@softarc/native-federation-orchestrator 4.5.2 → 4.5.3
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 +315 -99
- package/fesm2022/@softarc/native-federation-orchestrator.mjs.map +4 -4
- package/fesm2022/module-federation.mjs +25 -20
- package/fesm2022/module-federation.mjs.map +2 -2
- package/fesm2022/node.mjs +315 -99
- package/fesm2022/node.mjs.map +3 -3
- 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 +7 -0
- package/types/lib/core/1.domain/remote-entry/remote-entry.contract.d.ts +1 -0
- package/types/lib/core/2.app/config/mode.contract.d.ts +1 -0
- package/types/lib/core/2.app/driving-ports/for-shared-externals-storage.port.d.ts +1 -1
- package/types/lib/core/2.app/steps/store-remote-entry.d.ts +15 -7
package/fesm2022/options.mjs
CHANGED
|
@@ -52,10 +52,9 @@ var globalThisStorageEntry = (namespace) => (key, initialValue) => {
|
|
|
52
52
|
globalThis[namespace] = {};
|
|
53
53
|
}
|
|
54
54
|
const storage = globalThis[namespace];
|
|
55
|
-
if (!storage[key]) storage[key] = initialValue;
|
|
56
55
|
const entry = {
|
|
57
56
|
get() {
|
|
58
|
-
return cloneEntry(key, storage[key]);
|
|
57
|
+
return cloneEntry(key, key in storage ? storage[key] : initialValue);
|
|
59
58
|
},
|
|
60
59
|
set(value) {
|
|
61
60
|
storage[key] = cloneEntry(key, value);
|
|
@@ -71,13 +70,10 @@ var globalThisStorageEntry = (namespace) => (key, initialValue) => {
|
|
|
71
70
|
|
|
72
71
|
// src/lib/core/4.config/storage/local.storage.ts
|
|
73
72
|
var localStorageEntry = (namespace) => (key, initialValue) => {
|
|
74
|
-
if (!localStorage.getItem(`${namespace}.${String(key)}`)) {
|
|
75
|
-
localStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));
|
|
76
|
-
}
|
|
77
73
|
const entry = {
|
|
78
74
|
get() {
|
|
79
75
|
const fromCache = localStorage.getItem(`${namespace}.${String(key)}`);
|
|
80
|
-
if (!fromCache) return
|
|
76
|
+
if (!fromCache) return cloneEntry(key, initialValue);
|
|
81
77
|
return JSON.parse(fromCache);
|
|
82
78
|
},
|
|
83
79
|
set(value) {
|
|
@@ -94,13 +90,10 @@ var localStorageEntry = (namespace) => (key, initialValue) => {
|
|
|
94
90
|
|
|
95
91
|
// src/lib/core/4.config/storage/session.storage.ts
|
|
96
92
|
var sessionStorageEntry = (namespace) => (key, initialValue) => {
|
|
97
|
-
if (!sessionStorage.getItem(`${namespace}.${String(key)}`)) {
|
|
98
|
-
sessionStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));
|
|
99
|
-
}
|
|
100
93
|
const entry = {
|
|
101
94
|
get() {
|
|
102
95
|
const fromCache = sessionStorage.getItem(`${namespace}.${String(key)}`);
|
|
103
|
-
if (!fromCache) return
|
|
96
|
+
if (!fromCache) return cloneEntry(key, initialValue);
|
|
104
97
|
return JSON.parse(fromCache);
|
|
105
98
|
},
|
|
106
99
|
set(value) {
|
|
@@ -222,6 +215,7 @@ var useDefaultImportMap = (trustedTypesPolicyName = "nfo") => ({
|
|
|
222
215
|
var defaultProfile = {
|
|
223
216
|
latestSharedExternal: false,
|
|
224
217
|
skipInvalidExternalVersions: false,
|
|
218
|
+
scopeUncoveredEntrypoints: false,
|
|
225
219
|
overrideCachedRemotes: "init-only",
|
|
226
220
|
overrideCachedRemotesIfURLMatches: false
|
|
227
221
|
};
|
|
@@ -230,6 +224,7 @@ var defaultProfile = {
|
|
|
230
224
|
var cachingProfile = {
|
|
231
225
|
latestSharedExternal: false,
|
|
232
226
|
skipInvalidExternalVersions: false,
|
|
227
|
+
scopeUncoveredEntrypoints: false,
|
|
233
228
|
overrideCachedRemotes: "never",
|
|
234
229
|
overrideCachedRemotesIfURLMatches: false
|
|
235
230
|
};
|
package/fesm2022/options.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/core/2.app/config/log.contract.ts", "../../src/lib/core/4.config/logging/console.logger.ts", "../../src/lib/core/4.config/logging/noop.logger.ts", "../../src/lib/core/native-federation.error.ts", "../../src/lib/utils/clone-entry.ts", "../../src/lib/core/4.config/storage/global-this.storage.ts", "../../src/lib/core/4.config/storage/local.storage.ts", "../../src/lib/core/4.config/storage/session.storage.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-import-shim.ts", "../../src/lib/core/4.config/import-map/use-default.ts", "../../src/lib/core/4.config/mode/default.profile.ts", "../../src/lib/core/4.config/mode/caching.profile.ts"],
|
|
4
|
-
"sourcesContent": ["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 type { Logger } from 'lib/core/2.app/config/log.contract';\n\nconst consoleLogger: Logger = {\n /* eslint no-console: \"off\", curly: \"error\" */\n debug: (step: number, msg: string, err) =>\n !!err ? console.log(`[DEBUG][${step}]: ${msg}`, err) : console.log(`[DEBUG][${step}]: ${msg}`),\n error: (step: number, msg: string, err) =>\n !!err ? console.error(`[NF][${step}]: ${msg}`, err) : console.error(`[NF][${step}]: ${msg}`),\n warn: (step: number, msg: string, err) =>\n !!err ? console.warn(`[NF][${step}]: ${msg}`, err) : console.warn(`[NF][${step}]: ${msg}`),\n};\n\nexport { consoleLogger };\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", "class NFError extends Error {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'NFError';\n }\n}\n\nexport { NFError };\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 { StorageEntryCreator, StorageEntry } from 'lib/core/2.app/config/storage.contract';\n\nconst localStorageEntry: StorageEntryCreator =\n (namespace: string) =>\n <TValue>(key: string, initialValue: TValue) => {\n if (!localStorage.getItem(`${namespace}.${String(key)}`)) {\n localStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));\n }\n const entry: StorageEntry<TValue> = {\n get() {\n const fromCache = localStorage.getItem(`${namespace}.${String(key)}`);\n if (!fromCache) return undefined;\n return JSON.parse(fromCache);\n },\n set(value: TValue): StorageEntry<TValue> {\n localStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(value));\n return entry;\n },\n clear(): StorageEntry<TValue> {\n localStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));\n return this;\n },\n };\n return entry;\n };\n\nexport { localStorageEntry };\n", "import type { StorageEntryCreator, StorageEntry } from 'lib/core/2.app/config/storage.contract';\n\nconst sessionStorageEntry: StorageEntryCreator =\n (namespace: string) =>\n <TValue>(key: string, initialValue: TValue) => {\n if (!sessionStorage.getItem(`${namespace}.${String(key)}`)) {\n sessionStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));\n }\n const entry: StorageEntry<TValue> = {\n get() {\n const fromCache = sessionStorage.getItem(`${namespace}.${String(key)}`);\n if (!fromCache) return undefined;\n return JSON.parse(fromCache);\n },\n set(value: TValue): StorageEntry<TValue> {\n sessionStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(value));\n return entry;\n },\n clear(): StorageEntry<TValue> {\n sessionStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));\n return this;\n },\n };\n return entry;\n };\n\nexport { sessionStorageEntry };\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\ndeclare function importShim<T>(url: string): T;\n\nconst useShimImportMap = (\n cfg: { shimMode: boolean } = { shimMode: false },\n trustedTypesPolicyName: string | false = 'nfo'\n): ImportMapConfig => ({\n loadModuleFn: url => {\n const trusted = getTrustedTypesPolicy(trustedTypesPolicyName).createScriptURL(url);\n return importShim(trusted);\n },\n setImportMapFn: replaceInDOM(\n cfg.shimMode ? 'importmap-shim' : 'importmap',\n trustedTypesPolicyName\n ),\n reloadBrowserFn: () => {\n window.location.reload();\n },\n});\n\nexport { useShimImportMap };\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 { 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 { ModeProfileConfig } from 'lib/core/2.app/config/mode.contract';\n\nexport const cachingProfile: ModeProfileConfig = {\n latestSharedExternal: false,\n skipInvalidExternalVersions: false,\n overrideCachedRemotes: 'never',\n overrideCachedRemotesIfURLMatches: false,\n};\n"],
|
|
5
|
-
"mappings": ";AAAO,IAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AACT;;;ACFA,IAAM,gBAAwB;AAAA;AAAA,EAE5B,OAAO,CAAC,MAAc,KAAa,QACjC,CAAC,CAAC,MAAM,QAAQ,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,GAAG,IAAI,QAAQ,IAAI,WAAW,IAAI,MAAM,GAAG,EAAE;AAAA,EAC/F,OAAO,CAAC,MAAc,KAAa,QACjC,CAAC,CAAC,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,GAAG,IAAI,QAAQ,MAAM,QAAQ,IAAI,MAAM,GAAG,EAAE;AAAA,EAC7F,MAAM,CAAC,MAAc,KAAa,QAChC,CAAC,CAAC,MAAM,QAAQ,KAAK,QAAQ,IAAI,MAAM,GAAG,IAAI,GAAG,IAAI,QAAQ,KAAK,QAAQ,IAAI,MAAM,GAAG,EAAE;AAC7F;;;ACRA,IAAM,aAAqB;AAAA,EACzB,OAAO,MAAM;AAAA,EAAC;AAAA,EACd,OAAO,MAAM;AAAA,EAAC;AAAA,EACd,MAAM,MAAM;AAAA,EAAC;AACf;;;ACNA,IAAM,UAAN,cAAsB,MAAM;AAAA,EAC1B,YAAY,SAAiB,OAAe;AAC1C,UAAM,SAAS,KAAK;AACpB,SAAK,OAAO;AAAA,EACd;AACF;;;ACAA,IAAM,aAAyB,CAAI,MAAuB,QAAW;AACnE,MAAI;AACF,QAAI,OAAO,oBAAoB,YAAY;AACzC,aAAO,gBAAgB,GAAG;AAAA,IAC5B;AAAA,EACF,QAAQ;AAAA,EAER;AACA,MAAI;AACF,WAAO,KAAK,MAAM,KAAK,UAAU,GAAG,CAAC;AAAA,EACvC,QAAQ;AAAA,EAER;AACA,QAAM,IAAI,QAAQ,0BAA0B,OAAO,IAAI,CAAC,GAAG;AAC7D;;;ACbA,IAAM,yBACJ,CAAC,cACD,CAAS,KAAa,iBAAyB;AAC7C,MAAI,CAAE,WAAmD,SAAS,GAAG;AACnE,IAAC,WAAmD,SAAS,IAAI,CAAC;AAAA,EACpE;AAEA,QAAM,UAAW,WACf,SACF;
|
|
4
|
+
"sourcesContent": ["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 type { Logger } from 'lib/core/2.app/config/log.contract';\n\nconst consoleLogger: Logger = {\n /* eslint no-console: \"off\", curly: \"error\" */\n debug: (step: number, msg: string, err) =>\n !!err ? console.log(`[DEBUG][${step}]: ${msg}`, err) : console.log(`[DEBUG][${step}]: ${msg}`),\n error: (step: number, msg: string, err) =>\n !!err ? console.error(`[NF][${step}]: ${msg}`, err) : console.error(`[NF][${step}]: ${msg}`),\n warn: (step: number, msg: string, err) =>\n !!err ? console.warn(`[NF][${step}]: ${msg}`, err) : console.warn(`[NF][${step}]: ${msg}`),\n};\n\nexport { consoleLogger };\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", "class NFError extends Error {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'NFError';\n }\n}\n\nexport { NFError };\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 { StorageEntryCreator, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport { cloneEntry } from 'lib/utils/clone-entry';\n\nconst localStorageEntry: StorageEntryCreator =\n (namespace: string) =>\n <TValue>(key: string, initialValue: TValue) => {\n const entry: StorageEntry<TValue> = {\n get() {\n const fromCache = localStorage.getItem(`${namespace}.${String(key)}`);\n if (!fromCache) return cloneEntry(key, initialValue);\n return JSON.parse(fromCache);\n },\n set(value: TValue): StorageEntry<TValue> {\n localStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(value));\n return entry;\n },\n clear(): StorageEntry<TValue> {\n localStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));\n return this;\n },\n };\n return entry;\n };\n\nexport { localStorageEntry };\n", "import type { StorageEntryCreator, StorageEntry } from 'lib/core/2.app/config/storage.contract';\nimport { cloneEntry } from 'lib/utils/clone-entry';\n\nconst sessionStorageEntry: StorageEntryCreator =\n (namespace: string) =>\n <TValue>(key: string, initialValue: TValue) => {\n const entry: StorageEntry<TValue> = {\n get() {\n const fromCache = sessionStorage.getItem(`${namespace}.${String(key)}`);\n if (!fromCache) return cloneEntry(key, initialValue);\n return JSON.parse(fromCache);\n },\n set(value: TValue): StorageEntry<TValue> {\n sessionStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(value));\n return entry;\n },\n clear(): StorageEntry<TValue> {\n sessionStorage.setItem(`${namespace}.${String(key)}`, JSON.stringify(initialValue));\n return this;\n },\n };\n return entry;\n };\n\nexport { sessionStorageEntry };\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\ndeclare function importShim<T>(url: string): T;\n\nconst useShimImportMap = (\n cfg: { shimMode: boolean } = { shimMode: false },\n trustedTypesPolicyName: string | false = 'nfo'\n): ImportMapConfig => ({\n loadModuleFn: url => {\n const trusted = getTrustedTypesPolicy(trustedTypesPolicyName).createScriptURL(url);\n return importShim(trusted);\n },\n setImportMapFn: replaceInDOM(\n cfg.shimMode ? 'importmap-shim' : 'importmap',\n trustedTypesPolicyName\n ),\n reloadBrowserFn: () => {\n window.location.reload();\n },\n});\n\nexport { useShimImportMap };\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 { 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 { ModeProfileConfig } from 'lib/core/2.app/config/mode.contract';\n\nexport const cachingProfile: ModeProfileConfig = {\n latestSharedExternal: false,\n skipInvalidExternalVersions: false,\n scopeUncoveredEntrypoints: false,\n overrideCachedRemotes: 'never',\n overrideCachedRemotesIfURLMatches: false,\n};\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AACT;;;ACFA,IAAM,gBAAwB;AAAA;AAAA,EAE5B,OAAO,CAAC,MAAc,KAAa,QACjC,CAAC,CAAC,MAAM,QAAQ,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,GAAG,IAAI,QAAQ,IAAI,WAAW,IAAI,MAAM,GAAG,EAAE;AAAA,EAC/F,OAAO,CAAC,MAAc,KAAa,QACjC,CAAC,CAAC,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM,GAAG,IAAI,GAAG,IAAI,QAAQ,MAAM,QAAQ,IAAI,MAAM,GAAG,EAAE;AAAA,EAC7F,MAAM,CAAC,MAAc,KAAa,QAChC,CAAC,CAAC,MAAM,QAAQ,KAAK,QAAQ,IAAI,MAAM,GAAG,IAAI,GAAG,IAAI,QAAQ,KAAK,QAAQ,IAAI,MAAM,GAAG,EAAE;AAC7F;;;ACRA,IAAM,aAAqB;AAAA,EACzB,OAAO,MAAM;AAAA,EAAC;AAAA,EACd,OAAO,MAAM;AAAA,EAAC;AAAA,EACd,MAAM,MAAM;AAAA,EAAC;AACf;;;ACNA,IAAM,UAAN,cAAsB,MAAM;AAAA,EAC1B,YAAY,SAAiB,OAAe;AAC1C,UAAM,SAAS,KAAK;AACpB,SAAK,OAAO;AAAA,EACd;AACF;;;ACAA,IAAM,aAAyB,CAAI,MAAuB,QAAW;AACnE,MAAI;AACF,QAAI,OAAO,oBAAoB,YAAY;AACzC,aAAO,gBAAgB,GAAG;AAAA,IAC5B;AAAA,EACF,QAAQ;AAAA,EAER;AACA,MA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G;AACjF,WAAO,WAAW,OAAO;AAAA,EAC3B;AAAA,EACA,gBAAgB;AAAA,IACd,IAAI,WAAW,mBAAmB;AAAA,IAClC;AAAA,EACF;AAAA,EACA,iBAAiB,MAAM;AACrB,WAAO,SAAS,OAAO;AAAA,EACzB;AACF;;;ACjBA,IAAM,sBAAsB,CAAC,yBAAyC,WAA4B;AAAA,EAChG,cAAc,SAAO;AACnB,UAAM,UAAU,sBAAsB,sBAAsB,EAAE,gBAAgB,GAAG;AACjF,WAAO;AAAA;AAAA,MAA0B;AAAA;AAAA,EACnC;AAAA,EACA,gBAAgB,aAAa,aAAa,sBAAsB;AAAA,EAChE,iBAAiB,MAAM;AACrB,WAAO,SAAS,OAAO;AAAA,EACzB;AACF;;;ACXO,IAAM,iBAAoC;AAAA,EAC/C,sBAAsB;AAAA,EACtB,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,uBAAuB;AAAA,EACvB,mCAAmC;AACrC;;;ACNO,IAAM,iBAAoC;AAAA,EAC/C,sBAAsB;AAAA,EACtB,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,uBAAuB;AAAA,EACvB,mCAAmC;AACrC;",
|
|
6
6
|
"names": ["importMap"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.5.
|
|
2
|
+
"version": "4.5.3",
|
|
3
3
|
"name": "@softarc/native-federation-orchestrator",
|
|
4
4
|
"author": "Aukevanoost",
|
|
5
5
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">=24.16.0"
|
|
17
17
|
},
|
|
18
18
|
"sideEffects": false,
|
|
19
19
|
"dependencies": {
|