knip 6.4.1 → 6.6.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/CacheConsultant.js +3 -3
- package/dist/CatalogCounselor.js +5 -5
- package/dist/ConfigurationChief.d.ts +39 -16
- package/dist/ConfigurationChief.js +15 -15
- package/dist/DependencyDeputy.d.ts +1 -1
- package/dist/DependencyDeputy.js +5 -5
- package/dist/IssueCollector.js +3 -3
- package/dist/IssueFixer.js +5 -5
- package/dist/JsonCatalogPeeker.js +1 -1
- package/dist/ProjectPrincipal.js +13 -13
- package/dist/WorkspaceWorker.d.ts +3 -2
- package/dist/WorkspaceWorker.js +39 -26
- package/dist/YamlCatalogPeeker.js +1 -1
- package/dist/binaries/bash-parser.js +10 -10
- package/dist/binaries/fallback.js +3 -3
- package/dist/binaries/index.js +3 -3
- package/dist/binaries/plugins.js +6 -6
- package/dist/binaries/resolvers/bun.js +4 -4
- package/dist/binaries/resolvers/bunx.js +4 -4
- package/dist/binaries/resolvers/find.js +1 -1
- package/dist/binaries/resolvers/index.js +8 -8
- package/dist/binaries/resolvers/npx.js +4 -4
- package/dist/binaries/resolvers/pnpm.js +3 -3
- package/dist/binaries/resolvers/pnpx.js +2 -2
- package/dist/binaries/resolvers/yarn.js +4 -4
- package/dist/cli.js +10 -10
- package/dist/compilers/index.d.ts +62 -22
- package/dist/compilers/index.js +2 -2
- package/dist/compilers/mdx.js +1 -1
- package/dist/compilers/scss.js +1 -1
- package/dist/constants.d.ts +25 -25
- package/dist/constants.js +1 -1
- package/dist/graph/analyze.js +7 -7
- package/dist/graph/build.d.ts +2 -2
- package/dist/graph/build.js +34 -26
- package/dist/graph-explorer/constants.d.ts +5 -5
- package/dist/graph-explorer/explorer.js +9 -9
- package/dist/graph-explorer/operations/build-exports-tree.js +2 -2
- package/dist/graph-explorer/operations/get-contention.js +3 -3
- package/dist/graph-explorer/operations/get-dependency-usage.js +1 -1
- package/dist/graph-explorer/operations/get-usage.js +5 -5
- package/dist/graph-explorer/operations/has-strictly-ns-references.js +1 -1
- package/dist/graph-explorer/operations/is-referenced.js +2 -2
- package/dist/graph-explorer/operations/resolve-definition.js +3 -3
- package/dist/graph-explorer/utils.d.ts +1 -1
- package/dist/graph-explorer/utils.js +2 -2
- package/dist/graph-explorer/visitors.js +1 -1
- package/dist/graph-explorer/walk-down.js +2 -2
- package/dist/graph-explorer/walk-up.js +2 -2
- package/dist/index.js +2 -2
- package/dist/manifest/helpers.js +2 -2
- package/dist/manifest/index.js +3 -3
- package/dist/plugins/_template/index.js +2 -2
- package/dist/plugins/angular/index.js +4 -4
- package/dist/plugins/astro/compiler-mdx.js +1 -1
- package/dist/plugins/astro/compiler.js +1 -1
- package/dist/plugins/astro/index.js +8 -6
- package/dist/plugins/astro/resolveFromAST.d.ts +1 -0
- package/dist/plugins/astro/resolveFromAST.js +40 -1
- package/dist/plugins/astro-db/index.js +1 -1
- package/dist/plugins/astro-og-canvas/index.js +2 -2
- package/dist/plugins/ava/index.js +2 -2
- package/dist/plugins/babel/helpers.d.ts +44 -6
- package/dist/plugins/babel/helpers.js +1 -1
- package/dist/plugins/babel/index.js +4 -4
- package/dist/plugins/biome/index.js +4 -4
- package/dist/plugins/bumpp/index.js +2 -2
- package/dist/plugins/bun/index.js +1 -1
- package/dist/plugins/c8/index.js +1 -1
- package/dist/plugins/capacitor/index.js +3 -3
- package/dist/plugins/changelogen/index.js +2 -2
- package/dist/plugins/changelogithub/index.js +2 -2
- package/dist/plugins/changesets/index.js +3 -3
- package/dist/plugins/commitizen/index.js +2 -2
- package/dist/plugins/commitlint/index.js +3 -3
- package/dist/plugins/convex/index.js +1 -1
- package/dist/plugins/create-typescript-app/index.js +1 -1
- package/dist/plugins/cspell/index.js +2 -2
- package/dist/plugins/cucumber/index.js +2 -2
- package/dist/plugins/cypress/helpers.js +2 -2
- package/dist/plugins/cypress/index.js +3 -3
- package/dist/plugins/danger/index.js +1 -1
- package/dist/plugins/dependency-cruiser/index.js +1 -1
- package/dist/plugins/docusaurus/helpers.js +2 -2
- package/dist/plugins/docusaurus/index.js +4 -4
- package/dist/plugins/dotenv/index.js +1 -1
- package/dist/plugins/drizzle/index.js +2 -2
- package/dist/plugins/eleventy/index.js +6 -6
- package/dist/plugins/eslint/helpers.js +5 -5
- package/dist/plugins/eslint/index.js +4 -4
- package/dist/plugins/eslint/resolveFromAST.js +3 -3
- package/dist/plugins/execa/index.js +2 -2
- package/dist/plugins/execa/visitors/execa.js +1 -1
- package/dist/plugins/expo/helpers.d.ts +3 -3
- package/dist/plugins/expo/helpers.js +3 -3
- package/dist/plugins/expo/index.js +4 -4
- package/dist/plugins/expressive-code/index.js +1 -1
- package/dist/plugins/gatsby/index.js +2 -2
- package/dist/plugins/github-action/index.js +4 -4
- package/dist/plugins/github-actions/index.js +4 -4
- package/dist/plugins/graphql-codegen/index.js +5 -5
- package/dist/plugins/hardhat/index.js +2 -2
- package/dist/plugins/husky/index.js +3 -3
- package/dist/plugins/i18next-parser/index.js +1 -1
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +152 -144
- package/dist/plugins/jest/helpers.js +2 -2
- package/dist/plugins/jest/index.js +4 -4
- package/dist/plugins/karma/helpers.d.ts +1 -1
- package/dist/plugins/karma/helpers.js +2 -2
- package/dist/plugins/karma/index.js +4 -4
- package/dist/plugins/knex/index.js +3 -3
- package/dist/plugins/ladle/index.js +4 -4
- package/dist/plugins/lefthook/index.js +5 -5
- package/dist/plugins/lint-staged/index.js +2 -2
- package/dist/plugins/linthtml/index.js +3 -3
- package/dist/plugins/lockfile-lint/index.js +2 -2
- package/dist/plugins/lost-pixel/index.js +1 -1
- package/dist/plugins/markdownlint/index.js +3 -3
- package/dist/plugins/mdx/index.js +2 -2
- package/dist/plugins/mdxlint/index.js +3 -3
- package/dist/plugins/metro/index.js +4 -4
- package/dist/plugins/mocha/index.js +2 -2
- package/dist/plugins/moonrepo/index.js +1 -1
- package/dist/plugins/msw/index.js +3 -3
- package/dist/plugins/nano-staged/index.js +1 -1
- package/dist/plugins/nest/index.js +2 -2
- package/dist/plugins/netlify/index.js +4 -4
- package/dist/plugins/next/index.js +3 -3
- package/dist/plugins/next/resolveFromAST.js +1 -1
- package/dist/plugins/next-intl/index.js +1 -1
- package/dist/plugins/next-mdx/index.js +3 -3
- package/dist/plugins/next-mdx/resolveFromAST.js +1 -1
- package/dist/plugins/nitro/index.js +3 -3
- package/dist/plugins/node/index.js +1 -1
- package/dist/plugins/node-modules-inspector/index.js +2 -2
- package/dist/plugins/npm-package-json-lint/index.js +3 -3
- package/dist/plugins/nuxt/helpers.js +3 -3
- package/dist/plugins/nuxt/index.js +10 -11
- package/dist/plugins/nx/index.js +4 -4
- package/dist/plugins/nyc/index.js +2 -2
- package/dist/plugins/oclif/index.js +2 -2
- package/dist/plugins/openapi-ts/index.js +2 -2
- package/dist/plugins/oxfmt/index.js +1 -1
- package/dist/plugins/oxlint/index.js +3 -3
- package/dist/plugins/panda-css/index.js +2 -2
- package/dist/plugins/parcel/index.js +2 -2
- package/dist/plugins/payload/index.js +2 -2
- package/dist/plugins/pino/index.d.ts +3 -0
- package/dist/plugins/pino/index.js +15 -0
- package/dist/plugins/pino/visitors/transportCall.d.ts +2 -0
- package/dist/plugins/pino/visitors/transportCall.js +87 -0
- package/dist/plugins/playwright/index.js +4 -4
- package/dist/plugins/playwright-ct/index.js +3 -3
- package/dist/plugins/playwright-test/index.js +1 -1
- package/dist/plugins/plop/index.js +1 -1
- package/dist/plugins/pm2/index.js +3 -3
- package/dist/plugins/pnpm/index.js +1 -1
- package/dist/plugins/postcss/index.js +3 -3
- package/dist/plugins/preconstruct/index.js +3 -3
- package/dist/plugins/prettier/index.js +6 -2
- package/dist/plugins/prisma/index.js +5 -5
- package/dist/plugins/qwik/index.js +5 -5
- package/dist/plugins/qwik/resolveFromAST.js +1 -1
- package/dist/plugins/raycast/index.js +3 -3
- package/dist/plugins/react-cosmos/index.js +3 -3
- package/dist/plugins/react-email/index.d.ts +3 -0
- package/dist/plugins/react-email/index.js +26 -0
- package/dist/plugins/react-native/index.js +2 -2
- package/dist/plugins/react-router/index.js +6 -10
- package/dist/plugins/relay/index.js +3 -3
- package/dist/plugins/release-it/index.js +2 -2
- package/dist/plugins/remark/index.js +3 -3
- package/dist/plugins/remix/index.js +1 -1
- package/dist/plugins/rolldown/index.js +3 -3
- package/dist/plugins/rolldown/resolveFromAST.js +1 -1
- package/dist/plugins/rollup/index.js +3 -3
- package/dist/plugins/rollup/resolveFromAST.js +1 -1
- package/dist/plugins/rsbuild/index.js +2 -2
- package/dist/plugins/rslib/index.js +1 -1
- package/dist/plugins/rspack/index.js +2 -2
- package/dist/plugins/rstest/index.js +2 -2
- package/dist/plugins/sanity/index.js +1 -1
- package/dist/plugins/semantic-release/index.js +3 -3
- package/dist/plugins/sentry/index.js +1 -1
- package/dist/plugins/serverless-framework/index.d.ts +3 -0
- package/dist/plugins/serverless-framework/index.js +23 -0
- package/dist/plugins/serverless-framework/types.d.ts +7 -0
- package/dist/plugins/serverless-framework/types.js +1 -0
- package/dist/plugins/simple-git-hooks/index.js +2 -2
- package/dist/plugins/size-limit/index.js +3 -3
- package/dist/plugins/sst/index.js +2 -2
- package/dist/plugins/sst/resolveFromAST.js +5 -5
- package/dist/plugins/starlight/index.js +4 -4
- package/dist/plugins/starlight/resolveFromAST.js +1 -1
- package/dist/plugins/stencil/index.js +3 -3
- package/dist/plugins/storybook/index.js +3 -3
- package/dist/plugins/stryker/index.js +2 -2
- package/dist/plugins/stylelint/index.js +3 -3
- package/dist/plugins/svelte/compiler.js +1 -1
- package/dist/plugins/svelte/index.js +3 -3
- package/dist/plugins/sveltejs-package/helpers.d.ts +8 -0
- package/dist/plugins/sveltejs-package/helpers.js +65 -0
- package/dist/plugins/sveltejs-package/index.d.ts +3 -0
- package/dist/plugins/sveltejs-package/index.js +27 -0
- package/dist/plugins/sveltekit/index.js +3 -3
- package/dist/plugins/svgo/index.js +1 -1
- package/dist/plugins/svgr/index.js +2 -2
- package/dist/plugins/swc/index.js +3 -3
- package/dist/plugins/syncpack/index.js +2 -2
- package/dist/plugins/tailwind/index.js +2 -2
- package/dist/plugins/tanstack-router/index.js +3 -3
- package/dist/plugins/taskfile/index.js +3 -3
- package/dist/plugins/travis/index.js +1 -1
- package/dist/plugins/tsdown/index.js +3 -3
- package/dist/plugins/tsdown/resolveFromAST.js +1 -1
- package/dist/plugins/tsup/index.js +3 -3
- package/dist/plugins/tsup/resolveFromAST.js +1 -1
- package/dist/plugins/tsx/index.js +2 -2
- package/dist/plugins/typedoc/index.js +2 -2
- package/dist/plugins/typescript/index.js +4 -4
- package/dist/plugins/unbuild/index.js +2 -2
- package/dist/plugins/unocss/index.js +2 -2
- package/dist/plugins/vercel-og/index.js +1 -1
- package/dist/plugins/vike/index.js +1 -1
- package/dist/plugins/vite/helpers.js +4 -4
- package/dist/plugins/vite/index.js +5 -5
- package/dist/plugins/vite/visitors/importMetaGlob.js +4 -4
- package/dist/plugins/vitepress/index.js +1 -1
- package/dist/plugins/vitest/helpers.d.ts +4 -2
- package/dist/plugins/vitest/helpers.js +18 -0
- package/dist/plugins/vitest/index.js +9 -23
- package/dist/plugins/vue/compiler.js +1 -1
- package/dist/plugins/vue/index.js +4 -4
- package/dist/plugins/webdriver-io/index.js +2 -2
- package/dist/plugins/webpack/index.js +5 -5
- package/dist/plugins/webpack/visitors/requireContext.js +6 -7
- package/dist/plugins/wireit/index.js +1 -1
- package/dist/plugins/wrangler/index.js +2 -2
- package/dist/plugins/xo/index.js +2 -2
- package/dist/plugins/yarn/index.js +2 -2
- package/dist/plugins/yorkie/index.js +2 -2
- package/dist/plugins/zx/index.js +2 -2
- package/dist/plugins.js +2 -2
- package/dist/reporters/codeclimate.js +2 -2
- package/dist/reporters/codeowners.js +3 -3
- package/dist/reporters/compact.js +1 -1
- package/dist/reporters/disclosure.js +1 -1
- package/dist/reporters/github-actions.js +4 -4
- package/dist/reporters/index.js +8 -8
- package/dist/reporters/json.js +4 -4
- package/dist/reporters/markdown.js +2 -2
- package/dist/reporters/symbols.js +2 -2
- package/dist/reporters/trace.js +7 -7
- package/dist/reporters/util/configuration-hints.d.ts +2 -2
- package/dist/reporters/util/configuration-hints.js +7 -10
- package/dist/reporters/util/util.d.ts +3 -3
- package/dist/reporters/util/util.js +16 -15
- package/dist/reporters/watch.js +7 -7
- package/dist/run.js +14 -14
- package/dist/schema/configuration.d.ts +89 -31
- package/dist/schema/configuration.js +2 -2
- package/dist/schema/plugins.d.ts +20 -0
- package/dist/schema/plugins.js +4 -0
- package/dist/session/build-maps.js +3 -3
- package/dist/session/file-descriptor.js +3 -3
- package/dist/session/index.js +7 -7
- package/dist/session/package-json-descriptor.js +1 -1
- package/dist/session/session.js +3 -3
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +4 -0
- package/dist/types/config.d.ts +13 -0
- package/dist/types/issues.d.ts +1 -1
- package/dist/typescript/SourceFileManager.js +3 -3
- package/dist/typescript/ast-helpers.d.ts +2 -0
- package/dist/typescript/ast-helpers.js +5 -5
- package/dist/typescript/comments.js +1 -1
- package/dist/typescript/follow-imports.js +2 -2
- package/dist/typescript/get-imports-and-exports.js +10 -10
- package/dist/typescript/resolve-module-names.js +5 -5
- package/dist/typescript/visitors/calls.js +3 -3
- package/dist/typescript/visitors/exports.js +4 -4
- package/dist/typescript/visitors/helpers.js +3 -3
- package/dist/typescript/visitors/imports.js +4 -4
- package/dist/typescript/visitors/members.js +4 -4
- package/dist/typescript/visitors/walk.js +9 -9
- package/dist/util/Performance.d.ts +1 -1
- package/dist/util/Performance.js +2 -2
- package/dist/util/catalog.js +3 -3
- package/dist/util/codeowners.js +4 -4
- package/dist/util/colors.d.ts +18 -0
- package/dist/util/colors.js +24 -0
- package/dist/util/create-input-handler.js +6 -6
- package/dist/util/create-options.d.ts +72 -33
- package/dist/util/create-options.js +14 -15
- package/dist/util/create-workspace-graph.js +1 -1
- package/dist/util/debug.js +2 -4
- package/dist/util/file-entry-cache.js +4 -4
- package/dist/util/fs.js +2 -2
- package/dist/util/get-included-issue-types.js +2 -2
- package/dist/util/git.js +1 -1
- package/dist/util/glob-cache.js +4 -4
- package/dist/util/glob-core.d.ts +3 -3
- package/dist/util/glob-core.js +80 -64
- package/dist/util/glob.d.ts +1 -1
- package/dist/util/glob.js +14 -7
- package/dist/util/input.js +1 -1
- package/dist/util/issue-initializers.js +1 -1
- package/dist/util/jiti.js +1 -1
- package/dist/util/load-config.js +3 -3
- package/dist/util/load-tsconfig.js +62 -50
- package/dist/util/loader.js +5 -5
- package/dist/util/log.js +3 -3
- package/dist/util/map-workspaces.js +6 -6
- package/dist/util/modules.js +2 -2
- package/dist/util/package-name.js +1 -1
- package/dist/util/parse-and-convert-gitignores.d.ts +4 -2
- package/dist/util/parse-and-convert-gitignores.js +19 -7
- package/dist/util/plugin.js +5 -5
- package/dist/util/remove-export.js +1 -1
- package/dist/util/reporter.js +3 -3
- package/dist/util/require.js +1 -1
- package/dist/util/resolve.js +3 -3
- package/dist/util/string.d.ts +1 -1
- package/dist/util/table.js +1 -1
- package/dist/util/tag.js +1 -1
- package/dist/util/to-source-path.d.ts +4 -2
- package/dist/util/to-source-path.js +46 -22
- package/dist/util/trace.js +8 -8
- package/dist/util/watch.js +8 -8
- package/dist/util/workspace-file-filter.js +2 -2
- package/dist/util/workspace-selectors.js +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -19
- package/schema.json +13 -1
package/dist/util/glob-core.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type GlobOptions as TinyGlobOptions } from 'tinyglobby';
|
|
2
2
|
type Options = {
|
|
3
3
|
gitignore: boolean;
|
|
4
4
|
cwd: string;
|
|
5
5
|
};
|
|
6
|
-
interface GlobOptions extends
|
|
6
|
+
interface GlobOptions extends TinyGlobOptions {
|
|
7
7
|
gitignore: boolean;
|
|
8
8
|
cwd: string;
|
|
9
9
|
dir: string;
|
|
@@ -12,7 +12,7 @@ interface GlobOptions extends FastGlobOptions {
|
|
|
12
12
|
export declare const findAndParseGitignores: (cwd: string, workspaceDirs?: Set<string>) => Promise<{
|
|
13
13
|
gitignoreFiles: string[];
|
|
14
14
|
ignores: Set<string>;
|
|
15
|
-
unignores: string
|
|
15
|
+
unignores: Set<string>;
|
|
16
16
|
}>;
|
|
17
17
|
export declare function glob(_patterns: string[], options: GlobOptions): Promise<string[]>;
|
|
18
18
|
export declare function getGitIgnoredHandler(options: Options, workspaceDirs?: Set<string>): Promise<(path: string) => boolean>;
|
package/dist/util/glob-core.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { basename } from 'node:path';
|
|
3
|
+
import { fdir } from 'fdir';
|
|
4
|
+
import { glob as tinyGlob } from 'tinyglobby';
|
|
5
5
|
import picomatch from 'picomatch';
|
|
6
|
-
import { GLOBAL_IGNORE_PATTERNS } from
|
|
7
|
-
import { compact, partition } from
|
|
8
|
-
import { debugLogObject } from
|
|
9
|
-
import { isDirectory, isFile } from
|
|
10
|
-
import { timerify } from
|
|
11
|
-
import { parseAndConvertGitignorePatterns } from
|
|
12
|
-
import { dirname, join, relative, toPosix } from
|
|
13
|
-
const walk = promisify(_walk);
|
|
6
|
+
import { GLOBAL_IGNORE_PATTERNS } from '../constants.js';
|
|
7
|
+
import { compact, partition } from './array.js';
|
|
8
|
+
import { debugLogObject } from './debug.js';
|
|
9
|
+
import { isDirectory, isFile } from './fs.js';
|
|
10
|
+
import { timerify } from './Performance.js';
|
|
11
|
+
import { expandIgnorePatterns, parseAndConvertGitignorePatterns } from './parse-and-convert-gitignores.js';
|
|
12
|
+
import { dirname, join, relative, toPosix } from './path.js';
|
|
14
13
|
const cachedGitIgnores = new Map();
|
|
15
14
|
const cachedGlobIgnores = new Map();
|
|
16
15
|
const isGitRoot = (dir) => isDirectory(dir, '.git') || isFile(dir, '.git');
|
|
@@ -46,20 +45,21 @@ const findAncestorGitignoreFiles = (cwd) => {
|
|
|
46
45
|
};
|
|
47
46
|
export const findAndParseGitignores = async (cwd, workspaceDirs) => {
|
|
48
47
|
const ignores = new Set(GLOBAL_IGNORE_PATTERNS);
|
|
49
|
-
const unignores =
|
|
48
|
+
const unignores = new Set();
|
|
50
49
|
const gitignoreFiles = [];
|
|
51
|
-
const pmOptions = { ignore: unignores };
|
|
52
50
|
let deepFilterMatcher;
|
|
53
|
-
let
|
|
51
|
+
let prevUnignoreSize = unignores.size;
|
|
52
|
+
let unignoresArray = [];
|
|
54
53
|
const pendingIgnores = [];
|
|
55
54
|
const getMatcher = () => {
|
|
56
55
|
if (!deepFilterMatcher) {
|
|
57
|
-
|
|
56
|
+
unignoresArray = Array.from(unignores);
|
|
57
|
+
deepFilterMatcher = picomatch(Array.from(ignores), { ignore: unignoresArray });
|
|
58
58
|
pendingIgnores.length = 0;
|
|
59
59
|
}
|
|
60
60
|
else if (pendingIgnores.length > 0) {
|
|
61
61
|
const prev = deepFilterMatcher;
|
|
62
|
-
const incr = picomatch(pendingIgnores.splice(0),
|
|
62
|
+
const incr = picomatch(pendingIgnores.splice(0), { ignore: unignoresArray });
|
|
63
63
|
deepFilterMatcher = (path) => prev(path) || incr(path);
|
|
64
64
|
}
|
|
65
65
|
return deepFilterMatcher;
|
|
@@ -73,41 +73,29 @@ export const findAndParseGitignores = async (cwd, workspaceDirs) => {
|
|
|
73
73
|
const unignoresForDir = new Set();
|
|
74
74
|
const prevIgnoreSize = ignores.size;
|
|
75
75
|
const patterns = readFileSync(filePath, 'utf8');
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
if (
|
|
80
|
-
if (!unignores.
|
|
81
|
-
unignores.
|
|
76
|
+
const isRoot = base === '' || base.startsWith('..');
|
|
77
|
+
for (const { negated, pattern } of parseAndConvertGitignorePatterns(patterns, ancestor)) {
|
|
78
|
+
if (negated) {
|
|
79
|
+
if (isRoot) {
|
|
80
|
+
if (!unignores.has(pattern)) {
|
|
81
|
+
unignores.add(pattern);
|
|
82
82
|
unignoresForDir.add(pattern);
|
|
83
|
-
unignoresForDir.add(extraPattern);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
|
-
else {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
unignores.push(unignore, extraUnignore);
|
|
91
|
-
unignoresForDir.add(unignore);
|
|
92
|
-
unignoresForDir.add(extraUnignore);
|
|
93
|
-
}
|
|
85
|
+
else if (!unignores.has(pattern)) {
|
|
86
|
+
const unignore = join(base, pattern);
|
|
87
|
+
unignores.add(unignore);
|
|
88
|
+
unignoresForDir.add(unignore);
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
|
-
else {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const ignore = join(base, pattern);
|
|
105
|
-
const extraIgnore = join(base, extraPattern);
|
|
106
|
-
ignores.add(ignore);
|
|
107
|
-
ignores.add(extraIgnore);
|
|
108
|
-
ignoresForDir.add(ignore);
|
|
109
|
-
ignoresForDir.add(extraIgnore);
|
|
110
|
-
}
|
|
91
|
+
else if (isRoot) {
|
|
92
|
+
ignores.add(pattern);
|
|
93
|
+
ignoresForDir.add(pattern);
|
|
94
|
+
}
|
|
95
|
+
else if (!unignores.has(pattern)) {
|
|
96
|
+
const ignore = join(base, pattern);
|
|
97
|
+
ignores.add(ignore);
|
|
98
|
+
ignoresForDir.add(ignore);
|
|
111
99
|
}
|
|
112
100
|
}
|
|
113
101
|
const cacheDir = ancestor ? cwd : dir;
|
|
@@ -121,9 +109,9 @@ export const findAndParseGitignores = async (cwd, workspaceDirs) => {
|
|
|
121
109
|
else {
|
|
122
110
|
cachedGitIgnores.set(cacheDir, { ignores: ignoresForDir, unignores: unignoresForDir });
|
|
123
111
|
}
|
|
124
|
-
if (unignores.
|
|
112
|
+
if (unignores.size !== prevUnignoreSize) {
|
|
125
113
|
deepFilterMatcher = undefined;
|
|
126
|
-
|
|
114
|
+
prevUnignoreSize = unignores.size;
|
|
127
115
|
}
|
|
128
116
|
else if (ignores.size !== prevIgnoreSize) {
|
|
129
117
|
for (const p of ignoresForDir)
|
|
@@ -166,19 +154,48 @@ export const findAndParseGitignores = async (cwd, workspaceDirs) => {
|
|
|
166
154
|
};
|
|
167
155
|
}
|
|
168
156
|
}
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
157
|
+
const cwdPrefixLen = cwd.length + 1;
|
|
158
|
+
const walkGitignores = async () => {
|
|
159
|
+
await new fdir()
|
|
160
|
+
.withFullPaths()
|
|
161
|
+
.exclude((_dirName, dirPath) => {
|
|
162
|
+
const absPath = toPosix(dirPath.slice(0, -1));
|
|
163
|
+
return (isRelevantDir && !isRelevantDir(absPath)) || getMatcher()(absPath.slice(cwdPrefixLen));
|
|
164
|
+
})
|
|
165
|
+
.filter((filePath, isDir) => {
|
|
166
|
+
if (isDir || basename(filePath) !== '.gitignore')
|
|
167
|
+
return false;
|
|
168
|
+
addFile(filePath);
|
|
172
169
|
return true;
|
|
173
|
-
}
|
|
174
|
-
|
|
170
|
+
})
|
|
171
|
+
.crawl(cwd)
|
|
172
|
+
.withPromise();
|
|
175
173
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
await timerify(walkGitignores)();
|
|
175
|
+
if (unignores.size > 0) {
|
|
176
|
+
const unignorePaths = new Set();
|
|
177
|
+
for (const u of unignores) {
|
|
178
|
+
let p = u.replace(/^\*\*\//, '');
|
|
179
|
+
while (p && p !== '.' && p !== '/') {
|
|
180
|
+
unignorePaths.add(p);
|
|
181
|
+
const parent = dirname(p);
|
|
182
|
+
if (parent === p)
|
|
183
|
+
break;
|
|
184
|
+
p = parent;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
for (const cacheForDir of cachedGitIgnores.values()) {
|
|
188
|
+
for (const pattern of cacheForDir.ignores) {
|
|
189
|
+
const match = picomatch(pattern);
|
|
190
|
+
for (const p of unignorePaths) {
|
|
191
|
+
if (match(p)) {
|
|
192
|
+
cacheForDir.ignores.delete(pattern);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
182
199
|
debugLogObject('*', 'Parsed gitignore files', { gitignoreFiles });
|
|
183
200
|
return { gitignoreFiles, ignores, unignores };
|
|
184
201
|
};
|
|
@@ -196,9 +213,8 @@ export async function glob(_patterns, options) {
|
|
|
196
213
|
let prev;
|
|
197
214
|
while (dir) {
|
|
198
215
|
const cacheForDir = cachedGitIgnores.get(dir);
|
|
199
|
-
if (cacheForDir)
|
|
216
|
+
if (cacheForDir)
|
|
200
217
|
_ignore.push(...cacheForDir.ignores);
|
|
201
|
-
}
|
|
202
218
|
dir = dirname((prev = dir));
|
|
203
219
|
if (prev === dir || dir === '.')
|
|
204
220
|
break;
|
|
@@ -207,8 +223,8 @@ export async function glob(_patterns, options) {
|
|
|
207
223
|
if (willCache)
|
|
208
224
|
cachedGlobIgnores.set(options.dir, compact(_ignore));
|
|
209
225
|
const ignorePatterns = (cachedIgnores || _ignore).concat(negatedPatterns.map(pattern => pattern.slice(1)));
|
|
210
|
-
const { dir, label, ...fgOptions } = { ...options, ignore: ignorePatterns };
|
|
211
|
-
const paths = await
|
|
226
|
+
const { dir, label, ...fgOptions } = { ...options, ignore: ignorePatterns, expandDirectories: false };
|
|
227
|
+
const paths = await tinyGlob(patterns, fgOptions);
|
|
212
228
|
debugLogObject(relative(options.cwd, dir), label ? `Finding ${label}` : 'Finding paths', () => ({
|
|
213
229
|
patterns,
|
|
214
230
|
...fgOptions,
|
|
@@ -224,7 +240,7 @@ export async function getGitIgnoredHandler(options, workspaceDirs) {
|
|
|
224
240
|
if (options.gitignore === false)
|
|
225
241
|
return () => false;
|
|
226
242
|
const { ignores, unignores } = await _parseFindGitignores(options.cwd, workspaceDirs);
|
|
227
|
-
const matcher = picomatch(
|
|
243
|
+
const matcher = picomatch(expandIgnorePatterns(ignores), { ignore: expandIgnorePatterns(unignores) });
|
|
228
244
|
const cache = new Map();
|
|
229
245
|
const isGitIgnored = (filePath) => {
|
|
230
246
|
let result = cache.get(filePath);
|
package/dist/util/glob.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const hasProductionSuffix: (pattern: string) => boolean;
|
|
|
13
13
|
export declare const hasNoProductionSuffix: (pattern: string) => boolean;
|
|
14
14
|
export declare const _glob: ({ cwd, dir, patterns, gitignore, label }: GlobOptions) => Promise<string[]>;
|
|
15
15
|
export declare const _syncGlob: ({ cwd, patterns }: {
|
|
16
|
-
cwd
|
|
16
|
+
cwd: string;
|
|
17
17
|
patterns: string | string[];
|
|
18
18
|
}) => string[];
|
|
19
19
|
export declare const _dirGlob: ({ cwd, patterns, gitignore }: GlobOptions) => Promise<string[]>;
|
package/dist/util/glob.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { compact } from
|
|
3
|
-
import { computeGlobCacheKey, getCachedGlob, isGlobCacheEnabled, setCachedGlob } from
|
|
4
|
-
import { glob } from
|
|
5
|
-
import { timerify } from
|
|
6
|
-
import { isAbsolute, join, relative } from
|
|
1
|
+
import { globSync } from 'tinyglobby';
|
|
2
|
+
import { compact } from './array.js';
|
|
3
|
+
import { computeGlobCacheKey, getCachedGlob, isGlobCacheEnabled, setCachedGlob } from './glob-cache.js';
|
|
4
|
+
import { glob } from './glob-core.js';
|
|
5
|
+
import { timerify } from './Performance.js';
|
|
6
|
+
import { isAbsolute, join, relative } from './path.js';
|
|
7
7
|
const prepend = (pattern, relativePath) => isAbsolute(pattern.replace(/^!/, '')) ? pattern : prependDirToPattern(relativePath, pattern);
|
|
8
8
|
const prependDirToPatterns = (cwd, dir, patterns) => {
|
|
9
9
|
const relativePath = relative(cwd, dir);
|
|
@@ -44,7 +44,14 @@ const defaultGlob = async ({ cwd, dir = cwd, patterns, gitignore = true, label }
|
|
|
44
44
|
setCachedGlob(cacheKey, paths, dir);
|
|
45
45
|
return paths;
|
|
46
46
|
};
|
|
47
|
-
const syncGlob = ({ cwd, patterns }) =>
|
|
47
|
+
const syncGlob = ({ cwd, patterns }) => {
|
|
48
|
+
return globSync(patterns, {
|
|
49
|
+
cwd,
|
|
50
|
+
absolute: true,
|
|
51
|
+
followSymbolicLinks: false,
|
|
52
|
+
expandDirectories: false,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
48
55
|
const dirGlob = async ({ cwd, patterns, gitignore = true }) => glob(patterns, {
|
|
49
56
|
cwd,
|
|
50
57
|
dir: cwd,
|
package/dist/util/input.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISSUE_TYPES } from
|
|
1
|
+
import { ISSUE_TYPES } from '../constants.js';
|
|
2
2
|
export const initIssues = () => Object.fromEntries(ISSUE_TYPES.map(issueType => [issueType, {}]));
|
|
3
3
|
export const initCounters = () => ({
|
|
4
4
|
...Object.fromEntries(ISSUE_TYPES.map(issueType => [issueType, 0])),
|
package/dist/util/jiti.js
CHANGED
package/dist/util/load-config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { debugLogObject } from
|
|
2
|
-
import { ConfigurationError } from
|
|
3
|
-
import { _load } from
|
|
1
|
+
import { debugLogObject } from './debug.js';
|
|
2
|
+
import { ConfigurationError } from './errors.js';
|
|
3
|
+
import { _load } from './loader.js';
|
|
4
4
|
const unwrapFunction = async (maybeFunction, options) => {
|
|
5
5
|
if (typeof maybeFunction === 'function') {
|
|
6
6
|
try {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
1
|
import { parseTsconfig } from 'get-tsconfig';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { dirname, isAbsolute, join, toAbsolute } from "./path.js";
|
|
2
|
+
import { isFile } from './fs.js';
|
|
3
|
+
import { _syncGlob } from './glob.js';
|
|
4
|
+
import { dirname, isAbsolute, join, toAbsolute } from './path.js';
|
|
7
5
|
const hasGlobChar = (p) => p.includes('*') || p.includes('?');
|
|
8
6
|
const hasExtension = (p) => {
|
|
9
7
|
const last = p.lastIndexOf('/');
|
|
@@ -47,56 +45,70 @@ const expandFileNames = (dir, compilerOptions, include, exclude, files) => {
|
|
|
47
45
|
}
|
|
48
46
|
return result;
|
|
49
47
|
};
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const extPath = join(dirname(tsConfigFilePath), raw.extends);
|
|
57
|
-
return findRootDirsBase(extPath);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch { }
|
|
61
|
-
return undefined;
|
|
48
|
+
const resolveReference = (refPath, dir) => {
|
|
49
|
+
const abs = isAbsolute(refPath) ? refPath : join(dir, refPath);
|
|
50
|
+
if (isFile(abs))
|
|
51
|
+
return abs;
|
|
52
|
+
const withTsconfig = join(abs, 'tsconfig.json');
|
|
53
|
+
return isFile(withTsconfig) ? withTsconfig : undefined;
|
|
62
54
|
};
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
const fillFromReferences = (target, references, dir, visited) => {
|
|
56
|
+
if (!references?.length)
|
|
57
|
+
return;
|
|
58
|
+
for (const ref of references) {
|
|
59
|
+
if (target.outDir && target.rootDir)
|
|
60
|
+
return;
|
|
61
|
+
const refPath = resolveReference(ref.path, dir);
|
|
62
|
+
if (!refPath || visited.has(refPath))
|
|
63
|
+
continue;
|
|
64
|
+
visited.add(refPath);
|
|
65
|
+
const refConfig = parseTsconfig(refPath);
|
|
66
|
+
const refDir = dirname(refPath);
|
|
67
|
+
const refOpts = refConfig.compilerOptions;
|
|
68
|
+
if (refOpts?.outDir && !target.outDir)
|
|
69
|
+
target.outDir = toAbsolute(refOpts.outDir, refDir).replace(/\/+$/, '');
|
|
70
|
+
if (refOpts?.rootDir && !target.rootDir)
|
|
71
|
+
target.rootDir = toAbsolute(refOpts.rootDir, refDir).replace(/\/+$/, '');
|
|
72
|
+
if (!refOpts?.outDir || !refOpts?.rootDir)
|
|
73
|
+
fillFromReferences(target, refConfig.references, refDir, visited);
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
76
|
export const loadTSConfig = async (tsConfigFilePath) => {
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
if (isFile(tsConfigFilePath)) {
|
|
78
|
+
try {
|
|
79
|
+
const config = parseTsconfig(tsConfigFilePath);
|
|
80
|
+
const dir = dirname(tsConfigFilePath);
|
|
81
|
+
const compilerOptions = (config.compilerOptions ?? {});
|
|
82
|
+
if (compilerOptions.outDir)
|
|
83
|
+
compilerOptions.outDir = toAbsolute(compilerOptions.outDir, dir).replace(/\/+$/, '');
|
|
84
|
+
if (compilerOptions.rootDir)
|
|
85
|
+
compilerOptions.rootDir = toAbsolute(compilerOptions.rootDir, dir).replace(/\/+$/, '');
|
|
86
|
+
if (compilerOptions.paths) {
|
|
87
|
+
compilerOptions.pathsBasePath ??= dir;
|
|
88
|
+
}
|
|
89
|
+
if (compilerOptions.rootDirs) {
|
|
90
|
+
compilerOptions.rootDirs = compilerOptions.rootDirs.map((d) => (isAbsolute(d) ? d : join(dir, d)));
|
|
91
|
+
}
|
|
92
|
+
if ((!compilerOptions.outDir || !compilerOptions.rootDir) && config.references?.length) {
|
|
93
|
+
fillFromReferences(compilerOptions, config.references, dir, new Set([tsConfigFilePath]));
|
|
94
|
+
}
|
|
95
|
+
const include = resolvePatterns(config.include, dir, true);
|
|
96
|
+
const exclude = resolvePatterns(config.exclude, dir, true);
|
|
97
|
+
const files = resolvePatterns(config.files, dir);
|
|
98
|
+
const fileNames = expandFileNames(dir, compilerOptions, include, exclude, files);
|
|
99
|
+
return { isFile: true, compilerOptions, fileNames };
|
|
90
100
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
catch {
|
|
102
|
+
return {
|
|
103
|
+
isFile: true,
|
|
104
|
+
compilerOptions: {},
|
|
105
|
+
fileNames: [],
|
|
106
|
+
};
|
|
94
107
|
}
|
|
95
|
-
const include = resolvePatterns(config.include, dir, true);
|
|
96
|
-
const exclude = resolvePatterns(config.exclude, dir, true);
|
|
97
|
-
const files = resolvePatterns(config.files, dir);
|
|
98
|
-
const fileNames = expandFileNames(dir, compilerOptions, include, exclude, files);
|
|
99
|
-
return { isFile: true, compilerOptions, fileNames };
|
|
100
108
|
}
|
|
101
|
-
return {
|
|
109
|
+
return {
|
|
110
|
+
isFile: false,
|
|
111
|
+
compilerOptions: {},
|
|
112
|
+
fileNames: [],
|
|
113
|
+
};
|
|
102
114
|
};
|
package/dist/util/loader.js
CHANGED
|
@@ -6,11 +6,11 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
6
6
|
}
|
|
7
7
|
return path;
|
|
8
8
|
};
|
|
9
|
-
import { LoaderError } from
|
|
10
|
-
import { loadFile, loadJSON, loadJSONC, loadTOML, loadYAML, parseJSONC, parseYAML } from
|
|
11
|
-
import { jiti } from
|
|
12
|
-
import { timerify } from
|
|
13
|
-
import { extname, isInternal } from
|
|
9
|
+
import { LoaderError } from './errors.js';
|
|
10
|
+
import { loadFile, loadJSON, loadJSONC, loadTOML, loadYAML, parseJSONC, parseYAML } from './fs.js';
|
|
11
|
+
import { jiti } from './jiti.js';
|
|
12
|
+
import { timerify } from './Performance.js';
|
|
13
|
+
import { extname, isInternal } from './path.js';
|
|
14
14
|
const load = async (filePath) => {
|
|
15
15
|
try {
|
|
16
16
|
const ext = extname(filePath);
|
package/dist/util/log.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import st from './colors.js';
|
|
2
2
|
export const logWarning = (prefix, message) => {
|
|
3
|
-
console.warn(`${
|
|
3
|
+
console.warn(`${st.yellow(prefix)}: ${message}`);
|
|
4
4
|
};
|
|
5
5
|
export const logError = (prefix, message) => {
|
|
6
|
-
console.error(`${
|
|
6
|
+
console.error(`${st.red(prefix)}: ${message}`);
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import
|
|
3
|
-
import { partition } from
|
|
4
|
-
import { ConfigurationError } from
|
|
5
|
-
import { getPackageName } from
|
|
6
|
-
import { join } from
|
|
2
|
+
import { glob } from 'tinyglobby';
|
|
3
|
+
import { partition } from './array.js';
|
|
4
|
+
import { ConfigurationError } from './errors.js';
|
|
5
|
+
import { getPackageName } from './package-name.js';
|
|
6
|
+
import { join } from './path.js';
|
|
7
7
|
export default async function mapWorkspaces(cwd, workspaces) {
|
|
8
8
|
const [negatedPatterns, patterns] = partition(workspaces, p => p.match(/^!/));
|
|
9
9
|
const packages = new Map();
|
|
@@ -11,7 +11,7 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
11
11
|
if (patterns.length === 0 && negatedPatterns.length === 0)
|
|
12
12
|
return [packages, wsPkgNames];
|
|
13
13
|
const manifestPatterns = patterns.map(p => join(p, 'package.json'));
|
|
14
|
-
const matches = await
|
|
14
|
+
const matches = await glob(manifestPatterns, {
|
|
15
15
|
cwd,
|
|
16
16
|
ignore: ['**/node_modules/**', ...negatedPatterns.map(p => p.slice(1))],
|
|
17
17
|
});
|
package/dist/util/modules.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DT_SCOPE, PROTOCOL_VIRTUAL } from
|
|
2
|
-
import { isAbsolute, isInNodeModules, toPosix } from
|
|
1
|
+
import { DT_SCOPE, PROTOCOL_VIRTUAL } from '../constants.js';
|
|
2
|
+
import { isAbsolute, isInNodeModules, toPosix } from './path.js';
|
|
3
3
|
export const getPackageNameFromModuleSpecifier = (specifier) => {
|
|
4
4
|
if (!isStartsLikePackageName(specifier))
|
|
5
5
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { basename, dirname } from
|
|
1
|
+
import { basename, dirname } from './path.js';
|
|
2
2
|
const getPkgName = (parent, base) => (parent.charAt(0) === '@' ? `${parent}/${base}` : base);
|
|
3
3
|
const getName = (dir) => (dir ? getPkgName(basename(dirname(dir)), basename(dir)) : undefined);
|
|
4
4
|
export function getPackageName(pkg, pathname) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export declare const toExtendedIgnorePattern: (pattern: string) => string;
|
|
2
|
+
export declare const expandIgnorePatterns: (patterns: Iterable<string>) => string[];
|
|
1
3
|
export declare const convertGitignoreToPicomatchIgnorePatterns: (pattern: string) => {
|
|
2
4
|
negated: boolean;
|
|
3
|
-
|
|
5
|
+
pattern: string;
|
|
4
6
|
};
|
|
5
7
|
export declare const parseAndConvertGitignorePatterns: (patterns: string, ancestor?: string) => {
|
|
6
8
|
negated: boolean;
|
|
7
|
-
|
|
9
|
+
pattern: string;
|
|
8
10
|
}[];
|
|
@@ -1,23 +1,35 @@
|
|
|
1
|
+
export const toExtendedIgnorePattern = (pattern) => {
|
|
2
|
+
if (pattern === '*' || pattern === '**')
|
|
3
|
+
return pattern;
|
|
4
|
+
if (pattern.endsWith('/*'))
|
|
5
|
+
return pattern;
|
|
6
|
+
return `${pattern}/**`;
|
|
7
|
+
};
|
|
8
|
+
export const expandIgnorePatterns = (patterns) => {
|
|
9
|
+
const result = [];
|
|
10
|
+
for (const p of patterns) {
|
|
11
|
+
result.push(p);
|
|
12
|
+
const ext = toExtendedIgnorePattern(p);
|
|
13
|
+
if (ext !== p)
|
|
14
|
+
result.push(ext);
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
1
18
|
export const convertGitignoreToPicomatchIgnorePatterns = (pattern) => {
|
|
2
19
|
const negated = pattern[0] === '!';
|
|
3
20
|
if (negated)
|
|
4
21
|
pattern = pattern.slice(1);
|
|
5
|
-
let extPattern;
|
|
6
22
|
if (pattern.endsWith('/'))
|
|
7
23
|
pattern = pattern.slice(0, -1);
|
|
8
24
|
if (pattern.startsWith('*/**/'))
|
|
9
25
|
pattern = pattern.slice(5);
|
|
10
26
|
if (pattern === '*' || pattern === '**')
|
|
11
|
-
return { negated,
|
|
27
|
+
return { negated, pattern };
|
|
12
28
|
if (pattern.startsWith('/'))
|
|
13
29
|
pattern = pattern.slice(1);
|
|
14
30
|
else if (!pattern.startsWith('**/'))
|
|
15
31
|
pattern = `**/${pattern}`;
|
|
16
|
-
|
|
17
|
-
extPattern = pattern;
|
|
18
|
-
else
|
|
19
|
-
extPattern = `${pattern}/**`;
|
|
20
|
-
return { negated, patterns: [pattern, extPattern] };
|
|
32
|
+
return { negated, pattern };
|
|
21
33
|
};
|
|
22
34
|
export const parseAndConvertGitignorePatterns = (patterns, ancestor) => {
|
|
23
35
|
const matchFrom = ancestor ? new RegExp(`^(!?/?)(${ancestor})`) : undefined;
|
package/dist/util/plugin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { _load as load } from
|
|
2
|
-
import { arrayify } from
|
|
3
|
-
import { _load as load } from
|
|
4
|
-
import { get } from
|
|
5
|
-
import { basename } from
|
|
1
|
+
export { _load as load } from './loader.js';
|
|
2
|
+
import { arrayify } from './array.js';
|
|
3
|
+
import { _load as load } from './loader.js';
|
|
4
|
+
import { get } from './object.js';
|
|
5
|
+
import { basename } from './path.js';
|
|
6
6
|
export const hasDependency = (dependencies, values) => values.some(value => {
|
|
7
7
|
if (typeof value === 'string') {
|
|
8
8
|
return dependencies.has(value);
|
package/dist/util/reporter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import internalReporters from
|
|
2
|
-
import { _load } from
|
|
3
|
-
import { isAbsolute, isInternal, resolve } from
|
|
1
|
+
import internalReporters from '../reporters/index.js';
|
|
2
|
+
import { _load } from './loader.js';
|
|
3
|
+
import { isAbsolute, isInternal, resolve } from './path.js';
|
|
4
4
|
export const runPreprocessors = async (processors, data) => {
|
|
5
5
|
const preprocessors = await Promise.all(processors.map(proc => _load(isInternal(proc) && !isAbsolute(proc) ? resolve(proc) : proc)));
|
|
6
6
|
return preprocessors.length === 0
|
package/dist/util/require.js
CHANGED
package/dist/util/resolve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolverFactory } from 'oxc-resolver';
|
|
2
|
-
import { DEFAULT_EXTENSIONS, DTS_EXTENSIONS } from
|
|
3
|
-
import { timerify } from
|
|
4
|
-
import { toPosix } from
|
|
2
|
+
import { DEFAULT_EXTENSIONS, DTS_EXTENSIONS } from '../constants.js';
|
|
3
|
+
import { timerify } from './Performance.js';
|
|
4
|
+
import { toPosix } from './path.js';
|
|
5
5
|
const extensionAlias = {
|
|
6
6
|
'.js': ['.js', '.ts', '.tsx', '.d.ts'],
|
|
7
7
|
'.jsx': ['.jsx', '.tsx'],
|
package/dist/util/string.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const ELLIPSIS = "\u2026";
|
|
2
2
|
export declare const truncate: (text: string, width: number) => string;
|
|
3
3
|
export declare const truncateStart: (text: string, width: number) => string;
|
|
4
|
-
export declare const pad: (text: string, width: number, fillString?: string, align?:
|
|
4
|
+
export declare const pad: (text: string, width: number, fillString?: string, align?: 'left' | 'center' | 'right') => string;
|
|
5
5
|
export declare const prettyMilliseconds: (ms: number) => string;
|