@rsbuild/plugin-babel 0.5.2 → 0.5.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/dist/index.js +5 -1
- package/dist/index.mjs +6 -2
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -198,6 +198,7 @@ async function getCacheIdentifier(options) {
|
|
|
198
198
|
return identifier;
|
|
199
199
|
}
|
|
200
200
|
var getDefaultBabelOptions = (config, context) => {
|
|
201
|
+
const isLegacyDecorators = config.source.decorators.version === "legacy";
|
|
201
202
|
const options = {
|
|
202
203
|
babelrc: false,
|
|
203
204
|
configFile: false,
|
|
@@ -206,7 +207,10 @@ var getDefaultBabelOptions = (config, context) => {
|
|
|
206
207
|
[
|
|
207
208
|
require.resolve("@babel/plugin-proposal-decorators"),
|
|
208
209
|
config.source.decorators
|
|
209
|
-
]
|
|
210
|
+
],
|
|
211
|
+
// If you are using @babel/preset-env and legacy decorators, you must ensure the class elements transform is enabled regardless of your targets, because Babel only supports compiling legacy decorators when also compiling class properties:
|
|
212
|
+
// see https://babeljs.io/docs/babel-plugin-proposal-decorators#legacy
|
|
213
|
+
...isLegacyDecorators ? [require.resolve("@babel/plugin-transform-class-properties")] : []
|
|
210
214
|
],
|
|
211
215
|
presets: [
|
|
212
216
|
// TODO: only apply preset-typescript for ts file (isTSX & allExtensions false)
|
package/dist/index.mjs
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.48.
|
|
12
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.48.3/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);
|
|
@@ -186,6 +186,7 @@ async function getCacheIdentifier(options) {
|
|
|
186
186
|
return identifier;
|
|
187
187
|
}
|
|
188
188
|
var getDefaultBabelOptions = (config, context) => {
|
|
189
|
+
const isLegacyDecorators = config.source.decorators.version === "legacy";
|
|
189
190
|
const options = {
|
|
190
191
|
babelrc: false,
|
|
191
192
|
configFile: false,
|
|
@@ -194,7 +195,10 @@ var getDefaultBabelOptions = (config, context) => {
|
|
|
194
195
|
[
|
|
195
196
|
__require.resolve("@babel/plugin-proposal-decorators"),
|
|
196
197
|
config.source.decorators
|
|
197
|
-
]
|
|
198
|
+
],
|
|
199
|
+
// If you are using @babel/preset-env and legacy decorators, you must ensure the class elements transform is enabled regardless of your targets, because Babel only supports compiling legacy decorators when also compiling class properties:
|
|
200
|
+
// see https://babeljs.io/docs/babel-plugin-proposal-decorators#legacy
|
|
201
|
+
...isLegacyDecorators ? [__require.resolve("@babel/plugin-transform-class-properties")] : []
|
|
198
202
|
],
|
|
199
203
|
presets: [
|
|
200
204
|
// TODO: only apply preset-typescript for ts file (isTSX & allExtensions false)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-babel",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Babel plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,21 +23,22 @@
|
|
|
23
23
|
"compiled"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@babel/core": "^7.
|
|
27
|
-
"@babel/preset-typescript": "^7.
|
|
28
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
29
|
-
"@
|
|
26
|
+
"@babel/core": "^7.24.3",
|
|
27
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
28
|
+
"@babel/plugin-proposal-decorators": "^7.24.1",
|
|
29
|
+
"@babel/plugin-transform-class-properties": "^7.24.1",
|
|
30
|
+
"@types/babel__core": "^7.20.5",
|
|
30
31
|
"upath": "2.0.1",
|
|
31
|
-
"@rsbuild/shared": "0.5.
|
|
32
|
+
"@rsbuild/shared": "0.5.3"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/node": "16.x",
|
|
35
36
|
"typescript": "^5.4.2",
|
|
36
|
-
"@rsbuild/core": "0.5.
|
|
37
|
-
"@scripts/test-helper": "0.5.
|
|
37
|
+
"@rsbuild/core": "0.5.3",
|
|
38
|
+
"@scripts/test-helper": "0.5.3"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
|
-
"@rsbuild/core": "^0.5.
|
|
41
|
+
"@rsbuild/core": "^0.5.3"
|
|
41
42
|
},
|
|
42
43
|
"publishConfig": {
|
|
43
44
|
"access": "public",
|