diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
---|---|---|
committer | Dimitri Staessens <dimitri@ouroboros.rocks> | 2019-10-06 21:37:45 +0200 |
commit | 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch) | |
tree | c7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/fast-glob/out/utils | |
parent | 412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff) | |
download | website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip |
build: Add some required modules for node
Diffstat (limited to 'node_modules/fast-glob/out/utils')
-rw-r--r-- | node_modules/fast-glob/out/utils/array.d.ts | 4 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/array.js | 9 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/path.d.ts | 12 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/path.js | 28 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/pattern.d.ts | 74 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/pattern.js | 148 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/stream.d.ts | 5 | ||||
-rw-r--r-- | node_modules/fast-glob/out/utils/stream.js | 14 |
8 files changed, 294 insertions, 0 deletions
diff --git a/node_modules/fast-glob/out/utils/array.d.ts b/node_modules/fast-glob/out/utils/array.d.ts new file mode 100644 index 0000000..60c9086 --- /dev/null +++ b/node_modules/fast-glob/out/utils/array.d.ts @@ -0,0 +1,4 @@ +/** + * Flatten nested arrays (max depth is 2) into a non-nested array of non-array items. + */ +export declare function flatten<T>(items: T[][]): T[]; diff --git a/node_modules/fast-glob/out/utils/array.js b/node_modules/fast-glob/out/utils/array.js new file mode 100644 index 0000000..54c7f1b --- /dev/null +++ b/node_modules/fast-glob/out/utils/array.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Flatten nested arrays (max depth is 2) into a non-nested array of non-array items. + */ +function flatten(items) { + return items.reduce(function (collection, item) { return [].concat(collection, item); }, []); +} +exports.flatten = flatten; diff --git a/node_modules/fast-glob/out/utils/path.d.ts b/node_modules/fast-glob/out/utils/path.d.ts new file mode 100644 index 0000000..87dfe19 --- /dev/null +++ b/node_modules/fast-glob/out/utils/path.d.ts @@ -0,0 +1,12 @@ +/** + * Returns «true» if the last partial of the path starting with a period. + */ +export declare function isDotDirectory(filepath: string): boolean; +/** + * Convert a windows-like path to a unix-style path. + */ +export declare function normalize(filepath: string): string; +/** + * Returns normalized absolute path of provided filepath. + */ +export declare function makeAbsolute(cwd: string, filepath: string): string; diff --git a/node_modules/fast-glob/out/utils/path.js b/node_modules/fast-glob/out/utils/path.js new file mode 100644 index 0000000..cf4baea --- /dev/null +++ b/node_modules/fast-glob/out/utils/path.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var path = require("path"); +/** + * Returns «true» if the last partial of the path starting with a period. + */ +function isDotDirectory(filepath) { + return path.basename(filepath).startsWith('.'); +} +exports.isDotDirectory = isDotDirectory; +/** + * Convert a windows-like path to a unix-style path. + */ +function normalize(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.normalize = normalize; +/** + * Returns normalized absolute path of provided filepath. + */ +function makeAbsolute(cwd, filepath) { + if (path.isAbsolute(filepath)) { + return normalize(filepath); + } + var fullpath = path.resolve(cwd, filepath); + return normalize(fullpath); +} +exports.makeAbsolute = makeAbsolute; diff --git a/node_modules/fast-glob/out/utils/pattern.d.ts b/node_modules/fast-glob/out/utils/pattern.d.ts new file mode 100644 index 0000000..567aefd --- /dev/null +++ b/node_modules/fast-glob/out/utils/pattern.d.ts @@ -0,0 +1,74 @@ +import micromatch = require('micromatch'); +import { Pattern, PatternRe } from '../types/patterns'; +/** + * Return true for static pattern. + */ +export declare function isStaticPattern(pattern: Pattern): boolean; +/** + * Return true for pattern that looks like glob. + */ +export declare function isDynamicPattern(pattern: Pattern): boolean; +/** + * Convert a windows «path» to a unix-style «path». + */ +export declare function unixifyPattern(pattern: Pattern): Pattern; +/** + * Returns negative pattern as positive pattern. + */ +export declare function convertToPositivePattern(pattern: Pattern): Pattern; +/** + * Returns positive pattern as negative pattern. + */ +export declare function convertToNegativePattern(pattern: Pattern): Pattern; +/** + * Return true if provided pattern is negative pattern. + */ +export declare function isNegativePattern(pattern: Pattern): boolean; +/** + * Return true if provided pattern is positive pattern. + */ +export declare function isPositivePattern(pattern: Pattern): boolean; +/** + * Extracts negative patterns from array of patterns. + */ +export declare function getNegativePatterns(patterns: Pattern[]): Pattern[]; +/** + * Extracts positive patterns from array of patterns. + */ +export declare function getPositivePatterns(patterns: Pattern[]): Pattern[]; +/** + * Extract base directory from provided pattern. + */ +export declare function getBaseDirectory(pattern: Pattern): string; +/** + * Return true if provided pattern has globstar. + */ +export declare function hasGlobStar(pattern: Pattern): boolean; +/** + * Return true if provided pattern ends with slash and globstar. + */ +export declare function endsWithSlashGlobStar(pattern: Pattern): boolean; +/** + * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern. + */ +export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean; +/** + * Return naive depth of provided pattern without depth of the base directory. + */ +export declare function getNaiveDepth(pattern: Pattern): number; +/** + * Return max naive depth of provided patterns without depth of the base directory. + */ +export declare function getMaxNaivePatternsDepth(patterns: Pattern[]): number; +/** + * Make RegExp for provided pattern. + */ +export declare function makeRe(pattern: Pattern, options: micromatch.Options): PatternRe; +/** + * Convert patterns to regexps. + */ +export declare function convertPatternsToRe(patterns: Pattern[], options: micromatch.Options): PatternRe[]; +/** + * Returns true if the entry match any of the given RegExp's. + */ +export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean; diff --git a/node_modules/fast-glob/out/utils/pattern.js b/node_modules/fast-glob/out/utils/pattern.js new file mode 100644 index 0000000..ee70908 --- /dev/null +++ b/node_modules/fast-glob/out/utils/pattern.js @@ -0,0 +1,148 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var path = require("path"); +var globParent = require("glob-parent"); +var isGlob = require("is-glob"); +var micromatch = require("micromatch"); +var GLOBSTAR = '**'; +/** + * Return true for static pattern. + */ +function isStaticPattern(pattern) { + return !isDynamicPattern(pattern); +} +exports.isStaticPattern = isStaticPattern; +/** + * Return true for pattern that looks like glob. + */ +function isDynamicPattern(pattern) { + return isGlob(pattern); +} +exports.isDynamicPattern = isDynamicPattern; +/** + * Convert a windows «path» to a unix-style «path». + */ +function unixifyPattern(pattern) { + return pattern.replace(/\\/g, '/'); +} +exports.unixifyPattern = unixifyPattern; +/** + * Returns negative pattern as positive pattern. + */ +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +/** + * Returns positive pattern as negative pattern. + */ +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +/** + * Return true if provided pattern is negative pattern. + */ +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +/** + * Return true if provided pattern is positive pattern. + */ +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +/** + * Extracts negative patterns from array of patterns. + */ +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +/** + * Extracts positive patterns from array of patterns. + */ +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +/** + * Extract base directory from provided pattern. + */ +function getBaseDirectory(pattern) { + return globParent(pattern); +} +exports.getBaseDirectory = getBaseDirectory; +/** + * Return true if provided pattern has globstar. + */ +function hasGlobStar(pattern) { + return pattern.indexOf(GLOBSTAR) !== -1; +} +exports.hasGlobStar = hasGlobStar; +/** + * Return true if provided pattern ends with slash and globstar. + */ +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +/** + * Returns «true» when pattern ends with a slash and globstar or the last partial of the pattern is static pattern. + */ +function isAffectDepthOfReadingPattern(pattern) { + var basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +/** + * Return naive depth of provided pattern without depth of the base directory. + */ +function getNaiveDepth(pattern) { + var base = getBaseDirectory(pattern); + var patternDepth = pattern.split('/').length; + var patternBaseDepth = base.split('/').length; + /** + * This is a hack for pattern that has no base directory. + * + * This is related to the `*\something\*` pattern. + */ + if (base === '.') { + return patternDepth - patternBaseDepth; + } + return patternDepth - patternBaseDepth - 1; +} +exports.getNaiveDepth = getNaiveDepth; +/** + * Return max naive depth of provided patterns without depth of the base directory. + */ +function getMaxNaivePatternsDepth(patterns) { + return patterns.reduce(function (max, pattern) { + var depth = getNaiveDepth(pattern); + return depth > max ? depth : max; + }, 0); +} +exports.getMaxNaivePatternsDepth = getMaxNaivePatternsDepth; +/** + * Make RegExp for provided pattern. + */ +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +/** + * Convert patterns to regexps. + */ +function convertPatternsToRe(patterns, options) { + return patterns.map(function (pattern) { return makeRe(pattern, options); }); +} +exports.convertPatternsToRe = convertPatternsToRe; +/** + * Returns true if the entry match any of the given RegExp's. + */ +function matchAny(entry, patternsRe) { + return patternsRe.some(function (patternRe) { return patternRe.test(entry); }); +} +exports.matchAny = matchAny; diff --git a/node_modules/fast-glob/out/utils/stream.d.ts b/node_modules/fast-glob/out/utils/stream.d.ts new file mode 100644 index 0000000..af67264 --- /dev/null +++ b/node_modules/fast-glob/out/utils/stream.d.ts @@ -0,0 +1,5 @@ +/// <reference types="node" /> +/** + * Merge multiple streams and propagate their errors into one stream in parallel. + */ +export declare function merge(streams: NodeJS.ReadableStream[]): NodeJS.ReadableStream; diff --git a/node_modules/fast-glob/out/utils/stream.js b/node_modules/fast-glob/out/utils/stream.js new file mode 100644 index 0000000..03134e9 --- /dev/null +++ b/node_modules/fast-glob/out/utils/stream.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var merge2 = require("merge2"); +/** + * Merge multiple streams and propagate their errors into one stream in parallel. + */ +function merge(streams) { + var mergedStream = merge2(streams); + streams.forEach(function (stream) { + stream.on('error', function (err) { return mergedStream.emit('error', err); }); + }); + return mergedStream; +} +exports.merge = merge; |