@storybook/react-dom-shim 10.3.0-alpha.8 → 10.3.0-beta.0
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/preset.js +26 -9
- package/package.json +2 -2
package/dist/preset.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_8aoulbuasz3 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_8aoulbuasz3 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_8aoulbuasz3 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_8aoulbuasz3.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_8aoulbuasz3.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_8aoulbuasz3.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -15,6 +15,7 @@ import { readFile } from "node:fs/promises";
|
|
|
15
15
|
import { isAbsolute as isAbsolute2, join as join2 } from "node:path";
|
|
16
16
|
|
|
17
17
|
// ../../core/src/shared/utils/module.ts
|
|
18
|
+
import { createRequire, register } from "node:module";
|
|
18
19
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
19
20
|
|
|
20
21
|
// ../../../node_modules/exsolve/dist/index.mjs
|
|
@@ -206,7 +207,12 @@ var importMetaResolve = (...args) => typeof import.meta.resolve != "function" &&
|
|
|
206
207
|
try {
|
|
207
208
|
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
|
|
208
209
|
} catch {
|
|
209
|
-
|
|
210
|
+
try {
|
|
211
|
+
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"))));
|
|
212
|
+
} catch {
|
|
213
|
+
let req = createRequire(parent ?? import.meta.url);
|
|
214
|
+
return dirname(req.resolve(join(pkg, "package.json")));
|
|
215
|
+
}
|
|
210
216
|
}
|
|
211
217
|
};
|
|
212
218
|
|
|
@@ -230,8 +236,18 @@ var getIsReactVersion18or19 = async (options) => {
|
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
}, viteFinal = async (config, options) => {
|
|
233
|
-
|
|
234
|
-
|
|
239
|
+
let isReactVersion18 = await getIsReactVersion18or19(options), optimizeDeps = {
|
|
240
|
+
...config?.optimizeDeps ?? {},
|
|
241
|
+
include: [
|
|
242
|
+
...config.optimizeDeps?.include || [],
|
|
243
|
+
...isReactVersion18 ? ["react-dom/client"] : []
|
|
244
|
+
]
|
|
245
|
+
};
|
|
246
|
+
if (isReactVersion18)
|
|
247
|
+
return {
|
|
248
|
+
...config,
|
|
249
|
+
optimizeDeps
|
|
250
|
+
};
|
|
235
251
|
let alias = Array.isArray(config.resolve?.alias) ? config.resolve.alias.concat({
|
|
236
252
|
find: /^@storybook\/react-dom-shim$/,
|
|
237
253
|
replacement: "@storybook/react-dom-shim/react-16"
|
|
@@ -241,6 +257,7 @@ var getIsReactVersion18or19 = async (options) => {
|
|
|
241
257
|
};
|
|
242
258
|
return {
|
|
243
259
|
...config,
|
|
260
|
+
optimizeDeps,
|
|
244
261
|
resolve: {
|
|
245
262
|
...config.resolve,
|
|
246
263
|
alias
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-dom-shim",
|
|
3
|
-
"version": "10.3.0-
|
|
3
|
+
"version": "10.3.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
47
|
-
"storybook": "^10.3.0-
|
|
47
|
+
"storybook": "^10.3.0-beta.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|