@storybook/angular-vite 11.0.0-rc.1 → 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.
@@ -1,14 +1,10 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __export = (target, all) => {
4
- for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: !0 });
6
- };
7
- var __decorateClass = (decorators, target, key, kind) => {
8
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
9
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10
- return kind && result && __defProp(target, key, result), result;
11
- }, __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
1
+ import {
2
+ __decorateClass,
3
+ __decorateParam,
4
+ __export,
5
+ inputBinding,
6
+ isValidIdentifier
7
+ } from "./chunk-T4WQC6BZ.js";
12
8
 
13
9
  // src/client/render.ts
14
10
  var render_exports = {};
@@ -25,29 +21,6 @@ import { bootstrapApplication } from "@angular/platform-browser";
25
21
  import { BehaviorSubject } from "rxjs";
26
22
  import { stringify } from "telejson";
27
23
 
28
- // src/snippet-values.ts
29
- var isValidIdentifier = (name) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name), quoteExpressionString = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r")}'`, printExpressionValue = (value, unprintable) => {
30
- let parents = /* @__PURE__ */ new Set(), print = (value2) => {
31
- if (typeof value2 == "string")
32
- return quoteExpressionString(value2);
33
- if (unprintable && hasNoExpression(value2, parents))
34
- return unprintable();
35
- if (typeof value2 != "object" || value2 === null)
36
- return `${value2}`;
37
- parents.add(value2);
38
- let printed = Array.isArray(value2) ? `[${value2.map((element) => print(element ?? null)).join(", ")}]` : `{${Object.entries(value2).filter(([, entryValue]) => entryValue !== void 0).map(
39
- ([key, entryValue]) => `${isValidIdentifier(key) ? key : quoteExpressionString(key)}: ${print(entryValue)}`
40
- ).join(", ")}}`;
41
- return parents.delete(value2), printed;
42
- };
43
- return print(value);
44
- }, hasNoExpression = (value, parents) => {
45
- if (typeof value != "object" || value === null)
46
- return typeof value == "function" || typeof value == "symbol" || typeof value == "bigint";
47
- let prototype = Object.getPrototypeOf(value);
48
- return parents.has(value) || !Array.isArray(value) && prototype !== Object.prototype && prototype !== null;
49
- }, escapeAttributeExpression = (expression) => expression.replace(/&(?=#|\w+;)/g, "&").replace(/"/g, """), escapeTemplateLiteral = (template) => template.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), inputBinding = (name, expression) => `[${name}]="${expression}"`, textValue = (value) => typeof value == "string" ? value : typeof value == "number" || typeof value == "boolean" ? String(value) : void 0, angularText = (text) => text.includes("{{") ? void 0 : text.replace(/[{}@]|\$$/g, (syntax) => `&#${syntax.charCodeAt(0)};`);
50
-
51
24
  // src/template-grammar.ts
52
25
  var formatPropInTemplate = (propertyName) => isValidIdentifier(propertyName) ? propertyName : `this['${propertyName}']`, stringifyCircular = (obj) => {
53
26
  let seen = /* @__PURE__ */ new Set();
@@ -743,13 +716,6 @@ async function renderToCanvas({
743
716
  }
744
717
 
745
718
  export {
746
- __export,
747
- printExpressionValue,
748
- escapeAttributeExpression,
749
- escapeTemplateLiteral,
750
- inputBinding,
751
- textValue,
752
- angularText,
753
719
  formatPropInTemplate,
754
720
  isComponent,
755
721
  computesTemplateFromComponent,
@@ -1,9 +1,11 @@
1
1
  import {
2
- __export,
3
2
  computesTemplateFromComponent,
4
3
  render,
5
4
  renderToCanvas
6
- } from "./chunk-NEJ4XYRC.js";
5
+ } from "./chunk-6VSOLSRX.js";
6
+ import {
7
+ __export
8
+ } from "./chunk-T4WQC6BZ.js";
7
9
 
8
10
  // src/client/config.ts
9
11
  var config_exports = {};
@@ -1,13 +1,9 @@
1
1
  import {
2
- __export,
3
- angularText,
4
- computesTemplateSourceFromComponent,
5
- escapeAttributeExpression,
6
- escapeTemplateLiteral,
7
- inputBinding,
8
- printExpressionValue,
9
- textValue
10
- } from "./chunk-NEJ4XYRC.js";
2
+ computesTemplateSourceFromComponent
3
+ } from "./chunk-6VSOLSRX.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-T4WQC6BZ.js";
11
7
 
12
8
  // src/client/docs/config.ts
13
9
  var config_exports = {};
@@ -17,34 +13,6 @@ __export(config_exports, {
17
13
  });
18
14
  import { SourceType as SourceType2, getSourceSnippetRuntime } from "storybook/internal/docs-tools";
19
15
 
20
- // src/client/docs/print-hole.ts
21
- import {
22
- UnprintableArgError,
23
- unknownHoleKind
24
- } from "storybook/internal/docs-tools";
25
- var printHole = (hole, value) => {
26
- let arg = hole.arg ?? "", unprintable = () => {
27
- throw new UnprintableArgError(arg);
28
- }, expression = () => escapeAttributeExpression(printExpressionValue(value, unprintable));
29
- switch (hole.kind) {
30
- case "bind":
31
- return escapeTemplateLiteral(expression());
32
- case "prop":
33
- return value === void 0 || typeof value == "function" ? "" : escapeTemplateLiteral(inputBinding(arg, expression()));
34
- case "field":
35
- return printExpressionValue(value, unprintable);
36
- case "text":
37
- return escapeTemplateLiteral(text(value) ?? unprintable());
38
- default:
39
- return unknownHoleKind(hole.kind);
40
- }
41
- }, text = (value) => {
42
- if (value === void 0)
43
- return "";
44
- let printed = textValue(value);
45
- return printed === void 0 ? void 0 : angularText(printed);
46
- };
47
-
48
16
  // src/client/docs/sourceDecorator.ts
49
17
  import { SourceType } from "storybook/internal/docs-tools";
50
18
  import { useRef, emitTransformCode, useEffect } from "storybook/preview-api";
@@ -70,8 +38,7 @@ var snippetRuntime = getSourceSnippetRuntime(), parameters = {
70
38
  source: {
71
39
  type: SourceType2.DYNAMIC,
72
40
  // The server snippet is the TypeScript host component that renders the story.
73
- language: snippetRuntime === "server" ? "ts" : "html",
74
- ...snippetRuntime === "server" ? { printHole } : {}
41
+ language: snippetRuntime === "server" ? "ts" : "html"
75
42
  }
76
43
  }
77
44
  }, decorators = snippetRuntime === "preview" ? [sourceDecorator] : [];
@@ -0,0 +1,47 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: !0 });
6
+ };
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
9
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10
+ return kind && result && __defProp(target, key, result), result;
11
+ }, __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
12
+
13
+ // src/snippet-values.ts
14
+ var isValidIdentifier = (name) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name), quoteExpressionString = (value) => `'${value.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n").replace(/\r/g, "\\r")}'`, printExpressionValue = (value, unprintable) => {
15
+ let parents = /* @__PURE__ */ new Set(), print = (value2) => {
16
+ if (typeof value2 == "string")
17
+ return quoteExpressionString(value2);
18
+ if (unprintable && hasNoExpression(value2, parents))
19
+ return unprintable();
20
+ if (typeof value2 != "object" || value2 === null)
21
+ return `${value2}`;
22
+ parents.add(value2);
23
+ let printed = Array.isArray(value2) ? `[${value2.map((element) => print(element ?? null)).join(", ")}]` : `{${Object.entries(value2).filter(([, entryValue]) => entryValue !== void 0).map(
24
+ ([key, entryValue]) => `${isValidIdentifier(key) ? key : quoteExpressionString(key)}: ${print(entryValue)}`
25
+ ).join(", ")}}`;
26
+ return parents.delete(value2), printed;
27
+ };
28
+ return print(value);
29
+ }, hasNoExpression = (value, parents) => {
30
+ if (typeof value != "object" || value === null)
31
+ return typeof value == "function" || typeof value == "symbol" || typeof value == "bigint";
32
+ let prototype = Object.getPrototypeOf(value);
33
+ return parents.has(value) || !Array.isArray(value) && prototype !== Object.prototype && prototype !== null;
34
+ }, escapeAttributeExpression = (expression) => expression.replace(/&(?=#|\w+;)/g, "&").replace(/"/g, """), escapeTemplateLiteral = (template) => template.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), inputBinding = (name, expression) => `[${name}]="${expression}"`, textValue = (value) => typeof value == "string" ? value : typeof value == "number" || typeof value == "boolean" ? String(value) : void 0, angularText = (text) => text.includes("{{") ? void 0 : text.replace(/[{}@]|\$$/g, (syntax) => `&#${syntax.charCodeAt(0)};`);
35
+
36
+ export {
37
+ __export,
38
+ __decorateClass,
39
+ __decorateParam,
40
+ isValidIdentifier,
41
+ printExpressionValue,
42
+ escapeAttributeExpression,
43
+ escapeTemplateLiteral,
44
+ inputBinding,
45
+ textValue,
46
+ angularText
47
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  config_exports
3
- } from "./chunk-UOYFF56J.js";
3
+ } from "./chunk-IFJFIE3P.js";
4
4
  import {
5
5
  config_exports as config_exports2
6
- } from "./chunk-GGZHMF2V.js";
6
+ } from "./chunk-S752VTMD.js";
7
7
  import {
8
8
  computesTemplateFromComponent,
9
9
  formatPropInTemplate,
10
10
  isComponent,
11
11
  render_exports
12
- } from "./chunk-NEJ4XYRC.js";
12
+ } from "./chunk-6VSOLSRX.js";
13
13
 
14
14
  // src/client/portable-stories.ts
15
15
  import {
@@ -0,0 +1,42 @@
1
+ import {
2
+ angularText,
3
+ escapeAttributeExpression,
4
+ escapeTemplateLiteral,
5
+ inputBinding,
6
+ printExpressionValue,
7
+ textValue
8
+ } from "./chunk-T4WQC6BZ.js";
9
+
10
+ // src/client/docs/register-print-hole.ts
11
+ import { registerPrintHole } from "storybook/internal/docs-tools/snippets";
12
+
13
+ // src/client/docs/print-hole.ts
14
+ import {
15
+ UnprintableArgError,
16
+ unknownHoleKind
17
+ } from "storybook/internal/docs-tools/snippets";
18
+ var printHole = (hole, value) => {
19
+ let arg = hole.arg ?? "", unprintable = () => {
20
+ throw new UnprintableArgError(arg);
21
+ }, expression = () => escapeAttributeExpression(printExpressionValue(value, unprintable));
22
+ switch (hole.kind) {
23
+ case "bind":
24
+ return escapeTemplateLiteral(expression());
25
+ case "prop":
26
+ return value === void 0 || typeof value == "function" ? "" : escapeTemplateLiteral(inputBinding(arg, expression()));
27
+ case "field":
28
+ return printExpressionValue(value, unprintable);
29
+ case "text":
30
+ return escapeTemplateLiteral(text(value) ?? unprintable());
31
+ default:
32
+ return unknownHoleKind(hole.kind);
33
+ }
34
+ }, text = (value) => {
35
+ if (value === void 0)
36
+ return "";
37
+ let printed = textValue(value);
38
+ return printed === void 0 ? void 0 : angularText(printed);
39
+ };
40
+
41
+ // src/client/docs/register-print-hole.ts
42
+ registerPrintHole(printHole);
@@ -0,0 +1,6 @@
1
+ // src/builder-options-env.ts
2
+ var BUILDER_OPTIONS_ENV = "SB_ANGULAR_BUILDER_OPTIONS_JSON";
3
+
4
+ export {
5
+ BUILDER_OPTIONS_ENV
6
+ };
@@ -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.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify({
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.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify({
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.
@@ -2,11 +2,12 @@ import {
2
2
  argTypesEnhancers,
3
3
  decorateStory,
4
4
  parameters
5
- } from "../_browser-chunks/chunk-UOYFF56J.js";
5
+ } from "../_browser-chunks/chunk-IFJFIE3P.js";
6
6
  import {
7
7
  render,
8
8
  renderToCanvas
9
- } from "../_browser-chunks/chunk-NEJ4XYRC.js";
9
+ } from "../_browser-chunks/chunk-6VSOLSRX.js";
10
+ import "../_browser-chunks/chunk-T4WQC6BZ.js";
10
11
  export {
11
12
  decorateStory as applyDecorators,
12
13
  argTypesEnhancers,
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "../../_browser-chunks/chunk-GGZHMF2V.js";
5
- import "../../_browser-chunks/chunk-NEJ4XYRC.js";
4
+ } from "../../_browser-chunks/chunk-S752VTMD.js";
5
+ import "../../_browser-chunks/chunk-YS33I6LM.js";
6
+ import "../../_browser-chunks/chunk-6VSOLSRX.js";
7
+ import "../../_browser-chunks/chunk-T4WQC6BZ.js";
6
8
  export {
7
9
  decorators,
8
10
  parameters
@@ -0,0 +1,2 @@
1
+ import "../../_browser-chunks/chunk-YS33I6LM.js";
2
+ import "../../_browser-chunks/chunk-T4WQC6BZ.js";
@@ -5,10 +5,12 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "../_browser-chunks/chunk-BERN5EPJ.js";
9
- import "../_browser-chunks/chunk-UOYFF56J.js";
10
- import "../_browser-chunks/chunk-GGZHMF2V.js";
11
- import "../_browser-chunks/chunk-NEJ4XYRC.js";
8
+ } from "../_browser-chunks/chunk-Y5SREGLY.js";
9
+ import "../_browser-chunks/chunk-IFJFIE3P.js";
10
+ import "../_browser-chunks/chunk-S752VTMD.js";
11
+ import "../_browser-chunks/chunk-YS33I6LM.js";
12
+ import "../_browser-chunks/chunk-6VSOLSRX.js";
13
+ import "../_browser-chunks/chunk-T4WQC6BZ.js";
12
14
  export {
13
15
  __definePreview,
14
16
  applicationConfig,
@@ -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, storyFilePath) => {
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 ${storyFilePath}.`
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 ${storyFilePath} reached a binding that is a type-only or namespace import, which carries no class to document.
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 ${storyFilePath} sets no \`meta.${reference}\`.`);
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, storyFilePath, { manager, options, logger: logger8 }) => {
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 ?? storyFilePath}, reached while resolving \`meta.${reference}\` from ${storyFilePath}.
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 }, storyFilePath, storyImportPath, context) => {
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, storyFilePath);
2923
- return { name, path: storyImportPath, jsDocTags: {}, error };
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
- storyFilePath,
2930
+ story,
2930
2931
  context
2931
2932
  );
2932
2933
  if ("error" in docgen)
2933
- return { name, path: storyImportPath, jsDocTags: {}, error: docgen.error };
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(storyImportPath, storyFilePath, path2) : storyImportPath,
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", storyFilePath);
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, storyFilePath, storyImportPath, context)
2971
+ buildSubcomponentDocgen(subcomponent, story, context)
2977
2972
  ])
2978
2973
  );
2979
2974
  return {
package/dist/index.js CHANGED
@@ -5,10 +5,12 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "./_browser-chunks/chunk-BERN5EPJ.js";
9
- import "./_browser-chunks/chunk-UOYFF56J.js";
10
- import "./_browser-chunks/chunk-GGZHMF2V.js";
11
- import "./_browser-chunks/chunk-NEJ4XYRC.js";
8
+ } from "./_browser-chunks/chunk-Y5SREGLY.js";
9
+ import "./_browser-chunks/chunk-IFJFIE3P.js";
10
+ import "./_browser-chunks/chunk-S752VTMD.js";
11
+ import "./_browser-chunks/chunk-YS33I6LM.js";
12
+ import "./_browser-chunks/chunk-6VSOLSRX.js";
13
+ import "./_browser-chunks/chunk-T4WQC6BZ.js";
12
14
  export {
13
15
  __definePreview,
14
16
  applicationConfig,
@@ -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 ENV_KEY = "STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON", findNodeModulesRoots = (startDir) => {
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[ENV_KEY];
30
+ let existing = process.env[BUILDER_OPTIONS_ENV];
27
31
  return existing !== void 0 ? existing !== serialized && logger.warn(
28
- "[storybook-angular-vite] STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON 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."
29
- ) : process.env[ENV_KEY] = serialized, {
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";
@@ -1148,7 +1151,10 @@ var warnedMissingDocgenService = !1, getDocgenPayload = async (componentId) => {
1148
1151
  }, experimental_storyDocsProvider = createWorkerGatedStoryDocsProvider({
1149
1152
  label: "Angular",
1150
1153
  docgenWorker: fileURLToPath2(import.meta.resolve(DOCGEN_WORKER_SPECIFIER)),
1151
- build: (input) => buildStoryDocsPayload(input, { getDocgenPayload })
1154
+ build: (input) => buildStoryDocsPayload(input, { getDocgenPayload }),
1155
+ printHole: fileURLToPath2(
1156
+ import.meta.resolve("@storybook/angular-vite/internal/register-print-hole")
1157
+ )
1152
1158
  });
1153
1159
 
1154
1160
  // src/preset.ts
@@ -1187,11 +1193,10 @@ function resolveZoneless(angularBuilderOptions) {
1187
1193
  return angularBuilderOptions?.zoneless ?? !0;
1188
1194
  }
1189
1195
  var viteFinal = async (config, options) => {
1190
- if (!options.angularBuilderOptions && process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON)
1196
+ let bridgedBuilderOptions = process.env[BUILDER_OPTIONS_ENV];
1197
+ if (!options.angularBuilderOptions && bridgedBuilderOptions)
1191
1198
  try {
1192
- options.angularBuilderOptions = JSON.parse(
1193
- process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON
1194
- );
1199
+ options.angularBuilderOptions = JSON.parse(bridgedBuilderOptions);
1195
1200
  } catch {
1196
1201
  }
1197
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.1",
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",
@@ -37,6 +37,7 @@
37
37
  "./client/docs/config": "./dist/client/docs/config.js",
38
38
  "./client/preview-prod": "./dist/client/preview-prod.js",
39
39
  "./internal/docgen-worker": "./dist/docgen/docgen-worker.js",
40
+ "./internal/register-print-hole": "./dist/client/docs/register-print-hole.js",
40
41
  "./internal/vitest-compiler-setup": "./dist/client/vitest-compiler-setup.js",
41
42
  "./node": {
42
43
  "types": "./dist/node/index.d.ts",
@@ -64,7 +65,7 @@
64
65
  "!src/**/*"
65
66
  ],
66
67
  "dependencies": {
67
- "@storybook/builder-vite": "11.0.0-rc.1",
68
+ "@storybook/builder-vite": "11.0.0-rc.3",
68
69
  "telejson": "8.0.0",
69
70
  "ts-dedent": "^2.2.0",
70
71
  "vite": ">=8.0.0"
@@ -81,9 +82,9 @@
81
82
  "@angular/forms": "^21.2.14",
82
83
  "@angular/platform-browser": "^21.2.14",
83
84
  "@angular/platform-browser-dynamic": "^21.2.14",
84
- "@storybook/angular-cm": "11.0.0-rc.1",
85
- "@storybook/angular-compodoc": "11.0.0-rc.1",
86
- "@storybook/component-meta-typescript": "11.0.0-rc.1",
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",
87
88
  "@types/node": "^22.19.1",
88
89
  "empathic": "^2.0.0",
89
90
  "memfs": "^4.11.1",
@@ -106,7 +107,7 @@
106
107
  "rxjs": "^7.4.0",
107
108
  "sass": "^1.0.0",
108
109
  "sass-embedded": "^1.0.0",
109
- "storybook": "^11.0.0-rc.1",
110
+ "storybook": "^11.0.0-rc.3",
110
111
  "typescript": "^5.9.0 || ^6.0.0 || ^7.0.0",
111
112
  "vite": ">=8.0.0",
112
113
  "zone.js": ">=0.14.0"