@modern-js/app-tools 2.49.3-alpha.10 → 2.49.3-alpha.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/plugins/deploy/index.js +7 -1
- package/dist/cjs/plugins/deploy/platforms/vercel.js +13 -4
- package/dist/esm/plugins/deploy/index.js +8 -2
- package/dist/esm/plugins/deploy/platforms/vercel.js +14 -5
- package/dist/esm-node/plugins/deploy/index.js +7 -1
- package/dist/esm-node/plugins/deploy/platforms/vercel.js +14 -5
- package/package.json +7 -7
@@ -182,10 +182,16 @@ var deploy_default = () => ({
|
|
182
182
|
}
|
183
183
|
case "vercel": {
|
184
184
|
const { genVercelEntry } = await Promise.resolve().then(() => __toESM(require("./platforms/vercel")));
|
185
|
+
const serverAppContext2 = {
|
186
|
+
sharedDirectory: import_path.default.join(__dirname, import_path.default.relative(appDirectory, sharedDirectory)),
|
187
|
+
apiDirectory: import_path.default.join(__dirname, import_path.default.relative(appDirectory, apiDirectory)),
|
188
|
+
lambdaDirectory: import_path.default.join(__dirname, import_path.default.relative(appDirectory, lambdaDirectory)),
|
189
|
+
metaName
|
190
|
+
};
|
185
191
|
code = await genVercelEntry({
|
186
192
|
plugins,
|
187
193
|
config: modernConfig,
|
188
|
-
appContext:
|
194
|
+
appContext: serverAppContext2
|
189
195
|
});
|
190
196
|
break;
|
191
197
|
}
|
@@ -40,15 +40,24 @@ async function genVercelEntry({ config, plugins, appContext } = {}) {
|
|
40
40
|
path: "."
|
41
41
|
}
|
42
42
|
};
|
43
|
+
console.log("appContext.sharedDirectory", appContext === null || appContext === void 0 ? void 0 : appContext.sharedDirectory);
|
43
44
|
const pluginImportCode = (0, import_utils2.genPluginImportsCode)(plugins || []);
|
44
45
|
const dynamicProdOptions = {
|
45
|
-
config:
|
46
|
+
config: config || defaultConfig,
|
46
47
|
serverConfigFile: import_utils.DEFAULT_SERVER_CONFIG,
|
47
|
-
plugins
|
48
|
-
appContext:
|
48
|
+
plugins,
|
49
|
+
appContext: appContext ? {
|
50
|
+
sharedDirectory: appContext.sharedDirectory,
|
51
|
+
apiDirectory: appContext.apiDirectory,
|
52
|
+
lambdaDirectory: appContext.lambdaDirectory
|
53
|
+
} : "undefined"
|
49
54
|
};
|
50
55
|
let entryCode = (await import_utils.fs.readFile(import_node_path.default.join(__dirname, "./vercelEntry.js"))).toString();
|
51
|
-
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${import_utils.ROUTE_SPEC_FILE}"`).replace(
|
56
|
+
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${import_utils.ROUTE_SPEC_FILE}"`).replace(
|
57
|
+
"p_dynamicProdOptions",
|
58
|
+
// JSON.stringify(dynamicProdOptions),
|
59
|
+
JSON.stringify(dynamicProdOptions)
|
60
|
+
);
|
52
61
|
return entryCode;
|
53
62
|
}
|
54
63
|
// Annotate the CommonJS export names for ESM import in node:
|
@@ -18,7 +18,7 @@ function deploy_default() {
|
|
18
18
|
return {
|
19
19
|
beforeDeploy: function beforeDeploy() {
|
20
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;
|
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, serverAppContext1, genNetlifyEntry, entryFilePath;
|
22
22
|
return _ts_generator(this, function(_state) {
|
23
23
|
switch (_state.label) {
|
24
24
|
case 0:
|
@@ -281,12 +281,18 @@ function deploy_default() {
|
|
281
281
|
];
|
282
282
|
case 22:
|
283
283
|
genVercelEntry = _state.sent().genVercelEntry;
|
284
|
+
serverAppContext1 = {
|
285
|
+
sharedDirectory: path.join(__dirname, path.relative(appDirectory, sharedDirectory)),
|
286
|
+
apiDirectory: path.join(__dirname, path.relative(appDirectory, apiDirectory)),
|
287
|
+
lambdaDirectory: path.join(__dirname, path.relative(appDirectory, lambdaDirectory)),
|
288
|
+
metaName
|
289
|
+
};
|
284
290
|
return [
|
285
291
|
4,
|
286
292
|
genVercelEntry({
|
287
293
|
plugins,
|
288
294
|
config: modernConfig,
|
289
|
-
appContext:
|
295
|
+
appContext: serverAppContext1
|
290
296
|
})
|
291
297
|
];
|
292
298
|
case 23:
|
@@ -2,7 +2,7 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
3
3
|
import path from "node:path";
|
4
4
|
import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse } from "@modern-js/utils";
|
5
|
-
import { genPluginImportsCode
|
5
|
+
import { genPluginImportsCode } from "../utils";
|
6
6
|
function genVercelEntry() {
|
7
7
|
return _genVercelEntry.apply(this, arguments);
|
8
8
|
}
|
@@ -19,12 +19,17 @@ function _genVercelEntry() {
|
|
19
19
|
path: "."
|
20
20
|
}
|
21
21
|
};
|
22
|
+
console.log("appContext.sharedDirectory", appContext === null || appContext === void 0 ? void 0 : appContext.sharedDirectory);
|
22
23
|
pluginImportCode = genPluginImportsCode(plugins || []);
|
23
24
|
dynamicProdOptions = {
|
24
|
-
config:
|
25
|
+
config: config || defaultConfig,
|
25
26
|
serverConfigFile: DEFAULT_SERVER_CONFIG,
|
26
|
-
plugins
|
27
|
-
appContext:
|
27
|
+
plugins,
|
28
|
+
appContext: appContext ? {
|
29
|
+
sharedDirectory: appContext.sharedDirectory,
|
30
|
+
apiDirectory: appContext.apiDirectory,
|
31
|
+
lambdaDirectory: appContext.lambdaDirectory
|
32
|
+
} : "undefined"
|
28
33
|
};
|
29
34
|
return [
|
30
35
|
4,
|
@@ -32,7 +37,11 @@ function _genVercelEntry() {
|
|
32
37
|
];
|
33
38
|
case 1:
|
34
39
|
entryCode = _state.sent().toString();
|
35
|
-
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", '"'.concat(ROUTE_SPEC_FILE, '"')).replace(
|
40
|
+
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", '"'.concat(ROUTE_SPEC_FILE, '"')).replace(
|
41
|
+
"p_dynamicProdOptions",
|
42
|
+
// JSON.stringify(dynamicProdOptions),
|
43
|
+
JSON.stringify(dynamicProdOptions)
|
44
|
+
);
|
36
45
|
return [
|
37
46
|
2,
|
38
47
|
entryCode
|
@@ -149,10 +149,16 @@ var deploy_default = () => ({
|
|
149
149
|
}
|
150
150
|
case "vercel": {
|
151
151
|
const { genVercelEntry } = await import("./platforms/vercel");
|
152
|
+
const serverAppContext2 = {
|
153
|
+
sharedDirectory: path.join(__dirname, path.relative(appDirectory, sharedDirectory)),
|
154
|
+
apiDirectory: path.join(__dirname, path.relative(appDirectory, apiDirectory)),
|
155
|
+
lambdaDirectory: path.join(__dirname, path.relative(appDirectory, lambdaDirectory)),
|
156
|
+
metaName
|
157
|
+
};
|
152
158
|
code = await genVercelEntry({
|
153
159
|
plugins,
|
154
160
|
config: modernConfig,
|
155
|
-
appContext:
|
161
|
+
appContext: serverAppContext2
|
156
162
|
});
|
157
163
|
break;
|
158
164
|
}
|
@@ -1,21 +1,30 @@
|
|
1
1
|
import path from "node:path";
|
2
2
|
import { ROUTE_SPEC_FILE, DEFAULT_SERVER_CONFIG, fs as fse } from "@modern-js/utils";
|
3
|
-
import { genPluginImportsCode
|
3
|
+
import { genPluginImportsCode } from "../utils";
|
4
4
|
async function genVercelEntry({ config, plugins, appContext } = {}) {
|
5
5
|
const defaultConfig = {
|
6
6
|
output: {
|
7
7
|
path: "."
|
8
8
|
}
|
9
9
|
};
|
10
|
+
console.log("appContext.sharedDirectory", appContext === null || appContext === void 0 ? void 0 : appContext.sharedDirectory);
|
10
11
|
const pluginImportCode = genPluginImportsCode(plugins || []);
|
11
12
|
const dynamicProdOptions = {
|
12
|
-
config:
|
13
|
+
config: config || defaultConfig,
|
13
14
|
serverConfigFile: DEFAULT_SERVER_CONFIG,
|
14
|
-
plugins
|
15
|
-
appContext:
|
15
|
+
plugins,
|
16
|
+
appContext: appContext ? {
|
17
|
+
sharedDirectory: appContext.sharedDirectory,
|
18
|
+
apiDirectory: appContext.apiDirectory,
|
19
|
+
lambdaDirectory: appContext.lambdaDirectory
|
20
|
+
} : "undefined"
|
16
21
|
};
|
17
22
|
let entryCode = (await fse.readFile(path.join(__dirname, "./vercelEntry.js"))).toString();
|
18
|
-
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${ROUTE_SPEC_FILE}"`).replace(
|
23
|
+
entryCode = entryCode.replace("p_genPluginImportsCode", pluginImportCode).replace("p_ROUTE_SPEC_FILE", `"${ROUTE_SPEC_FILE}"`).replace(
|
24
|
+
"p_dynamicProdOptions",
|
25
|
+
// JSON.stringify(dynamicProdOptions),
|
26
|
+
JSON.stringify(dynamicProdOptions)
|
27
|
+
);
|
19
28
|
return entryCode;
|
20
29
|
}
|
21
30
|
export {
|
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.11",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -81,19 +81,19 @@
|
|
81
81
|
"pkg-types": "^1.1.0",
|
82
82
|
"std-env": "^3.7.0",
|
83
83
|
"@modern-js/core": "2.49.2",
|
84
|
-
"@modern-js/plugin-data-loader": "2.49.2",
|
85
84
|
"@modern-js/plugin": "2.49.2",
|
85
|
+
"@modern-js/plugin-data-loader": "2.49.2",
|
86
86
|
"@modern-js/plugin-i18n": "2.49.2",
|
87
|
-
"@modern-js/plugin-lint": "2.49.2",
|
88
|
-
"@modern-js/prod-server": "2.49.2",
|
89
87
|
"@modern-js/rsbuild-plugin-esbuild": "2.49.2",
|
88
|
+
"@modern-js/prod-server": "2.49.2",
|
89
|
+
"@modern-js/plugin-lint": "2.49.2",
|
90
90
|
"@modern-js/server-core": "2.49.2",
|
91
|
-
"@modern-js/uni-builder": "2.49.2",
|
92
91
|
"@modern-js/node-bundle-require": "2.49.2",
|
92
|
+
"@modern-js/server-utils": "2.49.2",
|
93
93
|
"@modern-js/types": "2.49.2",
|
94
|
+
"@modern-js/uni-builder": "2.49.2",
|
94
95
|
"@modern-js/utils": "2.49.2",
|
95
|
-
"@modern-js/server": "2.49.2"
|
96
|
-
"@modern-js/server-utils": "2.49.2"
|
96
|
+
"@modern-js/server": "2.49.2"
|
97
97
|
},
|
98
98
|
"devDependencies": {
|
99
99
|
"@rsbuild/plugin-swc": "0.6.10",
|