@teamkeel/wasm 0.38.0 → 0.41.0

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 +571 -24
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -733,7 +733,7 @@ var require_lodash = __commonJS({
733
733
  }
734
734
  var runInContext = function runInContext2(context) {
735
735
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
736
- var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
736
+ var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
737
737
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
738
738
  var coreJsData = context["__core-js_shared__"];
739
739
  var funcToString = funcProto.toString;
@@ -756,12 +756,12 @@ var require_lodash = __commonJS({
756
756
  } catch (e) {
757
757
  }
758
758
  }();
759
- var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
760
- var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
761
- var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
759
+ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
760
+ var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
761
+ var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
762
762
  var metaMap = WeakMap2 && new WeakMap2();
763
763
  var realNames = {};
764
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
764
+ var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
765
765
  var symbolProto = Symbol ? Symbol.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
766
766
  function lodash(value) {
767
767
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -970,7 +970,7 @@ var require_lodash = __commonJS({
970
970
  this.size = 0;
971
971
  this.__data__ = {
972
972
  "hash": new Hash(),
973
- "map": new (Map || ListCache)(),
973
+ "map": new (Map2 || ListCache)(),
974
974
  "string": new Hash()
975
975
  };
976
976
  }
@@ -1035,7 +1035,7 @@ var require_lodash = __commonJS({
1035
1035
  var data = this.__data__;
1036
1036
  if (data instanceof ListCache) {
1037
1037
  var pairs = data.__data__;
1038
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
1038
+ if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1039
1039
  pairs.push([key, value]);
1040
1040
  this.size = ++data.size;
1041
1041
  return this;
@@ -1216,7 +1216,7 @@ var require_lodash = __commonJS({
1216
1216
  if (typeof func != "function") {
1217
1217
  throw new TypeError2(FUNC_ERROR_TEXT);
1218
1218
  }
1219
- return setTimeout(function() {
1219
+ return setTimeout2(function() {
1220
1220
  func.apply(undefined2, args);
1221
1221
  }, wait);
1222
1222
  }
@@ -1996,7 +1996,7 @@ var require_lodash = __commonJS({
1996
1996
  end = end === undefined2 ? length : end;
1997
1997
  return !start && end >= length ? array : baseSlice(array, start, end);
1998
1998
  }
1999
- var clearTimeout = ctxClearTimeout || function(id) {
1999
+ var clearTimeout2 = ctxClearTimeout || function(id) {
2000
2000
  return root.clearTimeout(id);
2001
2001
  };
2002
2002
  function cloneBuffer(buffer, isDeep) {
@@ -2753,7 +2753,7 @@ var require_lodash = __commonJS({
2753
2753
  return result2;
2754
2754
  };
2755
2755
  var getTag = baseGetTag;
2756
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
2756
+ if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
2757
2757
  getTag = function(value) {
2758
2758
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
2759
2759
  if (ctorString) {
@@ -3025,7 +3025,7 @@ var require_lodash = __commonJS({
3025
3025
  return object[key];
3026
3026
  }
3027
3027
  var setData = shortOut(baseSetData);
3028
- var setTimeout = ctxSetTimeout || function(func, wait) {
3028
+ var setTimeout2 = ctxSetTimeout || function(func, wait) {
3029
3029
  return root.setTimeout(func, wait);
3030
3030
  };
3031
3031
  var setToString = shortOut(baseSetToString);
@@ -3817,7 +3817,7 @@ var require_lodash = __commonJS({
3817
3817
  }
3818
3818
  function leadingEdge(time) {
3819
3819
  lastInvokeTime = time;
3820
- timerId = setTimeout(timerExpired, wait);
3820
+ timerId = setTimeout2(timerExpired, wait);
3821
3821
  return leading ? invokeFunc(time) : result2;
3822
3822
  }
3823
3823
  function remainingWait(time) {
@@ -3833,7 +3833,7 @@ var require_lodash = __commonJS({
3833
3833
  if (shouldInvoke(time)) {
3834
3834
  return trailingEdge(time);
3835
3835
  }
3836
- timerId = setTimeout(timerExpired, remainingWait(time));
3836
+ timerId = setTimeout2(timerExpired, remainingWait(time));
3837
3837
  }
3838
3838
  function trailingEdge(time) {
3839
3839
  timerId = undefined2;
@@ -3845,7 +3845,7 @@ var require_lodash = __commonJS({
3845
3845
  }
3846
3846
  function cancel() {
3847
3847
  if (timerId !== undefined2) {
3848
- clearTimeout(timerId);
3848
+ clearTimeout2(timerId);
3849
3849
  }
3850
3850
  lastInvokeTime = 0;
3851
3851
  lastArgs = lastCallTime = lastThis = timerId = undefined2;
@@ -3863,13 +3863,13 @@ var require_lodash = __commonJS({
3863
3863
  return leadingEdge(lastCallTime);
3864
3864
  }
3865
3865
  if (maxing) {
3866
- clearTimeout(timerId);
3867
- timerId = setTimeout(timerExpired, wait);
3866
+ clearTimeout2(timerId);
3867
+ timerId = setTimeout2(timerExpired, wait);
3868
3868
  return invokeFunc(lastCallTime);
3869
3869
  }
3870
3870
  }
3871
3871
  if (timerId === undefined2) {
3872
- timerId = setTimeout(timerExpired, wait);
3872
+ timerId = setTimeout2(timerExpired, wait);
3873
3873
  }
3874
3874
  return result2;
3875
3875
  }
@@ -5885,7 +5885,7 @@ var require_normalize_options = __commonJS({
5885
5885
  var isValue = require_is_value();
5886
5886
  var forEach = Array.prototype.forEach;
5887
5887
  var create = Object.create;
5888
- var process = function(src, obj) {
5888
+ var process2 = function(src, obj) {
5889
5889
  var key;
5890
5890
  for (key in src)
5891
5891
  obj[key] = src[key];
@@ -5895,7 +5895,7 @@ var require_normalize_options = __commonJS({
5895
5895
  forEach.call(arguments, function(options) {
5896
5896
  if (!isValue(options))
5897
5897
  return;
5898
- process(Object(options), result);
5898
+ process2(Object(options), result);
5899
5899
  });
5900
5900
  return result;
5901
5901
  };
@@ -7247,6 +7247,533 @@ var require_lib = __commonJS({
7247
7247
  }
7248
7248
  });
7249
7249
 
7250
+ // lib/wasm_exec.js
7251
+ var require_wasm_exec = __commonJS({
7252
+ "lib/wasm_exec.js"() {
7253
+ "use strict";
7254
+ (() => {
7255
+ const enosys = () => {
7256
+ const err = new Error("not implemented");
7257
+ err.code = "ENOSYS";
7258
+ return err;
7259
+ };
7260
+ if (!globalThis.fs) {
7261
+ let outputBuf = "";
7262
+ globalThis.fs = {
7263
+ constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },
7264
+ writeSync(fd, buf) {
7265
+ outputBuf += decoder.decode(buf);
7266
+ const nl = outputBuf.lastIndexOf("\n");
7267
+ if (nl != -1) {
7268
+ console.log(outputBuf.substr(0, nl));
7269
+ outputBuf = outputBuf.substr(nl + 1);
7270
+ }
7271
+ return buf.length;
7272
+ },
7273
+ write(fd, buf, offset, length, position, callback) {
7274
+ if (offset !== 0 || length !== buf.length || position !== null) {
7275
+ callback(enosys());
7276
+ return;
7277
+ }
7278
+ const n = this.writeSync(fd, buf);
7279
+ callback(null, n);
7280
+ },
7281
+ chmod(path, mode, callback) {
7282
+ callback(enosys());
7283
+ },
7284
+ chown(path, uid, gid, callback) {
7285
+ callback(enosys());
7286
+ },
7287
+ close(fd, callback) {
7288
+ callback(enosys());
7289
+ },
7290
+ fchmod(fd, mode, callback) {
7291
+ callback(enosys());
7292
+ },
7293
+ fchown(fd, uid, gid, callback) {
7294
+ callback(enosys());
7295
+ },
7296
+ fstat(fd, callback) {
7297
+ callback(enosys());
7298
+ },
7299
+ fsync(fd, callback) {
7300
+ callback(null);
7301
+ },
7302
+ ftruncate(fd, length, callback) {
7303
+ callback(enosys());
7304
+ },
7305
+ lchown(path, uid, gid, callback) {
7306
+ callback(enosys());
7307
+ },
7308
+ link(path, link, callback) {
7309
+ callback(enosys());
7310
+ },
7311
+ lstat(path, callback) {
7312
+ callback(enosys());
7313
+ },
7314
+ mkdir(path, perm, callback) {
7315
+ callback(enosys());
7316
+ },
7317
+ open(path, flags, mode, callback) {
7318
+ callback(enosys());
7319
+ },
7320
+ read(fd, buffer, offset, length, position, callback) {
7321
+ callback(enosys());
7322
+ },
7323
+ readdir(path, callback) {
7324
+ callback(enosys());
7325
+ },
7326
+ readlink(path, callback) {
7327
+ callback(enosys());
7328
+ },
7329
+ rename(from, to, callback) {
7330
+ callback(enosys());
7331
+ },
7332
+ rmdir(path, callback) {
7333
+ callback(enosys());
7334
+ },
7335
+ stat(path, callback) {
7336
+ callback(enosys());
7337
+ },
7338
+ symlink(path, link, callback) {
7339
+ callback(enosys());
7340
+ },
7341
+ truncate(path, length, callback) {
7342
+ callback(enosys());
7343
+ },
7344
+ unlink(path, callback) {
7345
+ callback(enosys());
7346
+ },
7347
+ utimes(path, atime, mtime, callback) {
7348
+ callback(enosys());
7349
+ }
7350
+ };
7351
+ }
7352
+ if (!globalThis.process) {
7353
+ globalThis.process = {
7354
+ getuid() {
7355
+ return -1;
7356
+ },
7357
+ getgid() {
7358
+ return -1;
7359
+ },
7360
+ geteuid() {
7361
+ return -1;
7362
+ },
7363
+ getegid() {
7364
+ return -1;
7365
+ },
7366
+ getgroups() {
7367
+ throw enosys();
7368
+ },
7369
+ pid: -1,
7370
+ ppid: -1,
7371
+ umask() {
7372
+ throw enosys();
7373
+ },
7374
+ cwd() {
7375
+ throw enosys();
7376
+ },
7377
+ chdir() {
7378
+ throw enosys();
7379
+ }
7380
+ };
7381
+ }
7382
+ if (!globalThis.crypto) {
7383
+ throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
7384
+ }
7385
+ if (!globalThis.performance) {
7386
+ throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");
7387
+ }
7388
+ if (!globalThis.TextEncoder) {
7389
+ throw new Error("globalThis.TextEncoder is not available, polyfill required");
7390
+ }
7391
+ if (!globalThis.TextDecoder) {
7392
+ throw new Error("globalThis.TextDecoder is not available, polyfill required");
7393
+ }
7394
+ const encoder = new TextEncoder("utf-8");
7395
+ const decoder = new TextDecoder("utf-8");
7396
+ globalThis.Go = class {
7397
+ constructor() {
7398
+ this.argv = ["js"];
7399
+ this.env = {};
7400
+ this.exit = (code) => {
7401
+ if (code !== 0) {
7402
+ console.warn("exit code:", code);
7403
+ }
7404
+ };
7405
+ this._exitPromise = new Promise((resolve) => {
7406
+ this._resolveExitPromise = resolve;
7407
+ });
7408
+ this._pendingEvent = null;
7409
+ this._scheduledTimeouts = /* @__PURE__ */ new Map();
7410
+ this._nextCallbackTimeoutID = 1;
7411
+ const setInt64 = (addr, v) => {
7412
+ this.mem.setUint32(addr + 0, v, true);
7413
+ this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
7414
+ };
7415
+ const getInt64 = (addr) => {
7416
+ const low = this.mem.getUint32(addr + 0, true);
7417
+ const high = this.mem.getInt32(addr + 4, true);
7418
+ return low + high * 4294967296;
7419
+ };
7420
+ const loadValue = (addr) => {
7421
+ const f = this.mem.getFloat64(addr, true);
7422
+ if (f === 0) {
7423
+ return void 0;
7424
+ }
7425
+ if (!isNaN(f)) {
7426
+ return f;
7427
+ }
7428
+ const id = this.mem.getUint32(addr, true);
7429
+ return this._values[id];
7430
+ };
7431
+ const storeValue = (addr, v) => {
7432
+ const nanHead = 2146959360;
7433
+ if (typeof v === "number" && v !== 0) {
7434
+ if (isNaN(v)) {
7435
+ this.mem.setUint32(addr + 4, nanHead, true);
7436
+ this.mem.setUint32(addr, 0, true);
7437
+ return;
7438
+ }
7439
+ this.mem.setFloat64(addr, v, true);
7440
+ return;
7441
+ }
7442
+ if (v === void 0) {
7443
+ this.mem.setFloat64(addr, 0, true);
7444
+ return;
7445
+ }
7446
+ let id = this._ids.get(v);
7447
+ if (id === void 0) {
7448
+ id = this._idPool.pop();
7449
+ if (id === void 0) {
7450
+ id = this._values.length;
7451
+ }
7452
+ this._values[id] = v;
7453
+ this._goRefCounts[id] = 0;
7454
+ this._ids.set(v, id);
7455
+ }
7456
+ this._goRefCounts[id]++;
7457
+ let typeFlag = 0;
7458
+ switch (typeof v) {
7459
+ case "object":
7460
+ if (v !== null) {
7461
+ typeFlag = 1;
7462
+ }
7463
+ break;
7464
+ case "string":
7465
+ typeFlag = 2;
7466
+ break;
7467
+ case "symbol":
7468
+ typeFlag = 3;
7469
+ break;
7470
+ case "function":
7471
+ typeFlag = 4;
7472
+ break;
7473
+ }
7474
+ this.mem.setUint32(addr + 4, nanHead | typeFlag, true);
7475
+ this.mem.setUint32(addr, id, true);
7476
+ };
7477
+ const loadSlice = (addr) => {
7478
+ const array = getInt64(addr + 0);
7479
+ const len = getInt64(addr + 8);
7480
+ return new Uint8Array(this._inst.exports.mem.buffer, array, len);
7481
+ };
7482
+ const loadSliceOfValues = (addr) => {
7483
+ const array = getInt64(addr + 0);
7484
+ const len = getInt64(addr + 8);
7485
+ const a = new Array(len);
7486
+ for (let i = 0; i < len; i++) {
7487
+ a[i] = loadValue(array + i * 8);
7488
+ }
7489
+ return a;
7490
+ };
7491
+ const loadString = (addr) => {
7492
+ const saddr = getInt64(addr + 0);
7493
+ const len = getInt64(addr + 8);
7494
+ return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));
7495
+ };
7496
+ const timeOrigin = Date.now() - performance.now();
7497
+ this.importObject = {
7498
+ go: {
7499
+ "runtime.wasmExit": (sp) => {
7500
+ sp >>>= 0;
7501
+ const code = this.mem.getInt32(sp + 8, true);
7502
+ this.exited = true;
7503
+ delete this._inst;
7504
+ delete this._values;
7505
+ delete this._goRefCounts;
7506
+ delete this._ids;
7507
+ delete this._idPool;
7508
+ this.exit(code);
7509
+ },
7510
+ "runtime.wasmWrite": (sp) => {
7511
+ sp >>>= 0;
7512
+ const fd = getInt64(sp + 8);
7513
+ const p = getInt64(sp + 16);
7514
+ const n = this.mem.getInt32(sp + 24, true);
7515
+ fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));
7516
+ },
7517
+ "runtime.resetMemoryDataView": (sp) => {
7518
+ sp >>>= 0;
7519
+ this.mem = new DataView(this._inst.exports.mem.buffer);
7520
+ },
7521
+ "runtime.nanotime1": (sp) => {
7522
+ sp >>>= 0;
7523
+ setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);
7524
+ },
7525
+ "runtime.walltime": (sp) => {
7526
+ sp >>>= 0;
7527
+ const msec = new Date().getTime();
7528
+ setInt64(sp + 8, msec / 1e3);
7529
+ this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);
7530
+ },
7531
+ "runtime.scheduleTimeoutEvent": (sp) => {
7532
+ sp >>>= 0;
7533
+ const id = this._nextCallbackTimeoutID;
7534
+ this._nextCallbackTimeoutID++;
7535
+ this._scheduledTimeouts.set(id, setTimeout(() => {
7536
+ this._resume();
7537
+ while (this._scheduledTimeouts.has(id)) {
7538
+ console.warn("scheduleTimeoutEvent: missed timeout event");
7539
+ this._resume();
7540
+ }
7541
+ }, getInt64(sp + 8) + 1));
7542
+ this.mem.setInt32(sp + 16, id, true);
7543
+ },
7544
+ "runtime.clearTimeoutEvent": (sp) => {
7545
+ sp >>>= 0;
7546
+ const id = this.mem.getInt32(sp + 8, true);
7547
+ clearTimeout(this._scheduledTimeouts.get(id));
7548
+ this._scheduledTimeouts.delete(id);
7549
+ },
7550
+ "runtime.getRandomData": (sp) => {
7551
+ sp >>>= 0;
7552
+ crypto.getRandomValues(loadSlice(sp + 8));
7553
+ },
7554
+ "syscall/js.finalizeRef": (sp) => {
7555
+ sp >>>= 0;
7556
+ const id = this.mem.getUint32(sp + 8, true);
7557
+ this._goRefCounts[id]--;
7558
+ if (this._goRefCounts[id] === 0) {
7559
+ const v = this._values[id];
7560
+ this._values[id] = null;
7561
+ this._ids.delete(v);
7562
+ this._idPool.push(id);
7563
+ }
7564
+ },
7565
+ "syscall/js.stringVal": (sp) => {
7566
+ sp >>>= 0;
7567
+ storeValue(sp + 24, loadString(sp + 8));
7568
+ },
7569
+ "syscall/js.valueGet": (sp) => {
7570
+ sp >>>= 0;
7571
+ const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));
7572
+ sp = this._inst.exports.getsp() >>> 0;
7573
+ storeValue(sp + 32, result);
7574
+ },
7575
+ "syscall/js.valueSet": (sp) => {
7576
+ sp >>>= 0;
7577
+ Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));
7578
+ },
7579
+ "syscall/js.valueDelete": (sp) => {
7580
+ sp >>>= 0;
7581
+ Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));
7582
+ },
7583
+ "syscall/js.valueIndex": (sp) => {
7584
+ sp >>>= 0;
7585
+ storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));
7586
+ },
7587
+ "syscall/js.valueSetIndex": (sp) => {
7588
+ sp >>>= 0;
7589
+ Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));
7590
+ },
7591
+ "syscall/js.valueCall": (sp) => {
7592
+ sp >>>= 0;
7593
+ try {
7594
+ const v = loadValue(sp + 8);
7595
+ const m = Reflect.get(v, loadString(sp + 16));
7596
+ const args = loadSliceOfValues(sp + 32);
7597
+ const result = Reflect.apply(m, v, args);
7598
+ sp = this._inst.exports.getsp() >>> 0;
7599
+ storeValue(sp + 56, result);
7600
+ this.mem.setUint8(sp + 64, 1);
7601
+ } catch (err) {
7602
+ sp = this._inst.exports.getsp() >>> 0;
7603
+ storeValue(sp + 56, err);
7604
+ this.mem.setUint8(sp + 64, 0);
7605
+ }
7606
+ },
7607
+ "syscall/js.valueInvoke": (sp) => {
7608
+ sp >>>= 0;
7609
+ try {
7610
+ const v = loadValue(sp + 8);
7611
+ const args = loadSliceOfValues(sp + 16);
7612
+ const result = Reflect.apply(v, void 0, args);
7613
+ sp = this._inst.exports.getsp() >>> 0;
7614
+ storeValue(sp + 40, result);
7615
+ this.mem.setUint8(sp + 48, 1);
7616
+ } catch (err) {
7617
+ sp = this._inst.exports.getsp() >>> 0;
7618
+ storeValue(sp + 40, err);
7619
+ this.mem.setUint8(sp + 48, 0);
7620
+ }
7621
+ },
7622
+ "syscall/js.valueNew": (sp) => {
7623
+ sp >>>= 0;
7624
+ try {
7625
+ const v = loadValue(sp + 8);
7626
+ const args = loadSliceOfValues(sp + 16);
7627
+ const result = Reflect.construct(v, args);
7628
+ sp = this._inst.exports.getsp() >>> 0;
7629
+ storeValue(sp + 40, result);
7630
+ this.mem.setUint8(sp + 48, 1);
7631
+ } catch (err) {
7632
+ sp = this._inst.exports.getsp() >>> 0;
7633
+ storeValue(sp + 40, err);
7634
+ this.mem.setUint8(sp + 48, 0);
7635
+ }
7636
+ },
7637
+ "syscall/js.valueLength": (sp) => {
7638
+ sp >>>= 0;
7639
+ setInt64(sp + 16, parseInt(loadValue(sp + 8).length));
7640
+ },
7641
+ "syscall/js.valuePrepareString": (sp) => {
7642
+ sp >>>= 0;
7643
+ const str = encoder.encode(String(loadValue(sp + 8)));
7644
+ storeValue(sp + 16, str);
7645
+ setInt64(sp + 24, str.length);
7646
+ },
7647
+ "syscall/js.valueLoadString": (sp) => {
7648
+ sp >>>= 0;
7649
+ const str = loadValue(sp + 8);
7650
+ loadSlice(sp + 16).set(str);
7651
+ },
7652
+ "syscall/js.valueInstanceOf": (sp) => {
7653
+ sp >>>= 0;
7654
+ this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);
7655
+ },
7656
+ "syscall/js.copyBytesToGo": (sp) => {
7657
+ sp >>>= 0;
7658
+ const dst = loadSlice(sp + 8);
7659
+ const src = loadValue(sp + 32);
7660
+ if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {
7661
+ this.mem.setUint8(sp + 48, 0);
7662
+ return;
7663
+ }
7664
+ const toCopy = src.subarray(0, dst.length);
7665
+ dst.set(toCopy);
7666
+ setInt64(sp + 40, toCopy.length);
7667
+ this.mem.setUint8(sp + 48, 1);
7668
+ },
7669
+ "syscall/js.copyBytesToJS": (sp) => {
7670
+ sp >>>= 0;
7671
+ const dst = loadValue(sp + 8);
7672
+ const src = loadSlice(sp + 16);
7673
+ if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {
7674
+ this.mem.setUint8(sp + 48, 0);
7675
+ return;
7676
+ }
7677
+ const toCopy = src.subarray(0, dst.length);
7678
+ dst.set(toCopy);
7679
+ setInt64(sp + 40, toCopy.length);
7680
+ this.mem.setUint8(sp + 48, 1);
7681
+ },
7682
+ "debug": (value) => {
7683
+ console.log(value);
7684
+ }
7685
+ }
7686
+ };
7687
+ }
7688
+ run(instance) {
7689
+ return __async(this, null, function* () {
7690
+ if (!(instance instanceof WebAssembly.Instance)) {
7691
+ throw new Error("Go.run: WebAssembly.Instance expected");
7692
+ }
7693
+ this._inst = instance;
7694
+ this.mem = new DataView(this._inst.exports.mem.buffer);
7695
+ this._values = [
7696
+ NaN,
7697
+ 0,
7698
+ null,
7699
+ true,
7700
+ false,
7701
+ globalThis,
7702
+ this
7703
+ ];
7704
+ this._goRefCounts = new Array(this._values.length).fill(Infinity);
7705
+ this._ids = /* @__PURE__ */ new Map([
7706
+ [0, 1],
7707
+ [null, 2],
7708
+ [true, 3],
7709
+ [false, 4],
7710
+ [globalThis, 5],
7711
+ [this, 6]
7712
+ ]);
7713
+ this._idPool = [];
7714
+ this.exited = false;
7715
+ let offset = 4096;
7716
+ const strPtr = (str) => {
7717
+ const ptr = offset;
7718
+ const bytes = encoder.encode(str + "\0");
7719
+ new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);
7720
+ offset += bytes.length;
7721
+ if (offset % 8 !== 0) {
7722
+ offset += 8 - offset % 8;
7723
+ }
7724
+ return ptr;
7725
+ };
7726
+ const argc = this.argv.length;
7727
+ const argvPtrs = [];
7728
+ this.argv.forEach((arg) => {
7729
+ argvPtrs.push(strPtr(arg));
7730
+ });
7731
+ argvPtrs.push(0);
7732
+ const keys = Object.keys(this.env).sort();
7733
+ keys.forEach((key) => {
7734
+ argvPtrs.push(strPtr(`${key}=${this.env[key]}`));
7735
+ });
7736
+ argvPtrs.push(0);
7737
+ const argv = offset;
7738
+ argvPtrs.forEach((ptr) => {
7739
+ this.mem.setUint32(offset, ptr, true);
7740
+ this.mem.setUint32(offset + 4, 0, true);
7741
+ offset += 8;
7742
+ });
7743
+ const wasmMinDataAddr = 4096 + 8192;
7744
+ if (offset >= wasmMinDataAddr) {
7745
+ throw new Error("total length of command line and environment variables exceeds limit");
7746
+ }
7747
+ this._inst.exports.run(argc, argv);
7748
+ if (this.exited) {
7749
+ this._resolveExitPromise();
7750
+ }
7751
+ yield this._exitPromise;
7752
+ });
7753
+ }
7754
+ _resume() {
7755
+ if (this.exited) {
7756
+ throw new Error("Go program has already exited");
7757
+ }
7758
+ this._inst.exports.resume();
7759
+ if (this.exited) {
7760
+ this._resolveExitPromise();
7761
+ }
7762
+ }
7763
+ _makeFuncWrapper(id) {
7764
+ const go = this;
7765
+ return function() {
7766
+ const event = { id, this: this, args: arguments };
7767
+ go._pendingEvent = event;
7768
+ go._resume();
7769
+ return event.result;
7770
+ };
7771
+ }
7772
+ };
7773
+ })();
7774
+ }
7775
+ });
7776
+
7250
7777
  // index.ts
7251
7778
  var wasm_exports = {};
7252
7779
  __export(wasm_exports, {
@@ -7263,9 +7790,28 @@ function snakeToCamel(key) {
7263
7790
  return key.replace(/_(\w)/g, (match, char) => char.toUpperCase());
7264
7791
  }
7265
7792
  var transformKeys_default = (obj) => {
7266
- return (0, import_deep_map_keys.default)(obj, (_, key) => snakeToCamel(key));
7793
+ return (0, import_deep_map_keys.default)(obj, (key, value) => snakeToCamel(key));
7267
7794
  };
7268
7795
 
7796
+ // lib/wasm_exec_node.js
7797
+ globalThis.require = require;
7798
+ globalThis.fs = require("fs");
7799
+ globalThis.TextEncoder = require("util").TextEncoder;
7800
+ globalThis.TextDecoder = require("util").TextDecoder;
7801
+ globalThis.performance = {
7802
+ now() {
7803
+ const [sec, nsec] = process.hrtime();
7804
+ return sec * 1e3 + nsec / 1e6;
7805
+ }
7806
+ };
7807
+ var crypto2 = require("crypto");
7808
+ globalThis.crypto = {
7809
+ getRandomValues(b) {
7810
+ crypto2.randomFillSync(b);
7811
+ }
7812
+ };
7813
+ require_wasm_exec();
7814
+
7269
7815
  // index.ts
7270
7816
  var instantiate = () => __async(void 0, null, function* () {
7271
7817
  const go = new globalThis.Go();
@@ -7275,14 +7821,15 @@ var instantiate = () => __async(void 0, null, function* () {
7275
7821
  });
7276
7822
  var keel = () => __async(void 0, null, function* () {
7277
7823
  const api = yield instantiate();
7278
- const validate = (schemaString, opts) => {
7824
+ const validate = (schemaString, opts) => __async(void 0, null, function* () {
7279
7825
  const result = api.validate(schemaString, opts);
7280
7826
  const { validationErrors: { Errors: errors }, ast } = result;
7827
+ const transformedErrors = yield errors.map((err) => transformKeys_default(err));
7281
7828
  return {
7282
- errors: errors.map((e) => transformKeys_default(e)),
7283
- ast: transformKeys_default(ast)
7829
+ errors: transformedErrors,
7830
+ ast
7284
7831
  };
7285
- };
7832
+ });
7286
7833
  const format = (schemaString) => {
7287
7834
  return api.format(schemaString);
7288
7835
  };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@teamkeel/wasm",
3
- "version": "0.38.0",
3
+ "version": "0.41.0",
4
4
  "description": "Provides wasm binaries for the Keel CLI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "build": "node build.mjs",
7
+ "build": "node build.mjs && npm run copy-types",
8
+ "copy-types": "cp index.d.ts dist/",
8
9
  "start": "node dist/index.js",
9
10
  "prepublishOnly": "npm run build"
10
11
  },