test-filesystem 1.1.1 → 1.2.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.
@@ -2019,6 +2019,31 @@
2019
2019
  100: [function (require, module, exports) {
2020
2020
  'use strict'
2021
2021
 
2022
+ Object.defineProperty(exports, '__esModule', {
2023
+ value: true
2024
+ })
2025
+ exports.fileExists = exports.default = void 0
2026
+ var _fs = require('fs')
2027
+ /**
2028
+ * Detect if a file exists and is usable.
2029
+ * @memberOf module:test-fs
2030
+ * @param {string} filePath
2031
+ * @returns {boolean}
2032
+ */
2033
+ const fileExists = filePath => {
2034
+ try {
2035
+ (0, _fs.accessSync)(filePath, _fs.constants.F_OK)
2036
+ return true
2037
+ } catch (err) {
2038
+ return false
2039
+ }
2040
+ }
2041
+ exports.fileExists = fileExists
2042
+ var _default = exports.default = fileExists
2043
+ }, { fs: 110 }],
2044
+ 101: [function (require, module, exports) {
2045
+ 'use strict'
2046
+
2022
2047
  Object.defineProperty(exports, '__esModule', {
2023
2048
  value: true
2024
2049
  })
@@ -2042,7 +2067,7 @@
2042
2067
  }
2043
2068
  var _default = exports.default = jsonDom
2044
2069
  }, {}],
2045
- 101: [function (require, module, exports) {
2070
+ 102: [function (require, module, exports) {
2046
2071
  'use strict'
2047
2072
 
2048
2073
  Object.defineProperty(exports, '__esModule', {
@@ -2071,7 +2096,7 @@
2071
2096
  }
2072
2097
  var _default = exports.default = linkedList
2073
2098
  }, {}],
2074
- 102: [function (require, module, exports) {
2099
+ 103: [function (require, module, exports) {
2075
2100
  'use strict'
2076
2101
 
2077
2102
  Object.defineProperty(exports, '__esModule', {
@@ -2096,8 +2121,8 @@
2096
2121
  }
2097
2122
  exports.logObject = logObject
2098
2123
  var _default = exports.default = logObject
2099
- }, { util: 133 }],
2100
- 103: [function (require, module, exports) {
2124
+ }, { util: 141 }],
2125
+ 104: [function (require, module, exports) {
2101
2126
  'use strict'
2102
2127
 
2103
2128
  Object.defineProperty(exports, '__esModule', {
@@ -2123,7 +2148,7 @@
2123
2148
  }
2124
2149
  var _default = exports.default = multiReferenceObject
2125
2150
  }, {}],
2126
- 104: [function (require, module, exports) {
2151
+ 105: [function (require, module, exports) {
2127
2152
  'use strict'
2128
2153
 
2129
2154
  Object.defineProperty(exports, '__esModule', {
@@ -2157,7 +2182,7 @@
2157
2182
  }
2158
2183
  var _default = exports.default = nodeTree
2159
2184
  }, {}],
2160
- 105: [function (require, module, exports) {
2185
+ 106: [function (require, module, exports) {
2161
2186
  'use strict'
2162
2187
 
2163
2188
  Object.defineProperty(exports, '__esModule', {
@@ -2177,8 +2202,8 @@
2177
2202
  }, error => error ? reject(error) : resolve(dirPath))))
2178
2203
  exports.removeDirectory = removeDirectory
2179
2204
  var _default = exports.default = removeDirectory
2180
- }, { fs: 109 }],
2181
- 106: [function (require, module, exports) {
2205
+ }, { fs: 110 }],
2206
+ 107: [function (require, module, exports) {
2182
2207
  'use strict'
2183
2208
 
2184
2209
  Object.defineProperty(exports, '__esModule', {
@@ -2187,6 +2212,7 @@
2187
2212
  exports.setUp = exports.setDefaults = exports.default = exports.createTempDir = exports.beforeEach = exports.afterEach = void 0
2188
2213
  var _fs = require('fs')
2189
2214
  var _removeDirectory = _interopRequireDefault(require('./removeDirectory'))
2215
+ var _fileExists = _interopRequireDefault(require('./fileExists'))
2190
2216
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
2191
2217
  var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
2192
2218
  function adopt (value) {
@@ -2237,7 +2263,7 @@
2237
2263
  exports.afterEach = afterEach
2238
2264
  const createTempDir = (exists = true) => __awaiter(void 0, void 0, void 0, function * () {
2239
2265
  if (exists) {
2240
- return (0, _removeDirectory.default)(tempDir).then(removedDir => createTempDir((0, _fs.existsSync)(removedDir))).catch(error => console.error('Error: ', error))
2266
+ return (0, _removeDirectory.default)(tempDir).then(removedDir => createTempDir((0, _fileExists.default)(removedDir))).catch(error => console.error('Error: ', error))
2241
2267
  }
2242
2268
  return (0, _fs.mkdirSync)(srcPath, {
2243
2269
  recursive: true
@@ -2266,8 +2292,8 @@
2266
2292
  setDefaults
2267
2293
  }
2268
2294
  var _default = exports.default = setUp
2269
- }, { './removeDirectory': 105, fs: 109 }],
2270
- 107: [function (require, module, exports) {
2295
+ }, { './fileExists': 100, './removeDirectory': 106, fs: 110 }],
2296
+ 108: [function (require, module, exports) {
2271
2297
  'use strict'
2272
2298
 
2273
2299
  require('core-js/modules/esnext.weak-map.delete-all.js')
@@ -2330,6 +2356,18 @@
2330
2356
  }
2331
2357
  })
2332
2358
  })
2359
+ var _fileExists = _interopRequireWildcard(require('./functions/fileExists'))
2360
+ Object.keys(_fileExists).forEach(function (key) {
2361
+ if (key === 'default' || key === '__esModule') return
2362
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return
2363
+ if (key in exports && exports[key] === _fileExists[key]) return
2364
+ Object.defineProperty(exports, key, {
2365
+ enumerable: true,
2366
+ get: function () {
2367
+ return _fileExists[key]
2368
+ }
2369
+ })
2370
+ })
2333
2371
  var _jsonDom = _interopRequireWildcard(require('./functions/jsonDom'))
2334
2372
  Object.keys(_jsonDom).forEach(function (key) {
2335
2373
  if (key === 'default' || key === '__esModule') return
@@ -2429,6 +2467,7 @@
2429
2467
  countMatches: _countMatches.default,
2430
2468
  deepReferenceObject: _deepReferenceObject.default,
2431
2469
  domItem: _domItem.default,
2470
+ fileExists: _fileExists.default,
2432
2471
  jsonDom: _jsonDom.default,
2433
2472
  linkedList: _linkedList.default,
2434
2473
  logObject: _logObject.default,
@@ -2456,13 +2495,13 @@
2456
2495
  // @ts-ignore
2457
2496
  window.testFs = testFsBrowser
2458
2497
  }
2459
- }, { './functions/circularObject': 96, './functions/countMatches': 97, './functions/deepReferenceObject': 98, './functions/domItem': 99, './functions/jsonDom': 100, './functions/linkedList': 101, './functions/logObject': 102, './functions/multiReferenceObject': 103, './functions/nodeTree': 104, './functions/removeDirectory': 105, './functions/setUp': 106, 'core-js/modules/esnext.async-iterator.for-each.js': 92, 'core-js/modules/esnext.iterator.constructor.js': 93, 'core-js/modules/esnext.iterator.for-each.js': 94, 'core-js/modules/esnext.weak-map.delete-all.js': 95 }],
2460
- 108: [function (require, module, exports) {
2498
+ }, { './functions/circularObject': 96, './functions/countMatches': 97, './functions/deepReferenceObject': 98, './functions/domItem': 99, './functions/fileExists': 100, './functions/jsonDom': 101, './functions/linkedList': 102, './functions/logObject': 103, './functions/multiReferenceObject': 104, './functions/nodeTree': 105, './functions/removeDirectory': 106, './functions/setUp': 107, 'core-js/modules/esnext.async-iterator.for-each.js': 92, 'core-js/modules/esnext.iterator.constructor.js': 93, 'core-js/modules/esnext.iterator.for-each.js': 94, 'core-js/modules/esnext.weak-map.delete-all.js': 95 }],
2499
+ 109: [function (require, module, exports) {
2461
2500
  (function (global) {
2462
2501
  (function () {
2463
2502
  'use strict'
2464
2503
 
2465
- var possibleNames = [
2504
+ var /** @type {ReturnType<import('.')>} */ possibleNames = [
2466
2505
  'BigInt64Array',
2467
2506
  'BigUint64Array',
2468
2507
  'Float32Array',
@@ -2478,10 +2517,12 @@
2478
2517
 
2479
2518
  var g = typeof globalThis === 'undefined' ? global : globalThis
2480
2519
 
2520
+ /** @type {import('.')} */
2481
2521
  module.exports = function availableTypedArrays () {
2482
- var out = []
2522
+ var /** @type {ReturnType<typeof availableTypedArrays>} */ out = []
2483
2523
  for (var i = 0; i < possibleNames.length; i++) {
2484
2524
  if (typeof g[possibleNames[i]] === 'function') {
2525
+ // @ts-expect-error
2485
2526
  out[out.length] = possibleNames[i]
2486
2527
  }
2487
2528
  }
@@ -2490,10 +2531,10 @@
2490
2531
  }).call(this)
2491
2532
  }).call(this, typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {})
2492
2533
  }, {}],
2493
- 109: [function (require, module, exports) {
2534
+ 110: [function (require, module, exports) {
2494
2535
 
2495
2536
  }, {}],
2496
- 110: [function (require, module, exports) {
2537
+ 111: [function (require, module, exports) {
2497
2538
  'use strict'
2498
2539
 
2499
2540
  var GetIntrinsic = require('get-intrinsic')
@@ -2509,15 +2550,15 @@
2509
2550
  }
2510
2551
  return intrinsic
2511
2552
  }
2512
- }, { './': 111, 'get-intrinsic': 116 }],
2513
- 111: [function (require, module, exports) {
2553
+ }, { './': 112, 'get-intrinsic': 124 }],
2554
+ 112: [function (require, module, exports) {
2514
2555
  'use strict'
2515
2556
 
2516
2557
  var bind = require('function-bind')
2517
2558
  var GetIntrinsic = require('get-intrinsic')
2518
2559
  var setFunctionLength = require('set-function-length')
2519
2560
 
2520
- var $TypeError = GetIntrinsic('%TypeError%')
2561
+ var $TypeError = require('es-errors/type')
2521
2562
  var $apply = GetIntrinsic('%Function.prototype.apply%')
2522
2563
  var $call = GetIntrinsic('%Function.prototype.call%')
2523
2564
  var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply)
@@ -2555,8 +2596,8 @@
2555
2596
  } else {
2556
2597
  module.exports.apply = applyBind
2557
2598
  }
2558
- }, { 'function-bind': 115, 'get-intrinsic': 116, 'set-function-length': 130 }],
2559
- 112: [function (require, module, exports) {
2599
+ }, { 'es-errors/type': 119, 'function-bind': 123, 'get-intrinsic': 124, 'set-function-length': 138 }],
2600
+ 113: [function (require, module, exports) {
2560
2601
  'use strict'
2561
2602
 
2562
2603
  var hasPropertyDescriptors = require('has-property-descriptors')()
@@ -2573,8 +2614,8 @@
2573
2614
  }
2574
2615
  }
2575
2616
 
2576
- var $SyntaxError = GetIntrinsic('%SyntaxError%')
2577
- var $TypeError = GetIntrinsic('%TypeError%')
2617
+ var $SyntaxError = require('es-errors/syntax')
2618
+ var $TypeError = require('es-errors/type')
2578
2619
 
2579
2620
  var gopd = require('gopd')
2580
2621
 
@@ -2625,8 +2666,50 @@
2625
2666
  throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.')
2626
2667
  }
2627
2668
  }
2628
- }, { 'get-intrinsic': 116, gopd: 117, 'has-property-descriptors': 118 }],
2629
- 113: [function (require, module, exports) {
2669
+ }, { 'es-errors/syntax': 118, 'es-errors/type': 119, 'get-intrinsic': 124, gopd: 125, 'has-property-descriptors': 126 }],
2670
+ 114: [function (require, module, exports) {
2671
+ 'use strict'
2672
+
2673
+ /** @type {import('./eval')} */
2674
+ module.exports = EvalError
2675
+ }, {}],
2676
+ 115: [function (require, module, exports) {
2677
+ 'use strict'
2678
+
2679
+ /** @type {import('.')} */
2680
+ module.exports = Error
2681
+ }, {}],
2682
+ 116: [function (require, module, exports) {
2683
+ 'use strict'
2684
+
2685
+ /** @type {import('./range')} */
2686
+ module.exports = RangeError
2687
+ }, {}],
2688
+ 117: [function (require, module, exports) {
2689
+ 'use strict'
2690
+
2691
+ /** @type {import('./ref')} */
2692
+ module.exports = ReferenceError
2693
+ }, {}],
2694
+ 118: [function (require, module, exports) {
2695
+ 'use strict'
2696
+
2697
+ /** @type {import('./syntax')} */
2698
+ module.exports = SyntaxError
2699
+ }, {}],
2700
+ 119: [function (require, module, exports) {
2701
+ 'use strict'
2702
+
2703
+ /** @type {import('./type')} */
2704
+ module.exports = TypeError
2705
+ }, {}],
2706
+ 120: [function (require, module, exports) {
2707
+ 'use strict'
2708
+
2709
+ /** @type {import('./uri')} */
2710
+ module.exports = URIError
2711
+ }, {}],
2712
+ 121: [function (require, module, exports) {
2630
2713
  'use strict'
2631
2714
 
2632
2715
  var isCallable = require('is-callable')
@@ -2689,8 +2772,8 @@
2689
2772
  }
2690
2773
 
2691
2774
  module.exports = forEach
2692
- }, { 'is-callable': 126 }],
2693
- 114: [function (require, module, exports) {
2775
+ }, { 'is-callable': 134 }],
2776
+ 122: [function (require, module, exports) {
2694
2777
  'use strict'
2695
2778
 
2696
2779
  /* eslint no-invalid-this: 1 */
@@ -2775,21 +2858,27 @@
2775
2858
  return bound
2776
2859
  }
2777
2860
  }, {}],
2778
- 115: [function (require, module, exports) {
2861
+ 123: [function (require, module, exports) {
2779
2862
  'use strict'
2780
2863
 
2781
2864
  var implementation = require('./implementation')
2782
2865
 
2783
2866
  module.exports = Function.prototype.bind || implementation
2784
- }, { './implementation': 114 }],
2785
- 116: [function (require, module, exports) {
2867
+ }, { './implementation': 122 }],
2868
+ 124: [function (require, module, exports) {
2786
2869
  'use strict'
2787
2870
 
2788
2871
  var undefined
2789
2872
 
2790
- var $SyntaxError = SyntaxError
2873
+ var $Error = require('es-errors')
2874
+ var $EvalError = require('es-errors/eval')
2875
+ var $RangeError = require('es-errors/range')
2876
+ var $ReferenceError = require('es-errors/ref')
2877
+ var $SyntaxError = require('es-errors/syntax')
2878
+ var $TypeError = require('es-errors/type')
2879
+ var $URIError = require('es-errors/uri')
2880
+
2791
2881
  var $Function = Function
2792
- var $TypeError = TypeError
2793
2882
 
2794
2883
  // eslint-disable-next-line consistent-return
2795
2884
  var getEvalledConstructor = function (expressionSyntax) {
@@ -2841,6 +2930,7 @@
2841
2930
  var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array)
2842
2931
 
2843
2932
  var INTRINSICS = {
2933
+ __proto__: null,
2844
2934
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
2845
2935
  '%Array%': Array,
2846
2936
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
@@ -2861,9 +2951,9 @@
2861
2951
  '%decodeURIComponent%': decodeURIComponent,
2862
2952
  '%encodeURI%': encodeURI,
2863
2953
  '%encodeURIComponent%': encodeURIComponent,
2864
- '%Error%': Error,
2954
+ '%Error%': $Error,
2865
2955
  '%eval%': eval, // eslint-disable-line no-eval
2866
- '%EvalError%': EvalError,
2956
+ '%EvalError%': $EvalError,
2867
2957
  '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
2868
2958
  '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
2869
2959
  '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
@@ -2885,8 +2975,8 @@
2885
2975
  '%parseInt%': parseInt,
2886
2976
  '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
2887
2977
  '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
2888
- '%RangeError%': RangeError,
2889
- '%ReferenceError%': ReferenceError,
2978
+ '%RangeError%': $RangeError,
2979
+ '%ReferenceError%': $ReferenceError,
2890
2980
  '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
2891
2981
  '%RegExp%': RegExp,
2892
2982
  '%Set%': typeof Set === 'undefined' ? undefined : Set,
@@ -2903,7 +2993,7 @@
2903
2993
  '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
2904
2994
  '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
2905
2995
  '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
2906
- '%URIError%': URIError,
2996
+ '%URIError%': $URIError,
2907
2997
  '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
2908
2998
  '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
2909
2999
  '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
@@ -2945,6 +3035,7 @@
2945
3035
  }
2946
3036
 
2947
3037
  var LEGACY_ALIASES = {
3038
+ __proto__: null,
2948
3039
  '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
2949
3040
  '%ArrayPrototype%': ['Array', 'prototype'],
2950
3041
  '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
@@ -3134,8 +3225,8 @@
3134
3225
  }
3135
3226
  return value
3136
3227
  }
3137
- }, { 'function-bind': 115, 'has-proto': 119, 'has-symbols': 120, hasown: 123 }],
3138
- 117: [function (require, module, exports) {
3228
+ }, { 'es-errors': 115, 'es-errors/eval': 114, 'es-errors/range': 116, 'es-errors/ref': 117, 'es-errors/syntax': 118, 'es-errors/type': 119, 'es-errors/uri': 120, 'function-bind': 123, 'has-proto': 127, 'has-symbols': 128, hasown: 131 }],
3229
+ 125: [function (require, module, exports) {
3139
3230
  'use strict'
3140
3231
 
3141
3232
  var GetIntrinsic = require('get-intrinsic')
@@ -3152,8 +3243,8 @@
3152
3243
  }
3153
3244
 
3154
3245
  module.exports = $gOPD
3155
- }, { 'get-intrinsic': 116 }],
3156
- 118: [function (require, module, exports) {
3246
+ }, { 'get-intrinsic': 124 }],
3247
+ 126: [function (require, module, exports) {
3157
3248
  'use strict'
3158
3249
 
3159
3250
  var GetIntrinsic = require('get-intrinsic')
@@ -3187,8 +3278,8 @@
3187
3278
  }
3188
3279
 
3189
3280
  module.exports = hasPropertyDescriptors
3190
- }, { 'get-intrinsic': 116 }],
3191
- 119: [function (require, module, exports) {
3281
+ }, { 'get-intrinsic': 124 }],
3282
+ 127: [function (require, module, exports) {
3192
3283
  'use strict'
3193
3284
 
3194
3285
  var test = {
@@ -3201,7 +3292,7 @@
3201
3292
  return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object)
3202
3293
  }
3203
3294
  }, {}],
3204
- 120: [function (require, module, exports) {
3295
+ 128: [function (require, module, exports) {
3205
3296
  'use strict'
3206
3297
 
3207
3298
  var origSymbol = typeof Symbol !== 'undefined' && Symbol
@@ -3215,8 +3306,8 @@
3215
3306
 
3216
3307
  return hasSymbolSham()
3217
3308
  }
3218
- }, { './shams': 121 }],
3219
- 121: [function (require, module, exports) {
3309
+ }, { './shams': 129 }],
3310
+ 129: [function (require, module, exports) {
3220
3311
  'use strict'
3221
3312
 
3222
3313
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
@@ -3260,16 +3351,17 @@
3260
3351
  return true
3261
3352
  }
3262
3353
  }, {}],
3263
- 122: [function (require, module, exports) {
3354
+ 130: [function (require, module, exports) {
3264
3355
  'use strict'
3265
3356
 
3266
3357
  var hasSymbols = require('has-symbols/shams')
3267
3358
 
3359
+ /** @type {import('.')} */
3268
3360
  module.exports = function hasToStringTagShams () {
3269
3361
  return hasSymbols() && !!Symbol.toStringTag
3270
3362
  }
3271
- }, { 'has-symbols/shams': 121 }],
3272
- 123: [function (require, module, exports) {
3363
+ }, { 'has-symbols/shams': 129 }],
3364
+ 131: [function (require, module, exports) {
3273
3365
  'use strict'
3274
3366
 
3275
3367
  var call = Function.prototype.call
@@ -3278,8 +3370,8 @@
3278
3370
 
3279
3371
  /** @type {(o: {}, p: PropertyKey) => p is keyof o} */
3280
3372
  module.exports = bind.call(call, $hasOwn)
3281
- }, { 'function-bind': 115 }],
3282
- 124: [function (require, module, exports) {
3373
+ }, { 'function-bind': 123 }],
3374
+ 132: [function (require, module, exports) {
3283
3375
  if (typeof Object.create === 'function') {
3284
3376
  // implementation from standard node.js 'util' module
3285
3377
  module.exports = function inherits (ctor, superCtor) {
@@ -3308,7 +3400,7 @@
3308
3400
  }
3309
3401
  }
3310
3402
  }, {}],
3311
- 125: [function (require, module, exports) {
3403
+ 133: [function (require, module, exports) {
3312
3404
  'use strict'
3313
3405
 
3314
3406
  var hasToStringTag = require('has-tostringtag/shams')()
@@ -3342,8 +3434,8 @@
3342
3434
  isStandardArguments.isLegacyArguments = isLegacyArguments // for tests
3343
3435
 
3344
3436
  module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments
3345
- }, { 'call-bind/callBound': 110, 'has-tostringtag/shams': 122 }],
3346
- 126: [function (require, module, exports) {
3437
+ }, { 'call-bind/callBound': 111, 'has-tostringtag/shams': 130 }],
3438
+ 134: [function (require, module, exports) {
3347
3439
  'use strict'
3348
3440
 
3349
3441
  var fnToStr = Function.prototype.toString
@@ -3446,7 +3538,7 @@
3446
3538
  return tryFunctionObject(value)
3447
3539
  }
3448
3540
  }, {}],
3449
- 127: [function (require, module, exports) {
3541
+ 135: [function (require, module, exports) {
3450
3542
  'use strict'
3451
3543
 
3452
3544
  var toStr = Object.prototype.toString
@@ -3485,17 +3577,18 @@
3485
3577
  }
3486
3578
  return getProto(fn) === GeneratorFunction
3487
3579
  }
3488
- }, { 'has-tostringtag/shams': 122 }],
3489
- 128: [function (require, module, exports) {
3580
+ }, { 'has-tostringtag/shams': 130 }],
3581
+ 136: [function (require, module, exports) {
3490
3582
  'use strict'
3491
3583
 
3492
3584
  var whichTypedArray = require('which-typed-array')
3493
3585
 
3586
+ /** @type {import('.')} */
3494
3587
  module.exports = function isTypedArray (value) {
3495
3588
  return !!whichTypedArray(value)
3496
3589
  }
3497
- }, { 'which-typed-array': 134 }],
3498
- 129: [function (require, module, exports) {
3590
+ }, { 'which-typed-array': 142 }],
3591
+ 137: [function (require, module, exports) {
3499
3592
  // shim for using process in browser
3500
3593
  var process = module.exports = {}
3501
3594
 
@@ -3676,7 +3769,7 @@
3676
3769
  }
3677
3770
  process.umask = function () { return 0 }
3678
3771
  }, {}],
3679
- 130: [function (require, module, exports) {
3772
+ 138: [function (require, module, exports) {
3680
3773
  'use strict'
3681
3774
 
3682
3775
  var GetIntrinsic = require('get-intrinsic')
@@ -3684,9 +3777,12 @@
3684
3777
  var hasDescriptors = require('has-property-descriptors')()
3685
3778
  var gOPD = require('gopd')
3686
3779
 
3687
- var $TypeError = GetIntrinsic('%TypeError%')
3780
+ var $TypeError = require('es-errors/type')
3688
3781
  var $floor = GetIntrinsic('%Math.floor%')
3689
3782
 
3783
+ /** @typedef {(...args: unknown[]) => unknown} Func */
3784
+
3785
+ /** @type {<T extends Func = Func>(fn: T, length: number, loose?: boolean) => T} */
3690
3786
  module.exports = function setFunctionLength (fn, length) {
3691
3787
  if (typeof fn !== 'function') {
3692
3788
  throw new $TypeError('`fn` is not a function')
@@ -3711,15 +3807,15 @@
3711
3807
 
3712
3808
  if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
3713
3809
  if (hasDescriptors) {
3714
- define(fn, 'length', length, true, true)
3810
+ define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true)
3715
3811
  } else {
3716
- define(fn, 'length', length)
3812
+ define(/** @type {Parameters<define>[0]} */ (fn), 'length', length)
3717
3813
  }
3718
3814
  }
3719
3815
  return fn
3720
3816
  }
3721
- }, { 'define-data-property': 112, 'get-intrinsic': 116, gopd: 117, 'has-property-descriptors': 118 }],
3722
- 131: [function (require, module, exports) {
3817
+ }, { 'define-data-property': 113, 'es-errors/type': 119, 'get-intrinsic': 124, gopd: 125, 'has-property-descriptors': 126 }],
3818
+ 139: [function (require, module, exports) {
3723
3819
  module.exports = function isBuffer (arg) {
3724
3820
  return arg && typeof arg === 'object' &&
3725
3821
  typeof arg.copy === 'function' &&
@@ -3727,7 +3823,7 @@
3727
3823
  typeof arg.readUInt8 === 'function'
3728
3824
  }
3729
3825
  }, {}],
3730
- 132: [function (require, module, exports) {
3826
+ 140: [function (require, module, exports) {
3731
3827
  // Currently in sync with Node.js lib/internal/util/types.js
3732
3828
  // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
3733
3829
 
@@ -4061,8 +4157,8 @@
4061
4157
  }
4062
4158
  })
4063
4159
  })
4064
- }, { 'is-arguments': 125, 'is-generator-function': 127, 'is-typed-array': 128, 'which-typed-array': 134 }],
4065
- 133: [function (require, module, exports) {
4160
+ }, { 'is-arguments': 133, 'is-generator-function': 135, 'is-typed-array': 136, 'which-typed-array': 142 }],
4161
+ 141: [function (require, module, exports) {
4066
4162
  (function (process) {
4067
4163
  (function () {
4068
4164
  // Copyright Joyent, Inc. and other Node contributors.
@@ -4761,8 +4857,8 @@
4761
4857
  exports.callbackify = callbackify
4762
4858
  }).call(this)
4763
4859
  }).call(this, require('_process'))
4764
- }, { './support/isBuffer': 131, './support/types': 132, _process: 129, inherits: 124 }],
4765
- 134: [function (require, module, exports) {
4860
+ }, { './support/isBuffer': 139, './support/types': 140, _process: 137, inherits: 132 }],
4861
+ 142: [function (require, module, exports) {
4766
4862
  (function (global) {
4767
4863
  (function () {
4768
4864
  'use strict'
@@ -4782,7 +4878,7 @@
4782
4878
  var $slice = callBound('String.prototype.slice')
4783
4879
  var getPrototypeOf = Object.getPrototypeOf // require('getprototypeof');
4784
4880
 
4785
- var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf (array, value) {
4881
+ var $indexOf = callBound('Array.prototype.indexOf', true) || /** @type {(array: readonly unknown[], value: unknown) => keyof array} */ function indexOf (array, value) {
4786
4882
  for (var i = 0; i < array.length; i += 1) {
4787
4883
  if (array[i] === value) {
4788
4884
  return i
@@ -4790,17 +4886,24 @@
4790
4886
  }
4791
4887
  return -1
4792
4888
  }
4889
+
4890
+ /** @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array} TypedArray */
4891
+ /** @typedef {'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array'} TypedArrayName */
4892
+ /** @type {{ [k in `\$${TypedArrayName}`]?: (receiver: TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call } & { __proto__: null }} */
4793
4893
  var cache = { __proto__: null }
4794
4894
  if (hasToStringTag && gOPD && getPrototypeOf) {
4795
4895
  forEach(typedArrays, function (typedArray) {
4796
4896
  var arr = new g[typedArray]()
4797
4897
  if (Symbol.toStringTag in arr) {
4798
4898
  var proto = getPrototypeOf(arr)
4899
+ // @ts-expect-error TS won't narrow inside a closure
4799
4900
  var descriptor = gOPD(proto, Symbol.toStringTag)
4800
4901
  if (!descriptor) {
4801
4902
  var superProto = getPrototypeOf(proto)
4903
+ // @ts-expect-error TS won't narrow inside a closure
4802
4904
  descriptor = gOPD(superProto, Symbol.toStringTag)
4803
4905
  }
4906
+ // @ts-expect-error TODO: fix
4804
4907
  cache['$' + typedArray] = callBind(descriptor.get)
4805
4908
  }
4806
4909
  })
@@ -4809,38 +4912,52 @@
4809
4912
  var arr = new g[typedArray]()
4810
4913
  var fn = arr.slice || arr.set
4811
4914
  if (fn) {
4915
+ // @ts-expect-error TODO: fix
4812
4916
  cache['$' + typedArray] = callBind(fn)
4813
4917
  }
4814
4918
  })
4815
4919
  }
4816
4920
 
4921
+ /** @type {import('.')} */
4817
4922
  var tryTypedArrays = function tryAllTypedArrays (value) {
4818
- var found = false
4819
- forEach(cache, function (getter, typedArray) {
4820
- if (!found) {
4821
- try {
4822
- if ('$' + getter(value) === typedArray) {
4823
- found = $slice(typedArray, 1)
4824
- }
4825
- } catch (e) { /**/ }
4923
+ /** @type {ReturnType<tryAllTypedArrays>} */ var found = false
4924
+ forEach(
4925
+ // eslint-disable-next-line no-extra-parens
4926
+ /** @type {Record<`\$${TypedArrayName}`, typeof cache>} */ /** @type {any} */ (cache),
4927
+ /** @type {(getter: typeof cache, name: `\$${TypedArrayName}`) => void} */ function (getter, typedArray) {
4928
+ if (!found) {
4929
+ try {
4930
+ // @ts-expect-error TODO: fix
4931
+ if ('$' + getter(value) === typedArray) {
4932
+ found = $slice(typedArray, 1)
4933
+ }
4934
+ } catch (e) { /**/ }
4935
+ }
4826
4936
  }
4827
- })
4937
+ )
4828
4938
  return found
4829
4939
  }
4830
4940
 
4941
+ /** @type {import('.')} */
4831
4942
  var trySlices = function tryAllSlices (value) {
4832
- var found = false
4833
- forEach(cache, function (getter, name) {
4834
- if (!found) {
4835
- try {
4836
- getter(value)
4837
- found = $slice(name, 1)
4838
- } catch (e) { /**/ }
4943
+ /** @type {ReturnType<tryAllSlices>} */ var found = false
4944
+ forEach(
4945
+ // eslint-disable-next-line no-extra-parens
4946
+ /** @type {any} */ (cache),
4947
+ /** @type {(getter: typeof cache, name: `\$${TypedArrayName}`) => void} */ function (getter, name) {
4948
+ if (!found) {
4949
+ try {
4950
+ // @ts-expect-error TODO: fix
4951
+ getter(value)
4952
+ found = $slice(name, 1)
4953
+ } catch (e) { /**/ }
4954
+ }
4839
4955
  }
4840
- })
4956
+ )
4841
4957
  return found
4842
4958
  }
4843
4959
 
4960
+ /** @type {import('.')} */
4844
4961
  module.exports = function whichTypedArray (value) {
4845
4962
  if (!value || typeof value !== 'object') { return false }
4846
4963
  if (!hasToStringTag) {
@@ -4859,5 +4976,5 @@
4859
4976
  }
4860
4977
  }).call(this)
4861
4978
  }).call(this, typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {})
4862
- }, { 'available-typed-arrays': 108, 'call-bind': 111, 'call-bind/callBound': 110, 'for-each': 113, gopd: 117, 'has-tostringtag/shams': 122 }]
4863
- }, {}, [107])
4979
+ }, { 'available-typed-arrays': 109, 'call-bind': 112, 'call-bind/callBound': 111, 'for-each': 121, gopd: 125, 'has-tostringtag/shams': 130 }]
4980
+ }, {}, [108])