@nubjs/nub-linux-x64 0.0.14 → 0.0.16

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.
Files changed (70) hide show
  1. package/bin/nub +0 -0
  2. package/package.json +1 -1
  3. package/runtime/addons/nub-native.node +0 -0
  4. package/runtime/preload-async-hooks.mjs +5 -6
  5. package/runtime/preload.cjs +10 -6
  6. package/runtime/preload.mjs +22 -11
  7. package/runtime/transform-core.mjs +183 -521
  8. package/runtime/version.mjs +1 -1
  9. package/runtime/worker-polyfill.mjs +15 -2
  10. package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md +0 -3
  11. package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json +0 -42
  12. package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node +0 -0
  13. package/runtime/node_modules/@oxc-project/types/LICENSE +0 -22
  14. package/runtime/node_modules/@oxc-project/types/README.md +0 -3
  15. package/runtime/node_modules/@oxc-project/types/package.json +0 -26
  16. package/runtime/node_modules/@oxc-project/types/types.d.ts +0 -1912
  17. package/runtime/node_modules/@oxc-transform/binding-linux-x64-gnu/README.md +0 -3
  18. package/runtime/node_modules/@oxc-transform/binding-linux-x64-gnu/package.json +0 -44
  19. package/runtime/node_modules/@oxc-transform/binding-linux-x64-gnu/transform.linux-x64-gnu.node +0 -0
  20. package/runtime/node_modules/get-tsconfig/LICENSE +0 -21
  21. package/runtime/node_modules/get-tsconfig/README.md +0 -268
  22. package/runtime/node_modules/get-tsconfig/dist/index.cjs +0 -7
  23. package/runtime/node_modules/get-tsconfig/dist/index.d.cts +0 -2116
  24. package/runtime/node_modules/get-tsconfig/dist/index.d.mts +0 -2116
  25. package/runtime/node_modules/get-tsconfig/dist/index.mjs +0 -7
  26. package/runtime/node_modules/get-tsconfig/package.json +0 -46
  27. package/runtime/node_modules/oxc-parser/LICENSE +0 -22
  28. package/runtime/node_modules/oxc-parser/README.md +0 -167
  29. package/runtime/node_modules/oxc-parser/package.json +0 -153
  30. package/runtime/node_modules/oxc-parser/src-js/bindings.js +0 -601
  31. package/runtime/node_modules/oxc-parser/src-js/generated/constants.js +0 -105
  32. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js.js +0 -5862
  33. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js_range.js +0 -6403
  34. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts.js +0 -6154
  35. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts_range.js +0 -6723
  36. package/runtime/node_modules/oxc-parser/src-js/generated/lazy/constructors.js +0 -13875
  37. package/runtime/node_modules/oxc-parser/src-js/generated/lazy/type_ids.js +0 -191
  38. package/runtime/node_modules/oxc-parser/src-js/generated/lazy/walk.js +0 -5810
  39. package/runtime/node_modules/oxc-parser/src-js/generated/visit/keys.js +0 -220
  40. package/runtime/node_modules/oxc-parser/src-js/generated/visit/type_ids.js +0 -177
  41. package/runtime/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts +0 -387
  42. package/runtime/node_modules/oxc-parser/src-js/generated/visit/walk.js +0 -2455
  43. package/runtime/node_modules/oxc-parser/src-js/index.d.ts +0 -312
  44. package/runtime/node_modules/oxc-parser/src-js/index.js +0 -108
  45. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/common.js +0 -301
  46. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/eager.js +0 -255
  47. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy-common.js +0 -11
  48. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy.js +0 -162
  49. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/node-array.js +0 -365
  50. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/supported.js +0 -52
  51. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/visitor.js +0 -127
  52. package/runtime/node_modules/oxc-parser/src-js/visit/index.js +0 -41
  53. package/runtime/node_modules/oxc-parser/src-js/visit/visitor.js +0 -405
  54. package/runtime/node_modules/oxc-parser/src-js/wasm.js +0 -13
  55. package/runtime/node_modules/oxc-parser/src-js/webcontainer-fallback.cjs +0 -21
  56. package/runtime/node_modules/oxc-parser/src-js/wrap.js +0 -57
  57. package/runtime/node_modules/oxc-transform/LICENSE +0 -22
  58. package/runtime/node_modules/oxc-transform/README.md +0 -84
  59. package/runtime/node_modules/oxc-transform/browser.js +0 -1
  60. package/runtime/node_modules/oxc-transform/index.d.ts +0 -658
  61. package/runtime/node_modules/oxc-transform/index.js +0 -598
  62. package/runtime/node_modules/oxc-transform/package.json +0 -114
  63. package/runtime/node_modules/oxc-transform/webcontainer-fallback.cjs +0 -21
  64. package/runtime/node_modules/resolve-pkg-maps/LICENSE +0 -21
  65. package/runtime/node_modules/resolve-pkg-maps/README.md +0 -216
  66. package/runtime/node_modules/resolve-pkg-maps/dist/index.cjs +0 -1
  67. package/runtime/node_modules/resolve-pkg-maps/dist/index.d.cts +0 -11
  68. package/runtime/node_modules/resolve-pkg-maps/dist/index.d.mts +0 -11
  69. package/runtime/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
  70. package/runtime/node_modules/resolve-pkg-maps/package.json +0 -42
@@ -1,7 +0,0 @@
1
- var xe=Object.defineProperty;var r=(e,t)=>xe(e,"name",{value:t,configurable:!0});import m from"node:path";import ce from"node:fs";import Be from"node:module";import{resolveExports as Ie}from"resolve-pkg-maps";import $e from"fs";import Ue from"os";import Re from"path";function h(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}r(h,"slash");const K=r(e=>{const t=ce[e];return(s,...n)=>{const o=`${e}:${n.join(":")}`;let l=s==null?void 0:s.get(o);return l===void 0&&(l=Reflect.apply(t,ce,n),s==null||s.set(o,l)),l}},"cacheFs"),x=K("existsSync"),Se=K("readFileSync"),Q=K("statSync"),O=r((e,t,s)=>{for(;;){const n=m.posix.join(e,t);if(x(s,n))return n;const o=m.dirname(e);if(o===e)return;e=o}},"findUp"),C=/^\.{1,2}(\/.*)?$/,H=r(e=>{const t=h(e);return C.test(t)?t:`./${t}`},"normalizeRelativePath");function Ne(e,t=!1){const s=e.length;let n=0,o="",l=0,i=16,f=0,u=0,g=0,w=0,d=0;function _(c,j){let y=0,T=0;for(;y<c;){let k=e.charCodeAt(n);if(k>=48&&k<=57)T=T*16+k-48;else if(k>=65&&k<=70)T=T*16+k-65+10;else if(k>=97&&k<=102)T=T*16+k-97+10;else break;n++,y++}return y<c&&(T=-1),T}r(_,"scanHexDigits");function v(c){n=c,o="",l=0,i=16,d=0}r(v,"setPosition");function p(){let c=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&R(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&R(e.charCodeAt(n)))for(n++;n<e.length&&R(e.charCodeAt(n));)n++;else return d=3,e.substring(c,n);let j=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&R(e.charCodeAt(n))){for(n++;n<e.length&&R(e.charCodeAt(n));)n++;j=n}else d=3;return e.substring(c,j)}r(p,"scanNumber");function L(){let c="",j=n;for(;;){if(n>=s){c+=e.substring(j,n),d=2;break}const y=e.charCodeAt(n);if(y===34){c+=e.substring(j,n),n++;break}if(y===92){if(c+=e.substring(j,n),n++,n>=s){d=2;break}switch(e.charCodeAt(n++)){case 34:c+='"';break;case 92:c+="\\";break;case 47:c+="/";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
2
- `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:const k=_(4);k>=0?c+=String.fromCharCode(k):d=4;break;default:d=5}j=n;continue}if(y>=0&&y<=31)if(J(y)){c+=e.substring(j,n),d=2;break}else d=6;n++}return c}r(L,"scanString");function A(){if(o="",d=0,l=n,u=f,w=g,n>=s)return l=s,i=17;let c=e.charCodeAt(n);if(ee(c)){do n++,o+=String.fromCharCode(c),c=e.charCodeAt(n);while(ee(c));return i=15}if(J(c))return n++,o+=String.fromCharCode(c),c===13&&e.charCodeAt(n)===10&&(n++,o+=`
3
- `),f++,g=n,i=14;switch(c){case 123:return n++,i=1;case 125:return n++,i=2;case 91:return n++,i=3;case 93:return n++,i=4;case 58:return n++,i=6;case 44:return n++,i=5;case 34:return n++,o=L(),i=10;case 47:const j=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<s&&!J(e.charCodeAt(n));)n++;return o=e.substring(j,n),i=12}if(e.charCodeAt(n+1)===42){n+=2;const y=s-1;let T=!1;for(;n<y;){const k=e.charCodeAt(n);if(k===42&&e.charCodeAt(n+1)===47){n+=2,T=!0;break}n++,J(k)&&(k===13&&e.charCodeAt(n)===10&&n++,f++,g=n)}return T||(n++,d=1),o=e.substring(j,n),i=13}return o+=String.fromCharCode(c),n++,i=16;case 45:if(o+=String.fromCharCode(c),n++,n===s||!R(e.charCodeAt(n)))return i=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=p(),i=11;default:for(;n<s&&D(c);)n++,c=e.charCodeAt(n);if(l!==n){switch(o=e.substring(l,n),o){case"true":return i=8;case"false":return i=9;case"null":return i=7}return i=16}return o+=String.fromCharCode(c),n++,i=16}}r(A,"scanNext");function D(c){if(ee(c)||J(c))return!1;switch(c){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}r(D,"isUnknownContentCharacter");function B(){let c;do c=A();while(c>=12&&c<=15);return c}return r(B,"scanNextNonTrivia"),{setPosition:v,getPosition:r(()=>n,"getPosition"),scan:t?B:A,getToken:r(()=>i,"getToken"),getTokenValue:r(()=>o,"getTokenValue"),getTokenOffset:r(()=>l,"getTokenOffset"),getTokenLength:r(()=>n-l,"getTokenLength"),getTokenStartLine:r(()=>u,"getTokenStartLine"),getTokenStartCharacter:r(()=>l-w,"getTokenStartCharacter"),getTokenError:r(()=>d,"getTokenError")}}r(Ne,"createScanner");function ee(e){return e===32||e===9}r(ee,"isWhiteSpace");function J(e){return e===10||e===13}r(J,"isLineBreak");function R(e){return e>=48&&e<=57}r(R,"isDigit");var ge;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(ge||(ge={})),new Array(20).fill(0).map((e,t)=>" ".repeat(t));const S=200;new Array(S).fill(0).map((e,t)=>`
4
- `+" ".repeat(t)),new Array(S).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(S).fill(0).map((e,t)=>`\r
5
- `+" ".repeat(t)),new Array(S).fill(0).map((e,t)=>`
6
- `+" ".repeat(t)),new Array(S).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(S).fill(0).map((e,t)=>`\r
7
- `+" ".repeat(t));var X;(function(e){e.DEFAULT={allowTrailingComma:!1}})(X||(X={}));function Pe(e,t=[],s=X.DEFAULT){let n=null,o=[];const l=[];function i(u){Array.isArray(o)?o.push(u):n!==null&&(o[n]=u)}return r(i,"onValue"),We(e,{onObjectBegin:r(()=>{const u={};i(u),l.push(o),o=u,n=null},"onObjectBegin"),onObjectProperty:r(u=>{n=u},"onObjectProperty"),onObjectEnd:r(()=>{o=l.pop()},"onObjectEnd"),onArrayBegin:r(()=>{const u=[];i(u),l.push(o),o=u,n=null},"onArrayBegin"),onArrayEnd:r(()=>{o=l.pop()},"onArrayEnd"),onLiteralValue:i,onError:r((u,g,w)=>{t.push({error:u,offset:g,length:w})},"onError")},s),o[0]}r(Pe,"parse$1");function We(e,t,s=X.DEFAULT){const n=Ne(e,!1),o=[];let l=0;function i(b){return b?()=>l===0&&b(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}r(i,"toNoArgVisit");function f(b){return b?F=>l===0&&b(F,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}r(f,"toOneArgVisit");function u(b){return b?F=>l===0&&b(F,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}r(u,"toOneArgVisitWithPath");function g(b){return b?()=>{l>0?l++:b(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(l=1)}:()=>!0}r(g,"toBeginVisit");function w(b){return b?()=>{l>0&&l--,l===0&&b(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}r(w,"toEndVisit");const d=g(t.onObjectBegin),_=u(t.onObjectProperty),v=w(t.onObjectEnd),p=g(t.onArrayBegin),L=w(t.onArrayEnd),A=u(t.onLiteralValue),D=f(t.onSeparator),B=i(t.onComment),c=f(t.onError),j=s&&s.disallowComments,y=s&&s.allowTrailingComma;function T(){for(;;){const b=n.scan();switch(n.getTokenError()){case 4:k(14);break;case 5:k(15);break;case 3:k(13);break;case 1:j||k(11);break;case 2:k(12);break;case 6:k(16);break}switch(b){case 12:case 13:j?k(10):B();break;case 16:k(1);break;case 15:case 14:break;default:return b}}}r(T,"scanNext");function k(b,F=[],W=[]){if(c(b),F.length+W.length>0){let $=n.getToken();for(;$!==17;){if(F.indexOf($)!==-1){T();break}else if(W.indexOf($)!==-1)break;$=T()}}}r(k,"handleError");function P(b){const F=n.getTokenValue();return b?A(F):(_(F),o.push(F)),T(),!0}r(P,"parseString");function M(){switch(n.getToken()){case 11:const b=n.getTokenValue();let F=Number(b);isNaN(F)&&(k(2),F=0),A(F);break;case 7:A(null);break;case 8:A(!0);break;case 9:A(!1);break;default:return!1}return T(),!0}r(M,"parseLiteral");function V(){return n.getToken()!==10?(k(3,[],[2,5]),!1):(P(!1),n.getToken()===6?(D(":"),T(),U()||k(4,[],[2,5])):k(5,[],[2,5]),o.pop(),!0)}r(V,"parseProperty");function z(){d(),T();let b=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(b||k(4,[],[]),D(","),T(),n.getToken()===2&&y)break}else b&&k(6,[],[]);V()||k(4,[],[2,5]),b=!0}return v(),n.getToken()!==2?k(7,[2],[]):T(),!0}r(z,"parseObject");function G(){p(),T();let b=!0,F=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(F||k(4,[],[]),D(","),T(),n.getToken()===4&&y)break}else F&&k(6,[],[]);b?(o.push(0),b=!1):o[o.length-1]++,U()||k(4,[],[4,5]),F=!0}return L(),b||o.pop(),n.getToken()!==4?k(8,[4],[]):T(),!0}r(G,"parseArray");function U(){switch(n.getToken()){case 3:return G();case 1:return z();case 10:return P(!0);default:return M()}}return r(U,"parseValue"),T(),n.getToken()===17?s.allowEmptyContent?!0:(k(4,[],[]),!1):U()?(n.getToken()!==17&&k(9,[],[]),!0):(k(4,[],[]),!1)}r(We,"visit");var ke;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(ke||(ke={}));var me;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(me||(me={}));const Je=Pe;var de;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(de||(de={}));const we=r((e,t)=>Je(Se(t,e,"utf8")),"readJsonc"),ne=Symbol("implicitBaseUrl"),E="${configDir}",Me=r(()=>{const{findPnpApi:e}=Be;return e&&e(process.cwd())},"getPnpApi"),te=r((e,t,s,n)=>{const o=`resolveFromPackageJsonPath:${e}:${t}:${s}`;if(n!=null&&n.has(o))return n.get(o);const l=we(e,n);if(!l)return;let i=t||"tsconfig.json";if(!s&&l.exports)try{const[f]=Ie(l.exports,t,["require","types"]);i=f}catch{return!1}else!t&&l.tsconfig&&(i=l.tsconfig);return i=m.join(e,"..",i),n==null||n.set(o,i),i},"resolveFromPackageJsonPath"),se="package.json",le="tsconfig.json",Ve=r((e,t,s)=>{let n=e;if(e===".."&&(n=m.join(n,le)),e[0]==="."&&(n=m.resolve(t,n)),m.isAbsolute(n)){if(x(s,n)){if(Q(s,n).isFile())return n}else if(!n.endsWith(".json")){const v=`${n}.json`;if(x(s,v))return v}return}const[o,...l]=e.split("/"),i=o[0]==="@"?`${o}/${l.shift()}`:o,f=l.join("/"),u=Me();if(u){const{resolveRequest:v}=u;try{if(i===e){const p=v(m.join(i,se),t);if(p){const L=te(p,f,!1,s);if(L&&x(s,L))return L}}else{let p;try{p=v(e,t,{extensions:[".json"]})}catch{p=v(m.join(e,le),t)}if(p)return p}}catch{}}const g=O(m.resolve(t),m.join("node_modules",i),s);if(!g||!Q(s,g).isDirectory())return;const w=m.join(g,se);if(x(s,w)){const v=te(w,f,!1,s);if(v===!1)return;if(v&&x(s,v)&&Q(s,v).isFile())return v}const d=m.join(g,f),_=d.endsWith(".json");if(!_){const v=`${d}.json`;if(x(s,v))return v}if(x(s,d)){if(Q(s,d).isDirectory()){const v=m.join(d,se);if(x(s,v)){const L=te(v,"",!0,s);if(L&&x(s,L))return L}const p=m.join(d,le);if(x(s,p))return p}else if(_)return d}},"resolveExtendsPath"),oe=r((e,t)=>H(m.relative(e,t)),"pathRelative"),be=["files","include","exclude"],N=r((e,t,s)=>{const n=m.join(t,s),o=m.relative(e,n);return h(o)||"./"},"resolveAndRelativize"),ze=r((e,t,s)=>{const n=m.relative(e,t);if(!n)return s;const o=s.startsWith("./")?s.slice(2):s;return h(`${n}/${o}`)},"prefixPattern"),Ge=r((e,t,s,n)=>{const o=Ve(e,t,n);if(!o)throw new Error(`File '${e}' not found.`);if(s.has(o))throw new Error(`Circularity detected while resolving configuration: ${o}`);s.add(o);const l=m.dirname(o),i=pe(o,n,s);delete i.references;const{compilerOptions:f}=i;if(f){const{baseUrl:u}=f;u&&!u.startsWith(E)&&(f.baseUrl=N(t,l,u));const{outDir:g}=f;g&&!g.startsWith(E)&&(f.outDir=N(t,l,g));const{declarationDir:w}=f;w&&!w.startsWith(E)&&(f.declarationDir=N(t,l,w));const{rootDir:d}=f;d&&!d.startsWith(E)&&(f.rootDir=N(t,l,d));const{rootDirs:_}=f;_&&(f.rootDirs=_.map(p=>p.startsWith(E)?p:N(t,l,p)));const{typeRoots:v}=f;v&&(f.typeRoots=v.map(p=>p.startsWith(E)?p:N(t,l,p)))}for(const u of be){const g=i[u];g&&(i[u]=g.map(w=>w.startsWith(E)?w:ze(t,l,w)))}return i},"resolveExtends"),ve=["outDir","declarationDir"],pe=r((e,t,s=new Set)=>{let n;try{n=we(e,t)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${e}`)}if(typeof n!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const o=m.dirname(e);if(n.compilerOptions){const{compilerOptions:l}=n;l.paths&&!l.baseUrl&&(l[ne]=o)}if(n.extends){const l=Array.isArray(n.extends)?n.extends:[n.extends];delete n.extends;for(const i of l.reverse()){const f=Ge(i,o,new Set(s),t),u={...f,...n,compilerOptions:{...f.compilerOptions,...n.compilerOptions}};f.watchOptions&&(u.watchOptions={...f.watchOptions,...n.watchOptions}),n=u}}if(n.compilerOptions){const{compilerOptions:l}=n,i=["baseUrl","rootDir"];for(const f of i){const u=l[f];if(u&&!u.startsWith(E)){const g=m.resolve(o,u),w=oe(o,g);l[f]=w}}for(const f of ve){let u=l[f];u&&(Array.isArray(n.exclude)||(n.exclude=ve.map(g=>l[g]).filter(Boolean)),u.startsWith(E)||(u=H(u)),l[f]=u)}}else n.compilerOptions={};if(n.include&&(n.include=n.include.map(h)),n.files&&(n.files=n.files.map(l=>l.startsWith(E)?l:H(l))),n.watchOptions){const{watchOptions:l}=n;l.excludeDirectories&&(l.excludeDirectories=l.excludeDirectories.map(i=>h(m.resolve(o,i)))),l.excludeFiles&&(l.excludeFiles=l.excludeFiles.map(i=>h(m.resolve(o,i)))),l.watchFile&&(l.watchFile=l.watchFile.toLowerCase()),l.watchDirectory&&(l.watchDirectory=l.watchDirectory.toLowerCase()),l.fallbackPolling&&(l.fallbackPolling=l.fallbackPolling.toLowerCase())}return n},"_parseTsconfig"),Y=r((e,t)=>{if(e.startsWith(E))return h(m.join(t,e.slice(E.length)))},"interpolateConfigDir"),Qe=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],He=r(e=>{var t,s,n,o,l,i,f,u,g,w,d,_,v,p,L,A,D,B,c,j,y,T,k,P,M,V,z,G,U,b,F,W,$;if(e.strict){const a=["noImplicitAny","noImplicitThis","strictNullChecks","strictFunctionTypes","strictBindCallApply","strictPropertyInitialization","strictBuiltinIteratorReturn","alwaysStrict","useUnknownInCatchVariables"];for(const I of a)e[I]===void 0&&(e[I]=!0)}if(e.composite&&((t=e.declaration)!=null||(e.declaration=!0),(s=e.incremental)!=null||(e.incremental=!0)),e.target){let a=e.target.toLowerCase();a==="es2015"&&(a="es6"),e.target=a,a==="esnext"&&((n=e.module)!=null||(e.module="es6"),(o=e.useDefineForClassFields)!=null||(e.useDefineForClassFields=!0)),(a==="es6"||a==="es2016"||a==="es2017"||a==="es2018"||a==="es2019"||a==="es2020"||a==="es2021"||a==="es2022"||a==="es2023"||a==="es2024")&&((l=e.module)!=null||(e.module="es6")),(a==="es2022"||a==="es2023"||a==="es2024")&&((i=e.useDefineForClassFields)!=null||(e.useDefineForClassFields=!0))}if(e.module){let a=e.module.toLowerCase();if(a==="es2015"&&(a="es6"),e.module=a,(a==="es6"||a==="es2020"||a==="es2022"||a==="esnext"||a==="none"||a==="system"||a==="umd"||a==="amd")&&((f=e.moduleResolution)!=null||(e.moduleResolution="classic")),a==="system"&&((u=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0)),(a==="node16"||a==="node18"||a==="node20"||a==="nodenext"||a==="preserve")&&((g=e.esModuleInterop)!=null||(e.esModuleInterop=!0),(w=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0)),(a==="node16"||a==="node18"||a==="node20"||a==="nodenext")&&((d=e.moduleDetection)!=null||(e.moduleDetection="force")),a==="node16"&&((_=e.target)!=null||(e.target="es2022"),(v=e.moduleResolution)!=null||(e.moduleResolution="node16")),a==="node18"&&((p=e.target)!=null||(e.target="es2022"),(L=e.moduleResolution)!=null||(e.moduleResolution="node16")),a==="node20"&&((A=e.target)!=null||(e.target="es2023"),(D=e.moduleResolution)!=null||(e.moduleResolution="node16"),(B=e.resolveJsonModule)!=null||(e.resolveJsonModule=!0)),a==="nodenext"&&((c=e.target)!=null||(e.target="esnext"),(j=e.moduleResolution)!=null||(e.moduleResolution="nodenext"),(y=e.resolveJsonModule)!=null||(e.resolveJsonModule=!0)),a==="node16"||a==="node18"||a==="node20"||a==="nodenext"){const I=e.target;(I==="es3"||I==="es2022"||I==="es2023"||I==="es2024"||I==="esnext")&&((T=e.useDefineForClassFields)!=null||(e.useDefineForClassFields=!0))}a==="preserve"&&((k=e.moduleResolution)!=null||(e.moduleResolution="bundler"))}if(e.moduleResolution){let a=e.moduleResolution.toLowerCase();a==="node"&&(a="node10"),e.moduleResolution=a,(a==="node16"||a==="nodenext"||a==="bundler")&&((P=e.resolvePackageJsonExports)!=null||(e.resolvePackageJsonExports=!0),(M=e.resolvePackageJsonImports)!=null||(e.resolvePackageJsonImports=!0)),a==="bundler"&&((V=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0),(z=e.resolveJsonModule)!=null||(e.resolveJsonModule=!0))}e.jsx&&(e.jsx=e.jsx.toLowerCase()),e.moduleDetection&&(e.moduleDetection=e.moduleDetection.toLowerCase()),e.importsNotUsedAsValues&&(e.importsNotUsedAsValues=e.importsNotUsedAsValues.toLowerCase()),e.newLine&&(e.newLine=e.newLine.toLowerCase()),e.esModuleInterop&&((G=e.allowSyntheticDefaultImports)!=null||(e.allowSyntheticDefaultImports=!0)),e.verbatimModuleSyntax&&((U=e.isolatedModules)!=null||(e.isolatedModules=!0),(b=e.preserveConstEnums)!=null||(e.preserveConstEnums=!0)),e.isolatedModules&&((F=e.preserveConstEnums)!=null||(e.preserveConstEnums=!0)),e.rewriteRelativeImportExtensions&&((W=e.allowImportingTsExtensions)!=null||(e.allowImportingTsExtensions=!0)),e.lib&&(e.lib=e.lib.map(a=>a.toLowerCase())),e.checkJs&&(($=e.allowJs)!=null||(e.allowJs=!0))},"normalizeCompilerOptions"),ie=r((e,t=new Map)=>{const s=m.resolve(e),n=pe(s,t),o=m.dirname(s),{compilerOptions:l}=n;if(l){for(const f of Qe){const u=l[f];if(u){const g=Y(u,o);l[f]=g?oe(o,g):u}}for(const f of["rootDirs","typeRoots"]){const u=l[f];u&&(l[f]=u.map(g=>{const w=Y(g,o);return w?oe(o,w):H(g)}))}const{paths:i}=l;if(i)for(const f of Object.keys(i))i[f]=i[f].map(u=>{var g;return(g=Y(u,o))!=null?g:u});He(l)}for(const i of be){const f=n[i];f&&(n[i]=f.map(u=>{var g;return(g=Y(u,o))!=null?g:u}))}return n},"parseTsconfig");var Xe=Object.defineProperty,Z=r((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"s");const Te=Z(e=>{let t="";for(let s=0;s<e.length;s+=1){const n=e[s],o=n.toUpperCase();t+=n===o?n.toLowerCase():o}return t},"invertCase"),re=new Map,Ae=Z((e,t)=>{const s=Re.join(e,`.is-fs-case-sensitive-test-${process.pid}`);try{return t.writeFileSync(s,""),!t.existsSync(Te(s))}finally{try{t.unlinkSync(s)}catch{}}},"checkDirectoryCaseWithWrite"),Ye=Z((e,t,s)=>{try{return Ae(e,s)}catch(n){if(t===void 0)return Ae(Ue.tmpdir(),s);throw n}},"checkDirectoryCaseWithFallback"),Ze=Z((e,t=$e,s=!0)=>{const n=e!=null?e:process.cwd();if(s&&re.has(n))return re.get(n);let o;const l=Te(n);return l!==n&&t.existsSync(n)?o=!t.existsSync(l):o=Ye(n,e,t),s&&re.set(n,o),o},"isFsCaseSensitive"),{join:_e}=m.posix,ue={ts:[".ts",".tsx",".d.ts"],cts:[".cts",".d.cts"],mts:[".mts",".d.mts"]},qe=r(e=>{const t=[...ue.ts],s=[...ue.cts],n=[...ue.mts];return e!=null&&e.allowJs&&(t.push(".js",".jsx"),s.push(".cjs"),n.push(".mjs")),[...t,...s,...n]},"getSupportedExtensions"),Ke=r(e=>{const t=[];if(!e)return t;const{outDir:s,declarationDir:n}=e;return s&&t.push(s),n&&t.push(n),t},"getDefaultExcludeSpec"),ye=r(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeForRegexp"),Oe=["node_modules","bower_components","jspm_packages"],fe=`(?!(${Oe.join("|")})(/|$))`,Ce=/(?:^|\/)[^.*?]+$/,je="**/*",q="[^/]",ae="[^./]",Fe=process.platform==="win32",De=r(({config:e,path:t},s=Ze())=>{if("extends"in e)throw new Error("tsconfig#extends must be resolved. Use getTsconfig or parseTsconfig to resolve it.");if(!m.isAbsolute(t))throw new Error("The tsconfig path must be absolute");Fe&&(t=h(t));const n=m.dirname(t),{files:o,include:l,exclude:i,compilerOptions:f}=e,u=r(A=>m.isAbsolute(A)?A:_e(n,A),"resolvePattern"),g=o==null?void 0:o.map(u),w=qe(f),d=s?"":"i",v=(i||Ke(f)).map(A=>{const D=u(A),B=ye(D).replaceAll(String.raw`\*\*/`,"(.+/)?").replaceAll(String.raw`\*`,`${q}*`).replaceAll(String.raw`\?`,q);return new RegExp(`^${B}($|/)`,d)}),p=o||l?l:[je],L=p?p.map(A=>{let D=u(A);Ce.test(D)&&(D=_e(D,je));const B=ye(D).replaceAll(String.raw`/\*\*`,`(/${fe}${ae}${q}*)*?`).replaceAll(/(\/)?\\\*/g,(c,j)=>{const y=`(${ae}|(\\.(?!min\\.js$))?)*`;return j?`/${fe}${ae}${y}`:y}).replaceAll(/(\/)?\\\?/g,(c,j)=>{const y=q;return j?`/${fe}${y}`:y});return new RegExp(`^${B}$`,d)}):void 0;return A=>{if(!m.isAbsolute(A))throw new Error("filePath must be absolute");if(Fe&&(A=h(A)),g!=null&&g.includes(A))return e;if(!(!w.some(D=>A.endsWith(D))||v.some(D=>D.test(A)))&&L&&L.some(D=>D.test(A)))return e}},"createFilesMatcher"),Le=r((e,t,s)=>{const n=m.resolve(e);let o=h(e);for(;;){const l=O(o,t,s);if(!l)return;const i=m.resolve(l),f=ie(i,s),u={path:h(i),config:f};if(De(u)(n))return u;const w=m.dirname(l),d=m.dirname(w);if(d===w)return;o=d}},"findConfigApplicable"),he=r((e=process.cwd(),t="tsconfig.json",s=new Map,n=!1)=>{var o;return n?(o=Le(e,t,s))==null?void 0:o.path:O(h(e),t,s)},"findTsconfig"),en=r((e=process.cwd(),t="tsconfig.json",s=new Map,n=!1)=>{var o;if(!n){const l=he(e,t,s);if(!l)return null;const i=ie(l,s);return{path:l,config:i}}return(o=Le(e,t,s))!=null?o:null},"getTsconfig"),nn=/\*/g,Ee=r((e,t)=>{const s=e.match(nn);if(s&&s.length>1)throw new Error(t)},"assertStarCount"),tn=r(e=>{if(e.includes("*")){const[t,s]=e.split("*");return{prefix:t,suffix:s}}return e},"parsePattern"),sn=r(({prefix:e,suffix:t},s)=>s.startsWith(e)&&s.endsWith(t),"isPatternMatch"),ln=r((e,t,s)=>Object.entries(e).map(([n,o])=>(Ee(n,`Pattern '${n}' can have at most one '*' character.`),{pattern:tn(n),substitutions:o.map(l=>{if(Ee(l,`Substitution '${l}' in pattern '${n}' can have at most one '*' character.`),!t&&!C.test(l)&&!m.isAbsolute(l))throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");return m.resolve(s,l)})})),"parsePaths"),on=r(e=>{const{compilerOptions:t}=e.config;if(!t)return null;const{baseUrl:s,paths:n}=t;if(!s&&!n)return null;const o=ne in t&&t[ne],l=m.resolve(m.dirname(e.path),s||o||"."),i=n?ln(n,s,l):[];return f=>{if(C.test(f))return[];const u=[];for(const _ of i){if(_.pattern===f)return _.substitutions.map(h);typeof _.pattern!="string"&&u.push(_)}let g,w=-1;for(const _ of u)sn(_.pattern,f)&&_.pattern.prefix.length>w&&(w=_.pattern.prefix.length,g=_);if(!g)return s?[h(m.join(l,f))]:[];const d=f.slice(g.pattern.prefix.length,f.length-g.pattern.suffix.length);return g.substitutions.map(_=>h(_.replace("*",d)))}},"createPathsMatcher");export{De as createFilesMatcher,on as createPathsMatcher,he as findTsconfig,en as getTsconfig,ie as parseTsconfig};
@@ -1,46 +0,0 @@
1
- {
2
- "name": "get-tsconfig",
3
- "version": "4.14.0",
4
- "description": "Find and parse the tsconfig.json file from a directory path",
5
- "keywords": [
6
- "get-tsconfig",
7
- "get",
8
- "typescript",
9
- "tsconfig",
10
- "tsconfig.json"
11
- ],
12
- "license": "MIT",
13
- "repository": "privatenumber/get-tsconfig",
14
- "funding": "https://github.com/privatenumber/get-tsconfig?sponsor=1",
15
- "author": {
16
- "name": "Hiroki Osame",
17
- "email": "hiroki.osame@gmail.com"
18
- },
19
- "files": [
20
- "dist"
21
- ],
22
- "type": "module",
23
- "main": "./dist/index.cjs",
24
- "module": "./dist/index.mjs",
25
- "types": "./dist/index.d.cts",
26
- "exports": {
27
- "require": {
28
- "types": "./dist/index.d.cts",
29
- "default": "./dist/index.cjs"
30
- },
31
- "import": {
32
- "types": "./dist/index.d.mts",
33
- "default": "./dist/index.mjs"
34
- }
35
- },
36
- "imports": {
37
- "#get-tsconfig": {
38
- "types": "./src/index.ts",
39
- "development": "./src/index.ts",
40
- "default": "./dist/index.mjs"
41
- }
42
- },
43
- "dependencies": {
44
- "resolve-pkg-maps": "^1.0.0"
45
- }
46
- }
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024-present VoidZero Inc. & Contributors
4
- Copyright (c) 2023 Boshen
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
@@ -1,167 +0,0 @@
1
- # Oxc Parser
2
-
3
- See [usage instructions](https://oxc.rs/docs/guide/usage/parser).
4
-
5
- ## Features
6
-
7
- ### Supports WASM
8
-
9
- See https://stackblitz.com/edit/oxc-parser for usage example.
10
-
11
- ### ESTree
12
-
13
- When parsing JS or JSX files, the AST returned is fully conformant with the
14
- [ESTree standard](https://github.com/estree/estree), the same as produced by
15
- [Acorn](https://npmx.dev/package/acorn).
16
-
17
- When parsing TypeScript, the AST conforms to [@typescript-eslint/typescript-estree](https://npmx.dev/package/@typescript-eslint/typescript-estree)'s TS-ESTree format.
18
-
19
- If you need all ASTs in the same with-TS-properties format, use the `astType: 'ts'` option.
20
-
21
- The only differences between Oxc's AST and ESTree / TS-ESTree are:
22
-
23
- - Support for Stage 3 [decorators](https://github.com/tc39/proposal-decorators).
24
- - Support for Stage 3 ECMA features [`import defer`](https://github.com/tc39/proposal-defer-import-eval)
25
- and [`import source`](https://github.com/tc39/proposal-source-phase-imports).
26
- - In TS-ESTree AST, `import.defer(...)` and `import.source(...)` are represented as an `ImportExpression`
27
- with `'defer'` or `'source'` in `phase` field (as in ESTree spec), where TS-ESLint represents these
28
- as a `CallExpression` with `MetaProperty` as its `callee`.
29
- - Addition of a non-standard `hashbang` field to `Program`.
30
-
31
- That aside, the AST should completely align with Acorn's ESTree AST or TS-ESLint's TS-ESTree.
32
- Any deviation would be considered a bug.
33
-
34
- ### AST Types
35
-
36
- [@oxc-project/types](https://npmx.dev/package/@oxc-project/types) can be used. For example:
37
-
38
- ```typescript
39
- import { Statement } from "@oxc-project/types";
40
- ```
41
-
42
- ### Visitor
43
-
44
- An AST visitor is provided. See example below.
45
-
46
- This package also exports visitor keys which can be used with any other ESTree walker.
47
-
48
- ```js
49
- import { visitorKeys } from "oxc-parser";
50
- ```
51
-
52
- ### Fast Mode
53
-
54
- By default, Oxc parser does not produce semantic errors where symbols and scopes are needed.
55
-
56
- To enable semantic errors, apply the option `showSemanticErrors: true`.
57
-
58
- For example,
59
-
60
- ```js
61
- let foo;
62
- let foo;
63
- ```
64
-
65
- Does not produce any errors when `showSemanticErrors` is `false`, which is the default behavior.
66
-
67
- Fast mode is best suited for parser plugins, where other parts of your build pipeline has already checked for errors.
68
-
69
- Please note that turning off fast mode ​incurs​ a small performance overhead.
70
-
71
- ### Returns ESM information.
72
-
73
- It is likely that you are writing a parser plugin that requires ESM information.
74
-
75
- To avoid walking the AST again, Oxc Parser returns ESM information directly.
76
-
77
- This information can be used to rewrite import and exports with the help of [`magic-string`](https://npmx.dev/package/magic-string),
78
- without any AST manipulations.
79
-
80
- ```ts
81
- export interface EcmaScriptModule {
82
- /**
83
- * Has ESM syntax.
84
- *
85
- * i.e. `import` and `export` statements, and `import.meta`.
86
- *
87
- * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
88
- */
89
- hasModuleSyntax: boolean;
90
- /** Import statements */
91
- staticImports: Array<StaticImport>;
92
- /** Export statements */
93
- staticExports: Array<StaticExport>;
94
- /** Dynamic import expressions */
95
- dynamicImports: Array<DynamicImport>;
96
- /** Span positions of `import.meta` */
97
- importMetas: Array<Span>;
98
- }
99
- ```
100
-
101
- ## API
102
-
103
- ### Functions
104
-
105
- ```typescript
106
- // Synchronous parsing
107
- parseSync(filename: string, sourceText: string, options?: ParserOptions): ParseResult
108
-
109
- // Asynchronous parsing
110
- parse(filename: string, sourceText: string, options?: ParserOptions): Promise<ParseResult>
111
- ```
112
-
113
- Use `parseSync` for synchronous parsing. Use `parse` for asynchronous parsing, which can be beneficial in I/O-bound or concurrent scenarios, though it adds async overhead.
114
-
115
- ### Example
116
-
117
- ```javascript
118
- import { parseSync, Visitor } from "oxc-parser";
119
-
120
- const code = "const url: String = /* 🤨 */ import.meta.url;";
121
-
122
- // File extension is used to determine which dialect to parse source as.
123
- const filename = "test.tsx";
124
-
125
- const result = parseSync(filename, code);
126
- // Or use async version: const result = await parse(filename, code);
127
-
128
- // An array of errors, if any.
129
- console.log(result.errors);
130
-
131
- // AST and comments.
132
- console.log(result.program, result.comments);
133
-
134
- // ESM information - imports, exports, `import.meta`s.
135
- console.log(result.module);
136
-
137
- // Visit the AST
138
- const visitations = [];
139
-
140
- const visitor = new Visitor({
141
- VariableDeclaration(decl) {
142
- visitations.push(`enter ${decl.kind}`);
143
- },
144
- "VariableDeclaration:exit"(decl) {
145
- visitations.push(`exit ${decl.kind}`);
146
- },
147
- Identifier(ident) {
148
- visitations.push(ident.name);
149
- },
150
- });
151
-
152
- visitor.visit(result.program);
153
-
154
- // Logs: [ 'enter const', 'url', 'String', 'import', 'meta', 'url', 'exit const' ]
155
- console.log(visitations);
156
- ```
157
-
158
- ### Options
159
-
160
- All options are optional.
161
-
162
- - `lang`: `'js'` | `'jsx'` | `'ts'` | `'tsx'`. Set language of source. If omitted, language is deduced from file extension.
163
- - `sourceType`: `'script'` | `'module'` | `'unambiguous'`. Set source type. Defaults to `'module'`.
164
- - `astType`: `'js'` | `'ts'`. Set to `'ts'` if you want ASTs of plain JS/JSX files to contain TypeScript-specific properties.
165
- - `range`: `true` | `false`. If `true`, AST nodes contain a `range` field. Defaults to `false`.
166
- - `preserveParens`: `true` | `false`. If `true`, parenthesized expressions are represented by (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` AST nodes. Defaults to `true`.
167
- - `showSemanticErrors`: `true` | `false`. If `true`, check file for semantic errors which parser does not otherwise emit e.g. `let x; let x;`. Has a small performance cost. Defaults to `false`.
@@ -1,153 +0,0 @@
1
- {
2
- "name": "oxc-parser",
3
- "version": "0.132.0",
4
- "description": "Oxc Parser Node API",
5
- "keywords": [
6
- "ast",
7
- "estree",
8
- "javascript",
9
- "oxc",
10
- "parser",
11
- "typescript"
12
- ],
13
- "homepage": "https://oxc.rs/docs/guide/usage/parser",
14
- "bugs": "https://github.com/oxc-project/oxc/issues",
15
- "license": "MIT",
16
- "author": "Boshen and oxc contributors",
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/oxc-project/oxc.git",
20
- "directory": "napi/parser"
21
- },
22
- "funding": {
23
- "url": "https://github.com/sponsors/Boshen"
24
- },
25
- "files": [
26
- "src-js/bindings.js",
27
- "src-js/index.d.ts",
28
- "src-js/index.js",
29
- "src-js/wasm.js",
30
- "src-js/webcontainer-fallback.cjs",
31
- "src-js/wrap.js",
32
- "src-js/generated/constants.js",
33
- "src-js/raw-transfer/common.js",
34
- "src-js/raw-transfer/eager.js",
35
- "src-js/raw-transfer/lazy-common.js",
36
- "src-js/raw-transfer/lazy.js",
37
- "src-js/raw-transfer/node-array.js",
38
- "src-js/raw-transfer/supported.js",
39
- "src-js/raw-transfer/visitor.js",
40
- "src-js/visit/index.js",
41
- "src-js/visit/visitor.js",
42
- "src-js/generated/deserialize/js.js",
43
- "src-js/generated/deserialize/js_range.js",
44
- "src-js/generated/deserialize/ts.js",
45
- "src-js/generated/deserialize/ts_range.js",
46
- "src-js/generated/lazy/constructors.js",
47
- "src-js/generated/lazy/type_ids.js",
48
- "src-js/generated/lazy/walk.js",
49
- "src-js/generated/visit/keys.js",
50
- "src-js/generated/visit/type_ids.js",
51
- "src-js/generated/visit/visitor.d.ts",
52
- "src-js/generated/visit/walk.js"
53
- ],
54
- "type": "module",
55
- "main": "src-js/index.js",
56
- "browser": "src-js/wasm.js",
57
- "publishConfig": {
58
- "access": "public",
59
- "registry": "https://registry.npmjs.org/"
60
- },
61
- "dependencies": {
62
- "@oxc-project/types": "^0.132.0"
63
- },
64
- "devDependencies": {
65
- "@codspeed/vitest-plugin": "^5.0.0",
66
- "@emnapi/core": "1.10.0",
67
- "@emnapi/runtime": "1.10.0",
68
- "@napi-rs/cli": "3.6.2",
69
- "@napi-rs/wasm-runtime": "1.1.4",
70
- "@types/node": "24.1.0",
71
- "@typescript-eslint/visitor-keys": "^8.54.0",
72
- "@vitest/browser": "4.1.6",
73
- "@vitest/browser-playwright": "4.1.6",
74
- "playwright": "^1.51.0",
75
- "publint": "0.3.21",
76
- "rolldown": "1.0.1",
77
- "tinypool": "^2.0.0",
78
- "vitest": "4.1.6"
79
- },
80
- "napi": {
81
- "binaryName": "parser",
82
- "dtsHeaderFile": "src-js/header.d.ts",
83
- "packageName": "@oxc-parser/binding",
84
- "targets": [
85
- "aarch64-apple-darwin",
86
- "aarch64-linux-android",
87
- "aarch64-pc-windows-msvc",
88
- "aarch64-unknown-linux-gnu",
89
- "aarch64-unknown-linux-musl",
90
- "aarch64-unknown-linux-ohos",
91
- "armv7-linux-androideabi",
92
- "armv7-unknown-linux-gnueabihf",
93
- "armv7-unknown-linux-musleabihf",
94
- "i686-pc-windows-msvc",
95
- "powerpc64le-unknown-linux-gnu",
96
- "riscv64gc-unknown-linux-gnu",
97
- "riscv64gc-unknown-linux-musl",
98
- "s390x-unknown-linux-gnu",
99
- "wasm32-wasip1-threads",
100
- "x86_64-apple-darwin",
101
- "x86_64-pc-windows-msvc",
102
- "x86_64-unknown-freebsd",
103
- "x86_64-unknown-linux-gnu",
104
- "x86_64-unknown-linux-musl"
105
- ],
106
- "wasm": {
107
- "browser": {
108
- "fs": false
109
- }
110
- }
111
- },
112
- "engines": {
113
- "node": "^20.19.0 || >=22.12.0"
114
- },
115
- "optionalDependencies": {
116
- "@oxc-parser/binding-darwin-arm64": "0.132.0",
117
- "@oxc-parser/binding-android-arm64": "0.132.0",
118
- "@oxc-parser/binding-win32-arm64-msvc": "0.132.0",
119
- "@oxc-parser/binding-linux-arm64-gnu": "0.132.0",
120
- "@oxc-parser/binding-linux-arm64-musl": "0.132.0",
121
- "@oxc-parser/binding-openharmony-arm64": "0.132.0",
122
- "@oxc-parser/binding-android-arm-eabi": "0.132.0",
123
- "@oxc-parser/binding-linux-arm-gnueabihf": "0.132.0",
124
- "@oxc-parser/binding-linux-arm-musleabihf": "0.132.0",
125
- "@oxc-parser/binding-win32-ia32-msvc": "0.132.0",
126
- "@oxc-parser/binding-linux-ppc64-gnu": "0.132.0",
127
- "@oxc-parser/binding-linux-riscv64-gnu": "0.132.0",
128
- "@oxc-parser/binding-linux-riscv64-musl": "0.132.0",
129
- "@oxc-parser/binding-linux-s390x-gnu": "0.132.0",
130
- "@oxc-parser/binding-wasm32-wasi": "0.132.0",
131
- "@oxc-parser/binding-darwin-x64": "0.132.0",
132
- "@oxc-parser/binding-win32-x64-msvc": "0.132.0",
133
- "@oxc-parser/binding-freebsd-x64": "0.132.0",
134
- "@oxc-parser/binding-linux-x64-gnu": "0.132.0",
135
- "@oxc-parser/binding-linux-x64-musl": "0.132.0"
136
- },
137
- "scripts": {
138
- "build-dev": "napi build --esm --platform --js bindings.js --dts index.d.ts --output-dir src-js",
139
- "build-test": "pnpm run build-dev --features tokens --profile coverage",
140
- "build": "pnpm run build-dev --features allocator --release",
141
- "postbuild": "publint",
142
- "postbuild-dev": "node scripts/patch.js",
143
- "build-wasi": "napi build --target wasm32-wasip1-threads",
144
- "build-wasm": "pnpm run build-wasm-dev --release",
145
- "build-wasm-dev": "pnpm run build-dev --target wasm32-wasip1-threads",
146
- "build-npm-dir": "rm -rf npm-dir && napi create-npm-dirs --npm-dir npm-dir && pnpm napi artifacts --npm-dir npm-dir --output-dir src-js",
147
- "build-browser-bundle": "node scripts/build-browser-bundle.js",
148
- "test": "pnpm run test-node run",
149
- "test-node": "vitest --dir ./test",
150
- "test-browser": "vitest -c vitest.config.browser.ts",
151
- "bench": "vitest bench --run ./bench.bench.js"
152
- }
153
- }