Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/data-prefetch

Package Overview
Dependencies
Maintainers
0
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/data-prefetch - npm Package Compare versions

Comparing version 0.0.0-next-20241230094715 to 0.0.0-next-20241231075249

14

CHANGELOG.md
# @module-federation/data-prefetch
## 0.0.0-next-20241230094715
## 0.0.0-next-20241231075249
### Patch Changes
- @module-federation/runtime@0.0.0-next-20241231075249
- @module-federation/sdk@0.0.0-next-20241231075249
## 0.8.7
### Patch Changes
- Updated dependencies [835b09c]
- Updated dependencies [f573ad0]
- Updated dependencies [336f3d8]
- Updated dependencies [4fd33fb]
- @module-federation/sdk@0.0.0-next-20241230094715
- @module-federation/runtime@0.0.0-next-20241230094715
- @module-federation/sdk@0.8.7
- @module-federation/runtime@0.8.7

@@ -13,0 +21,0 @@ ## 0.8.6

import { FederationHost } from '@module-federation/runtime';
import { ModuleInfo } from '@module-federation/sdk';
import { Remote } from '@module-federation/runtime/types';
declare module '@module-federation/runtime' {
interface Federation {
__PREFETCH__: {
entryLoading: Record<string, undefined | Promise<void>>;
instance: Map<string, MFDataPrefetch>;
__PREFETCH_EXPORTS__: Record<string, () => Promise<Record<string, any>>>;
};
}
import type { Federation } from '@module-federation/runtime';
interface FederationWithPrefetch extends Federation {
__PREFETCH__: {
entryLoading: Record<string, undefined | Promise<void>>;
instance: Map<string, MFDataPrefetch>;
__PREFETCH_EXPORTS__: Record<string, () => Promise<Record<string, any>>>;
};
}

@@ -32,3 +31,3 @@ type PrefetchExports = Record<string, any>;

constructor(options: DataPrefetchOptions);
get global(): Record<string, any>;
get global(): FederationWithPrefetch['__PREFETCH__'];
static getInstance(id: string): MFDataPrefetch | undefined;

@@ -35,0 +34,0 @@ loadEntry(entry: string | undefined): Promise<any>;

{
"name": "@module-federation/data-prefetch",
"description": "Module Federation Data Prefetch",
"version": "0.0.0-next-20241230094715",
"version": "0.0.0-next-20241231075249",
"author": "nieyan <nyqykk@foxmail.com>",

@@ -86,4 +86,4 @@ "homepage": "https://github.com/module-federation/core",

"fs-extra": "9.1.0",
"@module-federation/runtime": "0.0.0-next-20241230094715",
"@module-federation/sdk": "0.0.0-next-20241230094715"
"@module-federation/runtime": "0.0.0-next-20241231075249",
"@module-federation/sdk": "0.0.0-next-20241231075249"
},

@@ -90,0 +90,0 @@ "scripts": {

@@ -12,13 +12,12 @@ import {

import { Remote } from '@module-federation/runtime/types';
import type { Federation } from '@module-federation/runtime';
import { getPrefetchId, compatGetPrefetchId } from './common/runtime-utils';
declare module '@module-federation/runtime' {
export interface Federation {
__PREFETCH__: {
entryLoading: Record<string, undefined | Promise<void>>;
instance: Map<string, MFDataPrefetch>;
__PREFETCH_EXPORTS__: Record<string, () => Promise<Record<string, any>>>;
};
}
// Define an interface that extends Federation to include __PREFETCH__
interface FederationWithPrefetch extends Federation {
__PREFETCH__: {
entryLoading: Record<string, undefined | Promise<void>>;
instance: Map<string, MFDataPrefetch>;
__PREFETCH_EXPORTS__: Record<string, () => Promise<Record<string, any>>>;
};
}

@@ -44,7 +43,9 @@

globalThis.__FEDERATION__ ??= {};
globalThis.__FEDERATION__.__PREFETCH__ ??= {
(
globalThis.__FEDERATION__ as unknown as FederationWithPrefetch
).__PREFETCH__ ??= {
entryLoading: {},
instance: new Map(),
__PREFETCH_EXPORTS__: {},
};
} as FederationWithPrefetch['__PREFETCH__'];
export class MFDataPrefetch {

@@ -64,8 +65,11 @@ public prefetchMemory: Map<string, Promise<any>>;

get global(): Record<string, any> {
return globalThis.__FEDERATION__.__PREFETCH__;
get global(): FederationWithPrefetch['__PREFETCH__'] {
return (globalThis.__FEDERATION__ as unknown as FederationWithPrefetch)
.__PREFETCH__;
}
static getInstance(id: string): MFDataPrefetch | undefined {
return globalThis.__FEDERATION__.__PREFETCH__.instance.get(id);
return (
globalThis.__FEDERATION__ as unknown as FederationWithPrefetch
).__PREFETCH__.instance.get(id);
}

@@ -100,4 +104,5 @@

const { name } = this._options;
const exportsPromiseFn =
globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__?.[name];
const exportsPromiseFn = (
globalThis.__FEDERATION__ as unknown as FederationWithPrefetch
).__PREFETCH__.__PREFETCH_EXPORTS__?.[name];
const exportsPromise =

@@ -104,0 +109,0 @@ typeof exportsPromiseFn === 'function'

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc