@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.9 → 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 +73 -99
- 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/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 +9 -18
- 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/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 +10 -20
- 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/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 +1 -3
- 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/index.d.ts +1 -1
- package/dist/types/run/index.d.ts +1 -1
- 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 +1 -1
- 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 +59 -30
- package/dist/cjs/plugins/serverRuntime.js +0 -53
- 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
package/dist/types/index.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import type { AppTools, CliPlugin } from './types/index.js';
|
|
|
3
3
|
import { initAppContext } from './utils/initAppContext.js';
|
|
4
4
|
export * from './defineConfig.js';
|
|
5
5
|
export declare const appTools: (options?: PolicyDefaultsOptions) => CliPlugin<AppTools>;
|
|
6
|
-
export { build } from './commands/build.js';
|
|
7
|
-
export { deploy } from './commands/deploy.js';
|
|
8
6
|
export { dev } from './commands/dev.js';
|
|
9
7
|
export { serve } from './commands/serve.js';
|
|
10
8
|
export { defineConfig } from './defineConfig.js';
|
|
@@ -12,7 +10,7 @@ export { type ResolveModernRsbuildConfigOptions, resolveModernRsbuildConfig, } f
|
|
|
12
10
|
export * from './types/index.js';
|
|
13
11
|
export { closeServer } from './utils/createServer.js';
|
|
14
12
|
export { generateWatchFiles } from './utils/generateWatchFiles.js';
|
|
15
|
-
export type {
|
|
13
|
+
export type { DeployOptions, DevOptions } from './utils/types.js';
|
|
16
14
|
export { initAppContext };
|
|
17
15
|
export default appTools;
|
|
18
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>;
|
|
@@ -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,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'> {
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { ResolvedDeployTarget } from '@modern-js/app-tools-extensions/deploy-output/target';
|
|
2
|
+
import type { AppContext, AsyncHook, CLIPluginExtends, InternalContext, PluginHook, PluginHookTap, TransformFunction } from '@modern-js/plugin/cli';
|
|
3
|
+
import type { BffRuntimeFramework } from '@modern-js/plugin/server';
|
|
4
|
+
import type { Entrypoint, HtmlPartials, HtmlTemplates, RouteLegacy } from '@modern-js/types/cli/base';
|
|
5
|
+
import type { ServerPlugin } from '@modern-js/types/common';
|
|
6
|
+
import type { HttpMethodDecider, ServerRoute } from '@modern-js/types/server';
|
|
7
|
+
import type { EagerRouteComponentFilesByEntry } from '@modern-js/utils/route-component-files';
|
|
8
|
+
import type { EnvironmentConfig } from '@rsbuild/core';
|
|
9
|
+
export type AppToolsModuleType = 'module' | 'commonjs';
|
|
10
|
+
export type AppToolsHookRunners = Record<string, any>;
|
|
11
|
+
export interface BffCompilation {
|
|
12
|
+
readonly appDirectory: string;
|
|
13
|
+
readonly apiDirectory: string;
|
|
14
|
+
readonly sourceDirectories: readonly string[];
|
|
15
|
+
readonly outputDirectories: readonly string[];
|
|
16
|
+
readonly distDirectory: string;
|
|
17
|
+
readonly tsconfigPath?: string;
|
|
18
|
+
readonly moduleType: AppToolsModuleType;
|
|
19
|
+
}
|
|
20
|
+
export interface BffGeneration {
|
|
21
|
+
readonly appDirectory: string;
|
|
22
|
+
readonly apiDirectory: string;
|
|
23
|
+
readonly lambdaDirectory: string;
|
|
24
|
+
readonly existLambda: boolean;
|
|
25
|
+
readonly apiFiles: readonly string[];
|
|
26
|
+
readonly relativeDistPath: string;
|
|
27
|
+
readonly prefix: string;
|
|
28
|
+
readonly port?: number;
|
|
29
|
+
readonly requestId: string;
|
|
30
|
+
readonly requestCreator?: string;
|
|
31
|
+
readonly httpMethodDecider?: HttpMethodDecider;
|
|
32
|
+
}
|
|
33
|
+
export interface BffClientArtifact {
|
|
34
|
+
/** Canonical relative source path under generation.apiDirectory. */
|
|
35
|
+
readonly sourcePath: string;
|
|
36
|
+
readonly code: string;
|
|
37
|
+
readonly declaration: string;
|
|
38
|
+
}
|
|
39
|
+
export interface BffClientArtifacts {
|
|
40
|
+
readonly generation: BffGeneration;
|
|
41
|
+
additionalArtifacts: BffClientArtifact[];
|
|
42
|
+
}
|
|
43
|
+
export interface BffGeneratedModule {
|
|
44
|
+
readonly code: string;
|
|
45
|
+
readonly declaration: string;
|
|
46
|
+
}
|
|
47
|
+
export interface BffGeneratedEntries {
|
|
48
|
+
readonly generation: BffGeneration;
|
|
49
|
+
plugin: BffGeneratedModule;
|
|
50
|
+
runtime: BffGeneratedModule | null;
|
|
51
|
+
/** Direct dependencies required by the emitted SDK modules. */
|
|
52
|
+
packageDependencies: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
export type BeforeBffCompileFn = (context: BffCompilation) => void | Promise<void>;
|
|
55
|
+
export type AfterBffCompileFn = (context: BffCompilation) => void | Promise<void>;
|
|
56
|
+
export type ModifyBffClientArtifactsFn = TransformFunction<BffClientArtifacts>;
|
|
57
|
+
export type ModifyBffGeneratedEntriesFn = TransformFunction<BffGeneratedEntries>;
|
|
58
|
+
export type AfterPrepareFn = () => Promise<void> | void;
|
|
59
|
+
export type CheckEntryPointFn = TransformFunction<{
|
|
60
|
+
path: string;
|
|
61
|
+
entry: false | string;
|
|
62
|
+
}>;
|
|
63
|
+
export type ModifyEntrypointsFn = TransformFunction<{
|
|
64
|
+
entrypoints: Entrypoint[];
|
|
65
|
+
}>;
|
|
66
|
+
export type ModifyBuilderEnvironmentsFn = TransformFunction<{
|
|
67
|
+
environments: Record<string, EnvironmentConfig>;
|
|
68
|
+
}>;
|
|
69
|
+
export type ModifyFileSystemRoutesFn<Routes> = TransformFunction<{
|
|
70
|
+
entrypoint: Entrypoint;
|
|
71
|
+
routes: RouteLegacy[] | Routes[];
|
|
72
|
+
}>;
|
|
73
|
+
export type DeplpoyFn = () => Promise<void> | void;
|
|
74
|
+
export type GenerateEntryCodeFn = (params: {
|
|
75
|
+
entrypoints: Entrypoint[];
|
|
76
|
+
}) => Promise<void> | void;
|
|
77
|
+
export type BeforeGenerateRoutesFn = TransformFunction<{
|
|
78
|
+
entrypoint: Entrypoint;
|
|
79
|
+
code: string;
|
|
80
|
+
}>;
|
|
81
|
+
export type BeforePrintInstructionsFn = TransformFunction<{
|
|
82
|
+
instructions: string;
|
|
83
|
+
}>;
|
|
84
|
+
export type AddRuntimeExportsFn = () => Promise<void> | void;
|
|
85
|
+
export interface AppToolsExtendAPIBase<Extends extends CLIPluginExtends, Routes> {
|
|
86
|
+
onAfterPrepare: PluginHookTap<AfterPrepareFn>;
|
|
87
|
+
deploy: PluginHookTap<DeplpoyFn>;
|
|
88
|
+
checkEntryPoint: PluginHookTap<CheckEntryPointFn>;
|
|
89
|
+
modifyEntrypoints: PluginHookTap<ModifyEntrypointsFn>;
|
|
90
|
+
modifyBuilderEnvironments: PluginHookTap<ModifyBuilderEnvironmentsFn>;
|
|
91
|
+
modifyFileSystemRoutes: PluginHookTap<ModifyFileSystemRoutesFn<Routes>>;
|
|
92
|
+
generateEntryCode: PluginHookTap<GenerateEntryCodeFn>;
|
|
93
|
+
onBeforeGenerateRoutes: PluginHookTap<BeforeGenerateRoutesFn>;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated
|
|
96
|
+
*/
|
|
97
|
+
onBeforePrintInstructions: PluginHookTap<BeforePrintInstructionsFn>;
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated use getAppContext instead
|
|
100
|
+
*/
|
|
101
|
+
useAppContext: () => AppContext<Extends> & Extends['extendContext'];
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated use getConfig instead
|
|
104
|
+
*/
|
|
105
|
+
useConfigContext: () => Extends['config'];
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated use getNormalizedConfig instead
|
|
108
|
+
*/
|
|
109
|
+
useResolvedConfigContext: () => Extends['normalizedConfig'];
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated use api.xx instead
|
|
112
|
+
*/
|
|
113
|
+
useHookRunners: () => AppToolsHookRunners;
|
|
114
|
+
}
|
|
115
|
+
export interface AppToolsExtendHooksBase<Routes> extends Record<string, PluginHook<(...args: any[]) => any>> {
|
|
116
|
+
onBeforeBffCompile: AsyncHook<BeforeBffCompileFn>;
|
|
117
|
+
onAfterBffCompile: AsyncHook<AfterBffCompileFn>;
|
|
118
|
+
modifyBffClientArtifacts: AsyncHook<ModifyBffClientArtifactsFn>;
|
|
119
|
+
modifyBffGeneratedEntries: AsyncHook<ModifyBffGeneratedEntriesFn>;
|
|
120
|
+
onAfterPrepare: AsyncHook<AfterPrepareFn>;
|
|
121
|
+
deploy: AsyncHook<DeplpoyFn>;
|
|
122
|
+
checkEntryPoint: AsyncHook<CheckEntryPointFn>;
|
|
123
|
+
modifyEntrypoints: AsyncHook<ModifyEntrypointsFn>;
|
|
124
|
+
modifyBuilderEnvironments: AsyncHook<ModifyBuilderEnvironmentsFn>;
|
|
125
|
+
modifyFileSystemRoutes: AsyncHook<ModifyFileSystemRoutesFn<Routes>>;
|
|
126
|
+
generateEntryCode: AsyncHook<GenerateEntryCodeFn>;
|
|
127
|
+
onBeforeGenerateRoutes: AsyncHook<BeforeGenerateRoutesFn>;
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated
|
|
130
|
+
*/
|
|
131
|
+
onBeforePrintInstructions: AsyncHook<BeforePrintInstructionsFn>;
|
|
132
|
+
}
|
|
133
|
+
export interface AppToolsExtendContextBase<Extends extends CLIPluginExtends> {
|
|
134
|
+
metaName: string;
|
|
135
|
+
internalDirectory: string;
|
|
136
|
+
sharedDirectory: string;
|
|
137
|
+
internalDirAlias: string;
|
|
138
|
+
internalSrcAlias: string;
|
|
139
|
+
apiDirectory: string;
|
|
140
|
+
lambdaDirectory: string;
|
|
141
|
+
runtimeConfigFile: string;
|
|
142
|
+
serverPlugins: ServerPlugin[];
|
|
143
|
+
moduleType: AppToolsModuleType;
|
|
144
|
+
/** Exact generated files excluded from server compilation. */
|
|
145
|
+
serverCompileExcludedFiles?: string[];
|
|
146
|
+
/** Information for entry points */
|
|
147
|
+
entrypoints: Entrypoint[];
|
|
148
|
+
/** Selected entry points */
|
|
149
|
+
checkedEntries: string[];
|
|
150
|
+
/** Information for server routes */
|
|
151
|
+
serverRoutes: ServerRoute[];
|
|
152
|
+
/** Whether to use api only mode */
|
|
153
|
+
apiOnly: boolean;
|
|
154
|
+
deployTarget: ResolvedDeployTarget;
|
|
155
|
+
_internalContext: InternalContext<Extends>;
|
|
156
|
+
/**
|
|
157
|
+
* Information for HTML templates by entry
|
|
158
|
+
* @private
|
|
159
|
+
*/
|
|
160
|
+
partialsByEntrypoint?: Record<string, HtmlPartials>;
|
|
161
|
+
/**
|
|
162
|
+
* Information for HTML templates
|
|
163
|
+
* @private
|
|
164
|
+
*/
|
|
165
|
+
htmlTemplates: HtmlTemplates;
|
|
166
|
+
/**
|
|
167
|
+
* @deprecated compat old plugin, default is app tools
|
|
168
|
+
*/
|
|
169
|
+
toolsType?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Identification for bff runtime framework
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
bffRuntimeFramework?: BffRuntimeFramework;
|
|
175
|
+
/**
|
|
176
|
+
* Route component files collected from the FINAL file-system routes (after all
|
|
177
|
+
* `modifyFileSystemRoutes` consumers ran), keyed by entry name. Populated by
|
|
178
|
+
* the router plugin during route generation and consumed (currently by stream
|
|
179
|
+
* SSR lazy compilation) to force route component chunks eager.
|
|
180
|
+
*
|
|
181
|
+
* Published via the app context (`api.updateAppContext`) by the router plugin,
|
|
182
|
+
* then read fresh when assembling the builder options and threaded into
|
|
183
|
+
* `BuilderOptions.eagerRouteComponentFilesByEntry`; the SSR builder plugin
|
|
184
|
+
* reads it from those options (not from the context directly).
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
eagerRouteComponentFilesByEntry?: EagerRouteComponentFilesByEntry;
|
|
188
|
+
}
|