@nil-/xit 0.1.14 → 0.1.15

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/assets/bundler.js CHANGED
@@ -17,7 +17,7 @@ import Component from "${USER_TAG}${eA.replace(/\\/g,"/")}";
17
17
  export const action = (target, context) => {
18
18
  let ref = mount(Component, { target, context });
19
19
  return { destroy: () => unmount(ref) }
20
- };`,JSON_PKG_CACHE=new Map,SCOPED_PKG_REGEX=/^(@[^/]*\/[^/]*)(?:\/(.*))?$/s,PKG_REGEX=/^([^/]*)(?:\/(.*))?$/s,FILE_PREFIX="file:/",WIN_FILE_PREFIX="file:///",resolve_local=async(eA,AA)=>{if(AA!=null){const tA=new URL(`${FILE_PREFIX}${AA}`),gA=new URL(eA,tA).href;return gA.startsWith(WIN_FILE_PREFIX)?gA.slice(8):gA.slice(6)}return eA},resolve_remote=async(eA,AA)=>(await fetch(new URL(eA,AA),{method:"HEAD"})).url,fetch_json_remote=async eA=>{const AA=await fetch(eA);if(AA.ok)return JSON.parse(await AA.text())},fetch_package_json=async(eA,AA)=>{const[tA,gA,iA=""]=eA.split(eA.startsWith("@")?SCOPED_PKG_REGEX:PKG_REGEX),IA=`${AA}/${gA}`,BA=`${IA}/package.json`;if(JSON_PKG_CACHE.has(BA))return JSON_PKG_CACHE.get(BA);const sA=await fetch_json_remote(BA);if(sA!=null)return JSON_PKG_CACHE.set(BA,{base:IA,rest:iA,json:sA}),JSON_PKG_CACHE.get(BA)},resolve_id=eA=>({input:AA=>({resolved:AA}),hook:async(AA,tA)=>{if(AA.startsWith(INTERNAL_TAG)||AA.startsWith(USER_TAG))return AA;if(AA.startsWith(".")){if(tA!=null&&tA.startsWith(USER_TAG))return`${USER_TAG}${await resolve_local(AA,tA.slice(USER_TAG.length))}`;if(tA!=null&&tA.startsWith(RESOURCE_TAG))return`${RESOURCE_TAG}${await resolve_remote(AA,tA.slice(RESOURCE_TAG.length))}`}if(AA.startsWith("https://"))return null;const gA=await fetch_package_json(AA,eA.cdn_url);if(gA!=null){const iA=o$2(gA.json,gA.rest,{browser:!0,conditions:["svelte","production"]});if(iA!=null){if(Array.isArray(iA)&&iA.length>0)return`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${iA[0]}`)}`;if(typeof iA=="string")return`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${iA}`)}`}else{const IA=i$3(gA.json);if(IA!=null)return console.log(`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${IA}`)}`),`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${IA}`)}`}}throw console.log(AA,tA),"unknown file, should be unreachable"}});function walk(eA,AA,tA){const gA=tA._;let iA=!1;function IA(sA,{next:QA,state:CA}){QA(CA)}function BA(sA,QA,CA){if(iA||!sA.type)return;let oA;const EA={},nA={path:QA,state:CA,next:(uA=CA)=>{QA.push(sA);for(const lA in sA){if(lA==="type")continue;const hA=sA[lA];if(hA&&typeof hA=="object")if(Array.isArray(hA)){const dA={};hA.forEach((DA,wA)=>{if(DA&&typeof DA=="object"){const RA=BA(DA,QA,uA);RA&&(dA[wA]=RA)}}),Object.keys(dA).length>0&&(EA[lA]=hA.map((DA,wA)=>dA[wA]??DA))}else{const dA=BA(hA,QA,uA);dA&&(EA[lA]=dA)}}if(QA.pop(),Object.keys(EA).length>0)return apply_mutations(sA,EA)},stop:()=>{iA=!0},visit:(uA,lA=CA)=>{QA.push(sA);const hA=BA(uA,QA,lA)??uA;return QA.pop(),hA}};let cA=tA[sA.type]??IA;if(gA){let uA;oA=gA(sA,{...nA,next:(lA=CA)=>(CA=lA,uA=cA(sA,{...nA,state:lA}),uA)}),!oA&&uA&&(oA=uA)}else oA=cA(sA,nA);if(oA||Object.keys(EA).length>0&&(oA=apply_mutations(sA,EA)),oA)return oA}return BA(eA,[],AA)??eA}function apply_mutations(eA,AA){const tA={},gA=Object.getOwnPropertyDescriptors(eA);for(const iA in gA)Object.defineProperty(tA,iA,gA[iA]);for(const iA in AA)tA[iA]=AA[iA];return tA}const regex_whitespace=/\s/,regex_whitespaces=/\s+/,regex_starts_with_newline=/^\r?\n/,regex_starts_with_whitespace=/^\s/,regex_starts_with_whitespaces=/^[ \t\r\n]+/,regex_ends_with_whitespace=/\s$/,regex_ends_with_whitespaces=/[ \t\r\n]+$/,regex_not_whitespace=/[^ \t\r\n]/,regex_whitespaces_strict=/[ \t\n\r\f]+/g,regex_only_whitespaces=/^[ \t\n\r\f]+$/,regex_not_newline_characters=/[^\n]/g,regex_is_valid_identifier=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/,regex_invalid_identifier_chars=/(^[^a-zA-Z_$]|[^a-zA-Z0-9_$])/g,regex_starts_with_vowel=/^[aeiou]/,regex_heading_tags=/^h[1-6]$/,regex_illegal_attribute_character=/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/,EACH_ITEM_REACTIVE=1,EACH_INDEX_REACTIVE=2,EACH_IS_CONTROLLED=4,EACH_IS_ANIMATED=8,EACH_ITEM_IMMUTABLE=16,PROPS_IS_IMMUTABLE=1,PROPS_IS_RUNES=2,PROPS_IS_UPDATED=4,PROPS_IS_BINDABLE=8,PROPS_IS_LAZY_INITIAL=16,TRANSITION_IN=1,TRANSITION_OUT=2,TRANSITION_GLOBAL=4,TEMPLATE_FRAGMENT=1,TEMPLATE_USE_IMPORT_NODE=2,HYDRATION_START="[",HYDRATION_START_ELSE="[!",HYDRATION_END="]",ELEMENT_IS_NAMESPACED=1,ELEMENT_PRESERVE_ATTRIBUTE_CASE=2,NAMESPACE_SVG="http://www.w3.org/2000/svg",NAMESPACE_MATHML="http://www.w3.org/1998/Math/MathML",IGNORABLE_RUNTIME_WARNINGS=["state_snapshot_uncloneable","binding_property_non_reactive","hydration_attribute_changed","hydration_html_changed","ownership_invalid_binding","ownership_invalid_mutation"];function fuzzymatch(eA,AA){if(AA.length===0)return null;const gA=new FuzzySet(AA).get(eA);return gA&&gA[0][0]>.7?gA[0][1]:null}const GRAM_SIZE_LOWER=2,GRAM_SIZE_UPPER=3;function _distance(eA,AA){if(eA===null&&AA===null)throw"Trying to compare two null values";return eA===null||AA===null?0:(eA=String(eA),AA=String(AA),1-levenshtein(eA,AA)/Math.max(eA.length,AA.length))}function levenshtein(eA,AA){const tA=[];let gA=0,iA=0;for(let IA=0;IA<=AA.length;IA++)for(let BA=0;BA<=eA.length;BA++)IA&&BA?eA.charAt(BA-1)===AA.charAt(IA-1)?iA=gA:iA=Math.min(tA[BA],tA[BA-1],gA)+1:iA=IA+BA,gA=tA[BA],tA[BA]=iA;return tA.pop()}const non_word_regex=/[^\w, ]+/;function iterate_grams(eA,AA=2){const tA="-"+eA.toLowerCase().replace(non_word_regex,"")+"-",gA=AA-tA.length,iA=[];if(gA>0)for(let IA=0;IA<gA;++IA)eA+="-";for(let IA=0;IA<tA.length-AA+1;++IA)iA.push(tA.slice(IA,IA+AA));return iA}function gram_counter(eA,AA=2){const tA={},gA=iterate_grams(eA,AA);let iA=0;for(iA;iA<gA.length;++iA)gA[iA]in tA?tA[gA[iA]]+=1:tA[gA[iA]]=1;return tA}function sort_descending(eA,AA){return AA[0]-eA[0]}class FuzzySet{constructor(AA){rg(this,"exact_set",{});rg(this,"match_dict",{});rg(this,"items",{});for(let tA=GRAM_SIZE_LOWER;tA<GRAM_SIZE_UPPER+1;++tA)this.items[tA]=[];for(let tA=0;tA<AA.length;++tA)this.add(AA[tA])}add(AA){if(AA.toLowerCase()in this.exact_set)return!1;let gA=GRAM_SIZE_LOWER;for(gA;gA<GRAM_SIZE_UPPER+1;++gA)this._add(AA,gA)}_add(AA,tA){const gA=AA.toLowerCase(),iA=this.items[tA]||[],IA=iA.length;iA.push(0);const BA=gram_counter(gA,tA);let sA=0,QA,CA;for(QA in BA)CA=BA[QA],sA+=Math.pow(CA,2),QA in this.match_dict?this.match_dict[QA].push([IA,CA]):this.match_dict[QA]=[[IA,CA]];const oA=Math.sqrt(sA);iA[IA]=[oA,gA],this.items[tA]=iA,this.exact_set[gA]=AA}get(AA){const tA=AA.toLowerCase(),gA=this.exact_set[tA];if(gA)return[[1,gA]];for(let iA=GRAM_SIZE_UPPER;iA>=GRAM_SIZE_LOWER;--iA){const IA=this.__get(AA,iA);if(IA.length>0)return IA}return null}__get(AA,tA){const gA=AA.toLowerCase(),iA={},IA=gram_counter(gA,tA),BA=this.items[tA];let sA=0,QA,CA,oA,EA,nA;for(QA in IA)if(CA=IA[QA],sA+=Math.pow(CA,2),QA in this.match_dict)for(oA=0;oA<this.match_dict[QA].length;++oA)EA=this.match_dict[QA][oA][0],nA=this.match_dict[QA][oA][1],EA in iA?iA[EA]+=CA*nA:iA[EA]=CA*nA;const cA=Math.sqrt(sA);let uA=[],lA;for(const DA in iA)lA=iA[DA],uA.push([lA/(cA*BA[DA][0]),BA[DA][1]]);uA.sort(sort_descending);let hA=[];const dA=Math.min(50,uA.length);for(let DA=0;DA<dA;++DA)hA.push([_distance(uA[DA][1],gA),uA[DA][1]]);uA=hA,uA.sort(sort_descending),hA=[];for(let DA=0;DA<uA.length;++DA)uA[DA][0]===uA[0][0]&&hA.push([uA[DA][0],this.exact_set[uA[DA][1]]]);return hA}}function rangeContains(eA,AA){return eA.start<=AA&&AA<eA.end}function getLocator$1(eA,AA={}){const{offsetLine:tA=0,offsetColumn:gA=0}=AA;let iA=0;const IA=eA.split(`
20
+ };`,JSON_PKG_CACHE=new Map,SCOPED_PKG_REGEX=/^(@[^/]*\/[^/]*)(?:\/(.*))?$/s,PKG_REGEX=/^([^/]*)(?:\/(.*))?$/s,FILE_PREFIX="file:/",WIN_FILE_PREFIX="file:///",resolve_local=async(eA,AA)=>{if(AA!=null){const tA=new URL(`${FILE_PREFIX}${AA}`),gA=new URL(eA,tA).href;return gA.startsWith(WIN_FILE_PREFIX)?gA.slice(8):gA.slice(6)}return eA},resolve_remote=async(eA,AA)=>(await fetch(new URL(eA,AA),{method:"HEAD"})).url,fetch_json_remote=async eA=>{const AA=await fetch(eA);if(AA.ok)return JSON.parse(await AA.text())},fetch_package_json=async(eA,AA)=>{const[tA,gA,iA=""]=eA.split(eA.startsWith("@")?SCOPED_PKG_REGEX:PKG_REGEX),IA=`${AA}/${gA}`,BA=`${IA}/package.json`;if(JSON_PKG_CACHE.has(BA))return JSON_PKG_CACHE.get(BA);const sA=await fetch_json_remote(BA);if(sA!=null)return JSON_PKG_CACHE.set(BA,{base:IA,rest:iA,json:sA}),JSON_PKG_CACHE.get(BA)},resolve_id=eA=>({input:AA=>({resolved:AA}),hook:async(AA,tA)=>{if(AA.startsWith(INTERNAL_TAG)||AA.startsWith(USER_TAG))return AA;if(AA.startsWith(".")){if(tA!=null&&tA.startsWith(USER_TAG))return`${USER_TAG}${await resolve_local(AA,tA.slice(USER_TAG.length))}`;if(tA!=null&&tA.startsWith(RESOURCE_TAG))return`${RESOURCE_TAG}${await resolve_remote(AA,tA.slice(RESOURCE_TAG.length))}`}if(AA.startsWith("https://"))return null;const gA=await fetch_package_json(AA,eA.cdn_url);if(gA!=null){const iA=o$2(gA.json,gA.rest,{browser:!0,conditions:["svelte","production"]});if(iA!=null){if(Array.isArray(iA)&&iA.length>0)return`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${iA[0]}`)}`;if(typeof iA=="string")return`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${iA}`)}`}else{const IA=i$3(gA.json);if(IA!=null)return`${RESOURCE_TAG}${await resolve_remote(`${gA.base}/${IA}`)}`}}throw"unknown file, should be unreachable"}});function walk(eA,AA,tA){const gA=tA._;let iA=!1;function IA(sA,{next:QA,state:CA}){QA(CA)}function BA(sA,QA,CA){if(iA||!sA.type)return;let oA;const EA={},nA={path:QA,state:CA,next:(uA=CA)=>{QA.push(sA);for(const lA in sA){if(lA==="type")continue;const hA=sA[lA];if(hA&&typeof hA=="object")if(Array.isArray(hA)){const dA={};hA.forEach((DA,wA)=>{if(DA&&typeof DA=="object"){const RA=BA(DA,QA,uA);RA&&(dA[wA]=RA)}}),Object.keys(dA).length>0&&(EA[lA]=hA.map((DA,wA)=>dA[wA]??DA))}else{const dA=BA(hA,QA,uA);dA&&(EA[lA]=dA)}}if(QA.pop(),Object.keys(EA).length>0)return apply_mutations(sA,EA)},stop:()=>{iA=!0},visit:(uA,lA=CA)=>{QA.push(sA);const hA=BA(uA,QA,lA)??uA;return QA.pop(),hA}};let cA=tA[sA.type]??IA;if(gA){let uA;oA=gA(sA,{...nA,next:(lA=CA)=>(CA=lA,uA=cA(sA,{...nA,state:lA}),uA)}),!oA&&uA&&(oA=uA)}else oA=cA(sA,nA);if(oA||Object.keys(EA).length>0&&(oA=apply_mutations(sA,EA)),oA)return oA}return BA(eA,[],AA)??eA}function apply_mutations(eA,AA){const tA={},gA=Object.getOwnPropertyDescriptors(eA);for(const iA in gA)Object.defineProperty(tA,iA,gA[iA]);for(const iA in AA)tA[iA]=AA[iA];return tA}const regex_whitespace=/\s/,regex_whitespaces=/\s+/,regex_starts_with_newline=/^\r?\n/,regex_starts_with_whitespace=/^\s/,regex_starts_with_whitespaces=/^[ \t\r\n]+/,regex_ends_with_whitespace=/\s$/,regex_ends_with_whitespaces=/[ \t\r\n]+$/,regex_not_whitespace=/[^ \t\r\n]/,regex_whitespaces_strict=/[ \t\n\r\f]+/g,regex_only_whitespaces=/^[ \t\n\r\f]+$/,regex_not_newline_characters=/[^\n]/g,regex_is_valid_identifier=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/,regex_invalid_identifier_chars=/(^[^a-zA-Z_$]|[^a-zA-Z0-9_$])/g,regex_starts_with_vowel=/^[aeiou]/,regex_heading_tags=/^h[1-6]$/,regex_illegal_attribute_character=/(^[0-9-.])|[\^$@%&#?!|()[\]{}^*+~;]/,EACH_ITEM_REACTIVE=1,EACH_INDEX_REACTIVE=2,EACH_IS_CONTROLLED=4,EACH_IS_ANIMATED=8,EACH_ITEM_IMMUTABLE=16,PROPS_IS_IMMUTABLE=1,PROPS_IS_RUNES=2,PROPS_IS_UPDATED=4,PROPS_IS_BINDABLE=8,PROPS_IS_LAZY_INITIAL=16,TRANSITION_IN=1,TRANSITION_OUT=2,TRANSITION_GLOBAL=4,TEMPLATE_FRAGMENT=1,TEMPLATE_USE_IMPORT_NODE=2,HYDRATION_START="[",HYDRATION_START_ELSE="[!",HYDRATION_END="]",ELEMENT_IS_NAMESPACED=1,ELEMENT_PRESERVE_ATTRIBUTE_CASE=2,NAMESPACE_SVG="http://www.w3.org/2000/svg",NAMESPACE_MATHML="http://www.w3.org/1998/Math/MathML",IGNORABLE_RUNTIME_WARNINGS=["state_snapshot_uncloneable","binding_property_non_reactive","hydration_attribute_changed","hydration_html_changed","ownership_invalid_binding","ownership_invalid_mutation"];function fuzzymatch(eA,AA){if(AA.length===0)return null;const gA=new FuzzySet(AA).get(eA);return gA&&gA[0][0]>.7?gA[0][1]:null}const GRAM_SIZE_LOWER=2,GRAM_SIZE_UPPER=3;function _distance(eA,AA){if(eA===null&&AA===null)throw"Trying to compare two null values";return eA===null||AA===null?0:(eA=String(eA),AA=String(AA),1-levenshtein(eA,AA)/Math.max(eA.length,AA.length))}function levenshtein(eA,AA){const tA=[];let gA=0,iA=0;for(let IA=0;IA<=AA.length;IA++)for(let BA=0;BA<=eA.length;BA++)IA&&BA?eA.charAt(BA-1)===AA.charAt(IA-1)?iA=gA:iA=Math.min(tA[BA],tA[BA-1],gA)+1:iA=IA+BA,gA=tA[BA],tA[BA]=iA;return tA.pop()}const non_word_regex=/[^\w, ]+/;function iterate_grams(eA,AA=2){const tA="-"+eA.toLowerCase().replace(non_word_regex,"")+"-",gA=AA-tA.length,iA=[];if(gA>0)for(let IA=0;IA<gA;++IA)eA+="-";for(let IA=0;IA<tA.length-AA+1;++IA)iA.push(tA.slice(IA,IA+AA));return iA}function gram_counter(eA,AA=2){const tA={},gA=iterate_grams(eA,AA);let iA=0;for(iA;iA<gA.length;++iA)gA[iA]in tA?tA[gA[iA]]+=1:tA[gA[iA]]=1;return tA}function sort_descending(eA,AA){return AA[0]-eA[0]}class FuzzySet{constructor(AA){rg(this,"exact_set",{});rg(this,"match_dict",{});rg(this,"items",{});for(let tA=GRAM_SIZE_LOWER;tA<GRAM_SIZE_UPPER+1;++tA)this.items[tA]=[];for(let tA=0;tA<AA.length;++tA)this.add(AA[tA])}add(AA){if(AA.toLowerCase()in this.exact_set)return!1;let gA=GRAM_SIZE_LOWER;for(gA;gA<GRAM_SIZE_UPPER+1;++gA)this._add(AA,gA)}_add(AA,tA){const gA=AA.toLowerCase(),iA=this.items[tA]||[],IA=iA.length;iA.push(0);const BA=gram_counter(gA,tA);let sA=0,QA,CA;for(QA in BA)CA=BA[QA],sA+=Math.pow(CA,2),QA in this.match_dict?this.match_dict[QA].push([IA,CA]):this.match_dict[QA]=[[IA,CA]];const oA=Math.sqrt(sA);iA[IA]=[oA,gA],this.items[tA]=iA,this.exact_set[gA]=AA}get(AA){const tA=AA.toLowerCase(),gA=this.exact_set[tA];if(gA)return[[1,gA]];for(let iA=GRAM_SIZE_UPPER;iA>=GRAM_SIZE_LOWER;--iA){const IA=this.__get(AA,iA);if(IA.length>0)return IA}return null}__get(AA,tA){const gA=AA.toLowerCase(),iA={},IA=gram_counter(gA,tA),BA=this.items[tA];let sA=0,QA,CA,oA,EA,nA;for(QA in IA)if(CA=IA[QA],sA+=Math.pow(CA,2),QA in this.match_dict)for(oA=0;oA<this.match_dict[QA].length;++oA)EA=this.match_dict[QA][oA][0],nA=this.match_dict[QA][oA][1],EA in iA?iA[EA]+=CA*nA:iA[EA]=CA*nA;const cA=Math.sqrt(sA);let uA=[],lA;for(const DA in iA)lA=iA[DA],uA.push([lA/(cA*BA[DA][0]),BA[DA][1]]);uA.sort(sort_descending);let hA=[];const dA=Math.min(50,uA.length);for(let DA=0;DA<dA;++DA)hA.push([_distance(uA[DA][1],gA),uA[DA][1]]);uA=hA,uA.sort(sort_descending),hA=[];for(let DA=0;DA<uA.length;++DA)uA[DA][0]===uA[0][0]&&hA.push([uA[DA][0],this.exact_set[uA[DA][1]]]);return hA}}function rangeContains(eA,AA){return eA.start<=AA&&AA<eA.end}function getLocator$1(eA,AA={}){const{offsetLine:tA=0,offsetColumn:gA=0}=AA;let iA=0;const IA=eA.split(`
21
21
  `).map((QA,CA)=>{const oA=iA+QA.length+1,EA={start:iA,end:oA,line:CA};return iA=oA,EA});let BA=0;function sA(QA,CA){if(typeof QA=="string"&&(QA=eA.indexOf(QA,CA??0)),QA===-1)return;let oA=IA[BA];const EA=QA>=oA.end?1:-1;for(;oA;){if(rangeContains(oA,QA))return{line:tA+oA.line,column:gA+QA-oA.start,character:QA};BA+=EA,oA=IA[BA]}}return sA}let warnings=[],filename,source,dev,locator=getLocator$1("",{offsetLine:1}),warning_filter,ignore_stack=[],ignore_map=new Map;function push_ignore(eA){const AA=new Set([...ignore_stack.at(-1)||[],...eA]);ignore_stack.push(AA)}function pop_ignore(){ignore_stack.pop()}function reset_warning_filter(eA=()=>!0){warning_filter=eA}function is_ignored(eA,AA){var tA;return dev&&!!((tA=ignore_map.get(eA))!=null&&tA.some(gA=>gA.has(AA)))}function reset(eA,AA){var gA;source=eA;const tA=(gA=AA.rootDir)==null?void 0:gA.replace(/\\/g,"/");filename=AA.filename.replace(/\\/g,"/"),dev=!!AA.dev,typeof tA=="string"&&filename.startsWith(tA)&&(filename=filename.replace(tA,"").replace(/^[/\\]/,"")),locator=getLocator$1(source,{offsetLine:1}),warnings=[],ignore_stack=[],ignore_map.clear()}const regex_tabs=/^\t+/;function tabs_to_spaces(eA){return eA.replace(regex_tabs,AA=>AA.split(" ").join(" "))}function get_code_frame(eA,AA,tA){const gA=eA.split(`
22
22
  `),iA=Math.max(0,AA-2),IA=Math.min(AA+3,gA.length),BA=String(IA+1).length;return gA.slice(iA,IA).map((sA,QA)=>{const CA=iA+QA===AA,oA=String(QA+iA+1).padStart(BA," ");if(CA){const EA=" ".repeat(BA+2+tabs_to_spaces(sA.slice(0,tA)).length)+"^";return`${oA}: ${tabs_to_spaces(sA)}
23
23
  ${EA}`}return`${oA}: ${tabs_to_spaces(sA)}`}).join(`
package/assets/index.js CHANGED
@@ -2,9 +2,9 @@ var P = (i) => {
2
2
  throw TypeError(i);
3
3
  };
4
4
  var C = (i, e, n) => e.has(i) || P("Cannot " + n);
5
- var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n), $ = (i, e, n, a) => (C(i, e, "write to private field"), a ? a.call(i, n) : e.set(i, n), n), W = (i, e, n) => (C(i, e, "access private method"), n);
5
+ var w = (i, e, n) => (C(i, e, "read from private field"), n ? n.call(i) : e.get(i)), F = (i, e, n) => e.has(i) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, n), $ = (i, e, n, a) => (C(i, e, "write to private field"), a ? a.call(i, n) : e.set(i, n), n), I = (i, e, n) => (C(i, e, "access private method"), n);
6
6
  import { w as writable, g as get } from "./svelte/store.js";
7
- var j, I, x, M, D, L, N, S, U;
7
+ var j, W, x, M, D, L, N, S, U;
8
8
  let Service$1 = (U = class {
9
9
  constructor({ host: e, port: n }) {
10
10
  F(this, j);
@@ -32,9 +32,9 @@ let Service$1 = (U = class {
32
32
  w(this, S) == null && w(this, x) !== 1 && w(this, x) !== 3 && ($(this, S, new WebSocket(`ws://${w(this, N)}`)), w(this, S).binaryType = "arraybuffer", w(this, S).onopen = () => {
33
33
  $(this, x, 1), w(this, M) && w(this, M).call(this, w(this, N));
34
34
  }, w(this, S).onclose = () => {
35
- w(this, x) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), $(this, x, 2), W(this, j, I).call(this));
35
+ w(this, x) === 1 && (w(this, D) && w(this, D).call(this, w(this, N)), $(this, x, 2), I(this, j, W).call(this));
36
36
  }, w(this, S).onerror = () => {
37
- w(this, x) !== 1 && w(this, x) !== 3 && ($(this, x, 2), W(this, j, I).call(this));
37
+ w(this, x) !== 1 && w(this, x) !== 3 && ($(this, x, 2), I(this, j, W).call(this));
38
38
  }, w(this, S).onmessage = (e) => {
39
39
  w(this, L) && w(this, L).call(this, w(this, N), new Uint8Array(e.data));
40
40
  });
@@ -51,7 +51,7 @@ let Service$1 = (U = class {
51
51
  send(e, n) {
52
52
  e === w(this, N) && this.publish(n);
53
53
  }
54
- }, j = new WeakSet(), I = function() {
54
+ }, j = new WeakSet(), W = function() {
55
55
  w(this, S) != null && (w(this, S).close(), $(this, S, null)), setTimeout(() => this.start(), 1e3);
56
56
  }, x = new WeakMap(), M = new WeakMap(), D = new WeakMap(), L = new WeakMap(), N = new WeakMap(), S = new WeakMap(), U);
57
57
  const header = (i) => {
@@ -86,14 +86,6 @@ const header = (i) => {
86
86
  clearTimeout(a), n.publish(e), n.stop();
87
87
  }), n.start();
88
88
  };
89
- function WorkerWrapper(i) {
90
- return new Worker(
91
- "/assets/bundler.js",
92
- {
93
- name: i == null ? void 0 : i.name
94
- }
95
- );
96
- }
97
89
  var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
98
90
  function getDefaultExportFromCjs(i) {
99
91
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
@@ -2253,42 +2245,42 @@ function requireRoot() {
2253
2245
  if (!m)
2254
2246
  return f.asPromise(c, _, h, p);
2255
2247
  var v = m === r;
2256
- function y(q, k) {
2248
+ function y(q, A) {
2257
2249
  if (m) {
2258
2250
  if (v)
2259
2251
  throw q;
2260
- var A = m;
2261
- m = null, A(q, k);
2252
+ var k = m;
2253
+ m = null, k(q, A);
2262
2254
  }
2263
2255
  }
2264
2256
  function g(q) {
2265
- var k = q.lastIndexOf("google/protobuf/");
2266
- if (k > -1) {
2267
- var A = q.substring(k);
2268
- if (A in s) return A;
2257
+ var A = q.lastIndexOf("google/protobuf/");
2258
+ if (A > -1) {
2259
+ var k = q.substring(A);
2260
+ if (k in s) return k;
2269
2261
  }
2270
2262
  return null;
2271
2263
  }
2272
- function b(q, k) {
2264
+ function b(q, A) {
2273
2265
  try {
2274
- if (f.isString(k) && k.charAt(0) === "{" && (k = JSON.parse(k)), !f.isString(k))
2275
- _.setOptions(k.options).addJSON(k.nested);
2266
+ if (f.isString(A) && A.charAt(0) === "{" && (A = JSON.parse(A)), !f.isString(A))
2267
+ _.setOptions(A.options).addJSON(A.nested);
2276
2268
  else {
2277
2269
  t.filename = q;
2278
- var A = t(k, _, p), B, E = 0;
2279
- if (A.imports)
2280
- for (; E < A.imports.length; ++E)
2281
- (B = g(A.imports[E]) || _.resolvePath(q, A.imports[E])) && R(B);
2282
- if (A.weakImports)
2283
- for (E = 0; E < A.weakImports.length; ++E)
2284
- (B = g(A.weakImports[E]) || _.resolvePath(q, A.weakImports[E])) && R(B, !0);
2270
+ var k = t(A, _, p), B, E = 0;
2271
+ if (k.imports)
2272
+ for (; E < k.imports.length; ++E)
2273
+ (B = g(k.imports[E]) || _.resolvePath(q, k.imports[E])) && R(B);
2274
+ if (k.weakImports)
2275
+ for (E = 0; E < k.weakImports.length; ++E)
2276
+ (B = g(k.weakImports[E]) || _.resolvePath(q, k.weakImports[E])) && R(B, !0);
2285
2277
  }
2286
2278
  } catch (V) {
2287
2279
  y(V);
2288
2280
  }
2289
2281
  !v && !O && y(null, _);
2290
2282
  }
2291
- function R(q, k) {
2283
+ function R(q, A) {
2292
2284
  if (q = g(q) || q, !(_.files.indexOf(q) > -1)) {
2293
2285
  if (_.files.push(q), q in s) {
2294
2286
  v ? b(q, s[q]) : (++O, setTimeout(function() {
@@ -2297,19 +2289,19 @@ function requireRoot() {
2297
2289
  return;
2298
2290
  }
2299
2291
  if (v) {
2300
- var A;
2292
+ var k;
2301
2293
  try {
2302
- A = f.fs.readFileSync(q).toString("utf8");
2294
+ k = f.fs.readFileSync(q).toString("utf8");
2303
2295
  } catch (B) {
2304
- k || y(B);
2296
+ A || y(B);
2305
2297
  return;
2306
2298
  }
2307
- b(q, A);
2299
+ b(q, k);
2308
2300
  } else
2309
2301
  ++O, _.fetch(q, function(B, E) {
2310
2302
  if (--O, !!m) {
2311
2303
  if (B) {
2312
- k ? O || y(null, _) : y(B);
2304
+ A ? O || y(null, _) : y(B);
2313
2305
  return;
2314
2306
  }
2315
2307
  b(q, E);
@@ -2664,7 +2656,12 @@ var indexLightExports = indexLight.exports, light = indexLightExports;
2664
2656
  const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data = { options: { syntax: "proto3", optimize_for: "LITE_RUNTIME" }, nested: { nil: { nested: { xit: { nested: { proto: { nested: { MessageType: { values: { MessageType_FrameRequest: 0, MessageType_FrameResponse: 1, MessageType_FrameCache: 2, MessageType_FrameLoaded: 3, MessageType_FrameSubscribe: 4, MessageType_FrameUnsubscribe: 5, MessageType_ValueRequest: 6, MessageType_ValueResponse: 7, MessageType_ValueUpdate: 8, MessageType_SignalRequest: 9, MessageType_SignalResponse: 10, MessageType_SignalNotify: 11, MessageType_FileRequest: 12, MessageType_FileResponse: 13 } }, FrameRequest: { fields: { id: { type: "string", id: 1 } } }, FrameResponse: { oneofs: { value: { oneof: ["file", "content"] } }, fields: { id: { type: "string", id: 1 }, file: { type: "string", id: 2 }, content: { type: "string", id: 3 } } }, FrameCache: { fields: { id: { type: "string", id: 1 }, content: { type: "string", id: 2 }, files: { rule: "repeated", type: "FileInfo", id: 3 } } }, FrameLoaded: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, FrameSubscribe: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, FrameUnsubscribe: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, Value: { oneofs: { value: { oneof: ["value_boolean", "value_number", "value_double", "value_string", "value_buffer"] } }, fields: { id: { type: "string", id: 1 }, value_boolean: { type: "bool", id: 2 }, value_number: { type: "int64", id: 3 }, value_double: { type: "double", id: 4 }, value_string: { type: "string", id: 5 }, value_buffer: { type: "bytes", id: 6 } } }, ValueRequest: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, ValueResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, values: { rule: "repeated", type: "Value", id: 3 } } }, ValueUpdate: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, value: { type: "Value", id: 3 } } }, SignalRequest: { fields: { id: { type: "string", id: 1 } } }, Signal: { oneofs: { _type: { oneof: ["type"] } }, fields: { id: { type: "string", id: 1 }, type: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, SignalResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signals: { rule: "repeated", type: "Signal", id: 3 } } }, SignalNotify: { oneofs: { _tag: { oneof: ["tag"] }, arg: { oneof: ["arg_boolean", "arg_number", "arg_double", "arg_string", "arg_buffer"] } }, fields: { frame_id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signal_id: { type: "string", id: 3 }, arg_boolean: { type: "bool", id: 4 }, arg_number: { type: "int64", id: 5 }, arg_double: { type: "double", id: 6 }, arg_string: { type: "string", id: 7 }, arg_buffer: { type: "bytes", id: 8 } } }, FileRequest: { fields: { target: { type: "string", id: 1 } } }, FileResponse: { fields: { target: { type: "string", id: 1 }, content: { type: "string", id: 2 }, metadata: { type: "bytes", id: 3 } } }, FileInfo: { fields: { target: { type: "string", id: 1 }, metadata: { type: "bytes", id: 2 } } } } } } } } } } }, nil_xit_proto = protobufjs.Root.fromJSON(proto_data).lookup(
2665
2657
  "nil.xit.proto"
2666
2658
  ), bundle = async (i) => new Promise((e, n) => {
2667
- const a = new WorkerWrapper();
2659
+ console.log(import.meta.url);
2660
+ const a = new Worker(new URL(
2661
+ /* @vite-ignore */
2662
+ "/assets/bundler.js",
2663
+ import.meta.url
2664
+ ), { type: "module" });
2668
2665
  a.postMessage({ type: "init", host: i.host, id: i.id, cdn_url: i.cdn_url }), a.addEventListener("message", async (f) => {
2669
2666
  if (f.data.ok) {
2670
2667
  if (f.data.files) {
package/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export type Xit = {
25
25
  number: (t: string, v: number) => Writable<number>;
26
26
  string: (t: string, v: string) => Writable<string>;
27
27
  buffer: (t: string, v: Uint8Array) => Writable<Uint8Array>;
28
- json: (t: string, v: object, codec: CoDec) => Writable<Record<string, any>>;
28
+ json: (t: string, v: object, codec: CoDec) => Writable<any>;
29
29
  };
30
30
  signals: {
31
31
  none: (t: string) => () => void;
@@ -34,7 +34,7 @@ export type Xit = {
34
34
  number: (t: string) => (v: number) => void;
35
35
  string: (t: string) => (v: string) => void;
36
36
  buffer: (t: string) => (v: Uint8Array) => void;
37
- json: (t: string, encoder: CoDec["encode"]) => (v: Record<string, any>) => void;
37
+ json: (t: string, encoder: CoDec["encode"]) => (v: any) => void;
38
38
  };
39
39
  loader: Loader;
40
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nil-/xit",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",