@modern-js/builder 2.30.0 → 2.31.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @modern-js/builder
2
2
 
3
+ ## 2.31.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 1eece3e: feat(builder): support performance.profile when use rspack-provider
8
+
9
+ feat(builder): 在使用 rspack-provider 时支持 performance.profile 配置项
10
+
11
+ - Updated dependencies [bfdf7b4]
12
+ - Updated dependencies [8ab3e2a]
13
+ - Updated dependencies [fa8e948]
14
+ - Updated dependencies [1882366]
15
+ - @modern-js/builder-shared@2.31.0
16
+ - @modern-js/utils@2.31.0
17
+ - @modern-js/monorepo-utils@2.31.0
18
+
3
19
  ## 2.30.0
4
20
 
5
21
  ### Patch Changes
@@ -42,5 +42,6 @@ const plugins = {
42
42
  sourceField: "source"
43
43
  })),
44
44
  networkPerformance: () => Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./networkPerformance"))).then((m) => m.builderPluginNetworkPerformance()),
45
- preloadOrPrefetch: () => Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./preloadOrPrefetch"))).then((m) => m.builderPluginPreloadOrPrefetch())
45
+ preloadOrPrefetch: () => Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./preloadOrPrefetch"))).then((m) => m.builderPluginPreloadOrPrefetch()),
46
+ performance: () => Promise.resolve().then(() => /* @__PURE__ */ _interop_require_wildcard._(require("./performance"))).then((m) => m.builderPluginPerformance())
46
47
  };
@@ -0,0 +1,5 @@
1
+ import type { DefaultBuilderPlugin } from '@modern-js/builder-shared';
2
+ /**
3
+ * Apply some configs of builder performance
4
+ */
5
+ export declare const builderPluginPerformance: () => DefaultBuilderPlugin;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "builderPluginPerformance", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return builderPluginPerformance;
9
+ }
10
+ });
11
+ function applyProfile({ chain, config }) {
12
+ const { profile } = config.performance;
13
+ if (!profile) {
14
+ return;
15
+ }
16
+ chain.profile(profile);
17
+ }
18
+ const builderPluginPerformance = () => ({
19
+ name: "builder-plugin-performance",
20
+ setup(api) {
21
+ api.modifyBuilderConfig((builderConfig) => {
22
+ var _builderConfig_performance;
23
+ if ((_builderConfig_performance = builderConfig.performance) === null || _builderConfig_performance === void 0 ? void 0 : _builderConfig_performance.profile) {
24
+ var _builderConfig_performance1;
25
+ if (!((_builderConfig_performance1 = builderConfig.performance) === null || _builderConfig_performance1 === void 0 ? void 0 : _builderConfig_performance1.bundleAnalyze)) {
26
+ var _builderConfig;
27
+ var _performance;
28
+ (_performance = (_builderConfig = builderConfig).performance) !== null && _performance !== void 0 ? _performance : _builderConfig.performance = {};
29
+ builderConfig.performance.bundleAnalyze = {
30
+ analyzerMode: "disabled",
31
+ generateStatsFile: true
32
+ };
33
+ } else {
34
+ builderConfig.performance.bundleAnalyze = {
35
+ generateStatsFile: true,
36
+ ...builderConfig.performance.bundleAnalyze || {}
37
+ };
38
+ }
39
+ }
40
+ });
41
+ api.modifyBundlerChain((chain) => {
42
+ const config = api.getNormalizedConfig();
43
+ applyProfile({
44
+ chain,
45
+ config
46
+ });
47
+ });
48
+ }
49
+ });
@@ -72,8 +72,8 @@ const builderPluginTsChecker = () => {
72
72
  }
73
73
  }, config.tools.tsChecker, void 0, _lodash.merge);
74
74
  if (api.context.bundlerType === "rspack" && chain.get("mode") === "production") {
75
- logger.info("ts-checker running...");
76
- logger.info("ts-checker is running slowly and will block builds until it is complete, please be patient and wait.");
75
+ logger.info("ts checker running...");
76
+ logger.info("ts checker is running slowly and will block builds until it is complete, please be patient and wait.");
77
77
  }
78
78
  chain.plugin(CHAIN_ID.PLUGIN.TS_CHECKER).use(ForkTsCheckerWebpackPlugin, [
79
79
  tsCheckerOptions
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "engines": {
19
19
  "node": ">=14.0.0"
20
20
  },
21
- "version": "2.30.0",
21
+ "version": "2.31.0",
22
22
  "jsnext:source": "./src/index.ts",
23
23
  "types": "./dist/index.d.ts",
24
24
  "main": "./dist/index.js",
@@ -32,18 +32,18 @@
32
32
  "dependencies": {
33
33
  "@svgr/webpack": "8.0.1",
34
34
  "@swc/helpers": "0.5.1",
35
- "@modern-js/builder-shared": "2.30.0",
36
- "@modern-js/monorepo-utils": "2.30.0",
37
- "@modern-js/utils": "2.30.0"
35
+ "@modern-js/builder-shared": "2.31.0",
36
+ "@modern-js/monorepo-utils": "2.31.0",
37
+ "@modern-js/utils": "2.31.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/babel__core": "^7.20.0",
41
41
  "@types/node": "^14",
42
42
  "typescript": "^5",
43
- "@modern-js/builder-webpack-provider": "2.30.0",
44
- "@modern-js/builder-rspack-provider": "2.30.0",
45
- "@scripts/build": "2.30.0",
46
- "@scripts/vitest-config": "2.30.0"
43
+ "@modern-js/builder-webpack-provider": "2.31.0",
44
+ "@modern-js/builder-rspack-provider": "2.31.0",
45
+ "@scripts/build": "2.31.0",
46
+ "@scripts/vitest-config": "2.31.0"
47
47
  },
48
48
  "publishConfig": {
49
49
  "registry": "https://registry.npmjs.org/",