You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15364 lines
497 KiB
15364 lines
497 KiB
"use strict";
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __commonJS = (cb, mod) => function __require() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
|
|
// node_modules/core-js/internals/global.js
|
|
var require_global = __commonJS({
|
|
"node_modules/core-js/internals/global.js"(exports2, module2) {
|
|
var check = function(it) {
|
|
return it && it.Math == Math && it;
|
|
};
|
|
module2.exports = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof global == "object" && global) || function() {
|
|
return this;
|
|
}() || Function("return this")();
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/fails.js
|
|
var require_fails = __commonJS({
|
|
"node_modules/core-js/internals/fails.js"(exports2, module2) {
|
|
module2.exports = function(exec) {
|
|
try {
|
|
return !!exec();
|
|
} catch (error) {
|
|
return true;
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/descriptors.js
|
|
var require_descriptors = __commonJS({
|
|
"node_modules/core-js/internals/descriptors.js"(exports2, module2) {
|
|
var fails = require_fails();
|
|
module2.exports = !fails(function() {
|
|
return Object.defineProperty({}, 1, { get: function() {
|
|
return 7;
|
|
} })[1] != 7;
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/function-bind-native.js
|
|
var require_function_bind_native = __commonJS({
|
|
"node_modules/core-js/internals/function-bind-native.js"(exports2, module2) {
|
|
var fails = require_fails();
|
|
module2.exports = !fails(function() {
|
|
var test = function() {
|
|
}.bind();
|
|
return typeof test != "function" || test.hasOwnProperty("prototype");
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/function-call.js
|
|
var require_function_call = __commonJS({
|
|
"node_modules/core-js/internals/function-call.js"(exports2, module2) {
|
|
var NATIVE_BIND = require_function_bind_native();
|
|
var call = Function.prototype.call;
|
|
module2.exports = NATIVE_BIND ? call.bind(call) : function() {
|
|
return call.apply(call, arguments);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-property-is-enumerable.js
|
|
var require_object_property_is_enumerable = __commonJS({
|
|
"node_modules/core-js/internals/object-property-is-enumerable.js"(exports2) {
|
|
"use strict";
|
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
exports2.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
return !!descriptor && descriptor.enumerable;
|
|
} : $propertyIsEnumerable;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/create-property-descriptor.js
|
|
var require_create_property_descriptor = __commonJS({
|
|
"node_modules/core-js/internals/create-property-descriptor.js"(exports2, module2) {
|
|
module2.exports = function(bitmap, value) {
|
|
return {
|
|
enumerable: !(bitmap & 1),
|
|
configurable: !(bitmap & 2),
|
|
writable: !(bitmap & 4),
|
|
value
|
|
};
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/function-uncurry-this.js
|
|
var require_function_uncurry_this = __commonJS({
|
|
"node_modules/core-js/internals/function-uncurry-this.js"(exports2, module2) {
|
|
var NATIVE_BIND = require_function_bind_native();
|
|
var FunctionPrototype = Function.prototype;
|
|
var call = FunctionPrototype.call;
|
|
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
|
|
module2.exports = NATIVE_BIND ? uncurryThisWithBind : function(fn) {
|
|
return function() {
|
|
return call.apply(fn, arguments);
|
|
};
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/classof-raw.js
|
|
var require_classof_raw = __commonJS({
|
|
"node_modules/core-js/internals/classof-raw.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var toString = uncurryThis({}.toString);
|
|
var stringSlice = uncurryThis("".slice);
|
|
module2.exports = function(it) {
|
|
return stringSlice(toString(it), 8, -1);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/indexed-object.js
|
|
var require_indexed_object = __commonJS({
|
|
"node_modules/core-js/internals/indexed-object.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var fails = require_fails();
|
|
var classof = require_classof_raw();
|
|
var $Object = Object;
|
|
var split = uncurryThis("".split);
|
|
module2.exports = fails(function() {
|
|
return !$Object("z").propertyIsEnumerable(0);
|
|
}) ? function(it) {
|
|
return classof(it) == "String" ? split(it, "") : $Object(it);
|
|
} : $Object;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-null-or-undefined.js
|
|
var require_is_null_or_undefined = __commonJS({
|
|
"node_modules/core-js/internals/is-null-or-undefined.js"(exports2, module2) {
|
|
module2.exports = function(it) {
|
|
return it === null || it === void 0;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/require-object-coercible.js
|
|
var require_require_object_coercible = __commonJS({
|
|
"node_modules/core-js/internals/require-object-coercible.js"(exports2, module2) {
|
|
var isNullOrUndefined = require_is_null_or_undefined();
|
|
var $TypeError = TypeError;
|
|
module2.exports = function(it) {
|
|
if (isNullOrUndefined(it))
|
|
throw $TypeError("Can't call method on " + it);
|
|
return it;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-indexed-object.js
|
|
var require_to_indexed_object = __commonJS({
|
|
"node_modules/core-js/internals/to-indexed-object.js"(exports2, module2) {
|
|
var IndexedObject = require_indexed_object();
|
|
var requireObjectCoercible = require_require_object_coercible();
|
|
module2.exports = function(it) {
|
|
return IndexedObject(requireObjectCoercible(it));
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/document-all.js
|
|
var require_document_all = __commonJS({
|
|
"node_modules/core-js/internals/document-all.js"(exports2, module2) {
|
|
var documentAll = typeof document == "object" && document.all;
|
|
var IS_HTMLDDA = typeof documentAll == "undefined" && documentAll !== void 0;
|
|
module2.exports = {
|
|
all: documentAll,
|
|
IS_HTMLDDA
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-callable.js
|
|
var require_is_callable = __commonJS({
|
|
"node_modules/core-js/internals/is-callable.js"(exports2, module2) {
|
|
var $documentAll = require_document_all();
|
|
var documentAll = $documentAll.all;
|
|
module2.exports = $documentAll.IS_HTMLDDA ? function(argument) {
|
|
return typeof argument == "function" || argument === documentAll;
|
|
} : function(argument) {
|
|
return typeof argument == "function";
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-object.js
|
|
var require_is_object = __commonJS({
|
|
"node_modules/core-js/internals/is-object.js"(exports2, module2) {
|
|
var isCallable = require_is_callable();
|
|
var $documentAll = require_document_all();
|
|
var documentAll = $documentAll.all;
|
|
module2.exports = $documentAll.IS_HTMLDDA ? function(it) {
|
|
return typeof it == "object" ? it !== null : isCallable(it) || it === documentAll;
|
|
} : function(it) {
|
|
return typeof it == "object" ? it !== null : isCallable(it);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/get-built-in.js
|
|
var require_get_built_in = __commonJS({
|
|
"node_modules/core-js/internals/get-built-in.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var isCallable = require_is_callable();
|
|
var aFunction = function(argument) {
|
|
return isCallable(argument) ? argument : void 0;
|
|
};
|
|
module2.exports = function(namespace, method) {
|
|
return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method];
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-is-prototype-of.js
|
|
var require_object_is_prototype_of = __commonJS({
|
|
"node_modules/core-js/internals/object-is-prototype-of.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
module2.exports = uncurryThis({}.isPrototypeOf);
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/engine-user-agent.js
|
|
var require_engine_user_agent = __commonJS({
|
|
"node_modules/core-js/internals/engine-user-agent.js"(exports2, module2) {
|
|
var getBuiltIn = require_get_built_in();
|
|
module2.exports = getBuiltIn("navigator", "userAgent") || "";
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/engine-v8-version.js
|
|
var require_engine_v8_version = __commonJS({
|
|
"node_modules/core-js/internals/engine-v8-version.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var userAgent = require_engine_user_agent();
|
|
var process2 = global2.process;
|
|
var Deno = global2.Deno;
|
|
var versions = process2 && process2.versions || Deno && Deno.version;
|
|
var v8 = versions && versions.v8;
|
|
var match;
|
|
var version;
|
|
if (v8) {
|
|
match = v8.split(".");
|
|
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
}
|
|
if (!version && userAgent) {
|
|
match = userAgent.match(/Edge\/(\d+)/);
|
|
if (!match || match[1] >= 74) {
|
|
match = userAgent.match(/Chrome\/(\d+)/);
|
|
if (match)
|
|
version = +match[1];
|
|
}
|
|
}
|
|
module2.exports = version;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/symbol-constructor-detection.js
|
|
var require_symbol_constructor_detection = __commonJS({
|
|
"node_modules/core-js/internals/symbol-constructor-detection.js"(exports2, module2) {
|
|
var V8_VERSION = require_engine_v8_version();
|
|
var fails = require_fails();
|
|
module2.exports = !!Object.getOwnPropertySymbols && !fails(function() {
|
|
var symbol = Symbol();
|
|
return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/use-symbol-as-uid.js
|
|
var require_use_symbol_as_uid = __commonJS({
|
|
"node_modules/core-js/internals/use-symbol-as-uid.js"(exports2, module2) {
|
|
var NATIVE_SYMBOL = require_symbol_constructor_detection();
|
|
module2.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-symbol.js
|
|
var require_is_symbol = __commonJS({
|
|
"node_modules/core-js/internals/is-symbol.js"(exports2, module2) {
|
|
var getBuiltIn = require_get_built_in();
|
|
var isCallable = require_is_callable();
|
|
var isPrototypeOf = require_object_is_prototype_of();
|
|
var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
|
|
var $Object = Object;
|
|
module2.exports = USE_SYMBOL_AS_UID ? function(it) {
|
|
return typeof it == "symbol";
|
|
} : function(it) {
|
|
var $Symbol = getBuiltIn("Symbol");
|
|
return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/try-to-string.js
|
|
var require_try_to_string = __commonJS({
|
|
"node_modules/core-js/internals/try-to-string.js"(exports2, module2) {
|
|
var $String = String;
|
|
module2.exports = function(argument) {
|
|
try {
|
|
return $String(argument);
|
|
} catch (error) {
|
|
return "Object";
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/a-callable.js
|
|
var require_a_callable = __commonJS({
|
|
"node_modules/core-js/internals/a-callable.js"(exports2, module2) {
|
|
var isCallable = require_is_callable();
|
|
var tryToString = require_try_to_string();
|
|
var $TypeError = TypeError;
|
|
module2.exports = function(argument) {
|
|
if (isCallable(argument))
|
|
return argument;
|
|
throw $TypeError(tryToString(argument) + " is not a function");
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/get-method.js
|
|
var require_get_method = __commonJS({
|
|
"node_modules/core-js/internals/get-method.js"(exports2, module2) {
|
|
var aCallable = require_a_callable();
|
|
var isNullOrUndefined = require_is_null_or_undefined();
|
|
module2.exports = function(V, P) {
|
|
var func = V[P];
|
|
return isNullOrUndefined(func) ? void 0 : aCallable(func);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/ordinary-to-primitive.js
|
|
var require_ordinary_to_primitive = __commonJS({
|
|
"node_modules/core-js/internals/ordinary-to-primitive.js"(exports2, module2) {
|
|
var call = require_function_call();
|
|
var isCallable = require_is_callable();
|
|
var isObject = require_is_object();
|
|
var $TypeError = TypeError;
|
|
module2.exports = function(input, pref) {
|
|
var fn, val;
|
|
if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
|
|
return val;
|
|
if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
|
|
return val;
|
|
if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
|
|
return val;
|
|
throw $TypeError("Can't convert object to primitive value");
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-pure.js
|
|
var require_is_pure = __commonJS({
|
|
"node_modules/core-js/internals/is-pure.js"(exports2, module2) {
|
|
module2.exports = false;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/define-global-property.js
|
|
var require_define_global_property = __commonJS({
|
|
"node_modules/core-js/internals/define-global-property.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var defineProperty = Object.defineProperty;
|
|
module2.exports = function(key, value) {
|
|
try {
|
|
defineProperty(global2, key, { value, configurable: true, writable: true });
|
|
} catch (error) {
|
|
global2[key] = value;
|
|
}
|
|
return value;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/shared-store.js
|
|
var require_shared_store = __commonJS({
|
|
"node_modules/core-js/internals/shared-store.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var defineGlobalProperty = require_define_global_property();
|
|
var SHARED = "__core-js_shared__";
|
|
var store = global2[SHARED] || defineGlobalProperty(SHARED, {});
|
|
module2.exports = store;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/shared.js
|
|
var require_shared = __commonJS({
|
|
"node_modules/core-js/internals/shared.js"(exports2, module2) {
|
|
var IS_PURE = require_is_pure();
|
|
var store = require_shared_store();
|
|
(module2.exports = function(key, value) {
|
|
return store[key] || (store[key] = value !== void 0 ? value : {});
|
|
})("versions", []).push({
|
|
version: "3.26.1",
|
|
mode: IS_PURE ? "pure" : "global",
|
|
copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
|
|
license: "https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",
|
|
source: "https://github.com/zloirock/core-js"
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-object.js
|
|
var require_to_object = __commonJS({
|
|
"node_modules/core-js/internals/to-object.js"(exports2, module2) {
|
|
var requireObjectCoercible = require_require_object_coercible();
|
|
var $Object = Object;
|
|
module2.exports = function(argument) {
|
|
return $Object(requireObjectCoercible(argument));
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/has-own-property.js
|
|
var require_has_own_property = __commonJS({
|
|
"node_modules/core-js/internals/has-own-property.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var toObject = require_to_object();
|
|
var hasOwnProperty = uncurryThis({}.hasOwnProperty);
|
|
module2.exports = Object.hasOwn || function hasOwn(it, key) {
|
|
return hasOwnProperty(toObject(it), key);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/uid.js
|
|
var require_uid = __commonJS({
|
|
"node_modules/core-js/internals/uid.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var id = 0;
|
|
var postfix = Math.random();
|
|
var toString = uncurryThis(1 .toString);
|
|
module2.exports = function(key) {
|
|
return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/well-known-symbol.js
|
|
var require_well_known_symbol = __commonJS({
|
|
"node_modules/core-js/internals/well-known-symbol.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var shared = require_shared();
|
|
var hasOwn = require_has_own_property();
|
|
var uid = require_uid();
|
|
var NATIVE_SYMBOL = require_symbol_constructor_detection();
|
|
var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
|
|
var WellKnownSymbolsStore = shared("wks");
|
|
var Symbol2 = global2.Symbol;
|
|
var symbolFor = Symbol2 && Symbol2["for"];
|
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2 : Symbol2 && Symbol2.withoutSetter || uid;
|
|
module2.exports = function(name) {
|
|
if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
|
|
var description = "Symbol." + name;
|
|
if (NATIVE_SYMBOL && hasOwn(Symbol2, name)) {
|
|
WellKnownSymbolsStore[name] = Symbol2[name];
|
|
} else if (USE_SYMBOL_AS_UID && symbolFor) {
|
|
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
} else {
|
|
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
}
|
|
}
|
|
return WellKnownSymbolsStore[name];
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-primitive.js
|
|
var require_to_primitive = __commonJS({
|
|
"node_modules/core-js/internals/to-primitive.js"(exports2, module2) {
|
|
var call = require_function_call();
|
|
var isObject = require_is_object();
|
|
var isSymbol = require_is_symbol();
|
|
var getMethod = require_get_method();
|
|
var ordinaryToPrimitive = require_ordinary_to_primitive();
|
|
var wellKnownSymbol = require_well_known_symbol();
|
|
var $TypeError = TypeError;
|
|
var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
|
|
module2.exports = function(input, pref) {
|
|
if (!isObject(input) || isSymbol(input))
|
|
return input;
|
|
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
var result;
|
|
if (exoticToPrim) {
|
|
if (pref === void 0)
|
|
pref = "default";
|
|
result = call(exoticToPrim, input, pref);
|
|
if (!isObject(result) || isSymbol(result))
|
|
return result;
|
|
throw $TypeError("Can't convert object to primitive value");
|
|
}
|
|
if (pref === void 0)
|
|
pref = "number";
|
|
return ordinaryToPrimitive(input, pref);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-property-key.js
|
|
var require_to_property_key = __commonJS({
|
|
"node_modules/core-js/internals/to-property-key.js"(exports2, module2) {
|
|
var toPrimitive = require_to_primitive();
|
|
var isSymbol = require_is_symbol();
|
|
module2.exports = function(argument) {
|
|
var key = toPrimitive(argument, "string");
|
|
return isSymbol(key) ? key : key + "";
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/document-create-element.js
|
|
var require_document_create_element = __commonJS({
|
|
"node_modules/core-js/internals/document-create-element.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var isObject = require_is_object();
|
|
var document2 = global2.document;
|
|
var EXISTS = isObject(document2) && isObject(document2.createElement);
|
|
module2.exports = function(it) {
|
|
return EXISTS ? document2.createElement(it) : {};
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/ie8-dom-define.js
|
|
var require_ie8_dom_define = __commonJS({
|
|
"node_modules/core-js/internals/ie8-dom-define.js"(exports2, module2) {
|
|
var DESCRIPTORS = require_descriptors();
|
|
var fails = require_fails();
|
|
var createElement = require_document_create_element();
|
|
module2.exports = !DESCRIPTORS && !fails(function() {
|
|
return Object.defineProperty(createElement("div"), "a", {
|
|
get: function() {
|
|
return 7;
|
|
}
|
|
}).a != 7;
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-get-own-property-descriptor.js
|
|
var require_object_get_own_property_descriptor = __commonJS({
|
|
"node_modules/core-js/internals/object-get-own-property-descriptor.js"(exports2) {
|
|
var DESCRIPTORS = require_descriptors();
|
|
var call = require_function_call();
|
|
var propertyIsEnumerableModule = require_object_property_is_enumerable();
|
|
var createPropertyDescriptor = require_create_property_descriptor();
|
|
var toIndexedObject = require_to_indexed_object();
|
|
var toPropertyKey = require_to_property_key();
|
|
var hasOwn = require_has_own_property();
|
|
var IE8_DOM_DEFINE = require_ie8_dom_define();
|
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
exports2.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
O = toIndexedObject(O);
|
|
P = toPropertyKey(P);
|
|
if (IE8_DOM_DEFINE)
|
|
try {
|
|
return $getOwnPropertyDescriptor(O, P);
|
|
} catch (error) {
|
|
}
|
|
if (hasOwn(O, P))
|
|
return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/v8-prototype-define-bug.js
|
|
var require_v8_prototype_define_bug = __commonJS({
|
|
"node_modules/core-js/internals/v8-prototype-define-bug.js"(exports2, module2) {
|
|
var DESCRIPTORS = require_descriptors();
|
|
var fails = require_fails();
|
|
module2.exports = DESCRIPTORS && fails(function() {
|
|
return Object.defineProperty(function() {
|
|
}, "prototype", {
|
|
value: 42,
|
|
writable: false
|
|
}).prototype != 42;
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/an-object.js
|
|
var require_an_object = __commonJS({
|
|
"node_modules/core-js/internals/an-object.js"(exports2, module2) {
|
|
var isObject = require_is_object();
|
|
var $String = String;
|
|
var $TypeError = TypeError;
|
|
module2.exports = function(argument) {
|
|
if (isObject(argument))
|
|
return argument;
|
|
throw $TypeError($String(argument) + " is not an object");
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-define-property.js
|
|
var require_object_define_property = __commonJS({
|
|
"node_modules/core-js/internals/object-define-property.js"(exports2) {
|
|
var DESCRIPTORS = require_descriptors();
|
|
var IE8_DOM_DEFINE = require_ie8_dom_define();
|
|
var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
|
|
var anObject = require_an_object();
|
|
var toPropertyKey = require_to_property_key();
|
|
var $TypeError = TypeError;
|
|
var $defineProperty = Object.defineProperty;
|
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
var ENUMERABLE = "enumerable";
|
|
var CONFIGURABLE = "configurable";
|
|
var WRITABLE = "writable";
|
|
exports2.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
|
anObject(O);
|
|
P = toPropertyKey(P);
|
|
anObject(Attributes);
|
|
if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
var current = $getOwnPropertyDescriptor(O, P);
|
|
if (current && current[WRITABLE]) {
|
|
O[P] = Attributes.value;
|
|
Attributes = {
|
|
configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
|
|
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
writable: false
|
|
};
|
|
}
|
|
}
|
|
return $defineProperty(O, P, Attributes);
|
|
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
anObject(O);
|
|
P = toPropertyKey(P);
|
|
anObject(Attributes);
|
|
if (IE8_DOM_DEFINE)
|
|
try {
|
|
return $defineProperty(O, P, Attributes);
|
|
} catch (error) {
|
|
}
|
|
if ("get" in Attributes || "set" in Attributes)
|
|
throw $TypeError("Accessors not supported");
|
|
if ("value" in Attributes)
|
|
O[P] = Attributes.value;
|
|
return O;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/create-non-enumerable-property.js
|
|
var require_create_non_enumerable_property = __commonJS({
|
|
"node_modules/core-js/internals/create-non-enumerable-property.js"(exports2, module2) {
|
|
var DESCRIPTORS = require_descriptors();
|
|
var definePropertyModule = require_object_define_property();
|
|
var createPropertyDescriptor = require_create_property_descriptor();
|
|
module2.exports = DESCRIPTORS ? function(object, key, value) {
|
|
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
} : function(object, key, value) {
|
|
object[key] = value;
|
|
return object;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/function-name.js
|
|
var require_function_name = __commonJS({
|
|
"node_modules/core-js/internals/function-name.js"(exports2, module2) {
|
|
var DESCRIPTORS = require_descriptors();
|
|
var hasOwn = require_has_own_property();
|
|
var FunctionPrototype = Function.prototype;
|
|
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
|
var EXISTS = hasOwn(FunctionPrototype, "name");
|
|
var PROPER = EXISTS && function something() {
|
|
}.name === "something";
|
|
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
|
|
module2.exports = {
|
|
EXISTS,
|
|
PROPER,
|
|
CONFIGURABLE
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/inspect-source.js
|
|
var require_inspect_source = __commonJS({
|
|
"node_modules/core-js/internals/inspect-source.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var isCallable = require_is_callable();
|
|
var store = require_shared_store();
|
|
var functionToString = uncurryThis(Function.toString);
|
|
if (!isCallable(store.inspectSource)) {
|
|
store.inspectSource = function(it) {
|
|
return functionToString(it);
|
|
};
|
|
}
|
|
module2.exports = store.inspectSource;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/weak-map-basic-detection.js
|
|
var require_weak_map_basic_detection = __commonJS({
|
|
"node_modules/core-js/internals/weak-map-basic-detection.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var isCallable = require_is_callable();
|
|
var WeakMap2 = global2.WeakMap;
|
|
module2.exports = isCallable(WeakMap2) && /native code/.test(String(WeakMap2));
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/shared-key.js
|
|
var require_shared_key = __commonJS({
|
|
"node_modules/core-js/internals/shared-key.js"(exports2, module2) {
|
|
var shared = require_shared();
|
|
var uid = require_uid();
|
|
var keys = shared("keys");
|
|
module2.exports = function(key) {
|
|
return keys[key] || (keys[key] = uid(key));
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/hidden-keys.js
|
|
var require_hidden_keys = __commonJS({
|
|
"node_modules/core-js/internals/hidden-keys.js"(exports2, module2) {
|
|
module2.exports = {};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/internal-state.js
|
|
var require_internal_state = __commonJS({
|
|
"node_modules/core-js/internals/internal-state.js"(exports2, module2) {
|
|
var NATIVE_WEAK_MAP = require_weak_map_basic_detection();
|
|
var global2 = require_global();
|
|
var isObject = require_is_object();
|
|
var createNonEnumerableProperty = require_create_non_enumerable_property();
|
|
var hasOwn = require_has_own_property();
|
|
var shared = require_shared_store();
|
|
var sharedKey = require_shared_key();
|
|
var hiddenKeys = require_hidden_keys();
|
|
var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
|
|
var TypeError2 = global2.TypeError;
|
|
var WeakMap2 = global2.WeakMap;
|
|
var set;
|
|
var get;
|
|
var has;
|
|
var enforce = function(it) {
|
|
return has(it) ? get(it) : set(it, {});
|
|
};
|
|
var getterFor = function(TYPE) {
|
|
return function(it) {
|
|
var state;
|
|
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
throw TypeError2("Incompatible receiver, " + TYPE + " required");
|
|
}
|
|
return state;
|
|
};
|
|
};
|
|
if (NATIVE_WEAK_MAP || shared.state) {
|
|
store = shared.state || (shared.state = new WeakMap2());
|
|
store.get = store.get;
|
|
store.has = store.has;
|
|
store.set = store.set;
|
|
set = function(it, metadata) {
|
|
if (store.has(it))
|
|
throw TypeError2(OBJECT_ALREADY_INITIALIZED);
|
|
metadata.facade = it;
|
|
store.set(it, metadata);
|
|
return metadata;
|
|
};
|
|
get = function(it) {
|
|
return store.get(it) || {};
|
|
};
|
|
has = function(it) {
|
|
return store.has(it);
|
|
};
|
|
} else {
|
|
STATE = sharedKey("state");
|
|
hiddenKeys[STATE] = true;
|
|
set = function(it, metadata) {
|
|
if (hasOwn(it, STATE))
|
|
throw TypeError2(OBJECT_ALREADY_INITIALIZED);
|
|
metadata.facade = it;
|
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
return metadata;
|
|
};
|
|
get = function(it) {
|
|
return hasOwn(it, STATE) ? it[STATE] : {};
|
|
};
|
|
has = function(it) {
|
|
return hasOwn(it, STATE);
|
|
};
|
|
}
|
|
var store;
|
|
var STATE;
|
|
module2.exports = {
|
|
set,
|
|
get,
|
|
has,
|
|
enforce,
|
|
getterFor
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/make-built-in.js
|
|
var require_make_built_in = __commonJS({
|
|
"node_modules/core-js/internals/make-built-in.js"(exports2, module2) {
|
|
var fails = require_fails();
|
|
var isCallable = require_is_callable();
|
|
var hasOwn = require_has_own_property();
|
|
var DESCRIPTORS = require_descriptors();
|
|
var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
|
|
var inspectSource = require_inspect_source();
|
|
var InternalStateModule = require_internal_state();
|
|
var enforceInternalState = InternalStateModule.enforce;
|
|
var getInternalState = InternalStateModule.get;
|
|
var defineProperty = Object.defineProperty;
|
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
|
return defineProperty(function() {
|
|
}, "length", { value: 8 }).length !== 8;
|
|
});
|
|
var TEMPLATE = String(String).split("String");
|
|
var makeBuiltIn = module2.exports = function(value, name, options) {
|
|
if (String(name).slice(0, 7) === "Symbol(") {
|
|
name = "[" + String(name).replace(/^Symbol\(([^)]*)\)/, "$1") + "]";
|
|
}
|
|
if (options && options.getter)
|
|
name = "get " + name;
|
|
if (options && options.setter)
|
|
name = "set " + name;
|
|
if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
|
|
if (DESCRIPTORS)
|
|
defineProperty(value, "name", { value: name, configurable: true });
|
|
else
|
|
value.name = name;
|
|
}
|
|
if (CONFIGURABLE_LENGTH && options && hasOwn(options, "arity") && value.length !== options.arity) {
|
|
defineProperty(value, "length", { value: options.arity });
|
|
}
|
|
try {
|
|
if (options && hasOwn(options, "constructor") && options.constructor) {
|
|
if (DESCRIPTORS)
|
|
defineProperty(value, "prototype", { writable: false });
|
|
} else if (value.prototype)
|
|
value.prototype = void 0;
|
|
} catch (error) {
|
|
}
|
|
var state = enforceInternalState(value);
|
|
if (!hasOwn(state, "source")) {
|
|
state.source = TEMPLATE.join(typeof name == "string" ? name : "");
|
|
}
|
|
return value;
|
|
};
|
|
Function.prototype.toString = makeBuiltIn(function toString() {
|
|
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
}, "toString");
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/define-built-in.js
|
|
var require_define_built_in = __commonJS({
|
|
"node_modules/core-js/internals/define-built-in.js"(exports2, module2) {
|
|
var isCallable = require_is_callable();
|
|
var definePropertyModule = require_object_define_property();
|
|
var makeBuiltIn = require_make_built_in();
|
|
var defineGlobalProperty = require_define_global_property();
|
|
module2.exports = function(O, key, value, options) {
|
|
if (!options)
|
|
options = {};
|
|
var simple = options.enumerable;
|
|
var name = options.name !== void 0 ? options.name : key;
|
|
if (isCallable(value))
|
|
makeBuiltIn(value, name, options);
|
|
if (options.global) {
|
|
if (simple)
|
|
O[key] = value;
|
|
else
|
|
defineGlobalProperty(key, value);
|
|
} else {
|
|
try {
|
|
if (!options.unsafe)
|
|
delete O[key];
|
|
else if (O[key])
|
|
simple = true;
|
|
} catch (error) {
|
|
}
|
|
if (simple)
|
|
O[key] = value;
|
|
else
|
|
definePropertyModule.f(O, key, {
|
|
value,
|
|
enumerable: false,
|
|
configurable: !options.nonConfigurable,
|
|
writable: !options.nonWritable
|
|
});
|
|
}
|
|
return O;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/math-trunc.js
|
|
var require_math_trunc = __commonJS({
|
|
"node_modules/core-js/internals/math-trunc.js"(exports2, module2) {
|
|
var ceil = Math.ceil;
|
|
var floor = Math.floor;
|
|
module2.exports = Math.trunc || function trunc(x) {
|
|
var n = +x;
|
|
return (n > 0 ? floor : ceil)(n);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-integer-or-infinity.js
|
|
var require_to_integer_or_infinity = __commonJS({
|
|
"node_modules/core-js/internals/to-integer-or-infinity.js"(exports2, module2) {
|
|
var trunc = require_math_trunc();
|
|
module2.exports = function(argument) {
|
|
var number = +argument;
|
|
return number !== number || number === 0 ? 0 : trunc(number);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-absolute-index.js
|
|
var require_to_absolute_index = __commonJS({
|
|
"node_modules/core-js/internals/to-absolute-index.js"(exports2, module2) {
|
|
var toIntegerOrInfinity = require_to_integer_or_infinity();
|
|
var max = Math.max;
|
|
var min = Math.min;
|
|
module2.exports = function(index, length) {
|
|
var integer = toIntegerOrInfinity(index);
|
|
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-length.js
|
|
var require_to_length = __commonJS({
|
|
"node_modules/core-js/internals/to-length.js"(exports2, module2) {
|
|
var toIntegerOrInfinity = require_to_integer_or_infinity();
|
|
var min = Math.min;
|
|
module2.exports = function(argument) {
|
|
return argument > 0 ? min(toIntegerOrInfinity(argument), 9007199254740991) : 0;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/length-of-array-like.js
|
|
var require_length_of_array_like = __commonJS({
|
|
"node_modules/core-js/internals/length-of-array-like.js"(exports2, module2) {
|
|
var toLength = require_to_length();
|
|
module2.exports = function(obj) {
|
|
return toLength(obj.length);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/array-includes.js
|
|
var require_array_includes = __commonJS({
|
|
"node_modules/core-js/internals/array-includes.js"(exports2, module2) {
|
|
var toIndexedObject = require_to_indexed_object();
|
|
var toAbsoluteIndex = require_to_absolute_index();
|
|
var lengthOfArrayLike = require_length_of_array_like();
|
|
var createMethod = function(IS_INCLUDES) {
|
|
return function($this, el, fromIndex) {
|
|
var O = toIndexedObject($this);
|
|
var length = lengthOfArrayLike(O);
|
|
var index = toAbsoluteIndex(fromIndex, length);
|
|
var value;
|
|
if (IS_INCLUDES && el != el)
|
|
while (length > index) {
|
|
value = O[index++];
|
|
if (value != value)
|
|
return true;
|
|
}
|
|
else
|
|
for (; length > index; index++) {
|
|
if ((IS_INCLUDES || index in O) && O[index] === el)
|
|
return IS_INCLUDES || index || 0;
|
|
}
|
|
return !IS_INCLUDES && -1;
|
|
};
|
|
};
|
|
module2.exports = {
|
|
includes: createMethod(true),
|
|
indexOf: createMethod(false)
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-keys-internal.js
|
|
var require_object_keys_internal = __commonJS({
|
|
"node_modules/core-js/internals/object-keys-internal.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var hasOwn = require_has_own_property();
|
|
var toIndexedObject = require_to_indexed_object();
|
|
var indexOf = require_array_includes().indexOf;
|
|
var hiddenKeys = require_hidden_keys();
|
|
var push = uncurryThis([].push);
|
|
module2.exports = function(object, names) {
|
|
var O = toIndexedObject(object);
|
|
var i = 0;
|
|
var result = [];
|
|
var key;
|
|
for (key in O)
|
|
!hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
|
while (names.length > i)
|
|
if (hasOwn(O, key = names[i++])) {
|
|
~indexOf(result, key) || push(result, key);
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/enum-bug-keys.js
|
|
var require_enum_bug_keys = __commonJS({
|
|
"node_modules/core-js/internals/enum-bug-keys.js"(exports2, module2) {
|
|
module2.exports = [
|
|
"constructor",
|
|
"hasOwnProperty",
|
|
"isPrototypeOf",
|
|
"propertyIsEnumerable",
|
|
"toLocaleString",
|
|
"toString",
|
|
"valueOf"
|
|
];
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-get-own-property-names.js
|
|
var require_object_get_own_property_names = __commonJS({
|
|
"node_modules/core-js/internals/object-get-own-property-names.js"(exports2) {
|
|
var internalObjectKeys = require_object_keys_internal();
|
|
var enumBugKeys = require_enum_bug_keys();
|
|
var hiddenKeys = enumBugKeys.concat("length", "prototype");
|
|
exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
return internalObjectKeys(O, hiddenKeys);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/object-get-own-property-symbols.js
|
|
var require_object_get_own_property_symbols = __commonJS({
|
|
"node_modules/core-js/internals/object-get-own-property-symbols.js"(exports2) {
|
|
exports2.f = Object.getOwnPropertySymbols;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/own-keys.js
|
|
var require_own_keys = __commonJS({
|
|
"node_modules/core-js/internals/own-keys.js"(exports2, module2) {
|
|
var getBuiltIn = require_get_built_in();
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var getOwnPropertyNamesModule = require_object_get_own_property_names();
|
|
var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
|
|
var anObject = require_an_object();
|
|
var concat = uncurryThis([].concat);
|
|
module2.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
|
|
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
|
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/copy-constructor-properties.js
|
|
var require_copy_constructor_properties = __commonJS({
|
|
"node_modules/core-js/internals/copy-constructor-properties.js"(exports2, module2) {
|
|
var hasOwn = require_has_own_property();
|
|
var ownKeys = require_own_keys();
|
|
var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
|
|
var definePropertyModule = require_object_define_property();
|
|
module2.exports = function(target, source, exceptions) {
|
|
var keys = ownKeys(source);
|
|
var defineProperty = definePropertyModule.f;
|
|
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
for (var i = 0; i < keys.length; i++) {
|
|
var key = keys[i];
|
|
if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
|
|
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-forced.js
|
|
var require_is_forced = __commonJS({
|
|
"node_modules/core-js/internals/is-forced.js"(exports2, module2) {
|
|
var fails = require_fails();
|
|
var isCallable = require_is_callable();
|
|
var replacement = /#|\.prototype\./;
|
|
var isForced = function(feature, detection) {
|
|
var value = data[normalize(feature)];
|
|
return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
|
|
};
|
|
var normalize = isForced.normalize = function(string) {
|
|
return String(string).replace(replacement, ".").toLowerCase();
|
|
};
|
|
var data = isForced.data = {};
|
|
var NATIVE = isForced.NATIVE = "N";
|
|
var POLYFILL = isForced.POLYFILL = "P";
|
|
module2.exports = isForced;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/export.js
|
|
var require_export = __commonJS({
|
|
"node_modules/core-js/internals/export.js"(exports2, module2) {
|
|
var global2 = require_global();
|
|
var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
|
|
var createNonEnumerableProperty = require_create_non_enumerable_property();
|
|
var defineBuiltIn = require_define_built_in();
|
|
var defineGlobalProperty = require_define_global_property();
|
|
var copyConstructorProperties = require_copy_constructor_properties();
|
|
var isForced = require_is_forced();
|
|
module2.exports = function(options, source) {
|
|
var TARGET = options.target;
|
|
var GLOBAL = options.global;
|
|
var STATIC = options.stat;
|
|
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
if (GLOBAL) {
|
|
target = global2;
|
|
} else if (STATIC) {
|
|
target = global2[TARGET] || defineGlobalProperty(TARGET, {});
|
|
} else {
|
|
target = (global2[TARGET] || {}).prototype;
|
|
}
|
|
if (target)
|
|
for (key in source) {
|
|
sourceProperty = source[key];
|
|
if (options.dontCallGetSet) {
|
|
descriptor = getOwnPropertyDescriptor(target, key);
|
|
targetProperty = descriptor && descriptor.value;
|
|
} else
|
|
targetProperty = target[key];
|
|
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
|
|
if (!FORCED && targetProperty !== void 0) {
|
|
if (typeof sourceProperty == typeof targetProperty)
|
|
continue;
|
|
copyConstructorProperties(sourceProperty, targetProperty);
|
|
}
|
|
if (options.sham || targetProperty && targetProperty.sham) {
|
|
createNonEnumerableProperty(sourceProperty, "sham", true);
|
|
}
|
|
defineBuiltIn(target, key, sourceProperty, options);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/function-uncurry-this-clause.js
|
|
var require_function_uncurry_this_clause = __commonJS({
|
|
"node_modules/core-js/internals/function-uncurry-this-clause.js"(exports2, module2) {
|
|
var classofRaw = require_classof_raw();
|
|
var uncurryThis = require_function_uncurry_this();
|
|
module2.exports = function(fn) {
|
|
if (classofRaw(fn) === "Function")
|
|
return uncurryThis(fn);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/function-bind-context.js
|
|
var require_function_bind_context = __commonJS({
|
|
"node_modules/core-js/internals/function-bind-context.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this_clause();
|
|
var aCallable = require_a_callable();
|
|
var NATIVE_BIND = require_function_bind_native();
|
|
var bind = uncurryThis(uncurryThis.bind);
|
|
module2.exports = function(fn, that) {
|
|
aCallable(fn);
|
|
return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
|
|
return fn.apply(that, arguments);
|
|
};
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/iterators.js
|
|
var require_iterators = __commonJS({
|
|
"node_modules/core-js/internals/iterators.js"(exports2, module2) {
|
|
module2.exports = {};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-array-iterator-method.js
|
|
var require_is_array_iterator_method = __commonJS({
|
|
"node_modules/core-js/internals/is-array-iterator-method.js"(exports2, module2) {
|
|
var wellKnownSymbol = require_well_known_symbol();
|
|
var Iterators = require_iterators();
|
|
var ITERATOR = wellKnownSymbol("iterator");
|
|
var ArrayPrototype = Array.prototype;
|
|
module2.exports = function(it) {
|
|
return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/to-string-tag-support.js
|
|
var require_to_string_tag_support = __commonJS({
|
|
"node_modules/core-js/internals/to-string-tag-support.js"(exports2, module2) {
|
|
var wellKnownSymbol = require_well_known_symbol();
|
|
var TO_STRING_TAG = wellKnownSymbol("toStringTag");
|
|
var test = {};
|
|
test[TO_STRING_TAG] = "z";
|
|
module2.exports = String(test) === "[object z]";
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/classof.js
|
|
var require_classof = __commonJS({
|
|
"node_modules/core-js/internals/classof.js"(exports2, module2) {
|
|
var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
|
|
var isCallable = require_is_callable();
|
|
var classofRaw = require_classof_raw();
|
|
var wellKnownSymbol = require_well_known_symbol();
|
|
var TO_STRING_TAG = wellKnownSymbol("toStringTag");
|
|
var $Object = Object;
|
|
var CORRECT_ARGUMENTS = classofRaw(function() {
|
|
return arguments;
|
|
}()) == "Arguments";
|
|
var tryGet = function(it, key) {
|
|
try {
|
|
return it[key];
|
|
} catch (error) {
|
|
}
|
|
};
|
|
module2.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
var O, tag, result;
|
|
return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && isCallable(O.callee) ? "Arguments" : result;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/get-iterator-method.js
|
|
var require_get_iterator_method = __commonJS({
|
|
"node_modules/core-js/internals/get-iterator-method.js"(exports2, module2) {
|
|
var classof = require_classof();
|
|
var getMethod = require_get_method();
|
|
var isNullOrUndefined = require_is_null_or_undefined();
|
|
var Iterators = require_iterators();
|
|
var wellKnownSymbol = require_well_known_symbol();
|
|
var ITERATOR = wellKnownSymbol("iterator");
|
|
module2.exports = function(it) {
|
|
if (!isNullOrUndefined(it))
|
|
return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/get-iterator.js
|
|
var require_get_iterator = __commonJS({
|
|
"node_modules/core-js/internals/get-iterator.js"(exports2, module2) {
|
|
var call = require_function_call();
|
|
var aCallable = require_a_callable();
|
|
var anObject = require_an_object();
|
|
var tryToString = require_try_to_string();
|
|
var getIteratorMethod = require_get_iterator_method();
|
|
var $TypeError = TypeError;
|
|
module2.exports = function(argument, usingIterator) {
|
|
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
if (aCallable(iteratorMethod))
|
|
return anObject(call(iteratorMethod, argument));
|
|
throw $TypeError(tryToString(argument) + " is not iterable");
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/iterator-close.js
|
|
var require_iterator_close = __commonJS({
|
|
"node_modules/core-js/internals/iterator-close.js"(exports2, module2) {
|
|
var call = require_function_call();
|
|
var anObject = require_an_object();
|
|
var getMethod = require_get_method();
|
|
module2.exports = function(iterator, kind, value) {
|
|
var innerResult, innerError;
|
|
anObject(iterator);
|
|
try {
|
|
innerResult = getMethod(iterator, "return");
|
|
if (!innerResult) {
|
|
if (kind === "throw")
|
|
throw value;
|
|
return value;
|
|
}
|
|
innerResult = call(innerResult, iterator);
|
|
} catch (error) {
|
|
innerError = true;
|
|
innerResult = error;
|
|
}
|
|
if (kind === "throw")
|
|
throw value;
|
|
if (innerError)
|
|
throw innerResult;
|
|
anObject(innerResult);
|
|
return value;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/iterate.js
|
|
var require_iterate = __commonJS({
|
|
"node_modules/core-js/internals/iterate.js"(exports2, module2) {
|
|
var bind = require_function_bind_context();
|
|
var call = require_function_call();
|
|
var anObject = require_an_object();
|
|
var tryToString = require_try_to_string();
|
|
var isArrayIteratorMethod = require_is_array_iterator_method();
|
|
var lengthOfArrayLike = require_length_of_array_like();
|
|
var isPrototypeOf = require_object_is_prototype_of();
|
|
var getIterator = require_get_iterator();
|
|
var getIteratorMethod = require_get_iterator_method();
|
|
var iteratorClose = require_iterator_close();
|
|
var $TypeError = TypeError;
|
|
var Result = function(stopped, result) {
|
|
this.stopped = stopped;
|
|
this.result = result;
|
|
};
|
|
var ResultPrototype = Result.prototype;
|
|
module2.exports = function(iterable, unboundFunction, options) {
|
|
var that = options && options.that;
|
|
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
var fn = bind(unboundFunction, that);
|
|
var iterator, iterFn, index, length, result, next, step;
|
|
var stop = function(condition) {
|
|
if (iterator)
|
|
iteratorClose(iterator, "normal", condition);
|
|
return new Result(true, condition);
|
|
};
|
|
var callFn = function(value) {
|
|
if (AS_ENTRIES) {
|
|
anObject(value);
|
|
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
}
|
|
return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
};
|
|
if (IS_RECORD) {
|
|
iterator = iterable.iterator;
|
|
} else if (IS_ITERATOR) {
|
|
iterator = iterable;
|
|
} else {
|
|
iterFn = getIteratorMethod(iterable);
|
|
if (!iterFn)
|
|
throw $TypeError(tryToString(iterable) + " is not iterable");
|
|
if (isArrayIteratorMethod(iterFn)) {
|
|
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
result = callFn(iterable[index]);
|
|
if (result && isPrototypeOf(ResultPrototype, result))
|
|
return result;
|
|
}
|
|
return new Result(false);
|
|
}
|
|
iterator = getIterator(iterable, iterFn);
|
|
}
|
|
next = IS_RECORD ? iterable.next : iterator.next;
|
|
while (!(step = call(next, iterator)).done) {
|
|
try {
|
|
result = callFn(step.value);
|
|
} catch (error) {
|
|
iteratorClose(iterator, "throw", error);
|
|
}
|
|
if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
|
|
return result;
|
|
}
|
|
return new Result(false);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/create-property.js
|
|
var require_create_property = __commonJS({
|
|
"node_modules/core-js/internals/create-property.js"(exports2, module2) {
|
|
"use strict";
|
|
var toPropertyKey = require_to_property_key();
|
|
var definePropertyModule = require_object_define_property();
|
|
var createPropertyDescriptor = require_create_property_descriptor();
|
|
module2.exports = function(object, key, value) {
|
|
var propertyKey = toPropertyKey(key);
|
|
if (propertyKey in object)
|
|
definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
else
|
|
object[propertyKey] = value;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/modules/es.object.from-entries.js
|
|
var require_es_object_from_entries = __commonJS({
|
|
"node_modules/core-js/modules/es.object.from-entries.js"() {
|
|
var $ = require_export();
|
|
var iterate = require_iterate();
|
|
var createProperty = require_create_property();
|
|
$({ target: "Object", stat: true }, {
|
|
fromEntries: function fromEntries(iterable) {
|
|
var obj = {};
|
|
iterate(iterable, function(k, v) {
|
|
createProperty(obj, k, v);
|
|
}, { AS_ENTRIES: true });
|
|
return obj;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-array.js
|
|
var require_is_array = __commonJS({
|
|
"node_modules/core-js/internals/is-array.js"(exports2, module2) {
|
|
var classof = require_classof_raw();
|
|
module2.exports = Array.isArray || function isArray(argument) {
|
|
return classof(argument) == "Array";
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/does-not-exceed-safe-integer.js
|
|
var require_does_not_exceed_safe_integer = __commonJS({
|
|
"node_modules/core-js/internals/does-not-exceed-safe-integer.js"(exports2, module2) {
|
|
var $TypeError = TypeError;
|
|
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
module2.exports = function(it) {
|
|
if (it > MAX_SAFE_INTEGER)
|
|
throw $TypeError("Maximum allowed index exceeded");
|
|
return it;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/flatten-into-array.js
|
|
var require_flatten_into_array = __commonJS({
|
|
"node_modules/core-js/internals/flatten-into-array.js"(exports2, module2) {
|
|
"use strict";
|
|
var isArray = require_is_array();
|
|
var lengthOfArrayLike = require_length_of_array_like();
|
|
var doesNotExceedSafeInteger = require_does_not_exceed_safe_integer();
|
|
var bind = require_function_bind_context();
|
|
var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) {
|
|
var targetIndex = start;
|
|
var sourceIndex = 0;
|
|
var mapFn = mapper ? bind(mapper, thisArg) : false;
|
|
var element, elementLen;
|
|
while (sourceIndex < sourceLen) {
|
|
if (sourceIndex in source) {
|
|
element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
|
if (depth > 0 && isArray(element)) {
|
|
elementLen = lengthOfArrayLike(element);
|
|
targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
|
|
} else {
|
|
doesNotExceedSafeInteger(targetIndex + 1);
|
|
target[targetIndex] = element;
|
|
}
|
|
targetIndex++;
|
|
}
|
|
sourceIndex++;
|
|
}
|
|
return targetIndex;
|
|
};
|
|
module2.exports = flattenIntoArray;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/is-constructor.js
|
|
var require_is_constructor = __commonJS({
|
|
"node_modules/core-js/internals/is-constructor.js"(exports2, module2) {
|
|
var uncurryThis = require_function_uncurry_this();
|
|
var fails = require_fails();
|
|
var isCallable = require_is_callable();
|
|
var classof = require_classof();
|
|
var getBuiltIn = require_get_built_in();
|
|
var inspectSource = require_inspect_source();
|
|
var noop = function() {
|
|
};
|
|
var empty = [];
|
|
var construct = getBuiltIn("Reflect", "construct");
|
|
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
var exec = uncurryThis(constructorRegExp.exec);
|
|
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
var isConstructorModern = function isConstructor(argument) {
|
|
if (!isCallable(argument))
|
|
return false;
|
|
try {
|
|
construct(noop, empty, argument);
|
|
return true;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
};
|
|
var isConstructorLegacy = function isConstructor(argument) {
|
|
if (!isCallable(argument))
|
|
return false;
|
|
switch (classof(argument)) {
|
|
case "AsyncFunction":
|
|
case "GeneratorFunction":
|
|
case "AsyncGeneratorFunction":
|
|
return false;
|
|
}
|
|
try {
|
|
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
} catch (error) {
|
|
return true;
|
|
}
|
|
};
|
|
isConstructorLegacy.sham = true;
|
|
module2.exports = !construct || fails(function() {
|
|
var called;
|
|
return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
|
|
called = true;
|
|
}) || called;
|
|
}) ? isConstructorLegacy : isConstructorModern;
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/array-species-constructor.js
|
|
var require_array_species_constructor = __commonJS({
|
|
"node_modules/core-js/internals/array-species-constructor.js"(exports2, module2) {
|
|
var isArray = require_is_array();
|
|
var isConstructor = require_is_constructor();
|
|
var isObject = require_is_object();
|
|
var wellKnownSymbol = require_well_known_symbol();
|
|
var SPECIES = wellKnownSymbol("species");
|
|
var $Array = Array;
|
|
module2.exports = function(originalArray) {
|
|
var C;
|
|
if (isArray(originalArray)) {
|
|
C = originalArray.constructor;
|
|
if (isConstructor(C) && (C === $Array || isArray(C.prototype)))
|
|
C = void 0;
|
|
else if (isObject(C)) {
|
|
C = C[SPECIES];
|
|
if (C === null)
|
|
C = void 0;
|
|
}
|
|
}
|
|
return C === void 0 ? $Array : C;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/array-species-create.js
|
|
var require_array_species_create = __commonJS({
|
|
"node_modules/core-js/internals/array-species-create.js"(exports2, module2) {
|
|
var arraySpeciesConstructor = require_array_species_constructor();
|
|
module2.exports = function(originalArray, length) {
|
|
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/modules/es.array.flat-map.js
|
|
var require_es_array_flat_map = __commonJS({
|
|
"node_modules/core-js/modules/es.array.flat-map.js"() {
|
|
"use strict";
|
|
var $ = require_export();
|
|
var flattenIntoArray = require_flatten_into_array();
|
|
var aCallable = require_a_callable();
|
|
var toObject = require_to_object();
|
|
var lengthOfArrayLike = require_length_of_array_like();
|
|
var arraySpeciesCreate = require_array_species_create();
|
|
$({ target: "Array", proto: true }, {
|
|
flatMap: function flatMap(callbackfn) {
|
|
var O = toObject(this);
|
|
var sourceLen = lengthOfArrayLike(O);
|
|
var A;
|
|
aCallable(callbackfn);
|
|
A = arraySpeciesCreate(O, 0);
|
|
A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0);
|
|
return A;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/modules/es.array.flat.js
|
|
var require_es_array_flat = __commonJS({
|
|
"node_modules/core-js/modules/es.array.flat.js"() {
|
|
"use strict";
|
|
var $ = require_export();
|
|
var flattenIntoArray = require_flatten_into_array();
|
|
var toObject = require_to_object();
|
|
var lengthOfArrayLike = require_length_of_array_like();
|
|
var toIntegerOrInfinity = require_to_integer_or_infinity();
|
|
var arraySpeciesCreate = require_array_species_create();
|
|
$({ target: "Array", proto: true }, {
|
|
flat: function flat() {
|
|
var depthArg = arguments.length ? arguments[0] : void 0;
|
|
var O = toObject(this);
|
|
var sourceLen = lengthOfArrayLike(O);
|
|
var A = arraySpeciesCreate(O, 0);
|
|
A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === void 0 ? 1 : toIntegerOrInfinity(depthArg));
|
|
return A;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/define-built-in-accessor.js
|
|
var require_define_built_in_accessor = __commonJS({
|
|
"node_modules/core-js/internals/define-built-in-accessor.js"(exports2, module2) {
|
|
var makeBuiltIn = require_make_built_in();
|
|
var defineProperty = require_object_define_property();
|
|
module2.exports = function(target, name, descriptor) {
|
|
if (descriptor.get)
|
|
makeBuiltIn(descriptor.get, name, { getter: true });
|
|
if (descriptor.set)
|
|
makeBuiltIn(descriptor.set, name, { setter: true });
|
|
return defineProperty.f(target, name, descriptor);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/internals/regexp-flags.js
|
|
var require_regexp_flags = __commonJS({
|
|
"node_modules/core-js/internals/regexp-flags.js"(exports2, module2) {
|
|
"use strict";
|
|
var anObject = require_an_object();
|
|
module2.exports = function() {
|
|
var that = anObject(this);
|
|
var result = "";
|
|
if (that.hasIndices)
|
|
result += "d";
|
|
if (that.global)
|
|
result += "g";
|
|
if (that.ignoreCase)
|
|
result += "i";
|
|
if (that.multiline)
|
|
result += "m";
|
|
if (that.dotAll)
|
|
result += "s";
|
|
if (that.unicode)
|
|
result += "u";
|
|
if (that.unicodeSets)
|
|
result += "v";
|
|
if (that.sticky)
|
|
result += "y";
|
|
return result;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/core-js/modules/es.regexp.flags.js
|
|
var require_es_regexp_flags = __commonJS({
|
|
"node_modules/core-js/modules/es.regexp.flags.js"() {
|
|
var global2 = require_global();
|
|
var DESCRIPTORS = require_descriptors();
|
|
var defineBuiltInAccessor = require_define_built_in_accessor();
|
|
var regExpFlags = require_regexp_flags();
|
|
var fails = require_fails();
|
|
var RegExp2 = global2.RegExp;
|
|
var RegExpPrototype = RegExp2.prototype;
|
|
var FORCED = DESCRIPTORS && fails(function() {
|
|
var INDICES_SUPPORT = true;
|
|
try {
|
|
RegExp2(".", "d");
|
|
} catch (error) {
|
|
INDICES_SUPPORT = false;
|
|
}
|
|
var O = {};
|
|
var calls = "";
|
|
var expected = INDICES_SUPPORT ? "dgimsy" : "gimsy";
|
|
var addGetter = function(key2, chr) {
|
|
Object.defineProperty(O, key2, { get: function() {
|
|
calls += chr;
|
|
return true;
|
|
} });
|
|
};
|
|
var pairs = {
|
|
dotAll: "s",
|
|
global: "g",
|
|
ignoreCase: "i",
|
|
multiline: "m",
|
|
sticky: "y"
|
|
};
|
|
if (INDICES_SUPPORT)
|
|
pairs.hasIndices = "d";
|
|
for (var key in pairs)
|
|
addGetter(key, pairs[key]);
|
|
var result = Object.getOwnPropertyDescriptor(RegExpPrototype, "flags").get.call(O);
|
|
return result !== expected || calls !== expected;
|
|
});
|
|
if (FORCED)
|
|
defineBuiltInAccessor(RegExpPrototype, "flags", {
|
|
configurable: true,
|
|
get: regExpFlags
|
|
});
|
|
}
|
|
});
|
|
|
|
// dist/_cli.js.cjs.js
|
|
require_es_object_from_entries();
|
|
require_es_array_flat_map();
|
|
require_es_array_flat();
|
|
require_es_regexp_flags();
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __esm = (fn, res) => function __init() {
|
|
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
};
|
|
var __commonJS2 = (cb, mod) => function __require() {
|
|
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = {
|
|
exports: {}
|
|
}).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, {
|
|
get: all[name],
|
|
enumerable: true
|
|
});
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames2(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, {
|
|
get: () => from[key],
|
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
});
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
value: mod,
|
|
enumerable: true
|
|
}) : target, mod));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", {
|
|
value: true
|
|
}), mod);
|
|
var require_fast_json_stable_stringify = __commonJS2({
|
|
"node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = function(data, opts) {
|
|
if (!opts)
|
|
opts = {};
|
|
if (typeof opts === "function")
|
|
opts = {
|
|
cmp: opts
|
|
};
|
|
var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
|
|
var cmp = opts.cmp && function(f) {
|
|
return function(node) {
|
|
return function(a, b) {
|
|
var aobj = {
|
|
key: a,
|
|
value: node[a]
|
|
};
|
|
var bobj = {
|
|
key: b,
|
|
value: node[b]
|
|
};
|
|
return f(aobj, bobj);
|
|
};
|
|
};
|
|
}(opts.cmp);
|
|
var seen = [];
|
|
return function stringify2(node) {
|
|
if (node && node.toJSON && typeof node.toJSON === "function") {
|
|
node = node.toJSON();
|
|
}
|
|
if (node === void 0)
|
|
return;
|
|
if (typeof node == "number")
|
|
return isFinite(node) ? "" + node : "null";
|
|
if (typeof node !== "object")
|
|
return JSON.stringify(node);
|
|
var i, out;
|
|
if (Array.isArray(node)) {
|
|
out = "[";
|
|
for (i = 0; i < node.length; i++) {
|
|
if (i)
|
|
out += ",";
|
|
out += stringify2(node[i]) || "null";
|
|
}
|
|
return out + "]";
|
|
}
|
|
if (node === null)
|
|
return "null";
|
|
if (seen.indexOf(node) !== -1) {
|
|
if (cycles)
|
|
return JSON.stringify("__cycle__");
|
|
throw new TypeError("Converting circular structure to JSON");
|
|
}
|
|
var seenIndex = seen.push(node) - 1;
|
|
var keys = Object.keys(node).sort(cmp && cmp(node));
|
|
out = "";
|
|
for (i = 0; i < keys.length; i++) {
|
|
var key = keys[i];
|
|
var value = stringify2(node[key]);
|
|
if (!value)
|
|
continue;
|
|
if (out)
|
|
out += ",";
|
|
out += JSON.stringify(key) + ":" + value;
|
|
}
|
|
seen.splice(seenIndex, 1);
|
|
return "{" + out + "}";
|
|
}(data);
|
|
};
|
|
}
|
|
});
|
|
var require_clone = __commonJS2({
|
|
"node_modules/clone/clone.js"(exports2, module2) {
|
|
var clone = function() {
|
|
"use strict";
|
|
function clone2(parent, circular, depth, prototype) {
|
|
var filter;
|
|
if (typeof circular === "object") {
|
|
depth = circular.depth;
|
|
prototype = circular.prototype;
|
|
filter = circular.filter;
|
|
circular = circular.circular;
|
|
}
|
|
var allParents = [];
|
|
var allChildren = [];
|
|
var useBuffer = typeof Buffer != "undefined";
|
|
if (typeof circular == "undefined")
|
|
circular = true;
|
|
if (typeof depth == "undefined")
|
|
depth = Infinity;
|
|
function _clone(parent2, depth2) {
|
|
if (parent2 === null)
|
|
return null;
|
|
if (depth2 == 0)
|
|
return parent2;
|
|
var child;
|
|
var proto2;
|
|
if (typeof parent2 != "object") {
|
|
return parent2;
|
|
}
|
|
if (clone2.__isArray(parent2)) {
|
|
child = [];
|
|
} else if (clone2.__isRegExp(parent2)) {
|
|
child = new RegExp(parent2.source, __getRegExpFlags(parent2));
|
|
if (parent2.lastIndex)
|
|
child.lastIndex = parent2.lastIndex;
|
|
} else if (clone2.__isDate(parent2)) {
|
|
child = new Date(parent2.getTime());
|
|
} else if (useBuffer && Buffer.isBuffer(parent2)) {
|
|
if (Buffer.allocUnsafe) {
|
|
child = Buffer.allocUnsafe(parent2.length);
|
|
} else {
|
|
child = new Buffer(parent2.length);
|
|
}
|
|
parent2.copy(child);
|
|
return child;
|
|
} else {
|
|
if (typeof prototype == "undefined") {
|
|
proto2 = Object.getPrototypeOf(parent2);
|
|
child = Object.create(proto2);
|
|
} else {
|
|
child = Object.create(prototype);
|
|
proto2 = prototype;
|
|
}
|
|
}
|
|
if (circular) {
|
|
var index = allParents.indexOf(parent2);
|
|
if (index != -1) {
|
|
return allChildren[index];
|
|
}
|
|
allParents.push(parent2);
|
|
allChildren.push(child);
|
|
}
|
|
for (var i in parent2) {
|
|
var attrs;
|
|
if (proto2) {
|
|
attrs = Object.getOwnPropertyDescriptor(proto2, i);
|
|
}
|
|
if (attrs && attrs.set == null) {
|
|
continue;
|
|
}
|
|
child[i] = _clone(parent2[i], depth2 - 1);
|
|
}
|
|
return child;
|
|
}
|
|
return _clone(parent, depth);
|
|
}
|
|
clone2.clonePrototype = function clonePrototype(parent) {
|
|
if (parent === null)
|
|
return null;
|
|
var c = function() {
|
|
};
|
|
c.prototype = parent;
|
|
return new c();
|
|
};
|
|
function __objToStr(o) {
|
|
return Object.prototype.toString.call(o);
|
|
}
|
|
;
|
|
clone2.__objToStr = __objToStr;
|
|
function __isDate(o) {
|
|
return typeof o === "object" && __objToStr(o) === "[object Date]";
|
|
}
|
|
;
|
|
clone2.__isDate = __isDate;
|
|
function __isArray(o) {
|
|
return typeof o === "object" && __objToStr(o) === "[object Array]";
|
|
}
|
|
;
|
|
clone2.__isArray = __isArray;
|
|
function __isRegExp(o) {
|
|
return typeof o === "object" && __objToStr(o) === "[object RegExp]";
|
|
}
|
|
;
|
|
clone2.__isRegExp = __isRegExp;
|
|
function __getRegExpFlags(re) {
|
|
var flags = "";
|
|
if (re.global)
|
|
flags += "g";
|
|
if (re.ignoreCase)
|
|
flags += "i";
|
|
if (re.multiline)
|
|
flags += "m";
|
|
return flags;
|
|
}
|
|
;
|
|
clone2.__getRegExpFlags = __getRegExpFlags;
|
|
return clone2;
|
|
}();
|
|
if (typeof module2 === "object" && module2.exports) {
|
|
module2.exports = clone;
|
|
}
|
|
}
|
|
});
|
|
var require_defaults = __commonJS2({
|
|
"node_modules/defaults/index.js"(exports2, module2) {
|
|
var clone = require_clone();
|
|
module2.exports = function(options, defaults) {
|
|
options = options || {};
|
|
Object.keys(defaults).forEach(function(key) {
|
|
if (typeof options[key] === "undefined") {
|
|
options[key] = clone(defaults[key]);
|
|
}
|
|
});
|
|
return options;
|
|
};
|
|
}
|
|
});
|
|
var require_combining = __commonJS2({
|
|
"node_modules/wcwidth/combining.js"(exports2, module2) {
|
|
module2.exports = [[768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531], [68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]];
|
|
}
|
|
});
|
|
var require_wcwidth = __commonJS2({
|
|
"node_modules/wcwidth/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var defaults = require_defaults();
|
|
var combining = require_combining();
|
|
var DEFAULTS = {
|
|
nul: 0,
|
|
control: 0
|
|
};
|
|
module2.exports = function wcwidth2(str) {
|
|
return wcswidth(str, DEFAULTS);
|
|
};
|
|
module2.exports.config = function(opts) {
|
|
opts = defaults(opts || {}, DEFAULTS);
|
|
return function wcwidth2(str) {
|
|
return wcswidth(str, opts);
|
|
};
|
|
};
|
|
function wcswidth(str, opts) {
|
|
if (typeof str !== "string")
|
|
return wcwidth(str, opts);
|
|
var s = 0;
|
|
for (var i = 0; i < str.length; i++) {
|
|
var n = wcwidth(str.charCodeAt(i), opts);
|
|
if (n < 0)
|
|
return -1;
|
|
s += n;
|
|
}
|
|
return s;
|
|
}
|
|
function wcwidth(ucs, opts) {
|
|
if (ucs === 0)
|
|
return opts.nul;
|
|
if (ucs < 32 || ucs >= 127 && ucs < 160)
|
|
return opts.control;
|
|
if (bisearch(ucs))
|
|
return 0;
|
|
return 1 + (ucs >= 4352 && (ucs <= 4447 || ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || ucs >= 44032 && ucs <= 55203 || ucs >= 63744 && ucs <= 64255 || ucs >= 65040 && ucs <= 65049 || ucs >= 65072 && ucs <= 65135 || ucs >= 65280 && ucs <= 65376 || ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141));
|
|
}
|
|
function bisearch(ucs) {
|
|
var min = 0;
|
|
var max = combining.length - 1;
|
|
var mid;
|
|
if (ucs < combining[0][0] || ucs > combining[max][1])
|
|
return false;
|
|
while (max >= min) {
|
|
mid = Math.floor((min + max) / 2);
|
|
if (ucs > combining[mid][1])
|
|
min = mid + 1;
|
|
else if (ucs < combining[mid][0])
|
|
max = mid - 1;
|
|
else
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
function ansiRegex({
|
|
onlyFirst = false
|
|
} = {}) {
|
|
const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
}
|
|
var init_ansi_regex = __esm({
|
|
"node_modules/strip-ansi/node_modules/ansi-regex/index.js"() {
|
|
}
|
|
});
|
|
var strip_ansi_exports = {};
|
|
__export(strip_ansi_exports, {
|
|
default: () => stripAnsi
|
|
});
|
|
function stripAnsi(string) {
|
|
if (typeof string !== "string") {
|
|
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
}
|
|
return string.replace(ansiRegex(), "");
|
|
}
|
|
var init_strip_ansi = __esm({
|
|
"node_modules/strip-ansi/index.js"() {
|
|
init_ansi_regex();
|
|
}
|
|
});
|
|
function assembleStyles() {
|
|
const codes = /* @__PURE__ */ new Map();
|
|
const styles2 = {
|
|
modifier: {
|
|
reset: [0, 0],
|
|
bold: [1, 22],
|
|
dim: [2, 22],
|
|
italic: [3, 23],
|
|
underline: [4, 24],
|
|
overline: [53, 55],
|
|
inverse: [7, 27],
|
|
hidden: [8, 28],
|
|
strikethrough: [9, 29]
|
|
},
|
|
color: {
|
|
black: [30, 39],
|
|
red: [31, 39],
|
|
green: [32, 39],
|
|
yellow: [33, 39],
|
|
blue: [34, 39],
|
|
magenta: [35, 39],
|
|
cyan: [36, 39],
|
|
white: [37, 39],
|
|
blackBright: [90, 39],
|
|
redBright: [91, 39],
|
|
greenBright: [92, 39],
|
|
yellowBright: [93, 39],
|
|
blueBright: [94, 39],
|
|
magentaBright: [95, 39],
|
|
cyanBright: [96, 39],
|
|
whiteBright: [97, 39]
|
|
},
|
|
bgColor: {
|
|
bgBlack: [40, 49],
|
|
bgRed: [41, 49],
|
|
bgGreen: [42, 49],
|
|
bgYellow: [43, 49],
|
|
bgBlue: [44, 49],
|
|
bgMagenta: [45, 49],
|
|
bgCyan: [46, 49],
|
|
bgWhite: [47, 49],
|
|
bgBlackBright: [100, 49],
|
|
bgRedBright: [101, 49],
|
|
bgGreenBright: [102, 49],
|
|
bgYellowBright: [103, 49],
|
|
bgBlueBright: [104, 49],
|
|
bgMagentaBright: [105, 49],
|
|
bgCyanBright: [106, 49],
|
|
bgWhiteBright: [107, 49]
|
|
}
|
|
};
|
|
styles2.color.gray = styles2.color.blackBright;
|
|
styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
|
|
styles2.color.grey = styles2.color.blackBright;
|
|
styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
|
|
for (const [groupName, group] of Object.entries(styles2)) {
|
|
for (const [styleName, style] of Object.entries(group)) {
|
|
styles2[styleName] = {
|
|
open: `\x1B[${style[0]}m`,
|
|
close: `\x1B[${style[1]}m`
|
|
};
|
|
group[styleName] = styles2[styleName];
|
|
codes.set(style[0], style[1]);
|
|
}
|
|
Object.defineProperty(styles2, groupName, {
|
|
value: group,
|
|
enumerable: false
|
|
});
|
|
}
|
|
Object.defineProperty(styles2, "codes", {
|
|
value: codes,
|
|
enumerable: false
|
|
});
|
|
styles2.color.close = "\x1B[39m";
|
|
styles2.bgColor.close = "\x1B[49m";
|
|
styles2.color.ansi = wrapAnsi16();
|
|
styles2.color.ansi256 = wrapAnsi256();
|
|
styles2.color.ansi16m = wrapAnsi16m();
|
|
styles2.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
styles2.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
styles2.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
Object.defineProperties(styles2, {
|
|
rgbToAnsi256: {
|
|
value: (red, green, blue) => {
|
|
if (red === green && green === blue) {
|
|
if (red < 8) {
|
|
return 16;
|
|
}
|
|
if (red > 248) {
|
|
return 231;
|
|
}
|
|
return Math.round((red - 8) / 247 * 24) + 232;
|
|
}
|
|
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
},
|
|
enumerable: false
|
|
},
|
|
hexToRgb: {
|
|
value: (hex) => {
|
|
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
|
|
if (!matches) {
|
|
return [0, 0, 0];
|
|
}
|
|
let {
|
|
colorString
|
|
} = matches.groups;
|
|
if (colorString.length === 3) {
|
|
colorString = [...colorString].map((character) => character + character).join("");
|
|
}
|
|
const integer = Number.parseInt(colorString, 16);
|
|
return [integer >> 16 & 255, integer >> 8 & 255, integer & 255];
|
|
},
|
|
enumerable: false
|
|
},
|
|
hexToAnsi256: {
|
|
value: (hex) => styles2.rgbToAnsi256(...styles2.hexToRgb(hex)),
|
|
enumerable: false
|
|
},
|
|
ansi256ToAnsi: {
|
|
value: (code) => {
|
|
if (code < 8) {
|
|
return 30 + code;
|
|
}
|
|
if (code < 16) {
|
|
return 90 + (code - 8);
|
|
}
|
|
let red;
|
|
let green;
|
|
let blue;
|
|
if (code >= 232) {
|
|
red = ((code - 232) * 10 + 8) / 255;
|
|
green = red;
|
|
blue = red;
|
|
} else {
|
|
code -= 16;
|
|
const remainder = code % 36;
|
|
red = Math.floor(code / 36) / 5;
|
|
green = Math.floor(remainder / 6) / 5;
|
|
blue = remainder % 6 / 5;
|
|
}
|
|
const value = Math.max(red, green, blue) * 2;
|
|
if (value === 0) {
|
|
return 30;
|
|
}
|
|
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
if (value === 2) {
|
|
result += 60;
|
|
}
|
|
return result;
|
|
},
|
|
enumerable: false
|
|
},
|
|
rgbToAnsi: {
|
|
value: (red, green, blue) => styles2.ansi256ToAnsi(styles2.rgbToAnsi256(red, green, blue)),
|
|
enumerable: false
|
|
},
|
|
hexToAnsi: {
|
|
value: (hex) => styles2.ansi256ToAnsi(styles2.hexToAnsi256(hex)),
|
|
enumerable: false
|
|
}
|
|
});
|
|
return styles2;
|
|
}
|
|
var ANSI_BACKGROUND_OFFSET;
|
|
var wrapAnsi16;
|
|
var wrapAnsi256;
|
|
var wrapAnsi16m;
|
|
var ansiStyles;
|
|
var ansi_styles_default;
|
|
var init_ansi_styles = __esm({
|
|
"node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
|
ANSI_BACKGROUND_OFFSET = 10;
|
|
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
ansiStyles = assembleStyles();
|
|
ansi_styles_default = ansiStyles;
|
|
}
|
|
});
|
|
function hasFlag(flag, argv = import_node_process.default.argv) {
|
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
const position = argv.indexOf(prefix + flag);
|
|
const terminatorPosition = argv.indexOf("--");
|
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
}
|
|
function envForceColor() {
|
|
if ("FORCE_COLOR" in env) {
|
|
if (env.FORCE_COLOR === "true") {
|
|
return 1;
|
|
}
|
|
if (env.FORCE_COLOR === "false") {
|
|
return 0;
|
|
}
|
|
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
}
|
|
}
|
|
function translateLevel(level) {
|
|
if (level === 0) {
|
|
return false;
|
|
}
|
|
return {
|
|
level,
|
|
hasBasic: true,
|
|
has256: level >= 2,
|
|
has16m: level >= 3
|
|
};
|
|
}
|
|
function _supportsColor(haveStream, {
|
|
streamIsTTY,
|
|
sniffFlags = true
|
|
} = {}) {
|
|
const noFlagForceColor = envForceColor();
|
|
if (noFlagForceColor !== void 0) {
|
|
flagForceColor = noFlagForceColor;
|
|
}
|
|
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
if (forceColor === 0) {
|
|
return 0;
|
|
}
|
|
if (sniffFlags) {
|
|
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
return 3;
|
|
}
|
|
if (hasFlag("color=256")) {
|
|
return 2;
|
|
}
|
|
}
|
|
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
return 0;
|
|
}
|
|
const min = forceColor || 0;
|
|
if (env.TERM === "dumb") {
|
|
return min;
|
|
}
|
|
if (import_node_process.default.platform === "win32") {
|
|
const osRelease = import_node_os.default.release().split(".");
|
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
}
|
|
return 1;
|
|
}
|
|
if ("CI" in env) {
|
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
return 1;
|
|
}
|
|
return min;
|
|
}
|
|
if ("TEAMCITY_VERSION" in env) {
|
|
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
}
|
|
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
return 1;
|
|
}
|
|
if (env.COLORTERM === "truecolor") {
|
|
return 3;
|
|
}
|
|
if ("TERM_PROGRAM" in env) {
|
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
switch (env.TERM_PROGRAM) {
|
|
case "iTerm.app":
|
|
return version >= 3 ? 3 : 2;
|
|
case "Apple_Terminal":
|
|
return 2;
|
|
}
|
|
}
|
|
if (/-256(color)?$/i.test(env.TERM)) {
|
|
return 2;
|
|
}
|
|
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
return 1;
|
|
}
|
|
if ("COLORTERM" in env) {
|
|
return 1;
|
|
}
|
|
return min;
|
|
}
|
|
function createSupportsColor(stream, options = {}) {
|
|
const level = _supportsColor(stream, Object.assign({
|
|
streamIsTTY: stream && stream.isTTY
|
|
}, options));
|
|
return translateLevel(level);
|
|
}
|
|
var import_node_process;
|
|
var import_node_os;
|
|
var import_node_tty;
|
|
var env;
|
|
var flagForceColor;
|
|
var supportsColor;
|
|
var supports_color_default;
|
|
var init_supports_color = __esm({
|
|
"node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
import_node_process = __toESM(require("process"), 1);
|
|
import_node_os = __toESM(require("os"), 1);
|
|
import_node_tty = __toESM(require("tty"), 1);
|
|
({
|
|
env
|
|
} = import_node_process.default);
|
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
flagForceColor = 0;
|
|
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
flagForceColor = 1;
|
|
}
|
|
supportsColor = {
|
|
stdout: createSupportsColor({
|
|
isTTY: import_node_tty.default.isatty(1)
|
|
}),
|
|
stderr: createSupportsColor({
|
|
isTTY: import_node_tty.default.isatty(2)
|
|
})
|
|
};
|
|
supports_color_default = supportsColor;
|
|
}
|
|
});
|
|
function stringReplaceAll(string, substring, replacer) {
|
|
let index = string.indexOf(substring);
|
|
if (index === -1) {
|
|
return string;
|
|
}
|
|
const substringLength = substring.length;
|
|
let endIndex = 0;
|
|
let returnValue = "";
|
|
do {
|
|
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
endIndex = index + substringLength;
|
|
index = string.indexOf(substring, endIndex);
|
|
} while (index !== -1);
|
|
returnValue += string.slice(endIndex);
|
|
return returnValue;
|
|
}
|
|
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
let endIndex = 0;
|
|
let returnValue = "";
|
|
do {
|
|
const gotCR = string[index - 1] === "\r";
|
|
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
endIndex = index + 1;
|
|
index = string.indexOf("\n", endIndex);
|
|
} while (index !== -1);
|
|
returnValue += string.slice(endIndex);
|
|
return returnValue;
|
|
}
|
|
var init_utilities = __esm({
|
|
"node_modules/chalk/source/utilities.js"() {
|
|
}
|
|
});
|
|
var source_exports = {};
|
|
__export(source_exports, {
|
|
Chalk: () => Chalk,
|
|
chalkStderr: () => chalkStderr,
|
|
default: () => source_default,
|
|
supportsColor: () => stdoutColor,
|
|
supportsColorStderr: () => stderrColor
|
|
});
|
|
function createChalk(options) {
|
|
return chalkFactory(options);
|
|
}
|
|
var stdoutColor;
|
|
var stderrColor;
|
|
var GENERATOR;
|
|
var STYLER;
|
|
var IS_EMPTY;
|
|
var levelMapping;
|
|
var styles;
|
|
var applyOptions;
|
|
var Chalk;
|
|
var chalkFactory;
|
|
var getModelAnsi;
|
|
var usedModels;
|
|
var proto;
|
|
var createStyler;
|
|
var createBuilder;
|
|
var applyStyle;
|
|
var chalk;
|
|
var chalkStderr;
|
|
var source_default;
|
|
var init_source = __esm({
|
|
"node_modules/chalk/source/index.js"() {
|
|
init_ansi_styles();
|
|
init_supports_color();
|
|
init_utilities();
|
|
({
|
|
stdout: stdoutColor,
|
|
stderr: stderrColor
|
|
} = supports_color_default);
|
|
GENERATOR = Symbol("GENERATOR");
|
|
STYLER = Symbol("STYLER");
|
|
IS_EMPTY = Symbol("IS_EMPTY");
|
|
levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
|
|
styles = /* @__PURE__ */ Object.create(null);
|
|
applyOptions = (object, options = {}) => {
|
|
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
}
|
|
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
};
|
|
Chalk = class {
|
|
constructor(options) {
|
|
return chalkFactory(options);
|
|
}
|
|
};
|
|
chalkFactory = (options) => {
|
|
const chalk2 = (...strings) => strings.join(" ");
|
|
applyOptions(chalk2, options);
|
|
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
return chalk2;
|
|
};
|
|
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
styles[styleName] = {
|
|
get() {
|
|
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
Object.defineProperty(this, styleName, {
|
|
value: builder
|
|
});
|
|
return builder;
|
|
}
|
|
};
|
|
}
|
|
styles.visible = {
|
|
get() {
|
|
const builder = createBuilder(this, this[STYLER], true);
|
|
Object.defineProperty(this, "visible", {
|
|
value: builder
|
|
});
|
|
return builder;
|
|
}
|
|
};
|
|
getModelAnsi = (model, level, type, ...arguments_) => {
|
|
if (model === "rgb") {
|
|
if (level === "ansi16m") {
|
|
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
}
|
|
if (level === "ansi256") {
|
|
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
}
|
|
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
}
|
|
if (model === "hex") {
|
|
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
}
|
|
return ansi_styles_default[type][model](...arguments_);
|
|
};
|
|
usedModels = ["rgb", "hex", "ansi256"];
|
|
for (const model of usedModels) {
|
|
styles[model] = {
|
|
get() {
|
|
const {
|
|
level
|
|
} = this;
|
|
return function(...arguments_) {
|
|
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
};
|
|
}
|
|
};
|
|
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
styles[bgModel] = {
|
|
get() {
|
|
const {
|
|
level
|
|
} = this;
|
|
return function(...arguments_) {
|
|
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
};
|
|
}
|
|
};
|
|
}
|
|
proto = Object.defineProperties(() => {
|
|
}, Object.assign(Object.assign({}, styles), {}, {
|
|
level: {
|
|
enumerable: true,
|
|
get() {
|
|
return this[GENERATOR].level;
|
|
},
|
|
set(level) {
|
|
this[GENERATOR].level = level;
|
|
}
|
|
}
|
|
}));
|
|
createStyler = (open, close, parent) => {
|
|
let openAll;
|
|
let closeAll;
|
|
if (parent === void 0) {
|
|
openAll = open;
|
|
closeAll = close;
|
|
} else {
|
|
openAll = parent.openAll + open;
|
|
closeAll = close + parent.closeAll;
|
|
}
|
|
return {
|
|
open,
|
|
close,
|
|
openAll,
|
|
closeAll,
|
|
parent
|
|
};
|
|
};
|
|
createBuilder = (self2, _styler, _isEmpty) => {
|
|
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
Object.setPrototypeOf(builder, proto);
|
|
builder[GENERATOR] = self2;
|
|
builder[STYLER] = _styler;
|
|
builder[IS_EMPTY] = _isEmpty;
|
|
return builder;
|
|
};
|
|
applyStyle = (self2, string) => {
|
|
if (self2.level <= 0 || !string) {
|
|
return self2[IS_EMPTY] ? "" : string;
|
|
}
|
|
let styler = self2[STYLER];
|
|
if (styler === void 0) {
|
|
return string;
|
|
}
|
|
const {
|
|
openAll,
|
|
closeAll
|
|
} = styler;
|
|
if (string.includes("\x1B")) {
|
|
while (styler !== void 0) {
|
|
string = stringReplaceAll(string, styler.close, styler.open);
|
|
styler = styler.parent;
|
|
}
|
|
}
|
|
const lfIndex = string.indexOf("\n");
|
|
if (lfIndex !== -1) {
|
|
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
}
|
|
return openAll + string + closeAll;
|
|
};
|
|
Object.defineProperties(createChalk.prototype, styles);
|
|
chalk = createChalk();
|
|
chalkStderr = createChalk({
|
|
level: stderrColor ? stderrColor.level : 0
|
|
});
|
|
source_default = chalk;
|
|
}
|
|
});
|
|
var require_logger = __commonJS2({
|
|
"src/cli/logger.js"(exports2, module2) {
|
|
"use strict";
|
|
var readline = require("readline");
|
|
var wcwidth = require_wcwidth();
|
|
var {
|
|
default: stripAnsi2
|
|
} = (init_strip_ansi(), __toCommonJS(strip_ansi_exports));
|
|
var {
|
|
default: chalk2,
|
|
chalkStderr: chalkStderr2
|
|
} = (init_source(), __toCommonJS(source_exports));
|
|
var countLines = (stream, text) => {
|
|
const columns = stream.columns || 80;
|
|
let lineCount = 0;
|
|
for (const line of stripAnsi2(text).split("\n")) {
|
|
lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns));
|
|
}
|
|
return lineCount;
|
|
};
|
|
var clear = (stream, text) => () => {
|
|
const lineCount = countLines(stream, text);
|
|
for (let line = 0; line < lineCount; line++) {
|
|
if (line > 0) {
|
|
readline.moveCursor(stream, 0, -1);
|
|
}
|
|
readline.clearLine(stream, 0);
|
|
readline.cursorTo(stream, 0);
|
|
}
|
|
};
|
|
var emptyLogResult = {
|
|
clear() {
|
|
}
|
|
};
|
|
function createLogger2(logLevel = "log") {
|
|
return {
|
|
logLevel,
|
|
warn: createLogFunc("warn", "yellow"),
|
|
error: createLogFunc("error", "red"),
|
|
debug: createLogFunc("debug", "blue"),
|
|
log: createLogFunc("log")
|
|
};
|
|
function createLogFunc(loggerName, color) {
|
|
if (!shouldLog(loggerName)) {
|
|
return () => emptyLogResult;
|
|
}
|
|
const stream = process[loggerName === "log" ? "stdout" : "stderr"];
|
|
const chalkInstance = loggerName === "log" ? chalk2 : chalkStderr2;
|
|
const prefix = color ? `[${chalkInstance[color](loggerName)}] ` : "";
|
|
return (message, options) => {
|
|
options = Object.assign({
|
|
newline: true,
|
|
clearable: false
|
|
}, options);
|
|
message = message.replace(/^/gm, prefix) + (options.newline ? "\n" : "");
|
|
stream.write(message);
|
|
if (options.clearable) {
|
|
return {
|
|
clear: clear(stream, message)
|
|
};
|
|
}
|
|
};
|
|
}
|
|
function shouldLog(loggerName) {
|
|
switch (logLevel) {
|
|
case "silent":
|
|
return false;
|
|
case "debug":
|
|
if (loggerName === "debug") {
|
|
return true;
|
|
}
|
|
case "log":
|
|
if (loggerName === "log") {
|
|
return true;
|
|
}
|
|
case "warn":
|
|
if (loggerName === "warn") {
|
|
return true;
|
|
}
|
|
case "error":
|
|
return loggerName === "error";
|
|
}
|
|
}
|
|
}
|
|
module2.exports = createLogger2;
|
|
}
|
|
});
|
|
var require_prettier_internal = __commonJS2({
|
|
"src/cli/prettier-internal.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = require("./index.js").__internal;
|
|
}
|
|
});
|
|
var require_lib = __commonJS2({
|
|
"node_modules/outdent/lib/index.js"(exports2, module2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.outdent = void 0;
|
|
function noop() {
|
|
var args = [];
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
args[_i] = arguments[_i];
|
|
}
|
|
}
|
|
function createWeakMap() {
|
|
if (typeof WeakMap !== "undefined") {
|
|
return /* @__PURE__ */ new WeakMap();
|
|
} else {
|
|
return fakeSetOrMap();
|
|
}
|
|
}
|
|
function fakeSetOrMap() {
|
|
return {
|
|
add: noop,
|
|
delete: noop,
|
|
get: noop,
|
|
set: noop,
|
|
has: function(k) {
|
|
return false;
|
|
}
|
|
};
|
|
}
|
|
var hop = Object.prototype.hasOwnProperty;
|
|
var has = function(obj, prop) {
|
|
return hop.call(obj, prop);
|
|
};
|
|
function extend(target, source) {
|
|
for (var prop in source) {
|
|
if (has(source, prop)) {
|
|
target[prop] = source[prop];
|
|
}
|
|
}
|
|
return target;
|
|
}
|
|
var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
|
|
var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
|
|
var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
|
|
var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
|
|
var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
|
|
function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
|
|
var indentationLevel = 0;
|
|
var match = strings[0].match(reDetectIndentation);
|
|
if (match) {
|
|
indentationLevel = match[1].length;
|
|
}
|
|
var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
|
|
var reMatchIndent = new RegExp(reSource, "g");
|
|
if (firstInterpolatedValueSetsIndentationLevel) {
|
|
strings = strings.slice(1);
|
|
}
|
|
var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
|
|
var normalizeNewlines = typeof newline === "string";
|
|
var l = strings.length;
|
|
var outdentedStrings = strings.map(function(v, i) {
|
|
v = v.replace(reMatchIndent, "$1");
|
|
if (i === 0 && trimLeadingNewline) {
|
|
v = v.replace(reLeadingNewline, "");
|
|
}
|
|
if (i === l - 1 && trimTrailingNewline) {
|
|
v = v.replace(reTrailingNewline, "");
|
|
}
|
|
if (normalizeNewlines) {
|
|
v = v.replace(/\r\n|\n|\r/g, function(_) {
|
|
return newline;
|
|
});
|
|
}
|
|
return v;
|
|
});
|
|
return outdentedStrings;
|
|
}
|
|
function concatStringsAndValues(strings, values) {
|
|
var ret = "";
|
|
for (var i = 0, l = strings.length; i < l; i++) {
|
|
ret += strings[i];
|
|
if (i < l - 1) {
|
|
ret += values[i];
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
function isTemplateStringsArray(v) {
|
|
return has(v, "raw") && has(v, "length");
|
|
}
|
|
function createInstance(options) {
|
|
var arrayAutoIndentCache = createWeakMap();
|
|
var arrayFirstInterpSetsIndentCache = createWeakMap();
|
|
function outdent(stringsOrOptions) {
|
|
var values = [];
|
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
values[_i - 1] = arguments[_i];
|
|
}
|
|
if (isTemplateStringsArray(stringsOrOptions)) {
|
|
var strings = stringsOrOptions;
|
|
var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
|
|
var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
|
|
var renderedArray = cache.get(strings);
|
|
if (!renderedArray) {
|
|
renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
|
|
cache.set(strings, renderedArray);
|
|
}
|
|
if (values.length === 0) {
|
|
return renderedArray[0];
|
|
}
|
|
var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
|
|
return rendered;
|
|
} else {
|
|
return createInstance(extend(extend({}, options), stringsOrOptions || {}));
|
|
}
|
|
}
|
|
var fullOutdent = extend(outdent, {
|
|
string: function(str) {
|
|
return _outdentArray([str], false, options)[0];
|
|
}
|
|
});
|
|
return fullOutdent;
|
|
}
|
|
var defaultOutdent = createInstance({
|
|
trimLeadingNewline: true,
|
|
trimTrailingNewline: true
|
|
});
|
|
exports2.outdent = defaultOutdent;
|
|
exports2.default = defaultOutdent;
|
|
if (typeof module2 !== "undefined") {
|
|
try {
|
|
module2.exports = defaultOutdent;
|
|
Object.defineProperty(defaultOutdent, "__esModule", {
|
|
value: true
|
|
});
|
|
defaultOutdent.default = defaultOutdent;
|
|
defaultOutdent.outdent = defaultOutdent;
|
|
} catch (e) {
|
|
}
|
|
}
|
|
}
|
|
});
|
|
var require_constant = __commonJS2({
|
|
"src/cli/constant.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
outdent
|
|
} = require_lib();
|
|
var {
|
|
coreOptions
|
|
} = require_prettier_internal();
|
|
var categoryOrder = [coreOptions.CATEGORY_OUTPUT, coreOptions.CATEGORY_FORMAT, coreOptions.CATEGORY_CONFIG, coreOptions.CATEGORY_EDITOR, coreOptions.CATEGORY_OTHER];
|
|
var options = {
|
|
cache: {
|
|
default: false,
|
|
description: "Only format changed files. Cannot use with --stdin-filepath.",
|
|
type: "boolean"
|
|
},
|
|
"cache-location": {
|
|
description: "Path to the cache file.",
|
|
type: "path"
|
|
},
|
|
"cache-strategy": {
|
|
choices: [{
|
|
description: "Use the file metadata such as timestamps as cache keys",
|
|
value: "metadata"
|
|
}, {
|
|
description: "Use the file content as cache keys",
|
|
value: "content"
|
|
}],
|
|
description: "Strategy for the cache to use for detecting changed files.",
|
|
type: "choice"
|
|
},
|
|
check: {
|
|
alias: "c",
|
|
category: coreOptions.CATEGORY_OUTPUT,
|
|
description: outdent`
|
|
Check if the given files are formatted, print a human-friendly summary
|
|
message and paths to unformatted files (see also --list-different).
|
|
`,
|
|
type: "boolean"
|
|
},
|
|
color: {
|
|
default: true,
|
|
description: "Colorize error messages.",
|
|
oppositeDescription: "Do not colorize error messages.",
|
|
type: "boolean"
|
|
},
|
|
config: {
|
|
category: coreOptions.CATEGORY_CONFIG,
|
|
description: "Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).",
|
|
exception: (value) => value === false,
|
|
oppositeDescription: "Do not look for a configuration file.",
|
|
type: "path"
|
|
},
|
|
"config-precedence": {
|
|
category: coreOptions.CATEGORY_CONFIG,
|
|
choices: [{
|
|
description: "CLI options take precedence over config file",
|
|
value: "cli-override"
|
|
}, {
|
|
description: "Config file take precedence over CLI options",
|
|
value: "file-override"
|
|
}, {
|
|
description: outdent`
|
|
If a config file is found will evaluate it and ignore other CLI options.
|
|
If no config file is found CLI options will evaluate as normal.
|
|
`,
|
|
value: "prefer-file"
|
|
}],
|
|
default: "cli-override",
|
|
description: "Define in which order config files and CLI options should be evaluated.",
|
|
type: "choice"
|
|
},
|
|
"debug-benchmark": {
|
|
type: "boolean"
|
|
},
|
|
"debug-check": {
|
|
type: "boolean"
|
|
},
|
|
"debug-print-ast": {
|
|
type: "boolean"
|
|
},
|
|
"debug-print-comments": {
|
|
type: "boolean"
|
|
},
|
|
"debug-print-doc": {
|
|
type: "boolean"
|
|
},
|
|
"debug-repeat": {
|
|
default: 0,
|
|
type: "int"
|
|
},
|
|
editorconfig: {
|
|
category: coreOptions.CATEGORY_CONFIG,
|
|
default: true,
|
|
description: "Take .editorconfig into account when parsing configuration.",
|
|
oppositeDescription: "Don't take .editorconfig into account when parsing configuration.",
|
|
type: "boolean"
|
|
},
|
|
"error-on-unmatched-pattern": {
|
|
oppositeDescription: "Prevent errors when pattern is unmatched.",
|
|
type: "boolean"
|
|
},
|
|
"file-info": {
|
|
description: outdent`
|
|
Extract the following info (as JSON) for a given file path. Reported fields:
|
|
* ignored (boolean) - true if file path is filtered by --ignore-path
|
|
* inferredParser (string | null) - name of parser inferred from file path
|
|
`,
|
|
type: "path"
|
|
},
|
|
"find-config-path": {
|
|
category: coreOptions.CATEGORY_CONFIG,
|
|
description: "Find and print the path to a configuration file for the given input file.",
|
|
type: "path"
|
|
},
|
|
help: {
|
|
alias: "h",
|
|
description: outdent`
|
|
Show CLI usage, or details about the given flag.
|
|
Example: --help write
|
|
`,
|
|
exception: (value) => value === "",
|
|
type: "flag"
|
|
},
|
|
"ignore-path": {
|
|
category: coreOptions.CATEGORY_CONFIG,
|
|
default: ".prettierignore",
|
|
description: "Path to a file with patterns describing files to ignore.",
|
|
type: "path"
|
|
},
|
|
"ignore-unknown": {
|
|
alias: "u",
|
|
description: "Ignore unknown files.",
|
|
type: "boolean"
|
|
},
|
|
"list-different": {
|
|
alias: "l",
|
|
category: coreOptions.CATEGORY_OUTPUT,
|
|
description: "Print the names of files that are different from Prettier's formatting (see also --check).",
|
|
type: "boolean"
|
|
},
|
|
loglevel: {
|
|
choices: ["silent", "error", "warn", "log", "debug"],
|
|
default: "log",
|
|
description: "What level of logs to report.",
|
|
type: "choice"
|
|
},
|
|
"plugin-search": {
|
|
oppositeDescription: "Disable plugin autoloading.",
|
|
type: "boolean"
|
|
},
|
|
"support-info": {
|
|
description: "Print support information as JSON.",
|
|
type: "boolean"
|
|
},
|
|
version: {
|
|
alias: "v",
|
|
description: "Print Prettier version.",
|
|
type: "boolean"
|
|
},
|
|
"with-node-modules": {
|
|
category: coreOptions.CATEGORY_CONFIG,
|
|
description: "Process files inside 'node_modules' directory.",
|
|
type: "boolean"
|
|
},
|
|
write: {
|
|
alias: "w",
|
|
category: coreOptions.CATEGORY_OUTPUT,
|
|
description: "Edit files in-place. (Beware!)",
|
|
type: "boolean"
|
|
}
|
|
};
|
|
var usageSummary = outdent`
|
|
Usage: prettier [options] [file/dir/glob ...]
|
|
|
|
By default, output is written to stdout.
|
|
Stdin is read if it is piped to Prettier and no files are given.
|
|
`;
|
|
module2.exports = {
|
|
categoryOrder,
|
|
options,
|
|
usageSummary
|
|
};
|
|
}
|
|
});
|
|
var require_dashify = __commonJS2({
|
|
"node_modules/dashify/index.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = (str, options) => {
|
|
if (typeof str !== "string")
|
|
throw new TypeError("expected a string");
|
|
return str.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\W/g, (m) => /[À-ž]/.test(m) ? m : "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, (m) => options && options.condense ? "-" : m).toLowerCase();
|
|
};
|
|
}
|
|
});
|
|
var require_option_map = __commonJS2({
|
|
"src/cli/options/option-map.js"(exports2, module2) {
|
|
"use strict";
|
|
var dashify = require_dashify();
|
|
var {
|
|
coreOptions
|
|
} = require_prettier_internal();
|
|
function normalizeDetailedOption(name, option) {
|
|
return Object.assign(Object.assign({
|
|
category: coreOptions.CATEGORY_OTHER
|
|
}, option), {}, {
|
|
choices: option.choices && option.choices.map((choice) => {
|
|
const newChoice = Object.assign({
|
|
description: "",
|
|
deprecated: false
|
|
}, typeof choice === "object" ? choice : {
|
|
value: choice
|
|
});
|
|
if (newChoice.value === true) {
|
|
newChoice.value = "";
|
|
}
|
|
return newChoice;
|
|
})
|
|
});
|
|
}
|
|
function normalizeDetailedOptionMap(detailedOptionMap) {
|
|
return Object.fromEntries(Object.entries(detailedOptionMap).sort(([leftName], [rightName]) => leftName.localeCompare(rightName)).map(([name, option]) => [name, normalizeDetailedOption(name, option)]));
|
|
}
|
|
function createDetailedOptionMap(supportOptions) {
|
|
return Object.fromEntries(supportOptions.map((option) => {
|
|
const newOption = Object.assign(Object.assign({}, option), {}, {
|
|
name: option.cliName || dashify(option.name),
|
|
description: option.cliDescription || option.description,
|
|
category: option.cliCategory || coreOptions.CATEGORY_FORMAT,
|
|
forwardToApi: option.name
|
|
});
|
|
if (option.deprecated) {
|
|
delete newOption.forwardToApi;
|
|
delete newOption.description;
|
|
delete newOption.oppositeDescription;
|
|
newOption.deprecated = true;
|
|
}
|
|
return [newOption.name, newOption];
|
|
}));
|
|
}
|
|
module2.exports = {
|
|
normalizeDetailedOptionMap,
|
|
createDetailedOptionMap
|
|
};
|
|
}
|
|
});
|
|
var require_get_context_options = __commonJS2({
|
|
"src/cli/options/get-context-options.js"(exports2, module2) {
|
|
"use strict";
|
|
var prettier2 = require("./index.js");
|
|
var {
|
|
optionsModule,
|
|
utils: {
|
|
arrayify
|
|
}
|
|
} = require_prettier_internal();
|
|
var constant = require_constant();
|
|
var {
|
|
normalizeDetailedOptionMap,
|
|
createDetailedOptionMap
|
|
} = require_option_map();
|
|
function getContextOptions(plugins, pluginSearchDirs) {
|
|
const {
|
|
options: supportOptions,
|
|
languages
|
|
} = prettier2.getSupportInfo({
|
|
showDeprecated: true,
|
|
showUnreleased: true,
|
|
showInternal: true,
|
|
plugins,
|
|
pluginSearchDirs
|
|
});
|
|
const detailedOptionMap = normalizeDetailedOptionMap(Object.assign(Object.assign({}, createDetailedOptionMap(supportOptions)), constant.options));
|
|
const detailedOptions = arrayify(detailedOptionMap, "name");
|
|
const apiDefaultOptions = Object.assign(Object.assign({}, optionsModule.hiddenDefaults), Object.fromEntries(supportOptions.filter(({
|
|
deprecated
|
|
}) => !deprecated).map((option) => [option.name, option.default])));
|
|
return {
|
|
supportOptions,
|
|
detailedOptions,
|
|
detailedOptionMap,
|
|
apiDefaultOptions,
|
|
languages
|
|
};
|
|
}
|
|
module2.exports = getContextOptions;
|
|
}
|
|
});
|
|
var require_camelcase = __commonJS2({
|
|
"node_modules/camelcase/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var UPPERCASE = /[\p{Lu}]/u;
|
|
var LOWERCASE = /[\p{Ll}]/u;
|
|
var LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
var SEPARATORS = /[_.\- ]+/;
|
|
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
var preserveCamelCase = (string, toLowerCase, toUpperCase) => {
|
|
let isLastCharLower = false;
|
|
let isLastCharUpper = false;
|
|
let isLastLastCharUpper = false;
|
|
for (let i = 0; i < string.length; i++) {
|
|
const character = string[i];
|
|
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
string = string.slice(0, i) + "-" + string.slice(i);
|
|
isLastCharLower = false;
|
|
isLastLastCharUpper = isLastCharUpper;
|
|
isLastCharUpper = true;
|
|
i++;
|
|
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
|
|
string = string.slice(0, i - 1) + "-" + string.slice(i - 1);
|
|
isLastLastCharUpper = isLastCharUpper;
|
|
isLastCharUpper = false;
|
|
isLastCharLower = true;
|
|
} else {
|
|
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
isLastLastCharUpper = isLastCharUpper;
|
|
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
}
|
|
}
|
|
return string;
|
|
};
|
|
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
LEADING_CAPITAL.lastIndex = 0;
|
|
return input.replace(LEADING_CAPITAL, (m1) => toLowerCase(m1));
|
|
};
|
|
var postProcess = (input, toUpperCase) => {
|
|
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
|
|
};
|
|
var camelCase = (input, options) => {
|
|
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
throw new TypeError("Expected the input to be `string | string[]`");
|
|
}
|
|
options = Object.assign({
|
|
pascalCase: false,
|
|
preserveConsecutiveUppercase: false
|
|
}, options);
|
|
if (Array.isArray(input)) {
|
|
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
} else {
|
|
input = input.trim();
|
|
}
|
|
if (input.length === 0) {
|
|
return "";
|
|
}
|
|
const toLowerCase = options.locale === false ? (string) => string.toLowerCase() : (string) => string.toLocaleLowerCase(options.locale);
|
|
const toUpperCase = options.locale === false ? (string) => string.toUpperCase() : (string) => string.toLocaleUpperCase(options.locale);
|
|
if (input.length === 1) {
|
|
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
}
|
|
const hasUpperCase = input !== toLowerCase(input);
|
|
if (hasUpperCase) {
|
|
input = preserveCamelCase(input, toLowerCase, toUpperCase);
|
|
}
|
|
input = input.replace(LEADING_SEPARATORS, "");
|
|
if (options.preserveConsecutiveUppercase) {
|
|
input = preserveConsecutiveUppercase(input, toLowerCase);
|
|
} else {
|
|
input = toLowerCase(input);
|
|
}
|
|
if (options.pascalCase) {
|
|
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
}
|
|
return postProcess(input, toUpperCase);
|
|
};
|
|
module2.exports = camelCase;
|
|
module2.exports.default = camelCase;
|
|
}
|
|
});
|
|
var sdbm_exports = {};
|
|
__export(sdbm_exports, {
|
|
default: () => sdbm
|
|
});
|
|
function sdbm(string) {
|
|
let hash = 0;
|
|
for (let i = 0; i < string.length; i++) {
|
|
hash = string.charCodeAt(i) + (hash << 6) + (hash << 16) - hash;
|
|
}
|
|
return hash >>> 0;
|
|
}
|
|
var init_sdbm = __esm({
|
|
"node_modules/sdbm/index.js"() {
|
|
}
|
|
});
|
|
var require_utils = __commonJS2({
|
|
"src/cli/utils.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
promises: fs
|
|
} = require("fs");
|
|
var {
|
|
default: sdbm2
|
|
} = (init_sdbm(), __toCommonJS(sdbm_exports));
|
|
var printToScreen2 = console.log.bind(console);
|
|
function groupBy(array2, iteratee) {
|
|
const result = /* @__PURE__ */ Object.create(null);
|
|
for (const value of array2) {
|
|
const key = iteratee(value);
|
|
if (Array.isArray(result[key])) {
|
|
result[key].push(value);
|
|
} else {
|
|
result[key] = [value];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function pick(object, keys) {
|
|
const entries = keys.map((key) => [key, object[key]]);
|
|
return Object.fromEntries(entries);
|
|
}
|
|
function createHash(source) {
|
|
return String(sdbm2(source));
|
|
}
|
|
async function statSafe(filePath) {
|
|
try {
|
|
return await fs.stat(filePath);
|
|
} catch (error) {
|
|
if (error.code !== "ENOENT") {
|
|
throw error;
|
|
}
|
|
}
|
|
}
|
|
function isJson(value) {
|
|
try {
|
|
JSON.parse(value);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
module2.exports = {
|
|
printToScreen: printToScreen2,
|
|
groupBy,
|
|
pick,
|
|
createHash,
|
|
statSafe,
|
|
isJson
|
|
};
|
|
}
|
|
});
|
|
var require_minimist = __commonJS2({
|
|
"node_modules/minimist/index.js"(exports2, module2) {
|
|
module2.exports = function(args, opts) {
|
|
if (!opts)
|
|
opts = {};
|
|
var flags = {
|
|
bools: {},
|
|
strings: {},
|
|
unknownFn: null
|
|
};
|
|
if (typeof opts["unknown"] === "function") {
|
|
flags.unknownFn = opts["unknown"];
|
|
}
|
|
if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
|
|
flags.allBools = true;
|
|
} else {
|
|
[].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
|
|
flags.bools[key2] = true;
|
|
});
|
|
}
|
|
var aliases = {};
|
|
Object.keys(opts.alias || {}).forEach(function(key2) {
|
|
aliases[key2] = [].concat(opts.alias[key2]);
|
|
aliases[key2].forEach(function(x) {
|
|
aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
|
|
return x !== y;
|
|
}));
|
|
});
|
|
});
|
|
[].concat(opts.string).filter(Boolean).forEach(function(key2) {
|
|
flags.strings[key2] = true;
|
|
if (aliases[key2]) {
|
|
flags.strings[aliases[key2]] = true;
|
|
}
|
|
});
|
|
var defaults = opts["default"] || {};
|
|
var argv = {
|
|
_: []
|
|
};
|
|
Object.keys(flags.bools).forEach(function(key2) {
|
|
setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
|
|
});
|
|
var notFlags = [];
|
|
if (args.indexOf("--") !== -1) {
|
|
notFlags = args.slice(args.indexOf("--") + 1);
|
|
args = args.slice(0, args.indexOf("--"));
|
|
}
|
|
function argDefined(key2, arg2) {
|
|
return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
|
|
}
|
|
function setArg(key2, val, arg2) {
|
|
if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
|
|
if (flags.unknownFn(arg2) === false)
|
|
return;
|
|
}
|
|
var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
|
|
setKey(argv, key2.split("."), value2);
|
|
(aliases[key2] || []).forEach(function(x) {
|
|
setKey(argv, x.split("."), value2);
|
|
});
|
|
}
|
|
function setKey(obj, keys, value2) {
|
|
var o = obj;
|
|
for (var i2 = 0; i2 < keys.length - 1; i2++) {
|
|
var key2 = keys[i2];
|
|
if (isConstructorOrProto(o, key2))
|
|
return;
|
|
if (o[key2] === void 0)
|
|
o[key2] = {};
|
|
if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype)
|
|
o[key2] = {};
|
|
if (o[key2] === Array.prototype)
|
|
o[key2] = [];
|
|
o = o[key2];
|
|
}
|
|
var key2 = keys[keys.length - 1];
|
|
if (isConstructorOrProto(o, key2))
|
|
return;
|
|
if (o === Object.prototype || o === Number.prototype || o === String.prototype)
|
|
o = {};
|
|
if (o === Array.prototype)
|
|
o = [];
|
|
if (o[key2] === void 0 || flags.bools[key2] || typeof o[key2] === "boolean") {
|
|
o[key2] = value2;
|
|
} else if (Array.isArray(o[key2])) {
|
|
o[key2].push(value2);
|
|
} else {
|
|
o[key2] = [o[key2], value2];
|
|
}
|
|
}
|
|
function aliasIsBoolean(key2) {
|
|
return aliases[key2].some(function(x) {
|
|
return flags.bools[x];
|
|
});
|
|
}
|
|
for (var i = 0; i < args.length; i++) {
|
|
var arg = args[i];
|
|
if (/^--.+=/.test(arg)) {
|
|
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
var key = m[1];
|
|
var value = m[2];
|
|
if (flags.bools[key]) {
|
|
value = value !== "false";
|
|
}
|
|
setArg(key, value, arg);
|
|
} else if (/^--no-.+/.test(arg)) {
|
|
var key = arg.match(/^--no-(.+)/)[1];
|
|
setArg(key, false, arg);
|
|
} else if (/^--.+/.test(arg)) {
|
|
var key = arg.match(/^--(.+)/)[1];
|
|
var next = args[i + 1];
|
|
if (next !== void 0 && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
setArg(key, next, arg);
|
|
i++;
|
|
} else if (/^(true|false)$/.test(next)) {
|
|
setArg(key, next === "true", arg);
|
|
i++;
|
|
} else {
|
|
setArg(key, flags.strings[key] ? "" : true, arg);
|
|
}
|
|
} else if (/^-[^-]+/.test(arg)) {
|
|
var letters = arg.slice(1, -1).split("");
|
|
var broken = false;
|
|
for (var j = 0; j < letters.length; j++) {
|
|
var next = arg.slice(j + 2);
|
|
if (next === "-") {
|
|
setArg(letters[j], next, arg);
|
|
continue;
|
|
}
|
|
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
|
|
setArg(letters[j], next.split("=")[1], arg);
|
|
broken = true;
|
|
break;
|
|
}
|
|
if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
|
setArg(letters[j], next, arg);
|
|
broken = true;
|
|
break;
|
|
}
|
|
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
setArg(letters[j], arg.slice(j + 2), arg);
|
|
broken = true;
|
|
break;
|
|
} else {
|
|
setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
|
|
}
|
|
}
|
|
var key = arg.slice(-1)[0];
|
|
if (!broken && key !== "-") {
|
|
if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
|
|
setArg(key, args[i + 1], arg);
|
|
i++;
|
|
} else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
|
|
setArg(key, args[i + 1] === "true", arg);
|
|
i++;
|
|
} else {
|
|
setArg(key, flags.strings[key] ? "" : true, arg);
|
|
}
|
|
}
|
|
} else {
|
|
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
|
argv._.push(flags.strings["_"] || !isNumber(arg) ? arg : Number(arg));
|
|
}
|
|
if (opts.stopEarly) {
|
|
argv._.push.apply(argv._, args.slice(i + 1));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
Object.keys(defaults).forEach(function(key2) {
|
|
if (!hasKey(argv, key2.split("."))) {
|
|
setKey(argv, key2.split("."), defaults[key2]);
|
|
(aliases[key2] || []).forEach(function(x) {
|
|
setKey(argv, x.split("."), defaults[key2]);
|
|
});
|
|
}
|
|
});
|
|
if (opts["--"]) {
|
|
argv["--"] = new Array();
|
|
notFlags.forEach(function(key2) {
|
|
argv["--"].push(key2);
|
|
});
|
|
} else {
|
|
notFlags.forEach(function(key2) {
|
|
argv._.push(key2);
|
|
});
|
|
}
|
|
return argv;
|
|
};
|
|
function hasKey(obj, keys) {
|
|
var o = obj;
|
|
keys.slice(0, -1).forEach(function(key2) {
|
|
o = o[key2] || {};
|
|
});
|
|
var key = keys[keys.length - 1];
|
|
return key in o;
|
|
}
|
|
function isNumber(x) {
|
|
if (typeof x === "number")
|
|
return true;
|
|
if (/^0x[0-9a-f]+$/i.test(x))
|
|
return true;
|
|
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
}
|
|
function isConstructorOrProto(obj, key) {
|
|
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
|
}
|
|
}
|
|
});
|
|
var require_minimist2 = __commonJS2({
|
|
"src/cli/options/minimist.js"(exports2, module2) {
|
|
"use strict";
|
|
var minimist = require_minimist();
|
|
var PLACEHOLDER = null;
|
|
module2.exports = function(args, options) {
|
|
const boolean = options.boolean || [];
|
|
const defaults = options.default || {};
|
|
const booleanWithoutDefault = boolean.filter((key) => !(key in defaults));
|
|
const newDefaults = Object.assign(Object.assign({}, defaults), Object.fromEntries(booleanWithoutDefault.map((key) => [key, PLACEHOLDER])));
|
|
const parsed = minimist(args, Object.assign(Object.assign({}, options), {}, {
|
|
default: newDefaults
|
|
}));
|
|
return Object.fromEntries(Object.entries(parsed).filter(([, value]) => value !== PLACEHOLDER));
|
|
};
|
|
}
|
|
});
|
|
var require_create_minimist_options = __commonJS2({
|
|
"src/cli/options/create-minimist-options.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
utils: {
|
|
partition
|
|
}
|
|
} = require_prettier_internal();
|
|
module2.exports = function createMinimistOptions(detailedOptions) {
|
|
const [boolean, string] = partition(detailedOptions, ({
|
|
type
|
|
}) => type === "boolean").map((detailedOptions2) => detailedOptions2.flatMap(({
|
|
name,
|
|
alias
|
|
}) => alias ? [name, alias] : [name]));
|
|
const defaults = Object.fromEntries(detailedOptions.filter((option) => !option.deprecated && (!option.forwardToApi || option.name === "plugin" || option.name === "plugin-search-dir") && option.default !== void 0).map((option) => [option.name, option.default]));
|
|
return {
|
|
alias: {},
|
|
boolean,
|
|
string,
|
|
default: defaults
|
|
};
|
|
};
|
|
}
|
|
});
|
|
var leven_exports = {};
|
|
__export(leven_exports, {
|
|
default: () => leven
|
|
});
|
|
function leven(first, second) {
|
|
if (first === second) {
|
|
return 0;
|
|
}
|
|
const swap = first;
|
|
if (first.length > second.length) {
|
|
first = second;
|
|
second = swap;
|
|
}
|
|
let firstLength = first.length;
|
|
let secondLength = second.length;
|
|
while (firstLength > 0 && first.charCodeAt(~-firstLength) === second.charCodeAt(~-secondLength)) {
|
|
firstLength--;
|
|
secondLength--;
|
|
}
|
|
let start = 0;
|
|
while (start < firstLength && first.charCodeAt(start) === second.charCodeAt(start)) {
|
|
start++;
|
|
}
|
|
firstLength -= start;
|
|
secondLength -= start;
|
|
if (firstLength === 0) {
|
|
return secondLength;
|
|
}
|
|
let bCharacterCode;
|
|
let result;
|
|
let temporary;
|
|
let temporary2;
|
|
let index = 0;
|
|
let index2 = 0;
|
|
while (index < firstLength) {
|
|
characterCodeCache[index] = first.charCodeAt(start + index);
|
|
array[index] = ++index;
|
|
}
|
|
while (index2 < secondLength) {
|
|
bCharacterCode = second.charCodeAt(start + index2);
|
|
temporary = index2++;
|
|
result = index2;
|
|
for (index = 0; index < firstLength; index++) {
|
|
temporary2 = bCharacterCode === characterCodeCache[index] ? temporary : temporary + 1;
|
|
temporary = array[index];
|
|
result = array[index] = temporary > result ? temporary2 > result ? result + 1 : temporary2 : temporary2 > temporary ? temporary + 1 : temporary2;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
var array;
|
|
var characterCodeCache;
|
|
var init_leven = __esm({
|
|
"node_modules/leven/index.js"() {
|
|
array = [];
|
|
characterCodeCache = [];
|
|
}
|
|
});
|
|
var require_normalize_cli_options = __commonJS2({
|
|
"src/cli/options/normalize-cli-options.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
default: chalk2
|
|
} = (init_source(), __toCommonJS(source_exports));
|
|
var {
|
|
default: leven2
|
|
} = (init_leven(), __toCommonJS(leven_exports));
|
|
var {
|
|
optionsNormalizer
|
|
} = require_prettier_internal();
|
|
function normalizeCliOptions(options, optionInfos, opts) {
|
|
return optionsNormalizer.normalizeCliOptions(options, optionInfos, Object.assign({
|
|
colorsModule: chalk2,
|
|
levenshteinDistance: leven2
|
|
}, opts));
|
|
}
|
|
module2.exports = normalizeCliOptions;
|
|
}
|
|
});
|
|
var require_parse_cli_arguments = __commonJS2({
|
|
"src/cli/options/parse-cli-arguments.js"(exports2, module2) {
|
|
"use strict";
|
|
var camelCase = require_camelcase();
|
|
var {
|
|
pick
|
|
} = require_utils();
|
|
var getContextOptions = require_get_context_options();
|
|
var minimist = require_minimist2();
|
|
var createMinimistOptions = require_create_minimist_options();
|
|
var normalizeCliOptions = require_normalize_cli_options();
|
|
function parseArgv(rawArguments, detailedOptions, logger, keys) {
|
|
const minimistOptions = createMinimistOptions(detailedOptions);
|
|
let argv = minimist(rawArguments, minimistOptions);
|
|
if (keys) {
|
|
if (keys.includes("plugin-search-dir") && !keys.includes("plugin-search")) {
|
|
keys.push("plugin-search");
|
|
}
|
|
detailedOptions = detailedOptions.filter((option) => keys.includes(option.name));
|
|
argv = pick(argv, keys);
|
|
}
|
|
const normalized = normalizeCliOptions(argv, detailedOptions, {
|
|
logger
|
|
});
|
|
return Object.assign(Object.assign({}, Object.fromEntries(Object.entries(normalized).map(([key, value]) => {
|
|
const option = detailedOptions.find(({
|
|
name
|
|
}) => name === key) || {};
|
|
return [option.forwardToApi || camelCase(key), value];
|
|
}))), {}, {
|
|
get __raw() {
|
|
return argv;
|
|
}
|
|
});
|
|
}
|
|
var detailedOptionsWithoutPlugins = getContextOptions([], false).detailedOptions;
|
|
function parseArgvWithoutPlugins2(rawArguments, logger, keys) {
|
|
return parseArgv(rawArguments, detailedOptionsWithoutPlugins, logger, typeof keys === "string" ? [keys] : keys);
|
|
}
|
|
module2.exports = {
|
|
parseArgv,
|
|
parseArgvWithoutPlugins: parseArgvWithoutPlugins2
|
|
};
|
|
}
|
|
});
|
|
var require_context = __commonJS2({
|
|
"src/cli/context.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
utils: {
|
|
getLast
|
|
}
|
|
} = require_prettier_internal();
|
|
var getContextOptions = require_get_context_options();
|
|
var {
|
|
parseArgv,
|
|
parseArgvWithoutPlugins: parseArgvWithoutPlugins2
|
|
} = require_parse_cli_arguments();
|
|
var Context2 = class {
|
|
constructor({
|
|
rawArguments,
|
|
logger
|
|
}) {
|
|
this.rawArguments = rawArguments;
|
|
this.logger = logger;
|
|
this.stack = [];
|
|
const {
|
|
plugins,
|
|
pluginSearchDirs
|
|
} = parseArgvWithoutPlugins2(rawArguments, logger, ["plugin", "plugin-search-dir"]);
|
|
this.pushContextPlugins(plugins, pluginSearchDirs);
|
|
const argv = parseArgv(rawArguments, this.detailedOptions, logger);
|
|
this.argv = argv;
|
|
this.filePatterns = argv._.map(String);
|
|
}
|
|
pushContextPlugins(plugins, pluginSearchDirs) {
|
|
const options = getContextOptions(plugins, pluginSearchDirs);
|
|
this.stack.push(options);
|
|
Object.assign(this, options);
|
|
}
|
|
popContextPlugins() {
|
|
this.stack.pop();
|
|
Object.assign(this, getLast(this.stack));
|
|
}
|
|
get performanceTestFlag() {
|
|
const {
|
|
debugBenchmark,
|
|
debugRepeat
|
|
} = this.argv;
|
|
if (debugBenchmark) {
|
|
return {
|
|
name: "--debug-benchmark",
|
|
debugBenchmark: true
|
|
};
|
|
}
|
|
if (debugRepeat > 0) {
|
|
return {
|
|
name: "--debug-repeat",
|
|
debugRepeat
|
|
};
|
|
}
|
|
const {
|
|
PRETTIER_PERF_REPEAT
|
|
} = process.env;
|
|
if (PRETTIER_PERF_REPEAT && /^\d+$/.test(PRETTIER_PERF_REPEAT)) {
|
|
return {
|
|
name: "PRETTIER_PERF_REPEAT (environment variable)",
|
|
debugRepeat: Number(PRETTIER_PERF_REPEAT)
|
|
};
|
|
}
|
|
}
|
|
};
|
|
module2.exports = Context2;
|
|
}
|
|
});
|
|
var require_usage = __commonJS2({
|
|
"src/cli/usage.js"(exports2, module2) {
|
|
"use strict";
|
|
var camelCase = require_camelcase();
|
|
var constant = require_constant();
|
|
var {
|
|
groupBy
|
|
} = require_utils();
|
|
var OPTION_USAGE_THRESHOLD = 25;
|
|
var CHOICE_USAGE_MARGIN = 3;
|
|
var CHOICE_USAGE_INDENTATION = 2;
|
|
function indent(str, spaces) {
|
|
return str.replace(/^/gm, " ".repeat(spaces));
|
|
}
|
|
function createDefaultValueDisplay(value) {
|
|
return Array.isArray(value) ? `[${value.map(createDefaultValueDisplay).join(", ")}]` : value;
|
|
}
|
|
function getOptionDefaultValue(context, optionName) {
|
|
if (!(optionName in context.detailedOptionMap)) {
|
|
return;
|
|
}
|
|
const option = context.detailedOptionMap[optionName];
|
|
if (option.default !== void 0) {
|
|
return option.default;
|
|
}
|
|
const optionCamelName = camelCase(optionName);
|
|
if (optionCamelName in context.apiDefaultOptions) {
|
|
return context.apiDefaultOptions[optionCamelName];
|
|
}
|
|
}
|
|
function createOptionUsageHeader(option) {
|
|
const name = `--${option.name}`;
|
|
const alias = option.alias ? `-${option.alias},` : null;
|
|
const type = createOptionUsageType(option);
|
|
return [alias, name, type].filter(Boolean).join(" ");
|
|
}
|
|
function createOptionUsageRow(header, content, threshold) {
|
|
const separator = header.length >= threshold ? `
|
|
${" ".repeat(threshold)}` : " ".repeat(threshold - header.length);
|
|
const description = content.replace(/\n/g, `
|
|
${" ".repeat(threshold)}`);
|
|
return `${header}${separator}${description}`;
|
|
}
|
|
function createOptionUsageType(option) {
|
|
switch (option.type) {
|
|
case "boolean":
|
|
return null;
|
|
case "choice":
|
|
return `<${option.choices.filter((choice) => !choice.deprecated && choice.since !== null).map((choice) => choice.value).join("|")}>`;
|
|
default:
|
|
return `<${option.type}>`;
|
|
}
|
|
}
|
|
function createChoiceUsages(choices, margin, indentation) {
|
|
const activeChoices = choices.filter((choice) => !choice.deprecated && choice.since !== null);
|
|
const threshold = Math.max(0, ...activeChoices.map((choice) => choice.value.length)) + margin;
|
|
return activeChoices.map((choice) => indent(createOptionUsageRow(choice.value, choice.description, threshold), indentation));
|
|
}
|
|
function createOptionUsage(context, option, threshold) {
|
|
const header = createOptionUsageHeader(option);
|
|
const optionDefaultValue = getOptionDefaultValue(context, option.name);
|
|
return createOptionUsageRow(header, `${option.description}${optionDefaultValue === void 0 ? "" : `
|
|
Defaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`, threshold);
|
|
}
|
|
function getOptionsWithOpposites(options) {
|
|
const optionsWithOpposites = options.map((option) => [option.description ? option : null, option.oppositeDescription ? Object.assign(Object.assign({}, option), {}, {
|
|
name: `no-${option.name}`,
|
|
type: "boolean",
|
|
description: option.oppositeDescription
|
|
}) : null]);
|
|
return optionsWithOpposites.flat().filter(Boolean);
|
|
}
|
|
function createUsage2(context) {
|
|
const options = getOptionsWithOpposites(context.detailedOptions).filter((option) => !(option.type === "boolean" && option.oppositeDescription && !option.name.startsWith("no-")));
|
|
const groupedOptions = groupBy(options, (option) => option.category);
|
|
const firstCategories = constant.categoryOrder.slice(0, -1);
|
|
const lastCategories = constant.categoryOrder.slice(-1);
|
|
const restCategories = Object.keys(groupedOptions).filter((category) => !constant.categoryOrder.includes(category));
|
|
const allCategories = [...firstCategories, ...restCategories, ...lastCategories];
|
|
const optionsUsage = allCategories.map((category) => {
|
|
const categoryOptions = groupedOptions[category].map((option) => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)).join("\n");
|
|
return `${category} options:
|
|
|
|
${indent(categoryOptions, 2)}`;
|
|
});
|
|
return [constant.usageSummary, ...optionsUsage, ""].join("\n\n");
|
|
}
|
|
function createDetailedUsage2(context, flag) {
|
|
const option = getOptionsWithOpposites(context.detailedOptions).find((option2) => option2.name === flag || option2.alias === flag);
|
|
const header = createOptionUsageHeader(option);
|
|
const description = `
|
|
|
|
${indent(option.description, 2)}`;
|
|
const choices = option.type !== "choice" ? "" : `
|
|
|
|
Valid options:
|
|
|
|
${createChoiceUsages(option.choices, CHOICE_USAGE_MARGIN, CHOICE_USAGE_INDENTATION).join("\n")}`;
|
|
const optionDefaultValue = getOptionDefaultValue(context, option.name);
|
|
const defaults = optionDefaultValue !== void 0 ? `
|
|
|
|
Default: ${createDefaultValueDisplay(optionDefaultValue)}` : "";
|
|
const pluginDefaults = option.pluginDefaults && Object.keys(option.pluginDefaults).length > 0 ? `
|
|
Plugin defaults:${Object.entries(option.pluginDefaults).map(([key, value]) => `
|
|
* ${key}: ${createDefaultValueDisplay(value)}`)}` : "";
|
|
return `${header}${description}${choices}${defaults}${pluginDefaults}`;
|
|
}
|
|
module2.exports = {
|
|
createUsage: createUsage2,
|
|
createDetailedUsage: createDetailedUsage2
|
|
};
|
|
}
|
|
});
|
|
var require_array = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/array.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.splitWhen = exports2.flatten = void 0;
|
|
function flatten(items) {
|
|
return items.reduce((collection, item) => [].concat(collection, item), []);
|
|
}
|
|
exports2.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;
|
|
}
|
|
exports2.splitWhen = splitWhen;
|
|
}
|
|
});
|
|
var require_errno = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/errno.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.isEnoentCodeError = void 0;
|
|
function isEnoentCodeError(error) {
|
|
return error.code === "ENOENT";
|
|
}
|
|
exports2.isEnoentCodeError = isEnoentCodeError;
|
|
}
|
|
});
|
|
var require_fs = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/fs.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.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);
|
|
}
|
|
exports2.createDirentFromStats = createDirentFromStats;
|
|
}
|
|
});
|
|
var require_path = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/path.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.removeLeadingDotSegment = exports2.escape = exports2.makeAbsolute = exports2.unixify = void 0;
|
|
var path = require("path");
|
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
var UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
|
|
function unixify(filepath) {
|
|
return filepath.replace(/\\/g, "/");
|
|
}
|
|
exports2.unixify = unixify;
|
|
function makeAbsolute(cwd, filepath) {
|
|
return path.resolve(cwd, filepath);
|
|
}
|
|
exports2.makeAbsolute = makeAbsolute;
|
|
function escape(pattern) {
|
|
return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
|
}
|
|
exports2.escape = escape;
|
|
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;
|
|
}
|
|
exports2.removeLeadingDotSegment = removeLeadingDotSegment;
|
|
}
|
|
});
|
|
var require_is_extglob = __commonJS2({
|
|
"node_modules/is-extglob/index.js"(exports2, module2) {
|
|
module2.exports = function isExtglob(str) {
|
|
if (typeof str !== "string" || str === "") {
|
|
return false;
|
|
}
|
|
var match;
|
|
while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
|
|
if (match[2])
|
|
return true;
|
|
str = str.slice(match.index + match[0].length);
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
});
|
|
var require_is_glob = __commonJS2({
|
|
"node_modules/is-glob/index.js"(exports2, module2) {
|
|
var isExtglob = require_is_extglob();
|
|
var chars = {
|
|
"{": "}",
|
|
"(": ")",
|
|
"[": "]"
|
|
};
|
|
var strictCheck = function(str) {
|
|
if (str[0] === "!") {
|
|
return true;
|
|
}
|
|
var index = 0;
|
|
var pipeIndex = -2;
|
|
var closeSquareIndex = -2;
|
|
var closeCurlyIndex = -2;
|
|
var closeParenIndex = -2;
|
|
var backSlashIndex = -2;
|
|
while (index < str.length) {
|
|
if (str[index] === "*") {
|
|
return true;
|
|
}
|
|
if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) {
|
|
return true;
|
|
}
|
|
if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
|
|
if (closeSquareIndex < index) {
|
|
closeSquareIndex = str.indexOf("]", index);
|
|
}
|
|
if (closeSquareIndex > index) {
|
|
if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
|
|
return true;
|
|
}
|
|
backSlashIndex = str.indexOf("\\", index);
|
|
if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
|
|
closeCurlyIndex = str.indexOf("}", index);
|
|
if (closeCurlyIndex > index) {
|
|
backSlashIndex = str.indexOf("\\", index);
|
|
if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
|
|
closeParenIndex = str.indexOf(")", index);
|
|
if (closeParenIndex > index) {
|
|
backSlashIndex = str.indexOf("\\", index);
|
|
if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
|
|
if (pipeIndex < index) {
|
|
pipeIndex = str.indexOf("|", index);
|
|
}
|
|
if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
|
|
closeParenIndex = str.indexOf(")", pipeIndex);
|
|
if (closeParenIndex > pipeIndex) {
|
|
backSlashIndex = str.indexOf("\\", pipeIndex);
|
|
if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (str[index] === "\\") {
|
|
var open = str[index + 1];
|
|
index += 2;
|
|
var close = chars[open];
|
|
if (close) {
|
|
var n = str.indexOf(close, index);
|
|
if (n !== -1) {
|
|
index = n + 1;
|
|
}
|
|
}
|
|
if (str[index] === "!") {
|
|
return true;
|
|
}
|
|
} else {
|
|
index++;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
var relaxedCheck = function(str) {
|
|
if (str[0] === "!") {
|
|
return true;
|
|
}
|
|
var index = 0;
|
|
while (index < str.length) {
|
|
if (/[*?{}()[\]]/.test(str[index])) {
|
|
return true;
|
|
}
|
|
if (str[index] === "\\") {
|
|
var open = str[index + 1];
|
|
index += 2;
|
|
var close = chars[open];
|
|
if (close) {
|
|
var n = str.indexOf(close, index);
|
|
if (n !== -1) {
|
|
index = n + 1;
|
|
}
|
|
}
|
|
if (str[index] === "!") {
|
|
return true;
|
|
}
|
|
} else {
|
|
index++;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
module2.exports = function isGlob(str, options) {
|
|
if (typeof str !== "string" || str === "") {
|
|
return false;
|
|
}
|
|
if (isExtglob(str)) {
|
|
return true;
|
|
}
|
|
var check = strictCheck;
|
|
if (options && options.strict === false) {
|
|
check = relaxedCheck;
|
|
}
|
|
return check(str);
|
|
};
|
|
}
|
|
});
|
|
var require_glob_parent = __commonJS2({
|
|
"node_modules/glob-parent/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var isGlob = require_is_glob();
|
|
var pathPosixDirname = require("path").posix.dirname;
|
|
var isWin32 = require("os").platform() === "win32";
|
|
var slash = "/";
|
|
var backslash = /\\/g;
|
|
var enclosure = /[\{\[].*[\}\]]$/;
|
|
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
|
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
|
module2.exports = function globParent(str, opts) {
|
|
var options = Object.assign({
|
|
flipBackslashes: true
|
|
}, opts);
|
|
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
|
str = str.replace(backslash, slash);
|
|
}
|
|
if (enclosure.test(str)) {
|
|
str += slash;
|
|
}
|
|
str += "a";
|
|
do {
|
|
str = pathPosixDirname(str);
|
|
} while (isGlob(str) || globby.test(str));
|
|
return str.replace(escaped, "$1");
|
|
};
|
|
}
|
|
});
|
|
var require_utils2 = __commonJS2({
|
|
"node_modules/braces/lib/utils.js"(exports2) {
|
|
"use strict";
|
|
exports2.isInteger = (num) => {
|
|
if (typeof num === "number") {
|
|
return Number.isInteger(num);
|
|
}
|
|
if (typeof num === "string" && num.trim() !== "") {
|
|
return Number.isInteger(Number(num));
|
|
}
|
|
return false;
|
|
};
|
|
exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
|
|
exports2.exceedsLimit = (min, max, step = 1, limit) => {
|
|
if (limit === false)
|
|
return false;
|
|
if (!exports2.isInteger(min) || !exports2.isInteger(max))
|
|
return false;
|
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
};
|
|
exports2.escapeNode = (block, n = 0, type) => {
|
|
let node = block.nodes[n];
|
|
if (!node)
|
|
return;
|
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
if (node.escaped !== true) {
|
|
node.value = "\\" + node.value;
|
|
node.escaped = true;
|
|
}
|
|
}
|
|
};
|
|
exports2.encloseBrace = (node) => {
|
|
if (node.type !== "brace")
|
|
return false;
|
|
if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
|
node.invalid = true;
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
exports2.isInvalidBrace = (block) => {
|
|
if (block.type !== "brace")
|
|
return false;
|
|
if (block.invalid === true || block.dollar)
|
|
return true;
|
|
if (block.commas >> 0 + block.ranges >> 0 === 0) {
|
|
block.invalid = true;
|
|
return true;
|
|
}
|
|
if (block.open !== true || block.close !== true) {
|
|
block.invalid = true;
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
exports2.isOpenOrClose = (node) => {
|
|
if (node.type === "open" || node.type === "close") {
|
|
return true;
|
|
}
|
|
return node.open === true || node.close === true;
|
|
};
|
|
exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
|
|
if (node.type === "text")
|
|
acc.push(node.value);
|
|
if (node.type === "range")
|
|
node.type = "text";
|
|
return acc;
|
|
}, []);
|
|
exports2.flatten = (...args) => {
|
|
const result = [];
|
|
const flat = (arr) => {
|
|
for (let i = 0; i < arr.length; i++) {
|
|
let ele = arr[i];
|
|
Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
|
|
}
|
|
return result;
|
|
};
|
|
flat(args);
|
|
return result;
|
|
};
|
|
}
|
|
});
|
|
var require_stringify = __commonJS2({
|
|
"node_modules/braces/lib/stringify.js"(exports2, module2) {
|
|
"use strict";
|
|
var utils = require_utils2();
|
|
module2.exports = (ast, options = {}) => {
|
|
let stringify2 = (node, parent = {}) => {
|
|
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
let output = "";
|
|
if (node.value) {
|
|
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
|
return "\\" + node.value;
|
|
}
|
|
return node.value;
|
|
}
|
|
if (node.value) {
|
|
return node.value;
|
|
}
|
|
if (node.nodes) {
|
|
for (let child of node.nodes) {
|
|
output += stringify2(child);
|
|
}
|
|
}
|
|
return output;
|
|
};
|
|
return stringify2(ast);
|
|
};
|
|
}
|
|
});
|
|
var require_is_number = __commonJS2({
|
|
"node_modules/is-number/index.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = function(num) {
|
|
if (typeof num === "number") {
|
|
return num - num === 0;
|
|
}
|
|
if (typeof num === "string" && num.trim() !== "") {
|
|
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
});
|
|
var require_to_regex_range = __commonJS2({
|
|
"node_modules/to-regex-range/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var isNumber = require_is_number();
|
|
var toRegexRange = (min, max, options) => {
|
|
if (isNumber(min) === false) {
|
|
throw new TypeError("toRegexRange: expected the first argument to be a number");
|
|
}
|
|
if (max === void 0 || min === max) {
|
|
return String(min);
|
|
}
|
|
if (isNumber(max) === false) {
|
|
throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
|
}
|
|
let opts = Object.assign({
|
|
relaxZeros: true
|
|
}, options);
|
|
if (typeof opts.strictZeros === "boolean") {
|
|
opts.relaxZeros = opts.strictZeros === false;
|
|
}
|
|
let relax = String(opts.relaxZeros);
|
|
let shorthand = String(opts.shorthand);
|
|
let capture = String(opts.capture);
|
|
let wrap = String(opts.wrap);
|
|
let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
|
|
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
return toRegexRange.cache[cacheKey].result;
|
|
}
|
|
let a = Math.min(min, max);
|
|
let b = Math.max(min, max);
|
|
if (Math.abs(a - b) === 1) {
|
|
let result = min + "|" + max;
|
|
if (opts.capture) {
|
|
return `(${result})`;
|
|
}
|
|
if (opts.wrap === false) {
|
|
return result;
|
|
}
|
|
return `(?:${result})`;
|
|
}
|
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
let state = {
|
|
min,
|
|
max,
|
|
a,
|
|
b
|
|
};
|
|
let positives = [];
|
|
let negatives = [];
|
|
if (isPadded) {
|
|
state.isPadded = isPadded;
|
|
state.maxLen = String(state.max).length;
|
|
}
|
|
if (a < 0) {
|
|
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
a = state.a = 0;
|
|
}
|
|
if (b >= 0) {
|
|
positives = splitToPatterns(a, b, state, opts);
|
|
}
|
|
state.negatives = negatives;
|
|
state.positives = positives;
|
|
state.result = collatePatterns(negatives, positives, opts);
|
|
if (opts.capture === true) {
|
|
state.result = `(${state.result})`;
|
|
} else if (opts.wrap !== false && positives.length + negatives.length > 1) {
|
|
state.result = `(?:${state.result})`;
|
|
}
|
|
toRegexRange.cache[cacheKey] = state;
|
|
return state.result;
|
|
};
|
|
function collatePatterns(neg, pos, options) {
|
|
let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
|
|
let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
|
|
let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
|
|
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
return subpatterns.join("|");
|
|
}
|
|
function splitToRanges(min, max) {
|
|
let nines = 1;
|
|
let zeros = 1;
|
|
let stop = countNines(min, nines);
|
|
let stops = /* @__PURE__ */ new Set([max]);
|
|
while (min <= stop && stop <= max) {
|
|
stops.add(stop);
|
|
nines += 1;
|
|
stop = countNines(min, nines);
|
|
}
|
|
stop = countZeros(max + 1, zeros) - 1;
|
|
while (min < stop && stop <= max) {
|
|
stops.add(stop);
|
|
zeros += 1;
|
|
stop = countZeros(max + 1, zeros) - 1;
|
|
}
|
|
stops = [...stops];
|
|
stops.sort(compare);
|
|
return stops;
|
|
}
|
|
function rangeToPattern(start, stop, options) {
|
|
if (start === stop) {
|
|
return {
|
|
pattern: start,
|
|
count: [],
|
|
digits: 0
|
|
};
|
|
}
|
|
let zipped = zip(start, stop);
|
|
let digits = zipped.length;
|
|
let pattern = "";
|
|
let count = 0;
|
|
for (let i = 0; i < digits; i++) {
|
|
let [startDigit, stopDigit] = zipped[i];
|
|
if (startDigit === stopDigit) {
|
|
pattern += startDigit;
|
|
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
pattern += toCharacterClass(startDigit, stopDigit, options);
|
|
} else {
|
|
count++;
|
|
}
|
|
}
|
|
if (count) {
|
|
pattern += options.shorthand === true ? "\\d" : "[0-9]";
|
|
}
|
|
return {
|
|
pattern,
|
|
count: [count],
|
|
digits
|
|
};
|
|
}
|
|
function splitToPatterns(min, max, tok, options) {
|
|
let ranges = splitToRanges(min, max);
|
|
let tokens = [];
|
|
let start = min;
|
|
let prev;
|
|
for (let i = 0; i < ranges.length; i++) {
|
|
let max2 = ranges[i];
|
|
let obj = rangeToPattern(String(start), String(max2), options);
|
|
let zeros = "";
|
|
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
if (prev.count.length > 1) {
|
|
prev.count.pop();
|
|
}
|
|
prev.count.push(obj.count[0]);
|
|
prev.string = prev.pattern + toQuantifier(prev.count);
|
|
start = max2 + 1;
|
|
continue;
|
|
}
|
|
if (tok.isPadded) {
|
|
zeros = padZeros(max2, tok, options);
|
|
}
|
|
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
|
tokens.push(obj);
|
|
start = max2 + 1;
|
|
prev = obj;
|
|
}
|
|
return tokens;
|
|
}
|
|
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
|
let result = [];
|
|
for (let ele of arr) {
|
|
let {
|
|
string
|
|
} = ele;
|
|
if (!intersection && !contains(comparison, "string", string)) {
|
|
result.push(prefix + string);
|
|
}
|
|
if (intersection && contains(comparison, "string", string)) {
|
|
result.push(prefix + string);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function zip(a, b) {
|
|
let arr = [];
|
|
for (let i = 0; i < a.length; i++)
|
|
arr.push([a[i], b[i]]);
|
|
return arr;
|
|
}
|
|
function compare(a, b) {
|
|
return a > b ? 1 : b > a ? -1 : 0;
|
|
}
|
|
function contains(arr, key, val) {
|
|
return arr.some((ele) => ele[key] === val);
|
|
}
|
|
function countNines(min, len) {
|
|
return Number(String(min).slice(0, -len) + "9".repeat(len));
|
|
}
|
|
function countZeros(integer, zeros) {
|
|
return integer - integer % Math.pow(10, zeros);
|
|
}
|
|
function toQuantifier(digits) {
|
|
let [start = 0, stop = ""] = digits;
|
|
if (stop || start > 1) {
|
|
return `{${start + (stop ? "," + stop : "")}}`;
|
|
}
|
|
return "";
|
|
}
|
|
function toCharacterClass(a, b, options) {
|
|
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
|
}
|
|
function hasPadding(str) {
|
|
return /^-?(0+)\d/.test(str);
|
|
}
|
|
function padZeros(value, tok, options) {
|
|
if (!tok.isPadded) {
|
|
return value;
|
|
}
|
|
let diff = Math.abs(tok.maxLen - String(value).length);
|
|
let relax = options.relaxZeros !== false;
|
|
switch (diff) {
|
|
case 0:
|
|
return "";
|
|
case 1:
|
|
return relax ? "0?" : "0";
|
|
case 2:
|
|
return relax ? "0{0,2}" : "00";
|
|
default: {
|
|
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
|
}
|
|
}
|
|
}
|
|
toRegexRange.cache = {};
|
|
toRegexRange.clearCache = () => toRegexRange.cache = {};
|
|
module2.exports = toRegexRange;
|
|
}
|
|
});
|
|
var require_fill_range = __commonJS2({
|
|
"node_modules/fill-range/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var util = require("util");
|
|
var toRegexRange = require_to_regex_range();
|
|
var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
var transform = (toNumber) => {
|
|
return (value) => toNumber === true ? Number(value) : String(value);
|
|
};
|
|
var isValidValue = (value) => {
|
|
return typeof value === "number" || typeof value === "string" && value !== "";
|
|
};
|
|
var isNumber = (num) => Number.isInteger(+num);
|
|
var zeros = (input) => {
|
|
let value = `${input}`;
|
|
let index = -1;
|
|
if (value[0] === "-")
|
|
value = value.slice(1);
|
|
if (value === "0")
|
|
return false;
|
|
while (value[++index] === "0")
|
|
;
|
|
return index > 0;
|
|
};
|
|
var stringify2 = (start, end, options) => {
|
|
if (typeof start === "string" || typeof end === "string") {
|
|
return true;
|
|
}
|
|
return options.stringify === true;
|
|
};
|
|
var pad = (input, maxLength, toNumber) => {
|
|
if (maxLength > 0) {
|
|
let dash = input[0] === "-" ? "-" : "";
|
|
if (dash)
|
|
input = input.slice(1);
|
|
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
|
}
|
|
if (toNumber === false) {
|
|
return String(input);
|
|
}
|
|
return input;
|
|
};
|
|
var toMaxLen = (input, maxLength) => {
|
|
let negative = input[0] === "-" ? "-" : "";
|
|
if (negative) {
|
|
input = input.slice(1);
|
|
maxLength--;
|
|
}
|
|
while (input.length < maxLength)
|
|
input = "0" + input;
|
|
return negative ? "-" + input : input;
|
|
};
|
|
var toSequence = (parts, options) => {
|
|
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
let prefix = options.capture ? "" : "?:";
|
|
let positives = "";
|
|
let negatives = "";
|
|
let result;
|
|
if (parts.positives.length) {
|
|
positives = parts.positives.join("|");
|
|
}
|
|
if (parts.negatives.length) {
|
|
negatives = `-(${prefix}${parts.negatives.join("|")})`;
|
|
}
|
|
if (positives && negatives) {
|
|
result = `${positives}|${negatives}`;
|
|
} else {
|
|
result = positives || negatives;
|
|
}
|
|
if (options.wrap) {
|
|
return `(${prefix}${result})`;
|
|
}
|
|
return result;
|
|
};
|
|
var toRange = (a, b, isNumbers, options) => {
|
|
if (isNumbers) {
|
|
return toRegexRange(a, b, Object.assign({
|
|
wrap: false
|
|
}, options));
|
|
}
|
|
let start = String.fromCharCode(a);
|
|
if (a === b)
|
|
return start;
|
|
let stop = String.fromCharCode(b);
|
|
return `[${start}-${stop}]`;
|
|
};
|
|
var toRegex = (start, end, options) => {
|
|
if (Array.isArray(start)) {
|
|
let wrap = options.wrap === true;
|
|
let prefix = options.capture ? "" : "?:";
|
|
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
|
}
|
|
return toRegexRange(start, end, options);
|
|
};
|
|
var rangeError = (...args) => {
|
|
return new RangeError("Invalid range arguments: " + util.inspect(...args));
|
|
};
|
|
var invalidRange = (start, end, options) => {
|
|
if (options.strictRanges === true)
|
|
throw rangeError([start, end]);
|
|
return [];
|
|
};
|
|
var invalidStep = (step, options) => {
|
|
if (options.strictRanges === true) {
|
|
throw new TypeError(`Expected step "${step}" to be a number`);
|
|
}
|
|
return [];
|
|
};
|
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
let a = Number(start);
|
|
let b = Number(end);
|
|
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
if (options.strictRanges === true)
|
|
throw rangeError([start, end]);
|
|
return [];
|
|
}
|
|
if (a === 0)
|
|
a = 0;
|
|
if (b === 0)
|
|
b = 0;
|
|
let descending = a > b;
|
|
let startString = String(start);
|
|
let endString = String(end);
|
|
let stepString = String(step);
|
|
step = Math.max(Math.abs(step), 1);
|
|
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
let toNumber = padded === false && stringify2(start, end, options) === false;
|
|
let format = options.transform || transform(toNumber);
|
|
if (options.toRegex && step === 1) {
|
|
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
|
}
|
|
let parts = {
|
|
negatives: [],
|
|
positives: []
|
|
};
|
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
let range = [];
|
|
let index = 0;
|
|
while (descending ? a >= b : a <= b) {
|
|
if (options.toRegex === true && step > 1) {
|
|
push(a);
|
|
} else {
|
|
range.push(pad(format(a, index), maxLen, toNumber));
|
|
}
|
|
a = descending ? a - step : a + step;
|
|
index++;
|
|
}
|
|
if (options.toRegex === true) {
|
|
return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
|
|
wrap: false
|
|
}, options));
|
|
}
|
|
return range;
|
|
};
|
|
var fillLetters = (start, end, step = 1, options = {}) => {
|
|
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
|
|
return invalidRange(start, end, options);
|
|
}
|
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
let a = `${start}`.charCodeAt(0);
|
|
let b = `${end}`.charCodeAt(0);
|
|
let descending = a > b;
|
|
let min = Math.min(a, b);
|
|
let max = Math.max(a, b);
|
|
if (options.toRegex && step === 1) {
|
|
return toRange(min, max, false, options);
|
|
}
|
|
let range = [];
|
|
let index = 0;
|
|
while (descending ? a >= b : a <= b) {
|
|
range.push(format(a, index));
|
|
a = descending ? a - step : a + step;
|
|
index++;
|
|
}
|
|
if (options.toRegex === true) {
|
|
return toRegex(range, null, {
|
|
wrap: false,
|
|
options
|
|
});
|
|
}
|
|
return range;
|
|
};
|
|
var fill = (start, end, step, options = {}) => {
|
|
if (end == null && isValidValue(start)) {
|
|
return [start];
|
|
}
|
|
if (!isValidValue(start) || !isValidValue(end)) {
|
|
return invalidRange(start, end, options);
|
|
}
|
|
if (typeof step === "function") {
|
|
return fill(start, end, 1, {
|
|
transform: step
|
|
});
|
|
}
|
|
if (isObject(step)) {
|
|
return fill(start, end, 0, step);
|
|
}
|
|
let opts = Object.assign({}, options);
|
|
if (opts.capture === true)
|
|
opts.wrap = true;
|
|
step = step || opts.step || 1;
|
|
if (!isNumber(step)) {
|
|
if (step != null && !isObject(step))
|
|
return invalidStep(step, opts);
|
|
return fill(start, end, 1, step);
|
|
}
|
|
if (isNumber(start) && isNumber(end)) {
|
|
return fillNumbers(start, end, step, opts);
|
|
}
|
|
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
|
};
|
|
module2.exports = fill;
|
|
}
|
|
});
|
|
var require_compile = __commonJS2({
|
|
"node_modules/braces/lib/compile.js"(exports2, module2) {
|
|
"use strict";
|
|
var fill = require_fill_range();
|
|
var utils = require_utils2();
|
|
var compile = (ast, options = {}) => {
|
|
let walk = (node, parent = {}) => {
|
|
let invalidBlock = utils.isInvalidBrace(parent);
|
|
let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
let invalid = invalidBlock === true || invalidNode === true;
|
|
let prefix = options.escapeInvalid === true ? "\\" : "";
|
|
let output = "";
|
|
if (node.isOpen === true) {
|
|
return prefix + node.value;
|
|
}
|
|
if (node.isClose === true) {
|
|
return prefix + node.value;
|
|
}
|
|
if (node.type === "open") {
|
|
return invalid ? prefix + node.value : "(";
|
|
}
|
|
if (node.type === "close") {
|
|
return invalid ? prefix + node.value : ")";
|
|
}
|
|
if (node.type === "comma") {
|
|
return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
|
}
|
|
if (node.value) {
|
|
return node.value;
|
|
}
|
|
if (node.nodes && node.ranges > 0) {
|
|
let args = utils.reduce(node.nodes);
|
|
let range = fill(...args, Object.assign(Object.assign({}, options), {}, {
|
|
wrap: false,
|
|
toRegex: true
|
|
}));
|
|
if (range.length !== 0) {
|
|
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
}
|
|
}
|
|
if (node.nodes) {
|
|
for (let child of node.nodes) {
|
|
output += walk(child, node);
|
|
}
|
|
}
|
|
return output;
|
|
};
|
|
return walk(ast);
|
|
};
|
|
module2.exports = compile;
|
|
}
|
|
});
|
|
var require_expand = __commonJS2({
|
|
"node_modules/braces/lib/expand.js"(exports2, module2) {
|
|
"use strict";
|
|
var fill = require_fill_range();
|
|
var stringify2 = require_stringify();
|
|
var utils = require_utils2();
|
|
var append = (queue = "", stash = "", enclose = false) => {
|
|
let result = [];
|
|
queue = [].concat(queue);
|
|
stash = [].concat(stash);
|
|
if (!stash.length)
|
|
return queue;
|
|
if (!queue.length) {
|
|
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
|
}
|
|
for (let item of queue) {
|
|
if (Array.isArray(item)) {
|
|
for (let value of item) {
|
|
result.push(append(value, stash, enclose));
|
|
}
|
|
} else {
|
|
for (let ele of stash) {
|
|
if (enclose === true && typeof ele === "string")
|
|
ele = `{${ele}}`;
|
|
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
}
|
|
}
|
|
}
|
|
return utils.flatten(result);
|
|
};
|
|
var expand = (ast, options = {}) => {
|
|
let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
let walk = (node, parent = {}) => {
|
|
node.queue = [];
|
|
let p = parent;
|
|
let q = parent.queue;
|
|
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
p = p.parent;
|
|
q = p.queue;
|
|
}
|
|
if (node.invalid || node.dollar) {
|
|
q.push(append(q.pop(), stringify2(node, options)));
|
|
return;
|
|
}
|
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
q.push(append(q.pop(), ["{}"]));
|
|
return;
|
|
}
|
|
if (node.nodes && node.ranges > 0) {
|
|
let args = utils.reduce(node.nodes);
|
|
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
|
}
|
|
let range = fill(...args, options);
|
|
if (range.length === 0) {
|
|
range = stringify2(node, options);
|
|
}
|
|
q.push(append(q.pop(), range));
|
|
node.nodes = [];
|
|
return;
|
|
}
|
|
let enclose = utils.encloseBrace(node);
|
|
let queue = node.queue;
|
|
let block = node;
|
|
while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
|
block = block.parent;
|
|
queue = block.queue;
|
|
}
|
|
for (let i = 0; i < node.nodes.length; i++) {
|
|
let child = node.nodes[i];
|
|
if (child.type === "comma" && node.type === "brace") {
|
|
if (i === 1)
|
|
queue.push("");
|
|
queue.push("");
|
|
continue;
|
|
}
|
|
if (child.type === "close") {
|
|
q.push(append(q.pop(), queue, enclose));
|
|
continue;
|
|
}
|
|
if (child.value && child.type !== "open") {
|
|
queue.push(append(queue.pop(), child.value));
|
|
continue;
|
|
}
|
|
if (child.nodes) {
|
|
walk(child, node);
|
|
}
|
|
}
|
|
return queue;
|
|
};
|
|
return utils.flatten(walk(ast));
|
|
};
|
|
module2.exports = expand;
|
|
}
|
|
});
|
|
var require_constants = __commonJS2({
|
|
"node_modules/braces/lib/constants.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = {
|
|
MAX_LENGTH: 1024 * 64,
|
|
CHAR_0: "0",
|
|
CHAR_9: "9",
|
|
CHAR_UPPERCASE_A: "A",
|
|
CHAR_LOWERCASE_A: "a",
|
|
CHAR_UPPERCASE_Z: "Z",
|
|
CHAR_LOWERCASE_Z: "z",
|
|
CHAR_LEFT_PARENTHESES: "(",
|
|
CHAR_RIGHT_PARENTHESES: ")",
|
|
CHAR_ASTERISK: "*",
|
|
CHAR_AMPERSAND: "&",
|
|
CHAR_AT: "@",
|
|
CHAR_BACKSLASH: "\\",
|
|
CHAR_BACKTICK: "`",
|
|
CHAR_CARRIAGE_RETURN: "\r",
|
|
CHAR_CIRCUMFLEX_ACCENT: "^",
|
|
CHAR_COLON: ":",
|
|
CHAR_COMMA: ",",
|
|
CHAR_DOLLAR: "$",
|
|
CHAR_DOT: ".",
|
|
CHAR_DOUBLE_QUOTE: '"',
|
|
CHAR_EQUAL: "=",
|
|
CHAR_EXCLAMATION_MARK: "!",
|
|
CHAR_FORM_FEED: "\f",
|
|
CHAR_FORWARD_SLASH: "/",
|
|
CHAR_HASH: "#",
|
|
CHAR_HYPHEN_MINUS: "-",
|
|
CHAR_LEFT_ANGLE_BRACKET: "<",
|
|
CHAR_LEFT_CURLY_BRACE: "{",
|
|
CHAR_LEFT_SQUARE_BRACKET: "[",
|
|
CHAR_LINE_FEED: "\n",
|
|
CHAR_NO_BREAK_SPACE: "\xA0",
|
|
CHAR_PERCENT: "%",
|
|
CHAR_PLUS: "+",
|
|
CHAR_QUESTION_MARK: "?",
|
|
CHAR_RIGHT_ANGLE_BRACKET: ">",
|
|
CHAR_RIGHT_CURLY_BRACE: "}",
|
|
CHAR_RIGHT_SQUARE_BRACKET: "]",
|
|
CHAR_SEMICOLON: ";",
|
|
CHAR_SINGLE_QUOTE: "'",
|
|
CHAR_SPACE: " ",
|
|
CHAR_TAB: " ",
|
|
CHAR_UNDERSCORE: "_",
|
|
CHAR_VERTICAL_LINE: "|",
|
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
|
};
|
|
}
|
|
});
|
|
var require_parse = __commonJS2({
|
|
"node_modules/braces/lib/parse.js"(exports2, module2) {
|
|
"use strict";
|
|
var stringify2 = require_stringify();
|
|
var {
|
|
MAX_LENGTH,
|
|
CHAR_BACKSLASH,
|
|
CHAR_BACKTICK,
|
|
CHAR_COMMA,
|
|
CHAR_DOT,
|
|
CHAR_LEFT_PARENTHESES,
|
|
CHAR_RIGHT_PARENTHESES,
|
|
CHAR_LEFT_CURLY_BRACE,
|
|
CHAR_RIGHT_CURLY_BRACE,
|
|
CHAR_LEFT_SQUARE_BRACKET,
|
|
CHAR_RIGHT_SQUARE_BRACKET,
|
|
CHAR_DOUBLE_QUOTE,
|
|
CHAR_SINGLE_QUOTE,
|
|
CHAR_NO_BREAK_SPACE,
|
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
} = require_constants();
|
|
var parse = (input, options = {}) => {
|
|
if (typeof input !== "string") {
|
|
throw new TypeError("Expected a string");
|
|
}
|
|
let opts = options || {};
|
|
let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
if (input.length > max) {
|
|
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
}
|
|
let ast = {
|
|
type: "root",
|
|
input,
|
|
nodes: []
|
|
};
|
|
let stack = [ast];
|
|
let block = ast;
|
|
let prev = ast;
|
|
let brackets = 0;
|
|
let length = input.length;
|
|
let index = 0;
|
|
let depth = 0;
|
|
let value;
|
|
let memo = {};
|
|
const advance = () => input[index++];
|
|
const push = (node) => {
|
|
if (node.type === "text" && prev.type === "dot") {
|
|
prev.type = "text";
|
|
}
|
|
if (prev && prev.type === "text" && node.type === "text") {
|
|
prev.value += node.value;
|
|
return;
|
|
}
|
|
block.nodes.push(node);
|
|
node.parent = block;
|
|
node.prev = prev;
|
|
prev = node;
|
|
return node;
|
|
};
|
|
push({
|
|
type: "bos"
|
|
});
|
|
while (index < length) {
|
|
block = stack[stack.length - 1];
|
|
value = advance();
|
|
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
continue;
|
|
}
|
|
if (value === CHAR_BACKSLASH) {
|
|
push({
|
|
type: "text",
|
|
value: (options.keepEscaping ? value : "") + advance()
|
|
});
|
|
continue;
|
|
}
|
|
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
push({
|
|
type: "text",
|
|
value: "\\" + value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
brackets++;
|
|
let closed = true;
|
|
let next;
|
|
while (index < length && (next = advance())) {
|
|
value += next;
|
|
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
|
brackets++;
|
|
continue;
|
|
}
|
|
if (next === CHAR_BACKSLASH) {
|
|
value += advance();
|
|
continue;
|
|
}
|
|
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
brackets--;
|
|
if (brackets === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === CHAR_LEFT_PARENTHESES) {
|
|
block = push({
|
|
type: "paren",
|
|
nodes: []
|
|
});
|
|
stack.push(block);
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
if (block.type !== "paren") {
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
block = stack.pop();
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
block = stack[stack.length - 1];
|
|
continue;
|
|
}
|
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
let open = value;
|
|
let next;
|
|
if (options.keepQuotes !== true) {
|
|
value = "";
|
|
}
|
|
while (index < length && (next = advance())) {
|
|
if (next === CHAR_BACKSLASH) {
|
|
value += next + advance();
|
|
continue;
|
|
}
|
|
if (next === open) {
|
|
if (options.keepQuotes === true)
|
|
value += next;
|
|
break;
|
|
}
|
|
value += next;
|
|
}
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
depth++;
|
|
let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
|
let brace = {
|
|
type: "brace",
|
|
open: true,
|
|
close: false,
|
|
dollar,
|
|
depth,
|
|
commas: 0,
|
|
ranges: 0,
|
|
nodes: []
|
|
};
|
|
block = push(brace);
|
|
stack.push(block);
|
|
push({
|
|
type: "open",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
if (block.type !== "brace") {
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
let type = "close";
|
|
block = stack.pop();
|
|
block.close = true;
|
|
push({
|
|
type,
|
|
value
|
|
});
|
|
depth--;
|
|
block = stack[stack.length - 1];
|
|
continue;
|
|
}
|
|
if (value === CHAR_COMMA && depth > 0) {
|
|
if (block.ranges > 0) {
|
|
block.ranges = 0;
|
|
let open = block.nodes.shift();
|
|
block.nodes = [open, {
|
|
type: "text",
|
|
value: stringify2(block)
|
|
}];
|
|
}
|
|
push({
|
|
type: "comma",
|
|
value
|
|
});
|
|
block.commas++;
|
|
continue;
|
|
}
|
|
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
|
let siblings = block.nodes;
|
|
if (depth === 0 || siblings.length === 0) {
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (prev.type === "dot") {
|
|
block.range = [];
|
|
prev.value += value;
|
|
prev.type = "range";
|
|
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
|
block.invalid = true;
|
|
block.ranges = 0;
|
|
prev.type = "text";
|
|
continue;
|
|
}
|
|
block.ranges++;
|
|
block.args = [];
|
|
continue;
|
|
}
|
|
if (prev.type === "range") {
|
|
siblings.pop();
|
|
let before = siblings[siblings.length - 1];
|
|
before.value += prev.value + value;
|
|
prev = before;
|
|
block.ranges--;
|
|
continue;
|
|
}
|
|
push({
|
|
type: "dot",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
}
|
|
do {
|
|
block = stack.pop();
|
|
if (block.type !== "root") {
|
|
block.nodes.forEach((node) => {
|
|
if (!node.nodes) {
|
|
if (node.type === "open")
|
|
node.isOpen = true;
|
|
if (node.type === "close")
|
|
node.isClose = true;
|
|
if (!node.nodes)
|
|
node.type = "text";
|
|
node.invalid = true;
|
|
}
|
|
});
|
|
let parent = stack[stack.length - 1];
|
|
let index2 = parent.nodes.indexOf(block);
|
|
parent.nodes.splice(index2, 1, ...block.nodes);
|
|
}
|
|
} while (stack.length > 0);
|
|
push({
|
|
type: "eos"
|
|
});
|
|
return ast;
|
|
};
|
|
module2.exports = parse;
|
|
}
|
|
});
|
|
var require_braces = __commonJS2({
|
|
"node_modules/braces/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var stringify2 = require_stringify();
|
|
var compile = require_compile();
|
|
var expand = require_expand();
|
|
var parse = require_parse();
|
|
var braces = (input, options = {}) => {
|
|
let output = [];
|
|
if (Array.isArray(input)) {
|
|
for (let pattern of input) {
|
|
let result = braces.create(pattern, options);
|
|
if (Array.isArray(result)) {
|
|
output.push(...result);
|
|
} else {
|
|
output.push(result);
|
|
}
|
|
}
|
|
} else {
|
|
output = [].concat(braces.create(input, options));
|
|
}
|
|
if (options && options.expand === true && options.nodupes === true) {
|
|
output = [...new Set(output)];
|
|
}
|
|
return output;
|
|
};
|
|
braces.parse = (input, options = {}) => parse(input, options);
|
|
braces.stringify = (input, options = {}) => {
|
|
if (typeof input === "string") {
|
|
return stringify2(braces.parse(input, options), options);
|
|
}
|
|
return stringify2(input, options);
|
|
};
|
|
braces.compile = (input, options = {}) => {
|
|
if (typeof input === "string") {
|
|
input = braces.parse(input, options);
|
|
}
|
|
return compile(input, options);
|
|
};
|
|
braces.expand = (input, options = {}) => {
|
|
if (typeof input === "string") {
|
|
input = braces.parse(input, options);
|
|
}
|
|
let result = expand(input, options);
|
|
if (options.noempty === true) {
|
|
result = result.filter(Boolean);
|
|
}
|
|
if (options.nodupes === true) {
|
|
result = [...new Set(result)];
|
|
}
|
|
return result;
|
|
};
|
|
braces.create = (input, options = {}) => {
|
|
if (input === "" || input.length < 3) {
|
|
return [input];
|
|
}
|
|
return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
|
|
};
|
|
module2.exports = braces;
|
|
}
|
|
});
|
|
var require_constants2 = __commonJS2({
|
|
"node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var WIN_SLASH = "\\\\/";
|
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
var DOT_LITERAL = "\\.";
|
|
var PLUS_LITERAL = "\\+";
|
|
var QMARK_LITERAL = "\\?";
|
|
var SLASH_LITERAL = "\\/";
|
|
var ONE_CHAR = "(?=.)";
|
|
var QMARK = "[^/]";
|
|
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
var STAR = `${QMARK}*?`;
|
|
var POSIX_CHARS = {
|
|
DOT_LITERAL,
|
|
PLUS_LITERAL,
|
|
QMARK_LITERAL,
|
|
SLASH_LITERAL,
|
|
ONE_CHAR,
|
|
QMARK,
|
|
END_ANCHOR,
|
|
DOTS_SLASH,
|
|
NO_DOT,
|
|
NO_DOTS,
|
|
NO_DOT_SLASH,
|
|
NO_DOTS_SLASH,
|
|
QMARK_NO_DOT,
|
|
STAR,
|
|
START_ANCHOR
|
|
};
|
|
var WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
|
|
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
QMARK: WIN_NO_SLASH,
|
|
STAR: `${WIN_NO_SLASH}*?`,
|
|
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
});
|
|
var POSIX_REGEX_SOURCE = {
|
|
alnum: "a-zA-Z0-9",
|
|
alpha: "a-zA-Z",
|
|
ascii: "\\x00-\\x7F",
|
|
blank: " \\t",
|
|
cntrl: "\\x00-\\x1F\\x7F",
|
|
digit: "0-9",
|
|
graph: "\\x21-\\x7E",
|
|
lower: "a-z",
|
|
print: "\\x20-\\x7E ",
|
|
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
space: " \\t\\r\\n\\v\\f",
|
|
upper: "A-Z",
|
|
word: "A-Za-z0-9_",
|
|
xdigit: "A-Fa-f0-9"
|
|
};
|
|
module2.exports = {
|
|
MAX_LENGTH: 1024 * 64,
|
|
POSIX_REGEX_SOURCE,
|
|
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
REPLACEMENTS: {
|
|
"***": "*",
|
|
"**/**": "**",
|
|
"**/**/**": "**"
|
|
},
|
|
CHAR_0: 48,
|
|
CHAR_9: 57,
|
|
CHAR_UPPERCASE_A: 65,
|
|
CHAR_LOWERCASE_A: 97,
|
|
CHAR_UPPERCASE_Z: 90,
|
|
CHAR_LOWERCASE_Z: 122,
|
|
CHAR_LEFT_PARENTHESES: 40,
|
|
CHAR_RIGHT_PARENTHESES: 41,
|
|
CHAR_ASTERISK: 42,
|
|
CHAR_AMPERSAND: 38,
|
|
CHAR_AT: 64,
|
|
CHAR_BACKWARD_SLASH: 92,
|
|
CHAR_CARRIAGE_RETURN: 13,
|
|
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
CHAR_COLON: 58,
|
|
CHAR_COMMA: 44,
|
|
CHAR_DOT: 46,
|
|
CHAR_DOUBLE_QUOTE: 34,
|
|
CHAR_EQUAL: 61,
|
|
CHAR_EXCLAMATION_MARK: 33,
|
|
CHAR_FORM_FEED: 12,
|
|
CHAR_FORWARD_SLASH: 47,
|
|
CHAR_GRAVE_ACCENT: 96,
|
|
CHAR_HASH: 35,
|
|
CHAR_HYPHEN_MINUS: 45,
|
|
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
CHAR_LEFT_CURLY_BRACE: 123,
|
|
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
CHAR_LINE_FEED: 10,
|
|
CHAR_NO_BREAK_SPACE: 160,
|
|
CHAR_PERCENT: 37,
|
|
CHAR_PLUS: 43,
|
|
CHAR_QUESTION_MARK: 63,
|
|
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
CHAR_SEMICOLON: 59,
|
|
CHAR_SINGLE_QUOTE: 39,
|
|
CHAR_SPACE: 32,
|
|
CHAR_TAB: 9,
|
|
CHAR_UNDERSCORE: 95,
|
|
CHAR_VERTICAL_LINE: 124,
|
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
SEP: path.sep,
|
|
extglobChars(chars) {
|
|
return {
|
|
"!": {
|
|
type: "negate",
|
|
open: "(?:(?!(?:",
|
|
close: `))${chars.STAR})`
|
|
},
|
|
"?": {
|
|
type: "qmark",
|
|
open: "(?:",
|
|
close: ")?"
|
|
},
|
|
"+": {
|
|
type: "plus",
|
|
open: "(?:",
|
|
close: ")+"
|
|
},
|
|
"*": {
|
|
type: "star",
|
|
open: "(?:",
|
|
close: ")*"
|
|
},
|
|
"@": {
|
|
type: "at",
|
|
open: "(?:",
|
|
close: ")"
|
|
}
|
|
};
|
|
},
|
|
globChars(win32) {
|
|
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_utils3 = __commonJS2({
|
|
"node_modules/picomatch/lib/utils.js"(exports2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var win32 = process.platform === "win32";
|
|
var {
|
|
REGEX_BACKSLASH,
|
|
REGEX_REMOVE_BACKSLASH,
|
|
REGEX_SPECIAL_CHARS,
|
|
REGEX_SPECIAL_CHARS_GLOBAL
|
|
} = require_constants2();
|
|
exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
|
|
exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
exports2.removeBackslashes = (str) => {
|
|
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
return match === "\\" ? "" : match;
|
|
});
|
|
};
|
|
exports2.supportsLookbehinds = () => {
|
|
const segs = process.version.slice(1).split(".").map(Number);
|
|
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
exports2.isWindows = (options) => {
|
|
if (options && typeof options.windows === "boolean") {
|
|
return options.windows;
|
|
}
|
|
return win32 === true || path.sep === "\\";
|
|
};
|
|
exports2.escapeLast = (input, char, lastIdx) => {
|
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
if (idx === -1)
|
|
return input;
|
|
if (input[idx - 1] === "\\")
|
|
return exports2.escapeLast(input, char, idx - 1);
|
|
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
};
|
|
exports2.removePrefix = (input, state = {}) => {
|
|
let output = input;
|
|
if (output.startsWith("./")) {
|
|
output = output.slice(2);
|
|
state.prefix = "./";
|
|
}
|
|
return output;
|
|
};
|
|
exports2.wrapOutput = (input, state = {}, options = {}) => {
|
|
const prepend = options.contains ? "" : "^";
|
|
const append = options.contains ? "" : "$";
|
|
let output = `${prepend}(?:${input})${append}`;
|
|
if (state.negated === true) {
|
|
output = `(?:^(?!${output}).*$)`;
|
|
}
|
|
return output;
|
|
};
|
|
}
|
|
});
|
|
var require_scan = __commonJS2({
|
|
"node_modules/picomatch/lib/scan.js"(exports2, module2) {
|
|
"use strict";
|
|
var utils = require_utils3();
|
|
var {
|
|
CHAR_ASTERISK,
|
|
CHAR_AT,
|
|
CHAR_BACKWARD_SLASH,
|
|
CHAR_COMMA,
|
|
CHAR_DOT,
|
|
CHAR_EXCLAMATION_MARK,
|
|
CHAR_FORWARD_SLASH,
|
|
CHAR_LEFT_CURLY_BRACE,
|
|
CHAR_LEFT_PARENTHESES,
|
|
CHAR_LEFT_SQUARE_BRACKET,
|
|
CHAR_PLUS,
|
|
CHAR_QUESTION_MARK,
|
|
CHAR_RIGHT_CURLY_BRACE,
|
|
CHAR_RIGHT_PARENTHESES,
|
|
CHAR_RIGHT_SQUARE_BRACKET
|
|
} = require_constants2();
|
|
var isPathSeparator = (code) => {
|
|
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
};
|
|
var depth = (token) => {
|
|
if (token.isPrefix !== true) {
|
|
token.depth = token.isGlobstar ? Infinity : 1;
|
|
}
|
|
};
|
|
var scan = (input, options) => {
|
|
const opts = options || {};
|
|
const length = input.length - 1;
|
|
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
const slashes = [];
|
|
const tokens = [];
|
|
const parts = [];
|
|
let str = input;
|
|
let index = -1;
|
|
let start = 0;
|
|
let lastIndex = 0;
|
|
let isBrace = false;
|
|
let isBracket = false;
|
|
let isGlob = false;
|
|
let isExtglob = false;
|
|
let isGlobstar = false;
|
|
let braceEscaped = false;
|
|
let backslashes = false;
|
|
let negated = false;
|
|
let negatedExtglob = false;
|
|
let finished = false;
|
|
let braces = 0;
|
|
let prev;
|
|
let code;
|
|
let token = {
|
|
value: "",
|
|
depth: 0,
|
|
isGlob: false
|
|
};
|
|
const eos = () => index >= length;
|
|
const peek = () => str.charCodeAt(index + 1);
|
|
const advance = () => {
|
|
prev = code;
|
|
return str.charCodeAt(++index);
|
|
};
|
|
while (index < length) {
|
|
code = advance();
|
|
let next;
|
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
backslashes = token.backslashes = true;
|
|
code = advance();
|
|
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
braceEscaped = true;
|
|
}
|
|
continue;
|
|
}
|
|
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
braces++;
|
|
while (eos() !== true && (code = advance())) {
|
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
backslashes = token.backslashes = true;
|
|
advance();
|
|
continue;
|
|
}
|
|
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
braces++;
|
|
continue;
|
|
}
|
|
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
isBrace = token.isBrace = true;
|
|
isGlob = token.isGlob = true;
|
|
finished = true;
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
isBrace = token.isBrace = true;
|
|
isGlob = token.isGlob = true;
|
|
finished = true;
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
braces--;
|
|
if (braces === 0) {
|
|
braceEscaped = false;
|
|
isBrace = token.isBrace = true;
|
|
finished = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (code === CHAR_FORWARD_SLASH) {
|
|
slashes.push(index);
|
|
tokens.push(token);
|
|
token = {
|
|
value: "",
|
|
depth: 0,
|
|
isGlob: false
|
|
};
|
|
if (finished === true)
|
|
continue;
|
|
if (prev === CHAR_DOT && index === start + 1) {
|
|
start += 2;
|
|
continue;
|
|
}
|
|
lastIndex = index + 1;
|
|
continue;
|
|
}
|
|
if (opts.noext !== true) {
|
|
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
isGlob = token.isGlob = true;
|
|
isExtglob = token.isExtglob = true;
|
|
finished = true;
|
|
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
negatedExtglob = true;
|
|
}
|
|
if (scanToEnd === true) {
|
|
while (eos() !== true && (code = advance())) {
|
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
backslashes = token.backslashes = true;
|
|
code = advance();
|
|
continue;
|
|
}
|
|
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
isGlob = token.isGlob = true;
|
|
finished = true;
|
|
break;
|
|
}
|
|
}
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (code === CHAR_ASTERISK) {
|
|
if (prev === CHAR_ASTERISK)
|
|
isGlobstar = token.isGlobstar = true;
|
|
isGlob = token.isGlob = true;
|
|
finished = true;
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (code === CHAR_QUESTION_MARK) {
|
|
isGlob = token.isGlob = true;
|
|
finished = true;
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
while (eos() !== true && (next = advance())) {
|
|
if (next === CHAR_BACKWARD_SLASH) {
|
|
backslashes = token.backslashes = true;
|
|
advance();
|
|
continue;
|
|
}
|
|
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
isBracket = token.isBracket = true;
|
|
isGlob = token.isGlob = true;
|
|
finished = true;
|
|
break;
|
|
}
|
|
}
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
negated = token.negated = true;
|
|
start++;
|
|
continue;
|
|
}
|
|
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
isGlob = token.isGlob = true;
|
|
if (scanToEnd === true) {
|
|
while (eos() !== true && (code = advance())) {
|
|
if (code === CHAR_LEFT_PARENTHESES) {
|
|
backslashes = token.backslashes = true;
|
|
code = advance();
|
|
continue;
|
|
}
|
|
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
finished = true;
|
|
break;
|
|
}
|
|
}
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (isGlob === true) {
|
|
finished = true;
|
|
if (scanToEnd === true) {
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (opts.noext === true) {
|
|
isExtglob = false;
|
|
isGlob = false;
|
|
}
|
|
let base = str;
|
|
let prefix = "";
|
|
let glob = "";
|
|
if (start > 0) {
|
|
prefix = str.slice(0, start);
|
|
str = str.slice(start);
|
|
lastIndex -= start;
|
|
}
|
|
if (base && isGlob === true && lastIndex > 0) {
|
|
base = str.slice(0, lastIndex);
|
|
glob = str.slice(lastIndex);
|
|
} else if (isGlob === true) {
|
|
base = "";
|
|
glob = str;
|
|
} else {
|
|
base = str;
|
|
}
|
|
if (base && base !== "" && base !== "/" && base !== str) {
|
|
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
base = base.slice(0, -1);
|
|
}
|
|
}
|
|
if (opts.unescape === true) {
|
|
if (glob)
|
|
glob = utils.removeBackslashes(glob);
|
|
if (base && backslashes === true) {
|
|
base = utils.removeBackslashes(base);
|
|
}
|
|
}
|
|
const state = {
|
|
prefix,
|
|
input,
|
|
start,
|
|
base,
|
|
glob,
|
|
isBrace,
|
|
isBracket,
|
|
isGlob,
|
|
isExtglob,
|
|
isGlobstar,
|
|
negated,
|
|
negatedExtglob
|
|
};
|
|
if (opts.tokens === true) {
|
|
state.maxDepth = 0;
|
|
if (!isPathSeparator(code)) {
|
|
tokens.push(token);
|
|
}
|
|
state.tokens = tokens;
|
|
}
|
|
if (opts.parts === true || opts.tokens === true) {
|
|
let prevIndex;
|
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
const n = prevIndex ? prevIndex + 1 : start;
|
|
const i = slashes[idx];
|
|
const value = input.slice(n, i);
|
|
if (opts.tokens) {
|
|
if (idx === 0 && start !== 0) {
|
|
tokens[idx].isPrefix = true;
|
|
tokens[idx].value = prefix;
|
|
} else {
|
|
tokens[idx].value = value;
|
|
}
|
|
depth(tokens[idx]);
|
|
state.maxDepth += tokens[idx].depth;
|
|
}
|
|
if (idx !== 0 || value !== "") {
|
|
parts.push(value);
|
|
}
|
|
prevIndex = i;
|
|
}
|
|
if (prevIndex && prevIndex + 1 < input.length) {
|
|
const value = input.slice(prevIndex + 1);
|
|
parts.push(value);
|
|
if (opts.tokens) {
|
|
tokens[tokens.length - 1].value = value;
|
|
depth(tokens[tokens.length - 1]);
|
|
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
}
|
|
}
|
|
state.slashes = slashes;
|
|
state.parts = parts;
|
|
}
|
|
return state;
|
|
};
|
|
module2.exports = scan;
|
|
}
|
|
});
|
|
var require_parse2 = __commonJS2({
|
|
"node_modules/picomatch/lib/parse.js"(exports2, module2) {
|
|
"use strict";
|
|
var constants = require_constants2();
|
|
var utils = require_utils3();
|
|
var {
|
|
MAX_LENGTH,
|
|
POSIX_REGEX_SOURCE,
|
|
REGEX_NON_SPECIAL_CHARS,
|
|
REGEX_SPECIAL_CHARS_BACKREF,
|
|
REPLACEMENTS
|
|
} = constants;
|
|
var expandRange = (args, options) => {
|
|
if (typeof options.expandRange === "function") {
|
|
return options.expandRange(...args, options);
|
|
}
|
|
args.sort();
|
|
const value = `[${args.join("-")}]`;
|
|
try {
|
|
new RegExp(value);
|
|
} catch (ex) {
|
|
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
}
|
|
return value;
|
|
};
|
|
var syntaxError = (type, char) => {
|
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
};
|
|
var parse = (input, options) => {
|
|
if (typeof input !== "string") {
|
|
throw new TypeError("Expected a string");
|
|
}
|
|
input = REPLACEMENTS[input] || input;
|
|
const opts = Object.assign({}, options);
|
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
let len = input.length;
|
|
if (len > max) {
|
|
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
}
|
|
const bos = {
|
|
type: "bos",
|
|
value: "",
|
|
output: opts.prepend || ""
|
|
};
|
|
const tokens = [bos];
|
|
const capture = opts.capture ? "" : "?:";
|
|
const win32 = utils.isWindows(options);
|
|
const PLATFORM_CHARS = constants.globChars(win32);
|
|
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
const {
|
|
DOT_LITERAL,
|
|
PLUS_LITERAL,
|
|
SLASH_LITERAL,
|
|
ONE_CHAR,
|
|
DOTS_SLASH,
|
|
NO_DOT,
|
|
NO_DOT_SLASH,
|
|
NO_DOTS_SLASH,
|
|
QMARK,
|
|
QMARK_NO_DOT,
|
|
STAR,
|
|
START_ANCHOR
|
|
} = PLATFORM_CHARS;
|
|
const globstar = (opts2) => {
|
|
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
};
|
|
const nodot = opts.dot ? "" : NO_DOT;
|
|
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
if (opts.capture) {
|
|
star = `(${star})`;
|
|
}
|
|
if (typeof opts.noext === "boolean") {
|
|
opts.noextglob = opts.noext;
|
|
}
|
|
const state = {
|
|
input,
|
|
index: -1,
|
|
start: 0,
|
|
dot: opts.dot === true,
|
|
consumed: "",
|
|
output: "",
|
|
prefix: "",
|
|
backtrack: false,
|
|
negated: false,
|
|
brackets: 0,
|
|
braces: 0,
|
|
parens: 0,
|
|
quotes: 0,
|
|
globstar: false,
|
|
tokens
|
|
};
|
|
input = utils.removePrefix(input, state);
|
|
len = input.length;
|
|
const extglobs = [];
|
|
const braces = [];
|
|
const stack = [];
|
|
let prev = bos;
|
|
let value;
|
|
const eos = () => state.index === len - 1;
|
|
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
const advance = state.advance = () => input[++state.index] || "";
|
|
const remaining = () => input.slice(state.index + 1);
|
|
const consume = (value2 = "", num = 0) => {
|
|
state.consumed += value2;
|
|
state.index += num;
|
|
};
|
|
const append = (token) => {
|
|
state.output += token.output != null ? token.output : token.value;
|
|
consume(token.value);
|
|
};
|
|
const negate = () => {
|
|
let count = 1;
|
|
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
advance();
|
|
state.start++;
|
|
count++;
|
|
}
|
|
if (count % 2 === 0) {
|
|
return false;
|
|
}
|
|
state.negated = true;
|
|
state.start++;
|
|
return true;
|
|
};
|
|
const increment = (type) => {
|
|
state[type]++;
|
|
stack.push(type);
|
|
};
|
|
const decrement = (type) => {
|
|
state[type]--;
|
|
stack.pop();
|
|
};
|
|
const push = (tok) => {
|
|
if (prev.type === "globstar") {
|
|
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
state.output = state.output.slice(0, -prev.output.length);
|
|
prev.type = "star";
|
|
prev.value = "*";
|
|
prev.output = star;
|
|
state.output += prev.output;
|
|
}
|
|
}
|
|
if (extglobs.length && tok.type !== "paren") {
|
|
extglobs[extglobs.length - 1].inner += tok.value;
|
|
}
|
|
if (tok.value || tok.output)
|
|
append(tok);
|
|
if (prev && prev.type === "text" && tok.type === "text") {
|
|
prev.value += tok.value;
|
|
prev.output = (prev.output || "") + tok.value;
|
|
return;
|
|
}
|
|
tok.prev = prev;
|
|
tokens.push(tok);
|
|
prev = tok;
|
|
};
|
|
const extglobOpen = (type, value2) => {
|
|
const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value2]), {}, {
|
|
conditions: 1,
|
|
inner: ""
|
|
});
|
|
token.prev = prev;
|
|
token.parens = state.parens;
|
|
token.output = state.output;
|
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
increment("parens");
|
|
push({
|
|
type,
|
|
value: value2,
|
|
output: state.output ? "" : ONE_CHAR
|
|
});
|
|
push({
|
|
type: "paren",
|
|
extglob: true,
|
|
value: advance(),
|
|
output
|
|
});
|
|
extglobs.push(token);
|
|
};
|
|
const extglobClose = (token) => {
|
|
let output = token.close + (opts.capture ? ")" : "");
|
|
let rest;
|
|
if (token.type === "negate") {
|
|
let extglobStar = star;
|
|
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
extglobStar = globstar(opts);
|
|
}
|
|
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
output = token.close = `)$))${extglobStar}`;
|
|
}
|
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
const expression = parse(rest, Object.assign(Object.assign({}, options), {}, {
|
|
fastpaths: false
|
|
})).output;
|
|
output = token.close = `)${expression})${extglobStar})`;
|
|
}
|
|
if (token.prev.type === "bos") {
|
|
state.negatedExtglob = true;
|
|
}
|
|
}
|
|
push({
|
|
type: "paren",
|
|
extglob: true,
|
|
value,
|
|
output
|
|
});
|
|
decrement("parens");
|
|
};
|
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
let backslashes = false;
|
|
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
if (first === "\\") {
|
|
backslashes = true;
|
|
return m;
|
|
}
|
|
if (first === "?") {
|
|
if (esc) {
|
|
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
}
|
|
if (index === 0) {
|
|
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
}
|
|
return QMARK.repeat(chars.length);
|
|
}
|
|
if (first === ".") {
|
|
return DOT_LITERAL.repeat(chars.length);
|
|
}
|
|
if (first === "*") {
|
|
if (esc) {
|
|
return esc + first + (rest ? star : "");
|
|
}
|
|
return star;
|
|
}
|
|
return esc ? m : `\\${m}`;
|
|
});
|
|
if (backslashes === true) {
|
|
if (opts.unescape === true) {
|
|
output = output.replace(/\\/g, "");
|
|
} else {
|
|
output = output.replace(/\\+/g, (m) => {
|
|
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
});
|
|
}
|
|
}
|
|
if (output === input && opts.contains === true) {
|
|
state.output = input;
|
|
return state;
|
|
}
|
|
state.output = utils.wrapOutput(output, state, options);
|
|
return state;
|
|
}
|
|
while (!eos()) {
|
|
value = advance();
|
|
if (value === "\0") {
|
|
continue;
|
|
}
|
|
if (value === "\\") {
|
|
const next = peek();
|
|
if (next === "/" && opts.bash !== true) {
|
|
continue;
|
|
}
|
|
if (next === "." || next === ";") {
|
|
continue;
|
|
}
|
|
if (!next) {
|
|
value += "\\";
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
const match = /^\\+/.exec(remaining());
|
|
let slashes = 0;
|
|
if (match && match[0].length > 2) {
|
|
slashes = match[0].length;
|
|
state.index += slashes;
|
|
if (slashes % 2 !== 0) {
|
|
value += "\\";
|
|
}
|
|
}
|
|
if (opts.unescape === true) {
|
|
value = advance();
|
|
} else {
|
|
value += advance();
|
|
}
|
|
if (state.brackets === 0) {
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
}
|
|
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
if (opts.posix !== false && value === ":") {
|
|
const inner = prev.value.slice(1);
|
|
if (inner.includes("[")) {
|
|
prev.posix = true;
|
|
if (inner.includes(":")) {
|
|
const idx = prev.value.lastIndexOf("[");
|
|
const pre = prev.value.slice(0, idx);
|
|
const rest2 = prev.value.slice(idx + 2);
|
|
const posix = POSIX_REGEX_SOURCE[rest2];
|
|
if (posix) {
|
|
prev.value = pre + posix;
|
|
state.backtrack = true;
|
|
advance();
|
|
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
bos.output = ONE_CHAR;
|
|
}
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
value = `\\${value}`;
|
|
}
|
|
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
value = `\\${value}`;
|
|
}
|
|
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
value = "^";
|
|
}
|
|
prev.value += value;
|
|
append({
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (state.quotes === 1 && value !== '"') {
|
|
value = utils.escapeRegex(value);
|
|
prev.value += value;
|
|
append({
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === '"') {
|
|
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
if (opts.keepQuotes === true) {
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
}
|
|
continue;
|
|
}
|
|
if (value === "(") {
|
|
increment("parens");
|
|
push({
|
|
type: "paren",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === ")") {
|
|
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
throw new SyntaxError(syntaxError("opening", "("));
|
|
}
|
|
const extglob = extglobs[extglobs.length - 1];
|
|
if (extglob && state.parens === extglob.parens + 1) {
|
|
extglobClose(extglobs.pop());
|
|
continue;
|
|
}
|
|
push({
|
|
type: "paren",
|
|
value,
|
|
output: state.parens ? ")" : "\\)"
|
|
});
|
|
decrement("parens");
|
|
continue;
|
|
}
|
|
if (value === "[") {
|
|
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
throw new SyntaxError(syntaxError("closing", "]"));
|
|
}
|
|
value = `\\${value}`;
|
|
} else {
|
|
increment("brackets");
|
|
}
|
|
push({
|
|
type: "bracket",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === "]") {
|
|
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
push({
|
|
type: "text",
|
|
value,
|
|
output: `\\${value}`
|
|
});
|
|
continue;
|
|
}
|
|
if (state.brackets === 0) {
|
|
if (opts.strictBrackets === true) {
|
|
throw new SyntaxError(syntaxError("opening", "["));
|
|
}
|
|
push({
|
|
type: "text",
|
|
value,
|
|
output: `\\${value}`
|
|
});
|
|
continue;
|
|
}
|
|
decrement("brackets");
|
|
const prevValue = prev.value.slice(1);
|
|
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
value = `/${value}`;
|
|
}
|
|
prev.value += value;
|
|
append({
|
|
value
|
|
});
|
|
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
continue;
|
|
}
|
|
const escaped = utils.escapeRegex(prev.value);
|
|
state.output = state.output.slice(0, -prev.value.length);
|
|
if (opts.literalBrackets === true) {
|
|
state.output += escaped;
|
|
prev.value = escaped;
|
|
continue;
|
|
}
|
|
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
state.output += prev.value;
|
|
continue;
|
|
}
|
|
if (value === "{" && opts.nobrace !== true) {
|
|
increment("braces");
|
|
const open = {
|
|
type: "brace",
|
|
value,
|
|
output: "(",
|
|
outputIndex: state.output.length,
|
|
tokensIndex: state.tokens.length
|
|
};
|
|
braces.push(open);
|
|
push(open);
|
|
continue;
|
|
}
|
|
if (value === "}") {
|
|
const brace = braces[braces.length - 1];
|
|
if (opts.nobrace === true || !brace) {
|
|
push({
|
|
type: "text",
|
|
value,
|
|
output: value
|
|
});
|
|
continue;
|
|
}
|
|
let output = ")";
|
|
if (brace.dots === true) {
|
|
const arr = tokens.slice();
|
|
const range = [];
|
|
for (let i = arr.length - 1; i >= 0; i--) {
|
|
tokens.pop();
|
|
if (arr[i].type === "brace") {
|
|
break;
|
|
}
|
|
if (arr[i].type !== "dots") {
|
|
range.unshift(arr[i].value);
|
|
}
|
|
}
|
|
output = expandRange(range, opts);
|
|
state.backtrack = true;
|
|
}
|
|
if (brace.comma !== true && brace.dots !== true) {
|
|
const out = state.output.slice(0, brace.outputIndex);
|
|
const toks = state.tokens.slice(brace.tokensIndex);
|
|
brace.value = brace.output = "\\{";
|
|
value = output = "\\}";
|
|
state.output = out;
|
|
for (const t of toks) {
|
|
state.output += t.output || t.value;
|
|
}
|
|
}
|
|
push({
|
|
type: "brace",
|
|
value,
|
|
output
|
|
});
|
|
decrement("braces");
|
|
braces.pop();
|
|
continue;
|
|
}
|
|
if (value === "|") {
|
|
if (extglobs.length > 0) {
|
|
extglobs[extglobs.length - 1].conditions++;
|
|
}
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value === ",") {
|
|
let output = value;
|
|
const brace = braces[braces.length - 1];
|
|
if (brace && stack[stack.length - 1] === "braces") {
|
|
brace.comma = true;
|
|
output = "|";
|
|
}
|
|
push({
|
|
type: "comma",
|
|
value,
|
|
output
|
|
});
|
|
continue;
|
|
}
|
|
if (value === "/") {
|
|
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
state.start = state.index + 1;
|
|
state.consumed = "";
|
|
state.output = "";
|
|
tokens.pop();
|
|
prev = bos;
|
|
continue;
|
|
}
|
|
push({
|
|
type: "slash",
|
|
value,
|
|
output: SLASH_LITERAL
|
|
});
|
|
continue;
|
|
}
|
|
if (value === ".") {
|
|
if (state.braces > 0 && prev.type === "dot") {
|
|
if (prev.value === ".")
|
|
prev.output = DOT_LITERAL;
|
|
const brace = braces[braces.length - 1];
|
|
prev.type = "dots";
|
|
prev.output += value;
|
|
prev.value += value;
|
|
brace.dots = true;
|
|
continue;
|
|
}
|
|
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
push({
|
|
type: "text",
|
|
value,
|
|
output: DOT_LITERAL
|
|
});
|
|
continue;
|
|
}
|
|
push({
|
|
type: "dot",
|
|
value,
|
|
output: DOT_LITERAL
|
|
});
|
|
continue;
|
|
}
|
|
if (value === "?") {
|
|
const isGroup = prev && prev.value === "(";
|
|
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
extglobOpen("qmark", value);
|
|
continue;
|
|
}
|
|
if (prev && prev.type === "paren") {
|
|
const next = peek();
|
|
let output = value;
|
|
if (next === "<" && !utils.supportsLookbehinds()) {
|
|
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
}
|
|
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
output = `\\${value}`;
|
|
}
|
|
push({
|
|
type: "text",
|
|
value,
|
|
output
|
|
});
|
|
continue;
|
|
}
|
|
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
push({
|
|
type: "qmark",
|
|
value,
|
|
output: QMARK_NO_DOT
|
|
});
|
|
continue;
|
|
}
|
|
push({
|
|
type: "qmark",
|
|
value,
|
|
output: QMARK
|
|
});
|
|
continue;
|
|
}
|
|
if (value === "!") {
|
|
if (opts.noextglob !== true && peek() === "(") {
|
|
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
extglobOpen("negate", value);
|
|
continue;
|
|
}
|
|
}
|
|
if (opts.nonegate !== true && state.index === 0) {
|
|
negate();
|
|
continue;
|
|
}
|
|
}
|
|
if (value === "+") {
|
|
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
extglobOpen("plus", value);
|
|
continue;
|
|
}
|
|
if (prev && prev.value === "(" || opts.regex === false) {
|
|
push({
|
|
type: "plus",
|
|
value,
|
|
output: PLUS_LITERAL
|
|
});
|
|
continue;
|
|
}
|
|
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
push({
|
|
type: "plus",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
push({
|
|
type: "plus",
|
|
value: PLUS_LITERAL
|
|
});
|
|
continue;
|
|
}
|
|
if (value === "@") {
|
|
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
push({
|
|
type: "at",
|
|
extglob: true,
|
|
value,
|
|
output: ""
|
|
});
|
|
continue;
|
|
}
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (value !== "*") {
|
|
if (value === "$" || value === "^") {
|
|
value = `\\${value}`;
|
|
}
|
|
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
if (match) {
|
|
value += match[0];
|
|
state.index += match[0].length;
|
|
}
|
|
push({
|
|
type: "text",
|
|
value
|
|
});
|
|
continue;
|
|
}
|
|
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
prev.type = "star";
|
|
prev.star = true;
|
|
prev.value += value;
|
|
prev.output = star;
|
|
state.backtrack = true;
|
|
state.globstar = true;
|
|
consume(value);
|
|
continue;
|
|
}
|
|
let rest = remaining();
|
|
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
extglobOpen("star", value);
|
|
continue;
|
|
}
|
|
if (prev.type === "star") {
|
|
if (opts.noglobstar === true) {
|
|
consume(value);
|
|
continue;
|
|
}
|
|
const prior = prev.prev;
|
|
const before = prior.prev;
|
|
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
push({
|
|
type: "star",
|
|
value,
|
|
output: ""
|
|
});
|
|
continue;
|
|
}
|
|
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
push({
|
|
type: "star",
|
|
value,
|
|
output: ""
|
|
});
|
|
continue;
|
|
}
|
|
while (rest.slice(0, 3) === "/**") {
|
|
const after = input[state.index + 4];
|
|
if (after && after !== "/") {
|
|
break;
|
|
}
|
|
rest = rest.slice(3);
|
|
consume("/**", 3);
|
|
}
|
|
if (prior.type === "bos" && eos()) {
|
|
prev.type = "globstar";
|
|
prev.value += value;
|
|
prev.output = globstar(opts);
|
|
state.output = prev.output;
|
|
state.globstar = true;
|
|
consume(value);
|
|
continue;
|
|
}
|
|
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
prior.output = `(?:${prior.output}`;
|
|
prev.type = "globstar";
|
|
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
prev.value += value;
|
|
state.globstar = true;
|
|
state.output += prior.output + prev.output;
|
|
consume(value);
|
|
continue;
|
|
}
|
|
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
const end = rest[1] !== void 0 ? "|$" : "";
|
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
prior.output = `(?:${prior.output}`;
|
|
prev.type = "globstar";
|
|
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
prev.value += value;
|
|
state.output += prior.output + prev.output;
|
|
state.globstar = true;
|
|
consume(value + advance());
|
|
push({
|
|
type: "slash",
|
|
value: "/",
|
|
output: ""
|
|
});
|
|
continue;
|
|
}
|
|
if (prior.type === "bos" && rest[0] === "/") {
|
|
prev.type = "globstar";
|
|
prev.value += value;
|
|
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
state.output = prev.output;
|
|
state.globstar = true;
|
|
consume(value + advance());
|
|
push({
|
|
type: "slash",
|
|
value: "/",
|
|
output: ""
|
|
});
|
|
continue;
|
|
}
|
|
state.output = state.output.slice(0, -prev.output.length);
|
|
prev.type = "globstar";
|
|
prev.output = globstar(opts);
|
|
prev.value += value;
|
|
state.output += prev.output;
|
|
state.globstar = true;
|
|
consume(value);
|
|
continue;
|
|
}
|
|
const token = {
|
|
type: "star",
|
|
value,
|
|
output: star
|
|
};
|
|
if (opts.bash === true) {
|
|
token.output = ".*?";
|
|
if (prev.type === "bos" || prev.type === "slash") {
|
|
token.output = nodot + token.output;
|
|
}
|
|
push(token);
|
|
continue;
|
|
}
|
|
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
token.output = value;
|
|
push(token);
|
|
continue;
|
|
}
|
|
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
if (prev.type === "dot") {
|
|
state.output += NO_DOT_SLASH;
|
|
prev.output += NO_DOT_SLASH;
|
|
} else if (opts.dot === true) {
|
|
state.output += NO_DOTS_SLASH;
|
|
prev.output += NO_DOTS_SLASH;
|
|
} else {
|
|
state.output += nodot;
|
|
prev.output += nodot;
|
|
}
|
|
if (peek() !== "*") {
|
|
state.output += ONE_CHAR;
|
|
prev.output += ONE_CHAR;
|
|
}
|
|
}
|
|
push(token);
|
|
}
|
|
while (state.brackets > 0) {
|
|
if (opts.strictBrackets === true)
|
|
throw new SyntaxError(syntaxError("closing", "]"));
|
|
state.output = utils.escapeLast(state.output, "[");
|
|
decrement("brackets");
|
|
}
|
|
while (state.parens > 0) {
|
|
if (opts.strictBrackets === true)
|
|
throw new SyntaxError(syntaxError("closing", ")"));
|
|
state.output = utils.escapeLast(state.output, "(");
|
|
decrement("parens");
|
|
}
|
|
while (state.braces > 0) {
|
|
if (opts.strictBrackets === true)
|
|
throw new SyntaxError(syntaxError("closing", "}"));
|
|
state.output = utils.escapeLast(state.output, "{");
|
|
decrement("braces");
|
|
}
|
|
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
push({
|
|
type: "maybe_slash",
|
|
value: "",
|
|
output: `${SLASH_LITERAL}?`
|
|
});
|
|
}
|
|
if (state.backtrack === true) {
|
|
state.output = "";
|
|
for (const token of state.tokens) {
|
|
state.output += token.output != null ? token.output : token.value;
|
|
if (token.suffix) {
|
|
state.output += token.suffix;
|
|
}
|
|
}
|
|
}
|
|
return state;
|
|
};
|
|
parse.fastpaths = (input, options) => {
|
|
const opts = Object.assign({}, options);
|
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
const len = input.length;
|
|
if (len > max) {
|
|
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
}
|
|
input = REPLACEMENTS[input] || input;
|
|
const win32 = utils.isWindows(options);
|
|
const {
|
|
DOT_LITERAL,
|
|
SLASH_LITERAL,
|
|
ONE_CHAR,
|
|
DOTS_SLASH,
|
|
NO_DOT,
|
|
NO_DOTS,
|
|
NO_DOTS_SLASH,
|
|
STAR,
|
|
START_ANCHOR
|
|
} = constants.globChars(win32);
|
|
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
const capture = opts.capture ? "" : "?:";
|
|
const state = {
|
|
negated: false,
|
|
prefix: ""
|
|
};
|
|
let star = opts.bash === true ? ".*?" : STAR;
|
|
if (opts.capture) {
|
|
star = `(${star})`;
|
|
}
|
|
const globstar = (opts2) => {
|
|
if (opts2.noglobstar === true)
|
|
return star;
|
|
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
};
|
|
const create = (str) => {
|
|
switch (str) {
|
|
case "*":
|
|
return `${nodot}${ONE_CHAR}${star}`;
|
|
case ".*":
|
|
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
case "*.*":
|
|
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
case "*/*":
|
|
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
case "**":
|
|
return nodot + globstar(opts);
|
|
case "**/*":
|
|
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
case "**/*.*":
|
|
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
case "**/.*":
|
|
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
default: {
|
|
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
if (!match)
|
|
return;
|
|
const source2 = create(match[1]);
|
|
if (!source2)
|
|
return;
|
|
return source2 + DOT_LITERAL + match[2];
|
|
}
|
|
}
|
|
};
|
|
const output = utils.removePrefix(input, state);
|
|
let source = create(output);
|
|
if (source && opts.strictSlashes !== true) {
|
|
source += `${SLASH_LITERAL}?`;
|
|
}
|
|
return source;
|
|
};
|
|
module2.exports = parse;
|
|
}
|
|
});
|
|
var require_picomatch = __commonJS2({
|
|
"node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var scan = require_scan();
|
|
var parse = require_parse2();
|
|
var utils = require_utils3();
|
|
var constants = require_constants2();
|
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
var picomatch = (glob, options, returnState = false) => {
|
|
if (Array.isArray(glob)) {
|
|
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
const arrayMatcher = (str) => {
|
|
for (const isMatch of fns) {
|
|
const state2 = isMatch(str);
|
|
if (state2)
|
|
return state2;
|
|
}
|
|
return false;
|
|
};
|
|
return arrayMatcher;
|
|
}
|
|
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
throw new TypeError("Expected pattern to be a non-empty string");
|
|
}
|
|
const opts = options || {};
|
|
const posix = utils.isWindows(options);
|
|
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
const state = regex.state;
|
|
delete regex.state;
|
|
let isIgnored = () => false;
|
|
if (opts.ignore) {
|
|
const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
|
|
ignore: null,
|
|
onMatch: null,
|
|
onResult: null
|
|
});
|
|
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
}
|
|
const matcher = (input, returnObject = false) => {
|
|
const {
|
|
isMatch,
|
|
match,
|
|
output
|
|
} = picomatch.test(input, regex, options, {
|
|
glob,
|
|
posix
|
|
});
|
|
const result = {
|
|
glob,
|
|
state,
|
|
regex,
|
|
posix,
|
|
input,
|
|
output,
|
|
match,
|
|
isMatch
|
|
};
|
|
if (typeof opts.onResult === "function") {
|
|
opts.onResult(result);
|
|
}
|
|
if (isMatch === false) {
|
|
result.isMatch = false;
|
|
return returnObject ? result : false;
|
|
}
|
|
if (isIgnored(input)) {
|
|
if (typeof opts.onIgnore === "function") {
|
|
opts.onIgnore(result);
|
|
}
|
|
result.isMatch = false;
|
|
return returnObject ? result : false;
|
|
}
|
|
if (typeof opts.onMatch === "function") {
|
|
opts.onMatch(result);
|
|
}
|
|
return returnObject ? result : true;
|
|
};
|
|
if (returnState) {
|
|
matcher.state = state;
|
|
}
|
|
return matcher;
|
|
};
|
|
picomatch.test = (input, regex, options, {
|
|
glob,
|
|
posix
|
|
} = {}) => {
|
|
if (typeof input !== "string") {
|
|
throw new TypeError("Expected input to be a string");
|
|
}
|
|
if (input === "") {
|
|
return {
|
|
isMatch: false,
|
|
output: ""
|
|
};
|
|
}
|
|
const opts = options || {};
|
|
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
let match = input === glob;
|
|
let output = match && format ? format(input) : input;
|
|
if (match === false) {
|
|
output = format ? format(input) : input;
|
|
match = output === glob;
|
|
}
|
|
if (match === false || opts.capture === true) {
|
|
if (opts.matchBase === true || opts.basename === true) {
|
|
match = picomatch.matchBase(input, regex, options, posix);
|
|
} else {
|
|
match = regex.exec(output);
|
|
}
|
|
}
|
|
return {
|
|
isMatch: Boolean(match),
|
|
match,
|
|
output
|
|
};
|
|
};
|
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
return regex.test(path.basename(input));
|
|
};
|
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
picomatch.parse = (pattern, options) => {
|
|
if (Array.isArray(pattern))
|
|
return pattern.map((p) => picomatch.parse(p, options));
|
|
return parse(pattern, Object.assign(Object.assign({}, options), {}, {
|
|
fastpaths: false
|
|
}));
|
|
};
|
|
picomatch.scan = (input, options) => scan(input, options);
|
|
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
if (returnOutput === true) {
|
|
return state.output;
|
|
}
|
|
const opts = options || {};
|
|
const prepend = opts.contains ? "" : "^";
|
|
const append = opts.contains ? "" : "$";
|
|
let source = `${prepend}(?:${state.output})${append}`;
|
|
if (state && state.negated === true) {
|
|
source = `^(?!${source}).*$`;
|
|
}
|
|
const regex = picomatch.toRegex(source, options);
|
|
if (returnState === true) {
|
|
regex.state = state;
|
|
}
|
|
return regex;
|
|
};
|
|
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
if (!input || typeof input !== "string") {
|
|
throw new TypeError("Expected a non-empty string");
|
|
}
|
|
let parsed = {
|
|
negated: false,
|
|
fastpaths: true
|
|
};
|
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
parsed.output = parse.fastpaths(input, options);
|
|
}
|
|
if (!parsed.output) {
|
|
parsed = parse(input, options);
|
|
}
|
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
};
|
|
picomatch.toRegex = (source, options) => {
|
|
try {
|
|
const opts = options || {};
|
|
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
} catch (err) {
|
|
if (options && options.debug === true)
|
|
throw err;
|
|
return /$^/;
|
|
}
|
|
};
|
|
picomatch.constants = constants;
|
|
module2.exports = picomatch;
|
|
}
|
|
});
|
|
var require_picomatch2 = __commonJS2({
|
|
"node_modules/picomatch/index.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = require_picomatch();
|
|
}
|
|
});
|
|
var require_micromatch = __commonJS2({
|
|
"node_modules/micromatch/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var util = require("util");
|
|
var braces = require_braces();
|
|
var picomatch = require_picomatch2();
|
|
var utils = require_utils3();
|
|
var isEmptyString = (val) => val === "" || val === "./";
|
|
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]), Object.assign(Object.assign({}, 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, Object.assign(Object.assign({}, 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, Object.assign(Object.assign({}, 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), Object.assign(Object.assign({}, 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 || !/\{.*\}/.test(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, Object.assign(Object.assign({}, options), {}, {
|
|
expand: true
|
|
}));
|
|
};
|
|
module2.exports = micromatch;
|
|
}
|
|
});
|
|
var require_pattern = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/pattern.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
|
|
var path = 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 = /,|\.\./;
|
|
function isStaticPattern(pattern, options = {}) {
|
|
return !isDynamicPattern(pattern, options);
|
|
}
|
|
exports2.isStaticPattern = isStaticPattern;
|
|
function isDynamicPattern(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;
|
|
}
|
|
exports2.isDynamicPattern = isDynamicPattern;
|
|
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 isNegativePattern(pattern) ? pattern.slice(1) : pattern;
|
|
}
|
|
exports2.convertToPositivePattern = convertToPositivePattern;
|
|
function convertToNegativePattern(pattern) {
|
|
return "!" + pattern;
|
|
}
|
|
exports2.convertToNegativePattern = convertToNegativePattern;
|
|
function isNegativePattern(pattern) {
|
|
return pattern.startsWith("!") && pattern[1] !== "(";
|
|
}
|
|
exports2.isNegativePattern = isNegativePattern;
|
|
function isPositivePattern(pattern) {
|
|
return !isNegativePattern(pattern);
|
|
}
|
|
exports2.isPositivePattern = isPositivePattern;
|
|
function getNegativePatterns(patterns) {
|
|
return patterns.filter(isNegativePattern);
|
|
}
|
|
exports2.getNegativePatterns = getNegativePatterns;
|
|
function getPositivePatterns(patterns) {
|
|
return patterns.filter(isPositivePattern);
|
|
}
|
|
exports2.getPositivePatterns = getPositivePatterns;
|
|
function getPatternsInsideCurrentDirectory(patterns) {
|
|
return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
|
|
}
|
|
exports2.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
|
|
function getPatternsOutsideCurrentDirectory(patterns) {
|
|
return patterns.filter(isPatternRelatedToParentDirectory);
|
|
}
|
|
exports2.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
|
|
function isPatternRelatedToParentDirectory(pattern) {
|
|
return pattern.startsWith("..") || pattern.startsWith("./..");
|
|
}
|
|
exports2.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
|
|
function getBaseDirectory(pattern) {
|
|
return globParent(pattern, {
|
|
flipBackslashes: false
|
|
});
|
|
}
|
|
exports2.getBaseDirectory = getBaseDirectory;
|
|
function hasGlobStar(pattern) {
|
|
return pattern.includes(GLOBSTAR);
|
|
}
|
|
exports2.hasGlobStar = hasGlobStar;
|
|
function endsWithSlashGlobStar(pattern) {
|
|
return pattern.endsWith("/" + GLOBSTAR);
|
|
}
|
|
exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
const basename = path.basename(pattern);
|
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
}
|
|
exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
function expandPatternsWithBraceExpansion(patterns) {
|
|
return patterns.reduce((collection, pattern) => {
|
|
return collection.concat(expandBraceExpansion(pattern));
|
|
}, []);
|
|
}
|
|
exports2.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
function expandBraceExpansion(pattern) {
|
|
return micromatch.braces(pattern, {
|
|
expand: true,
|
|
nodupes: true
|
|
});
|
|
}
|
|
exports2.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;
|
|
}
|
|
exports2.getPatternParts = getPatternParts;
|
|
function makeRe(pattern, options) {
|
|
return micromatch.makeRe(pattern, options);
|
|
}
|
|
exports2.makeRe = makeRe;
|
|
function convertPatternsToRe(patterns, options) {
|
|
return patterns.map((pattern) => makeRe(pattern, options));
|
|
}
|
|
exports2.convertPatternsToRe = convertPatternsToRe;
|
|
function matchAny(entry, patternsRe) {
|
|
return patternsRe.some((patternRe) => patternRe.test(entry));
|
|
}
|
|
exports2.matchAny = matchAny;
|
|
}
|
|
});
|
|
var require_merge2 = __commonJS2({
|
|
"node_modules/merge2/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var Stream = require("stream");
|
|
var PassThrough = Stream.PassThrough;
|
|
var slice = Array.prototype.slice;
|
|
module2.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(endStream);
|
|
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 endStream() {
|
|
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;
|
|
}
|
|
}
|
|
});
|
|
var require_stream = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/stream.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.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;
|
|
}
|
|
exports2.merge = merge;
|
|
function propagateCloseEventToSources(streams) {
|
|
streams.forEach((stream) => stream.emit("close"));
|
|
}
|
|
}
|
|
});
|
|
var require_string = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/string.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.isEmpty = exports2.isString = void 0;
|
|
function isString(input) {
|
|
return typeof input === "string";
|
|
}
|
|
exports2.isString = isString;
|
|
function isEmpty(input) {
|
|
return input === "";
|
|
}
|
|
exports2.isEmpty = isEmpty;
|
|
}
|
|
});
|
|
var require_utils4 = __commonJS2({
|
|
"node_modules/fast-glob/out/utils/index.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
|
|
var array2 = require_array();
|
|
exports2.array = array2;
|
|
var errno = require_errno();
|
|
exports2.errno = errno;
|
|
var fs = require_fs();
|
|
exports2.fs = fs;
|
|
var path = require_path();
|
|
exports2.path = path;
|
|
var pattern = require_pattern();
|
|
exports2.pattern = pattern;
|
|
var stream = require_stream();
|
|
exports2.stream = stream;
|
|
var string = require_string();
|
|
exports2.string = string;
|
|
}
|
|
});
|
|
var require_tasks = __commonJS2({
|
|
"node_modules/fast-glob/out/managers/tasks.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
|
|
var utils = require_utils4();
|
|
function generate(patterns, settings) {
|
|
const positivePatterns = getPositivePatterns(patterns);
|
|
const negativePatterns = getNegativePatternsAsPositive(patterns, settings.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, false);
|
|
const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
|
|
return staticTasks.concat(dynamicTasks);
|
|
}
|
|
exports2.generate = generate;
|
|
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;
|
|
}
|
|
exports2.convertPatternsToTasks = convertPatternsToTasks;
|
|
function getPositivePatterns(patterns) {
|
|
return utils.pattern.getPositivePatterns(patterns);
|
|
}
|
|
exports2.getPositivePatterns = getPositivePatterns;
|
|
function getNegativePatternsAsPositive(patterns, ignore) {
|
|
const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
|
|
const positive = negative.map(utils.pattern.convertToPositivePattern);
|
|
return positive;
|
|
}
|
|
exports2.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);
|
|
}
|
|
exports2.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
|
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
|
return Object.keys(positive).map((base) => {
|
|
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
|
});
|
|
}
|
|
exports2.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
|
function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
|
return {
|
|
dynamic,
|
|
positive,
|
|
negative,
|
|
base,
|
|
patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
|
|
};
|
|
}
|
|
exports2.convertPatternGroupToTask = convertPatternGroupToTask;
|
|
}
|
|
});
|
|
var require_patterns = __commonJS2({
|
|
"node_modules/fast-glob/out/managers/patterns.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.removeDuplicateSlashes = exports2.transform = void 0;
|
|
var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
|
|
function transform(patterns) {
|
|
return patterns.map((pattern) => removeDuplicateSlashes(pattern));
|
|
}
|
|
exports2.transform = transform;
|
|
function removeDuplicateSlashes(pattern) {
|
|
return pattern.replace(DOUBLE_SLASH_RE, "/");
|
|
}
|
|
exports2.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
}
|
|
});
|
|
var require_async = __commonJS2({
|
|
"node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.read = void 0;
|
|
function read(path, settings, callback) {
|
|
settings.fs.lstat(path, (lstatError, lstat) => {
|
|
if (lstatError !== null) {
|
|
callFailureCallback(callback, lstatError);
|
|
return;
|
|
}
|
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
callSuccessCallback(callback, lstat);
|
|
return;
|
|
}
|
|
settings.fs.stat(path, (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);
|
|
});
|
|
});
|
|
}
|
|
exports2.read = read;
|
|
function callFailureCallback(callback, error) {
|
|
callback(error);
|
|
}
|
|
function callSuccessCallback(callback, result) {
|
|
callback(null, result);
|
|
}
|
|
}
|
|
});
|
|
var require_sync = __commonJS2({
|
|
"node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.read = void 0;
|
|
function read(path, settings) {
|
|
const lstat = settings.fs.lstatSync(path);
|
|
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
return lstat;
|
|
}
|
|
try {
|
|
const stat = settings.fs.statSync(path);
|
|
if (settings.markSymbolicLink) {
|
|
stat.isSymbolicLink = () => true;
|
|
}
|
|
return stat;
|
|
} catch (error) {
|
|
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
|
return lstat;
|
|
}
|
|
throw error;
|
|
}
|
|
}
|
|
exports2.read = read;
|
|
}
|
|
});
|
|
var require_fs2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
var fs = require("fs");
|
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
lstat: fs.lstat,
|
|
stat: fs.stat,
|
|
lstatSync: fs.lstatSync,
|
|
statSync: fs.statSync
|
|
};
|
|
function createFileSystemAdapter(fsMethods) {
|
|
if (fsMethods === void 0) {
|
|
return exports2.FILE_SYSTEM_ADAPTER;
|
|
}
|
|
return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
}
|
|
exports2.createFileSystemAdapter = createFileSystemAdapter;
|
|
}
|
|
});
|
|
var require_settings = __commonJS2({
|
|
"node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var fs = require_fs2();
|
|
var Settings = class {
|
|
constructor(_options = {}) {
|
|
this._options = _options;
|
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
this.fs = fs.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;
|
|
}
|
|
};
|
|
exports2.default = Settings;
|
|
}
|
|
});
|
|
var require_out = __commonJS2({
|
|
"node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.statSync = exports2.stat = exports2.Settings = void 0;
|
|
var async = require_async();
|
|
var sync = require_sync();
|
|
var settings_1 = require_settings();
|
|
exports2.Settings = settings_1.default;
|
|
function stat(path, optionsOrSettingsOrCallback, callback) {
|
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
|
return;
|
|
}
|
|
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
|
}
|
|
exports2.stat = stat;
|
|
function statSync(path, optionsOrSettings) {
|
|
const settings = getSettings(optionsOrSettings);
|
|
return sync.read(path, settings);
|
|
}
|
|
exports2.statSync = statSync;
|
|
function getSettings(settingsOrOptions = {}) {
|
|
if (settingsOrOptions instanceof settings_1.default) {
|
|
return settingsOrOptions;
|
|
}
|
|
return new settings_1.default(settingsOrOptions);
|
|
}
|
|
}
|
|
});
|
|
var require_queue_microtask = __commonJS2({
|
|
"node_modules/queue-microtask/index.js"(exports2, module2) {
|
|
var promise;
|
|
module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
|
|
throw err;
|
|
}, 0));
|
|
}
|
|
});
|
|
var require_run_parallel = __commonJS2({
|
|
"node_modules/run-parallel/index.js"(exports2, module2) {
|
|
module2.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;
|
|
}
|
|
}
|
|
});
|
|
var require_constants3 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.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;
|
|
exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
|
}
|
|
});
|
|
var require_fs3 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.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);
|
|
}
|
|
exports2.createDirentFromStats = createDirentFromStats;
|
|
}
|
|
});
|
|
var require_utils5 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.fs = void 0;
|
|
var fs = require_fs3();
|
|
exports2.fs = fs;
|
|
}
|
|
});
|
|
var require_common = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.joinPathSegments = void 0;
|
|
function joinPathSegments(a, b, separator) {
|
|
if (a.endsWith(separator)) {
|
|
return a + b;
|
|
}
|
|
return a + separator + b;
|
|
}
|
|
exports2.joinPathSegments = joinPathSegments;
|
|
}
|
|
});
|
|
var require_async2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
|
|
var fsStat = require_out();
|
|
var rpl = require_run_parallel();
|
|
var constants_1 = require_constants3();
|
|
var utils = require_utils5();
|
|
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);
|
|
}
|
|
exports2.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);
|
|
});
|
|
});
|
|
}
|
|
exports2.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 path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
return (done) => {
|
|
fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
|
|
if (error !== null) {
|
|
done(error);
|
|
return;
|
|
}
|
|
const entry = {
|
|
name,
|
|
path,
|
|
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);
|
|
});
|
|
});
|
|
}
|
|
exports2.readdir = readdir;
|
|
function callFailureCallback(callback, error) {
|
|
callback(error);
|
|
}
|
|
function callSuccessCallback(callback, result) {
|
|
callback(null, result);
|
|
}
|
|
}
|
|
});
|
|
var require_sync2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
|
|
var fsStat = require_out();
|
|
var constants_1 = require_constants3();
|
|
var utils = require_utils5();
|
|
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);
|
|
}
|
|
exports2.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;
|
|
});
|
|
}
|
|
exports2.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;
|
|
});
|
|
}
|
|
exports2.readdir = readdir;
|
|
}
|
|
});
|
|
var require_fs4 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
var fs = require("fs");
|
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
lstat: fs.lstat,
|
|
stat: fs.stat,
|
|
lstatSync: fs.lstatSync,
|
|
statSync: fs.statSync,
|
|
readdir: fs.readdir,
|
|
readdirSync: fs.readdirSync
|
|
};
|
|
function createFileSystemAdapter(fsMethods) {
|
|
if (fsMethods === void 0) {
|
|
return exports2.FILE_SYSTEM_ADAPTER;
|
|
}
|
|
return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
}
|
|
exports2.createFileSystemAdapter = createFileSystemAdapter;
|
|
}
|
|
});
|
|
var require_settings2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var path = require("path");
|
|
var fsStat = require_out();
|
|
var fs = require_fs4();
|
|
var Settings = class {
|
|
constructor(_options = {}) {
|
|
this._options = _options;
|
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.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;
|
|
}
|
|
};
|
|
exports2.default = Settings;
|
|
}
|
|
});
|
|
var require_out2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
|
|
var async = require_async2();
|
|
var sync = require_sync2();
|
|
var settings_1 = require_settings2();
|
|
exports2.Settings = settings_1.default;
|
|
function scandir(path, optionsOrSettingsOrCallback, callback) {
|
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
|
return;
|
|
}
|
|
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
|
}
|
|
exports2.scandir = scandir;
|
|
function scandirSync(path, optionsOrSettings) {
|
|
const settings = getSettings(optionsOrSettings);
|
|
return sync.read(path, settings);
|
|
}
|
|
exports2.scandirSync = scandirSync;
|
|
function getSettings(settingsOrOptions = {}) {
|
|
if (settingsOrOptions instanceof settings_1.default) {
|
|
return settingsOrOptions;
|
|
}
|
|
return new settings_1.default(settingsOrOptions);
|
|
}
|
|
}
|
|
});
|
|
var require_reusify = __commonJS2({
|
|
"node_modules/reusify/reusify.js"(exports2, module2) {
|
|
"use strict";
|
|
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
|
|
};
|
|
}
|
|
module2.exports = reusify;
|
|
}
|
|
});
|
|
var require_queue = __commonJS2({
|
|
"node_modules/fastq/queue.js"(exports2, module2) {
|
|
"use strict";
|
|
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 greater than 1");
|
|
}
|
|
var cache = reusify(Task);
|
|
var queueHead = null;
|
|
var queueTail = null;
|
|
var _running = 0;
|
|
var errorHandler = null;
|
|
var self2 = {
|
|
push,
|
|
drain: noop,
|
|
saturated: noop,
|
|
pause,
|
|
paused: false,
|
|
concurrency,
|
|
running,
|
|
resume,
|
|
idle,
|
|
length,
|
|
getQueue,
|
|
unshift,
|
|
empty: noop,
|
|
kill,
|
|
killAndDrain,
|
|
error
|
|
};
|
|
return self2;
|
|
function running() {
|
|
return _running;
|
|
}
|
|
function pause() {
|
|
self2.paused = true;
|
|
}
|
|
function length() {
|
|
var current = queueHead;
|
|
var counter = 0;
|
|
while (current) {
|
|
current = current.next;
|
|
counter++;
|
|
}
|
|
return counter;
|
|
}
|
|
function getQueue() {
|
|
var current = queueHead;
|
|
var tasks = [];
|
|
while (current) {
|
|
tasks.push(current.value);
|
|
current = current.next;
|
|
}
|
|
return tasks;
|
|
}
|
|
function resume() {
|
|
if (!self2.paused)
|
|
return;
|
|
self2.paused = false;
|
|
for (var i = 0; i < self2.concurrency; i++) {
|
|
_running++;
|
|
release();
|
|
}
|
|
}
|
|
function idle() {
|
|
return _running === 0 && self2.length() === 0;
|
|
}
|
|
function push(value, done) {
|
|
var current = cache.get();
|
|
current.context = context;
|
|
current.release = release;
|
|
current.value = value;
|
|
current.callback = done || noop;
|
|
current.errorHandler = errorHandler;
|
|
if (_running === self2.concurrency || self2.paused) {
|
|
if (queueTail) {
|
|
queueTail.next = current;
|
|
queueTail = current;
|
|
} else {
|
|
queueHead = current;
|
|
queueTail = current;
|
|
self2.saturated();
|
|
}
|
|
} else {
|
|
_running++;
|
|
worker.call(context, current.value, current.worked);
|
|
}
|
|
}
|
|
function unshift(value, done) {
|
|
var current = cache.get();
|
|
current.context = context;
|
|
current.release = release;
|
|
current.value = value;
|
|
current.callback = done || noop;
|
|
if (_running === self2.concurrency || self2.paused) {
|
|
if (queueHead) {
|
|
current.next = queueHead;
|
|
queueHead = current;
|
|
} else {
|
|
queueHead = current;
|
|
queueTail = current;
|
|
self2.saturated();
|
|
}
|
|
} else {
|
|
_running++;
|
|
worker.call(context, current.value, current.worked);
|
|
}
|
|
}
|
|
function release(holder) {
|
|
if (holder) {
|
|
cache.release(holder);
|
|
}
|
|
var next = queueHead;
|
|
if (next) {
|
|
if (!self2.paused) {
|
|
if (queueTail === queueHead) {
|
|
queueTail = null;
|
|
}
|
|
queueHead = next.next;
|
|
next.next = null;
|
|
worker.call(context, next.value, next.worked);
|
|
if (queueTail === null) {
|
|
self2.empty();
|
|
}
|
|
} else {
|
|
_running--;
|
|
}
|
|
} else if (--_running === 0) {
|
|
self2.drain();
|
|
}
|
|
}
|
|
function kill() {
|
|
queueHead = null;
|
|
queueTail = null;
|
|
self2.drain = noop;
|
|
}
|
|
function killAndDrain() {
|
|
queueHead = null;
|
|
queueTail = null;
|
|
self2.drain();
|
|
self2.drain = noop;
|
|
}
|
|
function error(handler) {
|
|
errorHandler = handler;
|
|
}
|
|
}
|
|
function noop() {
|
|
}
|
|
function Task() {
|
|
this.value = null;
|
|
this.callback = noop;
|
|
this.next = null;
|
|
this.release = noop;
|
|
this.context = null;
|
|
this.errorHandler = null;
|
|
var self2 = this;
|
|
this.worked = function worked(err, result) {
|
|
var callback = self2.callback;
|
|
var errorHandler = self2.errorHandler;
|
|
var val = self2.value;
|
|
self2.value = null;
|
|
self2.callback = noop;
|
|
if (self2.errorHandler) {
|
|
errorHandler(err, val);
|
|
}
|
|
callback.call(self2.context, err, result);
|
|
self2.release(self2);
|
|
};
|
|
}
|
|
function queueAsPromised(context, worker, concurrency) {
|
|
if (typeof context === "function") {
|
|
concurrency = worker;
|
|
worker = context;
|
|
context = null;
|
|
}
|
|
function asyncWrapper(arg, cb) {
|
|
worker.call(this, arg).then(function(res) {
|
|
cb(null, res);
|
|
}, cb);
|
|
}
|
|
var queue = fastqueue(context, asyncWrapper, concurrency);
|
|
var pushCb = queue.push;
|
|
var unshiftCb = queue.unshift;
|
|
queue.push = push;
|
|
queue.unshift = unshift;
|
|
queue.drained = drained;
|
|
return queue;
|
|
function push(value) {
|
|
var p = new Promise(function(resolve, reject) {
|
|
pushCb(value, function(err, result) {
|
|
if (err) {
|
|
reject(err);
|
|
return;
|
|
}
|
|
resolve(result);
|
|
});
|
|
});
|
|
p.catch(noop);
|
|
return p;
|
|
}
|
|
function unshift(value) {
|
|
var p = new Promise(function(resolve, reject) {
|
|
unshiftCb(value, function(err, result) {
|
|
if (err) {
|
|
reject(err);
|
|
return;
|
|
}
|
|
resolve(result);
|
|
});
|
|
});
|
|
p.catch(noop);
|
|
return p;
|
|
}
|
|
function drained() {
|
|
var previousDrain = queue.drain;
|
|
var p = new Promise(function(resolve) {
|
|
queue.drain = function() {
|
|
previousDrain();
|
|
resolve();
|
|
};
|
|
});
|
|
return p;
|
|
}
|
|
}
|
|
module2.exports = fastqueue;
|
|
module2.exports.promise = queueAsPromised;
|
|
}
|
|
});
|
|
var require_common2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
|
|
function isFatalError(settings, error) {
|
|
if (settings.errorFilter === null) {
|
|
return true;
|
|
}
|
|
return !settings.errorFilter(error);
|
|
}
|
|
exports2.isFatalError = isFatalError;
|
|
function isAppliedFilter(filter, value) {
|
|
return filter === null || filter(value);
|
|
}
|
|
exports2.isAppliedFilter = isAppliedFilter;
|
|
function replacePathSegmentSeparator(filepath, separator) {
|
|
return filepath.split(/[/\\]/).join(separator);
|
|
}
|
|
exports2.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
function joinPathSegments(a, b, separator) {
|
|
if (a === "") {
|
|
return b;
|
|
}
|
|
if (a.endsWith(separator)) {
|
|
return a + b;
|
|
}
|
|
return a + separator + b;
|
|
}
|
|
exports2.joinPathSegments = joinPathSegments;
|
|
}
|
|
});
|
|
var require_reader = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var common = require_common2();
|
|
var Reader = class {
|
|
constructor(_root, _settings) {
|
|
this._root = _root;
|
|
this._settings = _settings;
|
|
this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
|
}
|
|
};
|
|
exports2.default = Reader;
|
|
}
|
|
});
|
|
var require_async3 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var events_1 = require("events");
|
|
var fsScandir = require_out2();
|
|
var fastq = require_queue();
|
|
var common = require_common2();
|
|
var reader_1 = require_reader();
|
|
var AsyncReader = class extends reader_1.default {
|
|
constructor(_root, _settings) {
|
|
super(_root, _settings);
|
|
this._settings = _settings;
|
|
this._scandir = fsScandir.scandir;
|
|
this._emitter = new events_1.EventEmitter();
|
|
this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
|
this._isFatalError = false;
|
|
this._isDestroyed = false;
|
|
this._queue.drain = () => {
|
|
if (!this._isFatalError) {
|
|
this._emitter.emit("end");
|
|
}
|
|
};
|
|
}
|
|
read() {
|
|
this._isFatalError = false;
|
|
this._isDestroyed = false;
|
|
setImmediate(() => {
|
|
this._pushToQueue(this._root, this._settings.basePath);
|
|
});
|
|
return this._emitter;
|
|
}
|
|
get isDestroyed() {
|
|
return this._isDestroyed;
|
|
}
|
|
destroy() {
|
|
if (this._isDestroyed) {
|
|
throw new Error("The reader is already destroyed");
|
|
}
|
|
this._isDestroyed = true;
|
|
this._queue.killAndDrain();
|
|
}
|
|
onEntry(callback) {
|
|
this._emitter.on("entry", callback);
|
|
}
|
|
onError(callback) {
|
|
this._emitter.once("error", callback);
|
|
}
|
|
onEnd(callback) {
|
|
this._emitter.once("end", callback);
|
|
}
|
|
_pushToQueue(directory, base) {
|
|
const queueItem = {
|
|
directory,
|
|
base
|
|
};
|
|
this._queue.push(queueItem, (error) => {
|
|
if (error !== null) {
|
|
this._handleError(error);
|
|
}
|
|
});
|
|
}
|
|
_worker(item, done) {
|
|
this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
|
|
if (error !== null) {
|
|
done(error, void 0);
|
|
return;
|
|
}
|
|
for (const entry of entries) {
|
|
this._handleEntry(entry, item.base);
|
|
}
|
|
done(null, void 0);
|
|
});
|
|
}
|
|
_handleError(error) {
|
|
if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
|
|
return;
|
|
}
|
|
this._isFatalError = true;
|
|
this._isDestroyed = true;
|
|
this._emitter.emit("error", error);
|
|
}
|
|
_handleEntry(entry, base) {
|
|
if (this._isDestroyed || this._isFatalError) {
|
|
return;
|
|
}
|
|
const fullpath = entry.path;
|
|
if (base !== void 0) {
|
|
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
|
}
|
|
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
|
this._emitEntry(entry);
|
|
}
|
|
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
|
this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
|
}
|
|
}
|
|
_emitEntry(entry) {
|
|
this._emitter.emit("entry", entry);
|
|
}
|
|
};
|
|
exports2.default = AsyncReader;
|
|
}
|
|
});
|
|
var require_async4 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var async_1 = require_async3();
|
|
var AsyncProvider = class {
|
|
constructor(_root, _settings) {
|
|
this._root = _root;
|
|
this._settings = _settings;
|
|
this._reader = new async_1.default(this._root, this._settings);
|
|
this._storage = [];
|
|
}
|
|
read(callback) {
|
|
this._reader.onError((error) => {
|
|
callFailureCallback(callback, error);
|
|
});
|
|
this._reader.onEntry((entry) => {
|
|
this._storage.push(entry);
|
|
});
|
|
this._reader.onEnd(() => {
|
|
callSuccessCallback(callback, this._storage);
|
|
});
|
|
this._reader.read();
|
|
}
|
|
};
|
|
exports2.default = AsyncProvider;
|
|
function callFailureCallback(callback, error) {
|
|
callback(error);
|
|
}
|
|
function callSuccessCallback(callback, entries) {
|
|
callback(null, entries);
|
|
}
|
|
}
|
|
});
|
|
var require_stream2 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var stream_1 = require("stream");
|
|
var async_1 = require_async3();
|
|
var StreamProvider = class {
|
|
constructor(_root, _settings) {
|
|
this._root = _root;
|
|
this._settings = _settings;
|
|
this._reader = new async_1.default(this._root, this._settings);
|
|
this._stream = new stream_1.Readable({
|
|
objectMode: true,
|
|
read: () => {
|
|
},
|
|
destroy: () => {
|
|
if (!this._reader.isDestroyed) {
|
|
this._reader.destroy();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
read() {
|
|
this._reader.onError((error) => {
|
|
this._stream.emit("error", error);
|
|
});
|
|
this._reader.onEntry((entry) => {
|
|
this._stream.push(entry);
|
|
});
|
|
this._reader.onEnd(() => {
|
|
this._stream.push(null);
|
|
});
|
|
this._reader.read();
|
|
return this._stream;
|
|
}
|
|
};
|
|
exports2.default = StreamProvider;
|
|
}
|
|
});
|
|
var require_sync3 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var fsScandir = require_out2();
|
|
var common = require_common2();
|
|
var reader_1 = require_reader();
|
|
var SyncReader = class extends reader_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._scandir = fsScandir.scandirSync;
|
|
this._storage = [];
|
|
this._queue = /* @__PURE__ */ new Set();
|
|
}
|
|
read() {
|
|
this._pushToQueue(this._root, this._settings.basePath);
|
|
this._handleQueue();
|
|
return this._storage;
|
|
}
|
|
_pushToQueue(directory, base) {
|
|
this._queue.add({
|
|
directory,
|
|
base
|
|
});
|
|
}
|
|
_handleQueue() {
|
|
for (const item of this._queue.values()) {
|
|
this._handleDirectory(item.directory, item.base);
|
|
}
|
|
}
|
|
_handleDirectory(directory, base) {
|
|
try {
|
|
const entries = this._scandir(directory, this._settings.fsScandirSettings);
|
|
for (const entry of entries) {
|
|
this._handleEntry(entry, base);
|
|
}
|
|
} catch (error) {
|
|
this._handleError(error);
|
|
}
|
|
}
|
|
_handleError(error) {
|
|
if (!common.isFatalError(this._settings, error)) {
|
|
return;
|
|
}
|
|
throw error;
|
|
}
|
|
_handleEntry(entry, base) {
|
|
const fullpath = entry.path;
|
|
if (base !== void 0) {
|
|
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
|
}
|
|
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
|
this._pushToStorage(entry);
|
|
}
|
|
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
|
this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
|
}
|
|
}
|
|
_pushToStorage(entry) {
|
|
this._storage.push(entry);
|
|
}
|
|
};
|
|
exports2.default = SyncReader;
|
|
}
|
|
});
|
|
var require_sync4 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var sync_1 = require_sync3();
|
|
var SyncProvider = class {
|
|
constructor(_root, _settings) {
|
|
this._root = _root;
|
|
this._settings = _settings;
|
|
this._reader = new sync_1.default(this._root, this._settings);
|
|
}
|
|
read() {
|
|
return this._reader.read();
|
|
}
|
|
};
|
|
exports2.default = SyncProvider;
|
|
}
|
|
});
|
|
var require_settings3 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var path = require("path");
|
|
var fsScandir = require_out2();
|
|
var Settings = class {
|
|
constructor(_options = {}) {
|
|
this._options = _options;
|
|
this.basePath = this._getValue(this._options.basePath, void 0);
|
|
this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
|
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
fs: this._options.fs,
|
|
pathSegmentSeparator: this._options.pathSegmentSeparator,
|
|
stats: this._options.stats,
|
|
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
|
|
});
|
|
}
|
|
_getValue(option, value) {
|
|
return option !== null && option !== void 0 ? option : value;
|
|
}
|
|
};
|
|
exports2.default = Settings;
|
|
}
|
|
});
|
|
var require_out3 = __commonJS2({
|
|
"node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
|
|
var async_1 = require_async4();
|
|
var stream_1 = require_stream2();
|
|
var sync_1 = require_sync4();
|
|
var settings_1 = require_settings3();
|
|
exports2.Settings = settings_1.default;
|
|
function walk(directory, optionsOrSettingsOrCallback, callback) {
|
|
if (typeof optionsOrSettingsOrCallback === "function") {
|
|
new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
|
|
return;
|
|
}
|
|
new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
|
|
}
|
|
exports2.walk = walk;
|
|
function walkSync(directory, optionsOrSettings) {
|
|
const settings = getSettings(optionsOrSettings);
|
|
const provider = new sync_1.default(directory, settings);
|
|
return provider.read();
|
|
}
|
|
exports2.walkSync = walkSync;
|
|
function walkStream(directory, optionsOrSettings) {
|
|
const settings = getSettings(optionsOrSettings);
|
|
const provider = new stream_1.default(directory, settings);
|
|
return provider.read();
|
|
}
|
|
exports2.walkStream = walkStream;
|
|
function getSettings(settingsOrOptions = {}) {
|
|
if (settingsOrOptions instanceof settings_1.default) {
|
|
return settingsOrOptions;
|
|
}
|
|
return new settings_1.default(settingsOrOptions);
|
|
}
|
|
}
|
|
});
|
|
var require_reader2 = __commonJS2({
|
|
"node_modules/fast-glob/out/readers/reader.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var path = require("path");
|
|
var fsStat = require_out();
|
|
var utils = require_utils4();
|
|
var Reader = class {
|
|
constructor(_settings) {
|
|
this._settings = _settings;
|
|
this._fsStatSettings = new fsStat.Settings({
|
|
followSymbolicLink: this._settings.followSymbolicLinks,
|
|
fs: this._settings.fs,
|
|
throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
|
|
});
|
|
}
|
|
_getFullEntryPath(filepath) {
|
|
return path.resolve(this._settings.cwd, filepath);
|
|
}
|
|
_makeEntry(stats, pattern) {
|
|
const entry = {
|
|
name: pattern,
|
|
path: pattern,
|
|
dirent: utils.fs.createDirentFromStats(pattern, stats)
|
|
};
|
|
if (this._settings.stats) {
|
|
entry.stats = stats;
|
|
}
|
|
return entry;
|
|
}
|
|
_isFatalError(error) {
|
|
return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
|
|
}
|
|
};
|
|
exports2.default = Reader;
|
|
}
|
|
});
|
|
var require_stream3 = __commonJS2({
|
|
"node_modules/fast-glob/out/readers/stream.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var stream_1 = require("stream");
|
|
var fsStat = require_out();
|
|
var fsWalk = require_out3();
|
|
var reader_1 = require_reader2();
|
|
var ReaderStream = class extends reader_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._walkStream = fsWalk.walkStream;
|
|
this._stat = fsStat.stat;
|
|
}
|
|
dynamic(root, options) {
|
|
return this._walkStream(root, options);
|
|
}
|
|
static(patterns, options) {
|
|
const filepaths = patterns.map(this._getFullEntryPath, this);
|
|
const stream = new stream_1.PassThrough({
|
|
objectMode: true
|
|
});
|
|
stream._write = (index, _enc, done) => {
|
|
return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
|
|
if (entry !== null && options.entryFilter(entry)) {
|
|
stream.push(entry);
|
|
}
|
|
if (index === filepaths.length - 1) {
|
|
stream.end();
|
|
}
|
|
done();
|
|
}).catch(done);
|
|
};
|
|
for (let i = 0; i < filepaths.length; i++) {
|
|
stream.write(i);
|
|
}
|
|
return stream;
|
|
}
|
|
_getEntry(filepath, pattern, options) {
|
|
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
|
|
if (options.errorFilter(error)) {
|
|
return null;
|
|
}
|
|
throw error;
|
|
});
|
|
}
|
|
_getStat(filepath) {
|
|
return new Promise((resolve, reject) => {
|
|
this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
|
return error === null ? resolve(stats) : reject(error);
|
|
});
|
|
});
|
|
}
|
|
};
|
|
exports2.default = ReaderStream;
|
|
}
|
|
});
|
|
var require_async5 = __commonJS2({
|
|
"node_modules/fast-glob/out/readers/async.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var fsWalk = require_out3();
|
|
var reader_1 = require_reader2();
|
|
var stream_1 = require_stream3();
|
|
var ReaderAsync = class extends reader_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._walkAsync = fsWalk.walk;
|
|
this._readerStream = new stream_1.default(this._settings);
|
|
}
|
|
dynamic(root, options) {
|
|
return new Promise((resolve, reject) => {
|
|
this._walkAsync(root, options, (error, entries) => {
|
|
if (error === null) {
|
|
resolve(entries);
|
|
} else {
|
|
reject(error);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
async static(patterns, options) {
|
|
const entries = [];
|
|
const stream = this._readerStream.static(patterns, options);
|
|
return new Promise((resolve, reject) => {
|
|
stream.once("error", reject);
|
|
stream.on("data", (entry) => entries.push(entry));
|
|
stream.once("end", () => resolve(entries));
|
|
});
|
|
}
|
|
};
|
|
exports2.default = ReaderAsync;
|
|
}
|
|
});
|
|
var require_matcher = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var utils = require_utils4();
|
|
var Matcher = class {
|
|
constructor(_patterns, _settings, _micromatchOptions) {
|
|
this._patterns = _patterns;
|
|
this._settings = _settings;
|
|
this._micromatchOptions = _micromatchOptions;
|
|
this._storage = [];
|
|
this._fillStorage();
|
|
}
|
|
_fillStorage() {
|
|
const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns);
|
|
for (const pattern of patterns) {
|
|
const segments = this._getPatternSegments(pattern);
|
|
const sections = this._splitSegmentsIntoSections(segments);
|
|
this._storage.push({
|
|
complete: sections.length <= 1,
|
|
pattern,
|
|
segments,
|
|
sections
|
|
});
|
|
}
|
|
}
|
|
_getPatternSegments(pattern) {
|
|
const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
|
|
return parts.map((part) => {
|
|
const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
|
|
if (!dynamic) {
|
|
return {
|
|
dynamic: false,
|
|
pattern: part
|
|
};
|
|
}
|
|
return {
|
|
dynamic: true,
|
|
pattern: part,
|
|
patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
|
|
};
|
|
});
|
|
}
|
|
_splitSegmentsIntoSections(segments) {
|
|
return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
|
|
}
|
|
};
|
|
exports2.default = Matcher;
|
|
}
|
|
});
|
|
var require_partial = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var matcher_1 = require_matcher();
|
|
var PartialMatcher = class extends matcher_1.default {
|
|
match(filepath) {
|
|
const parts = filepath.split("/");
|
|
const levels = parts.length;
|
|
const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
|
|
for (const pattern of patterns) {
|
|
const section = pattern.sections[0];
|
|
if (!pattern.complete && levels > section.length) {
|
|
return true;
|
|
}
|
|
const match = parts.every((part, index) => {
|
|
const segment = pattern.segments[index];
|
|
if (segment.dynamic && segment.patternRe.test(part)) {
|
|
return true;
|
|
}
|
|
if (!segment.dynamic && segment.pattern === part) {
|
|
return true;
|
|
}
|
|
return false;
|
|
});
|
|
if (match) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
exports2.default = PartialMatcher;
|
|
}
|
|
});
|
|
var require_deep = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var utils = require_utils4();
|
|
var partial_1 = require_partial();
|
|
var DeepFilter = class {
|
|
constructor(_settings, _micromatchOptions) {
|
|
this._settings = _settings;
|
|
this._micromatchOptions = _micromatchOptions;
|
|
}
|
|
getFilter(basePath, positive, negative) {
|
|
const matcher = this._getMatcher(positive);
|
|
const negativeRe = this._getNegativePatternsRe(negative);
|
|
return (entry) => this._filter(basePath, entry, matcher, negativeRe);
|
|
}
|
|
_getMatcher(patterns) {
|
|
return new partial_1.default(patterns, this._settings, this._micromatchOptions);
|
|
}
|
|
_getNegativePatternsRe(patterns) {
|
|
const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
|
|
return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
|
|
}
|
|
_filter(basePath, entry, matcher, negativeRe) {
|
|
if (this._isSkippedByDeep(basePath, entry.path)) {
|
|
return false;
|
|
}
|
|
if (this._isSkippedSymbolicLink(entry)) {
|
|
return false;
|
|
}
|
|
const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
|
if (this._isSkippedByPositivePatterns(filepath, matcher)) {
|
|
return false;
|
|
}
|
|
return this._isSkippedByNegativePatterns(filepath, negativeRe);
|
|
}
|
|
_isSkippedByDeep(basePath, entryPath) {
|
|
if (this._settings.deep === Infinity) {
|
|
return false;
|
|
}
|
|
return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
|
|
}
|
|
_getEntryLevel(basePath, entryPath) {
|
|
const entryPathDepth = entryPath.split("/").length;
|
|
if (basePath === "") {
|
|
return entryPathDepth;
|
|
}
|
|
const basePathDepth = basePath.split("/").length;
|
|
return entryPathDepth - basePathDepth;
|
|
}
|
|
_isSkippedSymbolicLink(entry) {
|
|
return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
|
|
}
|
|
_isSkippedByPositivePatterns(entryPath, matcher) {
|
|
return !this._settings.baseNameMatch && !matcher.match(entryPath);
|
|
}
|
|
_isSkippedByNegativePatterns(entryPath, patternsRe) {
|
|
return !utils.pattern.matchAny(entryPath, patternsRe);
|
|
}
|
|
};
|
|
exports2.default = DeepFilter;
|
|
}
|
|
});
|
|
var require_entry = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var utils = require_utils4();
|
|
var EntryFilter = class {
|
|
constructor(_settings, _micromatchOptions) {
|
|
this._settings = _settings;
|
|
this._micromatchOptions = _micromatchOptions;
|
|
this.index = /* @__PURE__ */ new Map();
|
|
}
|
|
getFilter(positive, negative) {
|
|
const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
|
|
const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions);
|
|
return (entry) => this._filter(entry, positiveRe, negativeRe);
|
|
}
|
|
_filter(entry, positiveRe, negativeRe) {
|
|
if (this._settings.unique && this._isDuplicateEntry(entry)) {
|
|
return false;
|
|
}
|
|
if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
|
|
return false;
|
|
}
|
|
if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
|
|
return false;
|
|
}
|
|
const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
|
|
const isDirectory = entry.dirent.isDirectory();
|
|
const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(entry.path, negativeRe, isDirectory);
|
|
if (this._settings.unique && isMatched) {
|
|
this._createIndexRecord(entry);
|
|
}
|
|
return isMatched;
|
|
}
|
|
_isDuplicateEntry(entry) {
|
|
return this.index.has(entry.path);
|
|
}
|
|
_createIndexRecord(entry) {
|
|
this.index.set(entry.path, void 0);
|
|
}
|
|
_onlyFileFilter(entry) {
|
|
return this._settings.onlyFiles && !entry.dirent.isFile();
|
|
}
|
|
_onlyDirectoryFilter(entry) {
|
|
return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
|
}
|
|
_isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
|
|
if (!this._settings.absolute) {
|
|
return false;
|
|
}
|
|
const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
|
|
return utils.pattern.matchAny(fullpath, patternsRe);
|
|
}
|
|
_isMatchToPatterns(entryPath, patternsRe, isDirectory) {
|
|
const filepath = utils.path.removeLeadingDotSegment(entryPath);
|
|
const isMatched = utils.pattern.matchAny(filepath, patternsRe);
|
|
if (!isMatched && isDirectory) {
|
|
return utils.pattern.matchAny(filepath + "/", patternsRe);
|
|
}
|
|
return isMatched;
|
|
}
|
|
};
|
|
exports2.default = EntryFilter;
|
|
}
|
|
});
|
|
var require_error = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var utils = require_utils4();
|
|
var ErrorFilter = class {
|
|
constructor(_settings) {
|
|
this._settings = _settings;
|
|
}
|
|
getFilter() {
|
|
return (error) => this._isNonFatalError(error);
|
|
}
|
|
_isNonFatalError(error) {
|
|
return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
|
|
}
|
|
};
|
|
exports2.default = ErrorFilter;
|
|
}
|
|
});
|
|
var require_entry2 = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var utils = require_utils4();
|
|
var EntryTransformer = class {
|
|
constructor(_settings) {
|
|
this._settings = _settings;
|
|
}
|
|
getTransformer() {
|
|
return (entry) => this._transform(entry);
|
|
}
|
|
_transform(entry) {
|
|
let filepath = entry.path;
|
|
if (this._settings.absolute) {
|
|
filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
|
filepath = utils.path.unixify(filepath);
|
|
}
|
|
if (this._settings.markDirectories && entry.dirent.isDirectory()) {
|
|
filepath += "/";
|
|
}
|
|
if (!this._settings.objectMode) {
|
|
return filepath;
|
|
}
|
|
return Object.assign(Object.assign({}, entry), {
|
|
path: filepath
|
|
});
|
|
}
|
|
};
|
|
exports2.default = EntryTransformer;
|
|
}
|
|
});
|
|
var require_provider = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/provider.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var path = require("path");
|
|
var deep_1 = require_deep();
|
|
var entry_1 = require_entry();
|
|
var error_1 = require_error();
|
|
var entry_2 = require_entry2();
|
|
var Provider = class {
|
|
constructor(_settings) {
|
|
this._settings = _settings;
|
|
this.errorFilter = new error_1.default(this._settings);
|
|
this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
|
|
this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
}
|
|
_getRootDirectory(task) {
|
|
return path.resolve(this._settings.cwd, task.base);
|
|
}
|
|
_getReaderOptions(task) {
|
|
const basePath = task.base === "." ? "" : task.base;
|
|
return {
|
|
basePath,
|
|
pathSegmentSeparator: "/",
|
|
concurrency: this._settings.concurrency,
|
|
deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
|
|
entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
|
|
errorFilter: this.errorFilter.getFilter(),
|
|
followSymbolicLinks: this._settings.followSymbolicLinks,
|
|
fs: this._settings.fs,
|
|
stats: this._settings.stats,
|
|
throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
|
|
transform: this.entryTransformer.getTransformer()
|
|
};
|
|
}
|
|
_getMicromatchOptions() {
|
|
return {
|
|
dot: this._settings.dot,
|
|
matchBase: this._settings.baseNameMatch,
|
|
nobrace: !this._settings.braceExpansion,
|
|
nocase: !this._settings.caseSensitiveMatch,
|
|
noext: !this._settings.extglob,
|
|
noglobstar: !this._settings.globstar,
|
|
posix: true,
|
|
strictSlashes: false
|
|
};
|
|
}
|
|
};
|
|
exports2.default = Provider;
|
|
}
|
|
});
|
|
var require_async6 = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/async.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var async_1 = require_async5();
|
|
var provider_1 = require_provider();
|
|
var ProviderAsync = class extends provider_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._reader = new async_1.default(this._settings);
|
|
}
|
|
async read(task) {
|
|
const root = this._getRootDirectory(task);
|
|
const options = this._getReaderOptions(task);
|
|
const entries = await this.api(root, task, options);
|
|
return entries.map((entry) => options.transform(entry));
|
|
}
|
|
api(root, task, options) {
|
|
if (task.dynamic) {
|
|
return this._reader.dynamic(root, options);
|
|
}
|
|
return this._reader.static(task.patterns, options);
|
|
}
|
|
};
|
|
exports2.default = ProviderAsync;
|
|
}
|
|
});
|
|
var require_stream4 = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/stream.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var stream_1 = require("stream");
|
|
var stream_2 = require_stream3();
|
|
var provider_1 = require_provider();
|
|
var ProviderStream = class extends provider_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._reader = new stream_2.default(this._settings);
|
|
}
|
|
read(task) {
|
|
const root = this._getRootDirectory(task);
|
|
const options = this._getReaderOptions(task);
|
|
const source = this.api(root, task, options);
|
|
const destination = new stream_1.Readable({
|
|
objectMode: true,
|
|
read: () => {
|
|
}
|
|
});
|
|
source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
|
|
destination.once("close", () => source.destroy());
|
|
return destination;
|
|
}
|
|
api(root, task, options) {
|
|
if (task.dynamic) {
|
|
return this._reader.dynamic(root, options);
|
|
}
|
|
return this._reader.static(task.patterns, options);
|
|
}
|
|
};
|
|
exports2.default = ProviderStream;
|
|
}
|
|
});
|
|
var require_sync5 = __commonJS2({
|
|
"node_modules/fast-glob/out/readers/sync.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var fsStat = require_out();
|
|
var fsWalk = require_out3();
|
|
var reader_1 = require_reader2();
|
|
var ReaderSync = class extends reader_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._walkSync = fsWalk.walkSync;
|
|
this._statSync = fsStat.statSync;
|
|
}
|
|
dynamic(root, options) {
|
|
return this._walkSync(root, options);
|
|
}
|
|
static(patterns, options) {
|
|
const entries = [];
|
|
for (const pattern of patterns) {
|
|
const filepath = this._getFullEntryPath(pattern);
|
|
const entry = this._getEntry(filepath, pattern, options);
|
|
if (entry === null || !options.entryFilter(entry)) {
|
|
continue;
|
|
}
|
|
entries.push(entry);
|
|
}
|
|
return entries;
|
|
}
|
|
_getEntry(filepath, pattern, options) {
|
|
try {
|
|
const stats = this._getStat(filepath);
|
|
return this._makeEntry(stats, pattern);
|
|
} catch (error) {
|
|
if (options.errorFilter(error)) {
|
|
return null;
|
|
}
|
|
throw error;
|
|
}
|
|
}
|
|
_getStat(filepath) {
|
|
return this._statSync(filepath, this._fsStatSettings);
|
|
}
|
|
};
|
|
exports2.default = ReaderSync;
|
|
}
|
|
});
|
|
var require_sync6 = __commonJS2({
|
|
"node_modules/fast-glob/out/providers/sync.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
var sync_1 = require_sync5();
|
|
var provider_1 = require_provider();
|
|
var ProviderSync = class extends provider_1.default {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._reader = new sync_1.default(this._settings);
|
|
}
|
|
read(task) {
|
|
const root = this._getRootDirectory(task);
|
|
const options = this._getReaderOptions(task);
|
|
const entries = this.api(root, task, options);
|
|
return entries.map(options.transform);
|
|
}
|
|
api(root, task, options) {
|
|
if (task.dynamic) {
|
|
return this._reader.dynamic(root, options);
|
|
}
|
|
return this._reader.static(task.patterns, options);
|
|
}
|
|
};
|
|
exports2.default = ProviderSync;
|
|
}
|
|
});
|
|
var require_settings4 = __commonJS2({
|
|
"node_modules/fast-glob/out/settings.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
var fs = require("fs");
|
|
var os2 = require("os");
|
|
var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
lstat: fs.lstat,
|
|
lstatSync: fs.lstatSync,
|
|
stat: fs.stat,
|
|
statSync: fs.statSync,
|
|
readdir: fs.readdir,
|
|
readdirSync: fs.readdirSync
|
|
};
|
|
var Settings = class {
|
|
constructor(_options = {}) {
|
|
this._options = _options;
|
|
this.absolute = this._getValue(this._options.absolute, false);
|
|
this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
|
|
this.braceExpansion = this._getValue(this._options.braceExpansion, true);
|
|
this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
|
|
this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
|
|
this.cwd = this._getValue(this._options.cwd, process.cwd());
|
|
this.deep = this._getValue(this._options.deep, Infinity);
|
|
this.dot = this._getValue(this._options.dot, false);
|
|
this.extglob = this._getValue(this._options.extglob, true);
|
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
|
|
this.fs = this._getFileSystemMethods(this._options.fs);
|
|
this.globstar = this._getValue(this._options.globstar, true);
|
|
this.ignore = this._getValue(this._options.ignore, []);
|
|
this.markDirectories = this._getValue(this._options.markDirectories, false);
|
|
this.objectMode = this._getValue(this._options.objectMode, false);
|
|
this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
|
|
this.onlyFiles = this._getValue(this._options.onlyFiles, true);
|
|
this.stats = this._getValue(this._options.stats, false);
|
|
this.suppressErrors = this._getValue(this._options.suppressErrors, false);
|
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
|
|
this.unique = this._getValue(this._options.unique, true);
|
|
if (this.onlyDirectories) {
|
|
this.onlyFiles = false;
|
|
}
|
|
if (this.stats) {
|
|
this.objectMode = true;
|
|
}
|
|
}
|
|
_getValue(option, value) {
|
|
return option === void 0 ? value : option;
|
|
}
|
|
_getFileSystemMethods(methods = {}) {
|
|
return Object.assign(Object.assign({}, exports2.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
|
|
}
|
|
};
|
|
exports2.default = Settings;
|
|
}
|
|
});
|
|
var require_out4 = __commonJS2({
|
|
"node_modules/fast-glob/out/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var taskManager = require_tasks();
|
|
var patternManager = require_patterns();
|
|
var async_1 = require_async6();
|
|
var stream_1 = require_stream4();
|
|
var sync_1 = require_sync6();
|
|
var settings_1 = require_settings4();
|
|
var utils = require_utils4();
|
|
async function FastGlob(source, options) {
|
|
assertPatternsInput(source);
|
|
const works = getWorks(source, async_1.default, options);
|
|
const result = await Promise.all(works);
|
|
return utils.array.flatten(result);
|
|
}
|
|
(function(FastGlob2) {
|
|
function sync(source, options) {
|
|
assertPatternsInput(source);
|
|
const works = getWorks(source, sync_1.default, options);
|
|
return utils.array.flatten(works);
|
|
}
|
|
FastGlob2.sync = sync;
|
|
function stream(source, options) {
|
|
assertPatternsInput(source);
|
|
const works = getWorks(source, stream_1.default, options);
|
|
return utils.stream.merge(works);
|
|
}
|
|
FastGlob2.stream = stream;
|
|
function generateTasks(source, options) {
|
|
assertPatternsInput(source);
|
|
const patterns = patternManager.transform([].concat(source));
|
|
const settings = new settings_1.default(options);
|
|
return taskManager.generate(patterns, settings);
|
|
}
|
|
FastGlob2.generateTasks = generateTasks;
|
|
function isDynamicPattern(source, options) {
|
|
assertPatternsInput(source);
|
|
const settings = new settings_1.default(options);
|
|
return utils.pattern.isDynamicPattern(source, settings);
|
|
}
|
|
FastGlob2.isDynamicPattern = isDynamicPattern;
|
|
function escapePath(source) {
|
|
assertPatternsInput(source);
|
|
return utils.path.escape(source);
|
|
}
|
|
FastGlob2.escapePath = escapePath;
|
|
})(FastGlob || (FastGlob = {}));
|
|
function getWorks(source, _Provider, options) {
|
|
const patterns = patternManager.transform([].concat(source));
|
|
const settings = new settings_1.default(options);
|
|
const tasks = taskManager.generate(patterns, settings);
|
|
const provider = new _Provider(settings);
|
|
return tasks.map(provider.read, provider);
|
|
}
|
|
function assertPatternsInput(input) {
|
|
const source = [].concat(input);
|
|
const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
|
|
if (!isValidSource) {
|
|
throw new TypeError("Patterns must be a string (non empty) or an array of strings");
|
|
}
|
|
}
|
|
module2.exports = FastGlob;
|
|
}
|
|
});
|
|
var require_expand_patterns = __commonJS2({
|
|
"src/cli/expand-patterns.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var fastGlob = require_out4();
|
|
var {
|
|
statSafe
|
|
} = require_utils();
|
|
async function* expandPatterns(context) {
|
|
const cwd = process.cwd();
|
|
const seen = /* @__PURE__ */ new Set();
|
|
let noResults = true;
|
|
for await (const pathOrError of expandPatternsInternal(context)) {
|
|
noResults = false;
|
|
if (typeof pathOrError !== "string") {
|
|
yield pathOrError;
|
|
continue;
|
|
}
|
|
const relativePath = path.relative(cwd, pathOrError);
|
|
if (seen.has(relativePath)) {
|
|
continue;
|
|
}
|
|
seen.add(relativePath);
|
|
yield relativePath;
|
|
}
|
|
if (noResults && context.argv.errorOnUnmatchedPattern !== false) {
|
|
yield {
|
|
error: `No matching files. Patterns: ${context.filePatterns.join(" ")}`
|
|
};
|
|
}
|
|
}
|
|
async function* expandPatternsInternal(context) {
|
|
const silentlyIgnoredDirs = [".git", ".sl", ".svn", ".hg"];
|
|
if (context.argv.withNodeModules !== true) {
|
|
silentlyIgnoredDirs.push("node_modules");
|
|
}
|
|
const globOptions = {
|
|
dot: true,
|
|
ignore: silentlyIgnoredDirs.map((dir) => "**/" + dir)
|
|
};
|
|
let supportedFilesGlob;
|
|
const cwd = process.cwd();
|
|
const entries = [];
|
|
for (const pattern of context.filePatterns) {
|
|
const absolutePath = path.resolve(cwd, pattern);
|
|
if (containsIgnoredPathSegment(absolutePath, cwd, silentlyIgnoredDirs)) {
|
|
continue;
|
|
}
|
|
const stat = await statSafe(absolutePath);
|
|
if (stat) {
|
|
if (stat.isFile()) {
|
|
entries.push({
|
|
type: "file",
|
|
glob: escapePathForGlob(fixWindowsSlashes(pattern)),
|
|
input: pattern
|
|
});
|
|
} else if (stat.isDirectory()) {
|
|
const relativePath = path.relative(cwd, absolutePath) || ".";
|
|
entries.push({
|
|
type: "dir",
|
|
glob: escapePathForGlob(fixWindowsSlashes(relativePath)) + "/" + getSupportedFilesGlob(),
|
|
input: pattern
|
|
});
|
|
}
|
|
} else if (pattern[0] === "!") {
|
|
globOptions.ignore.push(fixWindowsSlashes(pattern.slice(1)));
|
|
} else {
|
|
entries.push({
|
|
type: "glob",
|
|
glob: fixWindowsSlashes(pattern),
|
|
input: pattern
|
|
});
|
|
}
|
|
}
|
|
for (const {
|
|
type,
|
|
glob,
|
|
input
|
|
} of entries) {
|
|
let result;
|
|
try {
|
|
result = await fastGlob(glob, globOptions);
|
|
} catch ({
|
|
message
|
|
}) {
|
|
yield {
|
|
error: `${errorMessages.globError[type]}: ${input}
|
|
${message}`
|
|
};
|
|
continue;
|
|
}
|
|
if (result.length === 0) {
|
|
if (context.argv.errorOnUnmatchedPattern !== false) {
|
|
yield {
|
|
error: `${errorMessages.emptyResults[type]}: "${input}".`
|
|
};
|
|
}
|
|
} else {
|
|
yield* sortPaths(result);
|
|
}
|
|
}
|
|
function getSupportedFilesGlob() {
|
|
if (!supportedFilesGlob) {
|
|
const extensions = context.languages.flatMap((lang) => lang.extensions || []);
|
|
const filenames = context.languages.flatMap((lang) => lang.filenames || []);
|
|
supportedFilesGlob = `**/{${[...extensions.map((ext) => "*" + (ext[0] === "." ? ext : "." + ext)), ...filenames]}}`;
|
|
}
|
|
return supportedFilesGlob;
|
|
}
|
|
}
|
|
var errorMessages = {
|
|
globError: {
|
|
file: "Unable to resolve file",
|
|
dir: "Unable to expand directory",
|
|
glob: "Unable to expand glob pattern"
|
|
},
|
|
emptyResults: {
|
|
file: "Explicitly specified file was ignored due to negative glob patterns",
|
|
dir: "No supported files were found in the directory",
|
|
glob: "No files matching the pattern were found"
|
|
}
|
|
};
|
|
function containsIgnoredPathSegment(absolutePath, cwd, ignoredDirectories) {
|
|
return path.relative(cwd, absolutePath).split(path.sep).some((dir) => ignoredDirectories.includes(dir));
|
|
}
|
|
function sortPaths(paths) {
|
|
return paths.sort((a, b) => a.localeCompare(b));
|
|
}
|
|
function escapePathForGlob(path2) {
|
|
return fastGlob.escapePath(path2.replace(/\\/g, "\0")).replace(/\\!/g, "@(!)").replace(/\0/g, "@(\\\\)");
|
|
}
|
|
var isWindows = path.sep === "\\";
|
|
function fixWindowsSlashes(pattern) {
|
|
return isWindows ? pattern.replace(/\\/g, "/") : pattern;
|
|
}
|
|
module2.exports = {
|
|
expandPatterns,
|
|
fixWindowsSlashes
|
|
};
|
|
}
|
|
});
|
|
var require_get_options_for_file = __commonJS2({
|
|
"src/cli/options/get-options-for-file.js"(exports2, module2) {
|
|
"use strict";
|
|
var dashify = require_dashify();
|
|
var prettier2 = require("./index.js");
|
|
var {
|
|
optionsNormalizer
|
|
} = require_prettier_internal();
|
|
var minimist = require_minimist2();
|
|
var createMinimistOptions = require_create_minimist_options();
|
|
var normalizeCliOptions = require_normalize_cli_options();
|
|
function getOptions(argv, detailedOptions) {
|
|
return Object.fromEntries(detailedOptions.filter(({
|
|
forwardToApi
|
|
}) => forwardToApi).map(({
|
|
forwardToApi,
|
|
name
|
|
}) => [forwardToApi, argv[name]]));
|
|
}
|
|
function cliifyOptions(object, apiDetailedOptionMap) {
|
|
return Object.fromEntries(Object.entries(object || {}).map(([key, value]) => {
|
|
const apiOption = apiDetailedOptionMap[key];
|
|
const cliKey = apiOption ? apiOption.name : key;
|
|
return [dashify(cliKey), value];
|
|
}));
|
|
}
|
|
function createApiDetailedOptionMap(detailedOptions) {
|
|
return Object.fromEntries(detailedOptions.filter((option) => option.forwardToApi && option.forwardToApi !== option.name).map((option) => [option.forwardToApi, option]));
|
|
}
|
|
function parseArgsToOptions(context, overrideDefaults) {
|
|
const minimistOptions = createMinimistOptions(context.detailedOptions);
|
|
const apiDetailedOptionMap = createApiDetailedOptionMap(context.detailedOptions);
|
|
return getOptions(normalizeCliOptions(minimist(context.rawArguments, {
|
|
string: minimistOptions.string,
|
|
boolean: minimistOptions.boolean,
|
|
default: cliifyOptions(overrideDefaults, apiDetailedOptionMap)
|
|
}), context.detailedOptions, {
|
|
logger: false
|
|
}), context.detailedOptions);
|
|
}
|
|
async function getOptionsOrDie(context, filePath) {
|
|
try {
|
|
if (context.argv.config === false) {
|
|
context.logger.debug("'--no-config' option found, skip loading config file.");
|
|
return null;
|
|
}
|
|
context.logger.debug(context.argv.config ? `load config file from '${context.argv.config}'` : `resolve config from '${filePath}'`);
|
|
const options = await prettier2.resolveConfig(filePath, {
|
|
editorconfig: context.argv.editorconfig,
|
|
config: context.argv.config
|
|
});
|
|
context.logger.debug("loaded options `" + JSON.stringify(options) + "`");
|
|
return options;
|
|
} catch (error) {
|
|
context.logger.error(`Invalid configuration file \`${filePath}\`: ` + error.message);
|
|
process.exit(2);
|
|
}
|
|
}
|
|
function applyConfigPrecedence(context, options) {
|
|
try {
|
|
switch (context.argv.configPrecedence) {
|
|
case "cli-override":
|
|
return parseArgsToOptions(context, options);
|
|
case "file-override":
|
|
return Object.assign(Object.assign({}, parseArgsToOptions(context)), options);
|
|
case "prefer-file":
|
|
return options || parseArgsToOptions(context);
|
|
}
|
|
} catch (error) {
|
|
context.logger.error(error.toString());
|
|
process.exit(2);
|
|
}
|
|
}
|
|
async function getOptionsForFile(context, filepath) {
|
|
const options = await getOptionsOrDie(context, filepath);
|
|
const hasPlugins = options && options.plugins;
|
|
if (hasPlugins) {
|
|
context.pushContextPlugins(options.plugins);
|
|
}
|
|
const appliedOptions = Object.assign({
|
|
filepath
|
|
}, applyConfigPrecedence(context, options && optionsNormalizer.normalizeApiOptions(options, context.supportOptions, {
|
|
logger: context.logger
|
|
})));
|
|
context.logger.debug(`applied config-precedence (${context.argv.configPrecedence}): ${JSON.stringify(appliedOptions)}`);
|
|
if (hasPlugins) {
|
|
context.popContextPlugins();
|
|
}
|
|
return appliedOptions;
|
|
}
|
|
module2.exports = getOptionsForFile;
|
|
}
|
|
});
|
|
var require_is_tty = __commonJS2({
|
|
"src/cli/is-tty.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
isCI
|
|
} = require("./third-party.js");
|
|
module2.exports = function isTTY() {
|
|
return process.stdout.isTTY && !isCI();
|
|
};
|
|
}
|
|
});
|
|
var require_commondir = __commonJS2({
|
|
"node_modules/commondir/index.js"(exports2, module2) {
|
|
var path = require("path");
|
|
module2.exports = function(basedir, relfiles) {
|
|
if (relfiles) {
|
|
var files = relfiles.map(function(r) {
|
|
return path.resolve(basedir, r);
|
|
});
|
|
} else {
|
|
var files = basedir;
|
|
}
|
|
var res = files.slice(1).reduce(function(ps, file) {
|
|
if (!file.match(/^([A-Za-z]:)?\/|\\/)) {
|
|
throw new Error("relative path without a basedir");
|
|
}
|
|
var xs = file.split(/\/+|\\+/);
|
|
for (var i = 0; ps[i] === xs[i] && i < Math.min(ps.length, xs.length); i++)
|
|
;
|
|
return ps.slice(0, i);
|
|
}, files[0].split(/\/+|\\+/));
|
|
return res.length > 1 ? res.join("/") : "/";
|
|
};
|
|
}
|
|
});
|
|
var require_p_try = __commonJS2({
|
|
"node_modules/p-try/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var pTry = (fn, ...arguments_) => new Promise((resolve) => {
|
|
resolve(fn(...arguments_));
|
|
});
|
|
module2.exports = pTry;
|
|
module2.exports.default = pTry;
|
|
}
|
|
});
|
|
var require_p_limit = __commonJS2({
|
|
"node_modules/pkg-dir/node_modules/p-limit/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var pTry = require_p_try();
|
|
var pLimit = (concurrency) => {
|
|
if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
|
|
return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));
|
|
}
|
|
const queue = [];
|
|
let activeCount = 0;
|
|
const next = () => {
|
|
activeCount--;
|
|
if (queue.length > 0) {
|
|
queue.shift()();
|
|
}
|
|
};
|
|
const run2 = (fn, resolve, ...args) => {
|
|
activeCount++;
|
|
const result = pTry(fn, ...args);
|
|
resolve(result);
|
|
result.then(next, next);
|
|
};
|
|
const enqueue = (fn, resolve, ...args) => {
|
|
if (activeCount < concurrency) {
|
|
run2(fn, resolve, ...args);
|
|
} else {
|
|
queue.push(run2.bind(null, fn, resolve, ...args));
|
|
}
|
|
};
|
|
const generator = (fn, ...args) => new Promise((resolve) => enqueue(fn, resolve, ...args));
|
|
Object.defineProperties(generator, {
|
|
activeCount: {
|
|
get: () => activeCount
|
|
},
|
|
pendingCount: {
|
|
get: () => queue.length
|
|
},
|
|
clearQueue: {
|
|
value: () => {
|
|
queue.length = 0;
|
|
}
|
|
}
|
|
});
|
|
return generator;
|
|
};
|
|
module2.exports = pLimit;
|
|
module2.exports.default = pLimit;
|
|
}
|
|
});
|
|
var require_p_locate = __commonJS2({
|
|
"node_modules/pkg-dir/node_modules/p-locate/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var pLimit = require_p_limit();
|
|
var EndError = class extends Error {
|
|
constructor(value) {
|
|
super();
|
|
this.value = value;
|
|
}
|
|
};
|
|
var testElement = async (element, tester) => tester(await element);
|
|
var finder = async (element) => {
|
|
const values = await Promise.all(element);
|
|
if (values[1] === true) {
|
|
throw new EndError(values[0]);
|
|
}
|
|
return false;
|
|
};
|
|
var pLocate = async (iterable, tester, options) => {
|
|
options = Object.assign({
|
|
concurrency: Infinity,
|
|
preserveOrder: true
|
|
}, options);
|
|
const limit = pLimit(options.concurrency);
|
|
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
|
|
try {
|
|
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
} catch (error) {
|
|
if (error instanceof EndError) {
|
|
return error.value;
|
|
}
|
|
throw error;
|
|
}
|
|
};
|
|
module2.exports = pLocate;
|
|
module2.exports.default = pLocate;
|
|
}
|
|
});
|
|
var require_locate_path = __commonJS2({
|
|
"node_modules/pkg-dir/node_modules/locate-path/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var fs = require("fs");
|
|
var {
|
|
promisify
|
|
} = require("util");
|
|
var pLocate = require_p_locate();
|
|
var fsStat = promisify(fs.stat);
|
|
var fsLStat = promisify(fs.lstat);
|
|
var typeMappings = {
|
|
directory: "isDirectory",
|
|
file: "isFile"
|
|
};
|
|
function checkType({
|
|
type
|
|
}) {
|
|
if (type in typeMappings) {
|
|
return;
|
|
}
|
|
throw new Error(`Invalid type specified: ${type}`);
|
|
}
|
|
var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
|
|
module2.exports = async (paths, options) => {
|
|
options = Object.assign({
|
|
cwd: process.cwd(),
|
|
type: "file",
|
|
allowSymlinks: true
|
|
}, options);
|
|
checkType(options);
|
|
const statFn = options.allowSymlinks ? fsStat : fsLStat;
|
|
return pLocate(paths, async (path_) => {
|
|
try {
|
|
const stat = await statFn(path.resolve(options.cwd, path_));
|
|
return matchType(options.type, stat);
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
}, options);
|
|
};
|
|
module2.exports.sync = (paths, options) => {
|
|
options = Object.assign({
|
|
cwd: process.cwd(),
|
|
allowSymlinks: true,
|
|
type: "file"
|
|
}, options);
|
|
checkType(options);
|
|
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
|
|
for (const path_ of paths) {
|
|
try {
|
|
const stat = statFn(path.resolve(options.cwd, path_));
|
|
if (matchType(options.type, stat)) {
|
|
return path_;
|
|
}
|
|
} catch (_) {
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_path_exists = __commonJS2({
|
|
"node_modules/path-exists/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var fs = require("fs");
|
|
var {
|
|
promisify
|
|
} = require("util");
|
|
var pAccess = promisify(fs.access);
|
|
module2.exports = async (path) => {
|
|
try {
|
|
await pAccess(path);
|
|
return true;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
};
|
|
module2.exports.sync = (path) => {
|
|
try {
|
|
fs.accessSync(path);
|
|
return true;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_find_up = __commonJS2({
|
|
"node_modules/pkg-dir/node_modules/find-up/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var locatePath = require_locate_path();
|
|
var pathExists = require_path_exists();
|
|
var stop = Symbol("findUp.stop");
|
|
module2.exports = async (name, options = {}) => {
|
|
let directory = path.resolve(options.cwd || "");
|
|
const {
|
|
root
|
|
} = path.parse(directory);
|
|
const paths = [].concat(name);
|
|
const runMatcher = async (locateOptions) => {
|
|
if (typeof name !== "function") {
|
|
return locatePath(paths, locateOptions);
|
|
}
|
|
const foundPath = await name(locateOptions.cwd);
|
|
if (typeof foundPath === "string") {
|
|
return locatePath([foundPath], locateOptions);
|
|
}
|
|
return foundPath;
|
|
};
|
|
while (true) {
|
|
const foundPath = await runMatcher(Object.assign(Object.assign({}, options), {}, {
|
|
cwd: directory
|
|
}));
|
|
if (foundPath === stop) {
|
|
return;
|
|
}
|
|
if (foundPath) {
|
|
return path.resolve(directory, foundPath);
|
|
}
|
|
if (directory === root) {
|
|
return;
|
|
}
|
|
directory = path.dirname(directory);
|
|
}
|
|
};
|
|
module2.exports.sync = (name, options = {}) => {
|
|
let directory = path.resolve(options.cwd || "");
|
|
const {
|
|
root
|
|
} = path.parse(directory);
|
|
const paths = [].concat(name);
|
|
const runMatcher = (locateOptions) => {
|
|
if (typeof name !== "function") {
|
|
return locatePath.sync(paths, locateOptions);
|
|
}
|
|
const foundPath = name(locateOptions.cwd);
|
|
if (typeof foundPath === "string") {
|
|
return locatePath.sync([foundPath], locateOptions);
|
|
}
|
|
return foundPath;
|
|
};
|
|
while (true) {
|
|
const foundPath = runMatcher(Object.assign(Object.assign({}, options), {}, {
|
|
cwd: directory
|
|
}));
|
|
if (foundPath === stop) {
|
|
return;
|
|
}
|
|
if (foundPath) {
|
|
return path.resolve(directory, foundPath);
|
|
}
|
|
if (directory === root) {
|
|
return;
|
|
}
|
|
directory = path.dirname(directory);
|
|
}
|
|
};
|
|
module2.exports.exists = pathExists;
|
|
module2.exports.sync.exists = pathExists.sync;
|
|
module2.exports.stop = stop;
|
|
}
|
|
});
|
|
var require_pkg_dir = __commonJS2({
|
|
"node_modules/pkg-dir/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var findUp = require_find_up();
|
|
var pkgDir = async (cwd) => {
|
|
const filePath = await findUp("package.json", {
|
|
cwd
|
|
});
|
|
return filePath && path.dirname(filePath);
|
|
};
|
|
module2.exports = pkgDir;
|
|
module2.exports.default = pkgDir;
|
|
module2.exports.sync = (cwd) => {
|
|
const filePath = findUp.sync("package.json", {
|
|
cwd
|
|
});
|
|
return filePath && path.dirname(filePath);
|
|
};
|
|
}
|
|
});
|
|
var require_semver = __commonJS2({
|
|
"node_modules/make-dir/node_modules/semver/semver.js"(exports2, module2) {
|
|
exports2 = module2.exports = SemVer;
|
|
var debug;
|
|
if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
debug = function() {
|
|
var args = Array.prototype.slice.call(arguments, 0);
|
|
args.unshift("SEMVER");
|
|
console.log.apply(console, args);
|
|
};
|
|
} else {
|
|
debug = function() {
|
|
};
|
|
}
|
|
exports2.SEMVER_SPEC_VERSION = "2.0.0";
|
|
var MAX_LENGTH = 256;
|
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
var re = exports2.re = [];
|
|
var src = exports2.src = [];
|
|
var t = exports2.tokens = {};
|
|
var R = 0;
|
|
function tok(n) {
|
|
t[n] = R++;
|
|
}
|
|
tok("NUMERICIDENTIFIER");
|
|
src[t.NUMERICIDENTIFIER] = "0|[1-9]\\d*";
|
|
tok("NUMERICIDENTIFIERLOOSE");
|
|
src[t.NUMERICIDENTIFIERLOOSE] = "[0-9]+";
|
|
tok("NONNUMERICIDENTIFIER");
|
|
src[t.NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-][a-zA-Z0-9-]*";
|
|
tok("MAINVERSION");
|
|
src[t.MAINVERSION] = "(" + src[t.NUMERICIDENTIFIER] + ")\\.(" + src[t.NUMERICIDENTIFIER] + ")\\.(" + src[t.NUMERICIDENTIFIER] + ")";
|
|
tok("MAINVERSIONLOOSE");
|
|
src[t.MAINVERSIONLOOSE] = "(" + src[t.NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[t.NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[t.NUMERICIDENTIFIERLOOSE] + ")";
|
|
tok("PRERELEASEIDENTIFIER");
|
|
src[t.PRERELEASEIDENTIFIER] = "(?:" + src[t.NUMERICIDENTIFIER] + "|" + src[t.NONNUMERICIDENTIFIER] + ")";
|
|
tok("PRERELEASEIDENTIFIERLOOSE");
|
|
src[t.PRERELEASEIDENTIFIERLOOSE] = "(?:" + src[t.NUMERICIDENTIFIERLOOSE] + "|" + src[t.NONNUMERICIDENTIFIER] + ")";
|
|
tok("PRERELEASE");
|
|
src[t.PRERELEASE] = "(?:-(" + src[t.PRERELEASEIDENTIFIER] + "(?:\\." + src[t.PRERELEASEIDENTIFIER] + ")*))";
|
|
tok("PRERELEASELOOSE");
|
|
src[t.PRERELEASELOOSE] = "(?:-?(" + src[t.PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + src[t.PRERELEASEIDENTIFIERLOOSE] + ")*))";
|
|
tok("BUILDIDENTIFIER");
|
|
src[t.BUILDIDENTIFIER] = "[0-9A-Za-z-]+";
|
|
tok("BUILD");
|
|
src[t.BUILD] = "(?:\\+(" + src[t.BUILDIDENTIFIER] + "(?:\\." + src[t.BUILDIDENTIFIER] + ")*))";
|
|
tok("FULL");
|
|
tok("FULLPLAIN");
|
|
src[t.FULLPLAIN] = "v?" + src[t.MAINVERSION] + src[t.PRERELEASE] + "?" + src[t.BUILD] + "?";
|
|
src[t.FULL] = "^" + src[t.FULLPLAIN] + "$";
|
|
tok("LOOSEPLAIN");
|
|
src[t.LOOSEPLAIN] = "[v=\\s]*" + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + "?" + src[t.BUILD] + "?";
|
|
tok("LOOSE");
|
|
src[t.LOOSE] = "^" + src[t.LOOSEPLAIN] + "$";
|
|
tok("GTLT");
|
|
src[t.GTLT] = "((?:<|>)?=?)";
|
|
tok("XRANGEIDENTIFIERLOOSE");
|
|
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + "|x|X|\\*";
|
|
tok("XRANGEIDENTIFIER");
|
|
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + "|x|X|\\*";
|
|
tok("XRANGEPLAIN");
|
|
src[t.XRANGEPLAIN] = "[v=\\s]*(" + src[t.XRANGEIDENTIFIER] + ")(?:\\.(" + src[t.XRANGEIDENTIFIER] + ")(?:\\.(" + src[t.XRANGEIDENTIFIER] + ")(?:" + src[t.PRERELEASE] + ")?" + src[t.BUILD] + "?)?)?";
|
|
tok("XRANGEPLAINLOOSE");
|
|
src[t.XRANGEPLAINLOOSE] = "[v=\\s]*(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[t.XRANGEIDENTIFIERLOOSE] + ")(?:" + src[t.PRERELEASELOOSE] + ")?" + src[t.BUILD] + "?)?)?";
|
|
tok("XRANGE");
|
|
src[t.XRANGE] = "^" + src[t.GTLT] + "\\s*" + src[t.XRANGEPLAIN] + "$";
|
|
tok("XRANGELOOSE");
|
|
src[t.XRANGELOOSE] = "^" + src[t.GTLT] + "\\s*" + src[t.XRANGEPLAINLOOSE] + "$";
|
|
tok("COERCE");
|
|
src[t.COERCE] = "(^|[^\\d])(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "})(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:$|[^\\d])";
|
|
tok("COERCERTL");
|
|
re[t.COERCERTL] = new RegExp(src[t.COERCE], "g");
|
|
tok("LONETILDE");
|
|
src[t.LONETILDE] = "(?:~>?)";
|
|
tok("TILDETRIM");
|
|
src[t.TILDETRIM] = "(\\s*)" + src[t.LONETILDE] + "\\s+";
|
|
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], "g");
|
|
var tildeTrimReplace = "$1~";
|
|
tok("TILDE");
|
|
src[t.TILDE] = "^" + src[t.LONETILDE] + src[t.XRANGEPLAIN] + "$";
|
|
tok("TILDELOOSE");
|
|
src[t.TILDELOOSE] = "^" + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + "$";
|
|
tok("LONECARET");
|
|
src[t.LONECARET] = "(?:\\^)";
|
|
tok("CARETTRIM");
|
|
src[t.CARETTRIM] = "(\\s*)" + src[t.LONECARET] + "\\s+";
|
|
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], "g");
|
|
var caretTrimReplace = "$1^";
|
|
tok("CARET");
|
|
src[t.CARET] = "^" + src[t.LONECARET] + src[t.XRANGEPLAIN] + "$";
|
|
tok("CARETLOOSE");
|
|
src[t.CARETLOOSE] = "^" + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + "$";
|
|
tok("COMPARATORLOOSE");
|
|
src[t.COMPARATORLOOSE] = "^" + src[t.GTLT] + "\\s*(" + src[t.LOOSEPLAIN] + ")$|^$";
|
|
tok("COMPARATOR");
|
|
src[t.COMPARATOR] = "^" + src[t.GTLT] + "\\s*(" + src[t.FULLPLAIN] + ")$|^$";
|
|
tok("COMPARATORTRIM");
|
|
src[t.COMPARATORTRIM] = "(\\s*)" + src[t.GTLT] + "\\s*(" + src[t.LOOSEPLAIN] + "|" + src[t.XRANGEPLAIN] + ")";
|
|
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], "g");
|
|
var comparatorTrimReplace = "$1$2$3";
|
|
tok("HYPHENRANGE");
|
|
src[t.HYPHENRANGE] = "^\\s*(" + src[t.XRANGEPLAIN] + ")\\s+-\\s+(" + src[t.XRANGEPLAIN] + ")\\s*$";
|
|
tok("HYPHENRANGELOOSE");
|
|
src[t.HYPHENRANGELOOSE] = "^\\s*(" + src[t.XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + src[t.XRANGEPLAINLOOSE] + ")\\s*$";
|
|
tok("STAR");
|
|
src[t.STAR] = "(<|>)?=?\\s*\\*";
|
|
for (i = 0; i < R; i++) {
|
|
debug(i, src[i]);
|
|
if (!re[i]) {
|
|
re[i] = new RegExp(src[i]);
|
|
}
|
|
}
|
|
var i;
|
|
exports2.parse = parse;
|
|
function parse(version, options) {
|
|
if (!options || typeof options !== "object") {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
};
|
|
}
|
|
if (version instanceof SemVer) {
|
|
return version;
|
|
}
|
|
if (typeof version !== "string") {
|
|
return null;
|
|
}
|
|
if (version.length > MAX_LENGTH) {
|
|
return null;
|
|
}
|
|
var r = options.loose ? re[t.LOOSE] : re[t.FULL];
|
|
if (!r.test(version)) {
|
|
return null;
|
|
}
|
|
try {
|
|
return new SemVer(version, options);
|
|
} catch (er) {
|
|
return null;
|
|
}
|
|
}
|
|
exports2.valid = valid;
|
|
function valid(version, options) {
|
|
var v = parse(version, options);
|
|
return v ? v.version : null;
|
|
}
|
|
exports2.clean = clean;
|
|
function clean(version, options) {
|
|
var s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
return s ? s.version : null;
|
|
}
|
|
exports2.SemVer = SemVer;
|
|
function SemVer(version, options) {
|
|
if (!options || typeof options !== "object") {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
};
|
|
}
|
|
if (version instanceof SemVer) {
|
|
if (version.loose === options.loose) {
|
|
return version;
|
|
} else {
|
|
version = version.version;
|
|
}
|
|
} else if (typeof version !== "string") {
|
|
throw new TypeError("Invalid Version: " + version);
|
|
}
|
|
if (version.length > MAX_LENGTH) {
|
|
throw new TypeError("version is longer than " + MAX_LENGTH + " characters");
|
|
}
|
|
if (!(this instanceof SemVer)) {
|
|
return new SemVer(version, options);
|
|
}
|
|
debug("SemVer", version, options);
|
|
this.options = options;
|
|
this.loose = !!options.loose;
|
|
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
if (!m) {
|
|
throw new TypeError("Invalid Version: " + version);
|
|
}
|
|
this.raw = version;
|
|
this.major = +m[1];
|
|
this.minor = +m[2];
|
|
this.patch = +m[3];
|
|
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
throw new TypeError("Invalid major version");
|
|
}
|
|
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
throw new TypeError("Invalid minor version");
|
|
}
|
|
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
throw new TypeError("Invalid patch version");
|
|
}
|
|
if (!m[4]) {
|
|
this.prerelease = [];
|
|
} else {
|
|
this.prerelease = m[4].split(".").map(function(id) {
|
|
if (/^[0-9]+$/.test(id)) {
|
|
var num = +id;
|
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
return num;
|
|
}
|
|
}
|
|
return id;
|
|
});
|
|
}
|
|
this.build = m[5] ? m[5].split(".") : [];
|
|
this.format();
|
|
}
|
|
SemVer.prototype.format = function() {
|
|
this.version = this.major + "." + this.minor + "." + this.patch;
|
|
if (this.prerelease.length) {
|
|
this.version += "-" + this.prerelease.join(".");
|
|
}
|
|
return this.version;
|
|
};
|
|
SemVer.prototype.toString = function() {
|
|
return this.version;
|
|
};
|
|
SemVer.prototype.compare = function(other) {
|
|
debug("SemVer.compare", this.version, this.options, other);
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options);
|
|
}
|
|
return this.compareMain(other) || this.comparePre(other);
|
|
};
|
|
SemVer.prototype.compareMain = function(other) {
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options);
|
|
}
|
|
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
};
|
|
SemVer.prototype.comparePre = function(other) {
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options);
|
|
}
|
|
if (this.prerelease.length && !other.prerelease.length) {
|
|
return -1;
|
|
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
return 1;
|
|
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
return 0;
|
|
}
|
|
var i2 = 0;
|
|
do {
|
|
var a = this.prerelease[i2];
|
|
var b = other.prerelease[i2];
|
|
debug("prerelease compare", i2, a, b);
|
|
if (a === void 0 && b === void 0) {
|
|
return 0;
|
|
} else if (b === void 0) {
|
|
return 1;
|
|
} else if (a === void 0) {
|
|
return -1;
|
|
} else if (a === b) {
|
|
continue;
|
|
} else {
|
|
return compareIdentifiers(a, b);
|
|
}
|
|
} while (++i2);
|
|
};
|
|
SemVer.prototype.compareBuild = function(other) {
|
|
if (!(other instanceof SemVer)) {
|
|
other = new SemVer(other, this.options);
|
|
}
|
|
var i2 = 0;
|
|
do {
|
|
var a = this.build[i2];
|
|
var b = other.build[i2];
|
|
debug("prerelease compare", i2, a, b);
|
|
if (a === void 0 && b === void 0) {
|
|
return 0;
|
|
} else if (b === void 0) {
|
|
return 1;
|
|
} else if (a === void 0) {
|
|
return -1;
|
|
} else if (a === b) {
|
|
continue;
|
|
} else {
|
|
return compareIdentifiers(a, b);
|
|
}
|
|
} while (++i2);
|
|
};
|
|
SemVer.prototype.inc = function(release, identifier) {
|
|
switch (release) {
|
|
case "premajor":
|
|
this.prerelease.length = 0;
|
|
this.patch = 0;
|
|
this.minor = 0;
|
|
this.major++;
|
|
this.inc("pre", identifier);
|
|
break;
|
|
case "preminor":
|
|
this.prerelease.length = 0;
|
|
this.patch = 0;
|
|
this.minor++;
|
|
this.inc("pre", identifier);
|
|
break;
|
|
case "prepatch":
|
|
this.prerelease.length = 0;
|
|
this.inc("patch", identifier);
|
|
this.inc("pre", identifier);
|
|
break;
|
|
case "prerelease":
|
|
if (this.prerelease.length === 0) {
|
|
this.inc("patch", identifier);
|
|
}
|
|
this.inc("pre", identifier);
|
|
break;
|
|
case "major":
|
|
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
this.major++;
|
|
}
|
|
this.minor = 0;
|
|
this.patch = 0;
|
|
this.prerelease = [];
|
|
break;
|
|
case "minor":
|
|
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
this.minor++;
|
|
}
|
|
this.patch = 0;
|
|
this.prerelease = [];
|
|
break;
|
|
case "patch":
|
|
if (this.prerelease.length === 0) {
|
|
this.patch++;
|
|
}
|
|
this.prerelease = [];
|
|
break;
|
|
case "pre":
|
|
if (this.prerelease.length === 0) {
|
|
this.prerelease = [0];
|
|
} else {
|
|
var i2 = this.prerelease.length;
|
|
while (--i2 >= 0) {
|
|
if (typeof this.prerelease[i2] === "number") {
|
|
this.prerelease[i2]++;
|
|
i2 = -2;
|
|
}
|
|
}
|
|
if (i2 === -1) {
|
|
this.prerelease.push(0);
|
|
}
|
|
}
|
|
if (identifier) {
|
|
if (this.prerelease[0] === identifier) {
|
|
if (isNaN(this.prerelease[1])) {
|
|
this.prerelease = [identifier, 0];
|
|
}
|
|
} else {
|
|
this.prerelease = [identifier, 0];
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
throw new Error("invalid increment argument: " + release);
|
|
}
|
|
this.format();
|
|
this.raw = this.version;
|
|
return this;
|
|
};
|
|
exports2.inc = inc;
|
|
function inc(version, release, loose, identifier) {
|
|
if (typeof loose === "string") {
|
|
identifier = loose;
|
|
loose = void 0;
|
|
}
|
|
try {
|
|
return new SemVer(version, loose).inc(release, identifier).version;
|
|
} catch (er) {
|
|
return null;
|
|
}
|
|
}
|
|
exports2.diff = diff;
|
|
function diff(version1, version2) {
|
|
if (eq(version1, version2)) {
|
|
return null;
|
|
} else {
|
|
var v1 = parse(version1);
|
|
var v2 = parse(version2);
|
|
var prefix = "";
|
|
if (v1.prerelease.length || v2.prerelease.length) {
|
|
prefix = "pre";
|
|
var defaultResult = "prerelease";
|
|
}
|
|
for (var key in v1) {
|
|
if (key === "major" || key === "minor" || key === "patch") {
|
|
if (v1[key] !== v2[key]) {
|
|
return prefix + key;
|
|
}
|
|
}
|
|
}
|
|
return defaultResult;
|
|
}
|
|
}
|
|
exports2.compareIdentifiers = compareIdentifiers;
|
|
var numeric = /^[0-9]+$/;
|
|
function compareIdentifiers(a, b) {
|
|
var anum = numeric.test(a);
|
|
var bnum = numeric.test(b);
|
|
if (anum && bnum) {
|
|
a = +a;
|
|
b = +b;
|
|
}
|
|
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
}
|
|
exports2.rcompareIdentifiers = rcompareIdentifiers;
|
|
function rcompareIdentifiers(a, b) {
|
|
return compareIdentifiers(b, a);
|
|
}
|
|
exports2.major = major;
|
|
function major(a, loose) {
|
|
return new SemVer(a, loose).major;
|
|
}
|
|
exports2.minor = minor;
|
|
function minor(a, loose) {
|
|
return new SemVer(a, loose).minor;
|
|
}
|
|
exports2.patch = patch;
|
|
function patch(a, loose) {
|
|
return new SemVer(a, loose).patch;
|
|
}
|
|
exports2.compare = compare;
|
|
function compare(a, b, loose) {
|
|
return new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
}
|
|
exports2.compareLoose = compareLoose;
|
|
function compareLoose(a, b) {
|
|
return compare(a, b, true);
|
|
}
|
|
exports2.compareBuild = compareBuild;
|
|
function compareBuild(a, b, loose) {
|
|
var versionA = new SemVer(a, loose);
|
|
var versionB = new SemVer(b, loose);
|
|
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
}
|
|
exports2.rcompare = rcompare;
|
|
function rcompare(a, b, loose) {
|
|
return compare(b, a, loose);
|
|
}
|
|
exports2.sort = sort;
|
|
function sort(list, loose) {
|
|
return list.sort(function(a, b) {
|
|
return exports2.compareBuild(a, b, loose);
|
|
});
|
|
}
|
|
exports2.rsort = rsort;
|
|
function rsort(list, loose) {
|
|
return list.sort(function(a, b) {
|
|
return exports2.compareBuild(b, a, loose);
|
|
});
|
|
}
|
|
exports2.gt = gt;
|
|
function gt(a, b, loose) {
|
|
return compare(a, b, loose) > 0;
|
|
}
|
|
exports2.lt = lt;
|
|
function lt(a, b, loose) {
|
|
return compare(a, b, loose) < 0;
|
|
}
|
|
exports2.eq = eq;
|
|
function eq(a, b, loose) {
|
|
return compare(a, b, loose) === 0;
|
|
}
|
|
exports2.neq = neq;
|
|
function neq(a, b, loose) {
|
|
return compare(a, b, loose) !== 0;
|
|
}
|
|
exports2.gte = gte;
|
|
function gte(a, b, loose) {
|
|
return compare(a, b, loose) >= 0;
|
|
}
|
|
exports2.lte = lte;
|
|
function lte(a, b, loose) {
|
|
return compare(a, b, loose) <= 0;
|
|
}
|
|
exports2.cmp = cmp;
|
|
function cmp(a, op, b, loose) {
|
|
switch (op) {
|
|
case "===":
|
|
if (typeof a === "object")
|
|
a = a.version;
|
|
if (typeof b === "object")
|
|
b = b.version;
|
|
return a === b;
|
|
case "!==":
|
|
if (typeof a === "object")
|
|
a = a.version;
|
|
if (typeof b === "object")
|
|
b = b.version;
|
|
return a !== b;
|
|
case "":
|
|
case "=":
|
|
case "==":
|
|
return eq(a, b, loose);
|
|
case "!=":
|
|
return neq(a, b, loose);
|
|
case ">":
|
|
return gt(a, b, loose);
|
|
case ">=":
|
|
return gte(a, b, loose);
|
|
case "<":
|
|
return lt(a, b, loose);
|
|
case "<=":
|
|
return lte(a, b, loose);
|
|
default:
|
|
throw new TypeError("Invalid operator: " + op);
|
|
}
|
|
}
|
|
exports2.Comparator = Comparator;
|
|
function Comparator(comp, options) {
|
|
if (!options || typeof options !== "object") {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
};
|
|
}
|
|
if (comp instanceof Comparator) {
|
|
if (comp.loose === !!options.loose) {
|
|
return comp;
|
|
} else {
|
|
comp = comp.value;
|
|
}
|
|
}
|
|
if (!(this instanceof Comparator)) {
|
|
return new Comparator(comp, options);
|
|
}
|
|
debug("comparator", comp, options);
|
|
this.options = options;
|
|
this.loose = !!options.loose;
|
|
this.parse(comp);
|
|
if (this.semver === ANY) {
|
|
this.value = "";
|
|
} else {
|
|
this.value = this.operator + this.semver.version;
|
|
}
|
|
debug("comp", this);
|
|
}
|
|
var ANY = {};
|
|
Comparator.prototype.parse = function(comp) {
|
|
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
var m = comp.match(r);
|
|
if (!m) {
|
|
throw new TypeError("Invalid comparator: " + comp);
|
|
}
|
|
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
if (this.operator === "=") {
|
|
this.operator = "";
|
|
}
|
|
if (!m[2]) {
|
|
this.semver = ANY;
|
|
} else {
|
|
this.semver = new SemVer(m[2], this.options.loose);
|
|
}
|
|
};
|
|
Comparator.prototype.toString = function() {
|
|
return this.value;
|
|
};
|
|
Comparator.prototype.test = function(version) {
|
|
debug("Comparator.test", version, this.options.loose);
|
|
if (this.semver === ANY || version === ANY) {
|
|
return true;
|
|
}
|
|
if (typeof version === "string") {
|
|
try {
|
|
version = new SemVer(version, this.options);
|
|
} catch (er) {
|
|
return false;
|
|
}
|
|
}
|
|
return cmp(version, this.operator, this.semver, this.options);
|
|
};
|
|
Comparator.prototype.intersects = function(comp, options) {
|
|
if (!(comp instanceof Comparator)) {
|
|
throw new TypeError("a Comparator is required");
|
|
}
|
|
if (!options || typeof options !== "object") {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
};
|
|
}
|
|
var rangeTmp;
|
|
if (this.operator === "") {
|
|
if (this.value === "") {
|
|
return true;
|
|
}
|
|
rangeTmp = new Range(comp.value, options);
|
|
return satisfies(this.value, rangeTmp, options);
|
|
} else if (comp.operator === "") {
|
|
if (comp.value === "") {
|
|
return true;
|
|
}
|
|
rangeTmp = new Range(this.value, options);
|
|
return satisfies(comp.semver, rangeTmp, options);
|
|
}
|
|
var sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
|
|
var sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
|
|
var sameSemVer = this.semver.version === comp.semver.version;
|
|
var differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
|
|
var oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<");
|
|
var oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">");
|
|
return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
|
|
};
|
|
exports2.Range = Range;
|
|
function Range(range, options) {
|
|
if (!options || typeof options !== "object") {
|
|
options = {
|
|
loose: !!options,
|
|
includePrerelease: false
|
|
};
|
|
}
|
|
if (range instanceof Range) {
|
|
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
return range;
|
|
} else {
|
|
return new Range(range.raw, options);
|
|
}
|
|
}
|
|
if (range instanceof Comparator) {
|
|
return new Range(range.value, options);
|
|
}
|
|
if (!(this instanceof Range)) {
|
|
return new Range(range, options);
|
|
}
|
|
this.options = options;
|
|
this.loose = !!options.loose;
|
|
this.includePrerelease = !!options.includePrerelease;
|
|
this.raw = range;
|
|
this.set = range.split(/\s*\|\|\s*/).map(function(range2) {
|
|
return this.parseRange(range2.trim());
|
|
}, this).filter(function(c) {
|
|
return c.length;
|
|
});
|
|
if (!this.set.length) {
|
|
throw new TypeError("Invalid SemVer Range: " + range);
|
|
}
|
|
this.format();
|
|
}
|
|
Range.prototype.format = function() {
|
|
this.range = this.set.map(function(comps) {
|
|
return comps.join(" ").trim();
|
|
}).join("||").trim();
|
|
return this.range;
|
|
};
|
|
Range.prototype.toString = function() {
|
|
return this.range;
|
|
};
|
|
Range.prototype.parseRange = function(range) {
|
|
var loose = this.options.loose;
|
|
range = range.trim();
|
|
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
range = range.replace(hr, hyphenReplace);
|
|
debug("hyphen replace", range);
|
|
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
debug("comparator trim", range, re[t.COMPARATORTRIM]);
|
|
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
range = range.split(/\s+/).join(" ");
|
|
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
var set = range.split(" ").map(function(comp) {
|
|
return parseComparator(comp, this.options);
|
|
}, this).join(" ").split(/\s+/);
|
|
if (this.options.loose) {
|
|
set = set.filter(function(comp) {
|
|
return !!comp.match(compRe);
|
|
});
|
|
}
|
|
set = set.map(function(comp) {
|
|
return new Comparator(comp, this.options);
|
|
}, this);
|
|
return set;
|
|
};
|
|
Range.prototype.intersects = function(range, options) {
|
|
if (!(range instanceof Range)) {
|
|
throw new TypeError("a Range is required");
|
|
}
|
|
return this.set.some(function(thisComparators) {
|
|
return isSatisfiable(thisComparators, options) && range.set.some(function(rangeComparators) {
|
|
return isSatisfiable(rangeComparators, options) && thisComparators.every(function(thisComparator) {
|
|
return rangeComparators.every(function(rangeComparator) {
|
|
return thisComparator.intersects(rangeComparator, options);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
};
|
|
function isSatisfiable(comparators, options) {
|
|
var result = true;
|
|
var remainingComparators = comparators.slice();
|
|
var testComparator = remainingComparators.pop();
|
|
while (result && remainingComparators.length) {
|
|
result = remainingComparators.every(function(otherComparator) {
|
|
return testComparator.intersects(otherComparator, options);
|
|
});
|
|
testComparator = remainingComparators.pop();
|
|
}
|
|
return result;
|
|
}
|
|
exports2.toComparators = toComparators;
|
|
function toComparators(range, options) {
|
|
return new Range(range, options).set.map(function(comp) {
|
|
return comp.map(function(c) {
|
|
return c.value;
|
|
}).join(" ").trim().split(" ");
|
|
});
|
|
}
|
|
function parseComparator(comp, options) {
|
|
debug("comp", comp, options);
|
|
comp = replaceCarets(comp, options);
|
|
debug("caret", comp);
|
|
comp = replaceTildes(comp, options);
|
|
debug("tildes", comp);
|
|
comp = replaceXRanges(comp, options);
|
|
debug("xrange", comp);
|
|
comp = replaceStars(comp, options);
|
|
debug("stars", comp);
|
|
return comp;
|
|
}
|
|
function isX(id) {
|
|
return !id || id.toLowerCase() === "x" || id === "*";
|
|
}
|
|
function replaceTildes(comp, options) {
|
|
return comp.trim().split(/\s+/).map(function(comp2) {
|
|
return replaceTilde(comp2, options);
|
|
}).join(" ");
|
|
}
|
|
function replaceTilde(comp, options) {
|
|
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
return comp.replace(r, function(_, M, m, p, pr) {
|
|
debug("tilde", comp, _, M, m, p, pr);
|
|
var ret;
|
|
if (isX(M)) {
|
|
ret = "";
|
|
} else if (isX(m)) {
|
|
ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
|
|
} else if (isX(p)) {
|
|
ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
|
|
} else if (pr) {
|
|
debug("replaceTilde pr", pr);
|
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
|
|
} else {
|
|
ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
|
|
}
|
|
debug("tilde return", ret);
|
|
return ret;
|
|
});
|
|
}
|
|
function replaceCarets(comp, options) {
|
|
return comp.trim().split(/\s+/).map(function(comp2) {
|
|
return replaceCaret(comp2, options);
|
|
}).join(" ");
|
|
}
|
|
function replaceCaret(comp, options) {
|
|
debug("caret", comp, options);
|
|
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
return comp.replace(r, function(_, M, m, p, pr) {
|
|
debug("caret", comp, _, M, m, p, pr);
|
|
var ret;
|
|
if (isX(M)) {
|
|
ret = "";
|
|
} else if (isX(m)) {
|
|
ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
|
|
} else if (isX(p)) {
|
|
if (M === "0") {
|
|
ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
|
|
} else {
|
|
ret = ">=" + M + "." + m + ".0 <" + (+M + 1) + ".0.0";
|
|
}
|
|
} else if (pr) {
|
|
debug("replaceCaret pr", pr);
|
|
if (M === "0") {
|
|
if (m === "0") {
|
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + m + "." + (+p + 1);
|
|
} else {
|
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
|
|
}
|
|
} else {
|
|
ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + (+M + 1) + ".0.0";
|
|
}
|
|
} else {
|
|
debug("no pr");
|
|
if (M === "0") {
|
|
if (m === "0") {
|
|
ret = ">=" + M + "." + m + "." + p + " <" + M + "." + m + "." + (+p + 1);
|
|
} else {
|
|
ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
|
|
}
|
|
} else {
|
|
ret = ">=" + M + "." + m + "." + p + " <" + (+M + 1) + ".0.0";
|
|
}
|
|
}
|
|
debug("caret return", ret);
|
|
return ret;
|
|
});
|
|
}
|
|
function replaceXRanges(comp, options) {
|
|
debug("replaceXRanges", comp, options);
|
|
return comp.split(/\s+/).map(function(comp2) {
|
|
return replaceXRange(comp2, options);
|
|
}).join(" ");
|
|
}
|
|
function replaceXRange(comp, options) {
|
|
comp = comp.trim();
|
|
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
|
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
var xM = isX(M);
|
|
var xm = xM || isX(m);
|
|
var xp = xm || isX(p);
|
|
var anyX = xp;
|
|
if (gtlt === "=" && anyX) {
|
|
gtlt = "";
|
|
}
|
|
pr = options.includePrerelease ? "-0" : "";
|
|
if (xM) {
|
|
if (gtlt === ">" || gtlt === "<") {
|
|
ret = "<0.0.0-0";
|
|
} else {
|
|
ret = "*";
|
|
}
|
|
} else if (gtlt && anyX) {
|
|
if (xm) {
|
|
m = 0;
|
|
}
|
|
p = 0;
|
|
if (gtlt === ">") {
|
|
gtlt = ">=";
|
|
if (xm) {
|
|
M = +M + 1;
|
|
m = 0;
|
|
p = 0;
|
|
} else {
|
|
m = +m + 1;
|
|
p = 0;
|
|
}
|
|
} else if (gtlt === "<=") {
|
|
gtlt = "<";
|
|
if (xm) {
|
|
M = +M + 1;
|
|
} else {
|
|
m = +m + 1;
|
|
}
|
|
}
|
|
ret = gtlt + M + "." + m + "." + p + pr;
|
|
} else if (xm) {
|
|
ret = ">=" + M + ".0.0" + pr + " <" + (+M + 1) + ".0.0" + pr;
|
|
} else if (xp) {
|
|
ret = ">=" + M + "." + m + ".0" + pr + " <" + M + "." + (+m + 1) + ".0" + pr;
|
|
}
|
|
debug("xRange return", ret);
|
|
return ret;
|
|
});
|
|
}
|
|
function replaceStars(comp, options) {
|
|
debug("replaceStars", comp, options);
|
|
return comp.trim().replace(re[t.STAR], "");
|
|
}
|
|
function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
|
|
if (isX(fM)) {
|
|
from = "";
|
|
} else if (isX(fm)) {
|
|
from = ">=" + fM + ".0.0";
|
|
} else if (isX(fp)) {
|
|
from = ">=" + fM + "." + fm + ".0";
|
|
} else {
|
|
from = ">=" + from;
|
|
}
|
|
if (isX(tM)) {
|
|
to = "";
|
|
} else if (isX(tm)) {
|
|
to = "<" + (+tM + 1) + ".0.0";
|
|
} else if (isX(tp)) {
|
|
to = "<" + tM + "." + (+tm + 1) + ".0";
|
|
} else if (tpr) {
|
|
to = "<=" + tM + "." + tm + "." + tp + "-" + tpr;
|
|
} else {
|
|
to = "<=" + to;
|
|
}
|
|
return (from + " " + to).trim();
|
|
}
|
|
Range.prototype.test = function(version) {
|
|
if (!version) {
|
|
return false;
|
|
}
|
|
if (typeof version === "string") {
|
|
try {
|
|
version = new SemVer(version, this.options);
|
|
} catch (er) {
|
|
return false;
|
|
}
|
|
}
|
|
for (var i2 = 0; i2 < this.set.length; i2++) {
|
|
if (testSet(this.set[i2], version, this.options)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
function testSet(set, version, options) {
|
|
for (var i2 = 0; i2 < set.length; i2++) {
|
|
if (!set[i2].test(version)) {
|
|
return false;
|
|
}
|
|
}
|
|
if (version.prerelease.length && !options.includePrerelease) {
|
|
for (i2 = 0; i2 < set.length; i2++) {
|
|
debug(set[i2].semver);
|
|
if (set[i2].semver === ANY) {
|
|
continue;
|
|
}
|
|
if (set[i2].semver.prerelease.length > 0) {
|
|
var allowed = set[i2].semver;
|
|
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
exports2.satisfies = satisfies;
|
|
function satisfies(version, range, options) {
|
|
try {
|
|
range = new Range(range, options);
|
|
} catch (er) {
|
|
return false;
|
|
}
|
|
return range.test(version);
|
|
}
|
|
exports2.maxSatisfying = maxSatisfying;
|
|
function maxSatisfying(versions, range, options) {
|
|
var max = null;
|
|
var maxSV = null;
|
|
try {
|
|
var rangeObj = new Range(range, options);
|
|
} catch (er) {
|
|
return null;
|
|
}
|
|
versions.forEach(function(v) {
|
|
if (rangeObj.test(v)) {
|
|
if (!max || maxSV.compare(v) === -1) {
|
|
max = v;
|
|
maxSV = new SemVer(max, options);
|
|
}
|
|
}
|
|
});
|
|
return max;
|
|
}
|
|
exports2.minSatisfying = minSatisfying;
|
|
function minSatisfying(versions, range, options) {
|
|
var min = null;
|
|
var minSV = null;
|
|
try {
|
|
var rangeObj = new Range(range, options);
|
|
} catch (er) {
|
|
return null;
|
|
}
|
|
versions.forEach(function(v) {
|
|
if (rangeObj.test(v)) {
|
|
if (!min || minSV.compare(v) === 1) {
|
|
min = v;
|
|
minSV = new SemVer(min, options);
|
|
}
|
|
}
|
|
});
|
|
return min;
|
|
}
|
|
exports2.minVersion = minVersion;
|
|
function minVersion(range, loose) {
|
|
range = new Range(range, loose);
|
|
var minver = new SemVer("0.0.0");
|
|
if (range.test(minver)) {
|
|
return minver;
|
|
}
|
|
minver = new SemVer("0.0.0-0");
|
|
if (range.test(minver)) {
|
|
return minver;
|
|
}
|
|
minver = null;
|
|
for (var i2 = 0; i2 < range.set.length; ++i2) {
|
|
var comparators = range.set[i2];
|
|
comparators.forEach(function(comparator) {
|
|
var compver = new SemVer(comparator.semver.version);
|
|
switch (comparator.operator) {
|
|
case ">":
|
|
if (compver.prerelease.length === 0) {
|
|
compver.patch++;
|
|
} else {
|
|
compver.prerelease.push(0);
|
|
}
|
|
compver.raw = compver.format();
|
|
case "":
|
|
case ">=":
|
|
if (!minver || gt(minver, compver)) {
|
|
minver = compver;
|
|
}
|
|
break;
|
|
case "<":
|
|
case "<=":
|
|
break;
|
|
default:
|
|
throw new Error("Unexpected operation: " + comparator.operator);
|
|
}
|
|
});
|
|
}
|
|
if (minver && range.test(minver)) {
|
|
return minver;
|
|
}
|
|
return null;
|
|
}
|
|
exports2.validRange = validRange;
|
|
function validRange(range, options) {
|
|
try {
|
|
return new Range(range, options).range || "*";
|
|
} catch (er) {
|
|
return null;
|
|
}
|
|
}
|
|
exports2.ltr = ltr;
|
|
function ltr(version, range, options) {
|
|
return outside(version, range, "<", options);
|
|
}
|
|
exports2.gtr = gtr;
|
|
function gtr(version, range, options) {
|
|
return outside(version, range, ">", options);
|
|
}
|
|
exports2.outside = outside;
|
|
function outside(version, range, hilo, options) {
|
|
version = new SemVer(version, options);
|
|
range = new Range(range, options);
|
|
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
switch (hilo) {
|
|
case ">":
|
|
gtfn = gt;
|
|
ltefn = lte;
|
|
ltfn = lt;
|
|
comp = ">";
|
|
ecomp = ">=";
|
|
break;
|
|
case "<":
|
|
gtfn = lt;
|
|
ltefn = gte;
|
|
ltfn = gt;
|
|
comp = "<";
|
|
ecomp = "<=";
|
|
break;
|
|
default:
|
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
}
|
|
if (satisfies(version, range, options)) {
|
|
return false;
|
|
}
|
|
for (var i2 = 0; i2 < range.set.length; ++i2) {
|
|
var comparators = range.set[i2];
|
|
var high = null;
|
|
var low = null;
|
|
comparators.forEach(function(comparator) {
|
|
if (comparator.semver === ANY) {
|
|
comparator = new Comparator(">=0.0.0");
|
|
}
|
|
high = high || comparator;
|
|
low = low || comparator;
|
|
if (gtfn(comparator.semver, high.semver, options)) {
|
|
high = comparator;
|
|
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
low = comparator;
|
|
}
|
|
});
|
|
if (high.operator === comp || high.operator === ecomp) {
|
|
return false;
|
|
}
|
|
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
return false;
|
|
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
exports2.prerelease = prerelease;
|
|
function prerelease(version, options) {
|
|
var parsed = parse(version, options);
|
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
}
|
|
exports2.intersects = intersects;
|
|
function intersects(r1, r2, options) {
|
|
r1 = new Range(r1, options);
|
|
r2 = new Range(r2, options);
|
|
return r1.intersects(r2);
|
|
}
|
|
exports2.coerce = coerce;
|
|
function coerce(version, options) {
|
|
if (version instanceof SemVer) {
|
|
return version;
|
|
}
|
|
if (typeof version === "number") {
|
|
version = String(version);
|
|
}
|
|
if (typeof version !== "string") {
|
|
return null;
|
|
}
|
|
options = options || {};
|
|
var match = null;
|
|
if (!options.rtl) {
|
|
match = version.match(re[t.COERCE]);
|
|
} else {
|
|
var next;
|
|
while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
match = next;
|
|
}
|
|
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
|
|
}
|
|
re[t.COERCERTL].lastIndex = -1;
|
|
}
|
|
if (match === null) {
|
|
return null;
|
|
}
|
|
return parse(match[2] + "." + (match[3] || "0") + "." + (match[4] || "0"), options);
|
|
}
|
|
}
|
|
});
|
|
var require_make_dir = __commonJS2({
|
|
"node_modules/make-dir/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var fs = require("fs");
|
|
var path = require("path");
|
|
var {
|
|
promisify
|
|
} = require("util");
|
|
var semver = require_semver();
|
|
var useNativeRecursiveOption = semver.satisfies(process.version, ">=10.12.0");
|
|
var checkPath = (pth) => {
|
|
if (process.platform === "win32") {
|
|
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
|
|
if (pathHasInvalidWinCharacters) {
|
|
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
error.code = "EINVAL";
|
|
throw error;
|
|
}
|
|
}
|
|
};
|
|
var processOptions = (options) => {
|
|
const defaults = {
|
|
mode: 511,
|
|
fs
|
|
};
|
|
return Object.assign(Object.assign({}, defaults), options);
|
|
};
|
|
var permissionError = (pth) => {
|
|
const error = new Error(`operation not permitted, mkdir '${pth}'`);
|
|
error.code = "EPERM";
|
|
error.errno = -4048;
|
|
error.path = pth;
|
|
error.syscall = "mkdir";
|
|
return error;
|
|
};
|
|
var makeDir = async (input, options) => {
|
|
checkPath(input);
|
|
options = processOptions(options);
|
|
const mkdir = promisify(options.fs.mkdir);
|
|
const stat = promisify(options.fs.stat);
|
|
if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
|
|
const pth = path.resolve(input);
|
|
await mkdir(pth, {
|
|
mode: options.mode,
|
|
recursive: true
|
|
});
|
|
return pth;
|
|
}
|
|
const make = async (pth) => {
|
|
try {
|
|
await mkdir(pth, options.mode);
|
|
return pth;
|
|
} catch (error) {
|
|
if (error.code === "EPERM") {
|
|
throw error;
|
|
}
|
|
if (error.code === "ENOENT") {
|
|
if (path.dirname(pth) === pth) {
|
|
throw permissionError(pth);
|
|
}
|
|
if (error.message.includes("null bytes")) {
|
|
throw error;
|
|
}
|
|
await make(path.dirname(pth));
|
|
return make(pth);
|
|
}
|
|
try {
|
|
const stats = await stat(pth);
|
|
if (!stats.isDirectory()) {
|
|
throw new Error("The path is not a directory");
|
|
}
|
|
} catch (_) {
|
|
throw error;
|
|
}
|
|
return pth;
|
|
}
|
|
};
|
|
return make(path.resolve(input));
|
|
};
|
|
module2.exports = makeDir;
|
|
module2.exports.sync = (input, options) => {
|
|
checkPath(input);
|
|
options = processOptions(options);
|
|
if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
|
|
const pth = path.resolve(input);
|
|
fs.mkdirSync(pth, {
|
|
mode: options.mode,
|
|
recursive: true
|
|
});
|
|
return pth;
|
|
}
|
|
const make = (pth) => {
|
|
try {
|
|
options.fs.mkdirSync(pth, options.mode);
|
|
} catch (error) {
|
|
if (error.code === "EPERM") {
|
|
throw error;
|
|
}
|
|
if (error.code === "ENOENT") {
|
|
if (path.dirname(pth) === pth) {
|
|
throw permissionError(pth);
|
|
}
|
|
if (error.message.includes("null bytes")) {
|
|
throw error;
|
|
}
|
|
make(path.dirname(pth));
|
|
return make(pth);
|
|
}
|
|
try {
|
|
if (!options.fs.statSync(pth).isDirectory()) {
|
|
throw new Error("The path is not a directory");
|
|
}
|
|
} catch (_) {
|
|
throw error;
|
|
}
|
|
}
|
|
return pth;
|
|
};
|
|
return make(path.resolve(input));
|
|
};
|
|
}
|
|
});
|
|
var require_find_cache_dir = __commonJS2({
|
|
"node_modules/find-cache-dir/index.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var fs = require("fs");
|
|
var commonDir = require_commondir();
|
|
var pkgDir = require_pkg_dir();
|
|
var makeDir = require_make_dir();
|
|
var {
|
|
env: env2,
|
|
cwd
|
|
} = process;
|
|
var isWritable = (path2) => {
|
|
try {
|
|
fs.accessSync(path2, fs.constants.W_OK);
|
|
return true;
|
|
} catch (_) {
|
|
return false;
|
|
}
|
|
};
|
|
function useDirectory(directory, options) {
|
|
if (options.create) {
|
|
makeDir.sync(directory);
|
|
}
|
|
if (options.thunk) {
|
|
return (...arguments_) => path.join(directory, ...arguments_);
|
|
}
|
|
return directory;
|
|
}
|
|
function getNodeModuleDirectory(directory) {
|
|
const nodeModules = path.join(directory, "node_modules");
|
|
if (!isWritable(nodeModules) && (fs.existsSync(nodeModules) || !isWritable(path.join(directory)))) {
|
|
return;
|
|
}
|
|
return nodeModules;
|
|
}
|
|
module2.exports = (options = {}) => {
|
|
if (env2.CACHE_DIR && !["true", "false", "1", "0"].includes(env2.CACHE_DIR)) {
|
|
return useDirectory(path.join(env2.CACHE_DIR, options.name), options);
|
|
}
|
|
let {
|
|
cwd: directory = cwd()
|
|
} = options;
|
|
if (options.files) {
|
|
directory = commonDir(directory, options.files);
|
|
}
|
|
directory = pkgDir.sync(directory);
|
|
if (!directory) {
|
|
return;
|
|
}
|
|
const nodeModules = getNodeModuleDirectory(directory);
|
|
if (!nodeModules) {
|
|
return void 0;
|
|
}
|
|
return useDirectory(path.join(directory, "node_modules", ".cache", options.name), options);
|
|
};
|
|
}
|
|
});
|
|
var require_find_cache_file = __commonJS2({
|
|
"src/cli/find-cache-file.js"(exports2, module2) {
|
|
"use strict";
|
|
var fs = require("fs").promises;
|
|
var os2 = require("os");
|
|
var path = require("path");
|
|
var findCacheDir = require_find_cache_dir();
|
|
var {
|
|
statSafe,
|
|
isJson
|
|
} = require_utils();
|
|
function findDefaultCacheFile() {
|
|
const cacheDir = findCacheDir({
|
|
name: "prettier",
|
|
create: true
|
|
}) || os2.tmpdir();
|
|
const cacheFilePath = path.join(cacheDir, ".prettier-cache");
|
|
return cacheFilePath;
|
|
}
|
|
async function findCacheFileFromOption(cacheLocation) {
|
|
const cacheFile = path.resolve(cacheLocation);
|
|
const stat = await statSafe(cacheFile);
|
|
if (stat) {
|
|
if (stat.isDirectory()) {
|
|
throw new Error(`Resolved --cache-location '${cacheFile}' is a directory`);
|
|
}
|
|
const data = await fs.readFile(cacheFile, "utf8");
|
|
if (!isJson(data)) {
|
|
throw new Error(`'${cacheFile}' isn't a valid JSON file`);
|
|
}
|
|
}
|
|
return cacheFile;
|
|
}
|
|
async function findCacheFile(cacheLocation) {
|
|
if (!cacheLocation) {
|
|
return findDefaultCacheFile();
|
|
}
|
|
const cacheFile = await findCacheFileFromOption(cacheLocation);
|
|
return cacheFile;
|
|
}
|
|
module2.exports = findCacheFile;
|
|
}
|
|
});
|
|
var require_cjs = __commonJS2({
|
|
"node_modules/flatted/cjs/index.js"(exports2) {
|
|
"use strict";
|
|
var {
|
|
parse: $parse,
|
|
stringify: $stringify
|
|
} = JSON;
|
|
var {
|
|
keys
|
|
} = Object;
|
|
var Primitive = String;
|
|
var primitive = "string";
|
|
var ignore = {};
|
|
var object = "object";
|
|
var noop = (_, value) => value;
|
|
var primitives = (value) => value instanceof Primitive ? Primitive(value) : value;
|
|
var Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value;
|
|
var revive = (input, parsed, output, $) => {
|
|
const lazy = [];
|
|
for (let ke = keys(output), {
|
|
length
|
|
} = ke, y = 0; y < length; y++) {
|
|
const k = ke[y];
|
|
const value = output[k];
|
|
if (value instanceof Primitive) {
|
|
const tmp = input[value];
|
|
if (typeof tmp === object && !parsed.has(tmp)) {
|
|
parsed.add(tmp);
|
|
output[k] = ignore;
|
|
lazy.push({
|
|
k,
|
|
a: [input, parsed, tmp, $]
|
|
});
|
|
} else
|
|
output[k] = $.call(output, k, tmp);
|
|
} else if (output[k] !== ignore)
|
|
output[k] = $.call(output, k, value);
|
|
}
|
|
for (let {
|
|
length
|
|
} = lazy, i = 0; i < length; i++) {
|
|
const {
|
|
k,
|
|
a
|
|
} = lazy[i];
|
|
output[k] = $.call(output, k, revive.apply(null, a));
|
|
}
|
|
return output;
|
|
};
|
|
var set = (known, input, value) => {
|
|
const index = Primitive(input.push(value) - 1);
|
|
known.set(value, index);
|
|
return index;
|
|
};
|
|
var parse = (text, reviver) => {
|
|
const input = $parse(text, Primitives).map(primitives);
|
|
const value = input[0];
|
|
const $ = reviver || noop;
|
|
const tmp = typeof value === object && value ? revive(input, /* @__PURE__ */ new Set(), value, $) : value;
|
|
return $.call({
|
|
"": tmp
|
|
}, "", tmp);
|
|
};
|
|
exports2.parse = parse;
|
|
var stringify2 = (value, replacer, space) => {
|
|
const $ = replacer && typeof replacer === object ? (k, v) => k === "" || -1 < replacer.indexOf(k) ? v : void 0 : replacer || noop;
|
|
const known = /* @__PURE__ */ new Map();
|
|
const input = [];
|
|
const output = [];
|
|
let i = +set(known, input, $.call({
|
|
"": value
|
|
}, "", value));
|
|
let firstRun = !i;
|
|
while (i < input.length) {
|
|
firstRun = true;
|
|
output[i] = $stringify(input[i++], replace, space);
|
|
}
|
|
return "[" + output.join(",") + "]";
|
|
function replace(key, value2) {
|
|
if (firstRun) {
|
|
firstRun = !firstRun;
|
|
return value2;
|
|
}
|
|
const after = $.call(this, key, value2);
|
|
switch (typeof after) {
|
|
case object:
|
|
if (after === null)
|
|
return after;
|
|
case primitive:
|
|
return known.get(after) || set(known, input, after);
|
|
}
|
|
return after;
|
|
}
|
|
};
|
|
exports2.stringify = stringify2;
|
|
var toJSON = (any) => $parse(stringify2(any));
|
|
exports2.toJSON = toJSON;
|
|
var fromJSON = (any) => parse($stringify(any));
|
|
exports2.fromJSON = fromJSON;
|
|
}
|
|
});
|
|
var require_utils6 = __commonJS2({
|
|
"node_modules/flat-cache/src/utils.js"(exports2, module2) {
|
|
var fs = require("fs");
|
|
var path = require("path");
|
|
var flatted = require_cjs();
|
|
module2.exports = {
|
|
tryParse: function(filePath, defaultValue) {
|
|
var result;
|
|
try {
|
|
result = this.readJSON(filePath);
|
|
} catch (ex) {
|
|
result = defaultValue;
|
|
}
|
|
return result;
|
|
},
|
|
readJSON: function(filePath) {
|
|
return flatted.parse(fs.readFileSync(filePath, {
|
|
encoding: "utf8"
|
|
}));
|
|
},
|
|
writeJSON: function(filePath, data) {
|
|
fs.mkdirSync(path.dirname(filePath), {
|
|
recursive: true
|
|
});
|
|
fs.writeFileSync(filePath, flatted.stringify(data));
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_old = __commonJS2({
|
|
"node_modules/fs.realpath/old.js"(exports2) {
|
|
var pathModule = require("path");
|
|
var isWindows = process.platform === "win32";
|
|
var fs = require("fs");
|
|
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
function rethrow() {
|
|
var callback;
|
|
if (DEBUG) {
|
|
var backtrace = new Error();
|
|
callback = debugCallback;
|
|
} else
|
|
callback = missingCallback;
|
|
return callback;
|
|
function debugCallback(err) {
|
|
if (err) {
|
|
backtrace.message = err.message;
|
|
err = backtrace;
|
|
missingCallback(err);
|
|
}
|
|
}
|
|
function missingCallback(err) {
|
|
if (err) {
|
|
if (process.throwDeprecation)
|
|
throw err;
|
|
else if (!process.noDeprecation) {
|
|
var msg = "fs: missing callback " + (err.stack || err.message);
|
|
if (process.traceDeprecation)
|
|
console.trace(msg);
|
|
else
|
|
console.error(msg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function maybeCallback(cb) {
|
|
return typeof cb === "function" ? cb : rethrow();
|
|
}
|
|
var normalize = pathModule.normalize;
|
|
if (isWindows) {
|
|
nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
|
} else {
|
|
nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
|
}
|
|
var nextPartRe;
|
|
if (isWindows) {
|
|
splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
|
} else {
|
|
splitRootRe = /^[\/]*/;
|
|
}
|
|
var splitRootRe;
|
|
exports2.realpathSync = function realpathSync(p, cache) {
|
|
p = pathModule.resolve(p);
|
|
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
return cache[p];
|
|
}
|
|
var original = p, seenLinks = {}, knownHard = {};
|
|
var pos;
|
|
var current;
|
|
var base;
|
|
var previous;
|
|
start();
|
|
function start() {
|
|
var m = splitRootRe.exec(p);
|
|
pos = m[0].length;
|
|
current = m[0];
|
|
base = m[0];
|
|
previous = "";
|
|
if (isWindows && !knownHard[base]) {
|
|
fs.lstatSync(base);
|
|
knownHard[base] = true;
|
|
}
|
|
}
|
|
while (pos < p.length) {
|
|
nextPartRe.lastIndex = pos;
|
|
var result = nextPartRe.exec(p);
|
|
previous = current;
|
|
current += result[0];
|
|
base = previous + result[1];
|
|
pos = nextPartRe.lastIndex;
|
|
if (knownHard[base] || cache && cache[base] === base) {
|
|
continue;
|
|
}
|
|
var resolvedLink;
|
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
resolvedLink = cache[base];
|
|
} else {
|
|
var stat = fs.lstatSync(base);
|
|
if (!stat.isSymbolicLink()) {
|
|
knownHard[base] = true;
|
|
if (cache)
|
|
cache[base] = base;
|
|
continue;
|
|
}
|
|
var linkTarget = null;
|
|
if (!isWindows) {
|
|
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
if (seenLinks.hasOwnProperty(id)) {
|
|
linkTarget = seenLinks[id];
|
|
}
|
|
}
|
|
if (linkTarget === null) {
|
|
fs.statSync(base);
|
|
linkTarget = fs.readlinkSync(base);
|
|
}
|
|
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
if (cache)
|
|
cache[base] = resolvedLink;
|
|
if (!isWindows)
|
|
seenLinks[id] = linkTarget;
|
|
}
|
|
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
start();
|
|
}
|
|
if (cache)
|
|
cache[original] = p;
|
|
return p;
|
|
};
|
|
exports2.realpath = function realpath(p, cache, cb) {
|
|
if (typeof cb !== "function") {
|
|
cb = maybeCallback(cache);
|
|
cache = null;
|
|
}
|
|
p = pathModule.resolve(p);
|
|
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
return process.nextTick(cb.bind(null, null, cache[p]));
|
|
}
|
|
var original = p, seenLinks = {}, knownHard = {};
|
|
var pos;
|
|
var current;
|
|
var base;
|
|
var previous;
|
|
start();
|
|
function start() {
|
|
var m = splitRootRe.exec(p);
|
|
pos = m[0].length;
|
|
current = m[0];
|
|
base = m[0];
|
|
previous = "";
|
|
if (isWindows && !knownHard[base]) {
|
|
fs.lstat(base, function(err) {
|
|
if (err)
|
|
return cb(err);
|
|
knownHard[base] = true;
|
|
LOOP();
|
|
});
|
|
} else {
|
|
process.nextTick(LOOP);
|
|
}
|
|
}
|
|
function LOOP() {
|
|
if (pos >= p.length) {
|
|
if (cache)
|
|
cache[original] = p;
|
|
return cb(null, p);
|
|
}
|
|
nextPartRe.lastIndex = pos;
|
|
var result = nextPartRe.exec(p);
|
|
previous = current;
|
|
current += result[0];
|
|
base = previous + result[1];
|
|
pos = nextPartRe.lastIndex;
|
|
if (knownHard[base] || cache && cache[base] === base) {
|
|
return process.nextTick(LOOP);
|
|
}
|
|
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
return gotResolvedLink(cache[base]);
|
|
}
|
|
return fs.lstat(base, gotStat);
|
|
}
|
|
function gotStat(err, stat) {
|
|
if (err)
|
|
return cb(err);
|
|
if (!stat.isSymbolicLink()) {
|
|
knownHard[base] = true;
|
|
if (cache)
|
|
cache[base] = base;
|
|
return process.nextTick(LOOP);
|
|
}
|
|
if (!isWindows) {
|
|
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
if (seenLinks.hasOwnProperty(id)) {
|
|
return gotTarget(null, seenLinks[id], base);
|
|
}
|
|
}
|
|
fs.stat(base, function(err2) {
|
|
if (err2)
|
|
return cb(err2);
|
|
fs.readlink(base, function(err3, target) {
|
|
if (!isWindows)
|
|
seenLinks[id] = target;
|
|
gotTarget(err3, target);
|
|
});
|
|
});
|
|
}
|
|
function gotTarget(err, target, base2) {
|
|
if (err)
|
|
return cb(err);
|
|
var resolvedLink = pathModule.resolve(previous, target);
|
|
if (cache)
|
|
cache[base2] = resolvedLink;
|
|
gotResolvedLink(resolvedLink);
|
|
}
|
|
function gotResolvedLink(resolvedLink) {
|
|
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
start();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_fs5 = __commonJS2({
|
|
"node_modules/fs.realpath/index.js"(exports2, module2) {
|
|
module2.exports = realpath;
|
|
realpath.realpath = realpath;
|
|
realpath.sync = realpathSync;
|
|
realpath.realpathSync = realpathSync;
|
|
realpath.monkeypatch = monkeypatch;
|
|
realpath.unmonkeypatch = unmonkeypatch;
|
|
var fs = require("fs");
|
|
var origRealpath = fs.realpath;
|
|
var origRealpathSync = fs.realpathSync;
|
|
var version = process.version;
|
|
var ok = /^v[0-5]\./.test(version);
|
|
var old = require_old();
|
|
function newError(er) {
|
|
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
|
|
}
|
|
function realpath(p, cache, cb) {
|
|
if (ok) {
|
|
return origRealpath(p, cache, cb);
|
|
}
|
|
if (typeof cache === "function") {
|
|
cb = cache;
|
|
cache = null;
|
|
}
|
|
origRealpath(p, cache, function(er, result) {
|
|
if (newError(er)) {
|
|
old.realpath(p, cache, cb);
|
|
} else {
|
|
cb(er, result);
|
|
}
|
|
});
|
|
}
|
|
function realpathSync(p, cache) {
|
|
if (ok) {
|
|
return origRealpathSync(p, cache);
|
|
}
|
|
try {
|
|
return origRealpathSync(p, cache);
|
|
} catch (er) {
|
|
if (newError(er)) {
|
|
return old.realpathSync(p, cache);
|
|
} else {
|
|
throw er;
|
|
}
|
|
}
|
|
}
|
|
function monkeypatch() {
|
|
fs.realpath = realpath;
|
|
fs.realpathSync = realpathSync;
|
|
}
|
|
function unmonkeypatch() {
|
|
fs.realpath = origRealpath;
|
|
fs.realpathSync = origRealpathSync;
|
|
}
|
|
}
|
|
});
|
|
var require_concat_map = __commonJS2({
|
|
"node_modules/concat-map/index.js"(exports2, module2) {
|
|
module2.exports = function(xs, fn) {
|
|
var res = [];
|
|
for (var i = 0; i < xs.length; i++) {
|
|
var x = fn(xs[i], i);
|
|
if (isArray(x))
|
|
res.push.apply(res, x);
|
|
else
|
|
res.push(x);
|
|
}
|
|
return res;
|
|
};
|
|
var isArray = Array.isArray || function(xs) {
|
|
return Object.prototype.toString.call(xs) === "[object Array]";
|
|
};
|
|
}
|
|
});
|
|
var require_balanced_match = __commonJS2({
|
|
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
"use strict";
|
|
module2.exports = balanced;
|
|
function balanced(a, b, str) {
|
|
if (a instanceof RegExp)
|
|
a = maybeMatch(a, str);
|
|
if (b instanceof RegExp)
|
|
b = maybeMatch(b, str);
|
|
var r = range(a, b, str);
|
|
return r && {
|
|
start: r[0],
|
|
end: r[1],
|
|
pre: str.slice(0, r[0]),
|
|
body: str.slice(r[0] + a.length, r[1]),
|
|
post: str.slice(r[1] + b.length)
|
|
};
|
|
}
|
|
function maybeMatch(reg, str) {
|
|
var m = str.match(reg);
|
|
return m ? m[0] : null;
|
|
}
|
|
balanced.range = range;
|
|
function range(a, b, str) {
|
|
var begs, beg, left, right, result;
|
|
var ai = str.indexOf(a);
|
|
var bi = str.indexOf(b, ai + 1);
|
|
var i = ai;
|
|
if (ai >= 0 && bi > 0) {
|
|
if (a === b) {
|
|
return [ai, bi];
|
|
}
|
|
begs = [];
|
|
left = str.length;
|
|
while (i >= 0 && !result) {
|
|
if (i == ai) {
|
|
begs.push(i);
|
|
ai = str.indexOf(a, i + 1);
|
|
} else if (begs.length == 1) {
|
|
result = [begs.pop(), bi];
|
|
} else {
|
|
beg = begs.pop();
|
|
if (beg < left) {
|
|
left = beg;
|
|
right = bi;
|
|
}
|
|
bi = str.indexOf(b, i + 1);
|
|
}
|
|
i = ai < bi && ai >= 0 ? ai : bi;
|
|
}
|
|
if (begs.length) {
|
|
result = [left, right];
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
});
|
|
var require_brace_expansion = __commonJS2({
|
|
"node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
var concatMap = require_concat_map();
|
|
var balanced = require_balanced_match();
|
|
module2.exports = expandTop;
|
|
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
function numeric(str) {
|
|
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
}
|
|
function escapeBraces(str) {
|
|
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
}
|
|
function unescapeBraces(str) {
|
|
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
}
|
|
function parseCommaParts(str) {
|
|
if (!str)
|
|
return [""];
|
|
var parts = [];
|
|
var m = balanced("{", "}", str);
|
|
if (!m)
|
|
return str.split(",");
|
|
var pre = m.pre;
|
|
var body = m.body;
|
|
var post = m.post;
|
|
var p = pre.split(",");
|
|
p[p.length - 1] += "{" + body + "}";
|
|
var postParts = parseCommaParts(post);
|
|
if (post.length) {
|
|
p[p.length - 1] += postParts.shift();
|
|
p.push.apply(p, postParts);
|
|
}
|
|
parts.push.apply(parts, p);
|
|
return parts;
|
|
}
|
|
function expandTop(str) {
|
|
if (!str)
|
|
return [];
|
|
if (str.substr(0, 2) === "{}") {
|
|
str = "\\{\\}" + str.substr(2);
|
|
}
|
|
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
}
|
|
function embrace(str) {
|
|
return "{" + str + "}";
|
|
}
|
|
function isPadded(el) {
|
|
return /^-?0\d/.test(el);
|
|
}
|
|
function lte(i, y) {
|
|
return i <= y;
|
|
}
|
|
function gte(i, y) {
|
|
return i >= y;
|
|
}
|
|
function expand(str, isTop) {
|
|
var expansions = [];
|
|
var m = balanced("{", "}", str);
|
|
if (!m || /\$$/.test(m.pre))
|
|
return [str];
|
|
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
var isSequence = isNumericSequence || isAlphaSequence;
|
|
var isOptions = m.body.indexOf(",") >= 0;
|
|
if (!isSequence && !isOptions) {
|
|
if (m.post.match(/,.*\}/)) {
|
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
return expand(str);
|
|
}
|
|
return [str];
|
|
}
|
|
var n;
|
|
if (isSequence) {
|
|
n = m.body.split(/\.\./);
|
|
} else {
|
|
n = parseCommaParts(m.body);
|
|
if (n.length === 1) {
|
|
n = expand(n[0], false).map(embrace);
|
|
if (n.length === 1) {
|
|
var post = m.post.length ? expand(m.post, false) : [""];
|
|
return post.map(function(p) {
|
|
return m.pre + n[0] + p;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
var pre = m.pre;
|
|
var post = m.post.length ? expand(m.post, false) : [""];
|
|
var N;
|
|
if (isSequence) {
|
|
var x = numeric(n[0]);
|
|
var y = numeric(n[1]);
|
|
var width = Math.max(n[0].length, n[1].length);
|
|
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
var test = lte;
|
|
var reverse = y < x;
|
|
if (reverse) {
|
|
incr *= -1;
|
|
test = gte;
|
|
}
|
|
var pad = n.some(isPadded);
|
|
N = [];
|
|
for (var i = x; test(i, y); i += incr) {
|
|
var c;
|
|
if (isAlphaSequence) {
|
|
c = String.fromCharCode(i);
|
|
if (c === "\\")
|
|
c = "";
|
|
} else {
|
|
c = String(i);
|
|
if (pad) {
|
|
var need = width - c.length;
|
|
if (need > 0) {
|
|
var z = new Array(need + 1).join("0");
|
|
if (i < 0)
|
|
c = "-" + z + c.slice(1);
|
|
else
|
|
c = z + c;
|
|
}
|
|
}
|
|
}
|
|
N.push(c);
|
|
}
|
|
} else {
|
|
N = concatMap(n, function(el) {
|
|
return expand(el, false);
|
|
});
|
|
}
|
|
for (var j = 0; j < N.length; j++) {
|
|
for (var k = 0; k < post.length; k++) {
|
|
var expansion = pre + N[j] + post[k];
|
|
if (!isTop || isSequence || expansion)
|
|
expansions.push(expansion);
|
|
}
|
|
}
|
|
return expansions;
|
|
}
|
|
}
|
|
});
|
|
var require_minimatch = __commonJS2({
|
|
"node_modules/minimatch/minimatch.js"(exports2, module2) {
|
|
module2.exports = minimatch;
|
|
minimatch.Minimatch = Minimatch;
|
|
var path = function() {
|
|
try {
|
|
return require("path");
|
|
} catch (e) {
|
|
}
|
|
}() || {
|
|
sep: "/"
|
|
};
|
|
minimatch.sep = path.sep;
|
|
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
var expand = require_brace_expansion();
|
|
var plTypes = {
|
|
"!": {
|
|
open: "(?:(?!(?:",
|
|
close: "))[^/]*?)"
|
|
},
|
|
"?": {
|
|
open: "(?:",
|
|
close: ")?"
|
|
},
|
|
"+": {
|
|
open: "(?:",
|
|
close: ")+"
|
|
},
|
|
"*": {
|
|
open: "(?:",
|
|
close: ")*"
|
|
},
|
|
"@": {
|
|
open: "(?:",
|
|
close: ")"
|
|
}
|
|
};
|
|
var qmark = "[^/]";
|
|
var star = qmark + "*?";
|
|
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
var reSpecials = charSet("().*{}+?[]^$\\!");
|
|
function charSet(s) {
|
|
return s.split("").reduce(function(set, c) {
|
|
set[c] = true;
|
|
return set;
|
|
}, {});
|
|
}
|
|
var slashSplit = /\/+/;
|
|
minimatch.filter = filter;
|
|
function filter(pattern, options) {
|
|
options = options || {};
|
|
return function(p, i, list) {
|
|
return minimatch(p, pattern, options);
|
|
};
|
|
}
|
|
function ext(a, b) {
|
|
b = b || {};
|
|
var t = {};
|
|
Object.keys(a).forEach(function(k) {
|
|
t[k] = a[k];
|
|
});
|
|
Object.keys(b).forEach(function(k) {
|
|
t[k] = b[k];
|
|
});
|
|
return t;
|
|
}
|
|
minimatch.defaults = function(def) {
|
|
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
return minimatch;
|
|
}
|
|
var orig = minimatch;
|
|
var m = function minimatch2(p, pattern, options) {
|
|
return orig(p, pattern, ext(def, options));
|
|
};
|
|
m.Minimatch = function Minimatch2(pattern, options) {
|
|
return new orig.Minimatch(pattern, ext(def, options));
|
|
};
|
|
m.Minimatch.defaults = function defaults(options) {
|
|
return orig.defaults(ext(def, options)).Minimatch;
|
|
};
|
|
m.filter = function filter2(pattern, options) {
|
|
return orig.filter(pattern, ext(def, options));
|
|
};
|
|
m.defaults = function defaults(options) {
|
|
return orig.defaults(ext(def, options));
|
|
};
|
|
m.makeRe = function makeRe2(pattern, options) {
|
|
return orig.makeRe(pattern, ext(def, options));
|
|
};
|
|
m.braceExpand = function braceExpand2(pattern, options) {
|
|
return orig.braceExpand(pattern, ext(def, options));
|
|
};
|
|
m.match = function(list, pattern, options) {
|
|
return orig.match(list, pattern, ext(def, options));
|
|
};
|
|
return m;
|
|
};
|
|
Minimatch.defaults = function(def) {
|
|
return minimatch.defaults(def).Minimatch;
|
|
};
|
|
function minimatch(p, pattern, options) {
|
|
assertValidPattern(pattern);
|
|
if (!options)
|
|
options = {};
|
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
return false;
|
|
}
|
|
return new Minimatch(pattern, options).match(p);
|
|
}
|
|
function Minimatch(pattern, options) {
|
|
if (!(this instanceof Minimatch)) {
|
|
return new Minimatch(pattern, options);
|
|
}
|
|
assertValidPattern(pattern);
|
|
if (!options)
|
|
options = {};
|
|
pattern = pattern.trim();
|
|
if (!options.allowWindowsEscape && path.sep !== "/") {
|
|
pattern = pattern.split(path.sep).join("/");
|
|
}
|
|
this.options = options;
|
|
this.set = [];
|
|
this.pattern = pattern;
|
|
this.regexp = null;
|
|
this.negate = false;
|
|
this.comment = false;
|
|
this.empty = false;
|
|
this.partial = !!options.partial;
|
|
this.make();
|
|
}
|
|
Minimatch.prototype.debug = function() {
|
|
};
|
|
Minimatch.prototype.make = make;
|
|
function make() {
|
|
var pattern = this.pattern;
|
|
var options = this.options;
|
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
this.comment = true;
|
|
return;
|
|
}
|
|
if (!pattern) {
|
|
this.empty = true;
|
|
return;
|
|
}
|
|
this.parseNegate();
|
|
var set = this.globSet = this.braceExpand();
|
|
if (options.debug)
|
|
this.debug = function debug() {
|
|
console.error.apply(console, arguments);
|
|
};
|
|
this.debug(this.pattern, set);
|
|
set = this.globParts = set.map(function(s) {
|
|
return s.split(slashSplit);
|
|
});
|
|
this.debug(this.pattern, set);
|
|
set = set.map(function(s, si, set2) {
|
|
return s.map(this.parse, this);
|
|
}, this);
|
|
this.debug(this.pattern, set);
|
|
set = set.filter(function(s) {
|
|
return s.indexOf(false) === -1;
|
|
});
|
|
this.debug(this.pattern, set);
|
|
this.set = set;
|
|
}
|
|
Minimatch.prototype.parseNegate = parseNegate;
|
|
function parseNegate() {
|
|
var pattern = this.pattern;
|
|
var negate = false;
|
|
var options = this.options;
|
|
var negateOffset = 0;
|
|
if (options.nonegate)
|
|
return;
|
|
for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
|
|
negate = !negate;
|
|
negateOffset++;
|
|
}
|
|
if (negateOffset)
|
|
this.pattern = pattern.substr(negateOffset);
|
|
this.negate = negate;
|
|
}
|
|
minimatch.braceExpand = function(pattern, options) {
|
|
return braceExpand(pattern, options);
|
|
};
|
|
Minimatch.prototype.braceExpand = braceExpand;
|
|
function braceExpand(pattern, options) {
|
|
if (!options) {
|
|
if (this instanceof Minimatch) {
|
|
options = this.options;
|
|
} else {
|
|
options = {};
|
|
}
|
|
}
|
|
pattern = typeof pattern === "undefined" ? this.pattern : pattern;
|
|
assertValidPattern(pattern);
|
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
return [pattern];
|
|
}
|
|
return expand(pattern);
|
|
}
|
|
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
var assertValidPattern = function(pattern) {
|
|
if (typeof pattern !== "string") {
|
|
throw new TypeError("invalid pattern");
|
|
}
|
|
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
throw new TypeError("pattern is too long");
|
|
}
|
|
};
|
|
Minimatch.prototype.parse = parse;
|
|
var SUBPARSE = {};
|
|
function parse(pattern, isSub) {
|
|
assertValidPattern(pattern);
|
|
var options = this.options;
|
|
if (pattern === "**") {
|
|
if (!options.noglobstar)
|
|
return GLOBSTAR;
|
|
else
|
|
pattern = "*";
|
|
}
|
|
if (pattern === "")
|
|
return "";
|
|
var re = "";
|
|
var hasMagic = !!options.nocase;
|
|
var escaping = false;
|
|
var patternListStack = [];
|
|
var negativeLists = [];
|
|
var stateChar;
|
|
var inClass = false;
|
|
var reClassStart = -1;
|
|
var classStart = -1;
|
|
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
var self2 = this;
|
|
function clearStateChar() {
|
|
if (stateChar) {
|
|
switch (stateChar) {
|
|
case "*":
|
|
re += star;
|
|
hasMagic = true;
|
|
break;
|
|
case "?":
|
|
re += qmark;
|
|
hasMagic = true;
|
|
break;
|
|
default:
|
|
re += "\\" + stateChar;
|
|
break;
|
|
}
|
|
self2.debug("clearStateChar %j %j", stateChar, re);
|
|
stateChar = false;
|
|
}
|
|
}
|
|
for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
|
|
this.debug("%s %s %s %j", pattern, i, re, c);
|
|
if (escaping && reSpecials[c]) {
|
|
re += "\\" + c;
|
|
escaping = false;
|
|
continue;
|
|
}
|
|
switch (c) {
|
|
case "/": {
|
|
return false;
|
|
}
|
|
case "\\":
|
|
clearStateChar();
|
|
escaping = true;
|
|
continue;
|
|
case "?":
|
|
case "*":
|
|
case "+":
|
|
case "@":
|
|
case "!":
|
|
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
|
|
if (inClass) {
|
|
this.debug(" in class");
|
|
if (c === "!" && i === classStart + 1)
|
|
c = "^";
|
|
re += c;
|
|
continue;
|
|
}
|
|
self2.debug("call clearStateChar %j", stateChar);
|
|
clearStateChar();
|
|
stateChar = c;
|
|
if (options.noext)
|
|
clearStateChar();
|
|
continue;
|
|
case "(":
|
|
if (inClass) {
|
|
re += "(";
|
|
continue;
|
|
}
|
|
if (!stateChar) {
|
|
re += "\\(";
|
|
continue;
|
|
}
|
|
patternListStack.push({
|
|
type: stateChar,
|
|
start: i - 1,
|
|
reStart: re.length,
|
|
open: plTypes[stateChar].open,
|
|
close: plTypes[stateChar].close
|
|
});
|
|
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
|
|
this.debug("plType %j %j", stateChar, re);
|
|
stateChar = false;
|
|
continue;
|
|
case ")":
|
|
if (inClass || !patternListStack.length) {
|
|
re += "\\)";
|
|
continue;
|
|
}
|
|
clearStateChar();
|
|
hasMagic = true;
|
|
var pl = patternListStack.pop();
|
|
re += pl.close;
|
|
if (pl.type === "!") {
|
|
negativeLists.push(pl);
|
|
}
|
|
pl.reEnd = re.length;
|
|
continue;
|
|
case "|":
|
|
if (inClass || !patternListStack.length || escaping) {
|
|
re += "\\|";
|
|
escaping = false;
|
|
continue;
|
|
}
|
|
clearStateChar();
|
|
re += "|";
|
|
continue;
|
|
case "[":
|
|
clearStateChar();
|
|
if (inClass) {
|
|
re += "\\" + c;
|
|
continue;
|
|
}
|
|
inClass = true;
|
|
classStart = i;
|
|
reClassStart = re.length;
|
|
re += c;
|
|
continue;
|
|
case "]":
|
|
if (i === classStart + 1 || !inClass) {
|
|
re += "\\" + c;
|
|
escaping = false;
|
|
continue;
|
|
}
|
|
var cs = pattern.substring(classStart + 1, i);
|
|
try {
|
|
RegExp("[" + cs + "]");
|
|
} catch (er) {
|
|
var sp = this.parse(cs, SUBPARSE);
|
|
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
hasMagic = hasMagic || sp[1];
|
|
inClass = false;
|
|
continue;
|
|
}
|
|
hasMagic = true;
|
|
inClass = false;
|
|
re += c;
|
|
continue;
|
|
default:
|
|
clearStateChar();
|
|
if (escaping) {
|
|
escaping = false;
|
|
} else if (reSpecials[c] && !(c === "^" && inClass)) {
|
|
re += "\\";
|
|
}
|
|
re += c;
|
|
}
|
|
}
|
|
if (inClass) {
|
|
cs = pattern.substr(classStart + 1);
|
|
sp = this.parse(cs, SUBPARSE);
|
|
re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
|
hasMagic = hasMagic || sp[1];
|
|
}
|
|
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
var tail = re.slice(pl.reStart + pl.open.length);
|
|
this.debug("setting tail", re, pl);
|
|
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
|
|
if (!$2) {
|
|
$2 = "\\";
|
|
}
|
|
return $1 + $1 + $2 + "|";
|
|
});
|
|
this.debug("tail=%j\n %s", tail, tail, pl, re);
|
|
var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
|
hasMagic = true;
|
|
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
|
|
}
|
|
clearStateChar();
|
|
if (escaping) {
|
|
re += "\\\\";
|
|
}
|
|
var addPatternStart = false;
|
|
switch (re.charAt(0)) {
|
|
case "[":
|
|
case ".":
|
|
case "(":
|
|
addPatternStart = true;
|
|
}
|
|
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
var nl = negativeLists[n];
|
|
var nlBefore = re.slice(0, nl.reStart);
|
|
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
|
|
var nlAfter = re.slice(nl.reEnd);
|
|
nlLast += nlAfter;
|
|
var openParensBefore = nlBefore.split("(").length - 1;
|
|
var cleanAfter = nlAfter;
|
|
for (i = 0; i < openParensBefore; i++) {
|
|
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
|
}
|
|
nlAfter = cleanAfter;
|
|
var dollar = "";
|
|
if (nlAfter === "" && isSub !== SUBPARSE) {
|
|
dollar = "$";
|
|
}
|
|
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
re = newRe;
|
|
}
|
|
if (re !== "" && hasMagic) {
|
|
re = "(?=.)" + re;
|
|
}
|
|
if (addPatternStart) {
|
|
re = patternStart + re;
|
|
}
|
|
if (isSub === SUBPARSE) {
|
|
return [re, hasMagic];
|
|
}
|
|
if (!hasMagic) {
|
|
return globUnescape(pattern);
|
|
}
|
|
var flags = options.nocase ? "i" : "";
|
|
try {
|
|
var regExp = new RegExp("^" + re + "$", flags);
|
|
} catch (er) {
|
|
return new RegExp("$.");
|
|
}
|
|
regExp._glob = pattern;
|
|
regExp._src = re;
|
|
return regExp;
|
|
}
|
|
minimatch.makeRe = function(pattern, options) {
|
|
return new Minimatch(pattern, options || {}).makeRe();
|
|
};
|
|
Minimatch.prototype.makeRe = makeRe;
|
|
function makeRe() {
|
|
if (this.regexp || this.regexp === false)
|
|
return this.regexp;
|
|
var set = this.set;
|
|
if (!set.length) {
|
|
this.regexp = false;
|
|
return this.regexp;
|
|
}
|
|
var options = this.options;
|
|
var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
var flags = options.nocase ? "i" : "";
|
|
var re = set.map(function(pattern) {
|
|
return pattern.map(function(p) {
|
|
return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
|
|
}).join("\\/");
|
|
}).join("|");
|
|
re = "^(?:" + re + ")$";
|
|
if (this.negate)
|
|
re = "^(?!" + re + ").*$";
|
|
try {
|
|
this.regexp = new RegExp(re, flags);
|
|
} catch (ex) {
|
|
this.regexp = false;
|
|
}
|
|
return this.regexp;
|
|
}
|
|
minimatch.match = function(list, pattern, options) {
|
|
options = options || {};
|
|
var mm = new Minimatch(pattern, options);
|
|
list = list.filter(function(f) {
|
|
return mm.match(f);
|
|
});
|
|
if (mm.options.nonull && !list.length) {
|
|
list.push(pattern);
|
|
}
|
|
return list;
|
|
};
|
|
Minimatch.prototype.match = function match(f, partial) {
|
|
if (typeof partial === "undefined")
|
|
partial = this.partial;
|
|
this.debug("match", f, this.pattern);
|
|
if (this.comment)
|
|
return false;
|
|
if (this.empty)
|
|
return f === "";
|
|
if (f === "/" && partial)
|
|
return true;
|
|
var options = this.options;
|
|
if (path.sep !== "/") {
|
|
f = f.split(path.sep).join("/");
|
|
}
|
|
f = f.split(slashSplit);
|
|
this.debug(this.pattern, "split", f);
|
|
var set = this.set;
|
|
this.debug(this.pattern, "set", set);
|
|
var filename;
|
|
var i;
|
|
for (i = f.length - 1; i >= 0; i--) {
|
|
filename = f[i];
|
|
if (filename)
|
|
break;
|
|
}
|
|
for (i = 0; i < set.length; i++) {
|
|
var pattern = set[i];
|
|
var file = f;
|
|
if (options.matchBase && pattern.length === 1) {
|
|
file = [filename];
|
|
}
|
|
var hit = this.matchOne(file, pattern, partial);
|
|
if (hit) {
|
|
if (options.flipNegate)
|
|
return true;
|
|
return !this.negate;
|
|
}
|
|
}
|
|
if (options.flipNegate)
|
|
return false;
|
|
return this.negate;
|
|
};
|
|
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
|
var options = this.options;
|
|
this.debug("matchOne", {
|
|
"this": this,
|
|
file,
|
|
pattern
|
|
});
|
|
this.debug("matchOne", file.length, pattern.length);
|
|
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
this.debug("matchOne loop");
|
|
var p = pattern[pi];
|
|
var f = file[fi];
|
|
this.debug(pattern, p, f);
|
|
if (p === false)
|
|
return false;
|
|
if (p === GLOBSTAR) {
|
|
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
var fr = fi;
|
|
var pr = pi + 1;
|
|
if (pr === pl) {
|
|
this.debug("** at the end");
|
|
for (; fi < fl; fi++) {
|
|
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
while (fr < fl) {
|
|
var swallowee = file[fr];
|
|
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
this.debug("globstar found match!", fr, fl, swallowee);
|
|
return true;
|
|
} else {
|
|
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
this.debug("dot detected!", file, fr, pattern, pr);
|
|
break;
|
|
}
|
|
this.debug("globstar swallow a segment, and continue");
|
|
fr++;
|
|
}
|
|
}
|
|
if (partial) {
|
|
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
if (fr === fl)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
var hit;
|
|
if (typeof p === "string") {
|
|
hit = f === p;
|
|
this.debug("string match", p, f, hit);
|
|
} else {
|
|
hit = f.match(p);
|
|
this.debug("pattern match", p, f, hit);
|
|
}
|
|
if (!hit)
|
|
return false;
|
|
}
|
|
if (fi === fl && pi === pl) {
|
|
return true;
|
|
} else if (fi === fl) {
|
|
return partial;
|
|
} else if (pi === pl) {
|
|
return fi === fl - 1 && file[fi] === "";
|
|
}
|
|
throw new Error("wtf?");
|
|
};
|
|
function globUnescape(s) {
|
|
return s.replace(/\\(.)/g, "$1");
|
|
}
|
|
function regExpEscape(s) {
|
|
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
}
|
|
}
|
|
});
|
|
var require_inherits_browser = __commonJS2({
|
|
"node_modules/inherits/inherits_browser.js"(exports2, module2) {
|
|
if (typeof Object.create === "function") {
|
|
module2.exports = function inherits(ctor, superCtor) {
|
|
if (superCtor) {
|
|
ctor.super_ = superCtor;
|
|
ctor.prototype = Object.create(superCtor.prototype, {
|
|
constructor: {
|
|
value: ctor,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
}
|
|
};
|
|
} else {
|
|
module2.exports = function inherits(ctor, superCtor) {
|
|
if (superCtor) {
|
|
ctor.super_ = superCtor;
|
|
var TempCtor = function() {
|
|
};
|
|
TempCtor.prototype = superCtor.prototype;
|
|
ctor.prototype = new TempCtor();
|
|
ctor.prototype.constructor = ctor;
|
|
}
|
|
};
|
|
}
|
|
}
|
|
});
|
|
var require_inherits = __commonJS2({
|
|
"node_modules/inherits/inherits.js"(exports2, module2) {
|
|
try {
|
|
util = require("util");
|
|
if (typeof util.inherits !== "function")
|
|
throw "";
|
|
module2.exports = util.inherits;
|
|
} catch (e) {
|
|
module2.exports = require_inherits_browser();
|
|
}
|
|
var util;
|
|
}
|
|
});
|
|
var require_path_is_absolute = __commonJS2({
|
|
"node_modules/path-is-absolute/index.js"(exports2, module2) {
|
|
"use strict";
|
|
function posix(path) {
|
|
return path.charAt(0) === "/";
|
|
}
|
|
function win32(path) {
|
|
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
var result = splitDeviceRe.exec(path);
|
|
var device = result[1] || "";
|
|
var isUnc = Boolean(device && device.charAt(1) !== ":");
|
|
return Boolean(result[2] || isUnc);
|
|
}
|
|
module2.exports = process.platform === "win32" ? win32 : posix;
|
|
module2.exports.posix = posix;
|
|
module2.exports.win32 = win32;
|
|
}
|
|
});
|
|
var require_common3 = __commonJS2({
|
|
"node_modules/glob/common.js"(exports2) {
|
|
exports2.setopts = setopts;
|
|
exports2.ownProp = ownProp;
|
|
exports2.makeAbs = makeAbs;
|
|
exports2.finish = finish;
|
|
exports2.mark = mark;
|
|
exports2.isIgnored = isIgnored;
|
|
exports2.childrenIgnored = childrenIgnored;
|
|
function ownProp(obj, field) {
|
|
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
}
|
|
var fs = require("fs");
|
|
var path = require("path");
|
|
var minimatch = require_minimatch();
|
|
var isAbsolute = require_path_is_absolute();
|
|
var Minimatch = minimatch.Minimatch;
|
|
function alphasort(a, b) {
|
|
return a.localeCompare(b, "en");
|
|
}
|
|
function setupIgnores(self2, options) {
|
|
self2.ignore = options.ignore || [];
|
|
if (!Array.isArray(self2.ignore))
|
|
self2.ignore = [self2.ignore];
|
|
if (self2.ignore.length) {
|
|
self2.ignore = self2.ignore.map(ignoreMap);
|
|
}
|
|
}
|
|
function ignoreMap(pattern) {
|
|
var gmatcher = null;
|
|
if (pattern.slice(-3) === "/**") {
|
|
var gpattern = pattern.replace(/(\/\*\*)+$/, "");
|
|
gmatcher = new Minimatch(gpattern, {
|
|
dot: true
|
|
});
|
|
}
|
|
return {
|
|
matcher: new Minimatch(pattern, {
|
|
dot: true
|
|
}),
|
|
gmatcher
|
|
};
|
|
}
|
|
function setopts(self2, pattern, options) {
|
|
if (!options)
|
|
options = {};
|
|
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
|
if (options.noglobstar) {
|
|
throw new Error("base matching requires globstar");
|
|
}
|
|
pattern = "**/" + pattern;
|
|
}
|
|
self2.silent = !!options.silent;
|
|
self2.pattern = pattern;
|
|
self2.strict = options.strict !== false;
|
|
self2.realpath = !!options.realpath;
|
|
self2.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
|
|
self2.follow = !!options.follow;
|
|
self2.dot = !!options.dot;
|
|
self2.mark = !!options.mark;
|
|
self2.nodir = !!options.nodir;
|
|
if (self2.nodir)
|
|
self2.mark = true;
|
|
self2.sync = !!options.sync;
|
|
self2.nounique = !!options.nounique;
|
|
self2.nonull = !!options.nonull;
|
|
self2.nosort = !!options.nosort;
|
|
self2.nocase = !!options.nocase;
|
|
self2.stat = !!options.stat;
|
|
self2.noprocess = !!options.noprocess;
|
|
self2.absolute = !!options.absolute;
|
|
self2.fs = options.fs || fs;
|
|
self2.maxLength = options.maxLength || Infinity;
|
|
self2.cache = options.cache || /* @__PURE__ */ Object.create(null);
|
|
self2.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
|
|
self2.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
|
|
setupIgnores(self2, options);
|
|
self2.changedCwd = false;
|
|
var cwd = process.cwd();
|
|
if (!ownProp(options, "cwd"))
|
|
self2.cwd = cwd;
|
|
else {
|
|
self2.cwd = path.resolve(options.cwd);
|
|
self2.changedCwd = self2.cwd !== cwd;
|
|
}
|
|
self2.root = options.root || path.resolve(self2.cwd, "/");
|
|
self2.root = path.resolve(self2.root);
|
|
if (process.platform === "win32")
|
|
self2.root = self2.root.replace(/\\/g, "/");
|
|
self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
|
|
if (process.platform === "win32")
|
|
self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
|
|
self2.nomount = !!options.nomount;
|
|
options.nonegate = true;
|
|
options.nocomment = true;
|
|
options.allowWindowsEscape = false;
|
|
self2.minimatch = new Minimatch(pattern, options);
|
|
self2.options = self2.minimatch.options;
|
|
}
|
|
function finish(self2) {
|
|
var nou = self2.nounique;
|
|
var all = nou ? [] : /* @__PURE__ */ Object.create(null);
|
|
for (var i = 0, l = self2.matches.length; i < l; i++) {
|
|
var matches = self2.matches[i];
|
|
if (!matches || Object.keys(matches).length === 0) {
|
|
if (self2.nonull) {
|
|
var literal = self2.minimatch.globSet[i];
|
|
if (nou)
|
|
all.push(literal);
|
|
else
|
|
all[literal] = true;
|
|
}
|
|
} else {
|
|
var m = Object.keys(matches);
|
|
if (nou)
|
|
all.push.apply(all, m);
|
|
else
|
|
m.forEach(function(m2) {
|
|
all[m2] = true;
|
|
});
|
|
}
|
|
}
|
|
if (!nou)
|
|
all = Object.keys(all);
|
|
if (!self2.nosort)
|
|
all = all.sort(alphasort);
|
|
if (self2.mark) {
|
|
for (var i = 0; i < all.length; i++) {
|
|
all[i] = self2._mark(all[i]);
|
|
}
|
|
if (self2.nodir) {
|
|
all = all.filter(function(e) {
|
|
var notDir = !/\/$/.test(e);
|
|
var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
|
|
if (notDir && c)
|
|
notDir = c !== "DIR" && !Array.isArray(c);
|
|
return notDir;
|
|
});
|
|
}
|
|
}
|
|
if (self2.ignore.length)
|
|
all = all.filter(function(m2) {
|
|
return !isIgnored(self2, m2);
|
|
});
|
|
self2.found = all;
|
|
}
|
|
function mark(self2, p) {
|
|
var abs = makeAbs(self2, p);
|
|
var c = self2.cache[abs];
|
|
var m = p;
|
|
if (c) {
|
|
var isDir = c === "DIR" || Array.isArray(c);
|
|
var slash = p.slice(-1) === "/";
|
|
if (isDir && !slash)
|
|
m += "/";
|
|
else if (!isDir && slash)
|
|
m = m.slice(0, -1);
|
|
if (m !== p) {
|
|
var mabs = makeAbs(self2, m);
|
|
self2.statCache[mabs] = self2.statCache[abs];
|
|
self2.cache[mabs] = self2.cache[abs];
|
|
}
|
|
}
|
|
return m;
|
|
}
|
|
function makeAbs(self2, f) {
|
|
var abs = f;
|
|
if (f.charAt(0) === "/") {
|
|
abs = path.join(self2.root, f);
|
|
} else if (isAbsolute(f) || f === "") {
|
|
abs = f;
|
|
} else if (self2.changedCwd) {
|
|
abs = path.resolve(self2.cwd, f);
|
|
} else {
|
|
abs = path.resolve(f);
|
|
}
|
|
if (process.platform === "win32")
|
|
abs = abs.replace(/\\/g, "/");
|
|
return abs;
|
|
}
|
|
function isIgnored(self2, path2) {
|
|
if (!self2.ignore.length)
|
|
return false;
|
|
return self2.ignore.some(function(item) {
|
|
return item.matcher.match(path2) || !!(item.gmatcher && item.gmatcher.match(path2));
|
|
});
|
|
}
|
|
function childrenIgnored(self2, path2) {
|
|
if (!self2.ignore.length)
|
|
return false;
|
|
return self2.ignore.some(function(item) {
|
|
return !!(item.gmatcher && item.gmatcher.match(path2));
|
|
});
|
|
}
|
|
}
|
|
});
|
|
var require_sync7 = __commonJS2({
|
|
"node_modules/glob/sync.js"(exports2, module2) {
|
|
module2.exports = globSync;
|
|
globSync.GlobSync = GlobSync;
|
|
var rp = require_fs5();
|
|
var minimatch = require_minimatch();
|
|
var Minimatch = minimatch.Minimatch;
|
|
var Glob = require_glob().Glob;
|
|
var util = require("util");
|
|
var path = require("path");
|
|
var assert = require("assert");
|
|
var isAbsolute = require_path_is_absolute();
|
|
var common = require_common3();
|
|
var setopts = common.setopts;
|
|
var ownProp = common.ownProp;
|
|
var childrenIgnored = common.childrenIgnored;
|
|
var isIgnored = common.isIgnored;
|
|
function globSync(pattern, options) {
|
|
if (typeof options === "function" || arguments.length === 3)
|
|
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
return new GlobSync(pattern, options).found;
|
|
}
|
|
function GlobSync(pattern, options) {
|
|
if (!pattern)
|
|
throw new Error("must provide pattern");
|
|
if (typeof options === "function" || arguments.length === 3)
|
|
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
if (!(this instanceof GlobSync))
|
|
return new GlobSync(pattern, options);
|
|
setopts(this, pattern, options);
|
|
if (this.noprocess)
|
|
return this;
|
|
var n = this.minimatch.set.length;
|
|
this.matches = new Array(n);
|
|
for (var i = 0; i < n; i++) {
|
|
this._process(this.minimatch.set[i], i, false);
|
|
}
|
|
this._finish();
|
|
}
|
|
GlobSync.prototype._finish = function() {
|
|
assert.ok(this instanceof GlobSync);
|
|
if (this.realpath) {
|
|
var self2 = this;
|
|
this.matches.forEach(function(matchset, index) {
|
|
var set = self2.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
for (var p in matchset) {
|
|
try {
|
|
p = self2._makeAbs(p);
|
|
var real = rp.realpathSync(p, self2.realpathCache);
|
|
set[real] = true;
|
|
} catch (er) {
|
|
if (er.syscall === "stat")
|
|
set[self2._makeAbs(p)] = true;
|
|
else
|
|
throw er;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
common.finish(this);
|
|
};
|
|
GlobSync.prototype._process = function(pattern, index, inGlobStar) {
|
|
assert.ok(this instanceof GlobSync);
|
|
var n = 0;
|
|
while (typeof pattern[n] === "string") {
|
|
n++;
|
|
}
|
|
var prefix;
|
|
switch (n) {
|
|
case pattern.length:
|
|
this._processSimple(pattern.join("/"), index);
|
|
return;
|
|
case 0:
|
|
prefix = null;
|
|
break;
|
|
default:
|
|
prefix = pattern.slice(0, n).join("/");
|
|
break;
|
|
}
|
|
var remain = pattern.slice(n);
|
|
var read;
|
|
if (prefix === null)
|
|
read = ".";
|
|
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
|
|
return typeof p === "string" ? p : "[*]";
|
|
}).join("/"))) {
|
|
if (!prefix || !isAbsolute(prefix))
|
|
prefix = "/" + prefix;
|
|
read = prefix;
|
|
} else
|
|
read = prefix;
|
|
var abs = this._makeAbs(read);
|
|
if (childrenIgnored(this, read))
|
|
return;
|
|
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
if (isGlobStar)
|
|
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
|
|
else
|
|
this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
|
|
};
|
|
GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
var entries = this._readdir(abs, inGlobStar);
|
|
if (!entries)
|
|
return;
|
|
var pn = remain[0];
|
|
var negate = !!this.minimatch.negate;
|
|
var rawGlob = pn._glob;
|
|
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
var matchedEntries = [];
|
|
for (var i = 0; i < entries.length; i++) {
|
|
var e = entries[i];
|
|
if (e.charAt(0) !== "." || dotOk) {
|
|
var m;
|
|
if (negate && !prefix) {
|
|
m = !e.match(pn);
|
|
} else {
|
|
m = e.match(pn);
|
|
}
|
|
if (m)
|
|
matchedEntries.push(e);
|
|
}
|
|
}
|
|
var len = matchedEntries.length;
|
|
if (len === 0)
|
|
return;
|
|
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
if (!this.matches[index])
|
|
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
for (var i = 0; i < len; i++) {
|
|
var e = matchedEntries[i];
|
|
if (prefix) {
|
|
if (prefix.slice(-1) !== "/")
|
|
e = prefix + "/" + e;
|
|
else
|
|
e = prefix + e;
|
|
}
|
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
e = path.join(this.root, e);
|
|
}
|
|
this._emitMatch(index, e);
|
|
}
|
|
return;
|
|
}
|
|
remain.shift();
|
|
for (var i = 0; i < len; i++) {
|
|
var e = matchedEntries[i];
|
|
var newPattern;
|
|
if (prefix)
|
|
newPattern = [prefix, e];
|
|
else
|
|
newPattern = [e];
|
|
this._process(newPattern.concat(remain), index, inGlobStar);
|
|
}
|
|
};
|
|
GlobSync.prototype._emitMatch = function(index, e) {
|
|
if (isIgnored(this, e))
|
|
return;
|
|
var abs = this._makeAbs(e);
|
|
if (this.mark)
|
|
e = this._mark(e);
|
|
if (this.absolute) {
|
|
e = abs;
|
|
}
|
|
if (this.matches[index][e])
|
|
return;
|
|
if (this.nodir) {
|
|
var c = this.cache[abs];
|
|
if (c === "DIR" || Array.isArray(c))
|
|
return;
|
|
}
|
|
this.matches[index][e] = true;
|
|
if (this.stat)
|
|
this._stat(e);
|
|
};
|
|
GlobSync.prototype._readdirInGlobStar = function(abs) {
|
|
if (this.follow)
|
|
return this._readdir(abs, false);
|
|
var entries;
|
|
var lstat;
|
|
var stat;
|
|
try {
|
|
lstat = this.fs.lstatSync(abs);
|
|
} catch (er) {
|
|
if (er.code === "ENOENT") {
|
|
return null;
|
|
}
|
|
}
|
|
var isSym = lstat && lstat.isSymbolicLink();
|
|
this.symlinks[abs] = isSym;
|
|
if (!isSym && lstat && !lstat.isDirectory())
|
|
this.cache[abs] = "FILE";
|
|
else
|
|
entries = this._readdir(abs, false);
|
|
return entries;
|
|
};
|
|
GlobSync.prototype._readdir = function(abs, inGlobStar) {
|
|
var entries;
|
|
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
return this._readdirInGlobStar(abs);
|
|
if (ownProp(this.cache, abs)) {
|
|
var c = this.cache[abs];
|
|
if (!c || c === "FILE")
|
|
return null;
|
|
if (Array.isArray(c))
|
|
return c;
|
|
}
|
|
try {
|
|
return this._readdirEntries(abs, this.fs.readdirSync(abs));
|
|
} catch (er) {
|
|
this._readdirError(abs, er);
|
|
return null;
|
|
}
|
|
};
|
|
GlobSync.prototype._readdirEntries = function(abs, entries) {
|
|
if (!this.mark && !this.stat) {
|
|
for (var i = 0; i < entries.length; i++) {
|
|
var e = entries[i];
|
|
if (abs === "/")
|
|
e = abs + e;
|
|
else
|
|
e = abs + "/" + e;
|
|
this.cache[e] = true;
|
|
}
|
|
}
|
|
this.cache[abs] = entries;
|
|
return entries;
|
|
};
|
|
GlobSync.prototype._readdirError = function(f, er) {
|
|
switch (er.code) {
|
|
case "ENOTSUP":
|
|
case "ENOTDIR":
|
|
var abs = this._makeAbs(f);
|
|
this.cache[abs] = "FILE";
|
|
if (abs === this.cwdAbs) {
|
|
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
error.path = this.cwd;
|
|
error.code = er.code;
|
|
throw error;
|
|
}
|
|
break;
|
|
case "ENOENT":
|
|
case "ELOOP":
|
|
case "ENAMETOOLONG":
|
|
case "UNKNOWN":
|
|
this.cache[this._makeAbs(f)] = false;
|
|
break;
|
|
default:
|
|
this.cache[this._makeAbs(f)] = false;
|
|
if (this.strict)
|
|
throw er;
|
|
if (!this.silent)
|
|
console.error("glob error", er);
|
|
break;
|
|
}
|
|
};
|
|
GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
var entries = this._readdir(abs, inGlobStar);
|
|
if (!entries)
|
|
return;
|
|
var remainWithoutGlobStar = remain.slice(1);
|
|
var gspref = prefix ? [prefix] : [];
|
|
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
this._process(noGlobStar, index, false);
|
|
var len = entries.length;
|
|
var isSym = this.symlinks[abs];
|
|
if (isSym && inGlobStar)
|
|
return;
|
|
for (var i = 0; i < len; i++) {
|
|
var e = entries[i];
|
|
if (e.charAt(0) === "." && !this.dot)
|
|
continue;
|
|
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
this._process(instead, index, true);
|
|
var below = gspref.concat(entries[i], remain);
|
|
this._process(below, index, true);
|
|
}
|
|
};
|
|
GlobSync.prototype._processSimple = function(prefix, index) {
|
|
var exists = this._stat(prefix);
|
|
if (!this.matches[index])
|
|
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
if (!exists)
|
|
return;
|
|
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
var trail = /[\/\\]$/.test(prefix);
|
|
if (prefix.charAt(0) === "/") {
|
|
prefix = path.join(this.root, prefix);
|
|
} else {
|
|
prefix = path.resolve(this.root, prefix);
|
|
if (trail)
|
|
prefix += "/";
|
|
}
|
|
}
|
|
if (process.platform === "win32")
|
|
prefix = prefix.replace(/\\/g, "/");
|
|
this._emitMatch(index, prefix);
|
|
};
|
|
GlobSync.prototype._stat = function(f) {
|
|
var abs = this._makeAbs(f);
|
|
var needDir = f.slice(-1) === "/";
|
|
if (f.length > this.maxLength)
|
|
return false;
|
|
if (!this.stat && ownProp(this.cache, abs)) {
|
|
var c = this.cache[abs];
|
|
if (Array.isArray(c))
|
|
c = "DIR";
|
|
if (!needDir || c === "DIR")
|
|
return c;
|
|
if (needDir && c === "FILE")
|
|
return false;
|
|
}
|
|
var exists;
|
|
var stat = this.statCache[abs];
|
|
if (!stat) {
|
|
var lstat;
|
|
try {
|
|
lstat = this.fs.lstatSync(abs);
|
|
} catch (er) {
|
|
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
this.statCache[abs] = false;
|
|
return false;
|
|
}
|
|
}
|
|
if (lstat && lstat.isSymbolicLink()) {
|
|
try {
|
|
stat = this.fs.statSync(abs);
|
|
} catch (er) {
|
|
stat = lstat;
|
|
}
|
|
} else {
|
|
stat = lstat;
|
|
}
|
|
}
|
|
this.statCache[abs] = stat;
|
|
var c = true;
|
|
if (stat)
|
|
c = stat.isDirectory() ? "DIR" : "FILE";
|
|
this.cache[abs] = this.cache[abs] || c;
|
|
if (needDir && c === "FILE")
|
|
return false;
|
|
return c;
|
|
};
|
|
GlobSync.prototype._mark = function(p) {
|
|
return common.mark(this, p);
|
|
};
|
|
GlobSync.prototype._makeAbs = function(f) {
|
|
return common.makeAbs(this, f);
|
|
};
|
|
}
|
|
});
|
|
var require_wrappy = __commonJS2({
|
|
"node_modules/wrappy/wrappy.js"(exports2, module2) {
|
|
module2.exports = wrappy;
|
|
function wrappy(fn, cb) {
|
|
if (fn && cb)
|
|
return wrappy(fn)(cb);
|
|
if (typeof fn !== "function")
|
|
throw new TypeError("need wrapper function");
|
|
Object.keys(fn).forEach(function(k) {
|
|
wrapper[k] = fn[k];
|
|
});
|
|
return wrapper;
|
|
function wrapper() {
|
|
var args = new Array(arguments.length);
|
|
for (var i = 0; i < args.length; i++) {
|
|
args[i] = arguments[i];
|
|
}
|
|
var ret = fn.apply(this, args);
|
|
var cb2 = args[args.length - 1];
|
|
if (typeof ret === "function" && ret !== cb2) {
|
|
Object.keys(cb2).forEach(function(k) {
|
|
ret[k] = cb2[k];
|
|
});
|
|
}
|
|
return ret;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
var require_once = __commonJS2({
|
|
"node_modules/once/once.js"(exports2, module2) {
|
|
var wrappy = require_wrappy();
|
|
module2.exports = wrappy(once);
|
|
module2.exports.strict = wrappy(onceStrict);
|
|
once.proto = once(function() {
|
|
Object.defineProperty(Function.prototype, "once", {
|
|
value: function() {
|
|
return once(this);
|
|
},
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(Function.prototype, "onceStrict", {
|
|
value: function() {
|
|
return onceStrict(this);
|
|
},
|
|
configurable: true
|
|
});
|
|
});
|
|
function once(fn) {
|
|
var f = function() {
|
|
if (f.called)
|
|
return f.value;
|
|
f.called = true;
|
|
return f.value = fn.apply(this, arguments);
|
|
};
|
|
f.called = false;
|
|
return f;
|
|
}
|
|
function onceStrict(fn) {
|
|
var f = function() {
|
|
if (f.called)
|
|
throw new Error(f.onceError);
|
|
f.called = true;
|
|
return f.value = fn.apply(this, arguments);
|
|
};
|
|
var name = fn.name || "Function wrapped with `once`";
|
|
f.onceError = name + " shouldn't be called more than once";
|
|
f.called = false;
|
|
return f;
|
|
}
|
|
}
|
|
});
|
|
var require_inflight = __commonJS2({
|
|
"node_modules/inflight/inflight.js"(exports2, module2) {
|
|
var wrappy = require_wrappy();
|
|
var reqs = /* @__PURE__ */ Object.create(null);
|
|
var once = require_once();
|
|
module2.exports = wrappy(inflight);
|
|
function inflight(key, cb) {
|
|
if (reqs[key]) {
|
|
reqs[key].push(cb);
|
|
return null;
|
|
} else {
|
|
reqs[key] = [cb];
|
|
return makeres(key);
|
|
}
|
|
}
|
|
function makeres(key) {
|
|
return once(function RES() {
|
|
var cbs = reqs[key];
|
|
var len = cbs.length;
|
|
var args = slice(arguments);
|
|
try {
|
|
for (var i = 0; i < len; i++) {
|
|
cbs[i].apply(null, args);
|
|
}
|
|
} finally {
|
|
if (cbs.length > len) {
|
|
cbs.splice(0, len);
|
|
process.nextTick(function() {
|
|
RES.apply(null, args);
|
|
});
|
|
} else {
|
|
delete reqs[key];
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function slice(args) {
|
|
var length = args.length;
|
|
var array2 = [];
|
|
for (var i = 0; i < length; i++)
|
|
array2[i] = args[i];
|
|
return array2;
|
|
}
|
|
}
|
|
});
|
|
var require_glob = __commonJS2({
|
|
"node_modules/glob/glob.js"(exports2, module2) {
|
|
module2.exports = glob;
|
|
var rp = require_fs5();
|
|
var minimatch = require_minimatch();
|
|
var Minimatch = minimatch.Minimatch;
|
|
var inherits = require_inherits();
|
|
var EE = require("events").EventEmitter;
|
|
var path = require("path");
|
|
var assert = require("assert");
|
|
var isAbsolute = require_path_is_absolute();
|
|
var globSync = require_sync7();
|
|
var common = require_common3();
|
|
var setopts = common.setopts;
|
|
var ownProp = common.ownProp;
|
|
var inflight = require_inflight();
|
|
var util = require("util");
|
|
var childrenIgnored = common.childrenIgnored;
|
|
var isIgnored = common.isIgnored;
|
|
var once = require_once();
|
|
function glob(pattern, options, cb) {
|
|
if (typeof options === "function")
|
|
cb = options, options = {};
|
|
if (!options)
|
|
options = {};
|
|
if (options.sync) {
|
|
if (cb)
|
|
throw new TypeError("callback provided to sync glob");
|
|
return globSync(pattern, options);
|
|
}
|
|
return new Glob(pattern, options, cb);
|
|
}
|
|
glob.sync = globSync;
|
|
var GlobSync = glob.GlobSync = globSync.GlobSync;
|
|
glob.glob = glob;
|
|
function extend(origin, add) {
|
|
if (add === null || typeof add !== "object") {
|
|
return origin;
|
|
}
|
|
var keys = Object.keys(add);
|
|
var i = keys.length;
|
|
while (i--) {
|
|
origin[keys[i]] = add[keys[i]];
|
|
}
|
|
return origin;
|
|
}
|
|
glob.hasMagic = function(pattern, options_) {
|
|
var options = extend({}, options_);
|
|
options.noprocess = true;
|
|
var g = new Glob(pattern, options);
|
|
var set = g.minimatch.set;
|
|
if (!pattern)
|
|
return false;
|
|
if (set.length > 1)
|
|
return true;
|
|
for (var j = 0; j < set[0].length; j++) {
|
|
if (typeof set[0][j] !== "string")
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
glob.Glob = Glob;
|
|
inherits(Glob, EE);
|
|
function Glob(pattern, options, cb) {
|
|
if (typeof options === "function") {
|
|
cb = options;
|
|
options = null;
|
|
}
|
|
if (options && options.sync) {
|
|
if (cb)
|
|
throw new TypeError("callback provided to sync glob");
|
|
return new GlobSync(pattern, options);
|
|
}
|
|
if (!(this instanceof Glob))
|
|
return new Glob(pattern, options, cb);
|
|
setopts(this, pattern, options);
|
|
this._didRealPath = false;
|
|
var n = this.minimatch.set.length;
|
|
this.matches = new Array(n);
|
|
if (typeof cb === "function") {
|
|
cb = once(cb);
|
|
this.on("error", cb);
|
|
this.on("end", function(matches) {
|
|
cb(null, matches);
|
|
});
|
|
}
|
|
var self2 = this;
|
|
this._processing = 0;
|
|
this._emitQueue = [];
|
|
this._processQueue = [];
|
|
this.paused = false;
|
|
if (this.noprocess)
|
|
return this;
|
|
if (n === 0)
|
|
return done();
|
|
var sync = true;
|
|
for (var i = 0; i < n; i++) {
|
|
this._process(this.minimatch.set[i], i, false, done);
|
|
}
|
|
sync = false;
|
|
function done() {
|
|
--self2._processing;
|
|
if (self2._processing <= 0) {
|
|
if (sync) {
|
|
process.nextTick(function() {
|
|
self2._finish();
|
|
});
|
|
} else {
|
|
self2._finish();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Glob.prototype._finish = function() {
|
|
assert(this instanceof Glob);
|
|
if (this.aborted)
|
|
return;
|
|
if (this.realpath && !this._didRealpath)
|
|
return this._realpath();
|
|
common.finish(this);
|
|
this.emit("end", this.found);
|
|
};
|
|
Glob.prototype._realpath = function() {
|
|
if (this._didRealpath)
|
|
return;
|
|
this._didRealpath = true;
|
|
var n = this.matches.length;
|
|
if (n === 0)
|
|
return this._finish();
|
|
var self2 = this;
|
|
for (var i = 0; i < this.matches.length; i++)
|
|
this._realpathSet(i, next);
|
|
function next() {
|
|
if (--n === 0)
|
|
self2._finish();
|
|
}
|
|
};
|
|
Glob.prototype._realpathSet = function(index, cb) {
|
|
var matchset = this.matches[index];
|
|
if (!matchset)
|
|
return cb();
|
|
var found = Object.keys(matchset);
|
|
var self2 = this;
|
|
var n = found.length;
|
|
if (n === 0)
|
|
return cb();
|
|
var set = this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
found.forEach(function(p, i) {
|
|
p = self2._makeAbs(p);
|
|
rp.realpath(p, self2.realpathCache, function(er, real) {
|
|
if (!er)
|
|
set[real] = true;
|
|
else if (er.syscall === "stat")
|
|
set[p] = true;
|
|
else
|
|
self2.emit("error", er);
|
|
if (--n === 0) {
|
|
self2.matches[index] = set;
|
|
cb();
|
|
}
|
|
});
|
|
});
|
|
};
|
|
Glob.prototype._mark = function(p) {
|
|
return common.mark(this, p);
|
|
};
|
|
Glob.prototype._makeAbs = function(f) {
|
|
return common.makeAbs(this, f);
|
|
};
|
|
Glob.prototype.abort = function() {
|
|
this.aborted = true;
|
|
this.emit("abort");
|
|
};
|
|
Glob.prototype.pause = function() {
|
|
if (!this.paused) {
|
|
this.paused = true;
|
|
this.emit("pause");
|
|
}
|
|
};
|
|
Glob.prototype.resume = function() {
|
|
if (this.paused) {
|
|
this.emit("resume");
|
|
this.paused = false;
|
|
if (this._emitQueue.length) {
|
|
var eq = this._emitQueue.slice(0);
|
|
this._emitQueue.length = 0;
|
|
for (var i = 0; i < eq.length; i++) {
|
|
var e = eq[i];
|
|
this._emitMatch(e[0], e[1]);
|
|
}
|
|
}
|
|
if (this._processQueue.length) {
|
|
var pq = this._processQueue.slice(0);
|
|
this._processQueue.length = 0;
|
|
for (var i = 0; i < pq.length; i++) {
|
|
var p = pq[i];
|
|
this._processing--;
|
|
this._process(p[0], p[1], p[2], p[3]);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
|
|
assert(this instanceof Glob);
|
|
assert(typeof cb === "function");
|
|
if (this.aborted)
|
|
return;
|
|
this._processing++;
|
|
if (this.paused) {
|
|
this._processQueue.push([pattern, index, inGlobStar, cb]);
|
|
return;
|
|
}
|
|
var n = 0;
|
|
while (typeof pattern[n] === "string") {
|
|
n++;
|
|
}
|
|
var prefix;
|
|
switch (n) {
|
|
case pattern.length:
|
|
this._processSimple(pattern.join("/"), index, cb);
|
|
return;
|
|
case 0:
|
|
prefix = null;
|
|
break;
|
|
default:
|
|
prefix = pattern.slice(0, n).join("/");
|
|
break;
|
|
}
|
|
var remain = pattern.slice(n);
|
|
var read;
|
|
if (prefix === null)
|
|
read = ".";
|
|
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
|
|
return typeof p === "string" ? p : "[*]";
|
|
}).join("/"))) {
|
|
if (!prefix || !isAbsolute(prefix))
|
|
prefix = "/" + prefix;
|
|
read = prefix;
|
|
} else
|
|
read = prefix;
|
|
var abs = this._makeAbs(read);
|
|
if (childrenIgnored(this, read))
|
|
return cb();
|
|
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
if (isGlobStar)
|
|
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
else
|
|
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
};
|
|
Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
var self2 = this;
|
|
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
});
|
|
};
|
|
Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
if (!entries)
|
|
return cb();
|
|
var pn = remain[0];
|
|
var negate = !!this.minimatch.negate;
|
|
var rawGlob = pn._glob;
|
|
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
var matchedEntries = [];
|
|
for (var i = 0; i < entries.length; i++) {
|
|
var e = entries[i];
|
|
if (e.charAt(0) !== "." || dotOk) {
|
|
var m;
|
|
if (negate && !prefix) {
|
|
m = !e.match(pn);
|
|
} else {
|
|
m = e.match(pn);
|
|
}
|
|
if (m)
|
|
matchedEntries.push(e);
|
|
}
|
|
}
|
|
var len = matchedEntries.length;
|
|
if (len === 0)
|
|
return cb();
|
|
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
if (!this.matches[index])
|
|
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
for (var i = 0; i < len; i++) {
|
|
var e = matchedEntries[i];
|
|
if (prefix) {
|
|
if (prefix !== "/")
|
|
e = prefix + "/" + e;
|
|
else
|
|
e = prefix + e;
|
|
}
|
|
if (e.charAt(0) === "/" && !this.nomount) {
|
|
e = path.join(this.root, e);
|
|
}
|
|
this._emitMatch(index, e);
|
|
}
|
|
return cb();
|
|
}
|
|
remain.shift();
|
|
for (var i = 0; i < len; i++) {
|
|
var e = matchedEntries[i];
|
|
var newPattern;
|
|
if (prefix) {
|
|
if (prefix !== "/")
|
|
e = prefix + "/" + e;
|
|
else
|
|
e = prefix + e;
|
|
}
|
|
this._process([e].concat(remain), index, inGlobStar, cb);
|
|
}
|
|
cb();
|
|
};
|
|
Glob.prototype._emitMatch = function(index, e) {
|
|
if (this.aborted)
|
|
return;
|
|
if (isIgnored(this, e))
|
|
return;
|
|
if (this.paused) {
|
|
this._emitQueue.push([index, e]);
|
|
return;
|
|
}
|
|
var abs = isAbsolute(e) ? e : this._makeAbs(e);
|
|
if (this.mark)
|
|
e = this._mark(e);
|
|
if (this.absolute)
|
|
e = abs;
|
|
if (this.matches[index][e])
|
|
return;
|
|
if (this.nodir) {
|
|
var c = this.cache[abs];
|
|
if (c === "DIR" || Array.isArray(c))
|
|
return;
|
|
}
|
|
this.matches[index][e] = true;
|
|
var st = this.statCache[abs];
|
|
if (st)
|
|
this.emit("stat", e, st);
|
|
this.emit("match", e);
|
|
};
|
|
Glob.prototype._readdirInGlobStar = function(abs, cb) {
|
|
if (this.aborted)
|
|
return;
|
|
if (this.follow)
|
|
return this._readdir(abs, false, cb);
|
|
var lstatkey = "lstat\0" + abs;
|
|
var self2 = this;
|
|
var lstatcb = inflight(lstatkey, lstatcb_);
|
|
if (lstatcb)
|
|
self2.fs.lstat(abs, lstatcb);
|
|
function lstatcb_(er, lstat) {
|
|
if (er && er.code === "ENOENT")
|
|
return cb();
|
|
var isSym = lstat && lstat.isSymbolicLink();
|
|
self2.symlinks[abs] = isSym;
|
|
if (!isSym && lstat && !lstat.isDirectory()) {
|
|
self2.cache[abs] = "FILE";
|
|
cb();
|
|
} else
|
|
self2._readdir(abs, false, cb);
|
|
}
|
|
};
|
|
Glob.prototype._readdir = function(abs, inGlobStar, cb) {
|
|
if (this.aborted)
|
|
return;
|
|
cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
|
|
if (!cb)
|
|
return;
|
|
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
return this._readdirInGlobStar(abs, cb);
|
|
if (ownProp(this.cache, abs)) {
|
|
var c = this.cache[abs];
|
|
if (!c || c === "FILE")
|
|
return cb();
|
|
if (Array.isArray(c))
|
|
return cb(null, c);
|
|
}
|
|
var self2 = this;
|
|
self2.fs.readdir(abs, readdirCb(this, abs, cb));
|
|
};
|
|
function readdirCb(self2, abs, cb) {
|
|
return function(er, entries) {
|
|
if (er)
|
|
self2._readdirError(abs, er, cb);
|
|
else
|
|
self2._readdirEntries(abs, entries, cb);
|
|
};
|
|
}
|
|
Glob.prototype._readdirEntries = function(abs, entries, cb) {
|
|
if (this.aborted)
|
|
return;
|
|
if (!this.mark && !this.stat) {
|
|
for (var i = 0; i < entries.length; i++) {
|
|
var e = entries[i];
|
|
if (abs === "/")
|
|
e = abs + e;
|
|
else
|
|
e = abs + "/" + e;
|
|
this.cache[e] = true;
|
|
}
|
|
}
|
|
this.cache[abs] = entries;
|
|
return cb(null, entries);
|
|
};
|
|
Glob.prototype._readdirError = function(f, er, cb) {
|
|
if (this.aborted)
|
|
return;
|
|
switch (er.code) {
|
|
case "ENOTSUP":
|
|
case "ENOTDIR":
|
|
var abs = this._makeAbs(f);
|
|
this.cache[abs] = "FILE";
|
|
if (abs === this.cwdAbs) {
|
|
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
error.path = this.cwd;
|
|
error.code = er.code;
|
|
this.emit("error", error);
|
|
this.abort();
|
|
}
|
|
break;
|
|
case "ENOENT":
|
|
case "ELOOP":
|
|
case "ENAMETOOLONG":
|
|
case "UNKNOWN":
|
|
this.cache[this._makeAbs(f)] = false;
|
|
break;
|
|
default:
|
|
this.cache[this._makeAbs(f)] = false;
|
|
if (this.strict) {
|
|
this.emit("error", er);
|
|
this.abort();
|
|
}
|
|
if (!this.silent)
|
|
console.error("glob error", er);
|
|
break;
|
|
}
|
|
return cb();
|
|
};
|
|
Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
var self2 = this;
|
|
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
});
|
|
};
|
|
Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
if (!entries)
|
|
return cb();
|
|
var remainWithoutGlobStar = remain.slice(1);
|
|
var gspref = prefix ? [prefix] : [];
|
|
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
this._process(noGlobStar, index, false, cb);
|
|
var isSym = this.symlinks[abs];
|
|
var len = entries.length;
|
|
if (isSym && inGlobStar)
|
|
return cb();
|
|
for (var i = 0; i < len; i++) {
|
|
var e = entries[i];
|
|
if (e.charAt(0) === "." && !this.dot)
|
|
continue;
|
|
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
this._process(instead, index, true, cb);
|
|
var below = gspref.concat(entries[i], remain);
|
|
this._process(below, index, true, cb);
|
|
}
|
|
cb();
|
|
};
|
|
Glob.prototype._processSimple = function(prefix, index, cb) {
|
|
var self2 = this;
|
|
this._stat(prefix, function(er, exists) {
|
|
self2._processSimple2(prefix, index, er, exists, cb);
|
|
});
|
|
};
|
|
Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
|
|
if (!this.matches[index])
|
|
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
if (!exists)
|
|
return cb();
|
|
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
var trail = /[\/\\]$/.test(prefix);
|
|
if (prefix.charAt(0) === "/") {
|
|
prefix = path.join(this.root, prefix);
|
|
} else {
|
|
prefix = path.resolve(this.root, prefix);
|
|
if (trail)
|
|
prefix += "/";
|
|
}
|
|
}
|
|
if (process.platform === "win32")
|
|
prefix = prefix.replace(/\\/g, "/");
|
|
this._emitMatch(index, prefix);
|
|
cb();
|
|
};
|
|
Glob.prototype._stat = function(f, cb) {
|
|
var abs = this._makeAbs(f);
|
|
var needDir = f.slice(-1) === "/";
|
|
if (f.length > this.maxLength)
|
|
return cb();
|
|
if (!this.stat && ownProp(this.cache, abs)) {
|
|
var c = this.cache[abs];
|
|
if (Array.isArray(c))
|
|
c = "DIR";
|
|
if (!needDir || c === "DIR")
|
|
return cb(null, c);
|
|
if (needDir && c === "FILE")
|
|
return cb();
|
|
}
|
|
var exists;
|
|
var stat = this.statCache[abs];
|
|
if (stat !== void 0) {
|
|
if (stat === false)
|
|
return cb(null, stat);
|
|
else {
|
|
var type = stat.isDirectory() ? "DIR" : "FILE";
|
|
if (needDir && type === "FILE")
|
|
return cb();
|
|
else
|
|
return cb(null, type, stat);
|
|
}
|
|
}
|
|
var self2 = this;
|
|
var statcb = inflight("stat\0" + abs, lstatcb_);
|
|
if (statcb)
|
|
self2.fs.lstat(abs, statcb);
|
|
function lstatcb_(er, lstat) {
|
|
if (lstat && lstat.isSymbolicLink()) {
|
|
return self2.fs.stat(abs, function(er2, stat2) {
|
|
if (er2)
|
|
self2._stat2(f, abs, null, lstat, cb);
|
|
else
|
|
self2._stat2(f, abs, er2, stat2, cb);
|
|
});
|
|
} else {
|
|
self2._stat2(f, abs, er, lstat, cb);
|
|
}
|
|
}
|
|
};
|
|
Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
|
|
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
this.statCache[abs] = false;
|
|
return cb();
|
|
}
|
|
var needDir = f.slice(-1) === "/";
|
|
this.statCache[abs] = stat;
|
|
if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
|
|
return cb(null, false, stat);
|
|
var c = true;
|
|
if (stat)
|
|
c = stat.isDirectory() ? "DIR" : "FILE";
|
|
this.cache[abs] = this.cache[abs] || c;
|
|
if (needDir && c === "FILE")
|
|
return cb();
|
|
return cb(null, c, stat);
|
|
};
|
|
}
|
|
});
|
|
var require_rimraf = __commonJS2({
|
|
"node_modules/rimraf/rimraf.js"(exports2, module2) {
|
|
var assert = require("assert");
|
|
var path = require("path");
|
|
var fs = require("fs");
|
|
var glob = void 0;
|
|
try {
|
|
glob = require_glob();
|
|
} catch (_err) {
|
|
}
|
|
var defaultGlobOpts = {
|
|
nosort: true,
|
|
silent: true
|
|
};
|
|
var timeout = 0;
|
|
var isWindows = process.platform === "win32";
|
|
var defaults = (options) => {
|
|
const methods = ["unlink", "chmod", "stat", "lstat", "rmdir", "readdir"];
|
|
methods.forEach((m) => {
|
|
options[m] = options[m] || fs[m];
|
|
m = m + "Sync";
|
|
options[m] = options[m] || fs[m];
|
|
});
|
|
options.maxBusyTries = options.maxBusyTries || 3;
|
|
options.emfileWait = options.emfileWait || 1e3;
|
|
if (options.glob === false) {
|
|
options.disableGlob = true;
|
|
}
|
|
if (options.disableGlob !== true && glob === void 0) {
|
|
throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
|
|
}
|
|
options.disableGlob = options.disableGlob || false;
|
|
options.glob = options.glob || defaultGlobOpts;
|
|
};
|
|
var rimraf = (p, options, cb) => {
|
|
if (typeof options === "function") {
|
|
cb = options;
|
|
options = {};
|
|
}
|
|
assert(p, "rimraf: missing path");
|
|
assert.equal(typeof p, "string", "rimraf: path should be a string");
|
|
assert.equal(typeof cb, "function", "rimraf: callback function required");
|
|
assert(options, "rimraf: invalid options argument provided");
|
|
assert.equal(typeof options, "object", "rimraf: options should be object");
|
|
defaults(options);
|
|
let busyTries = 0;
|
|
let errState = null;
|
|
let n = 0;
|
|
const next = (er) => {
|
|
errState = errState || er;
|
|
if (--n === 0)
|
|
cb(errState);
|
|
};
|
|
const afterGlob = (er, results) => {
|
|
if (er)
|
|
return cb(er);
|
|
n = results.length;
|
|
if (n === 0)
|
|
return cb();
|
|
results.forEach((p2) => {
|
|
const CB = (er2) => {
|
|
if (er2) {
|
|
if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
|
|
busyTries++;
|
|
return setTimeout(() => rimraf_(p2, options, CB), busyTries * 100);
|
|
}
|
|
if (er2.code === "EMFILE" && timeout < options.emfileWait) {
|
|
return setTimeout(() => rimraf_(p2, options, CB), timeout++);
|
|
}
|
|
if (er2.code === "ENOENT")
|
|
er2 = null;
|
|
}
|
|
timeout = 0;
|
|
next(er2);
|
|
};
|
|
rimraf_(p2, options, CB);
|
|
});
|
|
};
|
|
if (options.disableGlob || !glob.hasMagic(p))
|
|
return afterGlob(null, [p]);
|
|
options.lstat(p, (er, stat) => {
|
|
if (!er)
|
|
return afterGlob(null, [p]);
|
|
glob(p, options.glob, afterGlob);
|
|
});
|
|
};
|
|
var rimraf_ = (p, options, cb) => {
|
|
assert(p);
|
|
assert(options);
|
|
assert(typeof cb === "function");
|
|
options.lstat(p, (er, st) => {
|
|
if (er && er.code === "ENOENT")
|
|
return cb(null);
|
|
if (er && er.code === "EPERM" && isWindows)
|
|
fixWinEPERM(p, options, er, cb);
|
|
if (st && st.isDirectory())
|
|
return rmdir(p, options, er, cb);
|
|
options.unlink(p, (er2) => {
|
|
if (er2) {
|
|
if (er2.code === "ENOENT")
|
|
return cb(null);
|
|
if (er2.code === "EPERM")
|
|
return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
|
|
if (er2.code === "EISDIR")
|
|
return rmdir(p, options, er2, cb);
|
|
}
|
|
return cb(er2);
|
|
});
|
|
});
|
|
};
|
|
var fixWinEPERM = (p, options, er, cb) => {
|
|
assert(p);
|
|
assert(options);
|
|
assert(typeof cb === "function");
|
|
options.chmod(p, 438, (er2) => {
|
|
if (er2)
|
|
cb(er2.code === "ENOENT" ? null : er);
|
|
else
|
|
options.stat(p, (er3, stats) => {
|
|
if (er3)
|
|
cb(er3.code === "ENOENT" ? null : er);
|
|
else if (stats.isDirectory())
|
|
rmdir(p, options, er, cb);
|
|
else
|
|
options.unlink(p, cb);
|
|
});
|
|
});
|
|
};
|
|
var fixWinEPERMSync = (p, options, er) => {
|
|
assert(p);
|
|
assert(options);
|
|
try {
|
|
options.chmodSync(p, 438);
|
|
} catch (er2) {
|
|
if (er2.code === "ENOENT")
|
|
return;
|
|
else
|
|
throw er;
|
|
}
|
|
let stats;
|
|
try {
|
|
stats = options.statSync(p);
|
|
} catch (er3) {
|
|
if (er3.code === "ENOENT")
|
|
return;
|
|
else
|
|
throw er;
|
|
}
|
|
if (stats.isDirectory())
|
|
rmdirSync(p, options, er);
|
|
else
|
|
options.unlinkSync(p);
|
|
};
|
|
var rmdir = (p, options, originalEr, cb) => {
|
|
assert(p);
|
|
assert(options);
|
|
assert(typeof cb === "function");
|
|
options.rmdir(p, (er) => {
|
|
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
|
|
rmkids(p, options, cb);
|
|
else if (er && er.code === "ENOTDIR")
|
|
cb(originalEr);
|
|
else
|
|
cb(er);
|
|
});
|
|
};
|
|
var rmkids = (p, options, cb) => {
|
|
assert(p);
|
|
assert(options);
|
|
assert(typeof cb === "function");
|
|
options.readdir(p, (er, files) => {
|
|
if (er)
|
|
return cb(er);
|
|
let n = files.length;
|
|
if (n === 0)
|
|
return options.rmdir(p, cb);
|
|
let errState;
|
|
files.forEach((f) => {
|
|
rimraf(path.join(p, f), options, (er2) => {
|
|
if (errState)
|
|
return;
|
|
if (er2)
|
|
return cb(errState = er2);
|
|
if (--n === 0)
|
|
options.rmdir(p, cb);
|
|
});
|
|
});
|
|
});
|
|
};
|
|
var rimrafSync = (p, options) => {
|
|
options = options || {};
|
|
defaults(options);
|
|
assert(p, "rimraf: missing path");
|
|
assert.equal(typeof p, "string", "rimraf: path should be a string");
|
|
assert(options, "rimraf: missing options");
|
|
assert.equal(typeof options, "object", "rimraf: options should be object");
|
|
let results;
|
|
if (options.disableGlob || !glob.hasMagic(p)) {
|
|
results = [p];
|
|
} else {
|
|
try {
|
|
options.lstatSync(p);
|
|
results = [p];
|
|
} catch (er) {
|
|
results = glob.sync(p, options.glob);
|
|
}
|
|
}
|
|
if (!results.length)
|
|
return;
|
|
for (let i = 0; i < results.length; i++) {
|
|
const p2 = results[i];
|
|
let st;
|
|
try {
|
|
st = options.lstatSync(p2);
|
|
} catch (er) {
|
|
if (er.code === "ENOENT")
|
|
return;
|
|
if (er.code === "EPERM" && isWindows)
|
|
fixWinEPERMSync(p2, options, er);
|
|
}
|
|
try {
|
|
if (st && st.isDirectory())
|
|
rmdirSync(p2, options, null);
|
|
else
|
|
options.unlinkSync(p2);
|
|
} catch (er) {
|
|
if (er.code === "ENOENT")
|
|
return;
|
|
if (er.code === "EPERM")
|
|
return isWindows ? fixWinEPERMSync(p2, options, er) : rmdirSync(p2, options, er);
|
|
if (er.code !== "EISDIR")
|
|
throw er;
|
|
rmdirSync(p2, options, er);
|
|
}
|
|
}
|
|
};
|
|
var rmdirSync = (p, options, originalEr) => {
|
|
assert(p);
|
|
assert(options);
|
|
try {
|
|
options.rmdirSync(p);
|
|
} catch (er) {
|
|
if (er.code === "ENOENT")
|
|
return;
|
|
if (er.code === "ENOTDIR")
|
|
throw originalEr;
|
|
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
|
|
rmkidsSync(p, options);
|
|
}
|
|
};
|
|
var rmkidsSync = (p, options) => {
|
|
assert(p);
|
|
assert(options);
|
|
options.readdirSync(p).forEach((f) => rimrafSync(path.join(p, f), options));
|
|
const retries = isWindows ? 100 : 1;
|
|
let i = 0;
|
|
do {
|
|
let threw = true;
|
|
try {
|
|
const ret = options.rmdirSync(p, options);
|
|
threw = false;
|
|
return ret;
|
|
} finally {
|
|
if (++i < retries && threw)
|
|
continue;
|
|
}
|
|
} while (true);
|
|
};
|
|
module2.exports = rimraf;
|
|
rimraf.sync = rimrafSync;
|
|
}
|
|
});
|
|
var require_del = __commonJS2({
|
|
"node_modules/flat-cache/src/del.js"(exports2, module2) {
|
|
var rimraf = require_rimraf().sync;
|
|
var fs = require("fs");
|
|
module2.exports = function del(file) {
|
|
if (fs.existsSync(file)) {
|
|
rimraf(file, {
|
|
glob: false
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
});
|
|
var require_cache = __commonJS2({
|
|
"node_modules/flat-cache/src/cache.js"(exports2, module2) {
|
|
var path = require("path");
|
|
var fs = require("fs");
|
|
var utils = require_utils6();
|
|
var del = require_del();
|
|
var writeJSON = utils.writeJSON;
|
|
var cache = {
|
|
load: function(docId, cacheDir) {
|
|
var me = this;
|
|
me._visited = {};
|
|
me._persisted = {};
|
|
me._pathToFile = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, "../.cache/", docId);
|
|
if (fs.existsSync(me._pathToFile)) {
|
|
me._persisted = utils.tryParse(me._pathToFile, {});
|
|
}
|
|
},
|
|
loadFile: function(pathToFile) {
|
|
var me = this;
|
|
var dir = path.dirname(pathToFile);
|
|
var fName = path.basename(pathToFile);
|
|
me.load(fName, dir);
|
|
},
|
|
all: function() {
|
|
return this._persisted;
|
|
},
|
|
keys: function() {
|
|
return Object.keys(this._persisted);
|
|
},
|
|
setKey: function(key, value) {
|
|
this._visited[key] = true;
|
|
this._persisted[key] = value;
|
|
},
|
|
removeKey: function(key) {
|
|
delete this._visited[key];
|
|
delete this._persisted[key];
|
|
},
|
|
getKey: function(key) {
|
|
this._visited[key] = true;
|
|
return this._persisted[key];
|
|
},
|
|
_prune: function() {
|
|
var me = this;
|
|
var obj = {};
|
|
var keys = Object.keys(me._visited);
|
|
if (keys.length === 0) {
|
|
return;
|
|
}
|
|
keys.forEach(function(key) {
|
|
obj[key] = me._persisted[key];
|
|
});
|
|
me._visited = {};
|
|
me._persisted = obj;
|
|
},
|
|
save: function(noPrune) {
|
|
var me = this;
|
|
!noPrune && me._prune();
|
|
writeJSON(me._pathToFile, me._persisted);
|
|
},
|
|
removeCacheFile: function() {
|
|
return del(this._pathToFile);
|
|
},
|
|
destroy: function() {
|
|
var me = this;
|
|
me._visited = {};
|
|
me._persisted = {};
|
|
me.removeCacheFile();
|
|
}
|
|
};
|
|
module2.exports = {
|
|
load: function(docId, cacheDir) {
|
|
return this.create(docId, cacheDir);
|
|
},
|
|
create: function(docId, cacheDir) {
|
|
var obj = Object.create(cache);
|
|
obj.load(docId, cacheDir);
|
|
return obj;
|
|
},
|
|
createFromFile: function(filePath) {
|
|
var obj = Object.create(cache);
|
|
obj.loadFile(filePath);
|
|
return obj;
|
|
},
|
|
clearCacheById: function(docId, cacheDir) {
|
|
var filePath = cacheDir ? path.resolve(cacheDir, docId) : path.resolve(__dirname, "../.cache/", docId);
|
|
return del(filePath);
|
|
},
|
|
clearAll: function(cacheDir) {
|
|
var filePath = cacheDir ? path.resolve(cacheDir) : path.resolve(__dirname, "../.cache/");
|
|
return del(filePath);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_cache2 = __commonJS2({
|
|
"node_modules/file-entry-cache/cache.js"(exports2, module2) {
|
|
var path = require("path");
|
|
var crypto = require("crypto");
|
|
module2.exports = {
|
|
createFromFile: function(filePath, useChecksum) {
|
|
var fname = path.basename(filePath);
|
|
var dir = path.dirname(filePath);
|
|
return this.create(fname, dir, useChecksum);
|
|
},
|
|
create: function(cacheId, _path, useChecksum) {
|
|
var fs = require("fs");
|
|
var flatCache = require_cache();
|
|
var cache = flatCache.load(cacheId, _path);
|
|
var normalizedEntries = {};
|
|
var removeNotFoundFiles = function removeNotFoundFiles2() {
|
|
const cachedEntries = cache.keys();
|
|
cachedEntries.forEach(function remover(fPath) {
|
|
try {
|
|
fs.statSync(fPath);
|
|
} catch (err) {
|
|
if (err.code === "ENOENT") {
|
|
cache.removeKey(fPath);
|
|
}
|
|
}
|
|
});
|
|
};
|
|
removeNotFoundFiles();
|
|
return {
|
|
cache,
|
|
getHash: function(buffer) {
|
|
return crypto.createHash("md5").update(buffer).digest("hex");
|
|
},
|
|
hasFileChanged: function(file) {
|
|
return this.getFileDescriptor(file).changed;
|
|
},
|
|
analyzeFiles: function(files) {
|
|
var me = this;
|
|
files = files || [];
|
|
var res = {
|
|
changedFiles: [],
|
|
notFoundFiles: [],
|
|
notChangedFiles: []
|
|
};
|
|
me.normalizeEntries(files).forEach(function(entry) {
|
|
if (entry.changed) {
|
|
res.changedFiles.push(entry.key);
|
|
return;
|
|
}
|
|
if (entry.notFound) {
|
|
res.notFoundFiles.push(entry.key);
|
|
return;
|
|
}
|
|
res.notChangedFiles.push(entry.key);
|
|
});
|
|
return res;
|
|
},
|
|
getFileDescriptor: function(file) {
|
|
var fstat;
|
|
try {
|
|
fstat = fs.statSync(file);
|
|
} catch (ex) {
|
|
this.removeEntry(file);
|
|
return {
|
|
key: file,
|
|
notFound: true,
|
|
err: ex
|
|
};
|
|
}
|
|
if (useChecksum) {
|
|
return this._getFileDescriptorUsingChecksum(file);
|
|
}
|
|
return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
|
|
},
|
|
_getFileDescriptorUsingMtimeAndSize: function(file, fstat) {
|
|
var meta = cache.getKey(file);
|
|
var cacheExists = !!meta;
|
|
var cSize = fstat.size;
|
|
var cTime = fstat.mtime.getTime();
|
|
var isDifferentDate;
|
|
var isDifferentSize;
|
|
if (!meta) {
|
|
meta = {
|
|
size: cSize,
|
|
mtime: cTime
|
|
};
|
|
} else {
|
|
isDifferentDate = cTime !== meta.mtime;
|
|
isDifferentSize = cSize !== meta.size;
|
|
}
|
|
var nEntry = normalizedEntries[file] = {
|
|
key: file,
|
|
changed: !cacheExists || isDifferentDate || isDifferentSize,
|
|
meta
|
|
};
|
|
return nEntry;
|
|
},
|
|
_getFileDescriptorUsingChecksum: function(file) {
|
|
var meta = cache.getKey(file);
|
|
var cacheExists = !!meta;
|
|
var contentBuffer;
|
|
try {
|
|
contentBuffer = fs.readFileSync(file);
|
|
} catch (ex) {
|
|
contentBuffer = "";
|
|
}
|
|
var isDifferent = true;
|
|
var hash = this.getHash(contentBuffer);
|
|
if (!meta) {
|
|
meta = {
|
|
hash
|
|
};
|
|
} else {
|
|
isDifferent = hash !== meta.hash;
|
|
}
|
|
var nEntry = normalizedEntries[file] = {
|
|
key: file,
|
|
changed: !cacheExists || isDifferent,
|
|
meta
|
|
};
|
|
return nEntry;
|
|
},
|
|
getUpdatedFiles: function(files) {
|
|
var me = this;
|
|
files = files || [];
|
|
return me.normalizeEntries(files).filter(function(entry) {
|
|
return entry.changed;
|
|
}).map(function(entry) {
|
|
return entry.key;
|
|
});
|
|
},
|
|
normalizeEntries: function(files) {
|
|
files = files || [];
|
|
var me = this;
|
|
var nEntries = files.map(function(file) {
|
|
return me.getFileDescriptor(file);
|
|
});
|
|
return nEntries;
|
|
},
|
|
removeEntry: function(entryName) {
|
|
delete normalizedEntries[entryName];
|
|
cache.removeKey(entryName);
|
|
},
|
|
deleteCacheFile: function() {
|
|
cache.removeCacheFile();
|
|
},
|
|
destroy: function() {
|
|
normalizedEntries = {};
|
|
cache.destroy();
|
|
},
|
|
_getMetaForFileUsingCheckSum: function(cacheEntry) {
|
|
var contentBuffer = fs.readFileSync(cacheEntry.key);
|
|
var hash = this.getHash(contentBuffer);
|
|
var meta = Object.assign(cacheEntry.meta, {
|
|
hash
|
|
});
|
|
delete meta.size;
|
|
delete meta.mtime;
|
|
return meta;
|
|
},
|
|
_getMetaForFileUsingMtimeAndSize: function(cacheEntry) {
|
|
var stat = fs.statSync(cacheEntry.key);
|
|
var meta = Object.assign(cacheEntry.meta, {
|
|
size: stat.size,
|
|
mtime: stat.mtime.getTime()
|
|
});
|
|
delete meta.hash;
|
|
return meta;
|
|
},
|
|
reconcile: function(noPrune) {
|
|
removeNotFoundFiles();
|
|
noPrune = typeof noPrune === "undefined" ? true : noPrune;
|
|
var entries = normalizedEntries;
|
|
var keys = Object.keys(entries);
|
|
if (keys.length === 0) {
|
|
return;
|
|
}
|
|
var me = this;
|
|
keys.forEach(function(entryName) {
|
|
var cacheEntry = entries[entryName];
|
|
try {
|
|
var meta = useChecksum ? me._getMetaForFileUsingCheckSum(cacheEntry) : me._getMetaForFileUsingMtimeAndSize(cacheEntry);
|
|
cache.setKey(entryName, meta);
|
|
} catch (err) {
|
|
if (err.code !== "ENOENT") {
|
|
throw err;
|
|
}
|
|
}
|
|
});
|
|
cache.save(noPrune);
|
|
}
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_format_results_cache = __commonJS2({
|
|
"src/cli/format-results-cache.js"(exports2, module2) {
|
|
"use strict";
|
|
var fileEntryCache = require_cache2();
|
|
var stringify2 = require_fast_json_stable_stringify();
|
|
var {
|
|
version: prettierVersion
|
|
} = require("./index.js");
|
|
var {
|
|
createHash
|
|
} = require_utils();
|
|
var optionsHashCache = /* @__PURE__ */ new WeakMap();
|
|
var nodeVersion = process && process.version;
|
|
function getHashOfOptions(options) {
|
|
if (optionsHashCache.has(options)) {
|
|
return optionsHashCache.get(options);
|
|
}
|
|
const hash = createHash(`${prettierVersion}_${nodeVersion}_${stringify2(options)}`);
|
|
optionsHashCache.set(options, hash);
|
|
return hash;
|
|
}
|
|
function getMetadataFromFileDescriptor(fileDescriptor) {
|
|
return fileDescriptor.meta;
|
|
}
|
|
var FormatResultsCache = class {
|
|
constructor(cacheFileLocation, cacheStrategy) {
|
|
const useChecksum = cacheStrategy === "content";
|
|
this.cacheFileLocation = cacheFileLocation;
|
|
this.fileEntryCache = fileEntryCache.create(cacheFileLocation, void 0, useChecksum);
|
|
}
|
|
existsAvailableFormatResultsCache(filePath, options) {
|
|
const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
|
|
if (fileDescriptor.notFound) {
|
|
return false;
|
|
}
|
|
const hashOfOptions = getHashOfOptions(options);
|
|
const meta = getMetadataFromFileDescriptor(fileDescriptor);
|
|
const changed = fileDescriptor.changed || meta.hashOfOptions !== hashOfOptions;
|
|
return !changed;
|
|
}
|
|
setFormatResultsCache(filePath, options) {
|
|
const fileDescriptor = this.fileEntryCache.getFileDescriptor(filePath);
|
|
const meta = getMetadataFromFileDescriptor(fileDescriptor);
|
|
if (fileDescriptor && !fileDescriptor.notFound) {
|
|
meta.hashOfOptions = getHashOfOptions(options);
|
|
}
|
|
}
|
|
removeFormatResultsCache(filePath) {
|
|
this.fileEntryCache.removeEntry(filePath);
|
|
}
|
|
reconcile() {
|
|
this.fileEntryCache.reconcile();
|
|
}
|
|
};
|
|
module2.exports = FormatResultsCache;
|
|
}
|
|
});
|
|
var require_base = __commonJS2({
|
|
"node_modules/diff/lib/diff/base.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2["default"] = Diff;
|
|
function Diff() {
|
|
}
|
|
Diff.prototype = {
|
|
diff: function diff(oldString, newString) {
|
|
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
var callback = options.callback;
|
|
if (typeof options === "function") {
|
|
callback = options;
|
|
options = {};
|
|
}
|
|
this.options = options;
|
|
var self2 = this;
|
|
function done(value) {
|
|
if (callback) {
|
|
setTimeout(function() {
|
|
callback(void 0, value);
|
|
}, 0);
|
|
return true;
|
|
} else {
|
|
return value;
|
|
}
|
|
}
|
|
oldString = this.castInput(oldString);
|
|
newString = this.castInput(newString);
|
|
oldString = this.removeEmpty(this.tokenize(oldString));
|
|
newString = this.removeEmpty(this.tokenize(newString));
|
|
var newLen = newString.length, oldLen = oldString.length;
|
|
var editLength = 1;
|
|
var maxEditLength = newLen + oldLen;
|
|
var bestPath = [{
|
|
newPos: -1,
|
|
components: []
|
|
}];
|
|
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
|
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
|
return done([{
|
|
value: this.join(newString),
|
|
count: newString.length
|
|
}]);
|
|
}
|
|
function execEditLength() {
|
|
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
|
var basePath = void 0;
|
|
var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
|
if (addPath) {
|
|
bestPath[diagonalPath - 1] = void 0;
|
|
}
|
|
var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
|
|
if (!canAdd && !canRemove) {
|
|
bestPath[diagonalPath] = void 0;
|
|
continue;
|
|
}
|
|
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
|
basePath = clonePath(removePath);
|
|
self2.pushComponent(basePath.components, void 0, true);
|
|
} else {
|
|
basePath = addPath;
|
|
basePath.newPos++;
|
|
self2.pushComponent(basePath.components, true, void 0);
|
|
}
|
|
_oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath);
|
|
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
|
return done(buildValues(self2, basePath.components, newString, oldString, self2.useLongestToken));
|
|
} else {
|
|
bestPath[diagonalPath] = basePath;
|
|
}
|
|
}
|
|
editLength++;
|
|
}
|
|
if (callback) {
|
|
(function exec() {
|
|
setTimeout(function() {
|
|
if (editLength > maxEditLength) {
|
|
return callback();
|
|
}
|
|
if (!execEditLength()) {
|
|
exec();
|
|
}
|
|
}, 0);
|
|
})();
|
|
} else {
|
|
while (editLength <= maxEditLength) {
|
|
var ret = execEditLength();
|
|
if (ret) {
|
|
return ret;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
pushComponent: function pushComponent(components, added, removed) {
|
|
var last = components[components.length - 1];
|
|
if (last && last.added === added && last.removed === removed) {
|
|
components[components.length - 1] = {
|
|
count: last.count + 1,
|
|
added,
|
|
removed
|
|
};
|
|
} else {
|
|
components.push({
|
|
count: 1,
|
|
added,
|
|
removed
|
|
});
|
|
}
|
|
},
|
|
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
|
var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
|
|
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
|
newPos++;
|
|
oldPos++;
|
|
commonCount++;
|
|
}
|
|
if (commonCount) {
|
|
basePath.components.push({
|
|
count: commonCount
|
|
});
|
|
}
|
|
basePath.newPos = newPos;
|
|
return oldPos;
|
|
},
|
|
equals: function equals(left, right) {
|
|
if (this.options.comparator) {
|
|
return this.options.comparator(left, right);
|
|
} else {
|
|
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
}
|
|
},
|
|
removeEmpty: function removeEmpty(array2) {
|
|
var ret = [];
|
|
for (var i = 0; i < array2.length; i++) {
|
|
if (array2[i]) {
|
|
ret.push(array2[i]);
|
|
}
|
|
}
|
|
return ret;
|
|
},
|
|
castInput: function castInput(value) {
|
|
return value;
|
|
},
|
|
tokenize: function tokenize(value) {
|
|
return value.split("");
|
|
},
|
|
join: function join(chars) {
|
|
return chars.join("");
|
|
}
|
|
};
|
|
function buildValues(diff, components, newString, oldString, useLongestToken) {
|
|
var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
|
for (; componentPos < componentLen; componentPos++) {
|
|
var component = components[componentPos];
|
|
if (!component.removed) {
|
|
if (!component.added && useLongestToken) {
|
|
var value = newString.slice(newPos, newPos + component.count);
|
|
value = value.map(function(value2, i) {
|
|
var oldValue = oldString[oldPos + i];
|
|
return oldValue.length > value2.length ? oldValue : value2;
|
|
});
|
|
component.value = diff.join(value);
|
|
} else {
|
|
component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
|
}
|
|
newPos += component.count;
|
|
if (!component.added) {
|
|
oldPos += component.count;
|
|
}
|
|
} else {
|
|
component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
|
oldPos += component.count;
|
|
if (componentPos && components[componentPos - 1].added) {
|
|
var tmp = components[componentPos - 1];
|
|
components[componentPos - 1] = components[componentPos];
|
|
components[componentPos] = tmp;
|
|
}
|
|
}
|
|
}
|
|
var lastComponent = components[componentLen - 1];
|
|
if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) {
|
|
components[componentLen - 2].value += lastComponent.value;
|
|
components.pop();
|
|
}
|
|
return components;
|
|
}
|
|
function clonePath(path) {
|
|
return {
|
|
newPos: path.newPos,
|
|
components: path.components.slice(0)
|
|
};
|
|
}
|
|
}
|
|
});
|
|
var require_params = __commonJS2({
|
|
"node_modules/diff/lib/util/params.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.generateOptions = generateOptions;
|
|
function generateOptions(options, defaults) {
|
|
if (typeof options === "function") {
|
|
defaults.callback = options;
|
|
} else if (options) {
|
|
for (var name in options) {
|
|
if (options.hasOwnProperty(name)) {
|
|
defaults[name] = options[name];
|
|
}
|
|
}
|
|
}
|
|
return defaults;
|
|
}
|
|
}
|
|
});
|
|
var require_line = __commonJS2({
|
|
"node_modules/diff/lib/diff/line.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.diffLines = diffLines;
|
|
exports2.diffTrimmedLines = diffTrimmedLines;
|
|
exports2.lineDiff = void 0;
|
|
var _base = _interopRequireDefault(require_base());
|
|
var _params = require_params();
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : {
|
|
"default": obj
|
|
};
|
|
}
|
|
var lineDiff = new _base["default"]();
|
|
exports2.lineDiff = lineDiff;
|
|
lineDiff.tokenize = function(value) {
|
|
var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
linesAndNewlines.pop();
|
|
}
|
|
for (var i = 0; i < linesAndNewlines.length; i++) {
|
|
var line = linesAndNewlines[i];
|
|
if (i % 2 && !this.options.newlineIsToken) {
|
|
retLines[retLines.length - 1] += line;
|
|
} else {
|
|
if (this.options.ignoreWhitespace) {
|
|
line = line.trim();
|
|
}
|
|
retLines.push(line);
|
|
}
|
|
}
|
|
return retLines;
|
|
};
|
|
function diffLines(oldStr, newStr, callback) {
|
|
return lineDiff.diff(oldStr, newStr, callback);
|
|
}
|
|
function diffTrimmedLines(oldStr, newStr, callback) {
|
|
var options = (0, _params.generateOptions)(callback, {
|
|
ignoreWhitespace: true
|
|
});
|
|
return lineDiff.diff(oldStr, newStr, options);
|
|
}
|
|
}
|
|
});
|
|
var require_create = __commonJS2({
|
|
"node_modules/diff/lib/patch/create.js"(exports2) {
|
|
"use strict";
|
|
Object.defineProperty(exports2, "__esModule", {
|
|
value: true
|
|
});
|
|
exports2.structuredPatch = structuredPatch;
|
|
exports2.formatPatch = formatPatch;
|
|
exports2.createTwoFilesPatch = createTwoFilesPatch;
|
|
exports2.createPatch = createPatch;
|
|
var _line = require_line();
|
|
function _toConsumableArray(arr) {
|
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
}
|
|
function _nonIterableSpread() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
function _unsupportedIterableToArray(o, minLen) {
|
|
if (!o)
|
|
return;
|
|
if (typeof o === "string")
|
|
return _arrayLikeToArray(o, minLen);
|
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
if (n === "Object" && o.constructor)
|
|
n = o.constructor.name;
|
|
if (n === "Map" || n === "Set")
|
|
return Array.from(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
return _arrayLikeToArray(o, minLen);
|
|
}
|
|
function _iterableToArray(iter) {
|
|
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
|
|
return Array.from(iter);
|
|
}
|
|
function _arrayWithoutHoles(arr) {
|
|
if (Array.isArray(arr))
|
|
return _arrayLikeToArray(arr);
|
|
}
|
|
function _arrayLikeToArray(arr, len) {
|
|
if (len == null || len > arr.length)
|
|
len = arr.length;
|
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
arr2[i] = arr[i];
|
|
}
|
|
return arr2;
|
|
}
|
|
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
if (!options) {
|
|
options = {};
|
|
}
|
|
if (typeof options.context === "undefined") {
|
|
options.context = 4;
|
|
}
|
|
var diff = (0, _line.diffLines)(oldStr, newStr, options);
|
|
diff.push({
|
|
value: "",
|
|
lines: []
|
|
});
|
|
function contextLines(lines) {
|
|
return lines.map(function(entry) {
|
|
return " " + entry;
|
|
});
|
|
}
|
|
var hunks = [];
|
|
var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
|
var _loop = function _loop2(i2) {
|
|
var current = diff[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
|
current.lines = lines;
|
|
if (current.added || current.removed) {
|
|
var _curRange;
|
|
if (!oldRangeStart) {
|
|
var prev = diff[i2 - 1];
|
|
oldRangeStart = oldLine;
|
|
newRangeStart = newLine;
|
|
if (prev) {
|
|
curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
|
|
oldRangeStart -= curRange.length;
|
|
newRangeStart -= curRange.length;
|
|
}
|
|
}
|
|
(_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function(entry) {
|
|
return (current.added ? "+" : "-") + entry;
|
|
})));
|
|
if (current.added) {
|
|
newLine += lines.length;
|
|
} else {
|
|
oldLine += lines.length;
|
|
}
|
|
} else {
|
|
if (oldRangeStart) {
|
|
if (lines.length <= options.context * 2 && i2 < diff.length - 2) {
|
|
var _curRange2;
|
|
(_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
|
|
} else {
|
|
var _curRange3;
|
|
var contextSize = Math.min(lines.length, options.context);
|
|
(_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
|
|
var hunk = {
|
|
oldStart: oldRangeStart,
|
|
oldLines: oldLine - oldRangeStart + contextSize,
|
|
newStart: newRangeStart,
|
|
newLines: newLine - newRangeStart + contextSize,
|
|
lines: curRange
|
|
};
|
|
if (i2 >= diff.length - 2 && lines.length <= options.context) {
|
|
var oldEOFNewline = /\n$/.test(oldStr);
|
|
var newEOFNewline = /\n$/.test(newStr);
|
|
var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
|
|
if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
|
|
curRange.splice(hunk.oldLines, 0, "\\ No newline at end of file");
|
|
}
|
|
if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
|
|
curRange.push("\\ No newline at end of file");
|
|
}
|
|
}
|
|
hunks.push(hunk);
|
|
oldRangeStart = 0;
|
|
newRangeStart = 0;
|
|
curRange = [];
|
|
}
|
|
}
|
|
oldLine += lines.length;
|
|
newLine += lines.length;
|
|
}
|
|
};
|
|
for (var i = 0; i < diff.length; i++) {
|
|
_loop(i);
|
|
}
|
|
return {
|
|
oldFileName,
|
|
newFileName,
|
|
oldHeader,
|
|
newHeader,
|
|
hunks
|
|
};
|
|
}
|
|
function formatPatch(diff) {
|
|
var ret = [];
|
|
if (diff.oldFileName == diff.newFileName) {
|
|
ret.push("Index: " + diff.oldFileName);
|
|
}
|
|
ret.push("===================================================================");
|
|
ret.push("--- " + diff.oldFileName + (typeof diff.oldHeader === "undefined" ? "" : " " + diff.oldHeader));
|
|
ret.push("+++ " + diff.newFileName + (typeof diff.newHeader === "undefined" ? "" : " " + diff.newHeader));
|
|
for (var i = 0; i < diff.hunks.length; i++) {
|
|
var hunk = diff.hunks[i];
|
|
if (hunk.oldLines === 0) {
|
|
hunk.oldStart -= 1;
|
|
}
|
|
if (hunk.newLines === 0) {
|
|
hunk.newStart -= 1;
|
|
}
|
|
ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
|
|
ret.push.apply(ret, hunk.lines);
|
|
}
|
|
return ret.join("\n") + "\n";
|
|
}
|
|
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
|
|
}
|
|
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
}
|
|
}
|
|
});
|
|
var require_format = __commonJS2({
|
|
"src/cli/format.js"(exports2, module2) {
|
|
"use strict";
|
|
var {
|
|
promises: fs
|
|
} = require("fs");
|
|
var path = require("path");
|
|
var {
|
|
default: chalk2
|
|
} = (init_source(), __toCommonJS(source_exports));
|
|
var prettier2 = require("./index.js");
|
|
var {
|
|
getStdin
|
|
} = require("./third-party.js");
|
|
var {
|
|
createIgnorer,
|
|
errors
|
|
} = require_prettier_internal();
|
|
var {
|
|
expandPatterns,
|
|
fixWindowsSlashes
|
|
} = require_expand_patterns();
|
|
var getOptionsForFile = require_get_options_for_file();
|
|
var isTTY = require_is_tty();
|
|
var findCacheFile = require_find_cache_file();
|
|
var FormatResultsCache = require_format_results_cache();
|
|
var {
|
|
statSafe
|
|
} = require_utils();
|
|
function diff(a, b) {
|
|
return require_create().createTwoFilesPatch("", "", a, b, "", "", {
|
|
context: 2
|
|
});
|
|
}
|
|
function handleError(context, filename, error, printedFilename) {
|
|
if (error instanceof errors.UndefinedParserError) {
|
|
if ((context.argv.write || context.argv.ignoreUnknown) && printedFilename) {
|
|
printedFilename.clear();
|
|
}
|
|
if (context.argv.ignoreUnknown) {
|
|
return;
|
|
}
|
|
if (!context.argv.check && !context.argv.listDifferent) {
|
|
process.exitCode = 2;
|
|
}
|
|
context.logger.error(error.message);
|
|
return;
|
|
}
|
|
if (context.argv.write) {
|
|
process.stdout.write("\n");
|
|
}
|
|
const isParseError = Boolean(error && error.loc);
|
|
const isValidationError = /^Invalid \S+ value\./.test(error && error.message);
|
|
if (isParseError) {
|
|
context.logger.error(`${filename}: ${String(error)}`);
|
|
} else if (isValidationError || error instanceof errors.ConfigError) {
|
|
context.logger.error(error.message);
|
|
process.exit(1);
|
|
} else if (error instanceof errors.DebugError) {
|
|
context.logger.error(`${filename}: ${error.message}`);
|
|
} else {
|
|
context.logger.error(filename + ": " + (error.stack || error));
|
|
}
|
|
process.exitCode = 2;
|
|
}
|
|
function writeOutput(context, result, options) {
|
|
process.stdout.write(context.argv.debugCheck ? result.filepath : result.formatted);
|
|
if (options && options.cursorOffset >= 0) {
|
|
process.stderr.write(result.cursorOffset + "\n");
|
|
}
|
|
}
|
|
function listDifferent(context, input, options, filename) {
|
|
if (!context.argv.check && !context.argv.listDifferent) {
|
|
return;
|
|
}
|
|
try {
|
|
if (!options.filepath && !options.parser) {
|
|
throw new errors.UndefinedParserError("No parser and no file path given, couldn't infer a parser.");
|
|
}
|
|
if (!prettier2.check(input, options)) {
|
|
if (!context.argv.write) {
|
|
context.logger.log(filename);
|
|
process.exitCode = 1;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
context.logger.error(error.message);
|
|
}
|
|
return true;
|
|
}
|
|
function format(context, input, opt) {
|
|
if (!opt.parser && !opt.filepath) {
|
|
throw new errors.UndefinedParserError("No parser and no file path given, couldn't infer a parser.");
|
|
}
|
|
if (context.argv.debugPrintDoc) {
|
|
const doc = prettier2.__debug.printToDoc(input, opt);
|
|
return {
|
|
formatted: prettier2.__debug.formatDoc(doc) + "\n"
|
|
};
|
|
}
|
|
if (context.argv.debugPrintComments) {
|
|
return {
|
|
formatted: prettier2.format(JSON.stringify(prettier2.formatWithCursor(input, opt).comments || []), {
|
|
parser: "json"
|
|
})
|
|
};
|
|
}
|
|
if (context.argv.debugPrintAst) {
|
|
const {
|
|
ast
|
|
} = prettier2.__debug.parse(input, opt);
|
|
return {
|
|
formatted: JSON.stringify(ast)
|
|
};
|
|
}
|
|
if (context.argv.debugCheck) {
|
|
const pp = prettier2.format(input, opt);
|
|
const pppp = prettier2.format(pp, opt);
|
|
if (pp !== pppp) {
|
|
throw new errors.DebugError("prettier(input) !== prettier(prettier(input))\n" + diff(pp, pppp));
|
|
} else {
|
|
const stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
|
const ast = stringify2(prettier2.__debug.parse(input, opt, true).ast);
|
|
const past = stringify2(prettier2.__debug.parse(pp, opt, true).ast);
|
|
if (ast !== past) {
|
|
const MAX_AST_SIZE = 2097152;
|
|
const astDiff = ast.length > MAX_AST_SIZE || past.length > MAX_AST_SIZE ? "AST diff too large to render" : diff(ast, past);
|
|
throw new errors.DebugError("ast(input) !== ast(prettier(input))\n" + astDiff + "\n" + diff(input, pp));
|
|
}
|
|
}
|
|
return {
|
|
formatted: pp,
|
|
filepath: opt.filepath || "(stdin)\n"
|
|
};
|
|
}
|
|
const {
|
|
performanceTestFlag
|
|
} = context;
|
|
if (performanceTestFlag !== null && performanceTestFlag !== void 0 && performanceTestFlag.debugBenchmark) {
|
|
let benchmark;
|
|
try {
|
|
benchmark = require("benchmark");
|
|
} catch {
|
|
context.logger.debug("'--debug-benchmark' requires the 'benchmark' package to be installed.");
|
|
process.exit(2);
|
|
}
|
|
context.logger.debug("'--debug-benchmark' option found, measuring formatWithCursor with 'benchmark' module.");
|
|
const suite = new benchmark.Suite();
|
|
suite.add("format", () => {
|
|
prettier2.formatWithCursor(input, opt);
|
|
}).on("cycle", (event) => {
|
|
const results = {
|
|
benchmark: String(event.target),
|
|
hz: event.target.hz,
|
|
ms: event.target.times.cycle * 1e3
|
|
};
|
|
context.logger.debug("'--debug-benchmark' measurements for formatWithCursor: " + JSON.stringify(results, null, 2));
|
|
}).run({
|
|
async: false
|
|
});
|
|
} else if (performanceTestFlag !== null && performanceTestFlag !== void 0 && performanceTestFlag.debugRepeat) {
|
|
const repeat = context.argv.debugRepeat;
|
|
context.logger.debug("'--debug-repeat' option found, running formatWithCursor " + repeat + " times.");
|
|
let totalMs = 0;
|
|
for (let i = 0; i < repeat; ++i) {
|
|
const startMs = Date.now();
|
|
prettier2.formatWithCursor(input, opt);
|
|
totalMs += Date.now() - startMs;
|
|
}
|
|
const averageMs = totalMs / repeat;
|
|
const results = {
|
|
repeat,
|
|
hz: 1e3 / averageMs,
|
|
ms: averageMs
|
|
};
|
|
context.logger.debug("'--debug-repeat' measurements for formatWithCursor: " + JSON.stringify(results, null, 2));
|
|
}
|
|
return prettier2.formatWithCursor(input, opt);
|
|
}
|
|
async function createIgnorerFromContextOrDie(context) {
|
|
try {
|
|
return await createIgnorer(context.argv.ignorePath, context.argv.withNodeModules);
|
|
} catch (e) {
|
|
context.logger.error(e.message);
|
|
process.exit(2);
|
|
}
|
|
}
|
|
async function formatStdin2(context) {
|
|
const filepath = context.argv.filepath ? path.resolve(process.cwd(), context.argv.filepath) : process.cwd();
|
|
const ignorer = await createIgnorerFromContextOrDie(context);
|
|
const relativeFilepath = context.argv.ignorePath ? path.relative(path.dirname(context.argv.ignorePath), filepath) : path.relative(process.cwd(), filepath);
|
|
try {
|
|
const input = await getStdin();
|
|
if (relativeFilepath && ignorer.ignores(fixWindowsSlashes(relativeFilepath))) {
|
|
writeOutput(context, {
|
|
formatted: input
|
|
});
|
|
return;
|
|
}
|
|
const options = await getOptionsForFile(context, filepath);
|
|
if (listDifferent(context, input, options, "(stdin)")) {
|
|
return;
|
|
}
|
|
const formatted = format(context, input, options);
|
|
const {
|
|
performanceTestFlag
|
|
} = context;
|
|
if (performanceTestFlag) {
|
|
context.logger.log(`'${performanceTestFlag.name}' option found, skipped print code to screen.`);
|
|
return;
|
|
}
|
|
writeOutput(context, formatted, options);
|
|
} catch (error) {
|
|
handleError(context, relativeFilepath || "stdin", error);
|
|
}
|
|
}
|
|
async function formatFiles2(context) {
|
|
var _formatResultsCache4;
|
|
const ignorer = await createIgnorerFromContextOrDie(context);
|
|
let numberOfUnformattedFilesFound = 0;
|
|
const {
|
|
performanceTestFlag
|
|
} = context;
|
|
if (context.argv.check && !performanceTestFlag) {
|
|
context.logger.log("Checking formatting...");
|
|
}
|
|
let formatResultsCache;
|
|
const cacheFilePath = await findCacheFile(context.argv.cacheLocation);
|
|
if (context.argv.cache) {
|
|
formatResultsCache = new FormatResultsCache(cacheFilePath, context.argv.cacheStrategy || "content");
|
|
} else {
|
|
if (context.argv.cacheStrategy) {
|
|
context.logger.error("`--cache-strategy` cannot be used without `--cache`.");
|
|
process.exit(2);
|
|
}
|
|
if (!context.argv.cacheLocation) {
|
|
const stat = await statSafe(cacheFilePath);
|
|
if (stat) {
|
|
await fs.unlink(cacheFilePath);
|
|
}
|
|
}
|
|
}
|
|
for await (const pathOrError of expandPatterns(context)) {
|
|
var _formatResultsCache;
|
|
if (typeof pathOrError === "object") {
|
|
context.logger.error(pathOrError.error);
|
|
process.exitCode = 2;
|
|
continue;
|
|
}
|
|
const filename = pathOrError;
|
|
const ignoreFilename = context.argv.ignorePath ? path.relative(path.dirname(context.argv.ignorePath), filename) : filename;
|
|
const fileIgnored = ignorer.ignores(fixWindowsSlashes(ignoreFilename));
|
|
if (fileIgnored && (context.argv.debugCheck || context.argv.write || context.argv.check || context.argv.listDifferent)) {
|
|
continue;
|
|
}
|
|
const options = Object.assign(Object.assign({}, await getOptionsForFile(context, filename)), {}, {
|
|
filepath: filename
|
|
});
|
|
let printedFilename;
|
|
if (isTTY()) {
|
|
printedFilename = context.logger.log(filename, {
|
|
newline: false,
|
|
clearable: true
|
|
});
|
|
}
|
|
let input;
|
|
try {
|
|
input = await fs.readFile(filename, "utf8");
|
|
} catch (error) {
|
|
context.logger.log("");
|
|
context.logger.error(`Unable to read file: ${filename}
|
|
${error.message}`);
|
|
process.exitCode = 2;
|
|
continue;
|
|
}
|
|
if (fileIgnored) {
|
|
writeOutput(context, {
|
|
formatted: input
|
|
}, options);
|
|
continue;
|
|
}
|
|
const start = Date.now();
|
|
const isCacheExists = (_formatResultsCache = formatResultsCache) === null || _formatResultsCache === void 0 ? void 0 : _formatResultsCache.existsAvailableFormatResultsCache(filename, options);
|
|
let result;
|
|
let output;
|
|
try {
|
|
if (isCacheExists) {
|
|
result = {
|
|
formatted: input
|
|
};
|
|
} else {
|
|
result = format(context, input, options);
|
|
}
|
|
output = result.formatted;
|
|
} catch (error) {
|
|
handleError(context, filename, error, printedFilename);
|
|
continue;
|
|
}
|
|
const isDifferent = output !== input;
|
|
let shouldSetCache = !isDifferent;
|
|
if (printedFilename) {
|
|
printedFilename.clear();
|
|
}
|
|
if (performanceTestFlag) {
|
|
context.logger.log(`'${performanceTestFlag.name}' option found, skipped print code or write files.`);
|
|
return;
|
|
}
|
|
if (context.argv.write) {
|
|
if (isDifferent) {
|
|
if (!context.argv.check && !context.argv.listDifferent) {
|
|
context.logger.log(`${filename} ${Date.now() - start}ms`);
|
|
}
|
|
try {
|
|
await fs.writeFile(filename, output, "utf8");
|
|
shouldSetCache = true;
|
|
} catch (error) {
|
|
context.logger.error(`Unable to write file: ${filename}
|
|
${error.message}`);
|
|
process.exitCode = 2;
|
|
}
|
|
} else if (!context.argv.check && !context.argv.listDifferent) {
|
|
const message = `${chalk2.grey(filename)} ${Date.now() - start}ms`;
|
|
if (isCacheExists) {
|
|
context.logger.log(`${message} (cached)`);
|
|
} else {
|
|
context.logger.log(message);
|
|
}
|
|
}
|
|
} else if (context.argv.debugCheck) {
|
|
if (result.filepath) {
|
|
context.logger.log(result.filepath);
|
|
} else {
|
|
process.exitCode = 2;
|
|
}
|
|
} else if (!context.argv.check && !context.argv.listDifferent) {
|
|
writeOutput(context, result, options);
|
|
}
|
|
if (shouldSetCache) {
|
|
var _formatResultsCache2;
|
|
(_formatResultsCache2 = formatResultsCache) === null || _formatResultsCache2 === void 0 ? void 0 : _formatResultsCache2.setFormatResultsCache(filename, options);
|
|
} else {
|
|
var _formatResultsCache3;
|
|
(_formatResultsCache3 = formatResultsCache) === null || _formatResultsCache3 === void 0 ? void 0 : _formatResultsCache3.removeFormatResultsCache(filename);
|
|
}
|
|
if (isDifferent) {
|
|
if (context.argv.check) {
|
|
context.logger.warn(filename);
|
|
} else if (context.argv.listDifferent) {
|
|
context.logger.log(filename);
|
|
}
|
|
numberOfUnformattedFilesFound += 1;
|
|
}
|
|
}
|
|
(_formatResultsCache4 = formatResultsCache) === null || _formatResultsCache4 === void 0 ? void 0 : _formatResultsCache4.reconcile();
|
|
if (context.argv.check) {
|
|
if (numberOfUnformattedFilesFound === 0) {
|
|
context.logger.log("All matched files use Prettier code style!");
|
|
} else if (numberOfUnformattedFilesFound === 1) {
|
|
context.logger.warn(context.argv.write ? "Code style issues fixed in the above file." : "Code style issues found in the above file. Forgot to run Prettier?");
|
|
} else {
|
|
context.logger.warn(context.argv.write ? "Code style issues found in " + numberOfUnformattedFilesFound + " files." : "Code style issues found in " + numberOfUnformattedFilesFound + " files. Forgot to run Prettier?");
|
|
}
|
|
}
|
|
if ((context.argv.check || context.argv.listDifferent) && numberOfUnformattedFilesFound > 0 && !process.exitCode && !context.argv.write) {
|
|
process.exitCode = 1;
|
|
}
|
|
}
|
|
module2.exports = {
|
|
formatStdin: formatStdin2,
|
|
formatFiles: formatFiles2
|
|
};
|
|
}
|
|
});
|
|
var require_file_info = __commonJS2({
|
|
"src/cli/file-info.js"(exports2, module2) {
|
|
"use strict";
|
|
var stringify2 = require_fast_json_stable_stringify();
|
|
var prettier2 = require("./index.js");
|
|
var {
|
|
printToScreen: printToScreen2
|
|
} = require_utils();
|
|
async function logFileInfoOrDie2(context) {
|
|
const {
|
|
fileInfo: file,
|
|
ignorePath,
|
|
withNodeModules,
|
|
plugins,
|
|
pluginSearchDirs,
|
|
config
|
|
} = context.argv;
|
|
const fileInfo = await prettier2.getFileInfo(file, {
|
|
ignorePath,
|
|
withNodeModules,
|
|
plugins,
|
|
pluginSearchDirs,
|
|
resolveConfig: config !== false
|
|
});
|
|
printToScreen2(prettier2.format(stringify2(fileInfo), {
|
|
parser: "json"
|
|
}));
|
|
}
|
|
module2.exports = logFileInfoOrDie2;
|
|
}
|
|
});
|
|
var require_find_config_path = __commonJS2({
|
|
"src/cli/find-config-path.js"(exports2, module2) {
|
|
"use strict";
|
|
var path = require("path");
|
|
var prettier2 = require("./index.js");
|
|
var {
|
|
printToScreen: printToScreen2
|
|
} = require_utils();
|
|
async function logResolvedConfigPathOrDie2(context) {
|
|
const file = context.argv.findConfigPath;
|
|
const configFile = await prettier2.resolveConfigFile(file);
|
|
if (configFile) {
|
|
printToScreen2(path.relative(process.cwd(), configFile));
|
|
} else {
|
|
throw new Error(`Can not find configure file for "${file}"`);
|
|
}
|
|
}
|
|
module2.exports = logResolvedConfigPathOrDie2;
|
|
}
|
|
});
|
|
var stringify = require_fast_json_stable_stringify();
|
|
var prettier = require("./index.js");
|
|
var createLogger = require_logger();
|
|
var Context = require_context();
|
|
var {
|
|
parseArgvWithoutPlugins
|
|
} = require_parse_cli_arguments();
|
|
var {
|
|
createDetailedUsage,
|
|
createUsage
|
|
} = require_usage();
|
|
var {
|
|
formatStdin,
|
|
formatFiles
|
|
} = require_format();
|
|
var logFileInfoOrDie = require_file_info();
|
|
var logResolvedConfigPathOrDie = require_find_config_path();
|
|
var {
|
|
utils: {
|
|
isNonEmptyArray
|
|
}
|
|
} = require_prettier_internal();
|
|
var {
|
|
printToScreen
|
|
} = require_utils();
|
|
async function run(rawArguments) {
|
|
let logger = createLogger();
|
|
try {
|
|
const logLevel = parseArgvWithoutPlugins(rawArguments, logger, "loglevel").loglevel;
|
|
if (logLevel !== logger.logLevel) {
|
|
logger = createLogger(logLevel);
|
|
}
|
|
const context = new Context({
|
|
rawArguments,
|
|
logger
|
|
});
|
|
if (logger.logLevel !== "debug" && context.performanceTestFlag) {
|
|
context.logger = createLogger("debug");
|
|
}
|
|
await main(context);
|
|
} catch (error) {
|
|
logger.error(error.message);
|
|
process.exitCode = 1;
|
|
}
|
|
}
|
|
async function main(context) {
|
|
context.logger.debug(`normalized argv: ${JSON.stringify(context.argv)}`);
|
|
if (context.argv.pluginSearch === false) {
|
|
const rawPluginSearchDirs = context.argv.__raw["plugin-search-dir"];
|
|
if (typeof rawPluginSearchDirs === "string" || isNonEmptyArray(rawPluginSearchDirs)) {
|
|
throw new Error("Cannot use --no-plugin-search and --plugin-search-dir together.");
|
|
}
|
|
}
|
|
if (context.argv.check && context.argv.listDifferent) {
|
|
throw new Error("Cannot use --check and --list-different together.");
|
|
}
|
|
if (context.argv.write && context.argv.debugCheck) {
|
|
throw new Error("Cannot use --write and --debug-check together.");
|
|
}
|
|
if (context.argv.findConfigPath && context.filePatterns.length > 0) {
|
|
throw new Error("Cannot use --find-config-path with multiple files");
|
|
}
|
|
if (context.argv.fileInfo && context.filePatterns.length > 0) {
|
|
throw new Error("Cannot use --file-info with multiple files");
|
|
}
|
|
if (context.argv.version) {
|
|
printToScreen(prettier.version);
|
|
return;
|
|
}
|
|
if (context.argv.help !== void 0) {
|
|
printToScreen(typeof context.argv.help === "string" && context.argv.help !== "" ? createDetailedUsage(context, context.argv.help) : createUsage(context));
|
|
return;
|
|
}
|
|
if (context.argv.supportInfo) {
|
|
printToScreen(prettier.format(stringify(prettier.getSupportInfo()), {
|
|
parser: "json"
|
|
}));
|
|
return;
|
|
}
|
|
const hasFilePatterns = context.filePatterns.length > 0;
|
|
const useStdin = !hasFilePatterns && (!process.stdin.isTTY || context.argv.filePath);
|
|
if (context.argv.findConfigPath) {
|
|
await logResolvedConfigPathOrDie(context);
|
|
} else if (context.argv.fileInfo) {
|
|
await logFileInfoOrDie(context);
|
|
} else if (useStdin) {
|
|
if (context.argv.cache) {
|
|
context.logger.error("`--cache` cannot be used with stdin.");
|
|
process.exit(2);
|
|
}
|
|
await formatStdin(context);
|
|
} else if (hasFilePatterns) {
|
|
await formatFiles(context);
|
|
} else {
|
|
process.exitCode = 1;
|
|
printToScreen(createUsage(context));
|
|
}
|
|
}
|
|
module.exports = {
|
|
run
|
|
};
|
|
|