@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.
- 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
package/dist/index.js
CHANGED
|
@@ -874,6 +874,21 @@ var SCOPE_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
|
874
874
|
"FunctionExpression",
|
|
875
875
|
"ArrowFunctionExpression"
|
|
876
876
|
]);
|
|
877
|
+
function parseProgram(script) {
|
|
878
|
+
try {
|
|
879
|
+
return acorn.parse(script, {
|
|
880
|
+
ecmaVersion: "latest",
|
|
881
|
+
sourceType: "script",
|
|
882
|
+
locations: true
|
|
883
|
+
});
|
|
884
|
+
} catch {
|
|
885
|
+
return acorn.parse(script, {
|
|
886
|
+
ecmaVersion: "latest",
|
|
887
|
+
sourceType: "module",
|
|
888
|
+
locations: true
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
}
|
|
877
892
|
var CONST_NODES = /* @__PURE__ */ Symbol("hf.constNodes");
|
|
878
893
|
function constNodesOf(scope) {
|
|
879
894
|
return scope[CONST_NODES];
|
|
@@ -2019,11 +2034,7 @@ function parseGsapScriptAcornForWrite(script) {
|
|
|
2019
2034
|
}
|
|
2020
2035
|
function parseGsapScriptAcorn(script) {
|
|
2021
2036
|
try {
|
|
2022
|
-
const ast =
|
|
2023
|
-
ecmaVersion: "latest",
|
|
2024
|
-
sourceType: "script",
|
|
2025
|
-
locations: true
|
|
2026
|
-
});
|
|
2037
|
+
const ast = parseProgram(script);
|
|
2027
2038
|
const scope = collectScopeBindings(ast);
|
|
2028
2039
|
const detection = findTimelineVar(ast, scope);
|
|
2029
2040
|
const ref = detection.ref ?? { kind: "identifier", name: "tl" };
|