@rsbuild/plugin-react 0.0.0-next-20240112061202 → 0.0.0-next-20240131063127
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 +2 -1
- package/dist/index.js +8 -6
- package/dist/index.mjs +9 -9
- package/package.json +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ type PluginReactOptions = {
|
|
|
28
28
|
*/
|
|
29
29
|
splitChunks?: SplitReactChunkOptions;
|
|
30
30
|
};
|
|
31
|
+
declare const PLUGIN_REACT_NAME = "rsbuild:react";
|
|
31
32
|
declare const pluginReact: (options?: PluginReactOptions) => RsbuildPlugin;
|
|
32
33
|
|
|
33
|
-
export { PluginReactOptions, SplitReactChunkOptions, isBeyondReact17, pluginReact };
|
|
34
|
+
export { PLUGIN_REACT_NAME, type PluginReactOptions, type SplitReactChunkOptions, isBeyondReact17, pluginReact };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
PLUGIN_REACT_NAME: () => PLUGIN_REACT_NAME,
|
|
33
34
|
isBeyondReact17: () => isBeyondReact17,
|
|
34
35
|
pluginReact: () => pluginReact
|
|
35
36
|
});
|
|
@@ -153,11 +154,11 @@ var import_shared4 = require("@rsbuild/shared");
|
|
|
153
154
|
var REACT_REFRESH_PATH = require.resolve("react-refresh");
|
|
154
155
|
var REACT_REFRESH_DIR_PATH = import_node_path.default.dirname(REACT_REFRESH_PATH);
|
|
155
156
|
var applyBasicReactSupport = (api, options) => {
|
|
156
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd: isProd2, target }) => {
|
|
157
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, isDev, isProd: isProd2, target }) => {
|
|
157
158
|
const config = api.getNormalizedConfig();
|
|
158
159
|
const usingHMR = (0, import_shared4.isUsingHMR)(config, { isProd: isProd2, target });
|
|
159
160
|
const reactOptions = {
|
|
160
|
-
development:
|
|
161
|
+
development: isDev,
|
|
161
162
|
refresh: usingHMR,
|
|
162
163
|
runtime: "automatic",
|
|
163
164
|
...options.swcReactOptions
|
|
@@ -184,7 +185,7 @@ var applyBasicReactSupport = (api, options) => {
|
|
|
184
185
|
};
|
|
185
186
|
|
|
186
187
|
// src/utils.ts
|
|
187
|
-
var
|
|
188
|
+
var import_node_fs = __toESM(require("fs"));
|
|
188
189
|
var import_semver = __toESM(require("@rsbuild/shared/semver"));
|
|
189
190
|
var import_shared5 = require("@rsbuild/shared");
|
|
190
191
|
var isBeyondReact17 = async (cwd) => {
|
|
@@ -192,7 +193,7 @@ var isBeyondReact17 = async (cwd) => {
|
|
|
192
193
|
if (!pkgPath) {
|
|
193
194
|
return false;
|
|
194
195
|
}
|
|
195
|
-
const pkgInfo = JSON.parse(
|
|
196
|
+
const pkgInfo = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf8"));
|
|
196
197
|
const deps = {
|
|
197
198
|
...pkgInfo.devDependencies,
|
|
198
199
|
...pkgInfo.dependencies
|
|
@@ -204,9 +205,9 @@ var isBeyondReact17 = async (cwd) => {
|
|
|
204
205
|
};
|
|
205
206
|
|
|
206
207
|
// src/index.ts
|
|
208
|
+
var PLUGIN_REACT_NAME = "rsbuild:react";
|
|
207
209
|
var pluginReact = (options = {}) => ({
|
|
208
|
-
name:
|
|
209
|
-
pre: ["rsbuild:swc"],
|
|
210
|
+
name: PLUGIN_REACT_NAME,
|
|
210
211
|
setup(api) {
|
|
211
212
|
if (api.context.bundlerType === "rspack") {
|
|
212
213
|
applyBasicReactSupport(api, options);
|
|
@@ -218,6 +219,7 @@ var pluginReact = (options = {}) => ({
|
|
|
218
219
|
});
|
|
219
220
|
// Annotate the CommonJS export names for ESM import in node:
|
|
220
221
|
0 && (module.exports = {
|
|
222
|
+
PLUGIN_REACT_NAME,
|
|
221
223
|
isBeyondReact17,
|
|
222
224
|
pluginReact
|
|
223
225
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
var require = createRequire(import.meta['url']);
|
|
3
|
+
|
|
1
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
5
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
6
|
}) : x)(function(x) {
|
|
@@ -6,14 +9,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
9
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
10
|
});
|
|
8
11
|
|
|
9
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.
|
|
12
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.46.1_typescript@5.3.2/node_modules/@modern-js/module-tools/shims/esm.js
|
|
10
13
|
import { fileURLToPath } from "url";
|
|
11
14
|
import path from "path";
|
|
12
15
|
|
|
13
|
-
// ../../scripts/requireShims.js
|
|
14
|
-
import { createRequire } from "module";
|
|
15
|
-
global.require = createRequire(import.meta.url);
|
|
16
|
-
|
|
17
16
|
// src/antd.ts
|
|
18
17
|
import { isServerTarget } from "@rsbuild/shared";
|
|
19
18
|
var getAntdMajorVersion = (appDirectory) => {
|
|
@@ -143,11 +142,11 @@ import {
|
|
|
143
142
|
var REACT_REFRESH_PATH = __require.resolve("react-refresh");
|
|
144
143
|
var REACT_REFRESH_DIR_PATH = path2.dirname(REACT_REFRESH_PATH);
|
|
145
144
|
var applyBasicReactSupport = (api, options) => {
|
|
146
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd: isProd2, target }) => {
|
|
145
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, isDev, isProd: isProd2, target }) => {
|
|
147
146
|
const config = api.getNormalizedConfig();
|
|
148
147
|
const usingHMR = isUsingHMR(config, { isProd: isProd2, target });
|
|
149
148
|
const reactOptions = {
|
|
150
|
-
development:
|
|
149
|
+
development: isDev,
|
|
151
150
|
refresh: usingHMR,
|
|
152
151
|
runtime: "automatic",
|
|
153
152
|
...options.swcReactOptions
|
|
@@ -194,9 +193,9 @@ var isBeyondReact17 = async (cwd) => {
|
|
|
194
193
|
};
|
|
195
194
|
|
|
196
195
|
// src/index.ts
|
|
196
|
+
var PLUGIN_REACT_NAME = "rsbuild:react";
|
|
197
197
|
var pluginReact = (options = {}) => ({
|
|
198
|
-
name:
|
|
199
|
-
pre: ["rsbuild:swc"],
|
|
198
|
+
name: PLUGIN_REACT_NAME,
|
|
200
199
|
setup(api) {
|
|
201
200
|
if (api.context.bundlerType === "rspack") {
|
|
202
201
|
applyBasicReactSupport(api, options);
|
|
@@ -207,6 +206,7 @@ var pluginReact = (options = {}) => ({
|
|
|
207
206
|
}
|
|
208
207
|
});
|
|
209
208
|
export {
|
|
209
|
+
PLUGIN_REACT_NAME,
|
|
210
210
|
isBeyondReact17,
|
|
211
211
|
pluginReact
|
|
212
212
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-react",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240131063127",
|
|
4
4
|
"description": "React plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,15 +22,18 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rspack/plugin-react-refresh": "0.5.
|
|
25
|
+
"@rspack/plugin-react-refresh": "0.5.3",
|
|
26
26
|
"react-refresh": "^0.14.0",
|
|
27
|
-
"@rsbuild/shared": "0.0.0-next-
|
|
27
|
+
"@rsbuild/shared": "0.0.0-next-20240131063127"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "16.x",
|
|
31
31
|
"typescript": "^5.3.0",
|
|
32
|
-
"@rsbuild/core": "0.0.0-next-
|
|
33
|
-
"@scripts/test-helper": "0.0.0-next-
|
|
32
|
+
"@rsbuild/core": "0.0.0-next-20240131063127",
|
|
33
|
+
"@scripts/test-helper": "0.0.0-next-20240131063127"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@rsbuild/core": "0.0.0-next-20240131063127"
|
|
34
37
|
},
|
|
35
38
|
"publishConfig": {
|
|
36
39
|
"access": "public",
|