@module-federation/webpack-bundler-runtime 0.0.0-next-20240521125425 → 0.0.0-next-20240523085338

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.
@@ -2,29 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _define_property(obj, key, value) {
6
- if (key in obj) {
7
- Object.defineProperty(obj, key, {
8
- value: value,
9
- enumerable: true,
10
- configurable: true,
11
- writable: true
12
- });
13
- } else {
14
- obj[key] = value;
15
- }
16
- return obj;
17
- }
18
5
  var ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
19
- // TODO: support rspack
20
- var FEDERATION_SUPPORTED_TYPES_CJS = 'cjs:webpack';
21
- var FEDERATION_SUPPORTED_TYPES_CJS_MAP = _define_property({}, FEDERATION_SUPPORTED_TYPES_CJS, 'commonjs-module');
22
6
  var FEDERATION_SUPPORTED_TYPES = [
23
- 'script',
24
- FEDERATION_SUPPORTED_TYPES_CJS
7
+ 'script'
25
8
  ];
26
9
 
27
10
  exports.ENCODE_NAME_PREFIX = ENCODE_NAME_PREFIX;
28
11
  exports.FEDERATION_SUPPORTED_TYPES = FEDERATION_SUPPORTED_TYPES;
29
- exports.FEDERATION_SUPPORTED_TYPES_CJS = FEDERATION_SUPPORTED_TYPES_CJS;
30
- exports.FEDERATION_SUPPORTED_TYPES_CJS_MAP = FEDERATION_SUPPORTED_TYPES_CJS_MAP;
@@ -1,23 +1,6 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
1
  var ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
15
- // TODO: support rspack
16
- var FEDERATION_SUPPORTED_TYPES_CJS = 'cjs:webpack';
17
- var FEDERATION_SUPPORTED_TYPES_CJS_MAP = _define_property({}, FEDERATION_SUPPORTED_TYPES_CJS, 'commonjs-module');
18
2
  var FEDERATION_SUPPORTED_TYPES = [
19
- 'script',
20
- FEDERATION_SUPPORTED_TYPES_CJS
3
+ 'script'
21
4
  ];
22
5
 
23
- export { ENCODE_NAME_PREFIX, FEDERATION_SUPPORTED_TYPES, FEDERATION_SUPPORTED_TYPES_CJS, FEDERATION_SUPPORTED_TYPES_CJS_MAP };
6
+ export { ENCODE_NAME_PREFIX, FEDERATION_SUPPORTED_TYPES };
@@ -0,0 +1 @@
1
+ export * from "./src/container";
@@ -0,0 +1,359 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = require('./index.cjs.js');
6
+ require('@module-federation/runtime');
7
+ require('@module-federation/sdk');
8
+ require('./constant.cjs.js');
9
+
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
+ try {
12
+ var info = gen[key](arg);
13
+ var value = info.value;
14
+ } catch (error) {
15
+ reject(error);
16
+ return;
17
+ }
18
+ if (info.done) {
19
+ resolve(value);
20
+ } else {
21
+ Promise.resolve(value).then(_next, _throw);
22
+ }
23
+ }
24
+ function _async_to_generator(fn) {
25
+ return function() {
26
+ var self = this, args = arguments;
27
+ return new Promise(function(resolve, reject) {
28
+ var gen = fn.apply(self, args);
29
+ function _next(value) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
+ }
32
+ function _throw(err) {
33
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
+ }
35
+ _next(undefined);
36
+ });
37
+ };
38
+ }
39
+ function _ts_generator(thisArg, body) {
40
+ var f, y, t, g, _ = {
41
+ label: 0,
42
+ sent: function() {
43
+ if (t[0] & 1) throw t[1];
44
+ return t[1];
45
+ },
46
+ trys: [],
47
+ ops: []
48
+ };
49
+ return g = {
50
+ next: verb(0),
51
+ "throw": verb(1),
52
+ "return": verb(2)
53
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
54
+ return this;
55
+ }), g;
56
+ function verb(n) {
57
+ return function(v) {
58
+ return step([
59
+ n,
60
+ v
61
+ ]);
62
+ };
63
+ }
64
+ function step(op) {
65
+ if (f) throw new TypeError("Generator is already executing.");
66
+ while(_)try {
67
+ 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;
68
+ if (y = 0, t) op = [
69
+ op[0] & 2,
70
+ t.value
71
+ ];
72
+ switch(op[0]){
73
+ case 0:
74
+ case 1:
75
+ t = op;
76
+ break;
77
+ case 4:
78
+ _.label++;
79
+ return {
80
+ value: op[1],
81
+ done: false
82
+ };
83
+ case 5:
84
+ _.label++;
85
+ y = op[1];
86
+ op = [
87
+ 0
88
+ ];
89
+ continue;
90
+ case 7:
91
+ op = _.ops.pop();
92
+ _.trys.pop();
93
+ continue;
94
+ default:
95
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
96
+ _ = 0;
97
+ continue;
98
+ }
99
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
100
+ _.label = op[1];
101
+ break;
102
+ }
103
+ if (op[0] === 6 && _.label < t[1]) {
104
+ _.label = t[1];
105
+ t = op;
106
+ break;
107
+ }
108
+ if (t && _.label < t[2]) {
109
+ _.label = t[2];
110
+ _.ops.push(op);
111
+ break;
112
+ }
113
+ if (t[2]) _.ops.pop();
114
+ _.trys.pop();
115
+ continue;
116
+ }
117
+ op = body.call(thisArg, _);
118
+ } catch (e) {
119
+ op = [
120
+ 6,
121
+ e
122
+ ];
123
+ y = 0;
124
+ } finally{
125
+ f = t = 0;
126
+ }
127
+ if (op[0] & 5) throw op[1];
128
+ return {
129
+ value: op[0] ? op[1] : void 0,
130
+ done: true
131
+ };
132
+ }
133
+ }
134
+ var _this = undefined;
135
+ var createContainer = function(federationOptions) {
136
+ var exposes = federationOptions.exposes, name = federationOptions.name, _federationOptions_remotes = federationOptions.remotes, remotes = _federationOptions_remotes === void 0 ? [] : _federationOptions_remotes, shared = federationOptions.shared, plugins = federationOptions.plugins;
137
+ var __webpack_modules__ = {
138
+ './node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js': function(//@ts-ignore
139
+ module, //@ts-ignore
140
+ __webpack_exports__, //@ts-ignore
141
+ __webpack_require__) {
142
+ __webpack_require__.r(__webpack_exports__);
143
+ var bundler_runtime = __webpack_require__.n(index);
144
+ var prevFederation = __webpack_require__.federation;
145
+ __webpack_require__.federation = {};
146
+ for(var key in bundler_runtime()){
147
+ __webpack_require__.federation[key] = bundler_runtime()[key];
148
+ }
149
+ for(var key1 in prevFederation){
150
+ __webpack_require__.federation[key1] = prevFederation[key1];
151
+ }
152
+ if (!__webpack_require__.federation.instance) {
153
+ var pluginsToAdd = plugins || [];
154
+ __webpack_require__.federation.initOptions.plugins = __webpack_require__.federation.initOptions.plugins ? __webpack_require__.federation.initOptions.plugins.concat(pluginsToAdd) : pluginsToAdd;
155
+ __webpack_require__.federation.instance = __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);
156
+ if (__webpack_require__.federation.attachShareScopeMap) {
157
+ __webpack_require__.federation.attachShareScopeMap(__webpack_require__);
158
+ }
159
+ if (__webpack_require__.federation.installInitialConsumes) {
160
+ __webpack_require__.federation.installInitialConsumes();
161
+ }
162
+ }
163
+ },
164
+ //@ts-ignore
165
+ 'webpack/container/entry/createContainer': function(//@ts-ignore
166
+ module, //@ts-ignore
167
+ exports, //@ts-ignore
168
+ __webpack_require__) {
169
+ var _loop = function(key) {
170
+ if (Object.prototype.hasOwnProperty.call(exposes, key)) {
171
+ //@ts-ignore
172
+ moduleMap[key] = function() {
173
+ return Promise.resolve(exposes[key]()).then(function(m) {
174
+ return function() {
175
+ return m;
176
+ };
177
+ });
178
+ };
179
+ }
180
+ };
181
+ var moduleMap = {};
182
+ for(var key in exposes)_loop(key);
183
+ //@ts-ignore
184
+ var get = function(module, getScope) {
185
+ __webpack_require__.R = getScope;
186
+ getScope = __webpack_require__.o(moduleMap, module) ? moduleMap[module]() : Promise.resolve().then(function() {
187
+ throw new Error('Module "'.concat(module, '" does not exist in container.'));
188
+ });
189
+ __webpack_require__.R = undefined;
190
+ return getScope;
191
+ };
192
+ //@ts-ignore
193
+ var init = function(shareScope, initScope, remoteEntryInitOptions) {
194
+ return __webpack_require__.federation.bundlerRuntime.initContainerEntry({
195
+ webpackRequire: __webpack_require__,
196
+ shareScope: shareScope,
197
+ initScope: initScope,
198
+ remoteEntryInitOptions: remoteEntryInitOptions,
199
+ shareScopeKey: 'default'
200
+ });
201
+ };
202
+ __webpack_require__('./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js');
203
+ // This exports getters to disallow modifications
204
+ __webpack_require__.d(exports, {
205
+ get: function() {
206
+ return get;
207
+ },
208
+ init: function() {
209
+ return init;
210
+ },
211
+ moduleMap: function() {
212
+ return moduleMap;
213
+ }
214
+ });
215
+ }
216
+ };
217
+ var __webpack_module_cache__ = {};
218
+ //@ts-ignore
219
+ var __webpack_require__ = function(moduleId) {
220
+ //@ts-ignore
221
+ var cachedModule = __webpack_module_cache__[moduleId];
222
+ if (cachedModule !== undefined) {
223
+ return cachedModule.exports;
224
+ }
225
+ //@ts-ignore
226
+ var module = __webpack_module_cache__[moduleId] = {
227
+ id: moduleId,
228
+ loaded: false,
229
+ exports: {}
230
+ };
231
+ var execOptions = {
232
+ id: moduleId,
233
+ module: module,
234
+ //@ts-ignore
235
+ factory: __webpack_modules__[moduleId],
236
+ require: __webpack_require__
237
+ };
238
+ __webpack_require__.i.forEach(function(handler) {
239
+ handler(execOptions);
240
+ });
241
+ module = execOptions.module;
242
+ execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
243
+ module.loaded = true;
244
+ return module.exports;
245
+ };
246
+ __webpack_require__.m = __webpack_modules__;
247
+ __webpack_require__.c = __webpack_module_cache__;
248
+ //@ts-ignore
249
+ __webpack_require__.i = [];
250
+ //@ts-ignore
251
+ if (!__webpack_require__.federation) {
252
+ __webpack_require__.federation = {
253
+ initOptions: {
254
+ name: name,
255
+ //@ts-ignore
256
+ remotes: remotes.map(function(remote) {
257
+ return {
258
+ type: remote.type,
259
+ alias: remote.alias,
260
+ name: remote.name,
261
+ //@ts-ignore
262
+ entry: remote.entry,
263
+ shareScope: remote.shareScope || 'default'
264
+ };
265
+ })
266
+ },
267
+ chunkMatcher: function() {
268
+ return true;
269
+ },
270
+ rootOutputDir: '',
271
+ initialConsumes: undefined,
272
+ bundlerRuntimeOptions: {}
273
+ };
274
+ }
275
+ //@ts-ignore
276
+ __webpack_require__.n = function(module) {
277
+ var getter = module && module.__esModule ? function() {
278
+ return module['default'];
279
+ } : function() {
280
+ return module;
281
+ };
282
+ __webpack_require__.d(getter, {
283
+ a: getter
284
+ });
285
+ return getter;
286
+ };
287
+ //@ts-ignore
288
+ __webpack_require__.d = function(exports, definition) {
289
+ for(var key in definition){
290
+ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
291
+ Object.defineProperty(exports, key, {
292
+ enumerable: true,
293
+ get: definition[key]
294
+ });
295
+ }
296
+ }
297
+ };
298
+ __webpack_require__.f = {};
299
+ __webpack_require__.g = function() {
300
+ if (typeof globalThis === 'object') return globalThis;
301
+ try {
302
+ return _this || new Function('return this')();
303
+ } catch (e) {
304
+ if (typeof window === 'object') return window;
305
+ }
306
+ }();
307
+ //@ts-ignore
308
+ __webpack_require__.o = function(obj, prop) {
309
+ return Object.prototype.hasOwnProperty.call(obj, prop);
310
+ };
311
+ //@ts-ignore
312
+ __webpack_require__.r = function(exports) {
313
+ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
314
+ Object.defineProperty(exports, Symbol.toStringTag, {
315
+ value: 'Module'
316
+ });
317
+ }
318
+ Object.defineProperty(exports, '__esModule', {
319
+ value: true
320
+ });
321
+ };
322
+ //@ts-ignore
323
+ __webpack_require__.federation.initOptions.shared = shared;
324
+ __webpack_require__.S = {};
325
+ var initPromises = {};
326
+ var initTokens = {};
327
+ //@ts-ignore
328
+ __webpack_require__.I = function(name, initScope) {
329
+ //@ts-ignore
330
+ return __webpack_require__.federation.bundlerRuntime.I({
331
+ shareScopeName: name,
332
+ webpackRequire: __webpack_require__,
333
+ initPromises: initPromises,
334
+ initTokens: initTokens,
335
+ initScope: initScope
336
+ });
337
+ };
338
+ var __webpack_exports__ = __webpack_require__('webpack/container/entry/createContainer');
339
+ __webpack_exports__.get;
340
+ __webpack_exports__.init;
341
+ return __webpack_exports__;
342
+ };
343
+ var createContainerAsync = function() {
344
+ var _ref = _async_to_generator(function(federationOptions) {
345
+ return _ts_generator(this, function(_state) {
346
+ // todo: consider async startup options here, for "async boundary" provision.
347
+ return [
348
+ 2,
349
+ createContainer(federationOptions)
350
+ ];
351
+ });
352
+ });
353
+ return function createContainerAsync(federationOptions) {
354
+ return _ref.apply(this, arguments);
355
+ };
356
+ }();
357
+
358
+ exports.createContainer = createContainer;
359
+ exports.createContainerAsync = createContainerAsync;
@@ -0,0 +1,354 @@
1
+ import federation from './index.esm.js';
2
+ import '@module-federation/runtime';
3
+ import '@module-federation/sdk';
4
+ import './constant.esm.js';
5
+
6
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
7
+ try {
8
+ var info = gen[key](arg);
9
+ var value = info.value;
10
+ } catch (error) {
11
+ reject(error);
12
+ return;
13
+ }
14
+ if (info.done) {
15
+ resolve(value);
16
+ } else {
17
+ Promise.resolve(value).then(_next, _throw);
18
+ }
19
+ }
20
+ function _async_to_generator(fn) {
21
+ return function() {
22
+ var self = this, args = arguments;
23
+ return new Promise(function(resolve, reject) {
24
+ var gen = fn.apply(self, args);
25
+ function _next(value) {
26
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
27
+ }
28
+ function _throw(err) {
29
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
30
+ }
31
+ _next(undefined);
32
+ });
33
+ };
34
+ }
35
+ function _ts_generator(thisArg, body) {
36
+ var f, y, t, g, _ = {
37
+ label: 0,
38
+ sent: function() {
39
+ if (t[0] & 1) throw t[1];
40
+ return t[1];
41
+ },
42
+ trys: [],
43
+ ops: []
44
+ };
45
+ return g = {
46
+ next: verb(0),
47
+ "throw": verb(1),
48
+ "return": verb(2)
49
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
50
+ return this;
51
+ }), g;
52
+ function verb(n) {
53
+ return function(v) {
54
+ return step([
55
+ n,
56
+ v
57
+ ]);
58
+ };
59
+ }
60
+ function step(op) {
61
+ if (f) throw new TypeError("Generator is already executing.");
62
+ while(_)try {
63
+ 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;
64
+ if (y = 0, t) op = [
65
+ op[0] & 2,
66
+ t.value
67
+ ];
68
+ switch(op[0]){
69
+ case 0:
70
+ case 1:
71
+ t = op;
72
+ break;
73
+ case 4:
74
+ _.label++;
75
+ return {
76
+ value: op[1],
77
+ done: false
78
+ };
79
+ case 5:
80
+ _.label++;
81
+ y = op[1];
82
+ op = [
83
+ 0
84
+ ];
85
+ continue;
86
+ case 7:
87
+ op = _.ops.pop();
88
+ _.trys.pop();
89
+ continue;
90
+ default:
91
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
92
+ _ = 0;
93
+ continue;
94
+ }
95
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
96
+ _.label = op[1];
97
+ break;
98
+ }
99
+ if (op[0] === 6 && _.label < t[1]) {
100
+ _.label = t[1];
101
+ t = op;
102
+ break;
103
+ }
104
+ if (t && _.label < t[2]) {
105
+ _.label = t[2];
106
+ _.ops.push(op);
107
+ break;
108
+ }
109
+ if (t[2]) _.ops.pop();
110
+ _.trys.pop();
111
+ continue;
112
+ }
113
+ op = body.call(thisArg, _);
114
+ } catch (e) {
115
+ op = [
116
+ 6,
117
+ e
118
+ ];
119
+ y = 0;
120
+ } finally{
121
+ f = t = 0;
122
+ }
123
+ if (op[0] & 5) throw op[1];
124
+ return {
125
+ value: op[0] ? op[1] : void 0,
126
+ done: true
127
+ };
128
+ }
129
+ }
130
+ var _this = undefined;
131
+ var createContainer = function(federationOptions) {
132
+ var exposes = federationOptions.exposes, name = federationOptions.name, _federationOptions_remotes = federationOptions.remotes, remotes = _federationOptions_remotes === void 0 ? [] : _federationOptions_remotes, shared = federationOptions.shared, plugins = federationOptions.plugins;
133
+ var __webpack_modules__ = {
134
+ './node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js': function(//@ts-ignore
135
+ module, //@ts-ignore
136
+ __webpack_exports__, //@ts-ignore
137
+ __webpack_require__) {
138
+ __webpack_require__.r(__webpack_exports__);
139
+ var bundler_runtime = __webpack_require__.n(federation);
140
+ var prevFederation = __webpack_require__.federation;
141
+ __webpack_require__.federation = {};
142
+ for(var key in bundler_runtime()){
143
+ __webpack_require__.federation[key] = bundler_runtime()[key];
144
+ }
145
+ for(var key1 in prevFederation){
146
+ __webpack_require__.federation[key1] = prevFederation[key1];
147
+ }
148
+ if (!__webpack_require__.federation.instance) {
149
+ var pluginsToAdd = plugins || [];
150
+ __webpack_require__.federation.initOptions.plugins = __webpack_require__.federation.initOptions.plugins ? __webpack_require__.federation.initOptions.plugins.concat(pluginsToAdd) : pluginsToAdd;
151
+ __webpack_require__.federation.instance = __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);
152
+ if (__webpack_require__.federation.attachShareScopeMap) {
153
+ __webpack_require__.federation.attachShareScopeMap(__webpack_require__);
154
+ }
155
+ if (__webpack_require__.federation.installInitialConsumes) {
156
+ __webpack_require__.federation.installInitialConsumes();
157
+ }
158
+ }
159
+ },
160
+ //@ts-ignore
161
+ 'webpack/container/entry/createContainer': function(//@ts-ignore
162
+ module, //@ts-ignore
163
+ exports, //@ts-ignore
164
+ __webpack_require__) {
165
+ var _loop = function(key) {
166
+ if (Object.prototype.hasOwnProperty.call(exposes, key)) {
167
+ //@ts-ignore
168
+ moduleMap[key] = function() {
169
+ return Promise.resolve(exposes[key]()).then(function(m) {
170
+ return function() {
171
+ return m;
172
+ };
173
+ });
174
+ };
175
+ }
176
+ };
177
+ var moduleMap = {};
178
+ for(var key in exposes)_loop(key);
179
+ //@ts-ignore
180
+ var get = function(module, getScope) {
181
+ __webpack_require__.R = getScope;
182
+ getScope = __webpack_require__.o(moduleMap, module) ? moduleMap[module]() : Promise.resolve().then(function() {
183
+ throw new Error('Module "'.concat(module, '" does not exist in container.'));
184
+ });
185
+ __webpack_require__.R = undefined;
186
+ return getScope;
187
+ };
188
+ //@ts-ignore
189
+ var init = function(shareScope, initScope, remoteEntryInitOptions) {
190
+ return __webpack_require__.federation.bundlerRuntime.initContainerEntry({
191
+ webpackRequire: __webpack_require__,
192
+ shareScope: shareScope,
193
+ initScope: initScope,
194
+ remoteEntryInitOptions: remoteEntryInitOptions,
195
+ shareScopeKey: 'default'
196
+ });
197
+ };
198
+ __webpack_require__('./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js');
199
+ // This exports getters to disallow modifications
200
+ __webpack_require__.d(exports, {
201
+ get: function() {
202
+ return get;
203
+ },
204
+ init: function() {
205
+ return init;
206
+ },
207
+ moduleMap: function() {
208
+ return moduleMap;
209
+ }
210
+ });
211
+ }
212
+ };
213
+ var __webpack_module_cache__ = {};
214
+ //@ts-ignore
215
+ var __webpack_require__ = function(moduleId) {
216
+ //@ts-ignore
217
+ var cachedModule = __webpack_module_cache__[moduleId];
218
+ if (cachedModule !== undefined) {
219
+ return cachedModule.exports;
220
+ }
221
+ //@ts-ignore
222
+ var module = __webpack_module_cache__[moduleId] = {
223
+ id: moduleId,
224
+ loaded: false,
225
+ exports: {}
226
+ };
227
+ var execOptions = {
228
+ id: moduleId,
229
+ module: module,
230
+ //@ts-ignore
231
+ factory: __webpack_modules__[moduleId],
232
+ require: __webpack_require__
233
+ };
234
+ __webpack_require__.i.forEach(function(handler) {
235
+ handler(execOptions);
236
+ });
237
+ module = execOptions.module;
238
+ execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
239
+ module.loaded = true;
240
+ return module.exports;
241
+ };
242
+ __webpack_require__.m = __webpack_modules__;
243
+ __webpack_require__.c = __webpack_module_cache__;
244
+ //@ts-ignore
245
+ __webpack_require__.i = [];
246
+ //@ts-ignore
247
+ if (!__webpack_require__.federation) {
248
+ __webpack_require__.federation = {
249
+ initOptions: {
250
+ name: name,
251
+ //@ts-ignore
252
+ remotes: remotes.map(function(remote) {
253
+ return {
254
+ type: remote.type,
255
+ alias: remote.alias,
256
+ name: remote.name,
257
+ //@ts-ignore
258
+ entry: remote.entry,
259
+ shareScope: remote.shareScope || 'default'
260
+ };
261
+ })
262
+ },
263
+ chunkMatcher: function() {
264
+ return true;
265
+ },
266
+ rootOutputDir: '',
267
+ initialConsumes: undefined,
268
+ bundlerRuntimeOptions: {}
269
+ };
270
+ }
271
+ //@ts-ignore
272
+ __webpack_require__.n = function(module) {
273
+ var getter = module && module.__esModule ? function() {
274
+ return module['default'];
275
+ } : function() {
276
+ return module;
277
+ };
278
+ __webpack_require__.d(getter, {
279
+ a: getter
280
+ });
281
+ return getter;
282
+ };
283
+ //@ts-ignore
284
+ __webpack_require__.d = function(exports, definition) {
285
+ for(var key in definition){
286
+ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
287
+ Object.defineProperty(exports, key, {
288
+ enumerable: true,
289
+ get: definition[key]
290
+ });
291
+ }
292
+ }
293
+ };
294
+ __webpack_require__.f = {};
295
+ __webpack_require__.g = function() {
296
+ if (typeof globalThis === 'object') return globalThis;
297
+ try {
298
+ return _this || new Function('return this')();
299
+ } catch (e) {
300
+ if (typeof window === 'object') return window;
301
+ }
302
+ }();
303
+ //@ts-ignore
304
+ __webpack_require__.o = function(obj, prop) {
305
+ return Object.prototype.hasOwnProperty.call(obj, prop);
306
+ };
307
+ //@ts-ignore
308
+ __webpack_require__.r = function(exports) {
309
+ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
310
+ Object.defineProperty(exports, Symbol.toStringTag, {
311
+ value: 'Module'
312
+ });
313
+ }
314
+ Object.defineProperty(exports, '__esModule', {
315
+ value: true
316
+ });
317
+ };
318
+ //@ts-ignore
319
+ __webpack_require__.federation.initOptions.shared = shared;
320
+ __webpack_require__.S = {};
321
+ var initPromises = {};
322
+ var initTokens = {};
323
+ //@ts-ignore
324
+ __webpack_require__.I = function(name, initScope) {
325
+ //@ts-ignore
326
+ return __webpack_require__.federation.bundlerRuntime.I({
327
+ shareScopeName: name,
328
+ webpackRequire: __webpack_require__,
329
+ initPromises: initPromises,
330
+ initTokens: initTokens,
331
+ initScope: initScope
332
+ });
333
+ };
334
+ var __webpack_exports__ = __webpack_require__('webpack/container/entry/createContainer');
335
+ __webpack_exports__.get;
336
+ __webpack_exports__.init;
337
+ return __webpack_exports__;
338
+ };
339
+ var createContainerAsync = function() {
340
+ var _ref = _async_to_generator(function(federationOptions) {
341
+ return _ts_generator(this, function(_state) {
342
+ // todo: consider async startup options here, for "async boundary" provision.
343
+ return [
344
+ 2,
345
+ createContainer(federationOptions)
346
+ ];
347
+ });
348
+ });
349
+ return function createContainerAsync(federationOptions) {
350
+ return _ref.apply(this, arguments);
351
+ };
352
+ }();
353
+
354
+ export { createContainer, createContainerAsync };
package/dist/index.cjs.js CHANGED
@@ -109,7 +109,9 @@ function remotes(options) {
109
109
  onError(error);
110
110
  }
111
111
  };
112
- var useRuntimeLoad = remoteInfos.length === 1 && constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfos[0].externalType) && remoteInfos[0].name;
112
+ var useRuntimeLoad = remoteInfos.length === 1 && [
113
+ 'script'
114
+ ].includes(remoteInfos[0].externalType) && remoteInfos[0].name;
113
115
  if (useRuntimeLoad) {
114
116
  handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);
115
117
  } else {
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as runtime from '@module-federation/runtime';
2
2
  import { decodeName } from '@module-federation/sdk';
3
- import { FEDERATION_SUPPORTED_TYPES, ENCODE_NAME_PREFIX } from './constant.esm.js';
3
+ import { ENCODE_NAME_PREFIX, FEDERATION_SUPPORTED_TYPES } from './constant.esm.js';
4
4
 
5
5
  function attachShareScopeMap(webpackRequire) {
6
6
  if (!webpackRequire.S || webpackRequire.federation.hasAttachShareScopeMap || !webpackRequire.federation.instance || !webpackRequire.federation.instance.shareScopeMap) {
@@ -87,7 +87,9 @@ function remotes(options) {
87
87
  onError(error);
88
88
  }
89
89
  };
90
- var useRuntimeLoad = remoteInfos.length === 1 && FEDERATION_SUPPORTED_TYPES.includes(remoteInfos[0].externalType) && remoteInfos[0].name;
90
+ var useRuntimeLoad = remoteInfos.length === 1 && [
91
+ 'script'
92
+ ].includes(remoteInfos[0].externalType) && remoteInfos[0].name;
91
93
  if (useRuntimeLoad) {
92
94
  handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);
93
95
  } else {
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "@module-federation/webpack-bundler-runtime",
4
- "version": "0.1.13",
4
+ "version": "0.1.15",
5
5
  "license": "MIT",
6
6
  "description": "Module Federation Runtime for webpack",
7
7
  "keywords": [
@@ -32,6 +32,10 @@
32
32
  "import": "./dist/constant.esm.js",
33
33
  "require": "./dist/constant.cjs.js"
34
34
  },
35
+ "./container": {
36
+ "import": "./dist/container.esm.js",
37
+ "require": "./dist/container.cjs.js"
38
+ },
35
39
  "./*": "./*"
36
40
  },
37
41
  "typesVersions": {
@@ -43,5 +47,8 @@
43
47
  "./dist/constant.cjs.d.ts"
44
48
  ]
45
49
  }
50
+ },
51
+ "devDependencies": {
52
+ "@module-federation/runtime": "workspace:*"
46
53
  }
47
54
  }
@@ -1,6 +1,2 @@
1
1
  export declare const ENCODE_NAME_PREFIX = "ENCODE_NAME_PREFIX";
2
- export declare const FEDERATION_SUPPORTED_TYPES_CJS = "cjs:webpack";
3
- export declare const FEDERATION_SUPPORTED_TYPES_CJS_MAP: {
4
- "cjs:webpack": string;
5
- };
6
2
  export declare const FEDERATION_SUPPORTED_TYPES: string[];
@@ -0,0 +1,9 @@
1
+ import type { UserOptions } from '@module-federation/runtime/types';
2
+ interface ExtendedOptions extends UserOptions {
3
+ exposes: {
4
+ [key: string]: () => Promise<() => any>;
5
+ };
6
+ }
7
+ export declare const createContainer: (federationOptions: ExtendedOptions) => any;
8
+ export declare const createContainerAsync: (federationOptions: ExtendedOptions) => Promise<any>;
9
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "@module-federation/webpack-bundler-runtime",
4
- "version": "0.0.0-next-20240521125425",
4
+ "version": "0.0.0-next-20240523085338",
5
5
  "license": "MIT",
6
6
  "description": "Module Federation Runtime for webpack",
7
7
  "keywords": [
@@ -20,8 +20,8 @@
20
20
  "module": "./dist/index.esm.js",
21
21
  "types": "./dist/index.cjs.d.ts",
22
22
  "dependencies": {
23
- "@module-federation/runtime": "0.0.0-next-20240521125425",
24
- "@module-federation/sdk": "0.0.0-next-20240521125425"
23
+ "@module-federation/runtime": "0.0.0-next-20240523085338",
24
+ "@module-federation/sdk": "0.0.0-next-20240523085338"
25
25
  },
26
26
  "exports": {
27
27
  ".": {
@@ -32,6 +32,10 @@
32
32
  "import": "./dist/constant.esm.js",
33
33
  "require": "./dist/constant.cjs.js"
34
34
  },
35
+ "./container": {
36
+ "import": "./dist/container.esm.js",
37
+ "require": "./dist/container.cjs.js"
38
+ },
35
39
  "./*": "./*"
36
40
  },
37
41
  "typesVersions": {
@@ -43,5 +47,8 @@
43
47
  "./dist/constant.cjs.d.ts"
44
48
  ]
45
49
  }
50
+ },
51
+ "devDependencies": {
52
+ "@module-federation/runtime": "0.0.0-next-20240523085338"
46
53
  }
47
54
  }