knip 6.28.0 → 6.29.0

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.
@@ -6,6 +6,7 @@ export declare const styleExtractor: RegExp;
6
6
  export declare const blockCommentMatcher: RegExp;
7
7
  export declare const lineCommentMatcher: RegExp;
8
8
  export declare const importMatcher: RegExp;
9
+ export declare const collectImports: CompilerSync;
9
10
  export declare const importsWithinScripts: CompilerSync;
10
11
  export declare const scriptBodies: CompilerSync;
11
12
  export declare const getStyleLang: (attrs: string) => string | undefined;
@@ -6,6 +6,16 @@ const langAttrMatcher = /\blang\s*=\s*["']([^"']+)["']/i;
6
6
  export const blockCommentMatcher = /\/\*[\s\S]*?\*\//g;
7
7
  export const lineCommentMatcher = /^[ \t]*\/\/.*$/gm;
8
8
  export const importMatcher = /import(?:\s*\(\s*['"][^'"]+['"][^)]*\)|(?!\s*\()[^'"]+['"][^'"]+['"])/g;
9
+ export const collectImports = text => {
10
+ if (!text.includes('import'))
11
+ return '';
12
+ const imports = [];
13
+ importMatcher.lastIndex = 0;
14
+ let match;
15
+ while ((match = importMatcher.exec(text)))
16
+ imports.push(match[0]);
17
+ return imports.join('\n');
18
+ };
9
19
  export const importsWithinScripts = (text) => {
10
20
  const scripts = [];
11
21
  scriptExtractor.lastIndex = 0;
@@ -2,6 +2,7 @@ import LESS from './less.js';
2
2
  import MDX from './mdx.js';
3
3
  import SCSS from './scss.js';
4
4
  import STYLUS from './stylus.js';
5
+ import TSRX from './tsrx.js';
5
6
  const isAsyncCompiler = (fn) => (fn ? fn.constructor.name === 'AsyncFunction' : false);
6
7
  export const normalizeCompilerExtension = (ext) => ext.replace(/^\.*/, '.');
7
8
  export const partitionCompilers = (rawLocalConfig) => {
@@ -33,6 +34,7 @@ const compilers = [
33
34
  { extensions: ['.sass', '.scss'], ...SCSS },
34
35
  { extensions: ['.less'], ...LESS },
35
36
  { extensions: ['.styl', '.stylus'], ...STYLUS },
37
+ { extensions: ['.tsrx'], ...TSRX },
36
38
  ];
37
39
  export const getIncludedCompilers = (syncCompilers, asyncCompilers, dependencies, onReferencedDependency) => {
38
40
  for (const { extensions, dependencies: compilerDependencies, compiler } of compilers) {
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ dependencies: string[];
3
+ compiler: import("./types.ts").CompilerSync;
4
+ };
5
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { collectImports } from './compilers.js';
2
+ const dependencies = ['@tsrx/core', '@tsrx/react', '@tsrx/preact', '@tsrx/vue', '@tsrx/solid', '@tsrx/ripple'];
3
+ export default { dependencies, compiler: collectImports };
@@ -9,7 +9,7 @@ const { values } = parseArgs({
9
9
  'performance-fn': { type: 'string', multiple: true },
10
10
  memory: { type: 'boolean' },
11
11
  'memory-realtime': { type: 'boolean' },
12
- duration: { type: 'boolean' },
12
+ duration: { type: 'boolean', short: 'u' },
13
13
  },
14
14
  });
15
15
  const timerifyOnlyFnName = values['performance-fn'];
@@ -258,7 +258,12 @@ export async function glob(_patterns, options) {
258
258
  cachedGlobIgnores.set(options.dir, compact(_ignore));
259
259
  }
260
260
  const ignorePatterns = (cachedIgnores ?? _ignore).concat(negatedPatterns.map(pattern => pattern.slice(1)));
261
- const { dir, label, ...fgOptions } = { ...options, ignore: ignorePatterns, expandDirectories: false };
261
+ const { dir, label, ...fgOptions } = {
262
+ ...options,
263
+ ignore: ignorePatterns,
264
+ expandDirectories: false,
265
+ followSymbolicLinks: false,
266
+ };
262
267
  const paths = await tinyGlob(patterns, fgOptions);
263
268
  debugLogObject(relative(options.cwd, dir), label ? `Finding ${label}` : 'Finding paths', () => ({
264
269
  patterns,
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "6.28.0";
1
+ export declare const version = "6.29.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '6.28.0';
1
+ export const version = '6.29.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "6.28.0",
3
+ "version": "6.29.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "keywords": [
6
6
  "analysis",