@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,13 +1,14 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import node_path from "node:path";
|
|
2
3
|
import { loadServerPlugins } from "@modern-js/server-core/node";
|
|
3
|
-
import { compatibleRequire, createDebugger,
|
|
4
|
+
import { compatibleRequire, createDebugger, getInternalPlugins, tryResolve } from "@modern-js/utils";
|
|
4
5
|
const debug = createDebugger('load-plugins');
|
|
5
6
|
async function getServerPlugins(api, metaName = 'modern-js') {
|
|
6
7
|
const hooks = api.getHooks();
|
|
7
8
|
const { plugins } = await hooks._internalServerPlugins.call({
|
|
8
9
|
plugins: []
|
|
9
10
|
});
|
|
10
|
-
const filtedPlugins = plugins.filter((plugin)=>plugin.name.includes(metaName));
|
|
11
|
+
const filtedPlugins = plugins.filter((plugin)=>node_path.isAbsolute(plugin.name) || plugin.name.includes(metaName));
|
|
11
12
|
api.updateAppContext({
|
|
12
13
|
serverPlugins: filtedPlugins
|
|
13
14
|
});
|
|
@@ -22,12 +23,7 @@ const resolveCliPlugin = async (p, appDirectory)=>{
|
|
|
22
23
|
const pkg = 'string' == typeof p ? p : p[0];
|
|
23
24
|
const pluginOptions = 'string' == typeof p ? void 0 : p[1];
|
|
24
25
|
const path = tryResolve(pkg, appDirectory);
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
module = await compatibleRequire(path);
|
|
28
|
-
} catch (e) {
|
|
29
|
-
({ default: module } = await dynamicImport(path));
|
|
30
|
-
}
|
|
26
|
+
const module = await compatibleRequire(path);
|
|
31
27
|
if ('function' == typeof module) {
|
|
32
28
|
const result = module(pluginOptions);
|
|
33
29
|
return result;
|
|
@@ -59,7 +59,7 @@ const resolveTsRuntimeRegisterMode = ()=>{
|
|
|
59
59
|
return 'unsupported';
|
|
60
60
|
};
|
|
61
61
|
const setupTsRuntime = async (appDir, distDir, alias, options = {})=>{
|
|
62
|
-
if ('unsupported' === resolveTsRuntimeRegisterMode()) throw new Error(`UltraModern.js requires Node.js >=26.
|
|
62
|
+
if ('unsupported' === resolveTsRuntimeRegisterMode()) throw new Error(`UltraModern.js requires Node.js >=26.10.0 with native TypeScript support; detected v${process.versions.node}. Legacy TypeScript runtime transpilers are unsupported.`);
|
|
63
63
|
const tsconfigPath = resolveServerTsconfig(appDir, options.tsconfigPath);
|
|
64
64
|
const isTsProject = await fs.pathExists(tsconfigPath);
|
|
65
65
|
if (!isTsProject) return;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import type { RsbuildPlugin } from '@modern-js/builder';
|
|
1
|
+
import type { RsbuildPlugin, Rspack } from '@modern-js/builder';
|
|
2
2
|
import type { BuilderOptions } from '../shared/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The copy plugin registers each pattern context as a context dependency even
|
|
5
|
+
* when the directory is absent. The watcher reports an absent context as
|
|
6
|
+
* removed right after the first build, which rebuilds every dev session once.
|
|
7
|
+
* Watch an absent context, and its absent parents, as missing instead: their
|
|
8
|
+
* later creation still rebuilds and copies.
|
|
9
|
+
*/
|
|
10
|
+
export declare class MissingCopyContextPlugin {
|
|
11
|
+
private readonly contexts;
|
|
12
|
+
constructor(contexts: readonly string[]);
|
|
13
|
+
apply(compiler: Rspack.Compiler): void;
|
|
14
|
+
}
|
|
3
15
|
export declare const builderPluginAdapterCopy: (options: BuilderOptions) => RsbuildPlugin;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare function createBuilderGenerator(): Promise<typeof import("./builder-rspack/index.js").createRspackBuilderForModern>;
|
|
2
2
|
export { parseRspackConfig } from '@modern-js/builder';
|
|
3
|
+
export { getBundleEntry } from '../plugins/analyze/getBundleEntry.js';
|
|
3
4
|
export { builderPluginAdapterBasic, builderPluginAdapterHooks, } from './shared/builderPlugins/index.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AppContext, CLIPluginExtends } from '@modern-js/plugin/cli';
|
|
1
2
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const builderPluginAdapterBasic: <Options extends {
|
|
4
|
+
appContext: Pick<AppContext<CLIPluginExtends>, 'metaName'>;
|
|
5
|
+
}>(options: Options) => RsbuildPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Rspack } from '@modern-js/builder';
|
|
2
|
-
import { type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import { type RsbuildPlugin, type RspackChain } from '@rsbuild/core';
|
|
3
3
|
import type { AppNormalizedConfig } from '../../../types/index.js';
|
|
4
4
|
import type { AppToolsContext } from '../../../types/plugin.js';
|
|
5
5
|
import type { BuilderOptions } from '../types.js';
|
|
@@ -12,3 +12,4 @@ export declare const builderPluginAdapterSSR: (options: BuilderOptions) => Rsbui
|
|
|
12
12
|
* so the caller leaves the config untouched.
|
|
13
13
|
*/
|
|
14
14
|
export declare function getSSRLazyCompilation(current: unknown, normalizedConfig: AppNormalizedConfig, appContext: AppToolsContext, eagerRouteComponentFilesByEntry: BuilderOptions['eagerRouteComponentFilesByEntry']): Rspack.LazyCompilationOptions | undefined;
|
|
15
|
+
export declare function applySSRLoaderEntry(chain: RspackChain, optinos: BuilderOptions, isServer: boolean, isServiceWorker: boolean): Promise<void>;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import type { Hooks } from '@modern-js/plugin/cli';
|
|
1
2
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const builderPluginAdapterHooks: <Options extends {
|
|
4
|
+
appContext: {
|
|
5
|
+
_internalContext: {
|
|
6
|
+
pluginAPI?: {
|
|
7
|
+
getHooks(): Readonly<Pick<Hooks<{}, {}, {}, {}>, 'modifyBundlerChain' | 'modifyRsbuildConfig' | 'modifyRspackConfig'>>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}>(options: Options) => RsbuildPlugin;
|
|
@@ -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[]>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { InternalContext } from '@modern-js/plugin';
|
|
2
|
-
import type { AppTools } from '../types/index.js';
|
|
2
|
+
import type { AppTools } from '../types/config/index.js';
|
|
3
|
+
import type { AppToolsHookRunners } from '../types/plugin-base.js';
|
|
3
4
|
/**
|
|
4
5
|
* old plugin useHookRunners function result
|
|
5
6
|
*/
|
|
6
|
-
export declare function getHookRunners(context: InternalContext<AppTools>):
|
|
7
|
+
export declare function getHookRunners(context: InternalContext<AppTools>): AppToolsHookRunners;
|
|
7
8
|
export declare function handleSetupResult(setupResult: Record<string, (...args: any) => any>, api: Record<string, any>): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +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 declare const appTools: () => CliPlugin<AppTools>;
|
|
5
|
-
export { build } from './commands/build.js';
|
|
6
|
-
export { deploy } from './commands/deploy.js';
|
|
5
|
+
export declare const appTools: (options?: PolicyDefaultsOptions) => CliPlugin<AppTools>;
|
|
7
6
|
export { dev } from './commands/dev.js';
|
|
8
7
|
export { serve } from './commands/serve.js';
|
|
9
8
|
export { defineConfig } from './defineConfig.js';
|
|
@@ -11,7 +10,7 @@ export { type ResolveModernRsbuildConfigOptions, resolveModernRsbuildConfig, } f
|
|
|
11
10
|
export * from './types/index.js';
|
|
12
11
|
export { closeServer } from './utils/createServer.js';
|
|
13
12
|
export { generateWatchFiles } from './utils/generateWatchFiles.js';
|
|
14
|
-
export type {
|
|
13
|
+
export type { DeployOptions, DevOptions } from './utils/types.js';
|
|
15
14
|
export { initAppContext };
|
|
16
15
|
export default appTools;
|
|
17
16
|
export { mergeConfig } from '@modern-js/plugin/cli';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
1
|
+
import type { AppContext, CLIPluginExtends } from '@modern-js/plugin/cli';
|
|
2
|
+
import type { Entrypoint } from '@modern-js/types/cli/base';
|
|
3
|
+
import type { AppToolsNormalizedConfig } from '../../types/config/base.js';
|
|
4
|
+
import type { AppToolsExtendHooksBase } from '../../types/plugin-base.js';
|
|
5
|
+
export declare const getBundleEntry: (hooks: Pick<AppToolsExtendHooksBase<never>, 'checkEntryPoint'>, appContext: Pick<AppContext<CLIPluginExtends>, 'appDirectory' | 'packageName'>, config: Pick<AppToolsNormalizedConfig, 'source'>) => Promise<Entrypoint[]>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { AppContext, CLIPluginExtends } from '@modern-js/plugin/cli';
|
|
2
|
+
import type { Entrypoint } from '@modern-js/types/cli/base';
|
|
3
|
+
import type { AppToolsNormalizedConfig } from '../../types/config/base.js';
|
|
4
|
+
import type { AppToolsExtendHooksBase } from '../../types/plugin-base.js';
|
|
4
5
|
export type { Entrypoint };
|
|
5
6
|
export declare const hasEntry: (dir: string) => string | false;
|
|
6
7
|
export declare const hasServerEntry: (dir: string) => string | false;
|
|
7
|
-
export declare const getFileSystemEntry: (hooks:
|
|
8
|
+
export declare const getFileSystemEntry: (hooks: Pick<AppToolsExtendHooksBase<never>, 'checkEntryPoint'>, appContext: Pick<AppContext<CLIPluginExtends>, 'appDirectory'>, config: Pick<AppToolsNormalizedConfig, 'source'>) => Promise<Entrypoint[]>;
|
|
@@ -3,8 +3,8 @@ export declare const replaceWithAlias: (base: string, filePath: string, alias: s
|
|
|
3
3
|
export declare const parseModule: ({ source, filename, }: {
|
|
4
4
|
source: string;
|
|
5
5
|
filename: string;
|
|
6
|
-
}) => Promise<readonly [imports: readonly import("es-module-lexer").
|
|
6
|
+
}) => Promise<readonly [imports: readonly import("es-module-lexer").Import[], exports: readonly import("es-module-lexer").Export[], facade: boolean, hasModuleSyntax: boolean]>;
|
|
7
7
|
export declare const getServerCombinedModuleFile: (internalDirectory: string, entryName: string) => string;
|
|
8
|
-
export declare const checkIsBuildCommands: (
|
|
8
|
+
export declare const checkIsBuildCommands: () => boolean;
|
|
9
9
|
export declare const checkIsServeCommand: () => boolean;
|
|
10
10
|
export declare const isSubDirOrEqual: (parent: string, child: string) => boolean;
|
|
@@ -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>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fork's default server policy (localised loaders, error responses,
|
|
3
|
+
* telemetry, module-federation CSS and asset headers, static serving).
|
|
4
|
+
*
|
|
5
|
+
* It is exposed from `@modern-js/app-tools` so a plain `appTools()` app can
|
|
6
|
+
* load it by a specifier it is guaranteed to be able to resolve: every app
|
|
7
|
+
* declares `@modern-js/app-tools`, but not necessarily
|
|
8
|
+
* `@modern-js/server-runtime-extensions`.
|
|
9
|
+
*/
|
|
10
|
+
export { default } from '@modern-js/server-runtime-extensions/server-plugin';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CLIPlugin, CLIPluginExtends } from '@modern-js/plugin/cli';
|
|
2
|
+
import type { BffUserConfig, ServerUserConfig } from '@modern-js/server-core/config-types';
|
|
3
|
+
import type { NestedRoute, PageRoute } from '@modern-js/types/cli/base';
|
|
4
|
+
import type { RsbuildConfig } from '@rsbuild/core';
|
|
5
|
+
import type { AppToolsExtendAPIBase, AppToolsExtendContextBase, AppToolsExtendHooksBase } from '../plugin-base.js';
|
|
6
|
+
import type { DeployUserConfig } from './deploy.js';
|
|
7
|
+
import type { DevUserConfig } from './dev.js';
|
|
8
|
+
import type { ExperimentsUserConfig } from './experiments.js';
|
|
9
|
+
import type { HtmlUserConfig } from './html.js';
|
|
10
|
+
import type { OutputUserConfig } from './output.js';
|
|
11
|
+
import type { PerformanceUserConfig } from './performance.js';
|
|
12
|
+
import type { ResolveUserConfig } from './resolve.js';
|
|
13
|
+
import type { SecurityUserConfig } from './security.js';
|
|
14
|
+
import type { SourceUserConfig } from './source.js';
|
|
15
|
+
import type { TestingUserConfig } from './testing.js';
|
|
16
|
+
import type { ToolsUserConfig } from './tools.js';
|
|
17
|
+
export * from './output.js';
|
|
18
|
+
export type AppToolsBuilderPlugins = NonNullable<RsbuildConfig['plugins']>;
|
|
19
|
+
export interface AppToolsUserConfigBase<Routes> {
|
|
20
|
+
resolve?: ResolveUserConfig;
|
|
21
|
+
server?: ServerUserConfig;
|
|
22
|
+
source?: SourceUserConfig;
|
|
23
|
+
output?: OutputUserConfig;
|
|
24
|
+
experiments?: ExperimentsUserConfig;
|
|
25
|
+
/**
|
|
26
|
+
* The configuration of `bff` is provided by `bff` plugin.
|
|
27
|
+
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
28
|
+
* @requires `bff` plugin
|
|
29
|
+
*/
|
|
30
|
+
bff?: BffUserConfig;
|
|
31
|
+
dev?: DevUserConfig;
|
|
32
|
+
deploy?: DeployUserConfig;
|
|
33
|
+
html?: HtmlUserConfig;
|
|
34
|
+
tools?: ToolsUserConfig;
|
|
35
|
+
security?: SecurityUserConfig;
|
|
36
|
+
testing?: TestingUserConfig;
|
|
37
|
+
builderPlugins?: AppToolsBuilderPlugins;
|
|
38
|
+
performance?: PerformanceUserConfig;
|
|
39
|
+
environments?: RsbuildConfig['environments'];
|
|
40
|
+
splitChunks?: RsbuildConfig['splitChunks'];
|
|
41
|
+
plugins?: CliPlugin<AppToolsBase<Routes>>[];
|
|
42
|
+
}
|
|
43
|
+
interface SharedNormalizedConfig<RawConfig> {
|
|
44
|
+
cliOptions?: Record<string, any>;
|
|
45
|
+
_raw: RawConfig;
|
|
46
|
+
}
|
|
47
|
+
export type AppToolsNormalizedConfig<Config = AppToolsUserConfig> = Required<Config> & SharedNormalizedConfig<Config>;
|
|
48
|
+
/** Renderer packages opt into JSX element typing through their owned type entry. */
|
|
49
|
+
export interface CLIElementTypes {
|
|
50
|
+
}
|
|
51
|
+
export type CLIElement = CLIElementTypes[keyof CLIElementTypes];
|
|
52
|
+
export type CLIFileSystemRoute<Element> = NestedRoute<string, Element> | PageRoute<Element>;
|
|
53
|
+
export type AppToolsBase<Routes> = Required<CLIPluginExtends<AppToolsUserConfigBase<Routes>, AppToolsNormalizedConfig<AppToolsUserConfigBase<Routes>>, AppToolsExtendContextBase<AppToolsBase<Routes>>, AppToolsExtendAPIBase<AppToolsBase<Routes>, Routes>, AppToolsExtendHooksBase<Routes>>>;
|
|
54
|
+
export type AppTools = AppToolsBase<CLIFileSystemRoute<CLIElement>>;
|
|
55
|
+
export type AppToolsUserConfig = AppToolsUserConfigBase<CLIFileSystemRoute<CLIElement>>;
|
|
56
|
+
export type AppUserConfig = AppToolsUserConfig;
|
|
57
|
+
export type AppNormalizedConfig = AppToolsNormalizedConfig;
|
|
58
|
+
export type CliPlugin<Extends extends CLIPluginExtends> = CLIPlugin<Extends>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CloudflareWorkerDeployConfig, DeployTarget } from '@modern-js/app-tools-extensions/config';
|
|
2
2
|
export type { CloudflareWorkerArtifactConfig, CloudflareWorkerD1DatabaseConfig, CloudflareWorkerPublicAssetConfig, CloudflareWorkerSecurityConfig, CloudflareWorkerSecurityCorsConfig, CloudflareWorkerSecurityCspConfig, CloudflareWorkerSecurityCspMode, CloudflareWorkerSecurityNoindexConfig, CloudflareWorkerServiceBindingConfig, CloudflareWorkerServiceBindingFragmentConfig, DeployTarget, JsonValue, } from '@modern-js/app-tools-extensions/config';
|
|
3
3
|
export interface MicroFrontend {
|
|
4
4
|
/**
|
|
@@ -26,53 +26,5 @@ export interface DeployUserConfig {
|
|
|
26
26
|
* @default false
|
|
27
27
|
*/
|
|
28
28
|
microFrontend?: boolean | MicroFrontend;
|
|
29
|
-
worker?:
|
|
30
|
-
name?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Cloudflare Workers compatibility date for generated wrangler config.
|
|
33
|
-
* Use YYYY-MM-DD. Defaults to the date validated against the bundled
|
|
34
|
-
* Wrangler version used by UltraModern generated workspaces.
|
|
35
|
-
*/
|
|
36
|
-
compatibilityDate?: string;
|
|
37
|
-
ssr?: boolean;
|
|
38
|
-
security?: CloudflareWorkerSecurityConfig;
|
|
39
|
-
/**
|
|
40
|
-
* Raw Wrangler-compatible config merged into `.output/wrangler.json`.
|
|
41
|
-
* Framework-owned worker invariants still win for `main`, the assets
|
|
42
|
-
* binding/directory/run mode, and required compatibility flags.
|
|
43
|
-
*/
|
|
44
|
-
wrangler?: Record<string, JsonValue>;
|
|
45
|
-
/**
|
|
46
|
-
* Additional app-root files or directories to stage under `.output`.
|
|
47
|
-
* Use this for provider resources such as migrations or generated config.
|
|
48
|
-
*/
|
|
49
|
-
artifacts?: CloudflareWorkerArtifactConfig[];
|
|
50
|
-
/**
|
|
51
|
-
* Additional app-root files or directories to serve as Cloudflare Worker
|
|
52
|
-
* Static Assets under `.output/public`. Use `to: '.'` to copy a
|
|
53
|
-
* source directory's contents into the public asset root.
|
|
54
|
-
*/
|
|
55
|
-
publicAssets?: CloudflareWorkerPublicAssetConfig[];
|
|
56
|
-
/**
|
|
57
|
-
* First-class Cloudflare D1 bindings. Modern.js writes these to
|
|
58
|
-
* `wrangler.json` as `d1_databases` and stages configured migration
|
|
59
|
-
* directories into `.output`.
|
|
60
|
-
*/
|
|
61
|
-
d1Databases?: CloudflareWorkerD1DatabaseConfig[];
|
|
62
|
-
/**
|
|
63
|
-
* First-class Cloudflare service bindings. Modern.js writes these to
|
|
64
|
-
* `wrangler.json` as `services`; when a binding also has `prefix`,
|
|
65
|
-
* the generated Worker dispatches matching requests through
|
|
66
|
-
* `env[binding].fetch(request)`.
|
|
67
|
-
*/
|
|
68
|
-
services?: CloudflareWorkerServiceBindingConfig[];
|
|
69
|
-
/**
|
|
70
|
-
* Dist output paths that must not be copied into Cloudflare public assets.
|
|
71
|
-
* Entries are slash-normalized path prefixes relative to the app dist root.
|
|
72
|
-
* Top-level `api` and `shared` dist directories are excluded when matching
|
|
73
|
-
* source directories exist in the app root because they conventionally
|
|
74
|
-
* contain server-only implementation code.
|
|
75
|
-
*/
|
|
76
|
-
publicAssetExcludes?: string[];
|
|
77
|
-
};
|
|
29
|
+
worker?: CloudflareWorkerDeployConfig;
|
|
78
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuilderConfig } from '@modern-js/builder';
|
|
2
|
-
import type { CorsOptions, SetupMiddlewares } from '@modern-js/server';
|
|
2
|
+
import type { CorsOptions, SetupMiddlewares } from '@modern-js/server/config-types';
|
|
3
3
|
import type { ServerConfig } from '@rsbuild/core';
|
|
4
4
|
type BuilderDevConfig = NonNullable<BuilderConfig['dev']>;
|
|
5
5
|
export type DevProxyOptions = string | Record<string, string>;
|
|
@@ -1,48 +1,24 @@
|
|
|
1
|
-
import type { CLIPlugin, CLIPluginExtends } from '@modern-js/plugin';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { CLIPlugin, CLIPluginExtends } from '@modern-js/plugin/cli';
|
|
2
|
+
import type { NestedRouteForCli, PageRoute } from '@modern-js/types/cli';
|
|
3
|
+
import type { PluginSvgrOptions } from '@rsbuild/plugin-svgr';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
4
5
|
import type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks } from '../plugin.js';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
import type { AppToolsUserConfigBase, AppToolsNormalizedConfig as BaseNormalizedConfig } from './base.js';
|
|
7
|
+
declare module '@modern-js/builder/types' {
|
|
8
|
+
interface BuilderSvgOptions {
|
|
9
|
+
options: PluginSvgrOptions;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
declare module './base' {
|
|
13
|
+
interface CLIElementTypes {
|
|
14
|
+
react: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export type { AppToolsBuilderPlugins } from './base.js';
|
|
16
18
|
export * from './output.js';
|
|
17
|
-
export
|
|
18
|
-
export interface AppToolsUserConfig {
|
|
19
|
-
resolve?: ResolveUserConfig;
|
|
20
|
-
server?: ServerUserConfig;
|
|
21
|
-
source?: SourceUserConfig;
|
|
22
|
-
output?: OutputUserConfig;
|
|
23
|
-
experiments?: ExperimentsUserConfig;
|
|
24
|
-
/**
|
|
25
|
-
* The configuration of `bff` is provided by `bff` plugin.
|
|
26
|
-
* Please use `yarn new` or `pnpm new` to enable the corresponding capability.
|
|
27
|
-
* @requires `bff` plugin
|
|
28
|
-
*/
|
|
29
|
-
bff?: BffUserConfig;
|
|
30
|
-
dev?: DevUserConfig;
|
|
31
|
-
deploy?: DeployUserConfig;
|
|
32
|
-
html?: HtmlUserConfig;
|
|
33
|
-
tools?: ToolsUserConfig;
|
|
34
|
-
security?: SecurityUserConfig;
|
|
35
|
-
testing?: TestingUserConfig;
|
|
36
|
-
builderPlugins?: AppToolsBuilderPlugins;
|
|
37
|
-
performance?: PerformanceUserConfig;
|
|
38
|
-
environments?: RsbuildConfig['environments'];
|
|
39
|
-
splitChunks?: RsbuildConfig['splitChunks'];
|
|
19
|
+
export interface AppToolsUserConfig extends Omit<AppToolsUserConfigBase<NestedRouteForCli | PageRoute>, 'plugins'> {
|
|
40
20
|
plugins?: CliPlugin<AppTools>[];
|
|
41
21
|
}
|
|
42
|
-
|
|
43
|
-
cliOptions?: Record<string, any>;
|
|
44
|
-
_raw: RawConfig;
|
|
45
|
-
}
|
|
46
|
-
export type AppToolsNormalizedConfig<Config = AppToolsUserConfig> = Required<Config> & SharedNormalizedConfig<Config>;
|
|
22
|
+
export type AppToolsNormalizedConfig<Config = AppToolsUserConfig> = BaseNormalizedConfig<Config>;
|
|
47
23
|
export type AppTools = Required<CLIPluginExtends<AppToolsUserConfig, AppToolsNormalizedConfig, AppToolsExtendContext, AppToolsExtendAPI, AppToolsExtendHooks>>;
|
|
48
24
|
export type CliPlugin<Extends extends CLIPluginExtends> = CLIPlugin<Extends>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuilderConfig } from '@modern-js/builder';
|
|
2
|
-
import type { SSGConfig, SSGMultiEntryOptions } from '@modern-js/types';
|
|
2
|
+
import type { SSGConfig, SSGMultiEntryOptions } from '@modern-js/types/cli/base';
|
|
3
3
|
import type { UnwrapBuilderConfig } from '../utils.js';
|
|
4
4
|
export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'output'> {
|
|
5
5
|
/**
|
|
@@ -33,4 +33,4 @@ export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'ou
|
|
|
33
33
|
*/
|
|
34
34
|
tempDir?: string;
|
|
35
35
|
}
|
|
36
|
-
export type { SSGConfig, SSGMultiEntryOptions, SSGRouteOptions, SSGSingleEntryOptions, } from '@modern-js/types';
|
|
36
|
+
export type { SSGConfig, SSGMultiEntryOptions, SSGRouteOptions, SSGSingleEntryOptions, } from '@modern-js/types/cli/base';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuilderConfig } from '@modern-js/builder';
|
|
2
|
-
import type { JestConfig } from '@modern-js/types';
|
|
2
|
+
import type { JestConfig } from '@modern-js/types/cli/base';
|
|
3
3
|
import type { UnwrapBuilderConfig } from '../utils.js';
|
|
4
4
|
type BuilderToolsConfig = UnwrapBuilderConfig<BuilderConfig, 'tools'>;
|
|
5
5
|
export interface ToolsUserConfig extends Omit<BuilderToolsConfig, 'swc'> {
|