@leafer/debug 1.2.2 → 1.3.1
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/package.json +3 -3
- package/src/Plugin.ts +13 -5
- package/types/index.d.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/debug",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "@leafer/debug",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "1.
|
|
25
|
+
"@leafer/math": "1.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "1.
|
|
28
|
+
"@leafer/interface": "1.3.1"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/Plugin.ts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
+
import { IBooleanMap } from '@leafer/interface'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const check = [] as string[]
|
|
5
|
+
|
|
1
6
|
export const Plugin = {
|
|
2
7
|
|
|
3
|
-
list: {} as
|
|
8
|
+
list: {} as IBooleanMap,
|
|
4
9
|
|
|
5
|
-
add(name: string) {
|
|
10
|
+
add(name: string, ...needPlugins: string[]) {
|
|
6
11
|
this.list[name] = true
|
|
12
|
+
check.push(...needPlugins)
|
|
7
13
|
},
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
has(name: string, tip?: boolean): boolean {
|
|
10
16
|
const rs = this.list[name]
|
|
11
17
|
if (!rs && tip) this.need(name)
|
|
12
18
|
return rs
|
|
13
19
|
},
|
|
14
20
|
|
|
15
21
|
need(name: string): any {
|
|
16
|
-
console.error('need plugin: @leafer-in/' + name)
|
|
22
|
+
console.error('need plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name)
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
setTimeout(() => check.forEach(name => Plugin.has(name, true)))
|
package/types/index.d.ts
CHANGED
|
@@ -39,9 +39,9 @@ declare class Debug {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
declare const Plugin: {
|
|
42
|
-
list:
|
|
43
|
-
add(name: string): void;
|
|
44
|
-
|
|
42
|
+
list: IBooleanMap;
|
|
43
|
+
add(name: string, ...needPlugins: string[]): void;
|
|
44
|
+
has(name: string, tip?: boolean): boolean;
|
|
45
45
|
need(name: string): any;
|
|
46
46
|
};
|
|
47
47
|
|