@modern-js/app-tools 2.0.0-beta.0 → 2.0.0-beta.2

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 (279) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/dist/js/modern/analyze/generateCode.js +30 -38
  3. package/dist/js/modern/analyze/getBundleEntry.js +5 -13
  4. package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +5 -30
  5. package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +5 -30
  6. package/dist/js/modern/analyze/getClientRoutes/utils.js +0 -3
  7. package/dist/js/modern/analyze/getFileSystemEntry.js +5 -18
  8. package/dist/js/modern/analyze/getHtmlTemplate.js +3 -10
  9. package/dist/js/modern/analyze/getServerRoutes.js +25 -38
  10. package/dist/js/modern/analyze/index.js +90 -48
  11. package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -4
  12. package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -2
  13. package/dist/js/modern/analyze/nestedRoutes.js +8 -33
  14. package/dist/js/modern/analyze/templates.js +22 -37
  15. package/dist/js/modern/analyze/utils.js +0 -7
  16. package/dist/js/modern/builder/builderPlugins/compatModern.js +41 -58
  17. package/dist/js/modern/builder/index.js +56 -37
  18. package/dist/js/modern/builder/share.js +1 -5
  19. package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -8
  20. package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +2 -13
  21. package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +97 -0
  22. package/dist/js/modern/commands/build.js +12 -46
  23. package/dist/js/modern/commands/dev.js +20 -23
  24. package/dist/js/modern/commands/inspect.js +4 -19
  25. package/dist/js/modern/commands/start.js +1 -2
  26. package/dist/js/modern/config/default.js +207 -0
  27. package/dist/js/modern/config/index.js +2 -0
  28. package/dist/js/modern/config/initial/createHtmlConfig.js +32 -0
  29. package/dist/js/modern/{builder → config/initial}/createOutputConfig.js +19 -18
  30. package/dist/js/modern/config/initial/createSourceConfig.js +32 -0
  31. package/dist/js/modern/config/initial/createToolsConfig.js +41 -0
  32. package/dist/js/modern/config/initial/index.js +11 -0
  33. package/dist/js/modern/config/initial/inits.js +117 -0
  34. package/dist/js/modern/config/initial/transformNormalizedConfig.js +40 -0
  35. package/dist/js/modern/defineConfig.js +12 -0
  36. package/dist/js/modern/hooks.js +23 -19
  37. package/dist/js/modern/index.js +12 -19
  38. package/dist/js/modern/initialize/index.js +72 -0
  39. package/dist/js/modern/schema/Schema.js +39 -0
  40. package/dist/js/modern/schema/index.js +139 -0
  41. package/dist/js/modern/schema/legacy.js +284 -0
  42. package/dist/js/modern/types/config/deploy.js +0 -0
  43. package/dist/js/modern/types/config/dev.js +0 -0
  44. package/dist/js/modern/types/config/experiments.js +0 -0
  45. package/dist/js/modern/types/config/html.js +0 -0
  46. package/dist/js/modern/types/config/index.js +2 -0
  47. package/dist/js/modern/types/config/output.js +0 -0
  48. package/dist/js/modern/types/config/performance.js +0 -0
  49. package/dist/js/modern/types/config/security.js +0 -0
  50. package/dist/js/modern/types/config/source.js +0 -0
  51. package/dist/js/modern/types/config/tools.js +0 -0
  52. package/dist/js/modern/types/hooks.js +0 -0
  53. package/dist/js/modern/types/index.js +4 -0
  54. package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
  55. package/dist/js/modern/types/legacyConfig/dev.js +0 -0
  56. package/dist/js/modern/types/legacyConfig/index.js +0 -0
  57. package/dist/js/modern/types/legacyConfig/output.js +1 -0
  58. package/dist/js/modern/types/legacyConfig/source.js +0 -0
  59. package/dist/js/modern/types/legacyConfig/tools.js +0 -0
  60. package/dist/js/modern/utils/config.js +2 -13
  61. package/dist/js/modern/utils/createFileWatcher.js +82 -0
  62. package/dist/js/modern/utils/createServer.js +0 -5
  63. package/dist/js/modern/utils/getSpecifiedEntries.js +0 -6
  64. package/dist/js/modern/utils/printInstructions.js +2 -1
  65. package/dist/js/modern/utils/restart.js +17 -0
  66. package/dist/js/modern/utils/routes.js +0 -2
  67. package/dist/js/node/analyze/generateCode.js +30 -61
  68. package/dist/js/node/analyze/getBundleEntry.js +5 -19
  69. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +5 -45
  70. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +5 -45
  71. package/dist/js/node/analyze/getClientRoutes/index.js +0 -2
  72. package/dist/js/node/analyze/getClientRoutes/utils.js +0 -14
  73. package/dist/js/node/analyze/getFileSystemEntry.js +5 -26
  74. package/dist/js/node/analyze/getHtmlTemplate.js +3 -24
  75. package/dist/js/node/analyze/getServerRoutes.js +24 -46
  76. package/dist/js/node/analyze/index.js +91 -70
  77. package/dist/js/node/analyze/isDefaultExportFunction.js +0 -12
  78. package/dist/js/node/analyze/makeLegalIdentifier.js +0 -4
  79. package/dist/js/node/analyze/nestedRoutes.js +8 -41
  80. package/dist/js/node/analyze/templates.js +22 -47
  81. package/dist/js/node/analyze/utils.js +0 -20
  82. package/dist/js/node/builder/builderPlugins/compatModern.js +41 -69
  83. package/dist/js/node/builder/index.js +57 -51
  84. package/dist/js/node/builder/share.js +1 -13
  85. package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -10
  86. package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +2 -15
  87. package/dist/js/node/builder/webpackPlugins/routerPlugin.js +105 -0
  88. package/dist/js/node/commands/build.js +10 -57
  89. package/dist/js/node/commands/deploy.js +0 -2
  90. package/dist/js/node/commands/dev.js +19 -34
  91. package/dist/js/node/commands/index.js +0 -6
  92. package/dist/js/node/commands/inspect.js +4 -26
  93. package/dist/js/node/commands/start.js +1 -11
  94. package/dist/js/node/config/default.js +214 -0
  95. package/dist/js/node/config/index.js +31 -0
  96. package/dist/js/node/config/initial/createHtmlConfig.js +38 -0
  97. package/dist/js/node/{builder → config/initial}/createOutputConfig.js +19 -20
  98. package/dist/js/node/config/initial/createSourceConfig.js +38 -0
  99. package/dist/js/node/config/initial/createToolsConfig.js +47 -0
  100. package/dist/js/node/config/initial/index.js +24 -0
  101. package/dist/js/node/config/initial/inits.js +127 -0
  102. package/dist/js/node/config/initial/transformNormalizedConfig.js +46 -0
  103. package/dist/js/node/defineConfig.js +20 -0
  104. package/dist/js/node/exports/server.js +0 -1
  105. package/dist/js/node/hooks.js +23 -30
  106. package/dist/js/node/index.js +35 -48
  107. package/dist/js/node/initialize/index.js +79 -0
  108. package/dist/js/node/locale/index.js +0 -4
  109. package/dist/js/node/schema/Schema.js +46 -0
  110. package/dist/js/node/schema/index.js +152 -0
  111. package/dist/js/node/schema/legacy.js +291 -0
  112. package/dist/js/node/types/config/deploy.js +0 -0
  113. package/dist/js/node/types/config/dev.js +0 -0
  114. package/dist/js/node/types/config/experiments.js +0 -0
  115. package/dist/js/node/types/config/html.js +0 -0
  116. package/dist/js/node/types/config/index.js +16 -0
  117. package/dist/js/node/types/config/output.js +0 -0
  118. package/dist/js/node/types/config/performance.js +0 -0
  119. package/dist/js/node/types/config/security.js +0 -0
  120. package/dist/js/node/types/config/source.js +0 -0
  121. package/dist/js/node/types/config/tools.js +0 -0
  122. package/dist/js/node/types/hooks.js +0 -0
  123. package/dist/js/node/types/index.js +38 -0
  124. package/dist/js/node/types/legacyConfig/deploy.js +0 -0
  125. package/dist/js/node/types/legacyConfig/dev.js +0 -0
  126. package/dist/js/node/types/legacyConfig/index.js +0 -0
  127. package/dist/js/node/types/legacyConfig/output.js +5 -0
  128. package/dist/js/node/types/legacyConfig/source.js +0 -0
  129. package/dist/js/node/types/legacyConfig/tools.js +0 -0
  130. package/dist/js/node/utils/commands.js +0 -2
  131. package/dist/js/node/utils/config.js +2 -26
  132. package/dist/js/node/utils/createFileWatcher.js +90 -0
  133. package/dist/js/node/utils/createServer.js +0 -15
  134. package/dist/js/node/utils/getSpecifiedEntries.js +0 -9
  135. package/dist/js/node/utils/language.js +0 -2
  136. package/dist/js/node/utils/printInstructions.js +2 -5
  137. package/dist/js/node/utils/restart.js +23 -0
  138. package/dist/js/node/utils/routes.js +0 -5
  139. package/dist/js/treeshaking/analyze/generateCode.js +58 -101
  140. package/dist/js/treeshaking/analyze/getBundleEntry.js +12 -20
  141. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +16 -42
  142. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +16 -42
  143. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -3
  144. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +5 -18
  145. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +3 -27
  146. package/dist/js/treeshaking/analyze/getServerRoutes.js +29 -41
  147. package/dist/js/treeshaking/analyze/index.js +195 -91
  148. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -4
  149. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -2
  150. package/dist/js/treeshaking/analyze/nestedRoutes.js +9 -51
  151. package/dist/js/treeshaking/analyze/templates.js +31 -50
  152. package/dist/js/treeshaking/analyze/utils.js +7 -14
  153. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +50 -68
  154. package/dist/js/treeshaking/builder/index.js +69 -65
  155. package/dist/js/treeshaking/builder/share.js +1 -5
  156. package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +1 -13
  157. package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +2 -14
  158. package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +121 -0
  159. package/dist/js/treeshaking/commands/build.js +41 -116
  160. package/dist/js/treeshaking/commands/deploy.js +0 -3
  161. package/dist/js/treeshaking/commands/dev.js +38 -46
  162. package/dist/js/treeshaking/commands/inspect.js +9 -27
  163. package/dist/js/treeshaking/commands/start.js +1 -9
  164. package/dist/js/treeshaking/config/default.js +200 -0
  165. package/dist/js/treeshaking/config/index.js +2 -0
  166. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +31 -0
  167. package/dist/js/treeshaking/config/initial/createOutputConfig.js +67 -0
  168. package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -0
  169. package/dist/js/treeshaking/config/initial/createToolsConfig.js +38 -0
  170. package/dist/js/treeshaking/config/initial/index.js +11 -0
  171. package/dist/js/treeshaking/config/initial/inits.js +114 -0
  172. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +38 -0
  173. package/dist/js/treeshaking/defineConfig.js +14 -0
  174. package/dist/js/treeshaking/hooks.js +23 -19
  175. package/dist/js/treeshaking/index.js +8 -43
  176. package/dist/js/treeshaking/initialize/index.js +121 -0
  177. package/dist/js/treeshaking/schema/Schema.js +75 -0
  178. package/dist/js/treeshaking/schema/index.js +138 -0
  179. package/dist/js/treeshaking/schema/legacy.js +273 -0
  180. package/dist/js/treeshaking/types/config/deploy.js +0 -0
  181. package/dist/js/treeshaking/types/config/dev.js +0 -0
  182. package/dist/js/treeshaking/types/config/experiments.js +0 -0
  183. package/dist/js/treeshaking/types/config/html.js +0 -0
  184. package/dist/js/treeshaking/types/config/index.js +2 -0
  185. package/dist/js/treeshaking/types/config/output.js +0 -0
  186. package/dist/js/treeshaking/types/config/performance.js +0 -0
  187. package/dist/js/treeshaking/types/config/security.js +0 -0
  188. package/dist/js/treeshaking/types/config/source.js +0 -0
  189. package/dist/js/treeshaking/types/config/tools.js +0 -0
  190. package/dist/js/treeshaking/types/hooks.js +0 -0
  191. package/dist/js/treeshaking/types/index.js +4 -0
  192. package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -0
  193. package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -0
  194. package/dist/js/treeshaking/types/legacyConfig/index.js +0 -0
  195. package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
  196. package/dist/js/treeshaking/types/legacyConfig/source.js +0 -0
  197. package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -0
  198. package/dist/js/treeshaking/utils/config.js +2 -18
  199. package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
  200. package/dist/js/treeshaking/utils/createServer.js +0 -10
  201. package/dist/js/treeshaking/utils/getSpecifiedEntries.js +0 -10
  202. package/dist/js/treeshaking/utils/printInstructions.js +0 -5
  203. package/dist/js/treeshaking/utils/restart.js +45 -0
  204. package/dist/js/treeshaking/utils/routes.js +0 -4
  205. package/dist/types/analyze/generateCode.d.ts +3 -2
  206. package/dist/types/analyze/getBundleEntry.d.ts +2 -2
  207. package/dist/types/analyze/getFileSystemEntry.d.ts +2 -2
  208. package/dist/types/analyze/getHtmlTemplate.d.ts +3 -3
  209. package/dist/types/analyze/getServerRoutes.d.ts +3 -2
  210. package/dist/types/analyze/index.d.ts +3 -42
  211. package/dist/types/analyze/nestedRoutes.d.ts +1 -1
  212. package/dist/types/analyze/templates.d.ts +4 -2
  213. package/dist/types/analyze/utils.d.ts +1 -1
  214. package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -3
  215. package/dist/types/builder/index.d.ts +7 -8
  216. package/dist/types/builder/share.d.ts +2 -2
  217. package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +10 -0
  218. package/dist/types/commands/build.d.ts +2 -2
  219. package/dist/types/commands/deploy.d.ts +2 -2
  220. package/dist/types/commands/dev.d.ts +2 -2
  221. package/dist/types/commands/inspect.d.ts +6 -1
  222. package/dist/types/commands/start.d.ts +2 -2
  223. package/dist/types/config/default.d.ts +3 -0
  224. package/dist/types/config/index.d.ts +2 -0
  225. package/dist/types/config/initial/createHtmlConfig.d.ts +2 -0
  226. package/dist/types/config/initial/createOutputConfig.d.ts +2 -0
  227. package/dist/types/config/initial/createSourceConfig.d.ts +2 -0
  228. package/dist/types/config/initial/createToolsConfig.d.ts +2 -0
  229. package/dist/types/config/initial/index.d.ts +4 -0
  230. package/dist/types/config/initial/inits.d.ts +4 -0
  231. package/dist/types/config/initial/transformNormalizedConfig.d.ts +2 -0
  232. package/dist/types/defineConfig.d.ts +7 -0
  233. package/dist/types/hooks.d.ts +2 -42
  234. package/dist/types/index.d.ts +5 -7
  235. package/dist/types/initialize/index.d.ts +3 -0
  236. package/dist/types/schema/Schema.d.ts +14 -0
  237. package/dist/types/schema/index.d.ts +4 -0
  238. package/dist/types/schema/legacy.d.ts +3 -0
  239. package/dist/types/types/config/deploy.d.ts +9 -0
  240. package/dist/types/types/config/dev.d.ts +13 -0
  241. package/dist/types/types/config/experiments.d.ts +4 -0
  242. package/dist/types/types/config/html.d.ts +4 -0
  243. package/dist/types/types/config/index.d.ts +62 -0
  244. package/dist/types/types/config/output.d.ts +23 -0
  245. package/dist/types/types/config/performance.d.ts +4 -0
  246. package/dist/types/types/config/security.d.ts +4 -0
  247. package/dist/types/types/config/source.d.ts +22 -0
  248. package/dist/types/types/config/tools.d.ts +15 -0
  249. package/dist/types/types/hooks.d.ts +80 -0
  250. package/dist/types/types/index.d.ts +23 -0
  251. package/dist/types/types/legacyConfig/deploy.d.ts +8 -0
  252. package/dist/types/types/legacyConfig/dev.d.ts +12 -0
  253. package/dist/types/types/legacyConfig/index.d.ts +33 -0
  254. package/dist/types/types/legacyConfig/output.d.ts +51 -0
  255. package/dist/types/types/legacyConfig/source.d.ts +25 -0
  256. package/dist/types/types/legacyConfig/tools.d.ts +16 -0
  257. package/dist/types/utils/config.d.ts +2 -3
  258. package/dist/types/utils/createFileWatcher.d.ts +3 -0
  259. package/dist/types/utils/printInstructions.d.ts +3 -3
  260. package/dist/types/utils/restart.d.ts +3 -0
  261. package/package.json +26 -25
  262. package/dist/js/modern/builder/createHtmlConfig.js +0 -58
  263. package/dist/js/modern/builder/createSourceConfig.js +0 -85
  264. package/dist/js/modern/builder/createToolsConfig.js +0 -94
  265. package/dist/js/modern/utils/createCompiler.js +0 -58
  266. package/dist/js/node/builder/createHtmlConfig.js +0 -76
  267. package/dist/js/node/builder/createSourceConfig.js +0 -99
  268. package/dist/js/node/builder/createToolsConfig.js +0 -103
  269. package/dist/js/node/utils/createCompiler.js +0 -75
  270. package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
  271. package/dist/js/treeshaking/builder/createOutputConfig.js +0 -67
  272. package/dist/js/treeshaking/builder/createSourceConfig.js +0 -100
  273. package/dist/js/treeshaking/builder/createToolsConfig.js +0 -90
  274. package/dist/js/treeshaking/utils/createCompiler.js +0 -117
  275. package/dist/types/builder/createHtmlConfig.d.ts +0 -6
  276. package/dist/types/builder/createOutputConfig.d.ts +0 -3
  277. package/dist/types/builder/createSourceConfig.d.ts +0 -5
  278. package/dist/types/builder/createToolsConfig.d.ts +0 -13
  279. package/dist/types/utils/createCompiler.d.ts +0 -12
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _utils = require("@modern-js/utils");
8
+ var _schema = require("../schema");
9
+ var _commands = require("../utils/commands");
10
+ var _transformNormalizedConfig = require("../config/initial/transformNormalizedConfig");
11
+ var _config = require("../config");
12
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
+ var _default = () => ({
16
+ name: '@modern-js/plugin-initialize',
17
+ setup(api) {
18
+ const config = () => {
19
+ const appContext = api.useAppContext();
20
+ const userConfig = api.useConfigContext();
21
+ return (0, _config.checkIsLegacyConfig)(userConfig) ? (0, _config.createLegacyDefaultConfig)(appContext) : (0, _config.createDefaultConfig)(appContext);
22
+ };
23
+ const validateSchema = () => {
24
+ const userConfig = api.useConfigContext();
25
+ const schemas = (0, _config.checkIsLegacyConfig)(userConfig) ? _schema.legacySchema : _schema.schema;
26
+ return schemas.generate();
27
+ };
28
+ return {
29
+ config,
30
+ validateSchema,
31
+ async resolvedConfig({
32
+ resolved
33
+ }) {
34
+ var _resolved$output$dist, _normalizedConfig$ser;
35
+ let appContext = api.useAppContext();
36
+ const userConfig = api.useConfigContext();
37
+ const port = await getDevServerPort(appContext, resolved);
38
+ appContext = _objectSpread(_objectSpread({}, appContext), {}, {
39
+ port,
40
+ distDirectory: (0, _utils.ensureAbsolutePath)(appContext.distDirectory, ((_resolved$output$dist = resolved.output.distPath) === null || _resolved$output$dist === void 0 ? void 0 : _resolved$output$dist.root) || 'dist')
41
+ });
42
+ api.setAppContext(appContext);
43
+ const normalizedConfig = (0, _config.checkIsLegacyConfig)(resolved) ? (0, _transformNormalizedConfig.transformNormalizedConfig)(resolved) : resolved;
44
+ return {
45
+ resolved: {
46
+ // FIXME: the userConfig mayby legacy userConfig
47
+ _raw: userConfig,
48
+ source: normalizedConfig.source || {},
49
+ server: _objectSpread(_objectSpread({}, normalizedConfig.server || {}), {}, {
50
+ port: port || ((_normalizedConfig$ser = normalizedConfig.server) === null || _normalizedConfig$ser === void 0 ? void 0 : _normalizedConfig$ser.port)
51
+ }),
52
+ bff: normalizedConfig.bff || {},
53
+ dev: normalizedConfig.dev || {},
54
+ html: normalizedConfig.html || {},
55
+ output: normalizedConfig.output || {},
56
+ security: normalizedConfig.security || {},
57
+ tools: normalizedConfig.tools || {},
58
+ testing: normalizedConfig.testing || {},
59
+ plugins: normalizedConfig.plugins || [],
60
+ runtime: normalizedConfig.runtime || {},
61
+ runtimeByEntries: normalizedConfig.runtimeByEntries || {},
62
+ deploy: normalizedConfig.deploy || {},
63
+ performance: normalizedConfig.performance || {},
64
+ experiments: normalizedConfig.experiments || {}
65
+ }
66
+ };
67
+ }
68
+ };
69
+ }
70
+ });
71
+ exports.default = _default;
72
+ async function getDevServerPort(appContext, resolved) {
73
+ const command = (0, _commands.getCommand)();
74
+ if ((0, _utils.isDev)() && command === 'dev') {
75
+ var _appContext$port;
76
+ return ((_appContext$port = appContext.port) !== null && _appContext$port !== void 0 ? _appContext$port : 0) > 0 ? appContext.port : await (0, _utils.getPort)(resolved.server.port || 8080);
77
+ }
78
+ return resolved.server.port;
79
+ }
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.localeKeys = exports.i18n = void 0;
7
-
8
7
  var _pluginI18n = require("@modern-js/plugin-i18n");
9
-
10
8
  var _zh = require("./zh");
11
-
12
9
  var _en = require("./en");
13
-
14
10
  const i18n = new _pluginI18n.I18n();
15
11
  exports.i18n = i18n;
16
12
  const localeKeys = i18n.init('zh', {
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Schema = void 0;
7
+ var _lodash = require("@modern-js/utils/lodash");
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ class Schema extends Map {
10
+ constructor(baseSchema = {}) {
11
+ super();
12
+ _defineProperty(this, "schema", void 0);
13
+ this.schema = baseSchema;
14
+ }
15
+ setSchema(key, object) {
16
+ Object.entries(object).forEach(([k, v]) => {
17
+ const target = `${key}.${k}`;
18
+ this.set(target, v);
19
+ });
20
+ return this;
21
+ }
22
+ set(key, value) {
23
+ if (this.has(key)) {
24
+ (0, _lodash.merge)(this.schema[key], value);
25
+ } else {
26
+ this.schema[key] = value;
27
+ }
28
+ return this;
29
+ }
30
+ has(key) {
31
+ return key in this.schema;
32
+ }
33
+ get(key) {
34
+ return this.schema[key];
35
+ }
36
+ delete(key) {
37
+ return delete this.schema[key];
38
+ }
39
+ generate() {
40
+ return Object.entries(this.schema).map(([target, schema]) => ({
41
+ target,
42
+ schema
43
+ }));
44
+ }
45
+ }
46
+ exports.Schema = Schema;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "legacySchema", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _legacy.default;
10
+ }
11
+ });
12
+ exports.schema = void 0;
13
+ var _constants = require("@modern-js/utils/constants");
14
+ var _Schema = require("./Schema");
15
+ var _legacy = _interopRequireDefault(require("./legacy"));
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ const source = {
18
+ entries: {
19
+ type: 'object',
20
+ patternProperties: {
21
+ [_constants.ENTRY_NAME_PATTERN]: {
22
+ if: {
23
+ type: 'object'
24
+ },
25
+ then: {
26
+ required: ['entry'],
27
+ properties: {
28
+ entry: {
29
+ type: ['string', 'array']
30
+ },
31
+ disableMount: {
32
+ type: 'boolean'
33
+ },
34
+ enableFileSystemRoutes: {
35
+ type: 'boolean'
36
+ }
37
+ },
38
+ additionalProperties: false
39
+ },
40
+ else: {
41
+ type: ['string', 'array']
42
+ }
43
+ }
44
+ }
45
+ },
46
+ enableAsyncEntry: {
47
+ type: 'boolean'
48
+ },
49
+ disableDefaultEntries: {
50
+ type: 'boolean'
51
+ },
52
+ entriesDir: {
53
+ type: 'string'
54
+ },
55
+ configDir: {
56
+ type: 'string'
57
+ },
58
+ designSystem: {
59
+ type: 'object'
60
+ }
61
+ };
62
+ const bff = {
63
+ prefix: {
64
+ type: 'string'
65
+ },
66
+ proxy: {
67
+ type: 'object',
68
+ additionalProperties: {
69
+ type: 'string'
70
+ }
71
+ }
72
+ };
73
+ const output = {
74
+ ssg: {
75
+ typeof: ['boolean', 'object', 'function']
76
+ },
77
+ enableModernMode: {
78
+ type: 'boolean'
79
+ },
80
+ disableNodePolyfill: {
81
+ type: 'boolean'
82
+ }
83
+ };
84
+ const dev = {
85
+ proxy: {
86
+ type: ['boolean', 'object']
87
+ }
88
+ };
89
+ const server = {
90
+ routes: {
91
+ type: 'object'
92
+ },
93
+ publicRoutes: {
94
+ type: 'object'
95
+ },
96
+ ssr: {
97
+ type: ['boolean', 'object']
98
+ },
99
+ ssrByEntries: {
100
+ type: 'object'
101
+ },
102
+ baseUrl: {
103
+ anyOf: [{
104
+ type: 'string'
105
+ }, {
106
+ type: 'array',
107
+ items: {
108
+ type: 'string'
109
+ }
110
+ }]
111
+ },
112
+ port: {
113
+ type: 'number'
114
+ },
115
+ logger: {
116
+ type: ['boolean', 'object']
117
+ },
118
+ metrics: {
119
+ type: ['boolean', 'object']
120
+ },
121
+ enableMicroFrontendDebug: {
122
+ type: 'boolean'
123
+ },
124
+ watchOptions: {
125
+ type: 'object'
126
+ },
127
+ compiler: {
128
+ type: 'string'
129
+ },
130
+ disableFrameworkExt: {
131
+ type: 'boolean'
132
+ }
133
+ };
134
+ const tools = {
135
+ tailwindcss: {
136
+ type: 'object'
137
+ },
138
+ jest: {
139
+ typeof: ['object', 'function']
140
+ },
141
+ esbuild: {
142
+ typeof: ['object']
143
+ }
144
+ };
145
+ const deploy = {
146
+ microFrontend: {
147
+ type: ['boolean', 'object']
148
+ }
149
+ };
150
+ const schema = new _Schema.Schema();
151
+ exports.schema = schema;
152
+ schema.setSchema('bff', bff).setSchema('dev', dev).setSchema('server', server).setSchema('source', source).setSchema('output', output).setSchema('tools', tools).setSchema('deploy', deploy);
@@ -0,0 +1,291 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _constants = require("@modern-js/utils/constants");
8
+ var _Schema = require("./Schema");
9
+ const source = {
10
+ entries: {
11
+ type: 'object',
12
+ patternProperties: {
13
+ [_constants.ENTRY_NAME_PATTERN]: {
14
+ if: {
15
+ type: 'object'
16
+ },
17
+ then: {
18
+ required: ['entry'],
19
+ properties: {
20
+ entry: {
21
+ type: ['string', 'array']
22
+ },
23
+ disableMount: {
24
+ type: 'boolean'
25
+ },
26
+ enableFileSystemRoutes: {
27
+ type: 'boolean'
28
+ }
29
+ },
30
+ additionalProperties: false
31
+ },
32
+ else: {
33
+ type: ['string', 'array']
34
+ }
35
+ }
36
+ }
37
+ },
38
+ preEntry: {
39
+ type: ['string', 'array']
40
+ },
41
+ alias: {
42
+ typeof: ['object', 'function']
43
+ },
44
+ enableAsyncEntry: {
45
+ type: 'boolean'
46
+ },
47
+ disableDefaultEntries: {
48
+ type: 'boolean'
49
+ },
50
+ envVars: {
51
+ type: 'array'
52
+ },
53
+ globalVars: {
54
+ type: 'object'
55
+ },
56
+ moduleScopes: {
57
+ instanceof: ['Array', 'Function']
58
+ },
59
+ entriesDir: {
60
+ type: 'string'
61
+ },
62
+ configDir: {
63
+ type: 'string'
64
+ },
65
+ include: {
66
+ type: ['array']
67
+ }
68
+ };
69
+ const output = {
70
+ assetPrefix: {
71
+ type: 'string'
72
+ },
73
+ path: {
74
+ type: 'string'
75
+ },
76
+ jsPath: {
77
+ type: 'string'
78
+ },
79
+ cssPath: {
80
+ type: 'string'
81
+ },
82
+ htmlPath: {
83
+ type: 'string'
84
+ },
85
+ mediaPath: {
86
+ type: 'string'
87
+ },
88
+ mountId: {
89
+ type: 'string'
90
+ },
91
+ favicon: {
92
+ type: 'string'
93
+ },
94
+ faviconByEntries: {
95
+ type: 'object',
96
+ patternProperties: {
97
+ [_constants.ENTRY_NAME_PATTERN]: {
98
+ type: 'string'
99
+ }
100
+ }
101
+ },
102
+ title: {
103
+ type: 'string'
104
+ },
105
+ titleByEntries: {
106
+ type: 'object',
107
+ patternProperties: {
108
+ [_constants.ENTRY_NAME_PATTERN]: {
109
+ type: 'string'
110
+ }
111
+ }
112
+ },
113
+ meta: {
114
+ type: 'object'
115
+ },
116
+ metaByEntries: {
117
+ type: 'object',
118
+ patternProperties: {
119
+ [_constants.ENTRY_NAME_PATTERN]: {
120
+ type: 'object'
121
+ }
122
+ }
123
+ },
124
+ inject: {
125
+ enum: [true, 'head', 'body', false]
126
+ },
127
+ injectByEntries: {
128
+ type: 'object',
129
+ patternProperties: {
130
+ [_constants.ENTRY_NAME_PATTERN]: {
131
+ enum: [true, 'head', 'body', false]
132
+ }
133
+ }
134
+ },
135
+ copy: {
136
+ type: 'array'
137
+ },
138
+ scriptExt: {
139
+ type: 'object'
140
+ },
141
+ disableTsChecker: {
142
+ type: 'boolean'
143
+ },
144
+ disableHtmlFolder: {
145
+ type: 'boolean'
146
+ },
147
+ disableCssModuleExtension: {
148
+ type: 'boolean'
149
+ },
150
+ disableCssExtract: {
151
+ type: 'boolean'
152
+ },
153
+ enableCssModuleTSDeclaration: {
154
+ type: 'boolean'
155
+ },
156
+ disableMinimize: {
157
+ type: 'boolean'
158
+ },
159
+ enableInlineStyles: {
160
+ type: 'boolean'
161
+ },
162
+ enableInlineScripts: {
163
+ type: 'boolean'
164
+ },
165
+ disableSourceMap: {
166
+ type: 'boolean'
167
+ },
168
+ disableInlineRuntimeChunk: {
169
+ type: 'boolean'
170
+ },
171
+ disableAssetsCache: {
172
+ type: 'boolean'
173
+ },
174
+ enableLatestDecorators: {
175
+ type: 'boolean'
176
+ },
177
+ enableTsLoader: {
178
+ type: 'boolean'
179
+ },
180
+ dataUriLimit: {
181
+ type: 'number'
182
+ },
183
+ templateParameters: {
184
+ type: 'object'
185
+ },
186
+ templateParametersByEntries: {
187
+ type: 'object',
188
+ patternProperties: {
189
+ [_constants.ENTRY_NAME_PATTERN]: {
190
+ type: 'object'
191
+ }
192
+ }
193
+ },
194
+ polyfill: {
195
+ type: 'string',
196
+ enum: ['usage', 'entry', 'off', 'ua']
197
+ },
198
+ cssModuleLocalIdentName: {
199
+ type: 'string'
200
+ },
201
+ federation: {
202
+ type: 'object'
203
+ },
204
+ disableNodePolyfill: {
205
+ type: 'boolean'
206
+ },
207
+ enableModernMode: {
208
+ type: 'boolean'
209
+ }
210
+ };
211
+ const server = {
212
+ routes: {
213
+ type: 'object'
214
+ },
215
+ publicRoutes: {
216
+ type: 'object'
217
+ },
218
+ ssr: {
219
+ type: ['boolean', 'object']
220
+ },
221
+ ssrByEntries: {
222
+ type: 'object'
223
+ },
224
+ baseUrl: {
225
+ anyOf: [{
226
+ type: 'string'
227
+ }, {
228
+ type: 'array',
229
+ items: {
230
+ type: 'string'
231
+ }
232
+ }]
233
+ },
234
+ port: {
235
+ type: 'number'
236
+ },
237
+ logger: {
238
+ type: ['boolean', 'object']
239
+ },
240
+ metrics: {
241
+ type: ['boolean', 'object']
242
+ },
243
+ enableMicroFrontendDebug: {
244
+ type: 'boolean'
245
+ },
246
+ watchOptions: {
247
+ type: 'object'
248
+ },
249
+ compiler: {
250
+ type: 'string'
251
+ },
252
+ disableFrameworkExt: {
253
+ type: 'boolean'
254
+ }
255
+ };
256
+ const dev = {
257
+ proxy: {
258
+ type: ['boolean', 'object']
259
+ }
260
+ };
261
+ const deploy = {
262
+ microFrontend: {
263
+ type: ['boolean', 'object']
264
+ }
265
+ };
266
+ const tools = {
267
+ tailwindcss: {
268
+ type: 'object'
269
+ },
270
+ jest: {
271
+ typeof: ['object', 'function']
272
+ },
273
+ esbuild: {
274
+ typeof: ['object']
275
+ }
276
+ };
277
+ const bff = {
278
+ prefix: {
279
+ type: 'string'
280
+ },
281
+ proxy: {
282
+ type: 'object',
283
+ additionalProperties: {
284
+ type: 'string'
285
+ }
286
+ }
287
+ };
288
+ const schema = new _Schema.Schema();
289
+ schema.setSchema('bff', bff).setSchema('dev', dev).setSchema('server', server).setSchema('source', source).setSchema('output', output).setSchema('tools', tools).setSchema('deploy', deploy);
290
+ var _default = schema;
291
+ exports.default = _default;
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _output = require("./output");
7
+ Object.keys(_output).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _output[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _output[key];
14
+ }
15
+ });
16
+ });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _hooks = require("./hooks");
7
+ Object.keys(_hooks).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _hooks[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _hooks[key];
14
+ }
15
+ });
16
+ });
17
+ var _config = require("./config");
18
+ Object.keys(_config).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _config[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _config[key];
25
+ }
26
+ });
27
+ });
28
+ var _legacyConfig = require("./legacyConfig");
29
+ Object.keys(_legacyConfig).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _legacyConfig[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _legacyConfig[key];
36
+ }
37
+ });
38
+ });
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
File without changes
File without changes
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getCommand = void 0;
7
-
8
7
  const getCommand = () => {
9
8
  const args = process.argv.slice(2);
10
9
  const command = args[0];
11
10
  return command;
12
11
  };
13
-
14
12
  exports.getCommand = getCommand;