@module-federation/nextjs-mf 5.2.1 → 5.3.0

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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/lib/NextFederationPlugin.js +1 -481
  3. package/lib/NextFederationPlugin2.js +536 -0
  4. package/lib/_virtual/UrlNode.js +8 -0
  5. package/lib/_virtual/_commonjsHelpers.js +26 -0
  6. package/lib/_virtual/_tslib.js +101 -0
  7. package/lib/_virtual/helpers.js +7 -0
  8. package/lib/_virtual/nextPageMapLoader.js +7 -0
  9. package/lib/client/CombinedPages.d.ts +28 -0
  10. package/lib/client/CombinedPages.d.ts.map +1 -0
  11. package/lib/client/CombinedPages.js +60 -0
  12. package/lib/client/MFClient.d.ts +70 -0
  13. package/lib/client/MFClient.d.ts.map +1 -0
  14. package/lib/client/MFClient.js +197 -0
  15. package/lib/client/RemoteContainer.d.ts +58 -0
  16. package/lib/client/RemoteContainer.d.ts.map +1 -0
  17. package/lib/client/RemoteContainer.js +161 -0
  18. package/lib/client/RemotePages.d.ts +48 -0
  19. package/lib/client/RemotePages.d.ts.map +1 -0
  20. package/lib/client/RemotePages.js +168 -0
  21. package/lib/client/UrlNode.d.ts +18 -0
  22. package/lib/client/UrlNode.d.ts.map +1 -0
  23. package/lib/client/UrlNode.js +162 -0
  24. package/lib/client/helpers.d.ts +17 -0
  25. package/lib/client/helpers.d.ts.map +1 -0
  26. package/lib/client/helpers.js +108 -0
  27. package/lib/client/useMFClient.d.ts +25 -0
  28. package/lib/client/useMFClient.d.ts.map +1 -0
  29. package/lib/client/useMFClient.js +79 -0
  30. package/lib/client/useMFRemote.d.ts +17 -0
  31. package/lib/client/useMFRemote.d.ts.map +1 -0
  32. package/lib/client/useMFRemote.js +72 -0
  33. package/lib/loaders/UrlNode.js +215 -0
  34. package/lib/loaders/fixImageLoader.js +42 -8
  35. package/lib/loaders/helpers.js +21 -2
  36. package/lib/loaders/nextPageMapLoader.js +81 -17
  37. package/lib/loaders/patchNextClientPageLoader.js +53 -0
  38. package/lib/plugins/DevHmrFixInvalidPongPlugin.js +65 -0
  39. package/lib/utils.js +7 -3
  40. package/package.json +21 -4
  41. package/tsconfig.json +33 -0
package/package.json CHANGED
@@ -1,33 +1,50 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "@module-federation/nextjs-mf",
4
- "version": "5.2.1",
4
+ "version": "5.3.0",
5
5
  "description": "Module Federation helper for NextJS",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "repository": "https://github.com/module-federation/nextjs-mf",
9
9
  "author": "Zack Jackson <zackary.l.jackson@gmail.com>",
10
+ "contributors": [
11
+ "Pavel Chertorogov, nodkz <pavel.chertorogov@gmail.com> (www.ps.kz)"
12
+ ],
10
13
  "license": "MIT",
11
14
  "scripts": {
12
- "demo": "yarn build && cd demo && yarn install && yarn dev",
15
+ "demo": "sleep 3 && cd demo && yarn install && yarn dev",
16
+ "dev": "rm -rf lib && concurrently \"yarn sync-files --watch\" \"yarn compile --watch\" \"yarn demo\"",
13
17
  "prettier": "prettier --write \"**/*.{js,json,md,ts,tsx}\"",
14
- "build": "rm -rf lib && cp -r ./src/ lib/ && rollup -c",
18
+ "sync-files": "cpx \"src/**/*.js\" lib/",
19
+ "compile": "rollup -c",
20
+ "build": "rm -rf lib && yarn sync-files && yarn compile",
15
21
  "prepublishOnly": "yarn build"
16
22
  },
17
23
  "dependencies": {
18
24
  "chalk": "^4.0.0",
25
+ "eventemitter3": "^4.0.7",
19
26
  "fast-glob": "^3.2.11"
20
27
  },
21
28
  "devDependencies": {
22
29
  "@rollup/plugin-commonjs": "^22.0.2",
23
30
  "@rollup/plugin-multi-entry": "^4.1.0",
24
31
  "@rollup/plugin-node-resolve": "^13.3.0",
25
- "next": "11.0.1",
32
+ "@types/react": "^18.0.19",
33
+ "concurrently": "^7.3.0",
34
+ "cpx": "^1.5.0",
35
+ "next": "12.2.2",
26
36
  "prettier": "2.3.2",
37
+ "react": "^18.2.0",
27
38
  "rollup": "^2.78.1",
28
39
  "rollup-obfuscator": "^3.0.1",
29
40
  "rollup-plugin-node-builtins": "^2.1.2",
30
41
  "rollup-plugin-node-globals": "^1.4.0",
42
+ "rollup-plugin-typescript2": "^0.33.0",
43
+ "tslib": "^2.4.0",
44
+ "typescript": "^4.8.2",
31
45
  "webpack": "5.45.1"
46
+ },
47
+ "peerDependencies": {
48
+ "react": "^17.0.0 || ^18.0.0"
32
49
  }
33
50
  }
package/tsconfig.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "module": "ES2020",
7
+ "esModuleInterop": true,
8
+ "moduleResolution": "node",
9
+ "sourceMap": true,
10
+ "downlevelIteration": true,
11
+ "resolveJsonModule": true,
12
+ "strict": false,
13
+ "allowJs": true,
14
+ "strictBindCallApply": true,
15
+ "strictNullChecks": true,
16
+ "strictPropertyInitialization": false,
17
+ "suppressImplicitAnyIndexErrors": true,
18
+ "importHelpers": false,
19
+ "noImplicitAny": true,
20
+ "noImplicitReturns": true,
21
+ "noImplicitThis": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUnusedParameters": false,
24
+ "noUnusedLocals": false,
25
+ "noEmitOnError": false,
26
+ "forceConsistentCasingInFileNames": true,
27
+ "skipLibCheck": true,
28
+ "lib": ["dom", "ESNext"],
29
+ "jsx": "react",
30
+ },
31
+ "exclude": ["node_modules"],
32
+ "include": ["src/client/**/*"]
33
+ }