@modern-js/uni-builder 2.59.0 → 2.60.0

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.
@@ -74,7 +74,7 @@ const pluginEnvironmentDefaults = (distPath = {}) => ({
74
74
  const environmentNameOrder = [
75
75
  "web",
76
76
  "node",
77
- "serviceWorker"
77
+ "workerSSR"
78
78
  ];
79
79
  config.environments = Object.fromEntries(Object.entries(config.environments).sort((a1, a2) => environmentNameOrder.includes(a1[0]) ? environmentNameOrder.indexOf(a1[0]) - environmentNameOrder.indexOf(a2[0]) : 1));
80
80
  },
@@ -1,6 +1,6 @@
1
1
  import type { NormalizedEnvironmentConfig, RsbuildContext, RsbuildTarget, RspackChain } from '@rsbuild/core';
2
2
  export declare const RUNTIME_CHUNK_NAME = "builder-runtime";
3
- export declare const SERVICE_WORKER_ENVIRONMENT_NAME = "serviceWorker";
3
+ export declare const SERVICE_WORKER_ENVIRONMENT_NAME = "workerSSR";
4
4
  export declare const JS_REGEX: RegExp;
5
5
  export declare const TS_REGEX: RegExp;
6
6
  export declare const SCRIPT_REGEX: RegExp;
@@ -45,7 +45,7 @@ __export(utils_exports, {
45
45
  module.exports = __toCommonJS(utils_exports);
46
46
  var import_browserslist = __toESM(require("browserslist"));
47
47
  const RUNTIME_CHUNK_NAME = "builder-runtime";
48
- const SERVICE_WORKER_ENVIRONMENT_NAME = "serviceWorker";
48
+ const SERVICE_WORKER_ENVIRONMENT_NAME = "workerSSR";
49
49
  const JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/;
50
50
  const TS_REGEX = /\.(?:ts|mts|cts|tsx)$/;
51
51
  const SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/;
@@ -36,6 +36,7 @@ var import_cloneDeep = __toESM(require("lodash/cloneDeep"));
36
36
  var import_node = require("@modern-js/babel-preset/node");
37
37
  var import_web = require("@modern-js/babel-preset/web");
38
38
  var import_utils = require("@modern-js/utils");
39
+ var import_core = require("@rsbuild/core");
39
40
  var import_plugin_babel = require("@rsbuild/plugin-babel");
40
41
  var import_utils2 = require("../../shared/utils");
41
42
  const getPresetReact = (rootPath, isProd) => {
@@ -101,8 +102,8 @@ const pluginBabel = (options, extraOptions) => ({
101
102
  },
102
103
  pluginDecorators: decoratorConfig
103
104
  });
105
+ applyPluginLodash(baseBabelConfig, extraOptions.transformLodash, config2.source.transformImport);
104
106
  applyPluginImport(baseBabelConfig, config2.source.transformImport);
105
- applyPluginLodash(baseBabelConfig, extraOptions.transformLodash);
106
107
  (_baseBabelConfig_presets = baseBabelConfig.presets) === null || _baseBabelConfig_presets === void 0 ? void 0 : _baseBabelConfig_presets.push(getPresetReact(api.context.rootPath, isProd));
107
108
  if (isProd) {
108
109
  var _baseBabelConfig_plugins;
@@ -155,7 +156,14 @@ const pluginBabel = (options, extraOptions) => ({
155
156
  });
156
157
  }
157
158
  });
158
- function applyPluginLodash(config, transformLodash) {
159
+ function applyPluginLodash(config, transformLodash, transformImport = []) {
160
+ const finalTransformImport = reduceTransformImportConfig(transformImport);
161
+ const hasImportPluginForLodash = finalTransformImport.some((transformImport2) => {
162
+ return transformImport2.libraryName === "lodash";
163
+ });
164
+ if (hasImportPluginForLodash && transformLodash) {
165
+ import_core.logger.warn("Detected a potential conflict between `source.transformImport` and `performance.transformLodash` for lodash. Please ensure only one of these configurations is used to handle lodash imports. If you want to use `source.transformImport`, set `performance.transformLodash` to `false` in your configuration.");
166
+ }
159
167
  if (transformLodash) {
160
168
  var _config_plugins;
161
169
  (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/uni-builder",
3
- "version": "2.59.0",
3
+ "version": "2.60.0",
4
4
  "description": "Unified builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,25 +26,25 @@
26
26
  "@babel/preset-react": "^7.22.15",
27
27
  "@babel/types": "^7.24.7",
28
28
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
29
- "@rsbuild/core": "1.0.1-rc.4",
30
- "@rsbuild/plugin-assets-retry": "1.0.1-rc.4",
31
- "@rsbuild/plugin-babel": "1.0.1-rc.4",
29
+ "@rsbuild/core": "1.0.2",
30
+ "@rsbuild/plugin-assets-retry": "1.0.1",
31
+ "@rsbuild/plugin-babel": "1.0.1",
32
32
  "@rsbuild/plugin-check-syntax": "1.0.1",
33
33
  "@rsbuild/plugin-css-minimizer": "1.0.2",
34
- "@rsbuild/plugin-less": "1.0.1-rc.4",
34
+ "@rsbuild/plugin-less": "1.0.1",
35
35
  "@rsbuild/plugin-pug": "1.0.2",
36
- "@rsbuild/plugin-react": "1.0.1-rc.4",
36
+ "@rsbuild/plugin-react": "1.0.1",
37
37
  "@rsbuild/plugin-rem": "1.0.1",
38
- "@rsbuild/plugin-sass": "1.0.1-rc.4",
38
+ "@rsbuild/plugin-sass": "1.0.1",
39
39
  "@rsbuild/plugin-source-build": "1.0.1",
40
40
  "@rsbuild/plugin-styled-components": "1.0.1",
41
- "@rsbuild/plugin-svgr": "1.0.1-rc.4",
41
+ "@rsbuild/plugin-svgr": "1.0.1",
42
42
  "@rsbuild/plugin-toml": "1.0.1",
43
- "@rsbuild/plugin-type-check": "1.0.1-rc.4",
43
+ "@rsbuild/plugin-type-check": "1.0.1",
44
44
  "@rsbuild/plugin-typed-css-modules": "1.0.2",
45
45
  "@rsbuild/plugin-yaml": "1.0.2",
46
- "@rsbuild/webpack": "1.0.1-rc.4",
47
- "@swc/helpers": "0.5.3",
46
+ "@rsbuild/webpack": "1.0.2",
47
+ "@swc/helpers": "0.5.13",
48
48
  "autoprefixer": "10.4.19",
49
49
  "babel-loader": "9.1.3",
50
50
  "babel-plugin-import": "1.13.5",
@@ -72,19 +72,19 @@
72
72
  "ts-loader": "9.4.4",
73
73
  "webpack": "^5.94.0",
74
74
  "webpack-subresource-integrity": "5.1.0",
75
- "@modern-js/babel-preset": "2.59.0",
76
- "@modern-js/utils": "2.59.0"
75
+ "@modern-js/babel-preset": "2.60.0",
76
+ "@modern-js/utils": "2.60.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@rsbuild/plugin-swc": "1.0.1-rc.4",
79
+ "@rsbuild/plugin-webpack-swc": "1.0.2",
80
80
  "@types/html-minifier-terser": "^7.0.2",
81
81
  "@types/lodash": "^4.14.202",
82
82
  "react": "^18.2.0",
83
83
  "react-dom": "^18.2.0",
84
84
  "terser": "^5.31.1",
85
85
  "typescript": "^5.3.0",
86
- "@scripts/build": "2.59.0",
87
- "@scripts/vitest-config": "2.59.0"
86
+ "@scripts/build": "2.60.0",
87
+ "@scripts/vitest-config": "2.60.0"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public",