knip 6.22.0 → 6.24.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.
Files changed (69) hide show
  1. package/LICENSE +1 -1
  2. package/dist/ConfigurationChief.d.ts +6 -0
  3. package/dist/ProjectPrincipal.js +3 -5
  4. package/dist/WorkspaceWorker.d.ts +3 -1
  5. package/dist/WorkspaceWorker.js +5 -2
  6. package/dist/binaries/resolvers/index.d.ts +2 -0
  7. package/dist/binaries/resolvers/index.js +3 -0
  8. package/dist/binaries/resolvers/nub.d.ts +2 -0
  9. package/dist/binaries/resolvers/nub.js +46 -0
  10. package/dist/binaries/resolvers/yarn.js +4 -3
  11. package/dist/compilers/compilers.d.ts +2 -0
  12. package/dist/compilers/compilers.js +15 -4
  13. package/dist/compilers/index.d.ts +11 -1
  14. package/dist/compilers/index.js +25 -10
  15. package/dist/compilers/less.d.ts +7 -0
  16. package/dist/compilers/less.js +37 -0
  17. package/dist/compilers/mdx.d.ts +1 -2
  18. package/dist/compilers/mdx.js +14 -8
  19. package/dist/compilers/scss.d.ts +3 -2
  20. package/dist/compilers/scss.js +17 -14
  21. package/dist/compilers/shared.d.ts +6 -0
  22. package/dist/compilers/shared.js +9 -0
  23. package/dist/compilers/style-preprocessors.d.ts +2 -0
  24. package/dist/compilers/style-preprocessors.js +41 -0
  25. package/dist/compilers/stylus.d.ts +7 -0
  26. package/dist/compilers/stylus.js +36 -0
  27. package/dist/constants.js +4 -0
  28. package/dist/graph/build.js +14 -1
  29. package/dist/plugins/astro/compiler-mdx.js +11 -2
  30. package/dist/plugins/astro/compiler.js +8 -4
  31. package/dist/plugins/astro-markdoc/index.d.ts +3 -0
  32. package/dist/plugins/astro-markdoc/index.js +34 -0
  33. package/dist/plugins/astro-markdoc/types.d.ts +12 -0
  34. package/dist/plugins/astro-markdoc/types.js +1 -0
  35. package/dist/plugins/github-actions/index.js +3 -2
  36. package/dist/plugins/index.d.ts +1 -0
  37. package/dist/plugins/index.js +2 -0
  38. package/dist/plugins/node/index.js +1 -1
  39. package/dist/plugins/nuxt/index.js +4 -2
  40. package/dist/plugins/prisma/compiler.js +3 -0
  41. package/dist/plugins/starlight/index.js +14 -1
  42. package/dist/plugins/stencil/index.js +59 -1
  43. package/dist/plugins/svelte/compiler.d.ts +2 -1
  44. package/dist/plugins/svelte/compiler.js +8 -1
  45. package/dist/plugins/tailwind/compiler.js +3 -0
  46. package/dist/plugins/tailwind/index.js +5 -1
  47. package/dist/plugins/vite/index.js +1 -1
  48. package/dist/plugins/vitest/index.js +3 -3
  49. package/dist/plugins/vue/compiler.d.ts +2 -1
  50. package/dist/plugins/vue/compiler.js +8 -1
  51. package/dist/reporters/compact.js +1 -2
  52. package/dist/reporters/symbols.js +1 -2
  53. package/dist/schema/configuration.d.ts +15 -0
  54. package/dist/schema/plugins.d.ts +5 -0
  55. package/dist/schema/plugins.js +1 -0
  56. package/dist/types/PluginNames.d.ts +2 -2
  57. package/dist/types/PluginNames.js +1 -0
  58. package/dist/types/config.d.ts +1 -0
  59. package/dist/types.d.ts +1 -1
  60. package/dist/typescript/SourceFileManager.js +3 -2
  61. package/dist/typescript/ast-nodes.d.ts +1 -0
  62. package/dist/typescript/ast-nodes.js +51 -1
  63. package/dist/typescript/comments.js +22 -3
  64. package/dist/typescript/visitors/walk.js +7 -1
  65. package/dist/util/create-options.d.ts +10 -0
  66. package/dist/version.d.ts +1 -1
  67. package/dist/version.js +1 -1
  68. package/package.json +1 -1
  69. package/schema.json +4 -0
@@ -28,6 +28,17 @@ export async function build({ chief, collector, counselor, deputy, principal, is
28
28
  const handleInput = createInputHandler(deputy, chief, isGitIgnored, addIssue, externalRefsFromInputs, options);
29
29
  const rawRootManifest = chief.getManifestForWorkspace('.');
30
30
  const rootManifest = rawRootManifest ? createManifest(rawRootManifest) : undefined;
31
+ const manifestsByWorkspaceName = new Map();
32
+ const getManifest = (dir) => {
33
+ const workspace = chief.findWorkspaceByFilePath(`${dir}/`);
34
+ if (!workspace)
35
+ return undefined;
36
+ if (!manifestsByWorkspaceName.has(workspace.name)) {
37
+ const raw = chief.getManifestForWorkspace(workspace.name);
38
+ manifestsByWorkspaceName.set(workspace.name, raw ? createManifest(raw) : undefined);
39
+ }
40
+ return manifestsByWorkspaceName.get(workspace.name);
41
+ };
31
42
  for (const workspace of workspaces) {
32
43
  const { name, dir, manifestPath, manifestStr } = workspace;
33
44
  const manifest = chief.getManifestForWorkspace(name);
@@ -70,6 +81,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
70
81
  rootManifest,
71
82
  handleInput: (input) => handleInput(input, workspace),
72
83
  findWorkspaceByFilePath: chief.findWorkspaceByFilePath.bind(chief),
84
+ getManifest,
73
85
  negatedWorkspacePatterns: chief.getNegatedWorkspacePatterns(name),
74
86
  ignoredWorkspacePatterns: chief.getIgnoredWorkspacesFor(name),
75
87
  enabledPluginsInAncestors: ancestors.flatMap(ancestor => enabledPluginsStore.get(ancestor) ?? []),
@@ -78,7 +90,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
78
90
  options,
79
91
  });
80
92
  await worker.init();
81
- const compilers = getIncludedCompilers(chief.config.syncCompilers, chief.config.asyncCompilers, dependencies);
93
+ const compilers = getIncludedCompilers(chief.config.syncCompilers, chief.config.asyncCompilers, dependencies, dep => deputy.addReferencedDependency(name, dep));
82
94
  const registerCompiler = async ({ extension, compiler }) => {
83
95
  const ext = normalizeCompilerExtension(extension);
84
96
  if (compilers[0].has(ext))
@@ -359,6 +371,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
359
371
  dependencies,
360
372
  manifest: createManifest(manifest),
361
373
  rootManifest,
374
+ getManifest,
362
375
  };
363
376
  const inputs = _getInputsFromScripts(file.scripts, opts);
364
377
  for (const input of inputs) {
@@ -1,8 +1,17 @@
1
1
  import { fencedCodeBlockMatcher, importMatcher, importsWithinFrontmatter, inlineCodeMatcher, } from '../../compilers/compilers.js';
2
2
  const frontmatterImportFields = ['layout'];
3
3
  const compiler = (text) => {
4
- const imports = text.replace(fencedCodeBlockMatcher, '').replace(inlineCodeMatcher, '').matchAll(importMatcher);
5
4
  const frontmatterImports = importsWithinFrontmatter(text, frontmatterImportFields);
6
- return [...imports, frontmatterImports].join('\n');
5
+ if (!text.includes('import'))
6
+ return frontmatterImports;
7
+ const imports = [];
8
+ const source = text.replace(fencedCodeBlockMatcher, '').replace(inlineCodeMatcher, '');
9
+ let match;
10
+ importMatcher.lastIndex = 0;
11
+ while ((match = importMatcher.exec(source)))
12
+ imports.push(match[0]);
13
+ if (frontmatterImports)
14
+ imports.push(frontmatterImports);
15
+ return imports.join('\n');
7
16
  };
8
17
  export default compiler;
@@ -1,17 +1,21 @@
1
1
  import { frontmatterMatcher, scriptBodies } from '../../compilers/compilers.js';
2
+ import { stylePreprocessorImports } from '../../compilers/style-preprocessors.js';
2
3
  const propsDeclMatcher = /(?:^|[\s;])(?:interface|type)\s+Props\b/;
3
4
  const compiler = (text, path) => {
4
- const scripts = [];
5
+ let out = '';
5
6
  const frontmatter = text.match(frontmatterMatcher);
6
7
  if (frontmatter?.[1]) {
7
8
  let fm = frontmatter[1];
8
9
  if (propsDeclMatcher.test(fm) && text.includes('Astro.props'))
9
10
  fm += '\ntype __knip_astro_props = Props;';
10
- scripts.push(fm);
11
+ out = fm;
11
12
  }
12
13
  const scriptContent = scriptBodies(text, path);
13
14
  if (scriptContent)
14
- scripts.push(scriptContent);
15
- return scripts.join('\n');
15
+ out = out ? `${out}\n${scriptContent}` : scriptContent;
16
+ const styleImports = stylePreprocessorImports(text, path);
17
+ if (styleImports)
18
+ out = out ? `${out}\n${styleImports}` : styleImports;
19
+ return out;
16
20
  };
17
21
  export default compiler;
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -0,0 +1,34 @@
1
+ import { toProductionEntry } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ const title = 'Astro Markdoc';
4
+ const enablers = ['@astrojs/markdoc'];
5
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
+ const config = ['markdoc.config.{js,ts,mjs,mts}'];
7
+ const extractSpecifiers = (renderField) => {
8
+ if (typeof renderField === 'string') {
9
+ return [renderField.split('#')[0]];
10
+ }
11
+ if (renderField && typeof renderField === 'object') {
12
+ for (const key of ['Component', 'file', 'path']) {
13
+ if (typeof renderField[key] === 'string') {
14
+ return [renderField[key].split('#')[0]];
15
+ }
16
+ }
17
+ }
18
+ return [];
19
+ };
20
+ const resolveConfig = async (localConfig) => {
21
+ if (!localConfig)
22
+ return [];
23
+ const entries = [...Object.values(localConfig.nodes ?? {}), ...Object.values(localConfig.tags ?? {})];
24
+ const specifiers = entries.flatMap(item => item && typeof item === 'object' && 'render' in item ? extractSpecifiers(item.render) : []);
25
+ return specifiers.map(id => toProductionEntry(id));
26
+ };
27
+ const plugin = {
28
+ title,
29
+ enablers,
30
+ isEnabled,
31
+ config,
32
+ resolveConfig,
33
+ };
34
+ export default plugin;
@@ -0,0 +1,12 @@
1
+ export type MarkdocRenderSpecifier = string | {
2
+ [key: string]: unknown;
3
+ };
4
+ type MarkdocRenderableNode = {
5
+ render?: MarkdocRenderSpecifier;
6
+ [key: string]: unknown;
7
+ };
8
+ export type MarkdocConfig = {
9
+ nodes?: Record<string, MarkdocRenderableNode>;
10
+ tags?: Record<string, MarkdocRenderableNode>;
11
+ };
12
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -18,7 +18,7 @@ export const getActionDependencies = (config, options) => {
18
18
  return scripts.map(script => join(configFileDir, script));
19
19
  };
20
20
  const resolveConfig = async (config, options) => {
21
- const { rootCwd, getInputsFromScripts, isProduction } = options;
21
+ const { rootCwd, getInputsFromScripts, isProduction, getManifest } = options;
22
22
  const inputs = new Set();
23
23
  const jobs = findByKeyDeep(config, 'steps');
24
24
  for (const steps of jobs) {
@@ -30,7 +30,8 @@ const resolveConfig = async (config, options) => {
30
30
  const workingDir = step['working-directory'];
31
31
  const dir = join(rootCwd, path && workingDir ? relative(workingDir, path) : workingDir ? workingDir : '.');
32
32
  if (step.run) {
33
- for (const input of getInputsFromScripts([step.run], { knownBinsOnly: true })) {
33
+ const manifest = getManifest(dir) ?? options.manifest;
34
+ for (const input of getInputsFromScripts([step.run], { knownBinsOnly: true, manifest })) {
34
35
  if (isDeferResolveEntry(input) && path && !workingDir) {
35
36
  input.specifier = relative(join(dir, path), join(rootCwd, input.specifier));
36
37
  }
@@ -2,6 +2,7 @@ export declare const Plugins: {
2
2
  angular: import("../types/config.ts").Plugin;
3
3
  astro: import("../types/config.ts").Plugin;
4
4
  'astro-db': import("../types/config.ts").Plugin;
5
+ 'astro-markdoc': import("../types/config.ts").Plugin;
5
6
  'astro-og-canvas': import("../types/config.ts").Plugin;
6
7
  ava: import("../types/config.ts").Plugin;
7
8
  babel: import("../types/config.ts").Plugin;
@@ -1,6 +1,7 @@
1
1
  import { default as angular } from './angular/index.js';
2
2
  import { default as astro } from './astro/index.js';
3
3
  import { default as astroDb } from './astro-db/index.js';
4
+ import { default as astroMarkdoc } from './astro-markdoc/index.js';
4
5
  import { default as astroOgCanvas } from './astro-og-canvas/index.js';
5
6
  import { default as ava } from './ava/index.js';
6
7
  import { default as babel } from './babel/index.js';
@@ -158,6 +159,7 @@ export const Plugins = {
158
159
  angular,
159
160
  astro,
160
161
  'astro-db': astroDb,
162
+ 'astro-markdoc': astroMarkdoc,
161
163
  'astro-og-canvas': astroOgCanvas,
162
164
  ava,
163
165
  babel,
@@ -7,7 +7,7 @@ const patterns = [
7
7
  '**/test.{cjs,mjs,js,cts,mts,ts}',
8
8
  '**/test/**/*.{cjs,mjs,js,cts,mts,ts}',
9
9
  ];
10
- const hasNodeTest = (scripts) => scripts && Object.values(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(script));
10
+ const hasNodeTest = (scripts) => scripts && Object.values(scripts).some(script => /(?<=^|\s)(node|nub)\s(.*)--test/.test(script));
11
11
  const entry = ['server.js'];
12
12
  const resolve = options => {
13
13
  const entries = entry.map(id => toProductionEntry(id));
@@ -82,10 +82,12 @@ const registerCompilers = async ({ cwd, hasDependency, registerCompiler }) => {
82
82
  if (store)
83
83
  store.push(...components);
84
84
  else
85
- componentMap.set(id, [...components]);
85
+ componentMap.set(id, components);
86
86
  }
87
87
  }
88
88
  const getSyntheticImports = (identifiers, templateTags) => {
89
+ if (importMap.size === 0 && (!templateTags || componentMap.size === 0))
90
+ return [];
89
91
  const syntheticImports = [];
90
92
  for (const [name, specifier] of importMap) {
91
93
  if (identifiers.has(name))
@@ -113,7 +115,7 @@ const registerCompilers = async ({ cwd, hasDependency, registerCompiler }) => {
113
115
  scripts.push(descriptor.script.content);
114
116
  if (descriptor.scriptSetup?.content)
115
117
  scripts.push(descriptor.scriptSetup.content);
116
- const identifiers = collectIdentifiers(scripts.join('\n'), path);
118
+ const identifiers = scripts.length === 0 ? new Set() : collectIdentifiers(scripts.join('\n'), path);
117
119
  let templateTags;
118
120
  if (descriptor.template?.ast) {
119
121
  const info = collectTemplateInfo(descriptor.template.ast);
@@ -1,7 +1,10 @@
1
1
  const directiveMatcher = /generator\s+(?!client)\w+\s*\{\s*provider\s*=\s*"([^"]+)"[^}]*\}/g;
2
2
  const compiler = (text) => {
3
+ if (!text.includes('generator'))
4
+ return '';
3
5
  const imports = [];
4
6
  let match;
7
+ directiveMatcher.lastIndex = 0;
5
8
  while ((match = directiveMatcher.exec(text))) {
6
9
  if (match[1]) {
7
10
  imports.push(`import '${match[1]}';`);
@@ -1,3 +1,4 @@
1
+ import { findCallArg, getDefaultImportName, getImportMap, getPropertyValues } from '../../typescript/ast-helpers.js';
1
2
  import { toProductionEntry } from '../../util/input.js';
2
3
  import { hasDependency } from '../../util/plugin.js';
3
4
  import { config } from '../astro/index.js';
@@ -7,7 +8,19 @@ const enablers = ['@astrojs/starlight'];
7
8
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
9
  const resolveFromAST = program => {
9
10
  const componentPaths = getComponentPathsFromSourceFile(program);
10
- return Array.from(componentPaths).map(id => toProductionEntry(id));
11
+ const inputs = Array.from(componentPaths).map(id => toProductionEntry(id));
12
+ const importMap = getImportMap(program);
13
+ const starlightImportName = getDefaultImportName(importMap, '@astrojs/starlight');
14
+ if (starlightImportName) {
15
+ const starlightConfig = findCallArg(program, starlightImportName);
16
+ if (starlightConfig) {
17
+ const customCssPaths = getPropertyValues(starlightConfig, 'customCss');
18
+ for (const id of customCssPaths) {
19
+ inputs.push(toProductionEntry(id));
20
+ }
21
+ }
22
+ }
23
+ return inputs;
11
24
  };
12
25
  const plugin = {
13
26
  title,
@@ -1,6 +1,10 @@
1
+ import { Visitor } from 'oxc-parser';
2
+ import scss from '../../compilers/scss.js';
3
+ import { IMPORT_FLAGS } from '../../constants.js';
1
4
  import { toConfig, toEntry, toProductionEntry } from '../../util/input.js';
5
+ import { dirname, join } from '../../util/path.js';
2
6
  import { hasDependency } from '../../util/plugin.js';
3
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
7
+ import { collectPropertyValues, getPropertyValues } from '../../typescript/ast-helpers.js';
4
8
  import { createCustomElementVisitor } from '../_custom-elements/custom-element-visitor.js';
5
9
  const title = 'Stencil';
6
10
  const enablers = ['@stencil/core'];
@@ -9,8 +13,49 @@ const config = ['stencil.config.{ts,js}'];
9
13
  const production = ['src/**/*.tsx'];
10
14
  const entry = ['**/*.spec.{ts,tsx}', '**/*.e2e.{ts,tsx}'];
11
15
  const isStencilSpecifier = (specifier) => specifier === '@stencil/core';
16
+ const registerCompilers = ({ hasDependency, registerCompiler }) => {
17
+ if (hasDependency('@stencil/sass'))
18
+ for (const ext of ['.scss', '.sass'])
19
+ registerCompiler({ extension: ext, compiler: scss.compiler });
20
+ };
12
21
  const registerVisitors = ({ ctx, registerVisitor }) => {
13
22
  registerVisitor(createCustomElementVisitor(ctx, isStencilSpecifier, { decoratorName: 'Component' }));
23
+ const componentNames = new Set();
24
+ registerVisitor({
25
+ Program() {
26
+ componentNames.clear();
27
+ },
28
+ ImportDeclaration(node) {
29
+ if (!isStencilSpecifier(node.source?.value))
30
+ return;
31
+ for (const spec of node.specifiers ?? []) {
32
+ if (spec.type === 'ImportSpecifier' &&
33
+ spec.imported.type === 'Identifier' &&
34
+ spec.imported.name === 'Component')
35
+ componentNames.add(spec.local.name);
36
+ }
37
+ },
38
+ ClassDeclaration(node) {
39
+ resolveStyleUrls(node);
40
+ },
41
+ });
42
+ function resolveStyleUrls(node) {
43
+ const dir = dirname(ctx.filePath);
44
+ for (const decorator of node.decorators ?? []) {
45
+ const expr = decorator.expression;
46
+ if (expr?.type !== 'CallExpression')
47
+ continue;
48
+ if (expr.callee?.type !== 'Identifier' || !componentNames.has(expr.callee.name))
49
+ continue;
50
+ const arg = expr.arguments?.[0];
51
+ if (arg?.type !== 'ObjectExpression')
52
+ continue;
53
+ for (const url of getPropertyValues(arg, 'styleUrl'))
54
+ ctx.addImport(join(dir, url), arg.start, IMPORT_FLAGS.NONE);
55
+ for (const url of getPropertyValues(arg, 'styleUrls'))
56
+ ctx.addImport(join(dir, url), arg.start, IMPORT_FLAGS.NONE);
57
+ }
58
+ }
14
59
  };
15
60
  const resolveFromAST = program => {
16
61
  const inputs = [];
@@ -22,6 +67,18 @@ const resolveFromAST = program => {
22
67
  for (const script of collectPropertyValues(program, 'globalScript')) {
23
68
  inputs.push(toProductionEntry(script));
24
69
  }
70
+ for (const style of collectPropertyValues(program, 'globalStyle')) {
71
+ inputs.push(toProductionEntry(style));
72
+ }
73
+ new Visitor({
74
+ ObjectExpression(node) {
75
+ const typeValues = getPropertyValues(node, 'type');
76
+ if (!typeValues.has('global-style'))
77
+ return;
78
+ for (const input of getPropertyValues(node, 'input'))
79
+ inputs.push(toProductionEntry(input));
80
+ },
81
+ }).visit(program);
25
82
  for (const tsconfig of collectPropertyValues(program, 'tsconfig')) {
26
83
  inputs.push(toConfig('typescript', tsconfig));
27
84
  }
@@ -41,6 +98,7 @@ const plugin = {
41
98
  entry,
42
99
  production,
43
100
  resolveFromAST,
101
+ registerCompilers,
44
102
  registerVisitors,
45
103
  };
46
104
  export default plugin;
@@ -1,2 +1,3 @@
1
- declare const compiler: import("../../compilers/types.ts").CompilerSync;
1
+ import type { CompilerSync } from '../../compilers/types.ts';
2
+ declare const compiler: CompilerSync;
2
3
  export default compiler;
@@ -1,3 +1,10 @@
1
1
  import { importsWithinScripts } from '../../compilers/compilers.js';
2
- const compiler = importsWithinScripts;
2
+ import { stylePreprocessorImports } from '../../compilers/style-preprocessors.js';
3
+ const compiler = (text, path) => {
4
+ const scripts = importsWithinScripts(text, path);
5
+ const styles = stylePreprocessorImports(text, path);
6
+ if (!scripts)
7
+ return styles;
8
+ return styles ? `${scripts};\n${styles}` : scripts;
9
+ };
3
10
  export default compiler;
@@ -1,8 +1,11 @@
1
1
  const directiveMatcher = /@(?:import|config|plugin)\s+['"]([^'"]+)['"][^;]*;/g;
2
2
  const compiler = (text) => {
3
+ if (!text.includes('@import') && !text.includes('@config') && !text.includes('@plugin'))
4
+ return '';
3
5
  const imports = [];
4
6
  let match;
5
7
  let index = 0;
8
+ directiveMatcher.lastIndex = 0;
6
9
  while ((match = directiveMatcher.exec(text)))
7
10
  if (match[1])
8
11
  imports.push(`import _$${index++} from '${match[1]}';`);
@@ -5,8 +5,12 @@ const enablers = ['tailwindcss', '@tailwindcss/vite', '@tailwindcss/postcss', '@
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
6
6
  const entry = ['tailwind.config.{js,cjs,mjs,ts,cts,mts}'];
7
7
  const registerCompilers = ({ registerCompiler, hasDependency }) => {
8
- if (enablers.some(enabler => hasDependency(enabler)))
8
+ for (const enabler of enablers) {
9
+ if (!hasDependency(enabler))
10
+ continue;
9
11
  registerCompiler({ extension: '.css', compiler });
12
+ break;
13
+ }
10
14
  };
11
15
  const plugin = {
12
16
  title,
@@ -3,7 +3,7 @@ import { resolveConfig } from '../vitest/index.js';
3
3
  import { getBabelInputs, getIndexHtmlEntries } from './helpers.js';
4
4
  import { createImportMetaGlobVisitor } from './visitors/importMetaGlob.js';
5
5
  const title = 'Vite';
6
- const enablers = ['vite', 'vitest'];
6
+ const enablers = ['vite', 'vitest', 'vite-plus'];
7
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
8
  export const config = ['vite.config.{js,mjs,ts,cjs,mts,cts}'];
9
9
  const resolveFromAST = program => getBabelInputs(program);
@@ -7,7 +7,7 @@ import { hasDependency } from '../../util/plugin.js';
7
7
  import { getIndexHtmlEntries } from '../vite/helpers.js';
8
8
  import { getAliasInputs, getEnvSpecifier, getExternalReporters } from './helpers.js';
9
9
  const title = 'Vitest';
10
- const enablers = ['vitest'];
10
+ const enablers = ['vitest', 'vite-plus'];
11
11
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
12
12
  const config = ['vitest.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{js,mjs,ts,cjs,mts,cts,json}'];
13
13
  const mocks = ['**/__mocks__/**/*.?(c|m)[jt]s?(x)'];
@@ -143,11 +143,11 @@ export const resolveConfig = async (localConfig, options) => {
143
143
  if (cfg.resolve?.alias)
144
144
  addAliases(cfg.resolve.alias);
145
145
  for (const dependency of cfg.resolve?.dedupe ?? [])
146
- inputs.add(toDependency(dependency));
146
+ inputs.add(toDependency(dependency, { optional: true }));
147
147
  for (const dependency of cfg.optimizeDeps?.include ?? []) {
148
148
  const packageName = getOptimizeDepsIncludePackageName(dependency);
149
149
  if (packageName)
150
- inputs.add(toDependency(packageName));
150
+ inputs.add(toDependency(packageName, { optional: true }));
151
151
  }
152
152
  if (cfg.resolve?.extensions) {
153
153
  const customExtensions = cfg.resolve.extensions.filter(ext => ext.startsWith('.') && !DEFAULT_EXTENSIONS.has(ext));
@@ -1,2 +1,3 @@
1
- declare const compiler: import("../../compilers/types.ts").CompilerSync;
1
+ import type { CompilerSync } from '../../compilers/types.ts';
2
+ declare const compiler: CompilerSync;
2
3
  export default compiler;
@@ -1,3 +1,10 @@
1
1
  import { scriptBodies } from '../../compilers/compilers.js';
2
- const compiler = scriptBodies;
2
+ import { stylePreprocessorImports } from '../../compilers/style-preprocessors.js';
3
+ const compiler = (text, path) => {
4
+ const scripts = scriptBodies(text, path);
5
+ const styles = stylePreprocessorImports(text, path);
6
+ if (!scripts)
7
+ return styles;
8
+ return styles ? `${scripts};\n${styles}` : scripts;
9
+ };
3
10
  export default compiler;
@@ -5,11 +5,10 @@ const logIssueRecord = (issues, cwd) => {
5
5
  console.log(getIssueLine(issue, cwd));
6
6
  };
7
7
  export default ({ report, issues, isShowProgress, cwd }) => {
8
- const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
9
8
  let totalIssues = 0;
10
9
  for (const [reportType, isReportType] of Object.entries(report)) {
11
10
  if (isReportType) {
12
- const title = reportMultipleGroups && getIssueTypeTitle(reportType);
11
+ const title = getIssueTypeTitle(reportType);
13
12
  const issuesForType = reportType === 'duplicates'
14
13
  ? flattenIssues(issues[reportType])
15
14
  : Object.values(issues[reportType])
@@ -2,11 +2,10 @@ import { printConfigurationHints, printTagHints } from './util/configuration-hin
2
2
  import { dim, flattenIssues, getColoredTitle, getIssueTypeTitle, getTableForType } from './util/util.js';
3
3
  export default (options) => {
4
4
  const { report, issues, isDisableConfigHints, isDisableTagHints, isShowProgress } = options;
5
- const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
6
5
  let totalIssues = 0;
7
6
  for (const [reportType, isReportType] of Object.entries(report)) {
8
7
  if (isReportType) {
9
- const title = reportMultipleGroups && getIssueTypeTitle(reportType);
8
+ const title = getIssueTypeTitle(reportType);
10
9
  const issuesForType = flattenIssues(issues[reportType]);
11
10
  if (issuesForType.length > 0) {
12
11
  title && console.log(getColoredTitle(title, issuesForType.length));
@@ -16,6 +16,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
16
16
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
17
17
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
18
18
  }, z.core.$strip>]>>;
19
+ 'astro-markdoc': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
20
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
21
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
22
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
23
+ }, z.core.$strip>]>>;
19
24
  'astro-og-canvas': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
20
25
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
21
26
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -812,6 +817,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
812
817
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
813
818
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
814
819
  }, z.core.$strip>]>>;
820
+ 'astro-markdoc': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
821
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
822
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
823
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
824
+ }, z.core.$strip>]>>;
815
825
  'astro-og-canvas': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
816
826
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
817
827
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -1622,6 +1632,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
1622
1632
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
1623
1633
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
1624
1634
  }, z.core.$strip>]>>;
1635
+ 'astro-markdoc': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
1636
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
1637
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
1638
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
1639
+ }, z.core.$strip>]>>;
1625
1640
  'astro-og-canvas': z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
1626
1641
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
1627
1642
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -21,6 +21,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
21
21
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
22
22
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
23
23
  }, z.core.$strip>]>;
24
+ 'astro-markdoc': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
25
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
26
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
27
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
28
+ }, z.core.$strip>]>;
24
29
  'astro-og-canvas': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
25
30
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
26
31
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -13,6 +13,7 @@ export const pluginsSchema = z.object({
13
13
  angular: pluginSchema,
14
14
  astro: pluginSchema,
15
15
  'astro-db': pluginSchema,
16
+ 'astro-markdoc': pluginSchema,
16
17
  'astro-og-canvas': pluginSchema,
17
18
  ava: pluginSchema,
18
19
  babel: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
2
- export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'eleventy', 'eslint', 'execa', 'expo', 'expressive-code', 'fast', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nx', 'nyc', 'oclif', 'openapi-ts', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'vercel', 'vercel-og', 'vike', 'vite', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
1
+ export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
2
+ export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'eleventy', 'eslint', 'execa', 'expo', 'expressive-code', 'fast', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nx', 'nyc', 'oclif', 'openapi-ts', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'vercel', 'vercel-og', 'vike', 'vite', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
@@ -2,6 +2,7 @@ export const pluginNames = [
2
2
  'angular',
3
3
  'astro',
4
4
  'astro-db',
5
+ 'astro-markdoc',
5
6
  'astro-og-canvas',
6
7
  'ava',
7
8
  'babel',
@@ -76,6 +76,7 @@ interface BaseOptions {
76
76
  cwd: string;
77
77
  manifest: Manifest;
78
78
  rootManifest: Manifest | undefined;
79
+ getManifest: (dir: string) => Manifest | undefined;
79
80
  }
80
81
  type IsPluginEnabledOptions = {
81
82
  cwd: string;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type { RawConfigurationOrFn as KnipConfig, RawConfiguration as KnipConfiguration, WorkspaceProjectConfig, } from './types/config.ts';
2
- export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.ts';
2
+ export type { Issue, IssueRecords, IssueType, Preprocessor, Reporter, ReporterOptions } from './types/issues.ts';
3
3
  export type { JSONReport, JSONReportEntry, JSONReportItem, JSONReportNamedItem } from './reporters/json.ts';
@@ -11,8 +11,9 @@ export class SourceFileManager {
11
11
  this.asyncCompilers = compilers[1];
12
12
  }
13
13
  readFile(filePath) {
14
- if (this.sourceTextCache.has(filePath))
15
- return this.sourceTextCache.get(filePath);
14
+ const cachedSourceText = this.sourceTextCache.get(filePath);
15
+ if (cachedSourceText !== undefined)
16
+ return cachedSourceText;
16
17
  const ext = extname(filePath);
17
18
  const compiler = this.syncCompilers.get(ext);
18
19
  if (FOREIGN_FILE_EXTENSIONS.has(ext) && !compiler) {
@@ -19,4 +19,5 @@ export declare const getStringValue: (node: any) => string | undefined;
19
19
  export declare const getSafeScriptFromArgs: (executable: any, argsArray: any) => string | undefined;
20
20
  export declare const shouldCountRefs: (ignoreExportsUsedInFile: IgnoreExportsUsedInFile, type: SymbolType) => boolean | undefined;
21
21
  export declare function extractNamespaceMembers(decl: TSModuleDeclaration, options: GetImportsAndExportsOptions, lineStarts: number[], getJSDocTags: (start: number) => Set<string>, prefix?: string): ExportMember[];
22
+ export declare const collectAugmentationRefs: (node: TSModuleDeclaration) => string[];
22
23
  export declare function extractEnumMembers(decl: TSEnumDeclaration, options: GetImportsAndExportsOptions, lineStarts: number[], getJSDocTags: (start: number) => Set<string>): ExportMember[];