New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/data-prefetch

Package Overview
Dependencies
Maintainers
0
Versions
248
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-20241230030326 to 0.0.0-next-20241230034757

7

CHANGELOG.md
# @module-federation/data-prefetch
## 0.0.0-next-20241230030326
## 0.0.0-next-20241230034757

@@ -8,6 +8,5 @@ ### Patch Changes

- Updated dependencies [835b09c]
- Updated dependencies [f0b1d4c]
- Updated dependencies [4fd33fb]
- @module-federation/sdk@0.0.0-next-20241230030326
- @module-federation/runtime@0.0.0-next-20241230030326
- @module-federation/sdk@0.0.0-next-20241230034757
- @module-federation/runtime@0.0.0-next-20241230034757

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

import { FederationHost } from '@module-federation/runtime';
import { ModuleInfo } from '@module-federation/sdk';
import { Remote } from '@module-federation/runtime/types';
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>>>;
};
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>>>;
};
}
}

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

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

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

{
"name": "@module-federation/data-prefetch",
"description": "Module Federation Data Prefetch",
"version": "0.0.0-next-20241230030326",
"version": "0.0.0-next-20241230034757",
"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-20241230030326",
"@module-federation/sdk": "0.0.0-next-20241230030326"
"@module-federation/runtime": "0.0.0-next-20241230034757",
"@module-federation/sdk": "0.0.0-next-20241230034757"
},

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

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

import { Remote } from '@module-federation/runtime/types';
import type { Federation } from '@module-federation/runtime';
import { getPrefetchId, compatGetPrefetchId } from './common/runtime-utils';
// 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>>>;
};
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>>>;
};
}
}

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

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

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

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

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

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

@@ -109,0 +104,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