obsidian-dev-utils 32.0.1 → 32.0.2-beta.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/lib/cjs/AbortController.cjs +70 -12
  3. package/dist/lib/cjs/AbortController.d.cts +39 -2
  4. package/dist/lib/cjs/Array.cjs +4 -3
  5. package/dist/lib/cjs/Async.cjs +187 -100
  6. package/dist/lib/cjs/Async.d.cts +71 -26
  7. package/dist/lib/cjs/Debug.cjs +18 -14
  8. package/dist/lib/cjs/Error.cjs +37 -4
  9. package/dist/lib/cjs/Error.d.cts +16 -3
  10. package/dist/lib/cjs/Library.cjs +1 -1
  11. package/dist/lib/cjs/ScriptUtils/version.cjs +4 -4
  12. package/dist/lib/cjs/String.cjs +2 -2
  13. package/dist/lib/cjs/ValueProvider.cjs +2 -2
  14. package/dist/lib/cjs/obsidian/FileChange.cjs +3 -3
  15. package/dist/lib/cjs/obsidian/Link.cjs +3 -3
  16. package/dist/lib/cjs/obsidian/Logger.cjs +21 -10
  17. package/dist/lib/cjs/obsidian/Loop.cjs +5 -6
  18. package/dist/lib/cjs/obsidian/MarkdownCodeBlockProcessor.cjs +2 -2
  19. package/dist/lib/cjs/obsidian/Plugin/PluginBase.cjs +16 -4
  20. package/dist/lib/cjs/obsidian/Plugin/PluginBase.d.cts +7 -0
  21. package/dist/lib/cjs/obsidian/Queue.cjs +9 -10
  22. package/dist/lib/cjs/obsidian/RenameDeleteHandler.cjs +3 -3
  23. package/dist/lib/esm/AbortController.d.mts +39 -2
  24. package/dist/lib/esm/AbortController.mjs +65 -11
  25. package/dist/lib/esm/Array.mjs +4 -3
  26. package/dist/lib/esm/Async.d.mts +71 -26
  27. package/dist/lib/esm/Async.mjs +184 -100
  28. package/dist/lib/esm/Debug.mjs +18 -14
  29. package/dist/lib/esm/Error.d.mts +16 -3
  30. package/dist/lib/esm/Error.mjs +35 -3
  31. package/dist/lib/esm/Library.mjs +1 -1
  32. package/dist/lib/esm/ScriptUtils/version.mjs +4 -4
  33. package/dist/lib/esm/String.mjs +2 -2
  34. package/dist/lib/esm/ValueProvider.mjs +2 -2
  35. package/dist/lib/esm/obsidian/FileChange.mjs +3 -3
  36. package/dist/lib/esm/obsidian/Link.mjs +3 -3
  37. package/dist/lib/esm/obsidian/Logger.mjs +21 -10
  38. package/dist/lib/esm/obsidian/Loop.mjs +9 -8
  39. package/dist/lib/esm/obsidian/MarkdownCodeBlockProcessor.mjs +2 -2
  40. package/dist/lib/esm/obsidian/Plugin/PluginBase.d.mts +7 -0
  41. package/dist/lib/esm/obsidian/Plugin/PluginBase.mjs +16 -4
  42. package/dist/lib/esm/obsidian/Queue.mjs +9 -10
  43. package/dist/lib/esm/obsidian/RenameDeleteHandler.mjs +3 -3
  44. package/package.json +1 -1
@@ -6,9 +6,10 @@ if you want to view the source, please visit the github repository of this plugi
6
6
  (function initEsm(){if(globalThis.process){return}const browserProcess={browser:true,cwd:__name(()=>"/","cwd"),env:{},platform:"android"};globalThis.process=browserProcess})();
7
7
 
8
8
  function filterInPlace(arr, predicate) {
9
+ const length = arr.length;
9
10
  let writeIndex = 0;
10
- for (let readIndex = 0; readIndex < arr.length; readIndex++) {
11
- if (!(readIndex in arr)) {
11
+ for (let readIndex = 0; readIndex < length; readIndex++) {
12
+ if (!Object.hasOwn(arr, readIndex)) {
12
13
  continue;
13
14
  }
14
15
  const current = arr[readIndex];
@@ -43,4 +44,4 @@ export {
43
44
  unique,
44
45
  uniqueInPlace
45
46
  };
46
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL0FycmF5LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBwYWNrYWdlRG9jdW1lbnRhdGlvblxuICpcbiAqIEFycmF5IHV0aWxpdGllcy5cbiAqL1xuXG4vKipcbiAqIEZpbHRlciB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Q7QUFDQSxRQUFJLElBQUksS0FBSztBQUNiLFdBQU87QUFBQSxFQUNULENBQUM7QUFDSDsiLAogICJuYW1lcyI6IFtdCn0K
@@ -10,10 +10,6 @@ import type { Promisable } from 'type-fest';
10
10
  * @typeParam T - The type of the value.
11
11
  */
12
12
  export type PromiseResolve<T> = undefined extends T ? (value?: PromiseLike<T> | T) => void : (value: PromiseLike<T> | T) => void;
13
- /**
14
- * A constant representing an infinite timeout.
15
- */
16
- export declare const INFINITE_TIMEOUT: number;
17
13
  /**
18
14
  * Options for configuring the retry behavior.
19
15
  */
@@ -35,22 +31,14 @@ export interface RetryOptions {
35
31
  */
36
32
  timeoutInMilliseconds?: number;
37
33
  }
38
- /**
39
- * A marker interface to indicate that an error should terminate retry logic.
40
- */
41
- export interface TerminateRetry {
42
- /**
43
- * A marker property to indicate that an error should terminate retry logic.
44
- */
45
- __terminateRetry: true;
46
- }
47
34
  /**
48
35
  * Adds an error handler to a {@link Promise} that catches any errors and emits an async error event.
49
36
  *
50
37
  * @param asyncFn - The asynchronous function to add an error handler to.
38
+ * @param stackTrace - The stack trace of the source function.
51
39
  * @returns A {@link Promise} that resolves when the asynchronous function completes or emits async error event.
52
40
  */
53
- export declare function addErrorHandler(asyncFn: () => Promise<unknown>): Promise<void>;
41
+ export declare function addErrorHandler(asyncFn: () => Promise<unknown>, stackTrace?: string): Promise<void>;
54
42
  /**
55
43
  * Filters an array asynchronously, keeping only the elements that satisfy the provided predicate function.
56
44
  *
@@ -60,6 +48,15 @@ export declare function addErrorHandler(asyncFn: () => Promise<unknown>): Promis
60
48
  * @returns A {@link Promise} that resolves with an array of elements that satisfy the predicate function.
61
49
  */
62
50
  export declare function asyncFilter<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => Promisable<boolean>): Promise<T[]>;
51
+ /**
52
+ * Filters an array asynchronously in place, keeping only the elements that satisfy the provided predicate function.
53
+ *
54
+ * @typeParam T - The type of elements in the input array.
55
+ * @param arr - The array to filter.
56
+ * @param predicate - The predicate function to test each element.
57
+ * @returns A {@link Promise} that resolves when the array is filtered.
58
+ */
59
+ export declare function asyncFilterInPlace<T>(arr: T[], predicate: (value: T, index: number, array: T[]) => Promisable<boolean>): Promise<void>;
63
60
  /**
64
61
  * Maps over an array asynchronously, applying the provided callback function to each element, and then flattens the results into a single array.
65
62
  *
@@ -85,9 +82,10 @@ export declare function asyncMap<T, U>(arr: T[], callback: (value: T, index: num
85
82
  *
86
83
  * @typeParam Args - The types of the arguments the function accepts.
87
84
  * @param asyncFunc - The asynchronous function to convert.
85
+ * @param stackTrace - The stack trace of the source function.
88
86
  * @returns A function that wraps the asynchronous function in a synchronous interface.
89
87
  */
90
- export declare function convertAsyncToSync<Args extends unknown[]>(asyncFunc: (...args: Args) => Promise<unknown>): (...args: Args) => void;
88
+ export declare function convertAsyncToSync<Args extends unknown[]>(asyncFunc: (...args: Args) => Promise<unknown>, stackTrace?: string): (...args: Args) => void;
91
89
  /**
92
90
  * Converts a synchronous function to an asynchronous one by wrapping it in a {@link Promise}.
93
91
  *
@@ -109,22 +107,58 @@ export declare function ignoreError(promise: Promise<unknown>, fallbackValue?: u
109
107
  * Invokes a {@link Promise} and safely handles any errors by catching them and emitting an async error event.
110
108
  *
111
109
  * @param asyncFn - The asynchronous function to invoke safely.
110
+ * @param stackTrace - The stack trace of the source function.
112
111
  */
113
- export declare function invokeAsyncSafely(asyncFn: () => Promise<unknown>): void;
112
+ export declare function invokeAsyncSafely(asyncFn: () => Promise<unknown>, stackTrace?: string): void;
114
113
  /**
115
114
  * Invokes an asynchronous function after a delay.
116
115
  *
117
116
  * @param asyncFn - The asynchronous function to invoke.
118
117
  * @param delayInMilliseconds - The delay in milliseconds.
118
+ * @param stackTrace - The stack trace of the source function.
119
+ * @param abortSignal - The abort signal to listen to.
120
+ */
121
+ export declare function invokeAsyncSafelyAfterDelay(asyncFn: (abortSignal: AbortSignal) => Promisable<void>, delayInMilliseconds?: number, stackTrace?: string, abortSignal?: AbortSignal): void;
122
+ /**
123
+ * Executes async functions sequentially.
124
+ *
125
+ * @typeParam T - The type of the value.
126
+ * @param asyncFns - The async functions to execute sequentially.
127
+ * @returns A {@link Promise} that resolves with an array of the results of the async functions.
119
128
  */
120
- export declare function invokeAsyncSafelyAfterDelay(asyncFn: () => Promisable<unknown>, delayInMilliseconds?: number): void;
129
+ export declare function promiseAllAsyncFnsSequentially<T>(asyncFns: (() => Promisable<T>)[]): Promise<T[]>;
130
+ /**
131
+ * Executes promises sequentially.
132
+ *
133
+ * @typeParam T - The type of the value.
134
+ * @param promises - The promises to execute sequentially.
135
+ * @returns A {@link Promise} that resolves with an array of the results of the promises.
136
+ */
137
+ export declare function promiseAllSequentially<T>(promises: Promisable<T>[]): Promise<T[]>;
121
138
  /**
122
139
  * Marks an error to terminate retry logic.
123
140
  *
124
141
  * @param error - The error to mark to terminate retry logic.
125
- * @returns An error that should terminate retry logic.
126
142
  */
127
- export declare function marksAsTerminateRetry<TError extends Error>(error: TError): TerminateRetry & TError;
143
+ export declare function marksAsTerminateRetry(error: Error): void;
144
+ /**
145
+ * An async function that never ends.
146
+ *
147
+ * @returns A {@link Promise} that never resolves.
148
+ */
149
+ export declare function neverEnds(): Promise<never>;
150
+ /**
151
+ * Gets the next tick.
152
+ *
153
+ * @returns A promise that resolves when the next tick is available.
154
+ */
155
+ export declare function nextTickAsync(): Promise<void>;
156
+ /**
157
+ * Gets the next queue microtask.
158
+ *
159
+ * @returns A promise that resolves when the next queue microtask is available.
160
+ */
161
+ export declare function queueMicrotaskAsync(): Promise<void>;
128
162
  /**
129
163
  * Gets the next request animation frame.
130
164
  *
@@ -149,30 +183,41 @@ export declare function retryWithTimeout(fn: (abortSignal: AbortSignal) => Promi
149
183
  * @param timeoutInMilliseconds - The maximum time to wait in milliseconds.
150
184
  * @param fn - The function to execute.
151
185
  * @param context - The context of the function.
186
+ * @param stackTrace - The stack trace of the source function.
152
187
  * @returns A {@link Promise} that resolves with the result of the asynchronous function or rejects if it times out.
153
188
  */
154
- export declare function runWithTimeout<R>(timeoutInMilliseconds: number, fn: (abortSignal: AbortSignal) => Promisable<R>, context?: unknown): Promise<R>;
189
+ export declare function runWithTimeout<R>(timeoutInMilliseconds: number, fn: (abortSignal: AbortSignal) => Promisable<R>, context?: unknown, stackTrace?: string): Promise<R>;
190
+ /**
191
+ * Gets the next set immediate.
192
+ *
193
+ * @returns A promise that resolves when the next set immediate is available.
194
+ */
195
+ export declare function setImmediateAsync(): Promise<void>;
155
196
  /**
156
197
  * Delays execution for a specified number of milliseconds.
157
198
  *
158
- * @param milliseconds - The time to wait in milliseconds.
199
+ * @param delay - The time to wait in milliseconds.
159
200
  * @returns A {@link Promise} that resolves after the specified delay.
160
201
  */
161
- export declare function sleep(milliseconds: number): Promise<void>;
202
+ export declare function setTimeoutAsync(delay?: number): Promise<void>;
162
203
  /**
163
- * Returns a {@link Promise} that rejects when the abort signal is aborted.
204
+ * Delays execution for a specified number of milliseconds.
164
205
  *
206
+ * @param milliseconds - The time to wait in milliseconds.
165
207
  * @param abortSignal - The abort signal to listen to.
166
- * @returns A {@link Promise} that rejects when the abort signal is aborted.
208
+ * @param shouldThrowOnAbort - Whether to throw an error if the abort signal is aborted.
209
+ * @returns A {@link Promise} that resolves after the specified delay.
167
210
  */
168
- export declare function throwOnAbort(abortSignal: AbortSignal): Promise<void>;
211
+ export declare function sleep(milliseconds: number, abortSignal?: AbortSignal, shouldThrowOnAbort?: boolean): Promise<void>;
169
212
  /**
170
213
  * Returns a {@link Promise} that rejects after the specified timeout period.
171
214
  *
172
215
  * @param timeoutInMilliseconds - The timeout period in milliseconds.
216
+ * @param abortSignal - The abort signal to listen to.
217
+ * @param shouldThrowOnAbort - Whether to throw an error if the abort signal is aborted.
173
218
  * @returns A {@link Promise} that always rejects with a timeout error.
174
219
  */
175
- export declare function timeout(timeoutInMilliseconds: number): Promise<never>;
220
+ export declare function timeout(timeoutInMilliseconds: number, abortSignal?: AbortSignal, shouldThrowOnAbort?: boolean): Promise<never>;
176
221
  /**
177
222
  * Converts an AsyncIterableIterator to an array by consuming all its elements.
178
223
  *