@mnaoumov/typescript-lib 0.0.0 → 1.0.0
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/@types/debug/package.json +4 -0
- package/LICENSE +21 -0
- package/README.md +7 -1
- package/dist/lib/cjs/@types/debug.d.cts +21 -0
- package/dist/lib/cjs/abort-controller.cjs +202 -0
- package/dist/lib/cjs/abort-controller.d.cts +135 -0
- package/dist/lib/cjs/aggregate-error.cjs +98 -0
- package/dist/lib/cjs/aggregate-error.d.cts +24 -0
- package/dist/lib/cjs/array-buffer.cjs +96 -0
- package/dist/lib/cjs/array-buffer.d.cts +16 -0
- package/dist/lib/cjs/array.cjs +134 -0
- package/dist/lib/cjs/array.d.cts +46 -0
- package/dist/lib/cjs/async-events.cjs +466 -0
- package/dist/lib/cjs/async-events.d.cts +456 -0
- package/dist/lib/cjs/async-operation-hook.cjs +113 -0
- package/dist/lib/cjs/async-operation-hook.d.cts +59 -0
- package/dist/lib/cjs/async.cjs +521 -0
- package/dist/lib/cjs/async.d.cts +414 -0
- package/dist/lib/cjs/beeper.cjs +126 -0
- package/dist/lib/cjs/beeper.d.cts +21 -0
- package/dist/lib/cjs/blob.cjs +160 -0
- package/dist/lib/cjs/blob.d.cts +59 -0
- package/dist/lib/cjs/bytes.cjs +114 -0
- package/dist/lib/cjs/bytes.d.cts +17 -0
- package/dist/lib/cjs/debug-controller.cjs +80 -0
- package/dist/lib/cjs/debug-controller.d.cts +87 -0
- package/dist/lib/cjs/debug.cjs +235 -0
- package/dist/lib/cjs/debug.d.cts +66 -0
- package/dist/lib/cjs/desktop-zip-extractor.cjs +215 -0
- package/dist/lib/cjs/desktop-zip-extractor.d.cts +95 -0
- package/dist/lib/cjs/disposable.cjs +414 -0
- package/dist/lib/cjs/disposable.d.cts +387 -0
- package/dist/lib/cjs/enum.cjs +100 -0
- package/dist/lib/cjs/enum.d.cts +24 -0
- package/dist/lib/cjs/error.cjs +297 -0
- package/dist/lib/cjs/error.d.cts +181 -0
- package/dist/lib/cjs/function.cjs +141 -0
- package/dist/lib/cjs/function.d.cts +128 -0
- package/dist/lib/cjs/html-element.cjs +341 -0
- package/dist/lib/cjs/html-element.d.cts +199 -0
- package/dist/lib/cjs/index.cjs +195 -0
- package/dist/lib/cjs/index.d.cts +33 -0
- package/dist/lib/cjs/jpeg-metadata.cjs +228 -0
- package/dist/lib/cjs/jpeg-metadata.d.cts +42 -0
- package/dist/lib/cjs/library.cjs +158 -0
- package/dist/lib/cjs/library.d.cts +96 -0
- package/dist/lib/cjs/object-utils.cjs +617 -0
- package/dist/lib/cjs/object-utils.d.cts +298 -0
- package/dist/lib/cjs/path.cjs +202 -0
- package/dist/lib/cjs/path.d.cts +154 -0
- package/dist/lib/cjs/reg-exp.cjs +254 -0
- package/dist/lib/cjs/reg-exp.d.cts +87 -0
- package/dist/lib/cjs/string.cjs +326 -0
- package/dist/lib/cjs/string.d.cts +361 -0
- package/dist/lib/cjs/transformers/date-transformer.cjs +129 -0
- package/dist/lib/cjs/transformers/date-transformer.d.cts +39 -0
- package/dist/lib/cjs/transformers/group-transformer.cjs +173 -0
- package/dist/lib/cjs/transformers/group-transformer.d.cts +70 -0
- package/dist/lib/cjs/transformers/index.cjs +123 -0
- package/dist/lib/cjs/transformers/index.d.cts +9 -0
- package/dist/lib/cjs/transformers/map-transformer.cjs +129 -0
- package/dist/lib/cjs/transformers/map-transformer.d.cts +41 -0
- package/dist/lib/cjs/transformers/set-transformer.cjs +129 -0
- package/dist/lib/cjs/transformers/set-transformer.d.cts +39 -0
- package/dist/lib/cjs/transformers/skip-private-property-transformer.cjs +127 -0
- package/dist/lib/cjs/transformers/skip-private-property-transformer.d.cts +36 -0
- package/dist/lib/cjs/transformers/transformer.cjs +170 -0
- package/dist/lib/cjs/transformers/transformer.d.cts +70 -0
- package/dist/lib/cjs/transformers/two-way-map-transformer.cjs +130 -0
- package/dist/lib/cjs/transformers/two-way-map-transformer.d.cts +42 -0
- package/dist/lib/cjs/transformers/typed-transformer.cjs +94 -0
- package/dist/lib/cjs/transformers/typed-transformer.d.cts +39 -0
- package/dist/lib/cjs/two-way-map.cjs +208 -0
- package/dist/lib/cjs/two-way-map.d.cts +101 -0
- package/dist/lib/cjs/type-guards.cjs +128 -0
- package/dist/lib/cjs/type-guards.d.cts +84 -0
- package/dist/lib/cjs/type.cjs +121 -0
- package/dist/lib/cjs/type.d.cts +122 -0
- package/dist/lib/cjs/typescript-lib-state.cjs +126 -0
- package/dist/lib/cjs/typescript-lib-state.d.cts +56 -0
- package/dist/lib/cjs/url.cjs +136 -0
- package/dist/lib/cjs/url.d.cts +74 -0
- package/dist/lib/cjs/value-provider.cjs +100 -0
- package/dist/lib/cjs/value-provider.d.cts +28 -0
- package/dist/lib/cjs/value-wrapper.cjs +144 -0
- package/dist/lib/cjs/value-wrapper.d.cts +47 -0
- package/dist/lib/esm/@types/debug.d.mts +21 -0
- package/dist/lib/esm/abort-controller.d.mts +135 -0
- package/dist/lib/esm/abort-controller.mjs +159 -0
- package/dist/lib/esm/aggregate-error.d.mts +24 -0
- package/dist/lib/esm/aggregate-error.mjs +60 -0
- package/dist/lib/esm/array-buffer.d.mts +16 -0
- package/dist/lib/esm/array-buffer.mjs +58 -0
- package/dist/lib/esm/array.d.mts +46 -0
- package/dist/lib/esm/array.mjs +93 -0
- package/dist/lib/esm/async-events.d.mts +456 -0
- package/dist/lib/esm/async-events.mjs +427 -0
- package/dist/lib/esm/async-operation-hook.d.mts +59 -0
- package/dist/lib/esm/async-operation-hook.mjs +71 -0
- package/dist/lib/esm/async.d.mts +414 -0
- package/dist/lib/esm/async.mjs +479 -0
- package/dist/lib/esm/beeper.d.mts +21 -0
- package/dist/lib/esm/beeper.mjs +88 -0
- package/dist/lib/esm/blob.d.mts +59 -0
- package/dist/lib/esm/blob.mjs +121 -0
- package/dist/lib/esm/bytes.d.mts +17 -0
- package/dist/lib/esm/bytes.mjs +76 -0
- package/dist/lib/esm/debug-controller.d.mts +87 -0
- package/dist/lib/esm/debug-controller.mjs +50 -0
- package/dist/lib/esm/debug.d.mts +66 -0
- package/dist/lib/esm/debug.mjs +185 -0
- package/dist/lib/esm/desktop-zip-extractor.d.mts +95 -0
- package/dist/lib/esm/desktop-zip-extractor.mjs +180 -0
- package/dist/lib/esm/disposable.d.mts +387 -0
- package/dist/lib/esm/disposable.mjs +360 -0
- package/dist/lib/esm/enum.d.mts +24 -0
- package/dist/lib/esm/enum.mjs +61 -0
- package/dist/lib/esm/error.d.mts +181 -0
- package/dist/lib/esm/error.mjs +248 -0
- package/dist/lib/esm/function.d.mts +128 -0
- package/dist/lib/esm/function.mjs +96 -0
- package/dist/lib/esm/html-element.d.mts +199 -0
- package/dist/lib/esm/html-element.mjs +291 -0
- package/dist/lib/esm/index.d.mts +33 -0
- package/dist/lib/esm/index.mjs +116 -0
- package/dist/lib/esm/jpeg-metadata.d.mts +42 -0
- package/dist/lib/esm/jpeg-metadata.mjs +189 -0
- package/dist/lib/esm/library.d.mts +96 -0
- package/dist/lib/esm/library.mjs +118 -0
- package/dist/lib/esm/object-utils.d.mts +298 -0
- package/dist/lib/esm/object-utils.mjs +567 -0
- package/dist/lib/esm/path.d.mts +154 -0
- package/dist/lib/esm/path.mjs +139 -0
- package/dist/lib/esm/reg-exp.d.mts +87 -0
- package/dist/lib/esm/reg-exp.mjs +213 -0
- package/dist/lib/esm/string.d.mts +361 -0
- package/dist/lib/esm/string.mjs +274 -0
- package/dist/lib/esm/transformers/date-transformer.d.mts +39 -0
- package/dist/lib/esm/transformers/date-transformer.mjs +91 -0
- package/dist/lib/esm/transformers/group-transformer.d.mts +70 -0
- package/dist/lib/esm/transformers/group-transformer.mjs +138 -0
- package/dist/lib/esm/transformers/index.d.mts +9 -0
- package/dist/lib/esm/transformers/index.mjs +68 -0
- package/dist/lib/esm/transformers/map-transformer.d.mts +41 -0
- package/dist/lib/esm/transformers/map-transformer.mjs +91 -0
- package/dist/lib/esm/transformers/set-transformer.d.mts +39 -0
- package/dist/lib/esm/transformers/set-transformer.mjs +91 -0
- package/dist/lib/esm/transformers/skip-private-property-transformer.d.mts +36 -0
- package/dist/lib/esm/transformers/skip-private-property-transformer.mjs +89 -0
- package/dist/lib/esm/transformers/transformer.d.mts +70 -0
- package/dist/lib/esm/transformers/transformer.mjs +132 -0
- package/dist/lib/esm/transformers/two-way-map-transformer.d.mts +42 -0
- package/dist/lib/esm/transformers/two-way-map-transformer.mjs +92 -0
- package/dist/lib/esm/transformers/typed-transformer.d.mts +39 -0
- package/dist/lib/esm/transformers/typed-transformer.mjs +56 -0
- package/dist/lib/esm/two-way-map.d.mts +101 -0
- package/dist/lib/esm/two-way-map.mjs +170 -0
- package/dist/lib/esm/type-guards.d.mts +84 -0
- package/dist/lib/esm/type-guards.mjs +85 -0
- package/dist/lib/esm/type.d.mts +122 -0
- package/dist/lib/esm/type.mjs +83 -0
- package/dist/lib/esm/typescript-lib-state.d.mts +56 -0
- package/dist/lib/esm/typescript-lib-state.mjs +84 -0
- package/dist/lib/esm/url.d.mts +74 -0
- package/dist/lib/esm/url.mjs +94 -0
- package/dist/lib/esm/value-provider.d.mts +28 -0
- package/dist/lib/esm/value-provider.mjs +62 -0
- package/dist/lib/esm/value-wrapper.d.mts +47 -0
- package/dist/lib/esm/value-wrapper.mjs +106 -0
- package/package.json +111 -13
- package/transformers/date-transformer/package.json +6 -0
- package/transformers/group-transformer/package.json +6 -0
- package/transformers/index/package.json +6 -0
- package/transformers/map-transformer/package.json +6 -0
- package/transformers/package.json +6 -0
- package/transformers/set-transformer/package.json +6 -0
- package/transformers/skip-private-property-transformer/package.json +6 -0
- package/transformers/transformer/package.json +6 -0
- package/transformers/two-way-map-transformer/package.json +6 -0
- package/transformers/typed-transformer/package.json +6 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/// <reference path="./library.d.mts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Two-way map.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A map that allows you to look up a value by its key and vice versa.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam Key - The type of the keys.
|
|
11
|
+
* @typeParam Value - The type of the values.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const map = new TwoWayMap<string, number>();
|
|
15
|
+
* map.set('foo', 42);
|
|
16
|
+
* map.getValue('foo'); // 42
|
|
17
|
+
* map.getKey(42); // 'foo'
|
|
18
|
+
* map.deleteKey('foo');
|
|
19
|
+
* map.deleteValue(42);
|
|
20
|
+
* map.clear();
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class TwoWayMap<Key, Value> {
|
|
24
|
+
private readonly keyValueMap;
|
|
25
|
+
private readonly valueKeyMap;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new two-way map.
|
|
28
|
+
*
|
|
29
|
+
* @param entries - Entries to initialize the map with.
|
|
30
|
+
*/
|
|
31
|
+
constructor(entries?: (readonly [key: Key, value: Value])[]);
|
|
32
|
+
/**
|
|
33
|
+
* Clears the map.
|
|
34
|
+
*/
|
|
35
|
+
clear(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Deletes a key from the map.
|
|
38
|
+
*
|
|
39
|
+
* @param key - The key.
|
|
40
|
+
*/
|
|
41
|
+
deleteKey(key: Key): void;
|
|
42
|
+
/**
|
|
43
|
+
* Deletes a value from the map.
|
|
44
|
+
*
|
|
45
|
+
* @param value - The value.
|
|
46
|
+
*/
|
|
47
|
+
deleteValue(value: Value): void;
|
|
48
|
+
/**
|
|
49
|
+
* Gets all entries in the map.
|
|
50
|
+
*
|
|
51
|
+
* @returns An iterator over all entries in the map.
|
|
52
|
+
*/
|
|
53
|
+
entries(): IterableIterator<readonly [key: Key, value: Value]>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets a key by its value.
|
|
56
|
+
*
|
|
57
|
+
* @param value - The value.
|
|
58
|
+
* @returns The key.
|
|
59
|
+
*/
|
|
60
|
+
getKey(value: Value): Key | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Gets a value by its key.
|
|
63
|
+
*
|
|
64
|
+
* @param key - The key.
|
|
65
|
+
* @returns The value.
|
|
66
|
+
*/
|
|
67
|
+
getValue(key: Key): undefined | Value;
|
|
68
|
+
/**
|
|
69
|
+
* Checks if the map has a key.
|
|
70
|
+
*
|
|
71
|
+
* @param key - The key.
|
|
72
|
+
* @returns `true` if the map has the key, `false` otherwise.
|
|
73
|
+
*/
|
|
74
|
+
hasKey(key: Key): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks if the map has a value.
|
|
77
|
+
*
|
|
78
|
+
* @param value - The value.
|
|
79
|
+
* @returns `true` if the map has the value, `false` otherwise.
|
|
80
|
+
*/
|
|
81
|
+
hasValue(value: Value): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Gets all keys in the map.
|
|
84
|
+
*
|
|
85
|
+
* @returns An iterator over all keys in the map.
|
|
86
|
+
*/
|
|
87
|
+
keys(): IterableIterator<Key>;
|
|
88
|
+
/**
|
|
89
|
+
* Sets a key-value pair in the map.
|
|
90
|
+
*
|
|
91
|
+
* @param key - The key.
|
|
92
|
+
* @param value - The value.
|
|
93
|
+
*/
|
|
94
|
+
set(key: Key, value: Value): void;
|
|
95
|
+
/**
|
|
96
|
+
* Gets all values in the map.
|
|
97
|
+
*
|
|
98
|
+
* @returns An iterator over all values in the map.
|
|
99
|
+
*/
|
|
100
|
+
values(): IterableIterator<Value>;
|
|
101
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function () {
|
|
7
|
+
function ensureDisposeSymbols(symbolConstructor = Symbol) {
|
|
8
|
+
symbolConstructor.asyncDispose ??= symbolConstructor.for('Symbol.asyncDispose');
|
|
9
|
+
symbolConstructor.dispose ??= symbolConstructor.for('Symbol.dispose');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ensureBrowserProcess() {
|
|
13
|
+
const browserProcess = {
|
|
14
|
+
browser: true,
|
|
15
|
+
cwd() {
|
|
16
|
+
return '/';
|
|
17
|
+
},
|
|
18
|
+
env: {},
|
|
19
|
+
platform: 'android'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line obsidianmd/no-global-this, unicorn/no-unnecessary-global-this -- Must stay `globalThis`-qualified: in the emitted banner a bare `process` is a free identifier, so reading it where the host has none throws a ReferenceError instead of yielding `undefined`. That is the very case this function exists to handle.
|
|
23
|
+
const existingProcess = globalThis.process;
|
|
24
|
+
|
|
25
|
+
if (!existingProcess) {
|
|
26
|
+
// eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
|
|
27
|
+
globalThis.process = browserProcess;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (existingProcess.versions?.node) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const existingProcessRecord = existingProcess;
|
|
36
|
+
|
|
37
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
38
|
+
existingProcessRecord[key] ??= value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
existingProcessRecord['browser'] = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
(function initEsm() {
|
|
45
|
+
ensureDisposeSymbols();
|
|
46
|
+
ensureBrowserProcess();
|
|
47
|
+
})();
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
class TwoWayMap {
|
|
51
|
+
keyValueMap = /* @__PURE__ */ new Map();
|
|
52
|
+
valueKeyMap = /* @__PURE__ */ new Map();
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new two-way map.
|
|
55
|
+
*
|
|
56
|
+
* @param entries - Entries to initialize the map with.
|
|
57
|
+
*/
|
|
58
|
+
constructor(entries = []) {
|
|
59
|
+
for (const [key, value] of entries) {
|
|
60
|
+
this.set(key, value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Clears the map.
|
|
65
|
+
*/
|
|
66
|
+
clear() {
|
|
67
|
+
this.keyValueMap.clear();
|
|
68
|
+
this.valueKeyMap.clear();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Deletes a key from the map.
|
|
72
|
+
*
|
|
73
|
+
* @param key - The key.
|
|
74
|
+
*/
|
|
75
|
+
deleteKey(key) {
|
|
76
|
+
const value = this.getValue(key);
|
|
77
|
+
if (value !== void 0) {
|
|
78
|
+
this.valueKeyMap.delete(value);
|
|
79
|
+
}
|
|
80
|
+
this.keyValueMap.delete(key);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Deletes a value from the map.
|
|
84
|
+
*
|
|
85
|
+
* @param value - The value.
|
|
86
|
+
*/
|
|
87
|
+
deleteValue(value) {
|
|
88
|
+
const key = this.getKey(value);
|
|
89
|
+
if (key !== void 0) {
|
|
90
|
+
this.keyValueMap.delete(key);
|
|
91
|
+
}
|
|
92
|
+
this.valueKeyMap.delete(value);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets all entries in the map.
|
|
96
|
+
*
|
|
97
|
+
* @returns An iterator over all entries in the map.
|
|
98
|
+
*/
|
|
99
|
+
entries() {
|
|
100
|
+
return this.keyValueMap.entries();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets a key by its value.
|
|
104
|
+
*
|
|
105
|
+
* @param value - The value.
|
|
106
|
+
* @returns The key.
|
|
107
|
+
*/
|
|
108
|
+
getKey(value) {
|
|
109
|
+
return this.valueKeyMap.get(value);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Gets a value by its key.
|
|
113
|
+
*
|
|
114
|
+
* @param key - The key.
|
|
115
|
+
* @returns The value.
|
|
116
|
+
*/
|
|
117
|
+
getValue(key) {
|
|
118
|
+
return this.keyValueMap.get(key);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Checks if the map has a key.
|
|
122
|
+
*
|
|
123
|
+
* @param key - The key.
|
|
124
|
+
* @returns `true` if the map has the key, `false` otherwise.
|
|
125
|
+
*/
|
|
126
|
+
hasKey(key) {
|
|
127
|
+
return this.keyValueMap.has(key);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Checks if the map has a value.
|
|
131
|
+
*
|
|
132
|
+
* @param value - The value.
|
|
133
|
+
* @returns `true` if the map has the value, `false` otherwise.
|
|
134
|
+
*/
|
|
135
|
+
hasValue(value) {
|
|
136
|
+
return this.valueKeyMap.has(value);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Gets all keys in the map.
|
|
140
|
+
*
|
|
141
|
+
* @returns An iterator over all keys in the map.
|
|
142
|
+
*/
|
|
143
|
+
keys() {
|
|
144
|
+
return this.keyValueMap.keys();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Sets a key-value pair in the map.
|
|
148
|
+
*
|
|
149
|
+
* @param key - The key.
|
|
150
|
+
* @param value - The value.
|
|
151
|
+
*/
|
|
152
|
+
set(key, value) {
|
|
153
|
+
this.deleteKey(key);
|
|
154
|
+
this.deleteValue(value);
|
|
155
|
+
this.keyValueMap.set(key, value);
|
|
156
|
+
this.valueKeyMap.set(value, key);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Gets all values in the map.
|
|
160
|
+
*
|
|
161
|
+
* @returns An iterator over all values in the map.
|
|
162
|
+
*/
|
|
163
|
+
values() {
|
|
164
|
+
return this.valueKeyMap.keys();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
TwoWayMap
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3R3by13YXktbWFwLnRzI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UFBO0FBQUE7QUFBQTtBQUFBO0FBQUEsRUFPTyxTQUFrQztBQUN2QyxXQUFPLEtBQUssWUFBWSxLQUFLO0FBQUEsRUFDL0I7QUFDRjsiLAogICJuYW1lcyI6IFtdCn0K
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// <reference path="./library.d.mts" />
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
*
|
|
5
|
+
* Contains utility functions for type guards.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A type that represents a generic object.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam T - The base type to intersect with.
|
|
11
|
+
*/
|
|
12
|
+
export type GenericObject<T = unknown> = Record<string | symbol, unknown> & T;
|
|
13
|
+
type NullableConstraint<T> = null extends T ? unknown : undefined extends T ? unknown : never;
|
|
14
|
+
/**
|
|
15
|
+
* Asserts that a condition is `true`. Throws if it is not.
|
|
16
|
+
*
|
|
17
|
+
* Use in place of `/* v8 ignore *\/` for defensive guards that should
|
|
18
|
+
* never trigger at runtime but would otherwise create uncovered branches.
|
|
19
|
+
*
|
|
20
|
+
* @param isTrue - The condition to assert.
|
|
21
|
+
* @param errorOrMessage - The error or message to throw if the condition is `false`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function assert(isTrue: boolean, errorOrMessage: Error | string): asserts isTrue;
|
|
24
|
+
/**
|
|
25
|
+
* Asserts that a value is a generic object, narrowing its type in place.
|
|
26
|
+
*
|
|
27
|
+
* @typeParam T - The type of the value.
|
|
28
|
+
* @param _object - The value to assert.
|
|
29
|
+
*/
|
|
30
|
+
export declare function assertGenericObject<T>(_object: T): asserts _object is GenericObject<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Asserts at compile time that every case of a discriminated union has been
|
|
33
|
+
* handled. Place at the `default` branch of a `switch` over a union or enum.
|
|
34
|
+
*
|
|
35
|
+
* If a new variant is added to the union without a matching `case`, the call
|
|
36
|
+
* to {@link assertNever} fails to compile because `value` is no longer `never`.
|
|
37
|
+
* If reached at runtime (e.g. because the value was bypassed via JSON or a
|
|
38
|
+
* type assertion), it throws a descriptive `Error`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* switch (mode) {
|
|
43
|
+
* case 'a': return doA();
|
|
44
|
+
* case 'b': return doB();
|
|
45
|
+
* default: assertNever(mode);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param value - The exhaustively-handled value, narrowed to `never` by control flow.
|
|
50
|
+
* @throws Always, if reached at runtime.
|
|
51
|
+
*/
|
|
52
|
+
export declare function assertNever(value: never): never;
|
|
53
|
+
/**
|
|
54
|
+
* Asserts that a value is not `null` or `undefined`, narrowing its type in place.
|
|
55
|
+
*
|
|
56
|
+
* Only callable when `T` includes `null` or `undefined`. Passing an already non-nullable type is a compile error.
|
|
57
|
+
*
|
|
58
|
+
* @typeParam T - The type of the value.
|
|
59
|
+
* @param value - The value to check.
|
|
60
|
+
* @param errorOrMessage - Optional {@link Error} or error message string.
|
|
61
|
+
* @throws If the value is `null` or `undefined`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function assertNonNullable<T extends NullableConstraint<T>>(value: T, errorOrMessage?: Error | string): asserts value is NonNullable<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Ensures that a value is a generic object, returning it with narrowed type.
|
|
66
|
+
*
|
|
67
|
+
* @typeParam T - The type of the value.
|
|
68
|
+
* @param $object - The value to ensure.
|
|
69
|
+
* @returns The value as a generic object.
|
|
70
|
+
*/
|
|
71
|
+
export declare function ensureGenericObject<T>($object: T): GenericObject<T>;
|
|
72
|
+
/**
|
|
73
|
+
* Ensures that a value is not `null` or `undefined` and returns it with narrowed type.
|
|
74
|
+
*
|
|
75
|
+
* Only callable when `T` includes `null` or `undefined`. Passing an already non-nullable type is a compile error.
|
|
76
|
+
*
|
|
77
|
+
* @typeParam T - The type of the value.
|
|
78
|
+
* @param value - The value to check.
|
|
79
|
+
* @param errorOrMessage - Optional {@link Error} or error message string.
|
|
80
|
+
* @returns The value with `null` and `undefined` excluded from its type.
|
|
81
|
+
* @throws If the value is `null` or `undefined`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function ensureNonNullable<T extends NullableConstraint<T>>(value: T, errorOrMessage?: Error | string): NonNullable<T>;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
3
|
+
if you want to view the source, please visit the github repository of this plugin
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function () {
|
|
7
|
+
function ensureDisposeSymbols(symbolConstructor = Symbol) {
|
|
8
|
+
symbolConstructor.asyncDispose ??= symbolConstructor.for('Symbol.asyncDispose');
|
|
9
|
+
symbolConstructor.dispose ??= symbolConstructor.for('Symbol.dispose');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function ensureBrowserProcess() {
|
|
13
|
+
const browserProcess = {
|
|
14
|
+
browser: true,
|
|
15
|
+
cwd() {
|
|
16
|
+
return '/';
|
|
17
|
+
},
|
|
18
|
+
env: {},
|
|
19
|
+
platform: 'android'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line obsidianmd/no-global-this, unicorn/no-unnecessary-global-this -- Must stay `globalThis`-qualified: in the emitted banner a bare `process` is a free identifier, so reading it where the host has none throws a ReferenceError instead of yielding `undefined`. That is the very case this function exists to handle.
|
|
23
|
+
const existingProcess = globalThis.process;
|
|
24
|
+
|
|
25
|
+
if (!existingProcess) {
|
|
26
|
+
// eslint-disable-next-line obsidianmd/no-global-this -- Actively use globalThis.
|
|
27
|
+
globalThis.process = browserProcess;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (existingProcess.versions?.node) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const existingProcessRecord = existingProcess;
|
|
36
|
+
|
|
37
|
+
for (const [key, value] of Object.entries(browserProcess)) {
|
|
38
|
+
existingProcessRecord[key] ??= value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
existingProcessRecord['browser'] = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
(function initEsm() {
|
|
45
|
+
ensureDisposeSymbols();
|
|
46
|
+
ensureBrowserProcess();
|
|
47
|
+
})();
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
import { noop } from "./function.mjs";
|
|
51
|
+
function assert(isTrue, errorOrMessage) {
|
|
52
|
+
if (!isTrue) {
|
|
53
|
+
throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function assertGenericObject(_object) {
|
|
57
|
+
noop();
|
|
58
|
+
}
|
|
59
|
+
function assertNever(value) {
|
|
60
|
+
throw new Error(`Unhandled value: ${String(value)}`);
|
|
61
|
+
}
|
|
62
|
+
function assertNonNullable(value, errorOrMessage) {
|
|
63
|
+
if (value !== null && value !== void 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
errorOrMessage ??= value === null ? "Value is null" : "Value is undefined";
|
|
67
|
+
const error = typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
function ensureGenericObject($object) {
|
|
71
|
+
return $object;
|
|
72
|
+
}
|
|
73
|
+
function ensureNonNullable(value, errorOrMessage) {
|
|
74
|
+
assertNonNullable(value, errorOrMessage);
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
assert,
|
|
79
|
+
assertGenericObject,
|
|
80
|
+
assertNever,
|
|
81
|
+
assertNonNullable,
|
|
82
|
+
ensureGenericObject,
|
|
83
|
+
ensureNonNullable
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic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|
|
7
|
+
import type { GenericFunction } from './function.mjs';
|
|
8
|
+
/**
|
|
9
|
+
* A type that represents the keys of an object as strings and asserts that all keys are present in a list of keys.
|
|
10
|
+
*
|
|
11
|
+
* @typeParam Type - The type of the object.
|
|
12
|
+
* @typeParam Keys - The list of keys to assert.
|
|
13
|
+
*/
|
|
14
|
+
export type ExactKeys<Type extends object, Keys extends readonly string[]> = ExactMembers<StringKeys<Type>, Keys>;
|
|
15
|
+
/**
|
|
16
|
+
* A type that represents the members of a type.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam Type - The type to assert the members of.
|
|
19
|
+
* @typeParam Keys - The list of members to assert.
|
|
20
|
+
*/
|
|
21
|
+
export type ExactMembers<Type extends LiteralKey, Keys extends readonly LiteralKey[]> = Exclude<Keys[number], Type> extends never ? Exclude<Type, Keys[number]> extends never ? Duplicates<Keys> extends [] ? Keys : `ERROR: Duplicate members: ${TupleToCSV<Duplicates<Keys>>}` : `ERROR: Missing members: ${TupleToCSV<UnionToTuple<Exclude<Type, Keys[number]>>>}` : `ERROR: Invalid members: ${TupleToCSV<UnionToTuple<Exclude<Keys[number], Type>>>}`;
|
|
22
|
+
/**
|
|
23
|
+
* Derives an event map (`{ eventName: [callbackArgs] }`) from a type exposing an overloaded `on(name, callback)`
|
|
24
|
+
* method — e.g. Obsidian's `Workspace` / `Vault` / `MetadataCache`. Each `on` overload becomes one entry keyed by
|
|
25
|
+
* the event name, with the callback's parameters as a labeled tuple; the wide `on(name: string, …)` catch-all
|
|
26
|
+
* overload is dropped. The map auto-tracks upstream overloads (no hand-authoring). It cannot reconstruct
|
|
27
|
+
* genuinely generic overloads, but Obsidian's event overloads are all concrete string-literal ones.
|
|
28
|
+
*
|
|
29
|
+
* @typeParam T - A type exposing an `on(name, callback, …)` method (e.g. an Obsidian `Events` subclass).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* type WorkspaceEventMap = ExtractEventMap<Workspace>;
|
|
34
|
+
* // { 'file-menu': [menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf]; … }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export type ExtractEventMap<T extends EventsWithOn> = UnionToIntersection<EntryOfOverload<OverloadUnion<T['on']>>>;
|
|
38
|
+
/**
|
|
39
|
+
* A type that represents a return value that may be `void`.
|
|
40
|
+
*
|
|
41
|
+
* @typeParam T - The type of the value that may be returned.
|
|
42
|
+
*/
|
|
43
|
+
export type MaybeReturn<T> = T | void;
|
|
44
|
+
/**
|
|
45
|
+
* A type that represents the values of an object.
|
|
46
|
+
*
|
|
47
|
+
* @typeParam T - The type of the object.
|
|
48
|
+
*/
|
|
49
|
+
export type PropertyValues<T extends object> = T[StringKeys<T>];
|
|
50
|
+
/**
|
|
51
|
+
* A type that represents the keys of an object as strings.
|
|
52
|
+
*
|
|
53
|
+
* @typeParam T - The type of the object.
|
|
54
|
+
*/
|
|
55
|
+
export type StringKeys<T extends object> = Extract<keyof T, string>;
|
|
56
|
+
type Duplicates<T extends readonly unknown[], Seen extends readonly unknown[] = [], Added extends readonly unknown[] = [], Out extends readonly unknown[] = []> = T extends readonly [infer First, ...infer Rest] ? Includes<Seen, First> extends true ? Includes<Added, First> extends true ? Duplicates<Rest, Seen, Added, Out> : Duplicates<Rest, Seen, [...Added, First], [...Out, First]> : Duplicates<Rest, [...Seen, First], Added, Out> : Out;
|
|
57
|
+
type EntryOfOverload<TOverload> = TOverload extends (name: infer Name, callback: (...$arguments: infer Arguments) => unknown, ...rest: never[]) => unknown ? Name extends string ? string extends Name ? never : Record<Name, Arguments> : never : never;
|
|
58
|
+
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
59
|
+
interface EventsWithOn {
|
|
60
|
+
on: GenericFunction;
|
|
61
|
+
}
|
|
62
|
+
type Includes<Type extends readonly unknown[], Member> = Type extends readonly [infer First, ...infer Rest] ? Equal<First, Member> extends true ? true : Includes<Rest, Member> : false;
|
|
63
|
+
type LastInUnion<Union> = UnionToIntersection<Union extends unknown ? () => Union : never> extends () => infer Last ? Last : never;
|
|
64
|
+
type LiteralKey = number | string;
|
|
65
|
+
type OverloadUnion<TOverload extends GenericFunction> = Exclude<OverloadUnionRecursive<(() => never) & TOverload>, TOverload extends () => never ? never : () => never>;
|
|
66
|
+
type OverloadUnionRecursive<TOverload, TPartialOverload = unknown> = TOverload extends (...$arguments: infer Arguments) => infer Return ? TPartialOverload extends TOverload ? never : OverloadUnionRecursive<TPartialOverload & TOverload, TPartialOverload & ((...$arguments: Arguments) => Return) & Pick<TOverload, keyof TOverload>> | ((...$arguments: Arguments) => Return) : never;
|
|
67
|
+
type ToString<T> = T extends number | string ? `${T}` : never;
|
|
68
|
+
type TupleToCSV<Tuple extends readonly unknown[]> = Tuple extends readonly [infer First, ...infer Rest] ? First extends LiteralKey ? Rest extends readonly unknown[] ? Rest['length'] extends 0 ? ToString<First> : `${ToString<First>},${TupleToCSV<Rest>}` : never : never : '';
|
|
69
|
+
/**
|
|
70
|
+
* Internal method shapes for {@link TypeAsserter}: a conditional type disables each method when the
|
|
71
|
+
* captured type does not support it.
|
|
72
|
+
*
|
|
73
|
+
* @typeParam Type - The captured type.
|
|
74
|
+
*/
|
|
75
|
+
interface TypeAssertions<Type> {
|
|
76
|
+
assertAllKeys: [Type] extends [object] ? <const Keys extends readonly string[]>(keys: ExactMembers<StringKeys<Type>, Keys>) => readonly (keyof Type)[] : never;
|
|
77
|
+
assertAllMembers: [Type] extends [LiteralKey] ? <const Keys extends readonly LiteralKey[]>(keys: ExactMembers<Type, Keys>) => readonly Type[] : never;
|
|
78
|
+
}
|
|
79
|
+
type UnionToIntersection<Union> = (Union extends unknown ? (key: Union) => void : never) extends (key: infer Intersection) => void ? Intersection : never;
|
|
80
|
+
type UnionToTuple<Union, Last = LastInUnion<Union>> = [Union] extends [never] ? [] : [...UnionToTuple<Exclude<Union, Last>>, Last];
|
|
81
|
+
/**
|
|
82
|
+
* A helper that captures a type parameter and provides methods for compile-time exhaustiveness checks.
|
|
83
|
+
*
|
|
84
|
+
* @typeParam Type - The captured type.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* - `assertAllKeys` is available when `Type` is an object type.
|
|
88
|
+
* - `assertAllMembers` is available when `Type` is a literal key union (`string | number`).
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* type A = { a: 1, b: 2, c: 3 };
|
|
93
|
+
* new TypeAsserter<A>().assertAllKeys(['a', 'b', 'c']); // OK
|
|
94
|
+
* new TypeAsserter<A>().assertAllKeys(['c', 'a', 'b']); // OK, order is ignored
|
|
95
|
+
* new TypeAsserter<A>().assertAllKeys(['a', 'b', 'c', 'd']); // Error: Invalid members: d
|
|
96
|
+
* new TypeAsserter<A>().assertAllKeys(['a', 'b']); // Error: Missing members: c
|
|
97
|
+
*
|
|
98
|
+
* type B = 1 | 2 | 3 | 'a';
|
|
99
|
+
* new TypeAsserter<B>().assertAllMembers([1, 2, 3, 'a']); // OK
|
|
100
|
+
* new TypeAsserter<B>().assertAllMembers([1, 2, 3, 'a', 4]); // Error: Invalid members: 4
|
|
101
|
+
* new TypeAsserter<B>().assertAllMembers([1, 2, 3]); // Error: Missing members: a
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare class TypeAsserter<Type> {
|
|
105
|
+
/**
|
|
106
|
+
* Asserts that all keys of an object type are present in a list of keys.
|
|
107
|
+
*
|
|
108
|
+
* @remarks Only available when `[Type] extends [object]`.
|
|
109
|
+
*/
|
|
110
|
+
readonly assertAllKeys: TypeAssertions<Type>['assertAllKeys'];
|
|
111
|
+
/**
|
|
112
|
+
* Asserts that all members of a union type are present in a list of members.
|
|
113
|
+
*
|
|
114
|
+
* @remarks Only available when `[Type] extends [LiteralKey]`.
|
|
115
|
+
*/
|
|
116
|
+
readonly assertAllMembers: TypeAssertions<Type>['assertAllMembers'];
|
|
117
|
+
/**
|
|
118
|
+
* Creates a type asserter that captures {@link Type} for compile-time exhaustiveness checks.
|
|
119
|
+
*/
|
|
120
|
+
constructor();
|
|
121
|
+
}
|
|
122
|
+
export {};
|