@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/index.cjs CHANGED
@@ -31,6 +31,10 @@ __export(index_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(index_exports);
33
33
 
34
+ // ../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.14_typescript@6.0.3/node_modules/tsup/assets/cjs_shims.js
35
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
36
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
37
+
34
38
  // src/adapters/node.ts
35
39
  var import_node_crypto2 = require("crypto");
36
40
 
@@ -379,15 +383,14 @@ var import_node_os = require("os");
379
383
  var import_node_fs2 = require("fs");
380
384
  var import_node_module = require("module");
381
385
  var import_node_path = require("path");
382
- var import_meta = {};
383
- var requireBSQ = (0, import_node_module.createRequire)(import_meta.url);
386
+ var requireBSQ = (0, import_node_module.createRequire)(importMetaUrl);
384
387
  function loadBetterSqlite3() {
385
388
  try {
386
389
  const mod = requireBSQ("better-sqlite3");
387
390
  return typeof mod === "function" ? mod : mod.default;
388
391
  } catch (err) {
389
392
  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}`,
393
+ `@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
394
  { cause: err }
392
395
  );
393
396
  }
@@ -460,8 +463,7 @@ var import_node_module2 = require("module");
460
463
  var import_node_os2 = require("os");
461
464
  var import_node_path2 = require("path");
462
465
  var import_node_child_process2 = require("child_process");
463
- var import_meta2 = {};
464
- var nodeRequire = (0, import_node_module2.createRequire)(import_meta2.url);
466
+ var nodeRequire = (0, import_node_module2.createRequire)(importMetaUrl);
465
467
  var DEFAULT_INGEST_URL = "https://gg-pixel-server.buzzbeamaustralia.workers.dev";
466
468
  async function install(opts = {}) {
467
469
  const cwd = (0, import_node_path2.resolve)(opts.cwd ?? process.cwd());
@@ -597,7 +599,9 @@ async function safeText(r) {
597
599
  }
598
600
  function detectPackageManager(projectRoot) {
599
601
  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";
602
+ 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"))) {
603
+ return "bun";
604
+ }
601
605
  if ((0, import_node_fs3.existsSync)((0, import_node_path2.join)(projectRoot, "yarn.lock"))) return "yarn";
602
606
  return "npm";
603
607
  }
@@ -973,10 +977,27 @@ function injectClientComponentViaAst(layoutPath, content, importSpec) {
973
977
  }
974
978
  function findFirstJsxElementByName(ast, name) {
975
979
  let found = null;
976
- function walk(node) {
980
+ const seen = /* @__PURE__ */ new WeakSet();
981
+ const MAX_DEPTH = 500;
982
+ const SKIP_KEYS = /* @__PURE__ */ new Set([
983
+ "loc",
984
+ "tokens",
985
+ "original",
986
+ "comments",
987
+ "leadingComments",
988
+ "trailingComments",
989
+ "innerComments",
990
+ "range",
991
+ "start",
992
+ "end"
993
+ ]);
994
+ function walk(node, depth) {
977
995
  if (found || !node || typeof node !== "object") return;
996
+ if (depth > MAX_DEPTH) return;
997
+ if (seen.has(node)) return;
998
+ seen.add(node);
978
999
  if (Array.isArray(node)) {
979
- for (const c of node) walk(c);
1000
+ for (const c of node) walk(c, depth + 1);
980
1001
  return;
981
1002
  }
982
1003
  const n = node;
@@ -991,10 +1012,11 @@ function findFirstJsxElementByName(ast, name) {
991
1012
  }
992
1013
  }
993
1014
  for (const key of Object.keys(n)) {
994
- walk(n[key]);
1015
+ if (SKIP_KEYS.has(key)) continue;
1016
+ walk(n[key], depth + 1);
995
1017
  }
996
1018
  }
997
- walk(ast);
1019
+ walk(ast, 0);
998
1020
  return found;
999
1021
  }
1000
1022
  function injectClientComponentViaRegex(layoutPath, content, spec) {