@hyperframes/parsers 0.8.75 → 0.8.76

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.
@@ -1796,7 +1796,16 @@ function parseGsapScriptAcornForWrite(script) {
1796
1796
  return null;
1797
1797
  }
1798
1798
  }
1799
+ var PARSE_MEMO_ENTRIES = 4;
1800
+ var parseMemo = /* @__PURE__ */ new Map();
1799
1801
  function parseGsapScriptAcorn(script) {
1802
+ const parsed = parseMemo.get(script) ?? parseGsapScriptAcornUncached(script);
1803
+ parseMemo.delete(script);
1804
+ parseMemo.set(script, parsed);
1805
+ if (parseMemo.size > PARSE_MEMO_ENTRIES) parseMemo.delete(parseMemo.keys().next().value);
1806
+ return structuredClone(parsed);
1807
+ }
1808
+ function parseGsapScriptAcornUncached(script) {
1800
1809
  try {
1801
1810
  const ast = parseProgram(script);
1802
1811
  const scope = collectScopeBindings(ast);