sveast 0.9.2 → 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 (54) 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 -7
  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-c9gzmr05.js +2 -0
  23. package/shared-h6c4cer7.js +2 -0
  24. package/shared-hjcsmz9f.js +2 -0
  25. package/shared-jxkrk6hx.js +10 -0
  26. package/{shared-k5pfyxpa.js → shared-n0fpkmn8.js} +2 -2
  27. package/shared-n1wnwhk8.js +3 -0
  28. package/shared-nbaaegmc.js +2 -0
  29. package/shared-rh41v5ez.js +3 -0
  30. package/shared-shxvsq2a.js +2 -0
  31. package/shared-stdj6se1.js +2 -0
  32. package/{shared-3yc3kmnb.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.d.ts +3 -2
  37. package/typescript.js +1 -1
  38. package/walk.d.ts +248 -7
  39. package/walk.js +1 -1
  40. package/shared-00hyas4z.js +0 -2
  41. package/shared-40v3xx3k.js +0 -2
  42. package/shared-4y1phpr0.js +0 -3
  43. package/shared-5kdpxrm3.js +0 -5
  44. package/shared-a454y0yc.js +0 -2
  45. package/shared-fcgh2ks8.js +0 -2
  46. package/shared-ff56bedk.js +0 -2
  47. package/shared-np5jnnrw.js +0 -2
  48. package/shared-r6mb2ytj.js +0 -2
  49. package/shared-t30czg6b.js +0 -2
  50. package/shared-tgpdmrqm.js +0 -3
  51. package/shared-wkbh341y.js +0 -2
  52. package/shared-x7fez4k2.js +0 -3
  53. package/shared-yxr92tk5.js +0 -10
  54. package/shared-zd01zsyh.js +0 -10
package/lexer.js CHANGED
@@ -1,3 +1,3 @@
1
- import{r,W,ye,u,m,_}from"./shared-4y1phpr0.js";import"./shared-40v3xx3k.js";import{H}from"./shared-tgpdmrqm.js";function g(e){let t=new f(e),o=[];return W(e,!1,(n,s)=>{let i=t.statement(s);return o.push(i),i.end}),o}function k(e){let t=new f(e),o=[];return ye(e,(n,s,i)=>{o.push(i?{kind:"template",value:t.cooked(n,s,!0),start:n,end:s}:{kind:"string",value:t.cooked(n+1,s-1,!1),start:n,end:s})}),o}class f{source;pos=0;end=0;escapeEnd=0;constructor(e){this.source=e}statement(e){this.pos=this.end=e+6;let t=this.source.charCodeAt(e)===105?{kind:"import",start:e,end:0,source:null,typeOnly:!1,specifiers:[]}:{kind:"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 i=this.peek(4);if(i===123||i===42||d(i)&&!this.isWordAfter(4,"from"))e.typeOnly=!0,this.advance(4)}let{specifiers:o,typeOnly:n}=e,s=this.at();if(s!==123&&s!==42){let i=this.pos,a=this.name();if(a===null)return!1;if(this.at()===61)return this.importEquals();if(o.push({kind:"default",imported:"default",local:a,typeOnly:n,start:i,end:this.end}),!this.eat(44))return this.from(e);s=this.at()}if(s===42){let i=this.pos;if(this.advance(1),!this.eatWord("as"))return!1;let a=this.name();if(a===null)return!1;return o.push({kind:"namespace",imported:"*",local:a,typeOnly:n,start:i,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let i=this.skip(),a=this.typeModifier()||n,l=this.name(),c=l??this.string()?.value;if(c===void 0)return!1;let h=l;if(this.eatWord("as"))h=this.name();if(h===null)return!1;if(o.push({kind:"named",imported:c,local:h,typeOnly:a,start:i,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.peek(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 n=this.peek(4);if(n===123||n===42)e.typeOnly=!0,this.advance(4)}let{specifiers:t,typeOnly:o}=e;if(this.at()===42){let n=this.pos;this.advance(1);let s=null;if(this.eatWord("as")){if(s=this.moduleExportName(),s===null)return!1}return t.push({kind:s===null?"all":"namespace",local:"*",exported:s,typeOnly:o,start:n,end:this.end}),this.from(e)}if(!this.eat(123))return!1;while(!this.eat(125)){let n=this.skip(),s=this.typeModifier()||o,i=this.moduleExportName();if(i===null)return!1;let a=i;if(this.eatWord("as"))a=this.moduleExportName();if(a===null)return!1;if(t.push({kind:"named",local:i,exported:a,typeOnly:s,start:n,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.peek(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.peek(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")&&!x(this.source,this.end,this.pos))e=6;if(e!==0&&this.peek(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}peek(e){return this.source.charCodeAt(m(this.source,this.pos+e))}isWordAfter(e,t){return _(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 _(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(!r(e.charCodeAt(t))||u(e.charCodeAt(t)))return null;let o="",n=t,s=t;while(s<e.length){let i=e.charCodeAt(s);if(i===92){if(e.charCodeAt(s+1)!==117)return null;let a=this.unicodeEscape(s+2);if(a===null)return null;o+=e.slice(n,s)+a,s=n=this.escapeEnd}else if(r(i))s++;else break}return this.advance(s-t),o+e.slice(n,s)}string(){let e=this.source,t=this.skip(),o=e.charCodeAt(t);if(o!==34&&o!==39)return null;let n="",s=t+1;for(let i=s;i<e.length;){let a=e.charCodeAt(i);if(a===o)return this.advance(i+1-t),{value:n+e.slice(s,i),start:t,end:i+1};if(a===10||a===13)return null;if(a===92){let l=this.escape(i+1);if(l===null)return null;n+=e.slice(s,i)+l,i=s=this.escapeEnd}else i++}return null}cooked(e,t,o){let n=this.source,s="",i=e;for(let a=e;a<t;){let l=n.charCodeAt(a);if(l===92){let c=this.escape(a+1);if(c===null)return null;s+=n.slice(i,a)+c,a=i=this.escapeEnd}else if(l===13&&o)s+=`${n.slice(i,a)}
2
- `,a+=n.charCodeAt(a+1)===10?2:1,i=a;else a++}return s+n.slice(i,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 u(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 u(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,o=e+1;for(;this.source.charCodeAt(o)!==125;o++){let n=p(this.source.charCodeAt(o));if(n===-1)return null;if(t=t*16+n,t>1114111)return null}if(o===e+1)return null;return this.escapeEnd=o+1,String.fromCodePoint(t)}hexEscape(e,t){let o=0;for(let n=e;n<e+t;n++){let s=p(this.source.charCodeAt(n));if(s===-1)return null;o=o*16+s}return this.escapeEnd=e+t,String.fromCharCode(o)}}function d(e){return e!==92&&r(e)&&!u(e)}function p(e){if(u(e))return e-48;let t=e|32;return t>=97&&t<=102?t-87:-1}function x(e,t,o){for(let n=t;n<o;n++){let s=e.charCodeAt(n);if(s===10||s===13||s===8232||s===8233)return!0}return!1}export{H 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-zd01zsyh.js";import"./shared-5kdpxrm3.js";import{e}from"./shared-yxr92tk5.js";import"./shared-4y1phpr0.js";import{g}from"./shared-t30czg6b.js";import{b}from"./shared-a454y0yc.js";import{U}from"./shared-fcgh2ks8.js";function m(t={}){let p=U(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.2",
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-zd01zsyh.js";import"./shared-5kdpxrm3.js";import"./shared-yxr92tk5.js";import"./shared-4y1phpr0.js";import"./shared-np5jnnrw.js";import{a}from"./shared-00hyas4z.js";import{b}from"./shared-a454y0yc.js";function s(r,t={}){return b(r,t,a)}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-zd01zsyh.js";import"./shared-5kdpxrm3.js";import{e}from"./shared-yxr92tk5.js";import"./shared-np5jnnrw.js";import{a}from"./shared-00hyas4z.js";import{g}from"./shared-t30czg6b.js";function s(r,o={}){return g(r,o,a)}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{ee}from"./shared-r6mb2ytj.js";import"./shared-tgpdmrqm.js";import"./shared-3yc3kmnb.js";import"./shared-00hyas4z.js";import"./shared-np5jnnrw.js";import"./shared-x7fez4k2.js";import"./shared-k5pfyxpa.js";import"./shared-40v3xx3k.js";import"./shared-4y1phpr0.js";import"./shared-yxr92tk5.js";import"./shared-5kdpxrm3.js";import"./shared-zd01zsyh.js";export{ee 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{Z}from"./shared-wkbh341y.js";import"./shared-3yc3kmnb.js";import"./shared-00hyas4z.js";import"./shared-np5jnnrw.js";import"./shared-x7fez4k2.js";import"./shared-k5pfyxpa.js";import"./shared-40v3xx3k.js";import"./shared-yxr92tk5.js";import"./shared-5kdpxrm3.js";import"./shared-zd01zsyh.js";export{Z 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{s}from"./shared-40v3xx3k.js";import{r,N}from"./shared-4y1phpr0.js";import"./shared-5kdpxrm3.js";import"./shared-zd01zsyh.js";import"./shared-yxr92tk5.js";import"./shared-k5pfyxpa.js";import"./shared-x7fez4k2.js";import"./shared-np5jnnrw.js";import{Z}from"./shared-wkbh341y.js";import{ee}from"./shared-r6mb2ytj.js";import{w,G,d,O}from"./shared-ff56bedk.js";import{H}from"./shared-tgpdmrqm.js";import"./shared-3yc3kmnb.js";import"./shared-00hyas4z.js";var C=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"]),S=new Set(["$state","$derived","$props","$bindable","$effect","$inspect","$host"]),b=/(?<![\w$])(?:\$(?:state|derived|props|bindable|effect|inspect|host)(?![\w$])|await(?![\w$]))|\\u/g,D=/^\{\s*(true|false)\s*\}$/;function z(e){let l=H(e),n=l.options?.attributes.find((u)=>u.name==="runes"),i=n&&I(n);if(i!==void 0)return i;let t=e.charCodeAt(0)===65279?e.slice(1):e,a=[l.instance,l.module].flatMap((u)=>u?[u.content]:[]),p=!1,c=!1;b.lastIndex=0;for(let u=b.exec(t);u!==null&&!c;u=b.exec(t)){let h=u.index;p=!0,c=!a.some(({start:E,end:v})=>h>=E&&h<v)}if(!p)return!1;if(n===void 0&&!t.includes("\\u")&&R(t,a))return!0;let o={css:!1,comments:!1},f=c?Z(e,o):ee(e,o);if(f.options?.runes!==void 0)return f.options.runes;return L(f)}function I(e){if(e.value===!0)return!0;let l=D.exec(e.value);return l?l[1]==="true":void 0}var M=new Map([...S].map((e)=>[e,new RegExp(`(?<![\\w$.])${e.slice(1)}(?![\\w$])`)])),F=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 R(e,l){let n=new Map;for(let{start:i,end:t}of l){let a=e.slice(0,t);if(N(a,i,(c,o)=>{if(a.charCodeAt(c)!==36)return!1;let f=a.slice(c,o);if(S.has(f)&&n.get(f)!==!1)n.set(f,T(a,c,o));return!1})!==a.length)return!1}for(let[i,t]of n)if(t&&!M.get(i)?.test(e))return!0;return!1}function T(e,l,n){let i=l-1;while(i>=0&&s(e.charCodeAt(i)))i--;let t=e.charCodeAt(i);if(t===35||t===42||t===46||t===58||t===60||t===64)return!1;if(r(t)){let o=i;while(o>0&&r(e.charCodeAt(o-1)))o--;if(F.has(e.slice(o,i+1)))return!1}let a=y(e,n);while(e.charCodeAt(a)===46){let o=y(e,a+1),f=o;while(r(e.charCodeAt(f)))f++;if(f===o)return!1;a=y(e,f)}if(e.charCodeAt(a)===60){if(a=k(e,a),a===-1)return!1;a=y(e,a)}if(e.charCodeAt(a)!==40)return!1;let p=N(e,a+1);if(e.charCodeAt(p)!==41)return!1;let c=e.charCodeAt(y(e,p+1));return c!==123&&c!==58}function y(e,l){let n=l;while(n<e.length&&s(e.charCodeAt(n)))n++;return n}function k(e,l){let n=0,i=Math.min(e.length,l+2000);for(let t=l;t<i;t++){let a=e.charCodeAt(t);if(a===34||a===39||a===96||a===47)return-1;if(a===60)n++;else if(a===62&&e.charCodeAt(t-1)!==61){if(n--,n===0)return t+1}}return-1}function L(e){let l=e.module?.content,n=e.instance?.content,i=new Map;if(n)A(n,i,!0);let t=new Map;if(l)A(l,t,!1);for(let[c,o]of t)if(!i.has(c))i.set(c,o);let a=[],p=(c)=>{if(!a.includes(c))a.push(c)};if(l)x(l,t,p);if(n&&x(n,i,p))return!0;if(x(e.fragment,i,p))return!0;for(let c of a){let o=c.slice(1);if(!i.has(o))return!0;let f=i.get(o)??null,u=P(f,i);if(!((u===null||o!=="props"&&u==="$props")&&!(c==="$derived"&&f?.type==="ImportDeclaration"&&f.source.value==="svelte/store")))return!0;i.set(c,null)}return!1}function x(e,l,n){let i=[],t=new Map,a=(o)=>S.has(o)&&!l.has(o)&&!i.some((f)=>_(f,t).has(o)),p=0,c=!1;return O(e,{enter(o,f){if(m(o))p++;else if(o.type==="AwaitExpression")c||=p===0;let u;if(o.type==="Identifier"&&f&&!f.type.startsWith("TS")&&G(o,f))u=o.name;else if(o.type==="TransitionDirective"||o.type==="AnimateDirective"||o.type==="UseDirective")u=o.name.split(".")[0];else if(o.type==="StyleDirective"&&o.value===!0)u=o.name;if(u!==void 0&&a(u))n(u);i.push(o)},leave(o){if(i.pop(),m(o))p--}}),c}var g=new Set;function _(e,l){let n=l.get(e);if(n)return n;let i=[];if(m(e)){if(i.push(...e.params),e.type==="FunctionExpression"&&e.id)i.push(e.id)}else if(e.type==="CatchClause"&&e.param)i.push(e.param);else if(e.type==="SnippetBlock")i.push(...e.parameters??[]);else if(e.type==="EachBlock"&&e.context)i.push(e.context);if(i.length===0&&!m(e))return l.set(e,g),g;if(n=new Set(i.flatMap((t)=>w(t)).map((t)=>t.name)),m(e)){let{body:t}=e;O(t,{enter(a){if(a===t)return;if(a.type==="VariableDeclaration")for(let p of a.declarations)for(let c of w(p.id))n?.add(c.name);else if((a.type==="FunctionDeclaration"||a.type==="ClassDeclaration")&&a.id)n?.add(a.id.name);return m(a)?d:void 0}})}return l.set(e,n),n}function m(e){return e.type==="ArrowFunctionExpression"||e.type==="FunctionExpression"||e.type==="FunctionDeclaration"}function A(e,l,n){let i=[];O(e,{enter(t,a){if(m(t)&&t.type!=="FunctionDeclaration")return d;let p=a===e||a?.type==="ExportNamedDeclaration"||a?.type==="ExportDefaultDeclaration";if(t.type==="ImportDeclaration"){for(let c of t.specifiers)l.set(c.local.name,t);return d}if(t.type==="FunctionDeclaration"||t.type==="ClassDeclaration"){if(p&&t.id)l.set(t.id.name,t);return d}if(t.type==="VariableDeclaration"){if(t.kind!=="var"&&!p)return d;for(let c of t.declarations)for(let o of w(c.id))l.set(o.name,p?c.init??null:null);return d}if(n&&a===e&&t.type==="LabeledStatement"&&t.label.name==="$"&&t.body.type==="ExpressionStatement"&&t.body.expression.type==="AssignmentExpression"){for(let c of w(t.body.expression.left))if(!c.name.startsWith("$"))i.push(c)}return}});for(let t of i)if(!l.has(t.name))l.set(t.name,null)}function P(e,l){if(e?.type!=="CallExpression")return null;let n=e.callee,i="";while(n.type==="MemberExpression"){if(n.computed||n.property.type!=="Identifier")return null;i=`.${n.property.name}${i}`,n=n.object}if(n.type==="CallExpression"&&n.callee.type==="Identifier")i=`()${i}`,n=n.callee;if(n.type!=="Identifier"||l.has(n.name))return null;return i=n.name+i,C.has(i)?i:null}export{z 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};