@module-federation/bridge-shared 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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +4 -36
- package/dist/index.umd.js +1 -3
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/dist/logger.d.ts +0 -8
- package/src/logger.ts +0 -52
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class g {
|
|
5
|
-
constructor(e) {
|
|
6
|
-
i(this, "name");
|
|
7
|
-
i(this, "isDebugEnabled");
|
|
8
|
-
i(this, "color");
|
|
9
|
-
this.name = e, this.isDebugEnabled = !1, this.color = this.stringToColor(e), typeof window < "u" && typeof localStorage < "u" && (this.isDebugEnabled = localStorage.getItem("debug") === "true"), typeof process < "u" && process.env && (this.isDebugEnabled = process.env.DEBUG === "true");
|
|
10
|
-
}
|
|
11
|
-
log(...e) {
|
|
12
|
-
var t, n;
|
|
13
|
-
if (this.isDebugEnabled) {
|
|
14
|
-
const o = `color: ${this.color}; font-weight: bold`, l = `%c[${this.name}]`, r = ((n = (t = new Error().stack) == null ? void 0 : t.split(`
|
|
15
|
-
`)[2]) == null ? void 0 : n.trim()) || "Stack information not available";
|
|
16
|
-
typeof console < "u" && console.debug && console.debug(l, o, ...e, `
|
|
17
|
-
(${r})`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
stringToColor(e) {
|
|
21
|
-
let t = 0;
|
|
22
|
-
for (let o = 0; o < e.length; o++)
|
|
23
|
-
t = e.charCodeAt(o) + ((t << 5) - t);
|
|
24
|
-
let n = "#";
|
|
25
|
-
for (let o = 0; o < 3; o++) {
|
|
26
|
-
const l = t >> o * 8 & 255;
|
|
27
|
-
n += ("00" + l.toString(16)).substr(-2);
|
|
28
|
-
}
|
|
29
|
-
return n;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function f() {
|
|
33
|
-
const s = new PopStateEvent("popstate", { state: window.history.state });
|
|
34
|
-
window.dispatchEvent(s);
|
|
1
|
+
function e() {
|
|
2
|
+
const t = new PopStateEvent("popstate", { state: window.history.state });
|
|
3
|
+
window.dispatchEvent(t);
|
|
35
4
|
}
|
|
36
5
|
export {
|
|
37
|
-
|
|
38
|
-
f as dispatchPopstateEnv
|
|
6
|
+
e as dispatchPopstateEnv
|
|
39
7
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["bridge-shared"]={}))})(this,function(e){"use strict";
|
|
2
|
-
`)[2])==null?void 0:l.trim())||"Stack information not available";typeof console<"u"&&console.debug&&console.debug(r,o,...s,`
|
|
3
|
-
(${c})`)}}stringToColor(s){let i=0;for(let o=0;o<s.length;o++)i=s.charCodeAt(o)+((i<<5)-i);let l="#";for(let o=0;o<3;o++){const r=i>>o*8&255;l+=("00"+r.toString(16)).substr(-2)}return l}}function n(){const a=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(a)}e.Logger=t,e.dispatchPopstateEnv=n,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["bridge-shared"]={}))})(this,function(e){"use strict";function t(){const n=new PopStateEvent("popstate",{state:window.history.state});window.dispatchEvent(n)}e.dispatchPopstateEnv=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/dist/logger.d.ts
DELETED
package/src/logger.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export class Logger {
|
|
2
|
-
private name: string;
|
|
3
|
-
private isDebugEnabled: boolean;
|
|
4
|
-
private color: string;
|
|
5
|
-
|
|
6
|
-
constructor(name: string) {
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.isDebugEnabled = false;
|
|
9
|
-
this.color = this.stringToColor(name);
|
|
10
|
-
|
|
11
|
-
// Check if debug is enabled in the browser environment
|
|
12
|
-
if (typeof window !== 'undefined' && typeof localStorage !== 'undefined') {
|
|
13
|
-
this.isDebugEnabled = localStorage.getItem('debug') === 'true';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Check if debug is enabled in the Node.js environment
|
|
17
|
-
if (typeof process !== 'undefined' && process.env) {
|
|
18
|
-
this.isDebugEnabled = process.env.DEBUG === 'true';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public log(...messages: any[]): void {
|
|
23
|
-
if (this.isDebugEnabled) {
|
|
24
|
-
const infoStyle = `color: ${this.color}; font-weight: bold`;
|
|
25
|
-
const logMessage = `%c[${this.name}]`;
|
|
26
|
-
const stack =
|
|
27
|
-
new Error().stack?.split('\n')[2]?.trim() ||
|
|
28
|
-
'Stack information not available';
|
|
29
|
-
|
|
30
|
-
if (typeof console !== 'undefined' && console.debug) {
|
|
31
|
-
console.debug(logMessage, infoStyle, ...messages, `\n (${stack})`);
|
|
32
|
-
|
|
33
|
-
// if (this.isDebugEnabledStack) {
|
|
34
|
-
// console.log(`%c${stack}`, 'color: grey; font-style: italic;');
|
|
35
|
-
// }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private stringToColor(str: string): string {
|
|
41
|
-
let hash = 0;
|
|
42
|
-
for (let i = 0; i < str.length; i++) {
|
|
43
|
-
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
44
|
-
}
|
|
45
|
-
let color = '#';
|
|
46
|
-
for (let i = 0; i < 3; i++) {
|
|
47
|
-
const value = (hash >> (i * 8)) & 0xff;
|
|
48
|
-
color += ('00' + value.toString(16)).substr(-2);
|
|
49
|
-
}
|
|
50
|
-
return color;
|
|
51
|
-
}
|
|
52
|
-
}
|