@storybook/angular-vite 11.0.0-alpha.1 → 11.0.0-alpha.2
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/build-schema.json +0 -4
- package/dist/_browser-chunks/{chunk-YQ53UO6D.js → chunk-BFQMI74D.js} +36 -25
- package/dist/_browser-chunks/{chunk-RPSYDPZX.js → chunk-K4OVBYYR.js} +1 -1
- package/dist/_browser-chunks/{chunk-PSE2PYUH.js → chunk-ONLO5U66.js} +4 -4
- package/dist/_browser-chunks/{chunk-SD6SKAYF.js → chunk-TN7UZNXT.js} +1 -1
- package/dist/_node-chunks/{chunk-GLAMVNEY.js → chunk-EOBWXGRJ.js} +6 -6
- package/dist/_node-chunks/{chunk-RUIEHCV7.js → chunk-IISTVQWO.js} +6 -6
- package/dist/_node-chunks/{chunk-FV5UMD2C.js → chunk-KE55VWWH.js} +22 -7
- package/dist/_node-chunks/{story-docs-template-analysis-GS3U7KVZ.js → story-docs-template-analysis-FVKKDKOD.js} +6 -6
- package/dist/builders/build-storybook/index.js +33 -29
- package/dist/builders/start-storybook/index.js +41 -31
- package/dist/client/config.js +2 -2
- package/dist/client/docs/config.js +2 -2
- package/dist/client/index.js +4 -4
- package/dist/docgen/docgen-worker.js +161 -81
- package/dist/index.d.ts +20 -859
- package/dist/index.js +4 -4
- package/dist/node/index.js +6 -6
- package/dist/node/vitest.js +6 -6
- package/dist/preset.js +20 -19
- package/package.json +7 -7
- package/start-schema.json +0 -4
- package/template/cli/header.component.ts +4 -1
- package/template/cli/page.component.ts +5 -3
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ayxk7ta37hg from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ayxk7ta37hg from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ayxk7ta37hg from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ayxk7ta37hg.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ayxk7ta37hg.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ayxk7ta37hg.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
resolveStoryComponent
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-EOBWXGRJ.js";
|
|
15
15
|
|
|
16
16
|
// src/docgen/docgen-worker.ts
|
|
17
17
|
import { STORY_FILE_TEST_REGEXP, getStoryImportPathFromEntry as getStoryImportPathFromEntry2 } from "storybook/internal/common";
|
|
18
18
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
19
19
|
|
|
20
20
|
// ../../lib/angular-cm/dist/index.js
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
21
|
+
import CJS_COMPAT_NODE_URL_s25cipixzl from "node:url";
|
|
22
|
+
import CJS_COMPAT_NODE_PATH_s25cipixzl from "node:path";
|
|
23
|
+
import CJS_COMPAT_NODE_MODULE_s25cipixzl from "node:module";
|
|
24
|
+
import { isInNodeModules } from "storybook/internal/common";
|
|
24
25
|
import {
|
|
25
26
|
ComponentMetaManager,
|
|
26
27
|
parseTsconfigCommandLine
|
|
27
28
|
} from "storybook/internal/component-meta";
|
|
28
|
-
import { isInNodeModules, slash } from "storybook/internal/common";
|
|
29
|
+
import { isInNodeModules as isInNodeModules2, slash } from "storybook/internal/common";
|
|
29
30
|
import {
|
|
30
31
|
extractComponentJsDocInfo,
|
|
31
32
|
ProgramBackedProject,
|
|
@@ -35,7 +36,123 @@ import { logger as logger3 } from "storybook/internal/node-logger";
|
|
|
35
36
|
import * as path from "node:path";
|
|
36
37
|
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
37
38
|
import { logger } from "storybook/internal/node-logger";
|
|
38
|
-
var __filename =
|
|
39
|
+
var __filename = CJS_COMPAT_NODE_URL_s25cipixzl.fileURLToPath(import.meta.url), __dirname = CJS_COMPAT_NODE_PATH_s25cipixzl.dirname(__filename), require2 = CJS_COMPAT_NODE_MODULE_s25cipixzl.createRequire(import.meta.url), resolvedSymbol = (ctx, node) => {
|
|
40
|
+
let symbol = ctx.checker.getSymbolAtLocation(node);
|
|
41
|
+
return symbol && symbol.flags & ctx.ts.SymbolFlags.Alias ? ctx.checker.getAliasedSymbol(symbol) : symbol;
|
|
42
|
+
}, resolvedNameSymbol = (ctx, name) => {
|
|
43
|
+
let symbol = ctx.checker.resolveName(name, ctx.sourceFile, ctx.ts.SymbolFlags.All, !1);
|
|
44
|
+
return symbol && symbol.flags & ctx.ts.SymbolFlags.Alias ? ctx.checker.getAliasedSymbol(symbol) : symbol;
|
|
45
|
+
}, decorationStripped = (line) => line.match(/^[ \t]*\*(?!\*)[ \t]?(.*)$/)?.[1], indentWidth = (line) => line.match(/^[ \t]*/)[0].length, cleanCommentText = (raw) => {
|
|
46
|
+
let lines = raw.split(`
|
|
47
|
+
`).map((line) => line.replace(/\r$/, "")), undecorated = lines.slice(1).filter((line) => line.trim() !== "" && decorationStripped(line) === void 0), margin = undecorated.length === 0 ? 0 : Math.min(...undecorated.map(indentWidth)), cleaned = lines.map((line, index) => {
|
|
48
|
+
if (line.trim() === "")
|
|
49
|
+
return "";
|
|
50
|
+
let stripped = decorationStripped(line);
|
|
51
|
+
return stripped !== void 0 ? stripped : index === 0 ? line.replace(/^[ \t]+/, "") : line.slice(margin);
|
|
52
|
+
});
|
|
53
|
+
for (; cleaned.length > 0 && cleaned[0] === ""; )
|
|
54
|
+
cleaned.shift();
|
|
55
|
+
return cleaned.join(`
|
|
56
|
+
`);
|
|
57
|
+
}, rawJsDocComment = (sourceText, jsDoc) => {
|
|
58
|
+
let end = jsDoc.tags?.length ? jsDoc.tags[0].pos : jsDoc.end;
|
|
59
|
+
return sourceText.slice(jsDoc.pos, end).replace(/^\/\*\*/, "").replace(/\*\/$/, "");
|
|
60
|
+
}, rawTagComment = (ts, sourceText, tag) => {
|
|
61
|
+
let start;
|
|
62
|
+
return ts.isJSDocSeeTag(tag) && tag.name ? start = tag.name.pos : tag.comment !== void 0 && (start = typeof tag.comment == "string" ? tag.getChildren().at(-1)?.end : tag.comment.pos, start ??= tag.tagName.end), start === void 0 ? void 0 : cleanCommentText(sourceText.slice(start, tag.end)).trimEnd();
|
|
63
|
+
};
|
|
64
|
+
function getJsDocDescription(ts, node) {
|
|
65
|
+
let sourceText = node.getSourceFile().text, jsDoc = ts.getJSDocCommentsAndTags(node).filter((doc) => ts.isJSDoc(doc)).at(-1), text = jsDoc?.comment === void 0 ? void 0 : cleanCommentText(rawJsDocComment(sourceText, jsDoc));
|
|
66
|
+
text = text?.replace(/^(?:[ \t]*\*+[ \t]*\n)+/, "").replace(/^[ \t]*\*+[ \t]*$/, "");
|
|
67
|
+
let descriptionTag = ts.getJSDocTags(node).find((tag) => tag.tagName.text === "description" && tag.comment !== void 0);
|
|
68
|
+
descriptionTag && (text = cleanCommentText(sourceText.slice(descriptionTag.tagName.end, descriptionTag.end)));
|
|
69
|
+
let trimmed = text?.replace(/\s+$/, "");
|
|
70
|
+
return trimmed ? { description: trimmed, rawdescription: trimmed } : {};
|
|
71
|
+
}
|
|
72
|
+
function getJsDocTags(ts, node) {
|
|
73
|
+
let tags = ts.getJSDocTags(node);
|
|
74
|
+
if (tags.length === 0)
|
|
75
|
+
return;
|
|
76
|
+
let sourceText = node.getSourceFile().text;
|
|
77
|
+
return tags.map((tag) => {
|
|
78
|
+
let name = tag.tagName.text, comment = rawTagComment(ts, sourceText, tag);
|
|
79
|
+
return { tagName: { text: name, escapedText: name }, ...comment === void 0 ? {} : { comment } };
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function getJsDocTagsField(ts, node) {
|
|
83
|
+
let tags = getJsDocTags(ts, node);
|
|
84
|
+
return tags ? { jsdoctags: tags } : {};
|
|
85
|
+
}
|
|
86
|
+
function hasJsDocTag(ts, node, tagName) {
|
|
87
|
+
return ts.getJSDocTags(node).some((tag) => tag.tagName.text === tagName);
|
|
88
|
+
}
|
|
89
|
+
var DETAIL_LINE_CAP = 20, isBareTypeName = (type) => /^[A-Za-z_$][\w$]*$/.test(type), namedTypeDetail = (context, type) => {
|
|
90
|
+
if (!isBareTypeName(type))
|
|
91
|
+
return;
|
|
92
|
+
let { ts } = context, walked = /* @__PURE__ */ new Set(), symbol = resolvedNameSymbol(context, type);
|
|
93
|
+
for (; symbol; ) {
|
|
94
|
+
let declaration = symbol.declarations?.find(
|
|
95
|
+
(candidate) => !candidate.getSourceFile().isDeclarationFile && !isInNodeModules(candidate.getSourceFile().fileName)
|
|
96
|
+
);
|
|
97
|
+
if (!declaration)
|
|
98
|
+
return;
|
|
99
|
+
if (ts.isEnumDeclaration(declaration))
|
|
100
|
+
return enumDetail(context, type, declaration);
|
|
101
|
+
if (ts.isInterfaceDeclaration(declaration))
|
|
102
|
+
return objectDetail(context, type, declaration.members);
|
|
103
|
+
if (ts.isTypeAliasDeclaration(declaration)) {
|
|
104
|
+
if (walked.has(declaration.name.text))
|
|
105
|
+
return;
|
|
106
|
+
if (walked.add(declaration.name.text), ts.isTypeLiteralNode(declaration.type))
|
|
107
|
+
return objectDetail(context, type, declaration.type.members);
|
|
108
|
+
if (ts.isTypeReferenceNode(declaration.type) && ts.isIdentifier(declaration.type.typeName)) {
|
|
109
|
+
symbol = resolvedNameSymbol(context, declaration.type.typeName.text);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}, detailLines = (lines) => lines.length > DETAIL_LINE_CAP ? [
|
|
117
|
+
...lines.slice(0, DETAIL_LINE_CAP).map((line) => ` ${line}`),
|
|
118
|
+
`\u2026 ${lines.length - DETAIL_LINE_CAP} more`
|
|
119
|
+
] : lines.map((line) => ` ${line}`), describedLine = (context, line, node) => {
|
|
120
|
+
let { rawdescription } = getJsDocDescription(context.ts, node);
|
|
121
|
+
return rawdescription === void 0 ? line : `${line} \u2014 ${rawdescription}`;
|
|
122
|
+
}, objectDetail = (context, header, members) => {
|
|
123
|
+
let { ts, types } = context;
|
|
124
|
+
if (!members)
|
|
125
|
+
return;
|
|
126
|
+
let lines = [];
|
|
127
|
+
for (let member of members) {
|
|
128
|
+
if (!ts.isPropertySignature(member) || member.type === void 0)
|
|
129
|
+
continue;
|
|
130
|
+
let optional = member.questionToken ? "?" : "";
|
|
131
|
+
lines.push(
|
|
132
|
+
describedLine(
|
|
133
|
+
context,
|
|
134
|
+
`${member.name.getText()}${optional}: ${types.render(member.type)}`,
|
|
135
|
+
member
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return lines.length === 0 ? void 0 : `${header} {
|
|
140
|
+
${detailLines(lines).join(`
|
|
141
|
+
`)}
|
|
142
|
+
}`;
|
|
143
|
+
}, enumDetail = (context, header, declaration) => {
|
|
144
|
+
let lines = [];
|
|
145
|
+
for (let member of declaration.members) {
|
|
146
|
+
let value = member.initializer?.getText();
|
|
147
|
+
lines.push(
|
|
148
|
+
describedLine(context, `${member.name.getText()}${value ? ` = ${value}` : ""}`, member)
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return lines.length === 0 ? void 0 : `${header} {
|
|
152
|
+
${detailLines(lines).join(`
|
|
153
|
+
`)}
|
|
154
|
+
}`;
|
|
155
|
+
}, NOOP_LOGGER = {
|
|
39
156
|
warn: () => {
|
|
40
157
|
},
|
|
41
158
|
debug: () => {
|
|
@@ -101,26 +218,26 @@ var __filename = CJS_COMPAT_NODE_URL_kao67mycvae.fileURLToPath(import.meta.url),
|
|
|
101
218
|
componentFile
|
|
102
219
|
);
|
|
103
220
|
return typeAlias ? (seen.add(type), resolveTypealias(typeAlias.rawtype, metadataJson, componentFile, seen)) : type;
|
|
104
|
-
}, isFunctionTypeString = (type) => type === "function" || /^(new\s+)?(<.*>\s*)?\(.*\)\s*=>/.test(type), extractType = (property, defaultValue, metadataJson, componentFile) => {
|
|
221
|
+
}, isFunctionTypeString = (type) => type === "function" || /^(new\s+)?(<.*>\s*)?\(.*\)\s*=>/.test(type), extractType = (property, defaultValue, metadataJson, componentFile, context) => {
|
|
105
222
|
let type = property.type || extractTypeFromValue(defaultValue);
|
|
106
223
|
switch (type) {
|
|
107
224
|
case "string":
|
|
108
225
|
case "boolean":
|
|
109
226
|
case "number":
|
|
110
|
-
return { name: type };
|
|
227
|
+
return { type: { name: type } };
|
|
111
228
|
case null:
|
|
112
|
-
return { name: "other", value: "void" };
|
|
229
|
+
return { type: { name: "other", value: "void" } };
|
|
113
230
|
default: {
|
|
114
231
|
if (typeof type == "string" && isFunctionTypeString(type))
|
|
115
|
-
return { name: "function" };
|
|
232
|
+
return { type: { name: "function" } };
|
|
116
233
|
let resolvedType = resolveTypealias(type, metadataJson, componentFile);
|
|
117
234
|
if (typeof resolvedType == "string" && resolvedType.indexOf("|") !== -1) {
|
|
118
235
|
let control = primitiveUnionControl([...new Set(selectableUnionMembers(resolvedType))]);
|
|
119
236
|
if (control)
|
|
120
|
-
return control;
|
|
237
|
+
return { type: control };
|
|
121
238
|
}
|
|
122
|
-
let enumValues = extractEnumValues(resolvedType, metadataJson, componentFile);
|
|
123
|
-
return
|
|
239
|
+
let enumValues = extractEnumValues(resolvedType, metadataJson, componentFile), sbType = enumValues ? { name: "enum", value: enumValues } : { name: "other", value: "empty-enum" }, detail = typeof type == "string" && context ? namedTypeDetail(context, type) : void 0;
|
|
240
|
+
return detail === void 0 ? { type: sbType } : { type: sbType, detail };
|
|
124
241
|
}
|
|
125
242
|
}
|
|
126
243
|
}, castUntypedDefault = (defaultValue) => {
|
|
@@ -215,7 +332,7 @@ var __filename = CJS_COMPAT_NODE_URL_kao67mycvae.fileURLToPath(import.meta.url),
|
|
|
215
332
|
let input = inputsByName.get(item.name);
|
|
216
333
|
return input?.line !== void 0 && input.line === item.line;
|
|
217
334
|
});
|
|
218
|
-
}, extractArgTypesFromData = (componentData, { metadataJson, propsTable, logger: logger42 = NOOP_LOGGER }) => {
|
|
335
|
+
}, extractArgTypesFromData = (componentData, { metadataJson, propsTable, logger: logger42 = NOOP_LOGGER, context }) => {
|
|
219
336
|
let sectionToItems = {}, componentClasses = propsTable === "inputs" ? ["inputsClass"] : ["propertiesClass", "methodsClass", "inputsClass", "outputsClass"], memberKeys = isDirectiveEntry(componentData) ? componentClasses : ["properties", "methods"], modelProperties = getModelProperties(componentData), modelPropertyNames = new Set(modelProperties.map((item) => item.name));
|
|
220
337
|
memberKeys.forEach((key) => {
|
|
221
338
|
readMembers(componentData, key).forEach((item) => {
|
|
@@ -228,7 +345,7 @@ var __filename = CJS_COMPAT_NODE_URL_kao67mycvae.fileURLToPath(import.meta.url),
|
|
|
228
345
|
);
|
|
229
346
|
return;
|
|
230
347
|
}
|
|
231
|
-
let defaultValue = isMethod(item) ? void 0 : extractDefaultValue(item, logger42), declaredType = isMethod(item) || section2 !== "inputs" && section2 !== "properties" ? { name: "other", value: "void" } : extractType(item, defaultValue, metadataJson, componentData.file), type = section2 === "inputs" && !isMethod(item) && isRequired(item) ? { ...declaredType, required: !0 } : declaredType, action = section2 === "outputs" ? { action: item.name } : {}, jsDocTags = extractMemberJsDocTags(item), argType = {
|
|
348
|
+
let defaultValue = isMethod(item) ? void 0 : extractDefaultValue(item, logger42), { type: declaredType, detail } = isMethod(item) || section2 !== "inputs" && section2 !== "properties" ? { type: { name: "other", value: "void" } } : extractType(item, defaultValue, metadataJson, componentData.file, context), type = section2 === "inputs" && !isMethod(item) && isRequired(item) ? { ...declaredType, required: !0 } : declaredType, action = section2 === "outputs" ? { action: item.name } : {}, jsDocTags = extractMemberJsDocTags(item), argType = {
|
|
232
349
|
name: item.name,
|
|
233
350
|
description: item.rawdescription || item.description,
|
|
234
351
|
type,
|
|
@@ -237,7 +354,8 @@ var __filename = CJS_COMPAT_NODE_URL_kao67mycvae.fileURLToPath(import.meta.url),
|
|
|
237
354
|
category: section2,
|
|
238
355
|
...jsDocTags !== void 0 ? { jsDocTags } : {},
|
|
239
356
|
type: {
|
|
240
|
-
summary: isMethod(item) ? displaySignature(item) : item.type
|
|
357
|
+
summary: isMethod(item) ? displaySignature(item) : item.type,
|
|
358
|
+
...detail !== void 0 ? { detail } : {}
|
|
241
359
|
},
|
|
242
360
|
defaultValue: { summary: defaultValue }
|
|
243
361
|
}
|
|
@@ -266,9 +384,6 @@ var __filename = CJS_COMPAT_NODE_URL_kao67mycvae.fileURLToPath(import.meta.url),
|
|
|
266
384
|
argTypes[argType.name] = argType;
|
|
267
385
|
});
|
|
268
386
|
}), argTypes;
|
|
269
|
-
}, resolvedSymbol = (ctx, node) => {
|
|
270
|
-
let symbol = ctx.checker.getSymbolAtLocation(node);
|
|
271
|
-
return symbol && symbol.flags & ctx.ts.SymbolFlags.Alias ? ctx.checker.getAliasedSymbol(symbol) : symbol;
|
|
272
387
|
}, isAngularCoreOrUnresolved = (ctx, node) => {
|
|
273
388
|
let symbol = resolvedSymbol(ctx, node);
|
|
274
389
|
if (!symbol)
|
|
@@ -417,51 +532,7 @@ var __filename = CJS_COMPAT_NODE_URL_kao67mycvae.fileURLToPath(import.meta.url),
|
|
|
417
532
|
...substitutions.size > 0 ? { substitutions } : {}
|
|
418
533
|
}
|
|
419
534
|
};
|
|
420
|
-
},
|
|
421
|
-
let lines = raw.split(`
|
|
422
|
-
`).map((line) => line.replace(/\r$/, "")), undecorated = lines.slice(1).filter((line) => line.trim() !== "" && decorationStripped(line) === void 0), margin = undecorated.length === 0 ? 0 : Math.min(...undecorated.map(indentWidth)), cleaned = lines.map((line, index) => {
|
|
423
|
-
if (line.trim() === "")
|
|
424
|
-
return "";
|
|
425
|
-
let stripped = decorationStripped(line);
|
|
426
|
-
return stripped !== void 0 ? stripped : index === 0 ? line.replace(/^[ \t]+/, "") : line.slice(margin);
|
|
427
|
-
});
|
|
428
|
-
for (; cleaned.length > 0 && cleaned[0] === ""; )
|
|
429
|
-
cleaned.shift();
|
|
430
|
-
return cleaned.join(`
|
|
431
|
-
`);
|
|
432
|
-
}, rawJsDocComment = (sourceText, jsDoc) => {
|
|
433
|
-
let end = jsDoc.tags?.length ? jsDoc.tags[0].pos : jsDoc.end;
|
|
434
|
-
return sourceText.slice(jsDoc.pos, end).replace(/^\/\*\*/, "").replace(/\*\/$/, "");
|
|
435
|
-
}, rawTagComment = (ts, sourceText, tag) => {
|
|
436
|
-
let start;
|
|
437
|
-
return ts.isJSDocSeeTag(tag) && tag.name ? start = tag.name.pos : tag.comment !== void 0 && (start = typeof tag.comment == "string" ? tag.getChildren().at(-1)?.end : tag.comment.pos, start ??= tag.tagName.end), start === void 0 ? void 0 : cleanCommentText(sourceText.slice(start, tag.end)).trimEnd();
|
|
438
|
-
};
|
|
439
|
-
function getJsDocDescription(ts, node) {
|
|
440
|
-
let sourceText = node.getSourceFile().text, jsDoc = ts.getJSDocCommentsAndTags(node).filter((doc) => ts.isJSDoc(doc)).at(-1), text = jsDoc?.comment === void 0 ? void 0 : cleanCommentText(rawJsDocComment(sourceText, jsDoc));
|
|
441
|
-
text = text?.replace(/^(?:[ \t]*\*+[ \t]*\n)+/, "").replace(/^[ \t]*\*+[ \t]*$/, "");
|
|
442
|
-
let descriptionTag = ts.getJSDocTags(node).find((tag) => tag.tagName.text === "description" && tag.comment !== void 0);
|
|
443
|
-
descriptionTag && (text = cleanCommentText(sourceText.slice(descriptionTag.tagName.end, descriptionTag.end)));
|
|
444
|
-
let trimmed = text?.replace(/\s+$/, "");
|
|
445
|
-
return trimmed ? { description: trimmed, rawdescription: trimmed } : {};
|
|
446
|
-
}
|
|
447
|
-
function getJsDocTags(ts, node) {
|
|
448
|
-
let tags = ts.getJSDocTags(node);
|
|
449
|
-
if (tags.length === 0)
|
|
450
|
-
return;
|
|
451
|
-
let sourceText = node.getSourceFile().text;
|
|
452
|
-
return tags.map((tag) => {
|
|
453
|
-
let name = tag.tagName.text, comment = rawTagComment(ts, sourceText, tag);
|
|
454
|
-
return { tagName: { text: name, escapedText: name }, ...comment === void 0 ? {} : { comment } };
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
function getJsDocTagsField(ts, node) {
|
|
458
|
-
let tags = getJsDocTags(ts, node);
|
|
459
|
-
return tags ? { jsdoctags: tags } : {};
|
|
460
|
-
}
|
|
461
|
-
function hasJsDocTag(ts, node, tagName) {
|
|
462
|
-
return ts.getJSDocTags(node).some((tag) => tag.tagName.text === tagName);
|
|
463
|
-
}
|
|
464
|
-
var memberName = (ts, name) => ts.isComputedPropertyName(name) ? name.getText() : name.text, SIGNAL_INPUT_NAMES = /* @__PURE__ */ new Set(["input", "model"]), SIGNAL_NAMES = /* @__PURE__ */ new Set(["input", "output", "model"]), SIGNAL_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
535
|
+
}, memberName = (ts, name) => ts.isComputedPropertyName(name) ? name.getText() : name.text, SIGNAL_INPUT_NAMES = /* @__PURE__ */ new Set(["input", "model"]), SIGNAL_NAMES = /* @__PURE__ */ new Set(["input", "output", "model"]), SIGNAL_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
465
536
|
"InputSignal",
|
|
466
537
|
"InputSignalWithTransform",
|
|
467
538
|
"ModelSignal",
|
|
@@ -1171,8 +1242,11 @@ var stripImportQualifiers = (text) => text.replace(/import\("[^"]*"\)\./g, ""),
|
|
|
1171
1242
|
}
|
|
1172
1243
|
}
|
|
1173
1244
|
};
|
|
1174
|
-
function
|
|
1175
|
-
|
|
1245
|
+
function analyzerContext(ts, sourceFile, checker) {
|
|
1246
|
+
return { ts, checker, types: new TypeIndex(ts, checker), sourceFile };
|
|
1247
|
+
}
|
|
1248
|
+
function analyzeSourceFile(ts, sourceFile, checker, context = analyzerContext(ts, sourceFile, checker)) {
|
|
1249
|
+
let ctx = context, meta = {
|
|
1176
1250
|
components: [],
|
|
1177
1251
|
directives: [],
|
|
1178
1252
|
pipes: [],
|
|
@@ -1182,7 +1256,7 @@ function analyzeSourceFile(ts, sourceFile, checker) {
|
|
|
1182
1256
|
};
|
|
1183
1257
|
for (let statement of sourceFile.statements) {
|
|
1184
1258
|
if (ts.isEnumDeclaration(statement) || ts.isTypeAliasDeclaration(statement)) {
|
|
1185
|
-
types.addDeclaration(statement);
|
|
1259
|
+
ctx.types.addDeclaration(statement);
|
|
1186
1260
|
continue;
|
|
1187
1261
|
}
|
|
1188
1262
|
if (!ts.isClassDeclaration(statement) || !statement.name)
|
|
@@ -1250,7 +1324,7 @@ function analyzeSourceFile(ts, sourceFile, checker) {
|
|
|
1250
1324
|
meta.classes.push(record);
|
|
1251
1325
|
}
|
|
1252
1326
|
}
|
|
1253
|
-
return meta.miscellaneous = types.toMiscellaneous(), meta;
|
|
1327
|
+
return meta.miscellaneous = ctx.types.toMiscellaneous(), meta;
|
|
1254
1328
|
}
|
|
1255
1329
|
var KNOWN_DECORATORS = {
|
|
1256
1330
|
Component: "component",
|
|
@@ -1327,18 +1401,19 @@ var KNOWN_DECORATORS = {
|
|
|
1327
1401
|
this.debug(`${fileName} left the program while being refreshed`);
|
|
1328
1402
|
return;
|
|
1329
1403
|
}
|
|
1330
|
-
let checker = program.getTypeChecker(), fileMeta = analyzeSourceFile(this.typescript, sourceFile, checker), entry = this.pickEntry(fileMeta, sourceFile, names);
|
|
1404
|
+
let checker = program.getTypeChecker(), context = analyzerContext(this.typescript, sourceFile, checker), fileMeta = analyzeSourceFile(this.typescript, sourceFile, checker, context), entry = this.pickEntry(fileMeta, sourceFile, names);
|
|
1331
1405
|
if (entry)
|
|
1332
1406
|
return this.debug(`${describe(entry)} from ${fileName}`), {
|
|
1333
1407
|
entry,
|
|
1334
1408
|
json: fileMeta,
|
|
1409
|
+
context,
|
|
1335
1410
|
...jsDocInfoField(
|
|
1336
1411
|
this.typescript,
|
|
1337
1412
|
checker,
|
|
1338
1413
|
findClassDeclaration(this.typescript, sourceFile, entry.name)
|
|
1339
1414
|
)
|
|
1340
1415
|
};
|
|
1341
|
-
let viaExports = this.extractViaModuleExports(checker, sourceFile, fileMeta, names);
|
|
1416
|
+
let viaExports = this.extractViaModuleExports(checker, sourceFile, fileMeta, context, names);
|
|
1342
1417
|
if (viaExports)
|
|
1343
1418
|
return this.debug(`${describe(viaExports.entry)} from ${fileName}, reached through its exports`), viaExports;
|
|
1344
1419
|
this.debug(
|
|
@@ -1364,7 +1439,7 @@ var KNOWN_DECORATORS = {
|
|
|
1364
1439
|
}
|
|
1365
1440
|
return findRecord(fileMeta, localName);
|
|
1366
1441
|
}
|
|
1367
|
-
extractViaModuleExports(checker, sourceFile, fileMeta, { exportName, localName }) {
|
|
1442
|
+
extractViaModuleExports(checker, sourceFile, fileMeta, context, { exportName, localName }) {
|
|
1368
1443
|
let { SymbolFlags, isClassDeclaration } = this.typescript, moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
1369
1444
|
if (!moduleSymbol)
|
|
1370
1445
|
return;
|
|
@@ -1378,11 +1453,12 @@ var KNOWN_DECORATORS = {
|
|
|
1378
1453
|
);
|
|
1379
1454
|
if (!declaration?.name || declaration.getSourceFile().isDeclarationFile)
|
|
1380
1455
|
continue;
|
|
1381
|
-
let declarationFile = declaration.getSourceFile(), targetMeta = declarationFile === sourceFile ? fileMeta : analyzeSourceFile(this.typescript, declarationFile, checker), entry = findRecord(targetMeta, declaration.name.text);
|
|
1456
|
+
let declarationFile = declaration.getSourceFile(), targetContext = declarationFile === sourceFile ? context : analyzerContext(this.typescript, declarationFile, checker), targetMeta = declarationFile === sourceFile ? fileMeta : analyzeSourceFile(this.typescript, declarationFile, checker, targetContext), entry = findRecord(targetMeta, declaration.name.text);
|
|
1382
1457
|
if (entry)
|
|
1383
1458
|
return {
|
|
1384
1459
|
entry,
|
|
1385
1460
|
json: targetMeta,
|
|
1461
|
+
context: targetContext,
|
|
1386
1462
|
...jsDocInfoField(this.typescript, checker, declaration)
|
|
1387
1463
|
};
|
|
1388
1464
|
}
|
|
@@ -1391,7 +1467,7 @@ var KNOWN_DECORATORS = {
|
|
|
1391
1467
|
let checker = program.getTypeChecker(), closure = /* @__PURE__ */ new Set(), queue = [entry];
|
|
1392
1468
|
for (; queue.length > 0; ) {
|
|
1393
1469
|
let file = queue.pop();
|
|
1394
|
-
if (!(closure.has(file.fileName) ||
|
|
1470
|
+
if (!(closure.has(file.fileName) || isInNodeModules2(file.fileName))) {
|
|
1395
1471
|
closure.add(file.fileName);
|
|
1396
1472
|
for (let statement of file.statements) {
|
|
1397
1473
|
let specifier = typescript.isImportDeclaration(statement) || typescript.isExportDeclaration(statement) ? statement.moduleSpecifier : void 0;
|
|
@@ -1649,11 +1725,15 @@ Check that the file exports the component class and is covered by a tsconfig.jso
|
|
|
1649
1725
|
let argTypes = extractArgTypesFromData(meta.entry, {
|
|
1650
1726
|
metadataJson: meta.json,
|
|
1651
1727
|
propsTable: options.propsTable,
|
|
1652
|
-
logger: logger5
|
|
1728
|
+
logger: logger5,
|
|
1729
|
+
// Named-type table detail resolves against the analyzer's live context; absent for stubbed
|
|
1730
|
+
// analyzers, which keeps those payloads flat.
|
|
1731
|
+
context: meta.context
|
|
1653
1732
|
}), apiArgTypes = options.propsTable === "api" ? argTypes : extractArgTypesFromData(meta.entry, {
|
|
1654
1733
|
metadataJson: meta.json,
|
|
1655
1734
|
propsTable: "api",
|
|
1656
|
-
logger: logger5
|
|
1735
|
+
logger: logger5,
|
|
1736
|
+
context: meta.context
|
|
1657
1737
|
}), jsDocTags = meta.jsDocInfo?.jsDocTags ?? analyzerJsDocTags(meta.entry), description = describedBy(meta.jsDocInfo?.description) ?? describedBy(meta.entry.rawdescription) ?? describedBy(meta.entry.description);
|
|
1658
1738
|
return {
|
|
1659
1739
|
...base,
|