@modern-js/app-tools 2.53.1-alpha.3 → 2.54.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. package/bin/modern.js +0 -2
  2. package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
  3. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +2 -2
  4. package/dist/cjs/commands/build.js +2 -0
  5. package/dist/cjs/commands/deploy.js +2 -2
  6. package/dist/cjs/commands/dev.js +19 -5
  7. package/dist/cjs/commands/index.js +113 -7
  8. package/dist/cjs/commands/serve.js +19 -5
  9. package/dist/cjs/hooks.js +5 -0
  10. package/dist/cjs/index.js +14 -83
  11. package/dist/cjs/plugins/analyze/constants.js +56 -0
  12. package/dist/cjs/{analyze → plugins/analyze}/generateCode.js +11 -84
  13. package/dist/cjs/{analyze → plugins/analyze}/getBundleEntry.js +11 -20
  14. package/dist/cjs/{analyze → plugins/analyze}/getFileSystemEntry.js +33 -47
  15. package/dist/cjs/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
  16. package/dist/cjs/{analyze → plugins/analyze}/index.js +9 -24
  17. package/dist/cjs/plugins/analyze/templates.js +101 -0
  18. package/dist/cjs/{analyze → plugins/analyze}/utils.js +12 -55
  19. package/dist/cjs/plugins/deploy/dependencies/index.js +16 -25
  20. package/dist/cjs/plugins/deploy/dependencies/utils.js +1 -2
  21. package/dist/cjs/plugins/deploy/platforms/netlify.js +5 -9
  22. package/dist/cjs/plugins/deploy/platforms/node.js +5 -13
  23. package/dist/cjs/plugins/deploy/platforms/vercel.js +5 -9
  24. package/dist/cjs/{initialize → plugins/initialize}/index.js +1 -1
  25. package/dist/cjs/plugins/serverBuild.js +10 -4
  26. package/dist/cjs/utils/createServer.js +1 -1
  27. package/dist/cjs/utils/{getServerInternalPlugins.js → loadPlugins.js} +18 -11
  28. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +4 -1
  29. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +2 -2
  30. package/dist/esm/commands/build.js +16 -9
  31. package/dist/esm/commands/deploy.js +2 -2
  32. package/dist/esm/commands/dev.js +13 -9
  33. package/dist/esm/commands/index.js +411 -3
  34. package/dist/esm/commands/serve.js +12 -8
  35. package/dist/esm/hooks.js +5 -0
  36. package/dist/esm/index.js +12 -394
  37. package/dist/esm/plugins/analyze/constants.js +24 -0
  38. package/dist/esm/{analyze → plugins/analyze}/generateCode.js +27 -169
  39. package/dist/esm/plugins/analyze/getBundleEntry.js +101 -0
  40. package/dist/esm/plugins/analyze/getFileSystemEntry.js +195 -0
  41. package/dist/esm/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
  42. package/dist/esm/{analyze → plugins/analyze}/index.js +42 -70
  43. package/dist/esm/plugins/analyze/templates.js +22 -0
  44. package/dist/esm/{analyze → plugins/analyze}/utils.js +13 -135
  45. package/dist/esm/plugins/deploy/dependencies/index.js +69 -94
  46. package/dist/esm/plugins/deploy/dependencies/utils.js +3 -4
  47. package/dist/esm/plugins/deploy/platforms/netlify.js +8 -10
  48. package/dist/esm/plugins/deploy/platforms/node.js +8 -14
  49. package/dist/esm/plugins/deploy/platforms/vercel.js +8 -10
  50. package/dist/esm/{initialize → plugins/initialize}/index.js +1 -1
  51. package/dist/esm/plugins/serverBuild.js +13 -6
  52. package/dist/esm/utils/createServer.js +2 -2
  53. package/dist/esm/utils/loadPlugins.js +64 -0
  54. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +2 -1
  55. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +2 -2
  56. package/dist/esm-node/commands/build.js +2 -0
  57. package/dist/esm-node/commands/deploy.js +2 -2
  58. package/dist/esm-node/commands/dev.js +11 -7
  59. package/dist/esm-node/commands/index.js +92 -3
  60. package/dist/esm-node/commands/serve.js +10 -6
  61. package/dist/esm-node/hooks.js +5 -0
  62. package/dist/esm-node/index.js +12 -79
  63. package/dist/esm-node/plugins/analyze/constants.js +24 -0
  64. package/dist/esm-node/{analyze → plugins/analyze}/generateCode.js +14 -87
  65. package/dist/esm-node/{analyze → plugins/analyze}/getBundleEntry.js +11 -20
  66. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +75 -0
  67. package/dist/esm-node/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
  68. package/dist/esm-node/{analyze → plugins/analyze}/index.js +10 -25
  69. package/dist/esm-node/plugins/analyze/templates.js +75 -0
  70. package/dist/esm-node/{analyze → plugins/analyze}/utils.js +13 -52
  71. package/dist/esm-node/plugins/deploy/dependencies/index.js +18 -27
  72. package/dist/esm-node/plugins/deploy/dependencies/utils.js +1 -2
  73. package/dist/esm-node/plugins/deploy/platforms/netlify.js +6 -10
  74. package/dist/esm-node/plugins/deploy/platforms/node.js +6 -14
  75. package/dist/esm-node/plugins/deploy/platforms/vercel.js +6 -10
  76. package/dist/esm-node/{initialize → plugins/initialize}/index.js +1 -1
  77. package/dist/esm-node/plugins/serverBuild.js +11 -5
  78. package/dist/esm-node/utils/createServer.js +2 -2
  79. package/dist/esm-node/utils/loadPlugins.js +21 -0
  80. package/dist/types/builder/builder-webpack/createCopyPattern.d.ts +2 -2
  81. package/dist/types/commands/index.d.ts +10 -3
  82. package/dist/types/config/initialize/inits.d.ts +1 -1
  83. package/dist/types/exports/server.d.ts +4 -0
  84. package/dist/types/index.d.ts +2 -5
  85. package/dist/types/plugins/analyze/constants.d.ts +9 -0
  86. package/dist/types/{analyze → plugins/analyze}/generateCode.d.ts +1 -1
  87. package/dist/types/plugins/analyze/getBundleEntry.d.ts +4 -0
  88. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +5 -0
  89. package/dist/types/{analyze → plugins/analyze}/getHtmlTemplate.d.ts +1 -1
  90. package/dist/types/{analyze → plugins/analyze}/getServerRoutes.d.ts +1 -1
  91. package/dist/types/{analyze → plugins/analyze}/index.d.ts +1 -1
  92. package/dist/types/plugins/analyze/templates.d.ts +19 -0
  93. package/dist/types/{analyze → plugins/analyze}/utils.d.ts +4 -6
  94. package/dist/types/plugins/deploy/dependencies/index.d.ts +1 -9
  95. package/dist/types/plugins/deploy/dependencies/utils.d.ts +1 -7
  96. package/dist/types/{initialize → plugins/initialize}/index.d.ts +1 -1
  97. package/dist/types/types/hooks.d.ts +11 -1
  98. package/dist/types/utils/loadPlugins.d.ts +5 -0
  99. package/package.json +22 -30
  100. package/dist/cjs/analyze/constants.js +0 -122
  101. package/dist/cjs/analyze/getClientRoutes/getRoutes.js +0 -197
  102. package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +0 -195
  103. package/dist/cjs/analyze/getClientRoutes/index.js +0 -31
  104. package/dist/cjs/analyze/getClientRoutes/utils.js +0 -59
  105. package/dist/cjs/analyze/makeLegalIdentifier.js +0 -37
  106. package/dist/cjs/analyze/nestedRoutes.js +0 -295
  107. package/dist/cjs/analyze/templates.js +0 -444
  108. package/dist/cjs/plugins/deploy/exports.js +0 -28
  109. package/dist/esm/analyze/constants.js +0 -76
  110. package/dist/esm/analyze/getBundleEntry.js +0 -75
  111. package/dist/esm/analyze/getClientRoutes/getRoutes.js +0 -185
  112. package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +0 -183
  113. package/dist/esm/analyze/getClientRoutes/index.js +0 -6
  114. package/dist/esm/analyze/getClientRoutes/utils.js +0 -28
  115. package/dist/esm/analyze/getFileSystemEntry.js +0 -113
  116. package/dist/esm/analyze/makeLegalIdentifier.js +0 -15
  117. package/dist/esm/analyze/nestedRoutes.js +0 -398
  118. package/dist/esm/analyze/templates.js +0 -435
  119. package/dist/esm/plugins/deploy/exports.js +0 -4
  120. package/dist/esm/utils/getServerInternalPlugins.js +0 -40
  121. package/dist/esm-node/analyze/constants.js +0 -76
  122. package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +0 -163
  123. package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +0 -161
  124. package/dist/esm-node/analyze/getClientRoutes/index.js +0 -6
  125. package/dist/esm-node/analyze/getClientRoutes/utils.js +0 -22
  126. package/dist/esm-node/analyze/getFileSystemEntry.js +0 -89
  127. package/dist/esm-node/analyze/makeLegalIdentifier.js +0 -13
  128. package/dist/esm-node/analyze/nestedRoutes.js +0 -259
  129. package/dist/esm-node/analyze/templates.js +0 -405
  130. package/dist/esm-node/plugins/deploy/exports.js +0 -4
  131. package/dist/esm-node/utils/getServerInternalPlugins.js +0 -15
  132. package/dist/js/modern/analyze/constants.js +0 -15
  133. package/dist/js/modern/analyze/generateCode.js +0 -179
  134. package/dist/js/modern/analyze/getBundleEntry.js +0 -75
  135. package/dist/js/modern/analyze/getClientRoutes.js +0 -219
  136. package/dist/js/modern/analyze/getFileSystemEntry.js +0 -74
  137. package/dist/js/modern/analyze/getHtmlTemplate.js +0 -82
  138. package/dist/js/modern/analyze/getServerRoutes.js +0 -192
  139. package/dist/js/modern/analyze/index.js +0 -148
  140. package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -32
  141. package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -16
  142. package/dist/js/modern/analyze/templates.js +0 -88
  143. package/dist/js/modern/analyze/utils.js +0 -92
  144. package/dist/js/modern/commands/build.js +0 -154
  145. package/dist/js/modern/commands/deploy.js +0 -5
  146. package/dist/js/modern/commands/dev.js +0 -95
  147. package/dist/js/modern/commands/index.js +0 -3
  148. package/dist/js/modern/commands/inspect.js +0 -69
  149. package/dist/js/modern/commands/start.js +0 -31
  150. package/dist/js/modern/exports/server.js +0 -1
  151. package/dist/js/modern/hooks.js +0 -21
  152. package/dist/js/modern/index.js +0 -109
  153. package/dist/js/modern/locale/en.js +0 -35
  154. package/dist/js/modern/locale/index.js +0 -9
  155. package/dist/js/modern/locale/zh.js +0 -35
  156. package/dist/js/modern/utils/config.js +0 -78
  157. package/dist/js/modern/utils/createCompiler.js +0 -61
  158. package/dist/js/modern/utils/createServer.js +0 -18
  159. package/dist/js/modern/utils/getSpecifiedEntries.js +0 -36
  160. package/dist/js/modern/utils/language.js +0 -5
  161. package/dist/js/modern/utils/printInstructions.js +0 -11
  162. package/dist/js/modern/utils/routes.js +0 -15
  163. package/dist/js/modern/utils/types.js +0 -0
  164. package/dist/js/node/analyze/constants.js +0 -36
  165. package/dist/js/node/analyze/generateCode.js +0 -208
  166. package/dist/js/node/analyze/getBundleEntry.js +0 -89
  167. package/dist/js/node/analyze/getClientRoutes.js +0 -241
  168. package/dist/js/node/analyze/getFileSystemEntry.js +0 -90
  169. package/dist/js/node/analyze/getHtmlTemplate.js +0 -106
  170. package/dist/js/node/analyze/getServerRoutes.js +0 -208
  171. package/dist/js/node/analyze/index.js +0 -178
  172. package/dist/js/node/analyze/isDefaultExportFunction.js +0 -50
  173. package/dist/js/node/analyze/makeLegalIdentifier.js +0 -24
  174. package/dist/js/node/analyze/templates.js +0 -106
  175. package/dist/js/node/analyze/utils.js +0 -113
  176. package/dist/js/node/commands/build.js +0 -174
  177. package/dist/js/node/commands/deploy.js +0 -14
  178. package/dist/js/node/commands/dev.js +0 -120
  179. package/dist/js/node/commands/index.js +0 -44
  180. package/dist/js/node/commands/inspect.js +0 -98
  181. package/dist/js/node/commands/start.js +0 -47
  182. package/dist/js/node/exports/server.js +0 -13
  183. package/dist/js/node/hooks.js +0 -39
  184. package/dist/js/node/index.js +0 -141
  185. package/dist/js/node/locale/en.js +0 -42
  186. package/dist/js/node/locale/index.js +0 -20
  187. package/dist/js/node/locale/zh.js +0 -42
  188. package/dist/js/node/utils/config.js +0 -103
  189. package/dist/js/node/utils/createCompiler.js +0 -81
  190. package/dist/js/node/utils/createServer.js +0 -35
  191. package/dist/js/node/utils/getSpecifiedEntries.js +0 -46
  192. package/dist/js/node/utils/language.js +0 -13
  193. package/dist/js/node/utils/printInstructions.js +0 -22
  194. package/dist/js/node/utils/routes.js +0 -25
  195. package/dist/js/node/utils/types.js +0 -0
  196. package/dist/types/analyze/constants.d.ts +0 -42
  197. package/dist/types/analyze/getBundleEntry.d.ts +0 -3
  198. package/dist/types/analyze/getClientRoutes/getRoutes.d.ts +0 -8
  199. package/dist/types/analyze/getClientRoutes/getRoutesLegacy.d.ts +0 -9
  200. package/dist/types/analyze/getClientRoutes/index.d.ts +0 -2
  201. package/dist/types/analyze/getClientRoutes/utils.d.ts +0 -5
  202. package/dist/types/analyze/getFileSystemEntry.d.ts +0 -4
  203. package/dist/types/analyze/makeLegalIdentifier.d.ts +0 -1
  204. package/dist/types/analyze/nestedRoutes.d.ts +0 -7
  205. package/dist/types/analyze/templates.d.ts +0 -30
  206. package/dist/types/plugins/deploy/exports.d.ts +0 -1
  207. package/dist/types/utils/getServerInternalPlugins.d.ts +0 -2
  208. /package/dist/cjs/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
  209. /package/dist/cjs/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
  210. /package/dist/esm/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
  211. /package/dist/esm/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
  212. /package/dist/esm-node/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
  213. /package/dist/esm-node/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
  214. /package/dist/types/{analyze → plugins/analyze}/isDefaultExportFunction.d.ts +0 -0
package/dist/esm/index.js CHANGED
@@ -4,273 +4,21 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
5
  import path from "path";
6
6
  import { lintPlugin } from "@modern-js/plugin-lint";
7
- import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE, newAction, upgradeAction } from "@modern-js/utils";
8
- import { castArray } from "@modern-js/utils/lodash";
7
+ import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE } from "@modern-js/utils";
9
8
  import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
10
- import analyzePlugin from "./analyze";
11
- import initializePlugin from "./initialize";
12
- import { hooks } from "./hooks";
13
- import { i18n, localeKeys } from "./locale";
9
+ import initializePlugin from "./plugins/initialize";
10
+ import analyzePlugin from "./plugins/analyze";
14
11
  import serverBuildPlugin from "./plugins/serverBuild";
15
12
  import deployPlugin from "./plugins/deploy";
13
+ import { hooks } from "./hooks";
14
+ import { i18n } from "./locale";
16
15
  import { restart } from "./utils/restart";
17
16
  import { generateWatchFiles } from "./utils/generateWatchFiles";
17
+ import { buildCommand, deployCommand, devCommand, inspectCommand, newCommand, serverCommand, upgradeCommand } from "./commands";
18
+ import { dev } from "./commands/dev";
18
19
  import { mergeConfig } from "@modern-js/core";
19
- import { dev } from "./commands";
20
20
  export * from "./defineConfig";
21
21
  export * from "./types";
22
- var devCommand = function() {
23
- var _ref = _async_to_generator(function(program, api) {
24
- var runner, devToolMetas, devProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, meta, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, subCmd;
25
- return _ts_generator(this, function(_state) {
26
- switch (_state.label) {
27
- case 0:
28
- runner = api.useHookRunners();
29
- return [
30
- 4,
31
- runner.registerDev()
32
- ];
33
- case 1:
34
- devToolMetas = _state.sent();
35
- devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(function() {
36
- var _ref2 = _async_to_generator(function(options) {
37
- var dev2;
38
- return _ts_generator(this, function(_state2) {
39
- switch (_state2.label) {
40
- case 0:
41
- return [
42
- 4,
43
- import("./commands/dev")
44
- ];
45
- case 1:
46
- dev2 = _state2.sent().dev;
47
- return [
48
- 4,
49
- dev2(api, options)
50
- ];
51
- case 2:
52
- _state2.sent();
53
- return [
54
- 2
55
- ];
56
- }
57
- });
58
- });
59
- return function(options) {
60
- return _ref2.apply(this, arguments);
61
- };
62
- }());
63
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
64
- try {
65
- for (_iterator = devToolMetas[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
66
- meta = _step.value;
67
- if (!meta.subCommands) {
68
- continue;
69
- }
70
- _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
71
- try {
72
- for (_iterator1 = meta.subCommands[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
73
- subCmd = _step1.value;
74
- devProgram.command(subCmd).action(/* @__PURE__ */ _async_to_generator(function() {
75
- var options, appDirectory, isTypescript;
76
- var _arguments = arguments;
77
- return _ts_generator(this, function(_state2) {
78
- switch (_state2.label) {
79
- case 0:
80
- options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
81
- appDirectory = api.useAppContext().appDirectory;
82
- return [
83
- 4,
84
- import("@modern-js/utils")
85
- ];
86
- case 1:
87
- isTypescript = _state2.sent().isTypescript;
88
- return [
89
- 4,
90
- runner.beforeDevTask(meta)
91
- ];
92
- case 2:
93
- _state2.sent();
94
- return [
95
- 4,
96
- meta.action(options, {
97
- isTsProject: isTypescript(appDirectory)
98
- })
99
- ];
100
- case 3:
101
- _state2.sent();
102
- return [
103
- 2
104
- ];
105
- }
106
- });
107
- }));
108
- }
109
- } catch (err) {
110
- _didIteratorError1 = true;
111
- _iteratorError1 = err;
112
- } finally {
113
- try {
114
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
115
- _iterator1.return();
116
- }
117
- } finally {
118
- if (_didIteratorError1) {
119
- throw _iteratorError1;
120
- }
121
- }
122
- }
123
- }
124
- } catch (err) {
125
- _didIteratorError = true;
126
- _iteratorError = err;
127
- } finally {
128
- try {
129
- if (!_iteratorNormalCompletion && _iterator.return != null) {
130
- _iterator.return();
131
- }
132
- } finally {
133
- if (_didIteratorError) {
134
- throw _iteratorError;
135
- }
136
- }
137
- }
138
- return [
139
- 2
140
- ];
141
- }
142
- });
143
- });
144
- return function devCommand2(program, api) {
145
- return _ref.apply(this, arguments);
146
- };
147
- }();
148
- var buildCommand = function() {
149
- var _ref = _async_to_generator(function(program, api) {
150
- var runner, platformBuilders, buildProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
151
- return _ts_generator(this, function(_state) {
152
- switch (_state.label) {
153
- case 0:
154
- runner = api.useHookRunners();
155
- return [
156
- 4,
157
- runner.registerBuildPlatform()
158
- ];
159
- case 1:
160
- platformBuilders = _state.sent();
161
- buildProgram = program.command("build").usage("[options]").description(i18n.t(localeKeys.command.build.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).action(function() {
162
- var _ref2 = _async_to_generator(function(options) {
163
- var build;
164
- return _ts_generator(this, function(_state2) {
165
- switch (_state2.label) {
166
- case 0:
167
- return [
168
- 4,
169
- import("./commands/build")
170
- ];
171
- case 1:
172
- build = _state2.sent().build;
173
- return [
174
- 4,
175
- build(api, options)
176
- ];
177
- case 2:
178
- _state2.sent();
179
- return [
180
- 2
181
- ];
182
- }
183
- });
184
- });
185
- return function(options) {
186
- return _ref2.apply(this, arguments);
187
- };
188
- }());
189
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
190
- try {
191
- _loop = function() {
192
- var platformBuilder = _step.value;
193
- var platforms = castArray(platformBuilder.platform);
194
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
195
- try {
196
- var _loop2 = function() {
197
- var platform = _step1.value;
198
- buildProgram.command(platform).action(/* @__PURE__ */ _async_to_generator(function() {
199
- var appDirectory, isTypescript;
200
- return _ts_generator(this, function(_state2) {
201
- switch (_state2.label) {
202
- case 0:
203
- appDirectory = api.useAppContext().appDirectory;
204
- return [
205
- 4,
206
- import("@modern-js/utils")
207
- ];
208
- case 1:
209
- isTypescript = _state2.sent().isTypescript;
210
- return [
211
- 4,
212
- runner.beforeBuildPlatform(platformBuilders)
213
- ];
214
- case 2:
215
- _state2.sent();
216
- return [
217
- 4,
218
- platformBuilder.build(platform, {
219
- isTsProject: isTypescript(appDirectory)
220
- })
221
- ];
222
- case 3:
223
- _state2.sent();
224
- return [
225
- 2
226
- ];
227
- }
228
- });
229
- }));
230
- };
231
- for (var _iterator2 = platforms[Symbol.iterator](), _step1; !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = true)
232
- _loop2();
233
- } catch (err) {
234
- _didIteratorError2 = true;
235
- _iteratorError2 = err;
236
- } finally {
237
- try {
238
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
239
- _iterator2.return();
240
- }
241
- } finally {
242
- if (_didIteratorError2) {
243
- throw _iteratorError2;
244
- }
245
- }
246
- }
247
- };
248
- for (_iterator = platformBuilders[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)
249
- _loop();
250
- } catch (err) {
251
- _didIteratorError = true;
252
- _iteratorError = err;
253
- } finally {
254
- try {
255
- if (!_iteratorNormalCompletion && _iterator.return != null) {
256
- _iterator.return();
257
- }
258
- } finally {
259
- if (_didIteratorError) {
260
- throw _iteratorError;
261
- }
262
- }
263
- }
264
- return [
265
- 2
266
- ];
267
- }
268
- });
269
- });
270
- return function buildCommand2(program, api) {
271
- return _ref.apply(this, arguments);
272
- };
273
- }();
274
22
  var appTools = function() {
275
23
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
276
24
  bundler: "webpack"
@@ -345,139 +93,11 @@ var appTools = function() {
345
93
  ];
346
94
  case 2:
347
95
  _state.sent();
348
- program.command("serve").usage("[options]").description(i18n.t(localeKeys.command.serve.describe)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(/* @__PURE__ */ _async_to_generator(function() {
349
- var start;
350
- return _ts_generator(this, function(_state2) {
351
- switch (_state2.label) {
352
- case 0:
353
- return [
354
- 4,
355
- import("./commands/serve")
356
- ];
357
- case 1:
358
- start = _state2.sent().start;
359
- return [
360
- 4,
361
- start(api)
362
- ];
363
- case 2:
364
- _state2.sent();
365
- return [
366
- 2
367
- ];
368
- }
369
- });
370
- }));
371
- program.command("deploy").usage("[options]").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-s --skip-build", i18n.t(localeKeys.command.shared.skipBuild)).description(i18n.t(localeKeys.command.deploy.describe)).action(function() {
372
- var _ref = _async_to_generator(function(options2) {
373
- var build, deploy;
374
- return _ts_generator(this, function(_state2) {
375
- switch (_state2.label) {
376
- case 0:
377
- if (!!options2.skipBuild)
378
- return [
379
- 3,
380
- 3
381
- ];
382
- return [
383
- 4,
384
- import("./commands/build")
385
- ];
386
- case 1:
387
- build = _state2.sent().build;
388
- return [
389
- 4,
390
- build(api)
391
- ];
392
- case 2:
393
- _state2.sent();
394
- _state2.label = 3;
395
- case 3:
396
- return [
397
- 4,
398
- import("./commands/deploy")
399
- ];
400
- case 4:
401
- deploy = _state2.sent().deploy;
402
- return [
403
- 4,
404
- deploy(api, options2)
405
- ];
406
- case 5:
407
- _state2.sent();
408
- process.exit(0);
409
- return [
410
- 2
411
- ];
412
- }
413
- });
414
- });
415
- return function(options2) {
416
- return _ref.apply(this, arguments);
417
- };
418
- }());
419
- program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(function() {
420
- var _ref = _async_to_generator(function(options2) {
421
- return _ts_generator(this, function(_state2) {
422
- switch (_state2.label) {
423
- case 0:
424
- return [
425
- 4,
426
- newAction(_object_spread_props(_object_spread({}, options2), {
427
- locale: options2.lang || locale
428
- }), "mwa")
429
- ];
430
- case 1:
431
- _state2.sent();
432
- return [
433
- 2
434
- ];
435
- }
436
- });
437
- });
438
- return function(options2) {
439
- return _ref.apply(this, arguments);
440
- };
441
- }());
442
- program.command("inspect").description("inspect the internal configs").option("--env <env>", i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "/").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(function() {
443
- var _ref = _async_to_generator(function(options2) {
444
- var inspect;
445
- return _ts_generator(this, function(_state2) {
446
- switch (_state2.label) {
447
- case 0:
448
- return [
449
- 4,
450
- import("./commands/inspect")
451
- ];
452
- case 1:
453
- inspect = _state2.sent().inspect;
454
- inspect(api, options2);
455
- return [
456
- 2
457
- ];
458
- }
459
- });
460
- });
461
- return function(options2) {
462
- return _ref.apply(this, arguments);
463
- };
464
- }());
465
- program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(/* @__PURE__ */ _async_to_generator(function() {
466
- return _ts_generator(this, function(_state2) {
467
- switch (_state2.label) {
468
- case 0:
469
- return [
470
- 4,
471
- upgradeAction()
472
- ];
473
- case 1:
474
- _state2.sent();
475
- return [
476
- 2
477
- ];
478
- }
479
- });
480
- }));
96
+ serverCommand(program, api);
97
+ deployCommand(program, api);
98
+ newCommand(program, locale);
99
+ inspectCommand(program, api);
100
+ upgradeCommand(program);
481
101
  return [
482
102
  2
483
103
  ];
@@ -654,9 +274,7 @@ var appTools = function() {
654
274
  var src_default = appTools;
655
275
  export {
656
276
  appTools,
657
- buildCommand,
658
277
  src_default as default,
659
278
  dev,
660
- devCommand,
661
279
  mergeConfig
662
280
  };
@@ -0,0 +1,24 @@
1
+ var INDEX_FILE_NAME = "index";
2
+ var FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
3
+ var ENTRY_POINT_FILE_NAME = "index.jsx";
4
+ var ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.jsx";
5
+ var HTML_PARTIALS_FOLDER = "html";
6
+ var HTML_PARTIALS_EXTENSIONS = [
7
+ ".htm",
8
+ ".html",
9
+ ".ejs"
10
+ ];
11
+ var APP_CONFIG_NAME = "config";
12
+ var APP_INIT_EXPORTED = "init";
13
+ var APP_INIT_IMPORTED = "appInit";
14
+ export {
15
+ APP_CONFIG_NAME,
16
+ APP_INIT_EXPORTED,
17
+ APP_INIT_IMPORTED,
18
+ ENTRY_BOOTSTRAP_FILE_NAME,
19
+ ENTRY_POINT_FILE_NAME,
20
+ FILE_SYSTEM_ROUTES_FILE_NAME,
21
+ HTML_PARTIALS_EXTENSIONS,
22
+ HTML_PARTIALS_FOLDER,
23
+ INDEX_FILE_NAME
24
+ };