knip 5.43.5 → 5.43.6
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/README.md +6 -6
- package/dist/plugins/expo/helpers.d.ts +19 -3
- package/dist/plugins/expo/helpers.js +16 -3
- package/dist/plugins/expo/index.js +4 -4
- package/dist/plugins/expo/types.d.ts +10 -4
- package/dist/plugins/nyc/index.js +1 -1
- package/dist/util/input.d.ts +0 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
<div align="center">
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
[][1]
|
|
13
|
+
[][1]
|
|
14
|
+
[][2]
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
Knip finds **unused files, dependencies and exports** in your
|
|
19
|
-
TypeScript projects. Less code and dependencies lead to improved
|
|
20
|
-
less maintenance and easier refactorings.
|
|
18
|
+
Knip finds and fixes **unused files, dependencies and exports** in your
|
|
19
|
+
JavaScript and TypeScript projects. Less code and dependencies lead to improved
|
|
20
|
+
performance, less maintenance and easier refactorings.
|
|
21
21
|
|
|
22
22
|
- Website: [knip.dev][3]
|
|
23
23
|
- GitHub repo: [webpro-nl/knip][2]
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import type { PluginOptions } from '../../types/config.js';
|
|
2
|
-
import { type Input } from '../../util/input.js';
|
|
1
|
+
import type { PluginOptions, ResolveConfig } from '../../types/config.js';
|
|
3
2
|
import type { ExpoConfig } from './types.js';
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const getConfig: (localConfig: ExpoConfig, options: PluginOptions) => {
|
|
4
|
+
platforms?: ("ios" | "android" | "web")[];
|
|
5
|
+
notification?: Record<string, unknown>;
|
|
6
|
+
updates?: {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
userInterfaceStyle?: "automatic" | "light" | "dark";
|
|
11
|
+
ios?: {
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
};
|
|
14
|
+
android?: {
|
|
15
|
+
userInterfaceStyle?: "automatic" | "light" | "dark";
|
|
16
|
+
};
|
|
17
|
+
androidNavigationBar?: Record<string, unknown>;
|
|
18
|
+
plugins?: (string | [string, Record<string, unknown>])[];
|
|
19
|
+
};
|
|
20
|
+
export declare const getDependencies: ResolveConfig<ExpoConfig>;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { toDependency, toProductionDependency } from '../../util/input.js';
|
|
2
2
|
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { join } from '../../util/path.js';
|
|
4
|
+
const getDummyConfigContext = (options) => ({
|
|
5
|
+
projectRoot: options.cwd,
|
|
6
|
+
staticConfigPath: null,
|
|
7
|
+
packageJsonPath: join(options.cwd, 'package.json'),
|
|
8
|
+
config: {
|
|
9
|
+
plugins: [],
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export const getConfig = (localConfig, options) => {
|
|
13
|
+
const expoConfig = typeof localConfig === 'function' ? localConfig(getDummyConfigContext(options)) : localConfig;
|
|
14
|
+
return 'expo' in expoConfig ? expoConfig.expo : expoConfig;
|
|
15
|
+
};
|
|
16
|
+
export const getDependencies = async (localConfig, options) => {
|
|
17
|
+
const { manifest } = options;
|
|
18
|
+
const config = getConfig(localConfig, options);
|
|
6
19
|
const platforms = config.platforms ?? ['ios', 'android'];
|
|
7
20
|
const pluginPackages = config.plugins
|
|
8
21
|
?.map(plugin => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { toProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { join } from '../../util/path.js';
|
|
3
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
4
|
-
import { getDependencies } from './helpers.js';
|
|
4
|
+
import { getConfig, getDependencies } from './helpers.js';
|
|
5
5
|
const title = 'Expo';
|
|
6
6
|
const enablers = ['expo'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
8
|
const config = ['app.json', 'app.config.{ts,js}'];
|
|
9
9
|
const production = ['app/**/*.{js,jsx,ts,tsx}', 'src/app/**/*.{js,jsx,ts,tsx}'];
|
|
10
10
|
export const docs = { production };
|
|
11
|
-
const resolveEntryPaths = async (localConfig,
|
|
12
|
-
const
|
|
13
|
-
const config =
|
|
11
|
+
const resolveEntryPaths = async (localConfig, options) => {
|
|
12
|
+
const { manifest } = options;
|
|
13
|
+
const config = getConfig(localConfig, options);
|
|
14
14
|
if (manifest.main === 'expo-router/entry') {
|
|
15
15
|
let patterns = [...production];
|
|
16
16
|
const normalizedPlugins = config.plugins?.map(plugin => (Array.isArray(plugin) ? plugin : [plugin])) ?? [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type BaseConfig = {
|
|
2
2
|
platforms?: ('ios' | 'android' | 'web')[];
|
|
3
3
|
notification?: Record<string, unknown>;
|
|
4
4
|
updates?: {
|
|
@@ -15,8 +15,14 @@ type AppConfig = {
|
|
|
15
15
|
androidNavigationBar?: Record<string, unknown>;
|
|
16
16
|
plugins?: (string | [string, Record<string, unknown>])[];
|
|
17
17
|
};
|
|
18
|
-
type
|
|
19
|
-
|
|
18
|
+
type ConfigContext = {
|
|
19
|
+
projectRoot: string;
|
|
20
|
+
staticConfigPath: string | null;
|
|
21
|
+
packageJsonPath: string | null;
|
|
22
|
+
config: Partial<BaseConfig>;
|
|
20
23
|
};
|
|
21
|
-
|
|
24
|
+
type ExpoConfigOrProp = BaseConfig | {
|
|
25
|
+
expo: BaseConfig;
|
|
26
|
+
};
|
|
27
|
+
export type ExpoConfig = ExpoConfigOrProp | ((cfg: ConfigContext) => ExpoConfigOrProp);
|
|
22
28
|
export {};
|
|
@@ -3,7 +3,7 @@ import { hasDependency } from '../../util/plugin.js';
|
|
|
3
3
|
const title = 'nyc';
|
|
4
4
|
const enablers = ['nyc'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
-
const config = ['.nycrc', '.nycrc.json
|
|
6
|
+
const config = ['.nycrc', '.nycrc.{json,yml,yaml}', 'nyc.config.js', 'package.json'];
|
|
7
7
|
const resolveConfig = config => {
|
|
8
8
|
const extend = config?.extends ?? [];
|
|
9
9
|
const requires = config?.require ?? [];
|
package/dist/util/input.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.43.
|
|
1
|
+
export declare const version = "5.43.6";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.43.
|
|
1
|
+
export const version = '5.43.6';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.43.
|
|
4
|
-
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
3
|
+
"version": "5.43.6",
|
|
4
|
+
"description": "Find and fix unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|