@module-federation/sdk 0.6.10 → 0.6.11

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
@@ -261,6 +261,11 @@ function safeToString(info) {
261
261
  return '';
262
262
  }
263
263
  }
264
+ // RegExp for version string
265
+ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
266
+ function isRequiredVersion(str) {
267
+ return VERSION_PATTERN_REGEXP.test(str);
268
+ }
264
269
 
265
270
  const simpleJoinRemoteEntry = (rPath, rName)=>{
266
271
  if (!rPath) {
@@ -438,7 +443,6 @@ function createScript(info) {
438
443
  const attrs = info.attrs;
439
444
  script = document.createElement('script');
440
445
  script.type = (attrs == null ? void 0 : attrs['type']) === 'module' ? 'module' : 'text/javascript';
441
- script.src = info.url;
442
446
  let createScriptRes = undefined;
443
447
  if (info.createScriptHook) {
444
448
  createScriptRes = info.createScriptHook(info.url, info.attrs);
@@ -453,6 +457,9 @@ function createScript(info) {
453
457
  }
454
458
  }
455
459
  }
460
+ if (!script.src) {
461
+ script.src = info.url;
462
+ }
456
463
  if (attrs && !createScriptRes) {
457
464
  Object.keys(attrs).forEach((name)=>{
458
465
  if (script) {
@@ -783,6 +790,7 @@ exports.inferAutoPublicPath = inferAutoPublicPath;
783
790
  exports.isBrowserEnv = isBrowserEnv;
784
791
  exports.isDebugMode = isDebugMode;
785
792
  exports.isManifestProvider = isManifestProvider;
793
+ exports.isRequiredVersion = isRequiredVersion;
786
794
  exports.isStaticResourcesEqual = isStaticResourcesEqual;
787
795
  exports.loadScript = loadScript;
788
796
  exports.loadScriptNode = loadScriptNode;
package/dist/index.esm.js CHANGED
@@ -259,6 +259,11 @@ function safeToString(info) {
259
259
  return '';
260
260
  }
261
261
  }
262
+ // RegExp for version string
263
+ const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
264
+ function isRequiredVersion(str) {
265
+ return VERSION_PATTERN_REGEXP.test(str);
266
+ }
262
267
 
263
268
  const simpleJoinRemoteEntry = (rPath, rName)=>{
264
269
  if (!rPath) {
@@ -436,7 +441,6 @@ function createScript(info) {
436
441
  const attrs = info.attrs;
437
442
  script = document.createElement('script');
438
443
  script.type = (attrs == null ? void 0 : attrs['type']) === 'module' ? 'module' : 'text/javascript';
439
- script.src = info.url;
440
444
  let createScriptRes = undefined;
441
445
  if (info.createScriptHook) {
442
446
  createScriptRes = info.createScriptHook(info.url, info.attrs);
@@ -451,6 +455,9 @@ function createScript(info) {
451
455
  }
452
456
  }
453
457
  }
458
+ if (!script.src) {
459
+ script.src = info.url;
460
+ }
454
461
  if (attrs && !createScriptRes) {
455
462
  Object.keys(attrs).forEach((name)=>{
456
463
  if (script) {
@@ -746,4 +753,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
746
753
  };
747
754
  }
748
755
 
749
- export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, 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 };
756
+ export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, 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, isRequiredVersion, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeToString, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
@@ -15,4 +15,5 @@ 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
17
  declare function safeToString(info: any): string;
18
- export { parseEntry, logger, decodeName, encodeName, composeKeyWithSeparator, generateExposeFilename, generateShareFilename, getResourceUrl, assert, error, warn, safeToString, };
18
+ declare function isRequiredVersion(str: string): boolean;
19
+ export { parseEntry, logger, decodeName, encodeName, composeKeyWithSeparator, generateExposeFilename, generateShareFilename, getResourceUrl, assert, error, warn, safeToString, isRequiredVersion, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [