@modern-js/app-tools 2.0.0-beta.1 → 2.0.0-beta.3
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 +445 -0
- package/bin/modern.js +10 -1
- package/dist/js/modern/analyze/constants.js +2 -0
- package/dist/js/modern/analyze/generateCode.js +39 -19
- package/dist/js/modern/analyze/getBundleEntry.js +1 -1
- package/dist/js/modern/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/modern/analyze/getHtmlTemplate.js +1 -1
- package/dist/js/modern/analyze/getServerRoutes.js +8 -4
- package/dist/js/modern/analyze/index.js +12 -27
- package/dist/js/modern/analyze/nestedRoutes.js +17 -6
- package/dist/js/modern/analyze/templates.js +59 -27
- package/dist/js/modern/analyze/utils.js +30 -4
- package/dist/js/modern/builder/builderPlugins/compatModern.js +18 -12
- package/dist/js/modern/builder/index.js +31 -16
- package/dist/js/modern/builder/loaders/routerLoader.js +20 -0
- package/dist/js/modern/builder/loaders/serverModuleLoader.js +4 -0
- package/dist/js/modern/builder/share.js +1 -1
- package/dist/js/modern/commands/build.js +8 -2
- package/dist/js/modern/commands/dev.js +37 -32
- package/dist/js/modern/commands/inspect.js +4 -2
- package/dist/js/modern/config/default.js +206 -0
- package/dist/js/modern/config/index.js +2 -0
- package/dist/js/modern/config/initial/createHtmlConfig.js +32 -0
- package/dist/js/modern/{builder → config/initial}/createOutputConfig.js +16 -15
- package/dist/js/modern/config/initial/createSourceConfig.js +32 -0
- package/dist/js/modern/config/initial/createToolsConfig.js +41 -0
- package/dist/js/modern/config/initial/index.js +11 -0
- package/dist/js/modern/config/initial/inits.js +117 -0
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +40 -0
- package/dist/js/modern/defineConfig.js +12 -0
- package/dist/js/modern/hooks.js +23 -19
- package/dist/js/modern/index.js +7 -5
- package/dist/js/modern/initialize/index.js +72 -0
- package/dist/js/modern/schema/Schema.js +39 -0
- package/dist/js/modern/schema/index.js +139 -0
- package/dist/js/modern/schema/legacy.js +284 -0
- package/dist/js/modern/types/config/deploy.js +0 -0
- package/dist/js/modern/types/config/dev.js +0 -0
- package/dist/js/modern/types/config/experiments.js +0 -0
- package/dist/js/modern/types/config/html.js +0 -0
- package/dist/js/modern/types/config/index.js +2 -0
- package/dist/js/modern/types/config/output.js +0 -0
- package/dist/js/modern/types/config/performance.js +0 -0
- package/dist/js/modern/types/config/security.js +0 -0
- package/dist/js/modern/types/config/source.js +0 -0
- package/dist/js/modern/types/config/tools.js +0 -0
- package/dist/js/modern/types/hooks.js +0 -0
- package/dist/js/modern/types/index.js +4 -0
- package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
- package/dist/js/modern/types/legacyConfig/dev.js +0 -0
- package/dist/js/modern/types/legacyConfig/index.js +0 -0
- package/dist/js/modern/types/legacyConfig/output.js +1 -0
- package/dist/js/modern/types/legacyConfig/source.js +0 -0
- package/dist/js/modern/types/legacyConfig/tools.js +0 -0
- package/dist/js/modern/utils/config.js +1 -1
- package/dist/js/modern/utils/createFileWatcher.js +82 -0
- package/dist/js/modern/utils/restart.js +17 -0
- package/dist/js/node/analyze/constants.js +5 -1
- package/dist/js/node/analyze/generateCode.js +37 -17
- package/dist/js/node/analyze/getBundleEntry.js +1 -1
- package/dist/js/node/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/node/analyze/getHtmlTemplate.js +1 -1
- package/dist/js/node/analyze/getServerRoutes.js +8 -4
- package/dist/js/node/analyze/index.js +13 -39
- package/dist/js/node/analyze/nestedRoutes.js +15 -4
- package/dist/js/node/analyze/templates.js +60 -27
- package/dist/js/node/analyze/utils.js +31 -3
- package/dist/js/node/builder/builderPlugins/compatModern.js +18 -12
- package/dist/js/node/builder/index.js +32 -16
- package/dist/js/node/builder/loaders/routerLoader.js +27 -0
- package/dist/js/node/builder/loaders/serverModuleLoader.js +11 -0
- package/dist/js/node/builder/share.js +1 -1
- package/dist/js/node/commands/build.js +8 -2
- package/dist/js/node/commands/dev.js +37 -32
- package/dist/js/node/commands/inspect.js +4 -2
- package/dist/js/node/config/default.js +213 -0
- package/dist/js/node/config/index.js +31 -0
- package/dist/js/node/config/initial/createHtmlConfig.js +38 -0
- package/dist/js/node/{builder → config/initial}/createOutputConfig.js +16 -15
- package/dist/js/node/config/initial/createSourceConfig.js +38 -0
- package/dist/js/node/config/initial/createToolsConfig.js +47 -0
- package/dist/js/node/config/initial/index.js +24 -0
- package/dist/js/node/config/initial/inits.js +127 -0
- package/dist/js/node/config/initial/transformNormalizedConfig.js +46 -0
- package/dist/js/node/defineConfig.js +20 -0
- package/dist/js/node/hooks.js +23 -28
- package/dist/js/node/index.js +30 -16
- package/dist/js/node/initialize/index.js +79 -0
- package/dist/js/node/schema/Schema.js +46 -0
- package/dist/js/node/schema/index.js +152 -0
- package/dist/js/node/schema/legacy.js +291 -0
- package/dist/js/node/types/config/deploy.js +0 -0
- package/dist/js/node/types/config/dev.js +0 -0
- package/dist/js/node/types/config/experiments.js +0 -0
- package/dist/js/node/types/config/html.js +0 -0
- package/dist/js/node/types/config/index.js +16 -0
- package/dist/js/node/types/config/output.js +0 -0
- package/dist/js/node/types/config/performance.js +0 -0
- package/dist/js/node/types/config/security.js +0 -0
- package/dist/js/node/types/config/source.js +0 -0
- package/dist/js/node/types/config/tools.js +0 -0
- package/dist/js/node/types/hooks.js +0 -0
- package/dist/js/node/types/index.js +38 -0
- package/dist/js/node/types/legacyConfig/deploy.js +0 -0
- package/dist/js/node/types/legacyConfig/dev.js +0 -0
- package/dist/js/node/types/legacyConfig/index.js +0 -0
- package/dist/js/node/types/legacyConfig/output.js +5 -0
- package/dist/js/node/types/legacyConfig/source.js +0 -0
- package/dist/js/node/types/legacyConfig/tools.js +0 -0
- package/dist/js/node/utils/config.js +1 -1
- package/dist/js/node/utils/createFileWatcher.js +91 -0
- package/dist/js/node/utils/restart.js +23 -0
- package/dist/js/treeshaking/analyze/constants.js +2 -0
- package/dist/js/treeshaking/analyze/generateCode.js +138 -82
- package/dist/js/treeshaking/analyze/getBundleEntry.js +1 -1
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +1 -1
- package/dist/js/treeshaking/analyze/getServerRoutes.js +7 -5
- package/dist/js/treeshaking/analyze/index.js +10 -26
- package/dist/js/treeshaking/analyze/nestedRoutes.js +98 -55
- package/dist/js/treeshaking/analyze/templates.js +175 -101
- package/dist/js/treeshaking/analyze/utils.js +80 -4
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +18 -12
- package/dist/js/treeshaking/builder/index.js +29 -16
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +14 -0
- package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +4 -0
- package/dist/js/treeshaking/builder/share.js +1 -1
- package/dist/js/treeshaking/commands/build.js +33 -23
- package/dist/js/treeshaking/commands/dev.js +56 -43
- package/dist/js/treeshaking/commands/inspect.js +8 -3
- package/dist/js/treeshaking/config/default.js +199 -0
- package/dist/js/treeshaking/config/index.js +2 -0
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +31 -0
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +70 -0
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -0
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +38 -0
- package/dist/js/treeshaking/config/initial/index.js +11 -0
- package/dist/js/treeshaking/config/initial/inits.js +114 -0
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +38 -0
- package/dist/js/treeshaking/defineConfig.js +14 -0
- package/dist/js/treeshaking/hooks.js +23 -19
- package/dist/js/treeshaking/index.js +7 -5
- package/dist/js/treeshaking/initialize/index.js +121 -0
- package/dist/js/treeshaking/schema/Schema.js +75 -0
- package/dist/js/treeshaking/schema/index.js +138 -0
- package/dist/js/treeshaking/schema/legacy.js +273 -0
- package/dist/js/treeshaking/types/config/deploy.js +0 -0
- package/dist/js/treeshaking/types/config/dev.js +0 -0
- package/dist/js/treeshaking/types/config/experiments.js +0 -0
- package/dist/js/treeshaking/types/config/html.js +0 -0
- package/dist/js/treeshaking/types/config/index.js +2 -0
- package/dist/js/treeshaking/types/config/output.js +0 -0
- package/dist/js/treeshaking/types/config/performance.js +0 -0
- package/dist/js/treeshaking/types/config/security.js +0 -0
- package/dist/js/treeshaking/types/config/source.js +0 -0
- package/dist/js/treeshaking/types/config/tools.js +0 -0
- package/dist/js/treeshaking/types/hooks.js +0 -0
- package/dist/js/treeshaking/types/index.js +4 -0
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/source.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -0
- package/dist/js/treeshaking/utils/config.js +1 -1
- package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
- package/dist/js/treeshaking/utils/restart.js +45 -0
- package/dist/types/analyze/constants.d.ts +2 -0
- package/dist/types/analyze/generateCode.d.ts +3 -2
- package/dist/types/analyze/getBundleEntry.d.ts +2 -2
- package/dist/types/analyze/getFileSystemEntry.d.ts +2 -2
- package/dist/types/analyze/getHtmlTemplate.d.ts +3 -3
- package/dist/types/analyze/getServerRoutes.d.ts +3 -2
- package/dist/types/analyze/index.d.ts +3 -41
- package/dist/types/analyze/templates.d.ts +9 -8
- package/dist/types/analyze/utils.d.ts +10 -2
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -2
- package/dist/types/builder/index.d.ts +5 -2
- package/dist/types/builder/loaders/routerLoader.d.ts +3 -0
- package/dist/types/builder/loaders/serverModuleLoader.d.ts +3 -0
- package/dist/types/builder/share.d.ts +2 -2
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/deploy.d.ts +2 -2
- package/dist/types/commands/dev.d.ts +2 -2
- package/dist/types/commands/inspect.d.ts +9 -1
- package/dist/types/commands/start.d.ts +2 -2
- package/dist/types/config/default.d.ts +3 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/initial/createHtmlConfig.d.ts +2 -0
- package/dist/types/config/initial/createOutputConfig.d.ts +2 -0
- package/dist/types/config/initial/createSourceConfig.d.ts +2 -0
- package/dist/types/config/initial/createToolsConfig.d.ts +2 -0
- package/dist/types/config/initial/index.d.ts +4 -0
- package/dist/types/config/initial/inits.d.ts +4 -0
- package/dist/types/config/initial/transformNormalizedConfig.d.ts +2 -0
- package/dist/types/defineConfig.d.ts +7 -0
- package/dist/types/hooks.d.ts +2 -42
- package/dist/types/index.d.ts +5 -5
- package/dist/types/initialize/index.d.ts +3 -0
- package/dist/types/schema/Schema.d.ts +14 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/dist/types/schema/legacy.d.ts +3 -0
- package/dist/types/types/config/deploy.d.ts +9 -0
- package/dist/types/types/config/dev.d.ts +13 -0
- package/dist/types/types/config/experiments.d.ts +4 -0
- package/dist/types/types/config/html.d.ts +4 -0
- package/dist/types/types/config/index.d.ts +62 -0
- package/dist/types/types/config/output.d.ts +23 -0
- package/dist/types/types/config/performance.d.ts +4 -0
- package/dist/types/types/config/security.d.ts +4 -0
- package/dist/types/types/config/source.d.ts +22 -0
- package/dist/types/types/config/tools.d.ts +22 -0
- package/dist/types/types/hooks.d.ts +81 -0
- package/dist/types/types/index.d.ts +23 -0
- package/dist/types/types/legacyConfig/deploy.d.ts +8 -0
- package/dist/types/types/legacyConfig/dev.d.ts +12 -0
- package/dist/types/types/legacyConfig/index.d.ts +33 -0
- package/dist/types/types/legacyConfig/output.d.ts +51 -0
- package/dist/types/types/legacyConfig/source.d.ts +25 -0
- package/dist/types/types/legacyConfig/tools.d.ts +16 -0
- package/dist/types/utils/config.d.ts +2 -2
- package/dist/types/utils/createFileWatcher.d.ts +4 -0
- package/dist/types/utils/printInstructions.d.ts +3 -3
- package/dist/types/utils/restart.d.ts +3 -0
- package/lib/types.d.ts +1 -1
- package/package.json +28 -25
- package/dist/js/modern/builder/createHtmlConfig.js +0 -58
- package/dist/js/modern/builder/createSourceConfig.js +0 -74
- package/dist/js/modern/builder/createToolsConfig.js +0 -87
- package/dist/js/node/builder/createHtmlConfig.js +0 -68
- package/dist/js/node/builder/createSourceConfig.js +0 -82
- package/dist/js/node/builder/createToolsConfig.js +0 -94
- package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
- package/dist/js/treeshaking/builder/createOutputConfig.js +0 -70
- package/dist/js/treeshaking/builder/createSourceConfig.js +0 -88
- package/dist/js/treeshaking/builder/createToolsConfig.js +0 -85
- package/dist/types/builder/createHtmlConfig.d.ts +0 -6
- package/dist/types/builder/createOutputConfig.d.ts +0 -3
- package/dist/types/builder/createSourceConfig.d.ts +0 -5
- package/dist/types/builder/createToolsConfig.d.ts +0 -13
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { ENTRY_NAME_PATTERN } from '@modern-js/utils/constants';
|
|
3
|
+
import { Schema } from "./Schema";
|
|
4
|
+
var source = {
|
|
5
|
+
entries: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
8
|
+
"if": {
|
|
9
|
+
type: 'object'
|
|
10
|
+
},
|
|
11
|
+
then: {
|
|
12
|
+
required: ['entry'],
|
|
13
|
+
properties: {
|
|
14
|
+
entry: {
|
|
15
|
+
type: ['string', 'array']
|
|
16
|
+
},
|
|
17
|
+
disableMount: {
|
|
18
|
+
type: 'boolean'
|
|
19
|
+
},
|
|
20
|
+
enableFileSystemRoutes: {
|
|
21
|
+
type: 'boolean'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
additionalProperties: false
|
|
25
|
+
},
|
|
26
|
+
"else": {
|
|
27
|
+
type: ['string', 'array']
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
enableAsyncEntry: {
|
|
32
|
+
type: 'boolean'
|
|
33
|
+
},
|
|
34
|
+
disableDefaultEntries: {
|
|
35
|
+
type: 'boolean'
|
|
36
|
+
},
|
|
37
|
+
entriesDir: {
|
|
38
|
+
type: 'string'
|
|
39
|
+
},
|
|
40
|
+
configDir: {
|
|
41
|
+
type: 'string'
|
|
42
|
+
},
|
|
43
|
+
designSystem: {
|
|
44
|
+
type: 'object'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var bff = {
|
|
48
|
+
prefix: {
|
|
49
|
+
type: 'string'
|
|
50
|
+
},
|
|
51
|
+
proxy: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
additionalProperties: {
|
|
54
|
+
type: 'string'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var output = {
|
|
59
|
+
ssg: {
|
|
60
|
+
"typeof": ['boolean', 'object', 'function']
|
|
61
|
+
},
|
|
62
|
+
enableModernMode: {
|
|
63
|
+
type: 'boolean'
|
|
64
|
+
},
|
|
65
|
+
disableNodePolyfill: {
|
|
66
|
+
type: 'boolean'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var dev = {
|
|
70
|
+
proxy: {
|
|
71
|
+
type: ['boolean', 'object']
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var server = {
|
|
75
|
+
routes: {
|
|
76
|
+
type: 'object'
|
|
77
|
+
},
|
|
78
|
+
publicRoutes: {
|
|
79
|
+
type: 'object'
|
|
80
|
+
},
|
|
81
|
+
ssr: {
|
|
82
|
+
type: ['boolean', 'object']
|
|
83
|
+
},
|
|
84
|
+
ssrByEntries: {
|
|
85
|
+
type: 'object'
|
|
86
|
+
},
|
|
87
|
+
baseUrl: {
|
|
88
|
+
anyOf: [{
|
|
89
|
+
type: 'string'
|
|
90
|
+
}, {
|
|
91
|
+
type: 'array',
|
|
92
|
+
items: {
|
|
93
|
+
type: 'string'
|
|
94
|
+
}
|
|
95
|
+
}]
|
|
96
|
+
},
|
|
97
|
+
port: {
|
|
98
|
+
type: 'number'
|
|
99
|
+
},
|
|
100
|
+
logger: {
|
|
101
|
+
type: ['boolean', 'object']
|
|
102
|
+
},
|
|
103
|
+
metrics: {
|
|
104
|
+
type: ['boolean', 'object']
|
|
105
|
+
},
|
|
106
|
+
enableMicroFrontendDebug: {
|
|
107
|
+
type: 'boolean'
|
|
108
|
+
},
|
|
109
|
+
watchOptions: {
|
|
110
|
+
type: 'object'
|
|
111
|
+
},
|
|
112
|
+
compiler: {
|
|
113
|
+
type: 'string'
|
|
114
|
+
},
|
|
115
|
+
disableFrameworkExt: {
|
|
116
|
+
type: 'boolean'
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var tools = {
|
|
120
|
+
tailwindcss: {
|
|
121
|
+
type: 'object'
|
|
122
|
+
},
|
|
123
|
+
jest: {
|
|
124
|
+
"typeof": ['object', 'function']
|
|
125
|
+
},
|
|
126
|
+
esbuild: {
|
|
127
|
+
"typeof": ['object']
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var deploy = {
|
|
131
|
+
microFrontend: {
|
|
132
|
+
type: ['boolean', 'object']
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var schema = new Schema();
|
|
136
|
+
schema.setSchema('bff', bff).setSchema('dev', dev).setSchema('server', server).setSchema('source', source).setSchema('output', output).setSchema('tools', tools).setSchema('deploy', deploy);
|
|
137
|
+
export { default as legacySchema } from "./legacy";
|
|
138
|
+
export { schema };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { ENTRY_NAME_PATTERN } from '@modern-js/utils/constants';
|
|
3
|
+
import { Schema } from "./Schema";
|
|
4
|
+
var source = {
|
|
5
|
+
entries: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
8
|
+
"if": {
|
|
9
|
+
type: 'object'
|
|
10
|
+
},
|
|
11
|
+
then: {
|
|
12
|
+
required: ['entry'],
|
|
13
|
+
properties: {
|
|
14
|
+
entry: {
|
|
15
|
+
type: ['string', 'array']
|
|
16
|
+
},
|
|
17
|
+
disableMount: {
|
|
18
|
+
type: 'boolean'
|
|
19
|
+
},
|
|
20
|
+
enableFileSystemRoutes: {
|
|
21
|
+
type: 'boolean'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
additionalProperties: false
|
|
25
|
+
},
|
|
26
|
+
"else": {
|
|
27
|
+
type: ['string', 'array']
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
preEntry: {
|
|
32
|
+
type: ['string', 'array']
|
|
33
|
+
},
|
|
34
|
+
alias: {
|
|
35
|
+
"typeof": ['object', 'function']
|
|
36
|
+
},
|
|
37
|
+
enableAsyncEntry: {
|
|
38
|
+
type: 'boolean'
|
|
39
|
+
},
|
|
40
|
+
disableDefaultEntries: {
|
|
41
|
+
type: 'boolean'
|
|
42
|
+
},
|
|
43
|
+
envVars: {
|
|
44
|
+
type: 'array'
|
|
45
|
+
},
|
|
46
|
+
globalVars: {
|
|
47
|
+
type: 'object'
|
|
48
|
+
},
|
|
49
|
+
moduleScopes: {
|
|
50
|
+
"instanceof": ['Array', 'Function']
|
|
51
|
+
},
|
|
52
|
+
entriesDir: {
|
|
53
|
+
type: 'string'
|
|
54
|
+
},
|
|
55
|
+
configDir: {
|
|
56
|
+
type: 'string'
|
|
57
|
+
},
|
|
58
|
+
include: {
|
|
59
|
+
type: ['array']
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var output = {
|
|
63
|
+
assetPrefix: {
|
|
64
|
+
type: 'string'
|
|
65
|
+
},
|
|
66
|
+
path: {
|
|
67
|
+
type: 'string'
|
|
68
|
+
},
|
|
69
|
+
jsPath: {
|
|
70
|
+
type: 'string'
|
|
71
|
+
},
|
|
72
|
+
cssPath: {
|
|
73
|
+
type: 'string'
|
|
74
|
+
},
|
|
75
|
+
htmlPath: {
|
|
76
|
+
type: 'string'
|
|
77
|
+
},
|
|
78
|
+
mediaPath: {
|
|
79
|
+
type: 'string'
|
|
80
|
+
},
|
|
81
|
+
mountId: {
|
|
82
|
+
type: 'string'
|
|
83
|
+
},
|
|
84
|
+
favicon: {
|
|
85
|
+
type: 'string'
|
|
86
|
+
},
|
|
87
|
+
faviconByEntries: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
90
|
+
type: 'string'
|
|
91
|
+
})
|
|
92
|
+
},
|
|
93
|
+
title: {
|
|
94
|
+
type: 'string'
|
|
95
|
+
},
|
|
96
|
+
titleByEntries: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
99
|
+
type: 'string'
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
meta: {
|
|
103
|
+
type: 'object'
|
|
104
|
+
},
|
|
105
|
+
metaByEntries: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
108
|
+
type: 'object'
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
inject: {
|
|
112
|
+
"enum": [true, 'head', 'body', false]
|
|
113
|
+
},
|
|
114
|
+
injectByEntries: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
117
|
+
"enum": [true, 'head', 'body', false]
|
|
118
|
+
})
|
|
119
|
+
},
|
|
120
|
+
copy: {
|
|
121
|
+
type: 'array'
|
|
122
|
+
},
|
|
123
|
+
scriptExt: {
|
|
124
|
+
type: 'object'
|
|
125
|
+
},
|
|
126
|
+
disableTsChecker: {
|
|
127
|
+
type: 'boolean'
|
|
128
|
+
},
|
|
129
|
+
disableHtmlFolder: {
|
|
130
|
+
type: 'boolean'
|
|
131
|
+
},
|
|
132
|
+
disableCssModuleExtension: {
|
|
133
|
+
type: 'boolean'
|
|
134
|
+
},
|
|
135
|
+
disableCssExtract: {
|
|
136
|
+
type: 'boolean'
|
|
137
|
+
},
|
|
138
|
+
enableCssModuleTSDeclaration: {
|
|
139
|
+
type: 'boolean'
|
|
140
|
+
},
|
|
141
|
+
disableMinimize: {
|
|
142
|
+
type: 'boolean'
|
|
143
|
+
},
|
|
144
|
+
enableInlineStyles: {
|
|
145
|
+
type: 'boolean'
|
|
146
|
+
},
|
|
147
|
+
enableInlineScripts: {
|
|
148
|
+
type: 'boolean'
|
|
149
|
+
},
|
|
150
|
+
disableSourceMap: {
|
|
151
|
+
type: 'boolean'
|
|
152
|
+
},
|
|
153
|
+
disableInlineRuntimeChunk: {
|
|
154
|
+
type: 'boolean'
|
|
155
|
+
},
|
|
156
|
+
disableAssetsCache: {
|
|
157
|
+
type: 'boolean'
|
|
158
|
+
},
|
|
159
|
+
enableLatestDecorators: {
|
|
160
|
+
type: 'boolean'
|
|
161
|
+
},
|
|
162
|
+
enableTsLoader: {
|
|
163
|
+
type: 'boolean'
|
|
164
|
+
},
|
|
165
|
+
dataUriLimit: {
|
|
166
|
+
type: 'number'
|
|
167
|
+
},
|
|
168
|
+
templateParameters: {
|
|
169
|
+
type: 'object'
|
|
170
|
+
},
|
|
171
|
+
templateParametersByEntries: {
|
|
172
|
+
type: 'object',
|
|
173
|
+
patternProperties: _defineProperty({}, ENTRY_NAME_PATTERN, {
|
|
174
|
+
type: 'object'
|
|
175
|
+
})
|
|
176
|
+
},
|
|
177
|
+
polyfill: {
|
|
178
|
+
type: 'string',
|
|
179
|
+
"enum": ['usage', 'entry', 'off', 'ua']
|
|
180
|
+
},
|
|
181
|
+
cssModuleLocalIdentName: {
|
|
182
|
+
type: 'string'
|
|
183
|
+
},
|
|
184
|
+
federation: {
|
|
185
|
+
type: 'object'
|
|
186
|
+
},
|
|
187
|
+
disableNodePolyfill: {
|
|
188
|
+
type: 'boolean'
|
|
189
|
+
},
|
|
190
|
+
enableModernMode: {
|
|
191
|
+
type: 'boolean'
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var server = {
|
|
195
|
+
routes: {
|
|
196
|
+
type: 'object'
|
|
197
|
+
},
|
|
198
|
+
publicRoutes: {
|
|
199
|
+
type: 'object'
|
|
200
|
+
},
|
|
201
|
+
ssr: {
|
|
202
|
+
type: ['boolean', 'object']
|
|
203
|
+
},
|
|
204
|
+
ssrByEntries: {
|
|
205
|
+
type: 'object'
|
|
206
|
+
},
|
|
207
|
+
baseUrl: {
|
|
208
|
+
anyOf: [{
|
|
209
|
+
type: 'string'
|
|
210
|
+
}, {
|
|
211
|
+
type: 'array',
|
|
212
|
+
items: {
|
|
213
|
+
type: 'string'
|
|
214
|
+
}
|
|
215
|
+
}]
|
|
216
|
+
},
|
|
217
|
+
port: {
|
|
218
|
+
type: 'number'
|
|
219
|
+
},
|
|
220
|
+
logger: {
|
|
221
|
+
type: ['boolean', 'object']
|
|
222
|
+
},
|
|
223
|
+
metrics: {
|
|
224
|
+
type: ['boolean', 'object']
|
|
225
|
+
},
|
|
226
|
+
enableMicroFrontendDebug: {
|
|
227
|
+
type: 'boolean'
|
|
228
|
+
},
|
|
229
|
+
watchOptions: {
|
|
230
|
+
type: 'object'
|
|
231
|
+
},
|
|
232
|
+
compiler: {
|
|
233
|
+
type: 'string'
|
|
234
|
+
},
|
|
235
|
+
disableFrameworkExt: {
|
|
236
|
+
type: 'boolean'
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var dev = {
|
|
240
|
+
proxy: {
|
|
241
|
+
type: ['boolean', 'object']
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
var deploy = {
|
|
245
|
+
microFrontend: {
|
|
246
|
+
type: ['boolean', 'object']
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var tools = {
|
|
250
|
+
tailwindcss: {
|
|
251
|
+
type: 'object'
|
|
252
|
+
},
|
|
253
|
+
jest: {
|
|
254
|
+
"typeof": ['object', 'function']
|
|
255
|
+
},
|
|
256
|
+
esbuild: {
|
|
257
|
+
"typeof": ['object']
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
var bff = {
|
|
261
|
+
prefix: {
|
|
262
|
+
type: 'string'
|
|
263
|
+
},
|
|
264
|
+
proxy: {
|
|
265
|
+
type: 'object',
|
|
266
|
+
additionalProperties: {
|
|
267
|
+
type: 'string'
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var schema = new Schema();
|
|
272
|
+
schema.setSchema('bff', bff).setSchema('dev', dev).setSchema('server', server).setSchema('source', source).setSchema('output', output).setSchema('tools', tools).setSchema('deploy', deploy);
|
|
273
|
+
export default schema;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -105,7 +105,7 @@ export var emitResolvedConfig = /*#__PURE__*/function () {
|
|
|
105
105
|
while (1) {
|
|
106
106
|
switch (_context3.prev = _context3.next) {
|
|
107
107
|
case 0:
|
|
108
|
-
outputPath = path.join(appDirectory, (
|
|
108
|
+
outputPath = path.join(appDirectory, ((_resolvedConfig$outpu = resolvedConfig.output.distPath) === null || _resolvedConfig$outpu === void 0 ? void 0 : _resolvedConfig$outpu.root) || './dist', OUTPUT_CONFIG_FILE);
|
|
109
109
|
_context3.next = 3;
|
|
110
110
|
return fs.writeJSON(outputPath, resolvedConfig, {
|
|
111
111
|
spaces: 2,
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
import crypto from 'crypto';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { isDev, chokidar, createDebugger, isTest, getServerConfig } from '@modern-js/utils';
|
|
8
|
+
/**
|
|
9
|
+
* Get user config from package.json.
|
|
10
|
+
* @param appDirectory - App root directory.
|
|
11
|
+
* @returns modernConfig or undefined
|
|
12
|
+
*/
|
|
13
|
+
// FIXME: read package.json again;
|
|
14
|
+
var getPackageConfig = function getPackageConfig(appDirectory, packageJsonConfig) {
|
|
15
|
+
var PACKAGE_JSON_CONFIG_NAME = 'modernConfig';
|
|
16
|
+
var json = JSON.parse(fs.readFileSync(path.resolve(appDirectory, './package.json'), 'utf8'));
|
|
17
|
+
return json[packageJsonConfig !== null && packageJsonConfig !== void 0 ? packageJsonConfig : PACKAGE_JSON_CONFIG_NAME];
|
|
18
|
+
};
|
|
19
|
+
export var addServerConfigToDeps = /*#__PURE__*/function () {
|
|
20
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dependencies, appDirectory, serverConfigFile) {
|
|
21
|
+
var serverConfig;
|
|
22
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
23
|
+
while (1) {
|
|
24
|
+
switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
_context.next = 2;
|
|
27
|
+
return getServerConfig(appDirectory, serverConfigFile);
|
|
28
|
+
case 2:
|
|
29
|
+
serverConfig = _context.sent;
|
|
30
|
+
if (serverConfig) {
|
|
31
|
+
dependencies.push(serverConfig);
|
|
32
|
+
}
|
|
33
|
+
case 4:
|
|
34
|
+
case "end":
|
|
35
|
+
return _context.stop();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, _callee);
|
|
39
|
+
}));
|
|
40
|
+
return function addServerConfigToDeps(_x, _x2, _x3) {
|
|
41
|
+
return _ref.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
}();
|
|
44
|
+
var debug = createDebugger('watch-files');
|
|
45
|
+
var md5 = function md5(data) {
|
|
46
|
+
return crypto.createHash('md5').update(data).digest('hex');
|
|
47
|
+
};
|
|
48
|
+
var hashMap = new Map();
|
|
49
|
+
export var createFileWatcher = /*#__PURE__*/function () {
|
|
50
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appContext, configDir, hooksRunner) {
|
|
51
|
+
var appDirectory, configFile, extraFiles, configPath, dependencies, watched, watcher;
|
|
52
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) {
|
|
54
|
+
switch (_context2.prev = _context2.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
if (!(isDev() || isTest())) {
|
|
57
|
+
_context2.next = 17;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
appDirectory = appContext.appDirectory, configFile = appContext.configFile;
|
|
61
|
+
_context2.next = 4;
|
|
62
|
+
return hooksRunner.watchFiles();
|
|
63
|
+
case 4:
|
|
64
|
+
extraFiles = _context2.sent;
|
|
65
|
+
configPath = path.join(appDirectory, configDir);
|
|
66
|
+
dependencies = getPackageConfig(appContext.appDirectory, appContext.packageName) ? [path.resolve(appDirectory, './package.json')] : []; // 将 server.config 加入到 loaded.dependencies,以便对文件监听做热更新
|
|
67
|
+
_context2.next = 9;
|
|
68
|
+
return addServerConfigToDeps(dependencies, appContext.appDirectory, appContext.serverConfigFile);
|
|
69
|
+
case 9:
|
|
70
|
+
watched = ["".concat(configPath, "/html")].concat(_toConsumableArray(extraFiles), dependencies, [configFile]).filter(Boolean);
|
|
71
|
+
debug("watched: %o", watched);
|
|
72
|
+
watcher = chokidar.watch(watched, {
|
|
73
|
+
cwd: appDirectory,
|
|
74
|
+
ignoreInitial: true,
|
|
75
|
+
ignorePermissionErrors: true,
|
|
76
|
+
ignored: [/node_modules/, '**/__test__/**', '**/*.test.(js|jsx|ts|tsx)', '**/*.spec.(js|jsx|ts|tsx)', '**/*.stories.(js|jsx|ts|tsx)']
|
|
77
|
+
});
|
|
78
|
+
watcher.on('change', function (changed) {
|
|
79
|
+
var lastHash = hashMap.get(changed);
|
|
80
|
+
var currentHash = md5(fs.readFileSync(path.join(appDirectory, changed), 'utf8'));
|
|
81
|
+
if (currentHash !== lastHash) {
|
|
82
|
+
debug("file change: %s", changed);
|
|
83
|
+
hashMap.set(changed, currentHash);
|
|
84
|
+
hooksRunner.fileChange({
|
|
85
|
+
filename: changed,
|
|
86
|
+
eventType: 'change'
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
watcher.on('add', function (name) {
|
|
91
|
+
debug("add file: %s", name);
|
|
92
|
+
var currentHash = md5(fs.readFileSync(path.join(appDirectory, name), 'utf8'));
|
|
93
|
+
hashMap.set(name, currentHash);
|
|
94
|
+
hooksRunner.fileChange({
|
|
95
|
+
filename: name,
|
|
96
|
+
eventType: 'add'
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
watcher.on('unlink', function (name) {
|
|
100
|
+
debug("remove file: %s", name);
|
|
101
|
+
if (hashMap.has(name)) {
|
|
102
|
+
hashMap["delete"](name);
|
|
103
|
+
}
|
|
104
|
+
hooksRunner.fileChange({
|
|
105
|
+
filename: name,
|
|
106
|
+
eventType: 'unlink'
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
watcher.on('error', function (err) {
|
|
110
|
+
throw err;
|
|
111
|
+
});
|
|
112
|
+
return _context2.abrupt("return", watcher);
|
|
113
|
+
case 17:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context2.stop();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, _callee2);
|
|
119
|
+
}));
|
|
120
|
+
return function createFileWatcher(_x4, _x5, _x6) {
|
|
121
|
+
return _ref2.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import { cli } from '@modern-js/core';
|
|
4
|
+
import { logger, program } from '@modern-js/utils';
|
|
5
|
+
export function restart(_x) {
|
|
6
|
+
return _restart.apply(this, arguments);
|
|
7
|
+
}
|
|
8
|
+
function _restart() {
|
|
9
|
+
_restart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(hooksRunner) {
|
|
10
|
+
var hasGetError;
|
|
11
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12
|
+
while (1) {
|
|
13
|
+
switch (_context.prev = _context.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
logger.info('Restart...\n');
|
|
16
|
+
hasGetError = false;
|
|
17
|
+
_context.next = 4;
|
|
18
|
+
return hooksRunner.beforeRestart();
|
|
19
|
+
case 4:
|
|
20
|
+
_context.prev = 4;
|
|
21
|
+
_context.next = 7;
|
|
22
|
+
return cli.init(cli.getPrevInitOptions());
|
|
23
|
+
case 7:
|
|
24
|
+
_context.next = 13;
|
|
25
|
+
break;
|
|
26
|
+
case 9:
|
|
27
|
+
_context.prev = 9;
|
|
28
|
+
_context.t0 = _context["catch"](4);
|
|
29
|
+
console.error(_context.t0);
|
|
30
|
+
hasGetError = true;
|
|
31
|
+
case 13:
|
|
32
|
+
_context.prev = 13;
|
|
33
|
+
if (!hasGetError) {
|
|
34
|
+
program.parse(process.argv);
|
|
35
|
+
}
|
|
36
|
+
return _context.finish(13);
|
|
37
|
+
case 16:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, _callee, null, [[4, 9, 13, 16]]);
|
|
43
|
+
}));
|
|
44
|
+
return _restart.apply(this, arguments);
|
|
45
|
+
}
|
|
@@ -4,6 +4,8 @@ export declare const APP_FILE_NAME = "App";
|
|
|
4
4
|
export declare const PAGES_DIR_NAME = "pages";
|
|
5
5
|
export declare const NESTED_ROUTES_DIR = "routes";
|
|
6
6
|
export declare const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
7
|
+
export declare const LOADER_EXPORT_NAME = "loader";
|
|
8
|
+
export declare const TEMP_LOADERS_DIR = "__loaders__";
|
|
7
9
|
export declare const ENTRY_POINT_FILE_NAME = "index.js";
|
|
8
10
|
export declare const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.js";
|
|
9
11
|
export declare const FILE_SYSTEM_ROUTES_DYNAMIC_REGEXP: RegExp;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IAppContext,
|
|
1
|
+
import { IAppContext, PluginAPI } from '@modern-js/core';
|
|
2
2
|
import type { Entrypoint } from '@modern-js/types';
|
|
3
|
+
import { AppNormalizedConfig, AppTools, ImportStatement } from '../types';
|
|
3
4
|
export declare const createImportStatements: (statements: ImportStatement[]) => string;
|
|
4
|
-
export declare const generateCode: (appContext: IAppContext, config:
|
|
5
|
+
export declare const generateCode: (appContext: IAppContext, config: AppNormalizedConfig, entrypoints: Entrypoint[], api: PluginAPI<AppTools>) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { IAppContext, NormalizedConfig } from '@modern-js/core';
|
|
2
1
|
import type { Entrypoint } from '@modern-js/types';
|
|
3
|
-
|
|
2
|
+
import type { AppNormalizedConfig, IAppContext } from '../types';
|
|
3
|
+
export declare const getBundleEntry: (appContext: IAppContext, config: AppNormalizedConfig) => Entrypoint[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NormalizedConfig, IAppContext } from '@modern-js/core';
|
|
2
1
|
import type { Entrypoint } from '@modern-js/types';
|
|
2
|
+
import type { AppNormalizedConfig, IAppContext } from '../types';
|
|
3
3
|
export type { Entrypoint };
|
|
4
|
-
export declare const getFileSystemEntry: (appContext: IAppContext, config:
|
|
4
|
+
export declare const getFileSystemEntry: (appContext: IAppContext, config: AppNormalizedConfig) => Entrypoint[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { IAppContext, NormalizedConfig, PluginAPI } from '@modern-js/core';
|
|
2
1
|
import type { Entrypoint, HtmlTemplates } from '@modern-js/types';
|
|
3
|
-
|
|
2
|
+
import type { AppNormalizedConfig, AppTools, IAppContext, PluginAPI } from '../types';
|
|
3
|
+
export declare const getHtmlTemplate: (entrypoints: Entrypoint[], api: PluginAPI<AppTools>, {
|
|
4
4
|
appContext,
|
|
5
5
|
config
|
|
6
6
|
}: {
|
|
7
7
|
appContext: IAppContext;
|
|
8
|
-
config:
|
|
8
|
+
config: AppNormalizedConfig;
|
|
9
9
|
}) => Promise<HtmlTemplates>;
|