@poe-platform/safe-bash 0.1.535 → 0.1.537
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/safe-bash/chunks/chunk-JWUT4LBW.js +617 -0
- package/dist/safe-bash/chunks/chunk-JWUT4LBW.js.map +7 -0
- package/dist/safe-bash/chunks/chunk-PY37EOPJ.js +1236 -0
- package/dist/safe-bash/chunks/chunk-PY37EOPJ.js.map +7 -0
- package/dist/safe-bash/commands/pr/command.d.ts +4 -0
- package/dist/safe-bash/commands/pr/command.d.ts.map +1 -0
- package/dist/safe-bash/commands/pr/command.js +117 -0
- package/dist/safe-bash/commands/pr/command.js.map +1 -0
- package/dist/safe-bash/commands/pr/format.d.ts +52 -0
- package/dist/safe-bash/commands/pr/format.d.ts.map +1 -0
- package/dist/safe-bash/commands/pr/format.js +527 -0
- package/dist/safe-bash/commands/pr/format.js.map +1 -0
- package/dist/safe-bash/commands/pr/index.browser.js +13 -0
- package/dist/safe-bash/commands/pr/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/pr/index.d.ts +7 -0
- package/dist/safe-bash/commands/pr/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/pr/index.js +13 -0
- package/dist/safe-bash/commands/pr/index.js.map +1 -0
- package/dist/safe-bash/commands/pr/internal.d.ts +61 -0
- package/dist/safe-bash/commands/pr/internal.d.ts.map +1 -0
- package/dist/safe-bash/commands/pr/internal.js +181 -0
- package/dist/safe-bash/commands/pr/internal.js.map +1 -0
- package/dist/safe-bash/commands/pr/io.d.ts +37 -0
- package/dist/safe-bash/commands/pr/io.d.ts.map +1 -0
- package/dist/safe-bash/commands/pr/io.js +210 -0
- package/dist/safe-bash/commands/pr/io.js.map +1 -0
- package/dist/safe-bash/commands/pr/options.d.ts +36 -0
- package/dist/safe-bash/commands/pr/options.d.ts.map +1 -0
- package/dist/safe-bash/commands/pr/options.js +250 -0
- package/dist/safe-bash/commands/pr/options.js.map +1 -0
- package/dist/safe-bash/commands/tsort/command.d.ts +4 -0
- package/dist/safe-bash/commands/tsort/command.d.ts.map +1 -0
- package/dist/safe-bash/commands/tsort/command.js +72 -0
- package/dist/safe-bash/commands/tsort/command.js.map +1 -0
- package/dist/safe-bash/commands/tsort/graph.d.ts +3 -0
- package/dist/safe-bash/commands/tsort/graph.d.ts.map +1 -0
- package/dist/safe-bash/commands/tsort/graph.js +183 -0
- package/dist/safe-bash/commands/tsort/graph.js.map +1 -0
- package/dist/safe-bash/commands/tsort/index.browser.js +13 -0
- package/dist/safe-bash/commands/tsort/index.browser.js.map +7 -0
- package/dist/safe-bash/commands/tsort/index.d.ts +7 -0
- package/dist/safe-bash/commands/tsort/index.d.ts.map +1 -0
- package/dist/safe-bash/commands/tsort/index.js +13 -0
- package/dist/safe-bash/commands/tsort/index.js.map +1 -0
- package/dist/safe-bash/commands/tsort/internal.d.ts +50 -0
- package/dist/safe-bash/commands/tsort/internal.d.ts.map +1 -0
- package/dist/safe-bash/commands/tsort/internal.js +176 -0
- package/dist/safe-bash/commands/tsort/internal.js.map +1 -0
- package/dist/safe-bash/commands/tsort/io.d.ts +29 -0
- package/dist/safe-bash/commands/tsort/io.d.ts.map +1 -0
- package/dist/safe-bash/commands/tsort/io.js +192 -0
- package/dist/safe-bash/commands/tsort/io.js.map +1 -0
- package/dist/safe-bash/core.browser.js +46 -5
- package/dist/safe-bash/core.browser.js.map +3 -3
- package/dist/safe-bash/core.d.ts +2 -0
- package/dist/safe-bash/core.d.ts.map +1 -1
- package/dist/safe-bash/core.js +2 -0
- package/dist/safe-bash/core.js.map +1 -1
- package/dist/safe-bash/plugins/composition.d.ts +4 -0
- package/dist/safe-bash/plugins/composition.d.ts.map +1 -1
- package/dist/safe-bash/plugins/composition.js +7 -1
- package/dist/safe-bash/plugins/composition.js.map +1 -1
- package/dist/safe-bash/shell/runtime.d.ts.map +1 -1
- package/dist/safe-bash/shell/runtime.js +28 -3
- package/dist/safe-bash/shell/runtime.js.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type CommandContext } from "../../contracts/index.js";
|
|
2
|
+
import { PublicDiagnostic } from "../../diagnostics.js";
|
|
3
|
+
export interface TsortLimits {
|
|
4
|
+
readonly maxArguments: number;
|
|
5
|
+
readonly maxArgumentBytes: number;
|
|
6
|
+
readonly maxInputBytes: number;
|
|
7
|
+
readonly maxTokenBytes: number;
|
|
8
|
+
readonly maxTokens: number;
|
|
9
|
+
readonly maxNodes: number;
|
|
10
|
+
readonly maxEdges: number;
|
|
11
|
+
readonly maxBufferedBytes: number;
|
|
12
|
+
readonly maxOutputBytes: number;
|
|
13
|
+
readonly maxDiagnosticBytes: number;
|
|
14
|
+
readonly maxWork: number;
|
|
15
|
+
readonly maxEmptyChunks: number;
|
|
16
|
+
}
|
|
17
|
+
export interface TsortCommandsOptions {
|
|
18
|
+
readonly replace?: boolean;
|
|
19
|
+
readonly limits?: Partial<TsortLimits>;
|
|
20
|
+
}
|
|
21
|
+
export declare function settings(options: TsortCommandsOptions): TsortLimits;
|
|
22
|
+
export declare class TsortError extends PublicDiagnostic {
|
|
23
|
+
readonly usage: boolean;
|
|
24
|
+
constructor(message: string, usage?: boolean);
|
|
25
|
+
}
|
|
26
|
+
export declare function raw(value: Uint8Array): string;
|
|
27
|
+
export declare function bytes(value: string): Uint8Array;
|
|
28
|
+
export declare function pathText(value: string): string;
|
|
29
|
+
export declare function quote(value: string): string;
|
|
30
|
+
export declare function fileQuote(value: string): string;
|
|
31
|
+
export declare class Budget {
|
|
32
|
+
readonly context: CommandContext;
|
|
33
|
+
readonly limits: TsortLimits;
|
|
34
|
+
readonly signal: AbortSignal;
|
|
35
|
+
private work;
|
|
36
|
+
private checkpoint;
|
|
37
|
+
private retained;
|
|
38
|
+
private input;
|
|
39
|
+
private output;
|
|
40
|
+
private diagnostics;
|
|
41
|
+
constructor(context: CommandContext, limits: TsortLimits, signal: AbortSignal);
|
|
42
|
+
check(value: number, maximum: number, label: string): void;
|
|
43
|
+
charge(amount?: number): void;
|
|
44
|
+
checkpointWork(): Promise<void>;
|
|
45
|
+
retain(amount: number): void;
|
|
46
|
+
inputBytes(amount: number): void;
|
|
47
|
+
emitted(amount: number, diagnostic: boolean): void;
|
|
48
|
+
arguments(): string[];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/commands/tsort/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACxC;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,WAAW,CAWnE;AA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|
|
1
|
+
import { getCommandArguments } from "../../contracts/index.js";
|
|
2
|
+
import { shellValueByteLength, shellValueBytes } from "../../contracts/value.js";
|
|
3
|
+
import { yieldTurn } from "../../contracts/yield.js";
|
|
4
|
+
import { PublicDiagnostic } from "../../diagnostics.js";
|
|
5
|
+
export function settings(options) {
|
|
6
|
+
const limits = {
|
|
7
|
+
maxArguments: 4096, maxArgumentBytes: 65_536, maxInputBytes: 33_554_432,
|
|
8
|
+
maxTokenBytes: 1_048_576, maxTokens: 2_097_152, maxNodes: 131_072,
|
|
9
|
+
maxEdges: 1_048_576, maxBufferedBytes: 33_554_432, maxOutputBytes: 67_108_864,
|
|
10
|
+
maxDiagnosticBytes: 65_536, maxWork: 134_217_728, maxEmptyChunks: 4096, ...options.limits,
|
|
11
|
+
};
|
|
12
|
+
for (const [name, value] of Object.entries(limits)) {
|
|
13
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
14
|
+
throw new RangeError(`Invalid tsort limit: ${name}`);
|
|
15
|
+
}
|
|
16
|
+
return Object.freeze(limits);
|
|
17
|
+
}
|
|
18
|
+
export class TsortError extends PublicDiagnostic {
|
|
19
|
+
usage;
|
|
20
|
+
constructor(message, usage = false) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.usage = usage;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function raw(value) {
|
|
26
|
+
let result = "";
|
|
27
|
+
for (let offset = 0; offset < value.length; offset += 4096)
|
|
28
|
+
result += String.fromCharCode(...value.subarray(offset, offset + 4096));
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
export function bytes(value) {
|
|
32
|
+
return Uint8Array.from(value, character => character.charCodeAt(0));
|
|
33
|
+
}
|
|
34
|
+
export function pathText(value) {
|
|
35
|
+
try {
|
|
36
|
+
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes(value));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
throw new TsortError("filesystem paths must be valid UTF-8");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function quote(value) {
|
|
43
|
+
const escapes = { "\x07": "\\a", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", "\t": "\\t", "\v": "\\v", "\\": "\\\\", "'": "\\'" };
|
|
44
|
+
let result = "'";
|
|
45
|
+
for (const character of value) {
|
|
46
|
+
const code = character.charCodeAt(0);
|
|
47
|
+
result += escapes[character] ?? (code >= 32 && code < 127 ? character : `\\${code.toString(8).padStart(3, "0")}`);
|
|
48
|
+
}
|
|
49
|
+
return `${result}'`;
|
|
50
|
+
}
|
|
51
|
+
export function fileQuote(value) {
|
|
52
|
+
let safe = value.length > 0;
|
|
53
|
+
let escaped = false;
|
|
54
|
+
for (const character of value) {
|
|
55
|
+
const code = character.charCodeAt(0);
|
|
56
|
+
if (!(character >= "a" && character <= "z" || character >= "A" && character <= "Z" || character >= "0" && character <= "9" || "_./-".includes(character)))
|
|
57
|
+
safe = false;
|
|
58
|
+
if (code < 32 || code >= 127)
|
|
59
|
+
escaped = true;
|
|
60
|
+
}
|
|
61
|
+
if (safe)
|
|
62
|
+
return value;
|
|
63
|
+
if (!escaped) {
|
|
64
|
+
if (value.includes("'") && !["$", "`", "\\", '"'].some(character => value.includes(character)))
|
|
65
|
+
return `"${value}"`;
|
|
66
|
+
return `'${value.split("'").join("'\\''")}'`;
|
|
67
|
+
}
|
|
68
|
+
const escapes = { "\x07": "\\a", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", "\t": "\\t", "\v": "\\v" };
|
|
69
|
+
let result = "'", inEscape = false;
|
|
70
|
+
for (const character of value) {
|
|
71
|
+
const code = character.charCodeAt(0);
|
|
72
|
+
if (code < 32 || code >= 127) {
|
|
73
|
+
if (!inEscape) {
|
|
74
|
+
result += "'$'";
|
|
75
|
+
inEscape = true;
|
|
76
|
+
}
|
|
77
|
+
result += escapes[character] ?? `\\${code.toString(8).padStart(3, "0")}`;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (inEscape) {
|
|
81
|
+
result += "''";
|
|
82
|
+
inEscape = false;
|
|
83
|
+
}
|
|
84
|
+
result += character === "'" ? "'\\''" : character;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return `${result}'`;
|
|
88
|
+
}
|
|
89
|
+
export class Budget {
|
|
90
|
+
context;
|
|
91
|
+
limits;
|
|
92
|
+
signal;
|
|
93
|
+
work = 0;
|
|
94
|
+
checkpoint = 0;
|
|
95
|
+
retained = 0;
|
|
96
|
+
input = 0;
|
|
97
|
+
output = 0;
|
|
98
|
+
diagnostics = 0;
|
|
99
|
+
constructor(context, limits, signal) {
|
|
100
|
+
this.context = context;
|
|
101
|
+
this.limits = limits;
|
|
102
|
+
this.signal = signal;
|
|
103
|
+
}
|
|
104
|
+
check(value, maximum, label) {
|
|
105
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > maximum)
|
|
106
|
+
throw new TsortError(`${label} limit exceeded`);
|
|
107
|
+
}
|
|
108
|
+
charge(amount = 1) {
|
|
109
|
+
this.signal.throwIfAborted();
|
|
110
|
+
this.check(this.work + amount, this.limits.maxWork, "work");
|
|
111
|
+
this.work += amount;
|
|
112
|
+
}
|
|
113
|
+
async checkpointWork() {
|
|
114
|
+
this.signal.throwIfAborted();
|
|
115
|
+
if (this.work - this.checkpoint >= 4096) {
|
|
116
|
+
this.checkpoint = this.work;
|
|
117
|
+
await yieldTurn(this.signal);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
retain(amount) {
|
|
121
|
+
this.check(this.retained + amount, this.limits.maxBufferedBytes, "buffered bytes");
|
|
122
|
+
this.retained += amount;
|
|
123
|
+
}
|
|
124
|
+
inputBytes(amount) {
|
|
125
|
+
this.check(this.input + amount, this.limits.maxInputBytes, "input bytes");
|
|
126
|
+
this.input += amount;
|
|
127
|
+
}
|
|
128
|
+
emitted(amount, diagnostic) {
|
|
129
|
+
if (diagnostic) {
|
|
130
|
+
this.check(this.diagnostics + amount, this.limits.maxDiagnosticBytes, "diagnostic bytes");
|
|
131
|
+
this.diagnostics += amount;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.check(this.output + amount, this.limits.maxOutputBytes, "output bytes");
|
|
135
|
+
this.output += amount;
|
|
136
|
+
this.charge(amount);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
arguments() {
|
|
140
|
+
this.check(this.context.args.length, this.limits.maxArguments, "argument count");
|
|
141
|
+
let total = 0;
|
|
142
|
+
for (const argument of this.context.args) {
|
|
143
|
+
total += argument.length;
|
|
144
|
+
this.check(total, this.limits.maxArgumentBytes, "argument bytes");
|
|
145
|
+
for (let offset = 0; offset < argument.length; offset++) {
|
|
146
|
+
const unit = argument.charCodeAt(offset);
|
|
147
|
+
if (unit >= 0xd800 && unit <= 0xdbff) {
|
|
148
|
+
const next = argument.charCodeAt(++offset);
|
|
149
|
+
if (!(next >= 0xdc00 && next <= 0xdfff))
|
|
150
|
+
throw new TsortError("arguments must contain well-formed Unicode");
|
|
151
|
+
}
|
|
152
|
+
else if (unit >= 0xdc00 && unit <= 0xdfff)
|
|
153
|
+
throw new TsortError("arguments must contain well-formed Unicode");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
total = 0;
|
|
157
|
+
const values = this.context.argumentValues === undefined ? this.context.args : getCommandArguments(this.context).values;
|
|
158
|
+
for (const argument of values) {
|
|
159
|
+
total += shellValueByteLength(argument);
|
|
160
|
+
this.check(total, this.limits.maxArgumentBytes, "argument bytes");
|
|
161
|
+
}
|
|
162
|
+
this.charge(total);
|
|
163
|
+
this.retain(total * 8 + this.context.args.length * 64 + 128);
|
|
164
|
+
total = 0;
|
|
165
|
+
return getCommandArguments(this.context).values.map(argument => {
|
|
166
|
+
total += shellValueByteLength(argument);
|
|
167
|
+
this.check(total, this.limits.maxArgumentBytes, "argument bytes");
|
|
168
|
+
this.charge(shellValueByteLength(argument));
|
|
169
|
+
const value = shellValueBytes(argument);
|
|
170
|
+
if (value.includes(0))
|
|
171
|
+
throw new TsortError("NUL is not supported in arguments");
|
|
172
|
+
return raw(value);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/commands/tsort/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAsBxD,MAAM,UAAU,QAAQ,CAAC,OAA6B;IACpD,MAAM,MAAM,GAAgB;QAC1B,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU;QACvE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO;QACjE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU;QAC7E,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM;KAC1F,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;YAAE,MAAM,IAAI,UAAU,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC;IACtG,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,OAAO,UA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,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC7D,KAAK,IAAI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;YAClE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC5C,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;YACxC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAAE,MAAM,IAAI,UAAU,CAAC,mCAAmC,CAAC,CAAC;YACjF,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { OutputOperation } from "../../contracts/output.js";
|
|
2
|
+
import { Budget } from "./internal.js";
|
|
3
|
+
export declare class Lifecycle {
|
|
4
|
+
readonly budget: Budget;
|
|
5
|
+
private readonly pending;
|
|
6
|
+
private readonly cleanups;
|
|
7
|
+
private closing;
|
|
8
|
+
constructor(budget: Budget, output: OutputOperation);
|
|
9
|
+
cleanup(action: () => Promise<void>): void;
|
|
10
|
+
assertOpen(): void;
|
|
11
|
+
operation<Value>(action: () => Value | Promise<Value>, diagnostic?: boolean): Promise<Value>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
write(value: string, diagnostic?: boolean): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare class Reader {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly lifecycle: Lifecycle;
|
|
18
|
+
private iterator;
|
|
19
|
+
private chunk;
|
|
20
|
+
private offset;
|
|
21
|
+
private ended;
|
|
22
|
+
private empties;
|
|
23
|
+
private snapshotBytes;
|
|
24
|
+
constructor(name: string, lifecycle: Lifecycle);
|
|
25
|
+
private readonly releaseSnapshot;
|
|
26
|
+
open(): Promise<void>;
|
|
27
|
+
get(): Promise<number>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../../src/commands/tsort/io.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAA0C,MAAM,eAAe,CAAC;AAE/E,qBAAa,SAAS;IAIR,QAAQ,CAAC,MAAM,EAAE,MAAM;IAHnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IACxD,OAAO,CAAC,OAAO,CAA4B;gBACtB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe;IAC5D,OAAO,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAC1C,UAAU,IAAI,IAAI;IAIZ,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,UAAU,UAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;IAQhG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAWhB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAU9D;AAED,qBAAa,MAAM;IAOL,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,SAAS;IANhE,OAAO,CAAC,QAAQ,CAAwC;IACxD,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,aAAa,CAAK;gBACL,IAAI,EAAE,MAAM,EAAW,SAAS,EAAE,SAAS;IAWhE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAG9B;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqCrB,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;CAyB7B"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { FsError, resolvePath } from "../../contracts/index.js";
|
|
2
|
+
import { Budget, TsortError, bytes, fileQuote, pathText } from "./internal.js";
|
|
3
|
+
export class Lifecycle {
|
|
4
|
+
budget;
|
|
5
|
+
pending = new Set();
|
|
6
|
+
cleanups = [];
|
|
7
|
+
closing;
|
|
8
|
+
constructor(budget, output) {
|
|
9
|
+
this.budget = budget;
|
|
10
|
+
output.registerCleanup(() => this.close());
|
|
11
|
+
}
|
|
12
|
+
cleanup(action) { this.assertOpen(); this.cleanups.push(action); }
|
|
13
|
+
assertOpen() {
|
|
14
|
+
this.budget.signal.throwIfAborted();
|
|
15
|
+
if (this.closing)
|
|
16
|
+
throw new TsortError("command is closed");
|
|
17
|
+
}
|
|
18
|
+
async operation(action, diagnostic = false) {
|
|
19
|
+
this.assertOpen();
|
|
20
|
+
if (!diagnostic)
|
|
21
|
+
this.budget.charge();
|
|
22
|
+
const pending = Promise.resolve().then(() => { this.assertOpen(); return action(); });
|
|
23
|
+
this.pending.add(pending);
|
|
24
|
+
try {
|
|
25
|
+
const value = await pending;
|
|
26
|
+
this.assertOpen();
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
this.pending.delete(pending);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
close() {
|
|
34
|
+
return this.closing ??= Promise.resolve().then(async () => {
|
|
35
|
+
while (this.pending.size)
|
|
36
|
+
await Promise.allSettled([...this.pending]);
|
|
37
|
+
const failures = [];
|
|
38
|
+
for (const cleanup of this.cleanups) {
|
|
39
|
+
try {
|
|
40
|
+
await cleanup();
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
failures.push(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (failures.length === 1)
|
|
47
|
+
throw failures[0];
|
|
48
|
+
if (failures.length > 1)
|
|
49
|
+
throw new AggregateError(failures, "tsort cleanup failed");
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async write(value, diagnostic = false) {
|
|
53
|
+
this.budget.emitted(value.length, diagnostic);
|
|
54
|
+
await this.operation(async () => {
|
|
55
|
+
if (!diagnostic)
|
|
56
|
+
this.budget.retain(value.length * 3);
|
|
57
|
+
try {
|
|
58
|
+
const sink = diagnostic ? this.budget.context.stderr : this.budget.context.stdout;
|
|
59
|
+
await (sink.ownedOutput ?? sink).write(bytes(value));
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
if (!diagnostic)
|
|
63
|
+
this.budget.retain(-value.length * 3);
|
|
64
|
+
}
|
|
65
|
+
}, diagnostic);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export class Reader {
|
|
69
|
+
name;
|
|
70
|
+
lifecycle;
|
|
71
|
+
iterator;
|
|
72
|
+
chunk = new Uint8Array();
|
|
73
|
+
offset = 0;
|
|
74
|
+
ended = false;
|
|
75
|
+
empties = 0;
|
|
76
|
+
snapshotBytes = 0;
|
|
77
|
+
constructor(name, lifecycle) {
|
|
78
|
+
this.name = name;
|
|
79
|
+
this.lifecycle = lifecycle;
|
|
80
|
+
lifecycle.cleanup(async () => {
|
|
81
|
+
try {
|
|
82
|
+
if (!this.ended)
|
|
83
|
+
await this.iterator?.return?.();
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
this.iterator = undefined;
|
|
87
|
+
this.releaseSnapshot();
|
|
88
|
+
lifecycle.budget.retain(-this.chunk.length);
|
|
89
|
+
this.chunk = new Uint8Array();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
releaseSnapshot = () => {
|
|
94
|
+
this.lifecycle.budget.retain(-this.snapshotBytes);
|
|
95
|
+
this.snapshotBytes = 0;
|
|
96
|
+
};
|
|
97
|
+
async open() {
|
|
98
|
+
const { budget } = this.lifecycle;
|
|
99
|
+
const { fs, stdin } = budget.context;
|
|
100
|
+
try {
|
|
101
|
+
await this.lifecycle.operation(async () => {
|
|
102
|
+
let source;
|
|
103
|
+
if (this.name === "-")
|
|
104
|
+
source = stdin;
|
|
105
|
+
else {
|
|
106
|
+
const path = resolvePath(budget.context.cwd, pathText(this.name));
|
|
107
|
+
const stat = await fs.stat(path, { signal: budget.signal });
|
|
108
|
+
budget.signal.throwIfAborted();
|
|
109
|
+
if (stat.type === "directory") {
|
|
110
|
+
this.ended = true;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (stat.type !== "file" && stat.type !== "character")
|
|
114
|
+
throw new FsError("ENOTSUP", { path });
|
|
115
|
+
const capabilities = await fs.capabilitiesFor?.(path, { signal: budget.signal }) ?? fs.capabilities;
|
|
116
|
+
budget.signal.throwIfAborted();
|
|
117
|
+
if (fs.readStream && capabilities.streamingRead !== false)
|
|
118
|
+
source = fs.readStream(path, { signal: budget.signal, chunkSize: 16_384 });
|
|
119
|
+
else {
|
|
120
|
+
const maximum = Math.min(budget.limits.maxInputBytes, Math.floor(budget.limits.maxBufferedBytes / 2));
|
|
121
|
+
budget.check(stat.size, maximum, "buffered input bytes");
|
|
122
|
+
budget.retain(maximum);
|
|
123
|
+
this.snapshotBytes = maximum;
|
|
124
|
+
const content = await fs.readFile(path, { signal: budget.signal, maxBytes: maximum });
|
|
125
|
+
if (!(content instanceof Uint8Array))
|
|
126
|
+
throw new TypeError("tsort input requires bytes");
|
|
127
|
+
budget.check(content.length, maximum, "buffered input bytes");
|
|
128
|
+
budget.retain(content.length - maximum);
|
|
129
|
+
this.snapshotBytes = content.length;
|
|
130
|
+
const { releaseSnapshot } = this;
|
|
131
|
+
source = { async *[Symbol.asyncIterator]() { try {
|
|
132
|
+
yield content;
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
releaseSnapshot();
|
|
136
|
+
} } };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
this.iterator = source[Symbol.asyncIterator]();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (error instanceof FsError)
|
|
144
|
+
throw new TsortError(`${fileQuote(this.name)}: ${fsDetail(error)}`);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async get() {
|
|
149
|
+
const { budget } = this.lifecycle;
|
|
150
|
+
budget.charge();
|
|
151
|
+
await budget.checkpointWork();
|
|
152
|
+
while (this.offset === this.chunk.length) {
|
|
153
|
+
if (this.ended)
|
|
154
|
+
return -1;
|
|
155
|
+
let next;
|
|
156
|
+
try {
|
|
157
|
+
next = await this.lifecycle.operation(() => this.iterator.next());
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (error instanceof FsError)
|
|
161
|
+
throw new TsortError(`${fileQuote(this.name)}: ${fsDetail(error)}`);
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
budget.retain(-this.chunk.length);
|
|
165
|
+
this.chunk = new Uint8Array();
|
|
166
|
+
this.offset = 0;
|
|
167
|
+
if (next.done) {
|
|
168
|
+
this.ended = true;
|
|
169
|
+
this.iterator = undefined;
|
|
170
|
+
return -1;
|
|
171
|
+
}
|
|
172
|
+
if (!(next.value instanceof Uint8Array))
|
|
173
|
+
throw new TypeError("tsort input requires bytes");
|
|
174
|
+
budget.inputBytes(next.value.length);
|
|
175
|
+
budget.charge(next.value.length);
|
|
176
|
+
budget.retain(next.value.length);
|
|
177
|
+
this.chunk = Uint8Array.from(next.value);
|
|
178
|
+
if (!this.chunk.length)
|
|
179
|
+
budget.check(++this.empties, budget.limits.maxEmptyChunks, "empty input chunks");
|
|
180
|
+
}
|
|
181
|
+
return this.chunk[this.offset++];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function fsDetail(error) {
|
|
185
|
+
const details = {
|
|
186
|
+
EACCES: "Permission denied", EPERM: "Operation not permitted", ENOENT: "No such file or directory",
|
|
187
|
+
EISDIR: "Is a directory", ENOTDIR: "Not a directory", EIO: "Input/output error", ELOOP: "Too many levels of symbolic links",
|
|
188
|
+
ENAMETOOLONG: "File name too long", ENOTSUP: "Operation not supported",
|
|
189
|
+
};
|
|
190
|
+
return details[error.code] ?? error.message;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/commands/tsort/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAmB,MAAM,0BAA0B,CAAC;AAEjF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE/E,MAAM,OAAO,SAAS;IAIC;IAHJ,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;IACtC,QAAQ,GAA4B,EAAE,CAAC;IAChD,OAAO,CAA4B;IAC3C,YAAqB,MAAc,EAAE,MAAuB;QAAvC,WAAM,GAAN,MAAM,CAAQ;QAA6B,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAAC,CAAC;IAC7G,OAAO,CAAC,MAA2B,IAAU,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7F,UAAU;QACR,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC9D,CAAC;IACD,KAAK,CAAC,SAAS,CAAQ,MAAoC,EAAE,UAAU,GAA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AAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC;QAC3G,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAE,CAAC;IACpC,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,MAAM,OAAO,GAA6C;QACxD,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,2BAA2B;QAClG,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,mCAAmC;QAC3H,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,yBAAyB;KACvE,CAAC;IACF,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC;AAC9C,CAAC"}
|
|
@@ -97,6 +97,16 @@ import {
|
|
|
97
97
|
openFileOutput,
|
|
98
98
|
writeFileOutput
|
|
99
99
|
} from "./chunks/chunk-QY2XHZTE.js";
|
|
100
|
+
import {
|
|
101
|
+
createPrCommand,
|
|
102
|
+
createPrCommands,
|
|
103
|
+
prCommands
|
|
104
|
+
} from "./chunks/chunk-PY37EOPJ.js";
|
|
105
|
+
import {
|
|
106
|
+
createTsortCommand,
|
|
107
|
+
createTsortCommands,
|
|
108
|
+
tsortCommands
|
|
109
|
+
} from "./chunks/chunk-JWUT4LBW.js";
|
|
100
110
|
import {
|
|
101
111
|
createOutputOperation
|
|
102
112
|
} from "./chunks/chunk-PPVCI2F2.js";
|
|
@@ -36223,6 +36233,10 @@ function composeAgentCommands(options2, executors) {
|
|
|
36223
36233
|
const grep = createGrepCommands(executors.grep);
|
|
36224
36234
|
const exprLimits = options2.expr?.limits;
|
|
36225
36235
|
const csplitLimits = options2.csplit?.limits;
|
|
36236
|
+
const prOptions = options2.pr;
|
|
36237
|
+
const prLimits = prOptions?.limits;
|
|
36238
|
+
const prClock = prOptions?.clock;
|
|
36239
|
+
const tsortLimits = options2.tsort?.limits;
|
|
36226
36240
|
const whichLimits = options2.which?.limits;
|
|
36227
36241
|
const timeoutOptions = options2.timeout;
|
|
36228
36242
|
const applyPatchLimits = options2.applyPatch?.limits;
|
|
@@ -36256,7 +36270,9 @@ function composeAgentCommands(options2, executors) {
|
|
|
36256
36270
|
}),
|
|
36257
36271
|
...createApplyPatchCommands(applyPatchLimits === void 0 ? {} : { limits: applyPatchLimits }),
|
|
36258
36272
|
...createXmlCommands(xmlLimits === void 0 ? {} : { limits: xmlLimits }),
|
|
36259
|
-
createCsplitCommandWithExecutor(executors.csplit, csplitLimits === void 0 ? {} : { limits: csplitLimits })
|
|
36273
|
+
createCsplitCommandWithExecutor(executors.csplit, csplitLimits === void 0 ? {} : { limits: csplitLimits }),
|
|
36274
|
+
...createPrCommands({ ...prLimits === void 0 ? {} : { limits: prLimits }, ...prClock === void 0 ? {} : { clock: prClock } }),
|
|
36275
|
+
...createTsortCommands(tsortLimits === void 0 ? {} : { limits: tsortLimits })
|
|
36260
36276
|
);
|
|
36261
36277
|
return new CommandRegistry(commands).list();
|
|
36262
36278
|
}
|
|
@@ -41557,8 +41573,18 @@ var Budget25 = class {
|
|
|
41557
41573
|
signal.throwIfAborted();
|
|
41558
41574
|
if (!(chunk instanceof Uint8Array)) throw new TypeError("Shell output must be Uint8Array");
|
|
41559
41575
|
if (chunk.byteLength > this.limits.maxOutputBytes - this.bytes) this.fail("maxOutputBytes");
|
|
41560
|
-
|
|
41561
|
-
|
|
41576
|
+
try {
|
|
41577
|
+
const capability = sink.ownedOutput;
|
|
41578
|
+
const write2 = capability.write;
|
|
41579
|
+
signal.throwIfAborted();
|
|
41580
|
+
if (chunk.byteLength > this.limits.maxOutputBytes - this.bytes) this.fail("maxOutputBytes");
|
|
41581
|
+
this.bytes += chunk.byteLength;
|
|
41582
|
+
await Reflect.apply(write2, capability, [chunk]);
|
|
41583
|
+
} catch (error) {
|
|
41584
|
+
signal.throwIfAborted();
|
|
41585
|
+
throw error;
|
|
41586
|
+
}
|
|
41587
|
+
signal.throwIfAborted();
|
|
41562
41588
|
}
|
|
41563
41589
|
} } : {},
|
|
41564
41590
|
write: async (chunk) => {
|
|
@@ -41726,7 +41752,16 @@ function signalSink(sink, signal) {
|
|
|
41726
41752
|
consumerClosed: sink.ownedOutput.consumerClosed,
|
|
41727
41753
|
async write(chunk) {
|
|
41728
41754
|
signal.throwIfAborted();
|
|
41729
|
-
|
|
41755
|
+
try {
|
|
41756
|
+
const capability = sink.ownedOutput;
|
|
41757
|
+
const write3 = capability.write;
|
|
41758
|
+
signal.throwIfAborted();
|
|
41759
|
+
await Reflect.apply(write3, capability, [chunk]);
|
|
41760
|
+
} catch (error) {
|
|
41761
|
+
signal.throwIfAborted();
|
|
41762
|
+
throw error;
|
|
41763
|
+
}
|
|
41764
|
+
signal.throwIfAborted();
|
|
41730
41765
|
}
|
|
41731
41766
|
} } : {},
|
|
41732
41767
|
async write(chunk) {
|
|
@@ -48532,7 +48567,7 @@ init_platform();
|
|
|
48532
48567
|
// packages/safe-js/dist/browser/safe-fs.js
|
|
48533
48568
|
init_platform();
|
|
48534
48569
|
|
|
48535
|
-
// packages/safe-js/dist/browser/chunks/chunk-
|
|
48570
|
+
// packages/safe-js/dist/browser/chunks/chunk-HG5OAL4N.js
|
|
48536
48571
|
init_platform();
|
|
48537
48572
|
var platform = Object.freeze({
|
|
48538
48573
|
errno(_code) {
|
|
@@ -52362,6 +52397,8 @@ export {
|
|
|
52362
52397
|
createOriginAuthorizer,
|
|
52363
52398
|
createOutputOperation,
|
|
52364
52399
|
createOverlayFileSystem2 as createOverlayFileSystem,
|
|
52400
|
+
createPrCommand,
|
|
52401
|
+
createPrCommands,
|
|
52365
52402
|
createReadOnlyFileSystem2 as createReadOnlyFileSystem,
|
|
52366
52403
|
createSafeJsCommands,
|
|
52367
52404
|
createSearchCommands,
|
|
@@ -52378,6 +52415,8 @@ export {
|
|
|
52378
52415
|
createTimeoutCommands,
|
|
52379
52416
|
createTreeCommand,
|
|
52380
52417
|
createTreeCommands,
|
|
52418
|
+
createTsortCommand,
|
|
52419
|
+
createTsortCommands,
|
|
52381
52420
|
createUnzipCommand,
|
|
52382
52421
|
createWgetCommand,
|
|
52383
52422
|
createWhichCommand,
|
|
@@ -52420,6 +52459,7 @@ export {
|
|
|
52420
52459
|
pipeBytes,
|
|
52421
52460
|
portableSearchCommands,
|
|
52422
52461
|
posixPath3 as posixPath,
|
|
52462
|
+
prCommands,
|
|
52423
52463
|
readBytes,
|
|
52424
52464
|
relativePath3 as relativePath,
|
|
52425
52465
|
resolvePath3 as resolvePath,
|
|
@@ -52437,6 +52477,7 @@ export {
|
|
|
52437
52477
|
toByteSource,
|
|
52438
52478
|
toFsError,
|
|
52439
52479
|
treeCommands,
|
|
52480
|
+
tsortCommands,
|
|
52440
52481
|
validateExitCode,
|
|
52441
52482
|
validatePath3 as validatePath,
|
|
52442
52483
|
whichCommands,
|