@matter/tools
Advanced tools
Comparing version 0.11.0-alpha.0-20241028-f7b2f013d to 0.11.0
@@ -48,3 +48,5 @@ "use strict"; | ||
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` | ||
); | ||
} | ||
@@ -51,0 +53,0 @@ } |
@@ -7,2 +7,3 @@ /** | ||
export declare function maybeStatSync(path: string): import("fs").Stats | undefined; | ||
export declare function maybeReadJsonSync(path: string): any; | ||
export declare function maybeReaddirSync(path: string): string[] | undefined; | ||
@@ -9,0 +10,0 @@ export declare class GlobError extends Error { |
@@ -23,2 +23,3 @@ "use strict"; | ||
globSync: () => globSync, | ||
maybeReadJsonSync: () => maybeReadJsonSync, | ||
maybeReaddirSync: () => maybeReaddirSync, | ||
@@ -49,2 +50,16 @@ maybeStatSync: () => maybeStatSync | ||
} | ||
function maybeReadJsonSync(path) { | ||
try { | ||
return JSON.parse((0, import_fs.readFileSync)(path, "utf-8")); | ||
} catch (e) { | ||
if (isNotFoundError(e)) { | ||
return; | ||
} | ||
if (e instanceof SyntaxError) { | ||
e.message = `Error parsing ${path}: ${e.message}`; | ||
throw e; | ||
} | ||
throw e; | ||
} | ||
} | ||
function maybeReaddirSync(path) { | ||
@@ -51,0 +66,0 @@ try { |
@@ -88,2 +88,11 @@ "use strict"; | ||
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); | ||
@@ -90,0 +99,0 @@ this.hasConfig = this.hasFile(this.resolve(CONFIG_PATH)); |
@@ -24,3 +24,5 @@ /** | ||
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` | ||
); | ||
} | ||
@@ -183,2 +185,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL2J1aWxkaW5nL3Byb2plY3QudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCAyMDIyLTIwMjQgTWF0dGVyLmpzIEF1dGhvcnNcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG4gKi9cblxuaW1wb3J0IHsgSGFzaCB9IGZyb20gXCJjcnlwdG9cIjtcbmltcG9ydCB7IGJ1aWxkIGFzIGVzYnVpbGQsIEZvcm1hdCB9IGZyb20gXCJlc2J1aWxkXCI7XG5pbXBvcnQgeyBjcCwgbWtkaXIsIHJlYWRGaWxlLCBybSwgc3ltbGluaywgd3JpdGVGaWxlIH0gZnJvbSBcImZzL3Byb21pc2VzXCI7XG5pbXBvcnQgeyBwbGF0Zm9ybSB9IGZyb20gXCJvc1wiO1xuaW1wb3J0IHsgZGlybmFtZSwgam9pbiB9IGZyb20gXCJwYXRoXCI7XG5pbXBvcnQgeyBpZ25vcmVFcnJvciB9IGZyb20gXCIuLi91dGlsL2Vycm9ycy5qc1wiO1xuaW1wb3J0IHsgQ09ORklHX1BBVEgsIFBhY2thZ2UgfSBmcm9tIFwiLi4vdXRpbC9wYWNrYWdlLmpzXCI7XG5cbmV4cG9ydCBjb25zdCBCVUlMRF9JTkZPX0xPQ0FUSU9OID0gXCJidWlsZC9pbmZvLmpzb25cIjtcblxuZXhwb3J0IGludGVyZmFjZSBCdWlsZEluZm9ybWF0aW9uIHtcbiAgICAvKipcbiA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STVwiICYmIHBsYXRmb3JtKCkgPT09IFwid2luMzJcIikge1xuICAgICAgICAgICAgICAgIC8vIElmIGRldmVsb3BlciBtb2RlIGlzIG5vdCBlbmFibGVkLCB3ZSBjYW4ndCBjcmVhdGUgYSBzeW1saW5rXG4gICAgICAgICAgICAgICAgLy8gb24gV2luZG93cy4gIENvcHkgaW5zdGVhZFxuICAgICAgICAgICAgICAgIGF3YWl0IGNwKHRoaXMucGtnLnJlc29sdmUoc3JjKSwgdGhpcy5wa2cucmVzb2x2ZShkZXN0KSwge1xuICAgICAgICAgICAgICAgICAgICByZWN1cnNpdmU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgIGZvcmNlOiB0cnVlLFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuI2NvbmZpZ3VyZUZvcm1hdChcImJ1aWxkXCIsIGZvcm1hdCwgZmFsc2UpO1xuICAgIH1cblxuICAgIGFzeW5jIGNsZWFuKCkge1xuICAgICAgICBmb3IgKGNvbnN0IGRpciBvZiBbXCJidWlsZFwiLCBcImRpc3RcIl0pIHtcbiAgICAgICAgICAgIGF3YWl0IHJtKHRoaXMucGtnLnJlc29sdmUoZGlyKSwgeyByZWN1cnNpdmU6IHRydWUsIGZvcmNlOiB0cnVlIH0pO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZ2V0IGhhc0RlY2xhcmF0aW9ucygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMucGtnLmhhc0RpcmVjdG9yeShcImJ1aWxkL3R5cGVzXCIpO1xuICAgIH1cblxuICAgIGFzeW5jIGhhc2hEZWNsYXJhdGlvbnMoYXBpU2hhOiBIYXNoKSB7XG4gICAgICAgIGlmICghdGhpcy5wa2cuaXNMaWJyYXJ5KSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgIC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cblxuICAgICAgICBpZiAoIXRoaXMucGtnLmhhc0NvbmZpZykge1xuICAgICAgICAgICAgcmV0dXJuIHt9O1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgY29uZmlnUGF0aCA9IHRoaXMucGtnLnJlc29sdmUoQ09ORklHX1BBVEgpO1xuXG4gICAgICAgIGNvbnN0IG91dGZpbGUgPSBjb25maWdQYXRoLnJlcGxhY2UoL1xcXFwvZywgXCIvXCIpLnJlcGxhY2UoXCIvc3JjL1wiLCBcIi9idWlsZC9cIikucmVwbGFjZSgvXFwudHMkLywgXCIuanNcIik7XG4gICAgICAgIGF3YWl0IGVzYnVpbGQoe1xuICAgICAgICAgICAgZW50cnlQb2ludHM6IFtjb25maWdQYXRoXSxcbiAgICAgICAgICAgIG91dGZpbGUsXG4gICAgICAgICAgICBzb3VyY2VtYXA6IHRydWUsXG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuI2NvbmZpZyA9IChhd2FpdCBpbXBvcnQoYGZpbGU6Ly8ke291dGZpbGV9YCkpIGFzIFByb2plY3QuQ29uZmlnIHwgdW5kZWZpbmVkO1xuICAgICAgICB0aGlzLiNjb25maWd1cmVkID0gdHJ1ZTtcblxuICAgICAgICBpZiAodGhpcy4jY29uZmlnPy5zdGFydHVwKSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLiNjb25maWc/LnN0YXJ0dXAoe1xuICAgICAgICAgICAgICAgIHByb2plY3Q6IHRoaXMsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzLiNjb25maWc7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ29weSBmaWxlcyBpbnRvIGRpc3QgZm9yIHN1cHBvcnRlZCBmb3JtYXRzLlxuICAgICAqL1xuICAgIGFzeW5jIGNvcHlUb0Rpc3Qoc291cmNlOiBzdHJpbmcsIGRlc3Q6IHN0cmluZykge1xuICAgICAgICBjb25zdCBmb3JtYXRzID0gQXJyYXk8c3RyaW5nPigpO1xuICAgICAgICBpZiAodGhpcy5wa2cuc3VwcG9ydHNFc20pIHtcbiAgICAgICAgICAgIGZvcm1hdHMucHVzaChcImVzbVwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5wa2cuc3VwcG9ydHNDanMpIHtcbiAgICAgICAgICAgIGZvcm1hdHMucHVzaChcImNqc1wiKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IGZvcm1hdCBvZiBmb3JtYXRzKSB7XG4gICAgICAgICAgICBhd2FpdCBjcCh0aGlzLnBrZy5yZXNvbHZlKHNvdXJjZSksIHRoaXMucGtnLnJlc29sdmUoam9pbihcImRpc3RcIiwgZm9ybWF0LCBkZXN0KSksIHtcbiAgICAgICAgICAgICAgICByZWN1cnNpdmU6IHRydWUsXG4gICAgICAgICAgICAgICAgZm9yY2U6IHRydWUsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGFzeW5jICNidWlsZChmb3JtYXQ6IEZvcm1hdCwgaW5kaXI6IHN0cmluZywgb3V0ZGlyOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3QgZW50cnlQb2ludHMgPSBhd2FpdCB0aGlzLiN0YXJnZXRzT2YoaW5kaXIsIG91dGRpciwgXCJ0c1wiLCBcImpzXCIpO1xuXG4gICAgICAgIGNvbnN0IGNvbmZpZ1BhdGggPSB0aGlzLnBrZy5yZXNvbHZlKENPTkZJR19QQVRIKTtcbiAgICAgICAgZm9yIChjb25zdCBlbnRyeSBvZiBlbnRyeVBvaW50cykge1xuICAgICAgICAgICAgaWYgKGVudHJ5LmluID09PSBjb25maWdQYXRoKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbnRyeS5vdXQgPSBlbnRyeS5vdXQucmVwbGFjZSgvXFwuW2p0XXMkLywgXCJcIik7XG4gICAgICAgIH1cblxuICAgICAgICBhd2FpdCBlc2J1aWxkKHtcbiAgICAgICAgICAgIGVudHJ5UG9pbnRzLFxuICAgICAgICAgICAgb3V0ZGlyOiB0aGlzLnBrZy5wYXRoLFxuICAgICAgICAgICAgZm9ybWF0LFxuICAgICAgICAgICAgc291cmNlbWFwOiB0cnVlLFxuICAgICAgICAgICAgc291cmNlc0NvbnRlbnQ6IGZhbHNlLFxuICAgICAgICAgICAgYWJzV29ya2luZ0RpcjogZGlybmFtZSh0aGlzLnBrZy5yZXNvbHZlKGluZGlyKSksXG5cbiAgICAgICAgICAgIC8vIFRoaXMgaXMgbmVjZXNzYXJ5IHRvIGRvd25sZXZlbCBcInVzaW5nXCJcbiAgICAgICAgICAgIHRhcmdldDogXCJlczIwMjJcIixcblxuICAgICAgICAgICAgbG9nT3ZlcnJpZGU6IHtcbiAgICAgICAgICAgICAgICBcImRpcmVjdC1ldmFsXCI6IFwic2lsZW50XCIsXG4gICAgICAgICAgICB9LFxuICAgICAgICB9KTtcblxuICAgICAgICBmb3IgKGNvbnN0IGVudHJ5IG9mIGF3YWl0IHRoaXMuI3RhcmdldHNPZihpbmRpciwgb3V0ZGlyLCBcImNqc1wiLCBcIm1qc1wiLCBcImQuY3RzXCIsIFwiZC5tdHNcIikpIHtcbiAgICAgICAgICAgIGF3YWl0IGNwKGVudHJ5LmluLCBlbnRyeS5vdXQpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgYXN5bmMgI2NvbmZpZ3VyZUZvcm1hdChkaXI6IHN0cmluZywgZm9ybWF0OiBGb3JtYXQsIGlzRGlzdDogYm9vbGVhbikge1xuICAgICAgICAvLyBCdWlsZCBpbXBvcnQgbWFwXG4gICAgICAgIGxldCB7IGltcG9ydHMgfSA9IHRoaXMucGtnLmpzb247XG4gICAgICAgIGlmIChpc0Rpc3QgJiYgdHlwZW9mIGltcG9ydHMgPT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgIGltcG9ydHMgPSB7IC4uLmltcG9ydHMgfTtcbiAgICAgICAgICAgIGZvciAo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YW4ndCBjcmVhdGUgYSBzeW1saW5rXG4gICAgICAgICAgICAgICAgLy8gb24gV2luZG93cy4gIENvcHkgaW5zdGVhZFxuICAgICAgICAgICAgICAgIGF3YWl0IGNwKHRoaXMucGtnLnJlc29sdmUoc3JjKSwgdGhpcy5wa2cucmVzb2x2ZShkZXN0KSwge1xuICAgICAgICAgICAgICAgICAgICByZWN1cnNpdmU6IHRydWUsXG4gICAgICAgICAgICAgICAgICAgIGZvcmNlOiB0cnVlLFxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHRoaXMuI2NvbmZpZ3VyZUZvcm1hdChcImJ1aWxkXCIsIGZvcm1hdCwgZmFsc2UpO1xuICAgIH1cblxuICAgIGFzeW5jIGNsZWFuKCkge1xuICAgICAgICBmb3IgKGNvbnN0IGRpciBvZiBbXCJidWlsZFwiLCBcImRpc3RcIl0pIHtcbiAgICAgICAgICAgIGF3YWl0IHJtKHRoaXMucGtnLnJlc29sdmUoZGlyKSwgeyByZWN1cnNpdmU6IHRydWUsIGZvcmNlOiB0cnVlIH0pO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgZ2V0IGhhc0RlY2xhcmF0aW9ucygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMucGtnLmhhc0RpcmVjdG9yeShcImJ1aWxkL3R5cGVzXCIpO1xuICAgIH1cblxuICAgIGFzeW5jIGhhc2hEZWNsYXJhdGlvbnMoYXBpU2hhOiBIYXNoKSB7XG4gICAgICAgIGlmICghdGhpcy5wa2cuaXNMaWJyYXJ5KSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBsZXQgcGF0aDtcbiAgICAgICAgaWYgKHRoaXMucGtnLnN1cHBvcnRzRXNtKSB7XG4gICAgICAgICAgICBwYXRoID0gXCJlc21cIjtcbi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UGF0aCA9IHRoaXMucGtnLnJlc29sdmUoQ09ORklHX1BBVEgpO1xuXG4gICAgICAgIGNvbnN0IG91dGZpbGUgPSBjb25maWdQYXRoLnJlcGxhY2UoL1xcXFwvZywgXCIvXCIpLnJlcGxhY2UoXCIvc3JjL1wiLCBcIi9idWlsZC9cIikucmVwbGFjZSgvXFwudHMkLywgXCIuanNcIik7XG4gICAgICAgIGF3YWl0IGVzYnVpbGQoe1xuICAgICAgICAgICAgZW50cnlQb2ludHM6IFtjb25maWdQYXRoXSxcbiAgICAgICAgICAgIG91dGZpbGUsXG4gICAgICAgICAgICBzb3VyY2VtYXA6IHRydWUsXG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMuI2NvbmZpZyA9IChhd2FpdCBpbXBvcnQoYGZpbGU6Ly8ke291dGZpbGV9YCkpIGFzIFByb2plY3QuQ29uZmlnIHwgdW5kZWZpbmVkO1xuICAgICAgICB0aGlzLiNjb25maWd1cmVkID0gdHJ1ZTtcblxuICAgICAgICBpZiAodGhpcy4jY29uZmlnPy5zdGFydHVwKSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLiNjb25maWc/LnN0YXJ0dXAoe1xuICAgICAgICAgICAgICAgIHByb2plY3Q6IHRoaXMsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzLiNjb25maWc7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ29weSBmaWxlcyBpbnRvIGRpc3QgZm9yIHN1cHBvcnRlZCBmb3JtYXRzLlxuICAgICAqL1xuICAgIGFzeW5jIGNvcHlUb0Rpc3Qoc291cmNlOiBzdHJpbmcsIGRlc3Q6IHN0cmluZykge1xuICAgICAgICBjb25zdCBmb3JtYXRzID0gQXJyYXk8c3RyaW5nPigpO1xuICAgICAgICBpZiAodGhpcy5wa2cuc3VwcG9ydHNFc20pIHtcbiAgICAgICAgICAgIGZvcm1hdHMucHVzaChcImVzbVwiKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAodGhpcy5wa2cuc3VwcG9ydHNDanMpIHtcbiAgICAgICAgICAgIGZvcm1hdHMucHVzaChcImNqc1wiKTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IGZvcm1hdCBvZiBmb3JtYXRzKSB7XG4gICAgICAgICAgICBhd2FpdCBjcCh0aGlzLnBrZy5yZXNvbHZlKHNvdXJjZSksIHRoaXMucGtnLnJlc29sdmUoam9pbihcImRpc3RcIiwgZm9ybWF0LCBkZXN0KSksIHtcbiAgICAgICAgICAgICAgICByZWN1cnNpdmU6IHRydWUsXG4gICAgICAgICAgICAgICAgZm9yY2U6IHRydWUsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGFzeW5jICNidWlsZChmb3JtYXQ6IEZvcm1hdCwgaW5kaXI6IHN0cmluZywgb3V0ZGlyOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3QgZW50cnlQb2ludHMgPSBhd2FpdCB0aGlzLiN0YXJnZXRzT2YoaW5kaXIsIG91dGRpciwgXCJ0c1wiLCBcImpzXCIpO1xuXG4gICAgICAgIGNvbnN0IGNvbmZpZ1BhdGggPSB0aGlzLnBrZy5yZXNvbHZlKENPTkZJR19QQVRIKTtcbiAgICAgICAgZm9yIChjb25zdCBlbnRyeSBvZiBlbnRyeVBvaW50cykge1xuICAgICAgICAgICAgaWYgKGVudHJ5LmluID09PSBjb25maWdQYXRoKSB7XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBlbnRyeS5vdXQgPSBlbnRyeS5vdXQucmVwbGFjZSgvXFwuW2p0XXMkLywgXCJcIik7XG4gICAgICAgIH1cblxuICAgICAgICBhd2FpdCBlc2J1aWxkKHtcbiAgICAgICAgICAgIGVudHJ5UG9pbnRzLFxuICAgICAgICAgICAgb3V0ZGlyOiB0aGlzLnBrZy5wYXRoLFxuICAgICAgICAgICAgZm9ybWF0LFxuICAgICAgICAgICAgc291cmNlbWFwOiB0cnVlLFxuICAgICAgICAgICAgc291cmNlc0NvbnRlbnQ6IGZhbHNlLFxuICAgICAgICAgICAgYWJzV29ya2luZ0RpcjogZGlybmFtZSh0aGlzLnBrZy5yZXNvbHZlKGluZGlyKSksXG5cbiAgICAgICAgICAgIC8vIFRoaXMgaXMgbmVjZXNzYXJ5IHRvIGRvd25sZXZlbCBcInVzaW5nXCJcbiAgICAgICAgICAgIHRhcmdldDogXCJlczIwMjJcIixcblxuICAgICAgICAgICAgbG9nT3ZlcnJpZGU6IHtcbiAgICAgICAgICAgICAgICBcImRpcmVjdC1ldmFsXCI6IFwic2lsZW50XCIsXG4gICAgICAgICAgICB9LFxuICAgICAgICB9KTtcblxuICAgICAgICBmb3IgKGNvbnN0IGVudHJ5IG9mIGF3YWl0IHRoaXMuI3RhcmdldHNPZihpbmRpciwgb3V0ZGlyLCBcImNqc1wiLCBcIm1qc1wiLCBcImQuY3RzXCIsIFwiZC5tdHNcIikpIHtcbiAgICAgICAgICAgIGF3YWl0IGNwKGVudHJ5LmluLCBlbnRyeS5vdXQpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgYXN5bmMgI2NvbmZpZ3VyZUZvcm1hdChkaXI6IHN0cmluZywgZm9ybWF0OiBGb3JtYXQsIGlzRGlzdDogYm9vbGVhbikge1xuICAgICAgICAvLyBCdWlsZCBpbXBvcnQgbWFwXG4gICAgICAgIGxldCB7IGltcG9ydHMgfSA9IHRoaXMucGtnLmpzb247XG4gICAgICAgIGlmIChpc0Rpc3QgJiYgdHlwZW9mIGltcG9ydHMgPT09IFwib2JqZWN0XCIpIHtcbiAgICAgICAgICAgIGltcG9ydHMgPSB7IC4uLmltcG9ydHMgfTtcbiAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IGluIGltcG9ydHMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCB2YWx1ZSA9IGltcG9ydHNba2V5XTtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9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R0FBRyxRQUFRO0FBQ3ZCLGlCQUFXLE9BQU8sU0FBUztBQUN2QixjQUFNLFFBQVEsUUFBUSxHQUFHO0FBQ3pCLFlBQUksT0FBTyxVQUFVLFVBQVU7QUFDM0Isa0JBQVEsR0FBRyxJQUFJLE1BQU0sUUFBUSxjQUFjLElBQUk7QUFBQSxRQUNuRDtBQUFBLE1BQ0o7QUFBQSxJQUNKO0FBR0EsVUFBTSxPQUFPLEtBQUssSUFBSSxRQUFRLEdBQUcsR0FBRyxJQUFJLE1BQU0sZUFBZTtBQUM3RCxVQUFNLE9BQWdDO0FBQUEsTUFDbEMsTUFBTSxXQUFXLFFBQVEsYUFBYTtBQUFBLE1BQ3RDO0FBQUEsSUFDSjtBQUNBLFVBQU0sVUFBVSxNQUFNLEtBQUssVUFBVSxNQUFNLFFBQVcsQ0FBQyxDQUFDO0FBQUEsRUFDNUQ7QUFBQSxFQUVBLE1BQU0sV0FBVyxPQUFlLFdBQW1CLFlBQXNCO0FBQ3JFLFVBQU0sb0JBQW9CLEtBQUssSUFBSSxRQUFRLEtBQUssRUFBRSxTQUFTO0FBQzNELGFBQVMsS0FBSyxJQUFJLFFBQVEsTUFBTSxFQUFFLFFBQVEsT0FBTyxHQUFHO0FBRXBELFlBQVEsTUFBTSxLQUFLLElBQUksS0FBSyxXQUFXLElBQUksU0FBTyxHQUFHLEtBQUssU0FBUyxHQUFHLEVBQUUsQ0FBQyxHQUFHLElBQUksV0FBUztBQUFBLE1BQ3JGLElBQUk7QUFBQSxNQUNKLEtBQUssR0FBRyxNQUFNLElBQUksS0FBSyxNQUFNLGlCQUFpQixDQUFDO0FBQUEsSUFDbkQsRUFBRTtBQUFBLEVBQ047QUFDSjsiLAogICJuYW1lcyI6IFtdCn0K |
@@ -7,2 +7,3 @@ /** | ||
export declare function maybeStatSync(path: string): import("fs").Stats | undefined; | ||
export declare function maybeReadJsonSync(path: string): any; | ||
export declare function maybeReaddirSync(path: string): string[] | undefined; | ||
@@ -9,0 +10,0 @@ export declare class GlobError extends Error { |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
import { readdirSync, statSync } from "fs"; | ||
import { readdirSync, readFileSync, statSync } from "fs"; | ||
import { GLOBSTAR, Minimatch } from "minimatch"; | ||
@@ -23,2 +23,16 @@ import { resolve } from "path"; | ||
} | ||
function maybeReadJsonSync(path) { | ||
try { | ||
return JSON.parse(readFileSync(path, "utf-8")); | ||
} catch (e) { | ||
if (isNotFoundError(e)) { | ||
return; | ||
} | ||
if (e instanceof SyntaxError) { | ||
e.message = `Error parsing ${path}: ${e.message}`; | ||
throw e; | ||
} | ||
throw e; | ||
} | ||
} | ||
function maybeReaddirSync(path) { | ||
@@ -110,5 +124,6 @@ try { | ||
globSync, | ||
maybeReadJsonSync, | ||
maybeReaddirSync, | ||
maybeStatSync | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3V0aWwvZmlsZXMudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGxpY2Vuc2VcbiAqIENvcHlyaWdodCAyMDIyLTIwMjQgTWF0dGVyLmpzIEF1dGhvcnNcbiAqIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG4gKi9cblxuaW1wb3J0IHsgcmVhZGRpclN5bmMsIHN0YXRTeW5jIH0gZnJvbSBcImZzXCI7XG5pbXBvcnQgeyBHTE9CU1RBUiwgTWluaW1hdGNoLCBQYXJzZVJldHVybkZpbHRlcmVkIH0gZnJvbSBcIm1pbmltYXRjaFwiO1xuaW1wb3J0IHsgcmVzb2x2ZSB9IGZyb20gXCJwYXRoXCI7XG5cbmZ1bmN0aW9uIGlzTm90Rm91bmRFcnJvcihlOiB1bmtub3duKSB7XG4gICAgcmV0dXJuIHR5cGVvZiBlID09PSBcIm9iamVjdFwiICYmIGUgIT09IG51bGwgJiYgXCJjb2RlXCIgaW4gZSAmJiA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1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gRmlsdGVyIHN0YXJ0cyB3aXRoIG1hZ2ljIHNvIGxvYWQgZGlyZWN0b3J5IGVudHJpZXMgdG8gbWF0Y2hcbiAgICAgICAgY29uc3Qgc3VibmFtZXMgPSBtYXliZVJlYWRkaXJTeW5jKHBhdGgpO1xuICAgICAgICBpZiAoIXN1Ym5hbWVzKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICAvLyBUZXN0IGVhY2ggZGlyZWN0b3J5IGVudHJ5XG4gICAgICAgIGZvciAoY29uc3Qgc3VibmFtZSBvZiBzdWJuYW1lcykge1xuICAgICAgICAgICAgY29uc3Qgc3VicGF0aCA9IHJlc29sdmUocGF0aCwgc3VibmFtZSk7XG5cbiAgICAgICAgICAgIC8vIEFueXRoaW5nIGJ1dCBHTE9CU1RBUiBpcyAxOjEgc3VibmFtZS9zZWdtZW50IG1hdGNoXG4gICAgICAgICAgICBpZiAoc2VnbWVudHNbMF0gIT09IEdMT0JTVEFSKSB7XG4gICAgICAgICAgICAgICAgaWYgKG1tLm1hdGNoT25lKFtzdWJuYW1lXSwgc2VnbWVudHMsIHRydWUpKSB7XG4gICAgICAgICAgICAgICAgICAgIG1hdGNoKHN1YnBhdGgsIHNlZ21lbnRzLnNsaWNlKDEpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIEdMT0JTVEFSIG1hdGNoZXMgbm90aGluZyBzbyB0ZXN0IHNlY29uZCBzZWdtZW50XG4gICAgICAgICAgICBpZiAoc2VnbWVudHMubGVuZ3RoID4gMSkge1xuICAgICAgICAgICAgICAgIGlmIChtbS5tYXRjaE9uZShbc3VibmFtZV0sIHNlZ21lbnRzLnNsaWNlKDEpLCB0cnVlKSkge1xuICAgICAgICAgICAgICAgICAgICBtYXRjaChzdWJwYXRoLCBzZWdtZW50cy5zbG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BRyxTQUFTLENBQUMsT0FBTyxHQUFHLFNBQVMsTUFBTSxDQUFDLEdBQUcsSUFBSSxHQUFHO0FBQ2pELGdCQUFNLFNBQVMsU0FBUyxNQUFNLENBQUMsQ0FBQztBQUFBLFFBQ3BDO0FBQUEsTUFDSjtBQUdBLFlBQU0sU0FBUyxRQUFRO0FBQUEsSUFDM0I7QUFBQSxFQUNKO0FBRUEsUUFBTSxVQUFVLFFBQVE7QUFFeEIsU0FBTztBQUNYOyIsCiAgIm5hbWVzIjogW10KfQo= |
@@ -10,3 +10,3 @@ /** | ||
import { ignoreError, ignoreErrorSync } from "./errors.js"; | ||
import { globSync, maybeStatSync } from "./files.js"; | ||
import { globSync, maybeReadJsonSync, maybeStatSync } from "./files.js"; | ||
import { Progress } from "./progress.js"; | ||
@@ -63,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); | ||
@@ -312,2 +321,2 @@ this.hasConfig = this.hasFile(this.resolve(CONFIG_PATH)); | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3V0aWwvcGFja2FnZS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IDIwMjItMjAyNCBNYXR0ZXIuanMgQXV0aG9yc1xuICogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEFwYWNoZS0yLjBcbiAqL1xuXG5pbXBvcnQgeyBleGlzdHNTeW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biAgICB9XG5cbiAgICBhc3luYyBsYXN0TW9kaWZpZWQoLi4ucGF0aHM6IHN0cmluZ1tdKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmxhc3RNb2RpZmllZEFic29sdXRlKHBhdGhzLm1hcChwID0+IHRoaXMucmVzb2x2ZShwKSkpO1xuICAgIH1cblxuICAgIHByaXZhdGUgYXN5bmMgbGFzdE1vZGlmaWVkQWJzb2x1dGUocGF0aHM6IHN0cmluZ1tdKSB7XG4gICAgICAgIGxldCBtdGltZSA9IDA7XG4gICAgICAgIGF3YWl0IFByb21pc2UuYWxsKFxuICAgICAgICAgICAgcGF0aHMubWFwKGFzeW5jIHAgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHN0YXRzID0gYXdhaXQgaWdub3JlRXJyb3IoXCJFTk9FTlRcIiwgYXN5bmMgKCkgPT4gYXdhaXQgc3RhdChwKSk7XG4gICAgICAgICAgICAgICAgaWYgKCFzdGF0cykge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgbGV0IHRoaXNNdGltZTtcbiAgICAgICAgICAgICAgICBpZiAoc3RhdHMuaXNEaXJlY3RvcnkoKSkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBwYXRocyA9IChhd2FpdCByZWFkZGlyKHApKS5tYXAocDIgPT4gcmVzb2x2ZShwLCBwMikpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzTXRpbWUgPSBhd2FpdCB0aGlzLmxhc3RNb2RpZmllZEFic29sdXRlKHBhdGhzKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzTXRpbWUgPSBzdGF0cy5tdGltZU1zO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpc010aW1lID4gbXRpbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgbXRpbWUgPSB0aGlzTXRpbWU7XG4gIC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BBcnJheS5pc0FycmF5KHBrZy5qc29uLndvcmtzcGFjZXMpKTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gd29ya3NwYWNlO1xuICAgIH1cblxuICAgIHN0YXRpYyBnZXQgdG9vbHMoKSB7XG4gICAgICAgIGlmICghdG9vbHMpIHtcbiAgICAgICAgICAgIHRvb2xzID0gbmV3IFBhY2thZ2UoeyBwYXRoOiB0b29sc1BhdGggfSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRvb2xzO1xuICAgIH1cblxuICAgIHN0YXRpYyBmaW5kRXhwb3J0KG5hbWU6IHN0cmluZywgdHlwZTogXCJjanNcIiB8IFwiZXNtXCIgPSBcImVzbVwiKSB7XG4gICAgICAgIHJldHVybiB0aGlzLndvcmtzcGFjZS5yZXNvbHZlSW1wb3J0KG5hbWUsIHR5cGUpO1xuICAgIH1cblxuICAgIHJlc29sdmVFeHBvcnQobmFtZTogc3RyaW5nLCB0eXBlOiBcImNqc1wiIHwgXCJlc21cIiA9IFwiZXNtXCIpIHtcbiAgICAgICAgaWYgKCFuYW1lLnN0YXJ0c1dpdGgoXCIuXCIpKSB7XG4gICAgICAgICAgICBuYW1lID0gYC4vJHtuYW1lfWA7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgZXhwb3J0RGV0YWlsID0gdGhpcy5leHBvcnRzPy5bbmFtZV07XG5cbiAgICAgICAgaWYgKGV4cG9ydERldGFpbCkge1xuICAgICAgICAgICAgY29uc3QgZXhwID0gZmluZEV4cG9ydENvbmRpdGlvbihleHBvcnREZXRhaWwsIHR5cGUpO1xuICAgICAgICAgICAgaWYgKGV4cCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlc29sdmUoZXhwKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChuYW1lID09PSBcIi5cIikge1xuICAgICAgICAgICAgaWYgKHR5cGUgPT09IFwiZXNtXCIgJiYgdGhpcy5qc29uLm1vZHVsZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnJlc29sdmUodGhpcy5qc29uLm1vZHVsZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodGhpcy5qc29uLm1haW4pIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlKHRoaXMuanNvbi5tYWluKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IHJlc29sdmUgZXhwb3J0ICR7bmFtZX0gaW4gcGFja2FnZSAke3RoaXMubmFtZX1gKTtcbiAgICB9XG5cbiAgICBmaW5kUGFja2FnZShuYW1lOiBzdHJpbmcpIHtcbiAgICAgICAgbGV0IHJlc29sdmVJbiA9IHRoaXMucGF0aDtcbiAgICAgICAgd2hpbGUgKHRydWUpIHtcbiAgICAgICAgICAgIGlmIChpc0RpcmVjdG9yeShyZXNvbHZlKHJlc29sdmVJbiwgXCJub2RlX21vZHVsZXNcIiwgbmFtZSkpKSB7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBjb25zdCBuZXh0UmVzb2x2ZUluID0gZGlybmFtZShyZXNvbHZlSW4pO1xuICAgICAgICAgICAgaWYgKG5leHRSZXNvbHZlSW4gPT09IHJlc29sdmVJbikge1xuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IGZpbmQgbW9kdWxlICR7bmFtZX0gZnJvbSAke3RoaXMucGF0aH1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc29sdmVJbiA9IG5leHRSZXNvbHZlSW47XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gUGFja2FnZS5mb3JQYXRoKHJlc29sdmUocmVzb2x2ZUluLCBcIm5vZGVfbW9kdWxlc1wiLCBuYW1lKSk7XG4gICAgfVxuXG4gICAgcmVzb2x2ZUltcG9ydChuYW1lOi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JpbmcpIHtcbiAgICAgICAgZnVuY3Rpb24gZmluZChwYXRoOiBzdHJpbmcpOiBQYWNrYWdlIHwgbnVsbCB7XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0gcGFja2FnZUZvclBhdGhbcGF0aF07XG4gICAgICAgICAgICBpZiAocmVzdWx0ID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXhpc3RzU3luYyhqb2luKHBhdGgsIFwicGFja2FnZS5qc29uXCIpKSkge1xuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBuZXcgUGFja2FnZSh7IHBhdGggfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gZmluZChkaXJuYW1lKHBhdGgpKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcGFja2FnZUZvclBhdGhbcGF0aF0gPSByZXN1bHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgcmVzdWx0ID0gZmluZChwYXRoKTtcblxuICAgICAgICByZXR1cm4gcmVzdWx0ID8/IHVuZGVmaW5lZDtcbiAgICB9XG5cbiAgICBzdGF0aWMgZm9yUGF0aChwYXRoOiBzdHJpbmcpIHtcbiAgICAgICAgY29uc3QgcmVzdWx0ID0gdGhpcy5tYXliZUZvclBhdGgocGF0aCk7XG4gICAgICAgIGlmIChyZXN1bHQgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgfVxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENhbm5vdCBmaW5kIHBhY2thZ2UuanNvbiBmb3IgXCIke3BhdGh9XCJgKTtcbiAgICB9XG5cbiAgICBnZXQgYWxpYXNlcygpOiBSZWNvcmQ8c3RyaW5nLCBzdHJpbmc+IHtcbiAgICAgICAgaWYgKHRoaX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AgICAgICAgcmV0dXJuIGdsb2JTeW5jKHBhdHRlcm4pO1xuICAgIH1cblxuICAgIHN0YXJ0KHdoYXQ6IHN0cmluZykge1xuICAgICAgICBjb25zdCBwcm9ncmVzcyA9IG5ldyBQcm9ncmVzcygpO1xuICAgICAgICBwcm9ncmVzcy5zdGFydHVwKHdoYXQsIHRoaXMpO1xuICAgICAgICByZXR1cm4gcHJvZ3Jlc3M7XG4gICAgfVxuXG4gICAgYXN5bmMgbGFzdE1vZGlmaWVkKC4uLnBhdGhzOiBzdHJpbmdbXSkge1xuICAgICAgICByZXR1cm4gdGhpcy5sYXN0TW9kaWZpZWRBYnNvbHV0ZShwYXRocy5tYXAocCA9PiB0aGlzLnJlc29sdmUocCkpKTtcbiAgICB9XG5cbiAgICBwcml2YXRlIGFzeW5jIGxhc3RNb2RpZmllZEFic29sdXRlKHBhdGhzOiBzdHJpbmdbXSkge1xuICAgICAgICBsZXQgbXRpbWUgPSAwO1xuICAgICAgICBhd2FpdCBQcm9taXNlLmFsbChcbiAgICAgICAgICAgIHBhdGhzLm1hcChhc3luYyBwID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBzdGF0cyA9IGF3YWl0IGlnbm9yZUVycm9yKFwiRU5PRU5UXCIsIGFzeW5jICgpID0+IGF3YWl0IHN0YXQocCkpO1xuICAgICAgICAgICAgICAgIGlmICghc3RhdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGxldCB0aGlzTXRpbWU7XG4gICAgICAgICAgICAgICAgaWYgKHN0YXRzLmlzRGlyZWN0b3J5KCkpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGF0aHMgPSAoYXdhaXQgcmVhZGRpcihwKSkubWFwKHAyID0+IHJlc29sdmUocCwgcDIpKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpc010aW1lID0gYXdhaXQgdGhpcy5sYXN0TW9kaWZpZWRBYnNvbHV0ZShwYXRocyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpc010aW1lID0gc3RhdHMubXRpbWVNcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHRoaXNNdGltZSA+IG10aW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIG10aW1lID0gdGhpc010aW1lO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pLFxuICAgICAgICApO1xuICAgICAgICByZXR1cm4gbXRpbWU7XG4gICAgfVxuXG4gICAgZ2V0IGRlcGVuZGVuY2llcygpIHtcbiAgICAgICAgbGV0IHJlc3VsdCA9IEFycmF5PHN0cmluZz4oKTtcbiAgICAgICAgZm9yIChjb25zdCB0eXBlIG9mIFtcImRlcGVuZGVuY2llc1wiLCBcIm9wdGlvbmFsRGVwZW5kZW5jaWVzXCIsIFwiZGV2RGVwZW5kZW5jaWVzXCIsIFwicGVlckRlcGVuZGVuY2llc1wiXSkge1xuICAgICAgICAgICAgaWYgKHR5cGVvZiB0aGlzLmpzb25bdHlwZV0gPT09IFwib2JqZWN0XCIgJiYgdGhpcy5qc29uW3R5cGVdICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gWy4uLnJlc3VsdCwgLi4uT2JqZWN0LmtleXModGhpcy5qc29uW3R5cGVdKV07XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIFsuLi5uZXcgU2V0KHJlc3VsdCldO1xuICAgIH1cblxuICAgIGdldCB3b3Jrc3BhY2UoKSB7XG4gICAgICAgIHJldHVybiBQYWNrYWdlLndvcmtzcGFjZUZvcih0aGlzLnBhdGgpO1xuICAgIH1cblxuICAgIHN0YXRpYyBzZXQgd29ya2luZ0Rpcih3ZDogc3RyaW5nKSB7XG4gICAgICAgIHdvcmtpbmdEaXIgPSB3ZDtcbiAgICB9XG5cbiAgICBzdGF0aWMgZ2V0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hwb3J0RGV0YWlsLCB0eXBlKTtcbiAgICAgICAgICAgIGlmIChleHApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlKGV4cCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAobmFtZSA9PT0gXCIuXCIpIHtcbiAgICAgICAgICAgIGlmICh0eXBlID09PSBcImVzbVwiICYmIHRoaXMuanNvbi5tb2R1bGUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5yZXNvbHZlKHRoaXMuanNvbi5tb2R1bGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMuanNvbi5tYWluKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMucmVzb2x2ZSh0aGlzLmpzb24ubWFpbik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENhbm5vdCByZXNvbHZlIGV4cG9ydCAke25hbWV9IGluIHBhY2thZ2UgJHt0aGlzLm5hbWV9YCk7XG4gICAgfVxuXG4gICAgZmluZFBhY2thZ2UobmFtZTogc3RyaW5nKSB7XG4gICAgICAgIGxldCByZXNvbHZlSW4gPSB0aGlzLnBhdGg7XG4gICAgICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICAgICAgICBpZiAoaXNEaXJlY3RvcnkocmVzb2x2ZShyZXNvbHZlSW4sIFwibm9kZV9tb2R1bGVzXCIsIG5hbWUpKSkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uc3QgbmV4dFJlc29sdmVJbiA9IGRpcm5hbWUocmVzb2x2ZUluKTtcbiAgICAgICAgICAgIGlmIChuZXh0UmVzb2x2ZUluID09PSByZXNvbHZlSW4pIHtcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYENhbm5vdCBmaW5kIG1vZHVsZSAke25hbWV9IGZyb20g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N5bmMgcmVhZEZpbGUocGF0aDogc3RyaW5nKSB7XG4gICAgICAgIHJldHVybiByZWFkRmlsZSh0aGlzLnJlc29sdmUocGF0aCksIFwidXRmLThcIik7XG4gICAgfVxuXG4gICAgcmVhZEZpbGVTeW5jKHBhdGg6IHN0cmluZykge1xuICAgICAgICByZXR1cm4gcmVhZEZpbGVTeW5jKHRoaXMucmVzb2x2ZShwYXRoKSwgXCJ1dGYtOFwiKTtcbiAgICB9XG5cbiAgICBhc3luYyB3cml0ZUZpbGUocGF0aDogc3RyaW5nLCBjb250ZW50czogdW5rbm93bikge1xuICAgICAgICBhd2FpdCB3cml0ZUZpbGUodGhpcy5yZXNvbHZlKHBhdGgpLCBgJHtjb250ZW50c31gKTtcbiAgICB9XG5cbiAgICBhc3luYyBzYXZlKCkge1xuICAgICAgICBhd2FpdCB0aGlzLndyaXRlRmlsZShqb2luKHRoaXMucGF0aCwgXCJwYWNrYWdlLmpzb25cIiksIEpTT04uc3RyaW5naWZ5KHRoaXMuanNvbiwgdW5kZWZpbmVkLCA0KSk7XG4gICAgfVxuXG4gICAgYXN5bmMgcmVhZEpzb24ocGF0aDogc3RyaW5nKSB7XG4gICAgICAgIGNvbnN0IHRleHQgPSBhd2FpdCB0aGlzLnJlYWRGaWxlKHBhdGgpO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UodGV4dCk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIGlmICghKGUgaW5zdGFuY2VvZiBFcnJvcikpIHtcbiAgICAgICAgICAgICAgICBlID0gbmV3IEVycm9yKGAke2V9YCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAoZSBhcyBFcnJvcikubWVzc2FnZSA9IGBFcnJvciBwYXJzaW5nIFwiJHt0aGlzLnJlc29sdmUocGF0aCl9XCI6ICR7KGUgYXMgRXJyb3IpLm1lc3NhZ2V9YDtcbiAgICAgICAgICAgIHRocm93IGU7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBhc3luYyB3cml0ZUpzb24ocGF0aDogc3RyaW5nLCB2YWx1ZToge30pIHtcbiAgICAgICAgYXdhaXQgdGhpcy53cml0ZUZpbGUocGF0aCwgSlNPTi5zdHJpbmdpZnkodmFsdWUsIHVuZGVmaW5lZCwgNCkpO1xuICAgIH1cblxuICAgIHN0YXRpYyBtYXliZUZvclBhdGgocGF0aDogc3RyaW5nKSB7XG4gICAgICAgIGZ1bmN0aW9uIGZpbmQocGF0aDogc3RyaW5nKTogUGFja2FnZSB8IG51bGwge1xuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHBhY2thZ2VGb3JQYXRoW3BhdGhdO1xuICAgICAgICAgICAgaWYgKHJlc3VsdCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgaWYgKGV4aXN0c1N5bmMoam9pbihwYXRoLCBcInBhY2thZ2UuanNvblwiKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gbmV3IFBhY2thZ2UoeyBwYXRoIH0pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IGZpbmQoZGlybmFtZShwYXRoKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHBhY2thZ2VGb3JQYXRoW3BhdGhdID0gcmVzdWx0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN0IHJlc3VsdCA9IGZpbmQocGF0aCk7XG5cbiAgICAgICAgcmV0dXJuIHJlc3VsdCA/PyB1bmRlZmluZWQ7XG4gICAgfVxuXG4gICAgc3RhdGljIGZvclBhdGgocGF0aDogc3RyaW5nKSB7XG4gICAgICAgIGNvbnN0IHJlc3VsdCA9IHRoaXMubWF5YmVGb3JQYXRoKHBhdGgpO1xuICAgICAgICBpZiAocmVzdWx0ICE9PSB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UyxVQUFhLEtBQUssV0FBVyxVQUM1QyxDQUFDLENBQUMsT0FBTyxPQUFPLEtBQUssV0FBVyxDQUFDLENBQUMsRUFBRSxLQUFLLENBQUMsUUFBYSxJQUFJLE9BQU87QUFBQSxFQUMxRSxPQUFPO0FBQ0gsVUFBTTtBQUNOLFVBQU0sQ0FBQyxDQUFDLEtBQUssVUFBVSxDQUFDLENBQUMsT0FBTyxPQUFPLEtBQUssV0FBVyxDQUFDLENBQUMsRUFBRSxLQUFLLENBQUMsUUFBYSxJQUFJLE1BQU07QUFBQSxFQUM1RjtBQUVBLFNBQU8sRUFBRSxLQUFLLElBQUk7QUFDdEI7QUFFQSxTQUFTLG9CQUFvQixRQUE2QixNQUF5QztBQUMvRixNQUFJLFNBQVMsU0FBUyxPQUFPLFFBQVE7QUFDakMsUUFBSUcsT0FBTSxPQUFPO0FBQ2pCLFFBQUlBLFFBQU8sT0FBT0EsU0FBUSxVQUFVO0FBQ2hDLE1BQUFBLE9BQU0sb0JBQW9CQSxNQUFLLElBQUk7QUFBQSxJQUN2QztBQUNBLFFBQUlBLE1BQUs7QUFDTCxhQUFPQTtBQUFBLElBQ1g7QUFBQSxFQUNKO0FBRUEsTUFBSSxNQUFNLE9BQU8sV0FBVyxPQUFPLFFBQVEsT0FBTztBQUNsRCxNQUFJLE9BQU8sT0FBTyxRQUFRLFVBQVU7QUFDaEMsVUFBTSxvQkFBb0IsS0FBSyxJQUFJO0FBQUEsRUFDdkM7QUFFQSxNQUFJLE9BQU8sUUFBUSxVQUFVO0FBQ3pCLFdBQU87QUFBQSxFQUNYO0FBQ0o7IiwKICAibmFtZXMiOiBbInBhdGhzIiwgImZpbmQiLCAicGF0aCIsICJyZXN1bHQiLCAiZXhwIl0KfQo= |
{ | ||
"name": "@matter/tools", | ||
"version": "0.11.0-alpha.0-20241028-f7b2f013d", | ||
"version": "0.11.0", | ||
"description": "Matter.js tooling", | ||
@@ -56,3 +56,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/commander": "^2.12.0", | ||
"@types/commander": "^2.12.5", | ||
"@types/minimatch": "^5.1.2", | ||
@@ -59,0 +59,0 @@ "@types/node": "^22.8.1" |
@@ -47,3 +47,5 @@ /** | ||
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`, | ||
); | ||
} | ||
@@ -50,0 +52,0 @@ } |
@@ -7,3 +7,3 @@ /** | ||
import { readdirSync, statSync } from "fs"; | ||
import { readdirSync, readFileSync, statSync } from "fs"; | ||
import { GLOBSTAR, Minimatch, ParseReturnFiltered } from "minimatch"; | ||
@@ -27,2 +27,17 @@ import { resolve } from "path"; | ||
export function maybeReadJsonSync(path: string) { | ||
try { | ||
return JSON.parse(readFileSync(path, "utf-8")); | ||
} catch (e) { | ||
if (isNotFoundError(e)) { | ||
return; | ||
} | ||
if (e instanceof SyntaxError) { | ||
e.message = `Error parsing ${path}: ${e.message}`; | ||
throw e; | ||
} | ||
throw e; | ||
} | ||
} | ||
export function maybeReaddirSync(path: string) { | ||
@@ -29,0 +44,0 @@ try { |
@@ -11,3 +11,3 @@ /** | ||
import { ignoreError, ignoreErrorSync } from "./errors.js"; | ||
import { globSync, maybeStatSync } from "./files.js"; | ||
import { globSync, maybeReadJsonSync, maybeStatSync } from "./files.js"; | ||
import { Progress } from "./progress.js"; | ||
@@ -75,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); | ||
@@ -77,0 +87,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
560317
8500