@module-federation/sdk 0.0.0-next-20240508024041 → 0.0.0-next-20240511023318

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
@@ -455,6 +455,9 @@ var simpleJoinRemoteEntry = function(rPath, rName) {
455
455
  }
456
456
  return "".concat(transformedPath, "/").concat(rName);
457
457
  };
458
+ function inferAutoPublicPath(url) {
459
+ return url.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
460
+ }
458
461
  // Priority: overrides > remotes
459
462
  // eslint-disable-next-line max-lines-per-function
460
463
  function generateSnapshotFromManifest(manifest) {
@@ -464,6 +467,10 @@ function generateSnapshotFromManifest(manifest) {
464
467
  var remoteSnapshot;
465
468
  var getPublicPath = function() {
466
469
  if ("publicPath" in manifest.metaData) {
470
+ if (manifest.metaData.publicPath === "auto" && version) {
471
+ // use same implementation as publicPath auto runtime module implements
472
+ return inferAutoPublicPath(version);
473
+ }
467
474
  return manifest.metaData.publicPath;
468
475
  } else {
469
476
  return manifest.metaData.getPublicPath;
@@ -1259,6 +1266,7 @@ exports.generateShareFilename = generateShareFilename;
1259
1266
  exports.generateSnapshotFromManifest = generateSnapshotFromManifest;
1260
1267
  exports.getProcessEnv = getProcessEnv;
1261
1268
  exports.getResourceUrl = getResourceUrl;
1269
+ exports.inferAutoPublicPath = inferAutoPublicPath;
1262
1270
  exports.isBrowserEnv = isBrowserEnv;
1263
1271
  exports.isDebugMode = isDebugMode;
1264
1272
  exports.isManifestProvider = isManifestProvider;
package/dist/index.esm.js CHANGED
@@ -451,6 +451,9 @@ var simpleJoinRemoteEntry = function(rPath, rName) {
451
451
  }
452
452
  return "".concat(transformedPath, "/").concat(rName);
453
453
  };
454
+ function inferAutoPublicPath(url) {
455
+ return url.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
456
+ }
454
457
  // Priority: overrides > remotes
455
458
  // eslint-disable-next-line max-lines-per-function
456
459
  function generateSnapshotFromManifest(manifest) {
@@ -460,6 +463,10 @@ function generateSnapshotFromManifest(manifest) {
460
463
  var remoteSnapshot;
461
464
  var getPublicPath = function() {
462
465
  if ("publicPath" in manifest.metaData) {
466
+ if (manifest.metaData.publicPath === "auto" && version) {
467
+ // use same implementation as publicPath auto runtime module implements
468
+ return inferAutoPublicPath(version);
469
+ }
463
470
  return manifest.metaData.publicPath;
464
471
  } else {
465
472
  return manifest.metaData.getPublicPath;
@@ -1227,4 +1234,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
1227
1234
  };
1228
1235
  }
1229
1236
 
1230
- export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, ModuleFederationPlugin as moduleFederationPlugin, normalizeOptions, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
1237
+ export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, MFModuleType, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
@@ -5,6 +5,7 @@ interface IOptions {
5
5
  version?: string;
6
6
  }
7
7
  export declare const simpleJoinRemoteEntry: (rPath: string, rName: string) => string;
8
+ export declare function inferAutoPublicPath(url: string): string;
8
9
  export declare function generateSnapshotFromManifest(manifest: Manifest, options?: IOptions): ProviderModuleInfo;
9
10
  export declare function isManifestProvider(moduleInfo: ModuleInfo | ManifestProvider): moduleInfo is ManifestProvider;
10
11
  export {};
@@ -1,7 +1,7 @@
1
1
  export * from './constant';
2
2
  export * from './types';
3
3
  export * from './utils';
4
- export { generateSnapshotFromManifest, isManifestProvider, simpleJoinRemoteEntry, } from './generateSnapshotFromManifest';
4
+ export { generateSnapshotFromManifest, isManifestProvider, simpleJoinRemoteEntry, inferAutoPublicPath, } from './generateSnapshotFromManifest';
5
5
  export * from './logger';
6
6
  export * from './env';
7
7
  export * from './dom';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.0-next-20240508024041",
3
+ "version": "0.0.0-next-20240511023318",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [