fix: multi-repo local dev (file:../ deps, package exports, missing deps)

This commit is contained in:
Raven Scott
2026-05-21 20:14:15 -04:00
parent fc17ec7445
commit dfc3315572
395 changed files with 51601 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
Copyright (c) 2014 Dominic Tarr
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+28
View File
@@ -0,0 +1,28 @@
# signed-varint
store signed integers efficiently, as per protocol-buffers.
For unsigned integers use
[varint](https://github.com/chrisdickinson/varint).
Integers are mapped to positive integers, so that positive integers
become positive even numbers (n*2)
and negative integers become positive odd numbers. (n*-2 - 1)
This is the same as moving the sign bit from the most significant
possition to the least significant. Otherwise, varint will encode
negative numbers as large integers.
``` js
var varint = require('varint')
var svarint = require('signed-varint')
console.log('unsigned', varint.encode(-1))
console.log('signed', svarint.encode(-1))
//=> unsigned [255,255,255, 15]
// signed [1]
```
## License
MIT
+16
View File
@@ -0,0 +1,16 @@
var varint = require('varint')
exports.encode = function encode (v, b, o) {
v = v >= 0 ? v*2 : v*-2 - 1
var r = varint.encode(v, b, o)
encode.bytes = varint.encode.bytes
return r
}
exports.decode = function decode (b, o) {
var v = varint.decode(b, o)
decode.bytes = varint.decode.bytes
return v & 1 ? (v+1) / -2 : v / 2
}
exports.encodingLength = function (v) {
return varint.encodingLength(v >= 0 ? v*2 : v*-2 - 1)
}
+21
View File
@@ -0,0 +1,21 @@
{
"name": "signed-varint",
"description": "efficiently store signed integers in varint",
"version": "2.0.1",
"homepage": "https://github.com/dominictarr/signed-varint",
"repository": {
"type": "git",
"url": "git://github.com/dominictarr/signed-varint.git"
},
"dependencies": {
"varint": "~5.0.0"
},
"devDependencies": {
"tape": "~2.12.3"
},
"scripts": {
"test": "node test.js"
},
"author": "Dominic Tarr <[email protected]> (http://dominictarr.com)",
"license": "MIT"
}
+49
View File
@@ -0,0 +1,49 @@
var tape = require('tape')
var svi = require('./')
function encodeDecode (t, v, bytes) {
var b = svi.encode(v)
t.equal(b.length, bytes)
t.equal(svi.decode(b), v)
t.equal(svi.encode.bytes, bytes)
t.equal(svi.decode.bytes, bytes)
}
tape('single byte', function (t) {
encodeDecode(t, 1, 1)
encodeDecode(t, -1, 1)
encodeDecode(t, 63, 1)
encodeDecode(t, -64, 1)
t.end()
})
tape('double byte', function (t) {
encodeDecode(t, 64, 2)
encodeDecode(t, -65, 2)
encodeDecode(t, 127, 2)
encodeDecode(t, -128, 2)
encodeDecode(t, 128, 2)
encodeDecode(t, -129, 2)
encodeDecode(t, 255, 2)
encodeDecode(t, -256, 2)
t.end()
})
tape('tripple', function (t) {
encodeDecode(t, 0x4000, 3)
encodeDecode(t, -0x4001, 3)
encodeDecode(t, 1048574, 3)
encodeDecode(t, -1048575, 3)
t.end()
})
tape('quad', function (t) {
encodeDecode(t, 134217726, 4)
encodeDecode(t, -134217727, 4)
t.end()
})
tape('large int', function (t) {
encodeDecode(t, 0x80000000000, 7)
encodeDecode(t, -0x80000000000, 7)
t.end()
})