knip 6.24.0 → 6.26.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.
- package/dist/ConfigurationChief.d.ts +115 -1
- package/dist/ConfigurationChief.js +3 -0
- package/dist/ProjectPrincipal.d.ts +2 -0
- package/dist/ProjectPrincipal.js +4 -1
- package/dist/binaries/bash-parser.js +55 -83
- package/dist/binaries/index.js +3 -0
- package/dist/compilers/index.d.ts +199 -5
- package/dist/constants.d.ts +5 -1
- package/dist/constants.js +18 -0
- package/dist/graph/analyze.js +37 -2
- package/dist/graph/build.js +17 -3
- package/dist/graph-explorer/explorer.d.ts +1 -0
- package/dist/graph-explorer/explorer.js +2 -0
- package/dist/graph-explorer/operations/find-all-cycles.d.ts +3 -0
- package/dist/graph-explorer/operations/find-all-cycles.js +43 -0
- package/dist/graph-explorer/operations/find-cycles.js +3 -9
- package/dist/graph-explorer/utils.d.ts +10 -1
- package/dist/graph-explorer/utils.js +53 -0
- package/dist/plugins/_vue/auto-import.d.ts +12 -0
- package/dist/plugins/_vue/auto-import.js +272 -0
- package/dist/plugins/_vue/types.d.ts +38 -0
- package/dist/plugins/_vue/types.js +1 -0
- package/dist/plugins/astro/index.js +2 -37
- package/dist/plugins/astro/resolveFromAST.d.ts +4 -4
- package/dist/plugins/astro/resolveFromAST.js +34 -7
- package/dist/plugins/bun/index.js +28 -14
- package/dist/plugins/electron-vite/index.d.ts +3 -0
- package/dist/plugins/electron-vite/index.js +51 -0
- package/dist/plugins/electron-vite/types.d.ts +23 -0
- package/dist/plugins/electron-vite/types.js +1 -0
- package/dist/plugins/esbuild/index.d.ts +3 -0
- package/dist/plugins/esbuild/index.js +17 -0
- package/dist/plugins/eslint/resolveFromAST.js +18 -21
- package/dist/plugins/eve/index.d.ts +3 -0
- package/dist/plugins/eve/index.js +22 -0
- package/dist/plugins/execa/visitors/execa.js +10 -18
- package/dist/plugins/fumadocs/index.d.ts +3 -0
- package/dist/plugins/fumadocs/index.js +18 -0
- package/dist/plugins/graphql-codegen/index.js +9 -7
- package/dist/plugins/index.d.ts +19 -0
- package/dist/plugins/index.js +38 -0
- package/dist/plugins/jest/index.js +13 -3
- package/dist/plugins/laravel-vite-plugin/index.d.ts +3 -0
- package/dist/plugins/laravel-vite-plugin/index.js +14 -0
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.d.ts +2 -0
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +27 -0
- package/dist/plugins/next/index.js +25 -12
- package/dist/plugins/next-mdx/index.js +2 -8
- package/dist/plugins/next-mdx/resolveFromAST.d.ts +3 -2
- package/dist/plugins/next-mdx/resolveFromAST.js +17 -21
- package/dist/plugins/node/index.js +4 -1
- package/dist/plugins/nuxt/index.js +5 -68
- package/dist/plugins/nuxt/types.d.ts +0 -34
- package/dist/plugins/nuxtjs-i18n/index.d.ts +3 -0
- package/dist/plugins/nuxtjs-i18n/index.js +12 -0
- package/dist/plugins/oclif/index.js +10 -5
- package/dist/plugins/orval/index.js +1 -3
- package/dist/plugins/orval/resolveFromAST.d.ts +2 -2
- package/dist/plugins/orval/resolveFromAST.js +4 -7
- package/dist/plugins/oxlint/index.js +23 -2
- package/dist/plugins/pnpm/index.js +22 -1
- package/dist/plugins/pnpm/types.d.ts +4 -0
- package/dist/plugins/pnpm/types.js +1 -0
- package/dist/plugins/prettier/index.js +19 -3
- package/dist/plugins/prettier/types.d.ts +6 -1
- package/dist/plugins/quasar/index.d.ts +3 -0
- package/dist/plugins/quasar/index.js +15 -0
- package/dist/plugins/quasar/resolveFromAST.d.ts +3 -0
- package/dist/plugins/quasar/resolveFromAST.js +63 -0
- package/dist/plugins/qwik/index.js +1 -25
- package/dist/plugins/qwik/resolveFromAST.d.ts +5 -3
- package/dist/plugins/qwik/resolveFromAST.js +28 -9
- package/dist/plugins/rolldown/index.js +2 -5
- package/dist/plugins/rollup/index.js +2 -5
- package/dist/plugins/rslib/index.js +2 -5
- package/dist/plugins/rspack/index.js +5 -0
- package/dist/plugins/serverless-framework/index.js +12 -1
- package/dist/plugins/serverless-framework/types.d.ts +5 -2
- package/dist/plugins/sst/index.js +1 -5
- package/dist/plugins/sst/resolveFromAST.d.ts +1 -1
- package/dist/plugins/sst/resolveFromAST.js +1 -1
- package/dist/plugins/starlight/index.js +1 -19
- package/dist/plugins/starlight/resolveFromAST.d.ts +2 -2
- package/dist/plugins/starlight/resolveFromAST.js +12 -8
- package/dist/plugins/stencil/index.js +2 -37
- package/dist/plugins/stencil/resolveFromAST.d.ts +3 -0
- package/dist/plugins/stencil/resolveFromAST.js +36 -0
- package/dist/plugins/storybook/index.js +10 -0
- package/dist/plugins/sveltekit/index.js +1 -48
- package/dist/plugins/sveltekit/resolveFromAST.d.ts +2 -0
- package/dist/plugins/sveltekit/resolveFromAST.js +45 -0
- package/dist/plugins/tauri/index.d.ts +3 -0
- package/dist/plugins/tauri/index.js +42 -0
- package/dist/plugins/tauri/types.d.ts +16 -0
- package/dist/plugins/tauri/types.js +1 -0
- package/dist/plugins/tsdown/index.js +2 -5
- package/dist/plugins/tsup/index.js +2 -5
- package/dist/plugins/typedoc/index.js +9 -3
- package/dist/plugins/typedoc/types.d.ts +2 -0
- package/dist/plugins/unplugin-auto-import/index.d.ts +3 -0
- package/dist/plugins/unplugin-auto-import/index.js +18 -0
- package/dist/plugins/unplugin-icons/index.d.ts +3 -0
- package/dist/plugins/unplugin-icons/index.js +17 -0
- package/dist/plugins/unplugin-vue-components/index.d.ts +3 -0
- package/dist/plugins/unplugin-vue-components/index.js +16 -0
- package/dist/plugins/unplugin-vue-i18n/index.d.ts +3 -0
- package/dist/plugins/unplugin-vue-i18n/index.js +10 -0
- package/dist/plugins/unplugin-vue-markdown/index.d.ts +3 -0
- package/dist/plugins/unplugin-vue-markdown/index.js +16 -0
- package/dist/plugins/unplugin-vue-router/index.d.ts +3 -0
- package/dist/plugins/unplugin-vue-router/index.js +14 -0
- package/dist/plugins/vite/helpers.d.ts +2 -0
- package/dist/plugins/vite/helpers.js +46 -31
- package/dist/plugins/vite/index.js +1 -1
- package/dist/plugins/vite/visitors/importMetaGlob.js +1 -8
- package/dist/plugins/vite-plugin-pages/index.d.ts +3 -0
- package/dist/plugins/vite-plugin-pages/index.js +26 -0
- package/dist/plugins/vite-plugin-pwa/index.d.ts +3 -0
- package/dist/plugins/vite-plugin-pwa/index.js +17 -0
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.d.ts +4 -0
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +37 -0
- package/dist/plugins/vite-plugin-vue-layouts-next/index.d.ts +3 -0
- package/dist/plugins/vite-plugin-vue-layouts-next/index.js +23 -0
- package/dist/plugins/vite-plus/index.d.ts +3 -0
- package/dist/plugins/vite-plus/index.js +14 -0
- package/dist/plugins/vite-plus/resolveFromAST.d.ts +2 -0
- package/dist/plugins/vite-plus/resolveFromAST.js +37 -0
- package/dist/plugins/vite-pwa-assets-generator/index.d.ts +3 -0
- package/dist/plugins/vite-pwa-assets-generator/index.js +12 -0
- package/dist/plugins/vitepress/index.js +5 -1
- package/dist/plugins/vitest/index.js +4 -0
- package/dist/plugins/vitest/types.d.ts +3 -0
- package/dist/plugins/vue/index.js +5 -3
- package/dist/plugins/webpack/visitors/requireContext.js +2 -13
- package/dist/plugins/yarn/index.js +14 -4
- package/dist/plugins/yarn/types.d.ts +8 -0
- package/dist/plugins/yarn/types.js +1 -0
- package/dist/plugins/zx/visitors/zx.js +4 -4
- package/dist/reporters/cycles.d.ts +3 -0
- package/dist/reporters/cycles.js +79 -0
- package/dist/reporters/index.d.ts +1 -0
- package/dist/reporters/index.js +2 -0
- package/dist/reporters/json.d.ts +3 -0
- package/dist/reporters/json.js +2 -1
- package/dist/reporters/util/util.d.ts +3 -1
- package/dist/reporters/util/util.js +5 -1
- package/dist/schema/configuration.d.ts +295 -6
- package/dist/schema/configuration.js +6 -0
- package/dist/schema/plugins.d.ts +95 -0
- package/dist/schema/plugins.js +19 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +19 -0
- package/dist/types/config.d.ts +9 -0
- package/dist/types/issues.d.ts +3 -0
- package/dist/types/module-graph.d.ts +7 -0
- package/dist/types/package-json.d.ts +8 -1
- package/dist/typescript/ast-helpers.d.ts +7 -2
- package/dist/typescript/ast-helpers.js +36 -8
- package/dist/typescript/ast-nodes.d.ts +4 -1
- package/dist/typescript/ast-nodes.js +17 -1
- package/dist/typescript/get-imports-and-exports.js +10 -0
- package/dist/typescript/glob-imports.d.ts +3 -0
- package/dist/typescript/glob-imports.js +49 -0
- package/dist/typescript/resolve-module-names.d.ts +2 -0
- package/dist/typescript/resolve-module-names.js +35 -1
- package/dist/typescript/visitors/calls.js +4 -6
- package/dist/typescript/visitors/imports.js +8 -8
- package/dist/typescript/visitors/script-visitors.js +4 -4
- package/dist/typescript/visitors/walk.js +2 -3
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +5 -3
- package/dist/util/create-options.d.ts +202 -5
- package/dist/util/create-options.js +4 -1
- package/dist/util/get-included-issue-types.d.ts +1 -0
- package/dist/util/get-included-issue-types.js +4 -2
- package/dist/util/issue-initializers.js +1 -1
- package/dist/util/load-tsconfig.js +17 -4
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.js +25 -4
- package/dist/util/resolve.js +4 -1
- package/dist/util/scripts.d.ts +7 -0
- package/dist/util/scripts.js +75 -0
- package/dist/util/to-source-path.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +108 -1
- package/dist/plugins/next/resolveFromAST.d.ts +0 -2
- package/dist/plugins/next/resolveFromAST.js +0 -2
- package/dist/plugins/nuxt/helpers.d.ts +0 -15
- package/dist/plugins/nuxt/helpers.js +0 -133
- package/dist/plugins/rolldown/resolveFromAST.d.ts +0 -2
- package/dist/plugins/rolldown/resolveFromAST.js +0 -4
- package/dist/plugins/rollup/resolveFromAST.d.ts +0 -2
- package/dist/plugins/rollup/resolveFromAST.js +0 -4
- package/dist/plugins/rslib/resolveFromAST.d.ts +0 -2
- package/dist/plugins/rslib/resolveFromAST.js +0 -4
- package/dist/plugins/tsdown/resolveFromAST.d.ts +0 -2
- package/dist/plugins/tsdown/resolveFromAST.js +0 -4
- package/dist/plugins/tsup/resolveFromAST.d.ts +0 -2
- package/dist/plugins/tsup/resolveFromAST.js +0 -4
- package/dist/plugins/vue/compiler.d.ts +0 -3
- package/dist/plugins/vue/compiler.js +0 -10
|
@@ -87,7 +87,7 @@ export const getToSourcePathsHandler = (chief) => {
|
|
|
87
87
|
const mapped = ws?.sourceMaps && rewritePattern(ws.sourceMaps, absSpecifier, extensions);
|
|
88
88
|
patterns.add(mapped ?? absSpecifier);
|
|
89
89
|
}
|
|
90
|
-
const filePaths = await _glob({ patterns: Array.from(patterns), cwd: dir, label });
|
|
90
|
+
const filePaths = await _glob({ patterns: Array.from(patterns), cwd: chief.cwd, dir, label });
|
|
91
91
|
debugLogArray(toRelative(dir, chief.cwd), 'Source mapping (package.json)', filePaths);
|
|
92
92
|
return filePaths;
|
|
93
93
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.26.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.26.0';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -67,6 +67,33 @@
|
|
|
67
67
|
"$ref": "#/definitions/issueTypes"
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
+
"cycles": {
|
|
71
|
+
"title": "Configure circular dependency (cycles) detection",
|
|
72
|
+
"examples": [
|
|
73
|
+
{
|
|
74
|
+
"dynamicImports": true,
|
|
75
|
+
"allow": [["src/a.ts", "src/b.ts"]]
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"properties": {
|
|
81
|
+
"dynamicImports": {
|
|
82
|
+
"title": "Include dynamic import() edges in cycle detection (excluded by default)",
|
|
83
|
+
"type": "boolean"
|
|
84
|
+
},
|
|
85
|
+
"allow": {
|
|
86
|
+
"title": "Allow (accept) specific cycles by exact path, relative to the root and omitting the closing repeat of the first file",
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": {
|
|
89
|
+
"type": "array",
|
|
90
|
+
"items": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
70
97
|
"includeEntryExports": {
|
|
71
98
|
"$ref": "#/definitions/includeEntryExports"
|
|
72
99
|
},
|
|
@@ -99,6 +126,9 @@
|
|
|
99
126
|
"catalog": {
|
|
100
127
|
"$ref": "#/definitions/ruleValue"
|
|
101
128
|
},
|
|
129
|
+
"cycles": {
|
|
130
|
+
"$ref": "#/definitions/ruleValue"
|
|
131
|
+
},
|
|
102
132
|
"dependencies": {
|
|
103
133
|
"$ref": "#/definitions/ruleValue"
|
|
104
134
|
},
|
|
@@ -251,7 +281,8 @@
|
|
|
251
281
|
"duplicates",
|
|
252
282
|
"enumMembers",
|
|
253
283
|
"namespaceMembers",
|
|
254
|
-
"catalog"
|
|
284
|
+
"catalog",
|
|
285
|
+
"cycles"
|
|
255
286
|
]
|
|
256
287
|
}
|
|
257
288
|
},
|
|
@@ -475,14 +506,26 @@
|
|
|
475
506
|
"title": "Drizzle plugin configuration (https://knip.dev/reference/plugins/drizzle)",
|
|
476
507
|
"$ref": "#/definitions/plugin"
|
|
477
508
|
},
|
|
509
|
+
"electron-vite": {
|
|
510
|
+
"title": "electron-vite plugin configuration (https://knip.dev/reference/plugins/electron-vite)",
|
|
511
|
+
"$ref": "#/definitions/plugin"
|
|
512
|
+
},
|
|
478
513
|
"eleventy": {
|
|
479
514
|
"title": "eleventy plugin configuration (https://knip.dev/reference/plugins/eleventy)",
|
|
480
515
|
"$ref": "#/definitions/plugin"
|
|
481
516
|
},
|
|
517
|
+
"esbuild": {
|
|
518
|
+
"title": "esbuild plugin configuration (https://knip.dev/reference/plugins/esbuild)",
|
|
519
|
+
"$ref": "#/definitions/plugin"
|
|
520
|
+
},
|
|
482
521
|
"eslint": {
|
|
483
522
|
"title": "ESLint plugin configuration (https://knip.dev/reference/plugins/eslint)",
|
|
484
523
|
"$ref": "#/definitions/plugin"
|
|
485
524
|
},
|
|
525
|
+
"eve": {
|
|
526
|
+
"title": "eve plugin configuration (https://knip.dev/reference/plugins/eve)",
|
|
527
|
+
"$ref": "#/definitions/plugin"
|
|
528
|
+
},
|
|
486
529
|
"execa": {
|
|
487
530
|
"title": "execa plugin configuration (https://knip.dev/reference/plugins/execa)",
|
|
488
531
|
"$ref": "#/definitions/plugin"
|
|
@@ -499,6 +542,10 @@
|
|
|
499
542
|
"title": "fast plugin configuration (https://knip.dev/reference/plugins/fast)",
|
|
500
543
|
"$ref": "#/definitions/plugin"
|
|
501
544
|
},
|
|
545
|
+
"fumadocs": {
|
|
546
|
+
"title": "fumadocs plugin configuration (https://knip.dev/reference/plugins/fumadocs)",
|
|
547
|
+
"$ref": "#/definitions/plugin"
|
|
548
|
+
},
|
|
502
549
|
"gatsby": {
|
|
503
550
|
"title": "Gatsby plugin configuration (https://knip.dev/reference/plugins/gatsby)",
|
|
504
551
|
"$ref": "#/definitions/plugin"
|
|
@@ -543,6 +590,10 @@
|
|
|
543
590
|
"title": "ladle plugin configuration (https://knip.dev/reference/plugins/ladle)",
|
|
544
591
|
"$ref": "#/definitions/plugin"
|
|
545
592
|
},
|
|
593
|
+
"laravel-vite-plugin": {
|
|
594
|
+
"title": "laravel-vite-plugin plugin configuration (https://knip.dev/reference/plugins/laravel-vite-plugin)",
|
|
595
|
+
"$ref": "#/definitions/plugin"
|
|
596
|
+
},
|
|
546
597
|
"lefthook": {
|
|
547
598
|
"title": "lefthook plugin configuration (https://knip.dev/reference/plugins/lefthook)",
|
|
548
599
|
"$ref": "#/definitions/plugin"
|
|
@@ -655,6 +706,10 @@
|
|
|
655
706
|
"title": "Nuxt plugin configuration (https://knip.dev/reference/plugins/nuxt)",
|
|
656
707
|
"$ref": "#/definitions/plugin"
|
|
657
708
|
},
|
|
709
|
+
"nuxtjs-i18n": {
|
|
710
|
+
"title": "nuxtjs-i18n plugin configuration (https://knip.dev/reference/plugins/nuxtjs-i18n)",
|
|
711
|
+
"$ref": "#/definitions/plugin"
|
|
712
|
+
},
|
|
658
713
|
"nx": {
|
|
659
714
|
"title": "Nx plugin configuration (https://knip.dev/reference/plugins/nx)",
|
|
660
715
|
"$ref": "#/definitions/plugin"
|
|
@@ -731,6 +786,10 @@
|
|
|
731
786
|
"title": "Prisma plugin configuration (https://knip.dev/reference/plugins/prisma)",
|
|
732
787
|
"$ref": "#/definitions/plugin"
|
|
733
788
|
},
|
|
789
|
+
"quasar": {
|
|
790
|
+
"title": "quasar plugin configuration (https://knip.dev/reference/plugins/quasar)",
|
|
791
|
+
"$ref": "#/definitions/plugin"
|
|
792
|
+
},
|
|
734
793
|
"qwik": {
|
|
735
794
|
"title": "qwik plugin configuration (https://knip.dev/reference/plugins/qwik)",
|
|
736
795
|
"$ref": "#/definitions/plugin"
|
|
@@ -879,6 +938,10 @@
|
|
|
879
938
|
"title": "taskfile plugin configuration (https://knip.dev/reference/plugins/taskfile)",
|
|
880
939
|
"$ref": "#/definitions/plugin"
|
|
881
940
|
},
|
|
941
|
+
"tauri": {
|
|
942
|
+
"title": "tauri plugin configuration (https://knip.dev/reference/plugins/tauri)",
|
|
943
|
+
"$ref": "#/definitions/plugin"
|
|
944
|
+
},
|
|
882
945
|
"travis": {
|
|
883
946
|
"title": "travis plugin configuration (https://knip.dev/reference/plugins/travis)",
|
|
884
947
|
"$ref": "#/definitions/plugin"
|
|
@@ -915,6 +978,30 @@
|
|
|
915
978
|
"title": "unocss plugin configuration (https://knip.dev/reference/plugins/unocss)",
|
|
916
979
|
"$ref": "#/definitions/plugin"
|
|
917
980
|
},
|
|
981
|
+
"unplugin-auto-import": {
|
|
982
|
+
"title": "unplugin-auto-import plugin configuration (https://knip.dev/reference/plugins/unplugin-auto-import)",
|
|
983
|
+
"$ref": "#/definitions/plugin"
|
|
984
|
+
},
|
|
985
|
+
"unplugin-icons": {
|
|
986
|
+
"title": "unplugin-icons plugin configuration (https://knip.dev/reference/plugins/unplugin-icons)",
|
|
987
|
+
"$ref": "#/definitions/plugin"
|
|
988
|
+
},
|
|
989
|
+
"unplugin-vue-components": {
|
|
990
|
+
"title": "unplugin-vue-components plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-components)",
|
|
991
|
+
"$ref": "#/definitions/plugin"
|
|
992
|
+
},
|
|
993
|
+
"unplugin-vue-i18n": {
|
|
994
|
+
"title": "unplugin-vue-i18n plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-i18n)",
|
|
995
|
+
"$ref": "#/definitions/plugin"
|
|
996
|
+
},
|
|
997
|
+
"unplugin-vue-markdown": {
|
|
998
|
+
"title": "unplugin-vue-markdown plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-markdown)",
|
|
999
|
+
"$ref": "#/definitions/plugin"
|
|
1000
|
+
},
|
|
1001
|
+
"unplugin-vue-router": {
|
|
1002
|
+
"title": "unplugin-vue-router plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-router)",
|
|
1003
|
+
"$ref": "#/definitions/plugin"
|
|
1004
|
+
},
|
|
918
1005
|
"vercel": {
|
|
919
1006
|
"title": "vercel plugin configuration (https://knip.dev/reference/plugins/vercel)",
|
|
920
1007
|
"$ref": "#/definitions/plugin"
|
|
@@ -931,6 +1018,26 @@
|
|
|
931
1018
|
"title": "vite plugin configuration (https://knip.dev/reference/plugins/vite)",
|
|
932
1019
|
"$ref": "#/definitions/plugin"
|
|
933
1020
|
},
|
|
1021
|
+
"vite-plugin-pages": {
|
|
1022
|
+
"title": "vite-plugin-pages plugin configuration (https://knip.dev/reference/plugins/vite-plugin-pages)",
|
|
1023
|
+
"$ref": "#/definitions/plugin"
|
|
1024
|
+
},
|
|
1025
|
+
"vite-plugin-pwa": {
|
|
1026
|
+
"title": "vite-plugin-pwa plugin configuration (https://knip.dev/reference/plugins/vite-plugin-pwa)",
|
|
1027
|
+
"$ref": "#/definitions/plugin"
|
|
1028
|
+
},
|
|
1029
|
+
"vite-plugin-vue-layouts-next": {
|
|
1030
|
+
"title": "vite-plugin-vue-layouts-next plugin configuration (https://knip.dev/reference/plugins/vite-plugin-vue-layouts-next)",
|
|
1031
|
+
"$ref": "#/definitions/plugin"
|
|
1032
|
+
},
|
|
1033
|
+
"vite-plus": {
|
|
1034
|
+
"title": "vite-plus plugin configuration (https://knip.dev/reference/plugins/vite-plus)",
|
|
1035
|
+
"$ref": "#/definitions/plugin"
|
|
1036
|
+
},
|
|
1037
|
+
"vite-pwa-assets-generator": {
|
|
1038
|
+
"title": "vite-pwa-assets-generator plugin configuration (https://knip.dev/reference/plugins/vite-pwa-assets-generator)",
|
|
1039
|
+
"$ref": "#/definitions/plugin"
|
|
1040
|
+
},
|
|
934
1041
|
"vitepress": {
|
|
935
1042
|
"title": "vitepress plugin configuration (https://knip.dev/reference/plugins/vitepress)",
|
|
936
1043
|
"$ref": "#/definitions/plugin"
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type ParseResult } from 'oxc-parser';
|
|
2
|
-
import type { TemplateAstNode, VueSfc } from './types.ts';
|
|
3
|
-
export declare const getVueSfc: (cwd: string) => VueSfc;
|
|
4
|
-
export declare const readAndParseFile: (filePath: string) => ParseResult;
|
|
5
|
-
export declare const collectIdentifiers: (source: string, fileName: string) => Set<string>;
|
|
6
|
-
export declare const collectTemplateInfo: (tree: TemplateAstNode) => {
|
|
7
|
-
tags: Set<string>;
|
|
8
|
-
identifiers: Set<string>;
|
|
9
|
-
};
|
|
10
|
-
export declare const toKebabCase: (s: string) => string;
|
|
11
|
-
export declare const collectLocalImportPaths: (filePath: string, result: ParseResult) => Set<string>;
|
|
12
|
-
export declare function buildAutoImportMap(filePath: string, result: ParseResult): {
|
|
13
|
-
importMap: Map<string, string>;
|
|
14
|
-
componentMap: Map<string, string[]>;
|
|
15
|
-
};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { Visitor } from 'oxc-parser';
|
|
4
|
-
import { scriptBodies } from '../../compilers/compilers.js';
|
|
5
|
-
import { _parseFile } from '../../typescript/ast-nodes.js';
|
|
6
|
-
import { basename, dirname, isInNodeModules, join } from '../../util/path.js';
|
|
7
|
-
export const getVueSfc = (cwd) => {
|
|
8
|
-
try {
|
|
9
|
-
return createRequire(join(cwd, 'package.json'))('vue/compiler-sfc');
|
|
10
|
-
}
|
|
11
|
-
catch { }
|
|
12
|
-
return {
|
|
13
|
-
parse: (source, path) => ({
|
|
14
|
-
descriptor: { script: { content: scriptBodies(source, path) }, scriptSetup: null, template: { content: '' } },
|
|
15
|
-
}),
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
const readFile = (filePath) => {
|
|
19
|
-
try {
|
|
20
|
-
return readFileSync(filePath, 'utf8');
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export const readAndParseFile = (filePath) => _parseFile(filePath, readFile(filePath));
|
|
27
|
-
export const collectIdentifiers = (source, fileName) => {
|
|
28
|
-
const identifiers = new Set();
|
|
29
|
-
const visitor = new Visitor({
|
|
30
|
-
Identifier(node) {
|
|
31
|
-
identifiers.add(node.name);
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
visitor.visit(_parseFile(fileName, source).program);
|
|
35
|
-
return identifiers;
|
|
36
|
-
};
|
|
37
|
-
export const collectTemplateInfo = (tree) => {
|
|
38
|
-
const tags = new Set();
|
|
39
|
-
const identifiers = new Set();
|
|
40
|
-
const addExprIdentifiers = (expr) => {
|
|
41
|
-
for (const id of collectIdentifiers(expr, 'expr.ts'))
|
|
42
|
-
identifiers.add(id);
|
|
43
|
-
};
|
|
44
|
-
const visit = (node) => {
|
|
45
|
-
if (node.tag)
|
|
46
|
-
tags.add(node.tag);
|
|
47
|
-
if (node.type === 5 && node.content && !node.content.isStatic)
|
|
48
|
-
addExprIdentifiers(node.content.content);
|
|
49
|
-
if (node.props) {
|
|
50
|
-
for (const prop of node.props) {
|
|
51
|
-
if (prop.type === 7) {
|
|
52
|
-
if (prop.exp && !prop.exp.isStatic)
|
|
53
|
-
addExprIdentifiers(prop.exp.content);
|
|
54
|
-
if (prop.arg && !prop.arg.isStatic)
|
|
55
|
-
addExprIdentifiers(prop.arg.content);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (node.children)
|
|
60
|
-
for (const child of node.children)
|
|
61
|
-
visit(child);
|
|
62
|
-
};
|
|
63
|
-
visit(tree);
|
|
64
|
-
return { tags, identifiers };
|
|
65
|
-
};
|
|
66
|
-
export const toKebabCase = (s) => s.replace(/[A-Z]/g, (m, i) => (i ? '-' : '') + m.toLowerCase());
|
|
67
|
-
const isLocalSpecifier = (specifier) => specifier.startsWith('.') && !isInNodeModules(specifier);
|
|
68
|
-
export const collectLocalImportPaths = (filePath, result) => {
|
|
69
|
-
const dir = dirname(filePath);
|
|
70
|
-
const paths = new Set();
|
|
71
|
-
const visitor = new Visitor({
|
|
72
|
-
TSImportType(node) {
|
|
73
|
-
const specifier = node.source.value;
|
|
74
|
-
if (isLocalSpecifier(specifier))
|
|
75
|
-
paths.add(join(dir, specifier));
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
visitor.visit(result.program);
|
|
79
|
-
return paths;
|
|
80
|
-
};
|
|
81
|
-
export function buildAutoImportMap(filePath, result) {
|
|
82
|
-
const dir = dirname(filePath);
|
|
83
|
-
const isComponents = basename(filePath) === 'components.d.ts';
|
|
84
|
-
const importMap = new Map();
|
|
85
|
-
const componentMap = new Map();
|
|
86
|
-
const importTypes = [];
|
|
87
|
-
const collectVisitor = new Visitor({
|
|
88
|
-
TSImportType(node) {
|
|
89
|
-
importTypes.push({ start: node.start, end: node.end, specifier: node.source.value });
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
collectVisitor.visit(result.program);
|
|
93
|
-
const matchVisitor = new Visitor({
|
|
94
|
-
VariableDeclarator(node) {
|
|
95
|
-
if (node.id?.type !== 'Identifier')
|
|
96
|
-
return;
|
|
97
|
-
const name = node.id.name;
|
|
98
|
-
if (name.startsWith('Lazy'))
|
|
99
|
-
return;
|
|
100
|
-
const importType = importTypes.find(it => it.start >= node.start && it.end <= node.end);
|
|
101
|
-
if (!importType)
|
|
102
|
-
return;
|
|
103
|
-
if (!isLocalSpecifier(importType.specifier))
|
|
104
|
-
return;
|
|
105
|
-
const absSpecifier = join(dir, importType.specifier);
|
|
106
|
-
if (isComponents) {
|
|
107
|
-
const components = componentMap.get(name);
|
|
108
|
-
if (components)
|
|
109
|
-
components.push(absSpecifier);
|
|
110
|
-
else
|
|
111
|
-
componentMap.set(name, [absSpecifier]);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
importMap.set(name, absSpecifier);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
ExportNamedDeclaration(node) {
|
|
118
|
-
if (!node.source)
|
|
119
|
-
return;
|
|
120
|
-
const specifier = node.source.value;
|
|
121
|
-
if (!isLocalSpecifier(specifier))
|
|
122
|
-
return;
|
|
123
|
-
const absSpecifier = join(dir, specifier);
|
|
124
|
-
for (const s of node.specifiers) {
|
|
125
|
-
const name = s.exported.type === 'Identifier' ? s.exported.name : s.exported.value;
|
|
126
|
-
if (name)
|
|
127
|
-
importMap.set(name, absSpecifier);
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
matchVisitor.visit(result.program);
|
|
132
|
-
return { importMap, componentMap };
|
|
133
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { scriptBodies } from '../../compilers/compilers.js';
|
|
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
|
-
};
|
|
10
|
-
export default compiler;
|