Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@anthropic-ai/dxt",
"description": "Tools for building Desktop Extensions",
"version": "0.2.0",
"version": "0.2.1",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
Expand Down Expand Up @@ -77,4 +77,4 @@
"@babel/helpers": "7.27.1",
"@babel/parser": "7.27.3"
}
}
}
54 changes: 0 additions & 54 deletions src/node/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) {
return ignore().add(EXCLUDE_PATTERNS).add(additionalPatterns);
}
Expand Down
2 changes: 1 addition & 1 deletion src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const DxtUserConfigurationOptionSchema = z.object({

export const DxtUserConfigValuesSchema = z.record(
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({
Expand Down