@module-federation/nextjs-mf 0.0.0-feat-node-support-1702694175665
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/client/UrlNode.d.ts +17 -0
- package/client/UrlNode.js +150 -0
- package/client/UrlNode.js.map +1 -0
- package/node.d.ts +1 -0
- package/node.js +18 -0
- package/node.js.map +1 -0
- package/package.json +44 -0
- package/src/default-delegate.cjs +308 -0
- package/src/default-delegate.d.ts +1 -0
- package/src/default-delegate.js.map +1 -0
- package/src/federation-noop.cjs +15 -0
- package/src/federation-noop.d.ts +0 -0
- package/src/federation-noop.js.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +12 -0
- package/src/index.js.map +1 -0
- package/src/internal.d.ts +48 -0
- package/src/internal.js +256 -0
- package/src/internal.js.map +1 -0
- package/src/loaders/delegateLoader.d.ts +10 -0
- package/src/loaders/delegateLoader.js +46 -0
- package/src/loaders/delegateLoader.js.map +1 -0
- package/src/loaders/fixImageLoader.d.ts +22 -0
- package/src/loaders/fixImageLoader.js +118 -0
- package/src/loaders/fixImageLoader.js.map +1 -0
- package/src/loaders/fixUrlLoader.d.ts +13 -0
- package/src/loaders/fixUrlLoader.js +25 -0
- package/src/loaders/fixUrlLoader.js.map +1 -0
- package/src/loaders/helpers.d.ts +17 -0
- package/src/loaders/helpers.js +60 -0
- package/src/loaders/helpers.js.map +1 -0
- package/src/loaders/nextPageMapLoader.d.ts +24 -0
- package/src/loaders/nextPageMapLoader.js +167 -0
- package/src/loaders/nextPageMapLoader.js.map +1 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -0
- package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
- package/src/plugins/CopyFederationPlugin.d.ts +20 -0
- package/src/plugins/CopyFederationPlugin.js +71 -0
- package/src/plugins/CopyFederationPlugin.js.map +1 -0
- package/src/plugins/NextFederationPlugin/apply-client-plugins.d.ts +23 -0
- package/src/plugins/NextFederationPlugin/apply-client-plugins.js +72 -0
- package/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -0
- package/src/plugins/NextFederationPlugin/apply-server-plugins.d.ts +60 -0
- package/src/plugins/NextFederationPlugin/apply-server-plugins.js +173 -0
- package/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -0
- package/src/plugins/NextFederationPlugin/index.d.ts +30 -0
- package/src/plugins/NextFederationPlugin/index.js +148 -0
- package/src/plugins/NextFederationPlugin/index.js.map +1 -0
- package/src/plugins/NextFederationPlugin/next-fragments.d.ts +18 -0
- package/src/plugins/NextFederationPlugin/next-fragments.js +65 -0
- package/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -0
- package/src/plugins/NextFederationPlugin/regex-equal.d.ts +14 -0
- package/src/plugins/NextFederationPlugin/regex-equal.js +25 -0
- package/src/plugins/NextFederationPlugin/regex-equal.js.map +1 -0
- package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.ts +8 -0
- package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +31 -0
- package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +1 -0
- package/src/plugins/NextFederationPlugin/set-options.d.ts +20 -0
- package/src/plugins/NextFederationPlugin/set-options.js +38 -0
- package/src/plugins/NextFederationPlugin/set-options.js.map +1 -0
- package/src/plugins/NextFederationPlugin/validate-options.d.ts +25 -0
- package/src/plugins/NextFederationPlugin/validate-options.js +46 -0
- package/src/plugins/NextFederationPlugin/validate-options.js.map +1 -0
- package/src/plugins/container/EmbeddedContainerPlugin.d.ts +40 -0
- package/src/plugins/container/EmbeddedContainerPlugin.js +73 -0
- package/src/plugins/container/EmbeddedContainerPlugin.js.map +1 -0
- package/src/plugins/container/HoistPseudoEagerModules.d.ts +19 -0
- package/src/plugins/container/HoistPseudoEagerModules.js +79 -0
- package/src/plugins/container/HoistPseudoEagerModules.js.map +1 -0
- package/src/plugins/container/InvertedContainerPlugin.d.ts +15 -0
- package/src/plugins/container/InvertedContainerPlugin.js +25 -0
- package/src/plugins/container/InvertedContainerPlugin.js.map +1 -0
- package/src/plugins/container/InvertedContainerRuntimeModule.d.ts +15 -0
- package/src/plugins/container/InvertedContainerRuntimeModule.js +65 -0
- package/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -0
- package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.ts +39 -0
- package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +72 -0
- package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +1 -0
- package/src/plugins/container/runtimePlugin.d.ts +2 -0
- package/src/plugins/container/runtimePlugin.js +64 -0
- package/src/plugins/container/runtimePlugin.js.map +1 -0
- package/src/plugins/container/types.d.ts +2 -0
- package/src/plugins/container/types.js +3 -0
- package/src/plugins/container/types.js.map +1 -0
- package/src/types.d.ts +28 -0
- package/src/types.js +3 -0
- package/src/types.js.map +1 -0
- package/utilities.d.ts +1 -0
- package/utilities.js +18 -0
- package/utilities.js.map +1 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This class provides a logic of sorting dynamic routes in NextJS.
|
|
3
|
+
*
|
|
4
|
+
* It was copied from
|
|
5
|
+
* @see https://github.com/vercel/next.js/blob/canary/packages/next/shared/lib/router/utils/sorted-routes.ts
|
|
6
|
+
*/
|
|
7
|
+
export declare class UrlNode {
|
|
8
|
+
placeholder: boolean;
|
|
9
|
+
children: Map<string, UrlNode>;
|
|
10
|
+
slugName: string | null;
|
|
11
|
+
restSlugName: string | null;
|
|
12
|
+
optionalRestSlugName: string | null;
|
|
13
|
+
insert(urlPath: string): void;
|
|
14
|
+
smoosh(): string[];
|
|
15
|
+
private _smoosh;
|
|
16
|
+
private _insert;
|
|
17
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UrlNode = void 0;
|
|
4
|
+
// TODO: fix the no-non-null assertion errors
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
6
|
+
/**
|
|
7
|
+
* This class provides a logic of sorting dynamic routes in NextJS.
|
|
8
|
+
*
|
|
9
|
+
* It was copied from
|
|
10
|
+
* @see https://github.com/vercel/next.js/blob/canary/packages/next/shared/lib/router/utils/sorted-routes.ts
|
|
11
|
+
*/
|
|
12
|
+
class UrlNode {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.placeholder = true;
|
|
15
|
+
this.children = new Map();
|
|
16
|
+
this.slugName = null;
|
|
17
|
+
this.restSlugName = null;
|
|
18
|
+
this.optionalRestSlugName = null;
|
|
19
|
+
}
|
|
20
|
+
insert(urlPath) {
|
|
21
|
+
this._insert(urlPath.split('/').filter(Boolean), [], false);
|
|
22
|
+
}
|
|
23
|
+
smoosh() {
|
|
24
|
+
return this._smoosh();
|
|
25
|
+
}
|
|
26
|
+
_smoosh(prefix = '/') {
|
|
27
|
+
const childrenPaths = [...this.children.keys()].sort();
|
|
28
|
+
if (this.slugName !== null) {
|
|
29
|
+
childrenPaths.splice(childrenPaths.indexOf('[]'), 1);
|
|
30
|
+
}
|
|
31
|
+
if (this.restSlugName !== null) {
|
|
32
|
+
childrenPaths.splice(childrenPaths.indexOf('[...]'), 1);
|
|
33
|
+
}
|
|
34
|
+
if (this.optionalRestSlugName !== null) {
|
|
35
|
+
childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1);
|
|
36
|
+
}
|
|
37
|
+
const routes = childrenPaths
|
|
38
|
+
.map((c) => this.children.get(c)._smoosh(`${prefix}${c}/`))
|
|
39
|
+
.reduce((prev, curr) => [...prev, ...curr], []);
|
|
40
|
+
if (this.slugName !== null) {
|
|
41
|
+
routes.push(...this.children.get('[]')._smoosh(`${prefix}[${this.slugName}]/`));
|
|
42
|
+
}
|
|
43
|
+
if (!this.placeholder) {
|
|
44
|
+
const r = prefix === '/' ? '/' : prefix.slice(0, -1);
|
|
45
|
+
if (this.optionalRestSlugName != null) {
|
|
46
|
+
throw new Error(`You cannot define a route with the same specificity as a optional catch-all route ("${r}" and "${r}[[...${this.optionalRestSlugName}]]").`);
|
|
47
|
+
}
|
|
48
|
+
routes.unshift(r);
|
|
49
|
+
}
|
|
50
|
+
if (this.restSlugName !== null) {
|
|
51
|
+
routes.push(...this.children
|
|
52
|
+
.get('[...]')
|
|
53
|
+
._smoosh(`${prefix}[...${this.restSlugName}]/`));
|
|
54
|
+
}
|
|
55
|
+
if (this.optionalRestSlugName !== null) {
|
|
56
|
+
routes.push(...this.children
|
|
57
|
+
.get('[[...]]')
|
|
58
|
+
._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`));
|
|
59
|
+
}
|
|
60
|
+
return routes;
|
|
61
|
+
}
|
|
62
|
+
_insert(urlPaths, slugNames, isCatchAll) {
|
|
63
|
+
if (urlPaths.length === 0) {
|
|
64
|
+
this.placeholder = false;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (isCatchAll) {
|
|
68
|
+
throw new Error(`Catch-all must be the last part of the URL.`);
|
|
69
|
+
}
|
|
70
|
+
// The next segment in the urlPaths list
|
|
71
|
+
let nextSegment = urlPaths[0];
|
|
72
|
+
// Check if the segment matches `[something]`
|
|
73
|
+
if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) {
|
|
74
|
+
// Strip `[` and `]`, leaving only `something`
|
|
75
|
+
let segmentName = nextSegment.slice(1, -1);
|
|
76
|
+
let isOptional = false;
|
|
77
|
+
if (segmentName.startsWith('[') && segmentName.endsWith(']')) {
|
|
78
|
+
// Strip optional `[` and `]`, leaving only `something`
|
|
79
|
+
segmentName = segmentName.slice(1, -1);
|
|
80
|
+
isOptional = true;
|
|
81
|
+
}
|
|
82
|
+
if (segmentName.startsWith('...')) {
|
|
83
|
+
// Strip `...`, leaving only `something`
|
|
84
|
+
segmentName = segmentName.substring(3);
|
|
85
|
+
isCatchAll = true;
|
|
86
|
+
}
|
|
87
|
+
if (segmentName.startsWith('[') || segmentName.endsWith(']')) {
|
|
88
|
+
throw new Error(`Segment names may not start or end with extra brackets ('${segmentName}').`);
|
|
89
|
+
}
|
|
90
|
+
if (segmentName.startsWith('.')) {
|
|
91
|
+
throw new Error(`Segment names may not start with erroneous periods ('${segmentName}').`);
|
|
92
|
+
}
|
|
93
|
+
const handleSlug = function handleSlug(previousSlug, nextSlug) {
|
|
94
|
+
if (previousSlug !== null && previousSlug !== nextSlug) {
|
|
95
|
+
throw new Error(`You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`);
|
|
96
|
+
}
|
|
97
|
+
slugNames.forEach((slug) => {
|
|
98
|
+
if (slug === nextSlug) {
|
|
99
|
+
throw new Error(`You cannot have the same slug name "${nextSlug}" repeat within a single dynamic path`);
|
|
100
|
+
}
|
|
101
|
+
if (slug.replace(/\W/g, '') === nextSegment.replace(/\W/g, '')) {
|
|
102
|
+
throw new Error(`You cannot have the slug names "${slug}" and "${nextSlug}" differ only by non-word symbols within a single dynamic path`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
slugNames.push(nextSlug);
|
|
106
|
+
};
|
|
107
|
+
if (isCatchAll) {
|
|
108
|
+
if (isOptional) {
|
|
109
|
+
if (this.restSlugName != null) {
|
|
110
|
+
throw new Error(`You cannot use both an required and optional catch-all route at the same level ("[...${this.restSlugName}]" and "${urlPaths[0]}" ).`);
|
|
111
|
+
}
|
|
112
|
+
handleSlug(this.optionalRestSlugName, segmentName);
|
|
113
|
+
// slugName is kept as it can only be one particular slugName
|
|
114
|
+
this.optionalRestSlugName = segmentName;
|
|
115
|
+
// nextSegment is overwritten to [[...]] so that it can later be sorted specifically
|
|
116
|
+
nextSegment = '[[...]]';
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
if (this.optionalRestSlugName != null) {
|
|
120
|
+
throw new Error(`You cannot use both an optional and required catch-all route at the same level ("[[...${this.optionalRestSlugName}]]" and "${urlPaths[0]}").`);
|
|
121
|
+
}
|
|
122
|
+
handleSlug(this.restSlugName, segmentName);
|
|
123
|
+
// slugName is kept as it can only be one particular slugName
|
|
124
|
+
this.restSlugName = segmentName;
|
|
125
|
+
// nextSegment is overwritten to [...] so that it can later be sorted specifically
|
|
126
|
+
nextSegment = '[...]';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
if (isOptional) {
|
|
131
|
+
throw new Error(`Optional route parameters are not yet supported ("${urlPaths[0]}").`);
|
|
132
|
+
}
|
|
133
|
+
handleSlug(this.slugName, segmentName);
|
|
134
|
+
// slugName is kept as it can only be one particular slugName
|
|
135
|
+
this.slugName = segmentName;
|
|
136
|
+
// nextSegment is overwritten to [] so that it can later be sorted specifically
|
|
137
|
+
nextSegment = '[]';
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode
|
|
141
|
+
if (!this.children.has(nextSegment)) {
|
|
142
|
+
this.children.set(nextSegment, new UrlNode());
|
|
143
|
+
}
|
|
144
|
+
this.children
|
|
145
|
+
.get(nextSegment)
|
|
146
|
+
._insert(urlPaths.slice(1), slugNames, isCatchAll);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.UrlNode = UrlNode;
|
|
150
|
+
//# sourceMappingURL=UrlNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UrlNode.js","sourceRoot":"","sources":["../../../../packages/nextjs-mf/client/UrlNode.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAC7C,6DAA6D;AAC7D;;;;;GAKG;AACH,MAAa,OAAO;IAApB;QACE,gBAAW,GAAG,IAAI,CAAC;QACnB,aAAQ,GAAyB,IAAI,GAAG,EAAE,CAAC;QAC3C,aAAQ,GAAkB,IAAI,CAAC;QAC/B,iBAAY,GAAkB,IAAI,CAAC;QACnC,yBAAoB,GAAkB,IAA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AE;oBACd,MAAM,IAAI,KAAK,CACb,qDAAqD,QAAQ,CAAC,CAAC,CAAC,KAAK,CACtE,CAAC;iBACH;gBACD,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;gBACvC,6DAA6D;gBAC7D,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;gBAC5B,+EAA+E;gBAC/E,WAAW,GAAG,IAAI,CAAC;aACpB;SACF;QAED,iFAAiF;QACjF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;YACnC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;SAC/C;QAED,IAAI,CAAC,QAAQ;aACV,GAAG,CAAC,WAAW,CAAE;aACjB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACvD,CAAC;CACF;AA9LD,0BA8LC"}
|
package/node.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@module-federation/node';
|
package/node.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@module-federation/node"), exports);
|
|
18
|
+
//# sourceMappingURL=node.js.map
|
package/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../packages/nextjs-mf/node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@module-federation/nextjs-mf",
|
|
3
|
+
"version": "0.0.0-feat-node-support-1702694175665",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"description": "Module Federation helper for NextJS",
|
|
9
|
+
"repository": "https://github.com/module-federation/universe/tree/main/packages/nextjs-mf",
|
|
10
|
+
"author": "Zack Jackson <zackary.l.jackson@gmail.com>",
|
|
11
|
+
"contributors": [
|
|
12
|
+
"Pavel Chertorogov, nodkz <pavel.chertorogov@gmail.com> (www.ps.kz)"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"encoding": "^0.1.13",
|
|
19
|
+
"eventemitter3": "^5.0.0",
|
|
20
|
+
"fast-glob": "^3.2.11",
|
|
21
|
+
"node-fetch": "2.7.0",
|
|
22
|
+
"semver": "7.5.4",
|
|
23
|
+
"tapable": "2.2.1",
|
|
24
|
+
"webpack-sources": "^3.2.3",
|
|
25
|
+
"@module-federation/enhanced": "0.0.0-feat-node-support-1702694175663",
|
|
26
|
+
"@module-federation/node": "0.0.0-feat-node-support-1702694175665",
|
|
27
|
+
"@module-federation/runtime": "0.0.0-feat-node-support-1702694175665",
|
|
28
|
+
"@module-federation/sdk": "0.0.0-feat-node-support-1702694175665",
|
|
29
|
+
"@module-federation/utilities": "0.0.0-feat-node-support-1702694175668",
|
|
30
|
+
"@module-federation/webpack-bundler-runtime": "0.0.0-feat-node-support-1702694175669"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"next": "^12 || ^13 || ^14",
|
|
34
|
+
"react": "^17 || ^18",
|
|
35
|
+
"react-dom": "^17 || ^18",
|
|
36
|
+
"styled-jsx": "*",
|
|
37
|
+
"webpack": "^5.40.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"styled-jsx": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Initializing pure as RemoteVars
|
|
5
|
+
*/
|
|
6
|
+
let pure = {};
|
|
7
|
+
try {
|
|
8
|
+
/**
|
|
9
|
+
* Assigning process.env['REMOTES'] to pure if it exists
|
|
10
|
+
*/
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
pure = process.env['REMOTES'] || {};
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
// not in webpack bundle
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Casting pure as RemoteVars
|
|
19
|
+
*/
|
|
20
|
+
const remoteVars = pure;
|
|
21
|
+
/**
|
|
22
|
+
* Function to extract URL and Global from a string
|
|
23
|
+
* @param {string} urlAndGlobal - The string to extract from
|
|
24
|
+
* @returns {Array} - An array containing the URL and Global
|
|
25
|
+
*/
|
|
26
|
+
const extractUrlAndGlobal = (urlAndGlobal) => {
|
|
27
|
+
const index = urlAndGlobal.indexOf('@');
|
|
28
|
+
if (index <= 0 || index === urlAndGlobal.length - 1) {
|
|
29
|
+
throw new Error(`Invalid request "${urlAndGlobal}"`);
|
|
30
|
+
}
|
|
31
|
+
return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Function to load script
|
|
35
|
+
* @param {string | RuntimeRemote} keyOrRuntimeRemoteItem - The key or RuntimeRemote item to load
|
|
36
|
+
* @returns {Promise} - A promise that resolves with the loaded script
|
|
37
|
+
*/
|
|
38
|
+
const loadScript = (keyOrRuntimeRemoteItem) => {
|
|
39
|
+
const runtimeRemotes = getRuntimeRemotes();
|
|
40
|
+
// 1) Load remote container if needed
|
|
41
|
+
let asyncContainer;
|
|
42
|
+
const reference = typeof keyOrRuntimeRemoteItem === 'string'
|
|
43
|
+
? runtimeRemotes[keyOrRuntimeRemoteItem]
|
|
44
|
+
: keyOrRuntimeRemoteItem;
|
|
45
|
+
if (reference.asyncContainer) {
|
|
46
|
+
asyncContainer =
|
|
47
|
+
typeof reference.asyncContainer.then === 'function'
|
|
48
|
+
? reference.asyncContainer
|
|
49
|
+
: // @ts-ignore
|
|
50
|
+
reference.asyncContainer();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// This casting is just to satisfy typescript,
|
|
54
|
+
// In reality remoteGlobal will always be a string;
|
|
55
|
+
const remoteGlobal = reference.global;
|
|
56
|
+
// Check if theres an override for container key if not use remote global
|
|
57
|
+
const containerKey = reference.uniqueKey
|
|
58
|
+
? reference.uniqueKey
|
|
59
|
+
: remoteGlobal;
|
|
60
|
+
const __webpack_error__ = new Error();
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
if (!globalThis.__remote_scope__) {
|
|
63
|
+
// create a global scope for container, similar to how remotes are set on window in the browser
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
globalThis.__remote_scope__ = {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
_config: {},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
const globalScope =
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
typeof window !== 'undefined' ? window : globalThis.__remote_scope__;
|
|
74
|
+
if (typeof window === 'undefined') {
|
|
75
|
+
globalScope['_config'][containerKey] = reference.url;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// to match promise template system, can be removed once promise template is gone
|
|
79
|
+
if (!globalScope['remoteLoading']) {
|
|
80
|
+
globalScope['remoteLoading'] = {};
|
|
81
|
+
}
|
|
82
|
+
if (globalScope['remoteLoading'][containerKey]) {
|
|
83
|
+
return globalScope['remoteLoading'][containerKey];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
asyncContainer = new Promise(function (resolve, reject) {
|
|
88
|
+
function resolveRemoteGlobal() {
|
|
89
|
+
const asyncContainer = globalScope[remoteGlobal];
|
|
90
|
+
return resolve(asyncContainer);
|
|
91
|
+
}
|
|
92
|
+
if (typeof globalScope[remoteGlobal] !== 'undefined') {
|
|
93
|
+
return resolveRemoteGlobal();
|
|
94
|
+
}
|
|
95
|
+
__webpack_require__.l(reference.url, function (event) {
|
|
96
|
+
if (typeof globalScope[remoteGlobal] !== 'undefined') {
|
|
97
|
+
return resolveRemoteGlobal();
|
|
98
|
+
}
|
|
99
|
+
const errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
100
|
+
const realSrc = event && event.target && event.target.src;
|
|
101
|
+
__webpack_error__.message =
|
|
102
|
+
'Loading script failed.\n(' +
|
|
103
|
+
errorType +
|
|
104
|
+
': ' +
|
|
105
|
+
realSrc +
|
|
106
|
+
' or global var ' +
|
|
107
|
+
remoteGlobal +
|
|
108
|
+
')';
|
|
109
|
+
__webpack_error__.name = 'ScriptExternalLoadError';
|
|
110
|
+
__webpack_error__.type = errorType;
|
|
111
|
+
__webpack_error__.request = realSrc;
|
|
112
|
+
reject(__webpack_error__);
|
|
113
|
+
}, containerKey);
|
|
114
|
+
}).catch(function (err) {
|
|
115
|
+
console.error('container is offline, returning fake remote');
|
|
116
|
+
console.error(err);
|
|
117
|
+
return {
|
|
118
|
+
fake: true,
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
get: (arg) => {
|
|
121
|
+
console.warn('faking', arg, 'module on, its offline');
|
|
122
|
+
return Promise.resolve(() => {
|
|
123
|
+
return {
|
|
124
|
+
__esModule: true,
|
|
125
|
+
default: () => {
|
|
126
|
+
return null;
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
//eslint-disable-next-line
|
|
132
|
+
init: () => { },
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
if (typeof window !== 'undefined') {
|
|
136
|
+
globalScope['remoteLoading'][containerKey] = asyncContainer;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return asyncContainer;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Function to get runtime remotes
|
|
143
|
+
* @returns {RuntimeRemotesMap} - An object containing runtime remotes
|
|
144
|
+
*/
|
|
145
|
+
const getRuntimeRemotes = () => {
|
|
146
|
+
try {
|
|
147
|
+
return Object.entries(remoteVars).reduce(function (acc, item) {
|
|
148
|
+
const [key, value] = item;
|
|
149
|
+
// if its an object with a thenable (eagerly executing function)
|
|
150
|
+
if (typeof value === 'object' && typeof value.then === 'function') {
|
|
151
|
+
acc[key] = { asyncContainer: value };
|
|
152
|
+
}
|
|
153
|
+
// if its a function that must be called (lazily executing function)
|
|
154
|
+
else if (typeof value === 'function') {
|
|
155
|
+
// @ts-ignore
|
|
156
|
+
acc[key] = { asyncContainer: value };
|
|
157
|
+
}
|
|
158
|
+
// if its a delegate module, skip it
|
|
159
|
+
else if (typeof value === 'string' && value.startsWith('internal ')) {
|
|
160
|
+
const [request, query] = value.replace('internal ', '').split('?');
|
|
161
|
+
if (query) {
|
|
162
|
+
const remoteSyntax = new URLSearchParams(query).get('remote');
|
|
163
|
+
if (remoteSyntax) {
|
|
164
|
+
const [url, global] = extractUrlAndGlobal(remoteSyntax);
|
|
165
|
+
acc[key] = { global, url };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if (typeof value === 'string' && !value.includes('@')) {
|
|
170
|
+
acc[key] = { global: key, url: value };
|
|
171
|
+
console.warn('delegates may need work');
|
|
172
|
+
}
|
|
173
|
+
// if its just a string (global@url)
|
|
174
|
+
else if (typeof value === 'string') {
|
|
175
|
+
const [url, global] = extractUrlAndGlobal(value);
|
|
176
|
+
acc[key] = { global, url };
|
|
177
|
+
}
|
|
178
|
+
// we dont know or currently support this type
|
|
179
|
+
else {
|
|
180
|
+
//@ts-ignore
|
|
181
|
+
console.warn('remotes process', process.env.REMOTES);
|
|
182
|
+
throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
|
|
183
|
+
}
|
|
184
|
+
return acc;
|
|
185
|
+
}, {});
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
console.warn('Unable to retrieve runtime remotes: ', err);
|
|
189
|
+
}
|
|
190
|
+
return {};
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Function to import a delegated module
|
|
194
|
+
* @param {string | RuntimeRemote} keyOrRuntimeRemoteItem - The key or RuntimeRemote item to import
|
|
195
|
+
* @returns {Promise} - A promise that resolves with the imported module
|
|
196
|
+
*/
|
|
197
|
+
const importDelegatedModule = async (keyOrRuntimeRemoteItem) => {
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
return loadScript(keyOrRuntimeRemoteItem)
|
|
200
|
+
.then((asyncContainer) => {
|
|
201
|
+
return asyncContainer;
|
|
202
|
+
})
|
|
203
|
+
.then((asyncContainer) => {
|
|
204
|
+
// most of this is only needed because of legacy promise based implementation
|
|
205
|
+
// can remove proxies once we remove promise based implementations
|
|
206
|
+
if (typeof window === 'undefined') {
|
|
207
|
+
if (!Object.hasOwnProperty.call(keyOrRuntimeRemoteItem, 'globalThis')) {
|
|
208
|
+
return asyncContainer;
|
|
209
|
+
}
|
|
210
|
+
// return asyncContainer;
|
|
211
|
+
//TODO: need to solve chunk flushing with delegated modules
|
|
212
|
+
return {
|
|
213
|
+
/**
|
|
214
|
+
* Function to get a module from the asyncContainer
|
|
215
|
+
* @param {string} arg - The module to get
|
|
216
|
+
* @returns {Promise} - A promise that resolves with the module
|
|
217
|
+
*/
|
|
218
|
+
get: function (arg) {
|
|
219
|
+
//@ts-ignore
|
|
220
|
+
return asyncContainer.get(arg).then((f) => {
|
|
221
|
+
const m = f();
|
|
222
|
+
const result = {
|
|
223
|
+
__esModule: m.__esModule,
|
|
224
|
+
};
|
|
225
|
+
for (const prop in m) {
|
|
226
|
+
if (typeof m[prop] === 'function') {
|
|
227
|
+
Object.defineProperty(result, prop, {
|
|
228
|
+
get: function () {
|
|
229
|
+
return function () {
|
|
230
|
+
if (globalThis.usedChunks) {
|
|
231
|
+
globalThis.usedChunks.add(
|
|
232
|
+
//@ts-ignore
|
|
233
|
+
`${keyOrRuntimeRemoteItem.global}->${arg}`);
|
|
234
|
+
}
|
|
235
|
+
//eslint-disable-next-line prefer-rest-params
|
|
236
|
+
return m[prop](...arguments);
|
|
237
|
+
};
|
|
238
|
+
},
|
|
239
|
+
enumerable: true,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
Object.defineProperty(result, prop, {
|
|
244
|
+
get: () => {
|
|
245
|
+
if (globalThis.usedChunks) {
|
|
246
|
+
globalThis.usedChunks.add(
|
|
247
|
+
//@ts-ignore
|
|
248
|
+
`${keyOrRuntimeRemoteItem.global}->${arg}`);
|
|
249
|
+
}
|
|
250
|
+
return m[prop];
|
|
251
|
+
},
|
|
252
|
+
enumerable: true,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (m.then) {
|
|
257
|
+
return Promise.resolve(() => result);
|
|
258
|
+
}
|
|
259
|
+
return () => result;
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
init: asyncContainer.init,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
return asyncContainer;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Module exports a Promise that resolves with a remote module
|
|
272
|
+
* @returns {Promise} - A promise that resolves with the remote module
|
|
273
|
+
*/
|
|
274
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
275
|
+
module.exports = new Promise(async (resolve, reject) => {
|
|
276
|
+
/**
|
|
277
|
+
* Extracting the current request from the resource query
|
|
278
|
+
*/
|
|
279
|
+
// eslint-disable-next-line no-undef
|
|
280
|
+
const currentRequest = new URLSearchParams(__resourceQuery).get('remote');
|
|
281
|
+
/**
|
|
282
|
+
* Splitting the current request into global and url
|
|
283
|
+
*/
|
|
284
|
+
// @ts-ignore
|
|
285
|
+
const [global, url] = currentRequest.split('@');
|
|
286
|
+
/**
|
|
287
|
+
* Importing the delegated module
|
|
288
|
+
*/
|
|
289
|
+
importDelegatedModule({
|
|
290
|
+
global,
|
|
291
|
+
url: url + '?' + Date.now(),
|
|
292
|
+
})
|
|
293
|
+
// @ts-ignore
|
|
294
|
+
.then((remote) => {
|
|
295
|
+
/**
|
|
296
|
+
* Resolving the promise with the remote module
|
|
297
|
+
*/
|
|
298
|
+
resolve(remote);
|
|
299
|
+
})
|
|
300
|
+
// @ts-ignore
|
|
301
|
+
.catch((err) => {
|
|
302
|
+
/**
|
|
303
|
+
* Rejecting the promise if an error occurs
|
|
304
|
+
*/
|
|
305
|
+
reject(err);
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
//# sourceMappingURL=default-delegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-delegate.js","sourceRoot":"","sources":["../../../../packages/nextjs-mf/src/default-delegate.ts"],"names":[],"mappings":";;AAWA;;GAEG;AACH,IAAI,IAAI,GAAG,EAAgB,CAAC;AAC5B,IAAI;IACF;;OA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
|
+
require('next/router');
|
|
4
|
+
require('next/link');
|
|
5
|
+
require('next/script');
|
|
6
|
+
require('next/image');
|
|
7
|
+
require('next/dynamic');
|
|
8
|
+
require('next/error');
|
|
9
|
+
require('next/amp');
|
|
10
|
+
require('styled-jsx');
|
|
11
|
+
require('styled-jsx/style');
|
|
12
|
+
require('next/image');
|
|
13
|
+
require('react/jsx-dev-runtime');
|
|
14
|
+
require('react/jsx-runtime');
|
|
15
|
+
//# sourceMappingURL=federation-noop.js.map
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federation-noop.js","sourceRoot":"","sources":["../../../../packages/nextjs-mf/src/federation-noop.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,WAAW,CAAC,CAAC;AACrB,OAAO,CAAC,aAAa,CAAC,CAAC;AACvB,OAAO,CAAC,WAAW,CAAC,CAAC;AACrB,OAAO,CAAC,aAAa,CAAC,CAAC;AACvB,OAAO,CAAC,YAAY,CAAC,CAAC;AACtB,OAAO,CAAC,cAAc,CAAC,CAAC;AACxB,OAAO,CAAC,YAAY,CAAC,CAAC;AACtB,OAAO,CAAC,UAAU,CAAC,CAAC;AACpB,OAAO,CAAC,YAAY,CAAC,CAAC;AACtB,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5B,OAAO,CAAC,YAAY,CAAC,CAAC;AACtB,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACjC,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NextFederationPlugin = void 0;
|
|
7
|
+
const NextFederationPlugin_1 = __importDefault(require("./plugins/NextFederationPlugin"));
|
|
8
|
+
exports.NextFederationPlugin = NextFederationPlugin_1.default;
|
|
9
|
+
exports.default = NextFederationPlugin_1.default;
|
|
10
|
+
module.exports = NextFederationPlugin_1.default;
|
|
11
|
+
module.exports.NextFederationPlugin = NextFederationPlugin_1.default;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/nextjs-mf/src/index.ts"],"names":[],"mappings":";;;;;;AAAA,0FAAkE;AAEzD,+BAFF,8BAAoB,CAEE;AAC7B,kBAAe,8BAAoB,CAAC;AAEpC,MAAM,CAAC,OAAO,GAAG,8BAAoB,CAAC;AACtC,MAAM,CAAC,OAAO,CAAC,oBAAoB,GAAG,8BAAoB,CAAC"}
|