@storybook/builder-vite 10.3.0-alpha.15 → 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 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";
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 = 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);
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
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
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";
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 = 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);
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-6TDQA4AZ.js";
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" && (config.build || (config.build = {}), config.build.rollupOptions = {
392
- ...config.build.rollupOptions,
393
- input: iframePath
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
- rollupOptions: {
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 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";
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 = 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);
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_dxkmre9ujad.createRequire(import.meta.url);
12
12
  import {
13
13
  optimizeViteDeps,
14
14
  viteCorePlugins
15
- } from "./_node-chunks/chunk-6TDQA4AZ.js";
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.15",
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.15",
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.15",
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"