@modern-js/app-tools 2.49.1-alpha.0 → 2.49.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,15 +36,14 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
36
36
|
|
37
37
|
const fs = require('node:fs/promises');
|
38
38
|
const path = require('node:path');
|
39
|
-
const {
|
39
|
+
const { createProdServer } = require('@modern-js/prod-server');
|
40
40
|
${(0, import_utils2.genPluginImportsCode)(plugins || [])}
|
41
41
|
|
42
|
-
let requestHandler = null;
|
43
|
-
|
44
42
|
if(!process.env.NODE_ENV){
|
45
43
|
process.env.NODE_ENV = 'production';
|
46
44
|
}
|
47
45
|
|
46
|
+
let requestHandler = null;
|
48
47
|
async function createHandler() {
|
49
48
|
try {
|
50
49
|
let routes = [];
|
@@ -68,9 +67,9 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
68
67
|
disableCustomHook: true
|
69
68
|
}
|
70
69
|
|
71
|
-
requestHandler = await
|
70
|
+
requestHandler = await createProdServer(prodServerOptions)
|
72
71
|
|
73
|
-
return requestHandler
|
72
|
+
return requestHandler;
|
74
73
|
} catch(error) {
|
75
74
|
console.error(error);
|
76
75
|
process.exit(1);
|
@@ -79,14 +78,12 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
79
78
|
|
80
79
|
createHandler();
|
81
80
|
|
82
|
-
|
81
|
+
module.exports = async(req, res) => {
|
83
82
|
if(typeof requestHandler !== 'function'){
|
84
83
|
await createHandler();
|
85
84
|
}
|
86
|
-
return requestHandler(
|
85
|
+
return requestHandler(req, res);
|
87
86
|
}
|
88
|
-
|
89
|
-
export default handleRequest;
|
90
87
|
`;
|
91
88
|
}
|
92
89
|
// Annotate the CommonJS export names for ESM import in node:
|
@@ -10,14 +10,13 @@ function genVercelEntry() {
|
|
10
10
|
path: "."
|
11
11
|
}
|
12
12
|
};
|
13
|
-
return "\n\n const fs = require('node:fs/promises');\n const path = require('node:path');\n const {
|
14
|
-
|
15
|
-
let requestHandler = null;
|
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 || []), `
|
16
14
|
|
17
15
|
if(!process.env.NODE_ENV){
|
18
16
|
process.env.NODE_ENV = 'production';
|
19
17
|
}
|
20
18
|
|
19
|
+
let requestHandler = null;
|
21
20
|
async function createHandler() {
|
22
21
|
try {
|
23
22
|
let routes = [];
|
@@ -34,7 +33,7 @@ function genVercelEntry() {
|
|
34
33
|
const prodServerOptions = {
|
35
34
|
pwd: __dirname,
|
36
35
|
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
|
36
|
+
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 createProdServer(prodServerOptions)\n\n return requestHandler;\n } catch(error) {\n console.error(error);\n process.exit(1);\n }\n }\n\n createHandler();\n\n module.exports = async(req, res) => {\n if(typeof requestHandler !== 'function'){\n await createHandler();\n }\n return requestHandler(req, res);\n }\n ");
|
38
37
|
}
|
39
38
|
export {
|
40
39
|
genVercelEntry
|
@@ -13,15 +13,14 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
13
13
|
|
14
14
|
const fs = require('node:fs/promises');
|
15
15
|
const path = require('node:path');
|
16
|
-
const {
|
16
|
+
const { createProdServer } = require('@modern-js/prod-server');
|
17
17
|
${genPluginImportsCode(plugins || [])}
|
18
18
|
|
19
|
-
let requestHandler = null;
|
20
|
-
|
21
19
|
if(!process.env.NODE_ENV){
|
22
20
|
process.env.NODE_ENV = 'production';
|
23
21
|
}
|
24
22
|
|
23
|
+
let requestHandler = null;
|
25
24
|
async function createHandler() {
|
26
25
|
try {
|
27
26
|
let routes = [];
|
@@ -45,9 +44,9 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
45
44
|
disableCustomHook: true
|
46
45
|
}
|
47
46
|
|
48
|
-
requestHandler = await
|
47
|
+
requestHandler = await createProdServer(prodServerOptions)
|
49
48
|
|
50
|
-
return requestHandler
|
49
|
+
return requestHandler;
|
51
50
|
} catch(error) {
|
52
51
|
console.error(error);
|
53
52
|
process.exit(1);
|
@@ -56,14 +55,12 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
56
55
|
|
57
56
|
createHandler();
|
58
57
|
|
59
|
-
|
58
|
+
module.exports = async(req, res) => {
|
60
59
|
if(typeof requestHandler !== 'function'){
|
61
60
|
await createHandler();
|
62
61
|
}
|
63
|
-
return requestHandler(
|
62
|
+
return requestHandler(req, res);
|
64
63
|
}
|
65
|
-
|
66
|
-
export default handleRequest;
|
67
64
|
`;
|
68
65
|
}
|
69
66
|
export {
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.49.1-alpha.
|
18
|
+
"version": "2.49.1-alpha.2",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -79,20 +79,20 @@
|
|
79
79
|
"esbuild-register": "^3.5.0",
|
80
80
|
"mlly": "^1.6.1",
|
81
81
|
"pkg-types": "^1.1.0",
|
82
|
-
"@modern-js/core": "2.49.0",
|
83
|
-
"@modern-js/node-bundle-require": "2.49.0",
|
84
82
|
"@modern-js/plugin": "2.49.0",
|
83
|
+
"@modern-js/core": "2.49.0",
|
85
84
|
"@modern-js/plugin-i18n": "2.49.0",
|
86
85
|
"@modern-js/plugin-lint": "2.49.0",
|
87
|
-
"@modern-js/
|
88
|
-
"@modern-js/rsbuild-plugin-esbuild": "0.6.3",
|
86
|
+
"@modern-js/node-bundle-require": "2.49.0",
|
89
87
|
"@modern-js/server": "2.49.0",
|
90
|
-
"@modern-js/plugin-data-loader": "2.49.0",
|
91
|
-
"@modern-js/server-utils": "2.49.0",
|
92
88
|
"@modern-js/server-core": "2.49.0",
|
89
|
+
"@modern-js/prod-server": "2.49.0",
|
93
90
|
"@modern-js/types": "2.49.0",
|
91
|
+
"@modern-js/plugin-data-loader": "2.49.0",
|
92
|
+
"@modern-js/utils": "2.49.0",
|
93
|
+
"@modern-js/server-utils": "2.49.0",
|
94
94
|
"@modern-js/uni-builder": "2.49.0",
|
95
|
-
"@modern-js/
|
95
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.49.1"
|
96
96
|
},
|
97
97
|
"devDependencies": {
|
98
98
|
"@rsbuild/plugin-swc": "0.6.4",
|