@modern-js/uni-builder 0.0.0-nightly-20240130170640 → 0.0.0-nightly-20240131170643

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.
@@ -40,9 +40,10 @@ const pluginBabelPost = () => ({
40
40
  ],
41
41
  setup(api) {
42
42
  api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
43
+ const config = api.getNormalizedConfig();
43
44
  if (chain.module.rules.get(CHAIN_ID.RULE.JS)) {
44
45
  const babelLoaderOptions = chain.module.rule(CHAIN_ID.RULE.JS).use(CHAIN_ID.USE.BABEL).get("options");
45
- if (babelLoaderOptions && (0, import_isEqual.default)((0, import_plugin_babel.getDefaultBabelOptions)(), babelLoaderOptions)) {
46
+ if (babelLoaderOptions && (0, import_isEqual.default)((0, import_plugin_babel.getDefaultBabelOptions)(config.source.decorators), babelLoaderOptions)) {
46
47
  chain.module.rule(CHAIN_ID.RULE.JS).uses.delete(CHAIN_ID.USE.BABEL);
47
48
  }
48
49
  }
@@ -93,10 +93,10 @@ async function getBrowserslistWithDefault(path, config, target) {
93
93
  return DEFAULT_BROWSERSLIST[target];
94
94
  }
95
95
  async function parseCommonConfig(uniBuilderConfig, options) {
96
- var _newDevServerConfig_devMiddleware, _uniBuilderConfig_security, _uniBuilderConfig_output, _uniBuilderConfig_tools;
96
+ var _newDevServerConfig_devMiddleware, _uniBuilderConfig_output, _uniBuilderConfig_tools;
97
97
  var _output, _output_distPath, _output_distPath1, _output1, _extraConfig, _html, _extraConfig1;
98
98
  const { cwd, frameworkConfigPath, entry, target } = options;
99
- const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, disableSourceMap, convertToRem, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, ...sourceConfig } = {}, dev: { port, host, https, ...devConfig } = {}, tools: { devServer, tsChecker, minifyCss, ...toolsConfig } = {} } = uniBuilderConfig;
99
+ const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, disableSourceMap, convertToRem, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, ...sourceConfig } = {}, dev: { port, host, https, ...devConfig } = {}, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, ...toolsConfig } = {} } = uniBuilderConfig;
100
100
  const rsbuildConfig = {
101
101
  plugins,
102
102
  output: outputConfig,
@@ -107,9 +107,15 @@ async function parseCommonConfig(uniBuilderConfig, options) {
107
107
  performance: performanceConfig,
108
108
  html: htmlConfig,
109
109
  tools: toolsConfig,
110
- dev: devConfig
110
+ dev: devConfig,
111
+ security: securityConfig
111
112
  };
112
- const { dev = {}, html = {}, output = {} } = rsbuildConfig;
113
+ const { dev = {}, html = {}, output = {}, source = {} } = rsbuildConfig;
114
+ if (enableLatestDecorators) {
115
+ source.decorators = {
116
+ version: "2022-03"
117
+ };
118
+ }
113
119
  if (cssModuleLocalIdentName) {
114
120
  var _output2;
115
121
  (_output2 = output).cssModules || (_output2.cssModules = {});
@@ -235,10 +241,9 @@ async function parseCommonConfig(uniBuilderConfig, options) {
235
241
  (0, import_plugin_toml.pluginToml)(),
236
242
  (0, import_plugin_yaml.pluginYaml)()
237
243
  ];
238
- const checkSyntaxOptions = (_uniBuilderConfig_security = uniBuilderConfig.security) === null || _uniBuilderConfig_security === void 0 ? void 0 : _uniBuilderConfig_security.checkSyntax;
239
- if (checkSyntaxOptions) {
244
+ if (checkSyntax) {
240
245
  const { pluginCheckSyntax } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-check-syntax")));
241
- rsbuildPlugins.push(pluginCheckSyntax(typeof checkSyntaxOptions === "boolean" ? {} : checkSyntaxOptions));
246
+ rsbuildPlugins.push(pluginCheckSyntax(typeof checkSyntax === "boolean" ? {} : checkSyntax));
242
247
  }
243
248
  if (!disableTsChecker) {
244
249
  const { pluginTypeCheck } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-type-check")));
package/dist/types.d.ts CHANGED
@@ -122,6 +122,10 @@ export type UniBuilderExtraConfig = {
122
122
  resolveExtensionPrefix?: string | Partial<Record<RsbuildTarget, string>>;
123
123
  };
124
124
  output?: {
125
+ /**
126
+ * @deprecated use `source.decorators` instead
127
+ */
128
+ enableLatestDecorators?: boolean;
125
129
  /**
126
130
  * @deprecated use `output.cssModules.localIdentName` instead
127
131
  */
@@ -64,9 +64,7 @@ const pluginBabel = (options) => ({
64
64
  }
65
65
  }
66
66
  };
67
- const decoratorConfig = {
68
- version: config2.output.enableLatestDecorators ? "2018-09" : "legacy"
69
- };
67
+ const decoratorConfig = config2.source.decorators;
70
68
  const baseBabelConfig = isServer || isServiceWorker ? (0, import_node.getBabelConfigForNode)({
71
69
  presetEnv: {
72
70
  targets: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/uni-builder",
3
- "version": "0.0.0-nightly-20240130170640",
3
+ "version": "0.0.0-nightly-20240131170643",
4
4
  "description": "Unified builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,23 +26,23 @@
26
26
  "@babel/preset-react": "^7.22.15",
27
27
  "@babel/types": "^7.23.0",
28
28
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
29
- "@rsbuild/babel-preset": "0.3.7",
30
- "@rsbuild/core": "0.3.7",
31
- "@rsbuild/plugin-assets-retry": "0.3.7",
32
- "@rsbuild/plugin-babel": "0.3.7",
33
- "@rsbuild/plugin-check-syntax": "0.3.7",
34
- "@rsbuild/plugin-css-minimizer": "0.3.7",
35
- "@rsbuild/plugin-pug": "0.3.7",
36
- "@rsbuild/plugin-react": "0.3.7",
37
- "@rsbuild/plugin-rem": "0.3.7",
38
- "@rsbuild/plugin-source-build": "0.3.7",
39
- "@rsbuild/plugin-styled-components": "0.3.7",
40
- "@rsbuild/plugin-svgr": "0.3.7",
41
- "@rsbuild/plugin-type-check": "0.3.7",
42
- "@rsbuild/plugin-toml": "0.3.7",
43
- "@rsbuild/plugin-yaml": "0.3.7",
44
- "@rsbuild/shared": "0.3.7",
45
- "@rsbuild/webpack": "0.3.7",
29
+ "@rsbuild/babel-preset": "0.3.11",
30
+ "@rsbuild/core": "0.3.11",
31
+ "@rsbuild/plugin-assets-retry": "0.3.11",
32
+ "@rsbuild/plugin-babel": "0.3.11",
33
+ "@rsbuild/plugin-check-syntax": "0.3.11",
34
+ "@rsbuild/plugin-css-minimizer": "0.3.11",
35
+ "@rsbuild/plugin-pug": "0.3.11",
36
+ "@rsbuild/plugin-react": "0.3.11",
37
+ "@rsbuild/plugin-rem": "0.3.11",
38
+ "@rsbuild/plugin-source-build": "0.3.11",
39
+ "@rsbuild/plugin-styled-components": "0.3.11",
40
+ "@rsbuild/plugin-svgr": "0.3.11",
41
+ "@rsbuild/plugin-type-check": "0.3.11",
42
+ "@rsbuild/plugin-toml": "0.3.11",
43
+ "@rsbuild/plugin-yaml": "0.3.11",
44
+ "@rsbuild/shared": "0.3.11",
45
+ "@rsbuild/webpack": "0.3.11",
46
46
  "@swc/helpers": "0.5.3",
47
47
  "babel-loader": "9.1.3",
48
48
  "babel-plugin-import": "1.13.5",
@@ -64,19 +64,19 @@
64
64
  "webpack": "^5.89.0",
65
65
  "webpack-manifest-plugin": "5.0.0",
66
66
  "webpack-subresource-integrity": "5.1.0",
67
- "@modern-js/utils": "0.0.0-nightly-20240130170640",
68
- "@modern-js/server": "0.0.0-nightly-20240130170640",
69
- "@modern-js/prod-server": "0.0.0-nightly-20240130170640"
67
+ "@modern-js/utils": "0.0.0-nightly-20240131170643",
68
+ "@modern-js/server": "0.0.0-nightly-20240131170643",
69
+ "@modern-js/prod-server": "0.0.0-nightly-20240131170643"
70
70
  },
71
71
  "devDependencies": {
72
- "@rsbuild/plugin-swc": "0.3.7",
72
+ "@rsbuild/plugin-swc": "0.3.11",
73
73
  "@types/lodash": "^4.14.202",
74
74
  "react": "^18.2.0",
75
75
  "react-dom": "^18.2.0",
76
76
  "typescript": "^5.3.0",
77
- "@modern-js/builder-plugin-node-polyfill": "0.0.0-nightly-20240130170640",
78
- "@scripts/build": "0.0.0-nightly-20240130170640",
79
- "@scripts/vitest-config": "0.0.0-nightly-20240130170640"
77
+ "@scripts/build": "0.0.0-nightly-20240131170643",
78
+ "@scripts/vitest-config": "0.0.0-nightly-20240131170643",
79
+ "@modern-js/builder-plugin-node-polyfill": "0.0.0-nightly-20240131170643"
80
80
  },
81
81
  "publishConfig": {
82
82
  "access": "public",