@code-inspector/esbuild 1.4.3 → 1.4.4

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