Socket
Book a DemoSign in
Socket

knip

Package Overview
Dependencies
Maintainers
1
Versions
569
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knip - npm Package Compare versions

Comparing version
6.0.4
to
6.0.5
+2
-2
dist/graph/analyze.js

@@ -63,3 +63,3 @@ import { createGraphExplorer } from "../graph-explorer/explorer.js";

for (const tagName of exportedItem.jsDocTags) {
if (options.tags[1].includes(tagName.replace(/^@/, ''))) {
if (options.tags[1].includes(tagName)) {
collector.addTagHint({ type: 'tag', filePath, identifier, tagName });

@@ -118,3 +118,3 @@ }

for (const tagName of exportedItem.jsDocTags) {
if (options.tags[1].includes(tagName.replace(/^@/, ''))) {
if (options.tags[1].includes(tagName)) {
collector.addTagHint({ type: 'tag', filePath, identifier: id, tagName });

@@ -121,0 +121,0 @@ }

@@ -48,3 +48,3 @@ import { compact } from "../../util/array.js";

commands = target.options.commands.map(commandConfig => typeof commandConfig === 'string' ? commandConfig : commandConfig.command);
const cwd = target.options?.cwd ? join(options.cwd, target.options.cwd) : undefined;
const cwd = target.options?.cwd ? join(options.cwd, target.options.cwd) : options.cwd;
return options.getInputsFromScripts(commands, { cwd });

@@ -51,0 +51,0 @@ });

@@ -50,3 +50,3 @@ import type { Fix, Fixes } from './exports.ts';

readonly fix: Fix;
readonly jsDocTags: Tags;
jsDocTags: Tags;
readonly flags: number;

@@ -53,0 +53,0 @@ hasRefsInFile: boolean;

@@ -14,3 +14,3 @@ import { isBuiltin } from 'node:module';

const jsxImportSourceRe = /@jsxImportSource\s+(\S+)/;
const referenceTypesRe = /\/\s*<reference\s+types\s*=\s*"([^"]+)"\s*\/>/;
const referenceTypesRe = /\s*<reference\s+types\s*=\s*"([^"]+)"\s*\/>/;
const envRe = /@(?:vitest|jest)-environment\s+(\S+)/g;

@@ -307,3 +307,3 @@ const getImportsAndExports = (filePath, sourceText, resolveModule, options, ignoreExportsUsedInFile, skipExportsForFile, visitor, pluginCtx, cachedParseResult) => {

if (comment.type === 'Line') {
const refMatch = ('/' + comment.value).match(referenceTypesRe);
const refMatch = comment.value.match(referenceTypesRe);
if (refMatch) {

@@ -310,0 +310,0 @@ addImport(refMatch[1], undefined, undefined, undefined, comment.start, IMPORT_FLAGS.TYPE_ONLY);

import { parseSync, rawTransferSupported, } from 'oxc-parser';
import { DEFAULT_EXTENSIONS, FIX_FLAGS, SYMBOL_TYPE } from "../../constants.js";
import { extname } from "../../util/path.js";
import { EMPTY_TAGS } from "./jsdoc.js";
const defaultParseOptions = {

@@ -60,2 +61,14 @@ sourceType: 'unambiguous',

const fullName = prefix ? `${prefix}.${name}` : name;
const tags = getJSDocTags(stmtStart);
const existing = members.find(m => m.identifier === fullName);
if (existing) {
if (tags.size) {
if (existing.jsDocTags === EMPTY_TAGS)
existing.jsDocTags = new Set(tags);
else
for (const t of tags)
existing.jsDocTags.add(t);
}
return;
}
const { line, col } = getLineAndCol(lineStarts, pos);

@@ -73,3 +86,3 @@ const fix = options.isFixExports

hasRefsInFile: false,
jsDocTags: getJSDocTags(stmtStart),
jsDocTags: tags,
flags: 0,

@@ -76,0 +89,0 @@ });

@@ -7,7 +7,7 @@ import { ALIAS_TAG, BETA_TAG, INTERNAL_TAG, PUBLIC_TAG } from "../constants.js";

if (match)
(tag.startsWith('-') ? excl : incl).push(match[0]);
(tag.startsWith('-') ? excl : incl).push(`@${match[0]}`);
return [incl, excl];
}, [[], []]);
};
const hasTag = (tags, jsDocTags) => tags.some(tag => jsDocTags.has(`@${tag}`));
const hasTag = (tags, jsDocTags) => tags.some(tag => jsDocTags.has(tag));
export const shouldIgnore = (jsDocTags, tags) => {

@@ -14,0 +14,0 @@ const [includeJSDocTags, excludeJSDocTags] = tags;

@@ -1,1 +0,1 @@

export declare const version = "6.0.4";
export declare const version = "6.0.5";

@@ -1,1 +0,1 @@

export const version = '6.0.4';
export const version = '6.0.5';
{
"name": "knip",
"version": "6.0.4",
"version": "6.0.5",
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",

@@ -5,0 +5,0 @@ "keywords": [