Release rolling / release (push) Successful in 11m16s
Bump published pins (compact-encoding 3, bare-fetch/tls/https/ws 3, bare-subprocess 6, bare-signals 5, corestore 7.12, protomux 3.11, hypercore-crypto 3.7, bare-runtime 1.31) and regenerate catalogs, manifests, and kernel/seeder bundles. Adapt call sites to the new APIs: - Corestore: explicit session flush before suspend(); treeCache ctor opts - bare-crypto: KeyObject.export() instead of removed ._key - Protomux 3.11: wait for fullyOpened()/fullyClosed() on chat channels - bare-fetch: surface response.type and Headers.getSetCookie - host snapshots: bare-os 3.9 / bare-posix / bare-fs.statfs frsize - bare-subprocess 6: optional IPC channel + json serialization Keep catalog sync from wiping curated pearEntries. Teach the Node test shim to stub bare-thread/bare-worker (ESM absolute paths) and chain Bare.on so bare-timers can load. Booter 479, protocol 34, seeder 14.
2301 lines
80 KiB
JavaScript
2301 lines
80 KiB
JavaScript
var __bare_os_bundle_exports__ = (() => {
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
}) : x)(function(x) {
|
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
});
|
|
var __commonJS = (cb, mod) => function __require2() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// ../../node_modules/bare-ansi-escapes/index.js
|
|
var require_bare_ansi_escapes = __commonJS({
|
|
"../../node_modules/bare-ansi-escapes/index.js"(exports) {
|
|
var ESC = "\x1B";
|
|
var CSI = ESC + "[";
|
|
var SGR = (n) => CSI + n + "m";
|
|
exports.constants = {
|
|
ESC,
|
|
CSI,
|
|
SGR
|
|
};
|
|
exports.cursorHide = CSI + "?25l";
|
|
exports.cursorShow = CSI + "?25h";
|
|
exports.cursorUp = function cursorUp(n = 1) {
|
|
return CSI + n + "A";
|
|
};
|
|
exports.cursorDown = function cursorDown(n = 1) {
|
|
return CSI + n + "B";
|
|
};
|
|
exports.cursorForward = function cursorForward(n = 1) {
|
|
return CSI + n + "C";
|
|
};
|
|
exports.cursorBack = function cursorBack(n = 1) {
|
|
return CSI + n + "D";
|
|
};
|
|
exports.cursorNextLine = function cursorNextLine(n = 1) {
|
|
return CSI + n + "E";
|
|
};
|
|
exports.cursorPreviousLine = function cursorPreviousLine(n = 1) {
|
|
return CSI + n + "F";
|
|
};
|
|
exports.cursorPosition = function cursorPosition(column, row = 0) {
|
|
if (row === 0) return CSI + (column + 1) + "G";
|
|
return CSI + (row + 1) + ";" + (column + 1) + "H";
|
|
};
|
|
exports.eraseDisplayEnd = CSI + "J";
|
|
exports.eraseDisplayStart = CSI + "1J";
|
|
exports.eraseDisplay = CSI + "2J";
|
|
exports.eraseLineEnd = CSI + "K";
|
|
exports.eraseLineStart = CSI + "1K";
|
|
exports.eraseLine = CSI + "2K";
|
|
exports.scrollUp = function scrollUp(n = 1) {
|
|
return CSI + n + "S";
|
|
};
|
|
exports.scrollDown = function scrollDown(n = 1) {
|
|
return CSI + n + "T";
|
|
};
|
|
exports.modifierReset = SGR(0);
|
|
exports.modifierBold = SGR(1);
|
|
exports.modifierDim = SGR(2);
|
|
exports.modifierItalic = SGR(3);
|
|
exports.modifierUnderline = SGR(4);
|
|
exports.modifierNormal = SGR(22);
|
|
exports.modifierNotItalic = SGR(23);
|
|
exports.modifierNotUnderline = SGR(24);
|
|
exports.colorBlack = SGR(30);
|
|
exports.colorRed = SGR(31);
|
|
exports.colorGreen = SGR(32);
|
|
exports.colorYellow = SGR(33);
|
|
exports.colorBlue = SGR(34);
|
|
exports.colorMagenta = SGR(35);
|
|
exports.colorCyan = SGR(36);
|
|
exports.colorWhite = SGR(37);
|
|
exports.colorDefault = SGR(39);
|
|
exports.colorBrightBlack = SGR(90);
|
|
exports.colorBrightRed = SGR(91);
|
|
exports.colorBrightGreen = SGR(92);
|
|
exports.colorBrightYellow = SGR(93);
|
|
exports.colorBrightBlue = SGR(94);
|
|
exports.colorBrightMagenta = SGR(95);
|
|
exports.colorBrightCyan = SGR(96);
|
|
exports.colorBrightWhite = SGR(97);
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-type/binding.js
|
|
var require_binding = __commonJS({
|
|
"../../node_modules/bare-type/binding.js"(exports, module) {
|
|
module.exports = __require.addon();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-type/index.js
|
|
var require_bare_type = __commonJS({
|
|
"../../node_modules/bare-type/index.js"(exports, module) {
|
|
var binding = require_binding();
|
|
var t = binding.constants;
|
|
var Type = class {
|
|
constructor(type) {
|
|
this._type = type;
|
|
}
|
|
isUndefined() {
|
|
return this._type === t.UNDEFINED;
|
|
}
|
|
isNull() {
|
|
return this._type === t.NULL;
|
|
}
|
|
isBoolean() {
|
|
return this._type === t.BOOLEAN;
|
|
}
|
|
isNumber() {
|
|
return (this._type & 255) === t.NUMBER;
|
|
}
|
|
isInt32() {
|
|
return (this._type & (255 | t.INT32)) === (t.NUMBER | t.INT32);
|
|
}
|
|
isUint32() {
|
|
return (this._type & (255 | t.UINT32)) === (t.NUMBER | t.UINT32);
|
|
}
|
|
isString() {
|
|
return this._type === t.STRING;
|
|
}
|
|
isSymbol() {
|
|
return this._type === t.SYMBOL;
|
|
}
|
|
isObject() {
|
|
return (this._type & 255) === t.OBJECT;
|
|
}
|
|
isArray() {
|
|
return this._type === (t.OBJECT | t.ARRAY);
|
|
}
|
|
isArguments() {
|
|
return this._type === (t.OBJECT | t.ARGUMENTS);
|
|
}
|
|
isDate() {
|
|
return this._type === (t.OBJECT | t.DATE);
|
|
}
|
|
isRegExp() {
|
|
return this._type === (t.OBJECT | t.REGEXP);
|
|
}
|
|
isError() {
|
|
return this._type === (t.OBJECT | t.ERROR);
|
|
}
|
|
isPromise() {
|
|
return this._type === (t.OBJECT | t.PROMISE);
|
|
}
|
|
isProxy() {
|
|
return this._type === (t.OBJECT | t.PROXY);
|
|
}
|
|
isGenerator() {
|
|
return this._type === (t.OBJECT | t.GENERATOR);
|
|
}
|
|
isMap() {
|
|
return this._type === (t.OBJECT | t.MAP);
|
|
}
|
|
isSet() {
|
|
return this._type === (t.OBJECT | t.SET);
|
|
}
|
|
isWeakMap() {
|
|
return this._type === (t.OBJECT | t.WEAK_MAP);
|
|
}
|
|
isWeakSet() {
|
|
return this._type === (t.OBJECT | t.WEAK_SET);
|
|
}
|
|
isWeakRef() {
|
|
return this._type === (t.OBJECT | t.WEAK_REF);
|
|
}
|
|
isArrayBuffer() {
|
|
return this._type === (t.OBJECT | t.ARRAYBUFFER);
|
|
}
|
|
isSharedArrayBuffer() {
|
|
return this._type === (t.OBJECT | t.SHAREDARRAYBUFFER);
|
|
}
|
|
isTypedArray() {
|
|
return (this._type & 65535) === (t.OBJECT | t.TYPEDARRAY);
|
|
}
|
|
isInt8Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.INT8ARRAY);
|
|
}
|
|
isUint8Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT8ARRAY);
|
|
}
|
|
isUint8ClampedArray() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT8CLAMPEDARRAY);
|
|
}
|
|
isInt16Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.INT16ARRAY);
|
|
}
|
|
isUint16Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT16ARRAY);
|
|
}
|
|
isInt32Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.INT32ARRAY);
|
|
}
|
|
isUint32Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT32ARRAY);
|
|
}
|
|
isFloat16Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.FLOAT16ARRAY);
|
|
}
|
|
isFloat32Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.FLOAT32ARRAY);
|
|
}
|
|
isFloat64Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.FLOAT64ARRAY);
|
|
}
|
|
isBigInt64Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.BIGINT64ARRAY);
|
|
}
|
|
isBigUint64Array() {
|
|
return this._type === (t.OBJECT | t.TYPEDARRAY | t.BIGUINT64ARRAY);
|
|
}
|
|
isDataView() {
|
|
return this._type === (t.OBJECT | t.DATAVIEW);
|
|
}
|
|
isModuleNamespace() {
|
|
return this._type === (t.OBJECT | t.MODULE_NAMESPACE);
|
|
}
|
|
isFunction() {
|
|
return (this._type & 255) === t.FUNCTION;
|
|
}
|
|
isAsyncFunction() {
|
|
return (this._type & (255 | t.ASYNC_FUNCTION)) === (t.FUNCTION | t.ASYNC_FUNCTION);
|
|
}
|
|
isGeneratorFunction() {
|
|
return (this._type & (255 | t.GENERATOR_FUNCTION)) === (t.FUNCTION | t.GENERATOR_FUNCTION);
|
|
}
|
|
isExternal() {
|
|
return this._type === t.EXTERNAL;
|
|
}
|
|
isBigInt() {
|
|
return this._type === t.BIGINT;
|
|
}
|
|
};
|
|
module.exports = exports = function type(value) {
|
|
switch (typeof value) {
|
|
case "undefined":
|
|
return new Type(t.UNDEFINED);
|
|
case "boolean":
|
|
return new Type(t.BOOLEAN);
|
|
case "number":
|
|
return new Type(
|
|
Number.isSafeInteger(value) ? binding.type(value) : t.NUMBER
|
|
);
|
|
case "string":
|
|
return new Type(t.STRING);
|
|
case "symbol":
|
|
return new Type(t.SYMBOL);
|
|
case "object":
|
|
return new Type(value === null ? t.NULL : binding.type(value));
|
|
case "function":
|
|
return new Type(binding.type(value));
|
|
case "bigint":
|
|
return new Type(t.BIGINT);
|
|
}
|
|
};
|
|
exports.createTag = function createTag(...components) {
|
|
const tag = new Uint32Array(4);
|
|
for (let i = 0; i < 4; i++) tag[i] = components[i] || 0;
|
|
return tag;
|
|
};
|
|
exports.addTag = function addTag(object, tag) {
|
|
binding.addTag(object, tag);
|
|
};
|
|
exports.checkTag = function checkTag(object, tag) {
|
|
return binding.checkTag(object, tag);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-inspect/binding.js
|
|
var require_binding2 = __commonJS({
|
|
"../../node_modules/bare-inspect/binding.js"(exports, module) {
|
|
module.exports = __require.addon();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-inspect/index.js
|
|
var require_bare_inspect = __commonJS({
|
|
"../../node_modules/bare-inspect/index.js"(exports, module) {
|
|
var ansiEscapes = require_bare_ansi_escapes();
|
|
var getType = require_bare_type();
|
|
var binding = require_binding2();
|
|
var defaultDepth = 2;
|
|
var defaultBreakLength = 80;
|
|
var defaultMaxArrayLength = 40;
|
|
module.exports = exports = function inspect(value, opts = {}) {
|
|
const {
|
|
colors = false,
|
|
depth = defaultDepth,
|
|
breakLength = defaultBreakLength,
|
|
stylize = defaultStylize(colors)
|
|
} = opts;
|
|
const references = new InspectRefMap();
|
|
const tree = inspectValue(value, 0, {
|
|
colors,
|
|
depth,
|
|
breakLength,
|
|
stylize,
|
|
references
|
|
});
|
|
return tree.toString();
|
|
};
|
|
exports.styles = {
|
|
bigint: ansiEscapes.colorYellow,
|
|
boolean: ansiEscapes.colorYellow,
|
|
date: ansiEscapes.colorMagenta,
|
|
module: ansiEscapes.modifierUnderline,
|
|
name: ansiEscapes.modifierReset,
|
|
null: ansiEscapes.modifierBold,
|
|
number: ansiEscapes.colorYellow,
|
|
regexp: ansiEscapes.colorRed,
|
|
special: ansiEscapes.colorCyan,
|
|
string: ansiEscapes.colorGreen,
|
|
symbol: ansiEscapes.colorGreen,
|
|
undefined: ansiEscapes.colorBrightBlack
|
|
};
|
|
var styles = exports.styles;
|
|
function defaultStylize(colors) {
|
|
return function stylize(value, style) {
|
|
const color = colors && styles[style];
|
|
if (color) return color + value + ansiEscapes.modifierReset;
|
|
return value;
|
|
};
|
|
}
|
|
var InspectRefMap = class {
|
|
constructor() {
|
|
this.refs = /* @__PURE__ */ new WeakMap();
|
|
this.ids = /* @__PURE__ */ new WeakMap();
|
|
this.nextId = 1;
|
|
}
|
|
has(object) {
|
|
return this.refs.has(object);
|
|
}
|
|
get(object) {
|
|
return this.refs.get(object) || null;
|
|
}
|
|
set(object, ref) {
|
|
this.refs.set(object, ref);
|
|
}
|
|
id(object) {
|
|
let id = this.ids.get(object);
|
|
if (id) return id;
|
|
id = this.nextId++;
|
|
this.ids.set(object, id);
|
|
return id;
|
|
}
|
|
};
|
|
var InspectNode = class {
|
|
constructor(depth, length, opts) {
|
|
const { breakLength = defaultBreakLength, breakAlways = false } = opts;
|
|
this.depth = depth;
|
|
this.length = length;
|
|
this.breakLength = breakLength;
|
|
this.breakAlways = breakAlways;
|
|
}
|
|
pad(n, string) {
|
|
return string.padStart(n, " ");
|
|
}
|
|
indent(n, string) {
|
|
return " ".repeat(n) + string;
|
|
}
|
|
};
|
|
var InspectRef = class extends InspectNode {
|
|
constructor(depth, opts) {
|
|
super(depth, "[circular *]".length, opts);
|
|
this.refs = opts.references;
|
|
this.count = 0;
|
|
this.circular = false;
|
|
this.color = opts.colors && styles.special;
|
|
}
|
|
get id() {
|
|
return this.refs.id(this);
|
|
}
|
|
increment() {
|
|
return ++this.count;
|
|
}
|
|
decrement() {
|
|
return --this.count;
|
|
}
|
|
toString(opts = {}) {
|
|
const { offset = 0, pad = 0, indent = 0 } = opts;
|
|
let value = this.pad(pad, "[circular *" + this.id + "]");
|
|
if (this.color) value = this.color + value + ansiEscapes.modifierReset;
|
|
return offset ? value : this.indent(indent, value);
|
|
}
|
|
};
|
|
var InspectLeaf = class extends InspectNode {
|
|
constructor(value, color, depth, opts) {
|
|
const length = value.length;
|
|
if (value.includes("\n")) {
|
|
value = value.replaceAll("\n", "\n" + " ".repeat(depth));
|
|
opts = { ...opts, breakAlways: true };
|
|
}
|
|
super(depth, length, opts);
|
|
this.value = value;
|
|
this.color = opts.colors && color;
|
|
}
|
|
toString(opts = {}) {
|
|
const { offset = 0, pad = 0, indent = 0 } = opts;
|
|
let value = this.pad(pad, this.value);
|
|
if (this.color) value = this.color + value + ansiEscapes.modifierReset;
|
|
return offset ? value : this.indent(indent, value);
|
|
}
|
|
};
|
|
var InspectPair = class extends InspectNode {
|
|
constructor(delim, left, right, depth, opts) {
|
|
const length = left.length + delim.length + right.length;
|
|
if (left.breakAlways || right.breakAlways) {
|
|
opts = { ...opts, breakAlways: true };
|
|
}
|
|
super(depth, length, opts);
|
|
this.delim = delim;
|
|
this.left = left;
|
|
this.right = right;
|
|
}
|
|
toString(opts = {}) {
|
|
const { indent = 0 } = opts;
|
|
return this.indent(
|
|
indent,
|
|
this.left + this.delim + this.right.toString({
|
|
indent,
|
|
offset: this.left.length + this.delim.length
|
|
})
|
|
);
|
|
}
|
|
};
|
|
var InspectSuspension = class extends InspectNode {
|
|
constructor(overflow, depth, opts) {
|
|
const label = `... ${overflow} more`;
|
|
super(depth, label.length, opts);
|
|
this.label = label;
|
|
}
|
|
toString(opts = {}) {
|
|
const { indent = 0 } = opts;
|
|
return this.indent(indent, this.label);
|
|
}
|
|
};
|
|
var InspectSequence = class extends InspectNode {
|
|
constructor(header, footer, delim, values, ref, depth, opts) {
|
|
const { tabulate = false } = opts;
|
|
const length = (ref.circular ? "<ref *>".length + 1 : 0) + header.length + values.reduce((length2, value, i) => length2 + value.length + (i === 0 ? 0 : delim.length), 0) + footer.length;
|
|
if (values.some((value) => value.breakAlways)) {
|
|
opts = { ...opts, breakAlways: true };
|
|
}
|
|
super(depth, length, opts);
|
|
this.header = header;
|
|
this.footer = footer;
|
|
this.delim = delim;
|
|
this.values = values;
|
|
this.ref = ref;
|
|
this.tabulate = tabulate;
|
|
}
|
|
toString(opts = {}) {
|
|
const { offset = 0, indent = 0 } = opts;
|
|
const split = this.breakAlways || this.values.length && (offset + this.length > this.breakLength || indent * 2 + this.length > this.breakLength);
|
|
let header = this.header;
|
|
if (this.ref.circular) {
|
|
header = "<ref *" + this.ref.id + "> " + header;
|
|
}
|
|
if (this.values.length === 0) {
|
|
header = header.trimEnd();
|
|
}
|
|
if (offset === 0) {
|
|
header = this.indent(indent, header);
|
|
}
|
|
if (split) {
|
|
header = header.trimEnd() + "\n";
|
|
}
|
|
let string = header;
|
|
let columns = 1;
|
|
let pad = 0;
|
|
if (this.tabulate) {
|
|
const widest = this.values.reduce(
|
|
(length, value) => value.breakAlways ? length : Math.max(length, value.length),
|
|
0
|
|
);
|
|
if (widest) {
|
|
columns = Math.max(
|
|
columns,
|
|
Math.floor((this.breakLength - indent * 2) / (widest + this.delim.length))
|
|
);
|
|
if (columns > 1) pad = widest;
|
|
}
|
|
}
|
|
for (let i = 0, n = this.values.length, offset2 = 0; i < n; i++) {
|
|
const value = this.values[i];
|
|
if (split) {
|
|
let part;
|
|
if (i % columns === 0 || value.breakAlways) {
|
|
part = value.toString({ indent: indent + 1, pad });
|
|
} else {
|
|
part = value.toString({ pad });
|
|
}
|
|
string += part;
|
|
if (i < n - 1) {
|
|
if (i % columns === columns - 1 || this.values[i + 1].breakAlways) {
|
|
string += this.delim.trimEnd() + "\n";
|
|
} else {
|
|
string += this.delim;
|
|
}
|
|
}
|
|
} else {
|
|
if (i > 0) string += this.delim;
|
|
string += value.toString({ offset: offset2 });
|
|
offset2 += value.length;
|
|
}
|
|
}
|
|
let footer = this.footer;
|
|
if (this.values.length === 0) {
|
|
footer = footer.trimStart();
|
|
}
|
|
if (split) {
|
|
string += "\n" + this.indent(indent, footer.trimStart());
|
|
} else {
|
|
string += footer;
|
|
}
|
|
return string;
|
|
}
|
|
};
|
|
function inspectValue(value, depth, opts) {
|
|
const type = getType(value);
|
|
if (type.isUndefined()) return inspectUndefined(depth, opts);
|
|
if (type.isNull()) return inspectNull(depth, opts);
|
|
if (type.isBoolean()) return inspectBoolean(value, depth, opts);
|
|
if (type.isNumber()) return inspectNumber(value, depth, opts);
|
|
if (type.isBigInt()) return inspectBigInt(value, depth, opts);
|
|
if (type.isString()) return inspectString(value, depth, opts);
|
|
if (type.isSymbol()) return inspectSymbol(value, depth, opts);
|
|
if (type.isObject()) return inspectObject(type, value, depth, opts);
|
|
if (type.isFunction()) return inspectFunction(type, value, depth, opts);
|
|
if (type.isExternal()) return inspectExternal(value, opts, opts);
|
|
}
|
|
function inspectUndefined(depth, opts) {
|
|
return new InspectLeaf("undefined", styles.undefined, depth, opts);
|
|
}
|
|
function inspectNull(depth, opts) {
|
|
return new InspectLeaf("null", styles.null, depth, opts);
|
|
}
|
|
function inspectBoolean(value, depth, opts) {
|
|
return new InspectLeaf(value.toString(), styles.boolean, depth, opts);
|
|
}
|
|
function inspectNumber(value, depth, opts) {
|
|
let string;
|
|
if (Object.is(value, -0)) {
|
|
string = "-0";
|
|
} else {
|
|
string = value.toString(10);
|
|
}
|
|
return new InspectLeaf(string, styles.number, depth, opts);
|
|
}
|
|
function inspectBigInt(value, depth, opts) {
|
|
return new InspectLeaf(value.toString(10) + "n", styles.bigint, depth, opts);
|
|
}
|
|
var STRING_ESCAPES = /[\ud800-\udbff][\udc00-\udfff]|[\u0000-\u001f'\\\ud800-\udfff]/g;
|
|
function inspectString(value, depth, opts) {
|
|
const string = value.replace(STRING_ESCAPES, (match) => {
|
|
if (match.length === 2) return match;
|
|
switch (match) {
|
|
case "'":
|
|
return "\\'";
|
|
case "\\":
|
|
return "\\\\";
|
|
case "\b":
|
|
return "\\b";
|
|
case " ":
|
|
return "\\t";
|
|
case "\n":
|
|
return "\\n";
|
|
case "\f":
|
|
return "\\f";
|
|
case "\r":
|
|
return "\\r";
|
|
default:
|
|
return "\\u" + match.charCodeAt(0).toString(16).padStart(4, "0");
|
|
}
|
|
});
|
|
return new InspectLeaf("'" + string + "'", styles.string, depth, opts);
|
|
}
|
|
function inspectSymbol(value, depth, opts) {
|
|
return new InspectLeaf(value.toString(), styles.symbol, depth, opts);
|
|
}
|
|
var PLAIN_KEY = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
|
|
function inspectKey(value, depth, opts) {
|
|
if (typeof value === "symbol") {
|
|
return inspectValue(value, depth, opts);
|
|
} else if (PLAIN_KEY.test(value)) {
|
|
return new InspectLeaf(value, null, depth, opts);
|
|
} else {
|
|
return inspectValue(value, depth, opts);
|
|
}
|
|
}
|
|
function inspectObject(type, object, depth, opts) {
|
|
const refs = opts.references;
|
|
let ref = refs.get(object);
|
|
if (ref === null) {
|
|
ref = new InspectRef(depth, opts);
|
|
refs.set(object, ref);
|
|
} else if (ref.count) {
|
|
ref.circular = true;
|
|
return ref;
|
|
}
|
|
const maxDepth = typeof opts.depth === "number" ? opts.depth : Infinity;
|
|
if (maxDepth < depth) {
|
|
const constructor = object.constructor;
|
|
return new InspectLeaf(
|
|
"[" + (constructor && constructor.name ? constructor.name : "Object") + "]",
|
|
styles.special,
|
|
depth,
|
|
opts
|
|
);
|
|
}
|
|
const inspect = object[Symbol.for("bare.inspect")] || object[Symbol.for("nodejs.util.inspect.custom")];
|
|
if (typeof inspect === "function") {
|
|
const value = inspect.call(
|
|
object,
|
|
typeof opts.depth === "number" ? opts.depth - depth : null,
|
|
{
|
|
colors: opts.colors,
|
|
breakLength: opts.breakLength,
|
|
stylize: opts.stylize
|
|
},
|
|
exports
|
|
);
|
|
if (typeof value === "object" && value !== null) {
|
|
refs.set(value, ref);
|
|
}
|
|
if (typeof value !== "string") {
|
|
return inspectValue(value, depth, opts);
|
|
}
|
|
return new InspectLeaf(value, null, depth, opts);
|
|
}
|
|
if (type.isArray()) return inspectArray(object, ref, depth, opts);
|
|
if (type.isDate()) return inspectDate(object, ref, depth, opts);
|
|
if (type.isRegExp()) return inspectRegExp(object, ref, depth, opts);
|
|
if (type.isError()) return inspectError(object, ref, depth, opts);
|
|
if (type.isPromise()) return inspectPromise(object, ref, depth, opts);
|
|
if (type.isMap()) return inspectMap(object, ref, depth, opts);
|
|
if (type.isSet()) return inspectSet(object, ref, depth, opts);
|
|
if (type.isWeakMap()) return inspectWeakMap(object, ref, depth, opts);
|
|
if (type.isWeakSet()) return inspectWeakSet(object, ref, depth, opts);
|
|
if (type.isWeakRef()) return inspectWeakRef(object, ref, depth, opts);
|
|
if (type.isArrayBuffer()) return inspectArrayBuffer(object, ref, depth, opts);
|
|
if (type.isSharedArrayBuffer()) return inspectSharedArrayBuffer(object, ref, depth, opts);
|
|
if (type.isTypedArray()) return inspectTypedArray(object, ref, depth, opts);
|
|
if (type.isDataView()) return inspectDataView(object, ref, depth, opts);
|
|
ref.increment();
|
|
const values = [];
|
|
for (const key in object) {
|
|
if (key === "constructor") continue;
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(object[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
for (const key of Object.getOwnPropertySymbols(object)) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(object[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
let header = "{ ";
|
|
const tag = object[Symbol.toStringTag];
|
|
if (tag) header = "[" + tag + "] " + header;
|
|
if (object.constructor) {
|
|
const name = object.constructor.name;
|
|
if (name && name !== "Object") {
|
|
header = object.constructor.name + " " + header;
|
|
}
|
|
}
|
|
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
|
|
}
|
|
function inspectArray(array, ref, depth, opts) {
|
|
const { maxArrayLength = defaultMaxArrayLength } = opts;
|
|
ref.increment();
|
|
const values = [];
|
|
let remaining = Math.max(maxArrayLength, 0);
|
|
for (let i = 0, n = array.length; i < n; i++) {
|
|
if (remaining-- === 0) {
|
|
values.push(
|
|
new InspectSuspension(array.length - values.length, depth + 1, {
|
|
...opts,
|
|
breakAlways: true
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
values.push(inspectValue(array[i], depth + 1, opts));
|
|
}
|
|
for (const key of binding.getOwnNonIndexPropertyNames(array)) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(array[key], depth + 1, opts),
|
|
depth + 1,
|
|
{ ...opts, breakAlways: remaining < 0 }
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
let header = "[ ";
|
|
if (array.constructor.name !== "Array") {
|
|
header = array.constructor.name + "(" + array.length + ") " + header;
|
|
}
|
|
return new InspectSequence(header, " ]", ", ", values, ref, depth, {
|
|
...opts,
|
|
tabulate: true
|
|
});
|
|
}
|
|
function inspectDate(date, ref, depth, opts) {
|
|
return new InspectLeaf(date.toISOString(), styles.date, depth, opts);
|
|
}
|
|
function inspectRegExp(regExp, ref, depth, opts) {
|
|
return new InspectLeaf(regExp.toString(), styles.regexp, depth, opts);
|
|
}
|
|
function inspectError(error, ref, depth, opts) {
|
|
let header;
|
|
if ("stack" in error) {
|
|
header = error.stack;
|
|
if (depth > 0) {
|
|
header = header.replaceAll("\n", "\n" + " ".repeat(depth));
|
|
}
|
|
} else {
|
|
header = error.toString();
|
|
}
|
|
const builtins = ["cause"];
|
|
if (error.name === "AggregateError") {
|
|
builtins.push("errors");
|
|
} else if (error.name === "SuppressedError") {
|
|
builtins.push("error", "suppressed");
|
|
}
|
|
const values = [];
|
|
for (const key of builtins) {
|
|
if (key in error === false) continue;
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
new InspectLeaf("[" + key + "]", null, depth + 1, opts),
|
|
inspectValue(error[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
for (const key in error) {
|
|
if (key === "constructor" || builtins.includes(key)) continue;
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(error[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
if (values.length === 0) return new InspectLeaf(header, null, depth, opts);
|
|
return new InspectSequence(header + " {", " }", ", ", values, ref, depth, opts);
|
|
}
|
|
function inspectPromise(promise, ref, depth, opts) {
|
|
ref.increment();
|
|
const state = binding.getPromiseState(promise);
|
|
const values = [];
|
|
switch (state) {
|
|
case 0:
|
|
values.push(new InspectLeaf("<pending>", styles.special, depth, opts));
|
|
break;
|
|
case 1:
|
|
values.push(inspectValue(binding.getPromiseResult(promise), depth, opts));
|
|
break;
|
|
case 2:
|
|
values.push(
|
|
new InspectLeaf("<rejected>", styles.special, depth, opts),
|
|
inspectValue(binding.getPromiseResult(promise), depth, opts)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = promise.constructor.name + " { ";
|
|
return new InspectSequence(header, " }", " ", values, ref, depth, opts);
|
|
}
|
|
function inspectMap(map, ref, depth, opts) {
|
|
const { maxArrayLength = defaultMaxArrayLength, maxMapLength = maxArrayLength } = opts;
|
|
ref.increment();
|
|
const values = [];
|
|
let remaining = maxMapLength;
|
|
for (const entry of map) {
|
|
if (remaining-- === 0) {
|
|
values.push(
|
|
new InspectSuspension(map.size - values.length, depth + 1, {
|
|
...opts,
|
|
breakAlways: true
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
values.push(
|
|
new InspectPair(
|
|
" => ",
|
|
inspectValue(entry[0], depth + 1, opts),
|
|
inspectValue(entry[1], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
for (const key in map) {
|
|
if (key === "constructor") continue;
|
|
const value = inspectValue(map[key], depth + 1, opts);
|
|
values.push(
|
|
new InspectPair(": ", inspectKey(key, depth + 1, opts), value, depth + 1, {
|
|
...opts,
|
|
breakAlways: remaining < 0
|
|
})
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = map.constructor.name + "(" + map.size + ") { ";
|
|
return new InspectSequence(header, " }", ", ", values, ref, depth, {
|
|
...opts,
|
|
tabulate: true
|
|
});
|
|
}
|
|
function inspectSet(set, ref, depth, opts) {
|
|
const { maxArrayLength = defaultMaxArrayLength, maxSetLength = maxArrayLength } = opts;
|
|
ref.increment();
|
|
const values = [];
|
|
let remaining = maxSetLength;
|
|
for (const entry of set) {
|
|
if (remaining-- === 0) {
|
|
values.push(
|
|
new InspectSuspension(set.size - values.length, depth + 1, {
|
|
...opts,
|
|
breakAlways: true
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
values.push(inspectValue(entry, depth + 1, opts));
|
|
}
|
|
for (const key in set) {
|
|
if (key === "constructor") continue;
|
|
const value = inspectValue(set[key], depth + 1, opts);
|
|
values.push(
|
|
new InspectPair(": ", inspectKey(key, depth + 1, opts), value, depth + 1, {
|
|
...opts,
|
|
breakAlways: remaining < 0
|
|
})
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = set.constructor.name + "(" + set.size + ") { ";
|
|
return new InspectSequence(header, " }", ", ", values, ref, depth, {
|
|
...opts,
|
|
tabulate: true
|
|
});
|
|
}
|
|
function inspectWeakMap(weakMap, ref, depth, opts) {
|
|
const header = weakMap.constructor.name + " { ";
|
|
return new InspectSequence(
|
|
header,
|
|
" }",
|
|
" ",
|
|
[new InspectLeaf("<items unknown>", styles.special, depth + 1, opts)],
|
|
ref,
|
|
depth,
|
|
opts
|
|
);
|
|
}
|
|
function inspectWeakSet(weakSet, ref, depth, opts) {
|
|
const header = weakSet.constructor.name + " { ";
|
|
return new InspectSequence(
|
|
header,
|
|
" }",
|
|
" ",
|
|
[new InspectLeaf("<items unknown>", styles.special, depth + 1, opts)],
|
|
ref,
|
|
depth,
|
|
opts
|
|
);
|
|
}
|
|
function inspectWeakRef(weakRef, ref, depth, opts) {
|
|
const target = weakRef.deref();
|
|
let value;
|
|
if (target === void 0) {
|
|
value = new InspectLeaf("<cleared>", styles.special, depth + 1, opts);
|
|
} else {
|
|
value = inspectValue(target, depth + 1, opts);
|
|
}
|
|
const header = weakRef.constructor.name + " { ";
|
|
return new InspectSequence(header, " }", " ", [value], ref, depth, opts);
|
|
}
|
|
function inspectArrayBuffer(arrayBuffer, ref, depth, opts) {
|
|
ref.increment();
|
|
const values = [];
|
|
for (const key of ["byteLength"]) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(arrayBuffer[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = arrayBuffer.constructor.name + " { ";
|
|
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
|
|
}
|
|
function inspectSharedArrayBuffer(sharedArrayBuffer, ref, depth, opts) {
|
|
ref.increment();
|
|
const values = [];
|
|
for (const key of ["byteLength"]) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(sharedArrayBuffer[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = sharedArrayBuffer.constructor.name + " { ";
|
|
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
|
|
}
|
|
function inspectTypedArray(typedArray, ref, depth, opts) {
|
|
if (Buffer.isBuffer(typedArray)) {
|
|
return inspectBuffer(typedArray, ref, depth, opts);
|
|
}
|
|
const { maxArrayLength = defaultMaxArrayLength, maxTypedArrayLength = maxArrayLength } = opts;
|
|
ref.increment();
|
|
const values = [];
|
|
let remaining = Math.max(maxTypedArrayLength, 0);
|
|
for (let i = 0, n = typedArray.length; i < n; i++) {
|
|
if (remaining-- === 0) {
|
|
values.push(
|
|
new InspectSuspension(typedArray.length - values.length, depth + 1, {
|
|
...opts,
|
|
breakAlways: true
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
values.push(inspectValue(typedArray[i], depth + 1, opts));
|
|
}
|
|
for (const key of binding.getOwnNonIndexPropertyNames(typedArray)) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(typedArray[key], depth + 1, opts),
|
|
depth + 1,
|
|
{ ...opts, breakAlways: remaining < 0 }
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = typedArray.constructor.name + "(" + typedArray.length + ") [ ";
|
|
return new InspectSequence(header, " ]", ", ", values, ref, depth, {
|
|
...opts,
|
|
tabulate: true
|
|
});
|
|
}
|
|
function inspectBuffer(buffer, ref, depth, opts) {
|
|
const { maxArrayLength = defaultMaxArrayLength, maxBufferLength = maxArrayLength } = opts;
|
|
ref.increment();
|
|
const values = [];
|
|
let remaining = Math.max(maxBufferLength, 0);
|
|
for (let i = 0, n = buffer.byteLength; i < n; i++) {
|
|
if (remaining-- === 0) {
|
|
values.push(
|
|
new InspectSuspension(buffer.length - values.length, depth + 1, {
|
|
...opts,
|
|
breakAlways: true
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
values.push(new InspectLeaf(buffer[i].toString(16).padStart(2, "0"), null, depth + 1, opts));
|
|
}
|
|
for (const key of binding.getOwnNonIndexPropertyNames(buffer)) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(buffer[key], depth + 1, opts),
|
|
depth + 1,
|
|
{ ...opts, breakAlways: remaining < 0 }
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
return new InspectSequence("<Buffer ", ">", " ", values, ref, depth, {
|
|
...opts,
|
|
tabulate: true
|
|
});
|
|
}
|
|
function inspectDataView(dataView, ref, depth, opts) {
|
|
ref.increment();
|
|
const values = [];
|
|
for (const key of ["byteLength", "byteOffset", "buffer"]) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(dataView[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
for (const key of binding.getOwnNonIndexPropertyNames(dataView)) {
|
|
values.push(
|
|
new InspectPair(
|
|
": ",
|
|
inspectKey(key, depth + 1, opts),
|
|
inspectValue(dataView[key], depth + 1, opts),
|
|
depth + 1,
|
|
opts
|
|
)
|
|
);
|
|
}
|
|
ref.decrement();
|
|
const header = dataView.constructor.name + " { ";
|
|
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
|
|
}
|
|
function inspectFunction(type, fn, depth, opts) {
|
|
if (fn.toString().startsWith("class")) return inspectClass(fn, depth, opts);
|
|
let tag = "function";
|
|
if (type.isGeneratorFunction()) tag = "generator " + tag;
|
|
if (type.isAsyncFunction()) tag = "async " + tag;
|
|
return new InspectLeaf(
|
|
"[" + tag + " " + (fn.name ? fn.name : "(anonymous)") + "]",
|
|
styles.special,
|
|
depth,
|
|
opts
|
|
);
|
|
}
|
|
function inspectClass(ctor, depth, opts) {
|
|
return new InspectLeaf(
|
|
"[class " + (ctor.name ? ctor.name : "(anonymous)") + "]",
|
|
styles.special,
|
|
depth,
|
|
opts
|
|
);
|
|
}
|
|
function inspectExternal(external, depth, opts) {
|
|
return new InspectLeaf(
|
|
"[external 0x" + binding.getExternal(external).toString(16) + "]",
|
|
styles.special,
|
|
depth,
|
|
opts
|
|
);
|
|
}
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-assert/index.js
|
|
var require_bare_assert = __commonJS({
|
|
"../../node_modules/bare-assert/index.js"(exports, module) {
|
|
var inspect = require_bare_inspect();
|
|
var AssertionError = class extends Error {
|
|
constructor(opts = {}) {
|
|
let { message = null, actual, expected, operator } = opts;
|
|
if (message === null) {
|
|
message = `${inspect(actual)} ${operator} ${inspect(expected)}`;
|
|
}
|
|
super(message);
|
|
this.actual = actual;
|
|
this.expected = expected;
|
|
this.operator = operator;
|
|
}
|
|
get name() {
|
|
return "AssertionError";
|
|
}
|
|
get code() {
|
|
"ASSERTION";
|
|
}
|
|
};
|
|
function assertFail(opts, fn) {
|
|
if (opts.message instanceof Error) throw opts.message;
|
|
const err = new AssertionError(opts);
|
|
if (Error.captureStackTrace) Error.captureStackTrace(err, fn);
|
|
throw err;
|
|
}
|
|
module.exports = exports = function assert(actual, message) {
|
|
if (actual) return;
|
|
assertFail({ message, actual, expected: true, operator: "==" }, assert);
|
|
};
|
|
exports.AssertionError = AssertionError;
|
|
exports.fail = function fail(message) {
|
|
if (message === void 0) message = "Failed";
|
|
assertFail({ message, operator: "fail" }, fail);
|
|
};
|
|
exports.ok = function ok(actual, message) {
|
|
if (actual) return;
|
|
assertFail({ message, actual, expected: true, operator: "==" }, ok);
|
|
};
|
|
exports.notOk = function ok(actual, message) {
|
|
if (!actual) return;
|
|
assertFail({ message, actual, expected: false, operator: "==" }, ok);
|
|
};
|
|
exports.equal = function equal(actual, expected, message) {
|
|
if (actual == expected || actual !== actual && expected !== expected) {
|
|
return;
|
|
}
|
|
assertFail({ message, actual, expected, operator: "==" }, equal);
|
|
};
|
|
exports.notEqual = function notEqual(actual, expected, message) {
|
|
if (actual != expected && (actual === actual || expected === expected)) {
|
|
return;
|
|
}
|
|
assertFail({ message, actual, expected, operator: "!=" }, notEqual);
|
|
};
|
|
exports.strictEqual = function strictEqual(actual, expected, message) {
|
|
if (Object.is(actual, expected)) return;
|
|
assertFail(
|
|
{ message, actual, expected, operator: "strictEqual" },
|
|
strictEqual
|
|
);
|
|
};
|
|
exports.notStrictEqual = function notStrictEqual(actual, expected, message) {
|
|
if (!Object.is(actual, expected)) return;
|
|
assertFail(
|
|
{ message, actual, expected, operator: "notStrictEqual" },
|
|
notStrictEqual
|
|
);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/binding/bare.js
|
|
var require_bare = __commonJS({
|
|
"../../node_modules/bare-lief/lib/binding/bare.js"(exports, module) {
|
|
module.exports = __require.addon("../..");
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/load-command.js
|
|
var require_load_command = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/load-command.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class MachOLoadCommand {
|
|
constructor(opts = {}) {
|
|
const { handle } = opts;
|
|
this._handle = handle;
|
|
}
|
|
get data() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.machOLoadCommandGetData(this._handle).buffer);
|
|
}
|
|
set data(value) {
|
|
assert(this._handle);
|
|
assert(ArrayBuffer.isView(value));
|
|
binding.machOLoadCommandSetData(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachOLoadCommand },
|
|
data: this.data
|
|
};
|
|
}
|
|
};
|
|
exports.TYPE = {
|
|
ID_DYLIB: binding.MACHO_LOAD_COMMAND_TYPE_ID_DYLIB,
|
|
RPATH: binding.MACHO_LOAD_COMMAND_TYPE_RPATH
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/dylib-command.js
|
|
var require_dylib_command = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/dylib-command.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var MachOLoadCommand = require_load_command();
|
|
module.exports = class MachODylibCommand extends MachOLoadCommand {
|
|
get name() {
|
|
assert(this._handle);
|
|
return binding.machODylibCommandGetName(this._handle);
|
|
}
|
|
set name(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "string");
|
|
binding.machODylibCommandSetName(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachODylibCommand },
|
|
data: this.data,
|
|
name: this.name
|
|
};
|
|
}
|
|
static id(name, opts = {}) {
|
|
assert.equal(typeof name, "string");
|
|
const { timestamp = 0, currentVersion = 0, compatibilityVersion = 0 } = opts;
|
|
assert.equal(typeof timestamp, "number");
|
|
assert.equal(typeof currentVersion, "number");
|
|
assert.equal(typeof compatibilityVersion, "number");
|
|
return new MachODylibCommand({
|
|
handle: binding.machODylibCommandCreateID(
|
|
name,
|
|
timestamp,
|
|
currentVersion,
|
|
compatibilityVersion
|
|
)
|
|
});
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/rpath-command.js
|
|
var require_rpath_command = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/rpath-command.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var MachOLoadCommand = require_load_command();
|
|
module.exports = class MachORPathCommand extends MachOLoadCommand {
|
|
constructor(path, opts = {}) {
|
|
if (typeof path === "object" && path !== null) {
|
|
opts = path;
|
|
path = null;
|
|
}
|
|
const { handle = binding.machORPathCommandCreate(path) } = opts;
|
|
super({ handle });
|
|
}
|
|
get path() {
|
|
assert(this._handle);
|
|
return binding.machORPathCommandGetPath(this._handle);
|
|
}
|
|
set path(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "string");
|
|
binding.machORPathCommandSetPath(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachORPathCommand },
|
|
data: this.data,
|
|
path: this.path
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/section.js
|
|
var require_section = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/section.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = class MachOSection {
|
|
constructor(name, content = null, opts = {}) {
|
|
const { handle } = opts;
|
|
assert.equal(typeof name, "string");
|
|
this._name = name;
|
|
if (handle) {
|
|
this._handle = handle;
|
|
} else {
|
|
assert(ArrayBuffer.isView(content));
|
|
this._handle = binding.machOSectionCreate(name, content);
|
|
}
|
|
}
|
|
get content() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.machOSectionGetContent(this._handle));
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachOSection },
|
|
name: this._name
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/binary.js
|
|
var require_binary = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/binary.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var MachODylibCommand = require_dylib_command();
|
|
var MachOLoadCommand = require_load_command();
|
|
var MachORPathCommand = require_rpath_command();
|
|
var MachOSection = require_section();
|
|
module.exports = class MachOBinary {
|
|
constructor(opts = {}) {
|
|
const { handle } = opts;
|
|
this._handle = handle;
|
|
}
|
|
get libraries() {
|
|
assert(this._handle);
|
|
return new MachOLibraryIterator(binding.machOBinaryGetLibraries(this, this._handle));
|
|
}
|
|
addSegmentCommand(command) {
|
|
assert(this._handle);
|
|
assert(command._handle);
|
|
binding.machOBinaryAddSegmentCommand(this, this._handle, command._handle);
|
|
}
|
|
getSection(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.machOBinaryGetSection(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new MachOSection(name, null, { handle });
|
|
}
|
|
getLoadCommand(type) {
|
|
assert(this._handle);
|
|
assert.equal(typeof type, "number");
|
|
const handle = binding.machOBinaryGetLoadCommand(this, this._handle, type);
|
|
if (handle === void 0) return null;
|
|
switch (type) {
|
|
case MachOLoadCommand.TYPE.ID_DYLIB:
|
|
return new MachODylibCommand({ handle });
|
|
case MachOLoadCommand.TYPE.RPATH:
|
|
return new MachORPathCommand({ handle });
|
|
default:
|
|
return new MachOLoadCommand({ handle });
|
|
}
|
|
}
|
|
addLoadCommand(command) {
|
|
assert(this._handle);
|
|
assert(command._handle);
|
|
const handle = binding.machOBinaryAddLoadCommand(this, this._handle, command._handle);
|
|
if (handle === void 0) return null;
|
|
return new MachOLoadCommand({ handle });
|
|
}
|
|
hasLoadCommand(type) {
|
|
assert(this._handle);
|
|
assert.equal(typeof type, "number");
|
|
return binding.machOBinaryHasLoadCommand(this._handle, type);
|
|
}
|
|
removeLoadCommand(command) {
|
|
assert(this._handle);
|
|
assert(command._handle);
|
|
return binding.machOBinaryRemoveLoadCommand(this._handle, command._handle);
|
|
}
|
|
removeAllLoadCommands(type) {
|
|
assert(this._handle);
|
|
assert.equal(typeof type, "number");
|
|
return binding.machOBinaryRemoveAllLoadCommands(this._handle, type);
|
|
}
|
|
addDylibCommand(command) {
|
|
assert(this._handle);
|
|
assert(command._handle);
|
|
const handle = binding.machOBinaryAddDylibCommand(this, this._handle, command._handle);
|
|
if (handle === void 0) return null;
|
|
return new MachODylibCommand({ handle });
|
|
}
|
|
findLibrary(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.machOBinaryFindLibrary(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new MachODylibCommand({ handle });
|
|
}
|
|
addLibrary(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
binding.machOBinaryAddLibrary(this._handle, name);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachOBinary }
|
|
};
|
|
}
|
|
};
|
|
var MachOLibraryIterator = class _MachOLibraryIterator {
|
|
constructor(handles) {
|
|
this._handles = handles;
|
|
}
|
|
*[Symbol.iterator]() {
|
|
for (const handle of this._handles) {
|
|
yield new MachODylibCommand({ handle });
|
|
}
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: _MachOLibraryIterator }
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/fat-binary.js
|
|
var require_fat_binary = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/fat-binary.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var MachOBinary = require_binary();
|
|
module.exports = class MachOFatBinary {
|
|
constructor(binaries, opts = {}) {
|
|
if (typeof binaries === "object" && binaries !== null && !Array.isArray(binaries)) {
|
|
opts = binaries;
|
|
binaries = null;
|
|
}
|
|
const { handle = binding.machOFatBinaryCreate(binaries.map(takeBinaries)) } = opts;
|
|
this._binaries = [];
|
|
this._handle = handle;
|
|
for (let i = 0, n = binding.machOFatBinaryGetSize(this._handle); i < n; i++) {
|
|
this._binaries.push(
|
|
new MachOBinary({ handle: binding.machOFatBinaryGetAt(this, this._handle, i) })
|
|
);
|
|
}
|
|
}
|
|
get size() {
|
|
return this._binaries.length;
|
|
}
|
|
at(i) {
|
|
assert.equal(typeof i, "number");
|
|
return this._binaries.at(i);
|
|
}
|
|
toDisk(path) {
|
|
assert(this._handle);
|
|
assert.equal(typeof path, "string");
|
|
binding.machOFatBinaryWrite(this._handle, path);
|
|
}
|
|
toBuffer() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.machOFatBinaryGetRaw(this._handle));
|
|
}
|
|
[Symbol.iterator]() {
|
|
return this._binaries[Symbol.iterator]();
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachOFatBinary },
|
|
binaries: this._binaries
|
|
};
|
|
}
|
|
static parse(input) {
|
|
assert(ArrayBuffer.isView(input));
|
|
return new MachOFatBinary({
|
|
handle: binding.machOFatBinaryParse(input)
|
|
});
|
|
}
|
|
static merge(binaries) {
|
|
assert(Array.isArray(binaries));
|
|
return new MachOFatBinary({
|
|
handle: binding.machOFatBinaryMerge(binaries.map(takeFatBinaries))
|
|
});
|
|
}
|
|
};
|
|
function takeBinaries(binary) {
|
|
assert(binary._handle);
|
|
const handle = binary._handle;
|
|
binary._handle = null;
|
|
return handle;
|
|
}
|
|
function takeFatBinaries(binary) {
|
|
assert(binary._handle);
|
|
const handle = binary._handle;
|
|
binary._handle = null;
|
|
binary._binaries = [];
|
|
return handle;
|
|
}
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho/segment-command.js
|
|
var require_segment_command = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho/segment-command.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class MachOSegmentCommand {
|
|
constructor(name) {
|
|
assert.equal(typeof name, "string");
|
|
this._name = name;
|
|
this._handle = binding.machOSegmentCommandCreate(this._name);
|
|
}
|
|
get maxProtection() {
|
|
assert(this._handle);
|
|
return binding.machOSegmentCommandGetMaxProtection(this._handle);
|
|
}
|
|
set maxProtection(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.machOSegmentCommandSetMaxProtection(this._handle, value);
|
|
}
|
|
get initialProtection() {
|
|
assert(this._handle);
|
|
return binding.machOSegmentCommandGetInitialProtection(this._handle);
|
|
}
|
|
set initialProtection(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.machOSegmentCommandSetInitialProtection(this._handle, value);
|
|
}
|
|
addSection(section) {
|
|
assert(this._handle);
|
|
assert(section._handle);
|
|
binding.machOSegmentCommandAddSection(this._handle, section._handle);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: MachOSegmentCommand },
|
|
name: this._name
|
|
};
|
|
}
|
|
};
|
|
exports.VM_PROTECTIONS = {
|
|
READ: binding.MACHO_SEGMENT_COMMAND_VM_PROTECTIONS_READ,
|
|
WRITE: binding.MACHO_SEGMENT_COMMAND_VM_PROTECTIONS_WRITE,
|
|
EXECUTE: binding.MACHO_SEGMENT_COMMAND_VM_PROTECTIONS_EXECUTE
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/macho.js
|
|
var require_macho = __commonJS({
|
|
"../../node_modules/bare-lief/lib/macho.js"(exports) {
|
|
exports.Binary = require_binary();
|
|
exports.FatBinary = require_fat_binary();
|
|
exports.Section = require_section();
|
|
exports.SegmentCommand = require_segment_command();
|
|
exports.LoadCommand = require_load_command();
|
|
exports.DylibCommand = require_dylib_command();
|
|
exports.RPathCommand = require_rpath_command();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/elf/dynamic-entry.js
|
|
var require_dynamic_entry = __commonJS({
|
|
"../../node_modules/bare-lief/lib/elf/dynamic-entry.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var ELFDynamicEntry = class _ELFDynamicEntry {
|
|
constructor(opts = {}) {
|
|
const { handle } = opts;
|
|
this._handle = handle;
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: _ELFDynamicEntry }
|
|
};
|
|
}
|
|
};
|
|
module.exports = exports = ELFDynamicEntry;
|
|
exports.TAG = {
|
|
NEEDED: binding.ELF_DYNAMIC_ENTRY_TAG_NEEDED,
|
|
SONAME: binding.ELF_DYNAMIC_ENTRY_TAG_SONAME,
|
|
RUNPATH: binding.ELF_DYNAMIC_ENTRY_TAG_RUNPATH
|
|
};
|
|
exports.SharedObject = class ELFDynamicSharedObject extends ELFDynamicEntry {
|
|
constructor(name, opts = {}) {
|
|
if (typeof name === "object" && name !== null) {
|
|
opts = name;
|
|
name = null;
|
|
}
|
|
const { handle = binding.elfDynamicSharedObjectCreate(name) } = opts;
|
|
super({ handle });
|
|
}
|
|
get name() {
|
|
assert(this._handle);
|
|
return binding.elfDynamicSharedObjectGetName(this._handle);
|
|
}
|
|
set name(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "string");
|
|
binding.elfDynamicSharedObjectSetName(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFDynamicSharedObject },
|
|
name: this.name
|
|
};
|
|
}
|
|
};
|
|
exports.Library = class ELFDynamicEntryLibrary extends ELFDynamicEntry {
|
|
constructor(name, opts = {}) {
|
|
if (typeof name === "object" && name !== null) {
|
|
opts = name;
|
|
name = null;
|
|
}
|
|
const { handle = binding.elfDynamicEntryLibraryCreate(name) } = opts;
|
|
super({ handle });
|
|
}
|
|
get name() {
|
|
assert(this._handle);
|
|
return binding.elfDynamicEntryLibraryGetName(this._handle);
|
|
}
|
|
set name(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "string");
|
|
binding.elfDynamicEntryLibrarySetName(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFDynamicEntryLibrary },
|
|
name: this.name
|
|
};
|
|
}
|
|
};
|
|
exports.RunPath = class ELFDynamicEntryRunPath extends ELFDynamicEntry {
|
|
constructor(path, opts = {}) {
|
|
if (typeof path === "object" && path !== null) {
|
|
opts = path;
|
|
path = null;
|
|
}
|
|
const { handle = binding.elfDynamicEntryRunPathCreate(path) } = opts;
|
|
super({ handle });
|
|
}
|
|
get runpath() {
|
|
assert(this._handle);
|
|
return binding.elfDynamicEntryRunPathGetRunPath(this._handle);
|
|
}
|
|
set runpath(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "string");
|
|
binding.elfDynamicEntryRunPathSetRunPath(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFDynamicEntryRunPath },
|
|
runpath: this.runpath
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/elf/section.js
|
|
var require_section2 = __commonJS({
|
|
"../../node_modules/bare-lief/lib/elf/section.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class ELFSection {
|
|
constructor(name, opts = {}) {
|
|
if (typeof name === "object" && name !== null) {
|
|
opts = name;
|
|
name = null;
|
|
}
|
|
const { handle = binding.elfSectionCreate(name) } = opts;
|
|
this._handle = handle;
|
|
}
|
|
get type() {
|
|
assert(this._handle);
|
|
return binding.elfSectionGetType(this._handle);
|
|
}
|
|
set type(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSectionSetType(this._handle, value);
|
|
}
|
|
get flags() {
|
|
assert(this._handle);
|
|
return binding.elfSectionGetFlags(this._handle);
|
|
}
|
|
set flags(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSectionSetFlags(this._handle, value);
|
|
}
|
|
get alignment() {
|
|
assert(this._handle);
|
|
return binding.elfSectionGetAlignment(this._handle);
|
|
}
|
|
set alignment(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSectionSetAlignment(this._handle, value);
|
|
}
|
|
get content() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.elfSectionGetContent(this._handle));
|
|
}
|
|
set content(value) {
|
|
assert(this._handle);
|
|
assert(ArrayBuffer.isView(value));
|
|
binding.elfSectionSetContent(this._handle, value);
|
|
}
|
|
get size() {
|
|
assert(this._handle);
|
|
return binding.elfSectionGetSize(this._handle);
|
|
}
|
|
set size(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSectionSetSize(this._handle, value);
|
|
}
|
|
get virtualAddress() {
|
|
assert(this._handle);
|
|
return binding.elfSectionGetVirtualAddress(this._handle);
|
|
}
|
|
set virtualAddress(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSectionSetVirtualAddress(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFSection },
|
|
type: this.type,
|
|
flags: this.flags,
|
|
alignment: this.alignment,
|
|
content: this.content,
|
|
size: this.size,
|
|
virtualAddress: this.virtualAddress
|
|
};
|
|
}
|
|
};
|
|
exports.FLAGS = {
|
|
WRITE: binding.ELF_SECTION_FLAGS_WRITE,
|
|
ALLOC: binding.ELF_SECTION_FLAGS_ALLOC,
|
|
EXECINSTR: binding.ELF_SECTION_FLAGS_EXECINSTR
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/elf/symbol.js
|
|
var require_symbol = __commonJS({
|
|
"../../node_modules/bare-lief/lib/elf/symbol.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class ELFSymbol {
|
|
constructor(name, opts = {}) {
|
|
if (typeof name === "object" && name !== null) {
|
|
opts = name;
|
|
name = null;
|
|
}
|
|
const { handle = binding.elfSymbolCreate(name) } = opts;
|
|
this._handle = handle;
|
|
}
|
|
get type() {
|
|
assert(this._handle);
|
|
return binding.elfSymbolGetType(this._handle);
|
|
}
|
|
set type(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSymbolSetType(this._handle, value);
|
|
}
|
|
get name() {
|
|
assert(this._handle);
|
|
return binding.elfSymbolGetName(this._handle);
|
|
}
|
|
set name(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "string");
|
|
binding.elfSymbolSetName(this._handle, value);
|
|
}
|
|
get value() {
|
|
assert(this._handle);
|
|
return binding.elfSymbolGetValue(this._handle);
|
|
}
|
|
set value(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSymbolSetValue(this._handle, value);
|
|
}
|
|
get binding() {
|
|
assert(this._handle);
|
|
return binding.elfSymbolGetBinding(this._handle);
|
|
}
|
|
set binding(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSymbolSetBinding(this._handle, value);
|
|
}
|
|
get sectionIndex() {
|
|
assert(this._handle);
|
|
return binding.elfSymbolGetSectionIndex(this._handle);
|
|
}
|
|
set sectionIndex(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSymbolSetSectionIndex(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFSymbol },
|
|
name: this.name,
|
|
value: this.value,
|
|
binding: this.binding,
|
|
sectionIndex: this.sectionIndex
|
|
};
|
|
}
|
|
};
|
|
exports.TYPE = {
|
|
OBJECT: binding.ELF_SYMBOL_TYPE_OBJECT,
|
|
FUNC: binding.ELF_SYMBOL_TYPE_FUNC,
|
|
SECTION: binding.ELF_SYMBOL_TYPE_SECTION,
|
|
FILE: binding.ELF_SYMBOL_TYPE_FILE,
|
|
COMMON: binding.ELF_SYMBOL_TYPE_COMMON,
|
|
TLS: binding.ELF_SYMBOL_TYPE_TLS
|
|
};
|
|
exports.BINDING = {
|
|
LOCAL: binding.ELF_SYMBOL_BINDING_LOCAL,
|
|
GLOBAL: binding.ELF_SYMBOL_BINDING_GLOBAL,
|
|
WEAK: binding.ELF_SYMBOL_BINDING_WEAK
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/elf/segment.js
|
|
var require_segment = __commonJS({
|
|
"../../node_modules/bare-lief/lib/elf/segment.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class ELFSegment {
|
|
constructor(opts = {}) {
|
|
const { handle = binding.elfSegmentCreate() } = opts;
|
|
this._handle = handle;
|
|
}
|
|
get type() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetType(this._handle);
|
|
}
|
|
set type(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetType(this._handle, value);
|
|
}
|
|
get flags() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetFlags(this._handle);
|
|
}
|
|
set flags(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetFlags(this._handle, value);
|
|
}
|
|
get alignment() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetAlignment(this._handle);
|
|
}
|
|
set alignment(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetAlignment(this._handle, value);
|
|
}
|
|
get content() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.elfSegmentGetContent(this._handle));
|
|
}
|
|
set content(value) {
|
|
assert(this._handle);
|
|
assert(ArrayBuffer.isView(value));
|
|
binding.elfSegmentSetContent(this._handle, value);
|
|
}
|
|
get virtualSize() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetVirtualSize(this._handle);
|
|
}
|
|
set virtualSize(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetVirtualSize(this._handle, value);
|
|
}
|
|
get physicalSize() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetPhysicalSize(this._handle);
|
|
}
|
|
set physicalSize(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetPhysicalSize(this._handle, value);
|
|
}
|
|
get virtualAddress() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetVirtualAddress(this._handle);
|
|
}
|
|
set virtualAddress(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetVirtualAddress(this._handle, value);
|
|
}
|
|
get physicalAddress() {
|
|
assert(this._handle);
|
|
return binding.elfSegmentGetPhysicalAddress(this._handle);
|
|
}
|
|
set physicalAddress(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.elfSegmentSetPhysicalAddress(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFSegment },
|
|
type: this.type,
|
|
flags: this.flags
|
|
};
|
|
}
|
|
};
|
|
exports.TYPE = {
|
|
LOAD: binding.ELF_SEGMENT_TYPE_LOAD
|
|
};
|
|
exports.FLAGS = {
|
|
X: binding.ELF_SEGMENT_FLAGS_X,
|
|
W: binding.ELF_SEGMENT_FLAGS_W,
|
|
R: binding.ELF_SEGMENT_FLAGS_R
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/elf/binary.js
|
|
var require_binary2 = __commonJS({
|
|
"../../node_modules/bare-lief/lib/elf/binary.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var ELFDynamicEntry = require_dynamic_entry();
|
|
var ELFSection = require_section2();
|
|
var ELFSymbol = require_symbol();
|
|
var ELFSegment = require_segment();
|
|
var { TAG } = ELFDynamicEntry;
|
|
module.exports = exports = class ELFBinary {
|
|
constructor(opts = {}) {
|
|
const { handle = null } = opts;
|
|
this._handle = handle;
|
|
}
|
|
addSegment(segment, base = 0) {
|
|
assert(this._handle);
|
|
assert(segment._handle);
|
|
assert.equal(typeof base, "number");
|
|
const handle = binding.elfBinaryAddSegment(this, this._handle, segment._handle, base);
|
|
if (handle === void 0) return null;
|
|
return new ELFSegment({ handle });
|
|
}
|
|
addSection(section, loaded = true, position = 0) {
|
|
assert(this._handle);
|
|
assert(section._handle);
|
|
assert.equal(typeof loaded, "boolean");
|
|
assert.equal(typeof position, "number");
|
|
const handle = binding.elfBinaryAddSection(
|
|
this,
|
|
this._handle,
|
|
section._handle,
|
|
loaded,
|
|
position
|
|
);
|
|
if (handle === void 0) return null;
|
|
return new ELFSection({ handle });
|
|
}
|
|
getSection(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.elfBinaryGetSection(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new ELFSection({ handle });
|
|
}
|
|
getSectionIndex(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
return binding.elfBinaryGetSectionIndex(this._handle, name);
|
|
}
|
|
addSymtabSymbol(symbol) {
|
|
assert(this._handle);
|
|
assert(symbol._handle);
|
|
binding.elfBinaryAddSymtabSymbol(this._handle, symbol._handle);
|
|
}
|
|
getSymtabSymbol(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.elfBinaryGetSymtabSymbol(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new ELFSymbol({ handle });
|
|
}
|
|
addDynamicSymbol(symbol) {
|
|
assert(this._handle);
|
|
assert(symbol._handle);
|
|
binding.elfBinaryAddDynamicSymbol(this._handle, symbol._handle);
|
|
}
|
|
getDynamicSymbol(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.elfBinaryGetDynamicSymbol(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new ELFSymbol({ handle });
|
|
}
|
|
addDynamicEntry(entry) {
|
|
assert(this._handle);
|
|
assert(entry._handle);
|
|
binding.elfBinaryAddDynamicEntry(this._handle, entry._handle);
|
|
}
|
|
getDynamicEntry(tag) {
|
|
assert(this._handle);
|
|
assert.equal(typeof tag, "number");
|
|
const handle = binding.elfBinaryGetDynamicEntry(this, this._handle, tag);
|
|
if (handle === void 0) return null;
|
|
switch (tag) {
|
|
case TAG.SONAME:
|
|
return new ELFDynamicEntry.SharedObject({ handle });
|
|
case TAG.NEEDED:
|
|
return new ELFDynamicEntry.Library({ handle });
|
|
case TAG.RUNPATH:
|
|
return new ELFDynamicEntry.RunPath({ handle });
|
|
default:
|
|
return new ELFDynamicEntry({ handle });
|
|
}
|
|
}
|
|
hasDynamicEntry(tag) {
|
|
assert(this._handle);
|
|
assert.equal(typeof tag, "number");
|
|
return binding.elfBinaryHasDynamicEntry(this._handle, tag);
|
|
}
|
|
removeDynamicEntry(entry) {
|
|
assert(this._handle);
|
|
assert(entry._handle);
|
|
binding.elfBinaryRemoveDynamicEntry(this._handle, entry._handle);
|
|
}
|
|
removeAllDynamicEntries(tag) {
|
|
assert(this._handle);
|
|
assert.equal(typeof tag, "number");
|
|
binding.elfBinaryRemoveAllDynamicEntries(this._handle, tag);
|
|
}
|
|
addLibrary(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
binding.elfBinaryAddLibrary(this._handle, name);
|
|
}
|
|
getLibrary(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.elfBinaryGetLibrary(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new ELFDynamicEntry.Library({ handle });
|
|
}
|
|
hasLibrary(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
return binding.elfBinaryHasLibrary(this._handle, name);
|
|
}
|
|
removeLibrary(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
binding.elfBinaryRemoveLibrary(this._handle, name);
|
|
}
|
|
toDisk(path) {
|
|
assert(this._handle);
|
|
assert.equal(typeof path, "string");
|
|
binding.elfBinaryWrite(this._handle, path);
|
|
}
|
|
toBuffer() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.elfBinaryGetRaw(this._handle));
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: ELFBinary }
|
|
};
|
|
}
|
|
static parse(input) {
|
|
assert(Buffer.isBuffer(input));
|
|
return new ELFBinary({
|
|
handle: binding.elfBinaryParse(input)
|
|
});
|
|
}
|
|
};
|
|
exports.SEC_INSERT_POS = {
|
|
AUTO: binding.ELF_BINARY_SEC_INSERT_POS_AUTO,
|
|
POST_SEGMENT: binding.ELF_BINARY_SEC_INSERT_POS_POST_SEGMENT,
|
|
POST_SECTION: binding.ELF_BINARY_SEC_INSERT_POS_POST_SECTION
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/elf.js
|
|
var require_elf = __commonJS({
|
|
"../../node_modules/bare-lief/lib/elf.js"(exports) {
|
|
exports.Binary = require_binary2();
|
|
exports.DynamicEntry = require_dynamic_entry();
|
|
exports.Section = require_section2();
|
|
exports.Segment = require_segment();
|
|
exports.Symbol = require_symbol();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/pe/section.js
|
|
var require_section3 = __commonJS({
|
|
"../../node_modules/bare-lief/lib/pe/section.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class PESection {
|
|
constructor(name, opts = {}) {
|
|
if (typeof name === "object" && name !== null) {
|
|
opts = name;
|
|
name = null;
|
|
}
|
|
const { handle = binding.peSectionCreate(name) } = opts;
|
|
this._handle = handle;
|
|
}
|
|
get characteristics() {
|
|
assert(this._handle);
|
|
return binding.peSectionGetCharacteristics(this._handle);
|
|
}
|
|
set characteristics(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.peSectionSetCharacteristics(this._handle, value);
|
|
}
|
|
get content() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.peSectionGetContent(this._handle));
|
|
}
|
|
set content(value) {
|
|
assert(this._handle);
|
|
assert(ArrayBuffer.isView(value));
|
|
binding.peSectionSetContent(this._handle, value);
|
|
}
|
|
get size() {
|
|
assert(this._handle);
|
|
return binding.peSectionGetSize(this._handle);
|
|
}
|
|
set size(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.peSectionSetSize(this._handle, value);
|
|
}
|
|
get virtualSize() {
|
|
assert(this._handle);
|
|
return binding.peSectionGetVirtualSize(this._handle);
|
|
}
|
|
set virtualSize(value) {
|
|
assert(this._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.peSectionSetVirtualSize(this._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: PESection },
|
|
characteristics: this.characteristics,
|
|
content: this.content,
|
|
size: this.size,
|
|
virtualSize: this.virtualSize
|
|
};
|
|
}
|
|
};
|
|
exports.CHARACTERISTICS = {
|
|
CNT_CODE: binding.PE_SECTION_CHARACTERISTICS_CNT_CODE,
|
|
CNT_INITIALIZED_DATA: binding.PE_SECTION_CHARACTERISTICS_CNT_INITIALIZED_DATA,
|
|
CNT_UNINITIALIZED_DATA: binding.PE_SECTION_CHARACTERISTICS_CNT_UNINITIALIZED_DATA,
|
|
MEM_SHARED: binding.PE_SECTION_CHARACTERISTICS_MEM_SHARED,
|
|
MEM_EXECUTE: binding.PE_SECTION_CHARACTERISTICS_MEM_EXECUTE,
|
|
MEM_READ: binding.PE_SECTION_CHARACTERISTICS_MEM_READ,
|
|
MEM_WRITE: binding.PE_SECTION_CHARACTERISTICS_MEM_WRITE
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/pe/optional-header.js
|
|
var require_optional_header = __commonJS({
|
|
"../../node_modules/bare-lief/lib/pe/optional-header.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
module.exports = exports = class PEOptionalHeader {
|
|
constructor(binary) {
|
|
assert(binary._handle);
|
|
this._binary = binary;
|
|
}
|
|
get subsystem() {
|
|
assert(this._binary._handle);
|
|
return binding.peOptionalHeaderGetSubsystem(this._binary._handle);
|
|
}
|
|
set subsystem(value) {
|
|
assert(this._binary._handle);
|
|
assert.equal(typeof value, "number");
|
|
binding.peOptionalHeaderSetSubsystem(this._binary._handle, value);
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: PEOptionalHeader },
|
|
subsystem: this.subsystem
|
|
};
|
|
}
|
|
};
|
|
exports.SUBSYSTEM = {
|
|
WINDOWS_GUI: binding.PE_OPTIONAL_HEADER_SUBSYSTEM_WINDOWS_GUI,
|
|
WINDOWS_CUI: binding.PE_OPTIONAL_HEADER_SUBSYSTEM_WINDOWS_CUI
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/pe/binary.js
|
|
var require_binary3 = __commonJS({
|
|
"../../node_modules/bare-lief/lib/pe/binary.js"(exports, module) {
|
|
var assert = require_bare_assert();
|
|
var binding = require_bare();
|
|
var PESection = require_section3();
|
|
var PEOptionalHeader = require_optional_header();
|
|
module.exports = class PEBinary {
|
|
constructor(opts = {}) {
|
|
const { handle = null } = opts;
|
|
this._handle = handle;
|
|
this._optionalHeader = new PEOptionalHeader(this);
|
|
}
|
|
get optionalHeader() {
|
|
return this._optionalHeader;
|
|
}
|
|
addSection(section) {
|
|
assert(this._handle);
|
|
assert(section._handle);
|
|
const handle = binding.peBinaryAddSection(this, this._handle, section._handle);
|
|
return new PESection({ handle });
|
|
}
|
|
getSection(name) {
|
|
assert(this._handle);
|
|
assert.equal(typeof name, "string");
|
|
const handle = binding.peBinaryGetSection(this, this._handle, name);
|
|
if (handle === void 0) return null;
|
|
return new PESection({ handle });
|
|
}
|
|
toDisk(path) {
|
|
assert(this._handle);
|
|
assert.equal(typeof path, "string");
|
|
binding.peBinaryWrite(this._handle, path);
|
|
}
|
|
toBuffer() {
|
|
assert(this._handle);
|
|
return Buffer.from(binding.peBinaryGetRaw(this._handle));
|
|
}
|
|
[Symbol.for("bare.inspect")]() {
|
|
return {
|
|
__proto__: { constructor: PEBinary },
|
|
optionalHeader: this.optionalHeader
|
|
};
|
|
}
|
|
static parse(input) {
|
|
assert(ArrayBuffer.isView(input));
|
|
return new PEBinary({
|
|
handle: binding.peBinaryParse(input)
|
|
});
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/lib/pe.js
|
|
var require_pe = __commonJS({
|
|
"../../node_modules/bare-lief/lib/pe.js"(exports) {
|
|
exports.Binary = require_binary3();
|
|
exports.Section = require_section3();
|
|
exports.OptionalHeader = require_optional_header();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-lief/index.js
|
|
var require_bare_lief = __commonJS({
|
|
"../../node_modules/bare-lief/index.js"(exports) {
|
|
exports.MachO = require_macho();
|
|
exports.ELF = require_elf();
|
|
exports.PE = require_pe();
|
|
}
|
|
});
|
|
|
|
// ../../bare-lib-entry-bareLief.js
|
|
var bare_lib_entry_bareLief_exports = {};
|
|
__export(bare_lib_entry_bareLief_exports, {
|
|
default: () => bare_lib_entry_bareLief_default
|
|
});
|
|
var import_bare_lief = __toESM(require_bare_lief());
|
|
var bare_lib_entry_bareLief_default = import_bare_lief.default;
|
|
return __toCommonJS(bare_lib_entry_bareLief_exports);
|
|
})();
|
|
;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};var e=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;var v=e!=null&&typeof e==="object"&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;g[s]["bareLief"]=v;})();
|