@module-federation/data-prefetch
Advanced tools
Comparing version 0.0.0-next-20240923073245 to 0.0.0-next-20240924012324
# @module-federation/data-prefetch | ||
## 0.0.0-next-20240923073245 | ||
## 0.0.0-next-20240924012324 | ||
### Patch Changes | ||
- Updated dependencies [3082116] | ||
- @module-federation/runtime@0.0.0-next-20240923073245 | ||
- @module-federation/sdk@0.0.0-next-20240923073245 | ||
- f10cf55: Refactored the way prefetch entries are imported for improved dynamic loading handling. | ||
- 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-20240924012324 | ||
- @module-federation/sdk@0.0.0-next-20240924012324 | ||
## 0.6.6 | ||
@@ -12,0 +21,0 @@ |
@@ -170,10 +170,12 @@ "use strict"; | ||
"function injectPrefetch() {", | ||
`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}');`, | ||
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}');}` | ||
]), | ||
"}", | ||
@@ -180,0 +182,0 @@ `${federationGlobal}.prefetch = injectPrefetch` |
@@ -144,10 +144,12 @@ import { | ||
"function injectPrefetch() {", | ||
`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}');`, | ||
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}');}` | ||
]), | ||
"}", | ||
@@ -154,0 +156,0 @@ `${federationGlobal}.prefetch = injectPrefetch` |
import { | ||
prefetchPlugin | ||
} from "./chunk-VVZ6XIM6.js"; | ||
} from "./chunk-EK6Q2YBB.js"; | ||
import "./chunk-TTJJJ2WZ.js"; | ||
import { | ||
MFDataPrefetch | ||
} from "./chunk-ISLXMAIA.js"; | ||
} from "./chunk-L7EVPWJ4.js"; | ||
import "./chunk-AJPO2B2T.js"; | ||
@@ -9,0 +9,0 @@ import "./chunk-EZUCZHGV.js"; |
import { | ||
plugin_default, | ||
prefetchPlugin | ||
} from "./chunk-VVZ6XIM6.js"; | ||
} from "./chunk-EK6Q2YBB.js"; | ||
import "./chunk-TTJJJ2WZ.js"; | ||
import "./chunk-ISLXMAIA.js"; | ||
import "./chunk-L7EVPWJ4.js"; | ||
import "./chunk-AJPO2B2T.js"; | ||
@@ -8,0 +8,0 @@ import "./chunk-EZUCZHGV.js"; |
import { | ||
prefetch | ||
} from "../chunk-KI4QGPIS.js"; | ||
} from "../chunk-FKXFJ2Y4.js"; | ||
import { | ||
@@ -9,3 +9,3 @@ logger_default | ||
MFDataPrefetch | ||
} from "../chunk-ISLXMAIA.js"; | ||
} from "../chunk-L7EVPWJ4.js"; | ||
import { | ||
@@ -12,0 +12,0 @@ getScope |
import { | ||
prefetch | ||
} from "../chunk-KI4QGPIS.js"; | ||
import "../chunk-ISLXMAIA.js"; | ||
} from "../chunk-FKXFJ2Y4.js"; | ||
import "../chunk-L7EVPWJ4.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-4e9646e4.js'; | ||
export { D as DataPrefetchOptions, M as MFDataPrefetch, p as prefetchOptions } from './prefetch-c08be471.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; | ||
var _a2, _b; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -98,3 +98,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const resolve = exportsPromise.then( | ||
@@ -101,0 +101,0 @@ (exports = {}) => { |
@@ -91,3 +91,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2; | ||
var _a2, _b; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -97,3 +97,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const resolve = exportsPromise.then( | ||
@@ -100,0 +100,0 @@ (exports = {}) => { |
@@ -1,2 +0,2 @@ | ||
import { p as prefetchOptions } from '../prefetch-4e9646e4.js'; | ||
import { p as prefetchOptions } from '../prefetch-c08be471.js'; | ||
import '@module-federation/runtime'; | ||
@@ -3,0 +3,0 @@ import '@module-federation/sdk'; |
@@ -89,3 +89,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2; | ||
var _a2, _b; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -95,3 +95,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
const resolve = exportsPromise.then( | ||
@@ -98,0 +98,0 @@ (exports = {}) => { |
@@ -1,2 +0,2 @@ | ||
import { p as prefetchOptions } from '../prefetch-4e9646e4.js'; | ||
import { p as prefetchOptions } from '../prefetch-c08be471.js'; | ||
import '@module-federation/runtime'; | ||
@@ -3,0 +3,0 @@ import '@module-federation/sdk'; |
@@ -82,3 +82,3 @@ "use strict"; | ||
getProjectExports() { | ||
var _a2; | ||
var _a2, _b; | ||
if (Object.keys(this._exports).length > 0) { | ||
@@ -88,3 +88,3 @@ return this._exports; | ||
const { name } = this._options; | ||
const exportsPromise = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]; | ||
const exportsPromise = (_b = (_a2 = globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__) == null ? void 0 : _a2[name]) == null ? void 0 : _b.call(_a2); | ||
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-20240923073245", | ||
"version": "0.0.0-next-20240924012324", | ||
"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-20240923073245", | ||
"@module-federation/runtime": "0.0.0-next-20240923073245" | ||
"@module-federation/sdk": "0.0.0-next-20240924012324", | ||
"@module-federation/runtime": "0.0.0-next-20240924012324" | ||
}, | ||
@@ -92,0 +92,0 @@ "scripts": { |
@@ -138,10 +138,12 @@ import path from 'path'; | ||
'function injectPrefetch() {', | ||
`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}');`, | ||
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}');}`, | ||
]), | ||
'}', | ||
@@ -148,0 +150,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>> = {}) => { |
123905
3582
+ Added@module-federation/runtime@0.0.0-next-20240924012324(transitive)
+ Added@module-federation/sdk@0.0.0-next-20240924012324(transitive)
- Removed@module-federation/runtime@0.0.0-next-20240923073245(transitive)
- Removed@module-federation/sdk@0.0.0-next-20240923073245(transitive)