1607 lines
61 KiB
JavaScript
1607 lines
61 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-make/lib/errors.js
|
|
var require_errors = __commonJS({
|
|
"../../node_modules/bare-make/lib/errors.js"(exports, module) {
|
|
module.exports = class MakeError extends Error {
|
|
constructor(msg, code, fn = MakeError) {
|
|
super(`${code}: ${msg}`);
|
|
this.code = code;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, fn);
|
|
}
|
|
}
|
|
get name() {
|
|
return "MakeError";
|
|
}
|
|
static UNKNOWN_TOOLCHAIN(msg) {
|
|
return new MakeError(msg, "UNKNOWN_TOOLCHAIN", MakeError.UNKNOWN_TOOLCHAIN);
|
|
}
|
|
static GENERATE_FAILED(msg) {
|
|
return new MakeError(msg, "GENERATE_FAILED", MakeError.GENERATE_FAILED);
|
|
}
|
|
static BUILD_FAILED(msg) {
|
|
return new MakeError(msg, "BUILD_FAILED", MakeError.BUILD_FAILED);
|
|
}
|
|
static INSTALL_FAILED(msg) {
|
|
return new MakeError(msg, "INSTALL_FAILED", MakeError.INSTALL_FAILED);
|
|
}
|
|
static TEST_FAILED(msg) {
|
|
return new MakeError(msg, "TEST_FAILED", MakeError.TEST_FAILED);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/node_modules/cmake-runtime/index.js
|
|
var require_cmake_runtime = __commonJS({
|
|
"../../node_modules/bare-make/node_modules/cmake-runtime/index.js"(exports, module) {
|
|
var os = __require("os");
|
|
var path = __require("path");
|
|
module.exports = function runtime(referrer, opts) {
|
|
if (typeof referrer === "object" && referrer !== null) {
|
|
opts = referrer;
|
|
referrer = "cmake";
|
|
} else if (typeof referrer !== "string") {
|
|
referrer = "cmake";
|
|
}
|
|
if (!opts) opts = {};
|
|
const {
|
|
platform = os.platform(),
|
|
arch = platform === "darwin" ? "universal" : os.arch()
|
|
} = opts;
|
|
const filename = path.basename(referrer);
|
|
let mod;
|
|
try {
|
|
mod = __require(`cmake-runtime-${platform}-${arch}`);
|
|
} catch (err) {
|
|
if (err.code === "MODULE_NOT_FOUND") {
|
|
throw new Error(`No binaries found for target '${platform}-${arch}'`);
|
|
} else {
|
|
throw err;
|
|
}
|
|
}
|
|
if (filename in mod === false) {
|
|
throw new Error(
|
|
`No binary found for target '${platform}-${arch}' for referrer '${referrer}'`
|
|
);
|
|
}
|
|
return mod[filename];
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/node_modules/cmake-runtime/lib/spawn.js
|
|
var require_spawn = __commonJS({
|
|
"../../node_modules/bare-make/node_modules/cmake-runtime/lib/spawn.js"(exports, module) {
|
|
var fs = __require("fs");
|
|
var childProcess = __require("child_process");
|
|
var runtime = require_cmake_runtime();
|
|
module.exports = function spawn(referrer, opts) {
|
|
if (typeof referrer === "object" && referrer !== null) {
|
|
opts = referrer;
|
|
referrer = "cmake";
|
|
} else if (typeof referrer !== "string") {
|
|
referrer = "cmake";
|
|
}
|
|
if (!opts) opts = {};
|
|
const {
|
|
args = typeof Bare !== "undefined" ? Bare.argv.slice(2) : process.argv.slice(2)
|
|
} = opts;
|
|
const bin = runtime(referrer, opts);
|
|
try {
|
|
fs.accessSync(bin, fs.constants.X_OK);
|
|
} catch {
|
|
fs.chmodSync(bin, 493);
|
|
}
|
|
return childProcess.spawn(bin, args, opts);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/lib/build.js
|
|
var require_build = __commonJS({
|
|
"../../node_modules/bare-make/lib/build.js"(exports, module) {
|
|
var path = __require("path");
|
|
var cmake = require_spawn();
|
|
var errors = require_errors();
|
|
module.exports = async function build(opts = {}) {
|
|
const {
|
|
preset = null,
|
|
build: build2 = preset ? null : "build",
|
|
target = null,
|
|
clean = false,
|
|
parallel = 0,
|
|
cwd = path.resolve("."),
|
|
verbose = false,
|
|
stdio
|
|
} = opts;
|
|
const args = ["--build"];
|
|
if (build2) args.push(path.resolve(cwd, build2));
|
|
if (preset) args.push("--preset", preset);
|
|
if (target) args.push("--target", target);
|
|
if (clean) args.push("--clean-first");
|
|
if (parallel > 0) args.push("--parallel", parallel);
|
|
if (verbose) args.push("--verbose");
|
|
const job = cmake({ args, cwd, stdio });
|
|
return new Promise((resolve, reject) => {
|
|
job.on("exit", () => {
|
|
if (job.exitCode === 0) {
|
|
resolve();
|
|
} else {
|
|
reject(errors.BUILD_FAILED("Build failed"));
|
|
}
|
|
});
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../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_errors2 = __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_errors2();
|
|
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 }) {
|
|
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 (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]/");
|
|
}
|
|
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_errors2();
|
|
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) 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;
|
|
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];
|
|
}
|
|
const state2 = { position: i, partial: true, range: true };
|
|
set.push(new Comparator(operator, Version.parse(input, state2)));
|
|
c = input[i = state2.position];
|
|
while (c === " ") c = input[++i];
|
|
if (c === "|" && input[i + 1] === "|") {
|
|
c = input[i += 2];
|
|
while (c === " ") c = input[++i];
|
|
break;
|
|
}
|
|
if (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);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../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_errors2();
|
|
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);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-module-resolve/lib/errors.js
|
|
var require_errors3 = __commonJS({
|
|
"../../node_modules/bare-module-resolve/lib/errors.js"(exports, module) {
|
|
module.exports = class ModuleResolveError extends Error {
|
|
constructor(msg, code, fn = ModuleResolveError) {
|
|
super(`${code}: ${msg}`);
|
|
this.code = code;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, fn);
|
|
}
|
|
}
|
|
get name() {
|
|
return "ModuleResolveError";
|
|
}
|
|
static INVALID_MODULE_SPECIFIER(msg) {
|
|
return new ModuleResolveError(
|
|
msg,
|
|
"INVALID_MODULE_SPECIFIER",
|
|
ModuleResolveError.INVALID_MODULE_SPECIFIER
|
|
);
|
|
}
|
|
static INVALID_PACKAGE_TARGET(msg) {
|
|
return new ModuleResolveError(
|
|
msg,
|
|
"INVALID_PACKAGE_TARGET",
|
|
ModuleResolveError.INVALID_PACKAGE_TARGET
|
|
);
|
|
}
|
|
static PACKAGE_PATH_NOT_EXPORTED(msg) {
|
|
return new ModuleResolveError(
|
|
msg,
|
|
"PACKAGE_PATH_NOT_EXPORTED",
|
|
ModuleResolveError.PACKAGE_PATH_NOT_EXPORTED
|
|
);
|
|
}
|
|
static PACKAGE_IMPORT_NOT_DEFINED(msg) {
|
|
return new ModuleResolveError(
|
|
msg,
|
|
"PACKAGE_IMPORT_NOT_DEFINED",
|
|
ModuleResolveError.PACKAGE_IMPORT_NOT_DEFINED
|
|
);
|
|
}
|
|
static UNSUPPORTED_ENGINE(msg) {
|
|
return new ModuleResolveError(msg, "UNSUPPORTED_ENGINE", ModuleResolveError.UNSUPPORTED_ENGINE);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-module-resolve/index.js
|
|
var require_bare_module_resolve = __commonJS({
|
|
"../../node_modules/bare-module-resolve/index.js"(exports, module) {
|
|
var { satisfies } = require_bare_semver();
|
|
var errors = require_errors3();
|
|
module.exports = exports = function resolve(specifier, parentURL, opts, readPackage) {
|
|
if (typeof opts === "function") {
|
|
readPackage = opts;
|
|
opts = {};
|
|
} else if (typeof readPackage !== "function") {
|
|
readPackage = defaultReadPackage;
|
|
}
|
|
return {
|
|
*[Symbol.iterator]() {
|
|
const generator = exports.module(specifier, parentURL, opts);
|
|
let next = generator.next();
|
|
while (next.done !== true) {
|
|
const value = next.value;
|
|
if (value.package) {
|
|
next = generator.next(readPackage(value.package));
|
|
} else {
|
|
next = generator.next(yield value.resolution);
|
|
}
|
|
}
|
|
return next.value;
|
|
},
|
|
async *[Symbol.asyncIterator]() {
|
|
const generator = exports.module(specifier, parentURL, opts);
|
|
let next = generator.next();
|
|
while (next.done !== true) {
|
|
const value = next.value;
|
|
if (value.package) {
|
|
next = generator.next(await readPackage(value.package));
|
|
} else {
|
|
next = generator.next(yield value.resolution);
|
|
}
|
|
}
|
|
return next.value;
|
|
}
|
|
};
|
|
};
|
|
function defaultReadPackage() {
|
|
return null;
|
|
}
|
|
var UNRESOLVED = 0;
|
|
var YIELDED = 1;
|
|
var RESOLVED = YIELDED | 2;
|
|
exports.constants = {
|
|
UNRESOLVED,
|
|
YIELDED,
|
|
RESOLVED
|
|
};
|
|
exports.module = function* (specifier, parentURL, opts = {}) {
|
|
const { resolutions = null, imports = null } = opts;
|
|
if (exports.startsWithWindowsDriveLetter(specifier)) {
|
|
specifier = "/" + specifier;
|
|
}
|
|
let status;
|
|
if (resolutions) {
|
|
status = yield* exports.preresolved(specifier, resolutions, parentURL, opts);
|
|
if (status) return status;
|
|
}
|
|
status = yield* exports.url(specifier, parentURL, opts);
|
|
if (status) return status;
|
|
status = yield* exports.packageImports(specifier, parentURL, opts);
|
|
if (status) return status;
|
|
if (specifier === "." || specifier === ".." || specifier[0] === "/" || specifier[0] === "\\" || specifier.startsWith("./") || specifier.startsWith(".\\") || specifier.startsWith("../") || specifier.startsWith("..\\")) {
|
|
if (imports) {
|
|
status = yield* exports.packageImportsExports(specifier, imports, parentURL, true, opts);
|
|
if (status) return status;
|
|
}
|
|
status = yield* exports.deferred(specifier, opts);
|
|
if (status) return status;
|
|
status = yield* exports.file(specifier, parentURL, false, opts);
|
|
if (status === RESOLVED) return status;
|
|
return yield* exports.directory(specifier, parentURL, opts);
|
|
}
|
|
return yield* exports.package(specifier, parentURL, opts);
|
|
};
|
|
exports.url = function* (url, parentURL, opts = {}) {
|
|
const { imports = null, deferredProtocol = "deferred:", resolutions = null } = opts;
|
|
let resolution;
|
|
try {
|
|
resolution = new URL(url);
|
|
} catch {
|
|
return UNRESOLVED;
|
|
}
|
|
if (imports) {
|
|
const status = yield* exports.packageImportsExports(
|
|
resolution.href,
|
|
imports,
|
|
parentURL,
|
|
true,
|
|
opts
|
|
);
|
|
if (status) return status;
|
|
}
|
|
if (resolution.protocol === deferredProtocol) {
|
|
const specifier = resolution.pathname;
|
|
if (resolutions) {
|
|
const imports2 = resolutions[parentURL.href];
|
|
if (typeof imports2 === "object" && imports2 !== null) {
|
|
opts = {
|
|
...opts,
|
|
resolutions: { ...resolutions, [parentURL.href]: { ...imports2, [specifier]: null } }
|
|
};
|
|
}
|
|
}
|
|
return yield* exports.module(specifier, parentURL, opts);
|
|
}
|
|
if (resolution.protocol === "node:") {
|
|
const specifier = resolution.pathname;
|
|
if (specifier === "." || specifier === ".." || specifier[0] === "/" || specifier.startsWith("./") || specifier.startsWith("../")) {
|
|
throw errors.INVALID_MODULE_SPECIFIER(`Module specifier '${url}' is not a valid package name`);
|
|
}
|
|
return yield* exports.package(specifier, parentURL, opts);
|
|
}
|
|
const resolved = yield { resolution };
|
|
return resolved ? RESOLVED : YIELDED;
|
|
};
|
|
exports.preresolved = function* (specifier, resolutions, parentURL, opts = {}) {
|
|
const imports = resolutions[parentURL.href];
|
|
if (typeof imports === "object" && imports !== null) {
|
|
return yield* exports.packageImportsExports(specifier, imports, parentURL, true, opts);
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.deferred = function* (specifier, opts = {}) {
|
|
const { deferredProtocol = "deferred:", defer = [] } = opts;
|
|
if (defer.includes(specifier)) {
|
|
const resolved = yield { resolution: new URL(deferredProtocol + specifier) };
|
|
return resolved ? RESOLVED : YIELDED;
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.package = function* (packageSpecifier, parentURL, opts = {}) {
|
|
const { builtins = [] } = opts;
|
|
if (packageSpecifier === "") {
|
|
throw errors.INVALID_MODULE_SPECIFIER(
|
|
`Module specifier '${packageSpecifier}' is not a valid package name`
|
|
);
|
|
}
|
|
let packageName;
|
|
if (packageSpecifier[0] !== "@") {
|
|
packageName = packageSpecifier.split("/", 1).join();
|
|
} else {
|
|
if (!packageSpecifier.includes("/")) {
|
|
throw errors.INVALID_MODULE_SPECIFIER(
|
|
`Module specifier '${packageSpecifier}' is not a valid package name`
|
|
);
|
|
}
|
|
packageName = packageSpecifier.split("/", 2).join("/");
|
|
}
|
|
if (packageName[0] === "." || packageName.includes("\\") || packageName.includes("%")) {
|
|
throw errors.INVALID_MODULE_SPECIFIER(
|
|
`Module specifier '${packageSpecifier}' is not a valid package name`
|
|
);
|
|
}
|
|
let status;
|
|
status = yield* exports.builtinTarget(packageSpecifier, null, builtins, opts);
|
|
if (status) return status;
|
|
status = yield* exports.deferred(packageSpecifier, opts);
|
|
if (status) return status;
|
|
let packageSubpath = "." + packageSpecifier.substring(packageName.length);
|
|
status = yield* exports.packageSelf(packageName, packageSubpath, parentURL, opts);
|
|
if (status) return status;
|
|
parentURL = new URL(parentURL.href);
|
|
for (const packageURL of exports.lookupPackageRoot(packageName, parentURL)) {
|
|
const info = yield { package: packageURL };
|
|
if (info) {
|
|
if (info.engines) exports.validateEngines(packageURL, info.engines, opts);
|
|
if (info.exports) {
|
|
return yield* exports.packageExports(packageURL, packageSubpath, info.exports, opts);
|
|
}
|
|
if (packageSubpath === ".") {
|
|
if (typeof info.main === "string" && info.main !== "") {
|
|
packageSubpath = info.main;
|
|
} else {
|
|
return yield* exports.file("index", packageURL, true, opts);
|
|
}
|
|
}
|
|
status = yield* exports.file(packageSubpath, packageURL, false, opts);
|
|
if (status === RESOLVED) return status;
|
|
return yield* exports.directory(packageSubpath, packageURL, opts);
|
|
}
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.packageSelf = function* (packageName, packageSubpath, parentURL, opts = {}) {
|
|
for (const packageURL of exports.lookupPackageScope(parentURL, opts)) {
|
|
const info = yield { package: packageURL };
|
|
if (info) {
|
|
if (info.name !== packageName) return false;
|
|
if (info.exports) {
|
|
return yield* exports.packageExports(packageURL, packageSubpath, info.exports, opts);
|
|
}
|
|
if (packageSubpath === ".") {
|
|
if (typeof info.main === "string" && info.main !== "") {
|
|
packageSubpath = info.main;
|
|
} else {
|
|
return yield* exports.file("index", packageURL, true, opts);
|
|
}
|
|
}
|
|
const status = yield* exports.file(packageSubpath, packageURL, false, opts);
|
|
if (status === RESOLVED) return status;
|
|
return yield* exports.directory(packageSubpath, packageURL, opts);
|
|
}
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.packageExports = function* (packageURL, subpath, packageExports, opts = {}) {
|
|
if (subpath === ".") {
|
|
let mainExport;
|
|
if (typeof packageExports === "string" || Array.isArray(packageExports)) {
|
|
mainExport = packageExports;
|
|
} else if (typeof packageExports === "object" && packageExports !== null) {
|
|
const keys = Object.keys(packageExports);
|
|
if (keys.some((key) => key.startsWith("."))) {
|
|
if ("." in packageExports) mainExport = packageExports["."];
|
|
} else {
|
|
mainExport = packageExports;
|
|
}
|
|
}
|
|
if (mainExport) {
|
|
const status = yield* exports.packageTarget(packageURL, mainExport, null, false, opts);
|
|
if (status) return status;
|
|
}
|
|
} else if (typeof packageExports === "object" && packageExports !== null) {
|
|
const keys = Object.keys(packageExports);
|
|
if (keys.every((key) => key.startsWith("."))) {
|
|
const status = yield* exports.packageImportsExports(
|
|
subpath,
|
|
packageExports,
|
|
packageURL,
|
|
false,
|
|
opts
|
|
);
|
|
if (status) return status;
|
|
}
|
|
}
|
|
throw errors.PACKAGE_PATH_NOT_EXPORTED(
|
|
`Package subpath '${subpath}' is not defined by "exports" in '${packageURL}'`
|
|
);
|
|
};
|
|
exports.packageImports = function* (specifier, parentURL, opts = {}) {
|
|
const { imports = null } = opts;
|
|
if (specifier === "#" || specifier.startsWith("#/")) {
|
|
throw errors.INVALID_MODULE_SPECIFIER(
|
|
`Module specifier '${specifier}' is not a valid internal imports specifier`
|
|
);
|
|
}
|
|
for (const packageURL of exports.lookupPackageScope(parentURL, opts)) {
|
|
const info = yield { package: packageURL };
|
|
if (info) {
|
|
if (info.imports) {
|
|
const status = yield* exports.packageImportsExports(
|
|
specifier,
|
|
info.imports,
|
|
packageURL,
|
|
true,
|
|
opts
|
|
);
|
|
if (status) return status;
|
|
}
|
|
if (specifier.startsWith("#")) {
|
|
throw errors.PACKAGE_IMPORT_NOT_DEFINED(
|
|
`Package import specifier '${specifier}' is not defined by "imports" in '${packageURL}'`
|
|
);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (imports) {
|
|
const status = yield* exports.packageImportsExports(specifier, imports, parentURL, true, opts);
|
|
if (status) return status;
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.packageImportsExports = function* (matchKey, matchObject, packageURL, isImports, opts = {}) {
|
|
if (matchKey in matchObject && !matchKey.includes("*")) {
|
|
const target = matchObject[matchKey];
|
|
return yield* exports.packageTarget(packageURL, target, null, isImports, opts);
|
|
}
|
|
const expansionKeys = Object.keys(matchObject).filter((key) => key.includes("*")).sort(exports.patternKeyCompare);
|
|
for (const expansionKey of expansionKeys) {
|
|
const patternIndex = expansionKey.indexOf("*");
|
|
const patternBase = expansionKey.substring(0, patternIndex);
|
|
if (matchKey.startsWith(patternBase) && matchKey !== patternBase) {
|
|
const patternTrailer = expansionKey.substring(patternIndex + 1);
|
|
if (patternTrailer === "" || matchKey.endsWith(patternTrailer) && matchKey.length >= expansionKey.length) {
|
|
const target = matchObject[expansionKey];
|
|
const patternMatch = matchKey.substring(
|
|
patternBase.length,
|
|
matchKey.length - patternTrailer.length
|
|
);
|
|
return yield* exports.packageTarget(packageURL, target, patternMatch, isImports, opts);
|
|
}
|
|
}
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.validateEngines = function validateEngines(packageURL, packageEngines, opts = {}) {
|
|
const { engines = {} } = opts;
|
|
for (const [engine, range] of Object.entries(packageEngines)) {
|
|
if (engine in engines) {
|
|
const version = engines[engine];
|
|
if (!satisfies(version, range)) {
|
|
throw errors.UNSUPPORTED_ENGINE(
|
|
`Package not compatible with engine '${engine}' ${version}, requires range '${range}' defined by "engines" in '${packageURL}'`
|
|
);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
exports.patternKeyCompare = function patternKeyCompare(keyA, keyB) {
|
|
const patternIndexA = keyA.indexOf("*");
|
|
const patternIndexB = keyB.indexOf("*");
|
|
const baseLengthA = patternIndexA === -1 ? keyA.length : patternIndexA + 1;
|
|
const baseLengthB = patternIndexB === -1 ? keyB.length : patternIndexB + 1;
|
|
if (baseLengthA > baseLengthB) return -1;
|
|
if (baseLengthB > baseLengthA) return 1;
|
|
if (patternIndexA === -1) return 1;
|
|
if (patternIndexB === -1) return -1;
|
|
if (keyA.length > keyB.length) return -1;
|
|
if (keyB.length > keyA.length) return 1;
|
|
return 0;
|
|
};
|
|
exports.packageTarget = function* (packageURL, target, patternMatch, isImports, opts = {}) {
|
|
const { conditions = [], matchedConditions = [] } = opts;
|
|
if (typeof target === "string") {
|
|
if (!target.startsWith("./") && !isImports) {
|
|
throw errors.INVALID_PACKAGE_TARGET(
|
|
`Invalid target '${target}' defined by "exports" in '${packageURL}'`
|
|
);
|
|
}
|
|
if (patternMatch !== null) {
|
|
target = target.replaceAll("*", patternMatch);
|
|
}
|
|
const status = yield* exports.url(target, packageURL, opts);
|
|
if (status) return status;
|
|
if (target === "." || target === ".." || target[0] === "/" || target.startsWith("./") || target.startsWith("../")) {
|
|
const resolved = yield { resolution: new URL(target, packageURL) };
|
|
return resolved ? RESOLVED : YIELDED;
|
|
}
|
|
return yield* exports.package(target, packageURL, opts);
|
|
}
|
|
if (Array.isArray(target)) {
|
|
for (const targetValue of target) {
|
|
const status = yield* exports.packageTarget(
|
|
packageURL,
|
|
targetValue,
|
|
patternMatch,
|
|
isImports,
|
|
opts
|
|
);
|
|
if (status) return status;
|
|
}
|
|
} else if (typeof target === "object" && target !== null) {
|
|
let status = UNRESOLVED;
|
|
for (const [condition, targetValue, subset] of exports.conditionMatches(
|
|
target,
|
|
conditions,
|
|
opts
|
|
)) {
|
|
matchedConditions.push(condition);
|
|
status |= yield* exports.packageTarget(packageURL, targetValue, patternMatch, isImports, {
|
|
...opts,
|
|
conditions: subset
|
|
});
|
|
matchedConditions.pop();
|
|
}
|
|
if (status) return status;
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.builtinTarget = function* (packageSpecifier, packageVersion, target, opts = {}) {
|
|
const { builtinProtocol = "builtin:", conditions = [], matchedConditions = [] } = opts;
|
|
if (typeof target === "string") {
|
|
const targetParts = target.split("@");
|
|
let targetName;
|
|
let targetVersion;
|
|
if (target[0] !== "@") {
|
|
targetName = targetParts[0];
|
|
targetVersion = targetParts[1] || null;
|
|
} else {
|
|
targetName = targetParts.slice(0, 2).join("@");
|
|
targetVersion = targetParts[2] || null;
|
|
}
|
|
if (packageSpecifier === targetName) {
|
|
if (packageVersion === null && targetVersion === null) {
|
|
const resolved = yield {
|
|
resolution: new URL(builtinProtocol + packageSpecifier)
|
|
};
|
|
return resolved ? RESOLVED : YIELDED;
|
|
}
|
|
let version = null;
|
|
if (packageVersion === null) {
|
|
version = targetVersion;
|
|
} else if (targetVersion === null || packageVersion === targetVersion) {
|
|
version = packageVersion;
|
|
}
|
|
if (version !== null) {
|
|
const resolved = yield {
|
|
resolution: new URL(builtinProtocol + packageSpecifier + "@" + version)
|
|
};
|
|
return resolved ? RESOLVED : YIELDED;
|
|
}
|
|
}
|
|
} else if (Array.isArray(target)) {
|
|
for (const targetValue of target) {
|
|
const status = yield* exports.builtinTarget(
|
|
packageSpecifier,
|
|
packageVersion,
|
|
targetValue,
|
|
opts
|
|
);
|
|
if (status) return status;
|
|
}
|
|
} else if (typeof target === "object" && target !== null) {
|
|
let status = UNRESOLVED;
|
|
for (const [condition, targetValue, subset] of exports.conditionMatches(
|
|
target,
|
|
conditions,
|
|
opts
|
|
)) {
|
|
matchedConditions.push(condition);
|
|
status |= yield* exports.builtinTarget(packageSpecifier, packageVersion, targetValue, {
|
|
...opts,
|
|
conditions: subset
|
|
});
|
|
matchedConditions.pop();
|
|
}
|
|
if (status) return status;
|
|
}
|
|
return UNRESOLVED;
|
|
};
|
|
exports.conditionMatches = function* conditionMatches(target, conditions, opts = {}) {
|
|
if (conditions.every((condition) => typeof condition === "string")) {
|
|
const keys = Object.keys(target);
|
|
for (const condition of keys) {
|
|
if (condition === "default" || conditions.includes(condition)) {
|
|
yield [condition, target[condition], conditions];
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
let yielded = false;
|
|
for (const subset of conditions) {
|
|
if (yield* conditionMatches(target, subset, opts)) {
|
|
yielded = true;
|
|
}
|
|
}
|
|
return yielded;
|
|
};
|
|
exports.lookupPackageRoot = function* (packageName, parentURL) {
|
|
parentURL = new URL(parentURL.href);
|
|
do {
|
|
const packageURL = new URL("node_modules/" + packageName + "/", parentURL);
|
|
const info = yield new URL("package.json", packageURL);
|
|
if (info) return info;
|
|
parentURL.pathname = parentURL.pathname.substring(0, parentURL.pathname.lastIndexOf("/"));
|
|
if (parentURL.pathname.length === 3 && exports.isWindowsDriveLetter(parentURL.pathname.substring(1))) {
|
|
break;
|
|
}
|
|
} while (parentURL.pathname !== "" && parentURL.pathname !== "/");
|
|
return null;
|
|
};
|
|
exports.lookupPackageScope = function* lookupPackageScope(scopeURL, opts = {}) {
|
|
const { resolutions = null } = opts;
|
|
if (resolutions) {
|
|
for (const { resolution } of exports.preresolved("#package", resolutions, scopeURL, opts)) {
|
|
if (resolution) return yield resolution;
|
|
}
|
|
}
|
|
scopeURL = new URL(scopeURL.href);
|
|
do {
|
|
if (scopeURL.pathname.endsWith("/node_modules")) break;
|
|
const info = yield new URL("package.json", scopeURL);
|
|
if (info) return info;
|
|
scopeURL.pathname = scopeURL.pathname.substring(0, scopeURL.pathname.lastIndexOf("/"));
|
|
if (scopeURL.pathname.length === 3 && exports.isWindowsDriveLetter(scopeURL.pathname.substring(1))) {
|
|
break;
|
|
}
|
|
} while (scopeURL.pathname !== "" && scopeURL.pathname !== "/");
|
|
return null;
|
|
};
|
|
exports.file = function* (filename, parentURL, isIndex, opts = {}) {
|
|
if (filename === "." || filename === ".." || filename[filename.length - 1] === "/" || filename[filename.length - 1] === "\\") {
|
|
return UNRESOLVED;
|
|
}
|
|
if (parentURL.protocol === "file:" && /%2f|%5c/i.test(filename)) {
|
|
throw errors.INVALID_MODULE_SPECIFIER(`Module specifier '${filename}' is invalid`);
|
|
}
|
|
const { extensions = [] } = opts;
|
|
let status = UNRESOLVED;
|
|
if (!isIndex) {
|
|
if (yield { resolution: new URL(filename, parentURL) }) {
|
|
return RESOLVED;
|
|
}
|
|
status = YIELDED;
|
|
}
|
|
for (const ext of extensions) {
|
|
if (filename.endsWith(ext)) continue;
|
|
if (yield { resolution: new URL(filename + ext, parentURL) }) {
|
|
return RESOLVED;
|
|
}
|
|
status = YIELDED;
|
|
}
|
|
return status;
|
|
};
|
|
exports.directory = function* (dirname, parentURL, opts = {}) {
|
|
let directoryURL;
|
|
if (dirname[dirname.length - 1] === "/" || dirname[dirname.length - 1] === "\\") {
|
|
directoryURL = new URL(dirname, parentURL);
|
|
} else {
|
|
directoryURL = new URL(dirname + "/", parentURL);
|
|
}
|
|
const info = yield { package: new URL("package.json", directoryURL) };
|
|
if (info) {
|
|
if (info.exports) {
|
|
return yield* exports.packageExports(directoryURL, ".", info.exports, opts);
|
|
}
|
|
if (typeof info.main === "string" && info.main !== "") {
|
|
const status = yield* exports.file(info.main, directoryURL, false, opts);
|
|
if (status === RESOLVED) return status;
|
|
return yield* exports.directory(info.main, directoryURL, opts);
|
|
}
|
|
}
|
|
return yield* exports.file("index", directoryURL, true, opts);
|
|
};
|
|
function isASCIIUpperAlpha(c) {
|
|
return c >= 65 && c <= 90;
|
|
}
|
|
function isASCIILowerAlpha(c) {
|
|
return c >= 97 && c <= 122;
|
|
}
|
|
function isASCIIAlpha(c) {
|
|
return isASCIIUpperAlpha(c) || isASCIILowerAlpha(c);
|
|
}
|
|
exports.isWindowsDriveLetter = function isWindowsDriveLetter(input) {
|
|
return input.length >= 2 && isASCIIAlpha(input.charCodeAt(0)) && (input.charCodeAt(1) === 58 || input.charCodeAt(1) === 124);
|
|
};
|
|
exports.startsWithWindowsDriveLetter = function startsWithWindowsDriveLetter(input) {
|
|
return input.length >= 2 && exports.isWindowsDriveLetter(input) && (input.length === 2 || input.charCodeAt(2) === 47 || input.charCodeAt(2) === 92 || input.charCodeAt(2) === 63 || input.charCodeAt(2) === 35);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/require-asset/lib/node.js
|
|
var require_node = __commonJS({
|
|
"../../node_modules/require-asset/lib/node.js"(exports, module) {
|
|
if (typeof __require.asset === "function") {
|
|
module.exports = __require.asset.bind(__require);
|
|
} else {
|
|
let readPackage2 = function(packageURL) {
|
|
try {
|
|
return __require(url.fileURLToPath(packageURL));
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}, isAlpine2 = function() {
|
|
return process.platform === "linux" && fs.existsSync("/etc/alpine-release");
|
|
};
|
|
readPackage = readPackage2, isAlpine = isAlpine2;
|
|
const url = __require("url");
|
|
const fs = __require("fs");
|
|
const resolve = require_bare_module_resolve();
|
|
const conditions = ["asset", "node", process.platform, process.arch];
|
|
if (isAlpine2()) conditions.push("musl");
|
|
module.exports = function asset(specifier, parentURL) {
|
|
if (typeof parentURL === "string") parentURL = url.pathToFileURL(parentURL);
|
|
const candidates = [];
|
|
for (const resolution of resolve(specifier, parentURL, { conditions }, readPackage2)) {
|
|
switch (resolution.protocol) {
|
|
case "file:":
|
|
try {
|
|
return __require.resolve(url.fileURLToPath(resolution));
|
|
} catch {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
let message = `Cannot find asset '${specifier}' imported from '${parentURL.href}'`;
|
|
if (candidates.length > 0) {
|
|
message += "\nCandidates:";
|
|
message += "\n" + candidates.map((url2) => "- " + url2.href).join("\n");
|
|
}
|
|
const err = new Error(message);
|
|
err.code = "ASSET_NOT_FOUND";
|
|
err.specifier = specifier;
|
|
err.referrer = parentURL;
|
|
err.candidates = candidates;
|
|
throw err;
|
|
};
|
|
}
|
|
var readPackage;
|
|
var isAlpine;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/cmake-toolchains/index.js
|
|
var require_cmake_toolchains = __commonJS({
|
|
"../../node_modules/cmake-toolchains/index.js"(exports) {
|
|
__require.asset = require_node();
|
|
exports["android-arm"] = __require.asset("./android-arm.cmake", __filename);
|
|
exports["android-arm64"] = __require.asset("./android-arm64.cmake", __filename);
|
|
exports["android-ia32"] = __require.asset("./android-ia32.cmake", __filename);
|
|
exports["android-x64"] = __require.asset("./android-x64.cmake", __filename);
|
|
exports["darwin-arm64"] = __require.asset("./darwin-arm64.cmake", __filename);
|
|
exports["darwin-x64"] = __require.asset("./darwin-x64.cmake", __filename);
|
|
exports["ios-arm64"] = __require.asset("./ios-arm64.cmake", __filename);
|
|
exports["ios-arm64-simulator"] = __require.asset("./ios-arm64-simulator.cmake", __filename);
|
|
exports["ios-x64-simulator"] = __require.asset("./ios-x64-simulator.cmake", __filename);
|
|
exports["linux-arm"] = __require.asset("./linux-arm.cmake", __filename);
|
|
exports["linux-arm-musl"] = __require.asset("./linux-arm-musl.cmake", __filename);
|
|
exports["linux-arm64"] = __require.asset("./linux-arm64.cmake", __filename);
|
|
exports["linux-arm64-musl"] = __require.asset("./linux-arm64-musl.cmake", __filename);
|
|
exports["linux-ia32"] = __require.asset("./linux-ia32.cmake", __filename);
|
|
exports["linux-ia32-musl"] = __require.asset("./linux-ia32-musl.cmake", __filename);
|
|
exports["linux-mips"] = __require.asset("./linux-mips.cmake", __filename);
|
|
exports["linux-mips-musl"] = __require.asset("./linux-mips-musl.cmake", __filename);
|
|
exports["linux-mips-muslsf"] = __require.asset("./linux-mips-muslsf.cmake", __filename);
|
|
exports["linux-mipsel"] = __require.asset("./linux-mipsel.cmake", __filename);
|
|
exports["linux-mipsel-musl"] = __require.asset("./linux-mipsel-musl.cmake", __filename);
|
|
exports["linux-mipsel-muslsf"] = __require.asset("./linux-mipsel-muslsf.cmake", __filename);
|
|
exports["linux-riscv64"] = __require.asset("./linux-riscv64.cmake", __filename);
|
|
exports["linux-x64"] = __require.asset("./linux-x64.cmake", __filename);
|
|
exports["linux-x64-musl"] = __require.asset("./linux-x64-musl.cmake", __filename);
|
|
exports["mingw-arm64"] = __require.asset("./mingw-arm64.cmake", __filename);
|
|
exports["mingw-x64"] = __require.asset("./mingw-x64.cmake", __filename);
|
|
exports["win32-arm64"] = __require.asset("./win32-arm64.cmake", __filename);
|
|
exports["win32-x64"] = __require.asset("./win32-x64.cmake", __filename);
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/ninja-runtime/index.js
|
|
var require_ninja_runtime = __commonJS({
|
|
"../../node_modules/ninja-runtime/index.js"(exports, module) {
|
|
var os = __require("os");
|
|
var path = __require("path");
|
|
module.exports = function runtime(referrer, opts) {
|
|
if (typeof referrer === "object" && referrer !== null) {
|
|
opts = referrer;
|
|
referrer = "ninja";
|
|
} else if (typeof referrer !== "string") {
|
|
referrer = "ninja";
|
|
}
|
|
if (!opts) opts = {};
|
|
const {
|
|
platform = os.platform(),
|
|
arch = platform === "darwin" ? "universal" : os.arch()
|
|
} = opts;
|
|
const filename = path.basename(referrer);
|
|
let mod;
|
|
try {
|
|
mod = __require(`ninja-runtime-${platform}-${arch}`);
|
|
} catch (err) {
|
|
if (err.code === "MODULE_NOT_FOUND") {
|
|
throw new Error(`No binaries found for target '${platform}-${arch}'`);
|
|
} else {
|
|
throw err;
|
|
}
|
|
}
|
|
if (filename in mod === false) {
|
|
throw new Error(
|
|
`No binary found for target '${platform}-${arch}' for referrer '${referrer}'`
|
|
);
|
|
}
|
|
return mod[filename];
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/lib/generate.js
|
|
var require_generate = __commonJS({
|
|
"../../node_modules/bare-make/lib/generate.js"(exports, module) {
|
|
var fs = __require("fs");
|
|
var os = __require("os");
|
|
var path = __require("path");
|
|
var cmake = require_spawn();
|
|
var toolchains = require_cmake_toolchains();
|
|
var ninja = require_ninja_runtime()();
|
|
var errors = require_errors();
|
|
try {
|
|
fs.accessSync(ninja, fs.constants.X_OK);
|
|
} catch {
|
|
fs.chmodSync(ninja, 493);
|
|
}
|
|
module.exports = async function generate(opts = {}) {
|
|
const {
|
|
preset = null,
|
|
source = ".",
|
|
build = preset ? null : "build",
|
|
platform = os.platform(),
|
|
arch = os.arch(),
|
|
simulator = false,
|
|
environment = null,
|
|
cache = true,
|
|
sanitize = null,
|
|
debug = false,
|
|
withDebugSymbols = false,
|
|
withMinimalSize = false,
|
|
define = [],
|
|
cwd = path.resolve("."),
|
|
color = false,
|
|
verbose = false,
|
|
stdio
|
|
} = opts;
|
|
let target = `${platform}-${arch}`;
|
|
if (simulator) target += "-simulator";
|
|
else if (environment) target += `-${environment}`;
|
|
if (target in toolchains === false) {
|
|
throw errors.UNKNOWN_TOOLCHAIN(`No toolchain found for target '${target}'`);
|
|
}
|
|
const args = ["-G", "Ninja", "-S", source];
|
|
if (build) args.push("-B", path.resolve(cwd, build));
|
|
if (preset) args.push("--preset", preset);
|
|
args.push("--toolchain", toolchains[target]);
|
|
if (cache === false) args.push("--fresh");
|
|
args.push(
|
|
`-DCMAKE_BUILD_TYPE=${debug ? "Debug" : withDebugSymbols ? "RelWithDebInfo" : withMinimalSize ? "MinSizeRel" : "Release"}`,
|
|
`-DCMAKE_MESSAGE_LOG_LEVEL=${verbose ? "VERBOSE" : "NOTICE"}`,
|
|
`-DCMAKE_MAKE_PROGRAM=${ninja}`,
|
|
// Export compile commands for use by external tools, such as the Clangd
|
|
// language server (https://clangd.llvm.org).
|
|
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
|
);
|
|
const compilerFlags = [];
|
|
const linkerFlags = [];
|
|
if (debug || sanitize) {
|
|
compilerFlags.push(platform === "win32" ? "/Oy-" : "-fno-omit-frame-pointer");
|
|
}
|
|
if (sanitize) {
|
|
compilerFlags.push(`-fsanitize=${sanitize}`);
|
|
linkerFlags.push(`-fsanitize=${sanitize}`);
|
|
}
|
|
if (color) compilerFlags.push("-fcolor-diagnostics");
|
|
if (compilerFlags.length) {
|
|
for (const type of ["C"]) {
|
|
args.push(`-DCMAKE_${type}_FLAGS=${compilerFlags.join(" ")}`);
|
|
}
|
|
}
|
|
if (linkerFlags.length) {
|
|
for (const type of ["EXE", "SHARED", "MODULE"]) {
|
|
args.push(`-DCMAKE_${type}_LINKER_FLAGS=${linkerFlags.join(" ")}`);
|
|
}
|
|
}
|
|
for (const entry of define) args.push(`-D${entry}`);
|
|
const job = cmake({ args, cwd, stdio });
|
|
return new Promise((resolve, reject) => {
|
|
job.on("exit", () => {
|
|
if (job.exitCode === 0) {
|
|
resolve();
|
|
} else {
|
|
reject(errors.GENERATE_FAILED("Build system generation failed"));
|
|
}
|
|
});
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-os/binding.js
|
|
var require_binding = __commonJS({
|
|
"../../node_modules/bare-os/binding.js"(exports, module) {
|
|
module.exports = __require.addon();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-os/lib/errors.js
|
|
var require_errors4 = __commonJS({
|
|
"../../node_modules/bare-os/lib/errors.js"(exports, module) {
|
|
module.exports = class OSError extends Error {
|
|
constructor(msg, code, fn = OSError) {
|
|
super(`${code}: ${msg}`);
|
|
this.code = code;
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, fn);
|
|
}
|
|
}
|
|
get name() {
|
|
return "OSError";
|
|
}
|
|
static UNKNOWN_SIGNAL(msg) {
|
|
return new OSError(msg, "UNKNOWN_SIGNAL", OSError.UNKNOWN_SIGNAL);
|
|
}
|
|
static TITLE_OVERFLOW(msg) {
|
|
return new OSError(msg, "TITLE_OVERFLOW", OSError.TITLE_OVERFLOW);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-os/lib/constants.js
|
|
var require_constants2 = __commonJS({
|
|
"../../node_modules/bare-os/lib/constants.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = {
|
|
signals: binding.signals,
|
|
errnos: binding.errnos,
|
|
priority: binding.priority
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-os/index.js
|
|
var require_bare_os = __commonJS({
|
|
"../../node_modules/bare-os/index.js"(exports) {
|
|
var binding = require_binding();
|
|
var errors = require_errors4();
|
|
var constants = require_constants2();
|
|
exports.constants = constants;
|
|
exports.EOL = binding.platform === "win32" ? "\r\n" : "\n";
|
|
exports.devNull = binding.platform === "win32" ? "\\\\.\\nul" : "/dev/null";
|
|
exports.platform = function platform() {
|
|
return binding.platform;
|
|
};
|
|
exports.arch = function arch() {
|
|
return binding.arch;
|
|
};
|
|
exports.type = binding.type;
|
|
exports.version = binding.version;
|
|
exports.release = binding.release;
|
|
exports.machine = binding.machine;
|
|
exports.execPath = binding.execPath;
|
|
exports.pid = binding.pid;
|
|
exports.ppid = binding.ppid;
|
|
exports.cwd = binding.cwd;
|
|
exports.chdir = binding.chdir;
|
|
exports.tmpdir = binding.tmpdir;
|
|
exports.homedir = binding.homedir;
|
|
exports.hostname = binding.hostname;
|
|
exports.userInfo = binding.userInfo;
|
|
exports.networkInterfaces = function networkInterfaces() {
|
|
const result = {};
|
|
for (const entry of binding.networkInterfaces()) {
|
|
const { name, ...properties } = entry;
|
|
if (result[name]) result[name].push(properties);
|
|
else result[name] = [properties];
|
|
}
|
|
return result;
|
|
};
|
|
exports.kill = function kill(pid, signal = constants.signals.SIGTERM) {
|
|
if (typeof signal === "string") {
|
|
if (signal in constants.signals === false) {
|
|
throw errors.UNKNOWN_SIGNAL("Unknown signal: " + signal);
|
|
}
|
|
signal = constants.signals[signal];
|
|
}
|
|
binding.kill(pid, signal);
|
|
};
|
|
exports.endianness = function endianness() {
|
|
return binding.isLittleEndian ? "LE" : "BE";
|
|
};
|
|
exports.availableParallelism = binding.availableParallelism;
|
|
exports.cpuUsage = function cpuUsage(previous) {
|
|
const current = binding.cpuUsage();
|
|
if (previous) {
|
|
return {
|
|
user: current.user - previous.user,
|
|
system: current.system - previous.system
|
|
};
|
|
}
|
|
return current;
|
|
};
|
|
exports.threadCpuUsage = function threadCpuUsage(previous) {
|
|
const current = binding.threadCpuUsage();
|
|
if (previous) {
|
|
return {
|
|
user: current.user - previous.user,
|
|
system: current.system - previous.system
|
|
};
|
|
}
|
|
return current;
|
|
};
|
|
exports.resourceUsage = binding.resourceUsage;
|
|
exports.memoryUsage = binding.memoryUsage;
|
|
exports.freemem = binding.freemem;
|
|
exports.totalmem = binding.totalmem;
|
|
exports.availableMemory = binding.availableMemory;
|
|
exports.constrainedMemory = binding.constrainedMemory;
|
|
exports.uptime = binding.uptime;
|
|
exports.loadavg = binding.loadavg;
|
|
exports.cpus = binding.cpus;
|
|
exports.getProcessTitle = binding.getProcessTitle;
|
|
exports.setProcessTitle = function setProcessTitle(title) {
|
|
if (typeof title !== "string") title = title.toString();
|
|
if (title.length >= 256) {
|
|
throw errors.TITLE_OVERFLOW("Process title is too long");
|
|
}
|
|
binding.setProcessTitle(title);
|
|
};
|
|
exports.getPriority = function getPriority(pid = 0) {
|
|
return binding.getPriority(pid);
|
|
};
|
|
exports.setPriority = function setPriority(pid, priority) {
|
|
if (priority === void 0) {
|
|
priority = pid;
|
|
pid = 0;
|
|
}
|
|
binding.setPriority(pid, priority);
|
|
};
|
|
exports.getEnvKeys = binding.getEnvKeys;
|
|
exports.getEnv = binding.getEnv;
|
|
exports.hasEnv = binding.hasEnv;
|
|
exports.setEnv = binding.setEnv;
|
|
exports.unsetEnv = binding.unsetEnv;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-env/index.js
|
|
var require_bare_env = __commonJS({
|
|
"../../node_modules/bare-env/index.js"(exports, module) {
|
|
var os = require_bare_os();
|
|
module.exports = new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
ownKeys(target) {
|
|
return os.getEnvKeys();
|
|
},
|
|
get(target, property) {
|
|
if (typeof property !== "string") return;
|
|
return os.getEnv(property);
|
|
},
|
|
has(target, property) {
|
|
if (typeof property !== "string") return false;
|
|
return os.hasEnv(property);
|
|
},
|
|
set(target, property, value) {
|
|
if (typeof property !== "string") return;
|
|
const type = typeof value;
|
|
if (type !== "string" && type !== "number" && type !== "boolean") {
|
|
throw new Error("Environment variable must be of type string, number, or boolean");
|
|
}
|
|
value = String(value);
|
|
os.setEnv(property, value);
|
|
return true;
|
|
},
|
|
deleteProperty(target, property) {
|
|
if (typeof property !== "string") return;
|
|
os.unsetEnv(property);
|
|
},
|
|
getOwnPropertyDescriptor(target, property) {
|
|
return {
|
|
value: this.get(target, property),
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
};
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/lib/env.js
|
|
var require_env = __commonJS({
|
|
"../../node_modules/bare-make/lib/env.js"(exports, module) {
|
|
module.exports = typeof Bare !== "undefined" ? require_bare_env() : process.env;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/lib/install.js
|
|
var require_install = __commonJS({
|
|
"../../node_modules/bare-make/lib/install.js"(exports, module) {
|
|
var path = __require("path");
|
|
var cmake = require_spawn();
|
|
var errors = require_errors();
|
|
module.exports = async function install(opts = {}) {
|
|
const {
|
|
build = "build",
|
|
prefix = "prebuilds",
|
|
component = null,
|
|
link = false,
|
|
parallel = 0,
|
|
strip = false,
|
|
cwd = path.resolve("."),
|
|
verbose = false,
|
|
stdio
|
|
} = opts;
|
|
const env = { ...require_env() };
|
|
const args = ["--install", path.resolve(cwd, build), "--prefix", path.resolve(cwd, prefix)];
|
|
if (component) args.push("--component", component);
|
|
if (parallel > 0) args.push("--parallel", parallel);
|
|
if (strip) args.push("--strip");
|
|
if (verbose) args.push("--verbose");
|
|
if (link) env.CMAKE_INSTALL_MODE = "ABS_SYMLINK";
|
|
const job = cmake({ args, cwd, stdio, env });
|
|
return new Promise((resolve, reject) => {
|
|
job.on("exit", () => {
|
|
if (job.exitCode === 0) {
|
|
resolve();
|
|
} else {
|
|
reject(errors.INSTALL_FAILED("Install failed"));
|
|
}
|
|
});
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/lib/test.js
|
|
var require_test = __commonJS({
|
|
"../../node_modules/bare-make/lib/test.js"(exports, module) {
|
|
var path = __require("path");
|
|
var cmake = require_spawn();
|
|
var errors = require_errors();
|
|
module.exports = async function test(opts = {}) {
|
|
const {
|
|
build = "build",
|
|
timeout = 30,
|
|
parallel = -1,
|
|
preset = null,
|
|
cwd = path.resolve("."),
|
|
verbose = false,
|
|
stdio
|
|
} = opts;
|
|
const args = ["--test-dir", path.resolve(cwd, build), "--timeout", timeout, "--output-on-failure"];
|
|
if (parallel >= 0) args.push("--parallel", parallel);
|
|
if (preset) args.push("--preset", preset);
|
|
if (verbose) args.push("--verbose");
|
|
const job = cmake("ctest", { args, cwd, stdio });
|
|
return new Promise((resolve, reject) => {
|
|
job.on("exit", () => {
|
|
if (job.exitCode === 0) {
|
|
resolve();
|
|
} else {
|
|
reject(errors.TEST_FAILED("Test failed"));
|
|
}
|
|
});
|
|
});
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-make/index.js
|
|
var require_bare_make = __commonJS({
|
|
"../../node_modules/bare-make/index.js"(exports) {
|
|
exports.errors = require_errors();
|
|
exports.build = require_build();
|
|
exports.generate = require_generate();
|
|
exports.install = require_install();
|
|
exports.test = require_test();
|
|
}
|
|
});
|
|
|
|
// ../../bare-lib-entry-bareMake.js
|
|
var bare_lib_entry_bareMake_exports = {};
|
|
__export(bare_lib_entry_bareMake_exports, {
|
|
default: () => bare_lib_entry_bareMake_default
|
|
});
|
|
var import_bare_make = __toESM(require_bare_make());
|
|
var bare_lib_entry_bareMake_default = import_bare_make.default;
|
|
return __toCommonJS(bare_lib_entry_bareMake_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]["bareMake"]=v;})();
|