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