@bleedingdev/modern-js-surface-resolution 3.9.0-ultramodern.9 → 3.9.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.
@@ -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");
@@ -54,12 +55,11 @@ function createEnvContext(env, allowLocalFallback) {
54
55
  env,
55
56
  allowLocalFallback,
56
57
  cloudflareDeployEnabled: 'cloudflare' === env.MODERNJS_DEPLOY,
57
- workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN'),
58
- requireCloudflarePublicUrls: 'true' === env.ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS
58
+ workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN')
59
59
  };
60
60
  }
61
61
  function resolveBaseUrl(context, unit) {
62
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
62
+ const { publicUrlEnv } = unit;
63
63
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
64
64
  if (void 0 !== configuredPublicUrl) return {
65
65
  ok: true,
@@ -69,13 +69,6 @@ function resolveBaseUrl(context, unit) {
69
69
  ok: true,
70
70
  baseUrl: `https://${unit.workerName}.${context.workersDevSubdomain}.workers.dev`
71
71
  };
72
- if (context.cloudflareDeployEnabled && context.requireCloudflarePublicUrls) return {
73
- ok: false,
74
- reason: `Cloudflare deploy requires ${publicUrlEnv} (or a configured manifest env / ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN with a worker name)`,
75
- details: {
76
- publicUrlEnv
77
- }
78
- };
79
72
  if (void 0 !== unit.port && context.allowLocalFallback) return {
80
73
  ok: true,
81
74
  baseUrl: `http://localhost:${unit.port}`
@@ -95,15 +88,15 @@ function resolveBaseUrl(context, unit) {
95
88
  }
96
89
  };
97
90
  }
98
- function resolveBrowserMfManifest(context, unit) {
99
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
91
+ function resolveBrowserManifestAddress(env, unit, environment, localEnvironments = DEFAULT_LOCAL_ENVIRONMENTS) {
92
+ return resolveBrowserManifestAddressInContext(createEnvContext(env, localEnvironments.includes(environment)), unit);
93
+ }
94
+ function resolveBrowserManifestAddressInContext(context, unit) {
95
+ const { manifestEnv } = unit;
100
96
  const configuredManifest = envValue(context.env, manifestEnv);
101
97
  if (void 0 !== configuredManifest) return {
102
98
  ok: true,
103
- location: {
104
- platform: 'browser-mf-manifest',
105
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
106
- }
99
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
107
100
  };
108
101
  const base = resolveBaseUrl(context, unit);
109
102
  if (!base.ok) return {
@@ -116,10 +109,7 @@ function resolveBrowserMfManifest(context, unit) {
116
109
  };
117
110
  return {
118
111
  ok: true,
119
- location: {
120
- platform: 'browser-mf-manifest',
121
- manifestUrl: `${base.baseUrl}/mf-manifest.json`
122
- }
112
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`
123
113
  };
124
114
  }
125
115
  function resolveNodeMfManifest(context, unit) {
@@ -155,7 +145,10 @@ function resolveNodeMfManifest(context, unit) {
155
145
  };
156
146
  }
157
147
  function resolveHttpApi(context, unit, config) {
158
- const base = resolveBaseUrl(context, unit);
148
+ const base = resolveBaseUrl(context, {
149
+ ...unit,
150
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
151
+ });
159
152
  if (!base.ok) return {
160
153
  ok: false,
161
154
  reason: `http-api unavailable (${base.reason})`,
@@ -188,7 +181,20 @@ function resolveCloudflareServiceBinding(config) {
188
181
  }
189
182
  function resolveSurfaceLocations(context, unit, surface) {
190
183
  const outcomes = [];
191
- if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
184
+ if (surface.platforms.browserMfManifest) {
185
+ const address = resolveBrowserManifestAddressInContext(context, {
186
+ ...unit,
187
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
188
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
189
+ });
190
+ outcomes.push(address.ok ? {
191
+ ok: true,
192
+ location: {
193
+ platform: 'browser-mf-manifest',
194
+ manifestUrl: address.manifestUrl
195
+ }
196
+ } : address);
197
+ }
192
198
  if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
193
199
  if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
194
200
  if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
@@ -308,10 +314,12 @@ function createEnvStaticSurfaceResolutionProvider(options) {
308
314
  exports.DEFAULT_LOCAL_ENVIRONMENTS = __webpack_exports__.DEFAULT_LOCAL_ENVIRONMENTS;
309
315
  exports.ENV_STATIC_PROVIDER_NAME = __webpack_exports__.ENV_STATIC_PROVIDER_NAME;
310
316
  exports.createEnvStaticSurfaceResolutionProvider = __webpack_exports__.createEnvStaticSurfaceResolutionProvider;
317
+ exports.resolveBrowserManifestAddress = __webpack_exports__.resolveBrowserManifestAddress;
311
318
  for(var __rspack_i in __webpack_exports__)if (-1 === [
312
319
  "DEFAULT_LOCAL_ENVIRONMENTS",
313
320
  "ENV_STATIC_PROVIDER_NAME",
314
- "createEnvStaticSurfaceResolutionProvider"
321
+ "createEnvStaticSurfaceResolutionProvider",
322
+ "resolveBrowserManifestAddress"
315
323
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
316
324
  Object.defineProperty(exports, '__esModule', {
317
325
  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"
@@ -20,12 +20,11 @@ function createEnvContext(env, allowLocalFallback) {
20
20
  env,
21
21
  allowLocalFallback,
22
22
  cloudflareDeployEnabled: 'cloudflare' === env.MODERNJS_DEPLOY,
23
- workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN'),
24
- requireCloudflarePublicUrls: 'true' === env.ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS
23
+ workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN')
25
24
  };
26
25
  }
27
26
  function resolveBaseUrl(context, unit) {
28
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
27
+ const { publicUrlEnv } = unit;
29
28
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
30
29
  if (void 0 !== configuredPublicUrl) return {
31
30
  ok: true,
@@ -35,13 +34,6 @@ function resolveBaseUrl(context, unit) {
35
34
  ok: true,
36
35
  baseUrl: `https://${unit.workerName}.${context.workersDevSubdomain}.workers.dev`
37
36
  };
38
- if (context.cloudflareDeployEnabled && context.requireCloudflarePublicUrls) return {
39
- ok: false,
40
- reason: `Cloudflare deploy requires ${publicUrlEnv} (or a configured manifest env / ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN with a worker name)`,
41
- details: {
42
- publicUrlEnv
43
- }
44
- };
45
37
  if (void 0 !== unit.port && context.allowLocalFallback) return {
46
38
  ok: true,
47
39
  baseUrl: `http://localhost:${unit.port}`
@@ -61,15 +53,15 @@ function resolveBaseUrl(context, unit) {
61
53
  }
62
54
  };
63
55
  }
64
- function resolveBrowserMfManifest(context, unit) {
65
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
56
+ function resolveBrowserManifestAddress(env, unit, environment, localEnvironments = DEFAULT_LOCAL_ENVIRONMENTS) {
57
+ return resolveBrowserManifestAddressInContext(createEnvContext(env, localEnvironments.includes(environment)), unit);
58
+ }
59
+ function resolveBrowserManifestAddressInContext(context, unit) {
60
+ const { manifestEnv } = unit;
66
61
  const configuredManifest = envValue(context.env, manifestEnv);
67
62
  if (void 0 !== configuredManifest) return {
68
63
  ok: true,
69
- location: {
70
- platform: 'browser-mf-manifest',
71
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
72
- }
64
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
73
65
  };
74
66
  const base = resolveBaseUrl(context, unit);
75
67
  if (!base.ok) return {
@@ -82,10 +74,7 @@ function resolveBrowserMfManifest(context, unit) {
82
74
  };
83
75
  return {
84
76
  ok: true,
85
- location: {
86
- platform: 'browser-mf-manifest',
87
- manifestUrl: `${base.baseUrl}/mf-manifest.json`
88
- }
77
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`
89
78
  };
90
79
  }
91
80
  function resolveNodeMfManifest(context, unit) {
@@ -121,7 +110,10 @@ function resolveNodeMfManifest(context, unit) {
121
110
  };
122
111
  }
123
112
  function resolveHttpApi(context, unit, config) {
124
- const base = resolveBaseUrl(context, unit);
113
+ const base = resolveBaseUrl(context, {
114
+ ...unit,
115
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
116
+ });
125
117
  if (!base.ok) return {
126
118
  ok: false,
127
119
  reason: `http-api unavailable (${base.reason})`,
@@ -154,7 +146,20 @@ function resolveCloudflareServiceBinding(config) {
154
146
  }
155
147
  function resolveSurfaceLocations(context, unit, surface) {
156
148
  const outcomes = [];
157
- if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
149
+ if (surface.platforms.browserMfManifest) {
150
+ const address = resolveBrowserManifestAddressInContext(context, {
151
+ ...unit,
152
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
153
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
154
+ });
155
+ outcomes.push(address.ok ? {
156
+ ok: true,
157
+ location: {
158
+ platform: 'browser-mf-manifest',
159
+ manifestUrl: address.manifestUrl
160
+ }
161
+ } : address);
162
+ }
158
163
  if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
159
164
  if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
160
165
  if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
@@ -271,4 +276,4 @@ function createEnvStaticSurfaceResolutionProvider(options) {
271
276
  }
272
277
  };
273
278
  }
274
- export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider };
279
+ 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";
@@ -21,12 +21,11 @@ function createEnvContext(env, allowLocalFallback) {
21
21
  env,
22
22
  allowLocalFallback,
23
23
  cloudflareDeployEnabled: 'cloudflare' === env.MODERNJS_DEPLOY,
24
- workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN'),
25
- requireCloudflarePublicUrls: 'true' === env.ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS
24
+ workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN')
26
25
  };
27
26
  }
28
27
  function resolveBaseUrl(context, unit) {
29
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
28
+ const { publicUrlEnv } = unit;
30
29
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
31
30
  if (void 0 !== configuredPublicUrl) return {
32
31
  ok: true,
@@ -36,13 +35,6 @@ function resolveBaseUrl(context, unit) {
36
35
  ok: true,
37
36
  baseUrl: `https://${unit.workerName}.${context.workersDevSubdomain}.workers.dev`
38
37
  };
39
- if (context.cloudflareDeployEnabled && context.requireCloudflarePublicUrls) return {
40
- ok: false,
41
- reason: `Cloudflare deploy requires ${publicUrlEnv} (or a configured manifest env / ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN with a worker name)`,
42
- details: {
43
- publicUrlEnv
44
- }
45
- };
46
38
  if (void 0 !== unit.port && context.allowLocalFallback) return {
47
39
  ok: true,
48
40
  baseUrl: `http://localhost:${unit.port}`
@@ -62,15 +54,15 @@ function resolveBaseUrl(context, unit) {
62
54
  }
63
55
  };
64
56
  }
65
- function resolveBrowserMfManifest(context, unit) {
66
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
57
+ function resolveBrowserManifestAddress(env, unit, environment, localEnvironments = DEFAULT_LOCAL_ENVIRONMENTS) {
58
+ return resolveBrowserManifestAddressInContext(createEnvContext(env, localEnvironments.includes(environment)), unit);
59
+ }
60
+ function resolveBrowserManifestAddressInContext(context, unit) {
61
+ const { manifestEnv } = unit;
67
62
  const configuredManifest = envValue(context.env, manifestEnv);
68
63
  if (void 0 !== configuredManifest) return {
69
64
  ok: true,
70
- location: {
71
- platform: 'browser-mf-manifest',
72
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
73
- }
65
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
74
66
  };
75
67
  const base = resolveBaseUrl(context, unit);
76
68
  if (!base.ok) return {
@@ -83,10 +75,7 @@ function resolveBrowserMfManifest(context, unit) {
83
75
  };
84
76
  return {
85
77
  ok: true,
86
- location: {
87
- platform: 'browser-mf-manifest',
88
- manifestUrl: `${base.baseUrl}/mf-manifest.json`
89
- }
78
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`
90
79
  };
91
80
  }
92
81
  function resolveNodeMfManifest(context, unit) {
@@ -122,7 +111,10 @@ function resolveNodeMfManifest(context, unit) {
122
111
  };
123
112
  }
124
113
  function resolveHttpApi(context, unit, config) {
125
- const base = resolveBaseUrl(context, unit);
114
+ const base = resolveBaseUrl(context, {
115
+ ...unit,
116
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
117
+ });
126
118
  if (!base.ok) return {
127
119
  ok: false,
128
120
  reason: `http-api unavailable (${base.reason})`,
@@ -155,7 +147,20 @@ function resolveCloudflareServiceBinding(config) {
155
147
  }
156
148
  function resolveSurfaceLocations(context, unit, surface) {
157
149
  const outcomes = [];
158
- if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
150
+ if (surface.platforms.browserMfManifest) {
151
+ const address = resolveBrowserManifestAddressInContext(context, {
152
+ ...unit,
153
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
154
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`
155
+ });
156
+ outcomes.push(address.ok ? {
157
+ ok: true,
158
+ location: {
159
+ platform: 'browser-mf-manifest',
160
+ manifestUrl: address.manifestUrl
161
+ }
162
+ } : address);
163
+ }
159
164
  if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
160
165
  if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
161
166
  if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
@@ -272,4 +277,4 @@ function createEnvStaticSurfaceResolutionProvider(options) {
272
277
  }
273
278
  };
274
279
  }
275
- export { DEFAULT_LOCAL_ENVIRONMENTS, ENV_STATIC_PROVIDER_NAME, createEnvStaticSurfaceResolutionProvider };
280
+ 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,11 +1,11 @@
1
1
  {
2
2
  "name": "@bleedingdev/modern-js-surface-resolution",
3
- "version": "3.9.0-ultramodern.9",
3
+ "version": "3.9.3-ultramodern.10",
4
4
  "description": "Universal surface references, atomic discovery records, and environment-static resolution.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/BleedingDev/ultramodern.js.git",
8
+ "url": "git+https://github.com/ultramodernjs/ultramodern.js.git",
9
9
  "directory": "packages/toolkit/surface-resolution"
10
10
  },
11
11
  "main": "./dist/cjs/surface-resolution/index.js",
@@ -27,15 +27,14 @@
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.9"
30
+ "@modern-js/backend-federation-contracts": "npm:@bleedingdev/modern-js-backend-federation-contracts@3.9.3-ultramodern.10"
31
31
  },
32
32
  "devDependencies": {
33
- "@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.9",
34
- "@rslib/core": "1.0.0",
35
- "@rstest/core": "0.11.12",
33
+ "@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.3-ultramodern.10",
34
+ "@rslib/core": "1.0.3",
35
+ "@rstest/core": "0.12.3",
36
36
  "@scripts/rstest-config": "2.66.0",
37
- "@types/node": "^26.4.1",
38
- "@typescript/native-preview": "7.0.0-dev.20260707.2"
37
+ "@types/node": "^26.6.5"
39
38
  },
40
39
  "publishConfig": {
41
40
  "access": "public"
@@ -45,8 +44,11 @@
45
44
  "dev": "rslib build --watch",
46
45
  "test": "rstest run"
47
46
  },
48
- "homepage": "https://github.com/BleedingDev/ultramodern.js#readme",
47
+ "homepage": "https://github.com/ultramodernjs/ultramodern.js#readme",
49
48
  "bugs": {
50
- "url": "https://github.com/BleedingDev/ultramodern.js/issues"
49
+ "url": "https://github.com/ultramodernjs/ultramodern.js/issues"
50
+ },
51
+ "ultramodern": {
52
+ "sourceName": "@modern-js/surface-resolution"
51
53
  }
52
54
  }
@@ -192,7 +192,6 @@ type EnvContext = {
192
192
  env: EnvRecord;
193
193
  cloudflareDeployEnabled: boolean;
194
194
  workersDevSubdomain: string | undefined;
195
- requireCloudflarePublicUrls: boolean;
196
195
  /**
197
196
  * Whether localhost dev fallbacks may be used. True only in designated
198
197
  * local environments; everywhere else missing config fails closed.
@@ -212,8 +211,6 @@ function createEnvContext(
212
211
  env,
213
212
  'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN',
214
213
  ),
215
- requireCloudflarePublicUrls:
216
- env.ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS === 'true',
217
214
  };
218
215
  }
219
216
 
@@ -223,9 +220,9 @@ function createEnvContext(
223
220
  */
224
221
  function resolveBaseUrl(
225
222
  context: EnvContext,
226
- unit: EnvStaticUnitConfig,
223
+ unit: { publicUrlEnv: string; workerName?: string; port?: number },
227
224
  ): LocationOutcomeBase {
228
- const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
225
+ const { publicUrlEnv } = unit;
229
226
  const configuredPublicUrl = envValue(context.env, publicUrlEnv);
230
227
  if (configuredPublicUrl !== undefined) {
231
228
  return { ok: true, baseUrl: trimTrailingSlashes(configuredPublicUrl) };
@@ -242,14 +239,6 @@ function resolveBaseUrl(
242
239
  };
243
240
  }
244
241
 
245
- if (context.cloudflareDeployEnabled && context.requireCloudflarePublicUrls) {
246
- return {
247
- ok: false,
248
- reason: `Cloudflare deploy requires ${publicUrlEnv} (or a configured manifest env / ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN with a worker name)`,
249
- details: { publicUrlEnv },
250
- };
251
- }
252
-
253
242
  if (unit.port !== undefined && context.allowLocalFallback) {
254
243
  return { ok: true, baseUrl: `http://localhost:${unit.port}` };
255
244
  }
@@ -273,19 +262,39 @@ type LocationOutcomeBase =
273
262
  | { ok: true; baseUrl: string }
274
263
  | { ok: false; reason: string; details?: Record<string, unknown> };
275
264
 
276
- function resolveBrowserMfManifest(
265
+ export type BrowserManifestAddressOptions = {
266
+ manifestEnv: string;
267
+ publicUrlEnv: string;
268
+ mfName: string;
269
+ workerName?: string;
270
+ port?: number;
271
+ };
272
+
273
+ /** Shared address policy for runtime discovery and build-time remote refs. */
274
+ export function resolveBrowserManifestAddress(
275
+ env: EnvRecord,
276
+ unit: BrowserManifestAddressOptions,
277
+ environment: EnvironmentId,
278
+ localEnvironments: readonly EnvironmentId[] = DEFAULT_LOCAL_ENVIRONMENTS,
279
+ ):
280
+ | { ok: true; manifestUrl: string }
281
+ | { ok: false; reason: string; details?: Record<string, unknown> } {
282
+ return resolveBrowserManifestAddressInContext(
283
+ createEnvContext(env, localEnvironments.includes(environment)),
284
+ unit,
285
+ );
286
+ }
287
+
288
+ function resolveBrowserManifestAddressInContext(
277
289
  context: EnvContext,
278
- unit: EnvStaticUnitConfig,
279
- ): LocationOutcome {
280
- const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
290
+ unit: BrowserManifestAddressOptions,
291
+ ): ReturnType<typeof resolveBrowserManifestAddress> {
292
+ const { manifestEnv } = unit;
281
293
  const configuredManifest = envValue(context.env, manifestEnv);
282
294
  if (configuredManifest !== undefined) {
283
295
  return {
284
296
  ok: true,
285
- location: {
286
- platform: 'browser-mf-manifest',
287
- manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName),
288
- },
297
+ manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName),
289
298
  };
290
299
  }
291
300
 
@@ -300,10 +309,7 @@ function resolveBrowserMfManifest(
300
309
 
301
310
  return {
302
311
  ok: true,
303
- location: {
304
- platform: 'browser-mf-manifest',
305
- manifestUrl: `${base.baseUrl}/mf-manifest.json`,
306
- },
312
+ manifestUrl: `${base.baseUrl}/mf-manifest.json`,
307
313
  };
308
314
  }
309
315
 
@@ -353,7 +359,10 @@ function resolveHttpApi(
353
359
  unit: EnvStaticUnitConfig,
354
360
  config: { prefix: string },
355
361
  ): LocationOutcome {
356
- const base = resolveBaseUrl(context, unit);
362
+ const base = resolveBaseUrl(context, {
363
+ ...unit,
364
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`,
365
+ });
357
366
  if (!base.ok) {
358
367
  return {
359
368
  ok: false,
@@ -402,7 +411,22 @@ function resolveSurfaceLocations(
402
411
  | { ok: false; reason: string; details?: Record<string, unknown> } {
403
412
  const outcomes: LocationOutcome[] = [];
404
413
  if (surface.platforms.browserMfManifest) {
405
- outcomes.push(resolveBrowserMfManifest(context, unit));
414
+ const address = resolveBrowserManifestAddressInContext(context, {
415
+ ...unit,
416
+ manifestEnv: `VERTICAL_${unit.envSegment}_MF_MANIFEST`,
417
+ publicUrlEnv: `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`,
418
+ });
419
+ outcomes.push(
420
+ address.ok
421
+ ? {
422
+ ok: true,
423
+ location: {
424
+ platform: 'browser-mf-manifest',
425
+ manifestUrl: address.manifestUrl,
426
+ },
427
+ }
428
+ : address,
429
+ );
406
430
  }
407
431
  if (surface.platforms.nodeMfManifest) {
408
432
  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,