@code-inspector/esbuild
Advanced tools
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var m=(t,p,i)=>new Promise((u,o)=>{var d=s=>{try{l(i.next(s))}catch(n){o(n)}},e=s=>{try{l(i.throw(s))}catch(n){o(n)}},l=s=>s.done?u(s.value):Promise.resolve(s.value).then(d,e);l((i=i.apply(t,p)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@code-inspector/core"),h=require("fs"),y=require("path"),C="@code-inspector/esbuild";function T(t){return{name:C,setup(p){if(t.close||!r.isDev(t.dev,!1))return;const i={port:0,entry:"",output:t.output},{escapeTags:u=[]}=t,o=new Map;p.onLoad({filter:t.match||/\.(jsx|tsx|js|ts|mjs|mts)?$/},d=>m(this,null,function*(){let e=d.path;e=r.getMappingFilePath(e,t.mappings);const l=y.extname(e).replace(".","");let s=yield h.promises.readFile(e,"utf8"),n=o.get(e);if(!n||n.originCode!==s){let a=s;if(r.isExcludedFile(e,t))return{contents:a,loader:l};a=yield r.getCodeWithWebComponent({options:t,file:e,code:a,record:i});let c="";if(r.isJsTypeFile(e)?c="jsx":e.endsWith(".svelte")&&(c="svelte"),c)a=yield r.transformCode({content:a,filePath:e,fileType:c,escapeTags:u,pathType:t.pathType});else if(e.endsWith(".vue")){c="vue";const{descriptor:f}=r.parseSFC(a,{sourceMap:!1}),g=yield r.transformCode({content:f.template.content,filePath:e,fileType:c,escapeTags:u,pathType:t.pathType});a=a.replace(f.template.content,g)}n={originCode:s,output:{contents:a,loader:l}},o.set(e,n)}return n.output}))}}}exports.EsbuildCodeInspectorPlugin=T; | ||
| "use strict";var m=(t,d,l)=>new Promise((u,o)=>{var p=a=>{try{c(l.next(a))}catch(r){o(r)}},e=a=>{try{c(l.throw(a))}catch(r){o(r)}},c=a=>a.done?u(a.value):Promise.resolve(a.value).then(p,e);c((l=l.apply(t,d)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@code-inspector/core"),h=require("fs"),x=require("path"),y="@code-inspector/esbuild";function C(t){return{name:y,setup(d){if(t.close||!n.isDev(t.dev,!1))return;const l={port:0,entry:"",output:t.output},{escapeTags:u=[]}=t,o=new Map;d.onLoad({filter:t.match||/\.(jsx|tsx|js|ts|mjs|mts)?$/},p=>m(this,null,function*(){let e=p.path;e=n.getMappingFilePath(e,t.mappings);const c=x.extname(e).replace(".","");let a=yield h.promises.readFile(e,"utf8"),r=o.get(e);if(!r||r.originCode!==a){let s=a;if(n.isExcludedFile(e,t))return{contents:s,loader:c};s=yield n.getCodeWithWebComponent({options:t,file:e,code:s,record:l});let i="";if(n.isJsTypeFile(e)?i="jsx":e.endsWith(".svelte")&&(i="svelte"),i)s=yield n.transformCode({content:s,filePath:e,fileType:i,escapeTags:u,pathType:t.pathType,mdx:t.mdx});else if(e.endsWith(".vue")){i="vue";const{descriptor:f}=n.parseSFC(s,{sourceMap:!1}),g=yield n.transformCode({content:f.template.content,filePath:e,fileType:i,escapeTags:u,pathType:t.pathType,mdx:t.mdx});s=s.replace(f.template.content,g)}r={originCode:a,output:{contents:s,loader:c}},o.set(e,r)}return r.output}))}}}exports.EsbuildCodeInspectorPlugin=C; |
+46
-44
@@ -1,18 +0,18 @@ | ||
| var f = (t, c, r) => new Promise((p, o) => { | ||
| var u = (a) => { | ||
| var m = (t, o, n) => new Promise((p, c) => { | ||
| var d = (a) => { | ||
| try { | ||
| i(r.next(a)); | ||
| } catch (s) { | ||
| o(s); | ||
| l(n.next(a)); | ||
| } catch (r) { | ||
| c(r); | ||
| } | ||
| }, e = (a) => { | ||
| try { | ||
| i(r.throw(a)); | ||
| } catch (s) { | ||
| o(s); | ||
| l(n.throw(a)); | ||
| } catch (r) { | ||
| c(r); | ||
| } | ||
| }, i = (a) => a.done ? p(a.value) : Promise.resolve(a.value).then(u, e); | ||
| i((r = r.apply(t, c)).next()); | ||
| }, l = (a) => a.done ? p(a.value) : Promise.resolve(a.value).then(d, e); | ||
| l((n = n.apply(t, o)).next()); | ||
| }); | ||
| import { isDev as g, getMappingFilePath as y, isExcludedFile as C, getCodeWithWebComponent as x, isJsTypeFile as T, transformCode as m, parseSFC as v } from "@code-inspector/core"; | ||
| import { isDev as x, getMappingFilePath as g, isExcludedFile as y, getCodeWithWebComponent as C, isJsTypeFile as T, transformCode as f, parseSFC as v } from "@code-inspector/core"; | ||
| import w from "fs"; | ||
@@ -24,55 +24,57 @@ import F from "path"; | ||
| name: j, | ||
| setup(c) { | ||
| if (t.close || !g(t.dev, !1)) | ||
| setup(o) { | ||
| if (t.close || !x(t.dev, !1)) | ||
| return; | ||
| const r = { | ||
| const n = { | ||
| port: 0, | ||
| entry: "", | ||
| output: t.output | ||
| }, { escapeTags: p = [] } = t, o = /* @__PURE__ */ new Map(); | ||
| c.onLoad( | ||
| }, { escapeTags: p = [] } = t, c = /* @__PURE__ */ new Map(); | ||
| o.onLoad( | ||
| { filter: t.match || /\.(jsx|tsx|js|ts|mjs|mts)?$/ }, | ||
| (u) => f(this, null, function* () { | ||
| let e = u.path; | ||
| e = y(e, t.mappings); | ||
| const i = F.extname(e).replace(".", ""); | ||
| let a = yield w.promises.readFile(e, "utf8"), s = o.get(e); | ||
| if (!s || s.originCode !== a) { | ||
| let n = a; | ||
| if (C(e, t)) | ||
| (d) => m(this, null, function* () { | ||
| let e = d.path; | ||
| e = g(e, t.mappings); | ||
| const l = F.extname(e).replace(".", ""); | ||
| let a = yield w.promises.readFile(e, "utf8"), r = c.get(e); | ||
| if (!r || r.originCode !== a) { | ||
| let s = a; | ||
| if (y(e, t)) | ||
| return { | ||
| contents: n, | ||
| loader: i | ||
| contents: s, | ||
| loader: l | ||
| }; | ||
| n = yield x({ | ||
| s = yield C({ | ||
| options: t, | ||
| file: e, | ||
| code: n, | ||
| record: r | ||
| code: s, | ||
| record: n | ||
| }); | ||
| let l = ""; | ||
| if (T(e) ? l = "jsx" : e.endsWith(".svelte") && (l = "svelte"), l) | ||
| n = yield m({ | ||
| content: n, | ||
| let i = ""; | ||
| if (T(e) ? i = "jsx" : e.endsWith(".svelte") && (i = "svelte"), i) | ||
| s = yield f({ | ||
| content: s, | ||
| filePath: e, | ||
| fileType: l, | ||
| fileType: i, | ||
| escapeTags: p, | ||
| pathType: t.pathType | ||
| pathType: t.pathType, | ||
| mdx: t.mdx | ||
| }); | ||
| else if (e.endsWith(".vue")) { | ||
| l = "vue"; | ||
| const { descriptor: d } = v(n, { | ||
| i = "vue"; | ||
| const { descriptor: u } = v(s, { | ||
| sourceMap: !1 | ||
| }), h = yield m({ | ||
| content: d.template.content, | ||
| }), h = yield f({ | ||
| content: u.template.content, | ||
| filePath: e, | ||
| fileType: l, | ||
| fileType: i, | ||
| escapeTags: p, | ||
| pathType: t.pathType | ||
| pathType: t.pathType, | ||
| mdx: t.mdx | ||
| }); | ||
| n = n.replace(d.template.content, h); | ||
| s = s.replace(u.template.content, h); | ||
| } | ||
| s = { originCode: a, output: { contents: n, loader: i } }, o.set(e, s); | ||
| r = { originCode: a, output: { contents: s, loader: l } }, c.set(e, r); | ||
| } | ||
| return s.output; | ||
| return r.output; | ||
| }) | ||
@@ -79,0 +81,0 @@ ); |
+2
-2
| { | ||
| "name": "@code-inspector/esbuild", | ||
| "version": "1.5.4", | ||
| "version": "1.6.0", | ||
| "main": "./dist/index.js", | ||
@@ -41,3 +41,3 @@ "module": "./dist/index.mjs", | ||
| "dependencies": { | ||
| "@code-inspector/core": "1.5.4" | ||
| "@code-inspector/core": "1.6.0" | ||
| }, | ||
@@ -44,0 +44,0 @@ "devDependencies": { |
17493
0.44%102
2%+ Added
- Removed
Updated