knip 2.14.0 → 2.14.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.
@@ -3,6 +3,7 @@ import { DEFAULT_EXTENSIONS } from './constants.js';
3
3
  import { IGNORED_FILE_EXTENSIONS } from './constants.js';
4
4
  import { createHosts } from './typescript/createHosts.js';
5
5
  import { getImportsAndExports } from './typescript/getImportsAndExports.js';
6
+ import { isMaybePackageName } from './util/modules.js';
6
7
  import { extname, isInNodeModules } from './util/path.js';
7
8
  import { timerify } from './util/Performance.js';
8
9
  const baseCompilerOptions = {
@@ -122,7 +123,7 @@ export class ProjectPrincipal {
122
123
  }
123
124
  }
124
125
  else {
125
- if (/^(@|[a-z])/.test(specifier)) {
126
+ if (isMaybePackageName(specifier)) {
126
127
  external.add(specifier);
127
128
  }
128
129
  else {
@@ -33,6 +33,9 @@ const findJestDependencies = async (configFilePath, { cwd, manifest }) => {
33
33
  const transform = config.transform
34
34
  ? Object.values(config.transform).map(transform => (typeof transform === 'string' ? transform : transform[0]))
35
35
  : [];
36
+ const moduleNameMapper = config.moduleNameMapper
37
+ ? Object.values(config.moduleNameMapper).map(mapper => (typeof mapper === 'string' ? mapper : mapper[0]))
38
+ : [];
36
39
  return [
37
40
  ...presets,
38
41
  ...environments,
@@ -41,6 +44,7 @@ const findJestDependencies = async (configFilePath, { cwd, manifest }) => {
41
44
  ...setupFiles,
42
45
  ...setupFilesAfterEnv,
43
46
  ...transform,
47
+ ...moduleNameMapper,
44
48
  ].map(replaceRootDir);
45
49
  };
46
50
  export const findDependencies = timerify(findJestDependencies);
@@ -2,4 +2,4 @@ import { hasDependency } from '../../util/plugin.js';
2
2
  export const NAME = 'Sentry';
3
3
  export const ENABLERS = [/^@sentry\//];
4
4
  export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
5
- export const ENTRY_FILE_PATTERNS = ['sentry.{client,server}.config.{js,ts}'];
5
+ export const ENTRY_FILE_PATTERNS = ['sentry.{client,server,edge}.config.{js,ts}'];
@@ -8,8 +8,11 @@ export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABL
8
8
  export const CONFIG_FILE_PATTERNS = ['tsconfig.json'];
9
9
  const findTypeScriptDependencies = async (configFilePath) => {
10
10
  const config = await load(configFilePath);
11
- const extend = config?.extends ? [config.extends].flat().filter(extend => !isInternal(extend)) : [];
12
- const plugins = compact(config?.compilerOptions?.plugins?.map(plugin => plugin.name) ?? []);
13
- return [...extend, ...plugins];
11
+ if (!config)
12
+ return [];
13
+ const extend = config.extends ? [config.extends].flat().filter(extend => !isInternal(extend)) : [];
14
+ const plugins = compact(config.compilerOptions?.plugins?.map(plugin => plugin.name) ?? []);
15
+ const importHelpers = config.compilerOptions?.importHelpers ? ['tslib'] : [];
16
+ return [...extend, ...plugins, ...importHelpers];
14
17
  };
15
18
  export const findDependencies = timerify(findTypeScriptDependencies);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.14.0";
1
+ export declare const version = "2.14.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.14.0';
1
+ export const version = '2.14.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.14.0",
3
+ "version": "2.14.2",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://github.com/webpro/knip",
6
6
  "repository": "github:webpro/knip",