@qse/edu-scripts 1.14.13 → 1.14.14
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/CHANGELOG.md +4 -0
- package/lib/config/babel.js +7 -1
- package/lib/utils/defineConfig.d.ts +6 -0
- package/package.json +1 -1
- package/src/config/babel.js +7 -1
- package/src/utils/defineConfig.ts +7 -0
package/CHANGELOG.md
CHANGED
package/lib/config/babel.js
CHANGED
|
@@ -83,7 +83,6 @@ module.exports = function getBabelConfig(opts = {}) {
|
|
|
83
83
|
// useESModules: true,
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
|
-
[require.resolve("@babel/plugin-proposal-decorators"), { version: "2023-11" }],
|
|
87
86
|
[
|
|
88
87
|
require.resolve("babel-plugin-import"),
|
|
89
88
|
{ libraryName: "lodash", libraryDirectory: "", camel2DashComponentName: false },
|
|
@@ -94,6 +93,13 @@ module.exports = function getBabelConfig(opts = {}) {
|
|
|
94
93
|
].filter(Boolean)
|
|
95
94
|
};
|
|
96
95
|
const override = getOverride();
|
|
96
|
+
if (override.decorators) {
|
|
97
|
+
config.presets[0][1].include = ["@babel/plugin-transform-class-properties"];
|
|
98
|
+
config.plugins.push([
|
|
99
|
+
require.resolve("@babel/plugin-proposal-decorators"),
|
|
100
|
+
{ version: "legacy" }
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
97
103
|
if (override.babel) {
|
|
98
104
|
config = override.babel(config, "src") || config;
|
|
99
105
|
}
|
|
@@ -83,5 +83,11 @@ export type Config = {
|
|
|
83
83
|
/** webpack compiler 自定义的时候会用到 */
|
|
84
84
|
compiler: Compiler;
|
|
85
85
|
}) => void;
|
|
86
|
+
/**
|
|
87
|
+
* 是否开启装饰器语法支持 只支持 legacy 版本
|
|
88
|
+
* @see https://babeljs.io/docs/en/babel-plugin-proposal-decorators
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
decorators?: boolean;
|
|
86
92
|
};
|
|
87
93
|
export declare function defineConfig(config: Config): Config;
|
package/package.json
CHANGED
package/src/config/babel.js
CHANGED
|
@@ -68,7 +68,6 @@ module.exports = function getBabelConfig(opts = {}) {
|
|
|
68
68
|
// useESModules: true,
|
|
69
69
|
},
|
|
70
70
|
],
|
|
71
|
-
[require.resolve('@babel/plugin-proposal-decorators'), { version: '2023-11' }],
|
|
72
71
|
[
|
|
73
72
|
require.resolve('babel-plugin-import'),
|
|
74
73
|
{ libraryName: 'lodash', libraryDirectory: '', camel2DashComponentName: false },
|
|
@@ -80,6 +79,13 @@ module.exports = function getBabelConfig(opts = {}) {
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
const override = getOverride()
|
|
82
|
+
if (override.decorators) {
|
|
83
|
+
config.presets[0][1].include = ['@babel/plugin-transform-class-properties'] // Force include: always transform
|
|
84
|
+
config.plugins.push([
|
|
85
|
+
require.resolve('@babel/plugin-proposal-decorators'),
|
|
86
|
+
{ version: 'legacy' },
|
|
87
|
+
])
|
|
88
|
+
}
|
|
83
89
|
if (override.babel) {
|
|
84
90
|
config = override.babel(config, 'src') || config
|
|
85
91
|
}
|
|
@@ -85,6 +85,13 @@ export type Config = {
|
|
|
85
85
|
/** webpack compiler 自定义的时候会用到 */
|
|
86
86
|
compiler: Compiler
|
|
87
87
|
}) => void
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 是否开启装饰器语法支持 只支持 legacy 版本
|
|
91
|
+
* @see https://babeljs.io/docs/en/babel-plugin-proposal-decorators
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
decorators?: boolean
|
|
88
95
|
}
|
|
89
96
|
export function defineConfig(config: Config) {
|
|
90
97
|
return config
|