storybook 10.2.0-alpha.15 → 10.2.0-alpha.17
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/_node-chunks/{builder-manager-SOKYB5NF.js → builder-manager-Q4F5VX5J.js} +14 -12
- package/dist/_node-chunks/{camelcase-SXQWF7PW.js → camelcase-FL6OBJRZ.js} +7 -7
- package/dist/_node-chunks/{chunk-5KEIALUH.js → chunk-25OWI2RR.js} +6 -6
- package/dist/_node-chunks/{chunk-ENNDE4GC.js → chunk-2XSHQN7K.js} +10 -10
- package/dist/_node-chunks/{chunk-E3Y5MHXD.js → chunk-3D4SLKEE.js} +7 -7
- package/dist/_node-chunks/{chunk-FKBWQGIF.js → chunk-5Q5JEISY.js} +6 -6
- package/dist/_node-chunks/{chunk-Q6WUEJ4S.js → chunk-C3FPVGL4.js} +6 -6
- package/dist/_node-chunks/chunk-CBPOKBOR.js +18 -0
- package/dist/_node-chunks/{chunk-2FQAOAQ6.js → chunk-CCJGKJ27.js} +12 -12
- package/dist/_node-chunks/{chunk-MD52RVZX.js → chunk-DJ3RRSJ7.js} +7 -7
- package/dist/_node-chunks/chunk-EG3WZ464.js +23 -0
- package/dist/_node-chunks/{chunk-6SIUW3HU.js → chunk-EYPTVKFI.js} +123 -72
- package/dist/_node-chunks/{chunk-TN3Q52LO.js → chunk-FAARRTOD.js} +6 -6
- package/dist/_node-chunks/{chunk-QPKBPYOY.js → chunk-G7P42ZEY.js} +7 -7
- package/dist/_node-chunks/chunk-GYJ7LPFJ.js +144 -0
- package/dist/_node-chunks/{chunk-BOY3TNPC.js → chunk-IRMNO3QS.js} +9 -9
- package/dist/_node-chunks/{chunk-BRW7NFUP.js → chunk-IWM3WHZE.js} +7 -7
- package/dist/_node-chunks/{chunk-RGWB6DD7.js → chunk-JBRILZWU.js} +6 -6
- package/dist/_node-chunks/{chunk-HFKM7JHQ.js → chunk-KKNWPXMS.js} +6 -6
- package/dist/_node-chunks/{chunk-45UIB4YF.js → chunk-MU4E5UBA.js} +7 -7
- package/dist/_node-chunks/{chunk-274OMYGE.js → chunk-PWI3ORDV.js} +22 -22
- package/dist/_node-chunks/chunk-RGEHGZS6.js +61 -0
- package/dist/_node-chunks/{chunk-KNGN3UEO.js → chunk-V3SFCYKQ.js} +7 -7
- package/dist/_node-chunks/{chunk-4GKVZO2T.js → chunk-VK4OWRKU.js} +9 -9
- package/dist/_node-chunks/{chunk-K4YVLJRS.js → chunk-VT2FICF4.js} +6 -6
- package/dist/_node-chunks/{chunk-SZWIX5YC.js → chunk-VTBZVEBF.js} +529 -142
- package/dist/_node-chunks/{chunk-T57UCO67.js → chunk-XI7HDOMY.js} +7 -7
- package/dist/_node-chunks/{chunk-PI7P5HFH.js → chunk-XTIFAWOB.js} +250 -14
- package/dist/_node-chunks/{chunk-AIIQJ6UR.js → chunk-XYONORVT.js} +7 -7
- package/dist/_node-chunks/{chunk-MQZLLJRG.js → chunk-ZOUBYBCH.js} +9 -9
- package/dist/_node-chunks/{globby-LGQ5P2JB.js → globby-4BDMCAAD.js} +9 -9
- package/dist/_node-chunks/{lib-5LBLULG3.js → lib-XS2XQMOO.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-TAPL5IEO.js → mdx-N42X6CFJ-JFERGMQH.js} +8 -8
- package/dist/_node-chunks/{p-limit-GTMOHYQF.js → p-limit-I4CLTHWH.js} +7 -7
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +12 -12
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +18 -18
- package/dist/common/index.js +19 -19
- package/dist/core-events/index.d.ts +19 -3
- package/dist/core-events/index.js +5 -1
- package/dist/core-server/index.d.ts +64 -2
- package/dist/core-server/index.js +37 -34
- package/dist/core-server/presets/common-override-preset.js +11 -11
- package/dist/core-server/presets/common-preset.js +532 -234
- package/dist/csf/index.d.ts +139 -9
- package/dist/csf/index.js +41 -14
- package/dist/csf-tools/index.d.ts +19 -1
- package/dist/csf-tools/index.js +11 -10
- package/dist/manager/globals-runtime.js +6 -2
- package/dist/manager/runtime.js +17 -98
- package/dist/manager-api/index.js +1 -1
- package/dist/mocking-utils/index.js +8 -8
- package/dist/node-logger/index.js +9 -9
- package/dist/preview/runtime.js +33 -6
- package/dist/preview-api/index.d.ts +68 -67
- package/dist/server-errors.js +11 -11
- package/dist/telemetry/index.d.ts +13 -2
- package/dist/telemetry/index.js +23 -22
- package/package.json +1 -1
- package/dist/_node-chunks/chunk-2BHD5YKF.js +0 -35
- package/dist/_node-chunks/chunk-MM7Z4SG7.js +0 -23
- package/dist/_node-chunks/chunk-TYSSQECX.js +0 -61
- package/dist/_node-chunks/chunk-YP34ARUD.js +0 -18
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.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
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-25OWI2RR.js";
|
|
15
15
|
|
|
16
16
|
// ../../node_modules/picocolors/picocolors.js
|
|
17
17
|
var require_picocolors = __commonJS({
|
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.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_build
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IWM3WHZE.js";
|
|
15
15
|
import {
|
|
16
16
|
StorybookError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FAARRTOD.js";
|
|
18
|
+
import {
|
|
19
|
+
up
|
|
20
|
+
} from "./chunk-C3FPVGL4.js";
|
|
18
21
|
import {
|
|
19
22
|
resolvePackageDir
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3D4SLKEE.js";
|
|
21
24
|
import {
|
|
22
25
|
relative
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-5Q5JEISY.js";
|
|
27
|
+
import {
|
|
28
|
+
STORYBOOK_FN_PLACEHOLDER,
|
|
29
|
+
generateDummyArgsFromArgTypes,
|
|
30
|
+
loadConfig,
|
|
31
|
+
printConfig
|
|
32
|
+
} from "./chunk-VTBZVEBF.js";
|
|
24
33
|
import {
|
|
25
34
|
require_dist
|
|
26
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-G7P42ZEY.js";
|
|
27
36
|
import {
|
|
28
37
|
require_picocolors
|
|
29
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-XI7HDOMY.js";
|
|
30
39
|
import {
|
|
31
40
|
__toESM
|
|
32
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-25OWI2RR.js";
|
|
33
42
|
|
|
34
43
|
// src/core-server/utils/server-statics.ts
|
|
35
44
|
import { existsSync, statSync } from "node:fs";
|
|
@@ -225,6 +234,230 @@ async function withTelemetry(eventType, options, run) {
|
|
|
225
234
|
}
|
|
226
235
|
}
|
|
227
236
|
|
|
237
|
+
// src/core-server/utils/generate-story.ts
|
|
238
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
239
|
+
import { writeFile } from "node:fs/promises";
|
|
240
|
+
import { relative as relative3 } from "node:path";
|
|
241
|
+
import { getProjectRoot as getProjectRoot3, getStoryId } from "storybook/internal/common";
|
|
242
|
+
|
|
243
|
+
// src/core-server/utils/get-new-story-file.ts
|
|
244
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
245
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
246
|
+
import { basename as basename2, dirname as dirname2, extname, join as join2, relative as relative2 } from "node:path";
|
|
247
|
+
import { types as t, traverse } from "storybook/internal/babel";
|
|
248
|
+
import {
|
|
249
|
+
extractFrameworkPackageName,
|
|
250
|
+
findConfigFile,
|
|
251
|
+
formatFileContent,
|
|
252
|
+
getFrameworkName,
|
|
253
|
+
getProjectRoot as getProjectRoot2
|
|
254
|
+
} from "storybook/internal/common";
|
|
255
|
+
import { isCsfFactoryPreview } from "storybook/internal/csf-tools";
|
|
256
|
+
import { logger as logger3 } from "storybook/internal/node-logger";
|
|
257
|
+
|
|
258
|
+
// src/core-server/utils/new-story-templates/csf-factory-template.ts
|
|
259
|
+
var import_ts_dedent2 = __toESM(require_dist(), 1);
|
|
260
|
+
|
|
261
|
+
// src/core-server/utils/get-component-variable-name.ts
|
|
262
|
+
var getComponentVariableName = async (name) => (await import("./camelcase-FL6OBJRZ.js")).default(name.replace(/^[^a-zA-Z_$]*/, ""), { pascalCase: !0 }).replace(/[^a-zA-Z_$]+/, "");
|
|
263
|
+
|
|
264
|
+
// src/core-server/utils/new-story-templates/csf-factory-template.ts
|
|
265
|
+
async function getCsfFactoryTemplateForNewStoryFile(data) {
|
|
266
|
+
let importName = data.componentIsDefaultExport ? await getComponentVariableName(data.basenameWithoutExtension) : data.componentExportName, importStatement = data.componentIsDefaultExport ? `import ${importName} from './${data.basenameWithoutExtension}';` : `import { ${importName} } from './${data.basenameWithoutExtension}';`, previewImport = data.previewImportPath ? `import preview from '${data.previewImportPath}';` : "import preview from '#.storybook/preview';", argsString = data.args && Object.keys(data.args).length > 0 ? `{ args: ${JSON.stringify(data.args, null, 2)} }` : "{}";
|
|
267
|
+
return import_ts_dedent2.dedent`
|
|
268
|
+
${previewImport}
|
|
269
|
+
|
|
270
|
+
${importStatement}
|
|
271
|
+
|
|
272
|
+
const meta = preview.meta({
|
|
273
|
+
component: ${importName},
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
export const ${data.exportedStoryName} = meta.story(${argsString});
|
|
277
|
+
`;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/core-server/utils/new-story-templates/javascript.ts
|
|
281
|
+
var import_ts_dedent3 = __toESM(require_dist(), 1);
|
|
282
|
+
async function getJavaScriptTemplateForNewStoryFile(data) {
|
|
283
|
+
let importName = data.componentIsDefaultExport ? await getComponentVariableName(data.basenameWithoutExtension) : data.componentExportName, importStatement = data.componentIsDefaultExport ? `import ${importName} from './${data.basenameWithoutExtension}';` : `import { ${importName} } from './${data.basenameWithoutExtension}';`, hasArgs = !!(data.args && Object.keys(data.args).length > 0), argsString = hasArgs ? `args: ${JSON.stringify(data.args, null, 2)},` : "", storyExport = hasArgs ? import_ts_dedent3.dedent`
|
|
284
|
+
export const ${data.exportedStoryName} = {
|
|
285
|
+
${argsString}
|
|
286
|
+
};
|
|
287
|
+
` : `export const ${data.exportedStoryName} = {};`;
|
|
288
|
+
return import_ts_dedent3.dedent`
|
|
289
|
+
${importStatement}
|
|
290
|
+
|
|
291
|
+
const meta = {
|
|
292
|
+
component: ${importName},
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export default meta;
|
|
296
|
+
|
|
297
|
+
${storyExport}
|
|
298
|
+
`;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/core-server/utils/new-story-templates/typescript.ts
|
|
302
|
+
var import_ts_dedent4 = __toESM(require_dist(), 1);
|
|
303
|
+
async function getTypeScriptTemplateForNewStoryFile(data) {
|
|
304
|
+
let importName = data.componentIsDefaultExport ? await getComponentVariableName(data.basenameWithoutExtension) : data.componentExportName, importStatement = data.componentIsDefaultExport ? `import ${importName} from './${data.basenameWithoutExtension}'` : `import { ${importName} } from './${data.basenameWithoutExtension}'`, hasArgs = !!(data.args && Object.keys(data.args).length > 0), argsString = hasArgs ? `args: ${JSON.stringify(data.args, null, 2)},` : "", storyExport = hasArgs ? import_ts_dedent4.dedent`
|
|
305
|
+
export const ${data.exportedStoryName}: Story = {
|
|
306
|
+
${argsString}
|
|
307
|
+
};
|
|
308
|
+
` : `export const ${data.exportedStoryName}: Story = {};`;
|
|
309
|
+
return import_ts_dedent4.dedent`
|
|
310
|
+
import type { Meta, StoryObj } from '${data.frameworkPackage}';
|
|
311
|
+
|
|
312
|
+
${importStatement};
|
|
313
|
+
|
|
314
|
+
const meta = {
|
|
315
|
+
component: ${importName},
|
|
316
|
+
} satisfies Meta<typeof ${importName}>;
|
|
317
|
+
|
|
318
|
+
export default meta;
|
|
319
|
+
|
|
320
|
+
type Story = StoryObj<typeof meta>;
|
|
321
|
+
|
|
322
|
+
${storyExport}
|
|
323
|
+
`;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// src/core-server/utils/get-new-story-file.ts
|
|
327
|
+
async function getNewStoryFile({
|
|
328
|
+
componentFilePath,
|
|
329
|
+
componentExportName,
|
|
330
|
+
componentIsDefaultExport,
|
|
331
|
+
componentExportCount
|
|
332
|
+
}, options) {
|
|
333
|
+
let frameworkPackageName = await getFrameworkName(options), sanitizedFrameworkPackageName = extractFrameworkPackageName(frameworkPackageName), base = basename2(componentFilePath), extension = extname(componentFilePath), basenameWithoutExtension = base.replace(extension, ""), dir = dirname2(componentFilePath), { storyFileName, isTypescript, storyFileExtension } = getStoryMetadata(componentFilePath), storyFileNameWithExtension = `${storyFileName}.${storyFileExtension}`, alternativeStoryFileNameWithExtension = `${basenameWithoutExtension}.${componentExportName}.stories.${storyFileExtension}`, exportedStoryName = "Default", useCsfFactory = !1, previewConfigPath;
|
|
334
|
+
try {
|
|
335
|
+
let previewConfig = findConfigFile("preview", options.configDir);
|
|
336
|
+
if (previewConfig) {
|
|
337
|
+
let previewContent = await readFile2(previewConfig, "utf-8");
|
|
338
|
+
useCsfFactory = isCsfFactoryPreview(loadConfig(previewContent)), previewConfigPath = previewConfig;
|
|
339
|
+
}
|
|
340
|
+
} catch {
|
|
341
|
+
}
|
|
342
|
+
let args;
|
|
343
|
+
try {
|
|
344
|
+
let argTypes = await options.presets.apply("internal_getArgTypesData", null, {
|
|
345
|
+
...options,
|
|
346
|
+
componentFilePath,
|
|
347
|
+
componentExportName
|
|
348
|
+
});
|
|
349
|
+
if (logger3.debug(`Extracted argTypes for ${componentExportName}: ${JSON.stringify(argTypes)}`), argTypes) {
|
|
350
|
+
let { required } = generateDummyArgsFromArgTypes(argTypes);
|
|
351
|
+
Object.keys(required).length > 0 && (args = required, logger3.debug(
|
|
352
|
+
`Generated dummy data using ArgTypes for ${componentExportName}: ${JSON.stringify(args)}`
|
|
353
|
+
));
|
|
354
|
+
}
|
|
355
|
+
} catch (error) {
|
|
356
|
+
logger3.debug(`Could not generate dummy data for ${componentExportName}: ${error}`);
|
|
357
|
+
}
|
|
358
|
+
let storyFileContent = "";
|
|
359
|
+
if (useCsfFactory) {
|
|
360
|
+
let previewImportPath;
|
|
361
|
+
if (previewConfigPath && !await checkForImportsMap(options.configDir)) {
|
|
362
|
+
let storyFilePath2 = join2(getProjectRoot2(), dir), pathWithoutExt = relative2(storyFilePath2, previewConfigPath).replace(/\.(ts|js|mts|cts|tsx|jsx)$/, "");
|
|
363
|
+
previewImportPath = pathWithoutExt.startsWith(".") ? pathWithoutExt : `./${pathWithoutExt}`;
|
|
364
|
+
}
|
|
365
|
+
storyFileContent = await getCsfFactoryTemplateForNewStoryFile({
|
|
366
|
+
basenameWithoutExtension,
|
|
367
|
+
componentExportName,
|
|
368
|
+
componentIsDefaultExport,
|
|
369
|
+
exportedStoryName,
|
|
370
|
+
previewImportPath,
|
|
371
|
+
args
|
|
372
|
+
});
|
|
373
|
+
} else
|
|
374
|
+
storyFileContent = isTypescript && frameworkPackageName ? await getTypeScriptTemplateForNewStoryFile({
|
|
375
|
+
basenameWithoutExtension,
|
|
376
|
+
componentExportName,
|
|
377
|
+
componentIsDefaultExport,
|
|
378
|
+
frameworkPackage: sanitizedFrameworkPackageName,
|
|
379
|
+
exportedStoryName,
|
|
380
|
+
args
|
|
381
|
+
}) : await getJavaScriptTemplateForNewStoryFile({
|
|
382
|
+
basenameWithoutExtension,
|
|
383
|
+
componentExportName,
|
|
384
|
+
componentIsDefaultExport,
|
|
385
|
+
exportedStoryName,
|
|
386
|
+
args
|
|
387
|
+
});
|
|
388
|
+
storyFileContent = replaceArgsPlaceholders(storyFileContent);
|
|
389
|
+
let storyFilePath = doesStoryFileExist(join2(getProjectRoot2(), dir), storyFileName) && componentExportCount > 1 ? join2(getProjectRoot2(), dir, alternativeStoryFileNameWithExtension) : join2(getProjectRoot2(), dir, storyFileNameWithExtension), formattedStoryFileContent = await formatFileContent(storyFilePath, storyFileContent);
|
|
390
|
+
return {
|
|
391
|
+
storyFilePath,
|
|
392
|
+
exportedStoryName,
|
|
393
|
+
storyFileContent: formattedStoryFileContent,
|
|
394
|
+
dirname: dir
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
var getStoryMetadata = (componentFilePath) => {
|
|
398
|
+
let isTypescript = /\.(ts|tsx|mts|cts)$/.test(componentFilePath), base = basename2(componentFilePath), extension = extname(componentFilePath), basenameWithoutExtension = base.replace(extension, ""), storyFileExtension = isTypescript ? "tsx" : "jsx";
|
|
399
|
+
return {
|
|
400
|
+
storyFileName: `${basenameWithoutExtension}.stories`,
|
|
401
|
+
storyFileExtension,
|
|
402
|
+
isTypescript
|
|
403
|
+
};
|
|
404
|
+
}, doesStoryFileExist = (parentFolder, storyFileName) => existsSync2(join2(parentFolder, `${storyFileName}.ts`)) || existsSync2(join2(parentFolder, `${storyFileName}.tsx`)) || existsSync2(join2(parentFolder, `${storyFileName}.js`)) || existsSync2(join2(parentFolder, `${storyFileName}.jsx`));
|
|
405
|
+
async function checkForImportsMap(configDir) {
|
|
406
|
+
try {
|
|
407
|
+
for (let directory of up(configDir, { last: getProjectRoot2() })) {
|
|
408
|
+
let packageJsonPath = join2(directory, "package.json");
|
|
409
|
+
if (existsSync2(packageJsonPath)) {
|
|
410
|
+
let packageJsonContent = await readFile2(packageJsonPath, "utf-8");
|
|
411
|
+
if (JSON.parse(packageJsonContent).imports)
|
|
412
|
+
return !0;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return !1;
|
|
416
|
+
} catch {
|
|
417
|
+
return !1;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function replaceArgsPlaceholders(storyFileContent) {
|
|
421
|
+
if (!storyFileContent.includes(STORYBOOK_FN_PLACEHOLDER))
|
|
422
|
+
return storyFileContent;
|
|
423
|
+
let storyFile = loadConfig(storyFileContent).parse(), needsFnImport = !1;
|
|
424
|
+
return traverse(storyFile._ast, {
|
|
425
|
+
StringLiteral(path) {
|
|
426
|
+
path.node.value === STORYBOOK_FN_PLACEHOLDER && (needsFnImport = !0, path.replaceWith(t.callExpression(t.identifier("fn"), [])));
|
|
427
|
+
}
|
|
428
|
+
}), needsFnImport && storyFile.setImport(["fn"], "storybook/test"), printConfig(storyFile).code;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/core-server/utils/generate-story.ts
|
|
432
|
+
async function generateStoryFile(payload, options, generateOptions = {}) {
|
|
433
|
+
let { checkFileExists = !0 } = generateOptions;
|
|
434
|
+
try {
|
|
435
|
+
let { storyFilePath, exportedStoryName, storyFileContent } = await getNewStoryFile(
|
|
436
|
+
payload,
|
|
437
|
+
options
|
|
438
|
+
), relativeStoryFilePath = relative3(getProjectRoot3(), storyFilePath), { storyId, kind } = await getStoryId({ storyFilePath, exportedStoryName }, options);
|
|
439
|
+
return checkFileExists && existsSync3(storyFilePath) ? {
|
|
440
|
+
success: !1,
|
|
441
|
+
kind,
|
|
442
|
+
storyFilePath: relativeStoryFilePath,
|
|
443
|
+
error: `A story file already exists at ${relativeStoryFilePath}`,
|
|
444
|
+
errorType: "STORY_FILE_EXISTS"
|
|
445
|
+
} : (await writeFile(storyFilePath, storyFileContent, "utf-8"), {
|
|
446
|
+
success: !0,
|
|
447
|
+
storyId,
|
|
448
|
+
kind,
|
|
449
|
+
storyFilePath: relativeStoryFilePath,
|
|
450
|
+
exportedStoryName
|
|
451
|
+
});
|
|
452
|
+
} catch (e) {
|
|
453
|
+
return {
|
|
454
|
+
success: !1,
|
|
455
|
+
error: e?.message || "Unknown error occurred",
|
|
456
|
+
errorType: "UNKNOWN"
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
228
461
|
// ../../node_modules/es-toolkit/dist/function/debounce.mjs
|
|
229
462
|
function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
230
463
|
let pendingThis, pendingArgs = null, leading = edges != null && edges.includes("leading"), trailing = edges == null || edges.includes("trailing"), invoke = () => {
|
|
@@ -305,5 +538,8 @@ export {
|
|
|
305
538
|
getErrorLevel,
|
|
306
539
|
sendTelemetryError,
|
|
307
540
|
isTelemetryEnabled,
|
|
308
|
-
withTelemetry
|
|
541
|
+
withTelemetry,
|
|
542
|
+
getStoryMetadata,
|
|
543
|
+
doesStoryFileExist,
|
|
544
|
+
generateStoryFile
|
|
309
545
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_ekkdwuux1sk.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-25OWI2RR.js";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/picomatch/lib/constants.js
|
|
18
18
|
var require_constants = __commonJS({
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.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 "./chunk-
|
|
14
|
+
} from "./chunk-XI7HDOMY.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__export,
|
|
18
18
|
__require,
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-25OWI2RR.js";
|
|
21
21
|
|
|
22
22
|
// ../../node_modules/are-we-there-yet/lib/tracker-base.js
|
|
23
23
|
var require_tracker_base = __commonJS({
|
|
@@ -3184,7 +3184,7 @@ function getMinimalTrace() {
|
|
|
3184
3184
|
(line) => !["getMinimalTrace", "createLogger", "logFunction"].some((fn) => line.includes(fn))
|
|
3185
3185
|
);
|
|
3186
3186
|
return userStackLines.length === 0 ? void 0 : `
|
|
3187
|
-
` + userStackLines.slice(0,
|
|
3187
|
+
` + userStackLines.slice(0, 4).join(`
|
|
3188
3188
|
`);
|
|
3189
3189
|
}
|
|
3190
3190
|
var formatLogMessage = (args) => args.map((arg) => typeof arg == "string" ? arg : typeof arg == "object" ? JSON.stringify(arg, null, 2) : String(arg)).join(" ");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -13,15 +13,15 @@ import {
|
|
|
13
13
|
require_picomatch,
|
|
14
14
|
require_utils,
|
|
15
15
|
toPath
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XYONORVT.js";
|
|
17
17
|
import {
|
|
18
18
|
slash
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JBRILZWU.js";
|
|
20
20
|
import {
|
|
21
21
|
__commonJS,
|
|
22
22
|
__require,
|
|
23
23
|
__toESM
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-25OWI2RR.js";
|
|
25
25
|
|
|
26
26
|
// ../../node_modules/fast-glob/out/utils/array.js
|
|
27
27
|
var require_array = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.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 "./chunk-
|
|
16
|
+
} from "./chunk-25OWI2RR.js";
|
|
17
17
|
|
|
18
18
|
// ../../node_modules/app-root-dir/lib/index.js
|
|
19
19
|
var require_lib = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
position,
|
|
22
22
|
start,
|
|
23
23
|
toEstree
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-V3SFCYKQ.js";
|
|
25
|
+
import "./chunk-25OWI2RR.js";
|
|
26
26
|
|
|
27
27
|
// ../../node_modules/@storybook/docs-mdx/dist/mdx-N42X6CFJ.js
|
|
28
28
|
import { default as default2 } from "path";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-25OWI2RR.js";
|
|
13
13
|
|
|
14
14
|
// ../../node_modules/yocto-queue/index.js
|
|
15
15
|
var Node = class {
|
package/dist/babel/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
recast,
|
|
23
23
|
traverse,
|
|
24
24
|
types
|
|
25
|
-
} from "../_node-chunks/chunk-
|
|
26
|
-
import "../_node-chunks/chunk-
|
|
27
|
-
import "../_node-chunks/chunk-
|
|
28
|
-
import "../_node-chunks/chunk-
|
|
25
|
+
} from "../_node-chunks/chunk-IRMNO3QS.js";
|
|
26
|
+
import "../_node-chunks/chunk-MU4E5UBA.js";
|
|
27
|
+
import "../_node-chunks/chunk-XI7HDOMY.js";
|
|
28
|
+
import "../_node-chunks/chunk-25OWI2RR.js";
|
|
29
29
|
var export_transformSync = import_core.transformSync;
|
|
30
30
|
export {
|
|
31
31
|
BabelFileClass,
|
package/dist/bin/core.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.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
|
version
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-CBPOKBOR.js";
|
|
15
15
|
import {
|
|
16
16
|
globalSettings
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
18
|
-
import "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-VK4OWRKU.js";
|
|
18
|
+
import "../_node-chunks/chunk-KKNWPXMS.js";
|
|
19
19
|
import {
|
|
20
20
|
require_dist
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-G7P42ZEY.js";
|
|
22
22
|
import {
|
|
23
23
|
require_picocolors
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
24
|
+
} from "../_node-chunks/chunk-XI7HDOMY.js";
|
|
25
25
|
import {
|
|
26
26
|
__commonJS,
|
|
27
27
|
__require,
|
|
28
28
|
__toESM
|
|
29
|
-
} from "../_node-chunks/chunk-
|
|
29
|
+
} from "../_node-chunks/chunk-25OWI2RR.js";
|
|
30
30
|
|
|
31
31
|
// ../../node_modules/commander/lib/error.js
|
|
32
32
|
var require_error = __commonJS({
|
package/dist/bin/dispatcher.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import CJS_COMPAT_NODE_URL_w8tq4vh9mzk from 'node:url';
|
|
3
|
+
import CJS_COMPAT_NODE_PATH_w8tq4vh9mzk from 'node:path';
|
|
4
|
+
import CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk from "node:module";
|
|
5
5
|
|
|
6
|
-
var __filename =
|
|
7
|
-
var __dirname =
|
|
8
|
-
var require =
|
|
6
|
+
var __filename = CJS_COMPAT_NODE_URL_w8tq4vh9mzk.fileURLToPath(import.meta.url);
|
|
7
|
+
var __dirname = CJS_COMPAT_NODE_PATH_w8tq4vh9mzk.dirname(__filename);
|
|
8
|
+
var require = CJS_COMPAT_NODE_MODULE_w8tq4vh9mzk.createRequire(import.meta.url);
|
|
9
9
|
|
|
10
10
|
// ------------------------------------------------------------
|
|
11
11
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
12
12
|
// ------------------------------------------------------------
|
|
13
13
|
import {
|
|
14
14
|
versions_default
|
|
15
|
-
} from "../_node-chunks/chunk-
|
|
15
|
+
} from "../_node-chunks/chunk-RGEHGZS6.js";
|
|
16
16
|
import {
|
|
17
17
|
resolvePackageDir
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
18
|
+
} from "../_node-chunks/chunk-3D4SLKEE.js";
|
|
19
19
|
import {
|
|
20
20
|
join
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-5Q5JEISY.js";
|
|
22
22
|
import {
|
|
23
23
|
require_dist
|
|
24
|
-
} from "../_node-chunks/chunk-
|
|
24
|
+
} from "../_node-chunks/chunk-G7P42ZEY.js";
|
|
25
25
|
import {
|
|
26
26
|
__toESM
|
|
27
|
-
} from "../_node-chunks/chunk-
|
|
27
|
+
} from "../_node-chunks/chunk-25OWI2RR.js";
|
|
28
28
|
|
|
29
29
|
// src/bin/dispatcher.ts
|
|
30
30
|
import { pathToFileURL } from "node:url";
|