@bleedingdev/modern-js-ultramodern-app-tools 3.9.3-ultramodern.9 → 3.11.3-ultramodern.10

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 (106) hide show
  1. package/README.md +41 -0
  2. package/dist/cjs/native-composition/config.js +3 -0
  3. package/dist/cjs/native-composition/module-federation-renderer-plugin.js +5 -4
  4. package/dist/cjs/native-composition/native-development.js +106 -40
  5. package/dist/cjs/native-composition/native-entry-command.js +3 -3
  6. package/dist/cjs/native-composition/native-federation-dev-assets.js +3 -3
  7. package/dist/cjs/native-composition/native-federation-dev-public-path.js +10 -0
  8. package/dist/cjs/native-composition/native-infrastructure.js +1 -1
  9. package/dist/cjs/native-composition/native-module-federation.js +4 -2
  10. package/dist/cjs/native-composition/native-prerender.js +1 -1
  11. package/dist/cjs/native-composition/native-server-plugin.js +1 -1
  12. package/dist/cjs/native-composition/redact-config.js +51 -0
  13. package/dist/cjs/native-composition/renderer-profile.js +1 -1
  14. package/dist/cjs/native-composition/renderer-registration.js +4 -2
  15. package/dist/cjs/native-composition/renderer-selection.js +1 -0
  16. package/dist/cjs/native-composition/server-minify.js +1 -4
  17. package/dist/cjs/native-composition/server-plugin-resolution.js +1 -1
  18. package/dist/cjs/native-composition/type-checker.js +16 -4
  19. package/dist/cjs/native-composition/workspace-preset.js +0 -5
  20. package/dist/cjs/renderers/react/adapter.js +1 -1
  21. package/dist/cjs/renderers/react/build-metadata.js +1 -1
  22. package/dist/cjs/renderers/react/composition.js +3 -1
  23. package/dist/cjs/renderers/react/module-federation-recovery-plugin.js +1 -1
  24. package/dist/cjs/renderers/react/module-federation.js +57 -13
  25. package/dist/cjs/renderers/react/profile.js +6 -6
  26. package/dist/cjs/renderers/react/redact-integration-plugin.js +279 -0
  27. package/dist/cjs/renderers/react/router-bindings.js +4 -4
  28. package/dist/cjs/renderers/react/rsc-disabled-plugin.js +2 -2
  29. package/dist/esm/native-composition/config.mjs +3 -0
  30. package/dist/esm/native-composition/module-federation-renderer-plugin.mjs +5 -4
  31. package/dist/esm/native-composition/native-development.mjs +107 -41
  32. package/dist/esm/native-composition/native-federation-dev-assets.mjs +3 -3
  33. package/dist/esm/native-composition/native-federation-dev-public-path.mjs +8 -1
  34. package/dist/esm/native-composition/native-module-federation.mjs +3 -1
  35. package/dist/esm/native-composition/native-prerender.mjs +1 -1
  36. package/dist/esm/native-composition/redact-config.mjs +10 -0
  37. package/dist/esm/native-composition/renderer-registration.mjs +3 -1
  38. package/dist/esm/native-composition/renderer-selection.mjs +1 -0
  39. package/dist/esm/native-composition/server-minify.mjs +1 -4
  40. package/dist/esm/native-composition/type-checker.mjs +6 -4
  41. package/dist/esm/native-composition/workspace-preset.mjs +0 -5
  42. package/dist/esm/renderers/react/adapter.mjs +1 -1
  43. package/dist/esm/renderers/react/composition.mjs +2 -0
  44. package/dist/esm/renderers/react/module-federation.mjs +52 -11
  45. package/dist/esm/renderers/react/profile.mjs +6 -6
  46. package/dist/esm/renderers/react/redact-integration-plugin.mjs +195 -0
  47. package/dist/esm/renderers/react/router-bindings.mjs +4 -4
  48. package/dist/esm-node/native-composition/config.mjs +3 -0
  49. package/dist/esm-node/native-composition/module-federation-renderer-plugin.mjs +5 -4
  50. package/dist/esm-node/native-composition/native-development.mjs +107 -41
  51. package/dist/esm-node/native-composition/native-federation-dev-assets.mjs +3 -3
  52. package/dist/esm-node/native-composition/native-federation-dev-public-path.mjs +8 -1
  53. package/dist/esm-node/native-composition/native-module-federation.mjs +3 -1
  54. package/dist/esm-node/native-composition/native-prerender.mjs +1 -1
  55. package/dist/esm-node/native-composition/redact-config.mjs +11 -0
  56. package/dist/esm-node/native-composition/renderer-registration.mjs +3 -1
  57. package/dist/esm-node/native-composition/renderer-selection.mjs +1 -0
  58. package/dist/esm-node/native-composition/server-minify.mjs +1 -4
  59. package/dist/esm-node/native-composition/type-checker.mjs +6 -4
  60. package/dist/esm-node/native-composition/workspace-preset.mjs +0 -5
  61. package/dist/esm-node/renderers/react/adapter.mjs +1 -1
  62. package/dist/esm-node/renderers/react/composition.mjs +2 -0
  63. package/dist/esm-node/renderers/react/module-federation.mjs +52 -11
  64. package/dist/esm-node/renderers/react/profile.mjs +6 -6
  65. package/dist/esm-node/renderers/react/redact-integration-plugin.mjs +196 -0
  66. package/dist/esm-node/renderers/react/router-bindings.mjs +4 -4
  67. package/dist/types/native-composition/module-federation-renderer-plugin.d.ts +2 -1
  68. package/dist/types/native-composition/native-development.d.ts +10 -0
  69. package/dist/types/native-composition/native-federation-dev-public-path.d.ts +5 -0
  70. package/dist/types/native-composition/redact-config.d.ts +11 -0
  71. package/dist/types/native-composition/renderer-selection.d.ts +1 -1
  72. package/dist/types/native-composition/server-minify.d.ts +2 -5
  73. package/dist/types/native-composition/types.d.ts +7 -0
  74. package/dist/types/renderers/react/module-federation.d.ts +10 -1
  75. package/dist/types/renderers/react/redact-integration-plugin.d.ts +51 -0
  76. package/dist/types/renderers/react/types.d.ts +1 -1
  77. package/dist/types-esm/native-composition/module-federation-renderer-plugin.d.mts +2 -1
  78. package/dist/types-esm/native-composition/native-development.d.mts +10 -0
  79. package/dist/types-esm/native-composition/native-federation-dev-public-path.d.mts +5 -0
  80. package/dist/types-esm/native-composition/redact-config.d.mts +11 -0
  81. package/dist/types-esm/native-composition/renderer-selection.d.mts +1 -1
  82. package/dist/types-esm/native-composition/server-minify.d.mts +2 -5
  83. package/dist/types-esm/native-composition/types.d.mts +7 -0
  84. package/dist/types-esm/renderers/react/module-federation.d.mts +10 -1
  85. package/dist/types-esm/renderers/react/redact-integration-plugin.d.mts +51 -0
  86. package/dist/types-esm/renderers/react/types.d.mts +1 -1
  87. package/package.json +119 -45
  88. package/src/native-composition/config.ts +3 -0
  89. package/src/native-composition/module-federation-renderer-plugin.ts +17 -3
  90. package/src/native-composition/native-development.ts +176 -61
  91. package/src/native-composition/native-federation-dev-assets.ts +9 -6
  92. package/src/native-composition/native-federation-dev-public-path.ts +27 -0
  93. package/src/native-composition/native-module-federation.ts +12 -2
  94. package/src/native-composition/redact-config.ts +33 -0
  95. package/src/native-composition/renderer-registration.ts +2 -0
  96. package/src/native-composition/renderer-selection.ts +1 -0
  97. package/src/native-composition/server-minify.ts +3 -2
  98. package/src/native-composition/type-checker.ts +10 -8
  99. package/src/native-composition/types.ts +5 -0
  100. package/src/native-composition/workspace-preset.ts +0 -1
  101. package/src/renderers/react/composition.ts +2 -0
  102. package/src/renderers/react/module-federation.ts +107 -9
  103. package/src/renderers/react/profile.ts +6 -6
  104. package/src/renderers/react/redact-integration-plugin.ts +347 -0
  105. package/src/renderers/react/router-bindings.ts +4 -4
  106. package/src/renderers/react/types.ts +1 -1
package/README.md CHANGED
@@ -25,6 +25,47 @@ The selector belongs to this config import. Do not add another `appTools()` or
25
25
  native application source and dependencies, then a dev-server restart and a
26
26
  document reload. The generated entries own mounting and hydration.
27
27
 
28
+ ## Default React runtime
29
+
30
+ React applications use the framework's exact `@tanstack/redact@0.2.1` runtime
31
+ by default, on the client, Node SSR and Cloudflare workerd SSR. Keep authoring
32
+ normal React 19 imports; no application dependency or template edits enable it.
33
+ The framework owns Redact, `rsbuild-redact-plugin@0.1.0`, and a React 19 copy for
34
+ the public plugin's version check under pnpm's strict dependency isolation.
35
+ CSR uses that public plugin; SSR uses a fork-owned integration with the same
36
+ exact aliases, including canonical Redact imports, in every environment.
37
+ Custom Document compilers inherit these aliases instead of forcing real React
38
+ externals; the native compiler respects explicit runtime aliases.
39
+
40
+ ```ts
41
+ export default defineConfig({
42
+ // Omit for Redact with view transitions disabled.
43
+ redact: { viewTransitions: true },
44
+ server: { ssr: true },
45
+ });
46
+ ```
47
+
48
+ Set `redact: false` to use real React throughout the application. Invalid values
49
+ fail configuration validation. **RSC applications always use real React**, on
50
+ both server and client: Flight requires React internals Redact does not provide.
51
+ The CLI logs this limitation once rather than mixing runtimes.
52
+
53
+ Enabled builds require the reviewed pnpm patch whose first line in Redact's
54
+ `dist/server/stream.js` is `// ultramodern-redact-patch: v1`. Missing patches
55
+ fail the build with installation guidance and the `redact: false` escape hatch;
56
+ there is no configuration bypass. The patch fixes streamed Suspense IDs,
57
+ post-hydration IDs, namespace-sensitive segments and deferred reveal ordering.
58
+
59
+ Federated hosts and remotes must choose the same runtime. Their existing
60
+ renderer manifest contract publishes the effective runtime and hydration
61
+ identity (Redact `0.2.1`, or actual React for opt-out/RSC), and rejects mismatches
62
+ before remote initialization. Redact publishes under React's own share keys
63
+ (`react`, `react-dom`, JSX runtimes), once each, so hosts that govern those
64
+ singletons keep working. Each key carries Redact's real version with strict
65
+ matching, not a React 19 version, and direct Redact imports consume the same
66
+ singletons. The React authoring
67
+ profile continues to describe React's API/compiler, not the runtime override.
68
+
28
69
  ## Native application imports
29
70
 
30
71
  | Renderer | Component authoring | Application router |
@@ -50,6 +50,7 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
50
50
  const cli_namespaceObject = require("@modern-js/plugin/cli");
51
51
  const utils_namespaceObject = require("@modern-js/utils");
52
52
  const external_config_read_context_js_namespaceObject = require("./config-read-context.js");
53
+ const external_redact_config_js_namespaceObject = require("./redact-config.js");
53
54
  const external_renderer_registration_js_namespaceObject = require("./renderer-registration.js");
54
55
  const external_renderer_router_resolution_js_namespaceObject = require("./renderer-router-resolution.js");
55
56
  const external_renderer_selection_js_namespaceObject = require("./renderer-selection.js");
@@ -59,6 +60,7 @@ function isConfigPromise(value) {
59
60
  }
60
61
  function selectConfig(config, factory) {
61
62
  if (!config || 'object' != typeof config || Array.isArray(config)) throw new Error('UltraModern configuration must be an object');
63
+ (0, external_redact_config_js_namespaceObject.validateRedactConfig)(config.redact);
62
64
  const renderer = (0, external_renderer_registration_js_namespaceObject.resolveRendererAdapter)(config.renderer).name;
63
65
  const plugins = config.plugins ?? [];
64
66
  (0, external_renderer_selection_js_namespaceObject.assertNoAdditionalBasePlugins)(plugins);
@@ -88,6 +90,7 @@ function createDefineConfig(factory) {
88
90
  }
89
91
  async function resolveUltramodernConfig(config, context) {
90
92
  const resolved = 'function' == typeof config ? await config(context) : config;
93
+ (0, external_redact_config_js_namespaceObject.validateRedactConfig)(resolved.redact);
91
94
  const renderer = (0, external_renderer_registration_js_namespaceObject.resolveRendererAdapter)(resolved.renderer).name;
92
95
  return void 0 === resolved.renderer ? {
93
96
  ...resolved,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -72,9 +72,9 @@ function nativeManifestAssetNames(manifest) {
72
72
  function resolveRendererFederationRuntimePlugin(registrarUrl = __rslib_import_meta_url__) {
73
73
  return (0, external_node_module_namespaceObject.createRequire)(registrarUrl).resolve('@modern-js/federation-runtime/renderer-runtime-plugin');
74
74
  }
75
- function resolveRendererFederationCompatibility(renderer) {
75
+ function resolveRendererFederationCompatibility(renderer, config = {}) {
76
76
  const adapter = (0, external_renderer_registration_js_namespaceObject.resolveRendererAdapter)(renderer);
77
- if ('native' !== adapter.kind) return (0, module_federation_js_namespaceObject.resolveReactFederationCompatibility)();
77
+ if ('native' !== adapter.kind) return (0, module_federation_js_namespaceObject.resolveReactFederationCompatibility)(config);
78
78
  const owners = adapter.runtime;
79
79
  const metadata = (0, external_renderer_profile_js_namespaceObject.resolveRendererProfileMetadata)(renderer);
80
80
  const bootstrap = metadata.frameworkPackages.find((owner)=>owner.specifier === owners.bootstrap);
@@ -121,7 +121,7 @@ function createRendererModuleFederationIntegration(renderer, options = {}) {
121
121
  api.modifyBundlerChain((chain)=>{
122
122
  const nativeKeys = NATIVE_PLUGINS.filter((key)=>chain.plugins.has(key));
123
123
  if (!nativeKeys.length) return;
124
- const compatibility = (0, renderer_contract_namespaceObject.readRendererFederationCompatibility)(options.resolveCompatibility?.() ?? resolveRendererFederationCompatibility(renderer));
124
+ const compatibility = (0, renderer_contract_namespaceObject.readRendererFederationCompatibility)(options.resolveCompatibility?.() ?? resolveRendererFederationCompatibility(renderer, api.getNormalizedConfig()));
125
125
  const runtimePlugin = (options.resolveRuntimePlugin ?? resolveRendererFederationRuntimePlugin)();
126
126
  const stamped = new WeakSet();
127
127
  const publications = new Set();
@@ -132,6 +132,7 @@ function createRendererModuleFederationIntegration(renderer, options = {}) {
132
132
  const config = {
133
133
  ...original
134
134
  };
135
+ if ('react' === renderer) config.shared = (0, module_federation_js_namespaceObject.withReactRuntimeShared)(config.shared, compatibility);
135
136
  if (false === config.manifest) throw (0, renderer_contract_namespaceObject.rendererFederationError)('renderer components require native manifest publication.');
136
137
  if (void 0 !== config.manifest && true !== config.manifest && !record(config.manifest)) throw (0, renderer_contract_namespaceObject.rendererFederationError)('native manifest options must be a boolean or record.');
137
138
  const manifest = record(config.manifest) ? config.manifest : {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -96,6 +96,47 @@ function emittedBytes(result, name) {
96
96
  });
97
97
  }
98
98
  class NativeDevelopment {
99
+ async captureFederationGraph(result) {
100
+ try {
101
+ const entryNames = Object.keys(this.options.getSessionIdentities().identities);
102
+ const assets = await (0, external_native_federation_dev_assets_js_namespaceObject.collectNativeFederationDevAssets)(result, entryNames, (name)=>emittedBytes(result, name));
103
+ if (0 === assets.size) return;
104
+ return {
105
+ assets,
106
+ graph: (0, external_native_federation_dev_assets_js_namespaceObject.nativeFederationDevGraph)(result)
107
+ };
108
+ } catch {
109
+ return;
110
+ }
111
+ }
112
+ retainFinishedGraphs() {
113
+ const pending = this.finishedFederationGraphs;
114
+ this.finishedFederationGraphs = [];
115
+ for (const finished of pending){
116
+ if (this.closed) return;
117
+ const revision = (0, external_native_federation_dev_assets_js_namespaceObject.nativeFederationDevRevision)(finished.assets);
118
+ const graphManifest = finished.graph?.immutableManifest;
119
+ try {
120
+ this.retainedFederationAssets = (0, external_native_federation_dev_assets_js_namespaceObject.retainNativeFederationDevAssets)(this.retainedFederationAssets, new Map([
121
+ ...finished.assets
122
+ ].map(([url, asset])=>[
123
+ url,
124
+ {
125
+ ...asset,
126
+ revision,
127
+ graphManifest
128
+ }
129
+ ])));
130
+ } catch (error) {
131
+ utils_namespaceObject.logger.warn('Native development could not retain a finished federation graph.', error);
132
+ continue;
133
+ }
134
+ this.federationAssets = new Map([
135
+ ...this.federationAssets,
136
+ ...this.retainedFederationAssets
137
+ ]);
138
+ }
139
+ }
99
140
  notify() {
100
141
  for (const waiter of this.waiters)waiter();
101
142
  this.waiters.clear();
@@ -254,6 +295,7 @@ class NativeDevelopment {
254
295
  this.closed = true;
255
296
  this.ready = void 0;
256
297
  this.notify();
298
+ await this.publication.catch(()=>{});
257
299
  this.retained.clear();
258
300
  this.federationAssets = new Map();
259
301
  this.federationRevision = void 0;
@@ -270,11 +312,13 @@ class NativeDevelopment {
270
312
  this.compilerVersions = new WeakMap();
271
313
  this.compilationVersions = new WeakMap();
272
314
  this.generation = 0;
315
+ this.publication = Promise.resolve();
273
316
  this.closed = false;
274
317
  this.retained = new Map();
275
318
  this.federationAssets = new Map();
276
319
  this.federationCompilers = new Set();
277
320
  this.retainedFederationAssets = new Map();
321
+ this.finishedFederationGraphs = [];
278
322
  this.mutableClientAssets = new Set([
279
323
  'renderer-assets.json'
280
324
  ]);
@@ -320,14 +364,9 @@ class NativeDevelopment {
320
364
  const pathname = URL.parse(request.url ?? '/', 'http://native-dev.invalid')?.pathname;
321
365
  const protocol = request.socket instanceof external_node_tls_namespaceObject.TLSSocket ? 'https:' : 'http:';
322
366
  const origin = `${protocol}//${request.headers.host}`;
323
- if (!owner.federationGraph && [
324
- ...owner.federationCompilers
325
- ].some((compiler)=>{
326
- const manifest = (0, external_native_federation_dev_assets_js_namespaceObject.nativeFederationDevManifest)(compiler);
327
- return manifest && URL.parse(manifest)?.pathname === pathname;
328
- })) {
367
+ const afterPublication = (resume)=>{
329
368
  const pending = new AbortController();
330
- const aborted = ()=>pending.abort(new Error('Native manifest request closed'));
369
+ const aborted = ()=>pending.abort(new Error('Native graph request closed'));
331
370
  request.once('aborted', aborted);
332
371
  response.once('close', aborted);
333
372
  if (request.aborted || response.destroyed) aborted();
@@ -337,15 +376,21 @@ class NativeDevelopment {
337
376
  };
338
377
  owner.waitForPublication(pending.signal).then(()=>{
339
378
  cleanup();
340
- if (pending.signal.aborted) return;
341
- if (!owner.federationGraph) return next(new Error('Native browser manifest was not published'));
342
- serve(request, response, next);
379
+ if (!pending.signal.aborted) resume();
343
380
  }, (error)=>{
344
381
  cleanup();
345
382
  if (!pending.signal.aborted) next(error);
346
383
  });
347
- return;
348
- }
384
+ };
385
+ if (!owner.federationGraph && [
386
+ ...owner.federationCompilers
387
+ ].some((compiler)=>{
388
+ const manifest = (0, external_native_federation_dev_assets_js_namespaceObject.nativeFederationDevManifest)(compiler);
389
+ return manifest && URL.parse(manifest)?.pathname === pathname;
390
+ })) return void afterPublication(()=>{
391
+ if (!owner.federationGraph) return next(new Error('Native browser manifest was not published'));
392
+ serve(request, response, next);
393
+ });
349
394
  const hotUpdate = owner.federationGraph && (0, external_native_federation_dev_public_path_js_namespaceObject.nativeFederationDevHotUpdateTarget)(owner.federationGraph.publicPath, request.url ?? '/', origin);
350
395
  if (hotUpdate) {
351
396
  request.url = hotUpdate;
@@ -354,7 +399,10 @@ class NativeDevelopment {
354
399
  const federationAsset = (0, external_native_federation_dev_assets_js_namespaceObject.resolveNativeFederationDevAsset)(owner.federationAssets, request.url ?? '/', origin) ?? (owner.federationGraph && (0, external_native_federation_dev_assets_js_namespaceObject.resolveNativeFederationDevManifest)(owner.federationAssets, request.url ?? '/', owner.federationGraph.manifest));
355
400
  const revision = owner.federationRevision;
356
401
  const asset = federationAsset || pathname && owner.retained.get(pathname);
357
- if (!asset) return next();
402
+ if (!asset) {
403
+ if (owner.federationGraph && !owner.ready && !owner.failure && (0, external_native_federation_dev_public_path_js_namespaceObject.isNativeFederationDevGraphAsset)(owner.federationGraph.publicPath, request.url ?? '/', origin)) return void afterPublication(()=>serve(request, response, next));
404
+ return next();
405
+ }
358
406
  applyDevServerHeaders(request, response, api.getNormalizedConfig().server).then(()=>{
359
407
  response.setHeader('Content-Type', asset.contentType);
360
408
  response.setHeader('Content-Length', asset.bytes.length);
@@ -416,36 +464,54 @@ class NativeDevelopment {
416
464
  this.invalidate();
417
465
  });
418
466
  candidate.hooks.failed.tap('UltraModernNativeDevelopment', (error)=>this.fail(error));
467
+ candidate.hooks.done.tapPromise(runHook, async (result)=>{
468
+ if (result.hasErrors()) return;
469
+ const finished = await this.captureFederationGraph(result);
470
+ if (finished) this.finishedFederationGraphs.push(finished);
471
+ });
419
472
  }
420
473
  });
421
- api.onDevCompileDone(async ({ stats })=>{
474
+ api.onDevCompileDone(({ stats })=>{
422
475
  const epoch = this.epoch;
423
- const results = 'stats' in stats ? stats.stats : [
424
- stats
425
- ];
426
- if (this.closed || results.some((result)=>{
427
- const version = this.compilationVersions.get(result.compilation);
428
- return void 0 === version || version !== this.compilerVersions.get(result.compilation.compiler);
429
- })) return;
430
- if (stats.hasErrors()) return this.fail(new Error('Native development compilation failed'));
431
- try {
432
- const publication = await this.publish(stats);
476
+ const publishCurrent = async ()=>{
433
477
  if (this.closed || epoch !== this.epoch) return;
434
- this.retainedFederationAssets = publication.retainedFederationAssets;
435
- this.federationAssets = new Map([
436
- ...publication.federationAssets,
437
- ...this.retainedFederationAssets
438
- ]);
439
- this.federationRevision = publication.federationRevision;
440
- this.federationGraph = publication.federationGraph;
441
- this.ready = publication.entries;
442
- this.failure = void 0;
443
- this.notify();
444
- } catch (error) {
445
- if (this.closed || epoch !== this.epoch) return;
446
- this.fail(error);
447
- api.logger.error('Native development could not load the compiled application.', error);
448
- }
478
+ const results = 'stats' in stats ? stats.stats : [
479
+ stats
480
+ ];
481
+ if (results.some((result)=>{
482
+ const version = this.compilationVersions.get(result.compilation);
483
+ return void 0 === version || version !== this.compilerVersions.get(result.compilation.compiler);
484
+ })) return;
485
+ if (stats.hasErrors()) return this.fail(new Error('Native development compilation failed'));
486
+ try {
487
+ const publication = await this.publish(stats);
488
+ if (this.closed || epoch !== this.epoch) return;
489
+ this.retainedFederationAssets = publication.retainedFederationAssets;
490
+ this.retainFinishedGraphs();
491
+ this.federationAssets = new Map([
492
+ ...publication.federationAssets,
493
+ ...this.retainedFederationAssets
494
+ ]);
495
+ this.federationRevision = publication.federationRevision;
496
+ this.federationGraph = publication.federationGraph;
497
+ this.ready = publication.entries;
498
+ this.failure = void 0;
499
+ this.notify();
500
+ } catch (error) {
501
+ if (this.closed || epoch !== this.epoch) return;
502
+ this.fail(error);
503
+ api.logger.error('Native development could not load the compiled application.', error);
504
+ }
505
+ };
506
+ const publishNext = async ()=>{
507
+ try {
508
+ await publishCurrent();
509
+ } finally{
510
+ this.retainFinishedGraphs();
511
+ }
512
+ };
513
+ this.publication = this.publication.then(publishNext, publishNext);
514
+ return this.publication;
449
515
  });
450
516
  api.onCloseDevServer(()=>this.close());
451
517
  }
@@ -50,9 +50,9 @@ function nativeEntryCommandPlugin() {
50
50
  }
51
51
  };
52
52
  }
53
- __webpack_require__.d(__webpack_exports__, {
54
- createRouteGenerationCommand: ()=>createRouteGenerationCommand,
55
- nativeEntryCommandPlugin: ()=>nativeEntryCommandPlugin
53
+ __webpack_require__.d(__webpack_exports__, {}, {
54
+ createRouteGenerationCommand: createRouteGenerationCommand,
55
+ nativeEntryCommandPlugin: nativeEntryCommandPlugin
56
56
  });
57
57
  exports.createRouteGenerationCommand = __webpack_exports__.createRouteGenerationCommand;
58
58
  exports.nativeEntryCommandPlugin = __webpack_exports__.nativeEntryCommandPlugin;
@@ -122,10 +122,11 @@ class NativeFederationDevAssetsPlugin {
122
122
  if (!safeAssetPathname(`/${manifestFile}`)) throw new Error('Unsafe native development federation manifest path');
123
123
  const publicPath = compilation.outputOptions.publicPath;
124
124
  if ('string' != typeof publicPath) throw new Error('Native development federation requires an explicit browser publicPath');
125
- const graphPrefix = (0, external_native_federation_dev_public_path_js_namespaceObject.nativeFederationDevGraphPublicPath)(publicPath);
125
+ const graphPublicPath = publicPath;
126
126
  class GraphPublicPathRuntimeModule extends core_namespaceObject.rspack.RuntimeModule {
127
127
  generate() {
128
- return `/* graph ${this.compilation?.fullHash ?? 'pending'} */\n${core_namespaceObject.rspack.RuntimeGlobals.publicPath} = ${JSON.stringify(graphPrefix)} + ${core_namespaceObject.rspack.RuntimeGlobals.getFullHash}() + "/";`;
128
+ const graph = (0, external_native_federation_dev_public_path_js_namespaceObject.nativeFederationDevGraphPublicPath)(graphPublicPath, this.compilation?.fullHash || void 0);
129
+ return `${core_namespaceObject.rspack.RuntimeGlobals.publicPath} = ${JSON.stringify(graph)};`;
129
130
  }
130
131
  constructor(){
131
132
  super('native federation graph publicPath', core_namespaceObject.rspack.RuntimeModule.STAGE_ATTACH);
@@ -134,7 +135,6 @@ class NativeFederationDevAssetsPlugin {
134
135
  }
135
136
  compilation.hooks.additionalTreeRuntimeRequirements.tap(name, (chunk, requirements)=>{
136
137
  if (chunk.name !== this.container) return;
137
- requirements.add(core_namespaceObject.rspack.RuntimeGlobals.getFullHash);
138
138
  requirements.add(core_namespaceObject.rspack.RuntimeGlobals.publicPath);
139
139
  compilation.addRuntimeModule(chunk, new GraphPublicPathRuntimeModule());
140
140
  });
@@ -28,6 +28,7 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
+ isNativeFederationDevGraphAsset: ()=>isNativeFederationDevGraphAsset,
31
32
  nativeFederationDevGraphPublicPath: ()=>nativeFederationDevGraphPublicPath,
32
33
  nativeFederationDevHotUpdateTarget: ()=>nativeFederationDevHotUpdateTarget,
33
34
  resolveNativeFederationDevPublicPath: ()=>resolveNativeFederationDevPublicPath
@@ -88,10 +89,19 @@ function nativeFederationDevHotUpdateTarget(publicPath, target, origin) {
88
89
  }
89
90
  return `${new URL(match[1], publicPath.endsWith('/') ? publicPath : `${publicPath}/`).pathname}${url.search}`;
90
91
  }
92
+ function isNativeFederationDevGraphAsset(publicPath, target, origin) {
93
+ if (!target.startsWith('/') || target.startsWith('//') || target.includes('#')) return false;
94
+ const pathname = target.split('?')[0];
95
+ const url = URL.parse(target, origin);
96
+ const prefix = new URL(nativeFederationDevGraphPublicPath(publicPath));
97
+ return !!url && url.pathname === pathname && url.origin === prefix.origin && url.pathname.startsWith(prefix.pathname) && /^[a-f0-9]+\/[^/]/iu.test(url.pathname.slice(prefix.pathname.length));
98
+ }
99
+ exports.isNativeFederationDevGraphAsset = __webpack_exports__.isNativeFederationDevGraphAsset;
91
100
  exports.nativeFederationDevGraphPublicPath = __webpack_exports__.nativeFederationDevGraphPublicPath;
92
101
  exports.nativeFederationDevHotUpdateTarget = __webpack_exports__.nativeFederationDevHotUpdateTarget;
93
102
  exports.resolveNativeFederationDevPublicPath = __webpack_exports__.resolveNativeFederationDevPublicPath;
94
103
  for(var __rspack_i in __webpack_exports__)if (-1 === [
104
+ "isNativeFederationDevGraphAsset",
95
105
  "nativeFederationDevGraphPublicPath",
96
106
  "nativeFederationDevHotUpdateTarget",
97
107
  "resolveNativeFederationDevPublicPath"
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -698,9 +698,11 @@ function nativeModuleFederationPlugin(renderer) {
698
698
  await splitClientEntries(chain, internalDirectory);
699
699
  });
700
700
  api.modifyRspackConfig(async (config, { environment })=>{
701
+ if ('client' !== environment.name && 'server' !== environment.name) return;
701
702
  const authored = await load();
703
+ const enabled = authored && ('client' === environment.name || serverRendered(authored));
704
+ if ('object' == typeof config.cache && 'persistent' === config.cache.type) config.cache.version = `${config.cache.version ?? ''}-ultramodern-mf-${enabled ? 'on' : 'off'}`;
702
705
  if (!authored) return;
703
- if ('client' !== environment.name && 'server' !== environment.name) return;
704
706
  const context = api.getAppContext();
705
707
  const address = context.builder?.context.devServer;
706
708
  if ('dev' === context.command && address) {
@@ -191,7 +191,7 @@ function markPrerenderedDocument(html) {
191
191
  const marker = `<meta name="${data_namespaceObject.PRERENDERED_DOCUMENT_META}" content="static-data">`;
192
192
  let close = -1;
193
193
  let templates = 0;
194
- for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s*>|<!--[\s\S]*?-->|<\/(head|template)\s*>|<[a-z][^\s/>]*(?:"[^"]*"|'[^']*'|[^>"'])*>/giu)){
194
+ for (const match of html.matchAll(/<(script|style|title|textarea|noscript|xmp|iframe|noembed|noframes)\b(?:"[^"]*"|'[^']*'|[^>"'])*>[\s\S]*?<\/\1\s*>|<\x21--[\s\S]*?--\x3e|<\/(head|template)\s*>|<[a-z][^\s/>]*(?:"[^"]*"|'[^']*'|[^>"'])*>/giu)){
195
195
  const token = match[0];
196
196
  if (/^<template\b/iu.test(token)) templates += 1;
197
197
  else if (match[2]?.toLowerCase() === 'template') templates = Math.max(0, templates - 1);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ function validateRedactConfig(value) {
31
+ if (void 0 === value || 'boolean' == typeof value) return;
32
+ if (null !== value && 'object' == typeof value && !Array.isArray(value) && (Object.getPrototypeOf(value) === Object.prototype || null === Object.getPrototypeOf(value)) && Object.keys(value).every((key)=>'viewTransitions' === key) && (!('viewTransitions' in value) || void 0 === value.viewTransitions || 'boolean' == typeof value.viewTransitions)) return;
33
+ throw new Error('[ultramodern] redact must be a boolean or { viewTransitions?: boolean }. Use redact: false to keep real React.');
34
+ }
35
+ function usesRedact(config) {
36
+ validateRedactConfig(config.redact);
37
+ return false !== config.redact && !config.server?.rsc;
38
+ }
39
+ __webpack_require__.d(__webpack_exports__, {}, {
40
+ usesRedact: usesRedact,
41
+ validateRedactConfig: validateRedactConfig
42
+ });
43
+ exports.usesRedact = __webpack_exports__.usesRedact;
44
+ exports.validateRedactConfig = __webpack_exports__.validateRedactConfig;
45
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
46
+ "usesRedact",
47
+ "validateRedactConfig"
48
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
49
+ Object.defineProperty(exports, '__esModule', {
50
+ value: true
51
+ });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -53,7 +53,9 @@ const rendererRegistrations = {
53
53
  '@modern-js/runtime',
54
54
  '@modern-js/plugin-tanstack',
55
55
  '@modern-js/plugin-i18n',
56
- '@tanstack/react-router'
56
+ '@tanstack/react-router',
57
+ '@tanstack/redact',
58
+ 'rsbuild-redact-plugin'
57
59
  ],
58
60
  ownedExtensions: []
59
61
  },
@@ -91,6 +91,7 @@ const REACT_CLI_PLUGIN_NAMES = [
91
91
  '@modern-js/plugin-document',
92
92
  '@modern-js/ultramodern-router-integration',
93
93
  '@modern-js/ultramodern-ssr-integration',
94
+ '@modern-js/ultramodern-redact-integration',
94
95
  '@modern-js/ultramodern-i18n-integration',
95
96
  '@modern-js/i18n-integration',
96
97
  '@modern-js/plugin-i18n',
@@ -35,10 +35,7 @@ const ULTRAMODERN_SERVER_MINIFY = {
35
35
  keep_classnames: true,
36
36
  keep_fnames: true
37
37
  },
38
- mangle: {
39
- keep_classnames: true,
40
- keep_fnames: true
41
- }
38
+ mangle: false
42
39
  }
43
40
  }
44
41
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
  var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
3
12
  (()=>{
4
13
  __webpack_require__.d = (exports1, getters, values)=>{
5
14
  var define = (defs, kind)=>{
@@ -31,6 +40,9 @@ __webpack_require__.d(__webpack_exports__, {
31
40
  rendererTypeCheckerOptions: ()=>rendererTypeCheckerOptions,
32
41
  rendererTypeCheckerPlugin: ()=>rendererTypeCheckerPlugin
33
42
  });
43
+ const external_node_path_namespaceObject = require("node:path");
44
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
45
+ const native_server_compiler_namespaceObject = require("@modern-js/app-tools-extensions/native-server-compiler");
34
46
  const native_type_checker_namespaceObject = require("@modern-js/app-tools-extensions/native-type-checker");
35
47
  const external_renderer_profile_js_namespaceObject = require("./renderer-profile.js");
36
48
  const rendererTypeCheckerOptions = (renderer)=>({
@@ -50,15 +62,15 @@ const rendererTypeCheckerPlugin = (renderer)=>({
50
62
  setup (api) {
51
63
  api.config(()=>({
52
64
  tools: {
65
+ serverCompiler: native_server_compiler_namespaceObject.nativeServerCompiler,
53
66
  tsChecker: rendererTypeCheckerOptions(renderer),
54
67
  bundlerChain (chain, utils) {
55
68
  const pluginId = utils.CHAIN_ID.PLUGIN.TS_CHECKER;
56
69
  if (!chain.plugins.has(pluginId)) return;
57
70
  const options = chain.plugin(pluginId).get('args')?.[0];
58
- if (options?.typescript?.tsgo === false) throw new Error("unsupported-type-checker: UltraModern requires native TypeScript 7.0.2; typescript.tsgo cannot be false");
59
- const typescriptPath = options?.typescript?.typescriptPath;
60
- if ('string' != typeof typescriptPath || !typescriptPath) throw new Error('unsupported-type-checker: UltraModern requires the selected native TypeScript 7.0.2 package');
61
- (0, native_type_checker_namespaceObject.configureUltramodernTypeChecker)(chain, pluginId, ()=>(0, native_type_checker_namespaceObject.resolveNativeTypeCheckerCommand)(typescriptPath));
71
+ if (options?.typescript?.tsgo === false) throw new Error("unsupported-type-checker: UltraModern requires an Effect-enabled native compiler; typescript.tsgo cannot be false");
72
+ const { appDirectory } = api.getAppContext();
73
+ (0, native_type_checker_namespaceObject.configureUltramodernTypeChecker)(chain, pluginId, ()=>(0, native_type_checker_namespaceObject.resolveNativeTypeCheckerCommand)(external_node_path_default().join(appDirectory, 'package.json')));
62
74
  }
63
75
  }
64
76
  }));
@@ -340,11 +340,6 @@ const resolveWorkspaceConfig = (config, options)=>{
340
340
  mainEntryName: 'index'
341
341
  },
342
342
  tools: {
343
- autoprefixer: {
344
- overrideBrowserslist: [
345
- 'defaults'
346
- ]
347
- },
348
343
  ...mfName ? {
349
344
  bundlerChain: (chain)=>{
350
345
  chain.output.uniqueName(mfName).chunkLoadingGlobal(`__ULTRAMODERN_${envSegment(mfName)}_LOADED_CHUNKS__`);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
- return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
3
+ return "u" < typeof document ? require('url'.replace('', '')).pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
4
  }();
5
5
  var __webpack_require__ = {};
6
6
  (()=>{