@module-federation/bridge-react-webpack-plugin 0.0.0-fix-lazy-comile-20250925082726
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +577 -0
- package/LICENSE +21 -0
- package/README.md +131 -0
- package/__tests__/mockRouterDir/router-v5/react-router-dom/package.json +71 -0
- package/__tests__/mockRouterDir/router-v6/react-router-dom/package.json +49 -0
- package/__tests__/utils.spec.ts +71 -0
- package/dist/index.cjs.d.ts +14 -0
- package/dist/index.cjs.js +1772 -0
- package/dist/index.es.js +1752 -0
- package/package.json +40 -0
- package/project.json +29 -0
- package/src/index.ts +62 -0
- package/src/utis.ts +128 -0
- package/tsconfig.json +42 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +24 -0
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-router-dom",
|
|
3
|
+
"version": "5.3.4",
|
|
4
|
+
"description": "DOM bindings for React Router",
|
|
5
|
+
"homepage": "https://reactrouter.com/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/remix-run/react-router.git",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"directory": "packages/react-router-dom"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Remix Software <hello@remix.run>",
|
|
13
|
+
"files": [
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md",
|
|
16
|
+
"BrowserRouter.js",
|
|
17
|
+
"HashRouter.js",
|
|
18
|
+
"Link.js",
|
|
19
|
+
"MemoryRouter.js",
|
|
20
|
+
"NavLink.js",
|
|
21
|
+
"Prompt.js",
|
|
22
|
+
"Redirect.js",
|
|
23
|
+
"Route.js",
|
|
24
|
+
"Router.js",
|
|
25
|
+
"StaticRouter.js",
|
|
26
|
+
"Switch.js",
|
|
27
|
+
"cjs",
|
|
28
|
+
"es",
|
|
29
|
+
"esm",
|
|
30
|
+
"index.js",
|
|
31
|
+
"generatePath.js",
|
|
32
|
+
"matchPath.js",
|
|
33
|
+
"modules/*.js",
|
|
34
|
+
"modules/utils/*.js",
|
|
35
|
+
"withRouter.js",
|
|
36
|
+
"warnAboutDeprecatedCJSRequire.js",
|
|
37
|
+
"umd"
|
|
38
|
+
],
|
|
39
|
+
"main": "index.js",
|
|
40
|
+
"module": "esm/react-router-dom.js",
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "rollup -c",
|
|
44
|
+
"lint": "eslint modules"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"react": ">=15"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@babel/runtime": "^7.12.13",
|
|
51
|
+
"history": "^4.9.0",
|
|
52
|
+
"loose-envify": "^1.3.1",
|
|
53
|
+
"prop-types": "^15.6.2",
|
|
54
|
+
"react-router": "5.3.4",
|
|
55
|
+
"tiny-invariant": "^1.0.2",
|
|
56
|
+
"tiny-warning": "^1.0.0"
|
|
57
|
+
},
|
|
58
|
+
"browserify": {
|
|
59
|
+
"transform": [
|
|
60
|
+
"loose-envify"
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"keywords": [
|
|
64
|
+
"react",
|
|
65
|
+
"router",
|
|
66
|
+
"route",
|
|
67
|
+
"routing",
|
|
68
|
+
"history",
|
|
69
|
+
"link"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-router-dom",
|
|
3
|
+
"version": "6.22.3",
|
|
4
|
+
"description": "Declarative routing for React web applications",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"router",
|
|
8
|
+
"route",
|
|
9
|
+
"routing",
|
|
10
|
+
"history",
|
|
11
|
+
"link"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/remix-run/react-router",
|
|
16
|
+
"directory": "packages/react-router-dom"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "Remix Software <hello@remix.run>",
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"main": "./dist/main.js",
|
|
22
|
+
"unpkg": "./dist/umd/react-router-dom.production.min.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@remix-run/router": "1.15.3",
|
|
27
|
+
"react-router": "6.22.3"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"react": "^18.3.1",
|
|
31
|
+
"react-dom": "^18.3.1"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": ">=16.8",
|
|
35
|
+
"react-dom": ">=16.8"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/",
|
|
39
|
+
"CHANGELOG.md",
|
|
40
|
+
"LICENSE.md",
|
|
41
|
+
"README.md",
|
|
42
|
+
"server.d.ts",
|
|
43
|
+
"server.js",
|
|
44
|
+
"server.mjs"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=14.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {
|
|
3
|
+
checkVersion,
|
|
4
|
+
findPackageJson,
|
|
5
|
+
getBridgeRouterAlias,
|
|
6
|
+
} from '../src/utis';
|
|
7
|
+
|
|
8
|
+
const resolveRouterV5 = path.resolve(
|
|
9
|
+
__dirname,
|
|
10
|
+
'../__tests__/mockRouterDir/router-v5/react-router-dom',
|
|
11
|
+
);
|
|
12
|
+
const resolveRouterV5_PkgPath = path.resolve(
|
|
13
|
+
__dirname,
|
|
14
|
+
'../__tests__/mockRouterDir/router-v5/react-router-dom/package.json',
|
|
15
|
+
);
|
|
16
|
+
const resolveRouterV6 = path.resolve(
|
|
17
|
+
__dirname,
|
|
18
|
+
'../__tests__/mockRouterDir/router-v6/react-router-dom/dist/main.js',
|
|
19
|
+
);
|
|
20
|
+
const resolveRouterV6_PkgPath = path.resolve(
|
|
21
|
+
__dirname,
|
|
22
|
+
'../__tests__/mockRouterDir/router-v6/react-router-dom/package.json',
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
describe('test checkVersion: should return the correct major version for react-router-dom', () => {
|
|
26
|
+
it('should return 5', () => {
|
|
27
|
+
expect(checkVersion('5.0.0')).toBe(5);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should return 5', () => {
|
|
31
|
+
expect(checkVersion('^5.0.0')).toBe(5);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should return 6', () => {
|
|
35
|
+
expect(checkVersion('6.0.0')).toBe(6);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should return 6', () => {
|
|
39
|
+
expect(checkVersion('~6.0.0')).toBe(6);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should return 6', () => {
|
|
43
|
+
expect(checkVersion('^6.0.0')).toBe(6);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('test findPackageJson: should return the correct package.json path for react-router-dom v5 and v6', () => {
|
|
48
|
+
it('should return the package.json path', () => {
|
|
49
|
+
expect(findPackageJson(resolveRouterV5)).toBe(resolveRouterV5_PkgPath);
|
|
50
|
+
expect(findPackageJson(resolveRouterV6)).toBe(resolveRouterV6_PkgPath);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('test getBridgeRouterAlias: should return the correct alias for react-router-dom v5 and v6', () => {
|
|
55
|
+
it('should return the correct alias for router v5', () => {
|
|
56
|
+
const res = getBridgeRouterAlias(resolveRouterV5);
|
|
57
|
+
expect(res).toEqual({
|
|
58
|
+
'react-router-dom$':
|
|
59
|
+
'@module-federation/bridge-react/dist/router-v5.es.js',
|
|
60
|
+
'react-router-dom/index.js': resolveRouterV5,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should return the correct alias for router v6', () => {
|
|
65
|
+
const res = getBridgeRouterAlias(resolveRouterV6);
|
|
66
|
+
expect(res).toEqual({
|
|
67
|
+
'react-router-dom$':
|
|
68
|
+
'@module-federation/bridge-react/dist/router-v6.es.js',
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
|
+
|
|
3
|
+
declare class ReactBridgeAliasChangerPlugin {
|
|
4
|
+
alias: string;
|
|
5
|
+
targetFile: string;
|
|
6
|
+
moduleFederationOptions: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
7
|
+
constructor(info: {
|
|
8
|
+
moduleFederationOptions: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
9
|
+
});
|
|
10
|
+
apply(compiler: any): void;
|
|
11
|
+
}
|
|
12
|
+
export default ReactBridgeAliasChangerPlugin;
|
|
13
|
+
|
|
14
|
+
export { }
|