@kt3k/tku 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +9 -6
  2. package/package.json +4 -2
package/dist/main.js CHANGED
@@ -9,6 +9,7 @@ import { resolve } from "node:path";
9
9
  import { open } from "node:fs/promises";
10
10
  import { execFile } from "node:child_process";
11
11
  import { promisify } from "node:util";
12
+ import picomatch from "picomatch";
12
13
  var execFileAsync = promisify(execFile);
13
14
  async function listFiles(repoPath, options = {}) {
14
15
  const cwd = resolve(repoPath);
@@ -30,12 +31,14 @@ async function listFiles(repoPath, options = {}) {
30
31
  }
31
32
  let files = stdout.trim().split("\n").filter((f) => f.length > 0);
32
33
  if (options.exclude && options.exclude.length > 0) {
33
- const patterns = options.exclude.map((g) => new URLPattern({
34
- pathname: g
35
- }));
36
- files = files.filter((f) => !patterns.some((p) => p.test({
37
- pathname: f
38
- })));
34
+ const expanded = options.exclude.flatMap((g) => /[*?{[/]/.test(g) ? [
35
+ g
36
+ ] : [
37
+ g,
38
+ `${g}/**`
39
+ ]);
40
+ const isExcluded = picomatch(expanded);
41
+ files = files.filter((f) => !isExcluded(f));
39
42
  }
40
43
  return files;
41
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kt3k/tku",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build": "deno bundle --external tiktoken -o dist/main.js src/main.ts && chmod +x dist/main.js",
13
+ "build": "deno bundle --external tiktoken --external picomatch -o dist/main.js src/main.ts && chmod +x dist/main.js",
14
14
  "prepublishOnly": "npm run build",
15
15
  "test": "vitest run"
16
16
  },
@@ -19,10 +19,12 @@
19
19
  "license": "MIT",
20
20
  "type": "module",
21
21
  "dependencies": {
22
+ "picomatch": "^4.0.4",
22
23
  "tiktoken": "^1"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@types/node": "^25",
27
+ "@types/picomatch": "^4.0.3",
26
28
  "string-dedent": "^3",
27
29
  "vitest": "^3"
28
30
  }