@storybook/angular-vite 0.0.0-canary-test → 0.0.0-canary

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,9 +1,10 @@
1
1
  import {
2
2
  __export,
3
3
  computesTemplateFromComponent,
4
+ getComponentInputsOutputs,
4
5
  render,
5
6
  renderToCanvas
6
- } from "./chunk-6U6AH4EH.js";
7
+ } from "./chunk-XUV22PT7.js";
7
8
 
8
9
  // src/client/config.ts
9
10
  var config_exports = {};
@@ -43,10 +44,13 @@ function hasNoTemplate(template) {
43
44
  var cleanArgsDecorator = (storyFn, context) => {
44
45
  if (!context.argTypes || !context.args || Object.keys(context.argTypes).length === 0)
45
46
  return storyFn();
46
- let argsToClean = context.args;
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;
47
51
  return context.args = Object.entries(argsToClean).reduce((obj, [key, arg]) => {
48
52
  let argType = context.argTypes[key];
49
- return argType?.action || argType?.control ? { ...obj, [key]: arg } : obj;
53
+ return argType?.action || argType?.control || componentBindings.has(key) ? { ...obj, [key]: arg } : obj;
50
54
  }, {}), storyFn();
51
55
  };
52
56
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __export,
3
3
  computesTemplateSourceFromComponent
4
- } from "./chunk-6U6AH4EH.js";
4
+ } from "./chunk-XUV22PT7.js";
5
5
 
6
6
  // src/client/docs/config.ts
7
7
  var config_exports = {};
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  config_exports
3
- } from "./chunk-CIJX6X7B.js";
3
+ } from "./chunk-A3YIOUBG.js";
4
4
  import {
5
5
  config_exports as config_exports2
6
- } from "./chunk-4WZEHS2U.js";
6
+ } from "./chunk-BDVIBYRD.js";
7
7
  import {
8
8
  computesTemplateFromComponent,
9
9
  formatPropInTemplate,
10
10
  isComponent,
11
11
  render_exports
12
- } from "./chunk-6U6AH4EH.js";
12
+ } from "./chunk-XUV22PT7.js";
13
13
 
14
14
  // src/client/portable-stories.ts
15
15
  import {
@@ -713,6 +713,7 @@ async function renderToCanvas({
713
713
 
714
714
  export {
715
715
  __export,
716
+ getComponentInputsOutputs,
716
717
  isComponent,
717
718
  formatPropInTemplate,
718
719
  computesTemplateFromComponent,
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w331jboqnti from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w331jboqnti from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w331jboqnti from "node:module";
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w331jboqnti.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w331jboqnti.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -56,35 +56,9 @@ var printErrorDetails = (error) => {
56
56
  You may need to refresh the browser.
57
57
  `;
58
58
 
59
- // src/builders/utils/run-compodoc.ts
60
- import { isAbsolute as isAbsolute2, relative } from "node:path";
61
- import { JsPackageManagerFactory } from "storybook/internal/common";
62
- import { prompt } from "storybook/internal/node-logger";
63
- var hasTsConfigArg = (args) => args.indexOf("-p") !== -1, hasOutputArg = (args) => args.indexOf("-d") !== -1 || args.indexOf("--output") !== -1, toRelativePath = (pathToTsConfig) => isAbsolute2(pathToTsConfig) ? relative(".", pathToTsConfig) : pathToTsConfig, runCompodoc = async ({ compodocArgs, tsconfig }, context) => {
64
- let tsConfigPath = toRelativePath(tsconfig), finalCompodocArgs = [
65
- "compodoc",
66
- ...hasTsConfigArg(compodocArgs) ? [] : ["-p", tsConfigPath],
67
- ...hasOutputArg(compodocArgs) ? [] : ["-d", `${context.workspaceRoot || "."}`],
68
- ...compodocArgs
69
- ], packageManager = JsPackageManagerFactory.getPackageManager();
70
- await prompt.executeTaskWithSpinner(
71
- () => packageManager.runPackageCommand({
72
- args: finalCompodocArgs,
73
- cwd: context.workspaceRoot
74
- }),
75
- {
76
- id: "compodoc",
77
- intro: "Generating documentation with Compodoc",
78
- success: "Compodoc finished successfully",
79
- error: "Compodoc failed"
80
- }
81
- );
82
- };
83
-
84
59
  export {
85
60
  up2 as up,
86
61
  up3 as up2,
87
62
  printErrorDetails,
88
- errorSummary,
89
- runCompodoc
63
+ errorSummary
90
64
  };
@@ -0,0 +1,40 @@
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+
13
+ // src/builders/utils/run-compodoc.ts
14
+ import { isAbsolute, relative } from "node:path";
15
+ import { JsPackageManagerFactory } from "storybook/internal/common";
16
+ import { prompt } from "storybook/internal/node-logger";
17
+ var hasTsConfigArg = (args) => args.indexOf("-p") !== -1, hasOutputArg = (args) => args.indexOf("-d") !== -1 || args.indexOf("--output") !== -1, toRelativePath = (pathToTsConfig) => isAbsolute(pathToTsConfig) ? relative(".", pathToTsConfig) : pathToTsConfig, runCompodoc = async (opts) => {
18
+ let { compodocArgs, tsconfig, workspaceRoot } = opts, tsConfigPath = toRelativePath(tsconfig), finalCompodocArgs = [
19
+ "compodoc",
20
+ ...hasTsConfigArg(compodocArgs) ? [] : ["-p", tsConfigPath],
21
+ ...hasOutputArg(compodocArgs) ? [] : ["-d", `${workspaceRoot || "."}`],
22
+ ...compodocArgs
23
+ ], packageManager = JsPackageManagerFactory.getPackageManager();
24
+ await prompt.executeTaskWithSpinner(
25
+ () => packageManager.runPackageCommand({
26
+ args: finalCompodocArgs,
27
+ cwd: workspaceRoot
28
+ }),
29
+ {
30
+ id: "compodoc",
31
+ intro: "Generating documentation with Compodoc",
32
+ success: "Compodoc finished successfully",
33
+ error: "Compodoc failed"
34
+ }
35
+ );
36
+ };
37
+
38
+ export {
39
+ runCompodoc
40
+ };
@@ -0,0 +1,17 @@
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ runCompodoc
14
+ } from "./chunk-K236VAP6.js";
15
+ export {
16
+ runCompodoc
17
+ };
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w331jboqnti from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w331jboqnti from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w331jboqnti from "node:module";
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w331jboqnti.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w331jboqnti.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,10 +12,12 @@ var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
12
12
  import {
13
13
  errorSummary,
14
14
  printErrorDetails,
15
- runCompodoc,
16
15
  up,
17
16
  up2
18
- } from "../../_node-chunks/chunk-R2RNJVE7.js";
17
+ } from "../../_node-chunks/chunk-DORGYJ52.js";
18
+ import {
19
+ runCompodoc
20
+ } from "../../_node-chunks/chunk-K236VAP6.js";
19
21
 
20
22
  // src/builders/build-storybook/index.ts
21
23
  import { readFileSync } from "node:fs";
@@ -32,10 +34,11 @@ var commandBuilder = async (options, context) => {
32
34
  cwd: options.configDir,
33
35
  last: getProjectRoot()
34
36
  });
35
- options.compodoc && await runCompodoc(
36
- { compodocArgs: options.compodocArgs, tsconfig: docTSConfig ?? tsConfig },
37
- context
38
- ), getEnvConfig(options, {
37
+ options.compodoc && await runCompodoc({
38
+ compodocArgs: options.compodocArgs,
39
+ tsconfig: docTSConfig ?? tsConfig,
40
+ workspaceRoot: context.workspaceRoot
41
+ }), getEnvConfig(options, {
39
42
  staticDir: "SBCONFIG_STATIC_DIR",
40
43
  outputDir: "SBCONFIG_OUTPUT_DIR",
41
44
  configDir: "SBCONFIG_CONFIG_DIR"
@@ -82,7 +85,9 @@ var commandBuilder = async (options, context) => {
82
85
  statsJson,
83
86
  previewUrl
84
87
  };
85
- if (await runInstance({ ...standaloneOptions, mode: "static" }), logTracker.shouldWriteLogsToFile) {
88
+ if (process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify(
89
+ standaloneOptions.angularBuilderOptions
90
+ ), await runInstance({ ...standaloneOptions, mode: "static" }), logTracker.shouldWriteLogsToFile) {
86
91
  let logFile = await logTracker.writeToFile(options.logfile);
87
92
  logger.info(`Debug logs are written to: ${logFile}`);
88
93
  }
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w331jboqnti from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w331jboqnti from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w331jboqnti from "node:module";
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w331jboqnti.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w331jboqnti.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,10 +12,12 @@ var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
12
12
  import {
13
13
  errorSummary,
14
14
  printErrorDetails,
15
- runCompodoc,
16
15
  up,
17
16
  up2
18
- } from "../../_node-chunks/chunk-R2RNJVE7.js";
17
+ } from "../../_node-chunks/chunk-DORGYJ52.js";
18
+ import {
19
+ runCompodoc
20
+ } from "../../_node-chunks/chunk-K236VAP6.js";
19
21
 
20
22
  // src/builders/start-storybook/index.ts
21
23
  import { readFileSync } from "node:fs";
@@ -35,13 +37,11 @@ var commandBuilder = (options, context) => new Observable((observer) => {
35
37
  cwd: options.configDir,
36
38
  last: getProjectRoot()
37
39
  });
38
- options.compodoc && await runCompodoc(
39
- {
40
- compodocArgs: [...options.compodocArgs, ...options.quiet ? ["--silent"] : []],
41
- tsconfig: docTSConfig ?? tsConfig
42
- },
43
- context
44
- ), getEnvConfig(options, {
40
+ options.compodoc && await runCompodoc({
41
+ compodocArgs: [...options.compodocArgs, ...options.quiet ? ["--silent"] : []],
42
+ tsconfig: docTSConfig ?? tsConfig,
43
+ workspaceRoot: context.workspaceRoot
44
+ }), getEnvConfig(options, {
45
45
  port: "SBCONFIG_PORT",
46
46
  host: "SBCONFIG_HOSTNAME",
47
47
  staticDir: "SBCONFIG_STATIC_DIR",
@@ -105,7 +105,11 @@ var commandBuilder = (options, context) => new Observable((observer) => {
105
105
  statsJson,
106
106
  loglevel,
107
107
  previewUrl
108
- }, startedPort = await runInstance(standaloneOptions);
108
+ };
109
+ process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON = JSON.stringify(
110
+ standaloneOptions.angularBuilderOptions
111
+ );
112
+ let startedPort = await runInstance(standaloneOptions);
109
113
  observer.next({ success: !0, info: { port: startedPort } });
110
114
  } catch (error) {
111
115
  if (logTracker.shouldWriteLogsToFile)
@@ -2,11 +2,11 @@ import {
2
2
  argTypesEnhancers,
3
3
  decorateStory,
4
4
  parameters
5
- } from "../_browser-chunks/chunk-CIJX6X7B.js";
5
+ } from "../_browser-chunks/chunk-A3YIOUBG.js";
6
6
  import {
7
7
  render,
8
8
  renderToCanvas
9
- } from "../_browser-chunks/chunk-6U6AH4EH.js";
9
+ } from "../_browser-chunks/chunk-XUV22PT7.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-4WZEHS2U.js";
5
- import "../../_browser-chunks/chunk-6U6AH4EH.js";
4
+ } from "../../_browser-chunks/chunk-BDVIBYRD.js";
5
+ import "../../_browser-chunks/chunk-XUV22PT7.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-TARB3NLN.js";
9
- import "../_browser-chunks/chunk-CIJX6X7B.js";
10
- import "../_browser-chunks/chunk-4WZEHS2U.js";
11
- import "../_browser-chunks/chunk-6U6AH4EH.js";
8
+ } from "../_browser-chunks/chunk-SDRZ67UN.js";
9
+ import "../_browser-chunks/chunk-A3YIOUBG.js";
10
+ import "../_browser-chunks/chunk-BDVIBYRD.js";
11
+ import "../_browser-chunks/chunk-XUV22PT7.js";
12
12
  export {
13
13
  __definePreview,
14
14
  applicationConfig,
package/dist/index.d.ts CHANGED
@@ -1323,7 +1323,8 @@ type FrameworkOptions = {
1323
1323
  liveReload?: boolean;
1324
1324
  inlineStylesExtension?: string;
1325
1325
  tsconfig?: string;
1326
- zoneless?: boolean;
1326
+ compodoc?: boolean;
1327
+ compodocArgs?: string[];
1327
1328
  };
1328
1329
  type StorybookConfigFramework = {
1329
1330
  framework: FrameworkName | {
package/dist/index.js CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  componentWrapperDecorator,
6
6
  moduleMetadata,
7
7
  setProjectAnnotations
8
- } from "./_browser-chunks/chunk-TARB3NLN.js";
9
- import "./_browser-chunks/chunk-CIJX6X7B.js";
10
- import "./_browser-chunks/chunk-4WZEHS2U.js";
11
- import "./_browser-chunks/chunk-6U6AH4EH.js";
8
+ } from "./_browser-chunks/chunk-SDRZ67UN.js";
9
+ import "./_browser-chunks/chunk-A3YIOUBG.js";
10
+ import "./_browser-chunks/chunk-BDVIBYRD.js";
11
+ import "./_browser-chunks/chunk-XUV22PT7.js";
12
12
  export {
13
13
  __definePreview,
14
14
  applicationConfig,
@@ -9,7 +9,8 @@ type FrameworkOptions = {
9
9
  liveReload?: boolean;
10
10
  inlineStylesExtension?: string;
11
11
  tsconfig?: string;
12
- zoneless?: boolean;
12
+ compodoc?: boolean;
13
+ compodocArgs?: string[];
13
14
  };
14
15
  type StorybookConfigFramework = {
15
16
  framework: FrameworkName | {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w331jboqnti from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w331jboqnti from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w331jboqnti from "node:module";
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w331jboqnti.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w331jboqnti.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -0,0 +1,37 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Angular build options that influence how stories compile under Vitest.
5
+ * Known keys give autocomplete; the index signature is NOT speculative — it
6
+ * models Angular's genuinely open-ended builder-options surface (the framework's
7
+ * internal type is `Record<string, any>`, and Angular adds builder options
8
+ * across versions). The upstream consumer is real and open-ended.
9
+ */
10
+ interface AngularVitestOptions {
11
+ zoneless?: boolean;
12
+ styles?: string[];
13
+ stylePreprocessorOptions?: {
14
+ sass?: Record<string, unknown>;
15
+ loadPaths?: string[];
16
+ };
17
+ assets?: unknown[];
18
+ sourceMap?: boolean;
19
+ preserveSymlinks?: boolean;
20
+ tsConfig?: string;
21
+ [key: string]: unknown;
22
+ }
23
+ /**
24
+ * Pure options bridge for standalone `vitest` runs (no parent `storybook dev`).
25
+ * Add to your `vitest.config.ts` `plugins` array alongside `storybookTest`. The
26
+ * env var is set SYNCHRONOUSLY in this factory body — before storybookTest's
27
+ * inline `presets.apply('viteFinal')` reads it — so timing does not depend on
28
+ * Vite plugin-hook ordering. Returns a near-noop plugin only so it lives in the
29
+ * `plugins` array (which is how the addon-vitest postinstall injects it).
30
+ *
31
+ * Does NOT register `@analogjs/vite-plugin-angular`; the framework's own
32
+ * `viteFinal` still injects analog. This only carries Angular build options
33
+ * into the env channel the framework already consumes.
34
+ */
35
+ declare function storybookAngularVitest(options?: AngularVitestOptions): Plugin;
36
+
37
+ export { type AngularVitestOptions, storybookAngularVitest };
@@ -0,0 +1,32 @@
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+
13
+ // src/node/vitest.ts
14
+ import { logger } from "storybook/internal/node-logger";
15
+ var ENV_KEY = "STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON";
16
+ function storybookAngularVitest(options = {}) {
17
+ let serialized;
18
+ try {
19
+ serialized = JSON.stringify(options);
20
+ } catch (err) {
21
+ throw new Error(
22
+ `[storybook-angular-vite] storybookAngularVitest received non-serializable options: ${err.message}`
23
+ );
24
+ }
25
+ let existing = process.env[ENV_KEY];
26
+ return existing !== void 0 ? existing !== serialized && logger.warn(
27
+ "[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."
28
+ ) : process.env[ENV_KEY] = serialized, { name: "storybook:angular-vitest-options" };
29
+ }
30
+ export {
31
+ storybookAngularVitest
32
+ };
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w331jboqnti from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w331jboqnti from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w331jboqnti from "node:module";
1
+ import CJS_COMPAT_NODE_URL_36p530az4ou from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_36p530az4ou from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_36p530az4ou from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w331jboqnti.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w331jboqnti.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w331jboqnti.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_36p530az4ou.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_36p530az4ou.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_36p530az4ou.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -48,12 +48,31 @@ var addons = [], previewAnnotations = async (entries = [], options) => {
48
48
  }
49
49
  };
50
50
  };
51
- function resolveZoneless(frameworkOptions, angularBuilderOptions) {
52
- return frameworkOptions?.zoneless ?? angularBuilderOptions?.zoneless ?? !0;
51
+ function resolveZoneless(angularBuilderOptions) {
52
+ return angularBuilderOptions?.zoneless ?? !0;
53
53
  }
54
54
  var viteFinal = async (config, options) => {
55
+ if (options && !options.angularBuilderOptions && process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON)
56
+ try {
57
+ options.angularBuilderOptions = JSON.parse(
58
+ process.env.STORYBOOK_ANGULAR_BUILDER_OPTIONS_JSON
59
+ );
60
+ } catch {
61
+ }
55
62
  config.plugins = (config.plugins ?? []).flat().filter((plugin) => !plugin.name.includes("analogjs")).map((plugin) => plugin?.name === "plugin-csf" && plugin.enforce === "pre" ? { ...plugin, enforce: void 0 } : plugin);
56
- let { mergeConfig, normalizePath } = await import("vite"), { default: angular } = await import("@analogjs/vite-plugin-angular"), framework = await options.presets.apply("framework"), zoneless = resolveZoneless(framework.options, options?.angularBuilderOptions), angularPlugins = angular({
63
+ let { mergeConfig, normalizePath } = await import("vite"), { default: angular } = await import("@analogjs/vite-plugin-angular"), framework = await options.presets.apply("framework");
64
+ if (framework.options?.compodoc !== !1) {
65
+ let { existsSync } = await import("node:fs"), path = await import("node:path"), workspaceRoot = options?.angularBuilderContext?.workspaceRoot ?? config?.root ?? process.cwd(), documentationJsonPath = path.resolve(workspaceRoot, "documentation.json");
66
+ if (!existsSync(documentationJsonPath)) {
67
+ let { runCompodoc } = await import("./_node-chunks/run-compodoc-HNX4LQP5.js"), tsconfig = framework.options?.tsconfig ?? options?.angularBuilderOptions?.tsConfig ?? path.resolve(workspaceRoot, "tsconfig.json"), compodocArgs = framework.options?.compodocArgs ?? ["-e", "json", "-d", "."];
68
+ try {
69
+ await runCompodoc({ compodocArgs, tsconfig, workspaceRoot });
70
+ } catch (err) {
71
+ console.warn("[storybook-angular-vite] compodoc generation failed:", err);
72
+ }
73
+ }
74
+ }
75
+ let zoneless = resolveZoneless(options?.angularBuilderOptions), angularPlugins = angular({
57
76
  jit: typeof framework.options?.jit < "u" ? framework.options?.jit : !0,
58
77
  liveReload: typeof framework.options?.liveReload < "u" ? framework.options?.liveReload : !1,
59
78
  tsconfig: typeof framework.options?.tsconfig < "u" ? framework.options?.tsconfig : options?.tsConfig ?? "./.storybook/tsconfig.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular-vite",
3
- "version": "0.0.0-canary-test",
3
+ "version": "0.0.0-canary",
4
4
  "description": "Storybook for Angular: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -42,7 +42,12 @@
42
42
  "default": "./dist/node/index.js"
43
43
  },
44
44
  "./package.json": "./package.json",
45
- "./preset": "./dist/preset.js"
45
+ "./preset": "./dist/preset.js",
46
+ "./vitest": {
47
+ "types": "./dist/node/vitest.d.ts",
48
+ "code": "./src/node/vitest.ts",
49
+ "default": "./dist/node/vitest.js"
50
+ }
46
51
  },
47
52
  "files": [
48
53
  "builders.json",