knip 5.46.1 → 5.46.2

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.
@@ -39,7 +39,7 @@ export const resolve = (binary, _args, options) => {
39
39
  if (id.includes('node_modules/.bin/'))
40
40
  positionals.push(toBinary(extractBinary(id)));
41
41
  else
42
- positionals.push(toDeferResolveEntry(id));
42
+ positionals.push(toDeferResolveEntry(id, { optional: true }));
43
43
  }
44
44
  }
45
45
  const mapToParsedKey = (id) => parsed[id];
@@ -109,7 +109,8 @@ export async function build({ cacheLocation, chief, collector, cwd, deputy, fact
109
109
  productionEntryFilePatterns.add(resolvedFilePath);
110
110
  }
111
111
  else if (isDeferResolveEntry(input)) {
112
- entryFilePatterns.add(resolvedFilePath);
112
+ if (!isProduction || !input.optional)
113
+ entryFilePatterns.add(resolvedFilePath);
113
114
  }
114
115
  else {
115
116
  principal.addEntryPath(resolvedFilePath, { skipExportsAnalysis: true });
@@ -1,15 +1,16 @@
1
- import { toEntry } from '../../util/input.js';
1
+ import { toEntry, toProductionEntry } from '../../util/input.js';
2
2
  const title = 'Node.js';
3
3
  const isEnabled = () => true;
4
4
  const config = ['package.json'];
5
5
  const packageJsonPath = (id) => id;
6
6
  const resolveEntryPaths = localConfig => {
7
7
  const scripts = localConfig.scripts;
8
- const entry = ['server.js'];
8
+ const entries = [toProductionEntry('server.js')];
9
9
  if (scripts && Object.keys(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(scripts[script]))) {
10
- entry.push(...['**/*{.,-,_}test.?(c|m)js', '**/test-*.?(c|m)js', '**/test.?(c|m)js', '**/test/**/*.?(c|m)js']);
10
+ const patterns = ['**/*{.,-,_}test.?(c|m)js', '**/test-*.?(c|m)js', '**/test.?(c|m)js', '**/test/**/*.?(c|m)js'];
11
+ entries.push(...patterns.map(toEntry));
11
12
  }
12
- return entry.map(toEntry);
13
+ return entries;
13
14
  };
14
15
  const args = {
15
16
  positional: true,
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.46.1";
1
+ export declare const version = "5.46.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.46.1';
1
+ export const version = '5.46.2';
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.46.1",
3
+ "version": "5.46.2",
4
4
  "description": "Find and fix unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/webpro-nl/knip",
8
+ "url": "git+https://github.com/webpro-nl/knip.git",
9
9
  "directory": "packages/knip"
10
10
  },
11
11
  "bugs": "https://github.com/webpro-nl/knip/issues",
@@ -91,7 +91,7 @@
91
91
  "@wdio/types": "^9.5.0",
92
92
  "codeclimate-types": "^0.3.1",
93
93
  "glob": "^10.4.2",
94
- "release-it": "^19.0.0-next.1",
94
+ "release-it": "^19.0.0-next.2",
95
95
  "type-fest": "^4.31.0",
96
96
  "typescript": "^5.5.2"
97
97
  },