pyret-npm 0.0.41 → 0.0.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyret-npm",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "description": "The CLI for the Pyret programming language",
5
5
  "files": [
6
6
  "pyret.js",
@@ -30,5 +30,8 @@
30
30
  "bugs": {
31
31
  "url": "https://github.com/brownplt/pyret-npm/issues"
32
32
  },
33
- "homepage": "https://github.com/brownplt/pyret-npm#readme"
33
+ "homepage": "https://github.com/brownplt/pyret-npm#readme",
34
+ "devDependencies": {
35
+ "jest": "^30.0.0"
36
+ }
34
37
  }
@@ -3841,6 +3841,7 @@ PEMEncoder.prototype.encode = function encode(data, options) {
3841
3841
  this.words[i] = carry;
3842
3842
  this.length++;
3843
3843
  }
3844
+ this.length = num === 0 ? 1 : this.length;
3844
3845
 
3845
3846
  return this;
3846
3847
  };
@@ -7528,6 +7529,7 @@ function fromByteArray (uint8) {
7528
7529
  this.words[i] = carry;
7529
7530
  this.length++;
7530
7531
  }
7532
+ this.length = num === 0 ? 1 : this.length;
7531
7533
 
7532
7534
  return isNegNum ? this.ineg() : this;
7533
7535
  };
@@ -3655,6 +3655,7 @@ PEMEncoder.prototype.encode = function encode(data, options) {
3655
3655
  this.words[i] = carry;
3656
3656
  this.length++;
3657
3657
  }
3658
+ this.length = num === 0 ? 1 : this.length;
3658
3659
 
3659
3660
  return this;
3660
3661
  };
@@ -7342,6 +7343,7 @@ function fromByteArray (uint8) {
7342
7343
  this.words[i] = carry;
7343
7344
  this.length++;
7344
7345
  }
7346
+ this.length = num === 0 ? 1 : this.length;
7345
7347
 
7346
7348
  return isNegNum ? this.ineg() : this;
7347
7349
  };
@@ -5190,6 +5190,7 @@ PEMEncoder.prototype.encode = function encode(data, options) {
5190
5190
  this.words[i] = carry;
5191
5191
  this.length++;
5192
5192
  }
5193
+ this.length = num === 0 ? 1 : this.length;
5193
5194
 
5194
5195
  return this;
5195
5196
  };
@@ -8898,6 +8899,7 @@ function fromByteArray (uint8) {
8898
8899
  this.words[i] = carry;
8899
8900
  this.length++;
8900
8901
  }
8902
+ this.length = num === 0 ? 1 : this.length;
8901
8903
 
8902
8904
  return isNegNum ? this.ineg() : this;
8903
8905
  };
@@ -14179,7 +14181,7 @@ var $TypeError = require('es-errors/type');
14179
14181
  var $call = require('./functionCall');
14180
14182
  var $actualApply = require('./actualApply');
14181
14183
 
14182
- /** @type {import('.')} */
14184
+ /** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
14183
14185
  module.exports = function callBindBasic(args) {
14184
14186
  if (args.length < 1 || typeof args[0] !== 'function') {
14185
14187
  throw new $TypeError('a function is required');
@@ -14231,10 +14233,11 @@ var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
14231
14233
 
14232
14234
  /** @type {import('.')} */
14233
14235
  module.exports = function callBoundIntrinsic(name, allowMissing) {
14234
- // eslint-disable-next-line no-extra-parens
14235
- var intrinsic = /** @type {Parameters<typeof callBindBasic>[0][0]} */ (GetIntrinsic(name, !!allowMissing));
14236
+ /* eslint no-extra-parens: 0 */
14237
+
14238
+ var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
14236
14239
  if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
14237
- return callBindBasic([intrinsic]);
14240
+ return callBindBasic(/** @type {const} */ ([intrinsic]));
14238
14241
  }
14239
14242
  return intrinsic;
14240
14243
  };
@@ -21405,6 +21408,7 @@ var isCallable = require('is-callable');
21405
21408
  var toStr = Object.prototype.toString;
21406
21409
  var hasOwnProperty = Object.prototype.hasOwnProperty;
21407
21410
 
21411
+ /** @type {<This, A extends readonly unknown[]>(arr: A, iterator: (this: This | void, value: A[number], index: number, arr: A) => void, receiver: This | undefined) => void} */
21408
21412
  var forEachArray = function forEachArray(array, iterator, receiver) {
21409
21413
  for (var i = 0, len = array.length; i < len; i++) {
21410
21414
  if (hasOwnProperty.call(array, i)) {
@@ -21417,6 +21421,7 @@ var forEachArray = function forEachArray(array, iterator, receiver) {
21417
21421
  }
21418
21422
  };
21419
21423
 
21424
+ /** @type {<This, S extends string>(string: S, iterator: (this: This | void, value: S[number], index: number, string: S) => void, receiver: This | undefined) => void} */
21420
21425
  var forEachString = function forEachString(string, iterator, receiver) {
21421
21426
  for (var i = 0, len = string.length; i < len; i++) {
21422
21427
  // no such thing as a sparse string.
@@ -21428,6 +21433,7 @@ var forEachString = function forEachString(string, iterator, receiver) {
21428
21433
  }
21429
21434
  };
21430
21435
 
21436
+ /** @type {<This, O>(obj: O, iterator: (this: This | void, value: O[keyof O], index: keyof O, obj: O) => void, receiver: This | undefined) => void} */
21431
21437
  var forEachObject = function forEachObject(object, iterator, receiver) {
21432
21438
  for (var k in object) {
21433
21439
  if (hasOwnProperty.call(object, k)) {
@@ -21440,7 +21446,13 @@ var forEachObject = function forEachObject(object, iterator, receiver) {
21440
21446
  }
21441
21447
  };
21442
21448
 
21443
- var forEach = function forEach(list, iterator, thisArg) {
21449
+ /** @type {(x: unknown) => x is readonly unknown[]} */
21450
+ function isArray(x) {
21451
+ return toStr.call(x) === '[object Array]';
21452
+ }
21453
+
21454
+ /** @type {import('.')._internal} */
21455
+ module.exports = function forEach(list, iterator, thisArg) {
21444
21456
  if (!isCallable(iterator)) {
21445
21457
  throw new TypeError('iterator must be a function');
21446
21458
  }
@@ -21450,7 +21462,7 @@ var forEach = function forEach(list, iterator, thisArg) {
21450
21462
  receiver = thisArg;
21451
21463
  }
21452
21464
 
21453
- if (toStr.call(list) === '[object Array]') {
21465
+ if (isArray(list)) {
21454
21466
  forEachArray(list, iterator, receiver);
21455
21467
  } else if (typeof list === 'string') {
21456
21468
  forEachString(list, iterator, receiver);
@@ -21459,8 +21471,6 @@ var forEach = function forEach(list, iterator, thisArg) {
21459
21471
  }
21460
21472
  };
21461
21473
 
21462
- module.exports = forEach;
21463
-
21464
21474
  },{"is-callable":167}],137:[function(require,module,exports){
21465
21475
  'use strict';
21466
21476
 
@@ -21647,6 +21657,7 @@ var INTRINSICS = {
21647
21657
  '%Error%': $Error,
21648
21658
  '%eval%': eval, // eslint-disable-line no-eval
21649
21659
  '%EvalError%': $EvalError,
21660
+ '%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
21650
21661
  '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
21651
21662
  '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
21652
21663
  '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
@@ -31915,6 +31926,7 @@ module.exports = function (thing, encoding, name) {
31915
31926
 
31916
31927
  /** @type {import('.')} */
31917
31928
  module.exports = [
31929
+ 'Float16Array',
31918
31930
  'Float32Array',
31919
31931
  'Float64Array',
31920
31932
  'Int8Array',
@@ -46209,8 +46221,8 @@ var availableTypedArrays = require('available-typed-arrays');
46209
46221
  var callBind = require('call-bind');
46210
46222
  var callBound = require('call-bound');
46211
46223
  var gOPD = require('gopd');
46224
+ var getProto = require('get-proto');
46212
46225
 
46213
- /** @type {(O: object) => string} */
46214
46226
  var $toString = callBound('Object.prototype.toString');
46215
46227
  var hasToStringTag = require('has-tostringtag/shams')();
46216
46228
 
@@ -46218,7 +46230,6 @@ var g = typeof globalThis === 'undefined' ? global : globalThis;
46218
46230
  var typedArrays = availableTypedArrays();
46219
46231
 
46220
46232
  var $slice = callBound('String.prototype.slice');
46221
- var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
46222
46233
 
46223
46234
  /** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
46224
46235
  var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
@@ -46230,18 +46241,18 @@ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(ar
46230
46241
  return -1;
46231
46242
  };
46232
46243
 
46233
- /** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */
46234
- /** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */
46244
+ /** @typedef {import('./types').Getter} Getter */
46245
+ /** @type {import('./types').Cache} */
46235
46246
  var cache = { __proto__: null };
46236
- if (hasToStringTag && gOPD && getPrototypeOf) {
46247
+ if (hasToStringTag && gOPD && getProto) {
46237
46248
  forEach(typedArrays, function (typedArray) {
46238
46249
  var arr = new g[typedArray]();
46239
- if (Symbol.toStringTag in arr) {
46240
- var proto = getPrototypeOf(arr);
46250
+ if (Symbol.toStringTag in arr && getProto) {
46251
+ var proto = getProto(arr);
46241
46252
  // @ts-expect-error TS won't narrow inside a closure
46242
46253
  var descriptor = gOPD(proto, Symbol.toStringTag);
46243
- if (!descriptor) {
46244
- var superProto = getPrototypeOf(proto);
46254
+ if (!descriptor && proto) {
46255
+ var superProto = getProto(proto);
46245
46256
  // @ts-expect-error TS won't narrow inside a closure
46246
46257
  descriptor = gOPD(superProto, Symbol.toStringTag);
46247
46258
  }
@@ -46254,8 +46265,12 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
46254
46265
  var arr = new g[typedArray]();
46255
46266
  var fn = arr.slice || arr.set;
46256
46267
  if (fn) {
46257
- // @ts-expect-error TODO: fix
46258
- cache['$' + typedArray] = callBind(fn);
46268
+ cache[
46269
+ /** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
46270
+ ] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
46271
+ // @ts-expect-error TODO FIXME
46272
+ callBind(fn)
46273
+ );
46259
46274
  }
46260
46275
  });
46261
46276
  }
@@ -46264,15 +46279,14 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
46264
46279
  var tryTypedArrays = function tryAllTypedArrays(value) {
46265
46280
  /** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
46266
46281
  forEach(
46267
- // eslint-disable-next-line no-extra-parens
46268
- /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
46282
+ /** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */ (cache),
46269
46283
  /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
46270
46284
  function (getter, typedArray) {
46271
46285
  if (!found) {
46272
46286
  try {
46273
- // @ts-expect-error TODO: fix
46287
+ // @ts-expect-error a throw is fine here
46274
46288
  if ('$' + getter(value) === typedArray) {
46275
- found = $slice(typedArray, 1);
46289
+ found = /** @type {import('.').TypedArrayName} */ ($slice(typedArray, 1));
46276
46290
  }
46277
46291
  } catch (e) { /**/ }
46278
46292
  }
@@ -46285,14 +46299,13 @@ var tryTypedArrays = function tryAllTypedArrays(value) {
46285
46299
  var trySlices = function tryAllSlices(value) {
46286
46300
  /** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
46287
46301
  forEach(
46288
- // eslint-disable-next-line no-extra-parens
46289
- /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
46290
- /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
46302
+ /** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */(cache),
46303
+ /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
46291
46304
  if (!found) {
46292
46305
  try {
46293
- // @ts-expect-error TODO: fix
46306
+ // @ts-expect-error a throw is fine here
46294
46307
  getter(value);
46295
- found = $slice(name, 1);
46308
+ found = /** @type {import('.').TypedArrayName} */ ($slice(name, 1));
46296
46309
  } catch (e) { /**/ }
46297
46310
  }
46298
46311
  }
@@ -46320,7 +46333,7 @@ module.exports = function whichTypedArray(value) {
46320
46333
  };
46321
46334
 
46322
46335
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
46323
- },{"available-typed-arrays":40,"call-bind":81,"call-bound":82,"for-each":136,"gopd":144,"has-tostringtag/shams":148}],278:[function(require,module,exports){
46336
+ },{"available-typed-arrays":40,"call-bind":81,"call-bound":82,"for-each":136,"get-proto":142,"gopd":144,"has-tostringtag/shams":148}],278:[function(require,module,exports){
46324
46337
  //
46325
46338
  // When building a standalone, browserify will parse this file
46326
46339
  // and produce a version which include each dependency that is required()