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
|
@@ -143,16 +143,31 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
143
143
|
entry?: string | string[] | undefined;
|
|
144
144
|
project?: string | string[] | undefined;
|
|
145
145
|
} | undefined;
|
|
146
|
+
'electron-vite'?: string | boolean | string[] | {
|
|
147
|
+
config?: string | string[] | undefined;
|
|
148
|
+
entry?: string | string[] | undefined;
|
|
149
|
+
project?: string | string[] | undefined;
|
|
150
|
+
} | undefined;
|
|
146
151
|
eleventy?: string | boolean | string[] | {
|
|
147
152
|
config?: string | string[] | undefined;
|
|
148
153
|
entry?: string | string[] | undefined;
|
|
149
154
|
project?: string | string[] | undefined;
|
|
150
155
|
} | undefined;
|
|
156
|
+
esbuild?: string | boolean | string[] | {
|
|
157
|
+
config?: string | string[] | undefined;
|
|
158
|
+
entry?: string | string[] | undefined;
|
|
159
|
+
project?: string | string[] | undefined;
|
|
160
|
+
} | undefined;
|
|
151
161
|
eslint?: string | boolean | string[] | {
|
|
152
162
|
config?: string | string[] | undefined;
|
|
153
163
|
entry?: string | string[] | undefined;
|
|
154
164
|
project?: string | string[] | undefined;
|
|
155
165
|
} | undefined;
|
|
166
|
+
eve?: string | boolean | string[] | {
|
|
167
|
+
config?: string | string[] | undefined;
|
|
168
|
+
entry?: string | string[] | undefined;
|
|
169
|
+
project?: string | string[] | undefined;
|
|
170
|
+
} | undefined;
|
|
156
171
|
execa?: string | boolean | string[] | {
|
|
157
172
|
config?: string | string[] | undefined;
|
|
158
173
|
entry?: string | string[] | undefined;
|
|
@@ -173,6 +188,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
173
188
|
entry?: string | string[] | undefined;
|
|
174
189
|
project?: string | string[] | undefined;
|
|
175
190
|
} | undefined;
|
|
191
|
+
fumadocs?: string | boolean | string[] | {
|
|
192
|
+
config?: string | string[] | undefined;
|
|
193
|
+
entry?: string | string[] | undefined;
|
|
194
|
+
project?: string | string[] | undefined;
|
|
195
|
+
} | undefined;
|
|
176
196
|
gatsby?: string | boolean | string[] | {
|
|
177
197
|
config?: string | string[] | undefined;
|
|
178
198
|
entry?: string | string[] | undefined;
|
|
@@ -233,6 +253,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
233
253
|
entry?: string | string[] | undefined;
|
|
234
254
|
project?: string | string[] | undefined;
|
|
235
255
|
} | undefined;
|
|
256
|
+
'laravel-vite-plugin'?: string | boolean | string[] | {
|
|
257
|
+
config?: string | string[] | undefined;
|
|
258
|
+
entry?: string | string[] | undefined;
|
|
259
|
+
project?: string | string[] | undefined;
|
|
260
|
+
} | undefined;
|
|
236
261
|
lefthook?: string | boolean | string[] | {
|
|
237
262
|
config?: string | string[] | undefined;
|
|
238
263
|
entry?: string | string[] | undefined;
|
|
@@ -368,6 +393,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
368
393
|
entry?: string | string[] | undefined;
|
|
369
394
|
project?: string | string[] | undefined;
|
|
370
395
|
} | undefined;
|
|
396
|
+
'nuxtjs-i18n'?: string | boolean | string[] | {
|
|
397
|
+
config?: string | string[] | undefined;
|
|
398
|
+
entry?: string | string[] | undefined;
|
|
399
|
+
project?: string | string[] | undefined;
|
|
400
|
+
} | undefined;
|
|
371
401
|
nx?: string | boolean | string[] | {
|
|
372
402
|
config?: string | string[] | undefined;
|
|
373
403
|
entry?: string | string[] | undefined;
|
|
@@ -473,6 +503,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
473
503
|
entry?: string | string[] | undefined;
|
|
474
504
|
project?: string | string[] | undefined;
|
|
475
505
|
} | undefined;
|
|
506
|
+
quasar?: string | boolean | string[] | {
|
|
507
|
+
config?: string | string[] | undefined;
|
|
508
|
+
entry?: string | string[] | undefined;
|
|
509
|
+
project?: string | string[] | undefined;
|
|
510
|
+
} | undefined;
|
|
476
511
|
qwik?: string | boolean | string[] | {
|
|
477
512
|
config?: string | string[] | undefined;
|
|
478
513
|
entry?: string | string[] | undefined;
|
|
@@ -663,6 +698,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
663
698
|
entry?: string | string[] | undefined;
|
|
664
699
|
project?: string | string[] | undefined;
|
|
665
700
|
} | undefined;
|
|
701
|
+
tauri?: string | boolean | string[] | {
|
|
702
|
+
config?: string | string[] | undefined;
|
|
703
|
+
entry?: string | string[] | undefined;
|
|
704
|
+
project?: string | string[] | undefined;
|
|
705
|
+
} | undefined;
|
|
666
706
|
travis?: string | boolean | string[] | {
|
|
667
707
|
config?: string | string[] | undefined;
|
|
668
708
|
entry?: string | string[] | undefined;
|
|
@@ -708,6 +748,36 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
708
748
|
entry?: string | string[] | undefined;
|
|
709
749
|
project?: string | string[] | undefined;
|
|
710
750
|
} | undefined;
|
|
751
|
+
'unplugin-auto-import'?: string | boolean | string[] | {
|
|
752
|
+
config?: string | string[] | undefined;
|
|
753
|
+
entry?: string | string[] | undefined;
|
|
754
|
+
project?: string | string[] | undefined;
|
|
755
|
+
} | undefined;
|
|
756
|
+
'unplugin-icons'?: string | boolean | string[] | {
|
|
757
|
+
config?: string | string[] | undefined;
|
|
758
|
+
entry?: string | string[] | undefined;
|
|
759
|
+
project?: string | string[] | undefined;
|
|
760
|
+
} | undefined;
|
|
761
|
+
'unplugin-vue-components'?: string | boolean | string[] | {
|
|
762
|
+
config?: string | string[] | undefined;
|
|
763
|
+
entry?: string | string[] | undefined;
|
|
764
|
+
project?: string | string[] | undefined;
|
|
765
|
+
} | undefined;
|
|
766
|
+
'unplugin-vue-i18n'?: string | boolean | string[] | {
|
|
767
|
+
config?: string | string[] | undefined;
|
|
768
|
+
entry?: string | string[] | undefined;
|
|
769
|
+
project?: string | string[] | undefined;
|
|
770
|
+
} | undefined;
|
|
771
|
+
'unplugin-vue-markdown'?: string | boolean | string[] | {
|
|
772
|
+
config?: string | string[] | undefined;
|
|
773
|
+
entry?: string | string[] | undefined;
|
|
774
|
+
project?: string | string[] | undefined;
|
|
775
|
+
} | undefined;
|
|
776
|
+
'unplugin-vue-router'?: string | boolean | string[] | {
|
|
777
|
+
config?: string | string[] | undefined;
|
|
778
|
+
entry?: string | string[] | undefined;
|
|
779
|
+
project?: string | string[] | undefined;
|
|
780
|
+
} | undefined;
|
|
711
781
|
vercel?: string | boolean | string[] | {
|
|
712
782
|
config?: string | string[] | undefined;
|
|
713
783
|
entry?: string | string[] | undefined;
|
|
@@ -728,6 +798,31 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
728
798
|
entry?: string | string[] | undefined;
|
|
729
799
|
project?: string | string[] | undefined;
|
|
730
800
|
} | undefined;
|
|
801
|
+
'vite-plugin-pages'?: string | boolean | string[] | {
|
|
802
|
+
config?: string | string[] | undefined;
|
|
803
|
+
entry?: string | string[] | undefined;
|
|
804
|
+
project?: string | string[] | undefined;
|
|
805
|
+
} | undefined;
|
|
806
|
+
'vite-plugin-pwa'?: string | boolean | string[] | {
|
|
807
|
+
config?: string | string[] | undefined;
|
|
808
|
+
entry?: string | string[] | undefined;
|
|
809
|
+
project?: string | string[] | undefined;
|
|
810
|
+
} | undefined;
|
|
811
|
+
'vite-plugin-vue-layouts-next'?: string | boolean | string[] | {
|
|
812
|
+
config?: string | string[] | undefined;
|
|
813
|
+
entry?: string | string[] | undefined;
|
|
814
|
+
project?: string | string[] | undefined;
|
|
815
|
+
} | undefined;
|
|
816
|
+
'vite-plus'?: string | boolean | string[] | {
|
|
817
|
+
config?: string | string[] | undefined;
|
|
818
|
+
entry?: string | string[] | undefined;
|
|
819
|
+
project?: string | string[] | undefined;
|
|
820
|
+
} | undefined;
|
|
821
|
+
'vite-pwa-assets-generator'?: string | boolean | string[] | {
|
|
822
|
+
config?: string | string[] | undefined;
|
|
823
|
+
entry?: string | string[] | undefined;
|
|
824
|
+
project?: string | string[] | undefined;
|
|
825
|
+
} | undefined;
|
|
731
826
|
vitepress?: string | boolean | string[] | {
|
|
732
827
|
config?: string | string[] | undefined;
|
|
733
828
|
entry?: string | string[] | undefined;
|
|
@@ -789,7 +884,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
789
884
|
project?: string | string[] | undefined;
|
|
790
885
|
} | undefined;
|
|
791
886
|
$schema?: string | undefined;
|
|
792
|
-
rules?: Partial<Record<"binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved", "error" | "off" | "warn">> | undefined;
|
|
887
|
+
rules?: Partial<Record<"binaries" | "catalog" | "cycles" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved", "error" | "off" | "warn">> | undefined;
|
|
793
888
|
entry?: string | string[] | undefined;
|
|
794
889
|
project?: string | string[] | undefined;
|
|
795
890
|
paths?: Record<string, string[]> | undefined;
|
|
@@ -800,15 +895,19 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
800
895
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
801
896
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
802
897
|
ignoreExportsUsedInFile?: boolean | Record<string, boolean | undefined> | undefined;
|
|
803
|
-
ignoreIssues?: Record<string, ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[]> | undefined;
|
|
898
|
+
ignoreIssues?: Record<string, ("binaries" | "catalog" | "cycles" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[]> | undefined;
|
|
899
|
+
cycles?: {
|
|
900
|
+
allow?: string[][] | undefined;
|
|
901
|
+
dynamicImports?: boolean | undefined;
|
|
902
|
+
} | undefined;
|
|
804
903
|
ignoreWorkspaces?: string[] | undefined;
|
|
805
904
|
includeEntryExports?: boolean | undefined;
|
|
806
905
|
compilers?: Record<string, true | CompilerAsync | CompilerSync> | undefined;
|
|
807
906
|
tags?: string[] | undefined;
|
|
808
907
|
treatConfigHintsAsErrors?: boolean | undefined;
|
|
809
908
|
treatTagHintsAsErrors?: boolean | undefined;
|
|
810
|
-
include?: ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
811
|
-
exclude?: ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
909
|
+
include?: ("binaries" | "catalog" | "cycles" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
910
|
+
exclude?: ("binaries" | "catalog" | "cycles" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[] | undefined;
|
|
812
911
|
workspaces?: Record<string, {
|
|
813
912
|
angular?: string | boolean | string[] | {
|
|
814
913
|
config?: string | string[] | undefined;
|
|
@@ -950,16 +1049,31 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
950
1049
|
entry?: string | string[] | undefined;
|
|
951
1050
|
project?: string | string[] | undefined;
|
|
952
1051
|
} | undefined;
|
|
1052
|
+
'electron-vite'?: string | boolean | string[] | {
|
|
1053
|
+
config?: string | string[] | undefined;
|
|
1054
|
+
entry?: string | string[] | undefined;
|
|
1055
|
+
project?: string | string[] | undefined;
|
|
1056
|
+
} | undefined;
|
|
953
1057
|
eleventy?: string | boolean | string[] | {
|
|
954
1058
|
config?: string | string[] | undefined;
|
|
955
1059
|
entry?: string | string[] | undefined;
|
|
956
1060
|
project?: string | string[] | undefined;
|
|
957
1061
|
} | undefined;
|
|
1062
|
+
esbuild?: string | boolean | string[] | {
|
|
1063
|
+
config?: string | string[] | undefined;
|
|
1064
|
+
entry?: string | string[] | undefined;
|
|
1065
|
+
project?: string | string[] | undefined;
|
|
1066
|
+
} | undefined;
|
|
958
1067
|
eslint?: string | boolean | string[] | {
|
|
959
1068
|
config?: string | string[] | undefined;
|
|
960
1069
|
entry?: string | string[] | undefined;
|
|
961
1070
|
project?: string | string[] | undefined;
|
|
962
1071
|
} | undefined;
|
|
1072
|
+
eve?: string | boolean | string[] | {
|
|
1073
|
+
config?: string | string[] | undefined;
|
|
1074
|
+
entry?: string | string[] | undefined;
|
|
1075
|
+
project?: string | string[] | undefined;
|
|
1076
|
+
} | undefined;
|
|
963
1077
|
execa?: string | boolean | string[] | {
|
|
964
1078
|
config?: string | string[] | undefined;
|
|
965
1079
|
entry?: string | string[] | undefined;
|
|
@@ -980,6 +1094,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
980
1094
|
entry?: string | string[] | undefined;
|
|
981
1095
|
project?: string | string[] | undefined;
|
|
982
1096
|
} | undefined;
|
|
1097
|
+
fumadocs?: string | boolean | string[] | {
|
|
1098
|
+
config?: string | string[] | undefined;
|
|
1099
|
+
entry?: string | string[] | undefined;
|
|
1100
|
+
project?: string | string[] | undefined;
|
|
1101
|
+
} | undefined;
|
|
983
1102
|
gatsby?: string | boolean | string[] | {
|
|
984
1103
|
config?: string | string[] | undefined;
|
|
985
1104
|
entry?: string | string[] | undefined;
|
|
@@ -1040,6 +1159,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1040
1159
|
entry?: string | string[] | undefined;
|
|
1041
1160
|
project?: string | string[] | undefined;
|
|
1042
1161
|
} | undefined;
|
|
1162
|
+
'laravel-vite-plugin'?: string | boolean | string[] | {
|
|
1163
|
+
config?: string | string[] | undefined;
|
|
1164
|
+
entry?: string | string[] | undefined;
|
|
1165
|
+
project?: string | string[] | undefined;
|
|
1166
|
+
} | undefined;
|
|
1043
1167
|
lefthook?: string | boolean | string[] | {
|
|
1044
1168
|
config?: string | string[] | undefined;
|
|
1045
1169
|
entry?: string | string[] | undefined;
|
|
@@ -1175,6 +1299,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1175
1299
|
entry?: string | string[] | undefined;
|
|
1176
1300
|
project?: string | string[] | undefined;
|
|
1177
1301
|
} | undefined;
|
|
1302
|
+
'nuxtjs-i18n'?: string | boolean | string[] | {
|
|
1303
|
+
config?: string | string[] | undefined;
|
|
1304
|
+
entry?: string | string[] | undefined;
|
|
1305
|
+
project?: string | string[] | undefined;
|
|
1306
|
+
} | undefined;
|
|
1178
1307
|
nx?: string | boolean | string[] | {
|
|
1179
1308
|
config?: string | string[] | undefined;
|
|
1180
1309
|
entry?: string | string[] | undefined;
|
|
@@ -1280,6 +1409,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1280
1409
|
entry?: string | string[] | undefined;
|
|
1281
1410
|
project?: string | string[] | undefined;
|
|
1282
1411
|
} | undefined;
|
|
1412
|
+
quasar?: string | boolean | string[] | {
|
|
1413
|
+
config?: string | string[] | undefined;
|
|
1414
|
+
entry?: string | string[] | undefined;
|
|
1415
|
+
project?: string | string[] | undefined;
|
|
1416
|
+
} | undefined;
|
|
1283
1417
|
qwik?: string | boolean | string[] | {
|
|
1284
1418
|
config?: string | string[] | undefined;
|
|
1285
1419
|
entry?: string | string[] | undefined;
|
|
@@ -1470,6 +1604,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1470
1604
|
entry?: string | string[] | undefined;
|
|
1471
1605
|
project?: string | string[] | undefined;
|
|
1472
1606
|
} | undefined;
|
|
1607
|
+
tauri?: string | boolean | string[] | {
|
|
1608
|
+
config?: string | string[] | undefined;
|
|
1609
|
+
entry?: string | string[] | undefined;
|
|
1610
|
+
project?: string | string[] | undefined;
|
|
1611
|
+
} | undefined;
|
|
1473
1612
|
travis?: string | boolean | string[] | {
|
|
1474
1613
|
config?: string | string[] | undefined;
|
|
1475
1614
|
entry?: string | string[] | undefined;
|
|
@@ -1515,6 +1654,36 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1515
1654
|
entry?: string | string[] | undefined;
|
|
1516
1655
|
project?: string | string[] | undefined;
|
|
1517
1656
|
} | undefined;
|
|
1657
|
+
'unplugin-auto-import'?: string | boolean | string[] | {
|
|
1658
|
+
config?: string | string[] | undefined;
|
|
1659
|
+
entry?: string | string[] | undefined;
|
|
1660
|
+
project?: string | string[] | undefined;
|
|
1661
|
+
} | undefined;
|
|
1662
|
+
'unplugin-icons'?: string | boolean | string[] | {
|
|
1663
|
+
config?: string | string[] | undefined;
|
|
1664
|
+
entry?: string | string[] | undefined;
|
|
1665
|
+
project?: string | string[] | undefined;
|
|
1666
|
+
} | undefined;
|
|
1667
|
+
'unplugin-vue-components'?: string | boolean | string[] | {
|
|
1668
|
+
config?: string | string[] | undefined;
|
|
1669
|
+
entry?: string | string[] | undefined;
|
|
1670
|
+
project?: string | string[] | undefined;
|
|
1671
|
+
} | undefined;
|
|
1672
|
+
'unplugin-vue-i18n'?: string | boolean | string[] | {
|
|
1673
|
+
config?: string | string[] | undefined;
|
|
1674
|
+
entry?: string | string[] | undefined;
|
|
1675
|
+
project?: string | string[] | undefined;
|
|
1676
|
+
} | undefined;
|
|
1677
|
+
'unplugin-vue-markdown'?: string | boolean | string[] | {
|
|
1678
|
+
config?: string | string[] | undefined;
|
|
1679
|
+
entry?: string | string[] | undefined;
|
|
1680
|
+
project?: string | string[] | undefined;
|
|
1681
|
+
} | undefined;
|
|
1682
|
+
'unplugin-vue-router'?: string | boolean | string[] | {
|
|
1683
|
+
config?: string | string[] | undefined;
|
|
1684
|
+
entry?: string | string[] | undefined;
|
|
1685
|
+
project?: string | string[] | undefined;
|
|
1686
|
+
} | undefined;
|
|
1518
1687
|
vercel?: string | boolean | string[] | {
|
|
1519
1688
|
config?: string | string[] | undefined;
|
|
1520
1689
|
entry?: string | string[] | undefined;
|
|
@@ -1535,6 +1704,31 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1535
1704
|
entry?: string | string[] | undefined;
|
|
1536
1705
|
project?: string | string[] | undefined;
|
|
1537
1706
|
} | undefined;
|
|
1707
|
+
'vite-plugin-pages'?: string | boolean | string[] | {
|
|
1708
|
+
config?: string | string[] | undefined;
|
|
1709
|
+
entry?: string | string[] | undefined;
|
|
1710
|
+
project?: string | string[] | undefined;
|
|
1711
|
+
} | undefined;
|
|
1712
|
+
'vite-plugin-pwa'?: string | boolean | string[] | {
|
|
1713
|
+
config?: string | string[] | undefined;
|
|
1714
|
+
entry?: string | string[] | undefined;
|
|
1715
|
+
project?: string | string[] | undefined;
|
|
1716
|
+
} | undefined;
|
|
1717
|
+
'vite-plugin-vue-layouts-next'?: string | boolean | string[] | {
|
|
1718
|
+
config?: string | string[] | undefined;
|
|
1719
|
+
entry?: string | string[] | undefined;
|
|
1720
|
+
project?: string | string[] | undefined;
|
|
1721
|
+
} | undefined;
|
|
1722
|
+
'vite-plus'?: string | boolean | string[] | {
|
|
1723
|
+
config?: string | string[] | undefined;
|
|
1724
|
+
entry?: string | string[] | undefined;
|
|
1725
|
+
project?: string | string[] | undefined;
|
|
1726
|
+
} | undefined;
|
|
1727
|
+
'vite-pwa-assets-generator'?: string | boolean | string[] | {
|
|
1728
|
+
config?: string | string[] | undefined;
|
|
1729
|
+
entry?: string | string[] | undefined;
|
|
1730
|
+
project?: string | string[] | undefined;
|
|
1731
|
+
} | undefined;
|
|
1538
1732
|
vitepress?: string | boolean | string[] | {
|
|
1539
1733
|
config?: string | string[] | undefined;
|
|
1540
1734
|
entry?: string | string[] | undefined;
|
|
@@ -1605,7 +1799,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1605
1799
|
ignoreMembers?: (string | RegExp)[] | undefined;
|
|
1606
1800
|
ignoreUnresolved?: (string | RegExp)[] | undefined;
|
|
1607
1801
|
ignoreExportsUsedInFile?: boolean | Record<string, boolean | undefined> | undefined;
|
|
1608
|
-
ignoreIssues?: Record<string, ("binaries" | "catalog" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[]> | undefined;
|
|
1802
|
+
ignoreIssues?: Record<string, ("binaries" | "catalog" | "cycles" | "dependencies" | "devDependencies" | "duplicates" | "enumMembers" | "exports" | "files" | "namespaceMembers" | "nsExports" | "nsTypes" | "optionalPeerDependencies" | "types" | "unlisted" | "unresolved")[]> | undefined;
|
|
1609
1803
|
includeEntryExports?: boolean | undefined;
|
|
1610
1804
|
}> | undefined;
|
|
1611
1805
|
syncCompilers: Record<string, true | CompilerSync>;
|
package/dist/constants.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const IGNORED_DEPENDENCIES: Set<string>;
|
|
|
16
16
|
export declare const IGNORED_RUNTIME_DEPENDENCIES: Set<string>;
|
|
17
17
|
export declare const FOREIGN_FILE_EXTENSIONS: Set<string>;
|
|
18
18
|
export declare const IGNORE_DEFINITELY_TYPED: Set<string>;
|
|
19
|
-
export declare const ISSUE_TYPES: readonly ['files', 'dependencies', 'devDependencies', 'optionalPeerDependencies', 'unlisted', 'binaries', 'unresolved', 'exports', 'nsExports', 'types', 'nsTypes', 'enumMembers', 'namespaceMembers', 'duplicates', 'catalog'];
|
|
19
|
+
export declare const ISSUE_TYPES: readonly ['files', 'dependencies', 'devDependencies', 'optionalPeerDependencies', 'unlisted', 'binaries', 'unresolved', 'exports', 'nsExports', 'types', 'nsTypes', 'enumMembers', 'namespaceMembers', 'duplicates', 'catalog', 'cycles'];
|
|
20
20
|
export declare const ISSUE_TYPE_TITLE: {
|
|
21
21
|
readonly files: 'Unused files';
|
|
22
22
|
readonly dependencies: 'Unused dependencies';
|
|
@@ -33,6 +33,7 @@ export declare const ISSUE_TYPE_TITLE: {
|
|
|
33
33
|
readonly namespaceMembers: 'Unused exported namespace members';
|
|
34
34
|
readonly duplicates: 'Duplicate exports';
|
|
35
35
|
readonly catalog: 'Unused catalog entries';
|
|
36
|
+
readonly cycles: 'Circular dependencies';
|
|
36
37
|
};
|
|
37
38
|
export declare const SYMBOL_TYPE: {
|
|
38
39
|
readonly CLASS: 'class';
|
|
@@ -53,6 +54,7 @@ export declare const FIX_FLAGS: {
|
|
|
53
54
|
};
|
|
54
55
|
export declare const SIDE_EFFECTS = "__side-effects";
|
|
55
56
|
export declare const OPAQUE = "__opaque";
|
|
57
|
+
export declare const SCRIPT_INTERPOLATION = "$__knip__";
|
|
56
58
|
export declare const IMPORT_FLAGS: {
|
|
57
59
|
readonly NONE: 0;
|
|
58
60
|
readonly RE_EXPORT: number;
|
|
@@ -62,4 +64,6 @@ export declare const IMPORT_FLAGS: {
|
|
|
62
64
|
readonly OPTIONAL: number;
|
|
63
65
|
readonly SIDE_EFFECTS: number;
|
|
64
66
|
readonly OPAQUE: number;
|
|
67
|
+
readonly AUGMENT: number;
|
|
68
|
+
readonly DYNAMIC: number;
|
|
65
69
|
};
|
package/dist/constants.js
CHANGED
|
@@ -23,6 +23,7 @@ export const PROTOCOL_VIRTUAL = 'virtual:';
|
|
|
23
23
|
export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
24
24
|
'amplify',
|
|
25
25
|
'aws',
|
|
26
|
+
'az',
|
|
26
27
|
'base64',
|
|
27
28
|
'basename',
|
|
28
29
|
'bash',
|
|
@@ -37,6 +38,10 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
37
38
|
'cksum',
|
|
38
39
|
'clear',
|
|
39
40
|
'cmd',
|
|
41
|
+
'cmd.exe',
|
|
42
|
+
'code',
|
|
43
|
+
'code-insiders',
|
|
44
|
+
'codesign',
|
|
40
45
|
'comm',
|
|
41
46
|
'command',
|
|
42
47
|
'corepack',
|
|
@@ -45,10 +50,12 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
45
50
|
'cut',
|
|
46
51
|
'date',
|
|
47
52
|
'deno',
|
|
53
|
+
'devtunnel',
|
|
48
54
|
'df',
|
|
49
55
|
'dir',
|
|
50
56
|
'dirname',
|
|
51
57
|
'docker',
|
|
58
|
+
'dotnet',
|
|
52
59
|
'echo',
|
|
53
60
|
'env',
|
|
54
61
|
'exec',
|
|
@@ -60,6 +67,7 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
60
67
|
'false',
|
|
61
68
|
'find',
|
|
62
69
|
'gem',
|
|
70
|
+
'gh',
|
|
63
71
|
'git',
|
|
64
72
|
'grep',
|
|
65
73
|
'groups',
|
|
@@ -86,12 +94,17 @@ export const IGNORED_GLOBAL_BINARIES = new Set([
|
|
|
86
94
|
'npx',
|
|
87
95
|
'nub',
|
|
88
96
|
'nubx',
|
|
97
|
+
'open',
|
|
89
98
|
'paste',
|
|
90
99
|
'pnpm',
|
|
91
100
|
'pnpx',
|
|
101
|
+
'powershell',
|
|
102
|
+
'powershell.exe',
|
|
92
103
|
'pr',
|
|
93
104
|
'printenv',
|
|
94
105
|
'pwd',
|
|
106
|
+
'python',
|
|
107
|
+
'python3',
|
|
95
108
|
'rm',
|
|
96
109
|
'rmdir',
|
|
97
110
|
'rsync',
|
|
@@ -186,6 +199,7 @@ export const ISSUE_TYPES = [
|
|
|
186
199
|
'namespaceMembers',
|
|
187
200
|
'duplicates',
|
|
188
201
|
'catalog',
|
|
202
|
+
'cycles',
|
|
189
203
|
];
|
|
190
204
|
export const ISSUE_TYPE_TITLE = {
|
|
191
205
|
files: 'Unused files',
|
|
@@ -203,6 +217,7 @@ export const ISSUE_TYPE_TITLE = {
|
|
|
203
217
|
namespaceMembers: 'Unused exported namespace members',
|
|
204
218
|
duplicates: 'Duplicate exports',
|
|
205
219
|
catalog: 'Unused catalog entries',
|
|
220
|
+
cycles: 'Circular dependencies',
|
|
206
221
|
};
|
|
207
222
|
export const SYMBOL_TYPE = {
|
|
208
223
|
CLASS: 'class',
|
|
@@ -223,6 +238,7 @@ export const FIX_FLAGS = {
|
|
|
223
238
|
};
|
|
224
239
|
export const SIDE_EFFECTS = '__side-effects';
|
|
225
240
|
export const OPAQUE = '__opaque';
|
|
241
|
+
export const SCRIPT_INTERPOLATION = '$__knip__';
|
|
226
242
|
export const IMPORT_FLAGS = {
|
|
227
243
|
NONE: 0,
|
|
228
244
|
RE_EXPORT: 1 << 0,
|
|
@@ -232,4 +248,6 @@ export const IMPORT_FLAGS = {
|
|
|
232
248
|
OPTIONAL: 1 << 4,
|
|
233
249
|
SIDE_EFFECTS: 1 << 5,
|
|
234
250
|
OPAQUE: 1 << 6,
|
|
251
|
+
AUGMENT: 1 << 7,
|
|
252
|
+
DYNAMIC: 1 << 8,
|
|
235
253
|
};
|
package/dist/graph/analyze.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { createGraphExplorer } from '../graph-explorer/explorer.js';
|
|
2
|
-
import { getIssueType, hasStrictlyEnumReferences } from '../graph-explorer/utils.js';
|
|
2
|
+
import { getIgnoredCycleImportFlags, getIssueType, getRuntimeImport, hasStrictlyEnumReferences, } from '../graph-explorer/utils.js';
|
|
3
3
|
import traceReporter from '../reporters/trace.js';
|
|
4
4
|
import { shouldCountRefs } from '../typescript/ast-nodes.js';
|
|
5
5
|
import { getPackageNameFromModuleSpecifier } from '../util/modules.js';
|
|
6
|
-
import {
|
|
6
|
+
import { relative } from '../util/path.js';
|
|
7
|
+
import { perfObserver, timerify } from '../util/Performance.js';
|
|
7
8
|
import { findMatch } from '../util/regex.js';
|
|
8
9
|
import { getShouldIgnoreHandler, getShouldIgnoreTagHandler, isAlwaysIgnored } from '../util/tag.js';
|
|
9
10
|
import { INTERNAL_TAG } from '../constants.js';
|
|
11
|
+
const toCyclePathKey = (path) => {
|
|
12
|
+
const length = path.length > 1 && path[0] === path[path.length - 1] ? path.length - 1 : path.length;
|
|
13
|
+
return path.slice(0, length).join('\0');
|
|
14
|
+
};
|
|
15
|
+
const getAllowedCyclePaths = (cycles) => {
|
|
16
|
+
if (!cycles.allow?.length)
|
|
17
|
+
return;
|
|
18
|
+
const paths = new Set();
|
|
19
|
+
for (const path of cycles.allow)
|
|
20
|
+
if (path.length > 0)
|
|
21
|
+
paths.add(toCyclePathKey(path));
|
|
22
|
+
return paths;
|
|
23
|
+
};
|
|
24
|
+
const isAllowedCycle = (symbols, paths) => paths?.has(toCyclePathKey(symbols.map(s => s.symbol))) ?? false;
|
|
10
25
|
export const analyze = async ({ analyzedFiles, counselor, chief, collector, deputy, entryPaths, graph, streamer, unreferencedFiles, options, }) => {
|
|
11
26
|
const shouldIgnore = getShouldIgnoreHandler(options.isProduction);
|
|
12
27
|
const shouldIgnoreTags = getShouldIgnoreTagHandler(options.tags);
|
|
@@ -210,6 +225,26 @@ export const analyze = async ({ analyzedFiles, counselor, chief, collector, depu
|
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
227
|
}
|
|
228
|
+
if (options.isReportCycles) {
|
|
229
|
+
const cyclesConfig = chief.config.cycles;
|
|
230
|
+
const allowedCyclePaths = getAllowedCyclePaths(cyclesConfig);
|
|
231
|
+
const ignoredFlags = getIgnoredCycleImportFlags(cyclesConfig.dynamicImports ?? false);
|
|
232
|
+
for (const cycle of timerify(explorer.findAllCycles, 'findAllCycles')(ignoredFlags)) {
|
|
233
|
+
const filePath = cycle[0];
|
|
234
|
+
const ws = chief.findWorkspaceByFilePath(filePath);
|
|
235
|
+
if (!ws)
|
|
236
|
+
continue;
|
|
237
|
+
const symbols = cycle.slice(0, -1).map((file, index) => {
|
|
238
|
+
const node = graph.get(file);
|
|
239
|
+
const edge = node && getRuntimeImport(node, cycle[index + 1], ignoredFlags);
|
|
240
|
+
return edge ? { symbol: relative(options.cwd, file), ...edge } : { symbol: relative(options.cwd, file) };
|
|
241
|
+
});
|
|
242
|
+
if (isAllowedCycle(symbols, allowedCyclePaths))
|
|
243
|
+
continue;
|
|
244
|
+
const symbol = symbols.map(s => s.symbol).join(' → ');
|
|
245
|
+
collector.addIssue({ type: 'cycles', filePath, workspace: ws.name, symbol, symbols, fixes: [] });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
213
248
|
const unusedFiles = options.isReportFiles
|
|
214
249
|
? [...unreferencedFiles].filter(filePath => !analyzedFiles.has(filePath))
|
|
215
250
|
: [];
|
package/dist/graph/build.js
CHANGED
|
@@ -10,6 +10,8 @@ import { tryRealpath } from '../util/fs.js';
|
|
|
10
10
|
import { createManifest } from '../util/package-json.js';
|
|
11
11
|
import { _glob, _syncGlob, negate, prependDirToPattern as prependDir } from '../util/glob.js';
|
|
12
12
|
import { isAlias, isConfig, isDeferResolveEntry, isDeferResolveProductionEntry, isEntry, isIgnore, isProductionEntry, isProject, toProductionEntry, } from '../util/input.js';
|
|
13
|
+
import { isAmbientDeclarationFile } from '../typescript/ast-nodes.js';
|
|
14
|
+
import { resolveImportGlobs } from '../typescript/glob-imports.js';
|
|
13
15
|
import { loadTSConfig } from '../util/load-tsconfig.js';
|
|
14
16
|
import { createFileNode, updateImportMap } from '../util/module-graph.js';
|
|
15
17
|
import { getPackageNameFromModuleSpecifier, isStartsLikePackageName, sanitizeSpecifier } from '../util/modules.js';
|
|
@@ -90,7 +92,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
90
92
|
options,
|
|
91
93
|
});
|
|
92
94
|
await worker.init();
|
|
93
|
-
const compilers = getIncludedCompilers(chief.config.syncCompilers, chief.config.asyncCompilers, dependencies, dep => deputy.addReferencedDependency(name, dep));
|
|
95
|
+
const compilers = getIncludedCompilers(new Map(chief.config.syncCompilers), new Map(chief.config.asyncCompilers), dependencies, dep => deputy.addReferencedDependency(name, dep));
|
|
94
96
|
const registerCompiler = async ({ extension, compiler }) => {
|
|
95
97
|
const ext = normalizeCompilerExtension(extension);
|
|
96
98
|
if (compilers[0].has(ext))
|
|
@@ -118,7 +120,8 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
118
120
|
const entrySpecifiersFromManifest = getEntrySpecifiersFromManifest(manifest);
|
|
119
121
|
const label = 'entry paths from package.json';
|
|
120
122
|
for (const filePath of await toSourceFilePaths(entrySpecifiersFromManifest, dir, extensionGlobStr, label)) {
|
|
121
|
-
|
|
123
|
+
if (!isGitIgnored(filePath))
|
|
124
|
+
inputs.add(toProductionEntry(filePath));
|
|
122
125
|
}
|
|
123
126
|
for (const identifier of entrySpecifiersFromManifest) {
|
|
124
127
|
if (identifier.startsWith('!') || isGitIgnored(join(dir, identifier)))
|
|
@@ -382,6 +385,13 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
382
385
|
pp.addEntryPath(specifierFilePath, { skipExportsAnalysis: true });
|
|
383
386
|
}
|
|
384
387
|
}
|
|
388
|
+
if (file.importGlobs.length > 0) {
|
|
389
|
+
const globbed = resolveImportGlobs(file.importGlobs, filePath, pp.resolveGlobPattern, workspace.dir);
|
|
390
|
+
for (const importedFilePath of globbed) {
|
|
391
|
+
if (!isGitIgnored(importedFilePath))
|
|
392
|
+
pp.addEntryPath(importedFilePath, { skipExportsAnalysis: true });
|
|
393
|
+
}
|
|
394
|
+
}
|
|
385
395
|
file.imports.unresolved = unresolvedImports;
|
|
386
396
|
const pluginRefs = externalRefsFromInputs?.get(filePath);
|
|
387
397
|
if (pluginRefs)
|
|
@@ -393,6 +403,7 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
393
403
|
node.exports = file.exports;
|
|
394
404
|
node.duplicates = file.duplicates;
|
|
395
405
|
node.scripts = file.scripts;
|
|
406
|
+
node.importGlobs = file.importGlobs;
|
|
396
407
|
updateImportMap(node, file.imports.internal, graph);
|
|
397
408
|
node.internalImportCache = file.imports.internal;
|
|
398
409
|
}
|
|
@@ -421,8 +432,11 @@ export async function build({ chief, collector, counselor, deputy, principal, is
|
|
|
421
432
|
}
|
|
422
433
|
return paths;
|
|
423
434
|
});
|
|
424
|
-
for (const filePath of principal.getUnreferencedFiles())
|
|
435
|
+
for (const filePath of principal.getUnreferencedFiles()) {
|
|
436
|
+
if (IS_DTS.test(filePath) && isAmbientDeclarationFile(filePath, principal.readFile(filePath)))
|
|
437
|
+
continue;
|
|
425
438
|
unreferencedFiles.add(filePath);
|
|
439
|
+
}
|
|
426
440
|
for (const filePath of principal.entryPaths)
|
|
427
441
|
entryPaths.add(filePath);
|
|
428
442
|
principal.reconcileCache(graph);
|
|
@@ -13,6 +13,7 @@ export declare const createGraphExplorer: (graph: ModuleGraph, entryPaths: Set<s
|
|
|
13
13
|
resolveDefinition: (filePath: string, identifier: string) => import("./operations/resolve-definition.ts").DefinitionResult | null;
|
|
14
14
|
getUsage: (filePath: string, identifier: string) => import("./operations/get-usage.ts").UsageResult;
|
|
15
15
|
findCycles: (filePath: string, maxDepth?: number) => import("../session/types.ts").Cycle[];
|
|
16
|
+
findAllCycles: (ignoredFlags?: number) => import("../session/types.ts").Cycle[];
|
|
16
17
|
getContention: (filePath: string) => Map<string, import("../session/types.ts").ContentionDetails>;
|
|
17
18
|
invalidateCache: () => void;
|
|
18
19
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { invalidateCache as invalidateCacheInternal } from './cache.js';
|
|
2
2
|
import { buildExportsTree } from './operations/build-exports-tree.js';
|
|
3
|
+
import { findAllCycles } from './operations/find-all-cycles.js';
|
|
3
4
|
import { findCycles } from './operations/find-cycles.js';
|
|
4
5
|
import { getContention } from './operations/get-contention.js';
|
|
5
6
|
import { getDependencyUsage } from './operations/get-dependency-usage.js';
|
|
@@ -16,6 +17,7 @@ export const createGraphExplorer = (graph, entryPaths) => {
|
|
|
16
17
|
resolveDefinition: (filePath, identifier) => resolveDefinition(graph, filePath, identifier),
|
|
17
18
|
getUsage: (filePath, identifier) => getUsage(graph, entryPaths, filePath, identifier),
|
|
18
19
|
findCycles: (filePath, maxDepth) => findCycles(graph, filePath, maxDepth),
|
|
20
|
+
findAllCycles: (ignoredFlags) => findAllCycles(graph, ignoredFlags),
|
|
19
21
|
getContention: (filePath) => getContention(graph, filePath),
|
|
20
22
|
invalidateCache: () => invalidateCacheInternal(graph),
|
|
21
23
|
};
|