@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.8 → 3.9.3-ultramodern.1
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/bin/modern-bundle-docs.js +2 -2
- package/bin/modern.js +2 -2
- package/dist/cjs/builder/generator/adapterCopy.js +26 -0
- package/dist/cjs/builder/generator/createCopyPattern.js +2 -1
- package/dist/cjs/builder/index.js +4 -0
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +11 -6
- package/dist/cjs/builder/shared/lazyCompilation.js +26 -0
- package/dist/cjs/commands/build.js +1 -2
- package/dist/cjs/commands/deploy.js +1 -3
- package/dist/cjs/commands/index.js +10 -2
- package/dist/cjs/compat/hooks.js +1 -1
- package/dist/cjs/esm/ts-paths-loader.js +5 -4
- package/dist/cjs/esm/ts-paths-loader.mjs +5 -4
- package/dist/cjs/index.js +89 -110
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +1 -1
- package/dist/cjs/plugins/analyze/getServerRoutes.js +1 -1
- package/dist/cjs/plugins/analyze/index.js +2 -2
- package/dist/cjs/plugins/analyze/utils.js +6 -6
- package/dist/cjs/plugins/deploy/index.js +7 -28
- package/dist/cjs/plugins/deploy/platforms/netlify.js +2 -1
- package/dist/cjs/plugins/deploy/platforms/node.js +12 -3
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +3 -2
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +3 -2
- package/dist/cjs/plugins/deploy/platforms/vercel.js +2 -1
- package/dist/cjs/plugins/deploy/utils/index.js +15 -12
- package/dist/cjs/plugins/initialize/index.js +6 -5
- package/dist/cjs/plugins/serverBuild.js +0 -2
- package/dist/cjs/run/index.js +5 -5
- package/dist/cjs/{plugins/serverRuntime.js → server-plugin.js} +13 -16
- package/dist/cjs/types/config/base.js +62 -0
- package/dist/cjs/types/plugin-base.js +18 -0
- package/dist/cjs/types/plugin.js +46 -2
- package/dist/cjs/utils/initAppContext.js +1 -1
- package/dist/cjs/utils/loadPlugins.js +13 -7
- package/dist/cjs/utils/register.js +1 -1
- package/dist/esm/builder/generator/adapterCopy.mjs +23 -1
- package/dist/esm/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm/builder/index.mjs +1 -0
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +9 -7
- package/dist/esm/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm/commands/build.mjs +1 -2
- package/dist/esm/commands/deploy.mjs +1 -3
- package/dist/esm/commands/index.mjs +10 -2
- package/dist/esm/compat/hooks.mjs +1 -1
- package/dist/esm/esm/ts-paths-loader.mjs +5 -4
- package/dist/esm/index.mjs +13 -20
- package/dist/esm/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +7 -7
- package/dist/esm/plugins/deploy/index.mjs +5 -21
- package/dist/esm/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm/plugins/deploy/platforms/node.mjs +12 -3
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +3 -2
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +3 -2
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm/plugins/deploy/utils/index.mjs +17 -14
- package/dist/esm/plugins/initialize/index.mjs +6 -5
- package/dist/esm/plugins/serverBuild.mjs +0 -2
- package/dist/esm/run/index.mjs +5 -5
- package/dist/esm/server-plugin.mjs +1 -0
- package/dist/esm/types/config/base.mjs +1 -0
- package/dist/esm/types/plugin-base.mjs +0 -0
- package/dist/esm/types/plugin.mjs +1 -0
- package/dist/esm/utils/initAppContext.mjs +2 -2
- package/dist/esm/utils/loadPlugins.mjs +4 -8
- package/dist/esm/utils/register.mjs +1 -1
- package/dist/esm-node/builder/generator/adapterCopy.mjs +23 -1
- package/dist/esm-node/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm-node/builder/index.mjs +1 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +9 -7
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm-node/commands/build.mjs +1 -2
- package/dist/esm-node/commands/deploy.mjs +1 -3
- package/dist/esm-node/commands/index.mjs +10 -2
- package/dist/esm-node/compat/hooks.mjs +1 -1
- package/dist/esm-node/esm/ts-paths-loader.mjs +5 -4
- package/dist/esm-node/index.mjs +14 -22
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm-node/plugins/analyze/index.mjs +2 -2
- package/dist/esm-node/plugins/analyze/utils.mjs +7 -7
- package/dist/esm-node/plugins/deploy/index.mjs +5 -21
- package/dist/esm-node/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +12 -3
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +3 -2
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +3 -2
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm-node/plugins/deploy/utils/index.mjs +17 -15
- package/dist/esm-node/plugins/initialize/index.mjs +6 -5
- package/dist/esm-node/plugins/serverBuild.mjs +0 -2
- package/dist/esm-node/run/index.mjs +5 -5
- package/dist/esm-node/server-plugin.mjs +2 -0
- package/dist/esm-node/types/config/base.mjs +2 -0
- package/dist/esm-node/types/plugin-base.mjs +1 -0
- package/dist/esm-node/types/plugin.mjs +1 -0
- package/dist/esm-node/utils/initAppContext.mjs +2 -2
- package/dist/esm-node/utils/loadPlugins.mjs +4 -8
- package/dist/esm-node/utils/register.mjs +1 -1
- package/dist/types/builder/generator/adapterCopy.d.ts +13 -1
- package/dist/types/builder/index.d.ts +1 -0
- package/dist/types/builder/shared/builderPlugins/adapterBasic.d.ts +4 -2
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +2 -1
- package/dist/types/builder/shared/builderPlugins/builderHooks.d.ts +10 -2
- package/dist/types/builder/shared/lazyCompilation.d.ts +15 -0
- package/dist/types/compat/hooks.d.ts +3 -2
- package/dist/types/index.d.ts +3 -4
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +5 -4
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +5 -4
- package/dist/types/plugins/analyze/utils.d.ts +2 -2
- package/dist/types/plugins/deploy/index.d.ts +1 -4
- package/dist/types/plugins/deploy/utils/generator.d.ts +1 -1
- package/dist/types/plugins/deploy/utils/index.d.ts +1 -1
- package/dist/types/run/index.d.ts +1 -1
- package/dist/types/server-plugin.d.ts +10 -0
- package/dist/types/types/config/base.d.ts +58 -0
- package/dist/types/types/config/deploy.d.ts +2 -50
- package/dist/types/types/config/dev.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +18 -42
- package/dist/types/types/config/output.d.ts +2 -2
- package/dist/types/types/config/testing.d.ts +1 -1
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/types/plugin-base.d.ts +188 -0
- package/dist/types/types/plugin.d.ts +9 -183
- package/dist/types/utils/initAppContext.d.ts +2 -2
- package/docs/apis/app/commands.md +1 -0
- package/docs/configure/app/bff/effect.md +5 -12
- package/docs/configure/app/output/disable-svgr.md +4 -0
- package/docs/configure/app/output/svg-default-export.md +4 -0
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/configure/app/tools/less.md +94 -19
- package/docs/configure/app/tools/sass.md +87 -18
- package/docs/configure/app/tools/svgr.md +91 -0
- package/docs/configure/app/tools/ts-checker.md +7 -21
- package/docs/guides/basic-features/render/ssr-cache.md +14 -1
- package/docs/guides/basic-features/static-assets/svg-assets.md +29 -17
- package/docs/guides/basic-features/testing/rstest.md +0 -2
- package/docs/guides/get-started/quick-start.md +1 -1
- package/docs/guides/get-started/ultramodern.md +45 -14
- package/docs/llms.txt +4 -3
- package/docs/plugin/introduction.md +10 -10
- package/docs/plugin/server-plugins/api.md +1 -0
- package/package.json +67 -30
- package/dist/esm/plugins/serverRuntime.mjs +0 -15
- package/dist/esm-node/plugins/serverRuntime.mjs +0 -16
- package/dist/types/plugins/serverRuntime.d.ts +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import node_path from "node:path";
|
|
2
3
|
import { collectRouteComponentFiles, normalizeModulePath } from "@modern-js/utils";
|
|
3
4
|
function aggregateEagerRouteComponentFiles(byEntry) {
|
|
4
5
|
const files = new Set();
|
|
@@ -21,6 +22,18 @@ function buildSSRLazyCompilationTest(eagerRouteFiles, userTest) {
|
|
|
21
22
|
return userTestFn(m);
|
|
22
23
|
};
|
|
23
24
|
}
|
|
25
|
+
function buildDefaultLazyCompilationTest(appDirectory, internalDirectory) {
|
|
26
|
+
let dirs;
|
|
27
|
+
return (m)=>{
|
|
28
|
+
if (!('resource' in m) || 'string' != typeof m.resource) return true;
|
|
29
|
+
dirs ??= {
|
|
30
|
+
app: normalizeModulePath(appDirectory),
|
|
31
|
+
internal: normalizeModulePath(internalDirectory)
|
|
32
|
+
};
|
|
33
|
+
const file = m.resource.split('?')[0].split(node_path.sep).join('/');
|
|
34
|
+
return file.startsWith(`${dirs.app}/`) && !file.startsWith(`${dirs.internal}/`) && !file.slice(dirs.app.length).includes('/node_modules/');
|
|
35
|
+
};
|
|
36
|
+
}
|
|
24
37
|
function planSSRLazyCompilation(current, info) {
|
|
25
38
|
if (!current) return {
|
|
26
39
|
apply: false
|
|
@@ -42,4 +55,4 @@ function planSSRLazyCompilation(current, info) {
|
|
|
42
55
|
}
|
|
43
56
|
};
|
|
44
57
|
}
|
|
45
|
-
export { aggregateEagerRouteComponentFiles, buildSSRLazyCompilationTest, collectRouteComponentFiles, normalizeModulePath, planSSRLazyCompilation };
|
|
58
|
+
export { aggregateEagerRouteComponentFiles, buildDefaultLazyCompilationTest, buildSSRLazyCompilationTest, collectRouteComponentFiles, normalizeModulePath, planSSRLazyCompilation };
|
|
@@ -57,9 +57,8 @@ const build = async (api, options)=>{
|
|
|
57
57
|
logger.info('Starting production build...');
|
|
58
58
|
if (!appContext.builder) throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
59
59
|
await appContext.builder.onAfterBuild(async ()=>copyEnvFiles(appContext.appDirectory, appContext.distDirectory));
|
|
60
|
-
|
|
60
|
+
await appContext.builder.build({
|
|
61
61
|
watch: options?.watch
|
|
62
62
|
});
|
|
63
|
-
if (!options?.watch) await buildResult?.close();
|
|
64
63
|
};
|
|
65
64
|
export { build };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { getServerPlugins } from "../utils/loadPlugins.mjs";
|
|
3
|
-
import { build } from "./build.mjs";
|
|
4
3
|
const deploy = async (api, options = {})=>{
|
|
5
4
|
const hooks = api.getHooks();
|
|
6
5
|
const { metaName } = api.getAppContext();
|
|
7
|
-
|
|
8
|
-
else await build(api);
|
|
6
|
+
await getServerPlugins(api, metaName);
|
|
9
7
|
await hooks.onBeforeDeploy.call(options);
|
|
10
8
|
await hooks.deploy.call();
|
|
11
9
|
await hooks.onAfterDeploy.call(options);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { i18n, localeKeys } from "../locale/index.mjs";
|
|
3
|
+
const deployTargetOption = [
|
|
4
|
+
'--deploy-target <target>',
|
|
5
|
+
'deploy target; overrides deploy.target and MODERNJS_DEPLOY'
|
|
6
|
+
];
|
|
3
7
|
const devCommand = async (program, api)=>{
|
|
4
8
|
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)=>{
|
|
5
9
|
const { dev } = await import("./dev.mjs");
|
|
@@ -7,7 +11,7 @@ const devCommand = async (program, api)=>{
|
|
|
7
11
|
});
|
|
8
12
|
};
|
|
9
13
|
const buildCommand = async (program, api)=>{
|
|
10
|
-
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)).option('-w --watch', i18n.t(localeKeys.command.build.watch)).action(async (options)=>{
|
|
14
|
+
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)).option('-w --watch', i18n.t(localeKeys.command.build.watch)).option(...deployTargetOption).action(async (options)=>{
|
|
11
15
|
const { build } = await import("./build.mjs");
|
|
12
16
|
await build(api, options);
|
|
13
17
|
});
|
|
@@ -19,7 +23,11 @@ const serverCommand = (program, api)=>{
|
|
|
19
23
|
});
|
|
20
24
|
};
|
|
21
25
|
const deployCommand = (program, api)=>{
|
|
22
|
-
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)=>{
|
|
26
|
+
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)).option(...deployTargetOption).description(i18n.t(localeKeys.command.deploy.describe)).action(async (options)=>{
|
|
27
|
+
if (!options.skipBuild) {
|
|
28
|
+
const { build } = await import("./build.mjs");
|
|
29
|
+
await build(api);
|
|
30
|
+
}
|
|
23
31
|
const { deploy } = await import("./deploy.mjs");
|
|
24
32
|
await deploy(api, options);
|
|
25
33
|
process.exit(0);
|
|
@@ -60,7 +60,7 @@ function handleSetupResult(setupResult, api) {
|
|
|
60
60
|
if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
|
|
61
61
|
const { isMultiple, params: transformParams } = transformHookParams(key, params);
|
|
62
62
|
if (isMultiple) return transformHookResult(key, await fn(...transformParams));
|
|
63
|
-
return transformHookResult(key, await fn(transformParams));
|
|
63
|
+
else return transformHookResult(key, await fn(transformParams));
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -15,8 +15,9 @@ const getParentPath = (parentURL)=>{
|
|
|
15
15
|
} catch {}
|
|
16
16
|
return process.cwd();
|
|
17
17
|
};
|
|
18
|
+
const resolveSourcePath = (resolvedPath, context, defaultResolve)=>defaultResolve(context.conditions?.find((condition)=>'require' === condition || 'import' === condition) === 'require' ? resolvedPath : pathToFileURL(resolvedPath).href, context, defaultResolve);
|
|
18
19
|
async function initialize({ appDir: currentAppDir, baseUrl, paths }) {
|
|
19
|
-
appDir = node_path.resolve(currentAppDir);
|
|
20
|
+
appDir = node_fs.existsSync(currentAppDir) ? node_fs.realpathSync(currentAppDir) : node_path.resolve(currentAppDir);
|
|
20
21
|
matchPath = createMatchPath(baseUrl || './', paths || {});
|
|
21
22
|
}
|
|
22
23
|
function resolve(specifier, context, defaultResolve) {
|
|
@@ -26,12 +27,12 @@ function resolve(specifier, context, defaultResolve) {
|
|
|
26
27
|
if ((specifier.startsWith('./') || specifier.startsWith('../')) && !node_path.extname(specifier) && isAppFile) {
|
|
27
28
|
const matchedPath = node_path.resolve(parentPath, specifier);
|
|
28
29
|
const resolvedPath = findSourceEntry(matchedPath) || matchedPath;
|
|
29
|
-
if (resolvedPath && node_fs.existsSync(resolvedPath)) return
|
|
30
|
+
if (resolvedPath && node_fs.existsSync(resolvedPath)) return resolveSourcePath(resolvedPath, context, defaultResolve);
|
|
30
31
|
}
|
|
31
|
-
if (!matchPath) return defaultResolve(specifier, context, defaultResolve);
|
|
32
|
+
if (!matchPath || !isAppFile) return defaultResolve(specifier, context, defaultResolve);
|
|
32
33
|
const match = findMatchedSourcePath(matchPath, specifier);
|
|
33
34
|
if (!match) return defaultResolve(specifier, context, defaultResolve);
|
|
34
35
|
const resolvedPath = findSourceEntry(match) || match;
|
|
35
|
-
return
|
|
36
|
+
return resolveSourcePath(resolvedPath, context, defaultResolve);
|
|
36
37
|
}
|
|
37
38
|
export { initialize, resolve };
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { resolveDeployTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
|
|
3
|
+
import { createPolicyDefaultsPlugin } from "@modern-js/app-tools-extensions/policy-defaults";
|
|
3
4
|
import { castArray } from "@modern-js/builder";
|
|
4
5
|
import { getLocaleLanguage } from "@modern-js/i18n-utils/language-detector";
|
|
5
6
|
import { createAsyncHook } from "@modern-js/plugin";
|
|
6
|
-
import {
|
|
7
|
+
import { deprecatedCommands, emptyDir, getArgv, getCommand } from "@modern-js/utils";
|
|
7
8
|
import path from "path";
|
|
8
9
|
import { buildCommand, deployCommand, devCommand, infoCommand, inspectCommand, serverCommand } from "./commands/index.mjs";
|
|
9
10
|
import { compatPlugin } from "./compat/index.mjs";
|
|
@@ -13,21 +14,20 @@ import analyze from "./plugins/analyze/index.mjs";
|
|
|
13
14
|
import deploy from "./plugins/deploy/index.mjs";
|
|
14
15
|
import initialize from "./plugins/initialize/index.mjs";
|
|
15
16
|
import serverBuild from "./plugins/serverBuild.mjs";
|
|
16
|
-
import serverRuntime from "./plugins/serverRuntime.mjs";
|
|
17
17
|
import { generateWatchFiles } from "./utils/generateWatchFiles.mjs";
|
|
18
18
|
import { initAppContext } from "./utils/initAppContext.mjs";
|
|
19
19
|
import { restart } from "./utils/restart.mjs";
|
|
20
20
|
export * from "./defineConfig.mjs";
|
|
21
21
|
export * from "./types/index.mjs";
|
|
22
|
-
const appTools = ()=>({
|
|
22
|
+
const appTools = (options = {})=>({
|
|
23
23
|
name: '@modern-js/app-tools',
|
|
24
24
|
usePlugins: [
|
|
25
|
-
serverRuntime(),
|
|
26
25
|
compatPlugin(),
|
|
27
26
|
initialize(),
|
|
28
27
|
analyze(),
|
|
29
28
|
serverBuild(),
|
|
30
|
-
deploy()
|
|
29
|
+
deploy(),
|
|
30
|
+
createPolicyDefaultsPlugin(options)
|
|
31
31
|
],
|
|
32
32
|
post: [
|
|
33
33
|
'@modern-js/plugin-initialize',
|
|
@@ -74,6 +74,11 @@ const appTools = ()=>({
|
|
|
74
74
|
deprecatedCommands(program);
|
|
75
75
|
});
|
|
76
76
|
api.onPrepare(async ()=>{
|
|
77
|
+
api.updateAppContext({
|
|
78
|
+
deployTarget: resolveDeployTarget({
|
|
79
|
+
configTarget: api.getNormalizedConfig().deploy?.target
|
|
80
|
+
})
|
|
81
|
+
});
|
|
77
82
|
const command = getCommand();
|
|
78
83
|
if ('deploy' === command) {
|
|
79
84
|
const isSkipBuild = [
|
|
@@ -82,18 +87,12 @@ const appTools = ()=>({
|
|
|
82
87
|
].some((tag)=>getArgv().includes(tag));
|
|
83
88
|
if (isSkipBuild) return;
|
|
84
89
|
}
|
|
85
|
-
|
|
86
|
-
const shouldClean = [
|
|
90
|
+
if ([
|
|
87
91
|
'dev',
|
|
88
92
|
'start',
|
|
89
93
|
'build',
|
|
90
94
|
'deploy'
|
|
91
|
-
].includes(command)
|
|
92
|
-
'dev',
|
|
93
|
-
'start',
|
|
94
|
-
'build'
|
|
95
|
-
].includes(contextCommand);
|
|
96
|
-
if (shouldClean) {
|
|
95
|
+
].includes(command)) {
|
|
97
96
|
const resolvedConfig = api.getNormalizedConfig();
|
|
98
97
|
if (resolvedConfig.output.cleanDistPath) {
|
|
99
98
|
const appContext = api.getAppContext();
|
|
@@ -124,17 +123,10 @@ const appTools = ()=>({
|
|
|
124
123
|
await restart(api.getHooks(), filename);
|
|
125
124
|
}
|
|
126
125
|
});
|
|
127
|
-
api.onBeforeRestart(()=>{
|
|
128
|
-
cleanRequireCache([
|
|
129
|
-
require.resolve('./plugins/analyze')
|
|
130
|
-
]);
|
|
131
|
-
});
|
|
132
126
|
}
|
|
133
127
|
});
|
|
134
128
|
const src = appTools;
|
|
135
129
|
export { defineConfig } from "./defineConfig.mjs";
|
|
136
|
-
export { build } from "./commands/build.mjs";
|
|
137
|
-
export { deploy } from "./commands/deploy.mjs";
|
|
138
130
|
export { dev } from "./commands/dev.mjs";
|
|
139
131
|
export { serve } from "./commands/serve.mjs";
|
|
140
132
|
export { resolveModernRsbuildConfig } from "./rsbuild.mjs";
|
|
@@ -62,6 +62,6 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
|
|
|
62
62
|
}));
|
|
63
63
|
return scanDir(hooks, dirs);
|
|
64
64
|
} else throw Error("source.entriesDir accept a directory.");
|
|
65
|
-
throw Error(`src dir ${entriesDir} not found.`);
|
|
65
|
+
else throw Error(`src dir ${entriesDir} not found.`);
|
|
66
66
|
};
|
|
67
67
|
export { getFileSystemEntry, hasEntry, hasServerEntry };
|
|
@@ -24,7 +24,7 @@ const analyze = ()=>({
|
|
|
24
24
|
const resolvedConfig = api.getNormalizedConfig();
|
|
25
25
|
const hooks = api.getHooks();
|
|
26
26
|
try {
|
|
27
|
-
if (checkIsBuildCommands(
|
|
27
|
+
if (checkIsBuildCommands()) fs.emptydirSync(appContext.internalDirectory);
|
|
28
28
|
} catch {}
|
|
29
29
|
const apiOnly = await isApiOnly(appContext.appDirectory, resolvedConfig.source?.entriesDir, appContext.apiDirectory);
|
|
30
30
|
const [{ getProdEntrypoints, getProdServerRoutes }] = await Promise.all([
|
|
@@ -126,7 +126,7 @@ const analyze = ()=>({
|
|
|
126
126
|
htmlTemplates
|
|
127
127
|
};
|
|
128
128
|
api.updateAppContext(appContext);
|
|
129
|
-
if (checkIsBuildCommands(
|
|
129
|
+
if (checkIsBuildCommands()) {
|
|
130
130
|
await hooks.generateEntryCode.call({
|
|
131
131
|
entrypoints
|
|
132
132
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { JS_EXTENSIONS, getCommand, normalizeToPosixPath } from "@modern-js/utils";
|
|
3
|
-
import { parse } from "es-module-lexer";
|
|
3
|
+
import { init, parse } from "es-module-lexer";
|
|
4
4
|
import { transform } from "esbuild";
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import path from "path";
|
|
@@ -10,14 +10,14 @@ const walkDirectory = (dir)=>fs.readdirSync(dir).reduce((previous, filename)=>{
|
|
|
10
10
|
...previous,
|
|
11
11
|
...walkDirectory(filePath)
|
|
12
12
|
];
|
|
13
|
-
return [
|
|
13
|
+
else return [
|
|
14
14
|
...previous,
|
|
15
15
|
filePath
|
|
16
16
|
];
|
|
17
17
|
}, []);
|
|
18
18
|
const replaceWithAlias = (base, filePath, alias)=>{
|
|
19
19
|
if (filePath.includes(base)) return normalizeToPosixPath(path.join(alias, path.relative(base, filePath)));
|
|
20
|
-
return filePath;
|
|
20
|
+
else return filePath;
|
|
21
21
|
};
|
|
22
22
|
const parseModule = async ({ source, filename })=>{
|
|
23
23
|
let content = source;
|
|
@@ -36,10 +36,11 @@ const parseModule = async ({ source, filename })=>{
|
|
|
36
36
|
});
|
|
37
37
|
content = result.code;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
await init();
|
|
40
|
+
return parse(content);
|
|
40
41
|
};
|
|
41
42
|
const getServerCombinedModuleFile = (internalDirectory, entryName)=>path.join(internalDirectory, entryName, 'server-loader-combined.js');
|
|
42
|
-
const checkIsBuildCommands = (
|
|
43
|
+
const checkIsBuildCommands = ()=>{
|
|
43
44
|
const buildCommands = [
|
|
44
45
|
'dev',
|
|
45
46
|
'start',
|
|
@@ -49,8 +50,7 @@ const checkIsBuildCommands = (contextCommand)=>{
|
|
|
49
50
|
'dev-worker'
|
|
50
51
|
];
|
|
51
52
|
const command = getCommand();
|
|
52
|
-
|
|
53
|
-
return 'dev' === contextCommand || 'start' === contextCommand || 'build' === contextCommand || 'deploy' === contextCommand;
|
|
53
|
+
return buildCommands.includes(command);
|
|
54
54
|
};
|
|
55
55
|
const checkIsServeCommand = ()=>{
|
|
56
56
|
const command = getCommand();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { createCloudflarePreset } from "@modern-js/app-tools-extensions/cloudflare";
|
|
3
|
-
import {
|
|
3
|
+
import { getDeployingTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
|
|
4
4
|
import { createGhPagesPreset } from "./platforms/gh-pages.mjs";
|
|
5
5
|
import { createNetlifyPreset } from "./platforms/netlify.mjs";
|
|
6
6
|
import { createNodePreset } from "./platforms/node.mjs";
|
|
@@ -13,24 +13,11 @@ const deployPresets = {
|
|
|
13
13
|
ghPages: createGhPagesPreset,
|
|
14
14
|
cloudflare: createCloudflarePreset
|
|
15
15
|
};
|
|
16
|
-
const getSupportedDeployTargets = ()=>Object.keys(deployPresets);
|
|
17
|
-
const isDeployTarget = (target)=>Object.prototype.hasOwnProperty.call(deployPresets, target);
|
|
18
|
-
const providerDeployTargets = {
|
|
19
|
-
vercel: 'vercel',
|
|
20
|
-
netlify: 'netlify',
|
|
21
|
-
cloudflare: 'cloudflare',
|
|
22
|
-
cloudflare_pages: 'cloudflare',
|
|
23
|
-
cloudflare_workers: 'cloudflare'
|
|
24
|
-
};
|
|
25
|
-
const normalizeDetectedProvider = (value)=>value ? providerDeployTargets[value] : void 0;
|
|
26
|
-
const resolveDeployTarget = (modernConfig, envDeployTarget = process.env.MODERNJS_DEPLOY, detectedProvider = provider)=>modernConfig.deploy?.target || envDeployTarget || normalizeDetectedProvider(detectedProvider) || 'node';
|
|
27
16
|
async function getDeployPreset(appContext, modernConfig, deployTarget, api) {
|
|
28
17
|
const { appDirectory, distDirectory, metaName } = appContext;
|
|
29
18
|
const { useSSR, useAPI, useWebServer } = getProjectUsage(appDirectory, distDirectory, metaName);
|
|
30
19
|
const needModernServer = useSSR || useAPI || useWebServer;
|
|
31
|
-
|
|
32
|
-
const createPreset = deployPresets[deployTarget];
|
|
33
|
-
return createPreset({
|
|
20
|
+
return deployPresets[deployTarget]({
|
|
34
21
|
appContext,
|
|
35
22
|
modernConfig,
|
|
36
23
|
needModernServer,
|
|
@@ -42,11 +29,9 @@ const deploy = ()=>({
|
|
|
42
29
|
setup: (api)=>{
|
|
43
30
|
api.deploy(async ()=>{
|
|
44
31
|
const appContext = api.getAppContext();
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
if ('modern-js' !== metaName && !modernConfig.deploy?.target && !process.env.MODERNJS_DEPLOY) return;
|
|
49
|
-
const deployPreset = await getDeployPreset(appContext, modernConfig, deployTarget, api);
|
|
32
|
+
const deployTarget = getDeployingTarget(appContext);
|
|
33
|
+
if (!deployTarget) return;
|
|
34
|
+
const deployPreset = await getDeployPreset(appContext, api.getNormalizedConfig(), deployTarget, api);
|
|
50
35
|
deployPreset?.prepare && await deployPreset?.prepare();
|
|
51
36
|
deployPreset?.writeOutput && await deployPreset?.writeOutput();
|
|
52
37
|
deployPreset?.genEntry && await deployPreset?.genEntry();
|
|
@@ -55,4 +40,3 @@ const deploy = ()=>({
|
|
|
55
40
|
}
|
|
56
41
|
});
|
|
57
42
|
export default deploy;
|
|
58
|
-
export { getSupportedDeployTargets, resolveDeployTarget };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import node_path from "node:path";
|
|
4
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
4
5
|
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
5
6
|
import { nodeDepEmit } from "ndepe";
|
|
6
7
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
@@ -73,8 +74,8 @@ const createNetlifyPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
73
74
|
if (!needModernServer) return;
|
|
74
75
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
75
76
|
const netlifyEntry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server/netlify') : require.resolve('@modern-js/prod-server/netlify');
|
|
76
|
-
if (!entry || !netlifyEntry) throw new Error('Cannot find @modern-js/prod-server');
|
|
77
77
|
await nodeDepEmit({
|
|
78
|
+
traceFiles: traceDeployFiles,
|
|
78
79
|
appDir: appDirectory,
|
|
79
80
|
sourceDir: funcsDirectory,
|
|
80
81
|
includeEntries: [
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
import node_path from "node:path";
|
|
5
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
4
6
|
import { chalk, fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
5
7
|
import { nodeDepEmit } from "ndepe";
|
|
6
8
|
import { readTemplate, resolveESMDependency } from "../utils/index.mjs";
|
|
7
9
|
import { generateHandler } from "../utils/generator.mjs";
|
|
8
10
|
const createNodePreset = ({ appContext, modernConfig })=>{
|
|
9
|
-
const { appDirectory, distDirectory, moduleType } = appContext;
|
|
11
|
+
const { appDirectory, distDirectory, moduleType, serverPlugins } = appContext;
|
|
10
12
|
const isEsmProject = 'module' === moduleType;
|
|
11
13
|
const outputDirectory = node_path.join(appDirectory, '.output');
|
|
12
14
|
const staticDirectory = node_path.join(outputDirectory, 'static');
|
|
@@ -36,12 +38,19 @@ const createNodePreset = ({ appContext, modernConfig })=>{
|
|
|
36
38
|
async end () {
|
|
37
39
|
const filter = (filePath)=>!filePath.startsWith(staticDirectory) && !filePath.endsWith('.map');
|
|
38
40
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
39
|
-
|
|
41
|
+
const requireFromApp = createRequire(node_path.join(appDirectory, 'package.json'));
|
|
42
|
+
const pluginEntries = new Set();
|
|
43
|
+
for (const plugin of serverPlugins)for (const specifier of plugin.includeEntries ?? []){
|
|
44
|
+
pluginEntries.add(requireFromApp.resolve(specifier));
|
|
45
|
+
if (isEsmProject) pluginEntries.add(await resolveESMDependency(specifier, appDirectory));
|
|
46
|
+
}
|
|
40
47
|
await nodeDepEmit({
|
|
48
|
+
traceFiles: traceDeployFiles,
|
|
41
49
|
appDir: appDirectory,
|
|
42
50
|
sourceDir: outputDirectory,
|
|
43
51
|
includeEntries: [
|
|
44
|
-
entry
|
|
52
|
+
entry,
|
|
53
|
+
...pluginEntries
|
|
45
54
|
],
|
|
46
55
|
copyWholePackage (pkgName) {
|
|
47
56
|
return '@modern-js/utils' === pkgName;
|
|
@@ -35,10 +35,11 @@ async function main() {
|
|
|
35
35
|
const app = await createProdServer(prodServerOptions);
|
|
36
36
|
const port = process.env.PORT || 8080;
|
|
37
37
|
app.listen({
|
|
38
|
-
host: '::',
|
|
39
38
|
port
|
|
40
39
|
}, ()=>{
|
|
41
|
-
|
|
40
|
+
const address = app.address();
|
|
41
|
+
const loopback = 'IPv6' === address.family ? '[::1]' : '127.0.0.1';
|
|
42
|
+
console.log(`\x1b[32mServer is listening on http://${loopback}:${address.port}`, '\x1b[0m');
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
main();
|
|
@@ -37,10 +37,11 @@ async function main() {
|
|
|
37
37
|
const app = await createProdServer(prodServerOptions);
|
|
38
38
|
const port = process.env.PORT || 8080;
|
|
39
39
|
app.listen({
|
|
40
|
-
host: '::',
|
|
41
40
|
port
|
|
42
41
|
}, ()=>{
|
|
43
|
-
|
|
42
|
+
const address = app.address();
|
|
43
|
+
const loopback = 'IPv6' === address.family ? '[::1]' : '127.0.0.1';
|
|
44
|
+
console.log(`\x1b[32mServer is listening on http://${loopback}:${address.port}`, '\x1b[0m');
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
main();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
3
|
import node_path from "node:path";
|
|
4
|
+
import { traceDeployFiles } from "@modern-js/app-tools-extensions/deploy-output/trace-files";
|
|
4
5
|
import { fs, removeModuleSyncFromExports } from "@modern-js/utils";
|
|
5
6
|
import { nodeDepEmit } from "ndepe";
|
|
6
7
|
import { isMainEntry } from "../../../utils/routes.mjs";
|
|
@@ -93,8 +94,8 @@ const createVercelPreset = ({ appContext, modernConfig, needModernServer })=>{
|
|
|
93
94
|
async end () {
|
|
94
95
|
if (!needModernServer) return;
|
|
95
96
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
96
|
-
if (!entry) throw new Error('Cannot find @modern-js/prod-server');
|
|
97
97
|
await nodeDepEmit({
|
|
98
|
+
traceFiles: traceDeployFiles,
|
|
98
99
|
appDir: appDirectory,
|
|
99
100
|
sourceDir: funcsDirectory,
|
|
100
101
|
includeEntries: [
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import { ROUTE_SPEC_FILE, SERVER_DIR, fs, getMeta } from "@modern-js/utils";
|
|
4
|
+
import { moduleResolve } from "import-meta-resolve";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
7
7
|
import { dirname as __rspack_dirname } from "node:path";
|
|
8
8
|
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
9
|
-
var __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
|
|
10
9
|
const normalizePath = (filePath)=>filePath.replace(/\\/g, '/');
|
|
11
10
|
const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
12
11
|
const routeJSON = path.join(distDirectory, ROUTE_SPEC_FILE);
|
|
@@ -31,17 +30,20 @@ const getProjectUsage = (appDirectory, distDirectory, metaName)=>{
|
|
|
31
30
|
};
|
|
32
31
|
const getTemplatePath = (file)=>path.join(__rspack_import_meta_dirname__, '../platforms/templates', file);
|
|
33
32
|
const readTemplate = async (file)=>(await fs.readFile(getTemplatePath(file))).toString();
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
const DEPLOY_CONDITIONS = [
|
|
34
|
+
'node',
|
|
35
|
+
'import',
|
|
36
|
+
'module',
|
|
37
|
+
'default'
|
|
38
|
+
];
|
|
39
|
+
const resolveESMDependency = async (entry, fromDirectory)=>{
|
|
40
|
+
const base = fromDirectory ? pathToFileURL(path.join(fromDirectory, 'package.json')) : pathToFileURL(`${__rspack_import_meta_dirname__}/`);
|
|
41
41
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
return normalizePath(fileURLToPath(moduleResolve(entry, base, new Set(DEPLOY_CONDITIONS), false)));
|
|
43
|
+
} catch (cause) {
|
|
44
|
+
throw new Error(`Cannot resolve "${entry}" with conditions [${DEPLOY_CONDITIONS.join(', ')}] from ${base.href}: ${cause.message}`, {
|
|
45
|
+
cause
|
|
46
|
+
});
|
|
47
|
+
}
|
|
46
48
|
};
|
|
47
49
|
export { getProjectUsage, getTemplatePath, normalizePath, readTemplate, resolveESMDependency };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
3
|
+
import { buildDefaultLazyCompilationTest } from "../../builder/shared/lazyCompilation.mjs";
|
|
3
4
|
import { createDefaultConfig, isLazyCompilationSafeByDefault } from "../../config/index.mjs";
|
|
4
5
|
const initialize = ()=>({
|
|
5
6
|
name: '@modern-js/plugin-initialize',
|
|
@@ -18,7 +19,8 @@ const initialize = ()=>({
|
|
|
18
19
|
...defaultConfig.dev,
|
|
19
20
|
lazyCompilation: {
|
|
20
21
|
imports: true,
|
|
21
|
-
entries: false
|
|
22
|
+
entries: false,
|
|
23
|
+
test: buildDefaultLazyCompilationTest(appContext.appDirectory, appContext.internalDirectory)
|
|
22
24
|
}
|
|
23
25
|
};
|
|
24
26
|
return defaultConfig;
|
|
@@ -26,7 +28,7 @@ const initialize = ()=>({
|
|
|
26
28
|
api.modifyResolvedConfig(async (resolved)=>{
|
|
27
29
|
let appContext = api.getAppContext();
|
|
28
30
|
const userConfig = api.getConfig();
|
|
29
|
-
const port = await getServerPort(resolved
|
|
31
|
+
const port = await getServerPort(resolved);
|
|
30
32
|
appContext = {
|
|
31
33
|
...appContext,
|
|
32
34
|
port,
|
|
@@ -61,10 +63,9 @@ function stabilizeConfig(resolve, config, keys) {
|
|
|
61
63
|
resolve[key] = config[key] || {};
|
|
62
64
|
});
|
|
63
65
|
}
|
|
64
|
-
async function getServerPort(config
|
|
66
|
+
async function getServerPort(config) {
|
|
65
67
|
const prodPort = Number(process.env.PORT) || config.server.port || 8080;
|
|
66
|
-
|
|
67
|
-
if (isDev() && (isDevCommand() || isProgrammaticDev)) return getPort(Number(process.env.PORT) || prodPort);
|
|
68
|
+
if (isDev() && isDevCommand()) return getPort(Number(process.env.PORT) || prodPort);
|
|
68
69
|
return prodPort;
|
|
69
70
|
}
|
|
70
71
|
export default initialize;
|
|
@@ -30,10 +30,8 @@ const serverBuild = ()=>({
|
|
|
30
30
|
sourceDirs.push(serverDir);
|
|
31
31
|
if (fs.existsSync(sharedDir)) sourceDirs.push(sharedDir);
|
|
32
32
|
}
|
|
33
|
-
const { server } = modernConfig;
|
|
34
33
|
const { alias } = modernConfig.source;
|
|
35
34
|
if (sourceDirs.length > 0) await compile(appDirectory, {
|
|
36
|
-
server,
|
|
37
35
|
alias
|
|
38
36
|
}, {
|
|
39
37
|
sourceDirs,
|
|
@@ -8,21 +8,21 @@ import { loadInternalPlugins } from "../utils/loadPlugins.mjs";
|
|
|
8
8
|
async function createRunOptions({ cwd, initialLog, metaName = 'modern-js', version, internalPlugins, configFile }) {
|
|
9
9
|
const nodeVersion = process.versions.node;
|
|
10
10
|
const versionArr = nodeVersion.split('.').map(Number);
|
|
11
|
-
if (versionArr[0] < 26 || 26 === versionArr[0] && versionArr[1] <
|
|
11
|
+
if (versionArr[0] < 26 || 26 === versionArr[0] && versionArr[1] < 10) throw new Error(`
|
|
12
12
|
${chalk.bgRed.white.bold(' UNSUPPORTED NODE.JS RUNTIME ')}
|
|
13
13
|
|
|
14
|
-
${chalk.red.bold(`UltraModern.js requires Node.js >=26.
|
|
14
|
+
${chalk.red.bold(`UltraModern.js requires Node.js >=26.10.0; detected v${nodeVersion}.`)}
|
|
15
15
|
${chalk.red('- Legacy Node runtimes and TypeScript transpiler fallbacks are unsupported.')}
|
|
16
16
|
|
|
17
17
|
${chalk.yellow('▸ Detected Runtime:')} ${chalk.yellow.bold(`Node.js v${nodeVersion}`)}
|
|
18
|
-
${chalk.green('▸ Required Minimum:')} ${chalk.green.bold('Node.js v26.
|
|
19
|
-
${chalk.green('▸ Pinned Runtime:')} ${chalk.green.bold('Node.js v26.
|
|
18
|
+
${chalk.green('▸ Required Minimum:')} ${chalk.green.bold('Node.js v26.10.0 or higher')}
|
|
19
|
+
${chalk.green('▸ Pinned Runtime:')} ${chalk.green.bold('Node.js v26.10.0')}
|
|
20
20
|
|
|
21
21
|
${chalk.cyan('Immediate Action Required:')}
|
|
22
22
|
${chalk.gray('├──')} ${chalk.yellow('Recommended Upgrade')}
|
|
23
23
|
${chalk.bold('mise install && mise exec -- node --version')}
|
|
24
24
|
${chalk.gray('├──')} ${chalk.yellow('Manual Installation')}
|
|
25
|
-
${chalk.underline('https://nodejs.org/download/release/v26.
|
|
25
|
+
${chalk.underline('https://nodejs.org/download/release/v26.10.0/')}
|
|
26
26
|
${chalk.gray('└──')} ${chalk.yellow('Environment Verification')}
|
|
27
27
|
${chalk.bold('node -v && npm -v')}
|
|
28
28
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
2
|
+
import { fs, ip } from "@modern-js/utils";
|
|
3
3
|
import path from "path";
|
|
4
4
|
function isSymlinkedNodeModules(appDirectory) {
|
|
5
5
|
try {
|
|
@@ -18,7 +18,7 @@ const initAppContext = ({ metaName, appDirectory, runtimeConfigFile, options, te
|
|
|
18
18
|
const moduleType = fs.existsSync(pkgPath) ? fs.readJSONSync(pkgPath).type || 'commonjs' : 'commonjs';
|
|
19
19
|
return {
|
|
20
20
|
runtimeConfigFile,
|
|
21
|
-
ip:
|
|
21
|
+
ip: ip(),
|
|
22
22
|
port: 0,
|
|
23
23
|
moduleType,
|
|
24
24
|
apiDirectory: path.resolve(appDirectory, apiDir),
|