@idlebox/browser 0.0.15 → 0.0.18
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/docs/package-public.d.ts +23 -0
- package/lib/_export_all_in_one_index.cjs +3 -1
- package/lib/_export_all_in_one_index.cjs.map +1 -1
- package/lib/_export_all_in_one_index.js +1 -0
- package/lib/_export_all_in_one_index.js.map +1 -1
- package/lib/debug/logger.cjs +40 -0
- package/lib/debug/logger.cjs.map +1 -0
- package/lib/debug/logger.js +31 -0
- package/lib/debug/logger.js.map +1 -0
- package/package.json +10 -10
- package/src/debug/logger.ts +36 -0
- package/config/rush-project.json +0 -3
- package/lib/globalref.cjs +0 -3
- package/lib/globalref.cjs.map +0 -1
- package/lib/globalref.js +0 -3
- package/lib/globalref.js.map +0 -1
- package/src/globalref.ts +0 -1
package/docs/package-public.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { WrappedConsole } from '@idlebox/common';
|
|
2
|
+
import { WrappedConsoleOptions } from '@idlebox/common';
|
|
3
|
+
|
|
4
|
+
declare const colorMap: {
|
|
5
|
+
info: string;
|
|
6
|
+
success: string;
|
|
7
|
+
debug: string;
|
|
8
|
+
error: string;
|
|
9
|
+
trace: string;
|
|
10
|
+
warn: string;
|
|
11
|
+
assert: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
1
14
|
export declare class TimeoutStorage<T> {
|
|
2
15
|
private readonly storage;
|
|
3
16
|
private readonly valueKey;
|
|
@@ -10,4 +23,14 @@ export declare class TimeoutStorage<T> {
|
|
|
10
23
|
read(): Readonly<T> | undefined;
|
|
11
24
|
}
|
|
12
25
|
|
|
26
|
+
declare interface WebConsoleOptions {
|
|
27
|
+
color?: boolean | Partial<typeof colorMap>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare class WrappedWebConsole extends WrappedConsole {
|
|
31
|
+
private readonly colors;
|
|
32
|
+
constructor(title: string, { color, ...opt }?: WrappedConsoleOptions & WebConsoleOptions);
|
|
33
|
+
protected processColorLabel(msg: any[], pos: number, level: string, prefix: string): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
13
36
|
export { }
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimeoutStorage = void 0;
|
|
3
|
+
exports.TimeoutStorage = exports.WrappedWebConsole = void 0;
|
|
4
|
+
var logger_cjs_1 = require("./debug/logger.cjs");
|
|
5
|
+
Object.defineProperty(exports, "WrappedWebConsole", { enumerable: true, get: function () { return logger_cjs_1.WrappedWebConsole; } });
|
|
4
6
|
var timeoutStorage_cjs_1 = require("./storage/timeoutStorage.cjs");
|
|
5
7
|
Object.defineProperty(exports, "TimeoutStorage", { enumerable: true, get: function () { return timeoutStorage_cjs_1.TimeoutStorage; } });
|
|
6
8
|
//# sourceMappingURL=_export_all_in_one_index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_export_all_in_one_index.js","sourceRoot":"","sources":["../source/_export_all_in_one_index.ts"],"names":[],"mappings":";;;AAAA,mEAAyD;AAAhD,oHAAA,cAAc,OAAA"}
|
|
1
|
+
{"version":3,"file":"_export_all_in_one_index.js","sourceRoot":"","sources":["../source/_export_all_in_one_index.ts"],"names":[],"mappings":";;;AAAA,iDAAkD;AAAzC,+GAAA,iBAAiB,OAAA;AAC1B,mEAAyD;AAAhD,oHAAA,cAAc,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_export_all_in_one_index.js","sourceRoot":"","sources":["../source/_export_all_in_one_index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oCAAgC"}
|
|
1
|
+
{"version":3,"file":"_export_all_in_one_index.js","sourceRoot":"","sources":["../source/_export_all_in_one_index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,0BAAsB;AAClD,OAAO,EAAE,cAAc,EAAE,oCAAgC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WrappedWebConsole = void 0;
|
|
4
|
+
const common_1 = require("@idlebox/common");
|
|
5
|
+
const colorMap = {
|
|
6
|
+
info: 'color:blue',
|
|
7
|
+
success: 'color:green',
|
|
8
|
+
debug: 'color:gray',
|
|
9
|
+
error: 'color:red',
|
|
10
|
+
trace: 'color:gray',
|
|
11
|
+
warn: 'color:yellow',
|
|
12
|
+
assert: 'background:red;color:white',
|
|
13
|
+
};
|
|
14
|
+
class WrappedWebConsole extends common_1.WrappedConsole {
|
|
15
|
+
constructor(title, { color, ...opt } = {}) {
|
|
16
|
+
super(title, opt);
|
|
17
|
+
Object.defineProperty(this, "colors", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: colorMap
|
|
22
|
+
});
|
|
23
|
+
if (color === false) {
|
|
24
|
+
this.colors = {};
|
|
25
|
+
}
|
|
26
|
+
else if (typeof color === 'object') {
|
|
27
|
+
this.colors = { ...colorMap, ...color };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
processColorLabel(msg, pos, level, prefix) {
|
|
31
|
+
if (this.colors[level]) {
|
|
32
|
+
msg.splice(pos, 1, `%c${prefix}${msg[pos]}`, this.colors[level]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
msg[pos] = `${prefix}${msg[pos]}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.WrappedWebConsole = WrappedWebConsole;
|
|
40
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/debug/logger.ts"],"names":[],"mappings":";;;AAAA,4CAAwE;AAMxE,MAAM,QAAQ,GAAG;IAChB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,4BAA4B;CACpC,CAAC;AAEF,MAAa,iBAAkB,SAAQ,uBAAc;IAGpD,YAAY,KAAa,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,KAAgD,EAAE;QAC3F,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAHnB;;;;mBAAkD,QAAQ;WAAC;QAI1D,IAAI,KAAK,KAAK,KAAK,EAAE;YACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;SACjB;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACrC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;SACxC;IACF,CAAC;IAES,iBAAiB,CAAC,GAAU,EAAE,GAAW,EAAE,KAAa,EAAE,MAAc;QACjF,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACvB,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;SACjE;aAAM;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;SAClC;IACF,CAAC;CACD;AAnBD,8CAmBC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WrappedConsole } from '@idlebox/common';
|
|
2
|
+
const colorMap = {
|
|
3
|
+
info: 'color:blue',
|
|
4
|
+
success: 'color:green',
|
|
5
|
+
debug: 'color:gray',
|
|
6
|
+
error: 'color:red',
|
|
7
|
+
trace: 'color:gray',
|
|
8
|
+
warn: 'color:yellow',
|
|
9
|
+
assert: 'background:red;color:white',
|
|
10
|
+
};
|
|
11
|
+
export class WrappedWebConsole extends WrappedConsole {
|
|
12
|
+
colors = colorMap;
|
|
13
|
+
constructor(title, { color, ...opt } = {}) {
|
|
14
|
+
super(title, opt);
|
|
15
|
+
if (color === false) {
|
|
16
|
+
this.colors = {};
|
|
17
|
+
}
|
|
18
|
+
else if (typeof color === 'object') {
|
|
19
|
+
this.colors = { ...colorMap, ...color };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
processColorLabel(msg, pos, level, prefix) {
|
|
23
|
+
if (this.colors[level]) {
|
|
24
|
+
msg.splice(pos, 1, `%c${prefix}${msg[pos]}`, this.colors[level]);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
msg[pos] = `${prefix}${msg[pos]}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/debug/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAMxE,MAAM,QAAQ,GAAG;IAChB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,4BAA4B;CACpC,CAAC;AAEF,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACnC,MAAM,GAA2B,QAAQ,CAAC;IAE3D,YAAY,KAAa,EAAE,EAAE,KAAK,EAAE,GAAG,GAAG,KAAgD,EAAE;QAC3F,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClB,IAAI,KAAK,KAAK,KAAK,EAAE;YACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;SACjB;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACrC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;SACxC;IACF,CAAC;IAES,iBAAiB,CAAC,GAAU,EAAE,GAAW,EAAE,KAAa,EAAE,MAAc;QACjF,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACvB,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;SACjE;aAAM;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;SAClC;IACF,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"monorepo": "rush",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"name": "@idlebox/browser",
|
|
6
6
|
"repository": "https://github.com/GongT/baobao",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"watch": "build-script watch"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@idlebox/common": "^1.
|
|
26
|
-
"source-map-support": "^0.5.
|
|
25
|
+
"@idlebox/common": "^1.3.3",
|
|
26
|
+
"source-map-support": "^0.5.21",
|
|
27
27
|
"tslib": "^2.3.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@build-script/builder": "^3.
|
|
31
|
-
"@build-script/typescript-transformer-dual-package": "^1.0.
|
|
32
|
-
"@build-script/export-all-in-one": "^3.
|
|
33
|
-
"@build-script/single-dog-asset": "^1.0.
|
|
30
|
+
"@build-script/builder": "^3.2.3",
|
|
31
|
+
"@build-script/typescript-transformer-dual-package": "^1.0.24",
|
|
32
|
+
"@build-script/export-all-in-one": "^3.1.1",
|
|
33
|
+
"@build-script/single-dog-asset": "^1.0.15",
|
|
34
34
|
"gulp": "^4.0.2",
|
|
35
|
-
"typescript": "^4.
|
|
36
|
-
"ttypescript": "^1.5.
|
|
37
|
-
"
|
|
35
|
+
"typescript": "^4.6.2",
|
|
36
|
+
"ttypescript": "^1.5.13",
|
|
37
|
+
"esm": "^3.2.25"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { WrappedConsole, WrappedConsoleOptions } from '@idlebox/common';
|
|
2
|
+
|
|
3
|
+
interface WebConsoleOptions {
|
|
4
|
+
color?: boolean | Partial<typeof colorMap>;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const colorMap = {
|
|
8
|
+
info: 'color:blue',
|
|
9
|
+
success: 'color:green',
|
|
10
|
+
debug: 'color:gray',
|
|
11
|
+
error: 'color:red',
|
|
12
|
+
trace: 'color:gray',
|
|
13
|
+
warn: 'color:yellow',
|
|
14
|
+
assert: 'background:red;color:white',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export class WrappedWebConsole extends WrappedConsole {
|
|
18
|
+
private readonly colors: Record<string, string> = colorMap;
|
|
19
|
+
|
|
20
|
+
constructor(title: string, { color, ...opt }: WrappedConsoleOptions & WebConsoleOptions = {}) {
|
|
21
|
+
super(title, opt);
|
|
22
|
+
if (color === false) {
|
|
23
|
+
this.colors = {};
|
|
24
|
+
} else if (typeof color === 'object') {
|
|
25
|
+
this.colors = { ...colorMap, ...color };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
protected processColorLabel(msg: any[], pos: number, level: string, prefix: string): void {
|
|
30
|
+
if (this.colors[level]) {
|
|
31
|
+
msg.splice(pos, 1, `%c${prefix}${msg[pos]}`, this.colors[level]);
|
|
32
|
+
} else {
|
|
33
|
+
msg[pos] = `${prefix}${msg[pos]}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/config/rush-project.json
DELETED
package/lib/globalref.cjs
DELETED
package/lib/globalref.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globalref.js","sourceRoot":"","sources":["../src/globalref.ts"],"names":[],"mappings":";AAAA,2BAA2B"}
|
package/lib/globalref.js
DELETED
package/lib/globalref.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globalref.js","sourceRoot":"","sources":["../src/globalref.ts"],"names":[],"mappings":";AAAA,2BAA2B"}
|
package/src/globalref.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference lib="DOM" />
|