@fireproof/core 0.7.0-alpha.2 → 0.7.0-alpha.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,9 @@
1
- import { mkdir, writeFile } from 'fs/promises';
2
1
  import http from 'node:http';
3
2
  import https from 'node:https';
4
3
  import zlib from 'node:zlib';
5
4
  import Stream$1, { PassThrough as PassThrough$2, pipeline as pipeline$2 } from 'node:stream';
6
5
  import { Buffer as Buffer$H } from 'node:buffer';
7
- import { types, promisify as promisify$1, deprecate as deprecate$2 } from 'node:util';
6
+ import { types, promisify as promisify$1, deprecate as deprecate$3 } from 'node:util';
8
7
  import { format as format$2 } from 'node:url';
9
8
  import { isIP } from 'node:net';
10
9
  import 'node:fs';
@@ -11484,15 +11483,7 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
11484
11483
 
11485
11484
  var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
11486
11485
 
11487
- var streamBrowser;
11488
- var hasRequiredStreamBrowser;
11489
-
11490
- function requireStreamBrowser () {
11491
- if (hasRequiredStreamBrowser) return streamBrowser;
11492
- hasRequiredStreamBrowser = 1;
11493
- streamBrowser = require$$0$1.EventEmitter;
11494
- return streamBrowser;
11495
- }
11486
+ var streamBrowser = require$$0$1.EventEmitter;
11496
11487
 
11497
11488
  // shim for using process in browser
11498
11489
  // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
@@ -11635,7 +11626,7 @@ var argv = [];
11635
11626
  var version$2 = ''; // empty string to avoid regexp issues
11636
11627
  var versions = {};
11637
11628
  var release = {};
11638
- var config = {};
11629
+ var config$1 = {};
11639
11630
 
11640
11631
  function noop$3() {}
11641
11632
 
@@ -11712,7 +11703,7 @@ var browser$1$1 = {
11712
11703
  hrtime: hrtime,
11713
11704
  platform: platform,
11714
11705
  release: release,
11715
- config: config,
11706
+ config: config$1,
11716
11707
  uptime: uptime
11717
11708
  };
11718
11709
 
@@ -11793,11 +11784,11 @@ function format(f) {
11793
11784
  // Mark that a method should not be used.
11794
11785
  // Returns a modified function which warns once by default.
11795
11786
  // If --no-deprecation is set, then it is a no-op.
11796
- function deprecate$1(fn, msg) {
11787
+ function deprecate$2(fn, msg) {
11797
11788
  // Allow for deprecating things in the process of starting up.
11798
11789
  if (isUndefined(global$1.process)) {
11799
11790
  return function() {
11800
- return deprecate$1(fn, msg).apply(this, arguments);
11791
+ return deprecate$2(fn, msg).apply(this, arguments);
11801
11792
  };
11802
11793
  }
11803
11794
 
@@ -12406,7 +12397,7 @@ var _polyfillNode_util = {
12406
12397
  isBoolean: isBoolean,
12407
12398
  isArray: isArray,
12408
12399
  inspect: inspect,
12409
- deprecate: deprecate$1,
12400
+ deprecate: deprecate$2,
12410
12401
  format: format,
12411
12402
  debuglog: debuglog,
12412
12403
  promisify: promisify,
@@ -12419,7 +12410,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
12419
12410
  callbackify: callbackify,
12420
12411
  debuglog: debuglog,
12421
12412
  default: _polyfillNode_util,
12422
- deprecate: deprecate$1,
12413
+ deprecate: deprecate$2,
12423
12414
  format: format,
12424
12415
  inherits: inherits$w,
12425
12416
  inspect: inspect,
@@ -12607,108 +12598,99 @@ function requireBuffer_list () {
12607
12598
  return buffer_list;
12608
12599
  }
12609
12600
 
12610
- var destroy_1;
12611
- var hasRequiredDestroy;
12612
-
12613
- function requireDestroy () {
12614
- if (hasRequiredDestroy) return destroy_1;
12615
- hasRequiredDestroy = 1;
12616
-
12617
- // undocumented cb() API, needed for core, not for public API
12618
- function destroy(err, cb) {
12619
- const readableDestroyed = this._readableState && this._readableState.destroyed;
12620
- const writableDestroyed = this._writableState && this._writableState.destroyed;
12621
- if (readableDestroyed || writableDestroyed) {
12622
- if (cb) {
12623
- cb(err);
12624
- } else if (err) {
12625
- if (!this._writableState) {
12626
- process.nextTick(emitErrorNT, this, err);
12627
- } else if (!this._writableState.errorEmitted) {
12628
- this._writableState.errorEmitted = true;
12629
- process.nextTick(emitErrorNT, this, err);
12630
- }
12631
- }
12632
- return this;
12633
- }
12601
+ // undocumented cb() API, needed for core, not for public API
12602
+ function destroy(err, cb) {
12603
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
12604
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
12605
+ if (readableDestroyed || writableDestroyed) {
12606
+ if (cb) {
12607
+ cb(err);
12608
+ } else if (err) {
12609
+ if (!this._writableState) {
12610
+ process.nextTick(emitErrorNT, this, err);
12611
+ } else if (!this._writableState.errorEmitted) {
12612
+ this._writableState.errorEmitted = true;
12613
+ process.nextTick(emitErrorNT, this, err);
12614
+ }
12615
+ }
12616
+ return this;
12617
+ }
12634
12618
 
12635
- // we set destroyed to true before firing error callbacks in order
12636
- // to make it re-entrance safe in case destroy() is called within callbacks
12619
+ // we set destroyed to true before firing error callbacks in order
12620
+ // to make it re-entrance safe in case destroy() is called within callbacks
12637
12621
 
12638
- if (this._readableState) {
12639
- this._readableState.destroyed = true;
12640
- }
12622
+ if (this._readableState) {
12623
+ this._readableState.destroyed = true;
12624
+ }
12641
12625
 
12642
- // if this is a duplex stream mark the writable part as destroyed as well
12643
- if (this._writableState) {
12644
- this._writableState.destroyed = true;
12645
- }
12646
- this._destroy(err || null, err => {
12647
- if (!cb && err) {
12648
- if (!this._writableState) {
12649
- process.nextTick(emitErrorAndCloseNT, this, err);
12650
- } else if (!this._writableState.errorEmitted) {
12651
- this._writableState.errorEmitted = true;
12652
- process.nextTick(emitErrorAndCloseNT, this, err);
12653
- } else {
12654
- process.nextTick(emitCloseNT, this);
12655
- }
12656
- } else if (cb) {
12657
- process.nextTick(emitCloseNT, this);
12658
- cb(err);
12659
- } else {
12660
- process.nextTick(emitCloseNT, this);
12661
- }
12662
- });
12663
- return this;
12664
- }
12665
- function emitErrorAndCloseNT(self, err) {
12666
- emitErrorNT(self, err);
12667
- emitCloseNT(self);
12668
- }
12669
- function emitCloseNT(self) {
12670
- if (self._writableState && !self._writableState.emitClose) return;
12671
- if (self._readableState && !self._readableState.emitClose) return;
12672
- self.emit('close');
12673
- }
12674
- function undestroy() {
12675
- if (this._readableState) {
12676
- this._readableState.destroyed = false;
12677
- this._readableState.reading = false;
12678
- this._readableState.ended = false;
12679
- this._readableState.endEmitted = false;
12680
- }
12681
- if (this._writableState) {
12682
- this._writableState.destroyed = false;
12683
- this._writableState.ended = false;
12684
- this._writableState.ending = false;
12685
- this._writableState.finalCalled = false;
12686
- this._writableState.prefinished = false;
12687
- this._writableState.finished = false;
12688
- this._writableState.errorEmitted = false;
12689
- }
12690
- }
12691
- function emitErrorNT(self, err) {
12692
- self.emit('error', err);
12693
- }
12694
- function errorOrDestroy(stream, err) {
12695
- // We have tests that rely on errors being emitted
12696
- // in the same tick, so changing this is semver major.
12697
- // For now when you opt-in to autoDestroy we allow
12698
- // the error to be emitted nextTick. In a future
12699
- // semver major update we should change the default to this.
12700
-
12701
- const rState = stream._readableState;
12702
- const wState = stream._writableState;
12703
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
12704
- }
12705
- destroy_1 = {
12706
- destroy,
12707
- undestroy,
12708
- errorOrDestroy
12709
- };
12710
- return destroy_1;
12626
+ // if this is a duplex stream mark the writable part as destroyed as well
12627
+ if (this._writableState) {
12628
+ this._writableState.destroyed = true;
12629
+ }
12630
+ this._destroy(err || null, err => {
12631
+ if (!cb && err) {
12632
+ if (!this._writableState) {
12633
+ process.nextTick(emitErrorAndCloseNT, this, err);
12634
+ } else if (!this._writableState.errorEmitted) {
12635
+ this._writableState.errorEmitted = true;
12636
+ process.nextTick(emitErrorAndCloseNT, this, err);
12637
+ } else {
12638
+ process.nextTick(emitCloseNT, this);
12639
+ }
12640
+ } else if (cb) {
12641
+ process.nextTick(emitCloseNT, this);
12642
+ cb(err);
12643
+ } else {
12644
+ process.nextTick(emitCloseNT, this);
12645
+ }
12646
+ });
12647
+ return this;
12648
+ }
12649
+ function emitErrorAndCloseNT(self, err) {
12650
+ emitErrorNT(self, err);
12651
+ emitCloseNT(self);
12652
+ }
12653
+ function emitCloseNT(self) {
12654
+ if (self._writableState && !self._writableState.emitClose) return;
12655
+ if (self._readableState && !self._readableState.emitClose) return;
12656
+ self.emit('close');
12657
+ }
12658
+ function undestroy() {
12659
+ if (this._readableState) {
12660
+ this._readableState.destroyed = false;
12661
+ this._readableState.reading = false;
12662
+ this._readableState.ended = false;
12663
+ this._readableState.endEmitted = false;
12664
+ }
12665
+ if (this._writableState) {
12666
+ this._writableState.destroyed = false;
12667
+ this._writableState.ended = false;
12668
+ this._writableState.ending = false;
12669
+ this._writableState.finalCalled = false;
12670
+ this._writableState.prefinished = false;
12671
+ this._writableState.finished = false;
12672
+ this._writableState.errorEmitted = false;
12673
+ }
12674
+ }
12675
+ function emitErrorNT(self, err) {
12676
+ self.emit('error', err);
12711
12677
  }
12678
+ function errorOrDestroy(stream, err) {
12679
+ // We have tests that rely on errors being emitted
12680
+ // in the same tick, so changing this is semver major.
12681
+ // For now when you opt-in to autoDestroy we allow
12682
+ // the error to be emitted nextTick. In a future
12683
+ // semver major update we should change the default to this.
12684
+
12685
+ const rState = stream._readableState;
12686
+ const wState = stream._writableState;
12687
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
12688
+ }
12689
+ var destroy_1 = {
12690
+ destroy,
12691
+ undestroy,
12692
+ errorOrDestroy
12693
+ };
12712
12694
 
12713
12695
  var errorsBrowser = {};
12714
12696
 
@@ -12838,109 +12820,92 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
12838
12820
  createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
12839
12821
  errorsBrowser.codes = codes;
12840
12822
 
12841
- var state;
12842
- var hasRequiredState;
12843
-
12844
- function requireState () {
12845
- if (hasRequiredState) return state;
12846
- hasRequiredState = 1;
12847
-
12848
- const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
12849
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
12850
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
12851
- }
12852
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
12853
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
12854
- if (hwm != null) {
12855
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
12856
- const name = isDuplex ? duplexKey : 'highWaterMark';
12857
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
12858
- }
12859
- return Math.floor(hwm);
12860
- }
12861
-
12862
- // Default value
12863
- return state.objectMode ? 16 : 16 * 1024;
12864
- }
12865
- state = {
12866
- getHighWaterMark
12867
- };
12868
- return state;
12823
+ const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
12824
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
12825
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
12869
12826
  }
12827
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
12828
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
12829
+ if (hwm != null) {
12830
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
12831
+ const name = isDuplex ? duplexKey : 'highWaterMark';
12832
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
12833
+ }
12834
+ return Math.floor(hwm);
12835
+ }
12870
12836
 
12871
- var browser$b;
12872
- var hasRequiredBrowser$3;
12837
+ // Default value
12838
+ return state.objectMode ? 16 : 16 * 1024;
12839
+ }
12840
+ var state = {
12841
+ getHighWaterMark
12842
+ };
12873
12843
 
12874
- function requireBrowser$3 () {
12875
- if (hasRequiredBrowser$3) return browser$b;
12876
- hasRequiredBrowser$3 = 1;
12877
- /**
12878
- * Module exports.
12879
- */
12844
+ /**
12845
+ * Module exports.
12846
+ */
12880
12847
 
12881
- browser$b = deprecate;
12848
+ var browser$b = deprecate$1;
12882
12849
 
12883
- /**
12884
- * Mark that a method should not be used.
12885
- * Returns a modified function which warns once by default.
12886
- *
12887
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
12888
- *
12889
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
12890
- * will throw an Error when invoked.
12891
- *
12892
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
12893
- * will invoke `console.trace()` instead of `console.error()`.
12894
- *
12895
- * @param {Function} fn - the function to deprecate
12896
- * @param {String} msg - the string to print to the console when `fn` is invoked
12897
- * @returns {Function} a new "deprecated" version of `fn`
12898
- * @api public
12899
- */
12850
+ /**
12851
+ * Mark that a method should not be used.
12852
+ * Returns a modified function which warns once by default.
12853
+ *
12854
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
12855
+ *
12856
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
12857
+ * will throw an Error when invoked.
12858
+ *
12859
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
12860
+ * will invoke `console.trace()` instead of `console.error()`.
12861
+ *
12862
+ * @param {Function} fn - the function to deprecate
12863
+ * @param {String} msg - the string to print to the console when `fn` is invoked
12864
+ * @returns {Function} a new "deprecated" version of `fn`
12865
+ * @api public
12866
+ */
12900
12867
 
12901
- function deprecate (fn, msg) {
12902
- if (config('noDeprecation')) {
12903
- return fn;
12904
- }
12868
+ function deprecate$1 (fn, msg) {
12869
+ if (config('noDeprecation')) {
12870
+ return fn;
12871
+ }
12905
12872
 
12906
- var warned = false;
12907
- function deprecated() {
12908
- if (!warned) {
12909
- if (config('throwDeprecation')) {
12910
- throw new Error(msg);
12911
- } else if (config('traceDeprecation')) {
12912
- console.trace(msg);
12913
- } else {
12914
- console.warn(msg);
12915
- }
12916
- warned = true;
12917
- }
12918
- return fn.apply(this, arguments);
12919
- }
12873
+ var warned = false;
12874
+ function deprecated() {
12875
+ if (!warned) {
12876
+ if (config('throwDeprecation')) {
12877
+ throw new Error(msg);
12878
+ } else if (config('traceDeprecation')) {
12879
+ console.trace(msg);
12880
+ } else {
12881
+ console.warn(msg);
12882
+ }
12883
+ warned = true;
12884
+ }
12885
+ return fn.apply(this, arguments);
12886
+ }
12920
12887
 
12921
- return deprecated;
12922
- }
12888
+ return deprecated;
12889
+ }
12923
12890
 
12924
- /**
12925
- * Checks `localStorage` for boolean values for the given `name`.
12926
- *
12927
- * @param {String} name
12928
- * @returns {Boolean}
12929
- * @api private
12930
- */
12891
+ /**
12892
+ * Checks `localStorage` for boolean values for the given `name`.
12893
+ *
12894
+ * @param {String} name
12895
+ * @returns {Boolean}
12896
+ * @api private
12897
+ */
12931
12898
 
12932
- function config (name) {
12933
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
12934
- try {
12935
- if (!commonjsGlobal.localStorage) return false;
12936
- } catch (_) {
12937
- return false;
12938
- }
12939
- var val = commonjsGlobal.localStorage[name];
12940
- if (null == val) return false;
12941
- return String(val).toLowerCase() === 'true';
12942
- }
12943
- return browser$b;
12899
+ function config (name) {
12900
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
12901
+ try {
12902
+ if (!commonjsGlobal.localStorage) return false;
12903
+ } catch (_) {
12904
+ return false;
12905
+ }
12906
+ var val = commonjsGlobal.localStorage[name];
12907
+ if (null == val) return false;
12908
+ return String(val).toLowerCase() === 'true';
12944
12909
  }
12945
12910
 
12946
12911
  var _stream_writable;
@@ -12971,12 +12936,12 @@ function require_stream_writable () {
12971
12936
 
12972
12937
  /*<replacement>*/
12973
12938
  const internalUtil = {
12974
- deprecate: requireBrowser$3()
12939
+ deprecate: browser$b
12975
12940
  };
12976
12941
  /*</replacement>*/
12977
12942
 
12978
12943
  /*<replacement>*/
12979
- var Stream = requireStreamBrowser();
12944
+ var Stream = streamBrowser;
12980
12945
  /*</replacement>*/
12981
12946
 
12982
12947
  const Buffer = require$$6$1.Buffer;
@@ -12987,8 +12952,8 @@ function require_stream_writable () {
12987
12952
  function _isUint8Array(obj) {
12988
12953
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
12989
12954
  }
12990
- const destroyImpl = requireDestroy();
12991
- const _require = requireState(),
12955
+ const destroyImpl = destroy_1;
12956
+ const _require = state,
12992
12957
  getHighWaterMark = _require.getHighWaterMark;
12993
12958
  const _require$codes = errorsBrowser.codes,
12994
12959
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -14182,7 +14147,7 @@ function require_stream_readable () {
14182
14147
  /*</replacement>*/
14183
14148
 
14184
14149
  /*<replacement>*/
14185
- var Stream = requireStreamBrowser();
14150
+ var Stream = streamBrowser;
14186
14151
  /*</replacement>*/
14187
14152
 
14188
14153
  const Buffer = require$$6$1.Buffer;
@@ -14205,8 +14170,8 @@ function require_stream_readable () {
14205
14170
  /*</replacement>*/
14206
14171
 
14207
14172
  const BufferList = requireBuffer_list();
14208
- const destroyImpl = requireDestroy();
14209
- const _require = requireState(),
14173
+ const destroyImpl = destroy_1;
14174
+ const _require = state,
14210
14175
  getHighWaterMark = _require.getHighWaterMark;
14211
14176
  const _require$codes = errorsBrowser.codes,
14212
14177
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -17572,7 +17537,7 @@ function WriteReq(chunk, encoding, cb) {
17572
17537
 
17573
17538
  function WritableState(options, stream) {
17574
17539
  Object.defineProperty(this, 'buffer', {
17575
- get: deprecate$1(function () {
17540
+ get: deprecate$2(function () {
17576
17541
  return this.getBuffer();
17577
17542
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
17578
17543
  });
@@ -39248,9 +39213,9 @@ function loadSync (filename) {
39248
39213
  }
39249
39214
 
39250
39215
  async function writeSync (fullpath, stringValue) {
39251
- await mkdir(dirname(fullpath), { recursive: true });
39216
+ await fs.promises.mkdir(dirname(fullpath), { recursive: true });
39252
39217
  // writeFileSync(fullpath, stringValue)
39253
- await writeFile(fullpath, stringValue);
39218
+ await fs.promises.writeFile(fullpath, stringValue);
39254
39219
  }
39255
39220
 
39256
39221
  /**
@@ -44190,7 +44155,7 @@ class Body {
44190
44155
  }
44191
44156
  }
44192
44157
 
44193
- Body.prototype.buffer = deprecate$2(Body.prototype.buffer, 'Please use \'response.arrayBuffer()\' instead of \'response.buffer()\'', 'node-fetch#buffer');
44158
+ Body.prototype.buffer = deprecate$3(Body.prototype.buffer, 'Please use \'response.arrayBuffer()\' instead of \'response.buffer()\'', 'node-fetch#buffer');
44194
44159
 
44195
44160
  // In browsers, all properties are enumerable.
44196
44161
  Object.defineProperties(Body.prototype, {
@@ -44200,7 +44165,7 @@ Object.defineProperties(Body.prototype, {
44200
44165
  blob: {enumerable: true},
44201
44166
  json: {enumerable: true},
44202
44167
  text: {enumerable: true},
44203
- data: {get: deprecate$2(() => {},
44168
+ data: {get: deprecate$3(() => {},
44204
44169
  'data doesn\'t exist, use json(), text(), arrayBuffer(), or body instead',
44205
44170
  'https://github.com/node-fetch/node-fetch/issues/1000 (response)')}
44206
44171
  });
@@ -44304,7 +44269,7 @@ const clone = (instance, highWaterMark) => {
44304
44269
  return body;
44305
44270
  };
44306
44271
 
44307
- const getNonSpecFormDataBoundary = deprecate$2(
44272
+ const getNonSpecFormDataBoundary = deprecate$3(
44308
44273
  body => body.getBoundary(),
44309
44274
  'form-data doesn\'t follow the spec and requires special treatment. Use alternative package',
44310
44275
  'https://github.com/node-fetch/node-fetch/issues/1167'
@@ -45221,7 +45186,7 @@ const isRequest = object => {
45221
45186
  );
45222
45187
  };
45223
45188
 
45224
- const doBadDataWarn = deprecate$2(() => {},
45189
+ const doBadDataWarn = deprecate$3(() => {},
45225
45190
  '.data is not a valid RequestInit property, use .body instead',
45226
45191
  'https://github.com/node-fetch/node-fetch/issues/1000 (request)');
45227
45192