UNPKG

@code-inspector/mako

Version:

Click the dom on the page, it will open your IDE and position the cursor to the source code location of the dom.

2 lines (1 loc) 1.06 kB
"use strict";var i=(e,l,o)=>new Promise((t,s)=>{var p=r=>{try{a(o.next(r))}catch(n){s(n)}},u=r=>{try{a(o.throw(r))}catch(n){s(n)}},a=r=>r.done?t(r.value):Promise.resolve(r.value).then(p,u);a((o=o.apply(e,l)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@code-inspector/core"),f=require("path");function m(e){const l={port:0,entry:"",output:e.output};return e.close||!c.isDev(e.dev,process.env.NODE_ENV==="development")?{name:"@code-inspector/mako"}:{name:"@code-inspector/mako",enforce:e.enforcePre===!1?"post":"pre",transform:(o,t)=>i(this,null,function*(){if(c.isExcludedFile(t,e)||t.includes("/.umi/"))return;const{escapeTags:s=[],mappings:p,match:u}=e||{};if(u&&!u.test(t))return;const a=yield c.getCodeWithWebComponent({options:e,file:t,code:o,record:l});if(c.isJsTypeFile(t)){const r=f.extname(t).slice(1);let n=c.normalizePath(t);return n=c.getMappingFilePath(n,p),{content:c.transformCode({content:a,filePath:n,fileType:"jsx",escapeTags:s,pathType:e.pathType}),type:r}}})}}exports.MakoCodeInspectorPlugin=m;