@modern-js/app-tools 2.53.1-alpha.4 → 2.54.1-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/modern.js +0 -2
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +2 -2
- package/dist/cjs/commands/build.js +2 -0
- package/dist/cjs/commands/deploy.js +2 -2
- package/dist/cjs/commands/dev.js +19 -5
- package/dist/cjs/commands/index.js +113 -7
- package/dist/cjs/commands/serve.js +19 -5
- package/dist/cjs/hooks.js +5 -0
- package/dist/cjs/index.js +14 -83
- package/dist/cjs/plugins/analyze/constants.js +56 -0
- package/dist/cjs/{analyze → plugins/analyze}/generateCode.js +11 -84
- package/dist/cjs/{analyze → plugins/analyze}/getBundleEntry.js +11 -20
- package/dist/cjs/{analyze → plugins/analyze}/getFileSystemEntry.js +33 -47
- package/dist/cjs/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
- package/dist/cjs/{analyze → plugins/analyze}/index.js +9 -24
- package/dist/cjs/plugins/analyze/templates.js +101 -0
- package/dist/cjs/{analyze → plugins/analyze}/utils.js +12 -55
- package/dist/cjs/plugins/deploy/platforms/netlify.js +2 -2
- package/dist/cjs/plugins/deploy/platforms/node.js +2 -2
- package/dist/cjs/plugins/deploy/platforms/vercel.js +2 -2
- package/dist/cjs/{initialize → plugins/initialize}/index.js +1 -1
- package/dist/cjs/plugins/serverBuild.js +10 -4
- package/dist/cjs/utils/createServer.js +1 -1
- package/dist/cjs/utils/{getServerInternalPlugins.js → loadPlugins.js} +18 -11
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +4 -1
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +2 -2
- package/dist/esm/commands/build.js +16 -9
- package/dist/esm/commands/deploy.js +2 -2
- package/dist/esm/commands/dev.js +13 -9
- package/dist/esm/commands/index.js +411 -3
- package/dist/esm/commands/serve.js +12 -8
- package/dist/esm/hooks.js +5 -0
- package/dist/esm/index.js +12 -394
- package/dist/esm/plugins/analyze/constants.js +24 -0
- package/dist/esm/{analyze → plugins/analyze}/generateCode.js +27 -169
- package/dist/esm/plugins/analyze/getBundleEntry.js +101 -0
- package/dist/esm/plugins/analyze/getFileSystemEntry.js +195 -0
- package/dist/esm/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
- package/dist/esm/{analyze → plugins/analyze}/index.js +42 -70
- package/dist/esm/plugins/analyze/templates.js +22 -0
- package/dist/esm/{analyze → plugins/analyze}/utils.js +13 -135
- package/dist/esm/plugins/deploy/platforms/netlify.js +5 -3
- package/dist/esm/plugins/deploy/platforms/node.js +5 -3
- package/dist/esm/plugins/deploy/platforms/vercel.js +5 -3
- package/dist/esm/{initialize → plugins/initialize}/index.js +1 -1
- package/dist/esm/plugins/serverBuild.js +13 -6
- package/dist/esm/utils/createServer.js +2 -2
- package/dist/esm/utils/loadPlugins.js +64 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +2 -2
- package/dist/esm-node/commands/build.js +2 -0
- package/dist/esm-node/commands/deploy.js +2 -2
- package/dist/esm-node/commands/dev.js +11 -7
- package/dist/esm-node/commands/index.js +92 -3
- package/dist/esm-node/commands/serve.js +10 -6
- package/dist/esm-node/hooks.js +5 -0
- package/dist/esm-node/index.js +12 -79
- package/dist/esm-node/plugins/analyze/constants.js +24 -0
- package/dist/esm-node/{analyze → plugins/analyze}/generateCode.js +14 -87
- package/dist/esm-node/{analyze → plugins/analyze}/getBundleEntry.js +11 -20
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +75 -0
- package/dist/esm-node/{analyze → plugins/analyze}/getServerRoutes.js +1 -1
- package/dist/esm-node/{analyze → plugins/analyze}/index.js +10 -25
- package/dist/esm-node/plugins/analyze/templates.js +75 -0
- package/dist/esm-node/{analyze → plugins/analyze}/utils.js +13 -52
- package/dist/esm-node/plugins/deploy/platforms/netlify.js +3 -3
- package/dist/esm-node/plugins/deploy/platforms/node.js +3 -3
- package/dist/esm-node/plugins/deploy/platforms/vercel.js +3 -3
- package/dist/esm-node/{initialize → plugins/initialize}/index.js +1 -1
- package/dist/esm-node/plugins/serverBuild.js +11 -5
- package/dist/esm-node/utils/createServer.js +2 -2
- package/dist/esm-node/utils/loadPlugins.js +21 -0
- package/dist/types/builder/builder-webpack/createCopyPattern.d.ts +2 -2
- package/dist/types/commands/index.d.ts +10 -3
- package/dist/types/config/initialize/inits.d.ts +1 -1
- package/dist/types/exports/server.d.ts +4 -0
- package/dist/types/index.d.ts +2 -5
- package/dist/types/plugins/analyze/constants.d.ts +9 -0
- package/dist/types/{analyze → plugins/analyze}/generateCode.d.ts +1 -1
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +4 -0
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +5 -0
- package/dist/types/{analyze → plugins/analyze}/getHtmlTemplate.d.ts +1 -1
- package/dist/types/{analyze → plugins/analyze}/getServerRoutes.d.ts +1 -1
- package/dist/types/{analyze → plugins/analyze}/index.d.ts +1 -1
- package/dist/types/plugins/analyze/templates.d.ts +19 -0
- package/dist/types/{analyze → plugins/analyze}/utils.d.ts +4 -6
- package/dist/types/{initialize → plugins/initialize}/index.d.ts +1 -1
- package/dist/types/types/hooks.d.ts +11 -1
- package/dist/types/utils/loadPlugins.d.ts +5 -0
- package/package.json +22 -22
- package/dist/cjs/analyze/constants.js +0 -122
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +0 -197
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +0 -195
- package/dist/cjs/analyze/getClientRoutes/index.js +0 -31
- package/dist/cjs/analyze/getClientRoutes/utils.js +0 -59
- package/dist/cjs/analyze/makeLegalIdentifier.js +0 -37
- package/dist/cjs/analyze/nestedRoutes.js +0 -295
- package/dist/cjs/analyze/templates.js +0 -444
- package/dist/esm/analyze/constants.js +0 -76
- package/dist/esm/analyze/getBundleEntry.js +0 -75
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +0 -185
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +0 -183
- package/dist/esm/analyze/getClientRoutes/index.js +0 -6
- package/dist/esm/analyze/getClientRoutes/utils.js +0 -28
- package/dist/esm/analyze/getFileSystemEntry.js +0 -113
- package/dist/esm/analyze/makeLegalIdentifier.js +0 -15
- package/dist/esm/analyze/nestedRoutes.js +0 -398
- package/dist/esm/analyze/templates.js +0 -435
- package/dist/esm/utils/getServerInternalPlugins.js +0 -40
- package/dist/esm-node/analyze/constants.js +0 -76
- package/dist/esm-node/analyze/getClientRoutes/getRoutes.js +0 -163
- package/dist/esm-node/analyze/getClientRoutes/getRoutesLegacy.js +0 -161
- package/dist/esm-node/analyze/getClientRoutes/index.js +0 -6
- package/dist/esm-node/analyze/getClientRoutes/utils.js +0 -22
- package/dist/esm-node/analyze/getFileSystemEntry.js +0 -89
- package/dist/esm-node/analyze/makeLegalIdentifier.js +0 -13
- package/dist/esm-node/analyze/nestedRoutes.js +0 -259
- package/dist/esm-node/analyze/templates.js +0 -405
- package/dist/esm-node/utils/getServerInternalPlugins.js +0 -15
- package/dist/types/analyze/constants.d.ts +0 -42
- package/dist/types/analyze/getBundleEntry.d.ts +0 -3
- package/dist/types/analyze/getClientRoutes/getRoutes.d.ts +0 -8
- package/dist/types/analyze/getClientRoutes/getRoutesLegacy.d.ts +0 -9
- package/dist/types/analyze/getClientRoutes/index.d.ts +0 -2
- package/dist/types/analyze/getClientRoutes/utils.d.ts +0 -5
- package/dist/types/analyze/getFileSystemEntry.d.ts +0 -4
- package/dist/types/analyze/makeLegalIdentifier.d.ts +0 -1
- package/dist/types/analyze/nestedRoutes.d.ts +0 -7
- package/dist/types/analyze/templates.d.ts +0 -30
- package/dist/types/utils/getServerInternalPlugins.d.ts +0 -2
- /package/dist/cjs/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
- /package/dist/cjs/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
- /package/dist/esm/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
- /package/dist/esm/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
- /package/dist/esm-node/{analyze → plugins/analyze}/getHtmlTemplate.js +0 -0
- /package/dist/esm-node/{analyze → plugins/analyze}/isDefaultExportFunction.js +0 -0
- /package/dist/types/{analyze → plugins/analyze}/isDefaultExportFunction.d.ts +0 -0
@@ -3,7 +3,7 @@ import { isHtmlDisabled } from "@rsbuild/shared";
|
|
3
3
|
import { mergeRsbuildConfig } from "@rsbuild/core";
|
4
4
|
import { fs, isUseSSRBundle } from "@modern-js/utils";
|
5
5
|
import { HtmlAsyncChunkPlugin, RouterPlugin } from "../bundlerPlugins";
|
6
|
-
import { getServerCombinedModueFile } from "../../../analyze/utils";
|
6
|
+
import { getServerCombinedModueFile } from "../../../plugins/analyze/utils";
|
7
7
|
const builderPluginAdapterSSR = (options) => ({
|
8
8
|
name: "builder-plugin-adapter-modern-ssr",
|
9
9
|
setup(api) {
|
@@ -124,7 +124,7 @@ function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
|
124
124
|
}
|
125
125
|
const { ssr, ssrByEntries } = serverConfig || {};
|
126
126
|
entryNames.forEach((name) => {
|
127
|
-
if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
|
127
|
+
if (!ssgEntries.includes(name) && !name.includes("server-loaders") && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
|
128
128
|
chain.entryPoints.delete(name);
|
129
129
|
}
|
130
130
|
});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ResolvedConfigContext } from "@modern-js/core";
|
2
2
|
import { logger } from "@modern-js/utils";
|
3
|
+
import { loadServerPlugins } from "../utils/loadPlugins";
|
3
4
|
import { generateRoutes } from "../utils/routes";
|
4
5
|
import { buildServerConfig } from "../utils/config";
|
5
6
|
import { registerCompiler } from "../utils/register";
|
@@ -11,6 +12,7 @@ const build = async (api, options) => {
|
|
11
12
|
let resolvedConfig = api.useResolvedConfigContext();
|
12
13
|
const appContext = api.useAppContext();
|
13
14
|
const hookRunners = api.useHookRunners();
|
15
|
+
await loadServerPlugins(api, appContext.appDirectory);
|
14
16
|
await registerCompiler(appContext.appDirectory, appContext.distDirectory, resolvedConfig === null || resolvedConfig === void 0 ? void 0 : (_resolvedConfig_source = resolvedConfig.source) === null || _resolvedConfig_source === void 0 ? void 0 : _resolvedConfig_source.alias);
|
15
17
|
const { apiOnly } = appContext;
|
16
18
|
if (apiOnly) {
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { getServerPlugins } from "../utils/loadPlugins";
|
2
2
|
const deploy = async (api, options) => {
|
3
3
|
const hookRunners = api.useHookRunners();
|
4
|
-
await
|
4
|
+
await getServerPlugins(api);
|
5
5
|
await hookRunners.beforeDeploy(options);
|
6
6
|
await hookRunners.deploy(options);
|
7
7
|
await hookRunners.afterDeploy(options);
|
@@ -1,13 +1,14 @@
|
|
1
|
+
import path from "node:path";
|
1
2
|
import { ResolvedConfigContext } from "@modern-js/core";
|
2
|
-
import { DEFAULT_DEV_HOST } from "@modern-js/utils";
|
3
|
+
import { DEFAULT_DEV_HOST, SERVER_DIR, getMeta } from "@modern-js/utils";
|
3
4
|
import { createDevServer } from "@modern-js/server";
|
4
|
-
import {
|
5
|
+
import { applyPlugins } from "@modern-js/prod-server";
|
6
|
+
import { loadServerPlugins } from "../utils/loadPlugins";
|
5
7
|
import { registerCompiler } from "../utils/register";
|
6
8
|
import { printInstructions } from "../utils/printInstructions";
|
7
9
|
import { setServer } from "../utils/createServer";
|
8
10
|
import { generateRoutes } from "../utils/routes";
|
9
11
|
import { buildServerConfig } from "../utils/config";
|
10
|
-
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
11
12
|
const dev = async (api, options, devServerOptions = {}) => {
|
12
13
|
var _normalizedConfig_source, _normalizedConfig_tools;
|
13
14
|
if (options.analyze) {
|
@@ -29,12 +30,14 @@ const dev = async (api, options, devServerOptions = {}) => {
|
|
29
30
|
configFile: serverConfigFile,
|
30
31
|
watch: true
|
31
32
|
});
|
33
|
+
const meta = getMeta(metaName);
|
34
|
+
const serverConfigPath = path.resolve(appDirectory, SERVER_DIR, `${meta}.server`);
|
32
35
|
await hookRunners.beforeDev();
|
33
36
|
if (!appContext.builder && !apiOnly) {
|
34
37
|
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
35
38
|
}
|
36
39
|
await generateRoutes(appContext);
|
37
|
-
const
|
40
|
+
const pluginInstances = await loadServerPlugins(api, appDirectory);
|
38
41
|
const serverOptions = {
|
39
42
|
metaName,
|
40
43
|
dev: {
|
@@ -49,16 +52,17 @@ const dev = async (api, options, devServerOptions = {}) => {
|
|
49
52
|
lambdaDirectory: appContext.lambdaDirectory,
|
50
53
|
sharedDirectory: appContext.sharedDirectory
|
51
54
|
},
|
55
|
+
serverConfigPath,
|
52
56
|
routes: serverRoutes,
|
53
57
|
pwd: appDirectory,
|
54
58
|
config: normalizedConfig,
|
55
59
|
serverConfigFile,
|
56
|
-
|
60
|
+
plugins: pluginInstances,
|
57
61
|
...devServerOptions
|
58
62
|
};
|
59
63
|
if (apiOnly) {
|
60
64
|
var _normalizedConfig_dev;
|
61
|
-
const app = await createDevServer(serverOptions,
|
65
|
+
const app = await createDevServer(serverOptions, applyPlugins);
|
62
66
|
const host = ((_normalizedConfig_dev = normalizedConfig.dev) === null || _normalizedConfig_dev === void 0 ? void 0 : _normalizedConfig_dev.host) || DEFAULT_DEV_HOST;
|
63
67
|
app.listen({
|
64
68
|
port,
|
@@ -69,7 +73,7 @@ const dev = async (api, options, devServerOptions = {}) => {
|
|
69
73
|
} else {
|
70
74
|
const { server } = await appContext.builder.startDevServer({
|
71
75
|
serverOptions,
|
72
|
-
|
76
|
+
applyPlugins
|
73
77
|
});
|
74
78
|
setServer(server);
|
75
79
|
}
|
@@ -1,3 +1,92 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { newAction, upgradeAction } from "@modern-js/utils";
|
2
|
+
import { castArray } from "@rsbuild/shared";
|
3
|
+
import { i18n, localeKeys } from "../locale";
|
4
|
+
const devCommand = async (program, api) => {
|
5
|
+
const runner = api.useHookRunners();
|
6
|
+
const devToolMetas = await runner.registerDev();
|
7
|
+
const devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(async (options) => {
|
8
|
+
const { dev } = await import("./dev");
|
9
|
+
await dev(api, options);
|
10
|
+
});
|
11
|
+
for (const meta of devToolMetas) {
|
12
|
+
if (!meta.subCommands) {
|
13
|
+
continue;
|
14
|
+
}
|
15
|
+
for (const subCmd of meta.subCommands) {
|
16
|
+
devProgram.command(subCmd).action(async (options = {}) => {
|
17
|
+
const { appDirectory } = api.useAppContext();
|
18
|
+
const { isTypescript } = await import("@modern-js/utils");
|
19
|
+
await runner.beforeDevTask(meta);
|
20
|
+
await meta.action(options, {
|
21
|
+
isTsProject: isTypescript(appDirectory)
|
22
|
+
});
|
23
|
+
});
|
24
|
+
}
|
25
|
+
}
|
26
|
+
};
|
27
|
+
const buildCommand = async (program, api) => {
|
28
|
+
const runner = api.useHookRunners();
|
29
|
+
const platformBuilders = await runner.registerBuildPlatform();
|
30
|
+
const buildProgram = program.command("build").usage("[options]").description(i18n.t(localeKeys.command.build.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).action(async (options) => {
|
31
|
+
const { build } = await import("./build");
|
32
|
+
await build(api, options);
|
33
|
+
});
|
34
|
+
for (const platformBuilder of platformBuilders) {
|
35
|
+
const platforms = castArray(platformBuilder.platform);
|
36
|
+
for (const platform of platforms) {
|
37
|
+
buildProgram.command(platform).action(async () => {
|
38
|
+
const { appDirectory } = api.useAppContext();
|
39
|
+
const { isTypescript } = await import("@modern-js/utils");
|
40
|
+
await runner.beforeBuildPlatform(platformBuilders);
|
41
|
+
await platformBuilder.build(platform, {
|
42
|
+
isTsProject: isTypescript(appDirectory)
|
43
|
+
});
|
44
|
+
});
|
45
|
+
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
const serverCommand = (program, api) => {
|
49
|
+
program.command("serve").usage("[options]").description(i18n.t(localeKeys.command.serve.describe)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(async () => {
|
50
|
+
const { start } = await import("./serve");
|
51
|
+
await start(api);
|
52
|
+
});
|
53
|
+
};
|
54
|
+
const deployCommand = (program, api) => {
|
55
|
+
program.command("deploy").usage("[options]").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-s --skip-build", i18n.t(localeKeys.command.shared.skipBuild)).description(i18n.t(localeKeys.command.deploy.describe)).action(async (options) => {
|
56
|
+
if (!options.skipBuild) {
|
57
|
+
const { build } = await import("./build");
|
58
|
+
await build(api);
|
59
|
+
}
|
60
|
+
const { deploy } = await import("./deploy");
|
61
|
+
await deploy(api, options);
|
62
|
+
process.exit(0);
|
63
|
+
});
|
64
|
+
};
|
65
|
+
const newCommand = (program, locale) => {
|
66
|
+
program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(async (options) => {
|
67
|
+
await newAction({
|
68
|
+
...options,
|
69
|
+
locale: options.lang || locale
|
70
|
+
}, "mwa");
|
71
|
+
});
|
72
|
+
};
|
73
|
+
const inspectCommand = (program, api) => {
|
74
|
+
program.command("inspect").description("inspect the internal configs").option(`--env <env>`, i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "/").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(async (options) => {
|
75
|
+
const { inspect } = await import("./inspect");
|
76
|
+
inspect(api, options);
|
77
|
+
});
|
78
|
+
};
|
79
|
+
const upgradeCommand = (program) => {
|
80
|
+
program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(async () => {
|
81
|
+
await upgradeAction();
|
82
|
+
});
|
83
|
+
};
|
84
|
+
export {
|
85
|
+
buildCommand,
|
86
|
+
deployCommand,
|
87
|
+
devCommand,
|
88
|
+
inspectCommand,
|
89
|
+
newCommand,
|
90
|
+
serverCommand,
|
91
|
+
upgradeCommand
|
92
|
+
};
|
@@ -1,20 +1,23 @@
|
|
1
|
-
import
|
1
|
+
import path from "path";
|
2
|
+
import { logger, isApiOnly, getTargetDir, getMeta, SERVER_DIR } from "@modern-js/utils";
|
2
3
|
import { createProdServer } from "@modern-js/prod-server";
|
3
4
|
import { printInstructions } from "../utils/printInstructions";
|
4
|
-
import {
|
5
|
+
import { loadServerPlugins } from "../utils/loadPlugins";
|
5
6
|
const start = async (api) => {
|
6
7
|
var _userConfig_source, _userConfig_output_distPath;
|
7
8
|
const appContext = api.useAppContext();
|
8
9
|
const userConfig = api.useResolvedConfigContext();
|
9
10
|
const hookRunners = api.useHookRunners();
|
10
|
-
const { distDirectory, appDirectory, port,
|
11
|
+
const { distDirectory, appDirectory, port, metaName, serverRoutes, serverConfigFile } = appContext;
|
11
12
|
logger.info(`Starting production server...`);
|
12
13
|
const apiOnly = await isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory);
|
13
14
|
let runMode;
|
14
15
|
if (apiOnly) {
|
15
16
|
runMode = "apiOnly";
|
16
17
|
}
|
17
|
-
const
|
18
|
+
const meta = getMeta(metaName);
|
19
|
+
const serverConfigPath = path.resolve(distDirectory, SERVER_DIR, `${meta}.server`);
|
20
|
+
const pluginInstances = await loadServerPlugins(api, appDirectory);
|
18
21
|
const app = await createProdServer({
|
19
22
|
metaName,
|
20
23
|
pwd: distDirectory,
|
@@ -27,14 +30,15 @@ const start = async (api) => {
|
|
27
30
|
}
|
28
31
|
},
|
29
32
|
routes: serverRoutes,
|
33
|
+
plugins: pluginInstances,
|
34
|
+
serverConfigFile,
|
35
|
+
serverConfigPath,
|
30
36
|
appContext: {
|
31
37
|
appDirectory,
|
32
38
|
sharedDirectory: getTargetDir(appContext.sharedDirectory, appContext.appDirectory, appContext.distDirectory),
|
33
39
|
apiDirectory: getTargetDir(appContext.apiDirectory, appContext.appDirectory, appContext.distDirectory),
|
34
40
|
lambdaDirectory: getTargetDir(appContext.lambdaDirectory, appContext.appDirectory, appContext.distDirectory)
|
35
41
|
},
|
36
|
-
serverConfigFile,
|
37
|
-
internalPlugins: serverInternalPlugins,
|
38
42
|
runMode
|
39
43
|
});
|
40
44
|
app.listen(port, async () => {
|
package/dist/esm-node/hooks.js
CHANGED
@@ -7,10 +7,15 @@ const hooks = {
|
|
7
7
|
modifyAsyncEntry: createAsyncWaterfall(),
|
8
8
|
modifyFileSystemRoutes: createAsyncWaterfall(),
|
9
9
|
modifyServerRoutes: createAsyncWaterfall(),
|
10
|
+
/** add entry point info to entrypoints array */
|
11
|
+
modifyEntrypoints: createAsyncWaterfall(),
|
12
|
+
/** add entry type */
|
13
|
+
checkEntryPoint: createAsyncWaterfall(),
|
10
14
|
htmlPartials: createAsyncWaterfall(),
|
11
15
|
beforeGenerateRoutes: createAsyncWaterfall(),
|
12
16
|
addDefineTypes: createAsyncWaterfall(),
|
13
17
|
collectServerPlugins: createAsyncWaterfall(),
|
18
|
+
_internalServerPlugins: createAsyncWaterfall(),
|
14
19
|
beforeDev: createAsyncWorkflow(),
|
15
20
|
afterDev: createAsyncWorkflow(),
|
16
21
|
beforeCreateCompiler: createAsyncWorkflow(),
|
package/dist/esm-node/index.js
CHANGED
@@ -1,64 +1,20 @@
|
|
1
1
|
import path from "path";
|
2
2
|
import { lintPlugin } from "@modern-js/plugin-lint";
|
3
|
-
import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE
|
4
|
-
import { castArray } from "@modern-js/utils/lodash";
|
3
|
+
import { cleanRequireCache, emptyDir, getCommand, getArgv, fs, NESTED_ROUTE_SPEC_FILE } from "@modern-js/utils";
|
5
4
|
import { getLocaleLanguage } from "@modern-js/plugin-i18n/language-detector";
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import { hooks } from "./hooks";
|
9
|
-
import { i18n, localeKeys } from "./locale";
|
5
|
+
import initializePlugin from "./plugins/initialize";
|
6
|
+
import analyzePlugin from "./plugins/analyze";
|
10
7
|
import serverBuildPlugin from "./plugins/serverBuild";
|
11
8
|
import deployPlugin from "./plugins/deploy";
|
9
|
+
import { hooks } from "./hooks";
|
10
|
+
import { i18n } from "./locale";
|
12
11
|
import { restart } from "./utils/restart";
|
13
12
|
import { generateWatchFiles } from "./utils/generateWatchFiles";
|
13
|
+
import { buildCommand, deployCommand, devCommand, inspectCommand, newCommand, serverCommand, upgradeCommand } from "./commands";
|
14
|
+
import { dev } from "./commands/dev";
|
14
15
|
import { mergeConfig } from "@modern-js/core";
|
15
|
-
import { dev } from "./commands";
|
16
16
|
export * from "./defineConfig";
|
17
17
|
export * from "./types";
|
18
|
-
const devCommand = async (program, api) => {
|
19
|
-
const runner = api.useHookRunners();
|
20
|
-
const devToolMetas = await runner.registerDev();
|
21
|
-
const devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(async (options) => {
|
22
|
-
const { dev: dev2 } = await import("./commands/dev");
|
23
|
-
await dev2(api, options);
|
24
|
-
});
|
25
|
-
for (const meta of devToolMetas) {
|
26
|
-
if (!meta.subCommands) {
|
27
|
-
continue;
|
28
|
-
}
|
29
|
-
for (const subCmd of meta.subCommands) {
|
30
|
-
devProgram.command(subCmd).action(async (options = {}) => {
|
31
|
-
const { appDirectory } = api.useAppContext();
|
32
|
-
const { isTypescript } = await import("@modern-js/utils");
|
33
|
-
await runner.beforeDevTask(meta);
|
34
|
-
await meta.action(options, {
|
35
|
-
isTsProject: isTypescript(appDirectory)
|
36
|
-
});
|
37
|
-
});
|
38
|
-
}
|
39
|
-
}
|
40
|
-
};
|
41
|
-
const buildCommand = async (program, api) => {
|
42
|
-
const runner = api.useHookRunners();
|
43
|
-
const platformBuilders = await runner.registerBuildPlatform();
|
44
|
-
const buildProgram = program.command("build").usage("[options]").description(i18n.t(localeKeys.command.build.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).action(async (options) => {
|
45
|
-
const { build } = await import("./commands/build");
|
46
|
-
await build(api, options);
|
47
|
-
});
|
48
|
-
for (const platformBuilder of platformBuilders) {
|
49
|
-
const platforms = castArray(platformBuilder.platform);
|
50
|
-
for (const platform of platforms) {
|
51
|
-
buildProgram.command(platform).action(async () => {
|
52
|
-
const { appDirectory } = api.useAppContext();
|
53
|
-
const { isTypescript } = await import("@modern-js/utils");
|
54
|
-
await runner.beforeBuildPlatform(platformBuilders);
|
55
|
-
await platformBuilder.build(platform, {
|
56
|
-
isTsProject: isTypescript(appDirectory)
|
57
|
-
});
|
58
|
-
});
|
59
|
-
}
|
60
|
-
}
|
61
|
-
};
|
62
18
|
const appTools = (options = {
|
63
19
|
bundler: "webpack"
|
64
20
|
}) => ({
|
@@ -111,32 +67,11 @@ const appTools = (options = {
|
|
111
67
|
async commands({ program }) {
|
112
68
|
await devCommand(program, api);
|
113
69
|
await buildCommand(program, api);
|
114
|
-
program
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
program
|
119
|
-
if (!options2.skipBuild) {
|
120
|
-
const { build } = await import("./commands/build");
|
121
|
-
await build(api);
|
122
|
-
}
|
123
|
-
const { deploy } = await import("./commands/deploy");
|
124
|
-
await deploy(api, options2);
|
125
|
-
process.exit(0);
|
126
|
-
});
|
127
|
-
program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(async (options2) => {
|
128
|
-
await newAction({
|
129
|
-
...options2,
|
130
|
-
locale: options2.lang || locale
|
131
|
-
}, "mwa");
|
132
|
-
});
|
133
|
-
program.command("inspect").description("inspect the internal configs").option(`--env <env>`, i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "/").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(async (options2) => {
|
134
|
-
const { inspect } = await import("./commands/inspect");
|
135
|
-
inspect(api, options2);
|
136
|
-
});
|
137
|
-
program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(async () => {
|
138
|
-
await upgradeAction();
|
139
|
-
});
|
70
|
+
serverCommand(program, api);
|
71
|
+
deployCommand(program, api);
|
72
|
+
newCommand(program, locale);
|
73
|
+
inspectCommand(program, api);
|
74
|
+
upgradeCommand(program);
|
140
75
|
},
|
141
76
|
async prepare() {
|
142
77
|
const command = getCommand();
|
@@ -199,9 +134,7 @@ const appTools = (options = {
|
|
199
134
|
var src_default = appTools;
|
200
135
|
export {
|
201
136
|
appTools,
|
202
|
-
buildCommand,
|
203
137
|
src_default as default,
|
204
138
|
dev,
|
205
|
-
devCommand,
|
206
139
|
mergeConfig
|
207
140
|
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
const INDEX_FILE_NAME = "index";
|
2
|
+
const FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
3
|
+
const ENTRY_POINT_FILE_NAME = "index.jsx";
|
4
|
+
const ENTRY_BOOTSTRAP_FILE_NAME = "bootstrap.jsx";
|
5
|
+
const HTML_PARTIALS_FOLDER = "html";
|
6
|
+
const HTML_PARTIALS_EXTENSIONS = [
|
7
|
+
".htm",
|
8
|
+
".html",
|
9
|
+
".ejs"
|
10
|
+
];
|
11
|
+
const APP_CONFIG_NAME = "config";
|
12
|
+
const APP_INIT_EXPORTED = "init";
|
13
|
+
const APP_INIT_IMPORTED = "appInit";
|
14
|
+
export {
|
15
|
+
APP_CONFIG_NAME,
|
16
|
+
APP_INIT_EXPORTED,
|
17
|
+
APP_INIT_IMPORTED,
|
18
|
+
ENTRY_BOOTSTRAP_FILE_NAME,
|
19
|
+
ENTRY_POINT_FILE_NAME,
|
20
|
+
FILE_SYSTEM_ROUTES_FILE_NAME,
|
21
|
+
HTML_PARTIALS_EXTENSIONS,
|
22
|
+
HTML_PARTIALS_FOLDER,
|
23
|
+
INDEX_FILE_NAME
|
24
|
+
};
|
@@ -1,10 +1,8 @@
|
|
1
1
|
import path from "path";
|
2
|
-
import { fs, getEntryOptions,
|
2
|
+
import { findExists, fs, getEntryOptions, JS_EXTENSIONS, SERVER_RENDER_FUNCTION_NAME } from "@modern-js/utils";
|
3
3
|
import * as templates from "./templates";
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { getDefaultImports, getServerLoadersFile, getServerCombinedModueFile } from "./utils";
|
7
|
-
import { walk } from "./nestedRoutes";
|
4
|
+
import { ENTRY_POINT_FILE_NAME, ENTRY_BOOTSTRAP_FILE_NAME } from "./constants";
|
5
|
+
import { getDefaultImports } from "./utils";
|
8
6
|
const createImportSpecifier = (specifiers) => {
|
9
7
|
let defaults = "";
|
10
8
|
const named = [];
|
@@ -50,92 +48,17 @@ ${initialize || ""}`);
|
|
50
48
|
${initialize || ""}`).join("\n");
|
51
49
|
};
|
52
50
|
const generateCode = async (appContext, config, entrypoints, api) => {
|
53
|
-
const { internalDirectory, srcDirectory, appDirectory, internalDirAlias, internalSrcAlias,
|
51
|
+
const { internalDirectory, srcDirectory, appDirectory, internalDirAlias, internalSrcAlias, runtimeConfigFile } = appContext;
|
54
52
|
const hookRunners = api.useHookRunners();
|
55
|
-
const
|
56
|
-
const getRoutes = isV5 ? getClientRoutesLegacy : getClientRoutes;
|
53
|
+
const customRuntimeConfig = findExists(JS_EXTENSIONS.map((ext) => path.resolve(srcDirectory, `${runtimeConfigFile}${ext}`)));
|
57
54
|
const importsStatemets = /* @__PURE__ */ new Map();
|
58
|
-
|
59
|
-
await Promise.all(entrypoints.map(generateEntryCode));
|
55
|
+
await Promise.all(entrypoints.map((entrypoint) => generateEntryCode(entrypoint, customRuntimeConfig)));
|
60
56
|
return {
|
61
57
|
importsStatemets
|
62
58
|
};
|
63
|
-
async function generateEntryCode(entrypoint) {
|
64
|
-
const { entryName,
|
59
|
+
async function generateEntryCode(entrypoint, customRuntimeConfig2) {
|
60
|
+
const { entryName, isAutoMount } = entrypoint;
|
65
61
|
if (isAutoMount) {
|
66
|
-
if (fileSystemRoutes) {
|
67
|
-
var _config_output;
|
68
|
-
let initialRoutes = [];
|
69
|
-
let nestedRoutes = null;
|
70
|
-
if (entrypoint.entry) {
|
71
|
-
initialRoutes = getRoutes({
|
72
|
-
entrypoint,
|
73
|
-
srcDirectory,
|
74
|
-
srcAlias: internalSrcAlias,
|
75
|
-
internalDirectory,
|
76
|
-
internalDirAlias
|
77
|
-
});
|
78
|
-
}
|
79
|
-
if (!isV5 && entrypoint.nestedRoutesEntry) {
|
80
|
-
nestedRoutes = await walk(entrypoint.nestedRoutesEntry, entrypoint.nestedRoutesEntry, {
|
81
|
-
name: internalSrcAlias,
|
82
|
-
basename: srcDirectory
|
83
|
-
}, entrypoint.entryName, entrypoint.isMainEntry, oldVersion);
|
84
|
-
if (nestedRoutes) {
|
85
|
-
if (!Array.isArray(nestedRoutes)) {
|
86
|
-
nestedRoutes = [
|
87
|
-
nestedRoutes
|
88
|
-
];
|
89
|
-
}
|
90
|
-
for (const route of nestedRoutes) {
|
91
|
-
initialRoutes.unshift(route);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
95
|
-
const { routes } = await hookRunners.modifyFileSystemRoutes({
|
96
|
-
entrypoint,
|
97
|
-
routes: initialRoutes
|
98
|
-
});
|
99
|
-
const config2 = api.useResolvedConfigContext();
|
100
|
-
const ssr = getEntryOptions(entryName, isMainEntry, config2.server.ssr, config2.server.ssrByEntries, packageName);
|
101
|
-
const useSSG = isSSGEntry(config2, entryName, entrypoints);
|
102
|
-
let mode;
|
103
|
-
if (ssr) {
|
104
|
-
mode = typeof ssr === "object" ? ssr.mode || "string" : "string";
|
105
|
-
}
|
106
|
-
if (mode === "stream") {
|
107
|
-
const hasPageRoute = routes.some((route) => "type" in route && route.type === "page");
|
108
|
-
if (hasPageRoute) {
|
109
|
-
logger.error("Streaming ssr is not supported when pages dir exists");
|
110
|
-
process.exit(1);
|
111
|
-
}
|
112
|
-
}
|
113
|
-
const { code } = await hookRunners.beforeGenerateRoutes({
|
114
|
-
entrypoint,
|
115
|
-
code: await templates.fileSystemRoutes({
|
116
|
-
routes,
|
117
|
-
ssrMode: useSSG ? "string" : mode,
|
118
|
-
nestedRoutesEntry: entrypoint.nestedRoutesEntry,
|
119
|
-
entryName: entrypoint.entryName,
|
120
|
-
internalDirectory,
|
121
|
-
splitRouteChunks: config2 === null || config2 === void 0 ? void 0 : (_config_output = config2.output) === null || _config_output === void 0 ? void 0 : _config_output.splitRouteChunks
|
122
|
-
})
|
123
|
-
});
|
124
|
-
if (entrypoint.nestedRoutesEntry && isUseSSRBundle(config2)) {
|
125
|
-
const routesServerFile = getServerLoadersFile(internalDirectory, entryName);
|
126
|
-
const code2 = templates.routesForServer({
|
127
|
-
routes
|
128
|
-
});
|
129
|
-
await fs.ensureFile(routesServerFile);
|
130
|
-
await fs.writeFile(routesServerFile, code2);
|
131
|
-
}
|
132
|
-
const serverLoaderCombined = templates.ssrLoaderCombinedModule(entrypoints, entrypoint, config2, appContext);
|
133
|
-
if (serverLoaderCombined) {
|
134
|
-
const serverLoaderFile = getServerCombinedModueFile(internalDirectory, entryName);
|
135
|
-
await fs.outputFile(serverLoaderFile, serverLoaderCombined);
|
136
|
-
}
|
137
|
-
fs.outputFileSync(path.resolve(internalDirectory, `./${entryName}/${FILE_SYSTEM_ROUTES_FILE_NAME}`), code, "utf8");
|
138
|
-
}
|
139
62
|
const { imports } = await hookRunners.modifyEntryImports({
|
140
63
|
entrypoint,
|
141
64
|
imports: getDefaultImports({
|
@@ -143,7 +66,9 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
143
66
|
srcDirectory,
|
144
67
|
appDirectory,
|
145
68
|
internalSrcAlias,
|
146
|
-
internalDirAlias
|
69
|
+
internalDirAlias,
|
70
|
+
runtimeConfigFile,
|
71
|
+
customRuntimeConfig: customRuntimeConfig2
|
147
72
|
})
|
148
73
|
});
|
149
74
|
importsStatemets.set(entryName, imports);
|
@@ -155,7 +80,8 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
155
80
|
const generateIndexCode = async ({ appContext, api, entrypoints, config, importsStatemets, bundlerConfigs }) => {
|
156
81
|
const hookRunners = api.useHookRunners();
|
157
82
|
const { mountId } = config.html;
|
158
|
-
const { internalDirectory, packageName } = appContext;
|
83
|
+
const { internalDirectory, packageName, srcDirectory, runtimeConfigFile } = appContext;
|
84
|
+
const customRuntimeConfig = findExists(JS_EXTENSIONS.map((ext) => path.resolve(srcDirectory, `${runtimeConfigFile}${ext}`)));
|
159
85
|
await Promise.all(entrypoints.map(async (entrypoint) => {
|
160
86
|
const { entryName, isMainEntry, isAutoMount, customBootstrap, fileSystemRoutes } = entrypoint;
|
161
87
|
if (isAutoMount) {
|
@@ -169,6 +95,7 @@ const generateIndexCode = async ({ appContext, api, entrypoints, config, imports
|
|
169
95
|
code: templates.renderFunction({
|
170
96
|
plugins,
|
171
97
|
customBootstrap,
|
98
|
+
customRuntimeConfig,
|
172
99
|
fileSystemRoutes
|
173
100
|
})
|
174
101
|
});
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import path from "path";
|
2
|
-
import { ensureAbsolutePath, fs, findExists, MAIN_ENTRY_NAME,
|
2
|
+
import { ensureAbsolutePath, fs, findExists, MAIN_ENTRY_NAME, JS_EXTENSIONS } from "@modern-js/utils";
|
3
3
|
import { getFileSystemEntry } from "./getFileSystemEntry";
|
4
|
-
import { JS_EXTENSIONS } from "./constants";
|
5
4
|
import { isSubDirOrEqual } from "./utils";
|
6
5
|
const ensureExtensions = (file) => {
|
7
6
|
if (!path.extname(file)) {
|
@@ -23,32 +22,24 @@ const ifAlreadyExists = (entrypoints, checked) => entrypoints.some((entrypoint)
|
|
23
22
|
}
|
24
23
|
return false;
|
25
24
|
});
|
26
|
-
const getBundleEntry = (appContext, config) => {
|
25
|
+
const getBundleEntry = async (hookRunners, appContext, config) => {
|
27
26
|
const { appDirectory, packageName } = appContext;
|
28
27
|
const { disableDefaultEntries, entries, entriesDir, mainEntryName } = config.source;
|
29
|
-
const defaults = disableDefaultEntries ? [] : getFileSystemEntry(appContext, config);
|
28
|
+
const defaults = disableDefaultEntries ? [] : await getFileSystemEntry(hookRunners, appContext, config);
|
30
29
|
if (entries) {
|
31
30
|
Object.keys(entries).forEach((name) => {
|
32
31
|
const value = entries[name];
|
33
|
-
const
|
32
|
+
const entryName = typeof value === "string" ? value : value.entry;
|
33
|
+
const isAutoMount = typeof value === "string" ? true : !value.disableMount;
|
34
|
+
const entrypoint = {
|
34
35
|
entryName: name,
|
35
36
|
isMainEntry: false,
|
36
|
-
entry: ensureAbsolutePath(appDirectory,
|
37
|
-
absoluteEntryDir: isDirectory(ensureAbsolutePath(appDirectory,
|
38
|
-
isAutoMount
|
39
|
-
|
40
|
-
|
41
|
-
entryName: name,
|
42
|
-
isMainEntry: false,
|
43
|
-
entry: ensureAbsolutePath(appDirectory, value.entry),
|
44
|
-
absoluteEntryDir: isDirectory(ensureAbsolutePath(appDirectory, value.entry)) ? ensureAbsolutePath(appDirectory, value.entry) : path.dirname(ensureAbsolutePath(appDirectory, value.entry)),
|
45
|
-
isAutoMount: !value.disableMount,
|
46
|
-
customBootstrap: value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
47
|
-
fileSystemRoutes: fs.statSync(ensureAbsolutePath(appDirectory, value.entry)).isDirectory() ? {} : void 0
|
37
|
+
entry: ensureAbsolutePath(appDirectory, entryName),
|
38
|
+
absoluteEntryDir: isDirectory(ensureAbsolutePath(appDirectory, entryName)) ? ensureAbsolutePath(appDirectory, entryName) : path.dirname(ensureAbsolutePath(appDirectory, entryName)),
|
39
|
+
isAutoMount,
|
40
|
+
customBootstrap: typeof value === "string" ? false : value.customBootstrap && ensureAbsolutePath(appDirectory, value.customBootstrap),
|
41
|
+
fileSystemRoutes: fs.statSync(ensureAbsolutePath(appDirectory, entryName)).isDirectory() ? {} : void 0
|
48
42
|
};
|
49
|
-
if (entrypoint.fileSystemRoutes && !isRouterV5(config)) {
|
50
|
-
entrypoint.nestedRoutesEntry = entrypoint.entry;
|
51
|
-
}
|
52
43
|
if (!ifAlreadyExists(defaults, entrypoint)) {
|
53
44
|
defaults.push(entrypoint);
|
54
45
|
}
|