@modern-js/app-tools 2.49.3-alpha.2 → 2.49.3-alpha.3
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.
- package/dist/cjs/plugins/deploy/entrys/vercel.js +0 -3
- package/dist/cjs/plugins/deploy/index.js +1 -5
- package/dist/esm/plugins/deploy/entrys/vercel.js +0 -3
- package/dist/esm/plugins/deploy/index.js +28 -47
- package/dist/esm-node/plugins/deploy/entrys/vercel.js +0 -3
- package/dist/esm-node/plugins/deploy/index.js +1 -5
- package/dist/types/plugins/deploy/entrys/vercel.d.ts +1 -2
- package/package.json +7 -7
@@ -32,9 +32,6 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
32
32
|
path: "."
|
33
33
|
}
|
34
34
|
};
|
35
|
-
if (appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory) {
|
36
|
-
appContext.apiDirectory = appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory.replace(/\/api$/, "/_api");
|
37
|
-
}
|
38
35
|
return `
|
39
36
|
|
40
37
|
const fs = require('node:fs/promises');
|
@@ -54,7 +54,7 @@ var deploy_default = () => ({
|
|
54
54
|
let outputDirectory = import_path.default.join(appDirectory, ".output");
|
55
55
|
let funcsDirectory = outputDirectory;
|
56
56
|
let staticDirectory = import_path.default.join(outputDirectory, "static");
|
57
|
-
if (deployTarget === "node") {
|
57
|
+
if (deployTarget === "node" || deployTarget === "netlify") {
|
58
58
|
await import_utils.fs.remove(outputDirectory);
|
59
59
|
await import_utils.fs.copy(distDirectory, outputDirectory);
|
60
60
|
}
|
@@ -112,10 +112,6 @@ var deploy_default = () => ({
|
|
112
112
|
return !src.includes(distStaticDirectory);
|
113
113
|
}
|
114
114
|
});
|
115
|
-
const apiDirectory2 = import_path.default.join(funcsDirectory, "api");
|
116
|
-
if (await import_utils.fs.pathExists(apiDirectory2)) {
|
117
|
-
await import_utils.fs.rename(apiDirectory2, import_path.default.join(funcsDirectory, "_api"));
|
118
|
-
}
|
119
115
|
await import_utils.fs.writeJSON(import_path.default.join(funcsDirectory, ".vc-config.json"), {
|
120
116
|
runtime: "nodejs16.x",
|
121
117
|
handler: "index.js",
|
@@ -10,9 +10,6 @@ function genVercelEntry() {
|
|
10
10
|
path: "."
|
11
11
|
}
|
12
12
|
};
|
13
|
-
if (appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory) {
|
14
|
-
appContext.apiDirectory = appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory.replace(/\/api$/, "/_api");
|
15
|
-
}
|
16
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 || []), `
|
17
14
|
|
18
15
|
if(!process.env.NODE_ENV){
|
@@ -17,7 +17,7 @@ function deploy_default() {
|
|
17
17
|
return {
|
18
18
|
beforeDeploy: function beforeDeploy() {
|
19
19
|
return _async_to_generator(function() {
|
20
|
-
var appContext, appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName, entrypoints, _getProjectUsage, useSSR, useAPI, useWebServer, needModernServer, configContext, outputDirectory, funcsDirectory, staticDirectory, vercelOutput, config, destHtmlDirectory, outputHtmlDirectory,
|
20
|
+
var appContext, appDirectory, distDirectory, serverInternalPlugins, sharedDirectory, apiDirectory, lambdaDirectory, metaName, entrypoints, _getProjectUsage, useSSR, useAPI, useWebServer, needModernServer, configContext, outputDirectory, funcsDirectory, staticDirectory, vercelOutput, config, destHtmlDirectory, outputHtmlDirectory, bff, config1, plugins, serverAppContext, code, genNodeEntry, genVercelEntry, genNetlifyEntry, entryFilePath;
|
21
21
|
return _ts_generator(this, function(_state) {
|
22
22
|
switch (_state.label) {
|
23
23
|
case 0:
|
@@ -29,7 +29,7 @@ function deploy_default() {
|
|
29
29
|
outputDirectory = path.join(appDirectory, ".output");
|
30
30
|
funcsDirectory = outputDirectory;
|
31
31
|
staticDirectory = path.join(outputDirectory, "static");
|
32
|
-
if (!(deployTarget === "node"))
|
32
|
+
if (!(deployTarget === "node" || deployTarget === "netlify"))
|
33
33
|
return [
|
34
34
|
3,
|
35
35
|
3
|
@@ -51,7 +51,7 @@ function deploy_default() {
|
|
51
51
|
if (!(deployTarget === "vercel"))
|
52
52
|
return [
|
53
53
|
3,
|
54
|
-
|
54
|
+
13
|
55
55
|
];
|
56
56
|
vercelOutput = path.join(appDirectory, ".vercel");
|
57
57
|
return [
|
@@ -128,7 +128,7 @@ function deploy_default() {
|
|
128
128
|
_state.sent();
|
129
129
|
return [
|
130
130
|
3,
|
131
|
-
|
131
|
+
13
|
132
132
|
];
|
133
133
|
case 9:
|
134
134
|
funcsDirectory = path.join(outputDirectory, "functions", "index.func");
|
@@ -149,25 +149,6 @@ function deploy_default() {
|
|
149
149
|
];
|
150
150
|
case 11:
|
151
151
|
_state.sent();
|
152
|
-
apiDirectory1 = path.join(funcsDirectory, "api");
|
153
|
-
return [
|
154
|
-
4,
|
155
|
-
fse.pathExists(apiDirectory1)
|
156
|
-
];
|
157
|
-
case 12:
|
158
|
-
if (!_state.sent())
|
159
|
-
return [
|
160
|
-
3,
|
161
|
-
14
|
162
|
-
];
|
163
|
-
return [
|
164
|
-
4,
|
165
|
-
fse.rename(apiDirectory1, path.join(funcsDirectory, "_api"))
|
166
|
-
];
|
167
|
-
case 13:
|
168
|
-
_state.sent();
|
169
|
-
_state.label = 14;
|
170
|
-
case 14:
|
171
152
|
return [
|
172
153
|
4,
|
173
154
|
fse.writeJSON(path.join(funcsDirectory, ".vc-config.json"), {
|
@@ -178,10 +159,10 @@ function deploy_default() {
|
|
178
159
|
supportsResponseStreaming: true
|
179
160
|
})
|
180
161
|
];
|
181
|
-
case
|
162
|
+
case 12:
|
182
163
|
_state.sent();
|
183
|
-
_state.label =
|
184
|
-
case
|
164
|
+
_state.label = 13;
|
165
|
+
case 13:
|
185
166
|
bff = configContext.bff;
|
186
167
|
config1 = {
|
187
168
|
output: {
|
@@ -202,29 +183,29 @@ function deploy_default() {
|
|
202
183
|
case "node":
|
203
184
|
return [
|
204
185
|
3,
|
205
|
-
|
186
|
+
14
|
206
187
|
];
|
207
188
|
case "vercel":
|
208
189
|
return [
|
209
190
|
3,
|
210
|
-
|
191
|
+
16
|
211
192
|
];
|
212
193
|
case "netlify":
|
213
194
|
return [
|
214
195
|
3,
|
215
|
-
|
196
|
+
18
|
216
197
|
];
|
217
198
|
}
|
218
199
|
return [
|
219
200
|
3,
|
220
|
-
|
201
|
+
20
|
221
202
|
];
|
222
|
-
case
|
203
|
+
case 14:
|
223
204
|
return [
|
224
205
|
4,
|
225
206
|
import("./entrys/node")
|
226
207
|
];
|
227
|
-
case
|
208
|
+
case 15:
|
228
209
|
genNodeEntry = _state.sent().genNodeEntry;
|
229
210
|
code = genNodeEntry({
|
230
211
|
plugins,
|
@@ -233,14 +214,14 @@ function deploy_default() {
|
|
233
214
|
});
|
234
215
|
return [
|
235
216
|
3,
|
236
|
-
|
217
|
+
21
|
237
218
|
];
|
238
|
-
case
|
219
|
+
case 16:
|
239
220
|
return [
|
240
221
|
4,
|
241
222
|
import("./entrys/vercel")
|
242
223
|
];
|
243
|
-
case
|
224
|
+
case 17:
|
244
225
|
genVercelEntry = _state.sent().genVercelEntry;
|
245
226
|
code = genVercelEntry({
|
246
227
|
plugins,
|
@@ -249,14 +230,14 @@ function deploy_default() {
|
|
249
230
|
});
|
250
231
|
return [
|
251
232
|
3,
|
252
|
-
|
233
|
+
21
|
253
234
|
];
|
254
|
-
case
|
235
|
+
case 18:
|
255
236
|
return [
|
256
237
|
4,
|
257
238
|
import("./entrys/netlify")
|
258
239
|
];
|
259
|
-
case
|
240
|
+
case 19:
|
260
241
|
genNetlifyEntry = _state.sent().genNetlifyEntry;
|
261
242
|
code = genNetlifyEntry({
|
262
243
|
plugins,
|
@@ -265,25 +246,25 @@ function deploy_default() {
|
|
265
246
|
});
|
266
247
|
return [
|
267
248
|
3,
|
268
|
-
|
249
|
+
21
|
269
250
|
];
|
270
|
-
case
|
251
|
+
case 20:
|
271
252
|
{
|
272
253
|
code = 'throw new Error("unknown deploy target, MODERNJS_DEPLOY should be set");';
|
273
254
|
}
|
274
|
-
_state.label =
|
275
|
-
case
|
255
|
+
_state.label = 21;
|
256
|
+
case 21:
|
276
257
|
entryFilePath = path.join(funcsDirectory, "index.js");
|
277
258
|
if (!needModernServer)
|
278
259
|
return [
|
279
260
|
3,
|
280
|
-
|
261
|
+
24
|
281
262
|
];
|
282
263
|
return [
|
283
264
|
4,
|
284
265
|
fse.writeFile(entryFilePath, code)
|
285
266
|
];
|
286
|
-
case
|
267
|
+
case 22:
|
287
268
|
_state.sent();
|
288
269
|
return [
|
289
270
|
4,
|
@@ -291,10 +272,10 @@ function deploy_default() {
|
|
291
272
|
"@modern-js/prod-server"
|
292
273
|
])
|
293
274
|
];
|
294
|
-
case
|
275
|
+
case 23:
|
295
276
|
_state.sent();
|
296
|
-
_state.label =
|
297
|
-
case
|
277
|
+
_state.label = 24;
|
278
|
+
case 24:
|
298
279
|
return [
|
299
280
|
2
|
300
281
|
];
|
@@ -9,9 +9,6 @@ function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
9
9
|
path: "."
|
10
10
|
}
|
11
11
|
};
|
12
|
-
if (appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory) {
|
13
|
-
appContext.apiDirectory = appContext === null || appContext === void 0 ? void 0 : appContext.apiDirectory.replace(/\/api$/, "/_api");
|
14
|
-
}
|
15
12
|
return `
|
16
13
|
|
17
14
|
const fs = require('node:fs/promises');
|
@@ -21,7 +21,7 @@ var deploy_default = () => ({
|
|
21
21
|
let outputDirectory = path.join(appDirectory, ".output");
|
22
22
|
let funcsDirectory = outputDirectory;
|
23
23
|
let staticDirectory = path.join(outputDirectory, "static");
|
24
|
-
if (deployTarget === "node") {
|
24
|
+
if (deployTarget === "node" || deployTarget === "netlify") {
|
25
25
|
await fse.remove(outputDirectory);
|
26
26
|
await fse.copy(distDirectory, outputDirectory);
|
27
27
|
}
|
@@ -79,10 +79,6 @@ var deploy_default = () => ({
|
|
79
79
|
return !src.includes(distStaticDirectory);
|
80
80
|
}
|
81
81
|
});
|
82
|
-
const apiDirectory2 = path.join(funcsDirectory, "api");
|
83
|
-
if (await fse.pathExists(apiDirectory2)) {
|
84
|
-
await fse.rename(apiDirectory2, path.join(funcsDirectory, "_api"));
|
85
|
-
}
|
86
82
|
await fse.writeJSON(path.join(funcsDirectory, ".vc-config.json"), {
|
87
83
|
runtime: "nodejs16.x",
|
88
84
|
handler: "index.js",
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.49.3-alpha.
|
18
|
+
"version": "2.49.3-alpha.3",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -82,18 +82,18 @@
|
|
82
82
|
"std-env": "^3.7.0",
|
83
83
|
"@modern-js/core": "2.49.2",
|
84
84
|
"@modern-js/plugin": "2.49.2",
|
85
|
-
"@modern-js/plugin-data-loader": "2.49.2",
|
86
|
-
"@modern-js/prod-server": "2.49.2",
|
87
|
-
"@modern-js/rsbuild-plugin-esbuild": "2.49.2",
|
88
85
|
"@modern-js/node-bundle-require": "2.49.2",
|
89
86
|
"@modern-js/plugin-i18n": "2.49.2",
|
87
|
+
"@modern-js/prod-server": "2.49.2",
|
88
|
+
"@modern-js/rsbuild-plugin-esbuild": "2.49.2",
|
89
|
+
"@modern-js/plugin-lint": "2.49.2",
|
90
|
+
"@modern-js/server": "2.49.2",
|
91
|
+
"@modern-js/server-utils": "2.49.2",
|
90
92
|
"@modern-js/server-core": "2.49.2",
|
91
93
|
"@modern-js/types": "2.49.2",
|
92
94
|
"@modern-js/uni-builder": "2.49.2",
|
93
|
-
"@modern-js/plugin-lint": "2.49.2",
|
94
95
|
"@modern-js/utils": "2.49.2",
|
95
|
-
"@modern-js/
|
96
|
-
"@modern-js/server": "2.49.2"
|
96
|
+
"@modern-js/plugin-data-loader": "2.49.2"
|
97
97
|
},
|
98
98
|
"devDependencies": {
|
99
99
|
"@rsbuild/plugin-swc": "0.6.10",
|