@fuzdev/fuz_util 0.50.1 → 0.52.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/dist/async.d.ts +21 -15
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +134 -75
- package/dist/path.d.ts +8 -2
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +8 -2
- package/dist/process.d.ts +4 -1
- package/dist/process.d.ts.map +1 -1
- package/dist/process.js +4 -1
- package/dist/source_json.d.ts +106 -6
- package/dist/source_json.d.ts.map +1 -1
- package/dist/source_json.js +27 -2
- package/package.json +10 -6
- package/src/lib/async.ts +146 -83
- package/src/lib/path.ts +8 -2
- package/src/lib/process.ts +4 -1
- package/src/lib/source_json.ts +27 -2
package/dist/async.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const wait: (duration?: number) => Promise<void>;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const is_promise: (value: unknown) => value is Promise<unknown>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* A deferred object with a promise and its resolve/reject handlers.
|
|
12
12
|
*/
|
|
13
13
|
export interface Deferred<T> {
|
|
14
14
|
promise: Promise<T>;
|
|
@@ -16,57 +16,63 @@ export interface Deferred<T> {
|
|
|
16
16
|
reject: (reason: any) => void;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Creates
|
|
19
|
+
* Creates an object with a `promise` and its `resolve`/`reject` handlers.
|
|
20
20
|
*/
|
|
21
21
|
export declare const create_deferred: <T>() => Deferred<T>;
|
|
22
22
|
/**
|
|
23
|
-
* Runs
|
|
23
|
+
* Runs a function on each item with controlled concurrency.
|
|
24
24
|
* Like `map_concurrent` but doesn't collect results (more efficient for side effects).
|
|
25
25
|
*
|
|
26
|
-
* @param items
|
|
27
|
-
* @param fn async function to apply to each item
|
|
26
|
+
* @param items items to process
|
|
28
27
|
* @param concurrency maximum number of concurrent operations
|
|
28
|
+
* @param fn function to apply to each item
|
|
29
|
+
* @param signal optional `AbortSignal` to cancel processing
|
|
29
30
|
*
|
|
30
31
|
* @example
|
|
31
32
|
* ```ts
|
|
32
33
|
* await each_concurrent(
|
|
33
34
|
* file_paths,
|
|
34
|
-
* async (path) => { await unlink(path); },
|
|
35
35
|
* 5, // max 5 concurrent deletions
|
|
36
|
+
* async (path) => { await unlink(path); },
|
|
36
37
|
* );
|
|
37
38
|
* ```
|
|
38
39
|
*/
|
|
39
|
-
export declare const each_concurrent: <T>(items:
|
|
40
|
+
export declare const each_concurrent: <T>(items: Iterable<T>, concurrency: number, fn: (item: T, index: number) => Promise<void> | void, signal?: AbortSignal) => Promise<void>;
|
|
40
41
|
/**
|
|
41
42
|
* Maps over items with controlled concurrency, preserving input order.
|
|
42
43
|
*
|
|
43
|
-
* @param items
|
|
44
|
-
* @param fn async function to apply to each item
|
|
44
|
+
* @param items items to process
|
|
45
45
|
* @param concurrency maximum number of concurrent operations
|
|
46
|
+
* @param fn function to apply to each item
|
|
47
|
+
* @param signal optional `AbortSignal` to cancel processing
|
|
46
48
|
* @returns promise resolving to array of results in same order as input
|
|
47
49
|
*
|
|
48
50
|
* @example
|
|
49
51
|
* ```ts
|
|
50
52
|
* const results = await map_concurrent(
|
|
51
53
|
* file_paths,
|
|
52
|
-
* async (path) => readFile(path, 'utf8'),
|
|
53
54
|
* 5, // max 5 concurrent reads
|
|
55
|
+
* async (path) => readFile(path, 'utf8'),
|
|
54
56
|
* );
|
|
55
57
|
* ```
|
|
56
58
|
*/
|
|
57
|
-
export declare const map_concurrent: <T, R>(items:
|
|
59
|
+
export declare const map_concurrent: <T, R>(items: Iterable<T>, concurrency: number, fn: (item: T, index: number) => Promise<R> | R, signal?: AbortSignal) => Promise<Array<R>>;
|
|
58
60
|
/**
|
|
59
61
|
* Like `map_concurrent` but collects all results/errors instead of failing fast.
|
|
60
62
|
* Returns an array of settlement objects matching the `Promise.allSettled` pattern.
|
|
61
63
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
+
* On abort, resolves with partial results: completed items keep their real settlements,
|
|
65
|
+
* in-flight and un-started items are settled as rejected with the abort reason.
|
|
66
|
+
*
|
|
67
|
+
* @param items items to process
|
|
64
68
|
* @param concurrency maximum number of concurrent operations
|
|
69
|
+
* @param fn function to apply to each item
|
|
70
|
+
* @param signal optional `AbortSignal` to cancel processing
|
|
65
71
|
* @returns promise resolving to array of `PromiseSettledResult` objects in input order
|
|
66
72
|
*
|
|
67
73
|
* @example
|
|
68
74
|
* ```ts
|
|
69
|
-
* const results = await map_concurrent_settled(urls,
|
|
75
|
+
* const results = await map_concurrent_settled(urls, 5, fetch);
|
|
70
76
|
* for (const [i, result] of results.entries()) {
|
|
71
77
|
* if (result.status === 'fulfilled') {
|
|
72
78
|
* console.log(`${urls[i]}: ${result.value.status}`);
|
|
@@ -76,7 +82,7 @@ export declare const map_concurrent: <T, R>(items: Array<T>, fn: (item: T, index
|
|
|
76
82
|
* }
|
|
77
83
|
* ```
|
|
78
84
|
*/
|
|
79
|
-
export declare const map_concurrent_settled: <T, R>(items:
|
|
85
|
+
export declare const map_concurrent_settled: <T, R>(items: Iterable<T>, concurrency: number, fn: (item: T, index: number) => Promise<R> | R, signal?: AbortSignal) => Promise<Array<PromiseSettledResult<R>>>;
|
|
80
86
|
/**
|
|
81
87
|
* Async semaphore for concurrency limiting.
|
|
82
88
|
*
|
package/dist/async.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/async.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,iBAAY,KAAG,OAAO,CAAC,IAAI,CACQ,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAO,CAAC,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,SAAS,WAAW,KAClB,OAAO,CAAC,IAAI,CA6Dd,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,EAAE,CAAC,EACxC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAClB,aAAa,MAAM,EACnB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAC9C,SAAS,WAAW,KAClB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CA+DlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,sBAAsB,GAAU,CAAC,EAAE,CAAC,EAChD,OAAO,QAAQ,CAAC,CAAC,CAAC,EAClB,aAAa,MAAM,EACnB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAC9C,SAAS,WAAW,KAClB,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAsExC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAc;;gBAId,OAAO,EAAE,MAAM;IAO3B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUxB,OAAO,IAAI,IAAI;CAQf"}
|
package/dist/async.js
CHANGED
|
@@ -7,7 +7,7 @@ export const wait = (duration = 0) => new Promise((resolve) => setTimeout(resolv
|
|
|
7
7
|
*/
|
|
8
8
|
export const is_promise = (value) => value != null && typeof value.then === 'function';
|
|
9
9
|
/**
|
|
10
|
-
* Creates
|
|
10
|
+
* Creates an object with a `promise` and its `resolve`/`reject` handlers.
|
|
11
11
|
*/
|
|
12
12
|
export const create_deferred = () => {
|
|
13
13
|
let resolve;
|
|
@@ -19,108 +19,142 @@ export const create_deferred = () => {
|
|
|
19
19
|
return { promise, resolve, reject };
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
* Runs
|
|
22
|
+
* Runs a function on each item with controlled concurrency.
|
|
23
23
|
* Like `map_concurrent` but doesn't collect results (more efficient for side effects).
|
|
24
24
|
*
|
|
25
|
-
* @param items
|
|
26
|
-
* @param fn async function to apply to each item
|
|
25
|
+
* @param items items to process
|
|
27
26
|
* @param concurrency maximum number of concurrent operations
|
|
27
|
+
* @param fn function to apply to each item
|
|
28
|
+
* @param signal optional `AbortSignal` to cancel processing
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* ```ts
|
|
31
32
|
* await each_concurrent(
|
|
32
33
|
* file_paths,
|
|
33
|
-
* async (path) => { await unlink(path); },
|
|
34
34
|
* 5, // max 5 concurrent deletions
|
|
35
|
+
* async (path) => { await unlink(path); },
|
|
35
36
|
* );
|
|
36
37
|
* ```
|
|
37
38
|
*/
|
|
38
|
-
export const each_concurrent = async (items, fn,
|
|
39
|
-
if (concurrency
|
|
39
|
+
export const each_concurrent = async (items, concurrency, fn, signal) => {
|
|
40
|
+
if (!(concurrency >= 1)) {
|
|
40
41
|
throw new Error('concurrency must be at least 1');
|
|
41
42
|
}
|
|
43
|
+
const iterator = items[Symbol.iterator]();
|
|
42
44
|
let next_index = 0;
|
|
43
45
|
let active_count = 0;
|
|
44
46
|
let rejected = false;
|
|
45
47
|
return new Promise((resolve, reject) => {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
+
const cleanup = signal ? () => signal.removeEventListener('abort', on_abort) : undefined;
|
|
49
|
+
const done = () => {
|
|
50
|
+
cleanup?.();
|
|
51
|
+
resolve();
|
|
52
|
+
};
|
|
53
|
+
const fail = (error) => {
|
|
48
54
|
if (rejected)
|
|
49
55
|
return;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
rejected = true;
|
|
57
|
+
cleanup?.();
|
|
58
|
+
reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors
|
|
59
|
+
};
|
|
60
|
+
function on_abort() {
|
|
61
|
+
fail(signal.reason);
|
|
62
|
+
}
|
|
63
|
+
if (signal?.aborted) {
|
|
64
|
+
fail(signal.reason);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
signal?.addEventListener('abort', on_abort);
|
|
68
|
+
const run_next = () => {
|
|
69
|
+
if (rejected)
|
|
53
70
|
return;
|
|
54
|
-
}
|
|
55
71
|
// Spawn workers up to concurrency limit
|
|
56
|
-
while (active_count < concurrency
|
|
72
|
+
while (active_count < concurrency) {
|
|
73
|
+
const next = iterator.next();
|
|
74
|
+
if (next.done) {
|
|
75
|
+
if (active_count === 0)
|
|
76
|
+
done();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
57
79
|
const index = next_index++;
|
|
58
|
-
const item =
|
|
80
|
+
const item = next.value;
|
|
59
81
|
active_count++;
|
|
60
|
-
fn(item, index)
|
|
82
|
+
new Promise((r) => r(fn(item, index)))
|
|
61
83
|
.then(() => {
|
|
62
84
|
if (rejected)
|
|
63
85
|
return;
|
|
64
86
|
active_count--;
|
|
65
87
|
run_next();
|
|
66
88
|
})
|
|
67
|
-
.catch(
|
|
68
|
-
if (rejected)
|
|
69
|
-
return;
|
|
70
|
-
rejected = true;
|
|
71
|
-
reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors
|
|
72
|
-
});
|
|
89
|
+
.catch(fail);
|
|
73
90
|
}
|
|
74
91
|
};
|
|
75
|
-
// Handle empty array
|
|
76
|
-
if (items.length === 0) {
|
|
77
|
-
resolve();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
92
|
run_next();
|
|
81
93
|
});
|
|
82
94
|
};
|
|
83
95
|
/**
|
|
84
96
|
* Maps over items with controlled concurrency, preserving input order.
|
|
85
97
|
*
|
|
86
|
-
* @param items
|
|
87
|
-
* @param fn async function to apply to each item
|
|
98
|
+
* @param items items to process
|
|
88
99
|
* @param concurrency maximum number of concurrent operations
|
|
100
|
+
* @param fn function to apply to each item
|
|
101
|
+
* @param signal optional `AbortSignal` to cancel processing
|
|
89
102
|
* @returns promise resolving to array of results in same order as input
|
|
90
103
|
*
|
|
91
104
|
* @example
|
|
92
105
|
* ```ts
|
|
93
106
|
* const results = await map_concurrent(
|
|
94
107
|
* file_paths,
|
|
95
|
-
* async (path) => readFile(path, 'utf8'),
|
|
96
108
|
* 5, // max 5 concurrent reads
|
|
109
|
+
* async (path) => readFile(path, 'utf8'),
|
|
97
110
|
* );
|
|
98
111
|
* ```
|
|
99
112
|
*/
|
|
100
|
-
export const map_concurrent = async (items, fn,
|
|
101
|
-
if (concurrency
|
|
113
|
+
export const map_concurrent = async (items, concurrency, fn, signal) => {
|
|
114
|
+
if (!(concurrency >= 1)) {
|
|
102
115
|
throw new Error('concurrency must be at least 1');
|
|
103
116
|
}
|
|
104
|
-
const results =
|
|
117
|
+
const results = [];
|
|
118
|
+
const iterator = items[Symbol.iterator]();
|
|
105
119
|
let next_index = 0;
|
|
106
120
|
let active_count = 0;
|
|
107
121
|
let rejected = false;
|
|
108
122
|
return new Promise((resolve, reject) => {
|
|
109
|
-
const
|
|
110
|
-
|
|
123
|
+
const cleanup = signal ? () => signal.removeEventListener('abort', on_abort) : undefined;
|
|
124
|
+
const done = () => {
|
|
125
|
+
cleanup?.();
|
|
126
|
+
resolve(results);
|
|
127
|
+
};
|
|
128
|
+
const fail = (error) => {
|
|
111
129
|
if (rejected)
|
|
112
130
|
return;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
rejected = true;
|
|
132
|
+
cleanup?.();
|
|
133
|
+
reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors
|
|
134
|
+
};
|
|
135
|
+
function on_abort() {
|
|
136
|
+
fail(signal.reason);
|
|
137
|
+
}
|
|
138
|
+
if (signal?.aborted) {
|
|
139
|
+
fail(signal.reason);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
signal?.addEventListener('abort', on_abort);
|
|
143
|
+
const run_next = () => {
|
|
144
|
+
if (rejected)
|
|
116
145
|
return;
|
|
117
|
-
}
|
|
118
146
|
// Spawn workers up to concurrency limit
|
|
119
|
-
while (active_count < concurrency
|
|
147
|
+
while (active_count < concurrency) {
|
|
148
|
+
const next = iterator.next();
|
|
149
|
+
if (next.done) {
|
|
150
|
+
if (active_count === 0)
|
|
151
|
+
done();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
120
154
|
const index = next_index++;
|
|
121
|
-
const item =
|
|
155
|
+
const item = next.value;
|
|
122
156
|
active_count++;
|
|
123
|
-
fn(item, index)
|
|
157
|
+
new Promise((r) => r(fn(item, index)))
|
|
124
158
|
.then((result) => {
|
|
125
159
|
if (rejected)
|
|
126
160
|
return;
|
|
@@ -128,19 +162,9 @@ export const map_concurrent = async (items, fn, concurrency) => {
|
|
|
128
162
|
active_count--;
|
|
129
163
|
run_next();
|
|
130
164
|
})
|
|
131
|
-
.catch(
|
|
132
|
-
if (rejected)
|
|
133
|
-
return;
|
|
134
|
-
rejected = true;
|
|
135
|
-
reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors
|
|
136
|
-
});
|
|
165
|
+
.catch(fail);
|
|
137
166
|
}
|
|
138
167
|
};
|
|
139
|
-
// Handle empty array
|
|
140
|
-
if (items.length === 0) {
|
|
141
|
-
resolve(results);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
168
|
run_next();
|
|
145
169
|
});
|
|
146
170
|
};
|
|
@@ -148,14 +172,18 @@ export const map_concurrent = async (items, fn, concurrency) => {
|
|
|
148
172
|
* Like `map_concurrent` but collects all results/errors instead of failing fast.
|
|
149
173
|
* Returns an array of settlement objects matching the `Promise.allSettled` pattern.
|
|
150
174
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
175
|
+
* On abort, resolves with partial results: completed items keep their real settlements,
|
|
176
|
+
* in-flight and un-started items are settled as rejected with the abort reason.
|
|
177
|
+
*
|
|
178
|
+
* @param items items to process
|
|
153
179
|
* @param concurrency maximum number of concurrent operations
|
|
180
|
+
* @param fn function to apply to each item
|
|
181
|
+
* @param signal optional `AbortSignal` to cancel processing
|
|
154
182
|
* @returns promise resolving to array of `PromiseSettledResult` objects in input order
|
|
155
183
|
*
|
|
156
184
|
* @example
|
|
157
185
|
* ```ts
|
|
158
|
-
* const results = await map_concurrent_settled(urls,
|
|
186
|
+
* const results = await map_concurrent_settled(urls, 5, fetch);
|
|
159
187
|
* for (const [i, result] of results.entries()) {
|
|
160
188
|
* if (result.status === 'fulfilled') {
|
|
161
189
|
* console.log(`${urls[i]}: ${result.value.status}`);
|
|
@@ -165,43 +193,71 @@ export const map_concurrent = async (items, fn, concurrency) => {
|
|
|
165
193
|
* }
|
|
166
194
|
* ```
|
|
167
195
|
*/
|
|
168
|
-
export const map_concurrent_settled = async (items, fn,
|
|
169
|
-
if (concurrency
|
|
196
|
+
export const map_concurrent_settled = async (items, concurrency, fn, signal) => {
|
|
197
|
+
if (!(concurrency >= 1)) {
|
|
170
198
|
throw new Error('concurrency must be at least 1');
|
|
171
199
|
}
|
|
172
|
-
const results =
|
|
200
|
+
const results = [];
|
|
201
|
+
const iterator = items[Symbol.iterator]();
|
|
173
202
|
let next_index = 0;
|
|
174
203
|
let active_count = 0;
|
|
204
|
+
let aborted = false;
|
|
175
205
|
return new Promise((resolve) => {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
206
|
+
const cleanup = signal ? () => signal.removeEventListener('abort', on_abort) : undefined;
|
|
207
|
+
const done = () => {
|
|
208
|
+
cleanup?.();
|
|
209
|
+
resolve(results);
|
|
210
|
+
};
|
|
211
|
+
function on_abort() {
|
|
212
|
+
if (aborted)
|
|
180
213
|
return;
|
|
214
|
+
aborted = true;
|
|
215
|
+
cleanup?.();
|
|
216
|
+
// Settle in-flight items as rejected with the abort reason
|
|
217
|
+
const reason = signal.reason;
|
|
218
|
+
for (let i = 0; i < next_index; i++) {
|
|
219
|
+
if (!(i in results)) {
|
|
220
|
+
results[i] = { status: 'rejected', reason };
|
|
221
|
+
}
|
|
181
222
|
}
|
|
223
|
+
resolve(results);
|
|
224
|
+
}
|
|
225
|
+
if (signal?.aborted) {
|
|
226
|
+
resolve(results);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
signal?.addEventListener('abort', on_abort);
|
|
230
|
+
const run_next = () => {
|
|
231
|
+
if (aborted)
|
|
232
|
+
return;
|
|
182
233
|
// Spawn workers up to concurrency limit
|
|
183
|
-
while (active_count < concurrency
|
|
234
|
+
while (active_count < concurrency) {
|
|
235
|
+
const next = iterator.next();
|
|
236
|
+
if (next.done) {
|
|
237
|
+
if (active_count === 0)
|
|
238
|
+
done();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
184
241
|
const index = next_index++;
|
|
185
|
-
const item =
|
|
242
|
+
const item = next.value;
|
|
186
243
|
active_count++;
|
|
187
|
-
fn(item, index)
|
|
244
|
+
new Promise((r) => r(fn(item, index)))
|
|
188
245
|
.then((value) => {
|
|
189
|
-
|
|
246
|
+
if (!aborted)
|
|
247
|
+
results[index] = { status: 'fulfilled', value };
|
|
190
248
|
})
|
|
191
249
|
.catch((reason) => {
|
|
192
|
-
|
|
250
|
+
if (!aborted)
|
|
251
|
+
results[index] = { status: 'rejected', reason };
|
|
193
252
|
})
|
|
194
253
|
.finally(() => {
|
|
254
|
+
if (aborted)
|
|
255
|
+
return;
|
|
195
256
|
active_count--;
|
|
196
257
|
run_next();
|
|
197
258
|
});
|
|
198
259
|
}
|
|
199
260
|
};
|
|
200
|
-
// Handle empty array
|
|
201
|
-
if (items.length === 0) {
|
|
202
|
-
resolve(results);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
261
|
run_next();
|
|
206
262
|
});
|
|
207
263
|
};
|
|
@@ -214,12 +270,15 @@ export class AsyncSemaphore {
|
|
|
214
270
|
#permits;
|
|
215
271
|
#waiters = [];
|
|
216
272
|
constructor(permits) {
|
|
273
|
+
if (!(permits >= 0)) {
|
|
274
|
+
throw new Error('permits must be >= 0');
|
|
275
|
+
}
|
|
217
276
|
this.#permits = permits;
|
|
218
277
|
}
|
|
219
|
-
|
|
278
|
+
acquire() {
|
|
220
279
|
if (this.#permits > 0) {
|
|
221
280
|
this.#permits--;
|
|
222
|
-
return;
|
|
281
|
+
return Promise.resolve();
|
|
223
282
|
}
|
|
224
283
|
return new Promise((resolve) => {
|
|
225
284
|
this.#waiters.push(resolve);
|
package/dist/path.d.ts
CHANGED
|
@@ -29,12 +29,18 @@ export type FileFilter = (path: string) => boolean;
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const to_file_path: (path_or_url: string | URL) => string;
|
|
31
31
|
/**
|
|
32
|
-
* @example
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* parse_path_parts('./foo/bar/baz.ts') // => ['foo', 'foo/bar', 'foo/bar/baz.ts']
|
|
35
|
+
* ```
|
|
33
36
|
*/
|
|
34
37
|
export declare const parse_path_parts: (path: string) => Array<string>;
|
|
35
38
|
/**
|
|
36
39
|
* Gets the individual parts of a path, ignoring dots and separators.
|
|
37
|
-
* @example
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* parse_path_segments('/foo/bar/baz.ts') // => ['foo', 'bar', 'baz.ts']
|
|
43
|
+
* ```
|
|
38
44
|
*/
|
|
39
45
|
export declare const parse_path_segments: (path: string) => Array<string>;
|
|
40
46
|
/**
|
package/dist/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WA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;AAE7D;;GAEG;AACH,MAAM,MAAM,SAAS,GAClB;IACA,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACZ,GACD;IACA,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACZ,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,KAAG,KAAK,CAAC,SAAS,CAgBnE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAC/B,UAAU,MAAM,GAAG,SAAS,EAC5B,SAAS,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,KAC7B,OAKF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,gCAA6B,KAAG,MAYpE,CAAC"}
|
package/dist/path.js
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const to_file_path = (path_or_url) => typeof path_or_url === 'string' ? path_or_url : decodeURIComponent(path_or_url.pathname);
|
|
5
5
|
/**
|
|
6
|
-
* @example
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* parse_path_parts('./foo/bar/baz.ts') // => ['foo', 'foo/bar', 'foo/bar/baz.ts']
|
|
9
|
+
* ```
|
|
7
10
|
*/
|
|
8
11
|
export const parse_path_parts = (path) => {
|
|
9
12
|
const segments = parse_path_segments(path);
|
|
@@ -18,7 +21,10 @@ export const parse_path_parts = (path) => {
|
|
|
18
21
|
};
|
|
19
22
|
/**
|
|
20
23
|
* Gets the individual parts of a path, ignoring dots and separators.
|
|
21
|
-
* @example
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* parse_path_segments('/foo/bar/baz.ts') // => ['foo', 'bar', 'baz.ts']
|
|
27
|
+
* ```
|
|
22
28
|
*/
|
|
23
29
|
export const parse_path_segments = (path) => path.split('/').filter((s) => s && s !== '.' && s !== '..');
|
|
24
30
|
/**
|
package/dist/process.d.ts
CHANGED
|
@@ -289,7 +289,10 @@ export declare const spawn_detached: (command: string, args?: ReadonlyArray<stri
|
|
|
289
289
|
/**
|
|
290
290
|
* Formats a child process for display.
|
|
291
291
|
*
|
|
292
|
-
* @example
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* `pid(1234) <- node server.js`
|
|
295
|
+
* ```
|
|
293
296
|
*/
|
|
294
297
|
export declare const print_child_process: (child: ChildProcess) => string;
|
|
295
298
|
/**
|
package/dist/process.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/process.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,IAAI,wBAAwB,EACjC,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,oBAAoB,CAAC;AAa5B;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,IAAI,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,iBA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-401,7 +401,10 @@ export const spawn_detached = (command, args = [], options) => {
|
|
|
401
401
|
/**
|
|
402
402
|
* Formats a child process for display.
|
|
403
403
|
*
|
|
404
|
-
* @example
|
|
404
|
+
* @example
|
|
405
|
+
* ```ts
|
|
406
|
+
* `pid(1234) <- node server.js`
|
|
407
|
+
* ```
|
|
405
408
|
*/
|
|
406
409
|
export const print_child_process = (child) => `${st('gray', 'pid(')}${child.pid ?? 'none'}${st('gray', ')')} ← ${st('green', child.spawnargs.join(' '))}`;
|
|
407
410
|
/**
|