sveast 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -3
- package/core.js +1 -1
- package/entities.js +1 -1
- package/index.d.ts +439 -0
- package/index.js +1 -1
- package/is-valid-type.js +1 -1
- package/lexer.js +3 -3
- package/module.js +1 -1
- package/package.json +6 -1
- package/parse-imports-exports.js +1 -1
- package/parse-module.js +1 -1
- package/parse-sections.js +1 -1
- package/parse.js +1 -1
- package/runes.js +1 -1
- package/scope.d.ts +1794 -0
- package/scope.js +1 -0
- package/shared-2pngd0mg.js +10 -0
- package/shared-5tpb3h6x.js +2 -0
- package/shared-bzqbnvee.js +2 -0
- package/shared-cs1ezg1f.js +2 -0
- package/shared-dgdrqgdn.js +2 -0
- package/shared-drb44hb9.js +2 -0
- package/shared-h6z1kjbb.js +2 -0
- package/shared-jpvd0875.js +2 -0
- package/shared-ke0fgd3r.js +2 -0
- package/shared-m0dcdh24.js +5 -0
- package/shared-m3dr31c3.js +2 -0
- package/shared-nan648gn.js +10 -0
- package/shared-qkp49nav.js +2 -0
- package/shared-rce4ty8a.js +3 -0
- package/shared-rvkvagj5.js +2 -0
- package/shared-xwzsb4m8.js +3 -0
- package/shared-y3nf00py.js +3 -0
- package/shared-y41kz9tv.js +2 -0
- package/shared-z9y4mrek.js +2 -0
- package/typescript.js +1 -1
- package/walk.d.ts +247 -0
- package/walk.js +1 -1
- package/shared-1z80250f.js +0 -2
- package/shared-2m9w933n.js +0 -2
- package/shared-3bhr0q10.js +0 -2
- package/shared-3ez2yv7r.js +0 -2
- package/shared-4t495q2a.js +0 -2
- package/shared-7q3geqgt.js +0 -2
- package/shared-bbp47cz4.js +0 -10
- package/shared-bx03zqyq.js +0 -2
- package/shared-cr4ebmgx.js +0 -5
- package/shared-g06vtkxe.js +0 -2
- package/shared-g7qbtk93.js +0 -3
- package/shared-j1r12f45.js +0 -3
- package/shared-njpj8eam.js +0 -2
- package/shared-qbw8n9am.js +0 -2
- package/shared-saxr459v.js +0 -2
- package/shared-wfjkg544.js +0 -10
- package/shared-wr6wdcs6.js +0 -2
- package/shared-xa3xp3kp.js +0 -3
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var names=Array(2048).fill(void 0);function resetNames(){names.fill(void 0)}function internName(input,start,end,hash){let slot=hash&2047,name=names[slot];if(name!==void 0&&name.length===end-start&&input.startsWith(name,start))return name;let word=input.slice(start,end);return names[slot]=word,word}var source="",lineStarts=[0],scanned=0,lastLine=0,breakEnds;function setSource(value){resetNames(),source=value,lineStarts=[0],scanned=0,lastLine=0,breakEnds=void 0}function scanTo(index){while(scanned<=index){let newline=source.indexOf(`
|
|
2
|
+
`,scanned);if(newline===-1){scanned=Number.POSITIVE_INFINITY;return}scanned=newline+1,lineStarts.push(scanned)}}function lineStartsOf(text){let starts=[0],i=text.indexOf(`
|
|
3
|
+
`);while(i!==-1)starts.push(i+1),i=text.indexOf(`
|
|
4
|
+
`,i+1);return starts}function lineOf(starts,index,hint){let low=0,high=starts.length-1;if(index>=starts[hint])low=hint;else high=hint-1;if(low<high&&index<starts[low+1])high=low;while(low<high){let mid=low+high+1>>>1;if(starts[mid]<=index)low=mid;else high=mid-1}return low}function locate3(index){return scanTo(index),lastLine=lineOf(lineStarts,index,lastLine),{line:lastLine+1,column:index-lineStarts[lastLine],character:index}}var REGEX_LINE_BREAK=/\r\n?|\n|\u2028|\u2029/g,REGEX_OTHER_LINE_BREAK=/[\r\u2028\u2029]/;function lineBreaksBefore(offset){if(breakEnds===void 0){breakEnds=REGEX_OTHER_LINE_BREAK.test(source)?[]:null,REGEX_LINE_BREAK.lastIndex=0;while(breakEnds!==null&®EX_LINE_BREAK.exec(source)!==null)breakEnds.push(REGEX_LINE_BREAK.lastIndex)}if(breakEnds===null)return scanTo(offset),lineOf(lineStarts,offset,lastLine);let low=0,high=breakEnds.length;while(low<high){let mid=low+high>>>1;if(breakEnds[mid]<=offset)low=mid+1;else high=mid}return low}function position(index){let{line,column}=locate3(index);return{line,column}}function lineText(line){while(lineStarts.length<=line+1&&scanned!==Number.POSITIVE_INFINITY)scanTo(scanned);if(line>=lineStarts.length)return;let end=line+1<lineStarts.length?lineStarts[line+1]-1:source.length;return source.slice(lineStarts[line],end)}function createLocator2(text){let starts,last=0;return(offset)=>(starts??=lineStartsOf(text),last=lineOf(starts,offset,last),{line:last+1,column:offset-starts[last]})}function isNode(value){return typeof value==="object"&&value!==null&&typeof fieldsOf(value).type==="string"}function fieldsOf(node){return node}function mapChildren(node,map){let fields=fieldsOf(node);for(let key in fields){let value=fields[key];if(Array.isArray(value)){for(let i=0;i<value.length;i++)if(isNode(value[i]))value[i]=map(value[i])}else if(isNode(value))fields[key]=map(value)}}function assertType(node,...types){if(!types.some((type)=>type===node.type))throw Error(`expected ${types.join(" or ")}, got ${node.type}`)}
|
|
5
|
+
export{internName,setSource,lineStartsOf,lineOf,locate3,lineBreaksBefore,position,lineText,createLocator2,isNode,fieldsOf,mapChildren,assertType};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var RUNES=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"]),RUNE_NAMES=new Set(["$state","$derived","$props","$bindable","$effect","$inspect","$host"]);
|
|
2
|
+
export{RUNES,RUNE_NAMES};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{internName,locate3,lineBreaksBefore,lineText,isNode,fieldsOf,mapChildren}from"./shared-m0dcdh24.js";import{definePlugin,extendParser,hasLineBreak,hasName}from"./shared-2pngd0mg.js";import{missingTypeScript}from"./shared-h6z1kjbb.js";var REGEX_LEADING_TABS=/^\t+/;class ParseError2 extends Error{name="ParseError";code;reason;position;start;end;frame;constructor(node,code,reason){super(`${reason}
|
|
2
|
+
https://svelte.dev/e/${code}`);this.code=code,this.reason=reason;let start=typeof node==="number"?node:node?.start,end=typeof node==="number"?node:node?.end;if(start!==void 0)this.position=[start,end??start],this.start=locate3(this.position[0]),this.end=locate3(this.position[1]),this.frame=codeFrame(this.start.line-1,this.end.column)}}var tabsToSpaces=(text)=>text.replace(REGEX_LEADING_TABS,(match)=>" ".repeat(match.length));function codeFrame(line,column){let frameStart=Math.max(0,line-2),lines=[];for(let i=frameStart;i<line+3;i++){let text=lineText(i);if(text===void 0)break;lines.push(text)}let digits=String(frameStart+lines.length+1).length;return lines.map((text,i)=>{let numbered=`${String(frameStart+i+1).padStart(digits," ")}: ${tabsToSpaces(text)}`;if(frameStart+i!==line)return numbered;return`${numbered}
|
|
3
|
+
${" ".repeat(digits+2+tabsToSpaces(text.slice(0,column)).length)}^`}).join(`
|
|
4
|
+
`)}function attribute_duplicate(node){throw new ParseError2(node,"attribute_duplicate","Attributes need to be unique")}function attribute_empty_shorthand(node){throw new ParseError2(node,"attribute_empty_shorthand","Attribute shorthand cannot be empty")}function block_duplicate_clause(node,name){throw new ParseError2(node,"block_duplicate_clause",`${name} cannot appear more than once within a block`)}function block_invalid_continuation_placement(node){throw new ParseError2(node,"block_invalid_continuation_placement","{:...} block is invalid at this position (did you forget to close the preceding element or block?)")}function block_invalid_elseif(node){throw new ParseError2(node,"block_invalid_elseif","'elseif' should be 'else if'")}function block_invalid_placement(node,name,location){throw new ParseError2(node,"block_invalid_placement",`{#${name} ...} block cannot be ${location}`)}function block_unclosed(node){throw new ParseError2(node,"block_unclosed","Block was left open")}function block_unexpected_close(node){throw new ParseError2(node,"block_unexpected_close","Unexpected block closing tag")}function const_tag_invalid_expression(node){throw new ParseError2(node,"const_tag_invalid_expression","{@const ...} must consist of a single variable declaration")}function css_empty_declaration(node){throw new ParseError2(node,"css_empty_declaration","Declaration cannot be empty")}function css_expected_identifier(node){throw new ParseError2(node,"css_expected_identifier","Expected a valid CSS identifier")}function css_selector_invalid(node){throw new ParseError2(node,"css_selector_invalid","Invalid selector")}function debug_tag_invalid_arguments(node){throw new ParseError2(node,"debug_tag_invalid_arguments","{@debug ...} arguments must be identifiers, not arbitrary expressions")}function declaration_tag_invalid_type(node){throw new ParseError2(node,"declaration_tag_invalid_type","Declaration tags must be `let` or `const` declarations")}function directive_invalid_value(node){throw new ParseError2(node,"directive_invalid_value","Directive value must be a JavaScript expression enclosed in curly braces")}function directive_missing_name(node,type){throw new ParseError2(node,"directive_missing_name",`\`${type}\` name cannot be empty`)}function element_invalid_closing_tag(node,name){throw new ParseError2(node,"element_invalid_closing_tag",`\`</${name}>\` attempted to close an element that was not open`)}function element_invalid_closing_tag_autoclosed(node,name,reason){throw new ParseError2(node,"element_invalid_closing_tag_autoclosed",`\`</${name}>\` attempted to close element that was already automatically closed by \`<${reason}>\` (cannot nest \`<${reason}>\` inside \`<${name}>\`)`)}function element_unclosed(node,name){throw new ParseError2(node,"element_unclosed",`\`<${name}>\` was left open`)}function expected_attribute_value(node){throw new ParseError2(node,"expected_attribute_value","Expected attribute value")}function expected_block_type(node){throw new ParseError2(node,"expected_block_type","Expected 'if', 'each', 'await', 'key' or 'snippet'")}function expected_identifier(node){throw new ParseError2(node,"expected_identifier","Expected an identifier")}function expected_pattern(node){throw new ParseError2(node,"expected_pattern","Expected identifier or destructure pattern")}function expected_tag(node){throw new ParseError2(node,"expected_tag","Expected 'html', 'render', 'attach', 'const', or 'debug'")}function expected_token(node,token){throw new ParseError2(node,"expected_token",`Expected token ${token}`)}function expected_whitespace(node){throw new ParseError2(node,"expected_whitespace","Expected whitespace")}function js_parse_error(node,message){throw new ParseError2(node,"js_parse_error",`${message}`)}function render_tag_invalid_expression(node){throw new ParseError2(node,"render_tag_invalid_expression","`{@render ...}` tags can only contain call expressions")}function script_duplicate(node){throw new ParseError2(node,"script_duplicate","A component can have a single top-level `<script>` element and/or a single top-level `<script module>` element")}function script_invalid_attribute_value(node,name){throw new ParseError2(node,"script_invalid_attribute_value",`If the \`${name}\` attribute is supplied, it must be a boolean attribute`)}function script_invalid_context(node){throw new ParseError2(node,"script_invalid_context",'If the context attribute is supplied, its value must be "module"')}function script_reserved_attribute(node,name){throw new ParseError2(node,"script_reserved_attribute",`The \`${name}\` attribute is reserved and cannot be used`)}function style_duplicate(node){throw new ParseError2(node,"style_duplicate","A component can have a single top-level `<style>` element")}function svelte_component_invalid_this(node){throw new ParseError2(node,"svelte_component_invalid_this","Invalid component definition — must be an `{expression}`")}function svelte_component_missing_this(node){throw new ParseError2(node,"svelte_component_missing_this","`<svelte:component>` must have a 'this' attribute")}function svelte_element_missing_this(node){throw new ParseError2(node,"svelte_element_missing_this","`<svelte:element>` must have a 'this' attribute with a value")}function svelte_meta_duplicate(node,name){throw new ParseError2(node,"svelte_meta_duplicate",`A component can only have one \`<${name}>\` element`)}function svelte_meta_invalid_content(node,name){throw new ParseError2(node,"svelte_meta_invalid_content",`<${name}> cannot have children`)}function svelte_meta_invalid_placement(node,name){throw new ParseError2(node,"svelte_meta_invalid_placement",`\`<${name}>\` tags cannot be inside elements or blocks`)}function svelte_meta_invalid_tag(node,list){throw new ParseError2(node,"svelte_meta_invalid_tag",`Valid \`<svelte:...>\` tag names are ${list}`)}function svelte_options_deprecated_tag(node){throw new ParseError2(node,"svelte_options_deprecated_tag",'"tag" option is deprecated — use "customElement" instead')}function svelte_options_invalid_attribute(node){throw new ParseError2(node,"svelte_options_invalid_attribute","`<svelte:options>` can only receive static attributes")}function svelte_options_invalid_attribute_value(node,list){throw new ParseError2(node,"svelte_options_invalid_attribute_value",`Value must be ${list}, if specified`)}function svelte_options_invalid_customelement(node){throw new ParseError2(node,"svelte_options_invalid_customelement",'"customElement" must be a string literal defining a valid custom element name or an object of the form { tag?: string; shadow?: "open" | "none" | `ShadowRootInit`; props?: { [key: string]: { attribute?: string; reflect?: boolean; type: .. } } }')}function svelte_options_invalid_customelement_props(node){throw new ParseError2(node,"svelte_options_invalid_customelement_props",'"props" must be a statically analyzable object literal of the form "{ [key: string]: { attribute?: string; reflect?: boolean; type?: "String" | "Boolean" | "Number" | "Array" | "Object" }"')}function svelte_options_invalid_customelement_shadow(node){throw new ParseError2(node,"svelte_options_invalid_customelement_shadow",'"shadow" must be either "open", "none" or `ShadowRootInit` object.')}function svelte_options_invalid_tagname(node){throw new ParseError2(node,"svelte_options_invalid_tagname","Tag name must be lowercase and hyphenated")}function svelte_options_reserved_tagname(node){throw new ParseError2(node,"svelte_options_reserved_tagname","Tag name is reserved")}function svelte_options_unknown_attribute(node,name){throw new ParseError2(node,"svelte_options_unknown_attribute",`\`<svelte:options>\` unknown attribute '${name}'`)}function tag_invalid_name(node){throw new ParseError2(node,"tag_invalid_name","Expected a valid element or component name. Components must have a valid variable name or dot notation expression")}function tag_invalid_placement(node,name,location){throw new ParseError2(node,"tag_invalid_placement",`{@${name} ...} tag cannot be ${location}`)}function unexpected_eof(node){throw new ParseError2(node,"unexpected_eof","Unexpected end of input")}function unexpected_reserved_word(node,word){throw new ParseError2(node,"unexpected_reserved_word",`'${word}' is a reserved word in JavaScript and cannot be used here`)}function unterminated_string_constant(node){throw new ParseError2(node,"unterminated_string_constant","Unterminated string constant")}function void_element_invalid_content(node){throw new ParseError2(node,"void_element_invalid_content","Void elements cannot have children or closing tags")}var commentSource="",commentSink=[],commentEnd=0,queue=[],next=0;function bindOnComment(source,comments){commentSource=source,commentSink=comments,commentEnd=0}function lastCommentEnd(){return commentEnd}function skipComment(_block,_value,_start,end){commentEnd=end}function onComment(block,rawValue,start,end,startLoc,endLoc){commentEnd=end;let value=rawValue;if(block&&value.includes(`
|
|
5
|
+
`)){let lineStart=commentSource.lastIndexOf(`
|
|
6
|
+
`,start-1)+1,indentEnd=lineStart,code=commentSource.charCodeAt(indentEnd);while(code===32||code===9)code=commentSource.charCodeAt(++indentEnd);if(indentEnd>lineStart)value=stripLeadingIndentation(value,commentSource.slice(lineStart,indentEnd))}let comment={type:block?"Block":"Line",value,start,end};if(startLoc&&endLoc)comment.loc={start:startLoc,end:endLoc};commentSink.push(comment)}function stripLeadingIndentation(value,indentation){let from=value.startsWith(indentation)?indentation.length:0,result="",newline=value.indexOf(`
|
|
7
|
+
`,from);while(newline!==-1){if(result+=value.slice(from,newline+1),from=newline+1,value.startsWith(indentation,from))from+=indentation.length;newline=value.indexOf(`
|
|
8
|
+
`,from)}return result+value.slice(from)}function attachComments(ast,comments,fromIndex){let low=0,high=comments.length;while(low<high){let mid=low+high>>>1;if(comments[mid].start<fromIndex)low=mid+1;else high=mid}if(low>=comments.length)return;if(queue=comments.slice(low).map(({type,value,start,end})=>({type,value,start,end})),next=0,visit(ast,void 0,!1),next<queue.length&&(queue[next].start>=ast.end||ast.type==="Program")){ast.trailingComments??=[];while(next<queue.length)ast.trailingComments.push(queue[next++])}}var LIST_KEYS=new Map([["BlockStatement","body"],["Program","body"],["ArrayExpression","elements"],["ObjectExpression","properties"]]);function gapBlocked(from,to){for(let i=from;i<to;i++){let code=commentSource.charCodeAt(i);if(code!==44&&code!==41&&code!==32&&code!==9)return!0}return!1}function visit(node,parent,lastInBody){while(next<queue.length&&queue[next].start<node.start)node.leadingComments??=[],node.leadingComments.push(queue[next++]);if(next>=queue.length)return;let upcoming=queue[next].start;if(upcoming<node.end||!gapBlocked(node.end,upcoming)){let fields=fieldsOf(node),listKey=LIST_KEYS.get(node.type),list=listKey===void 0?void 0:fields[listKey],listEmpty=Array.isArray(list)&&list.length===0;for(let key in fields){if(next>=queue.length)return;if(key==="type")continue;let value=fields[key];if(Array.isArray(value)){let inList=key===listKey;for(let i=0;i<value.length;i++){let child=value[i];if(isNode(child))visit(child,node,inList?i===value.length-1:listEmpty)}}else if(isNode(value))visit(value,node,listEmpty)}if(next>=queue.length)return}if(parent!==void 0&&node.end===parent.end)return;if(lastInBody)while(next<queue.length){if(parent&&queue[next].start>=parent.end)break;node.trailingComments??=[],node.trailingComments.push(queue[next++])}else if(node.end<=queue[next].start&&!gapBlocked(node.end,queue[next].start))node.trailingComments=[queue[next++]]}var RESERVED_WORDS=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" "));var sawParenthesized=!1,SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_SIMPLE_CATCH=32,SCOPE_CLASS_STATIC_BLOCK=256,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,LINE_BREAK=/\r\n?|\n|\u2028|\u2029/,WORD_TESTERS=new Map;function wordTester(words){if(!(words instanceof RegExp))return words;let tester=WORD_TESTERS.get(words);if(!tester){let set=new Set(words.source.slice(4,-2).split("|"));tester={test:(word)=>set.has(word)},WORD_TESTERS.set(words,tester)}return tester}var declarations=definePlugin((Base)=>class extends Base{declareName(name,bindingType,pos){let redeclared=!1;if(bindingType===BIND_LEXICAL){let scope=this.currentScope();if(redeclared=hasName(scope.lexical,name)||hasName(scope.functions,name)||hasName(scope.var,name),scope.lexical.push(name),this.inModule&&scope.flags&SCOPE_TOP)delete this.undefinedExports[name]}else if(bindingType===BIND_SIMPLE_CATCH)this.currentScope().lexical.push(name);else if(bindingType===BIND_FUNCTION){let scope=this.currentScope();redeclared=this.treatFunctionsAsVar?hasName(scope.lexical,name):hasName(scope.lexical,name)||hasName(scope.var,name),scope.functions.push(name)}else for(let i=this.scopeStack.length-1;i>=0;--i){let scope=this.scopeStack[i];if(hasName(scope.lexical,name)&&!(scope.flags&SCOPE_SIMPLE_CATCH&&scope.lexical[0]===name)||!this.treatFunctionsAsVarInScope(scope)&&hasName(scope.functions,name)){redeclared=!0;break}if(scope.var.push(name),this.inModule&&scope.flags&SCOPE_TOP)delete this.undefinedExports[name];if(scope.flags&SCOPE_VAR)break}if(redeclared)this.raiseRecoverable(pos,`Identifier '${name}' has already been declared`)}}),tweaks=definePlugin((Base)=>{let{keywordTypes,tokTypes}=Base.acorn,keywordTokens=new Map("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this const class extends export import super".split(" ").map((word)=>[word,keywordTypes[word]])),initialContext;return class extends Base{constructor(options,input,startPos){super(options,input,startPos);this.keywords=wordTester(this.keywords),this.reservedWords=wordTester(this.reservedWords),this.reservedWordsStrict=wordTester(this.reservedWordsStrict),this.reservedWordsStrictBind=wordTester(this.reservedWordsStrictBind),initialContext??=this.context[0]}reset(input,pos,startLocation){if(super.reset?.(input,pos,startLocation),this.input=input,this.containsEsc=!1,this.pos=pos,startLocation)this.lineStart=pos-startLocation.column,this.curLine=startLocation.line;else this.lineStart=input.lastIndexOf(`
|
|
9
|
+
`,pos-1)+1,this.curLine=this.options.locations?input.slice(0,this.lineStart).split(LINE_BREAK).length:1;this.type=tokTypes.eof,this.value=null,this.start=this.end=pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=pos;let context=this.context;if(context.length!==1||context[0]!==initialContext)this.context=this.initialContext();if(this.exprAllowed=!0,this.strict=!0,this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels.length>0)this.labels=[];for(let _ in this.undefinedExports){this.undefinedExports=Object.create(null);break}let scopes=this.scopeStack,top=scopes[0];if(scopes.length!==1||top.flags!==SCOPE_TOP||top.var.length>0||top.lexical.length>0||top.functions.length>0||top.tsTypes!==void 0||top.tsExportOnly!==void 0||top.tsEnums!==void 0)this.scopeStack=[],this.enterScope(SCOPE_TOP);if(this.regexpState=null,this.privateNameStack.length>0)this.privateNameStack=[];this.inTemplateElement=!1}parseParenAndDistinguishExpression(canBeArrow,forInit){let node=super.parseParenAndDistinguishExpression(canBeArrow,forInit);if(node.type==="ParenthesizedExpression")sawParenthesized=!0;return node}checkUnreserved(ref){if(RESERVED_WORDS.has(ref.name))super.checkUnreserved(ref)}canInsertSemicolon(){let type=this.type;return type===tokTypes.eof||type===tokTypes.braceR||hasLineBreak(this.input,this.lastTokEnd,this.start)}checkLocalExport(){}skipSpace(){let input=this.input,locations=this.options.locations,pos=this.pos,code=input.charCodeAt(pos);for(;;)if(code===32||code===9)code=input.charCodeAt(++pos);else if(code===10){if(code=input.charCodeAt(++pos),locations)this.curLine++,this.lineStart=pos}else break;if(this.pos=pos,code===47||code<33||code>=128)super.skipSpace()}readWord1(){let input=this.input,start=this.pos,end=start,code=input.charCodeAt(end),hash=0;while(code>=97&&code<=122||code>=65&&code<=90||code>=48&&code<=57||code===95||code===36)hash=Math.imul(hash,31)+code|0,code=input.charCodeAt(++end);if(code>=128||code===92)return super.readWord1();return this.containsEsc=!1,this.pos=end,internName(input,start,end,hash)}readWord(){let word=this.readWord1();return this.finishToken(keywordTokens.get(word)??tokTypes.name,word)}}}),JSParser=extendParser(declarations,tweaks),REGEX_POSITION_SUFFIX=/ \(\d+:\d+\)$/;function estree(node){return node}function isSyntaxErrorAt(error){return error instanceof SyntaxError&&"pos"in error&&typeof error.pos==="number"}function run(context,source,start,preserveParens,parse,commentsBefore=context.root.comments.length){let comments=context.root.comments;bindOnComment(source,comments);let options={onComment:context.comments?onComment:skipComment,sourceType:"module",ecmaVersion:16,locations:context.loc,preserveParens};if(context.lfOnly)options.startLocation=locate3(start);let ParserClass=context.isTypeScript?context.typescript:JSParser;if(!ParserClass)missingTypeScript();let node;try{node=parse(ParserClass,options)}catch(error){if(!isSyntaxErrorAt(error))throw error;js_parse_error(error.pos,error.message.replace(REGEX_POSITION_SUFFIX,""))}if(comments.length>commentsBefore)attachComments(estree(node),comments,start);return node}function parseProgram(context,source,start=0){return estree(run(context,source,0,!1,(ParserClass,options)=>{if(start>0&&options.locations)options.startLocation=locate3(start);let program=new ParserClass(options,source,start).parse();return program.start=0,program},0))}function acornLocation(index,locations){if(!locations)return{line:1,column:0};let{column}=locate3(index);return{line:lineBreaksBefore(index-column)+1,column}}var acornExpressionParses={count:0},spare,readExpression=(parser)=>parser.parseExpression();function parseWithSpare(ParserClass,options,source,index,read){let entry=spare;if(spare=void 0,entry?.ParserClass===ParserClass&&entry.onComment===options.onComment&&entry.locations===options.locations&&entry.parser.reset)entry.parser.reset(source,index,options.startLocation);else entry={ParserClass,onComment:options.onComment,locations:options.locations,parser:new ParserClass(options,source,index)};let parser=entry.parser;parser.nextToken();let node=read(parser);return parser.input="",spare=entry,node}function parseMarkupAt(context,source,index,read){return acornExpressionParses.count+=1,sawParenthesized=!1,run(context,source,index,!0,(ParserClass,options)=>(options.startLocation??=acornLocation(index,options.locations),parseWithSpare(ParserClass,options,source,index,read)))}function parseExpressionAt(context,source,index,keepParens=!1){let node=estree(parseMarkupAt(context,source,index,readExpression)),end=Math.max(node.end,lastCommentEnd());return{node:sawParenthesized&&!keepParens?removeParens(node):node,end}}function parsePatternAt(context,source,index){let comments=context.root.comments.length,complete=!0,node=parseMarkupAt(context,source,index,(parser)=>{let refDestructuringErrors={shorthandAssign:-1,trailingComma:-1,parenthesizedAssign:-1,parenthesizedBind:-1,doubleProto:-1},left=parser.parseMaybeConditional(void 0,refDestructuringErrors);if(parser.type!==JSParser.acorn.tokTypes.eof)return complete=!1,left;let pattern=parser.toAssignable(left,!1,refDestructuringErrors);return parser.checkLValPattern(pattern),pattern});if(!complete){context.root.comments.length=comments;return}let pattern=estree(node);return sawParenthesized?removeParens(pattern):pattern}function parseStatementAt(context,source,index){return estree(run(context,source,index,!1,(ParserClass,options)=>{let parser=new ParserClass(options,source,index);try{return parser.nextToken(),parser.parseStatement(null,!0,Object.create(null))}catch(error){if(isSyntaxErrorAt(error)&&error.pos===source.length)unexpected_eof(source.length);throw error}}))}function parseStatementsAt(context,source,find){let program=run(context,source,0,!1,(ParserClass,options)=>{let parser=new ParserClass(options,source,0),node=parser.startNode(),body=[],exports=Object.create(null);return find((index)=>{parser.pos=index,parser.context=parser.initialContext(),parser.exprAllowed=!0,parser.nextToken();let statement=parser.parseStatement(null,!0,exports);return body.push(statement),statement.end}),node.body=body,parser.finishNode(node,"Program")});return estree(program).body}function removeParens(node){let inner=node;while(inner.type==="ParenthesizedExpression")inner=inner.expression;return mapChildren(inner,removeParens),inner}
|
|
10
|
+
export{ParseError2,attribute_duplicate,attribute_empty_shorthand,block_duplicate_clause,block_invalid_continuation_placement,block_invalid_elseif,block_invalid_placement,block_unclosed,block_unexpected_close,const_tag_invalid_expression,css_empty_declaration,css_expected_identifier,css_selector_invalid,debug_tag_invalid_arguments,declaration_tag_invalid_type,directive_invalid_value,directive_missing_name,element_invalid_closing_tag,element_invalid_closing_tag_autoclosed,element_unclosed,expected_attribute_value,expected_block_type,expected_identifier,expected_pattern,expected_tag,expected_token,expected_whitespace,render_tag_invalid_expression,script_duplicate,script_invalid_attribute_value,script_invalid_context,script_reserved_attribute,style_duplicate,svelte_component_invalid_this,svelte_component_missing_this,svelte_element_missing_this,svelte_meta_duplicate,svelte_meta_invalid_content,svelte_meta_invalid_placement,svelte_meta_invalid_tag,svelte_options_deprecated_tag,svelte_options_invalid_attribute,svelte_options_invalid_attribute_value,svelte_options_invalid_customelement,svelte_options_invalid_customelement_props,svelte_options_invalid_customelement_shadow,svelte_options_invalid_tagname,svelte_options_reserved_tagname,svelte_options_unknown_attribute,tag_invalid_name,tag_invalid_placement,unexpected_eof,unexpected_reserved_word,unterminated_string_constant,void_element_invalid_content,RESERVED_WORDS,declarations,tweaks,parseProgram,parseExpressionAt,parsePatternAt,parseStatementAt,parseStatementsAt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{parseComponent}from"./shared-xwzsb4m8.js";import{htmlEntityNames}from"./shared-drb44hb9.js";import{TypeScriptParser}from"./shared-ke0fgd3r.js";var support={typescript:TypeScriptParser,entityNames:htmlEntityNames};function parse2(source,options){return parseComponent(source,options,support)}
|
|
2
|
+
export{parse2};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{closingTagOmitted}from"./shared-dgdrqgdn.js";import{withoutByteOrderMark,isWhitespace,skipWhitespace,isTypeScript,closingScriptTag,closingScriptTagEnd,isVoid,styleContentEnd,isQuote,nameEnd,endsUnquotedValue}from"./shared-5tpb3h6x.js";import{closingBracket}from"./shared-y3nf00py.js";var BLOCK="{",LT=60,GT=62,SLASH=47,EQUALS=61,BRACE=123,REGEX_CLOSING_STYLE_TAG_END=/\s*>/y,REGEX_CLOSING_TEXTAREA=/<\/textarea(\s[^>]*)?>/iy,SECTION_TAG_NAMES=["cript","tyle","velte:options"],CLOSING_OPTIONS_TAG="</svelte:options";function lexComponent2(input){let source=withoutByteOrderMark(input).trimEnd();return lex(source,isTypeScript(source),null)}function topLevelTags(source){let found={tags:[],comments:[]};return lex(source,!1,found),found}function lex(source,typescript,found){let component={typescript,instance:null,module:null,css:null,options:null},last=lastSectionTag(source),stack=[],i=0;while(i<=last){let code=source.charCodeAt(i);if(code===LT)i=readTag(source,i,stack,component,found);else if(code===BRACE)i=readMustache(source,i,stack);else i++}return component}function lastSectionTag(source){let last=-1,i=source.indexOf("<s");while(i!==-1){let end=sectionTagNameEnd(source,i+2);if(end!==-1){let code=source.charCodeAt(end);if(end===source.length||isWhitespace(code)||code===SLASH||code===GT)last=i}i=source.indexOf("<s",i+2)}return last}function sectionTagNameEnd(source,from){for(let name of SECTION_TAG_NAMES)if(source.startsWith(name,from))return from+name.length;return-1}function expressionEnd(source,from){return Math.min(closingBracket(source,from)+1,source.length)}function readMustache(source,start,stack){let i=skipWhitespace(source,start+1),code=source.charCodeAt(i),next=source.charCodeAt(i+1);if(code===35||code===58||code===64||code===SLASH&&next!==SLASH&&next!==42){i++;while(i<source.length){let letter=source.charCodeAt(i);if(letter<97||letter>122)break;i++}if(code===35)stack.push(BLOCK);else if(code===SLASH){let open=stack.lastIndexOf(BLOCK);if(open!==-1)stack.length=open}}return expressionEnd(source,i)}function readTag(source,start,stack,component,found){if(source.startsWith("!--",start+1)){let close=source.indexOf("-->",start+4),end=close===-1?source.length:close+3;if(found&&stack.length===0)found.comments.push(start,end);return end}if(source.charCodeAt(start+1)===SLASH){let nameStart=start+2,name=source.slice(nameStart,nameEnd(source,nameStart,!1)),open=stack.lastIndexOf(name);if(open!==-1)stack.length=open;return eatGreaterThan(source,skipWhitespace(source,nameStart+name.length))}let name=source.slice(start+1,nameEnd(source,start+1,!1)),i=skipWhitespace(source,start+1+name.length),parent=stack[stack.length-1];if(parent!==void 0&&closingTagOmitted(parent,name))stack.pop();let topLevel=stack.length===0;if(found&&topLevel&&(name==="script"||name==="style"||name==="svelte:options"))found.tags.push(start);if(topLevel&&(name==="script"||name==="style")){let attributes=[];if(i=eatGreaterThan(source,readStaticAttributes(source,i,attributes)),name==="script"){let script=readScript(source,start,i,attributes);if(script.context==="module")component.module??=script;else component.instance??=script;return script.end}let css=readStyle(source,start,i,attributes);return component.css??=css,css.end}let attributes=topLevel&&name==="svelte:options"?[]:null;if(i=readAttributes(source,i,attributes),source.charCodeAt(i)===SLASH||isVoid(name)){if(source.charCodeAt(i)===SLASH)i++;i=eatGreaterThan(source,i)}else{if(i=eatGreaterThan(source,i),name==="textarea")return textareaEnd(source,i);if(name==="script"||name==="style"){let closer=`</${name}>`,close=source.indexOf(closer,i);return close===-1?source.length:close+closer.length}if(attributes&&source.startsWith(CLOSING_OPTIONS_TAG,i))i=eatGreaterThan(source,skipWhitespace(source,i+CLOSING_OPTIONS_TAG.length));else return stack.push(name),i}if(attributes)component.options??={start,end:i,attributes};return i}function eatGreaterThan(source,i){return source.charCodeAt(i)===GT?i+1:i}function readScript(source,start,contentStart,attributes){let close=closingScriptTag(source,contentStart),contentEnd=close===-1?source.length:close,module=attributes.some((attribute)=>attribute.name==="module"||attribute.name==="context");return{start,end:close===-1?source.length:closingScriptTagEnd(source,close),context:module?"module":"default",attributes,content:{start:contentStart,end:contentEnd}}}function readStyle(source,start,contentStart,attributes){let contentEnd=styleContentEnd(source,contentStart),end=contentEnd;if(source.startsWith("</style",end)){end+=7,REGEX_CLOSING_STYLE_TAG_END.lastIndex=end;let close=REGEX_CLOSING_STYLE_TAG_END.exec(source);if(close)end+=close[0].length}return{start,end,attributes,content:{start:contentStart,end:contentEnd}}}function readStaticAttributes(source,from,into){let i=from;for(;;){let start=i,end=nameEnd(source,i,!0);if(end===start)return i;i=end;let value=!0;if(source.charCodeAt(i)===EQUALS){let at=skipWhitespace(source,i+1),quote=source.charCodeAt(at),valueEnd=-1;if(isQuote(quote)){let close=source.indexOf(source[at],at+1);if(close!==-1)valueEnd=close+1}if(valueEnd===-1){valueEnd=at;while(valueEnd<source.length&&source.charCodeAt(valueEnd)!==GT&&!isWhitespace(source.charCodeAt(valueEnd)))valueEnd++}let quotes=isQuote(quote)?1:0;value=source.slice(at+quotes,valueEnd-quotes),i=valueEnd}into.push({name:source.slice(start,end),value,start,end:i}),i=skipWhitespace(source,i)}}function readAttributes(source,from,into){let i=from;for(;;){for(;;){if(source.startsWith("/*",i)){let end=source.indexOf("*/",i+2);i=end===-1?source.length:end+2}else if(source.startsWith("//",i)){let end=source.indexOf(`
|
|
2
|
+
`,i+2);i=end===-1?source.length:end}else break;i=skipWhitespace(source,i)}let start=i;if(source.charCodeAt(i)===BRACE){i=skipWhitespace(source,expressionEnd(source,i+1));continue}let nameEndAt=nameEnd(source,i,!0);if(nameEndAt===start)return i;let end=nameEndAt,value=!0;if(i=skipWhitespace(source,nameEndAt),source.charCodeAt(i)===EQUALS){let at=skipWhitespace(source,i+1);end=source.startsWith("/>",at)?at+1:attributeValueEnd(source,at),value=isQuote(source.charCodeAt(at))?source.slice(at+1,Math.max(at+1,end-1)):source.slice(at,end),i=skipWhitespace(source,end)}into?.push({name:source.slice(start,nameEndAt),value,start,end})}}function attributeValueEnd(source,from){let quote=source.charCodeAt(from);if(isQuote(quote)){let i=from+1;while(i<source.length){let code=source.charCodeAt(i);if(code===quote)return i+1;i=code===BRACE?expressionEnd(source,i+1):i+1}return source.length}let i=from;while(i<source.length&&!endsUnquotedValue(source,i))i=source.charCodeAt(i)===BRACE?expressionEnd(source,i+1):i+1;return i}function textareaEnd(source,from){let i=from;while(i<source.length){let code=source.charCodeAt(i);if(code===LT){if(REGEX_CLOSING_TEXTAREA.lastIndex=i,REGEX_CLOSING_TEXTAREA.test(source))return REGEX_CLOSING_TEXTAREA.lastIndex}i=code===BRACE?expressionEnd(source,i+1):i+1}return source.length}
|
|
3
|
+
export{lexComponent2,topLevelTags};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{setSource}from"./shared-m0dcdh24.js";import{parseStatementsAt}from"./shared-nan648gn.js";import{scan}from"./shared-y3nf00py.js";function parseImportsExportsWith(source,options,typescript){setSource(source);let context={isTypeScript:options.typescript??!1,typescript,loc:!1,comments:!1,root:{comments:[]}};return parseStatementsAt(context,source,(parseAt)=>scan(source,options.localExports??!0,parseAt))}
|
|
2
|
+
export{parseImportsExportsWith};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{closingTagOmitted}from"./shared-dgdrqgdn.js";import{setSource,locate3,position,mapChildren,assertType}from"./shared-m0dcdh24.js";import{isIdentifierStart,isIdentifierChar}from"./shared-2pngd0mg.js";import{ParseError2,attribute_duplicate,attribute_empty_shorthand,block_duplicate_clause,block_invalid_continuation_placement,block_invalid_elseif,block_invalid_placement,block_unclosed,block_unexpected_close,const_tag_invalid_expression,css_empty_declaration,css_expected_identifier,css_selector_invalid,debug_tag_invalid_arguments,declaration_tag_invalid_type,directive_invalid_value,directive_missing_name,element_invalid_closing_tag,element_invalid_closing_tag_autoclosed,element_unclosed,expected_attribute_value,expected_block_type,expected_identifier,expected_pattern,expected_tag,expected_token,expected_whitespace,render_tag_invalid_expression,script_duplicate,script_invalid_attribute_value,script_invalid_context,script_reserved_attribute,style_duplicate,svelte_component_invalid_this,svelte_component_missing_this,svelte_element_missing_this,svelte_meta_duplicate,svelte_meta_invalid_content,svelte_meta_invalid_placement,svelte_meta_invalid_tag,svelte_options_deprecated_tag,svelte_options_invalid_attribute,svelte_options_invalid_attribute_value,svelte_options_invalid_customelement,svelte_options_invalid_customelement_props,svelte_options_invalid_customelement_shadow,svelte_options_invalid_tagname,svelte_options_reserved_tagname,svelte_options_unknown_attribute,tag_invalid_name,tag_invalid_placement,unexpected_eof,unexpected_reserved_word,unterminated_string_constant,void_element_invalid_content,RESERVED_WORDS,parseProgram,parseExpressionAt,parsePatternAt,parseStatementAt}from"./shared-nan648gn.js";import{withoutByteOrderMark,isDigit,isWhitespace,skipWhitespace,isTypeScript,closingScriptTag,closingScriptTagEnd,isVoid,styleContentEnd,isQuote,nameEnd,endsUnquotedValue}from"./shared-5tpb3h6x.js";import{decodeCharacterReferences}from"./shared-bzqbnvee.js";import{missingTypeScript}from"./shared-h6z1kjbb.js";var REGEX_NON_LF_LINE_BREAK=/\r(?!\n)|[\u2028\u2029]/,REGEX_WHITESPACE_THEN_CLOSING_BRACE=/\s*}/y;function scanIdentifier(source,from){let code=source.codePointAt(from);if(code===void 0||!isIdentifierStart(code,!0))return from;let end=from+(code<=65535?1:2),next=source.codePointAt(end);while(next!==void 0&&isIdentifierChar(next,!0))end+=next<=65535?1:2,next=source.codePointAt(end);return end}class TemplateParserState{source;index=0;loc;lfOnly;isTypeScript;typescript;entityNames;css;script;comments;root;stack;fragments;metaTags=new Set;lastAutoClosedTag;nextAngle=-1;nextBrace=-1;constructor(source,originalLength,support,options={}){if(this.source=source,this.loc=options.loc??!1,this.lfOnly=this.loc&&!REGEX_NON_LF_LINE_BREAK.test(source),this.isTypeScript=isTypeScript(source),this.typescript=support.typescript,this.isTypeScript&&!this.typescript)missingTypeScript();this.entityNames=support.entityNames,this.css=options.css??!0,this.script=options.script??!0,this.comments=options.comments??!0,this.root={type:"Root",start:0,end:originalLength,css:null,js:[],options:null,fragment:{type:"Fragment",nodes:[]},comments:[]},this.stack=[this.root],this.fragments=[this.root.fragment]}match(str){if(str.length===1)return this.source.charCodeAt(this.index)===str.charCodeAt(0);return this.source.startsWith(str,this.index)}matchRegex(pattern){return pattern.lastIndex=this.index,pattern.exec(this.source)?.[0]??null}eat(str,required=!1){if(this.match(str))return this.index+=str.length,!0;if(required)expected_token(this.index,str);return!1}read(pattern){let result=this.matchRegex(pattern);if(result)this.index+=result.length;return result}readUntil(needle){if(this.index>=this.source.length)unexpected_eof(this.source.length);let found=this.source.indexOf(needle,this.index),end=found===-1?this.source.length:found,result=this.source.slice(this.index,end);return this.index=end,result}allowWhitespace(){this.index=skipWhitespace(this.source,this.index)}requireWhitespace(){if(!isWhitespace(this.source.charCodeAt(this.index)))expected_whitespace(this.index);this.allowWhitespace()}eatClosingBrace(){this.allowWhitespace(),this.eat("}",!0)}sourceLocation(start,end){return this.loc?{start:locate3(start),end:locate3(end)}:void 0}readIdentifierName(){let start=this.index,end=scanIdentifier(this.source,start),name=this.source.slice(start,end);if(this.index=end,RESERVED_WORDS.has(name))unexpected_reserved_word(start,name);let identifier={type:"Identifier",name,start,end};if(this.loc)identifier.loc=this.sourceLocation(start,end);return identifier}current(){return this.stack[this.stack.length-1]}append(node){this.fragments[this.fragments.length-1].nodes.push(node)}open(node,fragment){this.append(node),this.stack.push(node),this.fragments.push(fragment)}setFragment(fragment){this.fragments[this.fragments.length-1]=fragment}close(){this.stack.pop(),this.fragments.pop()}}var PRECEDENCE={"||":1,"??":1,"&&":2,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"+":9,"-":9,"*":10,"/":10,"%":10};function literal(source,start,end,value){return{type:"Literal",start,end,value,raw:source.slice(start,end)}}function scanLiteral(source,from){let first=source.charCodeAt(from);if(first===34||first===39){for(let end=from+1;end<source.length;end++){let code=source.charCodeAt(end);if(code===first)return literal(source,from,end+1,source.slice(from+1,end));if(code===92||code===10||code===13)return null}return null}let end=from;for(;end<source.length;end++){let code=source.charCodeAt(end);if(code<48||code>57)break}if(end===from||first===48&&end-from>1)return null;return literal(source,from,end,Number(source.slice(from,end)))}function scanAtom(source,from,typescript){let identifierEnd=scanIdentifier(source,from);if(identifierEnd===from)return scanLiteral(source,from);let name=source.slice(from,identifierEnd);if(name==="true"||name==="false"||name==="null")return literal(source,from,identifierEnd,name==="null"?null:name==="true");if(RESERVED_WORDS.has(name))return null;let node={type:"Identifier",start:from,end:identifierEnd,name};for(let index=identifierEnd;;){let next=source.charCodeAt(index);if(next===40){let call=scanArguments(source,index+1,typescript);if(!call)return null;node={type:"CallExpression",start:from,end:call.end,callee:node,arguments:call.arguments,optional:!1},index=call.end;continue}let property,end;if(next===46){if(end=scanIdentifier(source,index+1),end===index+1)return null;property={type:"Identifier",start:index+1,end,name:source.slice(index+1,end)}}else if(next===91){if(property=scanLiteral(source,index+1),!property||source.charCodeAt(property.end)!==93)return null;end=property.end+1}else return node;node={type:"MemberExpression",start:from,end,object:node,property,computed:next===91,optional:!1},index=end}}function scanArguments(source,from,typescript){let args=[],index=skipWhitespace(source,from);if(source.charCodeAt(index)===41)return{arguments:args,end:index+1};for(;;){let argument=scanConditional(source,index,typescript);if(!argument)return null;args.push(argument),index=skipWhitespace(source,argument.end);let code=source.charCodeAt(index);if(code===41)return{arguments:args,end:index+1};if(code!==44)return null;if(index=skipWhitespace(source,index+1),source.charCodeAt(index)===41)return null}}function scanUnary(source,from,typescript){let code=source.charCodeAt(from),next=source.charCodeAt(from+1);if(!(code===33&&next!==61)&&!(code===45&&next!==45&&next!==61))return scanAtom(source,from,typescript);let argument=scanUnary(source,skipWhitespace(source,from+1),typescript);if(!argument)return null;return{type:"UnaryExpression",start:from,end:argument.end,operator:code===33?"!":"-",prefix:!0,argument}}function operatorAt(source,index,typescript){let code=source.charCodeAt(index),next=source.charCodeAt(index+1);switch(code){case 124:return next===124&&source.charCodeAt(index+2)!==61?"||":null;case 38:return next===38&&source.charCodeAt(index+2)!==61?"&&":null;case 63:return next===63&&source.charCodeAt(index+2)!==61?"??":null;case 61:if(next!==61)return null;return source.charCodeAt(index+2)===61?"===":"==";case 33:if(next!==61)return null;return source.charCodeAt(index+2)===61?"!==":"!=";case 60:case 62:if(typescript||next===code)return null;if(next===61)return code===60?"<=":">=";return code===60?"<":">";case 43:return next===43||next===61?null:"+";case 45:return next===45||next===61?null:"-";case 42:return next===42||next===61?null:"*";case 47:return next===47||next===42||next===61?null:"/";case 37:return next===61?null:"%";default:return null}}function scanBinary(source,left,minPrecedence,typescript){if(isClosing(source.charCodeAt(left.end)))return left;let index=skipWhitespace(source,left.end),operator=operatorAt(source,index,typescript);if(operator===null)return left;let precedence=PRECEDENCE[operator];if(precedence<=minPrecedence)return left;let operand=scanUnary(source,skipWhitespace(source,index+operator.length),typescript);if(!operand)return null;let right=scanBinary(source,operand,operator==="??"?2:precedence,typescript);if(!right)return null;let node;if(operator==="||"||operator==="&&"||operator==="??"){let after=operatorAt(source,skipWhitespace(source,right.end),typescript);if(operator==="??"?after==="||"||after==="&&":after==="??")return null;node={type:"LogicalExpression",start:left.start,end:right.end,left,operator,right}}else node={type:"BinaryExpression",start:left.start,end:right.end,left,operator,right};return scanBinary(source,node,minPrecedence,typescript)}function scanConditional(source,from,typescript){let operand=scanUnary(source,from,typescript);if(!operand)return null;let test=scanBinary(source,operand,-1,typescript);if(!test||isClosing(source.charCodeAt(test.end)))return test;let question=skipWhitespace(source,test.end);if(source.charCodeAt(question)!==63)return test;let next=source.charCodeAt(question+1);if(next===46||next===63)return null;let consequent=scanConditional(source,skipWhitespace(source,question+1),typescript);if(!consequent)return null;let colon=skipWhitespace(source,consequent.end);if(source.charCodeAt(colon)!==58)return null;let alternate=scanConditional(source,skipWhitespace(source,colon+1),typescript);if(!alternate)return null;return{type:"ConditionalExpression",start:test.start,end:alternate.end,test,consequent,alternate}}function isClosing(code){return code===125||code===41||code===44||code===58}function atTerminator(source,from){let code=source.charCodeAt(skipWhitespace(source,from));return code===125||code===41}function scanTrivialExpression(source,from,typescript){let node=scanConditional(source,from,typescript);return node&&atTerminator(source,node.end)?node:null}function addLocations(node){switch(node.loc={start:position(node.start),end:position(node.end)},node.type){case"MemberExpression":addLocations(node.object),addLocations(node.property);break;case"CallExpression":addLocations(node.callee);for(let argument of node.arguments)addLocations(argument);break;case"UnaryExpression":addLocations(node.argument);break;case"BinaryExpression":case"LogicalExpression":addLocations(node.left),addLocations(node.right);break;case"ConditionalExpression":addLocations(node.test),addLocations(node.consequent),addLocations(node.alternate);break}}function readExpression(state){let trivial=!state.loc||state.lfOnly?scanTrivialExpression(state.source,state.index,state.isTypeScript):null;if(trivial){if(state.index=trivial.end,state.loc)addLocations(trivial);return trivial}let{node,end}=parseExpressionAt(state,state.source,state.index);return state.index=end,node}var RESERVED_ATTRIBUTES=new Set(["server","client","worker","test","default"]);function readScript(state,start,attributes){let{source,index:scriptStart}=state;if(scriptStart>=source.length)unexpected_eof(source.length);let close=closingScriptTag(source,scriptStart);if(close===-1)element_unclosed(source.length,"script");state.index=closingScriptTagEnd(source,close);let program=state.script?parseProgram(state,source.slice(0,close),scriptStart):{type:"Program",start:scriptStart,end:close,body:[],sourceType:"module"};if(program.start=scriptStart,program.loc)Object.assign(program.loc.start,position(start)),Object.assign(program.loc.end,position(state.index));else if(state.loc)program.loc={start:position(start),end:position(state.index)};let context="default";for(let attribute of attributes){if(RESERVED_ATTRIBUTES.has(attribute.name))script_reserved_attribute(attribute,attribute.name);if(attribute.name==="module"){if(attribute.value!==!0)script_invalid_attribute_value(attribute,attribute.name);context="module"}if(attribute.name==="context"){let value=attribute.value;if(!Array.isArray(value)||value.length!==1||value[0].type!=="Text"||value[0].data!=="module")script_invalid_context(attribute);context="module"}}return{type:"Script",start,end:state.index,context,content:program,attributes}}var REGEX_NTH_OF=/(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of(\s+|(?=[.#[*:&])))/y,REGEX_PERCENTAGE=/\d+(\.\d+)?%/y,REGEX_UNICODE_SEQUENCE=/\\[0-9a-fA-F]{1,6}(\r\n|\s)?/y,REGEX_CLOSING_STYLE_TAG_END=/\s*>/y,NONE=-1,DOUBLE_QUOTE=34,HASH=35,DOLLAR=36,AMPERSAND=38,SINGLE_QUOTE=39,OPEN_PAREN=40,CLOSE_PAREN=41,ASTERISK=42,PLUS=43,HYPHEN=45,DOT=46,SLASH=47,COLON=58,SEMICOLON=59,LESS_THAN=60,EQUALS=61,GREATER_THAN=62,OPEN_BRACKET=91,BACKSLASH=92,CLOSE_BRACKET=93,CARET=94,OPEN_BRACE=123,PIPE=124,CLOSE_BRACE=125,TILDE=126,comments=[];function readStyle(state,start,attributes){let contentStart=state.index;comments=[];let children=state.css?readBody(state):skipBody(state),contentEnd=state.index;return state.eat("</style",!0),state.read(REGEX_CLOSING_STYLE_TAG_END),{type:"StyleSheet",start,end:state.index,attributes,children,comments,content:{start:contentStart,end:contentEnd,styles:state.source.slice(contentStart,contentEnd),comment:null}}}function skipBody(state){return state.index=styleContentEnd(state.source,state.index),[]}function readBody(state){let children=[];for(;;){if(allowCommentOrWhitespace(state,!0),state.match("</style")||state.index>=state.source.length)break;children.push(state.match("@")?readAtRule(state):readRule(state))}return children}function readAtRule(state){let start=state.index;state.eat("@",!0);let name=readIdentifier(state),prelude=readValue(state,!0),block=null;if(state.match("{"))block=readBlock(state);else state.eat(";",!0);return{type:"Atrule",start,end:state.index,name,prelude,block}}function readRule(state){let start=state.index;return{type:"Rule",prelude:readSelectorList(state,!1),block:readBlock(state),start,end:state.index}}function readSelectorList(state,insidePseudoClass){let children=[];allowCommentOrWhitespace(state,!0);let start=state.index;while(state.index<state.source.length){children.push(readSelector(state,insidePseudoClass));let end=state.index;if(allowCommentOrWhitespace(state,!0),state.match(insidePseudoClass?")":"{"))return{type:"SelectorList",start,end,children};state.eat(",",!0),allowCommentOrWhitespace(state,!0)}return unexpected_eof(state.source.length)}function createRelativeSelector(combinator,start){return{type:"RelativeSelector",combinator,selectors:[],start,end:-1}}function readSelector(state,insidePseudoClass){let{source,index:listStart}=state,children=[],relativeSelector=createRelativeSelector(null,state.index);while(state.index<source.length){let start=state.index,code=source.charCodeAt(start),selectors=relativeSelector.selectors;if(code===AMPERSAND)state.index++,selectors.push({type:"NestingSelector",name:"&",start,end:state.index});else if(code===ASTERISK)state.index++,selectors.push(readTypeSelectorRest(state,start,"*"));else if(code===HASH)state.index++,selectors.push({type:"IdSelector",name:readIdentifier(state),start,end:state.index});else if(code===DOT)state.index++,selectors.push({type:"ClassSelector",name:readIdentifier(state),start,end:state.index});else if(code===COLON){let isElement=source.charCodeAt(start+1)===COLON;state.index+=isElement?2:1;let name=readIdentifier(state),args=null;if(state.eat("("))args=readSelectorList(state,!0),state.eat(")",!0);if(isElement)selectors.push({type:"PseudoElementSelector",name,start,end:state.index,...args&&{args}});else selectors.push({type:"PseudoClassSelector",name,args,start,end:state.index})}else if(code===OPEN_BRACKET)state.index++,selectors.push(readAttributeSelector(state,start));else{let nth=insidePseudoClass?state.read(REGEX_NTH_OF):null,percentage=!nth&&isDigit(code)?state.read(REGEX_PERCENTAGE):null;if(nth)selectors.push({type:"Nth",value:nth,start,end:state.index});else if(percentage)selectors.push({type:"Percentage",value:percentage,start,end:state.index});else if(combinatorLength(source,start)===0){let name=readIdentifier(state);selectors.push(readTypeSelectorRest(state,start,name))}}let index=state.index;allowCommentOrWhitespace(state,!1);let end=state.match(",")||state.match(insidePseudoClass?")":"{");if(state.index=index,end)return relativeSelector.end=index,children.push(relativeSelector),{type:"ComplexSelector",start:listStart,end:index,children};let combinator=readCombinator(state);if(combinator){if(relativeSelector.selectors.length>0)relativeSelector.end=index,children.push(relativeSelector);if(relativeSelector=createRelativeSelector(combinator,combinator.start),state.allowWhitespace(),state.match(",")||state.match(insidePseudoClass?")":"{"))css_selector_invalid(state.index)}}return unexpected_eof(source.length)}function readTypeSelectorRest(state,start,first){let name=first,namespace;if(state.eat("|"))namespace=name,name=state.eat("*")?"*":readIdentifier(state);return{type:"TypeSelector",name,...namespace!==void 0&&{namespace},start,end:state.index}}function readAttributeSelector(state,start){let source=state.source;state.allowWhitespace();let name=readIdentifier(state);state.allowWhitespace();let value=null,matcher=null,code=source.charCodeAt(state.index);if(code===EQUALS)matcher="=";else if((code===TILDE||code===CARET||code===DOLLAR||code===ASTERISK||code===PIPE)&&source.charCodeAt(state.index+1)===EQUALS)matcher=source.slice(state.index,state.index+2);if(matcher)state.index+=matcher.length,state.allowWhitespace(),value=readAttributeValue(state);state.allowWhitespace();let flagsStart=state.index;while(isAsciiLetter(source.charCodeAt(state.index)))state.index++;let flags=state.index>flagsStart?source.slice(flagsStart,state.index):null;return state.allowWhitespace(),state.eat("]",!0),{type:"AttributeSelector",start,end:state.index,name,matcher,value,flags}}function combinatorLength(source,index){let code=source.charCodeAt(index);if(code===PLUS||code===TILDE||code===GREATER_THAN)return 1;if(code===PIPE&&source.charCodeAt(index+1)===PIPE)return 2;return 0}function readCombinator(state){let start=state.index;state.allowWhitespace();let index=state.index,length=combinatorLength(state.source,index);if(length>0){state.index+=length;let end=state.index;return state.allowWhitespace(),{type:"Combinator",name:state.source.slice(index,end),start:index,end}}if(state.index!==start)return{type:"Combinator",name:" ",start,end:state.index};return null}function readBlock(state){let start=state.index;state.eat("{",!0);let children=[];while(state.index<state.source.length){if(allowCommentOrWhitespace(state,!0),state.match("}"))break;children.push(readBlockItem(state))}return state.eat("}",!0),{type:"Block",start,end:state.index,children}}function readBlockItem(state){if(state.match("@"))return readAtRule(state);let start=state.index;readValue(state,!1);let code=state.source.charCodeAt(state.index);return state.index=start,code===OPEN_BRACE?readRule(state):readDeclaration(state)}function readDeclaration(state){let{source,index:start}=state;if(start>=source.length)unexpected_eof(source.length);let propertyEnd=start;while(propertyEnd<source.length){let code=source.charCodeAt(propertyEnd);if(code===COLON||isWhitespace(code))break;propertyEnd++}let property=source.slice(start,propertyEnd);state.index=propertyEnd,state.allowWhitespace(),state.eat(":");let index=state.index;state.allowWhitespace();let value=readValue(state,!0);if(!value&&!property.startsWith("--"))css_empty_declaration({start,end:index});let end=state.index;if(!state.match("}"))state.eat(";",!0);return{type:"Declaration",start,end,property,value}}function readValue(state,capture){let source=state.source,length=source.length,value="",segmentStart=state.index,valueComments=null,escaped=!1,inUrl=!1,quoteMark=NONE,i=state.index;while(i<length){let code=source.charCodeAt(i);if(escaped){escaped=!1,i++;continue}if(code===BACKSLASH){escaped=!0,i++;continue}if(code===quoteMark)quoteMark=NONE;else if(code===CLOSE_PAREN)inUrl=!1;else if(quoteMark===NONE&&(code===DOUBLE_QUOTE||code===SINGLE_QUOTE))quoteMark=code;else if(code===OPEN_PAREN){if(endsWithUrl(source,value,segmentStart,i))inUrl=!0}else if((code===SEMICOLON||code===OPEN_BRACE||code===CLOSE_BRACE)&&!inUrl&"eMark===NONE){if(state.index=i,!capture)return"";if(value+=source.slice(segmentStart,i),valueComments){let leadingWhitespace=value.length-value.trimStart().length;for(let comment of valueComments)comment.position=Math.max(0,(comment.position??0)-leadingWhitespace)}return value.trim()}else if(code===SLASH&&!inUrl&"eMark===NONE&&source.charCodeAt(i+1)===ASTERISK){value+=source.slice(segmentStart,i),state.index=i;let comment=readComment(state);if(capture)comment.position=value.length,comments.push(comment),valueComments??=[],valueComments.push(comment);i=state.index,segmentStart=i;continue}i++}return state.index=length,unexpected_eof(length)}function endsWithUrl(source,value,segmentStart,end){if(end-segmentStart>=3)return source.charCodeAt(end-3)===117&&source.charCodeAt(end-2)===114&&source.charCodeAt(end-1)===108;return(value+source.slice(segmentStart,end)).endsWith("url")}function readAttributeValue(state){let source=state.source,quoteMark=NONE;if(state.eat('"'))quoteMark=DOUBLE_QUOTE;else if(state.eat("'"))quoteMark=SINGLE_QUOTE;let start=state.index,escaped=!1,i=start;while(i<source.length){let code=source.charCodeAt(i);if(escaped)escaped=!1;else if(code===BACKSLASH)escaped=!0;else if(quoteMark===NONE?code===CLOSE_BRACKET||isWhitespace(code):code===quoteMark)return state.index=quoteMark===NONE?i:i+1,source.slice(start,i).trim();i++}return state.index=i,unexpected_eof(source.length)}function readIdentifier(state){let{source,index:start}=state,first=source.charCodeAt(start);if(isDigit(first)||first===HYPHEN&&isDigit(source.charCodeAt(start+1)))css_expected_identifier(start);let identifier="",runStart=start,i=start;while(i<source.length){let code=source.charCodeAt(i);if(code===BACKSLASH){identifier+=source.slice(runStart,i),state.index=i;let sequence=state.matchRegex(REGEX_UNICODE_SEQUENCE);if(sequence){let character=String.fromCodePoint(Number.parseInt(sequence.slice(1),16));identifier+=character==="\\"?"\\\\":character,i+=sequence.length}else identifier+=`\\${source[i+1]}`,i+=2;runStart=i}else if(code>=160||isIdentifierChar2(code))i++;else break}if(identifier+=source.slice(runStart,i),state.index=i,identifier==="")css_expected_identifier(start);return identifier}function allowCommentOrWhitespace(state,capture){let source=state.source;state.allowWhitespace();for(;;){let code=source.charCodeAt(state.index);if(code===SLASH&&source.charCodeAt(state.index+1)===ASTERISK){let comment=readComment(state);if(capture)comments.push(comment)}else if(code===LESS_THAN&&state.eat("<!--"))state.readUntil("-->"),state.eat("-->",!0);else break;state.allowWhitespace()}}function readComment(state){let start=state.index;state.eat("/*",!0);let value=state.readUntil("*/");return state.eat("*/",!0),{type:"CSSComment",value,start,end:state.index}}function isAsciiLetter(code){return code>=65&&code<=90||code>=97&&code<=122}function isIdentifierChar2(code){return isAsciiLetter(code)||isDigit(code)||code===95||code===45}var REGEX_CLOSING_TEXTAREA=/<\/textarea(\s[^>]*)?>/iy,REGEX_DOCTYPE_NAME=/^![a-zA-Z]+$/,REGEX_NAMESPACED_NAME=/^[a-zA-Z][a-zA-Z0-9]*:[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]$/,REGEX_CUSTOM_ELEMENT_NAME=/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u,ID_JOINERS="\\u200C\\u200D",REGEX_COMPONENT_NAME=new RegExp(`^(?:\\p{Lu}[$${ID_JOINERS}\\p{ID_Continue}.]*|\\p{ID_Start}[$${ID_JOINERS}\\p{ID_Continue}]*(?:\\.[$${ID_JOINERS}\\p{ID_Continue}]+)+)$`,"u"),DIRECTIVES=new Map([["use","UseDirective"],["animate","AnimateDirective"],["bind","BindDirective"],["class","ClassDirective"],["style","StyleDirective"],["on","OnDirective"],["let","LetDirective"],["in","TransitionDirective"],["out","TransitionDirective"],["transition","TransitionDirective"]]),META_TAGS=new Map([["svelte:head",["SvelteHead",!0]],["svelte:options",["SvelteOptions",!0]],["svelte:window",["SvelteWindow",!0]],["svelte:document",["SvelteDocument",!0]],["svelte:body",["SvelteBody",!0]],["svelte:element",["SvelteElement",!1]],["svelte:component",["SvelteComponent",!1]],["svelte:self",["SvelteSelf",!1]],["svelte:fragment",["SvelteFragment",!1]],["svelte:boundary",["SvelteBoundary",!1]]]),META_TAG_NAMES=[...META_TAGS.keys()],META_TAG_LIST=`${META_TAG_NAMES.slice(0,-1).join(", ")} or ${META_TAG_NAMES.at(-1)}`,GT=62,BRACE=123;function readName(state,isAttribute){let start=state.index;if(start>=state.source.length)unexpected_eof(state.source.length);let end=nameEnd(state.source,start,isAttribute);return state.index=end,{name:state.source.slice(start,end),start,end,loc:state.sourceLocation(start,end)}}var text=(start,end,raw,data=raw)=>({start,end,type:"Text",raw,data});function isComponentName(name){let first=name.charCodeAt(0);if(first>=97&&first<=122&&!name.includes("."))return!1;return REGEX_COMPONENT_NAME.test(name)}function isElementName(name){let simple=!0;for(let i=0;i<name.length&&simple;i++){let code=name.charCodeAt(i);simple=code>=97&&code<=122||i>0&&code>=48&&code<=57}return simple&&name.length>0||REGEX_DOCTYPE_NAME.test(name)||REGEX_NAMESPACED_NAME.test(name)||REGEX_CUSTOM_ELEMENT_NAME.test(name)}function hasAncestor(stack,matches){for(let i=stack.length-1;i>=0;i--){let found=matches(stack[i]);if(found!==void 0)return found}return!1}function elementType(state,name,isComponent){let meta=META_TAGS.get(name);if(meta)return meta[0];if(isComponent)return"Component";if(name==="title"){if(hasAncestor(state.stack,({type})=>{if(type==="SvelteHead")return!0;return type==="RegularElement"||type==="Component"?!1:void 0}))return"TitleElement"}if(name==="slot"){if(!hasAncestor(state.stack,(node)=>node.type==="RegularElement"&&node.attributes.some((a)=>a.type==="Attribute"&&a.name==="shadowrootmode")?!0:void 0))return"SlotElement"}return"RegularElement"}function readElement(state){let start=state.index++;if(state.eat("!--")){let data=state.readUntil("-->");state.eat("-->",!0),state.append({type:"Comment",start,end:state.index,data})}else if(state.eat("/"))closeElement(state,start);else openElement(state,start)}function closeElement(state,start){let{name}=readName(state,!1);if(state.allowWhitespace(),state.eat(">",!0),isVoid(name))void_element_invalid_content(start);let open=state.current();while(!("name"in open)||open.name!==name){if(open.type!=="RegularElement"){let autoClosed=state.lastAutoClosedTag;if(autoClosed?.tag===name)element_invalid_closing_tag_autoclosed(start,name,autoClosed.reason);element_invalid_closing_tag(start,name)}open.end=start,state.close(),open=state.current()}if(open.end=state.index,state.close(),state.stack.length<(state.lastAutoClosedTag?.depth??0))state.lastAutoClosedTag=void 0}function createElement(type,start,name){return{type,start,end:-1,name}}function openElement(state,start){let tag=readName(state,!1),{name}=tag,meta=META_TAGS.get(name);if(!meta&&name.startsWith("svelte:"))svelte_meta_invalid_tag(tag,META_TAG_LIST);let isComponent=isComponentName(name);if(!isComponent&&!isElementName(name))tag_invalid_name(tag);if(meta?.[1]){if(state.metaTags.has(name))svelte_meta_duplicate(start,name);if(state.current().type!=="Root")svelte_meta_invalid_placement(start,name);state.metaTags.add(name)}let element=createElement(elementType(state,name,isComponent),start,name);if(state.loc)element.name_loc=tag.loc;element.attributes=[],element.fragment={type:"Fragment",nodes:[]},state.allowWhitespace();let parent=state.current();if(parent.type==="RegularElement"&&closingTagOmitted(parent.name,name))parent.end=start,state.close(),state.lastAutoClosedTag={tag:parent.name,reason:name,depth:state.stack.length};if((name==="script"||name==="style")&&state.current().type==="Root"){let attributes=[];element.attributes=attributes,readAttributes(state,attributes,readStaticAttribute),readTopLevelBlock(state,element,start,attributes);return}if(readAttributes(state,element.attributes,readAttribute),element.type==="SvelteComponent"){let definition=takeThis(element);if(!definition)svelte_component_missing_this(start);if(!isExpressionValue(definition.value))svelte_component_invalid_this(definition.start);element.expression=expressionOf(definition.value)}else if(element.type==="SvelteElement"){let definition=takeThis(element);if(!definition)svelte_element_missing_this(start);if(definition.value===!0)svelte_element_missing_this(definition);element.tag=isExpressionValue(definition.value)?expressionOf(definition.value):literalTag(definition.value[0])}if(!state.eat("/")&&!isVoid(name))if(state.eat(">",!0),name==="textarea")element.fragment.nodes=readSequence(state,(source,i)=>(REGEX_CLOSING_TEXTAREA.lastIndex=i,REGEX_CLOSING_TEXTAREA.test(source)),"inside <textarea>"),state.read(REGEX_CLOSING_TEXTAREA);else if(name==="script"||name==="style")element.fragment.nodes.push(readRawText(state,`</${name}>`));else{state.open(element,element.fragment);return}else state.eat(">",!0);element.end=state.index,state.append(element)}function readRawText(state,closer){let start=state.index,found=state.source.indexOf(closer,start);state.index=found===-1?state.source.length:found;let node=text(start,state.index,state.source.slice(start,state.index));return state.eat(closer,!0),node}function readTopLevelBlock(state,element,start,attributes){state.eat(">",!0);let comment=commentBefore(state.root.fragment.nodes,start);if(element.name==="style"){let css=readStyle(state,start,attributes);if(css.content.comment=comment,state.root.css)style_duplicate(start);state.root.css=css;return}let script=readScript(state,start,attributes);if(comment&&state.comments)script.content.leadingComments=[{type:"Line",value:comment.data}];let slot=script.context==="module"?"module":"instance";if(state.root[slot])script_duplicate(start);state.root[slot]=script}function commentBefore(nodes,start){let last=nodes.length-1;if(last<0||nodes[last].end!==start)return null;for(let i=last;i>=0;i--){let node=nodes[i];if(node.type==="Comment")return node;if(node.type!=="Text"||node.data.trim())return null}return null}var isThisAttribute=(node)=>node.type==="Attribute"&&node.name==="this";function takeThis(element){let found=element.attributes.find(isThisAttribute);if(found)element.attributes.splice(element.attributes.indexOf(found),1);return found}function isExpressionValue(value){if(value===!0)return!1;if(!Array.isArray(value))return!0;return value.length===1&&value[0].type==="ExpressionTag"}function expressionOf(value){return(Array.isArray(value)?value[0]:value).expression}function literalTag(chunk){if(chunk.type!=="Text")return chunk.expression;return{type:"Literal",value:chunk.data,raw:`'${chunk.raw}'`,start:chunk.start,end:chunk.end}}function readAttributes(state,into,read){let seen=new Set;for(;;){let parsed=read(state);if(!parsed)return;let{type}=parsed;if(type==="Attribute"||type==="BindDirective"||type==="StyleDirective"||type==="ClassDirective"){let key=`${type==="BindDirective"?"Attribute":type}${parsed.name}`;if(seen.has(key))attribute_duplicate(parsed);if(parsed.name!=="this")seen.add(key)}into.push(parsed),state.allowWhitespace()}}function createAttribute(state,name,start,end,value){return state.loc?{type:"Attribute",start,end,name:name.name,name_loc:name.loc,value}:{type:"Attribute",start,end,name:name.name,value}}function rejectQuote(state){if(isQuote(state.source.charCodeAt(state.index)))expected_token(state.index,"=")}function readStaticAttribute(state){let start=state.index,name=readName(state,!0);if(!name.name)return null;let value=!0;if(state.eat("=")){state.allowWhitespace();let{source}=state,at=state.index,quoted=isQuote(source.charCodeAt(at)),end=-1;if(quoted){let close=source.indexOf(source[at],at+1);if(close!==-1)end=close+1}if(end===-1){end=at;while(end<source.length&&source.charCodeAt(end)!==GT&&!isWhitespace(source.charCodeAt(end)))end++;if(end===at)expected_attribute_value(at)}state.index=end;let quotes=quoted?1:0,raw=source.slice(at+quotes,end-quotes);value=[text(end-raw.length-quotes,end-quotes,raw,decodeCharacterReferences(raw,!0,state.entityNames))]}return rejectQuote(state),createAttribute(state,name,start,state.index,value)}function readJsComment(state){let start=state.index,block=state.match("/*");if(!block&&!state.match("//"))return!1;state.index+=2;let value=state.readUntil(block?"*/":`
|
|
2
|
+
`);if(block)state.eat("*/");let comment={type:block?"Block":"Line",start,end:state.index,value},loc=state.sourceLocation(start,state.index);if(loc)comment.loc=loc;if(state.comments)state.root.comments.push(comment);return!0}function readAttribute(state){while(readJsComment(state))state.allowWhitespace();let start=state.index;if(state.eat("{"))return readBraceAttribute(state,start);let name=readName(state,!0);if(!name.name)return null;let end=state.index;state.allowWhitespace();let value=!0;if(state.eat("=")){if(state.allowWhitespace(),state.match("/>"))value=[text(state.index,state.index+1,"/")],state.index++;else value=readAttributeValue2(state);end=state.index}else rejectQuote(state);let colon=name.name.indexOf(":"),type=colon>0?DIRECTIVES.get(name.name.slice(0,colon)):void 0;return type?directive(state,type,name,colon,start,end,value):createAttribute(state,name,start,end,value)}function readBraceAttribute(state,start){if(state.allowWhitespace(),state.eat("@attach")){state.requireWhitespace();let expression=readExpression(state);return state.eatClosingBrace(),{type:"AttachTag",start,end:state.index,expression}}if(state.eat("...")){let expression=readExpression(state);return state.eatClosingBrace(),{type:"SpreadAttribute",start,end:state.index,expression}}let id=state.readIdentifierName();if(id.name==="")attribute_empty_shorthand(start);state.eatClosingBrace();let value={type:"ExpressionTag",start:id.start,end:id.end,expression:id};return createAttribute(state,id,start,state.index,value)}function firstChunk(value){if(value===!0)return;return Array.isArray(value)?value[0]:value}function directive(state,type,tag,colon,start,end,value){let[name,...modifiers]=tag.name.slice(colon+1).split("|");if(name==="")directive_missing_name({start,end:start+colon+1},tag.name);let node={start,end,type,name};if(state.loc)node.name_loc=tag.loc;if(type==="StyleDirective")return node.modifiers=modifiers,node.value=value,node;let first=firstChunk(value);if(first&&(Array.isArray(value)&&value.length>1||first.type==="Text"))directive_invalid_value(first.start);if(node.expression=first?.expression??null,node.modifiers=modifiers,type==="TransitionDirective"){let direction=tag.name.slice(0,colon);node.intro=direction!=="out",node.outro=direction!=="in"}if((type==="BindDirective"||type==="ClassDirective")&&!node.expression)node.expression={start:start+colon+1,end,type:"Identifier",name};return node}function readAttributeValue2(state){let quote=state.source.charCodeAt(state.index),quoted=isQuote(quote);if(quoted){if(state.index++,state.source.charCodeAt(state.index)===quote)return state.index++,[text(state.index-1,state.index-1,"")]}let value;try{value=readSequence(state,quoted?(source,i)=>source.charCodeAt(i)===quote:endsUnquotedValue,"in attribute value",quoted?quote:void 0)}catch(error){let jsErrorAt=error instanceof ParseError2&&error.code==="js_parse_error"?error.position?.[0]:void 0;if(jsErrorAt!==void 0&&state.source.startsWith("/>",jsErrorAt-1))state.index=jsErrorAt,expected_token(jsErrorAt,quoted?String.fromCharCode(quote):"}");throw error}if(quoted)state.index++;else if(value.length===0)expected_attribute_value(state.index);return quoted||value.length>1||value[0].type==="Text"?value:value[0]}function readSequence(state,ends,location,quote){let{source}=state,chunks=[],textStart=state.index,flushText=(end)=>{if(end<=textStart)return;let raw=source.slice(textStart,end);chunks.push(text(textStart,end,raw,decodeCharacterReferences(raw,!0,state.entityNames)))};while(state.index<source.length){let at=state.index;if(ends(source,at))return flushText(at),chunks;if(source.charCodeAt(at)!==BRACE){if(state.index++,quote!==void 0)while(state.index<source.length&&source.charCodeAt(state.index)!==BRACE&&source.charCodeAt(state.index)!==quote)state.index++;continue}state.index++;let marker=source.charCodeAt(state.index);if(marker===35||marker===64){state.index++;let nameStart=state.index;while(state.index<source.length&&source.charCodeAt(state.index)>=97&&source.charCodeAt(state.index)<=122)state.index++;let name=source.slice(nameStart,state.index);(marker===35?block_invalid_placement:tag_invalid_placement)(at,name,location)}flushText(at),state.allowWhitespace();let expression=readExpression(state);state.eatClosingBrace(),chunks.push({type:"ExpressionTag",start:at,end:state.index,expression}),textStart=state.index}unexpected_eof(source.length)}var NAMESPACES=new Map([["html","html"],["svg","svg"],["mathml","mathml"],["http://www.w3.org/2000/svg","svg"],["http://www.w3.org/1998/Math/MathML","mathml"]]),PROP_READERS=new Map([["type",(prop,value)=>{if(value!=="String"&&value!=="Number"&&value!=="Boolean"&&value!=="Array"&&value!=="Object")return!1;return prop.type=value,!0}],["reflect",(prop,value)=>{if(typeof value!=="boolean")return!1;return prop.reflect=value,!0}],["attribute",(prop,value)=>{if(typeof value!=="string")return!1;return prop.attribute=value,!0}]]),NAME_CHAR="[a-z0-9_.\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}-]",REGEX_CUSTOM_ELEMENT_NAME2=new RegExp(`^[a-z]${NAME_CHAR}*-${NAME_CHAR}*$`,"u"),RESERVED_NAMES=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ")),flag=(key)=>(options,attribute)=>{let value=staticValue(attribute);if(typeof value!=="boolean")svelte_options_invalid_attribute_value(attribute,"true or false");options[key]=value},READERS=new Map([["runes",flag("runes")],["immutable",flag("immutable")],["preserveWhitespace",flag("preserveWhitespace")],["accessors",flag("accessors")],["namespace",(options,attribute)=>{let namespace=NAMESPACES.get(staticValue(attribute));if(!namespace)svelte_options_invalid_attribute_value(attribute,'"html", "mathml" or "svg"');options.namespace=namespace}],["css",(options,attribute)=>{if(staticValue(attribute)!=="injected")svelte_options_invalid_attribute_value(attribute,'"injected"');options.css="injected"}],["tag",(_,attribute)=>svelte_options_deprecated_tag(attribute)],["customElement",(options,attribute)=>{let customElement=readCustomElement(attribute);if(customElement)options.customElement=customElement}]]);function readOptions(node){let attributes=[],options={start:node.start,end:node.end,attributes};for(let attribute of node.attributes){if(attribute.type!=="Attribute")svelte_options_invalid_attribute(attribute);attributes.push(attribute);let read=READERS.get(attribute.name);if(!read)svelte_options_unknown_attribute(attribute,attribute.name);read(options,attribute)}return options}function staticValue({value}){if(value===!0)return!0;let chunks=Array.isArray(value)?value:[value];if(chunks.length===0)return!0;if(chunks.length>1)return null;let[chunk]=chunks;if(chunk.type==="Text")return chunk.data;return chunk.expression.type==="Literal"?chunk.expression.value:null}function checkName(node,name){if(typeof name!=="string")svelte_options_invalid_tagname(node);if(!name)return;if(!REGEX_CUSTOM_ELEMENT_NAME2.test(name))svelte_options_invalid_tagname(node);if(RESERVED_NAMES.has(name))svelte_options_reserved_tagname(node)}function isNamedProperty(property){return property.type==="Property"&&!property.computed&&property.key.type==="Identifier"}function propertiesOf(object,fail){let properties=new Map;for(let property of object.properties){if(!isNamedProperty(property))fail();if(!properties.has(property.key.name))properties.set(property.key.name,property.value)}return properties}function readCustomElement(attribute){let fail=()=>svelte_options_invalid_customelement(attribute);if(attribute.value===!0)fail();let chunk=Array.isArray(attribute.value)?attribute.value[0]:attribute.value;if(chunk.type==="Text"){let tag=staticValue(attribute);return checkName(attribute,tag),{tag}}let{expression}=chunk;if(expression.type!=="ObjectExpression"){if(expression.type==="Literal"&&expression.value===null)return;fail()}let properties=propertiesOf(expression,fail),customElement={},tagValue=properties.get("tag");if(tagValue){let tag=tagValue.type==="Literal"?tagValue.value:void 0;checkName(null,tag),customElement.tag=tag}let props=properties.get("props");if(props){let failProps=()=>svelte_options_invalid_customelement_props(attribute);if(props.type!=="ObjectExpression")failProps();customElement.props={};for(let property of props.properties){if(!isNamedProperty(property)||property.value.type!=="ObjectExpression")failProps();let prop={};customElement.props[property.key.name]=prop;for(let field of property.value.properties){if(!isNamedProperty(field)||field.value.type!=="Literal")failProps();if(!PROP_READERS.get(field.key.name)?.(prop,field.value.value))failProps()}}}let shadow=properties.get("shadow");if(shadow)if(shadow.type==="ObjectExpression")customElement.shadow=shadow;else if(shadow.type==="Literal"&&(shadow.value==="open"||shadow.value==="none"))customElement.shadow=shadow.value;else svelte_options_invalid_customelement_shadow(attribute);let extend=properties.get("extend");if(extend)customElement.extend=extend;return customElement}var DEFAULT_BRACKETS={"{":"}","(":")","[":"]"};function matchBracket(source,start,brackets=DEFAULT_BRACKETS){let close=Object.values(brackets),stack=[],i=start;while(i<source.length){let char=source[i++];if(char==="'"||char==='"'||char==="`")i=matchQuote(source,i,char);else if(Object.hasOwn(brackets,char))stack.push(char);else if(close.includes(char)){let expected=brackets[stack.pop()??""];if(char!==expected)expected_token(i-1,expected);if(stack.length===0)return i}}unexpected_eof(source.length)}function matchQuote(source,start,quote){let i=start;while(i<source.length){let char=source[i++];if(char===quote)return i;if(char==="\\")i++;else if(quote==="`"&&char==="$"&&source[i]==="{")i=matchBracket(source,i)}unterminated_string_constant(start)}var REGEX_OPTIONAL_PARAM_COLON=/\?\s*:/g;function readPattern(state){let start=state.index,id=state.readIdentifierName();if(id.name!=="")return{...id,typeAnnotation:readTypeAnnotation(state)};let char=state.source[state.index];if(char!=="{"&&char!=="[")expected_pattern(state.index);state.index=matchBracket(state.source,start);let pattern=parsePatternAt(state,state.source.slice(0,state.index),start)??assignedPattern(state,start);assertType(pattern,"ObjectPattern","ArrayPattern");let typeAnnotation=readTypeAnnotation(state);if(pattern.typeAnnotation=typeAnnotation,typeAnnotation)pattern.end=typeAnnotation.end;return pattern}function assignedPattern(state,start){let{node}=parseExpressionAt(state,`${state.source.slice(0,state.index)} = 1`,start);return assertType(node,"AssignmentExpression"),node.left}function readTypeAnnotation(state){let start=state.index;if(state.allowWhitespace(),!state.eat(":")){state.index=start;return}let insert="_ as ",a=state.index-insert.length,synthetic=state.source.slice(0,a)+insert+state.source.slice(state.index).replace(REGEX_OPTIONAL_PARAM_COLON,":"),expression=parseExpressionAt(state,synthetic,a).node;if(expression.type==="AssignmentExpression"){let b=expression.right.start;while(synthetic[b]!=="=")b-=1;expression=parseExpressionAt(state,synthetic.slice(0,b),a).node}if(expression.type==="SequenceExpression")expression=expression.expressions[0];return assertType(expression,"TSAsExpression"),state.index=expression.end,{type:"TSTypeAnnotation",start,end:state.index,typeAnnotation:expression.typeAnnotation}}var CLOSING_WORDS={IfBlock:"if",EachBlock:"each",KeyBlock:"key",AwaitBlock:"await",SnippetBlock:"snippet"},fragment=()=>({type:"Fragment",nodes:[]});function openBlock(state,start){if(state.eat("if")){state.requireWhitespace();let test=readExpression(state);state.eatClosingBrace();let consequent=fragment();state.open({type:"IfBlock",elseif:!1,start,end:-1,test,consequent,alternate:null},consequent)}else if(state.eat("each"))openEach(state,start);else if(state.eat("await")){state.requireWhitespace();let expression=readExpression(state);state.allowWhitespace();let block={type:"AwaitBlock",start,end:-1,expression,value:null,error:null,pending:null,then:null,catch:null},body=fragment();if(state.eat("then"))block.value=readAwaitBinding(state),block.then=body;else if(state.eat("catch"))block.error=readAwaitBinding(state),block.catch=body;else block.pending=body;state.eat("}",!0),state.open(block,body)}else if(state.eat("key")){state.requireWhitespace();let expression=readExpression(state);state.eatClosingBrace();let body=fragment();state.open({type:"KeyBlock",start,end:-1,expression,fragment:body},body)}else if(state.eat("snippet"))openSnippet(state,start);else expected_block_type(state.index)}function readAwaitBinding(state){if(state.matchRegex(REGEX_WHITESPACE_THEN_CLOSING_BRACE))return state.allowWhitespace(),null;state.requireWhitespace();let pattern=readPattern(state);return state.allowWhitespace(),pattern}function stripTrailingAssertion(root){let found={assertion:null},end=root.end,unwrap=(node)=>{if(node.type==="TSAsExpression"&&node.end===root.end)return found.assertion=node,end=node.expression.end,node.expression;return mapChildren(node,unwrap),node},expression=root;if(root.type==="TSAsExpression")found.assertion=root,expression=root.expression,end=expression.end;else mapChildren(root,unwrap);return expression.end=end,{expression,assertion:found.assertion}}function openEach(state,start){state.requireWhitespace();let source=state.source,expression;while(!expression)try{expression=readExpression(state)}catch(error){let end=((error instanceof ParseError2?error.position:void 0)?.[0]??start)-2;while(end>start&&state.source.slice(end,end+2)!=="as")end-=1;if(end<=start)throw state.source=source,error;state.source=source.slice(0,end)}if(state.source=source,state.allowWhitespace(),!state.match("as")){if(expression.type==="SequenceExpression")expression=expression.expressions[0];let stripped=stripTrailingAssertion(expression);if(expression=stripped.expression,stripped.assertion){let rewind=stripped.assertion.typeAnnotation.start-2;while(state.source.slice(rewind,rewind+2)!=="as")rewind-=1;state.index=rewind}}let context=null,index,key;if(state.eat("as"))state.requireWhitespace(),context=readPattern(state);else state.index=expression.end;if(state.allowWhitespace(),state.eat(",")){if(state.allowWhitespace(),index=state.readIdentifierName().name,!index)expected_identifier(state.index);state.allowWhitespace()}if(state.eat("("))state.allowWhitespace(),key=readExpression(state),state.allowWhitespace(),state.eat(")",!0),state.allowWhitespace();state.eat("}",!0);let body=fragment();state.open({type:"EachBlock",start,end:-1,expression,body,context,index,key},body)}function openSnippet(state,start){state.requireWhitespace();let id=state.readIdentifierName();if(id.name==="")expected_identifier(state.index);state.allowWhitespace();let paramsStart=state.index,typeParams;if(state.isTypeScript&&state.match("<")){let end=matchBracket(state.source,paramsStart,{"<":">"});typeParams=state.source.slice(paramsStart+1,end-1),state.index=end}state.allowWhitespace(),state.eat("(",!0);let parentheses=1;while(state.index<state.source.length&&(!state.match(")")||parentheses!==1)){if(state.match("("))parentheses++;if(state.match(")"))parentheses--;state.index+=1}state.eat(")",!0);let{node}=parseExpressionAt(state,`${state.source.slice(0,state.index)} => {}`,paramsStart,!0);state.eatClosingBrace();let body=fragment();state.open({type:"SnippetBlock",start,end:-1,expression:id,typeParams,parameters:node.type==="ArrowFunctionExpression"?node.params:void 0,body},body)}function nextBlockClause(state,tagStart){let start=state.index-1,block=state.current();if(block.type==="IfBlock"){if(!state.eat("else"))expected_token(start,"{:else} or {:else if}");if(state.eat("if"))block_invalid_elseif(start);if(state.allowWhitespace(),block.alternate=fragment(),state.setFragment(block.alternate),state.eat("if")){state.requireWhitespace();let test=readExpression(state);state.eatClosingBrace();let consequent=fragment();state.open({start:tagStart,end:-1,type:"IfBlock",elseif:!0,test,consequent,alternate:null},consequent)}else state.eatClosingBrace()}else if(block.type==="EachBlock"){if(!state.eat("else"))expected_token(start,"{:else}");state.eatClosingBrace(),block.fallback=fragment(),state.setFragment(block.fallback)}else if(block.type==="AwaitBlock"){let clause;if(state.eat("then"))clause="then";else if(state.eat("catch"))clause="catch";else expected_token(start,"{:then ...} or {:catch ...}");if(block[clause])block_duplicate_clause(start,`{:${clause}}`);if(!state.eat("}")){state.requireWhitespace();let pattern=readPattern(state);if(clause==="then")block.value=pattern;else block.error=pattern;state.eatClosingBrace()}let body=fragment();block[clause]=body,state.setFragment(body)}else block_invalid_continuation_placement(start)}function closeBlock(state){let block=state.current(),word=CLOSING_WORDS[block.type];if(!word)block_unexpected_close(state.index-1);state.eat(word,!0),state.eatClosingBrace();while(block.type==="IfBlock"&&block.elseif)block.end=state.index,state.close(),block=state.current();block.end=state.index,state.close()}function isCall(expression){return expression.type==="CallExpression"||expression.type==="ChainExpression"&&expression.expression.type==="CallExpression"}function readSpecialTag(state,start){if(state.eat("html")){state.requireWhitespace();let expression=readExpression(state);state.eatClosingBrace(),state.append({type:"HtmlTag",start,end:state.index,expression})}else if(state.eat("debug")){let identifiers=[];if(!state.read(REGEX_WHITESPACE_THEN_CLOSING_BRACE)){let expression=readExpression(state),nodes=expression.type==="SequenceExpression"?expression.expressions:[expression];for(let node of nodes){if(node.type!=="Identifier")debug_tag_invalid_arguments(node.start);identifiers.push(node)}state.eatClosingBrace()}state.append({type:"DebugTag",start,end:state.index,identifiers})}else if(state.eat("const")){state.requireWhitespace();let id=readPattern(state);state.allowWhitespace(),state.eat("=",!0),state.allowWhitespace();let expressionStart=state.index,init=readExpression(state),declaratorEnd=state.index;if(init.type==="SequenceExpression"&&!state.source.slice(expressionStart,init.start).includes("("))const_tag_invalid_expression(init);state.eatClosingBrace();let declarator={type:"VariableDeclarator",id,init,start:id.start,end:declaratorEnd};state.append({type:"ConstTag",start,end:state.index,declaration:{type:"VariableDeclaration",kind:"const",declarations:[declarator],start:start+2,end:state.index-1}})}else if(state.eat("render")){state.requireWhitespace();let expression=readExpression(state);if(!isCall(expression))render_tag_invalid_expression(expression);state.eatClosingBrace(),state.append({type:"RenderTag",start,end:state.index,expression})}else expected_tag(state.index)}var REGEX_UNSUPPORTED_DECLARATION=/(?:var|interface|enum)\b/y,REGEX_MAYBE_DECLARATION=/(?:let|const|type)\b/y;function readTag(state){let start=state.index;if(state.index+=1,state.allowWhitespace(),state.eat("#"))openBlock(state,start);else if(state.eat(":"))nextBlockClause(state,start);else if(state.eat("@"))readSpecialTag(state,start);else if(state.match("/")&&!state.match("/*")&&!state.match("//"))state.index+=1,closeBlock(state);else if(!readDeclarationTag(state,start)){let expression=readExpression(state);state.eatClosingBrace(),state.append({type:"ExpressionTag",start,end:state.index,expression})}}function readDeclarationTag(state,tagStart){let start=state.index,unsupported=state.matchRegex(REGEX_UNSUPPORTED_DECLARATION);if(unsupported)declaration_tag_invalid_type({start,end:start+unsupported.length});if(!state.matchRegex(REGEX_MAYBE_DECLARATION))return!1;let commentsBefore=state.root.comments.length,statement=parseStatementAt(state,state.source,start);if(statement.type==="ExpressionStatement")return state.root.comments.length=commentsBefore,!1;if(statement.type!=="VariableDeclaration"||statement.kind!=="let"&&statement.kind!=="const")declaration_tag_invalid_type(statement);return state.index=statement.end,state.eatClosingBrace(),state.append({type:"DeclarationTag",start:tagStart,end:state.index,declaration:statement}),!0}function readText(state){let{source,index:start}=state;if(state.nextAngle<start)state.nextAngle=find(source,"<",start);if(state.nextBrace<start)state.nextBrace=find(source,"{",start);let end=Math.min(state.nextAngle,state.nextBrace);state.index=end;let raw=source.slice(start,end);state.append({type:"Text",start,end,raw,data:decodeCharacterReferences(raw,!1,state.entityNames)})}function find(source,char,from){let index=source.indexOf(char,from);return index===-1?source.length:index}function parseComponent(source,options,support){let state=componentState(source,options,support);while(state.index<state.source.length)readNode(state);return finishComponent(state)}function componentState(source,options,support){let template=withoutByteOrderMark(source);return setSource(template),new TemplateParserState(template.trimEnd(),template.length,support,options)}function finishComponent(state){if(state.stack.length>1){let current=state.current();if(current.end=current.start+1,current.type==="RegularElement")element_unclosed(current,current.name);block_unclosed(current)}let{nodes:rootNodes}=state.root.fragment,optionsIndex=rootNodes.findIndex((node)=>node.type==="SvelteOptions"),raw=rootNodes[optionsIndex];if(raw?.type==="SvelteOptions"){rootNodes.splice(optionsIndex,1),state.root.options=readOptions(raw);let{nodes}=raw.fragment;if(nodes.length>0)svelte_meta_invalid_content({start:nodes[0].start,end:nodes[nodes.length-1].end},raw.name)}return state.root}function readNode(state){if(state.match("<"))readElement(state);else if(state.match("{"))readTag(state);else readText(state)}
|
|
3
|
+
export{readElement,parseComponent,componentState,finishComponent,readNode};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{isDigit,isWhitespace}from"./shared-5tpb3h6x.js";var STATEMENT_START=0,OPERATOR=1,BLOCK_OPENER=2,VALUE=3,PAREN=0,HEAD_PAREN=1,BLOCK=2,OBJECT=3,TEMPLATE=4,HEAD=4,IMPORT=5,EXPORT=6,KEYWORDS={await:OPERATOR,case:OPERATOR,default:OPERATOR,delete:OPERATOR,extends:OPERATOR,in:OPERATOR,instanceof:OPERATOR,new:OPERATOR,of:OPERATOR,return:OPERATOR,throw:OPERATOR,typeof:OPERATOR,void:OPERATOR,yield:OPERATOR,do:BLOCK_OPENER,else:BLOCK_OPENER,finally:BLOCK_OPENER,try:BLOCK_OPENER,for:HEAD,if:HEAD,while:HEAD,with:HEAD,import:IMPORT,export:EXPORT},LONGEST_KEYWORD=10,KEYWORDS_BY_KEY=Array(keywordKey(128,0)).fill(null);for(let entry of Object.entries(KEYWORDS)){let key=keywordKey(entry[0].charCodeAt(0),entry[0].length),entries=KEYWORDS_BY_KEY[key]??[];entries.push(entry),KEYWORDS_BY_KEY[key]=entries}function keywordKey(first,length){return first*(LONGEST_KEYWORD+1)+length}function wordKind(source,start,end){let first=source.charCodeAt(start);if(first>=128||end-start>LONGEST_KEYWORD)return VALUE;let key=keywordKey(first,end-start),entries=KEYWORDS_BY_KEY[key];if(entries===null)return VALUE;for(let i=0;i<entries.length;i++)if(source.startsWith(entries[i][0],start))return entries[i][1];return VALUE}var ASCII_WORD=new Uint8Array(128);for(let range of["az","AZ","09","__","$$","\\\\"])for(let code=range.charCodeAt(0);code<=range.charCodeAt(1);code++)ASCII_WORD[code]=1;function isWordCode(code){return code>=128?!isWhitespace(code):ASCII_WORD[code]===1}function scan(source,localExports,parseAt){tokenize(source,lastStatementKeyword(source,localExports),localExports,parseAt,void 0)}function scanLiterals(source,literal){tokenize(source,source.length-1,!1,void 0,literal)}function tokenize(source,last,localExports,parseAt,literal){let stack=[],pos=source.startsWith("#!")?lineEnd(source,2):0,prev=STATEMENT_START,afterDot=!1,head=!1,decorators=-1,statementEnd=()=>{if(prev=STATEMENT_START,stack.length===0)decorators=-1};while(pos<=last){let code=source.charCodeAt(pos);if(code===32||code===10||isWhitespace(code)){pos++;continue}if(code===47){let end=commentEnd(source,pos);if(end!==-1){pos=end;continue}}let wasAfterDot=afterDot,wasHead=head;if(afterDot=!1,head=!1,isWordCode(code)||code===35){let start=pos;pos=wordEnd(source,pos+1);let kind=wasAfterDot?VALUE:wordKind(source,start,pos);if(parseAt!==void 0&&stack.length===0&&(kind===EXPORT?localExports||isReexport(source,pos):kind===IMPORT&&isImportDeclaration(source,pos)))pos=Math.max(pos,parseAt(decorators!==-1&&kind===EXPORT?decorators:start,start)),statementEnd();else if(kind===EXPORT)prev=BLOCK_OPENER;else if(kind===HEAD)head=!0,prev=VALUE;else prev=kind===OPERATOR||kind===BLOCK_OPENER?kind:VALUE;continue}switch(pos++,code){case 34:case 39:{let start=pos-1;pos=stringEnd(source,pos,code),literal?.(start,pos,!1),prev=VALUE;break}case 96:{let start=pos;pos=templateEnd(source,pos,stack),literal?.(start,quasiEnd(source,pos),!0),prev=source.charCodeAt(pos-1)===123?OPERATOR:VALUE;break}case 47:{let end=prev===VALUE?-1:regexEnd(source,pos);if(end===-1)prev=OPERATOR;else pos=wordCodesEnd(source,end),prev=VALUE;break}case 40:stack.push(wasHead?HEAD_PAREN:PAREN),prev=OPERATOR;break;case 41:prev=stack.pop()===HEAD_PAREN?BLOCK_OPENER:VALUE;break;case 123:stack.push(prev===OPERATOR?OBJECT:BLOCK),prev=STATEMENT_START;break;case 125:{let open=stack.pop();if(open===TEMPLATE){let start=pos;pos=templateEnd(source,pos,stack),literal?.(start,quasiEnd(source,pos),!0),prev=source.charCodeAt(pos-1)===123?OPERATOR:VALUE}else if(open===OBJECT)prev=VALUE;else statementEnd();break}case 59:statementEnd();break;case 93:prev=VALUE;break;case 46:if(isDigit(source.charCodeAt(pos)))pos=wordCodesEnd(source,pos),prev=VALUE;else if(source.startsWith("..",pos))pos+=2,prev=OPERATOR;else afterDot=!0,prev=OPERATOR;break;case 63:if(source.charCodeAt(pos)===46&&!isDigit(source.charCodeAt(pos+1)))pos++,afterDot=!0;prev=OPERATOR;break;case 33:prev=prev===VALUE&&!isWhitespace(source.charCodeAt(pos-2))?VALUE:OPERATOR;break;case 43:case 45:if(source.charCodeAt(pos)===code&&prev===VALUE)pos++;else prev=OPERATOR;break;case 61:if(prev=source.charCodeAt(pos)===62?BLOCK_OPENER:OPERATOR,prev===BLOCK_OPENER)pos++;break;case 64:if(stack.length===0&&decorators===-1)decorators=pos-1;prev=OPERATOR;break;default:prev=OPERATOR}}}function closingBracket(source,from,word){let length=source.length,stack=[],pos=from,prev=OPERATOR,afterDot=!1;while(pos<length){let code=source.charCodeAt(pos);if(code===32||code===10||isWhitespace(code)){pos++;continue}if(code===47){let end=commentEnd(source,pos);if(end!==-1){pos=end;continue}}let wasAfterDot=afterDot;if(afterDot=!1,isWordCode(code)||code===35){let start=pos;if(pos=wordEnd(source,pos+1),!wasAfterDot&&word?.(start,pos))return-1;let kind=wasAfterDot?VALUE:wordKind(source,start,pos);prev=kind===OPERATOR||kind===BLOCK_OPENER||kind===HEAD?OPERATOR:VALUE;continue}switch(pos++,code){case 34:case 39:pos=stringEnd(source,pos,code),prev=VALUE;break;case 96:pos=templateEnd(source,pos,stack),prev=source.charCodeAt(pos-1)===123?OPERATOR:VALUE;break;case 47:{let end=prev===VALUE?-1:regexEnd(source,pos);if(end===-1)prev=OPERATOR;else pos=wordCodesEnd(source,end),prev=VALUE;break}case 40:stack.push(PAREN),prev=OPERATOR;break;case 41:if(stack.length===0)return pos-1;stack.pop(),prev=VALUE;break;case 123:stack.push(prev===OPERATOR?OBJECT:BLOCK),prev=STATEMENT_START;break;case 125:{if(stack.length===0)return pos-1;let open=stack.pop();if(open===TEMPLATE)pos=templateEnd(source,pos,stack),prev=source.charCodeAt(pos-1)===123?OPERATOR:VALUE;else prev=open===OBJECT?VALUE:STATEMENT_START;break}case 93:prev=VALUE;break;case 46:if(isDigit(source.charCodeAt(pos)))pos=wordCodesEnd(source,pos),prev=VALUE;else if(source.startsWith("..",pos))pos+=2,prev=OPERATOR;else afterDot=!0,prev=OPERATOR;break;case 63:if(source.charCodeAt(pos)===46&&!isDigit(source.charCodeAt(pos+1)))pos++,afterDot=!0;prev=OPERATOR;break;case 33:prev=prev===VALUE&&!isWhitespace(source.charCodeAt(pos-2))?VALUE:OPERATOR;break;case 43:case 45:if(source.charCodeAt(pos)===code&&prev===VALUE)pos++;else prev=OPERATOR;break;case 61:if(source.charCodeAt(pos)===62)pos++;prev=OPERATOR;break;default:prev=OPERATOR}}return length}function isLineBreak(code){return code===10||code===13||code===8232||code===8233}function lineEnd(source,pos){for(let i=pos;i<source.length;i++)if(isLineBreak(source.charCodeAt(i)))return i;return source.length}function commentEnd(source,slash){let next=source.charCodeAt(slash+1);if(next===47)return lineEnd(source,slash+2);if(next!==42)return-1;let end=source.indexOf("*/",slash+2);return end===-1?source.length:end+2}function wordEnd(source,pos){let i=pos;while(i<source.length){let code=source.charCodeAt(i);if(code===92)i+=2;else if(isWordCode(code))i++;else break}return i}function wordCodesEnd(source,pos){let i=pos;while(i<source.length&&isWordCode(source.charCodeAt(i)))i++;return i}function stringEnd(source,pos,quote){for(let i=pos;i<source.length;i++){let code=source.charCodeAt(i);if(code===quote)return i+1;if(code===92)i+=source.startsWith(`\r
|
|
2
|
+
`,i+1)?2:1;else if(code===10||code===13)return i}return source.length}function templateEnd(source,pos,stack){for(let i=pos;i<source.length;i++){let code=source.charCodeAt(i);if(code===96)return i+1;if(code===92)i++;else if(code===36&&source.charCodeAt(i+1)===123)return stack.push(TEMPLATE),i+2}return source.length}function quasiEnd(source,pos){let code=source.charCodeAt(pos-1);if(code===96)return pos-1;if(code===123&&source.charCodeAt(pos-2)===36)return pos-2;return pos}function regexEnd(source,pos){let inClass=!1;for(let i=pos;i<source.length;i++){let code=source.charCodeAt(i);if(isLineBreak(code))return-1;if(code===92)i++;else if(code===91)inClass=!0;else if(code===93)inClass=!1;else if(code===47&&!inClass)return i+1}return-1}function skipTrivia(source,pos){let i=pos;while(i<source.length){let code=source.charCodeAt(i);if(isWhitespace(code)){i++;continue}let end=code===47?commentEnd(source,i):-1;if(end===-1)return i;i=end}return source.length}function isWordAt(source,pos,word){return source.charCodeAt(pos)===word.charCodeAt(0)&&source.startsWith(word,pos)&&!isWordCode(source.charCodeAt(pos+word.length))}function isImportDeclaration(source,pos){let code=source.charCodeAt(skipTrivia(source,pos));return code!==40&&code!==46}function isReexport(source,pos){let i=skipTrivia(source,pos);if(isWordAt(source,i,"import"))return!0;if(isWordAt(source,i,"type"))i=skipTrivia(source,i+4);let code=source.charCodeAt(i);if(code===42)return!0;if(code!==123)return!1;for(i++;i<source.length;i++){let inner=source.charCodeAt(i);if(inner===125)break;if(inner===34||inner===39)i=stringEnd(source,i+1,inner)-1;else if(inner===47)i=Math.max(i,skipTrivia(source,i)-1)}return isWordAt(source,skipTrivia(source,i+1),"from")}var STATEMENT_KEYWORD=/import|export/g;function lastStatementKeyword(source,localExports){let last=-1;STATEMENT_KEYWORD.lastIndex=0;for(let match=STATEMENT_KEYWORD.exec(source);match!==null;match=STATEMENT_KEYWORD.exec(source)){let start=match.index,end=start+6;if(!isWordCode(source.charCodeAt(start-1))&&!isWordCode(source.charCodeAt(end))&&(source.charCodeAt(start)===105?isImportDeclaration(source,end):localExports||isReexport(source,end)))last=start}return last}
|
|
3
|
+
export{isWordCode,scan,scanLiterals,closingBracket,lineEnd,wordCodesEnd,skipTrivia,isWordAt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{decodeCharacterReferences}from"./shared-bzqbnvee.js";import{readElement,componentState,finishComponent,readNode}from"./shared-xwzsb4m8.js";import{topLevelTags}from"./shared-rce4ty8a.js";import{htmlEntityNames}from"./shared-drb44hb9.js";import{TypeScriptParser}from"./shared-ke0fgd3r.js";function parseComponentSections(source,options,support){let state=componentState(source,options,support);return readTopLevelTags(state),finishComponent(state)}function readTopLevelTags(state){let{source}=state,{tags,comments}=topLevelTags(source),nodes=state.root.fragment.nodes,appendText=(start,end)=>{if(end<=start)return;let raw=source.slice(start,end),data=raw.includes("<")||raw.includes("{")?raw:decodeCharacterReferences(raw,!1,state.entityNames);nodes.push({type:"Text",start,end,raw,data})},index=0,comment=0;for(let start of tags){for(;comment<comments.length&&comments[comment]<start;comment+=2){let commentStart=comments[comment];if(commentStart<index)continue;let end=comments[comment+1];appendText(index,commentStart),nodes.push({type:"Comment",start:commentStart,end,data:source.slice(commentStart+4,end-3)}),index=end}if(start<index)continue;appendText(index,start),state.index=start,readElement(state);while(state.stack.length>1&&state.index<source.length)readNode(state);index=state.index}let options=nodes.filter((node)=>node.type==="SvelteOptions");nodes.length=0,nodes.push(...options)}var support={typescript:TypeScriptParser,entityNames:htmlEntityNames};function parseSections2(source,options){return parseComponentSections(source,options,support)}
|
|
2
|
+
export{parseSections2};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{setSource}from"./shared-m0dcdh24.js";import{parseProgram}from"./shared-nan648gn.js";function parseModuleWith(source,options,typescript){return setSource(source),parseProgram({isTypeScript:options.typescript??!1,typescript,loc:options.loc??!1,comments:options.comments??!0,root:{comments:[]}},source)}
|
|
2
|
+
export{parseModuleWith};
|
package/typescript.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-2pngd0mg.js";import"./shared-m0dcdh24.js";import"./shared-nan648gn.js";import"./shared-cs1ezg1f.js";import{TypeScriptParser}from"./shared-ke0fgd3r.js";import{typeScriptSupport}from"./shared-h6z1kjbb.js";var typescript=typeScriptSupport(TypeScriptParser);export{typescript};
|
package/walk.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ export declare const visitorKeys: {
|
|
|
118
118
|
readonly AwaitExpression: readonly ["argument"];
|
|
119
119
|
readonly ImportExpression: readonly ["source", "options", "arguments"];
|
|
120
120
|
readonly ChainExpression: readonly ["expression"];
|
|
121
|
+
readonly ParenthesizedExpression: readonly ["expression"];
|
|
121
122
|
readonly MetaProperty: readonly ["meta", "property"];
|
|
122
123
|
readonly ObjectPattern: readonly ["decorators", "properties", "typeAnnotation"];
|
|
123
124
|
readonly ArrayPattern: readonly ["decorators", "elements", "typeAnnotation"];
|
|
@@ -250,6 +251,220 @@ export declare const markupVisitorKeys: {
|
|
|
250
251
|
readonly SnippetBlock: readonly ["body"];
|
|
251
252
|
};
|
|
252
253
|
|
|
254
|
+
/**
|
|
255
|
+
* {@link visitorKeys} without TypeScript's types: a {@link walk} with it
|
|
256
|
+
* reaches every value and binding but no type annotation, type
|
|
257
|
+
* parameter, type argument, `implements` clause or type in `as` and
|
|
258
|
+
* `satisfies`, so an `Identifier` it reaches in a TypeScript node is
|
|
259
|
+
* never a type's name. It still enters a declaration that holds only
|
|
260
|
+
* types, such as `type T = ...`, `interface I {}` or an index signature,
|
|
261
|
+
* but not its children, and of `declare function f(): void` it visits
|
|
262
|
+
* only the name. The
|
|
263
|
+
* TypeScript nodes it enters children of hold values: `as`,
|
|
264
|
+
* `satisfies`, `<T>a`, `a!` and `a<T>` hold their expression, an enum
|
|
265
|
+
* its members, a namespace its body, `import a = b` and `export =` their
|
|
266
|
+
* value, and a parameter property its parameter.
|
|
267
|
+
*/
|
|
268
|
+
export declare const valueVisitorKeys: {
|
|
269
|
+
readonly FunctionDeclaration: readonly ["id", "params", "body"];
|
|
270
|
+
readonly FunctionExpression: readonly ["id", "params", "body"];
|
|
271
|
+
readonly ArrowFunctionExpression: readonly ["params", "body"];
|
|
272
|
+
readonly ClassDeclaration: readonly ["decorators", "id", "superClass", "body"];
|
|
273
|
+
readonly ClassExpression: readonly ["decorators", "id", "superClass", "body"];
|
|
274
|
+
readonly MethodDefinition: readonly ["decorators", "key", "value"];
|
|
275
|
+
readonly PropertyDefinition: readonly ["decorators", "key", "value"];
|
|
276
|
+
readonly Identifier: readonly ["decorators"];
|
|
277
|
+
readonly CallExpression: readonly ["callee", "arguments"];
|
|
278
|
+
readonly NewExpression: readonly ["callee", "arguments"];
|
|
279
|
+
readonly TaggedTemplateExpression: readonly ["tag", "quasi"];
|
|
280
|
+
readonly RestElement: readonly ["decorators", "argument"];
|
|
281
|
+
readonly ObjectPattern: readonly ["decorators", "properties"];
|
|
282
|
+
readonly ArrayPattern: readonly ["decorators", "elements"];
|
|
283
|
+
readonly TSTypeAnnotation: readonly [];
|
|
284
|
+
readonly TSTypeParameterDeclaration: readonly [];
|
|
285
|
+
readonly TSTypeParameterInstantiation: readonly [];
|
|
286
|
+
readonly TSTypeParameter: readonly [];
|
|
287
|
+
readonly TSArrayType: readonly [];
|
|
288
|
+
readonly TSTupleType: readonly [];
|
|
289
|
+
readonly TSNamedTupleMember: readonly [];
|
|
290
|
+
readonly TSOptionalType: readonly [];
|
|
291
|
+
readonly TSRestType: readonly [];
|
|
292
|
+
readonly TSUnionType: readonly [];
|
|
293
|
+
readonly TSIntersectionType: readonly [];
|
|
294
|
+
readonly TSConditionalType: readonly [];
|
|
295
|
+
readonly TSInferType: readonly [];
|
|
296
|
+
readonly TSParenthesizedType: readonly [];
|
|
297
|
+
readonly TSTypeOperator: readonly [];
|
|
298
|
+
readonly TSIndexedAccessType: readonly [];
|
|
299
|
+
readonly TSMappedType: readonly [];
|
|
300
|
+
readonly TSLiteralType: readonly [];
|
|
301
|
+
readonly TSTypeReference: readonly [];
|
|
302
|
+
readonly TSTypeQuery: readonly [];
|
|
303
|
+
readonly TSImportType: readonly [];
|
|
304
|
+
readonly TSTypeLiteral: readonly [];
|
|
305
|
+
readonly TSPropertySignature: readonly [];
|
|
306
|
+
readonly TSMethodSignature: readonly [];
|
|
307
|
+
readonly TSCallSignatureDeclaration: readonly [];
|
|
308
|
+
readonly TSConstructSignatureDeclaration: readonly [];
|
|
309
|
+
readonly TSFunctionType: readonly [];
|
|
310
|
+
readonly TSConstructorType: readonly [];
|
|
311
|
+
readonly TSIndexSignature: readonly [];
|
|
312
|
+
readonly TSTypePredicate: readonly [];
|
|
313
|
+
readonly TSInterfaceDeclaration: readonly [];
|
|
314
|
+
readonly TSInterfaceBody: readonly [];
|
|
315
|
+
readonly TSExpressionWithTypeArguments: readonly [];
|
|
316
|
+
readonly TSTypeAliasDeclaration: readonly [];
|
|
317
|
+
readonly TSNamespaceExportDeclaration: readonly [];
|
|
318
|
+
readonly TSDeclareFunction: readonly ["id"];
|
|
319
|
+
readonly TSDeclareMethod: readonly [];
|
|
320
|
+
readonly TSAsExpression: readonly ["expression"];
|
|
321
|
+
readonly TSSatisfiesExpression: readonly ["expression"];
|
|
322
|
+
readonly TSTypeAssertion: readonly ["expression"];
|
|
323
|
+
readonly TSInstantiationExpression: readonly ["expression"];
|
|
324
|
+
readonly Root: readonly ["module", "instance", "fragment", "css"];
|
|
325
|
+
readonly Script: readonly ["attributes", "content"];
|
|
326
|
+
readonly Fragment: readonly ["nodes"];
|
|
327
|
+
readonly Text: readonly [];
|
|
328
|
+
readonly Comment: readonly [];
|
|
329
|
+
readonly ExpressionTag: readonly ["expression"];
|
|
330
|
+
readonly HtmlTag: readonly ["expression"];
|
|
331
|
+
readonly ConstTag: readonly ["declaration"];
|
|
332
|
+
readonly DeclarationTag: readonly ["declaration"];
|
|
333
|
+
readonly DebugTag: readonly ["identifiers"];
|
|
334
|
+
readonly RenderTag: readonly ["expression"];
|
|
335
|
+
readonly AttachTag: readonly ["expression"];
|
|
336
|
+
readonly Attribute: readonly ["value"];
|
|
337
|
+
readonly SpreadAttribute: readonly ["expression"];
|
|
338
|
+
readonly AnimateDirective: readonly ["expression"];
|
|
339
|
+
readonly BindDirective: readonly ["expression"];
|
|
340
|
+
readonly ClassDirective: readonly ["expression"];
|
|
341
|
+
readonly LetDirective: readonly ["expression"];
|
|
342
|
+
readonly OnDirective: readonly ["expression"];
|
|
343
|
+
readonly StyleDirective: readonly ["value"];
|
|
344
|
+
readonly TransitionDirective: readonly ["expression"];
|
|
345
|
+
readonly UseDirective: readonly ["expression"];
|
|
346
|
+
readonly Component: readonly ["attributes", "fragment"];
|
|
347
|
+
readonly TitleElement: readonly ["attributes", "fragment"];
|
|
348
|
+
readonly SlotElement: readonly ["attributes", "fragment"];
|
|
349
|
+
readonly RegularElement: readonly ["attributes", "fragment"];
|
|
350
|
+
readonly SvelteBody: readonly ["attributes", "fragment"];
|
|
351
|
+
readonly SvelteBoundary: readonly ["attributes", "fragment"];
|
|
352
|
+
readonly SvelteComponent: readonly ["expression", "attributes", "fragment"];
|
|
353
|
+
readonly SvelteDocument: readonly ["attributes", "fragment"];
|
|
354
|
+
readonly SvelteElement: readonly ["tag", "attributes", "fragment"];
|
|
355
|
+
readonly SvelteFragment: readonly ["attributes", "fragment"];
|
|
356
|
+
readonly SvelteHead: readonly ["attributes", "fragment"];
|
|
357
|
+
readonly SvelteOptions: readonly ["attributes", "fragment"];
|
|
358
|
+
readonly SvelteSelf: readonly ["attributes", "fragment"];
|
|
359
|
+
readonly SvelteWindow: readonly ["attributes", "fragment"];
|
|
360
|
+
readonly IfBlock: readonly ["test", "consequent", "alternate"];
|
|
361
|
+
readonly EachBlock: readonly ["expression", "context", "key", "body", "fallback"];
|
|
362
|
+
readonly AwaitBlock: readonly ["expression", "pending", "value", "then", "error", "catch"];
|
|
363
|
+
readonly KeyBlock: readonly ["expression", "fragment"];
|
|
364
|
+
readonly SnippetBlock: readonly ["expression", "parameters", "body"];
|
|
365
|
+
readonly StyleSheet: readonly ["attributes", "children"];
|
|
366
|
+
readonly Rule: readonly ["prelude", "block"];
|
|
367
|
+
readonly Atrule: readonly ["block"];
|
|
368
|
+
readonly SelectorList: readonly ["children"];
|
|
369
|
+
readonly ComplexSelector: readonly ["children"];
|
|
370
|
+
readonly RelativeSelector: readonly ["combinator", "selectors"];
|
|
371
|
+
readonly Combinator: readonly [];
|
|
372
|
+
readonly TypeSelector: readonly [];
|
|
373
|
+
readonly IdSelector: readonly [];
|
|
374
|
+
readonly ClassSelector: readonly [];
|
|
375
|
+
readonly AttributeSelector: readonly [];
|
|
376
|
+
readonly PseudoElementSelector: readonly ["args"];
|
|
377
|
+
readonly PseudoClassSelector: readonly ["args"];
|
|
378
|
+
readonly Percentage: readonly [];
|
|
379
|
+
readonly Nth: readonly [];
|
|
380
|
+
readonly NestingSelector: readonly [];
|
|
381
|
+
readonly Block: readonly ["children"];
|
|
382
|
+
readonly Declaration: readonly [];
|
|
383
|
+
readonly Program: readonly ["body"];
|
|
384
|
+
readonly ExpressionStatement: readonly ["expression"];
|
|
385
|
+
readonly BlockStatement: readonly ["body"];
|
|
386
|
+
readonly StaticBlock: readonly ["body"];
|
|
387
|
+
readonly EmptyStatement: readonly [];
|
|
388
|
+
readonly DebuggerStatement: readonly [];
|
|
389
|
+
readonly WithStatement: readonly ["object", "body"];
|
|
390
|
+
readonly ReturnStatement: readonly ["argument"];
|
|
391
|
+
readonly LabeledStatement: readonly ["label", "body"];
|
|
392
|
+
readonly BreakStatement: readonly ["label"];
|
|
393
|
+
readonly ContinueStatement: readonly ["label"];
|
|
394
|
+
readonly IfStatement: readonly ["test", "consequent", "alternate"];
|
|
395
|
+
readonly SwitchStatement: readonly ["discriminant", "cases"];
|
|
396
|
+
readonly SwitchCase: readonly ["test", "consequent"];
|
|
397
|
+
readonly ThrowStatement: readonly ["argument"];
|
|
398
|
+
readonly TryStatement: readonly ["block", "handler", "finalizer"];
|
|
399
|
+
readonly CatchClause: readonly ["param", "body"];
|
|
400
|
+
readonly WhileStatement: readonly ["test", "body"];
|
|
401
|
+
readonly DoWhileStatement: readonly ["body", "test"];
|
|
402
|
+
readonly ForStatement: readonly ["init", "test", "update", "body"];
|
|
403
|
+
readonly ForInStatement: readonly ["left", "right", "body"];
|
|
404
|
+
readonly ForOfStatement: readonly ["left", "right", "body"];
|
|
405
|
+
readonly VariableDeclaration: readonly ["declarations"];
|
|
406
|
+
readonly VariableDeclarator: readonly ["id", "init"];
|
|
407
|
+
readonly ClassBody: readonly ["body"];
|
|
408
|
+
readonly Property: readonly ["decorators", "key", "value"];
|
|
409
|
+
readonly ThisExpression: readonly [];
|
|
410
|
+
readonly Super: readonly [];
|
|
411
|
+
readonly Literal: readonly [];
|
|
412
|
+
readonly PrivateIdentifier: readonly [];
|
|
413
|
+
readonly ArrayExpression: readonly ["elements"];
|
|
414
|
+
readonly ObjectExpression: readonly ["properties"];
|
|
415
|
+
readonly UnaryExpression: readonly ["argument"];
|
|
416
|
+
readonly UpdateExpression: readonly ["argument"];
|
|
417
|
+
readonly BinaryExpression: readonly ["left", "right"];
|
|
418
|
+
readonly LogicalExpression: readonly ["left", "right"];
|
|
419
|
+
readonly AssignmentExpression: readonly ["left", "right"];
|
|
420
|
+
readonly MemberExpression: readonly ["object", "property"];
|
|
421
|
+
readonly ConditionalExpression: readonly ["test", "consequent", "alternate"];
|
|
422
|
+
readonly SequenceExpression: readonly ["expressions"];
|
|
423
|
+
readonly TemplateLiteral: readonly ["quasis", "expressions"];
|
|
424
|
+
readonly TemplateElement: readonly [];
|
|
425
|
+
readonly SpreadElement: readonly ["argument"];
|
|
426
|
+
readonly YieldExpression: readonly ["argument"];
|
|
427
|
+
readonly AwaitExpression: readonly ["argument"];
|
|
428
|
+
readonly ImportExpression: readonly ["source", "options", "arguments"];
|
|
429
|
+
readonly ChainExpression: readonly ["expression"];
|
|
430
|
+
readonly ParenthesizedExpression: readonly ["expression"];
|
|
431
|
+
readonly MetaProperty: readonly ["meta", "property"];
|
|
432
|
+
readonly AssignmentPattern: readonly ["decorators", "left", "right"];
|
|
433
|
+
readonly ImportDeclaration: readonly ["specifiers", "source", "attributes"];
|
|
434
|
+
readonly ImportSpecifier: readonly ["imported", "local"];
|
|
435
|
+
readonly ImportDefaultSpecifier: readonly ["local"];
|
|
436
|
+
readonly ImportNamespaceSpecifier: readonly ["local"];
|
|
437
|
+
readonly ImportAttribute: readonly ["key", "value"];
|
|
438
|
+
readonly ExportNamedDeclaration: readonly ["declaration", "specifiers", "source", "attributes"];
|
|
439
|
+
readonly ExportSpecifier: readonly ["local", "exported"];
|
|
440
|
+
readonly ExportDefaultDeclaration: readonly ["declaration"];
|
|
441
|
+
readonly ExportAllDeclaration: readonly ["exported", "source", "attributes"];
|
|
442
|
+
readonly Decorator: readonly ["expression"];
|
|
443
|
+
readonly TSAnyKeyword: readonly [];
|
|
444
|
+
readonly TSBigIntKeyword: readonly [];
|
|
445
|
+
readonly TSBooleanKeyword: readonly [];
|
|
446
|
+
readonly TSNeverKeyword: readonly [];
|
|
447
|
+
readonly TSNullKeyword: readonly [];
|
|
448
|
+
readonly TSNumberKeyword: readonly [];
|
|
449
|
+
readonly TSObjectKeyword: readonly [];
|
|
450
|
+
readonly TSStringKeyword: readonly [];
|
|
451
|
+
readonly TSSymbolKeyword: readonly [];
|
|
452
|
+
readonly TSUndefinedKeyword: readonly [];
|
|
453
|
+
readonly TSUnknownKeyword: readonly [];
|
|
454
|
+
readonly TSVoidKeyword: readonly [];
|
|
455
|
+
readonly TSThisType: readonly [];
|
|
456
|
+
readonly TSQualifiedName: readonly ["left", "right"];
|
|
457
|
+
readonly TSEnumDeclaration: readonly ["id", "members"];
|
|
458
|
+
readonly TSEnumMember: readonly ["id", "initializer"];
|
|
459
|
+
readonly TSModuleDeclaration: readonly ["id", "body"];
|
|
460
|
+
readonly TSModuleBlock: readonly ["body"];
|
|
461
|
+
readonly TSImportEqualsDeclaration: readonly ["id", "moduleReference"];
|
|
462
|
+
readonly TSExternalModuleReference: readonly ["expression"];
|
|
463
|
+
readonly TSExportAssignment: readonly ["expression"];
|
|
464
|
+
readonly TSParameterProperty: readonly ["parameter"];
|
|
465
|
+
readonly TSNonNullExpression: readonly ["expression"];
|
|
466
|
+
};
|
|
467
|
+
|
|
253
468
|
/**
|
|
254
469
|
* Return it from `enter` or `leave` to end the walk: no further `enter` or
|
|
255
470
|
* `leave` calls, including `leave` on the node's ancestors.
|
|
@@ -289,6 +504,22 @@ export interface Visitor {
|
|
|
289
504
|
*/
|
|
290
505
|
export declare function walk(node: AST.SvelteNode, visitor: Visitor, keys?: VisitorKeys): void;
|
|
291
506
|
|
|
507
|
+
/**
|
|
508
|
+
* Calls `callback` with each of `node`'s child nodes in source order, as
|
|
509
|
+
* {@link walk} would visit them, with the field that holds the child and
|
|
510
|
+
* its index when the field is an array. Allocates nothing. `keys` is as
|
|
511
|
+
* in {@link walk}.
|
|
512
|
+
*/
|
|
513
|
+
export declare function forEachChild(node: AST.SvelteNode, callback: (child: AST.SvelteNode, key: string, index: number | null) => void, keys?: VisitorKeys): void;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* `node`'s child nodes in source order, as {@link walk} would visit them.
|
|
517
|
+
* The array is made on the first call for each node and `keys`, and the
|
|
518
|
+
* same one is returned after, so don't change it; a node that
|
|
519
|
+
* {@link walk} replaces later isn't in it. `keys` is as in {@link walk}.
|
|
520
|
+
*/
|
|
521
|
+
export declare function children(node: AST.SvelteNode, keys?: VisitorKeys): readonly AST.SvelteNode[];
|
|
522
|
+
|
|
292
523
|
type Namespace = "html" | "svg" | "mathml";
|
|
293
524
|
|
|
294
525
|
export declare namespace AST {
|
|
@@ -1939,6 +2170,20 @@ export declare function extractIdentifiers(pattern: Pattern | TSParameterPropert
|
|
|
1939
2170
|
*/
|
|
1940
2171
|
export declare function isReference(node: AST.SvelteNode, parent: AST.SvelteNode | null): boolean;
|
|
1941
2172
|
|
|
2173
|
+
/**
|
|
2174
|
+
* The `{ line, column }` of `offset` in `text`, line from 1 and column
|
|
2175
|
+
* from 0, as {@link createLocator}'s function gives it, without keeping
|
|
2176
|
+
* a locator: the lines of the last 64 texts are kept, so calls for
|
|
2177
|
+
* several files in any order cost a lookup each after the first.
|
|
2178
|
+
*
|
|
2179
|
+
* ```ts
|
|
2180
|
+
* import { locate } from "sveast";
|
|
2181
|
+
*
|
|
2182
|
+
* `${file}:${locate(source, node.start).line}`;
|
|
2183
|
+
* ```
|
|
2184
|
+
*/
|
|
2185
|
+
export declare function locate(text: string, offset: number): Position;
|
|
2186
|
+
|
|
1942
2187
|
/**
|
|
1943
2188
|
* A function from an offset in `text` to its line, from 1, and column,
|
|
1944
2189
|
* from 0, in UTF-16 code units: what `loc: true` gives the node that
|
|
@@ -1961,3 +2206,5 @@ export declare function isReference(node: AST.SvelteNode, parent: AST.SvelteNode
|
|
|
1961
2206
|
* ```
|
|
1962
2207
|
*/
|
|
1963
2208
|
export declare function createLocator(text: string): (offset: number) => Position;
|
|
2209
|
+
|
|
2210
|
+
export declare function skipTypeWrappers(node: AST.SvelteNode): AST.SvelteNode;
|
package/walk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{extractIdentifiers2,isReference2,locate2,skipTypeWrappers2,visitorKeys2,markupVisitorKeys2,valueVisitorKeys2,STOP2,SKIP2,walk2,forEachChild2,children2}from"./shared-jpvd0875.js";import{createLocator2}from"./shared-m0dcdh24.js";export{SKIP2 as SKIP,STOP2 as STOP,children2 as children,createLocator2 as createLocator,extractIdentifiers2 as extractIdentifiers,forEachChild2 as forEachChild,isReference2 as isReference,locate2 as locate,markupVisitorKeys2 as markupVisitorKeys,skipTypeWrappers2 as skipTypeWrappers,valueVisitorKeys2 as valueVisitorKeys,visitorKeys2 as visitorKeys,walk2 as walk};
|
package/shared-1z80250f.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{v}from"./shared-bx03zqyq.js";import{te,le,pe,ce}from"./shared-j1r12f45.js";import{ve}from"./shared-g7qbtk93.js";import{x}from"./shared-4t495q2a.js";import{l}from"./shared-qbw8n9am.js";function f(t,n,c){let p=le(t,n,c);return y(p),pe(p)}function y(t){let{source:n}=t,{tags:c,comments:p}=ve(n),i=t.root.fragment.nodes,a=(e,r)=>{if(r<=e)return;let o=n.slice(e,r),d=o.includes("<")||o.includes("{")?o:v(o,!1,t.entityNames);i.push({type:"Text",start:e,end:r,raw:o,data:d})},s=0,m=0;for(let e of c){for(;m<p.length&&p[m]<e;m+=2){let r=p[m];if(r<s)continue;let o=p[m+1];a(s,r),i.push({type:"Comment",start:r,end:o,data:n.slice(r+4,o-3)}),s=o}if(e<s)continue;a(s,e),t.index=e,te(t);while(t.stack.length>1&&t.index<n.length)ce(t);s=t.index}let u=i.filter((e)=>e.type==="SvelteOptions");i.length=0,i.push(...u)}var S={typescript:l,entityNames:x};function ae(t,n){return f(t,n,S)}
|
|
2
|
-
export{ae};
|
package/shared-2m9w933n.js
DELETED
package/shared-3bhr0q10.js
DELETED
package/shared-3ez2yv7r.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var o={li:["li"],dt:["dt","dd"],dd:["dt","dd"],p:"address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul".split(" "),rt:["rt","rp"],rp:["rt","rp"],optgroup:["optgroup"],option:["option","optgroup"],thead:["tbody","tfoot"],tbody:["tbody","tfoot"],tfoot:["tbody"],tr:["tr","tbody"],td:["td","th","tr"],th:["td","th","tr"]};function W(t,d){return Object.hasOwn(o,t)&&o[t].includes(d)}
|
|
2
|
-
export{W};
|