parent
ac2df7c157
commit
3c1bb1c25e
3 changed files with 3 additions and 57 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@anthropic-ai/dxt",
|
"name": "@anthropic-ai/dxt",
|
||||||
"description": "Tools for building Desktop Extensions",
|
"description": "Tools for building Desktop Extensions",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
|
|
@ -77,4 +77,4 @@
|
||||||
"@babel/helpers": "7.27.1",
|
"@babel/helpers": "7.27.1",
|
||||||
"@babel/parser": "7.27.3"
|
"@babel/parser": "7.27.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -62,60 +62,6 @@ export function readDxtIgnorePatterns(baseDir: string): string[] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests if a file path matches a given pattern
|
|
||||||
*/
|
|
||||||
function matchesPattern(
|
|
||||||
pattern: string,
|
|
||||||
filePath: string,
|
|
||||||
fileName: string,
|
|
||||||
): boolean {
|
|
||||||
if (pattern.includes("*")) {
|
|
||||||
// Enhanced glob matching to handle directory paths like "temp/*"
|
|
||||||
let patternToMatch = pattern;
|
|
||||||
|
|
||||||
// Handle patterns like "dir/" by converting to "dir/**"
|
|
||||||
if (pattern.endsWith("/")) {
|
|
||||||
patternToMatch = pattern + "**";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert glob pattern to regex, with case sensitivity
|
|
||||||
const regexPattern =
|
|
||||||
"^" +
|
|
||||||
patternToMatch
|
|
||||||
.replace(/\./g, "\\.") // Escape dots
|
|
||||||
.replace(/\*\*/g, ".*") // ** matches anything including /
|
|
||||||
.replace(/\*/g, "[^/]*") + // * matches anything except /
|
|
||||||
"$";
|
|
||||||
|
|
||||||
const regex = new RegExp(regexPattern);
|
|
||||||
|
|
||||||
// Test full path
|
|
||||||
if (regex.test(filePath)) return true;
|
|
||||||
|
|
||||||
// Test filename
|
|
||||||
if (regex.test(fileName)) return true;
|
|
||||||
|
|
||||||
// Check if any part of the path matches for patterns like "node_modules"
|
|
||||||
const pathParts = filePath.split(sep);
|
|
||||||
for (const part of pathParts) {
|
|
||||||
if (regex.test(part)) return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Exact match
|
|
||||||
if (fileName === pattern) return true;
|
|
||||||
|
|
||||||
// Check if any part of the path matches
|
|
||||||
if (filePath.includes(pattern)) return true;
|
|
||||||
|
|
||||||
// Handle directory patterns like "tests/"
|
|
||||||
if (pattern.endsWith("/") && filePath.startsWith(pattern)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildIgnoreChecker(additionalPatterns: string[]) {
|
function buildIgnoreChecker(additionalPatterns: string[]) {
|
||||||
return ignore().add(EXCLUDE_PATTERNS).add(additionalPatterns);
|
return ignore().add(EXCLUDE_PATTERNS).add(additionalPatterns);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ export const DxtUserConfigurationOptionSchema = z.object({
|
||||||
|
|
||||||
export const DxtUserConfigValuesSchema = z.record(
|
export const DxtUserConfigValuesSchema = z.record(
|
||||||
z.string(),
|
z.string(),
|
||||||
z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])
|
z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const DxtManifestSchema = z.object({
|
export const DxtManifestSchema = z.object({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue