@storybook/angular-vite 11.0.0-beta.3 → 11.0.0-beta.5

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.
@@ -7,7 +7,7 @@ import {
7
7
  inputBinding,
8
8
  printExpressionValue,
9
9
  textValue
10
- } from "./chunk-FDLKT4EQ.js";
10
+ } from "./chunk-UU6I6OE3.js";
11
11
 
12
12
  // src/client/docs/config.ts
13
13
  var config_exports = {};
@@ -15,7 +15,7 @@ __export(config_exports, {
15
15
  decorators: () => decorators,
16
16
  parameters: () => parameters
17
17
  });
18
- import { SourceType as SourceType2 } from "storybook/internal/docs-tools";
18
+ import { SourceType as SourceType2, getSourceSnippetRuntime } from "storybook/internal/docs-tools";
19
19
 
20
20
  // src/client/docs/print-hole.ts
21
21
  import {
@@ -65,16 +65,16 @@ var skipSourceRender = (context) => {
65
65
  };
66
66
 
67
67
  // src/client/docs/config.ts
68
- var useStaticServiceSnippets = globalThis.FEATURES?.docgenServer === !0, parameters = {
68
+ var snippetRuntime = getSourceSnippetRuntime(), parameters = {
69
69
  docs: {
70
70
  source: {
71
71
  type: SourceType2.DYNAMIC,
72
- language: useStaticServiceSnippets ? "ts" : "html",
73
- // Prints a changed arg into the story-docs `template`, so the snippet follows the controls.
74
- ...useStaticServiceSnippets ? { printHole } : {}
72
+ // The server snippet is the TypeScript host component that renders the story.
73
+ language: snippetRuntime === "server" ? "ts" : "html",
74
+ ...snippetRuntime === "server" ? { printHole } : {}
75
75
  }
76
76
  }
77
- }, decorators = useStaticServiceSnippets ? [] : [sourceDecorator];
77
+ }, decorators = snippetRuntime === "preview" ? [sourceDecorator] : [];
78
78
 
79
79
  export {
80
80
  parameters,
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  config_exports
3
- } from "./chunk-JSKZYOEY.js";
3
+ } from "./chunk-GVR3YWT3.js";
4
4
  import {
5
5
  config_exports as config_exports2
6
- } from "./chunk-VA3FEKPB.js";
6
+ } from "./chunk-2JE7SKTX.js";
7
7
  import {
8
8
  computesTemplateFromComponent,
9
9
  formatPropInTemplate,
10
10
  isComponent,
11
11
  render_exports
12
- } from "./chunk-FDLKT4EQ.js";
12
+ } from "./chunk-UU6I6OE3.js";
13
13
 
14
14
  // src/client/portable-stories.ts
15
15
  import {
@@ -3,7 +3,7 @@ import {
3
3
  computesTemplateFromComponent,
4
4
  render,
5
5
  renderToCanvas
6
- } from "./chunk-FDLKT4EQ.js";
6
+ } from "./chunk-UU6I6OE3.js";
7
7
 
8
8
  // src/client/config.ts
9
9
  var config_exports = {};
@@ -519,7 +519,7 @@ var applicationRefs = /* @__PURE__ */ new Map(), STORY_UID_ATTRIBUTE = "data-sb-
519
519
  /** Wait and destroy the platform */
520
520
  static resetApplications(domNode) {
521
521
  applicationRefs.forEach((appRef, appDOMNode) => {
522
- if (!appRef.destroyed && (!domNode || appDOMNode === domNode))
522
+ if (!(domNode && appDOMNode !== domNode) && (applicationRefs.delete(appDOMNode), !appRef.destroyed))
523
523
  try {
524
524
  appRef.components.slice().forEach((componentRef) => componentRef.destroy());
525
525
  } finally {
@@ -1,17 +1,6 @@
1
- import CJS_COMPAT_NODE_URL_4pl39hy6w4x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4pl39hy6w4x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4pl39hy6w4x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_4pl39hy6w4x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4pl39hy6w4x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4pl39hy6w4x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
1
  import {
13
2
  up
14
- } from "./chunk-NV6YXVLU.js";
3
+ } from "./chunk-DSX4K57A.js";
15
4
 
16
5
  // ../../../node_modules/empathic/package.mjs
17
6
  function up2(options) {
@@ -1,15 +1,3 @@
1
- import CJS_COMPAT_NODE_URL_4pl39hy6w4x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4pl39hy6w4x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4pl39hy6w4x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_4pl39hy6w4x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4pl39hy6w4x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4pl39hy6w4x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
-
13
1
  // src/find-tsconfig.ts
14
2
  import { getProjectRoot } from "storybook/internal/common";
15
3
  import { resolve as resolve2 } from "node:path";
@@ -0,0 +1,37 @@
1
+ // src/docgen/resolve-component.ts
2
+ import {
3
+ createMetaComponentResolver,
4
+ createModuleResolver,
5
+ extractDeclaredSubcomponents,
6
+ jsTsSourceExtensions
7
+ } from "storybook/internal/common";
8
+ import { loadCsf } from "storybook/internal/csf-tools";
9
+ import { readFileSync } from "node:fs";
10
+ var resolveMetaComponent = createMetaComponentResolver(), storyImportResolver = createModuleResolver({
11
+ extensions: [...jsTsSourceExtensions],
12
+ mainFields: ["module", "main"],
13
+ tsconfig: "auto"
14
+ });
15
+ function parseStoryFile(storyFilePath, title) {
16
+ try {
17
+ let source = readFileSync(storyFilePath, "utf8");
18
+ return loadCsf(source, { makeTitle: () => title, fileName: storyFilePath }).parse();
19
+ } catch {
20
+ return;
21
+ }
22
+ }
23
+ function resolveStoryComponents(storyFilePath, title = "Docgen") {
24
+ let csf = parseStoryFile(storyFilePath, title);
25
+ return csf ? {
26
+ component: resolveMetaComponent(csf, storyFilePath),
27
+ subcomponents: extractDeclaredSubcomponents(csf).map(({ name, node }) => ({
28
+ name,
29
+ resolution: resolveMetaComponent(csf, storyFilePath, node)
30
+ }))
31
+ } : { component: { reason: "no-meta-component" }, subcomponents: [] };
32
+ }
33
+
34
+ export {
35
+ parseStoryFile,
36
+ resolveStoryComponents
37
+ };
@@ -1,15 +1,3 @@
1
- import CJS_COMPAT_NODE_URL_4pl39hy6w4x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4pl39hy6w4x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4pl39hy6w4x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_4pl39hy6w4x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4pl39hy6w4x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4pl39hy6w4x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
-
13
1
  // src/docgen/story-docs-template-analysis.ts
14
2
  import {
15
3
  CombinedRecursiveAstVisitor,
@@ -0,0 +1,8 @@
1
+ import {
2
+ analyzeStoryTemplate,
3
+ materializeLike
4
+ } from "./chunk-V5HMO3W7.js";
5
+ export {
6
+ analyzeStoryTemplate,
7
+ materializeLike
8
+ };
@@ -1,14 +1,3 @@
1
- import CJS_COMPAT_NODE_URL_4pl39hy6w4x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4pl39hy6w4x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4pl39hy6w4x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_4pl39hy6w4x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4pl39hy6w4x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4pl39hy6w4x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
1
  import {
13
2
  errorSummary,
14
3
  mergeBrowserTargetOptions,
@@ -16,10 +5,10 @@ import {
16
5
  printErrorDetails,
17
6
  requireBuilderTarget,
18
7
  up
19
- } from "../../_node-chunks/chunk-UTSO2W6Q.js";
8
+ } from "../../_node-chunks/chunk-AVIR5V77.js";
20
9
  import {
21
10
  resolveTsconfig
22
- } from "../../_node-chunks/chunk-NV6YXVLU.js";
11
+ } from "../../_node-chunks/chunk-DSX4K57A.js";
23
12
 
24
13
  // src/builders/build-storybook/index.ts
25
14
  import { readFileSync } from "node:fs";
@@ -53,7 +42,7 @@ var commandBuilder = async (options, context) => {
53
42
  sourceMap = !1,
54
43
  preserveSymlinks = !1,
55
44
  zoneless = !0
56
- } = options, packageJsonPath = up({ cwd: __dirname }), packageJson = packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null, declaredOptions = resolvedTarget ? await context.getTargetOptions(requireBuilderTarget(context)) : options, angularBuilderOptions = mergeBrowserTargetOptions(
45
+ } = options, packageJsonPath = up({ cwd: import.meta.dirname }), packageJson = packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null, declaredOptions = resolvedTarget ? await context.getTargetOptions(requireBuilderTarget(context)) : options, angularBuilderOptions = mergeBrowserTargetOptions(
57
46
  {
58
47
  stylePreprocessorOptions: declaredOptions.stylePreprocessorOptions,
59
48
  styles: declaredOptions.styles,
@@ -79,9 +68,12 @@ var commandBuilder = async (options, context) => {
79
68
  tsConfig,
80
69
  statsJson: normalizeStatsJson(statsJson)
81
70
  };
82
- if (process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify(
83
- standaloneOptions.angularBuilderOptions
84
- ), await runInstance({ ...standaloneOptions, mode: "static" }), logTracker.shouldWriteLogsToFile) {
71
+ if (process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify({
72
+ ...standaloneOptions.angularBuilderOptions,
73
+ // Style and load paths in the target options are workspace-root-relative; the addon-vitest
74
+ // child runs with a different Vite root, so it needs the workspace root to resolve them.
75
+ workspaceRoot: context.workspaceRoot
76
+ }), await runInstance({ ...standaloneOptions, mode: "static" }), logTracker.shouldWriteLogsToFile) {
85
77
  let logFile = await logTracker.writeToFile(options.logfile);
86
78
  logger.info(`Debug logs are written to: ${logFile}`);
87
79
  }
@@ -1,14 +1,3 @@
1
- import CJS_COMPAT_NODE_URL_4pl39hy6w4x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_4pl39hy6w4x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_4pl39hy6w4x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_4pl39hy6w4x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_4pl39hy6w4x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_4pl39hy6w4x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
1
  import {
13
2
  errorSummary,
14
3
  mergeBrowserTargetOptions,
@@ -16,10 +5,10 @@ import {
16
5
  printErrorDetails,
17
6
  requireBuilderTarget,
18
7
  up
19
- } from "../../_node-chunks/chunk-UTSO2W6Q.js";
8
+ } from "../../_node-chunks/chunk-AVIR5V77.js";
20
9
  import {
21
10
  resolveTsconfig
22
- } from "../../_node-chunks/chunk-NV6YXVLU.js";
11
+ } from "../../_node-chunks/chunk-DSX4K57A.js";
23
12
 
24
13
  // src/builders/start-storybook/index.ts
25
14
  import { readFileSync } from "node:fs";
@@ -70,7 +59,7 @@ var commandBuilder = (options, context) => new Observable((observer) => {
70
59
  sourceMap = !1,
71
60
  preserveSymlinks = !1,
72
61
  zoneless = !0
73
- } = options, packageJsonPath = up({ cwd: __dirname }), packageJson = packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null, declaredOptions = resolvedTarget ? await context.getTargetOptions(requireBuilderTarget(context)) : options, angularBuilderOptions = mergeBrowserTargetOptions(
62
+ } = options, packageJsonPath = up({ cwd: import.meta.dirname }), packageJson = packageJsonPath != null ? JSON.parse(readFileSync(packageJsonPath, "utf8")) : null, declaredOptions = resolvedTarget ? await context.getTargetOptions(requireBuilderTarget(context)) : options, angularBuilderOptions = mergeBrowserTargetOptions(
74
63
  {
75
64
  stylePreprocessorOptions: declaredOptions.stylePreprocessorOptions,
76
65
  styles: declaredOptions.styles,
@@ -104,9 +93,12 @@ var commandBuilder = (options, context) => new Observable((observer) => {
104
93
  statsJson: normalizeStatsJson(statsJson),
105
94
  loglevel
106
95
  };
107
- process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify(
108
- standaloneOptions.angularBuilderOptions
109
- );
96
+ process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify({
97
+ ...standaloneOptions.angularBuilderOptions,
98
+ // Style and load paths in the target options are workspace-root-relative; the addon-vitest
99
+ // child runs with a different Vite root, so it needs the workspace root to resolve them.
100
+ workspaceRoot: context.workspaceRoot
101
+ });
110
102
  let startedPort = await runInstance(standaloneOptions);
111
103
  observer.next({ success: !0, info: { port: startedPort } });
112
104
  } catch (error) {
@@ -2,11 +2,11 @@ import {
2
2
  argTypesEnhancers,
3
3
  decorateStory,
4
4
  parameters
5
- } from "../_browser-chunks/chunk-JSKZYOEY.js";
5
+ } from "../_browser-chunks/chunk-GVR3YWT3.js";
6
6
  import {
7
7
  render,
8
8
  renderToCanvas
9
- } from "../_browser-chunks/chunk-FDLKT4EQ.js";
9
+ } from "../_browser-chunks/chunk-UU6I6OE3.js";
10
10
  export {
11
11
  decorateStory as applyDecorators,
12
12
  argTypesEnhancers,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  decorators,
3
3
  parameters
4
- } from "../../_browser-chunks/chunk-VA3FEKPB.js";
5
- import "../../_browser-chunks/chunk-FDLKT4EQ.js";
4
+ } from "../../_browser-chunks/chunk-2JE7SKTX.js";
5
+ import "../../_browser-chunks/chunk-UU6I6OE3.js";
6
6
  export {
7
7
  decorators,
8
8
  parameters
@@ -5,10 +5,10 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "../_browser-chunks/chunk-OAG3JRJQ.js";
9
- import "../_browser-chunks/chunk-JSKZYOEY.js";
10
- import "../_browser-chunks/chunk-VA3FEKPB.js";
11
- import "../_browser-chunks/chunk-FDLKT4EQ.js";
8
+ } from "../_browser-chunks/chunk-56QYE53C.js";
9
+ import "../_browser-chunks/chunk-GVR3YWT3.js";
10
+ import "../_browser-chunks/chunk-2JE7SKTX.js";
11
+ import "../_browser-chunks/chunk-UU6I6OE3.js";
12
12
  export {
13
13
  __definePreview,
14
14
  applicationConfig,