@bleedingdev/modern-js-app-tools 3.8.2-ultramodern.10 → 3.8.2-ultramodern.12
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.
|
@@ -40,14 +40,18 @@ export interface PresetUltramodernOptions {
|
|
|
40
40
|
/**
|
|
41
41
|
* OTLP exporter endpoint. Setting it (or the environment variable)
|
|
42
42
|
* enables the OTLP exporter unless `enableTelemetryExporters` is `false`.
|
|
43
|
-
*
|
|
43
|
+
* The localhost endpoint is used only when exporters are forced on with
|
|
44
|
+
* `enableTelemetryExporters: true` and no endpoint was provided.
|
|
45
|
+
* @default process.env.MODERN_TELEMETRY_OTLP_ENDPOINT
|
|
44
46
|
*/
|
|
45
47
|
otlpEndpoint?: string;
|
|
46
48
|
/**
|
|
47
49
|
* VictoriaMetrics exporter endpoint. Setting it (or the environment
|
|
48
50
|
* variable) enables the VictoriaMetrics exporter unless
|
|
49
51
|
* `enableTelemetryExporters` is `false`.
|
|
50
|
-
*
|
|
52
|
+
* The localhost endpoint is used only when exporters are forced on with
|
|
53
|
+
* `enableTelemetryExporters: true` and no endpoint was provided.
|
|
54
|
+
* @default process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT
|
|
51
55
|
*/
|
|
52
56
|
victoriaMetricsEndpoint?: string;
|
|
53
57
|
/**
|
|
@@ -62,5 +66,21 @@ export interface PresetUltramodernOptions {
|
|
|
62
66
|
*/
|
|
63
67
|
enableModuleFederationSSR?: boolean;
|
|
64
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Materialize a fresh UltraModern preset config.
|
|
71
|
+
*
|
|
72
|
+
* This is the advanced inspection API. Use `presetUltramodern` when composing
|
|
73
|
+
* an application config so nested records, arrays, and hooks keep the normal
|
|
74
|
+
* Modern.js merge behavior.
|
|
75
|
+
*/
|
|
65
76
|
export declare const createPresetUltramodernConfig: (options?: PresetUltramodernOptions) => AppUserConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Compose an application config over the UltraModern preset.
|
|
79
|
+
*
|
|
80
|
+
* The application config is merged after the preset. Nested records are
|
|
81
|
+
* preserved, scalar values and `false` override preset values, and omitted or
|
|
82
|
+
* `undefined` values keep the preset value. Arrays and hooks compose in
|
|
83
|
+
* preset-first order. An empty record does not reset nested preset defaults;
|
|
84
|
+
* use the typed `PresetUltramodernOptions` opt-outs instead.
|
|
85
|
+
*/
|
|
66
86
|
export declare const presetUltramodern: (config: AppUserConfig, options?: PresetUltramodernOptions) => AppUserConfig;
|
|
@@ -250,6 +250,94 @@ directories, and caches are isolated per app, build target, and Rspack
|
|
|
250
250
|
environment so local `build`, `cloudflare:build`, and multi-environment
|
|
251
251
|
compilers do not share mutable build state.
|
|
252
252
|
|
|
253
|
+
## Configure the public preset
|
|
254
|
+
|
|
255
|
+
Use `presetUltramodern(appConfig, presetOptions)` inside the normal Modern.js
|
|
256
|
+
`defineConfig` call:
|
|
257
|
+
|
|
258
|
+
```ts title="modern.config.ts"
|
|
259
|
+
import { defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
260
|
+
|
|
261
|
+
export default defineConfig(
|
|
262
|
+
presetUltramodern(
|
|
263
|
+
{
|
|
264
|
+
output: {
|
|
265
|
+
precompress: false,
|
|
266
|
+
},
|
|
267
|
+
server: {
|
|
268
|
+
telemetry: {
|
|
269
|
+
failLoudStartup: true,
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
appId: 'catalog',
|
|
275
|
+
enableModuleFederationSSR: false,
|
|
276
|
+
enableTelemetryExporters: false,
|
|
277
|
+
},
|
|
278
|
+
),
|
|
279
|
+
);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
The first argument is ordinary `AppUserConfig`. It contains app-owned config
|
|
283
|
+
and wins where it supplies an override. The second argument controls the
|
|
284
|
+
preset itself. Use its typed options, such as `enableBffRequestId: false`,
|
|
285
|
+
`enableTelemetry: false`, `enableTelemetryExporters: false`, and
|
|
286
|
+
`enableModuleFederationSSR: false`, to turn preset features off.
|
|
287
|
+
|
|
288
|
+
Composition follows the Modern.js config merge rules:
|
|
289
|
+
|
|
290
|
+
- Nested records merge, so changing one nested field keeps its preset
|
|
291
|
+
siblings.
|
|
292
|
+
- Scalars and `false` supplied by the app override preset values. Omitting a
|
|
293
|
+
field, or leaving it `undefined`, keeps the preset value.
|
|
294
|
+
- Arrays and config hooks compose in preset-first order. Non-function array
|
|
295
|
+
entries are deduplicated by deep equality, while function entries are all
|
|
296
|
+
retained. An empty array or empty record does not clear values already
|
|
297
|
+
supplied by the preset.
|
|
298
|
+
|
|
299
|
+
There is no generic reset sentinel. Use a typed preset option for preset-owned
|
|
300
|
+
behavior and a normal app config override for app-owned behavior.
|
|
301
|
+
|
|
302
|
+
`createPresetUltramodernConfig(options)` is an advanced API for inspecting or
|
|
303
|
+
materializing a fresh preset config. Do not spread its result into another
|
|
304
|
+
config object. Object spread is shallow, so replacing `server`, `output`, or
|
|
305
|
+
another nested record can silently discard preset siblings. Use
|
|
306
|
+
`presetUltramodern(...)` for authoring `modern.config.ts`.
|
|
307
|
+
|
|
308
|
+
### Bare preset and generated workspace policy
|
|
309
|
+
|
|
310
|
+
The preset and the workspace generator own different parts of the config:
|
|
311
|
+
|
|
312
|
+
| Source | Identity | Remaining config |
|
|
313
|
+
| --------------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
|
|
314
|
+
| Bare `createPresetUltramodernConfig()` result | Uses `appId: 'app'` and has no `deliveryUnit` | Uses the preset defaults. Telemetry stays enabled, but no exporter is configured until its endpoint is set. |
|
|
315
|
+
| Generated app | Supplies the app-specific `appId` and stamped `deliveryUnit` | Inherits the other strict defaults from `presetUltramodern(...)`. |
|
|
316
|
+
| Application | Supplies the first `appConfig` argument | Overrides app-owned fields through the normal Modern.js merge. |
|
|
317
|
+
|
|
318
|
+
Keep the generated `appId` and `deliveryUnit` options intact. To change
|
|
319
|
+
preset-owned behavior, use typed options such as
|
|
320
|
+
`enableTelemetryExporters: false`,
|
|
321
|
+
`enableTelemetry: false`, `enableBffRequestId: false`, or
|
|
322
|
+
`enableModuleFederationSSR: false`. To change an app-owned field, put the
|
|
323
|
+
override in the first argument, as in the example above.
|
|
324
|
+
|
|
325
|
+
Telemetry exporter endpoints are unset by default:
|
|
326
|
+
|
|
327
|
+
- `MODERN_TELEMETRY_OTLP_ENDPOINT` enables only the OTLP exporter.
|
|
328
|
+
- `MODERN_TELEMETRY_VICTORIA_ENDPOINT` enables only the VictoriaMetrics
|
|
329
|
+
exporter.
|
|
330
|
+
- Setting both enables both. Leaving both unset keeps the telemetry pipeline
|
|
331
|
+
enabled without configuring an exporter.
|
|
332
|
+
|
|
333
|
+
The typed `otlpEndpoint` and `victoriaMetricsEndpoint` preset options provide
|
|
334
|
+
the same per-exporter behavior without environment variables.
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
MODERN_TELEMETRY_OTLP_ENDPOINT=https://otel.example.com/v1/logs \
|
|
338
|
+
mise exec -- pnpm dev
|
|
339
|
+
```
|
|
340
|
+
|
|
253
341
|
## Human Workflow
|
|
254
342
|
|
|
255
343
|
The public BleedingDev create package has one supported generated product. The
|
|
@@ -428,18 +516,6 @@ BleedingDev packages are published through GitHub Actions trusted publishing.
|
|
|
428
516
|
The public workflow is tokenless; do not publish packages manually from a
|
|
429
517
|
developer machine.
|
|
430
518
|
|
|
431
|
-
## Baseline Switches (Opt-out)
|
|
432
|
-
|
|
433
|
-
The generated `presetUltramodern(...)` starter enables strict platform contracts. Use these env switches to opt out per app or per environment:
|
|
434
|
-
|
|
435
|
-
- `MODERN_BASELINE_ENABLE_MF_SSR` (default: `true`): Enables app-level MF SSR baseline contract (`server.ssr.mode: 'stream'` + `moduleFederationAppSSR`). Disable when the app does not use app-level MF SSR, or when you need plain SSR/CSR behavior first.
|
|
436
|
-
- `MODERN_BASELINE_ENABLE_BFF_REQUEST_ID` (default: `true`): Enables default BFF producer identity contract (`bff.requestId`). Disable when the app does not need cross-project producer isolation.
|
|
437
|
-
- `MODERN_BASELINE_ENABLE_TELEMETRY_EXPORTERS` (default: `true`): Enables telemetry exporters in baseline config. Disable when the environment has no telemetry backend yet.
|
|
438
|
-
- `MODERN_BASELINE_APP_ID` (default: `basename(process.cwd())`): Overrides baseline `bff.requestId` identity. Set this when you need a fixed platform-wide producer ID convention.
|
|
439
|
-
- `MODERN_TELEMETRY_OTLP_ENDPOINT` (default: `http://127.0.0.1:4318/v1/logs`): OTLP exporter endpoint. Override when you route telemetry through a different collector endpoint.
|
|
440
|
-
- `MODERN_TELEMETRY_VICTORIA_ENDPOINT` (default: `http://127.0.0.1:8428/api/v1/import/prometheus`): VictoriaMetrics exporter endpoint. Override when you use a different VM ingress endpoint.
|
|
441
|
-
- `MODERN_TELEMETRY_FAIL_LOUD_STARTUP` (default: `true`): Fails startup if configured exporters fail startup health checks. Disable in local/dev environments where temporary telemetry outage should not block boot.
|
|
442
|
-
|
|
443
519
|
## Related Docs
|
|
444
520
|
|
|
445
521
|
- [BFF Runtime Frameworks](/guides/advanced-features/bff/frameworks.md)
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.8.2-ultramodern.
|
|
20
|
+
"version": "3.8.2-ultramodern.12",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"exports": {
|
|
@@ -134,16 +134,16 @@
|
|
|
134
134
|
"@babel/traverse": "^8.0.0",
|
|
135
135
|
"@babel/types": "^8.0.0",
|
|
136
136
|
"@loadable/component": "5.16.7",
|
|
137
|
-
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.8.2-ultramodern.
|
|
138
|
-
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.8.2-ultramodern.
|
|
139
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.8.2-ultramodern.
|
|
140
|
-
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.8.2-ultramodern.
|
|
141
|
-
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.8.2-ultramodern.
|
|
142
|
-
"@modern-js/server": "npm:@bleedingdev/modern-js-server@3.8.2-ultramodern.
|
|
143
|
-
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.2-ultramodern.
|
|
144
|
-
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.8.2-ultramodern.
|
|
145
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.2-ultramodern.
|
|
146
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.2-ultramodern.
|
|
137
|
+
"@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.8.2-ultramodern.12",
|
|
138
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.8.2-ultramodern.12",
|
|
139
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.8.2-ultramodern.12",
|
|
140
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.8.2-ultramodern.12",
|
|
141
|
+
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.8.2-ultramodern.12",
|
|
142
|
+
"@modern-js/server": "npm:@bleedingdev/modern-js-server@3.8.2-ultramodern.12",
|
|
143
|
+
"@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.2-ultramodern.12",
|
|
144
|
+
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.8.2-ultramodern.12",
|
|
145
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.2-ultramodern.12",
|
|
146
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.2-ultramodern.12",
|
|
147
147
|
"@rsbuild/core": "2.2.0-rc.0",
|
|
148
148
|
"@swc/core": "1.15.43",
|
|
149
149
|
"@swc/helpers": "^0.5.23",
|