@typeberry/convert 0.7.1 → 0.7.2-f0f2df3
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.
- package/index.js +42 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4558,6 +4558,46 @@ function measure(id) {
|
|
|
4558
4558
|
const start = now();
|
|
4559
4559
|
return () => `${id} took ${(now() - start).toFixed(2)}ms`;
|
|
4560
4560
|
}
|
|
4561
|
+
const BYTES_IN_MB = (/* unused pure expression or super */ null && (1024 * 1024));
|
|
4562
|
+
const toMb = (bytes) => (bytes / BYTES_IN_MB).toFixed(1);
|
|
4563
|
+
const signedMb = (bytes) => `${bytes >= 0 ? "+" : "-"}${toMb(bytes)}`;
|
|
4564
|
+
/** Raw process memory usage, or `null` in environments without `process` (e.g. browser). */
|
|
4565
|
+
function rawMemoryUsage() {
|
|
4566
|
+
if (isBrowser() || typeof process.memoryUsage !== "function") {
|
|
4567
|
+
return null;
|
|
4568
|
+
}
|
|
4569
|
+
return process.memoryUsage();
|
|
4570
|
+
}
|
|
4571
|
+
/**
|
|
4572
|
+
* Format current process memory usage as a human readable string.
|
|
4573
|
+
*
|
|
4574
|
+
* Returns an empty string in the browser where `process.memoryUsage` is unavailable.
|
|
4575
|
+
*
|
|
4576
|
+
* `arrayBuffers` should allow tracking WASM memory, since every instance backs its
|
|
4577
|
+
* memory with `ArrayBuffer`.
|
|
4578
|
+
*/
|
|
4579
|
+
function memoryUsage() {
|
|
4580
|
+
const m = rawMemoryUsage();
|
|
4581
|
+
if (m === null) {
|
|
4582
|
+
return "";
|
|
4583
|
+
}
|
|
4584
|
+
return `rss=${toMb(m.rss)}MB heap=${toMb(m.heapUsed)}/${toMb(m.heapTotal)}MB external=${toMb(m.external)}MB arrayBuffers=${toMb(m.arrayBuffers)}MB`;
|
|
4585
|
+
}
|
|
4586
|
+
/** Create a stateful memory usage reporter. */
|
|
4587
|
+
function memoryTracker() {
|
|
4588
|
+
let prev = null;
|
|
4589
|
+
return () => {
|
|
4590
|
+
const m = rawMemoryUsage();
|
|
4591
|
+
if (m === null) {
|
|
4592
|
+
return "";
|
|
4593
|
+
}
|
|
4594
|
+
const delta = prev === null
|
|
4595
|
+
? ""
|
|
4596
|
+
: ` (Δrss=${signedMb(m.rss - prev.rss)}MB ΔarrayBuffers=${signedMb(m.arrayBuffers - prev.arrayBuffers)}MB)`;
|
|
4597
|
+
prev = m;
|
|
4598
|
+
return `${memoryUsage()}${delta}`;
|
|
4599
|
+
};
|
|
4600
|
+
}
|
|
4561
4601
|
/** A class that adds `toString` method that prints all properties of an object. */
|
|
4562
4602
|
class WithDebug {
|
|
4563
4603
|
toString() {
|
|
@@ -4626,7 +4666,7 @@ function seeThrough(v) {
|
|
|
4626
4666
|
}
|
|
4627
4667
|
|
|
4628
4668
|
;// CONCATENATED MODULE: ./packages/core/utils/package.json
|
|
4629
|
-
const package_namespaceObject = {"rE":"0.7.
|
|
4669
|
+
const package_namespaceObject = /*#__PURE__*/JSON.parse('{"rE":"0.7.2-f0f2df3"}');
|
|
4630
4670
|
;// CONCATENATED MODULE: ./packages/core/utils/result.ts
|
|
4631
4671
|
|
|
4632
4672
|
/**
|
|
@@ -11368,7 +11408,7 @@ const DEFAULT_CONFIG = "default";
|
|
|
11368
11408
|
const NODE_DEFAULTS = {
|
|
11369
11409
|
name: isBrowser() ? "browser" : external_node_os_default().hostname(),
|
|
11370
11410
|
config: [DEFAULT_CONFIG],
|
|
11371
|
-
pvm: PvmBackend.
|
|
11411
|
+
pvm: PvmBackend.BuiltIn,
|
|
11372
11412
|
};
|
|
11373
11413
|
/** Chain spec chooser. */
|
|
11374
11414
|
var KnownChainSpec;
|