@mapwhit/pbf 1.0.3 → 2.0.0

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 (2) hide show
  1. package/index.js +2 -12
  2. package/package.json +5 -8
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
- const assert = require('assert');
2
- const ieee754 = require('ieee754');
1
+ import ieee754 from 'ieee754';
3
2
 
4
3
  const SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
5
4
  const SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
@@ -216,8 +215,6 @@ class Pbf {
216
215
  case Pbf.Fixed64:
217
216
  this.pos += 8;
218
217
  break;
219
- default:
220
- assert(false, `Unimplemented type: ${type}`);
221
218
  }
222
219
  }
223
220
 
@@ -446,7 +443,7 @@ Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
446
443
  Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
447
444
  Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
448
445
 
449
- module.exports = Pbf;
446
+ export default Pbf;
450
447
 
451
448
  function readVarintRemainder(l, s, p) {
452
449
  const { buf } = p;
@@ -469,8 +466,6 @@ function readVarintRemainder(l, s, p) {
469
466
  b = buf[p.pos++];
470
467
  h |= (b & 0x01) << 31;
471
468
  if (b < 0x80) return toNum(l, h, s);
472
-
473
- assert(false, 'Expected varint not more than 10 bytes');
474
469
  }
475
470
 
476
471
  function readPackedEnd(pbf) {
@@ -486,11 +481,6 @@ function toNum(low, high, isSigned) {
486
481
  }
487
482
 
488
483
  function writeBigVarint(val, pbf) {
489
- /* global DEBUG */
490
- if (DEBUG) {
491
- assert(val < 0x10000000000000000 && val >= -0x10000000000000000, "Given varint doesn't fit into 10 bytes");
492
- }
493
-
494
484
  let low;
495
485
  let high;
496
486
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@mapwhit/pbf",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "description": "a low-level, lightweight protocol buffers implementation in JavaScript",
5
- "main": "index.js",
5
+ "exports": "./index.js",
6
+ "type": "module",
6
7
  "scripts": {
7
8
  "test": "make check"
8
9
  },
@@ -31,17 +32,13 @@
31
32
  },
32
33
  "homepage": "https://github.com/mapbox/pbf",
33
34
  "dependencies": {
34
- "@pirxpilot/nanoassert": "~1",
35
35
  "ieee754": "^1.1.12"
36
36
  },
37
37
  "devDependencies": {
38
- "@biomejs/biome": "2.0.5",
38
+ "@biomejs/biome": "2.3.11",
39
39
  "benchmark": "^2.1.4",
40
- "protobufjs": "~7",
40
+ "protobufjs": "~8.0.0",
41
41
  "protocol-buffers": "~5",
42
42
  "tile-stats-runner": "^1.0.0"
43
- },
44
- "browser": {
45
- "assert": "@pirxpilot/nanoassert"
46
43
  }
47
44
  }