@kenkaiiii/gg-pixel 4.3.93 → 4.3.94
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/cli.js +25 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +26 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -9
package/dist/cli.js
CHANGED
|
@@ -149,7 +149,9 @@ async function safeText(r) {
|
|
|
149
149
|
}
|
|
150
150
|
function detectPackageManager(projectRoot) {
|
|
151
151
|
if (existsSync(join(projectRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
152
|
-
if (existsSync(join(projectRoot, "bun.
|
|
152
|
+
if (existsSync(join(projectRoot, "bun.lock")) || existsSync(join(projectRoot, "bun.lockb"))) {
|
|
153
|
+
return "bun";
|
|
154
|
+
}
|
|
153
155
|
if (existsSync(join(projectRoot, "yarn.lock"))) return "yarn";
|
|
154
156
|
return "npm";
|
|
155
157
|
}
|
|
@@ -525,10 +527,27 @@ function injectClientComponentViaAst(layoutPath, content, importSpec) {
|
|
|
525
527
|
}
|
|
526
528
|
function findFirstJsxElementByName(ast, name) {
|
|
527
529
|
let found = null;
|
|
528
|
-
|
|
530
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
531
|
+
const MAX_DEPTH = 500;
|
|
532
|
+
const SKIP_KEYS = /* @__PURE__ */ new Set([
|
|
533
|
+
"loc",
|
|
534
|
+
"tokens",
|
|
535
|
+
"original",
|
|
536
|
+
"comments",
|
|
537
|
+
"leadingComments",
|
|
538
|
+
"trailingComments",
|
|
539
|
+
"innerComments",
|
|
540
|
+
"range",
|
|
541
|
+
"start",
|
|
542
|
+
"end"
|
|
543
|
+
]);
|
|
544
|
+
function walk(node, depth) {
|
|
529
545
|
if (found || !node || typeof node !== "object") return;
|
|
546
|
+
if (depth > MAX_DEPTH) return;
|
|
547
|
+
if (seen.has(node)) return;
|
|
548
|
+
seen.add(node);
|
|
530
549
|
if (Array.isArray(node)) {
|
|
531
|
-
for (const c of node) walk(c);
|
|
550
|
+
for (const c of node) walk(c, depth + 1);
|
|
532
551
|
return;
|
|
533
552
|
}
|
|
534
553
|
const n = node;
|
|
@@ -543,10 +562,11 @@ function findFirstJsxElementByName(ast, name) {
|
|
|
543
562
|
}
|
|
544
563
|
}
|
|
545
564
|
for (const key of Object.keys(n)) {
|
|
546
|
-
|
|
565
|
+
if (SKIP_KEYS.has(key)) continue;
|
|
566
|
+
walk(n[key], depth + 1);
|
|
547
567
|
}
|
|
548
568
|
}
|
|
549
|
-
walk(ast);
|
|
569
|
+
walk(ast, 0);
|
|
550
570
|
return found;
|
|
551
571
|
}
|
|
552
572
|
function injectClientComponentViaRegex(layoutPath, content, spec) {
|