@bleedingdev/modern-js-app-tools 3.2.0-ultramodern.1 → 3.2.0-ultramodern.100

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.
Files changed (145) hide show
  1. package/bin/modern.js +0 -0
  2. package/dist/cjs/baseline.js +43 -1
  3. package/dist/cjs/builder/generator/getBuilderEnvironments.js +191 -8
  4. package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +41 -5
  5. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +3 -1
  6. package/dist/cjs/plugins/deploy/index.js +17 -6
  7. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +222 -0
  8. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +438 -0
  9. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +7 -0
  10. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +185 -0
  11. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +59 -0
  12. package/dist/cjs/rsbuild.js +3 -0
  13. package/dist/esm/baseline.mjs +33 -1
  14. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +180 -8
  15. package/dist/esm/builder/shared/builderPlugins/adapterBasic.mjs +41 -5
  16. package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +3 -1
  17. package/dist/esm/plugins/deploy/index.mjs +10 -4
  18. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +178 -0
  19. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +438 -0
  20. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +7 -0
  21. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +185 -0
  22. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +59 -0
  23. package/dist/esm/rsbuild.mjs +5 -2
  24. package/dist/esm-node/baseline.mjs +33 -1
  25. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +185 -9
  26. package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.mjs +41 -5
  27. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +3 -1
  28. package/dist/esm-node/plugins/deploy/index.mjs +10 -4
  29. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +179 -0
  30. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +438 -0
  31. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +7 -0
  32. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +185 -0
  33. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +59 -0
  34. package/dist/esm-node/rsbuild.mjs +5 -2
  35. package/dist/types/baseline.d.ts +46 -0
  36. package/dist/types/builder/builder-rspack/index.d.ts +2 -0
  37. package/dist/types/builder/generator/adapterCopy.d.ts +3 -0
  38. package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +3 -0
  39. package/dist/types/builder/generator/createCopyPattern.d.ts +16 -0
  40. package/dist/types/builder/generator/getBuilderEnvironments.d.ts +6 -0
  41. package/dist/types/builder/generator/index.d.ts +8 -0
  42. package/dist/types/builder/index.d.ts +3 -0
  43. package/dist/types/builder/shared/builderPlugins/adapterBasic.d.ts +3 -0
  44. package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +3 -0
  45. package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +3 -0
  46. package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +3 -0
  47. package/dist/types/builder/shared/builderPlugins/builderHooks.d.ts +3 -0
  48. package/dist/types/builder/shared/builderPlugins/index.d.ts +5 -0
  49. package/dist/types/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.d.ts +7 -0
  50. package/dist/types/builder/shared/bundlerPlugins/HtmlBottomTemplate.d.ts +9 -0
  51. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +32 -0
  52. package/dist/types/builder/shared/bundlerPlugins/index.d.ts +3 -0
  53. package/dist/types/builder/shared/createCopyInfo.d.ts +8 -0
  54. package/dist/types/builder/shared/index.d.ts +3 -0
  55. package/dist/types/builder/shared/loaders/serverModuleLoader.d.ts +3 -0
  56. package/dist/types/builder/shared/types.d.ts +6 -0
  57. package/dist/types/commands/build.d.ts +4 -0
  58. package/dist/types/commands/deploy.d.ts +3 -0
  59. package/dist/types/commands/dev.d.ts +9 -0
  60. package/dist/types/commands/index.d.ts +10 -0
  61. package/dist/types/commands/info.d.ts +18 -0
  62. package/dist/types/commands/inspect.d.ts +4 -0
  63. package/dist/types/commands/runtime.d.ts +11 -0
  64. package/dist/types/commands/serve.d.ts +8 -0
  65. package/dist/types/compat/hooks.d.ts +7 -0
  66. package/dist/types/compat/index.d.ts +2 -0
  67. package/dist/types/compat/utils.d.ts +13 -0
  68. package/dist/types/config/default.d.ts +3 -0
  69. package/dist/types/config/index.d.ts +2 -0
  70. package/dist/types/config/initialize/index.d.ts +3 -0
  71. package/dist/types/config/initialize/inits.d.ts +4 -0
  72. package/dist/types/constants.d.ts +2 -0
  73. package/dist/types/defineConfig.d.ts +11 -0
  74. package/dist/types/esm/register-esm.d.mts +5 -0
  75. package/dist/types/esm/ts-paths-loader.d.mts +6 -0
  76. package/dist/types/exports/server.d.ts +1 -0
  77. package/dist/types/index.d.ts +17 -0
  78. package/dist/types/locale/en.d.ts +44 -0
  79. package/dist/types/locale/index.d.ts +3 -0
  80. package/dist/types/locale/zh.d.ts +44 -0
  81. package/dist/types/plugins/analyze/constants.d.ts +3 -0
  82. package/dist/types/plugins/analyze/getBundleEntry.d.ts +4 -0
  83. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +7 -0
  84. package/dist/types/plugins/analyze/getHtmlTemplate.d.ts +27 -0
  85. package/dist/types/plugins/analyze/getServerRoutes.d.ts +8 -0
  86. package/dist/types/plugins/analyze/index.d.ts +3 -0
  87. package/dist/types/plugins/analyze/isDefaultExportFunction.d.ts +1 -0
  88. package/dist/types/plugins/analyze/templates.d.ts +5 -0
  89. package/dist/types/plugins/analyze/utils.d.ts +10 -0
  90. package/dist/types/plugins/deploy/index.d.ts +6 -0
  91. package/dist/types/plugins/deploy/platforms/cloudflare.d.ts +2 -0
  92. package/dist/types/plugins/deploy/platforms/gh-pages.d.ts +2 -0
  93. package/dist/types/plugins/deploy/platforms/netlify.d.ts +2 -0
  94. package/dist/types/plugins/deploy/platforms/node.d.ts +2 -0
  95. package/dist/types/plugins/deploy/platforms/platform.d.ts +17 -0
  96. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.d.mts +4 -0
  97. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.d.mts +5 -0
  98. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.d.mts +48 -0
  99. package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-path.d.mts +21 -0
  100. package/dist/types/plugins/deploy/platforms/templates/netlify-entry.d.cts +2 -0
  101. package/dist/types/plugins/deploy/platforms/templates/netlify-entry.d.mts +2 -0
  102. package/dist/types/plugins/deploy/platforms/templates/node-entry.d.cts +1 -0
  103. package/dist/types/plugins/deploy/platforms/templates/node-entry.d.mts +1 -0
  104. package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.cts +2 -0
  105. package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.mts +2 -0
  106. package/dist/types/plugins/deploy/platforms/vercel.d.ts +2 -0
  107. package/dist/types/plugins/deploy/types.d.ts +3 -0
  108. package/dist/types/plugins/deploy/utils/generator.d.ts +24 -0
  109. package/dist/types/plugins/deploy/utils/index.d.ts +16 -0
  110. package/dist/types/plugins/initialize/index.d.ts +3 -0
  111. package/dist/types/plugins/serverBuild.d.ts +3 -0
  112. package/dist/types/plugins/serverRuntime.d.ts +3 -0
  113. package/dist/types/presetUltramodern.d.ts +6 -0
  114. package/dist/types/rsbuild.d.ts +12 -0
  115. package/dist/types/run/index.d.ts +20 -0
  116. package/dist/types/types/config/deploy.d.ts +46 -0
  117. package/dist/types/types/config/dev.d.ts +55 -0
  118. package/dist/types/types/config/experiments.d.ts +3 -0
  119. package/dist/types/types/config/html.d.ts +3 -0
  120. package/dist/types/types/config/index.d.ts +48 -0
  121. package/dist/types/types/config/output.d.ts +61 -0
  122. package/dist/types/types/config/performance.d.ts +3 -0
  123. package/dist/types/types/config/resolve.d.ts +2 -0
  124. package/dist/types/types/config/security.d.ts +2 -0
  125. package/dist/types/types/config/source.d.ts +61 -0
  126. package/dist/types/types/config/testing.d.ts +8 -0
  127. package/dist/types/types/config/tools.d.ts +21 -0
  128. package/dist/types/types/index.d.ts +10 -0
  129. package/dist/types/types/plugin.d.ts +114 -0
  130. package/dist/types/types/utils.d.ts +1 -0
  131. package/dist/types/ultramodern/designSystem.d.ts +54 -0
  132. package/dist/types/utils/config.d.ts +2 -0
  133. package/dist/types/utils/createServer.d.ts +5 -0
  134. package/dist/types/utils/env.d.ts +2 -0
  135. package/dist/types/utils/generateWatchFiles.d.ts +2 -0
  136. package/dist/types/utils/getConfigFile.d.ts +1 -0
  137. package/dist/types/utils/getSelectedEntries.d.ts +5 -0
  138. package/dist/types/utils/initAppContext.d.ts +31 -0
  139. package/dist/types/utils/loadPlugins.d.ts +13 -0
  140. package/dist/types/utils/printInstructions.d.ts +3 -0
  141. package/dist/types/utils/register.d.ts +19 -0
  142. package/dist/types/utils/restart.d.ts +2 -0
  143. package/dist/types/utils/routes.d.ts +4 -0
  144. package/dist/types/utils/types.d.ts +49 -0
  145. package/package.json +18 -17
@@ -0,0 +1,5 @@
1
+ export declare const registerPathsLoader: ({ appDir, baseUrl, paths }: {
2
+ appDir: any;
3
+ baseUrl: any;
4
+ paths: any;
5
+ }) => Promise<void>;
@@ -0,0 +1,6 @@
1
+ export declare function initialize({ appDir: currentAppDir, baseUrl, paths }: {
2
+ appDir: any;
3
+ baseUrl: any;
4
+ paths: any;
5
+ }): Promise<void>;
6
+ export declare function resolve(specifier: any, context: any, defaultResolve: any): any;
@@ -0,0 +1 @@
1
+ export type { ServerPlugin } from '@modern-js/server-core';
@@ -0,0 +1,17 @@
1
+ import type { AppTools, CliPlugin } from './types';
2
+ import { initAppContext } from './utils/initAppContext';
3
+ export * from './baseline';
4
+ export * from './defineConfig';
5
+ export * from './presetUltramodern';
6
+ export * from './ultramodern/designSystem';
7
+ export declare const appTools: () => CliPlugin<AppTools>;
8
+ export { dev } from './commands/dev';
9
+ export { serve } from './commands/serve';
10
+ export { defineConfig } from './defineConfig';
11
+ export { type ResolveModernRsbuildConfigOptions, resolveModernRsbuildConfig, } from './rsbuild';
12
+ export * from './types';
13
+ export { generateWatchFiles } from './utils/generateWatchFiles';
14
+ export type { DevOptions } from './utils/types';
15
+ export { initAppContext };
16
+ export default appTools;
17
+ export { mergeConfig } from '@modern-js/plugin/cli';
@@ -0,0 +1,44 @@
1
+ export declare const EN_LOCALE: {
2
+ command: {
3
+ shared: {
4
+ analyze: string;
5
+ config: string;
6
+ skipBuild: string;
7
+ noNeedInstall: string;
8
+ };
9
+ dev: {
10
+ describe: string;
11
+ entry: string;
12
+ apiOnly: string;
13
+ webOnly: string;
14
+ selectEntry: string;
15
+ requireEntry: string;
16
+ };
17
+ build: {
18
+ describe: string;
19
+ watch: string;
20
+ };
21
+ serve: {
22
+ describe: string;
23
+ };
24
+ deploy: {
25
+ describe: string;
26
+ };
27
+ new: {
28
+ describe: string;
29
+ debug: string;
30
+ config: string;
31
+ distTag: string;
32
+ registry: string;
33
+ lang: string;
34
+ };
35
+ inspect: {
36
+ env: string;
37
+ output: string;
38
+ verbose: string;
39
+ };
40
+ info: {
41
+ describe: string;
42
+ };
43
+ };
44
+ };
@@ -0,0 +1,3 @@
1
+ declare const i18n: any;
2
+ declare const localeKeys: any;
3
+ export { i18n, localeKeys };
@@ -0,0 +1,44 @@
1
+ export declare const ZH_LOCALE: {
2
+ command: {
3
+ shared: {
4
+ analyze: string;
5
+ config: string;
6
+ skipBuild: string;
7
+ noNeedInstall: string;
8
+ };
9
+ dev: {
10
+ describe: string;
11
+ entry: string;
12
+ apiOnly: string;
13
+ webOnly: string;
14
+ selectEntry: string;
15
+ requireEntry: string;
16
+ };
17
+ build: {
18
+ describe: string;
19
+ watch: string;
20
+ };
21
+ serve: {
22
+ describe: string;
23
+ };
24
+ deploy: {
25
+ describe: string;
26
+ };
27
+ new: {
28
+ describe: string;
29
+ debug: string;
30
+ config: string;
31
+ distTag: string;
32
+ registry: string;
33
+ lang: string;
34
+ };
35
+ inspect: {
36
+ env: string;
37
+ output: string;
38
+ verbose: string;
39
+ };
40
+ info: {
41
+ describe: string;
42
+ };
43
+ };
44
+ };
@@ -0,0 +1,3 @@
1
+ export declare const ENTRY_FILE_NAME = "entry";
2
+ export declare const HTML_PARTIALS_FOLDER = "html";
3
+ export declare const HTML_PARTIALS_EXTENSIONS: string[];
@@ -0,0 +1,4 @@
1
+ import type { Entrypoint } from '@modern-js/types';
2
+ import type { AppNormalizedConfig } from '../../types';
3
+ import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
4
+ export declare const getBundleEntry: (hooks: AppToolsHooks, appContext: AppToolsContext, config: AppNormalizedConfig) => Promise<Entrypoint[]>;
@@ -0,0 +1,7 @@
1
+ import type { Entrypoint } from '@modern-js/types';
2
+ import type { AppNormalizedConfig } from '../../types';
3
+ import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
4
+ export type { Entrypoint };
5
+ export declare const hasEntry: (dir: string) => any;
6
+ export declare const hasServerEntry: (dir: string) => any;
7
+ export declare const getFileSystemEntry: (hooks: AppToolsHooks, appContext: AppToolsContext, config: AppNormalizedConfig) => Promise<Entrypoint[]>;
@@ -0,0 +1,27 @@
1
+ import type { Entrypoint, HtmlPartials, HtmlTemplates } from '@modern-js/types';
2
+ import type { AppNormalizedConfig } from '../../types';
3
+ import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
4
+ export declare const getModifyHtmlPartials: (partials: Record<keyof HtmlPartials, string[]>) => {
5
+ top: {
6
+ append: (...script: string[]) => void;
7
+ prepend: (...script: string[]) => void;
8
+ current: string[];
9
+ };
10
+ head: {
11
+ append: (...script: string[]) => void;
12
+ prepend: (...script: string[]) => void;
13
+ current: string[];
14
+ };
15
+ body: {
16
+ append: (...script: string[]) => void;
17
+ prepend: (...script: string[]) => void;
18
+ current: string[];
19
+ };
20
+ };
21
+ export declare const getHtmlTemplate: (entrypoints: Entrypoint[], hooks: AppToolsHooks, { appContext, config, }: {
22
+ appContext: AppToolsContext;
23
+ config: AppNormalizedConfig;
24
+ }) => Promise<{
25
+ partialsByEntrypoint: Record<string, HtmlPartials>;
26
+ htmlTemplates: HtmlTemplates;
27
+ }>;
@@ -0,0 +1,8 @@
1
+ import type { Entrypoint, ServerRoute } from '@modern-js/types';
2
+ import type { AppNormalizedConfig } from '../../types';
3
+ import type { AppToolsContext } from '../../types/plugin';
4
+ export declare const getServerRoutes: (entrypoints: Entrypoint[], { appContext, config, }: {
5
+ appContext: AppToolsContext;
6
+ config: AppNormalizedConfig;
7
+ }) => ServerRoute[];
8
+ export declare const getProdServerRoutes: (distDirectory: string) => any;
@@ -0,0 +1,3 @@
1
+ import type { AppTools, CliPlugin } from '../../types';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const isDefaultExportFunction: (file: string | false) => boolean;
@@ -0,0 +1,5 @@
1
+ export declare const html: (partials: {
2
+ top: string[];
3
+ head: string[];
4
+ body: string[];
5
+ }) => string;
@@ -0,0 +1,10 @@
1
+ export declare const walkDirectory: (dir: string) => string[];
2
+ export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => any;
3
+ export declare const parseModule: ({ source, filename, }: {
4
+ source: string;
5
+ filename: string;
6
+ }) => Promise<readonly [imports: readonly import("es-module-lexer").ImportSpecifier[], exports: readonly import("es-module-lexer").ExportSpecifier[], facade: boolean, hasModuleSyntax: boolean]>;
7
+ export declare const getServerCombinedModuleFile: (internalDirectory: string, entryName: string) => string;
8
+ export declare const checkIsBuildCommands: () => boolean;
9
+ export declare const checkIsServeCommand: () => boolean;
10
+ export declare const isSubDirOrEqual: (parent: string, child: string) => boolean;
@@ -0,0 +1,6 @@
1
+ import type { AppTools, AppToolsNormalizedConfig, CliPlugin } from '../../types';
2
+ import type { DeployTarget } from '../../types/config/deploy';
3
+ export declare const getSupportedDeployTargets: () => DeployTarget[];
4
+ export declare const resolveDeployTarget: (modernConfig: AppToolsNormalizedConfig, envDeployTarget?: string | undefined, detectedProvider?: import("std-env").ProviderName) => string;
5
+ declare const _default: () => CliPlugin<AppTools>;
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import type { CreatePreset } from './platform';
2
+ export declare const createCloudflarePreset: CreatePreset;
@@ -0,0 +1,2 @@
1
+ import type { CreatePreset } from './platform';
2
+ export declare const createGhPagesPreset: CreatePreset;
@@ -0,0 +1,2 @@
1
+ import type { CreatePreset } from './platform';
2
+ export declare const createNetlifyPreset: CreatePreset;
@@ -0,0 +1,2 @@
1
+ import type { CreatePreset } from './platform';
2
+ export declare const createNodePreset: CreatePreset;
@@ -0,0 +1,17 @@
1
+ import type { AppToolsNormalizedConfig } from '../../../types';
2
+ import type { AppToolsContext } from '../../../types/plugin';
3
+ import type { PluginAPI } from '../types';
4
+ interface CreatePresetParams {
5
+ appContext: AppToolsContext;
6
+ modernConfig: AppToolsNormalizedConfig;
7
+ api: PluginAPI;
8
+ needModernServer?: boolean;
9
+ }
10
+ export type CreatePreset = (params: CreatePresetParams) => DeployPreset;
11
+ type DeployPreset = {
12
+ prepare?: () => Promise<void>;
13
+ writeOutput?: () => Promise<void>;
14
+ genEntry?: () => Promise<void>;
15
+ end?: () => Promise<void>;
16
+ };
17
+ export {};
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ fetch(request: any, env: any, ctx: any): Promise<Response>;
3
+ };
4
+ export default _default;
@@ -0,0 +1,5 @@
1
+ export declare const readFile: () => Promise<never>;
2
+ declare const _default: {
3
+ readFile: () => Promise<never>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ export declare function ChunkExtractorManager({ extractor, children }: {
3
+ children: any;
4
+ extractor: any;
5
+ }): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
6
+ export declare class ChunkExtractor {
7
+ namespace: string;
8
+ stats: any;
9
+ publicPath: any;
10
+ outputPath: any;
11
+ entrypoints: string[];
12
+ chunks: any[];
13
+ constructor({ stats, entrypoints, namespace, outputPath, publicPath, }?: {
14
+ entrypoints?: string[] | undefined;
15
+ namespace?: string | undefined;
16
+ outputPath?: string | undefined;
17
+ });
18
+ addChunk(chunk: any): void;
19
+ collectChunks(app: any): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
20
+ getChunkGroup(chunk: any): any;
21
+ getChunkInfo(chunkId: any): any;
22
+ resolvePublicUrl(filename: any): string;
23
+ createChunkAsset({ filename, chunk, type, linkType }: {
24
+ chunk: any;
25
+ filename: any;
26
+ linkType: any;
27
+ type: any;
28
+ }): {
29
+ filename: any;
30
+ integrity: any;
31
+ scriptType: string;
32
+ chunk: any;
33
+ url: string;
34
+ path: string;
35
+ type: any;
36
+ linkType: any;
37
+ } | undefined;
38
+ getChunkAssets(chunks: any): any;
39
+ getChunkChildAssets(chunks: any, type: any): any;
40
+ getChunkDependencies(chunks: any): any;
41
+ getRequiredChunksScriptContent(): string;
42
+ getRequiredChunksNamesScriptContent(): string;
43
+ getRequiredChunksScriptTag(extraProps?: {}): string;
44
+ getMainAssets(scriptType: any): any;
45
+ getScriptTags(extraProps?: {}): string;
46
+ getStyleTags(extraProps?: {}): any;
47
+ getLinkTags(extraProps?: {}): any;
48
+ }
@@ -0,0 +1,21 @@
1
+ export declare const sep = "/";
2
+ export declare const delimiter = ":";
3
+ export declare function isAbsolute(filePath: any): boolean;
4
+ export declare function normalize(filePath: any): string;
5
+ export declare function join(...segments: any[]): string;
6
+ export declare function resolve(...segments: any[]): string;
7
+ export declare function dirname(filePath: any): string;
8
+ export declare function basename(filePath: any, suffix?: string): string;
9
+ export declare function extname(filePath: any): string;
10
+ declare const _default: {
11
+ basename: typeof basename;
12
+ delimiter: string;
13
+ dirname: typeof dirname;
14
+ extname: typeof extname;
15
+ isAbsolute: typeof isAbsolute;
16
+ join: typeof join;
17
+ normalize: typeof normalize;
18
+ resolve: typeof resolve;
19
+ sep: string;
20
+ };
21
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const handler: (request: any, context: any) => Promise<any>;
2
+ export { handler as default };
@@ -0,0 +1,2 @@
1
+ declare const handler: (request: any, context: any) => Promise<any>;
2
+ export default handler;
@@ -0,0 +1,2 @@
1
+ declare const handler: (req: any, res: any) => Promise<any>;
2
+ export = handler;
@@ -0,0 +1,2 @@
1
+ declare const handler: (req: any, res: any) => Promise<any>;
2
+ export default handler;
@@ -0,0 +1,2 @@
1
+ import type { CreatePreset } from './platform';
2
+ export declare const createVercelPreset: CreatePreset;
@@ -0,0 +1,3 @@
1
+ import type { AppTools, CliPlugin } from '../../types';
2
+ export type Setup = NonNullable<CliPlugin<AppTools>['setup']>;
3
+ export type PluginAPI = Parameters<Setup>[0];
@@ -0,0 +1,24 @@
1
+ import type { ProdServerOptions } from '@modern-js/prod-server';
2
+ import type { AppToolsNormalizedConfig } from '../../../types';
3
+ import type { AppToolsContext } from '../../../types/plugin';
4
+ export declare const serverAppContextTemplate: (appContext: AppToolsContext) => {
5
+ sharedDirectory: string;
6
+ apiDirectory: string;
7
+ lambdaDirectory: string;
8
+ metaName: any;
9
+ bffRuntimeFramework: any;
10
+ };
11
+ export type PluginItem = [string, Record<string, any> | undefined];
12
+ export declare const genPluginImportsCode: (plugins: PluginItem[], isESM?: boolean) => string;
13
+ export declare const getPluginsCode: (plugins: PluginItem[]) => string;
14
+ export declare const getServerConfigPath: (meta: string) => string;
15
+ export interface GenerateHandlerOptions {
16
+ template: string;
17
+ appContext: AppToolsContext;
18
+ config: AppToolsNormalizedConfig;
19
+ serverConfig?: Partial<ProdServerOptions>;
20
+ genAppContextTemplate?: typeof serverAppContextTemplate;
21
+ genPluginImports?: typeof genPluginImportsCode;
22
+ isESM?: boolean;
23
+ }
24
+ export declare const generateHandler: ({ template, appContext, config, serverConfig: modifyServerConfig, genAppContextTemplate, genPluginImports, isESM, }: GenerateHandlerOptions) => Promise<string>;
@@ -0,0 +1,16 @@
1
+ export type ServerAppContext = {
2
+ sharedDirectory: string;
3
+ apiDirectory: string;
4
+ lambdaDirectory: string;
5
+ metaName: string;
6
+ bffRuntimeFramework: string;
7
+ };
8
+ export declare const normalizePath: (filePath: string) => string;
9
+ export declare const getProjectUsage: (appDirectory: string, distDirectory: string, metaName: string) => {
10
+ useSSR: boolean;
11
+ useAPI: boolean;
12
+ useWebServer: boolean;
13
+ };
14
+ export declare const getTemplatePath: (file: string) => string;
15
+ export declare const readTemplate: (file: string) => Promise<any>;
16
+ export declare const resolveESMDependency: (entry: string) => Promise<string | undefined>;
@@ -0,0 +1,3 @@
1
+ import type { AppTools, CliPlugin } from '../../types';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { AppTools, CliPlugin } from '../types';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { AppTools, CliPlugin } from '../types';
2
+ declare const _default: () => CliPlugin<AppTools>;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { type AppBaselineOptions } from './baseline';
2
+ import type { AppUserConfig } from './types';
3
+ export interface PresetUltramodernOptions extends AppBaselineOptions {
4
+ }
5
+ export declare const createPresetUltramodernConfig: (options?: PresetUltramodernOptions) => AppUserConfig;
6
+ export declare const presetUltramodern: (config: AppUserConfig, options?: PresetUltramodernOptions) => AppUserConfig;
@@ -0,0 +1,12 @@
1
+ import type { AppUserConfig } from './types';
2
+ type ResolveModernRsbuildConfigOptions = {
3
+ command: string;
4
+ configPath?: string;
5
+ cwd?: string;
6
+ metaName?: string;
7
+ modifyModernConfig?: (config: AppUserConfig) => AppUserConfig | Promise<AppUserConfig>;
8
+ };
9
+ export declare function resolveModernRsbuildConfig(options: ResolveModernRsbuildConfigOptions): Promise<{
10
+ rsbuildConfig: any;
11
+ }>;
12
+ export type { ResolveModernRsbuildConfigOptions };
@@ -0,0 +1,20 @@
1
+ import type { InternalPlugins } from '@modern-js/types';
2
+ import { handleSetupResult } from '../compat/hooks';
3
+ export interface RunOptions {
4
+ cwd?: string;
5
+ configFile?: string;
6
+ metaName?: string;
7
+ statePluginName?: string;
8
+ internalPlugins?: InternalPlugins;
9
+ initialLog?: string;
10
+ version: string;
11
+ }
12
+ export declare function createRunOptions({ cwd, initialLog, metaName, version, internalPlugins, configFile, }: RunOptions): Promise<{
13
+ cwd: string | undefined;
14
+ initialLog: string;
15
+ configFile: string;
16
+ metaName: string;
17
+ internalPlugins: any;
18
+ handleSetupResult: typeof handleSetupResult;
19
+ }>;
20
+ export declare function run(options: RunOptions): Promise<void>;
@@ -0,0 +1,46 @@
1
+ export interface MicroFrontend {
2
+ /**
3
+ * Specifies whether to enable the HTML entry.
4
+ * When set to `true`, the current child application will be externalized for `react` and `react-dom`.
5
+ * @default true
6
+ */
7
+ enableHtmlEntry?: boolean;
8
+ /**
9
+ * Specifies whether to use the external base library.
10
+ * @default false
11
+ */
12
+ externalBasicLibrary?: boolean;
13
+ moduleApp?: string;
14
+ /**
15
+ * Runtime compatibility digest exposed in remote contracts (manifest / remote entry).
16
+ */
17
+ runtimeDigest?: string;
18
+ /**
19
+ * SRI-style integrity token for the remote entry contract.
20
+ * Example: `sha256-<base64Digest>`.
21
+ */
22
+ integrity?: string;
23
+ /**
24
+ * Opaque attestation token exposed in remote runtime metadata.
25
+ * Can be validated by the host via runtime `remoteTrust.attestations`.
26
+ */
27
+ attestation?: string;
28
+ }
29
+ export type DeployTarget = 'node' | 'vercel' | 'netlify' | 'ghPages' | 'cloudflare';
30
+ export interface DeployUserConfig {
31
+ /**
32
+ * Selects the deploy output preset.
33
+ * `MODERNJS_DEPLOY` still overrides provider auto-detection when set.
34
+ * @default node
35
+ */
36
+ target?: DeployTarget;
37
+ /**
38
+ * Used to configure micro-frontend sub-application information.
39
+ * @default false
40
+ */
41
+ microFrontend?: boolean | MicroFrontend;
42
+ worker?: {
43
+ name?: string;
44
+ ssr?: boolean;
45
+ };
46
+ }
@@ -0,0 +1,55 @@
1
+ import type { BuilderConfig } from '@modern-js/builder';
2
+ import type { CorsOptions, SetupMiddlewares } from '@modern-js/server';
3
+ import type { ServerConfig } from '@rsbuild/core';
4
+ type BuilderDevConfig = NonNullable<BuilderConfig['dev']>;
5
+ export type DevProxyOptions = string | Record<string, string>;
6
+ export interface DevServerUserConfig {
7
+ /**
8
+ * Configure CORS for the dev server.
9
+ * - object: enable CORS with the specified options.
10
+ * - true: enable CORS with default options (allow all origins, not recommended).
11
+ * - false: disable CORS.
12
+ * @default
13
+ * ```js
14
+ * { origin: defaultAllowedOrigins }
15
+ * ```
16
+ * where `defaultAllowedOrigins` includes:
17
+ * - `localhost`
18
+ * - `127.0.0.1`
19
+ *
20
+ * @link https://github.com/expressjs/cors
21
+ */
22
+ cors?: boolean | CorsOptions;
23
+ /**
24
+ * Whether to enable gzip compression for served static assets.
25
+ */
26
+ compress?: ServerConfig['compress'];
27
+ /**
28
+ * Adds headers to all responses.
29
+ */
30
+ headers?: ServerConfig['headers'];
31
+ /**
32
+ * The index.html page will likely have to be served in place of any 404 responses.
33
+ */
34
+ historyApiFallback?: ServerConfig['historyApiFallback'];
35
+ /**
36
+ * Proxying some URLs.
37
+ */
38
+ proxy?: ServerConfig['proxy'];
39
+ /**
40
+ * Whether to watch files change in directories such as `mock/`, `server/`, `api/`.
41
+ */
42
+ watch?: boolean;
43
+ }
44
+ /**
45
+ * setupMiddlewares is a special field, it will not be passed to Rsbuild.
46
+ * Although its name is the same as in Rsbuild, it is consumed by Modern.js.
47
+ */
48
+ export type DevUserConfig = Omit<BuilderDevConfig, 'setupMiddlewares'> & {
49
+ setupMiddlewares?: SetupMiddlewares;
50
+ /**
51
+ * Dev server specific options.
52
+ */
53
+ server?: DevServerUserConfig;
54
+ };
55
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { BuilderConfig } from '@modern-js/builder';
2
+ export type BuilderExperimentsConfig = Required<BuilderConfig>['experiments'];
3
+ export type ExperimentsUserConfig = BuilderExperimentsConfig;
@@ -0,0 +1,3 @@
1
+ import type { BuilderConfig } from '@modern-js/builder';
2
+ import type { UnwrapBuilderConfig } from '../utils';
3
+ export type HtmlUserConfig = UnwrapBuilderConfig<BuilderConfig, 'html'>;
@@ -0,0 +1,48 @@
1
+ import type { CLIPlugin, CLIPluginExtends } from '@modern-js/plugin';
2
+ import type { BffUserConfig, ServerUserConfig } from '@modern-js/server-core';
3
+ import type { RsbuildConfig } from '@rsbuild/core';
4
+ import type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks } from '../plugin';
5
+ import type { DeployUserConfig } from './deploy';
6
+ import type { DevUserConfig } from './dev';
7
+ import type { ExperimentsUserConfig } from './experiments';
8
+ import type { HtmlUserConfig } from './html';
9
+ import type { OutputUserConfig } from './output';
10
+ import type { PerformanceUserConfig } from './performance';
11
+ import type { ResolveUserConfig } from './resolve';
12
+ import type { SecurityUserConfig } from './security';
13
+ import type { SourceUserConfig } from './source';
14
+ import type { TestingUserConfig } from './testing';
15
+ import type { ToolsUserConfig } from './tools';
16
+ export * from './output';
17
+ export type AppToolsBuilderPlugins = NonNullable<RsbuildConfig['plugins']>;
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'];
40
+ plugins?: CliPlugin<AppTools>[];
41
+ }
42
+ interface SharedNormalizedConfig<RawConfig> {
43
+ cliOptions?: Record<string, any>;
44
+ _raw: RawConfig;
45
+ }
46
+ export type AppToolsNormalizedConfig<Config = AppToolsUserConfig> = Required<Config> & SharedNormalizedConfig<Config>;
47
+ export type AppTools = Required<CLIPluginExtends<AppToolsUserConfig, AppToolsNormalizedConfig, AppToolsExtendContext, AppToolsExtendAPI, AppToolsExtendHooks>>;
48
+ export type CliPlugin<Extends extends CLIPluginExtends> = CLIPlugin<Extends>;