nf3 0.1.12 → 0.2.0

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/index.mjs +9 -11
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -285,26 +285,24 @@ function rollupNodeFileTrace(opts = {}) {
285
285
  }
286
286
  function normalizeMatcher(input) {
287
287
  if (typeof input === "function") {
288
- input.score = input.score ?? 1e4;
288
+ input.score = 3e4 + input.toString().length;
289
289
  return input;
290
290
  }
291
- if (input instanceof RegExp) {
292
- const matcher = ((id) => input.test(id));
293
- matcher.score = input.toString().length;
294
- Object.defineProperty(matcher, "name", { value: `match(${input})` });
295
- return matcher;
296
- }
297
291
  if (typeof input === "string") {
298
292
  const pattern = normalize(input);
299
293
  const matcher = ((id) => {
300
- const idWithoutNodeModules = id.split("node_modules/").pop();
301
- return id.startsWith(pattern) || idWithoutNodeModules?.startsWith(pattern);
294
+ return id.startsWith(pattern) || id.split("node_modules/").pop()?.startsWith(pattern);
302
295
  });
303
- matcher.score = input.length;
304
- if (!isAbsolute$1(input) && input[0] !== ".") matcher.score += 1e3;
296
+ matcher.score = 2e4 + input.length;
305
297
  Object.defineProperty(matcher, "name", { value: `match(${pattern})` });
306
298
  return matcher;
307
299
  }
300
+ if (input instanceof RegExp) {
301
+ const matcher = ((id) => input.test(id));
302
+ matcher.score = 1e4 + input.toString().length;
303
+ Object.defineProperty(matcher, "name", { value: `match(${input})` });
304
+ return matcher;
305
+ }
308
306
  throw new Error(`Invalid matcher or pattern: ${input}`);
309
307
  }
310
308
  async function isDirectory(path$1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nf3",
3
- "version": "0.1.12",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "repository": "unjs/nf3",
6
6
  "license": "MIT",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@rollup/plugin-node-resolve": "^16.0.3",
28
- "@types/node": "^24.10.0",
28
+ "@types/node": "^24.10.1",
29
29
  "@types/semver": "^7.7.1",
30
30
  "@vercel/nft": "^0.30.3",
31
- "@vitest/coverage-v8": "^4.0.8",
31
+ "@vitest/coverage-v8": "^4.0.9",
32
32
  "automd": "^0.4.2",
33
33
  "changelogen": "^0.6.2",
34
34
  "eslint": "^9.39.1",
@@ -36,16 +36,16 @@
36
36
  "exsolve": "^1.0.8",
37
37
  "mlly": "^1.8.0",
38
38
  "obuild": "^0.4.1",
39
- "oxc-minify": "^0.96.0",
39
+ "oxc-minify": "^0.97.0",
40
40
  "pathe": "^2.0.3",
41
41
  "pkg-types": "^2.3.0",
42
42
  "prettier": "^3.6.2",
43
- "rolldown": "1.0.0-beta.47",
43
+ "rolldown": "^1.0.0-beta.50",
44
44
  "rollup": "^4.53.2",
45
45
  "rollup-plugin-esbuild": "^6.2.1",
46
46
  "semver": "^7.7.3",
47
47
  "typescript": "^5.9.3",
48
- "vitest": "^4.0.8"
48
+ "vitest": "^4.0.9"
49
49
  },
50
- "packageManager": "pnpm@10.20.0"
50
+ "packageManager": "pnpm@10.22.0"
51
51
  }