@rsbuild/plugin-react 0.0.24 → 0.0.26
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/index.d.ts +3 -1
- package/dist/index.js +26 -4
- package/dist/index.mjs +27 -4
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var require_splitChunks = __commonJS({
|
|
|
68
68
|
});
|
|
69
69
|
module2.exports = __toCommonJS2(splitChunks_exports);
|
|
70
70
|
var import_assert = __toESM2(require("assert"));
|
|
71
|
-
var
|
|
71
|
+
var import_shared6 = require("@rsbuild/shared");
|
|
72
72
|
function getUserDefinedCacheGroups(forceSplitting) {
|
|
73
73
|
const cacheGroups = {};
|
|
74
74
|
const pairs = Array.isArray(forceSplitting) ? forceSplitting.map(
|
|
@@ -141,11 +141,11 @@ var require_splitChunks = __commonJS({
|
|
|
141
141
|
// Core group
|
|
142
142
|
vendors: {
|
|
143
143
|
priority: -10,
|
|
144
|
-
test:
|
|
144
|
+
test: import_shared6.NODE_MODULES_REGEX,
|
|
145
145
|
// todo: not support in rspack
|
|
146
146
|
// @ts-expect-error
|
|
147
147
|
name(module22) {
|
|
148
|
-
return (0,
|
|
148
|
+
return (0, import_shared6.getPackageNameFromModulePath)(module22.context);
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
...override.cacheGroups
|
|
@@ -187,7 +187,7 @@ var require_splitChunks = __commonJS({
|
|
|
187
187
|
const { override, defaultConfig, userDefinedCacheGroups } = ctx;
|
|
188
188
|
const singleVendorCacheGroup = {
|
|
189
189
|
singleVendor: {
|
|
190
|
-
test:
|
|
190
|
+
test: import_shared6.NODE_MODULES_REGEX,
|
|
191
191
|
priority: 0,
|
|
192
192
|
chunks: "all",
|
|
193
193
|
name: "vendor",
|
|
@@ -272,6 +272,7 @@ var require_splitChunks = __commonJS({
|
|
|
272
272
|
// src/index.ts
|
|
273
273
|
var src_exports = {};
|
|
274
274
|
__export(src_exports, {
|
|
275
|
+
isBeyondReact17: () => isBeyondReact17,
|
|
275
276
|
pluginReact: () => pluginReact
|
|
276
277
|
});
|
|
277
278
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -475,6 +476,26 @@ var applyBasicReactSupport = (api) => {
|
|
|
475
476
|
});
|
|
476
477
|
};
|
|
477
478
|
|
|
479
|
+
// src/utils.ts
|
|
480
|
+
var import_fs = __toESM(require("fs"));
|
|
481
|
+
var import_semver = __toESM(require("semver"));
|
|
482
|
+
var import_shared5 = require("@rsbuild/shared");
|
|
483
|
+
var isBeyondReact17 = async (cwd) => {
|
|
484
|
+
const pkgPath = await (0, import_shared5.findUp)({ cwd, filename: "package.json" });
|
|
485
|
+
if (!pkgPath) {
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
const pkgInfo = JSON.parse(import_fs.default.readFileSync(pkgPath, "utf8"));
|
|
489
|
+
const deps = {
|
|
490
|
+
...pkgInfo.devDependencies,
|
|
491
|
+
...pkgInfo.dependencies
|
|
492
|
+
};
|
|
493
|
+
if (typeof deps.react !== "string") {
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
return import_semver.default.satisfies(import_semver.default.minVersion(deps.react), ">=17.0.0");
|
|
497
|
+
};
|
|
498
|
+
|
|
478
499
|
// src/index.ts
|
|
479
500
|
var pluginReact = () => ({
|
|
480
501
|
name: "plugin-react",
|
|
@@ -490,5 +511,6 @@ var pluginReact = () => ({
|
|
|
490
511
|
});
|
|
491
512
|
// Annotate the CommonJS export names for ESM import in node:
|
|
492
513
|
0 && (module.exports = {
|
|
514
|
+
isBeyondReact17,
|
|
493
515
|
pluginReact
|
|
494
516
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -92,7 +92,7 @@ var require_splitChunks = __commonJS({
|
|
|
92
92
|
});
|
|
93
93
|
module.exports = __toCommonJS(splitChunks_exports);
|
|
94
94
|
var import_assert = __toESM2(__require("assert"));
|
|
95
|
-
var
|
|
95
|
+
var import_shared6 = __require("@rsbuild/shared");
|
|
96
96
|
function getUserDefinedCacheGroups(forceSplitting) {
|
|
97
97
|
const cacheGroups = {};
|
|
98
98
|
const pairs = Array.isArray(forceSplitting) ? forceSplitting.map(
|
|
@@ -165,11 +165,11 @@ var require_splitChunks = __commonJS({
|
|
|
165
165
|
// Core group
|
|
166
166
|
vendors: {
|
|
167
167
|
priority: -10,
|
|
168
|
-
test:
|
|
168
|
+
test: import_shared6.NODE_MODULES_REGEX,
|
|
169
169
|
// todo: not support in rspack
|
|
170
170
|
// @ts-expect-error
|
|
171
171
|
name(module2) {
|
|
172
|
-
return (0,
|
|
172
|
+
return (0, import_shared6.getPackageNameFromModulePath)(module2.context);
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
...override.cacheGroups
|
|
@@ -211,7 +211,7 @@ var require_splitChunks = __commonJS({
|
|
|
211
211
|
const { override, defaultConfig, userDefinedCacheGroups } = ctx;
|
|
212
212
|
const singleVendorCacheGroup = {
|
|
213
213
|
singleVendor: {
|
|
214
|
-
test:
|
|
214
|
+
test: import_shared6.NODE_MODULES_REGEX,
|
|
215
215
|
priority: 0,
|
|
216
216
|
chunks: "all",
|
|
217
217
|
name: "vendor",
|
|
@@ -510,6 +510,28 @@ var applyBasicReactSupport = (api) => {
|
|
|
510
510
|
});
|
|
511
511
|
};
|
|
512
512
|
|
|
513
|
+
// src/utils.ts
|
|
514
|
+
init_esm();
|
|
515
|
+
init_require_shims();
|
|
516
|
+
import fs from "fs";
|
|
517
|
+
import semver from "semver";
|
|
518
|
+
import { findUp } from "@rsbuild/shared";
|
|
519
|
+
var isBeyondReact17 = async (cwd) => {
|
|
520
|
+
const pkgPath = await findUp({ cwd, filename: "package.json" });
|
|
521
|
+
if (!pkgPath) {
|
|
522
|
+
return false;
|
|
523
|
+
}
|
|
524
|
+
const pkgInfo = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
525
|
+
const deps = {
|
|
526
|
+
...pkgInfo.devDependencies,
|
|
527
|
+
...pkgInfo.dependencies
|
|
528
|
+
};
|
|
529
|
+
if (typeof deps.react !== "string") {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
return semver.satisfies(semver.minVersion(deps.react), ">=17.0.0");
|
|
533
|
+
};
|
|
534
|
+
|
|
513
535
|
// src/index.ts
|
|
514
536
|
var pluginReact = () => ({
|
|
515
537
|
name: "plugin-react",
|
|
@@ -524,5 +546,6 @@ var pluginReact = () => ({
|
|
|
524
546
|
}
|
|
525
547
|
});
|
|
526
548
|
export {
|
|
549
|
+
isBeyondReact17,
|
|
527
550
|
pluginReact
|
|
528
551
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"description": "React plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,15 +21,17 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rspack/plugin-react-refresh": "0.3.
|
|
24
|
+
"@rspack/plugin-react-refresh": "0.3.14",
|
|
25
25
|
"react-refresh": "^0.14.0",
|
|
26
|
-
"
|
|
26
|
+
"semver": "^7.5.4",
|
|
27
|
+
"@rsbuild/shared": "0.0.26"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/node": "^16",
|
|
31
|
+
"@types/semver": "^7.5.4",
|
|
30
32
|
"typescript": "^5.2.2",
|
|
31
|
-
"@rsbuild/core": "0.0.
|
|
32
|
-
"@rsbuild/test-helper": "0.0.
|
|
33
|
+
"@rsbuild/core": "0.0.26",
|
|
34
|
+
"@rsbuild/test-helper": "0.0.26"
|
|
33
35
|
},
|
|
34
36
|
"publishConfig": {
|
|
35
37
|
"access": "public",
|