@rsbuild/plugin-node-polyfill 1.4.3 → 1.4.4
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.cjs +7 -7
- package/dist/index.js +3 -3
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return
|
|
3
|
+
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
@@ -16,7 +16,7 @@ var __webpack_require__ = {};
|
|
|
16
16
|
})();
|
|
17
17
|
(()=>{
|
|
18
18
|
__webpack_require__.r = (exports1)=>{
|
|
19
|
-
if (
|
|
19
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
20
20
|
value: 'Module'
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -141,7 +141,7 @@ function pluginNodePolyfill(options = {}) {
|
|
|
141
141
|
return {
|
|
142
142
|
name: PLUGIN_NODE_POLYFILL_NAME,
|
|
143
143
|
setup (api) {
|
|
144
|
-
api.modifyBundlerChain(async (chain, { isServer, rspack })=>{
|
|
144
|
+
api.modifyBundlerChain(async (chain, { isServer, bundler, rspack })=>{
|
|
145
145
|
if (isServer && !force) return;
|
|
146
146
|
chain.resolve.fallback.merge(getResolveFallback({
|
|
147
147
|
protocolImports,
|
|
@@ -150,10 +150,10 @@ function pluginNodePolyfill(options = {}) {
|
|
|
150
150
|
overrides
|
|
151
151
|
}));
|
|
152
152
|
const provideGlobals = await getProvideGlobals(options.globals, overrides);
|
|
153
|
-
if (Object.keys(provideGlobals).length) chain.plugin('node-polyfill-provide').use(
|
|
153
|
+
if (Object.keys(provideGlobals).length) chain.plugin('node-polyfill-provide').use(bundler.ProvidePlugin, [
|
|
154
154
|
provideGlobals
|
|
155
155
|
]);
|
|
156
|
-
if (protocolImports) {
|
|
156
|
+
if (protocolImports && 'rspack' === api.context.bundlerType) {
|
|
157
157
|
const regex = /^node:/;
|
|
158
158
|
chain.plugin('protocol-imports').use(rspack.NormalModuleReplacementPlugin, [
|
|
159
159
|
regex,
|
|
@@ -173,7 +173,7 @@ exports.getResolveFallback = __webpack_exports__.getResolveFallback;
|
|
|
173
173
|
exports.pluginNodePolyfill = __webpack_exports__.pluginNodePolyfill;
|
|
174
174
|
exports.resolvePolyfill = __webpack_exports__.resolvePolyfill;
|
|
175
175
|
exports.resolvedPolyfillToModules = __webpack_exports__.resolvedPolyfillToModules;
|
|
176
|
-
for(var
|
|
176
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
177
177
|
"PLUGIN_NODE_POLYFILL_NAME",
|
|
178
178
|
"builtinMappingResolved",
|
|
179
179
|
"getProvideGlobals",
|
|
@@ -181,7 +181,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
181
181
|
"pluginNodePolyfill",
|
|
182
182
|
"resolvePolyfill",
|
|
183
183
|
"resolvedPolyfillToModules"
|
|
184
|
-
].indexOf(
|
|
184
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
185
185
|
Object.defineProperty(exports, '__esModule', {
|
|
186
186
|
value: true
|
|
187
187
|
});
|
package/dist/index.js
CHANGED
|
@@ -104,7 +104,7 @@ function pluginNodePolyfill(options = {}) {
|
|
|
104
104
|
return {
|
|
105
105
|
name: PLUGIN_NODE_POLYFILL_NAME,
|
|
106
106
|
setup (api) {
|
|
107
|
-
api.modifyBundlerChain(async (chain, { isServer, rspack })=>{
|
|
107
|
+
api.modifyBundlerChain(async (chain, { isServer, bundler, rspack })=>{
|
|
108
108
|
if (isServer && !force) return;
|
|
109
109
|
chain.resolve.fallback.merge(getResolveFallback({
|
|
110
110
|
protocolImports,
|
|
@@ -113,10 +113,10 @@ function pluginNodePolyfill(options = {}) {
|
|
|
113
113
|
overrides
|
|
114
114
|
}));
|
|
115
115
|
const provideGlobals = await getProvideGlobals(options.globals, overrides);
|
|
116
|
-
if (Object.keys(provideGlobals).length) chain.plugin('node-polyfill-provide').use(
|
|
116
|
+
if (Object.keys(provideGlobals).length) chain.plugin('node-polyfill-provide').use(bundler.ProvidePlugin, [
|
|
117
117
|
provideGlobals
|
|
118
118
|
]);
|
|
119
|
-
if (protocolImports) {
|
|
119
|
+
if (protocolImports && 'rspack' === api.context.bundlerType) {
|
|
120
120
|
const regex = /^node:/;
|
|
121
121
|
chain.plugin('protocol-imports').use(rspack.NormalModuleReplacementPlugin, [
|
|
122
122
|
regex,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-node-polyfill",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"repository": "https://github.com/rstackjs/rsbuild-plugin-node-polyfill",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@biomejs/biome": "^1.9.4",
|
|
64
|
-
"@playwright/test": "^1.
|
|
65
|
-
"@rsbuild/core": "^1.
|
|
66
|
-
"@rslib/core": "^0.
|
|
67
|
-
"@rstest/core": "0.
|
|
68
|
-
"@types/node": "^
|
|
64
|
+
"@playwright/test": "^1.58.1",
|
|
65
|
+
"@rsbuild/core": "^1.7.2",
|
|
66
|
+
"@rslib/core": "^0.19.4",
|
|
67
|
+
"@rstest/core": "0.8.1",
|
|
68
|
+
"@types/node": "^24.10.9",
|
|
69
69
|
"nano-staged": "^0.9.0",
|
|
70
|
-
"playwright": "^1.
|
|
70
|
+
"playwright": "^1.58.1",
|
|
71
71
|
"simple-git-hooks": "^2.13.1",
|
|
72
72
|
"tsx": "^4.21.0",
|
|
73
73
|
"typescript": "^5.9.3"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"optional": true
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
"packageManager": "pnpm@10.
|
|
83
|
+
"packageManager": "pnpm@10.28.2",
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public",
|
|
86
86
|
"registry": "https://registry.npmjs.org/"
|