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