@module-federation/sdk
Advanced tools
Comparing version 0.0.0-next-20240227135200 to 0.0.0-next-20240228024304
@@ -32,26 +32,3 @@ 'use strict'; | ||
var SEPARATOR = ":"; | ||
var ManifestFileName = "mf-manifest.json"; | ||
var StatsFileName = "mf-stats.json"; | ||
exports.ModuleType = void 0; | ||
(function(ModuleType) { | ||
ModuleType["NPM"] = "npm"; | ||
ModuleType["APP"] = "app"; | ||
})(exports.ModuleType || (exports.ModuleType = {})); | ||
var ContainerPlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var ContainerReferencePlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var ModuleFederationPlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var SharePlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
function isBrowserEnv() { | ||
@@ -135,2 +112,12 @@ return typeof window !== "undefined"; | ||
var DEBUG_LOG = "[ FEDERATION DEBUG ]"; | ||
function safeGetLocalStorageItem() { | ||
try { | ||
if (typeof window !== "undefined" && window.localStorage) { | ||
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE; | ||
} | ||
} catch (error) { | ||
return typeof document !== "undefined"; | ||
} | ||
return false; | ||
} | ||
var Logger = /*#__PURE__*/ function() { | ||
@@ -142,3 +129,3 @@ function Logger(identifier) { | ||
this.identifier = identifier || DEBUG_LOG; | ||
if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) { | ||
if (isBrowserEnv() && safeGetLocalStorageItem()) { | ||
this.enable = true; | ||
@@ -242,4 +229,3 @@ } else if (isDebugMode()) { | ||
var parseEntry = function(str, devVerOrUrl) { | ||
var separator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : SEPARATOR; | ||
var strSplit = str.split(separator); | ||
var strSplit = str.split(SEPARATOR); | ||
var devVersionOrUrl = getProcessEnv()["NODE_ENV"] === "development" && devVerOrUrl; | ||
@@ -253,3 +239,3 @@ var defaultVersion = "*"; | ||
var _strSplit = _to_array(strSplit), name = _strSplit[0], versionOrEntryArr = _strSplit.slice(1); | ||
var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator); | ||
var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(SEPARATOR); | ||
if (isEntry(versionOrEntry)) { | ||
@@ -522,7 +508,6 @@ return { | ||
}; | ||
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchEntry) { | ||
var _manifest_metaData_prefetchEntry = manifest.metaData.prefetchEntry, path = _manifest_metaData_prefetchEntry.path, name = _manifest_metaData_prefetchEntry.name, type = _manifest_metaData_prefetchEntry.type; | ||
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchInterface) { | ||
var prefetchInterface = manifest.metaData.prefetchInterface; | ||
basicRemoteSnapshot = _object_spread_props(_object_spread({}, basicRemoteSnapshot), { | ||
prefetchEntry: simpleJoinRemoteEntry(path, name), | ||
prefetchEntryType: type | ||
prefetchInterface: prefetchInterface | ||
}); | ||
@@ -1173,11 +1158,7 @@ } | ||
exports.MANIFEST_EXT = MANIFEST_EXT; | ||
exports.ManifestFileName = ManifestFileName; | ||
exports.NameTransformMap = NameTransformMap; | ||
exports.NameTransformSymbol = NameTransformSymbol; | ||
exports.SEPARATOR = SEPARATOR; | ||
exports.StatsFileName = StatsFileName; | ||
exports.assert = assert; | ||
exports.composeKeyWithSeparator = composeKeyWithSeparator; | ||
exports.containerPlugin = ContainerPlugin; | ||
exports.containerReferencePlugin = ContainerReferencePlugin; | ||
exports.createLink = createLink; | ||
@@ -1201,7 +1182,5 @@ exports.createScript = createScript; | ||
exports.logger = logger; | ||
exports.moduleFederationPlugin = ModuleFederationPlugin; | ||
exports.parseEntry = parseEntry; | ||
exports.safeWrapper = safeWrapper; | ||
exports.sharePlugin = SharePlugin; | ||
exports.simpleJoinRemoteEntry = simpleJoinRemoteEntry; | ||
exports.warn = warn; |
@@ -28,26 +28,3 @@ function _define_property$2(obj, key, value) { | ||
var SEPARATOR = ":"; | ||
var ManifestFileName = "mf-manifest.json"; | ||
var StatsFileName = "mf-stats.json"; | ||
var ModuleType; | ||
(function(ModuleType) { | ||
ModuleType["NPM"] = "npm"; | ||
ModuleType["APP"] = "app"; | ||
})(ModuleType || (ModuleType = {})); | ||
var ContainerPlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var ContainerReferencePlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var ModuleFederationPlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var SharePlugin = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
function isBrowserEnv() { | ||
@@ -131,2 +108,12 @@ return typeof window !== "undefined"; | ||
var DEBUG_LOG = "[ FEDERATION DEBUG ]"; | ||
function safeGetLocalStorageItem() { | ||
try { | ||
if (typeof window !== "undefined" && window.localStorage) { | ||
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE; | ||
} | ||
} catch (error) { | ||
return typeof document !== "undefined"; | ||
} | ||
return false; | ||
} | ||
var Logger = /*#__PURE__*/ function() { | ||
@@ -138,3 +125,3 @@ function Logger(identifier) { | ||
this.identifier = identifier || DEBUG_LOG; | ||
if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) { | ||
if (isBrowserEnv() && safeGetLocalStorageItem()) { | ||
this.enable = true; | ||
@@ -238,4 +225,3 @@ } else if (isDebugMode()) { | ||
var parseEntry = function(str, devVerOrUrl) { | ||
var separator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : SEPARATOR; | ||
var strSplit = str.split(separator); | ||
var strSplit = str.split(SEPARATOR); | ||
var devVersionOrUrl = getProcessEnv()["NODE_ENV"] === "development" && devVerOrUrl; | ||
@@ -249,3 +235,3 @@ var defaultVersion = "*"; | ||
var _strSplit = _to_array(strSplit), name = _strSplit[0], versionOrEntryArr = _strSplit.slice(1); | ||
var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(separator); | ||
var versionOrEntry = devVersionOrUrl || versionOrEntryArr.join(SEPARATOR); | ||
if (isEntry(versionOrEntry)) { | ||
@@ -518,7 +504,6 @@ return { | ||
}; | ||
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchEntry) { | ||
var _manifest_metaData_prefetchEntry = manifest.metaData.prefetchEntry, path = _manifest_metaData_prefetchEntry.path, name = _manifest_metaData_prefetchEntry.name, type = _manifest_metaData_prefetchEntry.type; | ||
if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchInterface) { | ||
var prefetchInterface = manifest.metaData.prefetchInterface; | ||
basicRemoteSnapshot = _object_spread_props(_object_spread({}, basicRemoteSnapshot), { | ||
prefetchEntry: simpleJoinRemoteEntry(path, name), | ||
prefetchEntryType: type | ||
prefetchInterface: prefetchInterface | ||
}); | ||
@@ -1163,2 +1148,2 @@ } | ||
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, ManifestFileName, ModuleType, 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, parseEntry, safeWrapper, SharePlugin as sharePlugin, simpleJoinRemoteEntry, warn }; | ||
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, EncodedNameTransformMap, FederationModuleManifest, Logger, MANIFEST_EXT, NameTransformMap, NameTransformSymbol, SEPARATOR, assert, composeKeyWithSeparator, createLink, createScript, createScriptNode, decodeName, encodeName, error, generateExposeFilename, generateShareFilename, generateSnapshotFromManifest, getProcessEnv, getResourceUrl, isBrowserEnv, isDebugMode, isManifestProvider, isStaticResourcesEqual, loadScript, loadScriptNode, logger, parseEntry, safeWrapper, simpleJoinRemoteEntry, warn }; |
@@ -17,7 +17,1 @@ export declare const FederationModuleManifest = "federation-manifest.json"; | ||
export declare const SEPARATOR = ":"; | ||
export declare const ManifestFileName = "mf-manifest.json"; | ||
export declare const StatsFileName = "mf-stats.json"; | ||
export declare enum ModuleType { | ||
NPM = "npm", | ||
APP = "app" | ||
} |
@@ -5,2 +5,1 @@ export * from './common'; | ||
export * from './snapshot'; | ||
export * from './plugins'; |
@@ -30,4 +30,3 @@ import { RemoteEntryType, StatsAssets } from './stats'; | ||
}>; | ||
prefetchEntry?: string; | ||
prefetchEntryType?: RemoteEntryType; | ||
prefetchInterface?: boolean; | ||
} | ||
@@ -34,0 +33,0 @@ interface BasicProviderModuleInfoWithPublicPath extends BasicProviderModuleInfo { |
@@ -1,2 +0,1 @@ | ||
import { ModuleType } from '../constant'; | ||
import type { RemoteWithEntry, RemoteWithVersion } from './common'; | ||
@@ -18,6 +17,4 @@ export type RemoteEntryType = 'esm' | 'global'; | ||
remoteEntry: ResourceInfo; | ||
prefetchEntry?: ResourceInfo; | ||
prefetchInterface: boolean; | ||
types: Omit<ResourceInfo, 'type'>; | ||
type: ModuleType; | ||
pluginVersion: string; | ||
} | ||
@@ -62,3 +59,3 @@ type StatsMetaDataWithGetPublicPath<T = BasicStatsMetaData> = T & { | ||
name: string; | ||
file: string[]; | ||
file: string; | ||
} | ||
@@ -65,0 +62,0 @@ export interface ManifestModuleInfos { |
import { RemoteEntryInfo, ModuleInfo } from './types'; | ||
import { Logger } from './logger'; | ||
declare const parseEntry: (str: string, devVerOrUrl?: string, separator?: string) => RemoteEntryInfo; | ||
declare const parseEntry: (str: string, devVerOrUrl?: string) => RemoteEntryInfo; | ||
declare global { | ||
@@ -5,0 +5,0 @@ var FEDERATION_DEBUG: string | undefined; |
{ | ||
"name": "@module-federation/sdk", | ||
"version": "0.0.0-next-20240227135200", | ||
"version": "0.0.0-next-20240228024304", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "A sdk for support module federation", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106825
25
2672