@bleedingdev/modern-js-app-tools 3.2.0-ultramodern.99 → 3.4.0-ultramodern.0

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 (165) hide show
  1. package/dist/cjs/baseline.js +12 -92
  2. package/dist/cjs/builder/builder-rspack/index.js +9 -5
  3. package/dist/cjs/builder/generator/adapterCopy.js +9 -5
  4. package/dist/cjs/builder/generator/createBuilderProviderConfig.js +9 -5
  5. package/dist/cjs/builder/generator/createCopyPattern.js +9 -5
  6. package/dist/cjs/builder/generator/getBuilderEnvironments.js +41 -9
  7. package/dist/cjs/builder/generator/index.js +16 -5
  8. package/dist/cjs/builder/index.js +9 -5
  9. package/dist/cjs/builder/shared/builderPlugins/adapterBasic.js +9 -5
  10. package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +10 -6
  11. package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +9 -5
  12. package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +39 -9
  13. package/dist/cjs/builder/shared/builderPlugins/builderHooks.js +12 -8
  14. package/dist/cjs/builder/shared/builderPlugins/index.js +9 -5
  15. package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +9 -5
  16. package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +12 -8
  17. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +41 -8
  18. package/dist/cjs/builder/shared/bundlerPlugins/index.js +9 -5
  19. package/dist/cjs/builder/shared/createCopyInfo.js +9 -5
  20. package/dist/cjs/builder/shared/index.js +9 -5
  21. package/dist/cjs/builder/shared/lazyCompilation.js +94 -0
  22. package/dist/cjs/builder/shared/loaders/serverModuleLoader.js +12 -8
  23. package/dist/cjs/commands/build.js +9 -5
  24. package/dist/cjs/commands/deploy.js +9 -5
  25. package/dist/cjs/commands/dev.js +9 -5
  26. package/dist/cjs/commands/index.js +12 -11
  27. package/dist/cjs/commands/info.js +9 -5
  28. package/dist/cjs/commands/inspect.js +12 -8
  29. package/dist/cjs/commands/runtime.js +50 -13
  30. package/dist/cjs/commands/serve.js +9 -5
  31. package/dist/cjs/compat/hooks.js +9 -5
  32. package/dist/cjs/compat/index.js +9 -5
  33. package/dist/cjs/compat/utils.js +9 -5
  34. package/dist/cjs/config/default.js +27 -7
  35. package/dist/cjs/config/index.js +9 -5
  36. package/dist/cjs/config/initialize/index.js +9 -5
  37. package/dist/cjs/config/initialize/inits.js +9 -5
  38. package/dist/cjs/constants.js +13 -9
  39. package/dist/cjs/defineConfig.js +12 -8
  40. package/dist/cjs/esm/register-esm.js +12 -8
  41. package/dist/cjs/esm/ts-paths-loader.js +9 -5
  42. package/dist/cjs/index.js +23 -17
  43. package/dist/cjs/locale/en.js +12 -8
  44. package/dist/cjs/locale/index.js +9 -5
  45. package/dist/cjs/locale/zh.js +12 -8
  46. package/dist/cjs/plugins/analyze/constants.js +14 -10
  47. package/dist/cjs/plugins/analyze/getBundleEntry.js +9 -5
  48. package/dist/cjs/plugins/analyze/getFileSystemEntry.js +9 -5
  49. package/dist/cjs/plugins/analyze/getHtmlTemplate.js +9 -5
  50. package/dist/cjs/plugins/analyze/getServerRoutes.js +9 -5
  51. package/dist/cjs/plugins/analyze/index.js +12 -6
  52. package/dist/cjs/plugins/analyze/isDefaultExportFunction.js +10 -6
  53. package/dist/cjs/plugins/analyze/templates.js +12 -8
  54. package/dist/cjs/plugins/analyze/utils.js +9 -5
  55. package/dist/cjs/plugins/deploy/index.js +9 -5
  56. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +185 -7
  57. package/dist/cjs/plugins/deploy/platforms/gh-pages.js +9 -5
  58. package/dist/cjs/plugins/deploy/platforms/netlify.js +9 -5
  59. package/dist/cjs/plugins/deploy/platforms/node.js +9 -5
  60. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +141 -16
  61. package/dist/cjs/plugins/deploy/platforms/vercel.js +9 -5
  62. package/dist/cjs/plugins/deploy/utils/generator.js +9 -5
  63. package/dist/cjs/plugins/deploy/utils/index.js +19 -40
  64. package/dist/cjs/plugins/initialize/index.js +19 -6
  65. package/dist/cjs/plugins/serverBuild.js +9 -5
  66. package/dist/cjs/plugins/serverRuntime.js +12 -8
  67. package/dist/cjs/presetUltramodern.js +96 -7
  68. package/dist/cjs/rsbuild.js +55 -67
  69. package/dist/cjs/run/index.js +9 -5
  70. package/dist/cjs/types/config/cloudflareDeploy.js +18 -0
  71. package/dist/cjs/types/config/index.js +9 -5
  72. package/dist/cjs/types/config/precompress.js +18 -0
  73. package/dist/cjs/types/index.js +9 -5
  74. package/dist/cjs/ultramodern/designSystem.js +16 -12
  75. package/dist/cjs/utils/config.js +9 -5
  76. package/dist/cjs/utils/createServer.js +14 -10
  77. package/dist/cjs/utils/env.js +9 -5
  78. package/dist/cjs/utils/generateWatchFiles.js +9 -5
  79. package/dist/cjs/utils/getConfigFile.js +9 -5
  80. package/dist/cjs/utils/getSelectedEntries.js +9 -5
  81. package/dist/cjs/utils/initAppContext.js +9 -5
  82. package/dist/cjs/utils/loadPlugins.js +9 -5
  83. package/dist/cjs/utils/printInstructions.js +9 -5
  84. package/dist/cjs/utils/register.js +9 -5
  85. package/dist/cjs/utils/restart.js +9 -5
  86. package/dist/cjs/utils/routes.js +9 -5
  87. package/dist/esm/baseline.mjs +3 -77
  88. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +32 -4
  89. package/dist/esm/builder/generator/index.mjs +7 -0
  90. package/dist/esm/builder/shared/builderPlugins/adapterHtml.mjs +1 -1
  91. package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +31 -5
  92. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.mjs +32 -3
  93. package/dist/esm/builder/shared/lazyCompilation.mjs +44 -0
  94. package/dist/esm/commands/index.mjs +2 -5
  95. package/dist/esm/commands/runtime.mjs +33 -3
  96. package/dist/esm/config/default.mjs +14 -1
  97. package/dist/esm/index.mjs +3 -2
  98. package/dist/esm/plugins/analyze/index.mjs +3 -1
  99. package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +1 -1
  100. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +176 -2
  101. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +141 -16
  102. package/dist/esm/plugins/deploy/utils/index.mjs +11 -36
  103. package/dist/esm/plugins/initialize/index.mjs +11 -2
  104. package/dist/esm/presetUltramodern.mjs +77 -3
  105. package/dist/esm/rsbuild.mjs +1 -8
  106. package/dist/esm/types/config/cloudflareDeploy.mjs +0 -0
  107. package/dist/esm/types/config/precompress.mjs +0 -0
  108. package/dist/esm-node/baseline.mjs +3 -77
  109. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +32 -4
  110. package/dist/esm-node/builder/generator/index.mjs +7 -0
  111. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.mjs +1 -1
  112. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +31 -5
  113. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.mjs +32 -3
  114. package/dist/esm-node/builder/shared/lazyCompilation.mjs +45 -0
  115. package/dist/esm-node/commands/index.mjs +2 -5
  116. package/dist/esm-node/commands/runtime.mjs +33 -3
  117. package/dist/esm-node/config/default.mjs +14 -1
  118. package/dist/esm-node/index.mjs +3 -2
  119. package/dist/esm-node/plugins/analyze/index.mjs +3 -1
  120. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +1 -1
  121. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +176 -2
  122. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +141 -16
  123. package/dist/esm-node/plugins/deploy/utils/index.mjs +12 -36
  124. package/dist/esm-node/plugins/initialize/index.mjs +11 -2
  125. package/dist/esm-node/presetUltramodern.mjs +77 -3
  126. package/dist/esm-node/rsbuild.mjs +1 -8
  127. package/dist/esm-node/types/config/cloudflareDeploy.mjs +1 -0
  128. package/dist/esm-node/types/config/precompress.mjs +1 -0
  129. package/dist/types/baseline.d.ts +16 -46
  130. package/dist/types/builder/builder-rspack/index.d.ts +1 -1
  131. package/dist/types/builder/generator/index.d.ts +1 -1
  132. package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +3 -1
  133. package/dist/types/builder/shared/createCopyInfo.d.ts +1 -1
  134. package/dist/types/builder/shared/lazyCompilation.d.ts +43 -0
  135. package/dist/types/builder/shared/types.d.ts +10 -0
  136. package/dist/types/commands/index.d.ts +1 -1
  137. package/dist/types/commands/inspect.d.ts +1 -1
  138. package/dist/types/commands/runtime.d.ts +1 -0
  139. package/dist/types/config/default.d.ts +6 -0
  140. package/dist/types/locale/index.d.ts +89 -2
  141. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +2 -2
  142. package/dist/types/plugins/analyze/index.d.ts +1 -1
  143. package/dist/types/plugins/analyze/utils.d.ts +1 -1
  144. package/dist/types/plugins/deploy/index.d.ts +1 -1
  145. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.d.mts +1 -1
  146. package/dist/types/plugins/deploy/platforms/templates/netlify-entry.d.cts +1 -1
  147. package/dist/types/plugins/deploy/platforms/templates/vercel-entry.d.cts +1 -1
  148. package/dist/types/plugins/deploy/utils/generator.d.ts +2 -2
  149. package/dist/types/plugins/deploy/utils/index.d.ts +1 -1
  150. package/dist/types/plugins/initialize/index.d.ts +1 -1
  151. package/dist/types/plugins/serverBuild.d.ts +1 -1
  152. package/dist/types/plugins/serverRuntime.d.ts +1 -1
  153. package/dist/types/presetUltramodern.d.ts +52 -2
  154. package/dist/types/rsbuild.d.ts +1 -1
  155. package/dist/types/run/index.d.ts +1 -1
  156. package/dist/types/types/config/cloudflareDeploy.d.ts +79 -0
  157. package/dist/types/types/config/deploy.d.ts +9 -15
  158. package/dist/types/types/config/output.d.ts +4 -20
  159. package/dist/types/types/config/precompress.d.ts +20 -0
  160. package/dist/types/types/plugin.d.ts +20 -0
  161. package/dist/types/utils/getConfigFile.d.ts +1 -1
  162. package/dist/types/utils/loadPlugins.d.ts +2 -2
  163. package/package.json +26 -21
  164. package/dist/esm/rslib-runtime.mjs +0 -18
  165. package/dist/esm-node/rslib-runtime.mjs +0 -19
@@ -1,46 +1,16 @@
1
- import type { AppUserConfig } from './types';
2
- export interface AppBaselineOptions {
3
- /**
4
- * Stable producer identity used by BFF cross-project clients.
5
- * @default "app"
6
- */
7
- appId?: string;
8
- /**
9
- * Enable BFF requestId contract by default.
10
- * @default true
11
- */
12
- enableBffRequestId?: boolean;
13
- /**
14
- * Enable telemetry contract by default.
15
- * Exporters are still configured separately by applications.
16
- * @default true
17
- */
18
- enableTelemetry?: boolean;
19
- /**
20
- * Enable telemetry exporters by default.
21
- * @default true
22
- */
23
- enableTelemetryExporters?: boolean;
24
- /**
25
- * OTLP exporter endpoint.
26
- * @default process.env.MODERN_TELEMETRY_OTLP_ENDPOINT || 'http://127.0.0.1:4318/v1/logs'
27
- */
28
- otlpEndpoint?: string;
29
- /**
30
- * VictoriaMetrics exporter endpoint.
31
- * @default process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT || 'http://127.0.0.1:8428/api/v1/import/prometheus'
32
- */
33
- victoriaMetricsEndpoint?: string;
34
- /**
35
- * Enable fail-loud startup probing for telemetry exporters.
36
- * @default true
37
- */
38
- telemetryFailLoudStartup?: boolean;
39
- /**
40
- * Enable app-level Module Federation SSR handshake by default.
41
- * @default true
42
- */
43
- enableModuleFederationSSR?: boolean;
44
- }
45
- export declare const createAppBaselineConfig: (options?: AppBaselineOptions) => AppUserConfig;
46
- export declare const withAppBaseline: (config: AppUserConfig, options?: AppBaselineOptions) => AppUserConfig;
1
+ import { type PresetUltramodernOptions } from './presetUltramodern';
2
+ /**
3
+ * @deprecated Use `PresetUltramodernOptions` from `@modern-js/app-tools`
4
+ * instead. This alias will be removed in a future release.
5
+ */
6
+ export type AppBaselineOptions = PresetUltramodernOptions;
7
+ /**
8
+ * @deprecated Use `createPresetUltramodernConfig` from `@modern-js/app-tools`
9
+ * instead. This alias will be removed in a future release.
10
+ */
11
+ export declare const createAppBaselineConfig: (options?: PresetUltramodernOptions) => import("./types").AppUserConfig;
12
+ /**
13
+ * @deprecated Use `presetUltramodern` from `@modern-js/app-tools` instead.
14
+ * This alias will be removed in a future release.
15
+ */
16
+ export declare const withAppBaseline: (config: import("./types").AppUserConfig, options?: PresetUltramodernOptions) => import("./types").AppUserConfig;
@@ -1,2 +1,2 @@
1
1
  import type { BuilderOptions } from '../shared';
2
- export declare function createRspackBuilderForModern(options: BuilderOptions): Promise<any>;
2
+ export declare function createRspackBuilderForModern(options: BuilderOptions): Promise<import("@rsbuild/core").RsbuildInstance>;
@@ -5,4 +5,4 @@ import type { BuilderOptions } from '../shared';
5
5
  * @param bundlerType BundlerType
6
6
  * @returns BuilderInstance
7
7
  */
8
- export declare function generateBuilder(options: BuilderOptions, bundlerType: BundlerType): Promise<any>;
8
+ export declare function generateBuilder(options: BuilderOptions, bundlerType: BundlerType): Promise<import("@rsbuild/core").RsbuildInstance>;
@@ -14,6 +14,7 @@ type Options = {
14
14
  disableFilenameHash?: boolean;
15
15
  scriptLoading?: ScriptLoading;
16
16
  nonce?: string;
17
+ useRsc?: boolean;
17
18
  };
18
19
  export declare class RouterPlugin {
19
20
  readonly name: string;
@@ -23,7 +24,8 @@ export declare class RouterPlugin {
23
24
  private disableFilenameHash?;
24
25
  private scriptLoading?;
25
26
  private nonce?;
26
- constructor({ staticJsDir, HtmlBundlerPlugin, enableInlineRouteManifests, disableFilenameHash, scriptLoading, nonce, }: Options);
27
+ private useRsc;
28
+ constructor({ staticJsDir, HtmlBundlerPlugin, enableInlineRouteManifests, disableFilenameHash, scriptLoading, nonce, useRsc, }: Options);
27
29
  private isTargetNodeOrWebWorker;
28
30
  private getEntryChunks;
29
31
  private getEntryChunkFiles;
@@ -4,5 +4,5 @@ export declare function createCopyInfo(appContext: AppToolsContext, config: AppN
4
4
  configDir: string;
5
5
  uploadDir: string;
6
6
  publicDir: string;
7
- customPublicDirs: any;
7
+ customPublicDirs: string[];
8
8
  };
@@ -0,0 +1,43 @@
1
+ import { type EagerRouteComponentFilesByEntry } from '@modern-js/utils';
2
+ export { collectRouteComponentFiles, type EagerRouteComponentFilesByEntry, normalizeModulePath, type RouteComponentFileCollection, } from '@modern-js/utils';
3
+ type ModuleLike = {
4
+ resource?: string;
5
+ };
6
+ type LazyCompilationTestFn = (m: ModuleLike) => boolean;
7
+ /** Matches Rspack's `LazyCompilationOptions['test']`. */
8
+ type LazyCompilationTest = RegExp | LazyCompilationTestFn | undefined;
9
+ export type EagerRouteComponentInfo = {
10
+ files: Set<string>;
11
+ /** Specifiers that could not be resolved, keyed by entry name. */
12
+ unresolvedByEntry: Map<string, string[]>;
13
+ };
14
+ /**
15
+ * Aggregate the per-entry route component data (collected by the router plugin
16
+ * during route generation and threaded in as
17
+ * `BuilderOptions.eagerRouteComponentFilesByEntry`) into the flat shape
18
+ * {@link planSSRLazyCompilation} expects: one Set of all route files plus the
19
+ * unresolved specifiers keyed by entry.
20
+ */
21
+ export declare function aggregateEagerRouteComponentFiles(byEntry: EagerRouteComponentFilesByEntry | undefined): EagerRouteComponentInfo;
22
+ /**
23
+ * Build a `lazyCompilation.test` that forces route component modules to compile
24
+ * eagerly (so SSR first-screen chunk/CSS injection has the assets it needs at
25
+ * render time), while delegating all other modules to the user's `test`
26
+ * (defaulting to lazy when the user did not provide one).
27
+ */
28
+ export declare function buildSSRLazyCompilationTest(eagerRouteFiles: Set<string>, userTest?: LazyCompilationTest): LazyCompilationTestFn;
29
+ export type SSRLazyPlan = {
30
+ apply: false;
31
+ unresolvedByEntry?: Map<string, string[]>;
32
+ } | {
33
+ apply: true;
34
+ lazyCompilation: Record<string, unknown>;
35
+ };
36
+ /**
37
+ * Decide whether to apply the route-eager lazy compilation for an SSR project.
38
+ * Checks unresolved route components FIRST: if any exist we cannot guarantee
39
+ * they are eager, so we skip the optimization (and surface them so the caller
40
+ * can warn) rather than silently leaving a route lazy. `current` is the
41
+ * existing `dev.lazyCompilation` value (lazy must be enabled for this to apply).
42
+ */
43
+ export declare function planSSRLazyCompilation(current: unknown, info: EagerRouteComponentInfo): SSRLazyPlan;
@@ -1,6 +1,16 @@
1
+ import type { EagerRouteComponentFilesByEntry } from '@modern-js/utils';
1
2
  import type { AppNormalizedConfig } from '../../types';
2
3
  import type { AppToolsContext } from '../../types/plugin';
3
4
  export type BuilderOptions = {
4
5
  normalizedConfig: AppNormalizedConfig;
5
6
  appContext: AppToolsContext;
7
+ /**
8
+ * Route component files collected from the FINAL file-system routes (after
9
+ * all `modifyFileSystemRoutes` consumers ran), keyed by entry name. Populated
10
+ * by the router plugin during route generation and threaded in here (read
11
+ * FRESH from the app context AFTER `generateEntryCode` runs) so the SSR
12
+ * builder plugin can force route component chunks eager under lazy
13
+ * compilation. Explicit param instead of a direct `_internalContext` read.
14
+ */
15
+ eagerRouteComponentFilesByEntry?: EagerRouteComponentFilesByEntry;
6
16
  };
@@ -7,4 +7,4 @@ export declare const serverCommand: (program: Command, api: CLIPluginAPI<AppTool
7
7
  export declare const deployCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
8
8
  export declare const inspectCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
9
9
  export declare const infoCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
10
- export declare const runtimeOperationsCommand: (program: Command, api: CLIPluginAPI<AppTools>) => Promise<void>;
10
+ export { runtimeCommand } from './runtime';
@@ -1,4 +1,4 @@
1
1
  import type { CLIPluginAPI } from '@modern-js/plugin';
2
2
  import type { AppTools } from '../types';
3
3
  import type { InspectOptions } from '../utils/types';
4
- export declare const inspect: (api: CLIPluginAPI<AppTools>, options: InspectOptions) => Promise<any>;
4
+ export declare const inspect: (api: CLIPluginAPI<AppTools>, options: InspectOptions) => Promise<import("@rsbuild/core").InspectConfigResult>;
@@ -7,5 +7,6 @@ export declare const resolveToken: ({ token, tokenEnv, }: {
7
7
  token?: string;
8
8
  tokenEnv?: string;
9
9
  }) => string | undefined;
10
+ export declare const formatRuntimeOutput: (payload: unknown, jsonOnly?: boolean) => string;
10
11
  export declare const createRuntimeFallbackSignalPayload: (options: RuntimeFallbackSignalOptions) => Record<string, unknown>;
11
12
  export declare const runtimeCommand: (program: Command, _api: CLIPluginAPI<AppTools>) => Promise<void>;
@@ -1,3 +1,9 @@
1
1
  import type { AppUserConfig } from '../types';
2
2
  import type { AppToolsContext } from '../types/plugin';
3
3
  export declare function createDefaultConfig(appContext: AppToolsContext): AppUserConfig;
4
+ /**
5
+ * Default-enable lazy compilation for pure CSR and stream SSR. Stream SSR keeps
6
+ * first-screen route assets correct via the route-eager lazyCompilation.test
7
+ * injected by the SSR builder plugin. String SSR, RSC and SSG stay disabled.
8
+ */
9
+ export declare function isLazyCompilationSafeByDefault(userConfig: Pick<AppUserConfig, 'server' | 'output'>): boolean;
@@ -1,3 +1,90 @@
1
- declare const i18n: any;
2
- declare const localeKeys: any;
1
+ import { I18n } from '@modern-js/i18n-utils';
2
+ declare const i18n: I18n;
3
+ declare const localeKeys: {
4
+ command: {
5
+ shared: {
6
+ analyze: string;
7
+ config: string;
8
+ skipBuild: string;
9
+ noNeedInstall: string;
10
+ };
11
+ dev: {
12
+ describe: string;
13
+ entry: string;
14
+ apiOnly: string;
15
+ webOnly: string;
16
+ selectEntry: string;
17
+ requireEntry: string;
18
+ };
19
+ build: {
20
+ describe: string;
21
+ watch: string;
22
+ };
23
+ serve: {
24
+ describe: string;
25
+ };
26
+ deploy: {
27
+ describe: string;
28
+ };
29
+ new: {
30
+ describe: string;
31
+ debug: string;
32
+ config: string;
33
+ distTag: string;
34
+ registry: string;
35
+ lang: string;
36
+ };
37
+ inspect: {
38
+ env: string;
39
+ output: string;
40
+ verbose: string;
41
+ };
42
+ info: {
43
+ describe: string;
44
+ };
45
+ };
46
+ } | {
47
+ command: {
48
+ shared: {
49
+ analyze: string;
50
+ config: string;
51
+ skipBuild: string;
52
+ noNeedInstall: string;
53
+ };
54
+ dev: {
55
+ describe: string;
56
+ entry: string;
57
+ apiOnly: string;
58
+ webOnly: string;
59
+ selectEntry: string;
60
+ requireEntry: string;
61
+ };
62
+ build: {
63
+ describe: string;
64
+ watch: string;
65
+ };
66
+ serve: {
67
+ describe: string;
68
+ };
69
+ deploy: {
70
+ describe: string;
71
+ };
72
+ new: {
73
+ describe: string;
74
+ debug: string;
75
+ config: string;
76
+ distTag: string;
77
+ registry: string;
78
+ lang: string;
79
+ };
80
+ inspect: {
81
+ env: string;
82
+ output: string;
83
+ verbose: string;
84
+ };
85
+ info: {
86
+ describe: string;
87
+ };
88
+ };
89
+ };
3
90
  export { i18n, localeKeys };
@@ -2,6 +2,6 @@ import type { Entrypoint } from '@modern-js/types';
2
2
  import type { AppNormalizedConfig } from '../../types';
3
3
  import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
4
4
  export type { Entrypoint };
5
- export declare const hasEntry: (dir: string) => any;
6
- export declare const hasServerEntry: (dir: string) => any;
5
+ export declare const hasEntry: (dir: string) => string | false;
6
+ export declare const hasServerEntry: (dir: string) => string | false;
7
7
  export declare const getFileSystemEntry: (hooks: AppToolsHooks, appContext: AppToolsContext, config: AppNormalizedConfig) => Promise<Entrypoint[]>;
@@ -1,3 +1,3 @@
1
1
  import type { AppTools, CliPlugin } from '../../types';
2
- declare const _default: () => CliPlugin<AppTools>;
3
2
  export default _default;
3
+ declare function _default(): CliPlugin<AppTools>;
@@ -1,5 +1,5 @@
1
1
  export declare const walkDirectory: (dir: string) => string[];
2
- export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => any;
2
+ export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
3
3
  export declare const parseModule: ({ source, filename, }: {
4
4
  source: string;
5
5
  filename: string;
@@ -2,5 +2,5 @@ import type { AppTools, AppToolsNormalizedConfig, CliPlugin } from '../../types'
2
2
  import type { DeployTarget } from '../../types/config/deploy';
3
3
  export declare const getSupportedDeployTargets: () => DeployTarget[];
4
4
  export declare const resolveDeployTarget: (modernConfig: AppToolsNormalizedConfig, envDeployTarget?: string | undefined, detectedProvider?: import("std-env").ProviderName) => string;
5
- declare const _default: () => CliPlugin<AppTools>;
6
5
  export default _default;
6
+ declare function _default(): CliPlugin<AppTools>;
@@ -1,4 +1,4 @@
1
1
  declare const _default: {
2
- fetch(request: any, env: any, ctx: any): Promise<Response>;
2
+ fetch(request: any, env: any, ctx: any): Promise<any>;
3
3
  };
4
4
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const handler: (request: any, context: any) => Promise<any>;
2
1
  export { handler as default };
2
+ declare const handler: (request: any, context: any) => Promise<any>;
@@ -1,2 +1,2 @@
1
- declare const handler: (req: any, res: any) => Promise<any>;
2
1
  export = handler;
2
+ declare const handler: (req: any, res: any) => Promise<any>;
@@ -5,8 +5,8 @@ export declare const serverAppContextTemplate: (appContext: AppToolsContext) =>
5
5
  sharedDirectory: string;
6
6
  apiDirectory: string;
7
7
  lambdaDirectory: string;
8
- metaName: any;
9
- bffRuntimeFramework: any;
8
+ metaName: string;
9
+ bffRuntimeFramework: "effect" | "hono";
10
10
  };
11
11
  export type PluginItem = [string, Record<string, any> | undefined];
12
12
  export declare const genPluginImportsCode: (plugins: PluginItem[], isESM?: boolean) => string;
@@ -12,5 +12,5 @@ export declare const getProjectUsage: (appDirectory: string, distDirectory: stri
12
12
  useWebServer: boolean;
13
13
  };
14
14
  export declare const getTemplatePath: (file: string) => string;
15
- export declare const readTemplate: (file: string) => Promise<any>;
15
+ export declare const readTemplate: (file: string) => Promise<string>;
16
16
  export declare const resolveESMDependency: (entry: string) => Promise<string | undefined>;
@@ -1,3 +1,3 @@
1
1
  import type { AppTools, CliPlugin } from '../../types';
2
- declare const _default: () => CliPlugin<AppTools>;
3
2
  export default _default;
3
+ declare function _default(): CliPlugin<AppTools>;
@@ -1,3 +1,3 @@
1
1
  import type { AppTools, CliPlugin } from '../types';
2
- declare const _default: () => CliPlugin<AppTools>;
3
2
  export default _default;
3
+ declare function _default(): CliPlugin<AppTools>;
@@ -1,3 +1,3 @@
1
1
  import type { AppTools, CliPlugin } from '../types';
2
- declare const _default: () => CliPlugin<AppTools>;
3
2
  export default _default;
3
+ declare function _default(): CliPlugin<AppTools>;
@@ -1,6 +1,56 @@
1
- import { type AppBaselineOptions } from './baseline';
2
1
  import type { AppUserConfig } from './types';
3
- export interface PresetUltramodernOptions extends AppBaselineOptions {
2
+ export interface PresetUltramodernOptions {
3
+ /**
4
+ * Stable producer identity used by BFF cross-project clients.
5
+ * @default "app"
6
+ */
7
+ appId?: string;
8
+ /**
9
+ * Enable BFF requestId contract by default.
10
+ * @default true
11
+ */
12
+ enableBffRequestId?: boolean;
13
+ /**
14
+ * Enable telemetry contract by default.
15
+ * Exporters are still configured separately by applications.
16
+ * @default true
17
+ */
18
+ enableTelemetry?: boolean;
19
+ /**
20
+ * Enable telemetry exporters.
21
+ *
22
+ * By default each exporter is enabled only when its endpoint is explicitly
23
+ * configured (via the matching option or environment variable), so a bare
24
+ * preset app boots in production without local collectors.
25
+ * Set `true` to force both exporters on with their default localhost
26
+ * endpoints, or `false` to disable exporters entirely.
27
+ * @default undefined (endpoint-driven)
28
+ */
29
+ enableTelemetryExporters?: boolean;
30
+ /**
31
+ * OTLP exporter endpoint. Setting it (or the environment variable)
32
+ * enables the OTLP exporter unless `enableTelemetryExporters` is `false`.
33
+ * @default process.env.MODERN_TELEMETRY_OTLP_ENDPOINT || 'http://127.0.0.1:4318/v1/logs'
34
+ */
35
+ otlpEndpoint?: string;
36
+ /**
37
+ * VictoriaMetrics exporter endpoint. Setting it (or the environment
38
+ * variable) enables the VictoriaMetrics exporter unless
39
+ * `enableTelemetryExporters` is `false`.
40
+ * @default process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT || 'http://127.0.0.1:8428/api/v1/import/prometheus'
41
+ */
42
+ victoriaMetricsEndpoint?: string;
43
+ /**
44
+ * Enable fail-loud startup probing for telemetry exporters.
45
+ * Probes only run for exporters that are actually enabled.
46
+ * @default true
47
+ */
48
+ telemetryFailLoudStartup?: boolean;
49
+ /**
50
+ * Enable app-level Module Federation SSR handshake by default.
51
+ * @default true
52
+ */
53
+ enableModuleFederationSSR?: boolean;
4
54
  }
5
55
  export declare const createPresetUltramodernConfig: (options?: PresetUltramodernOptions) => AppUserConfig;
6
56
  export declare const presetUltramodern: (config: AppUserConfig, options?: PresetUltramodernOptions) => AppUserConfig;
@@ -7,6 +7,6 @@ type ResolveModernRsbuildConfigOptions = {
7
7
  modifyModernConfig?: (config: AppUserConfig) => AppUserConfig | Promise<AppUserConfig>;
8
8
  };
9
9
  export declare function resolveModernRsbuildConfig(options: ResolveModernRsbuildConfigOptions): Promise<{
10
- rsbuildConfig: any;
10
+ rsbuildConfig: import("@rsbuild/core").RsbuildConfig;
11
11
  }>;
12
12
  export type { ResolveModernRsbuildConfigOptions };
@@ -14,7 +14,7 @@ export declare function createRunOptions({ cwd, initialLog, metaName, version, i
14
14
  initialLog: string;
15
15
  configFile: string;
16
16
  metaName: string;
17
- internalPlugins: any;
17
+ internalPlugins: import("@modern-js/plugin").Plugin[];
18
18
  handleSetupResult: typeof handleSetupResult;
19
19
  }>;
20
20
  export declare function run(options: RunOptions): Promise<void>;
@@ -0,0 +1,79 @@
1
+ export type DeployTarget = 'node' | 'vercel' | 'netlify' | 'ghPages' | 'cloudflare';
2
+ export type CloudflareWorkerSecurityCspMode = 'enforce' | 'report-only' | 'off';
3
+ export interface CloudflareWorkerSecurityCspConfig {
4
+ mode?: CloudflareWorkerSecurityCspMode;
5
+ directives?: Record<string, string[] | string | false>;
6
+ additionalScriptSrc?: string[];
7
+ additionalStyleSrc?: string[];
8
+ additionalConnectSrc?: string[];
9
+ additionalImgSrc?: string[];
10
+ frameAncestors?: string[] | false;
11
+ reportUri?: string;
12
+ reason?: string;
13
+ }
14
+ export interface CloudflareWorkerSecurityNoindexConfig {
15
+ workersDev?: boolean;
16
+ localhost?: boolean;
17
+ previewHostnames?: string[];
18
+ reason?: string;
19
+ }
20
+ export interface CloudflareWorkerSecurityCorsConfig {
21
+ /**
22
+ * Origins allowed to read application responses (BFF APIs, SSR HTML,
23
+ * route fallbacks) cross-origin. Accepts exact origins
24
+ * (e.g. `https://shell.example.com`) or `'*'`.
25
+ * When empty, application responses carry no CORS headers (same-origin).
26
+ * @default []
27
+ */
28
+ allowedOrigins?: string[];
29
+ /**
30
+ * Methods advertised on CORS preflight responses for application routes.
31
+ * @default ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']
32
+ */
33
+ allowedMethods?: string[];
34
+ /**
35
+ * Headers advertised on CORS preflight responses for application routes.
36
+ * @default ['*']
37
+ */
38
+ allowedHeaders?: string[];
39
+ /**
40
+ * Apply wildcard CORS to static asset responses so federated remotes
41
+ * (remote entries, manifests, CSS) can be loaded cross-origin.
42
+ * @default true
43
+ */
44
+ assets?: boolean;
45
+ reason?: string;
46
+ }
47
+ export interface CloudflareWorkerSecurityConfig {
48
+ /**
49
+ * Disable all Cloudflare worker security defaults for this app.
50
+ * Prefer narrower escape hatches when possible.
51
+ */
52
+ enabled?: boolean;
53
+ headers?: {
54
+ referrerPolicy?: string | false;
55
+ contentTypeOptions?: 'nosniff' | false;
56
+ permissionsPolicy?: string | false;
57
+ };
58
+ contentSecurityPolicy?: CloudflareWorkerSecurityCspConfig;
59
+ noindex?: boolean | CloudflareWorkerSecurityNoindexConfig;
60
+ /**
61
+ * Cross-origin resource sharing policy applied by the generated worker.
62
+ * Asset responses default to wildcard CORS for federated loading;
63
+ * application responses (BFF, SSR) default to no CORS headers.
64
+ */
65
+ cors?: CloudflareWorkerSecurityCorsConfig;
66
+ /**
67
+ * @deprecated Write-only: this option never had any runtime effect — the
68
+ * generated worker never mutates application `Set-Cookie` headers.
69
+ * Kept temporarily so configs emitted by existing `modern create`
70
+ * templates keep typechecking; will be removed once the generator stops
71
+ * emitting it. Use {@link CloudflareWorkerSecurityConfig.cors} for the
72
+ * worker's cross-origin policy.
73
+ */
74
+ cookies?: {
75
+ mutateSetCookie?: false;
76
+ reason?: string;
77
+ };
78
+ reason?: string;
79
+ }
@@ -1,3 +1,5 @@
1
+ import type { CloudflareWorkerSecurityConfig, DeployTarget } from './cloudflareDeploy';
2
+ export type { CloudflareWorkerSecurityConfig, CloudflareWorkerSecurityCorsConfig, CloudflareWorkerSecurityCspConfig, CloudflareWorkerSecurityCspMode, CloudflareWorkerSecurityNoindexConfig, DeployTarget, } from './cloudflareDeploy';
1
3
  export interface MicroFrontend {
2
4
  /**
3
5
  * Specifies whether to enable the HTML entry.
@@ -11,22 +13,7 @@ export interface MicroFrontend {
11
13
  */
12
14
  externalBasicLibrary?: boolean;
13
15
  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
16
  }
29
- export type DeployTarget = 'node' | 'vercel' | 'netlify' | 'ghPages' | 'cloudflare';
30
17
  export interface DeployUserConfig {
31
18
  /**
32
19
  * Selects the deploy output preset.
@@ -41,6 +28,13 @@ export interface DeployUserConfig {
41
28
  microFrontend?: boolean | MicroFrontend;
42
29
  worker?: {
43
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;
44
37
  ssr?: boolean;
38
+ security?: CloudflareWorkerSecurityConfig;
45
39
  };
46
40
  }
@@ -1,25 +1,8 @@
1
1
  import type { BuilderConfig } from '@modern-js/builder';
2
2
  import type { SSGConfig, SSGMultiEntryOptions } from '@modern-js/types';
3
- import type CompressionPlugin from 'compression-webpack-plugin';
4
3
  import type { UnwrapBuilderConfig } from '../utils';
5
- type CompressionPluginOptions = NonNullable<ConstructorParameters<typeof CompressionPlugin>[0]>;
6
- export type PrecompressCodecOptions = boolean | CompressionPluginOptions;
7
- export interface PrecompressConfig {
8
- /**
9
- * Configure gzip precompression options.
10
- * `true` means using default options.
11
- * `false` means disabling gzip precompression.
12
- * @default true
13
- */
14
- gzip?: PrecompressCodecOptions;
15
- /**
16
- * Configure brotli precompression options.
17
- * `true` means using default options.
18
- * `false` means disabling brotli precompression.
19
- * @default true
20
- */
21
- brotli?: PrecompressCodecOptions;
22
- }
4
+ import type { PrecompressConfig } from './precompress';
5
+ export type { PrecompressCodecOptions, PrecompressConfig } from './precompress';
23
6
  export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'output'> {
24
7
  /**
25
8
  * Enable SSG for self-controlled routing or conventional routing.
@@ -54,7 +37,8 @@ export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'ou
54
37
  /**
55
38
  * Generate precompressed static assets by using compression-webpack-plugin.
56
39
  * `true` means enabling both gzip and brotli with default options.
57
- * @default true
40
+ * Disabled unless explicitly configured; `presetUltramodern` enables it.
41
+ * @default false
58
42
  */
59
43
  precompress?: boolean | PrecompressConfig;
60
44
  }
@@ -0,0 +1,20 @@
1
+ import type CompressionPlugin from 'compression-webpack-plugin';
2
+ type CompressionPluginOptions = NonNullable<ConstructorParameters<typeof CompressionPlugin>[0]>;
3
+ export type PrecompressCodecOptions = boolean | CompressionPluginOptions;
4
+ export interface PrecompressConfig {
5
+ /**
6
+ * Configure gzip precompression options.
7
+ * `true` means using default options.
8
+ * `false` means disabling gzip precompression.
9
+ * @default true
10
+ */
11
+ gzip?: PrecompressCodecOptions;
12
+ /**
13
+ * Configure brotli precompression options.
14
+ * `true` means using default options.
15
+ * `false` means disabling brotli precompression.
16
+ * @default true
17
+ */
18
+ brotli?: PrecompressCodecOptions;
19
+ }
20
+ export {};