knip 6.26.0 → 6.28.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 (96) hide show
  1. package/dist/ConfigurationChief.d.ts +12 -0
  2. package/dist/DependencyDeputy.d.ts +1 -1
  3. package/dist/DependencyDeputy.js +3 -3
  4. package/dist/ProjectPrincipal.d.ts +3 -3
  5. package/dist/ProjectPrincipal.js +4 -4
  6. package/dist/WorkspaceWorker.js +9 -0
  7. package/dist/binaries/fallback.js +5 -1
  8. package/dist/binaries/resolvers/bun.js +13 -5
  9. package/dist/binaries/resolvers/npm.js +4 -2
  10. package/dist/binaries/resolvers/pnpm.js +11 -1
  11. package/dist/binaries/resolvers/yarn.js +10 -4
  12. package/dist/binaries/util.d.ts +4 -0
  13. package/dist/binaries/util.js +14 -0
  14. package/dist/compilers/index.d.ts +20 -0
  15. package/dist/compilers/less.js +1 -1
  16. package/dist/compilers/mdx.d.ts +2 -1
  17. package/dist/compilers/scss.js +1 -1
  18. package/dist/compilers/stylus.js +1 -1
  19. package/dist/constants.js +20 -0
  20. package/dist/graph/analyze.js +7 -5
  21. package/dist/graph/build.js +16 -4
  22. package/dist/graph-explorer/explorer.d.ts +1 -1
  23. package/dist/graph-explorer/operations/is-referenced.d.ts +1 -1
  24. package/dist/graph-explorer/operations/is-referenced.js +47 -33
  25. package/dist/manifest/index.d.ts +2 -1
  26. package/dist/plugins/_vue/auto-import.js +64 -4
  27. package/dist/plugins/_vue/types.d.ts +18 -11
  28. package/dist/plugins/angular/index.js +3 -0
  29. package/dist/plugins/babel/helpers.d.ts +9 -7
  30. package/dist/plugins/convex/index.js +11 -2
  31. package/dist/plugins/convex/types.d.ts +3 -0
  32. package/dist/plugins/convex/types.js +1 -0
  33. package/dist/plugins/github-actions/index.js +5 -2
  34. package/dist/plugins/index.d.ts +2 -0
  35. package/dist/plugins/index.js +4 -0
  36. package/dist/plugins/markdownlint/index.js +26 -5
  37. package/dist/plugins/markdownlint/types.d.ts +6 -0
  38. package/dist/plugins/nitro/index.js +3 -1
  39. package/dist/plugins/nuxt/index.js +19 -8
  40. package/dist/plugins/openclaw/index.d.ts +3 -0
  41. package/dist/plugins/openclaw/index.js +52 -0
  42. package/dist/plugins/openclaw/types.d.ts +25 -0
  43. package/dist/plugins/openclaw/types.js +1 -0
  44. package/dist/plugins/prettier/index.js +1 -1
  45. package/dist/plugins/react-email/index.js +1 -0
  46. package/dist/plugins/tailwind/compiler.js +9 -4
  47. package/dist/plugins/tailwind/index.js +8 -0
  48. package/dist/plugins/tanstack-router/index.js +3 -1
  49. package/dist/plugins/temporal/index.d.ts +3 -0
  50. package/dist/plugins/temporal/index.js +12 -0
  51. package/dist/plugins/tsdown/index.js +58 -3
  52. package/dist/plugins/tsdown/types.d.ts +4 -1
  53. package/dist/plugins/typescript/index.js +1 -1
  54. package/dist/plugins/vitest/index.js +15 -0
  55. package/dist/plugins/vitest/types.d.ts +5 -0
  56. package/dist/reporters/util/configuration-hints.js +3 -1
  57. package/dist/run.js +3 -3
  58. package/dist/schema/configuration.d.ts +30 -0
  59. package/dist/schema/plugins.d.ts +10 -0
  60. package/dist/schema/plugins.js +2 -0
  61. package/dist/types/PluginNames.d.ts +2 -2
  62. package/dist/types/PluginNames.js +2 -0
  63. package/dist/types/config.d.ts +1 -0
  64. package/dist/types/issues.d.ts +1 -1
  65. package/dist/typescript/ast-nodes.d.ts +4 -1
  66. package/dist/typescript/comments.d.ts +1 -1
  67. package/dist/typescript/comments.js +71 -5
  68. package/dist/typescript/get-imports-and-exports.d.ts +3 -1
  69. package/dist/typescript/get-imports-and-exports.js +9 -6
  70. package/dist/typescript/resolve-module-names.d.ts +2 -2
  71. package/dist/typescript/resolve-module-names.js +97 -18
  72. package/dist/typescript/visitors/walk.d.ts +3 -1
  73. package/dist/typescript/visitors/walk.js +27 -3
  74. package/dist/util/codeowners.js +1 -1
  75. package/dist/util/create-input-handler.js +8 -1
  76. package/dist/util/create-options.d.ts +20 -0
  77. package/dist/util/glob-cache.d.ts +7 -1
  78. package/dist/util/glob-cache.js +52 -29
  79. package/dist/util/glob-core.d.ts +2 -0
  80. package/dist/util/glob-core.js +46 -6
  81. package/dist/util/glob.d.ts +6 -3
  82. package/dist/util/glob.js +23 -9
  83. package/dist/util/loader.d.ts +3 -1
  84. package/dist/util/package-json.d.ts +7 -0
  85. package/dist/util/package-json.js +37 -0
  86. package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
  87. package/dist/util/parse-and-convert-gitignores.js +4 -4
  88. package/dist/util/reporter.js +4 -3
  89. package/dist/util/resolve.d.ts +1 -0
  90. package/dist/util/resolve.js +1 -1
  91. package/dist/util/to-source-path.d.ts +4 -3
  92. package/dist/util/to-source-path.js +22 -5
  93. package/dist/version.d.ts +1 -1
  94. package/dist/version.js +1 -1
  95. package/package.json +11 -11
  96. package/schema.json +8 -0
@@ -15,90 +15,104 @@ const hasOnlyNsRefs = (file) => {
15
15
  };
16
16
  export const isReferenced = (graph, entryPaths, filePath, id, options) => {
17
17
  const seen = new Set();
18
+ let isReferenced = false;
19
+ let reExportingEntryFile;
20
+ const hasCompleteResult = () => isReferenced && (options.traverseEntries || reExportingEntryFile !== undefined);
18
21
  const walkDown = (path, id, viaStar = false) => {
19
22
  const isEntryFile = entryPaths.has(path);
20
- let reExportingEntryFile = isEntryFile ? path : undefined;
23
+ if (isEntryFile && !reExportingEntryFile)
24
+ reExportingEntryFile = path;
25
+ if (hasCompleteResult())
26
+ return true;
21
27
  if (seen.has(path))
22
- return [false, reExportingEntryFile];
28
+ return false;
23
29
  seen.add(path);
24
30
  const restIds = id.split('.');
25
31
  const identifier = restIds.shift();
26
32
  if (options.treatStarAtEntryAsReferenced && isEntryFile && viaStar && restIds.length > 0) {
27
- return [true, reExportingEntryFile];
33
+ isReferenced = true;
34
+ return hasCompleteResult();
28
35
  }
29
36
  const file = graph.get(path)?.importedBy;
30
37
  if (!identifier || !file) {
31
- return [false, reExportingEntryFile];
38
+ return false;
32
39
  }
33
40
  const follow = (sources, nextId, nextViaStar = viaStar) => {
34
41
  for (const byFilePath of sources) {
35
- if (seen.has(byFilePath))
36
- continue;
37
- const result = walkDown(byFilePath, nextId, nextViaStar);
38
- if (result[1])
39
- reExportingEntryFile = result[1];
40
- if (result[0])
42
+ if (walkDown(byFilePath, nextId, nextViaStar))
41
43
  return true;
42
44
  }
43
45
  return false;
44
46
  };
45
- if ((file.import.get(OPAQUE) && !hasOnlyNsRefs(file)) ||
46
- ((identifier === id || (identifier !== id && file.refs.has(id))) &&
47
- (file.import.has(identifier) || file.importAs.has(identifier)))) {
48
- return [true, reExportingEntryFile];
47
+ if (!isReferenced) {
48
+ const hasDirectReference = (file.import.get(OPAQUE) && !hasOnlyNsRefs(file)) ||
49
+ ((identifier === id || (identifier !== id && file.refs.has(id))) &&
50
+ (file.import.has(identifier) || file.importAs.has(identifier)));
51
+ if (hasDirectReference) {
52
+ isReferenced = true;
53
+ if (hasCompleteResult())
54
+ return true;
55
+ }
49
56
  }
50
- for (const [exportId, aliases] of file.importAs) {
51
- if (identifier === exportId) {
52
- for (const alias of aliases.keys()) {
53
- const aliasedRef = [alias, ...restIds].join('.');
54
- if (file.refs.has(aliasedRef)) {
55
- return [true, reExportingEntryFile];
57
+ if (!isReferenced) {
58
+ aliasImports: for (const [exportId, aliases] of file.importAs) {
59
+ if (identifier === exportId) {
60
+ for (const alias of aliases.keys()) {
61
+ const aliasedRef = [alias, ...restIds].join('.');
62
+ if (file.refs.has(aliasedRef)) {
63
+ isReferenced = true;
64
+ break aliasImports;
65
+ }
56
66
  }
57
67
  }
58
68
  }
69
+ if (hasCompleteResult())
70
+ return true;
59
71
  }
60
72
  for (const namespace of file.importNs.keys()) {
61
- if (file.refs.has(`${namespace}.${id}`)) {
62
- return [true, reExportingEntryFile];
73
+ if (!isReferenced && file.refs.has(`${namespace}.${id}`)) {
74
+ isReferenced = true;
75
+ if (hasCompleteResult())
76
+ return true;
63
77
  }
64
78
  const nsAliasMap = getAliasReExportMap(file, namespace);
65
79
  if (nsAliasMap) {
66
80
  for (const [alias, sources] of nsAliasMap) {
67
81
  if (follow(sources, `${alias}.${id}`))
68
- return [true, reExportingEntryFile];
82
+ return true;
69
83
  }
70
84
  }
71
85
  const nsReExportSources = getNamespaceReExportSources(file, namespace);
72
86
  if (nsReExportSources) {
73
87
  if (follow(nsReExportSources, `${namespace}.${id}`))
74
- return [true, reExportingEntryFile];
88
+ return true;
75
89
  }
76
90
  }
77
91
  if (isEntryFile && !options.traverseEntries)
78
- return [false, reExportingEntryFile];
92
+ return false;
79
93
  const aliasMap = getAliasReExportMap(file, identifier);
80
94
  if (aliasMap) {
81
95
  for (const [alias, sources] of aliasMap) {
82
96
  if (follow(sources, [alias, ...restIds].join('.')))
83
- return [true, reExportingEntryFile];
97
+ return true;
84
98
  }
85
99
  }
86
100
  const directSources = getPassThroughReExportSources(file, identifier);
87
101
  const starSources = getStarReExportSources(file);
88
102
  if (directSources) {
89
103
  if (follow(directSources, id))
90
- return [true, reExportingEntryFile];
104
+ return true;
91
105
  }
92
106
  else if (starSources) {
93
107
  if (follow(starSources, id, true))
94
- return [true, reExportingEntryFile];
108
+ return true;
95
109
  }
96
110
  for (const [namespace, sources] of file.reExportNs) {
97
- if (follow(sources, `${namespace}.${id}`, true)) {
98
- return [true, reExportingEntryFile];
99
- }
111
+ if (follow(sources, `${namespace}.${id}`, true))
112
+ return true;
100
113
  }
101
- return [false, reExportingEntryFile];
114
+ return false;
102
115
  };
103
- return walkDown(filePath, id);
116
+ walkDown(filePath, id);
117
+ return [isReferenced, reExportingEntryFile];
104
118
  };
@@ -4,9 +4,10 @@ type Options = {
4
4
  dir: string;
5
5
  cwd: string;
6
6
  };
7
- export declare const getDependencyMetaData: ({ cwd, dir, packageNames }: Options) => {
7
+ declare const getMetaDataFromPackageJson: ({ cwd, dir, packageNames }: Options) => {
8
8
  hostDependencies: HostDependencies;
9
9
  installedBinaries: InstalledBinaries;
10
10
  hasTypesIncluded: Set<string>;
11
11
  };
12
+ export declare const getDependencyMetaData: typeof getMetaDataFromPackageJson;
12
13
  export {};
@@ -9,7 +9,26 @@ import { _syncGlob } from '../../util/glob.js';
9
9
  import { dirname, isInNodeModules, join } from '../../util/path.js';
10
10
  const getVueSfc = (cwd) => {
11
11
  try {
12
- return createRequire(join(cwd, 'package.json'))('vue/compiler-sfc');
12
+ const sfc = createRequire(join(cwd, 'package.json'))('vue/compiler-sfc');
13
+ if (typeof sfc.parseComponent === 'function') {
14
+ return {
15
+ parse: (source, path) => ({
16
+ descriptor: sfc.parse({ source, filename: path, sourceMap: false }),
17
+ }),
18
+ compileTemplate: (source, path, isTS, preprocessLang) => sfc.compileTemplate({
19
+ source,
20
+ filename: path,
21
+ sourceMap: false,
22
+ isProduction: true,
23
+ prettify: false,
24
+ isTS,
25
+ preprocessLang,
26
+ }),
27
+ };
28
+ }
29
+ return {
30
+ parse: (source, path) => sfc.parse(source, { filename: path, sourceMap: false }),
31
+ };
13
32
  }
14
33
  catch { }
15
34
  return {
@@ -40,11 +59,15 @@ const collectIdentifiers = (source, fileName) => {
40
59
  const collectTemplateInfo = (tree) => {
41
60
  const tags = new Set();
42
61
  const identifiers = new Set();
62
+ const visited = new Set();
43
63
  const addExprIdentifiers = (expr) => {
44
64
  for (const id of collectIdentifiers(expr, 'expr.ts'))
45
65
  identifiers.add(id);
46
66
  };
47
67
  const visit = (node) => {
68
+ if (visited.has(node))
69
+ return;
70
+ visited.add(node);
48
71
  if (node.tag)
49
72
  tags.add(node.tag);
50
73
  if (node.type === 5 && node.content && !node.content.isStatic)
@@ -62,10 +85,34 @@ const collectTemplateInfo = (tree) => {
62
85
  if (node.children)
63
86
  for (const child of node.children)
64
87
  visit(child);
88
+ if (node.ifConditions)
89
+ for (const condition of node.ifConditions)
90
+ visit(condition.block);
91
+ if (node.scopedSlots)
92
+ for (const name in node.scopedSlots)
93
+ visit(node.scopedSlots[name]);
65
94
  };
66
95
  visit(tree);
67
96
  return { tags, identifiers };
68
97
  };
98
+ const collectVue2TemplateIdentifiers = (source) => {
99
+ const identifiers = new Set();
100
+ const visitor = new Visitor({
101
+ MemberExpression(node) {
102
+ if (!node.computed &&
103
+ node.object.type === 'Identifier' &&
104
+ node.object.name === '_vm' &&
105
+ node.property.type === 'Identifier') {
106
+ const name = node.property.name;
107
+ if (name !== '_self' && name !== '$set' && name !== '$delete' && !(name.length === 2 && name[0] === '_')) {
108
+ identifiers.add(name);
109
+ }
110
+ }
111
+ },
112
+ });
113
+ visitor.visit(_parseFile('template.js', source).program);
114
+ return identifiers;
115
+ };
69
116
  const toKebabCase = (s) => s.replace(/[A-Z]/g, (m, i) => (i ? '-' : '') + m.toLowerCase());
70
117
  const isLocalSpecifier = (specifier) => specifier.startsWith('.') && !isInNodeModules(specifier);
71
118
  export const collectLocalImportPaths = (filePath, result) => {
@@ -182,20 +229,33 @@ const compileVueSfc = (source, path, maps, root) => {
182
229
  if (maps.importMap.size === 0 && maps.componentMap.size === 0) {
183
230
  return [scriptBodies(source, path), stylePreprocessorImports(source, path)].filter(Boolean).join(';\n');
184
231
  }
185
- const { descriptor } = sfcForRoot(root).parse(source, path);
232
+ const sfc = sfcForRoot(root);
233
+ const { descriptor } = sfc.parse(source, path);
186
234
  const scripts = [];
187
235
  if (descriptor.script?.content)
188
236
  scripts.push(descriptor.script.content);
189
237
  if (descriptor.scriptSetup?.content)
190
238
  scripts.push(descriptor.scriptSetup.content);
191
239
  const identifiers = scripts.length === 0 ? new Set() : collectIdentifiers(scripts.join('\n'), path);
240
+ const template = descriptor.template;
241
+ const compiled = template && !template.ast && sfc.compileTemplate
242
+ ? sfc.compileTemplate(template.content, path, descriptor.script?.lang === 'ts' ||
243
+ descriptor.script?.lang === 'tsx' ||
244
+ descriptor.scriptSetup?.lang === 'ts' ||
245
+ descriptor.scriptSetup?.lang === 'tsx', template.lang)
246
+ : undefined;
192
247
  let templateTags;
193
- if (descriptor.template?.ast) {
194
- const info = collectTemplateInfo(descriptor.template.ast);
248
+ const templateAst = template?.ast ?? compiled?.ast;
249
+ if (templateAst) {
250
+ const info = collectTemplateInfo(templateAst);
195
251
  templateTags = info.tags;
196
252
  for (const id of info.identifiers)
197
253
  identifiers.add(id);
198
254
  }
255
+ if (compiled?.code) {
256
+ for (const id of collectVue2TemplateIdentifiers(compiled.code))
257
+ identifiers.add(id);
258
+ }
199
259
  scripts.push(...getSyntheticImports(maps, identifiers, templateTags));
200
260
  const styles = stylePreprocessorImports(source, path);
201
261
  if (styles)
@@ -13,24 +13,31 @@ export interface TemplateAstNode {
13
13
  props?: TemplateAstProp[];
14
14
  content?: TemplateExpressionNode;
15
15
  children?: TemplateAstNode[];
16
+ ifConditions?: {
17
+ block: TemplateAstNode;
18
+ }[];
19
+ scopedSlots?: Record<string, TemplateAstNode>;
20
+ }
21
+ interface DescriptorBlock {
22
+ content: string;
23
+ lang?: string;
16
24
  }
17
25
  interface Descriptor {
18
- script: {
19
- content: string;
20
- } | null;
21
- scriptSetup: {
22
- content: string;
23
- } | null;
24
- template: {
25
- content: string;
26
+ script: DescriptorBlock | null;
27
+ scriptSetup: DescriptorBlock | null;
28
+ template: (DescriptorBlock & {
26
29
  ast?: TemplateAstNode;
27
- } | null;
30
+ }) | null;
28
31
  }
29
- export type VueSfc = {
32
+ export interface VueSfc {
30
33
  parse: (source: string, path: string) => {
31
34
  descriptor: Descriptor;
32
35
  };
33
- };
36
+ compileTemplate?: (source: string, path: string, isTS: boolean, preprocessLang?: string) => {
37
+ ast?: TemplateAstNode;
38
+ code: string;
39
+ };
40
+ }
34
41
  export interface AutoImportMaps {
35
42
  importMap: Map<string, string>;
36
43
  componentMap: Map<string, string[]>;
@@ -84,6 +84,9 @@ const entriesByOption = (opts) => new Map(Object.entries({
84
84
  scripts: 'scripts' in opts && opts.scripts && Array.isArray(opts.scripts)
85
85
  ? opts.scripts.map(scriptStringOrObject => typeof scriptStringOrObject === 'string' ? scriptStringOrObject : scriptStringOrObject.input)
86
86
  : [],
87
+ styles: 'styles' in opts && opts.styles && Array.isArray(opts.styles)
88
+ ? opts.styles.map(styleStringOrObject => typeof styleStringOrObject === 'string' ? styleStringOrObject : styleStringOrObject.input)
89
+ : [],
87
90
  polyfills: 'polyfills' in opts && opts.polyfills
88
91
  ? Array.isArray(opts.polyfills)
89
92
  ? opts.polyfills
@@ -1,14 +1,16 @@
1
1
  export declare const resolveName: (identifier: string, namespace: 'preset' | 'plugin') => string;
2
+ declare const cacheFn: {
3
+ (): undefined;
4
+ forever: () => any;
5
+ never: () => any;
6
+ using: () => any;
7
+ invalidate: () => any;
8
+ };
2
9
  export declare const api: {
3
10
  assertVersion: () => boolean;
4
- cache: {
5
- (): undefined;
6
- forever: () => any;
7
- never: () => any;
8
- using: () => any;
9
- invalidate: () => any;
10
- };
11
+ cache: typeof cacheFn;
11
12
  caller: () => boolean;
12
13
  env: (env?: string) => "development" | true;
13
14
  version: string;
14
15
  };
16
+ export {};
@@ -1,12 +1,21 @@
1
+ import { toProductionEntry } from '../../util/input.js';
2
+ import { join } from '../../util/path.js';
1
3
  import { hasDependency } from '../../util/plugin.js';
2
4
  const title = 'Convex';
3
5
  const enablers = ['convex'];
4
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
- const entry = ['convex/*.config.@(js|ts)', 'convex/**/_generated/*.@(js|ts)'];
7
+ const config = ['convex.json'];
8
+ const production = ['convex/**/*.@(js|ts)'];
9
+ const resolveConfig = localConfig => {
10
+ const functionsDir = typeof localConfig.functions === 'string' ? localConfig.functions : 'convex';
11
+ return [toProductionEntry(join(functionsDir, '**/*.@(js|ts)'))];
12
+ };
6
13
  const plugin = {
7
14
  title,
8
15
  enablers,
9
16
  isEnabled,
10
- entry,
17
+ config,
18
+ production,
19
+ resolveConfig,
11
20
  };
12
21
  export default plugin;
@@ -0,0 +1,3 @@
1
+ export interface ConvexConfig {
2
+ functions?: string;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -17,8 +17,9 @@ export const getActionDependencies = (config, options) => {
17
17
  const scripts = [runs.pre, runs.main, runs.post].filter(isString);
18
18
  return scripts.map(script => join(configFileDir, script));
19
19
  };
20
+ const ACTION_PATH_VAR = /\$\{\{\s*github\.action_path\s*\}\}|\$\{GITHUB_ACTION_PATH\}|\$GITHUB_ACTION_PATH/g;
20
21
  const resolveConfig = async (config, options) => {
21
- const { rootCwd, getInputsFromScripts, isProduction, getManifest } = options;
22
+ const { rootCwd, getInputsFromScripts, isProduction, getManifest, configFileDir } = options;
22
23
  const inputs = new Set();
23
24
  const jobs = findByKeyDeep(config, 'steps');
24
25
  for (const steps of jobs) {
@@ -31,7 +32,9 @@ const resolveConfig = async (config, options) => {
31
32
  const dir = join(rootCwd, path && workingDir ? relative(workingDir, path) : workingDir ? workingDir : '.');
32
33
  if (step.run) {
33
34
  const manifest = getManifest(dir) ?? options.manifest;
34
- for (const input of getInputsFromScripts([step.run], { knownBinsOnly: true, manifest })) {
35
+ const actionPath = relative(dir, configFileDir);
36
+ const run = step.run.replace(ACTION_PATH_VAR, actionPath ? `./${actionPath}` : '.');
37
+ for (const input of getInputsFromScripts([run], { knownBinsOnly: true, manifest })) {
35
38
  if (isDeferResolveEntry(input) && path && !workingDir) {
36
39
  input.specifier = relative(join(dir, path), join(rootCwd, input.specifier));
37
40
  }
@@ -87,6 +87,7 @@ export declare const Plugins: {
87
87
  nyc: import("../types/config.ts").Plugin;
88
88
  oclif: import("../types/config.ts").Plugin;
89
89
  'openapi-ts': import("../types/config.ts").Plugin;
90
+ openclaw: import("../types/config.ts").Plugin;
90
91
  orval: import("../types/config.ts").Plugin;
91
92
  oxfmt: import("../types/config.ts").Plugin;
92
93
  oxlint: import("../types/config.ts").Plugin;
@@ -144,6 +145,7 @@ export declare const Plugins: {
144
145
  'tanstack-router': import("../types/config.ts").Plugin;
145
146
  taskfile: import("../types/config.ts").Plugin;
146
147
  tauri: import("../types/config.ts").Plugin;
148
+ temporal: import("../types/config.ts").Plugin;
147
149
  travis: import("../types/config.ts").Plugin;
148
150
  'ts-node': import("../types/config.ts").Plugin;
149
151
  tsdown: import("../types/config.ts").Plugin;
@@ -81,6 +81,7 @@ import { default as nx } from './nx/index.js';
81
81
  import { default as nyc } from './nyc/index.js';
82
82
  import { default as oclif } from './oclif/index.js';
83
83
  import { default as openapiTs } from './openapi-ts/index.js';
84
+ import { default as openclaw } from './openclaw/index.js';
84
85
  import { default as orval } from './orval/index.js';
85
86
  import { default as oxfmt } from './oxfmt/index.js';
86
87
  import { default as oxlint } from './oxlint/index.js';
@@ -138,6 +139,7 @@ import { default as tailwind } from './tailwind/index.js';
138
139
  import { default as tanstackRouter } from './tanstack-router/index.js';
139
140
  import { default as taskfile } from './taskfile/index.js';
140
141
  import { default as tauri } from './tauri/index.js';
142
+ import { default as temporal } from './temporal/index.js';
141
143
  import { default as travis } from './travis/index.js';
142
144
  import { default as tsNode } from './ts-node/index.js';
143
145
  import { default as tsdown } from './tsdown/index.js';
@@ -258,6 +260,7 @@ export const Plugins = {
258
260
  nyc,
259
261
  oclif,
260
262
  'openapi-ts': openapiTs,
263
+ openclaw,
261
264
  orval,
262
265
  oxfmt,
263
266
  oxlint,
@@ -315,6 +318,7 @@ export const Plugins = {
315
318
  'tanstack-router': tanstackRouter,
316
319
  taskfile,
317
320
  tauri,
321
+ temporal,
318
322
  travis,
319
323
  'ts-node': tsNode,
320
324
  tsdown,
@@ -2,19 +2,40 @@ import { toDependency } from '../../util/input.js';
2
2
  import { hasDependency } from '../../util/plugin.js';
3
3
  import { getArgumentValues } from './helpers.js';
4
4
  const title = 'markdownlint';
5
- const enablers = ['markdownlint-cli'];
5
+ const enablers = ['markdownlint-cli', 'markdownlint-cli2'];
6
6
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
7
- const config = ['.markdownlint.{json,jsonc}', '.markdownlint.{yml,yaml}'];
7
+ const isBundled = (specifier) => specifier.startsWith('markdownlint/style/') || specifier === 'markdownlint-cli2-formatter-default';
8
+ const config = ['.markdownlint-cli2.{jsonc,yaml,cjs,mjs}', '.markdownlint.{json,jsonc,yaml,yml,cjs,mjs}'];
8
9
  const resolveConfig = (config, options) => {
9
10
  const { manifest } = options;
10
- const extend = config?.extends ? [config.extends] : [];
11
+ const dependencies = [];
12
+ for (const extend of [config?.extends, config?.config?.extends]) {
13
+ if (extend)
14
+ dependencies.push(extend);
15
+ }
16
+ for (const customRule of config?.customRules ?? []) {
17
+ if (typeof customRule === 'string')
18
+ dependencies.push(customRule);
19
+ else if (Array.isArray(customRule)) {
20
+ for (const rule of customRule) {
21
+ if (typeof rule === 'string')
22
+ dependencies.push(rule);
23
+ }
24
+ }
25
+ }
26
+ for (const modules of [config?.markdownItPlugins, config?.outputFormatters]) {
27
+ for (const module of modules ?? []) {
28
+ if (Array.isArray(module) && typeof module[0] === 'string')
29
+ dependencies.push(module[0]);
30
+ }
31
+ }
11
32
  const scripts = manifest?.scripts
12
33
  ? Object.values(manifest.scripts).filter((script) => typeof script === 'string')
13
34
  : [];
14
35
  const uses = scripts
15
- .filter(script => script.includes('markdownlint '))
36
+ .filter(script => script.includes('markdownlint ') || script.includes('markdownlint-cli2 '))
16
37
  .flatMap(script => getArgumentValues(script, / (--rules|-r)[ =]([^ ]+)/g));
17
- return [...extend, ...uses].map(id => toDependency(id));
38
+ return [...dependencies, ...uses].filter(id => !isBundled(id)).map(id => toDependency(id));
18
39
  };
19
40
  const plugin = {
20
41
  title,
@@ -1,3 +1,9 @@
1
1
  export type MarkdownlintConfig = {
2
+ config?: {
3
+ extends?: string;
4
+ };
5
+ customRules?: unknown[];
2
6
  extends?: string;
7
+ markdownItPlugins?: unknown[];
8
+ outputFormatters?: unknown[];
3
9
  };
@@ -1,4 +1,4 @@
1
- import { toDependency, toProductionEntry } from '../../util/input.js';
1
+ import { toDependency, toIgnore, toProductionEntry } from '../../util/input.js';
2
2
  import { join } from '../../util/path.js';
3
3
  import { hasDependency } from '../../util/plugin.js';
4
4
  const title = 'Nitro';
@@ -22,6 +22,7 @@ const setup = async () => {
22
22
  });
23
23
  }
24
24
  };
25
+ const resolve = () => [toIgnore('^#nitro-internal-', 'unresolved')];
25
26
  const resolveConfig = async (localConfig) => {
26
27
  const srcDir = localConfig.srcDir ?? '.';
27
28
  const patterns = [
@@ -53,6 +54,7 @@ const plugin = {
53
54
  config,
54
55
  production,
55
56
  setup,
57
+ resolve,
56
58
  resolveConfig,
57
59
  };
58
60
  export default plugin;
@@ -1,8 +1,8 @@
1
1
  import { isDirectory } from '../../util/fs.js';
2
2
  import { _syncGlob } from '../../util/glob.js';
3
- import { toAlias, toConfig, toDeferResolveProductionEntry, toDependency, toEntry, toIgnore, toProductionEntry, } from '../../util/input.js';
3
+ import { toAlias, toConfig, toDeferResolveProductionEntry, toDependency, toEntry, toIgnore, toProductionDependency, toProductionEntry, } from '../../util/input.js';
4
4
  import { loadTSConfig } from '../../util/load-tsconfig.js';
5
- import { join } from '../../util/path.js';
5
+ import { isInternal, join, toAbsolute } from '../../util/path.js';
6
6
  import { hasDependency } from '../../util/plugin.js';
7
7
  import { buildAutoImportMap, collectLocalImportPaths, createAutoImportMaps, createTsCompiler, createVueCompiler, readAndParseFile, } from '../_vue/auto-import.js';
8
8
  const title = 'Nuxt';
@@ -35,6 +35,13 @@ const setup = async () => {
35
35
  });
36
36
  }
37
37
  };
38
+ const resolve = () => [
39
+ toIgnore('^#build/', 'unresolved'),
40
+ toIgnore('#components', 'unresolved'),
41
+ toIgnore('#imports', 'unresolved'),
42
+ toIgnore('^#internal/', 'unresolved'),
43
+ toIgnore('#spa-template', 'unresolved'),
44
+ ];
38
45
  const resolveAlias = (specifier, srcDir, rootDir) => {
39
46
  if (specifier.startsWith('~~/') || specifier.startsWith('@@/'))
40
47
  return join(rootDir, specifier.slice(3));
@@ -80,14 +87,18 @@ const registerCompilers = async ({ cwd, hasDependency, registerCompiler }) => {
80
87
  const resolveConfig = async (localConfig, options) => {
81
88
  const { configFileDir: cwd } = options;
82
89
  const hasAppDir = isDirectory(cwd, 'app');
83
- const srcDir = localConfig.srcDir ?? (hasAppDir ? join(cwd, 'app') : cwd);
90
+ const srcDir = toAbsolute(localConfig.srcDir ?? (hasAppDir ? join(cwd, 'app') : cwd), cwd);
84
91
  const serverDir = localConfig.serverDir ?? 'server';
85
92
  const inputs = [];
93
+ const addModule = (id) => {
94
+ const specifier = resolveAlias(id, srcDir, cwd);
95
+ inputs.push(isInternal(specifier) ? toDeferResolveProductionEntry(specifier) : toProductionDependency(specifier));
96
+ };
86
97
  for (const id of localConfig.modules ?? []) {
87
98
  if (Array.isArray(id) && typeof id[0] === 'string')
88
- inputs.push(toDependency(id[0]));
99
+ addModule(id[0]);
89
100
  if (typeof id === 'string')
90
- inputs.push(toDependency(id));
101
+ addModule(id);
91
102
  }
92
103
  addAppEntries(inputs, srcDir, serverDir, localConfig, cwd);
93
104
  const aliases = localConfig.alias;
@@ -101,7 +112,8 @@ const resolveConfig = async (localConfig, options) => {
101
112
  }
102
113
  }
103
114
  for (const ext of localConfig.extends ?? []) {
104
- const resolved = resolveAlias(ext, srcDir, cwd);
115
+ const target = resolveAlias(ext, srcDir, cwd);
116
+ const resolved = isInternal(target) ? toAbsolute(target, cwd) : target;
105
117
  const configs = _syncGlob({ cwd: resolved, patterns: config });
106
118
  if (configs.length > 0)
107
119
  for (const cfg of configs)
@@ -129,8 +141,6 @@ const resolveConfig = async (localConfig, options) => {
129
141
  inputs.push(toAlias(key, paths[key], { dir }));
130
142
  }
131
143
  }
132
- inputs.push(toIgnore('#imports', 'unresolved'));
133
- inputs.push(toIgnore('#components', 'unresolved'));
134
144
  return inputs;
135
145
  };
136
146
  const plugin = {
@@ -141,6 +151,7 @@ const plugin = {
141
151
  entry,
142
152
  production,
143
153
  setup,
154
+ resolve,
144
155
  resolveConfig,
145
156
  registerCompilers,
146
157
  };
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../types/config.ts';
2
+ declare const plugin: Plugin;
3
+ export default plugin;