Closed p-ob closed 3 years ago
Seems to be a problem with the following comment:
Any valid path to load a JSON file that adheres to the custom element manifest schema: {@link https://github.com/webcomponents/custom-elements-manifest/}
Removing this stops it from crashing. :
{@link https://github.com/webcomponents/custom-elements-manifest/}
Definitely a bug, not sure why this is happening exactly yet. I'll take a look and debug it.
Minimal repro:
@customElement("customelement-schema-viewer")
export class CustomElementSchemaViewerElement extends LitElement {
/**
* Any valid path to load a JSON file that adheres to the custom element manifest schema: {@link https://github.com/webcomponents/custom-elements-manifest/}
*/
src;
}
This should be fixed in https://github.com/open-wc/custom-elements-manifest/commit/03ade50e1db83c7cd6b946a7754dbb6bd6550f7f
Furthermore, I'd love to see the customelement-schema-viewer
component when it's done 😄 Please do share it with us!
Checklist
--dev
flag to get more information?In writing a custom element to render custom elements manifest in a friendly format, we've encountered an issue when trying to generate the custom element manifest for this component.
I've included a txt file at the end so I could identify the cyclical items in the object that is being passed to
JSON.stringify
We're using latest of lit (2.0.0-rc.2) and TypeScript 4.3.4.
Output
[COLLECT PHASE]: src/ce-schema-viewer.ts [ANALYZE PHASE]: src/ce-schema-viewer.ts [MODULE LINK PHASE]: src/ce-schema-viewer.ts [PACKAGE LINK PHASE] Waiting for the debugger to disconnect... file:///C:/code/zywave/custom-element-viewer/node_modules/@custom-elements-manifest/analyzer/index.js:78 fs.writeFileSync(`${process.cwd()}${path.sep}custom-elements.json`, `${JSON.stringify(customElementsManifest, null, 2)}\n`); ^ TypeError: Converting circular structure to JSON --> starting at object with constructor 'SourceFileObject' | property 'statements' -> object with constructor 'Array' | index 0 -> object with constructor 'NodeObject' --- property 'parent' closes the circle at JSON.stringify (Expected behavior I'd expect for the custom element manifest JSON file to generate.
Reproduction Repro
custom element manifest bug.txt