@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/index.cjs CHANGED
@@ -387,7 +387,7 @@ function loadBetterSqlite3() {
387
387
  return typeof mod === "function" ? mod : mod.default;
388
388
  } catch (err) {
389
389
  throw new Error(
390
- `@kenkaiiii/gg-pixel: \`kind: "local"\` requires the optional peer dependency \`better-sqlite3\`. Install it with \`npm install better-sqlite3\` (or your package manager's equivalent). Underlying error: ${err.message}`,
390
+ `@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}`,
391
391
  { cause: err }
392
392
  );
393
393
  }
@@ -597,7 +597,9 @@ async function safeText(r) {
597
597
  }
598
598
  function detectPackageManager(projectRoot) {
599
599
  if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(projectRoot, "pnpm-lock.yaml"))) return "pnpm";
600
- if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(projectRoot, "bun.lockb"))) return "bun";
600
+ if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(projectRoot, "bun.lock")) || (0, import_node_fs3.existsSync)((0, import_node_path2.join)(projectRoot, "bun.lockb"))) {
601
+ return "bun";
602
+ }
601
603
  if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(projectRoot, "yarn.lock"))) return "yarn";
602
604
  return "npm";
603
605
  }
@@ -973,10 +975,27 @@ function injectClientComponentViaAst(layoutPath, content, importSpec) {
973
975
  }
974
976
  function findFirstJsxElementByName(ast, name) {
975
977
  let found = null;
976
- function walk(node) {
978
+ const seen = /* @__PURE__ */ new WeakSet();
979
+ const MAX_DEPTH = 500;
980
+ const SKIP_KEYS = /* @__PURE__ */ new Set([
981
+ "loc",
982
+ "tokens",
983
+ "original",
984
+ "comments",
985
+ "leadingComments",
986
+ "trailingComments",
987
+ "innerComments",
988
+ "range",
989
+ "start",
990
+ "end"
991
+ ]);
992
+ function walk(node, depth) {
977
993
  if (found || !node || typeof node !== "object") return;
994
+ if (depth > MAX_DEPTH) return;
995
+ if (seen.has(node)) return;
996
+ seen.add(node);
978
997
  if (Array.isArray(node)) {
979
- for (const c of node) walk(c);
998
+ for (const c of node) walk(c, depth + 1);
980
999
  return;
981
1000
  }
982
1001
  const n = node;
@@ -991,10 +1010,11 @@ function findFirstJsxElementByName(ast, name) {
991
1010
  }
992
1011
  }
993
1012
  for (const key of Object.keys(n)) {
994
- walk(n[key]);
1013
+ if (SKIP_KEYS.has(key)) continue;
1014
+ walk(n[key], depth + 1);
995
1015
  }
996
1016
  }
997
- walk(ast);
1017
+ walk(ast, 0);
998
1018
  return found;
999
1019
  }
1000
1020
  function injectClientComponentViaRegex(layoutPath, content, spec) {