@module-federation/data-prefetch
Advanced tools
Comparing version 0.0.0-next-20241015065721 to 0.0.0-next-20241016062654
# @module-federation/data-prefetch | ||
## 0.0.0-next-20241015065721 | ||
## 0.0.0-next-20241016062654 | ||
### Patch Changes | ||
- Updated dependencies [ea6d417] | ||
- Updated dependencies [d5a3072] | ||
- @module-federation/runtime@0.0.0-next-20241016062654 | ||
- @module-federation/sdk@0.0.0-next-20241016062654 | ||
## 0.6.10 | ||
### Patch Changes | ||
- 22a3b83: fix(data-prefetch): apply DataPrefetchPlugin on demand | ||
- 22a3b83: fix(data-prefetch): set sharedStrategy in build options instead of using runtime plugin | ||
- Updated dependencies [b704f30] | ||
- Updated dependencies [22a3b83] | ||
- @module-federation/runtime@0.6.10 | ||
- @module-federation/sdk@0.6.10 | ||
## 0.6.9 | ||
### Patch Changes | ||
- @module-federation/runtime@0.6.9 | ||
- @module-federation/sdk@0.6.9 | ||
## 0.6.8 | ||
### Patch Changes | ||
- Updated dependencies [32db0ac] | ||
- Updated dependencies [32db0ac] | ||
- Updated dependencies [6c5f444] | ||
- Updated dependencies [fac6ecf] | ||
- @module-federation/sdk@0.6.8 | ||
- @module-federation/runtime@0.6.8 | ||
## 0.6.7 | ||
### Patch Changes | ||
- 9e32644: Refactored the way prefetch entries are imported for improved dynamic loading handling. | ||
@@ -17,5 +55,4 @@ | ||
- Updated dependencies [9e32644] | ||
- Updated dependencies [3082116] | ||
- @module-federation/runtime@0.0.0-next-20241015065721 | ||
- @module-federation/sdk@0.0.0-next-20241015065721 | ||
- @module-federation/runtime@0.6.7 | ||
- @module-federation/sdk@0.6.7 | ||
@@ -22,0 +59,0 @@ ## 0.6.6 |
{ | ||
"name": "@module-federation/data-prefetch", | ||
"description": "Module Federation Data Prefetch", | ||
"version": "0.0.0-next-20241015065721", | ||
"version": "0.0.0-next-20241016062654", | ||
"author": "nieyan <nyqykk@foxmail.com>", | ||
@@ -13,30 +13,25 @@ "homepage": "https://github.com/module-federation/core", | ||
".": { | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
"import": "./dist/index.esm.js", | ||
"require": "./dist/index.cjs", | ||
"types": "./dist/index.cjs.d.ts" | ||
}, | ||
"./react": { | ||
"import": "./dist/esm/react/index.js", | ||
"require": "./dist/react/index.js", | ||
"types": "./dist/react/index.d.ts" | ||
"import": "./dist/react.esm.js", | ||
"require": "./dist/react.cjs.js", | ||
"types": "./dist/react.cjs.d.ts" | ||
}, | ||
"./cli": { | ||
"import": "./dist/esm/cli/index.js", | ||
"require": "./dist/cli/index.js", | ||
"types": "./dist/cli/index.d.ts" | ||
"import": "./dist/cli.esm.js", | ||
"require": "./dist/cli.cjs.js", | ||
"types": "./dist/cli.cjs.d.ts" | ||
}, | ||
"./babel-plugin": { | ||
"import": "./dist/esm/cli/babel.js", | ||
"require": "./dist/cli/babel.js", | ||
"types": "./dist/cli/babel.d.ts" | ||
"import": "./dist/babel.esm.js", | ||
"require": "./dist/babel.cjs.js", | ||
"types": "./dist/babel.cjs.d.ts" | ||
}, | ||
"./universal": { | ||
"import": "./dist/esm/universal/index.js", | ||
"require": "./dist/universal/index.js", | ||
"types": "./dist/universal/index.d.ts" | ||
}, | ||
"./shared": { | ||
"import": "./dist/esm/shared/index.js", | ||
"require": "./dist/shared/index.js", | ||
"types": "./dist/shared/index.d.ts" | ||
"import": "./dist/universal.esm.js", | ||
"require": "./dist/universal.cjs.js", | ||
"types": "./dist/universal.cjs.d.ts" | ||
} | ||
@@ -47,20 +42,20 @@ }, | ||
".": [ | ||
"./dist/index.d.ts" | ||
"./dist/index.cjs.d.ts" | ||
], | ||
"react": [ | ||
"./dist/react/index.d.ts" | ||
"./dist/react.cjs.d.ts" | ||
], | ||
"cli": [ | ||
"./dist/cli/index.d.ts" | ||
"./dist/cli.cjs.d.ts" | ||
], | ||
"universal": [ | ||
"./dist/universal/index.d.ts" | ||
"./dist/universal.cjs.d.ts" | ||
], | ||
"shared": [ | ||
"./dist/shared/index.d.ts" | ||
"babel-plugin": [ | ||
"./dist/babel.cjs.d.ts" | ||
] | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/esm/index.js", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.esm.js", | ||
"peerDependencies": { | ||
@@ -76,12 +71,10 @@ "react": ">=16.9.0", | ||
"@types/react": "~18.0.38", | ||
"esbuild-plugin-replace": "^1.4.0", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"minimist": "^1.2.8", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"react-router": "^6.21.3", | ||
"react-test-renderer": "^18.2.0", | ||
"ts-jest": "29.0.1", | ||
"tsup": "6.2.0", | ||
"webpack": "5.75.0" | ||
@@ -91,10 +84,8 @@ }, | ||
"fs-extra": "9.1.0", | ||
"@module-federation/sdk": "0.0.0-next-20241015065721", | ||
"@module-federation/runtime": "0.0.0-next-20241015065721" | ||
"@module-federation/runtime": "0.0.0-next-20241016062654", | ||
"@module-federation/sdk": "0.0.0-next-20241016062654" | ||
}, | ||
"scripts": { | ||
"dev": "cross-env WATCH=true tsup", | ||
"build": "rm -rf dist && tsup", | ||
"test": "jest" | ||
} | ||
} |
{ | ||
"name": "module-federation/data-prefetch", | ||
"name": "data-prefetch", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/data-prefetch/src", | ||
"projectType": "library", | ||
"tags": ["type:pkg"], | ||
"targets": { | ||
"build": { | ||
"executor": "nx:run-commands", | ||
"executor": "@nx/rollup:rollup", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"commands": ["npm run build --prefix packages/data-prefetch"] | ||
"outputPath": "packages/data-prefetch/dist", | ||
"main": "packages/data-prefetch/src/index.ts", | ||
"tsConfig": "packages/data-prefetch/tsconfig.lib.json", | ||
"assets": [], | ||
"project": "packages/data-prefetch/package.json", | ||
"rollupConfig": "packages/data-prefetch/rollup.config.js", | ||
"compiler": "swc", | ||
"format": ["cjs", "esm"] | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nx/jest:jest", | ||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], | ||
"options": { | ||
"jestConfig": "packages/data-prefetch/jest.config.js", | ||
"passWithNoTests": true | ||
}, | ||
"configurations": { | ||
"ci": { | ||
"ci": true, | ||
"codeCoverage": true | ||
} | ||
} | ||
}, | ||
"lint": { | ||
"executor": "@nx/eslint:lint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": [ | ||
"packages/data-prefetch/**/*.ts", | ||
"packages/data-prefetch/package.json" | ||
] | ||
} | ||
}, | ||
"pre-release": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"commands": ["npm run test --prefix packages/data-prefetch"] | ||
"parallel": false, | ||
"commands": [ | ||
{ | ||
"command": "nx run data-prefetch:test", | ||
"forwardAllArgs": false | ||
}, | ||
{ | ||
"command": "nx run data-prefetch:build", | ||
"forwardAllArgs": false | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"tags": ["type:pkg"] | ||
} | ||
} |
@@ -15,2 +15,3 @@ import path from 'path'; | ||
import { getPrefetchId } from '../common/runtime-utils'; | ||
import { SHARED_STRATEGY } from '../constant'; | ||
@@ -51,9 +52,11 @@ const { RuntimeGlobals, Template } = require( | ||
const runtimePath = path.resolve(__dirname, '../esm/plugin.js'); | ||
const sharedPath = path.resolve(__dirname, '../esm/shared/index.js'); | ||
const runtimePath = path.resolve(__dirname, './plugin.esm.js'); | ||
if (!this.options.runtimePlugins?.includes(runtimePath)) { | ||
this.options.runtimePlugins!.push(runtimePath); | ||
} | ||
if (!this.options.runtimePlugins?.includes(sharedPath)) { | ||
this.options.runtimePlugins!.push(sharedPath); | ||
if (this.options.shareStrategy !== SHARED_STRATEGY) { | ||
this.options.shareStrategy = SHARED_STRATEGY; | ||
console.warn( | ||
`[Module Federation Data Prefetch]: Your shared strategy is set to '${SHARED_STRATEGY}', this is a necessary condition for data prefetch`, | ||
); | ||
} | ||
@@ -60,0 +63,0 @@ |
@@ -7,2 +7,3 @@ import type { FederationRuntimePlugin } from '@module-federation/runtime/types'; | ||
import logger from './logger'; | ||
import { SHARED_STRATEGY } from './constant'; | ||
@@ -19,4 +20,3 @@ interface Loading { | ||
const loadingArray: Array<Loading> = []; | ||
const strategy = 'loaded-first'; | ||
let sharedFlag = strategy; | ||
let sharedFlag = SHARED_STRATEGY; | ||
// eslint-disable-next-line max-lines-per-function | ||
@@ -40,3 +40,3 @@ export const prefetchPlugin = (): FederationRuntimePlugin => ({ | ||
} | ||
if (sharedFlag !== strategy) { | ||
if (sharedFlag !== SHARED_STRATEGY) { | ||
throw new Error( | ||
@@ -115,3 +115,3 @@ `[Module Federation Data Prefetch]: If you want to use data prefetch, the shared strategy must be 'loaded-first'`, | ||
if (sharedFlag !== strategy) { | ||
if (sharedFlag !== SHARED_STRATEGY) { | ||
throw new Error( | ||
@@ -118,0 +118,0 @@ `[Module Federation Data Prefetch]: If you want to use data prefetch, the shared strategy must be 'loaded-first'`, |
@@ -25,4 +25,4 @@ { | ||
}, | ||
"include": ["src", "../../global.d.ts", "__tests__/**/*", "tsup.config.ts"], | ||
"include": ["src", "../../global.d.ts", "__tests__/**/*"], | ||
"exclude": ["node_modules/**/*", "../node_modules"] | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
14
79
5
107774
2643
1
+ Added@module-federation/runtime@0.0.0-next-20241016062654(transitive)
+ Added@module-federation/sdk@0.0.0-next-20241016062654(transitive)
- Removed@module-federation/runtime@0.0.0-next-20241015065721(transitive)
- Removed@module-federation/sdk@0.0.0-next-20241015065721(transitive)