-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(deps-dev): bump vitest from 1.4.0 to 1.5.3 #1310
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.4.0 to 1.5.3. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v1.5.3/packages/vitest) --- updated-dependencies: - dependency-name: vitest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
dependabot
bot
added
dependencies
Pull requests that update a dependency file
javascript
Pull requests that update Javascript code
labels
May 1, 2024
Diff between vitest 1.4.0 and 1.5.3diff --git a/dist/config.cjs b/dist/config.cjs
index v1.4.0..v1.5.3 100644
--- a/dist/config.cjs
+++ b/dist/config.cjs
@@ -6,5 +6,6 @@
var _a$1;
-typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
+const isNode = typeof process < "u" && typeof process.stdout < "u" && !((_a$1 = process.versions) == null ? void 0 : _a$1.deno) && !globalThis.window;
+isNode && process.platform === "win32";
var _a, _b;
@@ -41,4 +42,5 @@
extension: [".js", ".cjs", ".mjs", ".ts", ".mts", ".cts", ".tsx", ".jsx", ".vue", ".svelte", ".marko"],
allowExternal: false,
+ ignoreEmptyLines: false,
processingConcurrency: Math.min(20, ((_b = (_a = os).availableParallelism) == null ? void 0 : _b.call(_a)) ?? os.cpus().length)
};
diff --git a/dist/vendor/base.nhvUBzQY.js b/dist/vendor/base.nhvUBzQY.js
deleted file mode 100644
index v1.4.0..v1.5.3
--- a/dist/vendor/base.nhvUBzQY.js
+++ b/dist/vendor/base.nhvUBzQY.js
@@ -1,38 +0,0 @@
-import { ModuleCacheMap } from 'vite-node/client';
-import { p as provideWorkerState } from './global.CkGT_TMy.js';
-import { g as getDefaultRequestStubs, s as startVitestExecutor } from './execute.2_yoIC01.js';
-
-let _viteNode;
-const moduleCache = new ModuleCacheMap();
-const mockMap = /* @__PURE__ */ new Map();
-async function startViteNode(options) {
- if (_viteNode)
- return _viteNode;
- _viteNode = await startVitestExecutor(options);
- return _viteNode;
-}
-async function runBaseTests(state) {
- const { ctx } = state;
- state.moduleCache = moduleCache;
- state.mockMap = mockMap;
- provideWorkerState(globalThis, state);
- if (ctx.invalidates) {
- ctx.invalidates.forEach((fsPath) => {
- moduleCache.delete(fsPath);
- moduleCache.delete(`mock:${fsPath}`);
- });
- }
- ctx.files.forEach((i) => state.moduleCache.delete(i));
- const [executor, { run }] = await Promise.all([
- startViteNode({ state, requestStubs: getDefaultRequestStubs() }),
- import('../chunks/runtime-runBaseTests.SKlFOhuq.js')
- ]);
- await run(
- ctx.files,
- ctx.config,
- { environment: state.environment, options: ctx.environment.options },
- executor
- );
-}
-
-export { runBaseTests as r };
\ No newline at end of file
diff --git a/dist/vendor/benchmark.eeqk2rd8.js b/dist/vendor/benchmark.eeqk2rd8.js
deleted file mode 100644
index v1.4.0..v1.5.3
--- a/dist/vendor/benchmark.eeqk2rd8.js
+++ b/dist/vendor/benchmark.eeqk2rd8.js
@@ -1,41 +0,0 @@
-import { getCurrentSuite } from '@vitest/runner';
-import { createChainable } from '@vitest/runner/utils';
-import { noop } from '@vitest/utils';
-import { i as isRunningInBenchmark } from './index.ir9i0ywP.js';
-
-const benchFns = /* @__PURE__ */ new WeakMap();
-const benchOptsMap = /* @__PURE__ */ new WeakMap();
-function getBenchOptions(key) {
- return benchOptsMap.get(key);
-}
-function getBenchFn(key) {
- return benchFns.get(key);
-}
-const bench = createBenchmark(
- function(name, fn = noop, options = {}) {
- if (!isRunningInBenchmark())
- throw new Error("`bench()` is only available in benchmark mode.");
- const task = getCurrentSuite().task(formatName(name), {
- ...this,
- meta: {
- benchmark: true
- }
- });
- benchFns.set(task, fn);
- benchOptsMap.set(task, options);
- }
-);
-function createBenchmark(fn) {
- const benchmark = createChainable(
- ["skip", "only", "todo"],
- fn
- );
- benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
- benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
- return benchmark;
-}
-function formatName(name) {
- return typeof name === "string" ? name : name instanceof Function ? name.name || "<anonymous>" : String(name);
-}
-
-export { getBenchOptions as a, bench as b, getBenchFn as g };
\ No newline at end of file
diff --git a/dist/browser.js b/dist/browser.js
index v1.4.0..v1.5.3 100644
--- a/dist/browser.js
+++ b/dist/browser.js
@@ -1,4 +1,4 @@
export { processError, startTests } from '@vitest/runner';
-export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.vyF1kALR.js';
+export { l as loadDiffConfig, a as loadSnapshotSerializers, s as setupCommonEnv } from './vendor/setup-common.5nUd4r76.js';
export { g as getCoverageProvider, a as startCoverageInsideWorker, s as stopCoverageInsideWorker, t as takeCoverageInsideWorker } from './vendor/coverage.E7sG1b3r.js';
import '@vitest/utils';
diff --git a/dist/vendor/cac.RvTIWZBK.js b/dist/vendor/cac.RvTIWZBK.js
deleted file mode 100644
index v1.4.0..v1.5.3
--- a/dist/vendor/cac.RvTIWZBK.js
+++ b/dist/vendor/cac.RvTIWZBK.js
@@ -1,19576 +0,0 @@
-import { dirname, resolve, relative, normalize, join, basename, toNamespacedPath } from 'pathe';
-import require$$0$3, { EventEmitter as EventEmitter$2 } from 'events';
-import c from 'picocolors';
-import { b as removeUndefinedValues, c as isWindows } from './index.ir9i0ywP.js';
-import { w as wrapSerializableConfig, f as Typechecker, R as ReportersMap, e as BenchmarkReportsMap, g as RandomSequencer, B as BaseSequencer, h as generateCodeFrame, i as highlightCode, j as divider, L as Logger, s as stripAnsi } from './index.e9RDLAeW.js';
-import { A as API_PATH, c as configFiles, d as defaultPort, e as extraInlineDeps, a as defaultBrowserPort, E as EXIT_CODE_RESTART, w as workspacesFiles, C as CONFIG_NAMES } from './constants.K-Wf1PUy.js';
-import { g as getCoverageProvider, C as CoverageProviderMap } from './coverage.E7sG1b3r.js';
-import { g as getEnvPackageName } from './index.GVFv9dZ0.js';
-import { isFileServingAllowed, loadConfigFromFile, searchForWorkspaceRoot, version as version$1, createServer, mergeConfig } from 'vite';
-import path$8 from 'node:path';
-import url, { fileURLToPath } from 'node:url';
-import process$1 from 'node:process';
-import fs$8, { promises, existsSync } from 'node:fs';
-import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.jjO7Zipk.js';
-import require$$0 from 'os';
-import p from 'path';
-import { a as micromatch_1, m as mm } from './index.xL8XjTLv.js';
-import require$$0$1 from 'stream';
-import require$$0$2 from 'fs';
-import { ViteNodeRunner } from 'vite-node/client';
-import { SnapshotManager } from '@vitest/snapshot/manager';
-import { ViteNodeServer } from 'vite-node/server';
-import { rootDir } from '../path.js';
-import { c as createBirpc } from './index.8bPxjt7g.js';
-import require$$0$4 from 'zlib';
-import require$$0$5 from 'buffer';
-import require$$1 from 'crypto';
-import require$$1$1 from 'https';
-import require$$2 from 'http';
-import require$$3 from 'net';
-import require$$4 from 'tls';
-import require$$7 from 'url';
-import { createDefer, toArray as toArray$1, notNullish } from '@vitest/utils';
-import { parseErrorStacktrace } from '@vitest/utils/source-map';
-import { n as noop$2, b as isPrimitive, c as groupBy, A as AggregateErrorPonyfill, a as slash$1, t as toArray, d as deepMerge, w as wildcardPatternToRegExp, e as stdout } from './base.Xt0Omgh7.js';
-import v8 from 'node:v8';
-import * as nodeos from 'node:os';
-import nodeos__default from 'node:os';
-import EventEmitter$3 from 'node:events';
-import Tinypool$1, { Tinypool } from 'tinypool';
-import { MessageChannel } from 'node:worker_threads';
-import { hasFailed, getTests } from '@vitest/runner/utils';
-import { resolveModule, isPackageExists } from 'local-pkg';
-import { isCI, provider as provider$1 } from 'std-env';
-import crypto, { createHash as createHash$2 } from 'node:crypto';
-import { normalizeRequestId, cleanUrl } from 'vite-node/utils';
-import MagicString from 'magic-string';
-import { findNodeAround } from 'acorn-walk';
-import { esmWalker } from '@vitest/utils/ast';
-import { stripLiteral } from 'strip-literal';
-import { createRequire } from 'node:module';
-import readline from 'node:readline';
-import require$$0$6 from 'readline';
-
-function _mergeNamespaces(n, m) {
- m.forEach(function (e) {
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
- if (k !== 'default' && !(k in n)) {
- var d = Object.getOwnPropertyDescriptor(e, k);
- Object.defineProperty(n, k, d.get ? d : {
- enumerable: true,
- get: function () { return e[k]; }
- });
- }
- });
- });
- return Object.freeze(n);
-}
-
-async function getModuleGraph(ctx, id) {
- const graph = {};
- const externalized = /* @__PURE__ */ new Set();
- const inlined = /* @__PURE__ */ new Set();
- function clearId(id2) {
- return (id2 == null ? void 0 : id2.replace(/\?v=\w+$/, "")) || "";
- }
- async function get(mod, seen = /* @__PURE__ */ new Map()) {
- if (!mod || !mod.id)
- return;
- if (seen.has(mod))
- return seen.get(mod);
- let id2 = clearId(mod.id);
- seen.set(mod, id2);
- const rewrote = await ctx.vitenode.shouldExternalize(id2);
- if (rewrote) {
- id2 = rewrote;
- externalized.add(id2);
- seen.set(mod, id2);
- } else {
- inlined.add(id2);
- }
- const mods = Array.from(mod.importedModules).filter((i) => i.id && !i.id.includes("/vitest/dist/"));
- graph[id2] = (await Promise.all(mods.map((m) => get(m, seen)))).filter(Boolean);
- return id2;
- }
- await get(ctx.server.moduleGraph.getModuleById(id));
- return {
- graph,
- externalized: Array.from(externalized),
- inlined: Array.from(inlined)
- };
-}
-
-function cloneByOwnProperties(value) {
- return Object.getOwnPropertyNames(value).reduce((clone, prop) => ({
- ...clone,
- [prop]: value[prop]
- }), {});
-}
-function stringifyReplace(key, value) {
- if (value instanceof Error)
- return cloneByOwnProperties(value);
- else
- return value;
-}
-
-function toArr(any) {
- return any == null ? [] : Array.isArray(any) ? any : [any];
-}
-
-function toVal(out, key, val, opts) {
- var x, old=out[key], nxt=(
- !!~opts.string.indexOf(key) ? (val == null || val === true ? '' : String(val))
- : typeof val === 'boolean' ? val
- : !!~opts.boolean.indexOf(key) ? (val === 'false' ? false : val === 'true' || (out._.push((x = +val,x * 0 === 0) ? x : val),!!val))
- : (x = +val,x * 0 === 0) ? x : val
- );
- out[key] = old == null ? nxt : (Array.isArray(old) ? old.concat(nxt) : [old, nxt]);
-}
-
-function mri2 (args, opts) {
- args = args || [];
- opts = opts || {};
-
- var k, arr, arg, name, val, out={ _:[] };
- var i=0, j=0, idx=0, len=args.length;
-
- const alibi = opts.alias !== void 0;
- const strict = opts.unknown !== void 0;
- const defaults = opts.default !== void 0;
-
- opts.alias = opts.alias || {};
- opts.string = toArr(opts.string);
- opts.boolean = toArr(opts.boolean);
-
- if (alibi) {
- for (k in opts.alias) {
- arr = opts.alias[k] = toArr(opts.alias[k]);
- for (i=0; i < arr.length; i++) {
- (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
- }
- }
- }
-
- for (i=opts.boolean.length; i-- > 0;) {
- arr = opts.alias[opts.boolean[i]] || [];
- for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]);
- }
-
- for (i=opts.string.length; i-- > 0;) {
- arr = opts.alias[opts.string[i]] || [];
- for (j=arr.length; j-- > 0;) opts.string.push(arr[j]);
- }
-
- if (defaults) {
- for (k in opts.default) {
- name = typeof opts.default[k];
- arr = opts.alias[k] = opts.alias[k] || [];
- if (opts[name] !== void 0) {
- opts[name].push(k);
- for (i=0; i < arr.length; i++) {
- opts[name].push(arr[i]);
- }
- }
- }
- }
-
- const keys = strict ? Object.keys(opts.alias) : [];
-
- for (i=0; i < len; i++) {
- arg = args[i];
-
- if (arg === '--') {
- out._ = out._.concat(args.slice(++i));
- break;
- }
-
- for (j=0; j < arg.length; j++) {
- if (arg.charCodeAt(j) !== 45) break; // "-"
- }
-
- if (j === 0) {
- out._.push(arg);
- } else if (arg.substring(j, j + 3) === 'no-') {
- name = arg.substring(j + 3);
- if (strict && !~keys.indexOf(name)) {
- return opts.unknown(arg);
- }
- out[name] = false;
- } else {
- for (idx=j+1; idx < arg.length; idx++) {
- if (arg.charCodeAt(idx) === 61) break; // "="
- }
-
- name = arg.substring(j, idx);
- val = arg.substring(++idx) || (i+1 === len || (''+args[i+1]).charCodeAt(0) === 45 || args[++i]);
- arr = (j === 2 ? [name] : name);
-
- for (idx=0; idx < arr.length; idx++) {
- name = arr[idx];
- if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name);
- toVal(out, name, (idx + 1 < arr.length) || val, opts);
- }
- }
- }
-
- if (defaults) {
- for (k in opts.default) {
- if (out[k] === void 0) {
- out[k] = opts.default[k];
- }
- }
- }
-
- if (alibi) {
- for (k in out) {
- arr = opts.alias[k] || [];
- while (arr.length > 0) {
- out[arr.shift()] = out[k];
- }
- }
- }
-
- return out;
-}
-
-const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
-const findAllBrackets = (v) => {
- const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
- const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
- const res = [];
- const parse = (match) => {
- let variadic = false;
- let value = match[1];
- if (value.startsWith("...")) {
- value = value.slice(3);
- variadic = true;
- }
- return {
- required: match[0].startsWith("<"),
- value,
- variadic
- };
- };
- let angledMatch;
- while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
- res.push(parse(angledMatch));
- }
- let squareMatch;
- while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
- res.push(parse(squareMatch));
- }
- return res;
-};
-const getMriOptions = (options) => {
- const result = {alias: {}, boolean: []};
- for (const [index, option] of options.entries()) {
- if (option.names.length > 1) {
- result.alias[option.names[0]] = option.names.slice(1);
- }
- if (option.isBoolean) {
- if (option.negated) {
- const hasStringTypeOption = options.some((o, i) => {
- return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
- });
- if (!hasStringTypeOption) {
- result.boolean.push(option.names[0]);
- }
- } else {
- result.boolean.push(option.names[0]);
- }
- }
- }
- return result;
-};
-const findLongest = (arr) => {
- return arr.sort((a, b) => {
- return a.length > b.length ? -1 : 1;
- })[0];
-};
-const padRight = (str, length) => {
- return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
-};
-const camelcase = (input) => {
- return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
- return p1 + p2.toUpperCase();
- });
-};
-const setDotProp = (obj, keys, val, transforms) => {
- let i = 0;
- let length = keys.length;
- let t = obj;
- let x;
- let convertKey = (i) => {
- let key = keys[i];
- i--;
- while(i >= 0) {
- key = keys[i] + '.' + key;
- i--;
- }
- return key
- };
- for (; i < length; ++i) {
- x = t[keys[i]];
- const transform = transforms[convertKey(i)] || ((v) => v);
- t = t[keys[i]] = transform(i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : []);
- }
-};
-const getFileName = (input) => {
- const m = /([^\\\/]+)$/.exec(input);
- return m ? m[1] : "";
-};
-const camelcaseOptionName = (name) => {
- return name.split(".").map((v, i) => {
- return i === 0 ? camelcase(v) : v;
- }).join(".");
-};
-class CACError extends Error {
- constructor(message) {
- super(message);
- this.name = this.constructor.name;
- if (typeof Error.captureStackTrace === "function") {
- Error.captureStackTrace(this, this.constructor);
- } else {
- this.stack = new Error(message).stack;
- }
- }
-}
-
-class Option {
- constructor(rawName, description, config) {
- this.rawName = rawName;
- this.description = description;
- this.config = Object.assign({}, config);
- rawName = rawName.replace(/\.\*/g, "");
- this.negated = false;
- this.names = removeBrackets(rawName).split(",").map((v) => {
- let name = v.trim().replace(/^-{1,2}/, "");
- if (name.startsWith("no-")) {
- this.negated = true;
- name = name.replace(/^no-/, "");
- }
- return camelcaseOptionName(name);
- }).sort((a, b) => a.length > b.length ? 1 : -1);
- this.name = this.names[this.names.length - 1];
- if (this.negated && this.config.default == null) {
- this.config.default = true;
- }
- if (rawName.includes("<")) {
- this.required = true;
- } else if (rawName.includes("[")) {
- this.required = false;
- } else {
- this.isBoolean = true;
- }
- }
-}
-
-const processArgs = process.argv;
-const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
-
-class Command {
- constructor(rawName, description, config = {}, cli) {
- this.rawName = rawName;
- this.description = description;
- this.config = config;
- this.cli = cli;
- this.options = [];
- this.aliasNames = [];
- this.name = removeBrackets(rawName);
- this.args = findAllBrackets(rawName);
- this.examples = [];
- }
- usage(text) {
- this.usageText = text;
- return this;
- }
- allowUnknownOptions() {
- this.config.allowUnknownOptions = true;
- return this;
- }
- ignoreOptionDefaultValue() {
- this.config.ignoreOptionDefaultValue = true;
- return this;
- }
- version(version, customFlags = "-v, --version") {
- this.versionNumber = version;
- this.option(customFlags, "Display version number");
- return this;
- }
- example(example) {
- this.examples.push(example);
- return this;
- }
- option(rawName, description, config) {
- const option = new Option(rawName, description, config);
- this.options.push(option);
- return this;
- }
- alias(name) {
- this.aliasNames.push(name);
- return this;
- }
- action(callback) {
- this.commandAction = callback;
- return this;
- }
- isMatched(name) {
- return this.name === name || this.aliasNames.includes(name);
- }
- get isDefaultCommand() {
- return this.name === "" || this.aliasNames.includes("!");
- }
- get isGlobalCommand() {
- return this instanceof GlobalCommand;
- }
- hasOption(name) {
- name = name.split(".")[0];
- return this.options.find((option) => {
- return option.names.includes(name);
- });
- }
- outputHelp() {
- const {name, commands} = this.cli;
- const {
- versionNumber,
- options: globalOptions,
- helpCallback
- } = this.cli.globalCommand;
- let sections = [
- {
- body: `${name}${versionNumber ? `/${versionNumber}` : ""}`
- }
- ];
- sections.push({
- title: "Usage",
- body: ` $ ${name} ${this.usageText || this.rawName}`
- });
- const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
- if (showCommands) {
- const longestCommandName = findLongest(commands.map((command) => command.rawName));
- sections.push({
- title: "Commands",
- body: commands.map((command) => {
- return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
- }).join("\n")
- });
- sections.push({
- title: `For more info, run any command with the \`--help\` flag`,
- body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
- });
- }
- let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
- if (!this.isGlobalCommand && !this.isDefaultCommand) {
- options = options.filter((option) => option.name !== "version");
- }
- if (options.length > 0) {
- const longestOptionName = findLongest(options.map((option) => option.rawName));
- sections.push({
- title: "Options",
- body: options.map((option) => {
- return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
- }).join("\n")
- });
- }
- if (this.examples.length > 0) {
- sections.push({
- title: "Examples",
- body: this.examples.map((example) => {
- if (typeof example === "function") {
- return example(name);
- }
- return example;
- }).join("\n")
- });
- }
- if (helpCallback) {
- sections = helpCallback(sections) || sections;
- }
- console.log(sections.map((section) => {
- return section.title ? `${section.title}:
-${section.body}` : section.body;
- }).join("\n\n"));
- }
- outputVersion() {
- const {name} = this.cli;
- const {versionNumber} = this.cli.globalCommand;
- if (versionNumber) {
- console.log(`${name}/${versionNumber} ${platformInfo}`);
- }
- }
- checkRequiredArgs() {
- const minimalArgsCount = this.args.filter((arg) => arg.required).length;
- if (this.cli.args.length < minimalArgsCount) {
- throw new CACError(`missing required args for command \`${this.rawName}\``);
- }
- }
- checkUnknownOptions() {
- const {options, globalCommand} = this.cli;
- if (!this.config.allowUnknownOptions) {
- for (const name of Object.keys(options)) {
- if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) {
- throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
- }
- }
- }
- }
- checkOptionValue() {
- const {options: parsedOptions, globalCommand} = this.cli;
- const options = [...globalCommand.options, ...this.options];
- for (const option of options) {
- // skip dot names because only top level options are required
- if (option.name.includes('.')) {
- continue;
- }
- const value = parsedOptions[option.name];
- if (option.required) {
- const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
- if (value === true || value === false && !hasNegated) {
- throw new CACError(`option \`${option.rawName}\` value is missing`);
- }
- }
- }
- }
-}
-class GlobalCommand extends Command {
- constructor(cli) {
- super("@@global@@", "", {}, cli);
- }
-}
-
-var __assign = Object.assign;
-class CAC extends EventEmitter$2 {
- constructor(name = "") {
- super();
- this.name = name;
- this.commands = [];
- this.rawArgs = [];
- this.args = [];
- this.options = {};
- this.globalCommand = new GlobalCommand(this);
- this.globalCommand.usage("<command> [options]");
- }
- usage(text) {
- this.globalCommand.usage(text);
- return this;
- }
- command(rawName, description, config) {
- const command = new Command(rawName, description || "", config, this);
- command.globalCommand = this.globalCommand;
- this.commands.push(command);
- return command;
- }
- option(rawName, description, config) {
- this.globalCommand.option(rawName, description, config);
- return this;
- }
- help(callback) {
- this.globalCommand.option("-h, --help", "Display this message");
- this.globalCommand.helpCallback = callback;
- this.showHelpOnExit = true;
- return this;
- }
- version(version, customFlags = "-v, --version") {
- this.globalCommand.version(version, customFlags);
- this.showVersionOnExit = true;
- return this;
- }
- example(example) {
- this.globalCommand.example(example);
- return this;
- }
- outputHelp() {
- if (this.matchedCommand) {
- this.matchedCommand.outputHelp();
- } else {
- this.globalCommand.outputHelp();
- }
- }
- outputVersion() {
- this.globalCommand.outputVersion();
- }
- setParsedInfo({args, options}, matchedCommand, matchedCommandName) {
- this.args = args;
- this.options = options;
- if (matchedCommand) {
- this.matchedCommand = matchedCommand;
- }
- if (matchedCommandName) {
- this.matchedCommandName = matchedCommandName;
- }
- return this;
- }
- unsetMatchedCommand() {
- this.matchedCommand = void 0;
- this.matchedCommandName = void 0;
- }
- parse(argv = processArgs, {
- run = true
- } = {}) {
- this.rawArgs = argv;
- if (!this.name) {
- this.name = argv[1] ? getFileName(argv[1]) : "cli";
- }
- let shouldParse = true;
- for (const command of this.commands) {
- const parsed = this.mri(argv.slice(2), command);
- const commandName = parsed.args[0];
- if (command.isMatched(commandName)) {
- shouldParse = false;
- const parsedInfo = __assign(__assign({}, parsed), {
- args: parsed.args.slice(1)
- });
- this.setParsedInfo(parsedInfo, command, commandName);
- this.emit(`command:${commandName}`, command);
- }
- }
- if (shouldParse) {
- for (const command of this.commands) {
- if (command.name === "") {
- shouldParse = false;
- const parsed = this.mri(argv.slice(2), command);
- this.setParsedInfo(parsed, command);
- this.emit(`command:!`, command);
- }
- }
- }
- if (shouldParse) {
- const parsed = this.mri(argv.slice(2));
- this.setParsedInfo(parsed);
- }
- if (this.options.help && this.showHelpOnExit) {
- this.outputHelp();
- run = false;
- this.unsetMatchedCommand();
- }
- if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
- this.outputVersion();
- run = false;
- this.unsetMatchedCommand();
- }
- const parsedArgv = {args: this.args, options: this.options};
- if (run) {
- this.runMatchedCommand();
- }
- if (!this.matchedCommand && this.args[0]) {
- this.emit("command:*");
- }
- return parsedArgv;
- }
- mri(argv, command) {
- const cliOptions = [
- ...this.globalCommand.options,
- ...command ? command.options : []
- ];
- const mriOptions = getMriOptions(cliOptions);
- let argsAfterDoubleDashes = [];
- const doubleDashesIndex = argv.indexOf("--");
- if (doubleDashesIndex > -1) {
- argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
- argv = argv.slice(0, doubleDashesIndex);
- }
- let parsed = mri2(argv, mriOptions);
- parsed = Object.keys(parsed).reduce((res, name) => {
- return __assign(__assign({}, res), {
- [camelcaseOptionName(name)]: parsed[name]
- });
- }, {_: []});
- const args = parsed._;
- const options = {
- "--": argsAfterDoubleDashes
- };
- const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
- let transforms = Object.create(null);
- for (const cliOption of cliOptions) {
- if (!ignoreDefault && cliOption.config.default !== void 0) {
- for (const name of cliOption.names) {
- options[name] = cliOption.config.default;
- }
- }
- if (cliOption.config.type != null) {
- if (transforms[cliOption.name] === void 0) {
- transforms[cliOption.name] = cliOption.config.type;
- }
- }
- }
- for (const key of Object.keys(parsed)) {
- if (key !== "_") {
- const keys = key.split(".");
- setDotProp(options, keys, parsed[key], transforms);
- // setByType(options, transforms);
- }
- }
- return {
- args,
- options
- };
- }
- runMatchedCommand() {
- const {args, options, matchedCommand: command} = this;
- if (!command || !command.commandAction)
- return;
- command.checkUnknownOptions();
- command.checkOptionValue();
- command.checkRequiredArgs();
- const actionArgs = [];
- command.args.forEach((arg, index) => {
- if (arg.variadic) {
- actionArgs.push(args.slice(index));
- } else {
- actionArgs.push(args[index]);
- }
- });
- actionArgs.push(options);
- return command.commandAction.apply(this, actionArgs);
- }
-}
-
-const cac = (name = "") => new CAC(name);
-
-var version = "1.4.0";
-
-/*
-How it works:
-`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
-*/
-
-class Node {
- value;
- next;
-
- constructor(value) {
- this.value = value;
- }
-}
-
-class Queue {
- #head;
- #tail;
- #size;
-
- constructor() {
- this.clear();
- }
-
- enqueue(value) {
- const node = new Node(value);
-
- if (this.#head) {
- this.#tail.next = node;
- this.#tail = node;
- } else {
- this.#head = node;
- this.#tail = node;
- }
-
- this.#size++;
- }
-
- dequeue() {
- const current = this.#head;
- if (!current) {
- return;
- }
-
- this.#head = this.#head.next;
- this.#size--;
- return current.value;
- }
-
- clear() {
- this.#head = undefined;
- this.#tail = undefined;
- this.#size = 0;
- }
-
- get size() {
- return this.#size;
- }
-
- * [Symbol.iterator]() {
- let current = this.#head;
-
- while (current) {
- yield current.value;
- current = current.next;
- }
- }
-}
-
-function pLimit(concurrency) {
- if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
- throw new TypeError('Expected `concurrency` to be a number from 1 and up');
- }
-
- const queue = new Queue();
- let activeCount = 0;
-
- const next = () => {
- activeCount--;
-
- if (queue.size > 0) {
- queue.dequeue()();
- }
- };
-
- const run = async (fn, resolve, args) => {
- activeCount++;
-
- const result = (async () => fn(...args))();
-
- resolve(result);
-
- try {
- await result;
- } catch {}
-
- next();
- };
-
- const enqueue = (fn, resolve, args) => {
- queue.enqueue(run.bind(undefined, fn, resolve, args));
-
- (async () => {
- // This function needs to wait until the next microtask before comparing
- // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
- // when the run function is dequeued and called. The comparison in the if-statement
- // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
- await Promise.resolve();
-
- if (activeCount < concurrency && queue.size > 0) {
- queue.dequeue()();
- }
- })();
- };
-
- const generator = (fn, ...args) => new Promise(resolve => {
- enqueue(fn, resolve, args);
- });
-
- Object.defineProperties(generator, {
- activeCount: {
- get: () => activeCount,
- },
- pendingCount: {
- get: () => queue.size,
- },
- clearQueue: {
- value: () => {
- queue.clear();
- },
- },
- });
-
- return generator;
-}
-
-class EndError extends Error {
- constructor(value) {
- super();
- this.value = value;
- }
-}
-
-// The input can also be a promise, so we await it.
-const testElement = async (element, tester) => tester(await element);
-
-// The input can also be a promise, so we `Promise.all()` them both.
-const finder = async element => {
- const values = await Promise.all(element);
- if (values[1] === true) {
- throw new EndError(values[0]);
- }
-
- return false;
-};
-
-async function pLocate(
- iterable,
- tester,
- {
- concurrency = Number.POSITIVE_INFINITY,
- preserveOrder = true,
- } = {},
-) {
- const limit = pLimit(concurrency);
-
- // Start all the promises concurrently with optional limit.
- const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
-
- // Check the promises either serially or concurrently.
- const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
-
- try {
- await Promise.all(items.map(element => checkLimit(finder, element)));
- } catch (error) {
- if (error instanceof EndError) {
- return error.value;
- }
-
- throw error;
- }
-}
-
-const typeMappings = {
- directory: 'isDirectory',
- file: 'isFile',
-};
-
-function checkType(type) {
- if (Object.hasOwnProperty.call(typeMappings, type)) {
- return;
- }
-
- throw new Error(`Invalid type specified: ${type}`);
-}
-
-const matchType = (type, stat) => stat[typeMappings[type]]();
-
-const toPath$1 = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
-
-async function locatePath(
- paths,
- {
- cwd = process$1.cwd(),
- type = 'file',
- allowSymlinks = true,
- concurrency,
- preserveOrder,
- } = {},
-) {
- checkType(type);
- cwd = toPath$1(cwd);
-
- const statFunction = allowSymlinks ? promises.stat : promises.lstat;
-
- return pLocate(paths, async path_ => {
- try {
- const stat = await statFunction(path$8.resolve(cwd, path_));
- return matchType(type, stat);
- } catch {
- return false;
- }
- }, {concurrency, preserveOrder});
-}
-
-const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
-
-const findUpStop = Symbol('findUpStop');
-
-async function findUpMultiple(name, options = {}) {
- let directory = path$8.resolve(toPath(options.cwd) || '');
- const {root} = path$8.parse(directory);
- const stopAt = path$8.resolve(directory, options.stopAt || root);
- const limit = options.limit || Number.POSITIVE_INFINITY;
- const paths = [name].flat();
-
- 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;
- };
-
- const matches = [];
- // eslint-disable-next-line no-constant-condition
- while (true) {
- // eslint-disable-next-line no-await-in-loop
- const foundPath = await runMatcher({...options, cwd: directory});
-
- if (foundPath === findUpStop) {
- break;
- }
-
- if (foundPath) {
- matches.push(path$8.resolve(directory, foundPath));
- }
-
- if (directory === stopAt || matches.length >= limit) {
- break;
- }
-
- directory = path$8.dirname(directory);
- }
-
- return matches;
-}
-
-async function findUp(name, options = {}) {
- const matches = await findUpMultiple(name, {...options, limit: 1});
- return matches[0];
-}
-
-var tasks = {};
-
-var utils$b = {};
-
-var array$1 = {};
-
-Object.defineProperty(array$1, "__esModule", { value: true });
-array$1.splitWhen = array$1.flatten = void 0;
-function flatten(items) {
- return items.reduce((collection, item) => [].concat(collection, item), []);
-}
-array$1.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;
-}
-array$1.splitWhen = splitWhen;
-
-var errno$1 = {};
-
-Object.defineProperty(errno$1, "__esModule", { value: true });
-errno$1.isEnoentCodeError = void 0;
-function isEnoentCodeError(error) {
- return error.code === 'ENOENT';
-}
-errno$1.isEnoentCodeError = isEnoentCodeError;
-
-var fs$7 = {};
-
-Object.defineProperty(fs$7, "__esModule", { value: true });
-fs$7.createDirentFromStats = void 0;
-let DirentFromStats$1 = class DirentFromStats {
- 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$1(name, stats) {
- return new DirentFromStats$1(name, stats);
-}
-fs$7.createDirentFromStats = createDirentFromStats$1;
-
-var path$7 = {};
-
-Object.defineProperty(path$7, "__esModule", { value: true });
-path$7.convertPosixPathToPattern = path$7.convertWindowsPathToPattern = path$7.convertPathToPattern = path$7.escapePosixPath = path$7.escapeWindowsPath = path$7.escape = path$7.removeLeadingDotSegment = path$7.makeAbsolute = path$7.unixify = void 0;
-const os = require$$0;
-const path$6 = p;
-const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
-const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
-/**
- * All non-escaped special characters.
- * Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
- * Windows: (){}[], !+@ before (, ! at the beginning.
- */
-const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
-const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
-/**
- * The device path (\\.\ or \\?\).
- * https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
- */
-const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
-/**
- * All backslashes except those escaping special characters.
- * Windows: !()+@{}
- * https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
- */
-const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
-/**
- * Designed to work only with simple paths: `dir\\file`.
- */
-function unixify(filepath) {
- return filepath.replace(/\\/g, '/');
-}
-path$7.unixify = unixify;
-function makeAbsolute(cwd, filepath) {
- return path$6.resolve(cwd, filepath);
-}
-path$7.makeAbsolute = makeAbsolute;
-function removeLeadingDotSegment(entry) {
- // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
- // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
- if (entry.charAt(0) === '.') {
- const secondCharactery = entry.charAt(1);
- if (secondCharactery === '/' || secondCharactery === '\\') {
- return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
- }
- }
- return entry;
-}
-path$7.removeLeadingDotSegment = removeLeadingDotSegment;
-path$7.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
-function escapeWindowsPath(pattern) {
- return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
-}
-path$7.escapeWindowsPath = escapeWindowsPath;
-function escapePosixPath(pattern) {
- return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
-}
-path$7.escapePosixPath = escapePosixPath;
-path$7.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
-function convertWindowsPathToPattern(filepath) {
- return escapeWindowsPath(filepath)
- .replace(DOS_DEVICE_PATH_RE, '//$1')
- .replace(WINDOWS_BACKSLASHES_RE, '/');
-}
-path$7.convertWindowsPathToPattern = convertWindowsPathToPattern;
-function convertPosixPathToPattern(filepath) {
- return escapePosixPath(filepath);
-}
-path$7.convertPosixPathToPattern = convertPosixPathToPattern;
-
-var pattern$1 = {};
-
-/*!
- * is-extglob <https://github.com/jonschlinkert/is-extglob>
- *
- * Copyright (c) 2014-2016, Jon Schlinkert.
- * Licensed under the MIT License.
- */
-
-var isExtglob$1 = 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;
-};
-
-/*!
- * is-glob <https://github.com/jonschlinkert/is-glob>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
-
-var isExtglob = isExtglob$1;
-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;
-};
-
-var isGlob$1 = function isGlob(str, options) {
- if (typeof str !== 'string' || str === '') {
- return false;
- }
-
- if (isExtglob(str)) {
- return true;
- }
-
- var check = strictCheck;
-
- // optionally relax check
- if (options && options.strict === false) {
- check = relaxedCheck;
- }
-
- return check(str);
-};
-
-var isGlob = isGlob$1;
-var pathPosixDirname = p.posix.dirname;
-var isWin32 = require$$0.platform() === 'win32';
-
-var slash = '/';
-var backslash = /\\/g;
-var enclosure = /[\{\[].*[\}\]]$/;
-var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
-var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
-
-/**
- * @param {string} str
- * @param {Object} opts
- * @param {boolean} [opts.flipBackslashes=true]
- * @returns {string}
- */
-var globParent$1 = function globParent(str, opts) {
- var options = Object.assign({ flipBackslashes: true }, opts);
-
- // flip windows path separators
- if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
- str = str.replace(backslash, slash);
- }
-
- // special case for strings ending in enclosure containing path separator
- if (enclosure.test(str)) {
- str += slash;
- }
-
- // preserves full path in case of trailing path separator
- str += 'a';
-
- // remove path parts that are globby
- do {
- str = pathPosixDirname(str);
- } while (isGlob(str) || globby.test(str));
-
- // remove escape chars and return result
- return str.replace(escaped, '$1');
-};
-
-Object.defineProperty(pattern$1, "__esModule", { value: true });
-pattern$1.removeDuplicateSlashes = pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
-const path$5 = p;
-const globParent = globParent$1;
-const micromatch = micromatch_1;
-const GLOBSTAR = '**';
-const ESCAPE_SYMBOL = '\\';
-const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
-const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
-const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
-const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
-const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
-/**
- * Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
- * The latter is due to the presence of the device path at the beginning of the UNC path.
- */
-const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
-function isStaticPattern(pattern, options = {}) {
- return !isDynamicPattern(pattern, options);
-}
-pattern$1.isStaticPattern = isStaticPattern;
-function isDynamicPattern(pattern, options = {}) {
- /**
- * A special case with an empty string is necessary for matching patterns that start with a forward slash.
- * An empty string cannot be a dynamic pattern.
- * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
- */
- if (pattern === '') {
- return false;
- }
- /**
- * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
- * filepath directly (without read directory).
- */
- 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;
-}
-pattern$1.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;
-}
-pattern$1.convertToPositivePattern = convertToPositivePattern;
-function convertToNegativePattern(pattern) {
- return '!' + pattern;
-}
-pattern$1.convertToNegativePattern = convertToNegativePattern;
-function isNegativePattern(pattern) {
- return pattern.startsWith('!') && pattern[1] !== '(';
-}
-pattern$1.isNegativePattern = isNegativePattern;
-function isPositivePattern(pattern) {
- return !isNegativePattern(pattern);
-}
-pattern$1.isPositivePattern = isPositivePattern;
-function getNegativePatterns(patterns) {
- return patterns.filter(isNegativePattern);
-}
-pattern$1.getNegativePatterns = getNegativePatterns;
-function getPositivePatterns$1(patterns) {
- return patterns.filter(isPositivePattern);
-}
-pattern$1.getPositivePatterns = getPositivePatterns$1;
-/**
- * Returns patterns that can be applied inside the current directory.
- *
- * @example
- * // ['./*', '*', 'a/*']
- * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
- */
-function getPatternsInsideCurrentDirectory(patterns) {
- return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
-}
-pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
-/**
- * Returns patterns to be expanded relative to (outside) the current directory.
- *
- * @example
- * // ['../*', './../*']
- * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
- */
-function getPatternsOutsideCurrentDirectory(patterns) {
- return patterns.filter(isPatternRelatedToParentDirectory);
-}
-pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
-function isPatternRelatedToParentDirectory(pattern) {
- return pattern.startsWith('..') || pattern.startsWith('./..');
-}
-pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
-function getBaseDirectory(pattern) {
- return globParent(pattern, { flipBackslashes: false });
-}
-pattern$1.getBaseDirectory = getBaseDirectory;
-function hasGlobStar(pattern) {
- return pattern.includes(GLOBSTAR);
-}
-pattern$1.hasGlobStar = hasGlobStar;
-function endsWithSlashGlobStar(pattern) {
- return pattern.endsWith('/' + GLOBSTAR);
-}
-pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
-function isAffectDepthOfReadingPattern(pattern) {
- const basename = path$5.basename(pattern);
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
-}
-pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
-function expandPatternsWithBraceExpansion(patterns) {
- return patterns.reduce((collection, pattern) => {
- return collection.concat(expandBraceExpansion(pattern));
- }, []);
-}
-pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
-function expandBraceExpansion(pattern) {
- const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
- /**
- * Sort the patterns by length so that the same depth patterns are processed side by side.
- * `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
- */
- patterns.sort((a, b) => a.length - b.length);
- /**
- * Micromatch can return an empty string in the case of patterns like `{a,}`.
- */
- return patterns.filter((pattern) => pattern !== '');
-}
-pattern$1.expandBraceExpansion = expandBraceExpansion;
-function getPatternParts(pattern, options) {
- let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
- /**
- * The scan method returns an empty array in some cases.
- * See micromatch/picomatch#58 for more details.
- */
- if (parts.length === 0) {
- parts = [pattern];
- }
- /**
- * The scan method does not return an empty part for the pattern with a forward slash.
- * This is another part of micromatch/picomatch#58.
- */
- if (parts[0].startsWith('/')) {
- parts[0] = parts[0].slice(1);
- parts.unshift('');
- }
- return parts;
-}
-pattern$1.getPatternParts = getPatternParts;
-function makeRe(pattern, options) {
- return micromatch.makeRe(pattern, options);
-}
-pattern$1.makeRe = makeRe;
-function convertPatternsToRe(patterns, options) {
- return patterns.map((pattern) => makeRe(pattern, options));
-}
-pattern$1.convertPatternsToRe = convertPatternsToRe;
-function matchAny(entry, patternsRe) {
- return patternsRe.some((patternRe) => patternRe.test(entry));
-}
-pattern$1.matchAny = matchAny;
-/**
- * This package only works with forward slashes as a path separator.
- * Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
- */
-function removeDuplicateSlashes(pattern) {
- return pattern.replace(DOUBLE_SLASH_RE, '/');
-}
-pattern$1.removeDuplicateSlashes = removeDuplicateSlashes;
-
-var stream$4 = {};
-
-/*
- * merge2
- * https://github.com/teambition/merge2
- *
- * Copyright (c) 2014-2020 Teambition
- * Licensed under the MIT license.
- */
-const Stream = require$$0$1;
-const PassThrough = Stream.PassThrough;
-const slice = Array.prototype.slice;
-
-var merge2_1 = merge2$1;
-
-function merge2$1 () {
- 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);
- }
- // skip ended stream
- 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 });
- // compatible for old stream
- stream.resume();
- }
-
- for (let i = 0; i < streams.length; i++) {
- pipe(streams[i]);
- }
-
- next();
- }
-
- function endStream () {
- merging = false;
- // emit 'queueDrain' when all streams merged.
- 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
-}
-
-// check and pause streams for pipe.
-function pauseStreams (streams, options) {
- if (!Array.isArray(streams)) {
- // Backwards-compat with old-style 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
-}
-
-Object.defineProperty(stream$4, "__esModule", { value: true });
-stream$4.merge = void 0;
-const merge2 = merge2_1;
-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;
-}
-stream$4.merge = merge;
-function propagateCloseEventToSources(streams) {
- streams.forEach((stream) => stream.emit('close'));
-}
-
-var string$1 = {};
-
-Object.defineProperty(string$1, "__esModule", { value: true });
-string$1.isEmpty = string$1.isString = void 0;
-function isString(input) {
- return typeof input === 'string';
-}
-string$1.isString = isString;
-function isEmpty(input) {
- return input === '';
-}
-string$1.isEmpty = isEmpty;
-
-Object.defineProperty(utils$b, "__esModule", { value: true });
-utils$b.string = utils$b.stream = utils$b.pattern = utils$b.path = utils$b.fs = utils$b.errno = utils$b.array = void 0;
-const array = array$1;
-utils$b.array = array;
-const errno = errno$1;
-utils$b.errno = errno;
-const fs$6 = fs$7;
-utils$b.fs = fs$6;
-const path$4 = path$7;
-utils$b.path = path$4;
-const pattern = pattern$1;
-utils$b.pattern = pattern;
-const stream$3 = stream$4;
-utils$b.stream = stream$3;
-const string = string$1;
-utils$b.string = string;
-
-Object.defineProperty(tasks, "__esModule", { value: true });
-tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
-const utils$a = utils$b;
-function generate(input, settings) {
- const patterns = processPatterns(input, settings);
- const ignore = processPatterns(settings.ignore, settings);
- const positivePatterns = getPositivePatterns(patterns);
- const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
- const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
- const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
- const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
- const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
- return staticTasks.concat(dynamicTasks);
-}
-tasks.generate = generate;
-function processPatterns(input, settings) {
- let patterns = input;
- /**
- * The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
- * and some problems with the micromatch package (see fast-glob issues: #365, #394).
- *
- * To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
- * in matching in the case of a large set of patterns after expansion.
- */
- if (settings.braceExpansion) {
- patterns = utils$a.pattern.expandPatternsWithBraceExpansion(patterns);
- }
- /**
- * If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
- * at any nesting level.
- *
- * We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
- * the pattern in the filter before creating a regular expression. There is no need to change the patterns
- * in the application. Only on the input.
- */
- if (settings.baseNameMatch) {
- patterns = patterns.map((pattern) => pattern.includes('/') ? pattern : `**/${pattern}`);
- }
- /**
- * This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
- */
- return patterns.map((pattern) => utils$a.pattern.removeDuplicateSlashes(pattern));
-}
-/**
- * Returns tasks grouped by basic pattern directories.
- *
- * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
- * This is necessary because directory traversal starts at the base directory and goes deeper.
- */
-function convertPatternsToTasks(positive, negative, dynamic) {
- const tasks = [];
- const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
- const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
- const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
- const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
- tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
- /*
- * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
- * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
- */
- if ('.' in insideCurrentDirectoryGroup) {
- tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
- }
- else {
- tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
- }
- return tasks;
-}
-tasks.convertPatternsToTasks = convertPatternsToTasks;
-function getPositivePatterns(patterns) {
- return utils$a.pattern.getPositivePatterns(patterns);
-}
-tasks.getPositivePatterns = getPositivePatterns;
-function getNegativePatternsAsPositive(patterns, ignore) {
- const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
- const positive = negative.map(utils$a.pattern.convertToPositivePattern);
- return positive;
-}
-tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
-function groupPatternsByBaseDirectory(patterns) {
- const group = {};
- return patterns.reduce((collection, pattern) => {
- const base = utils$a.pattern.getBaseDirectory(pattern);
- if (base in collection) {
- collection[base].push(pattern);
- }
- else {
- collection[base] = [pattern];
- }
- return collection;
- }, group);
-}
-tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
-function convertPatternGroupsToTasks(positive, negative, dynamic) {
- return Object.keys(positive).map((base) => {
- return convertPatternGroupToTask(base, positive[base], negative, dynamic);
- });
-}
-tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
-function convertPatternGroupToTask(base, positive, negative, dynamic) {
- return {
- dynamic,
- positive,
- negative,
- base,
- patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
- };
-}
-tasks.convertPatternGroupToTask = convertPatternGroupToTask;
-
-var async$7 = {};
-
-var async$6 = {};
-
-var out$3 = {};
-
-var async$5 = {};
-
-var async$4 = {};
-
-var out$2 = {};
-
-var async$3 = {};
-
-var out$1 = {};
-
-var async$2 = {};
-
-Object.defineProperty(async$2, "__esModule", { value: true });
-async$2.read = void 0;
-function read$3(path, settings, callback) {
- settings.fs.lstat(path, (lstatError, lstat) => {
- if (lstatError !== null) {
- callFailureCallback$2(callback, lstatError);
- return;
- }
- if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
- callSuccessCallback$2(callback, lstat);
- return;
- }
- settings.fs.stat(path, (statError, stat) => {
- if (statError !== null) {
- if (settings.throwErrorOnBrokenSymbolicLink) {
- callFailureCallback$2(callback, statError);
- return;
- }
- callSuccessCallback$2(callback, lstat);
- return;
- }
- if (settings.markSymbolicLink) {
- stat.isSymbolicLink = () => true;
- }
- callSuccessCallback$2(callback, (too long so truncated)
Command detailsnpm diff --diff=vitest@1.4.0 --diff=vitest@1.5.3 --diff-unified=2 See also the Reported by ybiquitous/npm-diff-action@v1.5.0 (Node.js 20.12.2 and npm 10.7.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
dependencies
Pull requests that update a dependency file
javascript
Pull requests that update Javascript code
0 participants
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps vitest from 1.4.0 to 1.5.3.
Release notes
Sourced from vitest's releases.
... (truncated)
Commits
a52964b
chore: release v1.5.3200609c
fix(reporter): use default error formatter for JUnit (#5629)48fba19
fix: use package.json name for a workspace project if not provided (#5608)7c993e9
test: standardising internal test (#5600)81f57f4
chore: release v1.5.21be4510
chore: release v1.5.1f1bec62
refactor: remove VitestCache.clearCache method (#5602)780b187
feat(api):startVitest()
to acceptstdout
andstdin
(#5493)2b3fc0f
docs: fix cli-table generator597e0c2
docs: generate CLI table automatically (#5588)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)