ms-vite-plugin 1.5.38 → 1.5.39

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createDebugInstrumentPlugin=J;const{parseSync:H}=require("oxc-parser"),A=require("magic-string"),N="__kjs_bp_hit",O="__kjs_bp",F="__kjs_enter",C="__kjs_leave",d="__kjs_throw",D="__kjs_pos",u="__kjsErr",T=0,P=1,R=2,W="<anonymous>";function J(){let t=process.cwd(),n="";const e=new Map,i=new Map;return{name:"kuaijs-debug-instrument",enforce:"pre",configResolved(r){t=r.root||t,n=r.build?.outDir??""},writeBundle(){z(t,n,e,i)},renderChunk(r){return G(r)},transform(r,a){const o=U(a,t);if(!o)return null;const{edits:s,lines:c,aliases:y}=q(r,o,a);if(s.length===0)return null;const b=e.get(o)??new Set;for(const p of c)b.add(p);e.set(o,b),y.size>0&&i.set(o,y);const S=new A(r);for(const p of s)p.start===p.end?S.appendLeft(p.start,p.text):S.overwrite(p.start,p.end,p.text);return{code:S.toString(),map:S.generateMap({hires:!0})}}}}function U(t,n){if(!t||t.startsWith("\0")||t.includes("node_modules"))return null;const e=t.split("?")[0].split("#")[0];return!/\.[cm]?[jt]sx?$/.test(e)||!e.startsWith(n)?null:e.slice(n.length).replace(/^[\\/]+/,"").replace(/\\/g,"/")}function V(t,n){try{const e=H(t,n);return Array.isArray(e?.errors)&&e.errors.length>0?null:e?.program??null}catch{return null}}function q(t,n,e){const i=V(e,t);if(!i)return{edits:[],lines:[],aliases:new Map};const r=[],a=lt(t),o=JSON.stringify(n),s=new Set,c=[],y=f=>`()=>({${f.map(l=>l.writable?`get ${l.name}(){return ${l.name}},set ${l.name}(v){${l.name}=v}`:`get ${l.name}(){return ${l.name}}`).join(",")}})`;L(i,[],{onStatement:(f,l)=>{if(typeof f.start!="number")return;const m=h(a,f.start),x=y(l),w=f.type==="DebuggerStatement",v=`${O}(${o},${m},${x}${w?",true":""})`;s.add(m),r.push({start:f.start,end:f.start,text:w?`${v};`:`${N}(${o},${m})&&${v};`}),k(f)&&r.push({start:f.start,end:f.start,text:`${D}(${o},${m});`})},onFunctionBody:f=>Q(r,f,n,h(a,f.start)),onExpressionBody:f=>X(r,f,t,n,h(a,f.start)),onCatchClause:f=>tt(r,f,t,n,h(a,f.start)),onExpression:(f,l)=>{if(typeof f.start!="number"||typeof f.end!="number")return;const m=h(a,f.start),x=y(l);s.add(m),r.push({start:f.start,end:f.start,text:`(${N}(${o},${m})&&${O}(${o},${m},${x}),`}),r.push({start:f.end,end:f.end,text:")"})},onLabel:(f,l)=>{typeof f?.start!="number"||typeof l?.start!="number"||c.push({line:h(a,f.start),minLine:h(a,l.start)})}});const p=new Map;for(const f of c){let l=-1;for(const m of[...s].sort((x,w)=>x-w))if(m>=f.minLine){l=m;break}l>0&&l!==f.line&&p.set(f.line,l)}return{edits:r,lines:[...s].sort((f,l)=>f-l),aliases:p}}function G(t){if(!t||/(^|[\s;])export[\s{]/.test(t)||/(^|[\s;])import[\s({]/.test(t))return null;const n=new A(t);return n.prepend("try{"),n.appendLeft(K(t),`}catch(${u}){if(typeof ${d}==='function')${d}(${u},"",0,()=>({exception:${u}}),${R});throw ${u}}`),{code:n.toString(),map:n.generateMap({hires:!0})}}function K(t){const e=t.lastIndexOf(`
2
- `)+1;return t.slice(e).trimStart().startsWith("//")?e:t.length}const Y="kuaijs-debug-lines.json";function z(t,n,e,i){if(!t||!n)return;const r={};for(const[o,s]of e)r[o]=[...s].sort((c,y)=>c-y);const a={};for(const[o,s]of i){const c={};for(const[y,b]of s)c[String(y)]=b;a[o]=c}try{const o=require("fs"),s=require("path"),c=s.join(t,n);o.mkdirSync(c,{recursive:!0}),o.writeFileSync(s.join(c,Y),JSON.stringify({files:r,aliases:a}),"utf8")}catch{}}function Q(t,n,e,i){const r=n?.body;if(!r||typeof r.start!="number"||typeof r.end!="number")return;const a=JSON.stringify(B(n));let o=r.start+1;if(Array.isArray(r.body)){let s=0;for(;s<r.body.length&&M(r.body[s]);){const c=r.body[s];typeof c.end=="number"&&(o=c.end),s+=1}}t.push({start:o,end:o,text:`${F}(${a},${JSON.stringify(e)},${i});try{`}),t.push({start:r.end-1,end:r.end-1,text:`}catch(${u}){${d}(${u},${JSON.stringify(e)},${i},()=>({exception:${u}}),${T});throw ${u}}finally{${C}();}`})}function X(t,n,e,i,r){const a=n.body;if(!a||typeof a.start!="number"||typeof a.end!="number")return;const o=e.slice(a.start,a.end),s=n.async?"(async()=>":"(()=>",c=JSON.stringify(B(n));t.push({start:a.start,end:a.end,text:`${s}{${F}(${c},${JSON.stringify(i)},${r});try{return ${o};}catch(${u}){${d}(${u},${JSON.stringify(i)},${r},()=>({exception:${u}}),${T});throw ${u}}finally{${C}();}})()`})}function B(t){const n=t?.id?.name;if(typeof n=="string"&&n)return n;const e=t?.__kjsNameHint;return typeof e=="string"&&e?e:W}function Z(t,n,e){if(!j(e))return"";if(t?.type==="VariableDeclarator"&&n==="init"&&t.id?.type==="Identifier")return t.id.name;if(t?.type==="Property"&&n==="value"||(t?.type==="MethodDefinition"||t?.type==="PropertyDefinition")&&n==="value")return I(t.key);if(t?.type==="AssignmentExpression"&&n==="right"){const i=t.left;if(i?.type==="Identifier")return i.name;if(i?.type==="MemberExpression"&&i.property)return I(i.property)}return""}function I(t){return t?t.type==="Identifier"&&typeof t.name=="string"?t.name:t.type==="Literal"&&typeof t.value=="string"?t.value:"":""}function tt(t,n,e,i,r){const a=n?.body;if(typeof a?.start!="number")return;const o=n.param;let s="",c=u;if(o?.type==="Identifier")c=o.name;else if(!o)t.push({start:a.start,end:a.start,text:`(${u})`});else if(typeof o.start=="number"&&typeof o.end=="number"){const y=e.slice(o.start,o.end);t.push({start:o.start,end:o.end,text:u}),s=`let ${y}=${u};`}else return;t.push({start:a.start+1,end:a.start+1,text:s+`${d}(${c},${JSON.stringify(i)},${r},()=>({exception:${c}}),${P});`})}function L(t,n,e,i=!1){if(!(!t||typeof t!="object")){if(j(t)){const r=new Map;for(const a of t.params??[])g(a,r);t.body?.type==="BlockStatement"?(nt(t.body,r),e.onFunctionBody(t)):t.body&&e.onExpressionBody(t),n.push(r),_(t,n,e,i),n.pop();return}if(t.type==="Program"){const r=new Map;for(const a of t.body??[])if(a?.type==="ImportDeclaration")for(const o of a.specifiers??[])o?.local?.name&&r.set(o.local.name,!1);n.push(r),_(t,n,e,i),n.pop();return}if(t.type==="CatchClause"){e.onCatchClause(t);const r=new Map;t.param&&g(t.param,r,!0),n.push(r),_(t,n,e,i),n.pop();return}if(ot(t)){n.push(new Map),_(t,n,e,i),n.pop();return}_(t,n,e,i)}}function _(t,n,e,i){for(const r of Object.keys(t)){if(r==="start"||r==="end"||r==="type")continue;const a=t[r],o=Array.isArray(a)?a:[a];for(const s of o){if(!s||typeof s!="object")continue;const c=E(t)&&it.has(r),y=at(t,r,s);if(y&&s?.type==="ExpressionStatement"&&s.expression&&e.onExpression(s.expression,$(n)),!c&&rt(t,r,s)&&e.onExpression(s,$(n)),E(t)&&r==="test")e.onExpression(s,$(n));else if(E(t)&&r==="update"&&!t.test)e.onExpression(s,$(n));else if(E(t)&&r==="init"&&!t.test&&!t.update&&s?.type!=="VariableDeclaration")e.onExpression(s,$(n));else if(t.type==="ForStatement"&&r==="init"&&!t.test&&!t.update&&s?.type==="VariableDeclaration"&&s.declarations?.length===1){const p=s.declarations[0];p?.init&&e.onExpression(p.init,$(n))}(t.type==="ForInStatement"||t.type==="ForOfStatement")&&r==="right"&&e.onExpression(s,$(n)),t.type==="LabeledStatement"&&r==="body"&&e.onLabel(t,s);const b=(t.type==="ExportNamedDeclaration"||t.type==="ExportDefaultDeclaration")&&r==="declaration",S=Z(t,r,s);S&&!s.__kjsNameHint&&(s.__kjsNameHint=S),!i&&!c&&!y&&!b&&ft(s)&&!M(s)&&!ct(s)&&e.onStatement(s,$(n)),L(s,n,e,i||c),et(s,n)}}}function $(t){const n=new Map;for(let e=t.length-1;e>=0;e-=1)for(const[i,r]of t[e])n.has(i)||n.set(i,r);return[...n.entries()].map(([e,i])=>({name:e,writable:i})).sort((e,i)=>e.name<i.name?-1:e.name>i.name?1:0)}function et(t,n){const e=n[n.length-1];if(!e)return;if(t?.type==="VariableDeclaration"&&t.kind!=="var"){const r=t.kind!=="const";for(const a of t.declarations??[])g(a.id,e,r);return}const i=t?.declaration;i?.type==="ClassDeclaration"&&i.id?.name&&e.set(i.id.name,!0)}function g(t,n,e=!0){if(t)switch(t.type){case"Identifier":n.set(t.name,e);return;case"ObjectPattern":for(const i of t.properties??[])g(i.value??i.argument??i.key,n,e);return;case"ArrayPattern":for(const i of t.elements??[])g(i,n,e);return;case"AssignmentPattern":g(t.left,n,e);return;case"RestElement":g(t.argument,n);return;default:return}}function nt(t,n){const e=[t];for(;e.length>0;){const i=e.pop();if(!(!i||typeof i!="object")){if(i.type==="VariableDeclaration"&&i.kind==="var")for(const r of i.declarations??[])g(r.id,n);if(i.type==="FunctionDeclaration"&&i.id?.name&&n.set(i.id.name,!0),!(j(i)&&i!==t))for(const r of Object.keys(i)){if(r==="start"||r==="end"||r==="type")continue;const a=i[r],o=Array.isArray(a)?a:[a];for(const s of o)s&&typeof s=="object"&&e.push(s)}}}}function j(t){return t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression"}function rt(t,n,e){return n!=="value"||!e||typeof e.start!="number"?!1:t?.type==="PropertyDefinition"||t?.type==="AccessorProperty"}const it=new Set(["init","left","right","test","update"]),st=new Map([["IfStatement",new Set(["consequent","alternate"])],["WhileStatement",new Set(["body"])],["DoWhileStatement",new Set(["body"])],["ForStatement",new Set(["body"])],["ForInStatement",new Set(["body"])],["ForOfStatement",new Set(["body"])],["WithStatement",new Set(["body"])],["LabeledStatement",new Set(["body"])]]);function at(t,n,e){return e?.type==="BlockStatement"?!1:st.get(t?.type)?.has(n)===!0}function E(t){return t.type==="ForStatement"||t.type==="ForInStatement"||t.type==="ForOfStatement"}function ot(t){return t.type==="BlockStatement"||t.type==="Program"||t.type==="SwitchStatement"||t.type==="ForStatement"||t.type==="ForInStatement"||t.type==="ForOfStatement"}function ft(t){return t.type==="BlockStatement"||t.type==="EmptyStatement"||t.type==="LabeledStatement"?!1:typeof t.type=="string"&&(t.type.endsWith("Statement")||t.type.endsWith("Declaration"))}function M(t){return t?.type==="ExpressionStatement"&&t.expression?.type==="Literal"&&typeof t.expression.value=="string"}function k(t){if(!t||typeof t!="object")return!1;if(t.type==="CallExpression"||t.type==="NewExpression"||t.type==="TaggedTemplateExpression")return!0;for(const n of Object.keys(t)){if(n==="start"||n==="end"||n==="type")continue;const e=t[n],i=Array.isArray(e)?e:[e];for(const r of i)if(r&&typeof r=="object"&&k(r))return!0}return!1}function ct(t){const n=t?.expression;if(n?.type!=="CallExpression")return!1;const e=n.callee?.name;return e===N||e===O||e===F||e===C||e===d||e===D}function lt(t){const n=[0];for(let e=0;e<t.length;e+=1)t.charCodeAt(e)===10&&n.push(e+1);return n}function h(t,n){let e=0,i=t.length-1;for(;e<i;){const r=e+i+1>>1;t[r]<=n?e=r:i=r-1}return e+1}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createDebugInstrumentPlugin=J;const{parseSync:H}=require("oxc-parser"),A=require("magic-string"),E="__kjs_bp_hit",N="__kjs_bp",F="__kjs_enter",C="__kjs_leave",d="__kjs_throw",D="__kjs_pos",p="__kjsErr",T=0,P=1,R=2,W="<anonymous>";function J(){let t=process.cwd(),e="";const n=new Map,i=new Map;return{name:"kuaijs-debug-instrument",enforce:"pre",configResolved(r){t=r.root||t,e=r.build?.outDir??""},writeBundle(){z(t,e,n,i)},renderChunk(r){return G(r)},transform(r,o){const a=U(o,t);if(!a)return null;const{edits:s,lines:c,aliases:l}=q(r,a,o);if(s.length===0)return null;const S=n.get(a)??new Set;for(const y of c)S.add(y);n.set(a,S),l.size>0&&i.set(a,l);const $=new A(r);for(const y of s)y.start===y.end?$.appendLeft(y.start,y.text):$.overwrite(y.start,y.end,y.text);return{code:$.toString(),map:$.generateMap({hires:!0})}}}}function U(t,e){if(!t||t.startsWith("\0")||t.includes("node_modules"))return null;const n=t.split("?")[0].split("#")[0];return!/\.[cm]?[jt]sx?$/.test(n)||!n.startsWith(e)?null:n.slice(e.length).replace(/^[\\/]+/,"").replace(/\\/g,"/")}function V(t,e){try{const n=H(t,e);return Array.isArray(n?.errors)&&n.errors.length>0?null:n?.program??null}catch{return null}}function q(t,e,n){const i=V(n,t);if(!i)return{edits:[],lines:[],aliases:new Map};const r=[],o=ut(t),a=JSON.stringify(e),s=new Set,c=[],l=f=>`()=>({${f.map(u=>u.writable?`get ${u.name}(){return ${u.name}},set ${u.name}(v){${u.name}=v}`:`get ${u.name}(){return ${u.name}}`).join(",")}})`;L(i,[],{onStatement:(f,u)=>{if(typeof f.start!="number")return;const m=h(o,f.start),x=l(u),w=f.type==="DebuggerStatement",v=`${N}(${a},${m},${x}${w?",true":""})`;s.add(m),r.push({start:f.start,end:f.start,text:w?`${v};`:`${E}(${a},${m})&&${v};`}),k(f)&&r.push({start:f.start,end:f.start,text:`${D}(${a},${m});`})},onFunctionBody:f=>Q(r,f,e,h(o,f.start)),onExpressionBody:(f,u)=>{const m=h(o,f.body.start);s.add(m),X(r,f,t,e,h(o,f.start),l(u),a,m)},onCatchClause:f=>tt(r,f,t,e,h(o,f.start)),onExpression:(f,u)=>{if(typeof f.start!="number"||typeof f.end!="number")return;const m=h(o,f.start),x=l(u);s.add(m),r.push({start:f.start,end:f.start,text:`(${E}(${a},${m})&&${N}(${a},${m},${x}),`}),r.push({start:f.end,end:f.end,text:")"})},onLabel:(f,u)=>{typeof f?.start!="number"||typeof u?.start!="number"||c.push({line:h(o,f.start),minLine:h(o,u.start)})}});const y=new Map;for(const f of c){let u=-1;for(const m of[...s].sort((x,w)=>x-w))if(m>=f.minLine){u=m;break}u>0&&u!==f.line&&y.set(f.line,u)}return{edits:r,lines:[...s].sort((f,u)=>f-u),aliases:y}}function G(t){if(!t||/(^|[\s;])export[\s{]/.test(t)||/(^|[\s;])import[\s({]/.test(t))return null;const e=new A(t);return e.prepend("try{"),e.appendLeft(K(t),`}catch(${p}){if(typeof ${d}==='function')${d}(${p},"",0,()=>({exception:${p}}),${R});throw ${p}}`),{code:e.toString(),map:e.generateMap({hires:!0})}}function K(t){const n=t.lastIndexOf(`
2
+ `)+1;return t.slice(n).trimStart().startsWith("//")?n:t.length}const Y="kuaijs-debug-lines.json";function z(t,e,n,i){if(!t||!e)return;const r={};for(const[a,s]of n)r[a]=[...s].sort((c,l)=>c-l);const o={};for(const[a,s]of i){const c={};for(const[l,S]of s)c[String(l)]=S;o[a]=c}try{const a=require("fs"),s=require("path"),c=s.join(t,e);a.mkdirSync(c,{recursive:!0}),a.writeFileSync(s.join(c,Y),JSON.stringify({files:r,aliases:o}),"utf8")}catch{}}function Q(t,e,n,i){const r=e?.body;if(!r||typeof r.start!="number"||typeof r.end!="number")return;const o=JSON.stringify(B(e));let a=r.start+1;if(Array.isArray(r.body)){let s=0;for(;s<r.body.length&&M(r.body[s]);){const c=r.body[s];typeof c.end=="number"&&(a=c.end),s+=1}}t.push({start:a,end:a,text:`${F}(${o},${JSON.stringify(n)},${i});try{`}),t.push({start:r.end-1,end:r.end-1,text:`}catch(${p}){${d}(${p},${JSON.stringify(n)},${i},()=>({exception:${p}}),${T});throw ${p}}finally{${C}();}`})}function X(t,e,n,i,r,o,a,s){const c=e.body;if(!c||typeof c.start!="number"||typeof c.end!="number")return;const l=n.slice(c.start,c.end),S=e.async?"(async()=>":"(()=>",$=JSON.stringify(B(e));t.push({start:c.start,end:c.end,text:`${S}{${F}(${$},${JSON.stringify(i)},${r});try{${E}(${a},${s})&&${N}(${a},${s},${o});return ${l};}catch(${p}){${d}(${p},${JSON.stringify(i)},${r},()=>({exception:${p}}),${T});throw ${p}}finally{${C}();}})()`})}function B(t){const e=t?.id?.name;if(typeof e=="string"&&e)return e;const n=t?.__kjsNameHint;return typeof n=="string"&&n?n:W}function Z(t,e,n){if(!j(n))return"";if(t?.type==="VariableDeclarator"&&e==="init"&&t.id?.type==="Identifier")return t.id.name;if(t?.type==="Property"&&e==="value"||(t?.type==="MethodDefinition"||t?.type==="PropertyDefinition")&&e==="value")return I(t.key);if(t?.type==="AssignmentExpression"&&e==="right"){const i=t.left;if(i?.type==="Identifier")return i.name;if(i?.type==="MemberExpression"&&i.property)return I(i.property)}return""}function I(t){return t?t.type==="Identifier"&&typeof t.name=="string"?t.name:t.type==="Literal"&&typeof t.value=="string"?t.value:"":""}function tt(t,e,n,i,r){const o=e?.body;if(typeof o?.start!="number")return;const a=e.param;let s="",c=p;if(a?.type==="Identifier")c=a.name;else if(!a)t.push({start:o.start,end:o.start,text:`(${p})`});else if(typeof a.start=="number"&&typeof a.end=="number"){const l=n.slice(a.start,a.end);t.push({start:a.start,end:a.end,text:p}),s=`let ${l}=${p};`}else return;t.push({start:o.start+1,end:o.start+1,text:s+`${d}(${c},${JSON.stringify(i)},${r},()=>({exception:${c}}),${P});`})}function L(t,e,n,i=!1){if(!(!t||typeof t!="object")){if(j(t)){const r=new Map;for(const o of t.params??[])g(o,r);t.body?.type==="BlockStatement"?(nt(t.body,r),n.onFunctionBody(t)):t.body&&(e.push(r),n.onExpressionBody(t,b(e)),e.pop()),e.push(r),_(t,e,n,i),e.pop();return}if(t.type==="Program"){const r=new Map;for(const o of t.body??[])if(o?.type==="ImportDeclaration")for(const a of o.specifiers??[])a?.local?.name&&r.set(a.local.name,!1);e.push(r),_(t,e,n,i),e.pop();return}if(t.type==="CatchClause"){n.onCatchClause(t);const r=new Map;t.param&&g(t.param,r,!0),e.push(r),_(t,e,n,i),e.pop();return}if(ot(t)){e.push(new Map),_(t,e,n,i),e.pop();return}_(t,e,n,i)}}function _(t,e,n,i){for(const r of Object.keys(t)){if(r==="start"||r==="end"||r==="type")continue;const o=t[r],a=Array.isArray(o)?o:[o];for(const s of a){if(!s||typeof s!="object")continue;const c=O(t)&&it.has(r),l=at(t,r,s);if(l&&s?.type==="ExpressionStatement"&&s.expression&&n.onExpression(s.expression,b(e)),!c&&rt(t,r,s)&&n.onExpression(s,b(e)),O(t)&&r==="test")n.onExpression(s,b(e));else if(O(t)&&r==="update"&&!t.test)n.onExpression(s,b(e));else if(O(t)&&r==="init"&&!t.test&&!t.update&&s?.type!=="VariableDeclaration")n.onExpression(s,b(e));else if(t.type==="ForStatement"&&r==="init"&&!t.test&&!t.update&&s?.type==="VariableDeclaration"&&s.declarations?.length===1){const y=s.declarations[0];y?.init&&n.onExpression(y.init,b(e))}(t.type==="ForInStatement"||t.type==="ForOfStatement")&&r==="right"&&n.onExpression(s,b(e)),t.type==="LabeledStatement"&&r==="body"&&n.onLabel(t,s);const S=(t.type==="ExportNamedDeclaration"||t.type==="ExportDefaultDeclaration")&&r==="declaration",$=Z(t,r,s);$&&!s.__kjsNameHint&&(s.__kjsNameHint=$),!i&&!c&&!l&&!S&&ft(s)&&!M(s)&&!ct(s)&&n.onStatement(s,b(e)),L(s,e,n,i||c),et(s,e)}}}function b(t){const e=new Map;for(let n=t.length-1;n>=0;n-=1)for(const[i,r]of t[n])e.has(i)||e.set(i,r);return[...e.entries()].map(([n,i])=>({name:n,writable:i})).sort((n,i)=>n.name<i.name?-1:n.name>i.name?1:0)}function et(t,e){const n=e[e.length-1];if(!n)return;if(t?.type==="VariableDeclaration"&&t.kind!=="var"){const r=t.kind!=="const";for(const o of t.declarations??[])g(o.id,n,r);return}const i=t?.declaration;i?.type==="ClassDeclaration"&&i.id?.name&&n.set(i.id.name,!0)}function g(t,e,n=!0){if(t)switch(t.type){case"Identifier":e.set(t.name,n);return;case"ObjectPattern":for(const i of t.properties??[])g(i.value??i.argument??i.key,e,n);return;case"ArrayPattern":for(const i of t.elements??[])g(i,e,n);return;case"AssignmentPattern":g(t.left,e,n);return;case"RestElement":g(t.argument,e);return;default:return}}function nt(t,e){const n=[t];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object")){if(i.type==="VariableDeclaration"&&i.kind==="var")for(const r of i.declarations??[])g(r.id,e);if(i.type==="FunctionDeclaration"&&i.id?.name&&e.set(i.id.name,!0),!(j(i)&&i!==t))for(const r of Object.keys(i)){if(r==="start"||r==="end"||r==="type")continue;const o=i[r],a=Array.isArray(o)?o:[o];for(const s of a)s&&typeof s=="object"&&n.push(s)}}}}function j(t){return t.type==="FunctionDeclaration"||t.type==="FunctionExpression"||t.type==="ArrowFunctionExpression"}function rt(t,e,n){return e!=="value"||!n||typeof n.start!="number"?!1:t?.type==="PropertyDefinition"||t?.type==="AccessorProperty"}const it=new Set(["init","left","right","test","update"]),st=new Map([["IfStatement",new Set(["consequent","alternate"])],["WhileStatement",new Set(["body"])],["DoWhileStatement",new Set(["body"])],["ForStatement",new Set(["body"])],["ForInStatement",new Set(["body"])],["ForOfStatement",new Set(["body"])],["WithStatement",new Set(["body"])],["LabeledStatement",new Set(["body"])]]);function at(t,e,n){return n?.type==="BlockStatement"?!1:st.get(t?.type)?.has(e)===!0}function O(t){return t.type==="ForStatement"||t.type==="ForInStatement"||t.type==="ForOfStatement"}function ot(t){return t.type==="BlockStatement"||t.type==="Program"||t.type==="SwitchStatement"||t.type==="ForStatement"||t.type==="ForInStatement"||t.type==="ForOfStatement"}function ft(t){return t.type==="BlockStatement"||t.type==="EmptyStatement"||t.type==="LabeledStatement"?!1:typeof t.type=="string"&&(t.type.endsWith("Statement")||t.type.endsWith("Declaration"))}function M(t){return t?.type==="ExpressionStatement"&&t.expression?.type==="Literal"&&typeof t.expression.value=="string"}function k(t){if(!t||typeof t!="object")return!1;if(t.type==="CallExpression"||t.type==="NewExpression"||t.type==="TaggedTemplateExpression")return!0;for(const e of Object.keys(t)){if(e==="start"||e==="end"||e==="type")continue;const n=t[e],i=Array.isArray(n)?n:[n];for(const r of i)if(r&&typeof r=="object"&&k(r))return!0}return!1}function ct(t){const e=t?.expression;if(e?.type!=="CallExpression")return!1;const n=e.callee?.name;return n===E||n===N||n===F||n===C||n===d||n===D}function ut(t){const e=[0];for(let n=0;n<t.length;n+=1)t.charCodeAt(n)===10&&e.push(n+1);return e}function h(t,e){let n=0,i=t.length-1;for(;n<i;){const r=n+i+1>>1;t[r]<=e?n=r:i=r-1}return n+1}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.5.38",
3
+ "version": "1.5.39",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {