@qse/edu-scripts 1.14.12 → 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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # 更新日志
2
2
 
3
+ ## 1.14.14 (2025-07-17)
4
+
5
+ - fix: 将装饰器功能改成可配置项
6
+
7
+ ## 1.14.13 (2025-07-11)
8
+
9
+ - fix: 修复 pnpm build 时 @babel/runtime 解析不了
10
+
11
+ ## 1.14.12 (2025-06-21)
12
+
13
+ - feat: 兼容 pnpm 安装
14
+ - fix: 删除图片压缩功能
15
+ - fix: 修复 assets gzip 报告可能报错的问题
16
+
3
17
  ## 1.14.11 (2025-05-12)
4
18
 
5
19
  - feat: 优化热更新能力,适配 v1 环境
@@ -50,6 +50,7 @@ module.exports = function getBabelConfig(opts = {}) {
50
50
  [
51
51
  require.resolve("@babel/plugin-transform-runtime"),
52
52
  {
53
+ absoluteRuntime: true,
53
54
  corejs: false,
54
55
  helpers: true,
55
56
  // By default, babel assumes babel/runtime version 7.0.0-beta.0,
@@ -69,6 +69,7 @@ module.exports = function getBabelConfig(opts = {}) {
69
69
  [
70
70
  require.resolve("@babel/plugin-transform-runtime"),
71
71
  {
72
+ absoluteRuntime: true,
72
73
  corejs: false,
73
74
  helpers: true,
74
75
  // By default, babel assumes babel/runtime version 7.0.0-beta.0,
@@ -82,7 +83,6 @@ module.exports = function getBabelConfig(opts = {}) {
82
83
  // useESModules: true,
83
84
  }
84
85
  ],
85
- [require.resolve("@babel/plugin-proposal-decorators"), { version: "2023-11" }],
86
86
  [
87
87
  require.resolve("babel-plugin-import"),
88
88
  { libraryName: "lodash", libraryDirectory: "", camel2DashComponentName: false },
@@ -93,6 +93,13 @@ module.exports = function getBabelConfig(opts = {}) {
93
93
  ].filter(Boolean)
94
94
  };
95
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
+ }
96
103
  if (override.babel) {
97
104
  config = override.babel(config, "src") || config;
98
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qse/edu-scripts",
3
- "version": "1.14.12",
3
+ "version": "1.14.14",
4
4
  "author": "Kinoko",
5
5
  "license": "MIT",
6
6
  "description": "教育工程化基础框架",
@@ -35,6 +35,7 @@ module.exports = function getBabelConfig(opts = {}) {
35
35
  [
36
36
  require.resolve('@babel/plugin-transform-runtime'),
37
37
  {
38
+ absoluteRuntime: true,
38
39
  corejs: false,
39
40
  helpers: true,
40
41
  // By default, babel assumes babel/runtime version 7.0.0-beta.0,
@@ -54,6 +54,7 @@ module.exports = function getBabelConfig(opts = {}) {
54
54
  [
55
55
  require.resolve('@babel/plugin-transform-runtime'),
56
56
  {
57
+ absoluteRuntime: true,
57
58
  corejs: false,
58
59
  helpers: true,
59
60
  // By default, babel assumes babel/runtime version 7.0.0-beta.0,
@@ -67,7 +68,6 @@ module.exports = function getBabelConfig(opts = {}) {
67
68
  // useESModules: true,
68
69
  },
69
70
  ],
70
- [require.resolve('@babel/plugin-proposal-decorators'), { version: '2023-11' }],
71
71
  [
72
72
  require.resolve('babel-plugin-import'),
73
73
  { libraryName: 'lodash', libraryDirectory: '', camel2DashComponentName: false },
@@ -79,6 +79,13 @@ module.exports = function getBabelConfig(opts = {}) {
79
79
  }
80
80
 
81
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
+ }
82
89
  if (override.babel) {
83
90
  config = override.babel(config, 'src') || config
84
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