@lage-run/globby 14.2.1 → 14.2.2

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/CHANGELOG.json CHANGED
@@ -2,7 +2,36 @@
2
2
  "name": "@lage-run/globby",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 02 Apr 2025 08:09:42 GMT",
5
+ "date": "Sat, 24 Jan 2026 09:00:58 GMT",
6
+ "version": "14.2.2",
7
+ "tag": "@lage-run/globby_v14.2.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "elcraig@microsoft.com",
12
+ "package": "@lage-run/globby",
13
+ "commit": "092607a7d55561a9342ab3265ccab0142dd59b9b",
14
+ "comment": "Add explicit module boundary types and update typescript version"
15
+ }
16
+ ],
17
+ "none": [
18
+ {
19
+ "author": "elcraig@microsoft.com",
20
+ "package": "@lage-run/globby",
21
+ "commit": "092607a7d55561a9342ab3265ccab0142dd59b9b",
22
+ "comment": "Update tsconfig internals for dts bundle setup"
23
+ },
24
+ {
25
+ "author": "elcraig@microsoft.com",
26
+ "package": "@lage-run/globby",
27
+ "commit": "092607a7d55561a9342ab3265ccab0142dd59b9b",
28
+ "comment": "Add missing devDependencies"
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ {
34
+ "date": "Wed, 02 Apr 2025 08:10:04 GMT",
6
35
  "version": "14.2.1",
7
36
  "tag": "@lage-run/globby_v14.2.1",
8
37
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @lage-run/globby
2
2
 
3
- <!-- This log was last generated on Wed, 02 Apr 2025 08:09:42 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Sat, 24 Jan 2026 09:00:58 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 14.2.2
8
+
9
+ Sat, 24 Jan 2026 09:00:58 GMT
10
+
11
+ ### Patches
12
+
13
+ - Add explicit module boundary types and update typescript version (elcraig@microsoft.com)
14
+
7
15
  ## 14.2.1
8
16
 
9
- Wed, 02 Apr 2025 08:09:42 GMT
17
+ Wed, 02 Apr 2025 08:10:04 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -2,9 +2,9 @@
2
2
  const path = require("path");
3
3
 
4
4
  /** @type {import('dts-bundle-generator/config-schema').BundlerConfig} */
5
- module.exports = {
5
+ const config = {
6
6
  compilationOptions: {
7
- preferredConfigPath: path.join(__dirname, "tsconfig.json"),
7
+ preferredConfigPath: require.resolve("@lage-run/monorepo-scripts/config/tsconfig.dts-bundle.json"),
8
8
  },
9
9
  entries: [
10
10
  {
@@ -23,3 +23,4 @@ module.exports = {
23
23
  },
24
24
  ],
25
25
  };
26
+ module.exports = config;
package/lib/index.js CHANGED
@@ -332,9 +332,9 @@ var require_glob_parent = __commonJS({
332
332
  }
333
333
  });
334
334
 
335
- // ../../node_modules/micromatch/node_modules/braces/lib/utils.js
335
+ // ../../node_modules/braces/lib/utils.js
336
336
  var require_utils = __commonJS({
337
- "../../node_modules/micromatch/node_modules/braces/lib/utils.js"(exports2) {
337
+ "../../node_modules/braces/lib/utils.js"(exports2) {
338
338
  "use strict";
339
339
  exports2.isInteger = (num) => {
340
340
  if (typeof num === "number") {
@@ -414,9 +414,9 @@ var require_utils = __commonJS({
414
414
  }
415
415
  });
416
416
 
417
- // ../../node_modules/micromatch/node_modules/braces/lib/stringify.js
417
+ // ../../node_modules/braces/lib/stringify.js
418
418
  var require_stringify = __commonJS({
419
- "../../node_modules/micromatch/node_modules/braces/lib/stringify.js"(exports2, module2) {
419
+ "../../node_modules/braces/lib/stringify.js"(exports2, module2) {
420
420
  "use strict";
421
421
  var utils = require_utils();
422
422
  module2.exports = (ast, options = {}) => {
@@ -672,9 +672,9 @@ var require_to_regex_range = __commonJS({
672
672
  }
673
673
  });
674
674
 
675
- // ../../node_modules/micromatch/node_modules/fill-range/index.js
675
+ // ../../node_modules/fill-range/index.js
676
676
  var require_fill_range = __commonJS({
677
- "../../node_modules/micromatch/node_modules/fill-range/index.js"(exports2, module2) {
677
+ "../../node_modules/fill-range/index.js"(exports2, module2) {
678
678
  "use strict";
679
679
  var util = require("util");
680
680
  var toRegexRange = require_to_regex_range();
@@ -866,9 +866,9 @@ var require_fill_range = __commonJS({
866
866
  }
867
867
  });
868
868
 
869
- // ../../node_modules/micromatch/node_modules/braces/lib/compile.js
869
+ // ../../node_modules/braces/lib/compile.js
870
870
  var require_compile = __commonJS({
871
- "../../node_modules/micromatch/node_modules/braces/lib/compile.js"(exports2, module2) {
871
+ "../../node_modules/braces/lib/compile.js"(exports2, module2) {
872
872
  "use strict";
873
873
  var fill = require_fill_range();
874
874
  var utils = require_utils();
@@ -918,9 +918,9 @@ var require_compile = __commonJS({
918
918
  }
919
919
  });
920
920
 
921
- // ../../node_modules/micromatch/node_modules/braces/lib/expand.js
921
+ // ../../node_modules/braces/lib/expand.js
922
922
  var require_expand = __commonJS({
923
- "../../node_modules/micromatch/node_modules/braces/lib/expand.js"(exports2, module2) {
923
+ "../../node_modules/braces/lib/expand.js"(exports2, module2) {
924
924
  "use strict";
925
925
  var fill = require_fill_range();
926
926
  var stringify = require_stringify();
@@ -1012,9 +1012,9 @@ var require_expand = __commonJS({
1012
1012
  }
1013
1013
  });
1014
1014
 
1015
- // ../../node_modules/micromatch/node_modules/braces/lib/constants.js
1015
+ // ../../node_modules/braces/lib/constants.js
1016
1016
  var require_constants = __commonJS({
1017
- "../../node_modules/micromatch/node_modules/braces/lib/constants.js"(exports2, module2) {
1017
+ "../../node_modules/braces/lib/constants.js"(exports2, module2) {
1018
1018
  "use strict";
1019
1019
  module2.exports = {
1020
1020
  MAX_LENGTH: 1e4,
@@ -1113,9 +1113,9 @@ var require_constants = __commonJS({
1113
1113
  }
1114
1114
  });
1115
1115
 
1116
- // ../../node_modules/micromatch/node_modules/braces/lib/parse.js
1116
+ // ../../node_modules/braces/lib/parse.js
1117
1117
  var require_parse = __commonJS({
1118
- "../../node_modules/micromatch/node_modules/braces/lib/parse.js"(exports2, module2) {
1118
+ "../../node_modules/braces/lib/parse.js"(exports2, module2) {
1119
1119
  "use strict";
1120
1120
  var stringify = require_stringify();
1121
1121
  var {
@@ -1351,9 +1351,9 @@ var require_parse = __commonJS({
1351
1351
  }
1352
1352
  });
1353
1353
 
1354
- // ../../node_modules/micromatch/node_modules/braces/index.js
1354
+ // ../../node_modules/braces/index.js
1355
1355
  var require_braces = __commonJS({
1356
- "../../node_modules/micromatch/node_modules/braces/index.js"(exports2, module2) {
1356
+ "../../node_modules/braces/index.js"(exports2, module2) {
1357
1357
  "use strict";
1358
1358
  var stringify = require_stringify();
1359
1359
  var compile = require_compile();
@@ -4099,14 +4099,14 @@ var require_queue = __commonJS({
4099
4099
  "../../node_modules/fastq/queue.js"(exports2, module2) {
4100
4100
  "use strict";
4101
4101
  var reusify = require_reusify();
4102
- function fastqueue(context, worker, concurrency) {
4102
+ function fastqueue(context, worker, _concurrency) {
4103
4103
  if (typeof context === "function") {
4104
- concurrency = worker;
4104
+ _concurrency = worker;
4105
4105
  worker = context;
4106
4106
  context = null;
4107
4107
  }
4108
- if (concurrency < 1) {
4109
- throw new Error("fastqueue concurrency must be greater than 1");
4108
+ if (!(_concurrency >= 1)) {
4109
+ throw new Error("fastqueue concurrency must be equal to or greater than 1");
4110
4110
  }
4111
4111
  var cache2 = reusify(Task);
4112
4112
  var queueHead = null;
@@ -4119,7 +4119,20 @@ var require_queue = __commonJS({
4119
4119
  saturated: noop2,
4120
4120
  pause,
4121
4121
  paused: false,
4122
- concurrency,
4122
+ get concurrency() {
4123
+ return _concurrency;
4124
+ },
4125
+ set concurrency(value) {
4126
+ if (!(value >= 1)) {
4127
+ throw new Error("fastqueue concurrency must be equal to or greater than 1");
4128
+ }
4129
+ _concurrency = value;
4130
+ if (self.paused) return;
4131
+ for (; queueHead && _running < _concurrency; ) {
4132
+ _running++;
4133
+ release();
4134
+ }
4135
+ },
4123
4136
  running,
4124
4137
  resume,
4125
4138
  idle,
@@ -4129,7 +4142,8 @@ var require_queue = __commonJS({
4129
4142
  empty: noop2,
4130
4143
  kill,
4131
4144
  killAndDrain,
4132
- error
4145
+ error,
4146
+ abort
4133
4147
  };
4134
4148
  return self;
4135
4149
  function running() {
@@ -4159,7 +4173,12 @@ var require_queue = __commonJS({
4159
4173
  function resume() {
4160
4174
  if (!self.paused) return;
4161
4175
  self.paused = false;
4162
- for (var i = 0; i < self.concurrency; i++) {
4176
+ if (queueHead === null) {
4177
+ _running++;
4178
+ release();
4179
+ return;
4180
+ }
4181
+ for (; queueHead && _running < _concurrency; ) {
4163
4182
  _running++;
4164
4183
  release();
4165
4184
  }
@@ -4174,7 +4193,7 @@ var require_queue = __commonJS({
4174
4193
  current.value = value;
4175
4194
  current.callback = done || noop2;
4176
4195
  current.errorHandler = errorHandler;
4177
- if (_running === self.concurrency || self.paused) {
4196
+ if (_running >= _concurrency || self.paused) {
4178
4197
  if (queueTail) {
4179
4198
  queueTail.next = current;
4180
4199
  queueTail = current;
@@ -4194,7 +4213,8 @@ var require_queue = __commonJS({
4194
4213
  current.release = release;
4195
4214
  current.value = value;
4196
4215
  current.callback = done || noop2;
4197
- if (_running === self.concurrency || self.paused) {
4216
+ current.errorHandler = errorHandler;
4217
+ if (_running >= _concurrency || self.paused) {
4198
4218
  if (queueHead) {
4199
4219
  current.next = queueHead;
4200
4220
  queueHead = current;
@@ -4213,7 +4233,7 @@ var require_queue = __commonJS({
4213
4233
  cache2.release(holder);
4214
4234
  }
4215
4235
  var next = queueHead;
4216
- if (next) {
4236
+ if (next && _running <= _concurrency) {
4217
4237
  if (!self.paused) {
4218
4238
  if (queueTail === queueHead) {
4219
4239
  queueTail = null;
@@ -4242,6 +4262,28 @@ var require_queue = __commonJS({
4242
4262
  self.drain();
4243
4263
  self.drain = noop2;
4244
4264
  }
4265
+ function abort() {
4266
+ var current = queueHead;
4267
+ queueHead = null;
4268
+ queueTail = null;
4269
+ while (current) {
4270
+ var next = current.next;
4271
+ var callback = current.callback;
4272
+ var errorHandler2 = current.errorHandler;
4273
+ var val = current.value;
4274
+ var context2 = current.context;
4275
+ current.value = null;
4276
+ current.callback = noop2;
4277
+ current.errorHandler = null;
4278
+ if (errorHandler2) {
4279
+ errorHandler2(new Error("abort"), val);
4280
+ }
4281
+ callback.call(context2, new Error("abort"));
4282
+ current.release(current);
4283
+ current = next;
4284
+ }
4285
+ self.drain = noop2;
4286
+ }
4245
4287
  function error(handler) {
4246
4288
  errorHandler = handler;
4247
4289
  }
@@ -4269,9 +4311,9 @@ var require_queue = __commonJS({
4269
4311
  self.release(self);
4270
4312
  };
4271
4313
  }
4272
- function queueAsPromised(context, worker, concurrency) {
4314
+ function queueAsPromised(context, worker, _concurrency) {
4273
4315
  if (typeof context === "function") {
4274
- concurrency = worker;
4316
+ _concurrency = worker;
4275
4317
  worker = context;
4276
4318
  context = null;
4277
4319
  }
@@ -4280,7 +4322,7 @@ var require_queue = __commonJS({
4280
4322
  cb(null, res);
4281
4323
  }, cb);
4282
4324
  }
4283
- var queue = fastqueue(context, asyncWrapper, concurrency);
4325
+ var queue = fastqueue(context, asyncWrapper, _concurrency);
4284
4326
  var pushCb = queue.push;
4285
4327
  var unshiftCb = queue.unshift;
4286
4328
  queue.push = push;
@@ -4314,17 +4356,19 @@ var require_queue = __commonJS({
4314
4356
  return p;
4315
4357
  }
4316
4358
  function drained() {
4317
- if (queue.idle()) {
4318
- return new Promise(function(resolve) {
4319
- resolve();
4320
- });
4321
- }
4322
- var previousDrain = queue.drain;
4323
4359
  var p = new Promise(function(resolve) {
4324
- queue.drain = function() {
4325
- previousDrain();
4326
- resolve();
4327
- };
4360
+ process.nextTick(function() {
4361
+ if (queue.idle()) {
4362
+ resolve();
4363
+ } else {
4364
+ var previousDrain = queue.drain;
4365
+ queue.drain = function() {
4366
+ if (typeof previousDrain === "function") previousDrain();
4367
+ resolve();
4368
+ queue.drain = previousDrain;
4369
+ };
4370
+ }
4371
+ });
4328
4372
  });
4329
4373
  return p;
4330
4374
  }
@@ -5511,6 +5555,7 @@ var require_ignore = __commonJS({
5511
5555
  function makeArray(subject) {
5512
5556
  return Array.isArray(subject) ? subject : [subject];
5513
5557
  }
5558
+ var UNDEFINED = void 0;
5514
5559
  var EMPTY = "";
5515
5560
  var SPACE = " ";
5516
5561
  var ESCAPE = "\\";
@@ -5519,14 +5564,18 @@ var require_ignore = __commonJS({
5519
5564
  var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
5520
5565
  var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
5521
5566
  var REGEX_SPLITALL_CRLF = /\r?\n/g;
5522
- var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
5567
+ var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
5568
+ var REGEX_TEST_TRAILING_SLASH = /\/$/;
5523
5569
  var SLASH = "/";
5524
5570
  var TMP_KEY_IGNORE = "node-ignore";
5525
5571
  if (typeof Symbol !== "undefined") {
5526
5572
  TMP_KEY_IGNORE = Symbol.for("node-ignore");
5527
5573
  }
5528
5574
  var KEY_IGNORE = TMP_KEY_IGNORE;
5529
- var define = (object, key, value) => Object.defineProperty(object, key, { value });
5575
+ var define = (object, key, value) => {
5576
+ Object.defineProperty(object, key, { value });
5577
+ return value;
5578
+ };
5530
5579
  var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
5531
5580
  var RETURN_FALSE = () => false;
5532
5581
  var sanitizeRange = (range) => range.replace(
@@ -5539,7 +5588,7 @@ var require_ignore = __commonJS({
5539
5588
  };
5540
5589
  var REPLACERS = [
5541
5590
  [
5542
- // remove BOM
5591
+ // Remove BOM
5543
5592
  // TODO:
5544
5593
  // Other similar zero-width characters?
5545
5594
  /^\uFEFF/,
@@ -5549,14 +5598,21 @@ var require_ignore = __commonJS({
5549
5598
  [
5550
5599
  // (a\ ) -> (a )
5551
5600
  // (a ) -> (a)
5601
+ // (a ) -> (a)
5552
5602
  // (a \ ) -> (a )
5553
- /\\?\s+$/,
5554
- (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY
5603
+ /((?:\\\\)*?)(\\?\s+)$/,
5604
+ (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
5555
5605
  ],
5556
- // replace (\ ) with ' '
5606
+ // Replace (\ ) with ' '
5607
+ // (\ ) -> ' '
5608
+ // (\\ ) -> '\\ '
5609
+ // (\\\ ) -> '\\ '
5557
5610
  [
5558
- /\\\s/g,
5559
- () => SPACE
5611
+ /(\\+?)\s/g,
5612
+ (_, m1) => {
5613
+ const { length } = m1;
5614
+ return m1.slice(0, length - length % 2) + SPACE;
5615
+ }
5560
5616
  ],
5561
5617
  // Escape metacharacters
5562
5618
  // which is written down by users but means special for regular expressions.
@@ -5676,55 +5732,147 @@ var require_ignore = __commonJS({
5676
5732
  // 'js/' will not match 'a.js'
5677
5733
  // 'js' will match 'a.js' and 'a.js/'
5678
5734
  (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
5679
- ],
5680
- // trailing wildcard
5681
- [
5682
- /(\^|\\\/)?\\\*$/,
5683
- (_, p1) => {
5684
- const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
5685
- return `${prefix}(?=$|\\/$)`;
5686
- }
5687
5735
  ]
5688
5736
  ];
5689
- var regexCache = /* @__PURE__ */ Object.create(null);
5690
- var makeRegex = (pattern, ignoreCase) => {
5691
- let source = regexCache[pattern];
5692
- if (!source) {
5693
- source = REPLACERS.reduce(
5694
- (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
5695
- pattern
5696
- );
5697
- regexCache[pattern] = source;
5737
+ var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
5738
+ var MODE_IGNORE = "regex";
5739
+ var MODE_CHECK_IGNORE = "checkRegex";
5740
+ var UNDERSCORE = "_";
5741
+ var TRAILING_WILD_CARD_REPLACERS = {
5742
+ [MODE_IGNORE](_, p1) {
5743
+ const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
5744
+ return `${prefix}(?=$|\\/$)`;
5745
+ },
5746
+ [MODE_CHECK_IGNORE](_, p1) {
5747
+ const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
5748
+ return `${prefix}(?=$|\\/$)`;
5698
5749
  }
5699
- return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
5700
5750
  };
5751
+ var makeRegexPrefix = (pattern) => REPLACERS.reduce(
5752
+ (prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)),
5753
+ pattern
5754
+ );
5701
5755
  var isString = (subject) => typeof subject === "string";
5702
5756
  var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
5703
- var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
5757
+ var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
5704
5758
  var IgnoreRule = class {
5705
- constructor(origin, pattern, negative, regex) {
5706
- this.origin = origin;
5759
+ constructor(pattern, mark, body, ignoreCase, negative, prefix) {
5707
5760
  this.pattern = pattern;
5761
+ this.mark = mark;
5708
5762
  this.negative = negative;
5709
- this.regex = regex;
5763
+ define(this, "body", body);
5764
+ define(this, "ignoreCase", ignoreCase);
5765
+ define(this, "regexPrefix", prefix);
5766
+ }
5767
+ get regex() {
5768
+ const key = UNDERSCORE + MODE_IGNORE;
5769
+ if (this[key]) {
5770
+ return this[key];
5771
+ }
5772
+ return this._make(MODE_IGNORE, key);
5773
+ }
5774
+ get checkRegex() {
5775
+ const key = UNDERSCORE + MODE_CHECK_IGNORE;
5776
+ if (this[key]) {
5777
+ return this[key];
5778
+ }
5779
+ return this._make(MODE_CHECK_IGNORE, key);
5780
+ }
5781
+ _make(mode, key) {
5782
+ const str = this.regexPrefix.replace(
5783
+ REGEX_REPLACE_TRAILING_WILDCARD,
5784
+ // It does not need to bind pattern
5785
+ TRAILING_WILD_CARD_REPLACERS[mode]
5786
+ );
5787
+ const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
5788
+ return define(this, key, regex);
5710
5789
  }
5711
5790
  };
5712
- var createRule = (pattern, ignoreCase) => {
5713
- const origin = pattern;
5791
+ var createRule = ({
5792
+ pattern,
5793
+ mark
5794
+ }, ignoreCase) => {
5714
5795
  let negative = false;
5715
- if (pattern.indexOf("!") === 0) {
5796
+ let body = pattern;
5797
+ if (body.indexOf("!") === 0) {
5716
5798
  negative = true;
5717
- pattern = pattern.substr(1);
5799
+ body = body.substr(1);
5718
5800
  }
5719
- pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
5720
- const regex = makeRegex(pattern, ignoreCase);
5801
+ body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
5802
+ const regexPrefix = makeRegexPrefix(body);
5721
5803
  return new IgnoreRule(
5722
- origin,
5723
5804
  pattern,
5805
+ mark,
5806
+ body,
5807
+ ignoreCase,
5724
5808
  negative,
5725
- regex
5809
+ regexPrefix
5726
5810
  );
5727
5811
  };
5812
+ var RuleManager = class {
5813
+ constructor(ignoreCase) {
5814
+ this._ignoreCase = ignoreCase;
5815
+ this._rules = [];
5816
+ }
5817
+ _add(pattern) {
5818
+ if (pattern && pattern[KEY_IGNORE]) {
5819
+ this._rules = this._rules.concat(pattern._rules._rules);
5820
+ this._added = true;
5821
+ return;
5822
+ }
5823
+ if (isString(pattern)) {
5824
+ pattern = {
5825
+ pattern
5826
+ };
5827
+ }
5828
+ if (checkPattern(pattern.pattern)) {
5829
+ const rule = createRule(pattern, this._ignoreCase);
5830
+ this._added = true;
5831
+ this._rules.push(rule);
5832
+ }
5833
+ }
5834
+ // @param {Array<string> | string | Ignore} pattern
5835
+ add(pattern) {
5836
+ this._added = false;
5837
+ makeArray(
5838
+ isString(pattern) ? splitPattern(pattern) : pattern
5839
+ ).forEach(this._add, this);
5840
+ return this._added;
5841
+ }
5842
+ // Test one single path without recursively checking parent directories
5843
+ //
5844
+ // - checkUnignored `boolean` whether should check if the path is unignored,
5845
+ // setting `checkUnignored` to `false` could reduce additional
5846
+ // path matching.
5847
+ // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
5848
+ // @returns {TestResult} true if a file is ignored
5849
+ test(path2, checkUnignored, mode) {
5850
+ let ignored = false;
5851
+ let unignored = false;
5852
+ let matchedRule;
5853
+ this._rules.forEach((rule) => {
5854
+ const { negative } = rule;
5855
+ if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
5856
+ return;
5857
+ }
5858
+ const matched = rule[mode].test(path2);
5859
+ if (!matched) {
5860
+ return;
5861
+ }
5862
+ ignored = !negative;
5863
+ unignored = negative;
5864
+ matchedRule = negative ? UNDEFINED : rule;
5865
+ });
5866
+ const ret = {
5867
+ ignored,
5868
+ unignored
5869
+ };
5870
+ if (matchedRule) {
5871
+ ret.rule = matchedRule;
5872
+ }
5873
+ return ret;
5874
+ }
5875
+ };
5728
5876
  var throwError = (message, Ctor) => {
5729
5877
  throw new Ctor(message);
5730
5878
  };
@@ -5757,34 +5905,16 @@ var require_ignore = __commonJS({
5757
5905
  allowRelativePaths = false
5758
5906
  } = {}) {
5759
5907
  define(this, KEY_IGNORE, true);
5760
- this._rules = [];
5761
- this._ignoreCase = ignoreCase;
5762
- this._allowRelativePaths = allowRelativePaths;
5908
+ this._rules = new RuleManager(ignoreCase);
5909
+ this._strictPathCheck = !allowRelativePaths;
5763
5910
  this._initCache();
5764
5911
  }
5765
5912
  _initCache() {
5766
5913
  this._ignoreCache = /* @__PURE__ */ Object.create(null);
5767
5914
  this._testCache = /* @__PURE__ */ Object.create(null);
5768
5915
  }
5769
- _addPattern(pattern) {
5770
- if (pattern && pattern[KEY_IGNORE]) {
5771
- this._rules = this._rules.concat(pattern._rules);
5772
- this._added = true;
5773
- return;
5774
- }
5775
- if (checkPattern(pattern)) {
5776
- const rule = createRule(pattern, this._ignoreCase);
5777
- this._added = true;
5778
- this._rules.push(rule);
5779
- }
5780
- }
5781
- // @param {Array<string> | string | Ignore} pattern
5782
5916
  add(pattern) {
5783
- this._added = false;
5784
- makeArray(
5785
- isString(pattern) ? splitPattern(pattern) : pattern
5786
- ).forEach(this._addPattern, this);
5787
- if (this._added) {
5917
+ if (this._rules.add(pattern)) {
5788
5918
  this._initCache();
5789
5919
  }
5790
5920
  return this;
@@ -5793,58 +5923,45 @@ var require_ignore = __commonJS({
5793
5923
  addPattern(pattern) {
5794
5924
  return this.add(pattern);
5795
5925
  }
5796
- // | ignored : unignored
5797
- // negative | 0:0 | 0:1 | 1:0 | 1:1
5798
- // -------- | ------- | ------- | ------- | --------
5799
- // 0 | TEST | TEST | SKIP | X
5800
- // 1 | TESTIF | SKIP | TEST | X
5801
- // - SKIP: always skip
5802
- // - TEST: always test
5803
- // - TESTIF: only test if checkUnignored
5804
- // - X: that never happen
5805
- // @param {boolean} whether should check if the path is unignored,
5806
- // setting `checkUnignored` to `false` could reduce additional
5807
- // path matching.
5808
- // @returns {TestResult} true if a file is ignored
5809
- _testOne(path2, checkUnignored) {
5810
- let ignored = false;
5811
- let unignored = false;
5812
- this._rules.forEach((rule) => {
5813
- const { negative } = rule;
5814
- if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
5815
- return;
5816
- }
5817
- const matched = rule.regex.test(path2);
5818
- if (matched) {
5819
- ignored = !negative;
5820
- unignored = negative;
5821
- }
5822
- });
5823
- return {
5824
- ignored,
5825
- unignored
5826
- };
5827
- }
5828
5926
  // @returns {TestResult}
5829
5927
  _test(originalPath, cache2, checkUnignored, slices) {
5830
5928
  const path2 = originalPath && checkPath.convert(originalPath);
5831
5929
  checkPath(
5832
5930
  path2,
5833
5931
  originalPath,
5834
- this._allowRelativePaths ? RETURN_FALSE : throwError
5932
+ this._strictPathCheck ? throwError : RETURN_FALSE
5835
5933
  );
5836
5934
  return this._t(path2, cache2, checkUnignored, slices);
5837
5935
  }
5936
+ checkIgnore(path2) {
5937
+ if (!REGEX_TEST_TRAILING_SLASH.test(path2)) {
5938
+ return this.test(path2);
5939
+ }
5940
+ const slices = path2.split(SLASH).filter(Boolean);
5941
+ slices.pop();
5942
+ if (slices.length) {
5943
+ const parent = this._t(
5944
+ slices.join(SLASH) + SLASH,
5945
+ this._testCache,
5946
+ true,
5947
+ slices
5948
+ );
5949
+ if (parent.ignored) {
5950
+ return parent;
5951
+ }
5952
+ }
5953
+ return this._rules.test(path2, false, MODE_CHECK_IGNORE);
5954
+ }
5838
5955
  _t(path2, cache2, checkUnignored, slices) {
5839
5956
  if (path2 in cache2) {
5840
5957
  return cache2[path2];
5841
5958
  }
5842
5959
  if (!slices) {
5843
- slices = path2.split(SLASH);
5960
+ slices = path2.split(SLASH).filter(Boolean);
5844
5961
  }
5845
5962
  slices.pop();
5846
5963
  if (!slices.length) {
5847
- return cache2[path2] = this._testOne(path2, checkUnignored);
5964
+ return cache2[path2] = this._rules.test(path2, checkUnignored, MODE_IGNORE);
5848
5965
  }
5849
5966
  const parent = this._t(
5850
5967
  slices.join(SLASH) + SLASH,
@@ -5852,7 +5969,7 @@ var require_ignore = __commonJS({
5852
5969
  checkUnignored,
5853
5970
  slices
5854
5971
  );
5855
- return cache2[path2] = parent.ignored ? parent : this._testOne(path2, checkUnignored);
5972
+ return cache2[path2] = parent.ignored ? parent : this._rules.test(path2, checkUnignored, MODE_IGNORE);
5856
5973
  }
5857
5974
  ignores(path2) {
5858
5975
  return this._test(path2, this._ignoreCache, false).ignored;
@@ -5870,18 +5987,22 @@ var require_ignore = __commonJS({
5870
5987
  };
5871
5988
  var factory = (options) => new Ignore(options);
5872
5989
  var isPathValid = (path2) => checkPath(path2 && checkPath.convert(path2), path2, RETURN_FALSE);
5873
- factory.isPathValid = isPathValid;
5874
- factory.default = factory;
5875
- module2.exports = factory;
5990
+ var setupWindows = () => {
5991
+ const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
5992
+ checkPath.convert = makePosix;
5993
+ const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
5994
+ checkPath.isNotRelative = (path2) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path2) || isNotRelative(path2);
5995
+ };
5876
5996
  if (
5877
5997
  // Detect `process` so that it can run in browsers.
5878
- typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")
5998
+ typeof process !== "undefined" && process.platform === "win32"
5879
5999
  ) {
5880
- const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
5881
- checkPath.convert = makePosix;
5882
- const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
5883
- checkPath.isNotRelative = (path2) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path2) || isNotRelative(path2);
6000
+ setupWindows();
5884
6001
  }
6002
+ module2.exports = factory;
6003
+ factory.default = factory;
6004
+ module2.exports.isPathValid = isPathValid;
6005
+ define(module2.exports, Symbol.for("setupWindows"), setupWindows);
5885
6006
  }
5886
6007
  });
5887
6008
 
@@ -5895,7 +6016,7 @@ module.exports = __toCommonJS(index_exports);
5895
6016
 
5896
6017
  // ../../node_modules/globby/index.js
5897
6018
  var import_node_process2 = __toESM(require("process"), 1);
5898
- var import_node_fs2 = __toESM(require("fs"), 1);
6019
+ var import_node_fs3 = __toESM(require("fs"), 1);
5899
6020
  var import_node_path2 = __toESM(require("path"), 1);
5900
6021
 
5901
6022
  // ../../node_modules/@sindresorhus/merge-streams/index.js
@@ -6087,13 +6208,14 @@ var PASSTHROUGH_LISTENERS_PER_STREAM = 1;
6087
6208
  var import_fast_glob2 = __toESM(require_out4(), 1);
6088
6209
 
6089
6210
  // ../../node_modules/globby/node_modules/path-type/index.js
6090
- var import_fs = __toESM(require("fs"), 1);
6211
+ var import_node_fs = __toESM(require("fs"), 1);
6212
+ var import_promises2 = __toESM(require("fs/promises"), 1);
6091
6213
  async function isType(fsStatType, statsMethodName, filePath) {
6092
6214
  if (typeof filePath !== "string") {
6093
6215
  throw new TypeError(`Expected a string, got ${typeof filePath}`);
6094
6216
  }
6095
6217
  try {
6096
- const stats = await import_fs.promises[fsStatType](filePath);
6218
+ const stats = await import_promises2.default[fsStatType](filePath);
6097
6219
  return stats[statsMethodName]();
6098
6220
  } catch (error) {
6099
6221
  if (error.code === "ENOENT") {
@@ -6107,7 +6229,7 @@ function isTypeSync(fsStatType, statsMethodName, filePath) {
6107
6229
  throw new TypeError(`Expected a string, got ${typeof filePath}`);
6108
6230
  }
6109
6231
  try {
6110
- return import_fs.default[fsStatType](filePath)[statsMethodName]();
6232
+ return import_node_fs.default[fsStatType](filePath)[statsMethodName]();
6111
6233
  } catch (error) {
6112
6234
  if (error.code === "ENOENT") {
6113
6235
  return false;
@@ -6115,23 +6237,27 @@ function isTypeSync(fsStatType, statsMethodName, filePath) {
6115
6237
  throw error;
6116
6238
  }
6117
6239
  }
6118
- var isFile = isType.bind(null, "stat", "isFile");
6119
- var isDirectory = isType.bind(null, "stat", "isDirectory");
6120
- var isSymlink = isType.bind(null, "lstat", "isSymbolicLink");
6121
- var isFileSync = isTypeSync.bind(null, "statSync", "isFile");
6122
- var isDirectorySync = isTypeSync.bind(null, "statSync", "isDirectory");
6123
- var isSymlinkSync = isTypeSync.bind(null, "lstatSync", "isSymbolicLink");
6240
+ var isFile = isType.bind(void 0, "stat", "isFile");
6241
+ var isDirectory = isType.bind(void 0, "stat", "isDirectory");
6242
+ var isSymlink = isType.bind(void 0, "lstat", "isSymbolicLink");
6243
+ var isFileSync = isTypeSync.bind(void 0, "statSync", "isFile");
6244
+ var isDirectorySync = isTypeSync.bind(void 0, "statSync", "isDirectory");
6245
+ var isSymlinkSync = isTypeSync.bind(void 0, "lstatSync", "isSymbolicLink");
6124
6246
 
6125
6247
  // ../../node_modules/unicorn-magic/node.js
6248
+ var import_node_util = require("util");
6249
+ var import_node_child_process = require("child_process");
6126
6250
  var import_node_url = require("url");
6251
+ var execFileOriginal = (0, import_node_util.promisify)(import_node_child_process.execFile);
6127
6252
  function toPath(urlOrPath) {
6128
6253
  return urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
6129
6254
  }
6255
+ var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
6130
6256
 
6131
6257
  // ../../node_modules/globby/ignore.js
6132
6258
  var import_node_process = __toESM(require("process"), 1);
6133
- var import_node_fs = __toESM(require("fs"), 1);
6134
- var import_promises2 = __toESM(require("fs/promises"), 1);
6259
+ var import_node_fs2 = __toESM(require("fs"), 1);
6260
+ var import_promises3 = __toESM(require("fs/promises"), 1);
6135
6261
  var import_node_path = __toESM(require("path"), 1);
6136
6262
  var import_fast_glob = __toESM(require_out4(), 1);
6137
6263
  var import_ignore = __toESM(require_ignore(), 1);
@@ -6202,7 +6328,7 @@ var isIgnoredByIgnoreFiles = async (patterns, options) => {
6202
6328
  const files = await Promise.all(
6203
6329
  paths.map(async (filePath) => ({
6204
6330
  filePath,
6205
- content: await import_promises2.default.readFile(filePath, "utf8")
6331
+ content: await import_promises3.default.readFile(filePath, "utf8")
6206
6332
  }))
6207
6333
  );
6208
6334
  return getIsIgnoredPredicate(files, cwd);
@@ -6218,7 +6344,7 @@ var isIgnoredByIgnoreFilesSync = (patterns, options) => {
6218
6344
  });
6219
6345
  const files = paths.map((filePath) => ({
6220
6346
  filePath,
6221
- content: import_node_fs.default.readFileSync(filePath, "utf8")
6347
+ content: import_node_fs2.default.readFileSync(filePath, "utf8")
6222
6348
  }));
6223
6349
  return getIsIgnoredPredicate(files, cwd);
6224
6350
  };
@@ -6263,7 +6389,7 @@ var checkCwdOption = (cwd) => {
6263
6389
  }
6264
6390
  let stat;
6265
6391
  try {
6266
- stat = import_node_fs2.default.statSync(cwd);
6392
+ stat = import_node_fs3.default.statSync(cwd);
6267
6393
  } catch {
6268
6394
  return;
6269
6395
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/globby",
3
- "version": "14.2.1",
3
+ "version": "14.2.2",
4
4
  "main": "lib/index.js",
5
5
  "scripts": {
6
6
  "transpile": "esbuild src/index.mts --bundle --platform=node --target=node14 --format=cjs --outfile=lib/index.js",
@@ -8,10 +8,11 @@
8
8
  },
9
9
  "license": "MIT",
10
10
  "devDependencies": {
11
+ "@lage-run/monorepo-scripts": "^1.0.0",
11
12
  "dts-bundle-generator": "^9.5.1",
12
13
  "esbuild": "^0.25.0",
13
14
  "globby": "^14.0.2",
14
- "typescript": "~5.0.3"
15
+ "typescript": "~5.9.3"
15
16
  },
16
17
  "exports": {
17
18
  ".": {
package/tsconfig.json CHANGED
@@ -3,9 +3,10 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "./lib",
5
5
  "emitDeclarationOnly": true,
6
- "module": "Node16"
6
+ "module": "Node16",
7
+ "moduleResolution": "Node16",
8
+ "lib": ["ES2020"]
7
9
  },
8
- "files": [],
9
10
  "include": ["src/index.mts"],
10
11
  "exclude": ["lib/**/*.mts"]
11
12
  }