@wix/cli
Version:
CLI tool for building Wix sites and applications
1,375 lines (1,346 loc) • 132 kB
JavaScript
import { createRequire as _createRequire } from 'node:module';
const require = _createRequire(import.meta.url);
import {
require_braces,
require_glob_parent,
require_picomatch,
require_utils
} from "./chunk-K6JLY75P.js";
import {
__commonJS,
__require,
__toESM,
init_esm_shims
} from "./chunk-EXLZF52D.js";
// ../../node_modules/fast-glob/out/utils/array.js
var require_array = __commonJS({
"../../node_modules/fast-glob/out/utils/array.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.splitWhen = exports.flatten = void 0;
function flatten(items) {
return items.reduce((collection, item) => [].concat(collection, item), []);
}
exports.flatten = flatten;
function splitWhen(items, predicate) {
const result = [[]];
let groupIndex = 0;
for (const item of items) {
if (predicate(item)) {
groupIndex++;
result[groupIndex] = [];
} else {
result[groupIndex].push(item);
}
}
return result;
}
exports.splitWhen = splitWhen;
}
});
// ../../node_modules/fast-glob/out/utils/errno.js
var require_errno = __commonJS({
"../../node_modules/fast-glob/out/utils/errno.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEnoentCodeError = void 0;
function isEnoentCodeError(error) {
return error.code === "ENOENT";
}
exports.isEnoentCodeError = isEnoentCodeError;
}
});
// ../../node_modules/fast-glob/out/utils/fs.js
var require_fs = __commonJS({
"../../node_modules/fast-glob/out/utils/fs.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDirentFromStats = void 0;
var DirentFromStats = class {
constructor(name, stats) {
this.name = name;
this.isBlockDevice = stats.isBlockDevice.bind(stats);
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
this.isDirectory = stats.isDirectory.bind(stats);
this.isFIFO = stats.isFIFO.bind(stats);
this.isFile = stats.isFile.bind(stats);
this.isSocket = stats.isSocket.bind(stats);
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
}
};
function createDirentFromStats(name, stats) {
return new DirentFromStats(name, stats);
}
exports.createDirentFromStats = createDirentFromStats;
}
});
// ../../node_modules/fast-glob/out/utils/path.js
var require_path = __commonJS({
"../../node_modules/fast-glob/out/utils/path.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
var os = __require("os");
var path2 = __require("path");
var IS_WINDOWS_PLATFORM = os.platform() === "win32";
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
var DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
var WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
function unixify(filepath) {
return filepath.replace(/\\/g, "/");
}
exports.unixify = unixify;
function makeAbsolute(cwd, filepath) {
return path2.resolve(cwd, filepath);
}
exports.makeAbsolute = makeAbsolute;
function removeLeadingDotSegment(entry) {
if (entry.charAt(0) === ".") {
const secondCharactery = entry.charAt(1);
if (secondCharactery === "/" || secondCharactery === "\\") {
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
}
}
return entry;
}
exports.removeLeadingDotSegment = removeLeadingDotSegment;
exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
function escapeWindowsPath(pattern) {
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
}
exports.escapeWindowsPath = escapeWindowsPath;
function escapePosixPath(pattern) {
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
}
exports.escapePosixPath = escapePosixPath;
exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
function convertWindowsPathToPattern(filepath) {
return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/");
}
exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
function convertPosixPathToPattern(filepath) {
return escapePosixPath(filepath);
}
exports.convertPosixPathToPattern = convertPosixPathToPattern;
}
});
// ../../node_modules/micromatch/index.js
var require_micromatch = __commonJS({
"../../node_modules/micromatch/index.js"(exports, module) {
"use strict";
init_esm_shims();
var util = __require("util");
var braces = require_braces();
var picomatch = require_picomatch();
var utils = require_utils();
var isEmptyString = (v) => v === "" || v === "./";
var hasBraces = (v) => {
const index = v.indexOf("{");
return index > -1 && v.indexOf("}", index) > -1;
};
var micromatch = (list, patterns, options) => {
patterns = [].concat(patterns);
list = [].concat(list);
let omit = /* @__PURE__ */ new Set();
let keep = /* @__PURE__ */ new Set();
let items = /* @__PURE__ */ new Set();
let negatives = 0;
let onResult = (state) => {
items.add(state.output);
if (options && options.onResult) {
options.onResult(state);
}
};
for (let i = 0; i < patterns.length; i++) {
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
if (negated) negatives++;
for (let item of list) {
let matched = isMatch(item, true);
let match = negated ? !matched.isMatch : matched.isMatch;
if (!match) continue;
if (negated) {
omit.add(matched.output);
} else {
omit.delete(matched.output);
keep.add(matched.output);
}
}
}
let result = negatives === patterns.length ? [...items] : [...keep];
let matches = result.filter((item) => !omit.has(item));
if (options && matches.length === 0) {
if (options.failglob === true) {
throw new Error(`No matches found for "${patterns.join(", ")}"`);
}
if (options.nonull === true || options.nullglob === true) {
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
}
}
return matches;
};
micromatch.match = micromatch;
micromatch.matcher = (pattern, options) => picomatch(pattern, options);
micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
micromatch.any = micromatch.isMatch;
micromatch.not = (list, patterns, options = {}) => {
patterns = [].concat(patterns).map(String);
let result = /* @__PURE__ */ new Set();
let items = [];
let onResult = (state) => {
if (options.onResult) options.onResult(state);
items.push(state.output);
};
let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
for (let item of items) {
if (!matches.has(item)) {
result.add(item);
}
}
return [...result];
};
micromatch.contains = (str, pattern, options) => {
if (typeof str !== "string") {
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
}
if (Array.isArray(pattern)) {
return pattern.some((p) => micromatch.contains(str, p, options));
}
if (typeof pattern === "string") {
if (isEmptyString(str) || isEmptyString(pattern)) {
return false;
}
if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
return true;
}
}
return micromatch.isMatch(str, pattern, { ...options, contains: true });
};
micromatch.matchKeys = (obj, patterns, options) => {
if (!utils.isObject(obj)) {
throw new TypeError("Expected the first argument to be an object");
}
let keys = micromatch(Object.keys(obj), patterns, options);
let res = {};
for (let key of keys) res[key] = obj[key];
return res;
};
micromatch.some = (list, patterns, options) => {
let items = [].concat(list);
for (let pattern of [].concat(patterns)) {
let isMatch = picomatch(String(pattern), options);
if (items.some((item) => isMatch(item))) {
return true;
}
}
return false;
};
micromatch.every = (list, patterns, options) => {
let items = [].concat(list);
for (let pattern of [].concat(patterns)) {
let isMatch = picomatch(String(pattern), options);
if (!items.every((item) => isMatch(item))) {
return false;
}
}
return true;
};
micromatch.all = (str, patterns, options) => {
if (typeof str !== "string") {
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
}
return [].concat(patterns).every((p) => picomatch(p, options)(str));
};
micromatch.capture = (glob, input, options) => {
let posix = utils.isWindows(options);
let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
if (match) {
return match.slice(1).map((v) => v === void 0 ? "" : v);
}
};
micromatch.makeRe = (...args) => picomatch.makeRe(...args);
micromatch.scan = (...args) => picomatch.scan(...args);
micromatch.parse = (patterns, options) => {
let res = [];
for (let pattern of [].concat(patterns || [])) {
for (let str of braces(String(pattern), options)) {
res.push(picomatch.parse(str, options));
}
}
return res;
};
micromatch.braces = (pattern, options) => {
if (typeof pattern !== "string") throw new TypeError("Expected a string");
if (options && options.nobrace === true || !hasBraces(pattern)) {
return [pattern];
}
return braces(pattern, options);
};
micromatch.braceExpand = (pattern, options) => {
if (typeof pattern !== "string") throw new TypeError("Expected a string");
return micromatch.braces(pattern, { ...options, expand: true });
};
micromatch.hasBraces = hasBraces;
module.exports = micromatch;
}
});
// ../../node_modules/fast-glob/out/utils/pattern.js
var require_pattern = __commonJS({
"../../node_modules/fast-glob/out/utils/pattern.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
var path2 = __require("path");
var globParent = require_glob_parent();
var micromatch = require_micromatch();
var GLOBSTAR = "**";
var ESCAPE_SYMBOL = "\\";
var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
function isStaticPattern(pattern, options = {}) {
return !isDynamicPattern2(pattern, options);
}
exports.isStaticPattern = isStaticPattern;
function isDynamicPattern2(pattern, options = {}) {
if (pattern === "") {
return false;
}
if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
return true;
}
if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
return true;
}
if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
return true;
}
if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
return true;
}
return false;
}
exports.isDynamicPattern = isDynamicPattern2;
function hasBraceExpansion(pattern) {
const openingBraceIndex = pattern.indexOf("{");
if (openingBraceIndex === -1) {
return false;
}
const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
if (closingBraceIndex === -1) {
return false;
}
const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
}
function convertToPositivePattern(pattern) {
return isNegativePattern2(pattern) ? pattern.slice(1) : pattern;
}
exports.convertToPositivePattern = convertToPositivePattern;
function convertToNegativePattern(pattern) {
return "!" + pattern;
}
exports.convertToNegativePattern = convertToNegativePattern;
function isNegativePattern2(pattern) {
return pattern.startsWith("!") && pattern[1] !== "(";
}
exports.isNegativePattern = isNegativePattern2;
function isPositivePattern(pattern) {
return !isNegativePattern2(pattern);
}
exports.isPositivePattern = isPositivePattern;
function getNegativePatterns(patterns) {
return patterns.filter(isNegativePattern2);
}
exports.getNegativePatterns = getNegativePatterns;
function getPositivePatterns(patterns) {
return patterns.filter(isPositivePattern);
}
exports.getPositivePatterns = getPositivePatterns;
function getPatternsInsideCurrentDirectory(patterns) {
return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
}
exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
function getPatternsOutsideCurrentDirectory(patterns) {
return patterns.filter(isPatternRelatedToParentDirectory);
}
exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
function isPatternRelatedToParentDirectory(pattern) {
return pattern.startsWith("..") || pattern.startsWith("./..");
}
exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
function getBaseDirectory(pattern) {
return globParent(pattern, { flipBackslashes: false });
}
exports.getBaseDirectory = getBaseDirectory;
function hasGlobStar(pattern) {
return pattern.includes(GLOBSTAR);
}
exports.hasGlobStar = hasGlobStar;
function endsWithSlashGlobStar(pattern) {
return pattern.endsWith("/" + GLOBSTAR);
}
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
function isAffectDepthOfReadingPattern(pattern) {
const basename = path2.basename(pattern);
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
}
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
function expandPatternsWithBraceExpansion(patterns) {
return patterns.reduce((collection, pattern) => {
return collection.concat(expandBraceExpansion(pattern));
}, []);
}
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
function expandBraceExpansion(pattern) {
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
patterns.sort((a, b) => a.length - b.length);
return patterns.filter((pattern2) => pattern2 !== "");
}
exports.expandBraceExpansion = expandBraceExpansion;
function getPatternParts(pattern, options) {
let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
if (parts.length === 0) {
parts = [pattern];
}
if (parts[0].startsWith("/")) {
parts[0] = parts[0].slice(1);
parts.unshift("");
}
return parts;
}
exports.getPatternParts = getPatternParts;
function makeRe(pattern, options) {
return micromatch.makeRe(pattern, options);
}
exports.makeRe = makeRe;
function convertPatternsToRe(patterns, options) {
return patterns.map((pattern) => makeRe(pattern, options));
}
exports.convertPatternsToRe = convertPatternsToRe;
function matchAny(entry, patternsRe) {
return patternsRe.some((patternRe) => patternRe.test(entry));
}
exports.matchAny = matchAny;
function removeDuplicateSlashes(pattern) {
return pattern.replace(DOUBLE_SLASH_RE, "/");
}
exports.removeDuplicateSlashes = removeDuplicateSlashes;
function partitionAbsoluteAndRelative(patterns) {
const absolute = [];
const relative = [];
for (const pattern of patterns) {
if (isAbsolute(pattern)) {
absolute.push(pattern);
} else {
relative.push(pattern);
}
}
return [absolute, relative];
}
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
function isAbsolute(pattern) {
return path2.isAbsolute(pattern);
}
exports.isAbsolute = isAbsolute;
}
});
// ../../node_modules/merge2/index.js
var require_merge2 = __commonJS({
"../../node_modules/merge2/index.js"(exports, module) {
"use strict";
init_esm_shims();
var Stream = __require("stream");
var PassThrough = Stream.PassThrough;
var slice = Array.prototype.slice;
module.exports = merge2;
function merge2() {
const streamsQueue = [];
const args = slice.call(arguments);
let merging = false;
let options = args[args.length - 1];
if (options && !Array.isArray(options) && options.pipe == null) {
args.pop();
} else {
options = {};
}
const doEnd = options.end !== false;
const doPipeError = options.pipeError === true;
if (options.objectMode == null) {
options.objectMode = true;
}
if (options.highWaterMark == null) {
options.highWaterMark = 64 * 1024;
}
const mergedStream = PassThrough(options);
function addStream() {
for (let i = 0, len = arguments.length; i < len; i++) {
streamsQueue.push(pauseStreams(arguments[i], options));
}
mergeStream();
return this;
}
function mergeStream() {
if (merging) {
return;
}
merging = true;
let streams = streamsQueue.shift();
if (!streams) {
process.nextTick(endStream2);
return;
}
if (!Array.isArray(streams)) {
streams = [streams];
}
let pipesCount = streams.length + 1;
function next() {
if (--pipesCount > 0) {
return;
}
merging = false;
mergeStream();
}
function pipe(stream) {
function onend() {
stream.removeListener("merge2UnpipeEnd", onend);
stream.removeListener("end", onend);
if (doPipeError) {
stream.removeListener("error", onerror);
}
next();
}
function onerror(err) {
mergedStream.emit("error", err);
}
if (stream._readableState.endEmitted) {
return next();
}
stream.on("merge2UnpipeEnd", onend);
stream.on("end", onend);
if (doPipeError) {
stream.on("error", onerror);
}
stream.pipe(mergedStream, { end: false });
stream.resume();
}
for (let i = 0; i < streams.length; i++) {
pipe(streams[i]);
}
next();
}
function endStream2() {
merging = false;
mergedStream.emit("queueDrain");
if (doEnd) {
mergedStream.end();
}
}
mergedStream.setMaxListeners(0);
mergedStream.add = addStream;
mergedStream.on("unpipe", function(stream) {
stream.emit("merge2UnpipeEnd");
});
if (args.length) {
addStream.apply(null, args);
}
return mergedStream;
}
function pauseStreams(streams, options) {
if (!Array.isArray(streams)) {
if (!streams._readableState && streams.pipe) {
streams = streams.pipe(PassThrough(options));
}
if (!streams._readableState || !streams.pause || !streams.pipe) {
throw new Error("Only readable stream can be merged.");
}
streams.pause();
} else {
for (let i = 0, len = streams.length; i < len; i++) {
streams[i] = pauseStreams(streams[i], options);
}
}
return streams;
}
}
});
// ../../node_modules/fast-glob/out/utils/stream.js
var require_stream = __commonJS({
"../../node_modules/fast-glob/out/utils/stream.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.merge = void 0;
var merge2 = require_merge2();
function merge(streams) {
const mergedStream = merge2(streams);
streams.forEach((stream) => {
stream.once("error", (error) => mergedStream.emit("error", error));
});
mergedStream.once("close", () => propagateCloseEventToSources(streams));
mergedStream.once("end", () => propagateCloseEventToSources(streams));
return mergedStream;
}
exports.merge = merge;
function propagateCloseEventToSources(streams) {
streams.forEach((stream) => stream.emit("close"));
}
}
});
// ../../node_modules/fast-glob/out/utils/string.js
var require_string = __commonJS({
"../../node_modules/fast-glob/out/utils/string.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmpty = exports.isString = void 0;
function isString(input) {
return typeof input === "string";
}
exports.isString = isString;
function isEmpty(input) {
return input === "";
}
exports.isEmpty = isEmpty;
}
});
// ../../node_modules/fast-glob/out/utils/index.js
var require_utils2 = __commonJS({
"../../node_modules/fast-glob/out/utils/index.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0;
var array = require_array();
exports.array = array;
var errno = require_errno();
exports.errno = errno;
var fs4 = require_fs();
exports.fs = fs4;
var path2 = require_path();
exports.path = path2;
var pattern = require_pattern();
exports.pattern = pattern;
var stream = require_stream();
exports.stream = stream;
var string = require_string();
exports.string = string;
}
});
// ../../node_modules/fast-glob/out/managers/tasks.js
var require_tasks = __commonJS({
"../../node_modules/fast-glob/out/managers/tasks.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
var utils = require_utils2();
function generate(input, settings) {
const patterns = processPatterns(input, settings);
const ignore = processPatterns(settings.ignore, settings);
const positivePatterns = getPositivePatterns(patterns);
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
const staticTasks = convertPatternsToTasks(
staticPatterns,
negativePatterns,
/* dynamic */
false
);
const dynamicTasks = convertPatternsToTasks(
dynamicPatterns,
negativePatterns,
/* dynamic */
true
);
return staticTasks.concat(dynamicTasks);
}
exports.generate = generate;
function processPatterns(input, settings) {
let patterns = input;
if (settings.braceExpansion) {
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
}
if (settings.baseNameMatch) {
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
}
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
}
function convertPatternsToTasks(positive, negative, dynamic) {
const tasks = [];
const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
if ("." in insideCurrentDirectoryGroup) {
tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
} else {
tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
}
return tasks;
}
exports.convertPatternsToTasks = convertPatternsToTasks;
function getPositivePatterns(patterns) {
return utils.pattern.getPositivePatterns(patterns);
}
exports.getPositivePatterns = getPositivePatterns;
function getNegativePatternsAsPositive(patterns, ignore) {
const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
const positive = negative.map(utils.pattern.convertToPositivePattern);
return positive;
}
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
function groupPatternsByBaseDirectory(patterns) {
const group = {};
return patterns.reduce((collection, pattern) => {
const base = utils.pattern.getBaseDirectory(pattern);
if (base in collection) {
collection[base].push(pattern);
} else {
collection[base] = [pattern];
}
return collection;
}, group);
}
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
function convertPatternGroupsToTasks(positive, negative, dynamic) {
return Object.keys(positive).map((base) => {
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
});
}
exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
function convertPatternGroupToTask(base, positive, negative, dynamic) {
return {
dynamic,
positive,
negative,
base,
patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
};
}
exports.convertPatternGroupToTask = convertPatternGroupToTask;
}
});
// ../../node_modules/@nodelib/fs.stat/out/providers/async.js
var require_async = __commonJS({
"../../node_modules/@nodelib/fs.stat/out/providers/async.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.read = void 0;
function read(path2, settings, callback) {
settings.fs.lstat(path2, (lstatError, lstat) => {
if (lstatError !== null) {
callFailureCallback(callback, lstatError);
return;
}
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
callSuccessCallback(callback, lstat);
return;
}
settings.fs.stat(path2, (statError, stat) => {
if (statError !== null) {
if (settings.throwErrorOnBrokenSymbolicLink) {
callFailureCallback(callback, statError);
return;
}
callSuccessCallback(callback, lstat);
return;
}
if (settings.markSymbolicLink) {
stat.isSymbolicLink = () => true;
}
callSuccessCallback(callback, stat);
});
});
}
exports.read = read;
function callFailureCallback(callback, error) {
callback(error);
}
function callSuccessCallback(callback, result) {
callback(null, result);
}
}
});
// ../../node_modules/@nodelib/fs.stat/out/providers/sync.js
var require_sync = __commonJS({
"../../node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.read = void 0;
function read(path2, settings) {
const lstat = settings.fs.lstatSync(path2);
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
return lstat;
}
try {
const stat = settings.fs.statSync(path2);
if (settings.markSymbolicLink) {
stat.isSymbolicLink = () => true;
}
return stat;
} catch (error) {
if (!settings.throwErrorOnBrokenSymbolicLink) {
return lstat;
}
throw error;
}
}
exports.read = read;
}
});
// ../../node_modules/@nodelib/fs.stat/out/adapters/fs.js
var require_fs2 = __commonJS({
"../../node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
var fs4 = __require("fs");
exports.FILE_SYSTEM_ADAPTER = {
lstat: fs4.lstat,
stat: fs4.stat,
lstatSync: fs4.lstatSync,
statSync: fs4.statSync
};
function createFileSystemAdapter(fsMethods) {
if (fsMethods === void 0) {
return exports.FILE_SYSTEM_ADAPTER;
}
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
}
exports.createFileSystemAdapter = createFileSystemAdapter;
}
});
// ../../node_modules/@nodelib/fs.stat/out/settings.js
var require_settings = __commonJS({
"../../node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
var fs4 = require_fs2();
var Settings = class {
constructor(_options = {}) {
this._options = _options;
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
this.fs = fs4.createFileSystemAdapter(this._options.fs);
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
}
_getValue(option, value) {
return option !== null && option !== void 0 ? option : value;
}
};
exports.default = Settings;
}
});
// ../../node_modules/@nodelib/fs.stat/out/index.js
var require_out = __commonJS({
"../../node_modules/@nodelib/fs.stat/out/index.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.statSync = exports.stat = exports.Settings = void 0;
var async = require_async();
var sync = require_sync();
var settings_1 = require_settings();
exports.Settings = settings_1.default;
function stat(path2, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === "function") {
async.read(path2, getSettings(), optionsOrSettingsOrCallback);
return;
}
async.read(path2, getSettings(optionsOrSettingsOrCallback), callback);
}
exports.stat = stat;
function statSync(path2, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
return sync.read(path2, settings);
}
exports.statSync = statSync;
function getSettings(settingsOrOptions = {}) {
if (settingsOrOptions instanceof settings_1.default) {
return settingsOrOptions;
}
return new settings_1.default(settingsOrOptions);
}
}
});
// ../../node_modules/queue-microtask/index.js
var require_queue_microtask = __commonJS({
"../../node_modules/queue-microtask/index.js"(exports, module) {
"use strict";
init_esm_shims();
var promise;
module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
throw err;
}, 0));
}
});
// ../../node_modules/run-parallel/index.js
var require_run_parallel = __commonJS({
"../../node_modules/run-parallel/index.js"(exports, module) {
"use strict";
init_esm_shims();
module.exports = runParallel;
var queueMicrotask2 = require_queue_microtask();
function runParallel(tasks, cb) {
let results, pending, keys;
let isSync = true;
if (Array.isArray(tasks)) {
results = [];
pending = tasks.length;
} else {
keys = Object.keys(tasks);
results = {};
pending = keys.length;
}
function done(err) {
function end() {
if (cb) cb(err, results);
cb = null;
}
if (isSync) queueMicrotask2(end);
else end();
}
function each(i, err, result) {
results[i] = result;
if (--pending === 0 || err) {
done(err);
}
}
if (!pending) {
done(null);
} else if (keys) {
keys.forEach(function(key) {
tasks[key](function(err, result) {
each(key, err, result);
});
});
} else {
tasks.forEach(function(task, i) {
task(function(err, result) {
each(i, err, result);
});
});
}
isSync = false;
}
}
});
// ../../node_modules/@nodelib/fs.scandir/out/constants.js
var require_constants = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/constants.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
}
var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
var SUPPORTED_MAJOR_VERSION = 10;
var SUPPORTED_MINOR_VERSION = 10;
var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/utils/fs.js
var require_fs3 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDirentFromStats = void 0;
var DirentFromStats = class {
constructor(name, stats) {
this.name = name;
this.isBlockDevice = stats.isBlockDevice.bind(stats);
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
this.isDirectory = stats.isDirectory.bind(stats);
this.isFIFO = stats.isFIFO.bind(stats);
this.isFile = stats.isFile.bind(stats);
this.isSocket = stats.isSocket.bind(stats);
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
}
};
function createDirentFromStats(name, stats) {
return new DirentFromStats(name, stats);
}
exports.createDirentFromStats = createDirentFromStats;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/utils/index.js
var require_utils3 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.fs = void 0;
var fs4 = require_fs3();
exports.fs = fs4;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/providers/common.js
var require_common = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.joinPathSegments = void 0;
function joinPathSegments(a, b, separator) {
if (a.endsWith(separator)) {
return a + b;
}
return a + separator + b;
}
exports.joinPathSegments = joinPathSegments;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/providers/async.js
var require_async2 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
var fsStat = require_out();
var rpl = require_run_parallel();
var constants_1 = require_constants();
var utils = require_utils3();
var common = require_common();
function read(directory, settings, callback) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
readdirWithFileTypes(directory, settings, callback);
return;
}
readdir(directory, settings, callback);
}
exports.read = read;
function readdirWithFileTypes(directory, settings, callback) {
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
if (readdirError !== null) {
callFailureCallback(callback, readdirError);
return;
}
const entries = dirents.map((dirent) => ({
dirent,
name: dirent.name,
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
}));
if (!settings.followSymbolicLinks) {
callSuccessCallback(callback, entries);
return;
}
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
rpl(tasks, (rplError, rplEntries) => {
if (rplError !== null) {
callFailureCallback(callback, rplError);
return;
}
callSuccessCallback(callback, rplEntries);
});
});
}
exports.readdirWithFileTypes = readdirWithFileTypes;
function makeRplTaskEntry(entry, settings) {
return (done) => {
if (!entry.dirent.isSymbolicLink()) {
done(null, entry);
return;
}
settings.fs.stat(entry.path, (statError, stats) => {
if (statError !== null) {
if (settings.throwErrorOnBrokenSymbolicLink) {
done(statError);
return;
}
done(null, entry);
return;
}
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
done(null, entry);
});
};
}
function readdir(directory, settings, callback) {
settings.fs.readdir(directory, (readdirError, names) => {
if (readdirError !== null) {
callFailureCallback(callback, readdirError);
return;
}
const tasks = names.map((name) => {
const path2 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
return (done) => {
fsStat.stat(path2, settings.fsStatSettings, (error, stats) => {
if (error !== null) {
done(error);
return;
}
const entry = {
name,
path: path2,
dirent: utils.fs.createDirentFromStats(name, stats)
};
if (settings.stats) {
entry.stats = stats;
}
done(null, entry);
});
};
});
rpl(tasks, (rplError, entries) => {
if (rplError !== null) {
callFailureCallback(callback, rplError);
return;
}
callSuccessCallback(callback, entries);
});
});
}
exports.readdir = readdir;
function callFailureCallback(callback, error) {
callback(error);
}
function callSuccessCallback(callback, result) {
callback(null, result);
}
}
});
// ../../node_modules/@nodelib/fs.scandir/out/providers/sync.js
var require_sync2 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
var fsStat = require_out();
var constants_1 = require_constants();
var utils = require_utils3();
var common = require_common();
function read(directory, settings) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
return readdirWithFileTypes(directory, settings);
}
return readdir(directory, settings);
}
exports.read = read;
function readdirWithFileTypes(directory, settings) {
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
return dirents.map((dirent) => {
const entry = {
dirent,
name: dirent.name,
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
};
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
try {
const stats = settings.fs.statSync(entry.path);
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
} catch (error) {
if (settings.throwErrorOnBrokenSymbolicLink) {
throw error;
}
}
}
return entry;
});
}
exports.readdirWithFileTypes = readdirWithFileTypes;
function readdir(directory, settings) {
const names = settings.fs.readdirSync(directory);
return names.map((name) => {
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
const entry = {
name,
path: entryPath,
dirent: utils.fs.createDirentFromStats(name, stats)
};
if (settings.stats) {
entry.stats = stats;
}
return entry;
});
}
exports.readdir = readdir;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/adapters/fs.js
var require_fs4 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
var fs4 = __require("fs");
exports.FILE_SYSTEM_ADAPTER = {
lstat: fs4.lstat,
stat: fs4.stat,
lstatSync: fs4.lstatSync,
statSync: fs4.statSync,
readdir: fs4.readdir,
readdirSync: fs4.readdirSync
};
function createFileSystemAdapter(fsMethods) {
if (fsMethods === void 0) {
return exports.FILE_SYSTEM_ADAPTER;
}
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
}
exports.createFileSystemAdapter = createFileSystemAdapter;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/settings.js
var require_settings2 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/settings.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
var path2 = __require("path");
var fsStat = require_out();
var fs4 = require_fs4();
var Settings = class {
constructor(_options = {}) {
this._options = _options;
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
this.fs = fs4.createFileSystemAdapter(this._options.fs);
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path2.sep);
this.stats = this._getValue(this._options.stats, false);
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
this.fsStatSettings = new fsStat.Settings({
followSymbolicLink: this.followSymbolicLinks,
fs: this.fs,
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
});
}
_getValue(option, value) {
return option !== null && option !== void 0 ? option : value;
}
};
exports.default = Settings;
}
});
// ../../node_modules/@nodelib/fs.scandir/out/index.js
var require_out2 = __commonJS({
"../../node_modules/@nodelib/fs.scandir/out/index.js"(exports) {
"use strict";
init_esm_shims();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = exports.scandirSync = exports.scandir = void 0;
var async = require_async2();
var sync = require_sync2();
var settings_1 = require_settings2();
exports.Settings = settings_1.default;
function scandir(path2, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === "function") {
async.read(path2, getSettings(), optionsOrSettingsOrCallback);
return;
}
async.read(path2, getSettings(optionsOrSettingsOrCallback), callback);
}
exports.scandir = scandir;
function scandirSync(path2, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
return sync.read(path2, settings);
}
exports.scandirSync = scandirSync;
function getSettings(settingsOrOptions = {}) {
if (settingsOrOptions instanceof settings_1.default) {
return settingsOrOptions;
}
return new settings_1.default(settingsOrOptions);
}
}
});
// ../../node_modules/reusify/reusify.js
var require_reusify = __commonJS({
"../../node_modules/reusify/reusify.js"(exports, module) {
"use strict";
init_esm_shims();
function reusify(Constructor) {
var head = new Constructor();
var tail = head;
function get() {
var current = head;
if (current.next) {
head = current.next;
} else {
head = new Constructor();
tail = head;
}
current.next = null;
return current;
}
function release(obj) {
tail.next = obj;
tail = obj;
}
return {
get,
release
};
}
module.exports = reusify;
}
});
// ../../node_modules/fastq/queue.js
var require_queue = __commonJS({
"../../node_modules/fastq/queue.js"(exports, module) {
"use strict";
init_esm_shims();
var reusify = require_reusify();
function fastqueue(context, worker, _concurrency) {
if (typeof context === "function") {
_concurrency = worker;
worker = context;
context = null;
}
if (!(_concurrency >= 1)) {
throw new Error("fastqueue concurrency must be equal to or greater than 1");
}
var cache = reusify(Task);
var queueHead = null;
var queueTail = null;
var _running = 0;
var errorHandler = null;
var self = {
push,
drain: noop2,
saturated: noop2,
pause,
paused: false,
get concurrency() {
return _concurrency;
},
set concurrency(value) {
if (!(value >= 1)) {
throw new Error("fastqueue concurrency must be equal to or greater than 1");
}
_concurrency = value;
if (self.paused) return;
for (; queueHead && _running < _concurrency; ) {
_running++;
release();
}
},
running,
resume