qunitx-cli 0.9.3 → 0.9.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.
package/deno.lock CHANGED
@@ -11,7 +11,6 @@
11
11
  "npm:express@^5.2.1": "5.2.1",
12
12
  "npm:js-yaml@^4.1.1": "4.1.1",
13
13
  "npm:picomatch@*": "4.0.4",
14
- "npm:picomatch@^4.0.4": "4.0.4",
15
14
  "npm:playwright-core@^1.58.2": "1.58.2",
16
15
  "npm:prettier@^3.8.1": "3.8.1",
17
16
  "npm:qunitx@^1.0.4": "1.0.4",
@@ -636,7 +635,6 @@
636
635
  "npm:esbuild@~0.27.3",
637
636
  "npm:express@^5.2.1",
638
637
  "npm:js-yaml@^4.1.1",
639
- "npm:picomatch@^4.0.4",
640
638
  "npm:playwright-core@^1.58.2",
641
639
  "npm:prettier@^3.8.1",
642
640
  "npm:qunitx@^1.0.4",
@@ -1,9 +1,11 @@
1
- import fs from 'node:fs/promises';
1
+ import fs, { glob as fsGlob } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
- // @deno-types="npm:@types/picomatch"
4
- import picomatch from 'picomatch';
5
3
  import type { FSTree } from '../types.ts';
6
4
 
5
+ function isGlob(str: string): boolean {
6
+ return /[*?{[]/.test(str);
7
+ }
8
+
7
9
  async function readDirRecursive(dir: string, filter: (name: string) => boolean): Promise<string[]> {
8
10
  const entries = await fs.readdir(dir, { recursive: true, withFileTypes: true });
9
11
  return entries
@@ -24,26 +26,20 @@ export default async function buildFSTree(
24
26
 
25
27
  await Promise.all(
26
28
  fileAbsolutePaths.map(async (fileAbsolutePath) => {
27
- const glob = picomatch.scan(fileAbsolutePath);
28
-
29
29
  try {
30
- if (glob.isGlob) {
31
- const fileNames = await readDirRecursive(glob.base, (name) => {
32
- return targetExtensions.some((extension) => name.endsWith(`.${extension}`));
33
- });
34
-
35
- fileNames.forEach((fileName) => {
36
- if (picomatch.isMatch(fileName, fileAbsolutePath, { bash: true })) {
30
+ if (isGlob(fileAbsolutePath)) {
31
+ for await (const fileName of fsGlob(fileAbsolutePath)) {
32
+ if (targetExtensions.some((ext) => fileName.endsWith(`.${ext}`))) {
37
33
  fsTree[fileName] = null;
38
34
  }
39
- });
35
+ }
40
36
  } else {
41
37
  const entry = await fs.stat(fileAbsolutePath);
42
38
 
43
39
  if (entry.isFile()) {
44
40
  fsTree[fileAbsolutePath] = null;
45
41
  } else if (entry.isDirectory()) {
46
- const fileNames = await readDirRecursive(glob.base, (name) => {
42
+ const fileNames = await readDirRecursive(fileAbsolutePath, (name) => {
47
43
  return targetExtensions.some((extension) => name.endsWith(`.${extension}`));
48
44
  });
49
45
 
@@ -1,5 +1,8 @@
1
- // @deno-types="npm:@types/picomatch"
2
- import picomatch from 'picomatch';
1
+ import { matchesGlob } from 'node:path';
2
+
3
+ function isGlob(str: string): boolean {
4
+ return /[*?{[]/.test(str);
5
+ }
3
6
 
4
7
  interface PathMeta {
5
8
  input: string;
@@ -15,20 +18,12 @@ export default function setupTestFilePaths(_projectRoot: string, inputs: string[
15
18
  // NOTE: very complex algorithm, order is very important
16
19
  const [folders, filesWithGlob, filesWithoutGlob] = inputs.reduce(
17
20
  (result, input) => {
18
- const isGlob = picomatch.scan(input).isGlob;
21
+ const glob = isGlob(input);
19
22
 
20
23
  if (!pathIsFile(input)) {
21
- result[0].push({
22
- input,
23
- isFile: false,
24
- isGlob,
25
- });
24
+ result[0].push({ input, isFile: false, isGlob: glob });
26
25
  } else {
27
- result[isGlob ? 1 : 2].push({
28
- input,
29
- isFile: true,
30
- isGlob,
31
- });
26
+ result[glob ? 1 : 2].push({ input, isFile: true, isGlob: glob });
32
27
  }
33
28
 
34
29
  return result;
@@ -70,23 +65,10 @@ function pathIsIncludedInPaths(paths: PathMeta[], targetPath: PathMeta): boolean
70
65
  return false;
71
66
  }
72
67
 
73
- const globFormat = buildGlobFormat(path);
74
-
75
- return picomatch.isMatch(targetPath.input, globFormat, { bash: true });
68
+ return matchesGlob(targetPath.input, buildGlobFormat(path));
76
69
  });
77
70
  }
78
71
 
79
72
  function buildGlobFormat(path: PathMeta): string {
80
- if (!path.isFile) {
81
- if (!path.isGlob) {
82
- return `${path.input}/*`;
83
- } else if (path.input.endsWith('*')) {
84
- // NOTE: could be problematic in future, investigate if I should check endsWith /*
85
- return path.input;
86
- }
87
-
88
- return `${path.input}/*`;
89
- }
90
-
91
- return path.input;
73
+ return path.isFile ? path.input : `${path.input}/**`;
92
74
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qunitx-cli",
3
3
  "type": "module",
4
- "version": "0.9.3",
4
+ "version": "0.9.4",
5
5
  "description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
6
6
  "main": "cli.ts",
7
7
  "author": "Izel Nakri",
@@ -43,7 +43,6 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "esbuild": "^0.27.3",
46
- "picomatch": "^4.0.4",
47
46
  "playwright-core": "^1.58.2",
48
47
  "ws": "^8.20.0"
49
48
  },