@biffo/cli 0.199.8 → 0.200.0
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/index.js +24 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -320,11 +320,30 @@ function readCoreManifest(templateRoot) {
|
|
|
320
320
|
}
|
|
321
321
|
return result.data;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
323
|
+
function globToRegExp(pattern) {
|
|
324
|
+
const source = pattern.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join("[^/]*");
|
|
325
|
+
return new RegExp(`^${source}$`);
|
|
326
|
+
}
|
|
327
|
+
var GLOB_CACHE = /* @__PURE__ */ new Map();
|
|
328
|
+
function globMatches(relPath, pattern) {
|
|
329
|
+
let re = GLOB_CACHE.get(pattern);
|
|
330
|
+
if (!re) {
|
|
331
|
+
re = globToRegExp(pattern);
|
|
332
|
+
GLOB_CACHE.set(pattern, re);
|
|
333
|
+
}
|
|
334
|
+
return re.test(relPath);
|
|
335
|
+
}
|
|
336
|
+
function matchLength(relPath, pattern) {
|
|
337
|
+
if (pattern.includes("*")) {
|
|
338
|
+
if (!globMatches(relPath, pattern)) return -1;
|
|
339
|
+
let literals = 0;
|
|
340
|
+
for (const ch of pattern) if (ch !== "*") literals++;
|
|
341
|
+
return literals;
|
|
342
|
+
}
|
|
343
|
+
if (pattern.endsWith("/")) {
|
|
344
|
+
return relPath === pattern.slice(0, -1) || relPath.startsWith(pattern) ? pattern.length : -1;
|
|
345
|
+
}
|
|
346
|
+
return relPath === pattern ? pattern.length : -1;
|
|
328
347
|
}
|
|
329
348
|
function longestMatch(relPath, prefixes) {
|
|
330
349
|
let best = -1;
|