@storybook/builder-vite 10.3.0-alpha.13 → 10.3.0-alpha.15
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_dxkmre9ujad from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxkmre9ujad from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxkmre9ujad from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxkmre9ujad.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxkmre9ujad.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxkmre9ujad.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_dxkmre9ujad from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxkmre9ujad from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxkmre9ujad from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxkmre9ujad.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxkmre9ujad.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxkmre9ujad.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-6TDQA4AZ.js";
|
|
28
28
|
|
|
29
29
|
// ../../../node_modules/picocolors/picocolors.js
|
|
30
30
|
var require_picocolors = __commonJS({
|
|
@@ -1488,12 +1488,11 @@ async function build(options) {
|
|
|
1488
1488
|
}
|
|
1489
1489
|
|
|
1490
1490
|
// src/vite-server.ts
|
|
1491
|
-
import { logger as logger3 } from "storybook/internal/node-logger";
|
|
1492
|
-
import { dedent as dedent4 } from "ts-dedent";
|
|
1493
1491
|
async function createViteServer(options, devServer) {
|
|
1494
|
-
let { presets } = options, config = {
|
|
1495
|
-
...
|
|
1492
|
+
let { presets } = options, commonCfg = await commonConfig(options, "development"), { allowedHosts } = await presets.apply("core", {}), config = {
|
|
1493
|
+
...commonCfg,
|
|
1496
1494
|
server: {
|
|
1495
|
+
allowedHosts,
|
|
1497
1496
|
middlewareMode: !0,
|
|
1498
1497
|
hmr: {
|
|
1499
1498
|
port: options.port,
|
|
@@ -1505,14 +1504,7 @@ async function createViteServer(options, devServer) {
|
|
|
1505
1504
|
},
|
|
1506
1505
|
appType: "custom"
|
|
1507
1506
|
};
|
|
1508
|
-
options.host === "0.0.0.0" && !
|
|
1509
|
-
Defaulting 'allowedHosts' to true, which permits all hostnames.
|
|
1510
|
-
To restrict allowed hostnames, add the following to your 'viteFinal' config:
|
|
1511
|
-
Example: { server: { allowedHosts: ['mydomain.com'] } }
|
|
1512
|
-
See:
|
|
1513
|
-
- https://vite.dev/config/server-options.html#server-allowedhosts
|
|
1514
|
-
- https://storybook.js.org/docs/api/main-config/main-config-vite-final
|
|
1515
|
-
`));
|
|
1507
|
+
options.host === "0.0.0.0" && (!allowedHosts || Array.isArray(allowedHosts) && allowedHosts.length === 0) && (config.server.allowedHosts = !0);
|
|
1516
1508
|
let finalConfig = await presets.apply("viteFinal", config, options), { createServer } = await import("vite");
|
|
1517
1509
|
return finalConfig.customLogger ??= await createViteLogger(), createServer(finalConfig);
|
|
1518
1510
|
}
|
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_dxkmre9ujad from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dxkmre9ujad from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dxkmre9ujad from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dxkmre9ujad.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dxkmre9ujad.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dxkmre9ujad.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_8rkk2p9i9wf.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
optimizeViteDeps,
|
|
14
14
|
viteCorePlugins
|
|
15
|
-
} from "./_node-chunks/chunk-
|
|
15
|
+
} from "./_node-chunks/chunk-6TDQA4AZ.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.15",
|
|
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.15",
|
|
51
51
|
"ts-dedent": "^2.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"vite": "^7.0.4"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"storybook": "^10.3.0-alpha.
|
|
65
|
+
"storybook": "^10.3.0-alpha.15",
|
|
66
66
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|