@code-inspector/esbuild 1.4.5 → 1.5.0

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.
package/dist/index.js CHANGED
@@ -1 +1 @@
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;
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;
package/dist/index.mjs CHANGED
@@ -1,76 +1,79 @@
1
- var f = (s, o, n) => new Promise((p, l) => {
2
- var c = (t) => {
1
+ var f = (t, c, r) => new Promise((p, o) => {
2
+ var u = (a) => {
3
3
  try {
4
- r(n.next(t));
5
- } catch (a) {
6
- l(a);
4
+ i(r.next(a));
5
+ } catch (s) {
6
+ o(s);
7
7
  }
8
- }, e = (t) => {
8
+ }, e = (a) => {
9
9
  try {
10
- r(n.throw(t));
11
- } catch (a) {
12
- l(a);
10
+ i(r.throw(a));
11
+ } catch (s) {
12
+ o(s);
13
13
  }
14
- }, r = (t) => t.done ? p(t.value) : Promise.resolve(t.value).then(c, e);
15
- r((n = n.apply(s, o)).next());
14
+ }, i = (a) => a.done ? p(a.value) : Promise.resolve(a.value).then(u, e);
15
+ i((r = r.apply(t, c)).next());
16
16
  });
17
- 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";
17
+ 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";
18
18
  import w from "fs";
19
19
  import F from "path";
20
20
  const j = "@code-inspector/esbuild";
21
- function E(s) {
21
+ function E(t) {
22
22
  return {
23
23
  name: j,
24
- setup(o) {
25
- if (s.close || !g(s.dev, !1))
24
+ setup(c) {
25
+ if (t.close || !g(t.dev, !1))
26
26
  return;
27
- const n = {
27
+ const r = {
28
28
  port: 0,
29
29
  entry: "",
30
- output: s.output
31
- }, { escapeTags: p = [] } = s, l = /* @__PURE__ */ new Map();
32
- o.onLoad(
33
- { filter: s.match || /\.(jsx|tsx|js|ts|mjs|mts)?$/ },
34
- (c) => f(this, null, function* () {
35
- let e = c.path;
36
- e = y(e, s.mappings);
37
- let r = yield w.promises.readFile(e, "utf8"), t = l.get(e);
38
- if (!t || t.originCode !== r) {
39
- let a = r;
40
- if (C(e, s))
41
- return a;
42
- a = yield x({
43
- options: s,
30
+ output: t.output
31
+ }, { escapeTags: p = [] } = t, o = /* @__PURE__ */ new Map();
32
+ c.onLoad(
33
+ { filter: t.match || /\.(jsx|tsx|js|ts|mjs|mts)?$/ },
34
+ (u) => f(this, null, function* () {
35
+ let e = u.path;
36
+ e = y(e, t.mappings);
37
+ const i = F.extname(e).replace(".", "");
38
+ let a = yield w.promises.readFile(e, "utf8"), s = o.get(e);
39
+ if (!s || s.originCode !== a) {
40
+ let n = a;
41
+ if (C(e, t))
42
+ return {
43
+ contents: n,
44
+ loader: i
45
+ };
46
+ n = yield x({
47
+ options: t,
44
48
  file: e,
45
- code: a,
46
- record: n
49
+ code: n,
50
+ record: r
47
51
  });
48
- let i = "";
49
- if (T(e) ? i = "jsx" : e.endsWith(".svelte") && (i = "svelte"), i)
50
- a = yield d({
51
- content: a,
52
+ let l = "";
53
+ if (T(e) ? l = "jsx" : e.endsWith(".svelte") && (l = "svelte"), l)
54
+ n = yield m({
55
+ content: n,
52
56
  filePath: e,
53
- fileType: i,
57
+ fileType: l,
54
58
  escapeTags: p,
55
- pathType: s.pathType
59
+ pathType: t.pathType
56
60
  });
57
61
  else if (e.endsWith(".vue")) {
58
- i = "vue";
59
- const { descriptor: u } = v(a, {
62
+ l = "vue";
63
+ const { descriptor: d } = v(n, {
60
64
  sourceMap: !1
61
- }), h = yield d({
62
- content: u.template.content,
65
+ }), h = yield m({
66
+ content: d.template.content,
63
67
  filePath: e,
64
- fileType: i,
68
+ fileType: l,
65
69
  escapeTags: p,
66
- pathType: s.pathType
70
+ pathType: t.pathType
67
71
  });
68
- a = a.replace(u.template.content, h);
72
+ n = n.replace(d.template.content, h);
69
73
  }
70
- const m = F.extname(e).replace(".", "");
71
- t = { originCode: r, output: { contents: a, loader: m } }, l.set(e, t);
74
+ s = { originCode: a, output: { contents: n, loader: i } }, o.set(e, s);
72
75
  }
73
- return t.output;
76
+ return s.output;
74
77
  })
75
78
  );
76
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-inspector/esbuild",
3
- "version": "1.4.5",
3
+ "version": "1.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./types/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "url": "https://github.com/zh-lx/code-inspector/issues"
39
39
  },
40
40
  "dependencies": {
41
- "@code-inspector/core": "1.4.5"
41
+ "@code-inspector/core": "1.5.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^16.0.1",