modern-cmdk 1.1.5 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/codemod/cli.mjs +634 -399
- package/dist/codemod/transforms/data-attrs.mjs +2 -2
- package/dist/core/index.mjs +5 -2
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.mjs +83 -80
- package/package.json +5 -5
package/dist/codemod/cli.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fsPromises, { readFile, writeFile } from "node:fs/promises";
|
|
4
|
-
import
|
|
4
|
+
import path, { resolve } from "node:path";
|
|
5
5
|
import process$1 from "node:process";
|
|
6
6
|
import fs from "node:fs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import "node:stream";
|
|
8
|
+
import "node:events";
|
|
9
|
+
import "node:stream/promises";
|
|
10
10
|
import { promisify } from "node:util";
|
|
11
11
|
import { execFile } from "node:child_process";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
|
+
import os from "node:os";
|
|
13
14
|
//#region \0rolldown/runtime.js
|
|
14
15
|
var __create = Object.create;
|
|
15
16
|
var __defProp = Object.defineProperty;
|
|
@@ -17,8 +18,15 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
17
18
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
18
19
|
var __getProtoOf = Object.getPrototypeOf;
|
|
19
20
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
-
var __esmMin = (fn, res) => () =>
|
|
21
|
-
|
|
21
|
+
var __esmMin = (fn, res, err) => () => {
|
|
22
|
+
if (err) throw err[0];
|
|
23
|
+
try {
|
|
24
|
+
return fn && (res = fn(fn = 0)), res;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
throw err = [e], e;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
22
30
|
var __exportAll = (all, no_symbols) => {
|
|
23
31
|
let target = {};
|
|
24
32
|
for (var name in all) __defProp(target, name, {
|
|
@@ -43,173 +51,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
43
51
|
enumerable: true
|
|
44
52
|
}) : target, mod));
|
|
45
53
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
-
var __require = /*
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region ../../node_modules/.pnpm/@sindresorhus+merge-streams@4.0.0/node_modules/@sindresorhus/merge-streams/index.js
|
|
49
|
-
function mergeStreams(streams) {
|
|
50
|
-
if (!Array.isArray(streams)) throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);
|
|
51
|
-
for (const stream of streams) validateStream(stream);
|
|
52
|
-
const objectMode = streams.some(({ readableObjectMode }) => readableObjectMode);
|
|
53
|
-
const highWaterMark = getHighWaterMark(streams, objectMode);
|
|
54
|
-
const passThroughStream = new MergedStream({
|
|
55
|
-
objectMode,
|
|
56
|
-
writableHighWaterMark: highWaterMark,
|
|
57
|
-
readableHighWaterMark: highWaterMark
|
|
58
|
-
});
|
|
59
|
-
for (const stream of streams) passThroughStream.add(stream);
|
|
60
|
-
return passThroughStream;
|
|
61
|
-
}
|
|
62
|
-
const getHighWaterMark = (streams, objectMode) => {
|
|
63
|
-
if (streams.length === 0) return getDefaultHighWaterMark(objectMode);
|
|
64
|
-
const highWaterMarks = streams.filter(({ readableObjectMode }) => readableObjectMode === objectMode).map(({ readableHighWaterMark }) => readableHighWaterMark);
|
|
65
|
-
return Math.max(...highWaterMarks);
|
|
66
|
-
};
|
|
67
|
-
var MergedStream = class extends PassThrough {
|
|
68
|
-
#streams = /* @__PURE__ */ new Set([]);
|
|
69
|
-
#ended = /* @__PURE__ */ new Set([]);
|
|
70
|
-
#aborted = /* @__PURE__ */ new Set([]);
|
|
71
|
-
#onFinished;
|
|
72
|
-
#unpipeEvent = Symbol("unpipe");
|
|
73
|
-
#streamPromises = /* @__PURE__ */ new WeakMap();
|
|
74
|
-
add(stream) {
|
|
75
|
-
validateStream(stream);
|
|
76
|
-
if (this.#streams.has(stream)) return;
|
|
77
|
-
this.#streams.add(stream);
|
|
78
|
-
this.#onFinished ??= onMergedStreamFinished(this, this.#streams, this.#unpipeEvent);
|
|
79
|
-
const streamPromise = endWhenStreamsDone({
|
|
80
|
-
passThroughStream: this,
|
|
81
|
-
stream,
|
|
82
|
-
streams: this.#streams,
|
|
83
|
-
ended: this.#ended,
|
|
84
|
-
aborted: this.#aborted,
|
|
85
|
-
onFinished: this.#onFinished,
|
|
86
|
-
unpipeEvent: this.#unpipeEvent
|
|
87
|
-
});
|
|
88
|
-
this.#streamPromises.set(stream, streamPromise);
|
|
89
|
-
stream.pipe(this, { end: false });
|
|
90
|
-
}
|
|
91
|
-
async remove(stream) {
|
|
92
|
-
validateStream(stream);
|
|
93
|
-
if (!this.#streams.has(stream)) return false;
|
|
94
|
-
const streamPromise = this.#streamPromises.get(stream);
|
|
95
|
-
if (streamPromise === void 0) return false;
|
|
96
|
-
this.#streamPromises.delete(stream);
|
|
97
|
-
stream.unpipe(this);
|
|
98
|
-
await streamPromise;
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const onMergedStreamFinished = async (passThroughStream, streams, unpipeEvent) => {
|
|
103
|
-
updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);
|
|
104
|
-
const controller = new AbortController();
|
|
105
|
-
try {
|
|
106
|
-
await Promise.race([onMergedStreamEnd(passThroughStream, controller), onInputStreamsUnpipe(passThroughStream, streams, unpipeEvent, controller)]);
|
|
107
|
-
} finally {
|
|
108
|
-
controller.abort();
|
|
109
|
-
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
const onMergedStreamEnd = async (passThroughStream, { signal }) => {
|
|
113
|
-
try {
|
|
114
|
-
await finished(passThroughStream, {
|
|
115
|
-
signal,
|
|
116
|
-
cleanup: true
|
|
117
|
-
});
|
|
118
|
-
} catch (error) {
|
|
119
|
-
errorOrAbortStream(passThroughStream, error);
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const onInputStreamsUnpipe = async (passThroughStream, streams, unpipeEvent, { signal }) => {
|
|
124
|
-
for await (const [unpipedStream] of on(passThroughStream, "unpipe", { signal })) if (streams.has(unpipedStream)) unpipedStream.emit(unpipeEvent);
|
|
125
|
-
};
|
|
126
|
-
const validateStream = (stream) => {
|
|
127
|
-
if (typeof stream?.pipe !== "function") throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`);
|
|
128
|
-
};
|
|
129
|
-
const endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, aborted, onFinished, unpipeEvent }) => {
|
|
130
|
-
updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);
|
|
131
|
-
const controller = new AbortController();
|
|
132
|
-
try {
|
|
133
|
-
await Promise.race([
|
|
134
|
-
afterMergedStreamFinished(onFinished, stream, controller),
|
|
135
|
-
onInputStreamEnd({
|
|
136
|
-
passThroughStream,
|
|
137
|
-
stream,
|
|
138
|
-
streams,
|
|
139
|
-
ended,
|
|
140
|
-
aborted,
|
|
141
|
-
controller
|
|
142
|
-
}),
|
|
143
|
-
onInputStreamUnpipe({
|
|
144
|
-
stream,
|
|
145
|
-
streams,
|
|
146
|
-
ended,
|
|
147
|
-
aborted,
|
|
148
|
-
unpipeEvent,
|
|
149
|
-
controller
|
|
150
|
-
})
|
|
151
|
-
]);
|
|
152
|
-
} finally {
|
|
153
|
-
controller.abort();
|
|
154
|
-
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
|
|
155
|
-
}
|
|
156
|
-
if (streams.size > 0 && streams.size === ended.size + aborted.size) if (ended.size === 0 && aborted.size > 0) abortStream(passThroughStream);
|
|
157
|
-
else endStream(passThroughStream);
|
|
158
|
-
};
|
|
159
|
-
const afterMergedStreamFinished = async (onFinished, stream, { signal }) => {
|
|
160
|
-
try {
|
|
161
|
-
await onFinished;
|
|
162
|
-
if (!signal.aborted) abortStream(stream);
|
|
163
|
-
} catch (error) {
|
|
164
|
-
if (!signal.aborted) errorOrAbortStream(stream, error);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
const onInputStreamEnd = async ({ passThroughStream, stream, streams, ended, aborted, controller: { signal } }) => {
|
|
168
|
-
try {
|
|
169
|
-
await finished(stream, {
|
|
170
|
-
signal,
|
|
171
|
-
cleanup: true,
|
|
172
|
-
readable: true,
|
|
173
|
-
writable: false
|
|
174
|
-
});
|
|
175
|
-
if (streams.has(stream)) ended.add(stream);
|
|
176
|
-
} catch (error) {
|
|
177
|
-
if (signal.aborted || !streams.has(stream)) return;
|
|
178
|
-
if (isAbortError(error)) aborted.add(stream);
|
|
179
|
-
else errorStream(passThroughStream, error);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
const onInputStreamUnpipe = async ({ stream, streams, ended, aborted, unpipeEvent, controller: { signal } }) => {
|
|
183
|
-
await once(stream, unpipeEvent, { signal });
|
|
184
|
-
if (!stream.readable) return once(signal, "abort", { signal });
|
|
185
|
-
streams.delete(stream);
|
|
186
|
-
ended.delete(stream);
|
|
187
|
-
aborted.delete(stream);
|
|
188
|
-
};
|
|
189
|
-
const endStream = (stream) => {
|
|
190
|
-
if (stream.writable) stream.end();
|
|
191
|
-
};
|
|
192
|
-
const errorOrAbortStream = (stream, error) => {
|
|
193
|
-
if (isAbortError(error)) abortStream(stream);
|
|
194
|
-
else errorStream(stream, error);
|
|
195
|
-
};
|
|
196
|
-
const isAbortError = (error) => error?.code === "ERR_STREAM_PREMATURE_CLOSE";
|
|
197
|
-
const abortStream = (stream) => {
|
|
198
|
-
if (stream.readable || stream.writable) stream.destroy();
|
|
199
|
-
};
|
|
200
|
-
const errorStream = (stream, error) => {
|
|
201
|
-
if (!stream.destroyed) {
|
|
202
|
-
stream.once("error", noop);
|
|
203
|
-
stream.destroy(error);
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
const noop = () => {};
|
|
207
|
-
const updateMaxListeners = (passThroughStream, increment) => {
|
|
208
|
-
const maxListeners = passThroughStream.getMaxListeners();
|
|
209
|
-
if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) passThroughStream.setMaxListeners(maxListeners + increment);
|
|
210
|
-
};
|
|
211
|
-
const PASSTHROUGH_LISTENERS_COUNT = 2;
|
|
212
|
-
const PASSTHROUGH_LISTENERS_PER_STREAM = 1;
|
|
54
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
213
55
|
//#endregion
|
|
214
56
|
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
|
215
57
|
var require_array = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -267,9 +109,9 @@ var require_fs$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
267
109
|
var require_path$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
268
110
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
269
111
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
270
|
-
const os$
|
|
271
|
-
const path$
|
|
272
|
-
const IS_WINDOWS_PLATFORM = os$
|
|
112
|
+
const os$2 = __require("os");
|
|
113
|
+
const path$9 = __require("path");
|
|
114
|
+
const IS_WINDOWS_PLATFORM = os$2.platform() === "win32";
|
|
273
115
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
274
116
|
/**
|
|
275
117
|
* All non-escaped special characters.
|
|
@@ -297,7 +139,7 @@ var require_path$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
297
139
|
}
|
|
298
140
|
exports.unixify = unixify;
|
|
299
141
|
function makeAbsolute(cwd, filepath) {
|
|
300
|
-
return path$
|
|
142
|
+
return path$9.resolve(cwd, filepath);
|
|
301
143
|
}
|
|
302
144
|
exports.makeAbsolute = makeAbsolute;
|
|
303
145
|
function removeLeadingDotSegment(entry) {
|
|
@@ -669,7 +511,7 @@ var require_to_regex_range = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
669
511
|
let nines = 1;
|
|
670
512
|
let zeros = 1;
|
|
671
513
|
let stop = countNines(min, nines);
|
|
672
|
-
let stops = new Set([max]);
|
|
514
|
+
let stops = /* @__PURE__ */ new Set([max]);
|
|
673
515
|
while (min <= stop && stop <= max) {
|
|
674
516
|
stops.add(stop);
|
|
675
517
|
nines += 1;
|
|
@@ -1549,7 +1391,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1549
1391
|
//#endregion
|
|
1550
1392
|
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
|
|
1551
1393
|
var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1552
|
-
const path$
|
|
1394
|
+
const path$8 = __require("path");
|
|
1553
1395
|
const WIN_SLASH = "\\\\/";
|
|
1554
1396
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1555
1397
|
/**
|
|
@@ -1670,7 +1512,10 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1670
1512
|
CHAR_UNDERSCORE: 95,
|
|
1671
1513
|
CHAR_VERTICAL_LINE: 124,
|
|
1672
1514
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1673
|
-
SEP: path$
|
|
1515
|
+
SEP: path$8.sep,
|
|
1516
|
+
/**
|
|
1517
|
+
* Create EXTGLOB_CHARS
|
|
1518
|
+
*/
|
|
1674
1519
|
extglobChars(chars) {
|
|
1675
1520
|
return {
|
|
1676
1521
|
"!": {
|
|
@@ -1700,6 +1545,9 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1700
1545
|
}
|
|
1701
1546
|
};
|
|
1702
1547
|
},
|
|
1548
|
+
/**
|
|
1549
|
+
* Create GLOB_CHARS
|
|
1550
|
+
*/
|
|
1703
1551
|
globChars(win32) {
|
|
1704
1552
|
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
1705
1553
|
}
|
|
@@ -1708,7 +1556,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1708
1556
|
//#endregion
|
|
1709
1557
|
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
|
|
1710
1558
|
var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1711
|
-
const path$
|
|
1559
|
+
const path$7 = __require("path");
|
|
1712
1560
|
const win32 = process.platform === "win32";
|
|
1713
1561
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
|
|
1714
1562
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1728,7 +1576,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1728
1576
|
};
|
|
1729
1577
|
exports.isWindows = (options) => {
|
|
1730
1578
|
if (options && typeof options.windows === "boolean") return options.windows;
|
|
1731
|
-
return win32 === true || path$
|
|
1579
|
+
return win32 === true || path$7.sep === "\\";
|
|
1732
1580
|
};
|
|
1733
1581
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
1734
1582
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -2901,7 +2749,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2901
2749
|
//#endregion
|
|
2902
2750
|
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
|
|
2903
2751
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2904
|
-
const path$
|
|
2752
|
+
const path$6 = __require("path");
|
|
2905
2753
|
const scan = require_scan();
|
|
2906
2754
|
const parse = require_parse();
|
|
2907
2755
|
const utils = require_utils$2();
|
|
@@ -3040,7 +2888,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3040
2888
|
* @api public
|
|
3041
2889
|
*/
|
|
3042
2890
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
3043
|
-
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$
|
|
2891
|
+
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$6.basename(input));
|
|
3044
2892
|
};
|
|
3045
2893
|
/**
|
|
3046
2894
|
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
@@ -3595,7 +3443,7 @@ var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3595
3443
|
var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3596
3444
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3597
3445
|
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
|
|
3598
|
-
const path$
|
|
3446
|
+
const path$5 = __require("path");
|
|
3599
3447
|
const globParent = require_glob_parent();
|
|
3600
3448
|
const micromatch = require_micromatch();
|
|
3601
3449
|
const GLOBSTAR = "**";
|
|
@@ -3699,11 +3547,11 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3699
3547
|
}
|
|
3700
3548
|
exports.hasGlobStar = hasGlobStar;
|
|
3701
3549
|
function endsWithSlashGlobStar(pattern) {
|
|
3702
|
-
return pattern.endsWith("
|
|
3550
|
+
return pattern.endsWith("/**");
|
|
3703
3551
|
}
|
|
3704
3552
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
3705
3553
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
3706
|
-
const basename = path$
|
|
3554
|
+
const basename = path$5.basename(pattern);
|
|
3707
3555
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
3708
3556
|
}
|
|
3709
3557
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -3777,7 +3625,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3777
3625
|
}
|
|
3778
3626
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
3779
3627
|
function isAbsolute(pattern) {
|
|
3780
|
-
return path$
|
|
3628
|
+
return path$5.isAbsolute(pattern);
|
|
3781
3629
|
}
|
|
3782
3630
|
exports.isAbsolute = isAbsolute;
|
|
3783
3631
|
}));
|
|
@@ -4405,7 +4253,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4405
4253
|
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
|
|
4406
4254
|
var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4407
4255
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4408
|
-
const path$
|
|
4256
|
+
const path$4 = __require("path");
|
|
4409
4257
|
const fsStat = require_out$3();
|
|
4410
4258
|
const fs = require_fs();
|
|
4411
4259
|
var Settings = class {
|
|
@@ -4413,7 +4261,7 @@ var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4413
4261
|
this._options = _options;
|
|
4414
4262
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4415
4263
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
4416
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
4264
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
|
|
4417
4265
|
this.stats = this._getValue(this._options.stats, false);
|
|
4418
4266
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4419
4267
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -5007,7 +4855,7 @@ var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5007
4855
|
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
|
|
5008
4856
|
var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5009
4857
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5010
|
-
const path$
|
|
4858
|
+
const path$3 = __require("path");
|
|
5011
4859
|
const fsScandir = require_out$2();
|
|
5012
4860
|
var Settings = class {
|
|
5013
4861
|
constructor(_options = {}) {
|
|
@@ -5017,7 +4865,7 @@ var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5017
4865
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
5018
4866
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
5019
4867
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
5020
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
4868
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
|
|
5021
4869
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
5022
4870
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
5023
4871
|
fs: this._options.fs,
|
|
@@ -5069,7 +4917,7 @@ var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5069
4917
|
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js
|
|
5070
4918
|
var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5071
4919
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5072
|
-
const path$
|
|
4920
|
+
const path$2 = __require("path");
|
|
5073
4921
|
const fsStat = require_out$3();
|
|
5074
4922
|
const utils = require_utils$1();
|
|
5075
4923
|
var Reader = class {
|
|
@@ -5082,7 +4930,7 @@ var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5082
4930
|
});
|
|
5083
4931
|
}
|
|
5084
4932
|
_getFullEntryPath(filepath) {
|
|
5085
|
-
return path$
|
|
4933
|
+
return path$2.resolve(this._settings.cwd, filepath);
|
|
5086
4934
|
}
|
|
5087
4935
|
_makeEntry(stats, pattern) {
|
|
5088
4936
|
const entry = {
|
|
@@ -5417,7 +5265,7 @@ var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5417
5265
|
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js
|
|
5418
5266
|
var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5419
5267
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5420
|
-
const path = __require("path");
|
|
5268
|
+
const path$1 = __require("path");
|
|
5421
5269
|
const deep_1 = require_deep();
|
|
5422
5270
|
const entry_1 = require_entry$1();
|
|
5423
5271
|
const error_1 = require_error();
|
|
@@ -5431,7 +5279,7 @@ var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5431
5279
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
5432
5280
|
}
|
|
5433
5281
|
_getRootDirectory(task) {
|
|
5434
|
-
return path.resolve(this._settings.cwd, task.base);
|
|
5282
|
+
return path$1.resolve(this._settings.cwd, task.base);
|
|
5435
5283
|
}
|
|
5436
5284
|
_getReaderOptions(task) {
|
|
5437
5285
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -5588,12 +5436,12 @@ var require_settings = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5588
5436
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5589
5437
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
5590
5438
|
const fs$1 = __require("fs");
|
|
5591
|
-
const os = __require("os");
|
|
5439
|
+
const os$1 = __require("os");
|
|
5592
5440
|
/**
|
|
5593
5441
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
5594
5442
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
5595
5443
|
*/
|
|
5596
|
-
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
|
5444
|
+
const CPU_COUNT = Math.max(os$1.cpus().length, 1);
|
|
5597
5445
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
5598
5446
|
lstat: fs$1.lstat,
|
|
5599
5447
|
lstatSync: fs$1.lstatSync,
|
|
@@ -5800,7 +5648,6 @@ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
5800
5648
|
const REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
|
|
5801
5649
|
const MODE_IGNORE = "regex";
|
|
5802
5650
|
const MODE_CHECK_IGNORE = "checkRegex";
|
|
5803
|
-
const UNDERSCORE = "_";
|
|
5804
5651
|
const TRAILING_WILD_CARD_REPLACERS = {
|
|
5805
5652
|
[MODE_IGNORE](_, p1) {
|
|
5806
5653
|
return `${p1 ? `${p1}[^/]+` : "[^/]*"}(?=$|\\/$)`;
|
|
@@ -5823,12 +5670,12 @@ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
5823
5670
|
define(this, "regexPrefix", prefix);
|
|
5824
5671
|
}
|
|
5825
5672
|
get regex() {
|
|
5826
|
-
const key =
|
|
5673
|
+
const key = "_regex";
|
|
5827
5674
|
if (this[key]) return this[key];
|
|
5828
5675
|
return this._make(MODE_IGNORE, key);
|
|
5829
5676
|
}
|
|
5830
5677
|
get checkRegex() {
|
|
5831
|
-
const key =
|
|
5678
|
+
const key = "_checkRegex";
|
|
5832
5679
|
if (this[key]) return this[key];
|
|
5833
5680
|
return this._make(MODE_CHECK_IGNORE, key);
|
|
5834
5681
|
}
|
|
@@ -5976,8 +5823,8 @@ var import_ignore = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
5976
5823
|
define(module.exports, Symbol.for("setupWindows"), setupWindows);
|
|
5977
5824
|
})))(), 1);
|
|
5978
5825
|
function isPathInside(childPath, parentPath) {
|
|
5979
|
-
const relation =
|
|
5980
|
-
return Boolean(relation && relation !== ".." && !relation.startsWith(`..${
|
|
5826
|
+
const relation = path.relative(parentPath, childPath);
|
|
5827
|
+
return Boolean(relation && relation !== ".." && !relation.startsWith(`..${path.sep}`) && relation !== path.resolve(childPath));
|
|
5981
5828
|
}
|
|
5982
5829
|
//#endregion
|
|
5983
5830
|
//#region ../../node_modules/.pnpm/slash@5.1.0/node_modules/slash/index.js
|
|
@@ -5986,7 +5833,7 @@ function slash(path) {
|
|
|
5986
5833
|
return path.replace(/\\/g, "/");
|
|
5987
5834
|
}
|
|
5988
5835
|
//#endregion
|
|
5989
|
-
//#region ../../node_modules/.pnpm/globby@16.
|
|
5836
|
+
//#region ../../node_modules/.pnpm/globby@16.2.0/node_modules/globby/utilities.js
|
|
5990
5837
|
const isNegativePattern = (pattern) => pattern[0] === "!";
|
|
5991
5838
|
/**
|
|
5992
5839
|
Normalize a root-anchored pattern to be relative.
|
|
@@ -6015,7 +5862,7 @@ Get the leading static prefix from an absolute pattern.
|
|
|
6015
5862
|
@returns {string|undefined} Static absolute prefix, for example `/tmp/project`.
|
|
6016
5863
|
*/
|
|
6017
5864
|
const getStaticAbsolutePathPrefix = (pattern) => {
|
|
6018
|
-
if (!
|
|
5865
|
+
if (!path.isAbsolute(pattern)) return;
|
|
6019
5866
|
const staticSegments = [];
|
|
6020
5867
|
for (const segment of pattern.split("/")) {
|
|
6021
5868
|
if (!segment) continue;
|
|
@@ -6110,7 +5957,7 @@ const buildPathChain = (startPath, rootPath) => {
|
|
|
6110
5957
|
let currentPath = startPath;
|
|
6111
5958
|
chain.push(currentPath);
|
|
6112
5959
|
while (currentPath !== rootPath) {
|
|
6113
|
-
const parentPath =
|
|
5960
|
+
const parentPath = path.dirname(currentPath);
|
|
6114
5961
|
if (parentPath === currentPath) break;
|
|
6115
5962
|
currentPath = parentPath;
|
|
6116
5963
|
chain.push(currentPath);
|
|
@@ -6119,7 +5966,7 @@ const buildPathChain = (startPath, rootPath) => {
|
|
|
6119
5966
|
};
|
|
6120
5967
|
const findGitRootInChain = async (paths, statMethod) => {
|
|
6121
5968
|
for (const directory of paths) {
|
|
6122
|
-
const gitPath =
|
|
5969
|
+
const gitPath = path.join(directory, ".git");
|
|
6123
5970
|
try {
|
|
6124
5971
|
if (pathHasGitDirectory(await statMethod(gitPath))) return directory;
|
|
6125
5972
|
} catch {}
|
|
@@ -6128,11 +5975,11 @@ const findGitRootInChain = async (paths, statMethod) => {
|
|
|
6128
5975
|
const findGitRootSyncUncached = (cwd, fsImplementation) => {
|
|
6129
5976
|
const statSyncMethod = getStatSyncMethod$1(fsImplementation);
|
|
6130
5977
|
if (!statSyncMethod) return;
|
|
6131
|
-
const currentPath =
|
|
6132
|
-
const { root } =
|
|
5978
|
+
const currentPath = path.resolve(cwd);
|
|
5979
|
+
const { root } = path.parse(currentPath);
|
|
6133
5980
|
const chain = buildPathChain(currentPath, root);
|
|
6134
5981
|
for (const directory of chain) {
|
|
6135
|
-
const gitPath =
|
|
5982
|
+
const gitPath = path.join(directory, ".git");
|
|
6136
5983
|
try {
|
|
6137
5984
|
if (pathHasGitDirectory(statSyncMethod(gitPath))) return directory;
|
|
6138
5985
|
} catch {}
|
|
@@ -6145,8 +5992,8 @@ const findGitRootSync = (cwd, fsImplementation) => {
|
|
|
6145
5992
|
const findGitRootAsyncUncached = async (cwd, fsImplementation) => {
|
|
6146
5993
|
const statMethod = getAsyncStatMethod(fsImplementation);
|
|
6147
5994
|
if (!statMethod) return findGitRootSync(cwd, fsImplementation);
|
|
6148
|
-
const currentPath =
|
|
6149
|
-
const { root } =
|
|
5995
|
+
const currentPath = path.resolve(cwd);
|
|
5996
|
+
const { root } = path.parse(currentPath);
|
|
6150
5997
|
return findGitRootInChain(buildPathChain(currentPath, root), statMethod);
|
|
6151
5998
|
};
|
|
6152
5999
|
const findGitRoot = async (cwd, fsImplementation) => {
|
|
@@ -6161,8 +6008,8 @@ Get paths to all .gitignore files from git root to cwd (inclusive).
|
|
|
6161
6008
|
@returns {string[]} Array of .gitignore file paths to search for.
|
|
6162
6009
|
*/
|
|
6163
6010
|
const isWithinGitRoot = (gitRoot, cwd) => {
|
|
6164
|
-
const resolvedGitRoot =
|
|
6165
|
-
const resolvedCwd =
|
|
6011
|
+
const resolvedGitRoot = path.resolve(gitRoot);
|
|
6012
|
+
const resolvedCwd = path.resolve(cwd);
|
|
6166
6013
|
return resolvedCwd === resolvedGitRoot || isPathInside(resolvedCwd, resolvedGitRoot);
|
|
6167
6014
|
};
|
|
6168
6015
|
const getParentGitignorePaths = (gitRoot, cwd) => {
|
|
@@ -6170,7 +6017,7 @@ const getParentGitignorePaths = (gitRoot, cwd) => {
|
|
|
6170
6017
|
if (typeof cwd !== "string") throw new TypeError("cwd must be a string");
|
|
6171
6018
|
if (!gitRoot) return [];
|
|
6172
6019
|
if (!isWithinGitRoot(gitRoot, cwd)) return [];
|
|
6173
|
-
return [...buildPathChain(
|
|
6020
|
+
return [...buildPathChain(path.resolve(cwd), path.resolve(gitRoot))].reverse().map((directory) => path.join(directory, ".gitignore"));
|
|
6174
6021
|
};
|
|
6175
6022
|
/**
|
|
6176
6023
|
Convert ignore patterns to fast-glob compatible format.
|
|
@@ -6195,7 +6042,7 @@ const convertPatternsForFastGlob = (patterns, usingGitRoot, normalizeDirectoryPa
|
|
|
6195
6042
|
return hasNegations ? [] : result;
|
|
6196
6043
|
};
|
|
6197
6044
|
//#endregion
|
|
6198
|
-
//#region ../../node_modules/.pnpm/globby@16.
|
|
6045
|
+
//#region ../../node_modules/.pnpm/globby@16.2.0/node_modules/globby/ignore.js
|
|
6199
6046
|
const defaultIgnoredDirectories = [
|
|
6200
6047
|
"**/node_modules",
|
|
6201
6048
|
"**/flow-typed",
|
|
@@ -6207,31 +6054,20 @@ const ignoreFilesGlobOptions = {
|
|
|
6207
6054
|
dot: true
|
|
6208
6055
|
};
|
|
6209
6056
|
const GITIGNORE_FILES_PATTERN = "**/.gitignore";
|
|
6057
|
+
const MAX_INCLUDE_DEPTH = 10;
|
|
6210
6058
|
const getReadFileMethod = (fsImplementation) => bindFsMethod(fsImplementation?.promises, "readFile") ?? bindFsMethod(fsPromises, "readFile") ?? promisifyFsMethod(fsImplementation, "readFile");
|
|
6211
|
-
const getReadFileSyncMethod = (fsImplementation) => bindFsMethod(fsImplementation, "readFileSync") ?? bindFsMethod(fs, "readFileSync");
|
|
6212
6059
|
const shouldSkipIgnoreFileError = (error, suppressErrors) => {
|
|
6213
6060
|
if (!error) return Boolean(suppressErrors);
|
|
6214
6061
|
if (error.code === "ENOENT" || error.code === "ENOTDIR") return true;
|
|
6215
6062
|
return Boolean(suppressErrors);
|
|
6216
6063
|
};
|
|
6217
|
-
const
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
}
|
|
6222
|
-
return /* @__PURE__ */ new Error(`Failed to read ignore file at ${filePath}: ${String(error)}`);
|
|
6223
|
-
};
|
|
6224
|
-
const processIgnoreFileCore = (filePath, readMethod, suppressErrors) => {
|
|
6225
|
-
try {
|
|
6226
|
-
return {
|
|
6227
|
-
filePath,
|
|
6228
|
-
content: readMethod(filePath, "utf8")
|
|
6229
|
-
};
|
|
6230
|
-
} catch (error) {
|
|
6231
|
-
if (shouldSkipIgnoreFileError(error, suppressErrors)) return;
|
|
6232
|
-
throw createIgnoreFileReadError(filePath, error);
|
|
6233
|
-
}
|
|
6064
|
+
const createReadError = (kind, filePath, error) => {
|
|
6065
|
+
const prefix = `Failed to read ${kind} at ${filePath}`;
|
|
6066
|
+
if (error instanceof Error) return new Error(`${prefix}: ${error.message}`, { cause: error });
|
|
6067
|
+
return /* @__PURE__ */ new Error(`${prefix}: ${String(error)}`);
|
|
6234
6068
|
};
|
|
6069
|
+
const createIgnoreFileReadError = (filePath, error) => createReadError("ignore file", filePath, error);
|
|
6070
|
+
const createGitConfigReadError = (filePath, error) => createReadError("git config", filePath, error);
|
|
6235
6071
|
const readIgnoreFilesSafely = async (paths, readFileMethod, suppressErrors) => {
|
|
6236
6072
|
return (await Promise.all(paths.map(async (filePath) => {
|
|
6237
6073
|
try {
|
|
@@ -6245,7 +6081,6 @@ const readIgnoreFilesSafely = async (paths, readFileMethod, suppressErrors) => {
|
|
|
6245
6081
|
}
|
|
6246
6082
|
}))).filter(Boolean);
|
|
6247
6083
|
};
|
|
6248
|
-
const readIgnoreFilesSafelySync = (paths, readFileSyncMethod, suppressErrors) => paths.map((filePath) => processIgnoreFileCore(filePath, readFileSyncMethod, suppressErrors)).filter(Boolean);
|
|
6249
6084
|
const dedupePaths = (paths) => {
|
|
6250
6085
|
const seen = /* @__PURE__ */ new Set();
|
|
6251
6086
|
return paths.filter((filePath) => {
|
|
@@ -6263,9 +6098,11 @@ const combineIgnoreFilePaths = (gitRoot, normalizedOptions, childPaths) => dedup
|
|
|
6263
6098
|
const buildIgnoreResult = (files, normalizedOptions, gitRoot) => {
|
|
6264
6099
|
const baseDir = gitRoot || normalizedOptions.cwd;
|
|
6265
6100
|
const patterns = getPatternsFromIgnoreFiles(files, baseDir);
|
|
6101
|
+
const matcher = createIgnoreMatcher(patterns, normalizedOptions.cwd, baseDir);
|
|
6266
6102
|
return {
|
|
6267
6103
|
patterns,
|
|
6268
|
-
|
|
6104
|
+
matcher,
|
|
6105
|
+
predicate: (fileOrDirectory) => matcher(fileOrDirectory).ignored,
|
|
6269
6106
|
usingGitRoot: Boolean(gitRoot && gitRoot !== normalizedOptions.cwd)
|
|
6270
6107
|
};
|
|
6271
6108
|
};
|
|
@@ -6276,18 +6113,18 @@ const applyBaseToPattern = (pattern, base) => {
|
|
|
6276
6113
|
const slashIndex = cleanPattern.indexOf("/");
|
|
6277
6114
|
const hasNonTrailingSlash = slashIndex !== -1 && slashIndex !== cleanPattern.length - 1;
|
|
6278
6115
|
let result;
|
|
6279
|
-
if (!hasNonTrailingSlash) result =
|
|
6280
|
-
else if (cleanPattern.startsWith("/")) result =
|
|
6281
|
-
else result =
|
|
6116
|
+
if (!hasNonTrailingSlash) result = path.posix.join(base, "**", cleanPattern);
|
|
6117
|
+
else if (cleanPattern.startsWith("/")) result = path.posix.join(base, cleanPattern.slice(1));
|
|
6118
|
+
else result = path.posix.join(base, cleanPattern);
|
|
6282
6119
|
return isNegative ? "!" + result : result;
|
|
6283
6120
|
};
|
|
6284
6121
|
const parseIgnoreFile = (file, cwd) => {
|
|
6285
|
-
const base = slash(
|
|
6122
|
+
const base = slash(path.relative(cwd, path.dirname(file.filePath)));
|
|
6286
6123
|
return file.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
|
|
6287
6124
|
};
|
|
6288
6125
|
const toRelativePath = (fileOrDirectory, cwd) => {
|
|
6289
|
-
if (
|
|
6290
|
-
const relativePath =
|
|
6126
|
+
if (path.isAbsolute(fileOrDirectory)) {
|
|
6127
|
+
const relativePath = path.relative(cwd, fileOrDirectory);
|
|
6291
6128
|
if (relativePath && !isPathInside(fileOrDirectory, cwd)) return;
|
|
6292
6129
|
return relativePath;
|
|
6293
6130
|
}
|
|
@@ -6295,16 +6132,23 @@ const toRelativePath = (fileOrDirectory, cwd) => {
|
|
|
6295
6132
|
if (fileOrDirectory.startsWith("../")) return;
|
|
6296
6133
|
return fileOrDirectory;
|
|
6297
6134
|
};
|
|
6298
|
-
const
|
|
6135
|
+
const notIgnored = {
|
|
6136
|
+
ignored: false,
|
|
6137
|
+
unignored: false
|
|
6138
|
+
};
|
|
6139
|
+
const createIgnoreMatcher = (patterns, cwd, baseDir) => {
|
|
6299
6140
|
const ignores = (0, import_ignore.default)().add(patterns);
|
|
6300
|
-
const resolvedCwd =
|
|
6301
|
-
const resolvedBaseDir =
|
|
6141
|
+
const resolvedCwd = path.normalize(path.resolve(cwd));
|
|
6142
|
+
const resolvedBaseDir = path.normalize(path.resolve(baseDir));
|
|
6302
6143
|
return (fileOrDirectory) => {
|
|
6303
6144
|
fileOrDirectory = toPath(fileOrDirectory);
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6145
|
+
const hasTrailingSeparator = /[/\\]$/.test(fileOrDirectory);
|
|
6146
|
+
if (path.normalize(path.resolve(fileOrDirectory)) === resolvedCwd) return notIgnored;
|
|
6147
|
+
let relativePath = toRelativePath(fileOrDirectory, resolvedBaseDir);
|
|
6148
|
+
if (relativePath === void 0) return notIgnored;
|
|
6149
|
+
if (!relativePath) return notIgnored;
|
|
6150
|
+
if (hasTrailingSeparator && !relativePath.endsWith(path.sep)) relativePath += path.sep;
|
|
6151
|
+
return ignores.test(slash(relativePath));
|
|
6308
6152
|
};
|
|
6309
6153
|
};
|
|
6310
6154
|
const normalizeOptions$1 = (options = {}) => {
|
|
@@ -6322,6 +6166,273 @@ const normalizeOptions$1 = (options = {}) => {
|
|
|
6322
6166
|
fs: options.fs
|
|
6323
6167
|
};
|
|
6324
6168
|
};
|
|
6169
|
+
const unescapeGitQuotedValue = (value) => value.replaceAll(/\\(["\\abfnrtv])/g, (_match, escapedCharacter) => {
|
|
6170
|
+
switch (escapedCharacter) {
|
|
6171
|
+
case "a": return "\x07";
|
|
6172
|
+
case "b": return "\b";
|
|
6173
|
+
case "f": return "\f";
|
|
6174
|
+
case "n": return "\n";
|
|
6175
|
+
case "r": return "\r";
|
|
6176
|
+
case "t": return " ";
|
|
6177
|
+
case "v": return "\v";
|
|
6178
|
+
default: return escapedCharacter;
|
|
6179
|
+
}
|
|
6180
|
+
});
|
|
6181
|
+
const parseGitConfigValue = (value) => {
|
|
6182
|
+
const trimmedValue = value.trim();
|
|
6183
|
+
const quotedMatch = trimmedValue.match(/^"((?:[^"\\]|\\.)*)"\s*(?:[#;].*)?$/);
|
|
6184
|
+
if (quotedMatch) return unescapeGitQuotedValue(quotedMatch[1]);
|
|
6185
|
+
return trimmedValue.replace(/\s[#;].*$/, "").trim();
|
|
6186
|
+
};
|
|
6187
|
+
const resolveConfigPath = (filePath, configPath) => {
|
|
6188
|
+
if (configPath.startsWith("~/")) {
|
|
6189
|
+
const homeDirectory = os.homedir();
|
|
6190
|
+
const resolved = path.join(homeDirectory, configPath.slice(2));
|
|
6191
|
+
if (!isPathInside(resolved, homeDirectory)) return path.join(homeDirectory, ".globby-invalid-path-traversal");
|
|
6192
|
+
return resolved;
|
|
6193
|
+
}
|
|
6194
|
+
if (path.isAbsolute(configPath)) return configPath;
|
|
6195
|
+
return path.resolve(path.dirname(filePath), configPath);
|
|
6196
|
+
};
|
|
6197
|
+
const parseGitConfigSection = (line) => {
|
|
6198
|
+
if (!line.startsWith("[")) return;
|
|
6199
|
+
let inQuotes = false;
|
|
6200
|
+
let isEscaped = false;
|
|
6201
|
+
for (let index = 1; index < line.length; index++) {
|
|
6202
|
+
const character = line[index];
|
|
6203
|
+
if (isEscaped) {
|
|
6204
|
+
isEscaped = false;
|
|
6205
|
+
continue;
|
|
6206
|
+
}
|
|
6207
|
+
if (character === "\\") {
|
|
6208
|
+
isEscaped = true;
|
|
6209
|
+
continue;
|
|
6210
|
+
}
|
|
6211
|
+
if (character === "\"") {
|
|
6212
|
+
inQuotes = !inQuotes;
|
|
6213
|
+
continue;
|
|
6214
|
+
}
|
|
6215
|
+
if (character === "]" && !inQuotes) {
|
|
6216
|
+
const remainder = line.slice(index + 1).trimStart();
|
|
6217
|
+
if (remainder && !remainder.startsWith("#") && !remainder.startsWith(";")) return;
|
|
6218
|
+
return line.slice(1, index).trim();
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
};
|
|
6222
|
+
const parseGitConfigEntry = (line) => {
|
|
6223
|
+
const match = line.match(/^([A-Za-z\d-.]+)\s*=\s*(.*)$/);
|
|
6224
|
+
if (!match) return;
|
|
6225
|
+
return {
|
|
6226
|
+
key: match[1].toLowerCase(),
|
|
6227
|
+
value: parseGitConfigValue(match[2])
|
|
6228
|
+
};
|
|
6229
|
+
};
|
|
6230
|
+
const parseIncludeIfCondition = (section) => {
|
|
6231
|
+
if (!section) return;
|
|
6232
|
+
const match = section.match(/^includeif\s+"([^"]+)"$/i);
|
|
6233
|
+
return match ? match[1] : void 0;
|
|
6234
|
+
};
|
|
6235
|
+
const normalizeGitConfigConditionPattern = (pattern, configFilePath) => {
|
|
6236
|
+
if (pattern.startsWith("~/")) pattern = path.join(os.homedir(), pattern.slice(2));
|
|
6237
|
+
else if (pattern.startsWith("./")) pattern = path.resolve(path.dirname(configFilePath), pattern.slice(2));
|
|
6238
|
+
else if (!path.isAbsolute(pattern)) pattern = `**/${pattern}`;
|
|
6239
|
+
if (pattern.endsWith("/")) pattern += "**";
|
|
6240
|
+
return slash(pattern);
|
|
6241
|
+
};
|
|
6242
|
+
const gitConfigGlobToRegex = (pattern, flags) => {
|
|
6243
|
+
let regex = "";
|
|
6244
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
6245
|
+
const character = pattern[index];
|
|
6246
|
+
const nextCharacter = pattern[index + 1];
|
|
6247
|
+
const nextNextCharacter = pattern[index + 2];
|
|
6248
|
+
if (character === "*" && nextCharacter === "*" && nextNextCharacter === "/") {
|
|
6249
|
+
regex += "(?:.*/)?";
|
|
6250
|
+
index += 2;
|
|
6251
|
+
continue;
|
|
6252
|
+
}
|
|
6253
|
+
if (character === "*" && nextCharacter === "*") {
|
|
6254
|
+
regex += ".*";
|
|
6255
|
+
index += 1;
|
|
6256
|
+
continue;
|
|
6257
|
+
}
|
|
6258
|
+
if (character === "*") {
|
|
6259
|
+
regex += "[^/]*";
|
|
6260
|
+
continue;
|
|
6261
|
+
}
|
|
6262
|
+
if (character === "?") {
|
|
6263
|
+
regex += "[^/]";
|
|
6264
|
+
continue;
|
|
6265
|
+
}
|
|
6266
|
+
if (character === "[") {
|
|
6267
|
+
const closingBracketIndex = pattern.indexOf("]", index + 1);
|
|
6268
|
+
if (closingBracketIndex !== -1) {
|
|
6269
|
+
const bracketContent = pattern.slice(index + 1, closingBracketIndex);
|
|
6270
|
+
if (bracketContent) {
|
|
6271
|
+
const negatedBracketContent = bracketContent[0] === "!" ? `^${bracketContent.slice(1)}` : bracketContent;
|
|
6272
|
+
regex += `[${negatedBracketContent}]`;
|
|
6273
|
+
index = closingBracketIndex;
|
|
6274
|
+
continue;
|
|
6275
|
+
}
|
|
6276
|
+
}
|
|
6277
|
+
}
|
|
6278
|
+
regex += /[|\\{}()[\]^$+?.]/.test(character) ? `\\${character}` : character;
|
|
6279
|
+
}
|
|
6280
|
+
try {
|
|
6281
|
+
return new RegExp(`^${regex}$`, flags);
|
|
6282
|
+
} catch {
|
|
6283
|
+
return /(?!)/;
|
|
6284
|
+
}
|
|
6285
|
+
};
|
|
6286
|
+
const matchesIncludeIfCondition = (condition, gitDirectory, configFilePath) => {
|
|
6287
|
+
if (!gitDirectory) return false;
|
|
6288
|
+
const match = condition.match(/^(gitdir|gitdir\/i):(.*)$/i);
|
|
6289
|
+
if (!match) return false;
|
|
6290
|
+
const [, keyword, rawPattern] = match;
|
|
6291
|
+
const regularExpression = gitConfigGlobToRegex(normalizeGitConfigConditionPattern(rawPattern.trim(), configFilePath), keyword.toLowerCase() === "gitdir/i" ? "i" : void 0);
|
|
6292
|
+
const normalizedGitDirectory = slash(path.resolve(gitDirectory));
|
|
6293
|
+
return regularExpression.test(normalizedGitDirectory);
|
|
6294
|
+
};
|
|
6295
|
+
const shouldIncludeConfigSection = (section, gitDirectory, configFilePath) => {
|
|
6296
|
+
if (section?.toLowerCase() === "include") return true;
|
|
6297
|
+
const condition = parseIncludeIfCondition(section);
|
|
6298
|
+
return condition ? matchesIncludeIfCondition(condition, gitDirectory, configFilePath) : false;
|
|
6299
|
+
};
|
|
6300
|
+
const createExcludesFileValue = (value, declaringFilePath) => ({
|
|
6301
|
+
value,
|
|
6302
|
+
declaringFilePath
|
|
6303
|
+
});
|
|
6304
|
+
/**
|
|
6305
|
+
Parse git config content and return the excludesFile value and any include paths to recurse into.
|
|
6306
|
+
The caller is responsible for reading files and recursing (sync or async).
|
|
6307
|
+
*/
|
|
6308
|
+
const parseGitConfigForExcludesFile = (content, normalizedPath, gitDirectory) => {
|
|
6309
|
+
let currentSection;
|
|
6310
|
+
let excludesFile;
|
|
6311
|
+
const includePaths = [];
|
|
6312
|
+
for (const line of content.split(/\r?\n/)) {
|
|
6313
|
+
const trimmed = line.trim();
|
|
6314
|
+
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith(";")) continue;
|
|
6315
|
+
if (trimmed.startsWith("[")) {
|
|
6316
|
+
currentSection = parseGitConfigSection(trimmed);
|
|
6317
|
+
continue;
|
|
6318
|
+
}
|
|
6319
|
+
const entry = parseGitConfigEntry(trimmed);
|
|
6320
|
+
if (!entry) continue;
|
|
6321
|
+
if (currentSection?.toLowerCase() === "core" && entry.key === "excludesfile") {
|
|
6322
|
+
excludesFile = createExcludesFileValue(entry.value, normalizedPath);
|
|
6323
|
+
continue;
|
|
6324
|
+
}
|
|
6325
|
+
if (shouldIncludeConfigSection(currentSection, gitDirectory, normalizedPath) && entry.key === "path" && entry.value) includePaths.push(resolveConfigPath(normalizedPath, entry.value));
|
|
6326
|
+
}
|
|
6327
|
+
return {
|
|
6328
|
+
excludesFile,
|
|
6329
|
+
includePaths
|
|
6330
|
+
};
|
|
6331
|
+
};
|
|
6332
|
+
const readGitConfigFile = (normalizedPath, readMethod, suppressErrors) => {
|
|
6333
|
+
try {
|
|
6334
|
+
return readMethod(normalizedPath, "utf8");
|
|
6335
|
+
} catch (error) {
|
|
6336
|
+
if (shouldSkipIgnoreFileError(error, suppressErrors)) return;
|
|
6337
|
+
throw createGitConfigReadError(normalizedPath, error);
|
|
6338
|
+
}
|
|
6339
|
+
};
|
|
6340
|
+
const getExcludesFileFromGitConfigSync = (filePath, readFileSync, gitDirectory, options = {}) => {
|
|
6341
|
+
const { suppressErrors, includeStack = /* @__PURE__ */ new Set(), depth = 0 } = options;
|
|
6342
|
+
const normalizedPath = path.resolve(filePath);
|
|
6343
|
+
if (includeStack.has(normalizedPath)) return;
|
|
6344
|
+
if (depth >= MAX_INCLUDE_DEPTH) return;
|
|
6345
|
+
includeStack.add(normalizedPath);
|
|
6346
|
+
const content = readGitConfigFile(normalizedPath, readFileSync, suppressErrors);
|
|
6347
|
+
if (content === void 0) {
|
|
6348
|
+
includeStack.delete(normalizedPath);
|
|
6349
|
+
return;
|
|
6350
|
+
}
|
|
6351
|
+
let { excludesFile, includePaths } = parseGitConfigForExcludesFile(content, normalizedPath, gitDirectory);
|
|
6352
|
+
for (const includePath of includePaths) {
|
|
6353
|
+
const includedExcludesFile = getExcludesFileFromGitConfigSync(includePath, readFileSync, gitDirectory, {
|
|
6354
|
+
suppressErrors,
|
|
6355
|
+
includeStack,
|
|
6356
|
+
depth: depth + 1
|
|
6357
|
+
});
|
|
6358
|
+
if (includedExcludesFile !== void 0) excludesFile = includedExcludesFile;
|
|
6359
|
+
}
|
|
6360
|
+
includeStack.delete(normalizedPath);
|
|
6361
|
+
return excludesFile;
|
|
6362
|
+
};
|
|
6363
|
+
const getExcludesFileFromGitConfigAsync = async (filePath, readFile, gitDirectory, options = {}) => {
|
|
6364
|
+
const { suppressErrors, includeStack = /* @__PURE__ */ new Set(), depth = 0 } = options;
|
|
6365
|
+
const normalizedPath = path.resolve(filePath);
|
|
6366
|
+
if (includeStack.has(normalizedPath)) return;
|
|
6367
|
+
if (depth >= MAX_INCLUDE_DEPTH) return;
|
|
6368
|
+
includeStack.add(normalizedPath);
|
|
6369
|
+
let content;
|
|
6370
|
+
try {
|
|
6371
|
+
content = await readFile(normalizedPath, "utf8");
|
|
6372
|
+
} catch (error) {
|
|
6373
|
+
includeStack.delete(normalizedPath);
|
|
6374
|
+
if (shouldSkipIgnoreFileError(error, suppressErrors)) return;
|
|
6375
|
+
throw createGitConfigReadError(normalizedPath, error);
|
|
6376
|
+
}
|
|
6377
|
+
let { excludesFile, includePaths } = parseGitConfigForExcludesFile(content, normalizedPath, gitDirectory);
|
|
6378
|
+
for (const includePath of includePaths) {
|
|
6379
|
+
const includedExcludesFile = await getExcludesFileFromGitConfigAsync(includePath, readFile, gitDirectory, {
|
|
6380
|
+
suppressErrors,
|
|
6381
|
+
includeStack,
|
|
6382
|
+
depth: depth + 1
|
|
6383
|
+
});
|
|
6384
|
+
if (includedExcludesFile !== void 0) excludesFile = includedExcludesFile;
|
|
6385
|
+
}
|
|
6386
|
+
includeStack.delete(normalizedPath);
|
|
6387
|
+
return excludesFile;
|
|
6388
|
+
};
|
|
6389
|
+
const resolveGitDirectoryFromFile = (gitFilePath, content) => {
|
|
6390
|
+
const match = content.match(/^gitdir:\s*(.+?)\s*$/i);
|
|
6391
|
+
if (!match) return gitFilePath;
|
|
6392
|
+
return path.resolve(path.dirname(gitFilePath), match[1]);
|
|
6393
|
+
};
|
|
6394
|
+
const getGitDirectoryAsync = async (gitRoot, readFile) => {
|
|
6395
|
+
if (!gitRoot) return;
|
|
6396
|
+
const gitFilePath = path.join(gitRoot, ".git");
|
|
6397
|
+
try {
|
|
6398
|
+
return resolveGitDirectoryFromFile(gitFilePath, await readFile(gitFilePath, "utf8"));
|
|
6399
|
+
} catch {
|
|
6400
|
+
return gitFilePath;
|
|
6401
|
+
}
|
|
6402
|
+
};
|
|
6403
|
+
const getXdgConfigHome = () => process$1.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config");
|
|
6404
|
+
const getGitConfigPaths = () => {
|
|
6405
|
+
if ("GIT_CONFIG_GLOBAL" in process$1.env) {
|
|
6406
|
+
const value = process$1.env.GIT_CONFIG_GLOBAL;
|
|
6407
|
+
return value ? [value] : [];
|
|
6408
|
+
}
|
|
6409
|
+
return [path.join(getXdgConfigHome(), "git", "config"), path.join(os.homedir(), ".gitconfig")];
|
|
6410
|
+
};
|
|
6411
|
+
const getDefaultGlobalGitignorePath = () => path.join(getXdgConfigHome(), "git", "ignore");
|
|
6412
|
+
const resolveExcludesFilePath = (excludesFileConfig) => {
|
|
6413
|
+
if (excludesFileConfig?.value === "") return;
|
|
6414
|
+
if (excludesFileConfig === void 0) return getDefaultGlobalGitignorePath();
|
|
6415
|
+
return resolveConfigPath(excludesFileConfig.declaringFilePath, excludesFileConfig.value);
|
|
6416
|
+
};
|
|
6417
|
+
const getGlobalGitignoreFileAsync = async (options = {}) => {
|
|
6418
|
+
const cwd = toPath(options.cwd) ?? process$1.cwd();
|
|
6419
|
+
const readFile = getReadFileMethod(options.fs);
|
|
6420
|
+
const gitDirectory = await getGitDirectoryAsync(await findGitRoot(cwd, options.fs), readFile);
|
|
6421
|
+
const filePath = resolveExcludesFilePath((await Promise.all(getGitConfigPaths().map((gitConfigPath) => getExcludesFileFromGitConfigAsync(gitConfigPath, readFile, gitDirectory, { suppressErrors: options.suppressErrors })))).findLast((value) => value !== void 0));
|
|
6422
|
+
if (filePath === void 0) return;
|
|
6423
|
+
try {
|
|
6424
|
+
return {
|
|
6425
|
+
filePath,
|
|
6426
|
+
content: await readFile(filePath, "utf8")
|
|
6427
|
+
};
|
|
6428
|
+
} catch (error) {
|
|
6429
|
+
if (shouldSkipIgnoreFileError(error, options.suppressErrors)) return;
|
|
6430
|
+
throw createIgnoreFileReadError(filePath, error);
|
|
6431
|
+
}
|
|
6432
|
+
};
|
|
6433
|
+
const buildGlobalMatcher = (globalIgnoreFile, cwd, rootDirectory = cwd) => {
|
|
6434
|
+
return createIgnoreMatcher(parseIgnoreFile(globalIgnoreFile, path.dirname(globalIgnoreFile.filePath)), cwd, rootDirectory);
|
|
6435
|
+
};
|
|
6325
6436
|
const collectIgnoreFileArtifactsAsync = async (patterns, options, includeParentIgnoreFiles) => {
|
|
6326
6437
|
const normalizedOptions = normalizeOptions$1(options);
|
|
6327
6438
|
const childPaths = await globIgnoreFiles(import_out.default, patterns, normalizedOptions);
|
|
@@ -6332,16 +6443,6 @@ const collectIgnoreFileArtifactsAsync = async (patterns, options, includeParentI
|
|
|
6332
6443
|
gitRoot
|
|
6333
6444
|
};
|
|
6334
6445
|
};
|
|
6335
|
-
const collectIgnoreFileArtifactsSync = (patterns, options, includeParentIgnoreFiles) => {
|
|
6336
|
-
const normalizedOptions = normalizeOptions$1(options);
|
|
6337
|
-
const childPaths = globIgnoreFiles(import_out.default.sync, patterns, normalizedOptions);
|
|
6338
|
-
const gitRoot = includeParentIgnoreFiles ? findGitRootSync(normalizedOptions.cwd, normalizedOptions.fs) : void 0;
|
|
6339
|
-
return {
|
|
6340
|
-
files: readIgnoreFilesSafelySync(combineIgnoreFilePaths(gitRoot, normalizedOptions, childPaths), getReadFileSyncMethod(normalizedOptions.fs), normalizedOptions.suppressErrors),
|
|
6341
|
-
normalizedOptions,
|
|
6342
|
-
gitRoot
|
|
6343
|
-
};
|
|
6344
|
-
};
|
|
6345
6446
|
const getPatternsFromIgnoreFiles = (files, baseDir) => files.flatMap((file) => parseIgnoreFile(file, baseDir));
|
|
6346
6447
|
/**
|
|
6347
6448
|
Read ignore files and return both patterns and predicate.
|
|
@@ -6350,31 +6451,21 @@ This avoids reading the same files twice (once for patterns, once for filtering)
|
|
|
6350
6451
|
@param {string[]} patterns - Patterns to find ignore files
|
|
6351
6452
|
@param {Object} options - Options object
|
|
6352
6453
|
@param {boolean} [includeParentIgnoreFiles=false] - Whether to search for parent .gitignore files
|
|
6353
|
-
@returns {Promise<{patterns: string[], predicate: Function, usingGitRoot: boolean}>}
|
|
6454
|
+
@returns {Promise<{patterns: string[], matcher: Function, predicate: Function, usingGitRoot: boolean}>}
|
|
6354
6455
|
*/
|
|
6355
6456
|
const getIgnorePatternsAndPredicate = async (patterns, options, includeParentIgnoreFiles = false) => {
|
|
6356
6457
|
const { files, normalizedOptions, gitRoot } = await collectIgnoreFileArtifactsAsync(patterns, options, includeParentIgnoreFiles);
|
|
6357
6458
|
return buildIgnoreResult(files, normalizedOptions, gitRoot);
|
|
6358
6459
|
};
|
|
6359
|
-
/**
|
|
6360
|
-
Read ignore files and return both patterns and predicate (sync version).
|
|
6361
|
-
|
|
6362
|
-
@param {string[]} patterns - Patterns to find ignore files
|
|
6363
|
-
@param {Object} options - Options object
|
|
6364
|
-
@param {boolean} [includeParentIgnoreFiles=false] - Whether to search for parent .gitignore files
|
|
6365
|
-
@returns {{patterns: string[], predicate: Function, usingGitRoot: boolean}}
|
|
6366
|
-
*/
|
|
6367
|
-
const getIgnorePatternsAndPredicateSync = (patterns, options, includeParentIgnoreFiles = false) => {
|
|
6368
|
-
const { files, normalizedOptions, gitRoot } = collectIgnoreFileArtifactsSync(patterns, options, includeParentIgnoreFiles);
|
|
6369
|
-
return buildIgnoreResult(files, normalizedOptions, gitRoot);
|
|
6370
|
-
};
|
|
6371
6460
|
//#endregion
|
|
6372
|
-
//#region ../../node_modules/.pnpm/globby@16.
|
|
6461
|
+
//#region ../../node_modules/.pnpm/globby@16.2.0/node_modules/globby/index.js
|
|
6373
6462
|
const assertPatternsInput = (patterns) => {
|
|
6374
6463
|
if (patterns.some((pattern) => typeof pattern !== "string")) throw new TypeError("Patterns must be a string or an array of strings");
|
|
6375
6464
|
};
|
|
6376
|
-
const getStatMethod = (fsImplementation) =>
|
|
6377
|
-
|
|
6465
|
+
const getStatMethod = (fsImplementation) => {
|
|
6466
|
+
if (fsImplementation) return bindFsMethod(fsImplementation.promises, "stat") ?? promisifyFsMethod(fsImplementation, "stat");
|
|
6467
|
+
return bindFsMethod(fs.promises, "stat");
|
|
6468
|
+
};
|
|
6378
6469
|
const isDirectory = async (path, fsImplementation) => {
|
|
6379
6470
|
try {
|
|
6380
6471
|
return (await getStatMethod(fsImplementation)(path)).isDirectory();
|
|
@@ -6382,28 +6473,21 @@ const isDirectory = async (path, fsImplementation) => {
|
|
|
6382
6473
|
return false;
|
|
6383
6474
|
}
|
|
6384
6475
|
};
|
|
6385
|
-
const isDirectorySync = (path, fsImplementation) => {
|
|
6386
|
-
try {
|
|
6387
|
-
return getStatSyncMethod(fsImplementation)(path).isDirectory();
|
|
6388
|
-
} catch {
|
|
6389
|
-
return false;
|
|
6390
|
-
}
|
|
6391
|
-
};
|
|
6392
6476
|
const normalizePathForDirectoryGlob = (filePath, cwd) => {
|
|
6393
|
-
const path = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
|
|
6394
|
-
return
|
|
6477
|
+
const path$10 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
|
|
6478
|
+
return path.isAbsolute(path$10) ? path$10 : path.join(cwd, path$10);
|
|
6395
6479
|
};
|
|
6396
6480
|
const shouldExpandGlobstarDirectory = (pattern) => {
|
|
6397
6481
|
const match = pattern?.match(/\*\*\/([^/]+)$/);
|
|
6398
6482
|
if (!match) return false;
|
|
6399
6483
|
const dirname = match[1];
|
|
6400
6484
|
const hasWildcards = /[*?[\]{}]/.test(dirname);
|
|
6401
|
-
const hasExtension =
|
|
6485
|
+
const hasExtension = path.extname(dirname) && !dirname.startsWith(".");
|
|
6402
6486
|
return !hasWildcards && !hasExtension;
|
|
6403
6487
|
};
|
|
6404
6488
|
const getDirectoryGlob = ({ directoryPath, files, extensions }) => {
|
|
6405
6489
|
const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
|
|
6406
|
-
return files ? files.map((file) =>
|
|
6490
|
+
return files ? files.map((file) => path.posix.join(directoryPath, `**/${path.extname(file) ? file : `${file}${extensionGlob}`}`)) : [path.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`)];
|
|
6407
6491
|
};
|
|
6408
6492
|
const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, extensions, fs: fsImplementation } = {}) => {
|
|
6409
6493
|
return (await Promise.all(directoryPaths.map(async (directoryPath) => {
|
|
@@ -6419,18 +6503,6 @@ const directoryToGlob = async (directoryPaths, { cwd = process$1.cwd(), files, e
|
|
|
6419
6503
|
}) : directoryPath;
|
|
6420
6504
|
}))).flat();
|
|
6421
6505
|
};
|
|
6422
|
-
const directoryToGlobSync = (directoryPaths, { cwd = process$1.cwd(), files, extensions, fs: fsImplementation } = {}) => directoryPaths.flatMap((directoryPath) => {
|
|
6423
|
-
if (shouldExpandGlobstarDirectory(isNegativePattern(directoryPath) ? directoryPath.slice(1) : directoryPath)) return getDirectoryGlob({
|
|
6424
|
-
directoryPath,
|
|
6425
|
-
files,
|
|
6426
|
-
extensions
|
|
6427
|
-
});
|
|
6428
|
-
return isDirectorySync(normalizePathForDirectoryGlob(directoryPath, cwd), fsImplementation) ? getDirectoryGlob({
|
|
6429
|
-
directoryPath,
|
|
6430
|
-
files,
|
|
6431
|
-
extensions
|
|
6432
|
-
}) : directoryPath;
|
|
6433
|
-
});
|
|
6434
6506
|
const toPatternsArray = (patterns) => {
|
|
6435
6507
|
patterns = [...new Set([patterns].flat())];
|
|
6436
6508
|
assertPatternsInput(patterns);
|
|
@@ -6458,13 +6530,45 @@ const normalizeOptions = (options = {}) => {
|
|
|
6458
6530
|
return options;
|
|
6459
6531
|
};
|
|
6460
6532
|
const normalizeArguments = (function_) => async (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions(options));
|
|
6461
|
-
const normalizeArgumentsSync = (function_) => (patterns, options) => function_(toPatternsArray(patterns), normalizeOptions(options));
|
|
6462
6533
|
const getIgnoreFilesPatterns = (options) => {
|
|
6463
6534
|
const { ignoreFiles, gitignore } = options;
|
|
6464
6535
|
const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
|
|
6465
6536
|
if (gitignore) patterns.push(GITIGNORE_FILES_PATTERN);
|
|
6466
6537
|
return patterns;
|
|
6467
6538
|
};
|
|
6539
|
+
const isPathIgnored = (matcher, globalMatcher, path) => {
|
|
6540
|
+
const globalResult = globalMatcher ? globalMatcher(path) : void 0;
|
|
6541
|
+
const result = matcher ? matcher(path) : void 0;
|
|
6542
|
+
if (result?.unignored) return false;
|
|
6543
|
+
return Boolean(result?.ignored || globalResult?.ignored);
|
|
6544
|
+
};
|
|
6545
|
+
const hasIgnoredAncestorDirectory = (matcher, globalMatcher, file) => {
|
|
6546
|
+
let currentPath = file;
|
|
6547
|
+
while (true) {
|
|
6548
|
+
const parentDirectory = path.dirname(currentPath);
|
|
6549
|
+
if (parentDirectory === currentPath) return false;
|
|
6550
|
+
if (isPathIgnored(matcher, globalMatcher, `${parentDirectory}${path.sep}`)) return true;
|
|
6551
|
+
currentPath = parentDirectory;
|
|
6552
|
+
}
|
|
6553
|
+
};
|
|
6554
|
+
const combinePredicate = (matcher, globalMatcher) => {
|
|
6555
|
+
if (!matcher && !globalMatcher) return false;
|
|
6556
|
+
return (file) => {
|
|
6557
|
+
if ((matcher ? matcher(file) : void 0)?.unignored) return (globalMatcher ? globalMatcher(file) : void 0)?.ignored && hasIgnoredAncestorDirectory(matcher, globalMatcher, file);
|
|
6558
|
+
return isPathIgnored(matcher, globalMatcher, file);
|
|
6559
|
+
};
|
|
6560
|
+
};
|
|
6561
|
+
const buildIgnoreFilterResult = (options, cwd, { patterns, matcher, usingGitRoot }, globalMatcher, createFilter) => {
|
|
6562
|
+
const finalPredicate = combinePredicate(matcher, globalMatcher);
|
|
6563
|
+
const patternsForFastGlob = convertPatternsForFastGlob(patterns, usingGitRoot, normalizeDirectoryPatternForFastGlob);
|
|
6564
|
+
return {
|
|
6565
|
+
options: {
|
|
6566
|
+
...options,
|
|
6567
|
+
ignore: [...options.ignore, ...patternsForFastGlob]
|
|
6568
|
+
},
|
|
6569
|
+
filter: createFilter(finalPredicate, cwd, options.fs)
|
|
6570
|
+
};
|
|
6571
|
+
};
|
|
6468
6572
|
/**
|
|
6469
6573
|
Apply gitignore patterns to options and return filter predicate.
|
|
6470
6574
|
|
|
@@ -6477,63 +6581,78 @@ All patterns (including negated) are always used in the filter predicate to ensu
|
|
|
6477
6581
|
@returns {Promise<{options: Object, filter: Function}>}
|
|
6478
6582
|
*/
|
|
6479
6583
|
const applyIgnoreFilesAndGetFilter = async (options) => {
|
|
6584
|
+
const cwd = options.cwd ?? process$1.cwd();
|
|
6480
6585
|
const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
|
|
6481
|
-
|
|
6586
|
+
const globalIgnoreFile = options.globalGitignore ? await getGlobalGitignoreFileAsync(options) : void 0;
|
|
6587
|
+
if (ignoreFilesPatterns.length === 0 && !globalIgnoreFile) return {
|
|
6482
6588
|
options,
|
|
6483
|
-
filter:
|
|
6589
|
+
filter: createFilterFunctionAsync(false, cwd, options.fs)
|
|
6484
6590
|
};
|
|
6485
|
-
const
|
|
6486
|
-
const
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
ignore: [...options.ignore, ...patternsForFastGlob]
|
|
6491
|
-
},
|
|
6492
|
-
filter: createFilterFunction(predicate, options.cwd)
|
|
6591
|
+
const includeParentIgnoreFiles = options.gitignore === true;
|
|
6592
|
+
const ignoreResult = ignoreFilesPatterns.length > 0 ? await getIgnorePatternsAndPredicate(ignoreFilesPatterns, options, includeParentIgnoreFiles) : {
|
|
6593
|
+
patterns: [],
|
|
6594
|
+
matcher: false,
|
|
6595
|
+
usingGitRoot: false
|
|
6493
6596
|
};
|
|
6597
|
+
const globalGitRoot = globalIgnoreFile ? await findGitRoot(cwd, options.fs) : void 0;
|
|
6598
|
+
return buildIgnoreFilterResult(options, cwd, ignoreResult, globalIgnoreFile ? buildGlobalMatcher(globalIgnoreFile, cwd, globalGitRoot ?? cwd) : void 0, createFilterFunctionAsync);
|
|
6494
6599
|
};
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
const
|
|
6501
|
-
const
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6600
|
+
const globalGitignoreAsyncStatErrorMessage = "The `globalGitignore` option in `globby()` and `globbyStream()` requires `fs.promises.stat` or `fs.stat` when a custom `fs` is provided.";
|
|
6601
|
+
const assertGlobalGitignoreAsyncSupport = (options) => {
|
|
6602
|
+
if (!options.globalGitignore || !options.fs) return;
|
|
6603
|
+
if (!options.fs.promises?.stat && !options.fs.stat) throw new Error(globalGitignoreAsyncStatErrorMessage);
|
|
6604
|
+
};
|
|
6605
|
+
const createPathResolver = (cwd) => {
|
|
6606
|
+
const basePath = cwd || process$1.cwd();
|
|
6607
|
+
const pathCache = /* @__PURE__ */ new Map();
|
|
6608
|
+
return (pathKey) => {
|
|
6609
|
+
let absolutePath = pathCache.get(pathKey);
|
|
6610
|
+
if (absolutePath === void 0) {
|
|
6611
|
+
if (pathCache.size > 1e4) pathCache.clear();
|
|
6612
|
+
absolutePath = path.isAbsolute(pathKey) ? pathKey : path.resolve(basePath, pathKey);
|
|
6613
|
+
pathCache.set(pathKey, absolutePath);
|
|
6614
|
+
}
|
|
6615
|
+
return absolutePath;
|
|
6505
6616
|
};
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6617
|
+
};
|
|
6618
|
+
const createAsyncDirectoryCheck = (fsMethod) => {
|
|
6619
|
+
const directoryCache = /* @__PURE__ */ new Map();
|
|
6620
|
+
return async (absolutePath) => {
|
|
6621
|
+
let isDirectory = directoryCache.get(absolutePath);
|
|
6622
|
+
if (isDirectory !== void 0) return isDirectory;
|
|
6623
|
+
try {
|
|
6624
|
+
const stats = await fsMethod?.(absolutePath);
|
|
6625
|
+
isDirectory = Boolean(stats?.isDirectory());
|
|
6626
|
+
} catch {
|
|
6627
|
+
isDirectory = false;
|
|
6628
|
+
}
|
|
6629
|
+
if (directoryCache.size > 1e4) directoryCache.clear();
|
|
6630
|
+
directoryCache.set(absolutePath, isDirectory);
|
|
6631
|
+
return isDirectory;
|
|
6632
|
+
};
|
|
6633
|
+
};
|
|
6634
|
+
const createFilterFunctionAsync = (isIgnored, cwd, fsImplementation) => {
|
|
6635
|
+
const resolveAbsolutePath = createPathResolver(cwd);
|
|
6636
|
+
const isDirectoryEntry = createAsyncDirectoryCheck(getStatMethod(fsImplementation));
|
|
6637
|
+
return async (fastGlobResult) => {
|
|
6638
|
+
if (!isIgnored) return true;
|
|
6639
|
+
const absolutePath = resolveAbsolutePath(path.normalize(fastGlobResult.path ?? fastGlobResult));
|
|
6640
|
+
if (isIgnored(absolutePath)) return false;
|
|
6641
|
+
return !(await isDirectoryEntry(absolutePath) && isIgnored(`${absolutePath}${path.sep}`));
|
|
6514
6642
|
};
|
|
6515
6643
|
};
|
|
6516
|
-
const
|
|
6644
|
+
const unionFastGlobResultsAsync = async (results, filter) => {
|
|
6645
|
+
results = results.flat();
|
|
6646
|
+
const matches = await Promise.all(results.map((fastGlobResult) => filter(fastGlobResult)));
|
|
6517
6647
|
const seen = /* @__PURE__ */ new Set();
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
const pathKey = nodePath.normalize(fastGlobResult.path ?? fastGlobResult);
|
|
6648
|
+
return results.filter((fastGlobResult, index) => {
|
|
6649
|
+
if (!matches[index]) return false;
|
|
6650
|
+
const pathKey = path.normalize(fastGlobResult.path ?? fastGlobResult);
|
|
6522
6651
|
if (seen.has(pathKey)) return false;
|
|
6523
|
-
if (isIgnored) {
|
|
6524
|
-
let absolutePath = pathCache.get(pathKey);
|
|
6525
|
-
if (absolutePath === void 0) {
|
|
6526
|
-
absolutePath = nodePath.isAbsolute(pathKey) ? pathKey : nodePath.resolve(basePath, pathKey);
|
|
6527
|
-
pathCache.set(pathKey, absolutePath);
|
|
6528
|
-
if (pathCache.size > 1e4) pathCache.clear();
|
|
6529
|
-
}
|
|
6530
|
-
if (isIgnored(absolutePath)) return false;
|
|
6531
|
-
}
|
|
6532
6652
|
seen.add(pathKey);
|
|
6533
6653
|
return true;
|
|
6534
|
-
};
|
|
6654
|
+
});
|
|
6535
6655
|
};
|
|
6536
|
-
const unionFastGlobResults = (results, filter) => results.flat().filter((fastGlobResult) => filter(fastGlobResult));
|
|
6537
6656
|
const convertNegativePatterns = (patterns, options) => {
|
|
6538
6657
|
if (patterns.length > 0 && patterns.every((pattern) => isNegativePattern(pattern))) {
|
|
6539
6658
|
if (options.expandNegationOnlyPatterns === false) return [];
|
|
@@ -6611,46 +6730,12 @@ const generateTasks = async (patterns, options) => {
|
|
|
6611
6730
|
};
|
|
6612
6731
|
}));
|
|
6613
6732
|
};
|
|
6614
|
-
const generateTasksSync = (patterns, options) => {
|
|
6615
|
-
const globTasks = convertNegativePatterns(patterns, options);
|
|
6616
|
-
const { cwd, expandDirectories, fs: fsImplementation } = options;
|
|
6617
|
-
if (!expandDirectories) return applyParentDirectoryIgnoreAdjustments(globTasks);
|
|
6618
|
-
const directoryToGlobSyncOptions = {
|
|
6619
|
-
...normalizeExpandDirectoriesOption(expandDirectories, cwd),
|
|
6620
|
-
fs: fsImplementation
|
|
6621
|
-
};
|
|
6622
|
-
return globTasks.map((task) => {
|
|
6623
|
-
let { patterns, options } = task;
|
|
6624
|
-
patterns = directoryToGlobSync(patterns, directoryToGlobSyncOptions);
|
|
6625
|
-
options.ignore = directoryToGlobSync(options.ignore, {
|
|
6626
|
-
cwd,
|
|
6627
|
-
fs: fsImplementation
|
|
6628
|
-
});
|
|
6629
|
-
options.ignore = adjustIgnorePatternsForParentDirectories(patterns, options.ignore);
|
|
6630
|
-
return {
|
|
6631
|
-
patterns,
|
|
6632
|
-
options
|
|
6633
|
-
};
|
|
6634
|
-
});
|
|
6635
|
-
};
|
|
6636
6733
|
const globby = normalizeArguments(async (patterns, options) => {
|
|
6734
|
+
assertGlobalGitignoreAsyncSupport(options);
|
|
6637
6735
|
const { options: modifiedOptions, filter } = await applyIgnoreFilesAndGetFilter(options);
|
|
6638
6736
|
const tasks = await generateTasks(patterns, modifiedOptions);
|
|
6639
|
-
return
|
|
6640
|
-
});
|
|
6641
|
-
normalizeArgumentsSync((patterns, options) => {
|
|
6642
|
-
const { options: modifiedOptions, filter } = applyIgnoreFilesAndGetFilterSync(options);
|
|
6643
|
-
return unionFastGlobResults(generateTasksSync(patterns, modifiedOptions).map((task) => import_out.default.sync(task.patterns, task.options)), filter);
|
|
6644
|
-
});
|
|
6645
|
-
normalizeArgumentsSync((patterns, options) => {
|
|
6646
|
-
const { options: modifiedOptions, filter } = applyIgnoreFilesAndGetFilterSync(options);
|
|
6647
|
-
const streams = generateTasksSync(patterns, modifiedOptions).map((task) => import_out.default.stream(task.patterns, task.options));
|
|
6648
|
-
if (streams.length === 0) return Readable.from([]);
|
|
6649
|
-
return mergeStreams(streams).filter((fastGlobResult) => filter(fastGlobResult));
|
|
6737
|
+
return unionFastGlobResultsAsync(await Promise.all(tasks.map((task) => (0, import_out.default)(task.patterns, task.options))), filter);
|
|
6650
6738
|
});
|
|
6651
|
-
normalizeArgumentsSync((patterns, options) => patterns.some((pattern) => import_out.default.isDynamicPattern(pattern, options)));
|
|
6652
|
-
normalizeArguments(generateTasks);
|
|
6653
|
-
normalizeArgumentsSync(generateTasksSync);
|
|
6654
6739
|
const { convertPathToPattern } = import_out.default;
|
|
6655
6740
|
//#endregion
|
|
6656
6741
|
//#region ../../node_modules/.pnpm/jscodeshift@17.3.0/node_modules/jscodeshift/src/utils/intersection.js
|
|
@@ -9822,7 +9907,7 @@ var require_typescript = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9822
9907
|
var require_namedTypes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
9823
9908
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9824
9909
|
exports.namedTypes = void 0;
|
|
9825
|
-
|
|
9910
|
+
exports.namedTypes || (exports.namedTypes = {});
|
|
9826
9911
|
}));
|
|
9827
9912
|
//#endregion
|
|
9828
9913
|
//#region ../../node_modules/.pnpm/ast-types@0.16.1/node_modules/ast-types/lib/main.js
|
|
@@ -12418,6 +12503,7 @@ var require_esprima$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12418
12503
|
var expr = elementName;
|
|
12419
12504
|
qualifiedName = getQualifiedElementName(expr.object) + "." + getQualifiedElementName(expr.property);
|
|
12420
12505
|
break;
|
|
12506
|
+
/* istanbul ignore next */
|
|
12421
12507
|
default: break;
|
|
12422
12508
|
}
|
|
12423
12509
|
return qualifiedName;
|
|
@@ -13087,7 +13173,8 @@ var require_esprima$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13087
13173
|
}();
|
|
13088
13174
|
exports$8.BinaryExpression = function() {
|
|
13089
13175
|
function BinaryExpression(operator, left, right) {
|
|
13090
|
-
|
|
13176
|
+
var logical = operator === "||" || operator === "&&";
|
|
13177
|
+
this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
|
|
13091
13178
|
this.operator = operator;
|
|
13092
13179
|
this.left = left;
|
|
13093
13180
|
this.right = right;
|
|
@@ -21134,6 +21221,13 @@ var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21134
21221
|
* @mixin
|
|
21135
21222
|
*/
|
|
21136
21223
|
const traversalMethods = {
|
|
21224
|
+
/**
|
|
21225
|
+
* Find nodes of a specific type within the nodes of this collection.
|
|
21226
|
+
*
|
|
21227
|
+
* @param {type}
|
|
21228
|
+
* @param {filter}
|
|
21229
|
+
* @return {Collection}
|
|
21230
|
+
*/
|
|
21137
21231
|
find: function(type, filter) {
|
|
21138
21232
|
const paths = [];
|
|
21139
21233
|
const visitorMethodName = "visit" + type;
|
|
@@ -21152,9 +21246,22 @@ var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21152
21246
|
}, this);
|
|
21153
21247
|
return Collection.fromPaths(paths, this, type);
|
|
21154
21248
|
},
|
|
21249
|
+
/**
|
|
21250
|
+
* Returns a collection containing the paths that create the scope of the
|
|
21251
|
+
* currently selected paths. Dedupes the paths.
|
|
21252
|
+
*
|
|
21253
|
+
* @return {Collection}
|
|
21254
|
+
*/
|
|
21155
21255
|
closestScope: function() {
|
|
21156
21256
|
return this.map((path) => path.scope && path.scope.path);
|
|
21157
21257
|
},
|
|
21258
|
+
/**
|
|
21259
|
+
* Traverse the AST up and finds the closest node of the provided type.
|
|
21260
|
+
*
|
|
21261
|
+
* @param {Collection}
|
|
21262
|
+
* @param {filter}
|
|
21263
|
+
* @return {Collection}
|
|
21264
|
+
*/
|
|
21158
21265
|
closest: function(type, filter) {
|
|
21159
21266
|
return this.map(function(path) {
|
|
21160
21267
|
let parent = path.parent;
|
|
@@ -21162,6 +21269,17 @@ var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21162
21269
|
return parent || null;
|
|
21163
21270
|
});
|
|
21164
21271
|
},
|
|
21272
|
+
/**
|
|
21273
|
+
* Finds the declaration for each selected path. Useful for member expressions
|
|
21274
|
+
* or JSXElements. Expects a callback function that maps each path to the name
|
|
21275
|
+
* to look for.
|
|
21276
|
+
*
|
|
21277
|
+
* If the callback returns a falsey value, the element is skipped.
|
|
21278
|
+
*
|
|
21279
|
+
* @param {function} nameGetter
|
|
21280
|
+
*
|
|
21281
|
+
* @return {Collection}
|
|
21282
|
+
*/
|
|
21165
21283
|
getVariableDeclarators: function(nameGetter) {
|
|
21166
21284
|
return this.map(function(path) {
|
|
21167
21285
|
let scope = path.scope;
|
|
@@ -21184,18 +21302,38 @@ var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21184
21302
|
* @mixin
|
|
21185
21303
|
*/
|
|
21186
21304
|
const mutationMethods = {
|
|
21305
|
+
/**
|
|
21306
|
+
* Simply replaces the selected nodes with the provided node. If a function
|
|
21307
|
+
* is provided it is executed for every node and the node is replaced with the
|
|
21308
|
+
* functions return value.
|
|
21309
|
+
*
|
|
21310
|
+
* @param {Node|Array<Node>|function} nodes
|
|
21311
|
+
* @return {Collection}
|
|
21312
|
+
*/
|
|
21187
21313
|
replaceWith: function(nodes) {
|
|
21188
21314
|
return this.forEach(function(path, i) {
|
|
21189
21315
|
const newNodes = typeof nodes === "function" ? nodes.call(path, path, i) : nodes;
|
|
21190
21316
|
path.replace.apply(path, toArray(newNodes));
|
|
21191
21317
|
});
|
|
21192
21318
|
},
|
|
21319
|
+
/**
|
|
21320
|
+
* Inserts a new node before the current one.
|
|
21321
|
+
*
|
|
21322
|
+
* @param {Node|Array<Node>|function} insert
|
|
21323
|
+
* @return {Collection}
|
|
21324
|
+
*/
|
|
21193
21325
|
insertBefore: function(insert) {
|
|
21194
21326
|
return this.forEach(function(path, i) {
|
|
21195
21327
|
const newNodes = typeof insert === "function" ? insert.call(path, path, i) : insert;
|
|
21196
21328
|
path.insertBefore.apply(path, toArray(newNodes));
|
|
21197
21329
|
});
|
|
21198
21330
|
},
|
|
21331
|
+
/**
|
|
21332
|
+
* Inserts a new node after the current one.
|
|
21333
|
+
*
|
|
21334
|
+
* @param {Node|Array<Node>|function} insert
|
|
21335
|
+
* @return {Collection}
|
|
21336
|
+
*/
|
|
21199
21337
|
insertAfter: function(insert) {
|
|
21200
21338
|
return this.forEach(function(path, i) {
|
|
21201
21339
|
const newNodes = typeof insert === "function" ? insert.call(path, path, i) : insert;
|
|
@@ -21233,11 +21371,26 @@ var require_VariableDeclarator = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21233
21371
|
/**
|
|
21234
21372
|
* @mixin
|
|
21235
21373
|
*/
|
|
21236
|
-
const globalMethods = {
|
|
21374
|
+
const globalMethods = {
|
|
21375
|
+
/**
|
|
21376
|
+
* Finds all variable declarators, optionally filtered by name.
|
|
21377
|
+
*
|
|
21378
|
+
* @param {string} name
|
|
21379
|
+
* @return {Collection}
|
|
21380
|
+
*/
|
|
21381
|
+
findVariableDeclarators: function(name) {
|
|
21237
21382
|
const filter = name ? { id: { name } } : null;
|
|
21238
21383
|
return this.find(VariableDeclarator, filter);
|
|
21239
21384
|
} };
|
|
21240
|
-
const filterMethods = {
|
|
21385
|
+
const filterMethods = {
|
|
21386
|
+
/**
|
|
21387
|
+
* Returns a function that returns true if the provided path is a variable
|
|
21388
|
+
* declarator and requires one of the specified module names.
|
|
21389
|
+
*
|
|
21390
|
+
* @param {string|Array} names A module name or an array of module names
|
|
21391
|
+
* @return {Function}
|
|
21392
|
+
*/
|
|
21393
|
+
requiresModule: function(names) {
|
|
21241
21394
|
if (names && !Array.isArray(names)) names = [names];
|
|
21242
21395
|
const requireIdentifier = b.identifier("require");
|
|
21243
21396
|
return function(path) {
|
|
@@ -21249,7 +21402,14 @@ var require_VariableDeclarator = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21249
21402
|
/**
|
|
21250
21403
|
* @mixin
|
|
21251
21404
|
*/
|
|
21252
|
-
const transformMethods = {
|
|
21405
|
+
const transformMethods = {
|
|
21406
|
+
/**
|
|
21407
|
+
* Renames a variable and all its occurrences.
|
|
21408
|
+
*
|
|
21409
|
+
* @param {string} newName
|
|
21410
|
+
* @return {Collection}
|
|
21411
|
+
*/
|
|
21412
|
+
renameTo: function(newName) {
|
|
21253
21413
|
return this.forEach(function(path) {
|
|
21254
21414
|
const oldName = path.value.id.name;
|
|
21255
21415
|
const rootScope = path.scope;
|
|
@@ -21312,10 +21472,25 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21312
21472
|
* @mixin
|
|
21313
21473
|
*/
|
|
21314
21474
|
const globalMethods = {
|
|
21475
|
+
/**
|
|
21476
|
+
* Finds all JSXElements optionally filtered by name
|
|
21477
|
+
*
|
|
21478
|
+
* @param {string} name
|
|
21479
|
+
* @return {Collection}
|
|
21480
|
+
*/
|
|
21315
21481
|
findJSXElements: function(name) {
|
|
21316
21482
|
const nameFilter = name && { openingElement: { name: { name } } };
|
|
21317
21483
|
return this.find(JSXElement, nameFilter);
|
|
21318
21484
|
},
|
|
21485
|
+
/**
|
|
21486
|
+
* Finds all JSXElements by module name. Given
|
|
21487
|
+
*
|
|
21488
|
+
* var Bar = require('Foo');
|
|
21489
|
+
* <Bar />
|
|
21490
|
+
*
|
|
21491
|
+
* findJSXElementsByModuleName('Foo') will find <Bar />, without having to
|
|
21492
|
+
* know the variable name.
|
|
21493
|
+
*/
|
|
21319
21494
|
findJSXElementsByModuleName: function(moduleName) {
|
|
21320
21495
|
assert$1.ok(moduleName && typeof moduleName === "string", "findJSXElementsByModuleName(...) needs a name to look for");
|
|
21321
21496
|
return this.find(types.VariableDeclarator).filter(requiresModule(moduleName)).map(function(path) {
|
|
@@ -21325,6 +21500,12 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21325
21500
|
}
|
|
21326
21501
|
};
|
|
21327
21502
|
const filterMethods = {
|
|
21503
|
+
/**
|
|
21504
|
+
* Filter method for attributes.
|
|
21505
|
+
*
|
|
21506
|
+
* @param {Object} attributeFilter
|
|
21507
|
+
* @return {function}
|
|
21508
|
+
*/
|
|
21328
21509
|
hasAttributes: function(attributeFilter) {
|
|
21329
21510
|
const attributeNames = Object.keys(attributeFilter);
|
|
21330
21511
|
return function filter(path) {
|
|
@@ -21344,6 +21525,12 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21344
21525
|
});
|
|
21345
21526
|
};
|
|
21346
21527
|
},
|
|
21528
|
+
/**
|
|
21529
|
+
* Filter elements which contain a specific child type
|
|
21530
|
+
*
|
|
21531
|
+
* @param {string} name
|
|
21532
|
+
* @return {function}
|
|
21533
|
+
*/
|
|
21347
21534
|
hasChildren: function(name) {
|
|
21348
21535
|
return function filter(path) {
|
|
21349
21536
|
return JSXElement.check(path.value) && path.value.children.some((child) => JSXElement.check(child) && child.openingElement.name.name === name);
|
|
@@ -21354,6 +21541,11 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21354
21541
|
* @mixin
|
|
21355
21542
|
*/
|
|
21356
21543
|
const traversalMethods = {
|
|
21544
|
+
/**
|
|
21545
|
+
* Returns all child nodes, including literals and expressions.
|
|
21546
|
+
*
|
|
21547
|
+
* @return {Collection}
|
|
21548
|
+
*/
|
|
21357
21549
|
childNodes: function() {
|
|
21358
21550
|
const paths = [];
|
|
21359
21551
|
this.forEach(function(path) {
|
|
@@ -21363,6 +21555,11 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21363
21555
|
});
|
|
21364
21556
|
return Collection.fromPaths(paths, this);
|
|
21365
21557
|
},
|
|
21558
|
+
/**
|
|
21559
|
+
* Returns all children that are JSXElements.
|
|
21560
|
+
*
|
|
21561
|
+
* @return {JSXElementCollection}
|
|
21562
|
+
*/
|
|
21366
21563
|
childElements: function() {
|
|
21367
21564
|
const paths = [];
|
|
21368
21565
|
this.forEach(function(path) {
|
|
@@ -21372,6 +21569,11 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21372
21569
|
});
|
|
21373
21570
|
return Collection.fromPaths(paths, this, JSXElement);
|
|
21374
21571
|
},
|
|
21572
|
+
/**
|
|
21573
|
+
* Returns all children that are of jsxElementType.
|
|
21574
|
+
*
|
|
21575
|
+
* @return {Collection<jsxElementType>}
|
|
21576
|
+
*/
|
|
21375
21577
|
childNodesOfType: function(jsxChildElementType) {
|
|
21376
21578
|
const paths = [];
|
|
21377
21579
|
this.forEach(function(path) {
|
|
@@ -21382,7 +21584,15 @@ var require_JSXElement = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21382
21584
|
return Collection.fromPaths(paths, this, jsxChildElementType);
|
|
21383
21585
|
}
|
|
21384
21586
|
};
|
|
21385
|
-
const mappingMethods = {
|
|
21587
|
+
const mappingMethods = {
|
|
21588
|
+
/**
|
|
21589
|
+
* Given a JSXElement, returns its "root" name. E.g. it would return "Foo" for
|
|
21590
|
+
* both <Foo /> and <Foo.Bar />.
|
|
21591
|
+
*
|
|
21592
|
+
* @param {NodePath} path
|
|
21593
|
+
* @return {string}
|
|
21594
|
+
*/
|
|
21595
|
+
getRootName: function(path) {
|
|
21386
21596
|
let name = path.value.openingElement.name;
|
|
21387
21597
|
while (types.JSXMemberExpression.check(name)) name = name.object;
|
|
21388
21598
|
return name && name.name || null;
|
|
@@ -21412,6 +21622,12 @@ var require_ImportDeclaration = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21412
21622
|
const recast = require_main();
|
|
21413
21623
|
const types = recast.types.namedTypes;
|
|
21414
21624
|
const globalMethods = {
|
|
21625
|
+
/**
|
|
21626
|
+
* Inserts an ImportDeclaration at the top of the AST
|
|
21627
|
+
*
|
|
21628
|
+
* @param {string} sourcePath
|
|
21629
|
+
* @param {Array} specifiers
|
|
21630
|
+
*/
|
|
21415
21631
|
insertImportDeclaration: function(sourcePath, specifiers) {
|
|
21416
21632
|
assert.ok(sourcePath && typeof sourcePath === "string", "insertImportDeclaration(...) needs a source path");
|
|
21417
21633
|
assert.ok(specifiers && Array.isArray(specifiers), "insertImportDeclaration(...) needs an array of specifiers");
|
|
@@ -21421,14 +21637,33 @@ var require_ImportDeclaration = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21421
21637
|
if (path.value.type === "Program") path.value.body.unshift(importDeclaration);
|
|
21422
21638
|
});
|
|
21423
21639
|
},
|
|
21640
|
+
/**
|
|
21641
|
+
* Finds all ImportDeclarations optionally filtered by name
|
|
21642
|
+
*
|
|
21643
|
+
* @param {string} sourcePath
|
|
21644
|
+
* @return {Collection}
|
|
21645
|
+
*/
|
|
21424
21646
|
findImportDeclarations: function(sourcePath) {
|
|
21425
21647
|
assert.ok(sourcePath && typeof sourcePath === "string", "findImportDeclarations(...) needs a source path");
|
|
21426
21648
|
return this.find(types.ImportDeclaration, { source: { value: sourcePath } });
|
|
21427
21649
|
},
|
|
21650
|
+
/**
|
|
21651
|
+
* Determines if the collection has an ImportDeclaration with the given sourcePath
|
|
21652
|
+
*
|
|
21653
|
+
* @param {string} sourcePath
|
|
21654
|
+
* @returns {boolean}
|
|
21655
|
+
*/
|
|
21428
21656
|
hasImportDeclaration: function(sourcePath) {
|
|
21429
21657
|
assert.ok(sourcePath && typeof sourcePath === "string", "findImportDeclarations(...) needs a source path");
|
|
21430
21658
|
return this.findImportDeclarations(sourcePath).length > 0;
|
|
21431
21659
|
},
|
|
21660
|
+
/**
|
|
21661
|
+
* Renames all ImportDeclarations with the given name
|
|
21662
|
+
*
|
|
21663
|
+
* @param {string} sourcePath
|
|
21664
|
+
* @param {string} newSourcePath
|
|
21665
|
+
* @return {Collection}
|
|
21666
|
+
*/
|
|
21432
21667
|
renameImportDeclaration: function(sourcePath, newSourcePath) {
|
|
21433
21668
|
assert.ok(sourcePath && typeof sourcePath === "string", "renameImportDeclaration(...) needs a name to look for");
|
|
21434
21669
|
assert.ok(newSourcePath && typeof newSourcePath === "string", "renameImportDeclaration(...) needs a new name to rename to");
|
|
@@ -21704,7 +21939,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21704
21939
|
ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
|
|
21705
21940
|
ParseExpressionExpectsEOF: ({ unexpected }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
|
|
21706
21941
|
};
|
|
21707
|
-
const UnparenthesizedPipeBodyDescriptions = new Set([
|
|
21942
|
+
const UnparenthesizedPipeBodyDescriptions = /* @__PURE__ */ new Set([
|
|
21708
21943
|
"ArrowFunctionExpression",
|
|
21709
21944
|
"AssignmentExpression",
|
|
21710
21945
|
"ConditionalExpression",
|
|
@@ -21781,11 +22016,10 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21781
22016
|
for (const reasonCode of Object.keys(argument)) {
|
|
21782
22017
|
const template = argument[reasonCode];
|
|
21783
22018
|
const _ref = typeof template === "string" ? { message: () => template } : typeof template === "function" ? { message: template } : template, { message } = _ref, rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21784
|
-
const toMessage = typeof message === "string" ? () => message : message;
|
|
21785
22019
|
ParseErrorConstructors[reasonCode] = toParseErrorConstructor(Object.assign({
|
|
21786
22020
|
code: "BABEL_PARSER_SYNTAX_ERROR",
|
|
21787
22021
|
reasonCode,
|
|
21788
|
-
toMessage
|
|
22022
|
+
toMessage: typeof message === "string" ? () => message : message
|
|
21789
22023
|
}, syntaxPlugin ? { syntaxPlugin } : {}, rest));
|
|
21790
22024
|
}
|
|
21791
22025
|
return ParseErrorConstructors;
|
|
@@ -23606,7 +23840,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23606
23840
|
function isIteratorStart(current, next, next2) {
|
|
23607
23841
|
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
23608
23842
|
}
|
|
23609
|
-
const reservedWordLikeSet = new Set([
|
|
23843
|
+
const reservedWordLikeSet = /* @__PURE__ */ new Set([
|
|
23610
23844
|
"break",
|
|
23611
23845
|
"case",
|
|
23612
23846
|
"catch",
|
|
@@ -23812,7 +24046,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23812
24046
|
if (!this.scopeStack[0].declareFunctions.has(id.name)) super.checkLocalExport(id);
|
|
23813
24047
|
}
|
|
23814
24048
|
};
|
|
23815
|
-
const reservedTypes = new Set([
|
|
24049
|
+
const reservedTypes = /* @__PURE__ */ new Set([
|
|
23816
24050
|
"_",
|
|
23817
24051
|
"any",
|
|
23818
24052
|
"bool",
|
|
@@ -26776,7 +27010,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26776
27010
|
return code >= 48 && code <= 57;
|
|
26777
27011
|
};
|
|
26778
27012
|
const forbiddenNumericSeparatorSiblings = {
|
|
26779
|
-
decBinOct: new Set([
|
|
27013
|
+
decBinOct: /* @__PURE__ */ new Set([
|
|
26780
27014
|
46,
|
|
26781
27015
|
66,
|
|
26782
27016
|
69,
|
|
@@ -26786,7 +27020,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26786
27020
|
101,
|
|
26787
27021
|
111
|
|
26788
27022
|
]),
|
|
26789
|
-
hex: new Set([
|
|
27023
|
+
hex: /* @__PURE__ */ new Set([
|
|
26790
27024
|
46,
|
|
26791
27025
|
88,
|
|
26792
27026
|
95,
|
|
@@ -26994,7 +27228,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26994
27228
|
function buildPosition(pos, lineStart, curLine) {
|
|
26995
27229
|
return new Position(curLine, pos - lineStart, pos);
|
|
26996
27230
|
}
|
|
26997
|
-
const VALID_REGEX_FLAGS = new Set([
|
|
27231
|
+
const VALID_REGEX_FLAGS = /* @__PURE__ */ new Set([
|
|
26998
27232
|
103,
|
|
26999
27233
|
109,
|
|
27000
27234
|
115,
|
|
@@ -28126,7 +28360,8 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28126
28360
|
const oldInModule = this.inModule;
|
|
28127
28361
|
this.inModule = inModule;
|
|
28128
28362
|
const oldScope = this.scope;
|
|
28129
|
-
|
|
28363
|
+
const ScopeHandler = this.getScopeHandler();
|
|
28364
|
+
this.scope = new ScopeHandler(this, inModule);
|
|
28130
28365
|
const oldProdParam = this.prodParam;
|
|
28131
28366
|
this.prodParam = new ProductionParameterHandler();
|
|
28132
28367
|
const oldClassScope = this.classScope;
|
|
@@ -34840,7 +35075,7 @@ var require_flow_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34840
35075
|
return b;
|
|
34841
35076
|
}
|
|
34842
35077
|
function uY(a) {
|
|
34843
|
-
var b = new Float32Array(1);
|
|
35078
|
+
var b = /* @__PURE__ */ new Float32Array(1);
|
|
34844
35079
|
b[0] = a;
|
|
34845
35080
|
return new Int32Array(b.buffer)[0] | 0;
|
|
34846
35081
|
}
|
|
@@ -34940,7 +35175,7 @@ var require_flow_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34940
35175
|
c[1] = (4 + b.dims.length) * 8;
|
|
34941
35176
|
}
|
|
34942
35177
|
function uZ(a) {
|
|
34943
|
-
var b = new Int32Array(1);
|
|
35178
|
+
var b = /* @__PURE__ */ new Int32Array(1);
|
|
34944
35179
|
b[0] = a;
|
|
34945
35180
|
return new Float32Array(b.buffer)[0];
|
|
34946
35181
|
}
|
|
@@ -36106,7 +36341,7 @@ var require_flow_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36106
36341
|
a.b32[14] = a.len << 3;
|
|
36107
36342
|
a.b32[15] = a.len >> 29 & 536870911;
|
|
36108
36343
|
oA(a.w, a.b32);
|
|
36109
|
-
var e = new Uint8Array(16);
|
|
36344
|
+
var e = /* @__PURE__ */ new Uint8Array(16);
|
|
36110
36345
|
for (var d = 0; d < 4; d++) for (var b = 0; b < 4; b++) e[d * 4 + b] = a.w[d] >> 8 * b & 255;
|
|
36111
36346
|
return e;
|
|
36112
36347
|
}
|
|
@@ -36948,7 +37183,7 @@ var require_flow_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36948
37183
|
function aAQ() {
|
|
36949
37184
|
if (ab.crypto) {
|
|
36950
37185
|
if (ab.crypto.getRandomValues) {
|
|
36951
|
-
var a = ab.crypto.getRandomValues(new Int32Array(4));
|
|
37186
|
+
var a = ab.crypto.getRandomValues(/* @__PURE__ */ new Int32Array(4));
|
|
36952
37187
|
return [
|
|
36953
37188
|
0,
|
|
36954
37189
|
a[0],
|
|
@@ -89740,7 +89975,7 @@ function objectGroupBy(items, keyFn) {
|
|
|
89740
89975
|
}
|
|
89741
89976
|
//#endregion
|
|
89742
89977
|
//#region src/codemod/cli.ts
|
|
89743
|
-
const AVAILABLE_TRANSFORMS = new Map([
|
|
89978
|
+
const AVAILABLE_TRANSFORMS = /* @__PURE__ */ new Map([
|
|
89744
89979
|
["import-rewrite", "Rewrites cmdk imports to modern-cmdk/react"],
|
|
89745
89980
|
["data-attrs", "Converts [cmdk-*] selectors to [data-command-*]"],
|
|
89746
89981
|
["forward-ref", "Removes React.forwardRef wrappers (React 19)"],
|