@takeshape/util 11.99.2 → 11.102.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/dist/common/abort.d.ts +1 -0
- package/dist/common/abort.js +16 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function abortable<T>(signal: AbortSignal, promise: Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function abortable(signal, promise) {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
if (signal.aborted) {
|
|
4
|
+
reject(signal.reason);
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const onAbort = () => {
|
|
8
|
+
reject(signal.reason);
|
|
9
|
+
};
|
|
10
|
+
promise.then(resolve, reject).finally(() => {
|
|
11
|
+
signal.removeEventListener('abort', onAbort);
|
|
12
|
+
});
|
|
13
|
+
// Watch for 'abort' signals
|
|
14
|
+
signal.addEventListener('abort', onAbort);
|
|
15
|
+
});
|
|
16
|
+
}
|
package/dist/common/index.d.ts
CHANGED
package/dist/common/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/util",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.102.1",
|
|
4
4
|
"description": "Shared utilities",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"tiny-invariant": "^1.2.0",
|
|
46
46
|
"uint8array-extras": "^1.4.0",
|
|
47
47
|
"url-parse": "^1.5.3",
|
|
48
|
-
"@takeshape/prism": "11.
|
|
49
|
-
"@takeshape/routing": "11.
|
|
48
|
+
"@takeshape/prism": "11.102.1",
|
|
49
|
+
"@takeshape/routing": "11.102.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/classnames": "^2.2.9",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"stripe": "13.8.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
64
|
+
"node": ">=22"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"build:ci": "pnpm build --noCheck",
|
|
70
70
|
"clean": "del-cli dist coverage *.tsbuildinfo",
|
|
71
71
|
"lint": "trap 'RC=1' ERR; pnpm lint:biome; pnpm lint:eslint; exit $RC",
|
|
72
|
-
"lint:biome": "biome check",
|
|
72
|
+
"lint:biome": "biome check ./",
|
|
73
73
|
"lint:eslint": "eslint src -c ../../eslint.config.mjs",
|
|
74
|
-
"lint:ci:biome": "mkdir -p \"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}\" && biome check --diagnostic-level error --reporter=junit > \"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}/biome-results.xml\"",
|
|
74
|
+
"lint:ci:biome": "mkdir -p \"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}\" && biome check ./ --diagnostic-level error --reporter=junit > \"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}/biome-results.xml\"",
|
|
75
75
|
"lint:ci:eslint": "ESLINT_SUITE_NAME=${npm_package_name} ESLINT_JUNIT_OUTPUT=\"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}/eslint-results.xml\" pnpm lint:eslint --quiet --format ../../node_modules/eslint-junit/index.js",
|
|
76
76
|
"test": "TZ=UTC vitest run",
|
|
77
77
|
"test:ci": "TZ=UTC vitest run --reporter=default --reporter=junit --outputFile=\"${GITHUB_WORKSPACE}/test-results/${npm_package_name#*\\/}/vitest-results.xml\" --coverage.enabled --coverage.reportsDirectory=\"${GITHUB_WORKSPACE}/coverage/${npm_package_name#*\\/}\"",
|