@tslite/core 0.3.0 → 0.5.0

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/builders.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var o=class extends Error{constructor(t,n,i){super(n),this.name="TSLiteError",this.code=t,this.details=i;}};var s="#ast";var p=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","FunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","NewExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","TaggedTemplateExpression","SequenceExpression","ChainExpression","JSXElement","JSXFragment","Program"];function l(e){return p.includes(e)}function m(e){return new o("invalid-ast-entry",`Invalid #ast entry type: "${e}". The #ast marker is used to embed executable logic inside JSON. Only expression types that can be used as VALUES are allowed: ${p.join(", ")}. "${e}" is not a valid entry point because it cannot be used as a value in JSON.`,{type:e,validTypes:p})}var b=e=>{let{type:t,...n}=e;if(!t||typeof t!="string")throw new o("missing-node-type","ast() requires a node with a valid type property");if(!l(t))throw m(t);return {[s]:t,...n}},A=e=>{if(!e||typeof e!="object"||!(s in e))return e;let{[s]:t,...n}=e;return {type:t,...n}},J=e=>({type:"Identifier",name:e}),X=e=>e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:{type:"Literal",value:e},C=e=>({type:"ArrayExpression",elements:e}),h=e=>({type:"ObjectExpression",properties:e}),D=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),w=e=>({type:"SpreadElement",argument:e}),I=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),T=(e,t)=>({type:"NewExpression",callee:e,arguments:t}),P=(e,t,n=false,i=false)=>({type:"MemberExpression",object:e,property:t,computed:n,optional:i}),F=e=>({type:"ChainExpression",expression:e}),O=(e,t,n)=>({type:"BinaryExpression",left:t,right:n,operator:e}),N=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),L=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),k=(e,t,n=false)=>({type:"UpdateExpression",operator:e,argument:t,prefix:n}),B=(e,t,n)=>({type:"AssignmentExpression",operator:e,left:t,right:n}),R=(e,t,n)=>({type:"ConditionalExpression",test:e,consequent:t,alternate:n}),j=e=>({type:"AwaitExpression",argument:e}),M=(e,t=false)=>({type:"TemplateElement",value:e,tail:t}),V=(e,t)=>({type:"TemplateLiteral",quasis:e,expressions:t}),v=(e,t,n=false,i=false)=>({type:"ArrowFunctionExpression",expression:t.type!="BlockStatement",generator:i,async:n,params:e,body:t}),q=(e=null,t,n,i=false,a=false)=>({type:"FunctionExpression",id:e,params:t,body:n,async:i,generator:a}),U=(e,t,n,i=false,a=false)=>({type:"FunctionDeclaration",id:e,params:t,body:n,generator:i,async:a}),_=e=>({type:"BlockStatement",body:e}),W=e=>({type:"ExpressionStatement",expression:e}),Y=e=>({type:"ReturnStatement",argument:e}),H=(e,t,n=null)=>({type:"IfStatement",test:e,consequent:t,alternate:n}),K=(e,t)=>({type:"SwitchStatement",cases:t,discriminant:e}),$=(e,t)=>({type:"SwitchCase",consequent:t,test:e}),z=e=>({type:"ThrowStatement",argument:e}),Z=(e,t,n=null)=>({type:"TryStatement",block:e,handler:t,finalizer:n}),G=(e,t)=>({type:"CatchClause",param:e,body:t}),Q=(e=null)=>({type:"BreakStatement",label:e}),ee=(e=null)=>({type:"ContinueStatement",label:e}),te=()=>({type:"EmptyStatement"}),ne=(e,t,n,i)=>({type:"ForStatement",init:e,test:t,update:n,body:i}),re=(e,t,n)=>({type:"ForInStatement",body:n,left:e,right:t}),ie=(e,t,n,i=false)=>({type:"ForOfStatement",body:n,left:e,right:t,await:i}),oe=(e,t)=>({type:"WhileStatement",test:e,body:t}),se=(e,t)=>({type:"DoWhileStatement",body:e,test:t}),ae=(e,t)=>({type:"VariableDeclaration",declarations:t,kind:e}),pe=(e,t=null)=>({type:"VariableDeclarator",id:e,init:t}),le=e=>({type:"ObjectPattern",properties:e}),me=e=>({type:"ArrayPattern",elements:e}),xe=(e,t=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:t,shorthand:n,computed:i,method:false}),ce=e=>({type:"RestElement",argument:e}),Ee=(e,t)=>({type:"AssignmentPattern",left:e,right:t}),Se=(e,t="script")=>({type:"Program",body:e,sourceType:t}),x=e=>({type:"JsonExpression",body:e}),ye=(e,t)=>({type:"ImportDeclaration",specifiers:e,source:t}),de=(e,t)=>({type:"ImportSpecifier",imported:e,local:t}),ue=e=>({type:"ImportDefaultSpecifier",local:e}),ge=e=>({type:"ImportNamespaceSpecifier",local:e}),fe=(e=null,t=[],n=null)=>({type:"ExportNamedDeclaration",declaration:e,specifiers:t,source:n}),be=e=>({type:"ExportDefaultDeclaration",declaration:e}),Ae=(e,t=e)=>({type:"ExportSpecifier",local:e,exported:t}),Je=e=>({type:"JSXIdentifier",name:e}),Xe=(e,t)=>({type:"JSXMemberExpression",object:e,property:t}),Ce=(e,t)=>({type:"JSXNamespacedName",namespace:e,name:t}),he=()=>({type:"JSXEmptyExpression"}),De=e=>({type:"JSXExpressionContainer",expression:e}),we=e=>({type:"JSXSpreadAttribute",argument:e}),Ie=(e,t=null)=>({type:"JSXAttribute",name:e,value:t}),Te=(e,t=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:t,selfClosing:n}),Pe=e=>({type:"JSXClosingElement",name:e}),c=()=>({type:"JSXOpeningFragment"}),E=()=>({type:"JSXClosingFragment"}),Fe=(e,t=e)=>({type:"JSXText",value:e,raw:t}),Oe=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),Ne=(e=[],t=c(),n=E())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),Le=x;exports.arrayExpression=C;exports.arrayPattern=me;exports.arrowFunctionExpression=v;exports.assignmentExpression=B;exports.assignmentPattern=Ee;exports.assignmentProperty=xe;exports.ast=b;exports.awaitExpression=j;exports.binaryExpression=O;exports.blockStatement=_;exports.breakStatement=Q;exports.callExpression=I;exports.catchClause=G;exports.chainExpression=F;exports.conditionalExpression=R;exports.continueStatement=ee;exports.doWhileStatement=se;exports.emptyStatement=te;exports.exportDefaultDeclaration=be;exports.exportNamedDeclaration=fe;exports.exportSpecifier=Ae;exports.expressionStatement=W;exports.forInStatement=re;exports.forOfStatement=ie;exports.forStatement=ne;exports.fromAstMarker=A;exports.functionDeclaration=U;exports.functionExpression=q;exports.identifier=J;exports.ifStatement=H;exports.importDeclaration=ye;exports.importDefaultSpecifier=ue;exports.importNamespaceSpecifier=ge;exports.importSpecifier=de;exports.json=Le;exports.jsonExpression=x;exports.jsxAttribute=Ie;exports.jsxClosingElement=Pe;exports.jsxClosingFragment=E;exports.jsxElement=Oe;exports.jsxEmptyExpression=he;exports.jsxExpressionContainer=De;exports.jsxFragment=Ne;exports.jsxIdentifier=Je;exports.jsxMemberExpression=Xe;exports.jsxNamespacedName=Ce;exports.jsxOpeningElement=Te;exports.jsxOpeningFragment=c;exports.jsxSpreadAttribute=we;exports.jsxText=Fe;exports.literal=X;exports.logicalExpression=N;exports.memberExpression=P;exports.newExpression=T;exports.objectExpression=h;exports.objectPattern=le;exports.program=Se;exports.property=D;exports.restElement=ce;exports.returnStatement=Y;exports.spreadElement=w;exports.switchCase=$;exports.switchStatement=K;exports.templateElement=M;exports.templateLiteral=V;exports.throwStatement=z;exports.tryStatement=Z;exports.unaryExpression=L;exports.updateExpression=k;exports.variableDeclaration=ae;exports.variableDeclarator=pe;exports.whileStatement=oe;
1
+ 'use strict';var o=class extends Error{constructor(t,n,i){super(n),this.name="TSLiteError",this.code=t,this.details=i;}};var a=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","FunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","NewExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","TaggedTemplateExpression","SequenceExpression","ChainExpression","JSXElement","JSXFragment","Program"];function p(e){return a.includes(e)}function l(e){return new o("invalid-expression-entry",`Invalid #expr entry type: "${e}". The #expr marker is used to embed executable logic inside JSON. Only expression types that can be used as VALUES are allowed: ${a.join(", ")}. "${e}" is not a valid entry point because it cannot be used as a value in JSON.`,{type:e,validTypes:a})}var f=e=>{let{type:t,...n}=e;if(!t||typeof t!="string")throw new o("missing-node-type","expr() requires a node with a valid type property");if(!p(t))throw l(t);return {"#expr":t,...n}},b=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":t,...n}=e;return {type:t,...n}},J=e=>({type:"Identifier",name:e}),X=e=>e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:{type:"Literal",value:e},A=e=>({type:"ArrayExpression",elements:e}),C=e=>({type:"ObjectExpression",properties:e}),D=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),h=e=>({type:"SpreadElement",argument:e}),I=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),w=(e,t)=>({type:"NewExpression",callee:e,arguments:t}),T=(e,t,n=false,i=false)=>({type:"MemberExpression",object:e,property:t,computed:n,optional:i}),P=e=>({type:"ChainExpression",expression:e}),F=(e,t,n)=>({type:"BinaryExpression",left:t,right:n,operator:e}),O=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),N=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),L=(e,t,n=false)=>({type:"UpdateExpression",operator:e,argument:t,prefix:n}),k=(e,t,n)=>({type:"AssignmentExpression",operator:e,left:t,right:n}),B=(e,t,n)=>({type:"ConditionalExpression",test:e,consequent:t,alternate:n}),R=e=>({type:"AwaitExpression",argument:e}),j=(e,t=false)=>({type:"TemplateElement",value:e,tail:t}),M=(e,t)=>({type:"TemplateLiteral",quasis:e,expressions:t}),V=(e,t,n=false,i=false)=>({type:"ArrowFunctionExpression",expression:t.type!="BlockStatement",generator:i,async:n,params:e,body:t}),v=(e=null,t,n,i=false,s=false)=>({type:"FunctionExpression",id:e,params:t,body:n,async:i,generator:s}),q=(e,t,n,i=false,s=false)=>({type:"FunctionDeclaration",id:e,params:t,body:n,generator:i,async:s}),U=e=>({type:"BlockStatement",body:e}),W=e=>({type:"ExpressionStatement",expression:e}),_=e=>({type:"ReturnStatement",argument:e}),Y=(e,t,n=null)=>({type:"IfStatement",test:e,consequent:t,alternate:n}),H=(e,t)=>({type:"SwitchStatement",cases:t,discriminant:e}),$=(e,t)=>({type:"SwitchCase",consequent:t,test:e}),z=e=>({type:"ThrowStatement",argument:e}),K=(e,t,n=null)=>({type:"TryStatement",block:e,handler:t,finalizer:n}),Z=(e,t)=>({type:"CatchClause",param:e,body:t}),G=(e=null)=>({type:"BreakStatement",label:e}),Q=(e=null)=>({type:"ContinueStatement",label:e}),ee=()=>({type:"EmptyStatement"}),te=(e,t,n,i)=>({type:"ForStatement",init:e,test:t,update:n,body:i}),ne=(e,t,n)=>({type:"ForInStatement",body:n,left:e,right:t}),re=(e,t,n,i=false)=>({type:"ForOfStatement",body:n,left:e,right:t,await:i}),ie=(e,t)=>({type:"WhileStatement",test:e,body:t}),oe=(e,t)=>({type:"DoWhileStatement",body:e,test:t}),se=(e,t)=>({type:"VariableDeclaration",declarations:t,kind:e}),ae=(e,t=null)=>({type:"VariableDeclarator",id:e,init:t}),pe=e=>({type:"ObjectPattern",properties:e}),le=e=>({type:"ArrayPattern",elements:e}),me=(e,t=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:t,shorthand:n,computed:i,method:false}),xe=e=>({type:"RestElement",argument:e}),ce=(e,t)=>({type:"AssignmentPattern",left:e,right:t}),Ee=(e,t="script")=>({type:"Program",body:e,sourceType:t}),m=e=>({type:"JsonExpression",body:e}),Se=(e,t)=>({type:"ImportDeclaration",specifiers:e,source:t}),ye=(e,t)=>({type:"ImportSpecifier",imported:e,local:t}),de=e=>({type:"ImportDefaultSpecifier",local:e}),ue=e=>({type:"ImportNamespaceSpecifier",local:e}),ge=(e=null,t=[],n=null)=>({type:"ExportNamedDeclaration",declaration:e,specifiers:t,source:n}),fe=e=>({type:"ExportDefaultDeclaration",declaration:e}),be=(e,t=e)=>({type:"ExportSpecifier",local:e,exported:t}),Je=e=>({type:"JSXIdentifier",name:e}),Xe=(e,t)=>({type:"JSXMemberExpression",object:e,property:t}),Ae=(e,t)=>({type:"JSXNamespacedName",namespace:e,name:t}),Ce=()=>({type:"JSXEmptyExpression"}),De=e=>({type:"JSXExpressionContainer",expression:e}),he=e=>({type:"JSXSpreadAttribute",argument:e}),Ie=(e,t=null)=>({type:"JSXAttribute",name:e,value:t}),we=(e,t=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:t,selfClosing:n}),Te=e=>({type:"JSXClosingElement",name:e}),x=()=>({type:"JSXOpeningFragment"}),c=()=>({type:"JSXClosingFragment"}),Pe=(e,t=e)=>({type:"JSXText",value:e,raw:t}),Fe=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),Oe=(e=[],t=x(),n=c())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),Ne=m;exports.arrayExpression=A;exports.arrayPattern=le;exports.arrowFunctionExpression=V;exports.assignmentExpression=k;exports.assignmentPattern=ce;exports.assignmentProperty=me;exports.awaitExpression=R;exports.binaryExpression=F;exports.blockStatement=U;exports.breakStatement=G;exports.callExpression=I;exports.catchClause=Z;exports.chainExpression=P;exports.conditionalExpression=B;exports.continueStatement=Q;exports.doWhileStatement=oe;exports.emptyStatement=ee;exports.exportDefaultDeclaration=fe;exports.exportNamedDeclaration=ge;exports.exportSpecifier=be;exports.expr=f;exports.expressionStatement=W;exports.forInStatement=ne;exports.forOfStatement=re;exports.forStatement=te;exports.fromExprMarker=b;exports.functionDeclaration=q;exports.functionExpression=v;exports.identifier=J;exports.ifStatement=Y;exports.importDeclaration=Se;exports.importDefaultSpecifier=de;exports.importNamespaceSpecifier=ue;exports.importSpecifier=ye;exports.json=Ne;exports.jsonExpression=m;exports.jsxAttribute=Ie;exports.jsxClosingElement=Te;exports.jsxClosingFragment=c;exports.jsxElement=Fe;exports.jsxEmptyExpression=Ce;exports.jsxExpressionContainer=De;exports.jsxFragment=Oe;exports.jsxIdentifier=Je;exports.jsxMemberExpression=Xe;exports.jsxNamespacedName=Ae;exports.jsxOpeningElement=we;exports.jsxOpeningFragment=x;exports.jsxSpreadAttribute=he;exports.jsxText=Pe;exports.literal=X;exports.logicalExpression=O;exports.memberExpression=T;exports.newExpression=w;exports.objectExpression=C;exports.objectPattern=pe;exports.program=Ee;exports.property=D;exports.restElement=xe;exports.returnStatement=_;exports.spreadElement=h;exports.switchCase=$;exports.switchStatement=H;exports.templateElement=j;exports.templateLiteral=M;exports.throwStatement=z;exports.tryStatement=K;exports.unaryExpression=N;exports.updateExpression=L;exports.variableDeclaration=se;exports.variableDeclarator=ae;exports.whileStatement=ie;
@@ -1 +1 @@
1
- export { c8 as arrayExpression, c9 as arrayPattern, ca as arrowFunctionExpression, cb as assignmentExpression, cc as assignmentPattern, cd as assignmentProperty, c3 as ast, ce as awaitExpression, cf as binaryExpression, cg as blockStatement, ch as breakStatement, ci as callExpression, cj as catchClause, ck as chainExpression, cl as conditionalExpression, cm as continueStatement, cn as doWhileStatement, co as emptyStatement, cp as exportDefaultDeclaration, cq as exportNamedDeclaration, cr as exportSpecifier, cs as expressionStatement, ct as forInStatement, cu as forOfStatement, cv as forStatement, c4 as fromAstMarker, cw as functionDeclaration, cx as functionExpression, cy as identifier, cz as ifStatement, cA as importDeclaration, cB as importDefaultSpecifier, cC as importNamespaceSpecifier, cD as importSpecifier, c5 as json, c6 as jsonExpression, cE as jsxAttribute, cF as jsxClosingElement, cG as jsxClosingFragment, cH as jsxElement, cI as jsxEmptyExpression, cJ as jsxExpressionContainer, cK as jsxFragment, cL as jsxIdentifier, cM as jsxMemberExpression, cN as jsxNamespacedName, cO as jsxOpeningElement, cP as jsxOpeningFragment, cQ as jsxSpreadAttribute, cR as jsxText, cS as literal, cT as logicalExpression, cU as memberExpression, cV as newExpression, cW as objectExpression, cX as objectPattern, cY as program, cZ as property, c_ as restElement, c$ as returnStatement, d0 as spreadElement, d1 as switchCase, d2 as switchStatement, d3 as templateElement, d4 as templateLiteral, d5 as throwStatement, d6 as tryStatement, d7 as unaryExpression, d8 as updateExpression, d9 as variableDeclaration, da as variableDeclarator, db as whileStatement } from './index-CcVx_Zur.cjs';
1
+ export { ct as arrayExpression, cu as arrayPattern, cv as arrowFunctionExpression, cw as assignmentExpression, cx as assignmentPattern, cy as assignmentProperty, cz as awaitExpression, cA as binaryExpression, cB as blockStatement, cC as breakStatement, cD as callExpression, cE as catchClause, cF as chainExpression, cG as conditionalExpression, cH as continueStatement, cI as doWhileStatement, cJ as emptyStatement, cK as exportDefaultDeclaration, cL as exportNamedDeclaration, cM as exportSpecifier, co as expr, cN as expressionStatement, cO as forInStatement, cP as forOfStatement, cQ as forStatement, cp as fromExprMarker, cR as functionDeclaration, cS as functionExpression, cT as identifier, cU as ifStatement, cV as importDeclaration, cW as importDefaultSpecifier, cX as importNamespaceSpecifier, cY as importSpecifier, cq as json, cr as jsonExpression, cZ as jsxAttribute, c_ as jsxClosingElement, c$ as jsxClosingFragment, d0 as jsxElement, d1 as jsxEmptyExpression, d2 as jsxExpressionContainer, d3 as jsxFragment, d4 as jsxIdentifier, d5 as jsxMemberExpression, d6 as jsxNamespacedName, d7 as jsxOpeningElement, d8 as jsxOpeningFragment, d9 as jsxSpreadAttribute, da as jsxText, db as literal, dc as logicalExpression, dd as memberExpression, de as newExpression, df as objectExpression, dg as objectPattern, dh as program, di as property, dj as restElement, dk as returnStatement, dl as spreadElement, dm as switchCase, dn as switchStatement, dp as templateElement, dq as templateLiteral, dr as throwStatement, ds as tryStatement, dt as unaryExpression, du as updateExpression, dv as variableDeclaration, dw as variableDeclarator, dx as whileStatement } from './index-CFG9pxqO.cjs';
@@ -1 +1 @@
1
- export { c8 as arrayExpression, c9 as arrayPattern, ca as arrowFunctionExpression, cb as assignmentExpression, cc as assignmentPattern, cd as assignmentProperty, c3 as ast, ce as awaitExpression, cf as binaryExpression, cg as blockStatement, ch as breakStatement, ci as callExpression, cj as catchClause, ck as chainExpression, cl as conditionalExpression, cm as continueStatement, cn as doWhileStatement, co as emptyStatement, cp as exportDefaultDeclaration, cq as exportNamedDeclaration, cr as exportSpecifier, cs as expressionStatement, ct as forInStatement, cu as forOfStatement, cv as forStatement, c4 as fromAstMarker, cw as functionDeclaration, cx as functionExpression, cy as identifier, cz as ifStatement, cA as importDeclaration, cB as importDefaultSpecifier, cC as importNamespaceSpecifier, cD as importSpecifier, c5 as json, c6 as jsonExpression, cE as jsxAttribute, cF as jsxClosingElement, cG as jsxClosingFragment, cH as jsxElement, cI as jsxEmptyExpression, cJ as jsxExpressionContainer, cK as jsxFragment, cL as jsxIdentifier, cM as jsxMemberExpression, cN as jsxNamespacedName, cO as jsxOpeningElement, cP as jsxOpeningFragment, cQ as jsxSpreadAttribute, cR as jsxText, cS as literal, cT as logicalExpression, cU as memberExpression, cV as newExpression, cW as objectExpression, cX as objectPattern, cY as program, cZ as property, c_ as restElement, c$ as returnStatement, d0 as spreadElement, d1 as switchCase, d2 as switchStatement, d3 as templateElement, d4 as templateLiteral, d5 as throwStatement, d6 as tryStatement, d7 as unaryExpression, d8 as updateExpression, d9 as variableDeclaration, da as variableDeclarator, db as whileStatement } from './index-CcVx_Zur.js';
1
+ export { ct as arrayExpression, cu as arrayPattern, cv as arrowFunctionExpression, cw as assignmentExpression, cx as assignmentPattern, cy as assignmentProperty, cz as awaitExpression, cA as binaryExpression, cB as blockStatement, cC as breakStatement, cD as callExpression, cE as catchClause, cF as chainExpression, cG as conditionalExpression, cH as continueStatement, cI as doWhileStatement, cJ as emptyStatement, cK as exportDefaultDeclaration, cL as exportNamedDeclaration, cM as exportSpecifier, co as expr, cN as expressionStatement, cO as forInStatement, cP as forOfStatement, cQ as forStatement, cp as fromExprMarker, cR as functionDeclaration, cS as functionExpression, cT as identifier, cU as ifStatement, cV as importDeclaration, cW as importDefaultSpecifier, cX as importNamespaceSpecifier, cY as importSpecifier, cq as json, cr as jsonExpression, cZ as jsxAttribute, c_ as jsxClosingElement, c$ as jsxClosingFragment, d0 as jsxElement, d1 as jsxEmptyExpression, d2 as jsxExpressionContainer, d3 as jsxFragment, d4 as jsxIdentifier, d5 as jsxMemberExpression, d6 as jsxNamespacedName, d7 as jsxOpeningElement, d8 as jsxOpeningFragment, d9 as jsxSpreadAttribute, da as jsxText, db as literal, dc as logicalExpression, dd as memberExpression, de as newExpression, df as objectExpression, dg as objectPattern, dh as program, di as property, dj as restElement, dk as returnStatement, dl as spreadElement, dm as switchCase, dn as switchStatement, dp as templateElement, dq as templateLiteral, dr as throwStatement, ds as tryStatement, dt as unaryExpression, du as updateExpression, dv as variableDeclaration, dw as variableDeclarator, dx as whileStatement } from './index-CFG9pxqO.js';
package/dist/builders.js CHANGED
@@ -1 +1 @@
1
- export{o as arrayExpression,aa as arrayPattern,F as arrowFunctionExpression,A as assignmentExpression,da as assignmentPattern,ba as assignmentProperty,k as ast,C as awaitExpression,w as binaryExpression,I as blockStatement,R as breakStatement,s as callExpression,Q as catchClause,v as chainExpression,B as conditionalExpression,S as continueStatement,Y as doWhileStatement,T as emptyStatement,la as exportDefaultDeclaration,ka as exportNamedDeclaration,ma as exportSpecifier,J as expressionStatement,V as forInStatement,W as forOfStatement,U as forStatement,l as fromAstMarker,H as functionDeclaration,G as functionExpression,m as identifier,L as ifStatement,ga as importDeclaration,ia as importDefaultSpecifier,ja as importNamespaceSpecifier,ha as importSpecifier,Ba as json,fa as jsonExpression,ta as jsxAttribute,va as jsxClosingElement,xa as jsxClosingFragment,za as jsxElement,qa as jsxEmptyExpression,ra as jsxExpressionContainer,Aa as jsxFragment,na as jsxIdentifier,oa as jsxMemberExpression,pa as jsxNamespacedName,ua as jsxOpeningElement,wa as jsxOpeningFragment,sa as jsxSpreadAttribute,ya as jsxText,n as literal,x as logicalExpression,u as memberExpression,t as newExpression,p as objectExpression,$ as objectPattern,ea as program,q as property,ca as restElement,K as returnStatement,r as spreadElement,N as switchCase,M as switchStatement,D as templateElement,E as templateLiteral,O as throwStatement,P as tryStatement,y as unaryExpression,z as updateExpression,Z as variableDeclaration,_ as variableDeclarator,X as whileStatement}from'./chunk-JQLO5K6J.js';
1
+ export{n as arrayExpression,$ as arrayPattern,E as arrowFunctionExpression,z as assignmentExpression,ca as assignmentPattern,aa as assignmentProperty,B as awaitExpression,v as binaryExpression,H as blockStatement,Q as breakStatement,r as callExpression,P as catchClause,u as chainExpression,A as conditionalExpression,R as continueStatement,X as doWhileStatement,S as emptyStatement,ka as exportDefaultDeclaration,ja as exportNamedDeclaration,la as exportSpecifier,j as expr,I as expressionStatement,U as forInStatement,V as forOfStatement,T as forStatement,k as fromExprMarker,G as functionDeclaration,F as functionExpression,l as identifier,K as ifStatement,fa as importDeclaration,ha as importDefaultSpecifier,ia as importNamespaceSpecifier,ga as importSpecifier,Aa as json,ea as jsonExpression,sa as jsxAttribute,ua as jsxClosingElement,wa as jsxClosingFragment,ya as jsxElement,pa as jsxEmptyExpression,qa as jsxExpressionContainer,za as jsxFragment,ma as jsxIdentifier,na as jsxMemberExpression,oa as jsxNamespacedName,ta as jsxOpeningElement,va as jsxOpeningFragment,ra as jsxSpreadAttribute,xa as jsxText,m as literal,w as logicalExpression,t as memberExpression,s as newExpression,o as objectExpression,_ as objectPattern,da as program,p as property,ba as restElement,J as returnStatement,q as spreadElement,M as switchCase,L as switchStatement,C as templateElement,D as templateLiteral,N as throwStatement,O as tryStatement,x as unaryExpression,y as updateExpression,Y as variableDeclaration,Z as variableDeclarator,W as whileStatement}from'./chunk-ZEL34C7U.js';
@@ -0,0 +1 @@
1
+ var E=Object.defineProperty;var S=(e,t)=>{for(var n in t)E(e,n,{get:t[n],enumerable:true});};var Pe={};S(Pe,{arrayExpression:()=>f,arrayPattern:()=>oe,arrowFunctionExpression:()=>B,assignmentExpression:()=>F,assignmentPattern:()=>pe,assignmentProperty:()=>se,awaitExpression:()=>N,binaryExpression:()=>I,blockStatement:()=>M,breakStatement:()=>$,callExpression:()=>A,catchClause:()=>H,chainExpression:()=>h,conditionalExpression:()=>O,continueStatement:()=>z,doWhileStatement:()=>te,emptyStatement:()=>K,exportDefaultDeclaration:()=>ye,exportNamedDeclaration:()=>Se,exportSpecifier:()=>de,expr:()=>y,expressionStatement:()=>V,forInStatement:()=>G,forOfStatement:()=>Q,forStatement:()=>Z,fromExprMarker:()=>d,functionDeclaration:()=>j,functionExpression:()=>R,identifier:()=>u,ifStatement:()=>q,importDeclaration:()=>me,importDefaultSpecifier:()=>ce,importNamespaceSpecifier:()=>Ee,importSpecifier:()=>xe,json:()=>Te,jsonExpression:()=>m,jsxAttribute:()=>Ae,jsxClosingElement:()=>De,jsxClosingFragment:()=>c,jsxElement:()=>Ie,jsxEmptyExpression:()=>be,jsxExpressionContainer:()=>Je,jsxFragment:()=>we,jsxIdentifier:()=>ue,jsxMemberExpression:()=>ge,jsxNamespacedName:()=>fe,jsxOpeningElement:()=>Ce,jsxOpeningFragment:()=>x,jsxSpreadAttribute:()=>Xe,jsxText:()=>he,literal:()=>g,logicalExpression:()=>w,memberExpression:()=>D,newExpression:()=>C,objectExpression:()=>b,objectPattern:()=>ie,program:()=>le,property:()=>J,restElement:()=>ae,returnStatement:()=>v,spreadElement:()=>X,switchCase:()=>W,switchStatement:()=>U,templateElement:()=>L,templateLiteral:()=>k,throwStatement:()=>_,tryStatement:()=>Y,unaryExpression:()=>T,updateExpression:()=>P,variableDeclaration:()=>ne,variableDeclarator:()=>re,whileStatement:()=>ee});var o=class extends Error{constructor(t,n,i){super(n),this.name="TSLiteError",this.code=t,this.details=i;}};var Le=/^[a-zA-Z_][a-zA-Z_0-9]*$/,a=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","FunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","NewExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","TaggedTemplateExpression","SequenceExpression","ChainExpression","JSXElement","JSXFragment","Program"];function p(e){return a.includes(e)}function l(e){return new o("invalid-expression-entry",`Invalid #expr entry type: "${e}". The #expr marker is used to embed executable logic inside JSON. Only expression types that can be used as VALUES are allowed: ${a.join(", ")}. "${e}" is not a valid entry point because it cannot be used as a value in JSON.`,{type:e,validTypes:a})}var ke={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JsonExpression:[],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],JSXElement:["openingElement","children","closingElement"],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningElement:["name","attributes"],JSXClosingElement:["name"],JSXOpeningFragment:[],JSXClosingFragment:[],JSXAttribute:["name","value"],JSXSpreadAttribute:["argument"],JSXExpressionContainer:["expression"],JSXEmptyExpression:[],JSXText:[],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],TSAsExpression:["expression"],TSTypeAliasDeclaration:["id"]},r={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,Coalesce:3,LogicalOR:4,LogicalAND:5,BitwiseOR:6,BitwiseXOR:7,BitwiseAND:8,Equality:9,Relational:10,BitwiseSHIFT:11,Additive:12,Multiplicative:13,Exponentiation:14,Await:15,Unary:15,Postfix:16,OptionalChaining:17,Call:18,New:19,TaggedTemplate:20,Member:21,Primary:22},Be={"??":r.Coalesce,"||":r.LogicalOR,"&&":r.LogicalAND,"|":r.BitwiseOR,"^":r.BitwiseXOR,"&":r.BitwiseAND,"==":r.Equality,"!=":r.Equality,"===":r.Equality,"!==":r.Equality,is:r.Equality,isnt:r.Equality,"<":r.Relational,">":r.Relational,"<=":r.Relational,">=":r.Relational,in:r.Relational,instanceof:r.Relational,"<<":r.BitwiseSHIFT,">>":r.BitwiseSHIFT,">>>":r.BitwiseSHIFT,"+":r.Additive,"-":r.Additive,"*":r.Multiplicative,"%":r.Multiplicative,"/":r.Multiplicative,"**":r.Exponentiation};var y=e=>{let{type:t,...n}=e;if(!t||typeof t!="string")throw new o("missing-node-type","expr() requires a node with a valid type property");if(!p(t))throw l(t);return {"#expr":t,...n}},d=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":t,...n}=e;return {type:t,...n}},u=e=>({type:"Identifier",name:e}),g=e=>e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:{type:"Literal",value:e},f=e=>({type:"ArrayExpression",elements:e}),b=e=>({type:"ObjectExpression",properties:e}),J=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),X=e=>({type:"SpreadElement",argument:e}),A=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),C=(e,t)=>({type:"NewExpression",callee:e,arguments:t}),D=(e,t,n=false,i=false)=>({type:"MemberExpression",object:e,property:t,computed:n,optional:i}),h=e=>({type:"ChainExpression",expression:e}),I=(e,t,n)=>({type:"BinaryExpression",left:t,right:n,operator:e}),w=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),T=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),P=(e,t,n=false)=>({type:"UpdateExpression",operator:e,argument:t,prefix:n}),F=(e,t,n)=>({type:"AssignmentExpression",operator:e,left:t,right:n}),O=(e,t,n)=>({type:"ConditionalExpression",test:e,consequent:t,alternate:n}),N=e=>({type:"AwaitExpression",argument:e}),L=(e,t=false)=>({type:"TemplateElement",value:e,tail:t}),k=(e,t)=>({type:"TemplateLiteral",quasis:e,expressions:t}),B=(e,t,n=false,i=false)=>({type:"ArrowFunctionExpression",expression:t.type!="BlockStatement",generator:i,async:n,params:e,body:t}),R=(e=null,t,n,i=false,s=false)=>({type:"FunctionExpression",id:e,params:t,body:n,async:i,generator:s}),j=(e,t,n,i=false,s=false)=>({type:"FunctionDeclaration",id:e,params:t,body:n,generator:i,async:s}),M=e=>({type:"BlockStatement",body:e}),V=e=>({type:"ExpressionStatement",expression:e}),v=e=>({type:"ReturnStatement",argument:e}),q=(e,t,n=null)=>({type:"IfStatement",test:e,consequent:t,alternate:n}),U=(e,t)=>({type:"SwitchStatement",cases:t,discriminant:e}),W=(e,t)=>({type:"SwitchCase",consequent:t,test:e}),_=e=>({type:"ThrowStatement",argument:e}),Y=(e,t,n=null)=>({type:"TryStatement",block:e,handler:t,finalizer:n}),H=(e,t)=>({type:"CatchClause",param:e,body:t}),$=(e=null)=>({type:"BreakStatement",label:e}),z=(e=null)=>({type:"ContinueStatement",label:e}),K=()=>({type:"EmptyStatement"}),Z=(e,t,n,i)=>({type:"ForStatement",init:e,test:t,update:n,body:i}),G=(e,t,n)=>({type:"ForInStatement",body:n,left:e,right:t}),Q=(e,t,n,i=false)=>({type:"ForOfStatement",body:n,left:e,right:t,await:i}),ee=(e,t)=>({type:"WhileStatement",test:e,body:t}),te=(e,t)=>({type:"DoWhileStatement",body:e,test:t}),ne=(e,t)=>({type:"VariableDeclaration",declarations:t,kind:e}),re=(e,t=null)=>({type:"VariableDeclarator",id:e,init:t}),ie=e=>({type:"ObjectPattern",properties:e}),oe=e=>({type:"ArrayPattern",elements:e}),se=(e,t=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:t,shorthand:n,computed:i,method:false}),ae=e=>({type:"RestElement",argument:e}),pe=(e,t)=>({type:"AssignmentPattern",left:e,right:t}),le=(e,t="script")=>({type:"Program",body:e,sourceType:t}),m=e=>({type:"JsonExpression",body:e}),me=(e,t)=>({type:"ImportDeclaration",specifiers:e,source:t}),xe=(e,t)=>({type:"ImportSpecifier",imported:e,local:t}),ce=e=>({type:"ImportDefaultSpecifier",local:e}),Ee=e=>({type:"ImportNamespaceSpecifier",local:e}),Se=(e=null,t=[],n=null)=>({type:"ExportNamedDeclaration",declaration:e,specifiers:t,source:n}),ye=e=>({type:"ExportDefaultDeclaration",declaration:e}),de=(e,t=e)=>({type:"ExportSpecifier",local:e,exported:t}),ue=e=>({type:"JSXIdentifier",name:e}),ge=(e,t)=>({type:"JSXMemberExpression",object:e,property:t}),fe=(e,t)=>({type:"JSXNamespacedName",namespace:e,name:t}),be=()=>({type:"JSXEmptyExpression"}),Je=e=>({type:"JSXExpressionContainer",expression:e}),Xe=e=>({type:"JSXSpreadAttribute",argument:e}),Ae=(e,t=null)=>({type:"JSXAttribute",name:e,value:t}),Ce=(e,t=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:t,selfClosing:n}),De=e=>({type:"JSXClosingElement",name:e}),x=()=>({type:"JSXOpeningFragment"}),c=()=>({type:"JSXClosingFragment"}),he=(e,t=e)=>({type:"JSXText",value:e,raw:t}),Ie=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),we=(e=[],t=x(),n=c())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),Te=m;export{oe as $,O as A,Te as Aa,N as B,Pe as Ba,L as C,k as D,B as E,R as F,j as G,M as H,V as I,v as J,q as K,U as L,W as M,_ as N,Y as O,H as P,$ as Q,z as R,K as S,Z as T,G as U,Q as V,ee as W,te as X,ne as Y,re as Z,ie as _,S as a,se as aa,o as b,ae as ba,Le as c,pe as ca,a as d,le as da,p as e,m as ea,l as f,me as fa,ke as g,xe as ga,r as h,ce as ha,Be as i,Ee as ia,y as j,Se as ja,d as k,ye as ka,u as l,de as la,g as m,ue as ma,f as n,ge as na,b as o,fe as oa,J as p,be as pa,X as q,Je as qa,A as r,Xe as ra,C as s,Ae as sa,D as t,Ce as ta,h as u,De as ua,I as v,x as va,w,c as wa,T as x,he as xa,P as y,Ie as ya,F as z,we as za};
@@ -138,15 +138,15 @@ type Function = ArrowFunctionExpression | FunctionDeclaration | FunctionExpressi
138
138
  * TSLite — a forma serializada da linguagem TSLite.
139
139
  *
140
140
  * JSON puro (dados estáticos) entremeado de ilhas executáveis marcadas com
141
- * `#ast`, cujo valor é o tipo do nó ESTree. É portável, serializável e
141
+ * `#expr`, cujo valor é o tipo do nó ESTree. É portável, serializável e
142
142
  * diffável: `encode()` produz, `decode()` consome, `printJson()` emite.
143
143
  */
144
144
  type TSLite = string | number | boolean | null | TSLite[] | TSLiteMarker | {
145
145
  [key: string]: TSLite;
146
146
  };
147
- /** Ilha executável dentro do TSLite (o valor de `#ast` é o tipo do nó). */
147
+ /** Ilha executável dentro do TSLite (o valor de `#expr` é o tipo do nó). */
148
148
  interface TSLiteMarker {
149
- "#ast": string;
149
+ "#expr": string;
150
150
  [prop: string]: unknown;
151
151
  }
152
152
  /**
@@ -554,6 +554,125 @@ interface ImportDefaultSpecifier extends BaseModuleSpecifier {
554
554
  interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
555
555
  type: "ImportNamespaceSpecifier";
556
556
  }
557
+ /** Qualquer nó de tipo sintático. */
558
+ type TSType = TSKeywordType | TSLiteralType | TSTypeReference | TSArrayType | TSIndexedAccessType | TSUnionType | TSIntersectionType | TSFunctionType | TSTypeLiteral | TSTupleType | TSTypeOperator | TSInferType | TSConditionalType | TSMappedType | TSTypeQuery;
559
+ /** `string`/`number`/`boolean`/`any`/`unknown`/`undefined`/`void`/`null`/`never`. */
560
+ interface TSKeywordType extends BaseNode {
561
+ type: "TSKeywordType";
562
+ kind: "string" | "number" | "boolean" | "any" | "unknown" | "undefined" | "void" | "null" | "never";
563
+ }
564
+ /** `"paid"` / `42` / `true` em posição de tipo. */
565
+ interface TSLiteralType extends BaseNode {
566
+ type: "TSLiteralType";
567
+ literal: string | number | boolean;
568
+ }
569
+ /** Um nome de tipo: `User`, `Box<T>`, `T` (type-param) — o Schema (var/apply/
570
+ * ReturnType/Parameters) é decidido na conversão, com o escopo. */
571
+ interface TSTypeReference extends BaseNode {
572
+ type: "TSTypeReference";
573
+ typeName: string;
574
+ typeArguments?: TSType[];
575
+ }
576
+ /** `T[]` (`readonly T[]` marca a flag, como o Schema). */
577
+ interface TSArrayType extends BaseNode {
578
+ type: "TSArrayType";
579
+ elementType: TSType;
580
+ readonly?: boolean;
581
+ }
582
+ /** `T[K]` — indexed access. */
583
+ interface TSIndexedAccessType extends BaseNode {
584
+ type: "TSIndexedAccessType";
585
+ objectType: TSType;
586
+ indexType: TSType;
587
+ }
588
+ /** `A | B | C`. */
589
+ interface TSUnionType extends BaseNode {
590
+ type: "TSUnionType";
591
+ types: TSType[];
592
+ }
593
+ /** `A & B & C`. */
594
+ interface TSIntersectionType extends BaseNode {
595
+ type: "TSIntersectionType";
596
+ types: TSType[];
597
+ }
598
+ /** Um parâmetro de function type / call signature (`a: T`, `a?: T`). */
599
+ interface TSTypeParameter extends BaseNode {
600
+ type: "TSTypeParameter";
601
+ name: string;
602
+ typeAnnotation: TSType;
603
+ optional?: boolean;
604
+ }
605
+ /** `(a: T, b?: U) => R` — `typeParams` são os nomes de genérico declarados. */
606
+ interface TSFunctionType extends BaseNode {
607
+ type: "TSFunctionType";
608
+ params: TSTypeParameter[];
609
+ returnType: TSType;
610
+ typeParams?: string[];
611
+ }
612
+ /** `{ k: T; k2?: U }` (+ index/call signatures). */
613
+ interface TSTypeLiteral extends BaseNode {
614
+ type: "TSTypeLiteral";
615
+ members: TSTypeMember[];
616
+ }
617
+ type TSTypeMember = TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration;
618
+ /** Um membro `k: T` (ou `k?: T`) de um object type — ONDE comentários ancoram. */
619
+ interface TSPropertySignature extends BaseNode {
620
+ type: "TSPropertySignature";
621
+ key: string;
622
+ typeAnnotation: TSType;
623
+ optional?: boolean;
624
+ }
625
+ /** `[k: string]: V`. */
626
+ interface TSIndexSignature extends BaseNode {
627
+ type: "TSIndexSignature";
628
+ keyType: "string" | "number";
629
+ typeAnnotation: TSType;
630
+ }
631
+ /** `(a: T): R` dentro de um object type (uma → fn; várias → overload). */
632
+ interface TSCallSignatureDeclaration extends BaseNode {
633
+ type: "TSCallSignatureDeclaration";
634
+ params: TSTypeParameter[];
635
+ returnType: TSType;
636
+ }
637
+ /** `[A, B?, ...R[]]` — `flags` espelha o `ElementFlags` do Schema. */
638
+ interface TSTupleType extends BaseNode {
639
+ type: "TSTupleType";
640
+ elementTypes: TSType[];
641
+ flags?: string[];
642
+ readonly?: boolean;
643
+ }
644
+ /** `keyof T` (prefixo). `readonly` mora como flag no array/tuple, não aqui. */
645
+ interface TSTypeOperator extends BaseNode {
646
+ type: "TSTypeOperator";
647
+ operator: "keyof";
648
+ typeAnnotation: TSType;
649
+ }
650
+ /** `infer U` (só no ramo `extends` de um conditional). */
651
+ interface TSInferType extends BaseNode {
652
+ type: "TSInferType";
653
+ name: string;
654
+ }
655
+ /** `C extends E ? T : F`. */
656
+ interface TSConditionalType extends BaseNode {
657
+ type: "TSConditionalType";
658
+ checkType: TSType;
659
+ extendsType: TSType;
660
+ trueType: TSType;
661
+ falseType: TSType;
662
+ }
663
+ /** `{ [K in Over]?: Body }`. */
664
+ interface TSMappedType extends BaseNode {
665
+ type: "TSMappedType";
666
+ key: string;
667
+ constraint: TSType;
668
+ typeAnnotation: TSType;
669
+ optional?: boolean;
670
+ }
671
+ /** `typeof x` / `typeof a.b` — o path do entity name. */
672
+ interface TSTypeQuery extends BaseNode {
673
+ type: "TSTypeQuery";
674
+ exprName: string[];
675
+ }
557
676
  type SimpleArrayExpression = Partial<ArrayExpression>;
558
677
  type SimpleArrayPattern = Partial<ArrayPattern>;
559
678
  type SimpleArrowFunctionExpression = Partial<ArrowFunctionExpression>;
@@ -792,8 +911,29 @@ type types_SpreadElement = SpreadElement;
792
911
  type types_Statement = Statement;
793
912
  type types_SwitchCase = SwitchCase;
794
913
  type types_SwitchStatement = SwitchStatement;
914
+ type types_TSArrayType = TSArrayType;
915
+ type types_TSCallSignatureDeclaration = TSCallSignatureDeclaration;
916
+ type types_TSConditionalType = TSConditionalType;
917
+ type types_TSFunctionType = TSFunctionType;
918
+ type types_TSIndexSignature = TSIndexSignature;
919
+ type types_TSIndexedAccessType = TSIndexedAccessType;
920
+ type types_TSInferType = TSInferType;
921
+ type types_TSIntersectionType = TSIntersectionType;
922
+ type types_TSKeywordType = TSKeywordType;
795
923
  type types_TSLite = TSLite;
796
924
  type types_TSLiteMarker = TSLiteMarker;
925
+ type types_TSLiteralType = TSLiteralType;
926
+ type types_TSMappedType = TSMappedType;
927
+ type types_TSPropertySignature = TSPropertySignature;
928
+ type types_TSTupleType = TSTupleType;
929
+ type types_TSType = TSType;
930
+ type types_TSTypeLiteral = TSTypeLiteral;
931
+ type types_TSTypeMember = TSTypeMember;
932
+ type types_TSTypeOperator = TSTypeOperator;
933
+ type types_TSTypeParameter = TSTypeParameter;
934
+ type types_TSTypeQuery = TSTypeQuery;
935
+ type types_TSTypeReference = TSTypeReference;
936
+ type types_TSUnionType = TSUnionType;
797
937
  type types_TaggedTemplateExpression = TaggedTemplateExpression;
798
938
  type types_TemplateElement = TemplateElement;
799
939
  type types_TemplateLiteral = TemplateLiteral;
@@ -808,39 +948,39 @@ type types_VariableDeclaration = VariableDeclaration;
808
948
  type types_VariableDeclarator = VariableDeclarator;
809
949
  type types_WhileStatement = WhileStatement;
810
950
  declare namespace types {
811
- export type { types_ArrayExpression as ArrayExpression, types_ArrayPattern as ArrayPattern, types_ArrowFunctionExpression as ArrowFunctionExpression, types_AssignmentExpression as AssignmentExpression, types_AssignmentOperator as AssignmentOperator, types_AssignmentPattern as AssignmentPattern, types_AssignmentProperty as AssignmentProperty, types_AwaitExpression as AwaitExpression, types_BaseCallExpression as BaseCallExpression, types_BaseDeclaration as BaseDeclaration, types_BaseExpression as BaseExpression, types_BaseForXStatement as BaseForXStatement, types_BaseFunction as BaseFunction, types_BaseModuleDeclaration as BaseModuleDeclaration, types_BaseModuleSpecifier as BaseModuleSpecifier, types_BaseNode as BaseNode, types_BaseNodeWithoutComments as BaseNodeWithoutComments, types_BasePattern as BasePattern, types_BaseStatement as BaseStatement, types_BigIntLiteral as BigIntLiteral, types_BinaryExpression as BinaryExpression, types_BinaryOperator as BinaryOperator, types_BlockStatement as BlockStatement, types_BreakStatement as BreakStatement, types_CallExpression as CallExpression, types_CatchClause as CatchClause, types_ChainElement as ChainElement, types_ChainExpression as ChainExpression, types_Comment as Comment, types_ConditionalExpression as ConditionalExpression, types_ContinueStatement as ContinueStatement, types_DebuggerStatement as DebuggerStatement, types_Declaration as Declaration, types_Directive as Directive, types_DoWhileStatement as DoWhileStatement, types_EmptyStatement as EmptyStatement, types_ExportDefaultDeclaration as ExportDefaultDeclaration, types_ExportNamedDeclaration as ExportNamedDeclaration, types_ExportSpecifier as ExportSpecifier, types_Expression as Expression, types_ExpressionStatement as ExpressionStatement, types_ForInStatement as ForInStatement, types_ForOfStatement as ForOfStatement, types_ForStatement as ForStatement, types_Function as Function, types_FunctionDeclaration as FunctionDeclaration, types_FunctionExpression as FunctionExpression, types_Identifier as Identifier, types_IfStatement as IfStatement, types_ImportDeclaration as ImportDeclaration, types_ImportDefaultSpecifier as ImportDefaultSpecifier, types_ImportExpression as ImportExpression, types_ImportNamespaceSpecifier as ImportNamespaceSpecifier, types_ImportSpecifier as ImportSpecifier, types_JSXAttribute as JSXAttribute, types_JSXChild as JSXChild, types_JSXClosingElement as JSXClosingElement, types_JSXClosingFragment as JSXClosingFragment, types_JSXElement as JSXElement, types_JSXEmptyExpression as JSXEmptyExpression, types_JSXExpressionContainer as JSXExpressionContainer, types_JSXFragment as JSXFragment, types_JSXIdentifier as JSXIdentifier, types_JSXMemberExpression as JSXMemberExpression, types_JSXNamespacedName as JSXNamespacedName, types_JSXOpeningElement as JSXOpeningElement, types_JSXOpeningFragment as JSXOpeningFragment, types_JSXSpreadAttribute as JSXSpreadAttribute, types_JSXTagName as JSXTagName, types_JSXText as JSXText, types_JsonExpression as JsonExpression, types_LabeledStatement as LabeledStatement, types_Literal as Literal, types_LogicalExpression as LogicalExpression, types_LogicalOperator as LogicalOperator, types_MaybeNamedFunctionDeclaration as MaybeNamedFunctionDeclaration, types_MemberExpression as MemberExpression, types_MetaProperty as MetaProperty, types_MethodDefinition as MethodDefinition, types_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_NewExpression as NewExpression, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Position as Position, types_Program as Program, types_Property as Property, types_PropertyDefinition as PropertyDefinition, types_RegExpLiteral as RegExpLiteral, types_RestElement as RestElement, types_ReturnStatement as ReturnStatement, types_SequenceExpression as SequenceExpression, types_SimpleArrayExpression as SimpleArrayExpression, types_SimpleArrayPattern as SimpleArrayPattern, types_SimpleArrowFunctionExpression as SimpleArrowFunctionExpression, types_SimpleAssignmentExpression as SimpleAssignmentExpression, types_SimpleAssignmentPattern as SimpleAssignmentPattern, types_SimpleAssignmentProperty as SimpleAssignmentProperty, types_SimpleAwaitExpression as SimpleAwaitExpression, types_SimpleBaseCallExpression as SimpleBaseCallExpression, types_SimpleBaseDeclaration as SimpleBaseDeclaration, types_SimpleBaseExpression as SimpleBaseExpression, types_SimpleBaseForXStatement as SimpleBaseForXStatement, types_SimpleBaseFunction as SimpleBaseFunction, types_SimpleBaseNode as SimpleBaseNode, types_SimpleBaseNodeWithoutComments as SimpleBaseNodeWithoutComments, types_SimpleBasePattern as SimpleBasePattern, types_SimpleBaseStatement as SimpleBaseStatement, types_SimpleBigIntLiteral as SimpleBigIntLiteral, types_SimpleBinaryExpression as SimpleBinaryExpression, types_SimpleBlockStatement as SimpleBlockStatement, types_SimpleBreakStatement as SimpleBreakStatement, types_SimpleCallExpression as SimpleCallExpression, types_SimpleCatchClause as SimpleCatchClause, types_SimpleChainExpression as SimpleChainExpression, types_SimpleComment as SimpleComment, types_SimpleConditionalExpression as SimpleConditionalExpression, types_SimpleContinueStatement as SimpleContinueStatement, types_SimpleDoWhileStatement as SimpleDoWhileStatement, types_SimpleEmptyStatement as SimpleEmptyStatement, types_SimpleExpressionStatement as SimpleExpressionStatement, types_SimpleForInStatement as SimpleForInStatement, types_SimpleForOfStatement as SimpleForOfStatement, types_SimpleForStatement as SimpleForStatement, types_SimpleFunctionDeclaration as SimpleFunctionDeclaration, types_SimpleFunctionExpression as SimpleFunctionExpression, types_SimpleIdentifier as SimpleIdentifier, types_SimpleIfStatement as SimpleIfStatement, types_SimpleJsonExpression as SimpleJsonExpression, types_SimpleLabeledStatement as SimpleLabeledStatement, types_SimpleLiteral as SimpleLiteral, types_SimpleLogicalExpression as SimpleLogicalExpression, types_SimpleMemberExpression as SimpleMemberExpression, types_SimpleMethodDefinition as SimpleMethodDefinition, types_SimpleNewExpression as SimpleNewExpression, types_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, types_SimplePropertyDefinition as SimplePropertyDefinition, types_SimpleRegExpLiteral as SimpleRegExpLiteral, types_SimpleRestElement as SimpleRestElement, types_SimpleReturnStatement as SimpleReturnStatement, types_SimpleSequenceExpression as SimpleSequenceExpression, types_SimpleSimpleCallExpression as SimpleSimpleCallExpression, types_SimpleSimpleLiteral as SimpleSimpleLiteral, types_SimpleSourceLocation as SimpleSourceLocation, types_SimpleSpreadElement as SimpleSpreadElement, types_SimpleSwitchCase as SimpleSwitchCase, types_SimpleSwitchStatement as SimpleSwitchStatement, types_SimpleTemplateElement as SimpleTemplateElement, types_SimpleTemplateLiteral as SimpleTemplateLiteral, types_SimpleThisExpression as SimpleThisExpression, types_SimpleThrowStatement as SimpleThrowStatement, types_SimpleTryStatement as SimpleTryStatement, types_SimpleUnaryExpression as SimpleUnaryExpression, types_SimpleUpdateExpression as SimpleUpdateExpression, types_SimpleVariableDeclaration as SimpleVariableDeclaration, types_SimpleVariableDeclarator as SimpleVariableDeclarator, types_SimpleWhileStatement as SimpleWhileStatement, types_SourceLocation as SourceLocation, types_SpreadElement as SpreadElement, types_Statement as Statement, types_SwitchCase as SwitchCase, types_SwitchStatement as SwitchStatement, types_TSLite as TSLite, types_TSLiteMarker as TSLiteMarker, types_TaggedTemplateExpression as TaggedTemplateExpression, types_TemplateElement as TemplateElement, types_TemplateLiteral as TemplateLiteral, types_ThisExpression as ThisExpression, types_ThrowStatement as ThrowStatement, types_TryStatement as TryStatement, types_UnaryExpression as UnaryExpression, types_UnaryOperator as UnaryOperator, types_UpdateExpression as UpdateExpression, types_UpdateOperator as UpdateOperator, types_VariableDeclaration as VariableDeclaration, types_VariableDeclarator as VariableDeclarator, types_WhileStatement as WhileStatement };
951
+ export type { types_ArrayExpression as ArrayExpression, types_ArrayPattern as ArrayPattern, types_ArrowFunctionExpression as ArrowFunctionExpression, types_AssignmentExpression as AssignmentExpression, types_AssignmentOperator as AssignmentOperator, types_AssignmentPattern as AssignmentPattern, types_AssignmentProperty as AssignmentProperty, types_AwaitExpression as AwaitExpression, types_BaseCallExpression as BaseCallExpression, types_BaseDeclaration as BaseDeclaration, types_BaseExpression as BaseExpression, types_BaseForXStatement as BaseForXStatement, types_BaseFunction as BaseFunction, types_BaseModuleDeclaration as BaseModuleDeclaration, types_BaseModuleSpecifier as BaseModuleSpecifier, types_BaseNode as BaseNode, types_BaseNodeWithoutComments as BaseNodeWithoutComments, types_BasePattern as BasePattern, types_BaseStatement as BaseStatement, types_BigIntLiteral as BigIntLiteral, types_BinaryExpression as BinaryExpression, types_BinaryOperator as BinaryOperator, types_BlockStatement as BlockStatement, types_BreakStatement as BreakStatement, types_CallExpression as CallExpression, types_CatchClause as CatchClause, types_ChainElement as ChainElement, types_ChainExpression as ChainExpression, types_Comment as Comment, types_ConditionalExpression as ConditionalExpression, types_ContinueStatement as ContinueStatement, types_DebuggerStatement as DebuggerStatement, types_Declaration as Declaration, types_Directive as Directive, types_DoWhileStatement as DoWhileStatement, types_EmptyStatement as EmptyStatement, types_ExportDefaultDeclaration as ExportDefaultDeclaration, types_ExportNamedDeclaration as ExportNamedDeclaration, types_ExportSpecifier as ExportSpecifier, types_Expression as Expression, types_ExpressionStatement as ExpressionStatement, types_ForInStatement as ForInStatement, types_ForOfStatement as ForOfStatement, types_ForStatement as ForStatement, types_Function as Function, types_FunctionDeclaration as FunctionDeclaration, types_FunctionExpression as FunctionExpression, types_Identifier as Identifier, types_IfStatement as IfStatement, types_ImportDeclaration as ImportDeclaration, types_ImportDefaultSpecifier as ImportDefaultSpecifier, types_ImportExpression as ImportExpression, types_ImportNamespaceSpecifier as ImportNamespaceSpecifier, types_ImportSpecifier as ImportSpecifier, types_JSXAttribute as JSXAttribute, types_JSXChild as JSXChild, types_JSXClosingElement as JSXClosingElement, types_JSXClosingFragment as JSXClosingFragment, types_JSXElement as JSXElement, types_JSXEmptyExpression as JSXEmptyExpression, types_JSXExpressionContainer as JSXExpressionContainer, types_JSXFragment as JSXFragment, types_JSXIdentifier as JSXIdentifier, types_JSXMemberExpression as JSXMemberExpression, types_JSXNamespacedName as JSXNamespacedName, types_JSXOpeningElement as JSXOpeningElement, types_JSXOpeningFragment as JSXOpeningFragment, types_JSXSpreadAttribute as JSXSpreadAttribute, types_JSXTagName as JSXTagName, types_JSXText as JSXText, types_JsonExpression as JsonExpression, types_LabeledStatement as LabeledStatement, types_Literal as Literal, types_LogicalExpression as LogicalExpression, types_LogicalOperator as LogicalOperator, types_MaybeNamedFunctionDeclaration as MaybeNamedFunctionDeclaration, types_MemberExpression as MemberExpression, types_MetaProperty as MetaProperty, types_MethodDefinition as MethodDefinition, types_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_NewExpression as NewExpression, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Position as Position, types_Program as Program, types_Property as Property, types_PropertyDefinition as PropertyDefinition, types_RegExpLiteral as RegExpLiteral, types_RestElement as RestElement, types_ReturnStatement as ReturnStatement, types_SequenceExpression as SequenceExpression, types_SimpleArrayExpression as SimpleArrayExpression, types_SimpleArrayPattern as SimpleArrayPattern, types_SimpleArrowFunctionExpression as SimpleArrowFunctionExpression, types_SimpleAssignmentExpression as SimpleAssignmentExpression, types_SimpleAssignmentPattern as SimpleAssignmentPattern, types_SimpleAssignmentProperty as SimpleAssignmentProperty, types_SimpleAwaitExpression as SimpleAwaitExpression, types_SimpleBaseCallExpression as SimpleBaseCallExpression, types_SimpleBaseDeclaration as SimpleBaseDeclaration, types_SimpleBaseExpression as SimpleBaseExpression, types_SimpleBaseForXStatement as SimpleBaseForXStatement, types_SimpleBaseFunction as SimpleBaseFunction, types_SimpleBaseNode as SimpleBaseNode, types_SimpleBaseNodeWithoutComments as SimpleBaseNodeWithoutComments, types_SimpleBasePattern as SimpleBasePattern, types_SimpleBaseStatement as SimpleBaseStatement, types_SimpleBigIntLiteral as SimpleBigIntLiteral, types_SimpleBinaryExpression as SimpleBinaryExpression, types_SimpleBlockStatement as SimpleBlockStatement, types_SimpleBreakStatement as SimpleBreakStatement, types_SimpleCallExpression as SimpleCallExpression, types_SimpleCatchClause as SimpleCatchClause, types_SimpleChainExpression as SimpleChainExpression, types_SimpleComment as SimpleComment, types_SimpleConditionalExpression as SimpleConditionalExpression, types_SimpleContinueStatement as SimpleContinueStatement, types_SimpleDoWhileStatement as SimpleDoWhileStatement, types_SimpleEmptyStatement as SimpleEmptyStatement, types_SimpleExpressionStatement as SimpleExpressionStatement, types_SimpleForInStatement as SimpleForInStatement, types_SimpleForOfStatement as SimpleForOfStatement, types_SimpleForStatement as SimpleForStatement, types_SimpleFunctionDeclaration as SimpleFunctionDeclaration, types_SimpleFunctionExpression as SimpleFunctionExpression, types_SimpleIdentifier as SimpleIdentifier, types_SimpleIfStatement as SimpleIfStatement, types_SimpleJsonExpression as SimpleJsonExpression, types_SimpleLabeledStatement as SimpleLabeledStatement, types_SimpleLiteral as SimpleLiteral, types_SimpleLogicalExpression as SimpleLogicalExpression, types_SimpleMemberExpression as SimpleMemberExpression, types_SimpleMethodDefinition as SimpleMethodDefinition, types_SimpleNewExpression as SimpleNewExpression, types_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, types_SimplePropertyDefinition as SimplePropertyDefinition, types_SimpleRegExpLiteral as SimpleRegExpLiteral, types_SimpleRestElement as SimpleRestElement, types_SimpleReturnStatement as SimpleReturnStatement, types_SimpleSequenceExpression as SimpleSequenceExpression, types_SimpleSimpleCallExpression as SimpleSimpleCallExpression, types_SimpleSimpleLiteral as SimpleSimpleLiteral, types_SimpleSourceLocation as SimpleSourceLocation, types_SimpleSpreadElement as SimpleSpreadElement, types_SimpleSwitchCase as SimpleSwitchCase, types_SimpleSwitchStatement as SimpleSwitchStatement, types_SimpleTemplateElement as SimpleTemplateElement, types_SimpleTemplateLiteral as SimpleTemplateLiteral, types_SimpleThisExpression as SimpleThisExpression, types_SimpleThrowStatement as SimpleThrowStatement, types_SimpleTryStatement as SimpleTryStatement, types_SimpleUnaryExpression as SimpleUnaryExpression, types_SimpleUpdateExpression as SimpleUpdateExpression, types_SimpleVariableDeclaration as SimpleVariableDeclaration, types_SimpleVariableDeclarator as SimpleVariableDeclarator, types_SimpleWhileStatement as SimpleWhileStatement, types_SourceLocation as SourceLocation, types_SpreadElement as SpreadElement, types_Statement as Statement, types_SwitchCase as SwitchCase, types_SwitchStatement as SwitchStatement, types_TSArrayType as TSArrayType, types_TSCallSignatureDeclaration as TSCallSignatureDeclaration, types_TSConditionalType as TSConditionalType, types_TSFunctionType as TSFunctionType, types_TSIndexSignature as TSIndexSignature, types_TSIndexedAccessType as TSIndexedAccessType, types_TSInferType as TSInferType, types_TSIntersectionType as TSIntersectionType, types_TSKeywordType as TSKeywordType, types_TSLite as TSLite, types_TSLiteMarker as TSLiteMarker, types_TSLiteralType as TSLiteralType, types_TSMappedType as TSMappedType, types_TSPropertySignature as TSPropertySignature, types_TSTupleType as TSTupleType, types_TSType as TSType, types_TSTypeLiteral as TSTypeLiteral, types_TSTypeMember as TSTypeMember, types_TSTypeOperator as TSTypeOperator, types_TSTypeParameter as TSTypeParameter, types_TSTypeQuery as TSTypeQuery, types_TSTypeReference as TSTypeReference, types_TSUnionType as TSUnionType, types_TaggedTemplateExpression as TaggedTemplateExpression, types_TemplateElement as TemplateElement, types_TemplateLiteral as TemplateLiteral, types_ThisExpression as ThisExpression, types_ThrowStatement as ThrowStatement, types_TryStatement as TryStatement, types_UnaryExpression as UnaryExpression, types_UnaryOperator as UnaryOperator, types_UpdateExpression as UpdateExpression, types_UpdateOperator as UpdateOperator, types_VariableDeclaration as VariableDeclaration, types_VariableDeclarator as VariableDeclarator, types_WhileStatement as WhileStatement };
812
952
  }
813
953
 
814
954
  /**
815
- * Cria um marcador #ast para embedar AST em JSON.
955
+ * Cria um marcador #expr para embedar AST em JSON.
816
956
  *
817
- * O formato usa #ast como o tipo do nó, sem wrapper body:
957
+ * O formato usa #expr como o tipo do nó, sem wrapper body:
818
958
  * ```
819
- * { "#ast": "CallExpression", "callee": {...}, "arguments": [] }
959
+ * { "#expr": "CallExpression", "callee": {...}, "arguments": [] }
820
960
  * ```
821
961
  *
822
962
  * @param node - Nó AST (deve ter propriedade `type`)
823
- * @returns Objeto com #ast marker pronto para JSON
963
+ * @returns Objeto com #expr marker pronto para JSON
824
964
  * @throws Se o tipo não for válido como entry point
825
965
  */
826
- declare const ast: (node: Node) => TSLiteMarker;
966
+ declare const expr: (node: Node) => TSLiteMarker;
827
967
  /**
828
- * Converte um objeto com #ast marker de volta para nó AST com type.
968
+ * Converte um objeto com #expr marker de volta para nó AST com type.
829
969
  *
830
970
  * Útil quando você tem um objeto no formato TSLite e precisa usar como nó AST
831
971
  * normal (ex: passar como argumento).
832
972
  *
833
- * @param obj - Objeto com #ast marker
834
- * @returns Nó AST com type (ou o objeto original se não tiver #ast)
973
+ * @param obj - Objeto com #expr marker
974
+ * @returns Nó AST com type (ou o objeto original se não tiver #expr)
835
975
  *
836
976
  * @example
837
977
  * ```ts
838
- * const astMarked = { "#ast": "Identifier", name: "foo" };
839
- * const node = fromAstMarker(astMarked);
978
+ * const exprMarked = { "#expr": "Identifier", name: "foo" };
979
+ * const node = fromExprMarker(exprMarked);
840
980
  * // { type: "Identifier", name: "foo" }
841
981
  * ```
842
982
  */
843
- declare const fromAstMarker: (obj: unknown) => unknown;
983
+ declare const fromExprMarker: (obj: unknown) => unknown;
844
984
  declare const identifier: (name: string) => Identifier;
845
985
  declare const literal: (value: string | boolean | number | null | RegExp | bigint | undefined) => Literal;
846
986
  declare const arrayExpression: (elements: Array<Expression | SpreadElement | null>) => ArrayExpression;
@@ -915,4 +1055,4 @@ declare const jsxElement: (openingElement: JSXOpeningElement, children?: JSXChil
915
1055
  declare const jsxFragment: (children?: JSXChild[], openingFragment?: JSXOpeningFragment, closingFragment?: JSXClosingFragment) => JSXFragment;
916
1056
  declare const json: (body: TSLite) => JsonExpression;
917
1057
 
918
- export { type Directive as $, type ArrayExpression as A, type BaseNode as B, type CatchClause as C, type DoWhileStatement as D, type EmptyStatement as E, type ForInStatement as F, type SwitchStatement as G, type TemplateLiteral as H, type Identifier as I, type JsonExpression as J, type ThrowStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type TryStatement as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type UpdateExpression as V, type VariableDeclaration as W, type VariableDeclarator as X, type WhileStatement as Y, type SpreadElement as Z, type RestElement as _, type ArrayPattern as a, type SimpleBaseExpression as a$, type ModuleDeclaration as a0, type JSXElement as a1, type JSXFragment as a2, type CallExpression as a3, type AssignmentOperator as a4, type AssignmentPattern as a5, type BaseCallExpression as a6, type BaseDeclaration as a7, type BaseExpression as a8, type BaseForXStatement as a9, type JSXNamespacedName as aA, type JSXOpeningElement as aB, type JSXOpeningFragment as aC, type JSXSpreadAttribute as aD, type JSXTagName as aE, type JSXText as aF, type LabeledStatement as aG, type LogicalOperator as aH, type MaybeNamedFunctionDeclaration as aI, type MetaProperty as aJ, type MethodDefinition as aK, type ModuleSpecifier as aL, type NodeMap as aM, type Pattern as aN, type Position as aO, type PropertyDefinition as aP, type RegExpLiteral as aQ, type SequenceExpression as aR, type SimpleArrayExpression as aS, type SimpleArrayPattern as aT, type SimpleArrowFunctionExpression as aU, type SimpleAssignmentExpression as aV, type SimpleAssignmentPattern as aW, type SimpleAssignmentProperty as aX, type SimpleAwaitExpression as aY, type SimpleBaseCallExpression as aZ, type SimpleBaseDeclaration as a_, type BaseFunction as aa, type BaseModuleDeclaration as ab, type BaseModuleSpecifier as ac, type BaseNodeWithoutComments as ad, type BasePattern as ae, type BaseStatement as af, type BigIntLiteral as ag, type BinaryOperator as ah, type ChainElement as ai, type Comment as aj, type DebuggerStatement as ak, type Declaration as al, type ExportDefaultDeclaration as am, type ExportNamedDeclaration as an, type ExportSpecifier as ao, type Expression as ap, type Function as aq, type ImportExpression as ar, type JSXAttribute as as, type JSXChild as at, type JSXClosingElement as au, type JSXClosingFragment as av, type JSXEmptyExpression as aw, type JSXExpressionContainer as ax, type JSXIdentifier as ay, type JSXMemberExpression as az, type ArrowFunctionExpression as b, type TaggedTemplateExpression as b$, type SimpleBaseForXStatement as b0, type SimpleBaseFunction as b1, type SimpleBaseNode as b2, type SimpleBaseNodeWithoutComments as b3, type SimpleBasePattern as b4, type SimpleBaseStatement as b5, type SimpleBigIntLiteral as b6, type SimpleBinaryExpression as b7, type SimpleBlockStatement as b8, type SimpleBreakStatement as b9, type SimpleProgram as bA, type SimpleProperty as bB, type SimplePropertyDefinition as bC, type SimpleRegExpLiteral as bD, type SimpleRestElement as bE, type SimpleReturnStatement as bF, type SimpleSequenceExpression as bG, type SimpleSimpleCallExpression as bH, type SimpleSimpleLiteral as bI, type SimpleSourceLocation as bJ, type SimpleSpreadElement as bK, type SimpleSwitchCase as bL, type SimpleSwitchStatement as bM, type SimpleTemplateElement as bN, type SimpleTemplateLiteral as bO, type SimpleThisExpression as bP, type SimpleThrowStatement as bQ, type SimpleTryStatement as bR, type SimpleUnaryExpression as bS, type SimpleUpdateExpression as bT, type SimpleVariableDeclaration as bU, type SimpleVariableDeclarator as bV, type SimpleWhileStatement as bW, type SourceLocation as bX, type Statement as bY, type TSLite as bZ, type TSLiteMarker as b_, type SimpleCatchClause as ba, type SimpleChainExpression as bb, type SimpleComment as bc, type SimpleConditionalExpression as bd, type SimpleContinueStatement as be, type SimpleDoWhileStatement as bf, type SimpleEmptyStatement as bg, type SimpleExpressionStatement as bh, type SimpleForInStatement as bi, type SimpleForOfStatement as bj, type SimpleForStatement as bk, type SimpleFunctionDeclaration as bl, type SimpleFunctionExpression as bm, type SimpleIdentifier as bn, type SimpleIfStatement as bo, type SimpleJsonExpression as bp, type SimpleLabeledStatement as bq, type SimpleLiteral as br, type SimpleLogicalExpression as bs, type SimpleMemberExpression as bt, type SimpleMethodDefinition as bu, type SimpleNewExpression as bv, type SimpleNode as bw, type SimpleObjectExpression as bx, type SimpleObjectPattern as by, type SimplePosition as bz, type AssignmentExpression as c, returnStatement as c$, type ThisExpression as c0, type UnaryOperator as c1, type UpdateOperator as c2, ast as c3, fromAstMarker as c4, json as c5, jsonExpression as c6, types as c7, arrayExpression as c8, arrayPattern as c9, importDeclaration as cA, importDefaultSpecifier as cB, importNamespaceSpecifier as cC, importSpecifier as cD, jsxAttribute as cE, jsxClosingElement as cF, jsxClosingFragment as cG, jsxElement as cH, jsxEmptyExpression as cI, jsxExpressionContainer as cJ, jsxFragment as cK, jsxIdentifier as cL, jsxMemberExpression as cM, jsxNamespacedName as cN, jsxOpeningElement as cO, jsxOpeningFragment as cP, jsxSpreadAttribute as cQ, jsxText as cR, literal as cS, logicalExpression as cT, memberExpression as cU, newExpression as cV, objectExpression as cW, objectPattern as cX, program as cY, property as cZ, restElement as c_, arrowFunctionExpression as ca, assignmentExpression as cb, assignmentPattern as cc, assignmentProperty as cd, awaitExpression as ce, binaryExpression as cf, blockStatement as cg, breakStatement as ch, callExpression as ci, catchClause as cj, chainExpression as ck, conditionalExpression as cl, continueStatement as cm, doWhileStatement as cn, emptyStatement as co, exportDefaultDeclaration as cp, exportNamedDeclaration as cq, exportSpecifier as cr, expressionStatement as cs, forInStatement as ct, forOfStatement as cu, forStatement as cv, functionDeclaration as cw, functionExpression as cx, identifier as cy, ifStatement as cz, type AssignmentProperty as d, spreadElement as d0, switchCase as d1, switchStatement as d2, templateElement as d3, templateLiteral as d4, throwStatement as d5, tryStatement as d6, unaryExpression as d7, updateExpression as d8, variableDeclaration as d9, variableDeclarator as da, whileStatement as db, type AwaitExpression as e, type BinaryExpression as f, type BlockStatement as g, type BreakStatement as h, type ChainExpression as i, type ConditionalExpression as j, type ContinueStatement as k, type ExpressionStatement as l, type ForOfStatement as m, type ForStatement as n, type FunctionDeclaration as o, type FunctionExpression as p, type IfStatement as q, type ImportDeclaration as r, type ImportDefaultSpecifier as s, type ImportNamespaceSpecifier as t, type ImportSpecifier as u, type LogicalExpression as v, type NewExpression as w, type ObjectPattern as x, type Property as y, type SwitchCase as z };
1058
+ export { type Directive as $, type ArrayExpression as A, type BaseNode as B, type CatchClause as C, type DoWhileStatement as D, type EmptyStatement as E, type ForInStatement as F, type SwitchStatement as G, type TemplateLiteral as H, type Identifier as I, type JsonExpression as J, type ThrowStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type TryStatement as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type UpdateExpression as V, type VariableDeclaration as W, type VariableDeclarator as X, type WhileStatement as Y, type SpreadElement as Z, type RestElement as _, type ArrayPattern as a, type SimpleBaseExpression as a$, type ModuleDeclaration as a0, type JSXElement as a1, type JSXFragment as a2, type CallExpression as a3, type AssignmentOperator as a4, type AssignmentPattern as a5, type BaseCallExpression as a6, type BaseDeclaration as a7, type BaseExpression as a8, type BaseForXStatement as a9, type JSXNamespacedName as aA, type JSXOpeningElement as aB, type JSXOpeningFragment as aC, type JSXSpreadAttribute as aD, type JSXTagName as aE, type JSXText as aF, type LabeledStatement as aG, type LogicalOperator as aH, type MaybeNamedFunctionDeclaration as aI, type MetaProperty as aJ, type MethodDefinition as aK, type ModuleSpecifier as aL, type NodeMap as aM, type Pattern as aN, type Position as aO, type PropertyDefinition as aP, type RegExpLiteral as aQ, type SequenceExpression as aR, type SimpleArrayExpression as aS, type SimpleArrayPattern as aT, type SimpleArrowFunctionExpression as aU, type SimpleAssignmentExpression as aV, type SimpleAssignmentPattern as aW, type SimpleAssignmentProperty as aX, type SimpleAwaitExpression as aY, type SimpleBaseCallExpression as aZ, type SimpleBaseDeclaration as a_, type BaseFunction as aa, type BaseModuleDeclaration as ab, type BaseModuleSpecifier as ac, type BaseNodeWithoutComments as ad, type BasePattern as ae, type BaseStatement as af, type BigIntLiteral as ag, type BinaryOperator as ah, type ChainElement as ai, type Comment as aj, type DebuggerStatement as ak, type Declaration as al, type ExportDefaultDeclaration as am, type ExportNamedDeclaration as an, type ExportSpecifier as ao, type Expression as ap, type Function as aq, type ImportExpression as ar, type JSXAttribute as as, type JSXChild as at, type JSXClosingElement as au, type JSXClosingFragment as av, type JSXEmptyExpression as aw, type JSXExpressionContainer as ax, type JSXIdentifier as ay, type JSXMemberExpression as az, type ArrowFunctionExpression as b, type TSConditionalType as b$, type SimpleBaseForXStatement as b0, type SimpleBaseFunction as b1, type SimpleBaseNode as b2, type SimpleBaseNodeWithoutComments as b3, type SimpleBasePattern as b4, type SimpleBaseStatement as b5, type SimpleBigIntLiteral as b6, type SimpleBinaryExpression as b7, type SimpleBlockStatement as b8, type SimpleBreakStatement as b9, type SimpleProgram as bA, type SimpleProperty as bB, type SimplePropertyDefinition as bC, type SimpleRegExpLiteral as bD, type SimpleRestElement as bE, type SimpleReturnStatement as bF, type SimpleSequenceExpression as bG, type SimpleSimpleCallExpression as bH, type SimpleSimpleLiteral as bI, type SimpleSourceLocation as bJ, type SimpleSpreadElement as bK, type SimpleSwitchCase as bL, type SimpleSwitchStatement as bM, type SimpleTemplateElement as bN, type SimpleTemplateLiteral as bO, type SimpleThisExpression as bP, type SimpleThrowStatement as bQ, type SimpleTryStatement as bR, type SimpleUnaryExpression as bS, type SimpleUpdateExpression as bT, type SimpleVariableDeclaration as bU, type SimpleVariableDeclarator as bV, type SimpleWhileStatement as bW, type SourceLocation as bX, type Statement as bY, type TSArrayType as bZ, type TSCallSignatureDeclaration as b_, type SimpleCatchClause as ba, type SimpleChainExpression as bb, type SimpleComment as bc, type SimpleConditionalExpression as bd, type SimpleContinueStatement as be, type SimpleDoWhileStatement as bf, type SimpleEmptyStatement as bg, type SimpleExpressionStatement as bh, type SimpleForInStatement as bi, type SimpleForOfStatement as bj, type SimpleForStatement as bk, type SimpleFunctionDeclaration as bl, type SimpleFunctionExpression as bm, type SimpleIdentifier as bn, type SimpleIfStatement as bo, type SimpleJsonExpression as bp, type SimpleLabeledStatement as bq, type SimpleLiteral as br, type SimpleLogicalExpression as bs, type SimpleMemberExpression as bt, type SimpleMethodDefinition as bu, type SimpleNewExpression as bv, type SimpleNode as bw, type SimpleObjectExpression as bx, type SimpleObjectPattern as by, type SimplePosition as bz, type AssignmentExpression as c, jsxClosingFragment as c$, type TSFunctionType as c0, type TSIndexSignature as c1, type TSIndexedAccessType as c2, type TSInferType as c3, type TSIntersectionType as c4, type TSKeywordType as c5, type TSLite as c6, type TSLiteMarker as c7, type TSLiteralType as c8, type TSMappedType as c9, binaryExpression as cA, blockStatement as cB, breakStatement as cC, callExpression as cD, catchClause as cE, chainExpression as cF, conditionalExpression as cG, continueStatement as cH, doWhileStatement as cI, emptyStatement as cJ, exportDefaultDeclaration as cK, exportNamedDeclaration as cL, exportSpecifier as cM, expressionStatement as cN, forInStatement as cO, forOfStatement as cP, forStatement as cQ, functionDeclaration as cR, functionExpression as cS, identifier as cT, ifStatement as cU, importDeclaration as cV, importDefaultSpecifier as cW, importNamespaceSpecifier as cX, importSpecifier as cY, jsxAttribute as cZ, jsxClosingElement as c_, type TSPropertySignature as ca, type TSTupleType as cb, type TSType as cc, type TSTypeLiteral as cd, type TSTypeMember as ce, type TSTypeOperator as cf, type TSTypeParameter as cg, type TSTypeQuery as ch, type TSTypeReference as ci, type TSUnionType as cj, type TaggedTemplateExpression as ck, type ThisExpression as cl, type UnaryOperator as cm, type UpdateOperator as cn, expr as co, fromExprMarker as cp, json as cq, jsonExpression as cr, types as cs, arrayExpression as ct, arrayPattern as cu, arrowFunctionExpression as cv, assignmentExpression as cw, assignmentPattern as cx, assignmentProperty as cy, awaitExpression as cz, type AssignmentProperty as d, jsxElement as d0, jsxEmptyExpression as d1, jsxExpressionContainer as d2, jsxFragment as d3, jsxIdentifier as d4, jsxMemberExpression as d5, jsxNamespacedName as d6, jsxOpeningElement as d7, jsxOpeningFragment as d8, jsxSpreadAttribute as d9, jsxText as da, literal as db, logicalExpression as dc, memberExpression as dd, newExpression as de, objectExpression as df, objectPattern as dg, program as dh, property as di, restElement as dj, returnStatement as dk, spreadElement as dl, switchCase as dm, switchStatement as dn, templateElement as dp, templateLiteral as dq, throwStatement as dr, tryStatement as ds, unaryExpression as dt, updateExpression as du, variableDeclaration as dv, variableDeclarator as dw, whileStatement as dx, type AwaitExpression as e, type BinaryExpression as f, type BlockStatement as g, type BreakStatement as h, type ChainExpression as i, type ConditionalExpression as j, type ContinueStatement as k, type ExpressionStatement as l, type ForOfStatement as m, type ForStatement as n, type FunctionDeclaration as o, type FunctionExpression as p, type IfStatement as q, type ImportDeclaration as r, type ImportDefaultSpecifier as s, type ImportNamespaceSpecifier as t, type ImportSpecifier as u, type LogicalExpression as v, type NewExpression as w, type ObjectPattern as x, type Property as y, type SwitchCase as z };
@@ -138,15 +138,15 @@ type Function = ArrowFunctionExpression | FunctionDeclaration | FunctionExpressi
138
138
  * TSLite — a forma serializada da linguagem TSLite.
139
139
  *
140
140
  * JSON puro (dados estáticos) entremeado de ilhas executáveis marcadas com
141
- * `#ast`, cujo valor é o tipo do nó ESTree. É portável, serializável e
141
+ * `#expr`, cujo valor é o tipo do nó ESTree. É portável, serializável e
142
142
  * diffável: `encode()` produz, `decode()` consome, `printJson()` emite.
143
143
  */
144
144
  type TSLite = string | number | boolean | null | TSLite[] | TSLiteMarker | {
145
145
  [key: string]: TSLite;
146
146
  };
147
- /** Ilha executável dentro do TSLite (o valor de `#ast` é o tipo do nó). */
147
+ /** Ilha executável dentro do TSLite (o valor de `#expr` é o tipo do nó). */
148
148
  interface TSLiteMarker {
149
- "#ast": string;
149
+ "#expr": string;
150
150
  [prop: string]: unknown;
151
151
  }
152
152
  /**
@@ -554,6 +554,125 @@ interface ImportDefaultSpecifier extends BaseModuleSpecifier {
554
554
  interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
555
555
  type: "ImportNamespaceSpecifier";
556
556
  }
557
+ /** Qualquer nó de tipo sintático. */
558
+ type TSType = TSKeywordType | TSLiteralType | TSTypeReference | TSArrayType | TSIndexedAccessType | TSUnionType | TSIntersectionType | TSFunctionType | TSTypeLiteral | TSTupleType | TSTypeOperator | TSInferType | TSConditionalType | TSMappedType | TSTypeQuery;
559
+ /** `string`/`number`/`boolean`/`any`/`unknown`/`undefined`/`void`/`null`/`never`. */
560
+ interface TSKeywordType extends BaseNode {
561
+ type: "TSKeywordType";
562
+ kind: "string" | "number" | "boolean" | "any" | "unknown" | "undefined" | "void" | "null" | "never";
563
+ }
564
+ /** `"paid"` / `42` / `true` em posição de tipo. */
565
+ interface TSLiteralType extends BaseNode {
566
+ type: "TSLiteralType";
567
+ literal: string | number | boolean;
568
+ }
569
+ /** Um nome de tipo: `User`, `Box<T>`, `T` (type-param) — o Schema (var/apply/
570
+ * ReturnType/Parameters) é decidido na conversão, com o escopo. */
571
+ interface TSTypeReference extends BaseNode {
572
+ type: "TSTypeReference";
573
+ typeName: string;
574
+ typeArguments?: TSType[];
575
+ }
576
+ /** `T[]` (`readonly T[]` marca a flag, como o Schema). */
577
+ interface TSArrayType extends BaseNode {
578
+ type: "TSArrayType";
579
+ elementType: TSType;
580
+ readonly?: boolean;
581
+ }
582
+ /** `T[K]` — indexed access. */
583
+ interface TSIndexedAccessType extends BaseNode {
584
+ type: "TSIndexedAccessType";
585
+ objectType: TSType;
586
+ indexType: TSType;
587
+ }
588
+ /** `A | B | C`. */
589
+ interface TSUnionType extends BaseNode {
590
+ type: "TSUnionType";
591
+ types: TSType[];
592
+ }
593
+ /** `A & B & C`. */
594
+ interface TSIntersectionType extends BaseNode {
595
+ type: "TSIntersectionType";
596
+ types: TSType[];
597
+ }
598
+ /** Um parâmetro de function type / call signature (`a: T`, `a?: T`). */
599
+ interface TSTypeParameter extends BaseNode {
600
+ type: "TSTypeParameter";
601
+ name: string;
602
+ typeAnnotation: TSType;
603
+ optional?: boolean;
604
+ }
605
+ /** `(a: T, b?: U) => R` — `typeParams` são os nomes de genérico declarados. */
606
+ interface TSFunctionType extends BaseNode {
607
+ type: "TSFunctionType";
608
+ params: TSTypeParameter[];
609
+ returnType: TSType;
610
+ typeParams?: string[];
611
+ }
612
+ /** `{ k: T; k2?: U }` (+ index/call signatures). */
613
+ interface TSTypeLiteral extends BaseNode {
614
+ type: "TSTypeLiteral";
615
+ members: TSTypeMember[];
616
+ }
617
+ type TSTypeMember = TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration;
618
+ /** Um membro `k: T` (ou `k?: T`) de um object type — ONDE comentários ancoram. */
619
+ interface TSPropertySignature extends BaseNode {
620
+ type: "TSPropertySignature";
621
+ key: string;
622
+ typeAnnotation: TSType;
623
+ optional?: boolean;
624
+ }
625
+ /** `[k: string]: V`. */
626
+ interface TSIndexSignature extends BaseNode {
627
+ type: "TSIndexSignature";
628
+ keyType: "string" | "number";
629
+ typeAnnotation: TSType;
630
+ }
631
+ /** `(a: T): R` dentro de um object type (uma → fn; várias → overload). */
632
+ interface TSCallSignatureDeclaration extends BaseNode {
633
+ type: "TSCallSignatureDeclaration";
634
+ params: TSTypeParameter[];
635
+ returnType: TSType;
636
+ }
637
+ /** `[A, B?, ...R[]]` — `flags` espelha o `ElementFlags` do Schema. */
638
+ interface TSTupleType extends BaseNode {
639
+ type: "TSTupleType";
640
+ elementTypes: TSType[];
641
+ flags?: string[];
642
+ readonly?: boolean;
643
+ }
644
+ /** `keyof T` (prefixo). `readonly` mora como flag no array/tuple, não aqui. */
645
+ interface TSTypeOperator extends BaseNode {
646
+ type: "TSTypeOperator";
647
+ operator: "keyof";
648
+ typeAnnotation: TSType;
649
+ }
650
+ /** `infer U` (só no ramo `extends` de um conditional). */
651
+ interface TSInferType extends BaseNode {
652
+ type: "TSInferType";
653
+ name: string;
654
+ }
655
+ /** `C extends E ? T : F`. */
656
+ interface TSConditionalType extends BaseNode {
657
+ type: "TSConditionalType";
658
+ checkType: TSType;
659
+ extendsType: TSType;
660
+ trueType: TSType;
661
+ falseType: TSType;
662
+ }
663
+ /** `{ [K in Over]?: Body }`. */
664
+ interface TSMappedType extends BaseNode {
665
+ type: "TSMappedType";
666
+ key: string;
667
+ constraint: TSType;
668
+ typeAnnotation: TSType;
669
+ optional?: boolean;
670
+ }
671
+ /** `typeof x` / `typeof a.b` — o path do entity name. */
672
+ interface TSTypeQuery extends BaseNode {
673
+ type: "TSTypeQuery";
674
+ exprName: string[];
675
+ }
557
676
  type SimpleArrayExpression = Partial<ArrayExpression>;
558
677
  type SimpleArrayPattern = Partial<ArrayPattern>;
559
678
  type SimpleArrowFunctionExpression = Partial<ArrowFunctionExpression>;
@@ -792,8 +911,29 @@ type types_SpreadElement = SpreadElement;
792
911
  type types_Statement = Statement;
793
912
  type types_SwitchCase = SwitchCase;
794
913
  type types_SwitchStatement = SwitchStatement;
914
+ type types_TSArrayType = TSArrayType;
915
+ type types_TSCallSignatureDeclaration = TSCallSignatureDeclaration;
916
+ type types_TSConditionalType = TSConditionalType;
917
+ type types_TSFunctionType = TSFunctionType;
918
+ type types_TSIndexSignature = TSIndexSignature;
919
+ type types_TSIndexedAccessType = TSIndexedAccessType;
920
+ type types_TSInferType = TSInferType;
921
+ type types_TSIntersectionType = TSIntersectionType;
922
+ type types_TSKeywordType = TSKeywordType;
795
923
  type types_TSLite = TSLite;
796
924
  type types_TSLiteMarker = TSLiteMarker;
925
+ type types_TSLiteralType = TSLiteralType;
926
+ type types_TSMappedType = TSMappedType;
927
+ type types_TSPropertySignature = TSPropertySignature;
928
+ type types_TSTupleType = TSTupleType;
929
+ type types_TSType = TSType;
930
+ type types_TSTypeLiteral = TSTypeLiteral;
931
+ type types_TSTypeMember = TSTypeMember;
932
+ type types_TSTypeOperator = TSTypeOperator;
933
+ type types_TSTypeParameter = TSTypeParameter;
934
+ type types_TSTypeQuery = TSTypeQuery;
935
+ type types_TSTypeReference = TSTypeReference;
936
+ type types_TSUnionType = TSUnionType;
797
937
  type types_TaggedTemplateExpression = TaggedTemplateExpression;
798
938
  type types_TemplateElement = TemplateElement;
799
939
  type types_TemplateLiteral = TemplateLiteral;
@@ -808,39 +948,39 @@ type types_VariableDeclaration = VariableDeclaration;
808
948
  type types_VariableDeclarator = VariableDeclarator;
809
949
  type types_WhileStatement = WhileStatement;
810
950
  declare namespace types {
811
- export type { types_ArrayExpression as ArrayExpression, types_ArrayPattern as ArrayPattern, types_ArrowFunctionExpression as ArrowFunctionExpression, types_AssignmentExpression as AssignmentExpression, types_AssignmentOperator as AssignmentOperator, types_AssignmentPattern as AssignmentPattern, types_AssignmentProperty as AssignmentProperty, types_AwaitExpression as AwaitExpression, types_BaseCallExpression as BaseCallExpression, types_BaseDeclaration as BaseDeclaration, types_BaseExpression as BaseExpression, types_BaseForXStatement as BaseForXStatement, types_BaseFunction as BaseFunction, types_BaseModuleDeclaration as BaseModuleDeclaration, types_BaseModuleSpecifier as BaseModuleSpecifier, types_BaseNode as BaseNode, types_BaseNodeWithoutComments as BaseNodeWithoutComments, types_BasePattern as BasePattern, types_BaseStatement as BaseStatement, types_BigIntLiteral as BigIntLiteral, types_BinaryExpression as BinaryExpression, types_BinaryOperator as BinaryOperator, types_BlockStatement as BlockStatement, types_BreakStatement as BreakStatement, types_CallExpression as CallExpression, types_CatchClause as CatchClause, types_ChainElement as ChainElement, types_ChainExpression as ChainExpression, types_Comment as Comment, types_ConditionalExpression as ConditionalExpression, types_ContinueStatement as ContinueStatement, types_DebuggerStatement as DebuggerStatement, types_Declaration as Declaration, types_Directive as Directive, types_DoWhileStatement as DoWhileStatement, types_EmptyStatement as EmptyStatement, types_ExportDefaultDeclaration as ExportDefaultDeclaration, types_ExportNamedDeclaration as ExportNamedDeclaration, types_ExportSpecifier as ExportSpecifier, types_Expression as Expression, types_ExpressionStatement as ExpressionStatement, types_ForInStatement as ForInStatement, types_ForOfStatement as ForOfStatement, types_ForStatement as ForStatement, types_Function as Function, types_FunctionDeclaration as FunctionDeclaration, types_FunctionExpression as FunctionExpression, types_Identifier as Identifier, types_IfStatement as IfStatement, types_ImportDeclaration as ImportDeclaration, types_ImportDefaultSpecifier as ImportDefaultSpecifier, types_ImportExpression as ImportExpression, types_ImportNamespaceSpecifier as ImportNamespaceSpecifier, types_ImportSpecifier as ImportSpecifier, types_JSXAttribute as JSXAttribute, types_JSXChild as JSXChild, types_JSXClosingElement as JSXClosingElement, types_JSXClosingFragment as JSXClosingFragment, types_JSXElement as JSXElement, types_JSXEmptyExpression as JSXEmptyExpression, types_JSXExpressionContainer as JSXExpressionContainer, types_JSXFragment as JSXFragment, types_JSXIdentifier as JSXIdentifier, types_JSXMemberExpression as JSXMemberExpression, types_JSXNamespacedName as JSXNamespacedName, types_JSXOpeningElement as JSXOpeningElement, types_JSXOpeningFragment as JSXOpeningFragment, types_JSXSpreadAttribute as JSXSpreadAttribute, types_JSXTagName as JSXTagName, types_JSXText as JSXText, types_JsonExpression as JsonExpression, types_LabeledStatement as LabeledStatement, types_Literal as Literal, types_LogicalExpression as LogicalExpression, types_LogicalOperator as LogicalOperator, types_MaybeNamedFunctionDeclaration as MaybeNamedFunctionDeclaration, types_MemberExpression as MemberExpression, types_MetaProperty as MetaProperty, types_MethodDefinition as MethodDefinition, types_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_NewExpression as NewExpression, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Position as Position, types_Program as Program, types_Property as Property, types_PropertyDefinition as PropertyDefinition, types_RegExpLiteral as RegExpLiteral, types_RestElement as RestElement, types_ReturnStatement as ReturnStatement, types_SequenceExpression as SequenceExpression, types_SimpleArrayExpression as SimpleArrayExpression, types_SimpleArrayPattern as SimpleArrayPattern, types_SimpleArrowFunctionExpression as SimpleArrowFunctionExpression, types_SimpleAssignmentExpression as SimpleAssignmentExpression, types_SimpleAssignmentPattern as SimpleAssignmentPattern, types_SimpleAssignmentProperty as SimpleAssignmentProperty, types_SimpleAwaitExpression as SimpleAwaitExpression, types_SimpleBaseCallExpression as SimpleBaseCallExpression, types_SimpleBaseDeclaration as SimpleBaseDeclaration, types_SimpleBaseExpression as SimpleBaseExpression, types_SimpleBaseForXStatement as SimpleBaseForXStatement, types_SimpleBaseFunction as SimpleBaseFunction, types_SimpleBaseNode as SimpleBaseNode, types_SimpleBaseNodeWithoutComments as SimpleBaseNodeWithoutComments, types_SimpleBasePattern as SimpleBasePattern, types_SimpleBaseStatement as SimpleBaseStatement, types_SimpleBigIntLiteral as SimpleBigIntLiteral, types_SimpleBinaryExpression as SimpleBinaryExpression, types_SimpleBlockStatement as SimpleBlockStatement, types_SimpleBreakStatement as SimpleBreakStatement, types_SimpleCallExpression as SimpleCallExpression, types_SimpleCatchClause as SimpleCatchClause, types_SimpleChainExpression as SimpleChainExpression, types_SimpleComment as SimpleComment, types_SimpleConditionalExpression as SimpleConditionalExpression, types_SimpleContinueStatement as SimpleContinueStatement, types_SimpleDoWhileStatement as SimpleDoWhileStatement, types_SimpleEmptyStatement as SimpleEmptyStatement, types_SimpleExpressionStatement as SimpleExpressionStatement, types_SimpleForInStatement as SimpleForInStatement, types_SimpleForOfStatement as SimpleForOfStatement, types_SimpleForStatement as SimpleForStatement, types_SimpleFunctionDeclaration as SimpleFunctionDeclaration, types_SimpleFunctionExpression as SimpleFunctionExpression, types_SimpleIdentifier as SimpleIdentifier, types_SimpleIfStatement as SimpleIfStatement, types_SimpleJsonExpression as SimpleJsonExpression, types_SimpleLabeledStatement as SimpleLabeledStatement, types_SimpleLiteral as SimpleLiteral, types_SimpleLogicalExpression as SimpleLogicalExpression, types_SimpleMemberExpression as SimpleMemberExpression, types_SimpleMethodDefinition as SimpleMethodDefinition, types_SimpleNewExpression as SimpleNewExpression, types_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, types_SimplePropertyDefinition as SimplePropertyDefinition, types_SimpleRegExpLiteral as SimpleRegExpLiteral, types_SimpleRestElement as SimpleRestElement, types_SimpleReturnStatement as SimpleReturnStatement, types_SimpleSequenceExpression as SimpleSequenceExpression, types_SimpleSimpleCallExpression as SimpleSimpleCallExpression, types_SimpleSimpleLiteral as SimpleSimpleLiteral, types_SimpleSourceLocation as SimpleSourceLocation, types_SimpleSpreadElement as SimpleSpreadElement, types_SimpleSwitchCase as SimpleSwitchCase, types_SimpleSwitchStatement as SimpleSwitchStatement, types_SimpleTemplateElement as SimpleTemplateElement, types_SimpleTemplateLiteral as SimpleTemplateLiteral, types_SimpleThisExpression as SimpleThisExpression, types_SimpleThrowStatement as SimpleThrowStatement, types_SimpleTryStatement as SimpleTryStatement, types_SimpleUnaryExpression as SimpleUnaryExpression, types_SimpleUpdateExpression as SimpleUpdateExpression, types_SimpleVariableDeclaration as SimpleVariableDeclaration, types_SimpleVariableDeclarator as SimpleVariableDeclarator, types_SimpleWhileStatement as SimpleWhileStatement, types_SourceLocation as SourceLocation, types_SpreadElement as SpreadElement, types_Statement as Statement, types_SwitchCase as SwitchCase, types_SwitchStatement as SwitchStatement, types_TSLite as TSLite, types_TSLiteMarker as TSLiteMarker, types_TaggedTemplateExpression as TaggedTemplateExpression, types_TemplateElement as TemplateElement, types_TemplateLiteral as TemplateLiteral, types_ThisExpression as ThisExpression, types_ThrowStatement as ThrowStatement, types_TryStatement as TryStatement, types_UnaryExpression as UnaryExpression, types_UnaryOperator as UnaryOperator, types_UpdateExpression as UpdateExpression, types_UpdateOperator as UpdateOperator, types_VariableDeclaration as VariableDeclaration, types_VariableDeclarator as VariableDeclarator, types_WhileStatement as WhileStatement };
951
+ export type { types_ArrayExpression as ArrayExpression, types_ArrayPattern as ArrayPattern, types_ArrowFunctionExpression as ArrowFunctionExpression, types_AssignmentExpression as AssignmentExpression, types_AssignmentOperator as AssignmentOperator, types_AssignmentPattern as AssignmentPattern, types_AssignmentProperty as AssignmentProperty, types_AwaitExpression as AwaitExpression, types_BaseCallExpression as BaseCallExpression, types_BaseDeclaration as BaseDeclaration, types_BaseExpression as BaseExpression, types_BaseForXStatement as BaseForXStatement, types_BaseFunction as BaseFunction, types_BaseModuleDeclaration as BaseModuleDeclaration, types_BaseModuleSpecifier as BaseModuleSpecifier, types_BaseNode as BaseNode, types_BaseNodeWithoutComments as BaseNodeWithoutComments, types_BasePattern as BasePattern, types_BaseStatement as BaseStatement, types_BigIntLiteral as BigIntLiteral, types_BinaryExpression as BinaryExpression, types_BinaryOperator as BinaryOperator, types_BlockStatement as BlockStatement, types_BreakStatement as BreakStatement, types_CallExpression as CallExpression, types_CatchClause as CatchClause, types_ChainElement as ChainElement, types_ChainExpression as ChainExpression, types_Comment as Comment, types_ConditionalExpression as ConditionalExpression, types_ContinueStatement as ContinueStatement, types_DebuggerStatement as DebuggerStatement, types_Declaration as Declaration, types_Directive as Directive, types_DoWhileStatement as DoWhileStatement, types_EmptyStatement as EmptyStatement, types_ExportDefaultDeclaration as ExportDefaultDeclaration, types_ExportNamedDeclaration as ExportNamedDeclaration, types_ExportSpecifier as ExportSpecifier, types_Expression as Expression, types_ExpressionStatement as ExpressionStatement, types_ForInStatement as ForInStatement, types_ForOfStatement as ForOfStatement, types_ForStatement as ForStatement, types_Function as Function, types_FunctionDeclaration as FunctionDeclaration, types_FunctionExpression as FunctionExpression, types_Identifier as Identifier, types_IfStatement as IfStatement, types_ImportDeclaration as ImportDeclaration, types_ImportDefaultSpecifier as ImportDefaultSpecifier, types_ImportExpression as ImportExpression, types_ImportNamespaceSpecifier as ImportNamespaceSpecifier, types_ImportSpecifier as ImportSpecifier, types_JSXAttribute as JSXAttribute, types_JSXChild as JSXChild, types_JSXClosingElement as JSXClosingElement, types_JSXClosingFragment as JSXClosingFragment, types_JSXElement as JSXElement, types_JSXEmptyExpression as JSXEmptyExpression, types_JSXExpressionContainer as JSXExpressionContainer, types_JSXFragment as JSXFragment, types_JSXIdentifier as JSXIdentifier, types_JSXMemberExpression as JSXMemberExpression, types_JSXNamespacedName as JSXNamespacedName, types_JSXOpeningElement as JSXOpeningElement, types_JSXOpeningFragment as JSXOpeningFragment, types_JSXSpreadAttribute as JSXSpreadAttribute, types_JSXTagName as JSXTagName, types_JSXText as JSXText, types_JsonExpression as JsonExpression, types_LabeledStatement as LabeledStatement, types_Literal as Literal, types_LogicalExpression as LogicalExpression, types_LogicalOperator as LogicalOperator, types_MaybeNamedFunctionDeclaration as MaybeNamedFunctionDeclaration, types_MemberExpression as MemberExpression, types_MetaProperty as MetaProperty, types_MethodDefinition as MethodDefinition, types_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_NewExpression as NewExpression, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Position as Position, types_Program as Program, types_Property as Property, types_PropertyDefinition as PropertyDefinition, types_RegExpLiteral as RegExpLiteral, types_RestElement as RestElement, types_ReturnStatement as ReturnStatement, types_SequenceExpression as SequenceExpression, types_SimpleArrayExpression as SimpleArrayExpression, types_SimpleArrayPattern as SimpleArrayPattern, types_SimpleArrowFunctionExpression as SimpleArrowFunctionExpression, types_SimpleAssignmentExpression as SimpleAssignmentExpression, types_SimpleAssignmentPattern as SimpleAssignmentPattern, types_SimpleAssignmentProperty as SimpleAssignmentProperty, types_SimpleAwaitExpression as SimpleAwaitExpression, types_SimpleBaseCallExpression as SimpleBaseCallExpression, types_SimpleBaseDeclaration as SimpleBaseDeclaration, types_SimpleBaseExpression as SimpleBaseExpression, types_SimpleBaseForXStatement as SimpleBaseForXStatement, types_SimpleBaseFunction as SimpleBaseFunction, types_SimpleBaseNode as SimpleBaseNode, types_SimpleBaseNodeWithoutComments as SimpleBaseNodeWithoutComments, types_SimpleBasePattern as SimpleBasePattern, types_SimpleBaseStatement as SimpleBaseStatement, types_SimpleBigIntLiteral as SimpleBigIntLiteral, types_SimpleBinaryExpression as SimpleBinaryExpression, types_SimpleBlockStatement as SimpleBlockStatement, types_SimpleBreakStatement as SimpleBreakStatement, types_SimpleCallExpression as SimpleCallExpression, types_SimpleCatchClause as SimpleCatchClause, types_SimpleChainExpression as SimpleChainExpression, types_SimpleComment as SimpleComment, types_SimpleConditionalExpression as SimpleConditionalExpression, types_SimpleContinueStatement as SimpleContinueStatement, types_SimpleDoWhileStatement as SimpleDoWhileStatement, types_SimpleEmptyStatement as SimpleEmptyStatement, types_SimpleExpressionStatement as SimpleExpressionStatement, types_SimpleForInStatement as SimpleForInStatement, types_SimpleForOfStatement as SimpleForOfStatement, types_SimpleForStatement as SimpleForStatement, types_SimpleFunctionDeclaration as SimpleFunctionDeclaration, types_SimpleFunctionExpression as SimpleFunctionExpression, types_SimpleIdentifier as SimpleIdentifier, types_SimpleIfStatement as SimpleIfStatement, types_SimpleJsonExpression as SimpleJsonExpression, types_SimpleLabeledStatement as SimpleLabeledStatement, types_SimpleLiteral as SimpleLiteral, types_SimpleLogicalExpression as SimpleLogicalExpression, types_SimpleMemberExpression as SimpleMemberExpression, types_SimpleMethodDefinition as SimpleMethodDefinition, types_SimpleNewExpression as SimpleNewExpression, types_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, types_SimplePropertyDefinition as SimplePropertyDefinition, types_SimpleRegExpLiteral as SimpleRegExpLiteral, types_SimpleRestElement as SimpleRestElement, types_SimpleReturnStatement as SimpleReturnStatement, types_SimpleSequenceExpression as SimpleSequenceExpression, types_SimpleSimpleCallExpression as SimpleSimpleCallExpression, types_SimpleSimpleLiteral as SimpleSimpleLiteral, types_SimpleSourceLocation as SimpleSourceLocation, types_SimpleSpreadElement as SimpleSpreadElement, types_SimpleSwitchCase as SimpleSwitchCase, types_SimpleSwitchStatement as SimpleSwitchStatement, types_SimpleTemplateElement as SimpleTemplateElement, types_SimpleTemplateLiteral as SimpleTemplateLiteral, types_SimpleThisExpression as SimpleThisExpression, types_SimpleThrowStatement as SimpleThrowStatement, types_SimpleTryStatement as SimpleTryStatement, types_SimpleUnaryExpression as SimpleUnaryExpression, types_SimpleUpdateExpression as SimpleUpdateExpression, types_SimpleVariableDeclaration as SimpleVariableDeclaration, types_SimpleVariableDeclarator as SimpleVariableDeclarator, types_SimpleWhileStatement as SimpleWhileStatement, types_SourceLocation as SourceLocation, types_SpreadElement as SpreadElement, types_Statement as Statement, types_SwitchCase as SwitchCase, types_SwitchStatement as SwitchStatement, types_TSArrayType as TSArrayType, types_TSCallSignatureDeclaration as TSCallSignatureDeclaration, types_TSConditionalType as TSConditionalType, types_TSFunctionType as TSFunctionType, types_TSIndexSignature as TSIndexSignature, types_TSIndexedAccessType as TSIndexedAccessType, types_TSInferType as TSInferType, types_TSIntersectionType as TSIntersectionType, types_TSKeywordType as TSKeywordType, types_TSLite as TSLite, types_TSLiteMarker as TSLiteMarker, types_TSLiteralType as TSLiteralType, types_TSMappedType as TSMappedType, types_TSPropertySignature as TSPropertySignature, types_TSTupleType as TSTupleType, types_TSType as TSType, types_TSTypeLiteral as TSTypeLiteral, types_TSTypeMember as TSTypeMember, types_TSTypeOperator as TSTypeOperator, types_TSTypeParameter as TSTypeParameter, types_TSTypeQuery as TSTypeQuery, types_TSTypeReference as TSTypeReference, types_TSUnionType as TSUnionType, types_TaggedTemplateExpression as TaggedTemplateExpression, types_TemplateElement as TemplateElement, types_TemplateLiteral as TemplateLiteral, types_ThisExpression as ThisExpression, types_ThrowStatement as ThrowStatement, types_TryStatement as TryStatement, types_UnaryExpression as UnaryExpression, types_UnaryOperator as UnaryOperator, types_UpdateExpression as UpdateExpression, types_UpdateOperator as UpdateOperator, types_VariableDeclaration as VariableDeclaration, types_VariableDeclarator as VariableDeclarator, types_WhileStatement as WhileStatement };
812
952
  }
813
953
 
814
954
  /**
815
- * Cria um marcador #ast para embedar AST em JSON.
955
+ * Cria um marcador #expr para embedar AST em JSON.
816
956
  *
817
- * O formato usa #ast como o tipo do nó, sem wrapper body:
957
+ * O formato usa #expr como o tipo do nó, sem wrapper body:
818
958
  * ```
819
- * { "#ast": "CallExpression", "callee": {...}, "arguments": [] }
959
+ * { "#expr": "CallExpression", "callee": {...}, "arguments": [] }
820
960
  * ```
821
961
  *
822
962
  * @param node - Nó AST (deve ter propriedade `type`)
823
- * @returns Objeto com #ast marker pronto para JSON
963
+ * @returns Objeto com #expr marker pronto para JSON
824
964
  * @throws Se o tipo não for válido como entry point
825
965
  */
826
- declare const ast: (node: Node) => TSLiteMarker;
966
+ declare const expr: (node: Node) => TSLiteMarker;
827
967
  /**
828
- * Converte um objeto com #ast marker de volta para nó AST com type.
968
+ * Converte um objeto com #expr marker de volta para nó AST com type.
829
969
  *
830
970
  * Útil quando você tem um objeto no formato TSLite e precisa usar como nó AST
831
971
  * normal (ex: passar como argumento).
832
972
  *
833
- * @param obj - Objeto com #ast marker
834
- * @returns Nó AST com type (ou o objeto original se não tiver #ast)
973
+ * @param obj - Objeto com #expr marker
974
+ * @returns Nó AST com type (ou o objeto original se não tiver #expr)
835
975
  *
836
976
  * @example
837
977
  * ```ts
838
- * const astMarked = { "#ast": "Identifier", name: "foo" };
839
- * const node = fromAstMarker(astMarked);
978
+ * const exprMarked = { "#expr": "Identifier", name: "foo" };
979
+ * const node = fromExprMarker(exprMarked);
840
980
  * // { type: "Identifier", name: "foo" }
841
981
  * ```
842
982
  */
843
- declare const fromAstMarker: (obj: unknown) => unknown;
983
+ declare const fromExprMarker: (obj: unknown) => unknown;
844
984
  declare const identifier: (name: string) => Identifier;
845
985
  declare const literal: (value: string | boolean | number | null | RegExp | bigint | undefined) => Literal;
846
986
  declare const arrayExpression: (elements: Array<Expression | SpreadElement | null>) => ArrayExpression;
@@ -915,4 +1055,4 @@ declare const jsxElement: (openingElement: JSXOpeningElement, children?: JSXChil
915
1055
  declare const jsxFragment: (children?: JSXChild[], openingFragment?: JSXOpeningFragment, closingFragment?: JSXClosingFragment) => JSXFragment;
916
1056
  declare const json: (body: TSLite) => JsonExpression;
917
1057
 
918
- export { type Directive as $, type ArrayExpression as A, type BaseNode as B, type CatchClause as C, type DoWhileStatement as D, type EmptyStatement as E, type ForInStatement as F, type SwitchStatement as G, type TemplateLiteral as H, type Identifier as I, type JsonExpression as J, type ThrowStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type TryStatement as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type UpdateExpression as V, type VariableDeclaration as W, type VariableDeclarator as X, type WhileStatement as Y, type SpreadElement as Z, type RestElement as _, type ArrayPattern as a, type SimpleBaseExpression as a$, type ModuleDeclaration as a0, type JSXElement as a1, type JSXFragment as a2, type CallExpression as a3, type AssignmentOperator as a4, type AssignmentPattern as a5, type BaseCallExpression as a6, type BaseDeclaration as a7, type BaseExpression as a8, type BaseForXStatement as a9, type JSXNamespacedName as aA, type JSXOpeningElement as aB, type JSXOpeningFragment as aC, type JSXSpreadAttribute as aD, type JSXTagName as aE, type JSXText as aF, type LabeledStatement as aG, type LogicalOperator as aH, type MaybeNamedFunctionDeclaration as aI, type MetaProperty as aJ, type MethodDefinition as aK, type ModuleSpecifier as aL, type NodeMap as aM, type Pattern as aN, type Position as aO, type PropertyDefinition as aP, type RegExpLiteral as aQ, type SequenceExpression as aR, type SimpleArrayExpression as aS, type SimpleArrayPattern as aT, type SimpleArrowFunctionExpression as aU, type SimpleAssignmentExpression as aV, type SimpleAssignmentPattern as aW, type SimpleAssignmentProperty as aX, type SimpleAwaitExpression as aY, type SimpleBaseCallExpression as aZ, type SimpleBaseDeclaration as a_, type BaseFunction as aa, type BaseModuleDeclaration as ab, type BaseModuleSpecifier as ac, type BaseNodeWithoutComments as ad, type BasePattern as ae, type BaseStatement as af, type BigIntLiteral as ag, type BinaryOperator as ah, type ChainElement as ai, type Comment as aj, type DebuggerStatement as ak, type Declaration as al, type ExportDefaultDeclaration as am, type ExportNamedDeclaration as an, type ExportSpecifier as ao, type Expression as ap, type Function as aq, type ImportExpression as ar, type JSXAttribute as as, type JSXChild as at, type JSXClosingElement as au, type JSXClosingFragment as av, type JSXEmptyExpression as aw, type JSXExpressionContainer as ax, type JSXIdentifier as ay, type JSXMemberExpression as az, type ArrowFunctionExpression as b, type TaggedTemplateExpression as b$, type SimpleBaseForXStatement as b0, type SimpleBaseFunction as b1, type SimpleBaseNode as b2, type SimpleBaseNodeWithoutComments as b3, type SimpleBasePattern as b4, type SimpleBaseStatement as b5, type SimpleBigIntLiteral as b6, type SimpleBinaryExpression as b7, type SimpleBlockStatement as b8, type SimpleBreakStatement as b9, type SimpleProgram as bA, type SimpleProperty as bB, type SimplePropertyDefinition as bC, type SimpleRegExpLiteral as bD, type SimpleRestElement as bE, type SimpleReturnStatement as bF, type SimpleSequenceExpression as bG, type SimpleSimpleCallExpression as bH, type SimpleSimpleLiteral as bI, type SimpleSourceLocation as bJ, type SimpleSpreadElement as bK, type SimpleSwitchCase as bL, type SimpleSwitchStatement as bM, type SimpleTemplateElement as bN, type SimpleTemplateLiteral as bO, type SimpleThisExpression as bP, type SimpleThrowStatement as bQ, type SimpleTryStatement as bR, type SimpleUnaryExpression as bS, type SimpleUpdateExpression as bT, type SimpleVariableDeclaration as bU, type SimpleVariableDeclarator as bV, type SimpleWhileStatement as bW, type SourceLocation as bX, type Statement as bY, type TSLite as bZ, type TSLiteMarker as b_, type SimpleCatchClause as ba, type SimpleChainExpression as bb, type SimpleComment as bc, type SimpleConditionalExpression as bd, type SimpleContinueStatement as be, type SimpleDoWhileStatement as bf, type SimpleEmptyStatement as bg, type SimpleExpressionStatement as bh, type SimpleForInStatement as bi, type SimpleForOfStatement as bj, type SimpleForStatement as bk, type SimpleFunctionDeclaration as bl, type SimpleFunctionExpression as bm, type SimpleIdentifier as bn, type SimpleIfStatement as bo, type SimpleJsonExpression as bp, type SimpleLabeledStatement as bq, type SimpleLiteral as br, type SimpleLogicalExpression as bs, type SimpleMemberExpression as bt, type SimpleMethodDefinition as bu, type SimpleNewExpression as bv, type SimpleNode as bw, type SimpleObjectExpression as bx, type SimpleObjectPattern as by, type SimplePosition as bz, type AssignmentExpression as c, returnStatement as c$, type ThisExpression as c0, type UnaryOperator as c1, type UpdateOperator as c2, ast as c3, fromAstMarker as c4, json as c5, jsonExpression as c6, types as c7, arrayExpression as c8, arrayPattern as c9, importDeclaration as cA, importDefaultSpecifier as cB, importNamespaceSpecifier as cC, importSpecifier as cD, jsxAttribute as cE, jsxClosingElement as cF, jsxClosingFragment as cG, jsxElement as cH, jsxEmptyExpression as cI, jsxExpressionContainer as cJ, jsxFragment as cK, jsxIdentifier as cL, jsxMemberExpression as cM, jsxNamespacedName as cN, jsxOpeningElement as cO, jsxOpeningFragment as cP, jsxSpreadAttribute as cQ, jsxText as cR, literal as cS, logicalExpression as cT, memberExpression as cU, newExpression as cV, objectExpression as cW, objectPattern as cX, program as cY, property as cZ, restElement as c_, arrowFunctionExpression as ca, assignmentExpression as cb, assignmentPattern as cc, assignmentProperty as cd, awaitExpression as ce, binaryExpression as cf, blockStatement as cg, breakStatement as ch, callExpression as ci, catchClause as cj, chainExpression as ck, conditionalExpression as cl, continueStatement as cm, doWhileStatement as cn, emptyStatement as co, exportDefaultDeclaration as cp, exportNamedDeclaration as cq, exportSpecifier as cr, expressionStatement as cs, forInStatement as ct, forOfStatement as cu, forStatement as cv, functionDeclaration as cw, functionExpression as cx, identifier as cy, ifStatement as cz, type AssignmentProperty as d, spreadElement as d0, switchCase as d1, switchStatement as d2, templateElement as d3, templateLiteral as d4, throwStatement as d5, tryStatement as d6, unaryExpression as d7, updateExpression as d8, variableDeclaration as d9, variableDeclarator as da, whileStatement as db, type AwaitExpression as e, type BinaryExpression as f, type BlockStatement as g, type BreakStatement as h, type ChainExpression as i, type ConditionalExpression as j, type ContinueStatement as k, type ExpressionStatement as l, type ForOfStatement as m, type ForStatement as n, type FunctionDeclaration as o, type FunctionExpression as p, type IfStatement as q, type ImportDeclaration as r, type ImportDefaultSpecifier as s, type ImportNamespaceSpecifier as t, type ImportSpecifier as u, type LogicalExpression as v, type NewExpression as w, type ObjectPattern as x, type Property as y, type SwitchCase as z };
1058
+ export { type Directive as $, type ArrayExpression as A, type BaseNode as B, type CatchClause as C, type DoWhileStatement as D, type EmptyStatement as E, type ForInStatement as F, type SwitchStatement as G, type TemplateLiteral as H, type Identifier as I, type JsonExpression as J, type ThrowStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type TryStatement as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type UpdateExpression as V, type VariableDeclaration as W, type VariableDeclarator as X, type WhileStatement as Y, type SpreadElement as Z, type RestElement as _, type ArrayPattern as a, type SimpleBaseExpression as a$, type ModuleDeclaration as a0, type JSXElement as a1, type JSXFragment as a2, type CallExpression as a3, type AssignmentOperator as a4, type AssignmentPattern as a5, type BaseCallExpression as a6, type BaseDeclaration as a7, type BaseExpression as a8, type BaseForXStatement as a9, type JSXNamespacedName as aA, type JSXOpeningElement as aB, type JSXOpeningFragment as aC, type JSXSpreadAttribute as aD, type JSXTagName as aE, type JSXText as aF, type LabeledStatement as aG, type LogicalOperator as aH, type MaybeNamedFunctionDeclaration as aI, type MetaProperty as aJ, type MethodDefinition as aK, type ModuleSpecifier as aL, type NodeMap as aM, type Pattern as aN, type Position as aO, type PropertyDefinition as aP, type RegExpLiteral as aQ, type SequenceExpression as aR, type SimpleArrayExpression as aS, type SimpleArrayPattern as aT, type SimpleArrowFunctionExpression as aU, type SimpleAssignmentExpression as aV, type SimpleAssignmentPattern as aW, type SimpleAssignmentProperty as aX, type SimpleAwaitExpression as aY, type SimpleBaseCallExpression as aZ, type SimpleBaseDeclaration as a_, type BaseFunction as aa, type BaseModuleDeclaration as ab, type BaseModuleSpecifier as ac, type BaseNodeWithoutComments as ad, type BasePattern as ae, type BaseStatement as af, type BigIntLiteral as ag, type BinaryOperator as ah, type ChainElement as ai, type Comment as aj, type DebuggerStatement as ak, type Declaration as al, type ExportDefaultDeclaration as am, type ExportNamedDeclaration as an, type ExportSpecifier as ao, type Expression as ap, type Function as aq, type ImportExpression as ar, type JSXAttribute as as, type JSXChild as at, type JSXClosingElement as au, type JSXClosingFragment as av, type JSXEmptyExpression as aw, type JSXExpressionContainer as ax, type JSXIdentifier as ay, type JSXMemberExpression as az, type ArrowFunctionExpression as b, type TSConditionalType as b$, type SimpleBaseForXStatement as b0, type SimpleBaseFunction as b1, type SimpleBaseNode as b2, type SimpleBaseNodeWithoutComments as b3, type SimpleBasePattern as b4, type SimpleBaseStatement as b5, type SimpleBigIntLiteral as b6, type SimpleBinaryExpression as b7, type SimpleBlockStatement as b8, type SimpleBreakStatement as b9, type SimpleProgram as bA, type SimpleProperty as bB, type SimplePropertyDefinition as bC, type SimpleRegExpLiteral as bD, type SimpleRestElement as bE, type SimpleReturnStatement as bF, type SimpleSequenceExpression as bG, type SimpleSimpleCallExpression as bH, type SimpleSimpleLiteral as bI, type SimpleSourceLocation as bJ, type SimpleSpreadElement as bK, type SimpleSwitchCase as bL, type SimpleSwitchStatement as bM, type SimpleTemplateElement as bN, type SimpleTemplateLiteral as bO, type SimpleThisExpression as bP, type SimpleThrowStatement as bQ, type SimpleTryStatement as bR, type SimpleUnaryExpression as bS, type SimpleUpdateExpression as bT, type SimpleVariableDeclaration as bU, type SimpleVariableDeclarator as bV, type SimpleWhileStatement as bW, type SourceLocation as bX, type Statement as bY, type TSArrayType as bZ, type TSCallSignatureDeclaration as b_, type SimpleCatchClause as ba, type SimpleChainExpression as bb, type SimpleComment as bc, type SimpleConditionalExpression as bd, type SimpleContinueStatement as be, type SimpleDoWhileStatement as bf, type SimpleEmptyStatement as bg, type SimpleExpressionStatement as bh, type SimpleForInStatement as bi, type SimpleForOfStatement as bj, type SimpleForStatement as bk, type SimpleFunctionDeclaration as bl, type SimpleFunctionExpression as bm, type SimpleIdentifier as bn, type SimpleIfStatement as bo, type SimpleJsonExpression as bp, type SimpleLabeledStatement as bq, type SimpleLiteral as br, type SimpleLogicalExpression as bs, type SimpleMemberExpression as bt, type SimpleMethodDefinition as bu, type SimpleNewExpression as bv, type SimpleNode as bw, type SimpleObjectExpression as bx, type SimpleObjectPattern as by, type SimplePosition as bz, type AssignmentExpression as c, jsxClosingFragment as c$, type TSFunctionType as c0, type TSIndexSignature as c1, type TSIndexedAccessType as c2, type TSInferType as c3, type TSIntersectionType as c4, type TSKeywordType as c5, type TSLite as c6, type TSLiteMarker as c7, type TSLiteralType as c8, type TSMappedType as c9, binaryExpression as cA, blockStatement as cB, breakStatement as cC, callExpression as cD, catchClause as cE, chainExpression as cF, conditionalExpression as cG, continueStatement as cH, doWhileStatement as cI, emptyStatement as cJ, exportDefaultDeclaration as cK, exportNamedDeclaration as cL, exportSpecifier as cM, expressionStatement as cN, forInStatement as cO, forOfStatement as cP, forStatement as cQ, functionDeclaration as cR, functionExpression as cS, identifier as cT, ifStatement as cU, importDeclaration as cV, importDefaultSpecifier as cW, importNamespaceSpecifier as cX, importSpecifier as cY, jsxAttribute as cZ, jsxClosingElement as c_, type TSPropertySignature as ca, type TSTupleType as cb, type TSType as cc, type TSTypeLiteral as cd, type TSTypeMember as ce, type TSTypeOperator as cf, type TSTypeParameter as cg, type TSTypeQuery as ch, type TSTypeReference as ci, type TSUnionType as cj, type TaggedTemplateExpression as ck, type ThisExpression as cl, type UnaryOperator as cm, type UpdateOperator as cn, expr as co, fromExprMarker as cp, json as cq, jsonExpression as cr, types as cs, arrayExpression as ct, arrayPattern as cu, arrowFunctionExpression as cv, assignmentExpression as cw, assignmentPattern as cx, assignmentProperty as cy, awaitExpression as cz, type AssignmentProperty as d, jsxElement as d0, jsxEmptyExpression as d1, jsxExpressionContainer as d2, jsxFragment as d3, jsxIdentifier as d4, jsxMemberExpression as d5, jsxNamespacedName as d6, jsxOpeningElement as d7, jsxOpeningFragment as d8, jsxSpreadAttribute as d9, jsxText as da, literal as db, logicalExpression as dc, memberExpression as dd, newExpression as de, objectExpression as df, objectPattern as dg, program as dh, property as di, restElement as dj, returnStatement as dk, spreadElement as dl, switchCase as dm, switchStatement as dn, templateElement as dp, templateLiteral as dq, throwStatement as dr, tryStatement as ds, unaryExpression as dt, updateExpression as du, variableDeclaration as dv, variableDeclarator as dw, whileStatement as dx, type AwaitExpression as e, type BinaryExpression as f, type BlockStatement as g, type BreakStatement as h, type ChainExpression as i, type ConditionalExpression as j, type ContinueStatement as k, type ExpressionStatement as l, type ForOfStatement as m, type ForStatement as n, type FunctionDeclaration as o, type FunctionExpression as p, type IfStatement as q, type ImportDeclaration as r, type ImportDefaultSpecifier as s, type ImportNamespaceSpecifier as t, type ImportSpecifier as u, type LogicalExpression as v, type NewExpression as w, type ObjectPattern as x, type Property as y, type SwitchCase as z };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var G=Object.defineProperty;var O=(e,r)=>{for(var n in r)G(e,n,{get:r[n],enumerable:true});};var y=class extends Error{constructor(r,n,i){super(n),this.name="TSLiteError",this.code=r,this.details=i;}};var u="#ast",Q=/^[a-zA-Z_][a-zA-Z_0-9]*$/,f=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","FunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","NewExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","TaggedTemplateExpression","SequenceExpression","ChainExpression","JSXElement","JSXFragment","Program"];function h(e){return f.includes(e)}function N(e){return new y("invalid-ast-entry",`Invalid #ast entry type: "${e}". The #ast marker is used to embed executable logic inside JSON. Only expression types that can be used as VALUES are allowed: ${f.join(", ")}. "${e}" is not a valid entry point because it cannot be used as a value in JSON.`,{type:e,validTypes:f})}var w={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JsonExpression:[],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],JSXElement:["openingElement","children","closingElement"],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningElement:["name","attributes"],JSXClosingElement:["name"],JSXOpeningFragment:[],JSXClosingFragment:[],JSXAttribute:["name","value"],JSXSpreadAttribute:["argument"],JSXExpressionContainer:["expression"],JSXEmptyExpression:[],JSXText:[],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"]},l={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,Coalesce:3,LogicalOR:4,LogicalAND:5,BitwiseOR:6,BitwiseXOR:7,BitwiseAND:8,Equality:9,Relational:10,BitwiseSHIFT:11,Additive:12,Multiplicative:13,Exponentiation:14,Await:15,Unary:15,Postfix:16,OptionalChaining:17,Call:18,New:19,TaggedTemplate:20,Member:21,Primary:22},ee={"??":l.Coalesce,"||":l.LogicalOR,"&&":l.LogicalAND,"|":l.BitwiseOR,"^":l.BitwiseXOR,"&":l.BitwiseAND,"==":l.Equality,"!=":l.Equality,"===":l.Equality,"!==":l.Equality,is:l.Equality,isnt:l.Equality,"<":l.Relational,">":l.Relational,"<=":l.Relational,">=":l.Relational,in:l.Relational,instanceof:l.Relational,"<<":l.BitwiseSHIFT,">>":l.BitwiseSHIFT,">>>":l.BitwiseSHIFT,"+":l.Additive,"-":l.Additive,"*":l.Multiplicative,"%":l.Multiplicative,"/":l.Multiplicative,"**":l.Exponentiation};var b={};O(b,{arrayExpression:()=>te,arrayPattern:()=>Le,arrowFunctionExpression:()=>xe,assignmentExpression:()=>pe,assignmentPattern:()=>Re,assignmentProperty:()=>je,ast:()=>k,awaitExpression:()=>ce,binaryExpression:()=>se,blockStatement:()=>ue,breakStatement:()=>we,callExpression:()=>D,catchClause:()=>Ne,chainExpression:()=>ne,conditionalExpression:()=>le,continueStatement:()=>Ce,doWhileStatement:()=>Fe,emptyStatement:()=>Je,exportDefaultDeclaration:()=>$e,exportNamedDeclaration:()=>qe,exportSpecifier:()=>Ke,expressionStatement:()=>de,forInStatement:()=>Ie,forOfStatement:()=>Pe,forStatement:()=>De,fromAstMarker:()=>B,functionDeclaration:()=>Se,functionExpression:()=>Ee,identifier:()=>E,ifStatement:()=>ge,importDeclaration:()=>Me,importDefaultSpecifier:()=>Ue,importNamespaceSpecifier:()=>We,importSpecifier:()=>ve,json:()=>_,jsonExpression:()=>P,jsxAttribute:()=>et,jsxClosingElement:()=>rt,jsxClosingFragment:()=>j,jsxElement:()=>st,jsxEmptyExpression:()=>Ze,jsxExpressionContainer:()=>Ge,jsxFragment:()=>ot,jsxIdentifier:()=>Ye,jsxMemberExpression:()=>ze,jsxNamespacedName:()=>He,jsxOpeningElement:()=>tt,jsxOpeningFragment:()=>L,jsxSpreadAttribute:()=>Qe,jsxText:()=>nt,literal:()=>x,logicalExpression:()=>oe,memberExpression:()=>I,newExpression:()=>re,objectExpression:()=>g,objectPattern:()=>Be,program:()=>Ve,property:()=>C,restElement:()=>_e,returnStatement:()=>fe,spreadElement:()=>J,switchCase:()=>Ae,switchStatement:()=>be,templateElement:()=>me,templateLiteral:()=>ye,throwStatement:()=>Te,tryStatement:()=>he,unaryExpression:()=>ie,updateExpression:()=>ae,variableDeclaration:()=>Oe,variableDeclarator:()=>ke,whileStatement:()=>Xe});var k=e=>{let{type:r,...n}=e;if(!r||typeof r!="string")throw new y("missing-node-type","ast() requires a node with a valid type property");if(!h(r))throw N(r);return {[u]:r,...n}},B=e=>{if(!e||typeof e!="object"||!(u in e))return e;let{[u]:r,...n}=e;return {type:r,...n}},E=e=>({type:"Identifier",name:e}),x=e=>e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:{type:"Literal",value:e},te=e=>({type:"ArrayExpression",elements:e}),g=e=>({type:"ObjectExpression",properties:e}),C=(e,r,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:r,kind:"init"}),J=e=>({type:"SpreadElement",argument:e}),D=(e,r,n=false)=>({type:"CallExpression",callee:e,arguments:r,optional:n}),re=(e,r)=>({type:"NewExpression",callee:e,arguments:r}),I=(e,r,n=false,i=false)=>({type:"MemberExpression",object:e,property:r,computed:n,optional:i}),ne=e=>({type:"ChainExpression",expression:e}),se=(e,r,n)=>({type:"BinaryExpression",left:r,right:n,operator:e}),oe=(e,r,n)=>({type:"LogicalExpression",operator:e,left:r,right:n}),ie=(e,r)=>({type:"UnaryExpression",operator:e,argument:r,prefix:true}),ae=(e,r,n=false)=>({type:"UpdateExpression",operator:e,argument:r,prefix:n}),pe=(e,r,n)=>({type:"AssignmentExpression",operator:e,left:r,right:n}),le=(e,r,n)=>({type:"ConditionalExpression",test:e,consequent:r,alternate:n}),ce=e=>({type:"AwaitExpression",argument:e}),me=(e,r=false)=>({type:"TemplateElement",value:e,tail:r}),ye=(e,r)=>({type:"TemplateLiteral",quasis:e,expressions:r}),xe=(e,r,n=false,i=false)=>({type:"ArrowFunctionExpression",expression:r.type!="BlockStatement",generator:i,async:n,params:e,body:r}),Ee=(e=null,r,n,i=false,p=false)=>({type:"FunctionExpression",id:e,params:r,body:n,async:i,generator:p}),Se=(e,r,n,i=false,p=false)=>({type:"FunctionDeclaration",id:e,params:r,body:n,generator:i,async:p}),ue=e=>({type:"BlockStatement",body:e}),de=e=>({type:"ExpressionStatement",expression:e}),fe=e=>({type:"ReturnStatement",argument:e}),ge=(e,r,n=null)=>({type:"IfStatement",test:e,consequent:r,alternate:n}),be=(e,r)=>({type:"SwitchStatement",cases:r,discriminant:e}),Ae=(e,r)=>({type:"SwitchCase",consequent:r,test:e}),Te=e=>({type:"ThrowStatement",argument:e}),he=(e,r,n=null)=>({type:"TryStatement",block:e,handler:r,finalizer:n}),Ne=(e,r)=>({type:"CatchClause",param:e,body:r}),we=(e=null)=>({type:"BreakStatement",label:e}),Ce=(e=null)=>({type:"ContinueStatement",label:e}),Je=()=>({type:"EmptyStatement"}),De=(e,r,n,i)=>({type:"ForStatement",init:e,test:r,update:n,body:i}),Ie=(e,r,n)=>({type:"ForInStatement",body:n,left:e,right:r}),Pe=(e,r,n,i=false)=>({type:"ForOfStatement",body:n,left:e,right:r,await:i}),Xe=(e,r)=>({type:"WhileStatement",test:e,body:r}),Fe=(e,r)=>({type:"DoWhileStatement",body:e,test:r}),Oe=(e,r)=>({type:"VariableDeclaration",declarations:r,kind:e}),ke=(e,r=null)=>({type:"VariableDeclarator",id:e,init:r}),Be=e=>({type:"ObjectPattern",properties:e}),Le=e=>({type:"ArrayPattern",elements:e}),je=(e,r=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:r,shorthand:n,computed:i,method:false}),_e=e=>({type:"RestElement",argument:e}),Re=(e,r)=>({type:"AssignmentPattern",left:e,right:r}),Ve=(e,r="script")=>({type:"Program",body:e,sourceType:r}),P=e=>({type:"JsonExpression",body:e}),Me=(e,r)=>({type:"ImportDeclaration",specifiers:e,source:r}),ve=(e,r)=>({type:"ImportSpecifier",imported:e,local:r}),Ue=e=>({type:"ImportDefaultSpecifier",local:e}),We=e=>({type:"ImportNamespaceSpecifier",local:e}),qe=(e=null,r=[],n=null)=>({type:"ExportNamedDeclaration",declaration:e,specifiers:r,source:n}),$e=e=>({type:"ExportDefaultDeclaration",declaration:e}),Ke=(e,r=e)=>({type:"ExportSpecifier",local:e,exported:r}),Ye=e=>({type:"JSXIdentifier",name:e}),ze=(e,r)=>({type:"JSXMemberExpression",object:e,property:r}),He=(e,r)=>({type:"JSXNamespacedName",namespace:e,name:r}),Ze=()=>({type:"JSXEmptyExpression"}),Ge=e=>({type:"JSXExpressionContainer",expression:e}),Qe=e=>({type:"JSXSpreadAttribute",argument:e}),et=(e,r=null)=>({type:"JSXAttribute",name:e,value:r}),tt=(e,r=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:r,selfClosing:n}),rt=e=>({type:"JSXClosingElement",name:e}),L=()=>({type:"JSXOpeningFragment"}),j=()=>({type:"JSXClosingFragment"}),nt=(e,r=e)=>({type:"JSXText",value:e,raw:r}),st=(e,r=[],n=null)=>({type:"JSXElement",openingElement:e,children:r,closingElement:n}),ot=(e=[],r=L(),n=j())=>({type:"JSXFragment",openingFragment:r,children:e,closingFragment:n}),_=P;var it=(e="b")=>{class r{constructor(o){this.text=o;}}let n=(t,o)=>{if(typeof t!="object")return typeof t=="string"?`"${t}"`:typeof t=="bigint"?`${t}n`:String(t);if(!t)return "null";if(t instanceof RegExp)return t;if(Array.isArray(t))return `[${t.map(S=>n(S,o)).join(", ")}]`;if(!t.type)return t instanceof r?t.text:`${e}.jsonExpression(${JSON.stringify(t)})`;if(t.type in m)return m[t.type](t,o);throw new y("unknown-node-type","Unknown type: "+t.type,{type:t.type})},i=t=>`(${e}) => ${n(t)}`,p=t=>new Function("b",`return ${t}`)(b),s=(t,o,...S)=>{let T=[],X=false;return S.reverse().forEach(F=>{F===void 0?X&&T.push("false"):(T.push(n(F,t)),X=true);}),`${e}.${o}(${T.reverse().join(", ")})`},m={ArrayExpression:(t,o)=>s(t,"arrayExpression",t.elements),ArrayPattern:(t,o)=>s(t,"arrayPattern",t.elements),ArrowFunctionExpression:(t,o)=>s(t,"arrowFunctionExpression",t.params,t.body,t.async||void 0),AssignmentExpression:(t,o)=>s(t,"assignmentExpression",t.operator,t.left,t.right),AssignmentProperty:(t,o)=>s(t,"assignmentProperty",t.key,t.value||void 0,t.shorthand||void 0),AwaitExpression:(t,o)=>s(t,"awaitExpression",t.argument),BinaryExpression:(t,o)=>s(t,"binaryExpression",t.operator,t.left,t.right),BlockStatement:(t,o)=>s(t,"blockStatement",t.body),BreakStatement:(t,o)=>t.label?s(t,"breakStatement",t.label):s(t,"breakStatement"),CallExpression:(t,o)=>s(t,"callExpression",t.callee,t.arguments,t.optional||void 0),CatchClause:(t,o)=>s(t,"catchClause",t.param,t.body),ChainExpression:(t,o)=>s(t,"chainExpression",t.expression),ConditionalExpression:(t,o)=>s(t,"conditionalExpression",t.test,t.consequent,t.alternate),ContinueStatement:(t,o)=>s(t,"continueStatement",t.label),DoWhileStatement:(t,o)=>s(t,"doWhileStatement",t.body,t.test),EmptyStatement:(t,o)=>s(t,"emptyStatement"),ExpressionStatement:(t,o)=>s(t,"expressionStatement",t.expression),ForInStatement:(t,o)=>s(t,"forInStatement",t.left,t.right,t.body),ForOfStatement:(t,o)=>s(t,"forOfStatement",t.left,t.right,t.body),ForStatement:(t,o)=>s(t,"forStatement",t.init,t.test,t.update,t.body),FunctionDeclaration:(t,o)=>s(t,"functionDeclaration",t.id,t.params,t.body,t.generator||void 0,t.async||void 0),FunctionExpression:(t,o)=>s(t,"functionExpression",t.id||null,t.params,t.body,t.generator||void 0,t.async||void 0),Identifier:(t,o)=>s(t,"identifier",t.name),IfStatement:(t,o)=>s(t,"ifStatement",t.test,t.consequent,t.alternate),ImportDeclaration:(t,o)=>s(t,"importDeclaration",t.specifiers,t.source),ImportDefaultSpecifier:(t,o)=>s(t,"importDefaultSpecifier",t.local),ImportNamespaceSpecifier:(t,o)=>s(t,"importNamespaceSpecifier",t.local),ImportSpecifier:(t,o)=>s(t,"importSpecifier",t.imported,t.local),JsonExpression:(t,o)=>s(t,"jsonExpression",JSON.stringify(t.body)),Literal:(t,o)=>s(t,"literal",t.value),LogicalExpression:(t,o)=>s(t,"logicalExpression",t.operator,t.left,t.right),MemberExpression:(t,o)=>s(t,"memberExpression",t.object,t.property,t.computed||void 0,t.optional||void 0),NewExpression:(t,o)=>s(t,"newExpression",t.callee,t.arguments),ObjectExpression:(t,o)=>s(t,"objectExpression",t.properties),ObjectPattern:(t,o)=>s(t,"objectPattern",t.properties),Program:(t,o)=>s(t,"program",t.body),Property:(t,o)=>{if(o.type==="ObjectPattern")return s(t,"assignmentProperty",t.key,t.value,t.shorthand||void 0);if(o.type==="ObjectExpression")return s(t,"property",t.key,t.value,t.shorthand||void 0,t.computed||void 0)},ReturnStatement:(t,o)=>s(t,"returnStatement",t.argument),SwitchCase:(t,o)=>s(t,"switchCase",t.test,t.consequent),SwitchStatement:(t,o)=>s(t,"switchStatement",t.discriminant,t.cases),TemplateElement:(t,o)=>t.tail?s(t,"templateElement",new r(JSON.stringify(t.value)),true):s(t,"templateElement",new r(JSON.stringify(t.value))),TemplateLiteral:(t,o)=>s(t,"templateLiteral",t.quasis,t.expressions),ThrowStatement:(t,o)=>s(t,"throwStatement",t.argument),TryStatement:(t,o)=>s(t,"tryStatement",t.block,t.handler,t.finalizer),UnaryExpression:(t,o)=>s(t,"unaryExpression",t.operator,t.argument),UpdateExpression:(t,o)=>t.prefix==true?s(t,"updateExpression",t.operator,t.argument,true):s(t,"updateExpression",t.operator,t.argument),VariableDeclaration:(t,o)=>s(t,"variableDeclaration",t.kind,t.declarations),VariableDeclarator:(t,o)=>s(t,"variableDeclarator",t.id,t.init||void 0),WhileStatement:(t,o)=>s(t,"whileStatement",t.test,t.body),SpreadElement:(t,o)=>s(t,"spreadElement",t.argument),RestElement:(t,o)=>s(t,"restElement",t.argument)};return {build:n,buildFunction:i,safeEval:p,builders:m}};var W={};O(W,{isArrayExpression:()=>dt,isArrayPattern:()=>jt,isArrowFunctionExpression:()=>xt,isAssignmentExpression:()=>ht,isAssignmentProperty:()=>sr,isAwaitExpression:()=>Nt,isBinaryExpression:()=>yt,isBlockStatement:()=>Dt,isBreakStatement:()=>Xt,isCallExpression:()=>St,isCatchClause:()=>Yt,isConditionalExpression:()=>ft,isContinueStatement:()=>Ft,isDirective:()=>nr,isDoWhileStatement:()=>$t,isEmptyStatement:()=>Ot,isExpressionStatement:()=>Jt,isForInStatement:()=>Wt,isForOfStatement:()=>qt,isForStatement:()=>Ut,isFunctionDeclaration:()=>_t,isFunctionExpression:()=>Et,isIdentifier:()=>mt,isIfStatement:()=>Pt,isImportDeclaration:()=>Gt,isImportDefaultSpecifier:()=>er,isImportNamespaceSpecifier:()=>tr,isImportSpecifier:()=>Qt,isJsonExpression:()=>Ct,isLiteral:()=>ct,isLogicalExpression:()=>gt,isMemberExpression:()=>Tt,isModuleDeclaration:()=>rr,isNewExpression:()=>wt,isNode:()=>or,isObjectExpression:()=>ut,isObjectPattern:()=>Lt,isProgram:()=>Rt,isProperty:()=>U,isReturnStatement:()=>It,isSwitchCase:()=>Mt,isSwitchStatement:()=>Vt,isTemplateElement:()=>Ht,isTemplateLiteral:()=>Zt,isThrowStatement:()=>zt,isTryStatement:()=>Kt,isUnaryExpression:()=>bt,isUpdateExpression:()=>At,isVariableDeclaration:()=>Bt,isVariableDeclarator:()=>kt,isWhileStatement:()=>vt});var R=e=>typeof e=="object"&&e!==null&&typeof e.type=="string",at=w;function d(e,r){let n=at[e.type],i=e,p=(s,m)=>{if(s!=null)if(Array.isArray(s))for(let t=0;t<s.length;t++)R(s[t])&&r(s[t],m,t);else R(s)&&r(s,m,null);};if(n){for(let s of n)p(i[s],s);return}for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&p(i[s],s);}function V(e){let r=[];return d(e,n=>r.push(n)),r}function A(e,r){let n=false;function i(p,s){if(!p||n)return;let m=r[p.type]??r["*"],t=false;if(m){let o=m(p,s);if(o===false&&(t=true),o==="break"){n=true;return}}t||d(p,o=>{n||i(o,p);});}i(e,null);}var pt=new Proxy({fn:{}},{get(e,r){return {type:"Identifier",name:r}}}),a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function M(e,r){let n;return A(e,{"*":i=>{if(r(i))return n=i,"break"}}),n}function v(e,r,n){let i=p=>{if(r(p))return n(p);if(Array.isArray(p)){let s=false,m=p.map(t=>{let o=i(t);return o!==t&&(s=true),o});return s?m:p}if(a(p)){let s=false,m={};for(let t in p){let o=p[t],S=i(o);m[t]=S,S!==o&&(s=true);}return s?m:p}return p};return i(e)}function lt(e,r){let n={};return r.forEach(i=>{i in e&&(n[i]=e[i]);}),n}var ct=e=>e?.type==="Literal"&&"value"in e,mt=e=>e?.type==="Identifier"&&typeof e.name=="string",yt=e=>e?.type==="BinaryExpression"&&a(e.left)&&a(e.right)&&typeof e.operator=="string",xt=e=>e?.type==="ArrowFunctionExpression"&&a(e.body),Et=e=>e?.type==="FunctionExpression"&&a(e.body),St=e=>e?.type==="CallExpression"&&a(e.callee)&&Array.isArray(e.arguments),ut=e=>e?.type==="ObjectExpression"&&Array.isArray(e.properties),dt=e=>e?.type==="ArrayExpression"&&Array.isArray(e.elements),ft=e=>e?.type==="ConditionalExpression"&&a(e.test)&&a(e.consequent)&&a(e.alternate),gt=e=>e?.type==="LogicalExpression"&&a(e.left)&&a(e.right)&&typeof e.operator=="string",bt=e=>e?.type==="UnaryExpression"&&typeof e.operator=="string"&&a(e.argument),At=e=>e?.type==="UpdateExpression"&&typeof e.operator=="string"&&a(e.argument),Tt=e=>e?.type==="MemberExpression"&&a(e.object)&&a(e.property),ht=e=>e?.type==="AssignmentExpression"&&a(e.left)&&a(e.right)&&typeof e.operator=="string",Nt=e=>e?.type==="AwaitExpression"&&"argument"in e,wt=e=>e?.type==="NewExpression"&&a(e.callee)&&Array.isArray(e.arguments),Ct=e=>e?.type==="JsonExpression"&&a(e.body),Jt=e=>e?.type==="ExpressionStatement"&&a(e.expression),Dt=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),It=e=>e?.type==="ReturnStatement",Pt=e=>e?.type==="IfStatement"&&a(e.test)&&a(e.consequent),Xt=e=>e?.type==="BreakStatement",Ft=e=>e?.type==="ContinueStatement",Ot=e=>e?.type==="EmptyStatement",kt=e=>e?.type==="VariableDeclarator"&&a(e.id),Bt=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),Lt=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),jt=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),_t=e=>e?.type==="FunctionDeclaration"&&a(e.id)&&a(e.body),Rt=e=>e?.type==="Program"&&Array.isArray(e.body),Vt=e=>e?.type==="SwitchStatement"&&a(e.discriminant)&&Array.isArray(e.cases),Mt=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),vt=e=>e?.type==="WhileStatement"&&a(e.test)&&a(e.body),Ut=e=>e?.type==="ForStatement"&&"body"in e,Wt=e=>e?.type==="ForInStatement"&&a(e.left)&&a(e.right)&&a(e.body),qt=e=>e?.type==="ForOfStatement"&&a(e.left)&&a(e.right)&&a(e.body),$t=e=>e?.type==="DoWhileStatement"&&a(e.body)&&a(e.test),Kt=e=>e?.type==="TryStatement"&&a(e.block),Yt=e=>e?.type==="CatchClause"&&a(e.body),zt=e=>e?.type==="ThrowStatement"&&a(e.argument),Ht=e=>e?.type==="TemplateElement"&&a(e.value),Zt=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),Gt=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&a(e.source),Qt=e=>e?.type==="ImportSpecifier"&&a(e.imported)&&a(e.local),er=e=>e?.type==="ImportDefaultSpecifier"&&a(e.local),tr=e=>e?.type==="ImportNamespaceSpecifier"&&a(e.local),rr=e=>e?.type==="ModuleDeclaration",nr=e=>e?.type==="Directive",U=e=>e?.type==="Property"&&a(e.key)&&a(e.value),sr=e=>U(e),or=e=>typeof e?.type=="string";var ir="createElement",ar="Fragment";function c(e,r){return r.start!==void 0&&(e.start=r.start),r.end!==void 0&&(e.end=r.end),r.loc!==void 0&&(e.loc=r.loc),r.range!==void 0&&(e.range=r.range),e}var pr=e=>/^[a-zA-Z_$][\w$]*$/.test(e);function q(e){return e.type==="JSXIdentifier"?c(/^[a-z]/.test(e.name)||e.name.includes("-")?x(e.name):E(e.name),e):e.type==="JSXNamespacedName"?c(x(`${e.namespace.name}:${e.name.name}`),e):c(I(q(e.object),c(E(e.property.name),e.property)),e)}function lr(e){return e.type==="JSXNamespacedName"?c(x(`${e.namespace.name}:${e.name.name}`),e):c(pr(e.name)?E(e.name):x(e.name),e)}function cr(e,r){return e===null?c(x(true),r):e.type==="JSXExpressionContainer"?e.expression:e}var $=(e,r)=>c(r.emptyPropsAsObject?g([]):x(null),e);function mr(e,r,n){if(e.length===0)return $(r,n);let i=e.map(p=>p.type==="JSXSpreadAttribute"?c(J(p.argument),p):c(C(lr(p.name),cr(p.value,p)),p));return c(g(i),r)}function yr(e){let r=e.split(/\r\n|\n|\r/),n=-1;for(let p=0;p<r.length;p++)/[^ \t]/.test(r[p])&&(n=p);let i="";for(let p=0;p<r.length;p++){let s=r[p].replace(/\t/g," ");p!==0&&(s=s.replace(/^ +/,"")),p!==r.length-1&&(s=s.replace(/ +$/,"")),s&&(p!==n&&(s+=" "),i+=s);}return i===""?null:i}function xr(e){if(e.type==="JSXText"){let r=yr(e.value);return r===null?null:c(x(r),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e}function K(e,r={}){let n=e.type==="JSXFragment"?c(E(ar),e.openingFragment):q(e.openingElement.name),i=e.type==="JSXFragment"?$(e.openingFragment,r):mr(e.openingElement.attributes,e.openingElement,r),p=e.children.map(xr).filter(s=>s!==null);return c(D(c(E(ir),e),[n,i,...p]),e)}var Y=(e={})=>({vars:e,parent:null}),z=(e,r)=>({vars:r,parent:e});function H(e,r){for(let n=e;n;n=n.parent)if(Object.prototype.hasOwnProperty.call(n.vars,r))return n.vars[r]}function Z(e){let r=new Map;for(let n=e;n;n=n.parent)for(let i of Object.keys(n.vars))r.has(i)||r.set(i,n.vars[i]);return r}exports.AST_MARKER=u;exports.BinaryPrecedence=ee;exports.Mock=pt;exports.Precedence=l;exports.TSLiteError=y;exports.VALID_AST_ENTRY_TYPES=f;exports.VALID_OBJECT_KEY=Q;exports.VisitorKeys=w;exports.ast=k;exports.childScope=z;exports.childrenOf=V;exports.desugarJSX=K;exports.find=M;exports.forEachChild=d;exports.fromAstMarker=B;exports.generateBuilders=it;exports.guards=W;exports.invalidAstEntryError=N;exports.isObject=a;exports.isValidAstEntryType=h;exports.json=_;exports.jsonExpression=P;exports.lookup=H;exports.mutate=v;exports.pick=lt;exports.rootScope=Y;exports.visibleNames=Z;exports.walk=A;
1
+ 'use strict';var Z=Object.defineProperty;var F=(e,r)=>{for(var n in r)Z(e,n,{get:r[n],enumerable:true});};var y=class extends Error{constructor(r,n,i){super(n),this.name="TSLiteError",this.code=r,this.details=i;}};var G=/^[a-zA-Z_][a-zA-Z_0-9]*$/,d=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","FunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","NewExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","TaggedTemplateExpression","SequenceExpression","ChainExpression","JSXElement","JSXFragment","Program"];function T(e){return d.includes(e)}function h(e){return new y("invalid-expression-entry",`Invalid #expr entry type: "${e}". The #expr marker is used to embed executable logic inside JSON. Only expression types that can be used as VALUES are allowed: ${d.join(", ")}. "${e}" is not a valid entry point because it cannot be used as a value in JSON.`,{type:e,validTypes:d})}var N={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JsonExpression:[],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],JSXElement:["openingElement","children","closingElement"],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningElement:["name","attributes"],JSXClosingElement:["name"],JSXOpeningFragment:[],JSXClosingFragment:[],JSXAttribute:["name","value"],JSXSpreadAttribute:["argument"],JSXExpressionContainer:["expression"],JSXEmptyExpression:[],JSXText:[],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],TSAsExpression:["expression"],TSTypeAliasDeclaration:["id"]},l={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,Coalesce:3,LogicalOR:4,LogicalAND:5,BitwiseOR:6,BitwiseXOR:7,BitwiseAND:8,Equality:9,Relational:10,BitwiseSHIFT:11,Additive:12,Multiplicative:13,Exponentiation:14,Await:15,Unary:15,Postfix:16,OptionalChaining:17,Call:18,New:19,TaggedTemplate:20,Member:21,Primary:22},Q={"??":l.Coalesce,"||":l.LogicalOR,"&&":l.LogicalAND,"|":l.BitwiseOR,"^":l.BitwiseXOR,"&":l.BitwiseAND,"==":l.Equality,"!=":l.Equality,"===":l.Equality,"!==":l.Equality,is:l.Equality,isnt:l.Equality,"<":l.Relational,">":l.Relational,"<=":l.Relational,">=":l.Relational,in:l.Relational,instanceof:l.Relational,"<<":l.BitwiseSHIFT,">>":l.BitwiseSHIFT,">>>":l.BitwiseSHIFT,"+":l.Additive,"-":l.Additive,"*":l.Multiplicative,"%":l.Multiplicative,"/":l.Multiplicative,"**":l.Exponentiation};var g={};F(g,{arrayExpression:()=>ee,arrayPattern:()=>Be,arrowFunctionExpression:()=>ye,assignmentExpression:()=>ae,assignmentPattern:()=>_e,assignmentProperty:()=>Le,awaitExpression:()=>le,binaryExpression:()=>ne,blockStatement:()=>Se,breakStatement:()=>Ne,callExpression:()=>J,catchClause:()=>he,chainExpression:()=>re,conditionalExpression:()=>pe,continueStatement:()=>we,doWhileStatement:()=>Xe,emptyStatement:()=>Ce,exportDefaultDeclaration:()=>qe,exportNamedDeclaration:()=>We,exportSpecifier:()=>$e,expr:()=>O,expressionStatement:()=>ue,forInStatement:()=>De,forOfStatement:()=>Ie,forStatement:()=>Je,fromExprMarker:()=>k,functionDeclaration:()=>Ee,functionExpression:()=>xe,identifier:()=>E,ifStatement:()=>fe,importDeclaration:()=>Ve,importDefaultSpecifier:()=>ve,importNamespaceSpecifier:()=>Ue,importSpecifier:()=>Me,json:()=>j,jsonExpression:()=>I,jsxAttribute:()=>Qe,jsxClosingElement:()=>tt,jsxClosingFragment:()=>L,jsxElement:()=>nt,jsxEmptyExpression:()=>He,jsxExpressionContainer:()=>Ze,jsxFragment:()=>st,jsxIdentifier:()=>Ke,jsxMemberExpression:()=>Ye,jsxNamespacedName:()=>ze,jsxOpeningElement:()=>et,jsxOpeningFragment:()=>B,jsxSpreadAttribute:()=>Ge,jsxText:()=>rt,literal:()=>x,logicalExpression:()=>se,memberExpression:()=>D,newExpression:()=>te,objectExpression:()=>f,objectPattern:()=>ke,program:()=>Re,property:()=>w,restElement:()=>je,returnStatement:()=>de,spreadElement:()=>C,switchCase:()=>be,switchStatement:()=>ge,templateElement:()=>ce,templateLiteral:()=>me,throwStatement:()=>Ae,tryStatement:()=>Te,unaryExpression:()=>oe,updateExpression:()=>ie,variableDeclaration:()=>Fe,variableDeclarator:()=>Oe,whileStatement:()=>Pe});var O=e=>{let{type:r,...n}=e;if(!r||typeof r!="string")throw new y("missing-node-type","expr() requires a node with a valid type property");if(!T(r))throw h(r);return {"#expr":r,...n}},k=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":r,...n}=e;return {type:r,...n}},E=e=>({type:"Identifier",name:e}),x=e=>e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:{type:"Literal",value:e},ee=e=>({type:"ArrayExpression",elements:e}),f=e=>({type:"ObjectExpression",properties:e}),w=(e,r,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:r,kind:"init"}),C=e=>({type:"SpreadElement",argument:e}),J=(e,r,n=false)=>({type:"CallExpression",callee:e,arguments:r,optional:n}),te=(e,r)=>({type:"NewExpression",callee:e,arguments:r}),D=(e,r,n=false,i=false)=>({type:"MemberExpression",object:e,property:r,computed:n,optional:i}),re=e=>({type:"ChainExpression",expression:e}),ne=(e,r,n)=>({type:"BinaryExpression",left:r,right:n,operator:e}),se=(e,r,n)=>({type:"LogicalExpression",operator:e,left:r,right:n}),oe=(e,r)=>({type:"UnaryExpression",operator:e,argument:r,prefix:true}),ie=(e,r,n=false)=>({type:"UpdateExpression",operator:e,argument:r,prefix:n}),ae=(e,r,n)=>({type:"AssignmentExpression",operator:e,left:r,right:n}),pe=(e,r,n)=>({type:"ConditionalExpression",test:e,consequent:r,alternate:n}),le=e=>({type:"AwaitExpression",argument:e}),ce=(e,r=false)=>({type:"TemplateElement",value:e,tail:r}),me=(e,r)=>({type:"TemplateLiteral",quasis:e,expressions:r}),ye=(e,r,n=false,i=false)=>({type:"ArrowFunctionExpression",expression:r.type!="BlockStatement",generator:i,async:n,params:e,body:r}),xe=(e=null,r,n,i=false,p=false)=>({type:"FunctionExpression",id:e,params:r,body:n,async:i,generator:p}),Ee=(e,r,n,i=false,p=false)=>({type:"FunctionDeclaration",id:e,params:r,body:n,generator:i,async:p}),Se=e=>({type:"BlockStatement",body:e}),ue=e=>({type:"ExpressionStatement",expression:e}),de=e=>({type:"ReturnStatement",argument:e}),fe=(e,r,n=null)=>({type:"IfStatement",test:e,consequent:r,alternate:n}),ge=(e,r)=>({type:"SwitchStatement",cases:r,discriminant:e}),be=(e,r)=>({type:"SwitchCase",consequent:r,test:e}),Ae=e=>({type:"ThrowStatement",argument:e}),Te=(e,r,n=null)=>({type:"TryStatement",block:e,handler:r,finalizer:n}),he=(e,r)=>({type:"CatchClause",param:e,body:r}),Ne=(e=null)=>({type:"BreakStatement",label:e}),we=(e=null)=>({type:"ContinueStatement",label:e}),Ce=()=>({type:"EmptyStatement"}),Je=(e,r,n,i)=>({type:"ForStatement",init:e,test:r,update:n,body:i}),De=(e,r,n)=>({type:"ForInStatement",body:n,left:e,right:r}),Ie=(e,r,n,i=false)=>({type:"ForOfStatement",body:n,left:e,right:r,await:i}),Pe=(e,r)=>({type:"WhileStatement",test:e,body:r}),Xe=(e,r)=>({type:"DoWhileStatement",body:e,test:r}),Fe=(e,r)=>({type:"VariableDeclaration",declarations:r,kind:e}),Oe=(e,r=null)=>({type:"VariableDeclarator",id:e,init:r}),ke=e=>({type:"ObjectPattern",properties:e}),Be=e=>({type:"ArrayPattern",elements:e}),Le=(e,r=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:r,shorthand:n,computed:i,method:false}),je=e=>({type:"RestElement",argument:e}),_e=(e,r)=>({type:"AssignmentPattern",left:e,right:r}),Re=(e,r="script")=>({type:"Program",body:e,sourceType:r}),I=e=>({type:"JsonExpression",body:e}),Ve=(e,r)=>({type:"ImportDeclaration",specifiers:e,source:r}),Me=(e,r)=>({type:"ImportSpecifier",imported:e,local:r}),ve=e=>({type:"ImportDefaultSpecifier",local:e}),Ue=e=>({type:"ImportNamespaceSpecifier",local:e}),We=(e=null,r=[],n=null)=>({type:"ExportNamedDeclaration",declaration:e,specifiers:r,source:n}),qe=e=>({type:"ExportDefaultDeclaration",declaration:e}),$e=(e,r=e)=>({type:"ExportSpecifier",local:e,exported:r}),Ke=e=>({type:"JSXIdentifier",name:e}),Ye=(e,r)=>({type:"JSXMemberExpression",object:e,property:r}),ze=(e,r)=>({type:"JSXNamespacedName",namespace:e,name:r}),He=()=>({type:"JSXEmptyExpression"}),Ze=e=>({type:"JSXExpressionContainer",expression:e}),Ge=e=>({type:"JSXSpreadAttribute",argument:e}),Qe=(e,r=null)=>({type:"JSXAttribute",name:e,value:r}),et=(e,r=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:r,selfClosing:n}),tt=e=>({type:"JSXClosingElement",name:e}),B=()=>({type:"JSXOpeningFragment"}),L=()=>({type:"JSXClosingFragment"}),rt=(e,r=e)=>({type:"JSXText",value:e,raw:r}),nt=(e,r=[],n=null)=>({type:"JSXElement",openingElement:e,children:r,closingElement:n}),st=(e=[],r=B(),n=L())=>({type:"JSXFragment",openingFragment:r,children:e,closingFragment:n}),j=I;var ot=(e="b")=>{class r{constructor(o){this.text=o;}}let n=(t,o)=>{if(typeof t!="object")return typeof t=="string"?`"${t}"`:typeof t=="bigint"?`${t}n`:String(t);if(!t)return "null";if(t instanceof RegExp)return t;if(Array.isArray(t))return `[${t.map(S=>n(S,o)).join(", ")}]`;if(!t.type)return t instanceof r?t.text:`${e}.jsonExpression(${JSON.stringify(t)})`;if(t.type in m)return m[t.type](t,o);throw new y("unknown-node-type","Unknown type: "+t.type,{type:t.type})},i=t=>`(${e}) => ${n(t)}`,p=t=>new Function("b",`return ${t}`)(g),s=(t,o,...S)=>{let A=[],P=false;return S.reverse().forEach(X=>{X===void 0?P&&A.push("false"):(A.push(n(X,t)),P=true);}),`${e}.${o}(${A.reverse().join(", ")})`},m={ArrayExpression:(t,o)=>s(t,"arrayExpression",t.elements),ArrayPattern:(t,o)=>s(t,"arrayPattern",t.elements),ArrowFunctionExpression:(t,o)=>s(t,"arrowFunctionExpression",t.params,t.body,t.async||void 0),AssignmentExpression:(t,o)=>s(t,"assignmentExpression",t.operator,t.left,t.right),AssignmentProperty:(t,o)=>s(t,"assignmentProperty",t.key,t.value||void 0,t.shorthand||void 0),AwaitExpression:(t,o)=>s(t,"awaitExpression",t.argument),BinaryExpression:(t,o)=>s(t,"binaryExpression",t.operator,t.left,t.right),BlockStatement:(t,o)=>s(t,"blockStatement",t.body),BreakStatement:(t,o)=>t.label?s(t,"breakStatement",t.label):s(t,"breakStatement"),CallExpression:(t,o)=>s(t,"callExpression",t.callee,t.arguments,t.optional||void 0),CatchClause:(t,o)=>s(t,"catchClause",t.param,t.body),ChainExpression:(t,o)=>s(t,"chainExpression",t.expression),ConditionalExpression:(t,o)=>s(t,"conditionalExpression",t.test,t.consequent,t.alternate),ContinueStatement:(t,o)=>s(t,"continueStatement",t.label),DoWhileStatement:(t,o)=>s(t,"doWhileStatement",t.body,t.test),EmptyStatement:(t,o)=>s(t,"emptyStatement"),ExpressionStatement:(t,o)=>s(t,"expressionStatement",t.expression),ForInStatement:(t,o)=>s(t,"forInStatement",t.left,t.right,t.body),ForOfStatement:(t,o)=>s(t,"forOfStatement",t.left,t.right,t.body),ForStatement:(t,o)=>s(t,"forStatement",t.init,t.test,t.update,t.body),FunctionDeclaration:(t,o)=>s(t,"functionDeclaration",t.id,t.params,t.body,t.generator||void 0,t.async||void 0),FunctionExpression:(t,o)=>s(t,"functionExpression",t.id||null,t.params,t.body,t.generator||void 0,t.async||void 0),Identifier:(t,o)=>s(t,"identifier",t.name),IfStatement:(t,o)=>s(t,"ifStatement",t.test,t.consequent,t.alternate),ImportDeclaration:(t,o)=>s(t,"importDeclaration",t.specifiers,t.source),ImportDefaultSpecifier:(t,o)=>s(t,"importDefaultSpecifier",t.local),ImportNamespaceSpecifier:(t,o)=>s(t,"importNamespaceSpecifier",t.local),ImportSpecifier:(t,o)=>s(t,"importSpecifier",t.imported,t.local),JsonExpression:(t,o)=>s(t,"jsonExpression",JSON.stringify(t.body)),Literal:(t,o)=>s(t,"literal",t.value),LogicalExpression:(t,o)=>s(t,"logicalExpression",t.operator,t.left,t.right),MemberExpression:(t,o)=>s(t,"memberExpression",t.object,t.property,t.computed||void 0,t.optional||void 0),NewExpression:(t,o)=>s(t,"newExpression",t.callee,t.arguments),ObjectExpression:(t,o)=>s(t,"objectExpression",t.properties),ObjectPattern:(t,o)=>s(t,"objectPattern",t.properties),Program:(t,o)=>s(t,"program",t.body),Property:(t,o)=>{if(o.type==="ObjectPattern")return s(t,"assignmentProperty",t.key,t.value,t.shorthand||void 0);if(o.type==="ObjectExpression")return s(t,"property",t.key,t.value,t.shorthand||void 0,t.computed||void 0)},ReturnStatement:(t,o)=>s(t,"returnStatement",t.argument),SwitchCase:(t,o)=>s(t,"switchCase",t.test,t.consequent),SwitchStatement:(t,o)=>s(t,"switchStatement",t.discriminant,t.cases),TemplateElement:(t,o)=>t.tail?s(t,"templateElement",new r(JSON.stringify(t.value)),true):s(t,"templateElement",new r(JSON.stringify(t.value))),TemplateLiteral:(t,o)=>s(t,"templateLiteral",t.quasis,t.expressions),ThrowStatement:(t,o)=>s(t,"throwStatement",t.argument),TryStatement:(t,o)=>s(t,"tryStatement",t.block,t.handler,t.finalizer),UnaryExpression:(t,o)=>s(t,"unaryExpression",t.operator,t.argument),UpdateExpression:(t,o)=>t.prefix==true?s(t,"updateExpression",t.operator,t.argument,true):s(t,"updateExpression",t.operator,t.argument),VariableDeclaration:(t,o)=>s(t,"variableDeclaration",t.kind,t.declarations),VariableDeclarator:(t,o)=>s(t,"variableDeclarator",t.id,t.init||void 0),WhileStatement:(t,o)=>s(t,"whileStatement",t.test,t.body),SpreadElement:(t,o)=>s(t,"spreadElement",t.argument),RestElement:(t,o)=>s(t,"restElement",t.argument)};return {build:n,buildFunction:i,safeEval:p,builders:m}};var U={};F(U,{isArrayExpression:()=>ut,isArrayPattern:()=>Lt,isArrowFunctionExpression:()=>yt,isAssignmentExpression:()=>Tt,isAssignmentProperty:()=>nr,isAwaitExpression:()=>ht,isBinaryExpression:()=>mt,isBlockStatement:()=>Jt,isBreakStatement:()=>Pt,isCallExpression:()=>Et,isCatchClause:()=>Kt,isConditionalExpression:()=>dt,isContinueStatement:()=>Xt,isDirective:()=>rr,isDoWhileStatement:()=>qt,isEmptyStatement:()=>Ft,isExpressionStatement:()=>Ct,isForInStatement:()=>Ut,isForOfStatement:()=>Wt,isForStatement:()=>vt,isFunctionDeclaration:()=>jt,isFunctionExpression:()=>xt,isIdentifier:()=>ct,isIfStatement:()=>It,isImportDeclaration:()=>Zt,isImportDefaultSpecifier:()=>Qt,isImportNamespaceSpecifier:()=>er,isImportSpecifier:()=>Gt,isJsonExpression:()=>wt,isLiteral:()=>lt,isLogicalExpression:()=>ft,isMemberExpression:()=>At,isModuleDeclaration:()=>tr,isNewExpression:()=>Nt,isNode:()=>sr,isObjectExpression:()=>St,isObjectPattern:()=>Bt,isProgram:()=>_t,isProperty:()=>v,isReturnStatement:()=>Dt,isSwitchCase:()=>Vt,isSwitchStatement:()=>Rt,isTemplateElement:()=>zt,isTemplateLiteral:()=>Ht,isThrowStatement:()=>Yt,isTryStatement:()=>$t,isUnaryExpression:()=>gt,isUpdateExpression:()=>bt,isVariableDeclaration:()=>kt,isVariableDeclarator:()=>Ot,isWhileStatement:()=>Mt});var _=e=>typeof e=="object"&&e!==null&&typeof e.type=="string",it=N;function u(e,r){let n=it[e.type],i=e,p=(s,m)=>{if(s!=null)if(Array.isArray(s))for(let t=0;t<s.length;t++)_(s[t])&&r(s[t],m,t);else _(s)&&r(s,m,null);};if(n){for(let s of n)p(i[s],s);return}for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&p(i[s],s);}function R(e){let r=[];return u(e,n=>r.push(n)),r}function b(e,r){let n=false;function i(p,s){if(!p||n)return;let m=r[p.type]??r["*"],t=false;if(m){let o=m(p,s);if(o===false&&(t=true),o==="break"){n=true;return}}t||u(p,o=>{n||i(o,p);});}i(e,null);}var at=new Proxy({fn:{}},{get(e,r){return {type:"Identifier",name:r}}}),a=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function V(e,r){let n;return b(e,{"*":i=>{if(r(i))return n=i,"break"}}),n}function M(e,r,n){let i=p=>{if(r(p))return n(p);if(Array.isArray(p)){let s=false,m=p.map(t=>{let o=i(t);return o!==t&&(s=true),o});return s?m:p}if(a(p)){let s=false,m={};for(let t in p){let o=p[t],S=i(o);m[t]=S,S!==o&&(s=true);}return s?m:p}return p};return i(e)}function pt(e,r){let n={};return r.forEach(i=>{i in e&&(n[i]=e[i]);}),n}var lt=e=>e?.type==="Literal"&&"value"in e,ct=e=>e?.type==="Identifier"&&typeof e.name=="string",mt=e=>e?.type==="BinaryExpression"&&a(e.left)&&a(e.right)&&typeof e.operator=="string",yt=e=>e?.type==="ArrowFunctionExpression"&&a(e.body),xt=e=>e?.type==="FunctionExpression"&&a(e.body),Et=e=>e?.type==="CallExpression"&&a(e.callee)&&Array.isArray(e.arguments),St=e=>e?.type==="ObjectExpression"&&Array.isArray(e.properties),ut=e=>e?.type==="ArrayExpression"&&Array.isArray(e.elements),dt=e=>e?.type==="ConditionalExpression"&&a(e.test)&&a(e.consequent)&&a(e.alternate),ft=e=>e?.type==="LogicalExpression"&&a(e.left)&&a(e.right)&&typeof e.operator=="string",gt=e=>e?.type==="UnaryExpression"&&typeof e.operator=="string"&&a(e.argument),bt=e=>e?.type==="UpdateExpression"&&typeof e.operator=="string"&&a(e.argument),At=e=>e?.type==="MemberExpression"&&a(e.object)&&a(e.property),Tt=e=>e?.type==="AssignmentExpression"&&a(e.left)&&a(e.right)&&typeof e.operator=="string",ht=e=>e?.type==="AwaitExpression"&&"argument"in e,Nt=e=>e?.type==="NewExpression"&&a(e.callee)&&Array.isArray(e.arguments),wt=e=>e?.type==="JsonExpression"&&a(e.body),Ct=e=>e?.type==="ExpressionStatement"&&a(e.expression),Jt=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),Dt=e=>e?.type==="ReturnStatement",It=e=>e?.type==="IfStatement"&&a(e.test)&&a(e.consequent),Pt=e=>e?.type==="BreakStatement",Xt=e=>e?.type==="ContinueStatement",Ft=e=>e?.type==="EmptyStatement",Ot=e=>e?.type==="VariableDeclarator"&&a(e.id),kt=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),Bt=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),Lt=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),jt=e=>e?.type==="FunctionDeclaration"&&a(e.id)&&a(e.body),_t=e=>e?.type==="Program"&&Array.isArray(e.body),Rt=e=>e?.type==="SwitchStatement"&&a(e.discriminant)&&Array.isArray(e.cases),Vt=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),Mt=e=>e?.type==="WhileStatement"&&a(e.test)&&a(e.body),vt=e=>e?.type==="ForStatement"&&"body"in e,Ut=e=>e?.type==="ForInStatement"&&a(e.left)&&a(e.right)&&a(e.body),Wt=e=>e?.type==="ForOfStatement"&&a(e.left)&&a(e.right)&&a(e.body),qt=e=>e?.type==="DoWhileStatement"&&a(e.body)&&a(e.test),$t=e=>e?.type==="TryStatement"&&a(e.block),Kt=e=>e?.type==="CatchClause"&&a(e.body),Yt=e=>e?.type==="ThrowStatement"&&a(e.argument),zt=e=>e?.type==="TemplateElement"&&a(e.value),Ht=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),Zt=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&a(e.source),Gt=e=>e?.type==="ImportSpecifier"&&a(e.imported)&&a(e.local),Qt=e=>e?.type==="ImportDefaultSpecifier"&&a(e.local),er=e=>e?.type==="ImportNamespaceSpecifier"&&a(e.local),tr=e=>e?.type==="ModuleDeclaration",rr=e=>e?.type==="Directive",v=e=>e?.type==="Property"&&a(e.key)&&a(e.value),nr=e=>v(e),sr=e=>typeof e?.type=="string";var or="createElement",ir="Fragment";function c(e,r){return r.start!==void 0&&(e.start=r.start),r.end!==void 0&&(e.end=r.end),r.loc!==void 0&&(e.loc=r.loc),r.range!==void 0&&(e.range=r.range),e}var ar=e=>/^[a-zA-Z_$][\w$]*$/.test(e);function W(e){return e.type==="JSXIdentifier"?c(/^[a-z]/.test(e.name)||e.name.includes("-")?x(e.name):E(e.name),e):e.type==="JSXNamespacedName"?c(x(`${e.namespace.name}:${e.name.name}`),e):c(D(W(e.object),c(E(e.property.name),e.property)),e)}function pr(e){return e.type==="JSXNamespacedName"?c(x(`${e.namespace.name}:${e.name.name}`),e):c(ar(e.name)?E(e.name):x(e.name),e)}function lr(e,r){return e===null?c(x(true),r):e.type==="JSXExpressionContainer"?e.expression:e}var q=(e,r)=>c(r.emptyPropsAsObject?f([]):x(null),e);function cr(e,r,n){if(e.length===0)return q(r,n);let i=e.map(p=>p.type==="JSXSpreadAttribute"?c(C(p.argument),p):c(w(pr(p.name),lr(p.value,p)),p));return c(f(i),r)}function mr(e){let r=e.split(/\r\n|\n|\r/),n=-1;for(let p=0;p<r.length;p++)/[^ \t]/.test(r[p])&&(n=p);let i="";for(let p=0;p<r.length;p++){let s=r[p].replace(/\t/g," ");p!==0&&(s=s.replace(/^ +/,"")),p!==r.length-1&&(s=s.replace(/ +$/,"")),s&&(p!==n&&(s+=" "),i+=s);}return i===""?null:i}function yr(e){if(e.type==="JSXText"){let r=mr(e.value);return r===null?null:c(x(r),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e}function $(e,r={}){let n=e.type==="JSXFragment"?c(E(ir),e.openingFragment):W(e.openingElement.name),i=e.type==="JSXFragment"?q(e.openingFragment,r):cr(e.openingElement.attributes,e.openingElement,r),p=e.children.map(yr).filter(s=>s!==null);return c(J(c(E(or),e),[n,i,...p]),e)}var K=(e={})=>({vars:e,parent:null}),Y=(e,r)=>({vars:r,parent:e});function z(e,r){for(let n=e;n;n=n.parent)if(Object.prototype.hasOwnProperty.call(n.vars,r))return n.vars[r]}function H(e){let r=new Map;for(let n=e;n;n=n.parent)for(let i of Object.keys(n.vars))r.has(i)||r.set(i,n.vars[i]);return r}exports.BinaryPrecedence=Q;exports.Mock=at;exports.Precedence=l;exports.TSLiteError=y;exports.VALID_EXPRESSION_ENTRY_TYPES=d;exports.VALID_OBJECT_KEY=G;exports.VisitorKeys=N;exports.childScope=Y;exports.childrenOf=R;exports.desugarJSX=$;exports.expr=O;exports.find=V;exports.forEachChild=u;exports.fromExprMarker=k;exports.generateBuilders=ot;exports.guards=U;exports.invalidExpressionEntryError=h;exports.isObject=a;exports.isValidExpressionEntryType=T;exports.json=j;exports.jsonExpression=I;exports.lookup=z;exports.mutate=M;exports.pick=pt;exports.rootScope=K;exports.visibleNames=H;exports.walk=b;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { B as BaseNode, A as ArrayExpression, N as Node, a as ArrayPattern, b as ArrowFunctionExpression, c as AssignmentExpression, d as AssignmentProperty, e as AwaitExpression, f as BinaryExpression, g as BlockStatement, h as BreakStatement, S as SimpleCallExpression, C as CatchClause, i as ChainExpression, j as ConditionalExpression, k as ContinueStatement, D as DoWhileStatement, E as EmptyStatement, l as ExpressionStatement, F as ForInStatement, m as ForOfStatement, n as ForStatement, o as FunctionDeclaration, p as FunctionExpression, I as Identifier, q as IfStatement, r as ImportDeclaration, s as ImportDefaultSpecifier, t as ImportNamespaceSpecifier, u as ImportSpecifier, J as JsonExpression, L as Literal, v as LogicalExpression, M as MemberExpression, w as NewExpression, O as ObjectExpression, x as ObjectPattern, P as Program, y as Property, R as ReturnStatement, z as SwitchCase, G as SwitchStatement, T as TemplateElement, H as TemplateLiteral, K as ThrowStatement, Q as TryStatement, U as UnaryExpression, V as UpdateExpression, W as VariableDeclaration, X as VariableDeclarator, Y as WhileStatement, Z as SpreadElement, _ as RestElement, $ as Directive, a0 as ModuleDeclaration, a1 as JSXElement, a2 as JSXFragment, a3 as CallExpression } from './index-CcVx_Zur.cjs';
2
- export { a4 as AssignmentOperator, a5 as AssignmentPattern, a6 as BaseCallExpression, a7 as BaseDeclaration, a8 as BaseExpression, a9 as BaseForXStatement, aa as BaseFunction, ab as BaseModuleDeclaration, ac as BaseModuleSpecifier, ad as BaseNodeWithoutComments, ae as BasePattern, af as BaseStatement, ag as BigIntLiteral, ah as BinaryOperator, ai as ChainElement, aj as Comment, ak as DebuggerStatement, al as Declaration, am as ExportDefaultDeclaration, an as ExportNamedDeclaration, ao as ExportSpecifier, ap as Expression, aq as Function, ar as ImportExpression, as as JSXAttribute, at as JSXChild, au as JSXClosingElement, av as JSXClosingFragment, aw as JSXEmptyExpression, ax as JSXExpressionContainer, ay as JSXIdentifier, az as JSXMemberExpression, aA as JSXNamespacedName, aB as JSXOpeningElement, aC as JSXOpeningFragment, aD as JSXSpreadAttribute, aE as JSXTagName, aF as JSXText, aG as LabeledStatement, aH as LogicalOperator, aI as MaybeNamedFunctionDeclaration, aJ as MetaProperty, aK as MethodDefinition, aL as ModuleSpecifier, aM as NodeMap, aN as Pattern, aO as Position, aP as PropertyDefinition, aQ as RegExpLiteral, aR as SequenceExpression, aS as SimpleArrayExpression, aT as SimpleArrayPattern, aU as SimpleArrowFunctionExpression, aV as SimpleAssignmentExpression, aW as SimpleAssignmentPattern, aX as SimpleAssignmentProperty, aY as SimpleAwaitExpression, aZ as SimpleBaseCallExpression, a_ as SimpleBaseDeclaration, a$ as SimpleBaseExpression, b0 as SimpleBaseForXStatement, b1 as SimpleBaseFunction, b2 as SimpleBaseNode, b3 as SimpleBaseNodeWithoutComments, b4 as SimpleBasePattern, b5 as SimpleBaseStatement, b6 as SimpleBigIntLiteral, b7 as SimpleBinaryExpression, b8 as SimpleBlockStatement, b9 as SimpleBreakStatement, ba as SimpleCatchClause, bb as SimpleChainExpression, bc as SimpleComment, bd as SimpleConditionalExpression, be as SimpleContinueStatement, bf as SimpleDoWhileStatement, bg as SimpleEmptyStatement, bh as SimpleExpressionStatement, bi as SimpleForInStatement, bj as SimpleForOfStatement, bk as SimpleForStatement, bl as SimpleFunctionDeclaration, bm as SimpleFunctionExpression, bn as SimpleIdentifier, bo as SimpleIfStatement, bp as SimpleJsonExpression, bq as SimpleLabeledStatement, br as SimpleLiteral, bs as SimpleLogicalExpression, bt as SimpleMemberExpression, bu as SimpleMethodDefinition, bv as SimpleNewExpression, bw as SimpleNode, bx as SimpleObjectExpression, by as SimpleObjectPattern, bz as SimplePosition, bA as SimpleProgram, bB as SimpleProperty, bC as SimplePropertyDefinition, bD as SimpleRegExpLiteral, bE as SimpleRestElement, bF as SimpleReturnStatement, bG as SimpleSequenceExpression, bH as SimpleSimpleCallExpression, bI as SimpleSimpleLiteral, bJ as SimpleSourceLocation, bK as SimpleSpreadElement, bL as SimpleSwitchCase, bM as SimpleSwitchStatement, bN as SimpleTemplateElement, bO as SimpleTemplateLiteral, bP as SimpleThisExpression, bQ as SimpleThrowStatement, bR as SimpleTryStatement, bS as SimpleUnaryExpression, bT as SimpleUpdateExpression, bU as SimpleVariableDeclaration, bV as SimpleVariableDeclarator, bW as SimpleWhileStatement, bX as SourceLocation, bY as Statement, bZ as TSLite, b_ as TSLiteMarker, b$ as TaggedTemplateExpression, c0 as ThisExpression, c1 as UnaryOperator, c2 as UpdateOperator, c3 as ast, c4 as fromAstMarker, c5 as json, c6 as jsonExpression, c7 as types } from './index-CcVx_Zur.cjs';
1
+ import { B as BaseNode, A as ArrayExpression, N as Node, a as ArrayPattern, b as ArrowFunctionExpression, c as AssignmentExpression, d as AssignmentProperty, e as AwaitExpression, f as BinaryExpression, g as BlockStatement, h as BreakStatement, S as SimpleCallExpression, C as CatchClause, i as ChainExpression, j as ConditionalExpression, k as ContinueStatement, D as DoWhileStatement, E as EmptyStatement, l as ExpressionStatement, F as ForInStatement, m as ForOfStatement, n as ForStatement, o as FunctionDeclaration, p as FunctionExpression, I as Identifier, q as IfStatement, r as ImportDeclaration, s as ImportDefaultSpecifier, t as ImportNamespaceSpecifier, u as ImportSpecifier, J as JsonExpression, L as Literal, v as LogicalExpression, M as MemberExpression, w as NewExpression, O as ObjectExpression, x as ObjectPattern, P as Program, y as Property, R as ReturnStatement, z as SwitchCase, G as SwitchStatement, T as TemplateElement, H as TemplateLiteral, K as ThrowStatement, Q as TryStatement, U as UnaryExpression, V as UpdateExpression, W as VariableDeclaration, X as VariableDeclarator, Y as WhileStatement, Z as SpreadElement, _ as RestElement, $ as Directive, a0 as ModuleDeclaration, a1 as JSXElement, a2 as JSXFragment, a3 as CallExpression } from './index-CFG9pxqO.cjs';
2
+ export { a4 as AssignmentOperator, a5 as AssignmentPattern, a6 as BaseCallExpression, a7 as BaseDeclaration, a8 as BaseExpression, a9 as BaseForXStatement, aa as BaseFunction, ab as BaseModuleDeclaration, ac as BaseModuleSpecifier, ad as BaseNodeWithoutComments, ae as BasePattern, af as BaseStatement, ag as BigIntLiteral, ah as BinaryOperator, ai as ChainElement, aj as Comment, ak as DebuggerStatement, al as Declaration, am as ExportDefaultDeclaration, an as ExportNamedDeclaration, ao as ExportSpecifier, ap as Expression, aq as Function, ar as ImportExpression, as as JSXAttribute, at as JSXChild, au as JSXClosingElement, av as JSXClosingFragment, aw as JSXEmptyExpression, ax as JSXExpressionContainer, ay as JSXIdentifier, az as JSXMemberExpression, aA as JSXNamespacedName, aB as JSXOpeningElement, aC as JSXOpeningFragment, aD as JSXSpreadAttribute, aE as JSXTagName, aF as JSXText, aG as LabeledStatement, aH as LogicalOperator, aI as MaybeNamedFunctionDeclaration, aJ as MetaProperty, aK as MethodDefinition, aL as ModuleSpecifier, aM as NodeMap, aN as Pattern, aO as Position, aP as PropertyDefinition, aQ as RegExpLiteral, aR as SequenceExpression, aS as SimpleArrayExpression, aT as SimpleArrayPattern, aU as SimpleArrowFunctionExpression, aV as SimpleAssignmentExpression, aW as SimpleAssignmentPattern, aX as SimpleAssignmentProperty, aY as SimpleAwaitExpression, aZ as SimpleBaseCallExpression, a_ as SimpleBaseDeclaration, a$ as SimpleBaseExpression, b0 as SimpleBaseForXStatement, b1 as SimpleBaseFunction, b2 as SimpleBaseNode, b3 as SimpleBaseNodeWithoutComments, b4 as SimpleBasePattern, b5 as SimpleBaseStatement, b6 as SimpleBigIntLiteral, b7 as SimpleBinaryExpression, b8 as SimpleBlockStatement, b9 as SimpleBreakStatement, ba as SimpleCatchClause, bb as SimpleChainExpression, bc as SimpleComment, bd as SimpleConditionalExpression, be as SimpleContinueStatement, bf as SimpleDoWhileStatement, bg as SimpleEmptyStatement, bh as SimpleExpressionStatement, bi as SimpleForInStatement, bj as SimpleForOfStatement, bk as SimpleForStatement, bl as SimpleFunctionDeclaration, bm as SimpleFunctionExpression, bn as SimpleIdentifier, bo as SimpleIfStatement, bp as SimpleJsonExpression, bq as SimpleLabeledStatement, br as SimpleLiteral, bs as SimpleLogicalExpression, bt as SimpleMemberExpression, bu as SimpleMethodDefinition, bv as SimpleNewExpression, bw as SimpleNode, bx as SimpleObjectExpression, by as SimpleObjectPattern, bz as SimplePosition, bA as SimpleProgram, bB as SimpleProperty, bC as SimplePropertyDefinition, bD as SimpleRegExpLiteral, bE as SimpleRestElement, bF as SimpleReturnStatement, bG as SimpleSequenceExpression, bH as SimpleSimpleCallExpression, bI as SimpleSimpleLiteral, bJ as SimpleSourceLocation, bK as SimpleSpreadElement, bL as SimpleSwitchCase, bM as SimpleSwitchStatement, bN as SimpleTemplateElement, bO as SimpleTemplateLiteral, bP as SimpleThisExpression, bQ as SimpleThrowStatement, bR as SimpleTryStatement, bS as SimpleUnaryExpression, bT as SimpleUpdateExpression, bU as SimpleVariableDeclaration, bV as SimpleVariableDeclarator, bW as SimpleWhileStatement, bX as SourceLocation, bY as Statement, bZ as TSArrayType, b_ as TSCallSignatureDeclaration, b$ as TSConditionalType, c0 as TSFunctionType, c1 as TSIndexSignature, c2 as TSIndexedAccessType, c3 as TSInferType, c4 as TSIntersectionType, c5 as TSKeywordType, c6 as TSLite, c7 as TSLiteMarker, c8 as TSLiteralType, c9 as TSMappedType, ca as TSPropertySignature, cb as TSTupleType, cc as TSType, cd as TSTypeLiteral, ce as TSTypeMember, cf as TSTypeOperator, cg as TSTypeParameter, ch as TSTypeQuery, ci as TSTypeReference, cj as TSUnionType, ck as TaggedTemplateExpression, cl as ThisExpression, cm as UnaryOperator, cn as UpdateOperator, co as expr, cp as fromExprMarker, cq as json, cr as jsonExpression, cs as types } from './index-CFG9pxqO.cjs';
3
3
 
4
4
  /** Erro lançado pelo `@tslite/core`. */
5
- type CoreErrorCode = "invalid-ast-entry" | "missing-node-type" | "unknown-node-type";
5
+ type CoreErrorCode = "invalid-expression-entry" | "missing-node-type" | "unknown-node-type";
6
6
  /**
7
7
  * Erro base da plataforma TSLite. Carrega um `code` legível por máquina e um
8
8
  * `details` opcional com o contexto estruturado (ex.: o `type` ofensor).
@@ -15,31 +15,29 @@ declare class TSLiteError<C extends string = string> extends Error {
15
15
  constructor(code: C, message: string, details?: Record<string, unknown>);
16
16
  }
17
17
 
18
- /** Marker para lógica executável em JSON híbrido */
19
- declare const AST_MARKER = "#ast";
20
18
  /** Pattern para keys de objeto válidas sem aspas */
21
19
  declare const VALID_OBJECT_KEY: RegExp;
22
20
  /**
23
- * Tipos válidos como ponto de entrada #ast.
21
+ * Tipos válidos como ponto de entrada #expr.
24
22
  *
25
23
  * São tipos que podem aparecer como VALOR em JSON - tudo que pode estar
26
24
  * do lado direito de uma atribuição ou como valor de propriedade.
27
25
  *
28
26
  * Basicamente: Expressions + Program (para AST completo)
29
27
  */
30
- declare const VALID_AST_ENTRY_TYPES: readonly ["Identifier", "MemberExpression", "CallExpression", "ArrowFunctionExpression", "FunctionExpression", "BinaryExpression", "LogicalExpression", "UnaryExpression", "UpdateExpression", "ConditionalExpression", "AssignmentExpression", "NewExpression", "ArrayExpression", "ObjectExpression", "AwaitExpression", "TemplateLiteral", "TaggedTemplateExpression", "SequenceExpression", "ChainExpression", "JSXElement", "JSXFragment", "Program"];
31
- type ValidAstEntryType = (typeof VALID_AST_ENTRY_TYPES)[number];
28
+ declare const VALID_EXPRESSION_ENTRY_TYPES: readonly ["Identifier", "MemberExpression", "CallExpression", "ArrowFunctionExpression", "FunctionExpression", "BinaryExpression", "LogicalExpression", "UnaryExpression", "UpdateExpression", "ConditionalExpression", "AssignmentExpression", "NewExpression", "ArrayExpression", "ObjectExpression", "AwaitExpression", "TemplateLiteral", "TaggedTemplateExpression", "SequenceExpression", "ChainExpression", "JSXElement", "JSXFragment", "Program"];
29
+ type ValidExpressionEntryType = (typeof VALID_EXPRESSION_ENTRY_TYPES)[number];
32
30
  /**
33
- * Verifica se um tipo é válido como ponto de entrada #ast
31
+ * Verifica se um tipo é válido como ponto de entrada #expr
34
32
  */
35
- declare function isValidAstEntryType(type: string): type is ValidAstEntryType;
33
+ declare function isValidExpressionEntryType(type: string): type is ValidExpressionEntryType;
36
34
  /**
37
- * Erro para tipo inválido como entrada #ast.
35
+ * Erro para tipo inválido como entrada #expr.
38
36
  *
39
- * `code: "invalid-ast-entry"`; `details` carrega o `type` ofensor e a lista de
40
- * tipos válidos, para o consumidor reagir sem fazer parse da mensagem.
37
+ * `code: "invalid-expression-entry"`; `details` carrega o `type` ofensor e a
38
+ * lista de tipos válidos, para o consumidor reagir sem fazer parse da mensagem.
41
39
  */
42
- declare function invalidAstEntryError(type: string): TSLiteError<"invalid-ast-entry">;
40
+ declare function invalidExpressionEntryError(type: string): TSLiteError<"invalid-expression-entry">;
43
41
  declare const VisitorKeys: {
44
42
  AssignmentExpression: string[];
45
43
  AssignmentPattern: string[];
@@ -122,6 +120,8 @@ declare const VisitorKeys: {
122
120
  JSXIdentifier: never[];
123
121
  JSXMemberExpression: string[];
124
122
  JSXNamespacedName: string[];
123
+ TSAsExpression: string[];
124
+ TSTypeAliasDeclaration: string[];
125
125
  };
126
126
  declare const Precedence: {
127
127
  Sequence: number;
@@ -404,4 +404,4 @@ declare function find<T = BaseNode>(node: any, match: (n: any) => boolean): T |
404
404
  declare function mutate<T = any>(node: T, match: (value: any) => boolean, modifier: (value: any) => any): T;
405
405
  declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
406
406
 
407
- export { AST_MARKER, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentProperty, AwaitExpression, BaseNode, BinaryExpression, BinaryPrecedence, BlockStatement, BreakStatement, CallExpression, CatchClause, ChainExpression, ConditionalExpression, ContinueStatement, type CoreErrorCode, Directive, DoWhileStatement, EmptyStatement, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXElement, JSXFragment, JsonExpression, Literal, LogicalExpression, MemberExpression, Mock, ModuleDeclaration, NewExpression, Node, ObjectExpression, ObjectPattern, Precedence, Program, Property, RestElement, ReturnStatement, type Scope, SimpleCallExpression, SpreadElement, SwitchCase, SwitchStatement, TSLiteError, TemplateElement, TemplateLiteral, ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VALID_AST_ENTRY_TYPES, VALID_OBJECT_KEY, type ValidAstEntryType, VariableDeclaration, VariableDeclarator, VisitorKeys, WhileStatement, childScope, childrenOf, desugarJSX, find, forEachChild, generateBuilders, index as guards, invalidAstEntryError, isObject, isValidAstEntryType, lookup, mutate, pick, rootScope, visibleNames, walk };
407
+ export { ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentProperty, AwaitExpression, BaseNode, BinaryExpression, BinaryPrecedence, BlockStatement, BreakStatement, CallExpression, CatchClause, ChainExpression, ConditionalExpression, ContinueStatement, type CoreErrorCode, Directive, DoWhileStatement, EmptyStatement, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXElement, JSXFragment, JsonExpression, Literal, LogicalExpression, MemberExpression, Mock, ModuleDeclaration, NewExpression, Node, ObjectExpression, ObjectPattern, Precedence, Program, Property, RestElement, ReturnStatement, type Scope, SimpleCallExpression, SpreadElement, SwitchCase, SwitchStatement, TSLiteError, TemplateElement, TemplateLiteral, ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VALID_EXPRESSION_ENTRY_TYPES, VALID_OBJECT_KEY, type ValidExpressionEntryType, VariableDeclaration, VariableDeclarator, VisitorKeys, WhileStatement, childScope, childrenOf, desugarJSX, find, forEachChild, generateBuilders, index as guards, invalidExpressionEntryError, isObject, isValidExpressionEntryType, lookup, mutate, pick, rootScope, visibleNames, walk };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { B as BaseNode, A as ArrayExpression, N as Node, a as ArrayPattern, b as ArrowFunctionExpression, c as AssignmentExpression, d as AssignmentProperty, e as AwaitExpression, f as BinaryExpression, g as BlockStatement, h as BreakStatement, S as SimpleCallExpression, C as CatchClause, i as ChainExpression, j as ConditionalExpression, k as ContinueStatement, D as DoWhileStatement, E as EmptyStatement, l as ExpressionStatement, F as ForInStatement, m as ForOfStatement, n as ForStatement, o as FunctionDeclaration, p as FunctionExpression, I as Identifier, q as IfStatement, r as ImportDeclaration, s as ImportDefaultSpecifier, t as ImportNamespaceSpecifier, u as ImportSpecifier, J as JsonExpression, L as Literal, v as LogicalExpression, M as MemberExpression, w as NewExpression, O as ObjectExpression, x as ObjectPattern, P as Program, y as Property, R as ReturnStatement, z as SwitchCase, G as SwitchStatement, T as TemplateElement, H as TemplateLiteral, K as ThrowStatement, Q as TryStatement, U as UnaryExpression, V as UpdateExpression, W as VariableDeclaration, X as VariableDeclarator, Y as WhileStatement, Z as SpreadElement, _ as RestElement, $ as Directive, a0 as ModuleDeclaration, a1 as JSXElement, a2 as JSXFragment, a3 as CallExpression } from './index-CcVx_Zur.js';
2
- export { a4 as AssignmentOperator, a5 as AssignmentPattern, a6 as BaseCallExpression, a7 as BaseDeclaration, a8 as BaseExpression, a9 as BaseForXStatement, aa as BaseFunction, ab as BaseModuleDeclaration, ac as BaseModuleSpecifier, ad as BaseNodeWithoutComments, ae as BasePattern, af as BaseStatement, ag as BigIntLiteral, ah as BinaryOperator, ai as ChainElement, aj as Comment, ak as DebuggerStatement, al as Declaration, am as ExportDefaultDeclaration, an as ExportNamedDeclaration, ao as ExportSpecifier, ap as Expression, aq as Function, ar as ImportExpression, as as JSXAttribute, at as JSXChild, au as JSXClosingElement, av as JSXClosingFragment, aw as JSXEmptyExpression, ax as JSXExpressionContainer, ay as JSXIdentifier, az as JSXMemberExpression, aA as JSXNamespacedName, aB as JSXOpeningElement, aC as JSXOpeningFragment, aD as JSXSpreadAttribute, aE as JSXTagName, aF as JSXText, aG as LabeledStatement, aH as LogicalOperator, aI as MaybeNamedFunctionDeclaration, aJ as MetaProperty, aK as MethodDefinition, aL as ModuleSpecifier, aM as NodeMap, aN as Pattern, aO as Position, aP as PropertyDefinition, aQ as RegExpLiteral, aR as SequenceExpression, aS as SimpleArrayExpression, aT as SimpleArrayPattern, aU as SimpleArrowFunctionExpression, aV as SimpleAssignmentExpression, aW as SimpleAssignmentPattern, aX as SimpleAssignmentProperty, aY as SimpleAwaitExpression, aZ as SimpleBaseCallExpression, a_ as SimpleBaseDeclaration, a$ as SimpleBaseExpression, b0 as SimpleBaseForXStatement, b1 as SimpleBaseFunction, b2 as SimpleBaseNode, b3 as SimpleBaseNodeWithoutComments, b4 as SimpleBasePattern, b5 as SimpleBaseStatement, b6 as SimpleBigIntLiteral, b7 as SimpleBinaryExpression, b8 as SimpleBlockStatement, b9 as SimpleBreakStatement, ba as SimpleCatchClause, bb as SimpleChainExpression, bc as SimpleComment, bd as SimpleConditionalExpression, be as SimpleContinueStatement, bf as SimpleDoWhileStatement, bg as SimpleEmptyStatement, bh as SimpleExpressionStatement, bi as SimpleForInStatement, bj as SimpleForOfStatement, bk as SimpleForStatement, bl as SimpleFunctionDeclaration, bm as SimpleFunctionExpression, bn as SimpleIdentifier, bo as SimpleIfStatement, bp as SimpleJsonExpression, bq as SimpleLabeledStatement, br as SimpleLiteral, bs as SimpleLogicalExpression, bt as SimpleMemberExpression, bu as SimpleMethodDefinition, bv as SimpleNewExpression, bw as SimpleNode, bx as SimpleObjectExpression, by as SimpleObjectPattern, bz as SimplePosition, bA as SimpleProgram, bB as SimpleProperty, bC as SimplePropertyDefinition, bD as SimpleRegExpLiteral, bE as SimpleRestElement, bF as SimpleReturnStatement, bG as SimpleSequenceExpression, bH as SimpleSimpleCallExpression, bI as SimpleSimpleLiteral, bJ as SimpleSourceLocation, bK as SimpleSpreadElement, bL as SimpleSwitchCase, bM as SimpleSwitchStatement, bN as SimpleTemplateElement, bO as SimpleTemplateLiteral, bP as SimpleThisExpression, bQ as SimpleThrowStatement, bR as SimpleTryStatement, bS as SimpleUnaryExpression, bT as SimpleUpdateExpression, bU as SimpleVariableDeclaration, bV as SimpleVariableDeclarator, bW as SimpleWhileStatement, bX as SourceLocation, bY as Statement, bZ as TSLite, b_ as TSLiteMarker, b$ as TaggedTemplateExpression, c0 as ThisExpression, c1 as UnaryOperator, c2 as UpdateOperator, c3 as ast, c4 as fromAstMarker, c5 as json, c6 as jsonExpression, c7 as types } from './index-CcVx_Zur.js';
1
+ import { B as BaseNode, A as ArrayExpression, N as Node, a as ArrayPattern, b as ArrowFunctionExpression, c as AssignmentExpression, d as AssignmentProperty, e as AwaitExpression, f as BinaryExpression, g as BlockStatement, h as BreakStatement, S as SimpleCallExpression, C as CatchClause, i as ChainExpression, j as ConditionalExpression, k as ContinueStatement, D as DoWhileStatement, E as EmptyStatement, l as ExpressionStatement, F as ForInStatement, m as ForOfStatement, n as ForStatement, o as FunctionDeclaration, p as FunctionExpression, I as Identifier, q as IfStatement, r as ImportDeclaration, s as ImportDefaultSpecifier, t as ImportNamespaceSpecifier, u as ImportSpecifier, J as JsonExpression, L as Literal, v as LogicalExpression, M as MemberExpression, w as NewExpression, O as ObjectExpression, x as ObjectPattern, P as Program, y as Property, R as ReturnStatement, z as SwitchCase, G as SwitchStatement, T as TemplateElement, H as TemplateLiteral, K as ThrowStatement, Q as TryStatement, U as UnaryExpression, V as UpdateExpression, W as VariableDeclaration, X as VariableDeclarator, Y as WhileStatement, Z as SpreadElement, _ as RestElement, $ as Directive, a0 as ModuleDeclaration, a1 as JSXElement, a2 as JSXFragment, a3 as CallExpression } from './index-CFG9pxqO.js';
2
+ export { a4 as AssignmentOperator, a5 as AssignmentPattern, a6 as BaseCallExpression, a7 as BaseDeclaration, a8 as BaseExpression, a9 as BaseForXStatement, aa as BaseFunction, ab as BaseModuleDeclaration, ac as BaseModuleSpecifier, ad as BaseNodeWithoutComments, ae as BasePattern, af as BaseStatement, ag as BigIntLiteral, ah as BinaryOperator, ai as ChainElement, aj as Comment, ak as DebuggerStatement, al as Declaration, am as ExportDefaultDeclaration, an as ExportNamedDeclaration, ao as ExportSpecifier, ap as Expression, aq as Function, ar as ImportExpression, as as JSXAttribute, at as JSXChild, au as JSXClosingElement, av as JSXClosingFragment, aw as JSXEmptyExpression, ax as JSXExpressionContainer, ay as JSXIdentifier, az as JSXMemberExpression, aA as JSXNamespacedName, aB as JSXOpeningElement, aC as JSXOpeningFragment, aD as JSXSpreadAttribute, aE as JSXTagName, aF as JSXText, aG as LabeledStatement, aH as LogicalOperator, aI as MaybeNamedFunctionDeclaration, aJ as MetaProperty, aK as MethodDefinition, aL as ModuleSpecifier, aM as NodeMap, aN as Pattern, aO as Position, aP as PropertyDefinition, aQ as RegExpLiteral, aR as SequenceExpression, aS as SimpleArrayExpression, aT as SimpleArrayPattern, aU as SimpleArrowFunctionExpression, aV as SimpleAssignmentExpression, aW as SimpleAssignmentPattern, aX as SimpleAssignmentProperty, aY as SimpleAwaitExpression, aZ as SimpleBaseCallExpression, a_ as SimpleBaseDeclaration, a$ as SimpleBaseExpression, b0 as SimpleBaseForXStatement, b1 as SimpleBaseFunction, b2 as SimpleBaseNode, b3 as SimpleBaseNodeWithoutComments, b4 as SimpleBasePattern, b5 as SimpleBaseStatement, b6 as SimpleBigIntLiteral, b7 as SimpleBinaryExpression, b8 as SimpleBlockStatement, b9 as SimpleBreakStatement, ba as SimpleCatchClause, bb as SimpleChainExpression, bc as SimpleComment, bd as SimpleConditionalExpression, be as SimpleContinueStatement, bf as SimpleDoWhileStatement, bg as SimpleEmptyStatement, bh as SimpleExpressionStatement, bi as SimpleForInStatement, bj as SimpleForOfStatement, bk as SimpleForStatement, bl as SimpleFunctionDeclaration, bm as SimpleFunctionExpression, bn as SimpleIdentifier, bo as SimpleIfStatement, bp as SimpleJsonExpression, bq as SimpleLabeledStatement, br as SimpleLiteral, bs as SimpleLogicalExpression, bt as SimpleMemberExpression, bu as SimpleMethodDefinition, bv as SimpleNewExpression, bw as SimpleNode, bx as SimpleObjectExpression, by as SimpleObjectPattern, bz as SimplePosition, bA as SimpleProgram, bB as SimpleProperty, bC as SimplePropertyDefinition, bD as SimpleRegExpLiteral, bE as SimpleRestElement, bF as SimpleReturnStatement, bG as SimpleSequenceExpression, bH as SimpleSimpleCallExpression, bI as SimpleSimpleLiteral, bJ as SimpleSourceLocation, bK as SimpleSpreadElement, bL as SimpleSwitchCase, bM as SimpleSwitchStatement, bN as SimpleTemplateElement, bO as SimpleTemplateLiteral, bP as SimpleThisExpression, bQ as SimpleThrowStatement, bR as SimpleTryStatement, bS as SimpleUnaryExpression, bT as SimpleUpdateExpression, bU as SimpleVariableDeclaration, bV as SimpleVariableDeclarator, bW as SimpleWhileStatement, bX as SourceLocation, bY as Statement, bZ as TSArrayType, b_ as TSCallSignatureDeclaration, b$ as TSConditionalType, c0 as TSFunctionType, c1 as TSIndexSignature, c2 as TSIndexedAccessType, c3 as TSInferType, c4 as TSIntersectionType, c5 as TSKeywordType, c6 as TSLite, c7 as TSLiteMarker, c8 as TSLiteralType, c9 as TSMappedType, ca as TSPropertySignature, cb as TSTupleType, cc as TSType, cd as TSTypeLiteral, ce as TSTypeMember, cf as TSTypeOperator, cg as TSTypeParameter, ch as TSTypeQuery, ci as TSTypeReference, cj as TSUnionType, ck as TaggedTemplateExpression, cl as ThisExpression, cm as UnaryOperator, cn as UpdateOperator, co as expr, cp as fromExprMarker, cq as json, cr as jsonExpression, cs as types } from './index-CFG9pxqO.js';
3
3
 
4
4
  /** Erro lançado pelo `@tslite/core`. */
5
- type CoreErrorCode = "invalid-ast-entry" | "missing-node-type" | "unknown-node-type";
5
+ type CoreErrorCode = "invalid-expression-entry" | "missing-node-type" | "unknown-node-type";
6
6
  /**
7
7
  * Erro base da plataforma TSLite. Carrega um `code` legível por máquina e um
8
8
  * `details` opcional com o contexto estruturado (ex.: o `type` ofensor).
@@ -15,31 +15,29 @@ declare class TSLiteError<C extends string = string> extends Error {
15
15
  constructor(code: C, message: string, details?: Record<string, unknown>);
16
16
  }
17
17
 
18
- /** Marker para lógica executável em JSON híbrido */
19
- declare const AST_MARKER = "#ast";
20
18
  /** Pattern para keys de objeto válidas sem aspas */
21
19
  declare const VALID_OBJECT_KEY: RegExp;
22
20
  /**
23
- * Tipos válidos como ponto de entrada #ast.
21
+ * Tipos válidos como ponto de entrada #expr.
24
22
  *
25
23
  * São tipos que podem aparecer como VALOR em JSON - tudo que pode estar
26
24
  * do lado direito de uma atribuição ou como valor de propriedade.
27
25
  *
28
26
  * Basicamente: Expressions + Program (para AST completo)
29
27
  */
30
- declare const VALID_AST_ENTRY_TYPES: readonly ["Identifier", "MemberExpression", "CallExpression", "ArrowFunctionExpression", "FunctionExpression", "BinaryExpression", "LogicalExpression", "UnaryExpression", "UpdateExpression", "ConditionalExpression", "AssignmentExpression", "NewExpression", "ArrayExpression", "ObjectExpression", "AwaitExpression", "TemplateLiteral", "TaggedTemplateExpression", "SequenceExpression", "ChainExpression", "JSXElement", "JSXFragment", "Program"];
31
- type ValidAstEntryType = (typeof VALID_AST_ENTRY_TYPES)[number];
28
+ declare const VALID_EXPRESSION_ENTRY_TYPES: readonly ["Identifier", "MemberExpression", "CallExpression", "ArrowFunctionExpression", "FunctionExpression", "BinaryExpression", "LogicalExpression", "UnaryExpression", "UpdateExpression", "ConditionalExpression", "AssignmentExpression", "NewExpression", "ArrayExpression", "ObjectExpression", "AwaitExpression", "TemplateLiteral", "TaggedTemplateExpression", "SequenceExpression", "ChainExpression", "JSXElement", "JSXFragment", "Program"];
29
+ type ValidExpressionEntryType = (typeof VALID_EXPRESSION_ENTRY_TYPES)[number];
32
30
  /**
33
- * Verifica se um tipo é válido como ponto de entrada #ast
31
+ * Verifica se um tipo é válido como ponto de entrada #expr
34
32
  */
35
- declare function isValidAstEntryType(type: string): type is ValidAstEntryType;
33
+ declare function isValidExpressionEntryType(type: string): type is ValidExpressionEntryType;
36
34
  /**
37
- * Erro para tipo inválido como entrada #ast.
35
+ * Erro para tipo inválido como entrada #expr.
38
36
  *
39
- * `code: "invalid-ast-entry"`; `details` carrega o `type` ofensor e a lista de
40
- * tipos válidos, para o consumidor reagir sem fazer parse da mensagem.
37
+ * `code: "invalid-expression-entry"`; `details` carrega o `type` ofensor e a
38
+ * lista de tipos válidos, para o consumidor reagir sem fazer parse da mensagem.
41
39
  */
42
- declare function invalidAstEntryError(type: string): TSLiteError<"invalid-ast-entry">;
40
+ declare function invalidExpressionEntryError(type: string): TSLiteError<"invalid-expression-entry">;
43
41
  declare const VisitorKeys: {
44
42
  AssignmentExpression: string[];
45
43
  AssignmentPattern: string[];
@@ -122,6 +120,8 @@ declare const VisitorKeys: {
122
120
  JSXIdentifier: never[];
123
121
  JSXMemberExpression: string[];
124
122
  JSXNamespacedName: string[];
123
+ TSAsExpression: string[];
124
+ TSTypeAliasDeclaration: string[];
125
125
  };
126
126
  declare const Precedence: {
127
127
  Sequence: number;
@@ -404,4 +404,4 @@ declare function find<T = BaseNode>(node: any, match: (n: any) => boolean): T |
404
404
  declare function mutate<T = any>(node: T, match: (value: any) => boolean, modifier: (value: any) => any): T;
405
405
  declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
406
406
 
407
- export { AST_MARKER, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentProperty, AwaitExpression, BaseNode, BinaryExpression, BinaryPrecedence, BlockStatement, BreakStatement, CallExpression, CatchClause, ChainExpression, ConditionalExpression, ContinueStatement, type CoreErrorCode, Directive, DoWhileStatement, EmptyStatement, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXElement, JSXFragment, JsonExpression, Literal, LogicalExpression, MemberExpression, Mock, ModuleDeclaration, NewExpression, Node, ObjectExpression, ObjectPattern, Precedence, Program, Property, RestElement, ReturnStatement, type Scope, SimpleCallExpression, SpreadElement, SwitchCase, SwitchStatement, TSLiteError, TemplateElement, TemplateLiteral, ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VALID_AST_ENTRY_TYPES, VALID_OBJECT_KEY, type ValidAstEntryType, VariableDeclaration, VariableDeclarator, VisitorKeys, WhileStatement, childScope, childrenOf, desugarJSX, find, forEachChild, generateBuilders, index as guards, invalidAstEntryError, isObject, isValidAstEntryType, lookup, mutate, pick, rootScope, visibleNames, walk };
407
+ export { ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentProperty, AwaitExpression, BaseNode, BinaryExpression, BinaryPrecedence, BlockStatement, BreakStatement, CallExpression, CatchClause, ChainExpression, ConditionalExpression, ContinueStatement, type CoreErrorCode, Directive, DoWhileStatement, EmptyStatement, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXElement, JSXFragment, JsonExpression, Literal, LogicalExpression, MemberExpression, Mock, ModuleDeclaration, NewExpression, Node, ObjectExpression, ObjectPattern, Precedence, Program, Property, RestElement, ReturnStatement, type Scope, SimpleCallExpression, SpreadElement, SwitchCase, SwitchStatement, TSLiteError, TemplateElement, TemplateLiteral, ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VALID_EXPRESSION_ENTRY_TYPES, VALID_OBJECT_KEY, type ValidExpressionEntryType, VariableDeclaration, VariableDeclarator, VisitorKeys, WhileStatement, childScope, childrenOf, desugarJSX, find, forEachChild, generateBuilders, index as guards, invalidExpressionEntryError, isObject, isValidExpressionEntryType, lookup, mutate, pick, rootScope, visibleNames, walk };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import {a,h,m,s,b,Ca,n,u,p,r,q}from'./chunk-JQLO5K6J.js';export{c as AST_MARKER,j as BinaryPrecedence,i as Precedence,b as TSLiteError,e as VALID_AST_ENTRY_TYPES,d as VALID_OBJECT_KEY,h as VisitorKeys,k as ast,l as fromAstMarker,g as invalidAstEntryError,f as isValidAstEntryType,Ba as json,fa as jsonExpression}from'./chunk-JQLO5K6J.js';var H=(e="b")=>{class n{constructor(s){this.text=s;}}let a=(t,s)=>{if(typeof t!="object")return typeof t=="string"?`"${t}"`:typeof t=="bigint"?`${t}n`:String(t);if(!t)return "null";if(t instanceof RegExp)return t;if(Array.isArray(t))return `[${t.map(m=>a(m,s)).join(", ")}]`;if(!t.type)return t instanceof n?t.text:`${e}.jsonExpression(${JSON.stringify(t)})`;if(t.type in l)return l[t.type](t,s);throw new b("unknown-node-type","Unknown type: "+t.type,{type:t.type})},p=t=>`(${e}) => ${a(t)}`,i=t=>new Function("b",`return ${t}`)(Ca),r=(t,s,...m)=>{let d=[],g=false;return m.reverse().forEach(T=>{T===void 0?g&&d.push("false"):(d.push(a(T,t)),g=true);}),`${e}.${s}(${d.reverse().join(", ")})`},l={ArrayExpression:(t,s)=>r(t,"arrayExpression",t.elements),ArrayPattern:(t,s)=>r(t,"arrayPattern",t.elements),ArrowFunctionExpression:(t,s)=>r(t,"arrowFunctionExpression",t.params,t.body,t.async||void 0),AssignmentExpression:(t,s)=>r(t,"assignmentExpression",t.operator,t.left,t.right),AssignmentProperty:(t,s)=>r(t,"assignmentProperty",t.key,t.value||void 0,t.shorthand||void 0),AwaitExpression:(t,s)=>r(t,"awaitExpression",t.argument),BinaryExpression:(t,s)=>r(t,"binaryExpression",t.operator,t.left,t.right),BlockStatement:(t,s)=>r(t,"blockStatement",t.body),BreakStatement:(t,s)=>t.label?r(t,"breakStatement",t.label):r(t,"breakStatement"),CallExpression:(t,s)=>r(t,"callExpression",t.callee,t.arguments,t.optional||void 0),CatchClause:(t,s)=>r(t,"catchClause",t.param,t.body),ChainExpression:(t,s)=>r(t,"chainExpression",t.expression),ConditionalExpression:(t,s)=>r(t,"conditionalExpression",t.test,t.consequent,t.alternate),ContinueStatement:(t,s)=>r(t,"continueStatement",t.label),DoWhileStatement:(t,s)=>r(t,"doWhileStatement",t.body,t.test),EmptyStatement:(t,s)=>r(t,"emptyStatement"),ExpressionStatement:(t,s)=>r(t,"expressionStatement",t.expression),ForInStatement:(t,s)=>r(t,"forInStatement",t.left,t.right,t.body),ForOfStatement:(t,s)=>r(t,"forOfStatement",t.left,t.right,t.body),ForStatement:(t,s)=>r(t,"forStatement",t.init,t.test,t.update,t.body),FunctionDeclaration:(t,s)=>r(t,"functionDeclaration",t.id,t.params,t.body,t.generator||void 0,t.async||void 0),FunctionExpression:(t,s)=>r(t,"functionExpression",t.id||null,t.params,t.body,t.generator||void 0,t.async||void 0),Identifier:(t,s)=>r(t,"identifier",t.name),IfStatement:(t,s)=>r(t,"ifStatement",t.test,t.consequent,t.alternate),ImportDeclaration:(t,s)=>r(t,"importDeclaration",t.specifiers,t.source),ImportDefaultSpecifier:(t,s)=>r(t,"importDefaultSpecifier",t.local),ImportNamespaceSpecifier:(t,s)=>r(t,"importNamespaceSpecifier",t.local),ImportSpecifier:(t,s)=>r(t,"importSpecifier",t.imported,t.local),JsonExpression:(t,s)=>r(t,"jsonExpression",JSON.stringify(t.body)),Literal:(t,s)=>r(t,"literal",t.value),LogicalExpression:(t,s)=>r(t,"logicalExpression",t.operator,t.left,t.right),MemberExpression:(t,s)=>r(t,"memberExpression",t.object,t.property,t.computed||void 0,t.optional||void 0),NewExpression:(t,s)=>r(t,"newExpression",t.callee,t.arguments),ObjectExpression:(t,s)=>r(t,"objectExpression",t.properties),ObjectPattern:(t,s)=>r(t,"objectPattern",t.properties),Program:(t,s)=>r(t,"program",t.body),Property:(t,s)=>{if(s.type==="ObjectPattern")return r(t,"assignmentProperty",t.key,t.value,t.shorthand||void 0);if(s.type==="ObjectExpression")return r(t,"property",t.key,t.value,t.shorthand||void 0,t.computed||void 0)},ReturnStatement:(t,s)=>r(t,"returnStatement",t.argument),SwitchCase:(t,s)=>r(t,"switchCase",t.test,t.consequent),SwitchStatement:(t,s)=>r(t,"switchStatement",t.discriminant,t.cases),TemplateElement:(t,s)=>t.tail?r(t,"templateElement",new n(JSON.stringify(t.value)),true):r(t,"templateElement",new n(JSON.stringify(t.value))),TemplateLiteral:(t,s)=>r(t,"templateLiteral",t.quasis,t.expressions),ThrowStatement:(t,s)=>r(t,"throwStatement",t.argument),TryStatement:(t,s)=>r(t,"tryStatement",t.block,t.handler,t.finalizer),UnaryExpression:(t,s)=>r(t,"unaryExpression",t.operator,t.argument),UpdateExpression:(t,s)=>t.prefix==true?r(t,"updateExpression",t.operator,t.argument,true):r(t,"updateExpression",t.operator,t.argument),VariableDeclaration:(t,s)=>r(t,"variableDeclaration",t.kind,t.declarations),VariableDeclarator:(t,s)=>r(t,"variableDeclarator",t.id,t.init||void 0),WhileStatement:(t,s)=>r(t,"whileStatement",t.test,t.body),SpreadElement:(t,s)=>r(t,"spreadElement",t.argument),RestElement:(t,s)=>r(t,"restElement",t.argument)};return {build:a,buildFunction:p,safeEval:i,builders:l}};var I={};a(I,{isArrayExpression:()=>ce,isArrayPattern:()=>Ce,isArrowFunctionExpression:()=>oe,isAssignmentExpression:()=>xe,isAssignmentProperty:()=>Ge,isAwaitExpression:()=>de,isBinaryExpression:()=>ne,isBlockStatement:()=>be,isBreakStatement:()=>Ne,isCallExpression:()=>ae,isCatchClause:()=>Re,isConditionalExpression:()=>le,isContinueStatement:()=>he,isDirective:()=>ze,isDoWhileStatement:()=>Ve,isEmptyStatement:()=>we,isExpressionStatement:()=>Ae,isForInStatement:()=>Je,isForOfStatement:()=>Le,isForStatement:()=>Be,isFunctionDeclaration:()=>Fe,isFunctionExpression:()=>ie,isIdentifier:()=>se,isIfStatement:()=>Te,isImportDeclaration:()=>We,isImportDefaultSpecifier:()=>Ke,isImportNamespaceSpecifier:()=>qe,isImportSpecifier:()=>Ue,isJsonExpression:()=>Ee,isLiteral:()=>re,isLogicalExpression:()=>ye,isMemberExpression:()=>fe,isModuleDeclaration:()=>Ye,isNewExpression:()=>Se,isNode:()=>Ze,isObjectExpression:()=>pe,isObjectPattern:()=>De,isProgram:()=>Pe,isProperty:()=>P,isReturnStatement:()=>ge,isSwitchCase:()=>Oe,isSwitchStatement:()=>Ie,isTemplateElement:()=>ve,isTemplateLiteral:()=>Me,isThrowStatement:()=>$e,isTryStatement:()=>Xe,isUnaryExpression:()=>me,isUpdateExpression:()=>ue,isVariableDeclaration:()=>_e,isVariableDeclarator:()=>ke,isWhileStatement:()=>je});var _=e=>typeof e=="object"&&e!==null&&typeof e.type=="string",Q=h;function f(e,n){let a=Q[e.type],p=e,i=(r,l)=>{if(r!=null)if(Array.isArray(r))for(let t=0;t<r.length;t++)_(r[t])&&n(r[t],l,t);else _(r)&&n(r,l,null);};if(a){for(let r of a)i(p[r],r);return}for(let r in p)Object.prototype.hasOwnProperty.call(p,r)&&i(p[r],r);}function D(e){let n=[];return f(e,a=>n.push(a)),n}function x(e,n){let a=false;function p(i,r){if(!i||a)return;let l=n[i.type]??n["*"],t=false;if(l){let s=l(i,r);if(s===false&&(t=true),s==="break"){a=true;return}}t||f(i,s=>{a||p(s,i);});}p(e,null);}var ee=new Proxy({fn:{}},{get(e,n){return {type:"Identifier",name:n}}}),o=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function C(e,n){let a;return x(e,{"*":p=>{if(n(p))return a=p,"break"}}),a}function F(e,n,a){let p=i=>{if(n(i))return a(i);if(Array.isArray(i)){let r=false,l=i.map(t=>{let s=p(t);return s!==t&&(r=true),s});return r?l:i}if(o(i)){let r=false,l={};for(let t in i){let s=i[t],m=p(s);l[t]=m,m!==s&&(r=true);}return r?l:i}return i};return p(e)}function te(e,n){let a={};return n.forEach(p=>{p in e&&(a[p]=e[p]);}),a}var re=e=>e?.type==="Literal"&&"value"in e,se=e=>e?.type==="Identifier"&&typeof e.name=="string",ne=e=>e?.type==="BinaryExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",oe=e=>e?.type==="ArrowFunctionExpression"&&o(e.body),ie=e=>e?.type==="FunctionExpression"&&o(e.body),ae=e=>e?.type==="CallExpression"&&o(e.callee)&&Array.isArray(e.arguments),pe=e=>e?.type==="ObjectExpression"&&Array.isArray(e.properties),ce=e=>e?.type==="ArrayExpression"&&Array.isArray(e.elements),le=e=>e?.type==="ConditionalExpression"&&o(e.test)&&o(e.consequent)&&o(e.alternate),ye=e=>e?.type==="LogicalExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",me=e=>e?.type==="UnaryExpression"&&typeof e.operator=="string"&&o(e.argument),ue=e=>e?.type==="UpdateExpression"&&typeof e.operator=="string"&&o(e.argument),fe=e=>e?.type==="MemberExpression"&&o(e.object)&&o(e.property),xe=e=>e?.type==="AssignmentExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",de=e=>e?.type==="AwaitExpression"&&"argument"in e,Se=e=>e?.type==="NewExpression"&&o(e.callee)&&Array.isArray(e.arguments),Ee=e=>e?.type==="JsonExpression"&&o(e.body),Ae=e=>e?.type==="ExpressionStatement"&&o(e.expression),be=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),ge=e=>e?.type==="ReturnStatement",Te=e=>e?.type==="IfStatement"&&o(e.test)&&o(e.consequent),Ne=e=>e?.type==="BreakStatement",he=e=>e?.type==="ContinueStatement",we=e=>e?.type==="EmptyStatement",ke=e=>e?.type==="VariableDeclarator"&&o(e.id),_e=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),De=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),Ce=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),Fe=e=>e?.type==="FunctionDeclaration"&&o(e.id)&&o(e.body),Pe=e=>e?.type==="Program"&&Array.isArray(e.body),Ie=e=>e?.type==="SwitchStatement"&&o(e.discriminant)&&Array.isArray(e.cases),Oe=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),je=e=>e?.type==="WhileStatement"&&o(e.test)&&o(e.body),Be=e=>e?.type==="ForStatement"&&"body"in e,Je=e=>e?.type==="ForInStatement"&&o(e.left)&&o(e.right)&&o(e.body),Le=e=>e?.type==="ForOfStatement"&&o(e.left)&&o(e.right)&&o(e.body),Ve=e=>e?.type==="DoWhileStatement"&&o(e.body)&&o(e.test),Xe=e=>e?.type==="TryStatement"&&o(e.block),Re=e=>e?.type==="CatchClause"&&o(e.body),$e=e=>e?.type==="ThrowStatement"&&o(e.argument),ve=e=>e?.type==="TemplateElement"&&o(e.value),Me=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),We=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&o(e.source),Ue=e=>e?.type==="ImportSpecifier"&&o(e.imported)&&o(e.local),Ke=e=>e?.type==="ImportDefaultSpecifier"&&o(e.local),qe=e=>e?.type==="ImportNamespaceSpecifier"&&o(e.local),Ye=e=>e?.type==="ModuleDeclaration",ze=e=>e?.type==="Directive",P=e=>e?.type==="Property"&&o(e.key)&&o(e.value),Ge=e=>P(e),Ze=e=>typeof e?.type=="string";var He="createElement",Qe="Fragment";function c(e,n){return n.start!==void 0&&(e.start=n.start),n.end!==void 0&&(e.end=n.end),n.loc!==void 0&&(e.loc=n.loc),n.range!==void 0&&(e.range=n.range),e}var et=e=>/^[a-zA-Z_$][\w$]*$/.test(e);function O(e){return e.type==="JSXIdentifier"?c(/^[a-z]/.test(e.name)||e.name.includes("-")?n(e.name):m(e.name),e):e.type==="JSXNamespacedName"?c(n(`${e.namespace.name}:${e.name.name}`),e):c(u(O(e.object),c(m(e.property.name),e.property)),e)}function tt(e){return e.type==="JSXNamespacedName"?c(n(`${e.namespace.name}:${e.name.name}`),e):c(et(e.name)?m(e.name):n(e.name),e)}function rt(e,n$1){return e===null?c(n(true),n$1):e.type==="JSXExpressionContainer"?e.expression:e}var j=(e,n$1)=>c(n$1.emptyPropsAsObject?p([]):n(null),e);function st(e,n,a){if(e.length===0)return j(n,a);let p$1=e.map(i=>i.type==="JSXSpreadAttribute"?c(r(i.argument),i):c(q(tt(i.name),rt(i.value,i)),i));return c(p(p$1),n)}function nt(e){let n=e.split(/\r\n|\n|\r/),a=-1;for(let i=0;i<n.length;i++)/[^ \t]/.test(n[i])&&(a=i);let p="";for(let i=0;i<n.length;i++){let r=n[i].replace(/\t/g," ");i!==0&&(r=r.replace(/^ +/,"")),i!==n.length-1&&(r=r.replace(/ +$/,"")),r&&(i!==a&&(r+=" "),p+=r);}return p===""?null:p}function ot(e){if(e.type==="JSXText"){let n$1=nt(e.value);return n$1===null?null:c(n(n$1),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e}function B(e,n={}){let a=e.type==="JSXFragment"?c(m(Qe),e.openingFragment):O(e.openingElement.name),p=e.type==="JSXFragment"?j(e.openingFragment,n):st(e.openingElement.attributes,e.openingElement,n),i=e.children.map(ot).filter(r=>r!==null);return c(s(c(m(He),e),[a,p,...i]),e)}var J=(e={})=>({vars:e,parent:null}),L=(e,n)=>({vars:n,parent:e});function V(e,n){for(let a=e;a;a=a.parent)if(Object.prototype.hasOwnProperty.call(a.vars,n))return a.vars[n]}function X(e){let n=new Map;for(let a=e;a;a=a.parent)for(let p of Object.keys(a.vars))n.has(p)||n.set(p,a.vars[p]);return n}export{ee as Mock,L as childScope,D as childrenOf,B as desugarJSX,C as find,f as forEachChild,H as generateBuilders,I as guards,o as isObject,V as lookup,F as mutate,te as pick,J as rootScope,X as visibleNames,x as walk};
1
+ import {a,g,l,r,b,Ba,m,t,o as o$1,q,p}from'./chunk-ZEL34C7U.js';export{i as BinaryPrecedence,h as Precedence,b as TSLiteError,d as VALID_EXPRESSION_ENTRY_TYPES,c as VALID_OBJECT_KEY,g as VisitorKeys,j as expr,k as fromExprMarker,f as invalidExpressionEntryError,e as isValidExpressionEntryType,Aa as json,ea as jsonExpression}from'./chunk-ZEL34C7U.js';var Z=(e="b")=>{class s{constructor(n){this.text=n;}}let a=(t,n)=>{if(typeof t!="object")return typeof t=="string"?`"${t}"`:typeof t=="bigint"?`${t}n`:String(t);if(!t)return "null";if(t instanceof RegExp)return t;if(Array.isArray(t))return `[${t.map(m=>a(m,n)).join(", ")}]`;if(!t.type)return t instanceof s?t.text:`${e}.jsonExpression(${JSON.stringify(t)})`;if(t.type in l)return l[t.type](t,n);throw new b("unknown-node-type","Unknown type: "+t.type,{type:t.type})},p=t=>`(${e}) => ${a(t)}`,i=t=>new Function("b",`return ${t}`)(Ba),r=(t,n,...m)=>{let d=[],A=false;return m.reverse().forEach(T=>{T===void 0?A&&d.push("false"):(d.push(a(T,t)),A=true);}),`${e}.${n}(${d.reverse().join(", ")})`},l={ArrayExpression:(t,n)=>r(t,"arrayExpression",t.elements),ArrayPattern:(t,n)=>r(t,"arrayPattern",t.elements),ArrowFunctionExpression:(t,n)=>r(t,"arrowFunctionExpression",t.params,t.body,t.async||void 0),AssignmentExpression:(t,n)=>r(t,"assignmentExpression",t.operator,t.left,t.right),AssignmentProperty:(t,n)=>r(t,"assignmentProperty",t.key,t.value||void 0,t.shorthand||void 0),AwaitExpression:(t,n)=>r(t,"awaitExpression",t.argument),BinaryExpression:(t,n)=>r(t,"binaryExpression",t.operator,t.left,t.right),BlockStatement:(t,n)=>r(t,"blockStatement",t.body),BreakStatement:(t,n)=>t.label?r(t,"breakStatement",t.label):r(t,"breakStatement"),CallExpression:(t,n)=>r(t,"callExpression",t.callee,t.arguments,t.optional||void 0),CatchClause:(t,n)=>r(t,"catchClause",t.param,t.body),ChainExpression:(t,n)=>r(t,"chainExpression",t.expression),ConditionalExpression:(t,n)=>r(t,"conditionalExpression",t.test,t.consequent,t.alternate),ContinueStatement:(t,n)=>r(t,"continueStatement",t.label),DoWhileStatement:(t,n)=>r(t,"doWhileStatement",t.body,t.test),EmptyStatement:(t,n)=>r(t,"emptyStatement"),ExpressionStatement:(t,n)=>r(t,"expressionStatement",t.expression),ForInStatement:(t,n)=>r(t,"forInStatement",t.left,t.right,t.body),ForOfStatement:(t,n)=>r(t,"forOfStatement",t.left,t.right,t.body),ForStatement:(t,n)=>r(t,"forStatement",t.init,t.test,t.update,t.body),FunctionDeclaration:(t,n)=>r(t,"functionDeclaration",t.id,t.params,t.body,t.generator||void 0,t.async||void 0),FunctionExpression:(t,n)=>r(t,"functionExpression",t.id||null,t.params,t.body,t.generator||void 0,t.async||void 0),Identifier:(t,n)=>r(t,"identifier",t.name),IfStatement:(t,n)=>r(t,"ifStatement",t.test,t.consequent,t.alternate),ImportDeclaration:(t,n)=>r(t,"importDeclaration",t.specifiers,t.source),ImportDefaultSpecifier:(t,n)=>r(t,"importDefaultSpecifier",t.local),ImportNamespaceSpecifier:(t,n)=>r(t,"importNamespaceSpecifier",t.local),ImportSpecifier:(t,n)=>r(t,"importSpecifier",t.imported,t.local),JsonExpression:(t,n)=>r(t,"jsonExpression",JSON.stringify(t.body)),Literal:(t,n)=>r(t,"literal",t.value),LogicalExpression:(t,n)=>r(t,"logicalExpression",t.operator,t.left,t.right),MemberExpression:(t,n)=>r(t,"memberExpression",t.object,t.property,t.computed||void 0,t.optional||void 0),NewExpression:(t,n)=>r(t,"newExpression",t.callee,t.arguments),ObjectExpression:(t,n)=>r(t,"objectExpression",t.properties),ObjectPattern:(t,n)=>r(t,"objectPattern",t.properties),Program:(t,n)=>r(t,"program",t.body),Property:(t,n)=>{if(n.type==="ObjectPattern")return r(t,"assignmentProperty",t.key,t.value,t.shorthand||void 0);if(n.type==="ObjectExpression")return r(t,"property",t.key,t.value,t.shorthand||void 0,t.computed||void 0)},ReturnStatement:(t,n)=>r(t,"returnStatement",t.argument),SwitchCase:(t,n)=>r(t,"switchCase",t.test,t.consequent),SwitchStatement:(t,n)=>r(t,"switchStatement",t.discriminant,t.cases),TemplateElement:(t,n)=>t.tail?r(t,"templateElement",new s(JSON.stringify(t.value)),true):r(t,"templateElement",new s(JSON.stringify(t.value))),TemplateLiteral:(t,n)=>r(t,"templateLiteral",t.quasis,t.expressions),ThrowStatement:(t,n)=>r(t,"throwStatement",t.argument),TryStatement:(t,n)=>r(t,"tryStatement",t.block,t.handler,t.finalizer),UnaryExpression:(t,n)=>r(t,"unaryExpression",t.operator,t.argument),UpdateExpression:(t,n)=>t.prefix==true?r(t,"updateExpression",t.operator,t.argument,true):r(t,"updateExpression",t.operator,t.argument),VariableDeclaration:(t,n)=>r(t,"variableDeclaration",t.kind,t.declarations),VariableDeclarator:(t,n)=>r(t,"variableDeclarator",t.id,t.init||void 0),WhileStatement:(t,n)=>r(t,"whileStatement",t.test,t.body),SpreadElement:(t,n)=>r(t,"spreadElement",t.argument),RestElement:(t,n)=>r(t,"restElement",t.argument)};return {build:a,buildFunction:p,safeEval:i,builders:l}};var I={};a(I,{isArrayExpression:()=>pe,isArrayPattern:()=>De,isArrowFunctionExpression:()=>se,isAssignmentExpression:()=>fe,isAssignmentProperty:()=>ze,isAwaitExpression:()=>xe,isBinaryExpression:()=>ne,isBlockStatement:()=>be,isBreakStatement:()=>Te,isCallExpression:()=>ie,isCatchClause:()=>Ve,isConditionalExpression:()=>ce,isContinueStatement:()=>Ne,isDirective:()=>Ye,isDoWhileStatement:()=>Le,isEmptyStatement:()=>he,isExpressionStatement:()=>Ee,isForInStatement:()=>Be,isForOfStatement:()=>Je,isForStatement:()=>je,isFunctionDeclaration:()=>Ce,isFunctionExpression:()=>oe,isIdentifier:()=>re,isIfStatement:()=>Ae,isImportDeclaration:()=>Me,isImportDefaultSpecifier:()=>Ue,isImportNamespaceSpecifier:()=>Ke,isImportSpecifier:()=>We,isJsonExpression:()=>Se,isLiteral:()=>te,isLogicalExpression:()=>le,isMemberExpression:()=>ue,isModuleDeclaration:()=>qe,isNewExpression:()=>de,isNode:()=>Ge,isObjectExpression:()=>ae,isObjectPattern:()=>_e,isProgram:()=>Pe,isProperty:()=>F,isReturnStatement:()=>ge,isSwitchCase:()=>Ie,isSwitchStatement:()=>Fe,isTemplateElement:()=>$e,isTemplateLiteral:()=>ve,isThrowStatement:()=>Re,isTryStatement:()=>Xe,isUnaryExpression:()=>ye,isUpdateExpression:()=>me,isVariableDeclaration:()=>ke,isVariableDeclarator:()=>we,isWhileStatement:()=>Oe});var _=e=>typeof e=="object"&&e!==null&&typeof e.type=="string",H=g;function f(e,s){let a=H[e.type],p=e,i=(r,l)=>{if(r!=null)if(Array.isArray(r))for(let t=0;t<r.length;t++)_(r[t])&&s(r[t],l,t);else _(r)&&s(r,l,null);};if(a){for(let r of a)i(p[r],r);return}for(let r in p)Object.prototype.hasOwnProperty.call(p,r)&&i(p[r],r);}function D(e){let s=[];return f(e,a=>s.push(a)),s}function x(e,s){let a=false;function p(i,r){if(!i||a)return;let l=s[i.type]??s["*"],t=false;if(l){let n=l(i,r);if(n===false&&(t=true),n==="break"){a=true;return}}t||f(i,n=>{a||p(n,i);});}p(e,null);}var Q=new Proxy({fn:{}},{get(e,s){return {type:"Identifier",name:s}}}),o=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function C(e,s){let a;return x(e,{"*":p=>{if(s(p))return a=p,"break"}}),a}function P(e,s,a){let p=i=>{if(s(i))return a(i);if(Array.isArray(i)){let r=false,l=i.map(t=>{let n=p(t);return n!==t&&(r=true),n});return r?l:i}if(o(i)){let r=false,l={};for(let t in i){let n=i[t],m=p(n);l[t]=m,m!==n&&(r=true);}return r?l:i}return i};return p(e)}function ee(e,s){let a={};return s.forEach(p=>{p in e&&(a[p]=e[p]);}),a}var te=e=>e?.type==="Literal"&&"value"in e,re=e=>e?.type==="Identifier"&&typeof e.name=="string",ne=e=>e?.type==="BinaryExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",se=e=>e?.type==="ArrowFunctionExpression"&&o(e.body),oe=e=>e?.type==="FunctionExpression"&&o(e.body),ie=e=>e?.type==="CallExpression"&&o(e.callee)&&Array.isArray(e.arguments),ae=e=>e?.type==="ObjectExpression"&&Array.isArray(e.properties),pe=e=>e?.type==="ArrayExpression"&&Array.isArray(e.elements),ce=e=>e?.type==="ConditionalExpression"&&o(e.test)&&o(e.consequent)&&o(e.alternate),le=e=>e?.type==="LogicalExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",ye=e=>e?.type==="UnaryExpression"&&typeof e.operator=="string"&&o(e.argument),me=e=>e?.type==="UpdateExpression"&&typeof e.operator=="string"&&o(e.argument),ue=e=>e?.type==="MemberExpression"&&o(e.object)&&o(e.property),fe=e=>e?.type==="AssignmentExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",xe=e=>e?.type==="AwaitExpression"&&"argument"in e,de=e=>e?.type==="NewExpression"&&o(e.callee)&&Array.isArray(e.arguments),Se=e=>e?.type==="JsonExpression"&&o(e.body),Ee=e=>e?.type==="ExpressionStatement"&&o(e.expression),be=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),ge=e=>e?.type==="ReturnStatement",Ae=e=>e?.type==="IfStatement"&&o(e.test)&&o(e.consequent),Te=e=>e?.type==="BreakStatement",Ne=e=>e?.type==="ContinueStatement",he=e=>e?.type==="EmptyStatement",we=e=>e?.type==="VariableDeclarator"&&o(e.id),ke=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),_e=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),De=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),Ce=e=>e?.type==="FunctionDeclaration"&&o(e.id)&&o(e.body),Pe=e=>e?.type==="Program"&&Array.isArray(e.body),Fe=e=>e?.type==="SwitchStatement"&&o(e.discriminant)&&Array.isArray(e.cases),Ie=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),Oe=e=>e?.type==="WhileStatement"&&o(e.test)&&o(e.body),je=e=>e?.type==="ForStatement"&&"body"in e,Be=e=>e?.type==="ForInStatement"&&o(e.left)&&o(e.right)&&o(e.body),Je=e=>e?.type==="ForOfStatement"&&o(e.left)&&o(e.right)&&o(e.body),Le=e=>e?.type==="DoWhileStatement"&&o(e.body)&&o(e.test),Xe=e=>e?.type==="TryStatement"&&o(e.block),Ve=e=>e?.type==="CatchClause"&&o(e.body),Re=e=>e?.type==="ThrowStatement"&&o(e.argument),$e=e=>e?.type==="TemplateElement"&&o(e.value),ve=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),Me=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&o(e.source),We=e=>e?.type==="ImportSpecifier"&&o(e.imported)&&o(e.local),Ue=e=>e?.type==="ImportDefaultSpecifier"&&o(e.local),Ke=e=>e?.type==="ImportNamespaceSpecifier"&&o(e.local),qe=e=>e?.type==="ModuleDeclaration",Ye=e=>e?.type==="Directive",F=e=>e?.type==="Property"&&o(e.key)&&o(e.value),ze=e=>F(e),Ge=e=>typeof e?.type=="string";var Ze="createElement",He="Fragment";function c(e,s){return s.start!==void 0&&(e.start=s.start),s.end!==void 0&&(e.end=s.end),s.loc!==void 0&&(e.loc=s.loc),s.range!==void 0&&(e.range=s.range),e}var Qe=e=>/^[a-zA-Z_$][\w$]*$/.test(e);function O(e){return e.type==="JSXIdentifier"?c(/^[a-z]/.test(e.name)||e.name.includes("-")?m(e.name):l(e.name),e):e.type==="JSXNamespacedName"?c(m(`${e.namespace.name}:${e.name.name}`),e):c(t(O(e.object),c(l(e.property.name),e.property)),e)}function et(e){return e.type==="JSXNamespacedName"?c(m(`${e.namespace.name}:${e.name.name}`),e):c(Qe(e.name)?l(e.name):m(e.name),e)}function tt(e,s){return e===null?c(m(true),s):e.type==="JSXExpressionContainer"?e.expression:e}var j=(e,s)=>c(s.emptyPropsAsObject?o$1([]):m(null),e);function rt(e,s,a){if(e.length===0)return j(s,a);let p$1=e.map(i=>i.type==="JSXSpreadAttribute"?c(q(i.argument),i):c(p(et(i.name),tt(i.value,i)),i));return c(o$1(p$1),s)}function nt(e){let s=e.split(/\r\n|\n|\r/),a=-1;for(let i=0;i<s.length;i++)/[^ \t]/.test(s[i])&&(a=i);let p="";for(let i=0;i<s.length;i++){let r=s[i].replace(/\t/g," ");i!==0&&(r=r.replace(/^ +/,"")),i!==s.length-1&&(r=r.replace(/ +$/,"")),r&&(i!==a&&(r+=" "),p+=r);}return p===""?null:p}function st(e){if(e.type==="JSXText"){let s=nt(e.value);return s===null?null:c(m(s),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e}function B(e,s={}){let a=e.type==="JSXFragment"?c(l(He),e.openingFragment):O(e.openingElement.name),p=e.type==="JSXFragment"?j(e.openingFragment,s):rt(e.openingElement.attributes,e.openingElement,s),i=e.children.map(st).filter(r=>r!==null);return c(r(c(l(Ze),e),[a,p,...i]),e)}var J=(e={})=>({vars:e,parent:null}),L=(e,s)=>({vars:s,parent:e});function X(e,s){for(let a=e;a;a=a.parent)if(Object.prototype.hasOwnProperty.call(a.vars,s))return a.vars[s]}function V(e){let s=new Map;for(let a=e;a;a=a.parent)for(let p of Object.keys(a.vars))s.has(p)||s.set(p,a.vars[p]);return s}export{Q as Mock,L as childScope,D as childrenOf,B as desugarJSX,C as find,f as forEachChild,Z as generateBuilders,I as guards,o as isObject,X as lookup,P as mutate,ee as pick,J as rootScope,V as visibleNames,x as walk};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tslite/core",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "TSLite core — ESTree types, constants, guards, builders and AST utilities (the foundation)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- var S=Object.defineProperty;var y=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:true});};var Fe={};y(Fe,{arrayExpression:()=>b,arrayPattern:()=>se,arrowFunctionExpression:()=>R,assignmentExpression:()=>O,assignmentPattern:()=>le,assignmentProperty:()=>ae,ast:()=>d,awaitExpression:()=>L,binaryExpression:()=>I,blockStatement:()=>V,breakStatement:()=>$,callExpression:()=>C,catchClause:()=>K,chainExpression:()=>w,conditionalExpression:()=>N,continueStatement:()=>z,doWhileStatement:()=>ne,emptyStatement:()=>Z,exportDefaultDeclaration:()=>de,exportNamedDeclaration:()=>ye,exportSpecifier:()=>ue,expressionStatement:()=>v,forInStatement:()=>Q,forOfStatement:()=>ee,forStatement:()=>G,fromAstMarker:()=>u,functionDeclaration:()=>M,functionExpression:()=>j,identifier:()=>g,ifStatement:()=>U,importDeclaration:()=>xe,importDefaultSpecifier:()=>Ee,importNamespaceSpecifier:()=>Se,importSpecifier:()=>ce,json:()=>Pe,jsonExpression:()=>x,jsxAttribute:()=>Ce,jsxClosingElement:()=>De,jsxClosingFragment:()=>E,jsxElement:()=>Ie,jsxEmptyExpression:()=>Ae,jsxExpressionContainer:()=>Je,jsxFragment:()=>Te,jsxIdentifier:()=>ge,jsxMemberExpression:()=>fe,jsxNamespacedName:()=>be,jsxOpeningElement:()=>he,jsxOpeningFragment:()=>c,jsxSpreadAttribute:()=>Xe,jsxText:()=>we,literal:()=>f,logicalExpression:()=>T,memberExpression:()=>D,newExpression:()=>h,objectExpression:()=>A,objectPattern:()=>oe,program:()=>me,property:()=>J,restElement:()=>pe,returnStatement:()=>q,spreadElement:()=>X,switchCase:()=>W,switchStatement:()=>_,templateElement:()=>k,templateLiteral:()=>B,throwStatement:()=>Y,tryStatement:()=>H,unaryExpression:()=>P,updateExpression:()=>F,variableDeclaration:()=>re,variableDeclarator:()=>ie,whileStatement:()=>te});var o=class extends Error{constructor(t,n,i){super(n),this.name="TSLiteError",this.code=t,this.details=i;}};var s="#ast",ke=/^[a-zA-Z_][a-zA-Z_0-9]*$/,p=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","FunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","NewExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","TaggedTemplateExpression","SequenceExpression","ChainExpression","JSXElement","JSXFragment","Program"];function l(e){return p.includes(e)}function m(e){return new o("invalid-ast-entry",`Invalid #ast entry type: "${e}". The #ast marker is used to embed executable logic inside JSON. Only expression types that can be used as VALUES are allowed: ${p.join(", ")}. "${e}" is not a valid entry point because it cannot be used as a value in JSON.`,{type:e,validTypes:p})}var Be={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportExpression:["source"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],JsonExpression:[],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],JSXElement:["openingElement","children","closingElement"],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningElement:["name","attributes"],JSXClosingElement:["name"],JSXOpeningFragment:[],JSXClosingFragment:[],JSXAttribute:["name","value"],JSXSpreadAttribute:["argument"],JSXExpressionContainer:["expression"],JSXEmptyExpression:[],JSXText:[],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"]},r={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,Coalesce:3,LogicalOR:4,LogicalAND:5,BitwiseOR:6,BitwiseXOR:7,BitwiseAND:8,Equality:9,Relational:10,BitwiseSHIFT:11,Additive:12,Multiplicative:13,Exponentiation:14,Await:15,Unary:15,Postfix:16,OptionalChaining:17,Call:18,New:19,TaggedTemplate:20,Member:21,Primary:22},Re={"??":r.Coalesce,"||":r.LogicalOR,"&&":r.LogicalAND,"|":r.BitwiseOR,"^":r.BitwiseXOR,"&":r.BitwiseAND,"==":r.Equality,"!=":r.Equality,"===":r.Equality,"!==":r.Equality,is:r.Equality,isnt:r.Equality,"<":r.Relational,">":r.Relational,"<=":r.Relational,">=":r.Relational,in:r.Relational,instanceof:r.Relational,"<<":r.BitwiseSHIFT,">>":r.BitwiseSHIFT,">>>":r.BitwiseSHIFT,"+":r.Additive,"-":r.Additive,"*":r.Multiplicative,"%":r.Multiplicative,"/":r.Multiplicative,"**":r.Exponentiation};var d=e=>{let{type:t,...n}=e;if(!t||typeof t!="string")throw new o("missing-node-type","ast() requires a node with a valid type property");if(!l(t))throw m(t);return {[s]:t,...n}},u=e=>{if(!e||typeof e!="object"||!(s in e))return e;let{[s]:t,...n}=e;return {type:t,...n}},g=e=>({type:"Identifier",name:e}),f=e=>e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:{type:"Literal",value:e},b=e=>({type:"ArrayExpression",elements:e}),A=e=>({type:"ObjectExpression",properties:e}),J=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),X=e=>({type:"SpreadElement",argument:e}),C=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),h=(e,t)=>({type:"NewExpression",callee:e,arguments:t}),D=(e,t,n=false,i=false)=>({type:"MemberExpression",object:e,property:t,computed:n,optional:i}),w=e=>({type:"ChainExpression",expression:e}),I=(e,t,n)=>({type:"BinaryExpression",left:t,right:n,operator:e}),T=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),P=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),F=(e,t,n=false)=>({type:"UpdateExpression",operator:e,argument:t,prefix:n}),O=(e,t,n)=>({type:"AssignmentExpression",operator:e,left:t,right:n}),N=(e,t,n)=>({type:"ConditionalExpression",test:e,consequent:t,alternate:n}),L=e=>({type:"AwaitExpression",argument:e}),k=(e,t=false)=>({type:"TemplateElement",value:e,tail:t}),B=(e,t)=>({type:"TemplateLiteral",quasis:e,expressions:t}),R=(e,t,n=false,i=false)=>({type:"ArrowFunctionExpression",expression:t.type!="BlockStatement",generator:i,async:n,params:e,body:t}),j=(e=null,t,n,i=false,a=false)=>({type:"FunctionExpression",id:e,params:t,body:n,async:i,generator:a}),M=(e,t,n,i=false,a=false)=>({type:"FunctionDeclaration",id:e,params:t,body:n,generator:i,async:a}),V=e=>({type:"BlockStatement",body:e}),v=e=>({type:"ExpressionStatement",expression:e}),q=e=>({type:"ReturnStatement",argument:e}),U=(e,t,n=null)=>({type:"IfStatement",test:e,consequent:t,alternate:n}),_=(e,t)=>({type:"SwitchStatement",cases:t,discriminant:e}),W=(e,t)=>({type:"SwitchCase",consequent:t,test:e}),Y=e=>({type:"ThrowStatement",argument:e}),H=(e,t,n=null)=>({type:"TryStatement",block:e,handler:t,finalizer:n}),K=(e,t)=>({type:"CatchClause",param:e,body:t}),$=(e=null)=>({type:"BreakStatement",label:e}),z=(e=null)=>({type:"ContinueStatement",label:e}),Z=()=>({type:"EmptyStatement"}),G=(e,t,n,i)=>({type:"ForStatement",init:e,test:t,update:n,body:i}),Q=(e,t,n)=>({type:"ForInStatement",body:n,left:e,right:t}),ee=(e,t,n,i=false)=>({type:"ForOfStatement",body:n,left:e,right:t,await:i}),te=(e,t)=>({type:"WhileStatement",test:e,body:t}),ne=(e,t)=>({type:"DoWhileStatement",body:e,test:t}),re=(e,t)=>({type:"VariableDeclaration",declarations:t,kind:e}),ie=(e,t=null)=>({type:"VariableDeclarator",id:e,init:t}),oe=e=>({type:"ObjectPattern",properties:e}),se=e=>({type:"ArrayPattern",elements:e}),ae=(e,t=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:t,shorthand:n,computed:i,method:false}),pe=e=>({type:"RestElement",argument:e}),le=(e,t)=>({type:"AssignmentPattern",left:e,right:t}),me=(e,t="script")=>({type:"Program",body:e,sourceType:t}),x=e=>({type:"JsonExpression",body:e}),xe=(e,t)=>({type:"ImportDeclaration",specifiers:e,source:t}),ce=(e,t)=>({type:"ImportSpecifier",imported:e,local:t}),Ee=e=>({type:"ImportDefaultSpecifier",local:e}),Se=e=>({type:"ImportNamespaceSpecifier",local:e}),ye=(e=null,t=[],n=null)=>({type:"ExportNamedDeclaration",declaration:e,specifiers:t,source:n}),de=e=>({type:"ExportDefaultDeclaration",declaration:e}),ue=(e,t=e)=>({type:"ExportSpecifier",local:e,exported:t}),ge=e=>({type:"JSXIdentifier",name:e}),fe=(e,t)=>({type:"JSXMemberExpression",object:e,property:t}),be=(e,t)=>({type:"JSXNamespacedName",namespace:e,name:t}),Ae=()=>({type:"JSXEmptyExpression"}),Je=e=>({type:"JSXExpressionContainer",expression:e}),Xe=e=>({type:"JSXSpreadAttribute",argument:e}),Ce=(e,t=null)=>({type:"JSXAttribute",name:e,value:t}),he=(e,t=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:t,selfClosing:n}),De=e=>({type:"JSXClosingElement",name:e}),c=()=>({type:"JSXOpeningFragment"}),E=()=>({type:"JSXClosingFragment"}),we=(e,t=e)=>({type:"JSXText",value:e,raw:t}),Ie=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),Te=(e=[],t=c(),n=E())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),Pe=x;export{oe as $,O as A,Te as Aa,N as B,Pe as Ba,L as C,Fe as Ca,k as D,B as E,R as F,j as G,M as H,V as I,v as J,q as K,U as L,_ as M,W as N,Y as O,H as P,K as Q,$ as R,z as S,Z as T,G as U,Q as V,ee as W,te as X,ne as Y,re as Z,ie as _,y as a,se as aa,o as b,ae as ba,s as c,pe as ca,ke as d,le as da,p as e,me as ea,l as f,x as fa,m as g,xe as ga,Be as h,ce as ha,r as i,Ee as ia,Re as j,Se as ja,d as k,ye as ka,u as l,de as la,g as m,ue as ma,f as n,ge as na,b as o,fe as oa,A as p,be as pa,J as q,Ae as qa,X as r,Je as ra,C as s,Xe as sa,h as t,Ce as ta,D as u,he as ua,w as v,De as va,I as w,c as wa,T as x,E as xa,P as y,we as ya,F as z,Ie as za};