@code-inspector/webpack 1.4.4 → 1.4.6

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.mjs CHANGED
@@ -1,170 +1,177 @@
1
- var L = Object.defineProperty, N = Object.defineProperties;
2
- var O = Object.getOwnPropertyDescriptors;
3
- var C = Object.getOwnPropertySymbols;
1
+ var N = Object.defineProperty, O = Object.defineProperties;
2
+ var R = Object.getOwnPropertyDescriptors;
3
+ var x = Object.getOwnPropertySymbols;
4
4
  var S = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
5
- var W = (s, t, e) => t in s ? L(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, d = (s, t) => {
6
- for (var e in t || (t = {}))
7
- S.call(t, e) && W(s, e, t[e]);
8
- if (C)
9
- for (var e of C(t))
10
- z.call(t, e) && W(s, e, t[e]);
11
- return s;
12
- }, v = (s, t) => N(s, O(t));
13
- var c = (s, t, e) => new Promise((n, a) => {
14
- var r = (o) => {
5
+ var W = (e, t, s) => t in e ? N(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t) => {
6
+ for (var s in t || (t = {}))
7
+ S.call(t, s) && W(e, s, t[s]);
8
+ if (x)
9
+ for (var s of x(t))
10
+ z.call(t, s) && W(e, s, t[s]);
11
+ return e;
12
+ }, y = (e, t) => O(e, R(t));
13
+ var h = (e, t, s) => new Promise((o, n) => {
14
+ var a = (r) => {
15
15
  try {
16
- i(e.next(o));
17
- } catch (f) {
18
- a(f);
16
+ f(s.next(r));
17
+ } catch (i) {
18
+ n(i);
19
19
  }
20
- }, u = (o) => {
20
+ }, u = (r) => {
21
21
  try {
22
- i(e.throw(o));
23
- } catch (f) {
24
- a(f);
22
+ f(s.throw(r));
23
+ } catch (i) {
24
+ n(i);
25
25
  }
26
- }, i = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(r, u);
27
- i((e = e.apply(s, t)).next());
26
+ }, f = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(a, u);
27
+ f((s = s.apply(e, t)).next());
28
28
  });
29
- import { normalizePath as _, fileURLToPath as I, isDev as R, getProjectRecord as F, isNextjsProject as H, getCodeWithWebComponent as Q } from "@code-inspector/core";
30
- import j, { dirname as U } from "path";
31
- function V(s, t) {
32
- return c(this, null, function* () {
33
- if (!s || !t)
29
+ import { normalizePath as $, isDev as _, getProjectRecord as H, isNextjsProject as Q, getCodeWithWebComponent as U } from "@code-inspector/core";
30
+ import j from "path";
31
+ import { fileURLToPath as V } from "url";
32
+ function q(e, t) {
33
+ return h(this, null, function* () {
34
+ if (!e || !t)
34
35
  return [];
35
- const e = typeof s == "function" ? yield s() : s;
36
- let n = [];
37
- if (typeof e == "object" && !Array.isArray(e))
38
- for (const a in e) {
39
- const r = e[a], u = r.import || r;
40
- $(n, u, t);
36
+ const s = typeof e == "function" ? yield e() : e;
37
+ let o = [];
38
+ if (typeof s == "object" && !Array.isArray(s))
39
+ for (const n in s) {
40
+ const a = s[n], u = a.import || a;
41
+ w(o, u, t);
41
42
  }
42
43
  else
43
- $(n, e, t);
44
- return n.filter((a) => !!a);
44
+ w(o, s, t);
45
+ return o.filter((n) => !!n);
45
46
  });
46
47
  }
47
- function $(s, t, e) {
48
- typeof t == "string" ? s.push(w(t, e)) : Array.isArray(t) && s.push(
49
- ...t.map((n) => w(n, e))
48
+ function w(e, t, s) {
49
+ typeof t == "string" ? e.push(D(t, s)) : Array.isArray(t) && e.push(
50
+ ...t.map((o) => D(o, s))
50
51
  );
51
52
  }
52
- function w(s, t) {
53
- return j.isAbsolute(s) ? _(s) : s.startsWith(".") ? j.resolve(t, _(s)) : "";
53
+ function D(e, t) {
54
+ return j.isAbsolute(e) ? $(e) : e.startsWith(".") ? j.resolve(t, $(e)) : "";
54
55
  }
55
- let p = "";
56
- typeof __dirname != "undefined" ? p = __dirname : p = U(I(import.meta.url));
57
- let P = !0;
58
- const q = (s, t) => {
59
- var r, u;
60
- if (!P)
61
- return;
62
- P = !1;
63
- const e = (t == null ? void 0 : t.compiler) || t, n = (r = e == null ? void 0 : e.options) == null ? void 0 : r.module;
64
- ((n == null ? void 0 : n.rules) || (n == null ? void 0 : n.loaders) || []).push(
65
- d({
66
- test: (u = s.match) != null ? u : /\.html$/,
56
+ const L = j.dirname(V(import.meta.url)), P = j.resolve(L, "./loader.js"), E = j.resolve(L, "./inject-loader.js");
57
+ function B(e) {
58
+ return e.some(
59
+ (t) => {
60
+ var s, o;
61
+ return (o = (s = t == null ? void 0 : t.use) == null ? void 0 : s.some) == null ? void 0 : o.call(
62
+ s,
63
+ (n) => (n == null ? void 0 : n.loader) === P || (n == null ? void 0 : n.loader) === E
64
+ );
65
+ }
66
+ );
67
+ }
68
+ const F = (e, t) => {
69
+ var a, u;
70
+ const s = (t == null ? void 0 : t.compiler) || t, o = (a = s == null ? void 0 : s.options) == null ? void 0 : a.module, n = (o == null ? void 0 : o.rules) || (o == null ? void 0 : o.loaders) || [];
71
+ B(n) || n.push(
72
+ c({
73
+ test: (u = e.match) != null ? u : /\.html$/,
67
74
  resourceQuery: /vue/,
68
75
  use: [
69
76
  {
70
- loader: j.resolve(p, "./loader.js"),
71
- options: s
77
+ loader: P,
78
+ options: e
72
79
  }
73
80
  ]
74
- }, s.enforcePre === !1 ? {} : { enforce: "pre" }),
75
- d({
81
+ }, e.enforcePre === !1 ? {} : { enforce: "pre" }),
82
+ c({
76
83
  test: /\.(vue|jsx|tsx|js|ts|mjs|mts|svelte)$/,
77
84
  use: [
78
85
  {
79
- loader: j.resolve(p, "./loader.js"),
80
- options: s
86
+ loader: P,
87
+ options: e
81
88
  }
82
89
  ]
83
- }, s.enforcePre === !1 ? {} : { enforce: "pre" }),
84
- v(d({}, s.injectTo ? { resource: s.injectTo } : {
90
+ }, e.enforcePre === !1 ? {} : { enforce: "pre" }),
91
+ y(c({}, e.injectTo ? { resource: e.injectTo } : {
85
92
  test: /\.(jsx|tsx|js|ts|mjs|mts)$/,
86
93
  exclude: /node_modules/
87
94
  }), {
88
95
  use: [
89
96
  {
90
- loader: j.resolve(p, "./inject-loader.js"),
91
- options: s
97
+ loader: E,
98
+ options: e
92
99
  }
93
100
  ],
94
- enforce: H() ? "pre" : "post"
101
+ enforce: Q() ? "pre" : "post"
95
102
  })
96
103
  );
97
104
  };
98
- function D(s, t, e) {
99
- return Q({
100
- options: v(d({}, s), { importClient: "code" }),
105
+ function T(e, t, s) {
106
+ return U({
107
+ options: y(c({}, e), { importClient: "code" }),
101
108
  file: "main.js",
102
109
  code: "",
103
110
  record: t,
104
111
  inject: !0,
105
- server: e
112
+ server: s
106
113
  });
107
114
  }
108
- function B(n) {
109
- return c(this, arguments, function* ({
110
- options: s,
115
+ function G(o) {
116
+ return h(this, arguments, function* ({
117
+ options: e,
111
118
  record: t,
112
- assets: e
119
+ assets: s
113
120
  }) {
114
- const a = Object.keys(e).filter((r) => /\.html$/.test(r));
115
- if (a.length) {
116
- const r = yield D(s, t);
117
- a.forEach((u) => {
118
- var o, f;
119
- const i = (f = (o = e[u]) == null ? void 0 : o.source) == null ? void 0 : f.call(o);
120
- if (typeof i == "string") {
121
- const h = i.replace(
121
+ const n = Object.keys(s).filter((a) => /\.html$/.test(a));
122
+ if (n.length) {
123
+ const a = yield T(e, t);
124
+ n.forEach((u) => {
125
+ var r, i;
126
+ const f = (i = (r = s[u]) == null ? void 0 : r.source) == null ? void 0 : i.call(r);
127
+ if (typeof f == "string") {
128
+ const d = f.replace(
122
129
  "<head>",
123
- '<head><script type="module">\n'.concat(r, "\n<\/script>")
130
+ '<head><script type="module">\n'.concat(a, "\n<\/script>")
124
131
  );
125
- e[u] = {
126
- source: () => h,
127
- size: () => h.length
132
+ s[u] = {
133
+ source: () => d,
134
+ size: () => d.length
128
135
  };
129
136
  }
130
137
  });
131
138
  }
132
139
  });
133
140
  }
134
- class M {
141
+ class Y {
135
142
  constructor(t) {
136
143
  this.options = t;
137
144
  }
138
145
  apply(t) {
139
- return c(this, null, function* () {
140
- var a, r, u, i, o, f, h, b, k, A, y, x;
141
- if (P = !0, this.options.close || !R(
146
+ return h(this, null, function* () {
147
+ var n, a, u, f, r, i, d, b, k, A, p, C;
148
+ if (this.options.close || !_(
142
149
  this.options.dev,
143
- ((a = t == null ? void 0 : t.options) == null ? void 0 : a.mode) === "development" || process.env.NODE_ENV === "development"
150
+ ((n = t == null ? void 0 : t.options) == null ? void 0 : n.mode) === "development" || process.env.NODE_ENV === "development"
144
151
  ))
145
152
  return;
146
- const e = {
153
+ const s = {
147
154
  port: 0,
148
155
  entry: "",
149
156
  output: this.options.output,
150
- inputs: V(
151
- (r = t == null ? void 0 : t.options) == null ? void 0 : r.entry,
157
+ inputs: q(
158
+ (a = t == null ? void 0 : t.options) == null ? void 0 : a.entry,
152
159
  (u = t == null ? void 0 : t.options) == null ? void 0 : u.context
153
160
  ),
154
- envDir: (i = t == null ? void 0 : t.options) == null ? void 0 : i.context,
155
- root: (o = t == null ? void 0 : t.options) == null ? void 0 : o.context
156
- }, n = ((f = t == null ? void 0 : t.options) == null ? void 0 : f.cache) || ((b = (h = t == null ? void 0 : t.options) == null ? void 0 : h.experiments) == null ? void 0 : b.cache);
157
- if ((n == null ? void 0 : n.type) === "filesystem" && (this.options.cache ? (e.port = this.options.port || ((k = F(e)) == null ? void 0 : k.previousPort), D(this.options, e, !0)) : n.version = "code-inspector-".concat(Date.now())), q(v(d({}, this.options), { record: e }), t), (A = t == null ? void 0 : t.hooks) != null && A.emit && !((x = (y = this.options.skipSnippets) == null ? void 0 : y.includes) != null && x.call(y, "htmlScript"))) {
158
- const E = this.options;
161
+ envDir: (f = t == null ? void 0 : t.options) == null ? void 0 : f.context,
162
+ root: (r = t == null ? void 0 : t.options) == null ? void 0 : r.context
163
+ }, o = ((i = t == null ? void 0 : t.options) == null ? void 0 : i.cache) || ((b = (d = t == null ? void 0 : t.options) == null ? void 0 : d.experiments) == null ? void 0 : b.cache);
164
+ if ((o == null ? void 0 : o.type) === "filesystem" && (this.options.cache ? (s.port = this.options.port || ((k = H(s)) == null ? void 0 : k.previousPort), T(this.options, s, !0)) : o.version = "code-inspector-".concat(Date.now())), F(y(c({}, this.options), { record: s }), t), (A = t == null ? void 0 : t.hooks) != null && A.emit && !((C = (p = this.options.skipSnippets) == null ? void 0 : p.includes) != null && C.call(p, "htmlScript"))) {
165
+ const l = this.options;
159
166
  t.hooks.emit.tapAsync(
160
167
  "WebpackCodeInspectorPlugin",
161
- (g, T) => c(this, null, function* () {
162
- let l = {};
163
- g.getAssets ? l = yield g.getAssets() : l = g.assets, yield B({
164
- options: E,
165
- record: e,
166
- assets: l
167
- }), T();
168
+ (v, I) => h(this, null, function* () {
169
+ let g = {};
170
+ v.getAssets ? g = yield v.getAssets() : g = v.assets, yield G({
171
+ options: l,
172
+ record: s,
173
+ assets: g
174
+ }), I();
168
175
  })
169
176
  );
170
177
  }
@@ -172,5 +179,5 @@ class M {
172
179
  }
173
180
  }
174
181
  export {
175
- M as default
182
+ Y as default
176
183
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(s,n){typeof exports=="object"&&typeof module!="undefined"?module.exports=n(require("@code-inspector/core"),require("path")):typeof define=="function"&&define.amd?define(["@code-inspector/core","path"],n):(s=typeof globalThis!="undefined"?globalThis:s||self,s.WebpackCodeInspectorPlugin=n(s.core,s.path))})(this,function(s,n){"use strict";var q=Object.defineProperty,z=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var R=(s,n,r)=>n in s?q(s,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[n]=r,j=(s,n)=>{for(var r in n||(n={}))O.call(n,r)&&R(s,r,n[r]);if(L)for(var r of L(n))F.call(n,r)&&R(s,r,n[r]);return s},C=(s,n)=>z(s,N(n));var b=(s,n,r)=>new Promise((A,l)=>{var k=a=>{try{h(r.next(a))}catch(y){l(y)}},c=a=>{try{h(r.throw(a))}catch(y){l(y)}},h=a=>a.done?A(a.value):Promise.resolve(a.value).then(k,c);h((r=r.apply(s,n)).next())});var r=typeof document!="undefined"?document.currentScript:null;function A(t,e){return b(this,null,function*(){if(!t||!e)return[];const o=typeof t=="function"?yield t():t;let u=[];if(typeof o=="object"&&!Array.isArray(o))for(const f in o){const i=o[f],d=i.import||i;l(u,d,e)}else l(u,o,e);return u.filter(f=>!!f)})}function l(t,e,o){typeof e=="string"?t.push(k(e,o)):Array.isArray(e)&&t.push(...e.map(u=>k(u,o)))}function k(t,e){return n.isAbsolute(t)?s.normalizePath(t):t.startsWith(".")?n.resolve(e,s.normalizePath(t)):""}let c="";typeof __dirname!="undefined"?c=__dirname:c=n.dirname(s.fileURLToPath(typeof document=="undefined"&&typeof location=="undefined"?require("url").pathToFileURL(__filename).href:typeof document=="undefined"?location.href:r&&r.src||new URL("index.umd.js",document.baseURI).href));let h=!0;const a=(t,e)=>{var i,d;if(!h)return;h=!1;const o=(e==null?void 0:e.compiler)||e,u=(i=o==null?void 0:o.options)==null?void 0:i.module;((u==null?void 0:u.rules)||(u==null?void 0:u.loaders)||[]).push(j({test:(d=t.match)!=null?d:/\.html$/,resourceQuery:/vue/,use:[{loader:n.resolve(c,"./loader.js"),options:t}]},t.enforcePre===!1?{}:{enforce:"pre"}),j({test:/\.(vue|jsx|tsx|js|ts|mjs|mts|svelte)$/,use:[{loader:n.resolve(c,"./loader.js"),options:t}]},t.enforcePre===!1?{}:{enforce:"pre"}),C(j({},t.injectTo?{resource:t.injectTo}:{test:/\.(jsx|tsx|js|ts|mjs|mts)$/,exclude:/node_modules/}),{use:[{loader:n.resolve(c,"./inject-loader.js"),options:t}],enforce:s.isNextjsProject()?"pre":"post"}))};function y(t,e,o){return s.getCodeWithWebComponent({options:C(j({},t),{importClient:"code"}),file:"main.js",code:"",record:e,inject:!0,server:o})}function S(u){return b(this,arguments,function*({options:t,record:e,assets:o}){const f=Object.keys(o).filter(i=>/\.html$/.test(i));if(f.length){const i=yield y(t,e);f.forEach(d=>{var p,P;const v=(P=(p=o[d])==null?void 0:p.source)==null?void 0:P.call(p);if(typeof v=="string"){const g=v.replace("<head>",'<head><script type="module">\n'.concat(i,"\n<\/script>"));o[d]={source:()=>g,size:()=>g.length}}})}})}class E{constructor(e){this.options=e}apply(e){return b(this,null,function*(){var f,i,d,v,p,P,g,W,w,$,x,D;if(h=!0,this.options.close||!s.isDev(this.options.dev,((f=e==null?void 0:e.options)==null?void 0:f.mode)==="development"||process.env.NODE_ENV==="development"))return;const o={port:0,entry:"",output:this.options.output,inputs:A((i=e==null?void 0:e.options)==null?void 0:i.entry,(d=e==null?void 0:e.options)==null?void 0:d.context),envDir:(v=e==null?void 0:e.options)==null?void 0:v.context,root:(p=e==null?void 0:e.options)==null?void 0:p.context},u=((P=e==null?void 0:e.options)==null?void 0:P.cache)||((W=(g=e==null?void 0:e.options)==null?void 0:g.experiments)==null?void 0:W.cache);if((u==null?void 0:u.type)==="filesystem"&&(this.options.cache?(o.port=this.options.port||((w=s.getProjectRecord(o))==null?void 0:w.previousPort),y(this.options,o,!0)):u.version="code-inspector-".concat(Date.now())),a(C(j({},this.options),{record:o}),e),($=e==null?void 0:e.hooks)!=null&&$.emit&&!((D=(x=this.options.skipSnippets)==null?void 0:x.includes)!=null&&D.call(x,"htmlScript"))){const I=this.options;e.hooks.emit.tapAsync("WebpackCodeInspectorPlugin",(_,U)=>b(this,null,function*(){let T={};_.getAssets?T=yield _.getAssets():T=_.assets,yield S({options:I,record:o,assets:T}),U()}))}})}}return E});
1
+ (function(n,o){typeof exports=="object"&&typeof module!="undefined"?module.exports=o(require("@code-inspector/core"),require("path"),require("url")):typeof define=="function"&&define.amd?define(["@code-inspector/core","path","url"],o):(n=typeof globalThis!="undefined"?globalThis:n||self,n.WebpackCodeInspectorPlugin=o(n.core,n.path,n.url))})(this,function(n,o,i){"use strict";var O=Object.defineProperty,F=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var Q=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var S=(n,o,i)=>o in n?O(n,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[o]=i,y=(n,o)=>{for(var i in o||(o={}))Q.call(o,i)&&S(n,i,o[i]);if(I)for(var i of I(o))V.call(o,i)&&S(n,i,o[i]);return n},A=(n,o)=>F(n,H(o));var g=(n,o,i)=>new Promise((b,C)=>{var k=f=>{try{h(i.next(f))}catch(p){C(p)}},l=f=>{try{h(i.throw(f))}catch(p){C(p)}},h=f=>f.done?b(f.value):Promise.resolve(f.value).then(k,l);h((i=i.apply(n,o)).next())});var b=typeof document!="undefined"?document.currentScript:null;function C(s,e){return g(this,null,function*(){if(!s||!e)return[];const t=typeof s=="function"?yield s():s;let r=[];if(typeof t=="object"&&!Array.isArray(t))for(const u in t){const d=t[u],a=d.import||d;k(r,a,e)}else k(r,t,e);return r.filter(u=>!!u)})}function k(s,e,t){typeof e=="string"?s.push(l(e,t)):Array.isArray(e)&&s.push(...e.map(r=>l(r,t)))}function l(s,e){return o.isAbsolute(s)?n.normalizePath(s):s.startsWith(".")?o.resolve(e,n.normalizePath(s)):""}const h=o.dirname(i.fileURLToPath(typeof document=="undefined"&&typeof location=="undefined"?require("url").pathToFileURL(__filename).href:typeof document=="undefined"?location.href:b&&b.src||new URL("index.umd.js",document.baseURI).href)),f=o.resolve(h,"./loader.js"),p=o.resolve(h,"./inject-loader.js");function _(s){return s.some(e=>{var t,r;return(r=(t=e==null?void 0:e.use)==null?void 0:t.some)==null?void 0:r.call(t,u=>(u==null?void 0:u.loader)===f||(u==null?void 0:u.loader)===p)})}const q=(s,e)=>{var d,a;const t=(e==null?void 0:e.compiler)||e,r=(d=t==null?void 0:t.options)==null?void 0:d.module,u=(r==null?void 0:r.rules)||(r==null?void 0:r.loaders)||[];_(u)||u.push(y({test:(a=s.match)!=null?a:/\.html$/,resourceQuery:/vue/,use:[{loader:f,options:s}]},s.enforcePre===!1?{}:{enforce:"pre"}),y({test:/\.(vue|jsx|tsx|js|ts|mjs|mts|svelte)$/,use:[{loader:f,options:s}]},s.enforcePre===!1?{}:{enforce:"pre"}),A(y({},s.injectTo?{resource:s.injectTo}:{test:/\.(jsx|tsx|js|ts|mjs|mts)$/,exclude:/node_modules/}),{use:[{loader:p,options:s}],enforce:n.isNextjsProject()?"pre":"post"}))};function W(s,e,t){return n.getCodeWithWebComponent({options:A(y({},s),{importClient:"code"}),file:"main.js",code:"",record:e,inject:!0,server:t})}function E(r){return g(this,arguments,function*({options:s,record:e,assets:t}){const u=Object.keys(t).filter(d=>/\.html$/.test(d));if(u.length){const d=yield W(s,e);u.forEach(a=>{var c,v;const j=(v=(c=t[a])==null?void 0:c.source)==null?void 0:v.call(c);if(typeof j=="string"){const P=j.replace("<head>",'<head><script type="module">\n'.concat(d,"\n<\/script>"));t[a]={source:()=>P,size:()=>P.length}}})}})}class U{constructor(e){this.options=e}apply(e){return g(this,null,function*(){var u,d,a,j,c,v,P,w,R,$,x,D;if(this.options.close||!n.isDev(this.options.dev,((u=e==null?void 0:e.options)==null?void 0:u.mode)==="development"||process.env.NODE_ENV==="development"))return;const t={port:0,entry:"",output:this.options.output,inputs:C((d=e==null?void 0:e.options)==null?void 0:d.entry,(a=e==null?void 0:e.options)==null?void 0:a.context),envDir:(j=e==null?void 0:e.options)==null?void 0:j.context,root:(c=e==null?void 0:e.options)==null?void 0:c.context},r=((v=e==null?void 0:e.options)==null?void 0:v.cache)||((w=(P=e==null?void 0:e.options)==null?void 0:P.experiments)==null?void 0:w.cache);if((r==null?void 0:r.type)==="filesystem"&&(this.options.cache?(t.port=this.options.port||((R=n.getProjectRecord(t))==null?void 0:R.previousPort),W(this.options,t,!0)):r.version="code-inspector-".concat(Date.now())),q(A(y({},this.options),{record:t}),e),($=e==null?void 0:e.hooks)!=null&&$.emit&&!((D=(x=this.options.skipSnippets)==null?void 0:x.includes)!=null&&D.call(x,"htmlScript"))){const z=this.options;e.hooks.emit.tapAsync("WebpackCodeInspectorPlugin",(L,N)=>g(this,null,function*(){let T={};L.getAssets?T=yield L.getAssets():T=L.assets,yield E({options:z,record:t,assets:T}),N()}))}})}}return U});
package/dist/loader.js CHANGED
@@ -1 +1 @@
1
- "use strict";var T=(s,e,t)=>new Promise((r,p)=>{var o=i=>{try{c(t.next(i))}catch(n){p(n)}},u=i=>{try{c(t.throw(i))}catch(n){p(n)}},c=i=>i.done?r(i.value):Promise.resolve(i.value).then(o,u);c((t=t.apply(s,e)).next())});const a=require("@code-inspector/core"),x=["isJsx","isTsx","lang.jsx","lang.tsx"];function S(s){return T(this,null,function*(){var f,y,g;this.cacheable&&this.cacheable(!0);let e=a.normalizePath(this.resourcePath),t=new URLSearchParams(((f=this.resource.split("?"))==null?void 0:f[1])||"");const r=this.query;let{escapeTags:p=[],mappings:o}=r||{};if(a.isExcludedFile(e,r))return s;if(e=a.getMappingFilePath(e,o),a.isJsTypeFile(e)||e.endsWith(".vue")&&x.some(l=>t.get(l)!==null))return yield a.transformCode({content:s,filePath:e,fileType:"jsx",escapeTags:p,pathType:r.pathType});if(e.endsWith(".vue")&&(t.get("lang")==="tsx"||t.get("lang")==="jsx")){const{descriptor:l}=a.parseSFC(s,{sourceMap:!1}),d=[(y=l.script)==null?void 0:y.content,(g=l.scriptSetup)==null?void 0:g.content];for(const h of d){if(!h)continue;const m=yield a.transformCode({content:h,filePath:e,fileType:"jsx",escapeTags:p,pathType:r.pathType});s=s.replace(h,()=>m)}return s}const i=e.endsWith(".vue")&&t.get("type")!=="style"&&t.get("type")!=="script"&&t.get("raw")===null,n=e.endsWith(".html")&&t.get("type")==="template"&&t.has("vue");return i||n?yield a.transformCode({content:s,filePath:e,fileType:"vue",escapeTags:p,pathType:r.pathType}):e.endsWith(".svelte")?yield a.transformCode({content:s,filePath:e,fileType:"svelte",escapeTags:p,pathType:r.pathType}):s})}module.exports=S;
1
+ "use strict";var T=(s,e,t)=>new Promise((r,p)=>{var o=i=>{try{c(t.next(i))}catch(n){p(n)}},u=i=>{try{c(t.throw(i))}catch(n){p(n)}},c=i=>i.done?r(i.value):Promise.resolve(i.value).then(o,u);c((t=t.apply(s,e)).next())});const a=require("@code-inspector/core"),x=["isJsx","isTsx","lang.jsx","lang.tsx"];function S(s){return T(this,null,function*(){var f,y,g;this.cacheable&&this.cacheable(!0);let e=a.normalizePath(this.resourcePath),t=new URLSearchParams(((f=this.resource.split("?"))==null?void 0:f[1])||"");const r=this.query||{};let{escapeTags:p=[],mappings:o}=r;if(a.isExcludedFile(e,r))return s;if(e=a.getMappingFilePath(e,o),a.isJsTypeFile(e)||e.endsWith(".vue")&&x.some(l=>t.get(l)!==null))return yield a.transformCode({content:s,filePath:e,fileType:"jsx",escapeTags:p,pathType:r.pathType});if(e.endsWith(".vue")&&(t.get("lang")==="tsx"||t.get("lang")==="jsx")){const{descriptor:l}=a.parseSFC(s,{sourceMap:!1}),d=[(y=l.script)==null?void 0:y.content,(g=l.scriptSetup)==null?void 0:g.content];for(const h of d){if(!h)continue;const m=yield a.transformCode({content:h,filePath:e,fileType:"jsx",escapeTags:p,pathType:r.pathType});s=s.replace(h,()=>m)}return s}const i=e.endsWith(".vue")&&t.get("type")!=="style"&&t.get("type")!=="script"&&t.get("raw")===null,n=e.endsWith(".html")&&t.get("type")==="template"&&t.has("vue");return i||n?yield a.transformCode({content:s,filePath:e,fileType:"vue",escapeTags:p,pathType:r.pathType}):e.endsWith(".svelte")?yield a.transformCode({content:s,filePath:e,fileType:"svelte",escapeTags:p,pathType:r.pathType}):s})}module.exports=S;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-inspector/webpack",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "main": "./dist/index.umd.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./types/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "url": "https://github.com/zh-lx/code-inspector/issues"
41
41
  },
42
42
  "dependencies": {
43
- "@code-inspector/core": "1.4.4"
43
+ "@code-inspector/core": "1.4.6"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^20.3.3",