@modern-js/app-tools 2.31.3-alpha.1 → 2.32.1-alpha.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 +58 -0
- package/dist/cjs/analyze/getServerRoutes.js +1 -1
- package/dist/esm/analyze/getServerRoutes.js +1 -1
- package/dist/esm-node/analyze/getServerRoutes.js +1 -1
- package/dist/types/defineConfig.d.ts +7 -4
- package/dist/types/index.d.ts +7 -1
- package/dist/types/types/config/deploy.d.ts +13 -0
- package/dist/types/types/config/dev.d.ts +5 -2
- package/dist/types/types/config/output.d.ts +20 -0
- package/dist/types/types/config/source.d.ts +38 -1
- package/dist/types/types/config/testing.d.ts +1 -1
- package/dist/types/types/config/tools.d.ts +7 -3
- package/dist/types/types/legacyConfig/testing.d.ts +1 -1
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,63 @@
|
|
1
1
|
# @modern-js/app-tools
|
2
2
|
|
3
|
+
## 2.32.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- 4323e68: feat: support client-data file
|
8
|
+
feat: 支持 client-data 文件
|
9
|
+
- 2447d64: feat: support ssr resources preload
|
10
|
+
feat: 支持 ssr 资源预加载
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- e5a3fb4: fix: integration test, and export LoaderContext from utils
|
15
|
+
fix: 集成测试,然后导出 LoaderContext
|
16
|
+
- 3910eb8: fix: route.json fit ssr.preload
|
17
|
+
fix: route.json 适配 ssr.preload
|
18
|
+
- 6076166: fix: packaging errors found by publint
|
19
|
+
|
20
|
+
fix: 修复 publint 检测到的 packaging 问题
|
21
|
+
|
22
|
+
- c72980d: chore: When the page component exists, keep the layout component
|
23
|
+
chore: 当 page 组件存在时,保留 layout 组件
|
24
|
+
- 3149ccd: fix: should update asset when only html exists
|
25
|
+
fix: 只有当 html 存在时,才更新资源
|
26
|
+
- Updated dependencies [e6c7d33]
|
27
|
+
- Updated dependencies [e5a3fb4]
|
28
|
+
- Updated dependencies [6076166]
|
29
|
+
- Updated dependencies [5f7c714]
|
30
|
+
- Updated dependencies [6517032]
|
31
|
+
- Updated dependencies [a030aff]
|
32
|
+
- Updated dependencies [6d73519]
|
33
|
+
- Updated dependencies [83c1cf7]
|
34
|
+
- Updated dependencies [79658a0]
|
35
|
+
- Updated dependencies [0cc3981]
|
36
|
+
- Updated dependencies [ddcdef2]
|
37
|
+
- Updated dependencies [4323e68]
|
38
|
+
- Updated dependencies [3c91100]
|
39
|
+
- Updated dependencies [2447d64]
|
40
|
+
- Updated dependencies [5255eba]
|
41
|
+
- @modern-js/prod-server@2.32.0
|
42
|
+
- @modern-js/utils@2.32.0
|
43
|
+
- @modern-js/builder-webpack-provider@2.32.0
|
44
|
+
- @modern-js/builder-rspack-provider@2.32.0
|
45
|
+
- @modern-js/node-bundle-require@2.32.0
|
46
|
+
- @modern-js/plugin-data-loader@2.32.0
|
47
|
+
- @modern-js/plugin@2.32.0
|
48
|
+
- @modern-js/types@2.32.0
|
49
|
+
- @modern-js/server-core@2.32.0
|
50
|
+
- @modern-js/core@2.32.0
|
51
|
+
- @modern-js/server@2.32.0
|
52
|
+
- @modern-js/builder-shared@2.32.0
|
53
|
+
- @modern-js/builder@2.32.0
|
54
|
+
- @modern-js/builder-plugin-esbuild@2.32.0
|
55
|
+
- @modern-js/builder-plugin-node-polyfill@2.32.0
|
56
|
+
- @modern-js/plugin-i18n@2.32.0
|
57
|
+
- @modern-js/plugin-lint@2.32.0
|
58
|
+
- @modern-js/new-action@2.32.0
|
59
|
+
- @modern-js/upgrade@2.32.0
|
60
|
+
|
3
61
|
## 2.31.2
|
4
62
|
|
5
63
|
### Patch Changes
|
@@ -89,7 +89,7 @@ const collectHtmlRoutes = (entrypoints, appContext, config) => {
|
|
89
89
|
const entryOptions = (0, _utils.getEntryOptions)(entryName, isMainEntry, ssr, ssrByEntries, packageName);
|
90
90
|
const isSSR = Boolean(entryOptions);
|
91
91
|
const isWorker = Boolean(workerSSR);
|
92
|
-
const isStream = typeof entryOptions === "object" && entryOptions.mode === "stream";
|
92
|
+
const isStream = typeof entryOptions === "object" && (entryOptions.mode === "stream" || Boolean(entryOptions.preload));
|
93
93
|
const { resHeaders } = ((_routes = routes) === null || _routes === void 0 ? void 0 : _routes[entryName]) || {};
|
94
94
|
let route = {
|
95
95
|
urlPath: `/${isMainEntry ? "" : entryName}`,
|
@@ -80,7 +80,7 @@ var collectHtmlRoutes = function(entrypoints, appContext, config) {
|
|
80
80
|
var entryOptions = getEntryOptions(entryName, isMainEntry, ssr, ssrByEntries, packageName);
|
81
81
|
var isSSR = Boolean(entryOptions);
|
82
82
|
var isWorker = Boolean(workerSSR);
|
83
|
-
var isStream = typeof entryOptions === "object" && entryOptions.mode === "stream";
|
83
|
+
var isStream = typeof entryOptions === "object" && (entryOptions.mode === "stream" || Boolean(entryOptions.preload));
|
84
84
|
var resHeaders = (((_routes = routes) === null || _routes === void 0 ? void 0 : _routes[entryName]) || {}).resHeaders;
|
85
85
|
var route = {
|
86
86
|
urlPath: "/".concat(isMainEntry ? "" : entryName),
|
@@ -78,7 +78,7 @@ const collectHtmlRoutes = (entrypoints, appContext, config) => {
|
|
78
78
|
const entryOptions = getEntryOptions(entryName, isMainEntry, ssr, ssrByEntries, packageName);
|
79
79
|
const isSSR = Boolean(entryOptions);
|
80
80
|
const isWorker = Boolean(workerSSR);
|
81
|
-
const isStream = typeof entryOptions === "object" && entryOptions.mode === "stream";
|
81
|
+
const isStream = typeof entryOptions === "object" && (entryOptions.mode === "stream" || Boolean(entryOptions.preload));
|
82
82
|
const { resHeaders } = ((_routes = routes) === null || _routes === void 0 ? void 0 : _routes[entryName]) || {};
|
83
83
|
let route = {
|
84
84
|
urlPath: `/${isMainEntry ? "" : entryName}`,
|
@@ -1,9 +1,12 @@
|
|
1
1
|
import type { UserConfigExport } from '@modern-js/core';
|
2
2
|
import type { AppLegacyUserConfig, AppUserConfig } from './types';
|
3
|
-
export declare const defineConfig: <B extends "rspack" | "webpack" = "webpack">(config: UserConfigExport<AppUserConfig<B>>) => UserConfigExport<AppUserConfig<B>>;
|
4
3
|
/**
|
5
|
-
*
|
6
|
-
*
|
7
|
-
|
4
|
+
* This function helps you to autocomplete configuration types.
|
5
|
+
* It accepts a direct config object, or a function that returns a config.
|
6
|
+
*/
|
7
|
+
export declare const defineConfig: <B extends "webpack" | "rspack" = "webpack">(config: UserConfigExport<AppUserConfig<B>>) => UserConfigExport<AppUserConfig<B>>;
|
8
|
+
/**
|
9
|
+
* @deprecated Please use `defineConfig` instead.
|
10
|
+
* `defineLegacyConfig` will be removed in the future major version.
|
8
11
|
*/
|
9
12
|
export declare const defineLegacyConfig: (config: AppLegacyUserConfig) => AppLegacyUserConfig;
|
package/dist/types/index.d.ts
CHANGED
@@ -9,8 +9,14 @@ export type { RuntimeUserConfig } from './types/config';
|
|
9
9
|
export declare const devCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
10
10
|
export declare const buildCommand: (program: Command, api: PluginAPI<AppTools<'shared'>>) => Promise<void>;
|
11
11
|
export type AppToolsOptions = {
|
12
|
-
/**
|
12
|
+
/**
|
13
|
+
* Specify which bundler to use for the build.
|
14
|
+
* @default `webpack`
|
15
|
+
* */
|
13
16
|
bundler?: 'experimental-rspack' | 'webpack';
|
14
17
|
};
|
18
|
+
/**
|
19
|
+
* The core package of the framework, providing CLI commands, build capabilities, configuration parsing and more.
|
20
|
+
*/
|
15
21
|
export declare const appTools: (options?: AppToolsOptions) => CliPlugin<AppTools<'shared'>>;
|
16
22
|
export default appTools;
|
@@ -1,9 +1,22 @@
|
|
1
1
|
export interface MicroFrontend {
|
2
|
+
/**
|
3
|
+
* Specifies whether to enable the HTML entry.
|
4
|
+
* When set to `true`, the current child application will be externalized for `react` and `react-dom`.
|
5
|
+
* @default true
|
6
|
+
*/
|
2
7
|
enableHtmlEntry?: boolean;
|
8
|
+
/**
|
9
|
+
* Specifies whether to use the external base library.
|
10
|
+
* @default false
|
11
|
+
*/
|
3
12
|
externalBasicLibrary?: boolean;
|
4
13
|
moduleApp?: string;
|
5
14
|
}
|
6
15
|
export interface DeployUserConfig {
|
16
|
+
/**
|
17
|
+
* Used to configure micro-frontend sub-application information.
|
18
|
+
* @default false
|
19
|
+
*/
|
7
20
|
microFrontend?: boolean | MicroFrontend;
|
8
21
|
worker?: {
|
9
22
|
ssr?: boolean;
|
@@ -3,9 +3,12 @@ type BuilderDevConfig = Required<SharedBuilderConfig>['dev'];
|
|
3
3
|
export type DevProxyOptions = string | Record<string, string>;
|
4
4
|
export interface DevUserConfig extends BuilderDevConfig {
|
5
5
|
/**
|
6
|
-
*
|
6
|
+
* Used to configure a global proxy based on whistle in the development environment,
|
7
|
+
* which can be used to view and modify HTTP/HTTPS requests, responses, and can also be used as a proxy server.
|
8
|
+
*
|
9
|
+
* @requires `proxy` plugin.
|
10
|
+
* This configuration is provided by `proxy` plugin.
|
7
11
|
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
8
|
-
* @requires `proxy` plugin
|
9
12
|
*/
|
10
13
|
proxy?: string | Record<string, string>;
|
11
14
|
}
|
@@ -5,10 +5,30 @@ import { UnwrapBuilderConfig } from '../utils';
|
|
5
5
|
export type BuilderOutputConfig = UnwrapBuilderConfig<WebpackBuilderConfig, 'output'>;
|
6
6
|
export type RsBuilderOutputConfig = UnwrapBuilderConfig<RspackBuilderConfig, 'output'>;
|
7
7
|
export interface SharedOutputConfig extends BuilderSharedOutputConfig {
|
8
|
+
/**
|
9
|
+
* Enable SSG for self-controlled routing or conventional routing.
|
10
|
+
* @default false
|
11
|
+
*/
|
8
12
|
ssg?: SSGConfig;
|
13
|
+
/**
|
14
|
+
* When using convention-based routing, the framework will split js and css based on the route to load on demand.
|
15
|
+
* If your project does not want to split js and css based on routes, you can set this option to false.
|
16
|
+
* @default true
|
17
|
+
*/
|
9
18
|
splitRouteChunks?: boolean;
|
19
|
+
/**
|
20
|
+
* Used to control whether to inject the polyfill of the Node module into the code.
|
21
|
+
* @default true
|
22
|
+
*/
|
10
23
|
disableNodePolyfill?: boolean;
|
24
|
+
/**
|
25
|
+
* Used to control whether to inject convention-based routing information into the HTML.
|
26
|
+
* @default true
|
27
|
+
*/
|
11
28
|
enableInlineRouteManifests?: boolean;
|
29
|
+
/**
|
30
|
+
* Specify the temporary directory for framework generated files.
|
31
|
+
*/
|
12
32
|
tempDir?: string;
|
13
33
|
}
|
14
34
|
export interface OutputUserConfig extends BuilderOutputConfig, SharedOutputConfig {}
|
@@ -3,23 +3,60 @@ import type { WebpackBuilderConfig, RspackBuilderConfig } from '../../builder/sh
|
|
3
3
|
export type BuilderSourceConfig = NonNullable<WebpackBuilderConfig['source']>;
|
4
4
|
export type RsBuilderSourceConfig = NonNullable<RspackBuilderConfig['source']>;
|
5
5
|
export type Entry = string | {
|
6
|
+
/**
|
7
|
+
* The entry file path.
|
8
|
+
*/
|
6
9
|
entry: string;
|
10
|
+
/**
|
11
|
+
* Disable framework's behavior of automatically generating entry code.
|
12
|
+
*/
|
7
13
|
disableMount?: boolean;
|
14
|
+
/**
|
15
|
+
* Specify the file path of custom bootstrap.
|
16
|
+
*/
|
8
17
|
customBootstrap?: string;
|
9
18
|
};
|
10
19
|
export type Entries = Record<string, Entry>;
|
11
20
|
export interface SharedSourceConfig extends BuilderSharedSourceConfig {
|
21
|
+
/**
|
22
|
+
* Used to configure custom page entries.
|
23
|
+
*/
|
12
24
|
entries?: Entries;
|
25
|
+
/**
|
26
|
+
* Used to configure the main entry name.
|
27
|
+
* @default 'main'
|
28
|
+
*/
|
13
29
|
mainEntryName?: string;
|
30
|
+
/**
|
31
|
+
* This option is used for Module Federation scenario.
|
32
|
+
* When this option is enabled, framework will wrap the automatically generated entry files with dynamic import.
|
33
|
+
* @default false
|
34
|
+
*/
|
14
35
|
enableAsyncEntry?: boolean;
|
36
|
+
/**
|
37
|
+
* Used to disable the functionality of automatically identifying page entry points based on directory structure.
|
38
|
+
* @default false
|
39
|
+
*/
|
15
40
|
disableDefaultEntries?: boolean;
|
41
|
+
/**
|
42
|
+
* By default, framework scans the src directory to identify page entries.
|
43
|
+
* You can customize the directory used for identifying page entries with this option.
|
44
|
+
*/
|
16
45
|
entriesDir?: string;
|
46
|
+
/**
|
47
|
+
* By default, framework identifies the application entry point based on the `src` directory.
|
48
|
+
* You can use this option to prevent some directories from being recognized as application entry points.
|
49
|
+
*/
|
17
50
|
disableEntryDirs?: string[];
|
51
|
+
/**
|
52
|
+
* Customize the directory of the framework configuration files.
|
53
|
+
*/
|
18
54
|
configDir?: string;
|
19
55
|
/**
|
56
|
+
* Used to define the project's theme configuration such as color palette.
|
57
|
+
* @requires `tailwindcss` plugin.
|
20
58
|
* The configuration of `source.designSystem` is provided by `tailwindcss` plugin.
|
21
59
|
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
22
|
-
* @requires `tailwindcss` plugin
|
23
60
|
*/
|
24
61
|
designSystem?: Record<string, any>;
|
25
62
|
}
|
@@ -11,20 +11,24 @@ export type RsBuilderToolsConfig = UnwrapBuilderConfig<RspackBuilderConfig, 'too
|
|
11
11
|
export type Tailwindcss = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
|
12
12
|
export interface SharedToolsConfig extends BuilderSharedToolsConfig {
|
13
13
|
/**
|
14
|
+
* Used to custom Tailwind CSS configurations.
|
15
|
+
* @requires `tailwindcss` plugin.
|
14
16
|
* The configuration of `tools.tailwindcss` is provided by `tailwindcss` plugin.
|
15
17
|
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
16
|
-
* @requires `tailwindcss` plugin
|
17
18
|
*/
|
18
19
|
tailwindcss?: Tailwindcss;
|
19
20
|
/**
|
21
|
+
* Used to custom Jest configurations.
|
22
|
+
* @requires `test` plugin.
|
20
23
|
* The configuration of `tools.jest` is provided by `test` plugin.
|
21
24
|
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
22
|
-
* @requires `test` plugin
|
23
25
|
*/
|
24
26
|
jest?: JestConfig | ((jestConfig: JestConfig) => JestConfig);
|
25
27
|
/**
|
28
|
+
* Used to custom SWC configurations.
|
29
|
+
* @requires `swc` plugin.
|
26
30
|
* The configuration of `swc` is provided by `swc` plugin.
|
27
|
-
*
|
31
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
28
32
|
*/
|
29
33
|
swc?: PluginSwcOptions<'outer'>;
|
30
34
|
}
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.32.1-alpha.0",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -73,24 +73,24 @@
|
|
73
73
|
"esbuild": "0.17.19",
|
74
74
|
"rspack-plugin-virtual-module": "0.1.7",
|
75
75
|
"@swc/helpers": "0.5.1",
|
76
|
-
"@modern-js/builder
|
77
|
-
"@modern-js/builder": "2.
|
78
|
-
"@modern-js/builder-
|
79
|
-
"@modern-js/builder-
|
80
|
-
"@modern-js/
|
81
|
-
"@modern-js/
|
82
|
-
"@modern-js/node-bundle-require": "2.
|
83
|
-
"@modern-js/
|
84
|
-
"@modern-js/
|
85
|
-
"@modern-js/plugin-
|
86
|
-
"@modern-js/
|
87
|
-
"@modern-js/
|
88
|
-
"@modern-js/
|
89
|
-
"@modern-js/server
|
90
|
-
"@modern-js/
|
91
|
-
"@modern-js/utils": "2.
|
92
|
-
"@modern-js/
|
93
|
-
"@modern-js/
|
76
|
+
"@modern-js/builder": "2.32.0",
|
77
|
+
"@modern-js/builder-plugin-esbuild": "2.32.0",
|
78
|
+
"@modern-js/builder-plugin-node-polyfill": "2.32.0",
|
79
|
+
"@modern-js/builder-shared": "2.32.0",
|
80
|
+
"@modern-js/builder-webpack-provider": "2.32.0",
|
81
|
+
"@modern-js/core": "2.32.0",
|
82
|
+
"@modern-js/node-bundle-require": "2.32.0",
|
83
|
+
"@modern-js/plugin": "2.32.0",
|
84
|
+
"@modern-js/new-action": "2.32.0",
|
85
|
+
"@modern-js/plugin-i18n": "2.32.0",
|
86
|
+
"@modern-js/plugin-lint": "2.32.0",
|
87
|
+
"@modern-js/prod-server": "2.32.0",
|
88
|
+
"@modern-js/types": "2.32.0",
|
89
|
+
"@modern-js/server": "2.32.0",
|
90
|
+
"@modern-js/upgrade": "2.32.0",
|
91
|
+
"@modern-js/utils": "2.32.0",
|
92
|
+
"@modern-js/server-core": "2.32.0",
|
93
|
+
"@modern-js/plugin-data-loader": "2.32.0"
|
94
94
|
},
|
95
95
|
"devDependencies": {
|
96
96
|
"@types/babel__traverse": "^7.14.2",
|
@@ -99,13 +99,13 @@
|
|
99
99
|
"jest": "^29",
|
100
100
|
"typescript": "^5",
|
101
101
|
"webpack": "^5.88.1",
|
102
|
-
"@modern-js/builder-
|
103
|
-
"@modern-js/builder-
|
104
|
-
"@scripts/build": "2.
|
105
|
-
"@scripts/jest-config": "2.
|
102
|
+
"@modern-js/builder-plugin-swc": "2.32.0",
|
103
|
+
"@modern-js/builder-rspack-provider": "2.32.0",
|
104
|
+
"@scripts/build": "2.32.0",
|
105
|
+
"@scripts/jest-config": "2.32.0"
|
106
106
|
},
|
107
107
|
"peerDependencies": {
|
108
|
-
"@modern-js/builder-rspack-provider": "^2.
|
108
|
+
"@modern-js/builder-rspack-provider": "^2.32.0"
|
109
109
|
},
|
110
110
|
"peerDependenciesMeta": {
|
111
111
|
"@modern-js/builder-rspack-provider": {
|