@modern-js/app-tools 2.0.0-beta.3 → 2.0.0-beta.4

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 (230) hide show
  1. package/CHANGELOG.md +305 -0
  2. package/bin/modern.js +1 -0
  3. package/dist/js/modern/analyze/Builder.js +39 -0
  4. package/dist/js/modern/analyze/constants.js +38 -18
  5. package/dist/js/modern/analyze/generateCode.js +262 -221
  6. package/dist/js/modern/analyze/getBundleEntry.js +34 -32
  7. package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +93 -49
  8. package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +89 -47
  9. package/dist/js/modern/analyze/getClientRoutes/index.js +6 -2
  10. package/dist/js/modern/analyze/getClientRoutes/utils.js +23 -10
  11. package/dist/js/modern/analyze/getFileSystemEntry.js +43 -22
  12. package/dist/js/modern/analyze/getHtmlTemplate.js +89 -49
  13. package/dist/js/modern/analyze/getServerRoutes.js +122 -126
  14. package/dist/js/modern/analyze/index.js +201 -160
  15. package/dist/js/modern/analyze/isDefaultExportFunction.js +30 -16
  16. package/dist/js/modern/analyze/makeLegalIdentifier.js +10 -11
  17. package/dist/js/modern/analyze/nestedRoutes.js +106 -60
  18. package/dist/js/modern/analyze/templates.js +163 -81
  19. package/dist/js/modern/analyze/utils.js +87 -66
  20. package/dist/js/modern/builder/builderPlugins/compatModern.js +122 -109
  21. package/dist/js/modern/builder/index.js +123 -86
  22. package/dist/js/modern/builder/loaders/routerLoader.js +9 -12
  23. package/dist/js/modern/builder/loaders/serverModuleLoader.js +4 -1
  24. package/dist/js/modern/builder/share.js +23 -21
  25. package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +23 -22
  26. package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +31 -27
  27. package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +100 -84
  28. package/dist/js/modern/commands/build.js +67 -42
  29. package/dist/js/modern/commands/deploy.js +27 -4
  30. package/dist/js/modern/commands/dev.js +77 -27
  31. package/dist/js/modern/commands/index.js +1 -1
  32. package/dist/js/modern/commands/inspect.js +30 -5
  33. package/dist/js/modern/commands/start.js +37 -15
  34. package/dist/js/modern/config/default.js +103 -113
  35. package/dist/js/modern/config/index.js +8 -2
  36. package/dist/js/modern/config/initial/createHtmlConfig.js +5 -2
  37. package/dist/js/modern/config/initial/createOutputConfig.js +9 -10
  38. package/dist/js/modern/config/initial/createSourceConfig.js +5 -2
  39. package/dist/js/modern/config/initial/createToolsConfig.js +7 -6
  40. package/dist/js/modern/config/initial/index.js +9 -4
  41. package/dist/js/modern/config/initial/inits.js +109 -73
  42. package/dist/js/modern/config/initial/transformNormalizedConfig.js +6 -3
  43. package/dist/js/modern/defineConfig.js +26 -11
  44. package/dist/js/modern/exports/server.js +4 -1
  45. package/dist/js/modern/hooks.js +15 -4
  46. package/dist/js/modern/index.js +178 -90
  47. package/dist/js/modern/initialize/index.js +98 -51
  48. package/dist/js/modern/locale/en.js +20 -21
  49. package/dist/js/modern/locale/index.js +6 -6
  50. package/dist/js/modern/locale/zh.js +21 -22
  51. package/dist/js/modern/schema/Schema.js +6 -5
  52. package/dist/js/modern/schema/index.js +51 -100
  53. package/dist/js/modern/schema/legacy.js +96 -231
  54. package/dist/js/modern/types/config/index.js +0 -1
  55. package/dist/js/modern/types/index.js +0 -1
  56. package/dist/js/modern/types/legacyConfig/output.js +0 -1
  57. package/dist/js/modern/utils/commands.js +5 -2
  58. package/dist/js/modern/utils/config.js +102 -41
  59. package/dist/js/modern/utils/createFileWatcher.js +84 -51
  60. package/dist/js/modern/utils/createServer.js +63 -17
  61. package/dist/js/modern/utils/getSpecifiedEntries.js +46 -19
  62. package/dist/js/modern/utils/language.js +6 -3
  63. package/dist/js/modern/utils/printInstructions.js +27 -8
  64. package/dist/js/modern/utils/restart.js +43 -16
  65. package/dist/js/modern/utils/routes.js +29 -12
  66. package/dist/js/node/analyze/Builder.js +58 -0
  67. package/dist/js/node/analyze/constants.js +54 -39
  68. package/dist/js/node/analyze/generateCode.js +282 -239
  69. package/dist/js/node/analyze/getBundleEntry.js +58 -44
  70. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +132 -76
  71. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +128 -74
  72. package/dist/js/node/analyze/getClientRoutes/index.js +23 -17
  73. package/dist/js/node/analyze/getClientRoutes/utils.js +44 -21
  74. package/dist/js/node/analyze/getFileSystemEntry.js +70 -39
  75. package/dist/js/node/analyze/getHtmlTemplate.js +116 -61
  76. package/dist/js/node/analyze/getServerRoutes.js +143 -137
  77. package/dist/js/node/analyze/index.js +247 -174
  78. package/dist/js/node/analyze/isDefaultExportFunction.js +55 -26
  79. package/dist/js/node/analyze/makeLegalIdentifier.js +27 -15
  80. package/dist/js/node/analyze/nestedRoutes.js +137 -75
  81. package/dist/js/node/analyze/templates.js +185 -90
  82. package/dist/js/node/analyze/utils.js +114 -81
  83. package/dist/js/node/builder/builderPlugins/compatModern.js +150 -122
  84. package/dist/js/node/builder/index.js +151 -95
  85. package/dist/js/node/builder/loaders/routerLoader.js +27 -18
  86. package/dist/js/node/builder/loaders/serverModuleLoader.js +22 -7
  87. package/dist/js/node/builder/share.js +46 -26
  88. package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +39 -26
  89. package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +47 -31
  90. package/dist/js/node/builder/webpackPlugins/routerPlugin.js +118 -90
  91. package/dist/js/node/commands/build.js +89 -52
  92. package/dist/js/node/commands/deploy.js +45 -10
  93. package/dist/js/node/commands/dev.js +99 -41
  94. package/dist/js/node/commands/index.js +19 -38
  95. package/dist/js/node/commands/inspect.js +48 -11
  96. package/dist/js/node/commands/start.js +65 -26
  97. package/dist/js/node/config/default.js +119 -117
  98. package/dist/js/node/config/index.js +25 -29
  99. package/dist/js/node/config/initial/createHtmlConfig.js +22 -6
  100. package/dist/js/node/config/initial/createOutputConfig.js +26 -14
  101. package/dist/js/node/config/initial/createSourceConfig.js +22 -6
  102. package/dist/js/node/config/initial/createToolsConfig.js +24 -10
  103. package/dist/js/node/config/initial/index.js +28 -17
  104. package/dist/js/node/config/initial/inits.js +126 -81
  105. package/dist/js/node/config/initial/transformNormalizedConfig.js +31 -15
  106. package/dist/js/node/defineConfig.js +43 -17
  107. package/dist/js/node/exports/server.js +21 -10
  108. package/dist/js/node/hooks.js +48 -29
  109. package/dist/js/node/index.js +225 -128
  110. package/dist/js/node/initialize/index.js +116 -61
  111. package/dist/js/node/locale/en.js +36 -25
  112. package/dist/js/node/locale/index.js +27 -15
  113. package/dist/js/node/locale/zh.js +37 -26
  114. package/dist/js/node/schema/Schema.js +23 -10
  115. package/dist/js/node/schema/index.js +77 -114
  116. package/dist/js/node/schema/legacy.js +117 -240
  117. package/dist/js/node/types/config/index.js +17 -16
  118. package/dist/js/node/types/index.js +19 -38
  119. package/dist/js/node/types/legacyConfig/output.js +0 -5
  120. package/dist/js/node/utils/commands.js +21 -6
  121. package/dist/js/node/utils/config.js +120 -51
  122. package/dist/js/node/utils/createFileWatcher.js +104 -61
  123. package/dist/js/node/utils/createServer.js +86 -25
  124. package/dist/js/node/utils/getSpecifiedEntries.js +64 -25
  125. package/dist/js/node/utils/language.js +24 -8
  126. package/dist/js/node/utils/printInstructions.js +47 -16
  127. package/dist/js/node/utils/restart.js +61 -21
  128. package/dist/js/node/utils/routes.js +53 -18
  129. package/dist/js/treeshaking/analyze/Builder.js +199 -0
  130. package/dist/js/treeshaking/analyze/constants.js +28 -18
  131. package/dist/js/treeshaking/analyze/generateCode.js +600 -406
  132. package/dist/js/treeshaking/analyze/getBundleEntry.js +55 -63
  133. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +214 -168
  134. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +215 -169
  135. package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -2
  136. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +19 -20
  137. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +89 -86
  138. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +298 -125
  139. package/dist/js/treeshaking/analyze/getServerRoutes.js +210 -147
  140. package/dist/js/treeshaking/analyze/index.js +571 -304
  141. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +45 -26
  142. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -16
  143. package/dist/js/treeshaking/analyze/nestedRoutes.js +411 -200
  144. package/dist/js/treeshaking/analyze/templates.js +433 -236
  145. package/dist/js/treeshaking/analyze/utils.js +358 -153
  146. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +282 -200
  147. package/dist/js/treeshaking/builder/index.js +371 -165
  148. package/dist/js/treeshaking/builder/loaders/routerLoader.js +11 -12
  149. package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +3 -2
  150. package/dist/js/treeshaking/builder/share.js +38 -44
  151. package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +108 -44
  152. package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +70 -39
  153. package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +334 -112
  154. package/dist/js/treeshaking/commands/build.js +286 -88
  155. package/dist/js/treeshaking/commands/deploy.js +153 -25
  156. package/dist/js/treeshaking/commands/dev.js +318 -131
  157. package/dist/js/treeshaking/commands/index.js +1 -1
  158. package/dist/js/treeshaking/commands/inspect.js +147 -32
  159. package/dist/js/treeshaking/commands/start.js +190 -67
  160. package/dist/js/treeshaking/config/default.js +210 -198
  161. package/dist/js/treeshaking/config/index.js +3 -2
  162. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -31
  163. package/dist/js/treeshaking/config/initial/createOutputConfig.js +43 -70
  164. package/dist/js/treeshaking/config/initial/createSourceConfig.js +37 -40
  165. package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -38
  166. package/dist/js/treeshaking/config/initial/index.js +10 -9
  167. package/dist/js/treeshaking/config/initial/inits.js +205 -106
  168. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +27 -34
  169. package/dist/js/treeshaking/defineConfig.js +60 -13
  170. package/dist/js/treeshaking/exports/server.js +2 -1
  171. package/dist/js/treeshaking/hooks.js +30 -25
  172. package/dist/js/treeshaking/index.js +681 -256
  173. package/dist/js/treeshaking/initialize/index.js +290 -112
  174. package/dist/js/treeshaking/locale/en.js +34 -33
  175. package/dist/js/treeshaking/locale/index.js +5 -5
  176. package/dist/js/treeshaking/locale/zh.js +34 -33
  177. package/dist/js/treeshaking/schema/Schema.js +267 -69
  178. package/dist/js/treeshaking/schema/index.js +165 -121
  179. package/dist/js/treeshaking/schema/legacy.js +323 -256
  180. package/dist/js/treeshaking/types/config/deploy.js +1 -0
  181. package/dist/js/treeshaking/types/config/dev.js +1 -0
  182. package/dist/js/treeshaking/types/config/experiments.js +1 -0
  183. package/dist/js/treeshaking/types/config/html.js +1 -0
  184. package/dist/js/treeshaking/types/config/index.js +0 -1
  185. package/dist/js/treeshaking/types/config/output.js +1 -0
  186. package/dist/js/treeshaking/types/config/performance.js +1 -0
  187. package/dist/js/treeshaking/types/config/security.js +1 -0
  188. package/dist/js/treeshaking/types/config/source.js +1 -0
  189. package/dist/js/treeshaking/types/config/tools.js +1 -0
  190. package/dist/js/treeshaking/types/hooks.js +1 -0
  191. package/dist/js/treeshaking/types/index.js +0 -1
  192. package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
  193. package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
  194. package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
  195. package/dist/js/treeshaking/types/legacyConfig/output.js +1 -1
  196. package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
  197. package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
  198. package/dist/js/treeshaking/utils/commands.js +6 -5
  199. package/dist/js/treeshaking/utils/config.js +295 -117
  200. package/dist/js/treeshaking/utils/createFileWatcher.js +278 -118
  201. package/dist/js/treeshaking/utils/createServer.js +252 -67
  202. package/dist/js/treeshaking/utils/getSpecifiedEntries.js +182 -55
  203. package/dist/js/treeshaking/utils/language.js +6 -5
  204. package/dist/js/treeshaking/utils/printInstructions.js +151 -29
  205. package/dist/js/treeshaking/utils/restart.js +184 -42
  206. package/dist/js/treeshaking/utils/routes.js +151 -27
  207. package/dist/js/treeshaking/utils/types.js +1 -0
  208. package/dist/types/analyze/Builder.d.ts +8 -0
  209. package/dist/types/analyze/index.d.ts +2 -0
  210. package/dist/types/analyze/templates.d.ts +3 -1
  211. package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -1
  212. package/dist/types/builder/index.d.ts +3 -3
  213. package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +1 -7
  214. package/dist/types/defineConfig.d.ts +1 -0
  215. package/dist/types/index.d.ts +6 -1
  216. package/dist/types/initialize/index.d.ts +2 -0
  217. package/dist/types/types/config/dev.d.ts +2 -2
  218. package/dist/types/types/config/index.d.ts +1 -0
  219. package/dist/types/types/config/output.d.ts +0 -1
  220. package/dist/types/types/config/source.d.ts +1 -0
  221. package/dist/types/types/config/tools.d.ts +2 -0
  222. package/dist/types/types/hooks.d.ts +5 -0
  223. package/dist/types/types/legacyConfig/dev.d.ts +1 -0
  224. package/dist/types/types/legacyConfig/output.d.ts +1 -1
  225. package/dist/types/types/legacyConfig/source.d.ts +1 -0
  226. package/dist/types/types/legacyConfig/tools.d.ts +1 -0
  227. package/dist/types/utils/config.d.ts +1 -0
  228. package/dist/types/utils/createServer.d.ts +1 -0
  229. package/dist/types/utils/restart.d.ts +1 -1
  230. package/package.json +23 -22
@@ -1,69 +1,192 @@
1
- import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- import { logger, chalk, isApiOnly } from '@modern-js/utils';
4
- import server from '@modern-js/prod-server';
5
- import { printInstructions } from "../utils/printInstructions";
6
- import { injectDataLoaderPlugin } from "../utils/createServer";
7
- export var start = /*#__PURE__*/function () {
8
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(api) {
9
- var _userConfig$source;
10
- var appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, app;
11
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
12
- while (1) {
13
- switch (_context2.prev = _context2.next) {
14
- case 0:
15
- appContext = api.useAppContext();
16
- userConfig = api.useResolvedConfigContext();
17
- hookRunners = api.useHookRunners();
18
- appDirectory = appContext.appDirectory, port = appContext.port, serverConfigFile = appContext.serverConfigFile;
19
- logger.log(chalk.cyan("Starting the modern server..."));
20
- _context2.next = 7;
21
- return isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.entriesDir);
22
- case 7:
23
- apiOnly = _context2.sent;
24
- _context2.next = 10;
25
- return server({
26
- pwd: appDirectory,
27
- config: userConfig,
28
- serverConfigFile: serverConfigFile,
29
- internalPlugins: injectDataLoaderPlugin(appContext.serverInternalPlugins),
30
- apiOnly: apiOnly
31
- });
32
- case 10:
33
- app = _context2.sent;
34
- app.listen(port, /*#__PURE__*/function () {
35
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err) {
36
- return _regeneratorRuntime().wrap(function _callee$(_context) {
37
- while (1) {
38
- switch (_context.prev = _context.next) {
39
- case 0:
40
- if (!err) {
41
- _context.next = 2;
42
- break;
43
- }
44
- throw err;
45
- case 2:
46
- _context.next = 4;
47
- return printInstructions(hookRunners, appContext, userConfig);
48
- case 4:
49
- case "end":
50
- return _context.stop();
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) {
10
+ resolve(value);
11
+ } else {
12
+ Promise.resolve(value).then(_next, _throw);
13
+ }
14
+ }
15
+ function _asyncToGenerator(fn) {
16
+ return function() {
17
+ var self = this, args = arguments;
18
+ return new Promise(function(resolve, reject) {
19
+ var gen = fn.apply(self, args);
20
+ function _next(value) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
+ }
23
+ function _throw(err) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
+ }
26
+ _next(undefined);
27
+ });
28
+ };
29
+ }
30
+ var __generator = this && this.__generator || function(thisArg, body) {
31
+ var f, y, t, g, _ = {
32
+ label: 0,
33
+ sent: function() {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ };
40
+ return(g = {
41
+ next: verb(0),
42
+ "throw": verb(1),
43
+ "return": verb(2)
44
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
+ return this;
46
+ }), g);
47
+ function verb(n) {
48
+ return function(v) {
49
+ return step([
50
+ n,
51
+ v
52
+ ]);
53
+ };
54
+ }
55
+ function step(op) {
56
+ if (f) throw new TypeError("Generator is already executing.");
57
+ while(_)try {
58
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59
+ if (y = 0, t) op = [
60
+ op[0] & 2,
61
+ t.value
62
+ ];
63
+ switch(op[0]){
64
+ case 0:
65
+ case 1:
66
+ t = op;
67
+ break;
68
+ case 4:
69
+ _.label++;
70
+ return {
71
+ value: op[1],
72
+ done: false
73
+ };
74
+ case 5:
75
+ _.label++;
76
+ y = op[1];
77
+ op = [
78
+ 0
79
+ ];
80
+ continue;
81
+ case 7:
82
+ op = _.ops.pop();
83
+ _.trys.pop();
84
+ continue;
85
+ default:
86
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
87
+ _ = 0;
88
+ continue;
89
+ }
90
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
91
+ _.label = op[1];
92
+ break;
93
+ }
94
+ if (op[0] === 6 && _.label < t[1]) {
95
+ _.label = t[1];
96
+ t = op;
97
+ break;
51
98
  }
52
- }
53
- }, _callee);
54
- }));
55
- return function (_x2) {
56
- return _ref2.apply(this, arguments);
57
- };
58
- }());
59
- case 12:
60
- case "end":
61
- return _context2.stop();
99
+ if (t && _.label < t[2]) {
100
+ _.label = t[2];
101
+ _.ops.push(op);
102
+ break;
103
+ }
104
+ if (t[2]) _.ops.pop();
105
+ _.trys.pop();
106
+ continue;
107
+ }
108
+ op = body.call(thisArg, _);
109
+ } catch (e) {
110
+ op = [
111
+ 6,
112
+ e
113
+ ];
114
+ y = 0;
115
+ } finally{
116
+ f = t = 0;
62
117
  }
63
- }
64
- }, _callee2);
65
- }));
66
- return function start(_x) {
67
- return _ref.apply(this, arguments);
68
- };
69
- }();
118
+ if (op[0] & 5) throw op[1];
119
+ return {
120
+ value: op[0] ? op[1] : void 0,
121
+ done: true
122
+ };
123
+ }
124
+ };
125
+ import { logger, chalk, isApiOnly } from "@modern-js/utils";
126
+ import server from "@modern-js/prod-server";
127
+ import { printInstructions } from "../utils/printInstructions";
128
+ import { injectDataLoaderPlugin } from "../utils/createServer";
129
+ var start = function() {
130
+ var _ref = _asyncToGenerator(function(api) {
131
+ var ref, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, app;
132
+ return __generator(this, function(_state) {
133
+ switch(_state.label){
134
+ case 0:
135
+ appContext = api.useAppContext();
136
+ userConfig = api.useResolvedConfigContext();
137
+ hookRunners = api.useHookRunners();
138
+ appDirectory = appContext.appDirectory, port = appContext.port, serverConfigFile = appContext.serverConfigFile;
139
+ logger.log(chalk.cyan("Starting the modern server..."));
140
+ return [
141
+ 4,
142
+ isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (ref = userConfig.source) === null || ref === void 0 ? void 0 : ref.entriesDir)
143
+ ];
144
+ case 1:
145
+ apiOnly = _state.sent();
146
+ return [
147
+ 4,
148
+ server({
149
+ pwd: appDirectory,
150
+ config: userConfig,
151
+ serverConfigFile: serverConfigFile,
152
+ internalPlugins: injectDataLoaderPlugin(appContext.serverInternalPlugins),
153
+ apiOnly: apiOnly
154
+ })
155
+ ];
156
+ case 2:
157
+ app = _state.sent();
158
+ app.listen(port, function() {
159
+ var _ref = _asyncToGenerator(function(err) {
160
+ return __generator(this, function(_state) {
161
+ switch(_state.label){
162
+ case 0:
163
+ if (err) {
164
+ throw err;
165
+ }
166
+ return [
167
+ 4,
168
+ printInstructions(hookRunners, appContext, userConfig)
169
+ ];
170
+ case 1:
171
+ _state.sent();
172
+ return [
173
+ 2
174
+ ];
175
+ }
176
+ });
177
+ });
178
+ return function(err) {
179
+ return _ref.apply(this, arguments);
180
+ };
181
+ }());
182
+ return [
183
+ 2
184
+ ];
185
+ }
186
+ });
187
+ });
188
+ return function start(api) {
189
+ return _ref.apply(this, arguments);
190
+ };
191
+ }();
192
+ export { start };
@@ -1,199 +1,211 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- export function createDefaultConfig(appContext) {
3
- var _ref;
4
- var defaultAlias = appContext ? (_ref = {}, _defineProperty(_ref, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_ref, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_ref, '@', appContext.srcDirectory), _defineProperty(_ref, '@shared', appContext.sharedDirectory), _ref) : {};
5
- var source = {
6
- entries: undefined,
7
- enableAsyncEntry: false,
8
- disableDefaultEntries: false,
9
- entriesDir: './src',
10
- configDir: './config',
11
- globalVars: undefined,
12
- moduleScopes: undefined,
13
- include: [],
14
- alias: defaultAlias
15
- };
16
- var output = {
17
- assetPrefix: '/',
18
- distPath: {
19
- html: 'html',
20
- js: 'static/js',
21
- css: 'static/css',
22
- media: 'static/media',
23
- root: 'dist'
24
- },
25
- copy: undefined,
26
- disableCssModuleExtension: false,
27
- enableCssModuleTSDeclaration: false,
28
- disableMinimize: false,
29
- enableInlineStyles: false,
30
- enableInlineScripts: false,
31
- disableSourceMap: false,
32
- disableInlineRuntimeChunk: false,
33
- disableFilenameHash: false,
34
- enableLatestDecorators: false,
35
- polyfill: 'entry',
36
- cssModuleLocalIdentName: undefined
37
- };
38
- var html = {
39
- title: '',
40
- titleByEntries: undefined,
41
- meta: {
42
- charset: {
43
- charset: 'utf-8'
44
- },
45
- viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
46
- 'http-equiv': {
47
- 'http-equiv': 'x-ua-compatible',
48
- content: 'ie=edge'
49
- },
50
- renderer: 'webkit',
51
- layoutmode: 'standard',
52
- imagemode: 'force',
53
- 'wap-font-scale': 'no',
54
- 'format-detection': 'telephone=no'
55
- },
56
- metaByEntries: undefined,
57
- inject: 'head',
58
- injectByEntries: undefined,
59
- mountId: 'root',
60
- favicon: '',
61
- faviconByEntries: undefined,
62
- disableHtmlFolder: false,
63
- templateParameters: {},
64
- templateParametersByEntries: undefined
65
- };
66
- var server = {
67
- routes: undefined,
68
- publicRoutes: undefined,
69
- ssr: undefined,
70
- ssrByEntries: undefined,
71
- baseUrl: '/',
72
- port: 8080
73
- };
74
- var dev = {
75
- assetPrefix: false,
76
- https: false
77
- };
78
- var tools = {
79
- webpack: undefined,
80
- babel: undefined,
81
- postcss: undefined,
82
- autoprefixer: undefined,
83
- devServer: undefined,
84
- tsLoader: undefined,
85
- terser: undefined,
86
- minifyCss: undefined
87
- };
88
- return {
89
- source: source,
90
- output: output,
91
- server: server,
92
- dev: dev,
93
- html: html,
94
- tools: tools,
95
- plugins: [],
96
- runtime: {},
97
- runtimeByEntries: {}
98
- };
1
+ function _defineProperty(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
99
13
  }
100
- export function createLegacyDefaultConfig(appContext) {
101
- var _ref2;
102
- var defaultAlias = appContext ? (_ref2 = {}, _defineProperty(_ref2, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_ref2, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_ref2, '@', appContext.srcDirectory), _defineProperty(_ref2, '@shared', appContext.sharedDirectory), _ref2) : {};
103
- var sourceDefaults = {
104
- entries: undefined,
105
- enableAsyncEntry: false,
106
- disableDefaultEntries: false,
107
- entriesDir: './src',
108
- configDir: './config',
109
- apiDir: './api',
110
- envVars: [],
111
- globalVars: undefined,
112
- alias: defaultAlias,
113
- moduleScopes: undefined,
114
- include: []
115
- };
116
- var outputDefaults = {
117
- assetPrefix: '/',
118
- htmlPath: 'html',
119
- jsPath: 'static/js',
120
- cssPath: 'static/css',
121
- mediaPath: 'static/media',
122
- path: 'dist',
123
- title: '',
124
- titleByEntries: undefined,
125
- meta: {
126
- charset: {
127
- charset: 'utf-8'
128
- },
129
- viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
130
- 'http-equiv': {
131
- 'http-equiv': 'x-ua-compatible',
132
- content: 'ie=edge'
133
- },
134
- renderer: 'webkit',
135
- layoutmode: 'standard',
136
- imagemode: 'force',
137
- 'wap-font-scale': 'no',
138
- 'format-detection': 'telephone=no'
139
- },
140
- metaByEntries: undefined,
141
- inject: 'head',
142
- injectByEntries: undefined,
143
- mountId: 'root',
144
- favicon: '',
145
- faviconByEntries: undefined,
146
- copy: undefined,
147
- disableHtmlFolder: false,
148
- disableCssModuleExtension: false,
149
- disableCssExtract: false,
150
- enableCssModuleTSDeclaration: false,
151
- disableMinimize: false,
152
- enableInlineStyles: false,
153
- enableInlineScripts: false,
154
- disableSourceMap: false,
155
- disableInlineRuntimeChunk: false,
156
- disableAssetsCache: false,
157
- enableLatestDecorators: false,
158
- polyfill: 'entry',
159
- dataUriLimit: 10000,
160
- templateParameters: {},
161
- templateParametersByEntries: undefined,
162
- cssModuleLocalIdentName: undefined,
163
- enableModernMode: false,
164
- disableNodePolyfill: false,
165
- enableTsLoader: false
166
- };
167
- var serverDefaults = {
168
- routes: undefined,
169
- publicRoutes: undefined,
170
- ssr: undefined,
171
- ssrByEntries: undefined,
172
- baseUrl: '/',
173
- port: 8080
174
- };
175
- var devDefaults = {
176
- assetPrefix: false,
177
- https: false
178
- };
179
- var toolsDefaults = {
180
- webpack: undefined,
181
- babel: undefined,
182
- postcss: undefined,
183
- autoprefixer: undefined,
184
- lodash: undefined,
185
- devServer: undefined,
186
- tsLoader: undefined,
187
- terser: undefined,
188
- minifyCss: undefined
189
- };
190
- return {
191
- source: sourceDefaults,
192
- output: outputDefaults,
193
- server: serverDefaults,
194
- dev: devDefaults,
195
- tools: toolsDefaults,
196
- runtime: {},
197
- runtimeByEntries: {}
198
- };
199
- }
14
+ function createDefaultConfig(appContext) {
15
+ var _obj;
16
+ var defaultAlias = appContext ? (_obj = {}, _defineProperty(_obj, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_obj, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_obj, "@", appContext.srcDirectory), _defineProperty(_obj, "@shared", appContext.sharedDirectory), _obj) : {};
17
+ var source = {
18
+ entries: void 0,
19
+ enableAsyncEntry: false,
20
+ disableDefaultEntries: false,
21
+ entriesDir: "./src",
22
+ configDir: "./config",
23
+ globalVars: void 0,
24
+ moduleScopes: void 0,
25
+ include: [],
26
+ alias: defaultAlias
27
+ };
28
+ var output = {
29
+ assetPrefix: "/",
30
+ distPath: {
31
+ html: "html",
32
+ js: "static/js",
33
+ css: "static/css",
34
+ media: "static/media",
35
+ root: "dist"
36
+ },
37
+ copy: void 0,
38
+ disableCssModuleExtension: false,
39
+ enableCssModuleTSDeclaration: false,
40
+ disableMinimize: false,
41
+ enableInlineStyles: false,
42
+ enableInlineScripts: false,
43
+ disableSourceMap: false,
44
+ disableInlineRuntimeChunk: false,
45
+ disableFilenameHash: false,
46
+ enableLatestDecorators: false,
47
+ polyfill: "entry",
48
+ cssModuleLocalIdentName: void 0
49
+ };
50
+ var html = {
51
+ title: "",
52
+ titleByEntries: void 0,
53
+ meta: {
54
+ charset: {
55
+ charset: "utf-8"
56
+ },
57
+ viewport: "width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
58
+ "http-equiv": {
59
+ "http-equiv": "x-ua-compatible",
60
+ content: "ie=edge"
61
+ },
62
+ renderer: "webkit",
63
+ layoutmode: "standard",
64
+ imagemode: "force",
65
+ "wap-font-scale": "no",
66
+ "format-detection": "telephone=no"
67
+ },
68
+ metaByEntries: void 0,
69
+ inject: "head",
70
+ injectByEntries: void 0,
71
+ mountId: "root",
72
+ favicon: "",
73
+ faviconByEntries: void 0,
74
+ disableHtmlFolder: false,
75
+ templateParameters: {},
76
+ templateParametersByEntries: void 0
77
+ };
78
+ var server = {
79
+ routes: void 0,
80
+ publicRoutes: void 0,
81
+ ssr: void 0,
82
+ ssrByEntries: void 0,
83
+ baseUrl: "/",
84
+ port: 8080
85
+ };
86
+ var dev = {
87
+ assetPrefix: false,
88
+ https: false
89
+ };
90
+ var tools = {
91
+ webpack: void 0,
92
+ babel: void 0,
93
+ postcss: void 0,
94
+ autoprefixer: void 0,
95
+ devServer: void 0,
96
+ tsLoader: void 0,
97
+ terser: void 0,
98
+ minifyCss: void 0
99
+ };
100
+ return {
101
+ source: source,
102
+ output: output,
103
+ server: server,
104
+ dev: dev,
105
+ html: html,
106
+ tools: tools,
107
+ plugins: [],
108
+ runtime: {},
109
+ runtimeByEntries: {}
110
+ };
111
+ }
112
+ function createLegacyDefaultConfig(appContext) {
113
+ var _obj;
114
+ var defaultAlias = appContext ? (_obj = {}, _defineProperty(_obj, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_obj, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_obj, "@", appContext.srcDirectory), _defineProperty(_obj, "@shared", appContext.sharedDirectory), _obj) : {};
115
+ var sourceDefaults = {
116
+ entries: void 0,
117
+ enableAsyncEntry: false,
118
+ disableDefaultEntries: false,
119
+ entriesDir: "./src",
120
+ configDir: "./config",
121
+ apiDir: "./api",
122
+ envVars: [],
123
+ globalVars: void 0,
124
+ alias: defaultAlias,
125
+ moduleScopes: void 0,
126
+ include: []
127
+ };
128
+ var outputDefaults = {
129
+ assetPrefix: "/",
130
+ htmlPath: "html",
131
+ jsPath: "static/js",
132
+ cssPath: "static/css",
133
+ mediaPath: "static/media",
134
+ path: "dist",
135
+ title: "",
136
+ titleByEntries: void 0,
137
+ meta: {
138
+ charset: {
139
+ charset: "utf-8"
140
+ },
141
+ viewport: "width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
142
+ "http-equiv": {
143
+ "http-equiv": "x-ua-compatible",
144
+ content: "ie=edge"
145
+ },
146
+ renderer: "webkit",
147
+ layoutmode: "standard",
148
+ imagemode: "force",
149
+ "wap-font-scale": "no",
150
+ "format-detection": "telephone=no"
151
+ },
152
+ metaByEntries: void 0,
153
+ inject: "head",
154
+ injectByEntries: void 0,
155
+ mountId: "root",
156
+ favicon: "",
157
+ faviconByEntries: void 0,
158
+ copy: void 0,
159
+ disableHtmlFolder: false,
160
+ disableCssModuleExtension: false,
161
+ disableCssExtract: false,
162
+ enableCssModuleTSDeclaration: false,
163
+ disableMinimize: false,
164
+ enableInlineStyles: false,
165
+ enableInlineScripts: false,
166
+ disableSourceMap: false,
167
+ disableInlineRuntimeChunk: false,
168
+ disableAssetsCache: false,
169
+ enableLatestDecorators: false,
170
+ polyfill: "entry",
171
+ dataUriLimit: 1e4,
172
+ templateParameters: {},
173
+ templateParametersByEntries: void 0,
174
+ cssModuleLocalIdentName: void 0,
175
+ disableNodePolyfill: false,
176
+ enableTsLoader: false
177
+ };
178
+ var serverDefaults = {
179
+ routes: void 0,
180
+ publicRoutes: void 0,
181
+ ssr: void 0,
182
+ ssrByEntries: void 0,
183
+ baseUrl: "/",
184
+ port: 8080
185
+ };
186
+ var devDefaults = {
187
+ assetPrefix: false,
188
+ https: false
189
+ };
190
+ var toolsDefaults = {
191
+ webpack: void 0,
192
+ babel: void 0,
193
+ postcss: void 0,
194
+ autoprefixer: void 0,
195
+ lodash: void 0,
196
+ devServer: void 0,
197
+ tsLoader: void 0,
198
+ terser: void 0,
199
+ minifyCss: void 0
200
+ };
201
+ return {
202
+ source: sourceDefaults,
203
+ output: outputDefaults,
204
+ server: serverDefaults,
205
+ dev: devDefaults,
206
+ tools: toolsDefaults,
207
+ runtime: {},
208
+ runtimeByEntries: {}
209
+ };
210
+ }
211
+ export { createDefaultConfig, createLegacyDefaultConfig };