@ronin/compiler 0.13.3 → 0.13.4

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -662
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -1,660 +1,5 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
14
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
32
-
33
- // node_modules/@noble/hashes/_assert.js
34
- var require_assert = __commonJS({
35
- "node_modules/@noble/hashes/_assert.js"(exports) {
36
- "use strict";
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.anumber = anumber;
39
- exports.number = anumber;
40
- exports.abytes = abytes;
41
- exports.bytes = abytes;
42
- exports.ahash = ahash;
43
- exports.aexists = aexists;
44
- exports.aoutput = aoutput;
45
- function anumber(n) {
46
- if (!Number.isSafeInteger(n) || n < 0)
47
- throw new Error("positive integer expected, got " + n);
48
- }
49
- function isBytes(a) {
50
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
51
- }
52
- function abytes(b, ...lengths) {
53
- if (!isBytes(b))
54
- throw new Error("Uint8Array expected");
55
- if (lengths.length > 0 && !lengths.includes(b.length))
56
- throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
57
- }
58
- function ahash(h) {
59
- if (typeof h !== "function" || typeof h.create !== "function")
60
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
61
- anumber(h.outputLen);
62
- anumber(h.blockLen);
63
- }
64
- function aexists(instance, checkFinished = true) {
65
- if (instance.destroyed)
66
- throw new Error("Hash instance has been destroyed");
67
- if (checkFinished && instance.finished)
68
- throw new Error("Hash#digest() has already been called");
69
- }
70
- function aoutput(out, instance) {
71
- abytes(out);
72
- const min = instance.outputLen;
73
- if (out.length < min) {
74
- throw new Error("digestInto() expects output buffer of length at least " + min);
75
- }
76
- }
77
- var assert = {
78
- number: anumber,
79
- bytes: abytes,
80
- hash: ahash,
81
- exists: aexists,
82
- output: aoutput
83
- };
84
- exports.default = assert;
85
- }
86
- });
87
-
88
- // node_modules/@noble/hashes/_u64.js
89
- var require_u64 = __commonJS({
90
- "node_modules/@noble/hashes/_u64.js"(exports) {
91
- "use strict";
92
- Object.defineProperty(exports, "__esModule", { value: true });
93
- exports.add5L = exports.add5H = exports.add4H = exports.add4L = exports.add3H = exports.add3L = exports.rotlBL = exports.rotlBH = exports.rotlSL = exports.rotlSH = exports.rotr32L = exports.rotr32H = exports.rotrBL = exports.rotrBH = exports.rotrSL = exports.rotrSH = exports.shrSL = exports.shrSH = exports.toBig = void 0;
94
- exports.fromBig = fromBig;
95
- exports.split = split;
96
- exports.add = add;
97
- var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
98
- var _32n = /* @__PURE__ */ BigInt(32);
99
- function fromBig(n, le = false) {
100
- if (le)
101
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
102
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
103
- }
104
- function split(lst, le = false) {
105
- let Ah = new Uint32Array(lst.length);
106
- let Al = new Uint32Array(lst.length);
107
- for (let i = 0; i < lst.length; i++) {
108
- const { h, l } = fromBig(lst[i], le);
109
- [Ah[i], Al[i]] = [h, l];
110
- }
111
- return [Ah, Al];
112
- }
113
- var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
114
- exports.toBig = toBig;
115
- var shrSH = (h, _l, s) => h >>> s;
116
- exports.shrSH = shrSH;
117
- var shrSL = (h, l, s) => h << 32 - s | l >>> s;
118
- exports.shrSL = shrSL;
119
- var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
120
- exports.rotrSH = rotrSH;
121
- var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
122
- exports.rotrSL = rotrSL;
123
- var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
124
- exports.rotrBH = rotrBH;
125
- var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
126
- exports.rotrBL = rotrBL;
127
- var rotr32H = (_h, l) => l;
128
- exports.rotr32H = rotr32H;
129
- var rotr32L = (h, _l) => h;
130
- exports.rotr32L = rotr32L;
131
- var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
132
- exports.rotlSH = rotlSH;
133
- var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
134
- exports.rotlSL = rotlSL;
135
- var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
136
- exports.rotlBH = rotlBH;
137
- var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
138
- exports.rotlBL = rotlBL;
139
- function add(Ah, Al, Bh, Bl) {
140
- const l = (Al >>> 0) + (Bl >>> 0);
141
- return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
142
- }
143
- var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
144
- exports.add3L = add3L;
145
- var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
146
- exports.add3H = add3H;
147
- var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
148
- exports.add4L = add4L;
149
- var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
150
- exports.add4H = add4H;
151
- var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
152
- exports.add5L = add5L;
153
- var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
154
- exports.add5H = add5H;
155
- var u64 = {
156
- fromBig,
157
- split,
158
- toBig,
159
- shrSH,
160
- shrSL,
161
- rotrSH,
162
- rotrSL,
163
- rotrBH,
164
- rotrBL,
165
- rotr32H,
166
- rotr32L,
167
- rotlSH,
168
- rotlSL,
169
- rotlBH,
170
- rotlBL,
171
- add,
172
- add3L,
173
- add3H,
174
- add4L,
175
- add4H,
176
- add5H,
177
- add5L
178
- };
179
- exports.default = u64;
180
- }
181
- });
182
-
183
- // node_modules/@noble/hashes/cryptoNode.js
184
- var require_cryptoNode = __commonJS({
185
- "node_modules/@noble/hashes/cryptoNode.js"(exports) {
186
- "use strict";
187
- Object.defineProperty(exports, "__esModule", { value: true });
188
- exports.crypto = void 0;
189
- var nc = __require("node:crypto");
190
- exports.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
191
- }
192
- });
193
-
194
- // node_modules/@noble/hashes/utils.js
195
- var require_utils = __commonJS({
196
- "node_modules/@noble/hashes/utils.js"(exports) {
197
- "use strict";
198
- Object.defineProperty(exports, "__esModule", { value: true });
199
- exports.Hash = exports.nextTick = exports.byteSwapIfBE = exports.byteSwap = exports.isLE = exports.rotl = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
200
- exports.isBytes = isBytes;
201
- exports.byteSwap32 = byteSwap32;
202
- exports.bytesToHex = bytesToHex;
203
- exports.hexToBytes = hexToBytes;
204
- exports.asyncLoop = asyncLoop;
205
- exports.utf8ToBytes = utf8ToBytes;
206
- exports.toBytes = toBytes;
207
- exports.concatBytes = concatBytes;
208
- exports.checkOpts = checkOpts;
209
- exports.wrapConstructor = wrapConstructor;
210
- exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
211
- exports.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts;
212
- exports.randomBytes = randomBytes;
213
- var crypto_1 = require_cryptoNode();
214
- var _assert_js_1 = require_assert();
215
- function isBytes(a) {
216
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
217
- }
218
- var u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
219
- exports.u8 = u8;
220
- var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
221
- exports.u32 = u32;
222
- var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
223
- exports.createView = createView;
224
- var rotr = (word2, shift) => word2 << 32 - shift | word2 >>> shift;
225
- exports.rotr = rotr;
226
- var rotl = (word2, shift) => word2 << shift | word2 >>> 32 - shift >>> 0;
227
- exports.rotl = rotl;
228
- exports.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
229
- var byteSwap = (word2) => word2 << 24 & 4278190080 | word2 << 8 & 16711680 | word2 >>> 8 & 65280 | word2 >>> 24 & 255;
230
- exports.byteSwap = byteSwap;
231
- exports.byteSwapIfBE = exports.isLE ? (n) => n : (n) => (0, exports.byteSwap)(n);
232
- function byteSwap32(arr) {
233
- for (let i = 0; i < arr.length; i++) {
234
- arr[i] = (0, exports.byteSwap)(arr[i]);
235
- }
236
- }
237
- var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
238
- function bytesToHex(bytes) {
239
- (0, _assert_js_1.abytes)(bytes);
240
- let hex = "";
241
- for (let i = 0; i < bytes.length; i++) {
242
- hex += hexes[bytes[i]];
243
- }
244
- return hex;
245
- }
246
- var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
247
- function asciiToBase16(ch) {
248
- if (ch >= asciis._0 && ch <= asciis._9)
249
- return ch - asciis._0;
250
- if (ch >= asciis.A && ch <= asciis.F)
251
- return ch - (asciis.A - 10);
252
- if (ch >= asciis.a && ch <= asciis.f)
253
- return ch - (asciis.a - 10);
254
- return;
255
- }
256
- function hexToBytes(hex) {
257
- if (typeof hex !== "string")
258
- throw new Error("hex string expected, got " + typeof hex);
259
- const hl = hex.length;
260
- const al = hl / 2;
261
- if (hl % 2)
262
- throw new Error("hex string expected, got unpadded hex of length " + hl);
263
- const array = new Uint8Array(al);
264
- for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
265
- const n1 = asciiToBase16(hex.charCodeAt(hi));
266
- const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
267
- if (n1 === void 0 || n2 === void 0) {
268
- const char = hex[hi] + hex[hi + 1];
269
- throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
270
- }
271
- array[ai] = n1 * 16 + n2;
272
- }
273
- return array;
274
- }
275
- var nextTick = async () => {
276
- };
277
- exports.nextTick = nextTick;
278
- async function asyncLoop(iters, tick, cb) {
279
- let ts = Date.now();
280
- for (let i = 0; i < iters; i++) {
281
- cb(i);
282
- const diff = Date.now() - ts;
283
- if (diff >= 0 && diff < tick)
284
- continue;
285
- await (0, exports.nextTick)();
286
- ts += diff;
287
- }
288
- }
289
- function utf8ToBytes(str) {
290
- if (typeof str !== "string")
291
- throw new Error("utf8ToBytes expected string, got " + typeof str);
292
- return new Uint8Array(new TextEncoder().encode(str));
293
- }
294
- function toBytes(data) {
295
- if (typeof data === "string")
296
- data = utf8ToBytes(data);
297
- (0, _assert_js_1.abytes)(data);
298
- return data;
299
- }
300
- function concatBytes(...arrays) {
301
- let sum = 0;
302
- for (let i = 0; i < arrays.length; i++) {
303
- const a = arrays[i];
304
- (0, _assert_js_1.abytes)(a);
305
- sum += a.length;
306
- }
307
- const res = new Uint8Array(sum);
308
- for (let i = 0, pad = 0; i < arrays.length; i++) {
309
- const a = arrays[i];
310
- res.set(a, pad);
311
- pad += a.length;
312
- }
313
- return res;
314
- }
315
- var Hash = class {
316
- // Safe version that clones internal state
317
- clone() {
318
- return this._cloneInto();
319
- }
320
- };
321
- exports.Hash = Hash;
322
- function checkOpts(defaults, opts) {
323
- if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
324
- throw new Error("Options should be object or undefined");
325
- const merged = Object.assign(defaults, opts);
326
- return merged;
327
- }
328
- function wrapConstructor(hashCons) {
329
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
330
- const tmp = hashCons();
331
- hashC.outputLen = tmp.outputLen;
332
- hashC.blockLen = tmp.blockLen;
333
- hashC.create = () => hashCons();
334
- return hashC;
335
- }
336
- function wrapConstructorWithOpts(hashCons) {
337
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
338
- const tmp = hashCons({});
339
- hashC.outputLen = tmp.outputLen;
340
- hashC.blockLen = tmp.blockLen;
341
- hashC.create = (opts) => hashCons(opts);
342
- return hashC;
343
- }
344
- function wrapXOFConstructorWithOpts(hashCons) {
345
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
346
- const tmp = hashCons({});
347
- hashC.outputLen = tmp.outputLen;
348
- hashC.blockLen = tmp.blockLen;
349
- hashC.create = (opts) => hashCons(opts);
350
- return hashC;
351
- }
352
- function randomBytes(bytesLength = 32) {
353
- if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
354
- return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
355
- }
356
- if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") {
357
- return crypto_1.crypto.randomBytes(bytesLength);
358
- }
359
- throw new Error("crypto.getRandomValues must be defined");
360
- }
361
- }
362
- });
363
-
364
- // node_modules/@noble/hashes/sha3.js
365
- var require_sha3 = __commonJS({
366
- "node_modules/@noble/hashes/sha3.js"(exports) {
367
- "use strict";
368
- Object.defineProperty(exports, "__esModule", { value: true });
369
- exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;
370
- exports.keccakP = keccakP;
371
- var _assert_js_1 = require_assert();
372
- var _u64_js_1 = require_u64();
373
- var utils_js_1 = require_utils();
374
- var SHA3_PI = [];
375
- var SHA3_ROTL = [];
376
- var _SHA3_IOTA = [];
377
- var _0n = /* @__PURE__ */ BigInt(0);
378
- var _1n = /* @__PURE__ */ BigInt(1);
379
- var _2n = /* @__PURE__ */ BigInt(2);
380
- var _7n = /* @__PURE__ */ BigInt(7);
381
- var _256n = /* @__PURE__ */ BigInt(256);
382
- var _0x71n = /* @__PURE__ */ BigInt(113);
383
- for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
384
- [x, y] = [y, (2 * x + 3 * y) % 5];
385
- SHA3_PI.push(2 * (5 * y + x));
386
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
387
- let t = _0n;
388
- for (let j = 0; j < 7; j++) {
389
- R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
390
- if (R & _2n)
391
- t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
392
- }
393
- _SHA3_IOTA.push(t);
394
- }
395
- var [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA, true);
396
- var rotlH = (h, l, s) => s > 32 ? (0, _u64_js_1.rotlBH)(h, l, s) : (0, _u64_js_1.rotlSH)(h, l, s);
397
- var rotlL = (h, l, s) => s > 32 ? (0, _u64_js_1.rotlBL)(h, l, s) : (0, _u64_js_1.rotlSL)(h, l, s);
398
- function keccakP(s, rounds = 24) {
399
- const B = new Uint32Array(5 * 2);
400
- for (let round = 24 - rounds; round < 24; round++) {
401
- for (let x = 0; x < 10; x++)
402
- B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
403
- for (let x = 0; x < 10; x += 2) {
404
- const idx1 = (x + 8) % 10;
405
- const idx0 = (x + 2) % 10;
406
- const B0 = B[idx0];
407
- const B1 = B[idx0 + 1];
408
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
409
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
410
- for (let y = 0; y < 50; y += 10) {
411
- s[x + y] ^= Th;
412
- s[x + y + 1] ^= Tl;
413
- }
414
- }
415
- let curH = s[2];
416
- let curL = s[3];
417
- for (let t = 0; t < 24; t++) {
418
- const shift = SHA3_ROTL[t];
419
- const Th = rotlH(curH, curL, shift);
420
- const Tl = rotlL(curH, curL, shift);
421
- const PI = SHA3_PI[t];
422
- curH = s[PI];
423
- curL = s[PI + 1];
424
- s[PI] = Th;
425
- s[PI + 1] = Tl;
426
- }
427
- for (let y = 0; y < 50; y += 10) {
428
- for (let x = 0; x < 10; x++)
429
- B[x] = s[y + x];
430
- for (let x = 0; x < 10; x++)
431
- s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
432
- }
433
- s[0] ^= SHA3_IOTA_H[round];
434
- s[1] ^= SHA3_IOTA_L[round];
435
- }
436
- B.fill(0);
437
- }
438
- var Keccak = class _Keccak extends utils_js_1.Hash {
439
- // NOTE: we accept arguments in bytes instead of bits here.
440
- constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
441
- super();
442
- this.blockLen = blockLen;
443
- this.suffix = suffix;
444
- this.outputLen = outputLen;
445
- this.enableXOF = enableXOF;
446
- this.rounds = rounds;
447
- this.pos = 0;
448
- this.posOut = 0;
449
- this.finished = false;
450
- this.destroyed = false;
451
- (0, _assert_js_1.anumber)(outputLen);
452
- if (0 >= this.blockLen || this.blockLen >= 200)
453
- throw new Error("Sha3 supports only keccak-f1600 function");
454
- this.state = new Uint8Array(200);
455
- this.state32 = (0, utils_js_1.u32)(this.state);
456
- }
457
- keccak() {
458
- if (!utils_js_1.isLE)
459
- (0, utils_js_1.byteSwap32)(this.state32);
460
- keccakP(this.state32, this.rounds);
461
- if (!utils_js_1.isLE)
462
- (0, utils_js_1.byteSwap32)(this.state32);
463
- this.posOut = 0;
464
- this.pos = 0;
465
- }
466
- update(data) {
467
- (0, _assert_js_1.aexists)(this);
468
- const { blockLen, state } = this;
469
- data = (0, utils_js_1.toBytes)(data);
470
- const len = data.length;
471
- for (let pos = 0; pos < len; ) {
472
- const take = Math.min(blockLen - this.pos, len - pos);
473
- for (let i = 0; i < take; i++)
474
- state[this.pos++] ^= data[pos++];
475
- if (this.pos === blockLen)
476
- this.keccak();
477
- }
478
- return this;
479
- }
480
- finish() {
481
- if (this.finished)
482
- return;
483
- this.finished = true;
484
- const { state, suffix, pos, blockLen } = this;
485
- state[pos] ^= suffix;
486
- if ((suffix & 128) !== 0 && pos === blockLen - 1)
487
- this.keccak();
488
- state[blockLen - 1] ^= 128;
489
- this.keccak();
490
- }
491
- writeInto(out) {
492
- (0, _assert_js_1.aexists)(this, false);
493
- (0, _assert_js_1.abytes)(out);
494
- this.finish();
495
- const bufferOut = this.state;
496
- const { blockLen } = this;
497
- for (let pos = 0, len = out.length; pos < len; ) {
498
- if (this.posOut >= blockLen)
499
- this.keccak();
500
- const take = Math.min(blockLen - this.posOut, len - pos);
501
- out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
502
- this.posOut += take;
503
- pos += take;
504
- }
505
- return out;
506
- }
507
- xofInto(out) {
508
- if (!this.enableXOF)
509
- throw new Error("XOF is not possible for this instance");
510
- return this.writeInto(out);
511
- }
512
- xof(bytes) {
513
- (0, _assert_js_1.anumber)(bytes);
514
- return this.xofInto(new Uint8Array(bytes));
515
- }
516
- digestInto(out) {
517
- (0, _assert_js_1.aoutput)(out, this);
518
- if (this.finished)
519
- throw new Error("digest() was already called");
520
- this.writeInto(out);
521
- this.destroy();
522
- return out;
523
- }
524
- digest() {
525
- return this.digestInto(new Uint8Array(this.outputLen));
526
- }
527
- destroy() {
528
- this.destroyed = true;
529
- this.state.fill(0);
530
- }
531
- _cloneInto(to) {
532
- const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
533
- to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
534
- to.state32.set(this.state32);
535
- to.pos = this.pos;
536
- to.posOut = this.posOut;
537
- to.finished = this.finished;
538
- to.rounds = rounds;
539
- to.suffix = suffix;
540
- to.outputLen = outputLen;
541
- to.enableXOF = enableXOF;
542
- to.destroyed = this.destroyed;
543
- return to;
544
- }
545
- };
546
- exports.Keccak = Keccak;
547
- var gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen));
548
- exports.sha3_224 = gen(6, 144, 224 / 8);
549
- exports.sha3_256 = gen(6, 136, 256 / 8);
550
- exports.sha3_384 = gen(6, 104, 384 / 8);
551
- exports.sha3_512 = gen(6, 72, 512 / 8);
552
- exports.keccak_224 = gen(1, 144, 224 / 8);
553
- exports.keccak_256 = gen(1, 136, 256 / 8);
554
- exports.keccak_384 = gen(1, 104, 384 / 8);
555
- exports.keccak_512 = gen(1, 72, 512 / 8);
556
- var genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
557
- exports.shake128 = genShake(31, 168, 128 / 8);
558
- exports.shake256 = genShake(31, 136, 256 / 8);
559
- }
560
- });
561
-
562
- // node_modules/@paralleldrive/cuid2/src/index.js
563
- var require_src = __commonJS({
564
- "node_modules/@paralleldrive/cuid2/src/index.js"(exports, module) {
565
- "use strict";
566
- var { sha3_512: sha3 } = require_sha3();
567
- var defaultLength = 24;
568
- var bigLength = 32;
569
- var createEntropy = (length = 4, random = Math.random) => {
570
- let entropy = "";
571
- while (entropy.length < length) {
572
- entropy = entropy + Math.floor(random() * 36).toString(36);
573
- }
574
- return entropy;
575
- };
576
- function bufToBigInt(buf) {
577
- let bits = 8n;
578
- let value = 0n;
579
- for (const i of buf.values()) {
580
- const bi = BigInt(i);
581
- value = (value << bits) + bi;
582
- }
583
- return value;
584
- }
585
- var hash = (input = "") => {
586
- return bufToBigInt(sha3(input)).toString(36).slice(1);
587
- };
588
- var alphabet = Array.from(
589
- { length: 26 },
590
- (x, i) => String.fromCharCode(i + 97)
591
- );
592
- var randomLetter = (random) => alphabet[Math.floor(random() * alphabet.length)];
593
- var createFingerprint = ({
594
- globalObj = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {},
595
- random = Math.random
596
- } = {}) => {
597
- const globals = Object.keys(globalObj).toString();
598
- const sourceString = globals.length ? globals + createEntropy(bigLength, random) : createEntropy(bigLength, random);
599
- return hash(sourceString).substring(0, bigLength);
600
- };
601
- var createCounter = (count) => () => {
602
- return count++;
603
- };
604
- var initialCountMax = 476782367;
605
- var init = ({
606
- // Fallback if the user does not pass in a CSPRNG. This should be OK
607
- // because we don't rely solely on the random number generator for entropy.
608
- // We also use the host fingerprint, current time, and a session counter.
609
- random = Math.random,
610
- counter = createCounter(Math.floor(random() * initialCountMax)),
611
- length = defaultLength,
612
- fingerprint = createFingerprint({ random })
613
- } = {}) => {
614
- return function cuid2() {
615
- const firstLetter = randomLetter(random);
616
- const time = Date.now().toString(36);
617
- const count = counter().toString(36);
618
- const salt = createEntropy(length, random);
619
- const hashInput = `${time + salt + count + fingerprint}`;
620
- return `${firstLetter + hash(hashInput).substring(1, length)}`;
621
- };
622
- };
623
- var createId = init();
624
- var isCuid = (id, { minLength = 2, maxLength = bigLength } = {}) => {
625
- const length = id.length;
626
- const regex2 = /^[0-9a-z]+$/;
627
- try {
628
- if (typeof id === "string" && length >= minLength && length <= maxLength && regex2.test(id))
629
- return true;
630
- } finally {
631
- }
632
- return false;
633
- };
634
- module.exports.getConstants = () => ({ defaultLength, bigLength });
635
- module.exports.init = init;
636
- module.exports.createId = createId;
637
- module.exports.bufToBigInt = bufToBigInt;
638
- module.exports.createCounter = createCounter;
639
- module.exports.createFingerprint = createFingerprint;
640
- module.exports.isCuid = isCuid;
641
- }
642
- });
643
-
644
- // node_modules/@paralleldrive/cuid2/index.js
645
- var require_cuid2 = __commonJS({
646
- "node_modules/@paralleldrive/cuid2/index.js"(exports, module) {
647
- "use strict";
648
- var { createId, init, getConstants, isCuid } = require_src();
649
- module.exports.createId = createId;
650
- module.exports.init = init;
651
- module.exports.getConstants = getConstants;
652
- module.exports.isCuid = isCuid;
653
- }
654
- });
655
-
656
1
  // src/utils/helpers.ts
657
- var import_cuid2 = __toESM(require_cuid2(), 1);
2
+ import { init as cuid } from "@paralleldrive/cuid2";
658
3
  var QUERY_SYMBOLS = {
659
4
  // Represents a sub query.
660
5
  QUERY: "__RONIN_QUERY",
@@ -709,7 +54,7 @@ var DOUBLE_QUOTE_REGEX = /"/g;
709
54
  var AMPERSAND_REGEX = /\s*&+\s*/g;
710
55
  var SPECIAL_CHARACTERS_REGEX = /[^\w\s-]+/g;
711
56
  var SPLIT_REGEX = /(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|[\s.\-_]+/;
712
- var generateRecordId = (prefix) => `${prefix}_${(0, import_cuid2.init)({ length: 16 })()}`;
57
+ var generateRecordId = (prefix) => `${prefix}_${cuid({ length: 16 })()}`;
713
58
  var capitalize = (str) => {
714
59
  if (!str || str.length === 0) return "";
715
60
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
@@ -2600,8 +1945,3 @@ export {
2600
1945
  RoninError,
2601
1946
  Transaction
2602
1947
  };
2603
- /*! Bundled license information:
2604
-
2605
- @noble/hashes/utils.js:
2606
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
2607
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronin/compiler",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "type": "module",
5
5
  "description": "Compiles RONIN queries to SQL statements.",
6
6
  "publishConfig": {
@@ -27,9 +27,11 @@
27
27
  ],
28
28
  "author": "ronin",
29
29
  "license": "Apache-2.0",
30
+ "dependencies": {
31
+ "@paralleldrive/cuid2": "2.2.2"
32
+ },
30
33
  "devDependencies": {
31
34
  "@biomejs/biome": "1.9.4",
32
- "@paralleldrive/cuid2": "2.2.2",
33
35
  "@ronin/engine": "0.0.27",
34
36
  "@types/bun": "1.1.14",
35
37
  "title": "4.0.1",