knip 5.37.0 → 5.37.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SyncCompilerFn } from './types.js';
|
|
2
|
-
export declare const importMatcher: RegExp;
|
|
3
2
|
export declare const fencedCodeBlockMatcher: RegExp;
|
|
3
|
+
export declare const importMatcher: RegExp;
|
|
4
4
|
export declare const importsWithinScripts: SyncCompilerFn;
|
|
5
|
+
export declare const tsScriptBodies: SyncCompilerFn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export const fencedCodeBlockMatcher = /```[\s\S]*?```/g;
|
|
1
2
|
const scriptExtractor = /<script\b[^>]*>([\s\S]*?)<\/script>/gm;
|
|
2
3
|
export const importMatcher = /import[^'"]+['"]([^'"]+)['"]/g;
|
|
3
|
-
export const fencedCodeBlockMatcher = /```[\s\S]*?```/g;
|
|
4
4
|
export const importsWithinScripts = (text) => {
|
|
5
5
|
const scripts = [];
|
|
6
6
|
let scriptMatch;
|
|
@@ -11,3 +11,13 @@ export const importsWithinScripts = (text) => {
|
|
|
11
11
|
}
|
|
12
12
|
return scripts.join(';\n');
|
|
13
13
|
};
|
|
14
|
+
const tsScriptExtractor = /<script\b[^>]*lang="ts"[^>]*>(?<body>[\s\S]*?)<\/script>/gm;
|
|
15
|
+
export const tsScriptBodies = (text) => {
|
|
16
|
+
const scripts = [];
|
|
17
|
+
let scriptMatch;
|
|
18
|
+
while ((scriptMatch = tsScriptExtractor.exec(text))) {
|
|
19
|
+
if (scriptMatch.groups?.body)
|
|
20
|
+
scripts.push(scriptMatch.groups.body);
|
|
21
|
+
}
|
|
22
|
+
return scripts.join(';\n');
|
|
23
|
+
};
|
package/dist/compilers/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tsScriptBodies } from './compilers.js';
|
|
2
2
|
const condition = (hasDependency) => hasDependency('vue') || hasDependency('nuxt');
|
|
3
|
-
const compiler =
|
|
3
|
+
const compiler = tsScriptBodies;
|
|
4
4
|
export default { condition, compiler };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
2
|
import ts from 'typescript';
|
|
3
|
-
import { ALIAS_TAG, ANONYMOUS,
|
|
3
|
+
import { ALIAS_TAG, ANONYMOUS, IMPORT_STAR, PROTOCOL_VIRTUAL } from '../constants.js';
|
|
4
4
|
import { timerify } from '../util/Performance.js';
|
|
5
5
|
import { addNsValue, addValue, createImports } from '../util/dependency-graph.js';
|
|
6
6
|
import { getPackageNameFromFilePath, isStartsLikePackageName, sanitizeSpecifier } from '../util/modules.js';
|
|
7
|
-
import {
|
|
7
|
+
import { isInNodeModules } from '../util/path.js';
|
|
8
8
|
import { shouldIgnore } from '../util/tag.js';
|
|
9
9
|
import { getAccessMembers, getDestructuredIds, getJSDocTags, getLineAndCharacterOfPosition, getTypeName, isAccessExpression, isConsiderReferencedNS, isDestructuring, isImportSpecifier, isObjectEnumerationCallExpressionArgument, isReferencedInExport, } from './ast-helpers.js';
|
|
10
10
|
import { findInternalReferences, isType } from './find-internal-references.js';
|
|
@@ -108,9 +108,8 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options) =
|
|
|
108
108
|
else if (identifier !== ANONYMOUS && identifier !== IMPORT_STAR) {
|
|
109
109
|
addValue(imports.imported, identifier, sourceFile.fileName);
|
|
110
110
|
}
|
|
111
|
-
if (symbol
|
|
111
|
+
if (symbol)
|
|
112
112
|
importedInternalSymbols.set(symbol, filePath);
|
|
113
|
-
}
|
|
114
113
|
}
|
|
115
114
|
};
|
|
116
115
|
const addImport = (options, node) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.37.
|
|
1
|
+
export declare const version = "5.37.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.37.
|
|
1
|
+
export const version = '5.37.1';
|