@modern-js/app-tools 2.49.3-alpha.9 → 2.49.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 (43) hide show
  1. package/dist/cjs/analyze/getServerRoutes.js +3 -4
  2. package/dist/cjs/index.js +1 -3
  3. package/dist/cjs/utils/routes.js +2 -7
  4. package/dist/esm/analyze/getServerRoutes.js +4 -5
  5. package/dist/esm/index.js +1 -3
  6. package/dist/esm/utils/routes.js +2 -6
  7. package/dist/esm-node/analyze/getServerRoutes.js +4 -5
  8. package/dist/esm-node/index.js +1 -3
  9. package/dist/esm-node/utils/routes.js +2 -6
  10. package/dist/types/utils/routes.d.ts +3 -3
  11. package/package.json +22 -26
  12. package/dist/cjs/plugins/deploy/dependencies.js +0 -256
  13. package/dist/cjs/plugins/deploy/index.js +0 -215
  14. package/dist/cjs/plugins/deploy/platforms/netlify.js +0 -95
  15. package/dist/cjs/plugins/deploy/platforms/node.js +0 -88
  16. package/dist/cjs/plugins/deploy/platforms/platform.js +0 -16
  17. package/dist/cjs/plugins/deploy/platforms/vercel.js +0 -57
  18. package/dist/cjs/plugins/deploy/platforms/vercelEntry.js +0 -55
  19. package/dist/cjs/plugins/deploy/utils.js +0 -150
  20. package/dist/esm/plugins/deploy/dependencies.js +0 -725
  21. package/dist/esm/plugins/deploy/index.js +0 -356
  22. package/dist/esm/plugins/deploy/platforms/netlify.js +0 -41
  23. package/dist/esm/plugins/deploy/platforms/node.js +0 -39
  24. package/dist/esm/plugins/deploy/platforms/platform.js +0 -0
  25. package/dist/esm/plugins/deploy/platforms/vercel.js +0 -47
  26. package/dist/esm/plugins/deploy/platforms/vercelEntry.js +0 -197
  27. package/dist/esm/plugins/deploy/utils.js +0 -244
  28. package/dist/esm-node/plugins/deploy/dependencies.js +0 -222
  29. package/dist/esm-node/plugins/deploy/index.js +0 -185
  30. package/dist/esm-node/plugins/deploy/platforms/netlify.js +0 -71
  31. package/dist/esm-node/plugins/deploy/platforms/node.js +0 -64
  32. package/dist/esm-node/plugins/deploy/platforms/platform.js +0 -0
  33. package/dist/esm-node/plugins/deploy/platforms/vercel.js +0 -23
  34. package/dist/esm-node/plugins/deploy/platforms/vercelEntry.js +0 -63
  35. package/dist/esm-node/plugins/deploy/utils.js +0 -109
  36. package/dist/types/plugins/deploy/dependencies.d.ts +0 -1
  37. package/dist/types/plugins/deploy/index.d.ts +0 -4
  38. package/dist/types/plugins/deploy/platforms/netlify.d.ts +0 -5
  39. package/dist/types/plugins/deploy/platforms/node.d.ts +0 -5
  40. package/dist/types/plugins/deploy/platforms/platform.d.ts +0 -1
  41. package/dist/types/plugins/deploy/platforms/vercel.d.ts +0 -5
  42. package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +0 -2
  43. package/dist/types/plugins/deploy/utils.d.ts +0 -27
@@ -1,356 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
- import path from "path";
4
- import { fs as fse, getInternalPlugins } from "@modern-js/utils";
5
- import { provider } from "std-env";
6
- import { isMainEntry } from "../../utils/routes";
7
- import { getProjectUsage } from "./utils";
8
- import { handleDependencies } from "./dependencies";
9
- function deploy_default() {
10
- return {
11
- name: "@modern-js/plugin-deploy",
12
- pre: [
13
- "@modern-js/plugin-bff",
14
- "@modern-js/plugin-server"
15
- ],
16
- setup: function(api) {
17
- var deployTarget = process.env.MODERNJS_DEPLOY || provider || "node";
18
- return {
19
- beforeDeploy: function beforeDeploy() {
20
- return _async_to_generator(function() {
21
- var appContext, modernConfig, mainEntryName, appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName, entrypoints, _getProjectUsage, useSSR, useAPI, useWebServer, needModernServer, outputDirectory, funcsDirectory, staticDirectory, netlifyOutput, routes, redirectContent, redirectFilePath, vercelOutput, config, destHtmlDirectory, outputHtmlDirectory, plugins, serverAppContext, code, genNodeEntry, genVercelEntry, genNetlifyEntry, entryFilePath;
22
- return _ts_generator(this, function(_state) {
23
- switch (_state.label) {
24
- case 0:
25
- appContext = api.useAppContext();
26
- modernConfig = api.useResolvedConfigContext();
27
- mainEntryName = modernConfig.source.mainEntryName;
28
- appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, serverInternalPlugins = appContext.serverInternalPlugins, sharedDirectory = appContext.sharedDirectory, apiDirectory = appContext.apiDirectory, lambdaDirectory = appContext.lambdaDirectory, metaName = appContext.metaName, entrypoints = appContext.entrypoints;
29
- _getProjectUsage = getProjectUsage(appDirectory, distDirectory), useSSR = _getProjectUsage.useSSR, useAPI = _getProjectUsage.useAPI, useWebServer = _getProjectUsage.useWebServer;
30
- needModernServer = useSSR || useAPI || useWebServer;
31
- outputDirectory = path.join(appDirectory, ".output");
32
- funcsDirectory = outputDirectory;
33
- staticDirectory = path.join(outputDirectory, "static");
34
- if (!(deployTarget === "node"))
35
- return [
36
- 3,
37
- 3
38
- ];
39
- return [
40
- 4,
41
- fse.remove(outputDirectory)
42
- ];
43
- case 1:
44
- _state.sent();
45
- return [
46
- 4,
47
- fse.copy(distDirectory, outputDirectory)
48
- ];
49
- case 2:
50
- _state.sent();
51
- _state.label = 3;
52
- case 3:
53
- if (!(deployTarget === "netlify"))
54
- return [
55
- 3,
56
- 8
57
- ];
58
- netlifyOutput = path.join(appDirectory, ".netlify");
59
- funcsDirectory = path.join(netlifyOutput, "functions");
60
- routes = [];
61
- if (!needModernServer) {
62
- entrypoints.forEach(function(entry) {
63
- var isMain = isMainEntry(entry.entryName, mainEntryName);
64
- routes.push({
65
- src: "/".concat(isMain ? "" : "".concat(entry.entryName, "/"), "*"),
66
- dest: "/html/".concat(entry.entryName, "/index.html"),
67
- status: 200
68
- });
69
- });
70
- } else {
71
- routes.push({
72
- src: "/*",
73
- dest: "/.netlify/functions/index",
74
- status: 200
75
- });
76
- throw new Error("Currently on the Netlify platform, only CSR projects are supporte, Support for SSR and BFF projects will be available later");
77
- }
78
- console.log("routes", routes, needModernServer);
79
- redirectContent = routes.map(function(route) {
80
- return "".concat(route.src, " ").concat(route.dest, " ").concat(route.status);
81
- }).join("\n");
82
- console.log("redirectContent", redirectContent);
83
- return [
84
- 4,
85
- fse.remove(outputDirectory)
86
- ];
87
- case 4:
88
- _state.sent();
89
- return [
90
- 4,
91
- fse.ensureDir(funcsDirectory)
92
- ];
93
- case 5:
94
- _state.sent();
95
- return [
96
- 4,
97
- fse.copy(distDirectory, funcsDirectory, {
98
- filter: function(src) {
99
- var distStaticDirectory = path.join(distDirectory, "static");
100
- return !src.includes(distStaticDirectory);
101
- }
102
- })
103
- ];
104
- case 6:
105
- _state.sent();
106
- redirectFilePath = path.join(distDirectory, "_redirects");
107
- return [
108
- 4,
109
- fse.writeFile(redirectFilePath, redirectContent)
110
- ];
111
- case 7:
112
- _state.sent();
113
- _state.label = 8;
114
- case 8:
115
- if (!(deployTarget === "vercel"))
116
- return [
117
- 3,
118
- 18
119
- ];
120
- vercelOutput = path.join(appDirectory, ".vercel");
121
- return [
122
- 4,
123
- fse.remove(vercelOutput)
124
- ];
125
- case 9:
126
- _state.sent();
127
- outputDirectory = path.join(vercelOutput, "output");
128
- config = {
129
- version: 3,
130
- routes: [
131
- {
132
- src: "/static/(.*)",
133
- headers: {
134
- "cache-control": "s-maxage=31536000, immutable"
135
- },
136
- continue: true
137
- },
138
- {
139
- handle: "filesystem"
140
- }
141
- ]
142
- };
143
- if (!needModernServer) {
144
- entrypoints.forEach(function(entry) {
145
- var isMain = isMainEntry(entry.entryName, mainEntryName);
146
- config.routes.push({
147
- src: "/".concat(isMain ? "" : entry.entryName, "(?:/.*)?"),
148
- headers: {
149
- "cache-control": "s-maxage=0"
150
- },
151
- dest: "/html/".concat(entry.entryName, "/index.html")
152
- });
153
- });
154
- } else {
155
- config.routes.push({
156
- src: "/(.*)",
157
- dest: "/index"
158
- });
159
- }
160
- return [
161
- 4,
162
- fse.ensureDir(outputDirectory)
163
- ];
164
- case 10:
165
- _state.sent();
166
- return [
167
- 4,
168
- fse.writeJSON(path.join(outputDirectory, "config.json"), config, {
169
- spaces: 2
170
- })
171
- ];
172
- case 11:
173
- _state.sent();
174
- staticDirectory = path.join(outputDirectory, "static/static");
175
- return [
176
- 4,
177
- fse.copy(path.join(distDirectory, "static"), staticDirectory)
178
- ];
179
- case 12:
180
- _state.sent();
181
- if (!!needModernServer)
182
- return [
183
- 3,
184
- 14
185
- ];
186
- destHtmlDirectory = path.join(distDirectory, "html");
187
- outputHtmlDirectory = path.join(path.join(outputDirectory, "static"), "html");
188
- return [
189
- 4,
190
- fse.copy(destHtmlDirectory, outputHtmlDirectory)
191
- ];
192
- case 13:
193
- _state.sent();
194
- return [
195
- 3,
196
- 18
197
- ];
198
- case 14:
199
- funcsDirectory = path.join(outputDirectory, "functions", "index.func");
200
- return [
201
- 4,
202
- fse.ensureDir(funcsDirectory)
203
- ];
204
- case 15:
205
- _state.sent();
206
- return [
207
- 4,
208
- fse.copy(distDirectory, funcsDirectory, {
209
- filter: function(src) {
210
- var distStaticDirectory = path.join(distDirectory, "static");
211
- return !src.includes(distStaticDirectory);
212
- }
213
- })
214
- ];
215
- case 16:
216
- _state.sent();
217
- return [
218
- 4,
219
- fse.writeJSON(path.join(funcsDirectory, ".vc-config.json"), {
220
- runtime: "nodejs16.x",
221
- handler: "index.js",
222
- launcherType: "Nodejs",
223
- shouldAddHelpers: false,
224
- supportsResponseStreaming: true
225
- })
226
- ];
227
- case 17:
228
- _state.sent();
229
- _state.label = 18;
230
- case 18:
231
- plugins = getInternalPlugins(appDirectory, serverInternalPlugins);
232
- serverAppContext = {
233
- sharedDirectory: 'path.join(__dirname, "'.concat(path.relative(appDirectory, sharedDirectory), '")'),
234
- apiDirectory: 'path.join(__dirname, "'.concat(path.relative(appDirectory, apiDirectory), '")'),
235
- lambdaDirectory: 'path.join(__dirname, "'.concat(path.relative(appDirectory, lambdaDirectory), '")'),
236
- metaName
237
- };
238
- code = "";
239
- console.log("deployTarget111111111", deployTarget);
240
- switch (deployTarget) {
241
- case "node":
242
- return [
243
- 3,
244
- 19
245
- ];
246
- case "vercel":
247
- return [
248
- 3,
249
- 21
250
- ];
251
- case "netlify":
252
- return [
253
- 3,
254
- 24
255
- ];
256
- }
257
- return [
258
- 3,
259
- 26
260
- ];
261
- case 19:
262
- return [
263
- 4,
264
- import("./platforms/node")
265
- ];
266
- case 20:
267
- genNodeEntry = _state.sent().genNodeEntry;
268
- code = genNodeEntry({
269
- plugins,
270
- config: modernConfig,
271
- appContext: serverAppContext
272
- });
273
- return [
274
- 3,
275
- 27
276
- ];
277
- case 21:
278
- return [
279
- 4,
280
- import("./platforms/vercel")
281
- ];
282
- case 22:
283
- genVercelEntry = _state.sent().genVercelEntry;
284
- return [
285
- 4,
286
- genVercelEntry({
287
- plugins,
288
- config: modernConfig,
289
- appContext: serverAppContext
290
- })
291
- ];
292
- case 23:
293
- code = _state.sent();
294
- return [
295
- 3,
296
- 27
297
- ];
298
- case 24:
299
- return [
300
- 4,
301
- import("./platforms/netlify")
302
- ];
303
- case 25:
304
- genNetlifyEntry = _state.sent().genNetlifyEntry;
305
- code = genNetlifyEntry({
306
- plugins,
307
- config: modernConfig,
308
- appContext: serverAppContext
309
- });
310
- return [
311
- 3,
312
- 27
313
- ];
314
- case 26:
315
- {
316
- code = 'throw new Error("unknown deploy target, MODERNJS_DEPLOY should be set");';
317
- }
318
- _state.label = 27;
319
- case 27:
320
- entryFilePath = path.join(funcsDirectory, "index.js");
321
- if (!needModernServer)
322
- return [
323
- 3,
324
- 30
325
- ];
326
- return [
327
- 4,
328
- fse.writeFile(entryFilePath, code)
329
- ];
330
- case 28:
331
- _state.sent();
332
- return [
333
- 4,
334
- handleDependencies(appDirectory, funcsDirectory, [
335
- "@modern-js/prod-server"
336
- ])
337
- ];
338
- case 29:
339
- _state.sent();
340
- _state.label = 30;
341
- case 30:
342
- return [
343
- 2
344
- ];
345
- }
346
- });
347
- })();
348
- }
349
- };
350
- }
351
- };
352
- }
353
- ;
354
- export {
355
- deploy_default as default
356
- };
@@ -1,41 +0,0 @@
1
- import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG } from "@modern-js/utils";
2
- import { genPluginImportsCode, getPluginsCode, severAppContextTemplate } from "../utils";
3
- function genNetlifyEntry() {
4
- var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, config = _ref.config, plugins = _ref.plugins, appContext = _ref.appContext;
5
- var defaultConfig = {
6
- server: {
7
- port: 8080
8
- },
9
- output: {
10
- path: "."
11
- }
12
- };
13
- return "\n\n const fs = require('node:fs/promises');\n const path = require('node:path');\n const { createNetlifyFunction } = require('@modern-js/prod-server/netlify');\n ".concat(genPluginImportsCode(plugins || []), `
14
-
15
- let requestHandler = null;
16
-
17
- if(!process.env.NODE_ENV){
18
- process.env.NODE_ENV = 'production';
19
- }
20
-
21
- async function createHandler() {
22
- try {
23
- let routes = [];
24
- const routeFilepath = path.join(__dirname, "`).concat(ROUTE_SPEC_FILE, `");
25
- try {
26
- await fs.access(routeFilepath);
27
- const content = await fs.readFile(routeFilepath, "utf-8");
28
- const routeSpec = JSON.parse(content);
29
- routes = routeSpec.routes;
30
- } catch (error) {
31
- console.warn('route.json not found, continuing with empty routes.');
32
- }
33
-
34
- const prodServerOptions = {
35
- pwd: __dirname,
36
- routes,
37
- config: `).concat(JSON.stringify(config || defaultConfig), ",\n serverConfigFile: '").concat(DEFAULT_SERVER_CONFIG, "',\n plugins: ").concat(getPluginsCode(plugins || []), ",\n appContext: ").concat(appContext ? severAppContextTemplate(appContext) : "undefined", ",\n disableCustomHook: true\n }\n\n requestHandler = await createNetlifyFunction(prodServerOptions)\n\n return requestHandler\n } catch(error) {\n console.error(error);\n process.exit(1);\n }\n }\n\n createHandler();\n\n const handleRequest = async(request, context) => {\n if(typeof requestHandler !== 'function'){\n await createHandler();\n }\n return requestHandler(request, context);\n }\n\n export default handleRequest;\n ");
38
- }
39
- export {
40
- genNetlifyEntry
41
- };
@@ -1,39 +0,0 @@
1
- import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG } from "@modern-js/utils";
2
- import { genPluginImportsCode, getPluginsCode, severAppContextTemplate } from "../utils";
3
- function genNodeEntry() {
4
- var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, config = _ref.config, plugins = _ref.plugins, appContext = _ref.appContext;
5
- var defaultConfig = {
6
- server: {
7
- port: 8080
8
- },
9
- output: {
10
- path: "."
11
- }
12
- };
13
- return "\n\n const fs = require('node:fs/promises');\n const path = require('node:path');\n const { createProdServer } = require('@modern-js/prod-server');\n ".concat(genPluginImportsCode(plugins || []), `
14
-
15
- if(!process.env.NODE_ENV){
16
- process.env.NODE_ENV = 'production';
17
- }
18
-
19
- async function main() {
20
- try {
21
- let routes = [];
22
- const routeFilepath = path.join(__dirname, "`).concat(ROUTE_SPEC_FILE, `");
23
- try {
24
- await fs.access(routeFilepath);
25
- const content = await fs.readFile(routeFilepath, "utf-8");
26
- const routeSpec = JSON.parse(content);
27
- routes = routeSpec.routes;
28
- } catch (error) {
29
- console.warn('route.json not found, continuing with empty routes.');
30
- }
31
-
32
- const prodServerOptions = {
33
- pwd: __dirname,
34
- routes,
35
- config: `).concat(JSON.stringify(config || defaultConfig), ",\n serverConfigFile: '").concat(DEFAULT_SERVER_CONFIG, "',\n plugins: ").concat(getPluginsCode(plugins || []), ",\n appContext: ").concat(appContext ? severAppContextTemplate(appContext) : "undefined", ",\n disableCustomHook: true\n }\n\n const app = await createProdServer(prodServerOptions)\n\n const port = process.env.PORT || 3000;\n\n app.listen(port, () => {\n console.log('\\x1b[32mServer is listening on port', port, '\\x1b[0m');\n });\n } catch(error) {\n console.error(error);\n process.exit(1);\n }\n }\n\n main();\n ");
36
- }
37
- export {
38
- genNodeEntry
39
- };
File without changes
@@ -1,47 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
- import path from "node:path";
4
- import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse } from "@modern-js/utils";
5
- import { genPluginImportsCode, getPluginsCode, severAppContextTemplate } from "../utils";
6
- function genVercelEntry() {
7
- return _genVercelEntry.apply(this, arguments);
8
- }
9
- function _genVercelEntry() {
10
- _genVercelEntry = _async_to_generator(function() {
11
- var _ref, config, plugins, appContext, defaultConfig, pluginImportCode, dynamicProdOptions, entryCode;
12
- var _arguments = arguments;
13
- return _ts_generator(this, function(_state) {
14
- switch (_state.label) {
15
- case 0:
16
- _ref = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, config = _ref.config, plugins = _ref.plugins, appContext = _ref.appContext;
17
- defaultConfig = {
18
- output: {
19
- path: "."
20
- }
21
- };
22
- pluginImportCode = genPluginImportsCode(plugins || []);
23
- dynamicProdOptions = {
24
- config: "".concat(JSON.stringify(config || defaultConfig)),
25
- serverConfigFile: DEFAULT_SERVER_CONFIG,
26
- plugins: "".concat(getPluginsCode(plugins || [])),
27
- appContext: "".concat(appContext ? severAppContextTemplate(appContext) : "undefined")
28
- };
29
- return [
30
- 4,
31
- fse.readFile(path.join(__dirname, "./vercelEntry.js"))
32
- ];
33
- case 1:
34
- entryCode = _state.sent().toString();
35
- entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", ROUTE_SPEC_FILE).replace("p_dynamicProdOptions", JSON.stringify(dynamicProdOptions));
36
- return [
37
- 2,
38
- entryCode
39
- ];
40
- }
41
- });
42
- });
43
- return _genVercelEntry.apply(this, arguments);
44
- }
45
- export {
46
- genVercelEntry
47
- };
@@ -1,197 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
5
- var require_vercelEntry = __commonJS({
6
- "src/plugins/deploy/platforms/vercelEntry.js"(exports, module) {
7
- var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
8
- var _object_spread = require("@swc/helpers/_/_object_spread");
9
- var _ts_generator = require("@swc/helpers/_/_ts_generator");
10
- var fs = require("node:fs/promises");
11
- var path = require("node:path");
12
- var createProdServer = require("@modern-js/prod-server").createProdServer;
13
- p_genPluginImportsCode;
14
- if (!process.env.NODE_ENV) {
15
- process.env.NODE_ENV = "production";
16
- }
17
- var requestHandler = null;
18
- var handlerCreationPromise = null;
19
- function loadRoutes(routeFilepath) {
20
- return _loadRoutes.apply(this, arguments);
21
- }
22
- function _loadRoutes() {
23
- _loadRoutes = _async_to_generator._(function(routeFilepath) {
24
- var content, routeSpec, error;
25
- return _ts_generator._(this, function(_state) {
26
- switch (_state.label) {
27
- case 0:
28
- _state.trys.push([
29
- 0,
30
- 3,
31
- ,
32
- 4
33
- ]);
34
- return [
35
- 4,
36
- fs.access(routeFilepath)
37
- ];
38
- case 1:
39
- _state.sent();
40
- return [
41
- 4,
42
- fs.readFile(routeFilepath, "utf-8")
43
- ];
44
- case 2:
45
- content = _state.sent();
46
- routeSpec = JSON.parse(content);
47
- return [
48
- 2,
49
- routeSpec.routes || []
50
- ];
51
- case 3:
52
- error = _state.sent();
53
- console.warn("route.json not found or invalid, continuing with empty routes.");
54
- return [
55
- 2,
56
- []
57
- ];
58
- case 4:
59
- return [
60
- 2
61
- ];
62
- }
63
- });
64
- });
65
- return _loadRoutes.apply(this, arguments);
66
- }
67
- function initServer() {
68
- return _initServer.apply(this, arguments);
69
- }
70
- function _initServer() {
71
- _initServer = _async_to_generator._(function() {
72
- var routeFilepath, routes, dynamicProdOptions, prodServerOptions, app;
73
- return _ts_generator._(this, function(_state) {
74
- switch (_state.label) {
75
- case 0:
76
- routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
77
- return [
78
- 4,
79
- loadRoutes(routeFilepath)
80
- ];
81
- case 1:
82
- routes = _state.sent();
83
- dynamicProdOptions = p_dynamicProdOptions;
84
- prodServerOptions = _object_spread._({
85
- pwd: __dirname,
86
- routes,
87
- disableCustomHook: true
88
- }, dynamicProdOptions);
89
- return [
90
- 4,
91
- createProdServer(prodServerOptions)
92
- ];
93
- case 2:
94
- app = _state.sent();
95
- return [
96
- 2,
97
- app.getRequestListener()
98
- ];
99
- }
100
- });
101
- });
102
- return _initServer.apply(this, arguments);
103
- }
104
- function createHandler() {
105
- return _createHandler.apply(this, arguments);
106
- }
107
- function _createHandler() {
108
- _createHandler = _async_to_generator._(function() {
109
- return _ts_generator._(this, function(_state) {
110
- switch (_state.label) {
111
- case 0:
112
- if (!handlerCreationPromise) {
113
- handlerCreationPromise = _async_to_generator._(function() {
114
- var error;
115
- return _ts_generator._(this, function(_state2) {
116
- switch (_state2.label) {
117
- case 0:
118
- _state2.trys.push([
119
- 0,
120
- 2,
121
- ,
122
- 3
123
- ]);
124
- return [
125
- 4,
126
- initServer()
127
- ];
128
- case 1:
129
- requestHandler = _state2.sent();
130
- return [
131
- 3,
132
- 3
133
- ];
134
- case 2:
135
- error = _state2.sent();
136
- console.error("Error creating server:", error);
137
- process.exit(1);
138
- return [
139
- 3,
140
- 3
141
- ];
142
- case 3:
143
- return [
144
- 2
145
- ];
146
- }
147
- });
148
- })();
149
- }
150
- return [
151
- 4,
152
- handlerCreationPromise
153
- ];
154
- case 1:
155
- _state.sent();
156
- return [
157
- 2,
158
- requestHandler
159
- ];
160
- }
161
- });
162
- });
163
- return _createHandler.apply(this, arguments);
164
- }
165
- createHandler();
166
- module.exports = function() {
167
- var _ref = _async_to_generator._(function(req, res) {
168
- return _ts_generator._(this, function(_state) {
169
- switch (_state.label) {
170
- case 0:
171
- if (!!requestHandler)
172
- return [
173
- 3,
174
- 2
175
- ];
176
- return [
177
- 4,
178
- createHandler()
179
- ];
180
- case 1:
181
- _state.sent();
182
- _state.label = 2;
183
- case 2:
184
- return [
185
- 2,
186
- requestHandler(req, res)
187
- ];
188
- }
189
- });
190
- });
191
- return function(req, res) {
192
- return _ref.apply(this, arguments);
193
- };
194
- }();
195
- }
196
- });
197
- export default require_vercelEntry();