schnee effeckt und fehler Korektur
This commit is contained in:
108
node_modules/globby/gitignore.js
generated
vendored
Normal file
108
node_modules/globby/gitignore.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
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 from './to-path.js';
|
||||
|
||||
const DEFAULT_IGNORE = [
|
||||
'**/node_modules/**',
|
||||
'**/flow-typed/**',
|
||||
'**/coverage/**',
|
||||
'**/.git',
|
||||
];
|
||||
|
||||
const mapGitIgnorePatternTo = base => ignore => {
|
||||
if (ignore.startsWith('!')) {
|
||||
return '!' + path.posix.join(base, ignore.slice(1));
|
||||
}
|
||||
|
||||
return path.posix.join(base, ignore);
|
||||
};
|
||||
|
||||
const parseGitIgnore = (content, options) => {
|
||||
const base = slash(path.relative(options.cwd, path.dirname(options.fileName)));
|
||||
|
||||
return content
|
||||
.split(/\r?\n/)
|
||||
.filter(Boolean)
|
||||
.filter(line => !line.startsWith('#'))
|
||||
.map(mapGitIgnorePatternTo(base));
|
||||
};
|
||||
|
||||
const reduceIgnore = files => {
|
||||
const ignores = gitIgnore();
|
||||
for (const file of files) {
|
||||
ignores.add(parseGitIgnore(file.content, {
|
||||
cwd: file.cwd,
|
||||
fileName: file.filePath,
|
||||
}));
|
||||
}
|
||||
|
||||
return ignores;
|
||||
};
|
||||
|
||||
const ensureAbsolutePathForCwd = (cwd, p) => {
|
||||
cwd = slash(cwd);
|
||||
if (path.isAbsolute(p)) {
|
||||
if (slash(p).startsWith(cwd)) {
|
||||
return p;
|
||||
}
|
||||
|
||||
throw new Error(`Path ${p} is not in cwd ${cwd}`);
|
||||
}
|
||||
|
||||
return path.join(cwd, p);
|
||||
};
|
||||
|
||||
const getIsIgnoredPredicate = (ignores, cwd) => p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, toPath(p.path || p)))));
|
||||
|
||||
const getFile = async (file, cwd) => {
|
||||
const filePath = path.join(cwd, file);
|
||||
const content = await fs.promises.readFile(filePath, 'utf8');
|
||||
|
||||
return {
|
||||
cwd,
|
||||
filePath,
|
||||
content,
|
||||
};
|
||||
};
|
||||
|
||||
const getFileSync = (file, cwd) => {
|
||||
const filePath = path.join(cwd, file);
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
return {
|
||||
cwd,
|
||||
filePath,
|
||||
content,
|
||||
};
|
||||
};
|
||||
|
||||
const normalizeOptions = ({
|
||||
ignore = [],
|
||||
cwd = slash(process.cwd()),
|
||||
} = {}) => ({ignore: [...DEFAULT_IGNORE, ...ignore], cwd: toPath(cwd)});
|
||||
|
||||
export const isGitIgnored = async options => {
|
||||
options = normalizeOptions(options);
|
||||
|
||||
const paths = await fastGlob('**/.gitignore', options);
|
||||
|
||||
const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
|
||||
const ignores = reduceIgnore(files);
|
||||
|
||||
return getIsIgnoredPredicate(ignores, options.cwd);
|
||||
};
|
||||
|
||||
export const isGitIgnoredSync = options => {
|
||||
options = normalizeOptions(options);
|
||||
|
||||
const paths = fastGlob.sync('**/.gitignore', options);
|
||||
|
||||
const files = paths.map(file => getFileSync(file, options.cwd));
|
||||
const ignores = reduceIgnore(files);
|
||||
|
||||
return getIsIgnoredPredicate(ignores, options.cwd);
|
||||
};
|
||||
188
node_modules/globby/index.d.ts
generated
vendored
Normal file
188
node_modules/globby/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
import {URL} from 'node:url'; // TODO: Remove this when https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34960 is fixed.
|
||||
import {Options as FastGlobOptions, Entry} from 'fast-glob';
|
||||
|
||||
export type GlobEntry = Entry;
|
||||
|
||||
export interface GlobTask {
|
||||
readonly pattern: 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;
|
||||
|
||||
/**
|
||||
The current working directory in which to search.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: URL | string;
|
||||
}
|
||||
|
||||
export interface GitignoreOptions {
|
||||
readonly cwd?: URL | string;
|
||||
readonly ignore?: readonly 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
|
||||
): 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;
|
||||
197
node_modules/globby/index.js
generated
vendored
Normal file
197
node_modules/globby/index.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
import fs from 'node:fs';
|
||||
import arrayUnion from 'array-union';
|
||||
import merge2 from 'merge2';
|
||||
import fastGlob from 'fast-glob';
|
||||
import dirGlob from 'dir-glob';
|
||||
import toPath from './to-path.js';
|
||||
import {isGitIgnored, isGitIgnoredSync} from './gitignore.js';
|
||||
import {FilterStream, UniqueStream} from './stream-utils.js';
|
||||
|
||||
const DEFAULT_FILTER = () => false;
|
||||
|
||||
const isNegative = pattern => pattern[0] === '!';
|
||||
|
||||
const assertPatternsInput = patterns => {
|
||||
if (!patterns.every(pattern => typeof pattern === 'string')) {
|
||||
throw new TypeError('Patterns must be a string or an array of strings');
|
||||
}
|
||||
};
|
||||
|
||||
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 getPathString = p => p.stats instanceof fs.Stats ? p.path : p;
|
||||
|
||||
export const generateGlobTasks = (patterns, taskOptions = {}) => {
|
||||
patterns = arrayUnion([patterns].flat());
|
||||
assertPatternsInput(patterns);
|
||||
|
||||
const globTasks = [];
|
||||
|
||||
taskOptions = {
|
||||
ignore: [],
|
||||
expandDirectories: true,
|
||||
...taskOptions,
|
||||
cwd: toPath(taskOptions.cwd),
|
||||
};
|
||||
|
||||
checkCwdOption(taskOptions);
|
||||
|
||||
for (const [index, pattern] of patterns.entries()) {
|
||||
if (isNegative(pattern)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const ignore = patterns
|
||||
.slice(index)
|
||||
.filter(pattern => isNegative(pattern))
|
||||
.map(pattern => pattern.slice(1));
|
||||
|
||||
const options = {
|
||||
...taskOptions,
|
||||
ignore: [...taskOptions.ignore, ...ignore],
|
||||
};
|
||||
|
||||
globTasks.push({pattern, options});
|
||||
}
|
||||
|
||||
return globTasks;
|
||||
};
|
||||
|
||||
const globDirectories = (task, fn) => {
|
||||
let options = {};
|
||||
if (task.options.cwd) {
|
||||
options.cwd = task.options.cwd;
|
||||
}
|
||||
|
||||
if (Array.isArray(task.options.expandDirectories)) {
|
||||
options = {
|
||||
...options,
|
||||
files: task.options.expandDirectories,
|
||||
};
|
||||
} else if (typeof task.options.expandDirectories === 'object') {
|
||||
options = {
|
||||
...options,
|
||||
...task.options.expandDirectories,
|
||||
};
|
||||
}
|
||||
|
||||
return fn(task.pattern, options);
|
||||
};
|
||||
|
||||
const getPattern = (task, fn) => task.options.expandDirectories ? globDirectories(task, fn) : [task.pattern];
|
||||
|
||||
const getFilterSync = options => options && options.gitignore
|
||||
? isGitIgnoredSync({cwd: options.cwd, ignore: options.ignore})
|
||||
: DEFAULT_FILTER;
|
||||
|
||||
const globToTask = task => async glob => {
|
||||
const {options} = task;
|
||||
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
|
||||
options.ignore = await dirGlob(options.ignore);
|
||||
}
|
||||
|
||||
return {
|
||||
pattern: glob,
|
||||
options,
|
||||
};
|
||||
};
|
||||
|
||||
const globToTaskSync = task => glob => {
|
||||
const {options} = task;
|
||||
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
|
||||
options.ignore = dirGlob.sync(options.ignore);
|
||||
}
|
||||
|
||||
return {
|
||||
pattern: glob,
|
||||
options,
|
||||
};
|
||||
};
|
||||
|
||||
export const globby = async (patterns, options) => {
|
||||
const globTasks = generateGlobTasks(patterns, options);
|
||||
|
||||
const getFilter = async () => options && options.gitignore
|
||||
? isGitIgnored({cwd: options.cwd, ignore: options.ignore})
|
||||
: DEFAULT_FILTER;
|
||||
|
||||
const getTasks = async () => {
|
||||
const tasks = await Promise.all(globTasks.map(async task => {
|
||||
const globs = await getPattern(task, dirGlob);
|
||||
return Promise.all(globs.map(globToTask(task)));
|
||||
}));
|
||||
|
||||
return arrayUnion(...tasks);
|
||||
};
|
||||
|
||||
const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
|
||||
const paths = await Promise.all(tasks.map(task => fastGlob(task.pattern, task.options)));
|
||||
|
||||
return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_)));
|
||||
};
|
||||
|
||||
export const globbySync = (patterns, options) => {
|
||||
const globTasks = generateGlobTasks(patterns, options);
|
||||
|
||||
const tasks = [];
|
||||
for (const task of globTasks) {
|
||||
const newTask = getPattern(task, dirGlob.sync).map(globToTaskSync(task));
|
||||
tasks.push(...newTask);
|
||||
}
|
||||
|
||||
const filter = getFilterSync(options);
|
||||
|
||||
let matches = [];
|
||||
for (const task of tasks) {
|
||||
matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options));
|
||||
}
|
||||
|
||||
return matches.filter(path_ => !filter(path_));
|
||||
};
|
||||
|
||||
export const globbyStream = (patterns, options) => {
|
||||
const globTasks = generateGlobTasks(patterns, options);
|
||||
|
||||
const tasks = [];
|
||||
for (const task of globTasks) {
|
||||
const newTask = getPattern(task, dirGlob.sync).map(globToTaskSync(task));
|
||||
tasks.push(...newTask);
|
||||
}
|
||||
|
||||
const filter = getFilterSync(options);
|
||||
const filterStream = new FilterStream(p => !filter(p));
|
||||
const uniqueStream = new UniqueStream();
|
||||
|
||||
return merge2(tasks.map(task => fastGlob.stream(task.pattern, task.options)))
|
||||
.pipe(filterStream)
|
||||
.pipe(uniqueStream);
|
||||
};
|
||||
|
||||
export const isDynamicPattern = (patterns, options = {}) => {
|
||||
options = {
|
||||
...options,
|
||||
cwd: toPath(options.cwd),
|
||||
};
|
||||
|
||||
return [patterns].flat().some(pattern => fastGlob.isDynamicPattern(pattern, options));
|
||||
};
|
||||
|
||||
export {
|
||||
isGitIgnored,
|
||||
isGitIgnoredSync,
|
||||
} from './gitignore.js';
|
||||
9
node_modules/globby/license
generated
vendored
Normal file
9
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.
|
||||
23
node_modules/globby/node_modules/slash/index.d.ts
generated
vendored
Normal file
23
node_modules/globby/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/globby/node_modules/slash/index.js
generated
vendored
Normal file
10
node_modules/globby/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/globby/node_modules/slash/license
generated
vendored
Normal file
9
node_modules/globby/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/globby/node_modules/slash/package.json
generated
vendored
Normal file
38
node_modules/globby/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/globby/node_modules/slash/readme.md
generated
vendored
Normal file
48
node_modules/globby/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>
|
||||
87
node_modules/globby/package.json
generated
vendored
Normal file
87
node_modules/globby/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "globby",
|
||||
"version": "12.2.0",
|
||||
"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 glob-stream fast-glob && matcha bench.js",
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"gitignore.js",
|
||||
"stream-utils.js",
|
||||
"to-path.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": {
|
||||
"array-union": "^3.0.1",
|
||||
"dir-glob": "^3.0.1",
|
||||
"fast-glob": "^3.2.7",
|
||||
"ignore": "^5.1.9",
|
||||
"merge2": "^1.4.1",
|
||||
"slash": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.11",
|
||||
"ava": "^3.15.0",
|
||||
"get-stream": "^6.0.1",
|
||||
"glob-stream": "^7.0.0",
|
||||
"globby": "sindresorhus/globby#main",
|
||||
"matcha": "^0.7.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsd": "^0.19.0",
|
||||
"typescript": "^4.5.2",
|
||||
"xo": "^0.47.0"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"fixtures"
|
||||
]
|
||||
}
|
||||
}
|
||||
168
node_modules/globby/readme.md
generated
vendored
Normal file
168
node_modules/globby/readme.md
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
# 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`
|
||||
- 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.
|
||||
|
||||
### 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 `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.
|
||||
|
||||
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.
|
||||
|
||||
### 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` and `ignore?: string[]` as options. `.gitignore` files matched by the ignore config are not used for the resulting filter function.
|
||||
|
||||
```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 the same options as `isGitIgnored`.
|
||||
|
||||
## 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
|
||||
40
node_modules/globby/stream-utils.js
generated
vendored
Normal file
40
node_modules/globby/stream-utils.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import {Transform} from 'node:stream';
|
||||
|
||||
class ObjectTransform extends Transform {
|
||||
constructor() {
|
||||
super({
|
||||
objectMode: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class FilterStream extends ObjectTransform {
|
||||
constructor(filter) {
|
||||
super();
|
||||
this._filter = filter;
|
||||
}
|
||||
|
||||
_transform(data, encoding, callback) {
|
||||
if (this._filter(data)) {
|
||||
this.push(data);
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
export class UniqueStream extends ObjectTransform {
|
||||
constructor() {
|
||||
super();
|
||||
this._pushed = new Set();
|
||||
}
|
||||
|
||||
_transform(data, encoding, callback) {
|
||||
if (!this._pushed.has(data)) {
|
||||
this.push(data);
|
||||
this._pushed.add(data);
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
}
|
||||
15
node_modules/globby/to-path.js
generated
vendored
Normal file
15
node_modules/globby/to-path.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import {fileURLToPath} from 'node:url';
|
||||
|
||||
const toPath = urlOrPath => {
|
||||
if (!urlOrPath) {
|
||||
return urlOrPath;
|
||||
}
|
||||
|
||||
if (urlOrPath instanceof URL) {
|
||||
urlOrPath = urlOrPath.href;
|
||||
}
|
||||
|
||||
return urlOrPath.startsWith('file://') ? fileURLToPath(urlOrPath) : urlOrPath;
|
||||
};
|
||||
|
||||
export default toPath;
|
||||
Reference in New Issue
Block a user