@storybook/angular-vite 10.6.0-alpha.6 → 10.6.0-alpha.8
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 +33 -5
- package/dist/_browser-chunks/{chunk-CHMLOECK.js → chunk-AL7GEPYM.js} +15 -26
- package/dist/_browser-chunks/{chunk-HBLYOJ22.js → chunk-THQDNKQS.js} +3 -3
- package/dist/_browser-chunks/{chunk-ECGMCGUZ.js → chunk-UJ3I56EP.js} +6 -6
- package/dist/_browser-chunks/{chunk-BUNW7ROM.js → chunk-VP3W5GY3.js} +4 -4
- package/dist/_node-chunks/{chunk-ORVVXDOZ.js → chunk-5GTDRCMW.js} +18 -8
- package/dist/_node-chunks/{chunk-6P3TQP4W.js → chunk-DQYSVBAE.js} +7 -7
- package/dist/_node-chunks/chunk-FLU3HTGB.js +42 -0
- package/dist/_node-chunks/story-docs-template-analysis-LGFOFAHO.js +163 -0
- package/dist/builders/build-storybook/index.js +15 -10
- package/dist/builders/start-storybook/index.js +15 -10
- package/dist/chunk-Bv2XDHY-.d.ts +64 -0
- 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 +784 -286
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +6 -6
- package/dist/node/vitest.js +6 -6
- package/dist/preset.js +770 -197
- package/package.json +6 -6
- package/start-schema.json +33 -5
- package/dist/_node-chunks/chunk-5LXEVSHB.js +0 -35
- package/dist/chunk-D8_SR6hI.d.ts +0 -31
package/build-schema.json
CHANGED
|
@@ -60,16 +60,16 @@
|
|
|
60
60
|
},
|
|
61
61
|
"compodoc": {
|
|
62
62
|
"type": "boolean",
|
|
63
|
-
"description": "
|
|
64
|
-
"
|
|
63
|
+
"description": "Deprecated. Compodoc no longer runs.",
|
|
64
|
+
"x-deprecated": "Compodoc no longer runs. @storybook/angular-vite extracts Angular metadata in-process, so this option does nothing. Remove it from angular.json."
|
|
65
65
|
},
|
|
66
66
|
"compodocArgs": {
|
|
67
67
|
"type": "array",
|
|
68
|
-
"description": "
|
|
69
|
-
"default": ["-e", "json"],
|
|
68
|
+
"description": "Deprecated. Compodoc no longer runs.",
|
|
70
69
|
"items": {
|
|
71
70
|
"type": "string"
|
|
72
|
-
}
|
|
71
|
+
},
|
|
72
|
+
"x-deprecated": "Compodoc no longer runs. @storybook/angular-vite extracts Angular metadata in-process, so this option does nothing. Remove it from angular.json."
|
|
73
73
|
},
|
|
74
74
|
"statsJson": {
|
|
75
75
|
"type": ["boolean", "string"],
|
|
@@ -104,6 +104,34 @@
|
|
|
104
104
|
"items": {
|
|
105
105
|
"type": "string"
|
|
106
106
|
}
|
|
107
|
+
},
|
|
108
|
+
"sass": {
|
|
109
|
+
"description": "Options to pass to the sass preprocessor.",
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"fatalDeprecations": {
|
|
113
|
+
"description": "A set of deprecations to treat as fatal. If a deprecation warning of any provided type is encountered during compilation, the compiler will error instead. If a Version is provided, then all deprecations that were active in that compiler version will be treated as fatal.",
|
|
114
|
+
"type": "array",
|
|
115
|
+
"items": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"silenceDeprecations": {
|
|
120
|
+
"description": "A set of active deprecations to ignore. If a deprecation warning of any provided type is encountered during compilation, the compiler will ignore it instead.",
|
|
121
|
+
"type": "array",
|
|
122
|
+
"items": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"futureDeprecations": {
|
|
127
|
+
"description": "A set of future deprecations to opt into early. Future deprecations passed here will be treated as active by the compiler, emitting warnings as necessary.",
|
|
128
|
+
"type": "array",
|
|
129
|
+
"items": {
|
|
130
|
+
"type": "string"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"additionalProperties": false
|
|
107
135
|
}
|
|
108
136
|
},
|
|
109
137
|
"additionalProperties": false
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export,
|
|
3
3
|
computesTemplateFromComponent,
|
|
4
|
-
getComponentInputsOutputs,
|
|
5
4
|
render,
|
|
6
5
|
renderToCanvas
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UJ3I56EP.js";
|
|
8
7
|
|
|
9
8
|
// src/client/config.ts
|
|
10
9
|
var config_exports = {};
|
|
@@ -23,7 +22,7 @@ global.STORYBOOK_ENV = "angular";
|
|
|
23
22
|
// src/client/decorateStory.ts
|
|
24
23
|
import { sanitizeStoryContextUpdate } from "storybook/preview-api";
|
|
25
24
|
function decorateStory(mainStoryFn, decorators) {
|
|
26
|
-
return
|
|
25
|
+
return decorators.reduce(
|
|
27
26
|
(previousStoryFn, decorator) => (context) => decorator((update) => previousStoryFn({
|
|
28
27
|
...context,
|
|
29
28
|
...sanitizeStoryContextUpdate(update)
|
|
@@ -41,21 +40,10 @@ var prepareMain = (story, context) => {
|
|
|
41
40
|
function hasNoTemplate(template) {
|
|
42
41
|
return template == null;
|
|
43
42
|
}
|
|
44
|
-
var cleanArgsDecorator = (storyFn, context) => {
|
|
45
|
-
if (!context.argTypes || !context.args || Object.keys(context.argTypes).length === 0)
|
|
46
|
-
return storyFn();
|
|
47
|
-
let componentIO = context.component ? getComponentInputsOutputs(context.component) : { inputs: [], outputs: [] }, componentBindings = /* @__PURE__ */ new Set([
|
|
48
|
-
...componentIO.inputs.map((i) => i.templateName),
|
|
49
|
-
...componentIO.outputs.map((o) => o.templateName)
|
|
50
|
-
]), argsToClean = context.args;
|
|
51
|
-
return context.args = Object.entries(argsToClean).reduce((obj, [key, arg]) => {
|
|
52
|
-
let argType = context.argTypes[key];
|
|
53
|
-
return argType?.action || argType?.control || componentBindings.has(key) ? { ...obj, [key]: arg } : obj;
|
|
54
|
-
}, {}), storyFn();
|
|
55
|
-
};
|
|
56
43
|
|
|
57
44
|
// src/client/config.ts
|
|
58
45
|
import { enhanceArgTypes } from "storybook/internal/docs-tools";
|
|
46
|
+
import { global as global3 } from "@storybook/global";
|
|
59
47
|
|
|
60
48
|
// ../../../node_modules/entities/lib/esm/generated/decode-data-html.js
|
|
61
49
|
var decode_data_html_default = new Uint16Array(
|
|
@@ -422,7 +410,7 @@ var EncodingMode;
|
|
|
422
410
|
EncodingMode2[EncodingMode2.UTF8 = 0] = "UTF8", EncodingMode2[EncodingMode2.ASCII = 1] = "ASCII", EncodingMode2[EncodingMode2.Extensive = 2] = "Extensive", EncodingMode2[EncodingMode2.Attribute = 3] = "Attribute", EncodingMode2[EncodingMode2.Text = 4] = "Text";
|
|
423
411
|
})(EncodingMode || (EncodingMode = {}));
|
|
424
412
|
|
|
425
|
-
// ../../lib/angular-compodoc/dist/_browser-chunks/chunk-
|
|
413
|
+
// ../../lib/angular-compodoc/dist/_browser-chunks/chunk-FMGKBLGO.js
|
|
426
414
|
var NOOP_LOGGER = {
|
|
427
415
|
warn: () => {
|
|
428
416
|
},
|
|
@@ -497,7 +485,7 @@ var SECTION_ORDER = [
|
|
|
497
485
|
componentFile
|
|
498
486
|
);
|
|
499
487
|
return typeAlias ? (seen.add(compodocType), resolveTypealias(typeAlias.rawtype, compodocJson, componentFile, seen)) : compodocType;
|
|
500
|
-
}, isFunctionTypeString = (compodocType) => compodocType === "function" ||
|
|
488
|
+
}, isFunctionTypeString = (compodocType) => compodocType === "function" || /^(new\s+)?(<.*>\s*)?\(.*\)\s*=>/.test(compodocType), extractType = (property, defaultValue, compodocJson, componentFile, modern = !1) => {
|
|
501
489
|
let compodocType = property.type || extractTypeFromValue(defaultValue);
|
|
502
490
|
switch (compodocType) {
|
|
503
491
|
case "string":
|
|
@@ -602,12 +590,12 @@ var SECTION_ORDER = [
|
|
|
602
590
|
});
|
|
603
591
|
}, extractArgTypesFromData = (componentData, {
|
|
604
592
|
compodocJson,
|
|
605
|
-
filterNonInputControls,
|
|
593
|
+
filterNonInputControls: filterNonInputControls2,
|
|
606
594
|
logger: logger2 = NOOP_LOGGER,
|
|
607
595
|
unwrapHtml: unwrapHtml2,
|
|
608
596
|
modern = !1
|
|
609
597
|
}) => {
|
|
610
|
-
let sectionToItems = {}, componentClasses =
|
|
598
|
+
let sectionToItems = {}, componentClasses = filterNonInputControls2 ? ["inputsClass"] : ["propertiesClass", "methodsClass", "inputsClass", "outputsClass"], compodocClasses = isDirectiveEntry(componentData) ? componentClasses : ["properties", "methods"], modelProperties = getModelProperties(componentData), modelPropertyNames = new Set(modelProperties.map((item) => item.name));
|
|
611
599
|
compodocClasses.forEach((key) => {
|
|
612
600
|
readMembers(componentData, key).forEach((item) => {
|
|
613
601
|
if (modern && item.name.startsWith("#"))
|
|
@@ -663,27 +651,28 @@ import { logger } from "storybook/internal/client-logger";
|
|
|
663
651
|
import { global as global2 } from "@storybook/global";
|
|
664
652
|
var { FEATURES } = global2;
|
|
665
653
|
var getCompodocJson = () => global2.__STORYBOOK_COMPODOC_JSON__;
|
|
666
|
-
var unwrapHtml = (html) => new global2.DOMParser().parseFromString(html, "text/html").body.textContent ?? "", extractArgTypesFromData2 = (componentData) => extractArgTypesFromData(componentData, {
|
|
654
|
+
var unwrapHtml = (html) => new global2.DOMParser().parseFromString(html, "text/html").body.textContent ?? "", extractArgTypesFromData2 = (componentData, { filterNonInputControls: filterNonInputControls2 = FEATURES.angularFilterNonInputControls } = {}) => extractArgTypesFromData(componentData, {
|
|
667
655
|
compodocJson: getCompodocJson(),
|
|
668
|
-
|
|
669
|
-
// always thrown there rather than silently reading the flag as `false`.
|
|
670
|
-
filterNonInputControls: FEATURES.angularFilterNonInputControls,
|
|
656
|
+
filterNonInputControls: filterNonInputControls2,
|
|
671
657
|
logger,
|
|
672
658
|
unwrapHtml
|
|
673
|
-
}), extractArgTypes = (component) => {
|
|
659
|
+
}), extractArgTypes = (component, options) => {
|
|
674
660
|
let componentData = getComponentData(component, { compodocJson: getCompodocJson(), logger });
|
|
675
|
-
return componentData && extractArgTypesFromData2(componentData);
|
|
661
|
+
return componentData && extractArgTypesFromData2(componentData, options);
|
|
676
662
|
}, extractComponentDescription = (component) => {
|
|
677
663
|
let componentData = getComponentData(component, { compodocJson: getCompodocJson(), logger });
|
|
678
664
|
return componentData && (componentData.rawdescription || componentData.description);
|
|
679
665
|
};
|
|
680
666
|
|
|
667
|
+
// src/client/compodoc.ts
|
|
668
|
+
var filterNonInputControls = typeof STORYBOOK_ANGULAR_OPTIONS > "u" || STORYBOOK_ANGULAR_OPTIONS.propsTable === void 0 ? void 0 : STORYBOOK_ANGULAR_OPTIONS.propsTable === "inputs", extractArgTypes2 = (component) => extractArgTypes(component, { filterNonInputControls });
|
|
669
|
+
|
|
681
670
|
// src/client/config.ts
|
|
682
671
|
var parameters = {
|
|
683
672
|
renderer: "angular",
|
|
684
673
|
docs: {
|
|
685
674
|
story: { inline: !0 },
|
|
686
|
-
extractArgTypes,
|
|
675
|
+
extractArgTypes: (component) => global3.FEATURES?.experimentalDocgenServer === !0 ? {} : extractArgTypes2(component),
|
|
687
676
|
extractComponentDescription
|
|
688
677
|
}
|
|
689
678
|
}, argTypesEnhancers = [enhanceArgTypes];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
config_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AL7GEPYM.js";
|
|
4
4
|
import {
|
|
5
5
|
config_exports as config_exports2
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VP3W5GY3.js";
|
|
7
7
|
import {
|
|
8
8
|
computesTemplateFromComponent,
|
|
9
9
|
formatPropInTemplate,
|
|
10
10
|
isComponent,
|
|
11
11
|
render_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UJ3I56EP.js";
|
|
13
13
|
|
|
14
14
|
// src/client/portable-stories.ts
|
|
15
15
|
import {
|
|
@@ -64,27 +64,28 @@ var isValidIdentifier = (name) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name), forma
|
|
|
64
64
|
"source",
|
|
65
65
|
"track",
|
|
66
66
|
"wbr"
|
|
67
|
-
]), LEADING_CLASS = /^\..+/, LEADING_ATTRIBUTE = /^\[.+?]/, ID = /#([\w-]+)/, CLASS_RUN = /(\.[\w-]+)+/, ATTRIBUTE = /\[(.+?)]/g, ELEMENT_AND_ATTRIBUTES = /(\S+)(.*)/, MAX_SINGLE_LINE = 80, buildTemplate = (selector, { inputs, outputs, innerTemplate = "" }) => {
|
|
67
|
+
]), LEADING_CLASS = /^\..+/, LEADING_ATTRIBUTE = /^\[.+?]/, ID = /#([\w-]+)/, CLASS_RUN = /(\.[\w-]+)+/, ATTRIBUTE = /\[(.+?)]/g, ELEMENT_AND_ATTRIBUTES = /(\S+)(.*)/, MAX_SINGLE_LINE = 80, buildTemplate = (selector, { inputs, outputs, innerTemplate = "", selfClosing = !1 }) => {
|
|
68
68
|
let bindings = [
|
|
69
69
|
...inputs.map(({ name, expression }) => `[${name}]="${expression}"`),
|
|
70
70
|
...outputs.map((name) => `(${name})="${formatPropInTemplate(name)}($event)"`)
|
|
71
71
|
], firstSelector = selector.split(",")[0];
|
|
72
72
|
return (LEADING_CLASS.test(firstSelector) || LEADING_ATTRIBUTE.test(firstSelector) ? `div${firstSelector}` : firstSelector).replace(ID, ' id="$1"').replace(CLASS_RUN, (classes) => ` class="${classes.split(".").join(" ").trim()}"`).replace(ATTRIBUTE, " $1").replace(ELEMENT_AND_ATTRIBUTES, (_, element, attributes) => {
|
|
73
|
-
let inlineTag = `<${element}${attributes}${bindings.map((binding) => ` ${binding}`).join("")}`, inline =
|
|
73
|
+
let closesItself = VOID_ELEMENTS.has(element) || selfClosing && element.includes("-") && innerTemplate === "", inlineTag = `<${element}${attributes}${bindings.map((binding) => ` ${binding}`).join("")}`, inline = closesItself ? `${inlineTag} />` : `${inlineTag}>${innerTemplate}</${element}>`;
|
|
74
74
|
if (inline.length <= MAX_SINGLE_LINE || bindings.length === 0)
|
|
75
75
|
return inline;
|
|
76
76
|
let brokenTag = `<${element}${attributes}
|
|
77
77
|
${bindings.map((binding) => ` ${binding}`).join(`
|
|
78
78
|
`)}`;
|
|
79
|
-
if (
|
|
80
|
-
return `${brokenTag}
|
|
79
|
+
if (closesItself)
|
|
80
|
+
return selfClosing ? `${brokenTag}
|
|
81
|
+
/>` : `${brokenTag} />`;
|
|
81
82
|
let content = innerTemplate === "" ? `
|
|
82
83
|
` : `
|
|
83
84
|
${innerTemplate}
|
|
84
85
|
`;
|
|
85
86
|
return `${brokenTag}>${content}</${element}>`;
|
|
86
87
|
});
|
|
87
|
-
}, buildComponentOutletTemplate = (componentName) => `<ng-container *ngComponentOutlet="${componentName}"></ng-container>`;
|
|
88
|
+
}, buildComponentOutletTemplate = (componentName, { selfClosing = !1 } = {}) => selfClosing ? `<ng-container *ngComponentOutlet="${componentName}" />` : `<ng-container *ngComponentOutlet="${componentName}"></ng-container>`;
|
|
88
89
|
|
|
89
90
|
// src/client/renderer/utils/NgComponentAnalyzer.ts
|
|
90
91
|
import {
|
|
@@ -703,7 +704,6 @@ async function renderToCanvas({
|
|
|
703
704
|
export {
|
|
704
705
|
__export,
|
|
705
706
|
formatPropInTemplate,
|
|
706
|
-
getComponentInputsOutputs,
|
|
707
707
|
isComponent,
|
|
708
708
|
computesTemplateFromComponent,
|
|
709
709
|
computesTemplateSourceFromComponent,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export,
|
|
3
3
|
computesTemplateSourceFromComponent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UJ3I56EP.js";
|
|
5
5
|
|
|
6
6
|
// src/client/docs/config.ts
|
|
7
7
|
var config_exports = {};
|
|
@@ -31,14 +31,14 @@ var skipSourceRender = (context) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// src/client/docs/config.ts
|
|
34
|
-
var
|
|
34
|
+
var useStaticServiceSnippets = globalThis.FEATURES?.experimentalDocgenServer === !0, parameters = {
|
|
35
35
|
docs: {
|
|
36
36
|
source: {
|
|
37
37
|
type: SourceType2.DYNAMIC,
|
|
38
|
-
language
|
|
38
|
+
language: useStaticServiceSnippets ? "ts" : "html"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
}, decorators = [sourceDecorator];
|
|
41
|
+
}, decorators = useStaticServiceSnippets ? [] : [sourceDecorator];
|
|
42
42
|
|
|
43
43
|
export {
|
|
44
44
|
parameters,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,6 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_ze1vib595n.createRequire(import.meta.url);
|
|
|
12
12
|
|
|
13
13
|
// src/find-tsconfig.ts
|
|
14
14
|
import { getProjectRoot } from "storybook/internal/common";
|
|
15
|
+
import { resolve as resolve2 } from "node:path";
|
|
15
16
|
|
|
16
17
|
// ../../../node_modules/empathic/find.mjs
|
|
17
18
|
import { join as join2 } from "node:path";
|
|
@@ -42,9 +43,18 @@ function up2(name, options) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
// src/find-tsconfig.ts
|
|
45
|
-
var findTsconfigUp = (configDir) => up2("tsconfig.json", { cwd: configDir, last: getProjectRoot() })
|
|
46
|
+
var findTsconfigUp = (configDir) => up2("tsconfig.json", { cwd: configDir, last: getProjectRoot() }), resolveTsconfig = ({
|
|
47
|
+
workspaceRoot,
|
|
48
|
+
configDir,
|
|
49
|
+
tsConfig,
|
|
50
|
+
browserTsConfig
|
|
51
|
+
}) => {
|
|
52
|
+
let configured = tsConfig ?? findTsconfigUp(configDir) ?? browserTsConfig;
|
|
53
|
+
return configured ? resolve2(workspaceRoot, configured) : void 0;
|
|
54
|
+
};
|
|
46
55
|
|
|
47
56
|
export {
|
|
48
57
|
up2 as up,
|
|
49
|
-
findTsconfigUp
|
|
58
|
+
findTsconfigUp,
|
|
59
|
+
resolveTsconfig
|
|
50
60
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.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
|
up
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5GTDRCMW.js";
|
|
15
15
|
|
|
16
16
|
// ../../../node_modules/empathic/package.mjs
|
|
17
17
|
function up2(options) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/docgen/resolve-component.ts
|
|
14
|
+
import {
|
|
15
|
+
createMetaComponentResolver,
|
|
16
|
+
createModuleResolver,
|
|
17
|
+
jsTsSourceExtensions
|
|
18
|
+
} from "storybook/internal/common";
|
|
19
|
+
import { loadCsf } from "storybook/internal/csf-tools";
|
|
20
|
+
import { readFileSync } from "node:fs";
|
|
21
|
+
var resolveMetaComponent = createMetaComponentResolver(), storyImportResolver = createModuleResolver({
|
|
22
|
+
extensions: [...jsTsSourceExtensions],
|
|
23
|
+
mainFields: ["module", "main"],
|
|
24
|
+
tsconfig: "auto"
|
|
25
|
+
});
|
|
26
|
+
function parseStoryFile(storyFilePath, title) {
|
|
27
|
+
try {
|
|
28
|
+
let source = readFileSync(storyFilePath, "utf8");
|
|
29
|
+
return loadCsf(source, { makeTitle: () => title }).parse();
|
|
30
|
+
} catch {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function resolveStoryComponent(storyFilePath, title = "Docgen") {
|
|
35
|
+
let csf = parseStoryFile(storyFilePath, title);
|
|
36
|
+
return csf ? resolveMetaComponent(csf, storyFilePath) : { reason: "no-meta-component" };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
parseStoryFile,
|
|
41
|
+
resolveStoryComponent
|
|
42
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/docgen/story-docs-template-analysis.ts
|
|
14
|
+
import {
|
|
15
|
+
CombinedRecursiveAstVisitor,
|
|
16
|
+
ImplicitReceiver,
|
|
17
|
+
LiteralPrimitive,
|
|
18
|
+
PropertyRead,
|
|
19
|
+
R3TargetBinder,
|
|
20
|
+
ThisReceiver,
|
|
21
|
+
TmplAstTextAttribute,
|
|
22
|
+
parseTemplate
|
|
23
|
+
} from "@angular/compiler";
|
|
24
|
+
var StoryTemplateVisitor = class extends CombinedRecursiveAstVisitor {
|
|
25
|
+
constructor(target, expansions) {
|
|
26
|
+
super();
|
|
27
|
+
this.referencedNames = /* @__PURE__ */ new Set();
|
|
28
|
+
this.boundOutputs = /* @__PURE__ */ new Set();
|
|
29
|
+
this.errors = /* @__PURE__ */ new Set();
|
|
30
|
+
this.replacements = [];
|
|
31
|
+
this.seenExpansionMarkers = /* @__PURE__ */ new Set();
|
|
32
|
+
this.inEventHandler = !1;
|
|
33
|
+
this.target = target, this.expansions = expansions;
|
|
34
|
+
}
|
|
35
|
+
visitElement(element) {
|
|
36
|
+
this.recordExpansions(element.attributes, element.outputs), super.visitElement(element);
|
|
37
|
+
}
|
|
38
|
+
visitTemplate(template) {
|
|
39
|
+
this.recordExpansions(
|
|
40
|
+
[
|
|
41
|
+
...template.attributes,
|
|
42
|
+
...template.templateAttrs.filter(
|
|
43
|
+
(attribute) => attribute instanceof TmplAstTextAttribute
|
|
44
|
+
)
|
|
45
|
+
],
|
|
46
|
+
template.outputs
|
|
47
|
+
), super.visitTemplate(template);
|
|
48
|
+
}
|
|
49
|
+
visitPropertyRead(ast) {
|
|
50
|
+
this.recordComponentReference(ast), super.visitPropertyRead(ast, void 0);
|
|
51
|
+
}
|
|
52
|
+
visitSafePropertyRead(ast) {
|
|
53
|
+
this.recordComponentReference(ast), super.visitSafePropertyRead(ast, void 0);
|
|
54
|
+
}
|
|
55
|
+
visitKeyedRead(ast) {
|
|
56
|
+
this.recordComponentKey(ast), super.visitKeyedRead(ast, void 0);
|
|
57
|
+
}
|
|
58
|
+
visitSafeKeyedRead(ast) {
|
|
59
|
+
this.recordComponentKey(ast), super.visitSafeKeyedRead(ast, void 0);
|
|
60
|
+
}
|
|
61
|
+
visitCall(ast) {
|
|
62
|
+
let previous = this.builtinAnyReceiver;
|
|
63
|
+
this.builtinAnyReceiver = isBuiltinAnyCall(ast) ? ast.receiver : void 0;
|
|
64
|
+
try {
|
|
65
|
+
super.visitCall(ast, void 0);
|
|
66
|
+
} finally {
|
|
67
|
+
this.builtinAnyReceiver = previous;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
visitBoundEvent(event) {
|
|
71
|
+
this.boundOutputs.add(event.name);
|
|
72
|
+
let wasInEventHandler = this.inEventHandler;
|
|
73
|
+
this.inEventHandler = !0, super.visitBoundEvent(event), this.inEventHandler = wasInEventHandler;
|
|
74
|
+
}
|
|
75
|
+
recordComponentReference(ast) {
|
|
76
|
+
this.isComponentReceiver(ast.receiver) && this.target.getExpressionTarget(ast) === null && ast !== this.builtinAnyReceiver && !(this.inEventHandler && ast.name === "$event") && this.referencedNames.add(ast.name);
|
|
77
|
+
}
|
|
78
|
+
recordExpansions(attributes, outputs) {
|
|
79
|
+
let occupiedOutputs = new Set(outputs.map((output) => output.name)), markers = attributes.map((attribute) => ({ attribute, expansion: this.expansions.get(attribute.name) })).filter(
|
|
80
|
+
(entry) => entry.expansion !== void 0 && !this.seenExpansionMarkers.has(entry.attribute.name)
|
|
81
|
+
).sort(
|
|
82
|
+
(left, right) => left.attribute.sourceSpan.start.offset - right.attribute.sourceSpan.start.offset
|
|
83
|
+
);
|
|
84
|
+
for (let { attribute, expansion } of markers) {
|
|
85
|
+
this.seenExpansionMarkers.add(attribute.name);
|
|
86
|
+
let outputAttributes = expansion.outputAttributes.filter(
|
|
87
|
+
({ name }) => !occupiedOutputs.has(name)
|
|
88
|
+
);
|
|
89
|
+
outputAttributes.forEach(({ name }) => {
|
|
90
|
+
occupiedOutputs.add(name), this.boundOutputs.add(name);
|
|
91
|
+
}), this.replacements.push({
|
|
92
|
+
marker: attribute.name,
|
|
93
|
+
start: attribute.sourceSpan.start.offset,
|
|
94
|
+
end: attribute.sourceSpan.end.offset,
|
|
95
|
+
text: [...expansion.inputAttributes, ...outputAttributes.map(({ markup }) => markup)].join(
|
|
96
|
+
" "
|
|
97
|
+
)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
recordComponentKey(ast) {
|
|
102
|
+
!this.isComponentReceiver(ast.receiver) || this.target.getExpressionTarget(ast) !== null || (ast.key instanceof LiteralPrimitive && typeof ast.key.value == "string" ? this.referencedNames.add(ast.key.value) : this.errors.add("A component-root keyed read has a dynamic key."));
|
|
103
|
+
}
|
|
104
|
+
isComponentReceiver(receiver) {
|
|
105
|
+
return receiver instanceof ImplicitReceiver || receiver instanceof ThisReceiver;
|
|
106
|
+
}
|
|
107
|
+
}, isBuiltinAnyCall = (ast) => ast.receiver instanceof PropertyRead && ast.receiver.name === "$any" && ast.receiver.receiver instanceof ImplicitReceiver && !(ast.receiver.receiver instanceof ThisReceiver), analyzeStoryTemplate = (markup, expansions = []) => {
|
|
108
|
+
let expansionMap = new Map(expansions.map((expansion) => [expansion.marker, expansion]));
|
|
109
|
+
try {
|
|
110
|
+
let parsed = parseTemplate(markup, "storybook-template.html");
|
|
111
|
+
if (parsed.errors)
|
|
112
|
+
return {
|
|
113
|
+
kind: "unresolvable",
|
|
114
|
+
markup: materializeWithoutAnalysis(markup, expansions),
|
|
115
|
+
errors: parsed.errors.map((error) => error.toString())
|
|
116
|
+
};
|
|
117
|
+
let target = new R3TargetBinder(null).bind({ template: parsed.nodes }), visitor = new StoryTemplateVisitor(target, expansionMap);
|
|
118
|
+
parsed.nodes.forEach((node) => visitor.visit(node));
|
|
119
|
+
let missingExpansion = visitor.replacements.length !== expansions.length;
|
|
120
|
+
missingExpansion && visitor.errors.add("An argsToTemplate expression is not inside an element start tag.");
|
|
121
|
+
let materializedMarkup = missingExpansion ? materializeWithoutAnalysis(markup, expansions, visitor.replacements) : applyReplacements(markup, visitor.replacements);
|
|
122
|
+
return visitor.errors.size > 0 ? { kind: "unresolvable", markup: materializedMarkup, errors: [...visitor.errors] } : {
|
|
123
|
+
kind: "resolved",
|
|
124
|
+
markup: materializedMarkup,
|
|
125
|
+
referencedNames: [...visitor.referencedNames],
|
|
126
|
+
boundOutputs: [...visitor.boundOutputs]
|
|
127
|
+
};
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return {
|
|
130
|
+
kind: "unresolvable",
|
|
131
|
+
markup: materializeWithoutAnalysis(markup, expansions),
|
|
132
|
+
errors: [error instanceof Error ? error.message : String(error)]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}, applyReplacements = (markup, replacements) => {
|
|
136
|
+
let position = 0, materialized = "";
|
|
137
|
+
for (let replacement of [...replacements].sort((left, right) => left.start - right.start)) {
|
|
138
|
+
let precedingMarkup = markup.slice(position, replacement.start);
|
|
139
|
+
materialized += (replacement.text === "" ? precedingMarkup.trimEnd() : precedingMarkup) + replacement.text, position = replacement.end;
|
|
140
|
+
}
|
|
141
|
+
return materialized + markup.slice(position);
|
|
142
|
+
}, materializeWithoutAnalysis = (markup, expansions, replacements = []) => {
|
|
143
|
+
let replacedMarkers = new Set(replacements.map(({ marker }) => marker)), fallbackReplacements = expansions.flatMap((expansion) => {
|
|
144
|
+
if (replacedMarkers.has(expansion.marker))
|
|
145
|
+
return [];
|
|
146
|
+
let start = markup.indexOf(expansion.marker);
|
|
147
|
+
return start === -1 ? [] : [
|
|
148
|
+
{
|
|
149
|
+
marker: expansion.marker,
|
|
150
|
+
start,
|
|
151
|
+
end: start + expansion.marker.length,
|
|
152
|
+
text: [
|
|
153
|
+
...expansion.inputAttributes,
|
|
154
|
+
...expansion.outputAttributes.map(({ markup: attribute }) => attribute)
|
|
155
|
+
].join(" ")
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
});
|
|
159
|
+
return applyReplacements(markup, [...replacements, ...fallbackReplacements]);
|
|
160
|
+
};
|
|
161
|
+
export {
|
|
162
|
+
analyzeStoryTemplate
|
|
163
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
errorSummary,
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
up
|
|
16
|
-
} from "../../_node-chunks/chunk-
|
|
16
|
+
} from "../../_node-chunks/chunk-DQYSVBAE.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
18
|
+
resolveTsconfig
|
|
19
|
+
} from "../../_node-chunks/chunk-5GTDRCMW.js";
|
|
20
20
|
|
|
21
21
|
// src/builders/build-storybook/index.ts
|
|
22
22
|
import { readFileSync } from "node:fs";
|
|
@@ -91,7 +91,12 @@ async function setup(options, context) {
|
|
|
91
91
|
await context.getTargetOptions(browserTarget),
|
|
92
92
|
await context.getBuilderNameForTarget(browserTarget)
|
|
93
93
|
)), {
|
|
94
|
-
tsConfig:
|
|
94
|
+
tsConfig: resolveTsconfig({
|
|
95
|
+
workspaceRoot: context.workspaceRoot,
|
|
96
|
+
configDir: options.configDir,
|
|
97
|
+
tsConfig: options.tsConfig,
|
|
98
|
+
browserTsConfig: browserOptions?.tsConfig
|
|
99
|
+
})
|
|
95
100
|
};
|
|
96
101
|
}
|
|
97
102
|
async function runInstance(options) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_z1ub7mlv0j from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_z1ub7mlv0j from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_z1ub7mlv0j from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_z1ub7mlv0j.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_z1ub7mlv0j.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_z1ub7mlv0j.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
errorSummary,
|
|
14
14
|
printErrorDetails,
|
|
15
15
|
up
|
|
16
|
-
} from "../../_node-chunks/chunk-
|
|
16
|
+
} from "../../_node-chunks/chunk-DQYSVBAE.js";
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
} from "../../_node-chunks/chunk-
|
|
18
|
+
resolveTsconfig
|
|
19
|
+
} from "../../_node-chunks/chunk-5GTDRCMW.js";
|
|
20
20
|
|
|
21
21
|
// src/builders/start-storybook/index.ts
|
|
22
22
|
import { readFileSync } from "node:fs";
|
|
@@ -121,7 +121,12 @@ async function setup(options, context) {
|
|
|
121
121
|
await context.getTargetOptions(browserTarget),
|
|
122
122
|
await context.getBuilderNameForTarget(browserTarget)
|
|
123
123
|
)), {
|
|
124
|
-
tsConfig:
|
|
124
|
+
tsConfig: resolveTsconfig({
|
|
125
|
+
workspaceRoot: context.workspaceRoot,
|
|
126
|
+
configDir: options.configDir,
|
|
127
|
+
tsConfig: options.tsConfig,
|
|
128
|
+
browserTsConfig: browserOptions?.tsConfig
|
|
129
|
+
})
|
|
125
130
|
};
|
|
126
131
|
}
|
|
127
132
|
async function runInstance(options) {
|