@modern-js/core 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/.eslintrc.js +1 -0
  2. package/CHANGELOG.md +22 -0
  3. package/bin/modern-js.js +1 -1
  4. package/compiled/ajv/codegen.js +1 -0
  5. package/compiled/ajv/dist/ajv.d.ts +16 -0
  6. package/compiled/ajv/dist/compile/codegen/code.d.ts +40 -0
  7. package/compiled/ajv/dist/compile/codegen/index.d.ts +79 -0
  8. package/compiled/ajv/dist/compile/codegen/scope.d.ts +79 -0
  9. package/compiled/ajv/dist/compile/errors.d.ts +13 -0
  10. package/compiled/ajv/dist/compile/index.d.ts +80 -0
  11. package/compiled/ajv/dist/compile/ref_error.d.ts +6 -0
  12. package/compiled/ajv/dist/compile/resolve.d.ts +12 -0
  13. package/compiled/ajv/dist/compile/rules.d.ts +28 -0
  14. package/compiled/ajv/dist/compile/util.d.ts +40 -0
  15. package/compiled/ajv/dist/compile/validate/index.d.ts +42 -0
  16. package/compiled/ajv/dist/compile/validate/subschema.d.ts +47 -0
  17. package/compiled/ajv/dist/core.d.ts +173 -0
  18. package/compiled/ajv/dist/runtime/validation_error.d.ts +7 -0
  19. package/compiled/ajv/dist/types/index.d.ts +183 -0
  20. package/compiled/ajv/dist/types/json-schema.d.ts +124 -0
  21. package/compiled/ajv/dist/types/jtd-schema.d.ts +169 -0
  22. package/compiled/ajv/index.js +9 -0
  23. package/compiled/ajv/license +22 -0
  24. package/compiled/ajv/package.json +1 -0
  25. package/compiled/ajv/uri-js/dist/es5/uri.all.d.ts +59 -0
  26. package/compiled/ajv-keywords/ajv/dist/ajv.d.ts +16 -0
  27. package/compiled/ajv-keywords/ajv/dist/compile/codegen/code.d.ts +40 -0
  28. package/compiled/ajv-keywords/ajv/dist/compile/codegen/index.d.ts +79 -0
  29. package/compiled/ajv-keywords/ajv/dist/compile/codegen/scope.d.ts +79 -0
  30. package/compiled/ajv-keywords/ajv/dist/compile/errors.d.ts +13 -0
  31. package/compiled/ajv-keywords/ajv/dist/compile/index.d.ts +80 -0
  32. package/compiled/ajv-keywords/ajv/dist/compile/ref_error.d.ts +6 -0
  33. package/compiled/ajv-keywords/ajv/dist/compile/resolve.d.ts +12 -0
  34. package/compiled/ajv-keywords/ajv/dist/compile/rules.d.ts +28 -0
  35. package/compiled/ajv-keywords/ajv/dist/compile/util.d.ts +40 -0
  36. package/compiled/ajv-keywords/ajv/dist/compile/validate/index.d.ts +42 -0
  37. package/compiled/ajv-keywords/ajv/dist/compile/validate/subschema.d.ts +47 -0
  38. package/compiled/ajv-keywords/ajv/dist/core.d.ts +173 -0
  39. package/compiled/ajv-keywords/ajv/dist/runtime/validation_error.d.ts +7 -0
  40. package/compiled/ajv-keywords/ajv/dist/types/index.d.ts +183 -0
  41. package/compiled/ajv-keywords/ajv/dist/types/json-schema.d.ts +124 -0
  42. package/compiled/ajv-keywords/ajv/dist/types/jtd-schema.d.ts +169 -0
  43. package/compiled/ajv-keywords/dist/index.d.ts +4 -0
  44. package/compiled/ajv-keywords/index.js +1 -0
  45. package/compiled/ajv-keywords/license +21 -0
  46. package/compiled/ajv-keywords/package.json +1 -0
  47. package/compiled/ajv-keywords/uri-js/dist/es5/uri.all.d.ts +59 -0
  48. package/compiled/better-ajv-errors/ajv/dist/ajv.d.ts +16 -0
  49. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/code.d.ts +40 -0
  50. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/index.d.ts +79 -0
  51. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/scope.d.ts +79 -0
  52. package/compiled/better-ajv-errors/ajv/dist/compile/errors.d.ts +13 -0
  53. package/compiled/better-ajv-errors/ajv/dist/compile/index.d.ts +80 -0
  54. package/compiled/better-ajv-errors/ajv/dist/compile/ref_error.d.ts +6 -0
  55. package/compiled/better-ajv-errors/ajv/dist/compile/resolve.d.ts +12 -0
  56. package/compiled/better-ajv-errors/ajv/dist/compile/rules.d.ts +28 -0
  57. package/compiled/better-ajv-errors/ajv/dist/compile/util.d.ts +40 -0
  58. package/compiled/better-ajv-errors/ajv/dist/compile/validate/index.d.ts +42 -0
  59. package/compiled/better-ajv-errors/ajv/dist/compile/validate/subschema.d.ts +47 -0
  60. package/compiled/better-ajv-errors/ajv/dist/core.d.ts +173 -0
  61. package/compiled/better-ajv-errors/ajv/dist/runtime/validation_error.d.ts +7 -0
  62. package/compiled/better-ajv-errors/ajv/dist/types/index.d.ts +183 -0
  63. package/compiled/better-ajv-errors/ajv/dist/types/json-schema.d.ts +124 -0
  64. package/compiled/better-ajv-errors/ajv/dist/types/jtd-schema.d.ts +169 -0
  65. package/compiled/better-ajv-errors/index.js +1 -0
  66. package/compiled/better-ajv-errors/license +13 -0
  67. package/compiled/better-ajv-errors/package.json +1 -0
  68. package/compiled/better-ajv-errors/typings.d.ts +24 -0
  69. package/compiled/better-ajv-errors/uri-js/dist/es5/uri.all.d.ts +59 -0
  70. package/compiled/v8-compile-cache/index.js +1 -0
  71. package/compiled/v8-compile-cache/license +21 -0
  72. package/compiled/v8-compile-cache/package.json +1 -0
  73. package/dist/cli.d.ts +1 -0
  74. package/dist/cli.js +33 -0
  75. package/dist/config/defaults.d.ts +28 -0
  76. package/dist/config/defaults.js +98 -0
  77. package/dist/{types/config → config}/index.d.ts +2 -2
  78. package/dist/config/index.js +120 -0
  79. package/dist/config/mergeConfig.d.ts +30 -0
  80. package/dist/config/mergeConfig.js +26 -0
  81. package/dist/config/schema/deploy.d.ts +16 -0
  82. package/dist/config/schema/deploy.js +16 -0
  83. package/dist/config/schema/index.d.ts +466 -0
  84. package/dist/config/schema/index.js +95 -0
  85. package/dist/config/schema/output.d.ts +146 -0
  86. package/dist/config/schema/output.js +68 -0
  87. package/dist/config/schema/server.d.ts +182 -0
  88. package/dist/config/schema/server.js +107 -0
  89. package/dist/config/schema/source.d.ts +58 -0
  90. package/dist/config/schema/source.js +36 -0
  91. package/dist/config/schema/tools.d.ts +36 -0
  92. package/dist/config/schema/tools.js +19 -0
  93. package/dist/config/types/electron.d.ts +13 -0
  94. package/dist/config/types/electron.js +2 -0
  95. package/dist/config/types/index.d.ts +240 -0
  96. package/dist/config/types/index.js +2 -0
  97. package/dist/config/types/less.d.ts +10 -0
  98. package/dist/config/types/less.js +2 -0
  99. package/dist/config/types/sass.d.ts +8 -0
  100. package/dist/config/types/sass.js +2 -0
  101. package/dist/{types/config → config}/types/ssg.d.ts +8 -8
  102. package/dist/config/types/ssg.js +2 -0
  103. package/dist/config/types/test.d.ts +14 -0
  104. package/dist/config/types/test.js +2 -0
  105. package/dist/config/types/unbundle.d.ts +25 -0
  106. package/dist/config/types/unbundle.js +2 -0
  107. package/dist/{types/context.d.ts → context.d.ts} +12 -22
  108. package/dist/context.js +59 -0
  109. package/dist/index.d.ts +64 -0
  110. package/dist/index.js +177 -0
  111. package/dist/{types/initWatcher.d.ts → initWatcher.d.ts} +1 -1
  112. package/dist/initWatcher.js +75 -0
  113. package/dist/{types/loadEnv.d.ts → loadEnv.d.ts} +1 -1
  114. package/dist/loadEnv.js +21 -0
  115. package/dist/{types/loadPlugins.d.ts → loadPlugins.d.ts} +13 -16
  116. package/dist/loadPlugins.js +109 -0
  117. package/dist/manager.d.ts +72 -0
  118. package/dist/manager.js +24 -0
  119. package/dist/{types/pluginAPI.d.ts → pluginAPI.d.ts} +5 -6
  120. package/dist/pluginAPI.js +16 -0
  121. package/dist/{types/utils → utils}/commander.d.ts +1 -1
  122. package/dist/utils/commander.js +20 -0
  123. package/dist/{types/utils → utils}/repeatKeyWarning.d.ts +1 -1
  124. package/dist/utils/repeatKeyWarning.js +22 -0
  125. package/package.json +12 -26
  126. package/tsconfig.json +3 -4
  127. package/dist/js/modern/cli.js +0 -29
  128. package/dist/js/modern/config/defaults.js +0 -103
  129. package/dist/js/modern/config/index.js +0 -115
  130. package/dist/js/modern/config/mergeConfig.js +0 -22
  131. package/dist/js/modern/config/schema/deploy.js +0 -17
  132. package/dist/js/modern/config/schema/index.js +0 -107
  133. package/dist/js/modern/config/schema/output.js +0 -147
  134. package/dist/js/modern/config/schema/server.js +0 -170
  135. package/dist/js/modern/config/schema/source.js +0 -59
  136. package/dist/js/modern/config/schema/tools.js +0 -36
  137. package/dist/js/modern/config/types/electron.js +0 -1
  138. package/dist/js/modern/config/types/index.js +0 -1
  139. package/dist/js/modern/config/types/less.js +0 -0
  140. package/dist/js/modern/config/types/sass.js +0 -0
  141. package/dist/js/modern/config/types/ssg.js +0 -0
  142. package/dist/js/modern/config/types/test.js +0 -0
  143. package/dist/js/modern/config/types/unbundle.js +0 -0
  144. package/dist/js/modern/context.js +0 -63
  145. package/dist/js/modern/index.js +0 -169
  146. package/dist/js/modern/initWatcher.js +0 -62
  147. package/dist/js/modern/loadEnv.js +0 -14
  148. package/dist/js/modern/loadPlugins.js +0 -122
  149. package/dist/js/modern/manager.js +0 -28
  150. package/dist/js/modern/pluginAPI.js +0 -11
  151. package/dist/js/modern/utils/commander.js +0 -19
  152. package/dist/js/modern/utils/repeatKeyWarning.js +0 -18
  153. package/dist/js/node/cli.js +0 -35
  154. package/dist/js/node/config/defaults.js +0 -110
  155. package/dist/js/node/config/index.js +0 -182
  156. package/dist/js/node/config/mergeConfig.js +0 -32
  157. package/dist/js/node/config/schema/deploy.js +0 -26
  158. package/dist/js/node/config/schema/index.js +0 -127
  159. package/dist/js/node/config/schema/output.js +0 -156
  160. package/dist/js/node/config/schema/server.js +0 -179
  161. package/dist/js/node/config/schema/source.js +0 -68
  162. package/dist/js/node/config/schema/tools.js +0 -43
  163. package/dist/js/node/config/types/electron.js +0 -5
  164. package/dist/js/node/config/types/index.js +0 -5
  165. package/dist/js/node/config/types/less.js +0 -0
  166. package/dist/js/node/config/types/sass.js +0 -0
  167. package/dist/js/node/config/types/ssg.js +0 -0
  168. package/dist/js/node/config/types/test.js +0 -0
  169. package/dist/js/node/config/types/unbundle.js +0 -0
  170. package/dist/js/node/context.js +0 -93
  171. package/dist/js/node/index.js +0 -329
  172. package/dist/js/node/initWatcher.js +0 -82
  173. package/dist/js/node/loadEnv.js +0 -30
  174. package/dist/js/node/loadPlugins.js +0 -134
  175. package/dist/js/node/manager.js +0 -45
  176. package/dist/js/node/pluginAPI.js +0 -54
  177. package/dist/js/node/utils/commander.js +0 -32
  178. package/dist/js/node/utils/repeatKeyWarning.js +0 -31
  179. package/dist/types/cli.d.ts +0 -1
  180. package/dist/types/config/defaults.d.ts +0 -28
  181. package/dist/types/config/mergeConfig.d.ts +0 -31
  182. package/dist/types/config/schema/deploy.d.ts +0 -16
  183. package/dist/types/config/schema/index.d.ts +0 -466
  184. package/dist/types/config/schema/output.d.ts +0 -146
  185. package/dist/types/config/schema/server.d.ts +0 -182
  186. package/dist/types/config/schema/source.d.ts +0 -58
  187. package/dist/types/config/schema/tools.d.ts +0 -36
  188. package/dist/types/config/types/electron.d.ts +0 -13
  189. package/dist/types/config/types/index.d.ts +0 -252
  190. package/dist/types/config/types/less.d.ts +0 -10
  191. package/dist/types/config/types/sass.d.ts +0 -8
  192. package/dist/types/config/types/test.d.ts +0 -15
  193. package/dist/types/config/types/unbundle.d.ts +0 -28
  194. package/dist/types/index.d.ts +0 -64
  195. package/dist/types/manager.d.ts +0 -75
  196. package/modern.config.js +0 -6
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.traverseSchema = exports.patchSchema = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- var _lodash = require("@modern-js/utils/lodash");
11
-
12
- var _source = require("./source");
13
-
14
- var _output = require("./output");
15
-
16
- var _server = require("./server");
17
-
18
- var _deploy = require("./deploy");
19
-
20
- var _tools = require("./tools");
21
-
22
- const debug = (0, _utils.createDebugger)('validate-schema');
23
- const plugins = {
24
- type: 'array',
25
- additionalProperties: false
26
- };
27
- const dev = {
28
- type: 'object',
29
- properties: {
30
- assetPrefix: {
31
- type: ['boolean', 'string']
32
- },
33
- https: {
34
- type: 'boolean'
35
- }
36
- },
37
- additionalProperties: false
38
- };
39
-
40
- const patchSchema = pluginSchemas => {
41
- const finalSchema = (0, _lodash.cloneDeep)({
42
- type: 'object',
43
- additionalProperties: false,
44
- properties: {
45
- source: _source.source,
46
- output: _output.output,
47
- server: _server.server,
48
- deploy: _deploy.deploy,
49
- plugins,
50
- dev,
51
- tools: _tools.tools
52
- }
53
- });
54
-
55
- const findTargetNode = props => {
56
- let node = finalSchema.properties;
57
-
58
- for (const prop of props) {
59
- node = node[prop];
60
-
61
- if (!node || !(0, _utils.isObject)(node)) {
62
- throw new Error(`add schema ${props.join('.')} error`);
63
- }
64
-
65
- node.properties = node.hasOwnProperty('properties') ? node.properties : {};
66
- node = node.properties;
67
- }
68
-
69
- return node;
70
- };
71
-
72
- const finalPluginSchemas = [];
73
- pluginSchemas.forEach(item => {
74
- if (Array.isArray(item)) {
75
- finalPluginSchemas.push(...item);
76
- } else {
77
- finalPluginSchemas.push(item);
78
- }
79
- });
80
-
81
- for (const {
82
- target,
83
- schema
84
- } of finalPluginSchemas) {
85
- if (!target) {
86
- throw new Error(`should return target property in plugin schema.`);
87
- }
88
-
89
- const props = target.split('.');
90
- const mountProperty = props.pop();
91
- const targetNode = findTargetNode(props);
92
-
93
- if (targetNode.hasOwnProperty(mountProperty)) {
94
- throw new Error(`${target} already exists in current validate schema`);
95
- }
96
-
97
- targetNode[mountProperty] = (0, _lodash.cloneDeep)(schema);
98
- }
99
-
100
- debug(`final validate schema: %o`, finalSchema);
101
- return finalSchema;
102
- };
103
-
104
- exports.patchSchema = patchSchema;
105
-
106
- const traverseSchema = schema => {
107
- const keys = [];
108
-
109
- const traverse = ({
110
- properties
111
- }, old = []) => {
112
- for (const key of Object.keys(properties)) {
113
- const current = [...old, key];
114
-
115
- if (properties[key].type === 'object' && properties[key].properties) {
116
- traverse(properties[key], current);
117
- } else {
118
- keys.push(current.join('.'));
119
- }
120
- }
121
- };
122
-
123
- traverse(schema);
124
- return keys;
125
- };
126
-
127
- exports.traverseSchema = traverseSchema;
@@ -1,156 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.output = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- const output = {
11
- type: 'object',
12
- additionalProperties: false,
13
- properties: {
14
- assetPrefix: {
15
- type: 'string'
16
- },
17
- path: {
18
- type: 'string'
19
- },
20
- jsPath: {
21
- type: 'string'
22
- },
23
- cssPath: {
24
- type: 'string'
25
- },
26
- htmlPath: {
27
- type: 'string'
28
- },
29
- mediaPath: {
30
- type: 'string'
31
- },
32
- mountId: {
33
- type: 'string'
34
- },
35
- favicon: {
36
- type: 'string'
37
- },
38
- faviconByEntries: {
39
- type: 'object',
40
- patternProperties: {
41
- [_utils.ENTRY_NAME_PATTERN]: {
42
- type: 'string'
43
- }
44
- }
45
- },
46
- title: {
47
- type: 'string'
48
- },
49
- titleByEntries: {
50
- type: 'object',
51
- patternProperties: {
52
- [_utils.ENTRY_NAME_PATTERN]: {
53
- type: 'string'
54
- }
55
- }
56
- },
57
- meta: {
58
- type: 'object'
59
- },
60
- metaByEntries: {
61
- type: 'object',
62
- patternProperties: {
63
- [_utils.ENTRY_NAME_PATTERN]: {
64
- type: 'object'
65
- }
66
- }
67
- },
68
- inject: {
69
- enum: [true, 'head', 'body', false]
70
- },
71
- injectByEntries: {
72
- type: 'object',
73
- patternProperties: {
74
- [_utils.ENTRY_NAME_PATTERN]: {
75
- enum: [true, 'head', 'body', false]
76
- }
77
- }
78
- },
79
- copy: {
80
- type: 'array'
81
- },
82
- scriptExt: {
83
- type: 'object'
84
- },
85
- disableTsChecker: {
86
- type: 'boolean'
87
- },
88
- disableHtmlFolder: {
89
- type: 'boolean'
90
- },
91
- disableCssModuleExtension: {
92
- type: 'boolean'
93
- },
94
- disableCssExtract: {
95
- type: 'boolean'
96
- },
97
- enableCssModuleTSDeclaration: {
98
- type: 'boolean'
99
- },
100
- disableMinimize: {
101
- type: 'boolean'
102
- },
103
- enableInlineStyles: {
104
- type: 'boolean'
105
- },
106
- enableInlineScripts: {
107
- type: 'boolean'
108
- },
109
- disableSourceMap: {
110
- type: 'boolean'
111
- },
112
- disableInlineRuntimeChunk: {
113
- type: 'boolean'
114
- },
115
- disableAssetsCache: {
116
- type: 'boolean'
117
- },
118
- enableLatestDecorators: {
119
- type: 'boolean'
120
- },
121
- enableTsLoader: {
122
- type: 'boolean'
123
- },
124
- dataUriLimit: {
125
- type: 'number'
126
- },
127
- templateParameters: {
128
- type: 'object'
129
- },
130
- templateParametersByEntries: {
131
- type: 'object',
132
- patternProperties: {
133
- [_utils.ENTRY_NAME_PATTERN]: {
134
- type: 'object'
135
- }
136
- }
137
- },
138
- polyfill: {
139
- type: 'string',
140
- enum: ['usage', 'entry', 'off', 'ua']
141
- },
142
- cssModuleLocalIdentName: {
143
- type: 'string'
144
- },
145
- federation: {
146
- type: 'object'
147
- },
148
- disableNodePolyfill: {
149
- type: 'boolean'
150
- },
151
- enableModernMode: {
152
- type: 'boolean'
153
- }
154
- }
155
- };
156
- exports.output = output;
@@ -1,179 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.server = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- const SERVER_ROUTE_OBJECT = {
11
- type: 'object',
12
- properties: {
13
- path: {
14
- type: 'string'
15
- },
16
- headers: {
17
- type: 'object'
18
- }
19
- },
20
- additionalProperties: false
21
- };
22
- const server = {
23
- type: 'object',
24
- additionalProperties: false,
25
- properties: {
26
- port: {
27
- type: 'number'
28
- },
29
- ssr: {
30
- if: {
31
- type: 'object'
32
- },
33
- then: {
34
- properties: {
35
- disableLoadable: {
36
- type: 'boolean'
37
- },
38
- disableHelmet: {
39
- type: 'boolean'
40
- },
41
- disableRedirect: {
42
- type: 'boolean'
43
- },
44
- enableAsyncData: {
45
- type: 'boolean'
46
- },
47
- enableProductWarning: {
48
- type: 'boolean'
49
- },
50
- timeout: {
51
- type: 'number'
52
- },
53
- asyncDataTimeout: {
54
- type: 'number'
55
- }
56
- }
57
- },
58
- else: {
59
- type: 'boolean'
60
- }
61
- },
62
- ssrByEntries: {
63
- type: 'object',
64
- patternProperties: {
65
- [_utils.ENTRY_NAME_PATTERN]: {
66
- if: {
67
- type: 'object'
68
- },
69
- then: {
70
- properties: {
71
- disableLoadable: {
72
- type: 'boolean'
73
- },
74
- disableHelmet: {
75
- type: 'boolean'
76
- },
77
- disableRedirect: {
78
- type: 'boolean'
79
- },
80
- enableProductWarning: {
81
- type: 'boolean'
82
- },
83
- enableAsyncData: {
84
- type: 'boolean'
85
- },
86
- timeout: {
87
- type: 'number'
88
- },
89
- asyncDataTimeout: {
90
- type: 'number'
91
- }
92
- },
93
- additionalProperties: false
94
- },
95
- else: {
96
- type: 'boolean'
97
- }
98
- }
99
- }
100
- },
101
- routes: {
102
- type: 'object',
103
- patternProperties: {
104
- [_utils.ENTRY_NAME_PATTERN]: {
105
- if: {
106
- type: 'object'
107
- },
108
- then: {
109
- properties: {
110
- route: {
111
- oneOf: [{
112
- type: 'string'
113
- }, {
114
- type: 'array',
115
- items: {
116
- oneOf: [{
117
- type: 'string'
118
- }, SERVER_ROUTE_OBJECT]
119
- }
120
- }, SERVER_ROUTE_OBJECT]
121
- },
122
- disableSpa: {
123
- type: 'boolean'
124
- }
125
- },
126
- additionalProperties: false
127
- },
128
- else: {
129
- oneOf: [{
130
- type: 'string'
131
- }, {
132
- type: 'array',
133
- items: {
134
- type: 'string'
135
- }
136
- }]
137
- }
138
- }
139
- }
140
- },
141
- publicRoutes: {
142
- type: 'object',
143
- patternProperties: {
144
- [_utils.ENTRY_NAME_PATTERN]: {
145
- type: ['string']
146
- }
147
- }
148
- },
149
- baseUrl: {
150
- oneOf: [{
151
- type: 'string'
152
- }, {
153
- type: 'array',
154
- items: [{
155
- type: 'string'
156
- }]
157
- }]
158
- },
159
- middleware: {
160
- instanceof: ['Array', 'Function']
161
- },
162
- renderHook: {
163
- instanceof: 'Function'
164
- },
165
- logger: {
166
- type: ['object', 'boolean']
167
- },
168
- metrics: {
169
- type: ['object', 'boolean']
170
- },
171
- proxy: {
172
- type: 'object'
173
- },
174
- enableMicroFrontendDebug: {
175
- type: 'boolean'
176
- }
177
- }
178
- };
179
- exports.server = server;
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.source = void 0;
7
-
8
- var _utils = require("@modern-js/utils");
9
-
10
- const source = {
11
- type: 'object',
12
- additionalProperties: false,
13
- properties: {
14
- entries: {
15
- type: 'object',
16
- patternProperties: {
17
- [_utils.ENTRY_NAME_PATTERN]: {
18
- if: {
19
- type: 'object'
20
- },
21
- then: {
22
- required: ['entry'],
23
- properties: {
24
- entry: {
25
- type: ['string', 'array']
26
- },
27
- disableMount: {
28
- type: 'boolean'
29
- },
30
- enableFileSystemRoutes: {
31
- type: 'boolean'
32
- }
33
- },
34
- additionalProperties: false
35
- },
36
- else: {
37
- type: ['string', 'array']
38
- }
39
- }
40
- }
41
- },
42
- alias: {
43
- typeof: ['object', 'function']
44
- },
45
- disableDefaultEntries: {
46
- type: 'boolean'
47
- },
48
- envVars: {
49
- type: 'array'
50
- },
51
- globalVars: {
52
- type: 'object'
53
- },
54
- moduleScopes: {
55
- instanceof: ['Array', 'Function']
56
- },
57
- entriesDir: {
58
- type: 'string'
59
- },
60
- configDir: {
61
- type: 'string'
62
- },
63
- include: {
64
- type: ['array']
65
- }
66
- }
67
- };
68
- exports.source = source;
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.tools = void 0;
7
- const tools = {
8
- type: 'object',
9
- additionalProperties: false,
10
- properties: {
11
- webpack: {
12
- typeof: ['object', 'function']
13
- },
14
- babel: {
15
- typeof: ['object', 'function']
16
- },
17
- postcss: {
18
- typeof: ['object', 'function']
19
- },
20
- lodash: {
21
- typeof: ['object', 'function']
22
- },
23
- devServer: {
24
- type: 'object'
25
- },
26
- tsLoader: {
27
- typeof: ['object', 'function']
28
- },
29
- autoprefixer: {
30
- typeof: ['object', 'function']
31
- },
32
- terser: {
33
- typeof: ['object', 'function']
34
- },
35
- minifyCss: {
36
- typeof: ['object', 'function']
37
- },
38
- styledComponents: {
39
- typeof: ['object', 'function']
40
- }
41
- }
42
- };
43
- exports.tools = tools;
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,93 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useResolvedConfigContext = exports.useConfigContext = exports.useAppContext = exports.setAppContext = exports.initAppContext = exports.ResolvedConfigContext = exports.ConfigContext = exports.AppContext = void 0;
7
-
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
- var _plugin = require("@modern-js/plugin");
11
-
12
- var _address = _interopRequireDefault(require("address"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- const AppContext = (0, _plugin.createContext)({});
17
- exports.AppContext = AppContext;
18
- const ConfigContext = (0, _plugin.createContext)({});
19
- exports.ConfigContext = ConfigContext;
20
- const ResolvedConfigContext = (0, _plugin.createContext)({});
21
- /**
22
- * Set app context.
23
- * @param value new app context. It will override previous app context.
24
- */
25
-
26
- exports.ResolvedConfigContext = ResolvedConfigContext;
27
-
28
- const setAppContext = value => AppContext.set(value);
29
- /**
30
- * Get app context, including directories, plugins and some static infos.
31
- */
32
-
33
-
34
- exports.setAppContext = setAppContext;
35
-
36
- const useAppContext = () => AppContext.use().value;
37
- /**
38
- * Get original content of user config.
39
- */
40
-
41
-
42
- exports.useAppContext = useAppContext;
43
-
44
- const useConfigContext = () => ConfigContext.use().value;
45
- /**
46
- * Get normalized content of user config.
47
- */
48
-
49
-
50
- exports.useConfigContext = useConfigContext;
51
-
52
- const useResolvedConfigContext = () => ResolvedConfigContext.use().value;
53
-
54
- exports.useResolvedConfigContext = useResolvedConfigContext;
55
-
56
- const initAppContext = ({
57
- appDirectory,
58
- plugins,
59
- configFile,
60
- options,
61
- serverConfigFile
62
- }) => {
63
- const {
64
- metaName = 'modern-js',
65
- srcDir = 'src',
66
- distDir = '',
67
- sharedDir = 'shared'
68
- } = options || {};
69
- return {
70
- metaName,
71
- appDirectory,
72
- configFile,
73
- serverConfigFile,
74
- ip: _address.default.ip(),
75
- port: 0,
76
- packageName: require(_path.default.resolve(appDirectory, './package.json')).name,
77
- srcDirectory: _path.default.resolve(appDirectory, srcDir),
78
- distDirectory: distDir,
79
- sharedDirectory: _path.default.resolve(appDirectory, sharedDir),
80
- nodeModulesDirectory: _path.default.resolve(appDirectory, './node_modules'),
81
- internalDirectory: _path.default.resolve(appDirectory, `./node_modules/.${metaName}`),
82
- plugins,
83
- htmlTemplates: {},
84
- serverRoutes: [],
85
- entrypoints: [],
86
- checkedEntries: [],
87
- apiOnly: false,
88
- internalDirAlias: `@_${metaName.replace(/-/g, '_')}_internal`,
89
- internalSrcAlias: `@_${metaName.replace(/-/g, '_')}_src`
90
- };
91
- };
92
-
93
- exports.initAppContext = initAppContext;