@modern-js/app-tools 2.0.0-beta.6 → 2.0.0-beta.7
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 +52 -0
- package/dist/js/modern/analyze/getBundleEntry.js +2 -1
- package/dist/js/modern/analyze/utils.js +2 -1
- package/dist/js/modern/builder/index.js +8 -2
- package/dist/js/modern/schema/index.js +2 -6
- package/dist/js/modern/schema/legacy.js +1 -2
- package/dist/js/node/analyze/getBundleEntry.js +2 -1
- package/dist/js/node/analyze/utils.js +2 -1
- package/dist/js/node/builder/index.js +2 -1
- package/dist/js/node/schema/index.js +2 -6
- package/dist/js/node/schema/legacy.js +1 -2
- package/dist/js/treeshaking/analyze/getBundleEntry.js +2 -1
- package/dist/js/treeshaking/analyze/utils.js +2 -1
- package/dist/js/treeshaking/builder/index.js +3 -2
- package/dist/js/treeshaking/schema/index.js +3 -10
- package/dist/js/treeshaking/schema/legacy.js +0 -3
- package/dist/types/types/config/source.d.ts +1 -1
- package/dist/types/types/legacyConfig/source.d.ts +0 -1
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @modern-js/app-tools
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.7
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dda38c9c3e: chore: v2
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- edd1cfb1af: feat: modernjs Access builder compiler
|
|
12
|
+
feat: modernjs 接入 builder 构建
|
|
13
|
+
- bbe4c4ab64: feat: add @modern-js/plugin-swc
|
|
14
|
+
|
|
15
|
+
feat: 新增 @modern-js/plugin-swc 插件
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- d4a456659b: chore: rename plugin-jarvis to plugin-lint
|
|
20
|
+
|
|
21
|
+
chore: 重命名 plugin-jarvis 为 plugin-lint
|
|
22
|
+
|
|
23
|
+
- 6bda14ed71: feat: refactor router with react-router@6.4
|
|
24
|
+
|
|
25
|
+
feat: 使用 react-router@6.4 重构路由模块
|
|
26
|
+
|
|
27
|
+
- 8b8e1bb571: feat: support nested routes
|
|
28
|
+
feat: 支持嵌套路由
|
|
29
|
+
- Updated dependencies [c9e800d39a]
|
|
30
|
+
- Updated dependencies [edd1cfb1af]
|
|
31
|
+
- Updated dependencies [d4a456659b]
|
|
32
|
+
- Updated dependencies [6bda14ed71]
|
|
33
|
+
- Updated dependencies [f680410886]
|
|
34
|
+
- Updated dependencies [dda38c9c3e]
|
|
35
|
+
- Updated dependencies [8b8e1bb571]
|
|
36
|
+
- Updated dependencies [bbe4c4ab64]
|
|
37
|
+
- @modern-js/core@2.0.0-beta.7
|
|
38
|
+
- @modern-js/prod-server@2.0.0-beta.7
|
|
39
|
+
- @modern-js/builder-webpack-provider@2.0.0-beta.7
|
|
40
|
+
- @modern-js/builder-plugin-node-polyfill@2.0.0-beta.7
|
|
41
|
+
- @modern-js/utils@2.0.0-beta.7
|
|
42
|
+
- @modern-js/plugin-lint@2.0.0-beta.7
|
|
43
|
+
- @modern-js/types@2.0.0-beta.7
|
|
44
|
+
- @modern-js/builder@2.0.0-beta.7
|
|
45
|
+
- @modern-js/builder-shared@2.0.0-beta.7
|
|
46
|
+
- @modern-js/builder-plugin-esbuild@2.0.0-beta.7
|
|
47
|
+
- @modern-js/plugin-data-loader@2.0.0-beta.7
|
|
48
|
+
- @modern-js/plugin-i18n@2.0.0-beta.7
|
|
49
|
+
- @modern-js/new-action@2.0.0-beta.7
|
|
50
|
+
- @modern-js/server@2.0.0-beta.7
|
|
51
|
+
- @modern-js/node-bundle-require@2.0.0-beta.7
|
|
52
|
+
- @modern-js/plugin@2.0.0-beta.7
|
|
53
|
+
- @modern-js/upgrade@2.0.0-beta.7
|
|
54
|
+
|
|
3
55
|
## 2.0.0-beta.6
|
|
4
56
|
|
|
5
57
|
### Major Changes
|
|
@@ -46,7 +46,8 @@ const getBundleEntry = (appContext, config) => {
|
|
|
46
46
|
entryName: name,
|
|
47
47
|
entry: ensureAbsolutePath(appDirectory, value.entry),
|
|
48
48
|
isAutoMount: !value.disableMount,
|
|
49
|
-
|
|
49
|
+
customBootstrap: value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
|
50
|
+
fileSystemRoutes: fs.statSync(ensureAbsolutePath(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
|
50
51
|
};
|
|
51
52
|
if (entrypoint.fileSystemRoutes) {
|
|
52
53
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
@@ -59,6 +59,7 @@ const getDefaultImports = ({
|
|
|
59
59
|
},
|
|
60
60
|
customBootstrap && {
|
|
61
61
|
specifiers: [{ local: "customBootstrap" }],
|
|
62
|
+
initialize: "const App = false;",
|
|
62
63
|
value: normalizeToPosixPath(
|
|
63
64
|
customBootstrap.replace(srcDirectory, internalSrcAlias)
|
|
64
65
|
)
|
|
@@ -85,7 +86,7 @@ const getDefaultImports = ({
|
|
|
85
86
|
route.initialize = "const App = false;";
|
|
86
87
|
}
|
|
87
88
|
imports.push(route);
|
|
88
|
-
} else {
|
|
89
|
+
} else if (!customBootstrap) {
|
|
89
90
|
imports.push({
|
|
90
91
|
specifiers: [{ local: "App" }],
|
|
91
92
|
value: normalizeToPosixPath(
|
|
@@ -43,14 +43,20 @@ import {
|
|
|
43
43
|
import {
|
|
44
44
|
builderWebpackProvider
|
|
45
45
|
} from "@modern-js/builder-webpack-provider";
|
|
46
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
applyOptionsChain,
|
|
48
|
+
isProd,
|
|
49
|
+
isSSR,
|
|
50
|
+
isUseSSRBundle
|
|
51
|
+
} from "@modern-js/utils";
|
|
47
52
|
import {
|
|
48
53
|
PluginCompatModern
|
|
49
54
|
} from "./builderPlugins/compatModern";
|
|
50
55
|
import { createCopyPattern } from "./share";
|
|
51
56
|
function getBuilderTargets(normalizedConfig) {
|
|
52
57
|
const targets = ["web"];
|
|
53
|
-
|
|
58
|
+
const useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
|
59
|
+
if (useNodeTarget) {
|
|
54
60
|
targets.push("node");
|
|
55
61
|
}
|
|
56
62
|
return targets;
|
|
@@ -11,7 +11,7 @@ const source = {
|
|
|
11
11
|
properties: {
|
|
12
12
|
entry: { type: ["string", "array"] },
|
|
13
13
|
disableMount: { type: "boolean" },
|
|
14
|
-
|
|
14
|
+
customBootstrap: { type: "string" }
|
|
15
15
|
},
|
|
16
16
|
additionalProperties: false
|
|
17
17
|
},
|
|
@@ -41,11 +41,7 @@ const output = {
|
|
|
41
41
|
ssg: { typeof: ["boolean", "object", "function"] },
|
|
42
42
|
disableNodePolyfill: { type: "boolean" }
|
|
43
43
|
};
|
|
44
|
-
const dev = {
|
|
45
|
-
proxy: {
|
|
46
|
-
type: ["boolean", "object"]
|
|
47
|
-
}
|
|
48
|
-
};
|
|
44
|
+
const dev = {};
|
|
49
45
|
const server = {
|
|
50
46
|
routes: { type: "object" },
|
|
51
47
|
publicRoutes: { type: "object" },
|
|
@@ -10,8 +10,7 @@ const source = {
|
|
|
10
10
|
required: ["entry"],
|
|
11
11
|
properties: {
|
|
12
12
|
entry: { type: ["string", "array"] },
|
|
13
|
-
disableMount: { type: "boolean" }
|
|
14
|
-
enableFileSystemRoutes: { type: "boolean" }
|
|
13
|
+
disableMount: { type: "boolean" }
|
|
15
14
|
},
|
|
16
15
|
additionalProperties: false
|
|
17
16
|
},
|
|
@@ -69,7 +69,8 @@ const getBundleEntry = (appContext, config) => {
|
|
|
69
69
|
entryName: name,
|
|
70
70
|
entry: (0, import_utils.ensureAbsolutePath)(appDirectory, value.entry),
|
|
71
71
|
isAutoMount: !value.disableMount,
|
|
72
|
-
|
|
72
|
+
customBootstrap: value.customBootstrap && (0, import_utils.ensureAbsolutePath)(appDirectory, value.customBootstrap),
|
|
73
|
+
fileSystemRoutes: import_utils.fs.statSync((0, import_utils.ensureAbsolutePath)(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
|
73
74
|
};
|
|
74
75
|
if (entrypoint.fileSystemRoutes) {
|
|
75
76
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
@@ -89,6 +89,7 @@ const getDefaultImports = ({
|
|
|
89
89
|
},
|
|
90
90
|
customBootstrap && {
|
|
91
91
|
specifiers: [{ local: "customBootstrap" }],
|
|
92
|
+
initialize: "const App = false;",
|
|
92
93
|
value: (0, import_utils.normalizeToPosixPath)(
|
|
93
94
|
customBootstrap.replace(srcDirectory, internalSrcAlias)
|
|
94
95
|
)
|
|
@@ -115,7 +116,7 @@ const getDefaultImports = ({
|
|
|
115
116
|
route.initialize = "const App = false;";
|
|
116
117
|
}
|
|
117
118
|
imports.push(route);
|
|
118
|
-
} else {
|
|
119
|
+
} else if (!customBootstrap) {
|
|
119
120
|
imports.push({
|
|
120
121
|
specifiers: [{ local: "App" }],
|
|
121
122
|
value: (0, import_utils.normalizeToPosixPath)(
|
|
@@ -72,7 +72,8 @@ var import_compatModern = require("./builderPlugins/compatModern");
|
|
|
72
72
|
var import_share = require("./share");
|
|
73
73
|
function getBuilderTargets(normalizedConfig) {
|
|
74
74
|
const targets = ["web"];
|
|
75
|
-
|
|
75
|
+
const useNodeTarget = (0, import_utils.isProd)() ? (0, import_utils.isUseSSRBundle)(normalizedConfig) : (0, import_utils.isSSR)(normalizedConfig);
|
|
76
|
+
if (useNodeTarget) {
|
|
76
77
|
targets.push("node");
|
|
77
78
|
}
|
|
78
79
|
return targets;
|
|
@@ -41,7 +41,7 @@ const source = {
|
|
|
41
41
|
properties: {
|
|
42
42
|
entry: { type: ["string", "array"] },
|
|
43
43
|
disableMount: { type: "boolean" },
|
|
44
|
-
|
|
44
|
+
customBootstrap: { type: "string" }
|
|
45
45
|
},
|
|
46
46
|
additionalProperties: false
|
|
47
47
|
},
|
|
@@ -71,11 +71,7 @@ const output = {
|
|
|
71
71
|
ssg: { typeof: ["boolean", "object", "function"] },
|
|
72
72
|
disableNodePolyfill: { type: "boolean" }
|
|
73
73
|
};
|
|
74
|
-
const dev = {
|
|
75
|
-
proxy: {
|
|
76
|
-
type: ["boolean", "object"]
|
|
77
|
-
}
|
|
78
|
-
};
|
|
74
|
+
const dev = {};
|
|
79
75
|
const server = {
|
|
80
76
|
routes: { type: "object" },
|
|
81
77
|
publicRoutes: { type: "object" },
|
|
@@ -32,8 +32,7 @@ const source = {
|
|
|
32
32
|
required: ["entry"],
|
|
33
33
|
properties: {
|
|
34
34
|
entry: { type: ["string", "array"] },
|
|
35
|
-
disableMount: { type: "boolean" }
|
|
36
|
-
enableFileSystemRoutes: { type: "boolean" }
|
|
35
|
+
disableMount: { type: "boolean" }
|
|
37
36
|
},
|
|
38
37
|
additionalProperties: false
|
|
39
38
|
},
|
|
@@ -38,7 +38,8 @@ var getBundleEntry = function(appContext, config) {
|
|
|
38
38
|
entryName: name,
|
|
39
39
|
entry: ensureAbsolutePath(appDirectory, value.entry),
|
|
40
40
|
isAutoMount: !value.disableMount,
|
|
41
|
-
|
|
41
|
+
customBootstrap: value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
|
42
|
+
fileSystemRoutes: fs.statSync(ensureAbsolutePath(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
|
42
43
|
};
|
|
43
44
|
if (entrypoint.fileSystemRoutes) {
|
|
44
45
|
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
|
@@ -235,6 +235,7 @@ var getDefaultImports = function(param) {
|
|
|
235
235
|
local: "customBootstrap"
|
|
236
236
|
}
|
|
237
237
|
],
|
|
238
|
+
initialize: "const App = false;",
|
|
238
239
|
value: normalizeToPosixPath(customBootstrap.replace(srcDirectory, internalSrcAlias))
|
|
239
240
|
}
|
|
240
241
|
].filter(Boolean);
|
|
@@ -260,7 +261,7 @@ var getDefaultImports = function(param) {
|
|
|
260
261
|
route.initialize = "const App = false;";
|
|
261
262
|
}
|
|
262
263
|
imports.push(route);
|
|
263
|
-
} else {
|
|
264
|
+
} else if (!customBootstrap) {
|
|
264
265
|
imports.push({
|
|
265
266
|
specifiers: [
|
|
266
267
|
{
|
|
@@ -201,14 +201,15 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
201
201
|
};
|
|
202
202
|
import { createBuilder } from "@modern-js/builder";
|
|
203
203
|
import { builderWebpackProvider } from "@modern-js/builder-webpack-provider";
|
|
204
|
-
import { applyOptionsChain, isUseSSRBundle } from "@modern-js/utils";
|
|
204
|
+
import { applyOptionsChain, isProd, isSSR, isUseSSRBundle } from "@modern-js/utils";
|
|
205
205
|
import { PluginCompatModern } from "./builderPlugins/compatModern";
|
|
206
206
|
import { createCopyPattern } from "./share";
|
|
207
207
|
function getBuilderTargets(normalizedConfig) {
|
|
208
208
|
var targets = [
|
|
209
209
|
"web"
|
|
210
210
|
];
|
|
211
|
-
|
|
211
|
+
var useNodeTarget = isProd() ? isUseSSRBundle(normalizedConfig) : isSSR(normalizedConfig);
|
|
212
|
+
if (useNodeTarget) {
|
|
212
213
|
targets.push("node");
|
|
213
214
|
}
|
|
214
215
|
return targets;
|
|
@@ -34,8 +34,8 @@ var source = {
|
|
|
34
34
|
disableMount: {
|
|
35
35
|
type: "boolean"
|
|
36
36
|
},
|
|
37
|
-
|
|
38
|
-
type: "
|
|
37
|
+
customBootstrap: {
|
|
38
|
+
type: "string"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
additionalProperties: false
|
|
@@ -90,14 +90,7 @@ var output = {
|
|
|
90
90
|
type: "boolean"
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
var dev = {
|
|
94
|
-
proxy: {
|
|
95
|
-
type: [
|
|
96
|
-
"boolean",
|
|
97
|
-
"object"
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
};
|
|
93
|
+
var dev = {};
|
|
101
94
|
var server = {
|
|
102
95
|
routes: {
|
|
103
96
|
type: "object"
|
|
@@ -2,8 +2,8 @@ import type { BuilderConfig } from '@modern-js/builder-webpack-provider';
|
|
|
2
2
|
export declare type BuilderSourceConfig = Required<BuilderConfig>['source'];
|
|
3
3
|
export declare type Entry = string | {
|
|
4
4
|
entry: string;
|
|
5
|
-
enableFileSystemRoutes?: boolean;
|
|
6
5
|
disableMount?: boolean;
|
|
6
|
+
customBootstrap?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare type Entries = Record<string, Entry>;
|
|
9
9
|
export interface SourceUserConfig extends BuilderSourceConfig {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.7",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -65,23 +65,23 @@
|
|
|
65
65
|
"@babel/types": "^7.18.0",
|
|
66
66
|
"es-module-lexer": "^1.1.0",
|
|
67
67
|
"esbuild": "0.15.7",
|
|
68
|
-
"@modern-js/builder": "2.0.0-beta.
|
|
69
|
-
"@modern-js/builder-plugin-esbuild": "2.0.0-beta.
|
|
70
|
-
"@modern-js/builder-plugin-node-polyfill": "2.0.0-beta.
|
|
71
|
-
"@modern-js/builder-shared": "2.0.0-beta.
|
|
72
|
-
"@modern-js/builder-webpack-provider": "2.0.0-beta.
|
|
73
|
-
"@modern-js/core": "2.0.0-beta.
|
|
74
|
-
"@modern-js/new-action": "2.0.0-beta.
|
|
75
|
-
"@modern-js/node-bundle-require": "2.0.0-beta.
|
|
76
|
-
"@modern-js/plugin": "2.0.0-beta.
|
|
77
|
-
"@modern-js/plugin-data-loader": "2.0.0-beta.
|
|
78
|
-
"@modern-js/plugin-i18n": "2.0.0-beta.
|
|
79
|
-
"@modern-js/plugin-lint": "2.0.0-beta.
|
|
80
|
-
"@modern-js/prod-server": "2.0.0-beta.
|
|
81
|
-
"@modern-js/server": "2.0.0-beta.
|
|
82
|
-
"@modern-js/types": "2.0.0-beta.
|
|
83
|
-
"@modern-js/upgrade": "2.0.0-beta.
|
|
84
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
68
|
+
"@modern-js/builder": "2.0.0-beta.7",
|
|
69
|
+
"@modern-js/builder-plugin-esbuild": "2.0.0-beta.7",
|
|
70
|
+
"@modern-js/builder-plugin-node-polyfill": "2.0.0-beta.7",
|
|
71
|
+
"@modern-js/builder-shared": "2.0.0-beta.7",
|
|
72
|
+
"@modern-js/builder-webpack-provider": "2.0.0-beta.7",
|
|
73
|
+
"@modern-js/core": "2.0.0-beta.7",
|
|
74
|
+
"@modern-js/new-action": "2.0.0-beta.7",
|
|
75
|
+
"@modern-js/node-bundle-require": "2.0.0-beta.7",
|
|
76
|
+
"@modern-js/plugin": "2.0.0-beta.7",
|
|
77
|
+
"@modern-js/plugin-data-loader": "2.0.0-beta.7",
|
|
78
|
+
"@modern-js/plugin-i18n": "2.0.0-beta.7",
|
|
79
|
+
"@modern-js/plugin-lint": "2.0.0-beta.7",
|
|
80
|
+
"@modern-js/prod-server": "2.0.0-beta.7",
|
|
81
|
+
"@modern-js/server": "2.0.0-beta.7",
|
|
82
|
+
"@modern-js/types": "2.0.0-beta.7",
|
|
83
|
+
"@modern-js/upgrade": "2.0.0-beta.7",
|
|
84
|
+
"@modern-js/utils": "2.0.0-beta.7"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
"jest": "^27",
|
|
91
91
|
"typescript": "^4",
|
|
92
92
|
"webpack": "^5.75.0",
|
|
93
|
-
"@modern-js/builder-plugin-swc": "2.0.0-beta.
|
|
94
|
-
"@modern-js/server-core": "2.0.0-beta.
|
|
95
|
-
"@scripts/jest-config": "2.0.0-beta.
|
|
96
|
-
"@scripts/build": "2.0.0-beta.
|
|
93
|
+
"@modern-js/builder-plugin-swc": "2.0.0-beta.7",
|
|
94
|
+
"@modern-js/server-core": "2.0.0-beta.7",
|
|
95
|
+
"@scripts/jest-config": "2.0.0-beta.7",
|
|
96
|
+
"@scripts/build": "2.0.0-beta.7"
|
|
97
97
|
},
|
|
98
98
|
"sideEffects": false,
|
|
99
99
|
"publishConfig": {
|