@modern-js/app-tools 2.70.8 → 2.71.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.
@@ -37,7 +37,7 @@ function modifyOutputConfig(config, appContext) {
37
37
  };
38
38
  }
39
39
  function createBuilderProviderConfig(resolveConfig, appContext) {
40
- var _resolveConfig_tools;
40
+ var _resolveConfig_tools, _config_source, _config_source1;
41
41
  const htmlConfig = {
42
42
  ...resolveConfig.html
43
43
  };
@@ -53,6 +53,9 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
53
53
  resolve: {
54
54
  ...resolveConfig.resolve
55
55
  },
56
+ source: {
57
+ ...resolveConfig.source
58
+ },
56
59
  dev: {
57
60
  ...resolveConfig.dev,
58
61
  port: appContext.port
@@ -82,6 +85,9 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
82
85
  }
83
86
  }
84
87
  };
88
+ if (((_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.enableAsyncEntry) && ((_config_source1 = config.source) === null || _config_source1 === void 0 ? void 0 : _config_source1.enableAsyncPreEntry)) {
89
+ delete config.source.preEntry;
90
+ }
85
91
  modifyOutputConfig(config, appContext);
86
92
  return config;
87
93
  }
@@ -54,6 +54,7 @@ function createDefaultConfig(appContext) {
54
54
  mainEntryName: import_utils.MAIN_ENTRY_NAME,
55
55
  enableAsyncEntry: false,
56
56
  enableCustomEntry: false,
57
+ enableAsyncPreEntry: false,
57
58
  disableDefaultEntries: false,
58
59
  entriesDir: "./src",
59
60
  configDir: "./config",
@@ -15,7 +15,7 @@ function modifyOutputConfig(config, appContext) {
15
15
  });
16
16
  }
17
17
  function createBuilderProviderConfig(resolveConfig, appContext) {
18
- var _resolveConfig_tools;
18
+ var _resolveConfig_tools, _config_source, _config_source1;
19
19
  var htmlConfig = _object_spread({}, resolveConfig.html);
20
20
  if (!htmlConfig.template) {
21
21
  htmlConfig.templateByEntries = _object_spread({}, appContext.htmlTemplates, htmlConfig.templateByEntries);
@@ -23,6 +23,7 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
23
23
  var config = _object_spread_props(_object_spread({}, resolveConfig), {
24
24
  plugins: [],
25
25
  resolve: _object_spread({}, resolveConfig.resolve),
26
+ source: _object_spread({}, resolveConfig.source),
26
27
  dev: _object_spread_props(_object_spread({}, resolveConfig.dev), {
27
28
  port: appContext.port
28
29
  }),
@@ -48,6 +49,9 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
48
49
  })
49
50
  })
50
51
  });
52
+ if (((_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.enableAsyncEntry) && ((_config_source1 = config.source) === null || _config_source1 === void 0 ? void 0 : _config_source1.enableAsyncPreEntry)) {
53
+ delete config.source.preEntry;
54
+ }
51
55
  modifyOutputConfig(config, appContext);
52
56
  return config;
53
57
  }
@@ -37,6 +37,7 @@ function createDefaultConfig(appContext) {
37
37
  mainEntryName: MAIN_ENTRY_NAME,
38
38
  enableAsyncEntry: false,
39
39
  enableCustomEntry: false,
40
+ enableAsyncPreEntry: false,
40
41
  disableDefaultEntries: false,
41
42
  entriesDir: "./src",
42
43
  configDir: "./config",
@@ -14,7 +14,7 @@ function modifyOutputConfig(config, appContext) {
14
14
  };
15
15
  }
16
16
  function createBuilderProviderConfig(resolveConfig, appContext) {
17
- var _resolveConfig_tools;
17
+ var _resolveConfig_tools, _config_source, _config_source1;
18
18
  const htmlConfig = {
19
19
  ...resolveConfig.html
20
20
  };
@@ -30,6 +30,9 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
30
30
  resolve: {
31
31
  ...resolveConfig.resolve
32
32
  },
33
+ source: {
34
+ ...resolveConfig.source
35
+ },
33
36
  dev: {
34
37
  ...resolveConfig.dev,
35
38
  port: appContext.port
@@ -59,6 +62,9 @@ function createBuilderProviderConfig(resolveConfig, appContext) {
59
62
  }
60
63
  }
61
64
  };
65
+ if (((_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.enableAsyncEntry) && ((_config_source1 = config.source) === null || _config_source1 === void 0 ? void 0 : _config_source1.enableAsyncPreEntry)) {
66
+ delete config.source.preEntry;
67
+ }
62
68
  modifyOutputConfig(config, appContext);
63
69
  return config;
64
70
  }
@@ -30,6 +30,7 @@ function createDefaultConfig(appContext) {
30
30
  mainEntryName: MAIN_ENTRY_NAME,
31
31
  enableAsyncEntry: false,
32
32
  enableCustomEntry: false,
33
+ enableAsyncPreEntry: false,
33
34
  disableDefaultEntries: false,
34
35
  entriesDir: "./src",
35
36
  configDir: "./config",
@@ -21,6 +21,11 @@ export type Entry = string | {
21
21
  };
22
22
  export type Entries = Record<string, Entry>;
23
23
  export interface SourceUserConfig extends NonNullable<UniBuilderConfig['source']> {
24
+ /**
25
+ * Add code before each page entry. It will be executed before the page code.
26
+ * @default []
27
+ */
28
+ preEntry?: string | string[];
24
29
  /**
25
30
  * Used to configure custom page entries.
26
31
  */
@@ -36,6 +41,15 @@ export interface SourceUserConfig extends NonNullable<UniBuilderConfig['source']
36
41
  * @default false
37
42
  */
38
43
  enableAsyncEntry?: boolean;
44
+ /**
45
+ * When enabled, framework will inject `source.preEntry` into the top of the
46
+ * auto-generated entry file (`index.jsx`) and will not pass `source.preEntry`
47
+ * to builder config.
48
+ * This is useful when `source.enableAsyncEntry` is enabled and you still want
49
+ * preEntry to run before the real entry code.
50
+ * @default false
51
+ */
52
+ enableAsyncPreEntry?: boolean;
39
53
  /**
40
54
  * Enable use entry.tsx to custom entry
41
55
  * @default false
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.70.8",
18
+ "version": "2.71.0",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -85,7 +85,7 @@
85
85
  "@babel/parser": "^7.22.15",
86
86
  "@babel/traverse": "^7.23.2",
87
87
  "@babel/types": "^7.26.0",
88
- "@rsbuild/core": "1.7.3",
88
+ "@rsbuild/core": "1.7.5",
89
89
  "@rsbuild/plugin-node-polyfill": "1.4.4",
90
90
  "@swc/helpers": "^0.5.17",
91
91
  "es-module-lexer": "^1.1.0",
@@ -96,20 +96,20 @@
96
96
  "ndepe": "^0.1.13",
97
97
  "pkg-types": "^1.3.1",
98
98
  "std-env": "^3.7.0",
99
- "@modern-js/core": "2.70.8",
100
- "@modern-js/node-bundle-require": "2.70.8",
101
- "@modern-js/plugin": "2.70.8",
102
- "@modern-js/plugin-data-loader": "2.70.8",
103
- "@modern-js/plugin-i18n": "2.70.8",
104
- "@modern-js/plugin-v2": "2.70.8",
105
- "@modern-js/rsbuild-plugin-esbuild": "2.70.8",
106
- "@modern-js/prod-server": "2.70.8",
107
- "@modern-js/server-core": "2.70.8",
108
- "@modern-js/server": "2.70.8",
109
- "@modern-js/server-utils": "2.70.8",
110
- "@modern-js/types": "2.70.8",
111
- "@modern-js/uni-builder": "2.70.8",
112
- "@modern-js/utils": "2.70.8"
99
+ "@modern-js/core": "2.71.0",
100
+ "@modern-js/node-bundle-require": "2.71.0",
101
+ "@modern-js/plugin": "2.71.0",
102
+ "@modern-js/plugin-data-loader": "2.71.0",
103
+ "@modern-js/plugin-i18n": "2.71.0",
104
+ "@modern-js/rsbuild-plugin-esbuild": "2.71.0",
105
+ "@modern-js/prod-server": "2.71.0",
106
+ "@modern-js/plugin-v2": "2.71.0",
107
+ "@modern-js/server": "2.71.0",
108
+ "@modern-js/server-core": "2.71.0",
109
+ "@modern-js/server-utils": "2.71.0",
110
+ "@modern-js/types": "2.71.0",
111
+ "@modern-js/uni-builder": "2.71.0",
112
+ "@modern-js/utils": "2.71.0"
113
113
  },
114
114
  "devDependencies": {
115
115
  "@rsbuild/plugin-webpack-swc": "1.1.2",