@storybook/addon-vitest 0.0.0-pr-32795-sha-d0cb3b7f → 0.0.0-pr-33092-sha-c8460b7a

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/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w01o6m6dsu8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w01o6m6dsu8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w01o6m6dsu8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_vshh9fntxdn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_vshh9fntxdn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_vshh9fntxdn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w01o6m6dsu8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w01o6m6dsu8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_vshh9fntxdn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_vshh9fntxdn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_vshh9fntxdn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -12,10 +12,11 @@ var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
12
12
  import {
13
13
  log,
14
14
  noop
15
- } from "./_node-chunks/chunk-LTPLPMIL.js";
15
+ } from "./_node-chunks/chunk-QPB2GCIO.js";
16
16
  import {
17
+ execaNode,
17
18
  importMetaResolve
18
- } from "./_node-chunks/chunk-CM4R7CX6.js";
19
+ } from "./_node-chunks/chunk-NRFGFKG2.js";
19
20
  import {
20
21
  ADDON_ID,
21
22
  COVERAGE_DIRECTORY,
@@ -24,19 +25,16 @@ import {
24
25
  STORYBOOK_ADDON_TEST_CHANNEL,
25
26
  TEST_PROVIDER_STORE_CHANNEL_EVENT_NAME,
26
27
  storeOptions
27
- } from "./_node-chunks/chunk-VHEOYYGG.js";
28
+ } from "./_node-chunks/chunk-H6AFC5BW.js";
28
29
  import {
29
30
  require_picocolors
30
- } from "./_node-chunks/chunk-Q5NYU4IV.js";
31
- import {
32
- require_dist
33
- } from "./_node-chunks/chunk-CZJGKP4S.js";
31
+ } from "./_node-chunks/chunk-BYNAAADB.js";
34
32
  import {
35
33
  normalize
36
- } from "./_node-chunks/chunk-INLJZPAT.js";
34
+ } from "./_node-chunks/chunk-UVEHSNL5.js";
37
35
  import {
38
36
  __toESM
39
- } from "./_node-chunks/chunk-LG32FAEW.js";
37
+ } from "./_node-chunks/chunk-A4JN7TXM.js";
40
38
 
41
39
  // src/preset.ts
42
40
  import { mkdir } from "node:fs/promises";
@@ -207,11 +205,11 @@ function isEqual(a, b) {
207
205
  }
208
206
 
209
207
  // src/preset.ts
210
- var import_picocolors = __toESM(require_picocolors(), 1), import_ts_dedent = __toESM(require_dist(), 1);
208
+ var import_picocolors = __toESM(require_picocolors(), 1);
209
+ import { dedent } from "ts-dedent";
211
210
 
212
211
  // src/node/boot-test-runner.ts
213
212
  import { fileURLToPath } from "node:url";
214
- import { executeNodeCommand } from "storybook/internal/common";
215
213
  import {
216
214
  internal_universalStatusStore,
217
215
  internal_universalTestProviderStore
@@ -236,18 +234,15 @@ var MAX_START_TIME = 3e4, vitestModulePath = fileURLToPath(importMetaResolve("@s
236
234
  };
237
235
  process.on("exit", exit), process.on("SIGINT", () => exit(0)), process.on("SIGTERM", () => exit(0));
238
236
  let startChildProcess = () => new Promise((resolve, reject) => {
239
- child = executeNodeCommand({
240
- scriptPath: vitestModulePath,
241
- options: {
242
- env: {
243
- VITEST: "true",
244
- TEST: "true",
245
- VITEST_CHILD_PROCESS: "true",
246
- NODE_ENV: process.env.NODE_ENV ?? "test",
247
- STORYBOOK_CONFIG_DIR: normalize(options.configDir)
248
- },
249
- extendEnv: !0
250
- }
237
+ child = execaNode(vitestModulePath, {
238
+ env: {
239
+ VITEST: "true",
240
+ TEST: "true",
241
+ VITEST_CHILD_PROCESS: "true",
242
+ NODE_ENV: process.env.NODE_ENV ?? "test",
243
+ STORYBOOK_CONFIG_DIR: normalize(options.configDir)
244
+ },
245
+ extendEnv: !0
251
246
  }), stderr = [], child.stdout?.on("data", log), child.stderr?.on("data", (data) => {
252
247
  data.toString().match(/^\u001B\[33m/) || (log(data), stderr.push(data.toString()));
253
248
  }), unsubscribeStore = store.subscribe(forwardUniversalStoreEvent(STORE_CHANNEL_EVENT_NAME)), unsubscribeStatusStore = internal_universalStatusStore.subscribe(
@@ -308,7 +303,7 @@ var experimental_serverChannel = async (channel, options) => {
308
303
  options
309
304
  ), resolvedPreviewBuilder = typeof core?.builder == "string" ? core.builder : core?.builder?.name, framework = await getFrameworkName(options);
310
305
  if (!resolvedPreviewBuilder?.includes("vite"))
311
- return framework.includes("nextjs") && log(import_ts_dedent.dedent`
306
+ return framework.includes("nextjs") && log(dedent`
312
307
  You're using ${framework}, which is a Webpack-based builder. In order to use Storybook Test, with your project, you need to use '@storybook/nextjs-vite', a high performance Vite-based equivalent.
313
308
 
314
309
  Information on how to upgrade here: ${import_picocolors.default.yellow("https://storybook.js.org/docs/get-started/frameworks/nextjs?ref=upgrade#with-vite")}\n
@@ -385,7 +380,7 @@ var experimental_serverChannel = async (channel, options) => {
385
380
  }), !core.disableTelemetry) {
386
381
  let enableCrashReports = core.enableCrashReports || options.enableCrashReports;
387
382
  channel.on(STORYBOOK_ADDON_TEST_CHANNEL, (event) => {
388
- event.type !== "test-run-completed" && telemetry("addon-test", {
383
+ telemetry("addon-test", {
389
384
  ...event,
390
385
  payload: {
391
386
  ...event.payload,
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_w01o6m6dsu8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w01o6m6dsu8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w01o6m6dsu8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_vshh9fntxdn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_vshh9fntxdn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_vshh9fntxdn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w01o6m6dsu8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w01o6m6dsu8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_vshh9fntxdn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_vshh9fntxdn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_vshh9fntxdn.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __require,
15
15
  __toESM
16
- } from "../_node-chunks/chunk-LG32FAEW.js";
16
+ } from "../_node-chunks/chunk-A4JN7TXM.js";
17
17
 
18
18
  // ../../node_modules/tree-kill/index.js
19
19
  var require_tree_kill = __commonJS({
@@ -121,7 +121,8 @@ var storybookProcess = null, getIsVitestStandaloneRun = () => {
121
121
  try {
122
122
  storybookProcess = spawn(storybookScript, [], {
123
123
  stdio: process.env.DEBUG === "storybook" ? "pipe" : "ignore",
124
- cwd: process.cwd()
124
+ cwd: process.cwd(),
125
+ shell: !0
125
126
  }), storybookProcess.on("error", (error) => {
126
127
  throw logger.verbose("Failed to start Storybook:" + error.message), error;
127
128
  });
@@ -1,32 +1,29 @@
1
- import CJS_COMPAT_NODE_URL_w01o6m6dsu8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w01o6m6dsu8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w01o6m6dsu8 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_vshh9fntxdn from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_vshh9fntxdn from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_vshh9fntxdn from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_w01o6m6dsu8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w01o6m6dsu8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_vshh9fntxdn.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_vshh9fntxdn.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_vshh9fntxdn.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
  require_picocolors
14
- } from "../_node-chunks/chunk-Q5NYU4IV.js";
15
- import {
16
- require_dist
17
- } from "../_node-chunks/chunk-CZJGKP4S.js";
14
+ } from "../_node-chunks/chunk-BYNAAADB.js";
18
15
  import {
19
16
  join,
20
17
  normalize,
21
18
  relative,
22
19
  resolve,
23
20
  sep
24
- } from "../_node-chunks/chunk-INLJZPAT.js";
21
+ } from "../_node-chunks/chunk-UVEHSNL5.js";
25
22
  import {
26
23
  __commonJS,
27
24
  __require,
28
25
  __toESM
29
- } from "../_node-chunks/chunk-LG32FAEW.js";
26
+ } from "../_node-chunks/chunk-A4JN7TXM.js";
30
27
 
31
28
  // ../../node_modules/braces/lib/utils.js
32
29
  var require_utils = __commonJS({
@@ -2326,6 +2323,7 @@ import { mergeConfig } from "vitest/config";
2326
2323
  import {
2327
2324
  DEFAULT_FILES_PATTERN,
2328
2325
  getInterpretedFile,
2326
+ loadPreviewOrConfigFile,
2329
2327
  normalizeStories,
2330
2328
  optionalEnvToBoolean,
2331
2329
  resolvePathInStorybookCache,
@@ -2340,7 +2338,8 @@ import { readConfig, vitestTransform } from "storybook/internal/csf-tools";
2340
2338
  import { MainFileMissingError } from "storybook/internal/server-errors";
2341
2339
  import { telemetry } from "storybook/internal/telemetry";
2342
2340
  import { oneWayHash } from "storybook/internal/telemetry";
2343
- var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build2(), 1), import_ts_dedent = __toESM(require_dist(), 1);
2341
+ var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build2(), 1);
2342
+ import { dedent } from "ts-dedent";
2344
2343
 
2345
2344
  // ../../builders/builder-vite/src/utils/without-vite-plugins.ts
2346
2345
  var withoutVitePlugins = async (plugins = [], namesToRemove) => {
@@ -2373,6 +2372,13 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2373
2372
  new Map(matchingStoryFiles.map(([specifier, cache]) => [specifier, cache]))
2374
2373
  )
2375
2374
  };
2375
+ }, processPreviewAnnotation = (path, projectRoot) => typeof path == "object" ? path.bare != null && path.absolute === "" ? path.bare : normalize(path.absolute) : path.startsWith("/") || path.match(/^[a-zA-Z]:/) ? normalize(path) : normalize(resolve(projectRoot, path)), getPreviewAnnotations = async (presets, configDir, projectRoot) => {
2376
+ let previewAnnotations = await presets.apply("previewAnnotations", [], {}), previewOrConfigFile = loadPreviewOrConfigFile({ configDir });
2377
+ return [...previewAnnotations, previewOrConfigFile].filter(
2378
+ (entry) => entry !== void 0
2379
+ ).map(
2380
+ (annotation) => processPreviewAnnotation(annotation, projectRoot)
2381
+ );
2376
2382
  }, mdxStubPlugin = {
2377
2383
  name: "storybook:stub-mdx-plugin",
2378
2384
  enforce: "pre",
@@ -2401,7 +2407,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2401
2407
  configDir: finalOptions.configDir,
2402
2408
  packageJson: {}
2403
2409
  }), stories = await presets.apply("stories", []), [
2404
- { storiesGlobs },
2410
+ { storiesGlobs, storiesFiles },
2405
2411
  framework,
2406
2412
  storybookEnv,
2407
2413
  viteConfigFromStorybook,
@@ -2409,7 +2415,8 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2409
2415
  previewLevelTags,
2410
2416
  core,
2411
2417
  extraOptimizeDeps,
2412
- features
2418
+ features,
2419
+ previewAnnotations
2413
2420
  ] = await Promise.all([
2414
2421
  getStoryGlobsAndFiles(presets, directories),
2415
2422
  presets.apply("framework", void 0),
@@ -2419,7 +2426,8 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2419
2426
  extractTagsFromPreview(finalOptions.configDir),
2420
2427
  presets.apply("core"),
2421
2428
  presets.apply("optimizeViteDeps", []),
2422
- presets.apply("features", {})
2429
+ presets.apply("features", {}),
2430
+ getPreviewAnnotations(presets, finalOptions.configDir, WORKING_DIR)
2423
2431
  ]), pluginsToIgnore = [
2424
2432
  "storybook:react-docgen-plugin",
2425
2433
  "vite:react-docgen-typescript",
@@ -2526,6 +2534,13 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2526
2534
  ]
2527
2535
  },
2528
2536
  optimizeDeps: {
2537
+ // Include both story files and preview annotation files as entries.
2538
+ // Vite will automatically discover and optimize dependencies from these entry points.
2539
+ // This prevents hard reloads caused by runtime dependency discovery.
2540
+ entries: [
2541
+ ...storiesFiles.map((file) => relative(finalOptions.vitestRoot, file)),
2542
+ ...previewAnnotations.map((file) => relative(finalOptions.vitestRoot, file))
2543
+ ],
2529
2544
  include: [
2530
2545
  ...extraOptimizeDeps,
2531
2546
  "@storybook/addon-vitest/internal/setup-file",
@@ -2543,7 +2558,7 @@ var WORKING_DIR = process.cwd(), defaultOptions = {
2543
2558
  viteConfigFromStorybook
2544
2559
  );
2545
2560
  return (nonMutableInputConfig.test?.include?.length ?? 0) > 0 && (nonMutableInputConfig.test.include = [], console.log(
2546
- import_picocolors.default.yellow(import_ts_dedent.dedent`
2561
+ import_picocolors.default.yellow(dedent`
2547
2562
  Warning: Starting in Storybook 8.5.0-alpha.18, the "test.include" option in Vitest is discouraged in favor of just using the "stories" field in your Storybook configuration.
2548
2563
 
2549
2564
  The values you passed to "test.include" will be ignored, please remove them from your Vitest configuration where the Storybook plugin is applied.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PANEL_ID
3
- } from "../_browser-chunks/chunk-TJXI7EIW.js";
3
+ } from "../_browser-chunks/chunk-ULSHVN74.js";
4
4
 
5
5
  // src/vitest-plugin/setup-file.ts
6
6
  import { afterEach, beforeAll, vi } from "vitest";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-vitest",
3
- "version": "0.0.0-pr-32795-sha-d0cb3b7f",
3
+ "version": "0.0.0-pr-33092-sha-c8460b7a",
4
4
  "description": "Storybook Vitest addon: Blazing fast component testing using stories",
5
5
  "keywords": [
6
6
  "storybook",
@@ -73,7 +73,9 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@storybook/global": "^5.0.0",
76
- "@storybook/icons": "^2.0.0"
76
+ "@storybook/icons": "^2.0.0",
77
+ "prompts": "^2.4.0",
78
+ "ts-dedent": "^2.2.0"
77
79
  },
78
80
  "devDependencies": {
79
81
  "@types/istanbul-lib-report": "^3.0.3",
@@ -82,8 +84,10 @@
82
84
  "@types/semver": "^7",
83
85
  "@vitest/browser-playwright": "^4.0.1",
84
86
  "@vitest/runner": "^4.0.1",
87
+ "boxen": "^8.0.1",
85
88
  "empathic": "^2.0.0",
86
89
  "es-toolkit": "^1.36.0",
90
+ "execa": "^8.0.1",
87
91
  "istanbul-lib-report": "^3.0.1",
88
92
  "micromatch": "^4.0.8",
89
93
  "pathe": "^1.1.2",
@@ -103,7 +107,7 @@
103
107
  "@vitest/browser": "^3.0.0 || ^4.0.0",
104
108
  "@vitest/browser-playwright": "^4.0.0",
105
109
  "@vitest/runner": "^3.0.0 || ^4.0.0",
106
- "storybook": "^0.0.0-pr-32795-sha-d0cb3b7f",
110
+ "storybook": "^0.0.0-pr-33092-sha-c8460b7a",
107
111
  "vitest": "^3.0.0 || ^4.0.0"
108
112
  },
109
113
  "peerDependenciesMeta": {
@@ -1,158 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_w01o6m6dsu8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w01o6m6dsu8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w01o6m6dsu8 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_w01o6m6dsu8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w01o6m6dsu8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- dirname,
14
- join
15
- } from "./chunk-INLJZPAT.js";
16
-
17
- // ../../core/src/shared/utils/module.ts
18
- import { fileURLToPath, pathToFileURL } from "node:url";
19
-
20
- // ../../node_modules/exsolve/dist/index.mjs
21
- import assert from "node:assert";
22
- import v8 from "node:v8";
23
- import { format, inspect } from "node:util";
24
- var own$1 = {}.hasOwnProperty, classRegExp = /^([A-Z][a-z\d]*)+$/, kTypes = /* @__PURE__ */ new Set([
25
- "string",
26
- "function",
27
- "number",
28
- "object",
29
- "Function",
30
- "Object",
31
- "boolean",
32
- "bigint",
33
- "symbol"
34
- ]), messages = /* @__PURE__ */ new Map(), nodeInternalPrefix = "__node_internal_", userStackTraceLimit;
35
- function formatList(array, type = "and") {
36
- return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
37
- }
38
- function createError(sym, value, constructor) {
39
- return messages.set(sym, value), makeNodeErrorWithCode(constructor, sym);
40
- }
41
- function makeNodeErrorWithCode(Base, key) {
42
- return function(...parameters) {
43
- let limit = Error.stackTraceLimit;
44
- isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = 0);
45
- let error = new Base();
46
- isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = limit);
47
- let message = getMessage(key, parameters, error);
48
- return Object.defineProperties(error, {
49
- message: {
50
- value: message,
51
- enumerable: !1,
52
- writable: !0,
53
- configurable: !0
54
- },
55
- toString: {
56
- value() {
57
- return `${this.name} [${key}]: ${this.message}`;
58
- },
59
- enumerable: !1,
60
- writable: !0,
61
- configurable: !0
62
- }
63
- }), captureLargerStackTrace(error), error.code = key, error;
64
- };
65
- }
66
- function isErrorStackTraceLimitWritable() {
67
- try {
68
- if (v8.startupSnapshot.isBuildingSnapshot()) return !1;
69
- } catch {
70
- }
71
- let desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
72
- return desc === void 0 ? Object.isExtensible(Error) : own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
73
- }
74
- function hideStackFrames(wrappedFunction) {
75
- let hidden = nodeInternalPrefix + wrappedFunction.name;
76
- return Object.defineProperty(wrappedFunction, "name", { value: hidden }), wrappedFunction;
77
- }
78
- var captureLargerStackTrace = hideStackFrames(function(error) {
79
- let stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
80
- return stackTraceLimitIsWritable && (userStackTraceLimit = Error.stackTraceLimit, Error.stackTraceLimit = Number.POSITIVE_INFINITY), Error.captureStackTrace(error), stackTraceLimitIsWritable && (Error.stackTraceLimit = userStackTraceLimit), error;
81
- });
82
- function getMessage(key, parameters, self) {
83
- let message = messages.get(key);
84
- if (assert.ok(message !== void 0, "expected `message` to be found"), typeof message == "function")
85
- return assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`), Reflect.apply(message, self, parameters);
86
- let regex = /%[dfijoOs]/g, expectedLength = 0;
87
- for (; regex.exec(message) !== null; ) expectedLength++;
88
- return assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`), parameters.length === 0 ? message : (parameters.unshift(message), Reflect.apply(format, null, parameters));
89
- }
90
- function determineSpecificType(value) {
91
- if (value == null) return String(value);
92
- if (typeof value == "function" && value.name) return `function ${value.name}`;
93
- if (typeof value == "object")
94
- return value.constructor && value.constructor.name ? `an instance of ${value.constructor.name}` : `${inspect(value, { depth: -1 })}`;
95
- let inspected = inspect(value, { colors: !1 });
96
- return inspected.length > 28 && (inspected = `${inspected.slice(0, 25)}...`), `type ${typeof value} (${inspected})`;
97
- }
98
- var ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
99
- assert.ok(typeof name == "string", "'name' must be a string"), Array.isArray(expected) || (expected = [expected]);
100
- let message = "The ";
101
- if (name.endsWith(" argument")) message += `${name} `;
102
- else {
103
- let type = name.includes(".") ? "property" : "argument";
104
- message += `"${name}" ${type} `;
105
- }
106
- message += "must be ";
107
- let types = [], instances = [], other = [];
108
- for (let value of expected)
109
- assert.ok(typeof value == "string", "All expected entries have to be of type string"), kTypes.has(value) ? types.push(value.toLowerCase()) : classRegExp.exec(value) === null ? (assert.ok(value !== "object", 'The value "object" should be written as "Object"'), other.push(value)) : instances.push(value);
110
- if (instances.length > 0) {
111
- let pos = types.indexOf("object");
112
- pos !== -1 && (types.slice(pos, 1), instances.push("Object"));
113
- }
114
- return types.length > 0 && (message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`, (instances.length > 0 || other.length > 0) && (message += " or ")), instances.length > 0 && (message += `an instance of ${formatList(instances, "or")}`, other.length > 0 && (message += " or ")), other.length > 0 && (other.length > 1 ? message += `one of ${formatList(other, "or")}` : (other[0]?.toLowerCase() !== other[0] && (message += "an "), message += `${other[0]}`)), message += `. Received ${determineSpecificType(actual)}`, message;
115
- }, TypeError), ERR_INVALID_MODULE_SPECIFIER = createError(
116
- "ERR_INVALID_MODULE_SPECIFIER",
117
- /**
118
- * @param {string} request
119
- * @param {string} reason
120
- * @param {string} [base]
121
- */
122
- (request, reason, base) => `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`,
123
- TypeError
124
- ), ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`, Error), ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = !1, base) => {
125
- let relatedError = typeof target == "string" && !isImport && target.length > 0 && !target.startsWith("./");
126
- return key === "." ? (assert.ok(isImport === !1), `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`) : `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
127
- }, Error), ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path$1, base, exactUrl = !1) => `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`, Error), ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error), ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`, TypeError), ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
128
- "ERR_PACKAGE_PATH_NOT_EXPORTED",
129
- /**
130
- * @param {string} packagePath
131
- * @param {string} subpath
132
- * @param {string} [base]
133
- */
134
- (packagePath, subpath, base) => subpath === "." ? `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}` : `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`,
135
- Error
136
- ), ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error), ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', TypeError), ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path$1) => `Unknown file extension "${extension}" for ${path$1}`, TypeError), ERR_INVALID_ARG_VALUE = createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
137
- let inspected = inspect(value);
138
- return inspected.length > 128 && (inspected = `${inspected.slice(0, 128)}...`), `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
139
- }, TypeError), hasOwnProperty$1 = {}.hasOwnProperty;
140
- var hasOwnProperty = {}.hasOwnProperty;
141
- var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty;
142
- var isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
143
-
144
- // ../../core/src/shared/utils/module.ts
145
- var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
146
- "importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
147
- ), pathToFileURL(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => {
148
- try {
149
- return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
150
- } catch {
151
- return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"))));
152
- }
153
- };
154
-
155
- export {
156
- importMetaResolve,
157
- resolvePackageDir
158
- };
@@ -1,61 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_w01o6m6dsu8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w01o6m6dsu8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w01o6m6dsu8 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_w01o6m6dsu8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w01o6m6dsu8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- __commonJS
14
- } from "./chunk-LG32FAEW.js";
15
-
16
- // ../../node_modules/ts-dedent/dist/index.js
17
- var require_dist = __commonJS({
18
- "../../node_modules/ts-dedent/dist/index.js"(exports) {
19
- "use strict";
20
- Object.defineProperty(exports, "__esModule", { value: !0 });
21
- exports.dedent = void 0;
22
- function dedent(templ) {
23
- for (var values = [], _i = 1; _i < arguments.length; _i++)
24
- values[_i - 1] = arguments[_i];
25
- var strings = Array.from(typeof templ == "string" ? [templ] : templ);
26
- strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
27
- var indentLengths = strings.reduce(function(arr, str) {
28
- var matches = str.match(/\n([\t ]+|(?!\s).)/g);
29
- return matches ? arr.concat(matches.map(function(match) {
30
- var _a, _b;
31
- return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
32
- })) : arr;
33
- }, []);
34
- if (indentLengths.length) {
35
- var pattern_1 = new RegExp(`
36
- [ ]{` + Math.min.apply(Math, indentLengths) + "}", "g");
37
- strings = strings.map(function(str) {
38
- return str.replace(pattern_1, `
39
- `);
40
- });
41
- }
42
- strings[0] = strings[0].replace(/^\r?\n/, "");
43
- var string = strings[0];
44
- return values.forEach(function(value, i) {
45
- var endentations = string.match(/(?:^|\n)( *)$/), endentation = endentations ? endentations[1] : "", indentedValue = value;
46
- typeof value == "string" && value.includes(`
47
- `) && (indentedValue = String(value).split(`
48
- `).map(function(str, i2) {
49
- return i2 === 0 ? str : "" + endentation + str;
50
- }).join(`
51
- `)), string += indentedValue + strings[i + 1];
52
- }), string;
53
- }
54
- exports.dedent = dedent;
55
- exports.default = dedent;
56
- }
57
- });
58
-
59
- export {
60
- require_dist
61
- };
@@ -1,38 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_w01o6m6dsu8 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_w01o6m6dsu8 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_w01o6m6dsu8 from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_w01o6m6dsu8.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_w01o6m6dsu8.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_w01o6m6dsu8.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- ADDON_ID
14
- } from "./chunk-VHEOYYGG.js";
15
- import {
16
- require_picocolors
17
- } from "./chunk-Q5NYU4IV.js";
18
- import {
19
- __toESM
20
- } from "./chunk-LG32FAEW.js";
21
-
22
- // src/logger.ts
23
- var import_picocolors = __toESM(require_picocolors(), 1);
24
- import { logger } from "storybook/internal/node-logger";
25
- var log = (message) => {
26
- logger.log(
27
- `${import_picocolors.default.magenta(ADDON_ID)}: ${message.toString().replaceAll(/(│\n|│ )/g, "").trim()}`
28
- );
29
- };
30
-
31
- // ../../node_modules/es-toolkit/dist/function/noop.mjs
32
- function noop() {
33
- }
34
-
35
- export {
36
- noop,
37
- log
38
- };