@rsbuild/plugin-babel 0.7.1 → 0.7.3
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/compiled/babel-loader/index.js +13 -13
- package/dist/index.cjs +6 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -11
- package/package.json +9 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 258:
|
|
5
5
|
/***/ ((module) => {
|
|
6
6
|
|
|
7
7
|
const STRIP_FILENAME_RE = /^[^:]+: /;
|
|
@@ -36,7 +36,7 @@ module.exports = LoaderError;
|
|
|
36
36
|
|
|
37
37
|
/***/ }),
|
|
38
38
|
|
|
39
|
-
/***/
|
|
39
|
+
/***/ 249:
|
|
40
40
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -61,7 +61,7 @@ const {
|
|
|
61
61
|
mkdir
|
|
62
62
|
} = __nccwpck_require__(292);
|
|
63
63
|
const findCacheDirP = __nccwpck_require__.e(/* import() */ 672).then(__nccwpck_require__.bind(__nccwpck_require__, 672));
|
|
64
|
-
const transform = __nccwpck_require__(
|
|
64
|
+
const transform = __nccwpck_require__(418);
|
|
65
65
|
// Lazily instantiated when needed
|
|
66
66
|
let defaultCacheDirectory = null;
|
|
67
67
|
let hashType = "sha256";
|
|
@@ -220,7 +220,7 @@ module.exports = async function (params) {
|
|
|
220
220
|
|
|
221
221
|
/***/ }),
|
|
222
222
|
|
|
223
|
-
/***/
|
|
223
|
+
/***/ 802:
|
|
224
224
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
225
225
|
|
|
226
226
|
let babel;
|
|
@@ -241,10 +241,10 @@ if (/^6\./.test(babel.version)) {
|
|
|
241
241
|
const {
|
|
242
242
|
version
|
|
243
243
|
} = __nccwpck_require__(684);
|
|
244
|
-
const cache = __nccwpck_require__(
|
|
245
|
-
const transform = __nccwpck_require__(
|
|
246
|
-
const injectCaller = __nccwpck_require__(
|
|
247
|
-
const schema = __nccwpck_require__(
|
|
244
|
+
const cache = __nccwpck_require__(249);
|
|
245
|
+
const transform = __nccwpck_require__(418);
|
|
246
|
+
const injectCaller = __nccwpck_require__(747);
|
|
247
|
+
const schema = __nccwpck_require__(50);
|
|
248
248
|
const {
|
|
249
249
|
isAbsolute
|
|
250
250
|
} = __nccwpck_require__(17);
|
|
@@ -404,7 +404,7 @@ async function loader(source, inputSourceMap, overrides) {
|
|
|
404
404
|
|
|
405
405
|
/***/ }),
|
|
406
406
|
|
|
407
|
-
/***/
|
|
407
|
+
/***/ 747:
|
|
408
408
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
409
409
|
|
|
410
410
|
const babel = __nccwpck_require__(718);
|
|
@@ -451,14 +451,14 @@ function supportsCallerOption() {
|
|
|
451
451
|
|
|
452
452
|
/***/ }),
|
|
453
453
|
|
|
454
|
-
/***/
|
|
454
|
+
/***/ 418:
|
|
455
455
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
456
456
|
|
|
457
457
|
const babel = __nccwpck_require__(718);
|
|
458
458
|
const {
|
|
459
459
|
promisify
|
|
460
460
|
} = __nccwpck_require__(837);
|
|
461
|
-
const LoaderError = __nccwpck_require__(
|
|
461
|
+
const LoaderError = __nccwpck_require__(258);
|
|
462
462
|
const transform = promisify(babel.transform);
|
|
463
463
|
module.exports = async function (source, options) {
|
|
464
464
|
let result;
|
|
@@ -603,7 +603,7 @@ module.exports = require("zlib");
|
|
|
603
603
|
|
|
604
604
|
/***/ }),
|
|
605
605
|
|
|
606
|
-
/***/
|
|
606
|
+
/***/ 50:
|
|
607
607
|
/***/ ((module) => {
|
|
608
608
|
|
|
609
609
|
"use strict";
|
|
@@ -748,7 +748,7 @@ module.exports = JSON.parse('{"type":"object","properties":{"cacheDirectory":{"o
|
|
|
748
748
|
/******/ // startup
|
|
749
749
|
/******/ // Load entry module and return exports
|
|
750
750
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
751
|
-
/******/ var __webpack_exports__ = __nccwpck_require__(
|
|
751
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(802);
|
|
752
752
|
/******/ module.exports = __webpack_exports__;
|
|
753
753
|
/******/
|
|
754
754
|
/******/ })()
|
package/dist/index.cjs
CHANGED
|
@@ -141,10 +141,10 @@ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) =>
|
|
|
141
141
|
...getBabelUtils(defaultOptions),
|
|
142
142
|
...extraBabelUtils
|
|
143
143
|
};
|
|
144
|
-
return (0, import_shared.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
return (0, import_shared.reduceConfigsWithContext)({
|
|
145
|
+
initial: defaultOptions,
|
|
146
|
+
config: userBabelConfig,
|
|
147
|
+
ctx: babelUtils
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
return defaultOptions;
|
|
@@ -256,7 +256,7 @@ var pluginBabel = (options = {}) => ({
|
|
|
256
256
|
);
|
|
257
257
|
const { include, exclude } = options;
|
|
258
258
|
if (include || exclude) {
|
|
259
|
-
const rule = chain.module.rule(BABEL_JS_RULE);
|
|
259
|
+
const rule = chain.module.rule(BABEL_JS_RULE).after(CHAIN_ID.RULE.JS);
|
|
260
260
|
if (include) {
|
|
261
261
|
for (const condition of (0, import_shared2.castArray)(include)) {
|
|
262
262
|
rule.include.add(condition);
|
|
@@ -267,10 +267,7 @@ var pluginBabel = (options = {}) => ({
|
|
|
267
267
|
rule.exclude.add(condition);
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
const swcLoader = swcRule.get("loader");
|
|
272
|
-
const swcOptions = swcRule.get("options");
|
|
273
|
-
rule.test(import_shared2.SCRIPT_REGEX).use(CHAIN_ID.USE.SWC).loader(swcLoader).options(swcOptions).end().use(CHAIN_ID.USE.BABEL).loader(babelLoader).options(babelOptions);
|
|
270
|
+
rule.test(import_shared2.SCRIPT_REGEX).use(CHAIN_ID.USE.BABEL).loader(babelLoader).options(babelOptions);
|
|
274
271
|
} else {
|
|
275
272
|
const rule = chain.module.rule(CHAIN_ID.RULE.JS);
|
|
276
273
|
rule.test(import_shared2.SCRIPT_REGEX).use(CHAIN_ID.USE.BABEL).after(CHAIN_ID.USE.SWC).loader(babelLoader).options(babelOptions);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigChainWithContext, NormalizedConfig, RsbuildContext, RsbuildPlugin, BundlerChain, ChainIdentifier } from '@rsbuild/core';
|
|
2
2
|
import { PluginItem, TransformOptions } from '@babel/core';
|
|
3
3
|
export { TransformOptions as BabelTransformOptions } from '@babel/core';
|
|
4
4
|
|
|
@@ -94,7 +94,7 @@ type PluginBabelOptions = {
|
|
|
94
94
|
* Options passed to `babel-loader`.
|
|
95
95
|
* @see https://github.com/babel/babel-loader
|
|
96
96
|
*/
|
|
97
|
-
babelLoaderOptions?:
|
|
97
|
+
babelLoaderOptions?: ConfigChainWithContext<BabelLoaderOptions, BabelConfigUtils>;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
declare const getDefaultBabelOptions: (config: NormalizedConfig, context: RsbuildContext) => BabelLoaderOptions;
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
9
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.
|
|
12
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.51.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
13
13
|
import { fileURLToPath } from "url";
|
|
14
14
|
import path from "path";
|
|
15
15
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
|
|
30
30
|
// src/helper.ts
|
|
31
31
|
import { isAbsolute, normalize, sep } from "path";
|
|
32
|
-
import { castArray,
|
|
32
|
+
import { castArray, reduceConfigsWithContext } from "@rsbuild/shared";
|
|
33
33
|
import upath from "upath";
|
|
34
34
|
var BABEL_JS_RULE = "babel-js";
|
|
35
35
|
var normalizeToPosixPath = (p) => upath.normalizeSafe(normalize(p || "")).replace(/^([a-zA-Z]+):/, (_, m) => `/${m.toLowerCase()}`);
|
|
@@ -126,10 +126,10 @@ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) =>
|
|
|
126
126
|
...getBabelUtils(defaultOptions),
|
|
127
127
|
...extraBabelUtils
|
|
128
128
|
};
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
return reduceConfigsWithContext({
|
|
130
|
+
initial: defaultOptions,
|
|
131
|
+
config: userBabelConfig,
|
|
132
|
+
ctx: babelUtils
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
return defaultOptions;
|
|
@@ -241,7 +241,7 @@ var pluginBabel = (options = {}) => ({
|
|
|
241
241
|
);
|
|
242
242
|
const { include, exclude } = options;
|
|
243
243
|
if (include || exclude) {
|
|
244
|
-
const rule = chain.module.rule(BABEL_JS_RULE);
|
|
244
|
+
const rule = chain.module.rule(BABEL_JS_RULE).after(CHAIN_ID.RULE.JS);
|
|
245
245
|
if (include) {
|
|
246
246
|
for (const condition of castArray2(include)) {
|
|
247
247
|
rule.include.add(condition);
|
|
@@ -252,10 +252,7 @@ var pluginBabel = (options = {}) => ({
|
|
|
252
252
|
rule.exclude.add(condition);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
|
|
256
|
-
const swcLoader = swcRule.get("loader");
|
|
257
|
-
const swcOptions = swcRule.get("options");
|
|
258
|
-
rule.test(SCRIPT_REGEX).use(CHAIN_ID.USE.SWC).loader(swcLoader).options(swcOptions).end().use(CHAIN_ID.USE.BABEL).loader(babelLoader).options(babelOptions);
|
|
255
|
+
rule.test(SCRIPT_REGEX).use(CHAIN_ID.USE.BABEL).loader(babelLoader).options(babelOptions);
|
|
259
256
|
} else {
|
|
260
257
|
const rule = chain.module.rule(CHAIN_ID.RULE.JS);
|
|
261
258
|
rule.test(SCRIPT_REGEX).use(CHAIN_ID.USE.BABEL).after(CHAIN_ID.USE.SWC).loader(babelLoader).options(babelOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-babel",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Babel plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
"compiled"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@babel/core": "^7.24.
|
|
27
|
-
"@babel/plugin-proposal-decorators": "^7.24.
|
|
28
|
-
"@babel/plugin-transform-class-properties": "^7.24.
|
|
29
|
-
"@babel/preset-typescript": "^7.24.
|
|
26
|
+
"@babel/core": "^7.24.6",
|
|
27
|
+
"@babel/plugin-proposal-decorators": "^7.24.6",
|
|
28
|
+
"@babel/plugin-transform-class-properties": "^7.24.6",
|
|
29
|
+
"@babel/preset-typescript": "^7.24.6",
|
|
30
30
|
"@types/babel__core": "^7.20.5",
|
|
31
31
|
"upath": "2.0.1",
|
|
32
|
-
"@rsbuild/shared": "0.7.
|
|
32
|
+
"@rsbuild/shared": "0.7.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "18.x",
|
|
36
36
|
"babel-loader": "9.1.3",
|
|
37
37
|
"prebundle": "1.1.0",
|
|
38
38
|
"typescript": "^5.4.2",
|
|
39
|
-
"@rsbuild/core": "0.7.
|
|
40
|
-
"@scripts/test-helper": "0.7.
|
|
39
|
+
"@rsbuild/core": "0.7.3",
|
|
40
|
+
"@scripts/test-helper": "0.7.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@rsbuild/core": "^0.7.
|
|
43
|
+
"@rsbuild/core": "^0.7.3"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public",
|