ms-vite-plugin 1.4.70 → 1.4.71

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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addVararg=c;function s(o){o.vararg=!0,t(o.body.body)}function a(o){switch(o.type){case"FuncExpr":s(o);break;case"UnaryExpr":a(o.arg);break;case"BinaryExpr":a(o.left),a(o.right);break;case"TableExpr":for(const e of o.fields)e.kind==="index"&&a(e.key),a(e.value);break;case"IndexExpr":a(o.object),a(o.index);break;case"MemberExpr":a(o.object);break;case"CallExpr":a(o.callee);for(const e of o.args)a(e);break;case"MethodCallExpr":a(o.object);for(const e of o.args)a(e);break;case"ParenExpr":a(o.exp);break;default:break}}function t(o){for(const e of o)switch(e.type){case"DoStat":case"WhileStat":case"RepeatStat":case"ForNumStat":case"ForInStat":if(e.type==="WhileStat"&&a(e.cond),e.type==="RepeatStat"&&a(e.cond),e.type==="ForNumStat"&&(a(e.start),a(e.end),e.step&&a(e.step)),e.type==="ForInStat")for(const r of e.exps)a(r);t(e.body.body);break;case"IfStat":for(const r of e.clauses)a(r.cond),t(r.body.body);e.elseBody&&t(e.elseBody.body);break;case"FuncStat":case"LocalFuncStat":s(e.func);break;case"LocalStat":if(e.exps)for(const r of e.exps)a(r);break;case"AssignStat":for(const r of e.vars)a(r);for(const r of e.exps)a(r);break;case"CallStat":a(e.exp);break;case"ReturnStat":for(const r of e.exps)a(r);break;default:break}}function c(o){t(o.body)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addVararg=c;function s(r){r.vararg=!0,t(r.body.body)}function a(r){switch(r.type){case"FuncExpr":s(r);break;case"UnaryExpr":a(r.arg);break;case"BinaryExpr":a(r.left),a(r.right);break;case"TableExpr":for(const e of r.fields)e.kind==="index"&&a(e.key),a(e.value);break;case"IndexExpr":a(r.object),a(r.index);break;case"MemberExpr":a(r.object);break;case"CallExpr":a(r.callee);for(const e of r.args)a(e);break;case"MethodCallExpr":a(r.object);for(const e of r.args)a(e);break;case"ParenExpr":a(r.exp);break;default:break}}function t(r){for(const e of r)switch(e.type){case"DoStat":case"WhileStat":case"RepeatStat":case"ForNumStat":case"ForInStat":if(e.type==="WhileStat"&&a(e.cond),e.type==="RepeatStat"&&a(e.cond),e.type==="ForNumStat"&&(a(e.start),a(e.end),e.step&&a(e.step)),e.type==="ForInStat")for(const o of e.exps)a(o);t(e.body.body);break;case"IfStat":for(const o of e.clauses)a(o.cond),t(o.body.body);e.elseBody&&t(e.elseBody.body);break;case"FuncStat":case"LocalFuncStat":s(e.func);break;case"LocalStat":if(e.exps)for(const o of e.exps)a(o);break;case"AssignStat":for(const o of e.vars)a(o);for(const o of e.exps)a(o);break;case"CallStat":a(e.exp);break;case"ReturnStat":for(const o of e.exps)a(o);break;default:break}}function c(r){t(r.body)}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.flattenControlFlow=C;function m(t){return{type:"NumberLiteral",raw:String(t),value:t}}function p(t){return{type:"NameExpr",name:t}}function f(t,o){return{type:"AssignStat",vars:t.map(e=>p(e)),exps:o}}function u(t,o){return f([t.stateName],[typeof o=="number"?m(o):o])}function k(t,o,e){return{type:"BinaryExpr",op:"or",left:{type:"BinaryExpr",op:"and",left:p(t),right:m(o)},right:m(e)}}function E(t,o,e){return{type:"BinaryExpr",op:t,left:o,right:e}}function S(t){const o=`__t${t.nextTemp}`;return t.nextTemp+=1,t.temps.push(o),o}function x(t){const o=t.nextState;return t.nextState+=1,t.states.set(o,[]),o}function s(t,o,e){t.states.get(o).push(e)}function F(t,o){for(const e of t)if(e.type==="LocalStat")for(const a of e.names)o.push(a.name);else if(e.type==="LocalFuncStat")o.push(e.name);else if(e.type==="ForNumStat")o.push(e.name),F(e.body.body,o);else if(e.type==="ForInStat")o.push(...e.names),F(e.body.body,o);else if(e.type==="DoStat"||e.type==="WhileStat"||e.type==="RepeatStat")F(e.body.body,o);else if(e.type==="IfStat"){for(const a of e.clauses)F(a.body.body,o);e.elseBody&&F(e.elseBody.body,o)}}function h(t,o,e,a){if(t.length===0)return o;const y=t.map(()=>x(e));for(let n=0;n<t.length;n+=1){const r=t[n];r.type==="LabelStat"&&e.userLabels.set(r.name,y[n])}for(let n=0;n<t.length;n+=1){const r=n+1<t.length?y[n+1]:o;I(e,y[n],t[n],r,a)}return y[0]}function I(t,o,e,a,y){switch(e.type){case"EmptyStat":case"LabelStat":s(t,o,u(t,a));return;case"AssignStat":case"CallStat":case"FuncStat":s(t,o,e),s(t,o,u(t,a));return;case"LocalStat":e.exps&&e.exps.length>0&&s(t,o,f(e.names.map(n=>n.name),e.exps)),s(t,o,u(t,a));return;case"LocalFuncStat":s(t,o,f([e.name],[e.func])),s(t,o,u(t,a));return;case"ReturnStat":s(t,o,e);return;case"BreakStat":s(t,o,u(t,y));return;case"GotoStat":{const n=t.userLabels.get(e.name);if(n===void 0)throw new Error(`goto \u672A\u5B9A\u4E49\u6807\u7B7E ::${e.name}::`);s(t,o,u(t,n));return}case"DoStat":s(t,o,u(t,h(e.body.body,a,t,y)));return;case"IfStat":{const n=S(t);let r=o;for(let l=0;l<e.clauses.length;l+=1){const b=l===e.clauses.length-1,d=h(e.clauses[l].body.body,a,t,y);let i=a;b?e.elseBody&&(i=h(e.elseBody.body,a,t,y)):i=x(t),s(t,r,f([n],[e.clauses[l].cond])),s(t,r,u(t,k(n,d,i))),b||(r=i)}e.clauses.length===0&&s(t,o,u(t,a));return}case"WhileStat":{const n=S(t),r=h(e.body.body,o,t,a);s(t,o,f([n],[e.cond])),s(t,o,u(t,k(n,r,a)));return}case"RepeatStat":{const n=S(t),r=x(t),l=h(e.body.body,r,t,a);s(t,o,u(t,l)),s(t,r,f([n],[e.cond])),s(t,r,u(t,k(n,a,l)));return}case"ForNumStat":{const n=e.name,r=S(t),l=S(t),b=S(t),d=x(t),i=x(t),L=x(t),g=x(t),N=h(e.body.body,g,t,a);s(t,o,f([n],[e.start])),s(t,o,f([r],[e.end])),s(t,o,f([l],[e.step??m(1)])),s(t,o,u(t,d)),s(t,d,f([b],[E(">=",p(l),m(0))])),s(t,d,u(t,k(b,i,L))),s(t,i,f([b],[E("<=",p(n),p(r))])),s(t,i,u(t,k(b,N,a))),s(t,L,f([b],[E(">=",p(n),p(r))])),s(t,L,u(t,k(b,N,a))),s(t,g,f([n],[E("+",p(n),p(l))])),s(t,g,u(t,d));return}case"ForInStat":{const n=S(t),r=S(t),l=S(t),b=S(t),d=x(t),i=[f([l],[p(e.names[0])]),...e.body.body],L=h(i,d,t,a),g=e.exps.slice();for(;g.length<3;)g.push({type:"NilLiteral"});s(t,o,f([n,r,l],g.slice(0,3))),s(t,o,u(t,d)),s(t,d,{type:"AssignStat",vars:e.names.map(N=>p(N)),exps:[{type:"CallExpr",callee:p(n),args:[p(r),p(l)]}]}),s(t,d,f([b],[E("~=",p(e.names[0]),{type:"NilLiteral"})])),s(t,d,u(t,k(b,L,a)));return}default:s(t,o,u(t,a))}}function v(t,o){const e=t.slice();let a=o>>>0||1;for(let y=e.length-1;y>0;y-=1){a=Math.imul(a,1664525)+1013904223>>>0;const n=a%(y+1),r=e[y];e[y]=e[n],e[n]=r}return e}function w(t,o){if(t.length===0)return t;const e={states:new Map,temps:[],nextState:1,nextTemp:1,stateName:"__s",userLabels:new Map},a=[];F(t,a);const y=h(t,0,e,0),n=[...new Set([...a,...e.temps,e.stateName])],r=v([...e.states.keys()],o).map(l=>({cond:E("==",p(e.stateName),m(l)),body:{type:"Block",body:e.states.get(l)}}));return[{type:"LocalStat",names:n.map(l=>({name:l}))},f([e.stateName],[m(y)]),{type:"WhileStat",cond:E("~=",p(e.stateName),m(0)),body:{type:"Block",body:[{type:"IfStat",clauses:r}]}}]}function c(t,o){switch(t.type){case"FuncExpr":B(t.body.body,o),t.body.body=w(t.body.body,o);break;case"UnaryExpr":c(t.arg,o);break;case"BinaryExpr":c(t.left,o),c(t.right,o);break;case"TableExpr":for(const e of t.fields)e.kind==="index"&&c(e.key,o),c(e.value,o);break;case"IndexExpr":c(t.object,o),c(t.index,o);break;case"MemberExpr":c(t.object,o);break;case"CallExpr":c(t.callee,o);for(const e of t.args)c(e,o);break;case"MethodCallExpr":c(t.object,o);for(const e of t.args)c(e,o);break;case"ParenExpr":c(t.exp,o);break;default:break}}function B(t,o){for(const e of t)switch(e.type){case"DoStat":case"WhileStat":case"RepeatStat":case"ForNumStat":case"ForInStat":if((e.type==="WhileStat"||e.type==="RepeatStat")&&c(e.cond,o),e.type==="ForNumStat"&&(c(e.start,o),c(e.end,o),e.step&&c(e.step,o)),e.type==="ForInStat")for(const a of e.exps)c(a,o);B(e.body.body,o);break;case"IfStat":for(const a of e.clauses)c(a.cond,o),B(a.body.body,o);e.elseBody&&B(e.elseBody.body,o);break;case"FuncStat":case"LocalFuncStat":B(e.func.body.body,o),e.func.body.body=w(e.func.body.body,o);break;case"LocalStat":if(e.exps)for(const a of e.exps)c(a,o);break;case"AssignStat":for(const a of e.vars)c(a,o);for(const a of e.exps)c(a,o);break;case"CallStat":c(e.exp,o);break;case"ReturnStat":for(const a of e.exps)c(a,o);break;default:break}}function C(t,o){B(t.body,o),t.body=w(t.body,o)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.flattenControlFlow=C;function m(t){return{type:"NumberLiteral",raw:String(t),value:t}}function p(t){return{type:"NameExpr",name:t}}function f(t,s){return{type:"AssignStat",vars:t.map(e=>p(e)),exps:s}}function u(t,s){return f([t.stateName],[typeof s=="number"?m(s):s])}function k(t,s,e){return{type:"BinaryExpr",op:"or",left:{type:"BinaryExpr",op:"and",left:p(t),right:m(s)},right:m(e)}}function E(t,s,e){return{type:"BinaryExpr",op:t,left:s,right:e}}function S(t){const s=`__t${t.nextTemp}`;return t.nextTemp+=1,t.temps.push(s),s}function x(t){const s=t.nextState;return t.nextState+=1,t.states.set(s,[]),s}function n(t,s,e){t.states.get(s).push(e)}function F(t,s){for(const e of t)if(e.type==="LocalStat")for(const a of e.names)s.push(a.name);else if(e.type==="LocalFuncStat")s.push(e.name);else if(e.type==="ForNumStat")s.push(e.name),F(e.body.body,s);else if(e.type==="ForInStat")s.push(...e.names),F(e.body.body,s);else if(e.type==="DoStat"||e.type==="WhileStat"||e.type==="RepeatStat")F(e.body.body,s);else if(e.type==="IfStat"){for(const a of e.clauses)F(a.body.body,s);e.elseBody&&F(e.elseBody.body,s)}}function h(t,s,e,a){if(t.length===0)return s;const y=t.map(()=>x(e));for(let o=0;o<t.length;o+=1){const r=t[o];r.type==="LabelStat"&&e.userLabels.set(r.name,y[o])}for(let o=0;o<t.length;o+=1){const r=o+1<t.length?y[o+1]:s;I(e,y[o],t[o],r,a)}return y[0]}function I(t,s,e,a,y){switch(e.type){case"EmptyStat":case"LabelStat":n(t,s,u(t,a));return;case"AssignStat":case"CallStat":case"FuncStat":n(t,s,e),n(t,s,u(t,a));return;case"LocalStat":e.exps&&e.exps.length>0&&n(t,s,f(e.names.map(o=>o.name),e.exps)),n(t,s,u(t,a));return;case"LocalFuncStat":n(t,s,f([e.name],[e.func])),n(t,s,u(t,a));return;case"ReturnStat":n(t,s,e);return;case"BreakStat":n(t,s,u(t,y));return;case"GotoStat":{const o=t.userLabels.get(e.name);if(o===void 0)throw new Error(`goto \u672A\u5B9A\u4E49\u6807\u7B7E ::${e.name}::`);n(t,s,u(t,o));return}case"DoStat":n(t,s,u(t,h(e.body.body,a,t,y)));return;case"IfStat":{const o=S(t);let r=s;for(let l=0;l<e.clauses.length;l+=1){const b=l===e.clauses.length-1,d=h(e.clauses[l].body.body,a,t,y);let i=a;b?e.elseBody&&(i=h(e.elseBody.body,a,t,y)):i=x(t),n(t,r,f([o],[e.clauses[l].cond])),n(t,r,u(t,k(o,d,i))),b||(r=i)}e.clauses.length===0&&n(t,s,u(t,a));return}case"WhileStat":{const o=S(t),r=h(e.body.body,s,t,a);n(t,s,f([o],[e.cond])),n(t,s,u(t,k(o,r,a)));return}case"RepeatStat":{const o=S(t),r=x(t),l=h(e.body.body,r,t,a);n(t,s,u(t,l)),n(t,r,f([o],[e.cond])),n(t,r,u(t,k(o,a,l)));return}case"ForNumStat":{const o=e.name,r=S(t),l=S(t),b=S(t),d=x(t),i=x(t),L=x(t),g=x(t),N=h(e.body.body,g,t,a);n(t,s,f([o],[e.start])),n(t,s,f([r],[e.end])),n(t,s,f([l],[e.step??m(1)])),n(t,s,u(t,d)),n(t,d,f([b],[E(">=",p(l),m(0))])),n(t,d,u(t,k(b,i,L))),n(t,i,f([b],[E("<=",p(o),p(r))])),n(t,i,u(t,k(b,N,a))),n(t,L,f([b],[E(">=",p(o),p(r))])),n(t,L,u(t,k(b,N,a))),n(t,g,f([o],[E("+",p(o),p(l))])),n(t,g,u(t,d));return}case"ForInStat":{const o=S(t),r=S(t),l=S(t),b=S(t),d=x(t),i=[f([l],[p(e.names[0])]),...e.body.body],L=h(i,d,t,a),g=e.exps.slice();for(;g.length<3;)g.push({type:"NilLiteral"});n(t,s,f([o,r,l],g.slice(0,3))),n(t,s,u(t,d)),n(t,d,{type:"AssignStat",vars:e.names.map(N=>p(N)),exps:[{type:"CallExpr",callee:p(o),args:[p(r),p(l)]}]}),n(t,d,f([b],[E("~=",p(e.names[0]),{type:"NilLiteral"})])),n(t,d,u(t,k(b,L,a)));return}default:n(t,s,u(t,a))}}function v(t,s){const e=t.slice();let a=s>>>0||1;for(let y=e.length-1;y>0;y-=1){a=Math.imul(a,1664525)+1013904223>>>0;const o=a%(y+1),r=e[y];e[y]=e[o],e[o]=r}return e}function w(t,s){if(t.length===0)return t;const e={states:new Map,temps:[],nextState:1,nextTemp:1,stateName:"__s",userLabels:new Map},a=[];F(t,a);const y=h(t,0,e,0),o=[...new Set([...a,...e.temps,e.stateName])],r=v([...e.states.keys()],s).map(l=>({cond:E("==",p(e.stateName),m(l)),body:{type:"Block",body:e.states.get(l)}}));return[{type:"LocalStat",names:o.map(l=>({name:l}))},f([e.stateName],[m(y)]),{type:"WhileStat",cond:E("~=",p(e.stateName),m(0)),body:{type:"Block",body:[{type:"IfStat",clauses:r}]}}]}function c(t,s){switch(t.type){case"FuncExpr":B(t.body.body,s),t.body.body=w(t.body.body,s);break;case"UnaryExpr":c(t.arg,s);break;case"BinaryExpr":c(t.left,s),c(t.right,s);break;case"TableExpr":for(const e of t.fields)e.kind==="index"&&c(e.key,s),c(e.value,s);break;case"IndexExpr":c(t.object,s),c(t.index,s);break;case"MemberExpr":c(t.object,s);break;case"CallExpr":c(t.callee,s);for(const e of t.args)c(e,s);break;case"MethodCallExpr":c(t.object,s);for(const e of t.args)c(e,s);break;case"ParenExpr":c(t.exp,s);break;default:break}}function B(t,s){for(const e of t)switch(e.type){case"DoStat":case"WhileStat":case"RepeatStat":case"ForNumStat":case"ForInStat":if((e.type==="WhileStat"||e.type==="RepeatStat")&&c(e.cond,s),e.type==="ForNumStat"&&(c(e.start,s),c(e.end,s),e.step&&c(e.step,s)),e.type==="ForInStat")for(const a of e.exps)c(a,s);B(e.body.body,s);break;case"IfStat":for(const a of e.clauses)c(a.cond,s),B(a.body.body,s);e.elseBody&&B(e.elseBody.body,s);break;case"FuncStat":case"LocalFuncStat":B(e.func.body.body,s),e.func.body.body=w(e.func.body.body,s);break;case"LocalStat":if(e.exps)for(const a of e.exps)c(a,s);break;case"AssignStat":for(const a of e.vars)c(a,s);for(const a of e.exps)c(a,s);break;case"CallStat":c(e.exp,s);break;case"ReturnStat":for(const a of e.exps)c(a,s);break;default:break}}function C(t,s){B(t.body,s),t.body=w(t.body,s)}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shortName=r,exports.renameLocals=c;const u=require("./reserved"),d=require("./scope"),l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(a){let e=a,t="";do t=l[e%l.length]+t,e=Math.floor(e/l.length)-1;while(e>=0);return u.luaKeywords.has(t)?`_${t}`:t}function c(a){let e=0;const t=new Set;(0,d.collectAndRename)(a,(o,s)=>{if(o.newName!==o.original)return;let n=r(e);for(e+=1;s.has(n)||t.has(n)||u.luaKeywords.has(n);)n=r(e),e+=1;o.newName=n,t.add(n),s.add(n)})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shortName=a,exports.renameLocals=c;const u=require("./reserved"),d=require("./scope"),l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function a(r){let e=r,t="";do t=l[e%l.length]+t,e=Math.floor(e/l.length)-1;while(e>=0);return u.luaKeywords.has(t)?`_${t}`:t}function c(r){let e=0;const t=new Set;(0,d.collectAndRename)(r,(o,s)=>{if(o.newName!==o.original)return;let n=a(e);for(e+=1;s.has(n)||t.has(n)||u.luaKeywords.has(n);)n=a(e),e+=1;o.newName=n,t.add(n),s.add(n)})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveLocal=i,exports.collectAndRename=x;function i(t,o){let r=t;for(;r;){const e=r.locals.get(o);if(e)return e;r=r.parent}}function s(t){return{parent:t,locals:new Map}}function f(t,o){const r=t.locals.get(o);if(r)return r;const e={original:o,newName:o};return t.locals.set(o,e),e}function x(t,o){const r=new Set,e={locals:new Map};d(t.body,e,r,o)}function l(t,o,r,e){d(t.body,o,r,e)}function d(t,o,r,e){for(const c of t)b(c,o,r,e)}function m(t,o,r,e){const c=s(o),a=t.params.slice();for(let u=0;u<a.length;u+=1){const p=f(c,a[u]);e(p,r),t.params[u]=p.newName}l(t.body,c,r,e)}function b(t,o,r,e){switch(t.type){case"EmptyStat":case"BreakStat":case"GotoStat":case"LabelStat":return;case"DoStat":l(t.body,s(o),r,e);return;case"WhileStat":n(t.cond,o,r,e),l(t.body,s(o),r,e);return;case"RepeatStat":{const c=s(o);l(t.body,c,r,e),n(t.cond,c,r,e);return}case"IfStat":for(const c of t.clauses)n(c.cond,o,r,e),l(c.body,s(o),r,e);t.elseBody&&l(t.elseBody,s(o),r,e);return;case"ForNumStat":{n(t.start,o,r,e),n(t.end,o,r,e),t.step&&n(t.step,o,r,e);const c=s(o),a=f(c,t.name);e(a,r),t.name=a.newName,l(t.body,c,r,e);return}case"ForInStat":{for(const a of t.exps)n(a,o,r,e);const c=s(o);for(let a=0;a<t.names.length;a+=1){const u=f(c,t.names[a]);e(u,r),t.names[a]=u.newName}l(t.body,c,r,e);return}case"FuncStat":{const c=i(o,t.name.base);c&&(t.name.base=c.newName),m(t.func,o,r,e);return}case"LocalFuncStat":{const c=f(o,t.name);e(c,r),t.name=c.newName,m(t.func,o,r,e);return}case"LocalStat":if(t.exps)for(const c of t.exps)n(c,o,r,e);for(let c=0;c<t.names.length;c+=1){const a=f(o,t.names[c].name);e(a,r),t.names[c].name=a.newName}return;case"AssignStat":for(const c of t.vars)n(c,o,r,e);for(const c of t.exps)n(c,o,r,e);return;case"CallStat":n(t.exp,o,r,e);return;case"ReturnStat":for(const c of t.exps)n(c,o,r,e);return}}function n(t,o,r,e){switch(t.type){case"NilLiteral":case"BoolLiteral":case"NumberLiteral":case"StringLiteral":case"VarargExpr":return;case"NameExpr":{const c=i(o,t.name);c&&(t.name=c.newName);return}case"UnaryExpr":n(t.arg,o,r,e);return;case"BinaryExpr":n(t.left,o,r,e),n(t.right,o,r,e);return;case"FuncExpr":m(t,o,r,e);return;case"TableExpr":for(const c of t.fields)c.kind==="index"&&n(c.key,o,r,e),n(c.value,o,r,e);return;case"IndexExpr":n(t.object,o,r,e),n(t.index,o,r,e);return;case"MemberExpr":n(t.object,o,r,e);return;case"CallExpr":n(t.callee,o,r,e);for(const c of t.args)n(c,o,r,e);return;case"MethodCallExpr":n(t.object,o,r,e);for(const c of t.args)n(c,o,r,e);return;case"ParenExpr":n(t.exp,o,r,e);return}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveLocal=i,exports.collectAndRename=x;function i(t,s){let r=t;for(;r;){const e=r.locals.get(s);if(e)return e;r=r.parent}}function c(t){return{parent:t,locals:new Map}}function f(t,s){const r=t.locals.get(s);if(r)return r;const e={original:s,newName:s};return t.locals.set(s,e),e}function x(t,s){const r=new Set,e={locals:new Map};d(t.body,e,r,s)}function l(t,s,r,e){d(t.body,s,r,e)}function d(t,s,r,e){for(const o of t)b(o,s,r,e)}function m(t,s,r,e){const o=c(s),a=t.params.slice();for(let u=0;u<a.length;u+=1){const p=f(o,a[u]);e(p,r),t.params[u]=p.newName}l(t.body,o,r,e)}function b(t,s,r,e){switch(t.type){case"EmptyStat":case"BreakStat":case"GotoStat":case"LabelStat":return;case"DoStat":l(t.body,c(s),r,e);return;case"WhileStat":n(t.cond,s,r,e),l(t.body,c(s),r,e);return;case"RepeatStat":{const o=c(s);l(t.body,o,r,e),n(t.cond,o,r,e);return}case"IfStat":for(const o of t.clauses)n(o.cond,s,r,e),l(o.body,c(s),r,e);t.elseBody&&l(t.elseBody,c(s),r,e);return;case"ForNumStat":{n(t.start,s,r,e),n(t.end,s,r,e),t.step&&n(t.step,s,r,e);const o=c(s),a=f(o,t.name);e(a,r),t.name=a.newName,l(t.body,o,r,e);return}case"ForInStat":{for(const a of t.exps)n(a,s,r,e);const o=c(s);for(let a=0;a<t.names.length;a+=1){const u=f(o,t.names[a]);e(u,r),t.names[a]=u.newName}l(t.body,o,r,e);return}case"FuncStat":{const o=i(s,t.name.base);o&&(t.name.base=o.newName),m(t.func,s,r,e);return}case"LocalFuncStat":{const o=f(s,t.name);e(o,r),t.name=o.newName,m(t.func,s,r,e);return}case"LocalStat":if(t.exps)for(const o of t.exps)n(o,s,r,e);for(let o=0;o<t.names.length;o+=1){const a=f(s,t.names[o].name);e(a,r),t.names[o].name=a.newName}return;case"AssignStat":for(const o of t.vars)n(o,s,r,e);for(const o of t.exps)n(o,s,r,e);return;case"CallStat":n(t.exp,s,r,e);return;case"ReturnStat":for(const o of t.exps)n(o,s,r,e);return}}function n(t,s,r,e){switch(t.type){case"NilLiteral":case"BoolLiteral":case"NumberLiteral":case"StringLiteral":case"VarargExpr":return;case"NameExpr":{const o=i(s,t.name);o&&(t.name=o.newName);return}case"UnaryExpr":n(t.arg,s,r,e);return;case"BinaryExpr":n(t.left,s,r,e),n(t.right,s,r,e);return;case"FuncExpr":m(t,s,r,e);return;case"TableExpr":for(const o of t.fields)o.kind==="index"&&n(o.key,s,r,e),n(o.value,s,r,e);return;case"IndexExpr":n(t.object,s,r,e),n(t.index,s,r,e);return;case"MemberExpr":n(t.object,s,r,e);return;case"CallExpr":n(t.callee,s,r,e);for(const o of t.args)n(o,s,r,e);return;case"MethodCallExpr":n(t.object,s,r,e);for(const o of t.args)n(o,s,r,e);return;case"ParenExpr":n(t.exp,s,r,e);return}}
package/docs/api/hid.md CHANGED
@@ -310,6 +310,26 @@ hid.click(100, 200);
310
310
  hid.click(300, 400);
311
311
  ```
312
312
 
313
+ ### setMoveDelay - 设置移动延迟
314
+
315
+ 设置移动完成后的等待毫秒。不调用时固件默认 40ms。可设为 0 关闭等待。
316
+
317
+ ```typescript
318
+ function setMoveDelay(milliseconds: number): boolean;
319
+ ```
320
+
321
+ **参数:**
322
+ | 参数 | 类型 | 必需 | 默认值 | 描述 |
323
+ | ---- | ---- | ---- | ------ | ---- |
324
+ | `milliseconds` | number | 是 | `40` | `0` 关闭,`>0` 覆盖毫秒,`<0` 恢复默认 |
325
+
326
+ **示例:**
327
+
328
+ ```javascript
329
+ hid.setMoveDelay(0);
330
+ hid.move(100, 200);
331
+ ```
332
+
313
333
  ## 基础触摸操作
314
334
 
315
335
  ### click - 点击操作
package/docs/apicn/hid.md CHANGED
@@ -310,6 +310,26 @@ $HID.点击(100, 200);
310
310
  $HID.点击(300, 400);
311
311
  ```
312
312
 
313
+ ### 设置移动延迟
314
+
315
+ 设置移动完成后的等待毫秒。不调用时固件默认 40ms。可设为 0 关闭等待。
316
+
317
+ ```typescript
318
+ function 设置移动延迟(毫秒: 数字): 布尔值;
319
+ ```
320
+
321
+ **参数:**
322
+ | 参数 | 类型 | 必需 | 默认值 | 描述 |
323
+ | ---- | ---- | ---- | ------ | ---- |
324
+ | `毫秒` | 数字 | 是 | `40` | `0` 关闭,`>0` 覆盖毫秒,`<0` 恢复默认 |
325
+
326
+ **示例:**
327
+
328
+ ```javascript
329
+ $HID.设置移动延迟(0);
330
+ $HID.移动(100, 200);
331
+ ```
332
+
313
333
  ## 基础触摸操作
314
334
 
315
335
  ### 点击
@@ -281,6 +281,28 @@ hid.click(100, 200)
281
281
  hid.click(300, 400)
282
282
  ```
283
283
 
284
+ ### setMoveDelay - 设置移动延迟
285
+
286
+ 设置移动完成后的等待毫秒。不调用时固件默认 40ms。可设为 0 关闭等待。
287
+
288
+ ```lua
289
+ ---@param milliseconds number
290
+ ---@return boolean
291
+ function setMoveDelay(milliseconds) end
292
+ ```
293
+
294
+ **参数:**
295
+ | 参数 | 类型 | 必需 | 默认值 | 描述 |
296
+ | ---- | ---- | ---- | ------ | ---- |
297
+ | `milliseconds` | number | 是 | `40` | `0` 关闭,`>0` 覆盖毫秒,`<0` 恢复默认 |
298
+
299
+ **示例:**
300
+
301
+ ```lua
302
+ hid.setMoveDelay(0)
303
+ hid.move(100, 200)
304
+ ```
305
+
284
306
  ## 基础触摸操作
285
307
 
286
308
  ### click - 点击操作
@@ -320,6 +320,27 @@ hid.click(100, 200)
320
320
  hid.click(300, 400)
321
321
  ```
322
322
 
323
+ ### setMoveDelay - 设置移动延迟
324
+
325
+ 设置移动完成后的等待毫秒。不调用时固件默认 40ms。可设为 0 关闭等待。
326
+
327
+ ```python
328
+ def setMoveDelay(milliseconds: int) -> bool
329
+ ```
330
+
331
+ **参数:**
332
+ | 参数 | 类型 | 必需 | 默认值 | 描述 |
333
+ | ---- | ---- | ---- | ------ | ---- |
334
+ | `milliseconds` | int | 是 | `40` | `0` 关闭,`>0` 覆盖毫秒,`<0` 恢复默认 |
335
+
336
+ **示例:**
337
+
338
+ ```python
339
+ from kuaijs import hid
340
+ hid.setMoveDelay(0)
341
+ hid.move(100, 200)
342
+ ```
343
+
323
344
  ## 基础触摸操作
324
345
 
325
346
  ### click - 点击操作
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.4.70",
3
+ "version": "1.4.71",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {