jiek 0.4.7-alpha.1 → 0.4.7-alpha.11

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 (47) hide show
  1. package/bin/jiek.js +7 -4
  2. package/dist/cli.cjs +5028 -0
  3. package/dist/cli.js +4277 -95
  4. package/dist/cli.min.cjs +19 -0
  5. package/dist/cli.min.js +19 -1
  6. package/dist/index.cjs +5 -0
  7. package/dist/index.js +1 -3
  8. package/dist/index.min.cjs +1 -0
  9. package/dist/index.min.js +1 -1
  10. package/dist/rollup/index.cjs +4670 -0
  11. package/dist/rollup/index.js +4180 -66
  12. package/dist/rollup/index.min.cjs +19 -0
  13. package/dist/rollup/index.min.js +19 -1
  14. package/package.json +13 -11
  15. package/src/commands/base.ts +1 -2
  16. package/src/commands/build.ts +4 -2
  17. package/src/rollup/index.ts +2 -2
  18. package/src/utils/filterSupport.ts +2 -0
  19. package/src/utils/tsRegister.ts +4 -0
  20. package/dist/cli.d.mts.map +0 -1
  21. package/dist/cli.d.ts.map +0 -1
  22. package/dist/cli.js.map +0 -1
  23. package/dist/cli.min.js.map +0 -1
  24. package/dist/cli.min.mjs +0 -1
  25. package/dist/cli.min.mjs.map +0 -1
  26. package/dist/cli.mjs +0 -803
  27. package/dist/cli.mjs.map +0 -1
  28. package/dist/index.d.mts.map +0 -1
  29. package/dist/index.d.ts.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/index.min.js.map +0 -1
  32. package/dist/index.min.mjs +0 -1
  33. package/dist/index.min.mjs.map +0 -1
  34. package/dist/index.mjs +0 -3
  35. package/dist/index.mjs.map +0 -1
  36. package/dist/rollup/index.d.mts.map +0 -1
  37. package/dist/rollup/index.d.ts.map +0 -1
  38. package/dist/rollup/index.js.map +0 -1
  39. package/dist/rollup/index.min.js.map +0 -1
  40. package/dist/rollup/index.min.mjs +0 -1
  41. package/dist/rollup/index.min.mjs.map +0 -1
  42. package/dist/rollup/index.mjs +0 -551
  43. package/dist/rollup/index.mjs.map +0 -1
  44. package/src/pkg.ts +0 -1
  45. /package/dist/{cli.d.mts → cli.d.cts} +0 -0
  46. /package/dist/{index.d.mts → index.d.cts} +0 -0
  47. /package/dist/rollup/{index.d.mts → index.d.cts} +0 -0
package/dist/cli.js CHANGED
@@ -1,45 +1,26 @@
1
- 'use strict';
2
-
3
- var fs = require('node:fs');
4
- var path = require('node:path');
5
- var filterWorkspacePackages = require('@pnpm/filter-workspace-packages');
6
- var commander = require('commander');
7
- var jsYaml = require('js-yaml');
8
- var getWorkspaceDir = require('@jiek/utils/getWorkspaceDir');
9
- var cliProgress = require('cli-progress');
10
- var execa = require('execa');
11
- var detectIndent = require('detect-indent');
12
- var inquirer = require('inquirer');
13
- var jsoncParser = require('jsonc-parser');
14
- var micromatch = require('micromatch');
15
- var childProcess = require('node:child_process');
16
- var bumper = require('@jiek/utils/bumper');
17
- var entrypoints = require('@jiek/pkger/entrypoints');
18
-
19
- function _interopNamespaceDefault(e) {
20
- var n = Object.create(null);
21
- if (e) {
22
- Object.keys(e).forEach(function (k) {
23
- if (k !== 'default') {
24
- var d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () { return e[k]; }
28
- });
29
- }
30
- });
31
- }
32
- n.default = e;
33
- return Object.freeze(n);
34
- }
35
-
36
- var childProcess__namespace = /*#__PURE__*/_interopNamespaceDefault(childProcess);
1
+ import fs from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import path, { resolve as resolve$1, relative } from 'node:path';
4
+ import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages';
5
+ import { program } from 'commander';
6
+ import { load } from 'js-yaml';
7
+ import { isWorkspaceDir, getWorkspaceDir } from '@jiek/utils/getWorkspaceDir';
8
+ import { MultiBar, Presets } from 'cli-progress';
9
+ import { execaCommand } from 'execa';
10
+ import detectIndent from 'detect-indent';
11
+ import inquirer from 'inquirer';
12
+ import { applyEdits, modify } from 'jsonc-parser';
13
+ import require$$0 from 'util';
14
+ import require$$0$1 from 'path';
15
+ import * as childProcess from 'node:child_process';
16
+ import { bump } from '@jiek/utils/bumper';
17
+ import { resolveEntrypoints, filterLeafs, DEFAULT_SKIP_VALUES, entrypoints2Exports } from '@jiek/pkger/entrypoints';
37
18
 
38
19
  let root;
39
20
  function getRoot() {
40
21
  if (root)
41
22
  return root;
42
- const rootOption = commander.program.getOptionValue("root");
23
+ const rootOption = program.getOptionValue("root");
43
24
  root = rootOption ? path.isAbsolute(rootOption) ? rootOption : path.resolve(process.cwd(), rootOption) : void 0;
44
25
  return root;
45
26
  }
@@ -51,13 +32,13 @@ function getWD() {
51
32
  return { wd, notWorkspace };
52
33
  const root = getRoot();
53
34
  if (root !== void 0) {
54
- const isWorkspace = getWorkspaceDir.isWorkspaceDir(root, type);
35
+ const isWorkspace = isWorkspaceDir(root, type$1);
55
36
  notWorkspace = !isWorkspace;
56
37
  wd = root;
57
38
  return { wd, notWorkspace };
58
39
  }
59
40
  try {
60
- wd = getWorkspaceDir.getWorkspaceDir(type);
41
+ wd = getWorkspaceDir(type$1);
61
42
  } catch (e) {
62
43
  if ("message" in e && e.message === "workspace root not found") {
63
44
  wd = root;
@@ -69,23 +50,24 @@ function getWD() {
69
50
  return { wd, notWorkspace };
70
51
  }
71
52
 
72
- let type = "";
53
+ let type$1 = "";
73
54
  try {
55
+ const require = createRequire(import.meta.url);
74
56
  require.resolve("@pnpm/filter-workspace-packages");
75
- type = "pnpm";
57
+ type$1 = "pnpm";
76
58
  } catch {
77
59
  }
78
- if (type !== "") {
79
- commander.program.option("-f, --filter <filter>", "filter packages");
60
+ if (type$1 !== "") {
61
+ program.option("-f, --filter <filter>", "filter packages");
80
62
  }
81
63
  async function getSelectedProjectsGraph() {
82
- let filter = commander.program.getOptionValue("filter");
64
+ let filter = program.getOptionValue("filter");
83
65
  const root = getRoot();
84
66
  const { wd, notWorkspace } = getWD();
85
- if (!notWorkspace && type === "pnpm") {
67
+ if (!notWorkspace && type$1 === "pnpm") {
86
68
  const pnpmWorkspaceFilePath = path.resolve(wd, "pnpm-workspace.yaml");
87
69
  const pnpmWorkspaceFileContent = fs.readFileSync(pnpmWorkspaceFilePath, "utf-8");
88
- const pnpmWorkspace = jsYaml.load(pnpmWorkspaceFileContent);
70
+ const pnpmWorkspace = load(pnpmWorkspaceFileContent);
89
71
  if (root === wd && !filter) {
90
72
  throw new Error("root path is workspace root, please provide a filter");
91
73
  }
@@ -100,7 +82,7 @@ async function getSelectedProjectsGraph() {
100
82
  }
101
83
  filter = packageJSON.name;
102
84
  }
103
- const { selectedProjectsGraph } = await filterWorkspacePackages.filterPackagesFromDir(wd, [{
85
+ const { selectedProjectsGraph } = await filterPackagesFromDir(wd, [{
104
86
  filter: filter ?? "",
105
87
  followProdDepsOnly: true
106
88
  }], {
@@ -126,9 +108,96 @@ async function getSelectedProjectsGraph() {
126
108
  };
127
109
  }
128
110
 
129
- var pkg = require("../package.json");
111
+ var name = "jiek";
112
+ var type = "module";
113
+ var version = "0.4.7-alpha.10";
114
+ var description = "YiJie's personal kits.";
115
+ var bin = {
116
+ jiek: "bin/jiek.js",
117
+ jk: "bin/jiek.js"
118
+ };
119
+ var files = [
120
+ "dist",
121
+ "src",
122
+ "bin",
123
+ "LICENSE",
124
+ "README.md"
125
+ ];
126
+ var typesVersions = {
127
+ "<5.0": {
128
+ "*": [
129
+ "*",
130
+ "./dist/*",
131
+ "./dist/*/index.d.ts"
132
+ ]
133
+ }
134
+ };
135
+ var exports = {
136
+ "./package.json": "./package.json",
137
+ ".": "./src/index.ts",
138
+ "./cli": "./src/cli.ts",
139
+ "./rollup": "./src/rollup/index.ts"
140
+ };
141
+ var imports = {
142
+ "#~/*": "./src/*"
143
+ };
144
+ var dependencies = {
145
+ "@jiek/pkger": "workspace:^",
146
+ "@jiek/rollup-plugin-dts": "^6.1.1",
147
+ "@jiek/utils": "workspace:^",
148
+ "@rollup/plugin-commonjs": "^28.0.0",
149
+ "@rollup/plugin-json": "^6.0.1",
150
+ "@rollup/plugin-node-resolve": "^15.3.0",
151
+ "@rollup/plugin-terser": "^0.4.4",
152
+ autoprefixer: "^10.4.16",
153
+ "cli-progress": "^3.12.0",
154
+ commander: "^12.0.0",
155
+ "detect-indent": "^6.1.0",
156
+ execa: "9.3.1",
157
+ inquirer: "^8.2.6",
158
+ "js-yaml": "^4.1.0",
159
+ "jsonc-parser": "^3.2.1",
160
+ rollup: "^4.1.5",
161
+ "rollup-plugin-copy": "^3.5.0",
162
+ "rollup-plugin-esbuild": "^6.1.0",
163
+ typescript: "^5.0.0"
164
+ };
165
+ var optionalDependencies = {
166
+ "@pnpm/filter-workspace-packages": "^7.2.13",
167
+ "esbuild-register": "^3.5.0",
168
+ postcss: "^8.4.47",
169
+ "rollup-plugin-postcss": "^4.0.2"
170
+ };
171
+ var devDependencies = {
172
+ "@npm/types": "^1.0.2",
173
+ "@pnpm/filter-workspace-packages": "^7.2.13",
174
+ "@pnpm/workspace.pkgs-graph": "^2.0.15",
175
+ "@types/cli-progress": "^3.11.5",
176
+ "@types/inquirer": "^9.0.7",
177
+ "@types/js-yaml": "^4.0.9",
178
+ "@types/micromatch": "^4.0.6",
179
+ "esbuild-register": "^3.5.0",
180
+ micromatch: "^4.0.5",
181
+ "node-sass": "^9.0.0",
182
+ postcss: "^8.4.47",
183
+ "rollup-plugin-postcss": "^4.0.2"
184
+ };
185
+ var pkg = {
186
+ name: name,
187
+ type: type,
188
+ version: version,
189
+ description: description,
190
+ bin: bin,
191
+ files: files,
192
+ typesVersions: typesVersions,
193
+ exports: exports,
194
+ imports: imports,
195
+ dependencies: dependencies,
196
+ optionalDependencies: optionalDependencies,
197
+ devDependencies: devDependencies
198
+ };
130
199
 
131
- commander.program.version(pkg.version).description(pkg.description).option("--root <root>", "root path").option("-c, --config-path <configPath>", "config path");
200
+ program.version(pkg.version).description(pkg.description).option("--root <root>", "root path").option("-c, --config-path <configPath>", "config path");
132
201
 
133
202
  let resolve;
134
203
  function actionDone() {
@@ -138,9 +207,10 @@ function actionRestore() {
138
207
  new Promise((r) => resolve = r);
139
208
  }
140
209
 
210
+ const require$2 = createRequire(import.meta.url);
141
211
  function packageIsExist(name) {
142
212
  try {
143
- require.resolve(name);
213
+ require$2.resolve(name);
144
214
  return true;
145
215
  } catch (e) {
146
216
  return false;
@@ -193,7 +263,7 @@ function getConfigPath(root, dir) {
193
263
  }
194
264
  function loadConfig(dir) {
195
265
  const { wd: root } = getWD();
196
- let configPath = commander.program.getOptionValue("configPath");
266
+ let configPath = program.getOptionValue("configPath");
197
267
  if (!configPath) {
198
268
  configPath = getConfigPath(root, dir);
199
269
  } else {
@@ -213,7 +283,7 @@ function loadConfig(dir) {
213
283
  case ".json":
214
284
  return require(configPath);
215
285
  case ".yaml":
216
- return jsYaml.load(fs.readFileSync(configPath, "utf-8"));
286
+ return load(fs.readFileSync(configPath, "utf-8"));
217
287
  case ".ts":
218
288
  if (tsRegisterName) {
219
289
  require(tsRegisterName);
@@ -235,10 +305,10 @@ function loadConfig(dir) {
235
305
  }
236
306
 
237
307
  const FILE_TEMPLATE = (manifest) => `
238
- const manifest = ${JSON.stringify(manifest, null, 2)}
239
- module.exports = require('jiek/rollup').template(manifest)
308
+ module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null, 2)})
240
309
  `.trimStart();
241
- commander.program.command("build").option("-s, --silent", "Don't display logs.").option("-e, --entries <ENTRIES>", "Specify the entries of the package.json's 'exports' field.(support glob)").action(async ({
310
+ const require$1 = createRequire(import.meta.url);
311
+ program.command("build").option("-s, --silent", "Don't display logs.").option("-e, --entries <ENTRIES>", "Specify the entries of the package.json's 'exports' field.(support glob)").action(async ({
242
312
  silent,
243
313
  entries
244
314
  }) => {
@@ -260,12 +330,12 @@ commander.program.command("build").option("-s, --silent", "Don't display logs.")
260
330
  if (!fs.existsSync(jiekTempDir())) {
261
331
  fs.mkdirSync(jiekTempDir());
262
332
  }
263
- const rollupBinaryPath = require.resolve("rollup").replace(/dist\/rollup.js$/, "dist/bin/rollup");
264
- const multiBars = new cliProgress.MultiBar({
333
+ const rollupBinaryPath = require$1.resolve("rollup").replace(/dist\/rollup.js$/, "dist/bin/rollup");
334
+ const multiBars = new MultiBar({
265
335
  clearOnComplete: false,
266
336
  hideCursor: true,
267
337
  format: "- {bar} | {status} | {input} | {message}"
268
- }, cliProgress.Presets.shades_classic);
338
+ }, Presets.shades_classic);
269
339
  let i = 0;
270
340
  await Promise.all(
271
341
  Object.entries(value).map(async ([dir, manifest]) => {
@@ -279,7 +349,7 @@ commander.program.command("build").option("-s, --silent", "Don't display logs.")
279
349
  prefix = `node -r ${tsRegisterName} `;
280
350
  }
281
351
  const command = `${prefix}${rollupBinaryPath} --silent -c ${configFile}`;
282
- const child = execa.execaCommand(command, {
352
+ const child = execaCommand(command, {
283
353
  ipc: true,
284
354
  cwd: dir,
285
355
  env: {
@@ -361,6 +431,4112 @@ ${errorStr}`)));
361
431
  actionDone();
362
432
  });
363
433
 
434
+ var utils$1 = {};
435
+
436
+ var hasRequiredUtils$1;
437
+
438
+ function requireUtils$1 () {
439
+ if (hasRequiredUtils$1) return utils$1;
440
+ hasRequiredUtils$1 = 1;
441
+ (function (exports) {
442
+
443
+ exports.isInteger = num => {
444
+ if (typeof num === 'number') {
445
+ return Number.isInteger(num);
446
+ }
447
+ if (typeof num === 'string' && num.trim() !== '') {
448
+ return Number.isInteger(Number(num));
449
+ }
450
+ return false;
451
+ };
452
+
453
+ /**
454
+ * Find a node of the given type
455
+ */
456
+
457
+ exports.find = (node, type) => node.nodes.find(node => node.type === type);
458
+
459
+ /**
460
+ * Find a node of the given type
461
+ */
462
+
463
+ exports.exceedsLimit = (min, max, step = 1, limit) => {
464
+ if (limit === false) return false;
465
+ if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
466
+ return ((Number(max) - Number(min)) / Number(step)) >= limit;
467
+ };
468
+
469
+ /**
470
+ * Escape the given node with '\\' before node.value
471
+ */
472
+
473
+ exports.escapeNode = (block, n = 0, type) => {
474
+ let node = block.nodes[n];
475
+ if (!node) return;
476
+
477
+ if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
478
+ if (node.escaped !== true) {
479
+ node.value = '\\' + node.value;
480
+ node.escaped = true;
481
+ }
482
+ }
483
+ };
484
+
485
+ /**
486
+ * Returns true if the given brace node should be enclosed in literal braces
487
+ */
488
+
489
+ exports.encloseBrace = node => {
490
+ if (node.type !== 'brace') return false;
491
+ if ((node.commas >> 0 + node.ranges >> 0) === 0) {
492
+ node.invalid = true;
493
+ return true;
494
+ }
495
+ return false;
496
+ };
497
+
498
+ /**
499
+ * Returns true if a brace node is invalid.
500
+ */
501
+
502
+ exports.isInvalidBrace = block => {
503
+ if (block.type !== 'brace') return false;
504
+ if (block.invalid === true || block.dollar) return true;
505
+ if ((block.commas >> 0 + block.ranges >> 0) === 0) {
506
+ block.invalid = true;
507
+ return true;
508
+ }
509
+ if (block.open !== true || block.close !== true) {
510
+ block.invalid = true;
511
+ return true;
512
+ }
513
+ return false;
514
+ };
515
+
516
+ /**
517
+ * Returns true if a node is an open or close node
518
+ */
519
+
520
+ exports.isOpenOrClose = node => {
521
+ if (node.type === 'open' || node.type === 'close') {
522
+ return true;
523
+ }
524
+ return node.open === true || node.close === true;
525
+ };
526
+
527
+ /**
528
+ * Reduce an array of text nodes.
529
+ */
530
+
531
+ exports.reduce = nodes => nodes.reduce((acc, node) => {
532
+ if (node.type === 'text') acc.push(node.value);
533
+ if (node.type === 'range') node.type = 'text';
534
+ return acc;
535
+ }, []);
536
+
537
+ /**
538
+ * Flatten an array
539
+ */
540
+
541
+ exports.flatten = (...args) => {
542
+ const result = [];
543
+ const flat = arr => {
544
+ for (let i = 0; i < arr.length; i++) {
545
+ let ele = arr[i];
546
+ Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
547
+ }
548
+ return result;
549
+ };
550
+ flat(args);
551
+ return result;
552
+ };
553
+ } (utils$1));
554
+ return utils$1;
555
+ }
556
+
557
+ var stringify;
558
+ var hasRequiredStringify;
559
+
560
+ function requireStringify () {
561
+ if (hasRequiredStringify) return stringify;
562
+ hasRequiredStringify = 1;
563
+
564
+ const utils = requireUtils$1();
565
+
566
+ stringify = (ast, options = {}) => {
567
+ let stringify = (node, parent = {}) => {
568
+ let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
569
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
570
+ let output = '';
571
+
572
+ if (node.value) {
573
+ if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
574
+ return '\\' + node.value;
575
+ }
576
+ return node.value;
577
+ }
578
+
579
+ if (node.value) {
580
+ return node.value;
581
+ }
582
+
583
+ if (node.nodes) {
584
+ for (let child of node.nodes) {
585
+ output += stringify(child);
586
+ }
587
+ }
588
+ return output;
589
+ };
590
+
591
+ return stringify(ast);
592
+ };
593
+ return stringify;
594
+ }
595
+
596
+ /*!
597
+ * is-number <https://github.com/jonschlinkert/is-number>
598
+ *
599
+ * Copyright (c) 2014-present, Jon Schlinkert.
600
+ * Released under the MIT License.
601
+ */
602
+
603
+ var isNumber;
604
+ var hasRequiredIsNumber;
605
+
606
+ function requireIsNumber () {
607
+ if (hasRequiredIsNumber) return isNumber;
608
+ hasRequiredIsNumber = 1;
609
+
610
+ isNumber = function(num) {
611
+ if (typeof num === 'number') {
612
+ return num - num === 0;
613
+ }
614
+ if (typeof num === 'string' && num.trim() !== '') {
615
+ return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
616
+ }
617
+ return false;
618
+ };
619
+ return isNumber;
620
+ }
621
+
622
+ /*!
623
+ * to-regex-range <https://github.com/micromatch/to-regex-range>
624
+ *
625
+ * Copyright (c) 2015-present, Jon Schlinkert.
626
+ * Released under the MIT License.
627
+ */
628
+
629
+ var toRegexRange_1;
630
+ var hasRequiredToRegexRange;
631
+
632
+ function requireToRegexRange () {
633
+ if (hasRequiredToRegexRange) return toRegexRange_1;
634
+ hasRequiredToRegexRange = 1;
635
+
636
+ const isNumber = requireIsNumber();
637
+
638
+ const toRegexRange = (min, max, options) => {
639
+ if (isNumber(min) === false) {
640
+ throw new TypeError('toRegexRange: expected the first argument to be a number');
641
+ }
642
+
643
+ if (max === void 0 || min === max) {
644
+ return String(min);
645
+ }
646
+
647
+ if (isNumber(max) === false) {
648
+ throw new TypeError('toRegexRange: expected the second argument to be a number.');
649
+ }
650
+
651
+ let opts = { relaxZeros: true, ...options };
652
+ if (typeof opts.strictZeros === 'boolean') {
653
+ opts.relaxZeros = opts.strictZeros === false;
654
+ }
655
+
656
+ let relax = String(opts.relaxZeros);
657
+ let shorthand = String(opts.shorthand);
658
+ let capture = String(opts.capture);
659
+ let wrap = String(opts.wrap);
660
+ let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
661
+
662
+ if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
663
+ return toRegexRange.cache[cacheKey].result;
664
+ }
665
+
666
+ let a = Math.min(min, max);
667
+ let b = Math.max(min, max);
668
+
669
+ if (Math.abs(a - b) === 1) {
670
+ let result = min + '|' + max;
671
+ if (opts.capture) {
672
+ return `(${result})`;
673
+ }
674
+ if (opts.wrap === false) {
675
+ return result;
676
+ }
677
+ return `(?:${result})`;
678
+ }
679
+
680
+ let isPadded = hasPadding(min) || hasPadding(max);
681
+ let state = { min, max, a, b };
682
+ let positives = [];
683
+ let negatives = [];
684
+
685
+ if (isPadded) {
686
+ state.isPadded = isPadded;
687
+ state.maxLen = String(state.max).length;
688
+ }
689
+
690
+ if (a < 0) {
691
+ let newMin = b < 0 ? Math.abs(b) : 1;
692
+ negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
693
+ a = state.a = 0;
694
+ }
695
+
696
+ if (b >= 0) {
697
+ positives = splitToPatterns(a, b, state, opts);
698
+ }
699
+
700
+ state.negatives = negatives;
701
+ state.positives = positives;
702
+ state.result = collatePatterns(negatives, positives);
703
+
704
+ if (opts.capture === true) {
705
+ state.result = `(${state.result})`;
706
+ } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) {
707
+ state.result = `(?:${state.result})`;
708
+ }
709
+
710
+ toRegexRange.cache[cacheKey] = state;
711
+ return state.result;
712
+ };
713
+
714
+ function collatePatterns(neg, pos, options) {
715
+ let onlyNegative = filterPatterns(neg, pos, '-', false) || [];
716
+ let onlyPositive = filterPatterns(pos, neg, '', false) || [];
717
+ let intersected = filterPatterns(neg, pos, '-?', true) || [];
718
+ let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
719
+ return subpatterns.join('|');
720
+ }
721
+
722
+ function splitToRanges(min, max) {
723
+ let nines = 1;
724
+ let zeros = 1;
725
+
726
+ let stop = countNines(min, nines);
727
+ let stops = new Set([max]);
728
+
729
+ while (min <= stop && stop <= max) {
730
+ stops.add(stop);
731
+ nines += 1;
732
+ stop = countNines(min, nines);
733
+ }
734
+
735
+ stop = countZeros(max + 1, zeros) - 1;
736
+
737
+ while (min < stop && stop <= max) {
738
+ stops.add(stop);
739
+ zeros += 1;
740
+ stop = countZeros(max + 1, zeros) - 1;
741
+ }
742
+
743
+ stops = [...stops];
744
+ stops.sort(compare);
745
+ return stops;
746
+ }
747
+
748
+ /**
749
+ * Convert a range to a regex pattern
750
+ * @param {Number} `start`
751
+ * @param {Number} `stop`
752
+ * @return {String}
753
+ */
754
+
755
+ function rangeToPattern(start, stop, options) {
756
+ if (start === stop) {
757
+ return { pattern: start, count: [], digits: 0 };
758
+ }
759
+
760
+ let zipped = zip(start, stop);
761
+ let digits = zipped.length;
762
+ let pattern = '';
763
+ let count = 0;
764
+
765
+ for (let i = 0; i < digits; i++) {
766
+ let [startDigit, stopDigit] = zipped[i];
767
+
768
+ if (startDigit === stopDigit) {
769
+ pattern += startDigit;
770
+
771
+ } else if (startDigit !== '0' || stopDigit !== '9') {
772
+ pattern += toCharacterClass(startDigit, stopDigit);
773
+
774
+ } else {
775
+ count++;
776
+ }
777
+ }
778
+
779
+ if (count) {
780
+ pattern += options.shorthand === true ? '\\d' : '[0-9]';
781
+ }
782
+
783
+ return { pattern, count: [count], digits };
784
+ }
785
+
786
+ function splitToPatterns(min, max, tok, options) {
787
+ let ranges = splitToRanges(min, max);
788
+ let tokens = [];
789
+ let start = min;
790
+ let prev;
791
+
792
+ for (let i = 0; i < ranges.length; i++) {
793
+ let max = ranges[i];
794
+ let obj = rangeToPattern(String(start), String(max), options);
795
+ let zeros = '';
796
+
797
+ if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
798
+ if (prev.count.length > 1) {
799
+ prev.count.pop();
800
+ }
801
+
802
+ prev.count.push(obj.count[0]);
803
+ prev.string = prev.pattern + toQuantifier(prev.count);
804
+ start = max + 1;
805
+ continue;
806
+ }
807
+
808
+ if (tok.isPadded) {
809
+ zeros = padZeros(max, tok, options);
810
+ }
811
+
812
+ obj.string = zeros + obj.pattern + toQuantifier(obj.count);
813
+ tokens.push(obj);
814
+ start = max + 1;
815
+ prev = obj;
816
+ }
817
+
818
+ return tokens;
819
+ }
820
+
821
+ function filterPatterns(arr, comparison, prefix, intersection, options) {
822
+ let result = [];
823
+
824
+ for (let ele of arr) {
825
+ let { string } = ele;
826
+
827
+ // only push if _both_ are negative...
828
+ if (!intersection && !contains(comparison, 'string', string)) {
829
+ result.push(prefix + string);
830
+ }
831
+
832
+ // or _both_ are positive
833
+ if (intersection && contains(comparison, 'string', string)) {
834
+ result.push(prefix + string);
835
+ }
836
+ }
837
+ return result;
838
+ }
839
+
840
+ /**
841
+ * Zip strings
842
+ */
843
+
844
+ function zip(a, b) {
845
+ let arr = [];
846
+ for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
847
+ return arr;
848
+ }
849
+
850
+ function compare(a, b) {
851
+ return a > b ? 1 : b > a ? -1 : 0;
852
+ }
853
+
854
+ function contains(arr, key, val) {
855
+ return arr.some(ele => ele[key] === val);
856
+ }
857
+
858
+ function countNines(min, len) {
859
+ return Number(String(min).slice(0, -len) + '9'.repeat(len));
860
+ }
861
+
862
+ function countZeros(integer, zeros) {
863
+ return integer - (integer % Math.pow(10, zeros));
864
+ }
865
+
866
+ function toQuantifier(digits) {
867
+ let [start = 0, stop = ''] = digits;
868
+ if (stop || start > 1) {
869
+ return `{${start + (stop ? ',' + stop : '')}}`;
870
+ }
871
+ return '';
872
+ }
873
+
874
+ function toCharacterClass(a, b, options) {
875
+ return `[${a}${(b - a === 1) ? '' : '-'}${b}]`;
876
+ }
877
+
878
+ function hasPadding(str) {
879
+ return /^-?(0+)\d/.test(str);
880
+ }
881
+
882
+ function padZeros(value, tok, options) {
883
+ if (!tok.isPadded) {
884
+ return value;
885
+ }
886
+
887
+ let diff = Math.abs(tok.maxLen - String(value).length);
888
+ let relax = options.relaxZeros !== false;
889
+
890
+ switch (diff) {
891
+ case 0:
892
+ return '';
893
+ case 1:
894
+ return relax ? '0?' : '0';
895
+ case 2:
896
+ return relax ? '0{0,2}' : '00';
897
+ default: {
898
+ return relax ? `0{0,${diff}}` : `0{${diff}}`;
899
+ }
900
+ }
901
+ }
902
+
903
+ /**
904
+ * Cache
905
+ */
906
+
907
+ toRegexRange.cache = {};
908
+ toRegexRange.clearCache = () => (toRegexRange.cache = {});
909
+
910
+ /**
911
+ * Expose `toRegexRange`
912
+ */
913
+
914
+ toRegexRange_1 = toRegexRange;
915
+ return toRegexRange_1;
916
+ }
917
+
918
+ /*!
919
+ * fill-range <https://github.com/jonschlinkert/fill-range>
920
+ *
921
+ * Copyright (c) 2014-present, Jon Schlinkert.
922
+ * Licensed under the MIT License.
923
+ */
924
+
925
+ var fillRange;
926
+ var hasRequiredFillRange;
927
+
928
+ function requireFillRange () {
929
+ if (hasRequiredFillRange) return fillRange;
930
+ hasRequiredFillRange = 1;
931
+
932
+ const util = require$$0;
933
+ const toRegexRange = requireToRegexRange();
934
+
935
+ const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
936
+
937
+ const transform = toNumber => {
938
+ return value => toNumber === true ? Number(value) : String(value);
939
+ };
940
+
941
+ const isValidValue = value => {
942
+ return typeof value === 'number' || (typeof value === 'string' && value !== '');
943
+ };
944
+
945
+ const isNumber = num => Number.isInteger(+num);
946
+
947
+ const zeros = input => {
948
+ let value = `${input}`;
949
+ let index = -1;
950
+ if (value[0] === '-') value = value.slice(1);
951
+ if (value === '0') return false;
952
+ while (value[++index] === '0');
953
+ return index > 0;
954
+ };
955
+
956
+ const stringify = (start, end, options) => {
957
+ if (typeof start === 'string' || typeof end === 'string') {
958
+ return true;
959
+ }
960
+ return options.stringify === true;
961
+ };
962
+
963
+ const pad = (input, maxLength, toNumber) => {
964
+ if (maxLength > 0) {
965
+ let dash = input[0] === '-' ? '-' : '';
966
+ if (dash) input = input.slice(1);
967
+ input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'));
968
+ }
969
+ if (toNumber === false) {
970
+ return String(input);
971
+ }
972
+ return input;
973
+ };
974
+
975
+ const toMaxLen = (input, maxLength) => {
976
+ let negative = input[0] === '-' ? '-' : '';
977
+ if (negative) {
978
+ input = input.slice(1);
979
+ maxLength--;
980
+ }
981
+ while (input.length < maxLength) input = '0' + input;
982
+ return negative ? ('-' + input) : input;
983
+ };
984
+
985
+ const toSequence = (parts, options) => {
986
+ parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
987
+ parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
988
+
989
+ let prefix = options.capture ? '' : '?:';
990
+ let positives = '';
991
+ let negatives = '';
992
+ let result;
993
+
994
+ if (parts.positives.length) {
995
+ positives = parts.positives.join('|');
996
+ }
997
+
998
+ if (parts.negatives.length) {
999
+ negatives = `-(${prefix}${parts.negatives.join('|')})`;
1000
+ }
1001
+
1002
+ if (positives && negatives) {
1003
+ result = `${positives}|${negatives}`;
1004
+ } else {
1005
+ result = positives || negatives;
1006
+ }
1007
+
1008
+ if (options.wrap) {
1009
+ return `(${prefix}${result})`;
1010
+ }
1011
+
1012
+ return result;
1013
+ };
1014
+
1015
+ const toRange = (a, b, isNumbers, options) => {
1016
+ if (isNumbers) {
1017
+ return toRegexRange(a, b, { wrap: false, ...options });
1018
+ }
1019
+
1020
+ let start = String.fromCharCode(a);
1021
+ if (a === b) return start;
1022
+
1023
+ let stop = String.fromCharCode(b);
1024
+ return `[${start}-${stop}]`;
1025
+ };
1026
+
1027
+ const toRegex = (start, end, options) => {
1028
+ if (Array.isArray(start)) {
1029
+ let wrap = options.wrap === true;
1030
+ let prefix = options.capture ? '' : '?:';
1031
+ return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
1032
+ }
1033
+ return toRegexRange(start, end, options);
1034
+ };
1035
+
1036
+ const rangeError = (...args) => {
1037
+ return new RangeError('Invalid range arguments: ' + util.inspect(...args));
1038
+ };
1039
+
1040
+ const invalidRange = (start, end, options) => {
1041
+ if (options.strictRanges === true) throw rangeError([start, end]);
1042
+ return [];
1043
+ };
1044
+
1045
+ const invalidStep = (step, options) => {
1046
+ if (options.strictRanges === true) {
1047
+ throw new TypeError(`Expected step "${step}" to be a number`);
1048
+ }
1049
+ return [];
1050
+ };
1051
+
1052
+ const fillNumbers = (start, end, step = 1, options = {}) => {
1053
+ let a = Number(start);
1054
+ let b = Number(end);
1055
+
1056
+ if (!Number.isInteger(a) || !Number.isInteger(b)) {
1057
+ if (options.strictRanges === true) throw rangeError([start, end]);
1058
+ return [];
1059
+ }
1060
+
1061
+ // fix negative zero
1062
+ if (a === 0) a = 0;
1063
+ if (b === 0) b = 0;
1064
+
1065
+ let descending = a > b;
1066
+ let startString = String(start);
1067
+ let endString = String(end);
1068
+ let stepString = String(step);
1069
+ step = Math.max(Math.abs(step), 1);
1070
+
1071
+ let padded = zeros(startString) || zeros(endString) || zeros(stepString);
1072
+ let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
1073
+ let toNumber = padded === false && stringify(start, end, options) === false;
1074
+ let format = options.transform || transform(toNumber);
1075
+
1076
+ if (options.toRegex && step === 1) {
1077
+ return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
1078
+ }
1079
+
1080
+ let parts = { negatives: [], positives: [] };
1081
+ let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
1082
+ let range = [];
1083
+ let index = 0;
1084
+
1085
+ while (descending ? a >= b : a <= b) {
1086
+ if (options.toRegex === true && step > 1) {
1087
+ push(a);
1088
+ } else {
1089
+ range.push(pad(format(a, index), maxLen, toNumber));
1090
+ }
1091
+ a = descending ? a - step : a + step;
1092
+ index++;
1093
+ }
1094
+
1095
+ if (options.toRegex === true) {
1096
+ return step > 1
1097
+ ? toSequence(parts, options)
1098
+ : toRegex(range, null, { wrap: false, ...options });
1099
+ }
1100
+
1101
+ return range;
1102
+ };
1103
+
1104
+ const fillLetters = (start, end, step = 1, options = {}) => {
1105
+ if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
1106
+ return invalidRange(start, end, options);
1107
+ }
1108
+
1109
+
1110
+ let format = options.transform || (val => String.fromCharCode(val));
1111
+ let a = `${start}`.charCodeAt(0);
1112
+ let b = `${end}`.charCodeAt(0);
1113
+
1114
+ let descending = a > b;
1115
+ let min = Math.min(a, b);
1116
+ let max = Math.max(a, b);
1117
+
1118
+ if (options.toRegex && step === 1) {
1119
+ return toRange(min, max, false, options);
1120
+ }
1121
+
1122
+ let range = [];
1123
+ let index = 0;
1124
+
1125
+ while (descending ? a >= b : a <= b) {
1126
+ range.push(format(a, index));
1127
+ a = descending ? a - step : a + step;
1128
+ index++;
1129
+ }
1130
+
1131
+ if (options.toRegex === true) {
1132
+ return toRegex(range, null, { wrap: false, options });
1133
+ }
1134
+
1135
+ return range;
1136
+ };
1137
+
1138
+ const fill = (start, end, step, options = {}) => {
1139
+ if (end == null && isValidValue(start)) {
1140
+ return [start];
1141
+ }
1142
+
1143
+ if (!isValidValue(start) || !isValidValue(end)) {
1144
+ return invalidRange(start, end, options);
1145
+ }
1146
+
1147
+ if (typeof step === 'function') {
1148
+ return fill(start, end, 1, { transform: step });
1149
+ }
1150
+
1151
+ if (isObject(step)) {
1152
+ return fill(start, end, 0, step);
1153
+ }
1154
+
1155
+ let opts = { ...options };
1156
+ if (opts.capture === true) opts.wrap = true;
1157
+ step = step || opts.step || 1;
1158
+
1159
+ if (!isNumber(step)) {
1160
+ if (step != null && !isObject(step)) return invalidStep(step, opts);
1161
+ return fill(start, end, 1, step);
1162
+ }
1163
+
1164
+ if (isNumber(start) && isNumber(end)) {
1165
+ return fillNumbers(start, end, step, opts);
1166
+ }
1167
+
1168
+ return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
1169
+ };
1170
+
1171
+ fillRange = fill;
1172
+ return fillRange;
1173
+ }
1174
+
1175
+ var compile_1;
1176
+ var hasRequiredCompile;
1177
+
1178
+ function requireCompile () {
1179
+ if (hasRequiredCompile) return compile_1;
1180
+ hasRequiredCompile = 1;
1181
+
1182
+ const fill = requireFillRange();
1183
+ const utils = requireUtils$1();
1184
+
1185
+ const compile = (ast, options = {}) => {
1186
+ let walk = (node, parent = {}) => {
1187
+ let invalidBlock = utils.isInvalidBrace(parent);
1188
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
1189
+ let invalid = invalidBlock === true || invalidNode === true;
1190
+ let prefix = options.escapeInvalid === true ? '\\' : '';
1191
+ let output = '';
1192
+
1193
+ if (node.isOpen === true) {
1194
+ return prefix + node.value;
1195
+ }
1196
+ if (node.isClose === true) {
1197
+ return prefix + node.value;
1198
+ }
1199
+
1200
+ if (node.type === 'open') {
1201
+ return invalid ? (prefix + node.value) : '(';
1202
+ }
1203
+
1204
+ if (node.type === 'close') {
1205
+ return invalid ? (prefix + node.value) : ')';
1206
+ }
1207
+
1208
+ if (node.type === 'comma') {
1209
+ return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
1210
+ }
1211
+
1212
+ if (node.value) {
1213
+ return node.value;
1214
+ }
1215
+
1216
+ if (node.nodes && node.ranges > 0) {
1217
+ let args = utils.reduce(node.nodes);
1218
+ let range = fill(...args, { ...options, wrap: false, toRegex: true });
1219
+
1220
+ if (range.length !== 0) {
1221
+ return args.length > 1 && range.length > 1 ? `(${range})` : range;
1222
+ }
1223
+ }
1224
+
1225
+ if (node.nodes) {
1226
+ for (let child of node.nodes) {
1227
+ output += walk(child, node);
1228
+ }
1229
+ }
1230
+ return output;
1231
+ };
1232
+
1233
+ return walk(ast);
1234
+ };
1235
+
1236
+ compile_1 = compile;
1237
+ return compile_1;
1238
+ }
1239
+
1240
+ var expand_1;
1241
+ var hasRequiredExpand;
1242
+
1243
+ function requireExpand () {
1244
+ if (hasRequiredExpand) return expand_1;
1245
+ hasRequiredExpand = 1;
1246
+
1247
+ const fill = requireFillRange();
1248
+ const stringify = requireStringify();
1249
+ const utils = requireUtils$1();
1250
+
1251
+ const append = (queue = '', stash = '', enclose = false) => {
1252
+ let result = [];
1253
+
1254
+ queue = [].concat(queue);
1255
+ stash = [].concat(stash);
1256
+
1257
+ if (!stash.length) return queue;
1258
+ if (!queue.length) {
1259
+ return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
1260
+ }
1261
+
1262
+ for (let item of queue) {
1263
+ if (Array.isArray(item)) {
1264
+ for (let value of item) {
1265
+ result.push(append(value, stash, enclose));
1266
+ }
1267
+ } else {
1268
+ for (let ele of stash) {
1269
+ if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
1270
+ result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
1271
+ }
1272
+ }
1273
+ }
1274
+ return utils.flatten(result);
1275
+ };
1276
+
1277
+ const expand = (ast, options = {}) => {
1278
+ let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
1279
+
1280
+ let walk = (node, parent = {}) => {
1281
+ node.queue = [];
1282
+
1283
+ let p = parent;
1284
+ let q = parent.queue;
1285
+
1286
+ while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
1287
+ p = p.parent;
1288
+ q = p.queue;
1289
+ }
1290
+
1291
+ if (node.invalid || node.dollar) {
1292
+ q.push(append(q.pop(), stringify(node, options)));
1293
+ return;
1294
+ }
1295
+
1296
+ if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
1297
+ q.push(append(q.pop(), ['{}']));
1298
+ return;
1299
+ }
1300
+
1301
+ if (node.nodes && node.ranges > 0) {
1302
+ let args = utils.reduce(node.nodes);
1303
+
1304
+ if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
1305
+ throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
1306
+ }
1307
+
1308
+ let range = fill(...args, options);
1309
+ if (range.length === 0) {
1310
+ range = stringify(node, options);
1311
+ }
1312
+
1313
+ q.push(append(q.pop(), range));
1314
+ node.nodes = [];
1315
+ return;
1316
+ }
1317
+
1318
+ let enclose = utils.encloseBrace(node);
1319
+ let queue = node.queue;
1320
+ let block = node;
1321
+
1322
+ while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
1323
+ block = block.parent;
1324
+ queue = block.queue;
1325
+ }
1326
+
1327
+ for (let i = 0; i < node.nodes.length; i++) {
1328
+ let child = node.nodes[i];
1329
+
1330
+ if (child.type === 'comma' && node.type === 'brace') {
1331
+ if (i === 1) queue.push('');
1332
+ queue.push('');
1333
+ continue;
1334
+ }
1335
+
1336
+ if (child.type === 'close') {
1337
+ q.push(append(q.pop(), queue, enclose));
1338
+ continue;
1339
+ }
1340
+
1341
+ if (child.value && child.type !== 'open') {
1342
+ queue.push(append(queue.pop(), child.value));
1343
+ continue;
1344
+ }
1345
+
1346
+ if (child.nodes) {
1347
+ walk(child, node);
1348
+ }
1349
+ }
1350
+
1351
+ return queue;
1352
+ };
1353
+
1354
+ return utils.flatten(walk(ast));
1355
+ };
1356
+
1357
+ expand_1 = expand;
1358
+ return expand_1;
1359
+ }
1360
+
1361
+ var constants$1;
1362
+ var hasRequiredConstants$1;
1363
+
1364
+ function requireConstants$1 () {
1365
+ if (hasRequiredConstants$1) return constants$1;
1366
+ hasRequiredConstants$1 = 1;
1367
+
1368
+ constants$1 = {
1369
+ MAX_LENGTH: 1024 * 64,
1370
+
1371
+ // Digits
1372
+ CHAR_0: '0', /* 0 */
1373
+ CHAR_9: '9', /* 9 */
1374
+
1375
+ // Alphabet chars.
1376
+ CHAR_UPPERCASE_A: 'A', /* A */
1377
+ CHAR_LOWERCASE_A: 'a', /* a */
1378
+ CHAR_UPPERCASE_Z: 'Z', /* Z */
1379
+ CHAR_LOWERCASE_Z: 'z', /* z */
1380
+
1381
+ CHAR_LEFT_PARENTHESES: '(', /* ( */
1382
+ CHAR_RIGHT_PARENTHESES: ')', /* ) */
1383
+
1384
+ CHAR_ASTERISK: '*', /* * */
1385
+
1386
+ // Non-alphabetic chars.
1387
+ CHAR_AMPERSAND: '&', /* & */
1388
+ CHAR_AT: '@', /* @ */
1389
+ CHAR_BACKSLASH: '\\', /* \ */
1390
+ CHAR_BACKTICK: '`', /* ` */
1391
+ CHAR_CARRIAGE_RETURN: '\r', /* \r */
1392
+ CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
1393
+ CHAR_COLON: ':', /* : */
1394
+ CHAR_COMMA: ',', /* , */
1395
+ CHAR_DOLLAR: '$', /* . */
1396
+ CHAR_DOT: '.', /* . */
1397
+ CHAR_DOUBLE_QUOTE: '"', /* " */
1398
+ CHAR_EQUAL: '=', /* = */
1399
+ CHAR_EXCLAMATION_MARK: '!', /* ! */
1400
+ CHAR_FORM_FEED: '\f', /* \f */
1401
+ CHAR_FORWARD_SLASH: '/', /* / */
1402
+ CHAR_HASH: '#', /* # */
1403
+ CHAR_HYPHEN_MINUS: '-', /* - */
1404
+ CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
1405
+ CHAR_LEFT_CURLY_BRACE: '{', /* { */
1406
+ CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
1407
+ CHAR_LINE_FEED: '\n', /* \n */
1408
+ CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
1409
+ CHAR_PERCENT: '%', /* % */
1410
+ CHAR_PLUS: '+', /* + */
1411
+ CHAR_QUESTION_MARK: '?', /* ? */
1412
+ CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
1413
+ CHAR_RIGHT_CURLY_BRACE: '}', /* } */
1414
+ CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
1415
+ CHAR_SEMICOLON: ';', /* ; */
1416
+ CHAR_SINGLE_QUOTE: '\'', /* ' */
1417
+ CHAR_SPACE: ' ', /* */
1418
+ CHAR_TAB: '\t', /* \t */
1419
+ CHAR_UNDERSCORE: '_', /* _ */
1420
+ CHAR_VERTICAL_LINE: '|', /* | */
1421
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
1422
+ };
1423
+ return constants$1;
1424
+ }
1425
+
1426
+ var parse_1$1;
1427
+ var hasRequiredParse$1;
1428
+
1429
+ function requireParse$1 () {
1430
+ if (hasRequiredParse$1) return parse_1$1;
1431
+ hasRequiredParse$1 = 1;
1432
+
1433
+ const stringify = requireStringify();
1434
+
1435
+ /**
1436
+ * Constants
1437
+ */
1438
+
1439
+ const {
1440
+ MAX_LENGTH,
1441
+ CHAR_BACKSLASH, /* \ */
1442
+ CHAR_BACKTICK, /* ` */
1443
+ CHAR_COMMA, /* , */
1444
+ CHAR_DOT, /* . */
1445
+ CHAR_LEFT_PARENTHESES, /* ( */
1446
+ CHAR_RIGHT_PARENTHESES, /* ) */
1447
+ CHAR_LEFT_CURLY_BRACE, /* { */
1448
+ CHAR_RIGHT_CURLY_BRACE, /* } */
1449
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
1450
+ CHAR_RIGHT_SQUARE_BRACKET, /* ] */
1451
+ CHAR_DOUBLE_QUOTE, /* " */
1452
+ CHAR_SINGLE_QUOTE, /* ' */
1453
+ CHAR_NO_BREAK_SPACE,
1454
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE
1455
+ } = requireConstants$1();
1456
+
1457
+ /**
1458
+ * parse
1459
+ */
1460
+
1461
+ const parse = (input, options = {}) => {
1462
+ if (typeof input !== 'string') {
1463
+ throw new TypeError('Expected a string');
1464
+ }
1465
+
1466
+ let opts = options || {};
1467
+ let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1468
+ if (input.length > max) {
1469
+ throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
1470
+ }
1471
+
1472
+ let ast = { type: 'root', input, nodes: [] };
1473
+ let stack = [ast];
1474
+ let block = ast;
1475
+ let prev = ast;
1476
+ let brackets = 0;
1477
+ let length = input.length;
1478
+ let index = 0;
1479
+ let depth = 0;
1480
+ let value;
1481
+
1482
+ /**
1483
+ * Helpers
1484
+ */
1485
+
1486
+ const advance = () => input[index++];
1487
+ const push = node => {
1488
+ if (node.type === 'text' && prev.type === 'dot') {
1489
+ prev.type = 'text';
1490
+ }
1491
+
1492
+ if (prev && prev.type === 'text' && node.type === 'text') {
1493
+ prev.value += node.value;
1494
+ return;
1495
+ }
1496
+
1497
+ block.nodes.push(node);
1498
+ node.parent = block;
1499
+ node.prev = prev;
1500
+ prev = node;
1501
+ return node;
1502
+ };
1503
+
1504
+ push({ type: 'bos' });
1505
+
1506
+ while (index < length) {
1507
+ block = stack[stack.length - 1];
1508
+ value = advance();
1509
+
1510
+ /**
1511
+ * Invalid chars
1512
+ */
1513
+
1514
+ if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
1515
+ continue;
1516
+ }
1517
+
1518
+ /**
1519
+ * Escaped chars
1520
+ */
1521
+
1522
+ if (value === CHAR_BACKSLASH) {
1523
+ push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
1524
+ continue;
1525
+ }
1526
+
1527
+ /**
1528
+ * Right square bracket (literal): ']'
1529
+ */
1530
+
1531
+ if (value === CHAR_RIGHT_SQUARE_BRACKET) {
1532
+ push({ type: 'text', value: '\\' + value });
1533
+ continue;
1534
+ }
1535
+
1536
+ /**
1537
+ * Left square bracket: '['
1538
+ */
1539
+
1540
+ if (value === CHAR_LEFT_SQUARE_BRACKET) {
1541
+ brackets++;
1542
+ let next;
1543
+
1544
+ while (index < length && (next = advance())) {
1545
+ value += next;
1546
+
1547
+ if (next === CHAR_LEFT_SQUARE_BRACKET) {
1548
+ brackets++;
1549
+ continue;
1550
+ }
1551
+
1552
+ if (next === CHAR_BACKSLASH) {
1553
+ value += advance();
1554
+ continue;
1555
+ }
1556
+
1557
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
1558
+ brackets--;
1559
+
1560
+ if (brackets === 0) {
1561
+ break;
1562
+ }
1563
+ }
1564
+ }
1565
+
1566
+ push({ type: 'text', value });
1567
+ continue;
1568
+ }
1569
+
1570
+ /**
1571
+ * Parentheses
1572
+ */
1573
+
1574
+ if (value === CHAR_LEFT_PARENTHESES) {
1575
+ block = push({ type: 'paren', nodes: [] });
1576
+ stack.push(block);
1577
+ push({ type: 'text', value });
1578
+ continue;
1579
+ }
1580
+
1581
+ if (value === CHAR_RIGHT_PARENTHESES) {
1582
+ if (block.type !== 'paren') {
1583
+ push({ type: 'text', value });
1584
+ continue;
1585
+ }
1586
+ block = stack.pop();
1587
+ push({ type: 'text', value });
1588
+ block = stack[stack.length - 1];
1589
+ continue;
1590
+ }
1591
+
1592
+ /**
1593
+ * Quotes: '|"|`
1594
+ */
1595
+
1596
+ if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
1597
+ let open = value;
1598
+ let next;
1599
+
1600
+ if (options.keepQuotes !== true) {
1601
+ value = '';
1602
+ }
1603
+
1604
+ while (index < length && (next = advance())) {
1605
+ if (next === CHAR_BACKSLASH) {
1606
+ value += next + advance();
1607
+ continue;
1608
+ }
1609
+
1610
+ if (next === open) {
1611
+ if (options.keepQuotes === true) value += next;
1612
+ break;
1613
+ }
1614
+
1615
+ value += next;
1616
+ }
1617
+
1618
+ push({ type: 'text', value });
1619
+ continue;
1620
+ }
1621
+
1622
+ /**
1623
+ * Left curly brace: '{'
1624
+ */
1625
+
1626
+ if (value === CHAR_LEFT_CURLY_BRACE) {
1627
+ depth++;
1628
+
1629
+ let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
1630
+ let brace = {
1631
+ type: 'brace',
1632
+ open: true,
1633
+ close: false,
1634
+ dollar,
1635
+ depth,
1636
+ commas: 0,
1637
+ ranges: 0,
1638
+ nodes: []
1639
+ };
1640
+
1641
+ block = push(brace);
1642
+ stack.push(block);
1643
+ push({ type: 'open', value });
1644
+ continue;
1645
+ }
1646
+
1647
+ /**
1648
+ * Right curly brace: '}'
1649
+ */
1650
+
1651
+ if (value === CHAR_RIGHT_CURLY_BRACE) {
1652
+ if (block.type !== 'brace') {
1653
+ push({ type: 'text', value });
1654
+ continue;
1655
+ }
1656
+
1657
+ let type = 'close';
1658
+ block = stack.pop();
1659
+ block.close = true;
1660
+
1661
+ push({ type, value });
1662
+ depth--;
1663
+
1664
+ block = stack[stack.length - 1];
1665
+ continue;
1666
+ }
1667
+
1668
+ /**
1669
+ * Comma: ','
1670
+ */
1671
+
1672
+ if (value === CHAR_COMMA && depth > 0) {
1673
+ if (block.ranges > 0) {
1674
+ block.ranges = 0;
1675
+ let open = block.nodes.shift();
1676
+ block.nodes = [open, { type: 'text', value: stringify(block) }];
1677
+ }
1678
+
1679
+ push({ type: 'comma', value });
1680
+ block.commas++;
1681
+ continue;
1682
+ }
1683
+
1684
+ /**
1685
+ * Dot: '.'
1686
+ */
1687
+
1688
+ if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
1689
+ let siblings = block.nodes;
1690
+
1691
+ if (depth === 0 || siblings.length === 0) {
1692
+ push({ type: 'text', value });
1693
+ continue;
1694
+ }
1695
+
1696
+ if (prev.type === 'dot') {
1697
+ block.range = [];
1698
+ prev.value += value;
1699
+ prev.type = 'range';
1700
+
1701
+ if (block.nodes.length !== 3 && block.nodes.length !== 5) {
1702
+ block.invalid = true;
1703
+ block.ranges = 0;
1704
+ prev.type = 'text';
1705
+ continue;
1706
+ }
1707
+
1708
+ block.ranges++;
1709
+ block.args = [];
1710
+ continue;
1711
+ }
1712
+
1713
+ if (prev.type === 'range') {
1714
+ siblings.pop();
1715
+
1716
+ let before = siblings[siblings.length - 1];
1717
+ before.value += prev.value + value;
1718
+ prev = before;
1719
+ block.ranges--;
1720
+ continue;
1721
+ }
1722
+
1723
+ push({ type: 'dot', value });
1724
+ continue;
1725
+ }
1726
+
1727
+ /**
1728
+ * Text
1729
+ */
1730
+
1731
+ push({ type: 'text', value });
1732
+ }
1733
+
1734
+ // Mark imbalanced braces and brackets as invalid
1735
+ do {
1736
+ block = stack.pop();
1737
+
1738
+ if (block.type !== 'root') {
1739
+ block.nodes.forEach(node => {
1740
+ if (!node.nodes) {
1741
+ if (node.type === 'open') node.isOpen = true;
1742
+ if (node.type === 'close') node.isClose = true;
1743
+ if (!node.nodes) node.type = 'text';
1744
+ node.invalid = true;
1745
+ }
1746
+ });
1747
+
1748
+ // get the location of the block on parent.nodes (block's siblings)
1749
+ let parent = stack[stack.length - 1];
1750
+ let index = parent.nodes.indexOf(block);
1751
+ // replace the (invalid) block with it's nodes
1752
+ parent.nodes.splice(index, 1, ...block.nodes);
1753
+ }
1754
+ } while (stack.length > 0);
1755
+
1756
+ push({ type: 'eos' });
1757
+ return ast;
1758
+ };
1759
+
1760
+ parse_1$1 = parse;
1761
+ return parse_1$1;
1762
+ }
1763
+
1764
+ var braces_1;
1765
+ var hasRequiredBraces;
1766
+
1767
+ function requireBraces () {
1768
+ if (hasRequiredBraces) return braces_1;
1769
+ hasRequiredBraces = 1;
1770
+
1771
+ const stringify = requireStringify();
1772
+ const compile = requireCompile();
1773
+ const expand = requireExpand();
1774
+ const parse = requireParse$1();
1775
+
1776
+ /**
1777
+ * Expand the given pattern or create a regex-compatible string.
1778
+ *
1779
+ * ```js
1780
+ * const braces = require('braces');
1781
+ * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
1782
+ * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
1783
+ * ```
1784
+ * @param {String} `str`
1785
+ * @param {Object} `options`
1786
+ * @return {String}
1787
+ * @api public
1788
+ */
1789
+
1790
+ const braces = (input, options = {}) => {
1791
+ let output = [];
1792
+
1793
+ if (Array.isArray(input)) {
1794
+ for (let pattern of input) {
1795
+ let result = braces.create(pattern, options);
1796
+ if (Array.isArray(result)) {
1797
+ output.push(...result);
1798
+ } else {
1799
+ output.push(result);
1800
+ }
1801
+ }
1802
+ } else {
1803
+ output = [].concat(braces.create(input, options));
1804
+ }
1805
+
1806
+ if (options && options.expand === true && options.nodupes === true) {
1807
+ output = [...new Set(output)];
1808
+ }
1809
+ return output;
1810
+ };
1811
+
1812
+ /**
1813
+ * Parse the given `str` with the given `options`.
1814
+ *
1815
+ * ```js
1816
+ * // braces.parse(pattern, [, options]);
1817
+ * const ast = braces.parse('a/{b,c}/d');
1818
+ * console.log(ast);
1819
+ * ```
1820
+ * @param {String} pattern Brace pattern to parse
1821
+ * @param {Object} options
1822
+ * @return {Object} Returns an AST
1823
+ * @api public
1824
+ */
1825
+
1826
+ braces.parse = (input, options = {}) => parse(input, options);
1827
+
1828
+ /**
1829
+ * Creates a braces string from an AST, or an AST node.
1830
+ *
1831
+ * ```js
1832
+ * const braces = require('braces');
1833
+ * let ast = braces.parse('foo/{a,b}/bar');
1834
+ * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
1835
+ * ```
1836
+ * @param {String} `input` Brace pattern or AST.
1837
+ * @param {Object} `options`
1838
+ * @return {Array} Returns an array of expanded values.
1839
+ * @api public
1840
+ */
1841
+
1842
+ braces.stringify = (input, options = {}) => {
1843
+ if (typeof input === 'string') {
1844
+ return stringify(braces.parse(input, options), options);
1845
+ }
1846
+ return stringify(input, options);
1847
+ };
1848
+
1849
+ /**
1850
+ * Compiles a brace pattern into a regex-compatible, optimized string.
1851
+ * This method is called by the main [braces](#braces) function by default.
1852
+ *
1853
+ * ```js
1854
+ * const braces = require('braces');
1855
+ * console.log(braces.compile('a/{b,c}/d'));
1856
+ * //=> ['a/(b|c)/d']
1857
+ * ```
1858
+ * @param {String} `input` Brace pattern or AST.
1859
+ * @param {Object} `options`
1860
+ * @return {Array} Returns an array of expanded values.
1861
+ * @api public
1862
+ */
1863
+
1864
+ braces.compile = (input, options = {}) => {
1865
+ if (typeof input === 'string') {
1866
+ input = braces.parse(input, options);
1867
+ }
1868
+ return compile(input, options);
1869
+ };
1870
+
1871
+ /**
1872
+ * Expands a brace pattern into an array. This method is called by the
1873
+ * main [braces](#braces) function when `options.expand` is true. Before
1874
+ * using this method it's recommended that you read the [performance notes](#performance))
1875
+ * and advantages of using [.compile](#compile) instead.
1876
+ *
1877
+ * ```js
1878
+ * const braces = require('braces');
1879
+ * console.log(braces.expand('a/{b,c}/d'));
1880
+ * //=> ['a/b/d', 'a/c/d'];
1881
+ * ```
1882
+ * @param {String} `pattern` Brace pattern
1883
+ * @param {Object} `options`
1884
+ * @return {Array} Returns an array of expanded values.
1885
+ * @api public
1886
+ */
1887
+
1888
+ braces.expand = (input, options = {}) => {
1889
+ if (typeof input === 'string') {
1890
+ input = braces.parse(input, options);
1891
+ }
1892
+
1893
+ let result = expand(input, options);
1894
+
1895
+ // filter out empty strings if specified
1896
+ if (options.noempty === true) {
1897
+ result = result.filter(Boolean);
1898
+ }
1899
+
1900
+ // filter out duplicates if specified
1901
+ if (options.nodupes === true) {
1902
+ result = [...new Set(result)];
1903
+ }
1904
+
1905
+ return result;
1906
+ };
1907
+
1908
+ /**
1909
+ * Processes a brace pattern and returns either an expanded array
1910
+ * (if `options.expand` is true), a highly optimized regex-compatible string.
1911
+ * This method is called by the main [braces](#braces) function.
1912
+ *
1913
+ * ```js
1914
+ * const braces = require('braces');
1915
+ * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
1916
+ * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
1917
+ * ```
1918
+ * @param {String} `pattern` Brace pattern
1919
+ * @param {Object} `options`
1920
+ * @return {Array} Returns an array of expanded values.
1921
+ * @api public
1922
+ */
1923
+
1924
+ braces.create = (input, options = {}) => {
1925
+ if (input === '' || input.length < 3) {
1926
+ return [input];
1927
+ }
1928
+
1929
+ return options.expand !== true
1930
+ ? braces.compile(input, options)
1931
+ : braces.expand(input, options);
1932
+ };
1933
+
1934
+ /**
1935
+ * Expose "braces"
1936
+ */
1937
+
1938
+ braces_1 = braces;
1939
+ return braces_1;
1940
+ }
1941
+
1942
+ var utils = {};
1943
+
1944
+ var constants;
1945
+ var hasRequiredConstants;
1946
+
1947
+ function requireConstants () {
1948
+ if (hasRequiredConstants) return constants;
1949
+ hasRequiredConstants = 1;
1950
+
1951
+ const path = require$$0$1;
1952
+ const WIN_SLASH = '\\\\/';
1953
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1954
+
1955
+ /**
1956
+ * Posix glob regex
1957
+ */
1958
+
1959
+ const DOT_LITERAL = '\\.';
1960
+ const PLUS_LITERAL = '\\+';
1961
+ const QMARK_LITERAL = '\\?';
1962
+ const SLASH_LITERAL = '\\/';
1963
+ const ONE_CHAR = '(?=.)';
1964
+ const QMARK = '[^/]';
1965
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
1966
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
1967
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
1968
+ const NO_DOT = `(?!${DOT_LITERAL})`;
1969
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
1970
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
1971
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1972
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1973
+ const STAR = `${QMARK}*?`;
1974
+
1975
+ const POSIX_CHARS = {
1976
+ DOT_LITERAL,
1977
+ PLUS_LITERAL,
1978
+ QMARK_LITERAL,
1979
+ SLASH_LITERAL,
1980
+ ONE_CHAR,
1981
+ QMARK,
1982
+ END_ANCHOR,
1983
+ DOTS_SLASH,
1984
+ NO_DOT,
1985
+ NO_DOTS,
1986
+ NO_DOT_SLASH,
1987
+ NO_DOTS_SLASH,
1988
+ QMARK_NO_DOT,
1989
+ STAR,
1990
+ START_ANCHOR
1991
+ };
1992
+
1993
+ /**
1994
+ * Windows glob regex
1995
+ */
1996
+
1997
+ const WINDOWS_CHARS = {
1998
+ ...POSIX_CHARS,
1999
+
2000
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
2001
+ QMARK: WIN_NO_SLASH,
2002
+ STAR: `${WIN_NO_SLASH}*?`,
2003
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
2004
+ NO_DOT: `(?!${DOT_LITERAL})`,
2005
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
2006
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
2007
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
2008
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
2009
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
2010
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
2011
+ };
2012
+
2013
+ /**
2014
+ * POSIX Bracket Regex
2015
+ */
2016
+
2017
+ const POSIX_REGEX_SOURCE = {
2018
+ alnum: 'a-zA-Z0-9',
2019
+ alpha: 'a-zA-Z',
2020
+ ascii: '\\x00-\\x7F',
2021
+ blank: ' \\t',
2022
+ cntrl: '\\x00-\\x1F\\x7F',
2023
+ digit: '0-9',
2024
+ graph: '\\x21-\\x7E',
2025
+ lower: 'a-z',
2026
+ print: '\\x20-\\x7E ',
2027
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
2028
+ space: ' \\t\\r\\n\\v\\f',
2029
+ upper: 'A-Z',
2030
+ word: 'A-Za-z0-9_',
2031
+ xdigit: 'A-Fa-f0-9'
2032
+ };
2033
+
2034
+ constants = {
2035
+ MAX_LENGTH: 1024 * 64,
2036
+ POSIX_REGEX_SOURCE,
2037
+
2038
+ // regular expressions
2039
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
2040
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
2041
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
2042
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
2043
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
2044
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
2045
+
2046
+ // Replace globs with equivalent patterns to reduce parsing time.
2047
+ REPLACEMENTS: {
2048
+ '***': '*',
2049
+ '**/**': '**',
2050
+ '**/**/**': '**'
2051
+ },
2052
+
2053
+ // Digits
2054
+ CHAR_0: 48, /* 0 */
2055
+ CHAR_9: 57, /* 9 */
2056
+
2057
+ // Alphabet chars.
2058
+ CHAR_UPPERCASE_A: 65, /* A */
2059
+ CHAR_LOWERCASE_A: 97, /* a */
2060
+ CHAR_UPPERCASE_Z: 90, /* Z */
2061
+ CHAR_LOWERCASE_Z: 122, /* z */
2062
+
2063
+ CHAR_LEFT_PARENTHESES: 40, /* ( */
2064
+ CHAR_RIGHT_PARENTHESES: 41, /* ) */
2065
+
2066
+ CHAR_ASTERISK: 42, /* * */
2067
+
2068
+ // Non-alphabetic chars.
2069
+ CHAR_AMPERSAND: 38, /* & */
2070
+ CHAR_AT: 64, /* @ */
2071
+ CHAR_BACKWARD_SLASH: 92, /* \ */
2072
+ CHAR_CARRIAGE_RETURN: 13, /* \r */
2073
+ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
2074
+ CHAR_COLON: 58, /* : */
2075
+ CHAR_COMMA: 44, /* , */
2076
+ CHAR_DOT: 46, /* . */
2077
+ CHAR_DOUBLE_QUOTE: 34, /* " */
2078
+ CHAR_EQUAL: 61, /* = */
2079
+ CHAR_EXCLAMATION_MARK: 33, /* ! */
2080
+ CHAR_FORM_FEED: 12, /* \f */
2081
+ CHAR_FORWARD_SLASH: 47, /* / */
2082
+ CHAR_GRAVE_ACCENT: 96, /* ` */
2083
+ CHAR_HASH: 35, /* # */
2084
+ CHAR_HYPHEN_MINUS: 45, /* - */
2085
+ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
2086
+ CHAR_LEFT_CURLY_BRACE: 123, /* { */
2087
+ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
2088
+ CHAR_LINE_FEED: 10, /* \n */
2089
+ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
2090
+ CHAR_PERCENT: 37, /* % */
2091
+ CHAR_PLUS: 43, /* + */
2092
+ CHAR_QUESTION_MARK: 63, /* ? */
2093
+ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
2094
+ CHAR_RIGHT_CURLY_BRACE: 125, /* } */
2095
+ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
2096
+ CHAR_SEMICOLON: 59, /* ; */
2097
+ CHAR_SINGLE_QUOTE: 39, /* ' */
2098
+ CHAR_SPACE: 32, /* */
2099
+ CHAR_TAB: 9, /* \t */
2100
+ CHAR_UNDERSCORE: 95, /* _ */
2101
+ CHAR_VERTICAL_LINE: 124, /* | */
2102
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
2103
+
2104
+ SEP: path.sep,
2105
+
2106
+ /**
2107
+ * Create EXTGLOB_CHARS
2108
+ */
2109
+
2110
+ extglobChars(chars) {
2111
+ return {
2112
+ '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
2113
+ '?': { type: 'qmark', open: '(?:', close: ')?' },
2114
+ '+': { type: 'plus', open: '(?:', close: ')+' },
2115
+ '*': { type: 'star', open: '(?:', close: ')*' },
2116
+ '@': { type: 'at', open: '(?:', close: ')' }
2117
+ };
2118
+ },
2119
+
2120
+ /**
2121
+ * Create GLOB_CHARS
2122
+ */
2123
+
2124
+ globChars(win32) {
2125
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
2126
+ }
2127
+ };
2128
+ return constants;
2129
+ }
2130
+
2131
+ var hasRequiredUtils;
2132
+
2133
+ function requireUtils () {
2134
+ if (hasRequiredUtils) return utils;
2135
+ hasRequiredUtils = 1;
2136
+ (function (exports) {
2137
+
2138
+ const path = require$$0$1;
2139
+ const win32 = process.platform === 'win32';
2140
+ const {
2141
+ REGEX_BACKSLASH,
2142
+ REGEX_REMOVE_BACKSLASH,
2143
+ REGEX_SPECIAL_CHARS,
2144
+ REGEX_SPECIAL_CHARS_GLOBAL
2145
+ } = requireConstants();
2146
+
2147
+ exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
2148
+ exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
2149
+ exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
2150
+ exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
2151
+ exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
2152
+
2153
+ exports.removeBackslashes = str => {
2154
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
2155
+ return match === '\\' ? '' : match;
2156
+ });
2157
+ };
2158
+
2159
+ exports.supportsLookbehinds = () => {
2160
+ const segs = process.version.slice(1).split('.').map(Number);
2161
+ if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
2162
+ return true;
2163
+ }
2164
+ return false;
2165
+ };
2166
+
2167
+ exports.isWindows = options => {
2168
+ if (options && typeof options.windows === 'boolean') {
2169
+ return options.windows;
2170
+ }
2171
+ return win32 === true || path.sep === '\\';
2172
+ };
2173
+
2174
+ exports.escapeLast = (input, char, lastIdx) => {
2175
+ const idx = input.lastIndexOf(char, lastIdx);
2176
+ if (idx === -1) return input;
2177
+ if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
2178
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
2179
+ };
2180
+
2181
+ exports.removePrefix = (input, state = {}) => {
2182
+ let output = input;
2183
+ if (output.startsWith('./')) {
2184
+ output = output.slice(2);
2185
+ state.prefix = './';
2186
+ }
2187
+ return output;
2188
+ };
2189
+
2190
+ exports.wrapOutput = (input, state = {}, options = {}) => {
2191
+ const prepend = options.contains ? '' : '^';
2192
+ const append = options.contains ? '' : '$';
2193
+
2194
+ let output = `${prepend}(?:${input})${append}`;
2195
+ if (state.negated === true) {
2196
+ output = `(?:^(?!${output}).*$)`;
2197
+ }
2198
+ return output;
2199
+ };
2200
+ } (utils));
2201
+ return utils;
2202
+ }
2203
+
2204
+ var scan_1;
2205
+ var hasRequiredScan;
2206
+
2207
+ function requireScan () {
2208
+ if (hasRequiredScan) return scan_1;
2209
+ hasRequiredScan = 1;
2210
+
2211
+ const utils = requireUtils();
2212
+ const {
2213
+ CHAR_ASTERISK, /* * */
2214
+ CHAR_AT, /* @ */
2215
+ CHAR_BACKWARD_SLASH, /* \ */
2216
+ CHAR_COMMA, /* , */
2217
+ CHAR_DOT, /* . */
2218
+ CHAR_EXCLAMATION_MARK, /* ! */
2219
+ CHAR_FORWARD_SLASH, /* / */
2220
+ CHAR_LEFT_CURLY_BRACE, /* { */
2221
+ CHAR_LEFT_PARENTHESES, /* ( */
2222
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
2223
+ CHAR_PLUS, /* + */
2224
+ CHAR_QUESTION_MARK, /* ? */
2225
+ CHAR_RIGHT_CURLY_BRACE, /* } */
2226
+ CHAR_RIGHT_PARENTHESES, /* ) */
2227
+ CHAR_RIGHT_SQUARE_BRACKET /* ] */
2228
+ } = requireConstants();
2229
+
2230
+ const isPathSeparator = code => {
2231
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
2232
+ };
2233
+
2234
+ const depth = token => {
2235
+ if (token.isPrefix !== true) {
2236
+ token.depth = token.isGlobstar ? Infinity : 1;
2237
+ }
2238
+ };
2239
+
2240
+ /**
2241
+ * Quickly scans a glob pattern and returns an object with a handful of
2242
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
2243
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
2244
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
2245
+ *
2246
+ * ```js
2247
+ * const pm = require('picomatch');
2248
+ * console.log(pm.scan('foo/bar/*.js'));
2249
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
2250
+ * ```
2251
+ * @param {String} `str`
2252
+ * @param {Object} `options`
2253
+ * @return {Object} Returns an object with tokens and regex source string.
2254
+ * @api public
2255
+ */
2256
+
2257
+ const scan = (input, options) => {
2258
+ const opts = options || {};
2259
+
2260
+ const length = input.length - 1;
2261
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
2262
+ const slashes = [];
2263
+ const tokens = [];
2264
+ const parts = [];
2265
+
2266
+ let str = input;
2267
+ let index = -1;
2268
+ let start = 0;
2269
+ let lastIndex = 0;
2270
+ let isBrace = false;
2271
+ let isBracket = false;
2272
+ let isGlob = false;
2273
+ let isExtglob = false;
2274
+ let isGlobstar = false;
2275
+ let braceEscaped = false;
2276
+ let backslashes = false;
2277
+ let negated = false;
2278
+ let negatedExtglob = false;
2279
+ let finished = false;
2280
+ let braces = 0;
2281
+ let prev;
2282
+ let code;
2283
+ let token = { value: '', depth: 0, isGlob: false };
2284
+
2285
+ const eos = () => index >= length;
2286
+ const peek = () => str.charCodeAt(index + 1);
2287
+ const advance = () => {
2288
+ prev = code;
2289
+ return str.charCodeAt(++index);
2290
+ };
2291
+
2292
+ while (index < length) {
2293
+ code = advance();
2294
+ let next;
2295
+
2296
+ if (code === CHAR_BACKWARD_SLASH) {
2297
+ backslashes = token.backslashes = true;
2298
+ code = advance();
2299
+
2300
+ if (code === CHAR_LEFT_CURLY_BRACE) {
2301
+ braceEscaped = true;
2302
+ }
2303
+ continue;
2304
+ }
2305
+
2306
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
2307
+ braces++;
2308
+
2309
+ while (eos() !== true && (code = advance())) {
2310
+ if (code === CHAR_BACKWARD_SLASH) {
2311
+ backslashes = token.backslashes = true;
2312
+ advance();
2313
+ continue;
2314
+ }
2315
+
2316
+ if (code === CHAR_LEFT_CURLY_BRACE) {
2317
+ braces++;
2318
+ continue;
2319
+ }
2320
+
2321
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
2322
+ isBrace = token.isBrace = true;
2323
+ isGlob = token.isGlob = true;
2324
+ finished = true;
2325
+
2326
+ if (scanToEnd === true) {
2327
+ continue;
2328
+ }
2329
+
2330
+ break;
2331
+ }
2332
+
2333
+ if (braceEscaped !== true && code === CHAR_COMMA) {
2334
+ isBrace = token.isBrace = true;
2335
+ isGlob = token.isGlob = true;
2336
+ finished = true;
2337
+
2338
+ if (scanToEnd === true) {
2339
+ continue;
2340
+ }
2341
+
2342
+ break;
2343
+ }
2344
+
2345
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
2346
+ braces--;
2347
+
2348
+ if (braces === 0) {
2349
+ braceEscaped = false;
2350
+ isBrace = token.isBrace = true;
2351
+ finished = true;
2352
+ break;
2353
+ }
2354
+ }
2355
+ }
2356
+
2357
+ if (scanToEnd === true) {
2358
+ continue;
2359
+ }
2360
+
2361
+ break;
2362
+ }
2363
+
2364
+ if (code === CHAR_FORWARD_SLASH) {
2365
+ slashes.push(index);
2366
+ tokens.push(token);
2367
+ token = { value: '', depth: 0, isGlob: false };
2368
+
2369
+ if (finished === true) continue;
2370
+ if (prev === CHAR_DOT && index === (start + 1)) {
2371
+ start += 2;
2372
+ continue;
2373
+ }
2374
+
2375
+ lastIndex = index + 1;
2376
+ continue;
2377
+ }
2378
+
2379
+ if (opts.noext !== true) {
2380
+ const isExtglobChar = code === CHAR_PLUS
2381
+ || code === CHAR_AT
2382
+ || code === CHAR_ASTERISK
2383
+ || code === CHAR_QUESTION_MARK
2384
+ || code === CHAR_EXCLAMATION_MARK;
2385
+
2386
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
2387
+ isGlob = token.isGlob = true;
2388
+ isExtglob = token.isExtglob = true;
2389
+ finished = true;
2390
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
2391
+ negatedExtglob = true;
2392
+ }
2393
+
2394
+ if (scanToEnd === true) {
2395
+ while (eos() !== true && (code = advance())) {
2396
+ if (code === CHAR_BACKWARD_SLASH) {
2397
+ backslashes = token.backslashes = true;
2398
+ code = advance();
2399
+ continue;
2400
+ }
2401
+
2402
+ if (code === CHAR_RIGHT_PARENTHESES) {
2403
+ isGlob = token.isGlob = true;
2404
+ finished = true;
2405
+ break;
2406
+ }
2407
+ }
2408
+ continue;
2409
+ }
2410
+ break;
2411
+ }
2412
+ }
2413
+
2414
+ if (code === CHAR_ASTERISK) {
2415
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
2416
+ isGlob = token.isGlob = true;
2417
+ finished = true;
2418
+
2419
+ if (scanToEnd === true) {
2420
+ continue;
2421
+ }
2422
+ break;
2423
+ }
2424
+
2425
+ if (code === CHAR_QUESTION_MARK) {
2426
+ isGlob = token.isGlob = true;
2427
+ finished = true;
2428
+
2429
+ if (scanToEnd === true) {
2430
+ continue;
2431
+ }
2432
+ break;
2433
+ }
2434
+
2435
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
2436
+ while (eos() !== true && (next = advance())) {
2437
+ if (next === CHAR_BACKWARD_SLASH) {
2438
+ backslashes = token.backslashes = true;
2439
+ advance();
2440
+ continue;
2441
+ }
2442
+
2443
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
2444
+ isBracket = token.isBracket = true;
2445
+ isGlob = token.isGlob = true;
2446
+ finished = true;
2447
+ break;
2448
+ }
2449
+ }
2450
+
2451
+ if (scanToEnd === true) {
2452
+ continue;
2453
+ }
2454
+
2455
+ break;
2456
+ }
2457
+
2458
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
2459
+ negated = token.negated = true;
2460
+ start++;
2461
+ continue;
2462
+ }
2463
+
2464
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
2465
+ isGlob = token.isGlob = true;
2466
+
2467
+ if (scanToEnd === true) {
2468
+ while (eos() !== true && (code = advance())) {
2469
+ if (code === CHAR_LEFT_PARENTHESES) {
2470
+ backslashes = token.backslashes = true;
2471
+ code = advance();
2472
+ continue;
2473
+ }
2474
+
2475
+ if (code === CHAR_RIGHT_PARENTHESES) {
2476
+ finished = true;
2477
+ break;
2478
+ }
2479
+ }
2480
+ continue;
2481
+ }
2482
+ break;
2483
+ }
2484
+
2485
+ if (isGlob === true) {
2486
+ finished = true;
2487
+
2488
+ if (scanToEnd === true) {
2489
+ continue;
2490
+ }
2491
+
2492
+ break;
2493
+ }
2494
+ }
2495
+
2496
+ if (opts.noext === true) {
2497
+ isExtglob = false;
2498
+ isGlob = false;
2499
+ }
2500
+
2501
+ let base = str;
2502
+ let prefix = '';
2503
+ let glob = '';
2504
+
2505
+ if (start > 0) {
2506
+ prefix = str.slice(0, start);
2507
+ str = str.slice(start);
2508
+ lastIndex -= start;
2509
+ }
2510
+
2511
+ if (base && isGlob === true && lastIndex > 0) {
2512
+ base = str.slice(0, lastIndex);
2513
+ glob = str.slice(lastIndex);
2514
+ } else if (isGlob === true) {
2515
+ base = '';
2516
+ glob = str;
2517
+ } else {
2518
+ base = str;
2519
+ }
2520
+
2521
+ if (base && base !== '' && base !== '/' && base !== str) {
2522
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
2523
+ base = base.slice(0, -1);
2524
+ }
2525
+ }
2526
+
2527
+ if (opts.unescape === true) {
2528
+ if (glob) glob = utils.removeBackslashes(glob);
2529
+
2530
+ if (base && backslashes === true) {
2531
+ base = utils.removeBackslashes(base);
2532
+ }
2533
+ }
2534
+
2535
+ const state = {
2536
+ prefix,
2537
+ input,
2538
+ start,
2539
+ base,
2540
+ glob,
2541
+ isBrace,
2542
+ isBracket,
2543
+ isGlob,
2544
+ isExtglob,
2545
+ isGlobstar,
2546
+ negated,
2547
+ negatedExtglob
2548
+ };
2549
+
2550
+ if (opts.tokens === true) {
2551
+ state.maxDepth = 0;
2552
+ if (!isPathSeparator(code)) {
2553
+ tokens.push(token);
2554
+ }
2555
+ state.tokens = tokens;
2556
+ }
2557
+
2558
+ if (opts.parts === true || opts.tokens === true) {
2559
+ let prevIndex;
2560
+
2561
+ for (let idx = 0; idx < slashes.length; idx++) {
2562
+ const n = prevIndex ? prevIndex + 1 : start;
2563
+ const i = slashes[idx];
2564
+ const value = input.slice(n, i);
2565
+ if (opts.tokens) {
2566
+ if (idx === 0 && start !== 0) {
2567
+ tokens[idx].isPrefix = true;
2568
+ tokens[idx].value = prefix;
2569
+ } else {
2570
+ tokens[idx].value = value;
2571
+ }
2572
+ depth(tokens[idx]);
2573
+ state.maxDepth += tokens[idx].depth;
2574
+ }
2575
+ if (idx !== 0 || value !== '') {
2576
+ parts.push(value);
2577
+ }
2578
+ prevIndex = i;
2579
+ }
2580
+
2581
+ if (prevIndex && prevIndex + 1 < input.length) {
2582
+ const value = input.slice(prevIndex + 1);
2583
+ parts.push(value);
2584
+
2585
+ if (opts.tokens) {
2586
+ tokens[tokens.length - 1].value = value;
2587
+ depth(tokens[tokens.length - 1]);
2588
+ state.maxDepth += tokens[tokens.length - 1].depth;
2589
+ }
2590
+ }
2591
+
2592
+ state.slashes = slashes;
2593
+ state.parts = parts;
2594
+ }
2595
+
2596
+ return state;
2597
+ };
2598
+
2599
+ scan_1 = scan;
2600
+ return scan_1;
2601
+ }
2602
+
2603
+ var parse_1;
2604
+ var hasRequiredParse;
2605
+
2606
+ function requireParse () {
2607
+ if (hasRequiredParse) return parse_1;
2608
+ hasRequiredParse = 1;
2609
+
2610
+ const constants = requireConstants();
2611
+ const utils = requireUtils();
2612
+
2613
+ /**
2614
+ * Constants
2615
+ */
2616
+
2617
+ const {
2618
+ MAX_LENGTH,
2619
+ POSIX_REGEX_SOURCE,
2620
+ REGEX_NON_SPECIAL_CHARS,
2621
+ REGEX_SPECIAL_CHARS_BACKREF,
2622
+ REPLACEMENTS
2623
+ } = constants;
2624
+
2625
+ /**
2626
+ * Helpers
2627
+ */
2628
+
2629
+ const expandRange = (args, options) => {
2630
+ if (typeof options.expandRange === 'function') {
2631
+ return options.expandRange(...args, options);
2632
+ }
2633
+
2634
+ args.sort();
2635
+ const value = `[${args.join('-')}]`;
2636
+
2637
+ try {
2638
+ /* eslint-disable-next-line no-new */
2639
+ new RegExp(value);
2640
+ } catch (ex) {
2641
+ return args.map(v => utils.escapeRegex(v)).join('..');
2642
+ }
2643
+
2644
+ return value;
2645
+ };
2646
+
2647
+ /**
2648
+ * Create the message for a syntax error
2649
+ */
2650
+
2651
+ const syntaxError = (type, char) => {
2652
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2653
+ };
2654
+
2655
+ /**
2656
+ * Parse the given input string.
2657
+ * @param {String} input
2658
+ * @param {Object} options
2659
+ * @return {Object}
2660
+ */
2661
+
2662
+ const parse = (input, options) => {
2663
+ if (typeof input !== 'string') {
2664
+ throw new TypeError('Expected a string');
2665
+ }
2666
+
2667
+ input = REPLACEMENTS[input] || input;
2668
+
2669
+ const opts = { ...options };
2670
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2671
+
2672
+ let len = input.length;
2673
+ if (len > max) {
2674
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2675
+ }
2676
+
2677
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
2678
+ const tokens = [bos];
2679
+
2680
+ const capture = opts.capture ? '' : '?:';
2681
+ const win32 = utils.isWindows(options);
2682
+
2683
+ // create constants based on platform, for windows or posix
2684
+ const PLATFORM_CHARS = constants.globChars(win32);
2685
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
2686
+
2687
+ const {
2688
+ DOT_LITERAL,
2689
+ PLUS_LITERAL,
2690
+ SLASH_LITERAL,
2691
+ ONE_CHAR,
2692
+ DOTS_SLASH,
2693
+ NO_DOT,
2694
+ NO_DOT_SLASH,
2695
+ NO_DOTS_SLASH,
2696
+ QMARK,
2697
+ QMARK_NO_DOT,
2698
+ STAR,
2699
+ START_ANCHOR
2700
+ } = PLATFORM_CHARS;
2701
+
2702
+ const globstar = opts => {
2703
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2704
+ };
2705
+
2706
+ const nodot = opts.dot ? '' : NO_DOT;
2707
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
2708
+ let star = opts.bash === true ? globstar(opts) : STAR;
2709
+
2710
+ if (opts.capture) {
2711
+ star = `(${star})`;
2712
+ }
2713
+
2714
+ // minimatch options support
2715
+ if (typeof opts.noext === 'boolean') {
2716
+ opts.noextglob = opts.noext;
2717
+ }
2718
+
2719
+ const state = {
2720
+ input,
2721
+ index: -1,
2722
+ start: 0,
2723
+ dot: opts.dot === true,
2724
+ consumed: '',
2725
+ output: '',
2726
+ prefix: '',
2727
+ backtrack: false,
2728
+ negated: false,
2729
+ brackets: 0,
2730
+ braces: 0,
2731
+ parens: 0,
2732
+ quotes: 0,
2733
+ globstar: false,
2734
+ tokens
2735
+ };
2736
+
2737
+ input = utils.removePrefix(input, state);
2738
+ len = input.length;
2739
+
2740
+ const extglobs = [];
2741
+ const braces = [];
2742
+ const stack = [];
2743
+ let prev = bos;
2744
+ let value;
2745
+
2746
+ /**
2747
+ * Tokenizing helpers
2748
+ */
2749
+
2750
+ const eos = () => state.index === len - 1;
2751
+ const peek = state.peek = (n = 1) => input[state.index + n];
2752
+ const advance = state.advance = () => input[++state.index] || '';
2753
+ const remaining = () => input.slice(state.index + 1);
2754
+ const consume = (value = '', num = 0) => {
2755
+ state.consumed += value;
2756
+ state.index += num;
2757
+ };
2758
+
2759
+ const append = token => {
2760
+ state.output += token.output != null ? token.output : token.value;
2761
+ consume(token.value);
2762
+ };
2763
+
2764
+ const negate = () => {
2765
+ let count = 1;
2766
+
2767
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
2768
+ advance();
2769
+ state.start++;
2770
+ count++;
2771
+ }
2772
+
2773
+ if (count % 2 === 0) {
2774
+ return false;
2775
+ }
2776
+
2777
+ state.negated = true;
2778
+ state.start++;
2779
+ return true;
2780
+ };
2781
+
2782
+ const increment = type => {
2783
+ state[type]++;
2784
+ stack.push(type);
2785
+ };
2786
+
2787
+ const decrement = type => {
2788
+ state[type]--;
2789
+ stack.pop();
2790
+ };
2791
+
2792
+ /**
2793
+ * Push tokens onto the tokens array. This helper speeds up
2794
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
2795
+ * and 2) helping us avoid creating extra tokens when consecutive
2796
+ * characters are plain text. This improves performance and simplifies
2797
+ * lookbehinds.
2798
+ */
2799
+
2800
+ const push = tok => {
2801
+ if (prev.type === 'globstar') {
2802
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
2803
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
2804
+
2805
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
2806
+ state.output = state.output.slice(0, -prev.output.length);
2807
+ prev.type = 'star';
2808
+ prev.value = '*';
2809
+ prev.output = star;
2810
+ state.output += prev.output;
2811
+ }
2812
+ }
2813
+
2814
+ if (extglobs.length && tok.type !== 'paren') {
2815
+ extglobs[extglobs.length - 1].inner += tok.value;
2816
+ }
2817
+
2818
+ if (tok.value || tok.output) append(tok);
2819
+ if (prev && prev.type === 'text' && tok.type === 'text') {
2820
+ prev.value += tok.value;
2821
+ prev.output = (prev.output || '') + tok.value;
2822
+ return;
2823
+ }
2824
+
2825
+ tok.prev = prev;
2826
+ tokens.push(tok);
2827
+ prev = tok;
2828
+ };
2829
+
2830
+ const extglobOpen = (type, value) => {
2831
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
2832
+
2833
+ token.prev = prev;
2834
+ token.parens = state.parens;
2835
+ token.output = state.output;
2836
+ const output = (opts.capture ? '(' : '') + token.open;
2837
+
2838
+ increment('parens');
2839
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
2840
+ push({ type: 'paren', extglob: true, value: advance(), output });
2841
+ extglobs.push(token);
2842
+ };
2843
+
2844
+ const extglobClose = token => {
2845
+ let output = token.close + (opts.capture ? ')' : '');
2846
+ let rest;
2847
+
2848
+ if (token.type === 'negate') {
2849
+ let extglobStar = star;
2850
+
2851
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
2852
+ extglobStar = globstar(opts);
2853
+ }
2854
+
2855
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
2856
+ output = token.close = `)$))${extglobStar}`;
2857
+ }
2858
+
2859
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2860
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
2861
+ // In this case, we need to parse the string and use it in the output of the original pattern.
2862
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
2863
+ //
2864
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
2865
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
2866
+
2867
+ output = token.close = `)${expression})${extglobStar})`;
2868
+ }
2869
+
2870
+ if (token.prev.type === 'bos') {
2871
+ state.negatedExtglob = true;
2872
+ }
2873
+ }
2874
+
2875
+ push({ type: 'paren', extglob: true, value, output });
2876
+ decrement('parens');
2877
+ };
2878
+
2879
+ /**
2880
+ * Fast paths
2881
+ */
2882
+
2883
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
2884
+ let backslashes = false;
2885
+
2886
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
2887
+ if (first === '\\') {
2888
+ backslashes = true;
2889
+ return m;
2890
+ }
2891
+
2892
+ if (first === '?') {
2893
+ if (esc) {
2894
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
2895
+ }
2896
+ if (index === 0) {
2897
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
2898
+ }
2899
+ return QMARK.repeat(chars.length);
2900
+ }
2901
+
2902
+ if (first === '.') {
2903
+ return DOT_LITERAL.repeat(chars.length);
2904
+ }
2905
+
2906
+ if (first === '*') {
2907
+ if (esc) {
2908
+ return esc + first + (rest ? star : '');
2909
+ }
2910
+ return star;
2911
+ }
2912
+ return esc ? m : `\\${m}`;
2913
+ });
2914
+
2915
+ if (backslashes === true) {
2916
+ if (opts.unescape === true) {
2917
+ output = output.replace(/\\/g, '');
2918
+ } else {
2919
+ output = output.replace(/\\+/g, m => {
2920
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
2921
+ });
2922
+ }
2923
+ }
2924
+
2925
+ if (output === input && opts.contains === true) {
2926
+ state.output = input;
2927
+ return state;
2928
+ }
2929
+
2930
+ state.output = utils.wrapOutput(output, state, options);
2931
+ return state;
2932
+ }
2933
+
2934
+ /**
2935
+ * Tokenize input until we reach end-of-string
2936
+ */
2937
+
2938
+ while (!eos()) {
2939
+ value = advance();
2940
+
2941
+ if (value === '\u0000') {
2942
+ continue;
2943
+ }
2944
+
2945
+ /**
2946
+ * Escaped characters
2947
+ */
2948
+
2949
+ if (value === '\\') {
2950
+ const next = peek();
2951
+
2952
+ if (next === '/' && opts.bash !== true) {
2953
+ continue;
2954
+ }
2955
+
2956
+ if (next === '.' || next === ';') {
2957
+ continue;
2958
+ }
2959
+
2960
+ if (!next) {
2961
+ value += '\\';
2962
+ push({ type: 'text', value });
2963
+ continue;
2964
+ }
2965
+
2966
+ // collapse slashes to reduce potential for exploits
2967
+ const match = /^\\+/.exec(remaining());
2968
+ let slashes = 0;
2969
+
2970
+ if (match && match[0].length > 2) {
2971
+ slashes = match[0].length;
2972
+ state.index += slashes;
2973
+ if (slashes % 2 !== 0) {
2974
+ value += '\\';
2975
+ }
2976
+ }
2977
+
2978
+ if (opts.unescape === true) {
2979
+ value = advance();
2980
+ } else {
2981
+ value += advance();
2982
+ }
2983
+
2984
+ if (state.brackets === 0) {
2985
+ push({ type: 'text', value });
2986
+ continue;
2987
+ }
2988
+ }
2989
+
2990
+ /**
2991
+ * If we're inside a regex character class, continue
2992
+ * until we reach the closing bracket.
2993
+ */
2994
+
2995
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
2996
+ if (opts.posix !== false && value === ':') {
2997
+ const inner = prev.value.slice(1);
2998
+ if (inner.includes('[')) {
2999
+ prev.posix = true;
3000
+
3001
+ if (inner.includes(':')) {
3002
+ const idx = prev.value.lastIndexOf('[');
3003
+ const pre = prev.value.slice(0, idx);
3004
+ const rest = prev.value.slice(idx + 2);
3005
+ const posix = POSIX_REGEX_SOURCE[rest];
3006
+ if (posix) {
3007
+ prev.value = pre + posix;
3008
+ state.backtrack = true;
3009
+ advance();
3010
+
3011
+ if (!bos.output && tokens.indexOf(prev) === 1) {
3012
+ bos.output = ONE_CHAR;
3013
+ }
3014
+ continue;
3015
+ }
3016
+ }
3017
+ }
3018
+ }
3019
+
3020
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
3021
+ value = `\\${value}`;
3022
+ }
3023
+
3024
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
3025
+ value = `\\${value}`;
3026
+ }
3027
+
3028
+ if (opts.posix === true && value === '!' && prev.value === '[') {
3029
+ value = '^';
3030
+ }
3031
+
3032
+ prev.value += value;
3033
+ append({ value });
3034
+ continue;
3035
+ }
3036
+
3037
+ /**
3038
+ * If we're inside a quoted string, continue
3039
+ * until we reach the closing double quote.
3040
+ */
3041
+
3042
+ if (state.quotes === 1 && value !== '"') {
3043
+ value = utils.escapeRegex(value);
3044
+ prev.value += value;
3045
+ append({ value });
3046
+ continue;
3047
+ }
3048
+
3049
+ /**
3050
+ * Double quotes
3051
+ */
3052
+
3053
+ if (value === '"') {
3054
+ state.quotes = state.quotes === 1 ? 0 : 1;
3055
+ if (opts.keepQuotes === true) {
3056
+ push({ type: 'text', value });
3057
+ }
3058
+ continue;
3059
+ }
3060
+
3061
+ /**
3062
+ * Parentheses
3063
+ */
3064
+
3065
+ if (value === '(') {
3066
+ increment('parens');
3067
+ push({ type: 'paren', value });
3068
+ continue;
3069
+ }
3070
+
3071
+ if (value === ')') {
3072
+ if (state.parens === 0 && opts.strictBrackets === true) {
3073
+ throw new SyntaxError(syntaxError('opening', '('));
3074
+ }
3075
+
3076
+ const extglob = extglobs[extglobs.length - 1];
3077
+ if (extglob && state.parens === extglob.parens + 1) {
3078
+ extglobClose(extglobs.pop());
3079
+ continue;
3080
+ }
3081
+
3082
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
3083
+ decrement('parens');
3084
+ continue;
3085
+ }
3086
+
3087
+ /**
3088
+ * Square brackets
3089
+ */
3090
+
3091
+ if (value === '[') {
3092
+ if (opts.nobracket === true || !remaining().includes(']')) {
3093
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
3094
+ throw new SyntaxError(syntaxError('closing', ']'));
3095
+ }
3096
+
3097
+ value = `\\${value}`;
3098
+ } else {
3099
+ increment('brackets');
3100
+ }
3101
+
3102
+ push({ type: 'bracket', value });
3103
+ continue;
3104
+ }
3105
+
3106
+ if (value === ']') {
3107
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
3108
+ push({ type: 'text', value, output: `\\${value}` });
3109
+ continue;
3110
+ }
3111
+
3112
+ if (state.brackets === 0) {
3113
+ if (opts.strictBrackets === true) {
3114
+ throw new SyntaxError(syntaxError('opening', '['));
3115
+ }
3116
+
3117
+ push({ type: 'text', value, output: `\\${value}` });
3118
+ continue;
3119
+ }
3120
+
3121
+ decrement('brackets');
3122
+
3123
+ const prevValue = prev.value.slice(1);
3124
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
3125
+ value = `/${value}`;
3126
+ }
3127
+
3128
+ prev.value += value;
3129
+ append({ value });
3130
+
3131
+ // when literal brackets are explicitly disabled
3132
+ // assume we should match with a regex character class
3133
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
3134
+ continue;
3135
+ }
3136
+
3137
+ const escaped = utils.escapeRegex(prev.value);
3138
+ state.output = state.output.slice(0, -prev.value.length);
3139
+
3140
+ // when literal brackets are explicitly enabled
3141
+ // assume we should escape the brackets to match literal characters
3142
+ if (opts.literalBrackets === true) {
3143
+ state.output += escaped;
3144
+ prev.value = escaped;
3145
+ continue;
3146
+ }
3147
+
3148
+ // when the user specifies nothing, try to match both
3149
+ prev.value = `(${capture}${escaped}|${prev.value})`;
3150
+ state.output += prev.value;
3151
+ continue;
3152
+ }
3153
+
3154
+ /**
3155
+ * Braces
3156
+ */
3157
+
3158
+ if (value === '{' && opts.nobrace !== true) {
3159
+ increment('braces');
3160
+
3161
+ const open = {
3162
+ type: 'brace',
3163
+ value,
3164
+ output: '(',
3165
+ outputIndex: state.output.length,
3166
+ tokensIndex: state.tokens.length
3167
+ };
3168
+
3169
+ braces.push(open);
3170
+ push(open);
3171
+ continue;
3172
+ }
3173
+
3174
+ if (value === '}') {
3175
+ const brace = braces[braces.length - 1];
3176
+
3177
+ if (opts.nobrace === true || !brace) {
3178
+ push({ type: 'text', value, output: value });
3179
+ continue;
3180
+ }
3181
+
3182
+ let output = ')';
3183
+
3184
+ if (brace.dots === true) {
3185
+ const arr = tokens.slice();
3186
+ const range = [];
3187
+
3188
+ for (let i = arr.length - 1; i >= 0; i--) {
3189
+ tokens.pop();
3190
+ if (arr[i].type === 'brace') {
3191
+ break;
3192
+ }
3193
+ if (arr[i].type !== 'dots') {
3194
+ range.unshift(arr[i].value);
3195
+ }
3196
+ }
3197
+
3198
+ output = expandRange(range, opts);
3199
+ state.backtrack = true;
3200
+ }
3201
+
3202
+ if (brace.comma !== true && brace.dots !== true) {
3203
+ const out = state.output.slice(0, brace.outputIndex);
3204
+ const toks = state.tokens.slice(brace.tokensIndex);
3205
+ brace.value = brace.output = '\\{';
3206
+ value = output = '\\}';
3207
+ state.output = out;
3208
+ for (const t of toks) {
3209
+ state.output += (t.output || t.value);
3210
+ }
3211
+ }
3212
+
3213
+ push({ type: 'brace', value, output });
3214
+ decrement('braces');
3215
+ braces.pop();
3216
+ continue;
3217
+ }
3218
+
3219
+ /**
3220
+ * Pipes
3221
+ */
3222
+
3223
+ if (value === '|') {
3224
+ if (extglobs.length > 0) {
3225
+ extglobs[extglobs.length - 1].conditions++;
3226
+ }
3227
+ push({ type: 'text', value });
3228
+ continue;
3229
+ }
3230
+
3231
+ /**
3232
+ * Commas
3233
+ */
3234
+
3235
+ if (value === ',') {
3236
+ let output = value;
3237
+
3238
+ const brace = braces[braces.length - 1];
3239
+ if (brace && stack[stack.length - 1] === 'braces') {
3240
+ brace.comma = true;
3241
+ output = '|';
3242
+ }
3243
+
3244
+ push({ type: 'comma', value, output });
3245
+ continue;
3246
+ }
3247
+
3248
+ /**
3249
+ * Slashes
3250
+ */
3251
+
3252
+ if (value === '/') {
3253
+ // if the beginning of the glob is "./", advance the start
3254
+ // to the current index, and don't add the "./" characters
3255
+ // to the state. This greatly simplifies lookbehinds when
3256
+ // checking for BOS characters like "!" and "." (not "./")
3257
+ if (prev.type === 'dot' && state.index === state.start + 1) {
3258
+ state.start = state.index + 1;
3259
+ state.consumed = '';
3260
+ state.output = '';
3261
+ tokens.pop();
3262
+ prev = bos; // reset "prev" to the first token
3263
+ continue;
3264
+ }
3265
+
3266
+ push({ type: 'slash', value, output: SLASH_LITERAL });
3267
+ continue;
3268
+ }
3269
+
3270
+ /**
3271
+ * Dots
3272
+ */
3273
+
3274
+ if (value === '.') {
3275
+ if (state.braces > 0 && prev.type === 'dot') {
3276
+ if (prev.value === '.') prev.output = DOT_LITERAL;
3277
+ const brace = braces[braces.length - 1];
3278
+ prev.type = 'dots';
3279
+ prev.output += value;
3280
+ prev.value += value;
3281
+ brace.dots = true;
3282
+ continue;
3283
+ }
3284
+
3285
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
3286
+ push({ type: 'text', value, output: DOT_LITERAL });
3287
+ continue;
3288
+ }
3289
+
3290
+ push({ type: 'dot', value, output: DOT_LITERAL });
3291
+ continue;
3292
+ }
3293
+
3294
+ /**
3295
+ * Question marks
3296
+ */
3297
+
3298
+ if (value === '?') {
3299
+ const isGroup = prev && prev.value === '(';
3300
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
3301
+ extglobOpen('qmark', value);
3302
+ continue;
3303
+ }
3304
+
3305
+ if (prev && prev.type === 'paren') {
3306
+ const next = peek();
3307
+ let output = value;
3308
+
3309
+ if (next === '<' && !utils.supportsLookbehinds()) {
3310
+ throw new Error('Node.js v10 or higher is required for regex lookbehinds');
3311
+ }
3312
+
3313
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
3314
+ output = `\\${value}`;
3315
+ }
3316
+
3317
+ push({ type: 'text', value, output });
3318
+ continue;
3319
+ }
3320
+
3321
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
3322
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
3323
+ continue;
3324
+ }
3325
+
3326
+ push({ type: 'qmark', value, output: QMARK });
3327
+ continue;
3328
+ }
3329
+
3330
+ /**
3331
+ * Exclamation
3332
+ */
3333
+
3334
+ if (value === '!') {
3335
+ if (opts.noextglob !== true && peek() === '(') {
3336
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
3337
+ extglobOpen('negate', value);
3338
+ continue;
3339
+ }
3340
+ }
3341
+
3342
+ if (opts.nonegate !== true && state.index === 0) {
3343
+ negate();
3344
+ continue;
3345
+ }
3346
+ }
3347
+
3348
+ /**
3349
+ * Plus
3350
+ */
3351
+
3352
+ if (value === '+') {
3353
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
3354
+ extglobOpen('plus', value);
3355
+ continue;
3356
+ }
3357
+
3358
+ if ((prev && prev.value === '(') || opts.regex === false) {
3359
+ push({ type: 'plus', value, output: PLUS_LITERAL });
3360
+ continue;
3361
+ }
3362
+
3363
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
3364
+ push({ type: 'plus', value });
3365
+ continue;
3366
+ }
3367
+
3368
+ push({ type: 'plus', value: PLUS_LITERAL });
3369
+ continue;
3370
+ }
3371
+
3372
+ /**
3373
+ * Plain text
3374
+ */
3375
+
3376
+ if (value === '@') {
3377
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
3378
+ push({ type: 'at', extglob: true, value, output: '' });
3379
+ continue;
3380
+ }
3381
+
3382
+ push({ type: 'text', value });
3383
+ continue;
3384
+ }
3385
+
3386
+ /**
3387
+ * Plain text
3388
+ */
3389
+
3390
+ if (value !== '*') {
3391
+ if (value === '$' || value === '^') {
3392
+ value = `\\${value}`;
3393
+ }
3394
+
3395
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
3396
+ if (match) {
3397
+ value += match[0];
3398
+ state.index += match[0].length;
3399
+ }
3400
+
3401
+ push({ type: 'text', value });
3402
+ continue;
3403
+ }
3404
+
3405
+ /**
3406
+ * Stars
3407
+ */
3408
+
3409
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
3410
+ prev.type = 'star';
3411
+ prev.star = true;
3412
+ prev.value += value;
3413
+ prev.output = star;
3414
+ state.backtrack = true;
3415
+ state.globstar = true;
3416
+ consume(value);
3417
+ continue;
3418
+ }
3419
+
3420
+ let rest = remaining();
3421
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
3422
+ extglobOpen('star', value);
3423
+ continue;
3424
+ }
3425
+
3426
+ if (prev.type === 'star') {
3427
+ if (opts.noglobstar === true) {
3428
+ consume(value);
3429
+ continue;
3430
+ }
3431
+
3432
+ const prior = prev.prev;
3433
+ const before = prior.prev;
3434
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
3435
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
3436
+
3437
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
3438
+ push({ type: 'star', value, output: '' });
3439
+ continue;
3440
+ }
3441
+
3442
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
3443
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
3444
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
3445
+ push({ type: 'star', value, output: '' });
3446
+ continue;
3447
+ }
3448
+
3449
+ // strip consecutive `/**/`
3450
+ while (rest.slice(0, 3) === '/**') {
3451
+ const after = input[state.index + 4];
3452
+ if (after && after !== '/') {
3453
+ break;
3454
+ }
3455
+ rest = rest.slice(3);
3456
+ consume('/**', 3);
3457
+ }
3458
+
3459
+ if (prior.type === 'bos' && eos()) {
3460
+ prev.type = 'globstar';
3461
+ prev.value += value;
3462
+ prev.output = globstar(opts);
3463
+ state.output = prev.output;
3464
+ state.globstar = true;
3465
+ consume(value);
3466
+ continue;
3467
+ }
3468
+
3469
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
3470
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
3471
+ prior.output = `(?:${prior.output}`;
3472
+
3473
+ prev.type = 'globstar';
3474
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
3475
+ prev.value += value;
3476
+ state.globstar = true;
3477
+ state.output += prior.output + prev.output;
3478
+ consume(value);
3479
+ continue;
3480
+ }
3481
+
3482
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
3483
+ const end = rest[1] !== void 0 ? '|$' : '';
3484
+
3485
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
3486
+ prior.output = `(?:${prior.output}`;
3487
+
3488
+ prev.type = 'globstar';
3489
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
3490
+ prev.value += value;
3491
+
3492
+ state.output += prior.output + prev.output;
3493
+ state.globstar = true;
3494
+
3495
+ consume(value + advance());
3496
+
3497
+ push({ type: 'slash', value: '/', output: '' });
3498
+ continue;
3499
+ }
3500
+
3501
+ if (prior.type === 'bos' && rest[0] === '/') {
3502
+ prev.type = 'globstar';
3503
+ prev.value += value;
3504
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
3505
+ state.output = prev.output;
3506
+ state.globstar = true;
3507
+ consume(value + advance());
3508
+ push({ type: 'slash', value: '/', output: '' });
3509
+ continue;
3510
+ }
3511
+
3512
+ // remove single star from output
3513
+ state.output = state.output.slice(0, -prev.output.length);
3514
+
3515
+ // reset previous token to globstar
3516
+ prev.type = 'globstar';
3517
+ prev.output = globstar(opts);
3518
+ prev.value += value;
3519
+
3520
+ // reset output with globstar
3521
+ state.output += prev.output;
3522
+ state.globstar = true;
3523
+ consume(value);
3524
+ continue;
3525
+ }
3526
+
3527
+ const token = { type: 'star', value, output: star };
3528
+
3529
+ if (opts.bash === true) {
3530
+ token.output = '.*?';
3531
+ if (prev.type === 'bos' || prev.type === 'slash') {
3532
+ token.output = nodot + token.output;
3533
+ }
3534
+ push(token);
3535
+ continue;
3536
+ }
3537
+
3538
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
3539
+ token.output = value;
3540
+ push(token);
3541
+ continue;
3542
+ }
3543
+
3544
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
3545
+ if (prev.type === 'dot') {
3546
+ state.output += NO_DOT_SLASH;
3547
+ prev.output += NO_DOT_SLASH;
3548
+
3549
+ } else if (opts.dot === true) {
3550
+ state.output += NO_DOTS_SLASH;
3551
+ prev.output += NO_DOTS_SLASH;
3552
+
3553
+ } else {
3554
+ state.output += nodot;
3555
+ prev.output += nodot;
3556
+ }
3557
+
3558
+ if (peek() !== '*') {
3559
+ state.output += ONE_CHAR;
3560
+ prev.output += ONE_CHAR;
3561
+ }
3562
+ }
3563
+
3564
+ push(token);
3565
+ }
3566
+
3567
+ while (state.brackets > 0) {
3568
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
3569
+ state.output = utils.escapeLast(state.output, '[');
3570
+ decrement('brackets');
3571
+ }
3572
+
3573
+ while (state.parens > 0) {
3574
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
3575
+ state.output = utils.escapeLast(state.output, '(');
3576
+ decrement('parens');
3577
+ }
3578
+
3579
+ while (state.braces > 0) {
3580
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
3581
+ state.output = utils.escapeLast(state.output, '{');
3582
+ decrement('braces');
3583
+ }
3584
+
3585
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
3586
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
3587
+ }
3588
+
3589
+ // rebuild the output if we had to backtrack at any point
3590
+ if (state.backtrack === true) {
3591
+ state.output = '';
3592
+
3593
+ for (const token of state.tokens) {
3594
+ state.output += token.output != null ? token.output : token.value;
3595
+
3596
+ if (token.suffix) {
3597
+ state.output += token.suffix;
3598
+ }
3599
+ }
3600
+ }
3601
+
3602
+ return state;
3603
+ };
3604
+
3605
+ /**
3606
+ * Fast paths for creating regular expressions for common glob patterns.
3607
+ * This can significantly speed up processing and has very little downside
3608
+ * impact when none of the fast paths match.
3609
+ */
3610
+
3611
+ parse.fastpaths = (input, options) => {
3612
+ const opts = { ...options };
3613
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
3614
+ const len = input.length;
3615
+ if (len > max) {
3616
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
3617
+ }
3618
+
3619
+ input = REPLACEMENTS[input] || input;
3620
+ const win32 = utils.isWindows(options);
3621
+
3622
+ // create constants based on platform, for windows or posix
3623
+ const {
3624
+ DOT_LITERAL,
3625
+ SLASH_LITERAL,
3626
+ ONE_CHAR,
3627
+ DOTS_SLASH,
3628
+ NO_DOT,
3629
+ NO_DOTS,
3630
+ NO_DOTS_SLASH,
3631
+ STAR,
3632
+ START_ANCHOR
3633
+ } = constants.globChars(win32);
3634
+
3635
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
3636
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
3637
+ const capture = opts.capture ? '' : '?:';
3638
+ const state = { negated: false, prefix: '' };
3639
+ let star = opts.bash === true ? '.*?' : STAR;
3640
+
3641
+ if (opts.capture) {
3642
+ star = `(${star})`;
3643
+ }
3644
+
3645
+ const globstar = opts => {
3646
+ if (opts.noglobstar === true) return star;
3647
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
3648
+ };
3649
+
3650
+ const create = str => {
3651
+ switch (str) {
3652
+ case '*':
3653
+ return `${nodot}${ONE_CHAR}${star}`;
3654
+
3655
+ case '.*':
3656
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
3657
+
3658
+ case '*.*':
3659
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
3660
+
3661
+ case '*/*':
3662
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
3663
+
3664
+ case '**':
3665
+ return nodot + globstar(opts);
3666
+
3667
+ case '**/*':
3668
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
3669
+
3670
+ case '**/*.*':
3671
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
3672
+
3673
+ case '**/.*':
3674
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
3675
+
3676
+ default: {
3677
+ const match = /^(.*?)\.(\w+)$/.exec(str);
3678
+ if (!match) return;
3679
+
3680
+ const source = create(match[1]);
3681
+ if (!source) return;
3682
+
3683
+ return source + DOT_LITERAL + match[2];
3684
+ }
3685
+ }
3686
+ };
3687
+
3688
+ const output = utils.removePrefix(input, state);
3689
+ let source = create(output);
3690
+
3691
+ if (source && opts.strictSlashes !== true) {
3692
+ source += `${SLASH_LITERAL}?`;
3693
+ }
3694
+
3695
+ return source;
3696
+ };
3697
+
3698
+ parse_1 = parse;
3699
+ return parse_1;
3700
+ }
3701
+
3702
+ var picomatch_1;
3703
+ var hasRequiredPicomatch$1;
3704
+
3705
+ function requirePicomatch$1 () {
3706
+ if (hasRequiredPicomatch$1) return picomatch_1;
3707
+ hasRequiredPicomatch$1 = 1;
3708
+
3709
+ const path = require$$0$1;
3710
+ const scan = requireScan();
3711
+ const parse = requireParse();
3712
+ const utils = requireUtils();
3713
+ const constants = requireConstants();
3714
+ const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
3715
+
3716
+ /**
3717
+ * Creates a matcher function from one or more glob patterns. The
3718
+ * returned function takes a string to match as its first argument,
3719
+ * and returns true if the string is a match. The returned matcher
3720
+ * function also takes a boolean as the second argument that, when true,
3721
+ * returns an object with additional information.
3722
+ *
3723
+ * ```js
3724
+ * const picomatch = require('picomatch');
3725
+ * // picomatch(glob[, options]);
3726
+ *
3727
+ * const isMatch = picomatch('*.!(*a)');
3728
+ * console.log(isMatch('a.a')); //=> false
3729
+ * console.log(isMatch('a.b')); //=> true
3730
+ * ```
3731
+ * @name picomatch
3732
+ * @param {String|Array} `globs` One or more glob patterns.
3733
+ * @param {Object=} `options`
3734
+ * @return {Function=} Returns a matcher function.
3735
+ * @api public
3736
+ */
3737
+
3738
+ const picomatch = (glob, options, returnState = false) => {
3739
+ if (Array.isArray(glob)) {
3740
+ const fns = glob.map(input => picomatch(input, options, returnState));
3741
+ const arrayMatcher = str => {
3742
+ for (const isMatch of fns) {
3743
+ const state = isMatch(str);
3744
+ if (state) return state;
3745
+ }
3746
+ return false;
3747
+ };
3748
+ return arrayMatcher;
3749
+ }
3750
+
3751
+ const isState = isObject(glob) && glob.tokens && glob.input;
3752
+
3753
+ if (glob === '' || (typeof glob !== 'string' && !isState)) {
3754
+ throw new TypeError('Expected pattern to be a non-empty string');
3755
+ }
3756
+
3757
+ const opts = options || {};
3758
+ const posix = utils.isWindows(options);
3759
+ const regex = isState
3760
+ ? picomatch.compileRe(glob, options)
3761
+ : picomatch.makeRe(glob, options, false, true);
3762
+
3763
+ const state = regex.state;
3764
+ delete regex.state;
3765
+
3766
+ let isIgnored = () => false;
3767
+ if (opts.ignore) {
3768
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
3769
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
3770
+ }
3771
+
3772
+ const matcher = (input, returnObject = false) => {
3773
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
3774
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
3775
+
3776
+ if (typeof opts.onResult === 'function') {
3777
+ opts.onResult(result);
3778
+ }
3779
+
3780
+ if (isMatch === false) {
3781
+ result.isMatch = false;
3782
+ return returnObject ? result : false;
3783
+ }
3784
+
3785
+ if (isIgnored(input)) {
3786
+ if (typeof opts.onIgnore === 'function') {
3787
+ opts.onIgnore(result);
3788
+ }
3789
+ result.isMatch = false;
3790
+ return returnObject ? result : false;
3791
+ }
3792
+
3793
+ if (typeof opts.onMatch === 'function') {
3794
+ opts.onMatch(result);
3795
+ }
3796
+ return returnObject ? result : true;
3797
+ };
3798
+
3799
+ if (returnState) {
3800
+ matcher.state = state;
3801
+ }
3802
+
3803
+ return matcher;
3804
+ };
3805
+
3806
+ /**
3807
+ * Test `input` with the given `regex`. This is used by the main
3808
+ * `picomatch()` function to test the input string.
3809
+ *
3810
+ * ```js
3811
+ * const picomatch = require('picomatch');
3812
+ * // picomatch.test(input, regex[, options]);
3813
+ *
3814
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
3815
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
3816
+ * ```
3817
+ * @param {String} `input` String to test.
3818
+ * @param {RegExp} `regex`
3819
+ * @return {Object} Returns an object with matching info.
3820
+ * @api public
3821
+ */
3822
+
3823
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
3824
+ if (typeof input !== 'string') {
3825
+ throw new TypeError('Expected input to be a string');
3826
+ }
3827
+
3828
+ if (input === '') {
3829
+ return { isMatch: false, output: '' };
3830
+ }
3831
+
3832
+ const opts = options || {};
3833
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
3834
+ let match = input === glob;
3835
+ let output = (match && format) ? format(input) : input;
3836
+
3837
+ if (match === false) {
3838
+ output = format ? format(input) : input;
3839
+ match = output === glob;
3840
+ }
3841
+
3842
+ if (match === false || opts.capture === true) {
3843
+ if (opts.matchBase === true || opts.basename === true) {
3844
+ match = picomatch.matchBase(input, regex, options, posix);
3845
+ } else {
3846
+ match = regex.exec(output);
3847
+ }
3848
+ }
3849
+
3850
+ return { isMatch: Boolean(match), match, output };
3851
+ };
3852
+
3853
+ /**
3854
+ * Match the basename of a filepath.
3855
+ *
3856
+ * ```js
3857
+ * const picomatch = require('picomatch');
3858
+ * // picomatch.matchBase(input, glob[, options]);
3859
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
3860
+ * ```
3861
+ * @param {String} `input` String to test.
3862
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
3863
+ * @return {Boolean}
3864
+ * @api public
3865
+ */
3866
+
3867
+ picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3868
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
3869
+ return regex.test(path.basename(input));
3870
+ };
3871
+
3872
+ /**
3873
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
3874
+ *
3875
+ * ```js
3876
+ * const picomatch = require('picomatch');
3877
+ * // picomatch.isMatch(string, patterns[, options]);
3878
+ *
3879
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
3880
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
3881
+ * ```
3882
+ * @param {String|Array} str The string to test.
3883
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
3884
+ * @param {Object} [options] See available [options](#options).
3885
+ * @return {Boolean} Returns true if any patterns match `str`
3886
+ * @api public
3887
+ */
3888
+
3889
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3890
+
3891
+ /**
3892
+ * Parse a glob pattern to create the source string for a regular
3893
+ * expression.
3894
+ *
3895
+ * ```js
3896
+ * const picomatch = require('picomatch');
3897
+ * const result = picomatch.parse(pattern[, options]);
3898
+ * ```
3899
+ * @param {String} `pattern`
3900
+ * @param {Object} `options`
3901
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
3902
+ * @api public
3903
+ */
3904
+
3905
+ picomatch.parse = (pattern, options) => {
3906
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
3907
+ return parse(pattern, { ...options, fastpaths: false });
3908
+ };
3909
+
3910
+ /**
3911
+ * Scan a glob pattern to separate the pattern into segments.
3912
+ *
3913
+ * ```js
3914
+ * const picomatch = require('picomatch');
3915
+ * // picomatch.scan(input[, options]);
3916
+ *
3917
+ * const result = picomatch.scan('!./foo/*.js');
3918
+ * console.log(result);
3919
+ * { prefix: '!./',
3920
+ * input: '!./foo/*.js',
3921
+ * start: 3,
3922
+ * base: 'foo',
3923
+ * glob: '*.js',
3924
+ * isBrace: false,
3925
+ * isBracket: false,
3926
+ * isGlob: true,
3927
+ * isExtglob: false,
3928
+ * isGlobstar: false,
3929
+ * negated: true }
3930
+ * ```
3931
+ * @param {String} `input` Glob pattern to scan.
3932
+ * @param {Object} `options`
3933
+ * @return {Object} Returns an object with
3934
+ * @api public
3935
+ */
3936
+
3937
+ picomatch.scan = (input, options) => scan(input, options);
3938
+
3939
+ /**
3940
+ * Compile a regular expression from the `state` object returned by the
3941
+ * [parse()](#parse) method.
3942
+ *
3943
+ * @param {Object} `state`
3944
+ * @param {Object} `options`
3945
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
3946
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
3947
+ * @return {RegExp}
3948
+ * @api public
3949
+ */
3950
+
3951
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
3952
+ if (returnOutput === true) {
3953
+ return state.output;
3954
+ }
3955
+
3956
+ const opts = options || {};
3957
+ const prepend = opts.contains ? '' : '^';
3958
+ const append = opts.contains ? '' : '$';
3959
+
3960
+ let source = `${prepend}(?:${state.output})${append}`;
3961
+ if (state && state.negated === true) {
3962
+ source = `^(?!${source}).*$`;
3963
+ }
3964
+
3965
+ const regex = picomatch.toRegex(source, options);
3966
+ if (returnState === true) {
3967
+ regex.state = state;
3968
+ }
3969
+
3970
+ return regex;
3971
+ };
3972
+
3973
+ /**
3974
+ * Create a regular expression from a parsed glob pattern.
3975
+ *
3976
+ * ```js
3977
+ * const picomatch = require('picomatch');
3978
+ * const state = picomatch.parse('*.js');
3979
+ * // picomatch.compileRe(state[, options]);
3980
+ *
3981
+ * console.log(picomatch.compileRe(state));
3982
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3983
+ * ```
3984
+ * @param {String} `state` The object returned from the `.parse` method.
3985
+ * @param {Object} `options`
3986
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
3987
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
3988
+ * @return {RegExp} Returns a regex created from the given pattern.
3989
+ * @api public
3990
+ */
3991
+
3992
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
3993
+ if (!input || typeof input !== 'string') {
3994
+ throw new TypeError('Expected a non-empty string');
3995
+ }
3996
+
3997
+ let parsed = { negated: false, fastpaths: true };
3998
+
3999
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
4000
+ parsed.output = parse.fastpaths(input, options);
4001
+ }
4002
+
4003
+ if (!parsed.output) {
4004
+ parsed = parse(input, options);
4005
+ }
4006
+
4007
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
4008
+ };
4009
+
4010
+ /**
4011
+ * Create a regular expression from the given regex source string.
4012
+ *
4013
+ * ```js
4014
+ * const picomatch = require('picomatch');
4015
+ * // picomatch.toRegex(source[, options]);
4016
+ *
4017
+ * const { output } = picomatch.parse('*.js');
4018
+ * console.log(picomatch.toRegex(output));
4019
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
4020
+ * ```
4021
+ * @param {String} `source` Regular expression source string.
4022
+ * @param {Object} `options`
4023
+ * @return {RegExp}
4024
+ * @api public
4025
+ */
4026
+
4027
+ picomatch.toRegex = (source, options) => {
4028
+ try {
4029
+ const opts = options || {};
4030
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
4031
+ } catch (err) {
4032
+ if (options && options.debug === true) throw err;
4033
+ return /$^/;
4034
+ }
4035
+ };
4036
+
4037
+ /**
4038
+ * Picomatch constants.
4039
+ * @return {Object}
4040
+ */
4041
+
4042
+ picomatch.constants = constants;
4043
+
4044
+ /**
4045
+ * Expose "picomatch"
4046
+ */
4047
+
4048
+ picomatch_1 = picomatch;
4049
+ return picomatch_1;
4050
+ }
4051
+
4052
+ var picomatch;
4053
+ var hasRequiredPicomatch;
4054
+
4055
+ function requirePicomatch () {
4056
+ if (hasRequiredPicomatch) return picomatch;
4057
+ hasRequiredPicomatch = 1;
4058
+
4059
+ picomatch = requirePicomatch$1();
4060
+ return picomatch;
4061
+ }
4062
+
4063
+ var micromatch_1;
4064
+ var hasRequiredMicromatch;
4065
+
4066
+ function requireMicromatch () {
4067
+ if (hasRequiredMicromatch) return micromatch_1;
4068
+ hasRequiredMicromatch = 1;
4069
+
4070
+ const util = require$$0;
4071
+ const braces = requireBraces();
4072
+ const picomatch = requirePicomatch();
4073
+ const utils = requireUtils();
4074
+ const isEmptyString = val => val === '' || val === './';
4075
+
4076
+ /**
4077
+ * Returns an array of strings that match one or more glob patterns.
4078
+ *
4079
+ * ```js
4080
+ * const mm = require('micromatch');
4081
+ * // mm(list, patterns[, options]);
4082
+ *
4083
+ * console.log(mm(['a.js', 'a.txt'], ['*.js']));
4084
+ * //=> [ 'a.js' ]
4085
+ * ```
4086
+ * @param {String|Array<string>} `list` List of strings to match.
4087
+ * @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
4088
+ * @param {Object} `options` See available [options](#options)
4089
+ * @return {Array} Returns an array of matches
4090
+ * @summary false
4091
+ * @api public
4092
+ */
4093
+
4094
+ const micromatch = (list, patterns, options) => {
4095
+ patterns = [].concat(patterns);
4096
+ list = [].concat(list);
4097
+
4098
+ let omit = new Set();
4099
+ let keep = new Set();
4100
+ let items = new Set();
4101
+ let negatives = 0;
4102
+
4103
+ let onResult = state => {
4104
+ items.add(state.output);
4105
+ if (options && options.onResult) {
4106
+ options.onResult(state);
4107
+ }
4108
+ };
4109
+
4110
+ for (let i = 0; i < patterns.length; i++) {
4111
+ let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
4112
+ let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
4113
+ if (negated) negatives++;
4114
+
4115
+ for (let item of list) {
4116
+ let matched = isMatch(item, true);
4117
+
4118
+ let match = negated ? !matched.isMatch : matched.isMatch;
4119
+ if (!match) continue;
4120
+
4121
+ if (negated) {
4122
+ omit.add(matched.output);
4123
+ } else {
4124
+ omit.delete(matched.output);
4125
+ keep.add(matched.output);
4126
+ }
4127
+ }
4128
+ }
4129
+
4130
+ let result = negatives === patterns.length ? [...items] : [...keep];
4131
+ let matches = result.filter(item => !omit.has(item));
4132
+
4133
+ if (options && matches.length === 0) {
4134
+ if (options.failglob === true) {
4135
+ throw new Error(`No matches found for "${patterns.join(', ')}"`);
4136
+ }
4137
+
4138
+ if (options.nonull === true || options.nullglob === true) {
4139
+ return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
4140
+ }
4141
+ }
4142
+
4143
+ return matches;
4144
+ };
4145
+
4146
+ /**
4147
+ * Backwards compatibility
4148
+ */
4149
+
4150
+ micromatch.match = micromatch;
4151
+
4152
+ /**
4153
+ * Returns a matcher function from the given glob `pattern` and `options`.
4154
+ * The returned function takes a string to match as its only argument and returns
4155
+ * true if the string is a match.
4156
+ *
4157
+ * ```js
4158
+ * const mm = require('micromatch');
4159
+ * // mm.matcher(pattern[, options]);
4160
+ *
4161
+ * const isMatch = mm.matcher('*.!(*a)');
4162
+ * console.log(isMatch('a.a')); //=> false
4163
+ * console.log(isMatch('a.b')); //=> true
4164
+ * ```
4165
+ * @param {String} `pattern` Glob pattern
4166
+ * @param {Object} `options`
4167
+ * @return {Function} Returns a matcher function.
4168
+ * @api public
4169
+ */
4170
+
4171
+ micromatch.matcher = (pattern, options) => picomatch(pattern, options);
4172
+
4173
+ /**
4174
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
4175
+ *
4176
+ * ```js
4177
+ * const mm = require('micromatch');
4178
+ * // mm.isMatch(string, patterns[, options]);
4179
+ *
4180
+ * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
4181
+ * console.log(mm.isMatch('a.a', 'b.*')); //=> false
4182
+ * ```
4183
+ * @param {String} `str` The string to test.
4184
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
4185
+ * @param {Object} `[options]` See available [options](#options).
4186
+ * @return {Boolean} Returns true if any patterns match `str`
4187
+ * @api public
4188
+ */
4189
+
4190
+ micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
4191
+
4192
+ /**
4193
+ * Backwards compatibility
4194
+ */
4195
+
4196
+ micromatch.any = micromatch.isMatch;
4197
+
4198
+ /**
4199
+ * Returns a list of strings that _**do not match any**_ of the given `patterns`.
4200
+ *
4201
+ * ```js
4202
+ * const mm = require('micromatch');
4203
+ * // mm.not(list, patterns[, options]);
4204
+ *
4205
+ * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
4206
+ * //=> ['b.b', 'c.c']
4207
+ * ```
4208
+ * @param {Array} `list` Array of strings to match.
4209
+ * @param {String|Array} `patterns` One or more glob pattern to use for matching.
4210
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4211
+ * @return {Array} Returns an array of strings that **do not match** the given patterns.
4212
+ * @api public
4213
+ */
4214
+
4215
+ micromatch.not = (list, patterns, options = {}) => {
4216
+ patterns = [].concat(patterns).map(String);
4217
+ let result = new Set();
4218
+ let items = [];
4219
+
4220
+ let onResult = state => {
4221
+ if (options.onResult) options.onResult(state);
4222
+ items.push(state.output);
4223
+ };
4224
+
4225
+ let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
4226
+
4227
+ for (let item of items) {
4228
+ if (!matches.has(item)) {
4229
+ result.add(item);
4230
+ }
4231
+ }
4232
+ return [...result];
4233
+ };
4234
+
4235
+ /**
4236
+ * Returns true if the given `string` contains the given pattern. Similar
4237
+ * to [.isMatch](#isMatch) but the pattern can match any part of the string.
4238
+ *
4239
+ * ```js
4240
+ * var mm = require('micromatch');
4241
+ * // mm.contains(string, pattern[, options]);
4242
+ *
4243
+ * console.log(mm.contains('aa/bb/cc', '*b'));
4244
+ * //=> true
4245
+ * console.log(mm.contains('aa/bb/cc', '*d'));
4246
+ * //=> false
4247
+ * ```
4248
+ * @param {String} `str` The string to match.
4249
+ * @param {String|Array} `patterns` Glob pattern to use for matching.
4250
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4251
+ * @return {Boolean} Returns true if any of the patterns matches any part of `str`.
4252
+ * @api public
4253
+ */
4254
+
4255
+ micromatch.contains = (str, pattern, options) => {
4256
+ if (typeof str !== 'string') {
4257
+ throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
4258
+ }
4259
+
4260
+ if (Array.isArray(pattern)) {
4261
+ return pattern.some(p => micromatch.contains(str, p, options));
4262
+ }
4263
+
4264
+ if (typeof pattern === 'string') {
4265
+ if (isEmptyString(str) || isEmptyString(pattern)) {
4266
+ return false;
4267
+ }
4268
+
4269
+ if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) {
4270
+ return true;
4271
+ }
4272
+ }
4273
+
4274
+ return micromatch.isMatch(str, pattern, { ...options, contains: true });
4275
+ };
4276
+
4277
+ /**
4278
+ * Filter the keys of the given object with the given `glob` pattern
4279
+ * and `options`. Does not attempt to match nested keys. If you need this feature,
4280
+ * use [glob-object][] instead.
4281
+ *
4282
+ * ```js
4283
+ * const mm = require('micromatch');
4284
+ * // mm.matchKeys(object, patterns[, options]);
4285
+ *
4286
+ * const obj = { aa: 'a', ab: 'b', ac: 'c' };
4287
+ * console.log(mm.matchKeys(obj, '*b'));
4288
+ * //=> { ab: 'b' }
4289
+ * ```
4290
+ * @param {Object} `object` The object with keys to filter.
4291
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
4292
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4293
+ * @return {Object} Returns an object with only keys that match the given patterns.
4294
+ * @api public
4295
+ */
4296
+
4297
+ micromatch.matchKeys = (obj, patterns, options) => {
4298
+ if (!utils.isObject(obj)) {
4299
+ throw new TypeError('Expected the first argument to be an object');
4300
+ }
4301
+ let keys = micromatch(Object.keys(obj), patterns, options);
4302
+ let res = {};
4303
+ for (let key of keys) res[key] = obj[key];
4304
+ return res;
4305
+ };
4306
+
4307
+ /**
4308
+ * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
4309
+ *
4310
+ * ```js
4311
+ * const mm = require('micromatch');
4312
+ * // mm.some(list, patterns[, options]);
4313
+ *
4314
+ * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
4315
+ * // true
4316
+ * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
4317
+ * // false
4318
+ * ```
4319
+ * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
4320
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
4321
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4322
+ * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
4323
+ * @api public
4324
+ */
4325
+
4326
+ micromatch.some = (list, patterns, options) => {
4327
+ let items = [].concat(list);
4328
+
4329
+ for (let pattern of [].concat(patterns)) {
4330
+ let isMatch = picomatch(String(pattern), options);
4331
+ if (items.some(item => isMatch(item))) {
4332
+ return true;
4333
+ }
4334
+ }
4335
+ return false;
4336
+ };
4337
+
4338
+ /**
4339
+ * Returns true if every string in the given `list` matches
4340
+ * any of the given glob `patterns`.
4341
+ *
4342
+ * ```js
4343
+ * const mm = require('micromatch');
4344
+ * // mm.every(list, patterns[, options]);
4345
+ *
4346
+ * console.log(mm.every('foo.js', ['foo.js']));
4347
+ * // true
4348
+ * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
4349
+ * // true
4350
+ * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
4351
+ * // false
4352
+ * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
4353
+ * // false
4354
+ * ```
4355
+ * @param {String|Array} `list` The string or array of strings to test.
4356
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
4357
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4358
+ * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
4359
+ * @api public
4360
+ */
4361
+
4362
+ micromatch.every = (list, patterns, options) => {
4363
+ let items = [].concat(list);
4364
+
4365
+ for (let pattern of [].concat(patterns)) {
4366
+ let isMatch = picomatch(String(pattern), options);
4367
+ if (!items.every(item => isMatch(item))) {
4368
+ return false;
4369
+ }
4370
+ }
4371
+ return true;
4372
+ };
4373
+
4374
+ /**
4375
+ * Returns true if **all** of the given `patterns` match
4376
+ * the specified string.
4377
+ *
4378
+ * ```js
4379
+ * const mm = require('micromatch');
4380
+ * // mm.all(string, patterns[, options]);
4381
+ *
4382
+ * console.log(mm.all('foo.js', ['foo.js']));
4383
+ * // true
4384
+ *
4385
+ * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
4386
+ * // false
4387
+ *
4388
+ * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
4389
+ * // true
4390
+ *
4391
+ * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
4392
+ * // true
4393
+ * ```
4394
+ * @param {String|Array} `str` The string to test.
4395
+ * @param {String|Array} `patterns` One or more glob patterns to use for matching.
4396
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4397
+ * @return {Boolean} Returns true if any patterns match `str`
4398
+ * @api public
4399
+ */
4400
+
4401
+ micromatch.all = (str, patterns, options) => {
4402
+ if (typeof str !== 'string') {
4403
+ throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
4404
+ }
4405
+
4406
+ return [].concat(patterns).every(p => picomatch(p, options)(str));
4407
+ };
4408
+
4409
+ /**
4410
+ * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
4411
+ *
4412
+ * ```js
4413
+ * const mm = require('micromatch');
4414
+ * // mm.capture(pattern, string[, options]);
4415
+ *
4416
+ * console.log(mm.capture('test/*.js', 'test/foo.js'));
4417
+ * //=> ['foo']
4418
+ * console.log(mm.capture('test/*.js', 'foo/bar.css'));
4419
+ * //=> null
4420
+ * ```
4421
+ * @param {String} `glob` Glob pattern to use for matching.
4422
+ * @param {String} `input` String to match
4423
+ * @param {Object} `options` See available [options](#options) for changing how matches are performed
4424
+ * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
4425
+ * @api public
4426
+ */
4427
+
4428
+ micromatch.capture = (glob, input, options) => {
4429
+ let posix = utils.isWindows(options);
4430
+ let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
4431
+ let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
4432
+
4433
+ if (match) {
4434
+ return match.slice(1).map(v => v === void 0 ? '' : v);
4435
+ }
4436
+ };
4437
+
4438
+ /**
4439
+ * Create a regular expression from the given glob `pattern`.
4440
+ *
4441
+ * ```js
4442
+ * const mm = require('micromatch');
4443
+ * // mm.makeRe(pattern[, options]);
4444
+ *
4445
+ * console.log(mm.makeRe('*.js'));
4446
+ * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
4447
+ * ```
4448
+ * @param {String} `pattern` A glob pattern to convert to regex.
4449
+ * @param {Object} `options`
4450
+ * @return {RegExp} Returns a regex created from the given pattern.
4451
+ * @api public
4452
+ */
4453
+
4454
+ micromatch.makeRe = (...args) => picomatch.makeRe(...args);
4455
+
4456
+ /**
4457
+ * Scan a glob pattern to separate the pattern into segments. Used
4458
+ * by the [split](#split) method.
4459
+ *
4460
+ * ```js
4461
+ * const mm = require('micromatch');
4462
+ * const state = mm.scan(pattern[, options]);
4463
+ * ```
4464
+ * @param {String} `pattern`
4465
+ * @param {Object} `options`
4466
+ * @return {Object} Returns an object with
4467
+ * @api public
4468
+ */
4469
+
4470
+ micromatch.scan = (...args) => picomatch.scan(...args);
4471
+
4472
+ /**
4473
+ * Parse a glob pattern to create the source string for a regular
4474
+ * expression.
4475
+ *
4476
+ * ```js
4477
+ * const mm = require('micromatch');
4478
+ * const state = mm.parse(pattern[, options]);
4479
+ * ```
4480
+ * @param {String} `glob`
4481
+ * @param {Object} `options`
4482
+ * @return {Object} Returns an object with useful properties and output to be used as regex source string.
4483
+ * @api public
4484
+ */
4485
+
4486
+ micromatch.parse = (patterns, options) => {
4487
+ let res = [];
4488
+ for (let pattern of [].concat(patterns || [])) {
4489
+ for (let str of braces(String(pattern), options)) {
4490
+ res.push(picomatch.parse(str, options));
4491
+ }
4492
+ }
4493
+ return res;
4494
+ };
4495
+
4496
+ /**
4497
+ * Process the given brace `pattern`.
4498
+ *
4499
+ * ```js
4500
+ * const { braces } = require('micromatch');
4501
+ * console.log(braces('foo/{a,b,c}/bar'));
4502
+ * //=> [ 'foo/(a|b|c)/bar' ]
4503
+ *
4504
+ * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
4505
+ * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
4506
+ * ```
4507
+ * @param {String} `pattern` String with brace pattern to process.
4508
+ * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
4509
+ * @return {Array}
4510
+ * @api public
4511
+ */
4512
+
4513
+ micromatch.braces = (pattern, options) => {
4514
+ if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4515
+ if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
4516
+ return [pattern];
4517
+ }
4518
+ return braces(pattern, options);
4519
+ };
4520
+
4521
+ /**
4522
+ * Expand braces
4523
+ */
4524
+
4525
+ micromatch.braceExpand = (pattern, options) => {
4526
+ if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4527
+ return micromatch.braces(pattern, { ...options, expand: true });
4528
+ };
4529
+
4530
+ /**
4531
+ * Expose micromatch
4532
+ */
4533
+
4534
+ micromatch_1 = micromatch;
4535
+ return micromatch_1;
4536
+ }
4537
+
4538
+ var micromatchExports = requireMicromatch();
4539
+
364
4540
  const PACKAGE_JSON_TEMPLATE = `{
365
4541
  "name": "",
366
4542
  "version": "0.0.1",
@@ -453,12 +4629,12 @@ async function getName(named, name, {
453
4629
  }
454
4630
  } else {
455
4631
  for (const [key, value] of Object.entries(named)) {
456
- if (micromatch.isMatch(relativePath, key)) {
4632
+ if (micromatchExports.isMatch(relativePath, key)) {
457
4633
  matchedKey = key;
458
4634
  matchedRule = value;
459
4635
  break;
460
4636
  }
461
- if (micromatch.isMatch(`${relativePath}/jiek_ignore_dont_use_same_file_name`, key)) {
4637
+ if (micromatchExports.isMatch(`${relativePath}/jiek_ignore_dont_use_same_file_name`, key)) {
462
4638
  isParentMatched = true;
463
4639
  matchedKey = key;
464
4640
  matchedRule = value;
@@ -498,8 +4674,8 @@ async function getName(named, name, {
498
4674
  }
499
4675
  throw new Error("no matched rule");
500
4676
  }
501
- commander.program.command("init [name]").option("-t, --template <template>", "the package.json template file path or file content").action(async () => {
502
- const [, name] = commander.program.args;
4677
+ program.command("init [name]").option("-t, --template <template>", "the package.json template file path or file content").action(async () => {
4678
+ const [, name] = program.args;
503
4679
  const cwd = process.cwd();
504
4680
  const { init = {} } = loadConfig() ?? {};
505
4681
  const { wd } = getWD();
@@ -533,9 +4709,9 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
533
4709
  ];
534
4710
  let newJSONString = templateString;
535
4711
  for (const field of passFields) {
536
- newJSONString = jsoncParser.applyEdits(
4712
+ newJSONString = applyEdits(
537
4713
  newJSONString,
538
- jsoncParser.modify(
4714
+ modify(
539
4715
  newJSONString,
540
4716
  [field],
541
4717
  getWDPackageJSONFiled(wd, field),
@@ -566,7 +4742,7 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
566
4742
  });
567
4743
  pkgName = inputName;
568
4744
  }
569
- newJSONString = jsoncParser.applyEdits(newJSONString, jsoncParser.modify(newJSONString, ["name"], pkgName, { formattingOptions }));
4745
+ newJSONString = applyEdits(newJSONString, modify(newJSONString, ["name"], pkgName, { formattingOptions }));
570
4746
  let pkgRepo = getWDPackageJSONFiled(wd, "repository");
571
4747
  if (typeof pkgRepo === "string") {
572
4748
  pkgRepo = {
@@ -575,9 +4751,9 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
575
4751
  directory: pkgDir
576
4752
  };
577
4753
  }
578
- newJSONString = jsoncParser.applyEdits(
4754
+ newJSONString = applyEdits(
579
4755
  newJSONString,
580
- jsoncParser.modify(
4756
+ modify(
581
4757
  newJSONString,
582
4758
  ["repository"],
583
4759
  pkgRepo,
@@ -585,9 +4761,9 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
585
4761
  )
586
4762
  );
587
4763
  const homepage = `${pkgRepo?.url}/blob/master/${pkgDir}/README.md`;
588
- newJSONString = jsoncParser.applyEdits(
4764
+ newJSONString = applyEdits(
589
4765
  newJSONString,
590
- jsoncParser.modify(
4766
+ modify(
591
4767
  newJSONString,
592
4768
  ["homepage"],
593
4769
  homepage,
@@ -603,9 +4779,9 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
603
4779
  }
604
4780
  labels.push(`scope:${pkgName}`);
605
4781
  const bugs = `${pkgRepo?.url}/issues/new?template=${resolvedBug.template}&labels=${labels.join(",")}`;
606
- newJSONString = jsoncParser.applyEdits(
4782
+ newJSONString = applyEdits(
607
4783
  newJSONString,
608
- jsoncParser.modify(
4784
+ modify(
609
4785
  newJSONString,
610
4786
  ["bugs"],
611
4787
  bugs,
@@ -639,15 +4815,17 @@ commander.program.command("init [name]").option("-t, --template <template>", "th
639
4815
 
640
4816
  const intersection = (a, b) => new Set([...a].filter((i) => b.has(i)));
641
4817
  function getExports({
642
- entrypoints: entrypoints$1,
4818
+ entrypoints,
643
4819
  pkgIsModule,
644
4820
  entries,
645
4821
  config,
646
4822
  dir,
647
- noFilter
4823
+ noFilter,
4824
+ withSource,
4825
+ withSuffix
648
4826
  }) {
649
- const dirResolve = (...paths) => path.resolve(dir ?? process.cwd(), ...paths);
650
- const dirRelative = (path$1) => path.relative(dir ?? process.cwd(), path$1);
4827
+ const dirResolve = (...paths) => resolve$1(dir ?? process.cwd(), ...paths);
4828
+ const dirRelative = (path) => relative(dir ?? process.cwd(), path);
651
4829
  const { build = {} } = config ?? {};
652
4830
  const {
653
4831
  crossModuleConvertor = true
@@ -655,21 +4833,21 @@ function getExports({
655
4833
  const jsOutdir = `./${dirRelative(dirResolve(
656
4834
  (typeof build?.output?.dir === "object" ? build.output.dir.js : build?.output?.dir) ?? "dist"
657
4835
  ))}`;
658
- const [, resolvedEntrypoints] = entrypoints.resolveEntrypoints(entrypoints$1);
4836
+ const [, resolvedEntrypoints] = resolveEntrypoints(entrypoints);
659
4837
  if (entries) {
660
4838
  Object.entries(resolvedEntrypoints).forEach(([key]) => {
661
- if (!entries.some((e) => micromatch.isMatch(key, e, { matchBase: true }))) {
4839
+ if (!entries.some((e) => micromatchExports.isMatch(key, e, { matchBase: true }))) {
662
4840
  delete resolvedEntrypoints[key];
663
4841
  }
664
4842
  });
665
4843
  }
666
- const filteredResolvedEntrypoints = noFilter ? resolvedEntrypoints : entrypoints.filterLeafs(
4844
+ const filteredResolvedEntrypoints = noFilter ? resolvedEntrypoints : filterLeafs(
667
4845
  resolvedEntrypoints,
668
4846
  {
669
4847
  skipValue: [
670
4848
  // ignore values that filename starts with `.jk-noentry`
671
4849
  /(^|\/)\.jk-noentry/,
672
- ...entrypoints.DEFAULT_SKIP_VALUES
4850
+ ...DEFAULT_SKIP_VALUES
673
4851
  ]
674
4852
  }
675
4853
  );
@@ -685,8 +4863,10 @@ function getExports({
685
4863
  } : {};
686
4864
  return [
687
4865
  filteredResolvedEntrypoints,
688
- entrypoints.entrypoints2Exports(filteredResolvedEntrypoints, {
4866
+ entrypoints2Exports(filteredResolvedEntrypoints, {
689
4867
  outdir: jsOutdir,
4868
+ withSource,
4869
+ withSuffix,
690
4870
  withConditional: {
691
4871
  ...crossModuleWithConditional
692
4872
  }
@@ -694,7 +4874,7 @@ function getExports({
694
4874
  ];
695
4875
  }
696
4876
 
697
- commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper <bumper>", "bump version", "patch").option("-p, --preview", "preview publish").action(async ({ preview, bumper: bumper$1, ...options }) => {
4877
+ program.command("publish").aliases(["pub", "p"]).option("-b, --bumper <bumper>", "bump version", "patch").option("-p, --preview", "preview publish").action(async ({ preview, bumper, ...options }) => {
698
4878
  actionRestore();
699
4879
  const { value = {} } = await getSelectedProjectsGraph() ?? {};
700
4880
  const selectedProjectsGraphEntries = Object.entries(value);
@@ -710,7 +4890,9 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
710
4890
  pkgIsModule,
711
4891
  config: loadConfig(dir),
712
4892
  dir,
713
- noFilter: true
4893
+ noFilter: true,
4894
+ withSource: true,
4895
+ withSuffix: true
714
4896
  });
715
4897
  newManifest.exports = {
716
4898
  ...resolvedEntrypoints,
@@ -727,16 +4909,16 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
727
4909
  for (const [dir, manifest] of manifests) {
728
4910
  const oldJSONString = fs.readFileSync(path.join(dir, "package.json"), "utf-8");
729
4911
  const oldJSON = JSON.parse(oldJSONString) ?? "0.0.0";
730
- const newVersion = bumper.bump(oldJSON.version, bumper$1);
4912
+ const newVersion = bump(oldJSON.version, bumper);
731
4913
  const { indent = " " } = detectIndent(oldJSONString);
732
4914
  const formattingOptions = {
733
4915
  tabSize: indent.length,
734
4916
  insertSpaces: true
735
4917
  };
736
4918
  let newJSONString = oldJSONString;
737
- newJSONString = jsoncParser.applyEdits(
4919
+ newJSONString = applyEdits(
738
4920
  newJSONString,
739
- jsoncParser.modify(
4921
+ modify(
740
4922
  newJSONString,
741
4923
  ["version"],
742
4924
  newVersion,
@@ -747,9 +4929,9 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
747
4929
  if (JSON.stringify(value2) === JSON.stringify(oldJSON[key]))
748
4930
  continue;
749
4931
  if (key !== "exports") {
750
- newJSONString = jsoncParser.applyEdits(
4932
+ newJSONString = applyEdits(
751
4933
  newJSONString,
752
- jsoncParser.modify(
4934
+ modify(
753
4935
  newJSONString,
754
4936
  ["publishConfig", key],
755
4937
  value2,
@@ -759,9 +4941,9 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
759
4941
  } else {
760
4942
  const exports = value2;
761
4943
  for (const [k, v] of Object.entries(exports)) {
762
- newJSONString = jsoncParser.applyEdits(
4944
+ newJSONString = applyEdits(
763
4945
  newJSONString,
764
- jsoncParser.modify(
4946
+ modify(
765
4947
  newJSONString,
766
4948
  ["publishConfig", "exports", k],
767
4949
  v,
@@ -786,9 +4968,9 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
786
4968
  for (const [k, v] of Object.entries(indexPublishConfig)) {
787
4969
  if (v === void 0)
788
4970
  continue;
789
- newJSONString = jsoncParser.applyEdits(
4971
+ newJSONString = applyEdits(
790
4972
  newJSONString,
791
- jsoncParser.modify(
4973
+ modify(
792
4974
  newJSONString,
793
4975
  ["publishConfig", k],
794
4976
  v,
@@ -807,11 +4989,11 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
807
4989
  console.warn("preview mode");
808
4990
  continue;
809
4991
  }
810
- childProcess__namespace.execSync(["pnpm", "publish", "--access", "public", "--no-git-checks", ...passArgs].join(" "), {
4992
+ childProcess.execSync(["pnpm", "publish", "--access", "public", "--no-git-checks", ...passArgs].join(" "), {
811
4993
  cwd: dir,
812
4994
  stdio: "inherit"
813
4995
  });
814
- const modifyVersionPackageJSON = jsoncParser.applyEdits(oldJSONString, jsoncParser.modify(oldJSONString, ["version"], newVersion, {}));
4996
+ const modifyVersionPackageJSON = applyEdits(oldJSONString, modify(oldJSONString, ["version"], newVersion, {}));
815
4997
  fs.writeFileSync(path.join(dir, "package.json.bak"), modifyVersionPackageJSON);
816
4998
  } finally {
817
4999
  fs.unlinkSync(path.join(dir, "package.json"));
@@ -821,4 +5003,4 @@ commander.program.command("publish").aliases(["pub", "p"]).option("-b, --bumper
821
5003
  actionDone();
822
5004
  });
823
5005
 
824
- commander.program.parse(process.argv);
5006
+ program.parse(process.argv);