UNPKG

vite-uni-dev-tool

Version:

vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试

2 lines (1 loc) 2.08 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("path"),f=require("os");function i(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const m=i(g),h=i(f);function d(t,n){for(let e=0;e<t.length;e++)if(n(t[e]))return e+1;return-1}function x(t){const n=m.extname(t).toLowerCase();return{".html":"text/html",".js":"text/javascript",".css":"text/css",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".woff":"font/woff",".woff2":"font/woff2"}[n]||"text/plain"}function I(){const t=h.networkInterfaces(),n=[];return Object.keys(t).forEach(e=>{var o;t!=null&&t[e]&&Array.isArray(t==null?void 0:t[e])&&((o=t==null?void 0:t[e])==null||o.forEach(r=>{r.family==="IPv4"&&!r.internal&&n.push(r.address)}))}),n.push("localhost"),n}const y=/import\s*\{[^}]*onLaunch[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function C(t){return y.test(t)}const j=/import\s*\{[^}]*getCurrentInstance[^}]*\}\s*from\s+['"]vue['"];?/;function b(t){return j.test(t)}const w=/import\s*\{[^}]*console[^}]*\}\s*from\s+['"]vite-uni-dev-tool['"];?/;function v(t){return w.test(t)}const O=/console\.\w+\(/;function T(t){return O.test(t)}function L(t){let n=0,e=-1,o=-1,r="";const l=/<template(\s[^>]*)?>/g,p=/<\/template>/g,c=[];let a;for(;(a=l.exec(t))!==null;)c.push({index:a.index,type:"start",length:a[0].length});for(;(a=p.exec(t))!==null;)c.push({index:a.index,type:"end",length:a[0].length});c.sort((s,u)=>s.index-u.index);for(const s of c)if(s.type==="start")n===0&&(e=s.index+s.length),n++;else if(s.type==="end"&&(n--,n===0)){o=s.index,r=t.substring(e,o);break}return r.trim()}exports.findInsertionIndex=d;exports.getContentType=x;exports.getLocalIPs=I;exports.getTemplateContent=L;exports.hasImportConsole=v;exports.hasImportCurrentInstance=b;exports.hasImportOnLaunch=C;exports.hasUseConsole=T;