qapture2 0.2.3 → 0.2.4
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/bin/init.cjs +45 -9
- package/dist/{chunk-PC6LNG5Y.cjs → chunk-DPJW626S.cjs} +391 -192
- package/dist/{chunk-BE3H3FKR.js → chunk-RC7ZUQ5X.js} +391 -193
- package/dist/index.cjs +8 -4
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/next.cjs +4 -4
- package/dist/next.js +1 -1
- package/dist/standalone.cjs +26 -21
- package/dist/standalone.js +25 -20
- package/package.json +9 -2
package/dist/bin/init.cjs
CHANGED
|
@@ -227,7 +227,7 @@ function assertSafeToRead(filePath) {
|
|
|
227
227
|
const ext = path3.extname(filePath).toLowerCase();
|
|
228
228
|
if (basename3 === ".env.example") return true;
|
|
229
229
|
if (/^\.env\.example(\.\w+)?$/.test(basename3)) return true;
|
|
230
|
-
if (BLOCKED_EXACT_BASENAMES.has(basename3)) return false;
|
|
230
|
+
if (BLOCKED_EXACT_BASENAMES.has(basename3.toLowerCase())) return false;
|
|
231
231
|
if (/^\.env\./i.test(basename3) && !/^\.env\.example/i.test(basename3)) {
|
|
232
232
|
return false;
|
|
233
233
|
}
|
|
@@ -264,11 +264,11 @@ function makeStep(routePath) {
|
|
|
264
264
|
}
|
|
265
265
|
function classifyPath(routePath) {
|
|
266
266
|
const p = routePath.toLowerCase();
|
|
267
|
-
if (/^\/(seller|store-owner|vendor)/.test(p)) return "seller";
|
|
268
|
-
if (/^\/(admin|dashboard|control-panel|backoffice|back-office|management|cms)/.test(p)) {
|
|
267
|
+
if (/^\/(seller|store-owner|vendor)(?:\/|$)/.test(p)) return "seller";
|
|
268
|
+
if (/^\/(admin|dashboard|control-panel|backoffice|back-office|management|cms)(?:\/|$)/.test(p)) {
|
|
269
269
|
return "admin";
|
|
270
270
|
}
|
|
271
|
-
if (/^\/(login|signin|sign-in|signup|sign-up|register|auth|forgot-password|reset-password|verify|email-verification|oauth)/.test(p)) {
|
|
271
|
+
if (/^\/(login|signin|sign-in|signup|sign-up|register|auth|forgot-password|reset-password|verify|email-verification|oauth)(?:\/|$)/.test(p)) {
|
|
272
272
|
return "auth";
|
|
273
273
|
}
|
|
274
274
|
return "buyer";
|
|
@@ -494,6 +494,23 @@ function extractTailwindColors(content) {
|
|
|
494
494
|
colors.set(name.toLowerCase(), hex);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
+
const RE_NESTED = /['"]?([\w-]+)['"]?\s*:\s*\{([^{}]*)\}/g;
|
|
498
|
+
let nm;
|
|
499
|
+
while ((nm = RE_NESTED.exec(content)) !== null) {
|
|
500
|
+
const [, outerName, innerBlock] = nm;
|
|
501
|
+
const shades = /* @__PURE__ */ new Map();
|
|
502
|
+
const RE_INNER = /['"]?([\w-]+)['"]?\s*:\s*['"]?(#[0-9a-fA-F]{3,8})['"]?/g;
|
|
503
|
+
let im;
|
|
504
|
+
while ((im = RE_INNER.exec(innerBlock)) !== null) {
|
|
505
|
+
shades.set(im[1].toLowerCase(), im[2]);
|
|
506
|
+
}
|
|
507
|
+
if (shades.size === 0) continue;
|
|
508
|
+
const hex = shades.get("default") ?? shades.get("500") ?? shades.get("600") ?? shades.get("400") ?? shades.get("700") ?? shades.values().next().value;
|
|
509
|
+
if (hex) {
|
|
510
|
+
const key = outerName.toLowerCase();
|
|
511
|
+
if (!colors.has(key)) colors.set(key, hex);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
497
514
|
return colors;
|
|
498
515
|
}
|
|
499
516
|
function extractCssCustomProps(content) {
|
|
@@ -596,15 +613,33 @@ function isSeederFile(filePath) {
|
|
|
596
613
|
const norm = filePath.replace(/\\/g, "/");
|
|
597
614
|
return SEEDER_PATH_PATTERNS.some((p) => p.test(norm));
|
|
598
615
|
}
|
|
599
|
-
function extractMatches(content) {
|
|
616
|
+
function extractMatches(content, file) {
|
|
600
617
|
const out = [];
|
|
601
618
|
const lines = content.split("\n");
|
|
602
619
|
const FIELD_RE = /\b(email|login|username|password|phone|role)\s*[:=]\s*(?:["'`]([^"'`\r\n]+)["'`]|(process\.env\.(\w+)))/gi;
|
|
620
|
+
const FIELD_RE_EMBEDDED = /(?:^|[^A-Za-z0-9_])[A-Za-z][A-Za-z0-9_]*?(email|login|username|password|phone|role)\s*[:=]\s*(?:["'`]([^"'`\r\n]+)["'`]|(process\.env\.(\w+)))/gi;
|
|
603
621
|
for (let i = 0; i < lines.length; i++) {
|
|
604
622
|
const line = lines[i];
|
|
605
623
|
let m;
|
|
606
624
|
FIELD_RE.lastIndex = 0;
|
|
625
|
+
const claimedRanges = [];
|
|
607
626
|
while ((m = FIELD_RE.exec(line)) !== null) {
|
|
627
|
+
claimedRanges.push([m.index, m.index + m[0].length]);
|
|
628
|
+
const type = m[1].toLowerCase();
|
|
629
|
+
let value;
|
|
630
|
+
if (m[3] !== void 0) {
|
|
631
|
+
value = `TODO: set from env ${m[4]} (use .env.example)`;
|
|
632
|
+
} else {
|
|
633
|
+
value = m[2].trim();
|
|
634
|
+
if (/^[<{]/.test(value) || /^(change[_-]?me|your[_-])/i.test(value)) continue;
|
|
635
|
+
}
|
|
636
|
+
out.push({ type, value, lineIdx: i, context: line, file });
|
|
637
|
+
}
|
|
638
|
+
FIELD_RE_EMBEDDED.lastIndex = 0;
|
|
639
|
+
while ((m = FIELD_RE_EMBEDDED.exec(line)) !== null) {
|
|
640
|
+
const start = m.index;
|
|
641
|
+
const end = m.index + m[0].length;
|
|
642
|
+
if (claimedRanges.some(([s, e]) => start < e && end > s)) continue;
|
|
608
643
|
const type = m[1].toLowerCase();
|
|
609
644
|
let value;
|
|
610
645
|
if (m[3] !== void 0) {
|
|
@@ -613,7 +648,7 @@ function extractMatches(content) {
|
|
|
613
648
|
value = m[2].trim();
|
|
614
649
|
if (/^[<{]/.test(value) || /^(change[_-]?me|your[_-])/i.test(value)) continue;
|
|
615
650
|
}
|
|
616
|
-
out.push({ type, value, lineIdx: i, context: line });
|
|
651
|
+
out.push({ type, value, lineIdx: i, context: line, file });
|
|
617
652
|
}
|
|
618
653
|
}
|
|
619
654
|
return out;
|
|
@@ -644,7 +679,8 @@ function groupMatches(matches) {
|
|
|
644
679
|
const clusterHasIdentifier = current.some(
|
|
645
680
|
(x) => x.type === "email" || x.type === "login" || x.type === "username"
|
|
646
681
|
);
|
|
647
|
-
|
|
682
|
+
const sameFile = m.file === prev.file;
|
|
683
|
+
if (!sameFile || m.lineIdx - prev.lineIdx > 20 || isIdentifier && clusterHasIdentifier) {
|
|
648
684
|
clusters.push(current);
|
|
649
685
|
current = [m];
|
|
650
686
|
} else {
|
|
@@ -695,7 +731,7 @@ function detectCredentials(targetDir) {
|
|
|
695
731
|
const envExample = path6.join(targetDir, ".env.example");
|
|
696
732
|
if (fs6.existsSync(envExample) && assertSafeToRead(envExample)) {
|
|
697
733
|
const content = readFileSafe(envExample);
|
|
698
|
-
if (content) allMatches.push(...extractMatches(content));
|
|
734
|
+
if (content) allMatches.push(...extractMatches(content, envExample));
|
|
699
735
|
}
|
|
700
736
|
for (const rel of SEEDER_SEARCH_DIRS) {
|
|
701
737
|
const dirPath = path6.join(targetDir, rel);
|
|
@@ -706,7 +742,7 @@ function detectCredentials(targetDir) {
|
|
|
706
742
|
});
|
|
707
743
|
for (const f of files) {
|
|
708
744
|
const content = readFileSafe(f);
|
|
709
|
-
if (content) allMatches.push(...extractMatches(content));
|
|
745
|
+
if (content) allMatches.push(...extractMatches(content, f));
|
|
710
746
|
}
|
|
711
747
|
}
|
|
712
748
|
return groupMatches(allMatches);
|