@module-federation/nextjs-mf 5.5.1 → 5.6.1

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 (143) hide show
  1. package/README.md +1 -27
  2. package/{lib/client → client}/CombinedPages.d.ts +27 -28
  3. package/client/CombinedPages.js +38 -0
  4. package/client/CombinedPages.js.map +1 -0
  5. package/{lib/client → client}/MFClient.d.ts +72 -73
  6. package/client/MFClient.js +159 -0
  7. package/client/MFClient.js.map +1 -0
  8. package/{lib/client → client}/RemoteContainer.d.ts +46 -58
  9. package/client/RemoteContainer.js +121 -0
  10. package/client/RemoteContainer.js.map +1 -0
  11. package/{lib/client → client}/RemotePages.d.ts +49 -49
  12. package/client/RemotePages.js +138 -0
  13. package/client/RemotePages.js.map +1 -0
  14. package/{lib/client → client}/UrlNode.d.ts +17 -18
  15. package/{lib/client → client}/UrlNode.js +157 -161
  16. package/client/UrlNode.js.map +1 -0
  17. package/{lib/client → client}/helpers.d.ts +16 -17
  18. package/{lib/client → client}/helpers.js +90 -104
  19. package/client/helpers.js.map +1 -0
  20. package/client/index.d.ts +2 -0
  21. package/client/index.js +6 -0
  22. package/client/index.js.map +1 -0
  23. package/{lib/client → client}/useMFClient.d.ts +24 -25
  24. package/client/useMFClient.js +55 -0
  25. package/client/useMFClient.js.map +1 -0
  26. package/{lib/client → client}/useMFRemote.d.ts +16 -17
  27. package/client/useMFRemote.js +50 -0
  28. package/client/useMFRemote.js.map +1 -0
  29. package/jest.config.d.ts +13 -0
  30. package/jest.config.js +18 -0
  31. package/jest.config.js.map +1 -0
  32. package/package.json +19 -42
  33. package/src/include-defaults.d.ts +0 -0
  34. package/{lib → src}/include-defaults.js +4 -3
  35. package/src/include-defaults.js.map +1 -0
  36. package/src/index.d.ts +3 -0
  37. package/src/index.js +9 -0
  38. package/src/index.js.map +1 -0
  39. package/src/internal.d.ts +12 -0
  40. package/src/internal.js +260 -0
  41. package/src/internal.js.map +1 -0
  42. package/src/loaders/fixImageLoader.d.ts +16 -0
  43. package/src/loaders/fixImageLoader.js +53 -0
  44. package/src/loaders/fixImageLoader.js.map +1 -0
  45. package/src/loaders/fixUrlLoader.d.ts +13 -0
  46. package/src/loaders/fixUrlLoader.js +25 -0
  47. package/src/loaders/fixUrlLoader.js.map +1 -0
  48. package/src/loaders/helpers.d.ts +10 -0
  49. package/src/loaders/helpers.js +46 -0
  50. package/src/loaders/helpers.js.map +1 -0
  51. package/src/loaders/nextPageMapLoader.d.ts +15 -0
  52. package/src/loaders/nextPageMapLoader.js +151 -0
  53. package/src/loaders/nextPageMapLoader.js.map +1 -0
  54. package/src/loaders/patchNextClientPageLoader.d.ts +7 -0
  55. package/src/loaders/patchNextClientPageLoader.js +43 -0
  56. package/src/loaders/patchNextClientPageLoader.js.map +1 -0
  57. package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
  58. package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -0
  59. package/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
  60. package/src/plugins/ChildFederationPlugin.d.ts +9 -0
  61. package/src/plugins/ChildFederationPlugin.js +281 -0
  62. package/src/plugins/ChildFederationPlugin.js.map +1 -0
  63. package/src/plugins/DevHmrFixInvalidPongPlugin.d.ts +11 -0
  64. package/src/plugins/DevHmrFixInvalidPongPlugin.js +55 -0
  65. package/src/plugins/DevHmrFixInvalidPongPlugin.js.map +1 -0
  66. package/src/plugins/ModuleFederationPlugin.d.ts +7 -0
  67. package/src/plugins/ModuleFederationPlugin.js +50 -0
  68. package/src/plugins/ModuleFederationPlugin.js.map +1 -0
  69. package/src/plugins/NextFederationPlugin.d.ts +9 -0
  70. package/src/plugins/NextFederationPlugin.js +111 -0
  71. package/src/plugins/NextFederationPlugin.js.map +1 -0
  72. package/src/plugins/RemoveRRRuntimePlugin.d.ts +5 -0
  73. package/src/plugins/RemoveRRRuntimePlugin.js +39 -0
  74. package/src/plugins/RemoveRRRuntimePlugin.js.map +1 -0
  75. package/utils/Template.d.ts +148 -0
  76. package/utils/Template.js +381 -0
  77. package/utils/Template.js.map +1 -0
  78. package/utils/build-utils.d.ts +3 -0
  79. package/utils/build-utils.js +175 -0
  80. package/utils/build-utils.js.map +1 -0
  81. package/utils/index.d.ts +1 -0
  82. package/utils/index.js +7 -0
  83. package/utils/index.js.map +1 -0
  84. package/.prettierignore +0 -2
  85. package/.prettierrc +0 -7
  86. package/LICENSE +0 -21
  87. package/lib/ModuleFederationPlugin.js +0 -84
  88. package/lib/NextFederationPlugin.js +0 -513
  89. package/lib/_virtual/Template.js +0 -7
  90. package/lib/_virtual/UrlNode.js +0 -9
  91. package/lib/_virtual/_commonjsHelpers.js +0 -44
  92. package/lib/_virtual/_fast-glob.js +0 -16
  93. package/lib/_virtual/_fs.js +0 -16
  94. package/lib/_virtual/_path.js +0 -16
  95. package/lib/_virtual/_tslib.js +0 -277
  96. package/lib/_virtual/_webpack-sources.js +0 -16
  97. package/lib/_virtual/fs.js +0 -4
  98. package/lib/_virtual/fs2.js +0 -7
  99. package/lib/_virtual/helpers.js +0 -7
  100. package/lib/_virtual/nextPageMapLoader.js +0 -7
  101. package/lib/_virtual/options.js +0 -7
  102. package/lib/_virtual/utils.js +0 -7
  103. package/lib/build-utils.js +0 -176
  104. package/lib/client/CombinedPages.d.ts.map +0 -1
  105. package/lib/client/CombinedPages.js +0 -60
  106. package/lib/client/MFClient.d.ts.map +0 -1
  107. package/lib/client/MFClient.js +0 -213
  108. package/lib/client/RemoteContainer.d.ts.map +0 -1
  109. package/lib/client/RemoteContainer.js +0 -162
  110. package/lib/client/RemotePages.d.ts.map +0 -1
  111. package/lib/client/RemotePages.js +0 -194
  112. package/lib/client/UrlNode.d.ts.map +0 -1
  113. package/lib/client/helpers.d.ts.map +0 -1
  114. package/lib/client/useMFClient.d.ts.map +0 -1
  115. package/lib/client/useMFClient.js +0 -79
  116. package/lib/client/useMFRemote.d.ts.map +0 -1
  117. package/lib/client/useMFRemote.js +0 -72
  118. package/lib/dependencies/webpack/lib/Template.js +0 -437
  119. package/lib/dependencies/webpack/lib/container/options.js +0 -102
  120. package/lib/dependencies/webpack/lib/sharing/utils.js +0 -104
  121. package/lib/dependencies/webpack/lib/util/fs.js +0 -359
  122. package/lib/index.js +0 -3
  123. package/lib/internal.js +0 -271
  124. package/lib/loaders/UrlNode.js +0 -219
  125. package/lib/loaders/fixImageLoader.js +0 -65
  126. package/lib/loaders/fixUrlLoader.js +0 -25
  127. package/lib/loaders/helpers.js +0 -60
  128. package/lib/loaders/nextPageMapLoader.js +0 -200
  129. package/lib/loaders/patchNextClientPageLoader.js +0 -53
  130. package/lib/node-plugin/streaming/CommonJsChunkLoadingPlugin.js +0 -94
  131. package/lib/node-plugin/streaming/LoadFileChunkLoadingRuntimeModule.js +0 -414
  132. package/lib/node-plugin/streaming/index.js +0 -46
  133. package/lib/node-plugin/streaming/loadScript.js +0 -59
  134. package/lib/plugins/DevHmrFixInvalidPongPlugin.js +0 -82
  135. package/lib/utils.js +0 -125
  136. package/node-plugin/README.md +0 -27
  137. package/node-plugin/package.json +0 -4
  138. package/node-plugin/streaming/CommonJsChunkLoadingPlugin.js +0 -89
  139. package/node-plugin/streaming/LoadFileChunkLoadingRuntimeModule.js +0 -410
  140. package/node-plugin/streaming/NodeRuntime.js +0 -245
  141. package/node-plugin/streaming/index.js +0 -42
  142. package/node-plugin/streaming/loadScript.js +0 -51
  143. package/tsconfig.json +0 -33
@@ -1,277 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- /******************************************************************************
6
- Copyright (c) Microsoft Corporation.
7
-
8
- Permission to use, copy, modify, and/or distribute this software for any
9
- purpose with or without fee is hereby granted.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
- PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */
19
- /* global Reflect, Promise */
20
-
21
- var extendStatics = function(d, b) {
22
- extendStatics = Object.setPrototypeOf ||
23
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
25
- return extendStatics(d, b);
26
- };
27
-
28
- function __extends(d, b) {
29
- if (typeof b !== "function" && b !== null)
30
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- exports.__assign = function() {
37
- exports.__assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return exports.__assign.apply(this, arguments);
45
- };
46
-
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- }
58
-
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63
- return c > 3 && r && Object.defineProperty(target, key, r), r;
64
- }
65
-
66
- function __param(paramIndex, decorator) {
67
- return function (target, key) { decorator(target, key, paramIndex); }
68
- }
69
-
70
- function __metadata(metadataKey, metadataValue) {
71
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
- }
73
-
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
- return new (P || (P = Promise))(function (resolve, reject) {
77
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
- step((generator = generator.apply(thisArg, _arguments || [])).next());
81
- });
82
- }
83
-
84
- function __generator(thisArg, body) {
85
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
86
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
87
- function verb(n) { return function (v) { return step([n, v]); }; }
88
- function step(op) {
89
- if (f) throw new TypeError("Generator is already executing.");
90
- while (_) try {
91
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
92
- if (y = 0, t) op = [op[0] & 2, t.value];
93
- switch (op[0]) {
94
- case 0: case 1: t = op; break;
95
- case 4: _.label++; return { value: op[1], done: false };
96
- case 5: _.label++; y = op[1]; op = [0]; continue;
97
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
100
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
101
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
102
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
103
- if (t[2]) _.ops.pop();
104
- _.trys.pop(); continue;
105
- }
106
- op = body.call(thisArg, _);
107
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
108
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
109
- }
110
- }
111
-
112
- var __createBinding = Object.create ? (function(o, m, k, k2) {
113
- if (k2 === undefined) k2 = k;
114
- var desc = Object.getOwnPropertyDescriptor(m, k);
115
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
116
- desc = { enumerable: true, get: function() { return m[k]; } };
117
- }
118
- Object.defineProperty(o, k2, desc);
119
- }) : (function(o, m, k, k2) {
120
- if (k2 === undefined) k2 = k;
121
- o[k2] = m[k];
122
- });
123
-
124
- function __exportStar(m, o) {
125
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
126
- }
127
-
128
- function __values(o) {
129
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
130
- if (m) return m.call(o);
131
- if (o && typeof o.length === "number") return {
132
- next: function () {
133
- if (o && i >= o.length) o = void 0;
134
- return { value: o && o[i++], done: !o };
135
- }
136
- };
137
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
138
- }
139
-
140
- function __read(o, n) {
141
- var m = typeof Symbol === "function" && o[Symbol.iterator];
142
- if (!m) return o;
143
- var i = m.call(o), r, ar = [], e;
144
- try {
145
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
146
- }
147
- catch (error) { e = { error: error }; }
148
- finally {
149
- try {
150
- if (r && !r.done && (m = i["return"])) m.call(i);
151
- }
152
- finally { if (e) throw e.error; }
153
- }
154
- return ar;
155
- }
156
-
157
- /** @deprecated */
158
- function __spread() {
159
- for (var ar = [], i = 0; i < arguments.length; i++)
160
- ar = ar.concat(__read(arguments[i]));
161
- return ar;
162
- }
163
-
164
- /** @deprecated */
165
- function __spreadArrays() {
166
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
167
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
168
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
169
- r[k] = a[j];
170
- return r;
171
- }
172
-
173
- function __spreadArray(to, from, pack) {
174
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
175
- if (ar || !(i in from)) {
176
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
177
- ar[i] = from[i];
178
- }
179
- }
180
- return to.concat(ar || Array.prototype.slice.call(from));
181
- }
182
-
183
- function __await(v) {
184
- return this instanceof __await ? (this.v = v, this) : new __await(v);
185
- }
186
-
187
- function __asyncGenerator(thisArg, _arguments, generator) {
188
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
189
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
190
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
191
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
192
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
193
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
194
- function fulfill(value) { resume("next", value); }
195
- function reject(value) { resume("throw", value); }
196
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
197
- }
198
-
199
- function __asyncDelegator(o) {
200
- var i, p;
201
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
202
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
203
- }
204
-
205
- function __asyncValues(o) {
206
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
207
- var m = o[Symbol.asyncIterator], i;
208
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
209
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
210
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
211
- }
212
-
213
- function __makeTemplateObject(cooked, raw) {
214
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
215
- return cooked;
216
- };
217
-
218
- var __setModuleDefault = Object.create ? (function(o, v) {
219
- Object.defineProperty(o, "default", { enumerable: true, value: v });
220
- }) : function(o, v) {
221
- o["default"] = v;
222
- };
223
-
224
- function __importStar(mod) {
225
- if (mod && mod.__esModule) return mod;
226
- var result = {};
227
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
228
- __setModuleDefault(result, mod);
229
- return result;
230
- }
231
-
232
- function __importDefault(mod) {
233
- return (mod && mod.__esModule) ? mod : { default: mod };
234
- }
235
-
236
- function __classPrivateFieldGet(receiver, state, kind, f) {
237
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
238
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
239
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
240
- }
241
-
242
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
243
- if (kind === "m") throw new TypeError("Private method is not writable");
244
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
245
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
246
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
247
- }
248
-
249
- function __classPrivateFieldIn(state, receiver) {
250
- if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
251
- return typeof state === "function" ? receiver === state : state.has(receiver);
252
- }
253
-
254
- exports.__asyncDelegator = __asyncDelegator;
255
- exports.__asyncGenerator = __asyncGenerator;
256
- exports.__asyncValues = __asyncValues;
257
- exports.__await = __await;
258
- exports.__awaiter = __awaiter;
259
- exports.__classPrivateFieldGet = __classPrivateFieldGet;
260
- exports.__classPrivateFieldIn = __classPrivateFieldIn;
261
- exports.__classPrivateFieldSet = __classPrivateFieldSet;
262
- exports.__createBinding = __createBinding;
263
- exports.__decorate = __decorate;
264
- exports.__exportStar = __exportStar;
265
- exports.__extends = __extends;
266
- exports.__generator = __generator;
267
- exports.__importDefault = __importDefault;
268
- exports.__importStar = __importStar;
269
- exports.__makeTemplateObject = __makeTemplateObject;
270
- exports.__metadata = __metadata;
271
- exports.__param = __param;
272
- exports.__read = __read;
273
- exports.__rest = __rest;
274
- exports.__spread = __spread;
275
- exports.__spreadArray = __spreadArray;
276
- exports.__spreadArrays = __spreadArrays;
277
- exports.__values = __values;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var require$$0 = require('webpack-sources');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
10
-
11
-
12
-
13
- Object.defineProperty(exports, 'default', {
14
- enumerable: true,
15
- get: function () { return require$$0__default["default"]; }
16
- });
@@ -1,4 +0,0 @@
1
- 'use strict';
2
-
3
- require('./../dependencies/webpack/lib/util/fs.js');
4
-
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var fs = {};
6
-
7
- exports.__exports = fs;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var helpers = {};
6
-
7
- exports.__exports = helpers;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var nextPageMapLoader = {exports: {}};
6
-
7
- exports.nextPageMapLoader = nextPageMapLoader;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var options = {};
6
-
7
- exports.__exports = options;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var utils = {};
6
-
7
- exports.__exports = utils;
@@ -1,176 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var internal = require('./internal.js');
6
- require('./utils.js');
7
- var Template = require('./dependencies/webpack/lib/Template.js');
8
-
9
- const swc = require("@swc/core");
10
-
11
- const transformInput = (code) => {
12
- return swc.transformSync(code, {
13
- // Some options cannot be specified in .swcrc
14
- sourceMaps: false,
15
- // Input files are treated as module by default.
16
- isModule: false,
17
- // All options below can be configured via .swcrc
18
- jsc: {
19
- "loose": false,
20
- target: "es5",
21
- "externalHelpers": false,
22
- parser: {
23
- syntax: "ecmascript",
24
- },
25
- transform: {},
26
- },
27
- }).code
28
- };
29
-
30
- //urlAndGlobal is defined in the template wrapper
31
- const remoteTemplate = function() {
32
- const index = urlAndGlobal.indexOf('@');
33
- if (index <= 0 || index === urlAndGlobal.length - 1) {
34
- throw new Error(`Invalid request "${urlAndGlobal}"`);
35
- }
36
- var remote = {url: urlAndGlobal.substring(index + 1), global: urlAndGlobal.substring(0, index)};
37
- return new Promise(function (resolve, reject) {
38
- var __webpack_error__ = new Error();
39
- if (typeof window[remote.global] !== 'undefined') {
40
- return resolve();
41
- }
42
- __webpack_require__.l(remote.url, function (event) {
43
- if (typeof window[remote.global] !== 'undefined') {
44
- return resolve();
45
- }
46
-
47
- var errorType = event && (event.type === 'load' ? 'missing' : event.type);
48
- var realSrc = event && event.target && event.target.src;
49
- __webpack_error__.message = 'Loading script failed.(' + errorType + ': ' + realSrc + ' or global var ' + remote.global + ')';
50
- __webpack_error__.name = 'ScriptExternalLoadError';
51
- __webpack_error__.type = errorType;
52
- __webpack_error__.request = realSrc;
53
- reject(__webpack_error__);
54
- }, remote.global);
55
- }).then(function () {
56
- const proxy = {
57
- get: window[remote.global].get,
58
- init: function (shareScope) {
59
- const handler = {
60
- get(target, prop) {
61
- if (target[prop]) {
62
- Object.values(target[prop]).forEach(function (o) {
63
- if (o.from === '_N_E') {
64
- o.loaded = 1;
65
- }
66
- });
67
- }
68
- return target[prop]
69
- },
70
- set(target, property, value, receiver) {
71
- if (target[property]) {
72
- return target[property]
73
- }
74
- target[property] = value;
75
- return true
76
- }
77
- };
78
- try {
79
- window[remote.global].init(new Proxy(shareScope, handler));
80
- } catch (e) {
81
-
82
- }
83
- window[remote.global].__initialized = true;
84
- }
85
- };
86
- if (!window[remote.global].__initialized) {
87
- proxy.init();
88
- }
89
- return proxy
90
- })
91
- };
92
- const promiseFactory = (factory) => {
93
-
94
- const wrapper = `new Promise(${factory.toString()})`;
95
- if (wrapper.includes('require(', 'import(', 'import ')) {
96
- throw new Error('promiseFactory does not support require, import, or import statements');
97
- }
98
-
99
- const template = Template["default"].asString([
100
- 'function() {',
101
- Template["default"].indent([
102
- wrapper
103
- ]),
104
- '}',
105
- ]);
106
-
107
- return template
108
- };
109
-
110
- const promiseTemplate = (remote, ...otherPromises) => {
111
- let promises = '';
112
- if (otherPromises) {
113
- promises = otherPromises.map((p) => {
114
- return Template["default"].getFunctionContent(promiseFactory(p))
115
- });
116
- }
117
-
118
-
119
-
120
- let remoteSyntax = remote;
121
- let remoteFactory = internal.parseRemoteSyntax;
122
-
123
- if(typeof remote === 'function' || remote.startsWith('function') || remote.startsWith('(')) {
124
- remoteSyntax = Template["default"].getFunctionContent(promiseFactory(remote));
125
- remoteFactory = (remoteSyntax) => {
126
- return Template["default"].asString([
127
- `${remoteSyntax}.then(function(urlAndGlobal) {`,
128
- Template["default"].indent([
129
- Template["default"].getFunctionContent(remoteTemplate)
130
- ]),
131
- '})'
132
- ])
133
- };
134
- }
135
-
136
-
137
- const allPromises = [
138
- remoteFactory(remoteSyntax),
139
- ...promises
140
- ].join(',\n');
141
-
142
-
143
- return Template["default"].asString([
144
- 'promise new Promise(function(resolve, reject) {',
145
- transformInput(Template["default"].indent([
146
- 'Promise.all([',
147
- Template["default"].indent(allPromises),
148
- ']).then(function(promises) {',
149
- Template["default"].indent([
150
- 'resolve(promises[0]);',
151
- ]),
152
- '})',
153
- ])),
154
- '})',
155
- ])
156
- };
157
-
158
- // remotes: {
159
- // shop: promiseTemplate('global@url', (resolve,reject) => {}),
160
- // shop: promiseTemplate(
161
- // // can also be a string if it needs to be computed in scope
162
- // `(resolve, reject) => {
163
- // resolve("${remotes.shop}");
164
- // }`,
165
- // (resolve,reject)=>{
166
- // console.log('runing other promise');
167
- // setTimeout(() => {
168
- // console.log('resolving promise');
169
- // resolve();
170
- // } , 1000);
171
- // }),
172
- // checkout: remotes.checkout,
173
- // },
174
-
175
- exports.promiseFactory = promiseFactory;
176
- exports.promiseTemplate = promiseTemplate;
@@ -1 +0,0 @@
1
- {"version":3,"file":"CombinedPages.d.ts","sourceRoot":"","sources":["../../src/client/CombinedPages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,qBAAa,aAAa;IACxB,gFAAgF;IAChF,OAAO,CAAC,eAAe,CAAW;IAElC,iEAAiE;IACjE,OAAO,CAAC,eAAe,CAAW;IAClC,0EAA0E;IAC1E,OAAO,CAAC,gBAAgB,CAAW;IACnC,kEAAkE;IAClE,OAAO,CAAC,gBAAgB,CAA0B;IAClD,8BAA8B;IAC9B,OAAO,CAAC,WAAW,CAAc;gBAG/B,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,EACzC,WAAW,EAAE,WAAW;IAM1B;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM;IAKhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAavC"}
@@ -1,60 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _tslib = require('../_virtual/_tslib.js');
6
- var helpers = require('./helpers.js');
7
-
8
- /**
9
- * Class which provides combined sorted list of local and remote routes.
10
- */
11
- var CombinedPages = /** @class */ (function () {
12
- function CombinedPages(localPagesGetter, remotePages) {
13
- this.localPagesGetter = localPagesGetter;
14
- this.remotePages = remotePages;
15
- }
16
- /**
17
- * Check that provided route belongs to host application
18
- */
19
- CombinedPages.prototype.isLocalRoute = function (route) {
20
- return _tslib.__awaiter(this, void 0, void 0, function () {
21
- var localPages;
22
- return _tslib.__generator(this, function (_a) {
23
- switch (_a.label) {
24
- case 0: return [4 /*yield*/, this.localPagesGetter()];
25
- case 1:
26
- localPages = _a.sent();
27
- return [2 /*return*/, localPages.includes(route)];
28
- }
29
- });
30
- });
31
- };
32
- /**
33
- * Return sorted list of local & remotes routes.
34
- * This method is used in patchNextClientPageLoader
35
- * for patching nextjs' getPageList method.
36
- */
37
- CombinedPages.prototype.getPageList = function () {
38
- return _tslib.__awaiter(this, void 0, void 0, function () {
39
- var localPages, remotePages;
40
- return _tslib.__generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0: return [4 /*yield*/, this.localPagesGetter()];
43
- case 1:
44
- localPages = _a.sent();
45
- remotePages = this.remotePages.getPageList();
46
- if (localPages !== this.localPagesCache ||
47
- remotePages !== this.remotePagesCache) {
48
- this.localPagesCache = localPages;
49
- this.remotePagesCache = remotePages;
50
- this.sortedPageCache = helpers.sortNextPages(_tslib.__spreadArray(_tslib.__spreadArray([], _tslib.__read(localPages), false), _tslib.__read(remotePages), false));
51
- }
52
- return [2 /*return*/, this.sortedPageCache];
53
- }
54
- });
55
- });
56
- };
57
- return CombinedPages;
58
- }());
59
-
60
- exports.CombinedPages = CombinedPages;
@@ -1 +0,0 @@
1
- {"version":3,"file":"MFClient.d.ts","sourceRoot":"","sources":["../../src/client/MFClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,aAAK,UAAU,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAE3D,+FAA+F;AAC/F,oBAAY,YAAY,GAAG,MAAM,CAAC;AAElC,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,YAAY,GAAG,aAAa,CAAC;CACpC,CAAC;AAEF;;;GAGG;AACH,qBAAa,QAAQ;IACnB,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,CAAM;IACpD,mDAAmD;IACnD,aAAa,EAAE,aAAa,CAAC;IAC7B,0BAA0B;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,iEAAiE;IACjE,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACjC,gFAAgF;IAChF,OAAO,CAAC,eAAe,CAAa;gBAExB,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe;IAuB7D;;;;;;OAMG;IACG,WAAW;IAIjB;;;;;;;OAOG;IACH,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAInD;;;;;OAKG;IACH,cAAc,CAAC,SAAS,EAAE,YAAY;IAMtC;;;;;;;OAOG;IACG,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKzE;;;OAGG;IACH,OAAO,CAAC,cAAc;IAyCtB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CA4D5B"}