smoldot 1.0.11 → 1.0.12

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/README.md CHANGED
@@ -125,3 +125,10 @@ import { compileBytecode } from 'smoldot/bytecode';
125
125
  compileBytecode().then((bytecode) => postMessage(bytecode))
126
126
  onmessage = (msg) => smoldot.run(msg.data);
127
127
  ```
128
+
129
+ Note that importing sub-paths (for example importing `smoldot/worker`) relies on a relatively
130
+ modern JavaScript feature. If you import a smoldot sub-path from a TypeScript file, you might have
131
+ to configure TypeScript to use `"moduleResolution": "node16"`. [The official TypeScript
132
+ documentation itself recommends setting this configuration option to
133
+ `node`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#module-resolution-strategies),
134
+ and it is likely that `node16` becomes the go-to module resolution scheme in the future.
@@ -1,4 +1,6 @@
1
1
  export declare function utf8BytesToString(buffer: Uint8Array, offset: number, length: number): string;
2
+ export declare function readUInt8(buffer: Uint8Array, offset: number): number;
3
+ export declare function readUInt16BE(buffer: Uint8Array, offset: number): number;
2
4
  export declare function readUInt32LE(buffer: Uint8Array, offset: number): number;
3
5
  /**
4
6
  * Sets the value of a given byte in the buffer.
@@ -3,7 +3,7 @@
3
3
  // Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.
4
4
  // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.writeUInt64LE = exports.writeUInt32LE = exports.writeUInt8 = exports.readUInt32LE = exports.utf8BytesToString = void 0;
6
+ exports.writeUInt64LE = exports.writeUInt32LE = exports.writeUInt8 = exports.readUInt32LE = exports.readUInt16BE = exports.readUInt8 = exports.utf8BytesToString = void 0;
7
7
  // This program is free software: you can redistribute it and/or modify
8
8
  // it under the terms of the GNU General Public License as published by
9
9
  // the Free Software Foundation, either version 3 of the License, or
@@ -21,6 +21,16 @@ function utf8BytesToString(buffer, offset, length) {
21
21
  return new TextDecoder().decode(buffer.slice(offset, offset + length));
22
22
  }
23
23
  exports.utf8BytesToString = utf8BytesToString;
24
+ function readUInt8(buffer, offset) {
25
+ checkRange(buffer, offset, 1);
26
+ return buffer[offset];
27
+ }
28
+ exports.readUInt8 = readUInt8;
29
+ function readUInt16BE(buffer, offset) {
30
+ checkRange(buffer, offset, 2);
31
+ return ((buffer[offset] << 8) | buffer[offset + 1]);
32
+ }
33
+ exports.readUInt16BE = readUInt16BE;
24
34
  function readUInt32LE(buffer, offset) {
25
35
  checkRange(buffer, offset, 4);
26
36
  return (buffer[offset] | (buffer[offset + 1] << 8) | (buffer[offset + 2] << 16)) + (buffer[offset + 3] * 0x1000000);