ueberdb2 4.2.57 → 4.2.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var require$$1$7=require('console'),require$$0$m=require('process'),require$$0$6=require('util'),require$$0$9=require('dns'),require$$0$7=require('net'),require$$0$8=require('events'),require$$0$a=require('crypto'),require$$0$b=require('stream'),require$$1$2=require('tls'),os$3=require('os'),require$$1$3=require('path'),require$$0$c=require('fs'),https$6=require('https'),require$$0$d=require('zlib'),require$$0$e=require('url'),require$$0$f=require('vm'),http$5=require('http'),require$$0$g=require('assert'),require$$1$4=require('tty'),require$$0$h=require('buffer'),require$$1$5=require('querystring'),require$$13=require('stream/web'),require$$0$j=require('node:stream'),require$$1$6=require('node:util'),require$$0$i=require('node:events'),require$$0$k=require('worker_threads'),require$$2$2=require('perf_hooks'),require$$5$1=require('util/types'),require$$4$2=require('async_hooks'),require$$1$8=require('string_decoder'),require$$0$l=require('diagnostics_channel'),require$$1$9=require('timers'),child_process=require('child_process'),require$$0$n=require('fs/promises'),require$$5$2=require('constants'),require$$0$o=require('dgram'),require$$2$3=require('punycode');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var os__namespace=/*#__PURE__*/_interopNamespaceDefault(os$3);var https__namespace=/*#__PURE__*/_interopNamespaceDefault(https$6);var require$$0__namespace=/*#__PURE__*/_interopNamespaceDefault(require$$0$d);var http__namespace=/*#__PURE__*/_interopNamespaceDefault(http$5);var child_process__namespace=/*#__PURE__*/_interopNamespaceDefault(child_process);// @ts-nocheck
1
+ 'use strict';var require$$0$6=require('util'),require$$1$7=require('console'),require$$0$m=require('process'),require$$0$9=require('dns'),require$$0$7=require('net'),require$$0$8=require('events'),require$$0$a=require('crypto'),require$$0$b=require('stream'),require$$1$2=require('tls'),os$3=require('os'),require$$1$3=require('path'),require$$0$c=require('fs'),https$6=require('https'),require$$0$d=require('zlib'),require$$0$e=require('url'),require$$0$f=require('vm'),http$5=require('http'),require$$0$g=require('assert'),require$$1$4=require('tty'),node_path=require('node:path'),child_process=require('child_process'),require$$0$h=require('buffer'),require$$1$5=require('querystring'),require$$13=require('stream/web'),require$$0$j=require('node:stream'),require$$1$6=require('node:util'),require$$0$i=require('node:events'),require$$0$k=require('worker_threads'),require$$2$2=require('perf_hooks'),require$$5$1=require('util/types'),require$$4$2=require('async_hooks'),require$$1$8=require('string_decoder'),require$$0$l=require('diagnostics_channel'),require$$1$9=require('timers'),require$$0$n=require('fs/promises'),require$$5$2=require('constants'),require$$0$o=require('dgram'),require$$2$3=require('punycode');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var os__namespace=/*#__PURE__*/_interopNamespaceDefault(os$3);var https__namespace=/*#__PURE__*/_interopNamespaceDefault(https$6);var require$$0__namespace=/*#__PURE__*/_interopNamespaceDefault(require$$0$d);var http__namespace=/*#__PURE__*/_interopNamespaceDefault(http$5);var child_process__namespace=/*#__PURE__*/_interopNamespaceDefault(child_process);// @ts-nocheck
2
2
  /**
3
3
  * 2011 Peter 'Pita' Martischka
4
4
  *
@@ -31,7 +31,6 @@
31
31
  * All Features can be disabled or configured. The Wrapper provides default settings that can be
32
32
  * overwriden by the driver and by the module user.
33
33
  */
34
- const util$Z = require('util');
35
34
  /**
36
35
  * Cache with Least Recently Used eviction policy.
37
36
  */
@@ -141,7 +140,7 @@ const Database$1 = class Database {
141
140
  const f = wrappedDB[fn];
142
141
  if (typeof f !== 'function')
143
142
  continue;
144
- this.wrappedDB[fn] = util$Z.promisify(f.bind(wrappedDB));
143
+ this.wrappedDB[fn] = require$$0$6.promisify(f.bind(wrappedDB));
145
144
  }
146
145
  }
147
146
  this.logger = logger;
@@ -925,7 +924,7 @@ errors$C.ResponseError = ResponseError$1;/*
925
924
  * @param {number} ms
926
925
  * @returns {Promise<void>}
927
926
  */
928
- function delay$3(ms) {
927
+ function delay$4(ms) {
929
928
  return new Promise(r => setTimeout(r, ms || 0));
930
929
  }
931
930
 
@@ -1069,7 +1068,7 @@ function toCallback(promise, callback) {
1069
1068
  }
1070
1069
 
1071
1070
  var promiseUtils$e = {
1072
- delay: delay$3,
1071
+ delay: delay$4,
1073
1072
  fromCallback,
1074
1073
  fromEvent,
1075
1074
  getCallback,
@@ -20479,7 +20478,7 @@ const clientOptions$1 = requireClientOptions();
20479
20478
  let connectionIndex = 0;
20480
20479
  const connectionIndexOverflow = Math.pow(2, 15);
20481
20480
 
20482
- let defaultOptions$1;
20481
+ let defaultOptions$2;
20483
20482
 
20484
20483
  /**
20485
20484
  * Represents the possible states of the pool.
@@ -20965,10 +20964,10 @@ let HostConnectionPool$1=class HostConnectionPool extends events$b.EventEmitter
20965
20964
 
20966
20965
  /** Lazily loads the default options */
20967
20966
  function getDefaultOptions() {
20968
- if (defaultOptions$1 === undefined) {
20969
- defaultOptions$1 = clientOptions$1.defaultOptions();
20967
+ if (defaultOptions$2 === undefined) {
20968
+ defaultOptions$2 = clientOptions$1.defaultOptions();
20970
20969
  }
20971
- return defaultOptions$1;
20970
+ return defaultOptions$2;
20972
20971
  }
20973
20972
 
20974
20973
  var hostConnectionPool = HostConnectionPool$1;/*
@@ -29764,7 +29763,7 @@ const ZipFile = zipFile;
29764
29763
  const get_Bool = (val, def) => (typeof val === "boolean" ? val : def);
29765
29764
  const get_Str = (val, def) => (typeof val === "string" ? val : def);
29766
29765
 
29767
- const defaultOptions = {
29766
+ const defaultOptions$1 = {
29768
29767
  // option "noSort" : if true it disables files sorting
29769
29768
  noSort: false,
29770
29769
  // read entries during load (initial loading may be slower)
@@ -29779,7 +29778,7 @@ var admZip = function (/**String*/ input, /** object */ options) {
29779
29778
  let inBuffer = null;
29780
29779
 
29781
29780
  // create object based default options, allowing them to be overwritten
29782
- const opts = Object.assign(Object.create(null), defaultOptions);
29781
+ const opts = Object.assign(Object.create(null), defaultOptions$1);
29783
29782
 
29784
29783
  // test input variable
29785
29784
  if (input && "object" === typeof input) {
@@ -34839,7 +34838,7 @@ let Cache$3=class Cache {
34839
34838
  }
34840
34839
  };
34841
34840
 
34842
- var cache$2 = Cache$3;/*
34841
+ var cache$3 = Cache$3;/*
34843
34842
  * Copyright DataStax, Inc.
34844
34843
  *
34845
34844
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34855,7 +34854,7 @@ var cache$2 = Cache$3;/*
34855
34854
  * limitations under the License.
34856
34855
  */
34857
34856
 
34858
- const Cache$2 = cache$2;
34857
+ const Cache$2 = cache$3;
34859
34858
 
34860
34859
  /**
34861
34860
  * Represents a query or a set of queries used to perform a mutation in a batch.
@@ -36634,7 +36633,7 @@ const utils$j = utils$10;
36634
36633
  const QueryGenerator = queryGenerator;
36635
36634
  const ResultMapper$1 = resultMapper;
36636
36635
  const Result$4 = result$1;
36637
- const Cache$1 = cache$2;
36636
+ const Cache$1 = cache$3;
36638
36637
  const Tree = tree;
36639
36638
  const ObjectSelector = objectSelector;
36640
36639
  const DocInfoAdapter$1 = docInfoAdapter;
@@ -38267,7 +38266,7 @@ var implementation$8 = function bind(that) {
38267
38266
 
38268
38267
  var functionBind = Function.prototype.bind || implementation$7;var bind$6 = functionBind;
38269
38268
 
38270
- var src$3 = bind$6.call(Function.call, Object.prototype.hasOwnProperty);var undefined$1;
38269
+ var src$4 = bind$6.call(Function.call, Object.prototype.hasOwnProperty);var undefined$1;
38271
38270
 
38272
38271
  var $SyntaxError$1 = SyntaxError;
38273
38272
  var $Function = Function;
@@ -38481,7 +38480,7 @@ var LEGACY_ALIASES = {
38481
38480
  };
38482
38481
 
38483
38482
  var bind$5 = functionBind;
38484
- var hasOwn$1 = src$3;
38483
+ var hasOwn$1 = src$4;
38485
38484
  var $concat$1 = bind$5.call(Function.call, Array.prototype.concat);
38486
38485
  var $spliceApply = bind$5.call(Function.apply, Array.prototype.splice);
38487
38486
  var $replace$1 = bind$5.call(Function.call, String.prototype.replace);
@@ -38691,7 +38690,7 @@ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
38691
38690
  var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
38692
38691
  var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
38693
38692
  var booleanValueOf = Boolean.prototype.valueOf;
38694
- var objectToString$7 = Object.prototype.toString;
38693
+ var objectToString$8 = Object.prototype.toString;
38695
38694
  var functionToString = Function.prototype.toString;
38696
38695
  var $match = String.prototype.match;
38697
38696
  var $slice = String.prototype.slice;
@@ -38985,7 +38984,7 @@ function has$3(obj, key) {
38985
38984
  }
38986
38985
 
38987
38986
  function toStr$3(obj) {
38988
- return objectToString$7.call(obj);
38987
+ return objectToString$8.call(obj);
38989
38988
  }
38990
38989
 
38991
38990
  function nameOf(f) {
@@ -52357,7 +52356,7 @@ function getEnv(key) {
52357
52356
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
52358
52357
  }
52359
52358
 
52360
- proxyFromEnv$1.getProxyForUrl = getProxyForUrl;var followRedirects$1 = {exports: {}};var src$2 = {exports: {}};var browser = {exports: {}};/**
52359
+ proxyFromEnv$1.getProxyForUrl = getProxyForUrl;var followRedirects$1 = {exports: {}};var src$3 = {exports: {}};var browser = {exports: {}};/**
52361
52360
  * Helpers.
52362
52361
  */
52363
52362
 
@@ -53514,24 +53513,20 @@ function requireNode () {
53514
53513
  * treat as a browser.
53515
53514
  */
53516
53515
 
53517
- var hasRequiredSrc;
53516
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
53517
+ src$3.exports = requireBrowser();
53518
+ } else {
53519
+ src$3.exports = requireNode();
53520
+ }
53518
53521
 
53519
- function requireSrc () {
53520
- if (hasRequiredSrc) return src$2.exports;
53521
- hasRequiredSrc = 1;
53522
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
53523
- src$2.exports = requireBrowser();
53524
- } else {
53525
- src$2.exports = requireNode();
53526
- }
53527
- return src$2.exports;
53528
- }var debug$i;
53522
+ var srcExports = src$3.exports;
53523
+ var debug$j = /*@__PURE__*/getDefaultExportFromCjs(srcExports);var debug$i;
53529
53524
 
53530
53525
  var debug_1$7 = function () {
53531
53526
  if (!debug$i) {
53532
53527
  try {
53533
53528
  /* eslint global-require: off */
53534
- debug$i = requireSrc()("follow-redirects");
53529
+ debug$i = srcExports("follow-redirects");
53535
53530
  }
53536
53531
  catch (error) { /* */ }
53537
53532
  if (typeof debug$i !== "function") {
@@ -54472,7 +54467,7 @@ const trim = (str) => str.trim ?
54472
54467
  * @param {Boolean} [allOwnKeys = false]
54473
54468
  * @returns {any}
54474
54469
  */
54475
- function forEach$1(obj, fn, {allOwnKeys = false} = {}) {
54470
+ function forEach$2(obj, fn, {allOwnKeys = false} = {}) {
54476
54471
  // Don't bother if no value provided
54477
54472
  if (obj === null || typeof obj === 'undefined') {
54478
54473
  return;
@@ -54562,7 +54557,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
54562
54557
  };
54563
54558
 
54564
54559
  for (let i = 0, l = arguments.length; i < l; i++) {
54565
- arguments[i] && forEach$1(arguments[i], assignValue);
54560
+ arguments[i] && forEach$2(arguments[i], assignValue);
54566
54561
  }
54567
54562
  return result;
54568
54563
  }
@@ -54578,7 +54573,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
54578
54573
  * @returns {Object} The resulting value of object a
54579
54574
  */
54580
54575
  const extend$3 = (a, b, thisArg, {allOwnKeys}= {}) => {
54581
- forEach$1(b, (val, key) => {
54576
+ forEach$2(b, (val, key) => {
54582
54577
  if (thisArg && isFunction$3(val)) {
54583
54578
  a[key] = bind$4(val, thisArg);
54584
54579
  } else {
@@ -54777,7 +54772,7 @@ const reduceDescriptors = (obj, reducer) => {
54777
54772
  const descriptors = Object.getOwnPropertyDescriptors(obj);
54778
54773
  const reducedDescriptors = {};
54779
54774
 
54780
- forEach$1(descriptors, (descriptor, name) => {
54775
+ forEach$2(descriptors, (descriptor, name) => {
54781
54776
  let ret;
54782
54777
  if ((ret = reducer(descriptor, name, obj)) !== false) {
54783
54778
  reducedDescriptors[name] = ret || descriptor;
@@ -54884,7 +54879,7 @@ const toJSONObject = (obj) => {
54884
54879
  stack[i] = source;
54885
54880
  const target = isArray$2(source) ? [] : {};
54886
54881
 
54887
- forEach$1(source, (value, key) => {
54882
+ forEach$2(source, (value, key) => {
54888
54883
  const reducedValue = visit(value, i + 1);
54889
54884
  !isUndefined(reducedValue) && (target[key] = reducedValue);
54890
54885
  });
@@ -54927,7 +54922,7 @@ const utils$1$1 = {
54927
54922
  isURLSearchParams,
54928
54923
  isTypedArray,
54929
54924
  isFileList,
54930
- forEach: forEach$1,
54925
+ forEach: forEach$2,
54931
54926
  merge,
54932
54927
  extend: extend$3,
54933
54928
  trim,
@@ -60878,7 +60873,4169 @@ class Dirty_db extends AbstractDatabase {
60878
60873
  if (callback)
60879
60874
  callback();
60880
60875
  }
60881
- }class Dirty_git_db extends AbstractDatabase {
60876
+ }var dist$d = {};var src$2 = {};(function (exports) {
60877
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
60878
+ return (mod && mod.__esModule) ? mod : { "default": mod };
60879
+ };
60880
+ Object.defineProperty(exports, "__esModule", { value: true });
60881
+ const fs_1 = require$$0$c;
60882
+ const debug_1 = __importDefault(srcExports);
60883
+ const log = debug_1.default('@kwsites/file-exists');
60884
+ function check(path, isFile, isDirectory) {
60885
+ log(`checking %s`, path);
60886
+ try {
60887
+ const stat = fs_1.statSync(path);
60888
+ if (stat.isFile() && isFile) {
60889
+ log(`[OK] path represents a file`);
60890
+ return true;
60891
+ }
60892
+ if (stat.isDirectory() && isDirectory) {
60893
+ log(`[OK] path represents a directory`);
60894
+ return true;
60895
+ }
60896
+ log(`[FAIL] path represents something other than a file or directory`);
60897
+ return false;
60898
+ }
60899
+ catch (e) {
60900
+ if (e.code === 'ENOENT') {
60901
+ log(`[FAIL] path is not accessible: %o`, e);
60902
+ return false;
60903
+ }
60904
+ log(`[FATAL] %o`, e);
60905
+ throw e;
60906
+ }
60907
+ }
60908
+ /**
60909
+ * Synchronous validation of a path existing either as a file or as a directory.
60910
+ *
60911
+ * @param {string} path The path to check
60912
+ * @param {number} type One or both of the exported numeric constants
60913
+ */
60914
+ function exists(path, type = exports.READABLE) {
60915
+ return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
60916
+ }
60917
+ exports.exists = exists;
60918
+ /**
60919
+ * Constant representing a file
60920
+ */
60921
+ exports.FILE = 1;
60922
+ /**
60923
+ * Constant representing a folder
60924
+ */
60925
+ exports.FOLDER = 2;
60926
+ /**
60927
+ * Constant representing either a file or a folder
60928
+ */
60929
+ exports.READABLE = exports.FILE + exports.FOLDER;
60930
+
60931
+ } (src$2));(function (exports) {
60932
+ function __export(m) {
60933
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
60934
+ }
60935
+ Object.defineProperty(exports, "__esModule", { value: true });
60936
+ __export(src$2);
60937
+
60938
+ } (dist$d));var dist$c = {};Object.defineProperty(dist$c, "__esModule", { value: true });
60939
+ var createDeferred = dist$c.createDeferred = deferred_1 = dist$c.deferred = void 0;
60940
+ /**
60941
+ * Creates a new `DeferredPromise`
60942
+ *
60943
+ * ```typescript
60944
+ import {deferred} from '@kwsites/promise-deferred`;
60945
+ ```
60946
+ */
60947
+ function deferred() {
60948
+ let done;
60949
+ let fail;
60950
+ let status = 'pending';
60951
+ const promise = new Promise((_done, _fail) => {
60952
+ done = _done;
60953
+ fail = _fail;
60954
+ });
60955
+ return {
60956
+ promise,
60957
+ done(result) {
60958
+ if (status === 'pending') {
60959
+ status = 'resolved';
60960
+ done(result);
60961
+ }
60962
+ },
60963
+ fail(error) {
60964
+ if (status === 'pending') {
60965
+ status = 'rejected';
60966
+ fail(error);
60967
+ }
60968
+ },
60969
+ get fulfilled() {
60970
+ return status !== 'pending';
60971
+ },
60972
+ get status() {
60973
+ return status;
60974
+ },
60975
+ };
60976
+ }
60977
+ var deferred_1 = dist$c.deferred = deferred;
60978
+ /**
60979
+ * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the
60980
+ * local variable name rather than the factory import name, without needing to rename on import.
60981
+ *
60982
+ * ```typescript
60983
+ import {createDeferred} from '@kwsites/promise-deferred`;
60984
+ ```
60985
+ */
60986
+ createDeferred = dist$c.createDeferred = deferred;
60987
+ /**
60988
+ * Default export allows use as:
60989
+ *
60990
+ * ```typescript
60991
+ import deferred from '@kwsites/promise-deferred`;
60992
+ ```
60993
+ */
60994
+ dist$c.default = deferred;var __defProp = Object.defineProperty;
60995
+ var __defProps = Object.defineProperties;
60996
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
60997
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
60998
+ var __getOwnPropNames = Object.getOwnPropertyNames;
60999
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
61000
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
61001
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
61002
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
61003
+ var __spreadValues = (a, b) => {
61004
+ for (var prop in b || (b = {}))
61005
+ if (__hasOwnProp.call(b, prop))
61006
+ __defNormalProp(a, prop, b[prop]);
61007
+ if (__getOwnPropSymbols)
61008
+ for (var prop of __getOwnPropSymbols(b)) {
61009
+ if (__propIsEnum.call(b, prop))
61010
+ __defNormalProp(a, prop, b[prop]);
61011
+ }
61012
+ return a;
61013
+ };
61014
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
61015
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
61016
+ var __esm = (fn, res) => function __init() {
61017
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
61018
+ };
61019
+ var __commonJS = (cb, mod) => function __require() {
61020
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
61021
+ };
61022
+ var __export = (target, all) => {
61023
+ for (var name in all)
61024
+ __defProp(target, name, { get: all[name], enumerable: true });
61025
+ };
61026
+ var __reExport = (target, module, copyDefault, desc) => {
61027
+ if (module && typeof module === "object" || typeof module === "function") {
61028
+ for (let key of __getOwnPropNames(module))
61029
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
61030
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
61031
+ }
61032
+ return target;
61033
+ };
61034
+ var __toCommonJS = /* @__PURE__ */ ((cache2) => {
61035
+ return (module, temp) => {
61036
+ return cache2 && cache2.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache2 && cache2.set(module, temp), temp);
61037
+ };
61038
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
61039
+ var __async = (__this, __arguments, generator) => {
61040
+ return new Promise((resolve, reject) => {
61041
+ var fulfilled = (value) => {
61042
+ try {
61043
+ step(generator.next(value));
61044
+ } catch (e) {
61045
+ reject(e);
61046
+ }
61047
+ };
61048
+ var rejected = (value) => {
61049
+ try {
61050
+ step(generator.throw(value));
61051
+ } catch (e) {
61052
+ reject(e);
61053
+ }
61054
+ };
61055
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
61056
+ step((generator = generator.apply(__this, __arguments)).next());
61057
+ });
61058
+ };
61059
+
61060
+ // src/lib/args/pathspec.ts
61061
+ function pathspec(...paths) {
61062
+ const key = new String(paths);
61063
+ cache$2.set(key, paths);
61064
+ return key;
61065
+ }
61066
+ function isPathSpec(path) {
61067
+ return path instanceof String && cache$2.has(path);
61068
+ }
61069
+ function toPaths(pathSpec) {
61070
+ return cache$2.get(pathSpec) || [];
61071
+ }
61072
+ var cache$2;
61073
+ var init_pathspec = __esm({
61074
+ "src/lib/args/pathspec.ts"() {
61075
+ cache$2 = /* @__PURE__ */ new WeakMap();
61076
+ }
61077
+ });
61078
+
61079
+ // src/lib/errors/git-error.ts
61080
+ var GitError;
61081
+ var init_git_error = __esm({
61082
+ "src/lib/errors/git-error.ts"() {
61083
+ GitError = class extends Error {
61084
+ constructor(task, message) {
61085
+ super(message);
61086
+ this.task = task;
61087
+ Object.setPrototypeOf(this, new.target.prototype);
61088
+ }
61089
+ };
61090
+ }
61091
+ });
61092
+
61093
+ // src/lib/errors/git-response-error.ts
61094
+ var GitResponseError;
61095
+ var init_git_response_error = __esm({
61096
+ "src/lib/errors/git-response-error.ts"() {
61097
+ init_git_error();
61098
+ GitResponseError = class extends GitError {
61099
+ constructor(git, message) {
61100
+ super(void 0, message || String(git));
61101
+ this.git = git;
61102
+ }
61103
+ };
61104
+ }
61105
+ });
61106
+
61107
+ // src/lib/errors/task-configuration-error.ts
61108
+ var TaskConfigurationError;
61109
+ var init_task_configuration_error = __esm({
61110
+ "src/lib/errors/task-configuration-error.ts"() {
61111
+ init_git_error();
61112
+ TaskConfigurationError = class extends GitError {
61113
+ constructor(message) {
61114
+ super(void 0, message);
61115
+ }
61116
+ };
61117
+ }
61118
+ });
61119
+ function asFunction(source) {
61120
+ return typeof source === "function" ? source : NOOP$1;
61121
+ }
61122
+ function isUserFunction(source) {
61123
+ return typeof source === "function" && source !== NOOP$1;
61124
+ }
61125
+ function splitOn(input, char) {
61126
+ const index = input.indexOf(char);
61127
+ if (index <= 0) {
61128
+ return [input, ""];
61129
+ }
61130
+ return [input.substr(0, index), input.substr(index + 1)];
61131
+ }
61132
+ function first$1(input, offset = 0) {
61133
+ return isArrayLike$2(input) && input.length > offset ? input[offset] : void 0;
61134
+ }
61135
+ function last$1(input, offset = 0) {
61136
+ if (isArrayLike$2(input) && input.length > offset) {
61137
+ return input[input.length - 1 - offset];
61138
+ }
61139
+ }
61140
+ function isArrayLike$2(input) {
61141
+ return !!(input && typeof input.length === "number");
61142
+ }
61143
+ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
61144
+ return input.split(separator).reduce((output, line) => {
61145
+ const lineContent = trimmed2 ? line.trim() : line;
61146
+ if (lineContent) {
61147
+ output.push(lineContent);
61148
+ }
61149
+ return output;
61150
+ }, []);
61151
+ }
61152
+ function forEachLineWithContent(input, callback) {
61153
+ return toLinesWithContent(input, true).map((line) => callback(line));
61154
+ }
61155
+ function folderExists(path) {
61156
+ return dist$d.exists(path, dist$d.FOLDER);
61157
+ }
61158
+ function append(target, item) {
61159
+ if (Array.isArray(target)) {
61160
+ if (!target.includes(item)) {
61161
+ target.push(item);
61162
+ }
61163
+ } else {
61164
+ target.add(item);
61165
+ }
61166
+ return item;
61167
+ }
61168
+ function including(target, item) {
61169
+ if (Array.isArray(target) && !target.includes(item)) {
61170
+ target.push(item);
61171
+ }
61172
+ return target;
61173
+ }
61174
+ function remove$1(target, item) {
61175
+ if (Array.isArray(target)) {
61176
+ const index = target.indexOf(item);
61177
+ if (index >= 0) {
61178
+ target.splice(index, 1);
61179
+ }
61180
+ } else {
61181
+ target.delete(item);
61182
+ }
61183
+ return item;
61184
+ }
61185
+ function asArray(source) {
61186
+ return Array.isArray(source) ? source : [source];
61187
+ }
61188
+ function asStringArray(source) {
61189
+ return asArray(source).map(String);
61190
+ }
61191
+ function asNumber(source, onNaN = 0) {
61192
+ if (source == null) {
61193
+ return onNaN;
61194
+ }
61195
+ const num = parseInt(source, 10);
61196
+ return isNaN(num) ? onNaN : num;
61197
+ }
61198
+ function prefixedArray(input, prefix) {
61199
+ const output = [];
61200
+ for (let i = 0, max = input.length; i < max; i++) {
61201
+ output.push(prefix, input[i]);
61202
+ }
61203
+ return output;
61204
+ }
61205
+ function bufferToString(input) {
61206
+ return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8");
61207
+ }
61208
+ function pick(source, properties) {
61209
+ return Object.assign({}, ...properties.map((property) => property in source ? { [property]: source[property] } : {}));
61210
+ }
61211
+ function delay$3(duration = 0) {
61212
+ return new Promise((done) => setTimeout(done, duration));
61213
+ }
61214
+ function orVoid(input) {
61215
+ if (input === false) {
61216
+ return void 0;
61217
+ }
61218
+ return input;
61219
+ }
61220
+ var NULL$1, NOOP$1, objectToString$7;
61221
+ var init_util = __esm({
61222
+ "src/lib/utils/util.ts"() {
61223
+ NULL$1 = "\0";
61224
+ NOOP$1 = () => {
61225
+ };
61226
+ objectToString$7 = Object.prototype.toString.call.bind(Object.prototype.toString);
61227
+ }
61228
+ });
61229
+
61230
+ // src/lib/utils/argument-filters.ts
61231
+ function filterType(input, filter, def) {
61232
+ if (filter(input)) {
61233
+ return input;
61234
+ }
61235
+ return arguments.length > 2 ? def : void 0;
61236
+ }
61237
+ function filterPrimitives(input, omit) {
61238
+ const type = isPathSpec(input) ? "string" : typeof input;
61239
+ return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));
61240
+ }
61241
+ function filterPlainObject(input) {
61242
+ return !!input && objectToString$7(input) === "[object Object]";
61243
+ }
61244
+ function filterFunction(input) {
61245
+ return typeof input === "function";
61246
+ }
61247
+ var filterArray$1, filterString, filterStringArray, filterStringOrStringArray, filterHasLength;
61248
+ var init_argument_filters = __esm({
61249
+ "src/lib/utils/argument-filters.ts"() {
61250
+ init_util();
61251
+ init_pathspec();
61252
+ filterArray$1 = (input) => {
61253
+ return Array.isArray(input);
61254
+ };
61255
+ filterString = (input) => {
61256
+ return typeof input === "string";
61257
+ };
61258
+ filterStringArray = (input) => {
61259
+ return Array.isArray(input) && input.every(filterString);
61260
+ };
61261
+ filterStringOrStringArray = (input) => {
61262
+ return filterString(input) || Array.isArray(input) && input.every(filterString);
61263
+ };
61264
+ filterHasLength = (input) => {
61265
+ if (input == null || "number|boolean|function".includes(typeof input)) {
61266
+ return false;
61267
+ }
61268
+ return Array.isArray(input) || typeof input === "string" || typeof input.length === "number";
61269
+ };
61270
+ }
61271
+ });
61272
+
61273
+ // src/lib/utils/exit-codes.ts
61274
+ var ExitCodes;
61275
+ var init_exit_codes = __esm({
61276
+ "src/lib/utils/exit-codes.ts"() {
61277
+ ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
61278
+ ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
61279
+ ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
61280
+ ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND";
61281
+ ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
61282
+ return ExitCodes2;
61283
+ })(ExitCodes || {});
61284
+ }
61285
+ });
61286
+
61287
+ // src/lib/utils/git-output-streams.ts
61288
+ var GitOutputStreams;
61289
+ var init_git_output_streams = __esm({
61290
+ "src/lib/utils/git-output-streams.ts"() {
61291
+ GitOutputStreams = class {
61292
+ constructor(stdOut, stdErr) {
61293
+ this.stdOut = stdOut;
61294
+ this.stdErr = stdErr;
61295
+ }
61296
+ asStrings() {
61297
+ return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
61298
+ }
61299
+ };
61300
+ }
61301
+ });
61302
+
61303
+ // src/lib/utils/line-parser.ts
61304
+ var LineParser, RemoteLineParser;
61305
+ var init_line_parser = __esm({
61306
+ "src/lib/utils/line-parser.ts"() {
61307
+ LineParser = class {
61308
+ constructor(regExp, useMatches) {
61309
+ this.matches = [];
61310
+ this.parse = (line, target) => {
61311
+ this.resetMatches();
61312
+ if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
61313
+ return false;
61314
+ }
61315
+ return this.useMatches(target, this.prepareMatches()) !== false;
61316
+ };
61317
+ this._regExp = Array.isArray(regExp) ? regExp : [regExp];
61318
+ if (useMatches) {
61319
+ this.useMatches = useMatches;
61320
+ }
61321
+ }
61322
+ useMatches(target, match) {
61323
+ throw new Error(`LineParser:useMatches not implemented`);
61324
+ }
61325
+ resetMatches() {
61326
+ this.matches.length = 0;
61327
+ }
61328
+ prepareMatches() {
61329
+ return this.matches;
61330
+ }
61331
+ addMatch(reg, index, line) {
61332
+ const matched = line && reg.exec(line);
61333
+ if (matched) {
61334
+ this.pushMatch(index, matched);
61335
+ }
61336
+ return !!matched;
61337
+ }
61338
+ pushMatch(_index, matched) {
61339
+ this.matches.push(...matched.slice(1));
61340
+ }
61341
+ };
61342
+ RemoteLineParser = class extends LineParser {
61343
+ addMatch(reg, index, line) {
61344
+ return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
61345
+ }
61346
+ pushMatch(index, matched) {
61347
+ if (index > 0 || matched.length > 1) {
61348
+ super.pushMatch(index, matched);
61349
+ }
61350
+ }
61351
+ };
61352
+ }
61353
+ });
61354
+
61355
+ // src/lib/utils/simple-git-options.ts
61356
+ function createInstanceConfig(...options) {
61357
+ const baseDir = process.cwd();
61358
+ const config = Object.assign(__spreadValues({ baseDir }, defaultOptions), ...options.filter((o) => typeof o === "object" && o));
61359
+ config.baseDir = config.baseDir || baseDir;
61360
+ config.trimmed = config.trimmed === true;
61361
+ return config;
61362
+ }
61363
+ var defaultOptions;
61364
+ var init_simple_git_options = __esm({
61365
+ "src/lib/utils/simple-git-options.ts"() {
61366
+ defaultOptions = {
61367
+ binary: "git",
61368
+ maxConcurrentProcesses: 5,
61369
+ config: [],
61370
+ trimmed: false
61371
+ };
61372
+ }
61373
+ });
61374
+
61375
+ // src/lib/utils/task-options.ts
61376
+ function appendTaskOptions(options, commands = []) {
61377
+ if (!filterPlainObject(options)) {
61378
+ return commands;
61379
+ }
61380
+ return Object.keys(options).reduce((commands2, key) => {
61381
+ const value = options[key];
61382
+ if (isPathSpec(value)) {
61383
+ commands2.push(value);
61384
+ } else if (filterPrimitives(value, ["boolean"])) {
61385
+ commands2.push(key + "=" + value);
61386
+ } else {
61387
+ commands2.push(key);
61388
+ }
61389
+ return commands2;
61390
+ }, commands);
61391
+ }
61392
+ function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
61393
+ const command = [];
61394
+ for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {
61395
+ if ("string|number".includes(typeof args[i])) {
61396
+ command.push(String(args[i]));
61397
+ }
61398
+ }
61399
+ appendTaskOptions(trailingOptionsArgument(args), command);
61400
+ if (!objectOnly) {
61401
+ command.push(...trailingArrayArgument(args));
61402
+ }
61403
+ return command;
61404
+ }
61405
+ function trailingArrayArgument(args) {
61406
+ const hasTrailingCallback = typeof last$1(args) === "function";
61407
+ return filterType(last$1(args, hasTrailingCallback ? 1 : 0), filterArray$1, []);
61408
+ }
61409
+ function trailingOptionsArgument(args) {
61410
+ const hasTrailingCallback = filterFunction(last$1(args));
61411
+ return filterType(last$1(args, hasTrailingCallback ? 1 : 0), filterPlainObject);
61412
+ }
61413
+ function trailingFunctionArgument(args, includeNoop = true) {
61414
+ const callback = asFunction(last$1(args));
61415
+ return includeNoop || isUserFunction(callback) ? callback : void 0;
61416
+ }
61417
+ var init_task_options = __esm({
61418
+ "src/lib/utils/task-options.ts"() {
61419
+ init_argument_filters();
61420
+ init_util();
61421
+ init_pathspec();
61422
+ }
61423
+ });
61424
+
61425
+ // src/lib/utils/task-parser.ts
61426
+ function callTaskParser(parser3, streams) {
61427
+ return parser3(streams.stdOut, streams.stdErr);
61428
+ }
61429
+ function parseStringResponse(result, parsers12, texts, trim = true) {
61430
+ asArray(texts).forEach((text) => {
61431
+ for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {
61432
+ const line = (offset = 0) => {
61433
+ if (i + offset >= max) {
61434
+ return;
61435
+ }
61436
+ return lines[i + offset];
61437
+ };
61438
+ parsers12.some(({ parse }) => parse(line, result));
61439
+ }
61440
+ });
61441
+ return result;
61442
+ }
61443
+ var init_task_parser = __esm({
61444
+ "src/lib/utils/task-parser.ts"() {
61445
+ init_util();
61446
+ }
61447
+ });
61448
+
61449
+ // src/lib/utils/index.ts
61450
+ var utils_exports = {};
61451
+ __export(utils_exports, {
61452
+ ExitCodes: () => ExitCodes,
61453
+ GitOutputStreams: () => GitOutputStreams,
61454
+ LineParser: () => LineParser,
61455
+ NOOP: () => NOOP$1,
61456
+ NULL: () => NULL$1,
61457
+ RemoteLineParser: () => RemoteLineParser,
61458
+ append: () => append,
61459
+ appendTaskOptions: () => appendTaskOptions,
61460
+ asArray: () => asArray,
61461
+ asFunction: () => asFunction,
61462
+ asNumber: () => asNumber,
61463
+ asStringArray: () => asStringArray,
61464
+ bufferToString: () => bufferToString,
61465
+ callTaskParser: () => callTaskParser,
61466
+ createInstanceConfig: () => createInstanceConfig,
61467
+ delay: () => delay$3,
61468
+ filterArray: () => filterArray$1,
61469
+ filterFunction: () => filterFunction,
61470
+ filterHasLength: () => filterHasLength,
61471
+ filterPlainObject: () => filterPlainObject,
61472
+ filterPrimitives: () => filterPrimitives,
61473
+ filterString: () => filterString,
61474
+ filterStringArray: () => filterStringArray,
61475
+ filterStringOrStringArray: () => filterStringOrStringArray,
61476
+ filterType: () => filterType,
61477
+ first: () => first$1,
61478
+ folderExists: () => folderExists,
61479
+ forEachLineWithContent: () => forEachLineWithContent,
61480
+ getTrailingOptions: () => getTrailingOptions,
61481
+ including: () => including,
61482
+ isUserFunction: () => isUserFunction,
61483
+ last: () => last$1,
61484
+ objectToString: () => objectToString$7,
61485
+ orVoid: () => orVoid,
61486
+ parseStringResponse: () => parseStringResponse,
61487
+ pick: () => pick,
61488
+ prefixedArray: () => prefixedArray,
61489
+ remove: () => remove$1,
61490
+ splitOn: () => splitOn,
61491
+ toLinesWithContent: () => toLinesWithContent,
61492
+ trailingFunctionArgument: () => trailingFunctionArgument,
61493
+ trailingOptionsArgument: () => trailingOptionsArgument
61494
+ });
61495
+ var init_utils = __esm({
61496
+ "src/lib/utils/index.ts"() {
61497
+ init_argument_filters();
61498
+ init_exit_codes();
61499
+ init_git_output_streams();
61500
+ init_line_parser();
61501
+ init_simple_git_options();
61502
+ init_task_options();
61503
+ init_task_parser();
61504
+ init_util();
61505
+ }
61506
+ });
61507
+
61508
+ // src/lib/tasks/check-is-repo.ts
61509
+ var check_is_repo_exports = {};
61510
+ __export(check_is_repo_exports, {
61511
+ CheckRepoActions: () => CheckRepoActions,
61512
+ checkIsBareRepoTask: () => checkIsBareRepoTask,
61513
+ checkIsRepoRootTask: () => checkIsRepoRootTask,
61514
+ checkIsRepoTask: () => checkIsRepoTask
61515
+ });
61516
+ function checkIsRepoTask(action) {
61517
+ switch (action) {
61518
+ case "bare" /* BARE */:
61519
+ return checkIsBareRepoTask();
61520
+ case "root" /* IS_REPO_ROOT */:
61521
+ return checkIsRepoRootTask();
61522
+ }
61523
+ const commands = ["rev-parse", "--is-inside-work-tree"];
61524
+ return {
61525
+ commands,
61526
+ format: "utf-8",
61527
+ onError,
61528
+ parser: parser$1
61529
+ };
61530
+ }
61531
+ function checkIsRepoRootTask() {
61532
+ const commands = ["rev-parse", "--git-dir"];
61533
+ return {
61534
+ commands,
61535
+ format: "utf-8",
61536
+ onError,
61537
+ parser(path) {
61538
+ return /^\.(git)?$/.test(path.trim());
61539
+ }
61540
+ };
61541
+ }
61542
+ function checkIsBareRepoTask() {
61543
+ const commands = ["rev-parse", "--is-bare-repository"];
61544
+ return {
61545
+ commands,
61546
+ format: "utf-8",
61547
+ onError,
61548
+ parser: parser$1
61549
+ };
61550
+ }
61551
+ function isNotRepoMessage(error) {
61552
+ return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
61553
+ }
61554
+ var CheckRepoActions, onError, parser$1;
61555
+ var init_check_is_repo = __esm({
61556
+ "src/lib/tasks/check-is-repo.ts"() {
61557
+ init_utils();
61558
+ CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
61559
+ CheckRepoActions2["BARE"] = "bare";
61560
+ CheckRepoActions2["IN_TREE"] = "tree";
61561
+ CheckRepoActions2["IS_REPO_ROOT"] = "root";
61562
+ return CheckRepoActions2;
61563
+ })(CheckRepoActions || {});
61564
+ onError = ({ exitCode }, error, done, fail) => {
61565
+ if (exitCode === 128 /* UNCLEAN */ && isNotRepoMessage(error)) {
61566
+ return done(Buffer.from("false"));
61567
+ }
61568
+ fail(error);
61569
+ };
61570
+ parser$1 = (text) => {
61571
+ return text.trim() === "true";
61572
+ };
61573
+ }
61574
+ });
61575
+
61576
+ // src/lib/responses/CleanSummary.ts
61577
+ function cleanSummaryParser(dryRun, text) {
61578
+ const summary = new CleanResponse(dryRun);
61579
+ const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
61580
+ toLinesWithContent(text).forEach((line) => {
61581
+ const removed = line.replace(regexp, "");
61582
+ summary.paths.push(removed);
61583
+ (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
61584
+ });
61585
+ return summary;
61586
+ }
61587
+ var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;
61588
+ var init_CleanSummary = __esm({
61589
+ "src/lib/responses/CleanSummary.ts"() {
61590
+ init_utils();
61591
+ CleanResponse = class {
61592
+ constructor(dryRun) {
61593
+ this.dryRun = dryRun;
61594
+ this.paths = [];
61595
+ this.files = [];
61596
+ this.folders = [];
61597
+ }
61598
+ };
61599
+ removalRegexp = /^[a-z]+\s*/i;
61600
+ dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
61601
+ isFolderRegexp = /\/$/;
61602
+ }
61603
+ });
61604
+
61605
+ // src/lib/tasks/task.ts
61606
+ var task_exports = {};
61607
+ __export(task_exports, {
61608
+ EMPTY_COMMANDS: () => EMPTY_COMMANDS,
61609
+ adhocExecTask: () => adhocExecTask,
61610
+ configurationErrorTask: () => configurationErrorTask,
61611
+ isBufferTask: () => isBufferTask,
61612
+ isEmptyTask: () => isEmptyTask,
61613
+ straightThroughBufferTask: () => straightThroughBufferTask,
61614
+ straightThroughStringTask: () => straightThroughStringTask
61615
+ });
61616
+ function adhocExecTask(parser3) {
61617
+ return {
61618
+ commands: EMPTY_COMMANDS,
61619
+ format: "empty",
61620
+ parser: parser3
61621
+ };
61622
+ }
61623
+ function configurationErrorTask(error) {
61624
+ return {
61625
+ commands: EMPTY_COMMANDS,
61626
+ format: "empty",
61627
+ parser() {
61628
+ throw typeof error === "string" ? new TaskConfigurationError(error) : error;
61629
+ }
61630
+ };
61631
+ }
61632
+ function straightThroughStringTask(commands, trimmed2 = false) {
61633
+ return {
61634
+ commands,
61635
+ format: "utf-8",
61636
+ parser(text) {
61637
+ return trimmed2 ? String(text).trim() : text;
61638
+ }
61639
+ };
61640
+ }
61641
+ function straightThroughBufferTask(commands) {
61642
+ return {
61643
+ commands,
61644
+ format: "buffer",
61645
+ parser(buffer) {
61646
+ return buffer;
61647
+ }
61648
+ };
61649
+ }
61650
+ function isBufferTask(task) {
61651
+ return task.format === "buffer";
61652
+ }
61653
+ function isEmptyTask(task) {
61654
+ return task.format === "empty" || !task.commands.length;
61655
+ }
61656
+ var EMPTY_COMMANDS;
61657
+ var init_task = __esm({
61658
+ "src/lib/tasks/task.ts"() {
61659
+ init_task_configuration_error();
61660
+ EMPTY_COMMANDS = [];
61661
+ }
61662
+ });
61663
+
61664
+ // src/lib/tasks/clean.ts
61665
+ var clean_exports = {};
61666
+ __export(clean_exports, {
61667
+ CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
61668
+ CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
61669
+ CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
61670
+ CleanOptions: () => CleanOptions,
61671
+ cleanTask: () => cleanTask,
61672
+ cleanWithOptionsTask: () => cleanWithOptionsTask,
61673
+ isCleanOptionsArray: () => isCleanOptionsArray
61674
+ });
61675
+ function cleanWithOptionsTask(mode, customArgs) {
61676
+ const { cleanMode, options, valid } = getCleanOptions(mode);
61677
+ if (!cleanMode) {
61678
+ return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
61679
+ }
61680
+ if (!valid.options) {
61681
+ return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
61682
+ }
61683
+ options.push(...customArgs);
61684
+ if (options.some(isInteractiveMode)) {
61685
+ return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
61686
+ }
61687
+ return cleanTask(cleanMode, options);
61688
+ }
61689
+ function cleanTask(mode, customArgs) {
61690
+ const commands = ["clean", `-${mode}`, ...customArgs];
61691
+ return {
61692
+ commands,
61693
+ format: "utf-8",
61694
+ parser(text) {
61695
+ return cleanSummaryParser(mode === "n" /* DRY_RUN */, text);
61696
+ }
61697
+ };
61698
+ }
61699
+ function isCleanOptionsArray(input) {
61700
+ return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
61701
+ }
61702
+ function getCleanOptions(input) {
61703
+ let cleanMode;
61704
+ let options = [];
61705
+ let valid = { cleanMode: false, options: true };
61706
+ input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
61707
+ if (isCleanMode(char)) {
61708
+ cleanMode = char;
61709
+ valid.cleanMode = true;
61710
+ } else {
61711
+ valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
61712
+ }
61713
+ });
61714
+ return {
61715
+ cleanMode,
61716
+ options,
61717
+ valid
61718
+ };
61719
+ }
61720
+ function isCleanMode(cleanMode) {
61721
+ return cleanMode === "f" /* FORCE */ || cleanMode === "n" /* DRY_RUN */;
61722
+ }
61723
+ function isKnownOption(option) {
61724
+ return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
61725
+ }
61726
+ function isInteractiveMode(option) {
61727
+ if (/^-[^\-]/.test(option)) {
61728
+ return option.indexOf("i") > 0;
61729
+ }
61730
+ return option === "--interactive";
61731
+ }
61732
+ var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;
61733
+ var init_clean = __esm({
61734
+ "src/lib/tasks/clean.ts"() {
61735
+ init_CleanSummary();
61736
+ init_utils();
61737
+ init_task();
61738
+ CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
61739
+ CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required';
61740
+ CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
61741
+ CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
61742
+ CleanOptions2["DRY_RUN"] = "n";
61743
+ CleanOptions2["FORCE"] = "f";
61744
+ CleanOptions2["IGNORED_INCLUDED"] = "x";
61745
+ CleanOptions2["IGNORED_ONLY"] = "X";
61746
+ CleanOptions2["EXCLUDING"] = "e";
61747
+ CleanOptions2["QUIET"] = "q";
61748
+ CleanOptions2["RECURSIVE"] = "d";
61749
+ return CleanOptions2;
61750
+ })(CleanOptions || {});
61751
+ CleanOptionValues = /* @__PURE__ */ new Set([
61752
+ "i",
61753
+ ...asStringArray(Object.values(CleanOptions))
61754
+ ]);
61755
+ }
61756
+ });
61757
+
61758
+ // src/lib/responses/ConfigList.ts
61759
+ function configListParser(text) {
61760
+ const config = new ConfigList();
61761
+ for (const item of configParser(text)) {
61762
+ config.addValue(item.file, String(item.key), item.value);
61763
+ }
61764
+ return config;
61765
+ }
61766
+ function configGetParser(text, key) {
61767
+ let value = null;
61768
+ const values = [];
61769
+ const scopes = /* @__PURE__ */ new Map();
61770
+ for (const item of configParser(text, key)) {
61771
+ if (item.key !== key) {
61772
+ continue;
61773
+ }
61774
+ values.push(value = item.value);
61775
+ if (!scopes.has(item.file)) {
61776
+ scopes.set(item.file, []);
61777
+ }
61778
+ scopes.get(item.file).push(value);
61779
+ }
61780
+ return {
61781
+ key,
61782
+ paths: Array.from(scopes.keys()),
61783
+ scopes,
61784
+ value,
61785
+ values
61786
+ };
61787
+ }
61788
+ function configFilePath(filePath) {
61789
+ return filePath.replace(/^(file):/, "");
61790
+ }
61791
+ function* configParser(text, requestedKey = null) {
61792
+ const lines = text.split("\0");
61793
+ for (let i = 0, max = lines.length - 1; i < max; ) {
61794
+ const file = configFilePath(lines[i++]);
61795
+ let value = lines[i++];
61796
+ let key = requestedKey;
61797
+ if (value.includes("\n")) {
61798
+ const line = splitOn(value, "\n");
61799
+ key = line[0];
61800
+ value = line[1];
61801
+ }
61802
+ yield { file, key, value };
61803
+ }
61804
+ }
61805
+ var ConfigList;
61806
+ var init_ConfigList = __esm({
61807
+ "src/lib/responses/ConfigList.ts"() {
61808
+ init_utils();
61809
+ ConfigList = class {
61810
+ constructor() {
61811
+ this.files = [];
61812
+ this.values = /* @__PURE__ */ Object.create(null);
61813
+ }
61814
+ get all() {
61815
+ if (!this._all) {
61816
+ this._all = this.files.reduce((all, file) => {
61817
+ return Object.assign(all, this.values[file]);
61818
+ }, {});
61819
+ }
61820
+ return this._all;
61821
+ }
61822
+ addFile(file) {
61823
+ if (!(file in this.values)) {
61824
+ const latest = last$1(this.files);
61825
+ this.values[file] = latest ? Object.create(this.values[latest]) : {};
61826
+ this.files.push(file);
61827
+ }
61828
+ return this.values[file];
61829
+ }
61830
+ addValue(file, key, value) {
61831
+ const values = this.addFile(file);
61832
+ if (!values.hasOwnProperty(key)) {
61833
+ values[key] = value;
61834
+ } else if (Array.isArray(values[key])) {
61835
+ values[key].push(value);
61836
+ } else {
61837
+ values[key] = [values[key], value];
61838
+ }
61839
+ this._all = void 0;
61840
+ }
61841
+ };
61842
+ }
61843
+ });
61844
+
61845
+ // src/lib/tasks/config.ts
61846
+ function asConfigScope(scope, fallback) {
61847
+ if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) {
61848
+ return scope;
61849
+ }
61850
+ return fallback;
61851
+ }
61852
+ function addConfigTask(key, value, append2, scope) {
61853
+ const commands = ["config", `--${scope}`];
61854
+ if (append2) {
61855
+ commands.push("--add");
61856
+ }
61857
+ commands.push(key, value);
61858
+ return {
61859
+ commands,
61860
+ format: "utf-8",
61861
+ parser(text) {
61862
+ return text;
61863
+ }
61864
+ };
61865
+ }
61866
+ function getConfigTask(key, scope) {
61867
+ const commands = ["config", "--null", "--show-origin", "--get-all", key];
61868
+ if (scope) {
61869
+ commands.splice(1, 0, `--${scope}`);
61870
+ }
61871
+ return {
61872
+ commands,
61873
+ format: "utf-8",
61874
+ parser(text) {
61875
+ return configGetParser(text, key);
61876
+ }
61877
+ };
61878
+ }
61879
+ function listConfigTask(scope) {
61880
+ const commands = ["config", "--list", "--show-origin", "--null"];
61881
+ if (scope) {
61882
+ commands.push(`--${scope}`);
61883
+ }
61884
+ return {
61885
+ commands,
61886
+ format: "utf-8",
61887
+ parser(text) {
61888
+ return configListParser(text);
61889
+ }
61890
+ };
61891
+ }
61892
+ function config_default() {
61893
+ return {
61894
+ addConfig(key, value, ...rest) {
61895
+ return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local" /* local */)), trailingFunctionArgument(arguments));
61896
+ },
61897
+ getConfig(key, scope) {
61898
+ return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments));
61899
+ },
61900
+ listConfig(...rest) {
61901
+ return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments));
61902
+ }
61903
+ };
61904
+ }
61905
+ var GitConfigScope;
61906
+ var init_config = __esm({
61907
+ "src/lib/tasks/config.ts"() {
61908
+ init_ConfigList();
61909
+ init_utils();
61910
+ GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
61911
+ GitConfigScope2["system"] = "system";
61912
+ GitConfigScope2["global"] = "global";
61913
+ GitConfigScope2["local"] = "local";
61914
+ GitConfigScope2["worktree"] = "worktree";
61915
+ return GitConfigScope2;
61916
+ })(GitConfigScope || {});
61917
+ }
61918
+ });
61919
+
61920
+ // src/lib/tasks/diff-name-status.ts
61921
+ function isDiffNameStatus(input) {
61922
+ return diffNameStatus.has(input);
61923
+ }
61924
+ var DiffNameStatus, diffNameStatus;
61925
+ var init_diff_name_status = __esm({
61926
+ "src/lib/tasks/diff-name-status.ts"() {
61927
+ DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
61928
+ DiffNameStatus2["ADDED"] = "A";
61929
+ DiffNameStatus2["COPIED"] = "C";
61930
+ DiffNameStatus2["DELETED"] = "D";
61931
+ DiffNameStatus2["MODIFIED"] = "M";
61932
+ DiffNameStatus2["RENAMED"] = "R";
61933
+ DiffNameStatus2["CHANGED"] = "T";
61934
+ DiffNameStatus2["UNMERGED"] = "U";
61935
+ DiffNameStatus2["UNKNOWN"] = "X";
61936
+ DiffNameStatus2["BROKEN"] = "B";
61937
+ return DiffNameStatus2;
61938
+ })(DiffNameStatus || {});
61939
+ diffNameStatus = new Set(Object.values(DiffNameStatus));
61940
+ }
61941
+ });
61942
+
61943
+ // src/lib/tasks/grep.ts
61944
+ function grepQueryBuilder(...params) {
61945
+ return new GrepQuery().param(...params);
61946
+ }
61947
+ function parseGrep(grep) {
61948
+ const paths = /* @__PURE__ */ new Set();
61949
+ const results = {};
61950
+ forEachLineWithContent(grep, (input) => {
61951
+ const [path, line, preview] = input.split(NULL$1);
61952
+ paths.add(path);
61953
+ (results[path] = results[path] || []).push({
61954
+ line: asNumber(line),
61955
+ path,
61956
+ preview
61957
+ });
61958
+ });
61959
+ return {
61960
+ paths,
61961
+ results
61962
+ };
61963
+ }
61964
+ function grep_default() {
61965
+ return {
61966
+ grep(searchTerm) {
61967
+ const then = trailingFunctionArgument(arguments);
61968
+ const options = getTrailingOptions(arguments);
61969
+ for (const option of disallowedOptions) {
61970
+ if (options.includes(option)) {
61971
+ return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then);
61972
+ }
61973
+ }
61974
+ if (typeof searchTerm === "string") {
61975
+ searchTerm = grepQueryBuilder().param(searchTerm);
61976
+ }
61977
+ const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm];
61978
+ return this._runTask({
61979
+ commands,
61980
+ format: "utf-8",
61981
+ parser(stdOut) {
61982
+ return parseGrep(stdOut);
61983
+ }
61984
+ }, then);
61985
+ }
61986
+ };
61987
+ }
61988
+ var disallowedOptions, Query$6, _a$a, GrepQuery;
61989
+ var init_grep = __esm({
61990
+ "src/lib/tasks/grep.ts"() {
61991
+ init_utils();
61992
+ init_task();
61993
+ disallowedOptions = ["-h"];
61994
+ Query$6 = Symbol("grepQuery");
61995
+ GrepQuery = class {
61996
+ constructor() {
61997
+ this[_a$a] = [];
61998
+ }
61999
+ *[(_a$a = Query$6, Symbol.iterator)]() {
62000
+ for (const query of this[Query$6]) {
62001
+ yield query;
62002
+ }
62003
+ }
62004
+ and(...and) {
62005
+ and.length && this[Query$6].push("--and", "(", ...prefixedArray(and, "-e"), ")");
62006
+ return this;
62007
+ }
62008
+ param(...param) {
62009
+ this[Query$6].push(...prefixedArray(param, "-e"));
62010
+ return this;
62011
+ }
62012
+ };
62013
+ }
62014
+ });
62015
+
62016
+ // src/lib/tasks/reset.ts
62017
+ var reset_exports = {};
62018
+ __export(reset_exports, {
62019
+ ResetMode: () => ResetMode,
62020
+ getResetMode: () => getResetMode,
62021
+ resetTask: () => resetTask
62022
+ });
62023
+ function resetTask(mode, customArgs) {
62024
+ const commands = ["reset"];
62025
+ if (isValidResetMode(mode)) {
62026
+ commands.push(`--${mode}`);
62027
+ }
62028
+ commands.push(...customArgs);
62029
+ return straightThroughStringTask(commands);
62030
+ }
62031
+ function getResetMode(mode) {
62032
+ if (isValidResetMode(mode)) {
62033
+ return mode;
62034
+ }
62035
+ switch (typeof mode) {
62036
+ case "string":
62037
+ case "undefined":
62038
+ return "soft" /* SOFT */;
62039
+ }
62040
+ return;
62041
+ }
62042
+ function isValidResetMode(mode) {
62043
+ return ResetModes.includes(mode);
62044
+ }
62045
+ var ResetMode, ResetModes;
62046
+ var init_reset = __esm({
62047
+ "src/lib/tasks/reset.ts"() {
62048
+ init_task();
62049
+ ResetMode = /* @__PURE__ */ ((ResetMode2) => {
62050
+ ResetMode2["MIXED"] = "mixed";
62051
+ ResetMode2["SOFT"] = "soft";
62052
+ ResetMode2["HARD"] = "hard";
62053
+ ResetMode2["MERGE"] = "merge";
62054
+ ResetMode2["KEEP"] = "keep";
62055
+ return ResetMode2;
62056
+ })(ResetMode || {});
62057
+ ResetModes = Array.from(Object.values(ResetMode));
62058
+ }
62059
+ });
62060
+ function createLog() {
62061
+ return debug$j("simple-git");
62062
+ }
62063
+ function prefixedLogger(to, prefix, forward) {
62064
+ if (!prefix || !String(prefix).replace(/\s*/, "")) {
62065
+ return !forward ? to : (message, ...args) => {
62066
+ to(message, ...args);
62067
+ forward(message, ...args);
62068
+ };
62069
+ }
62070
+ return (message, ...args) => {
62071
+ to(`%s ${message}`, prefix, ...args);
62072
+ if (forward) {
62073
+ forward(message, ...args);
62074
+ }
62075
+ };
62076
+ }
62077
+ function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
62078
+ if (typeof name === "string") {
62079
+ return name;
62080
+ }
62081
+ const childNamespace = childDebugger && childDebugger.namespace || "";
62082
+ if (childNamespace.startsWith(parentNamespace)) {
62083
+ return childNamespace.substr(parentNamespace.length + 1);
62084
+ }
62085
+ return childNamespace || parentNamespace;
62086
+ }
62087
+ function createLogger$1(label, verbose, initialStep, infoDebugger = createLog()) {
62088
+ const labelPrefix = label && `[${label}]` || "";
62089
+ const spawned = [];
62090
+ const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
62091
+ const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
62092
+ return step(initialStep);
62093
+ function sibling(name, initial) {
62094
+ return append(spawned, createLogger$1(label, key.replace(/^[^:]+/, name), initial, infoDebugger));
62095
+ }
62096
+ function step(phase) {
62097
+ const stepPrefix = phase && `[${phase}]` || "";
62098
+ const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP$1;
62099
+ const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
62100
+ return Object.assign(debugDebugger ? debug2 : info, {
62101
+ label,
62102
+ sibling,
62103
+ info,
62104
+ step
62105
+ });
62106
+ }
62107
+ }
62108
+ var init_git_logger = __esm({
62109
+ "src/lib/git-logger.ts"() {
62110
+ init_utils();
62111
+ debug$j.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
62112
+ debug$j.formatters.B = (value) => {
62113
+ if (Buffer.isBuffer(value)) {
62114
+ return value.toString("utf8");
62115
+ }
62116
+ return objectToString$7(value);
62117
+ };
62118
+ }
62119
+ });
62120
+
62121
+ // src/lib/runners/tasks-pending-queue.ts
62122
+ var _TasksPendingQueue, TasksPendingQueue;
62123
+ var init_tasks_pending_queue = __esm({
62124
+ "src/lib/runners/tasks-pending-queue.ts"() {
62125
+ init_git_error();
62126
+ init_git_logger();
62127
+ _TasksPendingQueue = class {
62128
+ constructor(logLabel = "GitExecutor") {
62129
+ this.logLabel = logLabel;
62130
+ this._queue = /* @__PURE__ */ new Map();
62131
+ }
62132
+ withProgress(task) {
62133
+ return this._queue.get(task);
62134
+ }
62135
+ createProgress(task) {
62136
+ const name = _TasksPendingQueue.getName(task.commands[0]);
62137
+ const logger = createLogger$1(this.logLabel, name);
62138
+ return {
62139
+ task,
62140
+ logger,
62141
+ name
62142
+ };
62143
+ }
62144
+ push(task) {
62145
+ const progress = this.createProgress(task);
62146
+ progress.logger("Adding task to the queue, commands = %o", task.commands);
62147
+ this._queue.set(task, progress);
62148
+ return progress;
62149
+ }
62150
+ fatal(err) {
62151
+ for (const [task, { logger }] of Array.from(this._queue.entries())) {
62152
+ if (task === err.task) {
62153
+ logger.info(`Failed %o`, err);
62154
+ logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);
62155
+ } else {
62156
+ logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);
62157
+ }
62158
+ this.complete(task);
62159
+ }
62160
+ if (this._queue.size !== 0) {
62161
+ throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
62162
+ }
62163
+ }
62164
+ complete(task) {
62165
+ const progress = this.withProgress(task);
62166
+ if (progress) {
62167
+ this._queue.delete(task);
62168
+ }
62169
+ }
62170
+ attempt(task) {
62171
+ const progress = this.withProgress(task);
62172
+ if (!progress) {
62173
+ throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task");
62174
+ }
62175
+ progress.logger("Starting task");
62176
+ return progress;
62177
+ }
62178
+ static getName(name = "empty") {
62179
+ return `task:${name}:${++_TasksPendingQueue.counter}`;
62180
+ }
62181
+ };
62182
+ TasksPendingQueue = _TasksPendingQueue;
62183
+ TasksPendingQueue.counter = 0;
62184
+ }
62185
+ });
62186
+ function pluginContext$1(task, commands) {
62187
+ return {
62188
+ method: first$1(task.commands) || "",
62189
+ commands
62190
+ };
62191
+ }
62192
+ function onErrorReceived(target, logger) {
62193
+ return (err) => {
62194
+ logger(`[ERROR] child process exception %o`, err);
62195
+ target.push(Buffer.from(String(err.stack), "ascii"));
62196
+ };
62197
+ }
62198
+ function onDataReceived(target, name, logger, output) {
62199
+ return (buffer) => {
62200
+ logger(`%s received %L bytes`, name, buffer);
62201
+ output(`%B`, buffer);
62202
+ target.push(buffer);
62203
+ };
62204
+ }
62205
+ var GitExecutorChain;
62206
+ var init_git_executor_chain = __esm({
62207
+ "src/lib/runners/git-executor-chain.ts"() {
62208
+ init_git_error();
62209
+ init_task();
62210
+ init_utils();
62211
+ init_tasks_pending_queue();
62212
+ GitExecutorChain = class {
62213
+ constructor(_executor, _scheduler, _plugins) {
62214
+ this._executor = _executor;
62215
+ this._scheduler = _scheduler;
62216
+ this._plugins = _plugins;
62217
+ this._chain = Promise.resolve();
62218
+ this._queue = new TasksPendingQueue();
62219
+ }
62220
+ get binary() {
62221
+ return this._executor.binary;
62222
+ }
62223
+ get cwd() {
62224
+ return this._cwd || this._executor.cwd;
62225
+ }
62226
+ set cwd(cwd) {
62227
+ this._cwd = cwd;
62228
+ }
62229
+ get env() {
62230
+ return this._executor.env;
62231
+ }
62232
+ get outputHandler() {
62233
+ return this._executor.outputHandler;
62234
+ }
62235
+ chain() {
62236
+ return this;
62237
+ }
62238
+ push(task) {
62239
+ this._queue.push(task);
62240
+ return this._chain = this._chain.then(() => this.attemptTask(task));
62241
+ }
62242
+ attemptTask(task) {
62243
+ return __async(this, null, function* () {
62244
+ const onScheduleComplete = yield this._scheduler.next();
62245
+ const onQueueComplete = () => this._queue.complete(task);
62246
+ try {
62247
+ const { logger } = this._queue.attempt(task);
62248
+ return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger);
62249
+ } catch (e) {
62250
+ throw this.onFatalException(task, e);
62251
+ } finally {
62252
+ onQueueComplete();
62253
+ onScheduleComplete();
62254
+ }
62255
+ });
62256
+ }
62257
+ onFatalException(task, e) {
62258
+ const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
62259
+ this._chain = Promise.resolve();
62260
+ this._queue.fatal(gitError);
62261
+ return gitError;
62262
+ }
62263
+ attemptRemoteTask(task, logger) {
62264
+ return __async(this, null, function* () {
62265
+ const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext$1(task, task.commands));
62266
+ const raw = yield this.gitResponse(task, this.binary, args, this.outputHandler, logger.step("SPAWN"));
62267
+ const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE"));
62268
+ logger(`passing response to task's parser as a %s`, task.format);
62269
+ if (isBufferTask(task)) {
62270
+ return callTaskParser(task.parser, outputStreams);
62271
+ }
62272
+ return callTaskParser(task.parser, outputStreams.asStrings());
62273
+ });
62274
+ }
62275
+ attemptEmptyTask(task, logger) {
62276
+ return __async(this, null, function* () {
62277
+ logger(`empty task bypassing child process to call to task's parser`);
62278
+ return task.parser(this);
62279
+ });
62280
+ }
62281
+ handleTaskData(task, args, result, logger) {
62282
+ const { exitCode, rejection, stdOut, stdErr } = result;
62283
+ return new Promise((done, fail) => {
62284
+ logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
62285
+ const { error } = this._plugins.exec("task.error", { error: rejection }, __spreadValues(__spreadValues({}, pluginContext$1(task, args)), result));
62286
+ if (error && task.onError) {
62287
+ logger.info(`exitCode=%s handling with custom error handler`);
62288
+ return task.onError(result, error, (newStdOut) => {
62289
+ logger.info(`custom error handler treated as success`);
62290
+ logger(`custom error returned a %s`, objectToString$7(newStdOut));
62291
+ done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr)));
62292
+ }, fail);
62293
+ }
62294
+ if (error) {
62295
+ logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection);
62296
+ return fail(error);
62297
+ }
62298
+ logger.info(`retrieving task output complete`);
62299
+ done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
62300
+ });
62301
+ }
62302
+ gitResponse(task, command, args, outputHandler, logger) {
62303
+ return __async(this, null, function* () {
62304
+ const outputLogger = logger.sibling("output");
62305
+ const spawnOptions = this._plugins.exec("spawn.options", {
62306
+ cwd: this.cwd,
62307
+ env: this.env,
62308
+ windowsHide: true
62309
+ }, pluginContext$1(task, task.commands));
62310
+ return new Promise((done) => {
62311
+ const stdOut = [];
62312
+ const stdErr = [];
62313
+ logger.info(`%s %o`, command, args);
62314
+ logger("%O", spawnOptions);
62315
+ let rejection = this._beforeSpawn(task, args);
62316
+ if (rejection) {
62317
+ return done({
62318
+ stdOut,
62319
+ stdErr,
62320
+ exitCode: 9901,
62321
+ rejection
62322
+ });
62323
+ }
62324
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext$1(task, args)), {
62325
+ kill(reason) {
62326
+ rejection = reason || rejection;
62327
+ }
62328
+ }));
62329
+ const spawned = child_process.spawn(command, args, spawnOptions);
62330
+ spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
62331
+ spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
62332
+ spawned.on("error", onErrorReceived(stdErr, logger));
62333
+ if (outputHandler) {
62334
+ logger(`Passing child process stdOut/stdErr to custom outputHandler`);
62335
+ outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
62336
+ }
62337
+ this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext$1(task, args)), {
62338
+ spawned,
62339
+ close(exitCode, reason) {
62340
+ done({
62341
+ stdOut,
62342
+ stdErr,
62343
+ exitCode,
62344
+ rejection: rejection || reason
62345
+ });
62346
+ },
62347
+ kill(reason) {
62348
+ if (spawned.killed) {
62349
+ return;
62350
+ }
62351
+ rejection = reason;
62352
+ spawned.kill("SIGINT");
62353
+ }
62354
+ }));
62355
+ });
62356
+ });
62357
+ }
62358
+ _beforeSpawn(task, args) {
62359
+ let rejection;
62360
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext$1(task, args)), {
62361
+ kill(reason) {
62362
+ rejection = reason || rejection;
62363
+ }
62364
+ }));
62365
+ return rejection;
62366
+ }
62367
+ };
62368
+ }
62369
+ });
62370
+
62371
+ // src/lib/runners/git-executor.ts
62372
+ var git_executor_exports = {};
62373
+ __export(git_executor_exports, {
62374
+ GitExecutor: () => GitExecutor
62375
+ });
62376
+ var GitExecutor;
62377
+ var init_git_executor = __esm({
62378
+ "src/lib/runners/git-executor.ts"() {
62379
+ init_git_executor_chain();
62380
+ GitExecutor = class {
62381
+ constructor(binary = "git", cwd, _scheduler, _plugins) {
62382
+ this.binary = binary;
62383
+ this.cwd = cwd;
62384
+ this._scheduler = _scheduler;
62385
+ this._plugins = _plugins;
62386
+ this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
62387
+ }
62388
+ chain() {
62389
+ return new GitExecutorChain(this, this._scheduler, this._plugins);
62390
+ }
62391
+ push(task) {
62392
+ return this._chain.push(task);
62393
+ }
62394
+ };
62395
+ }
62396
+ });
62397
+
62398
+ // src/lib/task-callback.ts
62399
+ function taskCallback(task, response, callback = NOOP$1) {
62400
+ const onSuccess = (data) => {
62401
+ callback(null, data);
62402
+ };
62403
+ const onError2 = (err) => {
62404
+ if ((err == null ? void 0 : err.task) === task) {
62405
+ callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0);
62406
+ }
62407
+ };
62408
+ response.then(onSuccess, onError2);
62409
+ }
62410
+ function addDeprecationNoticeToError(err) {
62411
+ let log = (name) => {
62412
+ console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);
62413
+ log = NOOP$1;
62414
+ };
62415
+ return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
62416
+ function descriptorReducer(all, name) {
62417
+ if (name in err) {
62418
+ return all;
62419
+ }
62420
+ all[name] = {
62421
+ enumerable: false,
62422
+ configurable: false,
62423
+ get() {
62424
+ log(name);
62425
+ return err.git[name];
62426
+ }
62427
+ };
62428
+ return all;
62429
+ }
62430
+ }
62431
+ var init_task_callback = __esm({
62432
+ "src/lib/task-callback.ts"() {
62433
+ init_git_response_error();
62434
+ init_utils();
62435
+ }
62436
+ });
62437
+
62438
+ // src/lib/tasks/change-working-directory.ts
62439
+ function changeWorkingDirectoryTask(directory, root) {
62440
+ return adhocExecTask((instance) => {
62441
+ if (!folderExists(directory)) {
62442
+ throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
62443
+ }
62444
+ return (root || instance).cwd = directory;
62445
+ });
62446
+ }
62447
+ var init_change_working_directory = __esm({
62448
+ "src/lib/tasks/change-working-directory.ts"() {
62449
+ init_utils();
62450
+ init_task();
62451
+ }
62452
+ });
62453
+
62454
+ // src/lib/tasks/checkout.ts
62455
+ function checkoutTask(args) {
62456
+ const commands = ["checkout", ...args];
62457
+ if (commands[1] === "-b" && commands.includes("-B")) {
62458
+ commands[1] = remove$1(commands, "-B");
62459
+ }
62460
+ return straightThroughStringTask(commands);
62461
+ }
62462
+ function checkout_default() {
62463
+ return {
62464
+ checkout() {
62465
+ return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments));
62466
+ },
62467
+ checkoutBranch(branchName, startPoint) {
62468
+ return this._runTask(checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
62469
+ },
62470
+ checkoutLocalBranch(branchName) {
62471
+ return this._runTask(checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
62472
+ }
62473
+ };
62474
+ }
62475
+ var init_checkout = __esm({
62476
+ "src/lib/tasks/checkout.ts"() {
62477
+ init_utils();
62478
+ init_task();
62479
+ }
62480
+ });
62481
+
62482
+ // src/lib/parsers/parse-commit.ts
62483
+ function parseCommitResult(stdOut) {
62484
+ const result = {
62485
+ author: null,
62486
+ branch: "",
62487
+ commit: "",
62488
+ root: false,
62489
+ summary: {
62490
+ changes: 0,
62491
+ insertions: 0,
62492
+ deletions: 0
62493
+ }
62494
+ };
62495
+ return parseStringResponse(result, parsers, stdOut);
62496
+ }
62497
+ var parsers;
62498
+ var init_parse_commit = __esm({
62499
+ "src/lib/parsers/parse-commit.ts"() {
62500
+ init_utils();
62501
+ parsers = [
62502
+ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
62503
+ result.branch = branch;
62504
+ result.commit = commit;
62505
+ result.root = !!root;
62506
+ }),
62507
+ new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
62508
+ const parts = author.split("<");
62509
+ const email = parts.pop();
62510
+ if (!email || !email.includes("@")) {
62511
+ return;
62512
+ }
62513
+ result.author = {
62514
+ email: email.substr(0, email.length - 1),
62515
+ name: parts.join("<").trim()
62516
+ };
62517
+ }),
62518
+ new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
62519
+ result.summary.changes = parseInt(changes, 10) || 0;
62520
+ result.summary.insertions = parseInt(insertions, 10) || 0;
62521
+ result.summary.deletions = parseInt(deletions, 10) || 0;
62522
+ }),
62523
+ new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
62524
+ result.summary.changes = parseInt(changes, 10) || 0;
62525
+ const count = parseInt(lines, 10) || 0;
62526
+ if (direction === "-") {
62527
+ result.summary.deletions = count;
62528
+ } else if (direction === "+") {
62529
+ result.summary.insertions = count;
62530
+ }
62531
+ })
62532
+ ];
62533
+ }
62534
+ });
62535
+
62536
+ // src/lib/tasks/commit.ts
62537
+ function commitTask(message, files, customArgs) {
62538
+ const commands = [
62539
+ "-c",
62540
+ "core.abbrev=40",
62541
+ "commit",
62542
+ ...prefixedArray(message, "-m"),
62543
+ ...files,
62544
+ ...customArgs
62545
+ ];
62546
+ return {
62547
+ commands,
62548
+ format: "utf-8",
62549
+ parser: parseCommitResult
62550
+ };
62551
+ }
62552
+ function commit_default() {
62553
+ return {
62554
+ commit(message, ...rest) {
62555
+ const next = trailingFunctionArgument(arguments);
62556
+ const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...filterType(rest[1], filterArray$1, []), ...getTrailingOptions(arguments, 0, true)]);
62557
+ return this._runTask(task, next);
62558
+ }
62559
+ };
62560
+ function rejectDeprecatedSignatures(message) {
62561
+ return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`);
62562
+ }
62563
+ }
62564
+ var init_commit = __esm({
62565
+ "src/lib/tasks/commit.ts"() {
62566
+ init_parse_commit();
62567
+ init_utils();
62568
+ init_task();
62569
+ }
62570
+ });
62571
+
62572
+ // src/lib/tasks/first-commit.ts
62573
+ function first_commit_default() {
62574
+ return {
62575
+ firstCommit() {
62576
+ return this._runTask(straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true), trailingFunctionArgument(arguments));
62577
+ }
62578
+ };
62579
+ }
62580
+ var init_first_commit = __esm({
62581
+ "src/lib/tasks/first-commit.ts"() {
62582
+ init_utils();
62583
+ init_task();
62584
+ }
62585
+ });
62586
+
62587
+ // src/lib/tasks/hash-object.ts
62588
+ function hashObjectTask(filePath, write) {
62589
+ const commands = ["hash-object", filePath];
62590
+ if (write) {
62591
+ commands.push("-w");
62592
+ }
62593
+ return straightThroughStringTask(commands, true);
62594
+ }
62595
+ var init_hash_object = __esm({
62596
+ "src/lib/tasks/hash-object.ts"() {
62597
+ init_task();
62598
+ }
62599
+ });
62600
+
62601
+ // src/lib/responses/InitSummary.ts
62602
+ function parseInit(bare, path, text) {
62603
+ const response = String(text).trim();
62604
+ let result;
62605
+ if (result = initResponseRegex.exec(response)) {
62606
+ return new InitSummary(bare, path, false, result[1]);
62607
+ }
62608
+ if (result = reInitResponseRegex.exec(response)) {
62609
+ return new InitSummary(bare, path, true, result[1]);
62610
+ }
62611
+ let gitDir = "";
62612
+ const tokens = response.split(" ");
62613
+ while (tokens.length) {
62614
+ const token = tokens.shift();
62615
+ if (token === "in") {
62616
+ gitDir = tokens.join(" ");
62617
+ break;
62618
+ }
62619
+ }
62620
+ return new InitSummary(bare, path, /^re/i.test(response), gitDir);
62621
+ }
62622
+ var InitSummary, initResponseRegex, reInitResponseRegex;
62623
+ var init_InitSummary = __esm({
62624
+ "src/lib/responses/InitSummary.ts"() {
62625
+ InitSummary = class {
62626
+ constructor(bare, path, existing, gitDir) {
62627
+ this.bare = bare;
62628
+ this.path = path;
62629
+ this.existing = existing;
62630
+ this.gitDir = gitDir;
62631
+ }
62632
+ };
62633
+ initResponseRegex = /^Init.+ repository in (.+)$/;
62634
+ reInitResponseRegex = /^Rein.+ in (.+)$/;
62635
+ }
62636
+ });
62637
+
62638
+ // src/lib/tasks/init.ts
62639
+ function hasBareCommand(command) {
62640
+ return command.includes(bareCommand);
62641
+ }
62642
+ function initTask(bare = false, path, customArgs) {
62643
+ const commands = ["init", ...customArgs];
62644
+ if (bare && !hasBareCommand(commands)) {
62645
+ commands.splice(1, 0, bareCommand);
62646
+ }
62647
+ return {
62648
+ commands,
62649
+ format: "utf-8",
62650
+ parser(text) {
62651
+ return parseInit(commands.includes("--bare"), path, text);
62652
+ }
62653
+ };
62654
+ }
62655
+ var bareCommand;
62656
+ var init_init = __esm({
62657
+ "src/lib/tasks/init.ts"() {
62658
+ init_InitSummary();
62659
+ bareCommand = "--bare";
62660
+ }
62661
+ });
62662
+
62663
+ // src/lib/args/log-format.ts
62664
+ function logFormatFromCommand(customArgs) {
62665
+ for (let i = 0; i < customArgs.length; i++) {
62666
+ const format = logFormatRegex.exec(customArgs[i]);
62667
+ if (format) {
62668
+ return `--${format[1]}`;
62669
+ }
62670
+ }
62671
+ return "" /* NONE */;
62672
+ }
62673
+ function isLogFormat(customArg) {
62674
+ return logFormatRegex.test(customArg);
62675
+ }
62676
+ var logFormatRegex;
62677
+ var init_log_format = __esm({
62678
+ "src/lib/args/log-format.ts"() {
62679
+ logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
62680
+ }
62681
+ });
62682
+
62683
+ // src/lib/responses/DiffSummary.ts
62684
+ var DiffSummary;
62685
+ var init_DiffSummary = __esm({
62686
+ "src/lib/responses/DiffSummary.ts"() {
62687
+ DiffSummary = class {
62688
+ constructor() {
62689
+ this.changed = 0;
62690
+ this.deletions = 0;
62691
+ this.insertions = 0;
62692
+ this.files = [];
62693
+ }
62694
+ };
62695
+ }
62696
+ });
62697
+
62698
+ // src/lib/parsers/parse-diff-summary.ts
62699
+ function getDiffParser(format = "" /* NONE */) {
62700
+ const parser3 = diffSummaryParsers[format];
62701
+ return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false);
62702
+ }
62703
+ var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;
62704
+ var init_parse_diff_summary = __esm({
62705
+ "src/lib/parsers/parse-diff-summary.ts"() {
62706
+ init_log_format();
62707
+ init_DiffSummary();
62708
+ init_diff_name_status();
62709
+ init_utils();
62710
+ statParser = [
62711
+ new LineParser(/(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => {
62712
+ result.files.push({
62713
+ file: file.trim(),
62714
+ changes: asNumber(changes),
62715
+ insertions: alterations.replace(/[^+]/g, "").length,
62716
+ deletions: alterations.replace(/[^-]/g, "").length,
62717
+ binary: false
62718
+ });
62719
+ }),
62720
+ new LineParser(/(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => {
62721
+ result.files.push({
62722
+ file: file.trim(),
62723
+ before: asNumber(before),
62724
+ after: asNumber(after),
62725
+ binary: true
62726
+ });
62727
+ }),
62728
+ new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => {
62729
+ const inserted = /(\d+) i/.exec(summary);
62730
+ const deleted = /(\d+) d/.exec(summary);
62731
+ result.changed = asNumber(changed);
62732
+ result.insertions = asNumber(inserted == null ? void 0 : inserted[1]);
62733
+ result.deletions = asNumber(deleted == null ? void 0 : deleted[1]);
62734
+ })
62735
+ ];
62736
+ numStatParser = [
62737
+ new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => {
62738
+ const insertions = asNumber(changesInsert);
62739
+ const deletions = asNumber(changesDelete);
62740
+ result.changed++;
62741
+ result.insertions += insertions;
62742
+ result.deletions += deletions;
62743
+ result.files.push({
62744
+ file,
62745
+ changes: insertions + deletions,
62746
+ insertions,
62747
+ deletions,
62748
+ binary: false
62749
+ });
62750
+ }),
62751
+ new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
62752
+ result.changed++;
62753
+ result.files.push({
62754
+ file,
62755
+ after: 0,
62756
+ before: 0,
62757
+ binary: true
62758
+ });
62759
+ })
62760
+ ];
62761
+ nameOnlyParser = [
62762
+ new LineParser(/(.+)$/, (result, [file]) => {
62763
+ result.changed++;
62764
+ result.files.push({
62765
+ file,
62766
+ changes: 0,
62767
+ insertions: 0,
62768
+ deletions: 0,
62769
+ binary: false
62770
+ });
62771
+ })
62772
+ ];
62773
+ nameStatusParser = [
62774
+ new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, _similarity, from, _to, to]) => {
62775
+ result.changed++;
62776
+ result.files.push({
62777
+ file: to != null ? to : from,
62778
+ changes: 0,
62779
+ status: orVoid(isDiffNameStatus(status) && status),
62780
+ insertions: 0,
62781
+ deletions: 0,
62782
+ binary: false
62783
+ });
62784
+ })
62785
+ ];
62786
+ diffSummaryParsers = {
62787
+ ["" /* NONE */]: statParser,
62788
+ ["--stat" /* STAT */]: statParser,
62789
+ ["--numstat" /* NUM_STAT */]: numStatParser,
62790
+ ["--name-status" /* NAME_STATUS */]: nameStatusParser,
62791
+ ["--name-only" /* NAME_ONLY */]: nameOnlyParser
62792
+ };
62793
+ }
62794
+ });
62795
+
62796
+ // src/lib/parsers/parse-list-log-summary.ts
62797
+ function lineBuilder(tokens, fields) {
62798
+ return fields.reduce((line, field, index) => {
62799
+ line[field] = tokens[index] || "";
62800
+ return line;
62801
+ }, /* @__PURE__ */ Object.create({ diff: null }));
62802
+ }
62803
+ function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "" /* NONE */) {
62804
+ const parseDiffResult = getDiffParser(logFormat);
62805
+ return function(stdOut) {
62806
+ const all = toLinesWithContent(stdOut, true, START_BOUNDARY).map(function(item) {
62807
+ const lineDetail = item.trim().split(COMMIT_BOUNDARY);
62808
+ const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields);
62809
+ if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
62810
+ listLogLine.diff = parseDiffResult(lineDetail[1]);
62811
+ }
62812
+ return listLogLine;
62813
+ });
62814
+ return {
62815
+ all,
62816
+ latest: all.length && all[0] || null,
62817
+ total: all.length
62818
+ };
62819
+ };
62820
+ }
62821
+ var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;
62822
+ var init_parse_list_log_summary = __esm({
62823
+ "src/lib/parsers/parse-list-log-summary.ts"() {
62824
+ init_utils();
62825
+ init_parse_diff_summary();
62826
+ init_log_format();
62827
+ START_BOUNDARY = "\xF2\xF2\xF2\xF2\xF2\xF2 ";
62828
+ COMMIT_BOUNDARY = " \xF2\xF2";
62829
+ SPLITTER = " \xF2 ";
62830
+ defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"];
62831
+ }
62832
+ });
62833
+
62834
+ // src/lib/tasks/diff.ts
62835
+ var diff_exports = {};
62836
+ __export(diff_exports, {
62837
+ diffSummaryTask: () => diffSummaryTask,
62838
+ validateLogFormatConfig: () => validateLogFormatConfig
62839
+ });
62840
+ function diffSummaryTask(customArgs) {
62841
+ let logFormat = logFormatFromCommand(customArgs);
62842
+ const commands = ["diff"];
62843
+ if (logFormat === "" /* NONE */) {
62844
+ logFormat = "--stat" /* STAT */;
62845
+ commands.push("--stat=4096");
62846
+ }
62847
+ commands.push(...customArgs);
62848
+ return validateLogFormatConfig(commands) || {
62849
+ commands,
62850
+ format: "utf-8",
62851
+ parser: getDiffParser(logFormat)
62852
+ };
62853
+ }
62854
+ function validateLogFormatConfig(customArgs) {
62855
+ const flags = customArgs.filter(isLogFormat);
62856
+ if (flags.length > 1) {
62857
+ return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`);
62858
+ }
62859
+ if (flags.length && customArgs.includes("-z")) {
62860
+ return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`);
62861
+ }
62862
+ }
62863
+ var init_diff = __esm({
62864
+ "src/lib/tasks/diff.ts"() {
62865
+ init_log_format();
62866
+ init_parse_diff_summary();
62867
+ init_task();
62868
+ }
62869
+ });
62870
+
62871
+ // src/lib/tasks/log.ts
62872
+ function prettyFormat(format, splitter) {
62873
+ const fields = [];
62874
+ const formatStr = [];
62875
+ Object.keys(format).forEach((field) => {
62876
+ fields.push(field);
62877
+ formatStr.push(String(format[field]));
62878
+ });
62879
+ return [fields, formatStr.join(splitter)];
62880
+ }
62881
+ function userOptions(input) {
62882
+ return Object.keys(input).reduce((out, key) => {
62883
+ if (!(key in excludeOptions)) {
62884
+ out[key] = input[key];
62885
+ }
62886
+ return out;
62887
+ }, {});
62888
+ }
62889
+ function parseLogOptions(opt = {}, customArgs = []) {
62890
+ const splitter = filterType(opt.splitter, filterString, SPLITTER);
62891
+ const format = !filterPrimitives(opt.format) && opt.format ? opt.format : {
62892
+ hash: "%H",
62893
+ date: opt.strictDate === false ? "%ai" : "%aI",
62894
+ message: "%s",
62895
+ refs: "%D",
62896
+ body: opt.multiLine ? "%B" : "%b",
62897
+ author_name: opt.mailMap !== false ? "%aN" : "%an",
62898
+ author_email: opt.mailMap !== false ? "%aE" : "%ae"
62899
+ };
62900
+ const [fields, formatStr] = prettyFormat(format, splitter);
62901
+ const suffix = [];
62902
+ const command = [
62903
+ `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,
62904
+ ...customArgs
62905
+ ];
62906
+ const maxCount = opt.n || opt["max-count"] || opt.maxCount;
62907
+ if (maxCount) {
62908
+ command.push(`--max-count=${maxCount}`);
62909
+ }
62910
+ if (opt.from || opt.to) {
62911
+ const rangeOperator = opt.symmetric !== false ? "..." : "..";
62912
+ suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
62913
+ }
62914
+ if (filterString(opt.file)) {
62915
+ command.push("--follow", pathspec(opt.file));
62916
+ }
62917
+ appendTaskOptions(userOptions(opt), command);
62918
+ return {
62919
+ fields,
62920
+ splitter,
62921
+ commands: [...command, ...suffix]
62922
+ };
62923
+ }
62924
+ function logTask(splitter, fields, customArgs) {
62925
+ const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
62926
+ return {
62927
+ commands: ["log", ...customArgs],
62928
+ format: "utf-8",
62929
+ parser: parser3
62930
+ };
62931
+ }
62932
+ function log_default() {
62933
+ return {
62934
+ log(...rest) {
62935
+ const next = trailingFunctionArgument(arguments);
62936
+ const options = parseLogOptions(trailingOptionsArgument(arguments), filterType(arguments[0], filterArray$1));
62937
+ const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
62938
+ return this._runTask(task, next);
62939
+ }
62940
+ };
62941
+ function createLogTask(options) {
62942
+ return logTask(options.splitter, options.fields, options.commands);
62943
+ }
62944
+ function rejectDeprecatedSignatures(from, to) {
62945
+ return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`);
62946
+ }
62947
+ }
62948
+ var excludeOptions;
62949
+ var init_log = __esm({
62950
+ "src/lib/tasks/log.ts"() {
62951
+ init_log_format();
62952
+ init_pathspec();
62953
+ init_parse_list_log_summary();
62954
+ init_utils();
62955
+ init_task();
62956
+ init_diff();
62957
+ excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
62958
+ excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
62959
+ excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
62960
+ excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
62961
+ excludeOptions2[excludeOptions2["n"] = 3] = "n";
62962
+ excludeOptions2[excludeOptions2["file"] = 4] = "file";
62963
+ excludeOptions2[excludeOptions2["format"] = 5] = "format";
62964
+ excludeOptions2[excludeOptions2["from"] = 6] = "from";
62965
+ excludeOptions2[excludeOptions2["to"] = 7] = "to";
62966
+ excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
62967
+ excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
62968
+ excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
62969
+ excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
62970
+ excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
62971
+ return excludeOptions2;
62972
+ })(excludeOptions || {});
62973
+ }
62974
+ });
62975
+
62976
+ // src/lib/responses/MergeSummary.ts
62977
+ var MergeSummaryConflict, MergeSummaryDetail;
62978
+ var init_MergeSummary = __esm({
62979
+ "src/lib/responses/MergeSummary.ts"() {
62980
+ MergeSummaryConflict = class {
62981
+ constructor(reason, file = null, meta) {
62982
+ this.reason = reason;
62983
+ this.file = file;
62984
+ this.meta = meta;
62985
+ }
62986
+ toString() {
62987
+ return `${this.file}:${this.reason}`;
62988
+ }
62989
+ };
62990
+ MergeSummaryDetail = class {
62991
+ constructor() {
62992
+ this.conflicts = [];
62993
+ this.merges = [];
62994
+ this.result = "success";
62995
+ }
62996
+ get failed() {
62997
+ return this.conflicts.length > 0;
62998
+ }
62999
+ get reason() {
63000
+ return this.result;
63001
+ }
63002
+ toString() {
63003
+ if (this.conflicts.length) {
63004
+ return `CONFLICTS: ${this.conflicts.join(", ")}`;
63005
+ }
63006
+ return "OK";
63007
+ }
63008
+ };
63009
+ }
63010
+ });
63011
+
63012
+ // src/lib/responses/PullSummary.ts
63013
+ var PullSummary, PullFailedSummary;
63014
+ var init_PullSummary = __esm({
63015
+ "src/lib/responses/PullSummary.ts"() {
63016
+ PullSummary = class {
63017
+ constructor() {
63018
+ this.remoteMessages = {
63019
+ all: []
63020
+ };
63021
+ this.created = [];
63022
+ this.deleted = [];
63023
+ this.files = [];
63024
+ this.deletions = {};
63025
+ this.insertions = {};
63026
+ this.summary = {
63027
+ changes: 0,
63028
+ deletions: 0,
63029
+ insertions: 0
63030
+ };
63031
+ }
63032
+ };
63033
+ PullFailedSummary = class {
63034
+ constructor() {
63035
+ this.remote = "";
63036
+ this.hash = {
63037
+ local: "",
63038
+ remote: ""
63039
+ };
63040
+ this.branch = {
63041
+ local: "",
63042
+ remote: ""
63043
+ };
63044
+ this.message = "";
63045
+ }
63046
+ toString() {
63047
+ return this.message;
63048
+ }
63049
+ };
63050
+ }
63051
+ });
63052
+
63053
+ // src/lib/parsers/parse-remote-objects.ts
63054
+ function objectEnumerationResult(remoteMessages) {
63055
+ return remoteMessages.objects = remoteMessages.objects || {
63056
+ compressing: 0,
63057
+ counting: 0,
63058
+ enumerating: 0,
63059
+ packReused: 0,
63060
+ reused: { count: 0, delta: 0 },
63061
+ total: { count: 0, delta: 0 }
63062
+ };
63063
+ }
63064
+ function asObjectCount(source) {
63065
+ const count = /^\s*(\d+)/.exec(source);
63066
+ const delta = /delta (\d+)/i.exec(source);
63067
+ return {
63068
+ count: asNumber(count && count[1] || "0"),
63069
+ delta: asNumber(delta && delta[1] || "0")
63070
+ };
63071
+ }
63072
+ var remoteMessagesObjectParsers;
63073
+ var init_parse_remote_objects = __esm({
63074
+ "src/lib/parsers/parse-remote-objects.ts"() {
63075
+ init_utils();
63076
+ remoteMessagesObjectParsers = [
63077
+ new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
63078
+ const key = action.toLowerCase();
63079
+ const enumeration = objectEnumerationResult(result.remoteMessages);
63080
+ Object.assign(enumeration, { [key]: asNumber(count) });
63081
+ }),
63082
+ new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
63083
+ const key = action.toLowerCase();
63084
+ const enumeration = objectEnumerationResult(result.remoteMessages);
63085
+ Object.assign(enumeration, { [key]: asNumber(count) });
63086
+ }),
63087
+ new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
63088
+ const objects = objectEnumerationResult(result.remoteMessages);
63089
+ objects.total = asObjectCount(total);
63090
+ objects.reused = asObjectCount(reused);
63091
+ objects.packReused = asNumber(packReused);
63092
+ })
63093
+ ];
63094
+ }
63095
+ });
63096
+
63097
+ // src/lib/parsers/parse-remote-messages.ts
63098
+ function parseRemoteMessages(_stdOut, stdErr) {
63099
+ return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);
63100
+ }
63101
+ var parsers2, RemoteMessageSummary;
63102
+ var init_parse_remote_messages = __esm({
63103
+ "src/lib/parsers/parse-remote-messages.ts"() {
63104
+ init_utils();
63105
+ init_parse_remote_objects();
63106
+ parsers2 = [
63107
+ new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
63108
+ result.remoteMessages.all.push(text.trim());
63109
+ return false;
63110
+ }),
63111
+ ...remoteMessagesObjectParsers,
63112
+ new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
63113
+ result.remoteMessages.pullRequestUrl = pullRequestUrl;
63114
+ }),
63115
+ new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
63116
+ result.remoteMessages.vulnerabilities = {
63117
+ count: asNumber(count),
63118
+ summary,
63119
+ url
63120
+ };
63121
+ })
63122
+ ];
63123
+ RemoteMessageSummary = class {
63124
+ constructor() {
63125
+ this.all = [];
63126
+ }
63127
+ };
63128
+ }
63129
+ });
63130
+
63131
+ // src/lib/parsers/parse-pull.ts
63132
+ function parsePullErrorResult(stdOut, stdErr) {
63133
+ const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);
63134
+ return pullError.message && pullError;
63135
+ }
63136
+ var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;
63137
+ var init_parse_pull = __esm({
63138
+ "src/lib/parsers/parse-pull.ts"() {
63139
+ init_PullSummary();
63140
+ init_utils();
63141
+ init_parse_remote_messages();
63142
+ FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
63143
+ SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
63144
+ ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
63145
+ parsers3 = [
63146
+ new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
63147
+ result.files.push(file);
63148
+ if (insertions) {
63149
+ result.insertions[file] = insertions.length;
63150
+ }
63151
+ if (deletions) {
63152
+ result.deletions[file] = deletions.length;
63153
+ }
63154
+ }),
63155
+ new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
63156
+ if (insertions !== void 0 || deletions !== void 0) {
63157
+ result.summary.changes = +changes || 0;
63158
+ result.summary.insertions = +insertions || 0;
63159
+ result.summary.deletions = +deletions || 0;
63160
+ return true;
63161
+ }
63162
+ return false;
63163
+ }),
63164
+ new LineParser(ACTION_REGEX, (result, [action, file]) => {
63165
+ append(result.files, file);
63166
+ append(action === "create" ? result.created : result.deleted, file);
63167
+ })
63168
+ ];
63169
+ errorParsers = [
63170
+ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
63171
+ new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
63172
+ new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
63173
+ result.branch.local = branchLocal;
63174
+ result.hash.local = hashLocal;
63175
+ result.branch.remote = branchRemote;
63176
+ result.hash.remote = hashRemote;
63177
+ })
63178
+ ];
63179
+ parsePullDetail = (stdOut, stdErr) => {
63180
+ return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);
63181
+ };
63182
+ parsePullResult = (stdOut, stdErr) => {
63183
+ return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr));
63184
+ };
63185
+ }
63186
+ });
63187
+
63188
+ // src/lib/parsers/parse-merge.ts
63189
+ var parsers4, parseMergeResult, parseMergeDetail;
63190
+ var init_parse_merge = __esm({
63191
+ "src/lib/parsers/parse-merge.ts"() {
63192
+ init_MergeSummary();
63193
+ init_utils();
63194
+ init_parse_pull();
63195
+ parsers4 = [
63196
+ new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
63197
+ summary.merges.push(autoMerge);
63198
+ }),
63199
+ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
63200
+ summary.conflicts.push(new MergeSummaryConflict(reason, file));
63201
+ }),
63202
+ new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
63203
+ summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
63204
+ }),
63205
+ new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
63206
+ summary.conflicts.push(new MergeSummaryConflict(reason, null));
63207
+ }),
63208
+ new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
63209
+ summary.result = result;
63210
+ })
63211
+ ];
63212
+ parseMergeResult = (stdOut, stdErr) => {
63213
+ return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
63214
+ };
63215
+ parseMergeDetail = (stdOut) => {
63216
+ return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);
63217
+ };
63218
+ }
63219
+ });
63220
+
63221
+ // src/lib/tasks/merge.ts
63222
+ function mergeTask(customArgs) {
63223
+ if (!customArgs.length) {
63224
+ return configurationErrorTask("Git.merge requires at least one option");
63225
+ }
63226
+ return {
63227
+ commands: ["merge", ...customArgs],
63228
+ format: "utf-8",
63229
+ parser(stdOut, stdErr) {
63230
+ const merge = parseMergeResult(stdOut, stdErr);
63231
+ if (merge.failed) {
63232
+ throw new GitResponseError(merge);
63233
+ }
63234
+ return merge;
63235
+ }
63236
+ };
63237
+ }
63238
+ var init_merge = __esm({
63239
+ "src/lib/tasks/merge.ts"() {
63240
+ init_git_response_error();
63241
+ init_parse_merge();
63242
+ init_task();
63243
+ }
63244
+ });
63245
+
63246
+ // src/lib/parsers/parse-push.ts
63247
+ function pushResultPushedItem(local, remote, status) {
63248
+ const deleted = status.includes("deleted");
63249
+ const tag = status.includes("tag") || /^refs\/tags/.test(local);
63250
+ const alreadyUpdated = !status.includes("new");
63251
+ return {
63252
+ deleted,
63253
+ tag,
63254
+ branch: !tag,
63255
+ new: !alreadyUpdated,
63256
+ alreadyUpdated,
63257
+ local,
63258
+ remote
63259
+ };
63260
+ }
63261
+ var parsers5, parsePushResult, parsePushDetail;
63262
+ var init_parse_push = __esm({
63263
+ "src/lib/parsers/parse-push.ts"() {
63264
+ init_utils();
63265
+ init_parse_remote_messages();
63266
+ parsers5 = [
63267
+ new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
63268
+ result.repo = repo;
63269
+ }),
63270
+ new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
63271
+ result.ref = __spreadProps(__spreadValues({}, result.ref || {}), {
63272
+ local
63273
+ });
63274
+ }),
63275
+ new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
63276
+ result.pushed.push(pushResultPushedItem(local, remote, type));
63277
+ }),
63278
+ new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
63279
+ result.branch = __spreadProps(__spreadValues({}, result.branch || {}), {
63280
+ local,
63281
+ remote,
63282
+ remoteName
63283
+ });
63284
+ }),
63285
+ new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
63286
+ result.update = {
63287
+ head: {
63288
+ local,
63289
+ remote
63290
+ },
63291
+ hash: {
63292
+ from,
63293
+ to
63294
+ }
63295
+ };
63296
+ })
63297
+ ];
63298
+ parsePushResult = (stdOut, stdErr) => {
63299
+ const pushDetail = parsePushDetail(stdOut, stdErr);
63300
+ const responseDetail = parseRemoteMessages(stdOut, stdErr);
63301
+ return __spreadValues(__spreadValues({}, pushDetail), responseDetail);
63302
+ };
63303
+ parsePushDetail = (stdOut, stdErr) => {
63304
+ return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
63305
+ };
63306
+ }
63307
+ });
63308
+
63309
+ // src/lib/tasks/push.ts
63310
+ var push_exports = {};
63311
+ __export(push_exports, {
63312
+ pushTagsTask: () => pushTagsTask,
63313
+ pushTask: () => pushTask
63314
+ });
63315
+ function pushTagsTask(ref = {}, customArgs) {
63316
+ append(customArgs, "--tags");
63317
+ return pushTask(ref, customArgs);
63318
+ }
63319
+ function pushTask(ref = {}, customArgs) {
63320
+ const commands = ["push", ...customArgs];
63321
+ if (ref.branch) {
63322
+ commands.splice(1, 0, ref.branch);
63323
+ }
63324
+ if (ref.remote) {
63325
+ commands.splice(1, 0, ref.remote);
63326
+ }
63327
+ remove$1(commands, "-v");
63328
+ append(commands, "--verbose");
63329
+ append(commands, "--porcelain");
63330
+ return {
63331
+ commands,
63332
+ format: "utf-8",
63333
+ parser: parsePushResult
63334
+ };
63335
+ }
63336
+ var init_push = __esm({
63337
+ "src/lib/tasks/push.ts"() {
63338
+ init_parse_push();
63339
+ init_utils();
63340
+ }
63341
+ });
63342
+
63343
+ // src/lib/tasks/show.ts
63344
+ function show_default() {
63345
+ return {
63346
+ showBuffer() {
63347
+ const commands = ["show", ...getTrailingOptions(arguments, 1)];
63348
+ if (!commands.includes("--binary")) {
63349
+ commands.splice(1, 0, "--binary");
63350
+ }
63351
+ return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments));
63352
+ },
63353
+ show() {
63354
+ const commands = ["show", ...getTrailingOptions(arguments, 1)];
63355
+ return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments));
63356
+ }
63357
+ };
63358
+ }
63359
+ var init_show = __esm({
63360
+ "src/lib/tasks/show.ts"() {
63361
+ init_utils();
63362
+ init_task();
63363
+ }
63364
+ });
63365
+
63366
+ // src/lib/responses/FileStatusSummary.ts
63367
+ var fromPathRegex, FileStatusSummary;
63368
+ var init_FileStatusSummary = __esm({
63369
+ "src/lib/responses/FileStatusSummary.ts"() {
63370
+ fromPathRegex = /^(.+) -> (.+)$/;
63371
+ FileStatusSummary = class {
63372
+ constructor(path, index, working_dir) {
63373
+ this.path = path;
63374
+ this.index = index;
63375
+ this.working_dir = working_dir;
63376
+ if (index + working_dir === "R") {
63377
+ const detail = fromPathRegex.exec(path) || [null, path, path];
63378
+ this.from = detail[1] || "";
63379
+ this.path = detail[2] || "";
63380
+ }
63381
+ }
63382
+ };
63383
+ }
63384
+ });
63385
+
63386
+ // src/lib/responses/StatusSummary.ts
63387
+ function renamedFile(line) {
63388
+ const [to, from] = line.split(NULL$1);
63389
+ return {
63390
+ from: from || to,
63391
+ to
63392
+ };
63393
+ }
63394
+ function parser2(indexX, indexY, handler) {
63395
+ return [`${indexX}${indexY}`, handler];
63396
+ }
63397
+ function conflicts(indexX, ...indexY) {
63398
+ return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file)));
63399
+ }
63400
+ function splitLine(result, lineStr) {
63401
+ const trimmed2 = lineStr.trim();
63402
+ switch (" ") {
63403
+ case trimmed2.charAt(2):
63404
+ return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3));
63405
+ case trimmed2.charAt(1):
63406
+ return data(" " /* NONE */, trimmed2.charAt(0), trimmed2.substr(2));
63407
+ default:
63408
+ return;
63409
+ }
63410
+ function data(index, workingDir, path) {
63411
+ const raw = `${index}${workingDir}`;
63412
+ const handler = parsers6.get(raw);
63413
+ if (handler) {
63414
+ handler(result, path);
63415
+ }
63416
+ if (raw !== "##" && raw !== "!!") {
63417
+ result.files.push(new FileStatusSummary(path.replace(/\0.+$/, ""), index, workingDir));
63418
+ }
63419
+ }
63420
+ }
63421
+ var StatusSummary, parsers6, parseStatusSummary;
63422
+ var init_StatusSummary = __esm({
63423
+ "src/lib/responses/StatusSummary.ts"() {
63424
+ init_utils();
63425
+ init_FileStatusSummary();
63426
+ StatusSummary = class {
63427
+ constructor() {
63428
+ this.not_added = [];
63429
+ this.conflicted = [];
63430
+ this.created = [];
63431
+ this.deleted = [];
63432
+ this.ignored = void 0;
63433
+ this.modified = [];
63434
+ this.renamed = [];
63435
+ this.files = [];
63436
+ this.staged = [];
63437
+ this.ahead = 0;
63438
+ this.behind = 0;
63439
+ this.current = null;
63440
+ this.tracking = null;
63441
+ this.detached = false;
63442
+ this.isClean = () => {
63443
+ return !this.files.length;
63444
+ };
63445
+ }
63446
+ };
63447
+ parsers6 = new Map([
63448
+ parser2(" " /* NONE */, "A" /* ADDED */, (result, file) => append(result.created, file)),
63449
+ parser2(" " /* NONE */, "D" /* DELETED */, (result, file) => append(result.deleted, file)),
63450
+ parser2(" " /* NONE */, "M" /* MODIFIED */, (result, file) => append(result.modified, file)),
63451
+ parser2("A" /* ADDED */, " " /* NONE */, (result, file) => append(result.created, file) && append(result.staged, file)),
63452
+ parser2("A" /* ADDED */, "M" /* MODIFIED */, (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)),
63453
+ parser2("D" /* DELETED */, " " /* NONE */, (result, file) => append(result.deleted, file) && append(result.staged, file)),
63454
+ parser2("M" /* MODIFIED */, " " /* NONE */, (result, file) => append(result.modified, file) && append(result.staged, file)),
63455
+ parser2("M" /* MODIFIED */, "M" /* MODIFIED */, (result, file) => append(result.modified, file) && append(result.staged, file)),
63456
+ parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => {
63457
+ append(result.renamed, renamedFile(file));
63458
+ }),
63459
+ parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => {
63460
+ const renamed = renamedFile(file);
63461
+ append(result.renamed, renamed);
63462
+ append(result.modified, renamed.to);
63463
+ }),
63464
+ parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => {
63465
+ append(_result.ignored = _result.ignored || [], _file);
63466
+ }),
63467
+ parser2("?" /* UNTRACKED */, "?" /* UNTRACKED */, (result, file) => append(result.not_added, file)),
63468
+ ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */),
63469
+ ...conflicts("D" /* DELETED */, "D" /* DELETED */, "U" /* UNMERGED */),
63470
+ ...conflicts("U" /* UNMERGED */, "A" /* ADDED */, "D" /* DELETED */, "U" /* UNMERGED */),
63471
+ [
63472
+ "##",
63473
+ (result, line) => {
63474
+ const aheadReg = /ahead (\d+)/;
63475
+ const behindReg = /behind (\d+)/;
63476
+ const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
63477
+ const trackingReg = /\.{3}(\S*)/;
63478
+ const onEmptyBranchReg = /\son\s([\S]+)$/;
63479
+ let regexResult;
63480
+ regexResult = aheadReg.exec(line);
63481
+ result.ahead = regexResult && +regexResult[1] || 0;
63482
+ regexResult = behindReg.exec(line);
63483
+ result.behind = regexResult && +regexResult[1] || 0;
63484
+ regexResult = currentReg.exec(line);
63485
+ result.current = regexResult && regexResult[1];
63486
+ regexResult = trackingReg.exec(line);
63487
+ result.tracking = regexResult && regexResult[1];
63488
+ regexResult = onEmptyBranchReg.exec(line);
63489
+ result.current = regexResult && regexResult[1] || result.current;
63490
+ result.detached = /\(no branch\)/.test(line);
63491
+ }
63492
+ ]
63493
+ ]);
63494
+ parseStatusSummary = function(text) {
63495
+ const lines = text.split(NULL$1);
63496
+ const status = new StatusSummary();
63497
+ for (let i = 0, l = lines.length; i < l; ) {
63498
+ let line = lines[i++].trim();
63499
+ if (!line) {
63500
+ continue;
63501
+ }
63502
+ if (line.charAt(0) === "R" /* RENAMED */) {
63503
+ line += NULL$1 + (lines[i++] || "");
63504
+ }
63505
+ splitLine(status, line);
63506
+ }
63507
+ return status;
63508
+ };
63509
+ }
63510
+ });
63511
+
63512
+ // src/lib/tasks/status.ts
63513
+ function statusTask(customArgs) {
63514
+ const commands = [
63515
+ "status",
63516
+ "--porcelain",
63517
+ "-b",
63518
+ "-u",
63519
+ "--null",
63520
+ ...customArgs.filter((arg) => !ignoredOptions.includes(arg))
63521
+ ];
63522
+ return {
63523
+ format: "utf-8",
63524
+ commands,
63525
+ parser(text) {
63526
+ return parseStatusSummary(text);
63527
+ }
63528
+ };
63529
+ }
63530
+ var ignoredOptions;
63531
+ var init_status = __esm({
63532
+ "src/lib/tasks/status.ts"() {
63533
+ init_StatusSummary();
63534
+ ignoredOptions = ["--null", "-z"];
63535
+ }
63536
+ });
63537
+
63538
+ // src/lib/tasks/version.ts
63539
+ function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
63540
+ return Object.defineProperty({
63541
+ major,
63542
+ minor,
63543
+ patch,
63544
+ agent,
63545
+ installed
63546
+ }, "toString", {
63547
+ value() {
63548
+ return `${this.major}.${this.minor}.${this.patch}`;
63549
+ },
63550
+ configurable: false,
63551
+ enumerable: false
63552
+ });
63553
+ }
63554
+ function notInstalledResponse() {
63555
+ return versionResponse(0, 0, 0, "", false);
63556
+ }
63557
+ function version_default() {
63558
+ return {
63559
+ version() {
63560
+ return this._runTask({
63561
+ commands: ["--version"],
63562
+ format: "utf-8",
63563
+ parser: versionParser,
63564
+ onError(result, error, done, fail) {
63565
+ if (result.exitCode === -2 /* NOT_FOUND */) {
63566
+ return done(Buffer.from(NOT_INSTALLED));
63567
+ }
63568
+ fail(error);
63569
+ }
63570
+ });
63571
+ }
63572
+ };
63573
+ }
63574
+ function versionParser(stdOut) {
63575
+ if (stdOut === NOT_INSTALLED) {
63576
+ return notInstalledResponse();
63577
+ }
63578
+ return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
63579
+ }
63580
+ var NOT_INSTALLED, parsers7;
63581
+ var init_version = __esm({
63582
+ "src/lib/tasks/version.ts"() {
63583
+ init_utils();
63584
+ NOT_INSTALLED = "installed=false";
63585
+ parsers7 = [
63586
+ new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => {
63587
+ Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent));
63588
+ }),
63589
+ new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => {
63590
+ Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
63591
+ })
63592
+ ];
63593
+ }
63594
+ });
63595
+
63596
+ // src/lib/simple-git-api.ts
63597
+ var simple_git_api_exports = {};
63598
+ __export(simple_git_api_exports, {
63599
+ SimpleGitApi: () => SimpleGitApi
63600
+ });
63601
+ var SimpleGitApi;
63602
+ var init_simple_git_api = __esm({
63603
+ "src/lib/simple-git-api.ts"() {
63604
+ init_task_callback();
63605
+ init_change_working_directory();
63606
+ init_checkout();
63607
+ init_commit();
63608
+ init_config();
63609
+ init_first_commit();
63610
+ init_grep();
63611
+ init_hash_object();
63612
+ init_init();
63613
+ init_log();
63614
+ init_merge();
63615
+ init_push();
63616
+ init_show();
63617
+ init_status();
63618
+ init_task();
63619
+ init_version();
63620
+ init_utils();
63621
+ SimpleGitApi = class {
63622
+ constructor(_executor) {
63623
+ this._executor = _executor;
63624
+ }
63625
+ _runTask(task, then) {
63626
+ const chain = this._executor.chain();
63627
+ const promise = chain.push(task);
63628
+ if (then) {
63629
+ taskCallback(task, promise, then);
63630
+ }
63631
+ return Object.create(this, {
63632
+ then: { value: promise.then.bind(promise) },
63633
+ catch: { value: promise.catch.bind(promise) },
63634
+ _executor: { value: chain }
63635
+ });
63636
+ }
63637
+ add(files) {
63638
+ return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments));
63639
+ }
63640
+ cwd(directory) {
63641
+ const next = trailingFunctionArgument(arguments);
63642
+ if (typeof directory === "string") {
63643
+ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
63644
+ }
63645
+ if (typeof (directory == null ? void 0 : directory.path) === "string") {
63646
+ return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next);
63647
+ }
63648
+ return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next);
63649
+ }
63650
+ hashObject(path, write) {
63651
+ return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments));
63652
+ }
63653
+ init(bare) {
63654
+ return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
63655
+ }
63656
+ merge() {
63657
+ return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
63658
+ }
63659
+ mergeFromTo(remote, branch) {
63660
+ if (!(filterString(remote) && filterString(branch))) {
63661
+ return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`));
63662
+ }
63663
+ return this._runTask(mergeTask([remote, branch, ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments, false));
63664
+ }
63665
+ outputHandler(handler) {
63666
+ this._executor.outputHandler = handler;
63667
+ return this;
63668
+ }
63669
+ push() {
63670
+ const task = pushTask({
63671
+ remote: filterType(arguments[0], filterString),
63672
+ branch: filterType(arguments[1], filterString)
63673
+ }, getTrailingOptions(arguments));
63674
+ return this._runTask(task, trailingFunctionArgument(arguments));
63675
+ }
63676
+ stash() {
63677
+ return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
63678
+ }
63679
+ status() {
63680
+ return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
63681
+ }
63682
+ };
63683
+ Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
63684
+ }
63685
+ });
63686
+
63687
+ // src/lib/runners/scheduler.ts
63688
+ var scheduler_exports = {};
63689
+ __export(scheduler_exports, {
63690
+ Scheduler: () => Scheduler
63691
+ });
63692
+ var createScheduledTask, Scheduler;
63693
+ var init_scheduler = __esm({
63694
+ "src/lib/runners/scheduler.ts"() {
63695
+ init_utils();
63696
+ init_git_logger();
63697
+ createScheduledTask = (() => {
63698
+ let id = 0;
63699
+ return () => {
63700
+ id++;
63701
+ const { promise, done } = createDeferred();
63702
+ return {
63703
+ promise,
63704
+ done,
63705
+ id
63706
+ };
63707
+ };
63708
+ })();
63709
+ Scheduler = class {
63710
+ constructor(concurrency = 2) {
63711
+ this.concurrency = concurrency;
63712
+ this.logger = createLogger$1("", "scheduler");
63713
+ this.pending = [];
63714
+ this.running = [];
63715
+ this.logger(`Constructed, concurrency=%s`, concurrency);
63716
+ }
63717
+ schedule() {
63718
+ if (!this.pending.length || this.running.length >= this.concurrency) {
63719
+ this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);
63720
+ return;
63721
+ }
63722
+ const task = append(this.running, this.pending.shift());
63723
+ this.logger(`Attempting id=%s`, task.id);
63724
+ task.done(() => {
63725
+ this.logger(`Completing id=`, task.id);
63726
+ remove$1(this.running, task);
63727
+ this.schedule();
63728
+ });
63729
+ }
63730
+ next() {
63731
+ const { promise, id } = append(this.pending, createScheduledTask());
63732
+ this.logger(`Scheduling id=%s`, id);
63733
+ this.schedule();
63734
+ return promise;
63735
+ }
63736
+ };
63737
+ }
63738
+ });
63739
+
63740
+ // src/lib/tasks/apply-patch.ts
63741
+ var apply_patch_exports = {};
63742
+ __export(apply_patch_exports, {
63743
+ applyPatchTask: () => applyPatchTask
63744
+ });
63745
+ function applyPatchTask(patches, customArgs) {
63746
+ return straightThroughStringTask(["apply", ...customArgs, ...patches]);
63747
+ }
63748
+ var init_apply_patch = __esm({
63749
+ "src/lib/tasks/apply-patch.ts"() {
63750
+ init_task();
63751
+ }
63752
+ });
63753
+
63754
+ // src/lib/responses/BranchDeleteSummary.ts
63755
+ function branchDeletionSuccess(branch, hash) {
63756
+ return {
63757
+ branch,
63758
+ hash,
63759
+ success: true
63760
+ };
63761
+ }
63762
+ function branchDeletionFailure(branch) {
63763
+ return {
63764
+ branch,
63765
+ hash: null,
63766
+ success: false
63767
+ };
63768
+ }
63769
+ var BranchDeletionBatch;
63770
+ var init_BranchDeleteSummary = __esm({
63771
+ "src/lib/responses/BranchDeleteSummary.ts"() {
63772
+ BranchDeletionBatch = class {
63773
+ constructor() {
63774
+ this.all = [];
63775
+ this.branches = {};
63776
+ this.errors = [];
63777
+ }
63778
+ get success() {
63779
+ return !this.errors.length;
63780
+ }
63781
+ };
63782
+ }
63783
+ });
63784
+
63785
+ // src/lib/parsers/parse-branch-delete.ts
63786
+ function hasBranchDeletionError(data, processExitCode) {
63787
+ return processExitCode === 1 /* ERROR */ && deleteErrorRegex.test(data);
63788
+ }
63789
+ var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;
63790
+ var init_parse_branch_delete = __esm({
63791
+ "src/lib/parsers/parse-branch-delete.ts"() {
63792
+ init_BranchDeleteSummary();
63793
+ init_utils();
63794
+ deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
63795
+ deleteErrorRegex = /^error[^']+'([^']+)'/m;
63796
+ parsers8 = [
63797
+ new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
63798
+ const deletion = branchDeletionSuccess(branch, hash);
63799
+ result.all.push(deletion);
63800
+ result.branches[branch] = deletion;
63801
+ }),
63802
+ new LineParser(deleteErrorRegex, (result, [branch]) => {
63803
+ const deletion = branchDeletionFailure(branch);
63804
+ result.errors.push(deletion);
63805
+ result.all.push(deletion);
63806
+ result.branches[branch] = deletion;
63807
+ })
63808
+ ];
63809
+ parseBranchDeletions = (stdOut, stdErr) => {
63810
+ return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);
63811
+ };
63812
+ }
63813
+ });
63814
+
63815
+ // src/lib/responses/BranchSummary.ts
63816
+ var BranchSummaryResult;
63817
+ var init_BranchSummary = __esm({
63818
+ "src/lib/responses/BranchSummary.ts"() {
63819
+ BranchSummaryResult = class {
63820
+ constructor() {
63821
+ this.all = [];
63822
+ this.branches = {};
63823
+ this.current = "";
63824
+ this.detached = false;
63825
+ }
63826
+ push(status, detached, name, commit, label) {
63827
+ if (status === "*" /* CURRENT */) {
63828
+ this.detached = detached;
63829
+ this.current = name;
63830
+ }
63831
+ this.all.push(name);
63832
+ this.branches[name] = {
63833
+ current: status === "*" /* CURRENT */,
63834
+ linkedWorkTree: status === "+" /* LINKED */,
63835
+ name,
63836
+ commit,
63837
+ label
63838
+ };
63839
+ }
63840
+ };
63841
+ }
63842
+ });
63843
+
63844
+ // src/lib/parsers/parse-branch.ts
63845
+ function branchStatus(input) {
63846
+ return input ? input.charAt(0) : "";
63847
+ }
63848
+ function parseBranchSummary(stdOut) {
63849
+ return parseStringResponse(new BranchSummaryResult(), parsers9, stdOut);
63850
+ }
63851
+ var parsers9;
63852
+ var init_parse_branch = __esm({
63853
+ "src/lib/parsers/parse-branch.ts"() {
63854
+ init_BranchSummary();
63855
+ init_utils();
63856
+ parsers9 = [
63857
+ new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
63858
+ result.push(branchStatus(current), true, name, commit, label);
63859
+ }),
63860
+ new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
63861
+ result.push(branchStatus(current), false, name, commit, label);
63862
+ })
63863
+ ];
63864
+ }
63865
+ });
63866
+
63867
+ // src/lib/tasks/branch.ts
63868
+ var branch_exports = {};
63869
+ __export(branch_exports, {
63870
+ branchLocalTask: () => branchLocalTask,
63871
+ branchTask: () => branchTask,
63872
+ containsDeleteBranchCommand: () => containsDeleteBranchCommand,
63873
+ deleteBranchTask: () => deleteBranchTask,
63874
+ deleteBranchesTask: () => deleteBranchesTask
63875
+ });
63876
+ function containsDeleteBranchCommand(commands) {
63877
+ const deleteCommands = ["-d", "-D", "--delete"];
63878
+ return commands.some((command) => deleteCommands.includes(command));
63879
+ }
63880
+ function branchTask(customArgs) {
63881
+ const isDelete = containsDeleteBranchCommand(customArgs);
63882
+ const commands = ["branch", ...customArgs];
63883
+ if (commands.length === 1) {
63884
+ commands.push("-a");
63885
+ }
63886
+ if (!commands.includes("-v")) {
63887
+ commands.splice(1, 0, "-v");
63888
+ }
63889
+ return {
63890
+ format: "utf-8",
63891
+ commands,
63892
+ parser(stdOut, stdErr) {
63893
+ if (isDelete) {
63894
+ return parseBranchDeletions(stdOut, stdErr).all[0];
63895
+ }
63896
+ return parseBranchSummary(stdOut);
63897
+ }
63898
+ };
63899
+ }
63900
+ function branchLocalTask() {
63901
+ const parser3 = parseBranchSummary;
63902
+ return {
63903
+ format: "utf-8",
63904
+ commands: ["branch", "-v"],
63905
+ parser: parser3
63906
+ };
63907
+ }
63908
+ function deleteBranchesTask(branches, forceDelete = false) {
63909
+ return {
63910
+ format: "utf-8",
63911
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches],
63912
+ parser(stdOut, stdErr) {
63913
+ return parseBranchDeletions(stdOut, stdErr);
63914
+ },
63915
+ onError({ exitCode, stdOut }, error, done, fail) {
63916
+ if (!hasBranchDeletionError(String(error), exitCode)) {
63917
+ return fail(error);
63918
+ }
63919
+ done(stdOut);
63920
+ }
63921
+ };
63922
+ }
63923
+ function deleteBranchTask(branch, forceDelete = false) {
63924
+ const task = {
63925
+ format: "utf-8",
63926
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch],
63927
+ parser(stdOut, stdErr) {
63928
+ return parseBranchDeletions(stdOut, stdErr).branches[branch];
63929
+ },
63930
+ onError({ exitCode, stdErr, stdOut }, error, _, fail) {
63931
+ if (!hasBranchDeletionError(String(error), exitCode)) {
63932
+ return fail(error);
63933
+ }
63934
+ throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error));
63935
+ }
63936
+ };
63937
+ return task;
63938
+ }
63939
+ var init_branch = __esm({
63940
+ "src/lib/tasks/branch.ts"() {
63941
+ init_git_response_error();
63942
+ init_parse_branch_delete();
63943
+ init_parse_branch();
63944
+ init_utils();
63945
+ }
63946
+ });
63947
+
63948
+ // src/lib/responses/CheckIgnore.ts
63949
+ var parseCheckIgnore;
63950
+ var init_CheckIgnore = __esm({
63951
+ "src/lib/responses/CheckIgnore.ts"() {
63952
+ parseCheckIgnore = (text) => {
63953
+ return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file);
63954
+ };
63955
+ }
63956
+ });
63957
+
63958
+ // src/lib/tasks/check-ignore.ts
63959
+ var check_ignore_exports = {};
63960
+ __export(check_ignore_exports, {
63961
+ checkIgnoreTask: () => checkIgnoreTask
63962
+ });
63963
+ function checkIgnoreTask(paths) {
63964
+ return {
63965
+ commands: ["check-ignore", ...paths],
63966
+ format: "utf-8",
63967
+ parser: parseCheckIgnore
63968
+ };
63969
+ }
63970
+ var init_check_ignore = __esm({
63971
+ "src/lib/tasks/check-ignore.ts"() {
63972
+ init_CheckIgnore();
63973
+ }
63974
+ });
63975
+
63976
+ // src/lib/tasks/clone.ts
63977
+ var clone_exports = {};
63978
+ __export(clone_exports, {
63979
+ cloneMirrorTask: () => cloneMirrorTask,
63980
+ cloneTask: () => cloneTask
63981
+ });
63982
+ function disallowedCommand(command) {
63983
+ return /^--upload-pack(=|$)/.test(command);
63984
+ }
63985
+ function cloneTask(repo, directory, customArgs) {
63986
+ const commands = ["clone", ...customArgs];
63987
+ filterString(repo) && commands.push(repo);
63988
+ filterString(directory) && commands.push(directory);
63989
+ const banned = commands.find(disallowedCommand);
63990
+ if (banned) {
63991
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
63992
+ }
63993
+ return straightThroughStringTask(commands);
63994
+ }
63995
+ function cloneMirrorTask(repo, directory, customArgs) {
63996
+ append(customArgs, "--mirror");
63997
+ return cloneTask(repo, directory, customArgs);
63998
+ }
63999
+ var init_clone = __esm({
64000
+ "src/lib/tasks/clone.ts"() {
64001
+ init_task();
64002
+ init_utils();
64003
+ }
64004
+ });
64005
+
64006
+ // src/lib/parsers/parse-fetch.ts
64007
+ function parseFetchResult(stdOut, stdErr) {
64008
+ const result = {
64009
+ raw: stdOut,
64010
+ remote: null,
64011
+ branches: [],
64012
+ tags: [],
64013
+ updated: [],
64014
+ deleted: []
64015
+ };
64016
+ return parseStringResponse(result, parsers10, [stdOut, stdErr]);
64017
+ }
64018
+ var parsers10;
64019
+ var init_parse_fetch = __esm({
64020
+ "src/lib/parsers/parse-fetch.ts"() {
64021
+ init_utils();
64022
+ parsers10 = [
64023
+ new LineParser(/From (.+)$/, (result, [remote]) => {
64024
+ result.remote = remote;
64025
+ }),
64026
+ new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
64027
+ result.branches.push({
64028
+ name,
64029
+ tracking
64030
+ });
64031
+ }),
64032
+ new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
64033
+ result.tags.push({
64034
+ name,
64035
+ tracking
64036
+ });
64037
+ }),
64038
+ new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => {
64039
+ result.deleted.push({
64040
+ tracking
64041
+ });
64042
+ }),
64043
+ new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => {
64044
+ result.updated.push({
64045
+ name,
64046
+ tracking,
64047
+ to,
64048
+ from
64049
+ });
64050
+ })
64051
+ ];
64052
+ }
64053
+ });
64054
+
64055
+ // src/lib/tasks/fetch.ts
64056
+ var fetch_exports = {};
64057
+ __export(fetch_exports, {
64058
+ fetchTask: () => fetchTask
64059
+ });
64060
+ function disallowedCommand2(command) {
64061
+ return /^--upload-pack(=|$)/.test(command);
64062
+ }
64063
+ function fetchTask(remote, branch, customArgs) {
64064
+ const commands = ["fetch", ...customArgs];
64065
+ if (remote && branch) {
64066
+ commands.push(remote, branch);
64067
+ }
64068
+ const banned = commands.find(disallowedCommand2);
64069
+ if (banned) {
64070
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
64071
+ }
64072
+ return {
64073
+ commands,
64074
+ format: "utf-8",
64075
+ parser: parseFetchResult
64076
+ };
64077
+ }
64078
+ var init_fetch = __esm({
64079
+ "src/lib/tasks/fetch.ts"() {
64080
+ init_parse_fetch();
64081
+ init_task();
64082
+ }
64083
+ });
64084
+
64085
+ // src/lib/parsers/parse-move.ts
64086
+ function parseMoveResult(stdOut) {
64087
+ return parseStringResponse({ moves: [] }, parsers11, stdOut);
64088
+ }
64089
+ var parsers11;
64090
+ var init_parse_move = __esm({
64091
+ "src/lib/parsers/parse-move.ts"() {
64092
+ init_utils();
64093
+ parsers11 = [
64094
+ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
64095
+ result.moves.push({ from, to });
64096
+ })
64097
+ ];
64098
+ }
64099
+ });
64100
+
64101
+ // src/lib/tasks/move.ts
64102
+ var move_exports = {};
64103
+ __export(move_exports, {
64104
+ moveTask: () => moveTask
64105
+ });
64106
+ function moveTask(from, to) {
64107
+ return {
64108
+ commands: ["mv", "-v", ...asArray(from), to],
64109
+ format: "utf-8",
64110
+ parser: parseMoveResult
64111
+ };
64112
+ }
64113
+ var init_move = __esm({
64114
+ "src/lib/tasks/move.ts"() {
64115
+ init_parse_move();
64116
+ init_utils();
64117
+ }
64118
+ });
64119
+
64120
+ // src/lib/tasks/pull.ts
64121
+ var pull_exports = {};
64122
+ __export(pull_exports, {
64123
+ pullTask: () => pullTask
64124
+ });
64125
+ function pullTask(remote, branch, customArgs) {
64126
+ const commands = ["pull", ...customArgs];
64127
+ if (remote && branch) {
64128
+ commands.splice(1, 0, remote, branch);
64129
+ }
64130
+ return {
64131
+ commands,
64132
+ format: "utf-8",
64133
+ parser(stdOut, stdErr) {
64134
+ return parsePullResult(stdOut, stdErr);
64135
+ },
64136
+ onError(result, _error, _done, fail) {
64137
+ const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr));
64138
+ if (pullError) {
64139
+ return fail(new GitResponseError(pullError));
64140
+ }
64141
+ fail(_error);
64142
+ }
64143
+ };
64144
+ }
64145
+ var init_pull = __esm({
64146
+ "src/lib/tasks/pull.ts"() {
64147
+ init_git_response_error();
64148
+ init_parse_pull();
64149
+ init_utils();
64150
+ }
64151
+ });
64152
+
64153
+ // src/lib/responses/GetRemoteSummary.ts
64154
+ function parseGetRemotes(text) {
64155
+ const remotes = {};
64156
+ forEach$1(text, ([name]) => remotes[name] = { name });
64157
+ return Object.values(remotes);
64158
+ }
64159
+ function parseGetRemotesVerbose(text) {
64160
+ const remotes = {};
64161
+ forEach$1(text, ([name, url, purpose]) => {
64162
+ if (!remotes.hasOwnProperty(name)) {
64163
+ remotes[name] = {
64164
+ name,
64165
+ refs: { fetch: "", push: "" }
64166
+ };
64167
+ }
64168
+ if (purpose && url) {
64169
+ remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
64170
+ }
64171
+ });
64172
+ return Object.values(remotes);
64173
+ }
64174
+ function forEach$1(text, handler) {
64175
+ forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
64176
+ }
64177
+ var init_GetRemoteSummary = __esm({
64178
+ "src/lib/responses/GetRemoteSummary.ts"() {
64179
+ init_utils();
64180
+ }
64181
+ });
64182
+
64183
+ // src/lib/tasks/remote.ts
64184
+ var remote_exports = {};
64185
+ __export(remote_exports, {
64186
+ addRemoteTask: () => addRemoteTask,
64187
+ getRemotesTask: () => getRemotesTask,
64188
+ listRemotesTask: () => listRemotesTask,
64189
+ remoteTask: () => remoteTask,
64190
+ removeRemoteTask: () => removeRemoteTask
64191
+ });
64192
+ function addRemoteTask(remoteName, remoteRepo, customArgs = []) {
64193
+ return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
64194
+ }
64195
+ function getRemotesTask(verbose) {
64196
+ const commands = ["remote"];
64197
+ if (verbose) {
64198
+ commands.push("-v");
64199
+ }
64200
+ return {
64201
+ commands,
64202
+ format: "utf-8",
64203
+ parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
64204
+ };
64205
+ }
64206
+ function listRemotesTask(customArgs = []) {
64207
+ const commands = [...customArgs];
64208
+ if (commands[0] !== "ls-remote") {
64209
+ commands.unshift("ls-remote");
64210
+ }
64211
+ return straightThroughStringTask(commands);
64212
+ }
64213
+ function remoteTask(customArgs = []) {
64214
+ const commands = [...customArgs];
64215
+ if (commands[0] !== "remote") {
64216
+ commands.unshift("remote");
64217
+ }
64218
+ return straightThroughStringTask(commands);
64219
+ }
64220
+ function removeRemoteTask(remoteName) {
64221
+ return straightThroughStringTask(["remote", "remove", remoteName]);
64222
+ }
64223
+ var init_remote = __esm({
64224
+ "src/lib/tasks/remote.ts"() {
64225
+ init_GetRemoteSummary();
64226
+ init_task();
64227
+ }
64228
+ });
64229
+
64230
+ // src/lib/tasks/stash-list.ts
64231
+ var stash_list_exports = {};
64232
+ __export(stash_list_exports, {
64233
+ stashListTask: () => stashListTask
64234
+ });
64235
+ function stashListTask(opt = {}, customArgs) {
64236
+ const options = parseLogOptions(opt);
64237
+ const commands = ["stash", "list", ...options.commands, ...customArgs];
64238
+ const parser3 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands));
64239
+ return validateLogFormatConfig(commands) || {
64240
+ commands,
64241
+ format: "utf-8",
64242
+ parser: parser3
64243
+ };
64244
+ }
64245
+ var init_stash_list = __esm({
64246
+ "src/lib/tasks/stash-list.ts"() {
64247
+ init_log_format();
64248
+ init_parse_list_log_summary();
64249
+ init_diff();
64250
+ init_log();
64251
+ }
64252
+ });
64253
+
64254
+ // src/lib/tasks/sub-module.ts
64255
+ var sub_module_exports = {};
64256
+ __export(sub_module_exports, {
64257
+ addSubModuleTask: () => addSubModuleTask,
64258
+ initSubModuleTask: () => initSubModuleTask,
64259
+ subModuleTask: () => subModuleTask,
64260
+ updateSubModuleTask: () => updateSubModuleTask
64261
+ });
64262
+ function addSubModuleTask(repo, path) {
64263
+ return subModuleTask(["add", repo, path]);
64264
+ }
64265
+ function initSubModuleTask(customArgs) {
64266
+ return subModuleTask(["init", ...customArgs]);
64267
+ }
64268
+ function subModuleTask(customArgs) {
64269
+ const commands = [...customArgs];
64270
+ if (commands[0] !== "submodule") {
64271
+ commands.unshift("submodule");
64272
+ }
64273
+ return straightThroughStringTask(commands);
64274
+ }
64275
+ function updateSubModuleTask(customArgs) {
64276
+ return subModuleTask(["update", ...customArgs]);
64277
+ }
64278
+ var init_sub_module = __esm({
64279
+ "src/lib/tasks/sub-module.ts"() {
64280
+ init_task();
64281
+ }
64282
+ });
64283
+
64284
+ // src/lib/responses/TagList.ts
64285
+ function singleSorted(a, b) {
64286
+ const aIsNum = isNaN(a);
64287
+ const bIsNum = isNaN(b);
64288
+ if (aIsNum !== bIsNum) {
64289
+ return aIsNum ? 1 : -1;
64290
+ }
64291
+ return aIsNum ? sorted(a, b) : 0;
64292
+ }
64293
+ function sorted(a, b) {
64294
+ return a === b ? 0 : a > b ? 1 : -1;
64295
+ }
64296
+ function trimmed(input) {
64297
+ return input.trim();
64298
+ }
64299
+ function toNumber$3(input) {
64300
+ if (typeof input === "string") {
64301
+ return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
64302
+ }
64303
+ return 0;
64304
+ }
64305
+ var TagList, parseTagList;
64306
+ var init_TagList = __esm({
64307
+ "src/lib/responses/TagList.ts"() {
64308
+ TagList = class {
64309
+ constructor(all, latest) {
64310
+ this.all = all;
64311
+ this.latest = latest;
64312
+ }
64313
+ };
64314
+ parseTagList = function(data, customSort = false) {
64315
+ const tags = data.split("\n").map(trimmed).filter(Boolean);
64316
+ if (!customSort) {
64317
+ tags.sort(function(tagA, tagB) {
64318
+ const partsA = tagA.split(".");
64319
+ const partsB = tagB.split(".");
64320
+ if (partsA.length === 1 || partsB.length === 1) {
64321
+ return singleSorted(toNumber$3(partsA[0]), toNumber$3(partsB[0]));
64322
+ }
64323
+ for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
64324
+ const diff = sorted(toNumber$3(partsA[i]), toNumber$3(partsB[i]));
64325
+ if (diff) {
64326
+ return diff;
64327
+ }
64328
+ }
64329
+ return 0;
64330
+ });
64331
+ }
64332
+ const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
64333
+ return new TagList(tags, latest);
64334
+ };
64335
+ }
64336
+ });
64337
+
64338
+ // src/lib/tasks/tag.ts
64339
+ var tag_exports = {};
64340
+ __export(tag_exports, {
64341
+ addAnnotatedTagTask: () => addAnnotatedTagTask,
64342
+ addTagTask: () => addTagTask,
64343
+ tagListTask: () => tagListTask
64344
+ });
64345
+ function tagListTask(customArgs = []) {
64346
+ const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
64347
+ return {
64348
+ format: "utf-8",
64349
+ commands: ["tag", "-l", ...customArgs],
64350
+ parser(text) {
64351
+ return parseTagList(text, hasCustomSort);
64352
+ }
64353
+ };
64354
+ }
64355
+ function addTagTask(name) {
64356
+ return {
64357
+ format: "utf-8",
64358
+ commands: ["tag", name],
64359
+ parser() {
64360
+ return { name };
64361
+ }
64362
+ };
64363
+ }
64364
+ function addAnnotatedTagTask(name, tagMessage) {
64365
+ return {
64366
+ format: "utf-8",
64367
+ commands: ["tag", "-a", "-m", tagMessage, name],
64368
+ parser() {
64369
+ return { name };
64370
+ }
64371
+ };
64372
+ }
64373
+ var init_tag = __esm({
64374
+ "src/lib/tasks/tag.ts"() {
64375
+ init_TagList();
64376
+ }
64377
+ });
64378
+
64379
+ // src/git.js
64380
+ var require_git = __commonJS({
64381
+ "src/git.js"(exports, module) {
64382
+ var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
64383
+ var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
64384
+ var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
64385
+ var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
64386
+ var {
64387
+ asArray: asArray2,
64388
+ filterArray: filterArray2,
64389
+ filterPrimitives: filterPrimitives2,
64390
+ filterString: filterString2,
64391
+ filterStringOrStringArray: filterStringOrStringArray2,
64392
+ filterType: filterType2,
64393
+ getTrailingOptions: getTrailingOptions2,
64394
+ trailingFunctionArgument: trailingFunctionArgument2,
64395
+ trailingOptionsArgument: trailingOptionsArgument2
64396
+ } = (init_utils(), __toCommonJS(utils_exports));
64397
+ var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
64398
+ var {
64399
+ branchTask: branchTask2,
64400
+ branchLocalTask: branchLocalTask2,
64401
+ deleteBranchesTask: deleteBranchesTask2,
64402
+ deleteBranchTask: deleteBranchTask2
64403
+ } = (init_branch(), __toCommonJS(branch_exports));
64404
+ var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
64405
+ var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
64406
+ var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
64407
+ var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
64408
+ var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
64409
+ var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
64410
+ var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
64411
+ var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
64412
+ var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
64413
+ var {
64414
+ addRemoteTask: addRemoteTask2,
64415
+ getRemotesTask: getRemotesTask2,
64416
+ listRemotesTask: listRemotesTask2,
64417
+ remoteTask: remoteTask2,
64418
+ removeRemoteTask: removeRemoteTask2
64419
+ } = (init_remote(), __toCommonJS(remote_exports));
64420
+ var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
64421
+ var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
64422
+ var {
64423
+ addSubModuleTask: addSubModuleTask2,
64424
+ initSubModuleTask: initSubModuleTask2,
64425
+ subModuleTask: subModuleTask2,
64426
+ updateSubModuleTask: updateSubModuleTask2
64427
+ } = (init_sub_module(), __toCommonJS(sub_module_exports));
64428
+ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
64429
+ var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
64430
+ function Git2(options, plugins) {
64431
+ this._executor = new GitExecutor2(options.binary, options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins);
64432
+ this._trimmed = options.trimmed;
64433
+ }
64434
+ (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
64435
+ Git2.prototype.customBinary = function(command) {
64436
+ this._executor.binary = command;
64437
+ return this;
64438
+ };
64439
+ Git2.prototype.env = function(name, value) {
64440
+ if (arguments.length === 1 && typeof name === "object") {
64441
+ this._executor.env = name;
64442
+ } else {
64443
+ (this._executor.env = this._executor.env || {})[name] = value;
64444
+ }
64445
+ return this;
64446
+ };
64447
+ Git2.prototype.stashList = function(options) {
64448
+ return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments));
64449
+ };
64450
+ function createCloneTask(api, task, repoPath, localPath) {
64451
+ if (typeof repoPath !== "string") {
64452
+ return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
64453
+ }
64454
+ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
64455
+ }
64456
+ Git2.prototype.clone = function() {
64457
+ return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments));
64458
+ };
64459
+ Git2.prototype.mirror = function() {
64460
+ return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments));
64461
+ };
64462
+ Git2.prototype.mv = function(from, to) {
64463
+ return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
64464
+ };
64465
+ Git2.prototype.checkoutLatestTag = function(then) {
64466
+ var git = this;
64467
+ return this.pull(function() {
64468
+ git.tags(function(err, tags) {
64469
+ git.checkout(tags.latest, then);
64470
+ });
64471
+ });
64472
+ };
64473
+ Git2.prototype.pull = function(remote, branch, options, then) {
64474
+ return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64475
+ };
64476
+ Git2.prototype.fetch = function(remote, branch) {
64477
+ return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64478
+ };
64479
+ Git2.prototype.silent = function(silence) {
64480
+ console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");
64481
+ return this;
64482
+ };
64483
+ Git2.prototype.tags = function(options, then) {
64484
+ return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64485
+ };
64486
+ Git2.prototype.rebase = function() {
64487
+ return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments));
64488
+ };
64489
+ Git2.prototype.reset = function(mode) {
64490
+ return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64491
+ };
64492
+ Git2.prototype.revert = function(commit) {
64493
+ const next = trailingFunctionArgument2(arguments);
64494
+ if (typeof commit !== "string") {
64495
+ return this._runTask(configurationErrorTask2("Commit must be a string"), next);
64496
+ }
64497
+ return this._runTask(straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]), next);
64498
+ };
64499
+ Git2.prototype.addTag = function(name) {
64500
+ const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
64501
+ return this._runTask(task, trailingFunctionArgument2(arguments));
64502
+ };
64503
+ Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
64504
+ return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments));
64505
+ };
64506
+ Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
64507
+ return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
64508
+ };
64509
+ Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
64510
+ return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
64511
+ };
64512
+ Git2.prototype.branch = function(options, then) {
64513
+ return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64514
+ };
64515
+ Git2.prototype.branchLocal = function(then) {
64516
+ return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
64517
+ };
64518
+ Git2.prototype.raw = function(commands) {
64519
+ const createRestCommands = !Array.isArray(commands);
64520
+ const command = [].slice.call(createRestCommands ? arguments : commands, 0);
64521
+ for (let i = 0; i < command.length && createRestCommands; i++) {
64522
+ if (!filterPrimitives2(command[i])) {
64523
+ command.splice(i, command.length - i);
64524
+ break;
64525
+ }
64526
+ }
64527
+ command.push(...getTrailingOptions2(arguments, 0, true));
64528
+ var next = trailingFunctionArgument2(arguments);
64529
+ if (!command.length) {
64530
+ return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next);
64531
+ }
64532
+ return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
64533
+ };
64534
+ Git2.prototype.submoduleAdd = function(repo, path, then) {
64535
+ return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));
64536
+ };
64537
+ Git2.prototype.submoduleUpdate = function(args, then) {
64538
+ return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
64539
+ };
64540
+ Git2.prototype.submoduleInit = function(args, then) {
64541
+ return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
64542
+ };
64543
+ Git2.prototype.subModule = function(options, then) {
64544
+ return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64545
+ };
64546
+ Git2.prototype.listRemote = function() {
64547
+ return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64548
+ };
64549
+ Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
64550
+ return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64551
+ };
64552
+ Git2.prototype.removeRemote = function(remoteName, then) {
64553
+ return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
64554
+ };
64555
+ Git2.prototype.getRemotes = function(verbose, then) {
64556
+ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
64557
+ };
64558
+ Git2.prototype.remote = function(options, then) {
64559
+ return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
64560
+ };
64561
+ Git2.prototype.tag = function(options, then) {
64562
+ const command = getTrailingOptions2(arguments);
64563
+ if (command[0] !== "tag") {
64564
+ command.unshift("tag");
64565
+ }
64566
+ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
64567
+ };
64568
+ Git2.prototype.updateServerInfo = function(then) {
64569
+ return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments));
64570
+ };
64571
+ Git2.prototype.pushTags = function(remote, then) {
64572
+ const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments));
64573
+ return this._runTask(task, trailingFunctionArgument2(arguments));
64574
+ };
64575
+ Git2.prototype.rm = function(files) {
64576
+ return this._runTask(straightThroughStringTask2(["rm", "-f", ...asArray2(files)]), trailingFunctionArgument2(arguments));
64577
+ };
64578
+ Git2.prototype.rmKeepLocal = function(files) {
64579
+ return this._runTask(straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]), trailingFunctionArgument2(arguments));
64580
+ };
64581
+ Git2.prototype.catFile = function(options, then) {
64582
+ return this._catFile("utf-8", arguments);
64583
+ };
64584
+ Git2.prototype.binaryCatFile = function() {
64585
+ return this._catFile("buffer", arguments);
64586
+ };
64587
+ Git2.prototype._catFile = function(format, args) {
64588
+ var handler = trailingFunctionArgument2(args);
64589
+ var command = ["cat-file"];
64590
+ var options = args[0];
64591
+ if (typeof options === "string") {
64592
+ return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler);
64593
+ }
64594
+ if (Array.isArray(options)) {
64595
+ command.push.apply(command, options);
64596
+ }
64597
+ const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
64598
+ return this._runTask(task, handler);
64599
+ };
64600
+ Git2.prototype.diff = function(options, then) {
64601
+ const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
64602
+ return this._runTask(task, trailingFunctionArgument2(arguments));
64603
+ };
64604
+ Git2.prototype.diffSummary = function() {
64605
+ return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments));
64606
+ };
64607
+ Git2.prototype.applyPatch = function(patches) {
64608
+ const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
64609
+ return this._runTask(task, trailingFunctionArgument2(arguments));
64610
+ };
64611
+ Git2.prototype.revparse = function() {
64612
+ const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
64613
+ return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments));
64614
+ };
64615
+ Git2.prototype.clean = function(mode, options, then) {
64616
+ const usingCleanOptionsArray = isCleanOptionsArray2(mode);
64617
+ const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
64618
+ const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
64619
+ return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments));
64620
+ };
64621
+ Git2.prototype.exec = function(then) {
64622
+ const task = {
64623
+ commands: [],
64624
+ format: "utf-8",
64625
+ parser() {
64626
+ if (typeof then === "function") {
64627
+ then();
64628
+ }
64629
+ }
64630
+ };
64631
+ return this._runTask(task);
64632
+ };
64633
+ Git2.prototype.clearQueue = function() {
64634
+ return this;
64635
+ };
64636
+ Git2.prototype.checkIgnore = function(pathnames, then) {
64637
+ return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments));
64638
+ };
64639
+ Git2.prototype.checkIsRepo = function(checkType, then) {
64640
+ return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments));
64641
+ };
64642
+ module.exports = Git2;
64643
+ }
64644
+ });
64645
+
64646
+ // src/lib/api.ts
64647
+ init_pathspec();
64648
+
64649
+ // src/lib/errors/git-construct-error.ts
64650
+ init_git_error();
64651
+ var GitConstructError = class extends GitError {
64652
+ constructor(config, message) {
64653
+ super(void 0, message);
64654
+ this.config = config;
64655
+ }
64656
+ };
64657
+
64658
+ // src/lib/api.ts
64659
+ init_git_error();
64660
+
64661
+ // src/lib/errors/git-plugin-error.ts
64662
+ init_git_error();
64663
+ var GitPluginError = class extends GitError {
64664
+ constructor(task, plugin, message) {
64665
+ super(task, message);
64666
+ this.task = task;
64667
+ this.plugin = plugin;
64668
+ Object.setPrototypeOf(this, new.target.prototype);
64669
+ }
64670
+ };
64671
+
64672
+ // src/lib/api.ts
64673
+ init_git_response_error();
64674
+ init_task_configuration_error();
64675
+ init_check_is_repo();
64676
+ init_clean();
64677
+ init_config();
64678
+ init_diff_name_status();
64679
+ init_grep();
64680
+ init_reset();
64681
+
64682
+ // src/lib/plugins/abort-plugin.ts
64683
+ function abortPlugin(signal) {
64684
+ if (!signal) {
64685
+ return;
64686
+ }
64687
+ const onSpawnAfter = {
64688
+ type: "spawn.after",
64689
+ action(_data, context) {
64690
+ function kill() {
64691
+ context.kill(new GitPluginError(void 0, "abort", "Abort signal received"));
64692
+ }
64693
+ signal.addEventListener("abort", kill);
64694
+ context.spawned.on("close", () => signal.removeEventListener("abort", kill));
64695
+ }
64696
+ };
64697
+ const onSpawnBefore = {
64698
+ type: "spawn.before",
64699
+ action(_data, context) {
64700
+ if (signal.aborted) {
64701
+ context.kill(new GitPluginError(void 0, "abort", "Abort already signaled"));
64702
+ }
64703
+ }
64704
+ };
64705
+ return [onSpawnBefore, onSpawnAfter];
64706
+ }
64707
+
64708
+ // src/lib/plugins/block-unsafe-operations-plugin.ts
64709
+ function isConfigSwitch(arg) {
64710
+ return typeof arg === "string" && arg.trim().toLowerCase() === "-c";
64711
+ }
64712
+ function preventProtocolOverride(arg, next) {
64713
+ if (!isConfigSwitch(arg)) {
64714
+ return;
64715
+ }
64716
+ if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) {
64717
+ return;
64718
+ }
64719
+ throw new GitPluginError(void 0, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol");
64720
+ }
64721
+ function preventUploadPack(arg, method) {
64722
+ if (/^\s*--(upload|receive)-pack/.test(arg)) {
64723
+ throw new GitPluginError(void 0, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`);
64724
+ }
64725
+ if (method === "clone" && /^\s*-u\b/.test(arg)) {
64726
+ throw new GitPluginError(void 0, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`);
64727
+ }
64728
+ if (method === "push" && /^\s*--exec\b/.test(arg)) {
64729
+ throw new GitPluginError(void 0, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`);
64730
+ }
64731
+ }
64732
+ function blockUnsafeOperationsPlugin({
64733
+ allowUnsafeProtocolOverride = false,
64734
+ allowUnsafePack = false
64735
+ } = {}) {
64736
+ return {
64737
+ type: "spawn.args",
64738
+ action(args, context) {
64739
+ args.forEach((current, index) => {
64740
+ const next = index < args.length ? args[index + 1] : "";
64741
+ allowUnsafeProtocolOverride || preventProtocolOverride(current, next);
64742
+ allowUnsafePack || preventUploadPack(current, context.method);
64743
+ });
64744
+ return args;
64745
+ }
64746
+ };
64747
+ }
64748
+
64749
+ // src/lib/plugins/command-config-prefixing-plugin.ts
64750
+ init_utils();
64751
+ function commandConfigPrefixingPlugin(configuration) {
64752
+ const prefix = prefixedArray(configuration, "-c");
64753
+ return {
64754
+ type: "spawn.args",
64755
+ action(data) {
64756
+ return [...prefix, ...data];
64757
+ }
64758
+ };
64759
+ }
64760
+
64761
+ // src/lib/plugins/completion-detection.plugin.ts
64762
+ init_utils();
64763
+ var never = deferred_1().promise;
64764
+ function completionDetectionPlugin({
64765
+ onClose = true,
64766
+ onExit = 50
64767
+ } = {}) {
64768
+ function createEvents() {
64769
+ let exitCode = -1;
64770
+ const events = {
64771
+ close: deferred_1(),
64772
+ closeTimeout: deferred_1(),
64773
+ exit: deferred_1(),
64774
+ exitTimeout: deferred_1()
64775
+ };
64776
+ const result = Promise.race([
64777
+ onClose === false ? never : events.closeTimeout.promise,
64778
+ onExit === false ? never : events.exitTimeout.promise
64779
+ ]);
64780
+ configureTimeout(onClose, events.close, events.closeTimeout);
64781
+ configureTimeout(onExit, events.exit, events.exitTimeout);
64782
+ return {
64783
+ close(code) {
64784
+ exitCode = code;
64785
+ events.close.done();
64786
+ },
64787
+ exit(code) {
64788
+ exitCode = code;
64789
+ events.exit.done();
64790
+ },
64791
+ get exitCode() {
64792
+ return exitCode;
64793
+ },
64794
+ result
64795
+ };
64796
+ }
64797
+ function configureTimeout(flag, event, timeout) {
64798
+ if (flag === false) {
64799
+ return;
64800
+ }
64801
+ (flag === true ? event.promise : event.promise.then(() => delay$3(flag))).then(timeout.done);
64802
+ }
64803
+ return {
64804
+ type: "spawn.after",
64805
+ action(_0, _1) {
64806
+ return __async(this, arguments, function* (_data, { spawned, close }) {
64807
+ var _a2, _b;
64808
+ const events = createEvents();
64809
+ let deferClose = true;
64810
+ let quickClose = () => void (deferClose = false);
64811
+ (_a2 = spawned.stdout) == null ? void 0 : _a2.on("data", quickClose);
64812
+ (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose);
64813
+ spawned.on("error", quickClose);
64814
+ spawned.on("close", (code) => events.close(code));
64815
+ spawned.on("exit", (code) => events.exit(code));
64816
+ try {
64817
+ yield events.result;
64818
+ if (deferClose) {
64819
+ yield delay$3(50);
64820
+ }
64821
+ close(events.exitCode);
64822
+ } catch (err) {
64823
+ close(events.exitCode, err);
64824
+ }
64825
+ });
64826
+ }
64827
+ };
64828
+ }
64829
+
64830
+ // src/lib/plugins/error-detection.plugin.ts
64831
+ init_git_error();
64832
+ function isTaskError(result) {
64833
+ return !!(result.exitCode && result.stdErr.length);
64834
+ }
64835
+ function getErrorMessage$1(result) {
64836
+ return Buffer.concat([...result.stdOut, ...result.stdErr]);
64837
+ }
64838
+ function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage$1) {
64839
+ return (error, result) => {
64840
+ if (!overwrite && error || !isError(result)) {
64841
+ return error;
64842
+ }
64843
+ return errorMessage(result);
64844
+ };
64845
+ }
64846
+ function errorDetectionPlugin(config) {
64847
+ return {
64848
+ type: "task.error",
64849
+ action(data, context) {
64850
+ const error = config(data.error, {
64851
+ stdErr: context.stdErr,
64852
+ stdOut: context.stdOut,
64853
+ exitCode: context.exitCode
64854
+ });
64855
+ if (Buffer.isBuffer(error)) {
64856
+ return { error: new GitError(void 0, error.toString("utf-8")) };
64857
+ }
64858
+ return {
64859
+ error
64860
+ };
64861
+ }
64862
+ };
64863
+ }
64864
+
64865
+ // src/lib/plugins/plugin-store.ts
64866
+ init_utils();
64867
+ var PluginStore = class {
64868
+ constructor() {
64869
+ this.plugins = /* @__PURE__ */ new Set();
64870
+ }
64871
+ add(plugin) {
64872
+ const plugins = [];
64873
+ asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));
64874
+ return () => {
64875
+ plugins.forEach((plugin2) => this.plugins.delete(plugin2));
64876
+ };
64877
+ }
64878
+ exec(type, data, context) {
64879
+ let output = data;
64880
+ const contextual = Object.freeze(Object.create(context));
64881
+ for (const plugin of this.plugins) {
64882
+ if (plugin.type === type) {
64883
+ output = plugin.action(output, contextual);
64884
+ }
64885
+ }
64886
+ return output;
64887
+ }
64888
+ };
64889
+
64890
+ // src/lib/plugins/progress-monitor-plugin.ts
64891
+ init_utils();
64892
+ function progressMonitorPlugin(progress) {
64893
+ const progressCommand = "--progress";
64894
+ const progressMethods = ["checkout", "clone", "fetch", "pull", "push"];
64895
+ const onProgress = {
64896
+ type: "spawn.after",
64897
+ action(_data, context) {
64898
+ var _a2;
64899
+ if (!context.commands.includes(progressCommand)) {
64900
+ return;
64901
+ }
64902
+ (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => {
64903
+ const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
64904
+ if (!message) {
64905
+ return;
64906
+ }
64907
+ progress({
64908
+ method: context.method,
64909
+ stage: progressEventStage(message[1]),
64910
+ progress: asNumber(message[2]),
64911
+ processed: asNumber(message[3]),
64912
+ total: asNumber(message[4])
64913
+ });
64914
+ });
64915
+ }
64916
+ };
64917
+ const onArgs = {
64918
+ type: "spawn.args",
64919
+ action(args, context) {
64920
+ if (!progressMethods.includes(context.method)) {
64921
+ return args;
64922
+ }
64923
+ return including(args, progressCommand);
64924
+ }
64925
+ };
64926
+ return [onArgs, onProgress];
64927
+ }
64928
+ function progressEventStage(input) {
64929
+ return String(input.toLowerCase().split(" ", 1)) || "unknown";
64930
+ }
64931
+
64932
+ // src/lib/plugins/spawn-options-plugin.ts
64933
+ init_utils();
64934
+ function spawnOptionsPlugin(spawnOptions) {
64935
+ const options = pick(spawnOptions, ["uid", "gid"]);
64936
+ return {
64937
+ type: "spawn.options",
64938
+ action(data) {
64939
+ return __spreadValues(__spreadValues({}, options), data);
64940
+ }
64941
+ };
64942
+ }
64943
+
64944
+ // src/lib/plugins/timout-plugin.ts
64945
+ function timeoutPlugin({
64946
+ block,
64947
+ stdErr = true,
64948
+ stdOut = true
64949
+ }) {
64950
+ if (block > 0) {
64951
+ return {
64952
+ type: "spawn.after",
64953
+ action(_data, context) {
64954
+ var _a2, _b;
64955
+ let timeout;
64956
+ function wait() {
64957
+ timeout && clearTimeout(timeout);
64958
+ timeout = setTimeout(kill, block);
64959
+ }
64960
+ function stop() {
64961
+ var _a3, _b2;
64962
+ (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait);
64963
+ (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait);
64964
+ context.spawned.off("exit", stop);
64965
+ context.spawned.off("close", stop);
64966
+ timeout && clearTimeout(timeout);
64967
+ }
64968
+ function kill() {
64969
+ stop();
64970
+ context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
64971
+ }
64972
+ stdOut && ((_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait));
64973
+ stdErr && ((_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait));
64974
+ context.spawned.on("exit", stop);
64975
+ context.spawned.on("close", stop);
64976
+ wait();
64977
+ }
64978
+ };
64979
+ }
64980
+ }
64981
+
64982
+ // src/lib/plugins/suffix-paths.plugin.ts
64983
+ init_pathspec();
64984
+ function suffixPathsPlugin() {
64985
+ return {
64986
+ type: "spawn.args",
64987
+ action(data) {
64988
+ const prefix = [];
64989
+ let suffix;
64990
+ function append2(args) {
64991
+ (suffix = suffix || []).push(...args);
64992
+ }
64993
+ for (let i = 0; i < data.length; i++) {
64994
+ const param = data[i];
64995
+ if (isPathSpec(param)) {
64996
+ append2(toPaths(param));
64997
+ continue;
64998
+ }
64999
+ if (param === "--") {
65000
+ append2(data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item));
65001
+ break;
65002
+ }
65003
+ prefix.push(param);
65004
+ }
65005
+ return !suffix ? prefix : [...prefix, "--", ...suffix.map(String)];
65006
+ }
65007
+ };
65008
+ }
65009
+
65010
+ // src/lib/git-factory.ts
65011
+ init_utils();
65012
+ var Git = require_git();
65013
+ function gitInstanceFactory(baseDir, options) {
65014
+ const plugins = new PluginStore();
65015
+ const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options);
65016
+ if (!folderExists(config.baseDir)) {
65017
+ throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);
65018
+ }
65019
+ if (Array.isArray(config.config)) {
65020
+ plugins.add(commandConfigPrefixingPlugin(config.config));
65021
+ }
65022
+ plugins.add(blockUnsafeOperationsPlugin(config.unsafe));
65023
+ plugins.add(suffixPathsPlugin());
65024
+ plugins.add(completionDetectionPlugin(config.completion));
65025
+ config.abort && plugins.add(abortPlugin(config.abort));
65026
+ config.progress && plugins.add(progressMonitorPlugin(config.progress));
65027
+ config.timeout && plugins.add(timeoutPlugin(config.timeout));
65028
+ config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
65029
+ plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
65030
+ config.errors && plugins.add(errorDetectionPlugin(config.errors));
65031
+ return new Git(config, plugins);
65032
+ }
65033
+
65034
+ // src/lib/runners/promise-wrapped.ts
65035
+ init_git_response_error();
65036
+
65037
+ // src/esm.mjs
65038
+ var simpleGit = gitInstanceFactory;class Dirty_git_db extends AbstractDatabase {
60882
65039
  db;
60883
65040
  constructor(settings) {
60884
65041
  super(settings);
@@ -60914,8 +65071,8 @@ class Dirty_db extends AbstractDatabase {
60914
65071
  }
60915
65072
  set(key, value, callback) {
60916
65073
  this.db.set(key, value, callback);
60917
- const databasePath = require('path').dirname(this.settings.filename);
60918
- require('simple-git')(databasePath)
65074
+ const databasePath = node_path.dirname(this.settings.filename);
65075
+ simpleGit(databasePath)
60919
65076
  .silent(true)
60920
65077
  .add('./*.db')
60921
65078
  .commit('Automated commit...')
@@ -60954,7 +65111,7 @@ function redactObject(obj, additionalKeys = []) {
60954
65111
  if (value instanceof URL) {
60955
65112
  value = `${value.origin}${value.pathname}${value.search}`;
60956
65113
  }
60957
- if (typeof value === 'object' && value !== null) {
65114
+ if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
60958
65115
  if (seen.get(value) !== true) {
60959
65116
  // if this Object hasn't been seen, recursively redact it
60960
65117
  seen.set(value, true);
@@ -62031,7 +66188,7 @@ var _a$9;
62031
66188
  Object.defineProperty(Serializer$4, "__esModule", { value: true });
62032
66189
  const tslib_1$5 = require$$0$4;
62033
66190
  const querystring_1 = require$$1$5;
62034
- const debug_1$6 = tslib_1$5.__importDefault(requireSrc());
66191
+ const debug_1$6 = tslib_1$5.__importDefault(srcExports);
62035
66192
  const secure_json_parse_1 = tslib_1$5.__importDefault(requireSecureJsonParse());
62036
66193
  const errors_1$a = errors$e;
62037
66194
  const symbols_1$1 = requireSymbols$5();
@@ -62114,7 +66271,7 @@ let Serializer$3=class Serializer {
62114
66271
  };
62115
66272
  Serializer$4.default = Serializer$3;
62116
66273
  _a$9 = symbols_1$1.kJsonOptions;var name$8 = "@elastic/transport";
62117
- var version$8 = "8.4.0";
66274
+ var version$8 = "8.4.1";
62118
66275
  var description$4 = "Transport classes and utilities shared among Node.js Elastic client libraries";
62119
66276
  var main$6 = "index.js";
62120
66277
  var types$7 = "index.d.ts";
@@ -62227,7 +66384,7 @@ var _a$8, _b$1, _c$1, _d$1, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s,
62227
66384
  Object.defineProperty(Transport$3, "__esModule", { value: true });
62228
66385
  Transport$3.lowerCaseHeaders = Transport$3.generateRequestId = void 0;
62229
66386
  const tslib_1$4 = require$$0$4;
62230
- const debug_1$5 = tslib_1$4.__importDefault(requireSrc());
66387
+ const debug_1$5 = tslib_1$4.__importDefault(srcExports);
62231
66388
  const os_1$1 = tslib_1$4.__importDefault(os$3);
62232
66389
  const zlib_1$1 = tslib_1$4.__importDefault(require$$0$d);
62233
66390
  const buffer_1$2 = tslib_1$4.__importDefault(require$$0$h);
@@ -63226,7 +67383,7 @@ function requireHttpConnection () {
63226
67383
  const hpagent_1 = tslib_1.__importDefault(requireHpagent());
63227
67384
  const http_1 = tslib_1.__importDefault(http$5);
63228
67385
  const https_1 = tslib_1.__importDefault(https$6);
63229
- const debug_1 = tslib_1.__importDefault(requireSrc());
67386
+ const debug_1 = tslib_1.__importDefault(srcExports);
63230
67387
  const buffer_1 = tslib_1.__importDefault(require$$0$h);
63231
67388
  const BaseConnection_1 = tslib_1.__importStar(requireBaseConnection());
63232
67389
  const symbols_1 = requireSymbols$5();
@@ -64972,7 +69129,7 @@ function requireDicer () {
64972
69129
  if (this._headerFirst && this._isPreamble) {
64973
69130
  if (!this._part) {
64974
69131
  this._part = new PartStream(this._partOpts);
64975
- if (this._events.preamble) { this.emit('preamble', this._part); } else { this._ignore(); }
69132
+ if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part); } else { this._ignore(); }
64976
69133
  }
64977
69134
  const r = this._hparser.push(data);
64978
69135
  if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r); } else { return cb() }
@@ -65029,7 +69186,7 @@ function requireDicer () {
65029
69186
  }
65030
69187
  }
65031
69188
  if (this._dashes === 2) {
65032
- if ((start + i) < end && this._events.trailer) { this.emit('trailer', data.slice(start + i, end)); }
69189
+ if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)); }
65033
69190
  this.reset();
65034
69191
  this._finished = true;
65035
69192
  // no more parts will be added
@@ -65047,7 +69204,13 @@ function requireDicer () {
65047
69204
  this._part._read = function (n) {
65048
69205
  self._unpause();
65049
69206
  };
65050
- if (this._isPreamble && this._events.preamble) { this.emit('preamble', this._part); } else if (this._isPreamble !== true && this._events.part) { this.emit('part', this._part); } else { this._ignore(); }
69207
+ if (this._isPreamble && this.listenerCount('preamble') !== 0) {
69208
+ this.emit('preamble', this._part);
69209
+ } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) {
69210
+ this.emit('part', this._part);
69211
+ } else {
69212
+ this._ignore();
69213
+ }
65051
69214
  if (!this._isPreamble) { this._inHeader = true; }
65052
69215
  }
65053
69216
  if (data && start < end && !this._ignoreData) {
@@ -65203,7 +69366,7 @@ function requireDecodeText () {
65203
69366
  if (textDecoders.has(this.toString())) {
65204
69367
  try {
65205
69368
  return textDecoders.get(this).decode(data)
65206
- } catch (e) { }
69369
+ } catch {}
65207
69370
  }
65208
69371
  return typeof data === 'string'
65209
69372
  ? data
@@ -65613,7 +69776,7 @@ function requireMultipart () {
65613
69776
 
65614
69777
  ++nfiles;
65615
69778
 
65616
- if (!boy._events.file) {
69779
+ if (boy.listenerCount('file') === 0) {
65617
69780
  self.parser._ignore();
65618
69781
  return
65619
69782
  }
@@ -86885,7 +91048,7 @@ function requireUndiciConnection () {
86885
91048
  const tslib_1 = require$$0$4;
86886
91049
  /* eslint-disable @typescript-eslint/restrict-template-expressions */
86887
91050
  const events_1 = require$$0$8;
86888
- const debug_1 = tslib_1.__importDefault(requireSrc());
91051
+ const debug_1 = tslib_1.__importDefault(srcExports);
86889
91052
  const buffer_1 = tslib_1.__importDefault(require$$0$h);
86890
91053
  const BaseConnection_1 = tslib_1.__importStar(requireBaseConnection());
86891
91054
  const undici_1 = requireUndici();
@@ -87171,7 +91334,7 @@ function requireBaseConnectionPool () {
87171
91334
  Object.defineProperty(BaseConnectionPool$3, "__esModule", { value: true });
87172
91335
  const tslib_1 = require$$0$4;
87173
91336
  const url_1 = require$$0$e;
87174
- const debug_1 = tslib_1.__importDefault(requireSrc());
91337
+ const debug_1 = tslib_1.__importDefault(srcExports);
87175
91338
  const Diagnostic_1 = tslib_1.__importDefault(Diagnostic$2);
87176
91339
  const symbols_1 = requireSymbols$5();
87177
91340
  const connection_1 = connection$5;
@@ -87645,7 +91808,7 @@ function requireClusterConnectionPool () {
87645
91808
  const tslib_1 = require$$0$4;
87646
91809
  const BaseConnectionPool_1 = tslib_1.__importDefault(requireBaseConnectionPool());
87647
91810
  const assert_1 = tslib_1.__importDefault(require$$0$g);
87648
- const debug_1 = tslib_1.__importDefault(requireSrc());
91811
+ const debug_1 = tslib_1.__importDefault(srcExports);
87649
91812
  const connection_1 = connection$5;
87650
91813
  const debug = (0, debug_1.default)('elasticsearch');
87651
91814
  class ClusterConnectionPool extends BaseConnectionPool_1.default {
@@ -103086,8 +107249,8 @@ function requireApi () {
103086
107249
 
103087
107250
  return api$1;
103088
107251
  }var name$7 = "@elastic/elasticsearch";
103089
- var version$7 = "8.12.1";
103090
- var versionCanary = "8.12.1-canary.0";
107252
+ var version$7 = "8.12.2";
107253
+ var versionCanary = "8.12.2-canary.0";
103091
107254
  var description$3 = "The official Elasticsearch client for Node.js";
103092
107255
  var main$4 = "index.js";
103093
107256
  var types$6 = "index.d.ts";
@@ -103169,7 +107332,7 @@ var devDependencies$4 = {
103169
107332
  zx: "^7.2.2"
103170
107333
  };
103171
107334
  var dependencies$4 = {
103172
- "@elastic/transport": "^8.4.0",
107335
+ "@elastic/transport": "^8.4.1",
103173
107336
  tslib: "^2.4.0"
103174
107337
  };
103175
107338
  var tap = {
@@ -191420,7 +195583,7 @@ var error$3 = {
191420
195583
  RequestError: RequestError$3,
191421
195584
  TransactionError: TransactionError$3
191422
195585
  };const { EventEmitter: EventEmitter$a } = require$$0$i;
191423
- const debug$d = requireSrc()('mssql:base');
195586
+ const debug$d = srcExports('mssql:base');
191424
195587
  const { parseSqlConnectionString } = lib$4;
191425
195588
  const tarn = tarnExports;
191426
195589
  const { IDS: IDS$6 } = utils$7;
@@ -192254,7 +196417,7 @@ var connectionPool$1 = ConnectionPool$1;var globalConnection$3 = {exports: {}};(
192254
196417
  });
192255
196418
  } (globalConnection$3));
192256
196419
 
192257
- var globalConnectionExports = globalConnection$3.exports;const debug$c = requireSrc()('mssql:base');
196420
+ var globalConnectionExports = globalConnection$3.exports;const debug$c = srcExports('mssql:base');
192258
196421
  const { EventEmitter: EventEmitter$9 } = require$$0$i;
192259
196422
  const { IDS: IDS$5, objectHasProperty: objectHasProperty$2 } = utils$7;
192260
196423
  const globalConnection$2 = globalConnectionExports;
@@ -192635,7 +196798,7 @@ class PreparedStatement extends EventEmitter$9 {
192635
196798
  }
192636
196799
  }
192637
196800
 
192638
- var preparedStatement = PreparedStatement;const debug$b = requireSrc()('mssql:base');
196801
+ var preparedStatement = PreparedStatement;const debug$b = srcExports('mssql:base');
192639
196802
  const { EventEmitter: EventEmitter$8 } = require$$0$i;
192640
196803
  const { Readable: Readable$1 } = require$$0$j;
192641
196804
  const { IDS: IDS$4, objectHasProperty: objectHasProperty$1 } = utils$7;
@@ -193280,7 +197443,7 @@ var request$2 = Request$1;var isolationlevel = {
193280
197443
  REPEATABLE_READ: 0x03,
193281
197444
  SERIALIZABLE: 0x04,
193282
197445
  SNAPSHOT: 0x05
193283
- };const debug$a = requireSrc()('mssql:base');
197446
+ };const debug$a = srcExports('mssql:base');
193284
197447
  const { EventEmitter: EventEmitter$7 } = require$$0$i;
193285
197448
  const { IDS: IDS$3 } = utils$7;
193286
197449
  const globalConnection = globalConnectionExports;
@@ -214371,7 +218534,7 @@ promisify$2.default = promisify$1;var __importDefault$7 = (commonjsGlobal && com
214371
218534
  return (mod && mod.__esModule) ? mod : { "default": mod };
214372
218535
  };
214373
218536
  const events_1$2 = require$$0$8;
214374
- const debug_1$3 = __importDefault$7(requireSrc());
218537
+ const debug_1$3 = __importDefault$7(srcExports);
214375
218538
  const promisify_1 = __importDefault$7(promisify$2);
214376
218539
  const debug$7 = debug_1$3.default('agent-base');
214377
218540
  function isAgent(v) {
@@ -214571,7 +218734,7 @@ var src$1 = createAgent;var parseProxyResponse$1 = {};var __importDefault$6 = (c
214571
218734
  return (mod && mod.__esModule) ? mod : { "default": mod };
214572
218735
  };
214573
218736
  Object.defineProperty(parseProxyResponse$1, "__esModule", { value: true });
214574
- const debug_1$2 = __importDefault$6(requireSrc());
218737
+ const debug_1$2 = __importDefault$6(srcExports);
214575
218738
  const debug$6 = debug_1$2.default('https-proxy-agent:parse-proxy-response');
214576
218739
  function parseProxyResponse(socket) {
214577
218740
  return new Promise((resolve, reject) => {
@@ -214647,7 +218810,7 @@ const net_1$1 = __importDefault$5(require$$0$7);
214647
218810
  const tls_1$1 = __importDefault$5(require$$1$2);
214648
218811
  const url_1$2 = __importDefault$5(require$$0$e);
214649
218812
  const assert_1$1 = __importDefault$5(require$$0$g);
214650
- const debug_1$1 = __importDefault$5(requireSrc());
218813
+ const debug_1$1 = __importDefault$5(srcExports);
214651
218814
  const agent_base_1$1 = src$1;
214652
218815
  const parse_proxy_response_1 = __importDefault$5(parseProxyResponse$1);
214653
218816
  const debug$5 = debug_1$1.default('https-proxy-agent:agent');
@@ -214852,7 +219015,7 @@ Object.defineProperty(agent, "__esModule", { value: true });
214852
219015
  const net_1 = __importDefault$3(require$$0$7);
214853
219016
  const tls_1 = __importDefault$3(require$$1$2);
214854
219017
  const url_1$1 = __importDefault$3(require$$0$e);
214855
- const debug_1 = __importDefault$3(requireSrc());
219018
+ const debug_1 = __importDefault$3(srcExports);
214856
219019
  const once_1 = __importDefault$3(dist$9);
214857
219020
  const agent_base_1 = src$1;
214858
219021
  const debug$4 = (0, debug_1.default)('http-proxy-agent');
@@ -261137,7 +265300,7 @@ function requireIsPropertyDescriptor () {
261137
265300
 
261138
265301
  var GetIntrinsic = getIntrinsic;
261139
265302
 
261140
- var has = src$3;
265303
+ var has = src$4;
261141
265304
  var $TypeError = GetIntrinsic('%TypeError%');
261142
265305
 
261143
265306
  isPropertyDescriptor = function IsPropertyDescriptor(ES, Desc) {
@@ -261268,7 +265431,7 @@ function requireIsMatchRecord () {
261268
265431
  if (hasRequiredIsMatchRecord) return isMatchRecord;
261269
265432
  hasRequiredIsMatchRecord = 1;
261270
265433
 
261271
- var has = src$3;
265434
+ var has = src$4;
261272
265435
 
261273
265436
  // https://262.ecma-international.org/13.0/#sec-match-records
261274
265437
 
@@ -261295,7 +265458,7 @@ function requireAssertRecord () {
261295
265458
  var $TypeError = GetIntrinsic('%TypeError%');
261296
265459
  var $SyntaxError = GetIntrinsic('%SyntaxError%');
261297
265460
 
261298
- var has = src$3;
265461
+ var has = src$4;
261299
265462
  var isInteger = requireIsInteger();
261300
265463
 
261301
265464
  var isMatchRecord = requireIsMatchRecord();
@@ -261383,7 +265546,7 @@ function requireIsAccessorDescriptor () {
261383
265546
  if (hasRequiredIsAccessorDescriptor) return IsAccessorDescriptor;
261384
265547
  hasRequiredIsAccessorDescriptor = 1;
261385
265548
 
261386
- var has = src$3;
265549
+ var has = src$4;
261387
265550
 
261388
265551
  var Type = requireType();
261389
265552
 
@@ -261412,7 +265575,7 @@ function requireIsDataDescriptor () {
261412
265575
  if (hasRequiredIsDataDescriptor) return IsDataDescriptor$1;
261413
265576
  hasRequiredIsDataDescriptor = 1;
261414
265577
 
261415
- var has = src$3;
265578
+ var has = src$4;
261416
265579
 
261417
265580
  var Type = requireType();
261418
265581
 
@@ -261605,7 +265768,7 @@ function requireToPropertyDescriptor () {
261605
265768
  if (hasRequiredToPropertyDescriptor) return ToPropertyDescriptor;
261606
265769
  hasRequiredToPropertyDescriptor = 1;
261607
265770
 
261608
- var has = src$3;
265771
+ var has = src$4;
261609
265772
 
261610
265773
  var GetIntrinsic = getIntrinsic;
261611
265774
 
@@ -262699,7 +266862,7 @@ function requireInternalSlot () {
262699
266862
  hasRequiredInternalSlot = 1;
262700
266863
 
262701
266864
  var GetIntrinsic = getIntrinsic;
262702
- var has = src$3;
266865
+ var has = src$4;
262703
266866
  var channel = sideChannel();
262704
266867
 
262705
266868
  var $TypeError = GetIntrinsic('%TypeError%');
@@ -267119,7 +271282,7 @@ var connectionExports = connection$2.exports;(function (exports) {
267119
271282
  }
267120
271283
 
267121
271284
  } (tedious));const tds$1 = tedious;
267122
- const debug$2 = requireSrc()('mssql:tedi');
271285
+ const debug$2 = srcExports('mssql:tedi');
267123
271286
  const BaseConnectionPool = connectionPool$1;
267124
271287
  const { IDS: IDS$2 } = utils$7;
267125
271288
  const shared = sharedExports;
@@ -267269,7 +271432,7 @@ class ConnectionPool extends BaseConnectionPool {
267269
271432
  }
267270
271433
  }
267271
271434
 
267272
- var connectionPool = ConnectionPool;const debug$1 = requireSrc()('mssql:tedi');
271435
+ var connectionPool = ConnectionPool;const debug$1 = srcExports('mssql:tedi');
267273
271436
  const BaseTransaction = transaction$2;
267274
271437
  const { IDS: IDS$1 } = utils$7;
267275
271438
  const TransactionError = transactionError;
@@ -267682,7 +271845,7 @@ udt.PARSERS = {
267682
271845
  return parseGeography(buffer, /* isUsingGeometryPoints: */true)
267683
271846
  }
267684
271847
  };const tds = tedious;
267685
- const debug = requireSrc()('mssql:tedi');
271848
+ const debug = srcExports('mssql:tedi');
267686
271849
  const BaseRequest = request$2;
267687
271850
  const RequestError = requestError;
267688
271851
  const { IDS, objectHasProperty } = utils$7;
@@ -280235,7 +284398,7 @@ let Query$4=class Query extends Command$8 {
280235
284398
  this._receivedFieldsCount = 0;
280236
284399
  this._resultIndex = 0;
280237
284400
  this._localStream = null;
280238
- this._unpipeStream = function() {};
284401
+ this._unpipeStream = function () { };
280239
284402
  this._streamFactory = options.infileStreamFactory;
280240
284403
  this._connection = null;
280241
284404
  }
@@ -280360,7 +284523,7 @@ let Query$4=class Query extends Command$8 {
280360
284523
  const onPause = () => {
280361
284524
  this._localStream.pause();
280362
284525
  };
280363
- const onData = function(data) {
284526
+ const onData = function (data) {
280364
284527
  const dataWithHeader = Buffer.allocUnsafe(data.length + 4);
280365
284528
  data.copy(dataWithHeader, 4);
280366
284529
  connection.writePacket(
@@ -280432,7 +284595,7 @@ let Query$4=class Query extends Command$8 {
280432
284595
  }
280433
284596
 
280434
284597
  /* eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }] */
280435
- row(packet, _connection) {
284598
+ row(packet, _connection) {
280436
284599
  if (packet.isEOF()) {
280437
284600
  const status = packet.eofStatusFlags();
280438
284601
  const moreResults = status & ServerStatus.SERVER_MORE_RESULTS_EXISTS;
@@ -280484,11 +284647,13 @@ let Query$4=class Query extends Command$8 {
280484
284647
  });
280485
284648
  this.on('end', () => {
280486
284649
  stream.push(null); // pushing null, indicating EOF
280487
- setImmediate(() => stream.emit('close')); // notify readers that query has completed
280488
284650
  });
280489
284651
  this.on('fields', fields => {
280490
284652
  stream.emit('fields', fields); // replicate old emitter
280491
284653
  });
284654
+ stream.on('end', () => {
284655
+ stream.emit('close');
284656
+ });
280492
284657
  return stream;
280493
284658
  }
280494
284659
 
@@ -280507,7 +284672,7 @@ let Query$4=class Query extends Command$8 {
280507
284672
  Timers.clearTimeout(this.queryTimeout);
280508
284673
  this.queryTimeout = null;
280509
284674
  }
280510
-
284675
+
280511
284676
  const err = new Error('Query inactivity timeout');
280512
284677
  err.errorno = 'PROTOCOL_SEQUENCE_TIMEOUT';
280513
284678
  err.code = 'PROTOCOL_SEQUENCE_TIMEOUT';
@@ -281377,7 +285542,7 @@ var commands$7 = {
281377
285542
  ChangeUser,
281378
285543
  Quit
281379
285544
  };var name$1 = "mysql2";
281380
- var version$2 = "3.9.1";
285545
+ var version$2 = "3.9.2";
281381
285546
  var description = "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS";
281382
285547
  var main$1 = "index.js";
281383
285548
  var typings = "typings/mysql/index";
@@ -281453,7 +285618,6 @@ var devDependencies$1 = {
281453
285618
  prettier: "^3.0.0",
281454
285619
  progress: "^2.0.3",
281455
285620
  typescript: "^5.0.2",
281456
- urun: "0.0.8",
281457
285621
  utest: "0.0.8"
281458
285622
  };
281459
285623
  var require$$3 = {