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