Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
184
node_modules/del/index.d.ts
generated
vendored
184
node_modules/del/index.d.ts
generated
vendored
|
|
@ -1,116 +1,106 @@
|
|||
import {GlobbyOptions} from 'globby';
|
||||
import {Options as GlobbyOptions} from 'globby';
|
||||
|
||||
declare namespace del {
|
||||
interface ProgressData {
|
||||
/**
|
||||
Deleted files and directories count.
|
||||
*/
|
||||
deletedCount: number;
|
||||
export interface ProgressData {
|
||||
/**
|
||||
Deleted files and directories count.
|
||||
*/
|
||||
readonly deletedCount: number;
|
||||
|
||||
/**
|
||||
Total files and directories count.
|
||||
*/
|
||||
totalCount: number;
|
||||
/**
|
||||
Total files and directories count.
|
||||
*/
|
||||
readonly totalCount: number;
|
||||
|
||||
/**
|
||||
Completed percentage. A value between `0` and `1`.
|
||||
*/
|
||||
percent: number;
|
||||
}
|
||||
|
||||
interface Options extends GlobbyOptions {
|
||||
/**
|
||||
Allow deleting the current working directory and outside.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly force?: boolean;
|
||||
|
||||
/**
|
||||
See what would be deleted.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
import del = require('del');
|
||||
|
||||
(async () => {
|
||||
const deletedPaths = await del(['temp/*.js'], {dryRun: true});
|
||||
|
||||
console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n'));
|
||||
})();
|
||||
```
|
||||
*/
|
||||
readonly dryRun?: boolean;
|
||||
|
||||
/**
|
||||
Concurrency limit. Minimum: `1`.
|
||||
|
||||
@default Infinity
|
||||
*/
|
||||
readonly concurrency?: number;
|
||||
|
||||
/**
|
||||
Called after each file or directory is deleted.
|
||||
|
||||
@example
|
||||
```
|
||||
import del from 'del';
|
||||
|
||||
await del(patterns, {
|
||||
onProgress: progress => {
|
||||
// …
|
||||
}});
|
||||
```
|
||||
*/
|
||||
readonly onProgress?: (progress: ProgressData) => void;
|
||||
}
|
||||
/**
|
||||
Completed percentage. A value between `0` and `1`.
|
||||
*/
|
||||
readonly percent: number;
|
||||
}
|
||||
|
||||
declare const del: {
|
||||
export interface Options extends GlobbyOptions {
|
||||
/**
|
||||
Synchronously delete files and directories using glob patterns.
|
||||
Allow deleting the current working directory and outside.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
|
||||
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
|
||||
@param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default.
|
||||
@returns The deleted paths.
|
||||
@default false
|
||||
*/
|
||||
sync: (
|
||||
patterns: string | readonly string[],
|
||||
options?: del.Options
|
||||
) => string[];
|
||||
readonly force?: boolean;
|
||||
|
||||
/**
|
||||
Delete files and directories using glob patterns.
|
||||
See what would be deleted.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
|
||||
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
|
||||
@param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default.
|
||||
@returns The deleted paths.
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
import del = require('del');
|
||||
import {deleteAsync} from 'del';
|
||||
|
||||
(async () => {
|
||||
const deletedPaths = await del(['temp/*.js', '!temp/unicorn.js']);
|
||||
const deletedPaths = await deleteAsync(['temp/*.js'], {dryRun: true});
|
||||
|
||||
console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
|
||||
})();
|
||||
console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n'));
|
||||
```
|
||||
*/
|
||||
(
|
||||
patterns: string | readonly string[],
|
||||
options?: del.Options
|
||||
): Promise<string[]>;
|
||||
};
|
||||
readonly dryRun?: boolean;
|
||||
|
||||
export = del;
|
||||
/**
|
||||
Concurrency limit. Minimum: `1`.
|
||||
|
||||
@default Infinity
|
||||
*/
|
||||
readonly concurrency?: number;
|
||||
|
||||
/**
|
||||
Called after each file or directory is deleted.
|
||||
|
||||
@example
|
||||
```
|
||||
import {deleteAsync} from 'del';
|
||||
|
||||
await deleteAsync(patterns, {
|
||||
onProgress: progress => {
|
||||
// …
|
||||
}});
|
||||
```
|
||||
*/
|
||||
readonly onProgress?: (progress: ProgressData) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
Delete files and directories using glob patterns.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
|
||||
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
|
||||
@param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default.
|
||||
@returns The deleted paths.
|
||||
|
||||
@example
|
||||
```
|
||||
import {deleteAsync} from 'del';
|
||||
|
||||
const deletedPaths = await deleteAsync(['temp/*.js', '!temp/unicorn.js']);
|
||||
|
||||
console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
|
||||
```
|
||||
*/
|
||||
export function deleteAsync(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): Promise<string[]>;
|
||||
|
||||
/**
|
||||
Synchronously delete files and directories using glob patterns.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
|
||||
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
|
||||
@param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default.
|
||||
@returns The deleted paths.
|
||||
*/
|
||||
export function deleteSync(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): string[];
|
||||
|
|
|
|||
46
node_modules/del/index.js
generated
vendored
46
node_modules/del/index.js
generated
vendored
|
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
const {promisify} = require('util');
|
||||
const path = require('path');
|
||||
const globby = require('globby');
|
||||
const isGlob = require('is-glob');
|
||||
const slash = require('slash');
|
||||
const gracefulFs = require('graceful-fs');
|
||||
const isPathCwd = require('is-path-cwd');
|
||||
const isPathInside = require('is-path-inside');
|
||||
const rimraf = require('rimraf');
|
||||
const pMap = require('p-map');
|
||||
import {promisify} from 'node:util';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import {globby, globbySync} from 'globby';
|
||||
import isGlob from 'is-glob';
|
||||
import slash from 'slash';
|
||||
import gracefulFs from 'graceful-fs';
|
||||
import isPathCwd from 'is-path-cwd';
|
||||
import isPathInside from 'is-path-inside';
|
||||
import rimraf from 'rimraf';
|
||||
import pMap from 'p-map';
|
||||
|
||||
const rimrafP = promisify(rimraf);
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ const rimrafOptions = {
|
|||
rmdir: gracefulFs.rmdir,
|
||||
rmdirSync: gracefulFs.rmdirSync,
|
||||
readdir: gracefulFs.readdir,
|
||||
readdirSync: gracefulFs.readdirSync
|
||||
readdirSync: gracefulFs.readdirSync,
|
||||
};
|
||||
|
||||
function safeCheck(file, cwd) {
|
||||
|
|
@ -52,25 +52,25 @@ function normalizePatterns(patterns) {
|
|||
return patterns;
|
||||
}
|
||||
|
||||
module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgress = () => {}, ...options} = {}) => {
|
||||
export async function deleteAsync(patterns, {force, dryRun, cwd = process.cwd(), onProgress = () => {}, ...options} = {}) {
|
||||
options = {
|
||||
expandDirectories: false,
|
||||
onlyFiles: false,
|
||||
followSymbolicLinks: false,
|
||||
cwd,
|
||||
...options
|
||||
...options,
|
||||
};
|
||||
|
||||
patterns = normalizePatterns(patterns);
|
||||
|
||||
const files = (await globby(patterns, options))
|
||||
.sort((a, b) => b.localeCompare(a));
|
||||
const paths = await globby(patterns, options);
|
||||
const files = paths.sort((a, b) => b.localeCompare(a));
|
||||
|
||||
if (files.length === 0) {
|
||||
onProgress({
|
||||
totalCount: 0,
|
||||
deletedCount: 0,
|
||||
percent: 1
|
||||
percent: 1,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgres
|
|||
onProgress({
|
||||
totalCount: files.length,
|
||||
deletedCount,
|
||||
percent: deletedCount / files.length
|
||||
percent: deletedCount / files.length,
|
||||
});
|
||||
|
||||
return file;
|
||||
|
|
@ -103,20 +103,20 @@ module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgres
|
|||
removedFiles.sort((a, b) => a.localeCompare(b));
|
||||
|
||||
return removedFiles;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) => {
|
||||
export function deleteSync(patterns, {force, dryRun, cwd = process.cwd(), ...options} = {}) {
|
||||
options = {
|
||||
expandDirectories: false,
|
||||
onlyFiles: false,
|
||||
followSymbolicLinks: false,
|
||||
cwd,
|
||||
...options
|
||||
...options,
|
||||
};
|
||||
|
||||
patterns = normalizePatterns(patterns);
|
||||
|
||||
const files = globby.sync(patterns, options)
|
||||
const files = globbySync(patterns, options)
|
||||
.sort((a, b) => b.localeCompare(a));
|
||||
|
||||
const removedFiles = files.map(file => {
|
||||
|
|
@ -136,4 +136,4 @@ module.exports.sync = (patterns, {force, dryRun, cwd = process.cwd(), ...options
|
|||
removedFiles.sort((a, b) => a.localeCompare(b));
|
||||
|
||||
return removedFiles;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
94
node_modules/del/node_modules/globby/ignore.js
generated
vendored
Normal file
94
node_modules/del/node_modules/globby/ignore.js
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
import process from 'node:process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import fastGlob from 'fast-glob';
|
||||
import gitIgnore from 'ignore';
|
||||
import slash from 'slash';
|
||||
import {toPath, isNegativePattern} from './utilities.js';
|
||||
|
||||
const ignoreFilesGlobOptions = {
|
||||
ignore: [
|
||||
'**/node_modules',
|
||||
'**/flow-typed',
|
||||
'**/coverage',
|
||||
'**/.git',
|
||||
],
|
||||
absolute: true,
|
||||
dot: true,
|
||||
};
|
||||
|
||||
export const GITIGNORE_FILES_PATTERN = '**/.gitignore';
|
||||
|
||||
const applyBaseToPattern = (pattern, base) => isNegativePattern(pattern)
|
||||
? '!' + path.posix.join(base, pattern.slice(1))
|
||||
: path.posix.join(base, pattern);
|
||||
|
||||
const parseIgnoreFile = (file, cwd) => {
|
||||
const base = slash(path.relative(cwd, path.dirname(file.filePath)));
|
||||
|
||||
return file.content
|
||||
.split(/\r?\n/)
|
||||
.filter(line => line && !line.startsWith('#'))
|
||||
.map(pattern => applyBaseToPattern(pattern, base));
|
||||
};
|
||||
|
||||
const toRelativePath = (fileOrDirectory, cwd) => {
|
||||
cwd = slash(cwd);
|
||||
if (path.isAbsolute(fileOrDirectory)) {
|
||||
if (slash(fileOrDirectory).startsWith(cwd)) {
|
||||
return path.relative(cwd, fileOrDirectory);
|
||||
}
|
||||
|
||||
throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
|
||||
}
|
||||
|
||||
return fileOrDirectory;
|
||||
};
|
||||
|
||||
const getIsIgnoredPredicate = (files, cwd) => {
|
||||
const patterns = files.flatMap(file => parseIgnoreFile(file, cwd));
|
||||
const ignores = gitIgnore().add(patterns);
|
||||
|
||||
return fileOrDirectory => {
|
||||
fileOrDirectory = toPath(fileOrDirectory);
|
||||
fileOrDirectory = toRelativePath(fileOrDirectory, cwd);
|
||||
return fileOrDirectory ? ignores.ignores(slash(fileOrDirectory)) : false;
|
||||
};
|
||||
};
|
||||
|
||||
const normalizeOptions = (options = {}) => ({
|
||||
cwd: toPath(options.cwd) || process.cwd(),
|
||||
suppressErrors: Boolean(options.suppressErrors),
|
||||
deep: typeof options.deep === 'number' ? options.deep : Number.POSITIVE_INFINITY,
|
||||
});
|
||||
|
||||
export const isIgnoredByIgnoreFiles = async (patterns, options) => {
|
||||
const {cwd, suppressErrors, deep} = normalizeOptions(options);
|
||||
|
||||
const paths = await fastGlob(patterns, {cwd, suppressErrors, deep, ...ignoreFilesGlobOptions});
|
||||
|
||||
const files = await Promise.all(
|
||||
paths.map(async filePath => ({
|
||||
filePath,
|
||||
content: await fs.promises.readFile(filePath, 'utf8'),
|
||||
})),
|
||||
);
|
||||
|
||||
return getIsIgnoredPredicate(files, cwd);
|
||||
};
|
||||
|
||||
export const isIgnoredByIgnoreFilesSync = (patterns, options) => {
|
||||
const {cwd, suppressErrors, deep} = normalizeOptions(options);
|
||||
|
||||
const paths = fastGlob.sync(patterns, {cwd, suppressErrors, deep, ...ignoreFilesGlobOptions});
|
||||
|
||||
const files = paths.map(filePath => ({
|
||||
filePath,
|
||||
content: fs.readFileSync(filePath, 'utf8'),
|
||||
}));
|
||||
|
||||
return getIsIgnoredPredicate(files, cwd);
|
||||
};
|
||||
|
||||
export const isGitIgnored = options => isIgnoredByIgnoreFiles(GITIGNORE_FILES_PATTERN, options);
|
||||
export const isGitIgnoredSync = options => isIgnoredByIgnoreFilesSync(GITIGNORE_FILES_PATTERN, options);
|
||||
205
node_modules/del/node_modules/globby/index.d.ts
generated
vendored
Normal file
205
node_modules/del/node_modules/globby/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
import {Options as FastGlobOptions, Entry} from 'fast-glob';
|
||||
|
||||
export type GlobEntry = Entry;
|
||||
|
||||
export interface GlobTask {
|
||||
readonly patterns: string[];
|
||||
readonly options: Options;
|
||||
}
|
||||
|
||||
export type ExpandDirectoriesOption =
|
||||
| boolean
|
||||
| readonly string[]
|
||||
| {files?: readonly string[]; extensions?: readonly string[]};
|
||||
|
||||
type FastGlobOptionsWithoutCwd = Omit<FastGlobOptions, 'cwd'>;
|
||||
|
||||
export interface Options extends FastGlobOptionsWithoutCwd {
|
||||
/**
|
||||
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
|
||||
|
||||
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
|
||||
|
||||
@default true
|
||||
|
||||
@example
|
||||
```
|
||||
import {globby} from 'globby';
|
||||
|
||||
const paths = await globby('images', {
|
||||
expandDirectories: {
|
||||
files: ['cat', 'unicorn', '*.jpg'],
|
||||
extensions: ['png']
|
||||
}
|
||||
});
|
||||
|
||||
console.log(paths);
|
||||
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
|
||||
```
|
||||
*/
|
||||
readonly expandDirectories?: ExpandDirectoriesOption;
|
||||
|
||||
/**
|
||||
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly gitignore?: boolean;
|
||||
|
||||
/**
|
||||
Glob patterns to look for ignore files, which are then used to ignore globbed files.
|
||||
|
||||
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
|
||||
|
||||
@default undefined
|
||||
*/
|
||||
readonly ignoreFiles?: string | readonly string[];
|
||||
|
||||
/**
|
||||
The current working directory in which to search.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: URL | string;
|
||||
}
|
||||
|
||||
export interface GitignoreOptions {
|
||||
readonly cwd?: URL | string;
|
||||
}
|
||||
|
||||
export type GlobbyFilterFunction = (path: URL | string) => boolean;
|
||||
|
||||
/**
|
||||
Find files and directories using glob patterns.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
||||
@returns The matching paths.
|
||||
|
||||
@example
|
||||
```
|
||||
import {globby} from 'globby';
|
||||
|
||||
const paths = await globby(['*', '!cake']);
|
||||
|
||||
console.log(paths);
|
||||
//=> ['unicorn', 'rainbow']
|
||||
```
|
||||
*/
|
||||
export function globby(
|
||||
patterns: string | readonly string[],
|
||||
options: Options & {objectMode: true}
|
||||
): Promise<GlobEntry[]>;
|
||||
export function globby(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): Promise<string[]>;
|
||||
|
||||
/**
|
||||
Find files and directories using glob patterns.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
||||
@returns The matching paths.
|
||||
*/
|
||||
export function globbySync(
|
||||
patterns: string | readonly string[],
|
||||
options: Options & {objectMode: true}
|
||||
): GlobEntry[];
|
||||
export function globbySync(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): string[];
|
||||
|
||||
/**
|
||||
Find files and directories using glob patterns.
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
||||
@returns The stream of matching paths.
|
||||
|
||||
@example
|
||||
```
|
||||
import {globbyStream} from 'globby';
|
||||
|
||||
for await (const path of globbyStream('*.tmp')) {
|
||||
console.log(path);
|
||||
}
|
||||
```
|
||||
*/
|
||||
export function globbyStream(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): NodeJS.ReadableStream;
|
||||
|
||||
/**
|
||||
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
||||
@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
|
||||
*/
|
||||
export function generateGlobTasks(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): Promise<GlobTask[]>;
|
||||
|
||||
/**
|
||||
@see generateGlobTasks
|
||||
|
||||
@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
|
||||
*/
|
||||
export function generateGlobTasksSync(
|
||||
patterns: string | readonly string[],
|
||||
options?: Options
|
||||
): GlobTask[];
|
||||
|
||||
/**
|
||||
Note that the options affect the results.
|
||||
|
||||
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).
|
||||
|
||||
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
||||
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3).
|
||||
@returns Whether there are any special glob characters in the `patterns`.
|
||||
*/
|
||||
export function isDynamicPattern(
|
||||
patterns: string | readonly string[],
|
||||
options?: FastGlobOptionsWithoutCwd & {
|
||||
/**
|
||||
The current working directory in which to search.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: URL | string;
|
||||
}
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
`.gitignore` files matched by the ignore config are not used for the resulting filter function.
|
||||
|
||||
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
|
||||
|
||||
@example
|
||||
```
|
||||
import {isGitIgnored} from 'globby';
|
||||
|
||||
const isIgnored = await isGitIgnored();
|
||||
|
||||
console.log(isIgnored('some/file'));
|
||||
```
|
||||
*/
|
||||
export function isGitIgnored(options?: GitignoreOptions): Promise<GlobbyFilterFunction>;
|
||||
|
||||
/**
|
||||
@see isGitIgnored
|
||||
|
||||
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
|
||||
*/
|
||||
export function isGitIgnoredSync(options?: GitignoreOptions): GlobbyFilterFunction;
|
||||
229
node_modules/del/node_modules/globby/index.js
generated
vendored
Normal file
229
node_modules/del/node_modules/globby/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
import fs from 'node:fs';
|
||||
import nodePath from 'node:path';
|
||||
import merge2 from 'merge2';
|
||||
import fastGlob from 'fast-glob';
|
||||
import dirGlob from 'dir-glob';
|
||||
import {
|
||||
GITIGNORE_FILES_PATTERN,
|
||||
isIgnoredByIgnoreFiles,
|
||||
isIgnoredByIgnoreFilesSync,
|
||||
} from './ignore.js';
|
||||
import {FilterStream, toPath, isNegativePattern} from './utilities.js';
|
||||
|
||||
const assertPatternsInput = patterns => {
|
||||
if (patterns.some(pattern => typeof pattern !== 'string')) {
|
||||
throw new TypeError('Patterns must be a string or an array of strings');
|
||||
}
|
||||
};
|
||||
|
||||
const toPatternsArray = patterns => {
|
||||
patterns = [...new Set([patterns].flat())];
|
||||
assertPatternsInput(patterns);
|
||||
return patterns;
|
||||
};
|
||||
|
||||
const checkCwdOption = options => {
|
||||
if (!options.cwd) {
|
||||
return;
|
||||
}
|
||||
|
||||
let stat;
|
||||
try {
|
||||
stat = fs.statSync(options.cwd);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stat.isDirectory()) {
|
||||
throw new Error('The `cwd` option must be a path to a directory');
|
||||
}
|
||||
};
|
||||
|
||||
const normalizeOptions = (options = {}) => {
|
||||
options = {
|
||||
...options,
|
||||
ignore: options.ignore || [],
|
||||
expandDirectories: options.expandDirectories === undefined
|
||||
? true
|
||||
: options.expandDirectories,
|
||||
cwd: toPath(options.cwd),
|
||||
};
|
||||
|
||||
checkCwdOption(options);
|
||||
|
||||
return options;
|
||||
};
|
||||
|
||||
const normalizeArguments = fn => async (patterns, options) => fn(toPatternsArray(patterns), normalizeOptions(options));
|
||||
const normalizeArgumentsSync = fn => (patterns, options) => fn(toPatternsArray(patterns), normalizeOptions(options));
|
||||
|
||||
const getIgnoreFilesPatterns = options => {
|
||||
const {ignoreFiles, gitignore} = options;
|
||||
|
||||
const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
|
||||
if (gitignore) {
|
||||
patterns.push(GITIGNORE_FILES_PATTERN);
|
||||
}
|
||||
|
||||
return patterns;
|
||||
};
|
||||
|
||||
const getFilter = async options => {
|
||||
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
||||
return createFilterFunction(
|
||||
ignoreFilesPatterns.length > 0 && await isIgnoredByIgnoreFiles(ignoreFilesPatterns, options),
|
||||
);
|
||||
};
|
||||
|
||||
const getFilterSync = options => {
|
||||
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
||||
return createFilterFunction(
|
||||
ignoreFilesPatterns.length > 0 && isIgnoredByIgnoreFilesSync(ignoreFilesPatterns, options),
|
||||
);
|
||||
};
|
||||
|
||||
const createFilterFunction = isIgnored => {
|
||||
const seen = new Set();
|
||||
|
||||
return fastGlobResult => {
|
||||
const path = fastGlobResult.path || fastGlobResult;
|
||||
const pathKey = nodePath.normalize(path);
|
||||
const seenOrIgnored = seen.has(pathKey) || (isIgnored && isIgnored(path));
|
||||
seen.add(pathKey);
|
||||
return !seenOrIgnored;
|
||||
};
|
||||
};
|
||||
|
||||
const unionFastGlobResults = (results, filter) => results.flat().filter(fastGlobResult => filter(fastGlobResult));
|
||||
const unionFastGlobStreams = (streams, filter) => merge2(streams).pipe(new FilterStream(fastGlobResult => filter(fastGlobResult)));
|
||||
|
||||
const convertNegativePatterns = (patterns, options) => {
|
||||
const tasks = [];
|
||||
|
||||
while (patterns.length > 0) {
|
||||
const index = patterns.findIndex(pattern => isNegativePattern(pattern));
|
||||
|
||||
if (index === -1) {
|
||||
tasks.push({patterns, options});
|
||||
break;
|
||||
}
|
||||
|
||||
const ignorePattern = patterns[index].slice(1);
|
||||
|
||||
for (const task of tasks) {
|
||||
task.options.ignore.push(ignorePattern);
|
||||
}
|
||||
|
||||
if (index !== 0) {
|
||||
tasks.push({
|
||||
patterns: patterns.slice(0, index),
|
||||
options: {
|
||||
...options,
|
||||
ignore: [
|
||||
...options.ignore,
|
||||
ignorePattern,
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
patterns = patterns.slice(index + 1);
|
||||
}
|
||||
|
||||
return tasks;
|
||||
};
|
||||
|
||||
const getDirGlobOptions = (options, cwd) => ({
|
||||
...(cwd ? {cwd} : {}),
|
||||
...(Array.isArray(options) ? {files: options} : options),
|
||||
});
|
||||
|
||||
const generateTasks = async (patterns, options) => {
|
||||
const globTasks = convertNegativePatterns(patterns, options);
|
||||
|
||||
const {cwd, expandDirectories} = options;
|
||||
|
||||
if (!expandDirectories) {
|
||||
return globTasks;
|
||||
}
|
||||
|
||||
const patternExpandOptions = getDirGlobOptions(expandDirectories, cwd);
|
||||
const ignoreExpandOptions = cwd ? {cwd} : undefined;
|
||||
|
||||
return Promise.all(
|
||||
globTasks.map(async task => {
|
||||
let {patterns, options} = task;
|
||||
|
||||
[
|
||||
patterns,
|
||||
options.ignore,
|
||||
] = await Promise.all([
|
||||
dirGlob(patterns, patternExpandOptions),
|
||||
dirGlob(options.ignore, ignoreExpandOptions),
|
||||
]);
|
||||
|
||||
return {patterns, options};
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const generateTasksSync = (patterns, options) => {
|
||||
const globTasks = convertNegativePatterns(patterns, options);
|
||||
|
||||
const {cwd, expandDirectories} = options;
|
||||
|
||||
if (!expandDirectories) {
|
||||
return globTasks;
|
||||
}
|
||||
|
||||
const patternExpandOptions = getDirGlobOptions(expandDirectories, cwd);
|
||||
const ignoreExpandOptions = cwd ? {cwd} : undefined;
|
||||
|
||||
return globTasks.map(task => {
|
||||
let {patterns, options} = task;
|
||||
patterns = dirGlob.sync(patterns, patternExpandOptions);
|
||||
options.ignore = dirGlob.sync(options.ignore, ignoreExpandOptions);
|
||||
return {patterns, options};
|
||||
});
|
||||
};
|
||||
|
||||
export const globby = normalizeArguments(async (patterns, options) => {
|
||||
const [
|
||||
tasks,
|
||||
filter,
|
||||
] = await Promise.all([
|
||||
generateTasks(patterns, options),
|
||||
getFilter(options),
|
||||
]);
|
||||
const results = await Promise.all(tasks.map(task => fastGlob(task.patterns, task.options)));
|
||||
|
||||
return unionFastGlobResults(results, filter);
|
||||
});
|
||||
|
||||
export const globbySync = normalizeArgumentsSync((patterns, options) => {
|
||||
const tasks = generateTasksSync(patterns, options);
|
||||
const filter = getFilterSync(options);
|
||||
const results = tasks.map(task => fastGlob.sync(task.patterns, task.options));
|
||||
|
||||
return unionFastGlobResults(results, filter);
|
||||
});
|
||||
|
||||
export const globbyStream = normalizeArgumentsSync((patterns, options) => {
|
||||
const tasks = generateTasksSync(patterns, options);
|
||||
const filter = getFilterSync(options);
|
||||
const streams = tasks.map(task => fastGlob.stream(task.patterns, task.options));
|
||||
|
||||
return unionFastGlobStreams(streams, filter);
|
||||
});
|
||||
|
||||
export const isDynamicPattern = normalizeArgumentsSync(
|
||||
(patterns, options) => patterns.some(pattern => fastGlob.isDynamicPattern(pattern, options)),
|
||||
);
|
||||
|
||||
export const generateGlobTasks = normalizeArguments(generateTasks);
|
||||
export const generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
||||
|
||||
export {
|
||||
isGitIgnored,
|
||||
isGitIgnoredSync,
|
||||
} from './ignore.js';
|
||||
9
node_modules/del/node_modules/globby/license
generated
vendored
Normal file
9
node_modules/del/node_modules/globby/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
96
node_modules/del/node_modules/globby/package.json
generated
vendored
Normal file
96
node_modules/del/node_modules/globby/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
"name": "globby",
|
||||
"version": "13.2.2",
|
||||
"description": "User-friendly glob matching",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/globby",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "Sindre Sorhus",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "npm update @globby/main-branch glob-stream fast-glob && node bench.js",
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"ignore.js",
|
||||
"utilities.js"
|
||||
],
|
||||
"keywords": [
|
||||
"all",
|
||||
"array",
|
||||
"directories",
|
||||
"expand",
|
||||
"files",
|
||||
"filesystem",
|
||||
"filter",
|
||||
"find",
|
||||
"fnmatch",
|
||||
"folders",
|
||||
"fs",
|
||||
"glob",
|
||||
"globbing",
|
||||
"globs",
|
||||
"gulpfriendly",
|
||||
"match",
|
||||
"matcher",
|
||||
"minimatch",
|
||||
"multi",
|
||||
"multiple",
|
||||
"paths",
|
||||
"pattern",
|
||||
"patterns",
|
||||
"traverse",
|
||||
"util",
|
||||
"utility",
|
||||
"wildcard",
|
||||
"wildcards",
|
||||
"promise",
|
||||
"gitignore",
|
||||
"git"
|
||||
],
|
||||
"dependencies": {
|
||||
"dir-glob": "^3.0.1",
|
||||
"fast-glob": "^3.3.0",
|
||||
"ignore": "^5.2.4",
|
||||
"merge2": "^1.4.1",
|
||||
"slash": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@globby/main-branch": "sindresorhus/globby#main",
|
||||
"@types/node": "^20.3.3",
|
||||
"ava": "^5.3.1",
|
||||
"benchmark": "2.1.4",
|
||||
"glob-stream": "^8.0.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"tempy": "^3.0.0",
|
||||
"tsd": "^0.28.1",
|
||||
"typescript": "^5.1.6",
|
||||
"xo": "^0.54.2"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"fixtures"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-definitions": "off",
|
||||
"n/prefer-global/url": "off",
|
||||
"@typescript-eslint/consistent-type-imports": "off"
|
||||
}
|
||||
},
|
||||
"ava": {
|
||||
"files": [
|
||||
"!tests/utilities.js"
|
||||
],
|
||||
"workerThreads": false
|
||||
}
|
||||
}
|
||||
183
node_modules/del/node_modules/globby/readme.md
generated
vendored
Normal file
183
node_modules/del/node_modules/globby/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
# globby
|
||||
|
||||
> User-friendly glob matching
|
||||
|
||||
Based on [`fast-glob`](https://github.com/mrmlnc/fast-glob) but adds a bunch of useful features.
|
||||
|
||||
## Features
|
||||
|
||||
- Promise API
|
||||
- Multiple patterns
|
||||
- Negated patterns: `['foo*', '!foobar']`
|
||||
- Expands directories: `foo` → `foo/**/*`
|
||||
- Supports `.gitignore` and similar ignore config files
|
||||
- Supports `URL` as `cwd`
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install globby
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
├── unicorn
|
||||
├── cake
|
||||
└── rainbow
|
||||
```
|
||||
|
||||
```js
|
||||
import {globby} from 'globby';
|
||||
|
||||
const paths = await globby(['*', '!cake']);
|
||||
|
||||
console.log(paths);
|
||||
//=> ['unicorn', 'rainbow']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
### globby(patterns, options?)
|
||||
|
||||
Returns a `Promise<string[]>` of matching paths.
|
||||
|
||||
#### patterns
|
||||
|
||||
Type: `string | string[]`
|
||||
|
||||
See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones below.
|
||||
|
||||
##### expandDirectories
|
||||
|
||||
Type: `boolean | string[] | object`\
|
||||
Default: `true`
|
||||
|
||||
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `object` with `files` and `extensions` like below:
|
||||
|
||||
```js
|
||||
import {globby} from 'globby';
|
||||
|
||||
(async () => {
|
||||
const paths = await globby('images', {
|
||||
expandDirectories: {
|
||||
files: ['cat', 'unicorn', '*.jpg'],
|
||||
extensions: ['png']
|
||||
}
|
||||
});
|
||||
|
||||
console.log(paths);
|
||||
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
|
||||
})();
|
||||
```
|
||||
|
||||
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
|
||||
|
||||
##### gitignore
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
|
||||
|
||||
##### ignoreFiles
|
||||
|
||||
Type: `string | string[]`\
|
||||
Default: `undefined`
|
||||
|
||||
Glob patterns to look for ignore files, which are then used to ignore globbed files.
|
||||
|
||||
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
|
||||
|
||||
### globbySync(patterns, options?)
|
||||
|
||||
Returns `string[]` of matching paths.
|
||||
|
||||
### globbyStream(patterns, options?)
|
||||
|
||||
Returns a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_readable_streams) of matching paths.
|
||||
|
||||
Since Node.js 10, [readable streams are iterable](https://nodejs.org/api/stream.html#stream_readable_symbol_asynciterator), so you can loop over glob matches in a [`for await...of` loop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) like this:
|
||||
|
||||
```js
|
||||
import {globbyStream} from 'globby';
|
||||
|
||||
(async () => {
|
||||
for await (const path of globbyStream('*.tmp')) {
|
||||
console.log(path);
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
### generateGlobTasks(patterns, options?)
|
||||
|
||||
Returns an `Promise<object[]>` in the format `{patterns: string[], options: Object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
|
||||
|
||||
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
|
||||
|
||||
### generateGlobTasksSync(patterns, options?)
|
||||
|
||||
Returns an `object[]` in the format `{patterns: string[], options: Object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
|
||||
|
||||
Takes the same arguments as `generateGlobTasks`.
|
||||
|
||||
### isDynamicPattern(patterns, options?)
|
||||
|
||||
Returns a `boolean` of whether there are any special glob characters in the `patterns`.
|
||||
|
||||
Note that the options affect the results.
|
||||
|
||||
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).
|
||||
|
||||
### isGitIgnored(options?)
|
||||
|
||||
Returns a `Promise<(path: URL | string) => boolean>` indicating whether a given path is ignored via a `.gitignore` file.
|
||||
|
||||
Takes `cwd?: URL | string` as options.
|
||||
|
||||
```js
|
||||
import {isGitIgnored} from 'globby';
|
||||
|
||||
const isIgnored = await isGitIgnored();
|
||||
|
||||
console.log(isIgnored('some/file'));
|
||||
```
|
||||
|
||||
### isGitIgnoredSync(options?)
|
||||
|
||||
Returns a `(path: URL | string) => boolean` indicating whether a given path is ignored via a `.gitignore` file.
|
||||
|
||||
Takes `cwd?: URL | string` as options.
|
||||
|
||||
## Globbing patterns
|
||||
|
||||
Just a quick overview.
|
||||
|
||||
- `*` matches any number of characters, but not `/`
|
||||
- `?` matches a single character, but not `/`
|
||||
- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
|
||||
- `{}` allows for a comma-separated list of "or" expressions
|
||||
- `!` at the beginning of a pattern will negate the match
|
||||
|
||||
[Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
|
||||
|
||||
## globby for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of globby and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-globby?utm_source=npm-globby&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem
|
||||
- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
|
||||
- [del](https://github.com/sindresorhus/del) - Delete files and directories
|
||||
- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed
|
||||
17
node_modules/del/node_modules/globby/utilities.js
generated
vendored
Normal file
17
node_modules/del/node_modules/globby/utilities.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import {fileURLToPath} from 'node:url';
|
||||
import {Transform} from 'node:stream';
|
||||
|
||||
export const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
||||
|
||||
export class FilterStream extends Transform {
|
||||
constructor(filter) {
|
||||
super({
|
||||
objectMode: true,
|
||||
transform(data, encoding, callback) {
|
||||
callback(undefined, filter(data) ? data : undefined);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const isNegativePattern = pattern => pattern[0] === '!';
|
||||
25
node_modules/del/node_modules/is-path-inside/index.d.ts
generated
vendored
Normal file
25
node_modules/del/node_modules/is-path-inside/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
Check if a path is inside another path.
|
||||
|
||||
Note that relative paths are resolved against `process.cwd()` to make them absolute.
|
||||
|
||||
_Important:_ This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system.
|
||||
|
||||
@example
|
||||
```
|
||||
import isPathInside from 'is-path-inside';
|
||||
|
||||
isPathInside('a/b/c', 'a/b');
|
||||
//=> true
|
||||
|
||||
isPathInside('a/b/c', 'x/y');
|
||||
//=> false
|
||||
|
||||
isPathInside('a/b/c', 'a/b/c');
|
||||
//=> false
|
||||
|
||||
isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus');
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export default function isPathInside(childPath: string, parentPath: string): boolean;
|
||||
12
node_modules/del/node_modules/is-path-inside/index.js
generated
vendored
Normal file
12
node_modules/del/node_modules/is-path-inside/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import path from 'node:path';
|
||||
|
||||
export default function isPathInside(childPath, parentPath) {
|
||||
const relation = path.relative(parentPath, childPath);
|
||||
|
||||
return Boolean(
|
||||
relation &&
|
||||
relation !== '..' &&
|
||||
!relation.startsWith(`..${path.sep}`) &&
|
||||
relation !== path.resolve(childPath)
|
||||
);
|
||||
}
|
||||
9
node_modules/del/node_modules/is-path-inside/license
generated
vendored
Normal file
9
node_modules/del/node_modules/is-path-inside/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
38
node_modules/del/node_modules/is-path-inside/package.json
generated
vendored
Normal file
38
node_modules/del/node_modules/is-path-inside/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "is-path-inside",
|
||||
"version": "4.0.0",
|
||||
"description": "Check if a path is inside another path",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-path-inside",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"inside",
|
||||
"folder",
|
||||
"directory",
|
||||
"file",
|
||||
"resolve"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.39.1"
|
||||
}
|
||||
}
|
||||
59
node_modules/del/node_modules/is-path-inside/readme.md
generated
vendored
Normal file
59
node_modules/del/node_modules/is-path-inside/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# is-path-inside
|
||||
|
||||
> Check if a path is inside another path
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-path-inside
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import isPathInside from 'is-path-inside';
|
||||
|
||||
isPathInside('a/b/c', 'a/b');
|
||||
//=> true
|
||||
|
||||
isPathInside('a/b/c', 'x/y');
|
||||
//=> false
|
||||
|
||||
isPathInside('a/b/c', 'a/b/c');
|
||||
//=> false
|
||||
|
||||
isPathInside('/Users/sindresorhus/dev/unicorn', '/Users/sindresorhus');
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### isPathInside(childPath, parentPath)
|
||||
|
||||
Note that relative paths are resolved against `process.cwd()` to make them absolute.
|
||||
|
||||
**Important:** This package is meant for use with path manipulation. It does not check if the paths exist nor does it resolve symlinks. You should not use this as a security mechanism to guard against access to certain places on the file system.
|
||||
|
||||
#### childPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The path that should be inside `parentPath`.
|
||||
|
||||
#### parentPath
|
||||
|
||||
Type: `string`
|
||||
|
||||
The path that should contain `childPath`.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-is-path-inside?utm_source=npm-is-path-inside&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
23
node_modules/del/node_modules/slash/index.d.ts
generated
vendored
Normal file
23
node_modules/del/node_modules/slash/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`.
|
||||
|
||||
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
|
||||
|
||||
@param path - A Windows backslash path.
|
||||
@returns A path with forward slashes.
|
||||
|
||||
@example
|
||||
```
|
||||
import path from 'path';
|
||||
import slash from 'slash';
|
||||
|
||||
const string = path.join('foo', 'bar');
|
||||
// Unix => foo/bar
|
||||
// Windows => foo\\bar
|
||||
|
||||
slash(string);
|
||||
// Unix => foo/bar
|
||||
// Windows => foo/bar
|
||||
```
|
||||
*/
|
||||
export default function slash(path: string): string;
|
||||
10
node_modules/del/node_modules/slash/index.js
generated
vendored
Normal file
10
node_modules/del/node_modules/slash/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export default function slash(path) {
|
||||
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
||||
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
|
||||
|
||||
if (isExtendedLengthPath || hasNonAscii) {
|
||||
return path;
|
||||
}
|
||||
|
||||
return path.replace(/\\/g, '/');
|
||||
}
|
||||
9
node_modules/del/node_modules/slash/license
generated
vendored
Normal file
9
node_modules/del/node_modules/slash/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
38
node_modules/del/node_modules/slash/package.json
generated
vendored
Normal file
38
node_modules/del/node_modules/slash/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "slash",
|
||||
"version": "4.0.0",
|
||||
"description": "Convert Windows backslash paths to slash paths",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/slash",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"seperator",
|
||||
"slash",
|
||||
"backslash",
|
||||
"windows",
|
||||
"convert"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
}
|
||||
}
|
||||
48
node_modules/del/node_modules/slash/readme.md
generated
vendored
Normal file
48
node_modules/del/node_modules/slash/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# slash
|
||||
|
||||
> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`
|
||||
|
||||
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
|
||||
|
||||
This was created since the `path` methods in Node.js outputs `\\` paths on Windows.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install slash
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import path from 'path';
|
||||
import slash from 'slash';
|
||||
|
||||
const string = path.join('foo', 'bar');
|
||||
// Unix => foo/bar
|
||||
// Windows => foo\\bar
|
||||
|
||||
slash(string);
|
||||
// Unix => foo/bar
|
||||
// Windows => foo/bar
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### slash(path)
|
||||
|
||||
Type: `string`
|
||||
|
||||
Accepts a Windows backslash path and returns a path with forward slashes.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-slash?utm_source=npm-slash&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
33
node_modules/del/package.json
generated
vendored
33
node_modules/del/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "del",
|
||||
"version": "6.1.1",
|
||||
"version": "7.0.0",
|
||||
"description": "Delete files and directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/del",
|
||||
|
|
@ -10,8 +10,11 @@
|
|||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
|
|
@ -46,21 +49,25 @@
|
|||
"filesystem"
|
||||
],
|
||||
"dependencies": {
|
||||
"globby": "^11.0.1",
|
||||
"graceful-fs": "^4.2.4",
|
||||
"is-glob": "^4.0.1",
|
||||
"is-path-cwd": "^2.2.0",
|
||||
"is-path-inside": "^3.0.2",
|
||||
"p-map": "^4.0.0",
|
||||
"globby": "^13.1.2",
|
||||
"graceful-fs": "^4.2.10",
|
||||
"is-glob": "^4.0.3",
|
||||
"is-path-cwd": "^3.0.0",
|
||||
"is-path-inside": "^4.0.0",
|
||||
"p-map": "^5.5.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"slash": "^3.0.0"
|
||||
"slash": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"ava": "^4.3.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"make-dir": "^3.1.0",
|
||||
"tempy": "^0.7.0",
|
||||
"tsd": "^0.13.1",
|
||||
"xo": "^0.33.1"
|
||||
"tempy": "^3.0.0",
|
||||
"tsd": "^0.22.0",
|
||||
"xo": "^0.50.0"
|
||||
},
|
||||
"ava": {
|
||||
"serial": true,
|
||||
"workerThreads": false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
node_modules/del/readme.md
generated
vendored
40
node_modules/del/readme.md
generated
vendored
|
|
@ -6,23 +6,21 @@ Similar to [rimraf](https://github.com/isaacs/rimraf), but with a Promise API an
|
|||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install del
|
||||
```sh
|
||||
npm install del
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const del = require('del');
|
||||
import {deleteAsync} from 'del';
|
||||
|
||||
(async () => {
|
||||
const deletedFilePaths = await del(['temp/*.js', '!temp/unicorn.js']);
|
||||
const deletedDirectoryPaths = await del(['temp', 'public']);
|
||||
const deletedFilePaths = await deleteAsync(['temp/*.js', '!temp/unicorn.js']);
|
||||
const deletedDirectoryPaths = await deleteAsync(['temp', 'public']);
|
||||
|
||||
console.log('Deleted files:\n', deletedFilePaths.join('\n'));
|
||||
console.log('\n\n');
|
||||
console.log('Deleted directories:\n', deletedDirectoryPaths.join('\n'));
|
||||
})();
|
||||
console.log('Deleted files:\n', deletedFilePaths.join('\n'));
|
||||
console.log('\n\n');
|
||||
console.log('Deleted directories:\n', deletedDirectoryPaths.join('\n'));
|
||||
```
|
||||
|
||||
## Beware
|
||||
|
|
@ -32,19 +30,19 @@ The glob pattern `**` matches all children and *the parent*.
|
|||
So this won't work:
|
||||
|
||||
```js
|
||||
del.sync(['public/assets/**', '!public/assets/goat.png']);
|
||||
deleteSync(['public/assets/**', '!public/assets/goat.png']);
|
||||
```
|
||||
|
||||
You have to explicitly ignore the parent directories too:
|
||||
|
||||
```js
|
||||
del.sync(['public/assets/**', '!public/assets', '!public/assets/goat.png']);
|
||||
deleteSync(['public/assets/**', '!public/assets', '!public/assets/goat.png']);
|
||||
```
|
||||
|
||||
To delete all subdirectories inside `public/`, you can do:
|
||||
|
||||
```js
|
||||
del.sync(['public/*/']);
|
||||
deleteSync(['public/*/']);
|
||||
```
|
||||
|
||||
Suggestions on how to improve this welcome!
|
||||
|
|
@ -53,11 +51,11 @@ Suggestions on how to improve this welcome!
|
|||
|
||||
Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`.
|
||||
|
||||
### del(patterns, options?)
|
||||
### deleteAsync(patterns, options?)
|
||||
|
||||
Returns `Promise<string[]>` with the deleted paths.
|
||||
|
||||
### del.sync(patterns, options?)
|
||||
### deleteSync(patterns, options?)
|
||||
|
||||
Returns `string[]` with the deleted paths.
|
||||
|
||||
|
|
@ -91,13 +89,11 @@ Default: `false`
|
|||
See what would be deleted.
|
||||
|
||||
```js
|
||||
const del = require('del');
|
||||
import {deleteAsync} from 'del';
|
||||
|
||||
(async () => {
|
||||
const deletedPaths = await del(['temp/*.js'], {dryRun: true});
|
||||
const deletedPaths = await deleteAsync(['temp/*.js'], {dryRun: true});
|
||||
|
||||
console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n'));
|
||||
})();
|
||||
console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n'));
|
||||
```
|
||||
|
||||
##### concurrency
|
||||
|
|
@ -115,9 +111,9 @@ Type: `(progress: ProgressData) => void`
|
|||
Called after each file or directory is deleted.
|
||||
|
||||
```js
|
||||
import del from 'del';
|
||||
import {deleteAsync} from 'del';
|
||||
|
||||
await del(patterns, {
|
||||
await deleteAsync(patterns, {
|
||||
onProgress: progress => {
|
||||
// …
|
||||
}});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue