code-inspector-plugin 1.1.1 → 1.2.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 +1 -1
- package/dist/index.mjs +32 -192
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=Object.defineProperty,f=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var t=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var c=(e,r,n)=>r in e?a(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,i=(e,r)=>{for(var n in r||(r={}))p.call(r,n)&&c(e,n,r[n]);if(t)for(var n of t(r))g.call(r,n)&&c(e,n,r[n]);return e},l=(e,r)=>f(e,b(r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("@code-inspector/vite"),P=require("@code-inspector/webpack"),I=require("@code-inspector/esbuild"),k=require("@code-inspector/turbopack"),q=require("@code-inspector/mako"),o=require("@code-inspector/core"),C=require("chalk"),d=require("path");function s(e){if(!(e!=null&&e.bundler)){console.log(C.red("Please specify the bundler in the options of code-inspector-plugin."));return}let r=!1;e.needEnvInspector&&(r=!0,o.getEnvVariable("CODE_INSPECTOR",process.cwd())==="true"&&(r=!1));let n="";typeof __dirname!="undefined"?n=__dirname:n=d.dirname(o.fileURLToPath(typeof document=="undefined"?require("url").pathToFileURL(__filename).href:document.currentScript&&document.currentScript.src||new URL("index.js",document.baseURI).href));const u=l(i({},e),{close:r,output:d.resolve(n,"./")});return e.bundler==="webpack"||e.bundler==="rspack"?new P(u):e.bundler==="esbuild"?I.EsbuildCodeInspectorPlugin(u):e.bundler==="turbopack"?k.TurbopackCodeInspectorPlugin(u):e.bundler==="mako"?q.MakoCodeInspectorPlugin(u):m.ViteCodeInspectorPlugin(u)}const h=s;exports.CodeInspectorPlugin=s;exports.codeInspectorPlugin=h;
|
package/dist/index.mjs
CHANGED
|
@@ -1,204 +1,44 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var c = Object.defineProperty, d = Object.defineProperties;
|
|
2
|
+
var m = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var t = Object.getOwnPropertySymbols;
|
|
4
|
+
var f = Object.prototype.hasOwnProperty, a = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var o = (e, r, l) => r in e ? c(e, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[r] = l, u = (e, r) => {
|
|
6
|
+
for (var l in r || (r = {}))
|
|
7
|
+
f.call(r, l) && o(e, l, r[l]);
|
|
8
|
+
if (t)
|
|
9
|
+
for (var l of t(r))
|
|
10
|
+
a.call(r, l) && o(e, l, r[l]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
import { ViteCodeInspectorPlugin as
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
p(r.next(n));
|
|
23
|
-
} catch (o) {
|
|
24
|
-
l(o);
|
|
25
|
-
}
|
|
26
|
-
}, c = (n) => {
|
|
27
|
-
try {
|
|
28
|
-
p(r.throw(n));
|
|
29
|
-
} catch (o) {
|
|
30
|
-
l(o);
|
|
31
|
-
}
|
|
32
|
-
}, p = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(i, c);
|
|
33
|
-
p((r = r.apply(e, t)).next());
|
|
34
|
-
});
|
|
35
|
-
const q = "@code-inspector/esbuild";
|
|
36
|
-
function A(e) {
|
|
37
|
-
return {
|
|
38
|
-
name: q,
|
|
39
|
-
setup(t) {
|
|
40
|
-
if (e.close || !f(e.dev, !1))
|
|
41
|
-
return;
|
|
42
|
-
const r = {
|
|
43
|
-
port: 0,
|
|
44
|
-
entry: "",
|
|
45
|
-
output: e.output
|
|
46
|
-
}, { escapeTags: s = [] } = e, l = /* @__PURE__ */ new Map();
|
|
47
|
-
t.onLoad(
|
|
48
|
-
{ filter: e.match || /\.(jsx|tsx|js|ts|mjs|mts)?$/ },
|
|
49
|
-
(i) => U(this, null, function* () {
|
|
50
|
-
let c = i.path;
|
|
51
|
-
c = w(c, e.mappings);
|
|
52
|
-
let p = yield J.promises.readFile(c, "utf8"), n = l.get(c);
|
|
53
|
-
if (!n || n.originCode !== p) {
|
|
54
|
-
let o = p;
|
|
55
|
-
if (x(c, e))
|
|
56
|
-
return o;
|
|
57
|
-
o = yield O({
|
|
58
|
-
options: e,
|
|
59
|
-
file: c,
|
|
60
|
-
code: o,
|
|
61
|
-
record: r
|
|
62
|
-
});
|
|
63
|
-
let a = "";
|
|
64
|
-
if (k(c) ? a = "jsx" : c.endsWith(".svelte") && (a = "svelte"), a)
|
|
65
|
-
o = d({
|
|
66
|
-
content: o,
|
|
67
|
-
filePath: c,
|
|
68
|
-
fileType: a,
|
|
69
|
-
escapeTags: s,
|
|
70
|
-
pathType: e.pathType
|
|
71
|
-
});
|
|
72
|
-
else if (c.endsWith(".vue")) {
|
|
73
|
-
a = "vue";
|
|
74
|
-
const { descriptor: h } = M(o, {
|
|
75
|
-
sourceMap: !1
|
|
76
|
-
}), E = d({
|
|
77
|
-
content: h.template.content,
|
|
78
|
-
filePath: c,
|
|
79
|
-
fileType: a,
|
|
80
|
-
escapeTags: s,
|
|
81
|
-
pathType: e.pathType
|
|
82
|
-
});
|
|
83
|
-
o = o.replace(h.template.content, E);
|
|
84
|
-
}
|
|
85
|
-
const C = m.extname(c).replace(".", "");
|
|
86
|
-
n = { originCode: p, output: { contents: o, loader: C } }, l.set(c, n);
|
|
87
|
-
}
|
|
88
|
-
return n.output;
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
var B = Object.defineProperty, G = Object.defineProperties, H = Object.getOwnPropertyDescriptors, g = Object.getOwnPropertySymbols, K = Object.prototype.hasOwnProperty, Q = Object.prototype.propertyIsEnumerable, j = (e, t, r) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, u = (e, t) => {
|
|
95
|
-
for (var r in t || (t = {}))
|
|
96
|
-
K.call(t, r) && j(e, r, t[r]);
|
|
97
|
-
if (g)
|
|
98
|
-
for (var r of g(t))
|
|
99
|
-
Q.call(t, r) && j(e, r, t[r]);
|
|
100
|
-
return e;
|
|
101
|
-
}, T = (e, t) => G(e, H(t));
|
|
102
|
-
function X(e) {
|
|
103
|
-
const t = {
|
|
104
|
-
port: 0,
|
|
105
|
-
entry: "",
|
|
106
|
-
output: e.output
|
|
107
|
-
};
|
|
108
|
-
return e.close || !f(e.dev, process.env.NODE_ENV === "development") ? {} : {
|
|
109
|
-
"**/*.{jsx,tsx,js,ts,mjs,mts}": {
|
|
110
|
-
loaders: [
|
|
111
|
-
u({
|
|
112
|
-
loader: "@code-inspector/webpack/dist/loader.js",
|
|
113
|
-
options: T(u({}, e), {
|
|
114
|
-
record: t
|
|
115
|
-
})
|
|
116
|
-
}, e.enforcePre === !1 ? {} : { enforce: "pre" }),
|
|
117
|
-
{
|
|
118
|
-
loader: "@code-inspector/webpack/dist/inject-loader.js",
|
|
119
|
-
options: T(u({}, e), {
|
|
120
|
-
record: t
|
|
121
|
-
}),
|
|
122
|
-
enforce: "pre"
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
var Y = (e, t, r) => new Promise((s, l) => {
|
|
129
|
-
var i = (n) => {
|
|
130
|
-
try {
|
|
131
|
-
p(r.next(n));
|
|
132
|
-
} catch (o) {
|
|
133
|
-
l(o);
|
|
134
|
-
}
|
|
135
|
-
}, c = (n) => {
|
|
136
|
-
try {
|
|
137
|
-
p(r.throw(n));
|
|
138
|
-
} catch (o) {
|
|
139
|
-
l(o);
|
|
140
|
-
}
|
|
141
|
-
}, p = (n) => n.done ? s(n.value) : Promise.resolve(n.value).then(i, c);
|
|
142
|
-
p((r = r.apply(e, t)).next());
|
|
143
|
-
});
|
|
144
|
-
function Z(e) {
|
|
145
|
-
const t = {
|
|
146
|
-
port: 0,
|
|
147
|
-
entry: "",
|
|
148
|
-
output: e.output
|
|
149
|
-
};
|
|
150
|
-
return e.close || !f(e.dev, process.env.NODE_ENV === "development") ? {
|
|
151
|
-
name: "@code-inspector/mako"
|
|
152
|
-
} : {
|
|
153
|
-
name: "@code-inspector/mako",
|
|
154
|
-
enforce: e.enforcePre === !1 ? "post" : "pre",
|
|
155
|
-
transform: (r, s) => Y(this, null, function* () {
|
|
156
|
-
if (x(s, e) || s.includes("/.umi/"))
|
|
157
|
-
return;
|
|
158
|
-
const { escapeTags: l = [], mappings: i, match: c } = e || {};
|
|
159
|
-
if (c && !c.test(s))
|
|
160
|
-
return;
|
|
161
|
-
const p = yield O({
|
|
162
|
-
options: e,
|
|
163
|
-
file: s,
|
|
164
|
-
code: r,
|
|
165
|
-
record: t
|
|
166
|
-
});
|
|
167
|
-
if (k(s)) {
|
|
168
|
-
const n = m.extname(s).slice(1);
|
|
169
|
-
let o = S(s);
|
|
170
|
-
return o = w(o, i), { content: d({
|
|
171
|
-
content: p,
|
|
172
|
-
filePath: o,
|
|
173
|
-
fileType: "jsx",
|
|
174
|
-
escapeTags: l,
|
|
175
|
-
pathType: e.pathType
|
|
176
|
-
}), type: n };
|
|
177
|
-
}
|
|
178
|
-
})
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
function ee(e) {
|
|
12
|
+
}, i = (e, r) => d(e, m(r));
|
|
13
|
+
import { ViteCodeInspectorPlugin as p } from "@code-inspector/vite";
|
|
14
|
+
import s from "@code-inspector/webpack";
|
|
15
|
+
import { EsbuildCodeInspectorPlugin as b } from "@code-inspector/esbuild";
|
|
16
|
+
import { TurbopackCodeInspectorPlugin as g } from "@code-inspector/turbopack";
|
|
17
|
+
import { MakoCodeInspectorPlugin as P } from "@code-inspector/mako";
|
|
18
|
+
import { getEnvVariable as I, fileURLToPath as k } from "@code-inspector/core";
|
|
19
|
+
import C from "chalk";
|
|
20
|
+
import h, { dirname as E } from "path";
|
|
21
|
+
function _(e) {
|
|
182
22
|
if (!(e != null && e.bundler)) {
|
|
183
23
|
console.log(
|
|
184
|
-
|
|
24
|
+
C.red(
|
|
185
25
|
"Please specify the bundler in the options of code-inspector-plugin."
|
|
186
26
|
)
|
|
187
27
|
);
|
|
188
28
|
return;
|
|
189
29
|
}
|
|
190
|
-
let
|
|
191
|
-
e.needEnvInspector && (
|
|
192
|
-
let
|
|
193
|
-
typeof __dirname != "undefined" ?
|
|
194
|
-
const
|
|
195
|
-
close:
|
|
196
|
-
output:
|
|
30
|
+
let r = !1;
|
|
31
|
+
e.needEnvInspector && (r = !0, I("CODE_INSPECTOR", process.cwd()) === "true" && (r = !1));
|
|
32
|
+
let l = "";
|
|
33
|
+
typeof __dirname != "undefined" ? l = __dirname : l = E(k(import.meta.url));
|
|
34
|
+
const n = i(u({}, e), {
|
|
35
|
+
close: r,
|
|
36
|
+
output: h.resolve(l, "./")
|
|
197
37
|
});
|
|
198
|
-
return e.bundler === "webpack" || e.bundler === "rspack" ? new
|
|
38
|
+
return e.bundler === "webpack" || e.bundler === "rspack" ? new s(n) : e.bundler === "esbuild" ? b(n) : e.bundler === "turbopack" ? g(n) : e.bundler === "mako" ? P(n) : p(n);
|
|
199
39
|
}
|
|
200
|
-
const
|
|
40
|
+
const L = _;
|
|
201
41
|
export {
|
|
202
|
-
|
|
203
|
-
|
|
42
|
+
_ as CodeInspectorPlugin,
|
|
43
|
+
L as codeInspectorPlugin
|
|
204
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-inspector-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"chalk": "4.1.1",
|
|
50
|
-
"@code-inspector/core": "1.
|
|
51
|
-
"@code-inspector/vite": "1.
|
|
52
|
-
"@code-inspector/esbuild": "1.
|
|
53
|
-
"@code-inspector/webpack": "1.
|
|
54
|
-
"@code-inspector/
|
|
55
|
-
"@code-inspector/
|
|
50
|
+
"@code-inspector/core": "1.2.0",
|
|
51
|
+
"@code-inspector/vite": "1.2.0",
|
|
52
|
+
"@code-inspector/esbuild": "1.2.0",
|
|
53
|
+
"@code-inspector/webpack": "1.2.0",
|
|
54
|
+
"@code-inspector/mako": "1.2.0",
|
|
55
|
+
"@code-inspector/turbopack": "1.2.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^16.0.1",
|