@softarc/native-federation-orchestrator 4.5.2 → 4.6.0
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.
- package/README.md +2 -2
- package/fesm2022/@softarc/native-federation-orchestrator.mjs +1310 -257
- package/fesm2022/@softarc/native-federation-orchestrator.mjs.map +4 -4
- package/fesm2022/module-federation.mjs +27 -8
- package/fesm2022/module-federation.mjs.map +3 -3
- package/fesm2022/node.mjs +1307 -254
- package/fesm2022/node.mjs.map +4 -4
- package/fesm2022/options.mjs +5 -10
- package/fesm2022/options.mjs.map +2 -2
- package/package.json +2 -2
- package/quickstart.mjs +15 -15
- package/types/lib/core/1.domain/externals/basis.d.ts +22 -0
- package/types/lib/core/1.domain/externals/version.contract.d.ts +1 -0
- package/types/lib/core/1.domain/remote-entry/remote-entry.contract.d.ts +2 -0
- package/types/lib/core/2.app/config/mode.contract.d.ts +1 -0
- package/types/lib/core/2.app/driver-ports/init/drivers.contract.d.ts +2 -0
- package/types/lib/core/2.app/driver-ports/init/for-determining-shared-externals.port.d.ts +8 -1
- package/types/lib/core/2.app/driver-ports/init/for-marking-pools-for-reelection.port.d.ts +6 -0
- package/types/lib/core/2.app/driver-ports/init/for-pooling-shared-externals.port.d.ts +3 -1
- package/types/lib/core/2.app/driving-ports/for-shared-chunks-storage.port.d.ts +1 -0
- package/types/lib/core/2.app/driving-ports/for-shared-externals-storage.port.d.ts +2 -3
- package/types/lib/core/2.app/steps/apply-winner.d.ts +18 -0
- package/types/lib/core/2.app/steps/pooling/anchoring.d.ts +69 -0
- package/types/lib/core/2.app/steps/pooling/mark-pools-for-reelection.d.ts +5 -0
- package/types/lib/core/2.app/steps/pooling/pool-dynamic-externals.d.ts +3 -1
- package/types/lib/core/2.app/steps/pooling/pool-graph.d.ts +10 -5
- package/types/lib/core/2.app/steps/pooling/pool-shared-externals.d.ts +30 -1
- package/types/lib/core/2.app/steps/pooling/pool-views.d.ts +63 -0
- package/types/lib/core/2.app/steps/pooling/pool.types.d.ts +30 -1
- package/types/lib/core/2.app/steps/pooling/pool.util.d.ts +15 -0
- package/types/lib/core/2.app/steps/store-remote-entry.d.ts +15 -7
- package/types/lib/testing/pooling/no-tear.d.ts +37 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js", "../../../src/lib/core/2.app/flows/init.flow.ts", "../../../src/lib/core/2.app/flows/init-remote-entry.flow.ts", "../../../src/lib/core/native-federation.error.ts", "../../../src/lib/utils/path.ts", "../../../src/lib/core/2.app/steps/get-remote-entries.ts", "../../../src/lib/core/2.app/steps/store-remote-entry.ts", "../../../src/lib/core/2.app/steps/process-remote-entries.ts", "../../../src/lib/core/1.domain/externals/external.contract.ts", "../../../src/lib/core/2.app/steps/determine-shared-externals.ts", "../../../src/lib/core/2.app/steps/pooling/pool-graph.ts", "../../../src/lib/core/2.app/steps/pooling/pool.util.ts", "../../../src/lib/core/2.app/steps/pooling/pool-shared-externals.ts", "../../../node_modules/.pnpm/@softarc+native-federation@4.
|
|
4
|
-
"sourcesContent": ["'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n", "'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n", "'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n", "'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n", "'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n", "'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n", "'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n", "'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n", "'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n", "'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n", "'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n", "'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n", "'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n", "'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n", "'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n", "'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n", "'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n", "import type { FLOW_FACTORY } from '../driver-ports/flow-factory.contract';\nimport type { InitDriversContract } from '../driver-ports/init/drivers.contract';\nimport type { InitFlow } from '../driver-ports/init/flow.contract';\n\nexport const createInitFlow = ({\n flow,\n adapters,\n config,\n}: FLOW_FACTORY<InitDriversContract>): InitFlow => {\n return remotesOrManifestUrl =>\n flow\n .getRemoteEntries(remotesOrManifestUrl)\n .then(flow.processRemoteEntries)\n .then(flow.determineSharedExternals)\n .then(flow.poolSharedExternals)\n .then(flow.generateImportMap)\n .then(importMap => flow.commitChanges(importMap, { override: true }))\n .then(flow.exposeModuleLoader)\n .then(loadRemoteModule => ({\n config,\n adapters,\n loadRemoteModule,\n }));\n};\n", "import type { RemoteEntry } from 'lib/core/1.domain';\nimport type { FLOW_FACTORY } from '../driver-ports/flow-factory.contract';\nimport type { InitDriversContract } from '../driver-ports/init/drivers.contract';\nimport type { InitRemoteEntryFlow } from '../driver-ports/init/flow.contract';\n\nexport const createInitRemoteEntryFlow = ({\n flow,\n}: FLOW_FACTORY<InitDriversContract>): InitRemoteEntryFlow => {\n const processDynamicRemoteEntry = (remoteEntry: RemoteEntry) =>\n flow\n .updateCache(remoteEntry)\n .then(flow.poolDynamicExternals)\n .then(flow.convertToImportMap)\n .then(flow.commitChanges);\n\n return (remoteEntryUrl, remote) =>\n flow\n .getRemoteEntry(remoteEntryUrl, remote)\n .then(entry => entry.map(processDynamicRemoteEntry).orElse(Promise.resolve()))\n .then(() => undefined);\n};\n", "class NFError extends Error {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'NFError';\n }\n}\n\nexport { NFError };\n", "function join(pathA: string, pathB: string): string {\n pathA = pathA.endsWith('/') ? pathA.slice(0, -1) : pathA;\n pathB = pathB.startsWith('/') ? pathB.slice(1) : pathB;\n return `${pathA}/${pathB}`;\n}\n\nfunction getScope(path: string) {\n if (!path) return '';\n\n const parts = path.split('/');\n\n if (parts[parts.length - 1] === '' || parts[parts.length - 1]!.includes('.')) {\n parts.pop();\n }\n if (parts.length < 1) return '';\n\n return `${parts.join('/')}/`;\n}\n\nexport { join, getScope };\n", "import type { RemoteEntry } from 'lib/core/1.domain/remote-entry/remote-entry.contract';\nimport type {\n FederationManifest,\n RemoteEntryDescriptor,\n RemoteEntryUrl,\n} from 'lib/core/1.domain/remote-entry/manifest.contract';\nimport type { RemoteName } from 'lib/core/1.domain/remote/remote-info.contract';\nimport type { ForGettingRemoteEntries } from '../driver-ports/init/for-getting-remote-entries.port';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from '../config/mode.contract';\nimport type { HostConfig } from '../config/host.contract';\nimport * as _path from 'lib/utils/path';\n\nexport function createGetRemoteEntries(\n config: LoggingConfig & ModeConfig & HostConfig,\n ports: Pick<\n DrivingContract,\n 'remoteEntryProvider' | 'manifestProvider' | 'remoteInfoRepo' | 'sse'\n >\n): ForGettingRemoteEntries {\n /**\n * Step 1: Fetch the remoteEntry JSON objects:\n *\n * A Manifest or URL to a Manifest is used as the input. Based on the defined remotes\n * in the manifest, the library will download the remoteEntry.json files which contain the\n * metadata of the defined remotes (name, exposed modules and required dependencies a.k.a. externals)\n *\n * @param config\n * @param adapters\n * @returns A list of the remoteEntry json objects\n */\n return (remotesOrManifestUrl = {}) => {\n const manifestPromise = config.manifestIntegrity\n ? ports.manifestProvider.provide(remotesOrManifestUrl, {\n integrity: config.manifestIntegrity,\n })\n : ports.manifestProvider.provide(remotesOrManifestUrl);\n\n return manifestPromise\n .catch(e => {\n config.log.error(1, 'Could not fetch manifest.', e);\n return Promise.reject(new NFError('Failed to fetch manifest'));\n })\n .then(addHostRemoteEntry)\n .then(fetchRemoteEntries)\n .then(removeSkippedRemotes)\n .then(checkForSSE);\n };\n\n function addHostRemoteEntry(manifest: FederationManifest): FederationManifest {\n if (!config.hostRemoteEntry) return manifest;\n\n const { name, url, integrity } = config.hostRemoteEntry;\n\n return {\n ...manifest,\n [name]: integrity ? { url, integrity } : url,\n };\n }\n\n function normalizeEntry(descriptor: RemoteEntryDescriptor): {\n url: RemoteEntryUrl;\n integrity?: string;\n } {\n return typeof descriptor === 'string' ? { url: descriptor } : descriptor;\n }\n\n function withCacheTag(url: string, cacheTag?: string): string {\n if (!cacheTag) return url;\n return `${url}${url.includes('?') ? '&' : '?'}cacheTag=${cacheTag}`;\n }\n\n function resolveCacheTag(remoteName: RemoteName): string | undefined {\n if (\n config.hostRemoteEntry &&\n remoteName === config.hostRemoteEntry.name &&\n config.hostRemoteEntry.cacheTag\n ) {\n return config.hostRemoteEntry.cacheTag;\n }\n return config.profile.cacheTag;\n }\n\n async function fetchRemoteEntries(\n manifest: FederationManifest\n ): Promise<(RemoteEntry | false)[]> {\n const fetchPromises = Object.entries(manifest).map(([remoteName, descriptor]) =>\n fetchRemoteEntry(remoteName, descriptor)\n );\n return Promise.all(fetchPromises);\n }\n\n async function fetchRemoteEntry(\n remoteName: RemoteName,\n descriptor: RemoteEntryDescriptor\n ): Promise<RemoteEntry | false> {\n const { url: remoteEntryUrl, integrity } = normalizeEntry(descriptor);\n let isOverride = false;\n let skip = false;\n\n ports.remoteInfoRepo.tryGet(remoteName).ifPresent(cachedRemoteInfo => {\n if (\n config.profile.overrideCachedRemotes !== 'never' &&\n (remoteEntryUrl !== _path.join(cachedRemoteInfo.scopeUrl, 'remoteEntry.json') ||\n config.profile.overrideCachedRemotesIfURLMatches)\n ) {\n config.log.debug(1, `Overriding existing remote '${remoteName}' with '${remoteEntryUrl}'.`);\n isOverride = true;\n } else {\n config.log.debug(1, `Found remote '${remoteName}' in storage, omitting fetch.`);\n skip = true;\n }\n });\n\n if (skip) return false;\n\n const fetchUrl = withCacheTag(remoteEntryUrl, resolveCacheTag(remoteName));\n\n try {\n const remoteEntry = integrity\n ? await ports.remoteEntryProvider.provide(fetchUrl, { integrity })\n : await ports.remoteEntryProvider.provide(fetchUrl);\n\n config.log.debug(\n 1,\n `Fetched '${remoteEntry.name}' from '${remoteEntry.url}', exposing: ${JSON.stringify(remoteEntry.exposes)}`\n );\n\n return prepareRemoteEntry(remoteEntry, remoteName, isOverride);\n } catch (error) {\n if (config.strict.strictRemoteEntry) {\n config.log.error(1, `Could not fetch remote '${remoteName}'.`, error);\n return Promise.reject(new NFError(`Could not fetch remote '${remoteName}'`));\n }\n config.log.warn(1, `Could not fetch remote '${remoteName}'. skipping init.`, error);\n\n return Promise.resolve(false);\n }\n }\n\n function prepareRemoteEntry(\n remoteEntry: RemoteEntry,\n expectedRemoteName: string,\n isOverride: boolean\n ): RemoteEntry {\n if (isOverride) remoteEntry.override = isOverride;\n\n if (!!config.hostRemoteEntry && expectedRemoteName === config.hostRemoteEntry.name) {\n remoteEntry.host = true;\n remoteEntry.name = config.hostRemoteEntry!.name;\n }\n\n if (remoteEntry.name !== expectedRemoteName) {\n const errorDetails = `Fetched remote '${remoteEntry.name}' does not match requested '${expectedRemoteName}'.`;\n if (config.strict.strictRemoteEntry) {\n throw new NFError(errorDetails);\n }\n config.log.warn(1, `${errorDetails} Omitting expected name.`);\n }\n\n return remoteEntry;\n }\n\n function removeSkippedRemotes(remoteEntries: (RemoteEntry | false)[]): RemoteEntry[] {\n return remoteEntries.filter((entry): entry is RemoteEntry => entry !== false);\n }\n\n function checkForSSE(remoteEntries: RemoteEntry[]): RemoteEntry[] {\n if (config.sse) {\n remoteEntries.forEach(entry => {\n if (entry.buildNotificationsEndpoint) {\n ports.sse.watchRemoteBuilds(\n _path.join(_path.getScope(entry.url), entry.buildNotificationsEndpoint)\n );\n config.log.debug(1, `Registered SSE endpoint of remote '${entry.name}' `);\n return;\n }\n config.log.debug(1, `Remote ${entry.name} has no defined 'buildNotificationsEndpoint'`);\n });\n }\n\n return remoteEntries;\n }\n}\n", "import {\n type RemoteEntry,\n type RemoteInfo,\n type ScopedVersion,\n type SharedExternal,\n type DenseSharedInfo,\n type SharedVersion,\n type SharedVersionMeta,\n} from 'lib/core/1.domain';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport * as _path from 'lib/utils/path';\n\nexport type StoreRemoteEntry = (\n remoteEntry: RemoteEntry,\n onSharedExternal: SharedExternalHandler\n) => void;\n\nexport type SharedExternalHandler = (\n remoteEntry: RemoteEntry,\n external: DenseSharedInfo,\n ctx: SharedExternalContext\n) => void;\n\nexport type SharedExternalContext = {\n tag: string;\n remote: SharedVersionMeta;\n cached: SharedExternal;\n scopeType: 'global' | 'strict' | 'shareScope';\n assertSameVersionCompatibility: (matchingVersion: SharedVersion) => void;\n commit: () => void;\n};\n\n/**\n * Not a pipeline step but the template both storage steps specialize: it owns the full\n * storage sequence for a remoteEntry, and only the resolution of a singleton external\n * differs between the init pipeline (process-remote-entries, step 2) and the dynamic\n * pipeline (update-cache, step 8), injected per call. The pipelines must not be merged,\n * see docs/version-resolver.md \"Dynamic Init\". If a change ever needs a flag or\n * parameter here to serve only one caller, inline this back into the steps instead.\n */\nexport function createStoreRemoteEntry(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'scopedExternalsRepo'\n | 'sharedExternalsRepo'\n | 'sharedChunksRepo'\n | 'versionCheck'\n >,\n logStep: number\n): StoreRemoteEntry {\n return (remoteEntry, onSharedExternal) => {\n if (remoteEntry?.override) removeCachedRemoteEntry(remoteEntry);\n addRemoteInfoToStorage(remoteEntry);\n addExternalsToStorage(remoteEntry, onSharedExternal);\n addSharedChunksToStorage(remoteEntry);\n };\n\n function removeCachedRemoteEntry(remoteEntry: RemoteEntry): void {\n ports.remoteInfoRepo.remove(remoteEntry.name);\n ports.scopedExternalsRepo.remove(remoteEntry.name);\n ports.sharedExternalsRepo.removeFromAllScopes(remoteEntry.name);\n }\n\n function addRemoteInfoToStorage({ name, url, exposes, integrity }: RemoteEntry): void {\n ports.remoteInfoRepo.addOrUpdate(name, {\n scopeUrl: _path.getScope(url),\n exposes: Object.values(exposes ?? []).map(m => ({\n moduleName: m.key,\n file: m.outFileName,\n })),\n ...(integrity ? { integrity } : {}),\n } as RemoteInfo);\n }\n\n function addExternalsToStorage(\n remoteEntry: RemoteEntry,\n onSharedExternal: SharedExternalHandler\n ): void {\n remoteEntry.shared.forEach(external => {\n const tag = resolveVersion(remoteEntry, external);\n if (tag === null) return;\n\n if (external.singleton) {\n if (external.pool?.trim()) ports.sharedExternalsRepo.markPoolTagPresent();\n onSharedExternal(remoteEntry, external, sharedExternalContext(remoteEntry, external, tag));\n } else {\n addScopedExternal(remoteEntry, external, tag);\n }\n });\n }\n\n function addSharedChunksToStorage(remoteEntry: RemoteEntry): void {\n if (!remoteEntry.chunks) return;\n config.log.debug(\n logStep,\n `Adding chunks for remote \"${remoteEntry.name}\", bundles: [${Object.keys(remoteEntry.chunks).join(', ')}]`\n );\n Object.entries(remoteEntry.chunks).forEach(([bundleName, chunks]) => {\n ports.sharedChunksRepo.addOrReplace(remoteEntry.name, bundleName, chunks);\n });\n }\n\n function addScopedExternal(\n remoteEntry: RemoteEntry,\n sharedInfo: DenseSharedInfo,\n tag: string\n ): void {\n ports.scopedExternalsRepo.addExternal(remoteEntry.name, sharedInfo.packageName, {\n tag,\n bundle: sharedInfo.bundle,\n entries: sharedInfo.entries,\n } as ScopedVersion);\n }\n\n function resolveVersion(remoteEntry: RemoteEntry, external: DenseSharedInfo): string | null {\n if (external.version && ports.versionCheck.isValidSemver(external.version)) {\n return external.version;\n }\n\n const errorMsg = `[${remoteEntry.name}][${external.packageName}] Version '${external.version}' is not a valid version.`;\n if (config.strict.strictExternalVersion) {\n config.log.error(logStep, errorMsg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n if (config.profile.skipInvalidExternalVersions) {\n config.log.warn(logStep, `${errorMsg} Skipping external.`);\n return null;\n }\n config.log.warn(logStep, errorMsg);\n return ports.versionCheck.smallestVersion(external.requiredVersion);\n }\n\n function sharedExternalContext(\n remoteEntry: RemoteEntry,\n sharedInfo: DenseSharedInfo,\n tag: string\n ): SharedExternalContext {\n const scopeType = ports.sharedExternalsRepo.scopeType(sharedInfo.shareScope);\n\n const remote: SharedVersionMeta = {\n name: remoteEntry.name,\n bundle: sharedInfo.bundle,\n strictVersion: sharedInfo.strictVersion,\n cached: false,\n requiredVersion: scopeType === 'strict' ? tag : sharedInfo.requiredVersion || tag,\n ...(sharedInfo.pool?.trim() ? { pool: sharedInfo.pool } : {}),\n entries: sharedInfo.entries,\n };\n\n const cached: SharedExternal = ports.sharedExternalsRepo\n .tryGet(sharedInfo.packageName, sharedInfo.shareScope)\n .orElse({ dirty: false, versions: [] });\n\n return {\n tag,\n remote,\n cached,\n scopeType,\n assertSameVersionCompatibility(matchingVersion: SharedVersion): void {\n if (!remote.strictVersion) return;\n if (matchingVersion.remotes[0]!.requiredVersion === remote.requiredVersion) return;\n\n const errorMsg = `[${remoteEntry.name}][${sharedInfo.packageName}@${\n sharedInfo.version\n }] Required version-range '${\n remote.requiredVersion\n }' does not match cached version-range '${matchingVersion.remotes[0]!.requiredVersion}'`;\n\n if (config.strict.strictExternalSameVersionCompatibility) {\n config.log.error(logStep, errorMsg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n config.log.warn(logStep, errorMsg);\n },\n commit(): void {\n ports.sharedExternalsRepo.addOrUpdate(\n sharedInfo.packageName,\n {\n dirty: cached.dirty,\n versions: cached.versions.sort((a, b) => ports.versionCheck.compare(b.tag, a.tag)),\n },\n sharedInfo.shareScope\n );\n },\n };\n }\n}\n", "import type { ForProcessingRemoteEntries } from '../driver-ports/init/for-processing-remote-entries.port';\nimport type { RemoteEntry, DenseSharedInfo } from 'lib/core/1.domain';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport { createStoreRemoteEntry, type SharedExternalContext } from './store-remote-entry';\n\nexport function createProcessRemoteEntries(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'sharedExternalsRepo'\n | 'scopedExternalsRepo'\n | 'sharedChunksRepo'\n | 'versionCheck'\n >\n): ForProcessingRemoteEntries {\n const storeRemoteEntry = createStoreRemoteEntry(config, ports, 2);\n\n /**\n * Step 2: Merge the remote-info, externals and chunks of the provided remoteEntry\n * objects into the cache. Shared externals are only registered here; resolution\n * happens later in determine-shared-externals, per scope, with global knowledge.\n */\n return remoteEntries => {\n try {\n remoteEntries.forEach(remoteEntry => storeRemoteEntry(remoteEntry, addSharedExternal));\n return Promise.resolve(remoteEntries);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n function addSharedExternal(\n remoteEntry: RemoteEntry,\n _sharedInfo: DenseSharedInfo,\n {\n tag,\n remote,\n cached,\n scopeType,\n assertSameVersionCompatibility,\n commit,\n }: SharedExternalContext\n ): void {\n const matchingVersion = cached.versions.find(version => version.tag === tag);\n\n if (matchingVersion) {\n assertSameVersionCompatibility(matchingVersion);\n\n if (!matchingVersion.host && !!remoteEntry?.host) {\n matchingVersion.host = true;\n matchingVersion.remotes.unshift(remote);\n } else matchingVersion.remotes.push(remote);\n } else {\n if (scopeType !== 'strict') cached.dirty = true;\n cached.versions.push({\n tag,\n action: scopeType === 'strict' ? 'share' : 'skip',\n host: !!remoteEntry?.host,\n remotes: [remote],\n });\n }\n\n commit();\n }\n}\n", "import type { SharedVersion, ScopedVersion } from './version.contract';\n\nexport type ExternalName = string;\n\nexport type ScopedExternals = Record<string, ScopedExternal>;\n\nexport const GLOBAL_SCOPE = '__GLOBAL__';\n\nexport const STRICT_SCOPE = 'strict';\n\nexport type SharedExternal = {\n dirty: boolean;\n versions: SharedVersion[];\n};\n\nexport type shareScope = Record<string, SharedExternal>;\n\nexport type SharedExternals = Record<string, shareScope> & { [GLOBAL_SCOPE]: shareScope };\n\nexport type ScopedExternal = Record<string, ScopedVersion>;\n", "import type { ForDeterminingSharedExternals } from '../driver-ports/init/for-determining-shared-externals.port';\nimport { GLOBAL_SCOPE, type SharedExternal, type SharedVersion } from 'lib/core/1.domain';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\n\nexport function createDetermineSharedExternals(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'versionCheck' | 'sharedExternalsRepo'>\n): ForDeterminingSharedExternals {\n /**\n * Step 3: Determine which version is the optimal version to share.\n *\n * The shared external versions that were merged into the cache/storage caused the shared\n * external to be 'dirty', this step cleans all dirty externals in the storage by calculating\n * the most optimal version to share since only 1 version can be shared globally. All other\n * versions that are compatible are skipped and the incompatible ones are defined as scoped external.\n *\n * Check the docs for a full explanation of the dependency resolver.\n *\n * Priority:\n * 1) Latest external defined in 'host' remoteEntry (if available).\n * 2) If defined in config, prioritize latest available version.\n * 3) Find most optimal version, by comparing potential extra downloads per version.\n *\n * @param config\n * @param adapters\n * @returns\n */\n return () => {\n for (const shareScope of ports.sharedExternalsRepo.getScopes()) {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(shareScope);\n\n try {\n Object.entries(sharedExternals)\n .filter(([_, e]) => e.dirty)\n .forEach(([name, external]) =>\n ports.sharedExternalsRepo.addOrUpdate(\n name,\n setVersionActions(name, external),\n shareScope\n )\n );\n } catch (error) {\n config.log.error(\n 3,\n `[${shareScope ?? GLOBAL_SCOPE}] failed to determine shared externals.`,\n {\n sharedExternals,\n error,\n }\n );\n return Promise.reject(\n new NFError(\n `Could not determine shared externals in scope ${shareScope}.`,\n error as Error\n )\n );\n }\n }\n return Promise.resolve();\n };\n\n // Entrypoints declared by the versions `winner` would skip that its basis can't serve.\n function uncoveredTears(external: SharedExternal, winner: SharedVersion): number {\n const basis = winner.remotes[0]!.entries;\n return external.versions.reduce((sum, v) => {\n if (v === winner) return sum;\n if (!ports.versionCheck.isCompatible(winner.tag, v.remotes[0]!.requiredVersion)) return sum;\n return (\n sum +\n v.remotes.reduce((n, r) => n + Object.keys(r.entries).filter(e => !(e in basis)).length, 0)\n );\n }, 0);\n }\n\n function setVersionActions(externalName: string, external: SharedExternal) {\n if (external.versions.length === 1) {\n external.versions[0]!.action = 'share';\n external.dirty = false;\n return external;\n }\n\n let sharedVersion = external.versions.find(v => v.host);\n\n if (!sharedVersion && config.profile.latestSharedExternal) {\n sharedVersion = external.versions[0];\n }\n\n if (!sharedVersion) {\n // find version with least extra downloads, sorted by SEMVER version (O^2 complexity)\n let leastExtraDownloads = Number.MAX_VALUE;\n let leastTears = Number.MAX_VALUE;\n external.versions.forEach(vA => {\n const extraDownloads = external.versions.filter(\n vB =>\n !vB.remotes[0]!.cached &&\n vB.remotes[0]!.strictVersion &&\n !ports.versionCheck.isCompatible(vA.tag, vB.remotes[0]!.requiredVersion)\n ).length;\n // Tiebreak equal-download candidates toward the one that leaves fewest entrypoints\n // uncovered across the versions it would skip (fewest tears / scope-promotions).\n const tears = uncoveredTears(external, vA);\n if (\n extraDownloads < leastExtraDownloads ||\n (extraDownloads === leastExtraDownloads && tears < leastTears)\n ) {\n leastExtraDownloads = extraDownloads;\n leastTears = tears;\n sharedVersion = vA;\n }\n });\n }\n\n if (!sharedVersion) {\n throw new NFError(`[${externalName}] Could not determine shared version!`);\n }\n\n // Determine action of other versions based on chosen sharedVersion\n external.versions.forEach(v => {\n if (ports.versionCheck.isCompatible(sharedVersion!.tag, v.remotes[0]!.requiredVersion)) {\n v.action = 'skip';\n return;\n }\n\n if (config.strict.strictExternalCompatibility && v.remotes[0]!.strictVersion) {\n config.log.error(\n 3,\n `[${v.remotes[0]!.name}][${externalName}@${v.tag}] Is not compatible with requiredRange '${sharedVersion!.remotes[0]?.requiredVersion}' from remote '${sharedVersion!.remotes[0]!.name}'.`\n );\n\n throw new NFError(`External ${externalName}@${v.tag} could not be shared.`);\n }\n v.action = v.remotes[0]!.strictVersion ? 'scope' : 'skip';\n });\n\n sharedVersion.action = 'share';\n\n if (config.strict.strictEntryPointCoverage) {\n const basis = sharedVersion.remotes[0]!.entries;\n external.versions.forEach(v => {\n if (v.action !== 'skip') return;\n const uncovered = v.remotes.some(r =>\n Object.keys(r.entries).some(entrypoint => !(entrypoint in basis))\n );\n if (uncovered) {\n v.action = 'scope';\n config.log.debug(\n 3,\n `[${externalName}@${v.tag}] Scoped: entrypoints not covered by shared ${externalName}@${sharedVersion!.tag}.`\n );\n }\n });\n }\n\n external.dirty = false;\n return external;\n }\n}\n", "import type { ExternalName, shareScope } from 'lib/core/1.domain';\nimport type { LogHandler } from '../../config/log.contract';\nimport type { PoolMember, PoolName } from './pool.types';\n\n/** Matches a scoped npm package name, capturing the scope without the leading `@`. */\nconst SCOPED_PACKAGE = /^@([^/]+)\\//;\n\n// Disjoint-set union (union by size + iterative path halving \u2014 loop-based to avoid stack growth in\n// the browser). String node keys are interned to integers so the hot path indexes plain arrays.\nfunction createDSU() {\n const ids = new Map<string, number>();\n const parent: number[] = [];\n const size: number[] = [];\n\n const intern = (key: string): number => {\n let id = ids.get(key);\n if (id === undefined) {\n id = parent.length;\n ids.set(key, id);\n parent.push(id);\n size.push(1);\n }\n return id;\n };\n\n const findRoot = (x: number): number => {\n while (parent[x]! !== x) {\n parent[x] = parent[parent[x]!]!; // path halving\n x = parent[x]!;\n }\n return x;\n };\n\n return {\n union(a: string, b: string): void {\n let rootA = findRoot(intern(a));\n let rootB = findRoot(intern(b));\n if (rootA === rootB) return;\n if (size[rootA]! < size[rootB]!) [rootA, rootB] = [rootB, rootA];\n parent[rootB] = rootA;\n size[rootA] = size[rootA]! + size[rootB]!;\n },\n\n // Interns the key if unseen \u2014 an isolated key is its own component.\n component(key: string): number {\n return findRoot(intern(key));\n },\n };\n}\n\n// Namespaced node keys, NUL-separated so no kind or `(remote, tag)` pair can alias another. A\n// per-`(remote, tag)` node makes explicit tags remote-local (merge only via a shared member); a\n// per-scope node makes auto-pooling global (safe: the scope is machine-derived).\nconst extNode = (name: ExternalName): string => `ext\\x00${name}`;\nconst tagNode = (remote: string, tag: string): string => `tag\\x00${remote}\\x00${tag}`;\nconst scopeNode = (scope: string): string => `scope\\x00${scope}`;\n\nexport type PoolEdge = { remote: string; tag: string };\n\n// A poolable external's edges: `scope` (auto-pooling, global) and any declared `tags` (remote-local).\n// `value` is the payload returned per member \u2014 a `SharedExternal` for init, a package name for dynamic.\nexport type PoolCandidate<T> = {\n name: ExternalName;\n scope?: string;\n tags: readonly PoolEdge[];\n value: T;\n};\n\n// npm scope of a package when auto-pooling is on (`@framework/core` -> `framework`); undefined for\n// unscoped names or when auto-pooling is off.\nexport function autoScope(name: string, useAutoExternalPooling: boolean): string | undefined {\n return useAutoExternalPooling ? SCOPED_PACKAGE.exec(name)?.[1] : undefined;\n}\n\n/**\n * Group one shareScope's candidates into pools by shared membership: pool = connected component of a\n * graph with edges from auto-pooling (`external -> scope`, global) and declared tags\n * (`external -> tag@remote`, remote-local). See docs/version-resolver.md + plan.md. Returns only real\n * pools (>=2 members), keyed by and iterated in order of their canonical name (smallest member \u2014\n * reload-stable). An explicit-tag member that pooled with nothing is warned (likely typo or missing\n * sibling); auto-scope singletons stay silent.\n */\nexport function groupByMembership<T>(\n candidates: readonly PoolCandidate<T>[],\n log?: LogHandler\n): Map<PoolName, T[]> {\n const dsu = createDSU();\n const tagged = new Set<ExternalName>();\n const poolable: { name: ExternalName; value: T }[] = [];\n\n for (const candidate of candidates) {\n let joined = false;\n if (candidate.scope !== undefined) {\n dsu.union(extNode(candidate.name), scopeNode(candidate.scope));\n joined = true;\n }\n for (const edge of candidate.tags) {\n dsu.union(extNode(candidate.name), tagNode(edge.remote, edge.tag));\n tagged.add(candidate.name);\n joined = true;\n }\n if (joined) poolable.push({ name: candidate.name, value: candidate.value });\n }\n\n const byComponent = new Map<number, { name: ExternalName; value: T }[]>();\n for (const entry of poolable) {\n const root = dsu.component(extNode(entry.name));\n (byComponent.get(root) ?? byComponent.set(root, []).get(root)!).push(entry);\n }\n\n const pools: { name: ExternalName; value: T }[][] = [];\n for (const members of byComponent.values()) {\n members.sort((a, b) => a.name.localeCompare(b.name));\n if (members.length < 2) {\n const only = members[0]!;\n if (tagged.has(only.name)) {\n log?.warn(\n 3,\n `[${only.name}] declares a 'pool' tag but no other external joined its pool; likely a typo or a missing sibling.`\n );\n }\n continue;\n }\n pools.push(members);\n }\n\n pools.sort((a, b) => a[0]!.name.localeCompare(b[0]!.name));\n return new Map(pools.map(members => [members[0]!.name, members.map(m => m.value)]));\n}\n\n/** Init-path grouping: build candidates from the stored shared externals of one shareScope. */\nexport function buildPools(\n sharedExternals: shareScope,\n useAutoExternalPooling: boolean,\n log?: LogHandler\n): Map<PoolName, PoolMember[]> {\n const candidates = Object.entries(sharedExternals).map<PoolCandidate<PoolMember>>(\n ([name, external]) => ({\n name,\n scope: autoScope(name, useAutoExternalPooling),\n tags: external.versions.flatMap(v =>\n v.remotes.flatMap(r => {\n const tag = r.pool?.trim();\n return tag ? [{ remote: r.name, tag }] : [];\n })\n ),\n value: { name, external },\n })\n );\n return groupByMembership(candidates, log);\n}\n", "import type { RemoteName } from 'lib/core/1.domain';\nimport type { PoolMember } from './pool.types';\n\nexport function remotesInPool(members: PoolMember[]): RemoteName[] {\n return [\n ...new Set(members.flatMap(m => m.external.versions.flatMap(v => v.remotes.map(r => r.name)))),\n ];\n}\n", "import type { ForPoolingSharedExternals } from '../../driver-ports/init/for-pooling-shared-externals.port';\nimport type { RemoteName, SharedExternal, SharedVersion } from 'lib/core/1.domain';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { DrivingContract } from '../../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../../config/log.contract';\nimport type { ModeConfig } from '../../config/mode.contract';\nimport { buildPools } from './pool-graph';\nimport { remotesInPool } from './pool.util';\nimport type { PoolMember, PoolName } from './pool.types';\n\n// Remotes that are strict-incompatible on any member (determine marked a version `scope`). Reads\n// stored actions only \u2014 pooling makes no compatibility call \u2014 and islands across the WHOLE family.\nfunction islandedRemotes(members: PoolMember[]): Set<RemoteName> {\n const islanded = new Set<RemoteName>();\n for (const member of members)\n for (const version of member.external.versions)\n if (version.action === 'scope') for (const remote of version.remotes) islanded.add(remote.name);\n return islanded;\n}\n\nexport function createPoolSharedExternals(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'sharedExternalsRepo'>\n): ForPoolingSharedExternals {\n /**\n * Runs after determine-shared-externals: for each pool, a remote that is version-incompatible on any\n * member is islanded (its whole family scopes, no dedup) so a foreign build cannot leak in through a\n * shared sibling; every other remote keeps the base per-external verdict. Emits nothing, only\n * mutates `SharedExternal.versions`. See docs/version-resolver.md.\n *\n * Inert unless `useAutoExternalPooling` is on or an external carries a remote `pool` tag. The\n * `strict` scope is never pooled.\n */\n return () => {\n const { useAutoExternalPooling } = config.feature;\n\n // With auto-pooling off and no `pool` tag ever seen, nothing can be pooled \u2014 skip the scope\n // walk. Auto-pooling on must never early-out: any scoped package is potentially poolable.\n if (!useAutoExternalPooling && !ports.sharedExternalsRepo.hasPoolTag()) {\n return Promise.resolve();\n }\n\n for (const scope of ports.sharedExternalsRepo.getScopes()) {\n if (ports.sharedExternalsRepo.scopeType(scope) === 'strict') continue;\n\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(scope);\n\n try {\n for (const [poolName, members] of buildPools(\n sharedExternals,\n useAutoExternalPooling,\n config.log\n )) {\n poolFamily(poolName, members, scope);\n }\n } catch (error) {\n if (error instanceof NFError) return Promise.reject(error);\n config.log.error(3, `[${scope}] failed to pool shared externals.`, {\n sharedExternals,\n error,\n });\n return Promise.reject(\n new NFError(`Could not pool shared externals in scope ${scope}.`, error as Error)\n );\n }\n }\n return Promise.resolve();\n };\n\n function poolFamily(poolName: PoolName, members: PoolMember[], scope: string): void {\n // Below 2 members across 2 remotes there is nothing to coordinate; the per-external result is\n // already coherent.\n if (members.length < 2) return;\n\n const allRemotes = remotesInPool(members);\n if (allRemotes.length < 2) return;\n\n const islanded = islandedRemotes(members);\n\n config.log.debug(\n 3,\n `[${scope}][pool:${poolName}] ${members.length} members across ${allRemotes.length} remotes, islanded={${[...islanded].join(', ') || '\u2205'}}\\n` +\n members.map(m => ` - ${m.name}`).join('\\n')\n );\n\n // Defensive: determine already throws on real incompatibilities under strictExternalCompatibility.\n if (islanded.size > 0 && config.strict.strictExternalCompatibility) {\n config.log.error(\n 3,\n `[${scope}][pool:${poolName}] version-incompatible remotes cannot be pooled: {${[...islanded].join(', ')}}.`\n );\n throw new NFError(`Could not pool '${poolName}' in scope ${scope}.`);\n }\n\n for (const member of members) {\n const rebuilt = rebuildMember(member, islanded);\n warnIfScopedOnly(poolName, member.name, rebuilt, scope);\n ports.sharedExternalsRepo.addOrUpdate(member.name, rebuilt, scope);\n }\n }\n\n // Warn only when sharing was genuinely possible and lost: a scoped-only member with >1 consumer. A\n // single-consumer member is one download either way, so pooling could not have improved it.\n function warnIfScopedOnly(\n poolName: PoolName,\n memberName: string,\n rebuilt: SharedExternal,\n scope: string\n ): void {\n if (rebuilt.versions.some(v => v.action === 'share')) return;\n const consumers = new Set(rebuilt.versions.flatMap(v => v.remotes.map(r => r.name))).size;\n if (consumers < 2) return;\n config.log.warn(\n 3,\n `[${scope}][pool:${poolName}] '${memberName}' is scoped-only \u2014 no coherent shared build provides it; ${consumers} remotes download their own copy.`\n );\n }\n\n // Island-or-defer at remote-copy granularity: islanded (or already-`scope`) copies self-serve;\n // every other copy keeps its base verdict. Scope versions group by each copy's real tag (F3).\n function rebuildMember(member: PoolMember, islanded: Set<RemoteName>): SharedExternal {\n const entries = member.external.versions.flatMap(v =>\n v.remotes.map(meta => ({ remote: meta.name, tag: v.tag, host: v.host, action: v.action, meta }))\n );\n\n const isScoped = (e: (typeof entries)[number]) =>\n islanded.has(e.remote) || e.action === 'scope';\n\n let scoped = entries.filter(isScoped);\n let clean = entries.filter(e => !isScoped(e));\n\n // Winner islanded away: no shared build survives, so the orphaned `skip` copies self-serve too.\n if (!clean.some(e => e.action === 'share')) {\n scoped = [...scoped, ...clean];\n clean = [];\n }\n\n const shareEntries = clean.filter(e => e.action === 'share');\n const shareVersion: SharedVersion[] =\n shareEntries.length > 0\n ? [\n {\n tag: shareEntries[0]!.tag,\n host: shareEntries[0]!.host,\n action: 'share',\n remotes: shareEntries.map(e => e.meta),\n },\n ]\n : [];\n\n const skipByTag = new Map<string, SharedVersion>();\n for (const e of clean) {\n if (e.action !== 'skip') continue;\n const version = skipByTag.get(e.tag) ?? {\n tag: e.tag,\n host: e.host,\n action: 'skip' as const,\n remotes: [],\n };\n version.remotes.push(e.meta);\n skipByTag.set(e.tag, version);\n }\n\n const scopeByTag = new Map<string, SharedVersion>();\n for (const e of scoped) {\n const version = scopeByTag.get(e.tag) ?? {\n tag: e.tag,\n host: false,\n action: 'scope' as const,\n remotes: [],\n };\n version.remotes.push(e.meta);\n scopeByTag.set(e.tag, version);\n }\n\n return {\n dirty: false,\n versions: [...shareVersion, ...skipByTag.values(), ...scopeByTag.values()],\n };\n }\n}\n", "var BuildNotificationType = /* @__PURE__ */ ((BuildNotificationType2) => {\n BuildNotificationType2[\"COMPLETED\"] = \"federation-rebuild-complete\";\n BuildNotificationType2[\"ERROR\"] = \"federation-rebuild-error\";\n BuildNotificationType2[\"CANCELLED\"] = \"federation-rebuild-cancelled\";\n return BuildNotificationType2;\n})(BuildNotificationType || {});\nexport {\n BuildNotificationType\n};\n", "const CHUNK_PREFIX = \"@nf-internal\";\nfunction toChunkImport(fileName) {\n if (fileName.startsWith(\"./\")) {\n fileName = fileName.slice(2);\n }\n const packageName = fileName.replace(/.(m|c)?js$/, \"\");\n return CHUNK_PREFIX + \"/\" + packageName;\n}\nexport {\n CHUNK_PREFIX,\n toChunkImport\n};\n", "import type { ForGeneratingImportMap } from '../driver-ports/init/for-generating-import-map';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { ImportMap, Imports } from 'lib/core/1.domain/import-map/import-map.contract';\nimport {\n GLOBAL_SCOPE,\n type RemoteName,\n type ScopedExternal,\n type RemoteInfo,\n type SharedExternal,\n type SharedVersion,\n} from 'lib/core/1.domain';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\nimport * as _path from 'lib/utils/path';\nimport { NFError } from 'lib/core/native-federation.error';\nimport { toChunkImport } from '@softarc/native-federation/domain';\n\nexport function createGenerateImportMap(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n 'remoteInfoRepo' | 'scopedExternalsRepo' | 'sharedChunksRepo' | 'sharedExternalsRepo'\n >\n): ForGeneratingImportMap {\n /**\n * Step 4: Generate an importMap from the cached remoteEntries\n *\n * The processed externals in the storage/cache (step 2 & 3) are used\n * to generate an importMap. The step returns the generated importMap object.\n */\n return () => {\n const importMap: ImportMap = { imports: {} };\n const chunkBundles: Record<string, Set<string>> = {};\n try {\n addScopedExternals(importMap, chunkBundles);\n addshareScopeExternals(importMap, chunkBundles);\n addGlobalSharedExternals(importMap, chunkBundles);\n addRemoteInfos(importMap, chunkBundles);\n\n addChunkImports(importMap, chunkBundles);\n\n return Promise.resolve(importMap);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n /**\n * Step 4.1: Begin with appending smallest scope of shared dependencies\n * @param importMap\n * @returns\n */\n function addScopedExternals(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>\n ): ImportMap {\n const scopedExternals = ports.scopedExternalsRepo.getAll();\n\n for (const [remoteName, externals] of Object.entries(scopedExternals)) {\n const remote = ports.remoteInfoRepo.tryGet(remoteName).orThrow(() => {\n config.log.error(4, `[scoped][${remoteName}] Remote name not found in cache.`);\n return new NFError('Could not create ImportMap.');\n });\n addToScope(importMap, remote.scopeUrl, createScopeModules(externals, remote.scopeUrl));\n\n for (const version of Object.values(externals)) {\n for (const file of Object.values(version.entries)) {\n addIntegrity(importMap, _path.join(remote.scopeUrl, file), remoteName, file);\n }\n }\n\n Object.values(externals)\n .filter(e => !!e.bundle)\n .forEach(e => registerBundleChunks(chunkBundles, remoteName, e.bundle));\n }\n\n return importMap;\n }\n\n function createScopeModules(externals: ScopedExternal, scope: string): Imports {\n const modules: Imports = {};\n\n for (const version of Object.values(externals)) {\n for (const [packageName, file] of Object.entries(version.entries)) {\n modules[packageName] = _path.join(scope, file);\n }\n }\n\n return modules;\n }\n\n /**\n * Step 4.2: Added the shareScope externals, overriding the scoped externals that are shared\n * @param importMap\n * @returns\n */\n function addshareScopeExternals(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>\n ): ImportMap {\n const shareScopes = ports.sharedExternalsRepo.getScopes({ includeGlobal: false });\n\n for (const shareScope of shareScopes) {\n processshareScope(importMap, shareScope, chunkBundles);\n }\n\n return importMap;\n }\n\n function processshareScope(\n importMap: ImportMap,\n shareScope: string,\n chunkBundles: Record<string, Set<string>>\n ): void {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(shareScope);\n\n for (const [externalName, external] of Object.entries(sharedExternals)) {\n let override: SharedVersion | undefined | 'NOT_AVAILABLE' = undefined;\n let overrideScope: string | undefined = undefined;\n\n for (const version of external.versions) {\n if (version.action === 'scope') {\n for (const remote of version.remotes) {\n const remoteScope = getScope(shareScope, remote.name, externalName);\n for (const [packageName, file] of Object.entries(remote.entries)) {\n const url = _path.join(remoteScope, file);\n addToScope(importMap, remoteScope, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n }\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n remote.cached = true;\n }\n continue;\n }\n\n version.remotes[0]!.cached = true;\n\n // Serve every entrypoint from one source: the winning remote, or the override\n // provider when a 'skip' version is redirected elsewhere.\n let source = version.remotes[0]!;\n let sourceScope = getScope(shareScope, source.name, externalName);\n\n if (version.action === 'share') {\n registerBundleChunks(chunkBundles, source.name, source.bundle);\n } else if (version.action === 'skip') {\n if (!override) {\n override = findOverride(external, shareScope, externalName) ?? 'NOT_AVAILABLE';\n }\n if (override !== 'NOT_AVAILABLE') {\n if (!overrideScope)\n overrideScope = getScope(shareScope, override.remotes[0]!.name, externalName);\n source = override.remotes[0]!;\n sourceScope = overrideScope;\n override.remotes[0]!.cached = true;\n version.remotes[0]!.cached = false;\n }\n }\n\n const mappings: { packageName: string; url: string; name: RemoteName; file: string }[] =\n Object.entries(source.entries).map(([packageName, file]) => ({\n packageName,\n url: _path.join(sourceScope, file),\n name: source.name,\n file,\n }));\n\n version.remotes.forEach(r => {\n const rScope = getScope(shareScope, r.name, externalName);\n for (const m of mappings) {\n addToScope(importMap, rScope, { [m.packageName]: m.url });\n }\n // Entrypoints the shared source can't provide are served from this remote's own build.\n for (const [packageName, file] of Object.entries(r.entries)) {\n if (packageName in source.entries) continue;\n if (config.strict.strictEntryPointCoverage) {\n warnUncoveredEntrypoint(shareScope, externalName, r.name, packageName);\n continue;\n }\n const url = _path.join(rScope, file);\n addToScope(importMap, rScope, { [packageName]: url });\n addIntegrity(importMap, url, r.name, file);\n r.cached = true;\n }\n });\n for (const m of mappings) {\n addIntegrity(importMap, m.url, m.name, m.file);\n }\n }\n ports.sharedExternalsRepo.addOrUpdate(externalName, external, shareScope);\n }\n }\n\n function findOverride(\n external: SharedExternal,\n shareScope: string,\n externalName: string\n ): SharedVersion | undefined {\n const sharedVersions = external.versions.filter(v => v.action === 'share');\n const scopedExternalName = `${shareScope}.${externalName}`;\n\n if (sharedVersions.length > 1) {\n handleMultipleSharedVersions(scopedExternalName);\n }\n\n if (sharedVersions.length < 1) {\n if (config.strict.strictImportMap) {\n config.log.error(4, `[${shareScope}][${externalName}] shareScope has no override version.`);\n throw new NFError('Could not create ImportMap.');\n }\n config.log.debug(\n 4,\n `[${shareScope}][${externalName}] shareScope has no override version, scoping override versions.`\n );\n }\n\n return sharedVersions[0];\n }\n\n function handleMultipleSharedVersions(scopedExternalName: string): void {\n if (config.strict.strictImportMap) {\n config.log.error(\n 4,\n `[${scopedExternalName}] ShareScope external has multiple shared versions.`\n );\n throw new NFError('Could not create ImportMap.');\n }\n\n config.log.warn(4, `ShareScope external ${scopedExternalName} has multiple shared versions.`);\n }\n\n /**\n * Step 4.3: Added the globally shared externals.\n * @param importMap\n * @returns\n */\n function addGlobalSharedExternals(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>\n ): ImportMap {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope();\n\n for (const [externalName, external] of Object.entries(sharedExternals)) {\n for (const version of external.versions) {\n if (version.action === 'skip') continue;\n if (version.action === 'scope') {\n for (const remote of version.remotes) {\n const remoteScope = getScope(GLOBAL_SCOPE, remote.name, externalName);\n for (const [packageName, file] of Object.entries(remote.entries)) {\n const url = _path.join(remoteScope, file);\n addToScope(importMap, remoteScope, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n }\n remote.cached = true;\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n }\n continue;\n }\n\n if (importMap.imports[externalName]) {\n notifyDuplicateGlobalExternal(externalName);\n continue;\n }\n\n const scope = getScope(GLOBAL_SCOPE, version.remotes[0]!.name, externalName);\n for (const [packageName, file] of Object.entries(version.remotes[0]!.entries)) {\n const url = _path.join(scope, file);\n addToGlobal(importMap, { [packageName]: url });\n addIntegrity(importMap, url, version.remotes[0]!.name, file);\n }\n registerBundleChunks(chunkBundles, version.remotes[0]!.name, version.remotes[0]!.bundle);\n\n version.remotes[0]!.cached = true;\n }\n\n // Second pass, so the winner has claimed its imports first: fill entrypoints only a\n // skipped version declares from its own build.\n for (const version of external.versions) {\n if (version.action !== 'skip') continue;\n const remote = version.remotes[0]!;\n for (const [packageName, file] of Object.entries(remote.entries)) {\n if (importMap.imports[packageName]) continue;\n if (config.strict.strictEntryPointCoverage) {\n warnUncoveredEntrypoint(GLOBAL_SCOPE, externalName, remote.name, packageName);\n continue;\n }\n const scope = getScope(GLOBAL_SCOPE, remote.name, externalName);\n const url = _path.join(scope, file);\n addToGlobal(importMap, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n remote.cached = true;\n }\n }\n ports.sharedExternalsRepo.addOrUpdate(externalName, external);\n }\n\n return importMap;\n }\n\n function warnUncoveredEntrypoint(\n scope: string,\n externalName: string,\n remoteName: RemoteName,\n packageName: string\n ): void {\n const msg = `[${scope}][${externalName}][${remoteName}] Entrypoint '${packageName}' is not covered by the shared version.`;\n if (config.strict.strictImportMap) {\n config.log.error(4, msg);\n throw new NFError('Could not create ImportMap.');\n }\n config.log.warn(4, msg);\n }\n\n function notifyDuplicateGlobalExternal(externalName: string): void {\n if (config.strict.strictImportMap) {\n config.log.error(4, `[${externalName}] Shared external has multiple shared versions.`);\n throw new NFError('Could not create ImportMap.');\n }\n\n config.log.warn(4, `Singleton external ${externalName} has multiple shared versions.`);\n }\n\n function addToScope(importMap: ImportMap, scope: string, imports: Imports): void {\n if (!importMap.scopes) importMap.scopes = {};\n if (!importMap.scopes[scope]) importMap.scopes[scope] = {};\n importMap.scopes[scope] = Object.assign(importMap.scopes[scope], imports);\n }\n function addToGlobal(importMap: ImportMap, imports: Imports): void {\n importMap.imports = Object.assign(importMap.imports, imports);\n }\n\n /**\n * Step 4.4: Added the remote-modules (into the global scope).\n * @param importMap\n * @returns\n */\n function addRemoteInfos(importMap: ImportMap, chunkBundles: Record<string, Set<string>>): void {\n const remotes = ports.remoteInfoRepo.getAll();\n\n for (const [remoteName, remote] of Object.entries(remotes)) {\n addRemoteExposedModules(importMap, remoteName, remote);\n registerBundleChunks(chunkBundles, remoteName, 'mapping-or-exposed');\n }\n }\n\n function addRemoteExposedModules(\n importMap: ImportMap,\n remoteName: string,\n remote: RemoteInfo\n ): void {\n for (const exposed of remote.exposes) {\n const moduleName = _path.join(remoteName, exposed.moduleName);\n const moduleUrl = _path.join(remote.scopeUrl, exposed.file);\n importMap.imports[moduleName] = moduleUrl;\n addIntegrity(importMap, moduleUrl, remoteName, exposed.file);\n }\n }\n\n function registerBundleChunks(\n chunkBundles: Record<string, Set<string>>,\n remoteName: string,\n bundleName?: string\n ) {\n if (!bundleName) return chunkBundles;\n if (!chunkBundles[remoteName]) chunkBundles[remoteName] = new Set();\n chunkBundles[remoteName].add(bundleName);\n return chunkBundles;\n }\n\n function addChunkImports(importMap: ImportMap, chunkBundles: Record<string, Set<string>>) {\n Object.entries(chunkBundles).forEach(([remoteName, bundles]) => {\n const baseUrl = getScope('CHUNKS', remoteName);\n\n const imports = Array.from(bundles).reduce((_imports, bundleName) => {\n ports.sharedChunksRepo.tryGet(remoteName, bundleName).ifPresent(files => {\n files.forEach(file => {\n const url = _path.join(baseUrl, file);\n _imports[toChunkImport(file)] = url;\n addIntegrity(importMap, url, remoteName, file);\n });\n });\n return _imports;\n }, {} as Imports);\n\n if (Object.keys(imports).length > 0) addToScope(importMap, baseUrl, imports);\n });\n\n return importMap;\n }\n\n function addIntegrity(\n importMap: ImportMap,\n url: string,\n remoteName: RemoteName,\n file: string\n ): void {\n const hash = ports.remoteInfoRepo.tryGet(remoteName).get()?.integrity?.[file];\n if (!hash) return;\n if (!importMap.integrity) importMap.integrity = {};\n importMap.integrity[url] = hash;\n }\n\n function getScope(ctx: string, remoteName: RemoteName, externalName?: string) {\n return ports.remoteInfoRepo\n .tryGet(remoteName)\n .map(remote => remote.scopeUrl)\n .orThrow(() => {\n if (externalName) {\n config.log.error(\n 4,\n `[${ctx}][${externalName}][${remoteName}] Remote name not found in cache.`\n );\n } else {\n config.log.error(4, `[${ctx}][${remoteName}] Remote name not found in cache.`);\n }\n\n return new NFError('Could not create ImportMap.');\n });\n }\n}\n", "import type { DrivingContract } from '../driving-ports/driving.contract';\nimport type {\n CommitOptions,\n ForCommittingChanges,\n} from '../driver-ports/init/for-committing-changes.port';\nimport type { ImportMap } from 'lib/core/1.domain/import-map/import-map.contract';\nimport type { LoggingConfig } from 'lib/core/2.app/config';\n\nexport function createCommitChanges(\n config: LoggingConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'scopedExternalsRepo'\n | 'sharedExternalsRepo'\n | 'sharedChunksRepo'\n | 'browser'\n >\n): ForCommittingChanges {\n /**\n * Step 5: Commit all changes\n *\n * The changes made to the storage/cache are persisted to storage, and the importmap is\n * inserted into the HTML DOM.\n *\n * This step only runs if all previous steps were succesful to prevent the persistence of\n * erroneous changes into storage which can corrupt other pages/routes of the host.\n *\n * @param adapters\n */\n return (importMap: ImportMap, opts: CommitOptions = {}) =>\n Promise.resolve(importMap)\n .then(map => addToBrowser(map, opts))\n .then(persistRepositoryChanges);\n\n function addToBrowser(importMap: ImportMap, opts: CommitOptions) {\n ports.browser.setImportMapFn(importMap, opts);\n config.log.debug(5, 'Added import map to browser.', importMap);\n return importMap;\n }\n\n function persistRepositoryChanges() {\n ports.remoteInfoRepo.commit();\n ports.scopedExternalsRepo.commit();\n ports.sharedExternalsRepo.commit();\n ports.sharedChunksRepo.commit();\n return;\n }\n}\n", "import type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { ForExposingModuleLoader } from '../driver-ports/init/for-exposing-module-loader.port';\nimport type { LoadRemoteModule } from 'lib/core/init-federation.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { LoggingConfig } from '../config/log.contract';\nimport * as _path from 'lib/utils/path';\n\nexport function createExposeModuleLoader(\n config: LoggingConfig,\n ports: Pick<DrivingContract, 'remoteInfoRepo' | 'browser'>\n): ForExposingModuleLoader {\n const loadRemoteModule: LoadRemoteModule = <TModule = unknown>(\n remoteName: string,\n exposedModule: string\n ): Promise<TModule> => {\n try {\n if (!ports.remoteInfoRepo.contains(remoteName)) {\n throw new NFError(`Remote '${remoteName}' is not initialized.`);\n }\n\n const remoteModuleUrl = ports.remoteInfoRepo\n .tryGetModule(remoteName, exposedModule)\n .orThrow(\n new NFError(\n `Exposed module '${exposedModule}' from remote '${remoteName}' not found in storage.`\n )\n );\n\n config.log.debug(6, `Loading initialized module '${remoteModuleUrl}'`);\n\n return ports.browser.importModule(remoteModuleUrl) as Promise<TModule>;\n } catch (error) {\n config.log.error(6, `Failed to load module ${_path.join(remoteName, exposedModule)}: `, {\n error,\n });\n\n return Promise.reject(\n new NFError(`Failed to load module ${_path.join(remoteName, exposedModule)}`)\n );\n }\n };\n\n /**\n * Step 6: expose module loader\n *\n * The module loader can only be used after the importmap was generated and added to\n * the DOM, hence the module loader fn is exposed to the host after the final commit\n * step.\n *\n * The loadRemoteModule is also a callback that is returned as a promise by the initFederation\n * function. This way the loadRemoteModule can be shared througout the host application using\n * CustomEvents or by adding it to the global Window object for easy access.\n *\n * @param adapters\n */\n return () => Promise.resolve(loadRemoteModule);\n}\n", "export class Optional<T> {\n private constructor(private item?: T) {}\n\n public static of<T>(item?: T): Optional<T> {\n return new Optional(item);\n }\n public static empty<U>(): Optional<U> {\n return Optional.of<U>(undefined);\n }\n\n public isPresent() {\n return typeof this.item !== 'undefined' && this.item !== null;\n }\n public set<U>(other: U) {\n return Optional.of(other);\n }\n\n public ifPresent(callback: (_: T) => void): void {\n if (this.isPresent()) callback(this.item as T);\n }\n\n public map<U>(callback: (_: NonNullable<T>) => U | Optional<U>): Optional<U> {\n if (!this.isPresent()) return Optional.empty();\n\n const result = callback(this.item as NonNullable<T>);\n return result instanceof Optional ? result : Optional.of(result);\n }\n\n public orElse(other: Required<T>): NonNullable<T> {\n return this.isPresent() ? (this.item as NonNullable<T>) : (other as NonNullable<T>);\n }\n\n public orThrow(error: Error | string | (() => Error)): NonNullable<T> {\n if (this.isPresent()) return this.item as NonNullable<T>;\n if (typeof error === 'function') throw error();\n throw typeof error === 'string' ? new Error(error) : error;\n }\n\n public get(): T | undefined {\n return this.item;\n }\n}\n", "import type { RemoteEntryUrl } from 'lib/core/1.domain/remote-entry/manifest.contract';\nimport type { RemoteName } from 'lib/core/1.domain/remote/remote-info.contract';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from '../config/mode.contract';\nimport type { ForGettingRemoteEntry } from '../driver-ports/init/for-getting-remote-entry.port';\nimport type { RemoteRef } from '../driver-ports/init/flow.contract';\nimport { Optional } from 'lib/utils/optional';\nimport type { RemoteEntry } from 'lib/core/1.domain';\nimport * as _path from 'lib/utils/path';\n\nconst normalizeRemoteRef = (remote?: RemoteRef): { name?: RemoteName; integrity?: string } => {\n if (!remote) return {};\n if (typeof remote === 'string') return { name: remote };\n return remote;\n};\n\nexport function createGetRemoteEntry(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'remoteEntryProvider' | 'remoteInfoRepo' | 'sse'>\n): ForGettingRemoteEntry {\n return async (remoteEntryUrl: RemoteEntryUrl, remote?: RemoteRef) => {\n const { name: remoteName, integrity } = normalizeRemoteRef(remote);\n\n if (!!remoteName && shouldSkipCachedRemote(remoteEntryUrl, remoteName)) {\n config.log.debug(7, `Found remote '${remoteName}' in storage, omitting fetch.`);\n return Optional.empty<RemoteEntry>();\n }\n\n try {\n const remoteEntry = integrity\n ? await ports.remoteEntryProvider.provide(remoteEntryUrl, { integrity })\n : await ports.remoteEntryProvider.provide(remoteEntryUrl);\n\n config.log.debug(\n 7,\n `[${remoteEntry.name}] Fetched from '${remoteEntry.url}', exposing: ${JSON.stringify(remoteEntry.exposes)}`\n );\n\n if (!!remoteName && remoteEntry.name !== remoteName) {\n const errorMsg = `Fetched remote '${remoteEntry.name}' does not match requested '${remoteName}'.`;\n if (config.strict.strictRemoteEntry) {\n config.log.error(7, errorMsg);\n throw new NFError('Could not fetch remote entry');\n }\n config.log.warn(7, errorMsg + ' Omitting expected name.');\n }\n\n if (ports.remoteInfoRepo.contains(remoteEntry.name)) {\n remoteEntry.override = true;\n config.log.debug(7, `Overriding existing remote '${remoteName}' with '${remoteEntryUrl}'.`);\n }\n return Optional.of(checkForSSE(remoteEntry));\n } catch (error) {\n config.log.error(\n 7,\n `[${remoteName ?? 'unknown'}] Could not fetch remoteEntry from ${remoteEntryUrl}.`,\n error\n );\n return Promise.reject(\n new NFError(`[${remoteName ?? remoteEntryUrl}] Could not fetch remoteEntry.`)\n );\n }\n };\n\n function shouldSkipCachedRemote(remoteEntryUrl: string, remoteName: RemoteName): boolean {\n return ports.remoteInfoRepo\n .tryGet(remoteName)\n .map(\n cachedRemoteInfo =>\n config.profile.overrideCachedRemotes !== 'always' ||\n (!config.profile.overrideCachedRemotesIfURLMatches &&\n remoteEntryUrl === _path.join(cachedRemoteInfo.scopeUrl, 'remoteEntry.json'))\n )\n .orElse(false);\n }\n\n function checkForSSE(entry: RemoteEntry): RemoteEntry {\n if (config.sse) {\n if (entry.buildNotificationsEndpoint) {\n ports.sse.watchRemoteBuilds(\n _path.join(_path.getScope(entry.url), entry.buildNotificationsEndpoint)\n );\n config.log.debug(7, `Registered SSE endpoint of remote '${entry.name}' `);\n } else {\n config.log.debug(7, `Remote ${entry.name} has no defined 'buildNotificationsEndpoint'`);\n }\n }\n return entry;\n }\n}\n", "import type { ForUpdatingCache } from '../driver-ports/init/for-updating-cache';\nimport {\n type RemoteEntry,\n type DenseSharedInfo,\n type SharedInfoActions,\n type SharedVersion,\n type SharedVersionAction,\n GLOBAL_SCOPE,\n} from 'lib/core/1.domain';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport * as _path from 'lib/utils/path';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport { createStoreRemoteEntry, type SharedExternalContext } from './store-remote-entry';\n\nexport function createUpdateCache(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'sharedExternalsRepo'\n | 'scopedExternalsRepo'\n | 'sharedChunksRepo'\n | 'versionCheck'\n >\n): ForUpdatingCache {\n const storeRemoteEntry = createStoreRemoteEntry(config, ports, 8);\n\n /**\n * Step 8 (dynamic init): merge a runtime-loaded remoteEntry into the cache. The\n * import map is already committed, so shared externals are resolved immediately\n * and additively \u2014 an already-shared version stays authoritative.\n */\n return remoteEntry => {\n try {\n const actions: SharedInfoActions = {};\n\n storeRemoteEntry(remoteEntry, (entry, external, ctx) => {\n const { action, sharedVersion } = resolveSharedExternal(entry, external, ctx);\n actions[external.packageName] = { action };\n\n if (action === 'skip' && external.shareScope && sharedVersion?.remotes[0]?.entries) {\n actions[external.packageName]!.override = resolveOverrideEntries(\n entry,\n external,\n sharedVersion\n );\n }\n });\n\n return Promise.resolve({ entry: remoteEntry, actions });\n } catch (error) {\n return Promise.reject(error);\n }\n };\n\n function resolveSharedExternal(\n remoteEntry: RemoteEntry,\n sharedInfo: DenseSharedInfo,\n {\n tag,\n remote,\n cached,\n scopeType,\n assertSameVersionCompatibility,\n commit,\n }: SharedExternalContext\n ): { action: SharedVersionAction; sharedVersion?: SharedVersion } {\n let action: SharedVersionAction = scopeType === 'strict' ? 'share' : 'skip';\n\n const sharedVersion = cached.versions.find(c => c.action === 'share');\n const isCompatible =\n !sharedVersion || ports.versionCheck.isCompatible(sharedVersion.tag, remote.requiredVersion);\n\n if (action === 'skip' && !isCompatible && remote.strictVersion) {\n action = 'scope';\n const errorMsg = `[${sharedInfo.shareScope ?? GLOBAL_SCOPE}][${remoteEntry.name}] ${\n sharedInfo.packageName\n }@${sharedInfo.version} Is not compatible with existing ${sharedInfo.packageName}@${\n sharedVersion!.tag\n } requiredRange '${sharedVersion!.remotes[0]?.requiredVersion}'`;\n\n if (config.strict.strictExternalCompatibility) {\n config.log.error(8, errorMsg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n config.log.warn(8, errorMsg);\n }\n\n if (\n action === 'skip' &&\n config.strict.strictEntryPointCoverage &&\n sharedVersion &&\n Object.keys(remote.entries).some(e => !(e in sharedVersion.remotes[0]!.entries))\n ) {\n action = 'scope';\n }\n\n const matchingVersion = cached.versions.find(cached => cached.tag === tag);\n\n if (matchingVersion) {\n assertSameVersionCompatibility(matchingVersion);\n matchingVersion.remotes.push(remote);\n } else {\n if (!sharedVersion) action = 'share';\n remote.cached = action !== 'skip';\n cached.versions.push({ tag, action, host: false, remotes: [remote] });\n }\n\n commit();\n return { action, sharedVersion };\n }\n\n function resolveOverrideEntries(\n remoteEntry: RemoteEntry,\n external: DenseSharedInfo,\n sharedVersion: SharedVersion\n ): Record<string, string> {\n return ports.remoteInfoRepo\n .tryGet(sharedVersion.remotes[0]!.name)\n .map(remote =>\n Object.fromEntries(\n Object.entries(sharedVersion.remotes[0]!.entries).map(([packageName, file]) => [\n packageName,\n _path.join(remote.scopeUrl, file),\n ])\n )\n )\n .orThrow(() => {\n config.log.error(\n 8,\n `[${external.shareScope ?? GLOBAL_SCOPE}][${remoteEntry.name}][${\n external.packageName\n }@${external.version}][override] Remote name not found in cache.`\n );\n return new NFError(\n `Could not find override url from remote ${sharedVersion.remotes[0]!.name}`\n );\n });\n }\n}\n", "import type { ForPoolingDynamicExternals } from '../../driver-ports/init/for-pooling-dynamic-externals.port';\nimport type { ModeConfig } from '../../config/mode.contract';\nimport { GLOBAL_SCOPE, STRICT_SCOPE } from 'lib/core/1.domain';\nimport { autoScope, groupByMembership, type PoolCandidate } from './pool-graph';\n\nexport function createPoolDynamicExternals(config: ModeConfig): ForPoolingDynamicExternals {\n /**\n * Dynamic-init counterpart of pool-shared-externals. The committed import map is immutable, so\n * this step is strictly additive: it only adjusts the newly loaded remote's own actions, never\n * the existing shared versions (host precedence was already applied when those were elected).\n * See docs/version-resolver.md.\n */\n return ({ entry, actions }) => {\n const { useAutoExternalPooling } = config.feature;\n\n // With auto-pooling off, only an explicit `pool` tag on this entry can form a pool.\n if (!useAutoExternalPooling && !(entry.shared ?? []).some(e => e.pool?.trim())) {\n return Promise.resolve({ entry, actions });\n }\n\n const byScope = new Map<string, PoolCandidate<string>[]>();\n for (const external of entry.shared ?? []) {\n const name = external.packageName;\n if (!external.singleton || !actions[name]) continue;\n if (external.shareScope === STRICT_SCOPE) continue;\n\n const tag = external.pool?.trim();\n const shareScope = external.shareScope ?? GLOBAL_SCOPE;\n const candidates = byScope.get(shareScope) ?? [];\n candidates.push({\n name,\n scope: autoScope(name, useAutoExternalPooling),\n tags: tag ? [{ remote: entry.name, tag }] : [],\n value: name,\n });\n byScope.set(shareScope, candidates);\n }\n\n const scope = (name: string) => {\n actions[name]!.action = 'scope';\n delete actions[name]!.override;\n };\n\n for (const candidates of byScope.values()) {\n for (const members of groupByMembership(candidates).values()) {\n const memberActions = members.map(name => actions[name]!.action);\n\n // Island-or-defer: only a real incompatibility scopes the whole family (no dedup \u2014 a\n // same-version sibling would bridge the foreign build). A `share`+`skip` mix is a coverage\n // gap, not a conflict, so the loaded remote keeps the resolver's verdict.\n if (memberActions.includes('scope')) {\n members.forEach(scope);\n }\n }\n }\n\n return Promise.resolve({ entry, actions });\n };\n}\n", "import type { ImportMap } from 'lib/core/1.domain/import-map/import-map.contract';\nimport { type RemoteEntry, type SharedInfoActions } from 'lib/core/1.domain';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\nimport * as _path from 'lib/utils/path';\nimport type { ForConvertingToImportMap } from 'lib/core/2.app/driver-ports/init/for-converting-to-import-map';\nimport type { DrivingContract } from 'lib/core/2.app/driving-ports/driving.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport { toChunkImport } from '@softarc/native-federation/domain';\n\nexport function createConvertToImportMap(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'sharedChunksRepo'>\n): ForConvertingToImportMap {\n const { log } = config;\n return async ({ entry, actions }) => {\n const importMap: ImportMap = { imports: {} };\n\n addExternals(entry, actions, importMap);\n addRemoteInfos(entry, importMap);\n log.debug(9, `[${entry.name}] Processed actions:`, actions);\n return importMap;\n };\n\n function addExternals(\n remoteEntry: RemoteEntry,\n actions: SharedInfoActions,\n importMap: ImportMap\n ): void {\n if (!remoteEntry.shared) {\n return;\n }\n\n const remoteEntryScope = _path.getScope(remoteEntry.url);\n const integrityMap = remoteEntry.integrity;\n\n const chunkBundles = new Set<string>(['mapping-or-exposed']);\n remoteEntry.shared.forEach(external => {\n // Scoped externals\n if (!external.singleton) {\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n\n if (external?.bundle) chunkBundles.add(external?.bundle);\n return;\n }\n\n if (!actions[external.packageName]) {\n log.warn(\n 9,\n `[${remoteEntry.name}] No action defined for shared external '${external.packageName}', skipping.`\n );\n return;\n }\n\n // Skipped externals are provided by another remote. A global skip is served\n // by the global share elsewhere; a shareScope skip is always paired with an\n // override (see update-cache) that remaps its entrypoints.\n if (actions[external.packageName]!.action === 'skip') {\n const override = actions[external.packageName]!.override;\n if (!external.shareScope) return;\n if (override) {\n Object.entries(override).forEach(([packageName, url]) => {\n addToScopes(remoteEntryScope, packageName, url, importMap);\n });\n // Entrypoints the override can't supply are served from this remote's own build.\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n if (packageName in override) return;\n if (config.strict.strictEntryPointCoverage) {\n warnUncoveredEntrypoint(remoteEntry.name, external.packageName, packageName);\n return;\n }\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n // Reaching here means the resolver failed to produce the expected override.\n log.error(\n 9,\n `[${remoteEntry.name}][${external.packageName}] shareScope skip has no override.`\n );\n if (config.strict.strictImportMap) throw new NFError('Could not create ImportMap.');\n // Non-strict fallback: serve from the remote's own scope (matches init).\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n\n // Chunks for shared externals\n if (external?.bundle) chunkBundles.add(external?.bundle);\n\n // Scoped shared externals\n if (actions[external.packageName]!.action === 'scope') {\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n\n // Shared externals with shareScope\n if (external.shareScope) {\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n\n // Default case: shared globally\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n importMap.imports[packageName] = url;\n\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n });\n\n addChunkImports(importMap, remoteEntry, remoteEntryScope, chunkBundles);\n }\n\n function addToScopes(\n scope: string,\n packageName: string,\n url: string,\n importMap: ImportMap\n ): void {\n if (!importMap.scopes) importMap.scopes = {};\n if (!importMap.scopes[scope]) importMap.scopes[scope] = {};\n importMap.scopes[scope][packageName] = url;\n }\n\n function addRemoteInfos(remoteEntry: RemoteEntry, importMap: ImportMap): void {\n if (!remoteEntry.exposes) return;\n const scope = _path.getScope(remoteEntry.url);\n\n remoteEntry.exposes.forEach(exposed => {\n const moduleName = _path.join(remoteEntry.name, exposed.key);\n const moduleUrl = _path.join(scope, exposed.outFileName);\n importMap.imports[moduleName] = moduleUrl;\n addIntegrity(importMap, moduleUrl, remoteEntry.integrity, exposed.outFileName);\n });\n }\n\n function addChunkImports(\n importMap: ImportMap,\n remoteEntry: RemoteEntry,\n remoteEntryScope: string,\n chunkBundles: Set<string>\n ) {\n Array.from(chunkBundles).forEach(bundleName => {\n ports.sharedChunksRepo.tryGet(remoteEntry.name, bundleName).ifPresent(files => {\n files.forEach(file => {\n const url = _path.join(remoteEntryScope, file);\n addToScopes(remoteEntryScope, toChunkImport(file), url, importMap);\n addIntegrity(importMap, url, remoteEntry.integrity, file);\n });\n });\n });\n return importMap;\n }\n\n function warnUncoveredEntrypoint(\n remoteName: string,\n externalName: string,\n packageName: string\n ): void {\n const msg = `[${remoteName}][${externalName}] Entrypoint '${packageName}' is not covered by the override.`;\n if (config.strict.strictImportMap) {\n log.error(9, msg);\n throw new NFError('Could not create ImportMap.');\n }\n log.warn(9, msg);\n }\n\n function addIntegrity(\n importMap: ImportMap,\n url: string,\n integrityMap: Record<string, string> | undefined,\n file: string\n ): void {\n const hash = integrityMap?.[file];\n if (!hash) return;\n if (!importMap.integrity) importMap.integrity = {};\n importMap.integrity[url] = hash;\n }\n}\n", "import type { FLOW_FACTORY } from 'lib/core/2.app/driver-ports/flow-factory.contract';\nimport type { InitDriversContract } from 'lib/core/2.app/driver-ports/init/drivers.contract';\nimport { createGetRemoteEntries } from '../2.app/steps/get-remote-entries';\nimport { createProcessRemoteEntries } from '../2.app/steps/process-remote-entries';\nimport { createDetermineSharedExternals } from '../2.app/steps/determine-shared-externals';\nimport { createPoolSharedExternals } from '../2.app/steps/pooling/pool-shared-externals';\nimport { createGenerateImportMap } from '../2.app/steps/generate-import-map';\nimport { createCommitChanges } from '../2.app/steps/commit-changes';\nimport { createExposeModuleLoader } from '../2.app/steps/expose-module-loader';\nimport { createGetRemoteEntry } from '../2.app/steps/get-remote-entry';\nimport { createUpdateCache } from '../2.app/steps/update-cache';\nimport { createPoolDynamicExternals } from '../2.app/steps/pooling/pool-dynamic-externals';\nimport { createConvertToImportMap } from '../2.app/steps/convert-to-import-map';\nimport type { DrivingContract } from '../2.app/driving-ports/driving.contract';\nimport type { ConfigContract } from '../2.app/config/config.contract';\n\nexport const createInitDrivers = ({\n config,\n adapters,\n}: {\n config: ConfigContract;\n adapters: DrivingContract;\n}): InitDriversContract => ({\n getRemoteEntries: createGetRemoteEntries(config, adapters),\n processRemoteEntries: createProcessRemoteEntries(config, adapters),\n determineSharedExternals: createDetermineSharedExternals(config, adapters),\n poolSharedExternals: createPoolSharedExternals(config, adapters),\n generateImportMap: createGenerateImportMap(config, adapters),\n commitChanges: createCommitChanges(config, adapters),\n exposeModuleLoader: createExposeModuleLoader(config, adapters),\n getRemoteEntry: createGetRemoteEntry(config, adapters),\n updateCache: createUpdateCache(config, adapters),\n poolDynamicExternals: createPoolDynamicExternals(config),\n convertToImportMap: createConvertToImportMap(config, adapters),\n});\n\nexport const INIT_FLOW_FACTORY = ({\n config,\n adapters,\n}: {\n config: ConfigContract;\n adapters: DrivingContract;\n}): FLOW_FACTORY<InitDriversContract> => {\n const flow = createInitDrivers({ config, adapters });\n\n return {\n flow,\n adapters,\n config,\n };\n};\n", "import type { ForBrowserTasks } from 'lib/core/2.app/driving-ports/for-browser-tasks';\nimport type { ImportMapConfig } from 'lib/core/2.app/config/import-map.contract';\n\nconst createBrowser = (config: ImportMapConfig): ForBrowserTasks => {\n return {\n setImportMapFn: config.setImportMapFn,\n importModule: config.loadModuleFn,\n };\n};\n\nexport { createBrowser };\n", "import type { ForVersionChecking } from 'lib/core/2.app/driving-ports/for-version-checking.port';\nimport semverValid from 'semver/functions/valid';\nimport semverSatisfies from 'semver/functions/satisfies';\nimport semverCompare from 'semver/functions/compare';\nimport semverMinVersion from 'semver/ranges/min-version';\nimport semverValidRange from 'semver/ranges/valid';\n\nconst createVersionCheck = (): ForVersionChecking => {\n return {\n isValidSemver: function (version: string) {\n return semverValid(version) !== null;\n },\n isCompatible: function (version: string, range: string) {\n return semverSatisfies(version, range);\n },\n compare: function (versionA: string, versionB: string) {\n return semverCompare(versionA, versionB, true);\n },\n smallestVersion: function (versionRange: string) {\n if (!semverValidRange(versionRange)) return '0.0.0';\n const minVersion = semverMinVersion(versionRange);\n return minVersion?.raw ?? '0.0.0';\n },\n };\n};\n\nexport { createVersionCheck };\n", "const SUPPORTED_ALGORITHMS = {\n 'sha256-': 'SHA-256',\n 'sha384-': 'SHA-384',\n 'sha512-': 'SHA-512',\n} as const;\n\ntype Prefix = keyof typeof SUPPORTED_ALGORITHMS;\n\nconst parseIntegrity = (integrity: string): { algorithm: string; expected: string } | null => {\n for (const prefix of Object.keys(SUPPORTED_ALGORITHMS) as Prefix[]) {\n if (integrity.startsWith(prefix)) {\n return { algorithm: SUPPORTED_ALGORITHMS[prefix], expected: integrity };\n }\n }\n return null;\n};\n\nconst toBase64 = (bytes: ArrayBuffer): string => {\n const view = new Uint8Array(bytes);\n let bin = '';\n for (let i = 0; i < view.length; i++) bin += String.fromCharCode(view[i]!);\n return btoa(bin);\n};\n\nexport const verifyIntegrity = async (bytes: ArrayBuffer, integrity: string): Promise<void> => {\n const parsed = parseIntegrity(integrity);\n if (!parsed) {\n throw new TypeError(\n `Unsupported integrity prefix in '${integrity}'. Expected sha256-, sha384-, or sha512-.`\n );\n }\n\n const subtle =\n typeof crypto !== 'undefined' && crypto.subtle ? crypto.subtle : undefined;\n if (!subtle) {\n throw new Error('SubtleCrypto is not available in this environment.');\n }\n\n const digest = await subtle.digest(parsed.algorithm, bytes);\n const actual =\n integrity.substring(0, integrity.indexOf('-') + 1) + toBase64(digest);\n\n if (actual !== parsed.expected) {\n throw new Error(`Integrity mismatch: expected ${parsed.expected}, got ${actual}`);\n }\n};\n", "import type { FederationManifest } from 'lib/core/1.domain';\nimport type { ForProvidingManifest } from 'lib/core/2.app/driving-ports/for-providing-manifest.port';\nimport { NFError } from 'lib/core/native-federation.error';\nimport { verifyIntegrity } from 'lib/utils/integrity';\n\nconst createManifestProvider = (): ForProvidingManifest => {\n const ensureOk = (response: Response) => {\n if (!response.ok)\n return Promise.reject(new NFError(`${response.status} - ${response.statusText}`));\n return response;\n };\n\n const formatError = (manifestUrl: string) => (err: unknown) => {\n const msg = err instanceof Error ? err.message : String(err);\n throw new NFError(`Fetch of '${manifestUrl}' returned ${msg}`);\n };\n\n return {\n provide: async function (\n remotesOrManifestUrl: string | FederationManifest,\n opts: { integrity?: string } = {}\n ) {\n if (typeof remotesOrManifestUrl !== 'string') return Promise.resolve(remotesOrManifestUrl);\n\n const parse = async (response: Response): Promise<FederationManifest> => {\n if (!opts.integrity) return response.json() as Promise<FederationManifest>;\n const bytes = await response.arrayBuffer();\n await verifyIntegrity(bytes, opts.integrity);\n return JSON.parse(new TextDecoder().decode(bytes)) as FederationManifest;\n };\n\n return fetch(remotesOrManifestUrl)\n .then(ensureOk)\n .then(parse)\n .catch(formatError(remotesOrManifestUrl));\n },\n };\n};\n\nexport { createManifestProvider };\n", "import { toPosix } from \"./path-patterns.js\";\nfunction normalize(path, trailingSlash) {\n let cand = toPosix(path);\n if (typeof trailingSlash === \"undefined\") {\n return cand;\n }\n while (cand.endsWith(\"/\")) {\n cand = cand.substring(0, cand.length - 1);\n }\n if (trailingSlash) {\n return cand + \"/\";\n }\n return cand;\n}\nfunction normalizePackageName(fileName) {\n const sanitized = fileName.replace(/[^A-Za-z0-9]/g, \"_\");\n return sanitized.startsWith(\"_\") ? sanitized.slice(1) : sanitized;\n}\nfunction inferPackageFromSecondary(secondary) {\n const parts = secondary.split(\"/\");\n if (secondary.startsWith(\"@\") && parts.length >= 2) {\n return parts[0] + \"/\" + parts[1];\n }\n return parts[0];\n}\nexport {\n inferPackageFromSecondary,\n normalize,\n normalizePackageName\n};\n", "import { CHUNK_PREFIX } from \"../../domain/core/chunk.js\";\nimport { inferPackageFromSecondary } from \"../../utils/normalize.js\";\nfunction isDense(entry) {\n return \"entries\" in entry;\n}\nfunction isFlatChunk(entry) {\n return entry.packageName.startsWith(CHUNK_PREFIX);\n}\nfunction densifyExternals(shared) {\n const result = [];\n const groupIndex = /* @__PURE__ */ new Map();\n for (const entry of shared) {\n if (isDense(entry)) {\n result.push(entry);\n continue;\n }\n if (isFlatChunk(entry)) {\n const { outFileName, ...rest } = entry;\n result.push({ ...rest, entries: { [entry.packageName]: outFileName } });\n continue;\n }\n const parent = inferPackageFromSecondary(entry.packageName);\n const sig = JSON.stringify({\n singleton: entry.singleton,\n strictVersion: entry.strictVersion,\n requiredVersion: entry.requiredVersion,\n version: entry.version,\n shareScope: entry.shareScope\n });\n const key = parent + \" \" + sig;\n const existing = groupIndex.get(key);\n if (existing === void 0) {\n const dense = {\n singleton: entry.singleton,\n strictVersion: entry.strictVersion,\n requiredVersion: entry.requiredVersion,\n packageName: parent,\n entries: { [entry.packageName]: entry.outFileName }\n };\n if (entry.version !== void 0) dense.version = entry.version;\n if (entry.shareScope !== void 0) dense.shareScope = entry.shareScope;\n if (entry.bundle !== void 0) dense.bundle = entry.bundle;\n if (entry.pool !== void 0) dense.pool = entry.pool;\n if (entry.dev !== void 0) dense.dev = entry.dev;\n groupIndex.set(key, result.length);\n result.push(dense);\n } else {\n result[existing].entries[entry.packageName] = entry.outFileName;\n }\n }\n return result;\n}\nfunction toDenseSharedInfoFormat(shared) {\n return shared.map((external) => {\n if (\"entries\" in external) return external;\n const { outFileName, ...baseSharedInfoProps } = external;\n return {\n ...baseSharedInfoProps,\n entries: { [external.packageName]: outFileName }\n };\n });\n}\nexport {\n densifyExternals,\n toDenseSharedInfoFormat\n};\n", "import {\n type RawRemoteEntry,\n type RemoteEntry,\n} from 'lib/core/1.domain/remote-entry/remote-entry.contract';\nimport type { ForProvidingRemoteEntries } from 'lib/core/2.app/driving-ports/for-providing-remote-entries.port';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport { verifyIntegrity } from 'lib/utils/integrity';\nimport {\n densifyExternals,\n toDenseSharedInfoFormat,\n} from '@softarc/native-federation/internal/browser';\n\nconst createRemoteEntryProvider = (config: ModeConfig): ForProvidingRemoteEntries => {\n const ensureOk = (response: Response) => {\n if (!response.ok)\n return Promise.reject(new Error(`${response.status} - ${response.statusText}`));\n return response;\n };\n\n const fillEmptyFields = (remoteEntryUrl: string) => (remoteEntry: RemoteEntry) => {\n if (!remoteEntry.exposes) remoteEntry.exposes = [];\n if (!remoteEntry.shared) remoteEntry.shared = [];\n if (!remoteEntry.url) remoteEntry.url = remoteEntryUrl;\n return remoteEntry;\n };\n\n const normalizeRemoteEntry = (raw: RawRemoteEntry): RemoteEntry => {\n const shared = config.feature.convertFlatSharedInfo\n ? densifyExternals(raw.shared ?? [])\n : toDenseSharedInfoFormat(raw.shared ?? []);\n return { ...raw, shared } as RemoteEntry;\n };\n\n const formatError = (remoteEntryUrl: string) => (err: unknown) => {\n const msg = err instanceof Error ? err.message : String(err);\n throw new NFError(`Fetch of '${remoteEntryUrl}' returned ${msg}`);\n };\n\n return {\n provide: async function (remoteEntryUrl: string, opts: { integrity?: string } = {}) {\n const parse = async (response: Response): Promise<RawRemoteEntry> => {\n if (!opts.integrity) return response.json() as Promise<RawRemoteEntry>;\n const bytes = await response.arrayBuffer();\n await verifyIntegrity(bytes, opts.integrity);\n return JSON.parse(new TextDecoder().decode(bytes)) as RawRemoteEntry;\n };\n\n return fetch(remoteEntryUrl)\n .then(ensureOk)\n .then(parse)\n .then(normalizeRemoteEntry)\n .then(fillEmptyFields(remoteEntryUrl))\n .catch(formatError(remoteEntryUrl));\n },\n };\n};\n\nexport { createRemoteEntryProvider };\n", "import type { RemoteInfo, RemoteName, Remotes } from 'lib/core/1.domain';\nimport type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForRemoteInfoStorage } from 'lib/core/2.app/driving-ports/for-remote-info-storage.port';\nimport * as _path from 'lib/utils/path';\nimport { Optional } from 'lib/utils/optional';\n\nconst createRemoteInfoRepository = (config: StorageConfig): ForRemoteInfoStorage => {\n const STORAGE: StorageEntry<Remotes> = config.storage('remotes', {});\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: Remotes = STORAGE.get() ?? {};\n\n return {\n contains: function (remoteName: RemoteName) {\n return !!_cache[remoteName];\n },\n remove: function (remoteName: RemoteName) {\n delete _cache[remoteName];\n return this;\n },\n addOrUpdate: function (remoteName: string, remote: RemoteInfo) {\n _cache[remoteName] = remote;\n return this;\n },\n tryGet: function (remoteName: RemoteName) {\n return Optional.of(_cache[remoteName]);\n },\n tryGetModule: function (remoteName: RemoteName, exposedModule: string) {\n return Optional.of(_cache[remoteName]?.exposes.find(m => m.moduleName === exposedModule)).map(\n m => _path.join(_cache[remoteName]!.scopeUrl, m.file)\n );\n },\n getAll: function () {\n return _cache;\n },\n commit: function () {\n STORAGE.set(_cache);\n return this;\n },\n };\n};\n\nexport { createRemoteInfoRepository };\n", "import type { ScopedExternals } from 'lib/core/1.domain/externals/external.contract';\nimport type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForScopedExternalsStorage } from 'lib/core/2.app/driving-ports/for-scoped-externals-storage.port';\nimport type { RemoteName, ScopedVersion } from 'lib/core/1.domain';\nimport { Optional } from 'lib/utils/optional';\n\nconst createScopedExternalsRepository = (config: StorageConfig): ForScopedExternalsStorage => {\n const STORAGE: StorageEntry<ScopedExternals> = config.storage('scoped-externals', {});\n\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: ScopedExternals = STORAGE.get() ?? {};\n\n return {\n addExternal: function (remoteName: RemoteName, external: string, version: ScopedVersion) {\n if (!_cache[remoteName]) _cache[remoteName] = {};\n _cache[remoteName][external] = version;\n return this;\n },\n remove: function (remoteName: RemoteName) {\n delete _cache[remoteName];\n return this;\n },\n getAll: function () {\n return _cache;\n },\n tryGet: function (remoteName: string) {\n return Optional.of(_cache[remoteName]);\n },\n commit: function () {\n STORAGE.set(_cache);\n return this;\n },\n };\n};\n\nexport { createScopedExternalsRepository };\n", "import {\n type SharedExternal,\n type SharedExternals,\n GLOBAL_SCOPE,\n STRICT_SCOPE,\n} from 'lib/core/1.domain/externals/external.contract';\nimport type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForSharedExternalsStorage } from 'lib/core/2.app/driving-ports/for-shared-externals-storage.port';\nimport { Optional } from 'lib/utils/optional';\n\nconst createSharedExternalsRepository = (config: StorageConfig): ForSharedExternalsStorage => {\n const STORAGE: StorageEntry<SharedExternals> = config.storage<SharedExternals>(\n 'shared-externals',\n { [GLOBAL_SCOPE]: {} }\n );\n\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: SharedExternals = STORAGE.get()!;\n\n // Not persisted: re-derived from the freshly processed entries on every init, before pooling runs.\n let _sawPoolTag = false;\n\n return {\n markPoolTagPresent: function () {\n _sawPoolTag = true;\n },\n hasPoolTag: function () {\n return _sawPoolTag;\n },\n getFromScope: function (shareScope?: string) {\n return { ..._cache[shareScope ?? GLOBAL_SCOPE] };\n },\n addOrUpdate: function (externalName: string, external: SharedExternal, shareScope?: string) {\n if (!_cache[shareScope ?? GLOBAL_SCOPE]) _cache[shareScope ?? GLOBAL_SCOPE] = {};\n _cache[shareScope ?? GLOBAL_SCOPE]![externalName] = external;\n return this;\n },\n getScopes: function (o = { includeGlobal: true }) {\n if (o.includeGlobal) return Object.keys(_cache);\n return Object.keys(_cache).filter(s => s !== GLOBAL_SCOPE);\n },\n removeFromAllScopes: function (remoteName: string) {\n Object.values(_cache).forEach(scope => {\n const removeExternals: string[] = [];\n\n Object.entries(scope).forEach(([name, external]) => {\n const removeVersionIdx: number[] = [];\n external.versions.forEach((version, i) => {\n const versionRemoteIDX = version.remotes.findIndex(r => r.name === remoteName);\n if (~versionRemoteIDX) {\n version.remotes.splice(versionRemoteIDX, 1);\n }\n\n if (version.remotes.length === 0) removeVersionIdx.push(i);\n });\n\n if (removeVersionIdx.length > 0) {\n for (let i = removeVersionIdx.length - 1; i >= 0; i--) {\n external.versions.splice(removeVersionIdx[i]!, 1);\n }\n external.dirty = true;\n\n if (external.versions.length === 0) removeExternals.push(name);\n }\n });\n removeExternals.forEach(name => delete scope[name]);\n });\n },\n scopeType: function (shareScope?: string) {\n switch (shareScope) {\n case GLOBAL_SCOPE:\n case null:\n case undefined:\n return 'global';\n case STRICT_SCOPE:\n return 'strict';\n default:\n return 'shareScope';\n }\n },\n tryGet: function (external: string, shareScope?: string) {\n return Optional.of(_cache[shareScope ?? GLOBAL_SCOPE]?.[external]);\n },\n commit: function () {\n STORAGE.set(_cache);\n return this;\n },\n };\n};\n\nexport { createSharedExternalsRepository };\n", "import { BuildNotificationType } from '@softarc/native-federation/domain';\nimport type { ImportMapConfig } from 'lib/core/2.app/config/import-map.contract';\nimport type { ForSSE } from 'lib/core/2.app/driving-ports/for-sse.port';\nimport type { LoggingConfig } from 'lib/core/2.app/config/log.contract';\n\n/**\n * Watches for federation build completion events and automatically reloads the page.\n *\n * This function establishes a Server-Sent Events (SSE) connection to listen for\n * 'federation-rebuild-complete' notifications. When a build completes successfully,\n * it triggers a page reload to reflect the latest changes.\n * @param endpoint - The SSE endpoint URL to watch for build notifications.\n */\nconst createSSEHandler = (config: ImportMapConfig & LoggingConfig): ForSSE => {\n const subscribers: EventSource[] = [];\n\n return {\n watchRemoteBuilds: function (endpoint: string) {\n const eventSource = new EventSource(endpoint);\n\n eventSource.onmessage = function (event) {\n const data = JSON.parse(event.data);\n if (data.type === BuildNotificationType.COMPLETED) {\n subscribers.forEach(sub => sub.close());\n config.log.debug(0, '[SSE] Rebuild completed, reloading...');\n config.reloadBrowserFn();\n }\n };\n\n eventSource.onerror = function (event) {\n config.log.error(0, '[SSE] Connection error:', event);\n };\n subscribers.push(eventSource);\n },\n\n closeAll: function () {\n subscribers.forEach(sub => sub.close());\n subscribers.length = 0;\n },\n };\n};\n\nexport { createSSEHandler };\n", "import type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForSharedChunksStorage } from 'lib/core/2.app/driving-ports/for-shared-chunks-storage.port';\nimport type { SharedChunks } from 'lib/core/1.domain/externals/chunks.contract';\nimport { Optional } from 'lib/utils/optional';\n\nconst createChunkRepository = (config: StorageConfig): ForSharedChunksStorage => {\n const STORAGE: StorageEntry<SharedChunks> = config.storage('shared-chunks', {});\n\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: SharedChunks = STORAGE.get() ?? {};\n\n return {\n addOrReplace: function (remoteName: string, bundleName: string, chunks: string[]) {\n if (!_cache[remoteName]) _cache[remoteName] = {};\n _cache[remoteName][bundleName] = chunks;\n return this;\n },\n tryGet: function (remoteName: string, bundleName: string) {\n return Optional.of(_cache[remoteName]?.[bundleName]);\n },\n commit: function () {\n STORAGE.set(_cache);\n return this;\n },\n };\n};\n\nexport { createChunkRepository };\n", "import type { DrivingContract } from 'lib/core/2.app/driving-ports/driving.contract';\nimport type { ConfigContract } from 'lib/core/2.app/config/config.contract';\nimport { createBrowser } from 'lib/core/3.adapters/browser/browser';\nimport { createVersionCheck } from 'lib/core/3.adapters/checks/version.check';\nimport { createManifestProvider } from 'lib/core/3.adapters/http/manifest-provider';\nimport { createRemoteEntryProvider } from 'lib/core/3.adapters/http/remote-entry-provider';\nimport { createRemoteInfoRepository } from 'lib/core/3.adapters/storage/remote-info.repository';\nimport { createScopedExternalsRepository } from 'lib/core/3.adapters/storage/scoped-externals.repository';\nimport { createSharedExternalsRepository } from 'lib/core/3.adapters/storage/shared-externals.repository';\nimport { createSSEHandler } from 'lib/core/3.adapters/browser/sse-handler';\nimport { createChunkRepository } from 'lib/core/3.adapters/storage/chunk.repository';\n\nexport const createDriving = (\n config: ConfigContract\n): { adapters: DrivingContract; config: ConfigContract } => {\n const adapters = {\n versionCheck: createVersionCheck(),\n\n manifestProvider: createManifestProvider(),\n\n remoteEntryProvider: createRemoteEntryProvider(config),\n\n remoteInfoRepo: createRemoteInfoRepository(config),\n scopedExternalsRepo: createScopedExternalsRepository(config),\n sharedExternalsRepo: createSharedExternalsRepository(config),\n sharedChunksRepo: createChunkRepository(config),\n\n browser: createBrowser(config),\n sse: createSSEHandler(config),\n };\n return { adapters, config };\n};\n", "type TTCreateScript = (input: string) => string;\ntype TTCreateScriptURL = (input: string) => string;\n\ntype TTPolicyRules = {\n createScript?: TTCreateScript;\n createScriptURL?: TTCreateScriptURL;\n};\n\ntype TrustedValue = { toString(): string };\n\ntype TTPolicy = {\n createScript: (input: string) => TrustedValue;\n createScriptURL: (input: string) => TrustedValue;\n};\n\ntype TTFactory = {\n createPolicy: (name: string, rules: TTPolicyRules) => TTPolicy;\n};\n\nexport type NFTrustedTypesPolicy = {\n // `script.text` is a TrustedScript sink, so this must stay the genuine object.\n createScript: (input: string) => TrustedValue;\n createScriptURL: (input: string) => string;\n};\n\nconst IMPORT_MAP_KEYS = new Set(['imports', 'scopes', 'integrity']);\n\nconst validateImportMapJSON = (input: string): string => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(input);\n } catch {\n throw new TypeError('[nf-orchestrator] trusted-types: import map is not valid JSON');\n }\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new TypeError('[nf-orchestrator] trusted-types: import map must be a plain object');\n }\n for (const key of Object.keys(parsed as Record<string, unknown>)) {\n if (!IMPORT_MAP_KEYS.has(key)) {\n throw new TypeError(`[nf-orchestrator] trusted-types: unexpected key \"${key}\" in import map`);\n }\n }\n return input;\n};\n\nconst validateScriptURL = (input: string): string => {\n const base = typeof location !== 'undefined' ? location.href : 'http://localhost/';\n let url: URL;\n try {\n url = new URL(input, base);\n } catch {\n throw new TypeError(`[nf-orchestrator] trusted-types: invalid script URL \"${input}\"`);\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') {\n throw new TypeError(\n `[nf-orchestrator] trusted-types: disallowed protocol \"${url.protocol}\" for script URL`\n );\n }\n return input;\n};\n\nconst passThroughPolicy: NFTrustedTypesPolicy = {\n createScript: input => input,\n createScriptURL: input => input,\n};\n\nlet cachedPolicy: NFTrustedTypesPolicy | null = null;\n\nexport const getTrustedTypesPolicy = (\n name: string | false = 'nfo'\n): NFTrustedTypesPolicy => {\n if (name === false) return passThroughPolicy;\n if (cachedPolicy) return cachedPolicy;\n\n const factory = (globalThis as { trustedTypes?: TTFactory }).trustedTypes;\n if (!factory) {\n cachedPolicy = passThroughPolicy;\n return cachedPolicy;\n }\n\n const native = factory.createPolicy(name, {\n createScript: validateImportMapJSON,\n createScriptURL: validateScriptURL,\n });\n\n cachedPolicy = {\n createScript: input => native.createScript(input),\n createScriptURL: input => String(native.createScriptURL(input)),\n };\n return cachedPolicy;\n};\n\nexport const __resetTrustedTypesPolicyForTests = (): void => {\n cachedPolicy = null;\n};\n", "import type { ImportMap } from 'lib/core/1.domain';\nimport type { SetImportMap } from 'lib/core/2.app/config/import-map.contract';\nimport { getTrustedTypesPolicy } from './trusted-types';\n\nexport const replaceInDOM =\n (mapType: string, trustedTypesPolicyName: string | false = 'nfo'): SetImportMap =>\n (importMap: ImportMap, opts = {}) => {\n if (opts?.override) {\n document.head\n .querySelectorAll(`script[type=\"${mapType}\"]`)\n .forEach(importMap => importMap.remove());\n }\n\n const policy = getTrustedTypesPolicy(trustedTypesPolicyName);\n document.head.appendChild(\n Object.assign(document.createElement('script'), {\n type: mapType,\n text: policy.createScript(JSON.stringify(importMap)),\n })\n );\n return Promise.resolve(importMap);\n };\n", "import type { ImportMapConfig } from 'lib/core/2.app/config/import-map.contract';\nimport { replaceInDOM } from './replace-in-dom';\nimport { getTrustedTypesPolicy } from './trusted-types';\n\nconst useDefaultImportMap = (trustedTypesPolicyName: string | false = 'nfo'): ImportMapConfig => ({\n loadModuleFn: url => {\n const trusted = getTrustedTypesPolicy(trustedTypesPolicyName).createScriptURL(url);\n return import(/* @vite-ignore */ trusted);\n },\n setImportMapFn: replaceInDOM('importmap', trustedTypesPolicyName),\n reloadBrowserFn: () => {\n window.location.reload();\n },\n});\n\nexport { useDefaultImportMap };\n", "import type {\n ImportMapConfig,\n ImportMapOptions,\n} from 'lib/core/2.app/config/import-map.contract';\nimport { useDefaultImportMap } from './use-default';\n\nexport const createImportMapConfig = (o: Partial<ImportMapOptions>): ImportMapConfig => {\n const fallback = useDefaultImportMap(o.trustedTypesPolicyName);\n return {\n setImportMapFn: o.setImportMapFn ?? fallback.setImportMapFn,\n loadModuleFn: o.loadModuleFn ?? fallback.loadModuleFn,\n reloadBrowserFn: o.reloadBrowserFn ?? fallback.reloadBrowserFn,\n };\n};\n", "import type { HostConfig, HostOptions } from 'lib/core/2.app/config/host.contract';\n\nexport const createHostConfig = (override: Partial<HostOptions>): HostConfig => {\n const extras = override?.manifestIntegrity\n ? { manifestIntegrity: override.manifestIntegrity }\n : {};\n\n if (!override?.hostRemoteEntry) {\n return { hostRemoteEntry: false, ...extras };\n }\n if (typeof override.hostRemoteEntry === 'string') {\n return {\n hostRemoteEntry: {\n name: '__NF-HOST__',\n url: override.hostRemoteEntry,\n },\n ...extras,\n };\n }\n return {\n hostRemoteEntry: {\n name: '__NF-HOST__',\n ...override.hostRemoteEntry,\n },\n ...extras,\n };\n};\n", "import type { Logger } from 'lib/core/2.app/config/log.contract';\n\nconst noopLogger: Logger = {\n debug: () => {},\n error: () => {},\n warn: () => {},\n};\n\nexport { noopLogger };\n", "export const LogLevel = {\n debug: 0,\n warn: 1,\n error: 2,\n};\n\nexport type LogType = keyof typeof LogLevel;\n\nexport type Logger = {\n error: (step: number, msg: string, details?: unknown) => void;\n warn: (step: number, msg: string, details?: unknown) => void;\n debug: (step: number, msg: string, details?: unknown) => void;\n};\n\nexport type LogHandler = Logger & {\n level: LogType;\n};\n\nexport type LoggingConfig = {\n log: LogHandler;\n sse: boolean;\n};\n\nexport type LoggingOptions = {\n logger?: Logger;\n logLevel?: LogType;\n sse?: boolean;\n};\n", "import {\n type LogType,\n type LogHandler,\n type Logger,\n LogLevel,\n} from 'lib/core/2.app/config/log.contract';\n\nconst createLogHandler = (logger: Logger, logLevel: LogType): LogHandler => {\n const logTypes = Object.keys(LogLevel).filter(key => isNaN(Number(key))) as LogType[];\n\n return logTypes.reduce(\n (acc, logMessageType) => {\n return {\n ...acc,\n [logMessageType]: (step: number, message: string, details: unknown) => {\n if (LogLevel[logMessageType] >= LogLevel[logLevel]) {\n logger[logMessageType](step, message, details);\n }\n },\n };\n },\n { level: logLevel } as LogHandler\n );\n};\n\nexport { createLogHandler };\n", "import type { LoggingConfig, LoggingOptions } from 'lib/core/2.app/config/log.contract';\nimport { noopLogger } from './noop.logger';\nimport { createLogHandler } from './log.handler';\n\nexport const createLogConfig = ({ logger, logLevel, sse }: LoggingOptions): LoggingConfig => ({\n log: createLogHandler(logger ?? noopLogger, logLevel ?? 'error'),\n sse: !!sse,\n});\n", "import type { StorageEntryKey } from 'lib/core/2.app/config/storage.contract';\nimport { NFError } from 'lib/core/native-federation.error';\n\ntype CloneEntry = <T>(name: StorageEntryKey, raw: T) => T;\n\nconst cloneEntry: CloneEntry = <T>(name: StorageEntryKey, raw: T) => {\n try {\n if (typeof structuredClone === 'function') {\n return structuredClone(raw);\n }\n } catch {\n /* structured clone is unavailable */\n }\n try {\n return JSON.parse(JSON.stringify(raw));\n } catch {\n /* object is not stringifyable */\n }\n throw new NFError(`Could not clone entry '${String(name)}'`);\n};\n\nexport { CloneEntry, cloneEntry };\n", "import { cloneEntry } from 'lib/utils/clone-entry';\nimport {\n type StorageEntryCreator,\n type StorageEntry,\n} from 'lib/core/2.app/config/storage.contract';\n\nconst globalThisStorageEntry: StorageEntryCreator =\n (namespace: string) =>\n <TValue>(key: string, initialValue: TValue) => {\n if (!(globalThis as unknown as { [namespace]: unknown })[namespace]) {\n (globalThis as unknown as { [namespace]: unknown })[namespace] = {};\n }\n\n const storage = (globalThis as unknown as { [namespace]: { [P in typeof key]: TValue } })[\n namespace\n ]!;\n if (!storage[key]) storage[key] = initialValue;\n\n const entry: StorageEntry<TValue> = {\n get(): TValue {\n return cloneEntry(key, storage[key])!;\n },\n set(value: TValue): StorageEntry<TValue> {\n storage[key] = cloneEntry(key, value);\n return entry;\n },\n clear(): StorageEntry<TValue> {\n storage[key] = cloneEntry(key, initialValue);\n return this;\n },\n };\n\n return entry;\n };\n\nexport { globalThisStorageEntry };\n", "import type { StorageConfig, StorageOptions } from 'lib/core/2.app/config/storage.contract';\nimport { globalThisStorageEntry } from './global-this.storage';\n\nexport const createStorageConfig = (override: StorageOptions): StorageConfig => ({\n storage: override.storage\n ? override.storage(override.storageNamespace ?? '__NATIVE_FEDERATION__')\n : globalThisStorageEntry(override.storageNamespace ?? '__NATIVE_FEDERATION__'),\n clearStorage: override.clearStorage ?? false,\n});\n", "import type { ModeProfileConfig } from 'lib/core/2.app/config/mode.contract';\n\nexport const defaultProfile: ModeProfileConfig = {\n latestSharedExternal: false,\n skipInvalidExternalVersions: false,\n overrideCachedRemotes: 'init-only',\n overrideCachedRemotesIfURLMatches: false,\n};\n", "import type { ModeConfig, ModeOptions } from 'lib/core/2.app/config/mode.contract';\nimport { defaultProfile } from './default.profile';\n\nexport const createModeConfig = (override: ModeOptions): ModeConfig => {\n const strictnessConfig =\n typeof override.strict === 'boolean'\n ? {\n strictRemoteEntry: override.strict,\n strictExternalCompatibility: override.strict,\n strictExternalSameVersionCompatibility: override.strict,\n strictExternalVersion: override.strict,\n strictImportMap: override.strict,\n strictEntryPointCoverage: override.strict,\n }\n : {\n strictRemoteEntry: override.strict?.strictRemoteEntry ?? false,\n strictExternalCompatibility: override.strict?.strictExternalCompatibility ?? false,\n strictExternalSameVersionCompatibility:\n override.strict?.strictExternalSameVersionCompatibility ?? false,\n strictExternalVersion: override.strict?.strictExternalVersion ?? false,\n strictImportMap: override.strict?.strictImportMap ?? false,\n strictEntryPointCoverage: override.strict?.strictEntryPointCoverage ?? false,\n };\n\n return {\n strict: strictnessConfig,\n profile: { ...defaultProfile, ...(override.profile ?? {}) },\n feature: {\n convertFlatSharedInfo: override.feature?.convertFlatSharedInfo ?? false,\n useAutoExternalPooling: override.feature?.useAutoExternalPooling ?? false,\n },\n };\n};\n", "import type { ConfigContract, NFOptions } from 'lib/core/2.app/config/config.contract';\nimport { createImportMapConfig } from 'lib/core/4.config/import-map/import-map.config';\nimport { createHostConfig } from 'lib/core/4.config/host/host.config';\nimport { createLogConfig } from 'lib/core/4.config/logging/log.config';\nimport { createStorageConfig } from 'lib/core/4.config/storage/storage.config';\nimport { createModeConfig } from 'lib/core/4.config/mode/mode.config';\n\nexport const createConfigHandlers = (overrides: NFOptions): ConfigContract => ({\n ...createImportMapConfig(overrides),\n ...createHostConfig(overrides),\n ...createLogConfig(overrides),\n ...createStorageConfig(overrides),\n ...createModeConfig(overrides),\n});\n", "import type { ConfigContract } from '../2.app/config/config.contract';\nimport type { DrivingContract } from '../2.app/driving-ports/driving.contract';\nimport type { InitRemoteEntryFlow, RemoteRef } from '../2.app/driver-ports/init/flow.contract';\nimport type {\n LoadRemoteModule,\n LoadRemoteModuleOf,\n NativeFederationResult,\n} from '../init-federation.contract';\n\nexport const createStateDump =\n (config: ConfigContract, adapters: DrivingContract) =>\n (msg: string): void =>\n config.log.debug(0, msg, {\n remotes: { ...adapters.remoteInfoRepo.getAll() },\n 'shared-externals': adapters.sharedExternalsRepo\n .getScopes({ includeGlobal: true })\n .reduce(\n (acc, scope) => ({ ...acc, [scope]: adapters.sharedExternalsRepo.getFromScope(scope) }),\n {}\n ),\n 'scoped-externals': adapters.scopedExternalsRepo.getAll(),\n });\n\nexport const createFederationResult = ({\n config,\n adapters,\n loadRemoteModule,\n initRemoteEntryFlow,\n afterInitRemoteEntry,\n}: {\n config: ConfigContract;\n adapters: DrivingContract;\n loadRemoteModule: LoadRemoteModule;\n initRemoteEntryFlow: InitRemoteEntryFlow;\n afterInitRemoteEntry?: () => Promise<unknown>;\n}): NativeFederationResult => {\n const stateDump = createStateDump(config, adapters);\n\n const initRemoteEntry = async (\n remoteEntryUrl: string,\n remote?: RemoteRef\n ): Promise<NativeFederationResult> => {\n const remoteName = typeof remote === 'string' ? remote : remote?.name;\n return initRemoteEntryFlow(remoteEntryUrl, remote)\n .catch(e => {\n stateDump(`[dynamic-init][${remoteName ?? remoteEntryUrl}] STATE DUMP`);\n if (config.strict.strictRemoteEntry) return Promise.reject(e);\n else console.warn('Failed to initialize remote entry, continuing anyway.');\n return Promise.resolve();\n })\n .then(() => afterInitRemoteEntry?.())\n .then(() => result);\n };\n\n const result: NativeFederationResult = {\n config,\n adapters,\n loadRemoteModule,\n load: loadRemoteModule,\n as: <TModule = unknown>() => ({\n loadRemoteModule: loadRemoteModule as LoadRemoteModuleOf<TModule>,\n load: loadRemoteModule as LoadRemoteModuleOf<TModule>,\n }),\n initRemoteEntry,\n };\n\n return result;\n};\n", "import type { NativeFederationResult } from './init-federation.contract';\nimport type { NFOptions } from './2.app/config/config.contract';\nimport type { FederationManifest } from './1.domain';\nimport { createInitFlow } from './2.app/flows/init.flow';\nimport { createInitRemoteEntryFlow } from './2.app/flows/init-remote-entry.flow';\nimport { INIT_FLOW_FACTORY } from './5.di/init.factory';\nimport { createDriving } from './5.di/driving.factory';\nimport { createConfigHandlers } from './5.di/config.factory';\nimport { createFederationResult, createStateDump } from './5.di/federation-result.factory';\n\nconst initFederation = (\n remotesOrManifestUrl: string | FederationManifest,\n options: NFOptions = {}\n): Promise<NativeFederationResult> => {\n const { adapters, config } = createDriving(createConfigHandlers(options));\n\n const factory = INIT_FLOW_FACTORY({ adapters, config });\n const initFlow = createInitFlow(factory);\n const initRemoteEntryFlow = createInitRemoteEntryFlow(factory);\n\n return initFlow(remotesOrManifestUrl)\n .then(({ loadRemoteModule }) =>\n createFederationResult({ config, adapters, loadRemoteModule, initRemoteEntryFlow })\n )\n .catch(e => {\n createStateDump(config, adapters)(`[init] STATE DUMP`);\n return Promise.reject(e);\n });\n};\n\nexport { initFederation };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAM,QACJ,OAAO,YAAY,YACnB,QAAQ,OACR,QAAQ,IAAI,cACZ,cAAc,KAAK,QAAQ,IAAI,UAAU,IACvC,IAAI,SAAS,QAAQ,MAAM,UAAU,GAAG,IAAI,IAC5C,MAAM;AAAA,IAAC;AAEX,WAAO,UAAU;AAAA;AAAA;;;ACVjB;AAAA;AAAA;AAIA,QAAM,sBAAsB;AAE5B,QAAM,aAAa;AACnB,QAAM,mBAAmB,OAAO;AAAA,IACL;AAG3B,QAAM,4BAA4B;AAIlC,QAAM,wBAAwB,aAAa;AAE3C,QAAM,gBAAgB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO,UAAU;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,yBAAyB;AAAA,MACzB,YAAY;AAAA,IACd;AAAA;AAAA;;;ACpCA;AAAA;AAAA;AAEA,QAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI;AACJ,QAAM,QAAQ;AACd,cAAU,OAAO,UAAU,CAAC;AAG5B,QAAM,KAAK,QAAQ,KAAK,CAAC;AACzB,QAAM,SAAS,QAAQ,SAAS,CAAC;AACjC,QAAM,MAAM,QAAQ,MAAM,CAAC;AAC3B,QAAM,UAAU,QAAQ,UAAU,CAAC;AACnC,QAAM,IAAI,QAAQ,IAAI,CAAC;AACvB,QAAI,IAAI;AAER,QAAM,mBAAmB;AAQz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;AACrD,WAAO,QAAQ,OAAO,CAAC;AAAA,EACzB,CAAC;AACL;",
|
|
6
|
-
"names": ["require_valid", "getScope", "
|
|
3
|
+
"sources": ["../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js", "../../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js", "../../../src/lib/core/2.app/flows/init.flow.ts", "../../../src/lib/core/2.app/flows/init-remote-entry.flow.ts", "../../../src/lib/core/native-federation.error.ts", "../../../src/lib/utils/path.ts", "../../../src/lib/core/2.app/steps/get-remote-entries.ts", "../../../src/lib/core/1.domain/externals/basis.ts", "../../../src/lib/core/2.app/steps/store-remote-entry.ts", "../../../src/lib/core/2.app/steps/process-remote-entries.ts", "../../../src/lib/core/1.domain/externals/external.contract.ts", "../../../src/lib/core/2.app/steps/apply-winner.ts", "../../../src/lib/core/2.app/steps/determine-shared-externals.ts", "../../../src/lib/core/2.app/steps/pooling/pool-views.ts", "../../../src/lib/core/2.app/steps/pooling/anchoring.ts", "../../../src/lib/core/2.app/steps/pooling/pool-graph.ts", "../../../src/lib/core/2.app/steps/pooling/pool.util.ts", "../../../src/lib/core/2.app/steps/pooling/pool-shared-externals.ts", "../../../src/lib/core/2.app/steps/pooling/mark-pools-for-reelection.ts", "../../../node_modules/.pnpm/@softarc+native-federation@4.4.0_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/domain/core/build-notification-options.contract.js", "../../../node_modules/.pnpm/@softarc+native-federation@4.4.0_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/domain/core/chunk.js", "../../../src/lib/core/2.app/steps/generate-import-map.ts", "../../../src/lib/core/2.app/steps/commit-changes.ts", "../../../src/lib/core/2.app/steps/expose-module-loader.ts", "../../../src/lib/utils/optional.ts", "../../../src/lib/core/2.app/steps/get-remote-entry.ts", "../../../src/lib/core/2.app/steps/update-cache.ts", "../../../src/lib/core/2.app/steps/pooling/pool-dynamic-externals.ts", "../../../src/lib/core/2.app/steps/convert-to-import-map.ts", "../../../src/lib/core/5.di/init.factory.ts", "../../../src/lib/core/3.adapters/browser/browser.ts", "../../../src/lib/core/3.adapters/checks/version.check.ts", "../../../src/lib/utils/integrity.ts", "../../../src/lib/core/3.adapters/http/manifest-provider.ts", "../../../node_modules/.pnpm/@softarc+native-federation@4.4.0_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/utils/normalize.js", "../../../node_modules/.pnpm/@softarc+native-federation@4.4.0_typescript@6.0.3/node_modules/@softarc/native-federation/dist/lib/core/output/densify-externals.js", "../../../src/lib/core/3.adapters/http/remote-entry-provider.ts", "../../../src/lib/core/3.adapters/storage/remote-info.repository.ts", "../../../src/lib/core/3.adapters/storage/scoped-externals.repository.ts", "../../../src/lib/core/3.adapters/storage/shared-externals.repository.ts", "../../../src/lib/core/3.adapters/browser/sse-handler.ts", "../../../src/lib/core/3.adapters/storage/chunk.repository.ts", "../../../src/lib/core/5.di/driving.factory.ts", "../../../src/lib/core/4.config/import-map/trusted-types.ts", "../../../src/lib/core/4.config/import-map/replace-in-dom.ts", "../../../src/lib/core/4.config/import-map/use-default.ts", "../../../src/lib/core/4.config/import-map/import-map.config.ts", "../../../src/lib/core/4.config/host/host.config.ts", "../../../src/lib/core/4.config/logging/noop.logger.ts", "../../../src/lib/core/2.app/config/log.contract.ts", "../../../src/lib/core/4.config/logging/log.handler.ts", "../../../src/lib/core/4.config/logging/log.config.ts", "../../../src/lib/utils/clone-entry.ts", "../../../src/lib/core/4.config/storage/global-this.storage.ts", "../../../src/lib/core/4.config/storage/storage.config.ts", "../../../src/lib/core/4.config/mode/default.profile.ts", "../../../src/lib/core/4.config/mode/mode.config.ts", "../../../src/lib/core/5.di/config.factory.ts", "../../../src/lib/core/5.di/federation-result.factory.ts", "../../../src/lib/core/init-federation.ts"],
|
|
4
|
+
"sourcesContent": ["'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n", "'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n", "'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n", "'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n", "'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n", "'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n", "'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n", "'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n", "'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n", "'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n", "'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n", "'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n", "'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n", "'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n", "'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n", "'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n", "'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n", "'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n", "'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n", "import type { FLOW_FACTORY } from '../driver-ports/flow-factory.contract';\nimport type { InitDriversContract } from '../driver-ports/init/drivers.contract';\nimport type { InitFlow } from '../driver-ports/init/flow.contract';\n\nexport const createInitFlow = ({\n flow,\n adapters,\n config,\n}: FLOW_FACTORY<InitDriversContract>): InitFlow => {\n return remotesOrManifestUrl =>\n flow\n .getRemoteEntries(remotesOrManifestUrl)\n .then(flow.processRemoteEntries)\n .then(flow.markPoolsForReelection)\n .then(flow.determineSharedExternals)\n .then(flow.poolSharedExternals)\n .then(flow.generateImportMap)\n .then(importMap => flow.commitChanges(importMap, { override: true }))\n .then(flow.exposeModuleLoader)\n .then(loadRemoteModule => ({\n config,\n adapters,\n loadRemoteModule,\n }));\n};\n", "import type { RemoteEntry } from 'lib/core/1.domain';\nimport type { FLOW_FACTORY } from '../driver-ports/flow-factory.contract';\nimport type { InitDriversContract } from '../driver-ports/init/drivers.contract';\nimport type { InitRemoteEntryFlow } from '../driver-ports/init/flow.contract';\n\nexport const createInitRemoteEntryFlow = ({\n flow,\n}: FLOW_FACTORY<InitDriversContract>): InitRemoteEntryFlow => {\n const processDynamicRemoteEntry = (remoteEntry: RemoteEntry) =>\n flow\n .updateCache(remoteEntry)\n .then(flow.poolDynamicExternals)\n .then(flow.convertToImportMap)\n .then(flow.commitChanges);\n\n return (remoteEntryUrl, remote) =>\n flow\n .getRemoteEntry(remoteEntryUrl, remote)\n .then(entry => entry.map(processDynamicRemoteEntry).orElse(Promise.resolve()))\n .then(() => undefined);\n};\n", "class NFError extends Error {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'NFError';\n }\n}\n\nexport { NFError };\n", "function join(pathA: string, pathB: string): string {\n pathA = pathA.endsWith('/') ? pathA.slice(0, -1) : pathA;\n pathB = pathB.startsWith('/') ? pathB.slice(1) : pathB;\n return `${pathA}/${pathB}`;\n}\n\nfunction getScope(path: string) {\n if (!path) return '';\n\n const parts = path.split('/');\n\n if (parts[parts.length - 1] === '' || parts[parts.length - 1]!.includes('.')) {\n parts.pop();\n }\n if (parts.length < 1) return '';\n\n return `${parts.join('/')}/`;\n}\n\nexport { join, getScope };\n", "import type { RemoteEntry } from 'lib/core/1.domain/remote-entry/remote-entry.contract';\nimport type {\n FederationManifest,\n RemoteEntryDescriptor,\n RemoteEntryUrl,\n} from 'lib/core/1.domain/remote-entry/manifest.contract';\nimport type { RemoteName } from 'lib/core/1.domain/remote/remote-info.contract';\nimport type { ForGettingRemoteEntries } from '../driver-ports/init/for-getting-remote-entries.port';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from '../config/mode.contract';\nimport type { HostConfig } from '../config/host.contract';\nimport * as _path from 'lib/utils/path';\n\nexport function createGetRemoteEntries(\n config: LoggingConfig & ModeConfig & HostConfig,\n ports: Pick<\n DrivingContract,\n 'remoteEntryProvider' | 'manifestProvider' | 'remoteInfoRepo' | 'sse'\n >\n): ForGettingRemoteEntries {\n /**\n * Step 1: Fetch the remoteEntry JSON objects:\n *\n * A Manifest or URL to a Manifest is used as the input. Based on the defined remotes\n * in the manifest, the library will download the remoteEntry.json files which contain the\n * metadata of the defined remotes (name, exposed modules and required dependencies a.k.a. externals)\n *\n * @param config\n * @param adapters\n * @returns A list of the remoteEntry json objects\n */\n return (remotesOrManifestUrl = {}) => {\n const manifestPromise = config.manifestIntegrity\n ? ports.manifestProvider.provide(remotesOrManifestUrl, {\n integrity: config.manifestIntegrity,\n })\n : ports.manifestProvider.provide(remotesOrManifestUrl);\n\n return manifestPromise\n .catch(e => {\n config.log.error(1, 'Could not fetch manifest.', e);\n return Promise.reject(new NFError('Failed to fetch manifest'));\n })\n .then(addHostRemoteEntry)\n .then(fetchRemoteEntries)\n .then(removeSkippedRemotes)\n .then(checkForSSE);\n };\n\n function addHostRemoteEntry(manifest: FederationManifest): FederationManifest {\n if (!config.hostRemoteEntry) return manifest;\n\n const { name, url, integrity } = config.hostRemoteEntry;\n\n return {\n ...manifest,\n [name]: integrity ? { url, integrity } : url,\n };\n }\n\n function normalizeEntry(descriptor: RemoteEntryDescriptor): {\n url: RemoteEntryUrl;\n integrity?: string;\n } {\n return typeof descriptor === 'string' ? { url: descriptor } : descriptor;\n }\n\n function withCacheTag(url: string, cacheTag?: string): string {\n if (!cacheTag) return url;\n return `${url}${url.includes('?') ? '&' : '?'}cacheTag=${cacheTag}`;\n }\n\n function resolveCacheTag(remoteName: RemoteName): string | undefined {\n if (\n config.hostRemoteEntry &&\n remoteName === config.hostRemoteEntry.name &&\n config.hostRemoteEntry.cacheTag\n ) {\n return config.hostRemoteEntry.cacheTag;\n }\n return config.profile.cacheTag;\n }\n\n async function fetchRemoteEntries(\n manifest: FederationManifest\n ): Promise<(RemoteEntry | false)[]> {\n const fetchPromises = Object.entries(manifest).map(([remoteName, descriptor]) =>\n fetchRemoteEntry(remoteName, descriptor)\n );\n return Promise.all(fetchPromises);\n }\n\n async function fetchRemoteEntry(\n remoteName: RemoteName,\n descriptor: RemoteEntryDescriptor\n ): Promise<RemoteEntry | false> {\n const { url: remoteEntryUrl, integrity } = normalizeEntry(descriptor);\n let isOverride = false;\n let skip = false;\n\n ports.remoteInfoRepo.tryGet(remoteName).ifPresent(cachedRemoteInfo => {\n if (\n config.profile.overrideCachedRemotes !== 'never' &&\n (remoteEntryUrl !== _path.join(cachedRemoteInfo.scopeUrl, 'remoteEntry.json') ||\n config.profile.overrideCachedRemotesIfURLMatches)\n ) {\n config.log.debug(1, `Overriding existing remote '${remoteName}' with '${remoteEntryUrl}'.`);\n isOverride = true;\n } else {\n config.log.debug(1, `Found remote '${remoteName}' in storage, omitting fetch.`);\n skip = true;\n }\n });\n\n if (skip) return false;\n\n const fetchUrl = withCacheTag(remoteEntryUrl, resolveCacheTag(remoteName));\n\n try {\n const remoteEntry = integrity\n ? await ports.remoteEntryProvider.provide(fetchUrl, { integrity })\n : await ports.remoteEntryProvider.provide(fetchUrl);\n\n config.log.debug(\n 1,\n `Fetched '${remoteEntry.name}' from '${remoteEntry.url}', exposing: ${JSON.stringify(remoteEntry.exposes)}`\n );\n\n return prepareRemoteEntry(remoteEntry, remoteName, isOverride);\n } catch (error) {\n if (config.strict.strictRemoteEntry) {\n config.log.error(1, `Could not fetch remote '${remoteName}'.`, error);\n return Promise.reject(new NFError(`Could not fetch remote '${remoteName}'`));\n }\n config.log.warn(1, `Could not fetch remote '${remoteName}'. skipping init.`, error);\n\n return Promise.resolve(false);\n }\n }\n\n function prepareRemoteEntry(\n remoteEntry: RemoteEntry,\n expectedRemoteName: string,\n isOverride: boolean\n ): RemoteEntry {\n if (isOverride) remoteEntry.override = isOverride;\n\n if (!!config.hostRemoteEntry && expectedRemoteName === config.hostRemoteEntry.name) {\n remoteEntry.host = true;\n remoteEntry.name = config.hostRemoteEntry!.name;\n }\n\n if (remoteEntry.name !== expectedRemoteName) {\n const errorDetails = `Fetched remote '${remoteEntry.name}' does not match requested '${expectedRemoteName}'.`;\n if (config.strict.strictRemoteEntry) {\n throw new NFError(errorDetails);\n }\n config.log.warn(1, `${errorDetails} Omitting expected name.`);\n }\n\n return remoteEntry;\n }\n\n function removeSkippedRemotes(remoteEntries: (RemoteEntry | false)[]): RemoteEntry[] {\n return remoteEntries.filter((entry): entry is RemoteEntry => entry !== false);\n }\n\n function checkForSSE(remoteEntries: RemoteEntry[]): RemoteEntry[] {\n if (config.sse) {\n remoteEntries.forEach(entry => {\n if (entry.buildNotificationsEndpoint) {\n ports.sse.watchRemoteBuilds(\n _path.join(_path.getScope(entry.url), entry.buildNotificationsEndpoint)\n );\n config.log.debug(1, `Registered SSE endpoint of remote '${entry.name}' `);\n return;\n }\n config.log.debug(1, `Remote ${entry.name} has no defined 'buildNotificationsEndpoint'`);\n });\n }\n\n return remoteEntries;\n }\n}\n", "import type { SharedVersion, SharedVersionMeta } from './version.contract';\n\nconst coverage = (remote: SharedVersionMeta): number => Object.keys(remote.entries).length;\n\n// `remotes[0]` is the basis: the copy every consumer of the version resolves to. Host and cached\n// outrank coverage because repointing them invalidates a committed import map.\nexport function isBetterBasis(candidate: SharedVersionMeta, basis: SharedVersionMeta): boolean {\n if (basis.cached !== candidate.cached) return candidate.cached;\n return coverage(candidate) > coverage(basis);\n}\n\nexport function addRemoteToVersion(\n version: SharedVersion,\n remote: SharedVersionMeta,\n isHost = false\n): void {\n if (isHost) {\n version.host = true;\n version.remotes.unshift(remote);\n return;\n }\n\n const basis = version.remotes[0];\n if (basis && !version.host && isBetterBasis(remote, basis)) {\n version.remotes.unshift(remote);\n return;\n }\n\n version.remotes.push(remote);\n}\n\n// `remotes[0]` answers \"who serves this version\", never \"what does this version demand\":\n// `requiredVersion`, `strictVersion` and `cached` are per-build settings, so remotes sharing a tag\n// can disagree on all three. Negotiation must therefore aggregate over every remote, or basis\n// precedence would decide compatibility. Deduped because those settings repeat across a version's\n// remotes, which keeps the resolver's O(versions\u00B2) selection from also scaling with remote count.\nexport function versionDemands(version: SharedVersion): SharedVersionMeta[] {\n if (version.remotes.length < 2) return version.remotes;\n\n const distinct = new Map<string, SharedVersionMeta>();\n for (const remote of version.remotes) {\n const key = `${remote.requiredVersion}|${remote.strictVersion}|${remote.cached}`;\n if (!distinct.has(key)) distinct.set(key, remote);\n }\n return Array.from(distinct.values());\n}\n\n// Coverage enforcement can leave a `scope` version beside a shareable one at the same tag.\nexport function findVersionForTag(\n versions: SharedVersion[],\n tag: string\n): SharedVersion | undefined {\n let scoped: SharedVersion | undefined;\n for (const version of versions) {\n if (version.tag !== tag) continue;\n if (version.action !== 'scope') return version;\n scoped ??= version;\n }\n return scoped;\n}\n\n// Every copy of a version builds the same tag, so a specifier only some of them bundle is not a\n// tear: the version exposes the union of its copies' entrypoints, each served by the first copy\n// that declares it \u2014 basis precedence first. See\n// docs/version-resolver.md#entrypoint-coverage-and-tearing.\n//\n// Only copies that publish their own files count. Pooling anchors a copy on a foreign build via\n// `servedBy`, and the import map then names the anchor's files for it, per consumer \u2014 so what such a\n// copy bundles answers for nobody but itself, and counting it would promise a specifier no consumer of\n// this version can resolve. Pooling keeps an anchored copy out of the basis slot for exactly this\n// reason, so a `share` version's basis always survives the skip.\nexport function versionEntries(version: SharedVersion): Map<string, SharedVersionMeta> {\n return collectEntries(version, undefined);\n}\n\n// The part of that surface a committed import map already publishes, which on the dynamic path is less than\n// all of it: a copy that joined at runtime served its extra entrypoints into its own scope alone, so it is\n// part of the version yet can serve nobody else. `cached` is set by whichever import-map builder mapped the\n// copy, so it answers exactly that. Only a consumer that resolves through the committed mapping needs this\n// \u2014 a per-consumer override names its provider outright and can use any copy.\nexport function committedEntries(version: SharedVersion): Map<string, SharedVersionMeta> {\n return collectEntries(version, remote => remote.cached);\n}\n\n/**\n * The walk both of those keep the first claim of: which copies of a version may publish a specifier, in basis\n * precedence. Exposed so a caller that models the same fill order without needing the map \u2014 the pooling gates\n * ask which build a consumer lands on, per specifier \u2014 reads the `servedBy` rule from here instead of\n * restating it. It deliberately does not dedup: the callers do, and this way the walk allocates nothing.\n *\n * `accepts` is for a caller with a further reason to discount a copy (pooling islands one, so it self-serves).\n * Filtering the *result* is not the same thing \u2014 that drops the specifier instead of letting the next copy\n * claim it.\n */\nexport function forEachVersionEntry(\n version: SharedVersion,\n accepts: ((remote: SharedVersionMeta) => boolean) | undefined,\n visit: (entrypoint: string, remote: SharedVersionMeta) => void\n): void {\n for (const remote of version.remotes) {\n if (remote.servedBy) continue;\n if (accepts && !accepts(remote)) continue;\n for (const entrypoint in remote.entries) visit(entrypoint, remote);\n }\n}\n\nfunction collectEntries(\n version: SharedVersion,\n accepts: ((remote: SharedVersionMeta) => boolean) | undefined\n): Map<string, SharedVersionMeta> {\n const entries = new Map<string, SharedVersionMeta>();\n forEachVersionEntry(version, accepts, (entrypoint, remote) => {\n if (!entries.has(entrypoint)) entries.set(entrypoint, remote);\n });\n return entries;\n}\n\n// A `versionEntries` map or a bare name set both answer \"can this be served?\".\ntype Covered = Pick<ReadonlySet<string>, 'has'>;\n\nexport function uncoveredEntrypoints(remote: SharedVersionMeta, covered: Covered): string[] {\n return Object.keys(remote.entries).filter(entrypoint => !covered.has(entrypoint));\n}\n\n// `uncoveredEntrypoints` without materializing the names: the resolver's O(versions\u00B2) selection\n// loop asks this once per remote per candidate and only needs the count. Keep the two in sync.\nexport function countUncoveredEntrypoints(remote: SharedVersionMeta, covered: Covered): number {\n let uncovered = 0;\n for (const entrypoint in remote.entries) {\n if (!covered.has(entrypoint)) uncovered++;\n }\n return uncovered;\n}\n", "import {\n type RemoteEntry,\n type RemoteInfo,\n type RemoteName,\n type ScopedVersion,\n type SharedExternal,\n type DenseSharedInfo,\n type SharedVersion,\n type SharedVersionMeta,\n} from 'lib/core/1.domain';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport * as _path from 'lib/utils/path';\n\nexport type StoreRemoteEntry = (\n remoteEntry: RemoteEntry,\n onSharedExternal: SharedExternalHandler\n) => void;\n\nexport type RemoveCachedRemoteEntries = (remoteNames: ReadonlySet<RemoteName>) => void;\n\n/**\n * Evict overridden remotes before their replacements are merged in. Kept out of `storeRemoteEntry`\n * because `removeFromAllScopes` costs a full traversal of the shared-externals graph: the init\n * pipeline evicts its whole override set at once, the dynamic pipeline passes a single name.\n */\nexport function createRemoveCachedRemoteEntries(\n ports: Pick<\n DrivingContract,\n 'remoteInfoRepo' | 'scopedExternalsRepo' | 'sharedExternalsRepo' | 'sharedChunksRepo'\n >\n): RemoveCachedRemoteEntries {\n return remoteNames => {\n if (remoteNames.size === 0) return;\n\n for (const remoteName of remoteNames) {\n ports.remoteInfoRepo.remove(remoteName);\n ports.scopedExternalsRepo.remove(remoteName);\n ports.sharedChunksRepo.remove(remoteName);\n }\n ports.sharedExternalsRepo.removeFromAllScopes(remoteNames);\n };\n}\n\nexport type SharedExternalHandler = (\n remoteEntry: RemoteEntry,\n external: DenseSharedInfo,\n ctx: SharedExternalContext\n) => void;\n\nexport type SharedExternalContext = {\n tag: string;\n remote: SharedVersionMeta;\n cached: SharedExternal;\n scopeType: 'global' | 'strict' | 'shareScope';\n assertSameVersionCompatibility: (matchingVersion: SharedVersion) => void;\n commit: () => void;\n};\n\n/**\n * Not a pipeline step but the template both storage steps specialize: it owns the merge sequence\n * for a remoteEntry, and only the resolution of a singleton external differs between the init\n * pipeline (process-remote-entries, step 2) and the dynamic pipeline (update-cache, step 8),\n * injected per call. Evicting an overridden remote is the caller's job, see\n * `createRemoveCachedRemoteEntries` \u2014 every entry reaching here is merged additively. The\n * pipelines must not be merged, see docs/version-resolver.md \"Dynamic Init\". If a change ever\n * needs a flag or parameter here to serve only one caller, inline this back into the steps instead.\n */\nexport function createStoreRemoteEntry(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'scopedExternalsRepo'\n | 'sharedExternalsRepo'\n | 'sharedChunksRepo'\n | 'versionCheck'\n >,\n logStep: number\n): StoreRemoteEntry {\n return (remoteEntry, onSharedExternal) => {\n addRemoteInfoToStorage(remoteEntry);\n addExternalsToStorage(remoteEntry, onSharedExternal);\n addSharedChunksToStorage(remoteEntry);\n };\n\n function addRemoteInfoToStorage({ name, url, exposes, integrity }: RemoteEntry): void {\n ports.remoteInfoRepo.addOrUpdate(name, {\n scopeUrl: _path.getScope(url),\n exposes: Object.values(exposes ?? []).map(m => ({\n moduleName: m.key,\n file: m.outFileName,\n })),\n ...(integrity ? { integrity } : {}),\n } as RemoteInfo);\n }\n\n function addExternalsToStorage(\n remoteEntry: RemoteEntry,\n onSharedExternal: SharedExternalHandler\n ): void {\n remoteEntry.shared.forEach(external => {\n const tag = resolveVersion(remoteEntry, external);\n if (tag === null) return;\n\n if (external.singleton) {\n onSharedExternal(remoteEntry, external, sharedExternalContext(remoteEntry, external, tag));\n } else {\n addScopedExternal(remoteEntry, external, tag);\n }\n });\n }\n\n function addSharedChunksToStorage(remoteEntry: RemoteEntry): void {\n if (!remoteEntry.chunks) return;\n config.log.debug(\n logStep,\n `Adding chunks for remote \"${remoteEntry.name}\", bundles: [${Object.keys(remoteEntry.chunks).join(', ')}]`\n );\n Object.entries(remoteEntry.chunks).forEach(([bundleName, chunks]) => {\n ports.sharedChunksRepo.addOrReplace(remoteEntry.name, bundleName, chunks);\n });\n }\n\n function addScopedExternal(\n remoteEntry: RemoteEntry,\n sharedInfo: DenseSharedInfo,\n tag: string\n ): void {\n ports.scopedExternalsRepo.addExternal(remoteEntry.name, sharedInfo.packageName, {\n tag,\n bundle: sharedInfo.bundle,\n entries: sharedInfo.entries,\n } as ScopedVersion);\n }\n\n function resolveVersion(remoteEntry: RemoteEntry, external: DenseSharedInfo): string | null {\n if (external.version && ports.versionCheck.isValidSemver(external.version)) {\n return external.version;\n }\n\n const errorMsg = `[${remoteEntry.name}][${external.packageName}] Version '${external.version}' is not a valid version.`;\n if (config.strict.strictExternalVersion) {\n config.log.error(logStep, errorMsg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n if (config.profile.skipInvalidExternalVersions) {\n config.log.warn(logStep, `${errorMsg} Skipping external.`);\n return null;\n }\n config.log.warn(logStep, errorMsg);\n return ports.versionCheck.smallestVersion(external.requiredVersion);\n }\n\n function sharedExternalContext(\n remoteEntry: RemoteEntry,\n sharedInfo: DenseSharedInfo,\n tag: string\n ): SharedExternalContext {\n const scopeType = ports.sharedExternalsRepo.scopeType(sharedInfo.shareScope);\n\n const remote: SharedVersionMeta = {\n name: remoteEntry.name,\n bundle: sharedInfo.bundle,\n strictVersion: sharedInfo.strictVersion,\n cached: false,\n requiredVersion: scopeType === 'strict' ? tag : sharedInfo.requiredVersion || tag,\n ...(sharedInfo.pool?.trim() ? { pool: sharedInfo.pool } : {}),\n entries: sharedInfo.entries,\n };\n\n const cached: SharedExternal = ports.sharedExternalsRepo\n .tryGet(sharedInfo.packageName, sharedInfo.shareScope)\n .orElse({ dirty: false, versions: [] });\n\n return {\n tag,\n remote,\n cached,\n scopeType,\n assertSameVersionCompatibility(matchingVersion: SharedVersion): void {\n if (!remote.strictVersion) return;\n if (matchingVersion.remotes[0]!.requiredVersion === remote.requiredVersion) return;\n\n const errorMsg = `[${remoteEntry.name}][${sharedInfo.packageName}@${\n sharedInfo.version\n }] Required version-range '${\n remote.requiredVersion\n }' does not match cached version-range '${matchingVersion.remotes[0]!.requiredVersion}'`;\n\n if (config.strict.strictExternalSameVersionCompatibility) {\n config.log.error(logStep, errorMsg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n config.log.warn(logStep, errorMsg);\n },\n commit(): void {\n ports.sharedExternalsRepo.addOrUpdate(\n sharedInfo.packageName,\n {\n dirty: cached.dirty,\n versions: cached.versions.sort((a, b) => ports.versionCheck.compare(b.tag, a.tag)),\n },\n sharedInfo.shareScope\n );\n },\n };\n }\n}\n", "import type { ForProcessingRemoteEntries } from '../driver-ports/init/for-processing-remote-entries.port';\nimport type { RemoteEntry, RemoteName, DenseSharedInfo } from 'lib/core/1.domain';\nimport { addRemoteToVersion, findVersionForTag } from 'lib/core/1.domain/externals/basis';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport {\n createRemoveCachedRemoteEntries,\n createStoreRemoteEntry,\n type SharedExternalContext,\n} from './store-remote-entry';\n\nexport function createProcessRemoteEntries(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'sharedExternalsRepo'\n | 'scopedExternalsRepo'\n | 'sharedChunksRepo'\n | 'versionCheck'\n >\n): ForProcessingRemoteEntries {\n const storeRemoteEntry = createStoreRemoteEntry(config, ports, 2);\n const removeCachedRemoteEntries = createRemoveCachedRemoteEntries(ports);\n\n /**\n * Step 2: Merge the remote-info, externals and chunks of the provided remoteEntry\n * objects into the cache. Shared externals are only registered here; resolution\n * happens later in determine-shared-externals, per scope, with global knowledge.\n */\n return remoteEntries => {\n try {\n const evictPerEntry = evictOverriddenRemotes(remoteEntries);\n remoteEntries.forEach(remoteEntry => {\n if (remoteEntry?.override && evictPerEntry.has(remoteEntry.name)) {\n removeCachedRemoteEntries(new Set([remoteEntry.name]));\n }\n storeRemoteEntry(remoteEntry, addSharedExternal);\n });\n return Promise.resolve(remoteEntries);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n /**\n * Evict every overridden remote in one traversal of the shared-externals graph. Hoisting it ahead\n * of the merge is equivalent because removal only touches records carrying that remote's name \u2014\n * unless a name appears twice in the batch, which `get-remote-entries` permits when\n * `strictRemoteEntry` is off and a fetched entry disagrees with its manifest key.\n *\n * @returns the names that must still be evicted per entry, inside the merge loop.\n */\n function evictOverriddenRemotes(remoteEntries: RemoteEntry[]): Set<RemoteName> {\n const batched = new Set<RemoteName>();\n const repeated = new Set<RemoteName>();\n const seen = new Set<RemoteName>();\n\n for (const remoteEntry of remoteEntries) {\n if (!remoteEntry) continue;\n if (seen.has(remoteEntry.name)) repeated.add(remoteEntry.name);\n seen.add(remoteEntry.name);\n if (remoteEntry.override) batched.add(remoteEntry.name);\n }\n for (const remoteName of repeated) batched.delete(remoteName);\n\n removeCachedRemoteEntries(batched);\n return repeated;\n }\n\n function addSharedExternal(\n remoteEntry: RemoteEntry,\n _sharedInfo: DenseSharedInfo,\n {\n tag,\n remote,\n cached,\n scopeType,\n assertSameVersionCompatibility,\n commit,\n }: SharedExternalContext\n ): void {\n // Resolution is a function of the whole remote set, not of the tag list: a remote joining an\n // existing version can take the basis slot (changing what the version serves) and always adds\n // to `versionDemands` (changing what it accepts). Either way the cached actions are stale.\n if (scopeType !== 'strict') cached.dirty = true;\n\n const matchingVersion = findVersionForTag(cached.versions, tag);\n\n if (matchingVersion) {\n assertSameVersionCompatibility(matchingVersion);\n addRemoteToVersion(matchingVersion, remote, !matchingVersion.host && !!remoteEntry?.host);\n } else {\n cached.versions.push({\n tag,\n action: scopeType === 'strict' ? 'share' : 'skip',\n host: !!remoteEntry?.host,\n remotes: [remote],\n });\n }\n\n commit();\n }\n}\n", "import type { SharedVersion, ScopedVersion } from './version.contract';\n\nexport type ExternalName = string;\n\nexport type ScopedExternals = Record<string, ScopedExternal>;\n\nexport const GLOBAL_SCOPE = '__GLOBAL__';\n\nexport const STRICT_SCOPE = 'strict';\n\nexport type SharedExternal = {\n dirty: boolean;\n versions: SharedVersion[];\n};\n\nexport type shareScope = Record<string, SharedExternal>;\n\nexport type SharedExternals = Record<string, shareScope> & { [GLOBAL_SCOPE]: shareScope };\n\nexport type ScopedExternal = Record<string, ScopedVersion>;\n", "import type { SharedExternal, SharedVersion, SharedVersionMeta } from 'lib/core/1.domain';\nimport {\n uncoveredEntrypoints,\n versionDemands,\n versionEntries,\n} from 'lib/core/1.domain/externals/basis';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\n\nexport type IsCompatible = (tag: string, requiredVersion: string) => boolean;\n\nexport type VersionAcceptance = {\n // A version can only be redirected to `tag` if none of its remotes rejects that tag.\n accepts: (version: SharedVersion, tag: string) => boolean;\n // A representative copy that makes the redirect unsafe: it rejects `tag` while `strictVersion` is set,\n // so it keeps its own build instead of being deduped away. One is enough for the message and the\n // strict check; `applyWinner` enumerates the rest itself when it splits the version.\n objector: (version: SharedVersion, tag: string) => SharedVersionMeta | undefined;\n};\n\n// Every compatibility question is asked of the whole version, not of its basis: see `versionDemands`.\n// Computed once per external, since the selection loop is O(versions\u00B2).\nexport function versionAcceptance(\n external: SharedExternal,\n isCompatible: IsCompatible\n): VersionAcceptance {\n const demands = new Map<SharedVersion, SharedVersionMeta[]>(\n external.versions.map(v => [v, versionDemands(v)])\n );\n\n return {\n accepts: (version, tag) =>\n demands.get(version)!.every(d => isCompatible(tag, d.requiredVersion)),\n objector: (version, tag) =>\n demands.get(version)!.find(d => d.strictVersion && !isCompatible(tag, d.requiredVersion)),\n };\n}\n\n/**\n * The tail of winner election: derive every other version's verdict from the chosen one, apply the\n * entrypoint coverage policy, clear `dirty`. `determine` is the only caller, and passes its memoized\n * `isCompatible` plus the `acceptance` it already built for the election.\n *\n * A hazard for anyone who ever adds a second caller that re-points a winner: `findTears` keys off the\n * winner's merged entries, so moving the winner moves the surface coverage is measured against.\n */\nexport function createApplyWinner(config: LoggingConfig & ModeConfig) {\n return function applyWinner(\n externalName: string,\n external: SharedExternal,\n winner: SharedVersion,\n isCompatible: IsCompatible,\n acceptance?: VersionAcceptance\n ): SharedExternal {\n // A lone version has nothing to redirect, so it is never asked a compatibility question \u2014 which\n // is also why it is never strict-checked against its own tag.\n if (external.versions.length > 1) {\n const { accepts, objector } = acceptance ?? versionAcceptance(external, isCompatible);\n\n const rebuilt: SharedVersion[] = [];\n\n for (const v of external.versions) {\n rebuilt.push(v);\n\n if (accepts(v, winner.tag)) {\n v.action = 'skip';\n continue;\n }\n\n const strict = objector(v, winner.tag);\n\n if (config.strict.strictExternalCompatibility && strict) {\n config.log.error(\n 3,\n `[${strict.name}][${externalName}@${v.tag}] Is not compatible with requiredRange '${strict.requiredVersion}' of shared ${externalName}@${winner.tag}.`\n );\n\n throw new NFError(`External ${externalName}@${v.tag} could not be shared.`);\n }\n\n // The winner is never redirected, so its copies are never really asked to accept its own tag;\n // its verdict is `winner.action` below. Splitting it would scope copies that dedup today. Covers\n // the host row too, which host precedence always makes the winner.\n if (v === winner) continue;\n\n if (!strict) {\n v.action = 'skip';\n continue;\n }\n\n // `accepts` aggregates over the whole version because one version is one file served from one\n // basis \u2014 but only the copies that themselves reject the winner have to keep their own build.\n const objecting = new Set(\n v.remotes.filter(r => r.strictVersion && !isCompatible(winner.tag, r.requiredVersion))\n );\n\n if (objecting.size === v.remotes.length) {\n v.action = 'scope';\n continue;\n }\n\n v.remotes = v.remotes.filter(r => !objecting.has(r));\n v.action = 'skip';\n // Beside its source rather than appended: the record stays newest-first, which `commit()`\n // guarantees and a later election reads as \"the latest\".\n rebuilt.push({ tag: v.tag, host: false, action: 'scope', remotes: [...objecting] });\n }\n\n // One row per (tag, action). A warm record can already hold a `scope` row at the tag a split\n // produces \u2014 a joiner lands in the deduping row of a split tag and re-splits out of it \u2014 and both\n // `findVersionForTag` and `rebuildMember` read a tag as at most one row per action. Merged after the\n // loop, not during it: a row's verdict is not final until the winner has been applied to it.\n const merged = new Map<string, SharedVersion>();\n external.versions = rebuilt.filter(v => {\n const first = merged.get(`${v.tag}|${v.action}`);\n if (!first) {\n merged.set(`${v.tag}|${v.action}`, v);\n return true;\n }\n first.remotes.push(...v.remotes);\n return false;\n });\n }\n\n winner.action = 'share';\n\n applyEntrypointCoveragePolicy(externalName, external);\n\n external.dirty = false;\n return external;\n };\n\n // Both settings only govern tears *between* versions: copies of the shared tag always merge.\n // `strictEntryPointCoverage` refuses a tear, `profile.scopeUncoveredEntrypoints` scopes the\n // torn copy, otherwise the import-map builders self-fill it.\n function applyEntrypointCoveragePolicy(externalName: string, external: SharedExternal): void {\n const { strictEntryPointCoverage } = config.strict;\n if (!strictEntryPointCoverage && !config.profile.scopeUncoveredEntrypoints) return;\n\n const tears = findTears(external);\n if (tears.length === 0) return;\n\n if (strictEntryPointCoverage) {\n const { version, remote, uncovered } = tears[0]!;\n config.log.error(\n 3,\n `[${externalName}@${version.tag}][${remote.name}] Entrypoints not covered by the shared version: ${uncovered.join(', ')}.`\n );\n throw new NFError(\n `External ${externalName} could not be shared without tearing entrypoints.`\n );\n }\n\n scopeTornRemotes(externalName, external, tears);\n }\n\n function findTears(external: SharedExternal): Tear[] {\n const shared = external.versions.find(v => v.action === 'share');\n if (!shared) return [];\n\n const basis = versionEntries(shared);\n const tears: Tear[] = [];\n\n for (const version of external.versions) {\n if (version.action === 'scope') continue;\n // Its own copies are part of the basis, so they can never tear it.\n if (version === shared) continue;\n\n version.remotes.forEach(remote => {\n // Pooling anchored this copy elsewhere: the map names that build's files for it, so the shared\n // version is not what it resolves through and cannot tear it.\n if (remote.servedBy) return;\n\n const uncovered = uncoveredEntrypoints(remote, basis);\n if (uncovered.length > 0) tears.push({ version, remote, uncovered });\n });\n }\n\n return tears;\n }\n\n function scopeTornRemotes(externalName: string, external: SharedExternal, tears: Tear[]): void {\n const torn = new Set(tears.map(t => t.remote));\n const demotedByTag = new Map<string, SharedVersionMeta[]>();\n\n for (const { version, remote, uncovered } of tears) {\n const group = demotedByTag.get(version.tag);\n if (group) group.push(remote);\n else demotedByTag.set(version.tag, [remote]);\n\n config.log.debug(\n 3,\n `[${externalName}@${version.tag}][${remote.name}] Scoped: entrypoints not covered by the shared version: ${uncovered.join(', ')}.`\n );\n }\n\n for (const version of external.versions) {\n if (version.remotes.some(r => torn.has(r))) {\n version.remotes = version.remotes.filter(r => !torn.has(r));\n }\n }\n external.versions = external.versions.filter(v => v.remotes.length > 0);\n\n for (const [tag, remotes] of demotedByTag) {\n const scoped = external.versions.find(v => v.tag === tag && v.action === 'scope');\n if (scoped) scoped.remotes.push(...remotes);\n else external.versions.push({ tag, host: false, action: 'scope', remotes });\n }\n }\n}\n\ntype Tear = { version: SharedVersion; remote: SharedVersionMeta; uncovered: string[] };\n", "import type { ForDeterminingSharedExternals } from '../driver-ports/init/for-determining-shared-externals.port';\nimport {\n type ExternalName,\n GLOBAL_SCOPE,\n type SharedExternal,\n type SharedVersion,\n} from 'lib/core/1.domain';\nimport { countUncoveredEntrypoints, versionEntries } from 'lib/core/1.domain/externals/basis';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\nimport { createApplyWinner, type IsCompatible, versionAcceptance } from './apply-winner';\n\nexport function createDetermineSharedExternals(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'versionCheck' | 'sharedExternalsRepo'>\n): ForDeterminingSharedExternals {\n const applyWinner = createApplyWinner(config);\n\n /**\n * Step 3: Determine which version is the optimal version to share.\n *\n * The shared external versions that were merged into the cache/storage caused the shared\n * external to be 'dirty', this step cleans all dirty externals in the storage by calculating\n * the most optimal version to share since only 1 version can be shared globally. Every other copy\n * either skips onto the winner or, where its own range rejects it and `strictVersion` is set, is split\n * out into a scoped external of its own tag.\n *\n * Check the docs for a full explanation of the dependency resolver.\n *\n * Priority:\n * 1) Latest external defined in 'host' remoteEntry (if available).\n * 2) If defined in config, prioritize latest available version.\n * 3) Find most optimal version, by comparing potential extra downloads per version.\n *\n * @param config\n * @param adapters\n * @returns the externals it re-elected, per scope \u2014 pooling's signal for what changed, since this\n * step clears `dirty` on everything it touches.\n */\n return () => {\n // The selection loop asks this O(versions\u00B2 \u00D7 demands) times but has only\n // (candidate tag \u00D7 distinct requiredVersion) distinct questions to ask. Scoped to one resolve,\n // so the map needs no bound.\n const memo = new Map<string, boolean>();\n const isCompatible: IsCompatible = (tag, requiredVersion) => {\n const key = `${tag}|${requiredVersion}`;\n let hit = memo.get(key);\n if (hit === undefined) {\n hit = ports.versionCheck.isCompatible(tag, requiredVersion);\n memo.set(key, hit);\n }\n return hit;\n };\n\n const touched = new Map<string, Set<ExternalName>>();\n\n for (const shareScope of ports.sharedExternalsRepo.getScopes()) {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(shareScope);\n\n try {\n const elected = new Set<ExternalName>();\n Object.entries(sharedExternals)\n .filter(([_, e]) => e.dirty)\n .forEach(([name, external]) => {\n ports.sharedExternalsRepo.addOrUpdate(\n name,\n setVersionActions(name, external, isCompatible),\n shareScope\n );\n elected.add(name);\n });\n if (elected.size > 0) touched.set(shareScope, elected);\n } catch (error) {\n config.log.error(\n 3,\n `[${shareScope ?? GLOBAL_SCOPE}] failed to determine shared externals.`,\n {\n sharedExternals,\n error,\n }\n );\n return Promise.reject(\n new NFError(\n `Could not determine shared externals in scope ${shareScope}.`,\n error as Error\n )\n );\n }\n }\n return Promise.resolve(touched);\n };\n\n // Entrypoints declared by the versions `winner` would skip that its own copies can't serve. Prices\n // exactly the tears `applyWinner.findTears` would report, so an anchored copy \u2014 which resolves through\n // its pooling anchor, not through the winner \u2014 is no more a tear here than it is there.\n function uncoveredTears(\n external: SharedExternal,\n winner: SharedVersion,\n accepts: (version: SharedVersion, tag: string) => boolean\n ): number {\n const basis = versionEntries(winner);\n return external.versions.reduce((sum, v) => {\n if (v === winner) return sum;\n if (!accepts(v, winner.tag)) return sum;\n return v.remotes.reduce(\n (n, r) => (r.servedBy ? n : n + countUncoveredEntrypoints(r, basis)),\n sum\n );\n }, 0);\n }\n\n function setVersionActions(\n externalName: string,\n external: SharedExternal,\n isCompatible: IsCompatible\n ) {\n if (external.versions.length === 1) {\n return applyWinner(externalName, external, external.versions[0]!, isCompatible);\n }\n\n const acceptance = versionAcceptance(external, isCompatible);\n const { accepts } = acceptance;\n\n let sharedVersion = external.versions.find(v => v.host);\n\n if (!sharedVersion && config.profile.latestSharedExternal) {\n sharedVersion = external.versions[0];\n }\n\n if (!sharedVersion) {\n // find version with least extra downloads, sorted by SEMVER version (O^2 complexity)\n let leastExtraDownloads = Number.MAX_VALUE;\n let leastTears = Number.MAX_VALUE;\n // What a rejected version really costs: `applyWinner` splits it, so only the copies that themselves\n // reject the winner keep their own build. Cached copies are already downloaded and non-strict ones take\n // whatever is shared, so neither costs anything. Grouped by range so the O(versions\u00B2) selection loop\n // does not also scale with remote count.\n const selfServing = new Map<SharedVersion, { requiredVersion: string; copies: number }[]>(\n external.versions.map(v => {\n const groups = new Map<string, { requiredVersion: string; copies: number }>();\n for (const remote of v.remotes) {\n if (remote.cached || !remote.strictVersion) continue;\n const group = groups.get(remote.requiredVersion);\n if (group) group.copies++;\n else\n groups.set(remote.requiredVersion, {\n requiredVersion: remote.requiredVersion,\n copies: 1,\n });\n }\n return [v, [...groups.values()]];\n })\n );\n\n const costOf = (version: SharedVersion, tag: string) =>\n selfServing\n .get(version)!\n .reduce((n, g) => (isCompatible(tag, g.requiredVersion) ? n : n + g.copies), 0);\n\n external.versions.forEach(vA => {\n const extraDownloads = external.versions.reduce(\n // A copy of the winner is never redirected, so it never self-serves however its own range\n // reads \u2014 see `applyWinner`, which does not split the winner either.\n (sum, vB) => (vB === vA ? sum : sum + costOf(vB, vA.tag)),\n 0\n );\n // Tiebreak equal-download candidates toward the one that leaves fewest entrypoints\n // uncovered across the versions it would skip (fewest tears / scope-promotions).\n if (extraDownloads < leastExtraDownloads) {\n leastExtraDownloads = extraDownloads;\n leastTears = uncoveredTears(external, vA, accepts);\n sharedVersion = vA;\n return;\n }\n if (extraDownloads > leastExtraDownloads) return;\n\n const tears = uncoveredTears(external, vA, accepts);\n if (tears < leastTears) {\n leastTears = tears;\n sharedVersion = vA;\n }\n });\n }\n\n if (!sharedVersion) {\n throw new NFError(`[${externalName}] Could not determine shared version!`);\n }\n\n // Determine action of other versions based on chosen sharedVersion\n return applyWinner(externalName, external, sharedVersion, isCompatible, acceptance);\n }\n}\n", "import type { ExternalName, RemoteName, SharedVersion, VersionName } from 'lib/core/1.domain';\nimport { forEachVersionEntry } from 'lib/core/1.domain/externals/basis';\nimport type {\n BuildView,\n CommittedView,\n Islanded,\n OwnCopy,\n PoolMember,\n Specifier,\n} from './pool.types';\n\n/**\n * Read-only projections of one pool's stored record: everything the gates in `anchoring.ts` decide on is\n * derived here, and nothing here decides anything.\n *\n * Every set is keyed by entrypoint **specifier**, not by external name. A flat remote declares\n * `@framework/core/testing` as its own external while a dense one carries the same specifier as an entry\n * of `@framework/core`; comparing names makes those two shapes mutually uncoverable for a build-tool\n * reason with no provenance content. See docs/version-resolver.md \u00A7\"How pooling resolves\".\n */\n\ntype VersionMeta = SharedVersion['remotes'][number];\n\n/**\n * Per build: the specifiers it serves and from which file, the tag each is served at, and the\n * `(member \u2192 tag)` instance it runs. Built once per pool and reused across consumers, so a coverage question\n * is a subset test rather than a walk of `entries`.\n *\n * A `scope` copy is excluded \u2014 it is about to self-serve, so it serves nobody else.\n */\nexport function liveBuilds(members: PoolMember[], islanded?: Islanded): Map<RemoteName, BuildView> {\n return walkBuilds(members, islanded, true);\n}\n\n/**\n * The same walk over the *committed* record, where a `scope` copy is a **stable island** rather than a\n * remote about to self-serve: its files are already in the map under its own scope and it demonstrably runs\n * its own build, so it can serve a remote loaded later.\n */\nexport function committedView(members: PoolMember[]): CommittedView {\n const global: CommittedView['global'] = new Map();\n\n // Mirrors what `generate-import-map` emitted, so `global` is what the committed map really serves.\n forEachGlobalClaim(members, undefined, (specifier, tag, meta) => {\n if (!global.has(specifier))\n global.set(specifier, { tag, remote: meta.name, file: meta.entries[specifier]! });\n });\n\n return { builds: walkBuilds(members, undefined, false), global };\n}\n\nfunction walkBuilds(\n members: PoolMember[],\n islanded: Islanded | undefined,\n skipScoped: boolean\n): Map<RemoteName, BuildView> {\n const builds = new Map<RemoteName, BuildView>();\n\n for (const member of members) {\n const versions = member.external.versions;\n for (let v = 0; v < versions.length; v++) {\n const version = versions[v]!;\n if (skipScoped && version.action === 'scope') continue;\n\n const remotes = version.remotes;\n for (let r = 0; r < remotes.length; r++) {\n const meta = remotes[r]!;\n if (islanded?.has(meta.name)) continue;\n\n let own = builds.get(meta.name);\n if (!own) {\n builds.set(\n meta.name,\n (own = { coverage: new Map(), tags: new Map(), instance: new Map() })\n );\n }\n\n // A remote ships one copy per member, so a second row is a record it cannot produce; first tag\n // wins so such a record still reads deterministically.\n if (!own.instance.has(member.name)) own.instance.set(member.name, version.tag);\n for (const specifier in meta.entries) {\n own.coverage.set(specifier, meta.entries[specifier]!);\n if (!own.tags.has(specifier)) own.tags.set(specifier, version.tag);\n }\n }\n }\n }\n\n return builds;\n}\n\n/**\n * Per remote, every copy it holds \u2014 **including** ones marked `scope`, which is what separates this from\n * `liveBuilds`. That one answers \"what can this build serve others\"; this one answers \"what does this remote\n * run itself\", where a `scope` copy is precisely what it runs. Only the second question can see a torn\n * family.\n */\nexport function ownCopies(\n members: PoolMember[],\n // Callers that only judge a few remotes pay for a few: the whole pool is never needed at once.\n only?: ReadonlySet<RemoteName>\n): Map<RemoteName, OwnCopy[]> {\n const own = new Map<RemoteName, OwnCopy[]>();\n\n for (const member of members) {\n for (const version of member.external.versions) {\n for (const meta of version.remotes) {\n if (only && !only.has(meta.name)) continue;\n\n let copies = own.get(meta.name);\n if (!copies) own.set(meta.name, (copies = []));\n // A remote ships one copy per member, so a second row for one member is a record it cannot\n // produce; the first wins so such a record still reads deterministically.\n if (!copies.some(c => c.member === member.name))\n copies.push({ member: member.name, tag: version.tag, entries: meta.entries });\n }\n }\n }\n\n return own;\n}\n\n// Per remote, what it must be served. Wider than its instance: a copy marked `scope` is excluded there\n// but still consumed.\nexport function consumedMembers(members: PoolMember[]): Map<RemoteName, ExternalName[]> {\n const consumed = new Map<RemoteName, ExternalName[]>();\n\n for (const member of members) {\n const versions = member.external.versions;\n for (let v = 0; v < versions.length; v++) {\n const remotes = versions[v]!.remotes;\n for (let r = 0; r < remotes.length; r++) {\n const name = remotes[r]!.name;\n const list = consumed.get(name);\n if (!list) consumed.set(name, [member.name]);\n // Members are the outer loop, so a repeat can only be the entry just pushed.\n else if (list[list.length - 1] !== member.name) list.push(member.name);\n }\n }\n }\n\n return consumed;\n}\n\n/** `consumedMembers` in specifier space. */\nexport function consumedSpecifiers(members: PoolMember[]): Map<RemoteName, Set<Specifier>> {\n const consumed = new Map<RemoteName, Set<Specifier>>();\n\n for (const member of members) {\n const versions = member.external.versions;\n for (let v = 0; v < versions.length; v++) {\n const remotes = versions[v]!.remotes;\n for (let r = 0; r < remotes.length; r++) {\n const meta = remotes[r]!;\n let own = consumed.get(meta.name);\n if (!own) consumed.set(meta.name, (own = new Set()));\n for (const specifier in meta.entries) own.add(specifier);\n }\n }\n }\n\n return consumed;\n}\n\n/**\n * Does one build serve every specifier the pool's live copies consume? The cheap form of\n * `consumedSpecifiers` against one `liveBuilds` entry, for the only question the healthy path asks.\n *\n * Keyed by specifier, because being the basis of every *member* is not the same thing: an entrypoint the\n * basis does not carry is served from the declaring remote's own build, at that remote's own tag (see\n * \u00A7\"Entrypoint coverage and tearing\"), which is a torn package and not something a member-level test can\n * see.\n */\nexport function coversWholePool(\n members: PoolMember[],\n build: RemoteName,\n islanded: Islanded\n): boolean {\n const served = new Set<Specifier>();\n const wanted = new Set<Specifier>();\n\n for (const member of members) {\n for (const version of member.external.versions) {\n for (const meta of version.remotes) {\n if (islanded.has(meta.name)) continue;\n const into = meta.name === build ? served : wanted;\n for (const specifier in meta.entries) into.add(specifier);\n }\n }\n }\n\n for (const specifier of wanted) if (!served.has(specifier)) return false;\n return true;\n}\n\n/**\n * The build serving each member, i.e. `remotes[0]` of its shared version \u2014 skipping copies islanding has\n * taken, since those are about to self-serve. A member with no entry is served by nobody and every\n * consumer falls back to its own build.\n */\nexport function servingBuilds(\n members: PoolMember[],\n islanded: Islanded\n): Map<ExternalName, RemoteName> {\n const serving = new Map<ExternalName, RemoteName>();\n\n for (const member of members) {\n const shared = member.external.versions.find(v => v.action === 'share');\n const basis = shared?.remotes.find(r => !islanded.has(r.name));\n if (basis) serving.set(member.name, basis.name);\n }\n\n return serving;\n}\n\n/**\n * The copy whose file the global mapping publishes, per member: the first copy of the member's `share`\n * version that still runs its own build. A remote deduping onto a foreign build is skipped, because\n * publishing its file while it runs somebody else's makes the global mapping and `servedBy` name two\n * different builds for one remote (constraint 17). Order is otherwise the basis precedence `commit()`\n * established, so skipping never promotes a worse-covered copy over a better one. A member with no entry has\n * no basis left and leaves the shared set.\n */\nexport function basisPerMember(\n members: PoolMember[],\n islanded?: Islanded,\n dedupsElsewhere?: (remote: RemoteName) => boolean\n): Map<ExternalName, RemoteName> {\n const basis = new Map<ExternalName, RemoteName>();\n\n for (const member of members) {\n const winner = member.external.versions.find(v => v.action === 'share');\n if (!winner) continue;\n const own = winner.remotes.find(\n r => !islanded?.has(r.name) && !dedupsElsewhere?.(r.name)\n );\n if (own) basis.set(member.name, own.name);\n }\n\n return basis;\n}\n\n/**\n * The host, when it ships anything in this pool. A host-contributed version carries `host: true` and\n * basis precedence puts the host's own copy first on it, so `remotes[0]` of such a version is the host.\n */\nexport function hostRemotes(members: PoolMember[]): Set<RemoteName> {\n const hosts = new Set<RemoteName>();\n\n for (const member of members) {\n for (const version of member.external.versions) {\n if (version.host && version.remotes.length > 0) hosts.add(version.remotes[0]!.name);\n }\n }\n\n return hosts;\n}\n\n/** First appearance of each remote across the pool \u2014 the arrival order anchor tiebreaks read. */\nexport function arrivalOrder(members: PoolMember[]): Map<RemoteName, number> {\n const arrival = new Map<RemoteName, number>();\n\n for (const member of members) {\n for (const version of member.external.versions) {\n for (const meta of version.remotes) {\n if (!arrival.has(meta.name)) arrival.set(meta.name, arrival.size);\n }\n }\n }\n\n return arrival;\n}\n\n/**\n * The tag the global `imports` publishes per specifier. Reading the winning version's basis alone\n * understates it, which islands remotes that were never at risk.\n */\nexport function sharedTagPerSpecifier(\n members: PoolMember[],\n islanded: Islanded\n): Map<Specifier, VersionName> {\n const shared = new Map<Specifier, VersionName>();\n forEachGlobalClaim(members, islanded, (specifier, tag) => {\n if (!shared.has(specifier)) shared.set(specifier, tag);\n });\n return shared;\n}\n\n/**\n * The order `generate-import-map` fills the global `imports` in: per member the `share` version's basis first,\n * then its siblings (`mergeVersionEntries`), then the `skip` copies (`selfFillUncovered`), each filling only\n * what nobody claimed yet. Both gates decide on what a consumer would *land on*, so both read this rather than\n * the winning version alone \u2014 a package's secondary entrypoints are routinely published from a sibling copy of\n * the same tag.\n *\n * Which copies may claim is not restated here: `forEachVersionEntry` is the rule the builders publish by, so an\n * anchored copy \u2014 whose files the map names per consumer rather than globally \u2014 cannot be modelled as\n * publishing them. Islanded copies are discounted on top, being about to self-serve.\n *\n * `visit` is called in claim order for every candidate; first claim per specifier wins, which the callers\n * apply themselves so the walk stays allocation-free.\n */\nfunction forEachGlobalClaim(\n members: PoolMember[],\n islanded: Islanded | undefined,\n visit: (specifier: Specifier, tag: VersionName, meta: VersionMeta) => void\n): void {\n const accepts = islanded ? (meta: VersionMeta) => !islanded.has(meta.name) : undefined;\n const claim = (version: SharedVersion) =>\n forEachVersionEntry(version, accepts, (specifier, meta) => visit(specifier, version.tag, meta));\n\n for (const member of members) {\n const versions = member.external.versions;\n const winner = versions.find(v => v.action === 'share');\n if (winner) claim(winner);\n for (let v = 0; v < versions.length; v++) {\n if (versions[v]!.action === 'skip') claim(versions[v]!);\n }\n }\n}\n", "import type { ExternalName, RemoteName, VersionName } from 'lib/core/1.domain';\nimport type { BuildView, Coverage, FamilyInstance, PoolMember, Specifier } from './pool.types';\n\n/**\n * The gates that choose which build serves a consumer. Everything here reads **coverage** and\n * `isCompatible`; no function in this file compares two tags for distance, only for identity. The\n * projections they read are in `pool-views.ts`, the rationale in docs/version-resolver.md \u00A7\"The\n * provenance promise\".\n */\n\n/** `remote -> member -> every tag that remote's own `requiredVersion` accepts.` */\nexport type Acceptance = Map<RemoteName, Map<ExternalName, Set<VersionName>>>;\n\n/** The build serving each remote, or `undefined` where it serves its own family. */\nexport type Assignment = Map<RemoteName, RemoteName | undefined>;\n\n/**\n * Every tag each remote's own range accepts, per member. Precomputed rather than asked per\n * consumer/candidate pair, and `isCompatible` is expected to be `determine`'s memoized one \u2014 this must\n * never replicate its O(versions\u00B2) search.\n */\nexport function acceptanceTable(\n members: PoolMember[],\n isCompatible: (tag: VersionName, range: string) => boolean\n): Acceptance {\n const table: Acceptance = new Map();\n\n for (const member of members) {\n const tags: VersionName[] = [];\n for (const version of member.external.versions) tags.push(version.tag);\n\n for (const version of member.external.versions) {\n for (const meta of version.remotes) {\n let byMember = table.get(meta.name);\n if (!byMember) table.set(meta.name, (byMember = new Map()));\n if (byMember.has(member.name)) continue;\n\n const accepted = new Set<VersionName>();\n for (let t = 0; t < tags.length; t++) {\n if (isCompatible(tags[t]!, meta.requiredVersion)) accepted.add(tags[t]!);\n }\n byMember.set(member.name, accepted);\n }\n }\n }\n\n return table;\n}\n\n/** Does a build serve a superset of what a consumer imports? */\nexport function covers(coverage: Coverage, consumed: Iterable<Specifier>): boolean {\n for (const specifier of consumed) if (!coverage.has(specifier)) return false;\n return true;\n}\n\n/** Does a build offer every member a consumer needs, at a tag the consumer's own range accepts? */\nexport function acceptsAll(\n acceptance: Acceptance,\n build: FamilyInstance,\n consumer: RemoteName,\n consumed: readonly ExternalName[]\n): boolean {\n const byMember = acceptance.get(consumer);\n if (!byMember) return false;\n\n for (let i = 0; i < consumed.length; i++) {\n const offered = build.get(consumed[i]!);\n if (offered === undefined) return false;\n if (!byMember.get(consumed[i]!)?.has(offered)) return false;\n }\n\n return true;\n}\n\n/**\n * Is the combination the global mapping would hand this remote one that some live build shipped?\n *\n * All-or-nothing across the family: **every** specifier it imports has to be published at the tag that one\n * single build ships it at. Taken per specifier instead it reintroduces the defect, a combination nothing\n * compiled. Why the general form is sound and not just the remote's-own-build case: \u00A7\"Why the witness is\n * sound\".\n *\n * Asked before coverage on both paths, because a witnessed remote needs no anchor at all: asking coverage\n * first pins remotes already sitting at the shared tags onto one build for no gain.\n */\nexport function isWitnessed(\n specifiers: Iterable<Specifier>,\n shared: Map<Specifier, VersionName>,\n builds: Map<RemoteName, BuildView>\n): boolean {\n const wanted = [...specifiers];\n for (const specifier of wanted) if (!shared.has(specifier)) return false;\n\n for (const [, build] of builds) {\n let matches = true;\n for (let i = 0; i < wanted.length; i++) {\n if (build.tags.get(wanted[i]!) !== shared.get(wanted[i]!)) {\n matches = false;\n break;\n }\n }\n if (matches) return true;\n }\n return false;\n}\n\nexport type SelfServeReason = { gap: string; closest?: RemoteName };\n\n/**\n * Why no build could serve this remote, in the terms a portfolio owner can act on. Runs only for a remote\n * that is actually self-serving, so it costs nothing on a healthy portfolio.\n *\n * \"Closest\" is fewest missing entrypoints; a build that misses none failed on versions instead, and the gap\n * is then the member whose offered tag this remote's own range rejects.\n */\nexport function explainSelfServe(\n remote: RemoteName,\n wants: readonly ExternalName[],\n specifiers: Set<Specifier>,\n pool: { builds: Map<RemoteName, BuildView>; acceptance: Acceptance }\n): SelfServeReason {\n let closest: RemoteName | undefined;\n let fewest = Number.MAX_SAFE_INTEGER;\n let gap: string = wants[0] ?? '';\n\n for (const [build, view] of pool.builds) {\n if (build === remote) continue;\n\n let missing: string | undefined;\n let count = 0;\n for (const specifier of specifiers) {\n if (view.coverage.has(specifier)) continue;\n count++;\n missing ??= specifier;\n }\n if (count >= fewest) continue;\n\n fewest = count;\n closest = build;\n gap = missing ?? rejectedMember(view.instance, remote, wants, pool.acceptance) ?? gap;\n }\n\n return { gap, closest };\n}\n\n// The first member a covering build offers at a tag the consumer's own range rejects \u2014 the other way a\n// build fails the gate once coverage is satisfied.\nfunction rejectedMember(\n offered: FamilyInstance,\n consumer: RemoteName,\n wants: readonly ExternalName[],\n acceptance: Acceptance\n): string | undefined {\n const accepts = acceptance.get(consumer);\n if (!accepts) return undefined;\n\n for (const member of wants) {\n const tag = offered.get(member);\n if (tag === undefined) return member;\n if (!accepts.get(member)?.has(tag)) return `${member}@${tag}`;\n }\n return undefined;\n}\n\nexport type AnchorInput = {\n builds: Map<RemoteName, BuildView>;\n acceptance: Acceptance;\n consumedSpecifiers: Map<RemoteName, Set<Specifier>>;\n consumedMembers: Map<RemoteName, ExternalName[]>;\n hosts: Set<RemoteName>;\n arrival: Map<RemoteName, number>;\n};\n\n/**\n * Assign each consumer the build that serves it, or `undefined` where it serves its own family.\n *\n * Multi-anchor is mandatory rather than an optimisation (constraint 3): a single anchor per pool scopes\n * members nothing required to be scoped, and two remotes sharing no member already satisfy the promise.\n *\n * Greedy and deterministic, never a search. Tiebreaks in order: host, then most consumers fully covered,\n * then arrival, then name. A build chosen as an anchor **runs its own build**, so it is never itself\n * assigned elsewhere \u2014 a consumer deduping onto a remote that is itself deduping would inherit that\n * remote's foreign copies.\n */\nexport function assignAnchors(input: AnchorInput): Assignment {\n const { builds, acceptance, consumedMembers, hosts, arrival } = input;\n const assignment: Assignment = new Map();\n\n const byPriority = (a: RemoteName, b: RemoteName): number =>\n (arrival.get(a) ?? Number.MAX_SAFE_INTEGER) - (arrival.get(b) ?? Number.MAX_SAFE_INTEGER) ||\n a.localeCompare(b);\n\n const candidates = [...builds.keys()].sort(byPriority);\n const pending = new Set([...consumedMembers.keys()].sort(byPriority));\n const anchored = new Set<RemoteName>();\n\n const canServe = (candidate: RemoteName, consumer: RemoteName): boolean => {\n const build = builds.get(candidate)!;\n if (!covers(build.coverage, input.consumedSpecifiers.get(consumer) ?? [])) return false;\n return acceptsAll(acceptance, build.instance, consumer, consumedMembers.get(consumer) ?? []);\n };\n\n const electAnchor = (anchor: RemoteName, served: readonly RemoteName[]): void => {\n pending.delete(anchor);\n assignment.set(anchor, undefined);\n for (const consumer of served) {\n pending.delete(consumer);\n anchored.add(consumer);\n assignment.set(consumer, anchor);\n }\n };\n\n // The host first: its build is already in the browser, so anything it can serve is served for free. It\n // leaves `pending` either way \u2014 it is never reassigned (constraint 5), so a host that is not a candidate\n // at all must still self-serve rather than fall through to the greedy pass and be anchored onto somebody\n // else.\n for (const host of [...hosts].sort(byPriority)) {\n const served: RemoteName[] = [];\n if (builds.has(host)) {\n for (const consumer of pending) {\n if (consumer !== host && canServe(host, consumer)) served.push(consumer);\n }\n }\n electAnchor(host, served);\n }\n\n for (;;) {\n let best: RemoteName | undefined;\n let bestServed: RemoteName[] = [];\n\n for (const candidate of candidates) {\n if (anchored.has(candidate)) continue;\n const served: RemoteName[] = [];\n for (const consumer of pending) {\n if (consumer !== candidate && canServe(candidate, consumer)) served.push(consumer);\n }\n // Strictly greater, so a tie stays with the earlier candidate and the order above decides.\n if (served.length > bestServed.length) {\n best = candidate;\n bestServed = served;\n }\n }\n\n if (best === undefined) break;\n electAnchor(best, bestServed);\n }\n\n for (const consumer of pending) assignment.set(consumer, undefined);\n return assignment;\n}\n", "import type { ExternalName, shareScope } from 'lib/core/1.domain';\nimport type { LogHandler } from '../../config/log.contract';\nimport type { PoolMember, PoolName } from './pool.types';\n\n/** Matches a scoped npm package name, capturing the scope without the leading `@`. */\nconst SCOPED_PACKAGE = /^@([^/]+)\\//;\n\n// Disjoint-set union (union by size + iterative path halving \u2014 loop-based to avoid stack growth in\n// the browser). String node keys are interned to integers so the hot path indexes plain arrays.\nfunction createDSU() {\n const ids = new Map<string, number>();\n const parent: number[] = [];\n const size: number[] = [];\n\n const intern = (key: string): number => {\n let id = ids.get(key);\n if (id === undefined) {\n id = parent.length;\n ids.set(key, id);\n parent.push(id);\n size.push(1);\n }\n return id;\n };\n\n const findRoot = (x: number): number => {\n while (parent[x]! !== x) {\n parent[x] = parent[parent[x]!]!; // path halving\n x = parent[x]!;\n }\n return x;\n };\n\n return {\n union(a: string, b: string): void {\n let rootA = findRoot(intern(a));\n let rootB = findRoot(intern(b));\n if (rootA === rootB) return;\n if (size[rootA]! < size[rootB]!) [rootA, rootB] = [rootB, rootA];\n parent[rootB] = rootA;\n size[rootA] = size[rootA]! + size[rootB]!;\n },\n\n // Interns the key if unseen \u2014 an isolated key is its own component.\n component(key: string): number {\n return findRoot(intern(key));\n },\n };\n}\n\n// Namespaced node keys, NUL-separated so no kind or `(remote, \u2026)` pair can alias another. Both tag\n// and scope nodes are per remote, so every edge is remote-local and pools merge only through a\n// shared member \u2014 see docs/version-resolver.md \u00A7\"The provenance promise\", the auto-pooling bullet.\nconst extNode = (name: ExternalName): string => `ext\\x00${name}`;\nconst tagNode = (remote: string, tag: string): string => `tag\\x00${remote}\\x00${tag}`;\nconst scopeNode = (remote: string, scope: string): string => `scope\\x00${remote}\\x00${scope}`;\n\nexport type PoolEdge = { remote: string; tag: string };\n\n// A poolable external's edges: `scope` (auto-pooling, per declaring remote) and any declared `tags`.\n// `remotes` is every remote declaring the external, which is what makes auto-pooling remote-local.\n// `value` is the payload returned per member \u2014 a `SharedExternal` for init, a package name for dynamic.\nexport type PoolCandidate<T> = {\n name: ExternalName;\n scope?: string;\n tags: readonly PoolEdge[];\n remotes: readonly string[];\n value: T;\n};\n\n// npm scope of a package when auto-pooling is on (`@framework/core` -> `framework`); undefined for\n// unscoped names or when auto-pooling is off.\nexport function autoScope(name: string, useAutoExternalPooling: boolean): string | undefined {\n return useAutoExternalPooling ? SCOPED_PACKAGE.exec(name)?.[1] : undefined;\n}\n\n// The package a secondary entrypoint belongs to, or undefined when the name is already a package.\n// An npm package name carries at most one `/` (after a leading `@scope`), so any deeper segment is a\n// subpath of the package above it: `@framework/core/testing` -> `@framework/core`, `rxjs/operators`\n// -> `rxjs`.\nexport function owningPackage(name: ExternalName): ExternalName | undefined {\n const depth = name.startsWith('@') ? 2 : 1;\n let cut = -1;\n for (let seen = 0; seen < depth; seen++) {\n cut = name.indexOf('/', cut + 1);\n if (cut === -1) return undefined;\n }\n return name.slice(0, cut);\n}\n\n/**\n * Group one shareScope's candidates into pools by shared membership: pool = connected component of a\n * graph whose edges are all remote-local \u2014 `external -> scope@remote` for each remote that declares\n * it (auto-pooling) and `external -> tag@remote` for each declared tag \u2014 plus an unconditional\n * `entrypoint -> package` edge. A pool therefore forms exactly when some remote declares members\n * from both sides. See docs/version-resolver.md.\n *\n * Returns only real pools (>=2 members), keyed by and iterated in order of their canonical name\n * (smallest member \u2014 reload-stable). An explicit-tag member that pooled with nothing is warned\n * (likely typo or missing sibling); auto-scope singletons stay silent.\n */\nexport function groupByMembership<T>(\n candidates: readonly PoolCandidate<T>[],\n log?: LogHandler\n): Map<PoolName, T[]> {\n const dsu = createDSU();\n const tagged = new Set<ExternalName>();\n const joined = new Set<ExternalName>();\n\n // A `pool` tag replaces auto-pooling for the remote that declared it, per npm scope: one tag on a\n // member must not drag every other package of that scope in behind it.\n const tagRules = new Set<string>();\n for (const candidate of candidates) {\n if (candidate.scope === undefined) continue;\n for (const edge of candidate.tags) tagRules.add(`${edge.remote}\\x00${candidate.scope}`);\n }\n\n for (const candidate of candidates) {\n for (const edge of candidate.tags) {\n dsu.union(extNode(candidate.name), tagNode(edge.remote, edge.tag));\n tagged.add(candidate.name);\n joined.add(candidate.name);\n }\n if (candidate.scope === undefined) continue;\n for (const remote of candidate.remotes) {\n if (tagRules.has(`${remote}\\x00${candidate.scope}`)) continue;\n dsu.union(extNode(candidate.name), scopeNode(remote, candidate.scope));\n joined.add(candidate.name);\n }\n }\n\n // An entrypoint follows its package into whatever pool the package joins. Without this a remote\n // that tags anything in a scope drops the auto edge for its own flat entrypoints too, and they\n // leave pooling entirely \u2014 measured as a torn package.\n const declared = new Set(candidates.map(c => c.name));\n for (const candidate of candidates) {\n const owner = owningPackage(candidate.name);\n if (owner !== undefined && declared.has(owner))\n dsu.union(extNode(candidate.name), extNode(owner));\n }\n\n const byComponent = new Map<number, { name: ExternalName; value: T }[]>();\n for (const candidate of candidates) {\n const root = dsu.component(extNode(candidate.name));\n const members = byComponent.get(root) ?? byComponent.set(root, []).get(root)!;\n members.push({ name: candidate.name, value: candidate.value });\n }\n\n const pools: { name: ExternalName; value: T }[][] = [];\n for (const members of byComponent.values()) {\n // Joinedness is a property of the component, not of one member: an entrypoint contributes no edge\n // of its own yet pools with the package that does.\n if (!members.some(m => joined.has(m.name))) continue;\n\n members.sort((a, b) => a.name.localeCompare(b.name));\n if (members.length < 2) {\n const only = members[0]!;\n if (tagged.has(only.name)) {\n log?.warn(\n 3,\n `[${only.name}] declares a 'pool' tag but no other external joined its pool; likely a typo or a missing sibling.`\n );\n }\n continue;\n }\n pools.push(members);\n }\n\n pools.sort((a, b) => a[0]!.name.localeCompare(b[0]!.name));\n return new Map(pools.map(members => [members[0]!.name, members.map(m => m.value)]));\n}\n\n/** Init-path grouping: build candidates from the stored shared externals of one shareScope. */\nexport function buildPools(\n sharedExternals: shareScope,\n useAutoExternalPooling: boolean,\n log?: LogHandler\n): Map<PoolName, PoolMember[]> {\n const candidates = Object.entries(sharedExternals).map<PoolCandidate<PoolMember>>(\n ([name, external]) => ({\n name,\n scope: autoScope(name, useAutoExternalPooling),\n tags: external.versions.flatMap(v =>\n v.remotes.flatMap(r => {\n const tag = r.pool?.trim();\n return tag ? [{ remote: r.name, tag }] : [];\n })\n ),\n remotes: external.versions.flatMap(v => v.remotes.map(r => r.name)),\n value: { name, external },\n })\n );\n return groupByMembership(candidates, log);\n}\n", "import type { RemoteName } from 'lib/core/1.domain';\nimport type { ForSharedExternalsStorage } from '../../driving-ports/for-shared-externals-storage.port';\nimport type { ModeConfig } from '../../config/mode.contract';\nimport type { PoolMember } from './pool.types';\n\n// A projection built at most once, and only if a gate gets far enough to ask for it. Both pooling steps\n// iterate to a fixed point over views that do not change between rounds.\nexport function lazy<T>(make: () => T): () => T {\n let value: T | undefined;\n return () => (value ??= make());\n}\n\nexport function remotesInPool(members: PoolMember[]): RemoteName[] {\n return [\n ...new Set(members.flatMap(m => m.external.versions.flatMap(v => v.remotes.map(r => r.name)))),\n ];\n}\n\n/**\n * The scopes either pooling step has anything to do in. With auto-pooling off only a scope that carries a\n * `pool` tag of its own can pool anything, and a pool never spans share scopes \u2014 so one tag must not put\n * every other scope through a graph build. Auto-pooling on must never early-out, since any scoped package is\n * potentially poolable. The `strict` scope is never pooled.\n *\n * Names only, so a caller that decides to skip a scope never reads it out of storage.\n */\nexport function poolableScopes(\n config: ModeConfig,\n repo: Pick<ForSharedExternalsStorage, 'getScopes' | 'scopeType' | 'hasPoolTag'>\n): { useAutoExternalPooling: boolean; scopes: string[] } {\n const { useAutoExternalPooling } = config.feature;\n\n return {\n useAutoExternalPooling,\n scopes: repo\n .getScopes()\n .filter(\n scope =>\n repo.scopeType(scope) !== 'strict' && (useAutoExternalPooling || repo.hasPoolTag(scope))\n ),\n };\n}\n", "import type { ForPoolingSharedExternals } from '../../driver-ports/init/for-pooling-shared-externals.port';\nimport type { TouchedExternals } from '../../driver-ports/init/for-determining-shared-externals.port';\nimport type {\n ExternalName,\n RemoteName,\n SharedExternal,\n SharedVersion,\n SharedVersionMeta,\n VersionName,\n} from 'lib/core/1.domain';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { DrivingContract } from '../../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../../config/log.contract';\nimport type { ModeConfig } from '../../config/mode.contract';\nimport {\n arrivalOrder,\n basisPerMember,\n consumedMembers,\n consumedSpecifiers,\n coversWholePool,\n hostRemotes,\n liveBuilds,\n ownCopies,\n servingBuilds,\n sharedTagPerSpecifier,\n} from './pool-views';\nimport {\n acceptanceTable,\n assignAnchors,\n explainSelfServe,\n isWitnessed,\n type Acceptance,\n} from './anchoring';\nimport { buildPools } from './pool-graph';\nimport { lazy, poolableScopes, remotesInPool } from './pool.util';\nimport type { Islanded, PoolMember, PoolName, Specifier } from './pool.types';\n\ntype IslandCause =\n // determine marked one of its versions `scope`: a genuine range violation.\n | { kind: 'incompatible'; member: ExternalName; tag: VersionName }\n // No build in the pool serves everything it consumes at versions it accepts, and no build witnesses the\n // combination the global mapping offers it either. `gap` is what the closest build fell short on.\n | { kind: 'uncovered'; gap: string; closest?: RemoteName }\n // The record about to be written would hand it members from builds that never shipped them together.\n // See `findTornRemotes` for why this is checked when no portfolio is known to reach it.\n | { kind: 'torn'; combination: string };\n\n/**\n * Per remote, the members it must be served from a build other than that member's own basis \u2014 an anchor's,\n * or its own where it is an anchor for somebody else. Absent means the default: the copy resolves through\n * the global mapping, which is right whenever the shared tag is already the remote's own.\n */\ntype Served = Map<RemoteName, Map<ExternalName, RemoteName>>;\n\n/** The build serving each remote the gate moved, itself where it serves its own family. */\ntype ServingBuild = Map<RemoteName, RemoteName>;\n\n/** Projections gate 2 reads that no round of it can change. */\ntype GateViews = {\n consumedSpecifiers: () => Map<RemoteName, Set<Specifier>>;\n acceptance: () => Acceptance;\n arrival: () => Map<RemoteName, number>;\n};\n\n/**\n * Gate 1: remotes that are strict-incompatible on any member, islanded across the WHOLE family. Reads\n * stored actions only \u2014 pooling makes no compatibility call.\n *\n * Sound only because `mark-pools-for-reelection` re-elects a pool as a unit, which makes every `scope` seen\n * here determine's own rather than an island `rebuildMember` persisted for an earlier portfolio.\n */\nfunction islandedRemotes(members: PoolMember[]): Map<RemoteName, IslandCause> {\n const islanded = new Map<RemoteName, IslandCause>();\n for (const member of members)\n for (const version of member.external.versions)\n if (version.action === 'scope')\n for (const remote of version.remotes)\n if (!islanded.has(remote.name))\n islanded.set(remote.name, {\n kind: 'incompatible',\n member: member.name,\n tag: version.tag,\n });\n return islanded;\n}\n\nconst basisFor = (\n members: PoolMember[],\n islanded: Islanded,\n serving: ServingBuild\n): Map<ExternalName, RemoteName> =>\n basisPerMember(members, islanded, remote => {\n const build = serving.get(remote);\n return build !== undefined && build !== remote;\n });\n\n// Only where the serving build differs from what the global mapping already publishes: a remote whose\n// anchor *is* the basis resolves through `imports` and needs no scope entry at all.\nfunction servedPerRemote(\n consumed: Map<RemoteName, ExternalName[]>,\n serving: ServingBuild,\n basis: Map<ExternalName, RemoteName>\n): Served {\n const served: Served = new Map();\n\n for (const [remote, build] of serving) {\n const byMember = new Map<ExternalName, RemoteName>();\n for (const name of consumed.get(remote) ?? []) {\n if (basis.get(name) !== build) byMember.set(name, build);\n }\n if (byMember.size > 0) served.set(remote, byMember);\n }\n\n return served;\n}\n\n// Whether the stored record still names an anchor for anybody. A pool that needs no anchor this election is\n// only a no-op if the record agrees: a `servedBy` from an earlier portfolio would keep pointing the map at a\n// build gate 2 did not choose this time, and `rebuildMember` is what clears it.\nconst anyAnchorStored = (members: PoolMember[]): boolean =>\n members.some(m => m.external.versions.some(v => v.remotes.some(r => r.servedBy !== undefined)));\n\n/**\n * The no-tear guarantee, checked on what is about to be written rather than argued from the gates: every\n * non-host remote must resolve a `(specifier \u2192 tag)` combination that some single build shipped. Which remote\n * serves a tag is free \u2014 two builds at one tag are interchangeable providers \u2014 so this compares tags only,\n * never origins. A host is never judged: it cannot be repointed onto another build.\n *\n * Keyed by specifier like everything else in the design, not by member: a specifier no copy of the winning\n * version bundles is published from a `skip` copy at that version's tag (`selfFillUncovered`), so a\n * member-level check reads one tag for a package the remote really resolves at two. Copies of the winning\n * tag merging their entrypoints (`mergeVersionEntries`) never do this \u2014 one tag, nothing to tear.\n *\n * No portfolio is known to reach a tear through `poolFamily` \u2014 the gates leave it true \u2014 and it is checked\n * regardless, because it is the one thing pooling exists to prevent and because `rebuildMember`'s last rule\n * (a copy whose member lost its basis self-serves) is decided after gate 2 has stopped looking. Exported so\n * `find-torn-remotes.spec.ts` can pin the contract on hand-built input, the only way to reach it.\n */\nexport function findTornRemotes(\n members: PoolMember[],\n islanded: Islanded,\n basis: Map<ExternalName, RemoteName>,\n served: Served,\n hosts: ReadonlySet<RemoteName>\n): { remote: RemoteName; combination: string }[] {\n const { suspect, selfServed } = movedRemotes(members, islanded, basis, served, hosts);\n if (suspect.size === 0) return [];\n\n const builds = liveBuilds(members, islanded);\n // What the global `imports` publishes per specifier \u2014 not the member's basis, which understates it\n // exactly where a tear hides.\n const shared = sharedTagPerSpecifier(members, islanded);\n const own = ownCopies(members, suspect);\n const torn: { remote: RemoteName; combination: string }[] = [];\n\n for (const remote of suspect) {\n const copies = own.get(remote) ?? [];\n const mine = selfServed.get(remote);\n const anchors = served.get(remote);\n // Its own tags are read from every row, `scope` included: a copy about to self-serve is what a tear is\n // made of, and `liveBuilds` leaves those out by design.\n const ownTags = new Map<Specifier, VersionName>();\n const resolved = new Map<Specifier, VersionName>();\n\n for (const copy of copies) {\n // A copy `rebuildMember` will scope resolves itself whatever the member's basis is; otherwise an\n // explicit anchor, else the global mapping \u2014 and where that publishes nothing, nobody serves the\n // specifier and there is no combination to judge.\n const from = mine?.has(copy.member) ? remote : anchors?.get(copy.member);\n\n for (const specifier in copy.entries) {\n if (!ownTags.has(specifier)) ownTags.set(specifier, copy.tag);\n\n const tag =\n from === remote\n ? copy.tag\n : from !== undefined\n ? builds.get(from)?.tags.get(specifier)\n : shared.get(specifier);\n if (tag !== undefined && !resolved.has(specifier)) resolved.set(specifier, tag);\n }\n }\n if (resolved.size === 0) continue;\n\n // Its own build first: a remote running its whole family from itself is coherent by definition, and\n // that is where a self-serving copy has just put it.\n if (ships(ownTags, resolved)) continue;\n\n let witnessed = false;\n for (const [, build] of builds) {\n if (ships(build.tags, resolved)) {\n witnessed = true;\n break;\n }\n }\n\n if (!witnessed) {\n torn.push({\n remote,\n combination: [...resolved].map(([specifier, tag]) => `${specifier}@${tag}`).join(', '),\n });\n }\n }\n\n return torn;\n}\n\nconst ships = (\n build: Map<Specifier, VersionName> | undefined,\n resolved: Map<Specifier, VersionName>\n): boolean => {\n if (!build) return false;\n for (const [specifier, tag] of resolved) if (build.get(specifier) !== tag) return false;\n return true;\n};\n\n/**\n * The only remotes whose resolution pooling can have changed, and so the only ones worth checking: one it\n * anchored elsewhere, one consuming a member nothing publishes any more, or one holding a `scope` copy\n * without being islanded \u2014 which gate 1 makes impossible and is covered anyway, since it is the shape a tear\n * would take if that ever stopped holding. Everything else resolves the global mapping wholesale, exactly as\n * gate 2 witnessed it.\n *\n * `selfServed` is what each of them must serve itself, mirroring `rebuildMember` so the two cannot drift.\n */\nfunction movedRemotes(\n members: PoolMember[],\n islanded: Islanded,\n basis: Map<ExternalName, RemoteName>,\n served: Served,\n hosts: ReadonlySet<RemoteName>\n): { suspect: Set<RemoteName>; selfServed: Map<RemoteName, Set<ExternalName>> } {\n const suspect = new Set<RemoteName>();\n const selfServed = new Map<RemoteName, Set<ExternalName>>();\n\n const add = (remote: RemoteName) => {\n if (!islanded.has(remote) && !hosts.has(remote)) suspect.add(remote);\n };\n\n for (const remote of served.keys()) add(remote);\n\n for (const member of members) {\n const unpublished = !basis.has(member.name);\n for (const version of member.external.versions) {\n const scoped = version.action === 'scope';\n if (!unpublished && !scoped) continue;\n\n for (const meta of version.remotes) {\n add(meta.name);\n // A scoped copy always serves itself, and a clean copy of a member nothing publishes any more does\n // too \u2014 unless pooling gave it an anchor, which is the one thing that keeps such a copy deduping.\n const servesItself =\n scoped || (unpublished && served.get(meta.name)?.get(member.name) === undefined);\n if (!servesItself) continue;\n\n let mine = selfServed.get(meta.name);\n if (!mine) selfServed.set(meta.name, (mine = new Set()));\n mine.add(member.name);\n }\n }\n }\n\n return { suspect, selfServed };\n}\n\nexport function createPoolSharedExternals(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'sharedExternalsRepo' | 'versionCheck'>\n): ForPoolingSharedExternals {\n /**\n * Runs after determine-shared-externals: per pool, gate 1 islands a remote that is version-incompatible on\n * any member and gate 2 decides, for every other remote, whether it may take the dedups determine granted\n * it. Emits nothing, only mutates `SharedExternal.versions`. See docs/version-resolver.md \u00A7\"How pooling\n * resolves\".\n *\n * `touched` (determine's re-elected externals per scope) gates the work: a pool no member of which was\n * re-elected resolves to what storage already holds, so a warm init does no per-member work at all. Because\n * `mark-pools-for-reelection` runs first, a touched pool is a *wholly* re-elected one, which is what makes\n * gate 1 sound.\n */\n return (touched?: TouchedExternals) => {\n const { useAutoExternalPooling, scopes } = poolableScopes(config, ports.sharedExternalsRepo);\n\n for (const scope of scopes) {\n const touchedInScope = touched?.get(scope);\n if (touched && !touchedInScope) continue;\n\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(scope);\n\n try {\n for (const [poolName, members] of buildPools(\n sharedExternals,\n useAutoExternalPooling,\n config.log\n )) {\n if (touchedInScope && !members.some(m => touchedInScope.has(m.name))) continue;\n poolFamily(poolName, members, scope);\n }\n } catch (error) {\n if (error instanceof NFError) return Promise.reject(error);\n config.log.error(3, `[${scope}] failed to pool shared externals.`, {\n sharedExternals,\n error,\n });\n return Promise.reject(\n new NFError(`Could not pool shared externals in scope ${scope}.`, error as Error)\n );\n }\n }\n return Promise.resolve();\n };\n\n function poolFamily(poolName: PoolName, members: PoolMember[], scope: string): void {\n // Below 2 members across 2 remotes there is nothing to coordinate; the per-external result is already\n // coherent.\n if (members.length < 2) return;\n\n const allRemotes = remotesInPool(members);\n if (allRemotes.length < 2) return;\n\n const islanded = islandedRemotes(members);\n const consumed = consumedMembers(members);\n const hosts = hostRemotes(members);\n\n // None of these three depend on `islanded`, so they survive every round of the coverage gate and every\n // re-assignment the no-tear loop asks for \u2014 and the healthy path never asks for them at all.\n const views: GateViews = {\n consumedSpecifiers: lazy(() => consumedSpecifiers(members)),\n acceptance: lazy(() => acceptanceTable(members, ports.versionCheck.isCompatible)),\n arrival: lazy(() => arrivalOrder(members)),\n };\n\n config.log.debug(\n 3,\n `[${scope}][pool:${poolName}] ${members.length} members across ${allRemotes.length} remotes, incompatible={${[...islanded.keys()].join(', ') || '\u2205'}}\\n` +\n members.map(m => ` - ${m.name}`).join('\\n')\n );\n\n const assign = () => {\n const serving = assignServingBuilds(members, islanded, consumed, hosts, views);\n const basis = basisFor(members, islanded, serving);\n return { serving, basis, served: servedPerRemote(consumed, serving, basis) };\n };\n\n let { serving, basis, served } = assign();\n\n // Nothing to island and nothing reassigned: determine's verdicts already stand for every member, so\n // rebuilding them would write back what storage holds \u2014 unless the record still carries an anchor this\n // election did not grant, which has to be cleared or the map keeps honouring it.\n if (islanded.size === 0 && serving.size === 0 && !anyAnchorStored(members)) return;\n\n // A torn remote is islanded \u2014 self-serving a whole family is always coherent \u2014 and the assignment redone,\n // since taking a build away can move everyone who was deduping onto it. Terminates for the same reason\n // the coverage gate does: each round islands at least one more remote.\n for (;;) {\n const torn = findTornRemotes(members, islanded, basis, served, hosts);\n if (torn.length === 0) break;\n\n for (const { remote, combination } of torn)\n islanded.set(remote, { kind: 'torn', combination });\n ({ serving, basis, served } = assign());\n }\n\n // Defensive: determine already throws on real incompatibilities under strictExternalCompatibility. A\n // remote serving its own family for lack of coverage is not one of them (constraint 10) \u2014 nothing about\n // its versions is wrong, so it must not turn a strict portfolio into a failure.\n const incompatible = [...islanded]\n .filter(([, cause]) => cause.kind === 'incompatible')\n .map(([remote]) => remote);\n if (config.strict.strictExternalCompatibility && incompatible.length > 0) {\n config.log.error(\n 3,\n `[${scope}][pool:${poolName}] version-incompatible remotes cannot be pooled: {${incompatible.join(', ')}}.`\n );\n throw new NFError(`Could not pool '${poolName}' in scope ${scope}.`);\n }\n\n for (const [remote, cause] of islanded) {\n // What scopes is what this remote has a copy of, which in a ragged pool is fewer than the pool.\n const scoped = consumed.get(remote)?.length ?? 0;\n config.log.warn(3, `[${scope}][pool:${poolName}] ${islandWarning(remote, cause, scoped)}`);\n }\n\n for (const member of members) {\n const rebuilt = rebuildMember(member, islanded, served, basis.get(member.name));\n warnIfScopedOnly(poolName, member, rebuilt, islanded, scope);\n ports.sharedExternalsRepo.addOrUpdate(member.name, rebuilt, scope);\n }\n }\n\n /**\n * Gate 2: the witness first, then one build that serves a **superset** of what the remote consumes at\n * versions its own `requiredVersion` accepts, else it serves its whole family itself. No tag distance is\n * read anywhere, which is what stops a family split no build witnesses passing as benign patch drift.\n *\n * Repeats, and only after a round that scoped someone: scoping a remote removes it as a serving build,\n * which can leave a member unserved and push another remote onto its own build.\n */\n function assignServingBuilds(\n members: PoolMember[],\n islanded: Map<RemoteName, IslandCause>,\n consumed: Map<RemoteName, ExternalName[]>,\n hosts: Set<RemoteName>,\n views: GateViews\n ): ServingBuild {\n for (;;) {\n const bases = servingBuilds(members, islanded);\n\n // One build serves every member *and* every entrypoint anyone consumes, so the map hands every copy\n // that single build and gate 2 below would witness all of them. The healthy-portfolio path: no\n // per-build views, no acceptance table, no assignment, nothing written. Being the basis of every\n // member is not sufficient on its own \u2014 see `coversWholePool`.\n const distinct = new Set(bases.values());\n if (distinct.size === 1 && bases.size === members.length) {\n const sole = [...distinct][0]!;\n if (coversWholePool(members, sole, islanded)) return new Map();\n }\n\n const builds = liveBuilds(members, islanded);\n const shared = sharedTagPerSpecifier(members, islanded);\n const consumedSpec = views.consumedSpecifiers();\n\n const needAnchor = new Map<RemoteName, ExternalName[]>();\n const needSpecifiers = new Map<RemoteName, Set<Specifier>>();\n for (const [remote, wants] of consumed) {\n if (islanded.has(remote)) continue;\n if (isWitnessed(consumedSpec.get(remote) ?? [], shared, builds)) continue;\n needAnchor.set(remote, wants);\n needSpecifiers.set(remote, consumedSpec.get(remote) ?? new Set());\n }\n\n if (needAnchor.size === 0) return new Map();\n\n const acceptance = views.acceptance();\n const assignment = assignAnchors({\n builds,\n acceptance,\n consumedSpecifiers: needSpecifiers,\n consumedMembers: needAnchor,\n hosts,\n arrival: views.arrival(),\n });\n\n // A build somebody else dedups onto has to run its own copies of what it hands out, or the files it\n // serves would bind their peers against a different build one hop in (constraint 4).\n const anchors = new Set<RemoteName>();\n for (const build of assignment.values()) if (build !== undefined) anchors.add(build);\n\n const serving: ServingBuild = new Map();\n let scoped = false;\n\n for (const [remote, wants] of needAnchor) {\n const assigned = assignment.get(remote);\n const build = assigned ?? (anchors.has(remote) || hosts.has(remote) ? remote : undefined);\n\n if (build === undefined) {\n islanded.set(remote, {\n kind: 'uncovered',\n ...explainSelfServe(remote, wants, needSpecifiers.get(remote)!, { builds, acceptance }),\n });\n scoped = true;\n continue;\n }\n\n serving.set(remote, build);\n }\n\n if (!scoped) return serving;\n }\n }\n\n // Warn only when sharing was genuinely possible and lost: a scoped-only member with >1 consumer. A\n // single-consumer member is one download either way, so pooling could not have improved it.\n function warnIfScopedOnly(\n poolName: PoolName,\n member: PoolMember,\n rebuilt: SharedExternal,\n islanded: Islanded,\n scope: string\n ): void {\n if (rebuilt.versions.some(v => v.action === 'share')) return;\n // Only the scoped copies really download their own file: a copy that lost the global mapping but\n // carries a `servedBy` still dedups, onto its anchor's build, and saying otherwise would be false.\n const consumers = new Set(\n rebuilt.versions.filter(v => v.action === 'scope').flatMap(v => v.remotes.map(r => r.name))\n ).size;\n if (consumers < 2) return;\n\n // An island took this member's last provider: its own warning already named the cause, and this one\n // would only restate the effect.\n const provider = member.external.versions.find(v => v.action === 'share');\n if (provider?.remotes.some(r => islanded.has(r.name))) return;\n\n config.log.warn(\n 3,\n `[${scope}][pool:${poolName}] '${member.name}' is scoped-only \u2014 no coherent shared build provides it; ${consumers} remotes download their own copy.`\n );\n }\n\n // Island-or-defer at remote-copy granularity: islanded (or already-`scope`) copies self-serve; every\n // other copy keeps its base verdict, plus the build serving it whenever that is not the member's own\n // basis, so the map can point it at another origin's files. Scope versions group by each copy's real tag.\n //\n // `basis` is the copy the global mapping publishes; `undefined` means none is left and the member leaves\n // the shared set (constraint 15).\n function rebuildMember(\n member: PoolMember,\n islanded: Islanded,\n served: Served,\n basis: RemoteName | undefined\n ): SharedExternal {\n type Entry = {\n remote: RemoteName;\n tag: VersionName;\n host: boolean;\n action: SharedVersion['action'];\n meta: SharedVersionMeta;\n };\n\n let scoped: Entry[] = [];\n let clean: Entry[] = [];\n\n for (const version of member.external.versions) {\n for (const meta of version.remotes) {\n const entry: Entry = {\n remote: meta.name,\n tag: version.tag,\n host: version.host,\n action: version.action,\n meta,\n };\n (islanded.has(entry.remote) || entry.action === 'scope' ? scoped : clean).push(entry);\n }\n }\n\n // A copy about to self-serve runs its own file, so an anchor left on it from an earlier portfolio\n // would outlive the verdict it belonged to \u2014 and `servedBy` is persisted, read on the dynamic path as\n // \"this build dedups onto somebody else\" and there disqualifies the island as a serving build.\n for (const entry of scoped) delete entry.meta.servedBy;\n\n for (const entry of clean) {\n const build = served.get(entry.remote)?.get(member.name);\n if (build !== undefined) entry.meta.servedBy = build;\n else delete entry.meta.servedBy;\n }\n\n // No basis left: nothing publishes this member, so a copy that was resolving through the global mapping\n // has nowhere to go and self-serves. A copy with a `servedBy` is mapped explicitly and keeps its dedup \u2014\n // sweeping it too is what made N providers of one tag download N copies (constraint 15).\n if (basis === undefined) {\n scoped = [...scoped, ...clean.filter(e => e.meta.servedBy === undefined)];\n clean = clean\n .filter(e => e.meta.servedBy !== undefined)\n .map(e => ({ ...e, action: 'skip' as const }));\n }\n\n // Basis first: `remotes[0]` is what the global mapping and a later re-election read as the serving copy,\n // and only a copy that runs its own build may be it.\n const shareEntries = clean\n .filter(e => e.action === 'share')\n .sort((a, b) => Number(b.remote === basis) - Number(a.remote === basis));\n const shareVersion: SharedVersion[] =\n shareEntries.length > 0\n ? [\n {\n tag: shareEntries[0]!.tag,\n host: shareEntries[0]!.host,\n action: 'share',\n remotes: shareEntries.map(e => e.meta),\n },\n ]\n : [];\n\n const byTag = (entries: Entry[], action: 'skip' | 'scope'): SharedVersion[] => {\n const versions = new Map<VersionName, SharedVersion>();\n for (const entry of entries) {\n const version = versions.get(entry.tag) ?? {\n tag: entry.tag,\n host: entry.host,\n action,\n remotes: [],\n };\n version.remotes.push(entry.meta);\n versions.set(entry.tag, version);\n }\n return [...versions.values()];\n };\n\n // Descending by tag, the order `commit()` guarantees and `determine` reads as \"the latest\" \u2014 see\n // store-remote-entry.version-order.spec.ts. Grouping by action would break it, and a later init\n // re-elects this record without `commit()` ever passing over it again.\n return {\n dirty: false,\n versions: [\n ...shareVersion,\n ...byTag(\n clean.filter(e => e.action === 'skip'),\n 'skip'\n ),\n ...byTag(scoped, 'scope'),\n ].sort((a, b) => ports.versionCheck.compare(b.tag, a.tag)),\n };\n }\n}\n\nfunction islandWarning(remote: RemoteName, cause: IslandCause, scoped: number): string {\n // Deliberately worded apart: an incompatibility is a version the portfolio cannot honour, a coverage\n // self-serve is a family nothing shipped together. Three test helpers parse these sentences.\n switch (cause.kind) {\n case 'incompatible':\n return `'${remote}' is islanded: the resolver scoped its '${cause.member}@${cause.tag}', so all ${scoped} members it imports are scoped for it.`;\n case 'torn':\n return `'${remote}' serves its own family: the mapping would have handed it ${cause.combination}, which no build shipped together, so all ${scoped} members it imports are scoped for it.`;\n default: {\n const closest = cause.closest\n ? `closest is '${cause.closest}'`\n : 'no other build in the pool serves any of it';\n return `'${remote}' serves its own family: no shared build offers every entrypoint it imports at a version it accepts \u2014 '${cause.gap}' is the gap, ${closest}. All ${scoped} members it imports are scoped for it.`;\n }\n }\n}\n", "import type { ForMarkingPoolsForReelection } from '../../driver-ports/init/for-marking-pools-for-reelection.port';\nimport type { DrivingContract } from '../../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../../config/log.contract';\nimport type { ModeConfig } from '../../config/mode.contract';\nimport { buildPools } from './pool-graph';\nimport { poolableScopes } from './pool.util';\n\nexport function createMarkPoolsForReelection(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'sharedExternalsRepo'>\n): ForMarkingPoolsForReelection {\n /**\n * Runs between process-remote-entries and determine-shared-externals: a pool is one unit of state, so\n * whenever any member is dirty every member is marked dirty and `determine` re-elects the pool whole.\n *\n * Without this, pooling reads back its own `scope` verdicts for members no remote touched this init and\n * gate 1 cannot tell them from a range violation `determine` just found. See\n * docs/version-resolver.md \u00A7\"How pooling resolves\".\n */\n return () => {\n const { useAutoExternalPooling, scopes } = poolableScopes(config, ports.sharedExternalsRepo);\n\n for (const scope of scopes) {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(scope);\n\n // Nothing dirty in the scope \u21D2 no pool has a dirty member \u21D2 nothing to spread, so skip before\n // building the graph. Measured, this was the whole pooling cost of a warm init.\n if (!Object.values(sharedExternals).some(external => external.dirty)) continue;\n\n let spread = 0;\n\n // Mutates the stored records in place; nothing is written, so a scope with nothing dirty stays\n // untouched and `commit()` has no reason to fire.\n for (const [, members] of buildPools(sharedExternals, useAutoExternalPooling)) {\n if (!members.some(m => m.external.dirty)) continue;\n for (const member of members)\n if (!member.external.dirty) {\n member.external.dirty = true;\n spread++;\n }\n }\n\n if (spread > 0)\n config.log.debug(3, `[${scope}] ${spread} pool member(s) marked dirty for re-election.`);\n }\n\n return Promise.resolve();\n };\n}\n", "var BuildNotificationType = /* @__PURE__ */ ((BuildNotificationType2) => {\n BuildNotificationType2[\"COMPLETED\"] = \"federation-rebuild-complete\";\n BuildNotificationType2[\"ERROR\"] = \"federation-rebuild-error\";\n BuildNotificationType2[\"CANCELLED\"] = \"federation-rebuild-cancelled\";\n return BuildNotificationType2;\n})(BuildNotificationType || {});\nexport {\n BuildNotificationType\n};\n", "const CHUNK_PREFIX = \"@nf-internal\";\nfunction toChunkImport(fileName) {\n if (fileName.startsWith(\"./\")) {\n fileName = fileName.slice(2);\n }\n const packageName = fileName.replace(/.(m|c)?js$/, \"\");\n return CHUNK_PREFIX + \"/\" + packageName;\n}\nexport {\n CHUNK_PREFIX,\n toChunkImport\n};\n", "import type { ForGeneratingImportMap } from '../driver-ports/init/for-generating-import-map';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { ImportMap, Imports } from 'lib/core/1.domain/import-map/import-map.contract';\nimport {\n GLOBAL_SCOPE,\n type RemoteName,\n type ScopedExternal,\n type RemoteInfo,\n type SharedExternal,\n type SharedVersion,\n type SharedVersionMeta,\n} from 'lib/core/1.domain';\nimport { versionEntries } from 'lib/core/1.domain/externals/basis';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\nimport * as _path from 'lib/utils/path';\nimport { NFError } from 'lib/core/native-federation.error';\nimport { toChunkImport } from '@softarc/native-federation/domain';\n\nexport function createGenerateImportMap(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n 'remoteInfoRepo' | 'scopedExternalsRepo' | 'sharedChunksRepo' | 'sharedExternalsRepo'\n >\n): ForGeneratingImportMap {\n /**\n * Step 4: Generate an importMap from the cached remoteEntries\n *\n * The processed externals in the storage/cache (step 2 & 3) are used\n * to generate an importMap. The step returns the generated importMap object.\n */\n return () => {\n const importMap: ImportMap = { imports: {} };\n const chunkBundles: Record<string, Set<string>> = {};\n try {\n addScopedExternals(importMap, chunkBundles);\n addshareScopeExternals(importMap, chunkBundles);\n addGlobalSharedExternals(importMap, chunkBundles);\n addRemoteInfos(importMap, chunkBundles);\n\n addChunkImports(importMap, chunkBundles);\n\n return Promise.resolve(importMap);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n\n /**\n * Step 4.1: Begin with appending smallest scope of shared dependencies\n * @param importMap\n * @returns\n */\n function addScopedExternals(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>\n ): ImportMap {\n const scopedExternals = ports.scopedExternalsRepo.getAll();\n\n for (const [remoteName, externals] of Object.entries(scopedExternals)) {\n const remote = ports.remoteInfoRepo.tryGet(remoteName).orThrow(() => {\n config.log.error(4, `[scoped][${remoteName}] Remote name not found in cache.`);\n return new NFError('Could not create ImportMap.');\n });\n addToScope(importMap, remote.scopeUrl, createScopeModules(externals, remote.scopeUrl));\n\n for (const version of Object.values(externals)) {\n for (const file of Object.values(version.entries)) {\n addIntegrity(importMap, _path.join(remote.scopeUrl, file), remoteName, file);\n }\n }\n\n Object.values(externals)\n .filter(e => !!e.bundle)\n .forEach(e => registerBundleChunks(chunkBundles, remoteName, e.bundle));\n }\n\n return importMap;\n }\n\n function createScopeModules(externals: ScopedExternal, scope: string): Imports {\n const modules: Imports = {};\n\n for (const version of Object.values(externals)) {\n for (const [packageName, file] of Object.entries(version.entries)) {\n modules[packageName] = _path.join(scope, file);\n }\n }\n\n return modules;\n }\n\n /**\n * Step 4.2: Added the shareScope externals, overriding the scoped externals that are shared\n * @param importMap\n * @returns\n */\n function addshareScopeExternals(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>\n ): ImportMap {\n const shareScopes = ports.sharedExternalsRepo.getScopes({ includeGlobal: false });\n\n for (const shareScope of shareScopes) {\n processshareScope(importMap, shareScope, chunkBundles);\n }\n\n return importMap;\n }\n\n function processshareScope(\n importMap: ImportMap,\n shareScope: string,\n chunkBundles: Record<string, Set<string>>\n ): void {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope(shareScope);\n const index = buildServedIndex(sharedExternals);\n\n for (const [externalName, external] of Object.entries(sharedExternals)) {\n let override: SharedVersion | undefined | 'NOT_AVAILABLE' = undefined;\n const cachedBefore = cachedFingerprint(external);\n\n for (const version of external.versions) {\n if (version.action === 'scope') {\n for (const remote of version.remotes) {\n const remoteScope = getScope(shareScope, remote.name, externalName);\n for (const [packageName, file] of Object.entries(remote.entries)) {\n const url = _path.join(remoteScope, file);\n addToScope(importMap, remoteScope, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n }\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n remote.cached = true;\n }\n continue;\n }\n\n version.remotes[0]!.cached = true;\n\n // Serve every entrypoint from one version: this one, or the override version when a\n // 'skip' is redirected elsewhere. Within a version the copies merge, so the surface is\n // the union of what they bundle, each specifier from the copy that declares it.\n let serving = version;\n\n if (version.action === 'skip') {\n if (!override) {\n override = findOverride(external, shareScope, externalName) ?? 'NOT_AVAILABLE';\n }\n if (override !== 'NOT_AVAILABLE') {\n serving = override;\n version.remotes[0]!.cached = false;\n }\n }\n\n const provided = versionEntries(serving);\n const mappings: { packageName: string; url: string; name: RemoteName; file: string }[] = [];\n\n for (const [packageName, provider] of provided) {\n const file = provider.entries[packageName]!;\n mappings.push({\n packageName,\n url: _path.join(getScope(shareScope, provider.name, externalName), file),\n name: provider.name,\n file,\n });\n provider.cached = true;\n if (version.action === 'share') {\n registerBundleChunks(chunkBundles, provider.name, provider.bundle);\n }\n }\n\n version.remotes.forEach(r => {\n const rScope = getScope(shareScope, r.name, externalName);\n // Pooling anchored this remote on another build, so its scope names that build's files for\n // everything it imports rather than the shared source's.\n if (index && r.servedBy) {\n const files = index.get(r.servedBy);\n const servedScope = getScope(shareScope, r.servedBy, externalName);\n for (const specifier of Object.keys(r.entries)) {\n const source = files?.get(specifier);\n if (!source) continue;\n const url = _path.join(servedScope, source.file);\n addToScope(importMap, rScope, { [specifier]: url });\n addIntegrity(importMap, url, r.servedBy, source.file);\n registerBundleChunks(chunkBundles, r.servedBy, source.bundle);\n source.meta.cached = true;\n }\n return;\n }\n for (const m of mappings) {\n addToScope(importMap, rScope, { [m.packageName]: m.url });\n }\n // Entrypoints no copy of the serving version has are served from this remote's own build.\n for (const [packageName, file] of Object.entries(r.entries)) {\n if (provided.has(packageName)) continue;\n if (\n config.strict.strictEntryPointCoverage ||\n config.profile.scopeUncoveredEntrypoints\n ) {\n warnUncoveredEntrypoint(shareScope, externalName, r.name, packageName);\n continue;\n }\n const url = _path.join(rScope, file);\n addToScope(importMap, rScope, { [packageName]: url });\n addIntegrity(importMap, url, r.name, file);\n r.cached = true;\n }\n });\n for (const m of mappings) {\n addIntegrity(importMap, m.url, m.name, m.file);\n }\n }\n if (cachedFingerprint(external) !== cachedBefore) {\n ports.sharedExternalsRepo.addOrUpdate(externalName, external, shareScope);\n }\n }\n }\n\n function cachedFingerprint(external: SharedExternal): string {\n return external.versions.map(v => v.remotes.map(r => (r.cached ? 1 : 0)).join('')).join('|');\n }\n\n function findOverride(\n external: SharedExternal,\n shareScope: string,\n externalName: string\n ): SharedVersion | undefined {\n const sharedVersions = external.versions.filter(v => v.action === 'share');\n const scopedExternalName = `${shareScope}.${externalName}`;\n\n if (sharedVersions.length > 1) {\n handleMultipleSharedVersions(scopedExternalName);\n }\n\n if (sharedVersions.length < 1) {\n if (config.strict.strictImportMap) {\n config.log.error(4, `[${shareScope}][${externalName}] shareScope has no override version.`);\n throw new NFError('Could not create ImportMap.');\n }\n config.log.debug(\n 4,\n `[${shareScope}][${externalName}] shareScope has no override version, scoping override versions.`\n );\n }\n\n return sharedVersions[0];\n }\n\n function handleMultipleSharedVersions(scopedExternalName: string): void {\n if (config.strict.strictImportMap) {\n config.log.error(\n 4,\n `[${scopedExternalName}] ShareScope external has multiple shared versions.`\n );\n throw new NFError('Could not create ImportMap.');\n }\n\n config.log.warn(4, `ShareScope external ${scopedExternalName} has multiple shared versions.`);\n }\n\n /**\n * Where a build serves a specifier from, per remote \u2014 built only when some copy carries a `servedBy`,\n * so an unpooled portfolio allocates nothing. Pool-wide rather than per-external on purpose: the\n * specifier a consumer is anchored on may be an *entry* of a different external of the serving build,\n * which is the whole reason coverage is keyed by specifier (see docs/version-resolver.md \u00A7\"The\n * provenance promise\").\n */\n type ServedSource = { file: string; bundle?: string; meta: SharedVersionMeta };\n\n function buildServedIndex(\n externals: Record<string, SharedExternal>\n ): Map<RemoteName, Map<string, ServedSource>> | undefined {\n let anyServed = false;\n for (const external of Object.values(externals)) {\n for (const version of external.versions) {\n if (version.remotes.some(r => r.servedBy)) anyServed = true;\n }\n }\n if (!anyServed) return undefined;\n\n const index = new Map<RemoteName, Map<string, ServedSource>>();\n for (const external of Object.values(externals)) {\n for (const version of external.versions) {\n for (const remote of version.remotes) {\n let own = index.get(remote.name);\n if (!own) index.set(remote.name, (own = new Map()));\n for (const [specifier, file] of Object.entries(remote.entries)) {\n if (!own.has(specifier))\n own.set(specifier, { file, bundle: remote.bundle, meta: remote });\n }\n }\n }\n }\n return index;\n }\n\n // A cross-build scope entry, held back until every global mapping is in place so that a scope which\n // would merely repeat `imports` can be dropped (Performance \u00A79).\n type ServedScope = { scope: string; specifier: string; source: ServedSource; from: RemoteName };\n\n function collectServed(\n into: ServedScope[],\n index: Map<RemoteName, Map<string, ServedSource>>,\n ctx: string,\n externalName: string,\n version: SharedVersion\n ): void {\n for (const consumer of version.remotes) {\n if (!consumer.servedBy) continue;\n const files = index.get(consumer.servedBy);\n const scope = getScope(ctx, consumer.name, externalName);\n for (const specifier of Object.keys(consumer.entries)) {\n const source = files?.get(specifier);\n if (!source) {\n config.log.warn(\n 4,\n `[${ctx}][${externalName}][${consumer.name}] '${consumer.servedBy}' does not serve '${specifier}'.`\n );\n continue;\n }\n into.push({ scope, specifier, source, from: consumer.servedBy });\n }\n }\n }\n\n function flushServed(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>,\n served: ServedScope[]\n ): void {\n for (const { scope, specifier, source, from } of served) {\n const url = _path.join(getScope(GLOBAL_SCOPE, from), source.file);\n if (importMap.imports[specifier] === url) continue;\n addToScope(importMap, scope, { [specifier]: url });\n addIntegrity(importMap, url, from, source.file);\n registerBundleChunks(chunkBundles, from, source.bundle);\n source.meta.cached = true;\n }\n }\n\n /**\n * Step 4.3: Added the globally shared externals.\n * @param importMap\n * @returns\n */\n function addGlobalSharedExternals(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>\n ): ImportMap {\n const sharedExternals = ports.sharedExternalsRepo.getFromScope();\n const index = buildServedIndex(sharedExternals);\n const served: ServedScope[] = [];\n const cachedBefore = new Map<string, string>();\n\n for (const [externalName, external] of Object.entries(sharedExternals)) {\n cachedBefore.set(externalName, cachedFingerprint(external));\n\n for (const version of external.versions) {\n if (index && version.action !== 'scope') {\n collectServed(served, index, GLOBAL_SCOPE, externalName, version);\n }\n if (version.action === 'skip') continue;\n if (version.action === 'scope') {\n for (const remote of version.remotes) {\n const remoteScope = getScope(GLOBAL_SCOPE, remote.name, externalName);\n for (const [packageName, file] of Object.entries(remote.entries)) {\n const url = _path.join(remoteScope, file);\n addToScope(importMap, remoteScope, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n }\n remote.cached = true;\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n }\n continue;\n }\n\n if (importMap.imports[externalName]) {\n notifyDuplicateGlobalExternal(externalName);\n continue;\n }\n\n // Marks and registers the copies it maps, the basis included \u2014 so `cached` names the copies this\n // map really publishes, which the dynamic path reads as what it may call covered.\n mergeVersionEntries(importMap, chunkBundles, externalName, version);\n }\n\n // Second pass, so winners have claimed their imports first.\n for (const version of external.versions) {\n if (version.action !== 'skip') continue;\n selfFillUncovered(importMap, chunkBundles, externalName, version.remotes);\n }\n }\n\n flushServed(importMap, chunkBundles, served);\n\n for (const [externalName, external] of Object.entries(sharedExternals)) {\n if (cachedFingerprint(external) !== cachedBefore.get(externalName)) {\n ports.sharedExternalsRepo.addOrUpdate(externalName, external);\n }\n }\n\n return importMap;\n }\n\n // Copies of one tag build the same code, so serving a specifier only some of them bundle is not\n // tearing: the version exposes the union of its copies, whatever the coverage policy.\n function mergeVersionEntries(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>,\n externalName: string,\n version: SharedVersion\n ): void {\n // Scope lookup and chunk registration belong to the copy, not to each of its specifiers. A copy none\n // of whose specifiers survive the check below never enters it: nothing points at its build, so its\n // chunks are not needed and calling it cached would claim a mapping it does not have.\n const scopes = new Map<RemoteName, string>();\n\n for (const [packageName, remote] of versionEntries(version)) {\n // Another external claimed this specifier as one of its own entries \u2014 reachable when\n // `feature.convertFlatSharedInfo` is off and one remote emits a secondary entrypoint as a\n // package of its own. First writer wins; whoever loses would otherwise be repointed silently.\n if (importMap.imports[packageName]) {\n config.log.debug(\n 4,\n `[${GLOBAL_SCOPE}][${externalName}][${remote.name}] Entrypoint '${packageName}' is already mapped by another external, keeping '${importMap.imports[packageName]}'.`\n );\n continue;\n }\n let scope = scopes.get(remote.name);\n if (scope === undefined) {\n scopes.set(remote.name, (scope = getScope(GLOBAL_SCOPE, remote.name, externalName)));\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n remote.cached = true;\n }\n const file = remote.entries[packageName]!;\n const url = _path.join(scope, file);\n addToGlobal(importMap, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n }\n }\n\n // Reaching here with a coverage policy set means stale storage, so it is refused instead.\n function selfFillUncovered(\n importMap: ImportMap,\n chunkBundles: Record<string, Set<string>>,\n externalName: string,\n remotes: SharedVersionMeta[]\n ): void {\n for (const remote of remotes) {\n // A remote pooling anchored elsewhere takes every entrypoint from that build, so filling from its\n // own would put a second build into the global mapping.\n if (remote.servedBy) continue;\n for (const [packageName, file] of Object.entries(remote.entries)) {\n if (importMap.imports[packageName]) continue;\n if (config.strict.strictEntryPointCoverage || config.profile.scopeUncoveredEntrypoints) {\n warnUncoveredEntrypoint(GLOBAL_SCOPE, externalName, remote.name, packageName);\n continue;\n }\n const scope = getScope(GLOBAL_SCOPE, remote.name, externalName);\n const url = _path.join(scope, file);\n addToGlobal(importMap, { [packageName]: url });\n addIntegrity(importMap, url, remote.name, file);\n registerBundleChunks(chunkBundles, remote.name, remote.bundle);\n remote.cached = true;\n }\n }\n }\n\n function warnUncoveredEntrypoint(\n scope: string,\n externalName: string,\n remoteName: RemoteName,\n packageName: string\n ): void {\n const msg = `[${scope}][${externalName}][${remoteName}] Entrypoint '${packageName}' is not covered by the shared version.`;\n if (config.strict.strictEntryPointCoverage || config.strict.strictImportMap) {\n config.log.error(4, msg);\n throw new NFError('Could not create ImportMap.');\n }\n config.log.warn(4, msg);\n }\n\n function notifyDuplicateGlobalExternal(externalName: string): void {\n if (config.strict.strictImportMap) {\n config.log.error(4, `[${externalName}] Shared external has multiple shared versions.`);\n throw new NFError('Could not create ImportMap.');\n }\n\n config.log.warn(4, `Singleton external ${externalName} has multiple shared versions.`);\n }\n\n function addToScope(importMap: ImportMap, scope: string, imports: Imports): void {\n if (!importMap.scopes) importMap.scopes = {};\n if (!importMap.scopes[scope]) importMap.scopes[scope] = {};\n importMap.scopes[scope] = Object.assign(importMap.scopes[scope], imports);\n }\n function addToGlobal(importMap: ImportMap, imports: Imports): void {\n importMap.imports = Object.assign(importMap.imports, imports);\n }\n\n /**\n * Step 4.4: Added the remote-modules (into the global scope).\n * @param importMap\n * @returns\n */\n function addRemoteInfos(importMap: ImportMap, chunkBundles: Record<string, Set<string>>): void {\n const remotes = ports.remoteInfoRepo.getAll();\n\n for (const [remoteName, remote] of Object.entries(remotes)) {\n addRemoteExposedModules(importMap, remoteName, remote);\n registerBundleChunks(chunkBundles, remoteName, 'mapping-or-exposed');\n }\n }\n\n function addRemoteExposedModules(\n importMap: ImportMap,\n remoteName: string,\n remote: RemoteInfo\n ): void {\n for (const exposed of remote.exposes) {\n const moduleName = _path.join(remoteName, exposed.moduleName);\n const moduleUrl = _path.join(remote.scopeUrl, exposed.file);\n importMap.imports[moduleName] = moduleUrl;\n addIntegrity(importMap, moduleUrl, remoteName, exposed.file);\n }\n }\n\n function registerBundleChunks(\n chunkBundles: Record<string, Set<string>>,\n remoteName: string,\n bundleName?: string\n ) {\n if (!bundleName) return chunkBundles;\n if (!chunkBundles[remoteName]) chunkBundles[remoteName] = new Set();\n chunkBundles[remoteName].add(bundleName);\n return chunkBundles;\n }\n\n function addChunkImports(importMap: ImportMap, chunkBundles: Record<string, Set<string>>) {\n Object.entries(chunkBundles).forEach(([remoteName, bundles]) => {\n const baseUrl = getScope('CHUNKS', remoteName);\n\n const imports = Array.from(bundles).reduce((_imports, bundleName) => {\n ports.sharedChunksRepo.tryGet(remoteName, bundleName).ifPresent(files => {\n files.forEach(file => {\n const url = _path.join(baseUrl, file);\n _imports[toChunkImport(file)] = url;\n addIntegrity(importMap, url, remoteName, file);\n });\n });\n return _imports;\n }, {} as Imports);\n\n if (Object.keys(imports).length > 0) addToScope(importMap, baseUrl, imports);\n });\n\n return importMap;\n }\n\n function addIntegrity(\n importMap: ImportMap,\n url: string,\n remoteName: RemoteName,\n file: string\n ): void {\n const hash = ports.remoteInfoRepo.tryGet(remoteName).get()?.integrity?.[file];\n if (!hash) return;\n if (!importMap.integrity) importMap.integrity = {};\n importMap.integrity[url] = hash;\n }\n\n function getScope(ctx: string, remoteName: RemoteName, externalName?: string) {\n return ports.remoteInfoRepo\n .tryGet(remoteName)\n .map(remote => remote.scopeUrl)\n .orThrow(() => {\n if (externalName) {\n config.log.error(\n 4,\n `[${ctx}][${externalName}][${remoteName}] Remote name not found in cache.`\n );\n } else {\n config.log.error(4, `[${ctx}][${remoteName}] Remote name not found in cache.`);\n }\n\n return new NFError('Could not create ImportMap.');\n });\n }\n}\n", "import type { DrivingContract } from '../driving-ports/driving.contract';\nimport type {\n CommitOptions,\n ForCommittingChanges,\n} from '../driver-ports/init/for-committing-changes.port';\nimport type { ImportMap } from 'lib/core/1.domain/import-map/import-map.contract';\nimport type { LoggingConfig } from 'lib/core/2.app/config';\n\nexport function createCommitChanges(\n config: LoggingConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'scopedExternalsRepo'\n | 'sharedExternalsRepo'\n | 'sharedChunksRepo'\n | 'browser'\n >\n): ForCommittingChanges {\n /**\n * Step 5: Commit all changes\n *\n * The changes made to the storage/cache are persisted to storage, and the importmap is\n * inserted into the HTML DOM.\n *\n * This step only runs if all previous steps were succesful to prevent the persistence of\n * erroneous changes into storage which can corrupt other pages/routes of the host.\n *\n * @param adapters\n */\n return (importMap: ImportMap, opts: CommitOptions = {}) =>\n Promise.resolve(importMap)\n .then(map => addToBrowser(map, opts))\n .then(persistRepositoryChanges);\n\n function addToBrowser(importMap: ImportMap, opts: CommitOptions) {\n ports.browser.setImportMapFn(importMap, opts);\n config.log.debug(5, 'Added import map to browser.', importMap);\n return importMap;\n }\n\n function persistRepositoryChanges() {\n ports.remoteInfoRepo.commit();\n ports.scopedExternalsRepo.commit();\n ports.sharedExternalsRepo.commit();\n ports.sharedChunksRepo.commit();\n return;\n }\n}\n", "import type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { ForExposingModuleLoader } from '../driver-ports/init/for-exposing-module-loader.port';\nimport type { LoadRemoteModule } from 'lib/core/init-federation.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { LoggingConfig } from '../config/log.contract';\nimport * as _path from 'lib/utils/path';\n\nexport function createExposeModuleLoader(\n config: LoggingConfig,\n ports: Pick<DrivingContract, 'remoteInfoRepo' | 'browser'>\n): ForExposingModuleLoader {\n const loadRemoteModule: LoadRemoteModule = <TModule = unknown>(\n remoteName: string,\n exposedModule: string\n ): Promise<TModule> => {\n try {\n if (!ports.remoteInfoRepo.contains(remoteName)) {\n throw new NFError(`Remote '${remoteName}' is not initialized.`);\n }\n\n const remoteModuleUrl = ports.remoteInfoRepo\n .tryGetModule(remoteName, exposedModule)\n .orThrow(\n new NFError(\n `Exposed module '${exposedModule}' from remote '${remoteName}' not found in storage.`\n )\n );\n\n config.log.debug(6, `Loading initialized module '${remoteModuleUrl}'`);\n\n return ports.browser.importModule(remoteModuleUrl) as Promise<TModule>;\n } catch (error) {\n config.log.error(6, `Failed to load module ${_path.join(remoteName, exposedModule)}: `, {\n error,\n });\n\n return Promise.reject(\n new NFError(`Failed to load module ${_path.join(remoteName, exposedModule)}`)\n );\n }\n };\n\n /**\n * Step 6: expose module loader\n *\n * The module loader can only be used after the importmap was generated and added to\n * the DOM, hence the module loader fn is exposed to the host after the final commit\n * step.\n *\n * The loadRemoteModule is also a callback that is returned as a promise by the initFederation\n * function. This way the loadRemoteModule can be shared througout the host application using\n * CustomEvents or by adding it to the global Window object for easy access.\n *\n * @param adapters\n */\n return () => Promise.resolve(loadRemoteModule);\n}\n", "export class Optional<T> {\n private constructor(private item?: T) {}\n\n public static of<T>(item?: T): Optional<T> {\n return new Optional(item);\n }\n public static empty<U>(): Optional<U> {\n return Optional.of<U>(undefined);\n }\n\n public isPresent() {\n return typeof this.item !== 'undefined' && this.item !== null;\n }\n public set<U>(other: U) {\n return Optional.of(other);\n }\n\n public ifPresent(callback: (_: T) => void): void {\n if (this.isPresent()) callback(this.item as T);\n }\n\n public map<U>(callback: (_: NonNullable<T>) => U | Optional<U>): Optional<U> {\n if (!this.isPresent()) return Optional.empty();\n\n const result = callback(this.item as NonNullable<T>);\n return result instanceof Optional ? result : Optional.of(result);\n }\n\n public orElse(other: Required<T>): NonNullable<T> {\n return this.isPresent() ? (this.item as NonNullable<T>) : (other as NonNullable<T>);\n }\n\n public orThrow(error: Error | string | (() => Error)): NonNullable<T> {\n if (this.isPresent()) return this.item as NonNullable<T>;\n if (typeof error === 'function') throw error();\n throw typeof error === 'string' ? new Error(error) : error;\n }\n\n public get(): T | undefined {\n return this.item;\n }\n}\n", "import type { RemoteEntryUrl } from 'lib/core/1.domain/remote-entry/manifest.contract';\nimport type { RemoteName } from 'lib/core/1.domain/remote/remote-info.contract';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from '../config/mode.contract';\nimport type { ForGettingRemoteEntry } from '../driver-ports/init/for-getting-remote-entry.port';\nimport type { RemoteRef } from '../driver-ports/init/flow.contract';\nimport { Optional } from 'lib/utils/optional';\nimport type { RemoteEntry } from 'lib/core/1.domain';\nimport * as _path from 'lib/utils/path';\n\nconst normalizeRemoteRef = (remote?: RemoteRef): { name?: RemoteName; integrity?: string } => {\n if (!remote) return {};\n if (typeof remote === 'string') return { name: remote };\n return remote;\n};\n\nexport function createGetRemoteEntry(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'remoteEntryProvider' | 'remoteInfoRepo' | 'sse'>\n): ForGettingRemoteEntry {\n return async (remoteEntryUrl: RemoteEntryUrl, remote?: RemoteRef) => {\n const { name: remoteName, integrity } = normalizeRemoteRef(remote);\n\n if (!!remoteName && shouldSkipCachedRemote(remoteEntryUrl, remoteName)) {\n config.log.debug(7, `Found remote '${remoteName}' in storage, omitting fetch.`);\n return Optional.empty<RemoteEntry>();\n }\n\n try {\n const remoteEntry = integrity\n ? await ports.remoteEntryProvider.provide(remoteEntryUrl, { integrity })\n : await ports.remoteEntryProvider.provide(remoteEntryUrl);\n\n config.log.debug(\n 7,\n `[${remoteEntry.name}] Fetched from '${remoteEntry.url}', exposing: ${JSON.stringify(remoteEntry.exposes)}`\n );\n\n if (!!remoteName && remoteEntry.name !== remoteName) {\n const errorMsg = `Fetched remote '${remoteEntry.name}' does not match requested '${remoteName}'.`;\n if (config.strict.strictRemoteEntry) {\n config.log.error(7, errorMsg);\n throw new NFError('Could not fetch remote entry');\n }\n config.log.warn(7, errorMsg + ' Omitting expected name.');\n }\n\n if (ports.remoteInfoRepo.contains(remoteEntry.name)) {\n remoteEntry.override = true;\n config.log.debug(7, `Overriding existing remote '${remoteName}' with '${remoteEntryUrl}'.`);\n }\n return Optional.of(checkForSSE(remoteEntry));\n } catch (error) {\n config.log.error(\n 7,\n `[${remoteName ?? 'unknown'}] Could not fetch remoteEntry from ${remoteEntryUrl}.`,\n error\n );\n return Promise.reject(\n new NFError(`[${remoteName ?? remoteEntryUrl}] Could not fetch remoteEntry.`)\n );\n }\n };\n\n function shouldSkipCachedRemote(remoteEntryUrl: string, remoteName: RemoteName): boolean {\n return ports.remoteInfoRepo\n .tryGet(remoteName)\n .map(\n cachedRemoteInfo =>\n config.profile.overrideCachedRemotes !== 'always' ||\n (!config.profile.overrideCachedRemotesIfURLMatches &&\n remoteEntryUrl === _path.join(cachedRemoteInfo.scopeUrl, 'remoteEntry.json'))\n )\n .orElse(false);\n }\n\n function checkForSSE(entry: RemoteEntry): RemoteEntry {\n if (config.sse) {\n if (entry.buildNotificationsEndpoint) {\n ports.sse.watchRemoteBuilds(\n _path.join(_path.getScope(entry.url), entry.buildNotificationsEndpoint)\n );\n config.log.debug(7, `Registered SSE endpoint of remote '${entry.name}' `);\n } else {\n config.log.debug(7, `Remote ${entry.name} has no defined 'buildNotificationsEndpoint'`);\n }\n }\n return entry;\n }\n}\n", "import type { ForUpdatingCache } from '../driver-ports/init/for-updating-cache';\nimport {\n type RemoteEntry,\n type DenseSharedInfo,\n type SharedInfoActions,\n type SharedVersionAction,\n type SharedVersionMeta,\n GLOBAL_SCOPE,\n} from 'lib/core/1.domain';\nimport {\n addRemoteToVersion,\n committedEntries,\n findVersionForTag,\n uncoveredEntrypoints,\n versionEntries,\n} from 'lib/core/1.domain/externals/basis';\nimport type { DrivingContract } from '../driving-ports/driving.contract';\nimport type { LoggingConfig } from '../config/log.contract';\nimport * as _path from 'lib/utils/path';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport {\n createRemoveCachedRemoteEntries,\n createStoreRemoteEntry,\n type SharedExternalContext,\n} from './store-remote-entry';\n\nexport function createUpdateCache(\n config: LoggingConfig & ModeConfig,\n ports: Pick<\n DrivingContract,\n | 'remoteInfoRepo'\n | 'sharedExternalsRepo'\n | 'scopedExternalsRepo'\n | 'sharedChunksRepo'\n | 'versionCheck'\n >\n): ForUpdatingCache {\n const storeRemoteEntry = createStoreRemoteEntry(config, ports, 8);\n const removeCachedRemoteEntries = createRemoveCachedRemoteEntries(ports);\n\n /**\n * Step 8 (dynamic init): merge a runtime-loaded remoteEntry into the cache. The\n * import map is already committed, so shared externals are resolved immediately\n * and additively \u2014 an already-shared version stays authoritative.\n */\n return remoteEntry => {\n try {\n const actions: SharedInfoActions = {};\n\n if (remoteEntry?.override) removeCachedRemoteEntries(new Set([remoteEntry.name]));\n\n storeRemoteEntry(remoteEntry, (entry, external, ctx) => {\n const { action, provided, sameVersion } = resolveSharedExternal(entry, external, ctx);\n actions[external.packageName] = { action };\n\n if (action === 'skip' && provided) {\n actions[external.packageName]!.covered = Array.from(provided.keys());\n if (sameVersion) actions[external.packageName]!.sameVersion = true;\n\n if (external.shareScope) {\n actions[external.packageName]!.override = resolveOverrideEntries(\n entry,\n external,\n provided\n );\n }\n }\n });\n\n return Promise.resolve({ entry: remoteEntry, actions });\n } catch (error) {\n return Promise.reject(error);\n }\n };\n\n function resolveSharedExternal(\n remoteEntry: RemoteEntry,\n sharedInfo: DenseSharedInfo,\n {\n tag,\n remote,\n cached,\n scopeType,\n assertSameVersionCompatibility,\n commit,\n }: SharedExternalContext\n ): {\n action: SharedVersionAction;\n provided?: Map<string, SharedVersionMeta>;\n sameVersion?: boolean;\n } {\n let action: SharedVersionAction = scopeType === 'strict' ? 'share' : 'skip';\n\n const sharedVersion = cached.versions.find(c => c.action === 'share');\n const isCompatible =\n !sharedVersion || ports.versionCheck.isCompatible(sharedVersion.tag, remote.requiredVersion);\n\n if (action === 'skip' && !isCompatible && remote.strictVersion) {\n action = 'scope';\n const errorMsg = `[${sharedInfo.shareScope ?? GLOBAL_SCOPE}][${remoteEntry.name}] ${\n sharedInfo.packageName\n }@${sharedInfo.version} Is not compatible with existing ${sharedInfo.packageName}@${\n sharedVersion!.tag\n } requiredRange '${sharedVersion!.remotes[0]?.requiredVersion}'`;\n\n if (config.strict.strictExternalCompatibility) {\n config.log.error(8, errorMsg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n config.log.warn(8, errorMsg);\n }\n\n // Snapshotted before this remote joins the version below: a copy of the shared tag merges its\n // extra entrypoints in, and it has to serve them itself since the import map is committed.\n //\n // What the shared version can serve *this* remote, which is not its whole surface: a global skip\n // inherits the committed `imports`, so only a copy already published there covers it, while a\n // shareScope skip gets a per-consumer override that can name any copy. Both the tear check and\n // `covered` read it, or `convert-to-import-map` would self-fill what this step called covered.\n const provided = sharedVersion\n ? sharedInfo.shareScope\n ? versionEntries(sharedVersion)\n : committedEntries(sharedVersion)\n : undefined;\n const sameVersion = sharedVersion?.tag === tag;\n\n if (action === 'skip' && provided && !sameVersion) {\n const uncovered = uncoveredEntrypoints(remote, provided);\n if (uncovered.length > 0) {\n const msg = `[${sharedInfo.shareScope ?? GLOBAL_SCOPE}][${remoteEntry.name}][${sharedInfo.packageName}] Entrypoints not covered by the shared version: ${uncovered.join(', ')}.`;\n\n if (config.strict.strictEntryPointCoverage) {\n config.log.error(8, msg);\n throw new NFError(`Could not process remote '${remoteEntry.name}'`);\n }\n if (config.profile.scopeUncoveredEntrypoints) {\n config.log.debug(8, msg);\n action = 'scope';\n }\n }\n }\n\n const matchingVersion = findVersionForTag(cached.versions, tag);\n\n if (action === 'scope') {\n // Inside a shareable version a later import-map build would redirect it to the basis.\n remote.cached = true;\n const scoped = cached.versions.find(v => v.tag === tag && v.action === 'scope');\n if (scoped) scoped.remotes.push(remote);\n else cached.versions.push({ tag, action, host: false, remotes: [remote] });\n } else if (matchingVersion) {\n assertSameVersionCompatibility(matchingVersion);\n addRemoteToVersion(matchingVersion, remote);\n } else {\n if (!sharedVersion) action = 'share';\n remote.cached = action !== 'skip';\n cached.versions.push({ tag, action, host: false, remotes: [remote] });\n }\n\n commit();\n return { action, provided, sameVersion };\n }\n\n // Each entrypoint is served by the copy of the shared version that declares it.\n function resolveOverrideEntries(\n remoteEntry: RemoteEntry,\n external: DenseSharedInfo,\n provided: Map<string, SharedVersionMeta>\n ): Record<string, string> {\n return Object.fromEntries(\n Array.from(provided, ([packageName, provider]) => [\n packageName,\n _path.join(\n providerScopeUrl(remoteEntry, external, provider.name),\n provider.entries[packageName]!\n ),\n ])\n );\n }\n\n function providerScopeUrl(\n remoteEntry: RemoteEntry,\n external: DenseSharedInfo,\n providerName: string\n ): string {\n return ports.remoteInfoRepo\n .tryGet(providerName)\n .map(remote => remote.scopeUrl)\n .orThrow(() => {\n config.log.error(\n 8,\n `[${external.shareScope ?? GLOBAL_SCOPE}][${remoteEntry.name}][${\n external.packageName\n }@${external.version}][override] Remote name not found in cache.`\n );\n return new NFError(`Could not find override url from remote ${providerName}`);\n });\n }\n}\n", "import type { ForPoolingDynamicExternals } from '../../driver-ports/init/for-pooling-dynamic-externals.port';\nimport type { ModeConfig } from '../../config/mode.contract';\nimport type { LoggingConfig } from '../../config/log.contract';\nimport type { DrivingContract } from '../../driving-ports/driving.contract';\nimport {\n type ExternalName,\n GLOBAL_SCOPE,\n type RemoteName,\n STRICT_SCOPE,\n type SharedInfoActions,\n} from 'lib/core/1.domain';\nimport { buildPools } from './pool-graph';\nimport {\n basisPerMember,\n committedView,\n consumedMembers,\n consumedSpecifiers,\n hostRemotes,\n} from './pool-views';\nimport { lazy } from './pool.util';\nimport {\n acceptanceTable,\n acceptsAll,\n covers,\n explainSelfServe,\n isWitnessed,\n type Acceptance,\n} from './anchoring';\nimport type { CommittedView, PoolMember, Specifier } from './pool.types';\nimport * as _path from 'lib/utils/path';\n\n// One pool as both gates read it, for the remote being loaded.\ntype GateViews = {\n pool: PoolMember[];\n view: CommittedView;\n wants: ExternalName[];\n specifiers: Set<Specifier>;\n acceptance: () => Acceptance;\n};\n\nexport function createPoolDynamicExternals(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'sharedExternalsRepo' | 'remoteInfoRepo' | 'versionCheck'>\n): ForPoolingDynamicExternals {\n /**\n * Dynamic-init counterpart of pool-shared-externals. The committed import map is immutable, so\n * this step is strictly additive: it only adjusts the newly loaded remote's own actions, never\n * the existing shared versions (host precedence was already applied when those were elected).\n * See docs/version-resolver.md.\n */\n return ({ entry, actions }) => {\n const { useAutoExternalPooling } = config.feature;\n\n // The poolable singletons this entry declares, per share scope \u2014 what it may have its actions rewritten\n // for. Membership is decided below, off the committed record rather than off this list.\n const declared = new Map<string, Set<ExternalName>>();\n for (const external of entry.shared ?? []) {\n const name = external.packageName;\n if (!external.singleton || !actions[name]) continue;\n if (external.shareScope === STRICT_SCOPE) continue;\n\n const shareScope = external.shareScope ?? GLOBAL_SCOPE;\n let names = declared.get(shareScope);\n if (!names) declared.set(shareScope, (names = new Set()));\n names.add(name);\n }\n if (declared.size === 0) return Promise.resolve({ entry, actions });\n\n const scope = (name: string) => {\n actions[name]!.action = 'scope';\n delete actions[name]!.override;\n };\n\n for (const [shareScope, names] of declared) {\n // With auto-pooling off, a tag anywhere in the committed scope forms pools this entry is subject to \u2014\n // its own tag is not required. A tag is remote-local for *membership* only; the pool it forms then\n // operates on the whole external, this entry's copies included (see docs/version-resolver.md\n // \u00A7\"Unscoped lockstep families\"). Reading only this entry's tags is what let an untagged remote\n // bridge two builds the portfolio had deliberately pooled apart.\n if (!useAutoExternalPooling && !ports.sharedExternalsRepo.hasPoolTag(shareScope)) continue;\n\n const committed = ports.sharedExternalsRepo.getFromScope(shareScope);\n\n for (const pool of buildPools(committed, useAutoExternalPooling).values()) {\n // Only the members this entry declares have an action to rewrite; the rest of the pool is context \u2014\n // its builds are candidates and its committed tags are what the gate reads.\n const mine = pool.filter(member => names.has(member.name));\n if (mine.length === 0) continue;\n\n // Island-or-defer: only a real incompatibility scopes the whole family (no dedup \u2014 a\n // same-version sibling would bridge the foreign build). A `share`+`skip` mix is a coverage\n // gap, not a conflict, so the gate below decides it on coverage.\n if (mine.some(member => actions[member.name]!.action === 'scope')) {\n mine.forEach(member => scope(member.name));\n continue;\n }\n\n const asked = gateViews(entry.name, pool);\n const anchor = anchorFor(entry.name, asked);\n if (anchor === 'witnessed') continue;\n\n if (anchor === undefined) {\n const reason = explainDynamic(entry.name, asked);\n const closest = reason.closest\n ? `closest is '${reason.closest}'`\n : 'no committed build serves any of it';\n config.log.warn(\n 8,\n `[${shareScope}] '${entry.name}' serves its own family: no committed build offers every entrypoint it imports at a version it accepts \u2014 '${reason.gap}' is the gap, ${closest}. All ${mine.length} members it imports are scoped for it.`\n );\n mine.forEach(member => scope(member.name));\n continue;\n }\n\n redirect(entry.name, anchor, pool, asked.view, actions, shareScope);\n }\n }\n\n return Promise.resolve({ entry, actions });\n };\n\n // Everything both gates read about one pool, built once: `explainSelfServe` asks for the same projections\n // the witness and the coverage test do, and only the version table is expensive enough to defer.\n function gateViews(remote: RemoteName, pool: PoolMember[]): GateViews {\n return {\n pool,\n view: committedView(pool),\n wants: consumedMembers(pool).get(remote) ?? [],\n specifiers: consumedSpecifiers(pool).get(remote) ?? new Set<Specifier>(),\n acceptance: lazy(() => acceptanceTable(pool, ports.versionCheck.isCompatible)),\n };\n }\n\n /**\n * The init gate, asked of what the loaded remote would dedup onto: the witness first, then a committed\n * build that covers every entrypoint it imports at versions it accepts. Nothing here re-points an\n * existing remote \u2014 the only thing that can move is the remote being loaded.\n */\n function anchorFor(\n remote: RemoteName,\n { pool, view, wants, specifiers, acceptance }: GateViews\n ): RemoteName | 'witnessed' | undefined {\n const shared = new Map<Specifier, string>();\n for (const [specifier, source] of view.global) shared.set(specifier, source.tag);\n\n if (isWitnessed(specifiers, shared, view.builds)) return 'witnessed';\n\n const basis = basisPerMember(pool);\n\n for (const build of candidateOrder(pool, view)) {\n if (build === remote) continue;\n const candidate = view.builds.get(build)!;\n if (!servesItsOwnFamily(build, pool, basis)) continue;\n if (!covers(candidate.coverage, specifiers)) continue;\n if (!acceptsAll(acceptance(), candidate.instance, remote, wants)) continue;\n return build;\n }\n\n return undefined;\n }\n\n /**\n * Cheapest candidate first: a build the committed map already serves this pool from costs nothing at all\n * (`redirect` writes no override for a specifier already served from it), then the host, whose build the\n * browser has loaded regardless. Name breaks the rest, so the choice stays reload-stable.\n */\n function candidateOrder(pool: PoolMember[], view: CommittedView): RemoteName[] {\n const serving = new Set<RemoteName>();\n for (const source of view.global.values()) serving.add(source.remote);\n const hosts = hostRemotes(pool);\n\n const rank = (build: RemoteName) => (serving.has(build) ? 0 : hosts.has(build) ? 1 : 2);\n\n return [...view.builds.keys()].sort((a, b) => rank(a) - rank(b) || a.localeCompare(b));\n }\n\n /**\n * Constraint 9, read off the committed record: a candidate qualifies only if it wins every member it\n * ships (the map already names its own files for its whole family) or every copy it holds is scoped (an\n * island, running its own build by construction). Anything in between resolved part of its family through\n * the global winner, so its modules are already bound and a consumer deduping onto it inherits that \u2014\n * which no additive map can repair.\n */\n function servesItsOwnFamily(\n build: RemoteName,\n pool: PoolMember[],\n basis: Map<ExternalName, RemoteName>\n ): boolean {\n let ships = 0;\n let winsAll = true;\n let allScoped = true;\n\n for (const member of pool) {\n for (const version of member.external.versions) {\n const meta = version.remotes.find(r => r.name === build);\n if (!meta) continue;\n if (meta.servedBy !== undefined) return false;\n ships++;\n if (version.action !== 'scope') allScoped = false;\n if (basis.get(member.name) !== build) winsAll = false;\n }\n }\n\n return ships > 0 && (winsAll || allScoped);\n }\n\n function explainDynamic(remote: RemoteName, { view, wants, specifiers, acceptance }: GateViews) {\n return explainSelfServe(remote, wants, specifiers, {\n builds: view.builds,\n acceptance: acceptance(),\n });\n }\n\n /**\n * Point the loaded remote at the anchor's files, through the per-consumer override\n * `convert-to-import-map` emits for a skip. Only specifiers the committed map does not already serve from\n * the anchor get an entry, so deduping onto the current global provider adds nothing to the delta.\n *\n * `covered` is set for every member either way: it is per external, so a specifier the anchor serves as an\n * entry of a *different* member would otherwise be self-filled from the loaded remote's own build \u2014 one\n * file from a second build, which is the whole thing being prevented.\n */\n function redirect(\n remote: RemoteName,\n anchor: RemoteName,\n pool: PoolMember[],\n view: CommittedView,\n actions: SharedInfoActions,\n shareScope: string\n ): void {\n const files = view.builds.get(anchor)!.coverage;\n const scopeUrl = ports.remoteInfoRepo.tryGet(anchor).get()?.scopeUrl;\n if (!scopeUrl) {\n config.log.warn(\n 8,\n `[${shareScope}][${remote}] '${anchor}' is not in the cache, so its files cannot be mapped.`\n );\n return;\n }\n\n for (const member of pool) {\n const action = actions[member.name];\n if (!action || action.action !== 'skip') continue;\n\n const own = member.external.versions.flatMap(v => v.remotes).find(r => r.name === remote);\n if (!own) continue;\n\n const specifiers = Object.keys(own.entries);\n if (specifiers.length === 0) continue;\n\n const override: Record<string, string> = {};\n for (const specifier of specifiers) {\n if (view.global.get(specifier)?.remote === anchor) continue;\n const file = files.get(specifier);\n if (file) override[specifier] = _path.join(scopeUrl, file);\n }\n\n action.covered = specifiers;\n if (Object.keys(override).length > 0) action.override = override;\n }\n }\n}\n", "import type { ImportMap } from 'lib/core/1.domain/import-map/import-map.contract';\nimport { type RemoteEntry, type SharedInfoActions } from 'lib/core/1.domain';\nimport type { LoggingConfig } from '../config/log.contract';\nimport type { ModeConfig } from '../config/mode.contract';\nimport * as _path from 'lib/utils/path';\nimport type { ForConvertingToImportMap } from 'lib/core/2.app/driver-ports/init/for-converting-to-import-map';\nimport type { DrivingContract } from 'lib/core/2.app/driving-ports/driving.contract';\nimport { NFError } from 'lib/core/native-federation.error';\nimport { toChunkImport } from '@softarc/native-federation/domain';\n\nexport function createConvertToImportMap(\n config: LoggingConfig & ModeConfig,\n ports: Pick<DrivingContract, 'sharedChunksRepo'>\n): ForConvertingToImportMap {\n const { log } = config;\n return async ({ entry, actions }) => {\n const importMap: ImportMap = { imports: {} };\n\n addExternals(entry, actions, importMap);\n addRemoteInfos(entry, importMap);\n log.debug(9, `[${entry.name}] Processed actions:`, actions);\n return importMap;\n };\n\n function addExternals(\n remoteEntry: RemoteEntry,\n actions: SharedInfoActions,\n importMap: ImportMap\n ): void {\n if (!remoteEntry.shared) {\n return;\n }\n\n const remoteEntryScope = _path.getScope(remoteEntry.url);\n const integrityMap = remoteEntry.integrity;\n\n const chunkBundles = new Set<string>(['mapping-or-exposed']);\n remoteEntry.shared.forEach(external => {\n // Scoped externals\n if (!external.singleton) {\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n\n if (external?.bundle) chunkBundles.add(external?.bundle);\n return;\n }\n\n if (!actions[external.packageName]) {\n log.warn(\n 9,\n `[${remoteEntry.name}] No action defined for shared external '${external.packageName}', skipping.`\n );\n return;\n }\n\n // Skipped externals are provided by another remote. An override \u2014 from a shareScope skip, or from\n // pooling having anchored this remote on one committed build \u2014 names whose files, per consumer. A\n // global skip without one inherits the committed global mapping and needs no entry of its own.\n if (actions[external.packageName]!.action === 'skip') {\n const { override, covered, sameVersion } = actions[external.packageName]!;\n if (override) {\n Object.entries(override).forEach(([packageName, url]) => {\n addToScopes(remoteEntryScope, packageName, url, importMap);\n });\n serveUncovered(\n remoteEntry,\n external,\n covered ?? Object.keys(override),\n remoteEntryScope,\n importMap,\n sameVersion\n );\n return;\n }\n if (!external.shareScope) {\n if (covered) {\n serveUncovered(remoteEntry, external, covered, remoteEntryScope, importMap, sameVersion);\n }\n return;\n }\n // Reaching here means the resolver failed to produce the expected override.\n log.error(\n 9,\n `[${remoteEntry.name}][${external.packageName}] shareScope skip has no override.`\n );\n if (config.strict.strictImportMap) throw new NFError('Could not create ImportMap.');\n // Non-strict fallback: serve from the remote's own scope (matches init).\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n\n // Chunks for shared externals\n if (external?.bundle) chunkBundles.add(external?.bundle);\n\n // Scoped shared externals\n if (actions[external.packageName]!.action === 'scope') {\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n\n // Shared externals with shareScope\n if (external.shareScope) {\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n return;\n }\n\n // Default case: shared globally\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n const url = _path.join(remoteEntryScope, fileName);\n importMap.imports[packageName] = url;\n\n addIntegrity(importMap, url, integrityMap, fileName);\n });\n });\n\n addChunkImports(importMap, remoteEntry, remoteEntryScope, chunkBundles);\n }\n\n function addToScopes(\n scope: string,\n packageName: string,\n url: string,\n importMap: ImportMap\n ): void {\n if (!importMap.scopes) importMap.scopes = {};\n if (!importMap.scopes[scope]) importMap.scopes[scope] = {};\n importMap.scopes[scope][packageName] = url;\n }\n\n function addRemoteInfos(remoteEntry: RemoteEntry, importMap: ImportMap): void {\n if (!remoteEntry.exposes) return;\n const scope = _path.getScope(remoteEntry.url);\n\n remoteEntry.exposes.forEach(exposed => {\n const moduleName = _path.join(remoteEntry.name, exposed.key);\n const moduleUrl = _path.join(scope, exposed.outFileName);\n importMap.imports[moduleName] = moduleUrl;\n addIntegrity(importMap, moduleUrl, remoteEntry.integrity, exposed.outFileName);\n });\n }\n\n function addChunkImports(\n importMap: ImportMap,\n remoteEntry: RemoteEntry,\n remoteEntryScope: string,\n chunkBundles: Set<string>\n ) {\n Array.from(chunkBundles).forEach(bundleName => {\n ports.sharedChunksRepo.tryGet(remoteEntry.name, bundleName).ifPresent(files => {\n files.forEach(file => {\n const url = _path.join(remoteEntryScope, file);\n addToScopes(remoteEntryScope, toChunkImport(file), url, importMap);\n addIntegrity(importMap, url, remoteEntry.integrity, file);\n });\n });\n });\n return importMap;\n }\n\n // `sameVersion` means the shared copy builds this remote's own tag, so its extra entrypoints\n // merge in rather than tearing the package: the coverage policy does not apply.\n function serveUncovered(\n remoteEntry: RemoteEntry,\n external: { packageName: string; entries: Record<string, string> },\n covered: string[],\n remoteEntryScope: string,\n importMap: ImportMap,\n sameVersion = false\n ): void {\n const provided = new Set(covered);\n Object.entries(external.entries).forEach(([packageName, fileName]) => {\n if (provided.has(packageName)) return;\n if (\n !sameVersion &&\n (config.strict.strictEntryPointCoverage || config.profile.scopeUncoveredEntrypoints)\n ) {\n warnUncoveredEntrypoint(remoteEntry.name, external.packageName, packageName);\n return;\n }\n const url = _path.join(remoteEntryScope, fileName);\n addToScopes(remoteEntryScope, packageName, url, importMap);\n addIntegrity(importMap, url, remoteEntry.integrity, fileName);\n });\n }\n\n function warnUncoveredEntrypoint(\n remoteName: string,\n externalName: string,\n packageName: string\n ): void {\n const msg = `[${remoteName}][${externalName}] Entrypoint '${packageName}' is not covered by the override.`;\n if (config.strict.strictEntryPointCoverage || config.strict.strictImportMap) {\n log.error(9, msg);\n throw new NFError('Could not create ImportMap.');\n }\n log.warn(9, msg);\n }\n\n function addIntegrity(\n importMap: ImportMap,\n url: string,\n integrityMap: Record<string, string> | undefined,\n file: string\n ): void {\n const hash = integrityMap?.[file];\n if (!hash) return;\n if (!importMap.integrity) importMap.integrity = {};\n importMap.integrity[url] = hash;\n }\n}\n", "import type { FLOW_FACTORY } from 'lib/core/2.app/driver-ports/flow-factory.contract';\nimport type { InitDriversContract } from 'lib/core/2.app/driver-ports/init/drivers.contract';\nimport { createGetRemoteEntries } from '../2.app/steps/get-remote-entries';\nimport { createProcessRemoteEntries } from '../2.app/steps/process-remote-entries';\nimport { createDetermineSharedExternals } from '../2.app/steps/determine-shared-externals';\nimport { createPoolSharedExternals } from '../2.app/steps/pooling/pool-shared-externals';\nimport { createMarkPoolsForReelection } from '../2.app/steps/pooling/mark-pools-for-reelection';\nimport { createGenerateImportMap } from '../2.app/steps/generate-import-map';\nimport { createCommitChanges } from '../2.app/steps/commit-changes';\nimport { createExposeModuleLoader } from '../2.app/steps/expose-module-loader';\nimport { createGetRemoteEntry } from '../2.app/steps/get-remote-entry';\nimport { createUpdateCache } from '../2.app/steps/update-cache';\nimport { createPoolDynamicExternals } from '../2.app/steps/pooling/pool-dynamic-externals';\nimport { createConvertToImportMap } from '../2.app/steps/convert-to-import-map';\nimport type { DrivingContract } from '../2.app/driving-ports/driving.contract';\nimport type { ConfigContract } from '../2.app/config/config.contract';\n\nexport const createInitDrivers = ({\n config,\n adapters,\n}: {\n config: ConfigContract;\n adapters: DrivingContract;\n}): InitDriversContract => ({\n getRemoteEntries: createGetRemoteEntries(config, adapters),\n processRemoteEntries: createProcessRemoteEntries(config, adapters),\n markPoolsForReelection: createMarkPoolsForReelection(config, adapters),\n determineSharedExternals: createDetermineSharedExternals(config, adapters),\n poolSharedExternals: createPoolSharedExternals(config, adapters),\n generateImportMap: createGenerateImportMap(config, adapters),\n commitChanges: createCommitChanges(config, adapters),\n exposeModuleLoader: createExposeModuleLoader(config, adapters),\n getRemoteEntry: createGetRemoteEntry(config, adapters),\n updateCache: createUpdateCache(config, adapters),\n poolDynamicExternals: createPoolDynamicExternals(config, adapters),\n convertToImportMap: createConvertToImportMap(config, adapters),\n});\n\nexport const INIT_FLOW_FACTORY = ({\n config,\n adapters,\n}: {\n config: ConfigContract;\n adapters: DrivingContract;\n}): FLOW_FACTORY<InitDriversContract> => {\n const flow = createInitDrivers({ config, adapters });\n\n return {\n flow,\n adapters,\n config,\n };\n};\n", "import type { ForBrowserTasks } from 'lib/core/2.app/driving-ports/for-browser-tasks';\nimport type { ImportMapConfig } from 'lib/core/2.app/config/import-map.contract';\n\nconst createBrowser = (config: ImportMapConfig): ForBrowserTasks => {\n return {\n setImportMapFn: config.setImportMapFn,\n importModule: config.loadModuleFn,\n };\n};\n\nexport { createBrowser };\n", "import type { ForVersionChecking } from 'lib/core/2.app/driving-ports/for-version-checking.port';\nimport semverValid from 'semver/functions/valid';\nimport semverSatisfies from 'semver/functions/satisfies';\nimport semverCompare from 'semver/functions/compare';\nimport semverMinVersion from 'semver/ranges/min-version';\nimport semverValidRange from 'semver/ranges/valid';\n\nconst createVersionCheck = (): ForVersionChecking => {\n return {\n isValidSemver: function (version: string) {\n return semverValid(version) !== null;\n },\n isCompatible: function (version: string, range: string) {\n return semverSatisfies(version, range);\n },\n compare: function (versionA: string, versionB: string) {\n return semverCompare(versionA, versionB, true);\n },\n smallestVersion: function (versionRange: string) {\n if (!semverValidRange(versionRange)) return '0.0.0';\n const minVersion = semverMinVersion(versionRange);\n return minVersion?.raw ?? '0.0.0';\n },\n };\n};\n\nexport { createVersionCheck };\n", "const SUPPORTED_ALGORITHMS = {\n 'sha256-': 'SHA-256',\n 'sha384-': 'SHA-384',\n 'sha512-': 'SHA-512',\n} as const;\n\ntype Prefix = keyof typeof SUPPORTED_ALGORITHMS;\n\nconst parseIntegrity = (integrity: string): { algorithm: string; expected: string } | null => {\n for (const prefix of Object.keys(SUPPORTED_ALGORITHMS) as Prefix[]) {\n if (integrity.startsWith(prefix)) {\n return { algorithm: SUPPORTED_ALGORITHMS[prefix], expected: integrity };\n }\n }\n return null;\n};\n\nconst toBase64 = (bytes: ArrayBuffer): string => {\n const view = new Uint8Array(bytes);\n let bin = '';\n for (let i = 0; i < view.length; i++) bin += String.fromCharCode(view[i]!);\n return btoa(bin);\n};\n\nexport const verifyIntegrity = async (bytes: ArrayBuffer, integrity: string): Promise<void> => {\n const parsed = parseIntegrity(integrity);\n if (!parsed) {\n throw new TypeError(\n `Unsupported integrity prefix in '${integrity}'. Expected sha256-, sha384-, or sha512-.`\n );\n }\n\n const subtle =\n typeof crypto !== 'undefined' && crypto.subtle ? crypto.subtle : undefined;\n if (!subtle) {\n throw new Error('SubtleCrypto is not available in this environment.');\n }\n\n const digest = await subtle.digest(parsed.algorithm, bytes);\n const actual =\n integrity.substring(0, integrity.indexOf('-') + 1) + toBase64(digest);\n\n if (actual !== parsed.expected) {\n throw new Error(`Integrity mismatch: expected ${parsed.expected}, got ${actual}`);\n }\n};\n", "import type { FederationManifest } from 'lib/core/1.domain';\nimport type { ForProvidingManifest } from 'lib/core/2.app/driving-ports/for-providing-manifest.port';\nimport { NFError } from 'lib/core/native-federation.error';\nimport { verifyIntegrity } from 'lib/utils/integrity';\n\nconst createManifestProvider = (): ForProvidingManifest => {\n const ensureOk = (response: Response) => {\n if (!response.ok)\n return Promise.reject(new NFError(`${response.status} - ${response.statusText}`));\n return response;\n };\n\n const formatError = (manifestUrl: string) => (err: unknown) => {\n const msg = err instanceof Error ? err.message : String(err);\n throw new NFError(`Fetch of '${manifestUrl}' returned ${msg}`);\n };\n\n return {\n provide: async function (\n remotesOrManifestUrl: string | FederationManifest,\n opts: { integrity?: string } = {}\n ) {\n if (typeof remotesOrManifestUrl !== 'string') return Promise.resolve(remotesOrManifestUrl);\n\n const parse = async (response: Response): Promise<FederationManifest> => {\n if (!opts.integrity) return response.json() as Promise<FederationManifest>;\n const bytes = await response.arrayBuffer();\n await verifyIntegrity(bytes, opts.integrity);\n return JSON.parse(new TextDecoder().decode(bytes)) as FederationManifest;\n };\n\n return fetch(remotesOrManifestUrl)\n .then(ensureOk)\n .then(parse)\n .catch(formatError(remotesOrManifestUrl));\n },\n };\n};\n\nexport { createManifestProvider };\n", "import { toPosix } from \"./path-patterns.js\";\nfunction normalize(path, trailingSlash) {\n let cand = toPosix(path);\n if (typeof trailingSlash === \"undefined\") {\n return cand;\n }\n while (cand.endsWith(\"/\")) {\n cand = cand.substring(0, cand.length - 1);\n }\n if (trailingSlash) {\n return cand + \"/\";\n }\n return cand;\n}\nfunction normalizePackageName(fileName) {\n const sanitized = fileName.replace(/[^A-Za-z0-9]/g, \"_\");\n return sanitized.startsWith(\"_\") ? sanitized.slice(1) : sanitized;\n}\nfunction inferPackageFromSecondary(secondary) {\n const parts = secondary.split(\"/\");\n if (secondary.startsWith(\"@\") && parts.length >= 2) {\n return parts[0] + \"/\" + parts[1];\n }\n return parts[0];\n}\nexport {\n inferPackageFromSecondary,\n normalize,\n normalizePackageName\n};\n", "import { CHUNK_PREFIX } from \"../../domain/core/chunk.js\";\nimport { inferPackageFromSecondary } from \"../../utils/normalize.js\";\nfunction isDense(entry) {\n return \"entries\" in entry;\n}\nfunction isFlatChunk(entry) {\n return entry.packageName.startsWith(CHUNK_PREFIX);\n}\nfunction densifyExternals(shared) {\n const result = [];\n const groupIndex = /* @__PURE__ */ new Map();\n for (const entry of shared) {\n if (isDense(entry)) {\n result.push(entry);\n continue;\n }\n if (isFlatChunk(entry)) {\n const { outFileName, ...rest } = entry;\n result.push({ ...rest, entries: { [entry.packageName]: outFileName } });\n continue;\n }\n const parent = inferPackageFromSecondary(entry.packageName);\n const sig = JSON.stringify({\n singleton: entry.singleton,\n strictVersion: entry.strictVersion,\n requiredVersion: entry.requiredVersion,\n version: entry.version,\n shareScope: entry.shareScope\n });\n const key = parent + \" \" + sig;\n const existing = groupIndex.get(key);\n if (existing === void 0) {\n const dense = {\n singleton: entry.singleton,\n strictVersion: entry.strictVersion,\n requiredVersion: entry.requiredVersion,\n packageName: parent,\n entries: { [entry.packageName]: entry.outFileName }\n };\n if (entry.version !== void 0) dense.version = entry.version;\n if (entry.shareScope !== void 0) dense.shareScope = entry.shareScope;\n if (entry.bundle !== void 0) dense.bundle = entry.bundle;\n if (entry.pool !== void 0) dense.pool = entry.pool;\n if (entry.dev !== void 0) dense.dev = entry.dev;\n groupIndex.set(key, result.length);\n result.push(dense);\n } else {\n result[existing].entries[entry.packageName] = entry.outFileName;\n }\n }\n return result;\n}\nfunction toDenseSharedInfoFormat(shared) {\n return shared.map((external) => {\n if (\"entries\" in external) return external;\n const { outFileName, ...baseSharedInfoProps } = external;\n return {\n ...baseSharedInfoProps,\n entries: { [external.packageName]: outFileName }\n };\n });\n}\nexport {\n densifyExternals,\n toDenseSharedInfoFormat\n};\n", "import {\n type RawRemoteEntry,\n type RemoteEntry,\n} from 'lib/core/1.domain/remote-entry/remote-entry.contract';\nimport type { ForProvidingRemoteEntries } from 'lib/core/2.app/driving-ports/for-providing-remote-entries.port';\nimport { NFError } from 'lib/core/native-federation.error';\nimport type { ModeConfig } from 'lib/core/2.app/config/mode.contract';\nimport { verifyIntegrity } from 'lib/utils/integrity';\nimport {\n densifyExternals,\n toDenseSharedInfoFormat,\n} from '@softarc/native-federation/internal/browser';\n\nconst createRemoteEntryProvider = (config: ModeConfig): ForProvidingRemoteEntries => {\n const ensureOk = (response: Response) => {\n if (!response.ok)\n return Promise.reject(new Error(`${response.status} - ${response.statusText}`));\n return response;\n };\n\n const fillEmptyFields = (remoteEntryUrl: string) => (remoteEntry: RemoteEntry) => {\n if (!remoteEntry.exposes) remoteEntry.exposes = [];\n if (!remoteEntry.shared) remoteEntry.shared = [];\n if (!remoteEntry.url) remoteEntry.url = remoteEntryUrl;\n return remoteEntry;\n };\n\n const normalizeRemoteEntry = (raw: RawRemoteEntry): RemoteEntry => {\n const shared = config.feature.convertFlatSharedInfo\n ? densifyExternals(raw.shared ?? [])\n : toDenseSharedInfoFormat(raw.shared ?? []);\n return { ...raw, shared } as RemoteEntry;\n };\n\n const formatError = (remoteEntryUrl: string) => (err: unknown) => {\n const msg = err instanceof Error ? err.message : String(err);\n throw new NFError(`Fetch of '${remoteEntryUrl}' returned ${msg}`);\n };\n\n return {\n provide: async function (remoteEntryUrl: string, opts: { integrity?: string } = {}) {\n const parse = async (response: Response): Promise<RawRemoteEntry> => {\n if (!opts.integrity) return response.json() as Promise<RawRemoteEntry>;\n const bytes = await response.arrayBuffer();\n await verifyIntegrity(bytes, opts.integrity);\n return JSON.parse(new TextDecoder().decode(bytes)) as RawRemoteEntry;\n };\n\n return fetch(remoteEntryUrl)\n .then(ensureOk)\n .then(parse)\n .then(normalizeRemoteEntry)\n .then(fillEmptyFields(remoteEntryUrl))\n .catch(formatError(remoteEntryUrl));\n },\n };\n};\n\nexport { createRemoteEntryProvider };\n", "import type { RemoteInfo, RemoteName, Remotes } from 'lib/core/1.domain';\nimport type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForRemoteInfoStorage } from 'lib/core/2.app/driving-ports/for-remote-info-storage.port';\nimport * as _path from 'lib/utils/path';\nimport { Optional } from 'lib/utils/optional';\n\nconst createRemoteInfoRepository = (config: StorageConfig): ForRemoteInfoStorage => {\n const STORAGE: StorageEntry<Remotes> = config.storage('remotes', {});\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: Remotes = STORAGE.get() ?? {};\n\n let _dirty = false;\n\n return {\n contains: function (remoteName: RemoteName) {\n return !!_cache[remoteName];\n },\n remove: function (remoteName: RemoteName) {\n if (remoteName in _cache) {\n delete _cache[remoteName];\n _dirty = true;\n }\n return this;\n },\n addOrUpdate: function (remoteName: string, remote: RemoteInfo) {\n _cache[remoteName] = remote;\n _dirty = true;\n return this;\n },\n tryGet: function (remoteName: RemoteName) {\n return Optional.of(_cache[remoteName]);\n },\n tryGetModule: function (remoteName: RemoteName, exposedModule: string) {\n return Optional.of(_cache[remoteName]?.exposes.find(m => m.moduleName === exposedModule)).map(\n m => _path.join(_cache[remoteName]!.scopeUrl, m.file)\n );\n },\n getAll: function () {\n return _cache;\n },\n commit: function () {\n if (!_dirty) return this;\n STORAGE.set(_cache);\n _dirty = false;\n return this;\n },\n };\n};\n\nexport { createRemoteInfoRepository };\n", "import type { ScopedExternals } from 'lib/core/1.domain/externals/external.contract';\nimport type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForScopedExternalsStorage } from 'lib/core/2.app/driving-ports/for-scoped-externals-storage.port';\nimport type { RemoteName, ScopedVersion } from 'lib/core/1.domain';\nimport { Optional } from 'lib/utils/optional';\n\nconst createScopedExternalsRepository = (config: StorageConfig): ForScopedExternalsStorage => {\n const STORAGE: StorageEntry<ScopedExternals> = config.storage('scoped-externals', {});\n\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: ScopedExternals = STORAGE.get() ?? {};\n\n let _dirty = false;\n\n return {\n addExternal: function (remoteName: RemoteName, external: string, version: ScopedVersion) {\n if (!_cache[remoteName]) _cache[remoteName] = {};\n _cache[remoteName][external] = version;\n _dirty = true;\n return this;\n },\n remove: function (remoteName: RemoteName) {\n if (remoteName in _cache) {\n delete _cache[remoteName];\n _dirty = true;\n }\n return this;\n },\n getAll: function () {\n return _cache;\n },\n tryGet: function (remoteName: string) {\n return Optional.of(_cache[remoteName]);\n },\n commit: function () {\n if (!_dirty) return this;\n STORAGE.set(_cache);\n _dirty = false;\n return this;\n },\n };\n};\n\nexport { createScopedExternalsRepository };\n", "import {\n type SharedExternal,\n type SharedExternals,\n GLOBAL_SCOPE,\n STRICT_SCOPE,\n} from 'lib/core/1.domain/externals/external.contract';\nimport type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForSharedExternalsStorage } from 'lib/core/2.app/driving-ports/for-shared-externals-storage.port';\nimport { Optional } from 'lib/utils/optional';\n\nconst createSharedExternalsRepository = (config: StorageConfig): ForSharedExternalsStorage => {\n const STORAGE: StorageEntry<SharedExternals> = config.storage<SharedExternals>(\n 'shared-externals',\n { [GLOBAL_SCOPE]: {} }\n );\n\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: SharedExternals = STORAGE.get() ?? { [GLOBAL_SCOPE]: {} };\n\n let _dirty = false;\n\n return {\n // Read from the cache rather than remembered from this init's entries: a warm init may not refetch\n // the tagged remote at all, and pooling has to coordinate its pool anyway. Exits on the first hit.\n // Per share scope, because a pool never spans one: a tag in another scope is no reason to pool here.\n hasPoolTag: function (shareScope?: string) {\n const scope = _cache[shareScope ?? GLOBAL_SCOPE];\n if (!scope) return false;\n for (const external of Object.values(scope))\n for (const version of external.versions)\n for (const remote of version.remotes) if (remote.pool?.trim()) return true;\n return false;\n },\n getFromScope: function (shareScope?: string) {\n return { ..._cache[shareScope ?? GLOBAL_SCOPE] };\n },\n addOrUpdate: function (externalName: string, external: SharedExternal, shareScope?: string) {\n if (!_cache[shareScope ?? GLOBAL_SCOPE]) _cache[shareScope ?? GLOBAL_SCOPE] = {};\n _cache[shareScope ?? GLOBAL_SCOPE]![externalName] = external;\n _dirty = true;\n return this;\n },\n getScopes: function (o = { includeGlobal: true }) {\n if (o.includeGlobal) return Object.keys(_cache);\n return Object.keys(_cache).filter(s => s !== GLOBAL_SCOPE);\n },\n // Batched: one traversal of the graph per init instead of one per overridden remote.\n removeFromAllScopes: function (remoteNames: ReadonlySet<string>) {\n if (remoteNames.size === 0) return;\n\n Object.values(_cache).forEach(scope => {\n const removeExternals: string[] = [];\n\n Object.entries(scope).forEach(([name, external]) => {\n let removedCopy = false;\n\n for (let i = external.versions.length - 1; i >= 0; i--) {\n const version = external.versions[i]!;\n const remotes = version.remotes;\n // The host is `remotes[0]` of a flagged version, and the filter below is about to move it.\n const host = version.host ? remotes[0]?.name : undefined;\n\n let keep = 0;\n for (let r = 0; r < remotes.length; r++) {\n if (remoteNames.has(remotes[r]!.name)) continue;\n remotes[keep++] = remotes[r]!;\n }\n if (keep !== remotes.length) {\n remotes.length = keep;\n removedCopy = true;\n _dirty = true;\n // Or `determine` keeps granting host precedence to a tag the host has left.\n if (host !== undefined && remoteNames.has(host)) version.host = false;\n }\n\n if (remotes.length === 0) {\n external.versions.splice(i, 1);\n _dirty = true;\n }\n }\n\n // Any lost copy re-elects the external, not only one that emptied a version: the copy may have\n // been the version's basis, or the build a surviving copy's `servedBy` names. A replacement entry\n // that no longer declares this external never marks it dirty itself, so the record would keep\n // pointing at a build that does not serve it any more.\n if (removedCopy) {\n external.dirty = true;\n if (external.versions.length === 0) removeExternals.push(name);\n }\n });\n removeExternals.forEach(name => delete scope[name]);\n });\n },\n scopeType: function (shareScope?: string) {\n switch (shareScope) {\n case GLOBAL_SCOPE:\n case null:\n case undefined:\n return 'global';\n case STRICT_SCOPE:\n return 'strict';\n default:\n return 'shareScope';\n }\n },\n tryGet: function (external: string, shareScope?: string) {\n return Optional.of(_cache[shareScope ?? GLOBAL_SCOPE]?.[external]);\n },\n commit: function () {\n if (!_dirty) return this;\n STORAGE.set(_cache);\n _dirty = false;\n return this;\n },\n };\n};\n\nexport { createSharedExternalsRepository };\n", "import { BuildNotificationType } from '@softarc/native-federation/domain';\nimport type { ImportMapConfig } from 'lib/core/2.app/config/import-map.contract';\nimport type { ForSSE } from 'lib/core/2.app/driving-ports/for-sse.port';\nimport type { LoggingConfig } from 'lib/core/2.app/config/log.contract';\n\n/**\n * Watches for federation build completion events and automatically reloads the page.\n *\n * This function establishes a Server-Sent Events (SSE) connection to listen for\n * 'federation-rebuild-complete' notifications. When a build completes successfully,\n * it triggers a page reload to reflect the latest changes.\n * @param endpoint - The SSE endpoint URL to watch for build notifications.\n */\nconst createSSEHandler = (config: ImportMapConfig & LoggingConfig): ForSSE => {\n const subscribers: EventSource[] = [];\n\n return {\n watchRemoteBuilds: function (endpoint: string) {\n const eventSource = new EventSource(endpoint);\n\n eventSource.onmessage = function (event) {\n const data = JSON.parse(event.data);\n if (data.type === BuildNotificationType.COMPLETED) {\n subscribers.forEach(sub => sub.close());\n config.log.debug(0, '[SSE] Rebuild completed, reloading...');\n config.reloadBrowserFn();\n }\n };\n\n eventSource.onerror = function (event) {\n config.log.error(0, '[SSE] Connection error:', event);\n };\n subscribers.push(eventSource);\n },\n\n closeAll: function () {\n subscribers.forEach(sub => sub.close());\n subscribers.length = 0;\n },\n };\n};\n\nexport { createSSEHandler };\n", "import type { StorageConfig, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport type { ForSharedChunksStorage } from 'lib/core/2.app/driving-ports/for-shared-chunks-storage.port';\nimport type { SharedChunks } from 'lib/core/1.domain/externals/chunks.contract';\nimport { Optional } from 'lib/utils/optional';\n\nconst createChunkRepository = (config: StorageConfig): ForSharedChunksStorage => {\n const STORAGE: StorageEntry<SharedChunks> = config.storage('shared-chunks', {});\n\n if (config.clearStorage) STORAGE.clear();\n\n const _cache: SharedChunks = STORAGE.get() ?? {};\n\n let _dirty = false;\n\n return {\n addOrReplace: function (remoteName: string, bundleName: string, chunks: string[]) {\n if (!_cache[remoteName]) _cache[remoteName] = {};\n _cache[remoteName][bundleName] = chunks;\n _dirty = true;\n return this;\n },\n // Whole-remote: a build that stops chunking a bundle omits the key, so `addOrReplace` cannot clear it.\n remove: function (remoteName: string) {\n if (remoteName in _cache) {\n delete _cache[remoteName];\n _dirty = true;\n }\n return this;\n },\n tryGet: function (remoteName: string, bundleName: string) {\n return Optional.of(_cache[remoteName]?.[bundleName]);\n },\n commit: function () {\n if (!_dirty) return this;\n STORAGE.set(_cache);\n _dirty = false;\n return this;\n },\n };\n};\n\nexport { createChunkRepository };\n", "import type { DrivingContract } from 'lib/core/2.app/driving-ports/driving.contract';\nimport type { ConfigContract } from 'lib/core/2.app/config/config.contract';\nimport { createBrowser } from 'lib/core/3.adapters/browser/browser';\nimport { createVersionCheck } from 'lib/core/3.adapters/checks/version.check';\nimport { createManifestProvider } from 'lib/core/3.adapters/http/manifest-provider';\nimport { createRemoteEntryProvider } from 'lib/core/3.adapters/http/remote-entry-provider';\nimport { createRemoteInfoRepository } from 'lib/core/3.adapters/storage/remote-info.repository';\nimport { createScopedExternalsRepository } from 'lib/core/3.adapters/storage/scoped-externals.repository';\nimport { createSharedExternalsRepository } from 'lib/core/3.adapters/storage/shared-externals.repository';\nimport { createSSEHandler } from 'lib/core/3.adapters/browser/sse-handler';\nimport { createChunkRepository } from 'lib/core/3.adapters/storage/chunk.repository';\n\nexport const createDriving = (\n config: ConfigContract\n): { adapters: DrivingContract; config: ConfigContract } => {\n const adapters = {\n versionCheck: createVersionCheck(),\n\n manifestProvider: createManifestProvider(),\n\n remoteEntryProvider: createRemoteEntryProvider(config),\n\n remoteInfoRepo: createRemoteInfoRepository(config),\n scopedExternalsRepo: createScopedExternalsRepository(config),\n sharedExternalsRepo: createSharedExternalsRepository(config),\n sharedChunksRepo: createChunkRepository(config),\n\n browser: createBrowser(config),\n sse: createSSEHandler(config),\n };\n return { adapters, config };\n};\n", "type TTCreateScript = (input: string) => string;\ntype TTCreateScriptURL = (input: string) => string;\n\ntype TTPolicyRules = {\n createScript?: TTCreateScript;\n createScriptURL?: TTCreateScriptURL;\n};\n\ntype TrustedValue = { toString(): string };\n\ntype TTPolicy = {\n createScript: (input: string) => TrustedValue;\n createScriptURL: (input: string) => TrustedValue;\n};\n\ntype TTFactory = {\n createPolicy: (name: string, rules: TTPolicyRules) => TTPolicy;\n};\n\nexport type NFTrustedTypesPolicy = {\n // `script.text` is a TrustedScript sink, so this must stay the genuine object.\n createScript: (input: string) => TrustedValue;\n createScriptURL: (input: string) => string;\n};\n\nconst IMPORT_MAP_KEYS = new Set(['imports', 'scopes', 'integrity']);\n\nconst validateImportMapJSON = (input: string): string => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(input);\n } catch {\n throw new TypeError('[nf-orchestrator] trusted-types: import map is not valid JSON');\n }\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n throw new TypeError('[nf-orchestrator] trusted-types: import map must be a plain object');\n }\n for (const key of Object.keys(parsed as Record<string, unknown>)) {\n if (!IMPORT_MAP_KEYS.has(key)) {\n throw new TypeError(`[nf-orchestrator] trusted-types: unexpected key \"${key}\" in import map`);\n }\n }\n return input;\n};\n\nconst validateScriptURL = (input: string): string => {\n const base = typeof location !== 'undefined' ? location.href : 'http://localhost/';\n let url: URL;\n try {\n url = new URL(input, base);\n } catch {\n throw new TypeError(`[nf-orchestrator] trusted-types: invalid script URL \"${input}\"`);\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') {\n throw new TypeError(\n `[nf-orchestrator] trusted-types: disallowed protocol \"${url.protocol}\" for script URL`\n );\n }\n return input;\n};\n\nconst passThroughPolicy: NFTrustedTypesPolicy = {\n createScript: input => input,\n createScriptURL: input => input,\n};\n\nlet cachedPolicy: NFTrustedTypesPolicy | null = null;\n\nexport const getTrustedTypesPolicy = (\n name: string | false = 'nfo'\n): NFTrustedTypesPolicy => {\n if (name === false) return passThroughPolicy;\n if (cachedPolicy) return cachedPolicy;\n\n const factory = (globalThis as { trustedTypes?: TTFactory }).trustedTypes;\n if (!factory) {\n cachedPolicy = passThroughPolicy;\n return cachedPolicy;\n }\n\n const native = factory.createPolicy(name, {\n createScript: validateImportMapJSON,\n createScriptURL: validateScriptURL,\n });\n\n cachedPolicy = {\n createScript: input => native.createScript(input),\n createScriptURL: input => String(native.createScriptURL(input)),\n };\n return cachedPolicy;\n};\n\nexport const __resetTrustedTypesPolicyForTests = (): void => {\n cachedPolicy = null;\n};\n", "import type { ImportMap } from 'lib/core/1.domain';\nimport type { SetImportMap } from 'lib/core/2.app/config/import-map.contract';\nimport { getTrustedTypesPolicy } from './trusted-types';\n\nexport const replaceInDOM =\n (mapType: string, trustedTypesPolicyName: string | false = 'nfo'): SetImportMap =>\n (importMap: ImportMap, opts = {}) => {\n if (opts?.override) {\n document.head\n .querySelectorAll(`script[type=\"${mapType}\"]`)\n .forEach(importMap => importMap.remove());\n }\n\n const policy = getTrustedTypesPolicy(trustedTypesPolicyName);\n document.head.appendChild(\n Object.assign(document.createElement('script'), {\n type: mapType,\n text: policy.createScript(JSON.stringify(importMap)),\n })\n );\n return Promise.resolve(importMap);\n };\n", "import type { ImportMapConfig } from 'lib/core/2.app/config/import-map.contract';\nimport { replaceInDOM } from './replace-in-dom';\nimport { getTrustedTypesPolicy } from './trusted-types';\n\nconst useDefaultImportMap = (trustedTypesPolicyName: string | false = 'nfo'): ImportMapConfig => ({\n loadModuleFn: url => {\n const trusted = getTrustedTypesPolicy(trustedTypesPolicyName).createScriptURL(url);\n return import(/* @vite-ignore */ trusted);\n },\n setImportMapFn: replaceInDOM('importmap', trustedTypesPolicyName),\n reloadBrowserFn: () => {\n window.location.reload();\n },\n});\n\nexport { useDefaultImportMap };\n", "import type {\n ImportMapConfig,\n ImportMapOptions,\n} from 'lib/core/2.app/config/import-map.contract';\nimport { useDefaultImportMap } from './use-default';\n\nexport const createImportMapConfig = (o: Partial<ImportMapOptions>): ImportMapConfig => {\n const fallback = useDefaultImportMap(o.trustedTypesPolicyName);\n return {\n setImportMapFn: o.setImportMapFn ?? fallback.setImportMapFn,\n loadModuleFn: o.loadModuleFn ?? fallback.loadModuleFn,\n reloadBrowserFn: o.reloadBrowserFn ?? fallback.reloadBrowserFn,\n };\n};\n", "import type { HostConfig, HostOptions } from 'lib/core/2.app/config/host.contract';\n\nexport const createHostConfig = (override: Partial<HostOptions>): HostConfig => {\n const extras = override?.manifestIntegrity\n ? { manifestIntegrity: override.manifestIntegrity }\n : {};\n\n if (!override?.hostRemoteEntry) {\n return { hostRemoteEntry: false, ...extras };\n }\n if (typeof override.hostRemoteEntry === 'string') {\n return {\n hostRemoteEntry: {\n name: '__NF-HOST__',\n url: override.hostRemoteEntry,\n },\n ...extras,\n };\n }\n return {\n hostRemoteEntry: {\n name: '__NF-HOST__',\n ...override.hostRemoteEntry,\n },\n ...extras,\n };\n};\n", "import type { Logger } from 'lib/core/2.app/config/log.contract';\n\nconst noopLogger: Logger = {\n debug: () => {},\n error: () => {},\n warn: () => {},\n};\n\nexport { noopLogger };\n", "export const LogLevel = {\n debug: 0,\n warn: 1,\n error: 2,\n};\n\nexport type LogType = keyof typeof LogLevel;\n\nexport type Logger = {\n error: (step: number, msg: string, details?: unknown) => void;\n warn: (step: number, msg: string, details?: unknown) => void;\n debug: (step: number, msg: string, details?: unknown) => void;\n};\n\nexport type LogHandler = Logger & {\n level: LogType;\n};\n\nexport type LoggingConfig = {\n log: LogHandler;\n sse: boolean;\n};\n\nexport type LoggingOptions = {\n logger?: Logger;\n logLevel?: LogType;\n sse?: boolean;\n};\n", "import {\n type LogType,\n type LogHandler,\n type Logger,\n LogLevel,\n} from 'lib/core/2.app/config/log.contract';\n\nconst createLogHandler = (logger: Logger, logLevel: LogType): LogHandler => {\n const logTypes = Object.keys(LogLevel).filter(key => isNaN(Number(key))) as LogType[];\n\n return logTypes.reduce(\n (acc, logMessageType) => {\n return {\n ...acc,\n [logMessageType]: (step: number, message: string, details: unknown) => {\n if (LogLevel[logMessageType] >= LogLevel[logLevel]) {\n logger[logMessageType](step, message, details);\n }\n },\n };\n },\n { level: logLevel } as LogHandler\n );\n};\n\nexport { createLogHandler };\n", "import type { LoggingConfig, LoggingOptions } from 'lib/core/2.app/config/log.contract';\nimport { noopLogger } from './noop.logger';\nimport { createLogHandler } from './log.handler';\n\nexport const createLogConfig = ({ logger, logLevel, sse }: LoggingOptions): LoggingConfig => ({\n log: createLogHandler(logger ?? noopLogger, logLevel ?? 'error'),\n sse: !!sse,\n});\n", "import type { StorageEntryKey } from 'lib/core/2.app/config/storage.contract';\nimport { NFError } from 'lib/core/native-federation.error';\n\ntype CloneEntry = <T>(name: StorageEntryKey, raw: T) => T;\n\nconst cloneEntry: CloneEntry = <T>(name: StorageEntryKey, raw: T) => {\n try {\n if (typeof structuredClone === 'function') {\n return structuredClone(raw);\n }\n } catch {\n /* structured clone is unavailable */\n }\n try {\n return JSON.parse(JSON.stringify(raw));\n } catch {\n /* object is not stringifyable */\n }\n throw new NFError(`Could not clone entry '${String(name)}'`);\n};\n\nexport { CloneEntry, cloneEntry };\n", "import { cloneEntry } from 'lib/utils/clone-entry';\nimport {\n type StorageEntryCreator,\n type StorageEntry,\n} from 'lib/core/2.app/config/storage.contract';\n\nconst globalThisStorageEntry: StorageEntryCreator =\n (namespace: string) =>\n <TValue>(key: string, initialValue: TValue) => {\n if (!(globalThis as unknown as { [namespace]: unknown })[namespace]) {\n (globalThis as unknown as { [namespace]: unknown })[namespace] = {};\n }\n\n const storage = (globalThis as unknown as { [namespace]: { [P in typeof key]: TValue } })[\n namespace\n ]!;\n\n const entry: StorageEntry<TValue> = {\n get(): TValue {\n return cloneEntry(key, key in storage ? storage[key] : initialValue)!;\n },\n set(value: TValue): StorageEntry<TValue> {\n storage[key] = cloneEntry(key, value);\n return entry;\n },\n clear(): StorageEntry<TValue> {\n storage[key] = cloneEntry(key, initialValue);\n return this;\n },\n };\n\n return entry;\n };\n\nexport { globalThisStorageEntry };\n", "import type { StorageConfig, StorageOptions } from 'lib/core/2.app/config/storage.contract';\nimport { globalThisStorageEntry } from './global-this.storage';\n\nexport const createStorageConfig = (override: StorageOptions): StorageConfig => ({\n storage: override.storage\n ? override.storage(override.storageNamespace ?? '__NATIVE_FEDERATION__')\n : globalThisStorageEntry(override.storageNamespace ?? '__NATIVE_FEDERATION__'),\n clearStorage: override.clearStorage ?? false,\n});\n", "import type { ModeProfileConfig } from 'lib/core/2.app/config/mode.contract';\n\nexport const defaultProfile: ModeProfileConfig = {\n latestSharedExternal: false,\n skipInvalidExternalVersions: false,\n scopeUncoveredEntrypoints: false,\n overrideCachedRemotes: 'init-only',\n overrideCachedRemotesIfURLMatches: false,\n};\n", "import type { ModeConfig, ModeOptions } from 'lib/core/2.app/config/mode.contract';\nimport { defaultProfile } from './default.profile';\n\nexport const createModeConfig = (override: ModeOptions): ModeConfig => {\n const strictnessConfig =\n typeof override.strict === 'boolean'\n ? {\n strictRemoteEntry: override.strict,\n strictExternalCompatibility: override.strict,\n strictExternalSameVersionCompatibility: override.strict,\n strictExternalVersion: override.strict,\n strictImportMap: override.strict,\n strictEntryPointCoverage: override.strict,\n }\n : {\n strictRemoteEntry: override.strict?.strictRemoteEntry ?? false,\n strictExternalCompatibility: override.strict?.strictExternalCompatibility ?? false,\n strictExternalSameVersionCompatibility:\n override.strict?.strictExternalSameVersionCompatibility ?? false,\n strictExternalVersion: override.strict?.strictExternalVersion ?? false,\n strictImportMap: override.strict?.strictImportMap ?? false,\n strictEntryPointCoverage: override.strict?.strictEntryPointCoverage ?? false,\n };\n\n return {\n strict: strictnessConfig,\n profile: { ...defaultProfile, ...(override.profile ?? {}) },\n feature: {\n convertFlatSharedInfo: override.feature?.convertFlatSharedInfo ?? false,\n useAutoExternalPooling: override.feature?.useAutoExternalPooling ?? false,\n },\n };\n};\n", "import type { ConfigContract, NFOptions } from 'lib/core/2.app/config/config.contract';\nimport { createImportMapConfig } from 'lib/core/4.config/import-map/import-map.config';\nimport { createHostConfig } from 'lib/core/4.config/host/host.config';\nimport { createLogConfig } from 'lib/core/4.config/logging/log.config';\nimport { createStorageConfig } from 'lib/core/4.config/storage/storage.config';\nimport { createModeConfig } from 'lib/core/4.config/mode/mode.config';\n\nexport const createConfigHandlers = (overrides: NFOptions): ConfigContract => ({\n ...createImportMapConfig(overrides),\n ...createHostConfig(overrides),\n ...createLogConfig(overrides),\n ...createStorageConfig(overrides),\n ...createModeConfig(overrides),\n});\n", "import type { ConfigContract } from '../2.app/config/config.contract';\nimport type { DrivingContract } from '../2.app/driving-ports/driving.contract';\nimport type { InitRemoteEntryFlow, RemoteRef } from '../2.app/driver-ports/init/flow.contract';\nimport type {\n LoadRemoteModule,\n LoadRemoteModuleOf,\n NativeFederationResult,\n} from '../init-federation.contract';\n\nexport const createStateDump =\n (config: ConfigContract, adapters: DrivingContract) =>\n (msg: string): void =>\n config.log.debug(0, msg, {\n remotes: { ...adapters.remoteInfoRepo.getAll() },\n 'shared-externals': adapters.sharedExternalsRepo\n .getScopes({ includeGlobal: true })\n .reduce(\n (acc, scope) => ({ ...acc, [scope]: adapters.sharedExternalsRepo.getFromScope(scope) }),\n {}\n ),\n 'scoped-externals': adapters.scopedExternalsRepo.getAll(),\n });\n\nexport const createFederationResult = ({\n config,\n adapters,\n loadRemoteModule,\n initRemoteEntryFlow,\n afterInitRemoteEntry,\n}: {\n config: ConfigContract;\n adapters: DrivingContract;\n loadRemoteModule: LoadRemoteModule;\n initRemoteEntryFlow: InitRemoteEntryFlow;\n afterInitRemoteEntry?: () => Promise<unknown>;\n}): NativeFederationResult => {\n const stateDump = createStateDump(config, adapters);\n\n const initRemoteEntry = async (\n remoteEntryUrl: string,\n remote?: RemoteRef\n ): Promise<NativeFederationResult> => {\n const remoteName = typeof remote === 'string' ? remote : remote?.name;\n return initRemoteEntryFlow(remoteEntryUrl, remote)\n .catch(e => {\n stateDump(`[dynamic-init][${remoteName ?? remoteEntryUrl}] STATE DUMP`);\n if (config.strict.strictRemoteEntry) return Promise.reject(e);\n else console.warn('Failed to initialize remote entry, continuing anyway.');\n return Promise.resolve();\n })\n .then(() => afterInitRemoteEntry?.())\n .then(() => result);\n };\n\n const result: NativeFederationResult = {\n config,\n adapters,\n loadRemoteModule,\n load: loadRemoteModule,\n as: <TModule = unknown>() => ({\n loadRemoteModule: loadRemoteModule as LoadRemoteModuleOf<TModule>,\n load: loadRemoteModule as LoadRemoteModuleOf<TModule>,\n }),\n initRemoteEntry,\n };\n\n return result;\n};\n", "import type { NativeFederationResult } from './init-federation.contract';\nimport type { NFOptions } from './2.app/config/config.contract';\nimport type { FederationManifest } from './1.domain';\nimport { createInitFlow } from './2.app/flows/init.flow';\nimport { createInitRemoteEntryFlow } from './2.app/flows/init-remote-entry.flow';\nimport { INIT_FLOW_FACTORY } from './5.di/init.factory';\nimport { createDriving } from './5.di/driving.factory';\nimport { createConfigHandlers } from './5.di/config.factory';\nimport { createFederationResult, createStateDump } from './5.di/federation-result.factory';\n\nconst initFederation = (\n remotesOrManifestUrl: string | FederationManifest,\n options: NFOptions = {}\n): Promise<NativeFederationResult> => {\n const { adapters, config } = createDriving(createConfigHandlers(options));\n\n const factory = INIT_FLOW_FACTORY({ adapters, config });\n const initFlow = createInitFlow(factory);\n const initRemoteEntryFlow = createInitRemoteEntryFlow(factory);\n\n return initFlow(remotesOrManifestUrl)\n .then(({ loadRemoteModule }) =>\n createFederationResult({ config, adapters, loadRemoteModule, initRemoteEntryFlow })\n )\n .catch(e => {\n createStateDump(config, adapters)(`[init] STATE DUMP`);\n return Promise.reject(e);\n });\n};\n\nexport { initFederation };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAM,QACJ,OAAO,YAAY,YACnB,QAAQ,OACR,QAAQ,IAAI,cACZ,cAAc,KAAK,QAAQ,IAAI,UAAU,IACvC,IAAI,SAAS,QAAQ,MAAM,UAAU,GAAG,IAAI,IAC5C,MAAM;AAAA,IAAC;AAEX,WAAO,UAAU;AAAA;AAAA;;;ACVjB;AAAA;AAAA;AAIA,QAAM,sBAAsB;AAE5B,QAAM,aAAa;AACnB,QAAM,mBAAmB,OAAO;AAAA,IACL;AAG3B,QAAM,4BAA4B;AAIlC,QAAM,wBAAwB,aAAa;AAE3C,QAAM,gBAAgB;AAAA,MACpB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO,UAAU;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,yBAAyB;AAAA,MACzB,YAAY;AAAA,IACd;AAAA;AAAA;;;ACpCA;AAAA;AAAA;AAEA,QAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI;AACJ,QAAM,QAAQ;AACd,cAAU,OAAO,UAAU,CAAC;AAG5B,QAAM,KAAK,QAAQ,KAAK,CAAC;AACzB,QAAM,SAAS,QAAQ,SAAS,CAAC;AACjC,QAAM,MAAM,QAAQ,MAAM,CAAC;AAC3B,QAA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AM;AAAA,EACtB;AAEA,QAAM,SAAiC;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,IAAI,OAA0B;AAAA,MAC5B;AAAA,MACA,MAAM;AAAA,IACR;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;;;ACzDA,IAAM,iBAAiB,CACrB,sBACA,UAAqB,CAAC,MACc;AACpC,QAAM,EAAE,UAAU,OAAO,IAAI,cAAc,qBAAqB,OAAO,CAAC;AAExE,QAAM,UAAU,kBAAkB,EAAE,UAAU,OAAO,CAAC;AACtD,QAAM,WAAW,eAAe,OAAO;AACvC,QAAM,sBAAsB,0BAA0B,OAAO;AAE7D,SAAO,SAAS,oBAAoB,EACjC;AAAA,IAAK,CAAC,EAAE,iBAAiB,MACxB,uBAAuB,EAAE,QAAQ,UAAU,kBAAkB,oBAAoB,CAAC;AAAA,EACpF,EACC,MAAM,OAAK;AACV,oBAAgB,QAAQ,QAAQ,EAAE,mBAAmB;AACrD,WAAO,QAAQ,OAAO,CAAC;AAAA,EACzB,CAAC;AACL;",
|
|
6
|
+
"names": ["require_valid", "coverage", "consumedMembers", "serving", "basis", "getScope", "ships", "import_valid", "semverValid", "semverSatisfies", "semverCompare", "semverValidRange", "semverMinVersion", "importMap"]
|
|
7
7
|
}
|