@hyperframes/parsers 0.7.68 → 0.7.69

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.
@@ -785,6 +785,21 @@ var SCOPE_NODE_TYPES = /* @__PURE__ */ new Set([
785
785
  "FunctionExpression",
786
786
  "ArrowFunctionExpression"
787
787
  ]);
788
+ function parseProgram(script) {
789
+ try {
790
+ return acorn.parse(script, {
791
+ ecmaVersion: "latest",
792
+ sourceType: "script",
793
+ locations: true
794
+ });
795
+ } catch {
796
+ return acorn.parse(script, {
797
+ ecmaVersion: "latest",
798
+ sourceType: "module",
799
+ locations: true
800
+ });
801
+ }
802
+ }
788
803
  var CONST_NODES = /* @__PURE__ */ Symbol("hf.constNodes");
789
804
  function constNodesOf(scope) {
790
805
  return scope[CONST_NODES];
@@ -1899,11 +1914,7 @@ function assignStableIds(anims) {
1899
1914
  }
1900
1915
  function parseGsapScriptAcorn(script) {
1901
1916
  try {
1902
- const ast = acorn.parse(script, {
1903
- ecmaVersion: "latest",
1904
- sourceType: "script",
1905
- locations: true
1906
- });
1917
+ const ast = parseProgram(script);
1907
1918
  const scope = collectScopeBindings(ast);
1908
1919
  const detection = findTimelineVar(ast, scope);
1909
1920
  const ref = detection.ref ?? { kind: "identifier", name: "tl" };