knip 6.12.1 → 6.12.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.
- package/dist/plugins/serverless-framework/index.js +1 -1
- package/dist/plugins/serverless-framework/types.d.ts +1 -1
- package/dist/plugins/webpack/index.js +8 -1
- package/dist/reporters/util/util.js +7 -8
- package/dist/util/create-options.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ const handlerToEntry = (handler) => {
|
|
|
11
11
|
const resolveConfig = async (config) => {
|
|
12
12
|
if (!config.functions)
|
|
13
13
|
return [];
|
|
14
|
-
return Object.values(config.functions).
|
|
14
|
+
return Object.values(config.functions).flatMap(fn => (fn.handler ? [handlerToEntry(fn.handler)] : []));
|
|
15
15
|
};
|
|
16
16
|
const plugin = {
|
|
17
17
|
title,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toAlias, toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, } from '../../util/input.js';
|
|
2
|
-
import { isInternal, join, toAbsolute } from '../../util/path.js';
|
|
2
|
+
import { extname, isInternal, join, toAbsolute } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
4
|
import { getDependenciesFromConfig } from '../babel/index.js';
|
|
5
5
|
import { createRequireContextVisitor } from './visitors/requireContext.js';
|
|
@@ -7,6 +7,10 @@ const title = 'webpack';
|
|
|
7
7
|
const enablers = ['webpack', 'webpack-cli'];
|
|
8
8
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
9
|
const config = ['webpack.config.{js,ts,mjs,cjs,mts,cts}'];
|
|
10
|
+
const interpretLoaders = {
|
|
11
|
+
'.ts': ['ts-node', 'sucrase', '@babel/register', 'esbuild-register', '@swc/register'],
|
|
12
|
+
'.cts': ['ts-node'],
|
|
13
|
+
};
|
|
10
14
|
const hasBabelOptions = (use) => Boolean(use) &&
|
|
11
15
|
typeof use !== 'string' &&
|
|
12
16
|
'loader' in use &&
|
|
@@ -162,6 +166,9 @@ export const findWebpackDependenciesFromConfig = async (config, options) => {
|
|
|
162
166
|
const resolveConfig = async (localConfig, options) => {
|
|
163
167
|
const inputs = await findWebpackDependenciesFromConfig(localConfig, options);
|
|
164
168
|
inputs.push(toDependency('webpack-cli', { optional: true }));
|
|
169
|
+
for (const loader of interpretLoaders[extname(options.configFilePath)] ?? []) {
|
|
170
|
+
inputs.push(toDependency(loader, { optional: true }));
|
|
171
|
+
}
|
|
165
172
|
return inputs;
|
|
166
173
|
};
|
|
167
174
|
const registerVisitors = ({ ctx, registerVisitor }) => {
|
|
@@ -22,13 +22,11 @@ export const convert = (issue) => ({
|
|
|
22
22
|
pos: issue.pos,
|
|
23
23
|
});
|
|
24
24
|
const sortByPos = (a, b) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
: Number(rowA) - Number(rowB)
|
|
31
|
-
: filePathA.localeCompare(filePathB);
|
|
25
|
+
if (a.filePath !== b.filePath)
|
|
26
|
+
return a.filePath.localeCompare(b.filePath);
|
|
27
|
+
if (a.line !== b.line)
|
|
28
|
+
return (a.line ?? 0) - (b.line ?? 0);
|
|
29
|
+
return (a.col ?? 0) - (b.col ?? 0);
|
|
32
30
|
};
|
|
33
31
|
const highlightSymbol = (issue) => (_) => {
|
|
34
32
|
const { specifier, symbol } = issue;
|
|
@@ -52,7 +50,8 @@ export const getTableForType = (issues, cwd, options = { isUseColors: true }) =>
|
|
|
52
50
|
table.cell('parentSymbol', issue.parentSymbol && print(issue.parentSymbol));
|
|
53
51
|
table.cell('symbolType', issue.symbolType && issue.symbolType !== SYMBOL_TYPE.UNKNOWN && print(issue.symbolType));
|
|
54
52
|
const pos = issue.line === undefined ? '' : `:${issue.line}${issue.col === undefined ? '' : `:${issue.col}`}`;
|
|
55
|
-
const
|
|
53
|
+
const filePath = relative(cwd, issue.filePath);
|
|
54
|
+
const cell = isFileIssue ? filePath : `${filePath}${pos}`;
|
|
56
55
|
table.cell('filePath', print(cell));
|
|
57
56
|
table.cell('fixed', issue.isFixed && print('(removed)'));
|
|
58
57
|
}
|
|
@@ -14,8 +14,8 @@ import { isAbsolute, join, normalize, toAbsolute, toPosix } from './path.js';
|
|
|
14
14
|
import { splitTags } from './tag.js';
|
|
15
15
|
export const createOptions = async (options) => {
|
|
16
16
|
const { args = {} } = options;
|
|
17
|
-
const pcwd = process.cwd();
|
|
18
|
-
const cwd = normalize(toPosix(
|
|
17
|
+
const pcwd = toPosix(process.cwd());
|
|
18
|
+
const cwd = normalize(toAbsolute(toPosix(options.cwd ?? args.directory ?? pcwd), pcwd));
|
|
19
19
|
const manifestPath = findFile(cwd, 'package.json');
|
|
20
20
|
const manifest = manifestPath && (await loadJSON(manifestPath));
|
|
21
21
|
if (!(manifestPath && manifest)) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.12.
|
|
1
|
+
export declare const version = "6.12.2";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.12.
|
|
1
|
+
export const version = '6.12.2';
|