knip 5.0.4 → 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 +1 -0
- package/dist/ConfigurationValidator.d.ts +56 -0
- package/dist/ConfigurationValidator.js +1 -0
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/compilers/index.d.ts +10 -0
- package/dist/plugins/graphql-codegen/index.js +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/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/typescript/visitors/dynamic-imports/importCall.js +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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/schema.json +4 -0
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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 {};
|
|
@@ -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))
|
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}',
|
|
@@ -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) {
|
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/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": {
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"@release-it/bumper": "^6.0.1",
|
|
87
87
|
"@swc/cli": "^0.3.10",
|
|
88
88
|
"@swc/core": "^1.4.6",
|
|
89
|
+
"@types/bun": "1.0.8",
|
|
89
90
|
"@types/js-yaml": "^4.0.9",
|
|
90
91
|
"@types/micromatch": "^4.0.6",
|
|
91
92
|
"@types/minimist": "^1.2.5",
|
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"
|