diff --git a/package.json b/package.json index b1e7624..78c9920 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "type-check": "tsc --noEmit" }, "devDependencies": { - "@biomejs/biome": "^1.8.3", "@dcloudio/types": "^3.4.12", "@lerna-lite/cli": "^3.8.0", "@lerna-lite/version": "^3.8.0", diff --git a/packages/core/src/core/UnCancelToken.ts b/packages/core/src/core/UnCancelToken.ts index fdef0ef..ba45366 100644 --- a/packages/core/src/core/UnCancelToken.ts +++ b/packages/core/src/core/UnCancelToken.ts @@ -96,6 +96,23 @@ export class UnCancelToken { } } + toAbortSignal() { + const controller = new AbortController(); + + const abort: UnCancelTokenListener = (error) => { + controller.abort(error); + }; + + this.subscribe(abort); + + // @ts-expect-error Property 'unsubscribe' does not exist on type 'AbortSignal'.ts(2339) + controller.signal.unsubscribe = () => this.unsubscribe(abort); + + return controller.signal as AbortSignal & { + unsubscribe: () => void; + }; + } + static source(): UnCancelTokenSource { let cancel: UnCanceler; const token = new UnCancelToken((c) => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e38868d..226f581 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: devDependencies: - '@biomejs/biome': - specifier: ^1.8.3 - version: 1.8.3 '@dcloudio/types': specifier: ^3.4.12 version: 3.4.12 @@ -1031,59 +1028,6 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - '@biomejs/biome@1.8.3': - resolution: {integrity: sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==} - engines: {node: '>=14.21.3'} - hasBin: true - - '@biomejs/cli-darwin-arm64@1.8.3': - resolution: {integrity: sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [darwin] - - '@biomejs/cli-darwin-x64@1.8.3': - resolution: {integrity: sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [darwin] - - '@biomejs/cli-linux-arm64-musl@1.8.3': - resolution: {integrity: sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [linux] - - '@biomejs/cli-linux-arm64@1.8.3': - resolution: {integrity: sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [linux] - - '@biomejs/cli-linux-x64-musl@1.8.3': - resolution: {integrity: sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [linux] - - '@biomejs/cli-linux-x64@1.8.3': - resolution: {integrity: sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [linux] - - '@biomejs/cli-win32-arm64@1.8.3': - resolution: {integrity: sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [win32] - - '@biomejs/cli-win32-x64@1.8.3': - resolution: {integrity: sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [win32] - '@commitlint/cli@19.3.0': resolution: {integrity: sha512-LgYWOwuDR7BSTQ9OLZ12m7F/qhNY+NpAyPBgo4YNMkACE7lGuUnuQq1yi9hz1KA4+3VqpOYl8H1rY/LYK43v7g==} engines: {node: '>=v18'} @@ -10332,41 +10276,6 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} - '@biomejs/biome@1.8.3': - optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.8.3 - '@biomejs/cli-darwin-x64': 1.8.3 - '@biomejs/cli-linux-arm64': 1.8.3 - '@biomejs/cli-linux-arm64-musl': 1.8.3 - '@biomejs/cli-linux-x64': 1.8.3 - '@biomejs/cli-linux-x64-musl': 1.8.3 - '@biomejs/cli-win32-arm64': 1.8.3 - '@biomejs/cli-win32-x64': 1.8.3 - - '@biomejs/cli-darwin-arm64@1.8.3': - optional: true - - '@biomejs/cli-darwin-x64@1.8.3': - optional: true - - '@biomejs/cli-linux-arm64-musl@1.8.3': - optional: true - - '@biomejs/cli-linux-arm64@1.8.3': - optional: true - - '@biomejs/cli-linux-x64-musl@1.8.3': - optional: true - - '@biomejs/cli-linux-x64@1.8.3': - optional: true - - '@biomejs/cli-win32-arm64@1.8.3': - optional: true - - '@biomejs/cli-win32-x64@1.8.3': - optional: true - '@commitlint/cli@19.3.0(@types/node@20.16.1)(typescript@5.5.4)': dependencies: '@commitlint/format': 19.3.0