@veryfront/ext-content-mdx 0.1.1145 → 0.1.1147
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/esm/deno.d.ts +1 -0
- package/esm/deno.js +2 -1
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +3 -1
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +59 -20
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +2 -2
package/esm/deno.d.ts
CHANGED
|
@@ -285,6 +285,7 @@ declare namespace _default {
|
|
|
285
285
|
"#std/testing.ts": string;
|
|
286
286
|
"#std/testing/bdd": string;
|
|
287
287
|
"#std/testing/bdd.ts": string;
|
|
288
|
+
"#std/testing/mock": string;
|
|
288
289
|
"#std/testing/time": string;
|
|
289
290
|
"#std/testing/time.ts": string;
|
|
290
291
|
"#std/expect": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1147",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -345,6 +345,7 @@ export default {
|
|
|
345
345
|
"#std/testing.ts": "jsr:@std/testing@1.0.17",
|
|
346
346
|
"#std/testing/bdd": "jsr:@std/testing@1.0.17/bdd",
|
|
347
347
|
"#std/testing/bdd.ts": "jsr:@std/testing@1.0.17/bdd",
|
|
348
|
+
"#std/testing/mock": "jsr:@std/testing@1.0.17/mock",
|
|
348
349
|
"#std/testing/time": "jsr:@std/testing@1.0.17/time",
|
|
349
350
|
"#std/testing/time.ts": "jsr:@std/testing@1.0.17/time",
|
|
350
351
|
"#std/expect": "jsr:@std/expect@1.0.18",
|
|
@@ -5,7 +5,9 @@ export declare class Semaphore {
|
|
|
5
5
|
constructor(permits: number, options?: {
|
|
6
6
|
maxQueueSize?: number;
|
|
7
7
|
});
|
|
8
|
-
tryAcquire(timeoutMs?: number
|
|
8
|
+
tryAcquire(timeoutMs?: number, options?: {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}): Promise<boolean>;
|
|
9
11
|
release(): void;
|
|
10
12
|
get available(): number;
|
|
11
13
|
get waiting(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../../../../../../src/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"semaphore.d.ts","sourceRoot":"","sources":["../../../../../../src/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.ts"],"names":[],"mappings":"AAcA,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,SAAS,CAAyB;gBAE9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;IAKhE,UAAU,CACR,SAAS,SAA6B,EACtC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GACrC,OAAO,CAAC,OAAO,CAAC;IAqEnB,OAAO,IAAI,IAAI;IAgBf,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;CACF"}
|
|
@@ -9,39 +9,78 @@ export class Semaphore {
|
|
|
9
9
|
this.permits = permits;
|
|
10
10
|
this.maxQueueSize = options?.maxQueueSize ?? Infinity;
|
|
11
11
|
}
|
|
12
|
-
tryAcquire(timeoutMs = DEFAULT_ACQUIRE_TIMEOUT_MS) {
|
|
12
|
+
tryAcquire(timeoutMs = DEFAULT_ACQUIRE_TIMEOUT_MS, options = {}) {
|
|
13
|
+
const { signal } = options;
|
|
14
|
+
if (signal?.aborted) {
|
|
15
|
+
return Promise.reject(signal.reason ?? new DOMException("The operation was aborted", "AbortError"));
|
|
16
|
+
}
|
|
13
17
|
if (this.permits > 0) {
|
|
14
18
|
this.permits--;
|
|
15
19
|
return Promise.resolve(true);
|
|
16
20
|
}
|
|
21
|
+
if (timeoutMs <= 0) {
|
|
22
|
+
return Promise.resolve(false);
|
|
23
|
+
}
|
|
17
24
|
if (this.waitQueue.length >= this.maxQueueSize) {
|
|
18
25
|
return Promise.resolve(false);
|
|
19
26
|
}
|
|
20
|
-
return new Promise((resolve) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
clearTimeout(timeoutId);
|
|
27
|
-
resolve(true);
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const waiter = {
|
|
29
|
+
resolve,
|
|
30
|
+
reject,
|
|
31
|
+
settled: false,
|
|
32
|
+
signal,
|
|
28
33
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
return;
|
|
32
|
-
settled = true;
|
|
33
|
-
const index = this.waitQueue.findIndex((w) => w.resolve === onAcquire);
|
|
34
|
+
const removeWaiter = () => {
|
|
35
|
+
const index = this.waitQueue.indexOf(waiter);
|
|
34
36
|
if (index !== -1)
|
|
35
37
|
this.waitQueue.splice(index, 1);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
};
|
|
39
|
+
const cleanup = () => {
|
|
40
|
+
if (waiter.timeoutId !== undefined)
|
|
41
|
+
clearTimeout(waiter.timeoutId);
|
|
42
|
+
if (waiter.signal && waiter.onAbort) {
|
|
43
|
+
waiter.signal.removeEventListener("abort", waiter.onAbort);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
waiter.onAbort = () => {
|
|
47
|
+
if (waiter.settled)
|
|
48
|
+
return;
|
|
49
|
+
waiter.settled = true;
|
|
50
|
+
removeWaiter();
|
|
51
|
+
cleanup();
|
|
52
|
+
reject(signal?.reason ?? new DOMException("The operation was aborted", "AbortError"));
|
|
53
|
+
};
|
|
54
|
+
signal?.addEventListener("abort", waiter.onAbort, { once: true });
|
|
55
|
+
if (signal?.aborted) {
|
|
56
|
+
waiter.onAbort();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (Number.isFinite(timeoutMs)) {
|
|
60
|
+
waiter.timeoutId = dntShim.setTimeout(() => {
|
|
61
|
+
if (waiter.settled)
|
|
62
|
+
return;
|
|
63
|
+
waiter.settled = true;
|
|
64
|
+
removeWaiter();
|
|
65
|
+
cleanup();
|
|
66
|
+
resolve(false);
|
|
67
|
+
}, timeoutMs);
|
|
68
|
+
}
|
|
69
|
+
this.waitQueue.push(waiter);
|
|
39
70
|
});
|
|
40
71
|
}
|
|
41
72
|
release() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
next.
|
|
73
|
+
let next;
|
|
74
|
+
while ((next = this.waitQueue.shift())) {
|
|
75
|
+
if (next.settled)
|
|
76
|
+
continue;
|
|
77
|
+
next.settled = true;
|
|
78
|
+
if (next.timeoutId !== undefined)
|
|
79
|
+
clearTimeout(next.timeoutId);
|
|
80
|
+
if (next.signal && next.onAbort) {
|
|
81
|
+
next.signal.removeEventListener("abort", next.onAbort);
|
|
82
|
+
}
|
|
83
|
+
next.resolve(true);
|
|
45
84
|
return;
|
|
46
85
|
}
|
|
47
86
|
this.permits++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-content-mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1147",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-content-mdx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vfile": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"veryfront": "^0.1.
|
|
70
|
+
"veryfront": "^0.1.1147"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|