@idlebox/browser 0.0.18 → 0.0.21
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.
|
@@ -1 +1,10 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"file": "_export_all_in_one_index.cjs",
|
|
4
|
+
"sourceRoot": "",
|
|
5
|
+
"sources": [
|
|
6
|
+
"../source/_export_all_in_one_index.ts"
|
|
7
|
+
],
|
|
8
|
+
"names": [],
|
|
9
|
+
"mappings": ";;;AAAA,iDAAkD;AAAzC,+GAAA,iBAAiB,OAAA;AAC1B,mEAAyD;AAAhD,oHAAA,cAAc,OAAA"
|
|
10
|
+
}
|
package/lib/debug/logger.cjs.map
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"file": "logger.cjs",
|
|
4
|
+
"sourceRoot": "",
|
|
5
|
+
"sources": [
|
|
6
|
+
"../../src/debug/logger.ts"
|
|
7
|
+
],
|
|
8
|
+
"names": [],
|
|
9
|
+
"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,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10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
|
2
|
+
"monorepo": "rush",
|
|
3
|
+
"version": "0.0.21",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"name": "@idlebox/browser",
|
|
6
|
+
"repository": "https://github.com/GongT/baobao",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"typings": "docs/package-public.d.ts",
|
|
9
|
+
"main": "./lib/_export_all_in_one_index.cjs",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"require": "./lib/_export_all_in_one_index.cjs",
|
|
13
|
+
"import": "./lib/_export_all_in_one_index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@idlebox/common": "^1.3.8",
|
|
18
|
+
"source-map-support": "^0.5.21",
|
|
19
|
+
"tslib": "^2.4.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@build-script/builder": "^3.2.5",
|
|
23
|
+
"@build-script/typescript-transformer-dual-package": "^1.0.26",
|
|
24
|
+
"@build-script/export-all-in-one": "^3.1.3",
|
|
25
|
+
"@build-script/single-dog-asset": "^1.0.18",
|
|
26
|
+
"gulp": "^4.0.2",
|
|
27
|
+
"typescript": "^4.7.4",
|
|
28
|
+
"ttypescript": "^1.5.13"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "build-script build",
|
|
32
|
+
"clean": "rimraf lib",
|
|
33
|
+
"distclean": "build-script distclean",
|
|
34
|
+
"test": "build-script test",
|
|
35
|
+
"watch": "build-script watch"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/debug/logger.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export class TimeoutStorage<T> {
|
|
2
|
-
private readonly valueKey: string;
|
|
3
|
-
private readonly expireKey: string;
|
|
4
|
-
|
|
5
|
-
constructor(key: string, private readonly storage: Storage = localStorage) {
|
|
6
|
-
this.valueKey = key + '::value';
|
|
7
|
-
this.expireKey = key + '::expire';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
save(data: Readonly<T>, expire: string | Date) {
|
|
11
|
-
if (expire instanceof Date) {
|
|
12
|
-
expire = expire.toUTCString();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// console.log('[%s] add [%s] %s', this.key, expire, data);
|
|
16
|
-
this.storage.setItem(this.valueKey, JSON.stringify(data));
|
|
17
|
-
this.storage.setItem(this.expireKey, expire);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
forget() {
|
|
21
|
-
// console.log('[%s] forget.', this.key);
|
|
22
|
-
this.storage.removeItem(this.valueKey);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getExpire() {
|
|
26
|
-
const o = this.storage.getItem(this.expireKey);
|
|
27
|
-
if (!o || new Date(o) < new Date()) {
|
|
28
|
-
// console.log('[%s] outdate.', this.key);
|
|
29
|
-
this.forget();
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return new Date(o);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
read(defaultVal: Readonly<T>): Readonly<T>;
|
|
37
|
-
read(): Readonly<T> | undefined;
|
|
38
|
-
|
|
39
|
-
read(defaultVal?: Readonly<T>): Readonly<T> | undefined {
|
|
40
|
-
const json = this.storage.getItem(this.valueKey);
|
|
41
|
-
if (!json) {
|
|
42
|
-
return defaultVal;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const o = this.storage.getItem(this.expireKey);
|
|
46
|
-
if (!o || new Date(o) < new Date()) {
|
|
47
|
-
// console.log('[%s] outdate.', this.key);
|
|
48
|
-
this.forget();
|
|
49
|
-
return defaultVal;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
return JSON.parse(json);
|
|
54
|
-
} catch (e) {
|
|
55
|
-
// console.warn('[%s] JSON %s', this.key, e.message);
|
|
56
|
-
this.forget();
|
|
57
|
-
return defaultVal;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
package/src/tsconfig.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../node_modules/@build-script/single-dog-asset/package/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../lib",
|
|
5
|
-
"rootDir": ".",
|
|
6
|
-
"declaration": false,
|
|
7
|
-
"declarationMap": false,
|
|
8
|
-
"lib": ["DOM", "ESNext", "ESNext.Array", "ESNext.AsyncIterable", "ESNext.Symbol"],
|
|
9
|
-
"types": []
|
|
10
|
-
}
|
|
11
|
-
}
|