@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.4 → 3.9.0-ultramodern.6

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 (86) hide show
  1. package/dist/cjs/builder/generator/index.js +0 -1
  2. package/dist/cjs/builder/shared/builderPlugins/index.js +4 -11
  3. package/dist/cjs/config/index.js +4 -11
  4. package/dist/cjs/index.js +80 -111
  5. package/dist/cjs/plugins/deploy/platforms/node.js +0 -13
  6. package/dist/cjs/plugins/serverBuild.js +2 -1
  7. package/dist/esm/builder/generator/index.mjs +1 -2
  8. package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
  9. package/dist/esm/config/index.mjs +0 -1
  10. package/dist/esm/index.mjs +1 -6
  11. package/dist/esm/plugins/deploy/platforms/node.mjs +0 -13
  12. package/dist/esm/plugins/serverBuild.mjs +2 -1
  13. package/dist/esm-node/builder/generator/index.mjs +1 -2
  14. package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
  15. package/dist/esm-node/config/index.mjs +0 -1
  16. package/dist/esm-node/index.mjs +1 -6
  17. package/dist/esm-node/plugins/deploy/platforms/node.mjs +0 -13
  18. package/dist/esm-node/plugins/serverBuild.mjs +2 -1
  19. package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
  20. package/dist/types/config/index.d.ts +0 -1
  21. package/dist/types/index.d.ts +0 -1
  22. package/dist/types/plugins/deploy/utils/generator.d.ts +1 -1
  23. package/dist/types/types/config/output.d.ts +0 -9
  24. package/dist/types/types/index.d.ts +1 -1
  25. package/dist/types/types/plugin.d.ts +56 -2
  26. package/dist/types/utils/initAppContext.d.ts +3 -2
  27. package/docs/configure/app/bff/effect.md +29 -24
  28. package/docs/guides/advanced-features/bff/data-platform.md +2 -2
  29. package/docs/guides/advanced-features/bff/frameworks.md +36 -24
  30. package/docs/guides/advanced-features/bff/function.md +2 -2
  31. package/docs/guides/advanced-features/bff/operators.md +17 -17
  32. package/docs/guides/get-started/quick-start.md +1 -5
  33. package/docs/guides/get-started/ultramodern.md +5 -86
  34. package/docs/llms.txt +2 -2
  35. package/package.json +14 -30
  36. package/rslib.config.mts +0 -5
  37. package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +0 -125
  38. package/dist/cjs/config/build-environment.js +0 -268
  39. package/dist/cjs/config/public.js +0 -46
  40. package/dist/cjs/plugins/backend-federation/codegen.js +0 -256
  41. package/dist/cjs/plugins/backend-federation/config.js +0 -204
  42. package/dist/cjs/plugins/backend-federation/emit.js +0 -150
  43. package/dist/cjs/plugins/backendFederationBuild.js +0 -53
  44. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +0 -62
  45. package/dist/cjs/plugins/deploy/utils/npmAliases.js +0 -226
  46. package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +0 -44
  47. package/dist/cjs/presetUltramodern.js +0 -175
  48. package/dist/cjs/types/config/precompress.js +0 -18
  49. package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -77
  50. package/dist/esm/config/build-environment.mjs +0 -224
  51. package/dist/esm/config/public.mjs +0 -1
  52. package/dist/esm/plugins/backend-federation/codegen.mjs +0 -205
  53. package/dist/esm/plugins/backend-federation/config.mjs +0 -128
  54. package/dist/esm/plugins/backend-federation/emit.mjs +0 -99
  55. package/dist/esm/plugins/backendFederationBuild.mjs +0 -1
  56. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -1
  57. package/dist/esm/plugins/deploy/utils/npmAliases.mjs +0 -174
  58. package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +0 -6
  59. package/dist/esm/presetUltramodern.mjs +0 -119
  60. package/dist/esm/types/config/precompress.mjs +0 -0
  61. package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +0 -78
  62. package/dist/esm-node/config/build-environment.mjs +0 -225
  63. package/dist/esm-node/config/public.mjs +0 -2
  64. package/dist/esm-node/plugins/backend-federation/codegen.mjs +0 -206
  65. package/dist/esm-node/plugins/backend-federation/config.mjs +0 -129
  66. package/dist/esm-node/plugins/backend-federation/emit.mjs +0 -100
  67. package/dist/esm-node/plugins/backendFederationBuild.mjs +0 -2
  68. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +0 -2
  69. package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +0 -175
  70. package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +0 -7
  71. package/dist/esm-node/presetUltramodern.mjs +0 -120
  72. package/dist/esm-node/types/config/precompress.mjs +0 -1
  73. package/dist/types/builder/shared/builderPlugins/adapterPrecompress.d.ts +0 -3
  74. package/dist/types/config/build-environment.d.ts +0 -22
  75. package/dist/types/config/public.d.ts +0 -2
  76. package/dist/types/plugins/backend-federation/codegen.d.ts +0 -86
  77. package/dist/types/plugins/backend-federation/config.d.ts +0 -103
  78. package/dist/types/plugins/backend-federation/emit.d.ts +0 -13
  79. package/dist/types/plugins/backendFederationBuild.d.ts +0 -2
  80. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +0 -1
  81. package/dist/types/plugins/deploy/utils/npmAliases.d.ts +0 -14
  82. package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +0 -3
  83. package/dist/types/precompress/LICENSE +0 -20
  84. package/dist/types/precompress/index.d.ts +0 -76
  85. package/dist/types/presetUltramodern.d.ts +0 -87
  86. package/dist/types/types/config/precompress.d.ts +0 -19
@@ -1,120 +0,0 @@
1
- import "node:module";
2
- import node_fs from "node:fs";
3
- import node_path from "node:path";
4
- import { configureUltramodernTypeChecker } from "@modern-js/app-tools-extensions/native-type-checker";
5
- import { resolveUltramodernReleaseIdentity } from "@modern-js/app-tools-extensions/release-identity";
6
- import { mergeConfig } from "@modern-js/plugin/cli";
7
- import { rspack } from "@rsbuild/core";
8
- import { resolveEffectTsgoCompiler } from "./config/build-environment.mjs";
9
- const DEFAULT_OTLP_ENDPOINT = 'http://127.0.0.1:4318/v1/logs';
10
- const DEFAULT_VICTORIA_METRICS_ENDPOINT = 'http://127.0.0.1:8428/api/v1/import/prometheus';
11
- const resolveReactRouterPackageDir = (appDirectory)=>{
12
- const resolveNodeModulePackageJson = (packageName, fromDirectory)=>{
13
- let currentDirectory = node_path.resolve(fromDirectory);
14
- while(true){
15
- const packageJson = node_path.join(currentDirectory, 'node_modules', packageName, 'package.json');
16
- if (node_fs.existsSync(packageJson)) return node_fs.realpathSync(packageJson);
17
- const parentDirectory = node_path.dirname(currentDirectory);
18
- if (parentDirectory === currentDirectory) return;
19
- currentDirectory = parentDirectory;
20
- }
21
- };
22
- const reactRouterPackageJson = resolveNodeModulePackageJson('react-router', appDirectory);
23
- if (reactRouterPackageJson) return node_path.dirname(reactRouterPackageJson);
24
- const reactRouterDomPackageJson = resolveNodeModulePackageJson('react-router-dom', appDirectory);
25
- if (!reactRouterDomPackageJson) return;
26
- const nestedReactRouterPackageJson = resolveNodeModulePackageJson('react-router', node_path.dirname(reactRouterDomPackageJson));
27
- if (nestedReactRouterPackageJson) return node_path.dirname(nestedReactRouterPackageJson);
28
- };
29
- const setReactRouterBridgeSafeAliases = (chain, { isProd })=>{
30
- const chainContext = chain.get('context');
31
- const appDirectory = 'string' == typeof chainContext && chainContext.length > 0 ? chainContext : process.cwd();
32
- const reactRouterPackageDir = resolveReactRouterPackageDir(appDirectory);
33
- if (!reactRouterPackageDir) return;
34
- const productionEntry = node_path.join(reactRouterPackageDir, 'dist/production/index.mjs');
35
- const developmentEntry = node_path.join(reactRouterPackageDir, 'dist/development/index.mjs');
36
- chain.resolve.alias.set('react-router$', isProd ? productionEntry : developmentEntry);
37
- chain.resolve.alias.set('react-router/dist/production/index.js', productionEntry);
38
- chain.resolve.alias.set('react-router/dist/development/index.js', developmentEntry);
39
- };
40
- const createPresetUltramodernConfig = (options = {})=>{
41
- const { appId = 'app', deliveryUnit, enableBffRequestId = true, enableTelemetry = true, enableTelemetryExporters, otlpEndpoint = process.env.MODERN_TELEMETRY_OTLP_ENDPOINT, victoriaMetricsEndpoint = process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT, telemetryFailLoudStartup = false, enableModuleFederationSSR = true } = options;
42
- const server = {};
43
- const releaseIdentity = deliveryUnit ? resolveUltramodernReleaseIdentity({
44
- generationBuildMarker: deliveryUnit.buildMarker,
45
- unitId: deliveryUnit.unitId
46
- }) : void 0;
47
- const bundledReleaseIdentity = releaseIdentity ? {
48
- ...releaseIdentity,
49
- releaseVersion: deliveryUnit.version
50
- } : void 0;
51
- if (enableTelemetry) {
52
- server.telemetry = {
53
- enabled: true,
54
- failLoudStartup: telemetryFailLoudStartup
55
- };
56
- if (false !== enableTelemetryExporters) {
57
- const exporters = {};
58
- if (true === enableTelemetryExporters || otlpEndpoint) exporters.otlp = {
59
- enabled: true,
60
- endpoint: otlpEndpoint || DEFAULT_OTLP_ENDPOINT
61
- };
62
- if (true === enableTelemetryExporters || victoriaMetricsEndpoint) exporters.victoriaMetrics = {
63
- enabled: true,
64
- endpoint: victoriaMetricsEndpoint || DEFAULT_VICTORIA_METRICS_ENDPOINT
65
- };
66
- if (Object.keys(exporters).length > 0) server.telemetry.exporters = exporters;
67
- }
68
- }
69
- if (enableModuleFederationSSR) server.ssr = {
70
- mode: 'stream',
71
- moduleFederationAppSSR: true
72
- };
73
- const presetConfig = {
74
- output: {
75
- precompress: true
76
- },
77
- server,
78
- source: {
79
- reactCompiler: true,
80
- ...deliveryUnit ? {
81
- globalVars: {
82
- ULTRAMODERN_BUILD_MARKER: releaseIdentity?.buildMarker,
83
- ULTRAMODERN_RELEASE_VERSION: deliveryUnit.version,
84
- ULTRAMODERN_SOURCE_REVISION: releaseIdentity?.sourceRevision
85
- }
86
- } : {}
87
- },
88
- tools: {
89
- bundlerChain: (chain, utils)=>{
90
- setReactRouterBridgeSafeAliases(chain, utils);
91
- configureUltramodernTypeChecker(chain, utils.CHAIN_ID.PLUGIN.TS_CHECKER, (from)=>resolveEffectTsgoCompiler({
92
- from
93
- }));
94
- },
95
- lightningcssLoader: true,
96
- ...bundledReleaseIdentity ? {
97
- rspack: (config)=>{
98
- config.plugins ??= [];
99
- config.plugins.push(new rspack.BannerPlugin({
100
- banner: `void ${JSON.stringify(bundledReleaseIdentity.buildMarker)};void ${JSON.stringify(bundledReleaseIdentity.sourceRevision)};void ${JSON.stringify(bundledReleaseIdentity.releaseVersion)};`,
101
- raw: true,
102
- stage: rspack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
103
- test: /\.(?:c|m)?js$/u
104
- }));
105
- return config;
106
- }
107
- } : {}
108
- }
109
- };
110
- if (enableBffRequestId) presetConfig.bff = {
111
- requestId: appId
112
- };
113
- return presetConfig;
114
- };
115
- const presetUltramodern = (config, options = {})=>mergeConfig([
116
- createPresetUltramodernConfig(options),
117
- config
118
- ]);
119
- export { default as ultramodernReleaseEnvelopePlugin } from "./plugins/ultramodernReleaseEnvelope.mjs";
120
- export { createPresetUltramodernConfig, presetUltramodern };
@@ -1 +0,0 @@
1
- import "node:module";
@@ -1,3 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { BuilderOptions } from '../types.js';
3
- export declare const builderPluginAdapterPrecompress: (options: BuilderOptions) => RsbuildPlugin;
@@ -1,22 +0,0 @@
1
- import type { URL } from 'node:url';
2
- import type { Rspack } from '@rsbuild/core';
3
- /**
4
- * Reads an environment variable while keeping generated build configs free of
5
- * direct process access.
6
- */
7
- export declare function getBuildConfigEnvironment(name: string): string | undefined;
8
- /**
9
- * Runs a Rspack config setup under a leased environment value. The lease is
10
- * restored when that compiler reaches any supported terminal hook.
11
- */
12
- export declare function withBuildConfigEnvironment<Config extends {
13
- plugins?: Rspack.Plugin[];
14
- }, SetupArguments extends unknown[]>(name: string, value: string, setup: (config: Config, ...args: SetupArguments) => Config | void | Promise<Config | void>): (config: Config, ...args: SetupArguments) => Promise<Config>;
15
- export type ResolveEffectTsgoCompilerOptions = {
16
- /** Module URL or absolute filename used to resolve the consumer's compiler. */
17
- from: string | URL;
18
- };
19
- /**
20
- * Resolves the Effect TS-Go executable used by Module Federation DTS builds.
21
- */
22
- export declare function resolveEffectTsgoCompiler(options: ResolveEffectTsgoCompilerOptions): string;
@@ -1,2 +0,0 @@
1
- export type { ResolveEffectTsgoCompilerOptions } from './build-environment.js';
2
- export { getBuildConfigEnvironment, resolveEffectTsgoCompiler, withBuildConfigEnvironment, } from './build-environment.js';
@@ -1,86 +0,0 @@
1
- import type { BackendFederationEntryIntegrity } from '@modern-js/server-runtime-extensions/backend-federation-security';
2
- import { type BackendFederationApp } from './config.js';
3
- export declare const createBackendRemoteEntrySource: (workspaceRoot: string, app: BackendFederationApp, effectApiPath: string, entryPath: string) => Promise<string>;
4
- export declare const createBackendManifest: (workspaceRoot: string, distDirectory: string, app: BackendFederationApp, entryIntegrity: BackendFederationEntryIntegrity) => {
5
- schemaVersion: number;
6
- id: string;
7
- name: string;
8
- version: string | undefined;
9
- buildVersion: string | undefined;
10
- metaData: {
11
- name: string;
12
- type: string;
13
- buildInfo: {
14
- buildVersion: string | undefined;
15
- buildName: string | undefined;
16
- };
17
- remoteEntry: {
18
- name: string;
19
- path: string;
20
- type: string;
21
- };
22
- globalName: string;
23
- publicPath: string;
24
- ssrRemoteEntry: {
25
- name: string;
26
- path: string;
27
- type: string;
28
- };
29
- ssrPublicPath: string;
30
- };
31
- entry: {
32
- byteLength: number;
33
- sha256: string;
34
- file: string;
35
- path: string;
36
- type: string;
37
- url: string;
38
- };
39
- exposes: {
40
- id: string;
41
- name: string;
42
- path: string;
43
- assets: {
44
- js: {
45
- async: never[];
46
- sync: string[];
47
- };
48
- css: {
49
- async: never[];
50
- sync: never[];
51
- };
52
- };
53
- }[];
54
- shared: never[];
55
- backendFederation: {
56
- role: string;
57
- appId: string;
58
- name: string;
59
- runtimeFramework: string;
60
- strictEffectApproach: boolean;
61
- contractVersion: string;
62
- nodeAdapterVersion: string;
63
- remoteType: string;
64
- expose: string;
65
- manifestUrl: string;
66
- containerEntry: string;
67
- source: {
68
- module: string;
69
- };
70
- readinessPath: string;
71
- openapiPath: string;
72
- deliveryUnit?: import("@modern-js/utils/universal").DeliveryUnitContractBlock | undefined;
73
- versionBoundary: {
74
- invariant: string;
75
- packageName: string | undefined;
76
- version: string | undefined;
77
- buildVersion: string | undefined;
78
- uiManifestUrl?: string | undefined;
79
- deliveryUnit?: {
80
- unitId: string;
81
- buildMarker: string;
82
- sourceRevision: string;
83
- } | undefined;
84
- };
85
- };
86
- };
@@ -1,103 +0,0 @@
1
- import { type DeliveryUnitContractBlock, type UltramodernBuildArtifact } from '@modern-js/utils/universal';
2
- export declare const COMPACT_CONFIG_PATH = ".modernjs/ultramodern.json";
3
- export type CompactApp = {
4
- id?: unknown;
5
- kind?: unknown;
6
- path?: unknown;
7
- package?: unknown;
8
- port?: unknown;
9
- api?: {
10
- prefix?: unknown;
11
- stem?: unknown;
12
- };
13
- moduleFederation?: {
14
- name?: unknown;
15
- manifestUrl?: unknown;
16
- };
17
- backendFederation?: {
18
- name?: unknown;
19
- versionBoundary?: {
20
- ui?: {
21
- manifestUrl?: unknown;
22
- };
23
- };
24
- executionSurfaces?: {
25
- node?: {
26
- remoteName?: unknown;
27
- manifestUrl?: unknown;
28
- containerEntry?: unknown;
29
- remoteType?: unknown;
30
- };
31
- };
32
- };
33
- deliveryUnit?: {
34
- unitId?: unknown;
35
- buildMarker?: unknown;
36
- sourceRevision?: unknown;
37
- packageName?: unknown;
38
- version?: unknown;
39
- };
40
- serverExecution?: {
41
- node?: {
42
- remoteName?: unknown;
43
- manifestUrl?: unknown;
44
- containerEntry?: unknown;
45
- remoteType?: unknown;
46
- };
47
- };
48
- };
49
- export type CompactConfig = {
50
- topology?: {
51
- apps?: CompactApp[];
52
- };
53
- };
54
- export type BackendFederationApp = {
55
- id: string;
56
- directory: string;
57
- packageName?: string;
58
- version?: string;
59
- buildVersion?: string;
60
- unitId?: string;
61
- sourceRevision?: string;
62
- deliveryUnit?: DeliveryUnitContractBlock;
63
- port: number;
64
- apiPrefix: string;
65
- apiStem: string;
66
- backendName: string;
67
- manifestUrl: string;
68
- containerEntry: string;
69
- remoteType: string;
70
- uiManifestUrl?: string;
71
- compactDeliveryUnit?: {
72
- unitId?: string;
73
- buildMarker?: string;
74
- sourceRevision?: string;
75
- packageName?: string;
76
- version?: string;
77
- };
78
- };
79
- export type BackendFederationBuildIdentity = {
80
- appId?: string;
81
- packageName?: string;
82
- version?: string;
83
- buildVersion?: string;
84
- unitId?: string;
85
- sourceRevision?: string;
86
- artifact?: UltramodernBuildArtifact;
87
- };
88
- export declare const normalizeRelativePath: (value: string) => string;
89
- export declare const buildArtifactPathFor: (appDirectory: string) => string;
90
- export declare const buildModulePathFor: (appDirectory: string) => string;
91
- export declare const readBuildIdentity: (appDirectory: string) => Promise<BackendFederationBuildIdentity>;
92
- export declare const findWorkspaceRoot: (appDirectory: string) => string | undefined;
93
- export declare const resolveWorkspaceSourceRevision: (workspaceRoot: string) => Promise<string>;
94
- export declare const createStampedDeliveryUnit: (input: {
95
- appId: string;
96
- unitId?: string;
97
- buildMarker?: string;
98
- packageName?: string;
99
- version?: string;
100
- sourceRevision: string;
101
- }) => DeliveryUnitContractBlock | undefined;
102
- export declare const createAppFromCompactMetadata: (workspaceRoot: string, appDirectory: string, compactApp: CompactApp) => BackendFederationApp | undefined;
103
- export declare const findBackendFederationApp: (workspaceRoot: string, appDirectory: string) => Promise<BackendFederationApp | undefined>;
@@ -1,13 +0,0 @@
1
- import type { AppTools, CliPlugin } from '../../types/index.js';
2
- export type { BackendFederationBuildIdentity } from './config.js';
3
- export type BackendFederationArtifactResult = {
4
- appId: string;
5
- manifestPath: string;
6
- containerPath: string;
7
- deliveryUnitArtifactPath?: string;
8
- remoteName: string;
9
- remoteType: string;
10
- };
11
- export declare const emitBackendFederationArtifacts: (appDirectory: string, distDirectory: string) => Promise<BackendFederationArtifactResult | undefined>;
12
- export default _default;
13
- declare function _default(): CliPlugin<AppTools>;
@@ -1,2 +0,0 @@
1
- export type { BackendFederationArtifactResult } from './backend-federation/emit.js';
2
- export { default, emitBackendFederationArtifacts, } from './backend-federation/emit.js';
@@ -1 +0,0 @@
1
- export * from '@modern-js/app-tools-extensions/cloudflare-output-verifier';
@@ -1,14 +0,0 @@
1
- export type NpmAlias = {
2
- aliasName: string;
3
- targetName: string;
4
- targetVersion: string;
5
- };
6
- export declare function readPackageIdentity(entryPath: string): Promise<{
7
- name: string;
8
- version: string;
9
- }>;
10
- export declare function preserveNpmAliases({ appDirectory, outputDirectory, implicitAliases, }: {
11
- appDirectory: string;
12
- outputDirectory: string;
13
- implicitAliases?: NpmAlias[];
14
- }): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { AppTools, CliPlugin } from '../types/index.js';
2
- export default _default;
3
- declare function _default(): CliPlugin<AppTools>;
@@ -1,20 +0,0 @@
1
- Copyright JS Foundation and other contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- 'Software'), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,76 +0,0 @@
1
- type BasePluginOptions<T> = {
2
- /**
3
- * include all assets that pass test assertion
4
- */
5
- test?: Rules | undefined;
6
- /**
7
- * include all assets matching any of these conditions
8
- */
9
- include?: Rules | undefined;
10
- /**
11
- * exclude all assets matching any of these conditions
12
- */
13
- exclude?: Rules | undefined;
14
- /**
15
- * only assets bigger than this size are processed, in bytes
16
- */
17
- threshold?: number | undefined;
18
- /**
19
- * only assets that compress better than this ratio are processed (`minRatio = Compressed Size / Original Size`)
20
- */
21
- minRatio?: number | undefined;
22
- /**
23
- * whether to delete the original assets or not
24
- */
25
- deleteOriginalAssets?: DeleteOriginalAssets | undefined;
26
- /**
27
- * the target asset filename
28
- */
29
- filename?: Filename | undefined;
30
- };
31
- type Rules = Rule[] | Rule;
32
- type Rule = RegExp | string;
33
- type DeleteOriginalAssets =
34
- | boolean
35
- | "keep-source-map"
36
- | ((name: string) => boolean);
37
- type Filename = string | ((fileData: PathData) => string);
38
- type PathData = import('@rsbuild/core').Rspack.PathData;
39
- type DefinedDefaultAlgorithmAndOptions<T> = T extends ZlibOptions
40
- ? {
41
- algorithm?: string | AlgorithmFunction<T> | undefined;
42
- compressionOptions?: CompressionOptions<T> | undefined;
43
- }
44
- : {
45
- algorithm: string | AlgorithmFunction<T>;
46
- compressionOptions?: CompressionOptions<T> | undefined;
47
- };
48
- type ZlibOptions = import("zlib").ZlibOptions;
49
- type AlgorithmFunction<T> = (
50
- input: Buffer,
51
- options: CompressionOptions<T>,
52
- callback: (
53
- error: Error | null | undefined,
54
- result:
55
- | WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>
56
- | Uint8Array
57
- | ReadonlyArray<number>
58
- | WithImplicitCoercion<Uint8Array | ReadonlyArray<number> | string>
59
- | WithImplicitCoercion<string>
60
- | {
61
- [Symbol.toPrimitive](hint: "string"): string;
62
- },
63
- ) => void,
64
- ) => any;
65
- type CompressionOptions<T> = InferDefaultType<T>;
66
- type InferDefaultType<T> = T extends infer U ? U : CustomOptions;
67
- type CustomOptions = {
68
- [key: string]: EXPECTED_ANY;
69
- };
70
- type EXPECTED_ANY = any;
71
- type WithImplicitCoercion<T> =
72
- | T
73
- | {
74
- valueOf(): T;
75
- };
76
- export type CompressionPluginOptions = BasePluginOptions<ZlibOptions> & DefinedDefaultAlgorithmAndOptions<ZlibOptions>;
@@ -1,87 +0,0 @@
1
- import type { AppUserConfig } from './types/index.js';
2
- export { default as ultramodernReleaseEnvelopePlugin } from './plugins/ultramodernReleaseEnvelope.js';
3
- export interface PresetUltramodernOptions {
4
- /**
5
- * Stable producer identity used by BFF cross-project clients.
6
- * @default "app"
7
- */
8
- appId?: string;
9
- /**
10
- * Generation-time identity root for a generated delivery unit. When set, the
11
- * preset derives one build identity from the immutable source revision and
12
- * injects it into every browser, SSR, API, and backend bundle.
13
- */
14
- deliveryUnit?: {
15
- buildMarker: string;
16
- unitId: string;
17
- version: string;
18
- };
19
- /**
20
- * Enable BFF requestId contract by default.
21
- * @default true
22
- */
23
- enableBffRequestId?: boolean;
24
- /**
25
- * Enable telemetry contract by default.
26
- * Exporters are still configured separately by applications.
27
- * @default true
28
- */
29
- enableTelemetry?: boolean;
30
- /**
31
- * Enable telemetry exporters.
32
- *
33
- * By default each exporter is enabled only when its endpoint is explicitly
34
- * configured (via the matching option or environment variable), so a bare
35
- * preset app boots in production without local collectors.
36
- * Set `true` to force both exporters on with their default localhost
37
- * endpoints, or `false` to disable exporters entirely.
38
- * @default undefined (endpoint-driven)
39
- */
40
- enableTelemetryExporters?: boolean;
41
- /**
42
- * OTLP exporter endpoint. Setting it (or the environment variable)
43
- * enables the OTLP exporter unless `enableTelemetryExporters` is `false`.
44
- * The localhost endpoint is used only when exporters are forced on with
45
- * `enableTelemetryExporters: true` and no endpoint was provided.
46
- * @default process.env.MODERN_TELEMETRY_OTLP_ENDPOINT
47
- */
48
- otlpEndpoint?: string;
49
- /**
50
- * VictoriaMetrics exporter endpoint. Setting it (or the environment
51
- * variable) enables the VictoriaMetrics exporter unless
52
- * `enableTelemetryExporters` is `false`.
53
- * The localhost endpoint is used only when exporters are forced on with
54
- * `enableTelemetryExporters: true` and no endpoint was provided.
55
- * @default process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT
56
- */
57
- victoriaMetricsEndpoint?: string;
58
- /**
59
- * Enable fail-loud startup probing for telemetry exporters.
60
- * Probes only run for exporters that are actually enabled.
61
- * @default false
62
- */
63
- telemetryFailLoudStartup?: boolean;
64
- /**
65
- * Enable app-level Module Federation SSR handshake by default.
66
- * @default true
67
- */
68
- enableModuleFederationSSR?: boolean;
69
- }
70
- /**
71
- * Materialize a fresh UltraModern preset config.
72
- *
73
- * This is the advanced inspection API. Use `presetUltramodern` when composing
74
- * an application config so nested records, arrays, and hooks keep the normal
75
- * Modern.js merge behavior.
76
- */
77
- export declare const createPresetUltramodernConfig: (options?: PresetUltramodernOptions) => AppUserConfig;
78
- /**
79
- * Compose an application config over the UltraModern preset.
80
- *
81
- * The application config is merged after the preset. Nested records are
82
- * preserved, scalar values and `false` override preset values, and omitted or
83
- * `undefined` values keep the preset value. Arrays and hooks compose in
84
- * preset-first order. An empty record does not reset nested preset defaults;
85
- * use the typed `PresetUltramodernOptions` opt-outs instead.
86
- */
87
- export declare const presetUltramodern: (config: AppUserConfig, options?: PresetUltramodernOptions) => AppUserConfig;
@@ -1,19 +0,0 @@
1
- import type { CompressionPluginOptions } from '../../precompress/index.js';
2
- export type PrecompressCodecOptions = boolean | CompressionPluginOptions;
3
- export interface PrecompressConfig {
4
- /**
5
- * Configure gzip precompression options.
6
- * `true` means using default options.
7
- * `false` means disabling gzip precompression.
8
- * @default true
9
- */
10
- gzip?: PrecompressCodecOptions;
11
- /**
12
- * Configure brotli precompression options.
13
- * `true` means using default options.
14
- * `false` means disabling brotli precompression.
15
- * @default true
16
- */
17
- brotli?: PrecompressCodecOptions;
18
- }
19
- export {};