@storybook/angular-vite 11.0.0-rc.2 → 11.0.0-rc.3
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.
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
resolveTsconfig
|
|
11
11
|
} from "../../_node-chunks/chunk-DSX4K57A.js";
|
|
12
|
+
import {
|
|
13
|
+
BUILDER_OPTIONS_ENV
|
|
14
|
+
} from "../../_node-chunks/chunk-P3P4Y7DE.js";
|
|
12
15
|
|
|
13
16
|
// src/builders/build-storybook/index.ts
|
|
14
17
|
import { readFileSync } from "node:fs";
|
|
@@ -68,7 +71,7 @@ var commandBuilder = async (options, context) => {
|
|
|
68
71
|
tsConfig,
|
|
69
72
|
statsJson: normalizeStatsJson(statsJson)
|
|
70
73
|
};
|
|
71
|
-
if (process.env
|
|
74
|
+
if (process.env[BUILDER_OPTIONS_ENV] = JSON.stringify({
|
|
72
75
|
...standaloneOptions.angularBuilderOptions,
|
|
73
76
|
// Style and load paths in the target options are workspace-root-relative; the addon-vitest
|
|
74
77
|
// child runs with a different Vite root, so it needs the workspace root to resolve them.
|
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
resolveTsconfig
|
|
11
11
|
} from "../../_node-chunks/chunk-DSX4K57A.js";
|
|
12
|
+
import {
|
|
13
|
+
BUILDER_OPTIONS_ENV
|
|
14
|
+
} from "../../_node-chunks/chunk-P3P4Y7DE.js";
|
|
12
15
|
|
|
13
16
|
// src/builders/start-storybook/index.ts
|
|
14
17
|
import { readFileSync } from "node:fs";
|
|
@@ -93,7 +96,7 @@ var commandBuilder = (options, context) => new Observable((observer) => {
|
|
|
93
96
|
statsJson: normalizeStatsJson(statsJson),
|
|
94
97
|
loglevel
|
|
95
98
|
};
|
|
96
|
-
process.env
|
|
99
|
+
process.env[BUILDER_OPTIONS_ENV] = JSON.stringify({
|
|
97
100
|
...standaloneOptions.angularBuilderOptions,
|
|
98
101
|
// Style and load paths in the target options are workspace-root-relative; the addon-vitest
|
|
99
102
|
// child runs with a different Vite root, so it needs the workspace root to resolve them.
|
|
@@ -2842,16 +2842,16 @@ var inputsOf = (entry) => "inputsClass" in entry ? entry.inputsClass ?? [] : [],
|
|
|
2842
2842
|
};
|
|
2843
2843
|
}, notFound = (message) => ({
|
|
2844
2844
|
error: { name: "AngularComponentMetaNotFound", message }
|
|
2845
|
-
}), unresolvedError = (resolution, reference,
|
|
2845
|
+
}), unresolvedError = (resolution, reference, storyImportPath) => {
|
|
2846
2846
|
switch (resolution.reason) {
|
|
2847
2847
|
case "unreadable-component-expression":
|
|
2848
2848
|
return notFound(
|
|
2849
2849
|
`The story file sets \`${reference}: ${resolution.expression}\`, which does not resolve to a class.
|
|
2850
|
-
Storybook follows an imported name, a namespace-import property access, or a chain of property accesses and spreads through modules it can resolve. Assign the component to a name in ${
|
|
2850
|
+
Storybook follows an imported name, a namespace-import property access, or a chain of property accesses and spreads through modules it can resolve. Assign the component to a name in ${storyImportPath}.`
|
|
2851
2851
|
);
|
|
2852
2852
|
case "no-component-import":
|
|
2853
2853
|
return notFound(
|
|
2854
|
-
`Resolving \`meta.${reference}\` from ${
|
|
2854
|
+
`Resolving \`meta.${reference}\` from ${storyImportPath} reached a binding that is a type-only or namespace import, which carries no class to document.
|
|
2855
2855
|
Import the component as a value in whichever module declares that binding.`
|
|
2856
2856
|
);
|
|
2857
2857
|
case "missing-export":
|
|
@@ -2860,18 +2860,19 @@ Import the component as a value in whichever module declares that binding.`
|
|
|
2860
2860
|
Check the name against the module's exports, and any barrel that re-exports it.`
|
|
2861
2861
|
);
|
|
2862
2862
|
case "no-meta-component":
|
|
2863
|
-
return notFound(`The story file ${
|
|
2863
|
+
return notFound(`The story file ${storyImportPath} sets no \`meta.${reference}\`.`);
|
|
2864
2864
|
default: {
|
|
2865
2865
|
let unhandled = resolution;
|
|
2866
2866
|
throw new Error(`Unhandled resolution ${JSON.stringify(unhandled)}`);
|
|
2867
2867
|
}
|
|
2868
2868
|
}
|
|
2869
|
-
}, extractClassDocgen = (component, displayName, reference,
|
|
2869
|
+
}, extractClassDocgen = (component, displayName, reference, story, { manager, options, logger: logger8 }) => {
|
|
2870
|
+
let pathLikeStory = (file) => componentPathFromStory(story.importPath, story.filePath, file);
|
|
2870
2871
|
if (!component.path)
|
|
2871
2872
|
return notFound(
|
|
2872
2873
|
// The import can be written in another module the reference reaches, such as a barrel, so the
|
|
2873
2874
|
// message names the module that writes it.
|
|
2874
|
-
`Storybook could not resolve the import "${component.importId}" of "${displayName}" in ${component.importer
|
|
2875
|
+
`Storybook could not resolve the import "${component.importId}" of "${displayName}" in ${component.importer ? pathLikeStory(component.importer) : story.importPath}, reached while resolving \`meta.${reference}\` from ${story.importPath}.
|
|
2875
2876
|
Check the import specifier there, and any tsconfig path aliases it relies on.`
|
|
2876
2877
|
);
|
|
2877
2878
|
let meta;
|
|
@@ -2884,13 +2885,13 @@ Check the import specifier there, and any tsconfig path aliases it relies on.`
|
|
|
2884
2885
|
return {
|
|
2885
2886
|
error: {
|
|
2886
2887
|
name: "AngularComponentMetaExtractionFailed",
|
|
2887
|
-
message: `The analyzer threw while extracting "${component.exportName}" from ${component.path}: ${err instanceof Error ? err.message : String(err)}`
|
|
2888
|
+
message: `The analyzer threw while extracting "${component.exportName}" from ${pathLikeStory(component.path)}: ${err instanceof Error ? err.message : String(err)}`
|
|
2888
2889
|
}
|
|
2889
2890
|
};
|
|
2890
2891
|
}
|
|
2891
2892
|
if (!meta)
|
|
2892
2893
|
return notFound(
|
|
2893
|
-
`No metadata was extracted for the "${component.exportName}" export of ${component.path}.
|
|
2894
|
+
`No metadata was extracted for the "${component.exportName}" export of ${pathLikeStory(component.path)}.
|
|
2894
2895
|
Check that the file exports the component class and is covered by a tsconfig.json in or above its directory.`
|
|
2895
2896
|
);
|
|
2896
2897
|
let argTypes = extractArgTypesFromData(meta.entry, {
|
|
@@ -2916,25 +2917,25 @@ Check that the file exports the component class and is covered by a tsconfig.jso
|
|
|
2916
2917
|
apiDescription: buildApiDescription(apiArgTypes, meta.entry.name),
|
|
2917
2918
|
angularComponentMeta: metaToSnippetMeta(meta)
|
|
2918
2919
|
};
|
|
2919
|
-
}, displayNameOf = (component) => component.exportName === "default" ? component.localName : component.exportName, buildSubcomponentDocgen = ({ name, resolution },
|
|
2920
|
+
}, displayNameOf = (component) => component.exportName === "default" ? component.localName : component.exportName, buildSubcomponentDocgen = ({ name, resolution }, story, context) => {
|
|
2920
2921
|
let reference = `subcomponents.${name}`;
|
|
2921
2922
|
if ("reason" in resolution) {
|
|
2922
|
-
let { error } = unresolvedError(resolution, reference,
|
|
2923
|
-
return { name, path:
|
|
2923
|
+
let { error } = unresolvedError(resolution, reference, story.importPath);
|
|
2924
|
+
return { name, path: story.importPath, jsDocTags: {}, error };
|
|
2924
2925
|
}
|
|
2925
2926
|
let docgen = extractClassDocgen(
|
|
2926
2927
|
resolution.component,
|
|
2927
2928
|
displayNameOf(resolution.component),
|
|
2928
2929
|
reference,
|
|
2929
|
-
|
|
2930
|
+
story,
|
|
2930
2931
|
context
|
|
2931
2932
|
);
|
|
2932
2933
|
if ("error" in docgen)
|
|
2933
|
-
return { name, path:
|
|
2934
|
+
return { name, path: story.importPath, jsDocTags: {}, error: docgen.error };
|
|
2934
2935
|
let { angularComponentMeta: _, ...entry } = docgen, { path: path2 } = resolution.component;
|
|
2935
2936
|
return {
|
|
2936
2937
|
...entry,
|
|
2937
|
-
path: path2 ? componentPathFromStory(
|
|
2938
|
+
path: path2 ? componentPathFromStory(story.importPath, story.filePath, path2) : story.importPath,
|
|
2938
2939
|
renderer: "angular"
|
|
2939
2940
|
};
|
|
2940
2941
|
}, buildDocgenPayload = (input, context) => {
|
|
@@ -2952,7 +2953,7 @@ Check that the file exports the component class and is covered by a tsconfig.jso
|
|
|
2952
2953
|
);
|
|
2953
2954
|
return;
|
|
2954
2955
|
}
|
|
2955
|
-
let { error } = unresolvedError(resolved, "component",
|
|
2956
|
+
let { error } = unresolvedError(resolved, "component", storyImportPath);
|
|
2956
2957
|
return {
|
|
2957
2958
|
id,
|
|
2958
2959
|
name: resolved.reason === "unreadable-component-expression" ? resolved.expression : input.entry.title.split("/").at(-1) ?? input.entry.title,
|
|
@@ -2961,19 +2962,13 @@ Check that the file exports the component class and is covered by a tsconfig.jso
|
|
|
2961
2962
|
error
|
|
2962
2963
|
};
|
|
2963
2964
|
}
|
|
2964
|
-
let base = { id, name: displayNameOf(resolved.component), path: storyImportPath }, docgen = extractClassDocgen(
|
|
2965
|
-
resolved.component,
|
|
2966
|
-
base.name,
|
|
2967
|
-
"component",
|
|
2968
|
-
storyFilePath,
|
|
2969
|
-
context
|
|
2970
|
-
);
|
|
2965
|
+
let story = { importPath: storyImportPath, filePath: storyFilePath }, base = { id, name: displayNameOf(resolved.component), path: storyImportPath }, docgen = extractClassDocgen(resolved.component, base.name, "component", story, context);
|
|
2971
2966
|
if ("error" in docgen)
|
|
2972
2967
|
return { ...base, jsDocTags: {}, error: docgen.error };
|
|
2973
2968
|
let subcomponentEntries = Object.fromEntries(
|
|
2974
2969
|
subcomponents.map((subcomponent) => [
|
|
2975
2970
|
subcomponent.name,
|
|
2976
|
-
buildSubcomponentDocgen(subcomponent,
|
|
2971
|
+
buildSubcomponentDocgen(subcomponent, story, context)
|
|
2977
2972
|
])
|
|
2978
2973
|
);
|
|
2979
2974
|
return {
|
package/dist/node/vitest.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BUILDER_OPTIONS_ENV
|
|
3
|
+
} from "../_node-chunks/chunk-P3P4Y7DE.js";
|
|
4
|
+
|
|
1
5
|
// src/node/vitest.ts
|
|
2
6
|
import { existsSync } from "node:fs";
|
|
3
7
|
import { dirname, join, resolve } from "node:path";
|
|
4
8
|
import { logger } from "storybook/internal/node-logger";
|
|
5
9
|
import { normalizePath } from "vite";
|
|
6
|
-
var
|
|
10
|
+
var findNodeModulesRoots = (startDir) => {
|
|
7
11
|
let roots = [], dir = resolve(startDir);
|
|
8
12
|
for (; ; ) {
|
|
9
13
|
existsSync(join(dir, "node_modules")) && roots.push(normalizePath(dir));
|
|
@@ -23,10 +27,10 @@ function storybookAngularVitest(options = {}) {
|
|
|
23
27
|
`[storybook-angular-vite] storybookAngularVitest received non-serializable options: ${err.message}`
|
|
24
28
|
);
|
|
25
29
|
}
|
|
26
|
-
let existing = process.env[
|
|
30
|
+
let existing = process.env[BUILDER_OPTIONS_ENV];
|
|
27
31
|
return existing !== void 0 ? existing !== serialized && logger.warn(
|
|
28
|
-
|
|
29
|
-
) : process.env[
|
|
32
|
+
`[storybook-angular-vite] ${BUILDER_OPTIONS_ENV} is already set (likely by the Storybook CLI or the Vitest addon panel). Keeping the existing value; the options passed to storybookAngularVitest() are ignored in this run.`
|
|
33
|
+
) : process.env[BUILDER_OPTIONS_ENV] = serialized, {
|
|
30
34
|
name: "storybook:angular-vitest-options",
|
|
31
35
|
// Vitest augments Vite's `UserConfig` with `test`; assert the shape here rather than import
|
|
32
36
|
// Vitest's types, which would pull its whole type graph into the framework's d.ts build.
|
package/dist/preset.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findTsconfigUp
|
|
3
3
|
} from "./_node-chunks/chunk-DSX4K57A.js";
|
|
4
|
+
import {
|
|
5
|
+
BUILDER_OPTIONS_ENV
|
|
6
|
+
} from "./_node-chunks/chunk-P3P4Y7DE.js";
|
|
4
7
|
import {
|
|
5
8
|
parseStoryFile
|
|
6
9
|
} from "./_node-chunks/chunk-MIQVDAHU.js";
|
|
@@ -1190,11 +1193,10 @@ function resolveZoneless(angularBuilderOptions) {
|
|
|
1190
1193
|
return angularBuilderOptions?.zoneless ?? !0;
|
|
1191
1194
|
}
|
|
1192
1195
|
var viteFinal = async (config, options) => {
|
|
1193
|
-
|
|
1196
|
+
let bridgedBuilderOptions = process.env[BUILDER_OPTIONS_ENV];
|
|
1197
|
+
if (!options.angularBuilderOptions && bridgedBuilderOptions)
|
|
1194
1198
|
try {
|
|
1195
|
-
options.angularBuilderOptions = JSON.parse(
|
|
1196
|
-
process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON
|
|
1197
|
-
);
|
|
1199
|
+
options.angularBuilderOptions = JSON.parse(bridgedBuilderOptions);
|
|
1198
1200
|
} catch {
|
|
1199
1201
|
}
|
|
1200
1202
|
config.plugins = (config.plugins ?? []).flat().filter((plugin) => !plugin?.name?.includes("analogjs"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular-vite",
|
|
3
|
-
"version": "11.0.0-rc.
|
|
3
|
+
"version": "11.0.0-rc.3",
|
|
4
4
|
"description": "Storybook for Angular: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"!src/**/*"
|
|
66
66
|
],
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@storybook/builder-vite": "11.0.0-rc.
|
|
68
|
+
"@storybook/builder-vite": "11.0.0-rc.3",
|
|
69
69
|
"telejson": "8.0.0",
|
|
70
70
|
"ts-dedent": "^2.2.0",
|
|
71
71
|
"vite": ">=8.0.0"
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"@angular/forms": "^21.2.14",
|
|
83
83
|
"@angular/platform-browser": "^21.2.14",
|
|
84
84
|
"@angular/platform-browser-dynamic": "^21.2.14",
|
|
85
|
-
"@storybook/angular-cm": "11.0.0-rc.
|
|
86
|
-
"@storybook/angular-compodoc": "11.0.0-rc.
|
|
87
|
-
"@storybook/component-meta-typescript": "11.0.0-rc.
|
|
85
|
+
"@storybook/angular-cm": "11.0.0-rc.3",
|
|
86
|
+
"@storybook/angular-compodoc": "11.0.0-rc.3",
|
|
87
|
+
"@storybook/component-meta-typescript": "11.0.0-rc.3",
|
|
88
88
|
"@types/node": "^22.19.1",
|
|
89
89
|
"empathic": "^2.0.0",
|
|
90
90
|
"memfs": "^4.11.1",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"rxjs": "^7.4.0",
|
|
108
108
|
"sass": "^1.0.0",
|
|
109
109
|
"sass-embedded": "^1.0.0",
|
|
110
|
-
"storybook": "^11.0.0-rc.
|
|
110
|
+
"storybook": "^11.0.0-rc.3",
|
|
111
111
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
|
|
112
112
|
"vite": ">=8.0.0",
|
|
113
113
|
"zone.js": ">=0.14.0"
|