{"version":3,"file":"transformHermesLoops.js","names":[],"sources":["esm/transformHermesLoops.js"],"sourcesContent":["import MagicString from \"magic-string\";\nimport { parseSync } from \"oxc-parser\";\nconst LOOP_RE = /\\b(?:for|while)\\s*(?:await\\s+)?\\(/;\nconst LEXICAL_RE = /\\b(?:let|const|class)\\b/;\nfunction langFor(filename) {\n  const ext = filename.split(\"?\")[0].split(\".\").pop() || \"js\";\n  if (ext === \"ts\" || ext === \"cts\" || ext === \"mts\") return \"ts\";\n  if (ext === \"tsx\") return \"tsx\";\n  return \"jsx\";\n}\nfunction collectPatternNames(node, out) {\n  if (!node || typeof node !== \"object\") return;\n  switch (node.type) {\n    case \"Identifier\":\n      out.push(node.name);\n      return;\n    case \"ObjectPattern\":\n      for (const p of node.properties || []) {\n        collectPatternNames(p.value ?? p.argument, out);\n      }\n      return;\n    case \"ArrayPattern\":\n      for (const el of node.elements || []) collectPatternNames(el, out);\n      return;\n    case \"AssignmentPattern\":\n      collectPatternNames(node.left, out);\n      return;\n    case \"RestElement\":\n      collectPatternNames(node.argument, out);\n      return;\n  }\n}\nconst FUNCTION_TYPES = /* @__PURE__ */ new Set([\n  \"FunctionDeclaration\",\n  \"FunctionExpression\",\n  \"ArrowFunctionExpression\"\n]);\nfunction eachChild(node, fn) {\n  for (const key in node) {\n    if (key === \"type\" || key === \"start\" || key === \"end\" || key === \"parent\") continue;\n    const value = node[key];\n    if (Array.isArray(value)) {\n      for (const item of value) {\n        if (item && typeof item.type === \"string\") fn(item);\n      }\n    } else if (value && typeof value === \"object\" && typeof value.type === \"string\") {\n      fn(value);\n    }\n  }\n}\nfunction capturesInClosure(body, names) {\n  let found = false;\n  function scanInsideFunction(node, shadowed) {\n    if (found || !node || typeof node !== \"object\") return;\n    if (node.type === \"Identifier\" && names.has(node.name) && !shadowed.has(node.name)) {\n      found = true;\n      return;\n    }\n    if (FUNCTION_TYPES.has(node.type)) {\n      const inner = new Set(shadowed);\n      const params = [];\n      for (const p of node.params || []) collectPatternNames(p, params);\n      for (const p of params) inner.add(p);\n      if (node.id?.name) inner.add(node.id.name);\n      eachChild(node, (c) => scanInsideFunction(c, inner));\n      return;\n    }\n    if (node.type === \"MemberExpression\" && !node.computed) {\n      scanInsideFunction(node.object, shadowed);\n      return;\n    }\n    if (node.type === \"Property\" && !node.computed && node.key === node.value) {\n      scanInsideFunction(node.value, shadowed);\n      return;\n    }\n    eachChild(node, (c) => scanInsideFunction(c, shadowed));\n  }\n  function walk(node) {\n    if (found || !node || typeof node !== \"object\") return;\n    if (FUNCTION_TYPES.has(node.type)) {\n      const shadowed = /* @__PURE__ */ new Set();\n      const params = [];\n      for (const p of node.params || []) collectPatternNames(p, params);\n      for (const p of params) shadowed.add(p);\n      eachChild(node, (c) => scanInsideFunction(c, shadowed));\n      return;\n    }\n    eachChild(node, walk);\n  }\n  walk(body);\n  return found;\n}\nfunction analyzeBody(body, names) {\n  const facts = {\n    hasBreak: false,\n    hasContinue: false,\n    hasReturn: false,\n    hasAwait: false,\n    hasYield: false,\n    assignsBinding: false,\n    hasLabeledJump: false\n  };\n  function walk(node, inNestedBreakable, inNestedLoop, inFunction) {\n    if (!node || typeof node !== \"object\") return;\n    if (FUNCTION_TYPES.has(node.type)) {\n      eachChild(node, (c) => walk(c, inNestedBreakable, inNestedLoop, true));\n      return;\n    }\n    switch (node.type) {\n      case \"BreakStatement\":\n        if (node.label) facts.hasLabeledJump = true;\n        else if (!inNestedBreakable) facts.hasBreak = true;\n        break;\n      case \"ContinueStatement\":\n        if (node.label) facts.hasLabeledJump = true;\n        else if (!inNestedLoop) facts.hasContinue = true;\n        break;\n      case \"ReturnStatement\":\n        if (!inFunction) facts.hasReturn = true;\n        break;\n      case \"AwaitExpression\":\n        if (!inFunction) facts.hasAwait = true;\n        break;\n      case \"YieldExpression\":\n        if (!inFunction) facts.hasYield = true;\n        break;\n      case \"AssignmentExpression\":\n        if (node.left?.type === \"Identifier\" && names.has(node.left.name)) {\n          facts.assignsBinding = true;\n        }\n        break;\n      case \"UpdateExpression\":\n        if (node.argument?.type === \"Identifier\" && names.has(node.argument.name)) {\n          facts.assignsBinding = true;\n        }\n        break;\n    }\n    const isLoop = node.type === \"ForStatement\" || node.type === \"ForOfStatement\" || node.type === \"ForInStatement\" || node.type === \"WhileStatement\" || node.type === \"DoWhileStatement\";\n    const isBreakable = isLoop || node.type === \"SwitchStatement\";\n    eachChild(\n      node,\n      (c) => walk(c, inNestedBreakable || isBreakable, inNestedLoop || isLoop, inFunction)\n    );\n  }\n  walk(body, false, false, false);\n  return facts;\n}\nfunction collectBodyLexicalNames(node, out) {\n  if (!node || typeof node !== \"object\" || typeof node.type !== \"string\") return;\n  if (FUNCTION_TYPES.has(node.type) || node.type === \"ClassBody\") return;\n  if (node.type === \"VariableDeclaration\") {\n    if (node.kind === \"let\" || node.kind === \"const\") {\n      for (const d of node.declarations || []) collectPatternNames(d.id, out);\n    }\n    return;\n  }\n  if (node.type === \"ClassDeclaration\") {\n    if (node.id?.name) out.push(node.id.name);\n    return;\n  }\n  eachChild(node, (c) => collectBodyLexicalNames(c, out));\n}\nconst LOOP_TYPES = /* @__PURE__ */ new Set([\n  \"ForStatement\",\n  \"ForOfStatement\",\n  \"ForInStatement\",\n  \"WhileStatement\",\n  \"DoWhileStatement\"\n]);\nfunction headDeclaration(node) {\n  if (node.type === \"ForStatement\") return node.init;\n  if (node.type === \"ForOfStatement\" || node.type === \"ForInStatement\") return node.left;\n  return null;\n}\nfunction transformOnce(code, filename) {\n  const parsed = parseSync(filename, code, { lang: langFor(filename) });\n  if (!parsed?.program || parsed.errors?.length) return null;\n  const candidates = [];\n  function findLoops(node, insideCandidate) {\n    if (!node || typeof node !== \"object\") return;\n    let isCandidate = false;\n    if (LOOP_TYPES.has(node.type) && node.body) {\n      const names = [];\n      const decl = headDeclaration(node);\n      if (decl?.type === \"VariableDeclaration\" && (decl.kind === \"let\" || decl.kind === \"const\")) {\n        for (const d of decl.declarations || []) collectPatternNames(d.id, names);\n      }\n      const shared = [...names];\n      collectBodyLexicalNames(node.body, shared);\n      if (shared.length && capturesInClosure(node.body, new Set(shared))) {\n        isCandidate = true;\n        if (!insideCandidate) candidates.push({ node, names });\n      }\n    }\n    eachChild(node, (c) => findLoops(c, insideCandidate || isCandidate));\n  }\n  findLoops(parsed.program, false);\n  if (!candidates.length) return null;\n  const s = new MagicString(code);\n  let counter = 0;\n  let changed = false;\n  for (const { node, names } of candidates) {\n    const nameSet = new Set(names);\n    const facts = analyzeBody(node.body, nameSet);\n    if (facts.hasYield || facts.assignsBinding || facts.hasLabeledJump) continue;\n    const fnName = `_hermesLoop${counter++}`;\n    const params = names.join(\", \");\n    let bodyText = code.slice(node.body.start, node.body.end);\n    if (node.body.type !== \"BlockStatement\") {\n      bodyText = `{ ${bodyText} }`;\n    }\n    if (facts.hasBreak || facts.hasReturn || facts.hasContinue) {\n      bodyText = rewriteJumps(bodyText, node.body, code, nameSet);\n    }\n    const asyncKw = facts.hasAwait ? \"async \" : \"\";\n    const awaitKw = facts.hasAwait ? \"await \" : \"\";\n    let call = `${awaitKw}${fnName}(${params})`;\n    if (facts.hasBreak || facts.hasReturn) {\n      const checks = [];\n      if (facts.hasBreak) checks.push(\"if (_r === 1) break;\");\n      if (facts.hasReturn) checks.push(\"if (_r) return _r.v;\");\n      call = `{ var _r = ${call}; ${checks.join(\" \")} }`;\n    } else {\n      call = `{ ${call}; }`;\n    }\n    s.overwrite(node.body.start, node.body.end, call);\n    s.appendLeft(node.start, `{\nvar ${fnName} = ${asyncKw}(${params}) => ${bodyText};\n`);\n    s.appendLeft(node.end, \"\\n}\");\n    changed = true;\n  }\n  if (!changed) return null;\n  return {\n    code: s.toString(),\n    map: s.generateMap({ hires: true, source: filename, includeContent: false })\n  };\n}\nfunction rewriteJumps(bodyText, bodyNode, code, names) {\n  const offset = bodyNode.start;\n  const s = new MagicString(bodyText);\n  const pad = bodyNode.type === \"BlockStatement\" ? 0 : 2;\n  function walk(node, inNestedBreakable, inNestedLoop, inFunction) {\n    if (!node || typeof node !== \"object\") return;\n    if (FUNCTION_TYPES.has(node.type)) {\n      eachChild(node, (c) => walk(c, inNestedBreakable, inNestedLoop, true));\n      return;\n    }\n    if (node.type === \"BreakStatement\" && !node.label && !inNestedBreakable) {\n      s.overwrite(node.start - offset + pad, node.end - offset + pad, \"return 1;\");\n      return;\n    }\n    if (node.type === \"ContinueStatement\" && !node.label && !inNestedLoop) {\n      s.overwrite(node.start - offset + pad, node.end - offset + pad, \"return;\");\n      return;\n    }\n    if (node.type === \"ReturnStatement\" && !inFunction) {\n      const arg = node.argument;\n      const replacement = arg ? `return { v: ${code.slice(arg.start, arg.end)} };` : \"return { v: undefined };\";\n      s.overwrite(node.start - offset + pad, node.end - offset + pad, replacement);\n      return;\n    }\n    const isLoop = node.type === \"ForStatement\" || node.type === \"ForOfStatement\" || node.type === \"ForInStatement\" || node.type === \"WhileStatement\" || node.type === \"DoWhileStatement\";\n    const isBreakable = isLoop || node.type === \"SwitchStatement\";\n    eachChild(\n      node,\n      (c) => walk(c, inNestedBreakable || isBreakable, inNestedLoop || isLoop, inFunction)\n    );\n  }\n  walk(bodyNode, false, false, false);\n  return s.toString();\n}\nfunction transformHermesLoops(code, filename) {\n  if (!LOOP_RE.test(code) || !LEXICAL_RE.test(code)) return null;\n  let current = code;\n  const maps = [];\n  for (let i = 0; i < 10; i++) {\n    const next = transformOnce(current, filename);\n    if (!next) break;\n    current = next.code;\n    maps.push(next.map);\n  }\n  return maps.length ? { code: current, maps } : null;\n}\nexport {\n  transformHermesLoops\n};\n//# sourceMappingURL=transformHermesLoops.js.map\n"],"mappings":";;;;AAEA,MAAM,UAAU;AAChB,MAAM,aAAa;AACnB,SAAS,QAAQ,UAAU;CACzB,MAAM,MAAM,SAAS,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK;CACvD,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ,OAAO,OAAO;CAC3D,IAAI,QAAQ,OAAO,OA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