@tslite/printer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +1 -0
- package/package.json +59 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var core=require('@tslite/core'),capability=require('@tslite/capability');var B=t=>core.VALID_OBJECT_KEY.test(t);function f(t){let r=n=>{if(typeof n=="string")return `"${n}"`;if(typeof n!="object")return String(n);if(n===null)return "null";if(Array.isArray(n))return `[${n.map(r).join(",")}]`;let s=n;if(core.AST_MARKER in s){let i=s[core.AST_MARKER],{[core.AST_MARKER]:y,...h}=s,A={type:i,...h};return e(A)}return `{ ${Object.entries(s).map(([i,y])=>`${B(i)?i:`"${i}"`}: ${r(y)}`).join(", ")} }`};return r(t)}var $=", ",l=null,e=t=>{if(t==null)return "";if(Array.isArray(t))return t.filter(Boolean).map(e).join($);if(typeof t!="object")return String(t);if(!t.type)return JSON.stringify(t);if(t.type in E){if(l){let r=capability.nodeViolation(t,l);if(r)throw new core.TSLiteError("node-not-allowed",`'${r}' is not allowed by the active capability profile.`,{type:t.type})}return E[t.type](t)}throw Error("Unknown type: "+t.type)},C=(t,r)=>{let n=l;l=capability.compileProfile(r);try{return e(t)}finally{l=n;}},a=t=>`(${t})`,k=new Set(["Identifier","ThisExpression","ArrayExpression","MemberExpression","CallExpression","NewExpression","TemplateLiteral"]),u=t=>{if(t.type==="TSAsExpression")return u(t.expression);let r=e(t);if(k.has(t.type))return r;if(t.type==="Literal"){let n=t;return typeof n.value=="number"||n.bigint!=null?a(r):r}return a(r)},F=t=>`[${e(t.elements)}]`,D=t=>`[${e(t.elements)}]`,L=t=>{let r=e(t.params),n=t.body.type=="AssignmentExpression"||t.body.type=="BinaryExpression"||t.body.type=="ObjectExpression"||t.body.type=="JsonExpression"?a(e(t.body)):e(t.body);return `${t.async?"async ":""}(${r}) => ${n}`},O=t=>{let r=e(t.left),n=e(t.right);return `${r} ${t.operator} ${n}`},v=t=>"await "+c(t.argument,core.Precedence.Await,false),S=t=>t.type==="TSAsExpression"?S(t.expression):t,R=t=>{let r=S(t);return r.type==="UnaryExpression"||r.type==="AwaitExpression"},W=(t,r)=>{let n=S(r);if(n.type!=="LogicalExpression")return false;let s=n.operator;return t==="??"?s==="||"||s==="&&":t==="||"||t==="&&"?s==="??":false},J=t=>{let r=core.BinaryPrecedence[t.operator]??1/0,n=t.operator==="**",s=c(t.left,r,false,n),p=n&&(R(t.left)||s[0]==="-"||s[0]==="+")?a(s):s,i=c(t.right,r,true,n);return `${p} ${t.operator} ${i}`},_=t=>{let r=t.body.map(e).filter(n=>n&&n!==";").join("; ");return `{ ${r?r+"; ":""}}`},U=t=>t.label?`break ${e(t.label)}`:"break",q=t=>{let r=u(t.callee),n=t.optional?"?.":"";return `${r}${n}(${e(t.arguments)})`},V=t=>e(t.expression),T=t=>t.type==="BinaryExpression"||t.type==="LogicalExpression"?core.BinaryPrecedence[t.operator]??1/0:t.type==="ConditionalExpression"?core.Precedence.Conditional:t.type==="AssignmentExpression"?core.Precedence.Assignment:t.type==="ArrowFunctionExpression"?core.Precedence.ArrowFunction:t.type==="AwaitExpression"?core.Precedence.Await:t.type==="SequenceExpression"?core.Precedence.Sequence:t.type==="TSAsExpression"?T(t.expression):1/0,c=(t,r,n,s=false)=>{let p=e(t),i=T(t);return (n?s?i<r:i<=r:s?i<=r:i<r)?a(p):p},M=t=>`${c(t.test,core.Precedence.Conditional,false,true)} ? ${e(t.consequent)} : ${e(t.alternate)}`,K=t=>t.label?`continue ${e(t.label)}`:"continue",z=t=>{let r=e(t.expression);return r[0]==="{"||r.startsWith("function")||r.startsWith("class")?a(r):r},Y=t=>";",G=t=>`do ${e(t.body)} while (${e(t.test)})`,H=t=>`for (${e(t.left)} in ${e(t.right)}) ${e(t.body)}`,Q=t=>`for${t.await?" await":""} (${e(t.left)} of ${e(t.right)}) ${e(t.body)}`,X=t=>{let r=e(t.init),n=e(t.test),s=e(t.update);return `for (${r};${n?` ${n}`:""};${s?` ${s}`:""}) ${e(t.body)}`},Z=t=>{let r=t.params.map(g).join($);return `${t.async?"async ":""}function ${e(t.id)}(${r}) ${e(t.body)}`},d=t=>{let r=e(t.params);return `${t.async?"async ":""}function ${e(t.id)}(${r}) ${e(t.body)}`},g=t=>t.name,tt=t=>`if (${e(t.test)}) ${e(t.consequent)}${t.alternate?` else ${e(t.alternate)}`:""}`,et=t=>f(t.body),rt=t=>t.raw?t.raw:t.value===void 0?"undefined":t.value===null?"null":typeof t.value=="string"?JSON.stringify(t.value):typeof t.value=="boolean"?String(t.value):t.bigint?t.bigint+"n":t.regex?`/${t.regex.pattern}/${t.regex.flags}`:(t.value instanceof RegExp,String(t.value)),nt=t=>{let r=core.BinaryPrecedence[t.operator]??1/0,n=(s,p)=>W(t.operator,s)?a(e(s)):c(s,r,p);return `${n(t.left,false)} ${t.operator} ${n(t.right,true)}`},st=t=>{let r=[u(t.object)];return t.optional&&r.push(t.computed?"?.":"?"),r.push(t.computed?"[":"."),r.push(e(t.property)),t.computed&&r.push("]"),r.join("")},it=t=>`new ${u(t.callee)}(${e(t.arguments)})`,ot=t=>{let r=t.properties.map(e).join(", ");return r.length==0?"{}":`{ ${r} }`},pt=t=>{let r=t.properties.map(e).join(", ");return r.length==0?"{ }":`{ ${r} }`},at=new Set(["FunctionDeclaration","IfStatement","ForStatement","ForInStatement","ForOfStatement","WhileStatement","TryStatement","SwitchStatement","ClassDeclaration"]),ct=t=>t.body.map(r=>{let n=e(r);return n?at.has(r.type)?n:n+";":""}).filter(Boolean).join(" "),lt=t=>`${t.computed?`[${e(t.key)}]`:e(t.key)}: ${e(t.value)}`,ut=t=>"return "+e(t.argument),yt=t=>(t.test?`case ${e(t.test)}: `:" default: ")+t.consequent.map(e).join("; "),mt=t=>`switch (${e(t.discriminant)}) { ${t.cases.map(e).join("; ")}; }`,ft=t=>t.value.raw,xt=t=>"`"+t.quasis.map((r,n)=>e(r)+(r.tail?"":"${"+e(t.expressions[n])+"}")).join("")+"`",$t=t=>"throw "+e(t.argument),St=t=>{let r=`try ${e(t.block)}`;if(t.handler){let n=t.handler.param;r+=n?` catch (${e(n)}) ${e(t.handler.body)}`:` catch ${e(t.handler.body)}`;}return r+(t.finalizer?` finally ${e(t.finalizer)}`:"")},Et=t=>{let r=c(t.argument,core.Precedence.Unary,false),n=t.operator.length>1||(t.operator==="+"||t.operator==="-")&&r[0]===t.operator?" ":"";return t.operator+n+r},Tt=t=>t.prefix==true?t.operator+e(t.argument):e(t.argument)+t.operator,gt=t=>`${t.kind} ${t.declarations.map(b).join(", ")}`,b=t=>t.init?`${e(t.id)} = ${e(t.init)}`:e(t.id),bt=t=>`while (${e(t.test)}) ${e(t.body)}`,wt=t=>{let r=e(t.source);return t.specifiers.length==0?`import ${r}`:t.specifiers[0].type=="ImportNamespaceSpecifier"?`import ${e(t.specifiers[0])} from ${r}`:t.specifiers[0].type=="ImportDefaultSpecifier"?`import ${e(t.specifiers[0])} from ${r}`:`import { ${t.specifiers.filter(s=>s.type==="ImportSpecifier").map(w).join($)} } from ${r}`},ht=t=>e(t.local),At=t=>`* as ${e(t.local)}`,w=t=>t.imported.name===t.local.name?`${e(t.local)}`:`${e(t.imported)} as ${e(t.local)}`,It=t=>`...${e(t.argument)}`,Bt=t=>`...${e(t.argument)}`,jt=()=>"",Nt=t=>e(t.expression),E={print:e,ArrayExpression:F,ArrayPattern:D,ArrowFunctionExpression:L,AssignmentExpression:O,AwaitExpression:v,BinaryExpression:J,BlockStatement:_,BreakStatement:U,CallExpression:q,ChainExpression:V,ConditionalExpression:M,ContinueStatement:K,DoWhileStatement:G,EmptyStatement:Y,ExpressionStatement:z,ForInStatement:H,ForOfStatement:Q,ForStatement:X,FunctionDeclaration:Z,FunctionExpression:d,Identifier:g,IfStatement:tt,ImportDeclaration:wt,ImportDefaultSpecifier:ht,ImportNamespaceSpecifier:At,ImportSpecifier:w,JsonExpression:et,Literal:rt,LogicalExpression:nt,MemberExpression:st,NewExpression:it,ObjectExpression:ot,ObjectPattern:pt,Program:ct,Property:lt,ReturnStatement:ut,SwitchCase:yt,SwitchStatement:mt,TemplateElement:ft,TemplateLiteral:xt,ThrowStatement:$t,TryStatement:St,UnaryExpression:Et,UpdateExpression:Tt,VariableDeclaration:gt,VariableDeclarator:b,WhileStatement:bt,SpreadElement:It,RestElement:Bt,TSTypeAliasDeclaration:jt,TSAsExpression:Nt};exports.print=e;exports.printJson=f;exports.printWithProfile=C;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseNode, TSLite } from '@tslite/core';
|
|
2
|
+
import { CapabilityProfile } from '@tslite/capability';
|
|
3
|
+
|
|
4
|
+
type PrintInput = BaseNode | BaseNode[] | (BaseNode | null)[] | null | undefined;
|
|
5
|
+
declare const print: (node: PrintInput) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Printer **sob-contrato** (D37): emite só o que o `profile` permite e **recusa o
|
|
8
|
+
* resto** (lança `node-not-allowed`). É o limite hard do lado JIT — simétrico ao
|
|
9
|
+
* `evaluate(ast, env, { profile })` do interpret. O `print` padrão (standalone)
|
|
10
|
+
* segue emitindo qualquer nó.
|
|
11
|
+
*/
|
|
12
|
+
declare const printWithProfile: (ast: PrintInput, profile: CapabilityProfile) => string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Prints the hybrid JSON form (a value with `#ast` islands) as JS source.
|
|
16
|
+
*
|
|
17
|
+
* Static data is emitted as an object/array literal; each `#ast` island is
|
|
18
|
+
* handed back to `print()` — the same `#ast` boundary the type layer walks.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* printJson({ name: "John", init: { "#ast": "CallExpression", ... } })
|
|
22
|
+
* // '{ name: "John", init: setup() }'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function printJson(node: TSLite): string;
|
|
26
|
+
|
|
27
|
+
export { print, printJson, printWithProfile };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseNode, TSLite } from '@tslite/core';
|
|
2
|
+
import { CapabilityProfile } from '@tslite/capability';
|
|
3
|
+
|
|
4
|
+
type PrintInput = BaseNode | BaseNode[] | (BaseNode | null)[] | null | undefined;
|
|
5
|
+
declare const print: (node: PrintInput) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Printer **sob-contrato** (D37): emite só o que o `profile` permite e **recusa o
|
|
8
|
+
* resto** (lança `node-not-allowed`). É o limite hard do lado JIT — simétrico ao
|
|
9
|
+
* `evaluate(ast, env, { profile })` do interpret. O `print` padrão (standalone)
|
|
10
|
+
* segue emitindo qualquer nó.
|
|
11
|
+
*/
|
|
12
|
+
declare const printWithProfile: (ast: PrintInput, profile: CapabilityProfile) => string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Prints the hybrid JSON form (a value with `#ast` islands) as JS source.
|
|
16
|
+
*
|
|
17
|
+
* Static data is emitted as an object/array literal; each `#ast` island is
|
|
18
|
+
* handed back to `print()` — the same `#ast` boundary the type layer walks.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* printJson({ name: "John", init: { "#ast": "CallExpression", ... } })
|
|
22
|
+
* // '{ name: "John", init: setup() }'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function printJson(node: TSLite): string;
|
|
26
|
+
|
|
27
|
+
export { print, printJson, printWithProfile };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {Precedence,BinaryPrecedence,TSLiteError,AST_MARKER,VALID_OBJECT_KEY}from'@tslite/core';import {compileProfile,nodeViolation}from'@tslite/capability';var B=t=>VALID_OBJECT_KEY.test(t);function f(t){let r=n=>{if(typeof n=="string")return `"${n}"`;if(typeof n!="object")return String(n);if(n===null)return "null";if(Array.isArray(n))return `[${n.map(r).join(",")}]`;let s=n;if(AST_MARKER in s){let i=s[AST_MARKER],{[AST_MARKER]:y,...h}=s,A={type:i,...h};return e(A)}return `{ ${Object.entries(s).map(([i,y])=>`${B(i)?i:`"${i}"`}: ${r(y)}`).join(", ")} }`};return r(t)}var $=", ",l=null,e=t=>{if(t==null)return "";if(Array.isArray(t))return t.filter(Boolean).map(e).join($);if(typeof t!="object")return String(t);if(!t.type)return JSON.stringify(t);if(t.type in E){if(l){let r=nodeViolation(t,l);if(r)throw new TSLiteError("node-not-allowed",`'${r}' is not allowed by the active capability profile.`,{type:t.type})}return E[t.type](t)}throw Error("Unknown type: "+t.type)},C=(t,r)=>{let n=l;l=compileProfile(r);try{return e(t)}finally{l=n;}},a=t=>`(${t})`,k=new Set(["Identifier","ThisExpression","ArrayExpression","MemberExpression","CallExpression","NewExpression","TemplateLiteral"]),u=t=>{if(t.type==="TSAsExpression")return u(t.expression);let r=e(t);if(k.has(t.type))return r;if(t.type==="Literal"){let n=t;return typeof n.value=="number"||n.bigint!=null?a(r):r}return a(r)},F=t=>`[${e(t.elements)}]`,D=t=>`[${e(t.elements)}]`,L=t=>{let r=e(t.params),n=t.body.type=="AssignmentExpression"||t.body.type=="BinaryExpression"||t.body.type=="ObjectExpression"||t.body.type=="JsonExpression"?a(e(t.body)):e(t.body);return `${t.async?"async ":""}(${r}) => ${n}`},O=t=>{let r=e(t.left),n=e(t.right);return `${r} ${t.operator} ${n}`},v=t=>"await "+c(t.argument,Precedence.Await,false),S=t=>t.type==="TSAsExpression"?S(t.expression):t,R=t=>{let r=S(t);return r.type==="UnaryExpression"||r.type==="AwaitExpression"},W=(t,r)=>{let n=S(r);if(n.type!=="LogicalExpression")return false;let s=n.operator;return t==="??"?s==="||"||s==="&&":t==="||"||t==="&&"?s==="??":false},J=t=>{let r=BinaryPrecedence[t.operator]??1/0,n=t.operator==="**",s=c(t.left,r,false,n),p=n&&(R(t.left)||s[0]==="-"||s[0]==="+")?a(s):s,i=c(t.right,r,true,n);return `${p} ${t.operator} ${i}`},_=t=>{let r=t.body.map(e).filter(n=>n&&n!==";").join("; ");return `{ ${r?r+"; ":""}}`},U=t=>t.label?`break ${e(t.label)}`:"break",q=t=>{let r=u(t.callee),n=t.optional?"?.":"";return `${r}${n}(${e(t.arguments)})`},V=t=>e(t.expression),T=t=>t.type==="BinaryExpression"||t.type==="LogicalExpression"?BinaryPrecedence[t.operator]??1/0:t.type==="ConditionalExpression"?Precedence.Conditional:t.type==="AssignmentExpression"?Precedence.Assignment:t.type==="ArrowFunctionExpression"?Precedence.ArrowFunction:t.type==="AwaitExpression"?Precedence.Await:t.type==="SequenceExpression"?Precedence.Sequence:t.type==="TSAsExpression"?T(t.expression):1/0,c=(t,r,n,s=false)=>{let p=e(t),i=T(t);return (n?s?i<r:i<=r:s?i<=r:i<r)?a(p):p},M=t=>`${c(t.test,Precedence.Conditional,false,true)} ? ${e(t.consequent)} : ${e(t.alternate)}`,K=t=>t.label?`continue ${e(t.label)}`:"continue",z=t=>{let r=e(t.expression);return r[0]==="{"||r.startsWith("function")||r.startsWith("class")?a(r):r},Y=t=>";",G=t=>`do ${e(t.body)} while (${e(t.test)})`,H=t=>`for (${e(t.left)} in ${e(t.right)}) ${e(t.body)}`,Q=t=>`for${t.await?" await":""} (${e(t.left)} of ${e(t.right)}) ${e(t.body)}`,X=t=>{let r=e(t.init),n=e(t.test),s=e(t.update);return `for (${r};${n?` ${n}`:""};${s?` ${s}`:""}) ${e(t.body)}`},Z=t=>{let r=t.params.map(g).join($);return `${t.async?"async ":""}function ${e(t.id)}(${r}) ${e(t.body)}`},d=t=>{let r=e(t.params);return `${t.async?"async ":""}function ${e(t.id)}(${r}) ${e(t.body)}`},g=t=>t.name,tt=t=>`if (${e(t.test)}) ${e(t.consequent)}${t.alternate?` else ${e(t.alternate)}`:""}`,et=t=>f(t.body),rt=t=>t.raw?t.raw:t.value===void 0?"undefined":t.value===null?"null":typeof t.value=="string"?JSON.stringify(t.value):typeof t.value=="boolean"?String(t.value):t.bigint?t.bigint+"n":t.regex?`/${t.regex.pattern}/${t.regex.flags}`:(t.value instanceof RegExp,String(t.value)),nt=t=>{let r=BinaryPrecedence[t.operator]??1/0,n=(s,p)=>W(t.operator,s)?a(e(s)):c(s,r,p);return `${n(t.left,false)} ${t.operator} ${n(t.right,true)}`},st=t=>{let r=[u(t.object)];return t.optional&&r.push(t.computed?"?.":"?"),r.push(t.computed?"[":"."),r.push(e(t.property)),t.computed&&r.push("]"),r.join("")},it=t=>`new ${u(t.callee)}(${e(t.arguments)})`,ot=t=>{let r=t.properties.map(e).join(", ");return r.length==0?"{}":`{ ${r} }`},pt=t=>{let r=t.properties.map(e).join(", ");return r.length==0?"{ }":`{ ${r} }`},at=new Set(["FunctionDeclaration","IfStatement","ForStatement","ForInStatement","ForOfStatement","WhileStatement","TryStatement","SwitchStatement","ClassDeclaration"]),ct=t=>t.body.map(r=>{let n=e(r);return n?at.has(r.type)?n:n+";":""}).filter(Boolean).join(" "),lt=t=>`${t.computed?`[${e(t.key)}]`:e(t.key)}: ${e(t.value)}`,ut=t=>"return "+e(t.argument),yt=t=>(t.test?`case ${e(t.test)}: `:" default: ")+t.consequent.map(e).join("; "),mt=t=>`switch (${e(t.discriminant)}) { ${t.cases.map(e).join("; ")}; }`,ft=t=>t.value.raw,xt=t=>"`"+t.quasis.map((r,n)=>e(r)+(r.tail?"":"${"+e(t.expressions[n])+"}")).join("")+"`",$t=t=>"throw "+e(t.argument),St=t=>{let r=`try ${e(t.block)}`;if(t.handler){let n=t.handler.param;r+=n?` catch (${e(n)}) ${e(t.handler.body)}`:` catch ${e(t.handler.body)}`;}return r+(t.finalizer?` finally ${e(t.finalizer)}`:"")},Et=t=>{let r=c(t.argument,Precedence.Unary,false),n=t.operator.length>1||(t.operator==="+"||t.operator==="-")&&r[0]===t.operator?" ":"";return t.operator+n+r},Tt=t=>t.prefix==true?t.operator+e(t.argument):e(t.argument)+t.operator,gt=t=>`${t.kind} ${t.declarations.map(b).join(", ")}`,b=t=>t.init?`${e(t.id)} = ${e(t.init)}`:e(t.id),bt=t=>`while (${e(t.test)}) ${e(t.body)}`,wt=t=>{let r=e(t.source);return t.specifiers.length==0?`import ${r}`:t.specifiers[0].type=="ImportNamespaceSpecifier"?`import ${e(t.specifiers[0])} from ${r}`:t.specifiers[0].type=="ImportDefaultSpecifier"?`import ${e(t.specifiers[0])} from ${r}`:`import { ${t.specifiers.filter(s=>s.type==="ImportSpecifier").map(w).join($)} } from ${r}`},ht=t=>e(t.local),At=t=>`* as ${e(t.local)}`,w=t=>t.imported.name===t.local.name?`${e(t.local)}`:`${e(t.imported)} as ${e(t.local)}`,It=t=>`...${e(t.argument)}`,Bt=t=>`...${e(t.argument)}`,jt=()=>"",Nt=t=>e(t.expression),E={print:e,ArrayExpression:F,ArrayPattern:D,ArrowFunctionExpression:L,AssignmentExpression:O,AwaitExpression:v,BinaryExpression:J,BlockStatement:_,BreakStatement:U,CallExpression:q,ChainExpression:V,ConditionalExpression:M,ContinueStatement:K,DoWhileStatement:G,EmptyStatement:Y,ExpressionStatement:z,ForInStatement:H,ForOfStatement:Q,ForStatement:X,FunctionDeclaration:Z,FunctionExpression:d,Identifier:g,IfStatement:tt,ImportDeclaration:wt,ImportDefaultSpecifier:ht,ImportNamespaceSpecifier:At,ImportSpecifier:w,JsonExpression:et,Literal:rt,LogicalExpression:nt,MemberExpression:st,NewExpression:it,ObjectExpression:ot,ObjectPattern:pt,Program:ct,Property:lt,ReturnStatement:ut,SwitchCase:yt,SwitchStatement:mt,TemplateElement:ft,TemplateLiteral:xt,ThrowStatement:$t,TryStatement:St,UnaryExpression:Et,UpdateExpression:Tt,VariableDeclaration:gt,VariableDeclarator:b,WhileStatement:bt,SpreadElement:It,RestElement:Bt,TSTypeAliasDeclaration:jt,TSAsExpression:Nt};export{e as print,f as printJson,C as printWithProfile};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tslite/printer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TSLite printer — emits JavaScript source from an AST (and from the hybrid #ast JSON form)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/andersondrosa/tslite.git",
|
|
26
|
+
"directory": "packages/printer"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"ast",
|
|
30
|
+
"estree",
|
|
31
|
+
"codegen",
|
|
32
|
+
"printer",
|
|
33
|
+
"emit",
|
|
34
|
+
"code-generation",
|
|
35
|
+
"typescript"
|
|
36
|
+
],
|
|
37
|
+
"author": "Anderson D. Rosa <andersondrosa@outlook.com>",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@tslite/capability": "0.1.0",
|
|
44
|
+
"@tslite/core": "0.1.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"dev": "tsup --watch",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:watch": "vitest",
|
|
51
|
+
"test:coverage": "vitest run --coverage",
|
|
52
|
+
"typecheck": "tsc --noEmit",
|
|
53
|
+
"lint": "eslint src",
|
|
54
|
+
"lint:fix": "eslint src --fix",
|
|
55
|
+
"clean": "rm -rf dist",
|
|
56
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
57
|
+
"format:check": "prettier --check \"src/**/*.ts\""
|
|
58
|
+
}
|
|
59
|
+
}
|