create-storybook 10.6.0 → 11.0.0-alpha.1
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/{chunk-UODPQVMU.js → chunk-7ZKIEWG5.js} +109 -363
- package/dist/_node-chunks/{chunk-JMO4K5OA.js → chunk-EUU6EFAS.js} +6 -6
- package/dist/_node-chunks/{postinstallAddon-RI35EMUU.js → postinstallAddon-XDF7WG3V.js} +29 -13
- package/dist/_node-chunks/{run-H7JCVNWL.js → run-Y72TFO23.js} +10 -10
- package/dist/_node-chunks/{vitest.config.4.template-GO5UHHYJ.js → vitest.config.4.template-TTMYG36S.js} +7 -7
- package/dist/bin/index.js +7 -7
- package/dist/index.js +8 -8
- package/package.json +2 -3
- package/dist/_node-chunks/vitest.config.3.2.template-G2WNBAFU.js +0 -52
- package/dist/_node-chunks/vitest.config.template-R72ROP26.js +0 -52
- package/dist/_node-chunks/vitest.workspace.template-K2LEGFUH.js +0 -49
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.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_e12itq5dn8q.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__toESM
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EUU6EFAS.js";
|
|
16
16
|
|
|
17
17
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
18
18
|
var require_dist = __commonJS({
|
|
@@ -20,7 +20,7 @@ var require_dist = __commonJS({
|
|
|
20
20
|
"use strict";
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
22
22
|
exports.dedent = void 0;
|
|
23
|
-
function
|
|
23
|
+
function dedent14(templ) {
|
|
24
24
|
for (var values = [], _i = 1; _i < arguments.length; _i++)
|
|
25
25
|
values[_i - 1] = arguments[_i];
|
|
26
26
|
var strings = Array.from(typeof templ == "string" ? [templ] : templ);
|
|
@@ -52,8 +52,8 @@ var require_dist = __commonJS({
|
|
|
52
52
|
`)), string += indentedValue + strings[i + 1];
|
|
53
53
|
}), string;
|
|
54
54
|
}
|
|
55
|
-
exports.dedent =
|
|
56
|
-
exports.default =
|
|
55
|
+
exports.dedent = dedent14;
|
|
56
|
+
exports.default = dedent14;
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -122,8 +122,8 @@ var require_picocolors = __commonJS({
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
// src/initiate.ts
|
|
125
|
-
import { resolve as
|
|
126
|
-
import { ProjectType as
|
|
125
|
+
import { resolve as resolve5 } from "node:path";
|
|
126
|
+
import { ProjectType as ProjectType22 } from "storybook/internal/cli";
|
|
127
127
|
import {
|
|
128
128
|
PackageManagerName as PackageManagerName2,
|
|
129
129
|
cache,
|
|
@@ -136,15 +136,16 @@ import { Feature as Feature7 } from "storybook/internal/types";
|
|
|
136
136
|
|
|
137
137
|
// src/commands/PreflightCheckCommand.ts
|
|
138
138
|
var import_ts_dedent = __toESM(require_dist(), 1);
|
|
139
|
-
import { detectPnp } from "storybook/internal/cli";
|
|
140
139
|
import {
|
|
141
140
|
JsPackageManagerFactory,
|
|
142
141
|
PackageManagerName,
|
|
143
142
|
getPrettyPackageManagerName,
|
|
143
|
+
resolveStorybookVersionSpecifier,
|
|
144
144
|
isCI,
|
|
145
|
-
invalidateProjectRootCache
|
|
145
|
+
invalidateProjectRootCache,
|
|
146
|
+
getProcessAncestry as getProcessAncestry2
|
|
146
147
|
} from "storybook/internal/common";
|
|
147
|
-
import { CLI_COLORS,
|
|
148
|
+
import { CLI_COLORS, logger as logger2 } from "storybook/internal/node-logger";
|
|
148
149
|
import { MinimumReleaseAgeHandledError } from "storybook/internal/server-errors";
|
|
149
150
|
|
|
150
151
|
// src/scaffold-new-project.ts
|
|
@@ -158,8 +159,8 @@ import { telemetry as telemetry2 } from "storybook/internal/telemetry";
|
|
|
158
159
|
// src/prompt-cancel.ts
|
|
159
160
|
var createPromptCancelOptions = (telemetryService, promptName) => ({
|
|
160
161
|
async onCancel() {
|
|
161
|
-
let timeout, timeoutPromise = new Promise((
|
|
162
|
-
timeout = setTimeout(
|
|
162
|
+
let timeout, timeoutPromise = new Promise((resolve6) => {
|
|
163
|
+
timeout = setTimeout(resolve6, 2e3), timeout.unref?.();
|
|
163
164
|
});
|
|
164
165
|
try {
|
|
165
166
|
await Promise.race([
|
|
@@ -175,91 +176,13 @@ var createPromptCancelOptions = (telemetryService, promptName) => ({
|
|
|
175
176
|
});
|
|
176
177
|
|
|
177
178
|
// src/services/TelemetryService.ts
|
|
179
|
+
import {
|
|
180
|
+
getProcessAncestry,
|
|
181
|
+
getStorybookVersionSpecifierFromAncestry
|
|
182
|
+
} from "storybook/internal/common";
|
|
178
183
|
import { telemetry } from "storybook/internal/telemetry";
|
|
179
184
|
import { Feature } from "storybook/internal/types";
|
|
180
185
|
|
|
181
|
-
// ../../../node_modules/process-ancestry/dist/index.js
|
|
182
|
-
import os from "os";
|
|
183
|
-
import { execSync } from "child_process";
|
|
184
|
-
import { execSync as execSync2 } from "child_process";
|
|
185
|
-
function getProcessInfo(pid) {
|
|
186
|
-
try {
|
|
187
|
-
let output = execSync(`ps -p ${pid} -o pid=,ppid=,command=`, {
|
|
188
|
-
encoding: "utf8",
|
|
189
|
-
timeout: 5e3
|
|
190
|
-
// 5 second timeout
|
|
191
|
-
}).trim();
|
|
192
|
-
if (!output)
|
|
193
|
-
return null;
|
|
194
|
-
let [pidStr, ppidStr, ...commandParts] = output.split(/\s+/), parsedPid = pidStr ? parseInt(pidStr, 10) : NaN, parsedPpid = ppidStr ? parseInt(ppidStr, 10) : NaN;
|
|
195
|
-
return isNaN(parsedPid) || isNaN(parsedPpid) ? null : {
|
|
196
|
-
pid: parsedPid,
|
|
197
|
-
ppid: parsedPpid,
|
|
198
|
-
command: commandParts.join(" ") || void 0
|
|
199
|
-
};
|
|
200
|
-
} catch (error) {
|
|
201
|
-
return error instanceof Error && error.message.includes("timeout") && console.warn(`Process lookup timed out for PID ${pid}`), null;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function getAncestryUnix(startPid) {
|
|
205
|
-
let result = [], visited = /* @__PURE__ */ new Set(), currentPid = startPid, maxDepth = 1e3;
|
|
206
|
-
for (; currentPid && maxDepth > 0; ) {
|
|
207
|
-
if (visited.has(currentPid)) {
|
|
208
|
-
console.warn(`Detected cycle in process tree at PID ${currentPid}`);
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
visited.add(currentPid);
|
|
212
|
-
let info = getProcessInfo(currentPid);
|
|
213
|
-
if (!info || info.ppid === 0 || info.ppid === 1) break;
|
|
214
|
-
result.push(info), currentPid = info.ppid, maxDepth--;
|
|
215
|
-
}
|
|
216
|
-
return maxDepth === 0 && console.warn(`Reached maximum depth limit while traversing process tree from PID ${startPid}`), result;
|
|
217
|
-
}
|
|
218
|
-
function getProcessInfo2(pid) {
|
|
219
|
-
try {
|
|
220
|
-
let output = execSync2(
|
|
221
|
-
`wmic process where (ProcessId=${pid}) get ProcessId,ParentProcessId,CommandLine /format:csv`,
|
|
222
|
-
{
|
|
223
|
-
encoding: "utf8",
|
|
224
|
-
timeout: 1e4
|
|
225
|
-
// 10 second timeout (wmic can be slower)
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
if (!output)
|
|
229
|
-
return null;
|
|
230
|
-
let fields = output.split(`
|
|
231
|
-
`).filter((line) => line.trim() && !line.startsWith("Node")).pop()?.split(",");
|
|
232
|
-
if (!fields || fields.length < 4) return null;
|
|
233
|
-
let [_node, commandLine, parentPid, thisPid] = fields, parsedPid = thisPid ? parseInt(thisPid.trim(), 10) : NaN, parsedPpid = parentPid ? parseInt(parentPid.trim(), 10) : NaN;
|
|
234
|
-
return isNaN(parsedPid) || isNaN(parsedPpid) ? null : {
|
|
235
|
-
pid: parsedPid,
|
|
236
|
-
ppid: parsedPpid,
|
|
237
|
-
command: commandLine?.trim() || void 0
|
|
238
|
-
};
|
|
239
|
-
} catch (error) {
|
|
240
|
-
return error instanceof Error && error.message.includes("timeout") && console.warn(`Process lookup timed out for PID ${pid}`), null;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function getAncestryWindows(startPid) {
|
|
244
|
-
let result = [], visited = /* @__PURE__ */ new Set(), currentPid = startPid, maxDepth = 1e3;
|
|
245
|
-
for (; currentPid && maxDepth > 0; ) {
|
|
246
|
-
if (visited.has(currentPid)) {
|
|
247
|
-
console.warn(`Detected cycle in process tree at PID ${currentPid}`);
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
visited.add(currentPid);
|
|
251
|
-
let info = getProcessInfo2(currentPid);
|
|
252
|
-
if (!info || info.ppid === 0 || info.ppid === 4) break;
|
|
253
|
-
result.push(info), currentPid = info.ppid, maxDepth--;
|
|
254
|
-
}
|
|
255
|
-
return maxDepth === 0 && console.warn(`Reached maximum depth limit while traversing process tree from PID ${startPid}`), result;
|
|
256
|
-
}
|
|
257
|
-
function getProcessAncestry(pid = process.pid) {
|
|
258
|
-
if (typeof pid != "number" || !Number.isInteger(pid) || pid <= 0)
|
|
259
|
-
throw new Error("PID must be a positive integer");
|
|
260
|
-
return os.platform() === "win32" ? getAncestryWindows(pid) : getAncestryUnix(pid);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
186
|
// src/services/VersionService.ts
|
|
264
187
|
import { versions } from "storybook/internal/common";
|
|
265
188
|
import { lt, prerelease } from "semver";
|
|
@@ -280,17 +203,6 @@ var VersionService = class {
|
|
|
280
203
|
isOutdated(currentVersion, latestVersion) {
|
|
281
204
|
return lt(currentVersion, latestVersion);
|
|
282
205
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Extract Storybook version from process ancestry Looks for version specifiers in command history
|
|
285
|
-
* like: create-storybook@1.0.0 or storybook@1.0.0
|
|
286
|
-
*/
|
|
287
|
-
getStorybookVersionFromAncestry(ancestry) {
|
|
288
|
-
for (let ancestor of ancestry.toReversed()) {
|
|
289
|
-
let match = ancestor.command?.match(/\s(?:create-storybook|storybook)@([^\s]+)/);
|
|
290
|
-
if (match)
|
|
291
|
-
return match[1];
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
206
|
/**
|
|
295
207
|
* Extract CLI integration from process ancestry Detects if Storybook was invoked via sv create,
|
|
296
208
|
* sv add, create-rsbuild, or @tanstack/start commands
|
|
@@ -370,7 +282,7 @@ var TelemetryService = class {
|
|
|
370
282
|
let versionSpecifier, cliIntegration;
|
|
371
283
|
try {
|
|
372
284
|
let ancestry = getProcessAncestry();
|
|
373
|
-
versionSpecifier =
|
|
285
|
+
versionSpecifier = getStorybookVersionSpecifierFromAncestry(ancestry), cliIntegration = this.versionService.getCliIntegrationFromAncestry(ancestry);
|
|
374
286
|
} catch {
|
|
375
287
|
}
|
|
376
288
|
let telemetryFeatures = {
|
|
@@ -458,7 +370,7 @@ var SUPPORTED_PROJECTS = {
|
|
|
458
370
|
},
|
|
459
371
|
createScript: {
|
|
460
372
|
npm: "npm create vite@latest . -- --template lit-ts",
|
|
461
|
-
yarn: "yarn create vite . --template lit-ts && touch yarn.lock && yarn set version berry && yarn config set nodeLinker
|
|
373
|
+
yarn: "yarn create vite . --template lit-ts && touch yarn.lock && yarn set version berry && yarn config set nodeLinker node-modules",
|
|
462
374
|
pnpm: "pnpm create vite@latest . --template lit-ts"
|
|
463
375
|
}
|
|
464
376
|
}
|
|
@@ -551,7 +463,6 @@ import { SupportedBuilder, SupportedFramework, SupportedRenderer } from "storybo
|
|
|
551
463
|
var ONBOARDING_PROJECT_TYPES = [
|
|
552
464
|
ProjectType.REACT,
|
|
553
465
|
ProjectType.TANSTACK_REACT,
|
|
554
|
-
ProjectType.REACT_SCRIPTS,
|
|
555
466
|
ProjectType.REACT_NATIVE_WEB,
|
|
556
467
|
ProjectType.NEXTJS,
|
|
557
468
|
ProjectType.VUE3,
|
|
@@ -631,15 +542,17 @@ var PreflightCheckCommand = class {
|
|
|
631
542
|
this.telemetryService = telemetryService;
|
|
632
543
|
}
|
|
633
544
|
async execute(options) {
|
|
545
|
+
if (options.storybookVersionSpecifier === void 0)
|
|
546
|
+
try {
|
|
547
|
+
options.storybookVersionSpecifier = resolveStorybookVersionSpecifier(getProcessAncestry2());
|
|
548
|
+
} catch {
|
|
549
|
+
}
|
|
634
550
|
let isEmptyDirProject = options.force !== !0 && currentDirectoryIsEmpty(), packageManagerType = JsPackageManagerFactory.getPackageManagerType();
|
|
635
551
|
isEmptyDirProject && ((options.packageManager ? options.packageManager === PackageManagerName.YARN1 : packageManagerType === PackageManagerName.YARN1) && (logger2.warn("Empty directory with yarn1 is unsupported. Falling back to npm."), packageManagerType = PackageManagerName.NPM, options.packageManager = packageManagerType), logger2.intro(CLI_COLORS.info("Initializing a new project")), await scaffoldNewProject(packageManagerType, this.telemetryService), logger2.outro(CLI_COLORS.info("Project created successfully")), invalidateProjectRootCache()), logger2.intro(CLI_COLORS.info("Initializing Storybook"));
|
|
636
552
|
let packageManager = JsPackageManagerFactory.getPackageManager({
|
|
637
553
|
force: options.packageManager
|
|
638
554
|
});
|
|
639
|
-
logger2.info(`Package manager: ${getPrettyPackageManagerName(packageManager.type)}`), isEmptyDirProject && !options.skipInstall && await packageManager.installDependencies(),
|
|
640
|
-
As of Storybook 10.0, PnP is deprecated.
|
|
641
|
-
If you are using PnP, you can continue to use Storybook 10.0, but we recommend migrating to a different package manager or linker-mode. In future versions, PnP compatibility will be removed.
|
|
642
|
-
`), this.checkPackageNameConflict(packageManager), await this.displayVersionInfo(packageManager);
|
|
555
|
+
logger2.info(`Package manager: ${getPrettyPackageManagerName(packageManager.type)}`), isEmptyDirProject && !options.skipInstall && await packageManager.installDependencies(), this.checkPackageNameConflict(packageManager), await this.displayVersionInfo(packageManager);
|
|
643
556
|
try {
|
|
644
557
|
await packageManager.precheckStorybookPackageInstall({
|
|
645
558
|
storybookVersion: this.versionService.getCurrentVersion(),
|
|
@@ -787,14 +700,6 @@ var ProjectTypeService = class {
|
|
|
787
700
|
peerDependencies: ["react-native", "react-native-scripts", "expo"],
|
|
788
701
|
matcherFunction: ({ dependencies, peerDependencies }) => (dependencies?.some(Boolean) || peerDependencies?.some(Boolean)) ?? !1
|
|
789
702
|
},
|
|
790
|
-
{
|
|
791
|
-
preset: ProjectType2.REACT_SCRIPTS,
|
|
792
|
-
// For projects using a custom/forked `react-scripts` package.
|
|
793
|
-
files: ["/node_modules/.bin/react-scripts"],
|
|
794
|
-
// For standard CRA projects
|
|
795
|
-
dependencies: ["react-scripts"],
|
|
796
|
-
matcherFunction: ({ dependencies, files }) => (dependencies?.every(Boolean) || files?.every(Boolean)) ?? !1
|
|
797
|
-
},
|
|
798
703
|
{
|
|
799
704
|
preset: ProjectType2.ANGULAR,
|
|
800
705
|
dependencies: ["@angular/core"],
|
|
@@ -1358,8 +1263,16 @@ var defaultOptions = {
|
|
|
1358
1263
|
SupportedFramework3.VUE3_VITE,
|
|
1359
1264
|
SupportedFramework3.WEB_COMPONENTS_VITE
|
|
1360
1265
|
].includes(framework) : !1;
|
|
1361
|
-
async function baseGenerator(packageManager, npmOptions, {
|
|
1362
|
-
|
|
1266
|
+
async function baseGenerator(packageManager, npmOptions, {
|
|
1267
|
+
language,
|
|
1268
|
+
builder,
|
|
1269
|
+
framework,
|
|
1270
|
+
renderer,
|
|
1271
|
+
features,
|
|
1272
|
+
dependencyCollector,
|
|
1273
|
+
storybookVersionSpecifier
|
|
1274
|
+
}, _options) {
|
|
1275
|
+
let options = { ...defaultOptions, ..._options }, shouldApplyRequireWrapperOnPackageNames = packageManager.isStorybookInMonorepo(), taskLog = prompt5.taskLog({
|
|
1363
1276
|
id: "base-generator",
|
|
1364
1277
|
title: "Generating Storybook configuration"
|
|
1365
1278
|
}), { frameworkPackagePath, frameworkPackage } = getFrameworkDetails({
|
|
@@ -1414,7 +1327,8 @@ async function baseGenerator(packageManager, npmOptions, { language, builder, fr
|
|
|
1414
1327
|
} catch {
|
|
1415
1328
|
}
|
|
1416
1329
|
let versionedPackages = await packageManager.getVersionedPackages(
|
|
1417
|
-
packagesToInstall
|
|
1330
|
+
packagesToInstall,
|
|
1331
|
+
{ storybookVersionSpecifier }
|
|
1418
1332
|
);
|
|
1419
1333
|
versionedPackages.length > 0 && (npmOptions.type === "devDependencies" ? dependencyCollector.addDevDependencies(versionedPackages) : dependencyCollector.addDependencies(versionedPackages)), await mkdir(`./${storybookConfigFolder}`, { recursive: !0 });
|
|
1420
1334
|
let prefixes = shouldApplyRequireWrapperOnPackageNames ? [
|
|
@@ -1422,13 +1336,13 @@ async function baseGenerator(packageManager, npmOptions, { language, builder, fr
|
|
|
1422
1336
|
'import { fileURLToPath } from "url"',
|
|
1423
1337
|
language === SupportedLanguage3.JAVASCRIPT ? import_ts_dedent7.dedent`/**
|
|
1424
1338
|
* This function is used to resolve the absolute path of a package.
|
|
1425
|
-
* It is needed in projects that
|
|
1339
|
+
* It is needed in projects that are set up within a monorepo.
|
|
1426
1340
|
*/
|
|
1427
1341
|
function getAbsolutePath(value) {
|
|
1428
1342
|
return dirname(fileURLToPath(import.meta.resolve(\`\${value}/package.json\`)))
|
|
1429
1343
|
}` : import_ts_dedent7.dedent`/**
|
|
1430
1344
|
* This function is used to resolve the absolute path of a package.
|
|
1431
|
-
* It is needed in projects that
|
|
1345
|
+
* It is needed in projects that are set up within a monorepo.
|
|
1432
1346
|
*/
|
|
1433
1347
|
function getAbsolutePath(value: string) {
|
|
1434
1348
|
return dirname(fileURLToPath(import.meta.resolve(\`\${value}/package.json\`)))
|
|
@@ -1503,6 +1417,7 @@ var GeneratorExecutionCommand = class {
|
|
|
1503
1417
|
renderer: frameworkInfo.renderer,
|
|
1504
1418
|
builder: frameworkInfo.builder,
|
|
1505
1419
|
language,
|
|
1420
|
+
storybookVersionSpecifier: options.storybookVersionSpecifier,
|
|
1506
1421
|
telemetryService: this.telemetryService,
|
|
1507
1422
|
linkable: !!options.linkable,
|
|
1508
1423
|
features: selectedFeatures,
|
|
@@ -1513,8 +1428,8 @@ var GeneratorExecutionCommand = class {
|
|
|
1513
1428
|
builder: frameworkInfo.builder,
|
|
1514
1429
|
framework: frameworkInfo.framework,
|
|
1515
1430
|
renderer: frameworkInfo.renderer,
|
|
1431
|
+
storybookVersionSpecifier: options.storybookVersionSpecifier,
|
|
1516
1432
|
linkable: !!options.linkable,
|
|
1517
|
-
pnp: !!options.usePnp,
|
|
1518
1433
|
yes: !!options.yes,
|
|
1519
1434
|
projectType,
|
|
1520
1435
|
features: selectedFeatures,
|
|
@@ -1605,7 +1520,7 @@ async function postinstall(options) {
|
|
|
1605
1520
|
// ../../addons/vitest/src/postinstall.ts
|
|
1606
1521
|
import * as fs from "node:fs/promises";
|
|
1607
1522
|
import { writeFile as writeFile2 } from "node:fs/promises";
|
|
1608
|
-
import
|
|
1523
|
+
import os from "node:os";
|
|
1609
1524
|
import { babelParse as babelParse2, generate as generate2, traverse as traverse2 } from "storybook/internal/babel";
|
|
1610
1525
|
import { AddonVitestService as AddonVitestService2 } from "storybook/internal/cli";
|
|
1611
1526
|
import {
|
|
@@ -1620,8 +1535,7 @@ import {
|
|
|
1620
1535
|
AddonVitestPostinstallConfigUpdateError,
|
|
1621
1536
|
AddonVitestPostinstallError,
|
|
1622
1537
|
AddonVitestPostinstallFailedAddonA11yError,
|
|
1623
|
-
AddonVitestPostinstallPrerequisiteCheckError
|
|
1624
|
-
AddonVitestPostinstallWorkspaceUpdateError
|
|
1538
|
+
AddonVitestPostinstallPrerequisiteCheckError
|
|
1625
1539
|
} from "storybook/internal/server-errors";
|
|
1626
1540
|
import { SupportedFramework as SupportedFramework4 } from "storybook/internal/types";
|
|
1627
1541
|
|
|
@@ -1701,7 +1615,6 @@ var relative = function(from, to) {
|
|
|
1701
1615
|
|
|
1702
1616
|
// ../../addons/vitest/src/postinstall.ts
|
|
1703
1617
|
var import_ts_dedent8 = __toESM(require_dist(), 1);
|
|
1704
|
-
import { satisfies } from "semver";
|
|
1705
1618
|
|
|
1706
1619
|
// ../../addons/vitest/src/angular-vitest-postinstall.ts
|
|
1707
1620
|
import {
|
|
@@ -1849,22 +1762,11 @@ import {
|
|
|
1849
1762
|
isDefineConfigLike,
|
|
1850
1763
|
resolveExpression
|
|
1851
1764
|
} from "storybook/internal/babel";
|
|
1852
|
-
async function getTemplatePath(
|
|
1853
|
-
|
|
1854
|
-
case "vitest.config.template":
|
|
1855
|
-
return import("./vitest.config.template-R72ROP26.js");
|
|
1856
|
-
case "vitest.config.4.template":
|
|
1857
|
-
return import("./vitest.config.4.template-GO5UHHYJ.js");
|
|
1858
|
-
case "vitest.config.3.2.template":
|
|
1859
|
-
return import("./vitest.config.3.2.template-G2WNBAFU.js");
|
|
1860
|
-
case "vitest.workspace.template":
|
|
1861
|
-
return import("./vitest.workspace.template-K2LEGFUH.js");
|
|
1862
|
-
default:
|
|
1863
|
-
throw new Error(`Unknown template: ${name}`);
|
|
1864
|
-
}
|
|
1765
|
+
async function getTemplatePath() {
|
|
1766
|
+
return import("./vitest.config.4.template-TTMYG36S.js");
|
|
1865
1767
|
}
|
|
1866
1768
|
var loadTemplate = async (name, replacements) => {
|
|
1867
|
-
let template = (await getTemplatePath(
|
|
1769
|
+
let template = (await getTemplatePath()).default;
|
|
1868
1770
|
return Object.entries(replacements).forEach(
|
|
1869
1771
|
([key, value]) => template = template.replace(key, normalize(value))
|
|
1870
1772
|
), template;
|
|
@@ -1883,11 +1785,10 @@ var loadTemplate = async (name, replacements) => {
|
|
|
1883
1785
|
return resolved?.type === "ObjectExpression" ? resolved : null;
|
|
1884
1786
|
}, findNamedProp = (properties, name) => properties.find(
|
|
1885
1787
|
(p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === name
|
|
1886
|
-
),
|
|
1887
|
-
let existingKeyName = existingProjectRefsProp.key.type === "Identifier" ? existingProjectRefsProp.key.name : null;
|
|
1788
|
+
), isProjectsArrayProp = (p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "projects" && p.value.type === "ArrayExpression", appendToExistingProjectRefs = (existingProjectRefsProp, resolvedTestValue, templateTestProp, properties, targetConfigObject) => {
|
|
1888
1789
|
if (templateTestProp && templateTestProp.value.type === "ObjectExpression") {
|
|
1889
1790
|
let templateProjectRefsProp = templateTestProp.value.properties.find(
|
|
1890
|
-
(p) =>
|
|
1791
|
+
(p) => isProjectsArrayProp(p)
|
|
1891
1792
|
);
|
|
1892
1793
|
templateProjectRefsProp && templateProjectRefsProp.value.type === "ArrayExpression" && existingProjectRefsProp.value.elements.push(
|
|
1893
1794
|
...templateProjectRefsProp.value.elements
|
|
@@ -1898,17 +1799,15 @@ var loadTemplate = async (name, replacements) => {
|
|
|
1898
1799
|
).map((p) => p.key.name)
|
|
1899
1800
|
);
|
|
1900
1801
|
for (let templateProp of templateTestProp.value.properties)
|
|
1901
|
-
templateProp.type === "ObjectProperty" && templateProp.key.type === "Identifier" && templateProp.key.name !== "projects" &&
|
|
1802
|
+
templateProp.type === "ObjectProperty" && templateProp.key.type === "Identifier" && templateProp.key.name !== "projects" && !existingTestPropNames.has(templateProp.key.name) && resolvedTestValue.properties.push(templateProp);
|
|
1902
1803
|
}
|
|
1903
1804
|
let otherTemplateProps = properties.filter(
|
|
1904
1805
|
(p) => !(p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "test")
|
|
1905
1806
|
);
|
|
1906
1807
|
otherTemplateProps.length > 0 && mergeProperties(otherTemplateProps, targetConfigObject.properties);
|
|
1907
1808
|
}, wrapTestConfigAsProject = (resolvedTestValue, existingTestProp, templateTestProp, properties, targetConfigObject) => {
|
|
1908
|
-
let
|
|
1909
|
-
|
|
1910
|
-
) : void 0;
|
|
1911
|
-
if (!workspaceOrProjectsProp || workspaceOrProjectsProp.value.type !== "ArrayExpression") {
|
|
1809
|
+
let projectsProp = templateTestProp.value.type === "ObjectExpression" ? templateTestProp.value.properties.find((p) => isProjectsArrayProp(p)) : void 0;
|
|
1810
|
+
if (!projectsProp || projectsProp.value.type !== "ArrayExpression") {
|
|
1912
1811
|
mergeProperties(properties, targetConfigObject.properties);
|
|
1913
1812
|
return;
|
|
1914
1813
|
}
|
|
@@ -1964,15 +1863,13 @@ var loadTemplate = async (name, replacements) => {
|
|
|
1964
1863
|
}
|
|
1965
1864
|
]
|
|
1966
1865
|
};
|
|
1967
|
-
|
|
1866
|
+
projectsProp.value.elements.unshift(existingTestProject), targetConfigObject.properties = targetConfigObject.properties.filter(
|
|
1968
1867
|
(p) => p !== existingTestProp
|
|
1969
1868
|
), topLevelProps.length > 0 && templateTestProp.value.type === "ObjectExpression" && templateTestProp.value.properties.unshift(...topLevelProps), mergeProperties(properties, targetConfigObject.properties);
|
|
1970
1869
|
}, mergeTemplateIntoConfigObject = (targetConfigObject, properties, target) => {
|
|
1971
1870
|
let existingTestProp = findNamedProp(targetConfigObject.properties, "test"), resolvedTestValue = existingTestProp ? resolveTestPropValue(existingTestProp, target) : null, templateTestProp = findNamedProp(properties, "test");
|
|
1972
1871
|
if (existingTestProp && resolvedTestValue !== null) {
|
|
1973
|
-
let existingProjectRefsProp = resolvedTestValue.properties.find(
|
|
1974
|
-
isWorkspaceOrProjectsArrayProp
|
|
1975
|
-
);
|
|
1872
|
+
let existingProjectRefsProp = resolvedTestValue.properties.find(isProjectsArrayProp);
|
|
1976
1873
|
if (existingProjectRefsProp) {
|
|
1977
1874
|
appendToExistingProjectRefs(
|
|
1978
1875
|
existingProjectRefsProp,
|
|
@@ -2071,33 +1968,6 @@ var loadTemplate = async (name, replacements) => {
|
|
|
2071
1968
|
}
|
|
2072
1969
|
}
|
|
2073
1970
|
return updated;
|
|
2074
|
-
}, updateWorkspaceFile = (source, target) => {
|
|
2075
|
-
let updated = !1;
|
|
2076
|
-
for (let sourceNode of source.program.body)
|
|
2077
|
-
if (sourceNode.type === "ImportDeclaration") {
|
|
2078
|
-
if (!target.program.body.some(
|
|
2079
|
-
(targetNode) => targetNode.type === sourceNode.type && targetNode.source.value === sourceNode.source.value && targetNode.specifiers.some((s) => s.local.name === sourceNode.specifiers[0].local.name)
|
|
2080
|
-
)) {
|
|
2081
|
-
let lastImport = target.program.body.findLastIndex((n) => n.type === "ImportDeclaration");
|
|
2082
|
-
target.program.body.splice(lastImport + 1, 0, sourceNode);
|
|
2083
|
-
}
|
|
2084
|
-
} else if (sourceNode.type === "VariableDeclaration") {
|
|
2085
|
-
if (!target.program.body.some(
|
|
2086
|
-
(targetNode) => targetNode.type === sourceNode.type && targetNode.declarations.some(
|
|
2087
|
-
(d) => "name" in d.id && "name" in sourceNode.declarations[0].id && d.id.name === sourceNode.declarations[0].id.name
|
|
2088
|
-
)
|
|
2089
|
-
)) {
|
|
2090
|
-
let lastImport = target.program.body.findLastIndex((n) => n.type === "ImportDeclaration");
|
|
2091
|
-
target.program.body.splice(lastImport + 1, 0, sourceNode);
|
|
2092
|
-
}
|
|
2093
|
-
} else if (sourceNode.type === "ExportDefaultDeclaration") {
|
|
2094
|
-
let exportDefault = target.program.body.find((n) => n.type === "ExportDefaultDeclaration");
|
|
2095
|
-
if (exportDefault && sourceNode.declaration.type === "CallExpression" && sourceNode.declaration.arguments.length > 0 && sourceNode.declaration.arguments[0].type === "ArrayExpression" && sourceNode.declaration.arguments[0].elements.length > 0) {
|
|
2096
|
-
let { elements } = sourceNode.declaration.arguments[0];
|
|
2097
|
-
exportDefault.declaration.type === "ArrayExpression" ? (exportDefault.declaration.elements.push(...elements), updated = !0) : exportDefault.declaration.type === "CallExpression" && exportDefault.declaration.callee.type === "Identifier" && exportDefault.declaration.callee.name === "defineWorkspace" && exportDefault.declaration.arguments[0]?.type === "ArrayExpression" && (exportDefault.declaration.arguments[0].elements.push(...elements), updated = !0);
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
return updated;
|
|
2101
1971
|
};
|
|
2102
1972
|
|
|
2103
1973
|
// ../../addons/vitest/src/postinstall.ts
|
|
@@ -2108,11 +1978,7 @@ async function postInstall(options) {
|
|
|
2108
1978
|
}), findFile = (basename2, extensions = EXTENSIONS) => any(
|
|
2109
1979
|
extensions.map((ext) => basename2 + ext),
|
|
2110
1980
|
{ last: getProjectRoot3(), cwd: options.configDir }
|
|
2111
|
-
), allDeps = packageManager.getAllDependencies(), addonVitestService = new AddonVitestService2(packageManager),
|
|
2112
|
-
await packageManager.getDeclaredVersionSpecifier("vitest")
|
|
2113
|
-
);
|
|
2114
|
-
logger18.debug(`Vitest version specifier: ${vitestVersionSpecifier}`);
|
|
2115
|
-
let isVitest3_2To4 = vitestVersionSpecifier ? satisfies(vitestVersionSpecifier, ">=3.2.0 <4.0.0") : !1, isVitest4OrNewer = vitestVersionSpecifier ? satisfies(vitestVersionSpecifier, ">=4.0.0") : !0, info = await getStorybookInfo(options.configDir, void 0, { skipCache: !0 }), compatibilityResult = await addonVitestService.validateCompatibility({
|
|
1981
|
+
), allDeps = packageManager.getAllDependencies(), addonVitestService = new AddonVitestService2(packageManager), info = await getStorybookInfo(options.configDir, void 0, { skipCache: !0 }), compatibilityResult = await addonVitestService.validateCompatibility({
|
|
2116
1982
|
framework: info.framework,
|
|
2117
1983
|
builder: info.builder
|
|
2118
1984
|
}), result = null;
|
|
@@ -2160,19 +2026,16 @@ async function postInstall(options) {
|
|
|
2160
2026
|
useRemotePkg: !!options.skipInstall
|
|
2161
2027
|
});
|
|
2162
2028
|
else {
|
|
2163
|
-
let platform =
|
|
2029
|
+
let platform = os.platform(), useWithDeps = platform === "darwin" || platform === "win32", manualCommand = useWithDeps ? "npx playwright install chromium --with-deps" : "npx playwright install chromium", linuxNote = useWithDeps ? "" : `
|
|
2164
2030
|
Note: add --with-deps to the command above if you are on Debian or Ubuntu.`;
|
|
2165
2031
|
logger18.warn(import_ts_dedent8.dedent`
|
|
2166
2032
|
Playwright browser binaries installation skipped. Please run the following command manually later:
|
|
2167
2033
|
${CLI_COLORS2.cta(manualCommand)}${linuxNote}
|
|
2168
2034
|
`);
|
|
2169
2035
|
}
|
|
2170
|
-
let fileExtension = allDeps.typescript || findFile("tsconfig", [...EXTENSIONS, ".json"]) ? "ts" : "js",
|
|
2171
|
-
fileExtension === "ts" && !vitestShimFile && await writeFile2(
|
|
2172
|
-
|
|
2173
|
-
isVitest4OrNewer ? '/// <reference types="@vitest/browser-playwright" />' : '/// <reference types="@vitest/browser/providers/playwright" />'
|
|
2174
|
-
);
|
|
2175
|
-
let getTemplateName = (configContent) => isVitest4OrNewer ? "vitest.config.4.template" : isVitest3_2To4 ? configContent && configUsesWorkspace(configContent) ? "vitest.config.template" : "vitest.config.3.2.template" : "vitest.config.template", isAngularVite = info.framework === SupportedFramework4.ANGULAR_VITE, maybeWireAngular = async (filePath, content, ErrorClass = AddonVitestPostinstallConfigUpdateError) => {
|
|
2036
|
+
let fileExtension = allDeps.typescript || findFile("tsconfig", [...EXTENSIONS, ".json"]) ? "ts" : "js", viteConfigFile = findFile("vite.config"), vitestConfigFile = findFile("vitest.config"), vitestShimFile = findFile("vitest.shims.d"), rootConfig = vitestConfigFile || viteConfigFile;
|
|
2037
|
+
fileExtension === "ts" && !vitestShimFile && await writeFile2("vitest.shims.d.ts", '/// <reference types="@vitest/browser-playwright" />');
|
|
2038
|
+
let isAngularVite = info.framework === SupportedFramework4.ANGULAR_VITE, maybeWireAngular = async (filePath, content) => {
|
|
2176
2039
|
if (!isAngularVite || isAngularVitestAlreadyWired(content))
|
|
2177
2040
|
return;
|
|
2178
2041
|
let injected = injectAngularVitestIntoConfig(content);
|
|
@@ -2185,64 +2048,18 @@ async function postInstall(options) {
|
|
|
2185
2048
|
Please add storybookAngularVitest({}) to the plugins array next to storybookTest()
|
|
2186
2049
|
and import it from "@storybook/angular-vite/vitest". See:
|
|
2187
2050
|
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK3}#manual-setup-advanced
|
|
2188
|
-
`), errors.push(new
|
|
2051
|
+
`), errors.push(new AddonVitestPostinstallConfigUpdateError({ filePath }));
|
|
2189
2052
|
return;
|
|
2190
2053
|
}
|
|
2191
2054
|
let formattedContent = await formatFileContent(filePath, injected);
|
|
2192
2055
|
await writeFile2(filePath, formattedContent), logger18.step("Added the @storybook/angular-vite standalone-vitest bridge.");
|
|
2193
2056
|
};
|
|
2194
|
-
if (
|
|
2195
|
-
let workspaceFileContent = await fs.readFile(vitestWorkspaceFile, "utf8");
|
|
2196
|
-
if (isConfigAlreadySetup(vitestWorkspaceFile, workspaceFileContent)) {
|
|
2197
|
-
await maybeWireAngular(
|
|
2198
|
-
vitestWorkspaceFile,
|
|
2199
|
-
workspaceFileContent,
|
|
2200
|
-
AddonVitestPostinstallWorkspaceUpdateError
|
|
2201
|
-
), logger18.step(
|
|
2202
|
-
CLI_COLORS2.success("Vitest for Storybook is already properly configured. Skipping setup.")
|
|
2203
|
-
);
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
|
-
let workspaceTemplate = await loadTemplate("vitest.workspace.template", {
|
|
2207
|
-
EXTENDS_WORKSPACE: viteConfigFile ? relative(dirname3(vitestWorkspaceFile), viteConfigFile) : "",
|
|
2208
|
-
CONFIG_DIR: getTemplateConfigDir(vitestWorkspaceFile, options.configDir)
|
|
2209
|
-
}).then((t3) => t3.replace(`
|
|
2210
|
-
'ROOT_CONFIG',`, "").replace(/\s+extends: '',/, "")), source = babelParse2(workspaceTemplate), target = babelParse2(workspaceFileContent);
|
|
2211
|
-
if (updateWorkspaceFile(source, target)) {
|
|
2212
|
-
logger18.step("Updating your Vitest workspace file..."), logger18.log(`${vitestWorkspaceFile}`), isAngularVite && !isAngularVitestAlreadyWired(workspaceFileContent) && (injectAngularVitestIntoAst(target) ? logger18.step("Added the @storybook/angular-vite standalone-vitest bridge.") : (logger18.error(import_ts_dedent8.dedent`
|
|
2213
|
-
We configured @storybook/addon-vitest, but could not automatically add the
|
|
2214
|
-
@storybook/angular-vite standalone-vitest bridge to your workspace file:
|
|
2215
|
-
${vitestWorkspaceFile}
|
|
2216
|
-
|
|
2217
|
-
Please add storybookAngularVitest({}) to the plugins array next to storybookTest()
|
|
2218
|
-
in the referenced config and import it from "@storybook/angular-vite/vitest". See:
|
|
2219
|
-
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK3}#manual-setup-advanced
|
|
2220
|
-
`), errors.push(
|
|
2221
|
-
new AddonVitestPostinstallWorkspaceUpdateError({ filePath: vitestWorkspaceFile })
|
|
2222
|
-
)));
|
|
2223
|
-
let formattedContent = await formatFileContent(vitestWorkspaceFile, generate2(target).code);
|
|
2224
|
-
await writeFile2(vitestWorkspaceFile, formattedContent);
|
|
2225
|
-
} else
|
|
2226
|
-
logger18.error(
|
|
2227
|
-
import_ts_dedent8.dedent`
|
|
2228
|
-
Could not update existing Vitest workspace file:
|
|
2229
|
-
${vitestWorkspaceFile}
|
|
2230
|
-
|
|
2231
|
-
I was able to configure most of the addon but could not safely extend
|
|
2232
|
-
your existing workspace file automatically, you must do it yourself.
|
|
2233
|
-
|
|
2234
|
-
Please refer to the documentation to complete the setup manually:
|
|
2235
|
-
https://storybook.js.org/docs/next/${DOCUMENTATION_LINK3}#manual-setup-advanced
|
|
2236
|
-
`
|
|
2237
|
-
), errors.push(
|
|
2238
|
-
new AddonVitestPostinstallWorkspaceUpdateError({ filePath: vitestWorkspaceFile })
|
|
2239
|
-
);
|
|
2240
|
-
} else if (rootConfig) {
|
|
2057
|
+
if (rootConfig) {
|
|
2241
2058
|
let target, updated, configFile = await fs.readFile(rootConfig, "utf8"), configFileHasTypeReference = configFile.match(
|
|
2242
2059
|
/\/\/\/\s*<reference\s+types=["']vitest\/config["']\s*\/>/
|
|
2243
|
-
),
|
|
2244
|
-
if (
|
|
2245
|
-
let configTemplate = await loadTemplate(
|
|
2060
|
+
), alreadyConfigured = isConfigAlreadySetup(rootConfig, configFile);
|
|
2061
|
+
if (!alreadyConfigured) {
|
|
2062
|
+
let configTemplate = await loadTemplate("vitest.config.4.template", {
|
|
2246
2063
|
CONFIG_DIR: getTemplateConfigDir(rootConfig, options.configDir)
|
|
2247
2064
|
}), source = babelParse2(configTemplate);
|
|
2248
2065
|
target = babelParse2(configFile), updated = updateConfigFile(source, target);
|
|
@@ -2275,7 +2092,7 @@ async function postInstall(options) {
|
|
|
2275
2092
|
https://storybook.js.org/docs/writing-tests/integrations/vitest-addon#manual-setup-advanced
|
|
2276
2093
|
`), errors.push(new AddonVitestPostinstallConfigUpdateError({ filePath: rootConfig }));
|
|
2277
2094
|
} else {
|
|
2278
|
-
let parentDir = dirname3(options.configDir), newConfigFile = resolve4(parentDir, `vitest.config.${fileExtension}`), configTemplate = await loadTemplate(
|
|
2095
|
+
let parentDir = dirname3(options.configDir), newConfigFile = resolve4(parentDir, `vitest.config.${fileExtension}`), configTemplate = await loadTemplate("vitest.config.4.template", {
|
|
2279
2096
|
CONFIG_DIR: getTemplateConfigDir(newConfigFile, options.configDir)
|
|
2280
2097
|
});
|
|
2281
2098
|
logger18.step("Creating a Vitest config file:"), logger18.log(`${newConfigFile}`);
|
|
@@ -2372,28 +2189,6 @@ function isConfigAlreadySetup(_configPath, configContent) {
|
|
|
2372
2189
|
}
|
|
2373
2190
|
}), pluginReferenced;
|
|
2374
2191
|
}
|
|
2375
|
-
function configUsesWorkspace(configContent) {
|
|
2376
|
-
let ast;
|
|
2377
|
-
try {
|
|
2378
|
-
ast = babelParse2(configContent);
|
|
2379
|
-
} catch {
|
|
2380
|
-
return !1;
|
|
2381
|
-
}
|
|
2382
|
-
let found = !1;
|
|
2383
|
-
return traverse2(ast, {
|
|
2384
|
-
ObjectProperty(path4) {
|
|
2385
|
-
if (found) {
|
|
2386
|
-
path4.stop();
|
|
2387
|
-
return;
|
|
2388
|
-
}
|
|
2389
|
-
let key = path4.node.key;
|
|
2390
|
-
if (key.type === "Identifier" && key.name === "workspace") {
|
|
2391
|
-
let parent = path4.parentPath?.parentPath;
|
|
2392
|
-
parent?.isObjectProperty() && parent.node.key.type === "Identifier" && parent.node.key.name === "test" && (found = !0, path4.stop());
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
}), found;
|
|
2396
|
-
}
|
|
2397
2192
|
|
|
2398
2193
|
// src/commands/AddonConfigurationCommand.ts
|
|
2399
2194
|
var ADDON_INSTALLATION_INSTRUCTIONS = {
|
|
@@ -2447,7 +2242,7 @@ var ADDON_INSTALLATION_INSTRUCTIONS = {
|
|
|
2447
2242
|
}
|
|
2448
2243
|
/** Configure test addons (a11y and vitest) */
|
|
2449
2244
|
async configureAddons(configDir, addons) {
|
|
2450
|
-
let { postinstallAddon } = await import("./postinstallAddon-
|
|
2245
|
+
let { postinstallAddon } = await import("./postinstallAddon-XDF7WG3V.js"), task = prompt6.taskLog({
|
|
2451
2246
|
id: "configure-addons",
|
|
2452
2247
|
title: "Configuring addons..."
|
|
2453
2248
|
}), addonResults = /* @__PURE__ */ new Map();
|
|
@@ -2832,7 +2627,6 @@ var ANGULAR_default = {
|
|
|
2832
2627
|
`@types/node@^${Math.min(...MIN_SUPPORTED_NODE_VERSIONS.map((v) => v.major))}`,
|
|
2833
2628
|
...extraAngularDeps,
|
|
2834
2629
|
...isVite ? [
|
|
2835
|
-
angularVersion ? `@angular/animations@${angularVersion}` : "@angular/animations",
|
|
2836
2630
|
angularVersion ? `@angular/build@${angularVersion}` : "@angular/build",
|
|
2837
2631
|
`@analogjs/vite-plugin-angular@${ANALOG_VITE_PLUGIN_ANGULAR_VERSION}`,
|
|
2838
2632
|
"vite"
|
|
@@ -3442,7 +3236,9 @@ var lastMetroCodemodResult, lastScriptDerivationResult, detectReactNativeEntrypo
|
|
|
3442
3236
|
"@storybook/react-native-ui-lite",
|
|
3443
3237
|
"storybook"
|
|
3444
3238
|
], packages = [
|
|
3445
|
-
...await packageManager.getVersionedPackages(packagesToResolve
|
|
3239
|
+
...await packageManager.getVersionedPackages(packagesToResolve, {
|
|
3240
|
+
storybookVersionSpecifier: context.storybookVersionSpecifier
|
|
3241
|
+
}),
|
|
3446
3242
|
...missingReactDom && reactVersion ? [`react-dom@${reactVersion}`] : []
|
|
3447
3243
|
];
|
|
3448
3244
|
dependencyCollector.addDependencies(packages), packageManager.addScripts({
|
|
@@ -3570,63 +3366,14 @@ var REACT_NATIVE_AND_RNW_default = {
|
|
|
3570
3366
|
}
|
|
3571
3367
|
};
|
|
3572
3368
|
|
|
3573
|
-
// src/generators/
|
|
3574
|
-
var import_ts_dedent14 = __toESM(require_dist(), 1);
|
|
3575
|
-
import { existsSync as existsSync4 } from "node:fs";
|
|
3576
|
-
import { resolve as resolve5 } from "node:path";
|
|
3577
|
-
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
3369
|
+
// src/generators/SERVER/index.ts
|
|
3578
3370
|
import { ProjectType as ProjectType15 } from "storybook/internal/cli";
|
|
3579
3371
|
import { SupportedBuilder as SupportedBuilder13, SupportedRenderer as SupportedRenderer14 } from "storybook/internal/types";
|
|
3580
|
-
import semver3 from "semver";
|
|
3581
|
-
var REACT_SCRIPTS_default = {
|
|
3582
|
-
metadata: {
|
|
3583
|
-
projectType: ProjectType15.REACT_SCRIPTS,
|
|
3584
|
-
renderer: SupportedRenderer14.REACT,
|
|
3585
|
-
builderOverride: SupportedBuilder13.WEBPACK5
|
|
3586
|
-
},
|
|
3587
|
-
configure: async (packageManager, context) => {
|
|
3588
|
-
let monorepoRootPath = fileURLToPath4(new URL("../../../../../../..", import.meta.url)), extraMain = context.linkable ? {
|
|
3589
|
-
webpackFinal: `%%(config) => {
|
|
3590
|
-
// add monorepo root as a valid directory to import modules from
|
|
3591
|
-
config.resolve.plugins.forEach((p) => {
|
|
3592
|
-
if (Array.isArray(p.appSrcs)) {
|
|
3593
|
-
p.appSrcs.push('${monorepoRootPath}');
|
|
3594
|
-
}
|
|
3595
|
-
});
|
|
3596
|
-
return config;
|
|
3597
|
-
}
|
|
3598
|
-
%%`
|
|
3599
|
-
} : {}, craVersion = (await packageManager.getModulePackageJSON("react-scripts"))?.version ?? null;
|
|
3600
|
-
if (craVersion === null)
|
|
3601
|
-
throw new Error(import_ts_dedent14.dedent`
|
|
3602
|
-
It looks like you're trying to initialize Storybook in a CRA project that does not have react-scripts installed.
|
|
3603
|
-
Please install it and make sure it's of version 5 or higher, which are the versions supported by Storybook 7.0+.
|
|
3604
|
-
`);
|
|
3605
|
-
if (craVersion && semver3.lt(craVersion, "5.0.0"))
|
|
3606
|
-
throw new Error(import_ts_dedent14.dedent`
|
|
3607
|
-
Storybook 7.0+ doesn't support react-scripts@<5.0.0.
|
|
3608
|
-
|
|
3609
|
-
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#create-react-app-dropped-cra4-support
|
|
3610
|
-
`);
|
|
3611
|
-
return {
|
|
3612
|
-
webpackCompiler: () => {
|
|
3613
|
-
},
|
|
3614
|
-
extraAddons: ["@storybook/preset-create-react-app"],
|
|
3615
|
-
extraPackages: ["webpack", "prop-types"],
|
|
3616
|
-
staticDir: existsSync4(resolve5("./public")) ? "public" : void 0,
|
|
3617
|
-
extraMain
|
|
3618
|
-
};
|
|
3619
|
-
}
|
|
3620
|
-
};
|
|
3621
|
-
|
|
3622
|
-
// src/generators/SERVER/index.ts
|
|
3623
|
-
import { ProjectType as ProjectType16 } from "storybook/internal/cli";
|
|
3624
|
-
import { SupportedBuilder as SupportedBuilder14, SupportedRenderer as SupportedRenderer15 } from "storybook/internal/types";
|
|
3625
3372
|
var SERVER_default = {
|
|
3626
3373
|
metadata: {
|
|
3627
|
-
projectType:
|
|
3628
|
-
renderer:
|
|
3629
|
-
builderOverride:
|
|
3374
|
+
projectType: ProjectType15.SERVER,
|
|
3375
|
+
renderer: SupportedRenderer14.SERVER,
|
|
3376
|
+
builderOverride: SupportedBuilder13.WEBPACK5
|
|
3630
3377
|
},
|
|
3631
3378
|
configure: async () => ({
|
|
3632
3379
|
webpackCompiler: () => "swc",
|
|
@@ -3635,14 +3382,14 @@ var SERVER_default = {
|
|
|
3635
3382
|
};
|
|
3636
3383
|
|
|
3637
3384
|
// src/generators/SOLID/index.ts
|
|
3638
|
-
import { ProjectType as
|
|
3639
|
-
import { SupportedBuilder as
|
|
3385
|
+
import { ProjectType as ProjectType16 } from "storybook/internal/cli";
|
|
3386
|
+
import { SupportedBuilder as SupportedBuilder14, SupportedFramework as SupportedFramework12, SupportedRenderer as SupportedRenderer15 } from "storybook/internal/types";
|
|
3640
3387
|
var SOLID_default = {
|
|
3641
3388
|
metadata: {
|
|
3642
|
-
projectType:
|
|
3643
|
-
renderer:
|
|
3389
|
+
projectType: ProjectType16.SOLID,
|
|
3390
|
+
renderer: SupportedRenderer15.SOLID,
|
|
3644
3391
|
framework: SupportedFramework12.SOLID,
|
|
3645
|
-
builderOverride:
|
|
3392
|
+
builderOverride: SupportedBuilder14.VITE
|
|
3646
3393
|
},
|
|
3647
3394
|
configure: async () => ({
|
|
3648
3395
|
addComponents: !0
|
|
@@ -3650,12 +3397,12 @@ var SOLID_default = {
|
|
|
3650
3397
|
};
|
|
3651
3398
|
|
|
3652
3399
|
// src/generators/SVELTE/index.ts
|
|
3653
|
-
import { ProjectType as
|
|
3654
|
-
import { SupportedRenderer as
|
|
3400
|
+
import { ProjectType as ProjectType17 } from "storybook/internal/cli";
|
|
3401
|
+
import { SupportedRenderer as SupportedRenderer16 } from "storybook/internal/types";
|
|
3655
3402
|
var SVELTE_default = {
|
|
3656
3403
|
metadata: {
|
|
3657
|
-
projectType:
|
|
3658
|
-
renderer:
|
|
3404
|
+
projectType: ProjectType17.SVELTE,
|
|
3405
|
+
renderer: SupportedRenderer16.SVELTE
|
|
3659
3406
|
},
|
|
3660
3407
|
configure: async () => ({
|
|
3661
3408
|
extensions: ["js", "ts", "svelte"],
|
|
@@ -3664,14 +3411,14 @@ var SVELTE_default = {
|
|
|
3664
3411
|
};
|
|
3665
3412
|
|
|
3666
3413
|
// src/generators/SVELTEKIT/index.ts
|
|
3667
|
-
import { ProjectType as
|
|
3668
|
-
import { SupportedBuilder as
|
|
3414
|
+
import { ProjectType as ProjectType18 } from "storybook/internal/cli";
|
|
3415
|
+
import { SupportedBuilder as SupportedBuilder15, SupportedFramework as SupportedFramework13, SupportedRenderer as SupportedRenderer17 } from "storybook/internal/types";
|
|
3669
3416
|
var SVELTEKIT_default = {
|
|
3670
3417
|
metadata: {
|
|
3671
|
-
projectType:
|
|
3672
|
-
renderer:
|
|
3418
|
+
projectType: ProjectType18.SVELTEKIT,
|
|
3419
|
+
renderer: SupportedRenderer17.SVELTE,
|
|
3673
3420
|
framework: SupportedFramework13.SVELTEKIT,
|
|
3674
|
-
builderOverride:
|
|
3421
|
+
builderOverride: SupportedBuilder15.VITE
|
|
3675
3422
|
},
|
|
3676
3423
|
configure: async () => ({
|
|
3677
3424
|
extensions: ["js", "ts", "svelte"],
|
|
@@ -3680,14 +3427,14 @@ var SVELTEKIT_default = {
|
|
|
3680
3427
|
};
|
|
3681
3428
|
|
|
3682
3429
|
// src/generators/TANSTACK/index.ts
|
|
3683
|
-
import { ProjectType as
|
|
3684
|
-
import { SupportedBuilder as
|
|
3430
|
+
import { ProjectType as ProjectType19 } from "storybook/internal/cli";
|
|
3431
|
+
import { SupportedBuilder as SupportedBuilder16, SupportedFramework as SupportedFramework14, SupportedRenderer as SupportedRenderer18 } from "storybook/internal/types";
|
|
3685
3432
|
var TANSTACK_default = {
|
|
3686
3433
|
metadata: {
|
|
3687
|
-
projectType:
|
|
3688
|
-
renderer:
|
|
3434
|
+
projectType: ProjectType19.TANSTACK_REACT,
|
|
3435
|
+
renderer: SupportedRenderer18.REACT,
|
|
3689
3436
|
framework: SupportedFramework14.TANSTACK_REACT,
|
|
3690
|
-
builderOverride:
|
|
3437
|
+
builderOverride: SupportedBuilder16.VITE
|
|
3691
3438
|
},
|
|
3692
3439
|
configure: async () => ({
|
|
3693
3440
|
extraPackages: ["@tanstack/react-query", "@tanstack/react-router"]
|
|
@@ -3695,37 +3442,36 @@ var TANSTACK_default = {
|
|
|
3695
3442
|
};
|
|
3696
3443
|
|
|
3697
3444
|
// src/generators/VUE3/index.ts
|
|
3698
|
-
import { ProjectType as
|
|
3699
|
-
import { SupportedBuilder as
|
|
3445
|
+
import { ProjectType as ProjectType20 } from "storybook/internal/cli";
|
|
3446
|
+
import { SupportedBuilder as SupportedBuilder17, SupportedRenderer as SupportedRenderer19 } from "storybook/internal/types";
|
|
3700
3447
|
var VUE3_default = {
|
|
3701
3448
|
metadata: {
|
|
3702
|
-
projectType:
|
|
3703
|
-
renderer:
|
|
3449
|
+
projectType: ProjectType20.VUE3,
|
|
3450
|
+
renderer: SupportedRenderer19.VUE3
|
|
3704
3451
|
},
|
|
3705
3452
|
configure: async () => ({
|
|
3706
|
-
extraPackages: async ({ builder }) => builder ===
|
|
3707
|
-
webpackCompiler: ({ builder }) => builder ===
|
|
3453
|
+
extraPackages: async ({ builder }) => builder === SupportedBuilder17.WEBPACK5 ? ["vue-loader@^17.0.0", "@vue/compiler-sfc@^3.2.0"] : [],
|
|
3454
|
+
webpackCompiler: ({ builder }) => builder === SupportedBuilder17.WEBPACK5 ? "swc" : void 0
|
|
3708
3455
|
})
|
|
3709
3456
|
};
|
|
3710
3457
|
|
|
3711
3458
|
// src/generators/WEB-COMPONENTS/index.ts
|
|
3712
|
-
import { ProjectType as
|
|
3713
|
-
import { SupportedBuilder as
|
|
3459
|
+
import { ProjectType as ProjectType21 } from "storybook/internal/cli";
|
|
3460
|
+
import { SupportedBuilder as SupportedBuilder18, SupportedRenderer as SupportedRenderer20 } from "storybook/internal/types";
|
|
3714
3461
|
var WEB_COMPONENTS_default = {
|
|
3715
3462
|
metadata: {
|
|
3716
|
-
projectType:
|
|
3717
|
-
renderer:
|
|
3463
|
+
projectType: ProjectType21.WEB_COMPONENTS,
|
|
3464
|
+
renderer: SupportedRenderer20.WEB_COMPONENTS
|
|
3718
3465
|
},
|
|
3719
3466
|
configure: async () => ({
|
|
3720
3467
|
extraPackages: ["lit"],
|
|
3721
|
-
webpackCompiler: ({ builder }) => builder ===
|
|
3468
|
+
webpackCompiler: ({ builder }) => builder === SupportedBuilder18.WEBPACK5 ? "swc" : void 0
|
|
3722
3469
|
})
|
|
3723
3470
|
};
|
|
3724
3471
|
|
|
3725
3472
|
// src/generators/registerGenerators.ts
|
|
3726
3473
|
var setOfGenerators = /* @__PURE__ */ new Set([
|
|
3727
3474
|
REACT_default,
|
|
3728
|
-
REACT_SCRIPTS_default,
|
|
3729
3475
|
REACT_NATIVE_default,
|
|
3730
3476
|
REACT_NATIVE_WEB_default,
|
|
3731
3477
|
REACT_NATIVE_AND_RNW_default,
|
|
@@ -3814,7 +3560,7 @@ async function doInitiate(options) {
|
|
|
3814
3560
|
let hasAiFeature = selectedFeatures.has(Feature7.AI);
|
|
3815
3561
|
return configDir && isAiSetupAvailable && (await cache.set("ai-init-opt-in", {
|
|
3816
3562
|
timestamp: Date.now(),
|
|
3817
|
-
configDir:
|
|
3563
|
+
configDir: resolve5(configDir),
|
|
3818
3564
|
answer: hasAiFeature
|
|
3819
3565
|
}).catch(() => {
|
|
3820
3566
|
}), await telemetry4("ai-init-opt-in", {
|
|
@@ -3860,7 +3606,7 @@ async function runStorybookDev(result) {
|
|
|
3860
3606
|
if (storybookCommand)
|
|
3861
3607
|
try {
|
|
3862
3608
|
let parts = storybookCommand.split(" ");
|
|
3863
|
-
if (packageManager.type === "npm" && projectType !==
|
|
3609
|
+
if (packageManager.type === "npm" && projectType !== ProjectType22.ANGULAR && parts.push("--silent"), projectType !== ProjectType22.ANGULAR) {
|
|
3864
3610
|
(packageManager.type === PackageManagerName2.NPM || packageManager.type === PackageManagerName2.BUN) && parts.push("--");
|
|
3865
3611
|
let defaultPort = 6006, availablePort = await getServerPort(defaultPort);
|
|
3866
3612
|
availablePort !== defaultPort && parts.push("-p", `${availablePort}`), parts.push("--quiet");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.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-EUU6EFAS.js";
|
|
13
13
|
|
|
14
14
|
// ../cli-storybook/src/postinstallAddon.ts
|
|
15
15
|
import { spawnSync } from "node:child_process";
|
|
@@ -18,7 +18,7 @@ import { join as join2 } from "node:path";
|
|
|
18
18
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
19
19
|
|
|
20
20
|
// ../../core/src/shared/utils/module.ts
|
|
21
|
-
import { createRequire
|
|
21
|
+
import nodeModule, { createRequire } from "node:module";
|
|
22
22
|
import { win32 } from "node:path/win32";
|
|
23
23
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
24
24
|
|
|
@@ -147,15 +147,31 @@ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.ha
|
|
|
147
147
|
var isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
|
|
148
148
|
|
|
149
149
|
// ../../core/src/shared/utils/module.ts
|
|
150
|
+
import semver from "semver";
|
|
150
151
|
var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
|
|
151
152
|
"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"
|
|
152
153
|
), pathToFileURL(args[0]).href) : import.meta.resolve(...args);
|
|
153
|
-
var
|
|
154
|
+
var typescriptLoaderRegistration = null;
|
|
155
|
+
function registerTypescriptLoader() {
|
|
156
|
+
return typescriptLoaderRegistration || (typescriptLoaderRegistration = (async () => {
|
|
157
|
+
if (semver.gte(process.versions.node, "26.0.0"))
|
|
158
|
+
try {
|
|
159
|
+
let { load } = await import("storybook/internal/bin/loader");
|
|
160
|
+
nodeModule.registerHooks({ load });
|
|
161
|
+
} catch {
|
|
162
|
+
let typescriptLoaderUrl = importMetaResolve("storybook/internal/bin/loader");
|
|
163
|
+
nodeModule.register(typescriptLoaderUrl, import.meta.url);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
let typescriptLoaderUrl = importMetaResolve("storybook/internal/bin/loader");
|
|
167
|
+
nodeModule.register(typescriptLoaderUrl, import.meta.url);
|
|
168
|
+
}
|
|
169
|
+
})().catch((e) => {
|
|
170
|
+
throw typescriptLoaderRegistration = null, e;
|
|
171
|
+
})), typescriptLoaderRegistration;
|
|
172
|
+
}
|
|
154
173
|
async function importModule(path2, { skipCache = !1 } = {}) {
|
|
155
|
-
|
|
156
|
-
let typescriptLoaderUrl = importMetaResolve("storybook/internal/bin/loader");
|
|
157
|
-
register(typescriptLoaderUrl, import.meta.url), isTypescriptLoaderRegistered = !0;
|
|
158
|
-
}
|
|
174
|
+
await registerTypescriptLoader();
|
|
159
175
|
let mod;
|
|
160
176
|
try {
|
|
161
177
|
let resolvedPath = win32.isAbsolute(path2) ? pathToFileURL(path2).href : path2;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.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
|
initiate
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7ZKIEWG5.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
17
|
__require,
|
|
18
18
|
__toESM
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EUU6EFAS.js";
|
|
20
20
|
|
|
21
21
|
// ../../../node_modules/commander/lib/error.js
|
|
22
22
|
var require_error = __commonJS({
|
|
@@ -2619,7 +2619,7 @@ var import_index = __toESM(require_commander(), 1), {
|
|
|
2619
2619
|
} = import_index.default;
|
|
2620
2620
|
|
|
2621
2621
|
// package.json
|
|
2622
|
-
var version = "
|
|
2622
|
+
var version = "11.0.0-alpha.1";
|
|
2623
2623
|
|
|
2624
2624
|
// ../../../node_modules/std-env/dist/index.mjs
|
|
2625
2625
|
var e = globalThis.process?.env || /* @__PURE__ */ Object.create(null), t = globalThis.process || { env: e }, n = t !== void 0 && t.env && t.env.NODE_ENV || void 0, r = [["claude", ["CLAUDECODE", "CLAUDE_CODE"]], ["replit", ["REPL_ID"]], ["gemini", ["GEMINI_CLI"]], ["codex", ["CODEX_SANDBOX", "CODEX_THREAD_ID"]], ["opencode", ["OPENCODE"]], ["pi", [i("PATH", /\.pi[\\/]agent/)]], ["auggie", ["AUGMENT_AGENT"]], ["goose", ["GOOSE_PROVIDER"]], ["devin", [i("EDITOR", /devin/)]], ["cursor", ["CURSOR_AGENT"]], ["kiro", [i("TERM_PROGRAM", /kiro/)]]];
|
|
@@ -2660,7 +2660,7 @@ var createStorybookProgram = program.name("Initialize Storybook into your projec
|
|
|
2660
2660
|
new Option("--package-manager <type>", "Force package manager for installing deps").choices(
|
|
2661
2661
|
Object.values(PackageManagerName)
|
|
2662
2662
|
)
|
|
2663
|
-
).
|
|
2663
|
+
).addOption(
|
|
2664
2664
|
new Option("--parser <type>", "jscodeshift parser").choices([
|
|
2665
2665
|
"babel",
|
|
2666
2666
|
"babylon",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.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-EUU6EFAS.js";
|
|
13
13
|
|
|
14
14
|
// raw:../templates/vitest.config.4.template.ts
|
|
15
15
|
var vitest_config_4_template_default = `import path from 'node:path';
|
package/dist/bin/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
3
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
4
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
5
5
|
|
|
6
|
-
var __filename =
|
|
7
|
-
var __dirname =
|
|
8
|
-
var require =
|
|
6
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
7
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
8
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.createRequire(import.meta.url);
|
|
9
9
|
|
|
10
10
|
// ------------------------------------------------------------
|
|
11
11
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -20,4 +20,4 @@ if (!isNodeVersionSupported(major, minor, patch)) {
|
|
|
20
20
|
You are currently running Node.js ${process.version}.`
|
|
21
21
|
), logger.outro(""), process.exit(1);
|
|
22
22
|
}
|
|
23
|
-
await import("../_node-chunks/run-
|
|
23
|
+
await import("../_node-chunks/run-Y72TFO23.js");
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_u7f80k60d5q from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_u7f80k60d5q from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_u7f80k60d5q from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_u7f80k60d5q.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_u7f80k60d5q.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_u7f80k60d5q.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
|
doInitiate
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
15
|
-
import "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-7ZKIEWG5.js";
|
|
15
|
+
import "./_node-chunks/chunk-EUU6EFAS.js";
|
|
16
16
|
export {
|
|
17
17
|
doInitiate as initiate
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-storybook",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-alpha.1",
|
|
4
4
|
"description": "Storybook installer: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"semver": "^7.7.3",
|
|
42
|
-
"storybook": "
|
|
42
|
+
"storybook": "11.0.0-alpha.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/prompts": "^2.0.9",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"commander": "^14.0.2",
|
|
48
48
|
"empathic": "^2.0.0",
|
|
49
49
|
"picocolors": "^1.1.0",
|
|
50
|
-
"process-ancestry": "^0.0.2",
|
|
51
50
|
"react": "^18.2.0",
|
|
52
51
|
"tiny-invariant": "^1.3.1",
|
|
53
52
|
"ts-dedent": "^2.0.0",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_e12itq5dn8q from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_e12itq5dn8q from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_e12itq5dn8q from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_e12itq5dn8q.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_e12itq5dn8q.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_e12itq5dn8q.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-JMO4K5OA.js";
|
|
13
|
-
|
|
14
|
-
// raw:../templates/vitest.config.3.2.template.ts
|
|
15
|
-
var vitest_config_3_2_template_default = `import path from 'node:path';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
|
|
18
|
-
import { defineConfig } from 'vitest/config';
|
|
19
|
-
|
|
20
|
-
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
21
|
-
|
|
22
|
-
const dirname =
|
|
23
|
-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
|
|
25
|
-
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
26
|
-
export default defineConfig({
|
|
27
|
-
test: {
|
|
28
|
-
projects: [
|
|
29
|
-
{
|
|
30
|
-
extends: true,
|
|
31
|
-
plugins: [
|
|
32
|
-
// The plugin will run tests for the stories defined in your Storybook config
|
|
33
|
-
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
34
|
-
storybookTest({ configDir: path.join(dirname, 'CONFIG_DIR') }),
|
|
35
|
-
],
|
|
36
|
-
test: {
|
|
37
|
-
name: 'storybook',
|
|
38
|
-
browser: {
|
|
39
|
-
enabled: true,
|
|
40
|
-
headless: true,
|
|
41
|
-
provider: 'playwright',
|
|
42
|
-
instances: [{ browser: 'chromium' }],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
`;
|
|
50
|
-
export {
|
|
51
|
-
vitest_config_3_2_template_default as default
|
|
52
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_e12itq5dn8q from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_e12itq5dn8q from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_e12itq5dn8q from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_e12itq5dn8q.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_e12itq5dn8q.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_e12itq5dn8q.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-JMO4K5OA.js";
|
|
13
|
-
|
|
14
|
-
// raw:../templates/vitest.config.template.ts
|
|
15
|
-
var vitest_config_template_default = `import path from 'node:path';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
|
|
18
|
-
import { defineConfig } from 'vitest/config';
|
|
19
|
-
|
|
20
|
-
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
21
|
-
|
|
22
|
-
const dirname =
|
|
23
|
-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
|
|
25
|
-
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
26
|
-
export default defineConfig({
|
|
27
|
-
test: {
|
|
28
|
-
workspace: [
|
|
29
|
-
{
|
|
30
|
-
extends: true,
|
|
31
|
-
plugins: [
|
|
32
|
-
// The plugin will run tests for the stories defined in your Storybook config
|
|
33
|
-
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
34
|
-
storybookTest({ configDir: path.join(dirname, 'CONFIG_DIR') }),
|
|
35
|
-
],
|
|
36
|
-
test: {
|
|
37
|
-
name: 'storybook',
|
|
38
|
-
browser: {
|
|
39
|
-
enabled: true,
|
|
40
|
-
headless: true,
|
|
41
|
-
provider: 'playwright',
|
|
42
|
-
instances: [{ browser: 'chromium' }],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
`;
|
|
50
|
-
export {
|
|
51
|
-
vitest_config_template_default as default
|
|
52
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_e12itq5dn8q from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_e12itq5dn8q from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_e12itq5dn8q from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_e12itq5dn8q.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_e12itq5dn8q.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_e12itq5dn8q.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import "./chunk-JMO4K5OA.js";
|
|
13
|
-
|
|
14
|
-
// raw:../templates/vitest.workspace.template.ts
|
|
15
|
-
var vitest_workspace_template_default = `import path from 'node:path';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
|
|
18
|
-
import { defineWorkspace } from 'vitest/config';
|
|
19
|
-
|
|
20
|
-
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
21
|
-
|
|
22
|
-
const dirname =
|
|
23
|
-
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
|
|
25
|
-
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
26
|
-
export default defineWorkspace([
|
|
27
|
-
'ROOT_CONFIG',
|
|
28
|
-
{
|
|
29
|
-
extends: 'EXTENDS_WORKSPACE',
|
|
30
|
-
plugins: [
|
|
31
|
-
// The plugin will run tests for the stories defined in your Storybook config
|
|
32
|
-
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
33
|
-
storybookTest({ configDir: path.join(dirname, 'CONFIG_DIR') }),
|
|
34
|
-
],
|
|
35
|
-
test: {
|
|
36
|
-
name: 'storybook',
|
|
37
|
-
browser: {
|
|
38
|
-
enabled: true,
|
|
39
|
-
headless: true,
|
|
40
|
-
provider: 'playwright',
|
|
41
|
-
instances: [{ browser: 'chromium' }],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
]);
|
|
46
|
-
`;
|
|
47
|
-
export {
|
|
48
|
-
vitest_workspace_template_default as default
|
|
49
|
-
};
|