knip 6.44.2 → 6.45.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 +23 -1033
- package/dist/ConfigurationChief.js +71 -15
- package/dist/DependencyDeputy.d.ts +10 -6
- package/dist/DependencyDeputy.js +51 -27
- package/dist/IssueCollector.d.ts +14 -11
- package/dist/IssueCollector.js +25 -20
- package/dist/IssueFixer.js +1 -1
- package/dist/PackagePeeker.d.ts +6 -0
- package/dist/PackagePeeker.js +43 -14
- package/dist/ProjectPrincipal.d.ts +6 -3
- package/dist/ProjectPrincipal.js +83 -32
- package/dist/WorkspaceWorker.d.ts +5 -1
- package/dist/WorkspaceWorker.js +39 -22
- package/dist/binaries/bash-parser.js +1 -7
- package/dist/binaries/command.d.ts +3 -3
- package/dist/binaries/command.js +6 -2
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/plugins.d.ts +4 -1
- package/dist/binaries/plugins.js +66 -18
- package/dist/binaries/resolvers/npm.js +7 -5
- package/dist/binaries/resolvers/npx.js +8 -40
- package/dist/binaries/util.d.ts +13 -1
- package/dist/binaries/util.js +35 -1
- package/dist/cli.js +10 -84
- package/dist/configuration-hints.d.ts +16 -0
- package/dist/configuration-hints.js +64 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +2 -0
- package/dist/graph/SubpathReferences.d.ts +33 -0
- package/dist/graph/SubpathReferences.js +114 -0
- package/dist/graph/analyze.d.ts +4 -1
- package/dist/graph/analyze.js +16 -5
- package/dist/graph/build.d.ts +3 -1
- package/dist/graph/build.js +47 -23
- package/dist/graph-explorer/operations/resolve-export-origins.js +1 -1
- package/dist/plugins/angular/index.js +10 -17
- package/dist/plugins/aws-cdk/index.d.ts +3 -0
- package/dist/plugins/aws-cdk/index.js +32 -0
- package/dist/plugins/aws-cdk/types.d.ts +5 -0
- package/dist/plugins/aws-cdk/types.js +1 -0
- package/dist/plugins/babel/index.d.ts +1 -1
- package/dist/plugins/babel/index.js +19 -5
- package/dist/plugins/bun/index.js +8 -7
- package/dist/plugins/c8/index.js +17 -4
- package/dist/plugins/changesets/index.js +3 -2
- package/dist/plugins/commitizen/index.js +6 -3
- package/dist/plugins/commitlint/index.js +10 -11
- package/dist/plugins/cypress/index.js +4 -2
- package/dist/plugins/danger/index.js +1 -1
- package/dist/plugins/docusaurus/helpers.js +6 -6
- package/dist/plugins/docusaurus/index.js +2 -2
- package/dist/plugins/electron-forge/index.js +2 -2
- package/dist/plugins/electron-vite/index.js +2 -2
- package/dist/plugins/eleventy/index.js +3 -2
- package/dist/plugins/eslint/helpers.js +4 -3
- package/dist/plugins/eslint/resolveFromAST.js +2 -2
- package/dist/plugins/evalite/index.d.ts +3 -0
- package/dist/plugins/evalite/index.js +26 -0
- package/dist/plugins/flue/index.js +2 -2
- package/dist/plugins/github-action/index.js +2 -2
- package/dist/plugins/github-actions/index.js +2 -2
- package/dist/plugins/graphql-codegen/index.js +13 -9
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/jest/index.js +5 -5
- package/dist/plugins/knex/index.js +2 -2
- package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/lunaria/index.js +5 -2
- package/dist/plugins/markdownlint/index.js +8 -2
- package/dist/plugins/marko/index.js +2 -2
- package/dist/plugins/marko/taglibs.d.ts +1 -1
- package/dist/plugins/marko/taglibs.js +4 -28
- package/dist/plugins/mdx/index.d.ts +2 -1
- package/dist/plugins/mdx/index.js +7 -4
- package/dist/plugins/mdxlint/index.js +18 -15
- package/dist/plugins/mikro-orm/index.d.ts +3 -0
- package/dist/plugins/mikro-orm/index.js +77 -0
- package/dist/plugins/mikro-orm/types.d.ts +21 -0
- package/dist/plugins/mikro-orm/types.js +1 -0
- package/dist/plugins/msw/index.js +6 -3
- package/dist/plugins/msw/types.d.ts +1 -1
- package/dist/plugins/netlify/index.js +7 -3
- package/dist/plugins/next/index.js +63 -9
- package/dist/plugins/next/types.d.ts +5 -0
- package/dist/plugins/next-mdx/resolveFromAST.js +15 -10
- package/dist/plugins/nitro/index.js +5 -6
- package/dist/plugins/node/index.js +4 -4
- package/dist/plugins/npm-package-json-lint/index.js +10 -3
- package/dist/plugins/nuxt/index.js +18 -10
- package/dist/plugins/nuxt/types.d.ts +4 -0
- package/dist/plugins/nx/index.js +6 -3
- package/dist/plugins/openclaw/index.js +11 -11
- package/dist/plugins/oxlint/index.js +2 -2
- package/dist/plugins/payload/index.js +1 -1
- package/dist/plugins/playwright/index.js +3 -3
- package/dist/plugins/pm2/index.js +7 -7
- package/dist/plugins/prettier/index.js +2 -1
- package/dist/plugins/prisma/index.js +2 -2
- package/dist/plugins/quasar/resolveFromAST.js +14 -9
- package/dist/plugins/react-router/index.js +2 -2
- package/dist/plugins/release-it/index.js +6 -2
- package/dist/plugins/remix/index.js +3 -3
- package/dist/plugins/retry-cli/index.d.ts +3 -0
- package/dist/plugins/retry-cli/index.js +14 -0
- package/dist/plugins/rollup/index.js +1 -4
- package/dist/plugins/rstest/index.js +3 -3
- package/dist/plugins/semantic-release/index.js +3 -3
- package/dist/plugins/serverless-framework/index.js +10 -8
- package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +2 -2
- package/dist/plugins/stencil/resolveFromAST.js +5 -5
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/swc/index.js +4 -3
- package/dist/plugins/tailwind/index.js +2 -2
- package/dist/plugins/tanstack-router/index.js +2 -2
- package/dist/plugins/ts-node/index.js +6 -1
- package/dist/plugins/turbo/index.js +3 -3
- package/dist/plugins/typedoc/index.js +2 -2
- package/dist/plugins/typescript/content-mappers.d.ts +1 -1
- package/dist/plugins/typescript/index.js +6 -9
- package/dist/plugins/varlock/scan.js +1 -1
- package/dist/plugins/vite/helpers.d.ts +1 -0
- package/dist/plugins/vite/helpers.js +13 -3
- package/dist/plugins/vite/index.js +5 -2
- package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
- package/dist/plugins/vitest/index.js +14 -16
- package/dist/plugins/vue/index.js +1 -1
- package/dist/plugins/web-test-runner/index.d.ts +3 -0
- package/dist/plugins/web-test-runner/index.js +86 -0
- package/dist/plugins/wrangler/index.js +3 -3
- package/dist/plugins/yarn/index.js +5 -5
- package/dist/plugins.js +2 -5
- package/dist/reporters/github-actions.js +3 -7
- package/dist/reporters/json.d.ts +1 -0
- package/dist/reporters/json.js +1 -0
- package/dist/reporters/util/configuration-hints.d.ts +3 -1
- package/dist/reporters/util/configuration-hints.js +40 -21
- package/dist/reporters/util/util.d.ts +1 -1
- package/dist/run-cli.d.ts +2 -0
- package/dist/run-cli.js +82 -0
- package/dist/run.js +12 -0
- package/dist/session/incremental.d.ts +1 -0
- package/dist/session/incremental.js +1 -0
- package/dist/session/watch.js +2 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +5 -0
- package/dist/types/args.d.ts +3 -1
- package/dist/types/config.d.ts +17 -10
- package/dist/types/configuration.d.ts +45 -0
- package/dist/types/configuration.js +1 -0
- package/dist/types/issues.d.ts +4 -0
- package/dist/types/module-graph.d.ts +1 -0
- package/dist/types/options.d.ts +1 -0
- package/dist/types/package-json.d.ts +3 -8
- package/dist/types/workspace.d.ts +1 -0
- package/dist/typescript/get-imports-and-exports.js +18 -6
- package/dist/typescript/resolve-module-names.js +7 -45
- package/dist/typescript/visitors/calls.d.ts +1 -1
- package/dist/typescript/visitors/calls.js +14 -10
- package/dist/typescript/visitors/exports.js +16 -26
- package/dist/typescript/visitors/imports.d.ts +2 -1
- package/dist/typescript/visitors/imports.js +41 -24
- package/dist/typescript/visitors/members.d.ts +1 -1
- package/dist/typescript/visitors/members.js +38 -24
- package/dist/typescript/visitors/shadow.d.ts +2 -0
- package/dist/typescript/visitors/shadow.js +25 -0
- package/dist/typescript/visitors/walk.d.ts +20 -12
- package/dist/typescript/visitors/walk.js +78 -48
- package/dist/util/Performance.d.ts +25 -3
- package/dist/util/Performance.js +51 -27
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +4 -2
- package/dist/util/create-input-handler.js +138 -119
- package/dist/util/create-options.d.ts +4 -2071
- package/dist/util/create-options.js +6 -4
- package/dist/util/create-workspace-graph.js +2 -1
- package/dist/util/errors.d.ts +5 -2
- package/dist/util/errors.js +11 -18
- package/dist/util/fs.js +4 -2
- package/dist/util/input.d.ts +2 -2
- package/dist/util/input.js +2 -2
- package/dist/util/is-plugin-name.d.ts +2 -0
- package/dist/util/is-plugin-name.js +3 -0
- package/dist/util/jiti.d.ts +2 -1
- package/dist/util/jiti.js +10 -3
- package/dist/util/load-config.d.ts +1 -1
- package/dist/util/load-config.js +3 -2
- package/dist/util/loader.js +3 -2
- package/dist/util/map-workspaces.js +23 -1
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.d.ts +2 -0
- package/dist/util/modules.js +78 -0
- package/dist/util/package-json.d.ts +12 -5
- package/dist/util/package-json.js +54 -26
- package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
- package/dist/util/parse-and-convert-gitignores.js +5 -5
- package/dist/util/parse-configuration.d.ts +2 -0
- package/dist/util/parse-configuration.js +66 -0
- package/dist/util/plugin.js +8 -12
- package/dist/util/resolve.d.ts +1 -0
- package/dist/util/resolve.js +3 -2
- package/dist/util/scripts.d.ts +0 -5
- package/dist/util/scripts.js +1 -32
- package/dist/util/to-source-path.d.ts +4 -1
- package/dist/util/to-source-path.js +2 -2
- package/dist/util/unhandled-rejection.d.ts +8 -0
- package/dist/util/unhandled-rejection.js +29 -0
- package/dist/util/validation.d.ts +11 -0
- package/dist/util/validation.js +68 -0
- package/dist/util/watch.d.ts +3 -1
- package/dist/util/watch.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -7
- package/schema.json +34 -0
- package/dist/schema/configuration.d.ts +0 -3103
- package/dist/schema/configuration.js +0 -94
- package/dist/schema/plugins.d.ts +0 -1019
- package/dist/schema/plugins.js +0 -215
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ISSUE_TYPES, KNIP_CONFIG_LOCATIONS } from '../constants.js';
|
|
2
|
-
import { knipConfigurationSchema } from '../schema/configuration.js';
|
|
3
2
|
import { arrayify } from './array.js';
|
|
4
3
|
import { getCatalogContainer } from './catalog.js';
|
|
5
4
|
import { parseNumericOption } from './cli-arguments.js';
|
|
@@ -11,9 +10,11 @@ import { loadResolvedConfigFile } from './load-config.js';
|
|
|
11
10
|
import { _load, unload } from './loader.js';
|
|
12
11
|
import { logWarning } from './log.js';
|
|
13
12
|
import { getKeysByValue } from './object.js';
|
|
13
|
+
import { parseConfiguration } from './parse-configuration.js';
|
|
14
|
+
import { timerify } from './Performance.js';
|
|
14
15
|
import { isAbsolute, isInternal, join, resolveCwd, toAbsolute } from './path.js';
|
|
15
16
|
import { splitTags } from './tag.js';
|
|
16
|
-
export const createOptions = async (options, isReload = false) => {
|
|
17
|
+
export const createOptions = timerify(async (options, isReload = false) => {
|
|
17
18
|
const { args = {} } = options;
|
|
18
19
|
const cwd = resolveCwd(options.cwd ?? args.directory ?? '.');
|
|
19
20
|
const manifestPath = findFile(cwd, 'package.json');
|
|
@@ -57,7 +58,7 @@ export const createOptions = async (options, isReload = false) => {
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
const parsedConfig =
|
|
61
|
+
const parsedConfig = parseConfiguration(loadedConfig);
|
|
61
62
|
if (!configFilePath && manifest.knip)
|
|
62
63
|
configFilePath = manifestPath;
|
|
63
64
|
const pnpmWorkspacePath = findFile(cwd, 'pnpm-workspace.yaml');
|
|
@@ -139,6 +140,7 @@ export const createOptions = async (options, isReload = false) => {
|
|
|
139
140
|
isFixUnusedTypes: fixTypes.length === 0 || fixTypes.includes('types'),
|
|
140
141
|
isFormat: args.format ?? options.isFormat ?? false,
|
|
141
142
|
isIncludeEntryExports: args['include-entry-exports'] ?? options.isIncludeEntryExports ?? false,
|
|
143
|
+
isIncludeSubpathExports: args['include-subpath-exports'] ?? options.isIncludeSubpathExports ?? false,
|
|
142
144
|
isProduction,
|
|
143
145
|
isReportDependencies: includedIssueTypes.dependencies ||
|
|
144
146
|
includedIssueTypes.unlisted ||
|
|
@@ -186,4 +188,4 @@ export const createOptions = async (options, isReload = false) => {
|
|
|
186
188
|
workspace,
|
|
187
189
|
workspaces,
|
|
188
190
|
};
|
|
189
|
-
};
|
|
191
|
+
}, 'createOptions');
|
|
@@ -10,7 +10,8 @@ export function createWorkspaceGraph(cwd, wsNames, wsPkgNames, wsPackages) {
|
|
|
10
10
|
const dirs = new Set();
|
|
11
11
|
for (const type of types) {
|
|
12
12
|
if (pkg.manifest[type]) {
|
|
13
|
-
for (const
|
|
13
|
+
for (const dependency in pkg.manifest[type]) {
|
|
14
|
+
const pkgName = pkg.aliases.get(dependency) ?? dependency;
|
|
14
15
|
if (wsPkgNames.has(pkgName)) {
|
|
15
16
|
const wsPackage = packagesByPkgName.get(pkgName);
|
|
16
17
|
if (wsPackage)
|
package/dist/util/errors.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { core } from 'zod/mini';
|
|
2
1
|
interface ErrorWithCause extends Error {
|
|
3
2
|
cause: Error;
|
|
4
3
|
}
|
|
5
4
|
export declare class ConfigurationError extends Error {
|
|
6
5
|
}
|
|
6
|
+
export declare class ConfigurationValidationError extends Error {
|
|
7
|
+
errors: string[];
|
|
8
|
+
constructor(errors: string[]);
|
|
9
|
+
}
|
|
7
10
|
export declare class CompilerError extends Error {
|
|
8
11
|
}
|
|
9
12
|
export declare class LoaderError extends Error {
|
|
10
13
|
}
|
|
11
|
-
export declare const isKnownError: (error: Error) => error is
|
|
14
|
+
export declare const isKnownError: (error: Error) => error is CompilerError | ConfigurationError | ConfigurationValidationError | LoaderError;
|
|
12
15
|
export declare const hasErrorCause: (error: Error) => error is ErrorWithCause;
|
|
13
16
|
export declare const isConfigurationError: (error: Error) => error is ConfigurationError;
|
|
14
17
|
export declare const isModuleNotFoundError: (error: Error) => boolean;
|
package/dist/util/errors.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { core } from 'zod/mini';
|
|
2
1
|
import { substringBefore } from './string.js';
|
|
3
|
-
const isZodErrorLike = (error) => error instanceof core.$ZodError;
|
|
4
2
|
export class ConfigurationError extends Error {
|
|
5
3
|
}
|
|
4
|
+
export class ConfigurationValidationError extends Error {
|
|
5
|
+
errors;
|
|
6
|
+
constructor(errors) {
|
|
7
|
+
super(errors.join('\n'));
|
|
8
|
+
this.errors = errors;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
6
11
|
export class CompilerError extends Error {
|
|
7
12
|
}
|
|
8
13
|
export class LoaderError extends Error {
|
|
@@ -10,8 +15,8 @@ export class LoaderError extends Error {
|
|
|
10
15
|
export const isKnownError = (error) => error instanceof ConfigurationError ||
|
|
11
16
|
error instanceof CompilerError ||
|
|
12
17
|
error instanceof LoaderError ||
|
|
13
|
-
|
|
14
|
-
export const hasErrorCause = (error) =>
|
|
18
|
+
error instanceof ConfigurationValidationError;
|
|
19
|
+
export const hasErrorCause = (error) => error.cause instanceof Error;
|
|
15
20
|
export const isConfigurationError = (error) => error instanceof ConfigurationError;
|
|
16
21
|
export const isModuleNotFoundError = (error) => 'code' in error && error.code === 'MODULE_NOT_FOUND';
|
|
17
22
|
export const isLoaderError = (error) => error instanceof LoaderError;
|
|
@@ -22,19 +27,7 @@ export const formatCauseMessage = (error, cwd) => {
|
|
|
22
27
|
return substringBefore(root.message, '\n').replace(`${cwd}/`, '');
|
|
23
28
|
};
|
|
24
29
|
export const getKnownErrors = (error) => {
|
|
25
|
-
if (
|
|
26
|
-
return Array.from(error.
|
|
27
|
-
let message = error.message;
|
|
28
|
-
const details = [];
|
|
29
|
-
if (error.path.length > 0)
|
|
30
|
-
details.push(`location: ${error.path.join('.')}`);
|
|
31
|
-
if (typeof error.expected === 'string')
|
|
32
|
-
details.push(`expected: ${error.expected}`);
|
|
33
|
-
if (Array.isArray(error.keys))
|
|
34
|
-
details.push(`${error.code}: ${error.keys.join(', ')}`);
|
|
35
|
-
if (details.length > 0)
|
|
36
|
-
message += ` (${details.join(', ')})`;
|
|
37
|
-
return new Error(message);
|
|
38
|
-
});
|
|
30
|
+
if (error instanceof ConfigurationValidationError)
|
|
31
|
+
return Array.from(error.errors, message => new Error(message));
|
|
39
32
|
return [error];
|
|
40
33
|
};
|
package/dist/util/fs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { existsSync, readdirSync, realpathSync, statSync } from 'node:fs';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import {
|
|
4
|
-
import { parse as parseTOML } from 'smol-toml';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
5
4
|
import stripJsonComments from 'strip-json-comments';
|
|
6
5
|
import { LoaderError } from './errors.js';
|
|
7
6
|
import { extname, join, toPosix } from './path.js';
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
8
|
export const isDirectory = (cwdOrPath, name) => {
|
|
9
9
|
try {
|
|
10
10
|
return statSync(name ? join(cwdOrPath, name) : cwdOrPath, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
@@ -72,6 +72,7 @@ export const loadYAML = async (filePath) => {
|
|
|
72
72
|
};
|
|
73
73
|
export const loadTOML = async (filePath) => {
|
|
74
74
|
const contents = await loadFile(filePath);
|
|
75
|
+
const { parse: parseTOML } = require('smol-toml');
|
|
75
76
|
return parseTOML(contents);
|
|
76
77
|
};
|
|
77
78
|
export const parseJSONC = async (filePath, contents) => {
|
|
@@ -84,6 +85,7 @@ export const parseJSONC = async (filePath, contents) => {
|
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
export const parseYAML = (contents) => {
|
|
88
|
+
const { parse: parseYAMLContents } = require('yaml');
|
|
87
89
|
return parseYAMLContents(contents, { logLevel: 'error' });
|
|
88
90
|
};
|
|
89
91
|
export const tryRealpath = (filePath) => {
|
package/dist/util/input.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface IgnoreInput extends Input {
|
|
|
32
32
|
issueType: IssueType;
|
|
33
33
|
}
|
|
34
34
|
type Options = {
|
|
35
|
+
production?: boolean;
|
|
35
36
|
optional?: boolean;
|
|
36
37
|
isTypeOnly?: boolean;
|
|
37
38
|
alsoReferenceOwner?: boolean;
|
|
@@ -54,11 +55,10 @@ export declare const toConfig: (pluginName: PluginName, specifier: string, optio
|
|
|
54
55
|
export declare const isConfig: (input: Input) => input is ConfigInput;
|
|
55
56
|
export declare const toDependency: (specifier: string, options?: Options) => Input;
|
|
56
57
|
export declare const isDependency: (input: Input) => boolean;
|
|
57
|
-
export declare const toProductionDependency: (specifier: string) => Input;
|
|
58
|
+
export declare const toProductionDependency: (specifier: string, options?: Options) => Input;
|
|
58
59
|
export declare const toDeferResolve: (specifier: string, options?: Options) => Input;
|
|
59
60
|
export declare const isDeferResolve: (input: Input) => boolean;
|
|
60
61
|
export declare const toDeferResolveProductionEntry: (specifier: string, options?: Options) => Input;
|
|
61
|
-
export declare const isDeferResolveProductionEntry: (input: Input) => boolean;
|
|
62
62
|
export declare const toDeferResolveEntry: (specifier: string, options?: Options) => Input;
|
|
63
63
|
export declare const isDeferResolveEntry: (input: Input) => boolean;
|
|
64
64
|
export declare const toAlias: (specifier: string, prefix: string | string[], options?: Options) => AliasInput;
|
package/dist/util/input.js
CHANGED
|
@@ -36,10 +36,11 @@ export const toDependency = (specifier, options = {}) => ({
|
|
|
36
36
|
...options,
|
|
37
37
|
});
|
|
38
38
|
export const isDependency = (input) => input.type === 'dependency';
|
|
39
|
-
export const toProductionDependency = (specifier) => ({
|
|
39
|
+
export const toProductionDependency = (specifier, options = {}) => ({
|
|
40
40
|
type: 'dependency',
|
|
41
41
|
specifier,
|
|
42
42
|
production: true,
|
|
43
|
+
...options,
|
|
43
44
|
});
|
|
44
45
|
export const toDeferResolve = (specifier, options = {}) => ({
|
|
45
46
|
type: 'deferResolve',
|
|
@@ -53,7 +54,6 @@ export const toDeferResolveProductionEntry = (specifier, options = {}) => ({
|
|
|
53
54
|
production: true,
|
|
54
55
|
...options,
|
|
55
56
|
});
|
|
56
|
-
export const isDeferResolveProductionEntry = (input) => input.type === 'deferResolveEntry' && input.production === true;
|
|
57
57
|
export const toDeferResolveEntry = (specifier, options = {}) => ({
|
|
58
58
|
type: 'deferResolveEntry',
|
|
59
59
|
specifier,
|
package/dist/util/jiti.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Jiti } from 'jiti';
|
|
2
|
+
export declare const getJiti: () => Jiti;
|
package/dist/util/jiti.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
1
2
|
import { fileURLToPath } from 'node:url';
|
|
2
|
-
import { createJiti } from 'jiti';
|
|
3
3
|
import { join } from './path.js';
|
|
4
4
|
const empty = join(fileURLToPath(import.meta.url), '../empty.js');
|
|
5
5
|
const options = {
|
|
@@ -11,5 +11,12 @@ const options = {
|
|
|
11
11
|
jsx: true,
|
|
12
12
|
extensions: ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts', '.mtsx', '.ctsx', '.jsx'],
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const cwd = process.cwd();
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
let jiti;
|
|
17
|
+
export const getJiti = () => {
|
|
18
|
+
if (jiti)
|
|
19
|
+
return jiti;
|
|
20
|
+
const { createJiti } = require('jiti');
|
|
21
|
+
return (jiti = createJiti(cwd, options));
|
|
22
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ParsedCLIArgs } from './cli-arguments.ts';
|
|
2
|
-
export declare
|
|
2
|
+
export declare const loadResolvedConfigFile: (configPath: string, options: ParsedCLIArgs) => Promise<any>;
|
package/dist/util/load-config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { debugLogObject } from './debug.js';
|
|
2
2
|
import { ConfigurationError } from './errors.js';
|
|
3
3
|
import { _load } from './loader.js';
|
|
4
|
+
import { timerify } from './Performance.js';
|
|
4
5
|
const unwrapFunction = async (maybeFunction, options) => {
|
|
5
6
|
if (typeof maybeFunction === 'function') {
|
|
6
7
|
try {
|
|
@@ -14,7 +15,7 @@ const unwrapFunction = async (maybeFunction, options) => {
|
|
|
14
15
|
return maybeFunction;
|
|
15
16
|
};
|
|
16
17
|
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
17
|
-
export async function loadResolvedConfigFile(configPath, options) {
|
|
18
|
+
export const loadResolvedConfigFile = timerify(async function loadResolvedConfigFile(configPath, options) {
|
|
18
19
|
const loadedValue = await _load(configPath);
|
|
19
20
|
let config;
|
|
20
21
|
try {
|
|
@@ -26,4 +27,4 @@ export async function loadResolvedConfigFile(configPath, options) {
|
|
|
26
27
|
if (!isObject(config))
|
|
27
28
|
throw new ConfigurationError(`Expected an object as configuration from ${configPath}`);
|
|
28
29
|
return config;
|
|
29
|
-
}
|
|
30
|
+
});
|
package/dist/util/loader.js
CHANGED
|
@@ -10,12 +10,13 @@ import { createRequire } from 'node:module';
|
|
|
10
10
|
import { pathToFileURL } from 'node:url';
|
|
11
11
|
import { LoaderError } from './errors.js';
|
|
12
12
|
import { loadFile, loadJSON, loadJSONC, loadTOML, loadYAML, parseJSONC, parseYAML } from './fs.js';
|
|
13
|
-
import {
|
|
13
|
+
import { getJiti } from './jiti.js';
|
|
14
14
|
import { timerify } from './Performance.js';
|
|
15
15
|
import { extname, isInternal, toNative } from './path.js';
|
|
16
16
|
const versions = new Map();
|
|
17
17
|
const isReloadable = (ext) => ext === '.js' || ext === '.mjs' || ext === '.cjs';
|
|
18
18
|
const reload = async (filePath, version) => {
|
|
19
|
+
const jiti = getJiti();
|
|
19
20
|
let imported;
|
|
20
21
|
try {
|
|
21
22
|
imported = jiti(filePath);
|
|
@@ -60,7 +61,7 @@ const load = async (filePath) => {
|
|
|
60
61
|
versions.set(filePath, version);
|
|
61
62
|
if (version && isReloadable(ext))
|
|
62
63
|
return await reload(filePath, version);
|
|
63
|
-
return await
|
|
64
|
+
return await getJiti().import(filePath, { default: true });
|
|
64
65
|
}
|
|
65
66
|
catch (error) {
|
|
66
67
|
throw new LoaderError(`Error loading ${filePath}`, { cause: error });
|
|
@@ -4,8 +4,18 @@ import { partition } from './array.js';
|
|
|
4
4
|
import { debugLog } from './debug.js';
|
|
5
5
|
import { ConfigurationError } from './errors.js';
|
|
6
6
|
import { logWarning } from './log.js';
|
|
7
|
+
import { isStartsLikePackageName } from './modules.js';
|
|
7
8
|
import { getPackageName } from './package-name.js';
|
|
8
9
|
import { join } from './path.js';
|
|
10
|
+
const dependencyTypes = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
|
|
11
|
+
const getAliasedWorkspacePkgName = (range) => {
|
|
12
|
+
if (!range.startsWith('workspace:'))
|
|
13
|
+
return;
|
|
14
|
+
const spec = range.slice(10);
|
|
15
|
+
const at = spec.lastIndexOf('@');
|
|
16
|
+
if (at > 0 && isStartsLikePackageName(spec))
|
|
17
|
+
return spec.slice(0, at);
|
|
18
|
+
};
|
|
9
19
|
export default async function mapWorkspaces(cwd, workspaces) {
|
|
10
20
|
const [negatedPatterns, patterns] = partition(workspaces, p => p.match(/^!/));
|
|
11
21
|
const packages = new Map();
|
|
@@ -25,7 +35,7 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
25
35
|
const manifestStr = (await readFile(manifestPath, 'utf8')).replace(/^/, '');
|
|
26
36
|
const manifest = JSON.parse(manifestStr);
|
|
27
37
|
const pkgName = getPackageName(manifest, dir);
|
|
28
|
-
const pkg = { dir, name, pkgName, manifestPath, manifestStr, manifest };
|
|
38
|
+
const pkg = { dir, name, pkgName, manifestPath, manifestStr, manifest, aliases: new Map() };
|
|
29
39
|
packages.set(name, pkg);
|
|
30
40
|
if (pkgName)
|
|
31
41
|
wsPkgNames.add(pkgName);
|
|
@@ -43,5 +53,17 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
43
53
|
throw error;
|
|
44
54
|
}
|
|
45
55
|
}
|
|
56
|
+
for (const { manifest, aliases } of packages.values()) {
|
|
57
|
+
for (const type of dependencyTypes) {
|
|
58
|
+
const dependencies = manifest[type];
|
|
59
|
+
if (!dependencies)
|
|
60
|
+
continue;
|
|
61
|
+
for (const alias in dependencies) {
|
|
62
|
+
const pkgName = getAliasedWorkspacePkgName(dependencies[alias]);
|
|
63
|
+
if (pkgName && pkgName !== alias && wsPkgNames.has(pkgName))
|
|
64
|
+
aliases.set(alias, pkgName);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
46
68
|
return [packages, wsPkgNames];
|
|
47
69
|
}
|
package/dist/util/modules.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export declare const isInNodeModulesBin: (value: string) => boolean;
|
|
|
7
7
|
export declare const isRelativeNodeModulesBin: (value: string) => boolean;
|
|
8
8
|
export declare const extractBinary: (command: string) => string;
|
|
9
9
|
export declare const isValidBinary: (str: string) => boolean;
|
|
10
|
+
export declare const isBuiltin: (specifier: string) => boolean;
|
|
10
11
|
export declare const isDefinitelyTyped: (packageName: string) => boolean;
|
|
11
12
|
export declare const getDefinitelyTypedFor: (packageName: string) => string;
|
|
12
13
|
export declare const getPackageFromDefinitelyTyped: (typedDependency: string) => string;
|
|
13
14
|
export declare const sanitizeSpecifier: (specifier: string) => string;
|
|
15
|
+
export declare const getSubpathImport: (specifier: string) => string | undefined;
|
package/dist/util/modules.js
CHANGED
|
@@ -66,6 +66,77 @@ export const extractBinary = (command) => stripVersionFromSpecifier(stripNodeMod
|
|
|
66
66
|
.replace(/^(\.bin\/)/, '')
|
|
67
67
|
.replace(/\$\(npm bin\)\/(\w+)/, '$1'));
|
|
68
68
|
export const isValidBinary = (str) => !/[*:!()]/.test(str);
|
|
69
|
+
const NODE_BUILTIN_MODULES = new Set([
|
|
70
|
+
'_http_agent',
|
|
71
|
+
'_http_client',
|
|
72
|
+
'_http_common',
|
|
73
|
+
'_http_incoming',
|
|
74
|
+
'_http_outgoing',
|
|
75
|
+
'_http_server',
|
|
76
|
+
'_stream_duplex',
|
|
77
|
+
'_stream_passthrough',
|
|
78
|
+
'_stream_readable',
|
|
79
|
+
'_stream_transform',
|
|
80
|
+
'_stream_wrap',
|
|
81
|
+
'_stream_writable',
|
|
82
|
+
'_tls_common',
|
|
83
|
+
'_tls_wrap',
|
|
84
|
+
'assert',
|
|
85
|
+
'assert/strict',
|
|
86
|
+
'async_hooks',
|
|
87
|
+
'buffer',
|
|
88
|
+
'child_process',
|
|
89
|
+
'cluster',
|
|
90
|
+
'console',
|
|
91
|
+
'constants',
|
|
92
|
+
'crypto',
|
|
93
|
+
'dgram',
|
|
94
|
+
'diagnostics_channel',
|
|
95
|
+
'dns',
|
|
96
|
+
'dns/promises',
|
|
97
|
+
'domain',
|
|
98
|
+
'events',
|
|
99
|
+
'fs',
|
|
100
|
+
'fs/promises',
|
|
101
|
+
'http',
|
|
102
|
+
'http2',
|
|
103
|
+
'https',
|
|
104
|
+
'inspector',
|
|
105
|
+
'inspector/promises',
|
|
106
|
+
'module',
|
|
107
|
+
'net',
|
|
108
|
+
'os',
|
|
109
|
+
'path',
|
|
110
|
+
'path/posix',
|
|
111
|
+
'path/win32',
|
|
112
|
+
'perf_hooks',
|
|
113
|
+
'process',
|
|
114
|
+
'punycode',
|
|
115
|
+
'querystring',
|
|
116
|
+
'readline',
|
|
117
|
+
'readline/promises',
|
|
118
|
+
'repl',
|
|
119
|
+
'stream',
|
|
120
|
+
'stream/consumers',
|
|
121
|
+
'stream/promises',
|
|
122
|
+
'stream/web',
|
|
123
|
+
'string_decoder',
|
|
124
|
+
'sys',
|
|
125
|
+
'timers',
|
|
126
|
+
'timers/promises',
|
|
127
|
+
'tls',
|
|
128
|
+
'trace_events',
|
|
129
|
+
'tty',
|
|
130
|
+
'url',
|
|
131
|
+
'util',
|
|
132
|
+
'util/types',
|
|
133
|
+
'v8',
|
|
134
|
+
'vm',
|
|
135
|
+
'wasi',
|
|
136
|
+
'worker_threads',
|
|
137
|
+
'zlib',
|
|
138
|
+
]);
|
|
139
|
+
export const isBuiltin = (specifier) => specifier.startsWith('node:') || NODE_BUILTIN_MODULES.has(specifier);
|
|
69
140
|
export const isDefinitelyTyped = (packageName) => packageName.startsWith(`${DT_SCOPE}/`);
|
|
70
141
|
export const getDefinitelyTypedFor = (packageName) => {
|
|
71
142
|
if (isDefinitelyTyped(packageName))
|
|
@@ -120,3 +191,10 @@ export const sanitizeSpecifier = (specifier) => {
|
|
|
120
191
|
}
|
|
121
192
|
return colon !== -1 && colon < end ? specifier.slice(start, colon) : specifier.slice(start, end);
|
|
122
193
|
};
|
|
194
|
+
export const getSubpathImport = (specifier) => {
|
|
195
|
+
if (!specifier.includes('#'))
|
|
196
|
+
return;
|
|
197
|
+
const sanitized = sanitizeSpecifier(specifier);
|
|
198
|
+
if (sanitized.charCodeAt(0) === CHAR_HASH)
|
|
199
|
+
return sanitized;
|
|
200
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { PackageJson } from '../types/package-json.ts';
|
|
1
|
+
import type { Exports, PackageJson } from '../types/package-json.ts';
|
|
2
2
|
declare const INDENT: unique symbol;
|
|
3
3
|
declare const NEWLINE: unique symbol;
|
|
4
4
|
interface ExtendedPackageJson extends PackageJson {
|
|
5
5
|
[INDENT]?: string;
|
|
6
6
|
[NEWLINE]?: string;
|
|
7
7
|
}
|
|
8
|
+
export declare const getEntriesFromExports: (obj: any) => string[];
|
|
8
9
|
export declare const toDeclarationSpecifier: (specifier: string) => string | undefined;
|
|
9
10
|
export declare const getPublishedTypeManifest: (manifest: PackageJson) => PackageJson;
|
|
10
11
|
export declare const getPublishedTypeExportSpecifiers: (exports: PackageJson['exports']) => Set<string>;
|
|
@@ -12,17 +13,23 @@ export declare const getPublishedTypeEntrySpecifiers: (manifest: PackageJson) =>
|
|
|
12
13
|
candidates: string[];
|
|
13
14
|
versioned: Set<string>;
|
|
14
15
|
};
|
|
15
|
-
export declare const getPackageMapTarget: (map:
|
|
16
|
-
target:
|
|
16
|
+
export declare const getPackageMapTarget: (map: Exports, key: string) => {
|
|
17
|
+
target: Exports;
|
|
18
|
+
subpath: string;
|
|
17
19
|
patternMatch?: undefined;
|
|
18
20
|
} | {
|
|
19
|
-
target:
|
|
21
|
+
target: Exports;
|
|
22
|
+
subpath: string;
|
|
20
23
|
patternMatch: string;
|
|
21
24
|
} | undefined;
|
|
25
|
+
export declare const expandPackageTarget: (target: string | undefined, patternMatch: string | undefined) => string | undefined;
|
|
26
|
+
export declare const toPackagePath: (dir: string, target: string) => string | undefined;
|
|
27
|
+
export declare const getPackageTargetPaths: (value: unknown, dir: string, patternMatch: string | undefined, isIncludeTypes: boolean, paths?: string[]) => string[];
|
|
28
|
+
export declare const getExportEntries: (exports: NonNullable<PackageJson['exports']>) => [string, Exports][] | (readonly [".", NonNullable<Exports | undefined>])[];
|
|
22
29
|
export declare const isPublishedTypeExportTarget: (exports: PackageJson['exports'], candidate: string) => boolean;
|
|
23
30
|
export declare const load: (filePath: string) => Promise<ExtendedPackageJson>;
|
|
24
31
|
export declare const save: (filePath: string, content: ExtendedPackageJson) => Promise<void>;
|
|
25
|
-
export declare const getEntrySpecifiersFromManifest: (manifest: PackageJson) => Set<string>;
|
|
32
|
+
export declare const getEntrySpecifiersFromManifest: (manifest: PackageJson, isIncludeSubpathExports?: boolean) => Set<string>;
|
|
26
33
|
export type Manifest = PackageJson & {
|
|
27
34
|
scriptNames: Set<string>;
|
|
28
35
|
getMajor: (name: string) => number | undefined;
|
|
@@ -2,6 +2,7 @@ import { readFile, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import picomatch from 'picomatch';
|
|
3
3
|
import { IS_DTS } from '../constants.js';
|
|
4
4
|
import { getPackageNameFromModuleSpecifier } from './modules.js';
|
|
5
|
+
import { join } from './path.js';
|
|
5
6
|
const INDENT = Symbol.for('indent');
|
|
6
7
|
const NEWLINE = Symbol.for('newline');
|
|
7
8
|
const DEFAULT_NEWLINE = '\n';
|
|
@@ -20,7 +21,7 @@ const parseJson = (raw) => {
|
|
|
20
21
|
}
|
|
21
22
|
return result;
|
|
22
23
|
};
|
|
23
|
-
const getEntriesFromExports = (obj) => {
|
|
24
|
+
export const getEntriesFromExports = (obj) => {
|
|
24
25
|
if (typeof obj === 'string')
|
|
25
26
|
return [obj];
|
|
26
27
|
let values = [];
|
|
@@ -117,21 +118,23 @@ export const getPublishedTypeEntrySpecifiers = (manifest) => {
|
|
|
117
118
|
return { candidates, versioned };
|
|
118
119
|
};
|
|
119
120
|
export const getPackageMapTarget = (map, key) => {
|
|
120
|
-
if (
|
|
121
|
-
return key === '.' ? { target: map } : undefined;
|
|
122
|
-
|
|
121
|
+
if (map === null || typeof map !== 'object' || Array.isArray(map)) {
|
|
122
|
+
return key === '.' ? { target: map, subpath: '.' } : undefined;
|
|
123
|
+
}
|
|
123
124
|
let hasSubpaths = false;
|
|
124
|
-
for (const
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return { target };
|
|
125
|
+
for (const subpath in map) {
|
|
126
|
+
if (subpath.startsWith('.') || subpath.startsWith('#')) {
|
|
127
|
+
hasSubpaths = true;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
130
|
}
|
|
131
131
|
if (!hasSubpaths)
|
|
132
|
-
return key === '.' ? { target: map } : undefined;
|
|
132
|
+
return key === '.' ? { target: map, subpath: '.' } : undefined;
|
|
133
|
+
if (Object.hasOwn(map, key))
|
|
134
|
+
return { target: map[key], subpath: key };
|
|
133
135
|
let best;
|
|
134
|
-
for (const
|
|
136
|
+
for (const subpath in map) {
|
|
137
|
+
const target = map[subpath];
|
|
135
138
|
const starIndex = subpath.indexOf('*');
|
|
136
139
|
if (starIndex < 0)
|
|
137
140
|
continue;
|
|
@@ -144,6 +147,7 @@ export const getPackageMapTarget = (map, key) => {
|
|
|
144
147
|
(prefix.length === best.prefixLength && subpath.length > best.subpathLength)) {
|
|
145
148
|
best = {
|
|
146
149
|
target,
|
|
150
|
+
subpath,
|
|
147
151
|
patternMatch: key.slice(prefix.length, key.length - suffix.length),
|
|
148
152
|
prefixLength: prefix.length,
|
|
149
153
|
subpathLength: subpath.length,
|
|
@@ -151,7 +155,40 @@ export const getPackageMapTarget = (map, key) => {
|
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
if (best)
|
|
154
|
-
return { target: best.target, patternMatch: best.patternMatch };
|
|
158
|
+
return { target: best.target, subpath: best.subpath, patternMatch: best.patternMatch };
|
|
159
|
+
};
|
|
160
|
+
const invalidSegments = /(^|\\|\/)((\.|%2e)(\.|%2e)?|node_modules)(\\|\/|$)/i;
|
|
161
|
+
export const expandPackageTarget = (target, patternMatch) => {
|
|
162
|
+
if (!target?.startsWith('./') || invalidSegments.test(target.slice(2)))
|
|
163
|
+
return;
|
|
164
|
+
if (!target.includes('*'))
|
|
165
|
+
return target;
|
|
166
|
+
if (patternMatch === undefined || invalidSegments.test(patternMatch))
|
|
167
|
+
return;
|
|
168
|
+
return target.replaceAll('*', patternMatch);
|
|
169
|
+
};
|
|
170
|
+
export const toPackagePath = (dir, target) => {
|
|
171
|
+
const candidate = join(dir, target);
|
|
172
|
+
return candidate.startsWith(`${dir}/`) ? candidate : undefined;
|
|
173
|
+
};
|
|
174
|
+
export const getPackageTargetPaths = (value, dir, patternMatch, isIncludeTypes, paths = []) => {
|
|
175
|
+
if (typeof value === 'string') {
|
|
176
|
+
const target = expandPackageTarget(value, patternMatch);
|
|
177
|
+
const candidate = target && toPackagePath(dir, target);
|
|
178
|
+
if (candidate)
|
|
179
|
+
paths.push(candidate);
|
|
180
|
+
}
|
|
181
|
+
else if (Array.isArray(value)) {
|
|
182
|
+
for (const item of value)
|
|
183
|
+
getPackageTargetPaths(item, dir, patternMatch, isIncludeTypes, paths);
|
|
184
|
+
}
|
|
185
|
+
else if (value && typeof value === 'object') {
|
|
186
|
+
for (const [condition, child] of Object.entries(value)) {
|
|
187
|
+
if (isIncludeTypes || condition !== 'types')
|
|
188
|
+
getPackageTargetPaths(child, dir, patternMatch, isIncludeTypes, paths);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return paths;
|
|
155
192
|
};
|
|
156
193
|
const matchPublishedTypeTarget = (pattern, candidate) => {
|
|
157
194
|
const parts = pattern.split('*');
|
|
@@ -165,7 +202,7 @@ const matchPublishedTypeTarget = (pattern, candidate) => {
|
|
|
165
202
|
if (parts.join(patternMatch) === candidate)
|
|
166
203
|
return { patternMatch };
|
|
167
204
|
};
|
|
168
|
-
const getExportEntries = (exports) => {
|
|
205
|
+
export const getExportEntries = (exports) => {
|
|
169
206
|
if (!Array.isArray(exports) && typeof exports === 'object') {
|
|
170
207
|
const entries = Object.entries(exports);
|
|
171
208
|
if (entries.some(([key]) => key.startsWith('.')))
|
|
@@ -248,8 +285,9 @@ const getHiddenExportTargets = (exports) => {
|
|
|
248
285
|
}
|
|
249
286
|
return targets;
|
|
250
287
|
};
|
|
251
|
-
export const getEntrySpecifiersFromManifest = (manifest) => {
|
|
252
|
-
const { main, module, browser, bin,
|
|
288
|
+
export const getEntrySpecifiersFromManifest = (manifest, isIncludeSubpathExports = false) => {
|
|
289
|
+
const { main, module, browser, bin, types, typings } = manifest;
|
|
290
|
+
const exports = isIncludeSubpathExports ? undefined : manifest.exports;
|
|
253
291
|
const entryPaths = new Set();
|
|
254
292
|
if (typeof main === 'string' && main)
|
|
255
293
|
entryPaths.add(main);
|
|
@@ -274,16 +312,6 @@ export const getEntrySpecifiersFromManifest = (manifest) => {
|
|
|
274
312
|
entryPaths.add(expandWildcards(item));
|
|
275
313
|
}
|
|
276
314
|
}
|
|
277
|
-
if (manifest.imports) {
|
|
278
|
-
for (const [key, value] of Object.entries(manifest.imports)) {
|
|
279
|
-
if (!key.startsWith('#'))
|
|
280
|
-
continue;
|
|
281
|
-
for (const item of getEntriesFromExports(value)) {
|
|
282
|
-
if (item.startsWith('.') && !item.includes('*'))
|
|
283
|
-
entryPaths.add(item);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
315
|
if (exports) {
|
|
288
316
|
const entries = Array.from(entryPaths, withoutDotSlash);
|
|
289
317
|
for (const target of getHiddenExportTargets(exports)) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const toExtendedIgnorePattern: (pattern: string, shallow?: boolean) => string;
|
|
2
2
|
export declare const expandIgnorePatterns: (patterns: Iterable<string>, shallow?: boolean) => string[];
|
|
3
|
-
export declare const convertGitignoreToPicomatchIgnorePatterns: (pattern: string) => {
|
|
3
|
+
export declare const convertGitignoreToPicomatchIgnorePatterns: (pattern: string, isAnchored?: boolean) => {
|
|
4
4
|
negated: boolean;
|
|
5
5
|
pattern: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const parseAndConvertGitignorePatterns: (patterns: string, ancestor?: string) => {
|
|
7
|
+
export declare const parseAndConvertGitignorePatterns: (patterns: string, ancestor?: string, isAnchored?: boolean) => {
|
|
8
8
|
negated: boolean;
|
|
9
9
|
pattern: string;
|
|
10
10
|
}[];
|