@tslite/core 0.8.0 → 0.8.2
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 +1 -1
- package/dist/builders.d.cts +1 -1
- package/dist/builders.d.ts +1 -1
- package/dist/builders.js +1 -1
- package/dist/chunk-CW4CTN3N.js +1 -0
- package/dist/{index-BIjY0ZP4.d.cts → index-BNiyDL0x.d.cts} +35 -4
- package/dist/{index-BIjY0ZP4.d.ts → index-BNiyDL0x.d.ts} +35 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KFFODSKH.js +0 -1
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 a=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","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 of the Language 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 J=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}},X=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":t,...n}=e;return {type:t,...n}},
|
|
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","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","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 of the Language 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 J=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}},X=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":t,...n}=e;return {type:t,...n}},C=e=>({type:"Identifier",name:e}),h=()=>({type:"Placeholder"});function x(e){return e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:typeof e=="number"&&Number.isFinite(e)&&(e<0||Object.is(e,-0))?m("-",x(-e)):{type:"Literal",value:e}}var A=e=>({type:"ArrayExpression",elements:e}),I=e=>({type:"ObjectExpression",properties:e}),D=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),P=e=>({type:"SpreadElement",argument:e}),w=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),T=(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}),L=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),m=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),N=(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}),U=(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}),v=e=>({type:"BlockStatement",body:e}),_=e=>({type:"ExpressionStatement",expression:e}),W=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}),xe=(e,t=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:t,shorthand:n,computed:i}),me=e=>({type:"RestElement",argument:e}),ce=(e,t)=>({type:"AssignmentPattern",left:e,right:t}),Ee=(e,t="script")=>({type:"Program",body:e,sourceType:t}),c=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}),Ce=(e,t)=>({type:"JSXNamespacedName",namespace:e,name:t}),he=()=>({type:"JSXEmptyExpression"}),Ae=e=>({type:"JSXExpressionContainer",expression:e}),Ie=e=>({type:"JSXSpreadAttribute",argument:e}),De=(e,t=null)=>({type:"JSXAttribute",name:e,value:t}),Pe=(e,t=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:t,selfClosing:n}),we=e=>({type:"JSXClosingElement",name:e}),E=()=>({type:"JSXOpeningFragment"}),S=()=>({type:"JSXClosingFragment"}),Te=e=>({type:"JSXSpreadChild",expression:e}),Fe=(e,t=e)=>({type:"JSXText",value:e,raw:t}),Oe=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),Le=(e=[],t=E(),n=S())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),Ne=c;exports.arrayExpression=A;exports.arrayPattern=le;exports.arrowFunctionExpression=V;exports.assignmentExpression=k;exports.assignmentPattern=ce;exports.assignmentProperty=xe;exports.awaitExpression=R;exports.binaryExpression=O;exports.blockStatement=v;exports.breakStatement=G;exports.callExpression=w;exports.catchClause=Z;exports.chainExpression=F;exports.conditionalExpression=B;exports.continueStatement=Q;exports.doWhileStatement=oe;exports.emptyStatement=ee;exports.exportDefaultDeclaration=fe;exports.exportNamedDeclaration=ge;exports.exportSpecifier=be;exports.expr=J;exports.expressionStatement=_;exports.forInStatement=ne;exports.forOfStatement=re;exports.forStatement=te;exports.fromExprMarker=X;exports.functionDeclaration=q;exports.functionExpression=U;exports.identifier=C;exports.ifStatement=Y;exports.importDeclaration=Se;exports.importDefaultSpecifier=de;exports.importNamespaceSpecifier=ue;exports.importSpecifier=ye;exports.json=Ne;exports.jsonExpression=c;exports.jsxAttribute=De;exports.jsxClosingElement=we;exports.jsxClosingFragment=S;exports.jsxElement=Oe;exports.jsxEmptyExpression=he;exports.jsxExpressionContainer=Ae;exports.jsxFragment=Le;exports.jsxIdentifier=Je;exports.jsxMemberExpression=Xe;exports.jsxNamespacedName=Ce;exports.jsxOpeningElement=Pe;exports.jsxOpeningFragment=E;exports.jsxSpreadAttribute=Ie;exports.jsxSpreadChild=Te;exports.jsxText=Fe;exports.literal=x;exports.logicalExpression=L;exports.memberExpression=T;exports.objectExpression=I;exports.objectPattern=pe;exports.placeholder=h;exports.program=Ee;exports.property=D;exports.restElement=me;exports.returnStatement=W;exports.spreadElement=P;exports.switchCase=$;exports.switchStatement=H;exports.templateElement=j;exports.templateLiteral=M;exports.throwStatement=z;exports.tryStatement=K;exports.unaryExpression=m;exports.updateExpression=N;exports.variableDeclaration=se;exports.variableDeclarator=ae;exports.whileStatement=ie;
|
package/dist/builders.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { cq as arrayExpression, cr as arrayPattern, cs as arrowFunctionExpression, ct as assignmentExpression, cu as assignmentPattern, cv as assignmentProperty, cw as awaitExpression, cx as binaryExpression, cy as blockStatement, cz as breakStatement, cA as callExpression, cB as catchClause, cC as chainExpression, cD as conditionalExpression, cE as continueStatement, cF as doWhileStatement, cG as emptyStatement, cH as exportDefaultDeclaration, cI as exportNamedDeclaration, cJ as exportSpecifier, cl as expr, cK as expressionStatement, cL as forInStatement, cM as forOfStatement, cN as forStatement, cm as fromExprMarker, cO as functionDeclaration, cP as functionExpression, cQ as identifier, cR as ifStatement, cS as importDeclaration, cT as importDefaultSpecifier, cU as importNamespaceSpecifier, cV as importSpecifier, cn as json, co as jsonExpression, cW as jsxAttribute, cX as jsxClosingElement, cY as jsxClosingFragment, cZ as jsxElement, c_ as jsxEmptyExpression, c$ as jsxExpressionContainer, d0 as jsxFragment, d1 as jsxIdentifier, d2 as jsxMemberExpression, d3 as jsxNamespacedName, d4 as jsxOpeningElement, d5 as jsxOpeningFragment, d6 as jsxSpreadAttribute, d7 as jsxSpreadChild, d8 as jsxText, d9 as literal, da as logicalExpression, db as memberExpression, dc as objectExpression, dd as objectPattern, de as placeholder, df as program, dg as property, dh as restElement, di as returnStatement, dj as spreadElement, dk as switchCase, dl as switchStatement, dm as templateElement, dn as templateLiteral, dp as throwStatement, dq as tryStatement, dr as unaryExpression, ds as updateExpression, dt as variableDeclaration, du as variableDeclarator, dv as whileStatement } from './index-BNiyDL0x.cjs';
|
package/dist/builders.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { cq as arrayExpression, cr as arrayPattern, cs as arrowFunctionExpression, ct as assignmentExpression, cu as assignmentPattern, cv as assignmentProperty, cw as awaitExpression, cx as binaryExpression, cy as blockStatement, cz as breakStatement, cA as callExpression, cB as catchClause, cC as chainExpression, cD as conditionalExpression, cE as continueStatement, cF as doWhileStatement, cG as emptyStatement, cH as exportDefaultDeclaration, cI as exportNamedDeclaration, cJ as exportSpecifier, cl as expr, cK as expressionStatement, cL as forInStatement, cM as forOfStatement, cN as forStatement, cm as fromExprMarker, cO as functionDeclaration, cP as functionExpression, cQ as identifier, cR as ifStatement, cS as importDeclaration, cT as importDefaultSpecifier, cU as importNamespaceSpecifier, cV as importSpecifier, cn as json, co as jsonExpression, cW as jsxAttribute, cX as jsxClosingElement, cY as jsxClosingFragment, cZ as jsxElement, c_ as jsxEmptyExpression, c$ as jsxExpressionContainer, d0 as jsxFragment, d1 as jsxIdentifier, d2 as jsxMemberExpression, d3 as jsxNamespacedName, d4 as jsxOpeningElement, d5 as jsxOpeningFragment, d6 as jsxSpreadAttribute, d7 as jsxSpreadChild, d8 as jsxText, d9 as literal, da as logicalExpression, db as memberExpression, dc as objectExpression, dd as objectPattern, de as placeholder, df as program, dg as property, dh as restElement, di as returnStatement, dj as spreadElement, dk as switchCase, dl as switchStatement, dm as templateElement, dn as templateLiteral, dp as throwStatement, dq as tryStatement, dr as unaryExpression, ds as updateExpression, dt as variableDeclaration, du as variableDeclarator, dv as whileStatement } from './index-BNiyDL0x.js';
|
package/dist/builders.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{o 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,s 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,
|
|
1
|
+
export{o 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,s 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,Ba as json,ea as jsonExpression,sa as jsxAttribute,ua as jsxClosingElement,wa as jsxClosingFragment,za as jsxElement,pa as jsxEmptyExpression,qa as jsxExpressionContainer,Aa as jsxFragment,ma as jsxIdentifier,na as jsxMemberExpression,oa as jsxNamespacedName,ta as jsxOpeningElement,va as jsxOpeningFragment,ra as jsxSpreadAttribute,xa as jsxSpreadChild,ya as jsxText,n as literal,w as logicalExpression,t as memberExpression,p as objectExpression,_ as objectPattern,m as placeholder,da as program,q as property,ba as restElement,J as returnStatement,r 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-CW4CTN3N.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var d=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:true});};var Fe={};d(Fe,{arrayExpression:()=>J,arrayPattern:()=>oe,arrowFunctionExpression:()=>B,assignmentExpression:()=>F,assignmentPattern:()=>pe,assignmentProperty:()=>se,awaitExpression:()=>L,binaryExpression:()=>P,blockStatement:()=>M,breakStatement:()=>$,callExpression:()=>A,catchClause:()=>H,chainExpression:()=>D,conditionalExpression:()=>O,continueStatement:()=>z,doWhileStatement:()=>te,emptyStatement:()=>K,exportDefaultDeclaration:()=>ye,exportNamedDeclaration:()=>Se,exportSpecifier:()=>de,expr:()=>u,expressionStatement:()=>V,forInStatement:()=>G,forOfStatement:()=>Q,forStatement:()=>Z,fromExprMarker:()=>g,functionDeclaration:()=>j,functionExpression:()=>R,identifier:()=>f,ifStatement:()=>q,importDeclaration:()=>xe,importDefaultSpecifier:()=>ce,importNamespaceSpecifier:()=>Ee,importSpecifier:()=>me,json:()=>Te,jsonExpression:()=>c,jsxAttribute:()=>Ce,jsxClosingElement:()=>Ae,jsxClosingFragment:()=>S,jsxElement:()=>Pe,jsxEmptyExpression:()=>be,jsxExpressionContainer:()=>Je,jsxFragment:()=>we,jsxIdentifier:()=>ue,jsxMemberExpression:()=>ge,jsxNamespacedName:()=>fe,jsxOpeningElement:()=>he,jsxOpeningFragment:()=>E,jsxSpreadAttribute:()=>Xe,jsxSpreadChild:()=>Ie,jsxText:()=>De,literal:()=>x,logicalExpression:()=>w,memberExpression:()=>I,objectExpression:()=>X,objectPattern:()=>ie,placeholder:()=>b,program:()=>le,property:()=>C,restElement:()=>ae,returnStatement:()=>U,spreadElement:()=>h,switchCase:()=>_,switchStatement:()=>v,templateElement:()=>N,templateLiteral:()=>k,throwStatement:()=>W,tryStatement:()=>Y,unaryExpression:()=>m,updateExpression:()=>T,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 ke=/^[a-zA-Z_][a-zA-Z_0-9]*$/,a=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","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 of the Language 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 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"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],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"],Placeholder:[],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["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"],JSXElement:["openingElement","children","closingElement"],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningElement:["name","attributes"],JSXClosingElement:["name"],JSXOpeningFragment:[],JSXClosingFragment:[],JSXAttribute:["name","value"],JSXSpreadAttribute:["argument"],JSXExpressionContainer:["expression"],JSXSpreadChild:["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},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 u=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}},g=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":t,...n}=e;return {type:t,...n}},f=e=>({type:"Identifier",name:e}),b=()=>({type:"Placeholder"});function x(e){return e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:typeof e=="number"&&Number.isFinite(e)&&(e<0||Object.is(e,-0))?m("-",x(-e)):{type:"Literal",value:e}}var J=e=>({type:"ArrayExpression",elements:e}),X=e=>({type:"ObjectExpression",properties:e}),C=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),h=e=>({type:"SpreadElement",argument:e}),A=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),I=(e,t,n=false,i=false)=>({type:"MemberExpression",object:e,property:t,computed:n,optional:i}),D=e=>({type:"ChainExpression",expression:e}),P=(e,t,n)=>({type:"BinaryExpression",left:t,right:n,operator:e}),w=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),m=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),T=(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}),L=e=>({type:"AwaitExpression",argument:e}),N=(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}),U=e=>({type:"ReturnStatement",argument:e}),q=(e,t,n=null)=>({type:"IfStatement",test:e,consequent:t,alternate:n}),v=(e,t)=>({type:"SwitchStatement",cases:t,discriminant:e}),_=(e,t)=>({type:"SwitchCase",consequent:t,test:e}),W=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}),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}),c=e=>({type:"JsonExpression",body:e}),xe=(e,t)=>({type:"ImportDeclaration",specifiers:e,source:t}),me=(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}),Ce=(e,t=null)=>({type:"JSXAttribute",name:e,value:t}),he=(e,t=[],n=false)=>({type:"JSXOpeningElement",name:e,attributes:t,selfClosing:n}),Ae=e=>({type:"JSXClosingElement",name:e}),E=()=>({type:"JSXOpeningFragment"}),S=()=>({type:"JSXClosingFragment"}),Ie=e=>({type:"JSXSpreadChild",expression:e}),De=(e,t=e)=>({type:"JSXText",value:e,raw:t}),Pe=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),we=(e=[],t=E(),n=S())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),Te=c;export{oe as $,O as A,we as Aa,L as B,Te as Ba,N as C,Fe as Ca,k as D,B as E,R as F,j as G,M as H,V as I,U as J,q as K,v as L,_ as M,W 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 _,d as a,se as aa,o as b,ae as ba,ke as c,pe as ca,a as d,le as da,p as e,c as ea,l as f,xe as fa,Be as g,me as ga,r as h,ce as ha,Re as i,Ee as ia,u as j,Se as ja,g as k,ye as ka,f as l,de as la,b as m,ue as ma,x as n,ge as na,J as o,fe as oa,X as p,be as pa,C as q,Je as qa,h as r,Xe as ra,A as s,Ce as sa,I as t,he as ta,D as u,Ae as ua,P as v,E as va,w,S as wa,m as x,Ie as xa,T as y,De as ya,F as z,Pe as za};
|
|
@@ -53,6 +53,7 @@ interface NodeMap {
|
|
|
53
53
|
JSXAttribute: JSXAttribute;
|
|
54
54
|
JSXSpreadAttribute: JSXSpreadAttribute;
|
|
55
55
|
JSXExpressionContainer: JSXExpressionContainer;
|
|
56
|
+
JSXSpreadChild: JSXSpreadChild;
|
|
56
57
|
JSXEmptyExpression: JSXEmptyExpression;
|
|
57
58
|
JSXText: JSXText;
|
|
58
59
|
JSXIdentifier: JSXIdentifier;
|
|
@@ -62,7 +63,7 @@ interface NodeMap {
|
|
|
62
63
|
/** Nome de tag: `<div>` (Identifier), `<a.b>` (Member), `<a:b>` (Namespaced). */
|
|
63
64
|
type JSXTagName = JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
|
|
64
65
|
/** Filho de um elemento/fragment JSX. */
|
|
65
|
-
type JSXChild = JSXText | JSXExpressionContainer | JSXElement | JSXFragment;
|
|
66
|
+
type JSXChild = JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment;
|
|
66
67
|
interface JSXIdentifier extends BaseNode {
|
|
67
68
|
type: "JSXIdentifier";
|
|
68
69
|
name: string;
|
|
@@ -84,6 +85,12 @@ interface JSXExpressionContainer extends BaseNode {
|
|
|
84
85
|
type: "JSXExpressionContainer";
|
|
85
86
|
expression: Expression | JSXEmptyExpression;
|
|
86
87
|
}
|
|
88
|
+
/** `{...kids}` como FILHO: espalha um array de filhos — desaçucara para um
|
|
89
|
+
* `SpreadElement` entre os argumentos do `createElement`. */
|
|
90
|
+
interface JSXSpreadChild extends BaseNode {
|
|
91
|
+
type: "JSXSpreadChild";
|
|
92
|
+
expression: Expression;
|
|
93
|
+
}
|
|
87
94
|
interface JSXSpreadAttribute extends BaseNode {
|
|
88
95
|
type: "JSXSpreadAttribute";
|
|
89
96
|
argument: Expression;
|
|
@@ -317,6 +324,9 @@ interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
|
317
324
|
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
318
325
|
type: "Identifier";
|
|
319
326
|
name: string;
|
|
327
|
+
/** `(a?: T) => …`: parâmetro OPCIONAL (só em param, só Identifier — como no tsc).
|
|
328
|
+
* Apagável: printer e interpret não o veem; o checker o modela. */
|
|
329
|
+
optional?: boolean;
|
|
320
330
|
}
|
|
321
331
|
interface IfStatement extends BaseStatement {
|
|
322
332
|
type: "IfStatement";
|
|
@@ -531,10 +541,15 @@ interface ImportDeclaration extends BaseModuleDeclaration {
|
|
|
531
541
|
type: "ImportDeclaration";
|
|
532
542
|
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
|
533
543
|
source: Literal;
|
|
544
|
+
/** `import type { … }`: type-only — APAGÁVEL (o printer não emite; o checker
|
|
545
|
+
* e o interpret não ligam valor). Ausente = `"value"`. Nome do TSESTree. */
|
|
546
|
+
importKind?: "type" | "value";
|
|
534
547
|
}
|
|
535
548
|
interface ImportSpecifier extends BaseModuleSpecifier {
|
|
536
549
|
type: "ImportSpecifier";
|
|
537
550
|
imported: Identifier;
|
|
551
|
+
/** `import { type X }`: este specifier é type-only (apagável). */
|
|
552
|
+
importKind?: "type" | "value";
|
|
538
553
|
}
|
|
539
554
|
interface ImportExpression extends BaseExpression {
|
|
540
555
|
type: "ImportExpression";
|
|
@@ -547,7 +562,7 @@ interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
|
|
547
562
|
type: "ImportNamespaceSpecifier";
|
|
548
563
|
}
|
|
549
564
|
/** Qualquer nó de tipo sintático. */
|
|
550
|
-
type TSType = TSKeywordType | TSLiteralType | TSTypeReference | TSArrayType | TSIndexedAccessType | TSUnionType | TSIntersectionType | TSFunctionType | TSTypeLiteral | TSTupleType | TSTypeOperator | TSInferType | TSConditionalType | TSMappedType | TSTypeQuery;
|
|
565
|
+
type TSType = TSKeywordType | TSLiteralType | TSTypeReference | TSArrayType | TSIndexedAccessType | TSUnionType | TSIntersectionType | TSFunctionType | TSTypeLiteral | TSTupleType | TSTypeOperator | TSInferType | TSConditionalType | TSMappedType | TSTypeQuery | TSTypePredicate;
|
|
551
566
|
/** `string`/`number`/`boolean`/`any`/`unknown`/`undefined`/`void`/`null`/`never`. */
|
|
552
567
|
interface TSKeywordType extends BaseNode {
|
|
553
568
|
type: "TSKeywordType";
|
|
@@ -601,6 +616,13 @@ interface TSFunctionType extends BaseNode {
|
|
|
601
616
|
returnType: TSType;
|
|
602
617
|
typeParams?: string[];
|
|
603
618
|
}
|
|
619
|
+
/** `x is S` — o type predicate como tipo de RETORNO (`(v: unknown) => v is string`).
|
|
620
|
+
* No `Schema` vira `fn.guard` (o retorno é `boolean`); só o emissor de fonte o lê. */
|
|
621
|
+
interface TSTypePredicate extends BaseNode {
|
|
622
|
+
type: "TSTypePredicate";
|
|
623
|
+
parameterName: string;
|
|
624
|
+
typeAnnotation: TSType;
|
|
625
|
+
}
|
|
604
626
|
/** `{ k: T; k2?: U }` (+ index/call signatures). */
|
|
605
627
|
interface TSTypeLiteral extends BaseNode {
|
|
606
628
|
type: "TSTypeLiteral";
|
|
@@ -613,6 +635,8 @@ interface TSPropertySignature extends BaseNode {
|
|
|
613
635
|
key: string;
|
|
614
636
|
typeAnnotation: TSType;
|
|
615
637
|
optional?: boolean;
|
|
638
|
+
/** `readonly k: T` — só sintaxe: o `Schema` não o carrega. */
|
|
639
|
+
readonly?: boolean;
|
|
616
640
|
}
|
|
617
641
|
/** `[k: string]: V`. */
|
|
618
642
|
interface TSIndexSignature extends BaseNode {
|
|
@@ -632,6 +656,9 @@ interface TSTupleType extends BaseNode {
|
|
|
632
656
|
elementTypes: TSType[];
|
|
633
657
|
flags?: string[];
|
|
634
658
|
readonly?: boolean;
|
|
659
|
+
/** Rótulos de tupla nomeada (`[a: number, b?: string]`), alinhados a
|
|
660
|
+
* `elementTypes`; `undefined` onde não há. Só sintaxe: o `Schema` não os tem. */
|
|
661
|
+
labels?: (string | undefined)[];
|
|
635
662
|
}
|
|
636
663
|
/** `keyof T` (prefixo). `readonly` mora como flag no array/tuple, não aqui. */
|
|
637
664
|
interface TSTypeOperator extends BaseNode {
|
|
@@ -798,6 +825,7 @@ type types_JSXNamespacedName = JSXNamespacedName;
|
|
|
798
825
|
type types_JSXOpeningElement = JSXOpeningElement;
|
|
799
826
|
type types_JSXOpeningFragment = JSXOpeningFragment;
|
|
800
827
|
type types_JSXSpreadAttribute = JSXSpreadAttribute;
|
|
828
|
+
type types_JSXSpreadChild = JSXSpreadChild;
|
|
801
829
|
type types_JSXTagName = JSXTagName;
|
|
802
830
|
type types_JSXText = JSXText;
|
|
803
831
|
type types_JsonExpression = JsonExpression;
|
|
@@ -915,6 +943,7 @@ type types_TSTypeLiteral = TSTypeLiteral;
|
|
|
915
943
|
type types_TSTypeMember = TSTypeMember;
|
|
916
944
|
type types_TSTypeOperator = TSTypeOperator;
|
|
917
945
|
type types_TSTypeParameter = TSTypeParameter;
|
|
946
|
+
type types_TSTypePredicate = TSTypePredicate;
|
|
918
947
|
type types_TSTypeQuery = TSTypeQuery;
|
|
919
948
|
type types_TSTypeReference = TSTypeReference;
|
|
920
949
|
type types_TSUnionType = TSUnionType;
|
|
@@ -932,7 +961,7 @@ type types_VariableDeclaration = VariableDeclaration;
|
|
|
932
961
|
type types_VariableDeclarator = VariableDeclarator;
|
|
933
962
|
type types_WhileStatement = WhileStatement;
|
|
934
963
|
declare namespace types {
|
|
935
|
-
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_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Placeholder as Placeholder, types_Position as Position, types_Program as Program, types_Property as Property, 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_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, 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 };
|
|
964
|
+
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_JSXSpreadChild as JSXSpreadChild, 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_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Placeholder as Placeholder, types_Position as Position, types_Program as Program, types_Property as Property, 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_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, 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_TSTypePredicate as TSTypePredicate, 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 };
|
|
936
965
|
}
|
|
937
966
|
|
|
938
967
|
/**
|
|
@@ -1041,9 +1070,11 @@ declare const jsxOpeningElement: (name: JSXTagName, attributes?: Array<JSXAttrib
|
|
|
1041
1070
|
declare const jsxClosingElement: (name: JSXTagName) => JSXClosingElement;
|
|
1042
1071
|
declare const jsxOpeningFragment: () => JSXOpeningFragment;
|
|
1043
1072
|
declare const jsxClosingFragment: () => JSXClosingFragment;
|
|
1073
|
+
/** `{...kids}` como filho. */
|
|
1074
|
+
declare const jsxSpreadChild: (expression: Expression) => JSXSpreadChild;
|
|
1044
1075
|
declare const jsxText: (value: string, raw?: string) => JSXText;
|
|
1045
1076
|
declare const jsxElement: (openingElement: JSXOpeningElement, children?: JSXChild[], closingElement?: JSXClosingElement | null) => JSXElement;
|
|
1046
1077
|
declare const jsxFragment: (children?: JSXChild[], openingFragment?: JSXOpeningFragment, closingFragment?: JSXClosingFragment) => JSXFragment;
|
|
1047
1078
|
declare const json: (body: TSLite) => JsonExpression;
|
|
1048
1079
|
|
|
1049
|
-
export { type ModuleDeclaration 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 TemplateLiteral as G, type ThrowStatement as H, type Identifier as I, type JsonExpression as J, type TryStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type UpdateExpression as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type VariableDeclaration as V, type VariableDeclarator as W, type WhileStatement as X, type SpreadElement as Y, type RestElement as Z, type Directive as _, type ArrayPattern as a, type
|
|
1080
|
+
export { type ModuleDeclaration 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 TemplateLiteral as G, type ThrowStatement as H, type Identifier as I, type JsonExpression as J, type TryStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type UpdateExpression as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type VariableDeclaration as V, type VariableDeclarator as W, type WhileStatement as X, type SpreadElement as Y, type RestElement as Z, type Directive as _, type ArrayPattern as a, type SimpleBaseForXStatement as a$, type JSXElement as a0, type JSXFragment as a1, type CallExpression as a2, type AssignmentOperator as a3, type AssignmentPattern as a4, type BaseCallExpression as a5, type BaseDeclaration as a6, type BaseExpression as a7, type BaseForXStatement as a8, type BaseFunction as a9, type JSXOpeningElement as aA, type JSXOpeningFragment as aB, type JSXSpreadAttribute as aC, type JSXSpreadChild 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 ModuleSpecifier as aK, type NodeMap as aL, type Pattern as aM, type Placeholder as aN, type Position as aO, type RegExpLiteral as aP, type SequenceExpression as aQ, type SimpleArrayExpression as aR, type SimpleArrayPattern as aS, type SimpleArrowFunctionExpression as aT, type SimpleAssignmentExpression as aU, type SimpleAssignmentPattern as aV, type SimpleAssignmentProperty as aW, type SimpleAwaitExpression as aX, type SimpleBaseCallExpression as aY, type SimpleBaseDeclaration as aZ, type SimpleBaseExpression as a_, type BaseModuleDeclaration as aa, type BaseModuleSpecifier as ab, type BaseNodeWithoutComments as ac, type BasePattern as ad, type BaseStatement as ae, type BigIntLiteral as af, type BinaryOperator as ag, type ChainElement as ah, type Comment as ai, type DebuggerStatement as aj, type Declaration as ak, type ExportDefaultDeclaration as al, type ExportNamedDeclaration as am, type ExportSpecifier as an, type Expression as ao, type Function as ap, type ImportExpression as aq, type JSXAttribute as ar, type JSXChild as as, type JSXClosingElement as at, type JSXClosingFragment as au, type JSXEmptyExpression as av, type JSXExpressionContainer as aw, type JSXIdentifier as ax, type JSXMemberExpression as ay, type JSXNamespacedName as az, type ArrowFunctionExpression as b, type TSInferType as b$, type SimpleBaseFunction as b0, type SimpleBaseNode as b1, type SimpleBaseNodeWithoutComments as b2, type SimpleBasePattern as b3, type SimpleBaseStatement as b4, type SimpleBigIntLiteral as b5, type SimpleBinaryExpression as b6, type SimpleBlockStatement as b7, type SimpleBreakStatement as b8, type SimpleCatchClause as b9, type SimpleRestElement as bA, type SimpleReturnStatement as bB, type SimpleSequenceExpression as bC, type SimpleSimpleCallExpression as bD, type SimpleSimpleLiteral as bE, type SimpleSourceLocation as bF, type SimpleSpreadElement as bG, type SimpleSwitchCase as bH, type SimpleSwitchStatement as bI, type SimpleTemplateElement as bJ, type SimpleTemplateLiteral as bK, type SimpleThisExpression as bL, type SimpleThrowStatement as bM, type SimpleTryStatement as bN, type SimpleUnaryExpression as bO, type SimpleUpdateExpression as bP, type SimpleVariableDeclaration as bQ, type SimpleVariableDeclarator as bR, type SimpleWhileStatement as bS, type SourceLocation as bT, type Statement as bU, type TSArrayType as bV, type TSCallSignatureDeclaration as bW, type TSConditionalType as bX, type TSFunctionType as bY, type TSIndexSignature as bZ, type TSIndexedAccessType as b_, type SimpleChainExpression as ba, type SimpleComment as bb, type SimpleConditionalExpression as bc, type SimpleContinueStatement as bd, type SimpleDoWhileStatement as be, type SimpleEmptyStatement as bf, type SimpleExpressionStatement as bg, type SimpleForInStatement as bh, type SimpleForOfStatement as bi, type SimpleForStatement as bj, type SimpleFunctionDeclaration as bk, type SimpleFunctionExpression as bl, type SimpleIdentifier as bm, type SimpleIfStatement as bn, type SimpleJsonExpression as bo, type SimpleLabeledStatement as bp, type SimpleLiteral as bq, type SimpleLogicalExpression as br, type SimpleMemberExpression as bs, type SimpleNode as bt, type SimpleObjectExpression as bu, type SimpleObjectPattern as bv, type SimplePosition as bw, type SimpleProgram as bx, type SimpleProperty as by, type SimpleRegExpLiteral as bz, type AssignmentExpression as c, jsxExpressionContainer as c$, type TSIntersectionType as c0, type TSKeywordType as c1, type TSLite as c2, type TSLiteMarker as c3, type TSLiteralType as c4, type TSMappedType as c5, type TSPropertySignature as c6, type TSTupleType as c7, type TSType as c8, type TSTypeLiteral as c9, callExpression as cA, catchClause as cB, chainExpression as cC, conditionalExpression as cD, continueStatement as cE, doWhileStatement as cF, emptyStatement as cG, exportDefaultDeclaration as cH, exportNamedDeclaration as cI, exportSpecifier as cJ, expressionStatement as cK, forInStatement as cL, forOfStatement as cM, forStatement as cN, functionDeclaration as cO, functionExpression as cP, identifier as cQ, ifStatement as cR, importDeclaration as cS, importDefaultSpecifier as cT, importNamespaceSpecifier as cU, importSpecifier as cV, jsxAttribute as cW, jsxClosingElement as cX, jsxClosingFragment as cY, jsxElement as cZ, jsxEmptyExpression as c_, type TSTypeMember as ca, type TSTypeOperator as cb, type TSTypeParameter as cc, type TSTypePredicate as cd, type TSTypeQuery as ce, type TSTypeReference as cf, type TSUnionType as cg, type TaggedTemplateExpression as ch, type ThisExpression as ci, type UnaryOperator as cj, type UpdateOperator as ck, expr as cl, fromExprMarker as cm, json as cn, jsonExpression as co, types as cp, arrayExpression as cq, arrayPattern as cr, arrowFunctionExpression as cs, assignmentExpression as ct, assignmentPattern as cu, assignmentProperty as cv, awaitExpression as cw, binaryExpression as cx, blockStatement as cy, breakStatement as cz, type AssignmentProperty as d, jsxFragment as d0, jsxIdentifier as d1, jsxMemberExpression as d2, jsxNamespacedName as d3, jsxOpeningElement as d4, jsxOpeningFragment as d5, jsxSpreadAttribute as d6, jsxSpreadChild as d7, jsxText as d8, literal as d9, logicalExpression as da, memberExpression as db, objectExpression as dc, objectPattern as dd, placeholder as de, program as df, property as dg, restElement as dh, returnStatement as di, spreadElement as dj, switchCase as dk, switchStatement as dl, templateElement as dm, templateLiteral as dn, throwStatement as dp, tryStatement as dq, unaryExpression as dr, updateExpression as ds, variableDeclaration as dt, variableDeclarator as du, whileStatement as dv, 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 ObjectPattern as w, type Property as x, type SwitchCase as y, type SwitchStatement as z };
|
|
@@ -53,6 +53,7 @@ interface NodeMap {
|
|
|
53
53
|
JSXAttribute: JSXAttribute;
|
|
54
54
|
JSXSpreadAttribute: JSXSpreadAttribute;
|
|
55
55
|
JSXExpressionContainer: JSXExpressionContainer;
|
|
56
|
+
JSXSpreadChild: JSXSpreadChild;
|
|
56
57
|
JSXEmptyExpression: JSXEmptyExpression;
|
|
57
58
|
JSXText: JSXText;
|
|
58
59
|
JSXIdentifier: JSXIdentifier;
|
|
@@ -62,7 +63,7 @@ interface NodeMap {
|
|
|
62
63
|
/** Nome de tag: `<div>` (Identifier), `<a.b>` (Member), `<a:b>` (Namespaced). */
|
|
63
64
|
type JSXTagName = JSXIdentifier | JSXMemberExpression | JSXNamespacedName;
|
|
64
65
|
/** Filho de um elemento/fragment JSX. */
|
|
65
|
-
type JSXChild = JSXText | JSXExpressionContainer | JSXElement | JSXFragment;
|
|
66
|
+
type JSXChild = JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment;
|
|
66
67
|
interface JSXIdentifier extends BaseNode {
|
|
67
68
|
type: "JSXIdentifier";
|
|
68
69
|
name: string;
|
|
@@ -84,6 +85,12 @@ interface JSXExpressionContainer extends BaseNode {
|
|
|
84
85
|
type: "JSXExpressionContainer";
|
|
85
86
|
expression: Expression | JSXEmptyExpression;
|
|
86
87
|
}
|
|
88
|
+
/** `{...kids}` como FILHO: espalha um array de filhos — desaçucara para um
|
|
89
|
+
* `SpreadElement` entre os argumentos do `createElement`. */
|
|
90
|
+
interface JSXSpreadChild extends BaseNode {
|
|
91
|
+
type: "JSXSpreadChild";
|
|
92
|
+
expression: Expression;
|
|
93
|
+
}
|
|
87
94
|
interface JSXSpreadAttribute extends BaseNode {
|
|
88
95
|
type: "JSXSpreadAttribute";
|
|
89
96
|
argument: Expression;
|
|
@@ -317,6 +324,9 @@ interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
|
317
324
|
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
318
325
|
type: "Identifier";
|
|
319
326
|
name: string;
|
|
327
|
+
/** `(a?: T) => …`: parâmetro OPCIONAL (só em param, só Identifier — como no tsc).
|
|
328
|
+
* Apagável: printer e interpret não o veem; o checker o modela. */
|
|
329
|
+
optional?: boolean;
|
|
320
330
|
}
|
|
321
331
|
interface IfStatement extends BaseStatement {
|
|
322
332
|
type: "IfStatement";
|
|
@@ -531,10 +541,15 @@ interface ImportDeclaration extends BaseModuleDeclaration {
|
|
|
531
541
|
type: "ImportDeclaration";
|
|
532
542
|
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
|
533
543
|
source: Literal;
|
|
544
|
+
/** `import type { … }`: type-only — APAGÁVEL (o printer não emite; o checker
|
|
545
|
+
* e o interpret não ligam valor). Ausente = `"value"`. Nome do TSESTree. */
|
|
546
|
+
importKind?: "type" | "value";
|
|
534
547
|
}
|
|
535
548
|
interface ImportSpecifier extends BaseModuleSpecifier {
|
|
536
549
|
type: "ImportSpecifier";
|
|
537
550
|
imported: Identifier;
|
|
551
|
+
/** `import { type X }`: este specifier é type-only (apagável). */
|
|
552
|
+
importKind?: "type" | "value";
|
|
538
553
|
}
|
|
539
554
|
interface ImportExpression extends BaseExpression {
|
|
540
555
|
type: "ImportExpression";
|
|
@@ -547,7 +562,7 @@ interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
|
|
547
562
|
type: "ImportNamespaceSpecifier";
|
|
548
563
|
}
|
|
549
564
|
/** Qualquer nó de tipo sintático. */
|
|
550
|
-
type TSType = TSKeywordType | TSLiteralType | TSTypeReference | TSArrayType | TSIndexedAccessType | TSUnionType | TSIntersectionType | TSFunctionType | TSTypeLiteral | TSTupleType | TSTypeOperator | TSInferType | TSConditionalType | TSMappedType | TSTypeQuery;
|
|
565
|
+
type TSType = TSKeywordType | TSLiteralType | TSTypeReference | TSArrayType | TSIndexedAccessType | TSUnionType | TSIntersectionType | TSFunctionType | TSTypeLiteral | TSTupleType | TSTypeOperator | TSInferType | TSConditionalType | TSMappedType | TSTypeQuery | TSTypePredicate;
|
|
551
566
|
/** `string`/`number`/`boolean`/`any`/`unknown`/`undefined`/`void`/`null`/`never`. */
|
|
552
567
|
interface TSKeywordType extends BaseNode {
|
|
553
568
|
type: "TSKeywordType";
|
|
@@ -601,6 +616,13 @@ interface TSFunctionType extends BaseNode {
|
|
|
601
616
|
returnType: TSType;
|
|
602
617
|
typeParams?: string[];
|
|
603
618
|
}
|
|
619
|
+
/** `x is S` — o type predicate como tipo de RETORNO (`(v: unknown) => v is string`).
|
|
620
|
+
* No `Schema` vira `fn.guard` (o retorno é `boolean`); só o emissor de fonte o lê. */
|
|
621
|
+
interface TSTypePredicate extends BaseNode {
|
|
622
|
+
type: "TSTypePredicate";
|
|
623
|
+
parameterName: string;
|
|
624
|
+
typeAnnotation: TSType;
|
|
625
|
+
}
|
|
604
626
|
/** `{ k: T; k2?: U }` (+ index/call signatures). */
|
|
605
627
|
interface TSTypeLiteral extends BaseNode {
|
|
606
628
|
type: "TSTypeLiteral";
|
|
@@ -613,6 +635,8 @@ interface TSPropertySignature extends BaseNode {
|
|
|
613
635
|
key: string;
|
|
614
636
|
typeAnnotation: TSType;
|
|
615
637
|
optional?: boolean;
|
|
638
|
+
/** `readonly k: T` — só sintaxe: o `Schema` não o carrega. */
|
|
639
|
+
readonly?: boolean;
|
|
616
640
|
}
|
|
617
641
|
/** `[k: string]: V`. */
|
|
618
642
|
interface TSIndexSignature extends BaseNode {
|
|
@@ -632,6 +656,9 @@ interface TSTupleType extends BaseNode {
|
|
|
632
656
|
elementTypes: TSType[];
|
|
633
657
|
flags?: string[];
|
|
634
658
|
readonly?: boolean;
|
|
659
|
+
/** Rótulos de tupla nomeada (`[a: number, b?: string]`), alinhados a
|
|
660
|
+
* `elementTypes`; `undefined` onde não há. Só sintaxe: o `Schema` não os tem. */
|
|
661
|
+
labels?: (string | undefined)[];
|
|
635
662
|
}
|
|
636
663
|
/** `keyof T` (prefixo). `readonly` mora como flag no array/tuple, não aqui. */
|
|
637
664
|
interface TSTypeOperator extends BaseNode {
|
|
@@ -798,6 +825,7 @@ type types_JSXNamespacedName = JSXNamespacedName;
|
|
|
798
825
|
type types_JSXOpeningElement = JSXOpeningElement;
|
|
799
826
|
type types_JSXOpeningFragment = JSXOpeningFragment;
|
|
800
827
|
type types_JSXSpreadAttribute = JSXSpreadAttribute;
|
|
828
|
+
type types_JSXSpreadChild = JSXSpreadChild;
|
|
801
829
|
type types_JSXTagName = JSXTagName;
|
|
802
830
|
type types_JSXText = JSXText;
|
|
803
831
|
type types_JsonExpression = JsonExpression;
|
|
@@ -915,6 +943,7 @@ type types_TSTypeLiteral = TSTypeLiteral;
|
|
|
915
943
|
type types_TSTypeMember = TSTypeMember;
|
|
916
944
|
type types_TSTypeOperator = TSTypeOperator;
|
|
917
945
|
type types_TSTypeParameter = TSTypeParameter;
|
|
946
|
+
type types_TSTypePredicate = TSTypePredicate;
|
|
918
947
|
type types_TSTypeQuery = TSTypeQuery;
|
|
919
948
|
type types_TSTypeReference = TSTypeReference;
|
|
920
949
|
type types_TSUnionType = TSUnionType;
|
|
@@ -932,7 +961,7 @@ type types_VariableDeclaration = VariableDeclaration;
|
|
|
932
961
|
type types_VariableDeclarator = VariableDeclarator;
|
|
933
962
|
type types_WhileStatement = WhileStatement;
|
|
934
963
|
declare namespace types {
|
|
935
|
-
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_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Placeholder as Placeholder, types_Position as Position, types_Program as Program, types_Property as Property, 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_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, 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 };
|
|
964
|
+
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_JSXSpreadChild as JSXSpreadChild, 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_ModuleDeclaration as ModuleDeclaration, types_ModuleSpecifier as ModuleSpecifier, types_Node as Node, types_NodeMap as NodeMap, types_ObjectExpression as ObjectExpression, types_ObjectPattern as ObjectPattern, types_Pattern as Pattern, types_Placeholder as Placeholder, types_Position as Position, types_Program as Program, types_Property as Property, 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_SimpleNode as SimpleNode, types_SimpleObjectExpression as SimpleObjectExpression, types_SimpleObjectPattern as SimpleObjectPattern, types_SimplePosition as SimplePosition, types_SimpleProgram as SimpleProgram, types_SimpleProperty as SimpleProperty, 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_TSTypePredicate as TSTypePredicate, 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 };
|
|
936
965
|
}
|
|
937
966
|
|
|
938
967
|
/**
|
|
@@ -1041,9 +1070,11 @@ declare const jsxOpeningElement: (name: JSXTagName, attributes?: Array<JSXAttrib
|
|
|
1041
1070
|
declare const jsxClosingElement: (name: JSXTagName) => JSXClosingElement;
|
|
1042
1071
|
declare const jsxOpeningFragment: () => JSXOpeningFragment;
|
|
1043
1072
|
declare const jsxClosingFragment: () => JSXClosingFragment;
|
|
1073
|
+
/** `{...kids}` como filho. */
|
|
1074
|
+
declare const jsxSpreadChild: (expression: Expression) => JSXSpreadChild;
|
|
1044
1075
|
declare const jsxText: (value: string, raw?: string) => JSXText;
|
|
1045
1076
|
declare const jsxElement: (openingElement: JSXOpeningElement, children?: JSXChild[], closingElement?: JSXClosingElement | null) => JSXElement;
|
|
1046
1077
|
declare const jsxFragment: (children?: JSXChild[], openingFragment?: JSXOpeningFragment, closingFragment?: JSXClosingFragment) => JSXFragment;
|
|
1047
1078
|
declare const json: (body: TSLite) => JsonExpression;
|
|
1048
1079
|
|
|
1049
|
-
export { type ModuleDeclaration 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 TemplateLiteral as G, type ThrowStatement as H, type Identifier as I, type JsonExpression as J, type TryStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type UpdateExpression as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type VariableDeclaration as V, type VariableDeclarator as W, type WhileStatement as X, type SpreadElement as Y, type RestElement as Z, type Directive as _, type ArrayPattern as a, type
|
|
1080
|
+
export { type ModuleDeclaration 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 TemplateLiteral as G, type ThrowStatement as H, type Identifier as I, type JsonExpression as J, type TryStatement as K, type Literal as L, type MemberExpression as M, type Node as N, type ObjectExpression as O, type Program as P, type UpdateExpression as Q, type ReturnStatement as R, type SimpleCallExpression as S, type TemplateElement as T, type UnaryExpression as U, type VariableDeclaration as V, type VariableDeclarator as W, type WhileStatement as X, type SpreadElement as Y, type RestElement as Z, type Directive as _, type ArrayPattern as a, type SimpleBaseForXStatement as a$, type JSXElement as a0, type JSXFragment as a1, type CallExpression as a2, type AssignmentOperator as a3, type AssignmentPattern as a4, type BaseCallExpression as a5, type BaseDeclaration as a6, type BaseExpression as a7, type BaseForXStatement as a8, type BaseFunction as a9, type JSXOpeningElement as aA, type JSXOpeningFragment as aB, type JSXSpreadAttribute as aC, type JSXSpreadChild 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 ModuleSpecifier as aK, type NodeMap as aL, type Pattern as aM, type Placeholder as aN, type Position as aO, type RegExpLiteral as aP, type SequenceExpression as aQ, type SimpleArrayExpression as aR, type SimpleArrayPattern as aS, type SimpleArrowFunctionExpression as aT, type SimpleAssignmentExpression as aU, type SimpleAssignmentPattern as aV, type SimpleAssignmentProperty as aW, type SimpleAwaitExpression as aX, type SimpleBaseCallExpression as aY, type SimpleBaseDeclaration as aZ, type SimpleBaseExpression as a_, type BaseModuleDeclaration as aa, type BaseModuleSpecifier as ab, type BaseNodeWithoutComments as ac, type BasePattern as ad, type BaseStatement as ae, type BigIntLiteral as af, type BinaryOperator as ag, type ChainElement as ah, type Comment as ai, type DebuggerStatement as aj, type Declaration as ak, type ExportDefaultDeclaration as al, type ExportNamedDeclaration as am, type ExportSpecifier as an, type Expression as ao, type Function as ap, type ImportExpression as aq, type JSXAttribute as ar, type JSXChild as as, type JSXClosingElement as at, type JSXClosingFragment as au, type JSXEmptyExpression as av, type JSXExpressionContainer as aw, type JSXIdentifier as ax, type JSXMemberExpression as ay, type JSXNamespacedName as az, type ArrowFunctionExpression as b, type TSInferType as b$, type SimpleBaseFunction as b0, type SimpleBaseNode as b1, type SimpleBaseNodeWithoutComments as b2, type SimpleBasePattern as b3, type SimpleBaseStatement as b4, type SimpleBigIntLiteral as b5, type SimpleBinaryExpression as b6, type SimpleBlockStatement as b7, type SimpleBreakStatement as b8, type SimpleCatchClause as b9, type SimpleRestElement as bA, type SimpleReturnStatement as bB, type SimpleSequenceExpression as bC, type SimpleSimpleCallExpression as bD, type SimpleSimpleLiteral as bE, type SimpleSourceLocation as bF, type SimpleSpreadElement as bG, type SimpleSwitchCase as bH, type SimpleSwitchStatement as bI, type SimpleTemplateElement as bJ, type SimpleTemplateLiteral as bK, type SimpleThisExpression as bL, type SimpleThrowStatement as bM, type SimpleTryStatement as bN, type SimpleUnaryExpression as bO, type SimpleUpdateExpression as bP, type SimpleVariableDeclaration as bQ, type SimpleVariableDeclarator as bR, type SimpleWhileStatement as bS, type SourceLocation as bT, type Statement as bU, type TSArrayType as bV, type TSCallSignatureDeclaration as bW, type TSConditionalType as bX, type TSFunctionType as bY, type TSIndexSignature as bZ, type TSIndexedAccessType as b_, type SimpleChainExpression as ba, type SimpleComment as bb, type SimpleConditionalExpression as bc, type SimpleContinueStatement as bd, type SimpleDoWhileStatement as be, type SimpleEmptyStatement as bf, type SimpleExpressionStatement as bg, type SimpleForInStatement as bh, type SimpleForOfStatement as bi, type SimpleForStatement as bj, type SimpleFunctionDeclaration as bk, type SimpleFunctionExpression as bl, type SimpleIdentifier as bm, type SimpleIfStatement as bn, type SimpleJsonExpression as bo, type SimpleLabeledStatement as bp, type SimpleLiteral as bq, type SimpleLogicalExpression as br, type SimpleMemberExpression as bs, type SimpleNode as bt, type SimpleObjectExpression as bu, type SimpleObjectPattern as bv, type SimplePosition as bw, type SimpleProgram as bx, type SimpleProperty as by, type SimpleRegExpLiteral as bz, type AssignmentExpression as c, jsxExpressionContainer as c$, type TSIntersectionType as c0, type TSKeywordType as c1, type TSLite as c2, type TSLiteMarker as c3, type TSLiteralType as c4, type TSMappedType as c5, type TSPropertySignature as c6, type TSTupleType as c7, type TSType as c8, type TSTypeLiteral as c9, callExpression as cA, catchClause as cB, chainExpression as cC, conditionalExpression as cD, continueStatement as cE, doWhileStatement as cF, emptyStatement as cG, exportDefaultDeclaration as cH, exportNamedDeclaration as cI, exportSpecifier as cJ, expressionStatement as cK, forInStatement as cL, forOfStatement as cM, forStatement as cN, functionDeclaration as cO, functionExpression as cP, identifier as cQ, ifStatement as cR, importDeclaration as cS, importDefaultSpecifier as cT, importNamespaceSpecifier as cU, importSpecifier as cV, jsxAttribute as cW, jsxClosingElement as cX, jsxClosingFragment as cY, jsxElement as cZ, jsxEmptyExpression as c_, type TSTypeMember as ca, type TSTypeOperator as cb, type TSTypeParameter as cc, type TSTypePredicate as cd, type TSTypeQuery as ce, type TSTypeReference as cf, type TSUnionType as cg, type TaggedTemplateExpression as ch, type ThisExpression as ci, type UnaryOperator as cj, type UpdateOperator as ck, expr as cl, fromExprMarker as cm, json as cn, jsonExpression as co, types as cp, arrayExpression as cq, arrayPattern as cr, arrowFunctionExpression as cs, assignmentExpression as ct, assignmentPattern as cu, assignmentProperty as cv, awaitExpression as cw, binaryExpression as cx, blockStatement as cy, breakStatement as cz, type AssignmentProperty as d, jsxFragment as d0, jsxIdentifier as d1, jsxMemberExpression as d2, jsxNamespacedName as d3, jsxOpeningElement as d4, jsxOpeningFragment as d5, jsxSpreadAttribute as d6, jsxSpreadChild as d7, jsxText as d8, literal as d9, logicalExpression as da, memberExpression as db, objectExpression as dc, objectPattern as dd, placeholder as de, program as df, property as dg, restElement as dh, returnStatement as di, spreadElement as dj, switchCase as dk, switchStatement as dl, templateElement as dm, templateLiteral as dn, throwStatement as dp, tryStatement as dq, unaryExpression as dr, updateExpression as ds, variableDeclaration as dt, variableDeclarator as du, whileStatement as dv, 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 ObjectPattern as w, type Property as x, type SwitchCase as y, type SwitchStatement as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var G=Object.defineProperty;var F=(e,r)=>{for(var n in r)G(e,n,{get:r[n],enumerable:true});};var x=class extends Error{constructor(r,n,i){super(n),this.name="TSLiteError",this.code=r,this.details=i;}};var Q=/^[a-zA-Z_][a-zA-Z_0-9]*$/,d=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","ChainExpression","JSXElement","JSXFragment","Program"];function T(e){return d.includes(e)}function h(e){return new x("invalid-expression-entry",`Invalid #expr entry type: "${e}". The #expr marker is used to embed executable logic inside JSON. Only expression types of the Language 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"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],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"],Placeholder:[],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["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"],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},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 g={};F(g,{arrayExpression:()=>re,arrayPattern:()=>Le,arrowFunctionExpression:()=>ye,assignmentExpression:()=>ae,assignmentPattern:()=>_e,assignmentProperty:()=>Be,awaitExpression:()=>le,binaryExpression:()=>oe,blockStatement:()=>Se,breakStatement:()=>Ne,callExpression:()=>w,catchClause:()=>he,chainExpression:()=>ne,conditionalExpression:()=>pe,continueStatement:()=>Ce,doWhileStatement:()=>Xe,emptyStatement:()=>Je,exportDefaultDeclaration:()=>qe,exportNamedDeclaration:()=>We,exportSpecifier:()=>$e,expr:()=>O,expressionStatement:()=>ue,forInStatement:()=>De,forOfStatement:()=>Ie,forStatement:()=>we,fromExprMarker:()=>k,functionDeclaration:()=>Ee,functionExpression:()=>xe,identifier:()=>E,ifStatement:()=>fe,importDeclaration:()=>Ve,importDefaultSpecifier:()=>ve,importNamespaceSpecifier:()=>Ue,importSpecifier:()=>Me,json:()=>_,jsonExpression:()=>I,jsxAttribute:()=>Qe,jsxClosingElement:()=>tt,jsxClosingFragment:()=>j,jsxElement:()=>nt,jsxEmptyExpression:()=>He,jsxExpressionContainer:()=>Ze,jsxFragment:()=>ot,jsxIdentifier:()=>Ke,jsxMemberExpression:()=>Ye,jsxNamespacedName:()=>ze,jsxOpeningElement:()=>et,jsxOpeningFragment:()=>B,jsxSpreadAttribute:()=>Ge,jsxText:()=>rt,literal:()=>y,logicalExpression:()=>se,memberExpression:()=>D,objectExpression:()=>f,objectPattern:()=>ke,placeholder:()=>te,program:()=>Re,property:()=>C,restElement:()=>je,returnStatement:()=>de,spreadElement:()=>J,switchCase:()=>be,switchStatement:()=>ge,templateElement:()=>ce,templateLiteral:()=>me,throwStatement:()=>Ae,tryStatement:()=>Te,unaryExpression:()=>L,updateExpression:()=>ie,variableDeclaration:()=>Fe,variableDeclarator:()=>Oe,whileStatement:()=>Pe});var O=e=>{let{type:r,...n}=e;if(!r||typeof r!="string")throw new x("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}),te=()=>({type:"Placeholder"});function y(e){return e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:typeof e=="number"&&Number.isFinite(e)&&(e<0||Object.is(e,-0))?L("-",y(-e)):{type:"Literal",value:e}}var re=e=>({type:"ArrayExpression",elements:e}),f=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}),w=(e,r,n=false)=>({type:"CallExpression",callee:e,arguments:r,optional:n}),D=(e,r,n=false,i=false)=>({type:"MemberExpression",object:e,property:r,computed:n,optional:i}),ne=e=>({type:"ChainExpression",expression:e}),oe=(e,r,n)=>({type:"BinaryExpression",left:r,right:n,operator:e}),se=(e,r,n)=>({type:"LogicalExpression",operator:e,left:r,right:n}),L=(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}),Ce=(e=null)=>({type:"ContinueStatement",label:e}),Je=()=>({type:"EmptyStatement"}),we=(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}),Le=e=>({type:"ArrayPattern",elements:e}),Be=(e,r=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:r,shorthand:n,computed:i}),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"}),j=()=>({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}),ot=(e=[],r=B(),n=j())=>({type:"JSXFragment",openingFragment:r,children:e,closingFragment:n}),_=I;var st=(e="b")=>{class r{constructor(s){this.text=s;}}let n=(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(S=>n(S,s)).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,s);throw new x("unknown-node-type","Unknown type: "+t.type,{type:t.type})},i=t=>`(${e}) => ${n(t)}`,p=t=>new Function("b",`return ${t}`)(g),o=(t,s,...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}.${s}(${A.reverse().join(", ")})`},m={ArrayExpression:(t,s)=>o(t,"arrayExpression",t.elements),ArrayPattern:(t,s)=>o(t,"arrayPattern",t.elements),ArrowFunctionExpression:(t,s)=>o(t,"arrowFunctionExpression",t.params,t.body,t.async||void 0),AssignmentExpression:(t,s)=>o(t,"assignmentExpression",t.operator,t.left,t.right),AssignmentProperty:(t,s)=>o(t,"assignmentProperty",t.key,t.value||void 0,t.shorthand||void 0),AwaitExpression:(t,s)=>o(t,"awaitExpression",t.argument),BinaryExpression:(t,s)=>o(t,"binaryExpression",t.operator,t.left,t.right),BlockStatement:(t,s)=>o(t,"blockStatement",t.body),BreakStatement:(t,s)=>t.label?o(t,"breakStatement",t.label):o(t,"breakStatement"),CallExpression:(t,s)=>o(t,"callExpression",t.callee,t.arguments,t.optional||void 0),CatchClause:(t,s)=>o(t,"catchClause",t.param,t.body),ChainExpression:(t,s)=>o(t,"chainExpression",t.expression),ConditionalExpression:(t,s)=>o(t,"conditionalExpression",t.test,t.consequent,t.alternate),ContinueStatement:(t,s)=>o(t,"continueStatement",t.label),DoWhileStatement:(t,s)=>o(t,"doWhileStatement",t.body,t.test),EmptyStatement:(t,s)=>o(t,"emptyStatement"),ExpressionStatement:(t,s)=>o(t,"expressionStatement",t.expression),ForInStatement:(t,s)=>o(t,"forInStatement",t.left,t.right,t.body),ForOfStatement:(t,s)=>o(t,"forOfStatement",t.left,t.right,t.body),ForStatement:(t,s)=>o(t,"forStatement",t.init,t.test,t.update,t.body),FunctionDeclaration:(t,s)=>o(t,"functionDeclaration",t.id,t.params,t.body,t.generator||void 0,t.async||void 0),FunctionExpression:(t,s)=>o(t,"functionExpression",t.id||null,t.params,t.body,t.generator||void 0,t.async||void 0),Identifier:(t,s)=>o(t,"identifier",t.name),IfStatement:(t,s)=>o(t,"ifStatement",t.test,t.consequent,t.alternate),ImportDeclaration:(t,s)=>o(t,"importDeclaration",t.specifiers,t.source),ImportDefaultSpecifier:(t,s)=>o(t,"importDefaultSpecifier",t.local),ImportNamespaceSpecifier:(t,s)=>o(t,"importNamespaceSpecifier",t.local),ImportSpecifier:(t,s)=>o(t,"importSpecifier",t.imported,t.local),JsonExpression:(t,s)=>o(t,"jsonExpression",JSON.stringify(t.body)),Literal:(t,s)=>o(t,"literal",t.value),LogicalExpression:(t,s)=>o(t,"logicalExpression",t.operator,t.left,t.right),MemberExpression:(t,s)=>o(t,"memberExpression",t.object,t.property,t.computed||void 0,t.optional||void 0),ObjectExpression:(t,s)=>o(t,"objectExpression",t.properties),ObjectPattern:(t,s)=>o(t,"objectPattern",t.properties),Program:(t,s)=>o(t,"program",t.body),Property:(t,s)=>{if(s.type==="ObjectPattern")return o(t,"assignmentProperty",t.key,t.value,t.shorthand||void 0);if(s.type==="ObjectExpression")return o(t,"property",t.key,t.value,t.shorthand||void 0,t.computed||void 0)},ReturnStatement:(t,s)=>o(t,"returnStatement",t.argument),SwitchCase:(t,s)=>o(t,"switchCase",t.test,t.consequent),SwitchStatement:(t,s)=>o(t,"switchStatement",t.discriminant,t.cases),TemplateElement:(t,s)=>t.tail?o(t,"templateElement",new r(JSON.stringify(t.value)),true):o(t,"templateElement",new r(JSON.stringify(t.value))),TemplateLiteral:(t,s)=>o(t,"templateLiteral",t.quasis,t.expressions),ThrowStatement:(t,s)=>o(t,"throwStatement",t.argument),TryStatement:(t,s)=>o(t,"tryStatement",t.block,t.handler,t.finalizer),UnaryExpression:(t,s)=>o(t,"unaryExpression",t.operator,t.argument),UpdateExpression:(t,s)=>t.prefix==true?o(t,"updateExpression",t.operator,t.argument,true):o(t,"updateExpression",t.operator,t.argument),VariableDeclaration:(t,s)=>o(t,"variableDeclaration",t.kind,t.declarations),VariableDeclarator:(t,s)=>o(t,"variableDeclarator",t.id,t.init||void 0),WhileStatement:(t,s)=>o(t,"whileStatement",t.test,t.body),SpreadElement:(t,s)=>o(t,"spreadElement",t.argument),RestElement:(t,s)=>o(t,"restElement",t.argument)};return {build:n,buildFunction:i,safeEval:p,builders:m}};var W={};F(W,{isArrayExpression:()=>ut,isArrayPattern:()=>Lt,isArrowFunctionExpression:()=>yt,isAssignmentExpression:()=>Tt,isAssignmentProperty:()=>rr,isAwaitExpression:()=>ht,isBinaryExpression:()=>mt,isBlockStatement:()=>Jt,isBreakStatement:()=>It,isCallExpression:()=>Et,isCatchClause:()=>$t,isConditionalExpression:()=>dt,isContinueStatement:()=>Pt,isDirective:()=>tr,isDoWhileStatement:()=>Wt,isEmptyStatement:()=>Xt,isExpressionStatement:()=>Ct,isForInStatement:()=>vt,isForOfStatement:()=>Ut,isForStatement:()=>Mt,isFunctionDeclaration:()=>Bt,isFunctionExpression:()=>xt,isIdentifier:()=>ct,isIfStatement:()=>Dt,isImportDeclaration:()=>Ht,isImportDefaultSpecifier:()=>Gt,isImportNamespaceSpecifier:()=>Qt,isImportSpecifier:()=>Zt,isJsonExpression:()=>Nt,isLiteral:()=>lt,isLogicalExpression:()=>ft,isMemberExpression:()=>At,isModuleDeclaration:()=>er,isNode:()=>nr,isObjectExpression:()=>St,isObjectPattern:()=>kt,isProgram:()=>jt,isProperty:()=>U,isReturnStatement:()=>wt,isSwitchCase:()=>Rt,isSwitchStatement:()=>_t,isTemplateElement:()=>Yt,isTemplateLiteral:()=>zt,isThrowStatement:()=>Kt,isTryStatement:()=>qt,isUnaryExpression:()=>gt,isUpdateExpression:()=>bt,isVariableDeclaration:()=>Ot,isVariableDeclarator:()=>Ft,isWhileStatement:()=>Vt});var R=e=>typeof e=="object"&&e!==null&&typeof e.type=="string",it=N;function u(e,r){let n=it[e.type],i=e,p=(o,m)=>{if(o!=null)if(Array.isArray(o))for(let t=0;t<o.length;t++)R(o[t])&&r(o[t],m,t);else R(o)&&r(o,m,null);};if(n){for(let o of n)p(i[o],o);return}for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&p(i[o],o);}function V(e){let r=[];return u(e,n=>r.push(n)),r}function b(e,r){let n=false;function i(p,o){if(!p||n)return;let m=r[p.type]??r["*"],t=false;if(m){let s=m(p,o);if(s===false&&(t=true),s==="break"){n=true;return}}t||u(p,s=>{n||i(s,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 M(e,r){let n;return b(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 o=false,m=p.map(t=>{let s=i(t);return s!==t&&(o=true),s});return o?m:p}if(a(p)){let o=false,m={};for(let t in p){let s=p[t],S=i(s);m[t]=S,S!==s&&(o=true);}return o?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==="JsonExpression"&&a(e.body),Ct=e=>e?.type==="ExpressionStatement"&&a(e.expression),Jt=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),wt=e=>e?.type==="ReturnStatement",Dt=e=>e?.type==="IfStatement"&&a(e.test)&&a(e.consequent),It=e=>e?.type==="BreakStatement",Pt=e=>e?.type==="ContinueStatement",Xt=e=>e?.type==="EmptyStatement",Ft=e=>e?.type==="VariableDeclarator"&&a(e.id),Ot=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),kt=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),Lt=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),Bt=e=>e?.type==="FunctionDeclaration"&&a(e.id)&&a(e.body),jt=e=>e?.type==="Program"&&Array.isArray(e.body),_t=e=>e?.type==="SwitchStatement"&&a(e.discriminant)&&Array.isArray(e.cases),Rt=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),Vt=e=>e?.type==="WhileStatement"&&a(e.test)&&a(e.body),Mt=e=>e?.type==="ForStatement"&&"body"in e,vt=e=>e?.type==="ForInStatement"&&a(e.left)&&a(e.right)&&a(e.body),Ut=e=>e?.type==="ForOfStatement"&&a(e.left)&&a(e.right)&&a(e.body),Wt=e=>e?.type==="DoWhileStatement"&&a(e.body)&&a(e.test),qt=e=>e?.type==="TryStatement"&&a(e.block),$t=e=>e?.type==="CatchClause"&&a(e.body),Kt=e=>e?.type==="ThrowStatement"&&a(e.argument),Yt=e=>e?.type==="TemplateElement"&&a(e.value),zt=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),Ht=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&a(e.source),Zt=e=>e?.type==="ImportSpecifier"&&a(e.imported)&&a(e.local),Gt=e=>e?.type==="ImportDefaultSpecifier"&&a(e.local),Qt=e=>e?.type==="ImportNamespaceSpecifier"&&a(e.local),er=e=>e?.type==="ModuleDeclaration",tr=e=>e?.type==="Directive",U=e=>e?.type==="Property"&&a(e.key)&&a(e.value),rr=e=>U(e),nr=e=>typeof e?.type=="string";var or="createElement",sr="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 ir=e=>/^[a-zA-Z_$][\w$]*$/.test(e);function q(e){return e.type==="JSXIdentifier"?c(/^[a-z]/.test(e.name)||e.name.includes("-")?y(e.name):E(e.name),e):e.type==="JSXNamespacedName"?c(y(`${e.namespace.name}:${e.name.name}`),e):c(D(q(e.object),c(E(e.property.name),e.property)),e)}function ar(e){return e.type==="JSXNamespacedName"?c(y(`${e.namespace.name}:${e.name.name}`),e):c(ir(e.name)?E(e.name):y(e.name),e)}function pr(e,r){return e===null?c(y(true),r):e.type==="JSXExpressionContainer"?e.expression:e}var $=(e,r)=>c(r.emptyPropsAsObject?f([]):y(null),e);function lr(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(ar(p.name),pr(p.value,p)),p));return c(f(i),r)}function cr(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 o=r[p].replace(/\t/g," ");p!==0&&(o=o.replace(/^ +/,"")),p!==r.length-1&&(o=o.replace(/ +$/,"")),o&&(p!==n&&(o+=" "),i+=o);}return i===""?null:i}function mr(e){if(e.type==="JSXText"){let r=cr(e.value);return r===null?null:c(y(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(sr),e.openingFragment):q(e.openingElement.name),i=e.type==="JSXFragment"?$(e.openingFragment,r):lr(e.openingElement.attributes,e.openingElement,r),p=e.children.map(mr).filter(o=>o!==null);return c(w(c(E(or),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.BinaryPrecedence=ee;exports.Mock=at;exports.Precedence=l;exports.TSLiteError=x;exports.VALID_EXPRESSION_ENTRY_TYPES=d;exports.VALID_OBJECT_KEY=Q;exports.VisitorKeys=N;exports.childScope=z;exports.childrenOf=V;exports.desugarJSX=K;exports.expr=O;exports.find=M;exports.forEachChild=u;exports.fromExprMarker=k;exports.generateBuilders=st;exports.guards=W;exports.invalidExpressionEntryError=h;exports.isObject=a;exports.isValidExpressionEntryType=T;exports.json=_;exports.jsonExpression=I;exports.lookup=H;exports.mutate=v;exports.pick=pt;exports.rootScope=Y;exports.visibleNames=Z;exports.walk=b;
|
|
1
|
+
'use strict';var G=Object.defineProperty;var F=(e,r)=>{for(var n in r)G(e,n,{get:r[n],enumerable:true});};var x=class extends Error{constructor(r,n,i){super(n),this.name="TSLiteError",this.code=r,this.details=i;}};var Q=/^[a-zA-Z_][a-zA-Z_0-9]*$/,d=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","ChainExpression","JSXElement","JSXFragment","Program"];function h(e){return d.includes(e)}function N(e){return new x("invalid-expression-entry",`Invalid #expr entry type: "${e}". The #expr marker is used to embed executable logic inside JSON. Only expression types of the Language 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 C={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"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],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"],Placeholder:[],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["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"],JSXElement:["openingElement","children","closingElement"],JSXFragment:["openingFragment","children","closingFragment"],JSXOpeningElement:["name","attributes"],JSXClosingElement:["name"],JSXOpeningFragment:[],JSXClosingFragment:[],JSXAttribute:["name","value"],JSXSpreadAttribute:["argument"],JSXExpressionContainer:["expression"],JSXSpreadChild:["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},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={};F(b,{arrayExpression:()=>re,arrayPattern:()=>Le,arrowFunctionExpression:()=>ye,assignmentExpression:()=>ae,assignmentPattern:()=>_e,assignmentProperty:()=>Be,awaitExpression:()=>le,binaryExpression:()=>oe,blockStatement:()=>Se,breakStatement:()=>Ne,callExpression:()=>w,catchClause:()=>he,chainExpression:()=>ne,conditionalExpression:()=>pe,continueStatement:()=>Ce,doWhileStatement:()=>Pe,emptyStatement:()=>Je,exportDefaultDeclaration:()=>qe,exportNamedDeclaration:()=>We,exportSpecifier:()=>$e,expr:()=>O,expressionStatement:()=>ue,forInStatement:()=>De,forOfStatement:()=>Ie,forStatement:()=>we,fromExprMarker:()=>k,functionDeclaration:()=>Ee,functionExpression:()=>xe,identifier:()=>E,ifStatement:()=>fe,importDeclaration:()=>Ve,importDefaultSpecifier:()=>ve,importNamespaceSpecifier:()=>Ue,importSpecifier:()=>Me,json:()=>_,jsonExpression:()=>I,jsxAttribute:()=>Qe,jsxClosingElement:()=>tt,jsxClosingFragment:()=>j,jsxElement:()=>ot,jsxEmptyExpression:()=>He,jsxExpressionContainer:()=>Ze,jsxFragment:()=>st,jsxIdentifier:()=>Ke,jsxMemberExpression:()=>Ye,jsxNamespacedName:()=>ze,jsxOpeningElement:()=>et,jsxOpeningFragment:()=>B,jsxSpreadAttribute:()=>Ge,jsxSpreadChild:()=>rt,jsxText:()=>nt,literal:()=>y,logicalExpression:()=>se,memberExpression:()=>D,objectExpression:()=>f,objectPattern:()=>ke,placeholder:()=>te,program:()=>Re,property:()=>J,restElement:()=>je,returnStatement:()=>de,spreadElement:()=>g,switchCase:()=>be,switchStatement:()=>ge,templateElement:()=>ce,templateLiteral:()=>me,throwStatement:()=>Ae,tryStatement:()=>Te,unaryExpression:()=>L,updateExpression:()=>ie,variableDeclaration:()=>Fe,variableDeclarator:()=>Oe,whileStatement:()=>Xe});var O=e=>{let{type:r,...n}=e;if(!r||typeof r!="string")throw new x("missing-node-type","expr() requires a node with a valid type property");if(!h(r))throw N(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}),te=()=>({type:"Placeholder"});function y(e){return e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:typeof e=="number"&&Number.isFinite(e)&&(e<0||Object.is(e,-0))?L("-",y(-e)):{type:"Literal",value:e}}var re=e=>({type:"ArrayExpression",elements:e}),f=e=>({type:"ObjectExpression",properties:e}),J=(e,r,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:r,kind:"init"}),g=e=>({type:"SpreadElement",argument:e}),w=(e,r,n=false)=>({type:"CallExpression",callee:e,arguments:r,optional:n}),D=(e,r,n=false,i=false)=>({type:"MemberExpression",object:e,property:r,computed:n,optional:i}),ne=e=>({type:"ChainExpression",expression:e}),oe=(e,r,n)=>({type:"BinaryExpression",left:r,right:n,operator:e}),se=(e,r,n)=>({type:"LogicalExpression",operator:e,left:r,right:n}),L=(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}),Ce=(e=null)=>({type:"ContinueStatement",label:e}),Je=()=>({type:"EmptyStatement"}),we=(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}),Xe=(e,r)=>({type:"WhileStatement",test:e,body:r}),Pe=(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}),Le=e=>({type:"ArrayPattern",elements:e}),Be=(e,r=e,n=false,i=false)=>({type:"Property",key:e,kind:"init",value:r,shorthand:n,computed:i}),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"}),j=()=>({type:"JSXClosingFragment"}),rt=e=>({type:"JSXSpreadChild",expression:e}),nt=(e,r=e)=>({type:"JSXText",value:e,raw:r}),ot=(e,r=[],n=null)=>({type:"JSXElement",openingElement:e,children:r,closingElement:n}),st=(e=[],r=B(),n=j())=>({type:"JSXFragment",openingFragment:r,children:e,closingFragment:n}),_=I;var it=(e="b")=>{class r{constructor(s){this.text=s;}}let n=(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(S=>n(S,s)).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,s);throw new x("unknown-node-type","Unknown type: "+t.type,{type:t.type})},i=t=>`(${e}) => ${n(t)}`,p=t=>new Function("b",`return ${t}`)(b),o=(t,s,...S)=>{let T=[],X=false;return S.reverse().forEach(P=>{P===void 0?X&&T.push("false"):(T.push(n(P,t)),X=true);}),`${e}.${s}(${T.reverse().join(", ")})`},m={ArrayExpression:(t,s)=>o(t,"arrayExpression",t.elements),ArrayPattern:(t,s)=>o(t,"arrayPattern",t.elements),ArrowFunctionExpression:(t,s)=>o(t,"arrowFunctionExpression",t.params,t.body,t.async||void 0),AssignmentExpression:(t,s)=>o(t,"assignmentExpression",t.operator,t.left,t.right),AssignmentProperty:(t,s)=>o(t,"assignmentProperty",t.key,t.value||void 0,t.shorthand||void 0),AwaitExpression:(t,s)=>o(t,"awaitExpression",t.argument),BinaryExpression:(t,s)=>o(t,"binaryExpression",t.operator,t.left,t.right),BlockStatement:(t,s)=>o(t,"blockStatement",t.body),BreakStatement:(t,s)=>t.label?o(t,"breakStatement",t.label):o(t,"breakStatement"),CallExpression:(t,s)=>o(t,"callExpression",t.callee,t.arguments,t.optional||void 0),CatchClause:(t,s)=>o(t,"catchClause",t.param,t.body),ChainExpression:(t,s)=>o(t,"chainExpression",t.expression),ConditionalExpression:(t,s)=>o(t,"conditionalExpression",t.test,t.consequent,t.alternate),ContinueStatement:(t,s)=>o(t,"continueStatement",t.label),DoWhileStatement:(t,s)=>o(t,"doWhileStatement",t.body,t.test),EmptyStatement:(t,s)=>o(t,"emptyStatement"),ExpressionStatement:(t,s)=>o(t,"expressionStatement",t.expression),ForInStatement:(t,s)=>o(t,"forInStatement",t.left,t.right,t.body),ForOfStatement:(t,s)=>o(t,"forOfStatement",t.left,t.right,t.body),ForStatement:(t,s)=>o(t,"forStatement",t.init,t.test,t.update,t.body),FunctionDeclaration:(t,s)=>o(t,"functionDeclaration",t.id,t.params,t.body,t.generator||void 0,t.async||void 0),FunctionExpression:(t,s)=>o(t,"functionExpression",t.id||null,t.params,t.body,t.generator||void 0,t.async||void 0),Identifier:(t,s)=>o(t,"identifier",t.name),IfStatement:(t,s)=>o(t,"ifStatement",t.test,t.consequent,t.alternate),ImportDeclaration:(t,s)=>o(t,"importDeclaration",t.specifiers,t.source),ImportDefaultSpecifier:(t,s)=>o(t,"importDefaultSpecifier",t.local),ImportNamespaceSpecifier:(t,s)=>o(t,"importNamespaceSpecifier",t.local),ImportSpecifier:(t,s)=>o(t,"importSpecifier",t.imported,t.local),JsonExpression:(t,s)=>o(t,"jsonExpression",JSON.stringify(t.body)),Literal:(t,s)=>o(t,"literal",t.value),LogicalExpression:(t,s)=>o(t,"logicalExpression",t.operator,t.left,t.right),MemberExpression:(t,s)=>o(t,"memberExpression",t.object,t.property,t.computed||void 0,t.optional||void 0),ObjectExpression:(t,s)=>o(t,"objectExpression",t.properties),ObjectPattern:(t,s)=>o(t,"objectPattern",t.properties),Program:(t,s)=>o(t,"program",t.body),Property:(t,s)=>{if(s.type==="ObjectPattern")return o(t,"assignmentProperty",t.key,t.value,t.shorthand||void 0);if(s.type==="ObjectExpression")return o(t,"property",t.key,t.value,t.shorthand||void 0,t.computed||void 0)},ReturnStatement:(t,s)=>o(t,"returnStatement",t.argument),SwitchCase:(t,s)=>o(t,"switchCase",t.test,t.consequent),SwitchStatement:(t,s)=>o(t,"switchStatement",t.discriminant,t.cases),TemplateElement:(t,s)=>t.tail?o(t,"templateElement",new r(JSON.stringify(t.value)),true):o(t,"templateElement",new r(JSON.stringify(t.value))),TemplateLiteral:(t,s)=>o(t,"templateLiteral",t.quasis,t.expressions),ThrowStatement:(t,s)=>o(t,"throwStatement",t.argument),TryStatement:(t,s)=>o(t,"tryStatement",t.block,t.handler,t.finalizer),UnaryExpression:(t,s)=>o(t,"unaryExpression",t.operator,t.argument),UpdateExpression:(t,s)=>t.prefix==true?o(t,"updateExpression",t.operator,t.argument,true):o(t,"updateExpression",t.operator,t.argument),VariableDeclaration:(t,s)=>o(t,"variableDeclaration",t.kind,t.declarations),VariableDeclarator:(t,s)=>o(t,"variableDeclarator",t.id,t.init||void 0),WhileStatement:(t,s)=>o(t,"whileStatement",t.test,t.body),SpreadElement:(t,s)=>o(t,"spreadElement",t.argument),RestElement:(t,s)=>o(t,"restElement",t.argument)};return {build:n,buildFunction:i,safeEval:p,builders:m}};var W={};F(W,{isArrayExpression:()=>dt,isArrayPattern:()=>Bt,isArrowFunctionExpression:()=>xt,isAssignmentExpression:()=>ht,isAssignmentProperty:()=>nr,isAwaitExpression:()=>Nt,isBinaryExpression:()=>yt,isBlockStatement:()=>wt,isBreakStatement:()=>Xt,isCallExpression:()=>St,isCatchClause:()=>Kt,isConditionalExpression:()=>ft,isContinueStatement:()=>Pt,isDirective:()=>rr,isDoWhileStatement:()=>qt,isEmptyStatement:()=>Ft,isExpressionStatement:()=>Jt,isForInStatement:()=>Ut,isForOfStatement:()=>Wt,isForStatement:()=>vt,isFunctionDeclaration:()=>jt,isFunctionExpression:()=>Et,isIdentifier:()=>mt,isIfStatement:()=>It,isImportDeclaration:()=>Zt,isImportDefaultSpecifier:()=>Qt,isImportNamespaceSpecifier:()=>er,isImportSpecifier:()=>Gt,isJsonExpression:()=>Ct,isLiteral:()=>ct,isLogicalExpression:()=>gt,isMemberExpression:()=>Tt,isModuleDeclaration:()=>tr,isNode:()=>or,isObjectExpression:()=>ut,isObjectPattern:()=>Lt,isProgram:()=>_t,isProperty:()=>U,isReturnStatement:()=>Dt,isSwitchCase:()=>Vt,isSwitchStatement:()=>Rt,isTemplateElement:()=>zt,isTemplateLiteral:()=>Ht,isThrowStatement:()=>Yt,isTryStatement:()=>$t,isUnaryExpression:()=>bt,isUpdateExpression:()=>At,isVariableDeclaration:()=>kt,isVariableDeclarator:()=>Ot,isWhileStatement:()=>Mt});var R=e=>typeof e=="object"&&e!==null&&typeof e.type=="string",at=C;function u(e,r){let n=at[e.type],i=e,p=(o,m)=>{if(o!=null)if(Array.isArray(o))for(let t=0;t<o.length;t++)R(o[t])&&r(o[t],m,t);else R(o)&&r(o,m,null);};if(n){for(let o of n)p(i[o],o);return}for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&p(i[o],o);}function V(e){let r=[];return u(e,n=>r.push(n)),r}function A(e,r){let n=false;function i(p,o){if(!p||n)return;let m=r[p.type]??r["*"],t=false;if(m){let s=m(p,o);if(s===false&&(t=true),s==="break"){n=true;return}}t||u(p,s=>{n||i(s,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 o=false,m=p.map(t=>{let s=i(t);return s!==t&&(o=true),s});return o?m:p}if(a(p)){let o=false,m={};for(let t in p){let s=p[t],S=i(s);m[t]=S,S!==s&&(o=true);}return o?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,Ct=e=>e?.type==="JsonExpression"&&a(e.body),Jt=e=>e?.type==="ExpressionStatement"&&a(e.expression),wt=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),Dt=e=>e?.type==="ReturnStatement",It=e=>e?.type==="IfStatement"&&a(e.test)&&a(e.consequent),Xt=e=>e?.type==="BreakStatement",Pt=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),Lt=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),Bt=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",U=e=>e?.type==="Property"&&a(e.key)&&a(e.value),nr=e=>U(e),or=e=>typeof e?.type=="string";var sr="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 q(e){return e.type==="JSXIdentifier"?c(/^[a-z]/.test(e.name)||e.name.includes("-")?y(e.name):E(e.name),e):e.type==="JSXNamespacedName"?c(y(`${e.namespace.name}:${e.name.name}`),e):c(D(q(e.object),c(E(e.property.name),e.property)),e)}function pr(e){return e.type==="JSXNamespacedName"?c(y(`${e.namespace.name}:${e.name.name}`),e):c(ar(e.name)?E(e.name):y(e.name),e)}function lr(e,r){return e===null?c(y(true),r):e.type==="JSXExpressionContainer"?e.expression:e}var $=(e,r)=>c(r.emptyPropsAsObject?f([]):y(null),e);function cr(e,r,n){if(e.length===0)return $(r,n);let i=e.map(p=>p.type==="JSXSpreadAttribute"?c(g(p.argument),p):c(J(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 o=r[p].replace(/\t/g," ");p!==0&&(o=o.replace(/^ +/,"")),p!==r.length-1&&(o=o.replace(/ +$/,"")),o&&(p!==n&&(o+=" "),i+=o);}return i===""?null:i}function yr(e){if(e.type==="JSXText"){let r=mr(e.value);return r===null?null:c(y(r),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e.type==="JSXSpreadChild"?c(g(e.expression),e):e}function K(e,r={}){let n=e.type==="JSXFragment"?c(E(ir),e.openingFragment):q(e.openingElement.name),i=e.type==="JSXFragment"?$(e.openingFragment,r):cr(e.openingElement.attributes,e.openingElement,r),p=e.children.map(yr).filter(o=>o!==null);return c(w(c(E(sr),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.BinaryPrecedence=ee;exports.Mock=pt;exports.Precedence=l;exports.TSLiteError=x;exports.VALID_EXPRESSION_ENTRY_TYPES=d;exports.VALID_OBJECT_KEY=Q;exports.VisitorKeys=C;exports.childScope=z;exports.childrenOf=V;exports.desugarJSX=K;exports.expr=O;exports.find=M;exports.forEachChild=u;exports.fromExprMarker=k;exports.generateBuilders=it;exports.guards=W;exports.invalidExpressionEntryError=N;exports.isObject=a;exports.isValidExpressionEntryType=h;exports.json=_;exports.jsonExpression=I;exports.lookup=H;exports.mutate=v;exports.pick=lt;exports.rootScope=Y;exports.visibleNames=Z;exports.walk=A;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, O as ObjectExpression, w as ObjectPattern, P as Program, x as Property, R as ReturnStatement, y as SwitchCase, z as SwitchStatement, T as TemplateElement, G as TemplateLiteral, H as ThrowStatement, K as TryStatement, U as UnaryExpression, Q as UpdateExpression, V as VariableDeclaration, W as VariableDeclarator, X as WhileStatement, Y as SpreadElement, Z as RestElement, _ as Directive, $ as ModuleDeclaration, a0 as JSXElement, a1 as JSXFragment, a2 as CallExpression } from './index-
|
|
2
|
-
export { a3 as AssignmentOperator, a4 as AssignmentPattern, a5 as BaseCallExpression, a6 as BaseDeclaration, a7 as BaseExpression, a8 as BaseForXStatement, a9 as BaseFunction, aa as BaseModuleDeclaration, ab as BaseModuleSpecifier, ac as BaseNodeWithoutComments, ad as BasePattern, ae as BaseStatement, af as BigIntLiteral, ag as BinaryOperator, ah as ChainElement, ai as Comment, aj as DebuggerStatement, ak as Declaration, al as ExportDefaultDeclaration, am as ExportNamedDeclaration, an as ExportSpecifier, ao as Expression, ap as Function, aq as ImportExpression, ar as JSXAttribute, as as JSXChild, at as JSXClosingElement, au as JSXClosingFragment, av as JSXEmptyExpression, aw as JSXExpressionContainer, ax as JSXIdentifier, ay as JSXMemberExpression, az as JSXNamespacedName, aA as JSXOpeningElement, aB as JSXOpeningFragment, aC as JSXSpreadAttribute, aD as
|
|
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, O as ObjectExpression, w as ObjectPattern, P as Program, x as Property, R as ReturnStatement, y as SwitchCase, z as SwitchStatement, T as TemplateElement, G as TemplateLiteral, H as ThrowStatement, K as TryStatement, U as UnaryExpression, Q as UpdateExpression, V as VariableDeclaration, W as VariableDeclarator, X as WhileStatement, Y as SpreadElement, Z as RestElement, _ as Directive, $ as ModuleDeclaration, a0 as JSXElement, a1 as JSXFragment, a2 as CallExpression } from './index-BNiyDL0x.cjs';
|
|
2
|
+
export { a3 as AssignmentOperator, a4 as AssignmentPattern, a5 as BaseCallExpression, a6 as BaseDeclaration, a7 as BaseExpression, a8 as BaseForXStatement, a9 as BaseFunction, aa as BaseModuleDeclaration, ab as BaseModuleSpecifier, ac as BaseNodeWithoutComments, ad as BasePattern, ae as BaseStatement, af as BigIntLiteral, ag as BinaryOperator, ah as ChainElement, ai as Comment, aj as DebuggerStatement, ak as Declaration, al as ExportDefaultDeclaration, am as ExportNamedDeclaration, an as ExportSpecifier, ao as Expression, ap as Function, aq as ImportExpression, ar as JSXAttribute, as as JSXChild, at as JSXClosingElement, au as JSXClosingFragment, av as JSXEmptyExpression, aw as JSXExpressionContainer, ax as JSXIdentifier, ay as JSXMemberExpression, az as JSXNamespacedName, aA as JSXOpeningElement, aB as JSXOpeningFragment, aC as JSXSpreadAttribute, aD as JSXSpreadChild, aE as JSXTagName, aF as JSXText, aG as LabeledStatement, aH as LogicalOperator, aI as MaybeNamedFunctionDeclaration, aJ as MetaProperty, aK as ModuleSpecifier, aL as NodeMap, aM as Pattern, aN as Placeholder, aO as Position, aP as RegExpLiteral, aQ as SequenceExpression, aR as SimpleArrayExpression, aS as SimpleArrayPattern, aT as SimpleArrowFunctionExpression, aU as SimpleAssignmentExpression, aV as SimpleAssignmentPattern, aW as SimpleAssignmentProperty, aX as SimpleAwaitExpression, aY as SimpleBaseCallExpression, aZ as SimpleBaseDeclaration, a_ as SimpleBaseExpression, a$ as SimpleBaseForXStatement, b0 as SimpleBaseFunction, b1 as SimpleBaseNode, b2 as SimpleBaseNodeWithoutComments, b3 as SimpleBasePattern, b4 as SimpleBaseStatement, b5 as SimpleBigIntLiteral, b6 as SimpleBinaryExpression, b7 as SimpleBlockStatement, b8 as SimpleBreakStatement, b9 as SimpleCatchClause, ba as SimpleChainExpression, bb as SimpleComment, bc as SimpleConditionalExpression, bd as SimpleContinueStatement, be as SimpleDoWhileStatement, bf as SimpleEmptyStatement, bg as SimpleExpressionStatement, bh as SimpleForInStatement, bi as SimpleForOfStatement, bj as SimpleForStatement, bk as SimpleFunctionDeclaration, bl as SimpleFunctionExpression, bm as SimpleIdentifier, bn as SimpleIfStatement, bo as SimpleJsonExpression, bp as SimpleLabeledStatement, bq as SimpleLiteral, br as SimpleLogicalExpression, bs as SimpleMemberExpression, bt as SimpleNode, bu as SimpleObjectExpression, bv as SimpleObjectPattern, bw as SimplePosition, bx as SimpleProgram, by as SimpleProperty, bz as SimpleRegExpLiteral, bA as SimpleRestElement, bB as SimpleReturnStatement, bC as SimpleSequenceExpression, bD as SimpleSimpleCallExpression, bE as SimpleSimpleLiteral, bF as SimpleSourceLocation, bG as SimpleSpreadElement, bH as SimpleSwitchCase, bI as SimpleSwitchStatement, bJ as SimpleTemplateElement, bK as SimpleTemplateLiteral, bL as SimpleThisExpression, bM as SimpleThrowStatement, bN as SimpleTryStatement, bO as SimpleUnaryExpression, bP as SimpleUpdateExpression, bQ as SimpleVariableDeclaration, bR as SimpleVariableDeclarator, bS as SimpleWhileStatement, bT as SourceLocation, bU as Statement, bV as TSArrayType, bW as TSCallSignatureDeclaration, bX as TSConditionalType, bY as TSFunctionType, bZ as TSIndexSignature, b_ as TSIndexedAccessType, b$ as TSInferType, c0 as TSIntersectionType, c1 as TSKeywordType, c2 as TSLite, c3 as TSLiteMarker, c4 as TSLiteralType, c5 as TSMappedType, c6 as TSPropertySignature, c7 as TSTupleType, c8 as TSType, c9 as TSTypeLiteral, ca as TSTypeMember, cb as TSTypeOperator, cc as TSTypeParameter, cd as TSTypePredicate, ce as TSTypeQuery, cf as TSTypeReference, cg as TSUnionType, ch as TaggedTemplateExpression, ci as ThisExpression, cj as UnaryOperator, ck as UpdateOperator, cl as expr, cm as fromExprMarker, cn as json, co as jsonExpression, cp as types } from './index-BNiyDL0x.cjs';
|
|
3
3
|
|
|
4
4
|
/** Erro lançado pelo `@tslite/core`. */
|
|
5
5
|
type CoreErrorCode = "invalid-expression-entry" | "missing-node-type" | "unknown-node-type";
|
|
@@ -111,6 +111,7 @@ declare const VisitorKeys: {
|
|
|
111
111
|
JSXAttribute: string[];
|
|
112
112
|
JSXSpreadAttribute: string[];
|
|
113
113
|
JSXExpressionContainer: string[];
|
|
114
|
+
JSXSpreadChild: string[];
|
|
114
115
|
JSXEmptyExpression: never[];
|
|
115
116
|
JSXText: never[];
|
|
116
117
|
JSXIdentifier: never[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, O as ObjectExpression, w as ObjectPattern, P as Program, x as Property, R as ReturnStatement, y as SwitchCase, z as SwitchStatement, T as TemplateElement, G as TemplateLiteral, H as ThrowStatement, K as TryStatement, U as UnaryExpression, Q as UpdateExpression, V as VariableDeclaration, W as VariableDeclarator, X as WhileStatement, Y as SpreadElement, Z as RestElement, _ as Directive, $ as ModuleDeclaration, a0 as JSXElement, a1 as JSXFragment, a2 as CallExpression } from './index-
|
|
2
|
-
export { a3 as AssignmentOperator, a4 as AssignmentPattern, a5 as BaseCallExpression, a6 as BaseDeclaration, a7 as BaseExpression, a8 as BaseForXStatement, a9 as BaseFunction, aa as BaseModuleDeclaration, ab as BaseModuleSpecifier, ac as BaseNodeWithoutComments, ad as BasePattern, ae as BaseStatement, af as BigIntLiteral, ag as BinaryOperator, ah as ChainElement, ai as Comment, aj as DebuggerStatement, ak as Declaration, al as ExportDefaultDeclaration, am as ExportNamedDeclaration, an as ExportSpecifier, ao as Expression, ap as Function, aq as ImportExpression, ar as JSXAttribute, as as JSXChild, at as JSXClosingElement, au as JSXClosingFragment, av as JSXEmptyExpression, aw as JSXExpressionContainer, ax as JSXIdentifier, ay as JSXMemberExpression, az as JSXNamespacedName, aA as JSXOpeningElement, aB as JSXOpeningFragment, aC as JSXSpreadAttribute, aD as
|
|
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, O as ObjectExpression, w as ObjectPattern, P as Program, x as Property, R as ReturnStatement, y as SwitchCase, z as SwitchStatement, T as TemplateElement, G as TemplateLiteral, H as ThrowStatement, K as TryStatement, U as UnaryExpression, Q as UpdateExpression, V as VariableDeclaration, W as VariableDeclarator, X as WhileStatement, Y as SpreadElement, Z as RestElement, _ as Directive, $ as ModuleDeclaration, a0 as JSXElement, a1 as JSXFragment, a2 as CallExpression } from './index-BNiyDL0x.js';
|
|
2
|
+
export { a3 as AssignmentOperator, a4 as AssignmentPattern, a5 as BaseCallExpression, a6 as BaseDeclaration, a7 as BaseExpression, a8 as BaseForXStatement, a9 as BaseFunction, aa as BaseModuleDeclaration, ab as BaseModuleSpecifier, ac as BaseNodeWithoutComments, ad as BasePattern, ae as BaseStatement, af as BigIntLiteral, ag as BinaryOperator, ah as ChainElement, ai as Comment, aj as DebuggerStatement, ak as Declaration, al as ExportDefaultDeclaration, am as ExportNamedDeclaration, an as ExportSpecifier, ao as Expression, ap as Function, aq as ImportExpression, ar as JSXAttribute, as as JSXChild, at as JSXClosingElement, au as JSXClosingFragment, av as JSXEmptyExpression, aw as JSXExpressionContainer, ax as JSXIdentifier, ay as JSXMemberExpression, az as JSXNamespacedName, aA as JSXOpeningElement, aB as JSXOpeningFragment, aC as JSXSpreadAttribute, aD as JSXSpreadChild, aE as JSXTagName, aF as JSXText, aG as LabeledStatement, aH as LogicalOperator, aI as MaybeNamedFunctionDeclaration, aJ as MetaProperty, aK as ModuleSpecifier, aL as NodeMap, aM as Pattern, aN as Placeholder, aO as Position, aP as RegExpLiteral, aQ as SequenceExpression, aR as SimpleArrayExpression, aS as SimpleArrayPattern, aT as SimpleArrowFunctionExpression, aU as SimpleAssignmentExpression, aV as SimpleAssignmentPattern, aW as SimpleAssignmentProperty, aX as SimpleAwaitExpression, aY as SimpleBaseCallExpression, aZ as SimpleBaseDeclaration, a_ as SimpleBaseExpression, a$ as SimpleBaseForXStatement, b0 as SimpleBaseFunction, b1 as SimpleBaseNode, b2 as SimpleBaseNodeWithoutComments, b3 as SimpleBasePattern, b4 as SimpleBaseStatement, b5 as SimpleBigIntLiteral, b6 as SimpleBinaryExpression, b7 as SimpleBlockStatement, b8 as SimpleBreakStatement, b9 as SimpleCatchClause, ba as SimpleChainExpression, bb as SimpleComment, bc as SimpleConditionalExpression, bd as SimpleContinueStatement, be as SimpleDoWhileStatement, bf as SimpleEmptyStatement, bg as SimpleExpressionStatement, bh as SimpleForInStatement, bi as SimpleForOfStatement, bj as SimpleForStatement, bk as SimpleFunctionDeclaration, bl as SimpleFunctionExpression, bm as SimpleIdentifier, bn as SimpleIfStatement, bo as SimpleJsonExpression, bp as SimpleLabeledStatement, bq as SimpleLiteral, br as SimpleLogicalExpression, bs as SimpleMemberExpression, bt as SimpleNode, bu as SimpleObjectExpression, bv as SimpleObjectPattern, bw as SimplePosition, bx as SimpleProgram, by as SimpleProperty, bz as SimpleRegExpLiteral, bA as SimpleRestElement, bB as SimpleReturnStatement, bC as SimpleSequenceExpression, bD as SimpleSimpleCallExpression, bE as SimpleSimpleLiteral, bF as SimpleSourceLocation, bG as SimpleSpreadElement, bH as SimpleSwitchCase, bI as SimpleSwitchStatement, bJ as SimpleTemplateElement, bK as SimpleTemplateLiteral, bL as SimpleThisExpression, bM as SimpleThrowStatement, bN as SimpleTryStatement, bO as SimpleUnaryExpression, bP as SimpleUpdateExpression, bQ as SimpleVariableDeclaration, bR as SimpleVariableDeclarator, bS as SimpleWhileStatement, bT as SourceLocation, bU as Statement, bV as TSArrayType, bW as TSCallSignatureDeclaration, bX as TSConditionalType, bY as TSFunctionType, bZ as TSIndexSignature, b_ as TSIndexedAccessType, b$ as TSInferType, c0 as TSIntersectionType, c1 as TSKeywordType, c2 as TSLite, c3 as TSLiteMarker, c4 as TSLiteralType, c5 as TSMappedType, c6 as TSPropertySignature, c7 as TSTupleType, c8 as TSType, c9 as TSTypeLiteral, ca as TSTypeMember, cb as TSTypeOperator, cc as TSTypeParameter, cd as TSTypePredicate, ce as TSTypeQuery, cf as TSTypeReference, cg as TSUnionType, ch as TaggedTemplateExpression, ci as ThisExpression, cj as UnaryOperator, ck as UpdateOperator, cl as expr, cm as fromExprMarker, cn as json, co as jsonExpression, cp as types } from './index-BNiyDL0x.js';
|
|
3
3
|
|
|
4
4
|
/** Erro lançado pelo `@tslite/core`. */
|
|
5
5
|
type CoreErrorCode = "invalid-expression-entry" | "missing-node-type" | "unknown-node-type";
|
|
@@ -111,6 +111,7 @@ declare const VisitorKeys: {
|
|
|
111
111
|
JSXAttribute: string[];
|
|
112
112
|
JSXSpreadAttribute: string[];
|
|
113
113
|
JSXExpressionContainer: string[];
|
|
114
|
+
JSXSpreadChild: string[];
|
|
114
115
|
JSXEmptyExpression: never[];
|
|
115
116
|
JSXText: never[];
|
|
116
117
|
JSXIdentifier: never[];
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,g,l,s,b,Ba,n,t,p,r,q}from'./chunk-KFFODSKH.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-KFFODSKH.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),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:()=>_e,isArrowFunctionExpression:()=>se,isAssignmentExpression:()=>fe,isAssignmentProperty:()=>Ye,isAwaitExpression:()=>xe,isBinaryExpression:()=>ne,isBlockStatement:()=>Ee,isBreakStatement:()=>Ae,isCallExpression:()=>ie,isCatchClause:()=>Xe,isConditionalExpression:()=>ce,isContinueStatement:()=>Te,isDirective:()=>qe,isDoWhileStatement:()=>Je,isEmptyStatement:()=>Ne,isExpressionStatement:()=>Se,isForInStatement:()=>je,isForOfStatement:()=>Be,isForStatement:()=>Oe,isFunctionDeclaration:()=>De,isFunctionExpression:()=>oe,isIdentifier:()=>re,isIfStatement:()=>ge,isImportDeclaration:()=>ve,isImportDefaultSpecifier:()=>We,isImportNamespaceSpecifier:()=>Ue,isImportSpecifier:()=>Me,isJsonExpression:()=>de,isLiteral:()=>te,isLogicalExpression:()=>le,isMemberExpression:()=>ue,isModuleDeclaration:()=>Ke,isNode:()=>ze,isObjectExpression:()=>ae,isObjectPattern:()=>ke,isProgram:()=>Ce,isProperty:()=>F,isReturnStatement:()=>be,isSwitchCase:()=>Fe,isSwitchStatement:()=>Pe,isTemplateElement:()=>Re,isTemplateLiteral:()=>$e,isThrowStatement:()=>Ve,isTryStatement:()=>Le,isUnaryExpression:()=>ye,isUpdateExpression:()=>me,isVariableDeclaration:()=>we,isVariableDeclarator:()=>he,isWhileStatement:()=>Ie});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==="JsonExpression"&&o(e.body),Se=e=>e?.type==="ExpressionStatement"&&o(e.expression),Ee=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),be=e=>e?.type==="ReturnStatement",ge=e=>e?.type==="IfStatement"&&o(e.test)&&o(e.consequent),Ae=e=>e?.type==="BreakStatement",Te=e=>e?.type==="ContinueStatement",Ne=e=>e?.type==="EmptyStatement",he=e=>e?.type==="VariableDeclarator"&&o(e.id),we=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),ke=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),_e=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),De=e=>e?.type==="FunctionDeclaration"&&o(e.id)&&o(e.body),Ce=e=>e?.type==="Program"&&Array.isArray(e.body),Pe=e=>e?.type==="SwitchStatement"&&o(e.discriminant)&&Array.isArray(e.cases),Fe=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),Ie=e=>e?.type==="WhileStatement"&&o(e.test)&&o(e.body),Oe=e=>e?.type==="ForStatement"&&"body"in e,je=e=>e?.type==="ForInStatement"&&o(e.left)&&o(e.right)&&o(e.body),Be=e=>e?.type==="ForOfStatement"&&o(e.left)&&o(e.right)&&o(e.body),Je=e=>e?.type==="DoWhileStatement"&&o(e.body)&&o(e.test),Le=e=>e?.type==="TryStatement"&&o(e.block),Xe=e=>e?.type==="CatchClause"&&o(e.body),Ve=e=>e?.type==="ThrowStatement"&&o(e.argument),Re=e=>e?.type==="TemplateElement"&&o(e.value),$e=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),ve=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&o(e.source),Me=e=>e?.type==="ImportSpecifier"&&o(e.imported)&&o(e.local),We=e=>e?.type==="ImportDefaultSpecifier"&&o(e.local),Ue=e=>e?.type==="ImportNamespaceSpecifier"&&o(e.local),Ke=e=>e?.type==="ModuleDeclaration",qe=e=>e?.type==="Directive",F=e=>e?.type==="Property"&&o(e.key)&&o(e.value),Ye=e=>F(e),ze=e=>typeof e?.type=="string";var Ge="createElement",Ze="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 He=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):l(e.name),e):e.type==="JSXNamespacedName"?c(n(`${e.namespace.name}:${e.name.name}`),e):c(t(O(e.object),c(l(e.property.name),e.property)),e)}function Qe(e){return e.type==="JSXNamespacedName"?c(n(`${e.namespace.name}:${e.name.name}`),e):c(He(e.name)?l(e.name):n(e.name),e)}function et(e,s){return e===null?c(n(true),s):e.type==="JSXExpressionContainer"?e.expression:e}var j=(e,s)=>c(s.emptyPropsAsObject?p([]):n(null),e);function tt(e,s,a){if(e.length===0)return j(s,a);let p$1=e.map(i=>i.type==="JSXSpreadAttribute"?c(r(i.argument),i):c(q(Qe(i.name),et(i.value,i)),i));return c(p(p$1),s)}function rt(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 nt(e){if(e.type==="JSXText"){let s=rt(e.value);return s===null?null:c(n(s),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e}function B(e,s$1={}){let a=e.type==="JSXFragment"?c(l(Ze),e.openingFragment):O(e.openingElement.name),p=e.type==="JSXFragment"?j(e.openingFragment,s$1):tt(e.openingElement.attributes,e.openingElement,s$1),i=e.children.map(nt).filter(r=>r!==null);return c(s(c(l(Ge),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};
|
|
1
|
+
import {a,g,l,s,b,Ca,n,t,p,r,q}from'./chunk-CW4CTN3N.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,Ba as json,ea as jsonExpression}from'./chunk-CW4CTN3N.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 c)return c[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}`)(Ca),r=(t,n,...m)=>{let d=[],T=false;return m.reverse().forEach(N=>{N===void 0?T&&d.push("false"):(d.push(a(N,t)),T=true);}),`${e}.${n}(${d.reverse().join(", ")})`},c={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),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:c}};var I={};a(I,{isArrayExpression:()=>pe,isArrayPattern:()=>_e,isArrowFunctionExpression:()=>se,isAssignmentExpression:()=>fe,isAssignmentProperty:()=>Ye,isAwaitExpression:()=>xe,isBinaryExpression:()=>ne,isBlockStatement:()=>Ee,isBreakStatement:()=>Ae,isCallExpression:()=>ie,isCatchClause:()=>Xe,isConditionalExpression:()=>ye,isContinueStatement:()=>Te,isDirective:()=>qe,isDoWhileStatement:()=>Je,isEmptyStatement:()=>Ne,isExpressionStatement:()=>Se,isForInStatement:()=>je,isForOfStatement:()=>Be,isForStatement:()=>Oe,isFunctionDeclaration:()=>Ce,isFunctionExpression:()=>oe,isIdentifier:()=>re,isIfStatement:()=>ge,isImportDeclaration:()=>ve,isImportDefaultSpecifier:()=>We,isImportNamespaceSpecifier:()=>Ue,isImportSpecifier:()=>Me,isJsonExpression:()=>de,isLiteral:()=>te,isLogicalExpression:()=>ce,isMemberExpression:()=>ue,isModuleDeclaration:()=>Ke,isNode:()=>ze,isObjectExpression:()=>ae,isObjectPattern:()=>ke,isProgram:()=>De,isProperty:()=>F,isReturnStatement:()=>be,isSwitchCase:()=>Fe,isSwitchStatement:()=>Pe,isTemplateElement:()=>Re,isTemplateLiteral:()=>$e,isThrowStatement:()=>Ve,isTryStatement:()=>Le,isUnaryExpression:()=>le,isUpdateExpression:()=>me,isVariableDeclaration:()=>we,isVariableDeclarator:()=>he,isWhileStatement:()=>Ie});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,c)=>{if(r!=null)if(Array.isArray(r))for(let t=0;t<r.length;t++)_(r[t])&&s(r[t],c,t);else _(r)&&s(r,c,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 C(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 c=s[i.type]??s["*"],t=false;if(c){let n=c(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 D(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,c=i.map(t=>{let n=p(t);return n!==t&&(r=true),n});return r?c:i}if(o(i)){let r=false,c={};for(let t in i){let n=i[t],m=p(n);c[t]=m,m!==n&&(r=true);}return r?c: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),ye=e=>e?.type==="ConditionalExpression"&&o(e.test)&&o(e.consequent)&&o(e.alternate),ce=e=>e?.type==="LogicalExpression"&&o(e.left)&&o(e.right)&&typeof e.operator=="string",le=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==="JsonExpression"&&o(e.body),Se=e=>e?.type==="ExpressionStatement"&&o(e.expression),Ee=e=>e?.type==="BlockStatement"&&Array.isArray(e.body),be=e=>e?.type==="ReturnStatement",ge=e=>e?.type==="IfStatement"&&o(e.test)&&o(e.consequent),Ae=e=>e?.type==="BreakStatement",Te=e=>e?.type==="ContinueStatement",Ne=e=>e?.type==="EmptyStatement",he=e=>e?.type==="VariableDeclarator"&&o(e.id),we=e=>e?.type==="VariableDeclaration"&&Array.isArray(e.declarations),ke=e=>e?.type==="ObjectPattern"&&Array.isArray(e.properties),_e=e=>e?.type==="ArrayPattern"&&Array.isArray(e.elements),Ce=e=>e?.type==="FunctionDeclaration"&&o(e.id)&&o(e.body),De=e=>e?.type==="Program"&&Array.isArray(e.body),Pe=e=>e?.type==="SwitchStatement"&&o(e.discriminant)&&Array.isArray(e.cases),Fe=e=>e?.type==="SwitchCase"&&Array.isArray(e.consequent),Ie=e=>e?.type==="WhileStatement"&&o(e.test)&&o(e.body),Oe=e=>e?.type==="ForStatement"&&"body"in e,je=e=>e?.type==="ForInStatement"&&o(e.left)&&o(e.right)&&o(e.body),Be=e=>e?.type==="ForOfStatement"&&o(e.left)&&o(e.right)&&o(e.body),Je=e=>e?.type==="DoWhileStatement"&&o(e.body)&&o(e.test),Le=e=>e?.type==="TryStatement"&&o(e.block),Xe=e=>e?.type==="CatchClause"&&o(e.body),Ve=e=>e?.type==="ThrowStatement"&&o(e.argument),Re=e=>e?.type==="TemplateElement"&&o(e.value),$e=e=>e?.type==="TemplateLiteral"&&Array.isArray(e.quasis)&&Array.isArray(e.expressions),ve=e=>e?.type==="ImportDeclaration"&&Array.isArray(e.specifiers)&&o(e.source),Me=e=>e?.type==="ImportSpecifier"&&o(e.imported)&&o(e.local),We=e=>e?.type==="ImportDefaultSpecifier"&&o(e.local),Ue=e=>e?.type==="ImportNamespaceSpecifier"&&o(e.local),Ke=e=>e?.type==="ModuleDeclaration",qe=e=>e?.type==="Directive",F=e=>e?.type==="Property"&&o(e.key)&&o(e.value),Ye=e=>F(e),ze=e=>typeof e?.type=="string";var Ge="createElement",Ze="Fragment";function y(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 He=e=>/^[a-zA-Z_$][\w$]*$/.test(e);function O(e){return e.type==="JSXIdentifier"?y(/^[a-z]/.test(e.name)||e.name.includes("-")?n(e.name):l(e.name),e):e.type==="JSXNamespacedName"?y(n(`${e.namespace.name}:${e.name.name}`),e):y(t(O(e.object),y(l(e.property.name),e.property)),e)}function Qe(e){return e.type==="JSXNamespacedName"?y(n(`${e.namespace.name}:${e.name.name}`),e):y(He(e.name)?l(e.name):n(e.name),e)}function et(e,s){return e===null?y(n(true),s):e.type==="JSXExpressionContainer"?e.expression:e}var j=(e,s)=>y(s.emptyPropsAsObject?p([]):n(null),e);function tt(e,s,a){if(e.length===0)return j(s,a);let p$1=e.map(i=>i.type==="JSXSpreadAttribute"?y(r(i.argument),i):y(q(Qe(i.name),et(i.value,i)),i));return y(p(p$1),s)}function rt(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 nt(e){if(e.type==="JSXText"){let s=rt(e.value);return s===null?null:y(n(s),e)}return e.type==="JSXExpressionContainer"?e.expression.type==="JSXEmptyExpression"?null:e.expression:e.type==="JSXSpreadChild"?y(r(e.expression),e):e}function B(e,s$1={}){let a=e.type==="JSXFragment"?y(l(Ze),e.openingFragment):O(e.openingElement.name),p=e.type==="JSXFragment"?j(e.openingFragment,s$1):tt(e.openingElement.attributes,e.openingElement,s$1),i=e.children.map(nt).filter(r=>r!==null);return y(s(y(l(Ge),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,C as childrenOf,B as desugarJSX,D 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
package/dist/chunk-KFFODSKH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var y=Object.defineProperty;var d=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:true});};var Te={};d(Te,{arrayExpression:()=>J,arrayPattern:()=>oe,arrowFunctionExpression:()=>B,assignmentExpression:()=>F,assignmentPattern:()=>pe,assignmentProperty:()=>se,awaitExpression:()=>L,binaryExpression:()=>P,blockStatement:()=>M,breakStatement:()=>$,callExpression:()=>h,catchClause:()=>H,chainExpression:()=>D,conditionalExpression:()=>O,continueStatement:()=>z,doWhileStatement:()=>te,emptyStatement:()=>K,exportDefaultDeclaration:()=>ye,exportNamedDeclaration:()=>Se,exportSpecifier:()=>de,expr:()=>u,expressionStatement:()=>V,forInStatement:()=>G,forOfStatement:()=>Q,forStatement:()=>Z,fromExprMarker:()=>g,functionDeclaration:()=>j,functionExpression:()=>R,identifier:()=>f,ifStatement:()=>q,importDeclaration:()=>me,importDefaultSpecifier:()=>ce,importNamespaceSpecifier:()=>Ee,importSpecifier:()=>xe,json:()=>we,jsonExpression:()=>c,jsxAttribute:()=>Ae,jsxClosingElement:()=>he,jsxClosingFragment:()=>S,jsxElement:()=>De,jsxEmptyExpression:()=>be,jsxExpressionContainer:()=>Je,jsxFragment:()=>Pe,jsxIdentifier:()=>ue,jsxMemberExpression:()=>ge,jsxNamespacedName:()=>fe,jsxOpeningElement:()=>Ce,jsxOpeningFragment:()=>E,jsxSpreadAttribute:()=>Xe,jsxText:()=>Ie,literal:()=>m,logicalExpression:()=>w,memberExpression:()=>I,objectExpression:()=>X,objectPattern:()=>ie,placeholder:()=>b,program:()=>le,property:()=>A,restElement:()=>ae,returnStatement:()=>U,spreadElement:()=>C,switchCase:()=>_,switchStatement:()=>v,templateElement:()=>N,templateLiteral:()=>k,throwStatement:()=>W,tryStatement:()=>Y,unaryExpression:()=>x,updateExpression:()=>T,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 Ne=/^[a-zA-Z_][a-zA-Z_0-9]*$/,a=["Identifier","MemberExpression","CallExpression","ArrowFunctionExpression","BinaryExpression","LogicalExpression","UnaryExpression","UpdateExpression","ConditionalExpression","AssignmentExpression","ArrayExpression","ObjectExpression","AwaitExpression","TemplateLiteral","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 of the Language 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"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],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"],Placeholder:[],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["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"],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 u=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}},g=e=>{if(!e||typeof e!="object"||!("#expr"in e))return e;let{"#expr":t,...n}=e;return {type:t,...n}},f=e=>({type:"Identifier",name:e}),b=()=>({type:"Placeholder"});function m(e){return e instanceof RegExp?{type:"Literal",value:e,regex:{pattern:e.source,flags:e.flags}}:typeof e=="bigint"?{type:"Literal",value:e,bigint:String(e)}:typeof e=="number"&&Number.isFinite(e)&&(e<0||Object.is(e,-0))?x("-",m(-e)):{type:"Literal",value:e}}var J=e=>({type:"ArrayExpression",elements:e}),X=e=>({type:"ObjectExpression",properties:e}),A=(e,t,n=false,i=false)=>({type:"Property",shorthand:n,computed:i,key:e,value:t,kind:"init"}),C=e=>({type:"SpreadElement",argument:e}),h=(e,t,n=false)=>({type:"CallExpression",callee:e,arguments:t,optional:n}),I=(e,t,n=false,i=false)=>({type:"MemberExpression",object:e,property:t,computed:n,optional:i}),D=e=>({type:"ChainExpression",expression:e}),P=(e,t,n)=>({type:"BinaryExpression",left:t,right:n,operator:e}),w=(e,t,n)=>({type:"LogicalExpression",operator:e,left:t,right:n}),x=(e,t)=>({type:"UnaryExpression",operator:e,argument:t,prefix:true}),T=(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}),L=e=>({type:"AwaitExpression",argument:e}),N=(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}),U=e=>({type:"ReturnStatement",argument:e}),q=(e,t,n=null)=>({type:"IfStatement",test:e,consequent:t,alternate:n}),v=(e,t)=>({type:"SwitchStatement",cases:t,discriminant:e}),_=(e,t)=>({type:"SwitchCase",consequent:t,test:e}),W=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}),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}),c=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}),he=e=>({type:"JSXClosingElement",name:e}),E=()=>({type:"JSXOpeningFragment"}),S=()=>({type:"JSXClosingFragment"}),Ie=(e,t=e)=>({type:"JSXText",value:e,raw:t}),De=(e,t=[],n=null)=>({type:"JSXElement",openingElement:e,children:t,closingElement:n}),Pe=(e=[],t=E(),n=S())=>({type:"JSXFragment",openingFragment:t,children:e,closingFragment:n}),we=c;export{oe as $,O as A,we as Aa,L as B,Te as Ba,N as C,k as D,B as E,R as F,j as G,M as H,V as I,U as J,q as K,v as L,_ as M,W 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 _,d as a,se as aa,o as b,ae as ba,Ne as c,pe as ca,a as d,le as da,p as e,c 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,u as j,Se as ja,g as k,ye as ka,f as l,de as la,b as m,ue as ma,m as n,ge as na,J as o,fe as oa,X as p,be as pa,A as q,Je as qa,C as r,Xe as ra,h as s,Ae as sa,I as t,Ce as ta,D as u,he as ua,P as v,E as va,w,S as wa,x,Ie as xa,T as y,De as ya,F as z,Pe as za};
|