New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

micro-packed

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-packed - npm Package Compare versions

Comparing version 0.6.3 to 0.7.0

lib/debugger.js.map

46

lib/debugger.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.debug = exports.diff = exports.decode = exports.table = void 0;
exports.table = table;
exports.decode = decode;
exports.diff = diff;
exports.debug = debug;
const base_1 = require("@scure/base");

@@ -8,8 +11,11 @@ const P = require("./index.js");

const UNKNOWN = '(???)';
const bold = '\x1b[1m';
const gray = '\x1b[90m';
const reset = '\x1b[0m';
const red = '\x1b[31m';
const green = '\x1b[32m';
const yellow = '\x1b[33m';
const codes = { esc: 27, nl: 10 };
const esc = String.fromCharCode(codes.esc);
const nl = String.fromCharCode(codes.nl);
const bold = esc + '[1m';
const gray = esc + '[90m';
const reset = esc + '[0m';
const red = esc + '[31m';
const green = esc + '[32m';
const yellow = esc + '[33m';
class DebugReader extends P._TEST._Reader {

@@ -139,3 +145,3 @@ constructor() {

widths[k] = Math.max(widths[k] || 0, chrWidth(str(k)), str(elm[k])
.split('\n')
.split(nl)
.reduce((a, b) => Math.max(a, chrWidth(b)), 0));

@@ -151,7 +157,7 @@ }

const elm = data[idx];
const row = columns.map((i) => str(elm[i]).split('\n'));
const row = columns.map((i) => str(elm[i]).split(nl));
let message = [...Array(Math.max(...row.map((i) => i.length))).keys()]
.map((line) => row.map((c, i) => pad(str(c[line]), widths[columns[i]])))
.map((line, _) => wrap(` ${line.join(padding)} `, 1))
.join('\n');
.join(nl);
res.push(message);

@@ -163,8 +169,7 @@ }

.join(`─${i === res.length - 1 ? '┴' : '┼'}─`);
res[i] += wrap(`\n${reset}${gray}─${border}─${reset}`);
res[i] += wrap(`${nl}${reset}${gray}─${border}─${reset}`);
}
// @ts-ignore
console.log(res.join('\n'));
console.log(res.join(nl));
}
exports.table = table;
function fmtData(data, perLine = 8) {

@@ -175,3 +180,3 @@ const res = [];

}
return res.map((i) => `${bold}${i}${reset}`).join('\n');
return res.map((i) => `${bold}${i}${reset}`).join(nl);
}

@@ -217,3 +222,2 @@ function fmtValue(value) {

}
exports.decode = decode;
function getMap(coder, data) {

@@ -235,5 +239,5 @@ data = toBytes(data);

if (aI !== undefined)
outA += '\n';
outA += nl;
if (eI !== undefined)
outE += '\n';
outE += nl;
}

@@ -250,3 +254,3 @@ if (aI !== undefined)

return a;
return `A: ${red}${a}${reset}\nE: ${green}${e}${reset}`;
return `A: ${red}${a}${reset}${nl}E: ${green}${e}${reset}`;
}

@@ -257,3 +261,3 @@ function diffLength(a, e) {

return aLen;
return `A: ${red}${aLen}${reset}\nE: ${green}${eLen}${reset}`;
return `A: ${red}${aLen}${reset}${nl}E: ${green}${eLen}${reset}`;
}

@@ -264,3 +268,3 @@ function diffValue(a, e) {

return aV;
return `A: ${red}${aV}${reset}\nE: ${green}${eV}${reset}`;
return `A: ${red}${aV}${reset}${nl}E: ${green}${eV}${reset}`;
}

@@ -291,3 +295,2 @@ function diff(coder, actual, expected, skipSame = true) {

}
exports.diff = diff;
/**

@@ -314,3 +317,2 @@ * Wraps a CoderType with debug logging for encoding and decoding operations.

}
exports.debug = debug;
//# sourceMappingURL=debugger.js.map

@@ -5,8 +5,11 @@ import { base64, hex } from '@scure/base';

const UNKNOWN = '(???)';
const bold = '\x1b[1m';
const gray = '\x1b[90m';
const reset = '\x1b[0m';
const red = '\x1b[31m';
const green = '\x1b[32m';
const yellow = '\x1b[33m';
const codes = { esc: 27, nl: 10 };
const esc = String.fromCharCode(codes.esc);
const nl = String.fromCharCode(codes.nl);
const bold = esc + '[1m';
const gray = esc + '[90m';
const reset = esc + '[0m';
const red = esc + '[31m';
const green = esc + '[32m';
const yellow = esc + '[33m';
class DebugReader extends P._TEST._Reader {

@@ -136,3 +139,3 @@ constructor() {

widths[k] = Math.max(widths[k] || 0, chrWidth(str(k)), str(elm[k])
.split('\n')
.split(nl)
.reduce((a, b) => Math.max(a, chrWidth(b)), 0));

@@ -148,7 +151,7 @@ }

const elm = data[idx];
const row = columns.map((i) => str(elm[i]).split('\n'));
const row = columns.map((i) => str(elm[i]).split(nl));
let message = [...Array(Math.max(...row.map((i) => i.length))).keys()]
.map((line) => row.map((c, i) => pad(str(c[line]), widths[columns[i]])))
.map((line, _) => wrap(` ${line.join(padding)} `, 1))
.join('\n');
.join(nl);
res.push(message);

@@ -160,6 +163,6 @@ }

.join(`─${i === res.length - 1 ? '┴' : '┼'}─`);
res[i] += wrap(`\n${reset}${gray}─${border}─${reset}`);
res[i] += wrap(`${nl}${reset}${gray}─${border}─${reset}`);
}
// @ts-ignore
console.log(res.join('\n'));
console.log(res.join(nl));
}

@@ -171,3 +174,3 @@ function fmtData(data, perLine = 8) {

}
return res.map((i) => `${bold}${i}${reset}`).join('\n');
return res.map((i) => `${bold}${i}${reset}`).join(nl);
}

@@ -229,5 +232,5 @@ function fmtValue(value) {

if (aI !== undefined)
outA += '\n';
outA += nl;
if (eI !== undefined)
outE += '\n';
outE += nl;
}

@@ -244,3 +247,3 @@ if (aI !== undefined)

return a;
return `A: ${red}${a}${reset}\nE: ${green}${e}${reset}`;
return `A: ${red}${a}${reset}${nl}E: ${green}${e}${reset}`;
}

@@ -251,3 +254,3 @@ function diffLength(a, e) {

return aLen;
return `A: ${red}${aLen}${reset}\nE: ${green}${eLen}${reset}`;
return `A: ${red}${aLen}${reset}${nl}E: ${green}${eLen}${reset}`;
}

@@ -258,3 +261,3 @@ function diffValue(a, e) {

return aV;
return `A: ${red}${aV}${reset}\nE: ${green}${eV}${reset}`;
return `A: ${red}${aV}${reset}${nl}E: ${green}${eV}${reset}`;
}

@@ -261,0 +264,0 @@ export function diff(coder, actual, expected, skipSame = true) {

@@ -358,3 +358,3 @@ import type { Coder as BaseCoder } from '@scure/base';

export declare const wrap: <T>(inner: BytesCoderStream<T> & {
validate?: Validate<T> | undefined;
validate?: Validate<T>;
}) => CoderType<T>;

@@ -607,3 +607,4 @@ /**

*/
export declare const bytes: (len: Length, le?: boolean) => CoderType<Bytes>;
declare const createBytes: (len: Length, le?: boolean) => CoderType<Bytes>;
export { createBytes as bytes, createHex as hex };
/**

@@ -660,3 +661,3 @@ * Prefix-encoded value using a length prefix and an inner CoderType.

*/
export declare const hex: (len: Length, options?: HexOpts) => CoderType<string>;
declare const createHex: (len: Length, options?: HexOpts) => CoderType<string>;
/**

@@ -966,3 +967,2 @@ * Applies a base coder to a CoderType.

};
export {};
//# sourceMappingURL=index.d.ts.map
{
"name": "micro-packed",
"version": "0.6.3",
"version": "0.7.0",
"description": "Define complex binary structures using composable primitives",
"dependencies": {
"@scure/base": "~1.2.1"
},
"files": [
"lib/index.js",
"lib/index.d.ts",
"lib/index.d.ts.map",
"lib/esm/index.js",
"lib/debugger.js",
"lib/debugger.d.ts",
"lib/debugger.d.ts.map",
"lib/esm/debugger.js",
"lib/esm/package.json",
"!lib/_type_test.js",
"!lib/_type_test.js.map",
"!lib/_type_test.d.ts",
"!lib/_type_test.d.ts.map",
"!lib/esm/_type_test.js",
"!lib/esm/_type_test.js.map",
"!lib/esm/_type_test.d.ts",
"!lib/esm/_type_test.d.ts.map",
"!src/_type_test.ts",
"lib",
"src"

@@ -22,15 +26,11 @@ ],

".": {
"types": "./lib/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/index.js"
"require": "./lib/index.js"
},
"./debugger": {
"types": "./lib/debugger.d.ts",
"import": "./lib/esm/debugger.js",
"default": "./lib/debugger.js"
"require": "./lib/debugger.js"
}
},
"dependencies": {
"@scure/base": "~1.1.5"
},
"sideEffects": false,
"scripts": {

@@ -52,10 +52,19 @@ "bench": "node benchmark/index.js noble",

"devDependencies": {
"@paulmillr/jsbt": "0.1.0",
"@paulmillr/jsbt": "0.2.1",
"fast-check": "3.0.0",
"micro-bmark": "0.3.1",
"micro-should": "0.4.0",
"prettier": "3.1.1",
"typescript": "5.3.2"
"prettier": "3.3.2",
"typescript": "5.5.2"
},
"keywords": ["encode", "encoder", "binary", "bytes", "struct", "tuple", "enum"],
"keywords": [
"encode",
"encoder",
"binary",
"bytes",
"struct",
"tuple",
"enum"
],
"funding": "https://paulmillr.com/funding/"
}

@@ -13,4 +13,3 @@ # micro-packed

- [sol-signer](https://github.com/paulmillr/micro-sol-signer) for parsing of keys, messages and other things
- [ed25519-keygen](https://github.com/paulmillr/ed25519-keygen) for lightweight implementations of PGP and SSH, including base64armor
- [micro-otp](https://github.com/paulmillr/micro-signer) just briefly
- [key-producer](https://github.com/paulmillr/micro-key-producer) for lightweight implementations of PGP, SSH and OTP

@@ -17,0 +16,0 @@ ## Usage

@@ -6,9 +6,13 @@ import { base64, hex } from '@scure/base';

const UNKNOWN = '(???)';
const bold = '\x1b[1m';
const gray = '\x1b[90m';
const reset = '\x1b[0m';
const red = '\x1b[31m';
const green = '\x1b[32m';
const yellow = '\x1b[33m';
const codes = { esc: 27, nl: 10 };
const esc = String.fromCharCode(codes.esc);
const nl = String.fromCharCode(codes.nl);
const bold = esc + '[1m';
const gray = esc + '[90m';
const reset = esc + '[0m';
const red = esc + '[31m';
const green = esc + '[32m';
const yellow = esc + '[33m';
type DebugPath = { start: number; end?: number; path: string; value?: any };

@@ -135,3 +139,3 @@ class DebugReader extends P._TEST._Reader {

str(elm[k])
.split('\n')
.split(nl)
.reduce((a, b) => Math.max(a, chrWidth(b)), 0)

@@ -147,7 +151,7 @@ );

const elm = data[idx];
const row = columns.map((i) => str(elm[i]).split('\n'));
const row = columns.map((i) => str(elm[i]).split(nl));
let message = [...Array(Math.max(...row.map((i) => i.length))).keys()]
.map((line) => row.map((c, i) => pad(str(c[line]), widths[columns[i]])))
.map((line, _) => wrap(` ${line.join(padding)} `, 1))
.join('\n');
.join(nl);
res.push(message);

@@ -159,6 +163,6 @@ }

.join(`─${i === res.length - 1 ? '┴' : '┼'}─`);
res[i] += wrap(`\n${reset}${gray}─${border}─${reset}`);
res[i] += wrap(`${nl}${reset}${gray}─${border}─${reset}`);
}
// @ts-ignore
console.log(res.join('\n'));
console.log(res.join(nl));
}

@@ -171,3 +175,3 @@

}
return res.map((i) => `${bold}${i}${reset}`).join('\n');
return res.map((i) => `${bold}${i}${reset}`).join(nl);
}

@@ -234,4 +238,4 @@

if (i && !(i % 8)) {
if (aI !== undefined) outA += '\n';
if (eI !== undefined) outE += '\n';
if (aI !== undefined) outA += nl;
if (eI !== undefined) outE += nl;
}

@@ -246,3 +250,3 @@ if (aI !== undefined) outA += aI === eI ? charHex(aI) : `${yellow}${charHex(aI)}${reset}`;

if (a === e) return a;
return `A: ${red}${a}${reset}\nE: ${green}${e}${reset}`;
return `A: ${red}${a}${reset}${nl}E: ${green}${e}${reset}`;
}

@@ -252,3 +256,3 @@ function diffLength(a: P.Bytes, e: P.Bytes) {

if (aLen === eLen) return aLen;
return `A: ${red}${aLen}${reset}\nE: ${green}${eLen}${reset}`;
return `A: ${red}${aLen}${reset}${nl}E: ${green}${eLen}${reset}`;
}

@@ -259,3 +263,3 @@

if (aV === eV) return aV;
return `A: ${red}${aV}${reset}\nE: ${green}${eV}${reset}`;
return `A: ${red}${aV}${reset}${nl}E: ${green}${eV}${reset}`;
}

@@ -262,0 +266,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc