Files
bare-operating-system/kernel/lib/bare/bundles/bareSemver.js
T
Raven Scott 9bdecc4170
Release rolling / release (push) Successful in 11m16s
Sync Holepunch modules to current clone/npm latest
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.
2026-08-12 20:56:28 -04:00

466 lines
17 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 __commonJS = (cb, mod) => function __require() {
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-semver/lib/constants.js
var require_constants = __commonJS({
"../../node_modules/bare-semver/lib/constants.js"(exports, module) {
module.exports = {
EQ: 1,
LT: 2,
LTE: 3,
GT: 4,
GTE: 5
};
}
});
// ../../node_modules/bare-semver/lib/errors.js
var require_errors = __commonJS({
"../../node_modules/bare-semver/lib/errors.js"(exports, module) {
module.exports = class SemVerError extends Error {
constructor(msg, code, fn = SemVerError) {
super(`${code}: ${msg}`);
this.code = code;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, fn);
}
}
get name() {
return "SemVerError";
}
static INVALID_VERSION(msg, fn = SemVerError.INVALID_VERSION) {
return new SemVerError(msg, "INVALID_VERSION", fn);
}
static INVALID_RANGE(msg, fn = SemVerError.INVALID_RANGE) {
return new SemVerError(msg, "INVALID_RANGE", fn);
}
};
}
});
// ../../node_modules/bare-semver/lib/version.js
var require_version = __commonJS({
"../../node_modules/bare-semver/lib/version.js"(exports, module) {
var errors = require_errors();
var Version = class {
constructor(major, minor, patch, opts = {}) {
const { prerelease = [], build = [] } = opts;
this.major = major;
this.minor = minor;
this.patch = patch;
this.prerelease = prerelease;
this.build = build;
}
compare(version) {
return exports.compare(this, version);
}
toString() {
let result = `${this.major}.${this.minor}.${this.patch}`;
if (this.prerelease.length) {
result += "-" + this.prerelease.join(".");
}
if (this.build.length) {
result += "+" + this.build.join(".");
}
return result;
}
};
module.exports = exports = Version;
exports.parse = function parse(input, state = { position: 0, partial: false, range: false, precision: 0 }) {
let i = state.position;
let c;
const unexpected = (expected) => {
let msg;
if (i >= input.length) {
msg = `Unexpected end of input in '${input}'`;
} else {
msg = `Unexpected token '${input[i]}' in '${input}' at position ${i}`;
}
if (expected) msg += `, ${expected}`;
throw errors.INVALID_VERSION(msg, unexpected);
};
const components = [0, 0, 0];
let k = 0;
while (k < 3) {
c = input[i];
if (k > 0) {
if (c === ".") c = input[++i];
else if (state.range) break;
else unexpected("expected '.'");
}
if (state.range && (c === "x" || c === "X" || c === "*")) {
i++;
while (input[i] === ".") {
let j = i + 1;
while (input[j] >= "0" && input[j] <= "9" || input[j] === "x" || input[j] === "X" || input[j] === "*") {
j++;
}
if (j === i + 1) break;
i = j;
}
break;
}
if (c === "0") {
i++;
k++;
} else if (c >= "1" && c <= "9") {
let j = 0;
do
c = input[i + ++j];
while (c >= "0" && c <= "9");
components[k++] = parseInt(input.substring(i, i + j));
i += j;
} else unexpected("expected /[0-9]/");
}
state.precision = k;
const prerelease = [];
if (k === 3 && input[i] === "-") {
i++;
while (true) {
c = input[i];
let tag = "";
let j = 0;
while (c >= "0" && c <= "9") c = input[i + ++j];
let isNumeric = false;
if (j) {
tag += input.substring(i, i + j);
c = input[i += j];
isNumeric = tag[0] !== "0" || tag.length === 1;
}
j = 0;
while (c >= "0" && c <= "9" || c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "-") {
c = input[i + ++j];
}
if (j) {
tag += input.substring(i, i + j);
c = input[i += j];
} else if (!isNumeric) unexpected("expected /[a-zA-Z-]/");
prerelease.push(tag);
if (c === ".") c = input[++i];
else break;
}
}
const build = [];
if (k === 3 && input[i] === "+") {
i++;
while (true) {
c = input[i];
let tag = "";
let j = 0;
while (c >= "0" && c <= "9" || c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "-") {
c = input[i + ++j];
}
if (j) {
tag += input.substring(i, i + j);
c = input[i += j];
} else unexpected("expected /[0-9a-zA-Z-]/");
build.push(tag);
if (c === ".") c = input[++i];
else break;
}
}
if (i < input.length && state.partial === false) {
unexpected("expected end of input");
}
state.position = i;
return new Version(...components, { prerelease, build });
};
var integer = /^[0-9]+$/;
exports.compare = function compare(a, b) {
if (a.major > b.major) return 1;
if (a.major < b.major) return -1;
if (a.minor > b.minor) return 1;
if (a.minor < b.minor) return -1;
if (a.patch > b.patch) return 1;
if (a.patch < b.patch) return -1;
if (a.prerelease.length === 0) return b.prerelease.length === 0 ? 0 : 1;
if (b.prerelease.length === 0) return -1;
let i = 0;
do {
let x = a.prerelease[i];
let y = b.prerelease[i];
if (x === void 0) return y === void 0 ? 0 : -1;
if (y === void 0) return 1;
if (x === y) continue;
const xInt = integer.test(x);
const yInt = integer.test(y);
if (xInt && yInt) {
x = +x;
y = +y;
} else {
if (xInt) return -1;
if (yInt) return 1;
}
return x > y ? 1 : -1;
} while (++i);
};
}
});
// ../../node_modules/bare-semver/lib/comparator.js
var require_comparator = __commonJS({
"../../node_modules/bare-semver/lib/comparator.js"(exports, module) {
var constants = require_constants();
var symbols = {
[constants.EQ]: "=",
[constants.LT]: "<",
[constants.LTE]: "<=",
[constants.GT]: ">",
[constants.GTE]: ">="
};
module.exports = class Comparator {
constructor(operator, version) {
this.operator = operator;
this.version = version;
}
test(version) {
const result = version.compare(this.version);
switch (this.operator) {
case constants.LT:
return result < 0;
case constants.LTE:
return result <= 0;
case constants.GT:
return result > 0;
case constants.GTE:
return result >= 0;
default:
return result === 0;
}
}
toString() {
return symbols[this.operator] + this.version;
}
};
}
});
// ../../node_modules/bare-semver/lib/range.js
var require_range = __commonJS({
"../../node_modules/bare-semver/lib/range.js"(exports, module) {
var constants = require_constants();
var errors = require_errors();
var Version = require_version();
var Comparator = require_comparator();
var Range = class {
constructor(comparators = []) {
this.comparators = comparators;
}
test(version) {
for (const set of this.comparators) {
let matches = true;
for (const comparator of set) {
if (comparator.test(version)) continue;
matches = false;
break;
}
if (!matches) continue;
if (version.prerelease.length && !allows(set, version)) continue;
return true;
}
return false;
}
toString() {
let result = "";
let first = true;
for (const set of this.comparators) {
if (first) first = false;
else result += " || ";
result += set.join(" ");
}
return result;
}
};
module.exports = exports = Range;
exports.parse = function parse(input, state = { position: 0, partial: false }) {
let i = state.position;
let c;
const unexpected = (expected) => {
let msg;
if (i >= input.length) {
msg = `Unexpected end of input in '${input}'`;
} else {
msg = `Unexpected token '${input[i]}' in '${input}' at position ${i}`;
}
if (expected) msg += `, ${expected}`;
throw errors.INVALID_VERSION(msg, unexpected);
};
const comparators = [];
while (i < input.length) {
const set = [];
while (i < input.length) {
c = input[i];
let operator = constants.EQ;
let caret = false;
let tilde = false;
if (c === "<") {
operator = constants.LT;
c = input[++i];
if (c === "=") {
operator = constants.LTE;
c = input[++i];
}
} else if (c === ">") {
operator = constants.GT;
c = input[++i];
if (c === "=") {
operator = constants.GTE;
c = input[++i];
}
} else if (c === "=") {
c = input[++i];
} else if (c === "^") {
caret = true;
c = input[++i];
} else if (c === "~") {
tilde = true;
c = input[++i];
if (c === ">") c = input[++i];
}
while (c === " ") c = input[++i];
const state2 = { position: i, partial: true, range: true };
const lower = Version.parse(input, state2);
const precision = state2.precision;
c = input[i = state2.position];
while (c === " ") c = input[++i];
if (c === "-" && input[i + 1] === " " && operator === constants.EQ && !caret && !tilde) {
c = input[++i];
while (c === " ") c = input[++i];
state2.position = i;
const high = Version.parse(input, state2);
c = input[i = state2.position];
set.push(new Comparator(constants.GTE, lower));
if (state2.precision === 3) {
set.push(new Comparator(constants.LTE, high));
} else if (state2.precision === 2) {
set.push(upper(high.major, high.minor + 1, 0));
} else if (state2.precision === 1) {
set.push(upper(high.major + 1, 0, 0));
}
while (c === " ") c = input[++i];
} else {
if (caret) {
for (const comparator of expandCaret(lower, precision)) set.push(comparator);
} else if (tilde) {
for (const comparator of expandTilde(lower, precision)) set.push(comparator);
} else if (operator === constants.EQ) {
for (const comparator of expandPartial(lower, precision)) set.push(comparator);
} else {
set.push(new Comparator(operator, lower));
}
}
if (c === "|" && input[i + 1] === "|") {
c = input[i += 2];
while (c === " ") c = input[++i];
break;
}
if (c && c !== "<" && c !== ">" && c !== "^" && c !== "~" && c !== "=") {
unexpected("expected '||', '<', '>', '^', '~', or '='");
}
}
if (set.length) comparators.push(set);
}
if (i < input.length && state.partial === false) {
unexpected("expected end of input");
}
state.position = i;
return new Range(comparators);
};
function allows(set, version) {
for (const comparator of set) {
const target = comparator.version;
if (target.prerelease.length && target.major === version.major && target.minor === version.minor && target.patch === version.patch) {
return true;
}
}
return false;
}
function upper(major, minor, patch) {
return new Comparator(constants.LT, new Version(major, minor, patch, { prerelease: ["0"] }));
}
function expandPartial(version, precision) {
if (precision === 0) return [new Comparator(constants.GTE, new Version(0, 0, 0))];
if (precision === 3) return [new Comparator(constants.EQ, version)];
const set = [new Comparator(constants.GTE, version)];
if (precision === 1) set.push(upper(version.major + 1, 0, 0));
else set.push(upper(version.major, version.minor + 1, 0));
return set;
}
function expandCaret(version, precision) {
if (precision === 0) return [new Comparator(constants.GTE, new Version(0, 0, 0))];
const { major, minor, patch } = version;
const set = [new Comparator(constants.GTE, version)];
if (major !== 0) set.push(upper(major + 1, 0, 0));
else if (precision === 1) set.push(upper(1, 0, 0));
else if (minor !== 0) set.push(upper(0, minor + 1, 0));
else if (precision === 2) set.push(upper(0, 1, 0));
else set.push(upper(0, 0, patch + 1));
return set;
}
function expandTilde(version, precision) {
if (precision === 0) return [new Comparator(constants.GTE, new Version(0, 0, 0))];
const { major, minor } = version;
const set = [new Comparator(constants.GTE, version)];
if (precision === 1) set.push(upper(major + 1, 0, 0));
else set.push(upper(major, minor + 1, 0));
return set;
}
}
});
// ../../node_modules/bare-semver/index.js
var require_bare_semver = __commonJS({
"../../node_modules/bare-semver/index.js"(exports) {
exports.constants = require_constants();
exports.errors = require_errors();
var Version = exports.Version = require_version();
var Range = exports.Range = require_range();
exports.Comparator = require_comparator();
exports.satisfies = function satisfies(version, range) {
if (typeof version === "string") version = Version.parse(version);
if (typeof range === "string") range = Range.parse(range);
return range.test(version);
};
}
});
// ../../bare-lib-entry-bareSemver.js
var bare_lib_entry_bareSemver_exports = {};
__export(bare_lib_entry_bareSemver_exports, {
default: () => bare_lib_entry_bareSemver_default
});
var import_bare_semver = __toESM(require_bare_semver());
var bare_lib_entry_bareSemver_default = import_bare_semver.default;
return __toCommonJS(bare_lib_entry_bareSemver_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]["bareSemver"]=v;})();