@hyperframes/parsers 0.7.68 → 0.7.70
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/gsapParserAcorn.d.ts +5 -1
- package/dist/gsapParserAcorn.js +83 -5
- package/dist/gsapParserAcorn.js.map +1 -1
- package/dist/gsapParserExports.js +16 -5
- package/dist/gsapParserExports.js.map +1 -1
- package/dist/gsapWriterAcorn.js.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -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 =
|
|
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" };
|