@module-federation/sdk 0.0.0-next-20240822101913 → 0.0.0-next-20240824225724

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