@typeberry/lib 0.0.5-4df52ac → 0.0.5-6197992

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.
Files changed (3) hide show
  1. package/index.cjs +17453 -0
  2. package/index.js +13 -44
  3. package/package.json +8 -2
package/index.js CHANGED
@@ -1,10 +1,7 @@
1
- 'use strict';
1
+ import assert from 'node:assert';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
2
4
 
3
- var assert = require('node:assert');
4
- var fs = require('node:fs');
5
- var os = require('node:os');
6
-
7
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
5
  var GpVersion;
9
6
  (function (GpVersion) {
10
7
  GpVersion["V0_6_7"] = "0.6.7";
@@ -2613,7 +2610,7 @@ async function __wbg_init$2(module_or_path) {
2613
2610
  if (wasm$2 !== void 0) return wasm$2;
2614
2611
  if (typeof module_or_path !== "undefined") if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
2615
2612
  else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
2616
- if (typeof module_or_path === "undefined") module_or_path = new URL("bandersnatch_bg.wasm", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
2613
+ if (typeof module_or_path === "undefined") module_or_path = new URL("bandersnatch_bg.wasm", import.meta.url);
2617
2614
  const imports = __wbg_get_imports$2();
2618
2615
  if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) module_or_path = fetch(module_or_path);
2619
2616
  const { instance, module } = await __wbg_load$2(await module_or_path, imports);
@@ -2732,7 +2729,7 @@ async function __wbg_init$1(module_or_path) {
2732
2729
  if (wasm$1 !== void 0) return wasm$1;
2733
2730
  if (typeof module_or_path !== "undefined") if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
2734
2731
  else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
2735
- if (typeof module_or_path === "undefined") module_or_path = new URL("ed25519_wasm_bg.wasm", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
2732
+ if (typeof module_or_path === "undefined") module_or_path = new URL("ed25519_wasm_bg.wasm", import.meta.url);
2736
2733
  const imports = __wbg_get_imports$1();
2737
2734
  if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) module_or_path = fetch(module_or_path);
2738
2735
  const { instance, module } = await __wbg_load$1(await module_or_path, imports);
@@ -3016,7 +3013,7 @@ async function __wbg_init(module_or_path) {
3016
3013
  if (wasm !== void 0) return wasm;
3017
3014
  if (typeof module_or_path !== "undefined") if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
3018
3015
  else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
3019
- if (typeof module_or_path === "undefined") module_or_path = new URL("reed_solomon_wasm_bg.wasm", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
3016
+ if (typeof module_or_path === "undefined") module_or_path = new URL("reed_solomon_wasm_bg.wasm", import.meta.url);
3020
3017
  const imports = __wbg_get_imports();
3021
3018
  if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) module_or_path = fetch(module_or_path);
3022
3019
  const { instance, module } = await __wbg_load(await module_or_path, imports);
@@ -7957,7 +7954,7 @@ function parseLoggerOptions(input, defaultLevel, workingDir) {
7957
7954
  }
7958
7955
  }
7959
7956
  // TODO [ToDr] Fix dirname for workers.
7960
- const myDir = (undefined ?? "").split("/");
7957
+ const myDir = (import.meta.dirname ?? "").split("/");
7961
7958
  myDir.pop();
7962
7959
  myDir.pop();
7963
7960
  return {
@@ -8228,7 +8225,7 @@ class AuthorshipOptions {
8228
8225
  }
8229
8226
  }
8230
8227
 
8231
- const logger$4 = Logger.new(undefined, "config");
8228
+ const logger$4 = Logger.new(import.meta.filename, "config");
8232
8229
  /** Development config. Will accept unsealed blocks for now. */
8233
8230
  const DEV_CONFIG = "dev";
8234
8231
  /** Default config file. */
@@ -14042,7 +14039,7 @@ var AccessType;
14042
14039
  AccessType[AccessType["READ"] = 0] = "READ";
14043
14040
  AccessType[AccessType["WRITE"] = 1] = "WRITE";
14044
14041
  })(AccessType || (AccessType = {}));
14045
- const logger$3 = Logger.new(undefined, "pvm:mem");
14042
+ const logger$3 = Logger.new(import.meta.filename, "pvm:mem");
14046
14043
  class Memory {
14047
14044
  sbrkIndex;
14048
14045
  virtualSbrkIndex;
@@ -15878,7 +15875,7 @@ class JumpTable {
15878
15875
  }
15879
15876
  }
15880
15877
 
15881
- const logger$2 = Logger.new(undefined, "pvm-interpreter");
15878
+ const logger$2 = Logger.new(import.meta.filename, "pvm-interpreter");
15882
15879
  var ProgramDecoderError;
15883
15880
  (function (ProgramDecoderError) {
15884
15881
  ProgramDecoderError[ProgramDecoderError["InvalidProgramError"] = 0] = "InvalidProgramError";
@@ -15934,7 +15931,7 @@ class ProgramDecoder {
15934
15931
  }
15935
15932
  }
15936
15933
 
15937
- const logger$1 = Logger.new(undefined, "pvm");
15934
+ const logger$1 = Logger.new(import.meta.filename, "pvm");
15938
15935
  class Interpreter {
15939
15936
  useSbrkGas;
15940
15937
  registers = new Registers();
@@ -16326,7 +16323,7 @@ class HostCalls {
16326
16323
  }
16327
16324
  }
16328
16325
 
16329
- const logger = Logger.new(undefined, "host-calls-pvm");
16326
+ const logger = Logger.new(import.meta.filename, "host-calls-pvm");
16330
16327
  /** Container for all available host calls. */
16331
16328
  class HostCallsManager {
16332
16329
  hostCalls = new Map();
@@ -17422,32 +17419,4 @@ var index = /*#__PURE__*/Object.freeze({
17422
17419
  WorkPackageExecutor: WorkPackageExecutor
17423
17420
  });
17424
17421
 
17425
- exports.block = index$j;
17426
- exports.block_json = index$h;
17427
- exports.bytes = index$q;
17428
- exports.codec = index$o;
17429
- exports.collections = index$l;
17430
- exports.config = index$k;
17431
- exports.config_node = index$f;
17432
- exports.crypto = index$m;
17433
- exports.database = index$b;
17434
- exports.erasure_coding = index$a;
17435
- exports.hash = index$n;
17436
- exports.jam_host_calls = index$9;
17437
- exports.json_parser = index$i;
17438
- exports.logger = index$g;
17439
- exports.mmr = index$8;
17440
- exports.numbers = index$p;
17441
- exports.ordering = index$r;
17442
- exports.pvm = index$3;
17443
- exports.pvm_host_calls = index$6;
17444
- exports.pvm_interpreter = index$7;
17445
- exports.pvm_program = index$4;
17446
- exports.pvm_spi_decoder = index$5;
17447
- exports.shuffling = index$2;
17448
- exports.state = index$e;
17449
- exports.state_json = index$1;
17450
- exports.state_merkleization = index$c;
17451
- exports.transition = index;
17452
- exports.trie = index$d;
17453
- exports.utils = index$s;
17422
+ export { index$j as block, index$h as block_json, index$q as bytes, index$o as codec, index$l as collections, index$k as config, index$f as config_node, index$m as crypto, index$b as database, index$a as erasure_coding, index$n as hash, index$9 as jam_host_calls, index$i as json_parser, index$g as logger, index$8 as mmr, index$p as numbers, index$r as ordering, index$3 as pvm, index$6 as pvm_host_calls, index$7 as pvm_interpreter, index$4 as pvm_program, index$5 as pvm_spi_decoder, index$2 as shuffling, index$e as state, index$1 as state_json, index$c as state_merkleization, index as transition, index$d as trie, index$s as utils };
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@typeberry/lib",
3
- "version": "0.0.5-4df52ac",
3
+ "version": "0.0.5-6197992",
4
4
  "main": "index.js",
5
5
  "author": "Fluffy Labs",
6
6
  "license": "MPL-2.0",
7
- "sideEffects": false
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "import": "./index.js",
11
+ "require": "./index.cjs"
12
+ }
13
+ }
8
14
  }