knip 5.0.3 → 5.1.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 +3 -2
- package/dist/ConfigurationValidator.d.ts +56 -0
- package/dist/ConfigurationValidator.js +1 -0
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/binaries/resolvers/index.d.ts +12 -12
- package/dist/compilers/index.d.ts +10 -0
- package/dist/plugins/graphql-codegen/index.js +1 -1
- package/dist/plugins/husky/index.js +3 -18
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/linthtml/index.js +1 -0
- package/dist/plugins/msw/index.d.ts +10 -0
- package/dist/plugins/msw/index.js +23 -0
- package/dist/plugins/msw/types.d.ts +3 -0
- package/dist/plugins/msw/types.js +1 -0
- package/dist/plugins/next/index.js +1 -2
- package/dist/reporters/index.d.ts +5 -5
- package/dist/typescript/resolveModuleNames.js +32 -4
- package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/importCall.js +1 -1
- package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
- package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
- package/dist/typescript/visitors/exports/index.d.ts +1 -1
- package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/imports/index.d.ts +1 -1
- package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
- package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
- package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
- package/dist/typescript/visitors/scripts/index.d.ts +1 -1
- package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
- package/dist/util/fs.d.ts +1 -1
- package/dist/util/fs.js +1 -1
- package/dist/util/loader.js +14 -5
- package/dist/util/path.d.ts +3 -0
- package/dist/util/path.js +1 -0
- package/dist/util/tsconfig-loader.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -11
- package/schema.json +4 -0
|
@@ -40,7 +40,7 @@ export declare class ConfigurationChief {
|
|
|
40
40
|
constructor({ cwd, isProduction, isStrict, isIncludeEntryExports }: ConfigurationManagerOptions);
|
|
41
41
|
init(): Promise<void>;
|
|
42
42
|
private loadResolvedConfigurationFile;
|
|
43
|
-
getRules(): import("
|
|
43
|
+
getRules(): import("src/types/issues.js").Rules;
|
|
44
44
|
getFilters(): {
|
|
45
45
|
dir: string;
|
|
46
46
|
} | {
|
|
@@ -90,6 +90,7 @@ export declare class ConfigurationChief {
|
|
|
90
90
|
linthtml?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
91
91
|
markdownlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
92
92
|
mocha?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
93
|
+
msw?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
93
94
|
netlify?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
94
95
|
next?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
95
96
|
nx?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -129,7 +130,7 @@ export declare class ConfigurationChief {
|
|
|
129
130
|
ignore: string[];
|
|
130
131
|
isIncludeEntryExports: any;
|
|
131
132
|
};
|
|
132
|
-
getIncludedIssueTypes(): import("
|
|
133
|
+
getIncludedIssueTypes(): import("src/types/issues.js").Report;
|
|
133
134
|
findWorkspaceByFilePath(filePath: string): Workspace | undefined;
|
|
134
135
|
findWorkspaceByName(name: string): Workspace | undefined;
|
|
135
136
|
getUnusedIgnoredWorkspaces(): string[];
|
|
@@ -322,6 +322,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
322
322
|
entry?: string | string[] | undefined;
|
|
323
323
|
project?: string | string[] | undefined;
|
|
324
324
|
}>]>>;
|
|
325
|
+
msw: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
326
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
327
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
328
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
config?: string | string[] | undefined;
|
|
331
|
+
entry?: string | string[] | undefined;
|
|
332
|
+
project?: string | string[] | undefined;
|
|
333
|
+
}, {
|
|
334
|
+
config?: string | string[] | undefined;
|
|
335
|
+
entry?: string | string[] | undefined;
|
|
336
|
+
project?: string | string[] | undefined;
|
|
337
|
+
}>]>>;
|
|
325
338
|
netlify: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
326
339
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
327
340
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -856,6 +869,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
856
869
|
entry?: string | string[] | undefined;
|
|
857
870
|
project?: string | string[] | undefined;
|
|
858
871
|
} | undefined;
|
|
872
|
+
msw?: string | boolean | string[] | {
|
|
873
|
+
config?: string | string[] | undefined;
|
|
874
|
+
entry?: string | string[] | undefined;
|
|
875
|
+
project?: string | string[] | undefined;
|
|
876
|
+
} | undefined;
|
|
859
877
|
netlify?: string | boolean | string[] | {
|
|
860
878
|
config?: string | string[] | undefined;
|
|
861
879
|
entry?: string | string[] | undefined;
|
|
@@ -1134,6 +1152,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1134
1152
|
entry?: string | string[] | undefined;
|
|
1135
1153
|
project?: string | string[] | undefined;
|
|
1136
1154
|
} | undefined;
|
|
1155
|
+
msw?: string | boolean | string[] | {
|
|
1156
|
+
config?: string | string[] | undefined;
|
|
1157
|
+
entry?: string | string[] | undefined;
|
|
1158
|
+
project?: string | string[] | undefined;
|
|
1159
|
+
} | undefined;
|
|
1137
1160
|
netlify?: string | boolean | string[] | {
|
|
1138
1161
|
config?: string | string[] | undefined;
|
|
1139
1162
|
entry?: string | string[] | undefined;
|
|
@@ -1581,6 +1604,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1581
1604
|
entry?: string | string[] | undefined;
|
|
1582
1605
|
project?: string | string[] | undefined;
|
|
1583
1606
|
}>]>>;
|
|
1607
|
+
msw: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1608
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1609
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1610
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1611
|
+
}, "strip", z.ZodTypeAny, {
|
|
1612
|
+
config?: string | string[] | undefined;
|
|
1613
|
+
entry?: string | string[] | undefined;
|
|
1614
|
+
project?: string | string[] | undefined;
|
|
1615
|
+
}, {
|
|
1616
|
+
config?: string | string[] | undefined;
|
|
1617
|
+
entry?: string | string[] | undefined;
|
|
1618
|
+
project?: string | string[] | undefined;
|
|
1619
|
+
}>]>>;
|
|
1584
1620
|
netlify: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1585
1621
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1586
1622
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -2131,6 +2167,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2131
2167
|
entry?: string | string[] | undefined;
|
|
2132
2168
|
project?: string | string[] | undefined;
|
|
2133
2169
|
} | undefined;
|
|
2170
|
+
msw?: string | boolean | string[] | {
|
|
2171
|
+
config?: string | string[] | undefined;
|
|
2172
|
+
entry?: string | string[] | undefined;
|
|
2173
|
+
project?: string | string[] | undefined;
|
|
2174
|
+
} | undefined;
|
|
2134
2175
|
netlify?: string | boolean | string[] | {
|
|
2135
2176
|
config?: string | string[] | undefined;
|
|
2136
2177
|
entry?: string | string[] | undefined;
|
|
@@ -2402,6 +2443,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2402
2443
|
entry?: string | string[] | undefined;
|
|
2403
2444
|
project?: string | string[] | undefined;
|
|
2404
2445
|
} | undefined;
|
|
2446
|
+
msw?: string | boolean | string[] | {
|
|
2447
|
+
config?: string | string[] | undefined;
|
|
2448
|
+
entry?: string | string[] | undefined;
|
|
2449
|
+
project?: string | string[] | undefined;
|
|
2450
|
+
} | undefined;
|
|
2405
2451
|
netlify?: string | boolean | string[] | {
|
|
2406
2452
|
config?: string | string[] | undefined;
|
|
2407
2453
|
entry?: string | string[] | undefined;
|
|
@@ -2696,6 +2742,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2696
2742
|
entry?: string | string[] | undefined;
|
|
2697
2743
|
project?: string | string[] | undefined;
|
|
2698
2744
|
} | undefined;
|
|
2745
|
+
msw?: string | boolean | string[] | {
|
|
2746
|
+
config?: string | string[] | undefined;
|
|
2747
|
+
entry?: string | string[] | undefined;
|
|
2748
|
+
project?: string | string[] | undefined;
|
|
2749
|
+
} | undefined;
|
|
2699
2750
|
netlify?: string | boolean | string[] | {
|
|
2700
2751
|
config?: string | string[] | undefined;
|
|
2701
2752
|
entry?: string | string[] | undefined;
|
|
@@ -2967,6 +3018,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2967
3018
|
entry?: string | string[] | undefined;
|
|
2968
3019
|
project?: string | string[] | undefined;
|
|
2969
3020
|
} | undefined;
|
|
3021
|
+
msw?: string | boolean | string[] | {
|
|
3022
|
+
config?: string | string[] | undefined;
|
|
3023
|
+
entry?: string | string[] | undefined;
|
|
3024
|
+
project?: string | string[] | undefined;
|
|
3025
|
+
} | undefined;
|
|
2970
3026
|
netlify?: string | boolean | string[] | {
|
|
2971
3027
|
config?: string | string[] | undefined;
|
|
2972
3028
|
entry?: string | string[] | undefined;
|
|
@@ -59,7 +59,7 @@ export declare class ProjectPrincipal {
|
|
|
59
59
|
};
|
|
60
60
|
exports: {
|
|
61
61
|
exported: import("./types/exports.js").SerializableExports;
|
|
62
|
-
duplicate: import("
|
|
62
|
+
duplicate: import("src/types/issues.js").IssueSymbol[][];
|
|
63
63
|
};
|
|
64
64
|
scripts: Set<string>;
|
|
65
65
|
};
|
|
@@ -27,7 +27,7 @@ export declare class WorkspaceWorker {
|
|
|
27
27
|
isStrict: boolean;
|
|
28
28
|
rootIgnore: Configuration['ignore'];
|
|
29
29
|
negatedWorkspacePatterns: string[];
|
|
30
|
-
enabledPluginsMap: Record<"typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg", boolean>;
|
|
30
|
+
enabledPluginsMap: Record<"typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "msw" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg", boolean>;
|
|
31
31
|
enabledPlugins: PluginName[];
|
|
32
32
|
enabledPluginsInAncestors: string[];
|
|
33
33
|
constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }: WorkspaceManagerOptions);
|
|
@@ -46,7 +46,7 @@ export declare class WorkspaceWorker {
|
|
|
46
46
|
entryFilePatterns: Set<string>;
|
|
47
47
|
productionEntryFilePatterns: Set<string>;
|
|
48
48
|
referencedDependencies: ReferencedDependencies;
|
|
49
|
-
enabledPlugins: ("typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg")[];
|
|
49
|
+
enabledPlugins: ("typescript" | "astro" | "svelte" | "vue" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "msw" | "netlify" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "tailwind" | "tsup" | "typedoc" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "vercelOg")[];
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
52
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
bun: import("
|
|
3
|
-
c8: import("
|
|
4
|
-
dotenv: import("
|
|
5
|
-
node: import("
|
|
6
|
-
nodemon: import("
|
|
7
|
-
npx: import("
|
|
8
|
-
nx: import("
|
|
9
|
-
pnpm: import("
|
|
10
|
-
rollup: import("
|
|
11
|
-
'ts-node': import("
|
|
12
|
-
tsx: import("
|
|
13
|
-
yarn: import("
|
|
2
|
+
bun: import("src/binaries/types.js").Resolver;
|
|
3
|
+
c8: import("src/binaries/types.js").Resolver;
|
|
4
|
+
dotenv: import("src/binaries/types.js").Resolver;
|
|
5
|
+
node: import("src/binaries/types.js").Resolver;
|
|
6
|
+
nodemon: import("src/binaries/types.js").Resolver;
|
|
7
|
+
npx: import("src/binaries/types.js").Resolver;
|
|
8
|
+
nx: import("src/binaries/types.js").Resolver;
|
|
9
|
+
pnpm: import("src/binaries/types.js").Resolver;
|
|
10
|
+
rollup: import("src/binaries/types.js").Resolver;
|
|
11
|
+
'ts-node': import("src/binaries/types.js").Resolver;
|
|
12
|
+
tsx: import("src/binaries/types.js").Resolver;
|
|
13
|
+
yarn: import("src/binaries/types.js").Resolver;
|
|
14
14
|
};
|
|
15
15
|
export default _default;
|
|
@@ -135,6 +135,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
135
135
|
entry?: string | string[] | undefined;
|
|
136
136
|
project?: string | string[] | undefined;
|
|
137
137
|
} | undefined;
|
|
138
|
+
msw?: string | boolean | string[] | {
|
|
139
|
+
config?: string | string[] | undefined;
|
|
140
|
+
entry?: string | string[] | undefined;
|
|
141
|
+
project?: string | string[] | undefined;
|
|
142
|
+
} | undefined;
|
|
138
143
|
netlify?: string | boolean | string[] | {
|
|
139
144
|
config?: string | string[] | undefined;
|
|
140
145
|
entry?: string | string[] | undefined;
|
|
@@ -406,6 +411,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
406
411
|
entry?: string | string[] | undefined;
|
|
407
412
|
project?: string | string[] | undefined;
|
|
408
413
|
} | undefined;
|
|
414
|
+
msw?: string | boolean | string[] | {
|
|
415
|
+
config?: string | string[] | undefined;
|
|
416
|
+
entry?: string | string[] | undefined;
|
|
417
|
+
project?: string | string[] | undefined;
|
|
418
|
+
} | undefined;
|
|
409
419
|
netlify?: string | boolean | string[] | {
|
|
410
420
|
config?: string | string[] | undefined;
|
|
411
421
|
entry?: string | string[] | undefined;
|
|
@@ -20,7 +20,7 @@ const findPluginDependencies = async (configFilePath, options) => {
|
|
|
20
20
|
const localConfig = basename(configFilePath) === 'package.json' ? manifest[PACKAGE_JSON_PATH] : await load(configFilePath);
|
|
21
21
|
if (!localConfig)
|
|
22
22
|
return [];
|
|
23
|
-
const generateSet = Object.values(localConfig.generates);
|
|
23
|
+
const generateSet = localConfig.generates ? Object.values(localConfig.generates) : [];
|
|
24
24
|
const configurationOutput = generateSet.filter(isConfigurationOutput);
|
|
25
25
|
const presets = configurationOutput
|
|
26
26
|
.map(configOutput => (configOutput.preset ? configOutput.preset : undefined))
|
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
import semver from 'semver';
|
|
2
1
|
import { getGitHookPaths } from '../../util/git.js';
|
|
3
2
|
import { timerify } from '../../util/Performance.js';
|
|
4
3
|
import { getDependenciesFromScripts, hasDependency, loadFile } from '../../util/plugin.js';
|
|
5
4
|
const NAME = 'husky';
|
|
6
5
|
const ENABLERS = ['husky'];
|
|
7
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const CONFIG_FILE_PATTERNS = [...gitHooksPathInV8, ...gitHookPathsInV9];
|
|
7
|
+
const gitHookPaths = getGitHookPaths('.husky', false);
|
|
8
|
+
const CONFIG_FILE_PATTERNS = [...gitHookPaths];
|
|
11
9
|
const findHuskyDependencies = async (configFilePath, options) => {
|
|
12
|
-
const { isProduction
|
|
10
|
+
const { isProduction } = options;
|
|
13
11
|
if (isProduction)
|
|
14
12
|
return [];
|
|
15
|
-
const huskyVersion = manifest.devDependencies?.husky ?? manifest.dependencies?.husky ?? '*';
|
|
16
|
-
const isV8OrLower = semver.intersects(huskyVersion, '<9', {
|
|
17
|
-
includePrerelease: true,
|
|
18
|
-
});
|
|
19
|
-
if (!isV8OrLower && gitHooksPathInV8.some(path => configFilePath.includes(path))) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
const isV9OrHigher = semver.intersects(huskyVersion, '>=9', {
|
|
23
|
-
includePrerelease: true,
|
|
24
|
-
});
|
|
25
|
-
if (!isV9OrHigher && gitHookPathsInV9.some(path => configFilePath.includes(path))) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
13
|
const script = await loadFile(configFilePath);
|
|
29
14
|
if (!script)
|
|
30
15
|
return [];
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as lintStaged } from './lint-staged/index.js';
|
|
|
21
21
|
export { default as linthtml } from './linthtml/index.js';
|
|
22
22
|
export { default as markdownlint } from './markdownlint/index.js';
|
|
23
23
|
export { default as mocha } from './mocha/index.js';
|
|
24
|
+
export { default as msw } from './msw/index.js';
|
|
24
25
|
export { default as netlify } from './netlify/index.js';
|
|
25
26
|
export { default as next } from './next/index.js';
|
|
26
27
|
export { default as nodeTestRunner } from './node-test-runner/index.js';
|
package/dist/plugins/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { default as lintStaged } from './lint-staged/index.js';
|
|
|
21
21
|
export { default as linthtml } from './linthtml/index.js';
|
|
22
22
|
export { default as markdownlint } from './markdownlint/index.js';
|
|
23
23
|
export { default as mocha } from './mocha/index.js';
|
|
24
|
+
export { default as msw } from './msw/index.js';
|
|
24
25
|
export { default as netlify } from './netlify/index.js';
|
|
25
26
|
export { default as next } from './next/index.js';
|
|
26
27
|
export { default as nodeTestRunner } from './node-test-runner/index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GenericPluginCallback, IsPluginEnabledCallback } from '../../types/plugins.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
NAME: string;
|
|
4
|
+
ENABLERS: string[];
|
|
5
|
+
isEnabled: IsPluginEnabledCallback;
|
|
6
|
+
CONFIG_FILE_PATTERNS: string[];
|
|
7
|
+
ENTRY_FILE_PATTERNS: string[];
|
|
8
|
+
findDependencies: GenericPluginCallback;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { join } from '../../util/path.js';
|
|
2
|
+
import { basename } from '../../util/path.js';
|
|
3
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
4
|
+
import { toEntryPattern } from '../../util/protocols.js';
|
|
5
|
+
const NAME = 'Mock Service Worker';
|
|
6
|
+
const ENABLERS = ['msw'];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
8
|
+
const CONFIG_FILE_PATTERNS = ['package.json'];
|
|
9
|
+
const ENTRY_FILE_PATTERNS = ['mockServiceWorker.js'];
|
|
10
|
+
const findDependencies = async (configFilePath, options) => {
|
|
11
|
+
const { manifest } = options;
|
|
12
|
+
const localConfig = basename(configFilePath) === 'package.json' ? manifest.msw : undefined;
|
|
13
|
+
const workerDirectory = localConfig?.workerDirectory ?? '.';
|
|
14
|
+
return ENTRY_FILE_PATTERNS.map(pattern => toEntryPattern(join(workerDirectory, pattern)));
|
|
15
|
+
};
|
|
16
|
+
export default {
|
|
17
|
+
NAME,
|
|
18
|
+
ENABLERS,
|
|
19
|
+
isEnabled,
|
|
20
|
+
CONFIG_FILE_PATTERNS,
|
|
21
|
+
ENTRY_FILE_PATTERNS,
|
|
22
|
+
findDependencies,
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,8 +8,7 @@ const productionEntryFilePatternsWithoutSrc = [
|
|
|
8
8
|
'{instrumentation,middleware}.{js,ts}',
|
|
9
9
|
'app/global-error.{js,jsx,ts,tsx}',
|
|
10
10
|
'app/**/{error,layout,loading,not-found,page,template}.{js,jsx,ts,tsx}',
|
|
11
|
-
'app/**/route.{js,ts}',
|
|
12
|
-
'app/**/default.{js,jsx,ts,tsx}',
|
|
11
|
+
'app/**/{route,default}.{js,ts}',
|
|
13
12
|
'app/{manifest,sitemap,robots}.{js,ts}',
|
|
14
13
|
'app/**/{icon,apple-icon}.{js,jsx,ts,tsx}',
|
|
15
14
|
'app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
symbols: ({ report, issues, configurationHints, noConfigHints, isShowProgress }: import("
|
|
3
|
-
compact: ({ report, issues, isShowProgress }: import("
|
|
4
|
-
codeowners: ({ report, issues, isShowProgress, options }: import("
|
|
5
|
-
json: ({ report, issues, options }: import("
|
|
6
|
-
markdown: ({ report, issues }: import("
|
|
2
|
+
symbols: ({ report, issues, configurationHints, noConfigHints, isShowProgress }: import("src/index.js").ReporterOptions) => void;
|
|
3
|
+
compact: ({ report, issues, isShowProgress }: import("src/index.js").ReporterOptions) => void;
|
|
4
|
+
codeowners: ({ report, issues, isShowProgress, options }: import("src/index.js").ReporterOptions) => void;
|
|
5
|
+
json: ({ report, issues, options }: import("src/index.js").ReporterOptions) => Promise<void>;
|
|
6
|
+
markdown: ({ report, issues }: import("src/index.js").ReporterOptions) => void;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
@@ -2,7 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { isBuiltin } from 'node:module';
|
|
3
3
|
import ts from 'typescript';
|
|
4
4
|
import { sanitizeSpecifier } from '../util/modules.js';
|
|
5
|
-
import { dirname, extname, isAbsolute, isInternal, join } from '../util/path.js';
|
|
5
|
+
import { basename, dirname, extname, format, isAbsolute, isInternal, join } from '../util/path.js';
|
|
6
6
|
import { isDeclarationFileExtension } from './ast-helpers.js';
|
|
7
7
|
import { ensureRealFilePath, isVirtualFilePath } from './utils.js';
|
|
8
8
|
const resolutionCache = new Map();
|
|
@@ -17,6 +17,27 @@ const fileExists = (name, containingFile) => {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
+
const DECLARATION_EXTENSIONS_MAP = {
|
|
21
|
+
[ts.Extension.Dts]: ts.Extension.Js,
|
|
22
|
+
[ts.Extension.Dmts]: ts.Extension.Mjs,
|
|
23
|
+
[ts.Extension.Dcts]: ts.Extension.Cjs,
|
|
24
|
+
};
|
|
25
|
+
const jsMatchingDeclarationFileExists = (resolveDtsFileName, declarationFileExtension) => {
|
|
26
|
+
const mappedExtension = DECLARATION_EXTENSIONS_MAP[declarationFileExtension];
|
|
27
|
+
const resolvedFileName = format({
|
|
28
|
+
ext: mappedExtension,
|
|
29
|
+
dir: dirname(resolveDtsFileName),
|
|
30
|
+
name: basename(resolveDtsFileName, declarationFileExtension),
|
|
31
|
+
});
|
|
32
|
+
if (existsSync(resolvedFileName)) {
|
|
33
|
+
return {
|
|
34
|
+
resolvedFileName,
|
|
35
|
+
extension: mappedExtension,
|
|
36
|
+
isExternalLibraryImport: false,
|
|
37
|
+
resolvedUsingTsExtension: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
20
41
|
export function createCustomModuleResolver(customSys, compilerOptions, virtualFileExtensions) {
|
|
21
42
|
function resolveModuleNames(moduleNames, containingFile) {
|
|
22
43
|
return moduleNames.map(moduleName => {
|
|
@@ -46,9 +67,16 @@ export function createCustomModuleResolver(customSys, compilerOptions, virtualFi
|
|
|
46
67
|
if (tsResolvedModule &&
|
|
47
68
|
isDeclarationFileExtension(tsResolvedModule?.extension) &&
|
|
48
69
|
isInternal(tsResolvedModule.resolvedFileName)) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
{
|
|
71
|
+
const module = jsMatchingDeclarationFileExists(tsResolvedModule.resolvedFileName, tsResolvedModule.extension);
|
|
72
|
+
if (module)
|
|
73
|
+
return module;
|
|
74
|
+
}
|
|
75
|
+
{
|
|
76
|
+
const module = fileExists(sanitizedSpecifier, containingFile);
|
|
77
|
+
if (module)
|
|
78
|
+
return module;
|
|
79
|
+
}
|
|
52
80
|
}
|
|
53
81
|
if (virtualFileExtensions.length === 0)
|
|
54
82
|
return tsResolvedModule;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -19,7 +19,7 @@ export default visit(() => true, node => {
|
|
|
19
19
|
const callExpression = node.parent.parent;
|
|
20
20
|
if (ts.isCallExpression(callExpression) && ts.isFunctionLike(callExpression.arguments[0])) {
|
|
21
21
|
const arg = callExpression.arguments[0].parameters[0];
|
|
22
|
-
if (ts.isIdentifier(arg.name)) {
|
|
22
|
+
if (arg && ts.isIdentifier(arg.name)) {
|
|
23
23
|
const argName = arg.name.escapedText;
|
|
24
24
|
const accessExpressions = findDescendants(callExpression.arguments[0].body, ts.isPropertyAccessExpression).filter(binding => binding.expression.getText() === argName);
|
|
25
25
|
if (accessExpressions.length > 0) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import type { ImportNode } from '../../../types/imports.js';
|
|
3
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
3
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => ImportNode | ImportNode[] | undefined;
|
|
4
4
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/exports.js").ExportNode | import("src/types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/exports.js").ExportNode | import("src/types/exports.js").ExportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("../../../types/exports.js").ExportNode | import("../../../types/exports.js").ExportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => import("src/types/imports.js").ImportNode | import("src/types/imports.js").ImportNode[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => ((node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[] | undefined)[];
|
|
3
3
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("
|
|
2
|
+
declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("src/typescript/getImportsAndExports.js").GetImportsAndExportsOptions) => string | string[] | undefined;
|
|
3
3
|
export default _default;
|
package/dist/util/fs.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export declare const loadJSON: (filePath: string) => Promise<any>;
|
|
|
6
6
|
export declare const loadYAML: (filePath: string) => Promise<unknown>;
|
|
7
7
|
export declare const loadTOML: (filePath: string) => Promise<Record<string, import("smol-toml").TomlPrimitive>>;
|
|
8
8
|
export declare const parseJSON: (filePath: string, contents: string) => Promise<any>;
|
|
9
|
-
export declare const parseYAML: (contents: string) =>
|
|
9
|
+
export declare const parseYAML: (contents: string) => unknown;
|
|
10
10
|
export declare function isTypeModule(path: string): boolean;
|
|
11
11
|
export declare const _loadJSON: (filePath: string) => Promise<any>;
|
package/dist/util/fs.js
CHANGED
|
@@ -50,7 +50,7 @@ export const parseJSON = async (filePath, contents) => {
|
|
|
50
50
|
throw new LoaderError(`Error parsing ${filePath}`, { cause: error });
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
export const parseYAML =
|
|
53
|
+
export const parseYAML = (contents) => {
|
|
54
54
|
return yaml.load(contents);
|
|
55
55
|
};
|
|
56
56
|
export function isTypeModule(path) {
|
package/dist/util/loader.js
CHANGED
|
@@ -13,16 +13,25 @@ const load = async (filePath) => {
|
|
|
13
13
|
const ext = extname(filePath);
|
|
14
14
|
if (filePath.endsWith('rc')) {
|
|
15
15
|
const contents = await loadFile(filePath);
|
|
16
|
-
|
|
16
|
+
try {
|
|
17
|
+
return parseYAML(contents);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return parseJSON(filePath, contents);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (ext === '.yaml' || ext === '.yml') {
|
|
24
|
+
return await loadYAML(filePath);
|
|
17
25
|
}
|
|
18
26
|
if (ext === '.json' || ext === '.jsonc') {
|
|
19
|
-
return loadJSON(filePath);
|
|
27
|
+
return await loadJSON(filePath);
|
|
20
28
|
}
|
|
21
|
-
if (
|
|
22
|
-
|
|
29
|
+
if (typeof Bun !== 'undefined') {
|
|
30
|
+
const imported = await import(filePath);
|
|
31
|
+
return imported.default ?? imported;
|
|
23
32
|
}
|
|
24
33
|
if (ext === '.toml') {
|
|
25
|
-
return loadTOML(filePath);
|
|
34
|
+
return await loadTOML(filePath);
|
|
26
35
|
}
|
|
27
36
|
if (ext === '.mjs' || (ext === '.js' && isTypeModule(filePath))) {
|
|
28
37
|
const fileUrl = pathToFileURL(filePath);
|
package/dist/util/path.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import path from 'node:path';
|
|
1
3
|
export declare const isAbsolute: (path: string) => boolean;
|
|
2
4
|
export declare const dirname: (path: string) => string;
|
|
3
5
|
export declare const extname: (path: string) => string;
|
|
4
6
|
export declare const basename: (path: string, suffix?: string | undefined) => string;
|
|
7
|
+
export declare const format: (pathObject: path.FormatInputPathObject) => string;
|
|
5
8
|
export declare const join: (...paths: string[]) => string;
|
|
6
9
|
export declare const toPosix: (value: string) => string;
|
|
7
10
|
export declare const cwd: string;
|
package/dist/util/path.js
CHANGED
|
@@ -5,6 +5,7 @@ export const isAbsolute = path.isAbsolute;
|
|
|
5
5
|
export const dirname = path.posix.dirname;
|
|
6
6
|
export const extname = path.posix.extname;
|
|
7
7
|
export const basename = path.posix.basename;
|
|
8
|
+
export const format = path.posix.format;
|
|
8
9
|
export const join = path.posix.join;
|
|
9
10
|
export const toPosix = (value) => value.split(path.sep).join(path.posix.sep);
|
|
10
11
|
export const cwd = directory ? path.posix.resolve(directory) : toPosix(process.cwd());
|
|
@@ -2,12 +2,13 @@ import ts from 'typescript';
|
|
|
2
2
|
import { isFile } from './fs.js';
|
|
3
3
|
import { FAKE_PATH } from './loader.js';
|
|
4
4
|
import { dirname } from './path.js';
|
|
5
|
+
const dtsMatch = /\.d\.(c|m)?ts$/;
|
|
5
6
|
export const loadTSConfig = async (tsConfigFilePath) => {
|
|
6
7
|
if (tsConfigFilePath !== FAKE_PATH && isFile(tsConfigFilePath)) {
|
|
7
8
|
const config = ts.readConfigFile(tsConfigFilePath, ts.sys.readFile);
|
|
8
9
|
const parsedConfig = ts.parseJsonConfigFileContent(config.config, ts.sys, dirname(tsConfigFilePath));
|
|
9
10
|
const compilerOptions = parsedConfig.options ?? {};
|
|
10
|
-
const definitionPaths = parsedConfig.fileNames.filter(filePath =>
|
|
11
|
+
const definitionPaths = parsedConfig.fileNames.filter(filePath => dtsMatch.test(filePath));
|
|
11
12
|
return { compilerOptions, definitionPaths };
|
|
12
13
|
}
|
|
13
14
|
return { compilerOptions: {}, definitionPaths: [] };
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.0
|
|
1
|
+
export declare const version = "5.1.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.0
|
|
1
|
+
export const version = '5.1.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@npmcli/map-workspaces": "3.0.4",
|
|
59
59
|
"@npmcli/package-json": "5.0.0",
|
|
60
60
|
"@pnpm/logger": "5.0.0",
|
|
61
|
-
"@pnpm/workspace.pkgs-graph": "^2.0.
|
|
61
|
+
"@pnpm/workspace.pkgs-graph": "^2.0.15",
|
|
62
62
|
"@snyk/github-codeowners": "1.1.0",
|
|
63
63
|
"@types/picomatch": "2.3.3",
|
|
64
64
|
"easy-table": "1.2.0",
|
|
@@ -70,12 +70,11 @@
|
|
|
70
70
|
"picocolors": "1.0.0",
|
|
71
71
|
"picomatch": "4.0.1",
|
|
72
72
|
"pretty-ms": "9.0.0",
|
|
73
|
-
"semver": "7.6.0",
|
|
74
73
|
"smol-toml": "1.1.4",
|
|
75
74
|
"strip-json-comments": "5.0.1",
|
|
76
75
|
"summary": "2.1.0",
|
|
77
76
|
"zod": "3.22.4",
|
|
78
|
-
"zod-validation-error": "3.0.
|
|
77
|
+
"zod-validation-error": "3.0.3"
|
|
79
78
|
},
|
|
80
79
|
"peerDependencies": {
|
|
81
80
|
"@types/node": ">=18",
|
|
@@ -85,23 +84,23 @@
|
|
|
85
84
|
"@jest/types": "29.6.3",
|
|
86
85
|
"@knip/eslint-config": "0.0.0",
|
|
87
86
|
"@release-it/bumper": "^6.0.1",
|
|
88
|
-
"@swc/cli": "^0.3.
|
|
89
|
-
"@swc/core": "^1.4.
|
|
87
|
+
"@swc/cli": "^0.3.10",
|
|
88
|
+
"@swc/core": "^1.4.6",
|
|
89
|
+
"@types/bun": "1.0.8",
|
|
90
90
|
"@types/js-yaml": "^4.0.9",
|
|
91
91
|
"@types/micromatch": "^4.0.6",
|
|
92
92
|
"@types/minimist": "^1.2.5",
|
|
93
93
|
"@types/npmcli__map-workspaces": "^3.0.4",
|
|
94
94
|
"@types/npmcli__package-json": "^4.0.4",
|
|
95
|
-
"@types/semver": "7.5.7",
|
|
96
95
|
"@types/webpack": "^5.28.5",
|
|
97
96
|
"c8": "9.1.0",
|
|
98
|
-
"eslint": "^8.
|
|
99
|
-
"playwright": "^1.
|
|
97
|
+
"eslint": "^8.57.0",
|
|
98
|
+
"playwright": "^1.42.1",
|
|
100
99
|
"prettier": "^3.2.5",
|
|
101
100
|
"release-it": "^17.1.1",
|
|
102
101
|
"tsx": "^4.7.1",
|
|
103
|
-
"type-fest": "^4.
|
|
104
|
-
"typescript": "5.
|
|
102
|
+
"type-fest": "^4.12.0",
|
|
103
|
+
"typescript": "5.4.2"
|
|
105
104
|
},
|
|
106
105
|
"engines": {
|
|
107
106
|
"node": ">=18.6.0"
|
package/schema.json
CHANGED
|
@@ -358,6 +358,10 @@
|
|
|
358
358
|
"title": "Mocha plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/mocha/README.md)",
|
|
359
359
|
"$ref": "#/definitions/plugin"
|
|
360
360
|
},
|
|
361
|
+
"msw": {
|
|
362
|
+
"title": "Mocha plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/msw/README.md)",
|
|
363
|
+
"$ref": "#/definitions/plugin"
|
|
364
|
+
},
|
|
361
365
|
"netlify": {
|
|
362
366
|
"title": "Netlify plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/netlify/README.md)",
|
|
363
367
|
"$ref": "#/definitions/plugin"
|