@module-federation/sdk 0.0.0-next-20240808083234 → 0.0.0-next-20240812084439

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
@@ -31,13 +31,6 @@ const MFModuleType = {
31
31
  const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
32
32
  const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
33
33
  const TEMP_DIR = '.federation';
34
- const MFPrefetchCommon = {
35
- identifier: 'MFDataPrefetch',
36
- globalKey: '__PREFETCH__',
37
- library: 'mf-data-prefetch',
38
- exportsKey: '__PREFETCH_EXPORTS__',
39
- fileName: 'bootstrap.js'
40
- };
41
34
 
42
35
  var ContainerPlugin = /*#__PURE__*/Object.freeze({
43
36
  __proto__: null
@@ -442,8 +435,9 @@ function createScript(info) {
442
435
  script = document.createElement('script');
443
436
  script.type = 'text/javascript';
444
437
  script.src = info.url;
438
+ let createScriptRes = undefined;
445
439
  if (info.createScriptHook) {
446
- const createScriptRes = info.createScriptHook(info.url, info.attrs);
440
+ createScriptRes = info.createScriptHook(info.url, info.attrs);
447
441
  if (createScriptRes instanceof HTMLScriptElement) {
448
442
  script = createScriptRes;
449
443
  } else if (typeof createScriptRes === 'object') {
@@ -452,7 +446,7 @@ function createScript(info) {
452
446
  }
453
447
  }
454
448
  const attrs = info.attrs;
455
- if (attrs) {
449
+ if (attrs && !createScriptRes) {
456
450
  Object.keys(attrs).forEach((name)=>{
457
451
  if (script) {
458
452
  if (name === 'async' || name === 'defer') {
@@ -518,14 +512,15 @@ function createLink(info) {
518
512
  if (!link) {
519
513
  link = document.createElement('link');
520
514
  link.setAttribute('href', info.url);
515
+ let createLinkRes = undefined;
521
516
  if (info.createLinkHook) {
522
- const createLinkRes = info.createLinkHook(info.url);
517
+ createLinkRes = info.createLinkHook(info.url);
523
518
  if (createLinkRes instanceof HTMLLinkElement) {
524
519
  link = createLinkRes;
525
520
  }
526
521
  }
527
522
  const attrs = info.attrs;
528
- if (attrs) {
523
+ if (attrs && !createLinkRes) {
529
524
  Object.keys(attrs).forEach((name)=>{
530
525
  if (link && !link.getAttribute(name)) {
531
526
  link.setAttribute(name, attrs[name]);
@@ -717,7 +712,6 @@ exports.FederationModuleManifest = FederationModuleManifest;
717
712
  exports.Logger = Logger;
718
713
  exports.MANIFEST_EXT = MANIFEST_EXT;
719
714
  exports.MFModuleType = MFModuleType;
720
- exports.MFPrefetchCommon = MFPrefetchCommon;
721
715
  exports.MODULE_DEVTOOL_IDENTIFIER = MODULE_DEVTOOL_IDENTIFIER;
722
716
  exports.ManifestFileName = ManifestFileName;
723
717
  exports.NameTransformMap = NameTransformMap;
package/dist/index.esm.js CHANGED
@@ -27,13 +27,6 @@ const MFModuleType = {
27
27
  const MODULE_DEVTOOL_IDENTIFIER = '__MF_DEVTOOLS_MODULE_INFO__';
28
28
  const ENCODE_NAME_PREFIX = 'ENCODE_NAME_PREFIX';
29
29
  const TEMP_DIR = '.federation';
30
- const MFPrefetchCommon = {
31
- identifier: 'MFDataPrefetch',
32
- globalKey: '__PREFETCH__',
33
- library: 'mf-data-prefetch',
34
- exportsKey: '__PREFETCH_EXPORTS__',
35
- fileName: 'bootstrap.js'
36
- };
37
30
 
38
31
  var ContainerPlugin = /*#__PURE__*/Object.freeze({
39
32
  __proto__: null
@@ -438,8 +431,9 @@ function createScript(info) {
438
431
  script = document.createElement('script');
439
432
  script.type = 'text/javascript';
440
433
  script.src = info.url;
434
+ let createScriptRes = undefined;
441
435
  if (info.createScriptHook) {
442
- const createScriptRes = info.createScriptHook(info.url, info.attrs);
436
+ createScriptRes = info.createScriptHook(info.url, info.attrs);
443
437
  if (createScriptRes instanceof HTMLScriptElement) {
444
438
  script = createScriptRes;
445
439
  } else if (typeof createScriptRes === 'object') {
@@ -448,7 +442,7 @@ function createScript(info) {
448
442
  }
449
443
  }
450
444
  const attrs = info.attrs;
451
- if (attrs) {
445
+ if (attrs && !createScriptRes) {
452
446
  Object.keys(attrs).forEach((name)=>{
453
447
  if (script) {
454
448
  if (name === 'async' || name === 'defer') {
@@ -514,14 +508,15 @@ function createLink(info) {
514
508
  if (!link) {
515
509
  link = document.createElement('link');
516
510
  link.setAttribute('href', info.url);
511
+ let createLinkRes = undefined;
517
512
  if (info.createLinkHook) {
518
- const createLinkRes = info.createLinkHook(info.url);
513
+ createLinkRes = info.createLinkHook(info.url);
519
514
  if (createLinkRes instanceof HTMLLinkElement) {
520
515
  link = createLinkRes;
521
516
  }
522
517
  }
523
518
  const attrs = info.attrs;
524
- if (attrs) {
519
+ if (attrs && !createLinkRes) {
525
520
  Object.keys(attrs).forEach((name)=>{
526
521
  if (link && !link.getAttribute(name)) {
527
522
  link.setAttribute(name, attrs[name]);
@@ -705,4 +700,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
705
700
  };
706
701
  }
707
702
 
708
- 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, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn };
703
+ 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 };
@@ -23,10 +23,3 @@ export declare const MFModuleType: {
23
23
  export declare const MODULE_DEVTOOL_IDENTIFIER = "__MF_DEVTOOLS_MODULE_INFO__";
24
24
  export declare const ENCODE_NAME_PREFIX = "ENCODE_NAME_PREFIX";
25
25
  export declare const TEMP_DIR = ".federation";
26
- export declare const MFPrefetchCommon: {
27
- identifier: string;
28
- globalKey: string;
29
- library: string;
30
- exportsKey: string;
31
- fileName: string;
32
- };
@@ -65,10 +65,6 @@ export type Shared = (SharedItem | SharedObject)[] | SharedObject;
65
65
  * A module that should be shared in the share scope.
66
66
  */
67
67
  export type SharedItem = string;
68
- /**
69
- * Enable Data Prefetch
70
- */
71
- export type DataPrefetch = boolean;
72
68
  export interface AdditionalDataOptions {
73
69
  stats: Stats;
74
70
  manifest?: Manifest;
@@ -174,7 +170,6 @@ export interface ModuleFederationPluginOptions {
174
170
  dev?: boolean | PluginDevOptions;
175
171
  dts?: boolean | PluginDtsOptions;
176
172
  async?: boolean | AsyncBoundaryOptions;
177
- dataPrefetch?: DataPrefetch;
178
173
  }
179
174
  /**
180
175
  * Modules that should be exposed by this container. Property names are used as public paths.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.0-next-20240808083234",
3
+ "version": "0.0.0-next-20240812084439",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [