@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.2 → 3.9.0-ultramodern.21
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/generator/createCopyPattern.js +2 -1
- package/dist/cjs/builder/generator/index.js +0 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/index.js +4 -11
- package/dist/cjs/builder/shared/lazyCompilation.js +26 -0
- package/dist/cjs/commands/index.js +6 -2
- package/dist/cjs/compat/hooks.js +1 -1
- package/dist/cjs/config/index.js +4 -11
- package/dist/cjs/index.js +70 -87
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +1 -1
- package/dist/cjs/plugins/analyze/getServerRoutes.js +1 -1
- package/dist/cjs/plugins/analyze/utils.js +2 -2
- 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 -16
- package/dist/cjs/plugins/deploy/platforms/vercel.js +2 -1
- package/dist/cjs/plugins/deploy/utils/generator.js +1 -1
- package/dist/cjs/plugins/deploy/utils/index.js +15 -12
- package/dist/cjs/plugins/initialize/index.js +3 -1
- package/dist/cjs/plugins/serverBuild.js +2 -3
- package/dist/cjs/{plugins/backendFederationBuild.js → server-plugin.js} +4 -7
- package/dist/cjs/utils/loadPlugins.js +1 -6
- package/dist/esm/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm/builder/generator/index.mjs +1 -2
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm/commands/index.mjs +6 -2
- package/dist/esm/compat/hooks.mjs +1 -1
- package/dist/esm/config/index.mjs +0 -1
- package/dist/esm/index.mjs +9 -6
- package/dist/esm/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm/plugins/analyze/utils.mjs +2 -2
- 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 -16
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm/plugins/deploy/utils/generator.mjs +1 -1
- package/dist/esm/plugins/deploy/utils/index.mjs +17 -14
- package/dist/esm/plugins/initialize/index.mjs +3 -1
- package/dist/esm/plugins/serverBuild.mjs +2 -3
- package/dist/esm/server-plugin.mjs +1 -0
- package/dist/esm/utils/loadPlugins.mjs +2 -7
- package/dist/esm-node/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm-node/builder/generator/index.mjs +1 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm-node/commands/index.mjs +6 -2
- package/dist/esm-node/compat/hooks.mjs +1 -1
- package/dist/esm-node/config/index.mjs +0 -1
- package/dist/esm-node/index.mjs +9 -6
- 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/utils.mjs +2 -2
- 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 -16
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm-node/plugins/deploy/utils/generator.mjs +1 -1
- package/dist/esm-node/plugins/deploy/utils/index.mjs +17 -15
- package/dist/esm-node/plugins/initialize/index.mjs +3 -1
- package/dist/esm-node/plugins/serverBuild.mjs +2 -3
- package/dist/esm-node/server-plugin.mjs +2 -0
- package/dist/esm-node/utils/loadPlugins.mjs +2 -7
- package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
- package/dist/types/builder/shared/lazyCompilation.d.ts +15 -0
- package/dist/types/config/index.d.ts +0 -1
- package/dist/types/index.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/server-plugin.d.ts +10 -0
- package/dist/types/types/config/output.d.ts +0 -9
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/plugin.d.ts +58 -2
- package/dist/types/utils/initAppContext.d.ts +3 -2
- package/docs/apis/app/commands.md +1 -0
- package/docs/configure/app/bff/effect.md +34 -36
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/guides/advanced-features/bff/data-platform.md +2 -2
- package/docs/guides/advanced-features/bff/frameworks.md +36 -24
- package/docs/guides/advanced-features/bff/function.md +2 -2
- package/docs/guides/advanced-features/bff/operators.md +17 -17
- package/docs/guides/basic-features/render/ssr-cache.md +14 -1
- package/docs/guides/get-started/quick-start.md +2 -6
- package/docs/guides/get-started/ultramodern.md +14 -97
- package/docs/llms.txt +3 -3
- package/docs/plugin/server-plugins/api.md +1 -0
- package/package.json +38 -36
- package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +0 -125
- package/dist/cjs/config/build-environment.js +0 -268
- package/dist/cjs/config/public.js +0 -46
- package/dist/cjs/plugins/backend-federation/codegen.js +0 -256
- package/dist/cjs/plugins/backend-federation/config.js +0 -204
- package/dist/cjs/plugins/backend-federation/emit.js +0 -150
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +0 -62
- package/dist/cjs/plugins/deploy/utils/npmAliases.js +0 -226
- package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +0 -44
- package/dist/cjs/presetUltramodern.js +0 -168
- package/dist/cjs/types/config/precompress.js +0 -18
- package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -77
- package/dist/esm/config/build-environment.mjs +0 -224
- package/dist/esm/config/public.mjs +0 -1
- package/dist/esm/plugins/backend-federation/codegen.mjs +0 -205
- package/dist/esm/plugins/backend-federation/config.mjs +0 -128
- package/dist/esm/plugins/backend-federation/emit.mjs +0 -99
- package/dist/esm/plugins/backendFederationBuild.mjs +0 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -1
- package/dist/esm/plugins/deploy/utils/npmAliases.mjs +0 -174
- package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +0 -6
- package/dist/esm/presetUltramodern.mjs +0 -112
- package/dist/esm/types/config/precompress.mjs +0 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -78
- package/dist/esm-node/config/build-environment.mjs +0 -225
- package/dist/esm-node/config/public.mjs +0 -2
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +0 -206
- package/dist/esm-node/plugins/backend-federation/config.mjs +0 -129
- package/dist/esm-node/plugins/backend-federation/emit.mjs +0 -100
- package/dist/esm-node/plugins/backendFederationBuild.mjs +0 -2
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -2
- package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +0 -175
- package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +0 -7
- package/dist/esm-node/presetUltramodern.mjs +0 -113
- package/dist/esm-node/types/config/precompress.mjs +0 -1
- package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +0 -3
- package/dist/types/config/build-environment.d.ts +0 -22
- package/dist/types/config/public.d.ts +0 -2
- package/dist/types/plugins/backend-federation/codegen.d.ts +0 -86
- package/dist/types/plugins/backend-federation/config.d.ts +0 -103
- package/dist/types/plugins/backend-federation/emit.d.ts +0 -13
- package/dist/types/plugins/backendFederationBuild.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +0 -1
- package/dist/types/plugins/deploy/utils/npmAliases.d.ts +0 -14
- package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +0 -3
- package/dist/types/presetUltramodern.d.ts +0 -87
- package/dist/types/types/config/precompress.d.ts +0 -20
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
2
|
+
import { buildDefaultLazyCompilationTest } from "../../builder/shared/lazyCompilation.mjs";
|
|
2
3
|
import { createDefaultConfig, isLazyCompilationSafeByDefault } from "../../config/index.mjs";
|
|
3
4
|
const initialize = ()=>({
|
|
4
5
|
name: '@modern-js/plugin-initialize',
|
|
@@ -17,7 +18,8 @@ const initialize = ()=>({
|
|
|
17
18
|
...defaultConfig.dev,
|
|
18
19
|
lazyCompilation: {
|
|
19
20
|
imports: true,
|
|
20
|
-
entries: false
|
|
21
|
+
entries: false,
|
|
22
|
+
test: buildDefaultLazyCompilationTest(appContext.appDirectory, appContext.internalDirectory)
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
return defaultConfig;
|
|
@@ -29,16 +29,15 @@ const serverBuild = ()=>({
|
|
|
29
29
|
sourceDirs.push(serverDir);
|
|
30
30
|
if (fs.existsSync(sharedDir)) sourceDirs.push(sharedDir);
|
|
31
31
|
}
|
|
32
|
-
const { server } = modernConfig;
|
|
33
32
|
const { alias } = modernConfig.source;
|
|
34
33
|
if (sourceDirs.length > 0) await compile(appDirectory, {
|
|
35
|
-
server,
|
|
36
34
|
alias
|
|
37
35
|
}, {
|
|
38
36
|
sourceDirs,
|
|
39
37
|
distDir,
|
|
40
38
|
tsconfigPath,
|
|
41
|
-
moduleType
|
|
39
|
+
moduleType,
|
|
40
|
+
excludeFiles: api.getAppContext().serverCompileExcludedFiles
|
|
42
41
|
});
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@modern-js/server-runtime-extensions/server-plugin";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadServerPlugins } from "@modern-js/server-core/node";
|
|
2
|
-
import { compatibleRequire, createDebugger,
|
|
2
|
+
import { compatibleRequire, createDebugger, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
3
3
|
const debug = createDebugger('load-plugins');
|
|
4
4
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
5
5
|
const hooks = api.getHooks();
|
|
@@ -21,12 +21,7 @@ const resolveCliPlugin = async (p, appDirectory)=>{
|
|
|
21
21
|
const pkg = 'string' == typeof p ? p : p[0];
|
|
22
22
|
const pluginOptions = 'string' == typeof p ? void 0 : p[1];
|
|
23
23
|
const path = tryResolve(pkg, appDirectory);
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
module = await compatibleRequire(path);
|
|
27
|
-
} catch (e) {
|
|
28
|
-
({ default: module } = await dynamicImport(path));
|
|
29
|
-
}
|
|
24
|
+
const module = await compatibleRequire(path);
|
|
30
25
|
if ('function' == typeof module) {
|
|
31
26
|
const result = module(pluginOptions);
|
|
32
27
|
return result;
|
|
@@ -15,7 +15,8 @@ function createPublicPattern(appContext, config, chain) {
|
|
|
15
15
|
noErrorOnMissing: true,
|
|
16
16
|
transform: (content, absoluteFrom)=>{
|
|
17
17
|
if (!/\.html?$/.test(absoluteFrom)) return content;
|
|
18
|
-
|
|
18
|
+
const publicPath = chain.output.get('publicPath');
|
|
19
|
+
return content.toString('utf8').replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash('string' == typeof publicPath ? publicPath : ''));
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { createBuilder } from "@modern-js/builder";
|
|
3
3
|
import { mergeRsbuildConfig } from "@rsbuild/core";
|
|
4
|
-
import { builderPluginAdapterBasic, builderPluginAdapterHooks, builderPluginAdapterHtml,
|
|
4
|
+
import { builderPluginAdapterBasic, builderPluginAdapterHooks, builderPluginAdapterHtml, builderPluginAdapterSSR } from "../shared/builderPlugins/index.mjs";
|
|
5
5
|
import { builderPluginAdapterCopy } from "./adapterCopy.mjs";
|
|
6
6
|
import { createBuilderProviderConfig } from "./createBuilderProviderConfig.mjs";
|
|
7
7
|
import { getBuilderEnvironments } from "./getBuilderEnvironments.mjs";
|
|
@@ -41,7 +41,6 @@ async function applyBuilderPlugins(builder, options) {
|
|
|
41
41
|
builderPluginAdapterBasic(options),
|
|
42
42
|
builderPluginAdapterSSR(options),
|
|
43
43
|
builderPluginAdapterHtml(options),
|
|
44
|
-
builderPluginAdapterPrecompress(options),
|
|
45
44
|
builderPluginAdapterHooks(options)
|
|
46
45
|
]);
|
|
47
46
|
builder.addPlugins([
|
|
@@ -27,7 +27,8 @@ const builderPluginAdapterHtml = (options)=>({
|
|
|
27
27
|
async function injectAssetPrefix({ chain }) {
|
|
28
28
|
const entries = chain.entryPoints.entries() || {};
|
|
29
29
|
const entryNames = Object.keys(entries);
|
|
30
|
-
const
|
|
30
|
+
const publicPath = chain.output.get('publicPath');
|
|
31
|
+
const assetPrefix = removeTailSlash('string' == typeof publicPath ? publicPath : '');
|
|
31
32
|
const code = `window.__assetPrefix__ = '${assetPrefix}';`;
|
|
32
33
|
entryNames.forEach((entryName)=>{
|
|
33
34
|
entries[entryName].prepend(createVirtualModule(code));
|
|
@@ -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 };
|
|
@@ -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,7 @@ 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)=>{
|
|
23
27
|
const { deploy } = await import("./deploy.mjs");
|
|
24
28
|
await deploy(api, options);
|
|
25
29
|
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
|
});
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -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
|
-
import {
|
|
3
|
+
import { resolveDeployTarget } from "@modern-js/app-tools-extensions/deploy-output/target";
|
|
4
|
+
import { createPolicyDefaultsPlugin } from "@modern-js/app-tools-extensions/policy-defaults";
|
|
4
5
|
import { castArray } from "@modern-js/builder";
|
|
5
6
|
import { getLocaleLanguage } from "@modern-js/i18n-utils/language-detector";
|
|
6
7
|
import { createAsyncHook } from "@modern-js/plugin";
|
|
@@ -11,7 +12,6 @@ import { compatPlugin } from "./compat/index.mjs";
|
|
|
11
12
|
import { DEFAULT_RUNTIME_CONFIG_FILE } from "./constants.mjs";
|
|
12
13
|
import { i18n } from "./locale/index.mjs";
|
|
13
14
|
import analyze from "./plugins/analyze/index.mjs";
|
|
14
|
-
import backendFederationBuild from "./plugins/backendFederationBuild.mjs";
|
|
15
15
|
import deploy from "./plugins/deploy/index.mjs";
|
|
16
16
|
import initialize from "./plugins/initialize/index.mjs";
|
|
17
17
|
import serverBuild from "./plugins/serverBuild.mjs";
|
|
@@ -20,9 +20,8 @@ import { generateWatchFiles } from "./utils/generateWatchFiles.mjs";
|
|
|
20
20
|
import { initAppContext } from "./utils/initAppContext.mjs";
|
|
21
21
|
import { restart } from "./utils/restart.mjs";
|
|
22
22
|
export * from "./defineConfig.mjs";
|
|
23
|
-
export * from "./presetUltramodern.mjs";
|
|
24
23
|
export * from "./types/index.mjs";
|
|
25
|
-
const appTools = ()=>({
|
|
24
|
+
const appTools = (options = {})=>({
|
|
26
25
|
name: '@modern-js/app-tools',
|
|
27
26
|
usePlugins: [
|
|
28
27
|
serverRuntime(),
|
|
@@ -30,9 +29,8 @@ const appTools = ()=>({
|
|
|
30
29
|
initialize(),
|
|
31
30
|
analyze(),
|
|
32
31
|
serverBuild(),
|
|
33
|
-
backendFederationBuild(),
|
|
34
32
|
deploy(),
|
|
35
|
-
|
|
33
|
+
createPolicyDefaultsPlugin(options)
|
|
36
34
|
],
|
|
37
35
|
post: [
|
|
38
36
|
'@modern-js/plugin-initialize',
|
|
@@ -79,6 +77,11 @@ const appTools = ()=>({
|
|
|
79
77
|
deprecatedCommands(program);
|
|
80
78
|
});
|
|
81
79
|
api.onPrepare(async ()=>{
|
|
80
|
+
api.updateAppContext({
|
|
81
|
+
deployTarget: resolveDeployTarget({
|
|
82
|
+
configTarget: api.getNormalizedConfig().deploy?.target
|
|
83
|
+
})
|
|
84
|
+
});
|
|
82
85
|
const command = getCommand();
|
|
83
86
|
if ('deploy' === command) {
|
|
84
87
|
const isSkipBuild = [
|
|
@@ -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 };
|
|
@@ -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;
|
|
@@ -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,13 +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
|
-
import { preserveNpmAliases, readPackageIdentity } from "../utils/npmAliases.mjs";
|
|
9
10
|
const createNodePreset = ({ appContext, modernConfig })=>{
|
|
10
|
-
const { appDirectory, distDirectory, moduleType } = appContext;
|
|
11
|
+
const { appDirectory, distDirectory, moduleType, serverPlugins } = appContext;
|
|
11
12
|
const isEsmProject = 'module' === moduleType;
|
|
12
13
|
const outputDirectory = node_path.join(appDirectory, '.output');
|
|
13
14
|
const staticDirectory = node_path.join(outputDirectory, 'static');
|
|
@@ -37,13 +38,19 @@ const createNodePreset = ({ appContext, modernConfig })=>{
|
|
|
37
38
|
async end () {
|
|
38
39
|
const filter = (filePath)=>!filePath.startsWith(staticDirectory) && !filePath.endsWith('.map');
|
|
39
40
|
const entry = isEsmProject ? await resolveESMDependency('@modern-js/prod-server') : require.resolve('@modern-js/prod-server');
|
|
40
|
-
|
|
41
|
-
const
|
|
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
|
+
}
|
|
42
47
|
await nodeDepEmit({
|
|
48
|
+
traceFiles: traceDeployFiles,
|
|
43
49
|
appDir: appDirectory,
|
|
44
50
|
sourceDir: outputDirectory,
|
|
45
51
|
includeEntries: [
|
|
46
|
-
entry
|
|
52
|
+
entry,
|
|
53
|
+
...pluginEntries
|
|
47
54
|
],
|
|
48
55
|
copyWholePackage (pkgName) {
|
|
49
56
|
return '@modern-js/utils' === pkgName;
|
|
@@ -57,17 +64,6 @@ const createNodePreset = ({ appContext, modernConfig })=>{
|
|
|
57
64
|
};
|
|
58
65
|
}
|
|
59
66
|
});
|
|
60
|
-
await preserveNpmAliases({
|
|
61
|
-
appDirectory,
|
|
62
|
-
outputDirectory,
|
|
63
|
-
implicitAliases: [
|
|
64
|
-
{
|
|
65
|
-
aliasName: '@modern-js/prod-server',
|
|
66
|
-
targetName: prodServerPackage.name,
|
|
67
|
-
targetVersion: prodServerPackage.version
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
});
|
|
71
67
|
console.log('Static directory:', chalk.blue(node_path.relative(appDirectory, staticDirectory).replace(/\\/g, '/')));
|
|
72
68
|
console.log("You can preview this build by", chalk.blue('node .output/index'));
|
|
73
69
|
}
|
|
@@ -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: [
|
|
@@ -16,7 +16,7 @@ const serverAppContextTemplate = (appContext)=>{
|
|
|
16
16
|
};
|
|
17
17
|
const genPluginImportsCode = (plugins, isESM = false)=>plugins.map(([name, options], index)=>{
|
|
18
18
|
const im = isESM ? `import * as plugin_${index}_ns from '${name}'` : `const plugin_${index}_ns = require('${name}')`;
|
|
19
|
-
return `${im};const plugin_${index} = plugin_${index}_ns.default
|
|
19
|
+
return `${im};const plugin_${index} = typeof plugin_${index}_ns === 'function' ? plugin_${index}_ns : typeof plugin_${index}_ns.default === 'function' ? plugin_${index}_ns.default : plugin_${index}_ns.default?.default`;
|
|
20
20
|
}).join(';\n');
|
|
21
21
|
const getPluginsCode = (plugins)=>`[${plugins.map(([, options], index)=>`plugin_${index}(${options ? JSON.stringify(options) : ''})`).join(',')}]`;
|
|
22
22
|
const getServerConfigPath = (meta)=>`path.join(__dirname, "${SERVER_DIR}", "${meta}.server")`;
|
|
@@ -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;
|
|
@@ -30,16 +30,15 @@ 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,
|
|
40
38
|
distDir,
|
|
41
39
|
tsconfigPath,
|
|
42
|
-
moduleType
|
|
40
|
+
moduleType,
|
|
41
|
+
excludeFiles: api.getAppContext().serverCompileExcludedFiles
|
|
43
42
|
});
|
|
44
43
|
});
|
|
45
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { loadServerPlugins } from "@modern-js/server-core/node";
|
|
3
|
-
import { compatibleRequire, createDebugger,
|
|
3
|
+
import { compatibleRequire, createDebugger, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
4
4
|
const debug = createDebugger('load-plugins');
|
|
5
5
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
6
6
|
const hooks = api.getHooks();
|
|
@@ -22,12 +22,7 @@ const resolveCliPlugin = async (p, appDirectory)=>{
|
|
|
22
22
|
const pkg = 'string' == typeof p ? p : p[0];
|
|
23
23
|
const pluginOptions = 'string' == typeof p ? void 0 : p[1];
|
|
24
24
|
const path = tryResolve(pkg, appDirectory);
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
module = await compatibleRequire(path);
|
|
28
|
-
} catch (e) {
|
|
29
|
-
({ default: module } = await dynamicImport(path));
|
|
30
|
-
}
|
|
25
|
+
const module = await compatibleRequire(path);
|
|
31
26
|
if ('function' == typeof module) {
|
|
32
27
|
const result = module(pluginOptions);
|
|
33
28
|
return result;
|
|
@@ -26,6 +26,21 @@ export declare function aggregateEagerRouteComponentFiles(byEntry: EagerRouteCom
|
|
|
26
26
|
* (defaulting to lazy when the user did not provide one).
|
|
27
27
|
*/
|
|
28
28
|
export declare function buildSSRLazyCompilationTest(eagerRouteFiles: Set<string>, userTest?: LazyCompilationTest): LazyCompilationTestFn;
|
|
29
|
+
/**
|
|
30
|
+
* Build the default dev `lazyCompilation.test`: a dynamic import is lazy only
|
|
31
|
+
* when it targets the app's own source. Everything else compiles eagerly:
|
|
32
|
+
* - the generated `<internalDirectory>/<entry>/index.jsx`, which
|
|
33
|
+
* `bootstrap.jsx` imports as the async entry boundary Module Federation
|
|
34
|
+
* needs to initialize shared scopes, not a code-split point;
|
|
35
|
+
* - framework and dependency modules (outside `appDirectory` or under
|
|
36
|
+
* `node_modules`), such as plugin-i18n's backend, utils and react-i18next.
|
|
37
|
+
* Each lazy module costs one on-demand compile and HMR cycle on the first page
|
|
38
|
+
* load. Back-to-back cycles for framework imports raced on loaded CI runners
|
|
39
|
+
* ("Cannot read properties of undefined (reading 'call')"), and the app never
|
|
40
|
+
* rendered.
|
|
41
|
+
* Typed `object` so it is assignable to Rspack's `(module: Module) => boolean`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildDefaultLazyCompilationTest(appDirectory: string, internalDirectory: string): (m: object) => boolean;
|
|
29
44
|
export type SSRLazyPlan = {
|
|
30
45
|
apply: false;
|
|
31
46
|
unresolvedByEntry?: Map<string, string[]>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { type PolicyDefaultsOptions } from '@modern-js/app-tools-extensions/policy-defaults';
|
|
1
2
|
import type { AppTools, CliPlugin } from './types/index.js';
|
|
2
3
|
import { initAppContext } from './utils/initAppContext.js';
|
|
3
4
|
export * from './defineConfig.js';
|
|
4
|
-
export
|
|
5
|
-
export declare const appTools: () => CliPlugin<AppTools>;
|
|
5
|
+
export declare const appTools: (options?: PolicyDefaultsOptions) => CliPlugin<AppTools>;
|
|
6
6
|
export { build } from './commands/build.js';
|
|
7
7
|
export { deploy } from './commands/deploy.js';
|
|
8
8
|
export { dev } from './commands/dev.js';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { AppTools,
|
|
2
|
-
import type { DeployTarget } from '../../types/config/deploy.js';
|
|
3
|
-
export declare const getSupportedDeployTargets: () => DeployTarget[];
|
|
4
|
-
export declare const resolveDeployTarget: (modernConfig: AppToolsNormalizedConfig, envDeployTarget?: string | undefined, detectedProvider?: import("std-env").ProviderName) => string;
|
|
1
|
+
import type { AppTools, CliPlugin } from '../../types/index.js';
|
|
5
2
|
export default _default;
|
|
6
3
|
declare function _default(): CliPlugin<AppTools>;
|
|
@@ -6,7 +6,7 @@ export declare const serverAppContextTemplate: (appContext: AppToolsContext) =>
|
|
|
6
6
|
apiDirectory: string;
|
|
7
7
|
lambdaDirectory: string;
|
|
8
8
|
metaName: string;
|
|
9
|
-
bffRuntimeFramework:
|
|
9
|
+
bffRuntimeFramework: keyof import("@modern-js/plugin/server").BffRuntimeRegistry;
|
|
10
10
|
};
|
|
11
11
|
export type PluginItem = [string, Record<string, any> | undefined];
|
|
12
12
|
export declare const genPluginImportsCode: (plugins: PluginItem[], isESM?: boolean) => string;
|
|
@@ -13,4 +13,4 @@ export declare const getProjectUsage: (appDirectory: string, distDirectory: stri
|
|
|
13
13
|
};
|
|
14
14
|
export declare const getTemplatePath: (file: string) => string;
|
|
15
15
|
export declare const readTemplate: (file: string) => Promise<string>;
|
|
16
|
-
export declare const resolveESMDependency: (entry: string) => Promise<string
|
|
16
|
+
export declare const resolveESMDependency: (entry: string, fromDirectory?: string) => Promise<string>;
|