Consider custom element manifest files of imported packages
daKmoR opened this issue ยท 3 comments
daKmoR commented
my deps
node_modules/base/MyBase.js
node_modules/base/package.json
node_modules/base/custom-elements-manifst.json
๐ node_modules/base/MyBase.js
import { LitElement } from 'lit-element';
export class MyElement extends LitElement {
static get properties() {
return {
awesome: { type: Boolean }
}
}
constructor() {
super();
this.awesome = true;
}
}
๐ node_modules/base/custom-elements-manifst.json
// ...
"members": [
{
"kind": "field",
"name": "awesome",
"type": {
"text": "boolean"
},
"default": "true",
"privacy": "public",
"attribute": "awesome"
}
],
// ...
my element
class MyEl extends MyBase {
static get properties() {
return {
rainbow: { type: Boolean }
}
}
constructor() {
super();
this.rainbow = true;
}
}
Actual behavior
Generated CEM or docs for MyEl lists only rainbow
as a member but not awesome
.
// ...
"members": [
{
"kind": "field",
"name": "rainbow",
"type": {
"text": "boolean"
},
"default": "true",
"privacy": "public",
"attribute": "rainbow"
}
],
// ...
Expected behavior
Generated CEM or docs for MyEl should list rainbow
and awesome
as a member.
// ...
"members": [
{
"kind": "field",
"name": "rainbow",
"type": {
"text": "boolean"
},
"default": "true",
"privacy": "public",
"attribute": "rainbow"
},
{
"kind": "field",
"name": "awesome",
"type": {
"text": "boolean"
},
"default": "true",
"privacy": "public",
"attribute": "awesome",
"inheritedFrom": {
"name": "MyBase",
"module": "base/MyBase.js"
}
}
],
// ...
daKmoR commented
I think #129 will mean it analyzes the code in my node_modules?
but what I mean is that it reads the costume-elements-manifest.json
in node_modules and not the code. (e.g. do not analyze the code again)
thepassle commented
Ah yes I suppose we can try to see if the dependency doesnt already have a custom-elements-manifest.json
before we try to analyze. That might be hard because of the whole export map situation, but we can always analyze as a fallback. I'll take a look.