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

@matter/tools

Package Overview
Dependencies
Maintainers
0
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matter/tools - npm Package Compare versions

Comparing version 0.11.0-alpha.0-20241027-e40e1664f to 0.11.0-alpha.0-20241028-39fc76758

dist/cjs/util/commander.d.ts

45

dist/cjs/building/builder.js
"use strict";
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;

@@ -20,10 +18,2 @@ var __export = (target, all) => {

};
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);

@@ -36,3 +26,2 @@ var builder_exports = {};

module.exports = __toCommonJS(builder_exports);
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
var import_crypto = require("crypto");

@@ -151,3 +140,4 @@ var import_error = require("./error.js");

progress.failure("Terminating due to type errors");
process.stderr.write(e.diagnostics);
process.stderr.write(`${e.diagnostics}
`);
process.exit(1);

@@ -158,8 +148,22 @@ }

}
const formats = Array();
if (targets.has("esm" /* esm */)) {
await this.#transpile(project, progress, "esm" /* esm */);
formats.push("esm");
}
if (targets.has("cjs" /* cjs */)) {
await this.#transpile(project, progress, "cjs" /* cjs */);
formats.push("cjs");
}
if (formats.length) {
const groups = [project.pkg.isLibrary ? "library" : "app"];
if (project.pkg.hasTests) {
groups.push("tests");
}
const formatDesc = formats.map(progress.emphasize).join("+");
const groupDesc = groups.map(progress.emphasize).join("+");
await progress.run(`Transpile ${groupDesc} to ${formatDesc}`, async () => {
for (const format of formats) {
await this.#transpile(project, format);
}
});
}
await config?.after?.({ project });

@@ -173,13 +177,6 @@ if (!this.options.targets?.length) {

}
async #transpile(project, progress, format) {
const fmt = format.toUpperCase();
await progress.run(
`Transpile ${progress.emphasize(project.pkg.isLibrary ? "library" : "app")} to ${import_ansi_colors.default.bold(fmt)}`,
() => project.buildSource(format)
);
async #transpile(project, format) {
await project.buildSource(format);
if (project.pkg.hasTests) {
await progress.run(
`Transpile ${progress.emphasize("tests")} to ${import_ansi_colors.default.bold(fmt)}`,
() => project.buildTests(format)
);
await project.buildTests(format);
}

@@ -186,0 +183,0 @@ }

"use strict";
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;

@@ -20,10 +18,2 @@ var __export = (target, all) => {

};
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);

@@ -35,4 +25,3 @@ var cli_exports = {};

module.exports = __toCommonJS(cli_exports);
var import_yargs = __toESM(require("yargs"), 1);
var import_helpers = require("yargs/helpers");
var import_commander = require("../util/commander.js");
var import_builder = require("./builder.js");

@@ -58,4 +47,26 @@ var import_graph = require("./graph.js");

let mode = 0 /* BuildProject */;
const args = await (0, import_yargs.default)((0, import_helpers.hideBin)(argv)).usage("Builds packages adhering to matter.js standards.").option("prefix", { alias: "p", default: ".", type: "string", describe: "specify build directory" }).option("clean", { alias: "c", default: false, type: "boolean", describe: "clean before build" }).option("workspaces", { alias: "w", default: false, type: "boolean", describe: "build all workspace packages" }).option("dependencies", { alias: "d", default: false, type: "boolean", describe: "build dependencies" }).command("*", "build types and both JS files", () => {
}).command("clean", "remove build and dist directories", () => targets.push(import_builder.Target.clean)).command("types", "build type definitions", () => targets.push(import_builder.Target.types)).command("esm", "build JS (ES6 modules)", () => targets.push(import_builder.Target.esm)).command("cjs", "build JS (CommonJS modules)", () => targets.push(import_builder.Target.cjs)).command("graph", "display the workspace graph", () => mode = 3 /* DisplayGraph */).command("tsconfigs", "sync all tsconfigs with package.json", () => mode = 4 /* SyncTsconfigs */).wrap(Math.min(process.stdout.columns, 80)).strict().argv;
const program = (0, import_commander.commander)("matter-build", "Builds packages adhering to matter.js standards.").option("-p, --prefix <path>", "specify build directory", ".").option("-c, --clean", "clean before build", false).option("-w, --workspaces", "build all workspace packages", false).option("-d, --dependencies", "build dependencies", false);
program.command("build").description("(default) build JS and type definitions").action(() => {
});
program.command("clean").description("remove build and dist directories").action(() => {
targets.push(import_builder.Target.clean);
});
program.command("types").description("build type definitions").action(() => {
targets.push(import_builder.Target.types);
});
program.command("esm").description("build JS (ES6 modules)").action(() => {
targets.push(import_builder.Target.esm);
});
program.command("cjs").description("build JS (CommonJS modules)").action(() => {
targets.push(import_builder.Target.cjs);
});
program.command("graph").description("display the workspace graph").action(() => {
mode = 3 /* DisplayGraph */;
});
program.command("tsconfigs").description("sync all tsconfigs with package.json").action(() => {
mode = 4 /* SyncTsconfigs */;
});
program.action(() => {
});
const args = program.parse(argv).opts();
if (mode === 0 /* BuildProject */) {

@@ -62,0 +73,0 @@ if (args.workspaces) {

@@ -34,3 +34,2 @@ "use strict";

module.exports = __toCommonJS(graph_exports);
var import_map_workspaces = __toESM(require("@npmcli/map-workspaces"), 1);
var import_ansi_colors = __toESM(require("ansi-colors"), 1);

@@ -177,7 +176,7 @@ var import_package = require("../util/package.js");

static async #loadNodes(workspace) {
const workspaces = await (0, import_map_workspaces.default)({ pkg: workspace.json, cwd: workspace.path });
const workspaces = workspace.json.workspaces;
const nodeMap = {};
const allDeps = {};
for (const path of workspaces.values()) {
const pkg = new import_package.Package({ path });
const pkg = new import_package.Package({ path: workspace.resolve(path) });
allDeps[pkg.json.name] = pkg.dependencies;

@@ -184,0 +183,0 @@ nodeMap[pkg.json.name] = {

@@ -27,3 +27,2 @@ "use strict";

var import_promises = require("fs/promises");
var import_glob = require("glob");
var import_os = require("os");

@@ -50,3 +49,5 @@ var import_path = require("path");

if (!this.pkg.hasSrc) {
throw new Error(`Found package ${this.pkg.json.name} but no src directory is present`);
throw new Error(
`Found package ${this.pkg.json.name} but src directory is not present or not referenced in tsconfig.json`
);
}

@@ -146,3 +147,6 @@ }

for (const format of formats) {
await (0, import_promises.cp)(this.pkg.resolve(source), this.pkg.resolve((0, import_path.join)("dist", format, dest)));
await (0, import_promises.cp)(this.pkg.resolve(source), this.pkg.resolve((0, import_path.join)("dist", format, dest)), {
recursive: true,
force: true
});
}

@@ -195,7 +199,7 @@ }

async #targetsOf(indir, outdir, ...extensions) {
indir = this.pkg.resolve(indir).replace(/\\/g, "/");
const inputPrefixLength = this.pkg.resolve(indir).length + 1;
outdir = this.pkg.resolve(outdir).replace(/\\/g, "/");
return (await (0, import_glob.glob)(extensions.map((ext) => `${indir}/**/*.${ext}`))).map((file) => ({
return (await this.pkg.glob(extensions.map((ext) => `${indir}/**/*.${ext}`))).map((file) => ({
in: file,
out: `${outdir}/${file.slice(indir.length + 1)}`
out: `${outdir}/${file.slice(inputPrefixLength)}`
}));

@@ -202,0 +206,0 @@ }

@@ -62,3 +62,3 @@ "use strict";

}
const deps = node.dependencies.map((dep) => dep.pkg.resolve("src")).filter((p) => !p.match(/packages[\\/]tools/));
const deps = node.dependencies.filter((dep) => dep.pkg.isLibrary).map((dep) => dep.pkg.resolve("src")).filter((p) => !p.match(/packages[\\/]tools/));
const desired = [.../* @__PURE__ */ new Set([...deps, ...extraRefs])];

@@ -65,0 +65,0 @@ const newReferences = desired.map((ref) => ({ path: (0, import_path.relative)(path, ref).replace(/\\/g, "/") })).sort((ref1, ref2) => ref1.path.localeCompare(ref2.path));

@@ -6,11 +6,9 @@ /**

*/
import "./testing/global-declarations.js";
export * from "./building/builder.js";
export * from "./building/graph.js";
export * from "./building/project.js";
export * from "./testing/chip.js";
export * from "./testing/mocharc.cjs";
export * from "./util/docker.js";
export * from "./util/commander.js";
export * from "./util/files.js";
export * from "./util/package.js";
export * from "./util/progress.js";
export * from "./util/wtf.js";
//# sourceMappingURL=index.d.ts.map

@@ -18,11 +18,9 @@ "use strict";

module.exports = __toCommonJS(src_exports);
var import_global_declarations = require("./testing/global-declarations.js");
__reExport(src_exports, require("./building/builder.js"), module.exports);
__reExport(src_exports, require("./building/graph.js"), module.exports);
__reExport(src_exports, require("./building/project.js"), module.exports);
__reExport(src_exports, require("./testing/chip.js"), module.exports);
__reExport(src_exports, require("./testing/mocharc.cjs"), module.exports);
__reExport(src_exports, require("./util/docker.js"), module.exports);
__reExport(src_exports, require("./util/commander.js"), module.exports);
__reExport(src_exports, require("./util/files.js"), module.exports);
__reExport(src_exports, require("./util/package.js"), module.exports);
__reExport(src_exports, require("./util/progress.js"), module.exports);
__reExport(src_exports, require("./util/wtf.js"), module.exports);
/**

@@ -29,0 +27,0 @@ * @license

@@ -6,4 +6,6 @@ /**

*/
export * from "./commander.js";
export * from "./errors.js";
export * from "./files.js";
export * from "./package.js";
//# sourceMappingURL=index.d.ts.map

@@ -18,3 +18,5 @@ "use strict";

module.exports = __toCommonJS(util_exports);
__reExport(util_exports, require("./commander.js"), module.exports);
__reExport(util_exports, require("./errors.js"), module.exports);
__reExport(util_exports, require("./files.js"), module.exports);
__reExport(util_exports, require("./package.js"), module.exports);

@@ -21,0 +23,0 @@ /**

@@ -28,5 +28,5 @@ /**

get hasCodegen(): boolean;
resolve(path: string): string;
resolve(...paths: string[]): string;
relative(path: string): string;
glob(pattern: string): Promise<string[]>;
glob(pattern: string | string[]): Promise<string[]>;
start(what: string): Progress;

@@ -43,2 +43,3 @@ lastModified(...paths: string[]): Promise<number>;

resolveExport(name: string, type?: "cjs" | "esm"): string;
findPackage(name: string): Package;
resolveImport(name: string, type?: "cjs" | "esm"): string;

@@ -45,0 +46,0 @@ hasFile(path: string): boolean;

@@ -29,6 +29,5 @@ "use strict";

var import_promises = require("fs/promises");
var import_glob = require("glob");
var import_path = require("path");
var import_files = require("../testing/files.js");
var import_errors = require("./errors.js");
var import_files = require("./files.js");
var import_progress = require("./progress.js");

@@ -90,2 +89,11 @@ var import_tools_path = require("./tools-path.cjs");

this.hasTests = isDirectory(this.resolve("test"));
const refs = (0, import_files.maybeReadJsonSync)(this.resolve("tsconfig.json"))?.references;
if (refs !== void 0) {
if (!refs.find((ref) => this.resolve(ref.path) === this.resolve("src"))) {
this.hasSrc = false;
}
if (!refs.find((ref) => this.resolve(ref.path) === this.resolve("test"))) {
this.hasTests = false;
}
}
this.isLibrary = !!(this.json.main || this.json.module || this.json.exports);

@@ -103,4 +111,4 @@ this.hasConfig = this.hasFile(this.resolve(CONFIG_PATH));

}
resolve(path) {
return (0, import_path.resolve)(this.path, path);
resolve(...paths) {
return (0, import_path.resolve)(this.path, ...paths);
}

@@ -111,4 +119,8 @@ relative(path) {

async glob(pattern) {
pattern = this.resolve(pattern).replace(/\\/g, "/");
return await (0, import_glob.glob)(pattern);
if (typeof pattern === "string") {
pattern = this.resolve(pattern).replace(/\\/g, "/");
} else {
pattern = pattern.map((s) => this.resolve(s).replace(/\\/g, "/"));
}
return (0, import_files.globSync)(pattern);
}

@@ -199,11 +211,6 @@ start(what) {

}
resolveImport(name, type = "esm") {
const segments = name.split("/");
let subdir = segments.shift();
if (subdir.startsWith("@") && segments.length) {
subdir = `${subdir}/${segments.shift()}`;
}
findPackage(name) {
let resolveIn = this.path;
while (true) {
if (isDirectory((0, import_path.resolve)(resolveIn, "node_modules", subdir))) {
if (isDirectory((0, import_path.resolve)(resolveIn, "node_modules", name))) {
break;

@@ -213,7 +220,15 @@ }

if (nextResolveIn === resolveIn) {
throw new Error(`Cannot find module ${subdir} from ${this.path}`);
throw new Error(`Cannot find module ${name} from ${this.path}`);
}
resolveIn = nextResolveIn;
}
const pkg = Package.forPath((0, import_path.resolve)(resolveIn, "node_modules", subdir));
return Package.forPath((0, import_path.resolve)(resolveIn, "node_modules", name));
}
resolveImport(name, type = "esm") {
const segments = name.split("/");
let packageName = segments.shift();
if (packageName.startsWith("@") && segments.length) {
packageName = `${packageName}/${segments.shift()}`;
}
const pkg = this.findPackage(packageName);
return pkg.resolveExport(segments.length ? segments.join("/") : ".", type);

@@ -248,4 +263,4 @@ }

e.message = `Error parsing "${this.resolve(path)}": ${e.message}`;
throw e;
}
return JSON.parse(await this.readFile(path));
}

@@ -252,0 +267,0 @@ async writeJson(path, value) {

"use strict";
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;

@@ -20,10 +18,2 @@ var __export = (target, all) => {

};
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);

@@ -35,4 +25,3 @@ var cli_exports = {};

module.exports = __toCommonJS(cli_exports);
var import_yargs = __toESM(require("yargs"), 1);
var import_helpers = require("yargs/helpers");
var import_commander = require("../util/commander.js");
var import_package = require("../util/package.js");

@@ -47,4 +36,6 @@ var import_progress = require("../util/progress.js");

async function main(argv = process.argv) {
const args = await (0, import_yargs.default)((0, import_helpers.hideBin)(argv)).command("$0 [ver]", "Manipulate monorepo package versions.").option("prefix", { alias: "p", default: ".", type: "string", describe: "specify monorepo directory" }).option("set", { alias: "s", type: "boolean", describe: "Sets the release version" }).option("apply", { alias: "a", type: "boolean", describe: "Sets package versions to the release version" }).option("tag", { alias: "t", type: "boolean", describe: "Adds git tag for release version" }).wrap(Math.min(process.stdout.columns, 80)).strict().argv;
const version = args.ver;
const program = (0, import_commander.commander)("matter-version", "Manipulate monorepo package versions.").argument("[version]").option("-p, --prefix <prefix>", "specify monorepo directory").option("-s, --set", "sets the release version").option("-a, --apply", "sets package versions to the release version").option("-t, --tag", "adds git tag for release version").parse(argv);
const args = program.opts();
args.version = program.args[0];
const version = args.version;
const pkg = new import_package.Package({ path: args.prefix });

@@ -51,0 +42,0 @@ const versioner = new import_versioner.Versioner(pkg, version);

@@ -6,3 +6,2 @@ /**

*/
import colors from "ansi-colors";
import { createHash } from "crypto";

@@ -116,3 +115,4 @@ import { BuildError } from "./error.js";

progress.failure("Terminating due to type errors");
process.stderr.write(e.diagnostics);
process.stderr.write(`${e.diagnostics}
`);
process.exit(1);

@@ -123,8 +123,22 @@ }

}
const formats = Array();
if (targets.has("esm" /* esm */)) {
await this.#transpile(project, progress, "esm" /* esm */);
formats.push("esm");
}
if (targets.has("cjs" /* cjs */)) {
await this.#transpile(project, progress, "cjs" /* cjs */);
formats.push("cjs");
}
if (formats.length) {
const groups = [project.pkg.isLibrary ? "library" : "app"];
if (project.pkg.hasTests) {
groups.push("tests");
}
const formatDesc = formats.map(progress.emphasize).join("+");
const groupDesc = groups.map(progress.emphasize).join("+");
await progress.run(`Transpile ${groupDesc} to ${formatDesc}`, async () => {
for (const format of formats) {
await this.#transpile(project, format);
}
});
}
await config?.after?.({ project });

@@ -138,13 +152,6 @@ if (!this.options.targets?.length) {

}
async #transpile(project, progress, format) {
const fmt = format.toUpperCase();
await progress.run(
`Transpile ${progress.emphasize(project.pkg.isLibrary ? "library" : "app")} to ${colors.bold(fmt)}`,
() => project.buildSource(format)
);
async #transpile(project, format) {
await project.buildSource(format);
if (project.pkg.hasTests) {
await progress.run(
`Transpile ${progress.emphasize("tests")} to ${colors.bold(fmt)}`,
() => project.buildTests(format)
);
await project.buildTests(format);
}

@@ -177,2 +184,2 @@ }

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2J1aWxkaW5nL2J1aWxkZXIudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCAyMDIyLTIwMjQgTWF0dGVyLmpzIEF1dGhvcnNcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG4gKi9cblxuaW1wb3J0IGNvbG9ycyBmcm9tIFwiYW5zaS1jb2xvcnNcIjtcbmltcG9ydCB7IGNyZWF0ZUhhc2ggfSBmcm9tIFwiY3J5cHRvXCI7XG5pbXBvcnQgeyBQcm9ncmVzcyB9IGZyb20gXCIuLi91dGlsL3Byb2dyZXNzLmpzXCI7XG5pbXBvcnQgeyBCdWlsZEVycm9yIH0gZnJvbSBcIi4vZXJyb3IuanNcIjtcbmltcG9ydCB7IEdyYXBoIH0gZnJvbSBcIi4vZ3JhcGguanNcIjtcbmltcG9ydCB7IEJ1aWxkSW5mb3JtYXRpb24sIFByb2plY3QgfSBmcm9tIFwiLi9wcm9qZWN0LmpzXCI7XG5pbXBvcnQgeyBjcmVhdGVUeXBlc2NyaXB0Q29udGV4dCB9IGZyb20gXCIuL3R5cGVzY3JpcHQuanNcIjtcbmltcG9ydCB7IFR5cGVzY3JpcHRDb250ZXh0IH0gZnJvbSBcIi4vdHlwZXNjcmlwdC9jb250ZXh0LmpzXCI7XG5cbmV4cG9ydCBlbnV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AgICAgICAgICAgICAgIGluZm8uZGVwZW5kZW5jeUFwaVNoYXMgPSB7fTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpbmZvLmRlcGVuZGVuY3lBcGlTaGFzW2RlcC5wa2cubmFtZV0gPSBkZXAuaW5mby5hcGlTaGE7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRhcmdldHMuaGFzKFRhcmdldC50eXBlcykpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgLy8gT2J0YWluIG9yIGluaXRpYWxpemUgdHlwZXNjcmlwdCBzb2x1dGlvbiBidWlsZGVyXG4gICAgICAgICAgICAgICAgbGV0IGNvbnRleHQgPSB0aGlzLnRzQ29udGV4dDtcbiAgICAgICAgICAgICAgICBpZiAoY29udGV4dCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnRleHQgPSB0aGlzLnRzQ29udGV4dCA9IGF3YWl0IGNyZWF0ZVR5cGVzY3JpcHRDb250ZXh0KHByb2plY3QucGtnLndvcmtzcGFjZSwgZ3JhcGgpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNvbnN0IHJlZnJlc2hDYWxsYmFjayA9IHByb2dyZXNzLnJlZnJlc2guYmluZChwcm9ncmVzcyk7XG5cbiAgICAgICAgICAgICAgICBpZiAocHJvamVjdC5wa2cuaXNMaWJyYXJ5KSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGFwaVNoYSA9IGNyZWF0ZUhhc2goXCJzaGExXCIpO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIE91ciBBUEkgU0hBIGNoYW5nZXMgaWYgdGhhdCBvZiBhbnkgZGVwZW5kZW5jeSBjaGFuZ2VzXG4gICAgICAgICAgICAgICAgICAgIGlmIChub2RlKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IGRlcCBvZiBub2RlLmRlcGVuZGVuY2llcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkZXAuaW5mby5hcGlTaGEgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcGlTaGEudXBkYXRlKGRlcC5pbmZvLmFwaVNoYSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvZ3Jlc3MucnVuKGBHZW5lcmF0ZSAke3Byb2dyZXNzLmVtcGhhc2l6ZShcInR5cGUgZGVjbGFyYXRpb25zXCIpfWAsIGFzeW5jICgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IGNvbnRleHQuYnVpbGQocHJvamVjdC5wa2csIFwic3JjXCIsIHJlZnJlc2hDYWxsYmFjayk7XG4gICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm9qZWN0Lmhhc2hEZWNsYXJhdGlvbnMoYXBpU2hhKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICAgICAgaW5mby5hcGlTaGEgPSBhcGlTaGEuZGlnZXN0KFwiaGV4XCIpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb2dyZXNzLnJ1bihgVmFsaWRhdGUgJHtwcm9ncmVzcy5lbXBoYXNpemUoXCJ0eXBlc1wiKX1gLCAoKSA9PlxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC5idWlsZChwcm9qZWN0LnBrZywgXCJzcmNcIiwgcmVmcmVzaENhbGxiYWNrLCBmYWxzZSksXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChwcm9qZWN0LnBrZy5oYXNUZXN0cykge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm9ncmVzcy5ydW4oYFZhbGlkYXRlICR7cHJvZ3Jlc3MuZW1waGFzaXplKFwidGVzdCB0eXBlc1wiKX1gLCAoKSA9PlxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC5idWlsZChwcm9qZWN0LnBrZywgXCJ0ZXN0XCIsIHJlZnJlc2hDYWxsYmFjayksXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGlmIChlIGluc3RhbmNlb2YgQnVpbGRFcnJvcikge1xuICAgICAgICAgICAgICAgICAgICBwcm9ncmVzcy5mYWlsdXJlKFwiVGVybWluYXRpbmcgZHVlIHRvIHR5cGUgZXJyb3JzXCIpO1xuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzLnN0ZGVyci53cml0ZShlLmRpYWdub3N0aWNzKTtcbiAgICAgICAgICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRhcmdldHMuaGFzKFRhcmdldC5lc20pKSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLiN0cmFuc3BpbGUocHJvamVjdCwgcHJvZ3Jlc3MsIFRhcmdldC5lc20pO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRhcmdldHMuaGFzKFRhcmdldC5janMpKSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLiN0cmFuc3BpbGUocHJvamVjdCwgcHJvZ3Jlc3MsIFRhcmdldC5janMpO1xuICAgICAgICB9XG5cbiAgICAgICAgYXdhaXQgY29uZmlnPy5hZnRlcj8uKHsgcHJvamVjdCB9KTtcblxuICAgICAgICAvLyBPbmx5IHVwZGF0Z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AgICAgICAgaWYgKGdyYXBoKSB7XG4gICAgICAgICAgICBub2RlID0gZ3JhcGguZ2V0KHByb2plY3QucGtnLm5hbWUpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBkZXAgb2Ygbm9kZS5kZXBlbmRlbmNpZXMpIHtcbiAgICAgICAgICAgICAgICBpZiAoZGVwLmluZm8uYXBpU2hhICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGluZm8uZGVwZW5kZW5jeUFwaVNoYXMgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5mby5kZXBlbmRlbmN5QXBpU2hhcyA9IHt9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGluZm8uZGVwZW5kZW5jeUFwaVNoYXNbZGVwLnBrZy5uYW1lXSA9IGRlcC5pbmZvLmFwaVNoYTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGFyZ2V0cy5oYXMoVGFyZ2V0LnR5cGVzKSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAvLyBPYnRhaW4gb3IgaW5pdGlhbGl6ZSB0eXBlc2NyaXB0IHNvbHV0aW9uIGJ1aWxkZXJcbiAgICAgICAgICAgICAgICBsZXQgY29udGV4dCA9IHRoaXMudHNDb250ZXh0O1xuICAgICAgICAgICAgICAgIGlmIChjb250ZXh0ID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29udGV4dCA9IHRoaXMudHNDb250ZXh0ID0gYXdhaXQgY3JlYXRlVHlwZXNjcmlwdENvbnRleHQocHJvamVjdC5wa2cud29ya3NwYWNlLCBncmFwaCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgY29uc3QgcmVmcmVzaENhbGxiYWNrID0gcHJvZ3Jlc3MucmVmcmVzaC5iaW5kKHByb2dyZXNzKTtcblxuICAgICAgICAgICAgICAgIGlmIChwcm9qZWN0LnBrZy5pc0xpYnJhcnkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgYXBpU2hhID0gY3JlYXRlSGFzaChcInNoYTFcIik7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gT3VyIEFQSSBTSEEgY2hhbmdlcyBpZiB0aGF0IG9mIGFueSBkZXBlbmRlbmN5IGNoYW5nZXNcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5vZGUpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgZGVwIG9mIG5vZGUuZGVwZW5kZW5jaWVzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlcC5pbmZvLmFwaVNoYSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFwaVNoYS51cGRhdGUoZGVwLmluZm8uYXBpU2hhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBhd2FpdCBwcm9ncmVzcy5ydW4oYEdlbmVyYXRlICR7cHJvZ3Jlc3MuZW1waGFzaXplKFwidHlwZSBkZWNsYXJhdGlvbnNcIil9YCwgYXN5bmMgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgY29udGV4dC5idWlsZChwcm9qZWN0LnBrZywgXCJzcmNcIiwgcmVmcmVzaENhbGxiYWNrKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb2plY3QuaGFzaERlY2xhcmF0aW9ucyhhcGlTaGEpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgICBpbmZvLmFwaVNoYSA9IGFwaVNoYS5kaWdlc3QoXCJoZXhcIik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgcHJvZ3Jlc3MucnVuKGBWYWxpZGF0ZSAke3Byb2dyZXNzLmVtcGhhc2l6ZShcInR5cGVzXCIpfWAsICgpID0+XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmJ1aWxkKHByb2plY3QucGtnLCBcInNyY1wiLCByZWZyZXNoQ2FsbGJhY2ssIGZhbHNlKSxcbiAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHByb2plY3QucGtnLmhhc1Rlc3RzKSB7XG4gICAgICAgICAgICAgICAgICAgIGF3YWl0IHByb2dyZXNzLnJ1bihgVmFsaWRhdGUgJHtwcm9ncmVzcy5lbXBoYXNpemUoXCJ0ZXN0IHR5cGVzXCIpfWAsICgpID0+XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmJ1aWxkKHByb2plY3QucGtnLCBcInRlc3RcIiwgcmVmcmVzaENhbGxiYWNrKSxcbiAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgaWYgKGUgaW5zdGFuY2VvZiBCdWlsZEVycm9yKSB7XG4gICAgICAgICAgICAgICAgICAgIHByb2dyZXNzLmZhaWx1cmUoXCJUZXJtaW5hdGluZyBkdWUgdG8gdHlwZSBlcnJvcnNcIik7XG4gICAgICAgICAgICAgICAgICAgIHByb2Nlc3Muc3RkZXJyLndyaXRlKGAke2UuZGlhZ25vc3RpY3N9XFxuYCk7XG4gICAgICAgICAgICAgICAgICAgIHByb2Nlc3MuZXhpdCgxKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN0IGZvcm1hdHMgPSBBcnJheTxcImVzbVwiIHwgXCJjanNcIj4oKTtcbiAgICAgICAgaWYgKHRhcmdldHMuaGFzKFRhcmdldC5lc20pKSB7XG4gICAgICAgICAgICBmb3JtYXRzLnB1c2goXCJlc21cIik7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRhcmdldHMuaGFzKFRhcmdldC5janMpKSB7XG4gICAgICAgICAgICBmb3JtYXRzLnB1c2goXCJjanNcIik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZm9ybWF0cy5sZW5ndGgpIHtcbiAgICAgICAgICAgIGNvbnN0IGdyb3VwcyA9IFtwcm9qZWN0LnBrZy5pc0xpYnJhcnkgPyBcImxpYnJhcnlcIiA6IFwiYXBwXCJdO1xuICAgICAgICAgICAgaWYgKHByb2plY3QucGtnLmhhc1Rlc3RzKSB7XG4gICAgICAgICAgICAgICAgZ3JvdXBzLnB1c2goXCJ0ZXN0c1wiKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29uc3QgZm9ybWF0RGVzYyA9IGZvcm1hdHMubWFwKHByb2dyZXNzLmVtcGhhc2l6ZSkuam9pbihcIitcIik7XG4gICAgICAgICAgICBjb25zdCBncm91cERlc2MgPSBncm91cHMubWFwKHByb2dyZXNzLmVtcGhhc2l6ZSkuam9pbihcIitcIik7XG5cbiAgICAgICAgICAgIGF3YWl0IHByb2dyZXNzLnJ1bihgVHJhbnNwaWxlICR7Z3JvdXBEZXNjfSB0byAke2Zvcm1hdERlc2N9YCwgYXN5bmMgKCkgPT4ge1xuICAgICAgICAgICAgICAgIGZvciAoY29uc3QgZm9ybWF0IG9mIGZvcm1hdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy4jdHJhbnNwaWxlKHByb2plY3QsIGZvcm1hdCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICBhd2FpdCBjb25maWc/LmFmdGVyPy4oeyBwcm9qZWN0IH0pO1xuXG4gICAgICAgIC8vIE9ub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FFQSxVQUFJLFFBQVEsSUFBSSxhQUFhO0FBQ3pCLGdCQUFRLElBQUksZUFBVTtBQUFBLE1BQzFCO0FBQUEsSUFDSixPQUFPO0FBQ0gsVUFBSSxDQUFDLFFBQVEsSUFBSSxhQUFhO0FBQzFCLGdCQUFRLE9BQU8sZUFBVTtBQUFBLE1BQzdCO0FBRUEsVUFBSSxDQUFDLFFBQVEsSUFBSSxhQUFhO0FBQzFCLGdCQUFRLE9BQU8sZUFBVTtBQUFBLE1BQzdCO0FBQUEsSUFDSjtBQUVBLFdBQU87QUFBQSxFQUNYO0FBQ0o7IiwKICAibmFtZXMiOiBbIlRhcmdldCJdCn0K

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

*/
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { commander } from "../util/commander.js";
import { Builder, Target } from "./builder.js";

@@ -24,4 +23,26 @@ import { Graph } from "./graph.js";

let mode = 0 /* BuildProject */;
const args = await yargs(hideBin(argv)).usage("Builds packages adhering to matter.js standards.").option("prefix", { alias: "p", default: ".", type: "string", describe: "specify build directory" }).option("clean", { alias: "c", default: false, type: "boolean", describe: "clean before build" }).option("workspaces", { alias: "w", default: false, type: "boolean", describe: "build all workspace packages" }).option("dependencies", { alias: "d", default: false, type: "boolean", describe: "build dependencies" }).command("*", "build types and both JS files", () => {
}).command("clean", "remove build and dist directories", () => targets.push(Target.clean)).command("types", "build type definitions", () => targets.push(Target.types)).command("esm", "build JS (ES6 modules)", () => targets.push(Target.esm)).command("cjs", "build JS (CommonJS modules)", () => targets.push(Target.cjs)).command("graph", "display the workspace graph", () => mode = 3 /* DisplayGraph */).command("tsconfigs", "sync all tsconfigs with package.json", () => mode = 4 /* SyncTsconfigs */).wrap(Math.min(process.stdout.columns, 80)).strict().argv;
const program = commander("matter-build", "Builds packages adhering to matter.js standards.").option("-p, --prefix <path>", "specify build directory", ".").option("-c, --clean", "clean before build", false).option("-w, --workspaces", "build all workspace packages", false).option("-d, --dependencies", "build dependencies", false);
program.command("build").description("(default) build JS and type definitions").action(() => {
});
program.command("clean").description("remove build and dist directories").action(() => {
targets.push(Target.clean);
});
program.command("types").description("build type definitions").action(() => {
targets.push(Target.types);
});
program.command("esm").description("build JS (ES6 modules)").action(() => {
targets.push(Target.esm);
});
program.command("cjs").description("build JS (CommonJS modules)").action(() => {
targets.push(Target.cjs);
});
program.command("graph").description("display the workspace graph").action(() => {
mode = 3 /* DisplayGraph */;
});
program.command("tsconfigs").description("sync all tsconfigs with package.json").action(() => {
mode = 4 /* SyncTsconfigs */;
});
program.action(() => {
});
const args = program.parse(argv).opts();
if (mode === 0 /* BuildProject */) {

@@ -72,2 +93,2 @@ if (args.workspaces) {

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2J1aWxkaW5nL2NsaS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IDIwMjItMjAyNCBNYXR0ZXIuanMgQXV0aG9yc1xuICogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFwYWNoZS0yLjBcbiAqL1xuXG5pbXBvcnQgeWFyZ3MgZnJvbSBcInlhcmdzXCI7XG5pbXBvcnQgeyBoaWRlQmluIH0gZnJvbSBcInlhcmdzL2hlbHBlcnNcIjtcbmltcG9ydCB7IEJ1aWxkZXIsIFRhcmdldCB9IGZyb20gXCIuL2J1aWxkZXIuanNcIjtcbmltcG9ydCB7IEdyYXBoIH0gZnJvbSBcIi4vZ3JhcGguanNcIjtcbmltcG9ydCB7IFByb2plY3QgfSBmcm9tIFwiLi9wcm9qZWN0LmpzXCI7XG5pbXBvcnQgeyBzeW5jQWxsVHNjb25maWdzIH0gZnJvbSBcIi4vdHNjb25maWcuanNcIjtcblxuZW51bSBNb2RlIHtcbiAgICBCdWlsZFByb2plY3QsXG4gICAgQnVpbGRQcm9qZWN0V2l0aERlcGVuZGVuY2llcyxcbi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hdXNlICR7YXJncy5wcmVmaXh9IGlzIG5vdCBpbiBhIHdvcmtzcGFjZWApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBhd2FpdCBncmFwaC5idWlsZChidWlsZGVyKGdyYXBoKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBicmVhaztcblxuICAgICAgICBjYXNlIE1vZGUuQnVpbGRXb3Jrc3BhY2U6XG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgICAgY29uc3QgZ3JhcGggPSBhd2FpdCBHcmFwaC5sb2FkKCk7XG4gICAgICAgICAgICAgICAgYXdhaXQgc3luY0FsbFRzY29uZmlncyhncmFwaCk7XG4gICAgICAgICAgICAgICAgYXdhaXQgZ3JhcGguYnVpbGQoYnVpbGRlcihncmFwaCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgY2FzZSBNb2RlLkRpc3BsYXlHcmFwaDpcbiAgICAgICAgICAgIChhd2FpdCBHcmFwaC5sb2FkKCkpLmRpc3BsYXkoKTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgTW9kZS5TeW5jVHNjb25maWdzOlxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICAgIGNvbnN0IGdyYXBoID0gYXdhaXQgR3JhcGgubG9hZCgpO1xuICAgICAgICAgICAgICAgIGF3YWl0IHN5bmNBbGxUc2NvbmZpZ3MoZ3JhcGgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxufVxuIl0sCiAgIm1hcHBpbmdzIjogIkFBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQU1BLFNBQVMsaUJBQWlCO0FBQzFCLFNBQVMsU0FBUyxjQUFjO0FBQ2hDLFNBQVMsYUFBYTtBQUN0QixTQUFTLGVBQWU7QUFDeEIsU0FBUyx3QkFBd0I7QUFFakMsSUFBSyxPQUFMLGtCQUFLQSxVQUFMO0F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ztBQUMvQixjQUFNLGlCQUFpQixLQUFLO0FBQzVCLGNBQU0sTUFBTSxNQUFNLFFBQVEsS0FBSyxDQUFDO0FBQUEsTUFDcEM7QUFDQTtBQUFBLElBRUosS0FBSztBQUNELE9BQUMsTUFBTSxNQUFNLEtBQUssR0FBRyxRQUFRO0FBQzdCO0FBQUEsSUFFSixLQUFLO0FBQ0Q7QUFDSSxjQUFNLFFBQVEsTUFBTSxNQUFNLEtBQUs7QUFDL0IsY0FBTSxpQkFBaUIsS0FBSztBQUFBLE1BQ2hDO0FBQ0E7QUFBQSxFQUNSO0FBQ0o7IiwKICAibmFtZXMiOiBbIk1vZGUiXQp9Cg==

@@ -6,3 +6,2 @@ /**

*/
import mapWorkspaces from "@npmcli/map-workspaces";
import colors from "ansi-colors";

@@ -144,7 +143,7 @@ import { JsonNotFoundError, Package } from "../util/package.js";

static async #loadNodes(workspace) {
const workspaces = await mapWorkspaces({ pkg: workspace.json, cwd: workspace.path });
const workspaces = workspace.json.workspaces;
const nodeMap = {};
const allDeps = {};
for (const path of workspaces.values()) {
const pkg = new Package({ path });
const pkg = new Package({ path: workspace.resolve(path) });
allDeps[pkg.json.name] = pkg.dependencies;

@@ -193,2 +192,2 @@ nodeMap[pkg.json.name] = {

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2J1aWxkaW5nL2dyYXBoLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgMjAyMi0yMDI0IE1hdHRlci5qcyBBdXRob3JzXG4gKiBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogQXBhY2hlLTIuMFxuICovXG5cbmltcG9ydCBtYXBXb3Jrc3BhY2VzIGZyb20gXCJAbnBtY2xpL21hcC13b3Jrc3BhY2VzXCI7XG5pbXBvcnQgY29sb3JzIGZyb20gXCJhbnNpLWNvbG9yc1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ICAgICAgaWYgKGJ1aWxkZXIuaGFzQ2xlYW4gfHwgbmVlZHNDb25maWcpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgLy8gV2UgY2xlYW4gYWxsIHBhY2thZ2VzIGJlZm9yZSBlbmdhZ2luZyB0eXBlc2NyaXB0IGJlY2F1c2Ugb3RoZXJ3aXNlIGl0IHNlZW1zIHRvIGdldCBjb25mdXNlZFxuICAgICAgICAgICAgICAgIGlmIChidWlsZGVyLmhhc0NsZWFuKSB7XG4gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuY2xlYXJDbGVhbigpO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IG5vZGUgb2YgdGhpcy5ub2Rlcykge1xuICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgbm9kZS5wcm9qZWN0LmNsZWFuKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlLmluZm8gPSB7fTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIFdlIGNvbmZpZ3VyZSBlYWNoIGJ1aWxkIGJlZm9yZSBidWlsZGluZyBzbyB0aGF0IGFueSBnZW5lcmF0ZWQgZmlsZXMgYXJlIGluIHBsYWNlIGJlZm9yZSB3ZSBpbml0aWF0ZSB0aGUgYnVpbGRcbiAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IG5vZGUgb2YgdGhpcy5ub2Rlcykge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIW5vZGUucGtnLmhhc0NvbmZpZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgYnVpbGRlci5jb25maWd1cmUobm9kZS5wcm9qZWN0KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihcIlRlcm1pbmF0aW5nIGR1ZSB0byBwcmVidWlsZCBlcnJvcjpcIiwgZSk7XG4gICAgICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgd2hpbGUgKHRvQnVpbGQuc2l6ZSkge1xuICAgICAgICAgICAgbGV0IG5vZGU7XG5cbiAgICAgICAgICAgIG5vZGVzOiBmb3IgKG5vZGUgb2YgdG9CdWlsZCkge1xuICAgICAgICAgICAgICAgIGZvciAoY29uc3QgZGVwIG9mIG5vZGUuZGVwZW5kZW5jaWVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkZXAuaXNEaXJ0eSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWUgbm9kZXM7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghbm9kZSkge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcIkludGVybmFsIGxvZ2ljIGVycm9yOiBObyB1bmJ1aWx0IHByb2plY3QgaGFzIGZ1bGx5IGJ1aWx0IGRlcGVuZGVuY2llc1wiKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChub2RlLmlzRGlydHkgfHwgYnVpbGRlci51bmNvbmRpdGlvbmFsKSB7XG4gICAgICAgICAgICAgICAgYXdhaXQgYnVpbGRlci5idWlsZChub2RlLnByb2plY3QpO1xuICAgICAgICAgICAgICAgIG5vZGUuaW5mby50aW1lc3RhbXAgPSBuZXcgRGF0ZSgpLnRvSVNPU3RyaW5nKCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHNob3dTa2lwcGVkKSB7XG4gICAgICAgICAgICAgICAgbmV3IFByb2dyZXNzKCkuc2tpcChcIlVwIHRvIGRhdGVcIiwgbm9kZS5wa2c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cuaGFzRmlsZShCVUlMRF9JTkZPX0xPQ0FUSU9OKSkge1xuICAgICAgICAgICAgICAgICAgICBub2RlLmluZm8gPSBhd2FpdCBub2RlLnBrZy5yZWFkSnNvbihCVUlMRF9JTkZPX0xPQ0FUSU9OKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBub2RlLm1vZGlmeVRpbWUgPSBhd2FpdCBub2RlLnBrZy5sYXN0TW9kaWZpZWQoXCJwYWNrYWdlLmpzb25cIiwgXCJzcmNcIiwgXCJ0ZXN0XCIpO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIG5vZGU7XG4gICAgICAgICAgICB9KSxcbiAgICAgICAgKTtcblxuICAgICAgICBjb25zdCBzdGFjayA9IEFycmF5PEdyYXBoLk5vZGU+KCk7XG4gICAgICAgIGZ1bmN0aW9uIGZpbmRDaXJjdWxhcihub2RlOiBHcmFwaC5Ob2RlKSB7XG4gICAgICAgICAgICBpZiAoc3RhY2suaW5kZXhPZihub2RlKSAhPT0gLTEpIHtcbiAgICAgICAgICAgICAgICBzdGFjay5wdXNoKG5vZGUpO1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbnRlcm5hbEJ1aWxkRXJyb3IoYENpcmN1bGFyIGRlcGVuZGVuY3k6ICR7c3RhY2subWFwKGZvcm1hdERlcCkuam9pbihcIiBcdTI1QjggXCIpfWApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgc3RhY2sucHVzaChub2RlKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgZGVwIG9mIG5vZGUuZGVwZW5kZW5jaWVzKSB7XG4gICAgICAgICAgICAgICAgZmluZENpcmN1bGFyKGRlcCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzdGFjay5wb3AoKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IG5vZGUgb2YgZ3JhcGgubm9kZXMpIHtcbiAgICAgICAgICAgIGZpbmRDaXJjdWxhcihub2RlKTtcb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GdldCBpc0RpcnR5KCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gKFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5tb2RpZnlUaW1lID4gdGhpcy5idWlsZFRpbWUgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICEhdGhpcy5kZXBlbmRlbmNpZXMuZmluZChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXAgPT5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwLmlzRGlydHkgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGRlcC5idWlsZFRpbWUgPiB0aGlzLmJ1aWxkVGltZSAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGRlcC5pbmZvLmFwaVNoYSA9PT0gdW5kZWZpbmVkIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwLmluZm8uYXBpU2hhICE9PSB0aGlzLmluZm8uZGVwZW5kZW5jeUFwaVNoYXM/LltkZXAucGtnLm5hbWVdKSksXG4gICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cblxuICAgICAgICBmb3IgKGNvbnN0IG5hbWUgaW4gYWxsRGVwcykge1xuICAgICAgICAgICAgZm9yIChjb25zdCBkZXAgb2YgYWxsRGVwc1tuYW1lXSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGRlcE5vZGUgPSBub2RlTWFwW2RlcF07XG5cbiAgICAgICAgICAgICAgICAvLyBOb3RlIC0tIGFsbG93IG5vZGVzIHRvIHJlZmVyZW5jZSB0aGVtc2VsdmVzLCBzZWVtcyB0byBiZSBuZWNlc3Nhcnkgb24gdG9vbHMgZm9yIHVzZSBvZiB0c2NcbiAgICAgICAgICAgICAgICBpZiAoZGVwTm9kZSAmJiBkZXBOb2RlICE9PSBub2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gICAgICAgICAgaWYgKGJ1aWxkZXIuaGFzQ2xlYW4pIHtcbiAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5jbGVhckNsZWFuKCk7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3Qgbm9kZSBvZiB0aGlzLm5vZGVzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBhd2FpdCBub2RlLnByb2plY3QuY2xlYW4oKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUuaW5mbyA9IHt9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gV2UgY29uZmlndXJlIGVhY2ggYnVpbGQgYmVmb3JlIGJ1aWxkaW5nIHNvIHRoYXQgYW55IGdlbmVyYXRlZCBmaWxlcyBhcmUgaW4gcGxhY2UgYmVmb3JlIHdlIGluaXRpYXRlIHRoZSBidWlsZFxuICAgICAgICAgICAgICAgIGZvciAoY29uc3Qgbm9kZSBvZiB0aGlzLm5vZGVzKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghbm9kZS5wa2cuaGFzQ29uZmlnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBhd2FpdCBidWlsZGVyLmNvbmZpZ3VyZShub2RlLnByb2plY3QpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKFwiVGVybWluYXRpbmcgZHVlIHRvIHByZWJ1aWxkIGVycm9yOlwiLCBlKTtcbiAgICAgICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB3aGlsZSAodG9CdWlsZC5zaXplKSB7XG4gICAgICAgICAgICBsZXQgbm9kZTtcblxuICAgICAgICAgICAgbm9kZXM6IGZvciAobm9kZSBvZiB0b0J1aWxkKSB7XG4gICAgICAgICAgICAgICAgZm9yIChjb25zdCBkZXAgb2Ygbm9kZS5kZXBlbmRlbmNpZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRlcC5pc0RpcnR5KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZSBub2RlcztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCFub2RlKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwiSW50ZXJuYWwgbG9naWMgZXJyb3I6IE5vIHVuYnVpbHQgcHJvamVjdCBoYXMgZnVsbHkgYnVpbHQgZGVwZW5kZW5jaWVzXCIpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKG5vZGUuaXNEaXJ0eSB8fCBidWlsZGVyLnVuY29uZGl0aW9uYWwpIHtcbiAgICAgICAgICAgICAgICBhd2FpdCBidWlsZGVyLmJ1aWxkKG5vZGUucHJvamVjdCk7XG4gICAgICAgICAgICAgICAgbm9kZS5pbmZvLnRpbWVzdGFtcCA9IG5ldyBEYXRlKCkudG9JU09TdHJpbmcoKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoc2hvd1NraXBwZWQpIHtcbiAgICAgICAgICAgICAgICBuZXcgUHJvZ3Jlc3MoKS5za2lwKFwiVXAgdG8gZGF0ZVwiLCBub2RlLnBrZyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHRvQnVpbGQuZGVsZXRlKG5vZGUpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZGlzcGxheSgpIHtcbiAgICAgICAgZm9yIChjb25zdCBub2RlIG9mIHRoaXMubm9kZXMpIHtcbiAgICAgICAgICAgIGNvbnN0IHByb2dyZXNzID0gbm9kZS5wa2cuc3RhcnQoXCJOb2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5vZGUucGtnLmxhc3RNb2RpZmllZChcInBhY2thZ2UuanNvblwiLCBcInNyY1wiLCBcInRlc3RcIik7XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gbm9kZTtcbiAgICAgICAgICAgIH0pLFxuICAgICAgICApO1xuXG4gICAgICAgIGNvbnN0IHN0YWNrID0gQXJyYXk8R3JhcGguTm9kZT4oKTtcbiAgICAgICAgZnVuY3Rpb24gZmluZENpcmN1bGFyKG5vZGU6IEdyYXBoLk5vZGUpIHtcbiAgICAgICAgICAgIGlmIChzdGFjay5pbmRleE9mKG5vZGUpICE9PSAtMSkge1xuICAgICAgICAgICAgICAgIHN0YWNrLnB1c2gobm9kZSk7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEludGVybmFsQnVpbGRFcnJvcihgQ2lyY3VsYXIgZGVwZW5kZW5jeTogJHtzdGFjay5tYXAoZm9ybWF0RGVwKS5qb2luKFwiIFx1MjVCOCBcIil9YCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBzdGFjay5wdXNoKG5vZGUpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBkZXAgb2Ygbm9kZS5kZXBlbmRlbmNpZXMpIHtcbiAgICAgICAgICAgICAgICBmaW5kQ2lyY3VsYXIoZGVwKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHN0YWNrLnBvcCgpO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3Qgbm9kZSBvZiBncmFwaC5ub2Rlcykge1xuICAgICAgICAgICAgZmluZENpcmN1bGFyKG5vZGUpO1xuICAgICAgICB9XG5cbiAgICAgICAgcmV0dXJuIGdyYXBoO1xuICAgIH1cblxuICAgIHN0YXRpYyBhc3luYyAjbG9hZE5vZGVzKHdvcmtzcGFjZTogUGFja2FnZSkge1xuICAgICAgICBjb25zdCB3b3Jrc3BhY2VzID0gd29ya3NwYWNlLmpzb24ud29ya3NwYWNlcztcblxuICAgICAgICBjb25zdCBub2RlTWFwID0ge30gYXMgUmVjb3JkPHN0cmluZywgR3JhcGguTm9kZT47XG4gICAgICAgIGNvbnN0IGFsbERlcHMgPSB7fSBhcyBSZWNvcmQ8c3RyaW5nLCBzdHJpbmdbXT47XG4gICAgICAgIGZvciAoY29uc3QgcGF0aCBvZiB3b3Jrc3BhY2VzLnZhbHVlcygpKSB7XG4gICAgICAgICAgICBjb25zdCBwa2cgPSBuZXcgUGFja2FnZSh7IHBhdGg6IHdvcmtzcGFjZS5yZXNvbHZlKHBhdGgpIH0pO1xuICAgICAgICAgICAgYWxsRGVwc1twa2cuanNvbi5uYW1lXSA9IHBrZy5kZXBlbmRlbmNpZXM7XG4gICAgICAgICAgICBub2RlTWFwW3BrZy5qc29uLm5hbWVdID0ge1xuICAgICAgICAgICAgICAgIHBrZyxcbiAgICAgICAgICAgICAgICBwcm9qZWN0OiBuZXcgUHJvamVjdChwa2cpLFxuICAgICAgICAgICAgICAgIGRlcGVuZGVuY2llczogW10sXG4gICAgICAgICAgICAgICAgaW5mbzoge30sXG4gICAgICAgICAgICAgICAgbW9kaWZ5VGltZTogMCxcblxuICAgICAgICAgICAgICAgIGdldCBidWlsZFRpbWUoKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmluZm8udGltZXN0YW1wID8gbmV3IERhdGUodGhpcy5pbmZvLnRpbWVzdGFtcCkuZ2V0VGltZSgpIDogMDtcbiAgICAgICAgICAgICAgICB9LFxuXG4gICAgICAgICAgICAgICAgZ2V0IGlzRGlydHkoKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAoXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm1vZGlmeVRpbWUgPiB0aGlzLmJ1aWxkVGltZSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgISF0aGlzLmRlcGVuZGVuY2llcy5maW5kKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlcCA9PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXAuaXNEaXJ0eSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZGVwLmJ1aWxkVGltZSA+IHRoaXMuYnVpbGRUaW1lICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZGVwLmluZm8uYXBpU2hhID09PSB1bmRlZmluZWQgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXAuaW5mby5hcGlTaGEgIT09IHRoaXMuaW5mby5kZXBlbmRlbmN5QXBpU2hhcz8uW2RlcC5wa2cubmFtZV0pKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuXG4gICAgICAgIGZvciAoY29uc3QgbmFtZSBpbiBhbGxEZXBzKSB7XG4gICAgICAgICAgICBmb3IgKGNvbnN0IGRlcCBvZiBhbGxEZXBzW25hbWVdKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZGVwTm9kZSA9IG5vZGVNYXBbZGVwXTtcblxuICAgICAgICAgICAgICAgIC8vIE5vdGUgLS0gYWxsb3cgbm9kZXMgdG8gcmVmZXJlbmNlIHRoZW1zZWx2ZXMsIHNlZW1zIHRvIGJlIG5lY2Vzc2FyeSBvbiB0b29scyBmb3IgdXNlIG9mIHRzY1xuICAgICAgICAgICAgICAgIGlmIChkZXBOb2RlICYmIGRlcE5vZGUgIT09IG5vZGVNYXBbbmFtZV0pIHtcbiAgICAgICAgICAgICAgICAgICAgbm9kZU1hcFtuYW1lXS5kZXBlbmRlbmNpZXMucHVzaChkZXBOb2RlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gbm9kZU1hcDtcbiAgICB9XG59XG5cbmV4cG9ydCBuYW1lc3BhY2UgR3JhcGgge1xuICAgIGV4cG9ydCBpbnRlcmZhY2UgTm9kZSB7XG4gICA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FQUFFLE1BQU0sR0FBRyxFQUFFLENBQUMsRUFBRSxRQUFRLEtBQUssR0FBRztBQUN2RztBQUVBLFNBQVMsVUFBVSxNQUFrQjtBQUNqQyxTQUFPLEtBQUssSUFBSSxLQUFLLFFBQVEsY0FBYyxFQUFFO0FBQ2pEOyIsCiAgIm5hbWVzIjogWyJub2RlIl0KfQo=

@@ -8,3 +8,2 @@ /**

import { cp, mkdir, readFile, rm, symlink, writeFile } from "fs/promises";
import { glob } from "glob";
import { platform } from "os";

@@ -26,3 +25,5 @@ import { dirname, join } from "path";

if (!this.pkg.hasSrc) {
throw new Error(`Found package ${this.pkg.json.name} but no src directory is present`);
throw new Error(
`Found package ${this.pkg.json.name} but src directory is not present or not referenced in tsconfig.json`
);
}

@@ -122,3 +123,6 @@ }

for (const format of formats) {
await cp(this.pkg.resolve(source), this.pkg.resolve(join("dist", format, dest)));
await cp(this.pkg.resolve(source), this.pkg.resolve(join("dist", format, dest)), {
recursive: true,
force: true
});
}

@@ -171,7 +175,7 @@ }

async #targetsOf(indir, outdir, ...extensions) {
indir = this.pkg.resolve(indir).replace(/\\/g, "/");
const inputPrefixLength = this.pkg.resolve(indir).length + 1;
outdir = this.pkg.resolve(outdir).replace(/\\/g, "/");
return (await glob(extensions.map((ext) => `${indir}/**/*.${ext}`))).map((file) => ({
return (await this.pkg.glob(extensions.map((ext) => `${indir}/**/*.${ext}`))).map((file) => ({
in: file,
out: `${outdir}/${file.slice(indir.length + 1)}`
out: `${outdir}/${file.slice(inputPrefixLength)}`
}));

@@ -184,2 +188,2 @@ }

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2J1aWxkaW5nL3Byb2plY3QudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCAyMDIyLTIwMjQgTWF0dGVyLmpzIEF1dGhvcnNcbiAqIFNQRF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iAgICAgICAgICAgIGF3YWl0IGNwKHRoaXMucGtnLnJlc29sdmUoc291cmNlKSwgdGhpcy5wa2cucmVzb2x2ZShqb2luKFwiZGlzdFwiLCBmb3JtYXQsIGRlc3QpKSk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBhc3luYyAjYnVpbGQoZm9ybWF0OiBGb3JtYXQsIGluZGlyOiBzdHJpbmcsIG91dGRpcjogc3RyaW5nKSB7XG4gICAgICAgIGNvbnN0IGVudHJ5UG9pbnRzID0gYXdhaXQgdGhpcy4jdGFyZ2V0c09mKGluZGlyLCBvdXRkaXIsIFwidHNcIiwgXCJqc1wiKTtcblxuICAgICAgICBjb25zdCBjb25maWdQYXRoID0gdGhpcy5wa2cucmVzb2x2ZShDT05GSUdfUEFUSCk7XG4gICAgICAgIGZvciAoY29uc3QgZW50cnkgb2YgZW50cnlQb2ludHMpIHtcbiAgICAgICAgICAgIGlmIChlbnRyeS5pbiA9PT0gY29uZmlnUGF0aCkge1xuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZW50cnkub3V0ID0gZW50cnkub3V0LnJlcGxhY2UoL1xcLltqdF1zJC8sIFwiXCIpO1xuICAgICAgICB9XG5cbiAgICAgICAgYXdhaXQgZXNidWlsZCh7XG4gICAgICAgICAgICBlbnRyeVBvaW50cyxcbiAgICAgICAgICAgIG91dGRpcjogdGhpcy5wa2cucGF0aCxcbiAgICAgICAgICAgIGZvcm1hdCxcbiAgICAgICAgICAgIHNvdXJjZW1hcDogdHJ1ZSxcbiAgICAgICAgICAgIHNvdXJjZXNDb250ZW50OiBmYWxzZSxcbiAgICAgICAgICAgIGFic1dvcmtpbmdEaXI6IGRpcm5hbWUodGhpcy5wa2cucmVzb2x2ZShpbmRpcikpLFxuXG4gICAgICAgICAgICAvLyBUaGlzIGlzIG5lY2Vzc2FyeSB0byBkb3dubGV2ZWwgXCJ1c2luZ1wiXG4gICAgICAgICAgICB0YXJnZXQ6IFwiZXMyMDIyXCIsXG5cbiAgICAgICAgICAgIGxvZ092ZXJyaWRlOiB7XG4gICAgICAgICAgICAgICAgXCJkaXJlY3QtZXZhbFwiOiBcInNpbGVudFwiLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgfSk7XG5cbiAgICAgICAgZm9yIChjb25zdCBlbnRyeSBvZiBhd2FpdCB0aGlzLiN0YXJnZXRzT2YoaW5kaXIsIG91dGRpciwgXCJjanNcIiwgXCJtanNcIiwgXCJkLmN0c1wiLCBcImQubXRzXCIpKSB7XG4gICAgICAgICAgICBhd2FpdCBjcChlbnRyeS5pbiwgZW50cnkub3V0KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGFzeW5jICNjb25maWd1cmVGb3JtYXQoZGlyOiBzdHJpbmcsIGZvcm1hdDogRm9ybWF0LCBpc0Rpc3Q6IGJvb2xlYW4pIHtcbiAgICAgICAgLy8gQnVpbGQgaW1wb3J0IG1hcFxuICAgICAgICBsZXQgeyBpbXBvcnRzIH0gPSB0aGlzLnBrZy5qc29uO1xuICAgICAgICBpZiAoaXNEaXN0ICYmIHR5cGVvZiBpbXBvcnRzID09PSBcIm9iamVjdFwiKSB7XG4gICAgICAgICAgICBpbXBvcnRzID0geyAuLi5pbXBvcnRzIH07XG4gICAgICAgICAgICBmb3IgKGNvbnN0IGtleSBpbiBpbXBvcnRzKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBpbXBvcnRzW2tleV07XG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gXCJzdHJpbmdcIikge1xuICAgICAgICAgICAgICAgICAgICBpbXBvcnRzW2tleV0gPSB2YWx1ZS5yZXBsYWNlKC9eXFwuXFwvc3JjXFwvLywgXCIuL1wiKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBXcml0ZSBwYWNrYWdlLmpzb25cbiAgICAgICAgY29uc3Qgc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3RcIiwgYGJ1aWxkLyR7Zm9ybWF0fS90ZXN0YCk7XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBzcmMgPSBgZGlzdC8ke2Zvcm1hdH1gO1xuICAgICAgICBjb25zdCBkZXN0ID0gYGJ1aWxkLyR7Zm9ybWF0fS9zcmNgO1xuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBkZXN0UGF0aCA9IHRoaXMucGtnLnJlc29sdmUoZGVzdCk7XG4gICAgICAgICAgICBhd2FpdCBta2RpcihkaXJuYW1lKGRlc3RQYXRoKSwgeyByZWN1cnNpdmU6IHRydWUgfSk7XG4gICAgICAgICAgICBhd2FpdCBpZ25vcmVFcnJvcihcIkVFWElTVFwiLCBhc3luYyAoKSA9PiBhd2FpdCBzeW1saW5rKHRoaXMucGtnLnJlc29sdmUoc3JjKSwgZGVzdFBhdGgpKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgaWYgKChlIGFzIGFueSkuY29kZSA9PT0gXCJFUEVSTVwiICYmIHBsYXRmb3JtKCkgPT09IFwid2luMzJcIikge1xuICAgICAgICAgICAgICAgIC8vIElmIGRldmVsb3BlciBtb2RlIGlzIG5vdCBlbmFibGVkLCB3ZSBjYW4ndCBjcmVhdGUgYSBzeW1saW5rXG4gICAgICAgICAgICAgICAgLy8gb24gV2luZG93cy4gIENvcHkgaW5zdGVhZFxuICAgICAgICAgICAgICAgIGF3YWl0IGNwKHRoaXMucGtnLnJlc29sdmUoc3JjKSwgdGhpcy5wa2cucmVzb2x2ZShkZXN0KSwge1xuICAgICAgICAgICAgICAgICAgICByZWN1cnNpdmU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgIGZvcmNlOiB0cnVlLFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHR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yA9IChhd2FpdCBpbXBvcnQoYGZpbGU6Ly8ke291dGZpbGV9YCkpIGFzIFByb2plY3QuQ29uZmlnIHwgdW5kZWZpbmVkO1xuICAgICAgICB0aGlzLiNjb25maWd1cmVkID0gdHJ1ZTtcblxuICAgICAgICBpZiAodGhpcy4jY29uZmlnPy5zdGFydHVwKSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLiNjb25maWc/LnN0YXJ0dXAoe1xuICAgICAgICAgICAgICAgIHByb2plY3Q6IHRoaXMsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzLiNjb25maWc7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ29weSBmaWxlcyBpbnRvIGRpc3QgZm9yIHN1cHBvcnRlZCBmb3JtYXRzLlxuICAgICAqL1xuICAgIGFzeW5jIGNvcHlUb0Rpc3Qoc291cmNlOiBzdHJpbmcsIGRlc3Q6IHN0cmluZykge1xuICAgICAgICBjb25zdCBmb3JtYXRzID0gQXJyYXk8c3RyaW5nPigpO1xuICAgICAgICBpZiAodGhpcy5wa2cuc3VwcG9ydHNFc20pIHtcbiAgICAgICAgICAgIGZvcm1hdHMucHVzaChcImVzbVwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5wa2cuc3VwcG9ydHNDanMpIHtcbiAgICAgICAgICAgIGZvcm1hdHMucHVzaChcImNqc1wiKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IGZvcm1hdCBvZiBmb3JtYXRzKSB7XG4gICAgICAgICAgICBhd2FpdCBjcCh0aGlzLnBrZy5yZXNvbHZlKHNvdXJjZSksIHRoaXMucGtnLnJlc29sdmUoam9pbihcImRpc3RcIiwgZm9ybWF0LCBkZXN0KSksIHtcbiAgICAgICAgICAgICAgICByZWN1cnNpdmU6IHRydWUsXG4gICAgICAgICAgICAgICAgZm9yY2U6IHRydWUsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGFzeW5jICNidWlsZChmb3JtYXQ6IEZvcm1hdCwgaW5kaXI6IHN0cmluZywgb3V0ZGlyOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3QgZW50cnlQb2ludHMgPSBhd2FpdCB0aGlzLiN0YXJnZXRzT2YoaW5kaXIsIG91dGRpciwgXCJ0c1wiLCBcImpzXCIpO1xuXG4gICAgICAgIGNvbnN0IGNvbmZpZ1BhdGggPSB0aGlzLnBrZy5yZXNvbHZlKENPTkZJR19QQVRIKTtcbiAgICAgICAgZm9yIChjb25zdCBlbnRyeSBvZiBlbnRyeVBvaW50cykge1xuICAgICAgICAgICAgaWYgKGVudHJ5LmluID09PSBjb25maWdQYXRoKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbnRyeS5vdXQgPSBlbnRyeS5vdXQucmVwbGFjZSgvXFwuW2p0XXMkLywgXCJcIik7XG4gICAgICAgIH1cblxuICAgICAgICBhd2FpdCBlc2J1aWxkKHtcbiAgICAgICAgICAgIGVudHJ5UG9pbnRzLFxuICAgICAgICAgICAgb3V0ZGlyOiB0aGlzLnBrZy5wYXRoLFxuICAgICAgICAgICAgZm9ybWF0LFxuICAgICAgICAgICAgc291cmNlbWFwOiB0cnVlLFxuICAgICAgICAgICAgc291cmNlc0NvbnRlbnQ6IGZhbHNlLFxuICAgICAgICAgICAgYWJzV29ya2luZ0RpcjogZGlybmFtZSh0aGlzLnBrZy5yZXNvbHZlKGluZGlyKSksXG5cbiAgICAgICAgICAgIC8vIFRoaXMgaXMgbmVjZXNzYXJ5IHRvIGRvd25sZXZlbCBcInVzaW5nXCJcbiAgICAgICAgICAgIHRhcmdldDogXCJlczIwMjJcIixcblxuICAgICAgICAgICAgbG9nT3ZlcnJpZGU6IHtcbiAgICAgICAgICAgICAgICBcImRpcmVjdC1ldmFsXCI6IFwic2lsZW50XCIsXG4gICAgICAgICAgICB9LFxuICAgICAgICB9KTtcblxuICAgICAgICBmb3IgKGNvbnN0IGVudHJ5IG9mIGF3YWl0IHRoaXMuI3RhcmdldHNPZihpbmRpciwgb3V0ZGlyLCBcImNqc1wiLCBcIm1qc1wiLCBcImQuY3RzXCIsIFwiZC5tdHNcIikpIHtcbiAgICAgICAgICAgIGF3YWl0IGNwKGVudHJ5LmluLCBlbnRyeS5vdXQpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgYXN5bmMgI2NvbmZpZ3VyZUZvcm1hdChkaXI6IHN0cmluZywgZm9ybWF0OiBGb3JtYXQsIGlzRGlzdDogYm9vbGVhbikge1xuICAgICAgICAvLyBCdWlsZCBpbXBvcnQgbWFwXG4gICAgICAgIGxldCB7IGltcG9ydHMgfSA9IHRoaXMucGtnLmpzb247XG4gICAgICAgIGlmIChpc0Rpc3QgJiYgdHlwZW9mIGltcG9ydHMgPT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgIGltcG9ydHMgPSB7IC4uLmltcG9ydHMgfTtcbiAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IGluIGltcG9ydHMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB2YWx1ZSA9IGltcG9ydHNba2V5XTtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09PSBcInN0cmluZ1wiKSB7XG4gICAgICAgICAgICAgICAgICAgIGltcG9ydHNba2V5XSA9IHZhbHVlLnJlcGxhY2UoL15cXC5cXC9zcmNcXC8vLCBcIi4vXCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8vIFdyaXRlIHBhY2thZ2UuanNvblxuICAgICAgICBjb25zdCBwYXRoID0gdGhpcy5wa2cucmVzb2x2ZShgJHtkaXJ9LyR7Zm9ybWF0fS9wYWNrYWdlLmpzb25gKTtcbiAgICAgICAgY29uc3QganNvbjogUmVjb3JkPHN0cmluZywgdW5rbm93bj4gPSB7XG4gICAgICAgICAgICB0e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NBLFVBQU0sVUFBVSxNQUFNLEtBQUssVUFBVSxNQUFNLFFBQVcsQ0FBQyxDQUFDO0FBQUEsRUFDNUQ7QUFBQSxFQUVBLE1BQU0sV0FBVyxPQUFlLFdBQW1CLFlBQXNCO0FBQ3JFLFVBQU0sb0JBQW9CLEtBQUssSUFBSSxRQUFRLEtBQUssRUFBRSxTQUFTO0FBQzNELGFBQVMsS0FBSyxJQUFJLFFBQVEsTUFBTSxFQUFFLFFBQVEsT0FBTyxHQUFHO0FBRXBELFlBQVEsTUFBTSxLQUFLLElBQUksS0FBSyxXQUFXLElBQUksU0FBTyxHQUFHLEtBQUssU0FBUyxHQUFHLEVBQUUsQ0FBQyxHQUFHLElBQUksV0FBUztBQUFBLE1BQ3JGLElBQUk7QUFBQSxNQUNKLEtBQUssR0FBRyxNQUFNLElBQUksS0FBSyxNQUFNLGlCQUFpQixDQUFDO0FBQUEsSUFDbkQsRUFBRTtBQUFBLEVBQ047QUFDSjsiLAogICJuYW1lcyI6IFtdCn0K

@@ -38,3 +38,3 @@ /**

}
const deps = node.dependencies.map((dep) => dep.pkg.resolve("src")).filter((p) => !p.match(/packages[\\/]tools/));
const deps = node.dependencies.filter((dep) => dep.pkg.isLibrary).map((dep) => dep.pkg.resolve("src")).filter((p) => !p.match(/packages[\\/]tools/));
const desired = [.../* @__PURE__ */ new Set([...deps, ...extraRefs])];

@@ -51,2 +51,2 @@ const newReferences = desired.map((ref) => ({ path: relative(path, ref).replace(/\\/g, "/") })).sort((ref1, ref2) => ref1.path.localeCompare(ref2.path));

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2J1aWxkaW5nL3RzY29uZmlnLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgMjAyMi0yMDI0IE1hdHRlci5qcyBBdXRob3JzXG4gKiBTUERYLUxpY2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RO0FBQUEsRUFDbkQ7QUFDSjsiLAogICJuYW1lcyI6IFtdCn0K

@@ -6,11 +6,9 @@ /**

*/
import "./testing/global-declarations.js";
export * from "./building/builder.js";
export * from "./building/graph.js";
export * from "./building/project.js";
export * from "./testing/chip.js";
export * from "./testing/mocharc.cjs";
export * from "./util/docker.js";
export * from "./util/commander.js";
export * from "./util/files.js";
export * from "./util/package.js";
export * from "./util/progress.js";
export * from "./util/wtf.js";
//# sourceMappingURL=index.d.ts.map

@@ -6,11 +6,9 @@ /**

*/
import "./testing/global-declarations.js";
export * from "./building/builder.js";
export * from "./building/graph.js";
export * from "./building/project.js";
export * from "./testing/chip.js";
export * from "./testing/mocharc.cjs";
export * from "./util/docker.js";
export * from "./util/commander.js";
export * from "./util/files.js";
export * from "./util/package.js";
export * from "./util/progress.js";
export * from "./util/wtf.js";
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2luZGV4LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgMjAyMi0yMDI0IE1hdHRlci5qcyBBdXRob3JzXG4gKiBTUERYLUxpY2Vuc2UtSWRlbnRpZmllcjogQXBhY2hlLTIuMFxuICovXG5cbmltcG9ydCBcIi4vdGVzdGluZy9nbG9iYWwtZGVjbGFyYXRpb25zLmpzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9idWlsZGluZy9ncmFwaC5qc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vYnVpbGRpbmcvcHJvamVjdC5qc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vdGVzdGluZy9jaGlwLmpzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi90ZXN0aW5nL21vY2hhcmMuY2pzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi91dGlsL2RvY2tlci5qc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vdXRpb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Y0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYzsiLAogICJuYW1lcyI6IFtdCn0K

@@ -6,4 +6,6 @@ /**

*/
export * from "./commander.js";
export * from "./errors.js";
export * from "./files.js";
export * from "./package.js";
//# sourceMappingURL=index.d.ts.map

@@ -6,4 +6,6 @@ /**

*/
export * from "./commander.js";
export * from "./errors.js";
export * from "./files.js";
export * from "./package.js";
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3V0aWwvaW5kZXgudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCAyMDIyLTIwMjQgTWF0dGVyLmpzIEF1dGhvcnNcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG4gKi9cblxuZXhwb3J0ICogZnJvbSBcIi4vZXJyb3JzLmpzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9wYWNrYWdlLmpzXCI7XG4iXSwKICAibWFwcGluZ3MiOiAiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBTUEsY0FBYztBQUNkLGNBQWM7IiwKICAibmFtZXMiOiBbXQp9Cg==
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3V0aWwvaW5kZXgudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCAyMDIyLTIwMjQgTWF0dGVyLmpzIEF1dGhvcnNcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG4gKi9cblxuZXhwb3J0ICogZnJvbSBcIi4vY29tbWFuZGVyLmpzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9lcnJvcnMuanNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL2ZpbGVzLmpzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9wYWNrYWdlLmpzXCI7XG4iXSwKICAibWFwcGluZ3MiOiAiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBTUEsY0FBYztBQUNkLGNBQWM7QUFDZCxjQUFjO0FBQ2QsY0FBYzsiLAogICJuYW1lcyI6IFtdCn0K

@@ -28,5 +28,5 @@ /**

get hasCodegen(): boolean;
resolve(path: string): string;
resolve(...paths: string[]): string;
relative(path: string): string;
glob(pattern: string): Promise<string[]>;
glob(pattern: string | string[]): Promise<string[]>;
start(what: string): Progress;

@@ -43,2 +43,3 @@ lastModified(...paths: string[]): Promise<number>;

resolveExport(name: string, type?: "cjs" | "esm"): string;
findPackage(name: string): Package;
resolveImport(name: string, type?: "cjs" | "esm"): string;

@@ -45,0 +46,0 @@ hasFile(path: string): boolean;

@@ -8,6 +8,5 @@ /**

import { readdir, readFile, stat, writeFile } from "fs/promises";
import { glob } from "glob";
import { dirname, join, relative, resolve } from "path";
import { maybeStatSync } from "../testing/files.js";
import { ignoreError, ignoreErrorSync } from "./errors.js";
import { globSync, maybeReadJsonSync, maybeStatSync } from "./files.js";
import { Progress } from "./progress.js";

@@ -64,2 +63,11 @@ import { toolsPath } from "./tools-path.cjs";

this.hasTests = isDirectory(this.resolve("test"));
const refs = maybeReadJsonSync(this.resolve("tsconfig.json"))?.references;
if (refs !== void 0) {
if (!refs.find((ref) => this.resolve(ref.path) === this.resolve("src"))) {
this.hasSrc = false;
}
if (!refs.find((ref) => this.resolve(ref.path) === this.resolve("test"))) {
this.hasTests = false;
}
}
this.isLibrary = !!(this.json.main || this.json.module || this.json.exports);

@@ -77,4 +85,4 @@ this.hasConfig = this.hasFile(this.resolve(CONFIG_PATH));

}
resolve(path) {
return resolve(this.path, path);
resolve(...paths) {
return resolve(this.path, ...paths);
}

@@ -85,4 +93,8 @@ relative(path) {

async glob(pattern) {
pattern = this.resolve(pattern).replace(/\\/g, "/");
return await glob(pattern);
if (typeof pattern === "string") {
pattern = this.resolve(pattern).replace(/\\/g, "/");
} else {
pattern = pattern.map((s) => this.resolve(s).replace(/\\/g, "/"));
}
return globSync(pattern);
}

@@ -173,11 +185,6 @@ start(what) {

}
resolveImport(name, type = "esm") {
const segments = name.split("/");
let subdir = segments.shift();
if (subdir.startsWith("@") && segments.length) {
subdir = `${subdir}/${segments.shift()}`;
}
findPackage(name) {
let resolveIn = this.path;
while (true) {
if (isDirectory(resolve(resolveIn, "node_modules", subdir))) {
if (isDirectory(resolve(resolveIn, "node_modules", name))) {
break;

@@ -187,7 +194,15 @@ }

if (nextResolveIn === resolveIn) {
throw new Error(`Cannot find module ${subdir} from ${this.path}`);
throw new Error(`Cannot find module ${name} from ${this.path}`);
}
resolveIn = nextResolveIn;
}
const pkg = Package.forPath(resolve(resolveIn, "node_modules", subdir));
return Package.forPath(resolve(resolveIn, "node_modules", name));
}
resolveImport(name, type = "esm") {
const segments = name.split("/");
let packageName = segments.shift();
if (packageName.startsWith("@") && segments.length) {
packageName = `${packageName}/${segments.shift()}`;
}
const pkg = this.findPackage(packageName);
return pkg.resolveExport(segments.length ? segments.join("/") : ".", type);

@@ -222,4 +237,4 @@ }

e.message = `Error parsing "${this.resolve(path)}": ${e.message}`;
throw e;
}
return JSON.parse(await this.readFile(path));
}

@@ -311,2 +326,2 @@ async writeJson(path, value) {

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3V0aWwvcGFja2FnZS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IDIwMjItMjAyNCBNYXR0ZXIuanMgQXV0aG9yc1xuICogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFwYWNoZS0yLjBcbiAqL1xuXG5pbXBvcnQgeyBleGlzdHNTeW5jLCByZWFkRmlsZVN5bm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WFwKGFzeW5jIHAgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRzID0gYXdhaXQgaWdub3JlRXJyb3IoXCJFTk9FTlRcIiwgYXN5bmMgKCkgPT4gYXdhaXQgc3RhdChwKSk7XG4gICAgICAgICAgICAgICAgaWYgKCFzdGF0cykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgbGV0IHRoaXNNdGltZTtcbiAgICAgICAgICAgICAgICBpZiAoc3RhdHMuaXNEaXJlY3RvcnkoKSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBwYXRocyA9IChhd2FpdCByZWFkZGlyKHApKS5tYXAocDIgPT4gcmVzb2x2ZShwLCBwMikpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzTXRpbWUgPSBhd2FpdCB0aGlzLmxhc3RNb2RpZmllZEFic29sdXRlKHBhdGhzKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzTXRpbWUgPSBzdGF0cy5tdGltZU1zO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpc010aW1lID4gbXRpbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgbXRpbWUgPSB0aGlzTXRpbWU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSksXG4gICAgICAgICk7XG4gICAgICAgIHJldHVybiBtdGltZTtcbiAgICB9XG5cbiAgICBnZXQgZGVwZW5kZW5jaWVzKCkge1xuICAgICAgICBsZXQgcmVzdWx0ID0gQXJyYXk8c3RyaW5nPigpO1xuICAgICAgICBmb3IgKGNvbnN0IHR5cGUgb2YgW1wiZGVwZW5kZW5jaWVzXCIsIFwib3B0aW9uYWxEZXBlbmRlbmNpZXNcIiwgXCJkZXZEZXBlbmRlbmNpZXNcIiwgXCJwZWVyRGVwZW5kZW5jaWVzXCJdKSB7XG4gICAgICAgICA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TogXCJjanNcIiB8IFwiZXNtXCIgPSBcImVzbVwiKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndvcmtzcGFjZS5yZXNvbHZlSW1wb3J0KG5hbWUsIHR5cGUpO1xuICAgIH1cblxuICAgIHJlc29sdmVFeHBvcnQobmFtZTogc3RyaW5nLCB0eXBlOiBcImNqc1wiIHwgXCJlc21cIiA9IFwiZXNtXCIpIHtcbiAgICAgICAgaWYgKCFuYW1lLnN0YXJ0c1dpdGgoXCIuXCIpKSB7XG4gICAgICAgICAgICBuYW1lID0gYC4vJHtuYW1lfWA7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgZXhwb3J0RGV0YWlsID0gdGhpcy5leHBvcnRzPy5bbmFtZV07XG5cbiAgICAgICAgaWYgKGV4cG9ydERldGFpbCkge1xuICAgICAgICAgICAgY29uc3QgZXhwID0gZmluZEV4cG9ydENvbmRpdGlvbihleHBvcnREZXRhaWwsIHR5cGUpO1xuICAgICAgICAgICAgaWYgKGV4cCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlc29sdmUoZXhwKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChuYW1lID09PSBcIi5cIikge1xuICAgICAgICAgICAgaWYgKHR5cGUgPT09IFwiZXNtXCIgJiYgdGhpcy5qc29uLm1vZHVsZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlc29sdmUodGhpcy5qc29uLm1vZHVsZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodGhpcy5qc29uLm1haW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlKHRoaXMuanNvbi5tYWluKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IHJlc29sdmUgZXhwb3J0ICR7bmFtZX0gaW4gcGFja2FnZSAke3RoaXMubmFtZX1gKTtcbiAgICB9XG5cbiAgICByZXNvbHZlSW1wb3J0KG5hbWU6IHN0cmluZywgdHlwZTogXCJjanNcIiB8IFwiZXNtXCIgPSBcImVzbVwiKSB7XG4gICAgICAgIGNvbnN0IHNlZ21lbnRzID0gbmFtZS5zcGxpdChcIi9cIik7XG4gICAgICAgIGxldCBzdWJkaXIgPSBzZWdtZW50cy5zaGlmdCgpIGFzIHN0cmluZztcbiAgICAgICAgaWYgKHN1YmRpci5zdGFydHNXaXRoKFwiQFwiKSAmJiBzZWdtZW50cy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHN1YmRpciA9IGAke3N1YmRpcn0vJHtzZWdtZW50cy5zaGlmdCgpfWA7XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgcmVzb2x2ZUluID0gdGhpcy5wYXRoO1xuICAgICAgICB3aGlsZSAodHJ1ZSkge1xuICAgICAgICAgICAgaWYgKGlzRGlyZWN0b3J5KHJlc29sdmUocmVzb2x2ZUluLCBcIm5vZGVfbW9kdWxlc1wiLCBzdWJkaXIpKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgbmV4dFJlc29sdmVJbiA9IGRpcm5hbWUocmVzb2x2ZUluKTtcbiAgICAgICAgICAgIGlmIChuZXh0UmVzb2x2ZUluID09PSByZXNvbHZlSW4pIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENhbm5vdCBmaW5kIG1vZHVsZSAke3N1YmRpcn0gZnJvbSAke3RoaXMucGF0aH1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc29sdmVJbiA9IG5leHRSZXNvbHZlSW47XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBwa2cgPSBQYWNrYWdlLmZvclBhdGgocmVzb2x2ZShyZXNvbHZlSW4sIFwibm9kZV9tb2R1bGVzXCIsIHN1YmRpcikpO1xuICAgICAgICByZXR1cm4gcGtnLnJlc29sdmVFeH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gICAgICAgICByZXR1cm4gSlNPTi5wYXJzZSh0ZXh0KTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgaWYgKCEoZSBpbnN0YW5jZW9mIEVycm9yKSkge1xuICAgICAgICAgICAgICAgIGUgPSBuZXcgRXJyb3IoYCR7ZX1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIChlIGFzIEVycm9yKS5tZXNzYWdlID0gYEVycm9yIHBhcnNpbmcgXCIke3RoaXMucmVzb2x2ZShwYXRoKX1cIjogJHsoZSBhcyBFcnJvcikubWVzc2FnZX1gO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBKU09OLnBhcnNlKGF3YWl0IHRoaXMucmVhZEZpbGUocGF0aCkpO1xuICAgIH1cblxuICAgIGFzeW5jIHdyaXRlSnNvbihwYXRoOiBzdHJpbmcsIHZhbHVlOiB7fSkge1xuICAgICAgICBhd2FpdCB0aGlzLndyaXRlRmlsZShwYXRoLCBKU09OLnN0cmluZ2lmeSh2YWx1ZSwgdW5kZWZpbmVkLCA0KSk7XG4gICAgfVxuXG4gICAgc3RhdGljIG1heWJlRm9yUGF0aChwYXRoOiBzdHJpbmcpIHtcbiAgICAgICAgZnVuY3Rpb24gZmluZChwYXRoOiBzdHJpbmcpOiBQYWNrYWdlIHwgbnVsbCB7XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0gcGFja2FnZUZvclBhdGhbcGF0aF07XG4gICAgICAgICAgICBpZiAocmVzdWx0ID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXhpc3RzU3luYyhqb2luKHBhdGgsIFwicGFja2FnZS5qc29uXCIpKSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBuZXcgUGFja2FnZSh7IHBhdGggfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gZmluZChkaXJuYW1lKHBhdGgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcGFja2FnZUZvclBhdGhbcGF0aF0gPSByZXN1bHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgcmVzdWx0ID0gZmluZChwYXRoKTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0ID8/IHVuZGVmaW5lZDtcbiAgICB9XG5cbiAgICBzdGF0aWMgZm9yUGF0aChwYXRoOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3QgcmVzdWx0ID0gdGhpcy5tYXliZUZvclBhdGgocGF0aCk7XG4gICAgICAgIGlmIChyZXN1bHQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgfVxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENhbm5vdCBmaW5kIHBhY2thZ2UuanNvbiBmb3IgXCIke3BhdGh9XCJgKTtcbiAgICB9XG5cbiAgICBnZXQgYWxpYXNlcygpOiBSZWNvcmQ8c3RyaW5nLCBzdHJpbmc+IHtcbiAgICAgICAgaWYgKHRoaXMuI2FsaWFzZXMgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuI2FsaWFzZXM7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLiNhbGlhc2VzID0ge1xuICAgICAgICAgICAgLi4uUGFja2FnZS5tYXliZUZvclBhdGgoZGlybmFtZSh0aGlzLnBhdGgpKT8uYWxpYXNlcyxcbiAgICAgICAgICAgIC4uLnRoaXMuanNvbi5pbXBvcnRzLFxuICAgICAgICB9O1xuXG4gICAgICAgIHJldHVybiB0aGlzLiNhbGlhc2VzO1xuICAgIH1cblxuICAgICNtYXliZVN0YXQocGF0aDogc3RyaW5nKSB7XG4gICAgICAgIHJldHVybiBtYXliZVN0YXRTeW5jKHRoaXMucmVzb2x2ZShwYXRoKSk7XG4gICAgf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RU5UXCIsIGFzeW5jICgpID0+IGF3YWl0IHN0YXQocCkpO1xuICAgICAgICAgICAgICAgIGlmICghc3RhdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGxldCB0aGlzTXRpbWU7XG4gICAgICAgICAgICAgICAgaWYgKHN0YXRzLmlzRGlyZWN0b3J5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGF0aHMgPSAoYXdhaXQgcmVhZGRpcihwKSkubWFwKHAyID0+IHJlc29sdmUocCwgcDIpKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpc010aW1lID0gYXdhaXQgdGhpcy5sYXN0TW9kaWZpZWRBYnNvbHV0ZShwYXRocyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpc010aW1lID0gc3RhdHMubXRpbWVNcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHRoaXNNdGltZSA+IG10aW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIG10aW1lID0gdGhpc010aW1lO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pLFxuICAgICAgICApO1xuICAgICAgICByZXR1cm4gbXRpbWU7XG4gICAgfVxuXG4gICAgZ2V0IGRlcGVuZGVuY2llcygpIHtcbiAgICAgICAgbGV0IHJlc3VsdCA9IEFycmF5PHN0cmluZz4oKTtcbiAgICAgICAgZm9yIChjb25zdCB0eXBlIG9mIFtcImRlcGVuZGVuY2llc1wiLCBcIm9wdGlvbmFsRGVwZW5kZW5jaWVzXCIsIFwiZGV2RGVwZW5kZW5jaWVzXCIsIFwicGVlckRlcGVuZGVuY2llc1wiXSkge1xuICAgICAgICAgICAgaWYgKHR5cGVvZiB0aGlzLmpzb25bdHlwZV0gPT09IFwib2JqZWN0XCIgJiYgdGhpcy5qc29uW3R5cGVdICE9PSBudWxsKSB7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UucmVzb2x2ZUltcG9ydChuYW1lLCB0eXBlKTtcbiAgICB9XG5cbiAgICByZXNvbHZlRXhwb3J0KG5hbWU6IHN0cmluZywgdHlwZTogXCJjanNcIiB8IFwiZXNtXCIgPSBcImVzbVwiKSB7XG4gICAgICAgIGlmICghbmFtZS5zdGFydHNXaXRoKFwiLlwiKSkge1xuICAgICAgICAgICAgbmFtZSA9IGAuLyR7bmFtZX1gO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGV4cG9ydERldGFpbCA9IHRoaXMuZXhwb3J0cz8uW25hbWVdO1xuXG4gICAgICAgIGlmIChleHBvcnREZXRhaWwpIHtcbiAgICAgICAgICAgIGNvbnN0IGV4cCA9IGZpbmRFeHBvcnRDb25kaXRpb24oZXhwb3J0RGV0YWlsLCB0eXBlKTtcbiAgICAgICAgICAgIGlmIChleHApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlKGV4cCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobmFtZSA9PT0gXCIuXCIpIHtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSBcImVzbVwiICYmIHRoaXMuanNvbi5tb2R1bGUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlKHRoaXMuanNvbi5tb2R1bGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuanNvbi5tYWluKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVzb2x2ZSh0aGlzLmpzb24ubWFpbik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENhbm5vdCByZXNvbHZlIGV4cG9ydCAke25hbWV9IGluIHBhY2thZ2UgJHt0aGlzLm5hbWV9YCk7XG4gICAgfVxuXG4gICAgZmluZFBhY2thZ2UobmFtZTogc3RyaW5nKSB7XG4gICAgICAgIGxldCByZXNvbHZl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pdCB0aGlzLnJlYWRGaWxlKHBhdGgpO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UodGV4dCk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiBFcnJvcikpIHtcbiAgICAgICAgICAgICAgICBlID0gbmV3IEVycm9yKGAke2V9YCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAoZSBhcyBFcnJvcikubWVzc2FnZSA9IGBFcnJvciBwYXJzaW5nIFwiJHt0aGlzLnJlc29sdmUocGF0aCl9XCI6ICR7KGUgYXMgRXJyb3IpLm1lc3NhZ2V9YDtcbiAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBhc3luYyB3cml0ZUpzb24ocGF0aDogc3RyaW5nLCB2YWx1ZToge30pIHtcbiAgICAgICAgYXdhaXQgdGhpcy53cml0ZUZpbGUocGF0aCwgSlNPTi5zdHJpbmdpZnkodmFsdWUsIHVuZGVmaW5lZCwgNCkpO1xuICAgIH1cblxuICAgIHN0YXRpYyBtYXliZUZvclBhdGgocGF0aDogc3RyaW5nKSB7XG4gICAgICAgIGZ1bmN0aW9uIGZpbmQocGF0aDogc3RyaW5nKTogUGFja2FnZSB8IG51bGwge1xuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHBhY2thZ2VGb3JQYXRoW3BhdGhdO1xuICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgaWYgKGV4aXN0c1N5bmMoam9pbihwYXRoLCBcInBhY2thZ2UuanNvblwiKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gbmV3IFBhY2thZ2UoeyBwYXRoIH0pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IGZpbmQoZGlybmFtZShwYX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8sV0FBVyxPQUFPLFFBQVEsT0FBTztBQUNsRCxNQUFJLE9BQU8sT0FBTyxRQUFRLFVBQVU7QUFDaEMsVUFBTSxvQkFBb0IsS0FBSyxJQUFJO0FBQUEsRUFDdkM7QUFFQSxNQUFJLE9BQU8sUUFBUSxVQUFVO0FBQ3pCLFdBQU87QUFBQSxFQUNYO0FBQ0o7IiwKICAibmFtZXMiOiBbInBhdGhzIiwgImZpbmQiLCAicGF0aCIsICJyZXN1bHQiLCAiZXhwIl0KfQo=

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

*/
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { commander } from "../util/commander.js";
import { Package } from "../util/package.js";

@@ -13,4 +12,6 @@ import { Progress } from "../util/progress.js";

async function main(argv = process.argv) {
const args = await yargs(hideBin(argv)).command("$0 [ver]", "Manipulate monorepo package versions.").option("prefix", { alias: "p", default: ".", type: "string", describe: "specify monorepo directory" }).option("set", { alias: "s", type: "boolean", describe: "Sets the release version" }).option("apply", { alias: "a", type: "boolean", describe: "Sets package versions to the release version" }).option("tag", { alias: "t", type: "boolean", describe: "Adds git tag for release version" }).wrap(Math.min(process.stdout.columns, 80)).strict().argv;
const version = args.ver;
const program = commander("matter-version", "Manipulate monorepo package versions.").argument("[version]").option("-p, --prefix <prefix>", "specify monorepo directory").option("-s, --set", "sets the release version").option("-a, --apply", "sets package versions to the release version").option("-t, --tag", "adds git tag for release version").parse(argv);
const args = program.opts();
args.version = program.args[0];
const version = args.version;
const pkg = new Package({ path: args.prefix });

@@ -34,2 +35,2 @@ const versioner = new Versioner(pkg, version);

};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3ZlcnNpb25pbmcvY2xpLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgMjAyMi0yMDI0IE1hdHRlci5qcyBBdXRob3JzXG4gK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FNLElBQUksUUFBUSxFQUFFLE1BQU0sS0FBSyxPQUFPLENBQUM7QUFDN0MsUUFBTSxZQUFZLElBQUksVUFBVSxLQUFLLE9BQU87QUFFNUMsUUFBTSxXQUFXLElBQUksU0FBUztBQUU5QixXQUFTLFFBQVEsV0FBVyxVQUFVLE9BQU8sSUFBSSxVQUFVLEdBQUc7QUFDOUQsTUFBSSxLQUFLLEtBQUs7QUFDVixVQUFNLFNBQVMsSUFBSSxrQkFBa0IsU0FBUyxVQUFVLFVBQVUsT0FBTyxDQUFDLElBQUksTUFBTSxVQUFVLElBQUksQ0FBQztBQUFBLEVBQ3ZHO0FBRUEsTUFBSSxLQUFLLE9BQU87QUFDWixVQUFNLFVBQVUsTUFBTSxRQUFRO0FBQUEsRUFDbEM7QUFFQSxNQUFJLEtBQUssS0FBSztBQUNWLFVBQU0sU0FBUyxJQUFJLG1CQUFtQixTQUFTLFVBQVUsVUFBVSxPQUFPLENBQUMsSUFBSSxNQUFNLFVBQVUsSUFBSSxDQUFDO0FBQUEsRUFDeEc7QUFFQSxXQUFTLFNBQVM7QUFDdEI7IiwKICAibmFtZXMiOiBbXQp9Cg==
{
"name": "@matter/tools",
"version": "0.11.0-alpha.0-20241027-e40e1664f",
"version": "0.11.0-alpha.0-20241028-39fc76758",
"description": "Matter.js tooling",

@@ -10,3 +10,2 @@ "type": "module",

"build-clean": "node bin/build.js --clean",
"test": "node bin/test.js",
"version": "node bin/version.js"

@@ -16,3 +15,2 @@ },

"matter-build": "bin/build.js",
"matter-test": "bin/test.js",
"matter-run": "bin/run.js",

@@ -50,32 +48,15 @@ "matter-version": "bin/version.js"

"dependencies": {
"@npmcli/map-workspaces": "^4.0.1",
"@types/express": "^4.17.21",
"ansi-colors": "^4.1.3",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.2",
"dockerode": "^4.0.2",
"commander": "^12.1.0",
"esbuild": "^0.24.0",
"express": "^4.19.2",
"glob": "^10.4.5",
"mocha": "^10.7.3",
"playwright": "^1.48.1",
"trace-unhandled": "^2.0.1",
"typescript": "~5.6.2",
"wtfnode": "^0.9.3",
"yargs": "^17.7.2"
"minimatch": "^9.0.5",
"typescript": "~5.6.2"
},
"optionalDependencies": {
"@esbuild/linux-x64": "^0.24.0",
"v8-profiler-next": "^1.10.0"
"@esbuild/linux-x64": "^0.24.0"
},
"devDependencies": {
"@types/chai": "^4.3.16",
"@types/chai-as-promised": "^7.1.8",
"@types/debug": "^4.1.12",
"@types/dockerode": "^3.3.30",
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.7",
"@types/npmcli__map-workspaces": "^3.0.4",
"@types/wtfnode": "^0.7.3",
"@types/yargs": "^17.0.33"
"@types/commander": "^2.12.5",
"@types/minimatch": "^5.1.2",
"@types/node": "^22.8.1"
},

@@ -82,0 +63,0 @@ "publishConfig": {

# @matter/tools - Matter.js Tooling
This package supports build, test and execution infrastructure for other matter.js packages.
This package supports build and execution infrastructure for other matter.js packages.
> This package supports all Node.js LTS versions starting with 18.x
> Supports all Node.js LTS versions starting with 18.x
## Rational
Matter.js consists of a large number of generated TypeScript files. We support
multiple module formats targeting disparate JavaScript runtimes including Node
and web browsers. We publish a moderate (and growing) number of packages to
NPM. We support Linux, Windows and MacOS.
Matter.js consists of a large number of generated TypeScript files. We support multiple module formats targeting
disparate JavaScript runtimes including Node and web browsers. We publish a moderate (and growing) number of packages
to NPM. We support Linux, Windows and MacOS.
Previously, TSC analysis and test times had become quite slow. A proliferation
of configuration files for TSC and test framework was adding significant
redundancy to the codebase.
Previously, TSC analysis and test times had become quite slow. A proliferation of configuration files for TSC and test
framework was adding significant redundancy to the codebase.
This package standardizes and centralizes configuration for build and test. It
minimizes reliance on TSC and generally does its best to run build and test as
quickly as possible.
This package standardizes and centralizes configuration for build and test. It minimizes reliance on TSC and generally
does its best to run build and test as quickly as possible.
## Dev workflow
Although Matter.js relies on third party tools for build and test, the
interface is command-line oriented and unique to Matter.js. As such it will be
unfamiliar to new developers.
Although Matter.js relies on third party tools for build and test, the interface is command-line oriented and unique to
Matter.js. As such it will be unfamiliar to new developers.
To minimize developer burden, we also maintain traditional `tsconfig.json`
files with project references in each `src/` and `test/`. These files support
traditional IDE and `tsc --watch` workflows and are largely (but not entirely)
ignored by the tooling package.
To minimize developer burden, we also maintain traditional `tsconfig.json` files with project references in each `src/`
and `test/`. These files support traditional IDE and `tsc --watch` workflows and are largely (but not entirely) ignored
by the tooling package.
These files do add configuration overhead but we minimize this with a shared
[tsconfig.base.json](tsconfig.base.json) supplied by this package.
These files do add configuration overhead but we minimize this with a shared [tsconfig.base.json](tsconfig.base.json)
supplied by this package.
We also supply a standard `.mocharc.cjs` in packages with tests. You can use
this with your IDE's Mocha integration for standard testing workflows.
We also supply a standard `.mocharc.cjs` in packages with tests. You can use this with your IDE's Mocha integration for
standard testing workflows.
## Build
We use [TSC](https://www.typescriptlang.org/docs/handbook/compiler-options.html)
to validate TypeScript types and generate declaration files. We
use [esbuild](https://esbuild.github.io/) for transcoding TypeScript to ESM
(ES6 module format) and CJS (CommonJS module format).
We use [TSC](https://www.typescriptlang.org/docs/handbook/compiler-options.html) to validate TypeScript types and
generate declaration files. We use [esbuild](https://esbuild.github.io/) for transcoding TypeScript to ESM (ES6 module
format) and CJS (CommonJS module format).
The [matter-build](./bin/build.js) script orchestrates TSC and esbuild. It
inspects `package.json` for the target module to determine whether to emit
ESM, CJS or both.
The [matter-build](./bin/build.js) script orchestrates TSC and esbuild. It inspects `package.json` for the target
module to determine whether to emit ESM, CJS or both.
Use `matter-build --help` for command line usage. `matter-build --workspaces`
builds all workspace packages that have changed (or depend on other workspace
packages that have changed) since the last build.
Use `matter-build --help` for command line usage. `matter-build --workspaces` builds all workspace packages that have
changed (or depend on other workspace packages that have changed) since the last build.
`matter-build` itself is implemented in TypeScript. It uses `esbuild` to
bootstrap itself in fresh installs.
`matter-build` itself is implemented in TypeScript. It uses `esbuild` to bootstrap itself in fresh installs.
## Test
We run tests using [Mocha](https://mochajs.org/) with
[chai](https://www.chaijs.com/) for assertions. For multi-format modules we
run tests as both CJS and ESM. For packages that support browsers we run tests
in a headless browser using [Playwright](https://playwright.dev/).
The [matter-test](./bin/test.js) scripts orchestrates test execution. Use
`matter-test --help` for command line usage.
By default matter-test inspects `package.json` for the target module to
determine whether to test ESM, CJS or both under Node. Web tests do not run by
default but you can enable them using the `-w` option.
`matter-test` supports
environment variables of the form `MATTER_<OPTION>` for most command line
arguments. This includes `MATTER_SPEC`, `MATTER_PROFILE`, `MATTER_GREP`,
`MATTER_FGREP`, `MATTER_INVERT` and `MATTER_ALL_LOGS`.
Matter.js emits a significant volume of logging during testing. By default,
`matter-test` captures these logs internally and only emits them when
reporting on failed tests.
The test environment orchestrated by this package installs a small number of
Mocks for Matter.js infrastructure singletons.
[global-declarations.ts](src/testing/global-declarations.ts) defines a global
API for these mocks.
## Execution
The final command supplied by the tooling package is [matter-run](bin/run.js).
This command bootstraps tooling, transpiles the target module, and executes
the named JS or TS script.
We facilitate execution via [matter-run](bin/run.js). This command bootstraps tooling, transpiles the target module, and
executes the named JS or TS script.
`matter-run` understands Matter.js `package.json` conventions and
automatically transpiles typescript files in the target package prior to
execution.
`matter-run` understands Matter.js `package.json` conventions and automatically transpiles typescript files in the
target package prior to execution.
`matter-run` accepts a script to run and passes other arguments to the script
verbatim.
`matter-run` accepts a script to run and passes other arguments to the script verbatim.
If you set the environment variable `MATTER_ECHO`, `matter-run` will print the
command line prior to invoking a script.
If you set the environment variable `MATTER_ECHO`, `matter-run` will print the command line prior to invoking a script.

@@ -7,3 +7,2 @@ /**

import colors from "ansi-colors";
import { createHash } from "crypto";

@@ -153,3 +152,3 @@ import { Progress } from "../util/progress.js";

progress.failure("Terminating due to type errors");
process.stderr.write(e.diagnostics);
process.stderr.write(`${e.diagnostics}\n`);
process.exit(1);

@@ -161,10 +160,26 @@ }

const formats = Array<"esm" | "cjs">();
if (targets.has(Target.esm)) {
await this.#transpile(project, progress, Target.esm);
formats.push("esm");
}
if (targets.has(Target.cjs)) {
await this.#transpile(project, progress, Target.cjs);
formats.push("cjs");
}
if (formats.length) {
const groups = [project.pkg.isLibrary ? "library" : "app"];
if (project.pkg.hasTests) {
groups.push("tests");
}
const formatDesc = formats.map(progress.emphasize).join("+");
const groupDesc = groups.map(progress.emphasize).join("+");
await progress.run(`Transpile ${groupDesc} to ${formatDesc}`, async () => {
for (const format of formats) {
await this.#transpile(project, format);
}
});
}
await config?.after?.({ project });

@@ -181,12 +196,6 @@

async #transpile(project: Project, progress: Progress, format: "esm" | "cjs") {
const fmt = format.toUpperCase();
await progress.run(
`Transpile ${progress.emphasize(project.pkg.isLibrary ? "library" : "app")} to ${colors.bold(fmt)}`,
() => project.buildSource(format),
);
async #transpile(project: Project, format: "esm" | "cjs") {
await project.buildSource(format);
if (project.pkg.hasTests) {
await progress.run(`Transpile ${progress.emphasize("tests")} to ${colors.bold(fmt)}`, () =>
project.buildTests(format),
);
await project.buildTests(format);
}

@@ -193,0 +202,0 @@ }

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

import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { commander } from "../util/commander.js";
import { Builder, Target } from "./builder.js";

@@ -23,2 +22,9 @@ import { Graph } from "./graph.js";

interface Args {
prefix: string;
clean?: boolean;
workspaces?: boolean;
dependencies?: boolean;
}
export async function main(argv = process.argv) {

@@ -28,18 +34,59 @@ const targets = Array<Target>();

const args = await yargs(hideBin(argv))
.usage("Builds packages adhering to matter.js standards.")
.option("prefix", { alias: "p", default: ".", type: "string", describe: "specify build directory" })
.option("clean", { alias: "c", default: false, type: "boolean", describe: "clean before build" })
.option("workspaces", { alias: "w", default: false, type: "boolean", describe: "build all workspace packages" })
.option("dependencies", { alias: "d", default: false, type: "boolean", describe: "build dependencies" })
.command("*", "build types and both JS files", () => {})
.command("clean", "remove build and dist directories", () => targets.push(Target.clean))
.command("types", "build type definitions", () => targets.push(Target.types))
.command("esm", "build JS (ES6 modules)", () => targets.push(Target.esm))
.command("cjs", "build JS (CommonJS modules)", () => targets.push(Target.cjs))
.command("graph", "display the workspace graph", () => (mode = Mode.DisplayGraph))
.command("tsconfigs", "sync all tsconfigs with package.json", () => (mode = Mode.SyncTsconfigs))
.wrap(Math.min(process.stdout.columns, 80))
.strict().argv;
const program = commander("matter-build", "Builds packages adhering to matter.js standards.")
.option("-p, --prefix <path>", "specify build directory", ".")
.option("-c, --clean", "clean before build", false)
.option("-w, --workspaces", "build all workspace packages", false)
.option("-d, --dependencies", "build dependencies", false);
program
.command("build")
.description("(default) build JS and type definitions")
.action(() => {});
program
.command("clean")
.description("remove build and dist directories")
.action(() => {
targets.push(Target.clean);
});
program
.command("types")
.description("build type definitions")
.action(() => {
targets.push(Target.types);
});
program
.command("esm")
.description("build JS (ES6 modules)")
.action(() => {
targets.push(Target.esm);
});
program
.command("cjs")
.description("build JS (CommonJS modules)")
.action(() => {
targets.push(Target.cjs);
});
program
.command("graph")
.description("display the workspace graph")
.action(() => {
mode = Mode.DisplayGraph;
});
program
.command("tsconfigs")
.description("sync all tsconfigs with package.json")
.action(() => {
mode = Mode.SyncTsconfigs;
});
program.action(() => {});
const args = program.parse(argv).opts<Args>();
if (mode === Mode.BuildProject) {

@@ -46,0 +93,0 @@ if (args.workspaces) {

@@ -7,3 +7,2 @@ /**

import mapWorkspaces from "@npmcli/map-workspaces";
import colors from "ansi-colors";

@@ -178,3 +177,3 @@ import { JsonNotFoundError, Package } from "../util/package.js";

static async #loadNodes(workspace: Package) {
const workspaces = await mapWorkspaces({ pkg: workspace.json, cwd: workspace.path });
const workspaces = workspace.json.workspaces;

@@ -184,3 +183,3 @@ const nodeMap = {} as Record<string, Graph.Node>;

for (const path of workspaces.values()) {
const pkg = new Package({ path: path });
const pkg = new Package({ path: workspace.resolve(path) });
allDeps[pkg.json.name] = pkg.dependencies;

@@ -187,0 +186,0 @@ nodeMap[pkg.json.name] = {

@@ -10,3 +10,2 @@ /**

import { cp, mkdir, readFile, rm, symlink, writeFile } from "fs/promises";
import { glob } from "glob";
import { platform } from "os";

@@ -49,3 +48,5 @@ import { dirname, join } from "path";

if (!this.pkg.hasSrc) {
throw new Error(`Found package ${this.pkg.json.name} but no src directory is present`);
throw new Error(
`Found package ${this.pkg.json.name} but src directory is not present or not referenced in tsconfig.json`,
);
}

@@ -165,3 +166,6 @@ }

for (const format of formats) {
await cp(this.pkg.resolve(source), this.pkg.resolve(join("dist", format, dest)));
await cp(this.pkg.resolve(source), this.pkg.resolve(join("dist", format, dest)), {
recursive: true,
force: true,
});
}

@@ -225,8 +229,8 @@ }

async #targetsOf(indir: string, outdir: string, ...extensions: string[]) {
indir = this.pkg.resolve(indir).replace(/\\/g, "/");
const inputPrefixLength = this.pkg.resolve(indir).length + 1;
outdir = this.pkg.resolve(outdir).replace(/\\/g, "/");
return (await glob(extensions.map(ext => `${indir}/**/*.${ext}`))).map(file => ({
return (await this.pkg.glob(extensions.map(ext => `${indir}/**/*.${ext}`))).map(file => ({
in: file,
out: `${outdir}/${file.slice(indir.length + 1)}`,
out: `${outdir}/${file.slice(inputPrefixLength)}`,
}));

@@ -233,0 +237,0 @@ }

@@ -59,3 +59,6 @@ /**

const deps = node.dependencies.map(dep => dep.pkg.resolve("src")).filter(p => !p.match(/packages[\\/]tools/));
const deps = node.dependencies
.filter(dep => dep.pkg.isLibrary)
.map(dep => dep.pkg.resolve("src"))
.filter(p => !p.match(/packages[\\/]tools/));

@@ -62,0 +65,0 @@ const desired = [...new Set([...deps, ...extraRefs])];

@@ -7,10 +7,8 @@ /**

import "./testing/global-declarations.js";
export * from "./building/builder.js";
export * from "./building/graph.js";
export * from "./building/project.js";
export * from "./testing/chip.js";
export * from "./testing/mocharc.cjs";
export * from "./util/docker.js";
export * from "./util/commander.js";
export * from "./util/files.js";
export * from "./util/package.js";
export * from "./util/progress.js";
export * from "./util/wtf.js";

@@ -10,3 +10,2 @@ {

"**/*.ts",
"testing/mocharc.cjs",
"util/tools-path.d.cts"

@@ -13,0 +12,0 @@ ],

@@ -7,3 +7,5 @@ /**

export * from "./commander.js";
export * from "./errors.js";
export * from "./files.js";
export * from "./package.js";

@@ -9,6 +9,5 @@ /**

import { readdir, readFile, stat, writeFile } from "fs/promises";
import { glob } from "glob";
import { dirname, join, relative, resolve } from "path";
import { maybeStatSync } from "../testing/files.js";
import { ignoreError, ignoreErrorSync } from "./errors.js";
import { globSync, maybeReadJsonSync, maybeStatSync } from "./files.js";
import { Progress } from "./progress.js";

@@ -76,2 +75,12 @@ import { toolsPath } from "./tools-path.cjs";

const refs = maybeReadJsonSync(this.resolve("tsconfig.json"))?.references as undefined | { path: string }[];
if (refs !== undefined) {
if (!refs.find(ref => this.resolve(ref.path) === this.resolve("src"))) {
this.hasSrc = false;
}
if (!refs.find(ref => this.resolve(ref.path) === this.resolve("test"))) {
this.hasTests = false;
}
}
this.isLibrary = !!(this.json.main || this.json.module || this.json.exports);

@@ -94,4 +103,4 @@

resolve(path: string) {
return resolve(this.path, path);
resolve(...paths: string[]) {
return resolve(this.path, ...paths);
}

@@ -103,7 +112,12 @@

async glob(pattern: string) {
async glob(pattern: string | string[]) {
// Glob only understands forward-slash as separator because reasons
pattern = this.resolve(pattern).replace(/\\/g, "/");
if (typeof pattern === "string") {
pattern = this.resolve(pattern).replace(/\\/g, "/");
} else {
pattern = pattern.map(s => this.resolve(s).replace(/\\/g, "/"));
}
return await glob(pattern);
// Current glob implementation isn't actually async as this is faster and we only walk small directory trees
return globSync(pattern);
}

@@ -210,12 +224,6 @@

resolveImport(name: string, type: "cjs" | "esm" = "esm") {
const segments = name.split("/");
let subdir = segments.shift() as string;
if (subdir.startsWith("@") && segments.length) {
subdir = `${subdir}/${segments.shift()}`;
}
findPackage(name: string) {
let resolveIn = this.path;
while (true) {
if (isDirectory(resolve(resolveIn, "node_modules", subdir))) {
if (isDirectory(resolve(resolveIn, "node_modules", name))) {
break;

@@ -225,3 +233,3 @@ }

if (nextResolveIn === resolveIn) {
throw new Error(`Cannot find module ${subdir} from ${this.path}`);
throw new Error(`Cannot find module ${name} from ${this.path}`);
}

@@ -231,3 +239,14 @@ resolveIn = nextResolveIn;

const pkg = Package.forPath(resolve(resolveIn, "node_modules", subdir));
return Package.forPath(resolve(resolveIn, "node_modules", name));
}
resolveImport(name: string, type: "cjs" | "esm" = "esm") {
const segments = name.split("/");
let packageName = segments.shift() as string;
if (packageName.startsWith("@") && segments.length) {
packageName = `${packageName}/${segments.shift()}`;
}
const pkg = this.findPackage(packageName);
return pkg.resolveExport(segments.length ? segments.join("/") : ".", type);

@@ -269,4 +288,4 @@ }

(e as Error).message = `Error parsing "${this.resolve(path)}": ${(e as Error).message}`;
throw e;
}
return JSON.parse(await this.readFile(path));
}

@@ -273,0 +292,0 @@

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

import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { commander } from "../util/commander.js";
import { Package } from "../util/package.js";

@@ -14,13 +13,23 @@ import { Progress } from "../util/progress.js";

interface Args {
version?: string;
prefix?: string;
set?: boolean;
apply?: boolean;
tag?: boolean;
}
export async function main(argv = process.argv) {
const args = await yargs(hideBin(argv))
.command("$0 [ver]", "Manipulate monorepo package versions.")
.option("prefix", { alias: "p", default: ".", type: "string", describe: "specify monorepo directory" })
.option("set", { alias: "s", type: "boolean", describe: "Sets the release version" })
.option("apply", { alias: "a", type: "boolean", describe: "Sets package versions to the release version" })
.option("tag", { alias: "t", type: "boolean", describe: "Adds git tag for release version" })
.wrap(Math.min(process.stdout.columns, 80))
.strict().argv;
const program = commander("matter-version", "Manipulate monorepo package versions.")
.argument("[version]")
.option("-p, --prefix <prefix>", "specify monorepo directory")
.option("-s, --set", "sets the release version")
.option("-a, --apply", "sets package versions to the release version")
.option("-t, --tag", "adds git tag for release version")
.parse(argv);
const version = args.ver as string | undefined;
const args = program.opts<Args>();
args.version = program.args[0];
const version = args.version;
const pkg = new Package({ path: args.prefix });

@@ -27,0 +36,0 @@ const versioner = new Versioner(pkg, version);

{
"compilerOptions": { "composite": true },
"files": [],
"references": [{ "path": "src" }, { "path": "test" }]
"references": [{ "path": "src" }]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc