@module-federation/sdk 0.0.0-next-20241101074502 → 0.0.0-next-20241101093646
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 +49 -44
- package/dist/index.esm.js +49 -44
- package/dist/package.json +1 -4
- package/dist/src/logger.d.ts +8 -5
- package/dist/src/utils.d.ts +2 -1
- package/package.json +1 -4
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var isomorphicRslog = require('isomorphic-rslog');
|
|
4
3
|
var polyfills = require('./polyfills.cjs.js');
|
|
5
4
|
|
|
6
5
|
const FederationModuleManifest = 'federation-manifest.json';
|
|
@@ -59,61 +58,66 @@ var SharePlugin = /*#__PURE__*/Object.freeze({
|
|
|
59
58
|
function isBrowserEnv() {
|
|
60
59
|
return typeof window !== 'undefined';
|
|
61
60
|
}
|
|
62
|
-
function isBrowserDebug() {
|
|
63
|
-
try {
|
|
64
|
-
if (isBrowserEnv() && window.localStorage) {
|
|
65
|
-
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
|
|
66
|
-
}
|
|
67
|
-
} catch (error) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
61
|
function isDebugMode() {
|
|
73
62
|
if (typeof process !== 'undefined' && process.env && process.env['FEDERATION_DEBUG']) {
|
|
74
63
|
return Boolean(process.env['FEDERATION_DEBUG']);
|
|
75
64
|
}
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
return isBrowserDebug();
|
|
65
|
+
return typeof FEDERATION_DEBUG !== 'undefined' && Boolean(FEDERATION_DEBUG);
|
|
80
66
|
}
|
|
81
67
|
const getProcessEnv = function() {
|
|
82
68
|
return typeof process !== 'undefined' && process.env ? process.env : {};
|
|
83
69
|
};
|
|
84
70
|
|
|
85
|
-
const
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
const DEBUG_LOG = '[ FEDERATION DEBUG ]';
|
|
72
|
+
function safeToString$1(info) {
|
|
73
|
+
try {
|
|
74
|
+
return JSON.stringify(info, null, 2);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return '';
|
|
89
77
|
}
|
|
90
78
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
success: `${prefix} Success`,
|
|
96
|
-
info: `${prefix} Info`,
|
|
97
|
-
ready: `${prefix} Ready`,
|
|
98
|
-
debug: `${prefix} Debug`
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function createLogger(prefix) {
|
|
102
|
-
const loggerInstance = isomorphicRslog.createLogger({
|
|
103
|
-
labels: {
|
|
104
|
-
warn: `${PREFIX} Warn`,
|
|
105
|
-
error: `${PREFIX} Error`,
|
|
106
|
-
success: `${PREFIX} Success`,
|
|
107
|
-
info: `${PREFIX} Info`,
|
|
108
|
-
ready: `${PREFIX} Ready`,
|
|
109
|
-
debug: `${PREFIX} Debug`
|
|
79
|
+
function safeGetLocalStorageItem() {
|
|
80
|
+
try {
|
|
81
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
82
|
+
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
|
|
110
83
|
}
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return
|
|
84
|
+
} catch (error) {
|
|
85
|
+
return typeof document !== 'undefined';
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
115
88
|
}
|
|
116
|
-
|
|
89
|
+
let Logger = class Logger {
|
|
90
|
+
info(msg, info) {
|
|
91
|
+
if (this.enable) {
|
|
92
|
+
const argsToString = safeToString$1(info) || '';
|
|
93
|
+
if (isBrowserEnv()) {
|
|
94
|
+
console.info(`%c ${this.identifier}: ${msg} ${argsToString}`, 'color:#3300CC');
|
|
95
|
+
} else {
|
|
96
|
+
console.info('\x1b[34m%s', `${this.identifier}: ${msg} ${argsToString ? `\n${argsToString}` : ''}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
logOriginalInfo(...args) {
|
|
101
|
+
if (this.enable) {
|
|
102
|
+
if (isBrowserEnv()) {
|
|
103
|
+
console.info(`%c ${this.identifier}: OriginalInfo`, 'color:#3300CC');
|
|
104
|
+
console.log(...args);
|
|
105
|
+
} else {
|
|
106
|
+
console.info(`%c ${this.identifier}: OriginalInfo`, 'color:#3300CC');
|
|
107
|
+
console.log(...args);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
constructor(identifier){
|
|
112
|
+
this.enable = false;
|
|
113
|
+
this.identifier = identifier || DEBUG_LOG;
|
|
114
|
+
if (isBrowserEnv() && safeGetLocalStorageItem()) {
|
|
115
|
+
this.enable = true;
|
|
116
|
+
} else if (isDebugMode()) {
|
|
117
|
+
this.enable = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
117
121
|
|
|
118
122
|
const LOG_CATEGORY = '[ Federation Runtime ]';
|
|
119
123
|
// entry: name:version version : 1.0.0 | ^1.2.3
|
|
@@ -162,6 +166,7 @@ const parseEntry = (str, devVerOrUrl, separator = SEPARATOR)=>{
|
|
|
162
166
|
throw `Invalid entry value: ${str}`;
|
|
163
167
|
}
|
|
164
168
|
};
|
|
169
|
+
const logger = new Logger();
|
|
165
170
|
const composeKeyWithSeparator = function(...args) {
|
|
166
171
|
if (!args.length) {
|
|
167
172
|
return '';
|
|
@@ -755,6 +760,7 @@ exports.BROWSER_LOG_VALUE = BROWSER_LOG_VALUE;
|
|
|
755
760
|
exports.ENCODE_NAME_PREFIX = ENCODE_NAME_PREFIX;
|
|
756
761
|
exports.EncodedNameTransformMap = EncodedNameTransformMap;
|
|
757
762
|
exports.FederationModuleManifest = FederationModuleManifest;
|
|
763
|
+
exports.Logger = Logger;
|
|
758
764
|
exports.MANIFEST_EXT = MANIFEST_EXT;
|
|
759
765
|
exports.MFModuleType = MFModuleType;
|
|
760
766
|
exports.MFPrefetchCommon = MFPrefetchCommon;
|
|
@@ -770,7 +776,6 @@ exports.composeKeyWithSeparator = composeKeyWithSeparator;
|
|
|
770
776
|
exports.containerPlugin = ContainerPlugin;
|
|
771
777
|
exports.containerReferencePlugin = ContainerReferencePlugin;
|
|
772
778
|
exports.createLink = createLink;
|
|
773
|
-
exports.createLogger = createLogger;
|
|
774
779
|
exports.createScript = createScript;
|
|
775
780
|
exports.createScriptNode = createScriptNode;
|
|
776
781
|
exports.decodeName = decodeName;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createLogger as createLogger$1 } from 'isomorphic-rslog';
|
|
2
1
|
import { _ as _extends } from './polyfills.esm.js';
|
|
3
2
|
|
|
4
3
|
const FederationModuleManifest = 'federation-manifest.json';
|
|
@@ -57,61 +56,66 @@ var SharePlugin = /*#__PURE__*/Object.freeze({
|
|
|
57
56
|
function isBrowserEnv() {
|
|
58
57
|
return typeof window !== 'undefined';
|
|
59
58
|
}
|
|
60
|
-
function isBrowserDebug() {
|
|
61
|
-
try {
|
|
62
|
-
if (isBrowserEnv() && window.localStorage) {
|
|
63
|
-
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
59
|
function isDebugMode() {
|
|
71
60
|
if (typeof process !== 'undefined' && process.env && process.env['FEDERATION_DEBUG']) {
|
|
72
61
|
return Boolean(process.env['FEDERATION_DEBUG']);
|
|
73
62
|
}
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
return isBrowserDebug();
|
|
63
|
+
return typeof FEDERATION_DEBUG !== 'undefined' && Boolean(FEDERATION_DEBUG);
|
|
78
64
|
}
|
|
79
65
|
const getProcessEnv = function() {
|
|
80
66
|
return typeof process !== 'undefined' && process.env ? process.env : {};
|
|
81
67
|
};
|
|
82
68
|
|
|
83
|
-
const
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
const DEBUG_LOG = '[ FEDERATION DEBUG ]';
|
|
70
|
+
function safeToString$1(info) {
|
|
71
|
+
try {
|
|
72
|
+
return JSON.stringify(info, null, 2);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
return '';
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
success: `${prefix} Success`,
|
|
94
|
-
info: `${prefix} Info`,
|
|
95
|
-
ready: `${prefix} Ready`,
|
|
96
|
-
debug: `${prefix} Debug`
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function createLogger(prefix) {
|
|
100
|
-
const loggerInstance = createLogger$1({
|
|
101
|
-
labels: {
|
|
102
|
-
warn: `${PREFIX} Warn`,
|
|
103
|
-
error: `${PREFIX} Error`,
|
|
104
|
-
success: `${PREFIX} Success`,
|
|
105
|
-
info: `${PREFIX} Info`,
|
|
106
|
-
ready: `${PREFIX} Ready`,
|
|
107
|
-
debug: `${PREFIX} Debug`
|
|
77
|
+
function safeGetLocalStorageItem() {
|
|
78
|
+
try {
|
|
79
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
80
|
+
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
|
|
108
81
|
}
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return typeof document !== 'undefined';
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
113
86
|
}
|
|
114
|
-
|
|
87
|
+
let Logger = class Logger {
|
|
88
|
+
info(msg, info) {
|
|
89
|
+
if (this.enable) {
|
|
90
|
+
const argsToString = safeToString$1(info) || '';
|
|
91
|
+
if (isBrowserEnv()) {
|
|
92
|
+
console.info(`%c ${this.identifier}: ${msg} ${argsToString}`, 'color:#3300CC');
|
|
93
|
+
} else {
|
|
94
|
+
console.info('\x1b[34m%s', `${this.identifier}: ${msg} ${argsToString ? `\n${argsToString}` : ''}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
logOriginalInfo(...args) {
|
|
99
|
+
if (this.enable) {
|
|
100
|
+
if (isBrowserEnv()) {
|
|
101
|
+
console.info(`%c ${this.identifier}: OriginalInfo`, 'color:#3300CC');
|
|
102
|
+
console.log(...args);
|
|
103
|
+
} else {
|
|
104
|
+
console.info(`%c ${this.identifier}: OriginalInfo`, 'color:#3300CC');
|
|
105
|
+
console.log(...args);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
constructor(identifier){
|
|
110
|
+
this.enable = false;
|
|
111
|
+
this.identifier = identifier || DEBUG_LOG;
|
|
112
|
+
if (isBrowserEnv() && safeGetLocalStorageItem()) {
|
|
113
|
+
this.enable = true;
|
|
114
|
+
} else if (isDebugMode()) {
|
|
115
|
+
this.enable = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
115
119
|
|
|
116
120
|
const LOG_CATEGORY = '[ Federation Runtime ]';
|
|
117
121
|
// entry: name:version version : 1.0.0 | ^1.2.3
|
|
@@ -160,6 +164,7 @@ const parseEntry = (str, devVerOrUrl, separator = SEPARATOR)=>{
|
|
|
160
164
|
throw `Invalid entry value: ${str}`;
|
|
161
165
|
}
|
|
162
166
|
};
|
|
167
|
+
const logger = new Logger();
|
|
163
168
|
const composeKeyWithSeparator = function(...args) {
|
|
164
169
|
if (!args.length) {
|
|
165
170
|
return '';
|
|
@@ -748,4 +753,4 @@ function normalizeOptions(enableDefault, defaultOptions, key) {
|
|
|
748
753
|
};
|
|
749
754
|
}
|
|
750
755
|
|
|
751
|
-
export { BROWSER_LOG_KEY, BROWSER_LOG_VALUE, ENCODE_NAME_PREFIX, EncodedNameTransformMap, FederationModuleManifest, MANIFEST_EXT, MFModuleType, MFPrefetchCommon, MODULE_DEVTOOL_IDENTIFIER, ManifestFileName, NameTransformMap, NameTransformSymbol, SEPARATOR, StatsFileName, TEMP_DIR, assert, composeKeyWithSeparator, ContainerPlugin as containerPlugin, ContainerReferencePlugin as containerReferencePlugin, createLink,
|
|
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.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A sdk for support module federation",
|
|
6
6
|
"keywords": [
|
|
@@ -40,8 +40,5 @@
|
|
|
40
40
|
"./dist/normalize-webpack-path.cjs.d.ts"
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"isomorphic-rslog": "0.0.4"
|
|
46
43
|
}
|
|
47
44
|
}
|
package/dist/src/logger.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
declare class Logger {
|
|
2
|
+
enable: boolean;
|
|
3
|
+
identifier: string;
|
|
4
|
+
constructor(identifier?: string);
|
|
5
|
+
info(msg: string, info?: any): void;
|
|
6
|
+
logOriginalInfo(...args: unknown[]): void;
|
|
7
|
+
}
|
|
8
|
+
export { Logger };
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { RemoteEntryInfo, ModuleInfo } from './types';
|
|
2
|
-
import {
|
|
2
|
+
import { Logger } from './logger';
|
|
3
3
|
declare const parseEntry: (str: string, devVerOrUrl?: string, separator?: string) => RemoteEntryInfo;
|
|
4
4
|
declare global {
|
|
5
5
|
var FEDERATION_DEBUG: string | undefined;
|
|
6
6
|
}
|
|
7
|
+
declare const logger: Logger;
|
|
7
8
|
declare const composeKeyWithSeparator: (...args: (string | undefined)[]) => string;
|
|
8
9
|
declare const encodeName: (name: string, prefix?: string, withExt?: boolean) => string;
|
|
9
10
|
declare const decodeName: (name: string, prefix?: string, withExt?: boolean) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/sdk",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241101093646",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A sdk for support module federation",
|
|
6
6
|
"keywords": [
|
|
@@ -40,8 +40,5 @@
|
|
|
40
40
|
"./dist/normalize-webpack-path.cjs.d.ts"
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"isomorphic-rslog": "0.0.4"
|
|
46
43
|
}
|
|
47
44
|
}
|