@wc-toolkit/cem-generator-fast 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +18 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export function fastPlugin() {
|
|
|
27
27
|
summary: classDoc.summary,
|
|
28
28
|
deprecated: classDoc.deprecated,
|
|
29
29
|
tagName: classDoc.tagName ?? tagName,
|
|
30
|
-
superclass:
|
|
30
|
+
superclass: getFastSuperclass(node, context.checker),
|
|
31
31
|
members,
|
|
32
32
|
attributes: mergeByName(attributes, classDoc.attributes),
|
|
33
33
|
slots: mergeByName(discovered.slots, classDoc.slots),
|
|
@@ -56,6 +56,23 @@ export function fastPlugin() {
|
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
+
function getFastSuperclass(node, checker) {
|
|
60
|
+
const heritage = node.heritageClauses?.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword);
|
|
61
|
+
const expression = heritage?.types[0]?.expression;
|
|
62
|
+
if (!expression || !ts.isIdentifier(expression)) {
|
|
63
|
+
return { name: "FASTElement", module: "@microsoft/fast-element" };
|
|
64
|
+
}
|
|
65
|
+
const name = expression.text;
|
|
66
|
+
if (name === "FASTElement" || name === "FastElement") {
|
|
67
|
+
return { name: "FASTElement", module: "@microsoft/fast-element" };
|
|
68
|
+
}
|
|
69
|
+
const symbol = checker.getSymbolAtLocation(expression);
|
|
70
|
+
const resolved = symbol && symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
71
|
+
const declaration = resolved?.declarations?.find(ts.isClassDeclaration);
|
|
72
|
+
if (!declaration?.name)
|
|
73
|
+
return { name, module: "@microsoft/fast-element" };
|
|
74
|
+
return { name: declaration.name.text, module: declaration.getSourceFile().fileName };
|
|
75
|
+
}
|
|
59
76
|
function extendsFastElement(node, checker) {
|
|
60
77
|
const heritage = node.heritageClauses?.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword);
|
|
61
78
|
const seen = new Set();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wc-toolkit/cem-generator-fast",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "FAST detector plugin for generating Custom Elements Manifests.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"typescript": "^5.9.0",
|
|
33
|
-
"@wc-toolkit/cem-generator": "0.1.
|
|
33
|
+
"@wc-toolkit/cem-generator": "0.1.4",
|
|
34
34
|
"@wc-toolkit/cem-generator-utils": "0.1.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|