@module-federation/sdk 0.2.0 → 0.2.1

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
@@ -359,12 +359,17 @@ var generateShareFilename = function(pkgName, withExt) {
359
359
  };
360
360
  var getResourceUrl = function(module, sourceUrl) {
361
361
  if ('getPublicPath' in module) {
362
- var publicPath = new Function(module.getPublicPath)();
362
+ var publicPath;
363
+ if (!module.getPublicPath.startsWith('function')) {
364
+ publicPath = new Function(module.getPublicPath)();
365
+ } else {
366
+ publicPath = new Function('return ' + module.getPublicPath)()();
367
+ }
363
368
  return "".concat(publicPath).concat(sourceUrl);
364
369
  } else if ('publicPath' in module) {
365
370
  return "".concat(module.publicPath).concat(sourceUrl);
366
371
  } else {
367
- console.warn('Can not get resource url, if in debug mode, please ignore', module, sourceUrl);
372
+ console.warn('Cannot get resource URL. If in debug mode, please ignore.', module, sourceUrl);
368
373
  return '';
369
374
  }
370
375
  };
package/dist/index.esm.js CHANGED
@@ -355,12 +355,17 @@ var generateShareFilename = function(pkgName, withExt) {
355
355
  };
356
356
  var getResourceUrl = function(module, sourceUrl) {
357
357
  if ('getPublicPath' in module) {
358
- var publicPath = new Function(module.getPublicPath)();
358
+ var publicPath;
359
+ if (!module.getPublicPath.startsWith('function')) {
360
+ publicPath = new Function(module.getPublicPath)();
361
+ } else {
362
+ publicPath = new Function('return ' + module.getPublicPath)()();
363
+ }
359
364
  return "".concat(publicPath).concat(sourceUrl);
360
365
  } else if ('publicPath' in module) {
361
366
  return "".concat(module.publicPath).concat(sourceUrl);
362
367
  } else {
363
- console.warn('Can not get resource url, if in debug mode, please ignore', module, sourceUrl);
368
+ console.warn('Cannot get resource URL. If in debug mode, please ignore.', module, sourceUrl);
364
369
  return '';
365
370
  }
366
371
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
@@ -153,6 +153,10 @@ export interface ModuleFederationPluginOptions {
153
153
  * Runtime plugin file paths or package name.
154
154
  */
155
155
  runtimePlugins?: string[];
156
+ /**
157
+ * Custom public path function
158
+ */
159
+ getPublicPath?: string;
156
160
  /**
157
161
  * Bundler runtime path
158
162
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [