@fireproof/core 0.6.3-dev → 0.6.3-dev2

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var node_fs = require('node:fs');
4
- var promises = require('fs/promises');
4
+ var promises = require('node:fs/promises');
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
7
7
 
@@ -9958,15 +9958,7 @@ var _polyfillNode_events = /*#__PURE__*/Object.freeze({
9958
9958
 
9959
9959
  var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
9960
9960
 
9961
- var streamBrowser;
9962
- var hasRequiredStreamBrowser;
9963
-
9964
- function requireStreamBrowser () {
9965
- if (hasRequiredStreamBrowser) return streamBrowser;
9966
- hasRequiredStreamBrowser = 1;
9967
- streamBrowser = require$$0$1.EventEmitter;
9968
- return streamBrowser;
9969
- }
9961
+ var streamBrowser = require$$0$1.EventEmitter;
9970
9962
 
9971
9963
  // shim for using process in browser
9972
9964
  // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
@@ -10109,7 +10101,7 @@ var argv = [];
10109
10101
  var version$2 = ''; // empty string to avoid regexp issues
10110
10102
  var versions = {};
10111
10103
  var release = {};
10112
- var config = {};
10104
+ var config$1 = {};
10113
10105
 
10114
10106
  function noop$3() {}
10115
10107
 
@@ -10186,7 +10178,7 @@ var browser$1$1 = {
10186
10178
  hrtime: hrtime,
10187
10179
  platform: platform,
10188
10180
  release: release,
10189
- config: config,
10181
+ config: config$1,
10190
10182
  uptime: uptime
10191
10183
  };
10192
10184
 
@@ -10267,11 +10259,11 @@ function format(f) {
10267
10259
  // Mark that a method should not be used.
10268
10260
  // Returns a modified function which warns once by default.
10269
10261
  // If --no-deprecation is set, then it is a no-op.
10270
- function deprecate$1(fn, msg) {
10262
+ function deprecate$2(fn, msg) {
10271
10263
  // Allow for deprecating things in the process of starting up.
10272
10264
  if (isUndefined(global$1.process)) {
10273
10265
  return function() {
10274
- return deprecate$1(fn, msg).apply(this, arguments);
10266
+ return deprecate$2(fn, msg).apply(this, arguments);
10275
10267
  };
10276
10268
  }
10277
10269
 
@@ -10880,7 +10872,7 @@ var _polyfillNode_util = {
10880
10872
  isBoolean: isBoolean,
10881
10873
  isArray: isArray,
10882
10874
  inspect: inspect,
10883
- deprecate: deprecate$1,
10875
+ deprecate: deprecate$2,
10884
10876
  format: format,
10885
10877
  debuglog: debuglog,
10886
10878
  promisify: promisify,
@@ -10893,7 +10885,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
10893
10885
  callbackify: callbackify,
10894
10886
  debuglog: debuglog,
10895
10887
  default: _polyfillNode_util,
10896
- deprecate: deprecate$1,
10888
+ deprecate: deprecate$2,
10897
10889
  format: format,
10898
10890
  inherits: inherits$w,
10899
10891
  inspect: inspect,
@@ -11081,108 +11073,99 @@ function requireBuffer_list () {
11081
11073
  return buffer_list;
11082
11074
  }
11083
11075
 
11084
- var destroy_1;
11085
- var hasRequiredDestroy;
11086
-
11087
- function requireDestroy () {
11088
- if (hasRequiredDestroy) return destroy_1;
11089
- hasRequiredDestroy = 1;
11090
-
11091
- // undocumented cb() API, needed for core, not for public API
11092
- function destroy(err, cb) {
11093
- const readableDestroyed = this._readableState && this._readableState.destroyed;
11094
- const writableDestroyed = this._writableState && this._writableState.destroyed;
11095
- if (readableDestroyed || writableDestroyed) {
11096
- if (cb) {
11097
- cb(err);
11098
- } else if (err) {
11099
- if (!this._writableState) {
11100
- process.nextTick(emitErrorNT, this, err);
11101
- } else if (!this._writableState.errorEmitted) {
11102
- this._writableState.errorEmitted = true;
11103
- process.nextTick(emitErrorNT, this, err);
11104
- }
11105
- }
11106
- return this;
11107
- }
11076
+ // undocumented cb() API, needed for core, not for public API
11077
+ function destroy(err, cb) {
11078
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
11079
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
11080
+ if (readableDestroyed || writableDestroyed) {
11081
+ if (cb) {
11082
+ cb(err);
11083
+ } else if (err) {
11084
+ if (!this._writableState) {
11085
+ process.nextTick(emitErrorNT, this, err);
11086
+ } else if (!this._writableState.errorEmitted) {
11087
+ this._writableState.errorEmitted = true;
11088
+ process.nextTick(emitErrorNT, this, err);
11089
+ }
11090
+ }
11091
+ return this;
11092
+ }
11108
11093
 
11109
- // we set destroyed to true before firing error callbacks in order
11110
- // to make it re-entrance safe in case destroy() is called within callbacks
11094
+ // we set destroyed to true before firing error callbacks in order
11095
+ // to make it re-entrance safe in case destroy() is called within callbacks
11111
11096
 
11112
- if (this._readableState) {
11113
- this._readableState.destroyed = true;
11114
- }
11097
+ if (this._readableState) {
11098
+ this._readableState.destroyed = true;
11099
+ }
11115
11100
 
11116
- // if this is a duplex stream mark the writable part as destroyed as well
11117
- if (this._writableState) {
11118
- this._writableState.destroyed = true;
11119
- }
11120
- this._destroy(err || null, err => {
11121
- if (!cb && err) {
11122
- if (!this._writableState) {
11123
- process.nextTick(emitErrorAndCloseNT, this, err);
11124
- } else if (!this._writableState.errorEmitted) {
11125
- this._writableState.errorEmitted = true;
11126
- process.nextTick(emitErrorAndCloseNT, this, err);
11127
- } else {
11128
- process.nextTick(emitCloseNT, this);
11129
- }
11130
- } else if (cb) {
11131
- process.nextTick(emitCloseNT, this);
11132
- cb(err);
11133
- } else {
11134
- process.nextTick(emitCloseNT, this);
11135
- }
11136
- });
11137
- return this;
11138
- }
11139
- function emitErrorAndCloseNT(self, err) {
11140
- emitErrorNT(self, err);
11141
- emitCloseNT(self);
11142
- }
11143
- function emitCloseNT(self) {
11144
- if (self._writableState && !self._writableState.emitClose) return;
11145
- if (self._readableState && !self._readableState.emitClose) return;
11146
- self.emit('close');
11147
- }
11148
- function undestroy() {
11149
- if (this._readableState) {
11150
- this._readableState.destroyed = false;
11151
- this._readableState.reading = false;
11152
- this._readableState.ended = false;
11153
- this._readableState.endEmitted = false;
11154
- }
11155
- if (this._writableState) {
11156
- this._writableState.destroyed = false;
11157
- this._writableState.ended = false;
11158
- this._writableState.ending = false;
11159
- this._writableState.finalCalled = false;
11160
- this._writableState.prefinished = false;
11161
- this._writableState.finished = false;
11162
- this._writableState.errorEmitted = false;
11163
- }
11164
- }
11165
- function emitErrorNT(self, err) {
11166
- self.emit('error', err);
11167
- }
11168
- function errorOrDestroy(stream, err) {
11169
- // We have tests that rely on errors being emitted
11170
- // in the same tick, so changing this is semver major.
11171
- // For now when you opt-in to autoDestroy we allow
11172
- // the error to be emitted nextTick. In a future
11173
- // semver major update we should change the default to this.
11174
-
11175
- const rState = stream._readableState;
11176
- const wState = stream._writableState;
11177
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
11178
- }
11179
- destroy_1 = {
11180
- destroy,
11181
- undestroy,
11182
- errorOrDestroy
11183
- };
11184
- return destroy_1;
11101
+ // if this is a duplex stream mark the writable part as destroyed as well
11102
+ if (this._writableState) {
11103
+ this._writableState.destroyed = true;
11104
+ }
11105
+ this._destroy(err || null, err => {
11106
+ if (!cb && err) {
11107
+ if (!this._writableState) {
11108
+ process.nextTick(emitErrorAndCloseNT, this, err);
11109
+ } else if (!this._writableState.errorEmitted) {
11110
+ this._writableState.errorEmitted = true;
11111
+ process.nextTick(emitErrorAndCloseNT, this, err);
11112
+ } else {
11113
+ process.nextTick(emitCloseNT, this);
11114
+ }
11115
+ } else if (cb) {
11116
+ process.nextTick(emitCloseNT, this);
11117
+ cb(err);
11118
+ } else {
11119
+ process.nextTick(emitCloseNT, this);
11120
+ }
11121
+ });
11122
+ return this;
11123
+ }
11124
+ function emitErrorAndCloseNT(self, err) {
11125
+ emitErrorNT(self, err);
11126
+ emitCloseNT(self);
11185
11127
  }
11128
+ function emitCloseNT(self) {
11129
+ if (self._writableState && !self._writableState.emitClose) return;
11130
+ if (self._readableState && !self._readableState.emitClose) return;
11131
+ self.emit('close');
11132
+ }
11133
+ function undestroy() {
11134
+ if (this._readableState) {
11135
+ this._readableState.destroyed = false;
11136
+ this._readableState.reading = false;
11137
+ this._readableState.ended = false;
11138
+ this._readableState.endEmitted = false;
11139
+ }
11140
+ if (this._writableState) {
11141
+ this._writableState.destroyed = false;
11142
+ this._writableState.ended = false;
11143
+ this._writableState.ending = false;
11144
+ this._writableState.finalCalled = false;
11145
+ this._writableState.prefinished = false;
11146
+ this._writableState.finished = false;
11147
+ this._writableState.errorEmitted = false;
11148
+ }
11149
+ }
11150
+ function emitErrorNT(self, err) {
11151
+ self.emit('error', err);
11152
+ }
11153
+ function errorOrDestroy(stream, err) {
11154
+ // We have tests that rely on errors being emitted
11155
+ // in the same tick, so changing this is semver major.
11156
+ // For now when you opt-in to autoDestroy we allow
11157
+ // the error to be emitted nextTick. In a future
11158
+ // semver major update we should change the default to this.
11159
+
11160
+ const rState = stream._readableState;
11161
+ const wState = stream._writableState;
11162
+ if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
11163
+ }
11164
+ var destroy_1 = {
11165
+ destroy,
11166
+ undestroy,
11167
+ errorOrDestroy
11168
+ };
11186
11169
 
11187
11170
  var errorsBrowser = {};
11188
11171
 
@@ -11312,109 +11295,92 @@ createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
11312
11295
  createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
11313
11296
  errorsBrowser.codes = codes;
11314
11297
 
11315
- var state;
11316
- var hasRequiredState;
11317
-
11318
- function requireState () {
11319
- if (hasRequiredState) return state;
11320
- hasRequiredState = 1;
11321
-
11322
- const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
11323
- function highWaterMarkFrom(options, isDuplex, duplexKey) {
11324
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
11325
- }
11326
- function getHighWaterMark(state, options, duplexKey, isDuplex) {
11327
- const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
11328
- if (hwm != null) {
11329
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
11330
- const name = isDuplex ? duplexKey : 'highWaterMark';
11331
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
11332
- }
11333
- return Math.floor(hwm);
11334
- }
11335
-
11336
- // Default value
11337
- return state.objectMode ? 16 : 16 * 1024;
11338
- }
11339
- state = {
11340
- getHighWaterMark
11341
- };
11342
- return state;
11298
+ const ERR_INVALID_OPT_VALUE = errorsBrowser.codes.ERR_INVALID_OPT_VALUE;
11299
+ function highWaterMarkFrom(options, isDuplex, duplexKey) {
11300
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
11343
11301
  }
11302
+ function getHighWaterMark(state, options, duplexKey, isDuplex) {
11303
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
11304
+ if (hwm != null) {
11305
+ if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
11306
+ const name = isDuplex ? duplexKey : 'highWaterMark';
11307
+ throw new ERR_INVALID_OPT_VALUE(name, hwm);
11308
+ }
11309
+ return Math.floor(hwm);
11310
+ }
11344
11311
 
11345
- var browser$b;
11346
- var hasRequiredBrowser$3;
11312
+ // Default value
11313
+ return state.objectMode ? 16 : 16 * 1024;
11314
+ }
11315
+ var state = {
11316
+ getHighWaterMark
11317
+ };
11347
11318
 
11348
- function requireBrowser$3 () {
11349
- if (hasRequiredBrowser$3) return browser$b;
11350
- hasRequiredBrowser$3 = 1;
11351
- /**
11352
- * Module exports.
11353
- */
11319
+ /**
11320
+ * Module exports.
11321
+ */
11354
11322
 
11355
- browser$b = deprecate;
11323
+ var browser$b = deprecate$1;
11356
11324
 
11357
- /**
11358
- * Mark that a method should not be used.
11359
- * Returns a modified function which warns once by default.
11360
- *
11361
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
11362
- *
11363
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
11364
- * will throw an Error when invoked.
11365
- *
11366
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
11367
- * will invoke `console.trace()` instead of `console.error()`.
11368
- *
11369
- * @param {Function} fn - the function to deprecate
11370
- * @param {String} msg - the string to print to the console when `fn` is invoked
11371
- * @returns {Function} a new "deprecated" version of `fn`
11372
- * @api public
11373
- */
11325
+ /**
11326
+ * Mark that a method should not be used.
11327
+ * Returns a modified function which warns once by default.
11328
+ *
11329
+ * If `localStorage.noDeprecation = true` is set, then it is a no-op.
11330
+ *
11331
+ * If `localStorage.throwDeprecation = true` is set, then deprecated functions
11332
+ * will throw an Error when invoked.
11333
+ *
11334
+ * If `localStorage.traceDeprecation = true` is set, then deprecated functions
11335
+ * will invoke `console.trace()` instead of `console.error()`.
11336
+ *
11337
+ * @param {Function} fn - the function to deprecate
11338
+ * @param {String} msg - the string to print to the console when `fn` is invoked
11339
+ * @returns {Function} a new "deprecated" version of `fn`
11340
+ * @api public
11341
+ */
11374
11342
 
11375
- function deprecate (fn, msg) {
11376
- if (config('noDeprecation')) {
11377
- return fn;
11378
- }
11343
+ function deprecate$1 (fn, msg) {
11344
+ if (config('noDeprecation')) {
11345
+ return fn;
11346
+ }
11379
11347
 
11380
- var warned = false;
11381
- function deprecated() {
11382
- if (!warned) {
11383
- if (config('throwDeprecation')) {
11384
- throw new Error(msg);
11385
- } else if (config('traceDeprecation')) {
11386
- console.trace(msg);
11387
- } else {
11388
- console.warn(msg);
11389
- }
11390
- warned = true;
11391
- }
11392
- return fn.apply(this, arguments);
11393
- }
11348
+ var warned = false;
11349
+ function deprecated() {
11350
+ if (!warned) {
11351
+ if (config('throwDeprecation')) {
11352
+ throw new Error(msg);
11353
+ } else if (config('traceDeprecation')) {
11354
+ console.trace(msg);
11355
+ } else {
11356
+ console.warn(msg);
11357
+ }
11358
+ warned = true;
11359
+ }
11360
+ return fn.apply(this, arguments);
11361
+ }
11394
11362
 
11395
- return deprecated;
11396
- }
11363
+ return deprecated;
11364
+ }
11397
11365
 
11398
- /**
11399
- * Checks `localStorage` for boolean values for the given `name`.
11400
- *
11401
- * @param {String} name
11402
- * @returns {Boolean}
11403
- * @api private
11404
- */
11366
+ /**
11367
+ * Checks `localStorage` for boolean values for the given `name`.
11368
+ *
11369
+ * @param {String} name
11370
+ * @returns {Boolean}
11371
+ * @api private
11372
+ */
11405
11373
 
11406
- function config (name) {
11407
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
11408
- try {
11409
- if (!commonjsGlobal.localStorage) return false;
11410
- } catch (_) {
11411
- return false;
11412
- }
11413
- var val = commonjsGlobal.localStorage[name];
11414
- if (null == val) return false;
11415
- return String(val).toLowerCase() === 'true';
11416
- }
11417
- return browser$b;
11374
+ function config (name) {
11375
+ // accessing global.localStorage can trigger a DOMException in sandboxed iframes
11376
+ try {
11377
+ if (!commonjsGlobal.localStorage) return false;
11378
+ } catch (_) {
11379
+ return false;
11380
+ }
11381
+ var val = commonjsGlobal.localStorage[name];
11382
+ if (null == val) return false;
11383
+ return String(val).toLowerCase() === 'true';
11418
11384
  }
11419
11385
 
11420
11386
  var _stream_writable;
@@ -11445,12 +11411,12 @@ function require_stream_writable () {
11445
11411
 
11446
11412
  /*<replacement>*/
11447
11413
  const internalUtil = {
11448
- deprecate: requireBrowser$3()
11414
+ deprecate: browser$b
11449
11415
  };
11450
11416
  /*</replacement>*/
11451
11417
 
11452
11418
  /*<replacement>*/
11453
- var Stream = requireStreamBrowser();
11419
+ var Stream = streamBrowser;
11454
11420
  /*</replacement>*/
11455
11421
 
11456
11422
  const Buffer = require$$6$1.Buffer;
@@ -11461,8 +11427,8 @@ function require_stream_writable () {
11461
11427
  function _isUint8Array(obj) {
11462
11428
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
11463
11429
  }
11464
- const destroyImpl = requireDestroy();
11465
- const _require = requireState(),
11430
+ const destroyImpl = destroy_1;
11431
+ const _require = state,
11466
11432
  getHighWaterMark = _require.getHighWaterMark;
11467
11433
  const _require$codes = errorsBrowser.codes,
11468
11434
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -12656,7 +12622,7 @@ function require_stream_readable () {
12656
12622
  /*</replacement>*/
12657
12623
 
12658
12624
  /*<replacement>*/
12659
- var Stream = requireStreamBrowser();
12625
+ var Stream = streamBrowser;
12660
12626
  /*</replacement>*/
12661
12627
 
12662
12628
  const Buffer = require$$6$1.Buffer;
@@ -12679,8 +12645,8 @@ function require_stream_readable () {
12679
12645
  /*</replacement>*/
12680
12646
 
12681
12647
  const BufferList = requireBuffer_list();
12682
- const destroyImpl = requireDestroy();
12683
- const _require = requireState(),
12648
+ const destroyImpl = destroy_1;
12649
+ const _require = state,
12684
12650
  getHighWaterMark = _require.getHighWaterMark;
12685
12651
  const _require$codes = errorsBrowser.codes,
12686
12652
  ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
@@ -16046,7 +16012,7 @@ function WriteReq(chunk, encoding, cb) {
16046
16012
 
16047
16013
  function WritableState(options, stream) {
16048
16014
  Object.defineProperty(this, 'buffer', {
16049
- get: deprecate$1(function () {
16015
+ get: deprecate$2(function () {
16050
16016
  return this.getBuffer();
16051
16017
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
16052
16018
  });