@darkrymit/crunes-cli 0.13.0 → 0.14.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/chunks/{benchmark-2TVN6HDF.js → benchmark-Y2FTRSOP.js} +3 -3
- package/dist/chunks/{chunk-THGPCLJD.js → chunk-2N6X32LY.js} +5 -3
- package/dist/chunks/{chunk-CBWT3DFR.js → chunk-5L2GJWCD.js} +4 -0
- package/dist/chunks/{chunk-3VFNNPQI.js → chunk-JDPQACG7.js} +3 -3
- package/dist/chunks/{chunk-ATI5HNNC.js → chunk-NCSTZMBQ.js} +2 -2
- package/dist/chunks/{chunk-KP4EW2DS.js → chunk-SPXPSPM7.js} +221 -57
- package/dist/chunks/{chunk-QAP63JIK.js → chunk-W2A4ECOP.js} +5 -5
- package/dist/chunks/chunk-XPEVUBUK.js +40 -0
- package/dist/chunks/{chunk-TXCUSUZ6.js → chunk-ZO2JKBJX.js} +2552 -2372
- package/dist/chunks/{doctor-SXKAEYUF.js → doctor-Q6FZHDMH.js} +1 -1
- package/dist/chunks/{install-FSJAC3CL.js → install-2K5BNXDO.js} +1 -1
- package/dist/chunks/{intro-PN7LT6ZG.js → intro-PTGUS5FN.js} +1 -1
- package/dist/chunks/{kill-Z7ZDY5MB.js → kill-IX7HNMVP.js} +12 -4
- package/dist/chunks/{list-45SHVKXO.js → list-BJTV6SPK.js} +1 -1
- package/dist/chunks/{repl-PSADU3MJ.js → repl-QNXLTQYU.js} +4 -4
- package/dist/chunks/{resolver-YEUZSOS4.js → resolver-4IZNQ3QJ.js} +2 -2
- package/dist/chunks/{run-CYGL3HTA.js → run-BFGVSKV7.js} +3 -3
- package/dist/chunks/{rune-OQX5EYSQ.js → rune-RNJCIH4L.js} +5 -4
- package/dist/chunks/{runner-VUSHR2OR.js → runner-RYJO4AN3.js} +3 -2
- package/dist/chunks/{uninstall-MSCIWDWV.js → uninstall-X75QTERD.js} +1 -1
- package/dist/chunks/{update-IHCYA3JW.js → update-HHIDPHGX.js} +1 -1
- package/dist/chunks/{utils-DJ3BXOQC.js → utils-N6QJKOAO.js} +1 -1
- package/dist/chunks/{version-SBE7LQ5C.js → version-CYVVKOVG.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/test/index.js +227 -44
- package/package.json +1 -1
package/dist/test/index.js
CHANGED
|
@@ -20696,7 +20696,7 @@ var require_parse3 = __commonJS({
|
|
|
20696
20696
|
var BufferStream = require_BufferStream();
|
|
20697
20697
|
var parseExtraField = require_parseExtraField();
|
|
20698
20698
|
var parseDateTime = require_parseDateTime();
|
|
20699
|
-
var
|
|
20699
|
+
var pipeline3 = Stream.pipeline;
|
|
20700
20700
|
var parseBuffer = require_parseBuffer();
|
|
20701
20701
|
var endDirectorySignature = Buffer.alloc(4);
|
|
20702
20702
|
endDirectorySignature.writeUInt32LE(101010256, 0);
|
|
@@ -20845,7 +20845,7 @@ var require_parse3 = __commonJS({
|
|
|
20845
20845
|
eof.writeUInt32LE(134695760, 0);
|
|
20846
20846
|
}
|
|
20847
20847
|
return new Promise(function(resolve6, reject) {
|
|
20848
|
-
|
|
20848
|
+
pipeline3(
|
|
20849
20849
|
self2.stream(eof),
|
|
20850
20850
|
inflater,
|
|
20851
20851
|
entry,
|
|
@@ -28141,7 +28141,7 @@ var require_pipeline = __commonJS({
|
|
|
28141
28141
|
if (typeof streams[streams.length - 1] !== "function") return noop;
|
|
28142
28142
|
return streams.pop();
|
|
28143
28143
|
}
|
|
28144
|
-
function
|
|
28144
|
+
function pipeline3() {
|
|
28145
28145
|
for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28146
28146
|
streams[_key] = arguments[_key];
|
|
28147
28147
|
}
|
|
@@ -28164,7 +28164,7 @@ var require_pipeline = __commonJS({
|
|
|
28164
28164
|
});
|
|
28165
28165
|
return streams.reduce(pipe);
|
|
28166
28166
|
}
|
|
28167
|
-
module2.exports =
|
|
28167
|
+
module2.exports = pipeline3;
|
|
28168
28168
|
}
|
|
28169
28169
|
});
|
|
28170
28170
|
|
|
@@ -44917,7 +44917,7 @@ var require_pipeline2 = __commonJS({
|
|
|
44917
44917
|
}
|
|
44918
44918
|
}
|
|
44919
44919
|
}
|
|
44920
|
-
function
|
|
44920
|
+
function pipeline3(...streams) {
|
|
44921
44921
|
return pipelineImpl(streams, once(popCallback(streams)));
|
|
44922
44922
|
}
|
|
44923
44923
|
function pipelineImpl(streams, callback2, opts) {
|
|
@@ -45183,7 +45183,7 @@ var require_pipeline2 = __commonJS({
|
|
|
45183
45183
|
}
|
|
45184
45184
|
module2.exports = {
|
|
45185
45185
|
pipelineImpl,
|
|
45186
|
-
pipeline:
|
|
45186
|
+
pipeline: pipeline3
|
|
45187
45187
|
};
|
|
45188
45188
|
}
|
|
45189
45189
|
});
|
|
@@ -45193,7 +45193,7 @@ var require_compose = __commonJS({
|
|
|
45193
45193
|
"node_modules/archiver/node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
|
|
45194
45194
|
"use strict";
|
|
45195
45195
|
init_require_shim();
|
|
45196
|
-
var { pipeline:
|
|
45196
|
+
var { pipeline: pipeline3 } = require_pipeline2();
|
|
45197
45197
|
var Duplex = require_duplex();
|
|
45198
45198
|
var { destroyer } = require_destroy4();
|
|
45199
45199
|
var {
|
|
@@ -45253,7 +45253,7 @@ var require_compose = __commonJS({
|
|
|
45253
45253
|
}
|
|
45254
45254
|
}
|
|
45255
45255
|
const head = streams[0];
|
|
45256
|
-
const tail =
|
|
45256
|
+
const tail = pipeline3(streams, onfinished);
|
|
45257
45257
|
const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
|
|
45258
45258
|
const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail));
|
|
45259
45259
|
d = new Duplex({
|
|
@@ -45798,7 +45798,7 @@ var require_promises = __commonJS({
|
|
|
45798
45798
|
var { pipelineImpl: pl2 } = require_pipeline2();
|
|
45799
45799
|
var { finished } = require_end_of_stream2();
|
|
45800
45800
|
require_stream4();
|
|
45801
|
-
function
|
|
45801
|
+
function pipeline3(...streams) {
|
|
45802
45802
|
return new Promise2((resolve6, reject) => {
|
|
45803
45803
|
let signal;
|
|
45804
45804
|
let end;
|
|
@@ -45826,7 +45826,7 @@ var require_promises = __commonJS({
|
|
|
45826
45826
|
}
|
|
45827
45827
|
module2.exports = {
|
|
45828
45828
|
finished,
|
|
45829
|
-
pipeline:
|
|
45829
|
+
pipeline: pipeline3
|
|
45830
45830
|
};
|
|
45831
45831
|
}
|
|
45832
45832
|
});
|
|
@@ -45847,7 +45847,7 @@ var require_stream4 = __commonJS({
|
|
|
45847
45847
|
} = require_errors4();
|
|
45848
45848
|
var compose = require_compose();
|
|
45849
45849
|
var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state2();
|
|
45850
|
-
var { pipeline:
|
|
45850
|
+
var { pipeline: pipeline3 } = require_pipeline2();
|
|
45851
45851
|
var { destroyer } = require_destroy4();
|
|
45852
45852
|
var eos = require_end_of_stream2();
|
|
45853
45853
|
var promises = require_promises();
|
|
@@ -45911,7 +45911,7 @@ var require_stream4 = __commonJS({
|
|
|
45911
45911
|
Stream.Duplex = require_duplex();
|
|
45912
45912
|
Stream.Transform = require_transform();
|
|
45913
45913
|
Stream.PassThrough = require_passthrough2();
|
|
45914
|
-
Stream.pipeline =
|
|
45914
|
+
Stream.pipeline = pipeline3;
|
|
45915
45915
|
var { addAbortSignal } = require_add_abort_signal();
|
|
45916
45916
|
Stream.addAbortSignal = addAbortSignal;
|
|
45917
45917
|
Stream.finished = eos;
|
|
@@ -45927,7 +45927,7 @@ var require_stream4 = __commonJS({
|
|
|
45927
45927
|
return promises;
|
|
45928
45928
|
}
|
|
45929
45929
|
});
|
|
45930
|
-
ObjectDefineProperty(
|
|
45930
|
+
ObjectDefineProperty(pipeline3, customPromisify, {
|
|
45931
45931
|
__proto__: null,
|
|
45932
45932
|
enumerable: true,
|
|
45933
45933
|
get() {
|
|
@@ -51803,7 +51803,7 @@ var require_pipeline3 = __commonJS({
|
|
|
51803
51803
|
}
|
|
51804
51804
|
}
|
|
51805
51805
|
}
|
|
51806
|
-
function
|
|
51806
|
+
function pipeline3(...streams) {
|
|
51807
51807
|
return pipelineImpl(streams, once(popCallback(streams)));
|
|
51808
51808
|
}
|
|
51809
51809
|
function pipelineImpl(streams, callback2, opts) {
|
|
@@ -52069,7 +52069,7 @@ var require_pipeline3 = __commonJS({
|
|
|
52069
52069
|
}
|
|
52070
52070
|
module2.exports = {
|
|
52071
52071
|
pipelineImpl,
|
|
52072
|
-
pipeline:
|
|
52072
|
+
pipeline: pipeline3
|
|
52073
52073
|
};
|
|
52074
52074
|
}
|
|
52075
52075
|
});
|
|
@@ -52079,7 +52079,7 @@ var require_compose2 = __commonJS({
|
|
|
52079
52079
|
"node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
|
|
52080
52080
|
"use strict";
|
|
52081
52081
|
init_require_shim();
|
|
52082
|
-
var { pipeline:
|
|
52082
|
+
var { pipeline: pipeline3 } = require_pipeline3();
|
|
52083
52083
|
var Duplex = require_duplex2();
|
|
52084
52084
|
var { destroyer } = require_destroy5();
|
|
52085
52085
|
var {
|
|
@@ -52139,7 +52139,7 @@ var require_compose2 = __commonJS({
|
|
|
52139
52139
|
}
|
|
52140
52140
|
}
|
|
52141
52141
|
const head = streams[0];
|
|
52142
|
-
const tail =
|
|
52142
|
+
const tail = pipeline3(streams, onfinished);
|
|
52143
52143
|
const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
|
|
52144
52144
|
const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail));
|
|
52145
52145
|
d = new Duplex({
|
|
@@ -52684,7 +52684,7 @@ var require_promises2 = __commonJS({
|
|
|
52684
52684
|
var { pipelineImpl: pl2 } = require_pipeline3();
|
|
52685
52685
|
var { finished } = require_end_of_stream3();
|
|
52686
52686
|
require_stream5();
|
|
52687
|
-
function
|
|
52687
|
+
function pipeline3(...streams) {
|
|
52688
52688
|
return new Promise2((resolve6, reject) => {
|
|
52689
52689
|
let signal;
|
|
52690
52690
|
let end;
|
|
@@ -52712,7 +52712,7 @@ var require_promises2 = __commonJS({
|
|
|
52712
52712
|
}
|
|
52713
52713
|
module2.exports = {
|
|
52714
52714
|
finished,
|
|
52715
|
-
pipeline:
|
|
52715
|
+
pipeline: pipeline3
|
|
52716
52716
|
};
|
|
52717
52717
|
}
|
|
52718
52718
|
});
|
|
@@ -52733,7 +52733,7 @@ var require_stream5 = __commonJS({
|
|
|
52733
52733
|
} = require_errors5();
|
|
52734
52734
|
var compose = require_compose2();
|
|
52735
52735
|
var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state3();
|
|
52736
|
-
var { pipeline:
|
|
52736
|
+
var { pipeline: pipeline3 } = require_pipeline3();
|
|
52737
52737
|
var { destroyer } = require_destroy5();
|
|
52738
52738
|
var eos = require_end_of_stream3();
|
|
52739
52739
|
var promises = require_promises2();
|
|
@@ -52797,7 +52797,7 @@ var require_stream5 = __commonJS({
|
|
|
52797
52797
|
Stream.Duplex = require_duplex2();
|
|
52798
52798
|
Stream.Transform = require_transform2();
|
|
52799
52799
|
Stream.PassThrough = require_passthrough3();
|
|
52800
|
-
Stream.pipeline =
|
|
52800
|
+
Stream.pipeline = pipeline3;
|
|
52801
52801
|
var { addAbortSignal } = require_add_abort_signal2();
|
|
52802
52802
|
Stream.addAbortSignal = addAbortSignal;
|
|
52803
52803
|
Stream.finished = eos;
|
|
@@ -52813,7 +52813,7 @@ var require_stream5 = __commonJS({
|
|
|
52813
52813
|
return promises;
|
|
52814
52814
|
}
|
|
52815
52815
|
});
|
|
52816
|
-
ObjectDefineProperty(
|
|
52816
|
+
ObjectDefineProperty(pipeline3, customPromisify, {
|
|
52817
52817
|
__proto__: null,
|
|
52818
52818
|
enumerable: true,
|
|
52819
52819
|
get() {
|
|
@@ -57501,7 +57501,7 @@ var require_pipeline4 = __commonJS({
|
|
|
57501
57501
|
}
|
|
57502
57502
|
}
|
|
57503
57503
|
}
|
|
57504
|
-
function
|
|
57504
|
+
function pipeline3(...streams) {
|
|
57505
57505
|
return pipelineImpl(streams, once(popCallback(streams)));
|
|
57506
57506
|
}
|
|
57507
57507
|
function pipelineImpl(streams, callback2, opts) {
|
|
@@ -57767,7 +57767,7 @@ var require_pipeline4 = __commonJS({
|
|
|
57767
57767
|
}
|
|
57768
57768
|
module2.exports = {
|
|
57769
57769
|
pipelineImpl,
|
|
57770
|
-
pipeline:
|
|
57770
|
+
pipeline: pipeline3
|
|
57771
57771
|
};
|
|
57772
57772
|
}
|
|
57773
57773
|
});
|
|
@@ -57777,7 +57777,7 @@ var require_compose3 = __commonJS({
|
|
|
57777
57777
|
"node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
|
|
57778
57778
|
"use strict";
|
|
57779
57779
|
init_require_shim();
|
|
57780
|
-
var { pipeline:
|
|
57780
|
+
var { pipeline: pipeline3 } = require_pipeline4();
|
|
57781
57781
|
var Duplex = require_duplex3();
|
|
57782
57782
|
var { destroyer } = require_destroy6();
|
|
57783
57783
|
var {
|
|
@@ -57837,7 +57837,7 @@ var require_compose3 = __commonJS({
|
|
|
57837
57837
|
}
|
|
57838
57838
|
}
|
|
57839
57839
|
const head = streams[0];
|
|
57840
|
-
const tail =
|
|
57840
|
+
const tail = pipeline3(streams, onfinished);
|
|
57841
57841
|
const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
|
|
57842
57842
|
const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail));
|
|
57843
57843
|
d = new Duplex({
|
|
@@ -58382,7 +58382,7 @@ var require_promises3 = __commonJS({
|
|
|
58382
58382
|
var { pipelineImpl: pl2 } = require_pipeline4();
|
|
58383
58383
|
var { finished } = require_end_of_stream4();
|
|
58384
58384
|
require_stream6();
|
|
58385
|
-
function
|
|
58385
|
+
function pipeline3(...streams) {
|
|
58386
58386
|
return new Promise2((resolve6, reject) => {
|
|
58387
58387
|
let signal;
|
|
58388
58388
|
let end;
|
|
@@ -58410,7 +58410,7 @@ var require_promises3 = __commonJS({
|
|
|
58410
58410
|
}
|
|
58411
58411
|
module2.exports = {
|
|
58412
58412
|
finished,
|
|
58413
|
-
pipeline:
|
|
58413
|
+
pipeline: pipeline3
|
|
58414
58414
|
};
|
|
58415
58415
|
}
|
|
58416
58416
|
});
|
|
@@ -58431,7 +58431,7 @@ var require_stream6 = __commonJS({
|
|
|
58431
58431
|
} = require_errors6();
|
|
58432
58432
|
var compose = require_compose3();
|
|
58433
58433
|
var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state4();
|
|
58434
|
-
var { pipeline:
|
|
58434
|
+
var { pipeline: pipeline3 } = require_pipeline4();
|
|
58435
58435
|
var { destroyer } = require_destroy6();
|
|
58436
58436
|
var eos = require_end_of_stream4();
|
|
58437
58437
|
var promises = require_promises3();
|
|
@@ -58495,7 +58495,7 @@ var require_stream6 = __commonJS({
|
|
|
58495
58495
|
Stream.Duplex = require_duplex3();
|
|
58496
58496
|
Stream.Transform = require_transform3();
|
|
58497
58497
|
Stream.PassThrough = require_passthrough4();
|
|
58498
|
-
Stream.pipeline =
|
|
58498
|
+
Stream.pipeline = pipeline3;
|
|
58499
58499
|
var { addAbortSignal } = require_add_abort_signal3();
|
|
58500
58500
|
Stream.addAbortSignal = addAbortSignal;
|
|
58501
58501
|
Stream.finished = eos;
|
|
@@ -58511,7 +58511,7 @@ var require_stream6 = __commonJS({
|
|
|
58511
58511
|
return promises;
|
|
58512
58512
|
}
|
|
58513
58513
|
});
|
|
58514
|
-
ObjectDefineProperty(
|
|
58514
|
+
ObjectDefineProperty(pipeline3, customPromisify, {
|
|
58515
58515
|
__proto__: null,
|
|
58516
58516
|
enumerable: true,
|
|
58517
58517
|
get() {
|
|
@@ -60578,13 +60578,13 @@ var require_streamx = __commonJS({
|
|
|
60578
60578
|
}
|
|
60579
60579
|
function pipelinePromise(...streams) {
|
|
60580
60580
|
return new Promise((resolve6, reject) => {
|
|
60581
|
-
return
|
|
60581
|
+
return pipeline3(...streams, (err) => {
|
|
60582
60582
|
if (err) return reject(err);
|
|
60583
60583
|
resolve6();
|
|
60584
60584
|
});
|
|
60585
60585
|
});
|
|
60586
60586
|
}
|
|
60587
|
-
function
|
|
60587
|
+
function pipeline3(stream, ...streams) {
|
|
60588
60588
|
const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
|
|
60589
60589
|
const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
|
|
60590
60590
|
if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
|
|
@@ -60678,7 +60678,7 @@ var require_streamx = __commonJS({
|
|
|
60678
60678
|
return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
|
|
60679
60679
|
}
|
|
60680
60680
|
module2.exports = {
|
|
60681
|
-
pipeline:
|
|
60681
|
+
pipeline: pipeline3,
|
|
60682
60682
|
pipelinePromise,
|
|
60683
60683
|
isStream: isStream2,
|
|
60684
60684
|
isStreamx,
|
|
@@ -69163,6 +69163,8 @@ function formatList(node2, bullet, depth) {
|
|
|
69163
69163
|
init_require_shim();
|
|
69164
69164
|
import fsPromises from "node:fs/promises";
|
|
69165
69165
|
import { createReadStream, createWriteStream, realpathSync as realpathSync2 } from "node:fs";
|
|
69166
|
+
import { pipeline } from "node:stream";
|
|
69167
|
+
import { createZstdDecompress } from "node:zlib";
|
|
69166
69168
|
import path5 from "node:path";
|
|
69167
69169
|
|
|
69168
69170
|
// node_modules/tinyglobby/dist/index.mjs
|
|
@@ -70087,6 +70089,108 @@ function sliceLines(content, from, to) {
|
|
|
70087
70089
|
if (sliced.length === 0) return "";
|
|
70088
70090
|
return sliced.join("\n") + (hadTrailing ? "\n" : "");
|
|
70089
70091
|
}
|
|
70092
|
+
var RANGE_CHUNK_BYTES = 64 * 1024;
|
|
70093
|
+
async function readTailBytes(handle, size, count) {
|
|
70094
|
+
const chunks = [];
|
|
70095
|
+
let pos = size;
|
|
70096
|
+
let seen = 0;
|
|
70097
|
+
while (pos > 0) {
|
|
70098
|
+
const length = Math.min(RANGE_CHUNK_BYTES, pos);
|
|
70099
|
+
pos -= length;
|
|
70100
|
+
const chunk = Buffer.alloc(length);
|
|
70101
|
+
const { bytesRead } = await handle.read(chunk, 0, length, pos);
|
|
70102
|
+
if (bytesRead !== length) return null;
|
|
70103
|
+
let at = pos + length === size && chunk[length - 1] === 10 ? length - 1 : length;
|
|
70104
|
+
while (at > 0 && (at = chunk.lastIndexOf(10, at - 1)) !== -1) {
|
|
70105
|
+
if (++seen === count) {
|
|
70106
|
+
chunks.unshift(chunk.subarray(at + 1));
|
|
70107
|
+
return { bytes: Buffer.concat(chunks), whole: false };
|
|
70108
|
+
}
|
|
70109
|
+
}
|
|
70110
|
+
chunks.unshift(chunk);
|
|
70111
|
+
}
|
|
70112
|
+
return { bytes: Buffer.concat(chunks), whole: true };
|
|
70113
|
+
}
|
|
70114
|
+
async function readHeadBytes(handle, size, count) {
|
|
70115
|
+
const chunks = [];
|
|
70116
|
+
let pos = 0;
|
|
70117
|
+
let seen = 0;
|
|
70118
|
+
while (pos < size) {
|
|
70119
|
+
const length = Math.min(RANGE_CHUNK_BYTES, size - pos);
|
|
70120
|
+
const chunk = Buffer.alloc(length);
|
|
70121
|
+
const { bytesRead } = await handle.read(chunk, 0, length, pos);
|
|
70122
|
+
if (bytesRead !== length) return null;
|
|
70123
|
+
pos += length;
|
|
70124
|
+
let at = -1;
|
|
70125
|
+
while ((at = chunk.indexOf(10, at + 1)) !== -1) {
|
|
70126
|
+
if (++seen === count) {
|
|
70127
|
+
chunks.push(chunk.subarray(0, at));
|
|
70128
|
+
return { bytes: Buffer.concat(chunks), whole: false };
|
|
70129
|
+
}
|
|
70130
|
+
}
|
|
70131
|
+
chunks.push(chunk);
|
|
70132
|
+
}
|
|
70133
|
+
return { bytes: Buffer.concat(chunks), whole: true };
|
|
70134
|
+
}
|
|
70135
|
+
async function readEdgeLines(abs, from, to) {
|
|
70136
|
+
const isTail = Number.isInteger(from) && from < 0 && to == null;
|
|
70137
|
+
const isHead = Number.isInteger(to) && to >= 1 && (from == null || Number.isInteger(from) && from >= 1);
|
|
70138
|
+
if (!isTail && !isHead) return void 0;
|
|
70139
|
+
const handle = await fsPromises.open(abs, "r");
|
|
70140
|
+
try {
|
|
70141
|
+
const stat6 = await handle.stat();
|
|
70142
|
+
if (!stat6.isFile() || stat6.size === 0) return void 0;
|
|
70143
|
+
const part = isTail ? await readTailBytes(handle, stat6.size, -from) : await readHeadBytes(handle, stat6.size, to);
|
|
70144
|
+
if (!part) return void 0;
|
|
70145
|
+
if (part.whole) return sliceLines(stripBom(part.bytes.toString("utf8")), from, to);
|
|
70146
|
+
if (isTail) return part.bytes.toString("utf8");
|
|
70147
|
+
const last = Buffer.alloc(1);
|
|
70148
|
+
await handle.read(last, 0, 1, stat6.size - 1);
|
|
70149
|
+
const lines = stripBom(part.bytes.toString("utf8")).split("\n").slice(from == null ? 0 : from - 1);
|
|
70150
|
+
if (lines.length === 0) return "";
|
|
70151
|
+
return lines.join("\n") + (last[0] === 10 ? "\n" : "");
|
|
70152
|
+
} finally {
|
|
70153
|
+
await handle.close();
|
|
70154
|
+
}
|
|
70155
|
+
}
|
|
70156
|
+
var LINE_BATCH_BYTES = 256 * 1024;
|
|
70157
|
+
async function* readLineBatches(abs, needles, decompress) {
|
|
70158
|
+
let batch = [];
|
|
70159
|
+
let batchBytes = 0;
|
|
70160
|
+
let pending = [];
|
|
70161
|
+
let isFirst = true;
|
|
70162
|
+
const take = (line) => {
|
|
70163
|
+
if (isFirst) {
|
|
70164
|
+
isFirst = false;
|
|
70165
|
+
if (line[0] === 239 && line[1] === 187 && line[2] === 191) line = line.subarray(3);
|
|
70166
|
+
}
|
|
70167
|
+
if (line.at(-1) === 13) line = line.subarray(0, -1);
|
|
70168
|
+
if (needles && !needles.some((n) => line.includes(n))) return;
|
|
70169
|
+
batch.push(line.toString("utf8"));
|
|
70170
|
+
batchBytes += line.length + 1;
|
|
70171
|
+
};
|
|
70172
|
+
const file = createReadStream(abs, { highWaterMark: 1024 * 1024 });
|
|
70173
|
+
const source = decompress ? pipeline(file, createZstdDecompress(), () => {
|
|
70174
|
+
}) : file;
|
|
70175
|
+
for await (const chunk of source) {
|
|
70176
|
+
let start = 0;
|
|
70177
|
+
let nl;
|
|
70178
|
+
while ((nl = chunk.indexOf(10, start)) !== -1) {
|
|
70179
|
+
const piece = chunk.subarray(start, nl);
|
|
70180
|
+
take(pending.length ? Buffer.concat([...pending, piece]) : piece);
|
|
70181
|
+
pending = [];
|
|
70182
|
+
start = nl + 1;
|
|
70183
|
+
if (batchBytes >= LINE_BATCH_BYTES) {
|
|
70184
|
+
yield batch;
|
|
70185
|
+
batch = [];
|
|
70186
|
+
batchBytes = 0;
|
|
70187
|
+
}
|
|
70188
|
+
}
|
|
70189
|
+
if (start < chunk.length) pending.push(chunk.subarray(start));
|
|
70190
|
+
}
|
|
70191
|
+
if (pending.length) take(Buffer.concat(pending));
|
|
70192
|
+
if (batch.length) yield batch;
|
|
70193
|
+
}
|
|
70090
70194
|
function createFsUtils(dir, checkPermission, pluginDir = null, pluginId = null, storeDir = null) {
|
|
70091
70195
|
const ctx = () => ({ dir, pluginDir, pluginId, storeDir });
|
|
70092
70196
|
return {
|
|
@@ -70094,6 +70198,8 @@ function createFsUtils(dir, checkPermission, pluginDir = null, pluginId = null,
|
|
|
70094
70198
|
const abs = resolvePath(relPath, ctx());
|
|
70095
70199
|
if (checkPermission) checkPermission("fs.read", relPath);
|
|
70096
70200
|
try {
|
|
70201
|
+
const edge = await readEdgeLines(abs, from, to);
|
|
70202
|
+
if (edge !== void 0) return edge;
|
|
70097
70203
|
const content = stripBom(await fsPromises.readFile(abs, "utf8"));
|
|
70098
70204
|
return sliceLines(content, from, to);
|
|
70099
70205
|
} catch (err) {
|
|
@@ -70235,6 +70341,13 @@ function createFsUtils(dir, checkPermission, pluginDir = null, pluginId = null,
|
|
|
70235
70341
|
if (checkPermission) checkPermission("fs.read", relPath);
|
|
70236
70342
|
return createReadStream(abs);
|
|
70237
70343
|
},
|
|
70344
|
+
readLinesIter(relPath, { contains, decompress } = {}) {
|
|
70345
|
+
if (decompress != null && decompress !== "zstd") throw new TypeError(`fs.readLinesStream: unsupported decompress "${decompress}", expected "zstd"`);
|
|
70346
|
+
if (contains != null && !Array.isArray(contains)) throw new TypeError("fs.readLinesStream: contains must be an array of strings");
|
|
70347
|
+
const abs = resolvePath(relPath, ctx());
|
|
70348
|
+
if (checkPermission) checkPermission("fs.read", relPath);
|
|
70349
|
+
return readLineBatches(abs, contains?.map((s) => Buffer.from(s, "utf8")) ?? null, decompress === "zstd");
|
|
70350
|
+
},
|
|
70238
70351
|
async appendStreamRef(relPath) {
|
|
70239
70352
|
const abs = resolvePath(relPath, ctx());
|
|
70240
70353
|
if (checkPermission) checkPermission("fs.write", relPath);
|
|
@@ -71509,7 +71622,7 @@ function createShellUtils(dir, checkPermission) {
|
|
|
71509
71622
|
checkShellCommand(cmd, resolveShell(opts.shell).kind, checkPermission);
|
|
71510
71623
|
return new ShellSession(cmd, { dir, ...opts, activeSessions });
|
|
71511
71624
|
}
|
|
71512
|
-
async function createShellJob(cmd, opts, { createJob, updateJobPid, jobStdoutPath, jobStderrPath, jobStdinPath, spawnedBy, projectDir: jobProjectDir }) {
|
|
71625
|
+
async function createShellJob(cmd, opts, { createJob, updateJobPid, jobStdoutPath, jobStderrPath, jobStdinPath, jobPgidPath, spawnedBy, projectDir: jobProjectDir }) {
|
|
71513
71626
|
const repl = opts?.repl ?? false;
|
|
71514
71627
|
checkShellCommand(cmd, resolveShell(opts?.shell).kind, checkPermission);
|
|
71515
71628
|
const { id } = await createJob(null, {
|
|
@@ -71525,12 +71638,15 @@ function createShellUtils(dir, checkPermission) {
|
|
|
71525
71638
|
if (repl) {
|
|
71526
71639
|
const stdinLog = jobStdinPath(jobProjectDir, id);
|
|
71527
71640
|
fs.writeFileSync(stdinLog, "");
|
|
71641
|
+
const jobShell = resolveShell(opts?.shell);
|
|
71642
|
+
const recordGroup = process.platform === "win32" && jobShell.kind !== "cmd";
|
|
71528
71643
|
const wrapperEnv = {
|
|
71529
71644
|
...childEnv,
|
|
71530
|
-
CRUNES_SHELL_CMD: cmd,
|
|
71645
|
+
CRUNES_SHELL_CMD: recordGroup ? `cat /proc/$$/pgid > "$CRUNES_JOB_PGID"; ${cmd}` : cmd,
|
|
71531
71646
|
CRUNES_SHELL_CWD: jobProjectDir,
|
|
71532
71647
|
CRUNES_STDIN_LOG: stdinLog,
|
|
71533
|
-
CRUNES_SHELL_PATH:
|
|
71648
|
+
CRUNES_SHELL_PATH: jobShell.path,
|
|
71649
|
+
...recordGroup ? { CRUNES_JOB_PGID: jobPgidPath(jobProjectDir, id) } : {}
|
|
71534
71650
|
};
|
|
71535
71651
|
const wrapper = `
|
|
71536
71652
|
const {spawn}=require('child_process'),{openSync,closeSync,statSync,readSync}=require('fs')
|
|
@@ -74578,7 +74694,7 @@ function createOsInfo() {
|
|
|
74578
74694
|
init_require_shim();
|
|
74579
74695
|
import fs3 from "node:fs/promises";
|
|
74580
74696
|
import { createWriteStream as createWriteStream2 } from "node:fs";
|
|
74581
|
-
import { pipeline } from "node:stream/promises";
|
|
74697
|
+
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
74582
74698
|
import path12 from "node:path";
|
|
74583
74699
|
var _unzipper;
|
|
74584
74700
|
function getUnzipper() {
|
|
@@ -74635,7 +74751,7 @@ function createArchiveUtils(dir, checkPermission) {
|
|
|
74635
74751
|
await fs3.mkdir(absEntry, { recursive: true });
|
|
74636
74752
|
} else {
|
|
74637
74753
|
await fs3.mkdir(path12.dirname(absEntry), { recursive: true });
|
|
74638
|
-
await
|
|
74754
|
+
await pipeline2(file.stream(), createWriteStream2(absEntry));
|
|
74639
74755
|
}
|
|
74640
74756
|
}
|
|
74641
74757
|
},
|
|
@@ -74727,7 +74843,7 @@ function createArchiveUtils(dir, checkPermission) {
|
|
|
74727
74843
|
if (entry.type === "Directory") {
|
|
74728
74844
|
p2 = fs3.mkdir(absEntry, { recursive: true }).then(() => entry.autodrain()).catch(() => entry.autodrain());
|
|
74729
74845
|
} else {
|
|
74730
|
-
p2 = fs3.mkdir(path12.dirname(absEntry), { recursive: true }).then(() =>
|
|
74846
|
+
p2 = fs3.mkdir(path12.dirname(absEntry), { recursive: true }).then(() => pipeline2(entry, createWriteStream2(absEntry))).catch(() => entry.autodrain());
|
|
74731
74847
|
}
|
|
74732
74848
|
activePromises.add(p2);
|
|
74733
74849
|
p2.finally(() => activePromises.delete(p2));
|
|
@@ -74924,7 +75040,7 @@ function createCacheUtils(dir, checkPermission, { pluginId = null, storeDir = nu
|
|
|
74924
75040
|
|
|
74925
75041
|
// src/rune/api/sqlite.js
|
|
74926
75042
|
init_require_shim();
|
|
74927
|
-
import { mkdirSync } from "node:fs";
|
|
75043
|
+
import { existsSync as existsSync4, mkdirSync } from "node:fs";
|
|
74928
75044
|
import path14 from "node:path";
|
|
74929
75045
|
async function loadDatabase() {
|
|
74930
75046
|
try {
|
|
@@ -74939,10 +75055,29 @@ async function loadDatabase() {
|
|
|
74939
75055
|
function resolveFileName(name) {
|
|
74940
75056
|
return /\.\w+$/.test(name) ? name : `${name}.sqlite`;
|
|
74941
75057
|
}
|
|
75058
|
+
function isGranted(check) {
|
|
75059
|
+
if (!check) return true;
|
|
75060
|
+
try {
|
|
75061
|
+
check();
|
|
75062
|
+
return true;
|
|
75063
|
+
} catch (err) {
|
|
75064
|
+
if (err instanceof PermissionError) return false;
|
|
75065
|
+
throw err;
|
|
75066
|
+
}
|
|
75067
|
+
}
|
|
75068
|
+
function openDatabase(Database, dbPath, checkRead, checkWrite) {
|
|
75069
|
+
if (isGranted(checkWrite)) {
|
|
75070
|
+
mkdirSync(path14.dirname(dbPath), { recursive: true });
|
|
75071
|
+
const db = new Database(dbPath);
|
|
75072
|
+
db.pragma("journal_mode = WAL");
|
|
75073
|
+
return db;
|
|
75074
|
+
}
|
|
75075
|
+
checkRead();
|
|
75076
|
+
if (!existsSync4(dbPath)) throw new Error(`sqlite.open: no database at ${dbPath}, and creating one needs a sqlite.write grant`);
|
|
75077
|
+
return new Database(dbPath, { readonly: true, fileMustExist: true });
|
|
75078
|
+
}
|
|
74942
75079
|
function makeHandle2(Database, dbPath, checkRead, checkWrite, connections) {
|
|
74943
|
-
|
|
74944
|
-
const db = new Database(dbPath);
|
|
74945
|
-
db.pragma("journal_mode = WAL");
|
|
75080
|
+
const db = openDatabase(Database, dbPath, checkRead, checkWrite);
|
|
74946
75081
|
connections.push(db);
|
|
74947
75082
|
return {
|
|
74948
75083
|
query(sql, params = []) {
|
|
@@ -75812,6 +75947,52 @@ function createTestRune() {
|
|
|
75812
75947
|
}
|
|
75813
75948
|
};
|
|
75814
75949
|
}
|
|
75950
|
+
function createTestFs(fs5) {
|
|
75951
|
+
return {
|
|
75952
|
+
...fs5,
|
|
75953
|
+
readLinesStream(path16, opts) {
|
|
75954
|
+
let iter;
|
|
75955
|
+
return new ReadableStream({
|
|
75956
|
+
async start() {
|
|
75957
|
+
iter = fs5.readLinesIter(path16, opts);
|
|
75958
|
+
},
|
|
75959
|
+
async pull(controller) {
|
|
75960
|
+
const { value, done } = await iter.next();
|
|
75961
|
+
if (done) controller.close();
|
|
75962
|
+
else for (const line of value) controller.enqueue(line);
|
|
75963
|
+
},
|
|
75964
|
+
async cancel() {
|
|
75965
|
+
await iter.return();
|
|
75966
|
+
}
|
|
75967
|
+
});
|
|
75968
|
+
}
|
|
75969
|
+
};
|
|
75970
|
+
}
|
|
75971
|
+
function createTestSqlite(sqlite) {
|
|
75972
|
+
return {
|
|
75973
|
+
async open(location, name) {
|
|
75974
|
+
const handle = await sqlite.openHandle(location, name ?? void 0);
|
|
75975
|
+
const db = {
|
|
75976
|
+
query: async (sql, params) => handle.query(sql, params),
|
|
75977
|
+
get: async (sql, params) => handle.get(sql, params),
|
|
75978
|
+
exec: async (sql, params) => handle.exec(sql, params),
|
|
75979
|
+
run: async (sql) => handle.run(sql),
|
|
75980
|
+
transaction: async (fn) => {
|
|
75981
|
+
await db.exec("BEGIN");
|
|
75982
|
+
try {
|
|
75983
|
+
await fn();
|
|
75984
|
+
await db.exec("COMMIT");
|
|
75985
|
+
} catch (e) {
|
|
75986
|
+
await db.exec("ROLLBACK");
|
|
75987
|
+
throw e;
|
|
75988
|
+
}
|
|
75989
|
+
},
|
|
75990
|
+
close: async () => handle.close()
|
|
75991
|
+
};
|
|
75992
|
+
return db;
|
|
75993
|
+
}
|
|
75994
|
+
};
|
|
75995
|
+
}
|
|
75815
75996
|
function setupCrunesTest({
|
|
75816
75997
|
cwd = process.cwd(),
|
|
75817
75998
|
projectRoot = cwd,
|
|
@@ -75843,6 +76024,8 @@ function setupCrunesTest({
|
|
|
75843
76024
|
);
|
|
75844
76025
|
const merged = {
|
|
75845
76026
|
...utils,
|
|
76027
|
+
fs: createTestFs(utils.fs),
|
|
76028
|
+
sqlite: createTestSqlite(utils.sqlite),
|
|
75846
76029
|
crypt: createTestCrypt(),
|
|
75847
76030
|
codec: { ...codec_exports },
|
|
75848
76031
|
time: { after: (ms) => new Promise((resolve6) => setTimeout(resolve6, ms)) },
|