@module-federation/utilities 3.0.5 → 3.0.7
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/dist/index.cjs.js +0 -29
- package/dist/index.esm.js +1 -29
- package/dist/package.json +4 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/types/index.d.ts +3 -2
- package/dist/src/utils/common.d.ts +0 -10
- package/package.json +4 -1
package/dist/index.cjs.js
CHANGED
|
@@ -372,34 +372,6 @@ function _ts_generator$2(thisArg, body) {
|
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Creates a module that can be shared across different builds.
|
|
377
|
-
* @param {string} delegate - The delegate string.
|
|
378
|
-
* @param {Object} params - The parameters for the module.
|
|
379
|
-
* @returns {string} - The created module.
|
|
380
|
-
* @throws Will throw an error if the params are an array or object.
|
|
381
|
-
*/ var createDelegatedModule = function(delegate, params) {
|
|
382
|
-
var queries = [];
|
|
383
|
-
var processParam = function(key, value) {
|
|
384
|
-
if (Array.isArray(value)) {
|
|
385
|
-
value.forEach(function(v, i) {
|
|
386
|
-
return processParam("".concat(key, "[").concat(i, "]"), v);
|
|
387
|
-
});
|
|
388
|
-
} else if (typeof value === "object" && value !== null) {
|
|
389
|
-
Object.entries(value).forEach(function(param) {
|
|
390
|
-
var _param = _sliced_to_array$2(param, 2), k = _param[0], v = _param[1];
|
|
391
|
-
return processParam("".concat(key, ".").concat(k), v);
|
|
392
|
-
});
|
|
393
|
-
} else {
|
|
394
|
-
queries.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
Object.entries(params).forEach(function(param) {
|
|
398
|
-
var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
|
|
399
|
-
return processParam(key, value);
|
|
400
|
-
});
|
|
401
|
-
return queries.length === 0 ? "internal ".concat(delegate) : "internal ".concat(delegate, "?").concat(queries.join("&"));
|
|
402
|
-
};
|
|
403
375
|
var createContainerSharingScope = function(asyncContainer) {
|
|
404
376
|
// @ts-ignore
|
|
405
377
|
return asyncContainer.then(function(container) {
|
|
@@ -1413,7 +1385,6 @@ var importDelegatedModule = function() {
|
|
|
1413
1385
|
}();
|
|
1414
1386
|
|
|
1415
1387
|
exports.Logger = Logger;
|
|
1416
|
-
exports.createDelegatedModule = createDelegatedModule;
|
|
1417
1388
|
exports.createRuntimeVariables = createRuntimeVariables;
|
|
1418
1389
|
exports.extractUrlAndGlobal = extractUrlAndGlobal;
|
|
1419
1390
|
exports.getContainer = getContainer;
|
package/dist/index.esm.js
CHANGED
|
@@ -350,34 +350,6 @@ function _ts_generator$2(thisArg, body) {
|
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
/**
|
|
354
|
-
* Creates a module that can be shared across different builds.
|
|
355
|
-
* @param {string} delegate - The delegate string.
|
|
356
|
-
* @param {Object} params - The parameters for the module.
|
|
357
|
-
* @returns {string} - The created module.
|
|
358
|
-
* @throws Will throw an error if the params are an array or object.
|
|
359
|
-
*/ var createDelegatedModule = function(delegate, params) {
|
|
360
|
-
var queries = [];
|
|
361
|
-
var processParam = function(key, value) {
|
|
362
|
-
if (Array.isArray(value)) {
|
|
363
|
-
value.forEach(function(v, i) {
|
|
364
|
-
return processParam("".concat(key, "[").concat(i, "]"), v);
|
|
365
|
-
});
|
|
366
|
-
} else if (typeof value === "object" && value !== null) {
|
|
367
|
-
Object.entries(value).forEach(function(param) {
|
|
368
|
-
var _param = _sliced_to_array$2(param, 2), k = _param[0], v = _param[1];
|
|
369
|
-
return processParam("".concat(key, ".").concat(k), v);
|
|
370
|
-
});
|
|
371
|
-
} else {
|
|
372
|
-
queries.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
Object.entries(params).forEach(function(param) {
|
|
376
|
-
var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
|
|
377
|
-
return processParam(key, value);
|
|
378
|
-
});
|
|
379
|
-
return queries.length === 0 ? "internal ".concat(delegate) : "internal ".concat(delegate, "?").concat(queries.join("&"));
|
|
380
|
-
};
|
|
381
353
|
var createContainerSharingScope = function(asyncContainer) {
|
|
382
354
|
// @ts-ignore
|
|
383
355
|
return asyncContainer.then(function(container) {
|
|
@@ -1390,4 +1362,4 @@ var importDelegatedModule = function() {
|
|
|
1390
1362
|
};
|
|
1391
1363
|
}();
|
|
1392
1364
|
|
|
1393
|
-
export { Logger,
|
|
1365
|
+
export { Logger, createRuntimeVariables, extractUrlAndGlobal, getContainer, getModule, getRuntimeRemotes, importDelegatedModule, importRemote, injectScript, isObjectEmpty, loadScript };
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/utilities",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"types": "./dist/index.cjs.d.ts",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"react": "18.2.0"
|
|
18
18
|
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@module-federation/sdk": "workspace:*"
|
|
21
|
+
},
|
|
19
22
|
"peerDependencies": {
|
|
20
23
|
"webpack": "^5.40.0",
|
|
21
24
|
"react-dom": "^16 || ^17 || ^18",
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
export type { ImportRemoteOptions } from './utils/importRemote';
|
|
3
3
|
export type { LoggerInstance } from './Logger';
|
|
4
|
-
export {
|
|
4
|
+
export { createRuntimeVariables, getContainer, injectScript, getModule, } from './utils/common';
|
|
5
5
|
export { isObjectEmpty } from './utils/isEmpty';
|
|
6
6
|
export { importRemote } from './utils/importRemote';
|
|
7
7
|
export { Logger } from './Logger';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="webpack/module" />
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
|
+
import type { WebpackOptionsNormalized } from 'webpack';
|
|
4
|
+
export type ModuleFederationPluginOptions = moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
4
5
|
export type WebpackRequire = {
|
|
5
6
|
l: (url: string | undefined, cb: (event: any) => void, id: string | number) => Record<string, unknown>;
|
|
6
7
|
};
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import type { GetModuleOptions, RemoteData, Remotes, RuntimeRemote, WebpackRemoteContainer } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a module that can be shared across different builds.
|
|
4
|
-
* @param {string} delegate - The delegate string.
|
|
5
|
-
* @param {Object} params - The parameters for the module.
|
|
6
|
-
* @returns {string} - The created module.
|
|
7
|
-
* @throws Will throw an error if the params are an array or object.
|
|
8
|
-
*/
|
|
9
|
-
export declare const createDelegatedModule: (delegate: string, params: {
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
}) => string;
|
|
12
2
|
/**
|
|
13
3
|
* Return initialized remote container by remote's key or its runtime remote item data.
|
|
14
4
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/utilities",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.cjs.d.ts",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"react": "18.2.0"
|
|
18
18
|
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@module-federation/sdk": "0.1.2"
|
|
21
|
+
},
|
|
19
22
|
"peerDependencies": {
|
|
20
23
|
"webpack": "^5.40.0",
|
|
21
24
|
"react-dom": "^16 || ^17 || ^18",
|