🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@code-inspector/webpack

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-inspector/webpack - npm Package Compare versions

Comparing version
1.4.5
to
1.4.6
+111
-104
dist/index.mjs

@@ -1,85 +0,92 @@

var L = Object.defineProperty, N = Object.defineProperties;
var O = Object.getOwnPropertyDescriptors;
var C = Object.getOwnPropertySymbols;
var N = Object.defineProperty, O = Object.defineProperties;
var R = Object.getOwnPropertyDescriptors;
var x = Object.getOwnPropertySymbols;
var S = Object.prototype.hasOwnProperty, z = Object.prototype.propertyIsEnumerable;
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) => {
for (var e in t || (t = {}))
S.call(t, e) && W(s, e, t[e]);
if (C)
for (var e of C(t))
z.call(t, e) && W(s, e, t[e]);
return s;
}, v = (s, t) => N(s, O(t));
var c = (s, t, e) => new Promise((n, a) => {
var r = (o) => {
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) => {
for (var s in t || (t = {}))
S.call(t, s) && W(e, s, t[s]);
if (x)
for (var s of x(t))
z.call(t, s) && W(e, s, t[s]);
return e;
}, y = (e, t) => O(e, R(t));
var h = (e, t, s) => new Promise((o, n) => {
var a = (r) => {
try {
i(e.next(o));
} catch (f) {
a(f);
f(s.next(r));
} catch (i) {
n(i);
}
}, u = (o) => {
}, u = (r) => {
try {
i(e.throw(o));
} catch (f) {
a(f);
f(s.throw(r));
} catch (i) {
n(i);
}
}, i = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(r, u);
i((e = e.apply(s, t)).next());
}, f = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(a, u);
f((s = s.apply(e, t)).next());
});
import { normalizePath as _, fileURLToPath as I, isDev as R, getProjectRecord as F, isNextjsProject as H, getCodeWithWebComponent as Q } from "@code-inspector/core";
import j, { dirname as U } from "path";
function V(s, t) {
return c(this, null, function* () {
if (!s || !t)
import { normalizePath as $, isDev as _, getProjectRecord as H, isNextjsProject as Q, getCodeWithWebComponent as U } from "@code-inspector/core";
import j from "path";
import { fileURLToPath as V } from "url";
function q(e, t) {
return h(this, null, function* () {
if (!e || !t)
return [];
const e = typeof s == "function" ? yield s() : s;
let n = [];
if (typeof e == "object" && !Array.isArray(e))
for (const a in e) {
const r = e[a], u = r.import || r;
$(n, u, t);
const s = typeof e == "function" ? yield e() : e;
let o = [];
if (typeof s == "object" && !Array.isArray(s))
for (const n in s) {
const a = s[n], u = a.import || a;
w(o, u, t);
}
else
$(n, e, t);
return n.filter((a) => !!a);
w(o, s, t);
return o.filter((n) => !!n);
});
}
function $(s, t, e) {
typeof t == "string" ? s.push(w(t, e)) : Array.isArray(t) && s.push(
...t.map((n) => w(n, e))
function w(e, t, s) {
typeof t == "string" ? e.push(D(t, s)) : Array.isArray(t) && e.push(
...t.map((o) => D(o, s))
);
}
function w(s, t) {
return j.isAbsolute(s) ? _(s) : s.startsWith(".") ? j.resolve(t, _(s)) : "";
function D(e, t) {
return j.isAbsolute(e) ? $(e) : e.startsWith(".") ? j.resolve(t, $(e)) : "";
}
let p = "";
typeof __dirname != "undefined" ? p = __dirname : p = U(I(import.meta.url));
let P = !0;
const q = (s, t) => {
var r, u;
if (!P)
return;
P = !1;
const e = (t == null ? void 0 : t.compiler) || t, n = (r = e == null ? void 0 : e.options) == null ? void 0 : r.module;
((n == null ? void 0 : n.rules) || (n == null ? void 0 : n.loaders) || []).push(
d({
test: (u = s.match) != null ? u : /\.html$/,
const L = j.dirname(V(import.meta.url)), P = j.resolve(L, "./loader.js"), E = j.resolve(L, "./inject-loader.js");
function B(e) {
return e.some(
(t) => {
var s, o;
return (o = (s = t == null ? void 0 : t.use) == null ? void 0 : s.some) == null ? void 0 : o.call(
s,
(n) => (n == null ? void 0 : n.loader) === P || (n == null ? void 0 : n.loader) === E
);
}
);
}
const F = (e, t) => {
var a, u;
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) || [];
B(n) || n.push(
c({
test: (u = e.match) != null ? u : /\.html$/,
resourceQuery: /vue/,
use: [
{
loader: j.resolve(p, "./loader.js"),
options: s
loader: P,
options: e
}
]
}, s.enforcePre === !1 ? {} : { enforce: "pre" }),
d({
}, e.enforcePre === !1 ? {} : { enforce: "pre" }),
c({
test: /\.(vue|jsx|tsx|js|ts|mjs|mts|svelte)$/,
use: [
{
loader: j.resolve(p, "./loader.js"),
options: s
loader: P,
options: e
}
]
}, s.enforcePre === !1 ? {} : { enforce: "pre" }),
v(d({}, s.injectTo ? { resource: s.injectTo } : {
}, e.enforcePre === !1 ? {} : { enforce: "pre" }),
y(c({}, e.injectTo ? { resource: e.injectTo } : {
test: /\.(jsx|tsx|js|ts|mjs|mts)$/,

@@ -90,13 +97,13 @@ exclude: /node_modules/

{
loader: j.resolve(p, "./inject-loader.js"),
options: s
loader: E,
options: e
}
],
enforce: H() ? "pre" : "post"
enforce: Q() ? "pre" : "post"
})
);
};
function D(s, t, e) {
return Q({
options: v(d({}, s), { importClient: "code" }),
function T(e, t, s) {
return U({
options: y(c({}, e), { importClient: "code" }),
file: "main.js",

@@ -106,25 +113,25 @@ code: "",

inject: !0,
server: e
server: s
});
}
function B(n) {
return c(this, arguments, function* ({
options: s,
function G(o) {
return h(this, arguments, function* ({
options: e,
record: t,
assets: e
assets: s
}) {
const a = Object.keys(e).filter((r) => /\.html$/.test(r));
if (a.length) {
const r = yield D(s, t);
a.forEach((u) => {
var o, f;
const i = (f = (o = e[u]) == null ? void 0 : o.source) == null ? void 0 : f.call(o);
if (typeof i == "string") {
const h = i.replace(
const n = Object.keys(s).filter((a) => /\.html$/.test(a));
if (n.length) {
const a = yield T(e, t);
n.forEach((u) => {
var r, i;
const f = (i = (r = s[u]) == null ? void 0 : r.source) == null ? void 0 : i.call(r);
if (typeof f == "string") {
const d = f.replace(
"<head>",
'<head><script type="module">\n'.concat(r, "\n<\/script>")
'<head><script type="module">\n'.concat(a, "\n<\/script>")
);
e[u] = {
source: () => h,
size: () => h.length
s[u] = {
source: () => d,
size: () => d.length
};

@@ -136,3 +143,3 @@ }

}
class M {
class Y {
constructor(t) {

@@ -142,31 +149,31 @@ this.options = t;

apply(t) {
return c(this, null, function* () {
var a, r, u, i, o, f, h, b, k, A, y, x;
if (P = !0, this.options.close || !R(
return h(this, null, function* () {
var n, a, u, f, r, i, d, b, k, A, p, C;
if (this.options.close || !_(
this.options.dev,
((a = t == null ? void 0 : t.options) == null ? void 0 : a.mode) === "development" || process.env.NODE_ENV === "development"
((n = t == null ? void 0 : t.options) == null ? void 0 : n.mode) === "development" || process.env.NODE_ENV === "development"
))
return;
const e = {
const s = {
port: 0,
entry: "",
output: this.options.output,
inputs: V(
(r = t == null ? void 0 : t.options) == null ? void 0 : r.entry,
inputs: q(
(a = t == null ? void 0 : t.options) == null ? void 0 : a.entry,
(u = t == null ? void 0 : t.options) == null ? void 0 : u.context
),
envDir: (i = t == null ? void 0 : t.options) == null ? void 0 : i.context,
root: (o = t == null ? void 0 : t.options) == null ? void 0 : o.context
}, 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);
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"))) {
const E = this.options;
envDir: (f = t == null ? void 0 : t.options) == null ? void 0 : f.context,
root: (r = t == null ? void 0 : t.options) == null ? void 0 : r.context
}, 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);
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"))) {
const l = this.options;
t.hooks.emit.tapAsync(
"WebpackCodeInspectorPlugin",
(g, T) => c(this, null, function* () {
let l = {};
g.getAssets ? l = yield g.getAssets() : l = g.assets, yield B({
options: E,
record: e,
assets: l
}), T();
(v, I) => h(this, null, function* () {
let g = {};
v.getAssets ? g = yield v.getAssets() : g = v.assets, yield G({
options: l,
record: s,
assets: g
}), I();
})

@@ -179,3 +186,3 @@ );

export {
M as default
Y as default
};

@@ -1,1 +0,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});
(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});

@@ -1,1 +0,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;
"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;
{
"name": "@code-inspector/webpack",
"version": "1.4.5",
"version": "1.4.6",
"main": "./dist/index.umd.js",

@@ -43,3 +43,3 @@ "module": "./dist/index.mjs",

"dependencies": {
"@code-inspector/core": "1.4.5"
"@code-inspector/core": "1.4.6"
},

@@ -46,0 +46,0 @@ "devDependencies": {