@module-federation/sdk 0.0.0-next-20240824225724 → 0.0.0-next-20240826075118
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 +23 -15
- package/dist/index.esm.js +24 -15
- package/dist/package.json +1 -1
- package/dist/src/types/plugins/ModuleFederationPlugin.d.ts +0 -1
- package/dist/src/utils.d.ts +1 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _extends = require('@swc/helpers/_/_extends');
|
|
6
|
-
|
|
7
5
|
const FederationModuleManifest = 'federation-manifest.json';
|
|
8
6
|
const MANIFEST_EXT = '.json';
|
|
9
7
|
const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';
|
|
@@ -63,6 +61,13 @@ const getProcessEnv = function() {
|
|
|
63
61
|
return typeof process !== 'undefined' && process.env ? process.env : {};
|
|
64
62
|
};
|
|
65
63
|
|
|
64
|
+
function safeToString(info) {
|
|
65
|
+
try {
|
|
66
|
+
return JSON.stringify(info, null, 2);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
66
71
|
const DEBUG_LOG = '[ FEDERATION DEBUG ]';
|
|
67
72
|
function safeGetLocalStorageItem() {
|
|
68
73
|
try {
|
|
@@ -242,12 +247,16 @@ const error = (msg)=>{
|
|
|
242
247
|
const warn = (msg)=>{
|
|
243
248
|
console.warn(`${LOG_CATEGORY}: ${msg}`);
|
|
244
249
|
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
|
|
251
|
+
function _extends() {
|
|
252
|
+
_extends = Object.assign || function assign(target) {
|
|
253
|
+
for(var i = 1; i < arguments.length; i++){
|
|
254
|
+
var source = arguments[i];
|
|
255
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
256
|
+
}
|
|
257
|
+
return target;
|
|
258
|
+
};
|
|
259
|
+
return _extends.apply(this, arguments);
|
|
251
260
|
}
|
|
252
261
|
|
|
253
262
|
const simpleJoinRemoteEntry = (rPath, rName)=>{
|
|
@@ -353,23 +362,23 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
353
362
|
};
|
|
354
363
|
if ((_manifest_metaData = manifest.metaData) == null ? void 0 : _manifest_metaData.prefetchInterface) {
|
|
355
364
|
const prefetchInterface = manifest.metaData.prefetchInterface;
|
|
356
|
-
basicRemoteSnapshot = _extends
|
|
365
|
+
basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
357
366
|
prefetchInterface
|
|
358
367
|
});
|
|
359
368
|
}
|
|
360
369
|
if ((_manifest_metaData1 = manifest.metaData) == null ? void 0 : _manifest_metaData1.prefetchEntry) {
|
|
361
370
|
const { path, name, type } = manifest.metaData.prefetchEntry;
|
|
362
|
-
basicRemoteSnapshot = _extends
|
|
371
|
+
basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
363
372
|
prefetchEntry: simpleJoinRemoteEntry(path, name),
|
|
364
373
|
prefetchEntryType: type
|
|
365
374
|
});
|
|
366
375
|
}
|
|
367
376
|
if ('publicPath' in manifest.metaData) {
|
|
368
|
-
remoteSnapshot = _extends
|
|
377
|
+
remoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
369
378
|
publicPath: getPublicPath()
|
|
370
379
|
});
|
|
371
380
|
} else {
|
|
372
|
-
remoteSnapshot = _extends
|
|
381
|
+
remoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
373
382
|
getPublicPath: getPublicPath()
|
|
374
383
|
});
|
|
375
384
|
}
|
|
@@ -557,7 +566,7 @@ function loadScript(url, info) {
|
|
|
557
566
|
const { script, needAttach } = createScript({
|
|
558
567
|
url,
|
|
559
568
|
cb: resolve,
|
|
560
|
-
attrs: _extends
|
|
569
|
+
attrs: _extends({
|
|
561
570
|
fetchpriority: 'high'
|
|
562
571
|
}, attrs),
|
|
563
572
|
createScriptHook,
|
|
@@ -693,7 +702,7 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
693
702
|
return defaultOptions;
|
|
694
703
|
}
|
|
695
704
|
if (options && typeof options === 'object') {
|
|
696
|
-
return _extends
|
|
705
|
+
return _extends({}, defaultOptions, options);
|
|
697
706
|
}
|
|
698
707
|
throw new Error(`Unexpected type for \`${key}\`, expect boolean/undefined/object, got: ${typeof options}`);
|
|
699
708
|
};
|
|
@@ -740,7 +749,6 @@ exports.logger = logger;
|
|
|
740
749
|
exports.moduleFederationPlugin = ModuleFederationPlugin;
|
|
741
750
|
exports.normalizeOptions = normalizeOptions;
|
|
742
751
|
exports.parseEntry = parseEntry;
|
|
743
|
-
exports.safeToString = safeToString;
|
|
744
752
|
exports.safeWrapper = safeWrapper;
|
|
745
753
|
exports.sharePlugin = SharePlugin;
|
|
746
754
|
exports.simpleJoinRemoteEntry = simpleJoinRemoteEntry;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ } from '@swc/helpers/_/_extends';
|
|
2
|
-
|
|
3
1
|
const FederationModuleManifest = 'federation-manifest.json';
|
|
4
2
|
const MANIFEST_EXT = '.json';
|
|
5
3
|
const BROWSER_LOG_KEY = 'FEDERATION_DEBUG';
|
|
@@ -59,6 +57,13 @@ const getProcessEnv = function() {
|
|
|
59
57
|
return typeof process !== 'undefined' && process.env ? process.env : {};
|
|
60
58
|
};
|
|
61
59
|
|
|
60
|
+
function safeToString(info) {
|
|
61
|
+
try {
|
|
62
|
+
return JSON.stringify(info, null, 2);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
62
67
|
const DEBUG_LOG = '[ FEDERATION DEBUG ]';
|
|
63
68
|
function safeGetLocalStorageItem() {
|
|
64
69
|
try {
|
|
@@ -238,12 +243,16 @@ const error = (msg)=>{
|
|
|
238
243
|
const warn = (msg)=>{
|
|
239
244
|
console.warn(`${LOG_CATEGORY}: ${msg}`);
|
|
240
245
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
|
|
247
|
+
function _extends() {
|
|
248
|
+
_extends = Object.assign || function assign(target) {
|
|
249
|
+
for(var i = 1; i < arguments.length; i++){
|
|
250
|
+
var source = arguments[i];
|
|
251
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
252
|
+
}
|
|
253
|
+
return target;
|
|
254
|
+
};
|
|
255
|
+
return _extends.apply(this, arguments);
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
const simpleJoinRemoteEntry = (rPath, rName)=>{
|
|
@@ -349,23 +358,23 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
349
358
|
};
|
|
350
359
|
if ((_manifest_metaData = manifest.metaData) == null ? void 0 : _manifest_metaData.prefetchInterface) {
|
|
351
360
|
const prefetchInterface = manifest.metaData.prefetchInterface;
|
|
352
|
-
basicRemoteSnapshot =
|
|
361
|
+
basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
353
362
|
prefetchInterface
|
|
354
363
|
});
|
|
355
364
|
}
|
|
356
365
|
if ((_manifest_metaData1 = manifest.metaData) == null ? void 0 : _manifest_metaData1.prefetchEntry) {
|
|
357
366
|
const { path, name, type } = manifest.metaData.prefetchEntry;
|
|
358
|
-
basicRemoteSnapshot =
|
|
367
|
+
basicRemoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
359
368
|
prefetchEntry: simpleJoinRemoteEntry(path, name),
|
|
360
369
|
prefetchEntryType: type
|
|
361
370
|
});
|
|
362
371
|
}
|
|
363
372
|
if ('publicPath' in manifest.metaData) {
|
|
364
|
-
remoteSnapshot =
|
|
373
|
+
remoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
365
374
|
publicPath: getPublicPath()
|
|
366
375
|
});
|
|
367
376
|
} else {
|
|
368
|
-
remoteSnapshot =
|
|
377
|
+
remoteSnapshot = _extends({}, basicRemoteSnapshot, {
|
|
369
378
|
getPublicPath: getPublicPath()
|
|
370
379
|
});
|
|
371
380
|
}
|
|
@@ -553,7 +562,7 @@ function loadScript(url, info) {
|
|
|
553
562
|
const { script, needAttach } = createScript({
|
|
554
563
|
url,
|
|
555
564
|
cb: resolve,
|
|
556
|
-
attrs:
|
|
565
|
+
attrs: _extends({
|
|
557
566
|
fetchpriority: 'high'
|
|
558
567
|
}, attrs),
|
|
559
568
|
createScriptHook,
|
|
@@ -689,10 +698,10 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
689
698
|
return defaultOptions;
|
|
690
699
|
}
|
|
691
700
|
if (options && typeof options === 'object') {
|
|
692
|
-
return
|
|
701
|
+
return _extends({}, defaultOptions, options);
|
|
693
702
|
}
|
|
694
703
|
throw new Error(`Unexpected type for \`${key}\`, expect boolean/undefined/object, got: ${typeof options}`);
|
|
695
704
|
};
|
|
696
705
|
}
|
|
697
706
|
|
|
698
|
-
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, inferAutoPublicPath, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry,
|
|
707
|
+
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, inferAutoPublicPath, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
|
package/dist/package.json
CHANGED
|
@@ -174,7 +174,6 @@ export interface ModuleFederationPluginOptions {
|
|
|
174
174
|
dev?: boolean | PluginDevOptions;
|
|
175
175
|
dts?: boolean | PluginDtsOptions;
|
|
176
176
|
async?: boolean | AsyncBoundaryOptions;
|
|
177
|
-
embedRuntime?: boolean;
|
|
178
177
|
}
|
|
179
178
|
/**
|
|
180
179
|
* Modules that should be exposed by this container. Property names are used as public paths.
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -14,5 +14,4 @@ declare const getResourceUrl: (module: ModuleInfo, sourceUrl: string) => string;
|
|
|
14
14
|
declare const assert: (condition: any, msg: string) => asserts condition;
|
|
15
15
|
declare const error: (msg: string | Error | unknown) => never;
|
|
16
16
|
declare const warn: (msg: Parameters<typeof console.warn>[0]) => void;
|
|
17
|
-
|
|
18
|
-
export { parseEntry, logger, decodeName, encodeName, composeKeyWithSeparator, generateExposeFilename, generateShareFilename, getResourceUrl, assert, error, warn, safeToString, };
|
|
17
|
+
export { parseEntry, logger, decodeName, encodeName, composeKeyWithSeparator, generateExposeFilename, generateShareFilename, getResourceUrl, assert, error, warn, };
|