@storybook/builder-vite 10.3.0-alpha.14 → 10.3.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ro4snwt8gq from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ro4snwt8gq from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ro4snwt8gq from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ro4snwt8gq.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ro4snwt8gq.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ro4snwt8gq.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -160,6 +160,9 @@ function getUniqueImportPaths(index) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// src/plugins/storybook-optimize-deps-plugin.ts
|
|
163
|
+
function escapeGlobPath(filePath) {
|
|
164
|
+
return filePath.replace(/[()[\]{}!*?|+@]/g, "\\$&");
|
|
165
|
+
}
|
|
163
166
|
function storybookOptimizeDepsPlugin(options) {
|
|
164
167
|
return {
|
|
165
168
|
name: "storybook:optimize-deps-plugin",
|
|
@@ -176,10 +179,12 @@ function storybookOptimizeDepsPlugin(options) {
|
|
|
176
179
|
// Story files + preview annotation files as entry points for the dep optimizer.
|
|
177
180
|
// Vite will crawl these to discover all transitive CJS dependencies that need
|
|
178
181
|
// pre-bundling, removing the need for a hard-coded include list.
|
|
182
|
+
// Paths are escaped so that special glob characters (e.g. parentheses in Next.js route
|
|
183
|
+
// group directories) are treated as literal characters, not glob syntax.
|
|
179
184
|
entries: [
|
|
180
185
|
...typeof config.optimizeDeps?.entries == "string" ? [config.optimizeDeps.entries] : config.optimizeDeps?.entries ?? [],
|
|
181
|
-
...getUniqueImportPaths(index),
|
|
182
|
-
...previewAnnotationEntries
|
|
186
|
+
...getUniqueImportPaths(index).map(escapeGlobPath),
|
|
187
|
+
...previewAnnotationEntries.map(escapeGlobPath)
|
|
183
188
|
],
|
|
184
189
|
// Extra deps explicitly included by Storybook presets (e.g. framework-specific packages).
|
|
185
190
|
include: [...extraOptimizeDeps, ...config.optimizeDeps?.include ?? []]
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ro4snwt8gq from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ro4snwt8gq from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ro4snwt8gq from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ro4snwt8gq.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ro4snwt8gq.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ro4snwt8gq.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
normalize,
|
|
25
25
|
relative,
|
|
26
26
|
viteCorePlugins
|
|
27
|
-
} from "./_node-chunks/chunk-
|
|
27
|
+
} from "./_node-chunks/chunk-LJ2V3XRF.js";
|
|
28
28
|
|
|
29
29
|
// ../../../node_modules/picocolors/picocolors.js
|
|
30
30
|
var require_picocolors = __commonJS({
|
|
@@ -122,6 +122,23 @@ async function hasVitePlugins(plugins, names) {
|
|
|
122
122
|
return !1;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
// src/utils/vite-features.ts
|
|
126
|
+
import { version } from "vite";
|
|
127
|
+
var shouldUseRolldownOptions = () => {
|
|
128
|
+
try {
|
|
129
|
+
return Number(version.split(".")[0]) >= 8;
|
|
130
|
+
} catch {
|
|
131
|
+
return !1;
|
|
132
|
+
}
|
|
133
|
+
}, bundlerOptionsKey = shouldUseRolldownOptions() ? "rolldownOptions" : "rollupOptions";
|
|
134
|
+
function ensureRolldownOptions(config) {
|
|
135
|
+
if (!shouldUseRolldownOptions())
|
|
136
|
+
return;
|
|
137
|
+
config.build ??= {};
|
|
138
|
+
let rolldown = config.build.rolldownOptions ??= {}, output = rolldown.output ??= {};
|
|
139
|
+
output.strictExecutionOrder = !0;
|
|
140
|
+
}
|
|
141
|
+
|
|
125
142
|
// src/utils/without-vite-plugins.ts
|
|
126
143
|
var withoutVitePlugins = async (plugins = [], namesToRemove) => {
|
|
127
144
|
let result = [], resolvedPlugins = await Promise.all(plugins);
|
|
@@ -388,10 +405,14 @@ function codeGeneratorPlugin(options) {
|
|
|
388
405
|
});
|
|
389
406
|
},
|
|
390
407
|
config(config, { command }) {
|
|
391
|
-
command === "build"
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
408
|
+
if (command === "build") {
|
|
409
|
+
config.build || (config.build = {});
|
|
410
|
+
let build3 = config.build;
|
|
411
|
+
build3[bundlerOptionsKey] = {
|
|
412
|
+
...build3[bundlerOptionsKey],
|
|
413
|
+
input: iframePath
|
|
414
|
+
}, ensureRolldownOptions(config);
|
|
415
|
+
}
|
|
395
416
|
},
|
|
396
417
|
configResolved(config) {
|
|
397
418
|
iframeId = `${config.root}/iframe.html`;
|
|
@@ -1441,7 +1462,8 @@ async function build(options) {
|
|
|
1441
1462
|
outDir: options.outputDir,
|
|
1442
1463
|
emptyOutDir: !1,
|
|
1443
1464
|
// do not clean before running Vite build - Storybook has already added assets in there!
|
|
1444
|
-
|
|
1465
|
+
// TODO: Remove bundlerOptionsKey and use 'rolldownOptions' directly once support for Vite < 8 is dropped
|
|
1466
|
+
[bundlerOptionsKey]: {
|
|
1445
1467
|
external: [/\.\/sb-common-assets\/.*\.woff2/]
|
|
1446
1468
|
},
|
|
1447
1469
|
...options.test ? {
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ro4snwt8gq from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ro4snwt8gq from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ro4snwt8gq from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ro4snwt8gq.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ro4snwt8gq.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ro4snwt8gq.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_e2d3ehe95oc.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
optimizeViteDeps,
|
|
14
14
|
viteCorePlugins
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-LJ2V3XRF.js";
|
|
16
16
|
export {
|
|
17
17
|
optimizeViteDeps,
|
|
18
18
|
viteCorePlugins
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/builder-vite",
|
|
3
|
-
"version": "10.3.0-alpha.
|
|
3
|
+
"version": "10.3.0-alpha.16",
|
|
4
4
|
"description": "A Storybook builder to dev and build with Vite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"!src/**/*"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@storybook/csf-plugin": "10.3.0-alpha.
|
|
50
|
+
"@storybook/csf-plugin": "10.3.0-alpha.16",
|
|
51
51
|
"ts-dedent": "^2.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"vite": "^7.0.4"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"storybook": "^10.3.0-alpha.
|
|
66
|
-
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
65
|
+
"storybook": "^10.3.0-alpha.16",
|
|
66
|
+
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|