knip 6.0.2 → 6.0.3
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/graph/build.js +4 -2
- package/dist/plugins/qwik/resolveFromAST.js +3 -3
- package/dist/util/fs.d.ts +1 -0
- package/dist/util/fs.js +10 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/graph/build.js
CHANGED
|
@@ -5,6 +5,7 @@ import { partition } from "../util/array.js";
|
|
|
5
5
|
import { createInputHandler } from "../util/create-input-handler.js";
|
|
6
6
|
import { debugLog, debugLogArray } from "../util/debug.js";
|
|
7
7
|
import { existsSync } from 'node:fs';
|
|
8
|
+
import { tryRealpath } from "../util/fs.js";
|
|
8
9
|
import { _glob, _syncGlob, negate, prependDirToPattern as prependDir } from "../util/glob.js";
|
|
9
10
|
import { isAlias, isConfig, isDeferResolveEntry, isDeferResolveProductionEntry, isEntry, isIgnore, isProductionEntry, isProject, toProductionEntry, } from "../util/input.js";
|
|
10
11
|
import { loadTSConfig } from "../util/load-tsconfig.js";
|
|
@@ -92,7 +93,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
92
93
|
if (definitionPaths.length > 0) {
|
|
93
94
|
debugLogArray(name, 'Definition paths', definitionPaths);
|
|
94
95
|
for (const id of definitionPaths)
|
|
95
|
-
inputs.add(toProductionEntry(id, { containingFilePath: tsConfigFilePath }));
|
|
96
|
+
inputs.add(toProductionEntry(tryRealpath(id), { containingFilePath: tsConfigFilePath }));
|
|
96
97
|
}
|
|
97
98
|
const sharedGlobOptions = { cwd: options.cwd, dir, gitignore: options.gitignore };
|
|
98
99
|
const fn = (id) => ({ pattern: prependDir(options.cwd, prependDir(name, id)), id, workspaceName: name });
|
|
@@ -234,7 +235,8 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
234
235
|
if (options.isUseTscFiles && isFile) {
|
|
235
236
|
const isIgnoredWorkspace = chief.createIgnoredWorkspaceMatcher(name, dir);
|
|
236
237
|
debugLogArray(name, 'Using tsconfig files as project files', tscSourcePaths);
|
|
237
|
-
for (const
|
|
238
|
+
for (const tscPath of tscSourcePaths) {
|
|
239
|
+
const filePath = tryRealpath(tscPath);
|
|
238
240
|
if (!isGitIgnored(filePath) && !isIgnoredWorkspace(filePath)) {
|
|
239
241
|
principal.addProgramPath(filePath);
|
|
240
242
|
principal.addProjectPath(filePath);
|
|
@@ -11,9 +11,9 @@ export const getSrcDir = (program) => {
|
|
|
11
11
|
export const getRoutesDirs = (program, srcDir) => {
|
|
12
12
|
const arg = findCallArg(program, 'qwikCity');
|
|
13
13
|
if (arg) {
|
|
14
|
-
const values = getPropertyValues(arg, 'routesDir');
|
|
15
|
-
if (values.
|
|
16
|
-
return
|
|
14
|
+
const values = Array.from(getPropertyValues(arg, 'routesDir')).filter(Boolean);
|
|
15
|
+
if (values.length > 0)
|
|
16
|
+
return values;
|
|
17
17
|
}
|
|
18
18
|
return [`${srcDir}/routes`];
|
|
19
19
|
};
|
package/dist/util/fs.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export declare const loadYAML: (filePath: string) => Promise<any>;
|
|
|
10
10
|
export declare const loadTOML: (filePath: string) => Promise<import("smol-toml").TomlTable>;
|
|
11
11
|
export declare const parseJSONC: (filePath: string, contents: string) => Promise<any>;
|
|
12
12
|
export declare const parseYAML: (contents: string) => any;
|
|
13
|
+
export declare const tryRealpath: (filePath: string) => string;
|
package/dist/util/fs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readdirSync, realpathSync, statSync } from 'node:fs';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { parse as parseYAMLContents } from 'yaml';
|
|
4
4
|
import { parse as parseTOML } from 'smol-toml';
|
|
5
5
|
import stripJsonComments from 'strip-json-comments';
|
|
6
6
|
import { LoaderError } from "./errors.js";
|
|
7
|
-
import { extname, join } from "./path.js";
|
|
7
|
+
import { extname, join, toPosix } from "./path.js";
|
|
8
8
|
export const isDirectory = (cwdOrPath, name) => {
|
|
9
9
|
try {
|
|
10
10
|
return statSync(name ? join(cwdOrPath, name) : cwdOrPath).isDirectory();
|
|
@@ -86,3 +86,11 @@ export const parseJSONC = async (filePath, contents) => {
|
|
|
86
86
|
export const parseYAML = (contents) => {
|
|
87
87
|
return parseYAMLContents(contents, { logLevel: 'error' });
|
|
88
88
|
};
|
|
89
|
+
export const tryRealpath = (filePath) => {
|
|
90
|
+
try {
|
|
91
|
+
return toPosix(realpathSync.native(filePath));
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return filePath;
|
|
95
|
+
}
|
|
96
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.
|
|
1
|
+
export declare const version = "6.0.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.0.
|
|
1
|
+
export const version = '6.0.3';
|