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