sveast 0.9.3 → 0.9.4

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 (51) hide show
  1. package/README.md +76 -3
  2. package/core.js +1 -1
  3. package/entities.js +1 -1
  4. package/index.d.ts +437 -0
  5. package/index.js +1 -1
  6. package/is-valid-type.js +1 -1
  7. package/lexer.js +3 -3
  8. package/module.js +1 -1
  9. package/package.json +6 -1
  10. package/parse-imports-exports.js +1 -1
  11. package/parse-module.js +1 -1
  12. package/parse-sections.js +1 -1
  13. package/parse.js +1 -1
  14. package/runes.js +1 -1
  15. package/scope.d.ts +1792 -0
  16. package/scope.js +1 -0
  17. package/shared-2by923ar.js +3 -0
  18. package/shared-3371ehgf.js +2 -0
  19. package/shared-4wqe6a27.js +5 -0
  20. package/shared-4zk9ntab.js +2 -0
  21. package/shared-artd3d80.js +2 -0
  22. package/{shared-7q3geqgt.js → shared-c9gzmr05.js} +2 -2
  23. package/shared-h6c4cer7.js +2 -0
  24. package/shared-hjcsmz9f.js +2 -0
  25. package/shared-jxkrk6hx.js +10 -0
  26. package/{shared-bx03zqyq.js → shared-n0fpkmn8.js} +2 -2
  27. package/shared-n1wnwhk8.js +3 -0
  28. package/{shared-wr6wdcs6.js → shared-nbaaegmc.js} +2 -2
  29. package/shared-rh41v5ez.js +3 -0
  30. package/shared-shxvsq2a.js +2 -0
  31. package/{shared-3ez2yv7r.js → shared-stdj6se1.js} +2 -2
  32. package/{shared-4t495q2a.js → shared-v0nj05q2.js} +2 -2
  33. package/shared-vjpq32kx.js +2 -0
  34. package/shared-xyqvjc3m.js +10 -0
  35. package/shared-znzncsf2.js +2 -0
  36. package/typescript.js +1 -1
  37. package/walk.d.ts +247 -0
  38. package/walk.js +1 -1
  39. package/shared-1z80250f.js +0 -2
  40. package/shared-2m9w933n.js +0 -2
  41. package/shared-3bhr0q10.js +0 -2
  42. package/shared-bbp47cz4.js +0 -10
  43. package/shared-cr4ebmgx.js +0 -5
  44. package/shared-g06vtkxe.js +0 -2
  45. package/shared-g7qbtk93.js +0 -3
  46. package/shared-j1r12f45.js +0 -3
  47. package/shared-njpj8eam.js +0 -2
  48. package/shared-qbw8n9am.js +0 -2
  49. package/shared-saxr459v.js +0 -2
  50. package/shared-wfjkg544.js +0 -10
  51. package/shared-xa3xp3kp.js +0 -3
package/lexer.js CHANGED
@@ -1,3 +1,3 @@
1
- import{s}from"./shared-wr6wdcs6.js";import{o,j,ke,ie,m,L}from"./shared-xa3xp3kp.js";import"./shared-3ez2yv7r.js";import{ee}from"./shared-g7qbtk93.js";function g(e){let t=new f(e),u=[];return j(e,!1,(i,n)=>{let r=t.statement(n);return u.push(r),r.end}),u}function k(e){let t=new f(e),u=[];return ke(e,(i,n,r)=>{let a=r?0:1;u.push({kind:r?"template":"string",value:t.cooked(i+a,n-a,r),start:i,end:n})}),u}class f{source;pos=0;end=0;escapeEnd=0;constructor(e){this.source=e}statement(e){this.pos=this.end=e+6;let t={kind:this.source.charCodeAt(e)===105?"import":"export",start:e,end:0,source:null,typeOnly:!1,specifiers:[]};if(!(t.kind==="import"?this.import(t):this.export(t)))t.source=null,t.specifiers=[];return t.end=this.end,t}import(e){let t=this.string();if(t!==null)return e.source=t,this.finish();if(this.isWord("type")){let r=this.peekAfter(4);if(r===123||r===42||d(r)&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4)}let{specifiers:u,typeOnly:i}=e,n=this.at();if(n!==123&&n!==42){let r=this.pos,a=this.name();if(a===null)return!1;if(this.at()===61)return this.importEquals();if(u.push({kind:"default",imported:"default",local:a,typeOnly:i,start:r,end:this.end}),!this.eat(44))return this.from(e);n=this.at()}if(n===42){let r=this.pos;if(this.advance(1),!this.eatWord("as"))return!1;let a=this.name();if(a===null)return!1;return u.push({kind:"namespace",imported:"*",local:a,typeOnly:i,start:r,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let r=this.skip(),a=this.typeModifier()||i,l=this.name(),h=l??this.string()?.value;if(h===void 0)return!1;let c=l;if(this.eatWord("as"))c=this.name();if(c===null)return!1;if(u.push({kind:"named",imported:h,local:c,typeOnly:a,start:r,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}return this.from(e)}export(e){if(this.eatWord("import")){if(this.isWord("type")&&d(this.peekAfter(4))&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4);return this.name()!==null&&this.at()===61&&this.importEquals()}if(this.isWord("type")){let i=this.peekAfter(4);if(i===123||i===42)e.typeOnly=!0,this.advance(4)}let{specifiers:t,typeOnly:u}=e;if(this.at()===42){let i=this.pos;this.advance(1);let n=null;if(this.eatWord("as")){if(n=this.moduleExportName(),n===null)return!1}return t.push({kind:n===null?"all":"namespace",local:"*",exported:n,typeOnly:u,start:i,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let i=this.skip(),n=this.typeModifier()||u,r=this.moduleExportName();if(r===null)return!1;let a=r;if(this.eatWord("as"))a=this.moduleExportName();if(a===null)return!1;if(t.push({kind:"named",local:r,exported:a,typeOnly:n,start:i,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}return this.from(e)}typeModifier(){if(!this.isWord("type"))return!1;let e=this.peekAfter(4);if(e===34||e===39||d(e)&&!this.isWordAfter(4,"as"))return this.advance(4),!0;return!1}importEquals(){if(this.advance(1),this.isWord("require")&&this.peekAfter(7)===40){if(this.advance(7),this.eat(40),this.string()===null||!this.eat(41))return!1}else do if(this.name()===null)return!1;while(this.eat(46));return this.eat(59),!0}from(e){if(!this.eatWord("from"))return!1;return e.source=this.string(),e.source!==null&&this.finish()}finish(){let e=this.isWord("with")?4:0;if(this.isWord("assert")&&ie(this.source,this.end)>=this.pos)e=6;if(e!==0&&this.peekAfter(e)===123){this.advance(e),this.eat(123);while(!this.eat(125))if(this.string()===null&&this.name()===null&&!this.eat(58)&&!this.eat(44))return!1}return this.eat(59),!0}skip(){return this.pos=m(this.source,this.pos),this.pos}at(){return this.source.charCodeAt(this.skip())}advance(e){this.pos+=e,this.end=this.pos}peekAfter(e){return this.source.charCodeAt(m(this.source,this.pos+e))}isWordAfter(e,t){return L(this.source,m(this.source,this.pos+e),t)}eat(e){if(this.at()!==e)return!1;return this.advance(1),!0}isWord(e){return L(this.source,this.skip(),e)}eatWord(e){if(!this.isWord(e))return!1;return this.advance(e.length),!0}moduleExportName(){return this.name()??this.string()?.value??null}name(){let e=this.source,t=this.skip();if(!o(e.charCodeAt(t))||s(e.charCodeAt(t)))return null;let u="",i=t,n=t;while(n<e.length){let r=e.charCodeAt(n);if(r===92){if(e.charCodeAt(n+1)!==117)return null;let a=this.unicodeEscape(n+2);if(a===null)return null;u+=e.slice(i,n)+a,n=i=this.escapeEnd}else if(o(r))n++;else break}return this.advance(n-t),u+e.slice(i,n)}string(){let e=this.source,t=this.skip(),u=e.charCodeAt(t);if(u!==34&&u!==39)return null;let i="",n=t+1;for(let r=n;r<e.length;){let a=e.charCodeAt(r);if(a===u)return this.advance(r+1-t),{value:i+e.slice(n,r),start:t,end:r+1};if(a===10||a===13)return null;if(a===92){let l=this.escape(r+1);if(l===null)return null;i+=e.slice(n,r)+l,r=n=this.escapeEnd}else r++}return null}cooked(e,t,u){let i=this.source,n="",r=e;for(let a=e;a<t;){let l=i.charCodeAt(a);if(l===92){let h=this.escape(a+1);if(h===null)return null;n+=i.slice(r,a)+h,a=r=this.escapeEnd}else if(l===13&&u)n+=`${i.slice(r,a)}
2
- `,a+=i.charCodeAt(a+1)===10?2:1,r=a;else a++}return n+i.slice(r,t)}escape(e){let t=this.source.charCodeAt(e);switch(this.escapeEnd=e+1,t){case 110:return`
3
- `;case 114:return"\r";case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 48:return s(this.source.charCodeAt(e+1))?null:"\x00";case 120:return this.hexEscape(e+1,2);case 117:return this.unicodeEscape(e+1);case 13:if(this.source.charCodeAt(e+1)===10)this.escapeEnd++;return"";case 10:case 8232:case 8233:return"";default:return s(t)||e>=this.source.length?null:String.fromCharCode(t)}}unicodeEscape(e){if(this.source.charCodeAt(e)!==123)return this.hexEscape(e,4);let t=0,u=e+1;for(;this.source.charCodeAt(u)!==125;u++){let i=p(this.source.charCodeAt(u));if(i===-1)return null;if(t=t*16+i,t>1114111)return null}if(u===e+1)return null;return this.escapeEnd=u+1,String.fromCodePoint(t)}hexEscape(e,t){let u=0;for(let i=e;i<e+t;i++){let n=p(this.source.charCodeAt(i));if(n===-1)return null;u=u*16+n}return this.escapeEnd=e+t,String.fromCharCode(u)}}function d(e){return e!==92&&o(e)&&!s(e)}function p(e){if(s(e))return e-48;let t=e|32;return t>=97&&t<=102?t-87:-1}export{ee as lexComponent,g as lexImportsExports,k as lexStrings};
1
+ import{s}from"./shared-nbaaegmc.js";import{a,G,Ne,oe,b,q}from"./shared-2by923ar.js";import"./shared-stdj6se1.js";import{se}from"./shared-n1wnwhk8.js";function g(e){let t=new f(e),u=[];return G(e,!1,(i,n)=>{let r=t.statement(n);return u.push(r),r.end}),u}function k(e){let t=new f(e),u=[];return Ne(e,(i,n,r)=>{let o=r?0:1;u.push({kind:r?"template":"string",value:t.cooked(i+o,n-o,r),start:i,end:n})}),u}class f{source;pos=0;end=0;escapeEnd=0;constructor(e){this.source=e}statement(e){this.pos=this.end=e+6;let t={kind:this.source.charCodeAt(e)===105?"import":"export",start:e,end:0,source:null,typeOnly:!1,specifiers:[]};if(!(t.kind==="import"?this.import(t):this.export(t)))t.source=null,t.specifiers=[];return t.end=this.end,t}import(e){let t=this.string();if(t!==null)return e.source=t,this.finish();if(this.isWord("type")){let r=this.peekAfter(4);if(r===123||r===42||d(r)&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4)}let{specifiers:u,typeOnly:i}=e,n=this.at();if(n!==123&&n!==42){let r=this.pos,o=this.name();if(o===null)return!1;if(this.at()===61)return this.importEquals();if(u.push({kind:"default",imported:"default",local:o,typeOnly:i,start:r,end:this.end}),!this.eat(44))return this.from(e);n=this.at()}if(n===42){let r=this.pos;if(this.advance(1),!this.eatWord("as"))return!1;let o=this.name();if(o===null)return!1;return u.push({kind:"namespace",imported:"*",local:o,typeOnly:i,start:r,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let r=this.skip(),o=this.typeModifier()||i,l=this.name(),h=l??this.string()?.value;if(h===void 0)return!1;let c=l;if(this.eatWord("as"))c=this.name();if(c===null)return!1;if(u.push({kind:"named",imported:h,local:c,typeOnly:o,start:r,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}return this.from(e)}export(e){if(this.eatWord("import")){if(this.isWord("type")&&d(this.peekAfter(4))&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4);return this.name()!==null&&this.at()===61&&this.importEquals()}if(this.isWord("type")){let i=this.peekAfter(4);if(i===123||i===42)e.typeOnly=!0,this.advance(4)}let{specifiers:t,typeOnly:u}=e;if(this.at()===42){let i=this.pos;this.advance(1);let n=null;if(this.eatWord("as")){if(n=this.moduleExportName(),n===null)return!1}return t.push({kind:n===null?"all":"namespace",local:"*",exported:n,typeOnly:u,start:i,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let i=this.skip(),n=this.typeModifier()||u,r=this.moduleExportName();if(r===null)return!1;let o=r;if(this.eatWord("as"))o=this.moduleExportName();if(o===null)return!1;if(t.push({kind:"named",local:r,exported:o,typeOnly:n,start:i,end:this.end}),!this.eat(44)&&this.at()!==125)return!1}return this.from(e)}typeModifier(){if(!this.isWord("type"))return!1;let e=this.peekAfter(4);if(e===34||e===39||d(e)&&!this.isWordAfter(4,"as"))return this.advance(4),!0;return!1}importEquals(){if(this.advance(1),this.isWord("require")&&this.peekAfter(7)===40){if(this.advance(7),this.eat(40),this.string()===null||!this.eat(41))return!1}else do if(this.name()===null)return!1;while(this.eat(46));return this.eat(59),!0}from(e){if(!this.eatWord("from"))return!1;return e.source=this.string(),e.source!==null&&this.finish()}finish(){let e=this.isWord("with")?4:0;if(this.isWord("assert")&&oe(this.source,this.end)>=this.pos)e=6;if(e!==0&&this.peekAfter(e)===123){this.advance(e),this.eat(123);while(!this.eat(125))if(this.string()===null&&this.name()===null&&!this.eat(58)&&!this.eat(44))return!1}return this.eat(59),!0}skip(){return this.pos=b(this.source,this.pos),this.pos}at(){return this.source.charCodeAt(this.skip())}advance(e){this.pos+=e,this.end=this.pos}peekAfter(e){return this.source.charCodeAt(b(this.source,this.pos+e))}isWordAfter(e,t){return q(this.source,b(this.source,this.pos+e),t)}eat(e){if(this.at()!==e)return!1;return this.advance(1),!0}isWord(e){return q(this.source,this.skip(),e)}eatWord(e){if(!this.isWord(e))return!1;return this.advance(e.length),!0}moduleExportName(){return this.name()??this.string()?.value??null}name(){let e=this.source,t=this.skip();if(!a(e.charCodeAt(t))||s(e.charCodeAt(t)))return null;let u="",i=t,n=t;while(n<e.length){let r=e.charCodeAt(n);if(r===92){if(e.charCodeAt(n+1)!==117)return null;let o=this.unicodeEscape(n+2);if(o===null)return null;u+=e.slice(i,n)+o,n=i=this.escapeEnd}else if(a(r))n++;else break}return this.advance(n-t),u+e.slice(i,n)}string(){let e=this.source,t=this.skip(),u=e.charCodeAt(t);if(u!==34&&u!==39)return null;let i="",n=t+1;for(let r=n;r<e.length;){let o=e.charCodeAt(r);if(o===u)return this.advance(r+1-t),{value:i+e.slice(n,r),start:t,end:r+1};if(o===10||o===13)return null;if(o===92){let l=this.escape(r+1);if(l===null)return null;i+=e.slice(n,r)+l,r=n=this.escapeEnd}else r++}return null}cooked(e,t,u){let i=this.source,n="",r=e;for(let o=e;o<t;){let l=i.charCodeAt(o);if(l===92){let h=this.escape(o+1);if(h===null)return null;n+=i.slice(r,o)+h,o=r=this.escapeEnd}else if(l===13&&u)n+=`${i.slice(r,o)}
2
+ `,o+=i.charCodeAt(o+1)===10?2:1,r=o;else o++}return n+i.slice(r,t)}escape(e){let t=this.source.charCodeAt(e);switch(this.escapeEnd=e+1,t){case 110:return`
3
+ `;case 114:return"\r";case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 48:return s(this.source.charCodeAt(e+1))?null:"\x00";case 120:return this.hexEscape(e+1,2);case 117:return this.unicodeEscape(e+1);case 13:if(this.source.charCodeAt(e+1)===10)this.escapeEnd++;return"";case 10:case 8232:case 8233:return"";default:return s(t)||e>=this.source.length?null:String.fromCharCode(t)}}unicodeEscape(e){if(this.source.charCodeAt(e)!==123)return this.hexEscape(e,4);let t=0,u=e+1;for(;this.source.charCodeAt(u)!==125;u++){let i=p(this.source.charCodeAt(u));if(i===-1)return null;if(t=t*16+i,t>1114111)return null}if(u===e+1)return null;return this.escapeEnd=u+1,String.fromCodePoint(t)}hexEscape(e,t){let u=0;for(let i=e;i<e+t;i++){let n=p(this.source.charCodeAt(i));if(n===-1)return null;u=u*16+n}return this.escapeEnd=e+t,String.fromCharCode(u)}}function d(e){return e!==92&&a(e)&&!s(e)}function p(e){if(s(e))return e-48;let t=e|32;return t>=97&&t<=102?t-87:-1}export{se as lexComponent,g as lexImportsExports,k as lexStrings};
package/module.js CHANGED
@@ -1 +1 @@
1
- import"./shared-wfjkg544.js";import"./shared-cr4ebmgx.js";import{e}from"./shared-bbp47cz4.js";import"./shared-wr6wdcs6.js";import"./shared-xa3xp3kp.js";import{g}from"./shared-3bhr0q10.js";import{b}from"./shared-saxr459v.js";import{X}from"./shared-njpj8eam.js";function m(t={}){let p=X(t.typescript);return{parseModule:(r,o={})=>g(r,o,p),parseImportsExports:(r,o={})=>b(r,o,p)}}export{e as ParseError,m as createModuleParser};
1
+ import"./shared-xyqvjc3m.js";import"./shared-4wqe6a27.js";import{e}from"./shared-jxkrk6hx.js";import"./shared-nbaaegmc.js";import"./shared-2by923ar.js";import{T}from"./shared-artd3d80.js";import{k}from"./shared-hjcsmz9f.js";import{ee}from"./shared-h6c4cer7.js";function m(t={}){let p=ee(t.typescript);return{parseModule:(r,o={})=>T(r,o,p),parseImportsExports:(r,o={})=>k(r,o,p)}}export{e as ParseError,m as createModuleParser};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveast",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "license": "MIT",
5
5
  "description": "Fast, zero-dependency Svelte 5 parser with svelte/compiler's AST.",
6
6
  "author": "Eric Liu (https://github.com/metonym)",
@@ -38,6 +38,11 @@
38
38
  "import": "./walk.js",
39
39
  "default": "./walk.js"
40
40
  },
41
+ "./scope": {
42
+ "types": "./scope.d.ts",
43
+ "import": "./scope.js",
44
+ "default": "./scope.js"
45
+ },
41
46
  "./lexer": {
42
47
  "types": "./lexer.d.ts",
43
48
  "import": "./lexer.js",
@@ -1 +1 @@
1
- import"./shared-wfjkg544.js";import"./shared-cr4ebmgx.js";import"./shared-bbp47cz4.js";import"./shared-wr6wdcs6.js";import"./shared-xa3xp3kp.js";import"./shared-7q3geqgt.js";import{l}from"./shared-qbw8n9am.js";import{b}from"./shared-saxr459v.js";function s(r,t={}){return b(r,t,l)}export{s as parseImportsExports};
1
+ import"./shared-xyqvjc3m.js";import"./shared-4wqe6a27.js";import"./shared-jxkrk6hx.js";import"./shared-nbaaegmc.js";import"./shared-2by923ar.js";import"./shared-c9gzmr05.js";import{c}from"./shared-vjpq32kx.js";import{k}from"./shared-hjcsmz9f.js";function s(r,t={}){return k(r,t,c)}export{s as parseImportsExports};
package/parse-module.js CHANGED
@@ -1 +1 @@
1
- import"./shared-wfjkg544.js";import"./shared-cr4ebmgx.js";import{e}from"./shared-bbp47cz4.js";import"./shared-7q3geqgt.js";import{l}from"./shared-qbw8n9am.js";import{g}from"./shared-3bhr0q10.js";function s(r,o={}){return g(r,o,l)}export{e as ParseError,s as parseModule};
1
+ import"./shared-xyqvjc3m.js";import"./shared-4wqe6a27.js";import{e}from"./shared-jxkrk6hx.js";import"./shared-c9gzmr05.js";import{c}from"./shared-vjpq32kx.js";import{T}from"./shared-artd3d80.js";function s(r,o={}){return T(r,o,c)}export{e as ParseError,s as parseModule};
package/parse-sections.js CHANGED
@@ -1 +1 @@
1
- import{ae}from"./shared-1z80250f.js";import"./shared-g7qbtk93.js";import"./shared-4t495q2a.js";import"./shared-qbw8n9am.js";import"./shared-7q3geqgt.js";import"./shared-j1r12f45.js";import"./shared-bx03zqyq.js";import"./shared-3ez2yv7r.js";import"./shared-xa3xp3kp.js";import"./shared-wr6wdcs6.js";import"./shared-bbp47cz4.js";import"./shared-cr4ebmgx.js";import"./shared-wfjkg544.js";export{ae as parseSections};
1
+ import{ue}from"./shared-3371ehgf.js";import"./shared-n1wnwhk8.js";import"./shared-v0nj05q2.js";import"./shared-vjpq32kx.js";import"./shared-c9gzmr05.js";import"./shared-rh41v5ez.js";import"./shared-n0fpkmn8.js";import"./shared-stdj6se1.js";import"./shared-2by923ar.js";import"./shared-nbaaegmc.js";import"./shared-jxkrk6hx.js";import"./shared-4wqe6a27.js";import"./shared-xyqvjc3m.js";export{ue as parseSections};
package/parse.js CHANGED
@@ -1 +1 @@
1
- import{oe}from"./shared-2m9w933n.js";import"./shared-4t495q2a.js";import"./shared-qbw8n9am.js";import"./shared-7q3geqgt.js";import"./shared-j1r12f45.js";import"./shared-bx03zqyq.js";import"./shared-3ez2yv7r.js";import"./shared-wr6wdcs6.js";import"./shared-bbp47cz4.js";import"./shared-cr4ebmgx.js";import"./shared-wfjkg544.js";export{oe as parse};
1
+ import{pe}from"./shared-shxvsq2a.js";import"./shared-v0nj05q2.js";import"./shared-vjpq32kx.js";import"./shared-c9gzmr05.js";import"./shared-rh41v5ez.js";import"./shared-n0fpkmn8.js";import"./shared-stdj6se1.js";import"./shared-nbaaegmc.js";import"./shared-jxkrk6hx.js";import"./shared-4wqe6a27.js";import"./shared-xyqvjc3m.js";export{pe as parse};
package/runes.js CHANGED
@@ -1 +1 @@
1
- import"./shared-3ez2yv7r.js";import{S,i,t}from"./shared-wr6wdcs6.js";import{o,_,P}from"./shared-xa3xp3kp.js";import"./shared-cr4ebmgx.js";import"./shared-wfjkg544.js";import"./shared-bbp47cz4.js";import"./shared-bx03zqyq.js";import"./shared-j1r12f45.js";import"./shared-7q3geqgt.js";import{oe}from"./shared-2m9w933n.js";import{ae}from"./shared-1z80250f.js";import{C,Z,M,f,N}from"./shared-g06vtkxe.js";import{ee}from"./shared-g7qbtk93.js";import"./shared-4t495q2a.js";import"./shared-qbw8n9am.js";var F=new Set(["$state","$state.raw","$derived","$derived.by","$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"]),g=new Set(["$state","$derived","$props","$bindable","$effect","$inspect","$host"]),x=/(?<![\w$])(?:\$(?:state|derived|props|bindable|effect|inspect|host)(?![\w$])|await(?![\w$]))|\\u/g,R=/^\{\s*(true|false)\s*\}$/;function Y(e){let c=ee(e),l=c.options?.attributes.find((y)=>y.name==="runes"),r=l&&T(l);if(r!==void 0)return r;let n=S(e),s=[c.instance,c.module].flatMap((y)=>y?[y.content]:[]),u=!1,p=!1,a=!0;x.lastIndex=0;for(let y=x.exec(n);y!==null&&!(p&&!a);y=x.exec(n)){let A=y.index;u=!0,a&&=y[0]==="await",p||=!s.some(({start:D,end:I})=>A>=D&&A<I)}if(!u)return!1;if(!a&&l===void 0&&!n.includes("\\u")&&L(n,s))return!0;let d={css:!1,comments:!1},m=p?oe(e,d):ae(e,d);if(m.options?.runes!==void 0)return m.options.runes;if(a)return m.instance!==void 0&&w(m.instance.content)||w(m.fragment);return U(m)}function w(e){let c=!1;return N(e,{enter(l){if(h(l))return f;if(l.type!=="AwaitExpression")return;return c=!0,M}}),c}function T(e){if(e.value===!0)return!0;let c=R.exec(e.value);return c?c[1]==="true":void 0}var k=new Map([...g].map((e)=>[e,new RegExp(`(?<![\\w$.])${e.slice(1)}(?![\\w$])`)])),O=new Set("abstract accessor as async class const declare enum export extends function get implements import infer interface is keyof let module namespace new override private protected public readonly satisfies set static type typeof unique var".split(" "));function L(e,c){let l=new Map;for(let{start:r,end:n}of c){let s=e.slice(0,n);if(_(s,r,(p,a)=>{if(s.charCodeAt(p)!==36)return!1;let d=s.slice(p,a);if(g.has(d)&&l.get(d)!==!1)l.set(d,W(s,p,a));return!1})!==s.length)return!1}for(let[r,n]of l)if(n&&!k.get(r)?.test(e))return!0;return!1}function W(e,c,l){let r=c-1;while(r>=0&&i(e.charCodeAt(r)))r--;let n=e.charCodeAt(r);if(n===35||n===42||n===46||n===58||n===60||n===64)return!1;if(o(n)){let a=r;while(a>0&&o(e.charCodeAt(a-1)))a--;if(O.has(e.slice(a,r+1)))return!1}let s=t(e,l);while(e.charCodeAt(s)===46){let a=t(e,s+1),d=P(e,a);if(d===a)return!1;s=t(e,d)}if(e.charCodeAt(s)===60){if(s=B(e,s),s===-1)return!1;s=t(e,s)}if(e.charCodeAt(s)!==40)return!1;let u=_(e,s+1);if(e.charCodeAt(u)!==41)return!1;let p=e.charCodeAt(t(e,u+1));return p!==123&&p!==58}function B(e,c){let l=0,r=Math.min(e.length,c+2000);for(let n=c;n<r;n++){let s=e.charCodeAt(n);if(s===34||s===39||s===96||s===47)return-1;if(s===60)l++;else if(s===62&&e.charCodeAt(n-1)!==61){if(l--,l===0)return n+1}}return-1}function U(e){let c=e.module?.content,l=e.instance?.content,r=new Map;if(l)v(l,r,!0);let n=new Map;if(c)v(c,n,!1);for(let[p,a]of n)if(!r.has(p))r.set(p,a);let s=[],u=(p)=>{if(!s.includes(p))s.push(p)};if(c)b(c,n,u);if(l&&b(l,r,u))return!0;if(b(e.fragment,r,u))return!0;for(let p of s){let a=p.slice(1);if(!r.has(a))return!0;let d=r.get(a)??null,m=G(d,r);if(!((m===null||a!=="props"&&m==="$props")&&!(p==="$derived"&&d?.type==="ImportDeclaration"&&d.source.value==="svelte/store")))return!0;r.set(p,null)}return!1}function b(e,c,l){let r=[],n=new Map,s=(a)=>g.has(a)&&!c.has(a)&&!r.some((d)=>V(d,n).has(a)),u=0,p=!1;return N(e,{enter(a,d){if(h(a))u++;else if(a.type==="AwaitExpression")p||=u===0;let m;if(a.type==="Identifier"&&d&&!d.type.startsWith("TS")&&Z(a,d))m=a.name;else if(a.type==="TransitionDirective"||a.type==="AnimateDirective"||a.type==="UseDirective")m=a.name.split(".")[0];else if(a.type==="StyleDirective"&&a.value===!0)m=a.name;if(m!==void 0&&s(m))l(m);r.push(a)},leave(a){if(r.pop(),h(a))u--}}),p}var E=new Set;function V(e,c){let l=c.get(e);if(l)return l;let r=[];if(h(e)){if(r.push(...e.params),e.type==="FunctionExpression"&&e.id)r.push(e.id)}else if(e.type==="CatchClause"&&e.param)r.push(e.param);else if(e.type==="SnippetBlock")r.push(...e.parameters??[]);else if(e.type==="EachBlock"&&e.context)r.push(e.context);if(r.length===0&&!h(e))return c.set(e,E),E;let n=new Set(r.flatMap((s)=>C(s)).map((s)=>s.name));if(h(e)){let{body:s}=e;N(s,{enter(u){if(u===s)return;if(u.type==="VariableDeclaration")for(let p of u.declarations)for(let a of C(p.id))n.add(a.name);else if((u.type==="FunctionDeclaration"||u.type==="ClassDeclaration")&&u.id)n.add(u.id.name);return h(u)?f:void 0}})}return c.set(e,n),n}function h(e){return e.type==="ArrowFunctionExpression"||e.type==="FunctionExpression"||e.type==="FunctionDeclaration"}function v(e,c,l){let r=[];N(e,{enter(n,s){if(h(n)&&n.type!=="FunctionDeclaration")return f;let u=s===e||s?.type==="ExportNamedDeclaration"||s?.type==="ExportDefaultDeclaration";if(n.type==="ImportDeclaration"){for(let p of n.specifiers)c.set(p.local.name,n);return f}if(n.type==="FunctionDeclaration"||n.type==="ClassDeclaration"){if(u&&n.id)c.set(n.id.name,n);return f}if(n.type==="VariableDeclaration"){if(n.kind!=="var"&&!u)return f;for(let p of n.declarations)for(let a of C(p.id))c.set(a.name,u?p.init??null:null);return f}if(l&&s===e&&n.type==="LabeledStatement"&&n.label.name==="$"&&n.body.type==="ExpressionStatement"&&n.body.expression.type==="AssignmentExpression"){for(let p of C(n.body.expression.left))if(!p.name.startsWith("$"))r.push(p)}return}});for(let n of r)if(!c.has(n.name))c.set(n.name,null)}function G(e,c){if(e?.type!=="CallExpression")return null;let l=e.callee,r="";while(l.type==="MemberExpression"){if(l.computed||l.property.type!=="Identifier")return null;r=`.${l.property.name}${r}`,l=l.object}if(l.type==="CallExpression"&&l.callee.type==="Identifier")r=`()${r}`,l=l.callee;if(l.type!=="Identifier"||c.has(l.name))return null;return r=l.name+r,F.has(r)?r:null}export{Y as isRunesMode};
1
+ import"./shared-stdj6se1.js";import{w,i,t}from"./shared-nbaaegmc.js";import{a,R,O}from"./shared-2by923ar.js";import"./shared-4wqe6a27.js";import"./shared-xyqvjc3m.js";import"./shared-jxkrk6hx.js";import"./shared-n0fpkmn8.js";import"./shared-rh41v5ez.js";import"./shared-c9gzmr05.js";import{pe}from"./shared-shxvsq2a.js";import{ue}from"./shared-3371ehgf.js";import{p,I,j,y,L}from"./shared-4zk9ntab.js";import{W,P}from"./shared-znzncsf2.js";import{se}from"./shared-n1wnwhk8.js";import"./shared-v0nj05q2.js";import"./shared-vjpq32kx.js";var S=/(?<![\w$])(?:\$(?:state|derived|props|bindable|effect|inspect|host)(?![\w$])|await(?![\w$]))|\\u/g,N=/^\{\s*(true|false)\s*\}$/;function ee(e){let c=se(e),l=c.options?.attributes.find((h)=>h.name==="runes"),r=l&&M(l);if(r!==void 0)return r;let n=w(e),s=[c.instance,c.module].flatMap((h)=>h?[h.content]:[]),u=!1,f=!1,o=!0;S.lastIndex=0;for(let h=S.exec(n);h!==null&&!(f&&!o);h=S.exec(n)){let b=h.index;u=!0,o&&=h[0]==="await",f||=!s.some(({start:C,end:D})=>b>=C&&b<D)}if(!u)return!1;if(!o&&l===void 0&&!n.includes("\\u")&&k(n,s))return!0;let m={css:!1,comments:!1},d=f?pe(e,m):ue(e,m);if(d.options?.runes!==void 0)return d.options.runes;if(o)return d.instance!==void 0&&g(d.instance.content)||g(d.fragment);return U(d)}function g(e){let c=!1;return L(e,{enter(l){if(x(l))return y;if(l.type!=="AwaitExpression")return;return c=!0,j}}),c}function M(e){if(e.value===!0)return!0;let c=N.exec(e.value);return c?c[1]==="true":void 0}var F=new Map([...P].map((e)=>[e,new RegExp(`(?<![\\w$.])${e.slice(1)}(?![\\w$])`)])),T=new Set("abstract accessor as async class const declare enum export extends function get implements import infer interface is keyof let module namespace new override private protected public readonly satisfies set static type typeof unique var".split(" "));function k(e,c){let l=new Map;for(let{start:r,end:n}of c){let s=e.slice(0,n);if(R(s,r,(f,o)=>{if(s.charCodeAt(f)!==36)return!1;let m=s.slice(f,o);if(P.has(m)&&l.get(m)!==!1)l.set(m,_(s,f,o));return!1})!==s.length)return!1}for(let[r,n]of l)if(n&&!F.get(r)?.test(e))return!0;return!1}function _(e,c,l){let r=c-1;while(r>=0&&i(e.charCodeAt(r)))r--;let n=e.charCodeAt(r);if(n===35||n===42||n===46||n===58||n===60||n===64)return!1;if(a(n)){let o=r;while(o>0&&a(e.charCodeAt(o-1)))o--;if(T.has(e.slice(o,r+1)))return!1}let s=t(e,l);while(e.charCodeAt(s)===46){let o=t(e,s+1),m=O(e,o);if(m===o)return!1;s=t(e,m)}if(e.charCodeAt(s)===60){if(s=B(e,s),s===-1)return!1;s=t(e,s)}if(e.charCodeAt(s)!==40)return!1;let u=R(e,s+1);if(e.charCodeAt(u)!==41)return!1;let f=e.charCodeAt(t(e,u+1));return f!==123&&f!==58}function B(e,c){let l=0,r=Math.min(e.length,c+2000);for(let n=c;n<r;n++){let s=e.charCodeAt(n);if(s===34||s===39||s===96||s===47)return-1;if(s===60)l++;else if(s===62&&e.charCodeAt(n-1)!==61){if(l--,l===0)return n+1}}return-1}function U(e){let c=e.module?.content,l=e.instance?.content,r=new Map;if(l)v(l,r,!0);let n=new Map;if(c)v(c,n,!1);for(let[f,o]of n)if(!r.has(f))r.set(f,o);let s=[],u=(f)=>{if(!s.includes(f))s.push(f)};if(c)A(c,n,u);if(l&&A(l,r,u))return!0;if(A(e.fragment,r,u))return!0;for(let f of s){let o=f.slice(1);if(!r.has(o))return!0;let m=r.get(o)??null,d=G(m,r);if(!((d===null||o!=="props"&&d==="$props")&&!(f==="$derived"&&m?.type==="ImportDeclaration"&&m.source.value==="svelte/store")))return!0;r.set(f,null)}return!1}function A(e,c,l){let r=[],n=new Map,s=(o)=>P.has(o)&&!c.has(o)&&!r.some((m)=>V(m,n).has(o)),u=0,f=!1;return L(e,{enter(o,m){if(x(o))u++;else if(o.type==="AwaitExpression")f||=u===0;let d;if(o.type==="Identifier"&&m&&!m.type.startsWith("TS")&&I(o,m))d=o.name;else if(o.type==="TransitionDirective"||o.type==="AnimateDirective"||o.type==="UseDirective")d=o.name.split(".")[0];else if(o.type==="StyleDirective"&&o.value===!0)d=o.name;if(d!==void 0&&s(d))l(d);r.push(o)},leave(o){if(r.pop(),x(o))u--}}),f}var E=new Set;function V(e,c){let l=c.get(e);if(l)return l;let r=[];if(x(e)){if(r.push(...e.params),e.type==="FunctionExpression"&&e.id)r.push(e.id)}else if(e.type==="CatchClause"&&e.param)r.push(e.param);else if(e.type==="SnippetBlock")r.push(...e.parameters??[]);else if(e.type==="EachBlock"&&e.context)r.push(e.context);if(r.length===0&&!x(e))return c.set(e,E),E;let n=new Set(r.flatMap((s)=>p(s)).map((s)=>s.name));if(x(e)){let{body:s}=e;L(s,{enter(u){if(u===s)return;if(u.type==="VariableDeclaration")for(let f of u.declarations)for(let o of p(f.id))n.add(o.name);else if((u.type==="FunctionDeclaration"||u.type==="ClassDeclaration")&&u.id)n.add(u.id.name);return x(u)?y:void 0}})}return c.set(e,n),n}function x(e){return e.type==="ArrowFunctionExpression"||e.type==="FunctionExpression"||e.type==="FunctionDeclaration"}function v(e,c,l){let r=[];L(e,{enter(n,s){if(x(n)&&n.type!=="FunctionDeclaration")return y;let u=s===e||s?.type==="ExportNamedDeclaration"||s?.type==="ExportDefaultDeclaration";if(n.type==="ImportDeclaration"){for(let f of n.specifiers)c.set(f.local.name,n);return y}if(n.type==="FunctionDeclaration"||n.type==="ClassDeclaration"){if(u&&n.id)c.set(n.id.name,n);return y}if(n.type==="VariableDeclaration"){if(n.kind!=="var"&&!u)return y;for(let f of n.declarations)for(let o of p(f.id))c.set(o.name,u?f.init??null:null);return y}if(l&&s===e&&n.type==="LabeledStatement"&&n.label.name==="$"&&n.body.type==="ExpressionStatement"&&n.body.expression.type==="AssignmentExpression"){for(let f of p(n.body.expression.left))if(!f.name.startsWith("$"))r.push(f)}return}});for(let n of r)if(!c.has(n.name))c.set(n.name,null)}function G(e,c){if(e?.type!=="CallExpression")return null;let l=e.callee,r="";while(l.type==="MemberExpression"){if(l.computed||l.property.type!=="Identifier")return null;r=`.${l.property.name}${r}`,l=l.object}if(l.type==="CallExpression"&&l.callee.type==="Identifier")r=`()${r}`,l=l.callee;if(l.type!=="Identifier"||c.has(l.name))return null;return r=l.name+r,W.has(r)?r:null}export{ee as isRunesMode};