@modern-js/app-tools 2.63.0 → 2.63.1-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. package/bin/modern.js +1 -1
  2. package/dist/cjs/commands/build.js +19 -13
  3. package/dist/cjs/commands/deploy.js +5 -5
  4. package/dist/cjs/commands/dev.js +11 -11
  5. package/dist/cjs/commands/index.js +6 -6
  6. package/dist/cjs/commands/inspect.js +1 -1
  7. package/dist/cjs/commands/serve.js +4 -4
  8. package/dist/cjs/{new/compat → compat}/hooks.js +15 -8
  9. package/dist/cjs/{new/compat → compat}/index.js +4 -1
  10. package/dist/cjs/{new/compat → compat}/utils.js +10 -1
  11. package/dist/cjs/index.js +154 -5
  12. package/dist/cjs/plugins/analyze/getBundleEntry.js +2 -2
  13. package/dist/cjs/plugins/analyze/getFileSystemEntry.js +9 -9
  14. package/dist/cjs/plugins/analyze/getHtmlTemplate.js +51 -25
  15. package/dist/cjs/plugins/analyze/index.js +128 -130
  16. package/dist/cjs/plugins/deploy/index.js +12 -14
  17. package/dist/cjs/plugins/initialize/index.js +1 -1
  18. package/dist/cjs/plugins/serverBuild.js +30 -32
  19. package/dist/cjs/{new/run.js → run/index.js} +6 -6
  20. package/dist/cjs/{new → utils}/getConfigFile.js +1 -1
  21. package/dist/cjs/{new/context.js → utils/initAppContext.js} +3 -4
  22. package/dist/cjs/{new/utils/index.js → utils/isAutoLoadPlugins.js} +6 -6
  23. package/dist/cjs/utils/loadPlugins.js +35 -4
  24. package/dist/cjs/utils/printInstructions.js +2 -2
  25. package/dist/cjs/utils/restart.js +4 -3
  26. package/dist/esm/commands/build.js +18 -12
  27. package/dist/esm/commands/deploy.js +6 -6
  28. package/dist/esm/commands/dev.js +10 -10
  29. package/dist/esm/commands/index.js +8 -8
  30. package/dist/esm/commands/inspect.js +1 -1
  31. package/dist/esm/commands/serve.js +5 -5
  32. package/dist/esm/{new/compat → compat}/hooks.js +41 -41
  33. package/dist/esm/{new/compat → compat}/index.js +4 -1
  34. package/dist/esm/{new/compat → compat}/utils.js +10 -1
  35. package/dist/esm/index.js +245 -2
  36. package/dist/esm/plugins/analyze/getBundleEntry.js +3 -3
  37. package/dist/esm/plugins/analyze/getFileSystemEntry.js +12 -12
  38. package/dist/esm/plugins/analyze/getHtmlTemplate.js +101 -28
  39. package/dist/esm/plugins/analyze/index.js +328 -331
  40. package/dist/esm/plugins/deploy/index.js +84 -88
  41. package/dist/esm/plugins/initialize/index.js +1 -1
  42. package/dist/esm/plugins/serverBuild.js +52 -56
  43. package/dist/esm/{new/run.js → run/index.js} +6 -6
  44. package/dist/esm/{new → utils}/getConfigFile.js +1 -1
  45. package/dist/esm/{new/context.js → utils/initAppContext.js} +0 -1
  46. package/dist/esm/{new/utils/index.js → utils/isAutoLoadPlugins.js} +6 -6
  47. package/dist/esm/utils/loadPlugins.js +95 -7
  48. package/dist/esm/utils/printInstructions.js +3 -3
  49. package/dist/esm/utils/restart.js +5 -4
  50. package/dist/esm-node/commands/build.js +19 -13
  51. package/dist/esm-node/commands/deploy.js +5 -5
  52. package/dist/esm-node/commands/dev.js +11 -11
  53. package/dist/esm-node/commands/index.js +6 -6
  54. package/dist/esm-node/commands/inspect.js +1 -1
  55. package/dist/esm-node/commands/serve.js +4 -4
  56. package/dist/esm-node/{new/compat → compat}/hooks.js +15 -8
  57. package/dist/esm-node/{new/compat → compat}/index.js +4 -1
  58. package/dist/esm-node/{new/compat → compat}/utils.js +10 -1
  59. package/dist/esm-node/index.js +140 -2
  60. package/dist/esm-node/plugins/analyze/getBundleEntry.js +2 -2
  61. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +9 -9
  62. package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +49 -24
  63. package/dist/esm-node/plugins/analyze/index.js +128 -130
  64. package/dist/esm-node/plugins/deploy/index.js +12 -14
  65. package/dist/esm-node/plugins/initialize/index.js +1 -1
  66. package/dist/esm-node/plugins/serverBuild.js +30 -32
  67. package/dist/esm-node/{new/run.js → run/index.js} +6 -6
  68. package/dist/esm-node/{new → utils}/getConfigFile.js +1 -1
  69. package/dist/esm-node/{new/context.js → utils/initAppContext.js} +0 -1
  70. package/dist/esm-node/{new/utils/index.js → utils/isAutoLoadPlugins.js} +2 -2
  71. package/dist/esm-node/utils/loadPlugins.js +34 -4
  72. package/dist/esm-node/utils/printInstructions.js +2 -2
  73. package/dist/esm-node/utils/restart.js +4 -3
  74. package/dist/types/builder/generator/adapterCopy.d.ts +2 -1
  75. package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +3 -2
  76. package/dist/types/builder/generator/createCopyPattern.d.ts +4 -3
  77. package/dist/types/builder/generator/getBuilderEnvironments.d.ts +2 -2
  78. package/dist/types/builder/index.d.ts +1 -1
  79. package/dist/types/builder/shared/createCopyInfo.d.ts +3 -2
  80. package/dist/types/builder/shared/types.d.ts +3 -2
  81. package/dist/types/commands/build.d.ts +2 -2
  82. package/dist/types/commands/deploy.d.ts +2 -2
  83. package/dist/types/commands/dev.d.ts +2 -2
  84. package/dist/types/commands/index.d.ts +6 -6
  85. package/dist/types/commands/inspect.d.ts +2 -2
  86. package/dist/types/commands/serve.d.ts +2 -2
  87. package/dist/types/{new/compat → compat}/hooks.d.ts +2 -2
  88. package/dist/types/compat/index.d.ts +2 -0
  89. package/dist/types/config/initialize/index.d.ts +3 -2
  90. package/dist/types/config/initialize/inits.d.ts +4 -3
  91. package/dist/types/index.d.ts +5 -3
  92. package/dist/types/plugins/analyze/getBundleEntry.d.ts +3 -3
  93. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +3 -3
  94. package/dist/types/plugins/analyze/getHtmlTemplate.d.ts +26 -5
  95. package/dist/types/plugins/analyze/getServerRoutes.d.ts +2 -2
  96. package/dist/types/plugins/analyze/index.d.ts +2 -3
  97. package/dist/types/plugins/deploy/index.d.ts +2 -3
  98. package/dist/types/plugins/deploy/platforms/platform.d.ts +3 -3
  99. package/dist/types/plugins/deploy/utils.d.ts +2 -2
  100. package/dist/types/plugins/serverBuild.d.ts +2 -2
  101. package/dist/types/types/index.d.ts +2 -0
  102. package/dist/types/types/new.d.ts +46 -34
  103. package/dist/types/utils/generateWatchFiles.d.ts +2 -2
  104. package/dist/types/{new/context.d.ts → utils/initAppContext.d.ts} +0 -1
  105. package/dist/types/utils/isAutoLoadPlugins.d.ts +1 -0
  106. package/dist/types/utils/loadPlugins.d.ts +13 -3
  107. package/dist/types/utils/printInstructions.d.ts +3 -3
  108. package/dist/types/utils/restart.d.ts +2 -3
  109. package/dist/types/utils/routes.d.ts +2 -1
  110. package/package.json +14 -15
  111. package/dist/cjs/hooks.js +0 -60
  112. package/dist/cjs/new/index.js +0 -79
  113. package/dist/cjs/new/loadPlugins.js +0 -57
  114. package/dist/cjs/old.js +0 -179
  115. package/dist/esm/hooks.js +0 -36
  116. package/dist/esm/new/index.js +0 -55
  117. package/dist/esm/new/loadPlugins.js +0 -94
  118. package/dist/esm/old.js +0 -258
  119. package/dist/esm-node/hooks.js +0 -36
  120. package/dist/esm-node/new/index.js +0 -52
  121. package/dist/esm-node/new/loadPlugins.js +0 -33
  122. package/dist/esm-node/old.js +0 -140
  123. package/dist/types/hooks.d.ts +0 -2
  124. package/dist/types/new/compat/index.d.ts +0 -2
  125. package/dist/types/new/index.d.ts +0 -6
  126. package/dist/types/new/loadPlugins.d.ts +0 -9
  127. package/dist/types/new/utils/index.d.ts +0 -1
  128. package/dist/types/old.d.ts +0 -13
  129. /package/dist/cjs/{new/constants.js → constants.js} +0 -0
  130. /package/dist/esm/{new/constants.js → constants.js} +0 -0
  131. /package/dist/esm-node/{new/constants.js → constants.js} +0 -0
  132. /package/dist/types/{new/compat → compat}/utils.d.ts +0 -0
  133. /package/dist/types/{new/constants.d.ts → constants.d.ts} +0 -0
  134. /package/dist/types/{new/run.d.ts → run/index.d.ts} +0 -0
  135. /package/dist/types/{new → utils}/getConfigFile.d.ts +0 -0
@@ -23,347 +23,344 @@ function analyze_default(param) {
23
23
  setup: function(api) {
24
24
  var pagesDir = [];
25
25
  var nestedRouteEntries = [];
26
- return {
27
- prepare: function prepare() {
28
- return _async_to_generator(function() {
29
- var _resolvedConfig_source, appContext, resolvedConfig, hookRunners, apiOnly, routes, _ref, getBundleEntry, getServerRoutes, getHtmlTemplate, entrypoints, _, _tmp, initialRoutes, routes1, htmlTemplates, checkedEntries, entry, normalizedConfig, createBuilderForModern, builder;
30
- return _ts_generator(this, function(_state) {
31
- switch (_state.label) {
32
- case 0:
33
- appContext = api.useAppContext();
34
- resolvedConfig = api.useResolvedConfigContext();
35
- hookRunners = api.useHookRunners();
36
- try {
37
- if (checkIsBuildCommands()) {
38
- fs.emptydirSync(appContext.internalDirectory);
26
+ api.onPrepare(/* @__PURE__ */ _async_to_generator(function() {
27
+ var _resolvedConfig_source, appContext, resolvedConfig, hooks, apiOnly, routes, _ref, getBundleEntry, getServerRoutes, getHtmlTemplate, entrypoints, _, _1, _tmp, initialRoutes, routes1, _ref1, partialsByEntrypoint, htmlTemplates, checkedEntries, entry, normalizedConfig, createBuilderForModern, builder;
28
+ return _ts_generator(this, function(_state) {
29
+ switch (_state.label) {
30
+ case 0:
31
+ appContext = api.getAppContext();
32
+ resolvedConfig = api.getNormalizedConfig();
33
+ hooks = api.getHooks();
34
+ try {
35
+ if (checkIsBuildCommands()) {
36
+ fs.emptydirSync(appContext.internalDirectory);
37
+ }
38
+ } catch (e) {
39
+ }
40
+ return [
41
+ 4,
42
+ isApiOnly(appContext.appDirectory, (_resolvedConfig_source = resolvedConfig.source) === null || _resolvedConfig_source === void 0 ? void 0 : _resolvedConfig_source.entriesDir, appContext.apiDirectory)
43
+ ];
44
+ case 1:
45
+ apiOnly = _state.sent();
46
+ return [
47
+ 4,
48
+ hooks.addRuntimeExports.call()
49
+ ];
50
+ case 2:
51
+ _state.sent();
52
+ if (!apiOnly)
53
+ return [
54
+ 3,
55
+ 4
56
+ ];
57
+ return [
58
+ 4,
59
+ hooks.modifyServerRoutes.call({
60
+ routes: []
61
+ })
62
+ ];
63
+ case 3:
64
+ routes = _state.sent().routes;
65
+ debug("server routes: %o", routes);
66
+ api.updateAppContext({
67
+ apiOnly,
68
+ serverRoutes: routes
69
+ });
70
+ return [
71
+ 2
72
+ ];
73
+ case 4:
74
+ return [
75
+ 4,
76
+ Promise.all([
77
+ import("./getBundleEntry.js"),
78
+ import("./getServerRoutes.js"),
79
+ import("./getHtmlTemplate.js")
80
+ ])
81
+ ];
82
+ case 5:
83
+ _ref = _sliced_to_array.apply(void 0, [
84
+ _state.sent(),
85
+ 3
86
+ ]), getBundleEntry = _ref[0].getBundleEntry, getServerRoutes = _ref[1].getServerRoutes, getHtmlTemplate = _ref[2].getHtmlTemplate;
87
+ _1 = (_ = hooks.modifyEntrypoints).call;
88
+ _tmp = {};
89
+ return [
90
+ 4,
91
+ getBundleEntry(hooks, appContext, resolvedConfig)
92
+ ];
93
+ case 6:
94
+ return [
95
+ 4,
96
+ _1.apply(_, [
97
+ (_tmp.entrypoints = _state.sent(), _tmp)
98
+ ])
99
+ ];
100
+ case 7:
101
+ entrypoints = _state.sent().entrypoints;
102
+ debug("entrypoints: %o", entrypoints);
103
+ initialRoutes = getServerRoutes(entrypoints, {
104
+ appContext,
105
+ config: resolvedConfig
106
+ });
107
+ return [
108
+ 4,
109
+ hooks.modifyServerRoutes.call({
110
+ routes: initialRoutes
111
+ })
112
+ ];
113
+ case 8:
114
+ routes1 = _state.sent().routes;
115
+ debug("server routes: %o", routes1);
116
+ appContext = _object_spread_props(_object_spread({}, api.getAppContext()), {
117
+ entrypoints,
118
+ serverRoutes: routes1
119
+ });
120
+ api.updateAppContext(appContext);
121
+ nestedRouteEntries = entrypoints.map(function(point) {
122
+ return point.nestedRoutesEntry;
123
+ }).filter(Boolean);
124
+ pagesDir = entrypoints.map(function(point) {
125
+ return point.entry;
126
+ }).filter(function(entry2) {
127
+ return entry2 && !path.extname(entry2);
128
+ }).concat(nestedRouteEntries);
129
+ return [
130
+ 4,
131
+ getHtmlTemplate(entrypoints, hooks, {
132
+ appContext,
133
+ config: resolvedConfig
134
+ })
135
+ ];
136
+ case 9:
137
+ _ref1 = _state.sent(), partialsByEntrypoint = _ref1.partialsByEntrypoint, htmlTemplates = _ref1.htmlTemplates;
138
+ debug("html templates: %o", htmlTemplates);
139
+ api.updateAppContext({
140
+ partialsByEntrypoint
141
+ });
142
+ checkedEntries = entrypoints.map(function(point) {
143
+ return point.entryName;
144
+ });
145
+ if (!isDevCommand())
146
+ return [
147
+ 3,
148
+ 11
149
+ ];
150
+ entry = minimist(getArgv()).entry;
151
+ return [
152
+ 4,
153
+ getSelectedEntries(typeof entry === "string" ? entry.split(",") : entry, entrypoints)
154
+ ];
155
+ case 10:
156
+ checkedEntries = _state.sent();
157
+ _state.label = 11;
158
+ case 11:
159
+ appContext = _object_spread_props(_object_spread({}, api.getAppContext()), {
160
+ entrypoints,
161
+ checkedEntries,
162
+ apiOnly,
163
+ serverRoutes: routes1,
164
+ htmlTemplates
165
+ });
166
+ api.updateAppContext(appContext);
167
+ if (!checkIsBuildCommands())
168
+ return [
169
+ 3,
170
+ 15
171
+ ];
172
+ return [
173
+ 4,
174
+ hooks.generateEntryCode.call({
175
+ entrypoints
176
+ })
177
+ ];
178
+ case 12:
179
+ _state.sent();
180
+ normalizedConfig = api.getNormalizedConfig();
181
+ return [
182
+ 4,
183
+ createBuilderGenerator(bundler)
184
+ ];
185
+ case 13:
186
+ createBuilderForModern = _state.sent();
187
+ return [
188
+ 4,
189
+ createBuilderForModern({
190
+ normalizedConfig,
191
+ appContext
192
+ })
193
+ ];
194
+ case 14:
195
+ builder = _state.sent();
196
+ builder.onBeforeBuild(function() {
197
+ var _ref2 = _async_to_generator(function(param2) {
198
+ var bundlerConfigs, isFirstCompile, environments, isWatch;
199
+ return _ts_generator(this, function(_state2) {
200
+ switch (_state2.label) {
201
+ case 0:
202
+ bundlerConfigs = param2.bundlerConfigs, isFirstCompile = param2.isFirstCompile, environments = param2.environments, isWatch = param2.isWatch;
203
+ if (!isFirstCompile) {
204
+ return [
205
+ 2
206
+ ];
207
+ }
208
+ return [
209
+ 4,
210
+ generateRoutes(appContext)
211
+ ];
212
+ case 1:
213
+ _state2.sent();
214
+ return [
215
+ 4,
216
+ hooks.onBeforeBuild.call({
217
+ isFirstCompile,
218
+ isWatch,
219
+ environments,
220
+ bundlerConfigs
221
+ })
222
+ ];
223
+ case 2:
224
+ _state2.sent();
225
+ return [
226
+ 2
227
+ ];
39
228
  }
40
- } catch (e) {
41
- }
42
- return [
43
- 4,
44
- isApiOnly(appContext.appDirectory, (_resolvedConfig_source = resolvedConfig.source) === null || _resolvedConfig_source === void 0 ? void 0 : _resolvedConfig_source.entriesDir, appContext.apiDirectory)
45
- ];
46
- case 1:
47
- apiOnly = _state.sent();
48
- return [
49
- 4,
50
- hookRunners.addRuntimeExports()
51
- ];
52
- case 2:
53
- _state.sent();
54
- if (!apiOnly)
55
- return [
56
- 3,
57
- 4
58
- ];
59
- return [
60
- 4,
61
- hookRunners.modifyServerRoutes({
62
- routes: []
63
- })
64
- ];
65
- case 3:
66
- routes = _state.sent().routes;
67
- debug("server routes: %o", routes);
68
- appContext = _object_spread_props(_object_spread({}, api.useAppContext()), {
69
- apiOnly,
70
- serverRoutes: routes
71
- });
72
- api.setAppContext(appContext);
73
- return [
74
- 2
75
- ];
76
- case 4:
77
- return [
78
- 4,
79
- Promise.all([
80
- import("./getBundleEntry.js"),
81
- import("./getServerRoutes.js"),
82
- import("./getHtmlTemplate.js")
83
- ])
84
- ];
85
- case 5:
86
- _ref = _sliced_to_array.apply(void 0, [
87
- _state.sent(),
88
- 3
89
- ]), getBundleEntry = _ref[0].getBundleEntry, getServerRoutes = _ref[1].getServerRoutes, getHtmlTemplate = _ref[2].getHtmlTemplate;
90
- _ = hookRunners.modifyEntrypoints;
91
- _tmp = {};
92
- return [
93
- 4,
94
- getBundleEntry(hookRunners, appContext, resolvedConfig)
95
- ];
96
- case 6:
97
- return [
98
- 4,
99
- _.apply(hookRunners, [
100
- (_tmp.entrypoints = _state.sent(), _tmp)
101
- ])
102
- ];
103
- case 7:
104
- entrypoints = _state.sent().entrypoints;
105
- debug("entrypoints: %o", entrypoints);
106
- initialRoutes = getServerRoutes(entrypoints, {
107
- appContext,
108
- config: resolvedConfig
109
229
  });
110
- return [
111
- 4,
112
- hookRunners.modifyServerRoutes({
113
- routes: initialRoutes
114
- })
115
- ];
116
- case 8:
117
- routes1 = _state.sent().routes;
118
- debug("server routes: %o", routes1);
119
- appContext = _object_spread_props(_object_spread({}, api.useAppContext()), {
120
- entrypoints,
121
- serverRoutes: routes1
122
- });
123
- api.setAppContext(appContext);
124
- nestedRouteEntries = entrypoints.map(function(point) {
125
- return point.nestedRoutesEntry;
126
- }).filter(Boolean);
127
- pagesDir = entrypoints.map(function(point) {
128
- return point.entry;
129
- }).filter(function(entry2) {
130
- return entry2 && !path.extname(entry2);
131
- }).concat(nestedRouteEntries);
132
- return [
133
- 4,
134
- getHtmlTemplate(entrypoints, api, {
135
- appContext,
136
- config: resolvedConfig
137
- })
138
- ];
139
- case 9:
140
- htmlTemplates = _state.sent();
141
- debug("html templates: %o", htmlTemplates);
142
- checkedEntries = entrypoints.map(function(point) {
143
- return point.entryName;
230
+ });
231
+ return function(_2) {
232
+ return _ref2.apply(this, arguments);
233
+ };
234
+ }());
235
+ builder.onAfterBuild(function() {
236
+ var _ref2 = _async_to_generator(function(param2) {
237
+ var stats, environments, isFirstCompile, isWatch;
238
+ return _ts_generator(this, function(_state2) {
239
+ switch (_state2.label) {
240
+ case 0:
241
+ stats = param2.stats, environments = param2.environments, isFirstCompile = param2.isFirstCompile, isWatch = param2.isWatch;
242
+ return [
243
+ 4,
244
+ hooks.onAfterBuild.call({
245
+ stats,
246
+ environments,
247
+ isFirstCompile,
248
+ isWatch
249
+ })
250
+ ];
251
+ case 1:
252
+ _state2.sent();
253
+ return [
254
+ 4,
255
+ emitResolvedConfig(appContext.appDirectory, normalizedConfig)
256
+ ];
257
+ case 2:
258
+ _state2.sent();
259
+ return [
260
+ 2
261
+ ];
262
+ }
144
263
  });
145
- if (!isDevCommand())
264
+ });
265
+ return function(_2) {
266
+ return _ref2.apply(this, arguments);
267
+ };
268
+ }());
269
+ builder.onDevCompileDone(function() {
270
+ var _ref2 = _async_to_generator(function(param2) {
271
+ var isFirstCompile;
272
+ return _ts_generator(this, function(_state2) {
273
+ isFirstCompile = param2.isFirstCompile;
274
+ hooks.onAfterDev.call({
275
+ isFirstCompile
276
+ });
277
+ if (isFirstCompile) {
278
+ printInstructions(hooks, appContext, normalizedConfig);
279
+ }
146
280
  return [
147
- 3,
148
- 11
281
+ 2
149
282
  ];
150
- entry = minimist(getArgv()).entry;
151
- return [
152
- 4,
153
- getSelectedEntries(typeof entry === "string" ? entry.split(",") : entry, entrypoints)
154
- ];
155
- case 10:
156
- checkedEntries = _state.sent();
157
- _state.label = 11;
158
- case 11:
159
- appContext = _object_spread_props(_object_spread({}, api.useAppContext()), {
160
- entrypoints,
161
- checkedEntries,
162
- apiOnly,
163
- serverRoutes: routes1,
164
- htmlTemplates
165
283
  });
166
- api.setAppContext(appContext);
167
- if (!checkIsBuildCommands())
168
- return [
169
- 3,
170
- 15
171
- ];
172
- return [
173
- 4,
174
- hookRunners.generateEntryCode({
175
- entrypoints
176
- })
177
- ];
178
- case 12:
179
- _state.sent();
180
- normalizedConfig = api.useResolvedConfigContext();
181
- return [
182
- 4,
183
- createBuilderGenerator(bundler)
184
- ];
185
- case 13:
186
- createBuilderForModern = _state.sent();
187
- return [
188
- 4,
189
- createBuilderForModern({
190
- normalizedConfig,
191
- appContext
192
- })
193
- ];
194
- case 14:
195
- builder = _state.sent();
196
- builder.onBeforeBuild(function() {
197
- var _ref2 = _async_to_generator(function(param2) {
198
- var bundlerConfigs, isFirstCompile, hookRunners2;
199
- return _ts_generator(this, function(_state2) {
200
- switch (_state2.label) {
201
- case 0:
202
- bundlerConfigs = param2.bundlerConfigs, isFirstCompile = param2.isFirstCompile;
203
- if (!isFirstCompile) {
204
- return [
205
- 2
206
- ];
207
- }
208
- hookRunners2 = api.useHookRunners();
209
- return [
210
- 4,
211
- generateRoutes(appContext)
212
- ];
213
- case 1:
214
- _state2.sent();
215
- return [
216
- 4,
217
- hookRunners2.beforeBuild({
218
- bundlerConfigs
219
- })
220
- ];
221
- case 2:
222
- _state2.sent();
223
- return [
224
- 2
225
- ];
226
- }
227
- });
228
- });
229
- return function(_2) {
230
- return _ref2.apply(this, arguments);
231
- };
232
- }());
233
- builder.onAfterBuild(function() {
234
- var _ref2 = _async_to_generator(function(param2) {
235
- var stats, hookRunners2;
236
- return _ts_generator(this, function(_state2) {
237
- switch (_state2.label) {
238
- case 0:
239
- stats = param2.stats;
240
- hookRunners2 = api.useHookRunners();
241
- return [
242
- 4,
243
- hookRunners2.afterBuild({
244
- stats
245
- })
246
- ];
247
- case 1:
248
- _state2.sent();
249
- return [
250
- 4,
251
- emitResolvedConfig(appContext.appDirectory, normalizedConfig)
252
- ];
253
- case 2:
254
- _state2.sent();
255
- return [
256
- 2
257
- ];
258
- }
259
- });
260
- });
261
- return function(_2) {
262
- return _ref2.apply(this, arguments);
263
- };
264
- }());
265
- builder.onDevCompileDone(function() {
266
- var _ref2 = _async_to_generator(function(param2) {
267
- var isFirstCompile, hookRunners2;
268
- return _ts_generator(this, function(_state2) {
269
- isFirstCompile = param2.isFirstCompile;
270
- hookRunners2 = api.useHookRunners();
271
- hookRunners2.afterDev({
272
- isFirstCompile
273
- });
274
- if (isFirstCompile) {
275
- printInstructions(hookRunners2, appContext, normalizedConfig);
276
- }
284
+ });
285
+ return function(_2) {
286
+ return _ref2.apply(this, arguments);
287
+ };
288
+ }());
289
+ builder.onBeforeCreateCompiler(function() {
290
+ var _ref2 = _async_to_generator(function(param2) {
291
+ var bundlerConfigs, environments;
292
+ return _ts_generator(this, function(_state2) {
293
+ switch (_state2.label) {
294
+ case 0:
295
+ bundlerConfigs = param2.bundlerConfigs, environments = param2.environments;
296
+ return [
297
+ 4,
298
+ hooks.onBeforeCreateCompiler.call({
299
+ environments,
300
+ bundlerConfigs
301
+ })
302
+ ];
303
+ case 1:
304
+ _state2.sent();
277
305
  return [
278
306
  2
279
307
  ];
280
- });
281
- });
282
- return function(_2) {
283
- return _ref2.apply(this, arguments);
284
- };
285
- }());
286
- builder.onBeforeCreateCompiler(function() {
287
- var _ref2 = _async_to_generator(function(param2) {
288
- var bundlerConfigs, hookRunners2;
289
- return _ts_generator(this, function(_state2) {
290
- switch (_state2.label) {
291
- case 0:
292
- bundlerConfigs = param2.bundlerConfigs;
293
- hookRunners2 = api.useHookRunners();
294
- return [
295
- 4,
296
- hookRunners2.beforeCreateCompiler({
297
- bundlerConfigs
298
- })
299
- ];
300
- case 1:
301
- _state2.sent();
302
- return [
303
- 2
304
- ];
305
- }
306
- });
307
- });
308
- return function(_2) {
309
- return _ref2.apply(this, arguments);
310
- };
311
- }());
312
- builder.onAfterCreateCompiler(function() {
313
- var _ref2 = _async_to_generator(function(param2) {
314
- var compiler, hookRunners2;
315
- return _ts_generator(this, function(_state2) {
316
- switch (_state2.label) {
317
- case 0:
318
- compiler = param2.compiler;
319
- hookRunners2 = api.useHookRunners();
320
- return [
321
- 4,
322
- hookRunners2.afterCreateCompiler({
323
- compiler
324
- })
325
- ];
326
- case 1:
327
- _state2.sent();
328
- return [
329
- 2
330
- ];
331
- }
332
- });
333
- });
334
- return function(_2) {
335
- return _ref2.apply(this, arguments);
336
- };
337
- }());
338
- builder.addPlugins(resolvedConfig.builderPlugins);
339
- appContext = _object_spread_props(_object_spread({}, api.useAppContext()), {
340
- builder
308
+ }
341
309
  });
342
- api.setAppContext(appContext);
343
- _state.label = 15;
344
- case 15:
345
- return [
346
- 2
347
- ];
348
- }
349
- });
350
- })();
351
- },
352
- watchFiles: function watchFiles() {
353
- return {
354
- files: pagesDir,
355
- isPrivate: true
356
- };
357
- },
358
- resolvedConfig: function resolvedConfig(param2) {
359
- var resolved = param2.resolved;
360
- var appContext = api.useAppContext();
361
- var config = initialNormalizedConfig(resolved, appContext, bundler);
362
- return {
363
- resolved: config
364
- };
365
- }
366
- };
310
+ });
311
+ return function(_2) {
312
+ return _ref2.apply(this, arguments);
313
+ };
314
+ }());
315
+ builder.onAfterCreateCompiler(function() {
316
+ var _ref2 = _async_to_generator(function(param2) {
317
+ var compiler, environments;
318
+ return _ts_generator(this, function(_state2) {
319
+ switch (_state2.label) {
320
+ case 0:
321
+ compiler = param2.compiler, environments = param2.environments;
322
+ return [
323
+ 4,
324
+ hooks.onAfterCreateCompiler.call({
325
+ environments,
326
+ compiler
327
+ })
328
+ ];
329
+ case 1:
330
+ _state2.sent();
331
+ return [
332
+ 2
333
+ ];
334
+ }
335
+ });
336
+ });
337
+ return function(_2) {
338
+ return _ref2.apply(this, arguments);
339
+ };
340
+ }());
341
+ builder.addPlugins(resolvedConfig.builderPlugins);
342
+ api.updateAppContext({
343
+ builder
344
+ });
345
+ _state.label = 15;
346
+ case 15:
347
+ return [
348
+ 2
349
+ ];
350
+ }
351
+ });
352
+ }));
353
+ api.addWatchFiles(function() {
354
+ return {
355
+ files: pagesDir,
356
+ isPrivate: true
357
+ };
358
+ });
359
+ api.modifyResolvedConfig(function(resolved) {
360
+ var appContext = api.getAppContext();
361
+ var config = initialNormalizedConfig(resolved, appContext, bundler);
362
+ return config;
363
+ });
367
364
  }
368
365
  };
369
366
  }