@modern-js/app-tools 2.49.1-alpha.6 → 2.49.1-alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/plugins/deploy/entrys/vercel.js +3 -1
- package/dist/cjs/plugins/deploy/index.js +3 -8
- package/dist/esm/plugins/deploy/entrys/vercel.js +1 -1
- package/dist/esm/plugins/deploy/index.js +4 -9
- package/dist/esm-node/plugins/deploy/entrys/vercel.js +3 -1
- package/dist/esm-node/plugins/deploy/index.js +3 -8
- package/package.json +5 -5
@@ -67,7 +67,9 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
67
67
|
disableCustomHook: true
|
68
68
|
}
|
69
69
|
|
70
|
-
|
70
|
+
const app = await createProdServer(prodServerOptions)
|
71
|
+
|
72
|
+
requestHandler = app.getRequestListener();
|
71
73
|
|
72
74
|
return requestHandler;
|
73
75
|
} catch(error) {
|
@@ -42,9 +42,9 @@ var deploy_default = () => ({
|
|
42
42
|
"@modern-js/plugin-server"
|
43
43
|
],
|
44
44
|
setup: (api) => {
|
45
|
+
const deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
45
46
|
return {
|
46
47
|
async beforeDeploy() {
|
47
|
-
const deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
48
48
|
const appContext = api.useAppContext();
|
49
49
|
const { appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName } = appContext;
|
50
50
|
const configContext = api.useResolvedConfigContext();
|
@@ -53,12 +53,7 @@ var deploy_default = () => ({
|
|
53
53
|
let staticDirectory = import_path.default.join(outputDirectory, "static");
|
54
54
|
await import_utils.fs.remove(outputDirectory);
|
55
55
|
if (deployTarget === "node") {
|
56
|
-
await import_utils.fs.copy(distDirectory, outputDirectory
|
57
|
-
filter: (src) => {
|
58
|
-
const distStaticDirectory = import_path.default.join(distDirectory, "static");
|
59
|
-
return !src.includes(distStaticDirectory);
|
60
|
-
}
|
61
|
-
});
|
56
|
+
await import_utils.fs.copy(distDirectory, outputDirectory);
|
62
57
|
}
|
63
58
|
if (deployTarget === "vercel") {
|
64
59
|
outputDirectory = import_path.default.join(appDirectory, ".vercel/output");
|
@@ -68,7 +63,7 @@ var deploy_default = () => ({
|
|
68
63
|
await import_utils.fs.ensureDir(outputDirectory);
|
69
64
|
await import_utils.fs.writeJSON(import_path.default.join(outputDirectory, "config.json"), config2);
|
70
65
|
funcsDirectory = import_path.default.join(outputDirectory, "functions", "index.func");
|
71
|
-
staticDirectory = import_path.default.join(outputDirectory, "static");
|
66
|
+
staticDirectory = import_path.default.join(outputDirectory, "static/static");
|
72
67
|
await import_utils.fs.ensureDir(funcsDirectory);
|
73
68
|
await import_utils.fs.copy(distDirectory, funcsDirectory, {
|
74
69
|
filter: (src) => {
|
@@ -33,7 +33,7 @@ function genVercelEntry() {
|
|
33
33
|
const prodServerOptions = {
|
34
34
|
pwd: __dirname,
|
35
35
|
routes,
|
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
|
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 const app = await createProdServer(prodServerOptions)\n\n requestHandler = app.getRequestListener();\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 ");
|
37
37
|
}
|
38
38
|
export {
|
39
39
|
genVercelEntry
|
@@ -12,14 +12,14 @@ function deploy_default() {
|
|
12
12
|
"@modern-js/plugin-server"
|
13
13
|
],
|
14
14
|
setup: function(api) {
|
15
|
+
var deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
15
16
|
return {
|
16
17
|
beforeDeploy: function beforeDeploy() {
|
17
18
|
return _async_to_generator(function() {
|
18
|
-
var
|
19
|
+
var appContext, appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName, configContext, outputDirectory, funcsDirectory, staticDirectory, config, bff, config1, plugins, serverAppContext, code, genNodeEntry, genVercelEntry, genNetlifyEntry, _getProjectUsage, useSSR, useAPI, useWebServer, entryFilePath;
|
19
20
|
return _ts_generator(this, function(_state) {
|
20
21
|
switch (_state.label) {
|
21
22
|
case 0:
|
22
|
-
deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
23
23
|
appContext = api.useAppContext();
|
24
24
|
appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, serverInternalPlugins = appContext.serverInternalPlugins, sharedDirectory = appContext.sharedDirectory, apiDirectory = appContext.apiDirectory, lambdaDirectory = appContext.lambdaDirectory, metaName = appContext.metaName;
|
25
25
|
configContext = api.useResolvedConfigContext();
|
@@ -39,12 +39,7 @@ function deploy_default() {
|
|
39
39
|
];
|
40
40
|
return [
|
41
41
|
4,
|
42
|
-
fse.copy(distDirectory, outputDirectory
|
43
|
-
filter: function(src) {
|
44
|
-
var distStaticDirectory = path.join(distDirectory, "static");
|
45
|
-
return !src.includes(distStaticDirectory);
|
46
|
-
}
|
47
|
-
})
|
42
|
+
fse.copy(distDirectory, outputDirectory)
|
48
43
|
];
|
49
44
|
case 2:
|
50
45
|
_state.sent();
|
@@ -72,7 +67,7 @@ function deploy_default() {
|
|
72
67
|
case 5:
|
73
68
|
_state.sent();
|
74
69
|
funcsDirectory = path.join(outputDirectory, "functions", "index.func");
|
75
|
-
staticDirectory = path.join(outputDirectory, "static");
|
70
|
+
staticDirectory = path.join(outputDirectory, "static/static");
|
76
71
|
return [
|
77
72
|
4,
|
78
73
|
fse.ensureDir(funcsDirectory)
|
@@ -44,7 +44,9 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
44
44
|
disableCustomHook: true
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
const app = await createProdServer(prodServerOptions)
|
48
|
+
|
49
|
+
requestHandler = app.getRequestListener();
|
48
50
|
|
49
51
|
return requestHandler;
|
50
52
|
} catch(error) {
|
@@ -9,9 +9,9 @@ var deploy_default = () => ({
|
|
9
9
|
"@modern-js/plugin-server"
|
10
10
|
],
|
11
11
|
setup: (api) => {
|
12
|
+
const deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
12
13
|
return {
|
13
14
|
async beforeDeploy() {
|
14
|
-
const deployTarget = process.env.MODERNJS_DEPLOY || "node";
|
15
15
|
const appContext = api.useAppContext();
|
16
16
|
const { appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName } = appContext;
|
17
17
|
const configContext = api.useResolvedConfigContext();
|
@@ -20,12 +20,7 @@ var deploy_default = () => ({
|
|
20
20
|
let staticDirectory = path.join(outputDirectory, "static");
|
21
21
|
await fse.remove(outputDirectory);
|
22
22
|
if (deployTarget === "node") {
|
23
|
-
await fse.copy(distDirectory, outputDirectory
|
24
|
-
filter: (src) => {
|
25
|
-
const distStaticDirectory = path.join(distDirectory, "static");
|
26
|
-
return !src.includes(distStaticDirectory);
|
27
|
-
}
|
28
|
-
});
|
23
|
+
await fse.copy(distDirectory, outputDirectory);
|
29
24
|
}
|
30
25
|
if (deployTarget === "vercel") {
|
31
26
|
outputDirectory = path.join(appDirectory, ".vercel/output");
|
@@ -35,7 +30,7 @@ var deploy_default = () => ({
|
|
35
30
|
await fse.ensureDir(outputDirectory);
|
36
31
|
await fse.writeJSON(path.join(outputDirectory, "config.json"), config2);
|
37
32
|
funcsDirectory = path.join(outputDirectory, "functions", "index.func");
|
38
|
-
staticDirectory = path.join(outputDirectory, "static");
|
33
|
+
staticDirectory = path.join(outputDirectory, "static/static");
|
39
34
|
await fse.ensureDir(funcsDirectory);
|
40
35
|
await fse.copy(distDirectory, funcsDirectory, {
|
41
36
|
filter: (src) => {
|
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.7",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -81,18 +81,18 @@
|
|
81
81
|
"pkg-types": "^1.1.0",
|
82
82
|
"@modern-js/core": "2.49.0",
|
83
83
|
"@modern-js/plugin": "2.49.0",
|
84
|
+
"@modern-js/node-bundle-require": "2.49.0",
|
84
85
|
"@modern-js/plugin-i18n": "2.49.0",
|
85
86
|
"@modern-js/plugin-lint": "2.49.0",
|
86
|
-
"@modern-js/server": "2.49.0",
|
87
87
|
"@modern-js/prod-server": "2.49.0",
|
88
88
|
"@modern-js/server-core": "2.49.0",
|
89
89
|
"@modern-js/server-utils": "2.49.0",
|
90
90
|
"@modern-js/types": "2.49.0",
|
91
|
-
"@modern-js/rsbuild-plugin-esbuild": "2.49.1",
|
92
91
|
"@modern-js/utils": "2.49.0",
|
93
|
-
"@modern-js/
|
92
|
+
"@modern-js/server": "2.49.0",
|
93
|
+
"@modern-js/uni-builder": "2.49.0",
|
94
94
|
"@modern-js/plugin-data-loader": "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",
|