knip 5.27.0 → 5.27.1
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/dist/PrincipalFactory.js +3 -2
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/binaries/util.js +2 -2
- package/dist/plugins/eslint/helpers.js +8 -7
- package/dist/plugins/playwright/index.d.ts +1 -1
- package/dist/plugins/playwright/types.d.ts +36 -0
- package/dist/plugins/playwright/types.js +1 -0
- package/dist/plugins/playwright-ct/index.d.ts +2 -2
- package/dist/typescript/resolve-module-names.js +3 -2
- package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importCall.js +17 -21
- package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.js +8 -4
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/exports/index.d.ts +1 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/helpers.js +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/index.d.ts +1 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
- package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
- package/dist/typescript/visitors/scripts/index.d.ts +1 -1
- package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
- package/dist/util/handle-dependency.js +6 -8
- package/dist/util/loader.js +1 -1
- package/dist/util/modules.d.ts +0 -1
- package/dist/util/modules.js +0 -7
- package/dist/util/plugin.d.ts +1 -0
- package/dist/util/plugin.js +7 -6
- package/dist/util/require.d.ts +0 -3
- package/dist/util/require.js +3 -34
- package/dist/util/resolve.d.ts +2 -1
- package/dist/util/resolve.js +21 -12
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -5
- /package/dist/util/{register.d.ts → jiti.d.ts} +0 -0
- /package/dist/util/{register.js → jiti.js} +0 -0
package/dist/PrincipalFactory.js
CHANGED
|
@@ -7,8 +7,9 @@ const mapToAbsolutePaths = (paths, cwd) => Object.keys(paths).reduce((result, ke
|
|
|
7
7
|
return result;
|
|
8
8
|
}, {});
|
|
9
9
|
const mergePaths = (cwd, compilerOptions, paths = {}) => {
|
|
10
|
+
const basePath = typeof compilerOptions.pathsBasePath === 'string' ? compilerOptions.pathsBasePath : cwd;
|
|
10
11
|
const compilerPaths = !compilerOptions.baseUrl && compilerOptions.paths
|
|
11
|
-
? mapToAbsolutePaths(compilerOptions.paths,
|
|
12
|
+
? mapToAbsolutePaths(compilerOptions.paths, basePath)
|
|
12
13
|
: compilerOptions.paths;
|
|
13
14
|
const extraPaths = mapToAbsolutePaths(paths, cwd);
|
|
14
15
|
compilerOptions.paths = { ...compilerPaths, ...extraPaths };
|
|
@@ -19,7 +20,7 @@ export class PrincipalFactory {
|
|
|
19
20
|
getPrincipal(options) {
|
|
20
21
|
const { cwd, compilerOptions, isFile, paths, pkgName, isIsolateWorkspaces, compilers } = options;
|
|
21
22
|
options.compilerOptions = mergePaths(cwd, compilerOptions, paths);
|
|
22
|
-
if (isFile)
|
|
23
|
+
if (isFile && compilerOptions.module !== ts.ModuleKind.CommonJS)
|
|
23
24
|
compilerOptions.moduleResolution ??= ts.ModuleResolutionKind.Bundler;
|
|
24
25
|
const principal = this.findReusablePrincipal(compilerOptions);
|
|
25
26
|
if (!isIsolateWorkspaces && principal) {
|
|
@@ -34,7 +34,7 @@ export declare class WorkspaceWorker {
|
|
|
34
34
|
isStrict: boolean;
|
|
35
35
|
rootIgnore: Configuration['ignore'];
|
|
36
36
|
negatedWorkspacePatterns: string[];
|
|
37
|
-
enabledPluginsMap: Record<"
|
|
37
|
+
enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
|
|
38
38
|
enabledPlugins: PluginName[];
|
|
39
39
|
enabledPluginsInAncestors: string[];
|
|
40
40
|
cache: CacheConsultant<CacheItem>;
|
|
@@ -54,7 +54,7 @@ export declare class WorkspaceWorker {
|
|
|
54
54
|
entryFilePatterns: Set<string>;
|
|
55
55
|
productionEntryFilePatterns: Set<string>;
|
|
56
56
|
referencedDependencies: ReferencedDependencies;
|
|
57
|
-
enabledPlugins: ("
|
|
57
|
+
enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
|
|
58
58
|
}>;
|
|
59
59
|
onDispose(): void;
|
|
60
60
|
}
|
package/dist/binaries/util.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier } from '../util/modules.js';
|
|
2
2
|
import { isAbsolute, isInNodeModules, join } from '../util/path.js';
|
|
3
3
|
import { toBinary } from '../util/protocols.js';
|
|
4
|
-
import {
|
|
4
|
+
import { _resolveSync } from '../util/resolve.js';
|
|
5
5
|
export const tryResolveFilePath = (cwd, specifier, acceptModuleSpecifier) => {
|
|
6
6
|
if (specifier) {
|
|
7
7
|
const filePath = isAbsolute(specifier) ? specifier : join(cwd, specifier);
|
|
8
8
|
if (!isInNodeModules(filePath)) {
|
|
9
|
-
const resolvedFilePath =
|
|
9
|
+
const resolvedFilePath = _resolveSync(filePath, cwd);
|
|
10
10
|
if (resolvedFilePath) {
|
|
11
11
|
return resolvedFilePath;
|
|
12
12
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { compact } from '#p/util/array.js';
|
|
2
2
|
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier } from '#p/util/modules.js';
|
|
3
3
|
import { basename, dirname, isAbsolute, isInternal, toAbsolute } from '#p/util/path.js';
|
|
4
|
-
import { load } from '#p/util/plugin.js';
|
|
5
|
-
import { _resolve } from '#p/util/require.js';
|
|
4
|
+
import { load, resolve } from '#p/util/plugin.js';
|
|
6
5
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
7
6
|
const getDependencies = (config) => {
|
|
8
7
|
const extendsSpecifiers = config.extends ? [config.extends].flat().map(resolveExtendSpecifier) : [];
|
|
@@ -27,11 +26,13 @@ export const getDependenciesDeep = async (localConfig, options, dependencies = n
|
|
|
27
26
|
if (localConfig.extends) {
|
|
28
27
|
for (const extend of [localConfig.extends].flat()) {
|
|
29
28
|
if (isInternal(extend)) {
|
|
30
|
-
const filePath =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const filePath = resolve(toAbsolute(extend, configFileDir), configFileDir);
|
|
30
|
+
if (filePath) {
|
|
31
|
+
dependencies.add(filePath);
|
|
32
|
+
const localConfig = await load(filePath);
|
|
33
|
+
const opts = { ...options, configFileDir: dirname(filePath), configFileName: basename(filePath) };
|
|
34
|
+
addAll(await getDependenciesDeep(localConfig, opts, dependencies));
|
|
35
|
+
}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PlaywrightTestConfig } from 'playwright/test';
|
|
2
1
|
import type { IsPluginEnabled, ResolveConfig, ResolveEntryPaths } from '#p/types/plugins.js';
|
|
2
|
+
import type { PlaywrightTestConfig } from './types.js';
|
|
3
3
|
export declare const entry: string[];
|
|
4
4
|
export declare const resolveEntryPaths: ResolveEntryPaths<PlaywrightTestConfig>;
|
|
5
5
|
export declare const resolveConfig: ResolveConfig<PlaywrightTestConfig>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type LiteralUnion<T extends U, U = string> = T | (U & {
|
|
2
|
+
zz_IGNORE_ME?: never;
|
|
3
|
+
});
|
|
4
|
+
type ReporterDescription = Readonly<['blob'] | ['blob', {
|
|
5
|
+
outputDir?: string;
|
|
6
|
+
fileName?: string;
|
|
7
|
+
}] | ['dot'] | ['line'] | ['list'] | ['list', {
|
|
8
|
+
printSteps?: boolean;
|
|
9
|
+
}] | ['github'] | ['junit'] | ['junit', {
|
|
10
|
+
outputFile?: string;
|
|
11
|
+
stripANSIControlSequences?: boolean;
|
|
12
|
+
includeProjectInTestName?: boolean;
|
|
13
|
+
}] | ['json'] | ['json', {
|
|
14
|
+
outputFile?: string;
|
|
15
|
+
}] | ['html'] | [
|
|
16
|
+
'html',
|
|
17
|
+
{
|
|
18
|
+
outputFolder?: string;
|
|
19
|
+
open?: 'always' | 'never' | 'on-failure';
|
|
20
|
+
host?: string;
|
|
21
|
+
port?: number;
|
|
22
|
+
attachmentsBaseURL?: string;
|
|
23
|
+
}
|
|
24
|
+
] | ['null'] | [string] | [string, any]>;
|
|
25
|
+
type Project = {
|
|
26
|
+
name: string;
|
|
27
|
+
use: string;
|
|
28
|
+
testMatch?: string | RegExp | (string | RegExp)[];
|
|
29
|
+
};
|
|
30
|
+
export type PlaywrightTestConfig = {
|
|
31
|
+
projects?: Project[];
|
|
32
|
+
testMatch?: string | RegExp | (string | RegExp)[];
|
|
33
|
+
testDir?: string;
|
|
34
|
+
reporter?: LiteralUnion<'dot' | 'line' | 'list' | 'junit' | 'html' | 'json' | 'github' | 'null', string> | ReporterDescription[];
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
isEnabled: IsPluginEnabled;
|
|
6
6
|
config: string[];
|
|
7
7
|
entry: string[];
|
|
8
|
-
resolveEntryPaths: import("#p/types/plugins.js").ResolveEntryPaths<import("playwright/
|
|
9
|
-
resolveConfig: import("#p/types/plugins.js").ResolveConfig<import("playwright/
|
|
8
|
+
resolveEntryPaths: import("#p/types/plugins.js").ResolveEntryPaths<import("../playwright/types.js").PlaywrightTestConfig>;
|
|
9
|
+
resolveConfig: import("#p/types/plugins.js").ResolveConfig<import("../playwright/types.js").PlaywrightTestConfig>;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
|
@@ -5,7 +5,7 @@ import { DEFAULT_EXTENSIONS } from '../constants.js';
|
|
|
5
5
|
import { timerify } from '../util/Performance.js';
|
|
6
6
|
import { sanitizeSpecifier } from '../util/modules.js';
|
|
7
7
|
import { dirname, extname, isAbsolute, isInNodeModules, join } from '../util/path.js';
|
|
8
|
-
import {
|
|
8
|
+
import { _resolveSync, createSyncResolver } from '../util/resolve.js';
|
|
9
9
|
import { isDeclarationFileExtension } from './ast-helpers.js';
|
|
10
10
|
const resolutionCache = new Map();
|
|
11
11
|
const fileExists = (name, containingFile) => {
|
|
@@ -22,6 +22,7 @@ const fileExists = (name, containingFile) => {
|
|
|
22
22
|
export function createCustomModuleResolver(compilerOptions, customCompilerExtensions, toSourceFilePath, useCache = true) {
|
|
23
23
|
const customCompilerExtensionsSet = new Set(customCompilerExtensions);
|
|
24
24
|
const extensions = [...DEFAULT_EXTENSIONS, ...customCompilerExtensions];
|
|
25
|
+
const resolveSync = customCompilerExtensionsSet.size === 0 ? _resolveSync : createSyncResolver(extensions);
|
|
25
26
|
const virtualDeclarationFiles = new Map();
|
|
26
27
|
const tsSys = {
|
|
27
28
|
...ts.sys,
|
|
@@ -56,7 +57,7 @@ export function createCustomModuleResolver(compilerOptions, customCompilerExtens
|
|
|
56
57
|
const sanitizedSpecifier = sanitizeSpecifier(name);
|
|
57
58
|
if (isBuiltin(sanitizedSpecifier) || isInNodeModules(name))
|
|
58
59
|
return undefined;
|
|
59
|
-
const resolvedFileName = resolveSync(sanitizedSpecifier, containingFile
|
|
60
|
+
const resolvedFileName = resolveSync(sanitizedSpecifier, dirname(containingFile));
|
|
60
61
|
if (resolvedFileName) {
|
|
61
62
|
const ext = extname(resolvedFileName);
|
|
62
63
|
if (!customCompilerExtensionsSet.has(ext)) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -2,6 +2,7 @@ import ts from 'typescript';
|
|
|
2
2
|
import { ANONYMOUS } from '../../../constants.js';
|
|
3
3
|
import { findAncestor, findDescendants, isAccessExpression, isImportCall, isTopLevel, stripQuotes, } from '../../ast-helpers.js';
|
|
4
4
|
import { importVisitor as visit } from '../index.js';
|
|
5
|
+
const getSymbol = (node, isTopLevel) => (isTopLevel ? node.symbol : undefined);
|
|
5
6
|
export default visit(() => true, node => {
|
|
6
7
|
if (isImportCall(node)) {
|
|
7
8
|
if (node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) {
|
|
@@ -34,12 +35,7 @@ export default visit(() => true, node => {
|
|
|
34
35
|
return arg.name.elements.map(element => {
|
|
35
36
|
const identifier = (element.propertyName ?? element.name).getText();
|
|
36
37
|
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
37
|
-
return {
|
|
38
|
-
identifier,
|
|
39
|
-
alias,
|
|
40
|
-
specifier,
|
|
41
|
-
pos: element.pos,
|
|
42
|
-
};
|
|
38
|
+
return { identifier, alias, specifier, pos: element.pos };
|
|
43
39
|
});
|
|
44
40
|
}
|
|
45
41
|
}
|
|
@@ -51,9 +47,9 @@ export default visit(() => true, node => {
|
|
|
51
47
|
return ts.isVariableDeclaration(_node);
|
|
52
48
|
});
|
|
53
49
|
if (variableDeclaration) {
|
|
54
|
-
const isTLA = isTopLevel(variableDeclaration.parent);
|
|
55
50
|
const alias = String(variableDeclaration.name.escapedText);
|
|
56
|
-
|
|
51
|
+
const symbol = getSymbol(variableDeclaration, isTopLevel(variableDeclaration.parent));
|
|
52
|
+
return { identifier, alias, symbol, specifier, pos };
|
|
57
53
|
}
|
|
58
54
|
return { identifier, specifier, pos };
|
|
59
55
|
}
|
|
@@ -71,20 +67,17 @@ export default visit(() => true, node => {
|
|
|
71
67
|
ts.isVariableDeclarationList(variableDeclaration.parent)) {
|
|
72
68
|
const isTLA = isTopLevel(variableDeclaration.parent);
|
|
73
69
|
if (ts.isIdentifier(variableDeclaration.name)) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
symbol: isTLA ? variableDeclaration.symbol : undefined,
|
|
78
|
-
specifier,
|
|
79
|
-
pos: node.arguments[0].pos,
|
|
80
|
-
};
|
|
70
|
+
const alias = String(variableDeclaration.name.escapedText);
|
|
71
|
+
const symbol = getSymbol(variableDeclaration, isTLA);
|
|
72
|
+
return { identifier: 'default', alias, symbol, specifier, pos: node.arguments[0].pos };
|
|
81
73
|
}
|
|
82
74
|
const bindings = findDescendants(variableDeclaration, ts.isBindingElement);
|
|
83
75
|
if (bindings.length > 0) {
|
|
84
76
|
return bindings.map(element => {
|
|
85
77
|
const identifier = (element.propertyName ?? element.name).getText();
|
|
86
78
|
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
87
|
-
|
|
79
|
+
const symbol = getSymbol(element, isTLA);
|
|
80
|
+
return { identifier, alias, symbol, specifier, pos: element.pos };
|
|
88
81
|
});
|
|
89
82
|
}
|
|
90
83
|
return { identifier: ANONYMOUS, specifier, pos: node.arguments[0].pos };
|
|
@@ -99,18 +92,21 @@ export default visit(() => true, node => {
|
|
|
99
92
|
const index = arrayLiteralExpression.elements.indexOf(node);
|
|
100
93
|
const element = variableDeclarationParent.name.elements[index];
|
|
101
94
|
if (element) {
|
|
102
|
-
const
|
|
95
|
+
const isTL = isTopLevel(variableDeclarationParent.parent);
|
|
103
96
|
if (ts.isBindingElement(element) && ts.isObjectBindingPattern(element.name) && element.name.elements) {
|
|
104
97
|
return element.name.elements.map(element => {
|
|
105
98
|
const identifier = (element.propertyName ?? element.name).getText();
|
|
106
99
|
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
107
|
-
const symbol =
|
|
100
|
+
const symbol = getSymbol(element, isTL);
|
|
108
101
|
return { identifier, alias, symbol, specifier, pos: element.pos };
|
|
109
102
|
});
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
if (!ts.isOmittedExpression(element) && ts.isIdentifier(element.name)) {
|
|
105
|
+
const alias = String(element.name.escapedText);
|
|
106
|
+
const symbol = getSymbol(element, isTL);
|
|
107
|
+
return { identifier: 'default', symbol, alias, specifier, pos: element.pos };
|
|
108
|
+
}
|
|
109
|
+
return { identifier: 'default', specifier, pos: element.pos };
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
112
|
return { identifier: 'default', specifier, pos: node.arguments[0].pos };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import type { ImportNode } from '../../../types/imports.js';
|
|
3
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
3
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => ImportNode | ImportNode[] | undefined;
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { findAncestor, findDescendants, isRequireCall, isTopLevel } from '../../ast-helpers.js';
|
|
3
|
+
import { isNotJS } from '../helpers.js';
|
|
3
4
|
import { importVisitor as visit } from '../index.js';
|
|
4
5
|
export default visit(() => true, node => {
|
|
5
6
|
if (isRequireCall(node)) {
|
|
@@ -11,9 +12,10 @@ export default visit(() => true, node => {
|
|
|
11
12
|
return 'STOP';
|
|
12
13
|
return ts.isPropertyAccessExpression(_node);
|
|
13
14
|
});
|
|
15
|
+
const resolve = isNotJS(node.getSourceFile());
|
|
14
16
|
if (propertyAccessExpression) {
|
|
15
17
|
const identifier = String(propertyAccessExpression.name.escapedText);
|
|
16
|
-
return { identifier, specifier, pos: propertyAccessExpression.name.pos };
|
|
18
|
+
return { identifier, specifier, pos: propertyAccessExpression.name.pos, resolve };
|
|
17
19
|
}
|
|
18
20
|
const variableDeclaration = node.parent;
|
|
19
21
|
if (ts.isVariableDeclaration(variableDeclaration) &&
|
|
@@ -27,6 +29,7 @@ export default visit(() => true, node => {
|
|
|
27
29
|
symbol: isTLA ? variableDeclaration.symbol : undefined,
|
|
28
30
|
specifier,
|
|
29
31
|
pos: node.arguments[0].pos,
|
|
32
|
+
resolve,
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
const bindings = findDescendants(variableDeclaration, ts.isBindingElement);
|
|
@@ -34,12 +37,13 @@ export default visit(() => true, node => {
|
|
|
34
37
|
return bindings.map(element => {
|
|
35
38
|
const identifier = (element.propertyName ?? element.name).getText();
|
|
36
39
|
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
37
|
-
|
|
40
|
+
const symbol = isTLA ? element.symbol : undefined;
|
|
41
|
+
return { identifier, specifier, alias, symbol, pos: element.pos, resolve };
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
|
-
return { identifier: 'default', specifier, pos: node.arguments[0].pos };
|
|
44
|
+
return { identifier: 'default', specifier, pos: node.arguments[0].pos, resolve };
|
|
41
45
|
}
|
|
42
|
-
return { identifier: 'default', specifier, pos: node.arguments[0].pos };
|
|
46
|
+
return { identifier: 'default', specifier, pos: node.arguments[0].pos, resolve };
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
export const isNotJS = (sourceFile) => sourceFile
|
|
2
|
+
export const isNotJS = (sourceFile) => !isJS(sourceFile);
|
|
3
3
|
export const isJS = (sourceFile) => sourceFile.scriptKind === ts.ScriptKind.JS || sourceFile.scriptKind === ts.ScriptKind.JSX;
|
|
4
4
|
export function getImportsFromPragmas(sourceFile) {
|
|
5
5
|
const importNodes = [];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => string | string[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) =>
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../get-imports-and-exports.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier
|
|
2
|
-
import { isInNodeModules, isInternal } from './path.js';
|
|
1
|
+
import { getPackageNameFromFilePath, getPackageNameFromModuleSpecifier } from './modules.js';
|
|
2
|
+
import { dirname, isInNodeModules, isInternal } from './path.js';
|
|
3
3
|
import { fromBinary, isBinary } from './protocols.js';
|
|
4
|
-
import {
|
|
5
|
-
import { resolveSync } from './resolve.js';
|
|
4
|
+
import { _resolveSync } from './resolve.js';
|
|
6
5
|
export const getReferencedDependencyHandler = (collector, deputy, chief) => (specifier, containingFilePath, workspace) => {
|
|
7
6
|
if (isBinary(specifier)) {
|
|
8
7
|
const binaryName = fromBinary(specifier);
|
|
@@ -17,7 +16,7 @@ export const getReferencedDependencyHandler = (collector, deputy, chief) => (spe
|
|
|
17
16
|
}
|
|
18
17
|
else {
|
|
19
18
|
if (isInternal(specifier)) {
|
|
20
|
-
const resolvedFilePath =
|
|
19
|
+
const resolvedFilePath = _resolveSync(specifier, dirname(containingFilePath));
|
|
21
20
|
if (resolvedFilePath)
|
|
22
21
|
return resolvedFilePath;
|
|
23
22
|
collector.addIssue({
|
|
@@ -40,9 +39,8 @@ export const getReferencedDependencyHandler = (collector, deputy, chief) => (spe
|
|
|
40
39
|
symbol: specifier,
|
|
41
40
|
});
|
|
42
41
|
if (packageName && specifier !== packageName) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const filePath = _resolveSpecifier(otherWorkspace.dir, normalizeSpecifierFromFilePath(specifier));
|
|
42
|
+
if (chief.workspacePackagesByName.get(packageName)) {
|
|
43
|
+
const filePath = _resolveSync(specifier, dirname(containingFilePath));
|
|
46
44
|
if (filePath)
|
|
47
45
|
return filePath;
|
|
48
46
|
collector.addIssue({
|
package/dist/util/loader.js
CHANGED
|
@@ -3,8 +3,8 @@ import { timerify } from './Performance.js';
|
|
|
3
3
|
import { LoaderError } from './errors.js';
|
|
4
4
|
import { loadFile, loadJSON, loadTOML, loadYAML, parseJSON, parseYAML } from './fs.js';
|
|
5
5
|
import { isTypeModule } from './fs.js';
|
|
6
|
+
import { jitiCJS, jitiESM } from './jiti.js';
|
|
6
7
|
import { extname, isInternal } from './path.js';
|
|
7
|
-
import { jitiCJS, jitiESM } from './register.js';
|
|
8
8
|
const load = async (filePath) => {
|
|
9
9
|
try {
|
|
10
10
|
const ext = extname(filePath);
|
package/dist/util/modules.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { PackageJson } from '../types/package-json.js';
|
|
2
2
|
export declare const getPackageNameFromModuleSpecifier: (moduleSpecifier: string) => string | undefined;
|
|
3
3
|
export declare const getPackageNameFromFilePath: (value: string) => string;
|
|
4
|
-
export declare const normalizeSpecifierFromFilePath: (value: string) => string;
|
|
5
4
|
export declare const isStartsLikePackageName: (specifier: string) => boolean;
|
|
6
5
|
export declare const isDefinitelyTyped: (packageName: string) => boolean;
|
|
7
6
|
export declare const getDefinitelyTypedFor: (packageName: string) => string;
|
package/dist/util/modules.js
CHANGED
|
@@ -16,13 +16,6 @@ export const getPackageNameFromFilePath = (value) => {
|
|
|
16
16
|
return match[match.length - 1];
|
|
17
17
|
return value;
|
|
18
18
|
};
|
|
19
|
-
const packageNameMatch = /.*\/node_modules\/(.+)/;
|
|
20
|
-
export const normalizeSpecifierFromFilePath = (value) => {
|
|
21
|
-
const match = toPosix(value).match(packageNameMatch);
|
|
22
|
-
if (match)
|
|
23
|
-
return match[match.length - 1];
|
|
24
|
-
return value;
|
|
25
|
-
};
|
|
26
19
|
export const isStartsLikePackageName = (specifier) => /^@?[a-z0-9]/.test(specifier);
|
|
27
20
|
export const isDefinitelyTyped = (packageName) => packageName.startsWith(`${DT_SCOPE}/`);
|
|
28
21
|
export const getDefinitelyTypedFor = (packageName) => {
|
package/dist/util/plugin.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
|
|
2
2
|
export { _loadJSON as loadJSON } from './fs.js';
|
|
3
3
|
export { _load as load } from './loader.js';
|
|
4
|
+
export { _resolveSync as resolve } from './resolve.js';
|
|
4
5
|
import type { RawPluginConfiguration } from '../types/config.js';
|
|
5
6
|
import type { Plugin, PluginOptions } from '../types/plugins.js';
|
|
6
7
|
export declare const toCamelCase: (name: string) => string;
|
package/dist/util/plugin.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
|
|
2
2
|
export { _loadJSON as loadJSON } from './fs.js';
|
|
3
3
|
export { _load as load } from './loader.js';
|
|
4
|
+
export { _resolveSync as resolve } from './resolve.js';
|
|
4
5
|
import { arrayify } from './array.js';
|
|
5
6
|
import { _load as load } from './loader.js';
|
|
6
7
|
import { get } from './object.js';
|
|
7
8
|
import { basename, isAbsolute, join, relative } from './path.js';
|
|
8
9
|
import { toEntryPattern, toProductionEntryPattern } from './protocols.js';
|
|
9
|
-
import {
|
|
10
|
+
import { _resolveSync } from './resolve.js';
|
|
10
11
|
export const toCamelCase = (name) => name.toLowerCase().replace(/(-[a-z])/g, group => group.toUpperCase().replace('-', ''));
|
|
11
12
|
export const hasDependency = (dependencies, values) => values.some(value => {
|
|
12
13
|
if (typeof value === 'string') {
|
|
@@ -77,9 +78,9 @@ const toConfigMap = (defaultExtensions, builderConfig) => (moduleName, options)
|
|
|
77
78
|
];
|
|
78
79
|
const rcFiles = `${rcPrefix}${moduleName}${rcSuffix}.{${extensions.join(',')}}`;
|
|
79
80
|
const configExtensions = extensions.filter(ext => config.configFilesAllExtensions || jsTypeExtensions.includes(ext));
|
|
80
|
-
const configFiles =
|
|
81
|
-
const configDirFiles =
|
|
82
|
-
return [...baseFiles, rcFiles, configFiles, configDirFiles]
|
|
81
|
+
const configFiles = config.configFiles ? [`${moduleName}.config.{${configExtensions.join(',')}}`] : [];
|
|
82
|
+
const configDirFiles = config.configDir ? [`.config/${moduleName}${rcSuffix}.{${extensions.join(',')}}`] : [];
|
|
83
|
+
return [...baseFiles, rcFiles, ...configFiles, ...configDirFiles];
|
|
83
84
|
};
|
|
84
85
|
export const toCosmiconfig = toConfigMap(['json', 'yaml', 'yml', 'js', 'ts', 'cjs', 'mjs'], { configDir: true });
|
|
85
86
|
export const toLilconfig = toConfigMap(['json', 'js', 'cjs', 'mjs'], { configDir: true });
|
|
@@ -90,10 +91,10 @@ export const toUnconfig = toConfigMap(['json', 'ts', 'mts', 'cts', 'js', 'mjs',
|
|
|
90
91
|
configFiles: false,
|
|
91
92
|
});
|
|
92
93
|
export const resolveEntry = (options, specifier, rootDir = '.') => {
|
|
93
|
-
const { configFileDir
|
|
94
|
+
const { configFileDir } = options;
|
|
94
95
|
const resolvedPath = isAbsolute(specifier)
|
|
95
96
|
? specifier
|
|
96
|
-
:
|
|
97
|
+
: _resolveSync(join(configFileDir, rootDir, specifier), join(configFileDir, rootDir));
|
|
97
98
|
if (resolvedPath)
|
|
98
99
|
return toEntryPattern(relative(configFileDir, resolvedPath));
|
|
99
100
|
return specifier;
|
package/dist/util/require.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
1
|
export declare const _require: NodeRequire;
|
|
2
|
-
export declare const _resolve: (specifier: string) => string;
|
|
3
|
-
export declare const _tryResolve: (specifier: string, from: string) => string | undefined;
|
|
4
|
-
export declare const _resolveSpecifier: (dir: string, specifier: string) => string | undefined;
|
package/dist/util/require.js
CHANGED
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
import { createRequire
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
3
|
-
import createJITI from 'jiti';
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
4
2
|
import { timerify } from './Performance.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { cwd, join, toPosix } from './path.js';
|
|
8
|
-
import { jitiCJS } from './register.js';
|
|
9
|
-
const createRequire = (path) => nodeCreateRequire(pathToFileURL(path ?? cwd));
|
|
10
|
-
const require = createRequire();
|
|
3
|
+
import { cwd } from './path.js';
|
|
4
|
+
const require = createRequire(cwd);
|
|
11
5
|
export const _require = timerify(require);
|
|
12
|
-
const resolve = (specifier) => toPosix(jitiCJS.resolve(specifier));
|
|
13
|
-
const tryResolve = (specifier, from) => {
|
|
14
|
-
try {
|
|
15
|
-
return resolve(specifier);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
debugLog('*', `Unable to resolve ${specifier} (from ${from})`);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const resolveSpecifier = (dir, specifier) => {
|
|
22
|
-
try {
|
|
23
|
-
const jiti = createJITI(dir);
|
|
24
|
-
return toPosix(jiti.resolve(specifier));
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
const packageName = getPackageNameFromModuleSpecifier(specifier);
|
|
28
|
-
if (packageName) {
|
|
29
|
-
const relativeSpecifier = specifier.replace(packageName, '.');
|
|
30
|
-
return tryResolve(join(dir, relativeSpecifier), dir);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
export const _resolve = timerify(resolve);
|
|
35
|
-
export const _tryResolve = timerify(tryResolve);
|
|
36
|
-
export const _resolveSpecifier = timerify(resolveSpecifier);
|
package/dist/util/resolve.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const createSyncResolver: (extensions: string[]) => (specifier: string, baseDir: string) => string | undefined;
|
|
2
|
+
export declare const _resolveSync: (specifier: string, baseDir: string) => string | undefined;
|
package/dist/util/resolve.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import ER from 'enhanced-resolve';
|
|
2
3
|
import { DEFAULT_EXTENSIONS } from '../constants.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { timerify } from './Performance.js';
|
|
5
|
+
import { toPosix } from './path.js';
|
|
6
|
+
const fileSystem = new ER.CachedInputFileSystem(fs, 9999999);
|
|
7
|
+
export const createSyncResolver = (extensions) => {
|
|
8
|
+
const resolver = ER.create.sync({
|
|
9
|
+
fileSystem,
|
|
10
|
+
extensions,
|
|
11
|
+
conditionNames: ['require', 'import', 'node', 'default'],
|
|
12
|
+
});
|
|
13
|
+
return function resolveSync(specifier, baseDir) {
|
|
14
|
+
try {
|
|
15
|
+
const resolved = resolver({}, baseDir, specifier);
|
|
16
|
+
if (resolved)
|
|
17
|
+
return toPosix(resolved);
|
|
18
|
+
}
|
|
19
|
+
catch (_error) { }
|
|
20
|
+
};
|
|
14
21
|
};
|
|
22
|
+
const resolveSync = createSyncResolver([...DEFAULT_EXTENSIONS, '.json']);
|
|
23
|
+
export const _resolveSync = timerify(resolveSync);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.27.
|
|
1
|
+
export declare const version = "5.27.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.27.
|
|
1
|
+
export const version = '5.27.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.27.
|
|
3
|
+
"version": "5.27.1",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"lint": "biome lint ../..",
|
|
46
46
|
"format": "biome format --write .",
|
|
47
47
|
"test": "bun test test/*.test.ts test/**/*.test.ts",
|
|
48
|
-
"test:node": "glob -c \"npx -y tsx
|
|
48
|
+
"test:node": "glob -c \"npx -y tsx --test --import ./transform-test.js\" \"test/**/*.test.ts\"",
|
|
49
49
|
"watch": "npm link && tsc --watch",
|
|
50
50
|
"prebuild": "node rmdir.js dist",
|
|
51
51
|
"build": "tsc",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@nodelib/fs.walk": "1.2.8",
|
|
65
65
|
"@snyk/github-codeowners": "1.1.0",
|
|
66
66
|
"easy-table": "1.2.0",
|
|
67
|
+
"enhanced-resolve": "^5.17.1",
|
|
67
68
|
"fast-glob": "^3.3.2",
|
|
68
69
|
"jiti": "^1.21.6",
|
|
69
70
|
"js-yaml": "^4.1.0",
|
|
@@ -71,7 +72,6 @@
|
|
|
71
72
|
"picocolors": "^1.0.0",
|
|
72
73
|
"picomatch": "^4.0.1",
|
|
73
74
|
"pretty-ms": "^9.0.0",
|
|
74
|
-
"resolve": "^1.22.8",
|
|
75
75
|
"smol-toml": "^1.1.4",
|
|
76
76
|
"strip-json-comments": "5.0.1",
|
|
77
77
|
"summary": "2.1.0",
|
|
@@ -89,11 +89,9 @@
|
|
|
89
89
|
"@types/js-yaml": "^4.0.9",
|
|
90
90
|
"@types/minimist": "^1.2.5",
|
|
91
91
|
"@types/picomatch": "2.3.4",
|
|
92
|
-
"@types/resolve": "^1.20.6",
|
|
93
92
|
"@types/webpack": "^5.28.5",
|
|
94
93
|
"@wdio/types": "^8.39.0",
|
|
95
94
|
"glob": "^10.4.2",
|
|
96
|
-
"playwright": "^1.44.1",
|
|
97
95
|
"release-it": "^17.4.1",
|
|
98
96
|
"type-fest": "^4.20.0",
|
|
99
97
|
"typescript": "^5.5.2"
|
|
File without changes
|
|
File without changes
|