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