@better-fullstack/template-generator 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +3 -0
- package/dist/browser.mjs +3 -0
- package/dist/core/template-reader.mjs +1 -1
- package/dist/fs-writer.d.mts +1 -1
- package/dist/fs-writer.d.mts.map +1 -1
- package/dist/fs-writer.mjs +12 -1
- package/dist/fs-writer.mjs.map +1 -1
- package/dist/index.d.mts +233 -296
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -77533
- package/dist/index.mjs.map +1 -1
- package/dist/preflight-validation-DCiZp_NU.d.mts +70 -0
- package/dist/preflight-validation-DCiZp_NU.d.mts.map +1 -0
- package/dist/preflight-validation-FOuwVCzR.mjs +81207 -0
- package/dist/preflight-validation-FOuwVCzR.mjs.map +1 -0
- package/dist/{template-reader-Bjn8sWYU.mjs → template-reader-D1uxgWOQ.mjs} +382 -180
- package/dist/template-reader-D1uxgWOQ.mjs.map +1 -0
- package/dist/{types-Dkk8hmmP.d.mts → types-Jq14WnvH.d.mts} +1 -1
- package/dist/{types-Dkk8hmmP.d.mts.map → types-Jq14WnvH.d.mts.map} +1 -1
- package/package.json +12 -5
- package/templates-binary/java-base/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/dist/template-reader-Bjn8sWYU.mjs.map +0 -1
|
@@ -2,9 +2,9 @@ import { dirname, join } from "pathe";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import * as nativeFs
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import * as nativeFs from "fs";
|
|
6
|
+
import { readdir, readdirSync, realpath, realpathSync, stat, statSync } from "fs";
|
|
7
|
+
import { basename, dirname as dirname$1, isAbsolute, normalize as normalize$1, posix, relative, resolve, sep } from "path";
|
|
8
8
|
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
9
9
|
import { createRequire } from "module";
|
|
10
10
|
|
|
@@ -314,28 +314,28 @@ function isBinaryPath(filePath) {
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
//#endregion
|
|
317
|
-
//#region ../../node_modules/.bun/fdir@6.5.0+
|
|
317
|
+
//#region ../../node_modules/.bun/fdir@6.5.0+5b2c60377f53a28e/node_modules/fdir/dist/index.mjs
|
|
318
318
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
319
|
-
function cleanPath(path$
|
|
320
|
-
let normalized = normalize$1(path$
|
|
319
|
+
function cleanPath(path$1) {
|
|
320
|
+
let normalized = normalize$1(path$1);
|
|
321
321
|
if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
322
322
|
return normalized;
|
|
323
323
|
}
|
|
324
324
|
const SLASHES_REGEX = /[\\/]/g;
|
|
325
|
-
function convertSlashes(path$
|
|
326
|
-
return path$
|
|
325
|
+
function convertSlashes(path$1, separator) {
|
|
326
|
+
return path$1.replace(SLASHES_REGEX, separator);
|
|
327
327
|
}
|
|
328
328
|
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
329
|
-
function isRootDirectory(path$
|
|
330
|
-
return path$
|
|
329
|
+
function isRootDirectory(path$1) {
|
|
330
|
+
return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
|
|
331
331
|
}
|
|
332
|
-
function normalizePath(path$
|
|
332
|
+
function normalizePath(path$1, options) {
|
|
333
333
|
const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
|
|
334
|
-
const pathNeedsCleaning = process.platform === "win32" && path$
|
|
335
|
-
if (resolvePaths) path$
|
|
336
|
-
if (normalizePath$1 || pathNeedsCleaning) path$
|
|
337
|
-
if (path$
|
|
338
|
-
return convertSlashes(path$
|
|
334
|
+
const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith(".");
|
|
335
|
+
if (resolvePaths) path$1 = resolve(path$1);
|
|
336
|
+
if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
|
|
337
|
+
if (path$1 === ".") return "";
|
|
338
|
+
return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
|
|
339
339
|
}
|
|
340
340
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
341
341
|
return directoryPath + filename;
|
|
@@ -371,8 +371,8 @@ const pushDirectory = (directoryPath, paths) => {
|
|
|
371
371
|
paths.push(directoryPath || ".");
|
|
372
372
|
};
|
|
373
373
|
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
374
|
-
const path$
|
|
375
|
-
if (filters.every((filter) => filter(path$
|
|
374
|
+
const path$1 = directoryPath || ".";
|
|
375
|
+
if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
|
|
376
376
|
};
|
|
377
377
|
const empty$2 = () => {};
|
|
378
378
|
function build$6(root, options) {
|
|
@@ -421,27 +421,27 @@ const empty = () => {};
|
|
|
421
421
|
function build$3(options) {
|
|
422
422
|
return options.group ? groupFiles : empty;
|
|
423
423
|
}
|
|
424
|
-
const resolveSymlinksAsync = function(path$
|
|
424
|
+
const resolveSymlinksAsync = function(path$1, state, callback$1) {
|
|
425
425
|
const { queue, fs: fs$1, options: { suppressErrors } } = state;
|
|
426
426
|
queue.enqueue();
|
|
427
|
-
fs$1.realpath(path$
|
|
427
|
+
fs$1.realpath(path$1, (error, resolvedPath) => {
|
|
428
428
|
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
429
|
-
fs$1.stat(resolvedPath, (error$1, stat) => {
|
|
429
|
+
fs$1.stat(resolvedPath, (error$1, stat$1) => {
|
|
430
430
|
if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
431
|
-
if (stat.isDirectory() && isRecursive(path$
|
|
432
|
-
callback$1(stat, resolvedPath);
|
|
431
|
+
if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state);
|
|
432
|
+
callback$1(stat$1, resolvedPath);
|
|
433
433
|
queue.dequeue(null, state);
|
|
434
434
|
});
|
|
435
435
|
});
|
|
436
436
|
};
|
|
437
|
-
const resolveSymlinks = function(path$
|
|
437
|
+
const resolveSymlinks = function(path$1, state, callback$1) {
|
|
438
438
|
const { queue, fs: fs$1, options: { suppressErrors } } = state;
|
|
439
439
|
queue.enqueue();
|
|
440
440
|
try {
|
|
441
|
-
const resolvedPath = fs$1.realpathSync(path$
|
|
442
|
-
const stat = fs$1.statSync(resolvedPath);
|
|
443
|
-
if (stat.isDirectory() && isRecursive(path$
|
|
444
|
-
callback$1(stat, resolvedPath);
|
|
441
|
+
const resolvedPath = fs$1.realpathSync(path$1);
|
|
442
|
+
const stat$1 = fs$1.statSync(resolvedPath);
|
|
443
|
+
if (stat$1.isDirectory() && isRecursive(path$1, resolvedPath, state)) return;
|
|
444
|
+
callback$1(stat$1, resolvedPath);
|
|
445
445
|
} catch (e) {
|
|
446
446
|
if (!suppressErrors) throw e;
|
|
447
447
|
}
|
|
@@ -450,16 +450,16 @@ function build$2(options, isSynchronous) {
|
|
|
450
450
|
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
451
451
|
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
452
452
|
}
|
|
453
|
-
function isRecursive(path$
|
|
453
|
+
function isRecursive(path$1, resolved, state) {
|
|
454
454
|
if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
|
|
455
|
-
let parent = dirname$1(path$
|
|
455
|
+
let parent = dirname$1(path$1);
|
|
456
456
|
let depth$1 = 1;
|
|
457
457
|
while (parent !== state.root && depth$1 < 2) {
|
|
458
458
|
const resolvedPath = state.symlinks.get(parent);
|
|
459
459
|
if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth$1++;
|
|
460
460
|
else parent = dirname$1(parent);
|
|
461
461
|
}
|
|
462
|
-
state.symlinks.set(path$
|
|
462
|
+
state.symlinks.set(path$1, resolved);
|
|
463
463
|
return depth$1 > 1;
|
|
464
464
|
}
|
|
465
465
|
function isRecursiveUsingRealPaths(resolved, state) {
|
|
@@ -615,7 +615,7 @@ var Walker = class {
|
|
|
615
615
|
symlinks: /* @__PURE__ */ new Map(),
|
|
616
616
|
visited: [""].slice(0, 0),
|
|
617
617
|
controller: new Aborter(),
|
|
618
|
-
fs: options.fs || nativeFs
|
|
618
|
+
fs: options.fs || nativeFs
|
|
619
619
|
};
|
|
620
620
|
this.joinPath = build$7(this.root, options);
|
|
621
621
|
this.pushDirectory = build$6(this.root, options);
|
|
@@ -640,19 +640,19 @@ var Walker = class {
|
|
|
640
640
|
const filename = this.joinPath(entry.name, directoryPath);
|
|
641
641
|
this.pushFile(filename, files, this.state.counts, filters);
|
|
642
642
|
} else if (entry.isDirectory()) {
|
|
643
|
-
let path$
|
|
644
|
-
if (exclude && exclude(entry.name, path$
|
|
645
|
-
this.pushDirectory(path$
|
|
646
|
-
this.walkDirectory(this.state, path$
|
|
643
|
+
let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
|
|
644
|
+
if (exclude && exclude(entry.name, path$1)) continue;
|
|
645
|
+
this.pushDirectory(path$1, paths, filters);
|
|
646
|
+
this.walkDirectory(this.state, path$1, path$1, depth$1 - 1, this.walk);
|
|
647
647
|
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
648
|
-
let path$
|
|
649
|
-
this.resolveSymlink(path$
|
|
650
|
-
if (stat.isDirectory()) {
|
|
648
|
+
let path$1 = joinPathWithBasePath(entry.name, directoryPath);
|
|
649
|
+
this.resolveSymlink(path$1, this.state, (stat$1, resolvedPath) => {
|
|
650
|
+
if (stat$1.isDirectory()) {
|
|
651
651
|
resolvedPath = normalizePath(resolvedPath, this.state.options);
|
|
652
|
-
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$
|
|
653
|
-
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$
|
|
652
|
+
if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return;
|
|
653
|
+
this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth$1 - 1, this.walk);
|
|
654
654
|
} else {
|
|
655
|
-
resolvedPath = useRealPaths ? resolvedPath : path$
|
|
655
|
+
resolvedPath = useRealPaths ? resolvedPath : path$1;
|
|
656
656
|
const filename = basename(resolvedPath);
|
|
657
657
|
const directoryPath$1 = normalizePath(dirname$1(resolvedPath), this.state.options);
|
|
658
658
|
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
@@ -817,16 +817,17 @@ var Builder = class {
|
|
|
817
817
|
isMatch = globFn(patterns, ...options);
|
|
818
818
|
this.globCache[patterns.join("\0")] = isMatch;
|
|
819
819
|
}
|
|
820
|
-
this.options.filters.push((path$
|
|
820
|
+
this.options.filters.push((path$1) => isMatch(path$1));
|
|
821
821
|
return this;
|
|
822
822
|
}
|
|
823
823
|
};
|
|
824
824
|
|
|
825
825
|
//#endregion
|
|
826
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
826
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
827
827
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
828
828
|
const WIN_SLASH = "\\\\/";
|
|
829
829
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
830
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
830
831
|
/**
|
|
831
832
|
* Posix glob regex
|
|
832
833
|
*/
|
|
@@ -879,6 +880,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
879
880
|
* POSIX Bracket Regex
|
|
880
881
|
*/
|
|
881
882
|
const POSIX_REGEX_SOURCE$1 = {
|
|
883
|
+
__proto__: null,
|
|
882
884
|
alnum: "a-zA-Z0-9",
|
|
883
885
|
alpha: "a-zA-Z",
|
|
884
886
|
ascii: "\\x00-\\x7F",
|
|
@@ -895,6 +897,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
895
897
|
xdigit: "A-Fa-f0-9"
|
|
896
898
|
};
|
|
897
899
|
module.exports = {
|
|
900
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
898
901
|
MAX_LENGTH: 1024 * 64,
|
|
899
902
|
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
900
903
|
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
@@ -988,7 +991,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
988
991
|
}));
|
|
989
992
|
|
|
990
993
|
//#endregion
|
|
991
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
994
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
992
995
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
993
996
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
994
997
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1028,8 +1031,8 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1028
1031
|
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
1029
1032
|
return output;
|
|
1030
1033
|
};
|
|
1031
|
-
exports.basename = (path$
|
|
1032
|
-
const segs = path$
|
|
1034
|
+
exports.basename = (path$1, { windows } = {}) => {
|
|
1035
|
+
const segs = path$1.split(windows ? /[\\/]/ : "/");
|
|
1033
1036
|
const last = segs[segs.length - 1];
|
|
1034
1037
|
if (last === "") return segs[segs.length - 2];
|
|
1035
1038
|
return last;
|
|
@@ -1037,7 +1040,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1037
1040
|
}));
|
|
1038
1041
|
|
|
1039
1042
|
//#endregion
|
|
1040
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
1043
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
1041
1044
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1042
1045
|
const utils$3 = require_utils();
|
|
1043
1046
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
@@ -1325,7 +1328,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1325
1328
|
}));
|
|
1326
1329
|
|
|
1327
1330
|
//#endregion
|
|
1328
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
1331
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
1329
1332
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1330
1333
|
const constants$1 = require_constants();
|
|
1331
1334
|
const utils$2 = require_utils();
|
|
@@ -1353,6 +1356,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1353
1356
|
const syntaxError = (type, char) => {
|
|
1354
1357
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1355
1358
|
};
|
|
1359
|
+
const splitTopLevel = (input) => {
|
|
1360
|
+
const parts = [];
|
|
1361
|
+
let bracket = 0;
|
|
1362
|
+
let paren = 0;
|
|
1363
|
+
let quote = 0;
|
|
1364
|
+
let value = "";
|
|
1365
|
+
let escaped = false;
|
|
1366
|
+
for (const ch of input) {
|
|
1367
|
+
if (escaped === true) {
|
|
1368
|
+
value += ch;
|
|
1369
|
+
escaped = false;
|
|
1370
|
+
continue;
|
|
1371
|
+
}
|
|
1372
|
+
if (ch === "\\") {
|
|
1373
|
+
value += ch;
|
|
1374
|
+
escaped = true;
|
|
1375
|
+
continue;
|
|
1376
|
+
}
|
|
1377
|
+
if (ch === "\"") {
|
|
1378
|
+
quote = quote === 1 ? 0 : 1;
|
|
1379
|
+
value += ch;
|
|
1380
|
+
continue;
|
|
1381
|
+
}
|
|
1382
|
+
if (quote === 0) {
|
|
1383
|
+
if (ch === "[") bracket++;
|
|
1384
|
+
else if (ch === "]" && bracket > 0) bracket--;
|
|
1385
|
+
else if (bracket === 0) {
|
|
1386
|
+
if (ch === "(") paren++;
|
|
1387
|
+
else if (ch === ")" && paren > 0) paren--;
|
|
1388
|
+
else if (ch === "|" && paren === 0) {
|
|
1389
|
+
parts.push(value);
|
|
1390
|
+
value = "";
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
value += ch;
|
|
1396
|
+
}
|
|
1397
|
+
parts.push(value);
|
|
1398
|
+
return parts;
|
|
1399
|
+
};
|
|
1400
|
+
const isPlainBranch = (branch) => {
|
|
1401
|
+
let escaped = false;
|
|
1402
|
+
for (const ch of branch) {
|
|
1403
|
+
if (escaped === true) {
|
|
1404
|
+
escaped = false;
|
|
1405
|
+
continue;
|
|
1406
|
+
}
|
|
1407
|
+
if (ch === "\\") {
|
|
1408
|
+
escaped = true;
|
|
1409
|
+
continue;
|
|
1410
|
+
}
|
|
1411
|
+
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
1412
|
+
}
|
|
1413
|
+
return true;
|
|
1414
|
+
};
|
|
1415
|
+
const normalizeSimpleBranch = (branch) => {
|
|
1416
|
+
let value = branch.trim();
|
|
1417
|
+
let changed = true;
|
|
1418
|
+
while (changed === true) {
|
|
1419
|
+
changed = false;
|
|
1420
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
1421
|
+
value = value.slice(2, -1);
|
|
1422
|
+
changed = true;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
if (!isPlainBranch(value)) return;
|
|
1426
|
+
return value.replace(/\\(.)/g, "$1");
|
|
1427
|
+
};
|
|
1428
|
+
const hasRepeatedCharPrefixOverlap = (branches) => {
|
|
1429
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
1430
|
+
for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
|
|
1431
|
+
const a = values[i];
|
|
1432
|
+
const b = values[j];
|
|
1433
|
+
const char = a[0];
|
|
1434
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
|
|
1435
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
1436
|
+
}
|
|
1437
|
+
return false;
|
|
1438
|
+
};
|
|
1439
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
1440
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
|
|
1441
|
+
let bracket = 0;
|
|
1442
|
+
let paren = 0;
|
|
1443
|
+
let quote = 0;
|
|
1444
|
+
let escaped = false;
|
|
1445
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
1446
|
+
const ch = pattern[i];
|
|
1447
|
+
if (escaped === true) {
|
|
1448
|
+
escaped = false;
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1451
|
+
if (ch === "\\") {
|
|
1452
|
+
escaped = true;
|
|
1453
|
+
continue;
|
|
1454
|
+
}
|
|
1455
|
+
if (ch === "\"") {
|
|
1456
|
+
quote = quote === 1 ? 0 : 1;
|
|
1457
|
+
continue;
|
|
1458
|
+
}
|
|
1459
|
+
if (quote === 1) continue;
|
|
1460
|
+
if (ch === "[") {
|
|
1461
|
+
bracket++;
|
|
1462
|
+
continue;
|
|
1463
|
+
}
|
|
1464
|
+
if (ch === "]" && bracket > 0) {
|
|
1465
|
+
bracket--;
|
|
1466
|
+
continue;
|
|
1467
|
+
}
|
|
1468
|
+
if (bracket > 0) continue;
|
|
1469
|
+
if (ch === "(") {
|
|
1470
|
+
paren++;
|
|
1471
|
+
continue;
|
|
1472
|
+
}
|
|
1473
|
+
if (ch === ")") {
|
|
1474
|
+
paren--;
|
|
1475
|
+
if (paren === 0) {
|
|
1476
|
+
if (requireEnd === true && i !== pattern.length - 1) return;
|
|
1477
|
+
return {
|
|
1478
|
+
type: pattern[0],
|
|
1479
|
+
body: pattern.slice(2, i),
|
|
1480
|
+
end: i
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
const getStarExtglobSequenceOutput = (pattern) => {
|
|
1487
|
+
let index = 0;
|
|
1488
|
+
const chars = [];
|
|
1489
|
+
while (index < pattern.length) {
|
|
1490
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
1491
|
+
if (!match || match.type !== "*") return;
|
|
1492
|
+
const branches = splitTopLevel(match.body).map((branch$1) => branch$1.trim());
|
|
1493
|
+
if (branches.length !== 1) return;
|
|
1494
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
1495
|
+
if (!branch || branch.length !== 1) return;
|
|
1496
|
+
chars.push(branch);
|
|
1497
|
+
index += match.end + 1;
|
|
1498
|
+
}
|
|
1499
|
+
if (chars.length < 1) return;
|
|
1500
|
+
return `${chars.length === 1 ? utils$2.escapeRegex(chars[0]) : `[${chars.map((ch) => utils$2.escapeRegex(ch)).join("")}]`}*`;
|
|
1501
|
+
};
|
|
1502
|
+
const repeatedExtglobRecursion = (pattern) => {
|
|
1503
|
+
let depth$1 = 0;
|
|
1504
|
+
let value = pattern.trim();
|
|
1505
|
+
let match = parseRepeatedExtglob(value);
|
|
1506
|
+
while (match) {
|
|
1507
|
+
depth$1++;
|
|
1508
|
+
value = match.body.trim();
|
|
1509
|
+
match = parseRepeatedExtglob(value);
|
|
1510
|
+
}
|
|
1511
|
+
return depth$1;
|
|
1512
|
+
};
|
|
1513
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
1514
|
+
if (options.maxExtglobRecursion === false) return { risky: false };
|
|
1515
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants$1.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
1516
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
1517
|
+
if (branches.length > 1) {
|
|
1518
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
1519
|
+
}
|
|
1520
|
+
for (const branch of branches) {
|
|
1521
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
1522
|
+
if (safeOutput) return {
|
|
1523
|
+
risky: true,
|
|
1524
|
+
safeOutput
|
|
1525
|
+
};
|
|
1526
|
+
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
1527
|
+
}
|
|
1528
|
+
return { risky: false };
|
|
1529
|
+
};
|
|
1356
1530
|
/**
|
|
1357
1531
|
* Parse the given input string.
|
|
1358
1532
|
* @param {String} input
|
|
@@ -1482,6 +1656,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1482
1656
|
token.prev = prev;
|
|
1483
1657
|
token.parens = state.parens;
|
|
1484
1658
|
token.output = state.output;
|
|
1659
|
+
token.startIndex = state.index;
|
|
1660
|
+
token.tokensIndex = tokens.length;
|
|
1485
1661
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
1486
1662
|
increment("parens");
|
|
1487
1663
|
push({
|
|
@@ -1498,6 +1674,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1498
1674
|
extglobs.push(token);
|
|
1499
1675
|
};
|
|
1500
1676
|
const extglobClose = (token) => {
|
|
1677
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
1678
|
+
const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
|
|
1679
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
1680
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR$1) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
1681
|
+
const open = tokens[token.tokensIndex];
|
|
1682
|
+
open.type = "text";
|
|
1683
|
+
open.value = literal;
|
|
1684
|
+
open.output = safeOutput || utils$2.escapeRegex(literal);
|
|
1685
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
1686
|
+
tokens[i].value = "";
|
|
1687
|
+
tokens[i].output = "";
|
|
1688
|
+
delete tokens[i].suffix;
|
|
1689
|
+
}
|
|
1690
|
+
state.output = token.output + open.output;
|
|
1691
|
+
state.backtrack = true;
|
|
1692
|
+
push({
|
|
1693
|
+
type: "paren",
|
|
1694
|
+
extglob: true,
|
|
1695
|
+
value,
|
|
1696
|
+
output: ""
|
|
1697
|
+
});
|
|
1698
|
+
decrement("parens");
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1501
1701
|
let output = token.close + (opts.capture ? ")" : "");
|
|
1502
1702
|
let rest;
|
|
1503
1703
|
if (token.type === "negate") {
|
|
@@ -2184,7 +2384,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2184
2384
|
}));
|
|
2185
2385
|
|
|
2186
2386
|
//#endregion
|
|
2187
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
2387
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
2188
2388
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2189
2389
|
const scan = require_scan();
|
|
2190
2390
|
const parse = require_parse();
|
|
@@ -2394,6 +2594,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2394
2594
|
* Compile a regular expression from the `state` object returned by the
|
|
2395
2595
|
* [parse()](#parse) method.
|
|
2396
2596
|
*
|
|
2597
|
+
* ```js
|
|
2598
|
+
* const picomatch = require('picomatch');
|
|
2599
|
+
* const state = picomatch.parse('*.js');
|
|
2600
|
+
* // picomatch.compileRe(state[, options]);
|
|
2601
|
+
*
|
|
2602
|
+
* console.log(picomatch.compileRe(state));
|
|
2603
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2604
|
+
* ```
|
|
2397
2605
|
* @param {Object} `state`
|
|
2398
2606
|
* @param {Object} `options`
|
|
2399
2607
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -2417,10 +2625,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2417
2625
|
*
|
|
2418
2626
|
* ```js
|
|
2419
2627
|
* const picomatch = require('picomatch');
|
|
2420
|
-
*
|
|
2421
|
-
* // picomatch.compileRe(state[, options]);
|
|
2628
|
+
* // picomatch.makeRe(state[, options]);
|
|
2422
2629
|
*
|
|
2423
|
-
*
|
|
2630
|
+
* const result = picomatch.makeRe('*.js');
|
|
2631
|
+
* console.log(result);
|
|
2424
2632
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2425
2633
|
* ```
|
|
2426
2634
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -2477,7 +2685,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2477
2685
|
}));
|
|
2478
2686
|
|
|
2479
2687
|
//#endregion
|
|
2480
|
-
//#region ../../node_modules/.bun/picomatch@4.0.
|
|
2688
|
+
//#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/index.js
|
|
2481
2689
|
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2482
2690
|
const pico = require_picomatch$1();
|
|
2483
2691
|
const utils = require_utils();
|
|
@@ -2493,38 +2701,39 @@ var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2493
2701
|
}));
|
|
2494
2702
|
|
|
2495
2703
|
//#endregion
|
|
2496
|
-
//#region ../../node_modules/.bun/tinyglobby@0.2.
|
|
2704
|
+
//#region ../../node_modules/.bun/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.mjs
|
|
2497
2705
|
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
2498
2706
|
const isReadonlyArray = Array.isArray;
|
|
2707
|
+
const BACKSLASHES = /\\/g;
|
|
2499
2708
|
const isWin = process.platform === "win32";
|
|
2500
2709
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
2501
2710
|
function getPartialMatcher(patterns, options = {}) {
|
|
2502
2711
|
const patternsCount = patterns.length;
|
|
2503
2712
|
const patternsParts = Array(patternsCount);
|
|
2504
2713
|
const matchers = Array(patternsCount);
|
|
2505
|
-
|
|
2506
|
-
for (
|
|
2714
|
+
let i, j;
|
|
2715
|
+
for (i = 0; i < patternsCount; i++) {
|
|
2507
2716
|
const parts = splitPattern(patterns[i]);
|
|
2508
2717
|
patternsParts[i] = parts;
|
|
2509
2718
|
const partsCount = parts.length;
|
|
2510
2719
|
const partMatchers = Array(partsCount);
|
|
2511
|
-
for (
|
|
2720
|
+
for (j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
|
|
2512
2721
|
matchers[i] = partMatchers;
|
|
2513
2722
|
}
|
|
2514
2723
|
return (input) => {
|
|
2515
2724
|
const inputParts = input.split("/");
|
|
2516
2725
|
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
|
|
2517
|
-
for (
|
|
2726
|
+
for (i = 0; i < patternsCount; i++) {
|
|
2518
2727
|
const patternParts = patternsParts[i];
|
|
2519
2728
|
const matcher = matchers[i];
|
|
2520
2729
|
const inputPatternCount = inputParts.length;
|
|
2521
2730
|
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
2522
|
-
|
|
2731
|
+
j = 0;
|
|
2523
2732
|
while (j < minParts) {
|
|
2524
2733
|
const part = patternParts[j];
|
|
2525
2734
|
if (part.includes("/")) return true;
|
|
2526
2735
|
if (!matcher[j](inputParts[j])) break;
|
|
2527
|
-
if (
|
|
2736
|
+
if (!options.noglobstar && part === "**") return true;
|
|
2528
2737
|
j++;
|
|
2529
2738
|
}
|
|
2530
2739
|
if (j === inputPatternCount) return true;
|
|
@@ -2538,7 +2747,7 @@ const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
|
|
|
2538
2747
|
function buildFormat(cwd, root, absolute) {
|
|
2539
2748
|
if (cwd === root || root.startsWith(`${cwd}/`)) {
|
|
2540
2749
|
if (absolute) {
|
|
2541
|
-
const start =
|
|
2750
|
+
const start = cwd.length + +!isRoot(cwd);
|
|
2542
2751
|
return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
|
|
2543
2752
|
}
|
|
2544
2753
|
const prefix = root.slice(cwd.length + 1);
|
|
@@ -2559,20 +2768,19 @@ function buildRelative(cwd, root) {
|
|
|
2559
2768
|
}
|
|
2560
2769
|
return (p) => {
|
|
2561
2770
|
const result = posix.relative(cwd, `${root}/${p}`);
|
|
2562
|
-
|
|
2563
|
-
return result || ".";
|
|
2771
|
+
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
2564
2772
|
};
|
|
2565
2773
|
}
|
|
2566
2774
|
const splitPatternOptions = { parts: true };
|
|
2567
|
-
function splitPattern(path$1
|
|
2775
|
+
function splitPattern(path$1) {
|
|
2568
2776
|
var _result$parts;
|
|
2569
|
-
const result = import_picomatch.default.scan(path$1
|
|
2570
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1
|
|
2777
|
+
const result = import_picomatch.default.scan(path$1, splitPatternOptions);
|
|
2778
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$1];
|
|
2571
2779
|
}
|
|
2572
2780
|
const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
2573
2781
|
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
2574
|
-
const escapePosixPath = (path$1
|
|
2575
|
-
const escapeWin32Path = (path$1
|
|
2782
|
+
const escapePosixPath = (path$1) => path$1.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2783
|
+
const escapeWin32Path = (path$1) => path$1.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2576
2784
|
/**
|
|
2577
2785
|
* Escapes a path's special characters depending on the platform.
|
|
2578
2786
|
* @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
|
|
@@ -2599,28 +2807,31 @@ function isDynamicPattern(pattern, options) {
|
|
|
2599
2807
|
function log(...tasks) {
|
|
2600
2808
|
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
|
|
2601
2809
|
}
|
|
2810
|
+
function ensureStringArray(value) {
|
|
2811
|
+
return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
|
|
2812
|
+
}
|
|
2602
2813
|
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
2603
2814
|
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
2604
|
-
|
|
2605
|
-
|
|
2815
|
+
function normalizePattern(pattern, opts, props, isIgnore) {
|
|
2816
|
+
var _PARENT_DIRECTORY$exe;
|
|
2817
|
+
const cwd = opts.cwd;
|
|
2606
2818
|
let result = pattern;
|
|
2607
|
-
if (pattern.
|
|
2608
|
-
if (
|
|
2819
|
+
if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
|
|
2820
|
+
if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
|
|
2609
2821
|
const escapedCwd = escapePath(cwd);
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
2822
|
+
result = isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
|
|
2823
|
+
const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
|
|
2613
2824
|
const parts = splitPattern(result);
|
|
2614
|
-
if (
|
|
2615
|
-
const n = (
|
|
2825
|
+
if (parentDir) {
|
|
2826
|
+
const n = (parentDir.length + 1) / 3;
|
|
2616
2827
|
let i = 0;
|
|
2617
2828
|
const cwdParts = escapedCwd.split("/");
|
|
2618
2829
|
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
2619
2830
|
result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
2620
2831
|
i++;
|
|
2621
2832
|
}
|
|
2622
|
-
const potentialRoot = posix.join(cwd,
|
|
2623
|
-
if (
|
|
2833
|
+
const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
|
|
2834
|
+
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
2624
2835
|
props.root = potentialRoot;
|
|
2625
2836
|
props.depthOffset = -n + i;
|
|
2626
2837
|
}
|
|
@@ -2636,7 +2847,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
2636
2847
|
newCommonPath.pop();
|
|
2637
2848
|
break;
|
|
2638
2849
|
}
|
|
2639
|
-
if (part !== props.commonPath[i] || isDynamicPattern(part)
|
|
2850
|
+
if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
|
|
2640
2851
|
newCommonPath.push(part);
|
|
2641
2852
|
}
|
|
2642
2853
|
props.depthOffset = newCommonPath.length;
|
|
@@ -2645,135 +2856,126 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
|
|
|
2645
2856
|
}
|
|
2646
2857
|
return result;
|
|
2647
2858
|
}
|
|
2648
|
-
function processPatterns(
|
|
2649
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
2650
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
2859
|
+
function processPatterns(options, patterns, props) {
|
|
2651
2860
|
const matchPatterns = [];
|
|
2652
2861
|
const ignorePatterns = [];
|
|
2653
|
-
for (const pattern of ignore) {
|
|
2862
|
+
for (const pattern of options.ignore) {
|
|
2654
2863
|
if (!pattern) continue;
|
|
2655
|
-
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern,
|
|
2864
|
+
if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
|
|
2656
2865
|
}
|
|
2657
2866
|
for (const pattern of patterns) {
|
|
2658
2867
|
if (!pattern) continue;
|
|
2659
|
-
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern,
|
|
2660
|
-
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1),
|
|
2868
|
+
if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
|
|
2869
|
+
else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
|
|
2661
2870
|
}
|
|
2662
2871
|
return {
|
|
2663
2872
|
match: matchPatterns,
|
|
2664
2873
|
ignore: ignorePatterns
|
|
2665
2874
|
};
|
|
2666
2875
|
}
|
|
2667
|
-
function
|
|
2668
|
-
|
|
2669
|
-
const path$1$1 = paths[i];
|
|
2670
|
-
paths[i] = relative$1(path$1$1);
|
|
2671
|
-
}
|
|
2672
|
-
return paths;
|
|
2673
|
-
}
|
|
2674
|
-
function normalizeCwd(cwd) {
|
|
2675
|
-
if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
|
|
2676
|
-
if (cwd instanceof URL) return fileURLToPath$1(cwd).replace(BACKSLASHES, "/");
|
|
2677
|
-
return path$1.resolve(cwd).replace(BACKSLASHES, "/");
|
|
2678
|
-
}
|
|
2679
|
-
function getCrawler(patterns, inputOptions = {}) {
|
|
2680
|
-
const options = process.env.TINYGLOBBY_DEBUG ? {
|
|
2681
|
-
...inputOptions,
|
|
2682
|
-
debug: true
|
|
2683
|
-
} : inputOptions;
|
|
2684
|
-
const cwd = normalizeCwd(options.cwd);
|
|
2685
|
-
if (options.debug) log("globbing with:", {
|
|
2686
|
-
patterns,
|
|
2687
|
-
options,
|
|
2688
|
-
cwd
|
|
2689
|
-
});
|
|
2690
|
-
if (Array.isArray(patterns) && patterns.length === 0) return [{
|
|
2691
|
-
sync: () => [],
|
|
2692
|
-
withPromise: async () => []
|
|
2693
|
-
}, false];
|
|
2876
|
+
function buildCrawler(options, patterns) {
|
|
2877
|
+
const cwd = options.cwd;
|
|
2694
2878
|
const props = {
|
|
2695
2879
|
root: cwd,
|
|
2696
|
-
commonPath: null,
|
|
2697
2880
|
depthOffset: 0
|
|
2698
2881
|
};
|
|
2699
|
-
const processed = processPatterns(
|
|
2700
|
-
...options,
|
|
2701
|
-
patterns
|
|
2702
|
-
}, cwd, props);
|
|
2882
|
+
const processed = processPatterns(options, patterns, props);
|
|
2703
2883
|
if (options.debug) log("internal processing patterns:", processed);
|
|
2884
|
+
const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
|
|
2885
|
+
const root = props.root.replace(BACKSLASHES, "");
|
|
2704
2886
|
const matchOptions = {
|
|
2705
|
-
dot
|
|
2887
|
+
dot,
|
|
2706
2888
|
nobrace: options.braceExpansion === false,
|
|
2707
|
-
nocase:
|
|
2889
|
+
nocase: !caseSensitiveMatch,
|
|
2708
2890
|
noextglob: options.extglob === false,
|
|
2709
2891
|
noglobstar: options.globstar === false,
|
|
2710
2892
|
posix: true
|
|
2711
2893
|
};
|
|
2712
|
-
const matcher = (0, import_picomatch.default)(processed.match,
|
|
2713
|
-
...matchOptions,
|
|
2714
|
-
ignore: processed.ignore
|
|
2715
|
-
});
|
|
2894
|
+
const matcher = (0, import_picomatch.default)(processed.match, matchOptions);
|
|
2716
2895
|
const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
|
|
2717
2896
|
const partialMatcher = getPartialMatcher(processed.match, matchOptions);
|
|
2718
|
-
const format = buildFormat(cwd,
|
|
2719
|
-
const
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2897
|
+
const format = buildFormat(cwd, root, absolute);
|
|
2898
|
+
const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
|
|
2899
|
+
const excludePredicate = (_, p) => {
|
|
2900
|
+
const relativePath = excludeFormatter(p, true);
|
|
2901
|
+
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2902
|
+
};
|
|
2903
|
+
let maxDepth;
|
|
2904
|
+
if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
|
|
2905
|
+
const crawler = new Builder({
|
|
2906
|
+
filters: [debug ? (p, isDirectory) => {
|
|
2907
|
+
const path$1 = format(p, isDirectory);
|
|
2908
|
+
const matches = matcher(path$1) && !ignore(path$1);
|
|
2909
|
+
if (matches) log(`matched ${path$1}`);
|
|
2725
2910
|
return matches;
|
|
2726
|
-
} : (p, isDirectory) =>
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2911
|
+
} : (p, isDirectory) => {
|
|
2912
|
+
const path$1 = format(p, isDirectory);
|
|
2913
|
+
return matcher(path$1) && !ignore(path$1);
|
|
2914
|
+
}],
|
|
2915
|
+
exclude: debug ? (_, p) => {
|
|
2916
|
+
const skipped = excludePredicate(_, p);
|
|
2917
|
+
log(`${skipped ? "skipped" : "crawling"} ${p}`);
|
|
2732
2918
|
return skipped;
|
|
2733
|
-
} :
|
|
2734
|
-
|
|
2735
|
-
return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
|
|
2736
|
-
},
|
|
2737
|
-
fs: options.fs ? {
|
|
2738
|
-
readdir: options.fs.readdir || nativeFs.readdir,
|
|
2739
|
-
readdirSync: options.fs.readdirSync || nativeFs.readdirSync,
|
|
2740
|
-
realpath: options.fs.realpath || nativeFs.realpath,
|
|
2741
|
-
realpathSync: options.fs.realpathSync || nativeFs.realpathSync,
|
|
2742
|
-
stat: options.fs.stat || nativeFs.stat,
|
|
2743
|
-
statSync: options.fs.statSync || nativeFs.statSync
|
|
2744
|
-
} : void 0,
|
|
2919
|
+
} : excludePredicate,
|
|
2920
|
+
fs: options.fs,
|
|
2745
2921
|
pathSeparator: "/",
|
|
2746
|
-
relativePaths:
|
|
2747
|
-
|
|
2922
|
+
relativePaths: !absolute,
|
|
2923
|
+
resolvePaths: absolute,
|
|
2924
|
+
includeBasePath: absolute,
|
|
2925
|
+
resolveSymlinks: followSymbolicLinks,
|
|
2926
|
+
excludeSymlinks: !followSymbolicLinks,
|
|
2927
|
+
excludeFiles: onlyDirectories,
|
|
2928
|
+
includeDirs: onlyDirectories || !options.onlyFiles,
|
|
2929
|
+
maxDepth,
|
|
2748
2930
|
signal: options.signal
|
|
2931
|
+
}).crawl(root);
|
|
2932
|
+
if (options.debug) log("internal properties:", {
|
|
2933
|
+
...props,
|
|
2934
|
+
root
|
|
2935
|
+
});
|
|
2936
|
+
return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
|
|
2937
|
+
}
|
|
2938
|
+
function formatPaths(paths, mapper) {
|
|
2939
|
+
if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
|
|
2940
|
+
return paths;
|
|
2941
|
+
}
|
|
2942
|
+
const defaultOptions = {
|
|
2943
|
+
caseSensitiveMatch: true,
|
|
2944
|
+
cwd: process.cwd(),
|
|
2945
|
+
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
2946
|
+
expandDirectories: true,
|
|
2947
|
+
followSymbolicLinks: true,
|
|
2948
|
+
onlyFiles: true
|
|
2949
|
+
};
|
|
2950
|
+
function getOptions(options) {
|
|
2951
|
+
const opts = {
|
|
2952
|
+
...defaultOptions,
|
|
2953
|
+
...options
|
|
2749
2954
|
};
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
}
|
|
2760
|
-
if (
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2955
|
+
opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve(opts.cwd)).replace(BACKSLASHES, "/");
|
|
2956
|
+
opts.ignore = ensureStringArray(opts.ignore);
|
|
2957
|
+
opts.fs && (opts.fs = {
|
|
2958
|
+
readdir: opts.fs.readdir || readdir,
|
|
2959
|
+
readdirSync: opts.fs.readdirSync || readdirSync,
|
|
2960
|
+
realpath: opts.fs.realpath || realpath,
|
|
2961
|
+
realpathSync: opts.fs.realpathSync || realpathSync,
|
|
2962
|
+
stat: opts.fs.stat || stat,
|
|
2963
|
+
statSync: opts.fs.statSync || statSync
|
|
2964
|
+
});
|
|
2965
|
+
if (opts.debug) log("globbing with options:", opts);
|
|
2966
|
+
return opts;
|
|
2967
|
+
}
|
|
2968
|
+
function getCrawler(globInput, inputOptions = {}) {
|
|
2969
|
+
var _ref;
|
|
2970
|
+
if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
2971
|
+
const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
|
|
2972
|
+
const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
|
|
2973
|
+
const options = getOptions(isModern ? inputOptions : globInput);
|
|
2974
|
+
return patterns.length > 0 ? buildCrawler(options, patterns) : [];
|
|
2769
2975
|
}
|
|
2770
|
-
async function glob(
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
const opts = isModern ? options : patternsOrOptions;
|
|
2774
|
-
const [crawler, relative$1] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
|
|
2775
|
-
if (!relative$1) return crawler.withPromise();
|
|
2776
|
-
return formatPaths(await crawler.withPromise(), relative$1);
|
|
2976
|
+
async function glob(globInput, options) {
|
|
2977
|
+
const [crawler, relative$1] = getCrawler(globInput, options);
|
|
2978
|
+
return crawler ? formatPaths(await crawler.withPromise(), relative$1) : [];
|
|
2777
2979
|
}
|
|
2778
2980
|
|
|
2779
2981
|
//#endregion
|
|
@@ -2839,4 +3041,4 @@ async function listTemplates(prefix) {
|
|
|
2839
3041
|
|
|
2840
3042
|
//#endregion
|
|
2841
3043
|
export { loadTemplates as a, loadTemplate as i, getTemplatesRoot as n, isBinaryPath as o, listTemplates as r, getBinaryTemplatesRoot as t };
|
|
2842
|
-
//# sourceMappingURL=template-reader-
|
|
3044
|
+
//# sourceMappingURL=template-reader-D1uxgWOQ.mjs.map
|