@modern-js/app-tools 3.0.5 → 3.1.0
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/builder/shared/builderPlugins/adapterSSR.js +1 -1
- package/dist/cjs/config/default.js +1 -1
- package/dist/cjs/plugins/analyze/utils.js +6 -6
- package/dist/cjs/plugins/deploy/index.js +10 -5
- package/dist/cjs/plugins/deploy/platforms/gh-pages.js +1 -1
- package/dist/cjs/plugins/deploy/platforms/netlify.js +17 -33
- package/dist/cjs/plugins/deploy/platforms/node.js +17 -38
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +57 -0
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +59 -0
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +44 -0
- package/dist/{esm/plugins/deploy/platforms → cjs/plugins/deploy/platforms/templates}/node-entry.mjs +5 -27
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +56 -0
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +58 -0
- package/dist/cjs/plugins/deploy/platforms/vercel.js +15 -32
- package/dist/cjs/plugins/deploy/types.js +18 -0
- package/dist/cjs/plugins/deploy/utils/generator.js +103 -0
- package/dist/cjs/plugins/deploy/{utils.js → utils/index.js} +28 -24
- package/dist/cjs/utils/register.js +1 -9
- package/dist/esm/builder/shared/builderPlugins/adapterBasic.mjs +2 -2
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +2 -2
- package/dist/esm/commands/build.mjs +3 -3
- package/dist/esm/commands/dev.mjs +5 -5
- package/dist/esm/commands/serve.mjs +2 -2
- package/dist/esm/config/default.mjs +1 -1
- package/dist/esm/esm/register-esm.mjs +3 -3
- package/dist/esm/plugins/analyze/utils.mjs +2 -2
- package/dist/esm/plugins/deploy/index.mjs +9 -4
- package/dist/esm/plugins/deploy/platforms/gh-pages.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/netlify.mjs +25 -41
- package/dist/esm/plugins/deploy/platforms/node.mjs +22 -43
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +57 -0
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +59 -0
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +44 -0
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +46 -0
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +56 -0
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +58 -0
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +28 -45
- package/dist/esm/plugins/deploy/types.mjs +0 -0
- package/dist/esm/plugins/deploy/utils/generator.mjs +47 -0
- package/dist/esm/plugins/deploy/utils/index.mjs +40 -0
- package/dist/esm/utils/loadPlugins.mjs +4 -4
- package/dist/esm/utils/register.mjs +6 -14
- package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.mjs +2 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +2 -2
- package/dist/esm-node/commands/build.mjs +3 -3
- package/dist/esm-node/commands/dev.mjs +5 -5
- package/dist/esm-node/commands/serve.mjs +2 -2
- package/dist/esm-node/config/default.mjs +1 -1
- package/dist/esm-node/esm/register-esm.mjs +3 -3
- package/dist/esm-node/plugins/analyze/utils.mjs +2 -2
- package/dist/esm-node/plugins/deploy/index.mjs +9 -4
- package/dist/esm-node/plugins/deploy/platforms/gh-pages.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/netlify.mjs +25 -44
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +22 -46
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +57 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +59 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +44 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +46 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +56 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +58 -0
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +28 -48
- package/dist/esm-node/plugins/deploy/types.mjs +1 -0
- package/dist/esm-node/plugins/deploy/utils/generator.mjs +48 -0
- package/dist/esm-node/plugins/deploy/utils/index.mjs +44 -0
- package/dist/esm-node/utils/loadPlugins.mjs +4 -4
- package/dist/esm-node/utils/register.mjs +6 -14
- package/dist/types/plugins/analyze/utils.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/platform.d.ts +8 -1
- package/dist/types/plugins/deploy/platforms/templates/netlify-entry.d.mts +2 -0
- package/dist/types/plugins/deploy/platforms/templates/node-entry.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.cts +2 -0
- package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.mts +2 -0
- package/dist/types/plugins/deploy/types.d.ts +3 -0
- package/dist/types/plugins/deploy/utils/generator.d.ts +24 -0
- package/dist/types/plugins/deploy/utils/index.d.ts +16 -0
- package/package.json +12 -11
- package/rslib.config.mts +19 -0
- package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +0 -36
- package/dist/cjs/plugins/deploy/platforms/netlify-handler.js +0 -89
- package/dist/cjs/plugins/deploy/platforms/node-entry.js +0 -75
- package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +0 -37
- package/dist/cjs/plugins/deploy/platforms/vercel-handler.js +0 -89
- package/dist/esm/plugins/deploy/platforms/netlify-entry.mjs +0 -2
- package/dist/esm/plugins/deploy/platforms/netlify-handler.mjs +0 -85
- package/dist/esm/plugins/deploy/platforms/vercel-entry.mjs +0 -3
- package/dist/esm/plugins/deploy/platforms/vercel-handler.mjs +0 -85
- package/dist/esm/plugins/deploy/utils.mjs +0 -39
- package/dist/esm-node/plugins/deploy/platforms/netlify-entry.mjs +0 -3
- package/dist/esm-node/plugins/deploy/platforms/netlify-handler.mjs +0 -89
- package/dist/esm-node/plugins/deploy/platforms/node-entry.mjs +0 -72
- package/dist/esm-node/plugins/deploy/platforms/vercel-entry.mjs +0 -4
- package/dist/esm-node/plugins/deploy/platforms/vercel-handler.mjs +0 -89
- package/dist/esm-node/plugins/deploy/utils.mjs +0 -40
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +0 -2
- package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +0 -2
- package/dist/types/plugins/deploy/platforms/vercel-entry.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +0 -1
- package/dist/types/plugins/deploy/utils.d.ts +0 -23
- /package/dist/types/plugins/deploy/platforms/{netlify-handler.d.cts → templates/netlify-entry.d.cts} +0 -0
- /package/dist/types/plugins/deploy/platforms/{node-entry.d.ts → templates/node-entry.d.cts} +0 -0
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
import { chalk, fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
2
3
|
import { nodeDepEmit } from "ndepe";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
const createNodePreset = (appContext,
|
|
6
|
-
const { appDirectory, distDirectory,
|
|
4
|
+
import { readTemplate, resolveESMDependency } from "../utils/index.mjs";
|
|
5
|
+
import { generateHandler } from "../utils/generator.mjs";
|
|
6
|
+
const createNodePreset = ({ appContext, modernConfig, api })=>{
|
|
7
|
+
const { appDirectory, distDirectory, moduleType } = appContext;
|
|
7
8
|
const isEsmProject = 'module' === moduleType;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
]);
|
|
12
|
-
const outputDirectory = __rspack_external_node_path_c5b9b54f["default"].join(appDirectory, '.output');
|
|
13
|
-
const staticDirectory = __rspack_external_node_path_c5b9b54f["default"].join(outputDirectory, 'static');
|
|
14
|
-
const entryFilePath = __rspack_external_node_path_c5b9b54f["default"].join(outputDirectory, 'index.js');
|
|
9
|
+
const outputDirectory = node_path.join(appDirectory, '.output');
|
|
10
|
+
const staticDirectory = node_path.join(outputDirectory, 'static');
|
|
11
|
+
const entryFilePath = node_path.join(outputDirectory, 'index.js');
|
|
15
12
|
return {
|
|
16
13
|
async prepare () {
|
|
17
14
|
await fs.remove(outputDirectory);
|
|
@@ -20,44 +17,24 @@ const createNodePreset = (appContext, config)=>{
|
|
|
20
17
|
await fs.copy(distDirectory, outputDirectory);
|
|
21
18
|
},
|
|
22
19
|
async genEntry () {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
distPath: {
|
|
32
|
-
root: '.'
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const pluginImportCode = genPluginImportsCode(plugins || []);
|
|
37
|
-
const dynamicProdOptions = {
|
|
38
|
-
config: serverConfig
|
|
39
|
-
};
|
|
40
|
-
const meta = getMeta(metaName);
|
|
41
|
-
const serverConfigPath = `path.join(__dirname, "${SERVER_DIR}", "${meta}.server")`;
|
|
42
|
-
const pluginsCode = getPluginsCode(plugins);
|
|
43
|
-
let entryCode = (await fs.readFile(__rspack_external_node_path_c5b9b54f["default"].join(__dirname, './node-entry.js'))).toString();
|
|
44
|
-
const serverAppContext = serverAppContenxtTemplate(appContext);
|
|
45
|
-
entryCode = entryCode.replace('p_genPluginImportsCode', pluginImportCode).replace('p_ROUTE_SPEC_FILE', `"${ROUTE_SPEC_FILE}"`).replace('p_dynamicProdOptions', JSON.stringify(dynamicProdOptions)).replace('p_plugins', pluginsCode).replace('p_serverDirectory', serverConfigPath).replace('p_sharedDirectory', serverAppContext.sharedDirectory).replace('p_apiDirectory', serverAppContext.apiDirectory).replace('p_bffRuntimeFramework', `"${serverAppContext.bffRuntimeFramework}"`).replace('p_lambdaDirectory', serverAppContext.lambdaDirectory);
|
|
46
|
-
if (isEsmProject) {
|
|
47
|
-
const cjsEntryFilePath = __rspack_external_node_path_c5b9b54f["default"].join(outputDirectory, 'index.cjs');
|
|
48
|
-
await fs.writeFile(cjsEntryFilePath, entryCode);
|
|
49
|
-
await fs.writeFile(entryFilePath, "import('./index.cjs');");
|
|
50
|
-
} else await fs.writeFile(entryFilePath, entryCode);
|
|
20
|
+
const template = await readTemplate(`node-entry.${isEsmProject ? 'mjs' : 'cjs'}`);
|
|
21
|
+
const code = await generateHandler({
|
|
22
|
+
template,
|
|
23
|
+
appContext,
|
|
24
|
+
config: modernConfig,
|
|
25
|
+
isESM: isEsmProject
|
|
26
|
+
});
|
|
27
|
+
await fs.writeFile(entryFilePath, code);
|
|
51
28
|
},
|
|
52
29
|
async end () {
|
|
53
|
-
console.log('Static directory:', chalk.blue(__rspack_external_node_path_c5b9b54f["default"].relative(appDirectory, staticDirectory)));
|
|
54
|
-
console.log("You can preview this build by", chalk.blue("node .output/index"));
|
|
55
30
|
const filter = (filePath)=>!filePath.startsWith(staticDirectory) && !filePath.endsWith('.map');
|
|
31
|
+
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
32
|
+
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
56
33
|
await nodeDepEmit({
|
|
57
34
|
appDir: appDirectory,
|
|
58
35
|
sourceDir: outputDirectory,
|
|
59
36
|
includeEntries: [
|
|
60
|
-
|
|
37
|
+
entry
|
|
61
38
|
],
|
|
62
39
|
copyWholePackage (pkgName) {
|
|
63
40
|
return '@modern-js/utils' === pkgName;
|
|
@@ -71,6 +48,8 @@ const createNodePreset = (appContext, config)=>{
|
|
|
71
48
|
};
|
|
72
49
|
}
|
|
73
50
|
});
|
|
51
|
+
console.log('Static directory:', chalk.blue(node_path.relative(appDirectory, staticDirectory).replace(/\\/g, '/')));
|
|
52
|
+
console.log("You can preview this build by", chalk.blue('node .output/index'));
|
|
74
53
|
}
|
|
75
54
|
};
|
|
76
55
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const fs = require('node:fs/promises');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const { createNetlifyFunction } = require('@modern-js/prod-server/netlify');
|
|
4
|
+
p_genPluginImportsCode;
|
|
5
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
6
|
+
let requestHandler = null;
|
|
7
|
+
let handlerCreationPromise = null;
|
|
8
|
+
async function loadRoutes(routeFilepath) {
|
|
9
|
+
try {
|
|
10
|
+
await fs.access(routeFilepath);
|
|
11
|
+
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
12
|
+
const routeSpec = JSON.parse(content);
|
|
13
|
+
return routeSpec.routes || [];
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function initServer() {
|
|
20
|
+
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
21
|
+
const routes = await loadRoutes(routeFilepath);
|
|
22
|
+
const dynamicProdOptions = p_dynamicProdOptions;
|
|
23
|
+
const prodServerOptions = {
|
|
24
|
+
pwd: __dirname,
|
|
25
|
+
routes,
|
|
26
|
+
disableCustomHook: true,
|
|
27
|
+
appContext: {
|
|
28
|
+
sharedDirectory: p_sharedDirectory,
|
|
29
|
+
apiDirectory: p_apiDirectory,
|
|
30
|
+
lambdaDirectory: p_lambdaDirectory,
|
|
31
|
+
bffRuntimeFramework: p_bffRuntimeFramework
|
|
32
|
+
},
|
|
33
|
+
plugins: p_plugins,
|
|
34
|
+
serverConfigPath: p_serverDirectory,
|
|
35
|
+
...dynamicProdOptions
|
|
36
|
+
};
|
|
37
|
+
const requestHandler = await createNetlifyFunction(prodServerOptions);
|
|
38
|
+
return requestHandler;
|
|
39
|
+
}
|
|
40
|
+
async function createHandler() {
|
|
41
|
+
if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
|
|
42
|
+
try {
|
|
43
|
+
requestHandler = await initServer();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('Error creating server:', error);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
await handlerCreationPromise;
|
|
50
|
+
return requestHandler;
|
|
51
|
+
}
|
|
52
|
+
createHandler();
|
|
53
|
+
const handler = async (request, context)=>{
|
|
54
|
+
if (!requestHandler) await createHandler();
|
|
55
|
+
return requestHandler(request, context);
|
|
56
|
+
};
|
|
57
|
+
exports.handler = handler;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { createNetlifyFunction } from '@modern-js/prod-server/netlify';
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
p_genPluginImportsCode;
|
|
7
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
8
|
+
let requestHandler = null;
|
|
9
|
+
let handlerCreationPromise = null;
|
|
10
|
+
async function loadRoutes(routeFilepath) {
|
|
11
|
+
try {
|
|
12
|
+
await fs.access(routeFilepath);
|
|
13
|
+
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
14
|
+
const routeSpec = JSON.parse(content);
|
|
15
|
+
return routeSpec.routes || [];
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function initServer() {
|
|
22
|
+
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
23
|
+
const routes = await loadRoutes(routeFilepath);
|
|
24
|
+
const dynamicProdOptions = p_dynamicProdOptions;
|
|
25
|
+
const prodServerOptions = {
|
|
26
|
+
pwd: __dirname,
|
|
27
|
+
routes,
|
|
28
|
+
disableCustomHook: true,
|
|
29
|
+
appContext: {
|
|
30
|
+
sharedDirectory: p_sharedDirectory,
|
|
31
|
+
apiDirectory: p_apiDirectory,
|
|
32
|
+
lambdaDirectory: p_lambdaDirectory,
|
|
33
|
+
bffRuntimeFramework: p_bffRuntimeFramework
|
|
34
|
+
},
|
|
35
|
+
plugins: p_plugins,
|
|
36
|
+
serverConfigPath: p_serverDirectory,
|
|
37
|
+
...dynamicProdOptions
|
|
38
|
+
};
|
|
39
|
+
const requestHandler = await createNetlifyFunction(prodServerOptions);
|
|
40
|
+
return requestHandler;
|
|
41
|
+
}
|
|
42
|
+
async function createHandler() {
|
|
43
|
+
if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
|
|
44
|
+
try {
|
|
45
|
+
requestHandler = await initServer();
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error('Error creating server:', error);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
await handlerCreationPromise;
|
|
52
|
+
return requestHandler;
|
|
53
|
+
}
|
|
54
|
+
createHandler();
|
|
55
|
+
const handler = async (request, context)=>{
|
|
56
|
+
if (!requestHandler) await createHandler();
|
|
57
|
+
return requestHandler(request, context);
|
|
58
|
+
};
|
|
59
|
+
export default handler;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const fs = require('node:fs/promises');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const { createProdServer } = require('@modern-js/prod-server');
|
|
4
|
+
p_genPluginImportsCode;
|
|
5
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
6
|
+
async function loadRoutes(routeFilepath) {
|
|
7
|
+
try {
|
|
8
|
+
await fs.access(routeFilepath);
|
|
9
|
+
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
10
|
+
const routeSpec = JSON.parse(content);
|
|
11
|
+
return routeSpec.routes || [];
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function main() {
|
|
18
|
+
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
19
|
+
const routes = await loadRoutes(routeFilepath);
|
|
20
|
+
const dynamicProdOptions = p_dynamicProdOptions;
|
|
21
|
+
const prodServerOptions = {
|
|
22
|
+
pwd: __dirname,
|
|
23
|
+
routes,
|
|
24
|
+
disableCustomHook: true,
|
|
25
|
+
appContext: {
|
|
26
|
+
sharedDirectory: p_sharedDirectory,
|
|
27
|
+
apiDirectory: p_apiDirectory,
|
|
28
|
+
lambdaDirectory: p_lambdaDirectory,
|
|
29
|
+
bffRuntimeFramework: p_bffRuntimeFramework
|
|
30
|
+
},
|
|
31
|
+
plugins: p_plugins,
|
|
32
|
+
serverConfigPath: p_serverDirectory,
|
|
33
|
+
...dynamicProdOptions
|
|
34
|
+
};
|
|
35
|
+
const app = await createProdServer(prodServerOptions);
|
|
36
|
+
const port = process.env.PORT || 8080;
|
|
37
|
+
app.listen({
|
|
38
|
+
host: '::',
|
|
39
|
+
port
|
|
40
|
+
}, ()=>{
|
|
41
|
+
console.log(`\x1b[32mServer is listening on http://[::]:${port}`, '\x1b[0m');
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
main();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { createProdServer } from '@modern-js/prod-server';
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
p_genPluginImportsCode;
|
|
7
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
8
|
+
async function loadRoutes(routeFilepath) {
|
|
9
|
+
try {
|
|
10
|
+
await fs.access(routeFilepath);
|
|
11
|
+
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
12
|
+
const routeSpec = JSON.parse(content);
|
|
13
|
+
return routeSpec.routes || [];
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function main() {
|
|
20
|
+
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
21
|
+
const routes = await loadRoutes(routeFilepath);
|
|
22
|
+
const dynamicProdOptions = p_dynamicProdOptions;
|
|
23
|
+
const prodServerOptions = {
|
|
24
|
+
pwd: __dirname,
|
|
25
|
+
routes,
|
|
26
|
+
disableCustomHook: true,
|
|
27
|
+
appContext: {
|
|
28
|
+
sharedDirectory: p_sharedDirectory,
|
|
29
|
+
apiDirectory: p_apiDirectory,
|
|
30
|
+
lambdaDirectory: p_lambdaDirectory,
|
|
31
|
+
bffRuntimeFramework: p_bffRuntimeFramework
|
|
32
|
+
},
|
|
33
|
+
plugins: p_plugins,
|
|
34
|
+
serverConfigPath: p_serverDirectory,
|
|
35
|
+
...dynamicProdOptions
|
|
36
|
+
};
|
|
37
|
+
const app = await createProdServer(prodServerOptions);
|
|
38
|
+
const port = process.env.PORT || 8080;
|
|
39
|
+
app.listen({
|
|
40
|
+
host: '::',
|
|
41
|
+
port
|
|
42
|
+
}, ()=>{
|
|
43
|
+
console.log(`\x1b[32mServer is listening on http://[::]:${port}`, '\x1b[0m');
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
main();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const fs = require('node:fs/promises');
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const { createProdServer } = require('@modern-js/prod-server');
|
|
4
|
+
p_genPluginImportsCode;
|
|
5
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
6
|
+
let requestHandler = null;
|
|
7
|
+
let handlerCreationPromise = null;
|
|
8
|
+
async function loadRoutes(routeFilepath) {
|
|
9
|
+
try {
|
|
10
|
+
await fs.access(routeFilepath);
|
|
11
|
+
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
12
|
+
const routeSpec = JSON.parse(content);
|
|
13
|
+
return routeSpec.routes || [];
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function initServer() {
|
|
20
|
+
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
21
|
+
const routes = await loadRoutes(routeFilepath);
|
|
22
|
+
const dynamicProdOptions = p_dynamicProdOptions;
|
|
23
|
+
const prodServerOptions = {
|
|
24
|
+
pwd: __dirname,
|
|
25
|
+
routes,
|
|
26
|
+
disableCustomHook: true,
|
|
27
|
+
appContext: {
|
|
28
|
+
sharedDirectory: p_sharedDirectory,
|
|
29
|
+
apiDirectory: p_apiDirectory,
|
|
30
|
+
lambdaDirectory: p_lambdaDirectory
|
|
31
|
+
},
|
|
32
|
+
plugins: p_plugins,
|
|
33
|
+
serverConfigPath: p_serverDirectory,
|
|
34
|
+
...dynamicProdOptions
|
|
35
|
+
};
|
|
36
|
+
const app = await createProdServer(prodServerOptions);
|
|
37
|
+
return app.getRequestListener();
|
|
38
|
+
}
|
|
39
|
+
async function createHandler() {
|
|
40
|
+
if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
|
|
41
|
+
try {
|
|
42
|
+
requestHandler = await initServer();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Error creating server:', error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
await handlerCreationPromise;
|
|
49
|
+
return requestHandler;
|
|
50
|
+
}
|
|
51
|
+
createHandler();
|
|
52
|
+
const handler = async (req, res)=>{
|
|
53
|
+
if (!requestHandler) await createHandler();
|
|
54
|
+
return requestHandler(req, res);
|
|
55
|
+
};
|
|
56
|
+
module.exports = handler;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { createProdServer } from '@modern-js/prod-server';
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
p_genPluginImportsCode;
|
|
7
|
+
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production';
|
|
8
|
+
let requestHandler = null;
|
|
9
|
+
let handlerCreationPromise = null;
|
|
10
|
+
async function loadRoutes(routeFilepath) {
|
|
11
|
+
try {
|
|
12
|
+
await fs.access(routeFilepath);
|
|
13
|
+
const content = await fs.readFile(routeFilepath, 'utf-8');
|
|
14
|
+
const routeSpec = JSON.parse(content);
|
|
15
|
+
return routeSpec.routes || [];
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn('route.json not found or invalid, continuing with empty routes.');
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function initServer() {
|
|
22
|
+
const routeFilepath = path.join(__dirname, p_ROUTE_SPEC_FILE);
|
|
23
|
+
const routes = await loadRoutes(routeFilepath);
|
|
24
|
+
const dynamicProdOptions = p_dynamicProdOptions;
|
|
25
|
+
const prodServerOptions = {
|
|
26
|
+
pwd: __dirname,
|
|
27
|
+
routes,
|
|
28
|
+
disableCustomHook: true,
|
|
29
|
+
appContext: {
|
|
30
|
+
sharedDirectory: p_sharedDirectory,
|
|
31
|
+
apiDirectory: p_apiDirectory,
|
|
32
|
+
lambdaDirectory: p_lambdaDirectory
|
|
33
|
+
},
|
|
34
|
+
plugins: p_plugins,
|
|
35
|
+
serverConfigPath: p_serverDirectory,
|
|
36
|
+
...dynamicProdOptions
|
|
37
|
+
};
|
|
38
|
+
const app = await createProdServer(prodServerOptions);
|
|
39
|
+
return app.getRequestListener();
|
|
40
|
+
}
|
|
41
|
+
async function createHandler() {
|
|
42
|
+
if (!handlerCreationPromise) handlerCreationPromise = (async ()=>{
|
|
43
|
+
try {
|
|
44
|
+
requestHandler = await initServer();
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Error creating server:', error);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
await handlerCreationPromise;
|
|
51
|
+
return requestHandler;
|
|
52
|
+
}
|
|
53
|
+
createHandler();
|
|
54
|
+
const handler = async (req, res)=>{
|
|
55
|
+
if (!requestHandler) await createHandler();
|
|
56
|
+
return requestHandler(req, res);
|
|
57
|
+
};
|
|
58
|
+
export default handler;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
2
3
|
import { nodeDepEmit } from "ndepe";
|
|
3
4
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
const createVercelPreset = (appContext, modernConfig, needModernServer)=>{
|
|
7
|
-
const { appDirectory, distDirectory, entrypoints,
|
|
5
|
+
import { readTemplate, resolveESMDependency } from "../utils/index.mjs";
|
|
6
|
+
import { generateHandler } from "../utils/generator.mjs";
|
|
7
|
+
const createVercelPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
8
|
+
const { appDirectory, distDirectory, entrypoints, moduleType } = appContext;
|
|
8
9
|
const isEsmProject = 'module' === moduleType;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const vercelOutput = __rspack_external_node_path_c5b9b54f["default"].join(appDirectory, '.vercel');
|
|
14
|
-
const outputDirectory = __rspack_external_node_path_c5b9b54f["default"].join(vercelOutput, 'output');
|
|
15
|
-
const funcsDirectory = __rspack_external_node_path_c5b9b54f["default"].join(outputDirectory, 'functions', 'index.func');
|
|
16
|
-
const entryFilePath = __rspack_external_node_path_c5b9b54f["default"].join(funcsDirectory, 'index.js');
|
|
17
|
-
const handlerFilePath = __rspack_external_node_path_c5b9b54f["default"].join(funcsDirectory, 'vercel-handler.cjs');
|
|
10
|
+
const vercelOutput = node_path.join(appDirectory, '.vercel');
|
|
11
|
+
const outputDirectory = node_path.join(vercelOutput, 'output');
|
|
12
|
+
const funcsDirectory = node_path.join(outputDirectory, 'functions', 'index.func');
|
|
13
|
+
const entryFilePath = node_path.join(funcsDirectory, 'index.js');
|
|
18
14
|
return {
|
|
19
15
|
async prepare () {
|
|
20
16
|
await fs.remove(vercelOutput);
|
|
@@ -54,21 +50,21 @@ const createVercelPreset = (appContext, modernConfig, needModernServer)=>{
|
|
|
54
50
|
});
|
|
55
51
|
}
|
|
56
52
|
await fs.ensureDir(outputDirectory);
|
|
57
|
-
await fs.writeJSON(
|
|
53
|
+
await fs.writeJSON(node_path.join(outputDirectory, 'config.json'), config, {
|
|
58
54
|
spaces: 2
|
|
59
55
|
});
|
|
60
|
-
const staticDirectory =
|
|
61
|
-
await fs.copy(
|
|
56
|
+
const staticDirectory = node_path.join(outputDirectory, 'static/static');
|
|
57
|
+
await fs.copy(node_path.join(distDirectory, 'static'), staticDirectory);
|
|
62
58
|
if (needModernServer) {
|
|
63
59
|
await fs.ensureDir(funcsDirectory);
|
|
64
60
|
await fs.copy(distDirectory, funcsDirectory, {
|
|
65
61
|
filter: (src)=>{
|
|
66
|
-
const distStaticDirectory =
|
|
62
|
+
const distStaticDirectory = node_path.join(distDirectory, 'static');
|
|
67
63
|
return !src.includes(distStaticDirectory);
|
|
68
64
|
}
|
|
69
65
|
});
|
|
70
66
|
const nodeVersion = process.versions.node.split('.')[0];
|
|
71
|
-
await fs.writeJSON(
|
|
67
|
+
await fs.writeJSON(node_path.join(funcsDirectory, '.vc-config.json'), {
|
|
72
68
|
runtime: `nodejs${nodeVersion}.x`,
|
|
73
69
|
handler: 'index.js',
|
|
74
70
|
launcherType: 'Nodejs',
|
|
@@ -76,44 +72,31 @@ const createVercelPreset = (appContext, modernConfig, needModernServer)=>{
|
|
|
76
72
|
supportsResponseStreaming: true
|
|
77
73
|
});
|
|
78
74
|
} else {
|
|
79
|
-
const destHtmlDirectory =
|
|
80
|
-
const outputHtmlDirectory =
|
|
75
|
+
const destHtmlDirectory = node_path.join(distDirectory, 'html');
|
|
76
|
+
const outputHtmlDirectory = node_path.join(node_path.join(outputDirectory, 'static'), 'html');
|
|
81
77
|
await fs.copy(destHtmlDirectory, outputHtmlDirectory);
|
|
82
78
|
}
|
|
83
79
|
},
|
|
84
80
|
async genEntry () {
|
|
85
81
|
if (!needModernServer) return;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const pluginImportCode = genPluginImportsCode(plugins || []);
|
|
97
|
-
const dynamicProdOptions = {
|
|
98
|
-
config: serverConfig
|
|
99
|
-
};
|
|
100
|
-
const meta = getMeta(metaName);
|
|
101
|
-
const serverConfigPath = `path.join(__dirname, "${SERVER_DIR}", "${meta}.server")`;
|
|
102
|
-
const pluginsCode = getPluginsCode(plugins || []);
|
|
103
|
-
const serverAppContext = serverAppContenxtTemplate(appContext);
|
|
104
|
-
let handlerCode = (await fs.readFile(__rspack_external_node_path_c5b9b54f["default"].join(__dirname, './vercel-handler.js'))).toString();
|
|
105
|
-
handlerCode = handlerCode.replace('p_genPluginImportsCode', pluginImportCode).replace('p_ROUTE_SPEC_FILE', `"${ROUTE_SPEC_FILE}"`).replace('p_dynamicProdOptions', JSON.stringify(dynamicProdOptions)).replace('p_plugins', pluginsCode).replace('p_serverDirectory', serverConfigPath).replace('p_sharedDirectory', serverAppContext.sharedDirectory).replace('p_apiDirectory', serverAppContext.apiDirectory).replace('p_lambdaDirectory', serverAppContext.lambdaDirectory);
|
|
106
|
-
await fs.writeFile(handlerFilePath, handlerCode);
|
|
107
|
-
if (isEsmProject) await fs.writeFile(entryFilePath, "import { handler } from './vercel-handler.cjs';\nexport default handler;\n");
|
|
108
|
-
else await fs.writeFile(entryFilePath, "const { handler } = require('./vercel-handler.cjs');\nmodule.exports = handler;\n");
|
|
82
|
+
const template = await readTemplate(`vercel-entry.${isEsmProject ? 'mjs' : 'cjs'}`);
|
|
83
|
+
const code = await generateHandler({
|
|
84
|
+
template,
|
|
85
|
+
appContext,
|
|
86
|
+
config: modernConfig,
|
|
87
|
+
isESM: isEsmProject
|
|
88
|
+
});
|
|
89
|
+
await fs.writeFile(entryFilePath, code);
|
|
109
90
|
},
|
|
110
91
|
async end () {
|
|
111
92
|
if (!needModernServer) return;
|
|
93
|
+
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
94
|
+
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
112
95
|
await nodeDepEmit({
|
|
113
96
|
appDir: appDirectory,
|
|
114
97
|
sourceDir: funcsDirectory,
|
|
115
98
|
includeEntries: [
|
|
116
|
-
|
|
99
|
+
entry
|
|
117
100
|
],
|
|
118
101
|
copyWholePackage (pkgName) {
|
|
119
102
|
return '@modern-js/utils' === pkgName;
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
import { ROUTE_SPEC_FILE, SERVER_DIR, getMeta } from "@modern-js/utils";
|
|
3
|
+
import { merge } from "@modern-js/utils/lodash";
|
|
4
|
+
import { normalizePath } from "./index.mjs";
|
|
5
|
+
const serverAppContextTemplate = (appContext)=>{
|
|
6
|
+
const { appDirectory, sharedDirectory, apiDirectory, lambdaDirectory, metaName, bffRuntimeFramework } = appContext;
|
|
7
|
+
return {
|
|
8
|
+
sharedDirectory: `path.join(__dirname, "${normalizePath(node_path.relative(appDirectory, sharedDirectory))}")`,
|
|
9
|
+
apiDirectory: `path.join(__dirname, "${normalizePath(node_path.relative(appDirectory, apiDirectory))}")`,
|
|
10
|
+
lambdaDirectory: `path.join(__dirname, "${normalizePath(node_path.relative(appDirectory, lambdaDirectory))}")`,
|
|
11
|
+
metaName,
|
|
12
|
+
bffRuntimeFramework: bffRuntimeFramework || 'hono'
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const genPluginImportsCode = (plugins, isESM = false)=>plugins.map(([name, options], index)=>{
|
|
16
|
+
const im = isESM ? `import * as plugin_${index}_ns from '${name}'` : `const plugin_${index}_ns = require('${name}')`;
|
|
17
|
+
return `${im};const plugin_${index} = plugin_${index}_ns.default || plugin_${index}_ns`;
|
|
18
|
+
}).join(';\n');
|
|
19
|
+
const getPluginsCode = (plugins)=>`[${plugins.map(([, options], index)=>`plugin_${index}(${options ? JSON.stringify(options) : ''})`).join(',')}]`;
|
|
20
|
+
const getServerConfigPath = (meta)=>`"${normalizePath(node_path.join(SERVER_DIR, `${meta}.server`))}"`;
|
|
21
|
+
const generateHandler = async ({ template, appContext, config, serverConfig: modifyServerConfig, genAppContextTemplate = serverAppContextTemplate, genPluginImports = genPluginImportsCode, isESM })=>{
|
|
22
|
+
const { serverPlugins, metaName } = appContext;
|
|
23
|
+
const plugins = serverPlugins.map((plugin)=>[
|
|
24
|
+
plugin.name,
|
|
25
|
+
plugin.options
|
|
26
|
+
]);
|
|
27
|
+
const serverConfig = merge({
|
|
28
|
+
bff: {
|
|
29
|
+
prefix: config?.bff?.prefix
|
|
30
|
+
},
|
|
31
|
+
output: {
|
|
32
|
+
distPath: {
|
|
33
|
+
root: '.'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, modifyServerConfig || {});
|
|
37
|
+
const meta = getMeta(metaName);
|
|
38
|
+
const pluginImportCode = genPluginImports(plugins || [], Boolean(isESM));
|
|
39
|
+
const dynamicProdOptions = {
|
|
40
|
+
config: serverConfig
|
|
41
|
+
};
|
|
42
|
+
const serverConfigPath = getServerConfigPath(meta);
|
|
43
|
+
const pluginsCode = getPluginsCode(plugins);
|
|
44
|
+
const serverAppContext = genAppContextTemplate(appContext);
|
|
45
|
+
return template.replace('p_genPluginImportsCode', pluginImportCode).replace('p_ROUTE_SPEC_FILE', `"${ROUTE_SPEC_FILE}"`).replace('p_dynamicProdOptions', JSON.stringify(dynamicProdOptions)).replace('p_plugins', pluginsCode).replace('p_bffRuntimeFramework', `"${serverAppContext.bffRuntimeFramework}"`).replace('p_serverDirectory', serverConfigPath).replace('p_sharedDirectory', serverAppContext.sharedDirectory).replace('p_apiDirectory', serverAppContext.apiDirectory).replace('p_lambdaDirectory', serverAppContext.lambdaDirectory);
|
|
46
|
+
};
|
|
47
|
+
export { genPluginImportsCode, generateHandler, getPluginsCode, getServerConfigPath, serverAppContextTemplate };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { ROUTE_SPEC_FILE, SERVER_DIR, fs, getMeta } from "@modern-js/utils";
|
|
4
|
+
const normalizePath = (filePath)=>filePath.replace(/\\/g, '/');
|
|
5
|
+
const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
6
|
+
const routeJSON = path.join(distDirectory, ROUTE_SPEC_FILE);
|
|
7
|
+
const { routes } = fs.readJSONSync(routeJSON);
|
|
8
|
+
let useSSR = false;
|
|
9
|
+
let useAPI = false;
|
|
10
|
+
routes.forEach((route)=>{
|
|
11
|
+
if (route.isSSR) useSSR = true;
|
|
12
|
+
if (route.isApi) useAPI = true;
|
|
13
|
+
});
|
|
14
|
+
const meta = getMeta(metaName);
|
|
15
|
+
const serverConfigPath = path.resolve(appDirectory, SERVER_DIR, `${meta}.server`);
|
|
16
|
+
const isServerConfigExists = [
|
|
17
|
+
'.ts',
|
|
18
|
+
'.js'
|
|
19
|
+
].some((ex)=>fs.existsSync(`${serverConfigPath}${ex}`));
|
|
20
|
+
return {
|
|
21
|
+
useSSR,
|
|
22
|
+
useAPI,
|
|
23
|
+
useWebServer: isServerConfigExists
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getTemplatePath = (file)=>path.join(__dirname, '../platforms/templates', file);
|
|
27
|
+
const readTemplate = async (file)=>(await fs.readFile(getTemplatePath(file))).toString();
|
|
28
|
+
const resolveESMDependency = async (entry)=>{
|
|
29
|
+
const conditions = new Set([
|
|
30
|
+
'node',
|
|
31
|
+
'import',
|
|
32
|
+
'module',
|
|
33
|
+
'default'
|
|
34
|
+
]);
|
|
35
|
+
try {
|
|
36
|
+
const { moduleResolve } = await import("import-meta-resolve");
|
|
37
|
+
return normalizePath(moduleResolve(entry, pathToFileURL(`${__dirname}/`), conditions, false).pathname.replace(/^\/(\w)\:/, '$1:'));
|
|
38
|
+
} catch (err) {}
|
|
39
|
+
};
|
|
40
|
+
export { getProjectUsage, getTemplatePath, normalizePath, readTemplate, resolveESMDependency };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { loadServerPlugins } from "@modern-js/prod-server";
|
|
1
2
|
import { compatibleRequire, createDebugger, dynamicImport, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
2
|
-
import * as __rspack_external__modern_js_prod_server_057184e2 from "@modern-js/prod-server";
|
|
3
3
|
const debug = createDebugger('load-plugins');
|
|
4
4
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
5
5
|
const hooks = api.getHooks();
|
|
@@ -12,9 +12,9 @@ async function getServerPlugins(api, metaName = 'modern-js') {
|
|
|
12
12
|
});
|
|
13
13
|
return filtedPlugins;
|
|
14
14
|
}
|
|
15
|
-
async function
|
|
15
|
+
async function loadPlugins_loadServerPlugins(api, appDirectory, metaName) {
|
|
16
16
|
const plugins = await getServerPlugins(api, metaName);
|
|
17
|
-
const instances = await
|
|
17
|
+
const instances = await loadServerPlugins(plugins, appDirectory);
|
|
18
18
|
return instances;
|
|
19
19
|
}
|
|
20
20
|
const resolveCliPlugin = async (p, appDirectory)=>{
|
|
@@ -42,4 +42,4 @@ const loadInternalPlugins = async (appDirectory, internalPlugins)=>{
|
|
|
42
42
|
}));
|
|
43
43
|
return loadedPlugins;
|
|
44
44
|
};
|
|
45
|
-
export { getServerPlugins, loadInternalPlugins, loadServerPlugins };
|
|
45
|
+
export { getServerPlugins, loadInternalPlugins, loadPlugins_loadServerPlugins as loadServerPlugins };
|