mirror of
https://github.com/github/codeql-action.git
synced 2026-01-02 20:50:05 +08:00
Fix dependency incompatibilities
This commit is contained in:
51
node_modules/del/node_modules/aggregate-error/index.d.ts
generated
vendored
Normal file
51
node_modules/del/node_modules/aggregate-error/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
Create an error from multiple errors.
|
||||
*/
|
||||
declare class AggregateError<T extends Error = Error> extends Error implements Iterable<T> {
|
||||
readonly name: 'AggregateError';
|
||||
|
||||
/**
|
||||
@param errors - If a string, a new `Error` is created with the string as the error message. If a non-Error object, a new `Error` is created with all properties from the object copied over.
|
||||
@returns An Error that is also an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables) for the individual errors.
|
||||
|
||||
@example
|
||||
```
|
||||
import AggregateError = require('aggregate-error');
|
||||
|
||||
const error = new AggregateError([new Error('foo'), 'bar', {message: 'baz'}]);
|
||||
|
||||
throw error;
|
||||
|
||||
// AggregateError:
|
||||
// Error: foo
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:33)
|
||||
// Error: bar
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
// Error: baz
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
// at AggregateError (/Users/sindresorhus/dev/aggregate-error/index.js:19:3)
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
// at Module._compile (module.js:556:32)
|
||||
// at Object.Module._extensions..js (module.js:565:10)
|
||||
// at Module.load (module.js:473:32)
|
||||
// at tryModuleLoad (module.js:432:12)
|
||||
// at Function.Module._load (module.js:424:3)
|
||||
// at Module.runMain (module.js:590:10)
|
||||
// at run (bootstrap_node.js:394:7)
|
||||
// at startup (bootstrap_node.js:149:9)
|
||||
|
||||
|
||||
for (const individualError of error) {
|
||||
console.log(individualError);
|
||||
}
|
||||
//=> [Error: foo]
|
||||
//=> [Error: bar]
|
||||
//=> [Error: baz]
|
||||
```
|
||||
*/
|
||||
constructor(errors: ReadonlyArray<T | {[key: string]: any} | string>);
|
||||
|
||||
[Symbol.iterator](): IterableIterator<T>;
|
||||
}
|
||||
|
||||
export = AggregateError;
|
||||
47
node_modules/del/node_modules/aggregate-error/index.js
generated
vendored
Normal file
47
node_modules/del/node_modules/aggregate-error/index.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
const indentString = require('indent-string');
|
||||
const cleanStack = require('clean-stack');
|
||||
|
||||
const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, '');
|
||||
|
||||
class AggregateError extends Error {
|
||||
constructor(errors) {
|
||||
if (!Array.isArray(errors)) {
|
||||
throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
|
||||
}
|
||||
|
||||
errors = [...errors].map(error => {
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (error !== null && typeof error === 'object') {
|
||||
// Handle plain error objects with message property and/or possibly other metadata
|
||||
return Object.assign(new Error(error.message), error);
|
||||
}
|
||||
|
||||
return new Error(error);
|
||||
});
|
||||
|
||||
let message = errors
|
||||
.map(error => {
|
||||
// The `stack` property is not standardized, so we can't assume it exists
|
||||
return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error);
|
||||
})
|
||||
.join('\n');
|
||||
message = '\n' + indentString(message, 4);
|
||||
super(message);
|
||||
|
||||
this.name = 'AggregateError';
|
||||
|
||||
Object.defineProperty(this, '_errors', {value: errors});
|
||||
}
|
||||
|
||||
* [Symbol.iterator]() {
|
||||
for (const error of this._errors) {
|
||||
yield error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AggregateError;
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
|
||||
|
||||
41
node_modules/del/node_modules/aggregate-error/package.json
generated
vendored
Normal file
41
node_modules/del/node_modules/aggregate-error/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "aggregate-error",
|
||||
"version": "3.1.0",
|
||||
"description": "Create an error from multiple errors",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/aggregate-error",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"aggregate",
|
||||
"error",
|
||||
"combine",
|
||||
"multiple",
|
||||
"many",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator"
|
||||
],
|
||||
"dependencies": {
|
||||
"clean-stack": "^2.0.0",
|
||||
"indent-string": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
||||
61
node_modules/del/node_modules/aggregate-error/readme.md
generated
vendored
Normal file
61
node_modules/del/node_modules/aggregate-error/readme.md
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# aggregate-error [](https://travis-ci.org/sindresorhus/aggregate-error)
|
||||
|
||||
> Create an error from multiple errors
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install aggregate-error
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const AggregateError = require('aggregate-error');
|
||||
|
||||
const error = new AggregateError([new Error('foo'), 'bar', {message: 'baz'}]);
|
||||
|
||||
throw error;
|
||||
/*
|
||||
AggregateError:
|
||||
Error: foo
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:33)
|
||||
Error: bar
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
Error: baz
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
at AggregateError (/Users/sindresorhus/dev/aggregate-error/index.js:19:3)
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-error/example.js:3:13)
|
||||
at Module._compile (module.js:556:32)
|
||||
at Object.Module._extensions..js (module.js:565:10)
|
||||
at Module.load (module.js:473:32)
|
||||
at tryModuleLoad (module.js:432:12)
|
||||
at Function.Module._load (module.js:424:3)
|
||||
at Module.runMain (module.js:590:10)
|
||||
at run (bootstrap_node.js:394:7)
|
||||
at startup (bootstrap_node.js:149:9)
|
||||
*/
|
||||
|
||||
for (const individualError of error) {
|
||||
console.log(individualError);
|
||||
}
|
||||
//=> [Error: foo]
|
||||
//=> [Error: bar]
|
||||
//=> [Error: baz]
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### AggregateError(errors)
|
||||
|
||||
Returns an `Error` that is also an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterables) for the individual errors.
|
||||
|
||||
#### errors
|
||||
|
||||
Type: `Array<Error|Object|string>`
|
||||
|
||||
If a string, a new `Error` is created with the string as the error message.<br>
|
||||
If a non-Error object, a new `Error` is created with all properties from the object copied over.
|
||||
47
node_modules/del/node_modules/clean-stack/index.d.ts
generated
vendored
Normal file
47
node_modules/del/node_modules/clean-stack/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
declare namespace cleanStack {
|
||||
interface Options {
|
||||
/**
|
||||
Prettify the file paths in the stack:
|
||||
|
||||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly pretty?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Clean up error stack traces. Removes the mostly unhelpful internal Node.js entries.
|
||||
|
||||
@param stack - The `stack` property of an `Error`.
|
||||
|
||||
@example
|
||||
```
|
||||
import cleanStack = require('clean-stack');
|
||||
|
||||
const error = new Error('Missing unicorn');
|
||||
|
||||
console.log(error.stack);
|
||||
|
||||
// Error: Missing unicorn
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
// at Module._compile (module.js:409:26)
|
||||
// at Object.Module._extensions..js (module.js:416:10)
|
||||
// at Module.load (module.js:343:32)
|
||||
// at Function.Module._load (module.js:300:12)
|
||||
// at Function.Module.runMain (module.js:441:10)
|
||||
// at startup (node.js:139:18)
|
||||
|
||||
console.log(cleanStack(error.stack));
|
||||
|
||||
// Error: Missing unicorn
|
||||
// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
```
|
||||
*/
|
||||
declare function cleanStack(
|
||||
stack: string,
|
||||
options?: cleanStack.Options
|
||||
): string;
|
||||
|
||||
export = cleanStack;
|
||||
40
node_modules/del/node_modules/clean-stack/index.js
generated
vendored
Normal file
40
node_modules/del/node_modules/clean-stack/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
|
||||
const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/;
|
||||
const pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;
|
||||
const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir();
|
||||
|
||||
module.exports = (stack, options) => {
|
||||
options = Object.assign({pretty: false}, options);
|
||||
|
||||
return stack.replace(/\\/g, '/')
|
||||
.split('\n')
|
||||
.filter(line => {
|
||||
const pathMatches = line.match(extractPathRegex);
|
||||
if (pathMatches === null || !pathMatches[1]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const match = pathMatches[1];
|
||||
|
||||
// Electron
|
||||
if (
|
||||
match.includes('.app/Contents/Resources/electron.asar') ||
|
||||
match.includes('.app/Contents/Resources/default_app.asar')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !pathRegex.test(match);
|
||||
})
|
||||
.filter(line => line.trim() !== '')
|
||||
.map(line => {
|
||||
if (options.pretty) {
|
||||
return line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));
|
||||
}
|
||||
|
||||
return line;
|
||||
})
|
||||
.join('\n');
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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:
|
||||
|
||||
39
node_modules/del/node_modules/clean-stack/package.json
generated
vendored
Normal file
39
node_modules/del/node_modules/clean-stack/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "clean-stack",
|
||||
"version": "2.2.0",
|
||||
"description": "Clean up error stack traces",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/clean-stack",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"clean",
|
||||
"stack",
|
||||
"trace",
|
||||
"traces",
|
||||
"error",
|
||||
"err",
|
||||
"electron"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"browser": {
|
||||
"os": false
|
||||
}
|
||||
}
|
||||
76
node_modules/del/node_modules/clean-stack/readme.md
generated
vendored
Normal file
76
node_modules/del/node_modules/clean-stack/readme.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# clean-stack [](https://travis-ci.org/sindresorhus/clean-stack)
|
||||
|
||||
> Clean up error stack traces
|
||||
|
||||
Removes the mostly unhelpful internal Node.js entries.
|
||||
|
||||
Also works in Electron.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install clean-stack
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const cleanStack = require('clean-stack');
|
||||
|
||||
const error = new Error('Missing unicorn');
|
||||
|
||||
console.log(error.stack);
|
||||
/*
|
||||
Error: Missing unicorn
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
at Module._compile (module.js:409:26)
|
||||
at Object.Module._extensions..js (module.js:416:10)
|
||||
at Module.load (module.js:343:32)
|
||||
at Function.Module._load (module.js:300:12)
|
||||
at Function.Module.runMain (module.js:441:10)
|
||||
at startup (node.js:139:18)
|
||||
*/
|
||||
|
||||
console.log(cleanStack(error.stack));
|
||||
/*
|
||||
Error: Missing unicorn
|
||||
at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
|
||||
*/
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### cleanStack(stack, [options])
|
||||
|
||||
#### stack
|
||||
|
||||
Type: `string`
|
||||
|
||||
The `stack` property of an `Error`.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### pretty
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Prettify the file paths in the stack:
|
||||
|
||||
`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [extrack-stack](https://github.com/sindresorhus/extract-stack) - Extract the actual stack of an error
|
||||
- [stack-utils](https://github.com/tapjs/stack-utils) - Captures and cleans stack traces
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
94
node_modules/del/node_modules/globby/ignore.js
generated
vendored
94
node_modules/del/node_modules/globby/ignore.js
generated
vendored
@@ -1,94 +0,0 @@
|
||||
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
205
node_modules/del/node_modules/globby/index.d.ts
generated
vendored
@@ -1,205 +0,0 @@
|
||||
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
229
node_modules/del/node_modules/globby/index.js
generated
vendored
@@ -1,229 +0,0 @@
|
||||
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';
|
||||
96
node_modules/del/node_modules/globby/package.json
generated
vendored
96
node_modules/del/node_modules/globby/package.json
generated
vendored
@@ -1,96 +0,0 @@
|
||||
{
|
||||
"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
183
node_modules/del/node_modules/globby/readme.md
generated
vendored
@@ -1,183 +0,0 @@
|
||||
# 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
17
node_modules/del/node_modules/globby/utilities.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
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] === '!';
|
||||
42
node_modules/del/node_modules/indent-string/index.d.ts
generated
vendored
Normal file
42
node_modules/del/node_modules/indent-string/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
declare namespace indentString {
|
||||
interface Options {
|
||||
/**
|
||||
The string to use for the indent.
|
||||
|
||||
@default ' '
|
||||
*/
|
||||
readonly indent?: string;
|
||||
|
||||
/**
|
||||
Also indent empty lines.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly includeEmptyLines?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Indent each line in a string.
|
||||
|
||||
@param string - The string to indent.
|
||||
@param count - How many times you want `options.indent` repeated. Default: `1`.
|
||||
|
||||
@example
|
||||
```
|
||||
import indentString = require('indent-string');
|
||||
|
||||
indentString('Unicorns\nRainbows', 4);
|
||||
//=> ' Unicorns\n Rainbows'
|
||||
|
||||
indentString('Unicorns\nRainbows', 4, {indent: '♥'});
|
||||
//=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
|
||||
```
|
||||
*/
|
||||
declare function indentString(
|
||||
string: string,
|
||||
count?: number,
|
||||
options?: indentString.Options
|
||||
): string;
|
||||
|
||||
export = indentString;
|
||||
35
node_modules/del/node_modules/indent-string/index.js
generated
vendored
Normal file
35
node_modules/del/node_modules/indent-string/index.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = (string, count = 1, options) => {
|
||||
options = {
|
||||
indent: ' ',
|
||||
includeEmptyLines: false,
|
||||
...options
|
||||
};
|
||||
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError(
|
||||
`Expected \`input\` to be a \`string\`, got \`${typeof string}\``
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof count !== 'number') {
|
||||
throw new TypeError(
|
||||
`Expected \`count\` to be a \`number\`, got \`${typeof count}\``
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof options.indent !== 'string') {
|
||||
throw new TypeError(
|
||||
`Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\``
|
||||
);
|
||||
}
|
||||
|
||||
if (count === 0) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
||||
|
||||
return string.replace(regex, options.indent.repeat(count));
|
||||
};
|
||||
9
node_modules/del/node_modules/indent-string/license
generated
vendored
Normal file
9
node_modules/del/node_modules/indent-string/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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.
|
||||
37
node_modules/del/node_modules/indent-string/package.json
generated
vendored
Normal file
37
node_modules/del/node_modules/indent-string/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "indent-string",
|
||||
"version": "4.0.0",
|
||||
"description": "Indent each line in a string",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/indent-string",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"indent",
|
||||
"string",
|
||||
"pad",
|
||||
"align",
|
||||
"line",
|
||||
"text",
|
||||
"each",
|
||||
"every"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
70
node_modules/del/node_modules/indent-string/readme.md
generated
vendored
Normal file
70
node_modules/del/node_modules/indent-string/readme.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# indent-string [](https://travis-ci.org/sindresorhus/indent-string)
|
||||
|
||||
> Indent each line in a string
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install indent-string
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const indentString = require('indent-string');
|
||||
|
||||
indentString('Unicorns\nRainbows', 4);
|
||||
//=> ' Unicorns\n Rainbows'
|
||||
|
||||
indentString('Unicorns\nRainbows', 4, {indent: '♥'});
|
||||
//=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### indentString(string, [count], [options])
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
The string to indent.
|
||||
|
||||
#### count
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `1`
|
||||
|
||||
How many times you want `options.indent` repeated.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### indent
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `' '`
|
||||
|
||||
The string to use for the indent.
|
||||
|
||||
##### includeEmptyLines
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Also indent empty lines.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [indent-string-cli](https://github.com/sindresorhus/indent-string-cli) - CLI for this module
|
||||
- [strip-indent](https://github.com/sindresorhus/strip-indent) - Strip leading whitespace from every line in a string
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
25
node_modules/del/node_modules/is-path-inside/index.d.ts
generated
vendored
25
node_modules/del/node_modules/is-path-inside/index.d.ts
generated
vendored
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
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
12
node_modules/del/node_modules/is-path-inside/index.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
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)
|
||||
);
|
||||
}
|
||||
38
node_modules/del/node_modules/is-path-inside/package.json
generated
vendored
38
node_modules/del/node_modules/is-path-inside/package.json
generated
vendored
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"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
59
node_modules/del/node_modules/is-path-inside/readme.md
generated
vendored
@@ -1,59 +0,0 @@
|
||||
# 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>
|
||||
67
node_modules/del/node_modules/p-map/index.d.ts
generated
vendored
Normal file
67
node_modules/del/node_modules/p-map/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
declare namespace pMap {
|
||||
interface Options {
|
||||
/**
|
||||
Number of concurrently pending promises returned by `mapper`.
|
||||
|
||||
Must be an integer from 1 and up or `Infinity`.
|
||||
|
||||
@default Infinity
|
||||
*/
|
||||
readonly concurrency?: number;
|
||||
|
||||
/**
|
||||
When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly stopOnError?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
||||
|
||||
@param element - Iterated element.
|
||||
@param index - Index of the element in the source array.
|
||||
*/
|
||||
type Mapper<Element = any, NewElement = unknown> = (
|
||||
element: Element,
|
||||
index: number
|
||||
) => NewElement | Promise<NewElement>;
|
||||
}
|
||||
|
||||
/**
|
||||
@param input - Iterated over concurrently in the `mapper` function.
|
||||
@param mapper - Function which is called for every item in `input`. Expected to return a `Promise` or value.
|
||||
@returns A `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
|
||||
|
||||
@example
|
||||
```
|
||||
import pMap = require('p-map');
|
||||
import got = require('got');
|
||||
|
||||
const sites = [
|
||||
getWebsiteFromUsername('https://sindresorhus'), //=> Promise
|
||||
'https://ava.li',
|
||||
'https://github.com'
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const mapper = async site => {
|
||||
const {requestUrl} = await got.head(site);
|
||||
return requestUrl;
|
||||
};
|
||||
|
||||
const result = await pMap(sites, mapper, {concurrency: 2});
|
||||
|
||||
console.log(result);
|
||||
//=> ['https://sindresorhus.com/', 'https://ava.li/', 'https://github.com/']
|
||||
})();
|
||||
```
|
||||
*/
|
||||
declare function pMap<Element, NewElement>(
|
||||
input: Iterable<Element>,
|
||||
mapper: pMap.Mapper<Element, NewElement>,
|
||||
options?: pMap.Options
|
||||
): Promise<NewElement[]>;
|
||||
|
||||
export = pMap;
|
||||
81
node_modules/del/node_modules/p-map/index.js
generated
vendored
Normal file
81
node_modules/del/node_modules/p-map/index.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
const AggregateError = require('aggregate-error');
|
||||
|
||||
module.exports = async (
|
||||
iterable,
|
||||
mapper,
|
||||
{
|
||||
concurrency = Infinity,
|
||||
stopOnError = true
|
||||
} = {}
|
||||
) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (typeof mapper !== 'function') {
|
||||
throw new TypeError('Mapper function is required');
|
||||
}
|
||||
|
||||
if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) {
|
||||
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
||||
}
|
||||
|
||||
const result = [];
|
||||
const errors = [];
|
||||
const iterator = iterable[Symbol.iterator]();
|
||||
let isRejected = false;
|
||||
let isIterableDone = false;
|
||||
let resolvingCount = 0;
|
||||
let currentIndex = 0;
|
||||
|
||||
const next = () => {
|
||||
if (isRejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextItem = iterator.next();
|
||||
const index = currentIndex;
|
||||
currentIndex++;
|
||||
|
||||
if (nextItem.done) {
|
||||
isIterableDone = true;
|
||||
|
||||
if (resolvingCount === 0) {
|
||||
if (!stopOnError && errors.length !== 0) {
|
||||
reject(new AggregateError(errors));
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
resolvingCount++;
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const element = await nextItem.value;
|
||||
result[index] = await mapper(element, index);
|
||||
resolvingCount--;
|
||||
next();
|
||||
} catch (error) {
|
||||
if (stopOnError) {
|
||||
isRejected = true;
|
||||
reject(error);
|
||||
} else {
|
||||
errors.push(error);
|
||||
resolvingCount--;
|
||||
next();
|
||||
}
|
||||
}
|
||||
})();
|
||||
};
|
||||
|
||||
for (let i = 0; i < concurrency; i++) {
|
||||
next();
|
||||
|
||||
if (isIterableDone) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
53
node_modules/del/node_modules/p-map/package.json
generated
vendored
Normal file
53
node_modules/del/node_modules/p-map/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "p-map",
|
||||
"version": "4.0.0",
|
||||
"description": "Map over promises concurrently",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-map",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"map",
|
||||
"resolved",
|
||||
"wait",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"race",
|
||||
"fulfilled",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"concurrently",
|
||||
"concurrency",
|
||||
"parallel",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"aggregate-error": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.2.0",
|
||||
"delay": "^4.1.0",
|
||||
"in-range": "^2.0.0",
|
||||
"random-int": "^2.0.0",
|
||||
"time-span": "^3.1.0",
|
||||
"tsd": "^0.7.4",
|
||||
"xo": "^0.27.2"
|
||||
}
|
||||
}
|
||||
89
node_modules/del/node_modules/p-map/readme.md
generated
vendored
Normal file
89
node_modules/del/node_modules/p-map/readme.md
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
# p-map [](https://travis-ci.org/sindresorhus/p-map)
|
||||
|
||||
> Map over promises concurrently
|
||||
|
||||
Useful when you need to run promise-returning & async functions multiple times with different inputs concurrently.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-map
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pMap = require('p-map');
|
||||
const got = require('got');
|
||||
|
||||
const sites = [
|
||||
getWebsiteFromUsername('https://sindresorhus'), //=> Promise
|
||||
'https://ava.li',
|
||||
'https://github.com'
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const mapper = async site => {
|
||||
const {requestUrl} = await got.head(site);
|
||||
return requestUrl;
|
||||
};
|
||||
|
||||
const result = await pMap(sites, mapper, {concurrency: 2});
|
||||
|
||||
console.log(result);
|
||||
//=> ['https://sindresorhus.com/', 'https://ava.li/', 'https://github.com/']
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### pMap(input, mapper, options?)
|
||||
|
||||
Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<Promise | unknown>`
|
||||
|
||||
Iterated over concurrently in the `mapper` function.
|
||||
|
||||
#### mapper(element, index)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Expected to return a `Promise` or value.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number` (Integer)\
|
||||
Default: `Infinity`\
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises returned by `mapper`.
|
||||
|
||||
##### stopOnError
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
When set to `false`, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an [aggregated error](https://github.com/sindresorhus/aggregate-error) containing all the errors from the rejected promises.
|
||||
|
||||
## p-map for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of p-map 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-p-map?utm_source=npm-p-map&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
|
||||
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
|
||||
- [p-times](https://github.com/sindresorhus/p-times) - Run promise-returning & async functions a specific number of times concurrently
|
||||
- [p-props](https://github.com/sindresorhus/p-props) - Like `Promise.all()` but for `Map` and `Object`
|
||||
- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially
|
||||
- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
23
node_modules/del/node_modules/slash/index.d.ts
generated
vendored
23
node_modules/del/node_modules/slash/index.d.ts
generated
vendored
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
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
10
node_modules/del/node_modules/slash/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
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, '/');
|
||||
}
|
||||
38
node_modules/del/node_modules/slash/package.json
generated
vendored
38
node_modules/del/node_modules/slash/package.json
generated
vendored
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"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
48
node_modules/del/node_modules/slash/readme.md
generated
vendored
@@ -1,48 +0,0 @@
|
||||
# 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>
|
||||
Reference in New Issue
Block a user