@modern-js/core 0.0.0-windows-202110385642 → 0.0.1-20221226

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.
Files changed (130) hide show
  1. package/CHANGELOG.md +1164 -6
  2. package/dist/bin.d.ts +2 -0
  3. package/dist/bin.js +5 -0
  4. package/dist/config/createDefaultConfig.d.ts +2 -0
  5. package/dist/config/createDefaultConfig.js +9 -0
  6. package/dist/config/createLoadedConfig.d.ts +6 -0
  7. package/dist/config/createLoadedConfig.js +35 -0
  8. package/dist/config/createResolvedConfig.d.ts +3 -0
  9. package/dist/config/createResolvedConfig.js +92 -0
  10. package/dist/config/index.d.ts +3 -0
  11. package/dist/config/index.js +19 -0
  12. package/dist/context.d.ts +35 -0
  13. package/dist/context.js +61 -0
  14. package/dist/index.d.ts +73 -0
  15. package/dist/index.js +150 -0
  16. package/dist/load-configs/index.d.ts +34 -0
  17. package/dist/load-configs/index.js +124 -0
  18. package/dist/{types/loadEnv.d.ts → loadEnv.d.ts} +1 -1
  19. package/dist/loadEnv.js +21 -0
  20. package/dist/loadPlugins.d.ts +18 -0
  21. package/dist/loadPlugins.js +65 -0
  22. package/dist/manager.d.ts +87 -0
  23. package/dist/manager.js +24 -0
  24. package/dist/runBin.d.ts +5 -0
  25. package/dist/runBin.js +51 -0
  26. package/dist/schema/patchSchema.d.ts +19 -0
  27. package/dist/schema/patchSchema.js +57 -0
  28. package/dist/schema/source.d.ts +9 -0
  29. package/dist/schema/source.js +10 -0
  30. package/dist/schema/testing.d.ts +13 -0
  31. package/dist/schema/testing.js +11 -0
  32. package/dist/schema/traverseSchema.d.ts +2 -0
  33. package/dist/schema/traverseSchema.js +20 -0
  34. package/dist/types/config/index.d.ts +49 -125
  35. package/dist/types/config/index.js +2 -0
  36. package/dist/types/config/testing.d.ts +15 -0
  37. package/dist/types/config/testing.js +2 -0
  38. package/dist/types/context.d.ts +28 -14
  39. package/dist/types/context.js +2 -0
  40. package/dist/types/hooks.d.ts +44 -0
  41. package/dist/types/hooks.js +2 -0
  42. package/dist/types/index.d.ts +9 -87
  43. package/dist/types/index.js +21 -0
  44. package/dist/types/plugin.d.ts +26 -0
  45. package/dist/types/plugin.js +2 -0
  46. package/dist/types/pluginAPI.d.ts +18 -0
  47. package/dist/types/pluginAPI.js +2 -0
  48. package/dist/utils/commander.d.ts +4 -0
  49. package/dist/utils/commander.js +20 -0
  50. package/dist/utils/mergeConfig.d.ts +2 -0
  51. package/dist/utils/mergeConfig.js +32 -0
  52. package/dist/utils/repeatKeyWarning.d.ts +3 -0
  53. package/dist/utils/repeatKeyWarning.js +22 -0
  54. package/package.json +52 -48
  55. package/bin/modern-js.js +0 -18
  56. package/dist/js/modern/config/defaults.js +0 -100
  57. package/dist/js/modern/config/index.js +0 -104
  58. package/dist/js/modern/config/mergeConfig.js +0 -20
  59. package/dist/js/modern/config/schema/deploy.js +0 -20
  60. package/dist/js/modern/config/schema/index.js +0 -107
  61. package/dist/js/modern/config/schema/output.js +0 -147
  62. package/dist/js/modern/config/schema/server.js +0 -170
  63. package/dist/js/modern/config/schema/source.js +0 -59
  64. package/dist/js/modern/config/schema/tools.js +0 -33
  65. package/dist/js/modern/context.js +0 -25
  66. package/dist/js/modern/index.js +0 -142
  67. package/dist/js/modern/initWatcher.js +0 -46
  68. package/dist/js/modern/loadEnv.js +0 -12
  69. package/dist/js/modern/loadPlugins.js +0 -66
  70. package/dist/js/modern/utils/commander.js +0 -19
  71. package/dist/js/modern/utils/repeatKeyWarning.js +0 -18
  72. package/dist/js/node/config/defaults.js +0 -107
  73. package/dist/js/node/config/index.js +0 -142
  74. package/dist/js/node/config/mergeConfig.js +0 -32
  75. package/dist/js/node/config/schema/deploy.js +0 -29
  76. package/dist/js/node/config/schema/index.js +0 -129
  77. package/dist/js/node/config/schema/output.js +0 -156
  78. package/dist/js/node/config/schema/server.js +0 -179
  79. package/dist/js/node/config/schema/source.js +0 -68
  80. package/dist/js/node/config/schema/tools.js +0 -40
  81. package/dist/js/node/context.js +0 -52
  82. package/dist/js/node/index.js +0 -247
  83. package/dist/js/node/initWatcher.js +0 -67
  84. package/dist/js/node/loadEnv.js +0 -28
  85. package/dist/js/node/loadPlugins.js +0 -76
  86. package/dist/js/node/utils/commander.js +0 -35
  87. package/dist/js/node/utils/repeatKeyWarning.js +0 -31
  88. package/dist/types/config/defaults.d.ts +0 -25
  89. package/dist/types/config/mergeConfig.d.ts +0 -29
  90. package/dist/types/config/schema/deploy.d.ts +0 -19
  91. package/dist/types/config/schema/index.d.ts +0 -466
  92. package/dist/types/config/schema/output.d.ts +0 -146
  93. package/dist/types/config/schema/server.d.ts +0 -182
  94. package/dist/types/config/schema/source.d.ts +0 -58
  95. package/dist/types/config/schema/tools.d.ts +0 -33
  96. package/dist/types/initWatcher.d.ts +0 -3
  97. package/dist/types/loadPlugins.d.ts +0 -16
  98. package/dist/types/utils/commander.d.ts +0 -7
  99. package/dist/types/utils/repeatKeyWarning.d.ts +0 -3
  100. package/modern.config.js +0 -13
  101. package/src/config/defaults.ts +0 -101
  102. package/src/config/index.ts +0 -296
  103. package/src/config/mergeConfig.ts +0 -68
  104. package/src/config/schema/deploy.ts +0 -17
  105. package/src/config/schema/index.ts +0 -116
  106. package/src/config/schema/output.ts +0 -66
  107. package/src/config/schema/server.ts +0 -106
  108. package/src/config/schema/source.ts +0 -34
  109. package/src/config/schema/tools.ts +0 -15
  110. package/src/context.ts +0 -46
  111. package/src/index.ts +0 -247
  112. package/src/initWatcher.ts +0 -77
  113. package/src/loadEnv.ts +0 -21
  114. package/src/loadPlugins.ts +0 -81
  115. package/src/types.d.ts +0 -0
  116. package/src/utils/commander.ts +0 -22
  117. package/src/utils/repeatKeyWarning.ts +0 -29
  118. package/tests/.eslintrc.js +0 -6
  119. package/tests/fixtures/load-plugin/not-found/package.json +0 -3
  120. package/tests/fixtures/load-plugin/not-found/test-plugin-a.js +0 -1
  121. package/tests/fixtures/load-plugin/user-plugins/package.json +0 -3
  122. package/tests/fixtures/load-plugin/user-plugins/test-plugin-a.js +0 -1
  123. package/tests/fixtures/load-plugin/user-plugins/test-plugin-b.js +0 -3
  124. package/tests/loadEnv.test.ts +0 -100
  125. package/tests/loadPlugin.test.ts +0 -29
  126. package/tests/mergeConfig.test.ts +0 -78
  127. package/tests/repeatKeyWarning.test.ts +0 -68
  128. package/tests/schema.test.ts +0 -109
  129. package/tests/tsconfig.json +0 -13
  130. package/tsconfig.json +0 -14
@@ -1,29 +0,0 @@
1
- import { UserConfig, SourceConfig, ToolsConfig } from '.';
2
- export interface NormalizedSourceConfig extends Omit<SourceConfig, 'alias' | 'moduleScopes'> {
3
- alias: SourceConfig['alias'] | Array<SourceConfig['alias']>;
4
- moduleScopes: SourceConfig['moduleScopes'] | Array<SourceConfig['moduleScopes']>;
5
- }
6
- export interface NormalizedToolsConfig extends Omit<ToolsConfig, 'webpack' | 'babel' | 'postcss' | 'autoprefixer' | 'lodash' | 'tsLoader' | 'terser' | 'minifyCss' | 'esbuild'> {
7
- webpack: ToolsConfig['webpack'] | Array<NonNullable<ToolsConfig['webpack']>>;
8
- babel: ToolsConfig['babel'] | Array<NonNullable<ToolsConfig['babel']>>;
9
- postcss: ToolsConfig['postcss'] | Array<NonNullable<ToolsConfig['postcss']>>;
10
- autoprefixer: ToolsConfig['autoprefixer'] | Array<NonNullable<ToolsConfig['autoprefixer']>>;
11
- lodash: ToolsConfig['lodash'] | Array<ToolsConfig['lodash']>;
12
- tsLoader: ToolsConfig['tsLoader'] | Array<NonNullable<ToolsConfig['tsLoader']>>;
13
- terser: ToolsConfig['terser'] | Array<NonNullable<ToolsConfig['terser']>>;
14
- minifyCss: ToolsConfig['minifyCss'] | Array<NonNullable<ToolsConfig['minifyCss']>>;
15
- esbuild: ToolsConfig['esbuild'] | Array<NonNullable<ToolsConfig['esbuild']>>;
16
- }
17
- export interface NormalizedConfig extends Omit<Required<UserConfig>, 'source' | 'tools'> {
18
- source: NormalizedSourceConfig;
19
- tools: NormalizedToolsConfig;
20
- _raw: UserConfig;
21
- }
22
- /**
23
- * merge configuration from modern.config.js and plugins.
24
- *
25
- * @param configs - Configuration from modern.config.ts or plugin's config hook.
26
- * @returns - normalized user config.
27
- */
28
-
29
- export declare const mergeConfig: (configs: Array<UserConfig | NormalizedConfig>) => NormalizedConfig;
@@ -1,19 +0,0 @@
1
- export declare const deploy: {
2
- type: string;
3
- properties: {
4
- microFrontend: {
5
- type: string[];
6
- };
7
- domain: {
8
- type: string[];
9
- };
10
- domainByEntries: {
11
- type: string;
12
- patternProperties: {
13
- "^[a-zA-Z0-9_-]+$": {
14
- type: string[];
15
- };
16
- };
17
- };
18
- };
19
- };
@@ -1,466 +0,0 @@
1
- import { JSONSchemaType } from 'ajv';
2
- export interface PluginValidateSchema {
3
- target: string;
4
- schema: JSONSchemaType<any>;
5
- }
6
- export declare const patchSchema: (pluginSchemas: Array<PluginValidateSchema | PluginValidateSchema[]>) => {
7
- type: string;
8
- additionalProperties: boolean;
9
- properties: {
10
- source: {
11
- type: string;
12
- additionalProperties: boolean;
13
- properties: {
14
- entries: {
15
- type: string;
16
- patternProperties: {
17
- "^[a-zA-Z0-9_-]+$": {
18
- if: {
19
- type: string;
20
- };
21
- then: {
22
- required: string[];
23
- properties: {
24
- entry: {
25
- type: string[];
26
- };
27
- disableMount: {
28
- type: string;
29
- };
30
- enableFileSystemRoutes: {
31
- type: string;
32
- };
33
- };
34
- additionalProperties: boolean;
35
- };
36
- else: {
37
- type: string[];
38
- };
39
- };
40
- };
41
- };
42
- alias: {
43
- typeof: string[];
44
- };
45
- disableDefaultEntries: {
46
- type: string;
47
- };
48
- envVars: {
49
- type: string;
50
- };
51
- globalVars: {
52
- type: string;
53
- };
54
- moduleScopes: {
55
- instanceof: string[];
56
- };
57
- entriesDir: {
58
- type: string;
59
- };
60
- configDir: {
61
- type: string;
62
- };
63
- include: {
64
- type: string[];
65
- };
66
- };
67
- };
68
- output: {
69
- type: string;
70
- additionalProperties: boolean;
71
- properties: {
72
- assetPrefix: {
73
- type: string;
74
- };
75
- path: {
76
- type: string;
77
- };
78
- jsPath: {
79
- type: string;
80
- };
81
- cssPath: {
82
- type: string;
83
- };
84
- htmlPath: {
85
- type: string;
86
- };
87
- mediaPath: {
88
- type: string;
89
- };
90
- mountId: {
91
- type: string;
92
- };
93
- favicon: {
94
- type: string;
95
- };
96
- faviconByEntries: {
97
- type: string;
98
- patternProperties: {
99
- "^[a-zA-Z0-9_-]+$": {
100
- type: string;
101
- };
102
- };
103
- };
104
- title: {
105
- type: string;
106
- };
107
- titleByEntries: {
108
- type: string;
109
- patternProperties: {
110
- "^[a-zA-Z0-9_-]+$": {
111
- type: string;
112
- };
113
- };
114
- };
115
- meta: {
116
- type: string;
117
- };
118
- metaByEntries: {
119
- type: string;
120
- patternProperties: {
121
- "^[a-zA-Z0-9_-]+$": {
122
- type: string;
123
- };
124
- };
125
- };
126
- inject: {
127
- enum: (string | boolean)[];
128
- };
129
- injectByEntries: {
130
- type: string;
131
- patternProperties: {
132
- "^[a-zA-Z0-9_-]+$": {
133
- enum: (string | boolean)[];
134
- };
135
- };
136
- };
137
- copy: {
138
- type: string;
139
- };
140
- scriptExt: {
141
- type: string;
142
- };
143
- disableHtmlFolder: {
144
- type: string;
145
- };
146
- disableCssModuleExtension: {
147
- type: string;
148
- };
149
- disableCssExtract: {
150
- type: string;
151
- };
152
- enableCssModuleTSDeclaration: {
153
- type: string;
154
- };
155
- disableMinimize: {
156
- type: string;
157
- };
158
- enableInlineStyles: {
159
- type: string;
160
- };
161
- enableInlineScripts: {
162
- type: string;
163
- };
164
- disableSourceMap: {
165
- type: string;
166
- };
167
- disableInlineRuntimeChunk: {
168
- type: string;
169
- };
170
- disableAssetsCache: {
171
- type: string;
172
- };
173
- enableLatestDecorators: {
174
- type: string;
175
- };
176
- enableUsageBuiltIns: {
177
- type: string;
178
- };
179
- enableTsLoader: {
180
- type: string;
181
- };
182
- dataUriLimit: {
183
- type: string;
184
- };
185
- templateParameters: {
186
- type: string;
187
- };
188
- templateParametersByEntries: {
189
- type: string;
190
- patternProperties: {
191
- "^[a-zA-Z0-9_-]+$": {
192
- type: string;
193
- };
194
- };
195
- };
196
- polyfill: {
197
- type: string;
198
- enum: string[];
199
- };
200
- cssModuleLocalIdentName: {
201
- type: string;
202
- };
203
- federation: {
204
- type: string;
205
- };
206
- disableNodePolyfill: {
207
- type: string;
208
- };
209
- enableModernMode: {
210
- type: string;
211
- };
212
- };
213
- };
214
- server: {
215
- type: string;
216
- additionalProperties: boolean;
217
- properties: {
218
- port: {
219
- type: string;
220
- };
221
- ssr: {
222
- if: {
223
- type: string;
224
- };
225
- then: {
226
- properties: {
227
- disableLoadable: {
228
- type: string;
229
- };
230
- disableHelmet: {
231
- type: string;
232
- };
233
- disableRedirect: {
234
- type: string;
235
- };
236
- enableAsyncData: {
237
- type: string;
238
- };
239
- enableProductWarning: {
240
- type: string;
241
- };
242
- timeout: {
243
- type: string;
244
- };
245
- asyncDataTimeout: {
246
- type: string;
247
- };
248
- };
249
- };
250
- else: {
251
- type: string;
252
- };
253
- };
254
- ssrByEntries: {
255
- type: string;
256
- patternProperties: {
257
- "^[a-zA-Z0-9_-]+$": {
258
- if: {
259
- type: string;
260
- };
261
- then: {
262
- properties: {
263
- disableLoadable: {
264
- type: string;
265
- };
266
- disableHelmet: {
267
- type: string;
268
- };
269
- disableRedirect: {
270
- type: string;
271
- };
272
- enableProductWarning: {
273
- type: string;
274
- };
275
- enableAsyncData: {
276
- type: string;
277
- };
278
- timeout: {
279
- type: string;
280
- };
281
- asyncDataTimeout: {
282
- type: string;
283
- };
284
- };
285
- additionalProperties: boolean;
286
- };
287
- else: {
288
- type: string;
289
- };
290
- };
291
- };
292
- };
293
- routes: {
294
- type: string;
295
- patternProperties: {
296
- "^[a-zA-Z0-9_-]+$": {
297
- if: {
298
- type: string;
299
- };
300
- then: {
301
- properties: {
302
- route: {
303
- oneOf: ({
304
- type: string;
305
- properties: {
306
- path: {
307
- type: string;
308
- };
309
- headers: {
310
- type: string;
311
- };
312
- };
313
- additionalProperties: boolean;
314
- } | {
315
- type: string;
316
- items?: undefined;
317
- } | {
318
- type: string;
319
- items: {
320
- oneOf: ({
321
- type: string;
322
- properties: {
323
- path: {
324
- type: string;
325
- };
326
- headers: {
327
- type: string;
328
- };
329
- };
330
- additionalProperties: boolean;
331
- } | {
332
- type: string;
333
- })[];
334
- };
335
- })[];
336
- };
337
- disableSpa: {
338
- type: string;
339
- };
340
- };
341
- additionalProperties: boolean;
342
- };
343
- else: {
344
- oneOf: ({
345
- type: string;
346
- items?: undefined;
347
- } | {
348
- type: string;
349
- items: {
350
- type: string;
351
- };
352
- })[];
353
- };
354
- };
355
- };
356
- };
357
- publicRoutes: {
358
- type: string;
359
- patternProperties: {
360
- "^[a-zA-Z0-9_-]+$": {
361
- type: string[];
362
- };
363
- };
364
- };
365
- baseUrl: {
366
- oneOf: ({
367
- type: string;
368
- items?: undefined;
369
- } | {
370
- type: string;
371
- items: {
372
- type: string;
373
- }[];
374
- })[];
375
- };
376
- middleware: {
377
- instanceof: string[];
378
- };
379
- renderHook: {
380
- instanceof: string;
381
- };
382
- logger: {
383
- type: string;
384
- };
385
- measure: {
386
- type: string;
387
- };
388
- proxy: {
389
- type: string;
390
- };
391
- enableMicroFrontendDebug: {
392
- type: string;
393
- };
394
- };
395
- };
396
- deploy: {
397
- type: string;
398
- properties: {
399
- microFrontend: {
400
- type: string[];
401
- };
402
- domain: {
403
- type: string[];
404
- };
405
- domainByEntries: {
406
- type: string;
407
- patternProperties: {
408
- "^[a-zA-Z0-9_-]+$": {
409
- type: string[];
410
- };
411
- };
412
- };
413
- };
414
- };
415
- plugins: {
416
- type: string;
417
- additionalProperties: boolean;
418
- };
419
- dev: {
420
- type: string;
421
- properties: {
422
- assetPrefix: {
423
- type: string[];
424
- };
425
- https: {
426
- type: string;
427
- };
428
- };
429
- additionalProperties: boolean;
430
- };
431
- tools: {
432
- type: string;
433
- additionalProperties: boolean;
434
- properties: {
435
- webpack: {
436
- typeof: string[];
437
- };
438
- babel: {
439
- typeof: string[];
440
- };
441
- postcss: {
442
- typeof: string[];
443
- };
444
- lodash: {
445
- typeof: string[];
446
- };
447
- devServer: {
448
- type: string;
449
- };
450
- tsLoader: {
451
- typeof: string[];
452
- };
453
- autoprefixer: {
454
- typeof: string[];
455
- };
456
- terser: {
457
- typeof: string[];
458
- };
459
- minifyCss: {
460
- typeof: string[];
461
- };
462
- };
463
- };
464
- };
465
- };
466
- export declare const traverseSchema: (schema: ReturnType<typeof patchSchema>) => string[];
@@ -1,146 +0,0 @@
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
- };