@kenkaiiii/gg-pixel 4.3.93 → 4.3.95
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 +32 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -10
package/dist/index.js
CHANGED
|
@@ -353,7 +353,7 @@ function loadBetterSqlite3() {
|
|
|
353
353
|
return typeof mod === "function" ? mod : mod.default;
|
|
354
354
|
} catch (err) {
|
|
355
355
|
throw new Error(
|
|
356
|
-
`@kenkaiiii/gg-pixel: \`kind: "local"\` requires
|
|
356
|
+
`@kenkaiiii/gg-pixel: \`kind: "local"\` requires \`better-sqlite3\` to be installed. Install it with \`npm install better-sqlite3\` (or your package manager's equivalent). Underlying error: ${err.message}`,
|
|
357
357
|
{ cause: err }
|
|
358
358
|
);
|
|
359
359
|
}
|
|
@@ -569,7 +569,9 @@ async function safeText(r) {
|
|
|
569
569
|
}
|
|
570
570
|
function detectPackageManager(projectRoot) {
|
|
571
571
|
if (existsSync2(join2(projectRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
572
|
-
if (existsSync2(join2(projectRoot, "bun.
|
|
572
|
+
if (existsSync2(join2(projectRoot, "bun.lock")) || existsSync2(join2(projectRoot, "bun.lockb"))) {
|
|
573
|
+
return "bun";
|
|
574
|
+
}
|
|
573
575
|
if (existsSync2(join2(projectRoot, "yarn.lock"))) return "yarn";
|
|
574
576
|
return "npm";
|
|
575
577
|
}
|
|
@@ -945,10 +947,27 @@ function injectClientComponentViaAst(layoutPath, content, importSpec) {
|
|
|
945
947
|
}
|
|
946
948
|
function findFirstJsxElementByName(ast, name) {
|
|
947
949
|
let found = null;
|
|
948
|
-
|
|
950
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
951
|
+
const MAX_DEPTH = 500;
|
|
952
|
+
const SKIP_KEYS = /* @__PURE__ */ new Set([
|
|
953
|
+
"loc",
|
|
954
|
+
"tokens",
|
|
955
|
+
"original",
|
|
956
|
+
"comments",
|
|
957
|
+
"leadingComments",
|
|
958
|
+
"trailingComments",
|
|
959
|
+
"innerComments",
|
|
960
|
+
"range",
|
|
961
|
+
"start",
|
|
962
|
+
"end"
|
|
963
|
+
]);
|
|
964
|
+
function walk(node, depth) {
|
|
949
965
|
if (found || !node || typeof node !== "object") return;
|
|
966
|
+
if (depth > MAX_DEPTH) return;
|
|
967
|
+
if (seen.has(node)) return;
|
|
968
|
+
seen.add(node);
|
|
950
969
|
if (Array.isArray(node)) {
|
|
951
|
-
for (const c of node) walk(c);
|
|
970
|
+
for (const c of node) walk(c, depth + 1);
|
|
952
971
|
return;
|
|
953
972
|
}
|
|
954
973
|
const n = node;
|
|
@@ -963,10 +982,11 @@ function findFirstJsxElementByName(ast, name) {
|
|
|
963
982
|
}
|
|
964
983
|
}
|
|
965
984
|
for (const key of Object.keys(n)) {
|
|
966
|
-
|
|
985
|
+
if (SKIP_KEYS.has(key)) continue;
|
|
986
|
+
walk(n[key], depth + 1);
|
|
967
987
|
}
|
|
968
988
|
}
|
|
969
|
-
walk(ast);
|
|
989
|
+
walk(ast, 0);
|
|
970
990
|
return found;
|
|
971
991
|
}
|
|
972
992
|
function injectClientComponentViaRegex(layoutPath, content, spec) {
|