@darkrymit/crunes-cli 0.14.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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  joinBracketTokens,
3
3
  parseBracketKey
4
- } from "./chunk-PICTIOYJ.js";
4
+ } from "./chunk-JDPQACG7.js";
5
5
  import {
6
6
  output
7
7
  } from "./chunk-RQ6KHY6W.js";
@@ -11,8 +11,8 @@ import {
11
11
  } from "./chunk-AFAVAB5Q.js";
12
12
  import {
13
13
  runRune
14
- } from "./chunk-WUNDVEEL.js";
15
- import "./chunk-C3FADOZT.js";
14
+ } from "./chunk-W2A4ECOP.js";
15
+ import "./chunk-NCSTZMBQ.js";
16
16
  import "./chunk-UKAIACRQ.js";
17
17
  import "./chunk-HQUMVDQE.js";
18
18
  import {
@@ -5,10 +5,10 @@ import {
5
5
  import {
6
6
  describeConfigLayers,
7
7
  runRune
8
- } from "./chunk-WUNDVEEL.js";
8
+ } from "./chunk-W2A4ECOP.js";
9
9
  import {
10
10
  renderSection
11
- } from "./chunk-C3FADOZT.js";
11
+ } from "./chunk-NCSTZMBQ.js";
12
12
  import {
13
13
  loadConfig
14
14
  } from "./chunk-YUI5RTLD.js";
@@ -216,7 +216,7 @@ async function handler({
216
216
  process.exit(1);
217
217
  }
218
218
  if (isBatch) {
219
- const { resolvePluginRune } = await import("./resolver-II54EHPA.js");
219
+ const { resolvePluginRune } = await import("./resolver-4IZNQ3QJ.js");
220
220
  const { loadPluginJson } = await import("./manifest-6KLIS7BL.js");
221
221
  for (const seg of segments) {
222
222
  let entry = config.runes?.[seg.key] ?? {};
@@ -440,7 +440,7 @@ async function getRunBlockSchema(desc, projectDir, { vars = {}, runeKey = null }
440
440
  if (/\.json$/i.test(desc.argsModule)) {
441
441
  return loadJsonSchema(desc.argsModule, relative(projectDir, desc.argsModule).replace(/\\/g, "/") || desc.argsModule);
442
442
  }
443
- const { getArgsSchema } = await import("./runner-OKVKI7FP.js");
443
+ const { getArgsSchema } = await import("./runner-RYJO4AN3.js");
444
444
  return getArgsSchema(desc.argsModule, blockGrants({ permissions: desc.argsPermissions }), projectDir, { vars, runeKey });
445
445
  }
446
446
  function parseOutputLine(line) {
@@ -474,7 +474,7 @@ async function runRunBlock({ dir, key, args, entry, opts = {}, configDir, runeCa
474
474
  const desc = describeRunBlock(entry, configDir);
475
475
  let callArgs = [...desc.argv, ...args];
476
476
  if (desc.runtime === "isolate") {
477
- const { runRuneInIsolate } = await import("./runner-OKVKI7FP.js");
477
+ const { runRuneInIsolate } = await import("./runner-RYJO4AN3.js");
478
478
  return runRuneInIsolate(desc.command, blockGrants(desc), callArgs, dir, {
479
479
  runeCallback,
480
480
  sections: opts.sections ?? null,
@@ -28,6 +28,7 @@ import {
28
28
  scopedPermissions
29
29
  } from "./chunk-4SZGKHSW.js";
30
30
  import {
31
+ PermissionError,
31
32
  computeEffectivePermissions,
32
33
  ensureProjectIdentity,
33
34
  getAutoPermits,
@@ -18986,7 +18987,7 @@ var require_parse2 = __commonJS({
18986
18987
  var BufferStream = require_BufferStream();
18987
18988
  var parseExtraField = require_parseExtraField();
18988
18989
  var parseDateTime = require_parseDateTime();
18989
- var pipeline2 = Stream.pipeline;
18990
+ var pipeline3 = Stream.pipeline;
18990
18991
  var parseBuffer = require_parseBuffer();
18991
18992
  var endDirectorySignature = Buffer.alloc(4);
18992
18993
  endDirectorySignature.writeUInt32LE(101010256, 0);
@@ -19135,7 +19136,7 @@ var require_parse2 = __commonJS({
19135
19136
  eof.writeUInt32LE(134695760, 0);
19136
19137
  }
19137
19138
  return new Promise(function(resolve6, reject) {
19138
- pipeline2(
19139
+ pipeline3(
19139
19140
  self2.stream(eof),
19140
19141
  inflater,
19141
19142
  entry,
@@ -26431,7 +26432,7 @@ var require_pipeline = __commonJS({
26431
26432
  if (typeof streams[streams.length - 1] !== "function") return noop;
26432
26433
  return streams.pop();
26433
26434
  }
26434
- function pipeline2() {
26435
+ function pipeline3() {
26435
26436
  for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
26436
26437
  streams[_key] = arguments[_key];
26437
26438
  }
@@ -26454,7 +26455,7 @@ var require_pipeline = __commonJS({
26454
26455
  });
26455
26456
  return streams.reduce(pipe);
26456
26457
  }
26457
- module2.exports = pipeline2;
26458
+ module2.exports = pipeline3;
26458
26459
  }
26459
26460
  });
26460
26461
 
@@ -43207,7 +43208,7 @@ var require_pipeline2 = __commonJS({
43207
43208
  }
43208
43209
  }
43209
43210
  }
43210
- function pipeline2(...streams) {
43211
+ function pipeline3(...streams) {
43211
43212
  return pipelineImpl(streams, once(popCallback(streams)));
43212
43213
  }
43213
43214
  function pipelineImpl(streams, callback2, opts) {
@@ -43473,7 +43474,7 @@ var require_pipeline2 = __commonJS({
43473
43474
  }
43474
43475
  module2.exports = {
43475
43476
  pipelineImpl,
43476
- pipeline: pipeline2
43477
+ pipeline: pipeline3
43477
43478
  };
43478
43479
  }
43479
43480
  });
@@ -43483,7 +43484,7 @@ var require_compose = __commonJS({
43483
43484
  "node_modules/archiver/node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
43484
43485
  "use strict";
43485
43486
  init_require_shim();
43486
- var { pipeline: pipeline2 } = require_pipeline2();
43487
+ var { pipeline: pipeline3 } = require_pipeline2();
43487
43488
  var Duplex = require_duplex();
43488
43489
  var { destroyer } = require_destroy4();
43489
43490
  var {
@@ -43543,7 +43544,7 @@ var require_compose = __commonJS({
43543
43544
  }
43544
43545
  }
43545
43546
  const head = streams[0];
43546
- const tail = pipeline2(streams, onfinished);
43547
+ const tail = pipeline3(streams, onfinished);
43547
43548
  const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
43548
43549
  const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail));
43549
43550
  d = new Duplex({
@@ -44088,7 +44089,7 @@ var require_promises = __commonJS({
44088
44089
  var { pipelineImpl: pl2 } = require_pipeline2();
44089
44090
  var { finished } = require_end_of_stream2();
44090
44091
  require_stream4();
44091
- function pipeline2(...streams) {
44092
+ function pipeline3(...streams) {
44092
44093
  return new Promise2((resolve6, reject) => {
44093
44094
  let signal;
44094
44095
  let end;
@@ -44116,7 +44117,7 @@ var require_promises = __commonJS({
44116
44117
  }
44117
44118
  module2.exports = {
44118
44119
  finished,
44119
- pipeline: pipeline2
44120
+ pipeline: pipeline3
44120
44121
  };
44121
44122
  }
44122
44123
  });
@@ -44137,7 +44138,7 @@ var require_stream4 = __commonJS({
44137
44138
  } = require_errors4();
44138
44139
  var compose = require_compose();
44139
44140
  var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state2();
44140
- var { pipeline: pipeline2 } = require_pipeline2();
44141
+ var { pipeline: pipeline3 } = require_pipeline2();
44141
44142
  var { destroyer } = require_destroy4();
44142
44143
  var eos = require_end_of_stream2();
44143
44144
  var promises = require_promises();
@@ -44201,7 +44202,7 @@ var require_stream4 = __commonJS({
44201
44202
  Stream.Duplex = require_duplex();
44202
44203
  Stream.Transform = require_transform();
44203
44204
  Stream.PassThrough = require_passthrough2();
44204
- Stream.pipeline = pipeline2;
44205
+ Stream.pipeline = pipeline3;
44205
44206
  var { addAbortSignal } = require_add_abort_signal();
44206
44207
  Stream.addAbortSignal = addAbortSignal;
44207
44208
  Stream.finished = eos;
@@ -44217,7 +44218,7 @@ var require_stream4 = __commonJS({
44217
44218
  return promises;
44218
44219
  }
44219
44220
  });
44220
- ObjectDefineProperty(pipeline2, customPromisify, {
44221
+ ObjectDefineProperty(pipeline3, customPromisify, {
44221
44222
  __proto__: null,
44222
44223
  enumerable: true,
44223
44224
  get() {
@@ -50093,7 +50094,7 @@ var require_pipeline3 = __commonJS({
50093
50094
  }
50094
50095
  }
50095
50096
  }
50096
- function pipeline2(...streams) {
50097
+ function pipeline3(...streams) {
50097
50098
  return pipelineImpl(streams, once(popCallback(streams)));
50098
50099
  }
50099
50100
  function pipelineImpl(streams, callback2, opts) {
@@ -50359,7 +50360,7 @@ var require_pipeline3 = __commonJS({
50359
50360
  }
50360
50361
  module2.exports = {
50361
50362
  pipelineImpl,
50362
- pipeline: pipeline2
50363
+ pipeline: pipeline3
50363
50364
  };
50364
50365
  }
50365
50366
  });
@@ -50369,7 +50370,7 @@ var require_compose2 = __commonJS({
50369
50370
  "node_modules/compress-commons/node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
50370
50371
  "use strict";
50371
50372
  init_require_shim();
50372
- var { pipeline: pipeline2 } = require_pipeline3();
50373
+ var { pipeline: pipeline3 } = require_pipeline3();
50373
50374
  var Duplex = require_duplex2();
50374
50375
  var { destroyer } = require_destroy5();
50375
50376
  var {
@@ -50429,7 +50430,7 @@ var require_compose2 = __commonJS({
50429
50430
  }
50430
50431
  }
50431
50432
  const head = streams[0];
50432
- const tail = pipeline2(streams, onfinished);
50433
+ const tail = pipeline3(streams, onfinished);
50433
50434
  const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
50434
50435
  const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail));
50435
50436
  d = new Duplex({
@@ -50974,7 +50975,7 @@ var require_promises2 = __commonJS({
50974
50975
  var { pipelineImpl: pl2 } = require_pipeline3();
50975
50976
  var { finished } = require_end_of_stream3();
50976
50977
  require_stream5();
50977
- function pipeline2(...streams) {
50978
+ function pipeline3(...streams) {
50978
50979
  return new Promise2((resolve6, reject) => {
50979
50980
  let signal;
50980
50981
  let end;
@@ -51002,7 +51003,7 @@ var require_promises2 = __commonJS({
51002
51003
  }
51003
51004
  module2.exports = {
51004
51005
  finished,
51005
- pipeline: pipeline2
51006
+ pipeline: pipeline3
51006
51007
  };
51007
51008
  }
51008
51009
  });
@@ -51023,7 +51024,7 @@ var require_stream5 = __commonJS({
51023
51024
  } = require_errors5();
51024
51025
  var compose = require_compose2();
51025
51026
  var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state3();
51026
- var { pipeline: pipeline2 } = require_pipeline3();
51027
+ var { pipeline: pipeline3 } = require_pipeline3();
51027
51028
  var { destroyer } = require_destroy5();
51028
51029
  var eos = require_end_of_stream3();
51029
51030
  var promises = require_promises2();
@@ -51087,7 +51088,7 @@ var require_stream5 = __commonJS({
51087
51088
  Stream.Duplex = require_duplex2();
51088
51089
  Stream.Transform = require_transform2();
51089
51090
  Stream.PassThrough = require_passthrough3();
51090
- Stream.pipeline = pipeline2;
51091
+ Stream.pipeline = pipeline3;
51091
51092
  var { addAbortSignal } = require_add_abort_signal2();
51092
51093
  Stream.addAbortSignal = addAbortSignal;
51093
51094
  Stream.finished = eos;
@@ -51103,7 +51104,7 @@ var require_stream5 = __commonJS({
51103
51104
  return promises;
51104
51105
  }
51105
51106
  });
51106
- ObjectDefineProperty(pipeline2, customPromisify, {
51107
+ ObjectDefineProperty(pipeline3, customPromisify, {
51107
51108
  __proto__: null,
51108
51109
  enumerable: true,
51109
51110
  get() {
@@ -55791,7 +55792,7 @@ var require_pipeline4 = __commonJS({
55791
55792
  }
55792
55793
  }
55793
55794
  }
55794
- function pipeline2(...streams) {
55795
+ function pipeline3(...streams) {
55795
55796
  return pipelineImpl(streams, once(popCallback(streams)));
55796
55797
  }
55797
55798
  function pipelineImpl(streams, callback2, opts) {
@@ -56057,7 +56058,7 @@ var require_pipeline4 = __commonJS({
56057
56058
  }
56058
56059
  module2.exports = {
56059
56060
  pipelineImpl,
56060
- pipeline: pipeline2
56061
+ pipeline: pipeline3
56061
56062
  };
56062
56063
  }
56063
56064
  });
@@ -56067,7 +56068,7 @@ var require_compose3 = __commonJS({
56067
56068
  "node_modules/crc32-stream/node_modules/readable-stream/lib/internal/streams/compose.js"(exports2, module2) {
56068
56069
  "use strict";
56069
56070
  init_require_shim();
56070
- var { pipeline: pipeline2 } = require_pipeline4();
56071
+ var { pipeline: pipeline3 } = require_pipeline4();
56071
56072
  var Duplex = require_duplex3();
56072
56073
  var { destroyer } = require_destroy6();
56073
56074
  var {
@@ -56127,7 +56128,7 @@ var require_compose3 = __commonJS({
56127
56128
  }
56128
56129
  }
56129
56130
  const head = streams[0];
56130
- const tail = pipeline2(streams, onfinished);
56131
+ const tail = pipeline3(streams, onfinished);
56131
56132
  const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head));
56132
56133
  const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail));
56133
56134
  d = new Duplex({
@@ -56672,7 +56673,7 @@ var require_promises3 = __commonJS({
56672
56673
  var { pipelineImpl: pl2 } = require_pipeline4();
56673
56674
  var { finished } = require_end_of_stream4();
56674
56675
  require_stream6();
56675
- function pipeline2(...streams) {
56676
+ function pipeline3(...streams) {
56676
56677
  return new Promise2((resolve6, reject) => {
56677
56678
  let signal;
56678
56679
  let end;
@@ -56700,7 +56701,7 @@ var require_promises3 = __commonJS({
56700
56701
  }
56701
56702
  module2.exports = {
56702
56703
  finished,
56703
- pipeline: pipeline2
56704
+ pipeline: pipeline3
56704
56705
  };
56705
56706
  }
56706
56707
  });
@@ -56721,7 +56722,7 @@ var require_stream6 = __commonJS({
56721
56722
  } = require_errors6();
56722
56723
  var compose = require_compose3();
56723
56724
  var { setDefaultHighWaterMark, getDefaultHighWaterMark } = require_state4();
56724
- var { pipeline: pipeline2 } = require_pipeline4();
56725
+ var { pipeline: pipeline3 } = require_pipeline4();
56725
56726
  var { destroyer } = require_destroy6();
56726
56727
  var eos = require_end_of_stream4();
56727
56728
  var promises = require_promises3();
@@ -56785,7 +56786,7 @@ var require_stream6 = __commonJS({
56785
56786
  Stream.Duplex = require_duplex3();
56786
56787
  Stream.Transform = require_transform3();
56787
56788
  Stream.PassThrough = require_passthrough4();
56788
- Stream.pipeline = pipeline2;
56789
+ Stream.pipeline = pipeline3;
56789
56790
  var { addAbortSignal } = require_add_abort_signal3();
56790
56791
  Stream.addAbortSignal = addAbortSignal;
56791
56792
  Stream.finished = eos;
@@ -56801,7 +56802,7 @@ var require_stream6 = __commonJS({
56801
56802
  return promises;
56802
56803
  }
56803
56804
  });
56804
- ObjectDefineProperty(pipeline2, customPromisify, {
56805
+ ObjectDefineProperty(pipeline3, customPromisify, {
56805
56806
  __proto__: null,
56806
56807
  enumerable: true,
56807
56808
  get() {
@@ -58868,13 +58869,13 @@ var require_streamx = __commonJS({
58868
58869
  }
58869
58870
  function pipelinePromise(...streams) {
58870
58871
  return new Promise((resolve6, reject) => {
58871
- return pipeline2(...streams, (err) => {
58872
+ return pipeline3(...streams, (err) => {
58872
58873
  if (err) return reject(err);
58873
58874
  resolve6();
58874
58875
  });
58875
58876
  });
58876
58877
  }
58877
- function pipeline2(stream, ...streams) {
58878
+ function pipeline3(stream, ...streams) {
58878
58879
  const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
58879
58880
  const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
58880
58881
  if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
@@ -58968,7 +58969,7 @@ var require_streamx = __commonJS({
58968
58969
  return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
58969
58970
  }
58970
58971
  module2.exports = {
58971
- pipeline: pipeline2,
58972
+ pipeline: pipeline3,
58972
58973
  pipelinePromise,
58973
58974
  isStream: isStream2,
58974
58975
  isStreamx,
@@ -67457,6 +67458,8 @@ function formatList(node2, bullet, depth) {
67457
67458
  init_require_shim();
67458
67459
  import fsPromises from "node:fs/promises";
67459
67460
  import { createReadStream, createWriteStream, realpathSync as realpathSync2 } from "node:fs";
67461
+ import { pipeline } from "node:stream";
67462
+ import { createZstdDecompress } from "node:zlib";
67460
67463
  import path from "node:path";
67461
67464
 
67462
67465
  // node_modules/tinyglobby/dist/index.mjs
@@ -68328,7 +68331,7 @@ async function readEdgeLines(abs, from, to) {
68328
68331
  }
68329
68332
  }
68330
68333
  var LINE_BATCH_BYTES = 256 * 1024;
68331
- async function* readLineBatches(abs, needles) {
68334
+ async function* readLineBatches(abs, needles, decompress) {
68332
68335
  let batch = [];
68333
68336
  let batchBytes = 0;
68334
68337
  let pending = [];
@@ -68343,7 +68346,10 @@ async function* readLineBatches(abs, needles) {
68343
68346
  batch.push(line.toString("utf8"));
68344
68347
  batchBytes += line.length + 1;
68345
68348
  };
68346
- for await (const chunk of createReadStream(abs, { highWaterMark: 1024 * 1024 })) {
68349
+ const file = createReadStream(abs, { highWaterMark: 1024 * 1024 });
68350
+ const source = decompress ? pipeline(file, createZstdDecompress(), () => {
68351
+ }) : file;
68352
+ for await (const chunk of source) {
68347
68353
  let start = 0;
68348
68354
  let nl;
68349
68355
  while ((nl = chunk.indexOf(10, start)) !== -1) {
@@ -68512,11 +68518,12 @@ function createFsUtils(dir, checkPermission, pluginDir = null, pluginId = null,
68512
68518
  if (checkPermission) checkPermission("fs.read", relPath);
68513
68519
  return createReadStream(abs);
68514
68520
  },
68515
- readLinesIter(relPath, { contains } = {}) {
68521
+ readLinesIter(relPath, { contains, decompress } = {}) {
68522
+ if (decompress != null && decompress !== "zstd") throw new TypeError(`fs.readLinesStream: unsupported decompress "${decompress}", expected "zstd"`);
68516
68523
  if (contains != null && !Array.isArray(contains)) throw new TypeError("fs.readLinesStream: contains must be an array of strings");
68517
68524
  const abs = resolvePath(relPath, ctx());
68518
68525
  if (checkPermission) checkPermission("fs.read", relPath);
68519
- return readLineBatches(abs, contains?.map((s) => Buffer.from(s, "utf8")) ?? null);
68526
+ return readLineBatches(abs, contains?.map((s) => Buffer.from(s, "utf8")) ?? null, decompress === "zstd");
68520
68527
  },
68521
68528
  async appendStreamRef(relPath) {
68522
68529
  const abs = resolvePath(relPath, ctx());
@@ -72017,7 +72024,7 @@ function createOsInfo() {
72017
72024
  init_require_shim();
72018
72025
  import fs3 from "node:fs/promises";
72019
72026
  import { createWriteStream as createWriteStream2 } from "node:fs";
72020
- import { pipeline } from "node:stream/promises";
72027
+ import { pipeline as pipeline2 } from "node:stream/promises";
72021
72028
  import path7 from "node:path";
72022
72029
  var _unzipper;
72023
72030
  function getUnzipper() {
@@ -72074,7 +72081,7 @@ function createArchiveUtils(dir, checkPermission) {
72074
72081
  await fs3.mkdir(absEntry, { recursive: true });
72075
72082
  } else {
72076
72083
  await fs3.mkdir(path7.dirname(absEntry), { recursive: true });
72077
- await pipeline(file.stream(), createWriteStream2(absEntry));
72084
+ await pipeline2(file.stream(), createWriteStream2(absEntry));
72078
72085
  }
72079
72086
  }
72080
72087
  },
@@ -72166,7 +72173,7 @@ function createArchiveUtils(dir, checkPermission) {
72166
72173
  if (entry.type === "Directory") {
72167
72174
  p2 = fs3.mkdir(absEntry, { recursive: true }).then(() => entry.autodrain()).catch(() => entry.autodrain());
72168
72175
  } else {
72169
- p2 = fs3.mkdir(path7.dirname(absEntry), { recursive: true }).then(() => pipeline(entry, createWriteStream2(absEntry))).catch(() => entry.autodrain());
72176
+ p2 = fs3.mkdir(path7.dirname(absEntry), { recursive: true }).then(() => pipeline2(entry, createWriteStream2(absEntry))).catch(() => entry.autodrain());
72170
72177
  }
72171
72178
  activePromises.add(p2);
72172
72179
  p2.finally(() => activePromises.delete(p2));
@@ -72363,7 +72370,7 @@ function createCacheUtils(dir, checkPermission, { pluginId = null, storeDir = nu
72363
72370
 
72364
72371
  // src/rune/api/sqlite.js
72365
72372
  init_require_shim();
72366
- import { mkdirSync } from "node:fs";
72373
+ import { existsSync as existsSync2, mkdirSync } from "node:fs";
72367
72374
  import path9 from "node:path";
72368
72375
  async function loadDatabase() {
72369
72376
  try {
@@ -72378,10 +72385,29 @@ async function loadDatabase() {
72378
72385
  function resolveFileName(name) {
72379
72386
  return /\.\w+$/.test(name) ? name : `${name}.sqlite`;
72380
72387
  }
72388
+ function isGranted(check) {
72389
+ if (!check) return true;
72390
+ try {
72391
+ check();
72392
+ return true;
72393
+ } catch (err) {
72394
+ if (err instanceof PermissionError) return false;
72395
+ throw err;
72396
+ }
72397
+ }
72398
+ function openDatabase(Database, dbPath, checkRead, checkWrite) {
72399
+ if (isGranted(checkWrite)) {
72400
+ mkdirSync(path9.dirname(dbPath), { recursive: true });
72401
+ const db = new Database(dbPath);
72402
+ db.pragma("journal_mode = WAL");
72403
+ return db;
72404
+ }
72405
+ checkRead();
72406
+ if (!existsSync2(dbPath)) throw new Error(`sqlite.open: no database at ${dbPath}, and creating one needs a sqlite.write grant`);
72407
+ return new Database(dbPath, { readonly: true, fileMustExist: true });
72408
+ }
72381
72409
  function makeHandle2(Database, dbPath, checkRead, checkWrite, connections) {
72382
- mkdirSync(path9.dirname(dbPath), { recursive: true });
72383
- const db = new Database(dbPath);
72384
- db.pragma("journal_mode = WAL");
72410
+ const db = openDatabase(Database, dbPath, checkRead, checkWrite);
72385
72411
  connections.push(db);
72386
72412
  return {
72387
72413
  query(sql, params = []) {
@@ -74524,7 +74550,7 @@ async function injectUtils(isolate, context, utils2, _runeCallback, vars, projec
74524
74550
  }));
74525
74551
  const sqliteHandles = /* @__PURE__ */ new Map();
74526
74552
  let nextSqliteHandle = 0;
74527
- await jail.set("$__utils_sqlite_open", new ivm2.Reference(async (location, name) => {
74553
+ await jail.set("$__utils_sqlite_open", asyncRef(async (location, name) => {
74528
74554
  const handle = await utils2.sqlite.openHandle(location, name ?? "default");
74529
74555
  const id = String(nextSqliteHandle++);
74530
74556
  sqliteHandles.set(id, handle);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRunBlock
3
- } from "./chunk-C3FADOZT.js";
3
+ } from "./chunk-NCSTZMBQ.js";
4
4
  import {
5
5
  isNativeRune,
6
6
  trustDigest,
@@ -127,7 +127,7 @@ async function runPluginMatch({ match, pluginJson, projectPerms, projectVars, ke
127
127
  });
128
128
  return result2?.directExitCode !== void 0 ? result2 : normaliseResult(result2);
129
129
  }
130
- const { executePluginRune } = await import("./runner-OKVKI7FP.js");
130
+ const { executePluginRune } = await import("./runner-RYJO4AN3.js");
131
131
  const result = await executePluginRune({
132
132
  pluginDir,
133
133
  pluginCacheDir,
@@ -225,7 +225,7 @@ async function resolveRuneEntry(projectDir, config, key, configDir = projectDir)
225
225
  const vars = { ...pluginJson.runes[runeKey]?.vars ?? {}, ...config.runes?.[`${pluginKey}:${runeKey}`]?.vars ?? {} };
226
226
  return {
227
227
  async createReplSession(args, opts = {}) {
228
- const { getPluginRunePath, runRuneInRepl } = await import("./runner-OKVKI7FP.js");
228
+ const { getPluginRunePath, runRuneInRepl } = await import("./runner-RYJO4AN3.js");
229
229
  const runeFile = getPluginRunePath(pluginDir, runeKey, pluginJson, "repl");
230
230
  const nodeModulesDir = join(pluginCacheDir, "node_modules");
231
231
  return runRuneInRepl(runeFile, effective, args, projectDir, {
@@ -251,7 +251,7 @@ async function resolveRuneEntry(projectDir, config, key, configDir = projectDir)
251
251
  const vars = entry.vars ?? {};
252
252
  return {
253
253
  async createReplSession(args, opts = {}) {
254
- const { runRuneInRepl } = await import("./runner-OKVKI7FP.js");
254
+ const { runRuneInRepl } = await import("./runner-RYJO4AN3.js");
255
255
  return runRuneInRepl(runeFile, effective, args, projectDir, {
256
256
  vars,
257
257
  runeKey: key,
@@ -275,7 +275,7 @@ async function resolveRuneEntry(projectDir, config, key, configDir = projectDir)
275
275
  const vars = { ...pluginJson.runes[runeKey]?.vars ?? {}, ...config.runes?.[`${pluginKey}:${runeKey}`]?.vars ?? {} };
276
276
  return {
277
277
  async createReplSession(args, opts = {}) {
278
- const { getPluginRunePath, runRuneInRepl } = await import("./runner-OKVKI7FP.js");
278
+ const { getPluginRunePath, runRuneInRepl } = await import("./runner-RYJO4AN3.js");
279
279
  const runeFile = getPluginRunePath(pluginDir, runeKey, pluginJson, "repl");
280
280
  const nodeModulesDir = join(pluginCacheDir, "node_modules");
281
281
  return runRuneInRepl(runeFile, effective, args, projectDir, {