Files
cloud-code/claude-code-source/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js
janlaywss a192e187e8 fix: keep only source-map extracted node_modules, exclude pnpm artifacts
Restore node_modules to exact state from cli.js.map extraction:
- Move .ignored/ and .ignored_* files back to original package paths
- Remove pnpm symlinks (replaced by real source-map directories)
- Update .gitignore: only exclude /dist/, .pnpm/, .bin/, .ignored* dirs
- All package dist/ folders are now preserved as part of source-map files

After clone, run `pnpm install` to get pnpm-managed symlinks for building.
The committed node_modules contains the original TypeScript/JS source files
as bundled in cli.js.
2026-03-31 21:09:32 +08:00

77 lines
2.6 KiB
JavaScript

"use strict";
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = void 0;
const cancellation_1 = require("./cancellation");
var CancellationState;
(function (CancellationState) {
CancellationState.Continue = 0;
CancellationState.Cancelled = 1;
})(CancellationState || (CancellationState = {}));
class SharedArraySenderStrategy {
constructor() {
this.buffers = new Map();
}
enableCancellation(request) {
if (request.id === null) {
return;
}
const buffer = new SharedArrayBuffer(4);
const data = new Int32Array(buffer, 0, 1);
data[0] = CancellationState.Continue;
this.buffers.set(request.id, buffer);
request.$cancellationData = buffer;
}
async sendCancellation(_conn, id) {
const buffer = this.buffers.get(id);
if (buffer === undefined) {
return;
}
const data = new Int32Array(buffer, 0, 1);
Atomics.store(data, 0, CancellationState.Cancelled);
}
cleanup(id) {
this.buffers.delete(id);
}
dispose() {
this.buffers.clear();
}
}
exports.SharedArraySenderStrategy = SharedArraySenderStrategy;
class SharedArrayBufferCancellationToken {
constructor(buffer) {
this.data = new Int32Array(buffer, 0, 1);
}
get isCancellationRequested() {
return Atomics.load(this.data, 0) === CancellationState.Cancelled;
}
get onCancellationRequested() {
throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`);
}
}
class SharedArrayBufferCancellationTokenSource {
constructor(buffer) {
this.token = new SharedArrayBufferCancellationToken(buffer);
}
cancel() {
}
dispose() {
}
}
class SharedArrayReceiverStrategy {
constructor() {
this.kind = 'request';
}
createCancellationTokenSource(request) {
const buffer = request.$cancellationData;
if (buffer === undefined) {
return new cancellation_1.CancellationTokenSource();
}
return new SharedArrayBufferCancellationTokenSource(buffer);
}
}
exports.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy;