knip 2.41.4 → 2.41.5
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
+
import { isBuiltin } from 'node:module';
|
|
2
3
|
import ts from 'typescript';
|
|
3
4
|
import { sanitizeSpecifier } from '../util/modules.js';
|
|
4
5
|
import { dirname, extname, isAbsolute, isInternal, join } from '../util/path.js';
|
|
@@ -21,6 +22,8 @@ export function createCustomModuleResolver(customSys, compilerOptions, virtualFi
|
|
|
21
22
|
}
|
|
22
23
|
function resolveModuleName(name, containingFile) {
|
|
23
24
|
const sanitizedSpecifier = sanitizeSpecifier(name);
|
|
25
|
+
if (isBuiltin(sanitizedSpecifier))
|
|
26
|
+
return undefined;
|
|
24
27
|
const tsResolvedModule = ts.resolveModuleName(sanitizedSpecifier, containingFile, compilerOptions, ts.sys).resolvedModule;
|
|
25
28
|
if (!tsResolvedModule) {
|
|
26
29
|
const extension = extname(sanitizedSpecifier);
|
package/dist/util/modules.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { isBuiltin } from 'module';
|
|
1
2
|
import { _glob } from './glob.js';
|
|
2
3
|
import { getStringValues } from './object.js';
|
|
3
|
-
import { toPosix } from './path.js';
|
|
4
|
+
import { isAbsolute, toPosix } from './path.js';
|
|
4
5
|
export const getPackageNameFromModuleSpecifier = (moduleSpecifier) => {
|
|
5
6
|
if (!isMaybePackageName(moduleSpecifier))
|
|
6
7
|
return;
|
|
@@ -52,7 +53,9 @@ export const getEntryPathFromManifest = (manifest, sharedGlobOptions) => {
|
|
|
52
53
|
return _glob({ ...sharedGlobOptions, patterns: Array.from(entryPaths) });
|
|
53
54
|
};
|
|
54
55
|
export const sanitizeSpecifier = (specifier) => {
|
|
55
|
-
if (specifier
|
|
56
|
+
if (isBuiltin(specifier))
|
|
57
|
+
return specifier;
|
|
58
|
+
if (isAbsolute(specifier))
|
|
56
59
|
return specifier;
|
|
57
60
|
return specifier.replace(/^([?!|-]+)?([^!?:]+).*/, '$2');
|
|
58
61
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.41.
|
|
1
|
+
export declare const version = "2.41.5";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.41.
|
|
1
|
+
export const version = '2.41.5';
|
package/package.json
CHANGED