@bleedingdev/modern-js-surface-resolution 3.9.0-ultramodern.11 → 3.9.0-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.
@@ -30,7 +30,8 @@ __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
31
  DEFAULT_LOCAL_ENVIRONMENTS: ()=>DEFAULT_LOCAL_ENVIRONMENTS,
32
32
  ENV_STATIC_PROVIDER_NAME: ()=>ENV_STATIC_PROVIDER_NAME,
33
- createEnvStaticSurfaceResolutionProvider: ()=>createEnvStaticSurfaceResolutionProvider
33
+ createEnvStaticSurfaceResolutionProvider: ()=>createEnvStaticSurfaceResolutionProvider,
34
+ resolveBrowserManifestAddress: ()=>resolveBrowserManifestAddress
34
35
  });
35
36
  const external_surface_ref_js_namespaceObject = require("./surface-ref.js");
36
37
  const external_validation_js_namespaceObject = require("./validation.js");
@@ -59,7 +60,7 @@ function createEnvContext(env, allowLocalFallback) {
59
60
  };
60
61
  }
61
62
  function resolveBaseUrl(context, unit) {
62
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
63
+ const { publicUrlEnv } = unit;
63
64
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
64
65
  if (void 0 !== configuredPublicUrl) return {
65
66
  ok: true,
@@ -95,15 +96,15 @@ function resolveBaseUrl(context, unit) {
95
96
  }
96
97
  };
97
98
  }
98
- function resolveBrowserMfManifest(context, unit) {
99
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
99
+ function resolveBrowserManifestAddress(env, unit, environment, localEnvironments = DEFAULT_LOCAL_ENVIRONMENTS) {
100
+ return resolveBrowserManifestAddressInContext(createEnvContext(env, localEnvironments.includes(environment)), unit);
101
+ }
102
+ function resolveBrowserManifestAddressInContext(context, unit) {
103
+ const { manifestEnv } = unit;
100
104
  const configuredManifest = envValue(context.env, manifestEnv);
101
105
  if (void 0 !== configuredManifest) return {
102
106
  ok: true,
103
- location: {
104
- platform: 'browser-mf-manifest',
105
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
106
- }
107
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
107
108
  };
108
109
  const base = resolveBaseUrl(context, unit);
109
110
  if (!base.ok) return {
@@ -116,10 +117,7 @@ function resolveBrowserMfManifest(context, unit) {
116
117
  };
117
118
  return {
118
119
  ok: true,
119
- location: {
120
- platform: 'browser-mf-manifest',
121
- manifestUrl: `${base.baseUrl}/mf-manifest.json`
122
- }
120
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`
123
121
  };
124
122
  }
125
123
  function resolveNodeMfManifest(context, unit) {
@@ -155,7 +153,10 @@ function resolveNodeMfManifest(context, unit) {
155
153
  };
156
154
  }
157
155
  function resolveHttpApi(context, unit, config) {
158
- const base = resolveBaseUrl(context, unit);
156
+ const base = resolveBaseUrl(context, {
157
+ ...unit,
158
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
159
+ });
159
160
  if (!base.ok) return {
160
161
  ok: false,
161
162
  reason: `http-api unavailable (${base.reason})`,
@@ -188,7 +189,20 @@ function resolveCloudflareServiceBinding(config) {
188
189
  }
189
190
  function resolveSurfaceLocations(context, unit, surface) {
190
191
  const outcomes = [];
191
- if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
192
+ if (surface.platforms.browserMfManifest) {
193
+ const address = resolveBrowserManifestAddressInContext(context, {
194
+ ...unit,
195
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
196
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
197
+ });
198
+ outcomes.push(address.ok ? {
199
+ ok: true,
200
+ location: {
201
+ platform: 'browser-mf-manifest',
202
+ manifestUrl: address.manifestUrl
203
+ }
204
+ } : address);
205
+ }
192
206
  if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
193
207
  if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
194
208
  if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
@@ -308,10 +322,12 @@ function createEnvStaticSurfaceResolutionProvider(options) {
308
322
  exports.DEFAULT_LOCAL_ENVIRONMENTS = __webpack_exports__.DEFAULT_LOCAL_ENVIRONMENTS;
309
323
  exports.ENV_STATIC_PROVIDER_NAME = __webpack_exports__.ENV_STATIC_PROVIDER_NAME;
310
324
  exports.createEnvStaticSurfaceResolutionProvider = __webpack_exports__.createEnvStaticSurfaceResolutionProvider;
325
+ exports.resolveBrowserManifestAddress = __webpack_exports__.resolveBrowserManifestAddress;
311
326
  for(var __rspack_i in __webpack_exports__)if (-1 === [
312
327
  "DEFAULT_LOCAL_ENVIRONMENTS",
313
328
  "ENV_STATIC_PROVIDER_NAME",
314
- "createEnvStaticSurfaceResolutionProvider"
329
+ "createEnvStaticSurfaceResolutionProvider",
330
+ "resolveBrowserManifestAddress"
315
331
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
316
332
  Object.defineProperty(exports, '__esModule', {
317
333
  value: true
@@ -35,6 +35,7 @@ __webpack_require__.d(__webpack_exports__, {
35
35
  formatSurfaceRef: ()=>external_surface_ref_js_namespaceObject.formatSurfaceRef,
36
36
  matchDeliveryUnitIdentity: ()=>external_validation_js_namespaceObject.matchDeliveryUnitIdentity,
37
37
  parseSurfaceRef: ()=>external_surface_ref_js_namespaceObject.parseSurfaceRef,
38
+ resolveBrowserManifestAddress: ()=>external_env_static_provider_js_namespaceObject.resolveBrowserManifestAddress,
38
39
  selectResolvedSurface: ()=>external_validation_js_namespaceObject.selectResolvedSurface,
39
40
  validateResolvedDeliveryUnit: ()=>external_validation_js_namespaceObject.validateResolvedDeliveryUnit,
40
41
  validateSurfaceRef: ()=>external_surface_ref_js_namespaceObject.validateSurfaceRef
@@ -49,6 +50,7 @@ exports.createEnvStaticSurfaceResolutionProvider = __webpack_exports__.createEnv
49
50
  exports.formatSurfaceRef = __webpack_exports__.formatSurfaceRef;
50
51
  exports.matchDeliveryUnitIdentity = __webpack_exports__.matchDeliveryUnitIdentity;
51
52
  exports.parseSurfaceRef = __webpack_exports__.parseSurfaceRef;
53
+ exports.resolveBrowserManifestAddress = __webpack_exports__.resolveBrowserManifestAddress;
52
54
  exports.selectResolvedSurface = __webpack_exports__.selectResolvedSurface;
53
55
  exports.validateResolvedDeliveryUnit = __webpack_exports__.validateResolvedDeliveryUnit;
54
56
  exports.validateSurfaceRef = __webpack_exports__.validateSurfaceRef;
@@ -60,6 +62,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
60
62
  "formatSurfaceRef",
61
63
  "matchDeliveryUnitIdentity",
62
64
  "parseSurfaceRef",
65
+ "resolveBrowserManifestAddress",
63
66
  "selectResolvedSurface",
64
67
  "validateResolvedDeliveryUnit",
65
68
  "validateSurfaceRef"
@@ -25,7 +25,7 @@ function createEnvContext(env, allowLocalFallback) {
25
25
  };
26
26
  }
27
27
  function resolveBaseUrl(context, unit) {
28
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
28
+ const { publicUrlEnv } = unit;
29
29
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
30
30
  if (void 0 !== configuredPublicUrl) return {
31
31
  ok: true,
@@ -61,15 +61,15 @@ function resolveBaseUrl(context, unit) {
61
61
  }
62
62
  };
63
63
  }
64
- function resolveBrowserMfManifest(context, unit) {
65
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
64
+ function resolveBrowserManifestAddress(env, unit, environment, localEnvironments = DEFAULT_LOCAL_ENVIRONMENTS) {
65
+ return resolveBrowserManifestAddressInContext(createEnvContext(env, localEnvironments.includes(environment)), unit);
66
+ }
67
+ function resolveBrowserManifestAddressInContext(context, unit) {
68
+ const { manifestEnv } = unit;
66
69
  const configuredManifest = envValue(context.env, manifestEnv);
67
70
  if (void 0 !== configuredManifest) return {
68
71
  ok: true,
69
- location: {
70
- platform: 'browser-mf-manifest',
71
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
72
- }
72
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
73
73
  };
74
74
  const base = resolveBaseUrl(context, unit);
75
75
  if (!base.ok) return {
@@ -82,10 +82,7 @@ function resolveBrowserMfManifest(context, unit) {
82
82
  };
83
83
  return {
84
84
  ok: true,
85
- location: {
86
- platform: 'browser-mf-manifest',
87
- manifestUrl: `${base.baseUrl}/mf-manifest.json`
88
- }
85
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`
89
86
  };
90
87
  }
91
88
  function resolveNodeMfManifest(context, unit) {
@@ -121,7 +118,10 @@ function resolveNodeMfManifest(context, unit) {
121
118
  };
122
119
  }
123
120
  function resolveHttpApi(context, unit, config) {
124
- const base = resolveBaseUrl(context, unit);
121
+ const base = resolveBaseUrl(context, {
122
+ ...unit,
123
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
124
+ });
125
125
  if (!base.ok) return {
126
126
  ok: false,
127
127
  reason: `http-api unavailable (${base.reason})`,
@@ -154,7 +154,20 @@ function resolveCloudflareServiceBinding(config) {
154
154
  }
155
155
  function resolveSurfaceLocations(context, unit, surface) {
156
156
  const outcomes = [];
157
- if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
157
+ if (surface.platforms.browserMfManifest) {
158
+ const address = resolveBrowserManifestAddressInContext(context, {
159
+ ...unit,
160
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
161
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
162
+ });
163
+ outcomes.push(address.ok ? {
164
+ ok: true,
165
+ location: {
166
+ platform: 'browser-mf-manifest',
167
+ manifestUrl: address.manifestUrl
168
+ }
169
+ } : address);
170
+ }
158
171
  if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
159
172
  if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
160
173
  if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
@@ -271,4 +284,4 @@ function createEnvStaticSurfaceResolutionProvider(options) {
271
284
  }
272
285
  };
273
286
  }
274
- export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider };
287
+ export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider, resolveBrowserManifestAddress };
@@ -1,3 +1,3 @@
1
- export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider } from "./env-static-provider.mjs";
1
+ export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider, resolveBrowserManifestAddress } from "./env-static-provider.mjs";
2
2
  export { formatSurfaceRef, parseSurfaceRef, validateSurfaceRef } from "./surface-ref.mjs";
3
3
  export { createDiscoveryError, matchDeliveryUnitIdentity, selectResolvedSurface, validateResolvedDeliveryUnit } from "./validation.mjs";
@@ -26,7 +26,7 @@ function createEnvContext(env, allowLocalFallback) {
26
26
  };
27
27
  }
28
28
  function resolveBaseUrl(context, unit) {
29
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
29
+ const { publicUrlEnv } = unit;
30
30
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
31
31
  if (void 0 !== configuredPublicUrl) return {
32
32
  ok: true,
@@ -62,15 +62,15 @@ function resolveBaseUrl(context, unit) {
62
62
  }
63
63
  };
64
64
  }
65
- function resolveBrowserMfManifest(context, unit) {
66
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
65
+ function resolveBrowserManifestAddress(env, unit, environment, localEnvironments = DEFAULT_LOCAL_ENVIRONMENTS) {
66
+ return resolveBrowserManifestAddressInContext(createEnvContext(env, localEnvironments.includes(environment)), unit);
67
+ }
68
+ function resolveBrowserManifestAddressInContext(context, unit) {
69
+ const { manifestEnv } = unit;
67
70
  const configuredManifest = envValue(context.env, manifestEnv);
68
71
  if (void 0 !== configuredManifest) return {
69
72
  ok: true,
70
- location: {
71
- platform: 'browser-mf-manifest',
72
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
73
- }
73
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
74
74
  };
75
75
  const base = resolveBaseUrl(context, unit);
76
76
  if (!base.ok) return {
@@ -83,10 +83,7 @@ function resolveBrowserMfManifest(context, unit) {
83
83
  };
84
84
  return {
85
85
  ok: true,
86
- location: {
87
- platform: 'browser-mf-manifest',
88
- manifestUrl: `${base.baseUrl}/mf-manifest.json`
89
- }
86
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`
90
87
  };
91
88
  }
92
89
  function resolveNodeMfManifest(context, unit) {
@@ -122,7 +119,10 @@ function resolveNodeMfManifest(context, unit) {
122
119
  };
123
120
  }
124
121
  function resolveHttpApi(context, unit, config) {
125
- const base = resolveBaseUrl(context, unit);
122
+ const base = resolveBaseUrl(context, {
123
+ ...unit,
124
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
125
+ });
126
126
  if (!base.ok) return {
127
127
  ok: false,
128
128
  reason: `http-api unavailable (${base.reason})`,
@@ -155,7 +155,20 @@ function resolveCloudflareServiceBinding(config) {
155
155
  }
156
156
  function resolveSurfaceLocations(context, unit, surface) {
157
157
  const outcomes = [];
158
- if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
158
+ if (surface.platforms.browserMfManifest) {
159
+ const address = resolveBrowserManifestAddressInContext(context, {
160
+ ...unit,
161
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
162
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
163
+ });
164
+ outcomes.push(address.ok ? {
165
+ ok: true,
166
+ location: {
167
+ platform: 'browser-mf-manifest',
168
+ manifestUrl: address.manifestUrl
169
+ }
170
+ } : address);
171
+ }
159
172
  if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
160
173
  if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
161
174
  if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
@@ -272,4 +285,4 @@ function createEnvStaticSurfaceResolutionProvider(options) {
272
285
  }
273
286
  };
274
287
  }
275
- export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider };
288
+ export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider, resolveBrowserManifestAddress };
@@ -1,4 +1,4 @@
1
1
  import "node:module";
2
- export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider } from "./env-static-provider.mjs";
2
+ export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider, resolveBrowserManifestAddress } from "./env-static-provider.mjs";
3
3
  export { formatSurfaceRef, parseSurfaceRef, validateSurfaceRef } from "./surface-ref.mjs";
4
4
  export { createDiscoveryError, matchDeliveryUnitIdentity, selectResolvedSurface, validateResolvedDeliveryUnit } from "./validation.mjs";
@@ -98,6 +98,22 @@ export type EnvStaticProviderOptions = {
98
98
  identityVerification?: EnvStaticIdentityVerification;
99
99
  };
100
100
  export declare const ENV_STATIC_PROVIDER_NAME = "env-static";
101
+ export type BrowserManifestAddressOptions = {
102
+ manifestEnv: string;
103
+ publicUrlEnv: string;
104
+ mfName: string;
105
+ workerName?: string;
106
+ port?: number;
107
+ };
108
+ /** Shared address policy for runtime discovery and build-time remote refs. */
109
+ export declare function resolveBrowserManifestAddress(env: EnvRecord, unit: BrowserManifestAddressOptions, environment: EnvironmentId, localEnvironments?: readonly EnvironmentId[]): {
110
+ ok: true;
111
+ manifestUrl: string;
112
+ } | {
113
+ ok: false;
114
+ reason: string;
115
+ details?: Record<string, unknown>;
116
+ };
101
117
  /**
102
118
  * Create the baseline env/static provider. Resolution is all-or-nothing per
103
119
  * RESOLUTION-0001: every declared platform location for every surface of the
@@ -1,4 +1,4 @@
1
- export { createEnvStaticSurfaceResolutionProvider, DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, type EnvRecord, type EnvStaticIdentityVerification, type EnvStaticMajorConfig, type EnvStaticProviderOptions, type EnvStaticSurfaceConfig, type EnvStaticSurfacePlatforms, type EnvStaticUnitConfig, } from './env-static-provider.js';
1
+ export { type BrowserManifestAddressOptions, createEnvStaticSurfaceResolutionProvider, DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, type EnvRecord, type EnvStaticIdentityVerification, type EnvStaticMajorConfig, type EnvStaticProviderOptions, type EnvStaticSurfaceConfig, type EnvStaticSurfacePlatforms, type EnvStaticUnitConfig, resolveBrowserManifestAddress, } from './env-static-provider.js';
2
2
  export { formatSurfaceRef, type ParsedSurfaceRef, parseSurfaceRef, type SurfaceRefParseError, type SurfaceRefParseResult, validateSurfaceRef, } from './surface-ref.js';
3
3
  export type { CompatibilityStatus, CompatibilityVerdict, DiscoveryError, DiscoveryErrorCode, DiscoveryResult, EnvironmentId, ResolvedDeliveryUnit, ResolvedSurface, ResolvedSurfaceKind, ResolvedSurfaceLocation, ResolvedSurfaceLocationPlatform, SurfaceResolutionProvider, } from './types.js';
4
4
  export { createDiscoveryError, type ExpectedDeliveryUnitIdentity, matchDeliveryUnitIdentity, type ResolvedDeliveryUnitIssue, type ResolvedDeliveryUnitValidationResult, selectResolvedSurface, validateResolvedDeliveryUnit, } from './validation.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bleedingdev/modern-js-surface-resolution",
3
- "version": "3.9.0-ultramodern.11",
3
+ "version": "3.9.0-ultramodern.12",
4
4
  "description": "Universal surface references, atomic discovery records, and environment-static resolution.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,10 +27,10 @@
27
27
  ],
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
- "@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.0-ultramodern.11"
30
+ "@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.0-ultramodern.12"
31
31
  },
32
32
  "devDependencies": {
33
- "@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.11",
33
+ "@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.12",
34
34
  "@rslib/core": "1.0.0",
35
35
  "@rstest/core": "0.11.12",
36
36
  "@scripts/rstest-config": "2.66.0",
@@ -223,9 +223,9 @@ function createEnvContext(
223
223
  */
224
224
  function resolveBaseUrl(
225
225
  context: EnvContext,
226
- unit: EnvStaticUnitConfig,
226
+ unit: { publicUrlEnv: string; workerName?: string; port?: number },
227
227
  ): LocationOutcomeBase {
228
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
228
+ const { publicUrlEnv } = unit;
229
229
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
230
230
  if (configuredPublicUrl !== undefined) {
231
231
  return { ok: true, baseUrl: trimTrailingSlashes(configuredPublicUrl) };
@@ -273,19 +273,39 @@ type LocationOutcomeBase =
273
273
  | { ok: true; baseUrl: string }
274
274
  | { ok: false; reason: string; details?: Record<string, unknown> };
275
275
 
276
- function resolveBrowserMfManifest(
276
+ export type BrowserManifestAddressOptions = {
277
+ manifestEnv: string;
278
+ publicUrlEnv: string;
279
+ mfName: string;
280
+ workerName?: string;
281
+ port?: number;
282
+ };
283
+
284
+ /** Shared address policy for runtime discovery and build-time remote refs. */
285
+ export function resolveBrowserManifestAddress(
286
+ env: EnvRecord,
287
+ unit: BrowserManifestAddressOptions,
288
+ environment: EnvironmentId,
289
+ localEnvironments: readonly EnvironmentId[] = DEFAULT_LOCAL_ENVIRONMENTS,
290
+ ):
291
+ | { ok: true; manifestUrl: string }
292
+ | { ok: false; reason: string; details?: Record<string, unknown> } {
293
+ return resolveBrowserManifestAddressInContext(
294
+ createEnvContext(env, localEnvironments.includes(environment)),
295
+ unit,
296
+ );
297
+ }
298
+
299
+ function resolveBrowserManifestAddressInContext(
277
300
  context: EnvContext,
278
- unit: EnvStaticUnitConfig,
279
- ): LocationOutcome {
280
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
301
+ unit: BrowserManifestAddressOptions,
302
+ ): ReturnType<typeof resolveBrowserManifestAddress> {
303
+ const { manifestEnv } = unit;
281
304
  const configuredManifest = envValue(context.env, manifestEnv);
282
305
  if (configuredManifest !== undefined) {
283
306
  return {
284
307
  ok: true,
285
- location: {
286
- platform: 'browser-mf-manifest',
287
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName),
288
- },
308
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName),
289
309
  };
290
310
  }
291
311
 
@@ -300,10 +320,7 @@ function resolveBrowserMfManifest(
300
320
 
301
321
  return {
302
322
  ok: true,
303
- location: {
304
- platform: 'browser-mf-manifest',
305
- manifestUrl: `${base.baseUrl}/mf-manifest.json`,
306
- },
323
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`,
307
324
  };
308
325
  }
309
326
 
@@ -353,7 +370,10 @@ function resolveHttpApi(
353
370
  unit: EnvStaticUnitConfig,
354
371
  config: { prefix: string },
355
372
  ): LocationOutcome {
356
- const base = resolveBaseUrl(context, unit);
373
+ const base = resolveBaseUrl(context, {
374
+ ...unit,
375
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`,
376
+ });
357
377
  if (!base.ok) {
358
378
  return {
359
379
  ok: false,
@@ -402,7 +422,22 @@ function resolveSurfaceLocations(
402
422
  | { ok: false; reason: string; details?: Record<string, unknown> } {
403
423
  const outcomes: LocationOutcome[] = [];
404
424
  if (surface.platforms.browserMfManifest) {
405
- outcomes.push(resolveBrowserMfManifest(context, unit));
425
+ const address = resolveBrowserManifestAddressInContext(context, {
426
+ ...unit,
427
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
428
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`,
429
+ });
430
+ outcomes.push(
431
+ address.ok
432
+ ? {
433
+ ok: true,
434
+ location: {
435
+ platform: 'browser-mf-manifest',
436
+ manifestUrl: address.manifestUrl,
437
+ },
438
+ }
439
+ : address,
440
+ );
406
441
  }
407
442
  if (surface.platforms.nodeMfManifest) {
408
443
  outcomes.push(resolveNodeMfManifest(context, unit));
@@ -1,4 +1,5 @@
1
1
  export {
2
+ type BrowserManifestAddressOptions,
2
3
  createEnvStaticSurfaceResolutionProvider,
3
4
  DEFAULT_LOCAL_ENVIRONMENTS,
4
5
  ENV_STATIC_PROVIDER_NAME,
@@ -9,6 +10,7 @@ export {
9
10
  type EnvStaticSurfaceConfig,
10
11
  type EnvStaticSurfacePlatforms,
11
12
  type EnvStaticUnitConfig,
13
+ resolveBrowserManifestAddress,
12
14
  } from './env-static-provider';
13
15
  export {
14
16
  formatSurfaceRef,