@modern-js/core 1.0.0-alpha.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 +10 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/bin/modern-js.js +18 -0
- package/dist/js/modern/config/defaults.js +102 -0
- package/dist/js/modern/config/index.js +104 -0
- package/dist/js/modern/config/mergeConfig.js +20 -0
- package/dist/js/modern/config/schema/deploy.js +34 -0
- package/dist/js/modern/config/schema/index.js +104 -0
- package/dist/js/modern/config/schema/output.js +147 -0
- package/dist/js/modern/config/schema/server.js +167 -0
- package/dist/js/modern/config/schema/source.js +59 -0
- package/dist/js/modern/config/schema/tools.js +33 -0
- package/dist/js/modern/context.js +25 -0
- package/dist/js/modern/index.js +137 -0
- package/dist/js/modern/initWatcher.js +51 -0
- package/dist/js/modern/loadEnv.js +12 -0
- package/dist/js/modern/loadPlugins.js +66 -0
- package/dist/js/modern/utils/commander.js +19 -0
- package/dist/js/modern/utils/repeatKeyWarning.js +18 -0
- package/dist/js/node/config/defaults.js +109 -0
- package/dist/js/node/config/index.js +142 -0
- package/dist/js/node/config/mergeConfig.js +32 -0
- package/dist/js/node/config/schema/deploy.js +43 -0
- package/dist/js/node/config/schema/index.js +126 -0
- package/dist/js/node/config/schema/output.js +156 -0
- package/dist/js/node/config/schema/server.js +176 -0
- package/dist/js/node/config/schema/source.js +68 -0
- package/dist/js/node/config/schema/tools.js +40 -0
- package/dist/js/node/context.js +52 -0
- package/dist/js/node/index.js +212 -0
- package/dist/js/node/initWatcher.js +72 -0
- package/dist/js/node/loadEnv.js +28 -0
- package/dist/js/node/loadPlugins.js +76 -0
- package/dist/js/node/utils/commander.js +35 -0
- package/dist/js/node/utils/repeatKeyWarning.js +31 -0
- package/dist/types/config/defaults.d.ts +27 -0
- package/dist/types/config/index.d.ts +125 -0
- package/dist/types/config/mergeConfig.d.ts +29 -0
- package/dist/types/config/schema/deploy.d.ts +33 -0
- package/dist/types/config/schema/index.d.ts +474 -0
- package/dist/types/config/schema/output.d.ts +146 -0
- package/dist/types/config/schema/server.d.ts +179 -0
- package/dist/types/config/schema/source.d.ts +58 -0
- package/dist/types/config/schema/tools.d.ts +33 -0
- package/dist/types/context.d.ts +20 -0
- package/dist/types/index.d.ts +86 -0
- package/dist/types/initWatcher.d.ts +4 -0
- package/dist/types/loadEnv.d.ts +1 -0
- package/dist/types/loadPlugins.d.ts +16 -0
- package/dist/types/utils/commander.d.ts +7 -0
- package/dist/types/utils/repeatKeyWarning.d.ts +3 -0
- package/modern.config.js +13 -0
- package/package.json +73 -0
- package/src/config/defaults.ts +104 -0
- package/src/config/index.ts +296 -0
- package/src/config/mergeConfig.ts +68 -0
- package/src/config/schema/deploy.ts +23 -0
- package/src/config/schema/index.ts +111 -0
- package/src/config/schema/output.ts +66 -0
- package/src/config/schema/server.ts +105 -0
- package/src/config/schema/source.ts +34 -0
- package/src/config/schema/tools.ts +15 -0
- package/src/context.ts +46 -0
- package/src/index.ts +240 -0
- package/src/initWatcher.ts +81 -0
- package/src/loadEnv.ts +21 -0
- package/src/loadPlugins.ts +81 -0
- package/src/types.d.ts +0 -0
- package/src/utils/commander.ts +22 -0
- package/src/utils/repeatKeyWarning.ts +29 -0
- package/tests/fixtures/load-plugin/not-found/package.json +3 -0
- package/tests/fixtures/load-plugin/not-found/test-plugin-a.js +1 -0
- package/tests/fixtures/load-plugin/user-plugins/package.json +3 -0
- package/tests/fixtures/load-plugin/user-plugins/test-plugin-a.js +1 -0
- package/tests/fixtures/load-plugin/user-plugins/test-plugin-b.js +3 -0
- package/tests/loadEnv.test.ts +100 -0
- package/tests/loadPlugin.test.ts +29 -0
- package/tests/mergeConfig.test.ts +78 -0
- package/tests/repeatKeyWarning.test.ts +68 -0
- package/tests/schema.test.ts +109 -0
- package/tests/tsconfig.json +13 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export declare const output: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
properties: {
|
|
5
|
+
assetPrefix: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
path: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
jsPath: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
cssPath: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
htmlPath: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
mediaPath: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
mountId: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
favicon: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
faviconByEntries: {
|
|
30
|
+
type: string;
|
|
31
|
+
patternProperties: {
|
|
32
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
title: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
titleByEntries: {
|
|
41
|
+
type: string;
|
|
42
|
+
patternProperties: {
|
|
43
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
meta: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
metaByEntries: {
|
|
52
|
+
type: string;
|
|
53
|
+
patternProperties: {
|
|
54
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
inject: {
|
|
60
|
+
enum: (string | boolean)[];
|
|
61
|
+
};
|
|
62
|
+
injectByEntries: {
|
|
63
|
+
type: string;
|
|
64
|
+
patternProperties: {
|
|
65
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
66
|
+
enum: (string | boolean)[];
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
copy: {
|
|
71
|
+
type: string;
|
|
72
|
+
};
|
|
73
|
+
scriptExt: {
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
disableHtmlFolder: {
|
|
77
|
+
type: string;
|
|
78
|
+
};
|
|
79
|
+
disableCssModuleExtension: {
|
|
80
|
+
type: string;
|
|
81
|
+
};
|
|
82
|
+
disableCssExtract: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
enableCssModuleTSDeclaration: {
|
|
86
|
+
type: string;
|
|
87
|
+
};
|
|
88
|
+
disableMinimize: {
|
|
89
|
+
type: string;
|
|
90
|
+
};
|
|
91
|
+
enableInlineStyles: {
|
|
92
|
+
type: string;
|
|
93
|
+
};
|
|
94
|
+
enableInlineScripts: {
|
|
95
|
+
type: string;
|
|
96
|
+
};
|
|
97
|
+
disableSourceMap: {
|
|
98
|
+
type: string;
|
|
99
|
+
};
|
|
100
|
+
disableInlineRuntimeChunk: {
|
|
101
|
+
type: string;
|
|
102
|
+
};
|
|
103
|
+
disableAssetsCache: {
|
|
104
|
+
type: string;
|
|
105
|
+
};
|
|
106
|
+
enableLatestDecorators: {
|
|
107
|
+
type: string;
|
|
108
|
+
};
|
|
109
|
+
enableUsageBuiltIns: {
|
|
110
|
+
type: string;
|
|
111
|
+
};
|
|
112
|
+
enableTsLoader: {
|
|
113
|
+
type: string;
|
|
114
|
+
};
|
|
115
|
+
dataUriLimit: {
|
|
116
|
+
type: string;
|
|
117
|
+
};
|
|
118
|
+
templateParameters: {
|
|
119
|
+
type: string;
|
|
120
|
+
};
|
|
121
|
+
templateParametersByEntries: {
|
|
122
|
+
type: string;
|
|
123
|
+
patternProperties: {
|
|
124
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
polyfill: {
|
|
130
|
+
type: string;
|
|
131
|
+
enum: string[];
|
|
132
|
+
};
|
|
133
|
+
cssModuleLocalIdentName: {
|
|
134
|
+
type: string;
|
|
135
|
+
};
|
|
136
|
+
federation: {
|
|
137
|
+
type: string;
|
|
138
|
+
};
|
|
139
|
+
disableNodePolyfill: {
|
|
140
|
+
type: string;
|
|
141
|
+
};
|
|
142
|
+
enableModernMode: {
|
|
143
|
+
type: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export declare const server: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
properties: {
|
|
5
|
+
port: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
ssr: {
|
|
9
|
+
if: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
then: {
|
|
13
|
+
properties: {
|
|
14
|
+
disableLoadable: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
disableHelmet: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
disableRedirect: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
enableAsyncData: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
enableProductWarning: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
timeout: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
asyncDataTimeout: {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
else: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
ssrByEntries: {
|
|
42
|
+
type: string;
|
|
43
|
+
patternProperties: {
|
|
44
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
45
|
+
if: {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
then: {
|
|
49
|
+
properties: {
|
|
50
|
+
disableLoadable: {
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
disableHelmet: {
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
56
|
+
disableRedirect: {
|
|
57
|
+
type: string;
|
|
58
|
+
};
|
|
59
|
+
enableProductWarning: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
enableAsyncData: {
|
|
63
|
+
type: string;
|
|
64
|
+
};
|
|
65
|
+
timeout: {
|
|
66
|
+
type: string;
|
|
67
|
+
};
|
|
68
|
+
asyncDataTimeout: {
|
|
69
|
+
type: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
additionalProperties: boolean;
|
|
73
|
+
};
|
|
74
|
+
else: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
routes: {
|
|
81
|
+
type: string;
|
|
82
|
+
patternProperties: {
|
|
83
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
84
|
+
if: {
|
|
85
|
+
type: string;
|
|
86
|
+
};
|
|
87
|
+
then: {
|
|
88
|
+
properties: {
|
|
89
|
+
route: {
|
|
90
|
+
oneOf: ({
|
|
91
|
+
type: string;
|
|
92
|
+
properties: {
|
|
93
|
+
path: {
|
|
94
|
+
type: string;
|
|
95
|
+
};
|
|
96
|
+
headers: {
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
additionalProperties: boolean;
|
|
101
|
+
} | {
|
|
102
|
+
type: string;
|
|
103
|
+
items?: undefined;
|
|
104
|
+
} | {
|
|
105
|
+
type: string;
|
|
106
|
+
items: {
|
|
107
|
+
oneOf: ({
|
|
108
|
+
type: string;
|
|
109
|
+
properties: {
|
|
110
|
+
path: {
|
|
111
|
+
type: string;
|
|
112
|
+
};
|
|
113
|
+
headers: {
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
additionalProperties: boolean;
|
|
118
|
+
} | {
|
|
119
|
+
type: string;
|
|
120
|
+
})[];
|
|
121
|
+
};
|
|
122
|
+
})[];
|
|
123
|
+
};
|
|
124
|
+
disableSpa: {
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
additionalProperties: boolean;
|
|
129
|
+
};
|
|
130
|
+
else: {
|
|
131
|
+
oneOf: ({
|
|
132
|
+
type: string;
|
|
133
|
+
items?: undefined;
|
|
134
|
+
} | {
|
|
135
|
+
type: string;
|
|
136
|
+
items: {
|
|
137
|
+
type: string;
|
|
138
|
+
};
|
|
139
|
+
})[];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
publicRoutes: {
|
|
145
|
+
type: string;
|
|
146
|
+
patternProperties: {
|
|
147
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
148
|
+
type: string[];
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
baseUrl: {
|
|
153
|
+
oneOf: ({
|
|
154
|
+
type: string;
|
|
155
|
+
items?: undefined;
|
|
156
|
+
} | {
|
|
157
|
+
type: string;
|
|
158
|
+
items: {
|
|
159
|
+
type: string;
|
|
160
|
+
}[];
|
|
161
|
+
})[];
|
|
162
|
+
};
|
|
163
|
+
middleware: {
|
|
164
|
+
instanceof: string[];
|
|
165
|
+
};
|
|
166
|
+
renderHook: {
|
|
167
|
+
instanceof: string;
|
|
168
|
+
};
|
|
169
|
+
logger: {
|
|
170
|
+
type: string;
|
|
171
|
+
};
|
|
172
|
+
measure: {
|
|
173
|
+
type: string;
|
|
174
|
+
};
|
|
175
|
+
proxy: {
|
|
176
|
+
type: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const source: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
properties: {
|
|
5
|
+
entries: {
|
|
6
|
+
type: string;
|
|
7
|
+
patternProperties: {
|
|
8
|
+
"^[a-zA-Z0-9_-]+$": {
|
|
9
|
+
if: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
then: {
|
|
13
|
+
required: string[];
|
|
14
|
+
properties: {
|
|
15
|
+
entry: {
|
|
16
|
+
type: string[];
|
|
17
|
+
};
|
|
18
|
+
disableMount: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
enableFileSystemRoutes: {
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
additionalProperties: boolean;
|
|
26
|
+
};
|
|
27
|
+
else: {
|
|
28
|
+
type: string[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
alias: {
|
|
34
|
+
typeof: string[];
|
|
35
|
+
};
|
|
36
|
+
disableDefaultEntries: {
|
|
37
|
+
type: string;
|
|
38
|
+
};
|
|
39
|
+
envVars: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
globalVars: {
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
moduleScopes: {
|
|
46
|
+
instanceof: string[];
|
|
47
|
+
};
|
|
48
|
+
entriesDir: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
configDir: {
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
include: {
|
|
55
|
+
type: string[];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const tools: {
|
|
2
|
+
type: string;
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
properties: {
|
|
5
|
+
webpack: {
|
|
6
|
+
typeof: string[];
|
|
7
|
+
};
|
|
8
|
+
babel: {
|
|
9
|
+
typeof: string[];
|
|
10
|
+
};
|
|
11
|
+
postcss: {
|
|
12
|
+
typeof: string[];
|
|
13
|
+
};
|
|
14
|
+
lodash: {
|
|
15
|
+
typeof: string[];
|
|
16
|
+
};
|
|
17
|
+
devServer: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
tsLoader: {
|
|
21
|
+
typeof: string[];
|
|
22
|
+
};
|
|
23
|
+
autoprefixer: {
|
|
24
|
+
typeof: string[];
|
|
25
|
+
};
|
|
26
|
+
terser: {
|
|
27
|
+
typeof: string[];
|
|
28
|
+
};
|
|
29
|
+
minifyCss: {
|
|
30
|
+
typeof: string[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IAppContext } from '@modern-js/types';
|
|
2
|
+
import { UserConfig } from './config';
|
|
3
|
+
import { NormalizedConfig } from './config/mergeConfig';
|
|
4
|
+
export type { IAppContext };
|
|
5
|
+
export declare const AppContext: import("@modern-js/plugin").Context<IAppContext>;
|
|
6
|
+
export declare const ConfigContext: import("@modern-js/plugin").Context<UserConfig>;
|
|
7
|
+
export declare const ResolvedConfigContext: import("@modern-js/plugin").Context<NormalizedConfig>;
|
|
8
|
+
export declare const useAppContext: () => {
|
|
9
|
+
value: IAppContext;
|
|
10
|
+
};
|
|
11
|
+
export declare const useConfigContext: () => {
|
|
12
|
+
value: UserConfig;
|
|
13
|
+
};
|
|
14
|
+
export declare const useResolvedConfigContext: () => {
|
|
15
|
+
value: NormalizedConfig;
|
|
16
|
+
};
|
|
17
|
+
export declare const initAppContext: (appDirectory: string, plugins: Array<{
|
|
18
|
+
cli: any;
|
|
19
|
+
server: any;
|
|
20
|
+
}>, configFile: string | false) => IAppContext;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createContext, ParallelWorkflow, AsyncWorkflow, Progresses2Runners } from '@modern-js/plugin';
|
|
2
|
+
import type { Hooks } from '@modern-js/types';
|
|
3
|
+
import { Command } from './utils/commander';
|
|
4
|
+
import { defineConfig, UserConfig, ToolsConfig } from './config';
|
|
5
|
+
import { AppContext, IAppContext, useAppContext, useConfigContext, useResolvedConfigContext } from './context';
|
|
6
|
+
import { NormalizedConfig } from './config/mergeConfig';
|
|
7
|
+
export type { Hooks };
|
|
8
|
+
export { defaultsConfig } from './config';
|
|
9
|
+
export declare type HooksRunner = Progresses2Runners<{
|
|
10
|
+
config: ParallelWorkflow<void>;
|
|
11
|
+
validateSchema: ParallelWorkflow<void>;
|
|
12
|
+
prepare: AsyncWorkflow<void, void>;
|
|
13
|
+
commands: AsyncWorkflow<{
|
|
14
|
+
program: Command;
|
|
15
|
+
}, void>;
|
|
16
|
+
watchFiles: ParallelWorkflow<void>;
|
|
17
|
+
fileChange: AsyncWorkflow<{
|
|
18
|
+
filename: string;
|
|
19
|
+
}, void>;
|
|
20
|
+
beforeExit: AsyncWorkflow<void, void>;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const manager: import("@modern-js/plugin").AsyncManager<Hooks, {
|
|
23
|
+
config: ParallelWorkflow<void, unknown>;
|
|
24
|
+
validateSchema: ParallelWorkflow<void, unknown>;
|
|
25
|
+
prepare: AsyncWorkflow<void, void>;
|
|
26
|
+
commands: AsyncWorkflow<{
|
|
27
|
+
program: Command;
|
|
28
|
+
}, void>;
|
|
29
|
+
watchFiles: ParallelWorkflow<void, unknown>;
|
|
30
|
+
fileChange: AsyncWorkflow<{
|
|
31
|
+
filename: string;
|
|
32
|
+
}, void>;
|
|
33
|
+
beforeExit: AsyncWorkflow<void, void>;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const createPlugin: (initializer: import("@modern-js/plugin").AsyncInitializer<Partial<import("@modern-js/plugin").Progresses2Threads<{
|
|
36
|
+
config: ParallelWorkflow<void, unknown>;
|
|
37
|
+
validateSchema: ParallelWorkflow<void, unknown>;
|
|
38
|
+
prepare: AsyncWorkflow<void, void>;
|
|
39
|
+
commands: AsyncWorkflow<{
|
|
40
|
+
program: Command;
|
|
41
|
+
}, void>;
|
|
42
|
+
watchFiles: ParallelWorkflow<void, unknown>;
|
|
43
|
+
fileChange: AsyncWorkflow<{
|
|
44
|
+
filename: string;
|
|
45
|
+
}, void>;
|
|
46
|
+
beforeExit: AsyncWorkflow<void, void>;
|
|
47
|
+
} & import("@modern-js/plugin").ClearDraftProgress<Hooks>>>>, options?: import("@modern-js/plugin").PluginOptions | undefined) => import("@modern-js/plugin").AsyncPlugin<Partial<import("@modern-js/plugin").Progresses2Threads<{
|
|
48
|
+
config: ParallelWorkflow<void, unknown>;
|
|
49
|
+
validateSchema: ParallelWorkflow<void, unknown>;
|
|
50
|
+
prepare: AsyncWorkflow<void, void>;
|
|
51
|
+
commands: AsyncWorkflow<{
|
|
52
|
+
program: Command;
|
|
53
|
+
}, void>;
|
|
54
|
+
watchFiles: ParallelWorkflow<void, unknown>;
|
|
55
|
+
fileChange: AsyncWorkflow<{
|
|
56
|
+
filename: string;
|
|
57
|
+
}, void>;
|
|
58
|
+
beforeExit: AsyncWorkflow<void, void>;
|
|
59
|
+
} & import("@modern-js/plugin").ClearDraftProgress<Hooks>>>>, registerHook: (newShape: Partial<Hooks>) => void, mountHook: () => Progresses2Runners<{
|
|
60
|
+
config: ParallelWorkflow<void, unknown>;
|
|
61
|
+
validateSchema: ParallelWorkflow<void, unknown>;
|
|
62
|
+
prepare: AsyncWorkflow<void, void>;
|
|
63
|
+
commands: AsyncWorkflow<{
|
|
64
|
+
program: Command;
|
|
65
|
+
}, void>;
|
|
66
|
+
watchFiles: ParallelWorkflow<void, unknown>;
|
|
67
|
+
fileChange: AsyncWorkflow<{
|
|
68
|
+
filename: string;
|
|
69
|
+
}, void>;
|
|
70
|
+
beforeExit: AsyncWorkflow<void, void>;
|
|
71
|
+
} & import("@modern-js/plugin").ClearDraftProgress<Hooks>>;
|
|
72
|
+
export declare const usePlugins: (plugins: string[]) => void;
|
|
73
|
+
export { defineConfig, createContext, AppContext, useAppContext, useConfigContext, useResolvedConfigContext };
|
|
74
|
+
export type { NormalizedConfig, IAppContext, UserConfig, ToolsConfig };
|
|
75
|
+
export interface CoreOption {
|
|
76
|
+
dryRun?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare const cli: {
|
|
79
|
+
init: (argv?: string[]) => Promise<{
|
|
80
|
+
loadedConfig: import("./config").LoadedConfig;
|
|
81
|
+
appContext: IAppContext;
|
|
82
|
+
resolved: NormalizedConfig;
|
|
83
|
+
}>;
|
|
84
|
+
run: (argv: string[]) => Promise<void>;
|
|
85
|
+
restart: () => Promise<boolean>;
|
|
86
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NormalizedConfig } from './config/mergeConfig';
|
|
2
|
+
import { LoadedConfig } from './config';
|
|
3
|
+
import { HooksRunner } from '.';
|
|
4
|
+
export declare const initWatcher: (loaded: LoadedConfig, appDirectory: string, resovledConfig: NormalizedConfig, hooksRunner: HooksRunner, argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadEnv: (appDirectory: string, mode?: string) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface PluginConfigItem {
|
|
2
|
+
cli?: string;
|
|
3
|
+
server?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare type PluginConfig = Array<PluginConfigItem>;
|
|
6
|
+
/**
|
|
7
|
+
* Load internal plugins which in @modern-js scope and user's custom plugins.
|
|
8
|
+
* @param appDirectory - Application root directory.
|
|
9
|
+
* @param pluginsConfig - Plugins declared in the user configuration.
|
|
10
|
+
* @returns Plugin Objects has been required.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export declare const loadPlugins: (appDirectory: string, pluginConfig: PluginConfig) => {
|
|
14
|
+
cli: any;
|
|
15
|
+
server: any;
|
|
16
|
+
}[];
|
package/modern.config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @type {import('@modern-js/module-tools').UserConfig} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
output: {
|
|
4
|
+
disableSourceMap: true,
|
|
5
|
+
},
|
|
6
|
+
testing: {
|
|
7
|
+
jest: {
|
|
8
|
+
collectCoverage: true,
|
|
9
|
+
collectCoverageFrom: ['src/**/*.ts'],
|
|
10
|
+
coveragePathIgnorePatterns: ['/node_modules/'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@modern-js/core",
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
|
+
"jsnext:source": "./src/index.ts",
|
|
5
|
+
"types": "./dist/types/index.d.ts",
|
|
6
|
+
"main": "./dist/js/node/index.js",
|
|
7
|
+
"module": "./dist/js/treeshaking/index.js",
|
|
8
|
+
"jsnext:modern": "./dist/js/modern/index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"node": {
|
|
12
|
+
"import": "./dist/js/modern/index.js",
|
|
13
|
+
"require": "./dist/js/node/index.js"
|
|
14
|
+
},
|
|
15
|
+
"default": "./dist/js/treeshaking/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./bin": "./bin/modern-js.js"
|
|
18
|
+
},
|
|
19
|
+
"typesVersions": {
|
|
20
|
+
"*": {
|
|
21
|
+
"config": [
|
|
22
|
+
"./dist/types/config/index.d.ts"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"bin": "./bin/modern-js.js",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@babel/runtime": "^7",
|
|
29
|
+
"@babel/code-frame": "^7.14.5",
|
|
30
|
+
"@modern-js/load-config": "^1.0.0-alpha.3",
|
|
31
|
+
"@modern-js/plugin": "^1.0.0-alpha.3",
|
|
32
|
+
"@modern-js/utils": "^1.0.0-alpha.3",
|
|
33
|
+
"address": "^1.1.2",
|
|
34
|
+
"ajv": "^8.6.2",
|
|
35
|
+
"ajv-keywords": "^5.0.0",
|
|
36
|
+
"better-ajv-errors": "^0.7.0",
|
|
37
|
+
"chokidar": "^3.5.2",
|
|
38
|
+
"commander": "^8.1.0",
|
|
39
|
+
"dotenv": "^10.0.0",
|
|
40
|
+
"dotenv-expand": "^5.1.0",
|
|
41
|
+
"lodash.clonedeep": "^4.5.0",
|
|
42
|
+
"lodash.mergewith": "^4.6.2",
|
|
43
|
+
"minimist": "^1.2.5",
|
|
44
|
+
"signale": "^1.4.0",
|
|
45
|
+
"v8-compile-cache": "^2.3.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/babel__code-frame": "^7.0.3",
|
|
49
|
+
"@modern-js/types": "^1.0.0-alpha.3",
|
|
50
|
+
"@types/jest": "^26",
|
|
51
|
+
"@types/lodash.clonedeep": "^4.5.6",
|
|
52
|
+
"@types/lodash.mergewith": "^4.6.6",
|
|
53
|
+
"@types/node": "^14",
|
|
54
|
+
"@types/react": "^17",
|
|
55
|
+
"@types/react-dom": "^17",
|
|
56
|
+
"@types/signale": "^1.4.2",
|
|
57
|
+
"typescript": "^4",
|
|
58
|
+
"@modern-js/plugin-testing": "^1.0.0-alpha.3",
|
|
59
|
+
"@modern-js/module-tools": "^1.0.0-alpha.3"
|
|
60
|
+
},
|
|
61
|
+
"sideEffects": false,
|
|
62
|
+
"modernConfig": {
|
|
63
|
+
"output": {
|
|
64
|
+
"packageMode": "node-js"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"new": "modern new",
|
|
69
|
+
"build": "modern build",
|
|
70
|
+
"dev": "modern build --watch",
|
|
71
|
+
"test": "modern test --passWithNoTests"
|
|
72
|
+
}
|
|
73
|
+
}
|