@module-federation/data-prefetch
Advanced tools
Comparing version 0.0.0-next-20240924022552 to 0.0.0-next-20240924091419
# @module-federation/data-prefetch | ||
## 0.0.0-next-20240924022552 | ||
## 0.0.0-next-20240924091419 | ||
### Patch Changes | ||
- f10cf55: Refactored the way prefetch entries are imported for improved dynamic loading handling. | ||
- Updated dependencies [3082116] | ||
- @module-federation/runtime@0.0.0-next-20240924091419 | ||
- @module-federation/sdk@0.0.0-next-20240924091419 | ||
- Changed the import of prefetch entries to use a function wrapper for more dynamic control. | ||
- Updated data types to ensure consistency with the new function-based import approach. | ||
- Modified the `injectPrefetch` function structure to incorporate the new import method. | ||
- Modified the `MFDataPrefetch` class to handle the new import function when resolving exports. | ||
- Updated dependencies [3837c89] | ||
- Updated dependencies [3837c89] | ||
- Updated dependencies [59e0069] | ||
- @module-federation/runtime@0.0.0-next-20240924022552 | ||
- @module-federation/sdk@0.0.0-next-20240924022552 | ||
## 0.6.6 | ||
@@ -21,0 +12,0 @@ |
@@ -170,12 +170,10 @@ "use strict"; | ||
"function injectPrefetch() {", | ||
Template.indent([ | ||
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`, | ||
`globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}'] || {`, | ||
`entryLoading: {},`, | ||
`instance: new Map(),`, | ||
`__PREFETCH_EXPORTS__: {},`, | ||
`};`, | ||
`globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}']['${import_sdk2.MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}']['${import_sdk2.MFPrefetchCommon.exportsKey}'] || {};`, | ||
`globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}']['${import_sdk2.MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}` | ||
]), | ||
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`, | ||
`globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}'] || {`, | ||
`entryLoading: {},`, | ||
`instance: new Map(),`, | ||
`__PREFETCH_EXPORTS__: {},`, | ||
`};`, | ||
`globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}']['${import_sdk2.MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}']['${import_sdk2.MFPrefetchCommon.exportsKey}'] || {};`, | ||
`globalThis.__FEDERATION__['${import_sdk2.MFPrefetchCommon.globalKey}']['${import_sdk2.MFPrefetchCommon.exportsKey}']['${options.name}'] = import('${prefetchEntry}');`, | ||
"}", | ||
@@ -182,0 +180,0 @@ `${federationGlobal}.prefetch = injectPrefetch` |
@@ -144,12 +144,10 @@ import { | ||
"function injectPrefetch() {", | ||
Template.indent([ | ||
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`, | ||
`entryLoading: {},`, | ||
`instance: new Map(),`, | ||
`__PREFETCH_EXPORTS__: {},`, | ||
`};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}` | ||
]), | ||
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`, | ||
`entryLoading: {},`, | ||
`instance: new Map(),`, | ||
`__PREFETCH_EXPORTS__: {},`, | ||
`};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = import('${prefetchEntry}');`, | ||
"}", | ||
@@ -156,0 +154,0 @@ `${federationGlobal}.prefetch = injectPrefetch` |
import { | ||
prefetchPlugin | ||
} from "./chunk-EK6Q2YBB.js"; | ||
} from "./chunk-VVZ6XIM6.js"; | ||
import "./chunk-TTJJJ2WZ.js"; | ||
import { | ||
MFDataPrefetch | ||
} from "./chunk-L7EVPWJ4.js"; | ||
} from "./chunk-ISLXMAIA.js"; | ||
import "./chunk-AJPO2B2T.js"; | ||
@@ -9,0 +9,0 @@ import "./chunk-EZUCZHGV.js"; |
import { | ||
plugin_default, | ||
prefetchPlugin | ||
} from "./chunk-EK6Q2YBB.js"; | ||
} from "./chunk-VVZ6XIM6.js"; | ||
import "./chunk-TTJJJ2WZ.js"; | ||
import "./chunk-L7EVPWJ4.js"; | ||
import "./chunk-ISLXMAIA.js"; | ||
import "./chunk-AJPO2B2T.js"; | ||
@@ -8,0 +8,0 @@ import "./chunk-EZUCZHGV.js"; |
import { | ||
prefetch | ||
} from "../chunk-FKXFJ2Y4.js"; | ||
} from "../chunk-KI4QGPIS.js"; | ||
import { | ||
@@ -9,3 +9,3 @@ logger_default | ||
MFDataPrefetch | ||
} from "../chunk-L7EVPWJ4.js"; | ||
} from "../chunk-ISLXMAIA.js"; | ||
import { | ||
@@ -12,0 +12,0 @@ getScope |
import { | ||
prefetch | ||
} from "../chunk-FKXFJ2Y4.js"; | ||
import "../chunk-L7EVPWJ4.js"; | ||
} from "../chunk-KI4QGPIS.js"; | ||
import "../chunk-ISLXMAIA.js"; | ||
import "../chunk-AJPO2B2T.js"; | ||
@@ -6,0 +6,0 @@ import "../chunk-EZUCZHGV.js"; |
@@ -1,2 +0,2 @@ | ||
export { D as DataPrefetchOptions, M as MFDataPrefetch, p as prefetchOptions } from './prefetch-c08be471.js'; | ||
export { D as DataPrefetchOptions, M as MFDataPrefetch, p as prefetchOptions } from './prefetch-4e9646e4.js'; | ||
export { default as prefetchPlugin } from './plugin.js'; | ||
@@ -3,0 +3,0 @@ import '@module-federation/runtime'; |
@@ -92,3 +92,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2, _b; | ||
var _a2; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -98,3 +98,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const resolve = exportsPromise.then( | ||
@@ -101,0 +101,0 @@ (exports = {}) => { |
@@ -91,3 +91,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2, _b; | ||
var _a2; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -97,3 +97,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const resolve = exportsPromise.then( | ||
@@ -100,0 +100,0 @@ (exports = {}) => { |
@@ -1,2 +0,2 @@ | ||
import { p as prefetchOptions } from '../prefetch-c08be471.js'; | ||
import { p as prefetchOptions } from '../prefetch-4e9646e4.js'; | ||
import '@module-federation/runtime'; | ||
@@ -3,0 +3,0 @@ import '@module-federation/sdk'; |
@@ -89,3 +89,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2, _b; | ||
var _a2; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -95,3 +95,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const resolve = exportsPromise.then( | ||
@@ -98,0 +98,0 @@ (exports = {}) => { |
@@ -1,2 +0,2 @@ | ||
import { p as prefetchOptions } from '../prefetch-c08be471.js'; | ||
import { p as prefetchOptions } from '../prefetch-4e9646e4.js'; | ||
import '@module-federation/runtime'; | ||
@@ -3,0 +3,0 @@ import '@module-federation/sdk'; |
@@ -82,3 +82,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2, _b; | ||
var _a2; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -88,3 +88,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const resolve = exportsPromise.then( | ||
@@ -91,0 +91,0 @@ (exports = {}) => { |
@@ -27,4 +27,4 @@ // For a detailed explanation regarding each configuration property, visit: | ||
rootDir: __dirname, | ||
testMatch: ['<rootDir>/__tests__/**/*.spec.[jt]s?(x)'], | ||
testMatch: ['<rootDir>__tests__/**/**.spec.[jt]s?(x)'], | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
}; |
{ | ||
"name": "@module-federation/data-prefetch", | ||
"description": "Module Federation Data Prefetch", | ||
"version": "0.0.0-next-20240924022552", | ||
"version": "0.0.0-next-20240924091419", | ||
"author": "nieyan <nyqykk@foxmail.com>", | ||
@@ -88,4 +88,4 @@ "homepage": "https://github.com/module-federation/core", | ||
"fs-extra": "9.1.0", | ||
"@module-federation/sdk": "0.0.0-next-20240924022552", | ||
"@module-federation/runtime": "0.0.0-next-20240924022552" | ||
"@module-federation/sdk": "0.0.0-next-20240924091419", | ||
"@module-federation/runtime": "0.0.0-next-20240924091419" | ||
}, | ||
@@ -92,0 +92,0 @@ "scripts": { |
@@ -138,12 +138,10 @@ import path from 'path'; | ||
'function injectPrefetch() {', | ||
Template.indent([ | ||
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`, | ||
`entryLoading: {},`, | ||
`instance: new Map(),`, | ||
`__PREFETCH_EXPORTS__: {},`, | ||
`};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`, | ||
]), | ||
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`, | ||
`entryLoading: {},`, | ||
`instance: new Map(),`, | ||
`__PREFETCH_EXPORTS__: {},`, | ||
`};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`, | ||
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = import('${prefetchEntry}');`, | ||
'}', | ||
@@ -150,0 +148,0 @@ `${federationGlobal}.prefetch = injectPrefetch`, |
@@ -20,3 +20,3 @@ import { | ||
instance: Map<string, MFDataPrefetch>; | ||
__PREFETCH_EXPORTS__: Record<string, () => Promise<Record<string, any>>>; | ||
__PREFETCH_EXPORTS__: Record<string, Promise<Record<string, any>>>; | ||
}; | ||
@@ -99,3 +99,3 @@ } | ||
const exportsPromise = | ||
globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__?.[name]?.(); | ||
globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__?.[name]; | ||
const resolve = exportsPromise.then( | ||
@@ -102,0 +102,0 @@ (exports: Record<string, Record<string, any>> = {}) => { |
241
29
74
241
122905
3576
+ Added@module-federation/runtime@0.0.0-next-20240924091419(transitive)
+ Added@module-federation/sdk@0.0.0-next-20240924091419(transitive)
- Removed@module-federation/runtime@0.0.0-next-20240924022552(transitive)
- Removed@module-federation/sdk@0.0.0-next-20240924022552(transitive)