code-inspector-plugin 0.16.2 → 0.17.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/LICENSE +21 -21
- package/README.md +344 -344
- package/dist/index.js +1 -1
- package/dist/index.mjs +207 -242
- package/package.json +5 -5
- package/types/index.d.ts +15 -15
package/dist/index.mjs
CHANGED
|
@@ -1,122 +1,128 @@
|
|
|
1
|
-
var
|
|
1
|
+
var V = Object.defineProperty, k = Object.defineProperties;
|
|
2
2
|
var P = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
C.call(t,
|
|
3
|
+
var E = Object.getOwnPropertySymbols;
|
|
4
|
+
var x = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var _ = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t) => {
|
|
6
|
+
for (var n in t || (t = {}))
|
|
7
|
+
x.call(t, n) && _(e, n, t[n]);
|
|
8
|
+
if (E)
|
|
9
|
+
for (var n of E(t))
|
|
10
|
+
C.call(t, n) && _(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
12
|
+
}, w = (e, t) => k(e, P(t));
|
|
13
13
|
import { ViteCodeInspectorPlugin as R } from "vite-code-inspector-plugin";
|
|
14
|
-
import
|
|
15
|
-
import { getCodeWithWebComponent as
|
|
14
|
+
import K from "webpack-code-inspector-plugin";
|
|
15
|
+
import { isDev as L, getCodeWithWebComponent as S, isJsTypeFile as A, parseSFC as F, transformCode as D, fileURLToPath as Y } from "code-inspector-core";
|
|
16
16
|
import f from "fs";
|
|
17
17
|
import v, { dirname as M } from "path";
|
|
18
|
-
import
|
|
19
|
-
var
|
|
20
|
-
var
|
|
18
|
+
import B from "chalk";
|
|
19
|
+
var W = (e, t, n) => new Promise((s, c) => {
|
|
20
|
+
var r = (a) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
i(n.next(a));
|
|
23
23
|
} catch (u) {
|
|
24
|
-
|
|
24
|
+
c(u);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
26
|
+
}, o = (a) => {
|
|
27
27
|
try {
|
|
28
|
-
|
|
28
|
+
i(n.throw(a));
|
|
29
29
|
} catch (u) {
|
|
30
|
-
|
|
30
|
+
c(u);
|
|
31
31
|
}
|
|
32
|
-
},
|
|
33
|
-
|
|
32
|
+
}, i = (a) => a.done ? s(a.value) : Promise.resolve(a.value).then(r, o);
|
|
33
|
+
i((n = n.apply(e, t)).next());
|
|
34
34
|
});
|
|
35
|
-
const
|
|
36
|
-
function J(e) {
|
|
37
|
-
let t;
|
|
38
|
-
return typeof e == "function" ? t = e() : t = e, !!t;
|
|
39
|
-
}
|
|
35
|
+
const U = "esbuild-code-inspector-plugin";
|
|
40
36
|
function q(e) {
|
|
41
37
|
return {
|
|
42
|
-
name:
|
|
38
|
+
name: U,
|
|
43
39
|
setup(t) {
|
|
44
|
-
if (e.close || !
|
|
40
|
+
if (e.close || !L(e.dev, !1))
|
|
45
41
|
return;
|
|
46
|
-
const
|
|
42
|
+
const n = {
|
|
47
43
|
port: 0,
|
|
48
44
|
entry: "",
|
|
49
45
|
output: e.output
|
|
50
|
-
}, { escapeTags: s = [] } = e,
|
|
46
|
+
}, { escapeTags: s = [] } = e, c = /* @__PURE__ */ new Map();
|
|
51
47
|
t.onLoad(
|
|
52
48
|
{ filter: e.match || /\.(jsx|tsx|js|ts|mjs|mts)?$/ },
|
|
53
|
-
(
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
if (!
|
|
57
|
-
let u = yield
|
|
49
|
+
(r) => W(this, null, function* () {
|
|
50
|
+
const o = r.path;
|
|
51
|
+
let i = yield f.promises.readFile(o, "utf8"), a = c.get(o);
|
|
52
|
+
if (!a || a.originCode !== i) {
|
|
53
|
+
let u = yield S(
|
|
58
54
|
e,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
o,
|
|
56
|
+
i,
|
|
57
|
+
n
|
|
62
58
|
), p = "";
|
|
63
|
-
if (
|
|
64
|
-
u =
|
|
59
|
+
if (A(o) ? p = "jsx" : o.endsWith(".svelte") && (p = "svelte"), p)
|
|
60
|
+
u = D({
|
|
65
61
|
content: u,
|
|
66
|
-
filePath:
|
|
62
|
+
filePath: o,
|
|
67
63
|
fileType: p,
|
|
68
64
|
escapeTags: s
|
|
69
65
|
});
|
|
70
|
-
else if (
|
|
66
|
+
else if (o.endsWith(".vue")) {
|
|
71
67
|
p = "vue";
|
|
72
|
-
const { descriptor:
|
|
68
|
+
const { descriptor: y } = F(u, {
|
|
73
69
|
sourceMap: !1
|
|
74
|
-
}), $ =
|
|
75
|
-
content:
|
|
76
|
-
filePath:
|
|
70
|
+
}), $ = D({
|
|
71
|
+
content: y.template.content,
|
|
72
|
+
filePath: o,
|
|
77
73
|
fileType: p,
|
|
78
74
|
escapeTags: s
|
|
79
75
|
});
|
|
80
|
-
u = u.replace(
|
|
76
|
+
u = u.replace(y.template.content, $);
|
|
81
77
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
78
|
+
const I = v.extname(o).replace(".", "");
|
|
79
|
+
a = { originCode: i, output: { contents: u, loader: I } }, c.set(o, a);
|
|
84
80
|
}
|
|
85
|
-
return
|
|
81
|
+
return a.output;
|
|
86
82
|
})
|
|
87
83
|
);
|
|
88
84
|
}
|
|
89
85
|
};
|
|
90
86
|
}
|
|
91
|
-
function
|
|
92
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
93
|
-
}
|
|
94
|
-
function Q(e) {
|
|
87
|
+
function J(e) {
|
|
95
88
|
if (e.__esModule)
|
|
96
89
|
return e;
|
|
97
90
|
var t = e.default;
|
|
98
91
|
if (typeof t == "function") {
|
|
99
|
-
var
|
|
100
|
-
|
|
92
|
+
var n = function s() {
|
|
93
|
+
if (this instanceof s) {
|
|
94
|
+
var c = [null];
|
|
95
|
+
c.push.apply(c, arguments);
|
|
96
|
+
var r = Function.bind.apply(t, c);
|
|
97
|
+
return new r();
|
|
98
|
+
}
|
|
99
|
+
return t.apply(this, arguments);
|
|
101
100
|
};
|
|
102
|
-
|
|
101
|
+
n.prototype = t.prototype;
|
|
103
102
|
} else
|
|
104
|
-
|
|
105
|
-
return Object.defineProperty(
|
|
106
|
-
var
|
|
107
|
-
Object.defineProperty(
|
|
103
|
+
n = {};
|
|
104
|
+
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(s) {
|
|
105
|
+
var c = Object.getOwnPropertyDescriptor(e, s);
|
|
106
|
+
Object.defineProperty(n, s, c.get ? c : {
|
|
108
107
|
enumerable: !0,
|
|
109
108
|
get: function() {
|
|
110
109
|
return e[s];
|
|
111
110
|
}
|
|
112
111
|
});
|
|
113
|
-
}),
|
|
112
|
+
}), n;
|
|
114
113
|
}
|
|
115
|
-
var d = {
|
|
116
|
-
|
|
114
|
+
var d = {}, G = {
|
|
115
|
+
get exports() {
|
|
116
|
+
return d;
|
|
117
|
+
},
|
|
118
|
+
set exports(e) {
|
|
119
|
+
d = e;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const Q = {}, z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
117
123
|
__proto__: null,
|
|
118
|
-
default:
|
|
119
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
124
|
+
default: Q
|
|
125
|
+
}, Symbol.toStringTag, { value: "Module" })), O = /* @__PURE__ */ J(z), H = "dotenv", X = "16.3.1", Z = "Loads environment variables from .env file", ee = "lib/main.js", te = "lib/main.d.ts", ne = {
|
|
120
126
|
".": {
|
|
121
127
|
types: "./lib/main.d.ts",
|
|
122
128
|
require: "./lib/main.js",
|
|
@@ -129,19 +135,18 @@ const z = {}, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
129
135
|
"./lib/cli-options": "./lib/cli-options.js",
|
|
130
136
|
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
131
137
|
"./package.json": "./package.json"
|
|
132
|
-
},
|
|
138
|
+
}, re = {
|
|
133
139
|
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
134
140
|
lint: "standard",
|
|
135
141
|
"lint-readme": "standard-markdown",
|
|
136
142
|
pretest: "npm run lint && npm run dts-check",
|
|
137
143
|
test: "tap tests/*.js --100 -Rspec",
|
|
138
|
-
"test:coverage": "tap --coverage-report=lcov",
|
|
139
144
|
prerelease: "npm test",
|
|
140
145
|
release: "standard-version"
|
|
141
|
-
},
|
|
146
|
+
}, oe = {
|
|
142
147
|
type: "git",
|
|
143
148
|
url: "git://github.com/motdotla/dotenv.git"
|
|
144
|
-
},
|
|
149
|
+
}, se = "https://github.com/motdotla/dotenv?sponsor=1", ce = [
|
|
145
150
|
"dotenv",
|
|
146
151
|
"env",
|
|
147
152
|
".env",
|
|
@@ -149,7 +154,7 @@ const z = {}, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
149
154
|
"variables",
|
|
150
155
|
"config",
|
|
151
156
|
"settings"
|
|
152
|
-
], ie = "README.md",
|
|
157
|
+
], ie = "README.md", ae = "BSD-2-Clause", le = {
|
|
153
158
|
"@definitelytyped/dtslint": "^0.0.133",
|
|
154
159
|
"@types/node": "^18.11.3",
|
|
155
160
|
decache: "^4.6.1",
|
|
@@ -160,205 +165,165 @@ const z = {}, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
160
165
|
tap: "^16.3.0",
|
|
161
166
|
tar: "^6.1.11",
|
|
162
167
|
typescript: "^4.8.4"
|
|
163
|
-
},
|
|
168
|
+
}, ue = {
|
|
164
169
|
node: ">=12"
|
|
165
|
-
},
|
|
170
|
+
}, pe = {
|
|
166
171
|
fs: !1
|
|
167
|
-
},
|
|
168
|
-
name:
|
|
169
|
-
version:
|
|
170
|
-
description:
|
|
171
|
-
main:
|
|
172
|
-
types:
|
|
172
|
+
}, de = {
|
|
173
|
+
name: H,
|
|
174
|
+
version: X,
|
|
175
|
+
description: Z,
|
|
176
|
+
main: ee,
|
|
177
|
+
types: te,
|
|
173
178
|
exports: ne,
|
|
174
|
-
scripts:
|
|
175
|
-
repository:
|
|
176
|
-
funding:
|
|
177
|
-
keywords:
|
|
179
|
+
scripts: re,
|
|
180
|
+
repository: oe,
|
|
181
|
+
funding: se,
|
|
182
|
+
keywords: ce,
|
|
178
183
|
readmeFilename: ie,
|
|
179
|
-
license:
|
|
180
|
-
devDependencies:
|
|
181
|
-
engines:
|
|
182
|
-
browser:
|
|
183
|
-
},
|
|
184
|
-
function
|
|
184
|
+
license: ae,
|
|
185
|
+
devDependencies: le,
|
|
186
|
+
engines: ue,
|
|
187
|
+
browser: pe
|
|
188
|
+
}, T = f, m = v, fe = O, ve = O, ge = de, h = ge.version, me = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
189
|
+
function he(e) {
|
|
185
190
|
const t = {};
|
|
186
|
-
let
|
|
187
|
-
|
|
191
|
+
let n = e.toString();
|
|
192
|
+
n = n.replace(/\r\n?/mg, "\n");
|
|
188
193
|
let s;
|
|
189
|
-
for (; (s =
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
194
|
+
for (; (s = me.exec(n)) != null; ) {
|
|
195
|
+
const c = s[1];
|
|
196
|
+
let r = s[2] || "";
|
|
197
|
+
r = r.trim();
|
|
198
|
+
const o = r[0];
|
|
199
|
+
r = r.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), o === '"' && (r = r.replace(/\\n/g, "\n"), r = r.replace(/\\r/g, "\r")), t[c] = r;
|
|
195
200
|
}
|
|
196
201
|
return t;
|
|
197
202
|
}
|
|
198
|
-
function
|
|
199
|
-
const t =
|
|
200
|
-
if (!
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
let o;
|
|
206
|
-
for (let n = 0; n < a; n++)
|
|
203
|
+
function ye(e) {
|
|
204
|
+
const t = j(e), n = l.configDotenv({ path: t });
|
|
205
|
+
if (!n.parsed)
|
|
206
|
+
throw new Error("MISSING_DATA: Cannot parse ".concat(t, " for an unknown reason"));
|
|
207
|
+
const s = N(e).split(","), c = s.length;
|
|
208
|
+
let r;
|
|
209
|
+
for (let o = 0; o < c; o++)
|
|
207
210
|
try {
|
|
208
|
-
const
|
|
209
|
-
|
|
211
|
+
const i = s[o].trim(), a = be(n, i);
|
|
212
|
+
r = l.decrypt(a.ciphertext, a.key);
|
|
210
213
|
break;
|
|
211
|
-
} catch (
|
|
212
|
-
if (
|
|
213
|
-
throw
|
|
214
|
+
} catch (i) {
|
|
215
|
+
if (o + 1 >= c)
|
|
216
|
+
throw i;
|
|
214
217
|
}
|
|
215
|
-
return l.parse(
|
|
218
|
+
return l.parse(r);
|
|
216
219
|
}
|
|
217
|
-
function
|
|
218
|
-
console.log("[dotenv@".concat(
|
|
220
|
+
function Ee(e) {
|
|
221
|
+
console.log("[dotenv@".concat(h, "][INFO] ").concat(e));
|
|
219
222
|
}
|
|
220
|
-
function
|
|
221
|
-
console.log("[dotenv@".concat(
|
|
223
|
+
function _e(e) {
|
|
224
|
+
console.log("[dotenv@".concat(h, "][WARN] ").concat(e));
|
|
222
225
|
}
|
|
223
226
|
function g(e) {
|
|
224
|
-
console.log("[dotenv@".concat(
|
|
227
|
+
console.log("[dotenv@".concat(h, "][DEBUG] ").concat(e));
|
|
225
228
|
}
|
|
226
|
-
function
|
|
229
|
+
function N(e) {
|
|
227
230
|
return e && e.DOTENV_KEY && e.DOTENV_KEY.length > 0 ? e.DOTENV_KEY : process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0 ? process.env.DOTENV_KEY : "";
|
|
228
231
|
}
|
|
229
|
-
function
|
|
230
|
-
let
|
|
232
|
+
function be(e, t) {
|
|
233
|
+
let n;
|
|
231
234
|
try {
|
|
232
|
-
|
|
233
|
-
} catch (
|
|
234
|
-
|
|
235
|
-
const i = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
236
|
-
throw i.code = "INVALID_DOTENV_KEY", i;
|
|
237
|
-
}
|
|
238
|
-
throw c;
|
|
239
|
-
}
|
|
240
|
-
const s = r.password;
|
|
241
|
-
if (!s) {
|
|
242
|
-
const c = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
243
|
-
throw c.code = "INVALID_DOTENV_KEY", c;
|
|
235
|
+
n = new URL(t);
|
|
236
|
+
} catch (i) {
|
|
237
|
+
throw i.code === "ERR_INVALID_URL" ? new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development") : i;
|
|
244
238
|
}
|
|
245
|
-
const
|
|
246
|
-
if (!
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
throw
|
|
254
|
-
}
|
|
255
|
-
return { ciphertext: n, key: s };
|
|
239
|
+
const s = n.password;
|
|
240
|
+
if (!s)
|
|
241
|
+
throw new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
242
|
+
const c = n.searchParams.get("environment");
|
|
243
|
+
if (!c)
|
|
244
|
+
throw new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
245
|
+
const r = "DOTENV_VAULT_".concat(c.toUpperCase()), o = e.parsed[r];
|
|
246
|
+
if (!o)
|
|
247
|
+
throw new Error("NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ".concat(r, " in your .env.vault file."));
|
|
248
|
+
return { ciphertext: o, key: s };
|
|
256
249
|
}
|
|
257
|
-
function
|
|
258
|
-
let t =
|
|
259
|
-
|
|
260
|
-
if (Array.isArray(e.path))
|
|
261
|
-
for (const r of e.path)
|
|
262
|
-
m.existsSync(r) && (t = r.endsWith(".vault") ? r : "".concat(r, ".vault"));
|
|
263
|
-
else
|
|
264
|
-
t = e.path.endsWith(".vault") ? e.path : "".concat(e.path, ".vault");
|
|
265
|
-
else
|
|
266
|
-
t = h.resolve(process.cwd(), ".env.vault");
|
|
267
|
-
return m.existsSync(t) ? t : null;
|
|
250
|
+
function j(e) {
|
|
251
|
+
let t = m.resolve(process.cwd(), ".env");
|
|
252
|
+
return e && e.path && e.path.length > 0 && (t = e.path), t.endsWith(".vault") ? t : "".concat(t, ".vault");
|
|
268
253
|
}
|
|
269
|
-
function
|
|
270
|
-
return e[0] === "~" ?
|
|
254
|
+
function we(e) {
|
|
255
|
+
return e[0] === "~" ? m.join(fe.homedir(), e.slice(1)) : e;
|
|
271
256
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
257
|
+
function De(e) {
|
|
258
|
+
Ee("Loading env from encrypted .env.vault");
|
|
274
259
|
const t = l._parseVault(e);
|
|
275
|
-
let
|
|
276
|
-
return e && e.processEnv != null && (
|
|
260
|
+
let n = process.env;
|
|
261
|
+
return e && e.processEnv != null && (n = e.processEnv), l.populate(n, t, e), { parsed: t };
|
|
277
262
|
}
|
|
278
|
-
function
|
|
279
|
-
|
|
280
|
-
let r = "utf8";
|
|
263
|
+
function Oe(e) {
|
|
264
|
+
let t = m.resolve(process.cwd(), ".env"), n = "utf8";
|
|
281
265
|
const s = !!(e && e.debug);
|
|
282
|
-
e && e.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
a.push(O(i));
|
|
291
|
-
}
|
|
292
|
-
let o;
|
|
293
|
-
const n = {};
|
|
294
|
-
for (const i of a)
|
|
295
|
-
try {
|
|
296
|
-
const u = l.parse(m.readFileSync(i, { encoding: r }));
|
|
297
|
-
l.populate(n, u, e);
|
|
298
|
-
} catch (u) {
|
|
299
|
-
s && g("Failed to load ".concat(i, " ").concat(u.message)), o = u;
|
|
300
|
-
}
|
|
301
|
-
let c = process.env;
|
|
302
|
-
return e && e.processEnv != null && (c = e.processEnv), l.populate(c, n, e), o ? { parsed: n, error: o } : { parsed: n };
|
|
266
|
+
e && (e.path != null && (t = we(e.path)), e.encoding != null && (n = e.encoding));
|
|
267
|
+
try {
|
|
268
|
+
const c = l.parse(T.readFileSync(t, { encoding: n }));
|
|
269
|
+
let r = process.env;
|
|
270
|
+
return e && e.processEnv != null && (r = e.processEnv), l.populate(r, c, e), { parsed: c };
|
|
271
|
+
} catch (c) {
|
|
272
|
+
return s && g("Failed to load ".concat(t, " ").concat(c.message)), { error: c };
|
|
273
|
+
}
|
|
303
274
|
}
|
|
304
|
-
function
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const t = V(e);
|
|
308
|
-
return t ? l._configVault(e) : (be("You set DOTENV_KEY but you are missing a .env.vault file at ".concat(t, ". Did you forget to build it?")), l.configDotenv(e));
|
|
275
|
+
function Te(e) {
|
|
276
|
+
const t = j(e);
|
|
277
|
+
return N(e).length === 0 ? l.configDotenv(e) : T.existsSync(t) ? l._configVault(e) : (_e("You set DOTENV_KEY but you are missing a .env.vault file at ".concat(t, ". Did you forget to build it?")), l.configDotenv(e));
|
|
309
278
|
}
|
|
310
|
-
function
|
|
311
|
-
const
|
|
279
|
+
function Ne(e, t) {
|
|
280
|
+
const n = Buffer.from(t.slice(-64), "hex");
|
|
312
281
|
let s = Buffer.from(e, "base64");
|
|
313
|
-
const
|
|
314
|
-
s = s.
|
|
282
|
+
const c = s.slice(0, 12), r = s.slice(-16);
|
|
283
|
+
s = s.slice(12, -16);
|
|
315
284
|
try {
|
|
316
|
-
const
|
|
317
|
-
return
|
|
318
|
-
} catch (
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
const p =
|
|
322
|
-
throw
|
|
285
|
+
const o = ve.createDecipheriv("aes-256-gcm", n, c);
|
|
286
|
+
return o.setAuthTag(r), "".concat(o.update(s)).concat(o.final());
|
|
287
|
+
} catch (o) {
|
|
288
|
+
const i = o instanceof RangeError, a = o.message === "Invalid key length", u = o.message === "Unsupported state or unable to authenticate data";
|
|
289
|
+
if (i || a) {
|
|
290
|
+
const p = "INVALID_DOTENV_KEY: It must be 64 characters long (or more)";
|
|
291
|
+
throw new Error(p);
|
|
323
292
|
} else if (u) {
|
|
324
|
-
const p =
|
|
325
|
-
throw
|
|
293
|
+
const p = "DECRYPTION_FAILED: Please check your DOTENV_KEY";
|
|
294
|
+
throw new Error(p);
|
|
326
295
|
} else
|
|
327
|
-
throw
|
|
296
|
+
throw console.error("Error: ", o.code), console.error("Error: ", o.message), o;
|
|
328
297
|
}
|
|
329
298
|
}
|
|
330
|
-
function
|
|
331
|
-
const s = !!(
|
|
332
|
-
if (typeof t != "object")
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
for (const o of Object.keys(t))
|
|
337
|
-
Object.prototype.hasOwnProperty.call(e, o) ? (a === !0 && (e[o] = t[o]), s && g(a === !0 ? '"'.concat(o, '" is already defined and WAS overwritten') : '"'.concat(o, '" is already defined and was NOT overwritten'))) : e[o] = t[o];
|
|
299
|
+
function je(e, t, n = {}) {
|
|
300
|
+
const s = !!(n && n.debug), c = !!(n && n.override);
|
|
301
|
+
if (typeof t != "object")
|
|
302
|
+
throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
303
|
+
for (const r of Object.keys(t))
|
|
304
|
+
Object.prototype.hasOwnProperty.call(e, r) ? (c === !0 && (e[r] = t[r]), s && g(c === !0 ? '"'.concat(r, '" is already defined and WAS overwritten') : '"'.concat(r, '" is already defined and was NOT overwritten'))) : e[r] = t[r];
|
|
338
305
|
}
|
|
339
306
|
const l = {
|
|
340
|
-
configDotenv:
|
|
341
|
-
_configVault:
|
|
342
|
-
_parseVault:
|
|
343
|
-
config:
|
|
344
|
-
decrypt:
|
|
345
|
-
parse:
|
|
346
|
-
populate:
|
|
307
|
+
configDotenv: Oe,
|
|
308
|
+
_configVault: De,
|
|
309
|
+
_parseVault: ye,
|
|
310
|
+
config: Te,
|
|
311
|
+
decrypt: Ne,
|
|
312
|
+
parse: he,
|
|
313
|
+
populate: je
|
|
347
314
|
};
|
|
348
|
-
d.
|
|
349
|
-
d.
|
|
350
|
-
d.
|
|
351
|
-
d.
|
|
352
|
-
d.
|
|
353
|
-
d.
|
|
354
|
-
d.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const je = /* @__PURE__ */ G(Ve);
|
|
358
|
-
function $e(e) {
|
|
315
|
+
d.configDotenv = l.configDotenv;
|
|
316
|
+
d._configVault = l._configVault;
|
|
317
|
+
d._parseVault = l._parseVault;
|
|
318
|
+
d.config = l.config;
|
|
319
|
+
d.decrypt = l.decrypt;
|
|
320
|
+
d.parse = l.parse;
|
|
321
|
+
d.populate = l.populate;
|
|
322
|
+
G.exports = l;
|
|
323
|
+
function Ie(e) {
|
|
359
324
|
if (!(e != null && e.bundler)) {
|
|
360
325
|
console.log(
|
|
361
|
-
|
|
326
|
+
B.red(
|
|
362
327
|
"Please specify the bundler in the options of code-inspector-plugin."
|
|
363
328
|
)
|
|
364
329
|
);
|
|
@@ -369,22 +334,22 @@ function $e(e) {
|
|
|
369
334
|
if (t = !0, process.env.CODE_INSPECTOR === "true")
|
|
370
335
|
t = !1;
|
|
371
336
|
else {
|
|
372
|
-
const
|
|
373
|
-
if (f.existsSync(
|
|
374
|
-
const
|
|
375
|
-
(
|
|
337
|
+
const r = v.resolve(process.cwd(), ".env.local");
|
|
338
|
+
if (f.existsSync(r)) {
|
|
339
|
+
const o = f.readFileSync(r, "utf-8"), i = d.parse(o || "");
|
|
340
|
+
(i == null ? void 0 : i.CODE_INSPECTOR) === "true" && (t = !1);
|
|
376
341
|
}
|
|
377
342
|
}
|
|
378
|
-
let
|
|
379
|
-
typeof __dirname != "undefined" ?
|
|
380
|
-
const s =
|
|
343
|
+
let n = "";
|
|
344
|
+
typeof __dirname != "undefined" ? n = __dirname : n = M(Y(import.meta.url));
|
|
345
|
+
const s = w(b({}, e), {
|
|
381
346
|
close: t,
|
|
382
|
-
output: v.resolve(
|
|
347
|
+
output: v.resolve(n, "./")
|
|
383
348
|
});
|
|
384
|
-
return e.bundler === "webpack" || e.bundler === "rspack" ? new
|
|
349
|
+
return e.bundler === "webpack" || e.bundler === "rspack" ? new K(s) : e.bundler === "esbuild" ? q(s) : R(s);
|
|
385
350
|
}
|
|
386
|
-
const Ke =
|
|
351
|
+
const Ke = Ie;
|
|
387
352
|
export {
|
|
388
|
-
|
|
353
|
+
Ie as CodeInspectorPlugin,
|
|
389
354
|
Ke as codeInspectorPlugin
|
|
390
355
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-inspector-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"chalk": "4.1.1",
|
|
50
|
-
"code-inspector-core": "0.
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
50
|
+
"code-inspector-core": "0.17.0",
|
|
51
|
+
"vite-code-inspector-plugin": "0.17.0",
|
|
52
|
+
"webpack-code-inspector-plugin": "0.17.0",
|
|
53
|
+
"esbuild-code-inspector-plugin": "0.17.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^16.0.1",
|
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { CodeOptions } from 'code-inspector-core';
|
|
2
|
-
export interface CodeInspectorPluginOptions extends CodeOptions {
|
|
3
|
-
/**
|
|
4
|
-
* @zh 指定项目的打包器
|
|
5
|
-
* @en specify the bundler of the project
|
|
6
|
-
*/
|
|
7
|
-
bundler: 'vite' | 'webpack' | 'rspack' | 'esbuild';
|
|
8
|
-
/**
|
|
9
|
-
* @zh 设置为 true 时,仅当 .env.local 文件存在且其包含 CODE_INSPECTOR=true 时插件生效;默认值为 false
|
|
10
|
-
* @en When set the value to true, only if the .env.local file exists and it contains CODE_INSPECTOR=true, the plugin takes effect; The default value is false
|
|
11
|
-
*/
|
|
12
|
-
needEnvInspector?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function CodeInspectorPlugin(options: CodeInspectorPluginOptions): any;
|
|
15
|
-
export declare const codeInspectorPlugin: typeof CodeInspectorPlugin;
|
|
1
|
+
import { CodeOptions } from 'code-inspector-core';
|
|
2
|
+
export interface CodeInspectorPluginOptions extends CodeOptions {
|
|
3
|
+
/**
|
|
4
|
+
* @zh 指定项目的打包器
|
|
5
|
+
* @en specify the bundler of the project
|
|
6
|
+
*/
|
|
7
|
+
bundler: 'vite' | 'webpack' | 'rspack' | 'esbuild';
|
|
8
|
+
/**
|
|
9
|
+
* @zh 设置为 true 时,仅当 .env.local 文件存在且其包含 CODE_INSPECTOR=true 时插件生效;默认值为 false
|
|
10
|
+
* @en When set the value to true, only if the .env.local file exists and it contains CODE_INSPECTOR=true, the plugin takes effect; The default value is false
|
|
11
|
+
*/
|
|
12
|
+
needEnvInspector?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function CodeInspectorPlugin(options: CodeInspectorPluginOptions): any;
|
|
15
|
+
export declare const codeInspectorPlugin: typeof CodeInspectorPlugin;
|