Comments (5)
This was corrected in @custom-elements-manifest/analyzer v0.4.7 👍
from custom-elements-manifest.
I've ran into the situation myself a couple of times as well, where I need to find a class that is exported as default. I do think this is currently a limitation of the schema, and we should improve on this
from custom-elements-manifest.
Example case:
If we have a MyElement class we want to extend our element from, and then we want to backtrack from MyExtendingElement's "superclass.name" to find the declarations of it, we can't find it with the current information, as the name "MyElement" is not present in the declaration at all.
"declarations": [
{
"kind": "class",
"description": "",
"name": "default",
"superclass": {
"name": "HTMLElement"
},
"customElement": true
},
{
"kind": "class",
"description": "",
"name": "MyExtendingElement",
"superclass": {
"name": "MyElement",
"module": "src/my-element.js"
},
"tagName": "my-extending-element",
"customElement": true
}
],
from custom-elements-manifest.
The way this should work is the same for any export that renames the item: the export has a name that's independent of the declaration name.
export default class MyElement {}
should result in an export named "default" and a reference to a class declaration named "MyElement".
Same with a rename:
class MyElementImpl {}
export {MyElementImpl as MyElement}
should result in an export named "MyElement" and a reference to a class declaration named "MyElementImpl".
From the playground it looks like the analyzer is getting this wrong.
This:
"declarations": [
{
"kind": "class",
"description": "",
"name": "default",
"superclass": {
"name": "HTMLElement"
},
"customElement": true
},
Should be:
"declarations": [
{
"kind": "class",
"description": "",
"name": "MyElement",
"superclass": {
"name": "HTMLElement"
},
"customElement": true
},
iow, a declaration should never have the name "default", unless someone actually named a class/function/variable that.
from custom-elements-manifest.
Looks like this is being fixed in the Open WC analyzer. Closing here.
from custom-elements-manifest.
Related Issues (20)
- Generated schema contains errors HOT 3
- How to output `oneOf` for discriminated unions. HOT 1
- sync between source and manifest HOT 2
- Add support for package and element icons and screenshots HOT 1
- add funding links
- Add support for CSS CustomState
- Add support for symbol-named class members HOT 1
- Add support for including canonical URLs for References
- Needed styles for elements HOT 4
- Package name field HOT 1
- Ability to document type of detail property for CustomEvents HOT 5
- README should mention that manifest can (and should) be generated by a tool
- `tagName` should not be part of the manifest HOT 4
- Publish New Version HOT 1
- Access modifier issue on derived class HOT 1
- Status of the "manifest" HOT 4
- Deomnstration Project using the Manifest... HOT 1
- To which files should the manifest link. .ts, .js, both, ... HOT 8
- componentRegistered Information HOT 1
- desc.startsWith is not a function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from custom-elements-manifest.