@digipair/skill-git 0.63.1 → 0.64.3

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.
Files changed (3) hide show
  1. package/index.cjs.js +101 -31
  2. package/index.esm.js +101 -31
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -348,20 +348,69 @@ function setup(env) {
348
348
  createDebug.namespaces = namespaces;
349
349
  createDebug.names = [];
350
350
  createDebug.skips = [];
351
- var i;
352
- var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
353
- var len = split.length;
354
- for(i = 0; i < len; i++){
355
- if (!split[i]) {
356
- continue;
351
+ var split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
352
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
353
+ try {
354
+ for(var _iterator = split[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
355
+ var ns = _step.value;
356
+ if (ns[0] === "-") {
357
+ createDebug.skips.push(ns.slice(1));
358
+ } else {
359
+ createDebug.names.push(ns);
360
+ }
361
+ }
362
+ } catch (err) {
363
+ _didIteratorError = true;
364
+ _iteratorError = err;
365
+ } finally{
366
+ try {
367
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
368
+ _iterator.return();
369
+ }
370
+ } finally{
371
+ if (_didIteratorError) {
372
+ throw _iteratorError;
373
+ }
357
374
  }
358
- namespaces = split[i].replace(/\*/g, ".*?");
359
- if (namespaces[0] === "-") {
360
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
375
+ }
376
+ }
377
+ /**
378
+ * Checks if the given string matches a namespace template, honoring
379
+ * asterisks as wildcards.
380
+ *
381
+ * @param {String} search
382
+ * @param {String} template
383
+ * @return {Boolean}
384
+ */ function matchesTemplate(search, template) {
385
+ var searchIndex = 0;
386
+ var templateIndex = 0;
387
+ var starIndex = -1;
388
+ var matchIndex = 0;
389
+ while(searchIndex < search.length){
390
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
391
+ // Match character or proceed with wildcard
392
+ if (template[templateIndex] === "*") {
393
+ starIndex = templateIndex;
394
+ matchIndex = searchIndex;
395
+ templateIndex++; // Skip the '*'
396
+ } else {
397
+ searchIndex++;
398
+ templateIndex++;
399
+ }
400
+ } else if (starIndex !== -1) {
401
+ // Backtrack to the last '*' and try to match more characters
402
+ templateIndex = starIndex + 1;
403
+ matchIndex++;
404
+ searchIndex = matchIndex;
361
405
  } else {
362
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
406
+ return false; // No match
363
407
  }
364
408
  }
409
+ // Handle trailing '*' in template
410
+ while(templateIndex < template.length && template[templateIndex] === "*"){
411
+ templateIndex++;
412
+ }
413
+ return templateIndex === template.length;
365
414
  }
366
415
  /**
367
416
  * Disable debug output.
@@ -369,7 +418,7 @@ function setup(env) {
369
418
  * @return {String} namespaces
370
419
  * @api public
371
420
  */ function disable() {
372
- var namespaces = _to_consumable_array$1(createDebug.names.map(toNamespace)).concat(_to_consumable_array$1(createDebug.skips.map(toNamespace).map(function(namespace) {
421
+ var namespaces = _to_consumable_array$1(createDebug.names).concat(_to_consumable_array$1(createDebug.skips.map(function(namespace) {
373
422
  return "-" + namespace;
374
423
  }))).join(",");
375
424
  createDebug.enable("");
@@ -382,32 +431,52 @@ function setup(env) {
382
431
  * @return {Boolean}
383
432
  * @api public
384
433
  */ function enabled(name) {
385
- if (name[name.length - 1] === "*") {
386
- return true;
387
- }
388
- var i;
389
- var len;
390
- for(i = 0, len = createDebug.skips.length; i < len; i++){
391
- if (createDebug.skips[i].test(name)) {
392
- return false;
434
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
435
+ try {
436
+ for(var _iterator = createDebug.skips[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
437
+ var skip = _step.value;
438
+ if (matchesTemplate(name, skip)) {
439
+ return false;
440
+ }
441
+ }
442
+ } catch (err) {
443
+ _didIteratorError = true;
444
+ _iteratorError = err;
445
+ } finally{
446
+ try {
447
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
448
+ _iterator.return();
449
+ }
450
+ } finally{
451
+ if (_didIteratorError) {
452
+ throw _iteratorError;
453
+ }
393
454
  }
394
455
  }
395
- for(i = 0, len = createDebug.names.length; i < len; i++){
396
- if (createDebug.names[i].test(name)) {
397
- return true;
456
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
457
+ try {
458
+ for(var _iterator1 = createDebug.names[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
459
+ var ns = _step1.value;
460
+ if (matchesTemplate(name, ns)) {
461
+ return true;
462
+ }
463
+ }
464
+ } catch (err) {
465
+ _didIteratorError1 = true;
466
+ _iteratorError1 = err;
467
+ } finally{
468
+ try {
469
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
470
+ _iterator1.return();
471
+ }
472
+ } finally{
473
+ if (_didIteratorError1) {
474
+ throw _iteratorError1;
475
+ }
398
476
  }
399
477
  }
400
478
  return false;
401
479
  }
402
- /**
403
- * Convert regexp to namespace
404
- *
405
- * @param {RegExp} regxep
406
- * @return {String} namespace
407
- * @api private
408
- */ function toNamespace(regexp) {
409
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
410
- }
411
480
  /**
412
481
  * Coerce `val`.
413
482
  *
@@ -551,6 +620,7 @@ function useColors() {
551
620
  var m;
552
621
  // Is webkit? http://stackoverflow.com/a/16459606/376773
553
622
  // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
623
+ // eslint-disable-next-line no-return-assign
554
624
  return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
555
625
  typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
556
626
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
package/index.esm.js CHANGED
@@ -337,20 +337,69 @@ function setup(env) {
337
337
  createDebug.namespaces = namespaces;
338
338
  createDebug.names = [];
339
339
  createDebug.skips = [];
340
- var i;
341
- var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
342
- var len = split.length;
343
- for(i = 0; i < len; i++){
344
- if (!split[i]) {
345
- continue;
340
+ var split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
341
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
342
+ try {
343
+ for(var _iterator = split[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
344
+ var ns = _step.value;
345
+ if (ns[0] === "-") {
346
+ createDebug.skips.push(ns.slice(1));
347
+ } else {
348
+ createDebug.names.push(ns);
349
+ }
350
+ }
351
+ } catch (err) {
352
+ _didIteratorError = true;
353
+ _iteratorError = err;
354
+ } finally{
355
+ try {
356
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
357
+ _iterator.return();
358
+ }
359
+ } finally{
360
+ if (_didIteratorError) {
361
+ throw _iteratorError;
362
+ }
346
363
  }
347
- namespaces = split[i].replace(/\*/g, ".*?");
348
- if (namespaces[0] === "-") {
349
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
364
+ }
365
+ }
366
+ /**
367
+ * Checks if the given string matches a namespace template, honoring
368
+ * asterisks as wildcards.
369
+ *
370
+ * @param {String} search
371
+ * @param {String} template
372
+ * @return {Boolean}
373
+ */ function matchesTemplate(search, template) {
374
+ var searchIndex = 0;
375
+ var templateIndex = 0;
376
+ var starIndex = -1;
377
+ var matchIndex = 0;
378
+ while(searchIndex < search.length){
379
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
380
+ // Match character or proceed with wildcard
381
+ if (template[templateIndex] === "*") {
382
+ starIndex = templateIndex;
383
+ matchIndex = searchIndex;
384
+ templateIndex++; // Skip the '*'
385
+ } else {
386
+ searchIndex++;
387
+ templateIndex++;
388
+ }
389
+ } else if (starIndex !== -1) {
390
+ // Backtrack to the last '*' and try to match more characters
391
+ templateIndex = starIndex + 1;
392
+ matchIndex++;
393
+ searchIndex = matchIndex;
350
394
  } else {
351
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
395
+ return false; // No match
352
396
  }
353
397
  }
398
+ // Handle trailing '*' in template
399
+ while(templateIndex < template.length && template[templateIndex] === "*"){
400
+ templateIndex++;
401
+ }
402
+ return templateIndex === template.length;
354
403
  }
355
404
  /**
356
405
  * Disable debug output.
@@ -358,7 +407,7 @@ function setup(env) {
358
407
  * @return {String} namespaces
359
408
  * @api public
360
409
  */ function disable() {
361
- var namespaces = _to_consumable_array$1(createDebug.names.map(toNamespace)).concat(_to_consumable_array$1(createDebug.skips.map(toNamespace).map(function(namespace) {
410
+ var namespaces = _to_consumable_array$1(createDebug.names).concat(_to_consumable_array$1(createDebug.skips.map(function(namespace) {
362
411
  return "-" + namespace;
363
412
  }))).join(",");
364
413
  createDebug.enable("");
@@ -371,32 +420,52 @@ function setup(env) {
371
420
  * @return {Boolean}
372
421
  * @api public
373
422
  */ function enabled(name) {
374
- if (name[name.length - 1] === "*") {
375
- return true;
376
- }
377
- var i;
378
- var len;
379
- for(i = 0, len = createDebug.skips.length; i < len; i++){
380
- if (createDebug.skips[i].test(name)) {
381
- return false;
423
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
424
+ try {
425
+ for(var _iterator = createDebug.skips[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
426
+ var skip = _step.value;
427
+ if (matchesTemplate(name, skip)) {
428
+ return false;
429
+ }
430
+ }
431
+ } catch (err) {
432
+ _didIteratorError = true;
433
+ _iteratorError = err;
434
+ } finally{
435
+ try {
436
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
437
+ _iterator.return();
438
+ }
439
+ } finally{
440
+ if (_didIteratorError) {
441
+ throw _iteratorError;
442
+ }
382
443
  }
383
444
  }
384
- for(i = 0, len = createDebug.names.length; i < len; i++){
385
- if (createDebug.names[i].test(name)) {
386
- return true;
445
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
446
+ try {
447
+ for(var _iterator1 = createDebug.names[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
448
+ var ns = _step1.value;
449
+ if (matchesTemplate(name, ns)) {
450
+ return true;
451
+ }
452
+ }
453
+ } catch (err) {
454
+ _didIteratorError1 = true;
455
+ _iteratorError1 = err;
456
+ } finally{
457
+ try {
458
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
459
+ _iterator1.return();
460
+ }
461
+ } finally{
462
+ if (_didIteratorError1) {
463
+ throw _iteratorError1;
464
+ }
387
465
  }
388
466
  }
389
467
  return false;
390
468
  }
391
- /**
392
- * Convert regexp to namespace
393
- *
394
- * @param {RegExp} regxep
395
- * @return {String} namespace
396
- * @api private
397
- */ function toNamespace(regexp) {
398
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
399
- }
400
469
  /**
401
470
  * Coerce `val`.
402
471
  *
@@ -540,6 +609,7 @@ function useColors() {
540
609
  var m;
541
610
  // Is webkit? http://stackoverflow.com/a/16459606/376773
542
611
  // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
612
+ // eslint-disable-next-line no-return-assign
543
613
  return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
544
614
  typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
545
615
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-git",
3
- "version": "0.63.1",
3
+ "version": "0.64.3",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"