code-inspector-plugin 0.12.2 → 0.14.0-beta.1
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 +6 -3
- package/dist/.eslintrc.js +7 -0
- package/dist/append-code-5679.js +2 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +103 -96
- package/package.json +14 -5
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://github.com/zh-lx/code-inspector/assets/73059627/842c3e88-dca7-4743-854c-d61093d3d34f" width=160px" style="margin-bottom: 12px;" />
|
|
2
|
+
<img src="https://github.com/zh-lx/code-inspector/assets/73059627/842c3e88-dca7-4743-854c-d61093d3d34f" width="160px" style="margin-bottom: 12px;" />
|
|
3
3
|
|
|
4
4
|
<p align="center">
|
|
5
5
|
<h2>code-inspector</h2>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/code-inspector-plugin)
|
|
10
|
-
[](https://npmcharts.
|
|
10
|
+
[](https://npmcharts.netlify.app/compare/code-inspector-plugin?minimal=true)
|
|
11
11
|
[](https://opensource.org/licenses/MIT)
|
|
12
12
|
[](https://github.com/zh-lx/code-inspector)
|
|
13
13
|
[](https://github.com/zh-lx/code-inspector)
|
|
@@ -28,6 +28,7 @@ Click the element on the page, it can automatically open the code editor and pos
|
|
|
28
28
|
- [react online demo](https://stackblitz.com/edit/vitejs-vite-svtwrr?file=vite.config.ts)
|
|
29
29
|
- [preact online demo](https://stackblitz.com/edit/vitejs-vite-iyawbf?file=vite.config.ts)
|
|
30
30
|
- [solid online demo](https://stackblitz.com/edit/solidjs-templates-6u76jn?file=vite.config.ts)
|
|
31
|
+
- [qwik online demo](https://stackblitz.com/edit/vitejs-vite-antzds?file=vite.config.ts)
|
|
31
32
|
- [svelte online demo](https://stackblitz.com/edit/vitejs-vite-zoncqr?file=vite.config.ts)
|
|
32
33
|
- [astro online demo](https://stackblitz.com/edit/withastro-astro-f5xq1t?file=astro.config.mjs)
|
|
33
34
|
|
|
@@ -46,6 +47,7 @@ The following are which compilers, web frameworks and editors we supported now:
|
|
|
46
47
|
✅ react<br />
|
|
47
48
|
✅ preact<br />
|
|
48
49
|
✅ solid<br />
|
|
50
|
+
✅ qwik<br />
|
|
49
51
|
✅ svelte<br />
|
|
50
52
|
✅ astro
|
|
51
53
|
- The following code editors are currently supported:<br />
|
|
@@ -283,7 +285,8 @@ Please check here for more usage information: [code-inspector-plugin configurati
|
|
|
283
285
|
## 👨💻 Contributors
|
|
284
286
|
|
|
285
287
|
Special thanks to the contributors of this project:<br />
|
|
286
|
-
|
|
288
|
+
|
|
289
|
+
<img src="https://contrib.rocks/image?repo=zh-lx/code-inspector" height="40" />
|
|
287
290
|
|
|
288
291
|
## 📧 Communication and Feedback
|
|
289
292
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
'use client'; ;(function(){ if (globalThis.__code_inspector_warning) { return; }; var originWarn = console.warn; var warning = "Extraneous non-props attributes"; var path = "data-insp-path"; console.warn = function () { globalThis.__code_inspector_warning = true; var args = Array.prototype.slice.call(arguments); var firstParam = args && args[0]; if (typeof firstParam === 'string' && firstParam.indexOf(warning) !== -1 && firstParam.indexOf(path) !== -1) { return; } else { originWarn.apply(null, args); }; }; })(); ;(function (){ if (typeof window !== 'undefined') { if (!document.documentElement.querySelector('code-inspector-component')) { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.textContent = (function(v,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):p((v=typeof globalThis!="undefined"?globalThis:v||self).vueInspectorClient={})})(this,function(v){"use strict";var At=Object.freeze,Et=Object.defineProperty,qt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var St=Object.getOwnPropertySymbols;var Jt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable;var xt=(v,p,f)=>p in v?Et(v,p,{enumerable:!0,configurable:!0,writable:!0,value:f}):v[p]=f,q=(v,p)=>{for(var f in p||(p={}))Jt.call(p,f)&&xt(v,f,p[f]);if(St)for(var f of St(p))Qt.call(p,f)&&xt(v,f,p[f]);return v},G=(v,p)=>qt(v,Gt(p));var I=(v,p)=>At(Et(v,"raw",{value:At(p||v.slice())})),Ct=(v,p,f)=>new Promise((z,N)=>{var K=b=>{try{S(f.next(b))}catch(C){N(C)}},X=b=>{try{S(f.throw(b))}catch(C){N(C)}},S=b=>b.done?z(b.value):Promise.resolve(b.value).then(K,X);S((f=f.apply(v,p)).next())});var Pt,Mt,kt,Tt;const p=window,f=p.ShadowRoot&&(p.ShadyCSS===void 0||p.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,z=Symbol(),N=new WeakMap;let K=class{constructor(i,t,e){if(this._$cssResult$=!0,e!==z)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t}get styleSheet(){let i=this.o;const t=this.t;if(f&&i===void 0){const e=t!==void 0&&t.length===1;e&&(i=N.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&N.set(t,i))}return i}toString(){return this.cssText}};const X=f?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(const o of t.cssRules)e+=o.cssText;return(o=>new K(typeof o=="string"?o:o+"",void 0,z))(e)})(i):i;var S;const b=window,C=b.trustedTypes,Ut=C?C.emptyScript:"",rt=b.reactiveElementPolyfillSupport,J={toAttribute(i,t){switch(t){case Boolean:i=i?Ut:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(o){e=null}}return e}},lt=(i,t)=>t!==i&&(t==t||i==i),Q={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:lt};let P=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(i){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(i)}static get observedAttributes(){this.finalize();const i=[];return this.elementProperties.forEach((t,e)=>{const o=this._$Ep(e,t);o!==void 0&&(this._$Ev.set(o,e),i.push(o))}),i}static createProperty(i,t=Q){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(i,t),!t.noAccessor&&!this.prototype.hasOwnProperty(i)){const e=typeof i=="symbol"?Symbol():"__"+i,o=this.getPropertyDescriptor(i,e,t);o!==void 0&&Object.defineProperty(this.prototype,i,o)}}static getPropertyDescriptor(i,t,e){return{get(){return this[t]},set(o){const s=this[i];this[t]=o,this.requestUpdate(i,s,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(i){return this.elementProperties.get(i)||Q}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const i=Object.getPrototypeOf(this);if(i.finalize(),i.h!==void 0&&(this.h=[...i.h]),this.elementProperties=new Map(i.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const o of e)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const t=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const o of e)t.unshift(X(o))}else i!==void 0&&t.push(X(i));return t}static _$Ep(i,t){const e=t.attribute;return e===!1?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}u(){var i;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(i=this.constructor.h)===null||i===void 0||i.forEach(t=>t(this))}addController(i){var t,e;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(i),this.renderRoot!==void 0&&this.isConnected&&((e=i.hostConnected)===null||e===void 0||e.call(i))}removeController(i){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(i)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((i,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var i;const t=(i=this.shadowRoot)!==null&&i!==void 0?i:this.attachShadow(this.constructor.shadowRootOptions);return((e,o)=>{f?e.adoptedStyleSheets=o.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet):o.forEach(s=>{const n=document.createElement("style"),r=p.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,e.appendChild(n)})})(t,this.constructor.elementStyles),t}connectedCallback(){var i;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(i=this._$ES)===null||i===void 0||i.forEach(t=>{var e;return(e=t.hostConnected)===null||e===void 0?void 0:e.call(t)})}enableUpdating(i){}disconnectedCallback(){var i;(i=this._$ES)===null||i===void 0||i.forEach(t=>{var e;return(e=t.hostDisconnected)===null||e===void 0?void 0:e.call(t)})}attributeChangedCallback(i,t,e){this._$AK(i,e)}_$EO(i,t,e=Q){var o;const s=this.constructor._$Ep(i,e);if(s!==void 0&&e.reflect===!0){const n=(((o=e.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?e.converter:J).toAttribute(t,e.type);this._$El=i,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$El=null}}_$AK(i,t){var e;const o=this.constructor,s=o._$Ev.get(i);if(s!==void 0&&this._$El!==s){const n=o.getPropertyOptions(s),r=typeof n.converter=="function"?{fromAttribute:n.converter}:((e=n.converter)===null||e===void 0?void 0:e.fromAttribute)!==void 0?n.converter:J;this._$El=s,this[s]=r.fromAttribute(t,n.type),this._$El=null}}requestUpdate(i,t,e){let o=!0;i!==void 0&&(((e=e||this.constructor.getPropertyOptions(i)).hasChanged||lt)(this[i],t)?(this._$AL.has(i)||this._$AL.set(i,t),e.reflect===!0&&this._$El!==i&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(i,e))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}_$Ej(){return Ct(this,null,function*(){this.isUpdatePending=!0;try{yield this._$E_}catch(t){Promise.reject(t)}const i=this.scheduleUpdate();return i!=null&&(yield i),!this.isUpdatePending})}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((o,s)=>this[s]=o),this._$Ei=void 0);let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$ES)===null||i===void 0||i.forEach(o=>{var s;return(s=o.hostUpdate)===null||s===void 0?void 0:s.call(o)}),this.update(e)):this._$Ek()}catch(o){throw t=!1,this._$Ek(),o}t&&this._$AE(e)}willUpdate(i){}_$AE(i){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var o;return(o=e.hostUpdated)===null||o===void 0?void 0:o.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(i)),this.updated(i)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(i){return!0}update(i){this._$EC!==void 0&&(this._$EC.forEach((t,e)=>this._$EO(e,this[e],t)),this._$EC=void 0),this._$Ek()}updated(i){}firstUpdated(i){}};var tt;P.finalized=!0,P.elementProperties=new Map,P.elementStyles=[],P.shadowRootOptions={mode:"open"},rt==null||rt({ReactiveElement:P}),((S=b.reactiveElementVersions)!==null&&S!==void 0?S:b.reactiveElementVersions=[]).push("1.6.1");const F=window,M=F.trustedTypes,ht=M?M.createPolicy("lit-html",{createHTML:i=>i}):void 0,A="lit$".concat((Math.random()+"").slice(9),"$"),at="?"+A,Ht="<".concat(at,">"),k=document,D=(i="")=>k.createComment(i),O=i=>i===null||typeof i!="object"&&typeof i!="function",dt=Array.isArray,V=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pt=/-->/g,ct=/>/g,x=RegExp(">|[ \n\f\r](?:([^\\s\"'>=/]+)([ \n\f\r]*=[ \n\f\r]*(?:[^ \n\f\r\"'`<>=]|(\"|')|))|$)","g"),ut=/'/g,mt=/"/g,vt=/^(?:script|style|textarea|title)$/i,et=(i=>(t,...e)=>({_$litType$:i,strings:t,values:e}))(1),E=Symbol.for("lit-noChange"),y=Symbol.for("lit-nothing"),gt=new WeakMap,T=k.createTreeWalker(k,129,null,!1),Rt=(i,t)=>{const e=i.length-1,o=[];let s,n=t===2?"<svg>":"",r=V;for(let l=0;l<e;l++){const h=i[l];let $,d,u=-1,g=0;for(;g<h.length&&(r.lastIndex=g,d=r.exec(h),d!==null);)g=r.lastIndex,r===V?d[1]==="!--"?r=pt:d[1]!==void 0?r=ct:d[2]!==void 0?(vt.test(d[2])&&(s=RegExp("</"+d[2],"g")),r=x):d[3]!==void 0&&(r=x):r===x?d[0]===">"?(r=s!=null?s:V,u=-1):d[1]===void 0?u=-2:(u=r.lastIndex-d[2].length,$=d[1],r=d[3]===void 0?x:d[3]==='"'?mt:ut):r===mt||r===ut?r=x:r===pt||r===ct?r=V:(r=x,s=void 0);const R=r===x&&i[l+1].startsWith("/>")?" ":"";n+=r===V?h+Ht:u>=0?(o.push($),h.slice(0,u)+"$lit$"+h.slice(u)+A+R):h+A+(u===-2?(o.push(void 0),l):R)}const a=n+(i[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return[ht!==void 0?ht.createHTML(a):a,o]};class j{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let n=0,r=0;const a=t.length-1,l=this.parts,[h,$]=Rt(t,e);if(this.el=j.createElement(h,o),T.currentNode=this.el.content,e===2){const d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(s=T.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes()){const d=[];for(const u of s.getAttributeNames())if(u.endsWith("$lit$")||u.startsWith(A)){const g=$[r++];if(d.push(u),g!==void 0){const R=s.getAttribute(g.toLowerCase()+"$lit$").split(A),L=/([.?@])?(.*)/.exec(g);l.push({type:1,index:n,name:L[2],strings:R,ctor:L[1]==="."?zt:L[1]==="?"?Dt:L[1]==="@"?Ot:Y})}else l.push({type:6,index:n})}for(const u of d)s.removeAttribute(u)}if(vt.test(s.tagName)){const d=s.textContent.split(A),u=d.length-1;if(u>0){s.textContent=M?M.emptyScript:"";for(let g=0;g<u;g++)s.append(d[g],D()),T.nextNode(),l.push({type:2,index:++n});s.append(d[u],D())}}}else if(s.nodeType===8)if(s.data===at)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(A,d+1))!==-1;)l.push({type:7,index:n}),d+=A.length-1}n++}}static createElement(t,e){const o=k.createElement("template");return o.innerHTML=t,o}}function U(i,t,e=i,o){var s,n,r,a;if(t===E)return t;let l=o!==void 0?(s=e._$Co)===null||s===void 0?void 0:s[o]:e._$Cl;const h=O(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==h&&((n=l==null?void 0:l._$AO)===null||n===void 0||n.call(l,!1),h===void 0?l=void 0:(l=new h(i),l._$AT(i,e,o)),o!==void 0?((r=(a=e)._$Co)!==null&&r!==void 0?r:a._$Co=[])[o]=l:e._$Cl=l),l!==void 0&&(t=U(i,l._$AS(i,t.values),l,o)),t}class Lt{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:o},parts:s}=this._$AD,n=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:k).importNode(o,!0);T.currentNode=n;let r=T.nextNode(),a=0,l=0,h=s[0];for(;h!==void 0;){if(a===h.index){let $;h.type===2?$=new W(r,r.nextSibling,this,t):h.type===1?$=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&($=new Vt(r,this,t)),this.u.push($),h=s[++l]}a!==(h==null?void 0:h.index)&&(r=T.nextNode(),a++)}return n}p(t){let e=0;for(const o of this.u)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}}class W{constructor(t,e,o,s){var n;this.type=2,this._$AH=y,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=s,this._$Cm=(n=s==null?void 0:s.isConnected)===null||n===void 0||n}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=U(this,t,e),O(t)?t===y||t==null||t===""?(this._$AH!==y&&this._$AR(),this._$AH=y):t!==this._$AH&&t!==E&&this.g(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):(o=>dt(o)||typeof(o==null?void 0:o[Symbol.iterator])=="function")(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==y&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(k.createTextNode(t)),this._$AH=t}$(t){var e;const{values:o,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=j.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.p(o);else{const r=new Lt(n,this),a=r.v(this.options);r.p(o),this.T(a),this._$AH=r}}_$AC(t){let e=gt.get(t.strings);return e===void 0&>.set(t.strings,e=new j(t)),e}k(t){dt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let o,s=0;for(const n of t)s===e.length?e.push(o=new W(this.O(D()),this.O(D()),this,this.options)):o=e[s],o._$AI(n),s++;s<e.length&&(this._$AR(o&&o._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var o;for((o=this._$AP)===null||o===void 0||o.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cm=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class Y{constructor(t,e,o,s,n){this.type=1,this._$AH=y,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=y}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,o,s){const n=this.strings;let r=!1;if(n===void 0)t=U(this,t,e,0),r=!O(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{const a=t;let l,h;for(t=n[0],l=0;l<n.length-1;l++)h=U(this,a[o+l],e,l),h===E&&(h=this._$AH[l]),r||(r=!O(h)||h!==this._$AH[l]),h===y?t=y:t!==y&&(t+=(h!=null?h:"")+n[l+1]),this._$AH[l]=h}r&&!s&&this.j(t)}j(t){t===y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class zt extends Y{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===y?void 0:t}}const Nt=M?M.emptyScript:"";class Dt extends Y{constructor(){super(...arguments),this.type=4}j(t){t&&t!==y?this.element.setAttribute(this.name,Nt):this.element.removeAttribute(this.name)}}class Ot extends Y{constructor(t,e,o,s,n){super(t,e,o,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=U(this,t,e,0))!==null&&o!==void 0?o:y)===E)return;const s=this._$AH,n=t===y&&s!==y||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==y&&(s===y||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,o;typeof this._$AH=="function"?this._$AH.call((o=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&o!==void 0?o:this.element,t):this._$AH.handleEvent(t)}}class Vt{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){U(this,t)}}const ft=F.litHtmlPolyfillSupport;ft==null||ft(j,W),((tt=F.litHtmlVersions)!==null&&tt!==void 0?tt:F.litHtmlVersions=[]).push("2.6.1");var it,ot;class B extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const o=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=o.firstChild),o}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((o,s,n)=>{var r,a;const l=(r=n==null?void 0:n.renderBefore)!==null&&r!==void 0?r:s;let h=l._$litPart$;if(h===void 0){const $=(a=n==null?void 0:n.renderBefore)!==null&&a!==void 0?a:null;l._$litPart$=h=new W(s.insertBefore(D(),$),$,void 0,n!=null?n:{})}return h._$AI(o),h})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return E}}B.finalized=!0,B._$litElement$=!0,(it=globalThis.litElementHydrateSupport)===null||it===void 0||it.call(globalThis,{LitElement:B});const yt=globalThis.litElementPolyfillSupport;yt==null||yt({LitElement:B}),((ot=globalThis.litElementVersions)!==null&&ot!==void 0?ot:globalThis.litElementVersions=[]).push("3.2.2");const jt=(i,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?G(q({},t),{finisher(e){e.createProperty(t.key,i)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,i)}};function _(i){return(t,e)=>e!==void 0?((o,s,n)=>{s.constructor.createProperty(n,o)})(i,t,e):jt(i,t)}function w(i){return _(G(q({},i),{state:!0}))}var st;(st=window.HTMLSlotElement)===null||st===void 0||st.prototype.assignedElements;const Wt=1;let Bt=class{constructor(i){}get _$AU(){return this._$AM._$AU}_$AT(i,t,e){this._$Ct=i,this._$AM=t,this._$Ci=e}_$AS(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};const H=(i=>(...t)=>({_$litDirective$:i,values:t}))(class extends Bt{constructor(i){var t;if(super(i),i.type!==Wt||i.name!=="style"||((t=i.strings)===null||t===void 0?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{const o=i[e];return o==null?t:t+"".concat(e=e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase(),":").concat(o,";")},"")}update(i,[t]){const{style:e}=i.element;if(this.vt===void 0){this.vt=new Set;for(const o in t)this.vt.add(o);return this.render(t)}this.vt.forEach(o=>{t[o]==null&&(this.vt.delete(o),o.includes("-")?e.removeProperty(o):e[o]="")});for(const o in t){const s=t[o];s!=null&&(this.vt.add(o),o.includes("-")?e.setProperty(o,s):e[o]=s)}return E}});function $t(i){if(i.path)return i.path;let t=i.target;for(i.path=[];t.parentNode!==null;)i.path.push(t),t=t.parentNode;return i.path.push(document,window),i.path}const Z="data-insp-path",bt="{file}",wt="{line}",_t="{column}";var It=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,m=(i,t,e,o)=>{for(var s,n=o>1?void 0:o?Kt(t,e):t,r=i.length-1;r>=0;r--)(s=i[r])&&(n=(o?s(t,e,n):s(n))||n);return o&&n&&It(t,e,n),n};const nt="__code-inspector-unique-id",Xt={ctrlKey:"^control",altKey:"⌥option",metaKey:"⌘command",shiftKey:"shift"},Ft={ctrlKey:"Ctrl",altKey:"Alt",metaKey:"⊞Windows",shiftKey:"⇧Shift"};class c extends B{constructor(){super(...arguments),this.hotKeys="shiftKey,altKey",this.port=5678,this.showSwitch=!1,this.autoToggle=!1,this.hideConsole=!1,this.locate=!0,this.copy=!1,this.ip="localhost",this.position={top:0,right:0,bottom:0,left:0,padding:{top:0,right:0,bottom:0,left:0},border:{top:0,right:0,bottom:0,left:0},margin:{top:0,right:0,bottom:0,left:0}},this.element={name:"",line:0,column:0,path:""},this.infoClassName={vertical:"",horizon:""},this.infoWidth="300px",this.show=!1,this.dragging=!1,this.mousePosition={baseX:0,baseY:0,moveX:0,moveY:0},this.open=!1,this.moved=!1,this.hoverSwitch=!1,this.preUserSelect="",this.sendType="xhr",this.isTracking=t=>this.hotKeys&&this.hotKeys.split(",").every(e=>t[e.trim()]),this.getDomPropertyValue=(t,e)=>{const o=window.getComputedStyle(t);return Number(o.getPropertyValue(e).replace("px",""))},this.renderCover=t=>{const{top:e,right:o,bottom:s,left:n}=t.getBoundingClientRect();this.position={top:e,right:o,bottom:s,left:n,border:{top:this.getDomPropertyValue(t,"border-top-width"),right:this.getDomPropertyValue(t,"border-right-width"),bottom:this.getDomPropertyValue(t,"border-bottom-width"),left:this.getDomPropertyValue(t,"border-left-width")},padding:{top:this.getDomPropertyValue(t,"padding-top"),right:this.getDomPropertyValue(t,"padding-right"),bottom:this.getDomPropertyValue(t,"padding-bottom"),left:this.getDomPropertyValue(t,"padding-left")},margin:{top:this.getDomPropertyValue(t,"margin-top"),right:this.getDomPropertyValue(t,"margin-right"),bottom:this.getDomPropertyValue(t,"margin-bottom"),left:this.getDomPropertyValue(t,"margin-left")}};const r=document.documentElement.clientHeight,a=document.documentElement.clientWidth,l=r-s-this.getDomPropertyValue(t,"margin-bottom"),h=a-o-this.getDomPropertyValue(t,"margin-right"),$=e-this.getDomPropertyValue(t,"margin-top"),d=n-this.getDomPropertyValue(t,"margin-left");this.infoClassName={vertical:$>l?$<100?"element-info-top-inner":"element-info-top":l<100?"element-info-bottom-inner":"element-info-bottom",horizon:d>=h?"element-info-right":"element-info-left"},this.infoWidth=Math.max(o-n+this.getDomPropertyValue(t,"margin-right")+this.getDomPropertyValue(t,"margin-left"),300)+"px",this.addGlobalCursorStyle(),this.preUserSelect||(this.preUserSelect=getComputedStyle(document.body).userSelect),document.body.style.userSelect="none";let u=t.getAttribute(Z)||t[Z]||"";!u&&t.getAttribute("data-astro-source-file")&&(u="".concat(t.getAttribute("data-astro-source-file"),":").concat(t.getAttribute("data-astro-source-loc"),":").concat(t.tagName.toLowerCase()));const g=u.split(":"),R=g[g.length-1],L=Number(g[g.length-2]),Yt=Number(g[g.length-3]),Zt=g.slice(0,g.length-3).join(":");this.element={name:R,path:Zt,line:Yt,column:L},this.show=!0},this.removeCover=()=>{this.show=!1,this.removeGlobalCursorStyle(),document.body.style.userSelect=this.preUserSelect,this.preUserSelect=""},this.addGlobalCursorStyle=()=>{if(!document.getElementById(nt)){const t=document.createElement("style");t.setAttribute("id",nt),t.innerText="body * {\n cursor: pointer !important;\n }",document.body.appendChild(t)}},this.removeGlobalCursorStyle=()=>{const t=document.getElementById(nt);t&&t.remove()},this.sendXHR=()=>{const t=encodeURIComponent(this.element.path),e="http://".concat(this.ip,":").concat(this.port,"/?file=").concat(t,"&line=").concat(this.element.line,"&column=").concat(this.element.column),o=new XMLHttpRequest;o.open("GET",e,!0),o.send(),o.addEventListener("error",()=>{this.sendType="img",this.sendImg()})},this.sendImg=()=>{const t=encodeURIComponent(this.element.path),e="http://".concat(this.ip,":").concat(this.port,"/?file=").concat(t,"&line=").concat(this.element.line,"&column=").concat(this.element.column);document.createElement("img").src=e},this.trackCode=()=>{if(this.locate&&(this.sendType==="xhr"?this.sendXHR():this.sendImg()),this.copy){const t=function(e,o,s,n){let r="".concat(e,":").concat(o,":").concat(s);if(typeof n=="string")r=n.replace(bt,e).replace(wt,o).replace(_t,s);else if(n instanceof Array)return n.map(a=>a.replace(bt,e).replace(wt,o).replace(_t,s));return[r]}(this.element.path,String(this.element.line),String(this.element.column),this.copy);this.copyToClipboard(t[0])}},this.moveSwitch=t=>{if($t(t).includes(this)?this.hoverSwitch=!0:this.hoverSwitch=!1,this.dragging)return this.moved=!0,this.inspectorSwitchRef.style.left=this.mousePosition.baseX+(t.pageX-this.mousePosition.moveX)+"px",void(this.inspectorSwitchRef.style.top=this.mousePosition.baseY+(t.pageY-this.mousePosition.moveY)+"px")},this.handleMouseup=()=>{this.hoverSwitch=!1},this.handleMouseMove=t=>{if((this.isTracking(t)&&!this.dragging||this.open)&&!this.hoverSwitch){const e=$t(t);let o;for(let s=0;s<e.length;s++){const n=e[s];if(n.hasAttribute&&n.hasAttribute(Z)||n[Z]){o=n;break}if(n.hasAttribute&&n.hasAttribute("data-astro-source-file")){o=n;break}}o&&this.renderCover(o)}else this.removeCover()},this.handleMouseClick=t=>{(this.isTracking(t)||this.open)&&this.show&&(t.stopPropagation(),t.preventDefault(),this.trackCode(),this.removeCover(),this.autoToggle&&(this.open=!1))},this.handlePointerDown=t=>{var e;(e=t.target)!=null&&e.disabled&&(this.isTracking(t)||this.open)&&this.show&&(t.stopPropagation(),t.preventDefault(),this.trackCode(),this.removeCover(),this.autoToggle&&(this.open=!1))},this.handleKeyUp=t=>{this.isTracking(t)||this.open||this.removeCover()},this.printTip=()=>{const t=navigator.userAgent.toLowerCase(),e=["windows","win32","wow32","win64","wow64"].some(r=>t.match(r))?Ft:Xt,o=this.hotKeys.split(",").map(r=>"%c"+e[r.trim()]),s=2*o.length+1,n=Array(s).fill("").map((r,a)=>a%2==0?"color: #42b983; font-weight: bold; font-family: PingFang SC;":"color: #006aff; font-weight: bold; font-family: PingFang SC;");console.log("%c同时按住 [".concat(o.join(" %c+ "),"%c] 时启用 inspector 功能(点击页面元素可定位至编辑器源代码)"),...n)},this.recordMousePosition=t=>{this.mousePosition={baseX:this.inspectorSwitchRef.offsetLeft,baseY:this.inspectorSwitchRef.offsetTop,moveX:t.pageX,moveY:t.pageY},this.dragging=!0,t.preventDefault()},this.handleMouseUp=()=>{this.dragging=!1},this.switch=t=>{this.moved||(this.open=!this.open,t.preventDefault(),t.stopPropagation()),this.moved=!1}}copyToClipboard(t){var e;if(typeof((e=navigator==null?void 0:navigator.clipboard)==null?void 0:e.writeText)=="function")navigator.clipboard.writeText(t);else{const o=document.createElement("textarea");o.value=t,document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}}firstUpdated(){this.hideConsole||this.printTip(),window.addEventListener("mousemove",this.handleMouseMove),window.addEventListener("mousemove",this.moveSwitch),window.addEventListener("mouseup",this.handleMouseup),window.addEventListener("click",this.handleMouseClick,!0),window.addEventListener("pointerdown",this.handlePointerDown,!0),document.addEventListener("keyup",this.handleKeyUp),document.addEventListener("mouseleave",this.removeCover),document.addEventListener("mouseup",this.handleMouseUp),this.inspectorSwitchRef.addEventListener("mousedown",this.recordMousePosition),this.inspectorSwitchRef.addEventListener("click",this.switch)}disconnectedCallback(){window.removeEventListener("mousemove",this.handleMouseMove),window.removeEventListener("mousemove",this.moveSwitch),window.removeEventListener("mouseup",this.handleMouseup),window.removeEventListener("click",this.handleMouseClick,!0),window.removeEventListener("pointerdown",this.handlePointerDown,!0),document.removeEventListener("keyup",this.handleKeyUp),document.removeEventListener("mouseleave",this.removeCover),document.removeEventListener("mouseup",this.handleMouseUp),this.inspectorSwitchRef&&this.inspectorSwitchRef.removeEventListener("mousedown",this.recordMousePosition),this.inspectorSwitchRef.removeEventListener("click",this.switch)}render(){const t={display:this.show?"block":"none",top:this.position.top-this.position.margin.top+"px",left:this.position.left-this.position.margin.left+"px",height:"".concat(this.position.bottom-this.position.top+this.position.margin.bottom+this.position.margin.top,"px"),width:"".concat(this.position.right-this.position.left+this.position.margin.right+this.position.margin.left,"px")},e={borderTopWidth:"".concat(this.position.margin.top,"px"),borderRightWidth:"".concat(this.position.margin.right,"px"),borderBottomWidth:"".concat(this.position.margin.bottom,"px"),borderLeftWidth:"".concat(this.position.margin.left,"px")},o={borderTopWidth:"".concat(this.position.border.top,"px"),borderRightWidth:"".concat(this.position.border.right,"px"),borderBottomWidth:"".concat(this.position.border.bottom,"px"),borderLeftWidth:"".concat(this.position.border.left,"px")},s={borderTopWidth:"".concat(this.position.padding.top,"px"),borderRightWidth:"".concat(this.position.padding.right,"px"),borderBottomWidth:"".concat(this.position.padding.bottom,"px"),borderLeftWidth:"".concat(this.position.padding.left,"px")};return et(kt||(kt=I(['\n <div\n class="code-inspector-container"\n id="code-inspector-container"\n style=','\n >\n <div class="margin-overlay" style=','>\n <div class="border-overlay" style=','>\n <div class="padding-overlay" style=','>\n <div class="content-overlay"></div>\n </div>\n </div>\n </div>\n <div\n id="element-info"\n class="element-info '," ",'"\n style=','\n >\n <div class="element-info-content">\n <div class="name-line">\n <div class="element-name">\n <span class="element-title"><','></span>\n <span class="element-tip">click to open IDE</span>\n </div>\n </div>\n <div class="path-line">','</div>\n </div>\n </div>\n </div>\n <div\n id="inspector-switch"\n class="inspector-switch '," ",'"\n style=',"\n >\n ","\n </div>\n "])),H(t),H(e),H(o),H(s),this.infoClassName.vertical,this.infoClassName.horizon,H({width:this.infoWidth}),this.element.name,this.element.path,this.open?"active-inspector-switch":"",this.moved?"move-inspector-switch":"",H({display:this.showSwitch?"flex":"none"}),this.open?et(Pt||(Pt=I(['\n <svg\n t="1677801709811"\n class="icon"\n viewBox="0 0 1024 1024"\n version="1.1"\n xmlns="http://www.w3.org/2000/svg"\n p-id="1110"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n width="1em"\n height="1em"\n >\n <path\n d="M546.56 704H128c-19.2 0-32-12.8-32-32V256h704v194.56c10.928 1.552 21.648 3.76 32 6.832V128c0-35.2-28.8-64-64-64H128C92.8 64 64 92.8 64 128v544c0 35.2 28.8 64 64 64h425.392a221.936 221.936 0 0 1-6.848-32zM96 128c0-19.2 12.8-32 32-32h640c19.2 0 32 12.8 32 32v96H96V128z"\n fill="#34495E"\n p-id="1111"\n ></path>\n <path\n d="M416 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="#00B42A"\n p-id="1112"\n ></path>\n <path\n d="M288 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="#F7BA1E"\n p-id="1113"\n ></path>\n <path\n d="M160 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="#F53F3F"\n p-id="1114"\n ></path>\n <path\n d="M382.848 658.928l99.376-370.88 30.912 8.272-99.36 370.88zM318.368 319.2L160 477.6l158.4 158.4 22.64-22.624-135.792-135.776 135.776-135.776zM768 480c-13.088 0-25.888 1.344-38.24 3.84l6.24-6.24-158.4-158.4-22.64 22.624 135.792 135.776-135.776 135.776 22.656 22.624 2.208-2.224a190.768 190.768 0 0 0 30.928 148.08l-116.672 116.656c-10.24 10.24-10.24 26.896 0 37.136l27.76 27.76c5.12 5.12 11.84 7.68 18.56 7.68s13.456-2.56 18.56-7.68l120.992-120.96A190.56 190.56 0 0 0 768 864c105.872 0 192-86.128 192-192s-86.128-192-192-192z m-159.12 193.136c0-88.224 71.776-160 160-160 10.656 0 21.04 1.152 31.12 3.152V672c0 19.2-12.8 32-32 32h-156a160.144 160.144 0 0 1-3.12-30.864z m-68.464 263.584l-19.632-19.632 110.336-110.336c6.464 6.656 13.392 12.848 20.752 18.528l-111.456 111.44z m228.464-103.584c-65.92 0-122.576-40.096-147.056-97.136H768c35.2 0 64-28.8 64-64v-145.776c56.896 24.544 96.88 81.12 96.88 146.912 0 88.224-71.776 160-160 160z"\n fill="#006AFF"\n p-id="1115"\n ></path>\n <path\n d="M864.576 672c0 52.928-43.072 96-96 96v32a128 128 0 0 0 128-128h-32z"\n fill="#34495E"\n p-id="1116"\n ></path>\n </svg>\n ']))):et(Mt||(Mt=I(['<svg\n t="1677801709811"\n class="icon"\n viewBox="0 0 1024 1024"\n version="1.1"\n xmlns="http://www.w3.org/2000/svg"\n p-id="1110"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n width="1em"\n height="1em"\n >\n <path\n d="M546.56 704H128c-19.2 0-32-12.8-32-32V256h704v194.56c10.928 1.552 21.648 3.76 32 6.832V128c0-35.2-28.8-64-64-64H128C92.8 64 64 92.8 64 128v544c0 35.2 28.8 64 64 64h425.392a221.936 221.936 0 0 1-6.848-32zM96 128c0-19.2 12.8-32 32-32h640c19.2 0 32 12.8 32 32v96H96V128z"\n fill="currentColor"\n p-id="1111"\n ></path>\n <path\n d="M416 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="currentColor"\n p-id="1112"\n ></path>\n <path\n d="M288 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="currentColor"\n p-id="1113"\n ></path>\n <path\n d="M160 160m-32 0a32 32 0 1 0 64 0 32 32 0 1 0-64 0Z"\n fill="currentColor"\n p-id="1114"\n ></path>\n <path\n d="M382.848 658.928l99.376-370.88 30.912 8.272-99.36 370.88zM318.368 319.2L160 477.6l158.4 158.4 22.64-22.624-135.792-135.776 135.776-135.776zM768 480c-13.088 0-25.888 1.344-38.24 3.84l6.24-6.24-158.4-158.4-22.64 22.624 135.792 135.776-135.776 135.776 22.656 22.624 2.208-2.224a190.768 190.768 0 0 0 30.928 148.08l-116.672 116.656c-10.24 10.24-10.24 26.896 0 37.136l27.76 27.76c5.12 5.12 11.84 7.68 18.56 7.68s13.456-2.56 18.56-7.68l120.992-120.96A190.56 190.56 0 0 0 768 864c105.872 0 192-86.128 192-192s-86.128-192-192-192z m-159.12 193.136c0-88.224 71.776-160 160-160 10.656 0 21.04 1.152 31.12 3.152V672c0 19.2-12.8 32-32 32h-156a160.144 160.144 0 0 1-3.12-30.864z m-68.464 263.584l-19.632-19.632 110.336-110.336c6.464 6.656 13.392 12.848 20.752 18.528l-111.456 111.44z m228.464-103.584c-65.92 0-122.576-40.096-147.056-97.136H768c35.2 0 64-28.8 64-64v-145.776c56.896 24.544 96.88 81.12 96.88 146.912 0 88.224-71.776 160-160 160z"\n fill="currentColor"\n p-id="1115"\n ></path>\n <path\n d="M864.576 672c0 52.928-43.072 96-96 96v32a128 128 0 0 0 128-128h-32z"\n fill="currentColor"\n p-id="1116"\n ></path>\n </svg>']))))}}c.styles=((i,...t)=>{const e=i.length===1?i[0]:t.reduce((o,s,n)=>o+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new K(e,i,z)})(Tt||(Tt=I(["\n .code-inspector-container {\n position: fixed;\n pointer-events: none;\n z-index: 999999;\n font-family: 'PingFang SC';\n .margin-overlay {\n position: absolute;\n inset: 0;\n border-style: solid;\n border-color: rgba(255, 155, 0, 0.3);\n .border-overlay {\n position: absolute;\n inset: 0;\n border-style: solid;\n border-color: rgba(255, 200, 50, 0.3);\n .padding-overlay {\n position: absolute;\n inset: 0;\n border-style: solid;\n border-color: rgba(77, 200, 0, 0.3);\n .content-overlay {\n position: absolute;\n inset: 0;\n background: rgba(120, 170, 210, 0.7);\n }\n }\n }\n }\n }\n .element-info {\n position: absolute;\n }\n .element-info-content {\n max-width: 100%;\n font-size: 12px;\n color: #000;\n background-color: #fff;\n word-break: break-all;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);\n box-sizing: border-box;\n padding: 4px 8px;\n border-radius: 4px;\n }\n .element-info-top {\n top: -4px;\n transform: translateY(-100%);\n }\n .element-info-bottom {\n top: calc(100% + 4px);\n }\n .element-info-top-inner {\n top: 4px;\n }\n .element-info-bottom-inner {\n bottom: 4px;\n }\n .element-info-left {\n left: 0;\n display: flex;\n justify-content: flex-start;\n }\n .element-info-right {\n right: 0;\n display: flex;\n justify-content: flex-end;\n }\n .element-name .element-title {\n color: coral;\n font-weight: bold;\n }\n .element-name .element-tip {\n color: #006aff;\n }\n .path-line {\n color: #333;\n line-height: 12px;\n margin-top: 4px;\n }\n .inspector-switch {\n position: fixed;\n z-index: 9999999;\n top: 16px;\n left: 50%;\n font-size: 22px;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.8);\n color: #555;\n height: 32px;\n width: 32px;\n border-radius: 50%;\n box-shadow: 0px 1px 2px -2px rgba(0, 0, 0, 0.2),\n 0px 3px 6px 0px rgba(0, 0, 0, 0.16),\n 0px 5px 12px 4px rgba(0, 0, 0, 0.12);\n cursor: pointer;\n }\n .active-inspector-switch {\n color: #006aff;\n }\n .move-inspector-switch {\n cursor: move;\n }\n "]))),m([_()],c.prototype,"hotKeys",2),m([_()],c.prototype,"port",2),m([_()],c.prototype,"showSwitch",2),m([_()],c.prototype,"autoToggle",2),m([_()],c.prototype,"hideConsole",2),m([_()],c.prototype,"locate",2),m([_()],c.prototype,"copy",2),m([_()],c.prototype,"ip",2),m([w()],c.prototype,"position",2),m([w()],c.prototype,"element",2),m([w()],c.prototype,"infoClassName",2),m([w()],c.prototype,"infoWidth",2),m([w()],c.prototype,"show",2),m([w()],c.prototype,"dragging",2),m([w()],c.prototype,"mousePosition",2),m([w()],c.prototype,"open",2),m([w()],c.prototype,"moved",2),m([w()],c.prototype,"hoverSwitch",2),m([w()],c.prototype,"preUserSelect",2),m([w()],c.prototype,"sendType",2),m([function(i,t){return(({finisher:e,descriptor:o})=>(s,n)=>{var r;if(n===void 0){const a=(r=s.originalKey)!==null&&r!==void 0?r:s.key,l=o!=null?{kind:"method",placement:"prototype",key:a,descriptor:o(s.key)}:G(q({},s),{key:a});return e!=null&&(l.finisher=function(h){e(h,a)}),l}{const a=s.constructor;o!==void 0&&Object.defineProperty(s,n,o(n)),e==null||e(a,n)}})({descriptor:e=>{const o={get(){var s,n;return(n=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(i))!==null&&n!==void 0?n:null},enumerable:!0,configurable:!0};if(t){const s=typeof e=="symbol"?Symbol():"__"+e;o.get=function(){var n,r;return this[s]===void 0&&(this[s]=(r=(n=this.renderRoot)===null||n===void 0?void 0:n.querySelector(i))!==null&&r!==void 0?r:null),this[s]}}return o}})}("#inspector-switch")],c.prototype,"inspectorSwitchRef",2),customElements.get("code-inspector-component")||customElements.define("code-inspector-component",c),v.CodeInspectorComponent=c,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});; var inspector = document.createElement('code-inspector-component'); inspector.port = 5679; inspector.hotKeys = 'shiftKey,altKey'; inspector.showSwitch = !!false; inspector.autoToggle = !!true; inspector.hideConsole = !!false; inspector.locate = !!true; inspector.copy = false; inspector.ip = 'localhost'; document.documentElement.append(inspector); } }})();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.defineProperty,
|
|
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;
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
var I = Object.defineProperty,
|
|
2
|
-
var
|
|
1
|
+
var I = Object.defineProperty, V = Object.defineProperties;
|
|
2
|
+
var $ = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var h = Object.getOwnPropertySymbols;
|
|
4
4
|
var j = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
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) => {
|
|
6
6
|
for (var n in t || (t = {}))
|
|
7
|
-
j.call(t, n) &&
|
|
7
|
+
j.call(t, n) && y(e, n, t[n]);
|
|
8
8
|
if (h)
|
|
9
9
|
for (var n of h(t))
|
|
10
|
-
k.call(t, n) &&
|
|
10
|
+
k.call(t, n) && y(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
12
|
+
}, _ = (e, t) => V(e, $(t));
|
|
13
13
|
import { ViteCodeInspectorPlugin as T } from "vite-code-inspector-plugin";
|
|
14
14
|
import P from "webpack-code-inspector-plugin";
|
|
15
|
-
import x from "
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
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) {
|
|
19
20
|
if (e.__esModule)
|
|
20
21
|
return e;
|
|
21
22
|
var t = e.default;
|
|
@@ -42,18 +43,18 @@ function C(e) {
|
|
|
42
43
|
});
|
|
43
44
|
}), n;
|
|
44
45
|
}
|
|
45
|
-
var
|
|
46
|
+
var l = {}, A = {
|
|
46
47
|
get exports() {
|
|
47
|
-
return
|
|
48
|
+
return l;
|
|
48
49
|
},
|
|
49
50
|
set exports(e) {
|
|
50
|
-
|
|
51
|
+
l = e;
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
|
-
const
|
|
54
|
+
const L = {}, S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
54
55
|
__proto__: null,
|
|
55
|
-
default:
|
|
56
|
-
}, Symbol.toStringTag, { value: "Module" })), b = /* @__PURE__ */
|
|
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 = {
|
|
57
58
|
".": {
|
|
58
59
|
types: "./lib/main.d.ts",
|
|
59
60
|
require: "./lib/main.js",
|
|
@@ -66,7 +67,7 @@ const R = {}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
66
67
|
"./lib/cli-options": "./lib/cli-options.js",
|
|
67
68
|
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
68
69
|
"./package.json": "./package.json"
|
|
69
|
-
},
|
|
70
|
+
}, q = {
|
|
70
71
|
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
71
72
|
lint: "standard",
|
|
72
73
|
"lint-readme": "standard-markdown",
|
|
@@ -74,10 +75,10 @@ const R = {}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
74
75
|
test: "tap tests/*.js --100 -Rspec",
|
|
75
76
|
prerelease: "npm test",
|
|
76
77
|
release: "standard-version"
|
|
77
|
-
},
|
|
78
|
+
}, G = {
|
|
78
79
|
type: "git",
|
|
79
80
|
url: "git://github.com/motdotla/dotenv.git"
|
|
80
|
-
},
|
|
81
|
+
}, J = "https://github.com/motdotla/dotenv?sponsor=1", Q = [
|
|
81
82
|
"dotenv",
|
|
82
83
|
"env",
|
|
83
84
|
".env",
|
|
@@ -85,7 +86,7 @@ const R = {}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
85
86
|
"variables",
|
|
86
87
|
"config",
|
|
87
88
|
"settings"
|
|
88
|
-
],
|
|
89
|
+
], z = "README.md", H = "BSD-2-Clause", X = {
|
|
89
90
|
"@definitelytyped/dtslint": "^0.0.133",
|
|
90
91
|
"@types/node": "^18.11.3",
|
|
91
92
|
decache: "^4.6.1",
|
|
@@ -96,33 +97,33 @@ const R = {}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
96
97
|
tap: "^16.3.0",
|
|
97
98
|
tar: "^6.1.11",
|
|
98
99
|
typescript: "^4.8.4"
|
|
99
|
-
},
|
|
100
|
+
}, Z = {
|
|
100
101
|
node: ">=12"
|
|
101
|
-
},
|
|
102
|
+
}, ee = {
|
|
102
103
|
fs: !1
|
|
103
|
-
},
|
|
104
|
-
name:
|
|
105
|
-
version:
|
|
106
|
-
description:
|
|
107
|
-
main:
|
|
108
|
-
types:
|
|
109
|
-
exports:
|
|
110
|
-
scripts:
|
|
111
|
-
repository:
|
|
112
|
-
funding:
|
|
113
|
-
keywords:
|
|
114
|
-
readmeFilename:
|
|
115
|
-
license:
|
|
116
|
-
devDependencies:
|
|
117
|
-
engines:
|
|
118
|
-
browser:
|
|
119
|
-
}, w =
|
|
120
|
-
function
|
|
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) {
|
|
121
122
|
const t = {};
|
|
122
123
|
let n = e.toString();
|
|
123
124
|
n = n.replace(/\r\n?/mg, "\n");
|
|
124
125
|
let o;
|
|
125
|
-
for (; (o =
|
|
126
|
+
for (; (o = se.exec(n)) != null; ) {
|
|
126
127
|
const s = o[1];
|
|
127
128
|
let r = o[2] || "";
|
|
128
129
|
r = r.trim();
|
|
@@ -131,7 +132,7 @@ function oe(e) {
|
|
|
131
132
|
}
|
|
132
133
|
return t;
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function ie(e) {
|
|
135
136
|
const t = O(e), n = i.configDotenv({ path: t });
|
|
136
137
|
if (!n.parsed)
|
|
137
138
|
throw new Error("MISSING_DATA: Cannot parse ".concat(t, " for an unknown reason"));
|
|
@@ -139,33 +140,33 @@ function se(e) {
|
|
|
139
140
|
let r;
|
|
140
141
|
for (let c = 0; c < s; c++)
|
|
141
142
|
try {
|
|
142
|
-
const
|
|
143
|
+
const a = o[c].trim(), u = ue(n, a);
|
|
143
144
|
r = i.decrypt(u.ciphertext, u.key);
|
|
144
145
|
break;
|
|
145
|
-
} catch (
|
|
146
|
+
} catch (a) {
|
|
146
147
|
if (c + 1 >= s)
|
|
147
|
-
throw
|
|
148
|
+
throw a;
|
|
148
149
|
}
|
|
149
150
|
return i.parse(r);
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
-
console.log("[dotenv@".concat(
|
|
152
|
+
function ae(e) {
|
|
153
|
+
console.log("[dotenv@".concat(m, "][INFO] ").concat(e));
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
-
console.log("[dotenv@".concat(
|
|
155
|
+
function le(e) {
|
|
156
|
+
console.log("[dotenv@".concat(m, "][WARN] ").concat(e));
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
-
console.log("[dotenv@".concat(
|
|
158
|
+
function v(e) {
|
|
159
|
+
console.log("[dotenv@".concat(m, "][DEBUG] ").concat(e));
|
|
159
160
|
}
|
|
160
161
|
function D(e) {
|
|
161
162
|
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 : "";
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
+
function ue(e, t) {
|
|
164
165
|
let n;
|
|
165
166
|
try {
|
|
166
167
|
n = new URL(t);
|
|
167
|
-
} catch (
|
|
168
|
-
throw
|
|
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;
|
|
169
170
|
}
|
|
170
171
|
const o = n.password;
|
|
171
172
|
if (!o)
|
|
@@ -179,45 +180,45 @@ function ae(e, t) {
|
|
|
179
180
|
return { ciphertext: c, key: o };
|
|
180
181
|
}
|
|
181
182
|
function O(e) {
|
|
182
|
-
let t =
|
|
183
|
+
let t = g.resolve(process.cwd(), ".env");
|
|
183
184
|
return e && e.path && e.path.length > 0 && (t = e.path), t.endsWith(".vault") ? t : "".concat(t, ".vault");
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
-
return e[0] === "~" ?
|
|
186
|
+
function de(e) {
|
|
187
|
+
return e[0] === "~" ? g.join(ne.homedir(), e.slice(1)) : e;
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
189
|
+
function pe(e) {
|
|
190
|
+
ae("Loading env from encrypted .env.vault");
|
|
190
191
|
const t = i._parseVault(e);
|
|
191
192
|
let n = process.env;
|
|
192
193
|
return e && e.processEnv != null && (n = e.processEnv), i.populate(n, t, e), { parsed: t };
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
-
let t =
|
|
195
|
+
function fe(e) {
|
|
196
|
+
let t = g.resolve(process.cwd(), ".env"), n = "utf8";
|
|
196
197
|
const o = !!(e && e.debug);
|
|
197
|
-
e && (e.path != null && (t =
|
|
198
|
+
e && (e.path != null && (t = de(e.path)), e.encoding != null && (n = e.encoding));
|
|
198
199
|
try {
|
|
199
200
|
const s = i.parse(w.readFileSync(t, { encoding: n }));
|
|
200
201
|
let r = process.env;
|
|
201
202
|
return e && e.processEnv != null && (r = e.processEnv), i.populate(r, s, e), { parsed: s };
|
|
202
203
|
} catch (s) {
|
|
203
|
-
return o &&
|
|
204
|
+
return o && v("Failed to load ".concat(t, " ").concat(s.message)), { error: s };
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
+
function ve(e) {
|
|
207
208
|
const t = O(e);
|
|
208
|
-
return D(e).length === 0 ? i.configDotenv(e) : w.existsSync(t) ? i._configVault(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));
|
|
209
210
|
}
|
|
210
|
-
function
|
|
211
|
+
function ge(e, t) {
|
|
211
212
|
const n = Buffer.from(t.slice(-64), "hex");
|
|
212
213
|
let o = Buffer.from(e, "base64");
|
|
213
214
|
const s = o.slice(0, 12), r = o.slice(-16);
|
|
214
215
|
o = o.slice(12, -16);
|
|
215
216
|
try {
|
|
216
|
-
const c =
|
|
217
|
+
const c = re.createDecipheriv("aes-256-gcm", n, s);
|
|
217
218
|
return c.setAuthTag(r), "".concat(c.update(o)).concat(c.final());
|
|
218
219
|
} catch (c) {
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
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) {
|
|
221
222
|
const d = "INVALID_DOTENV_KEY: It must be 64 characters long (or more)";
|
|
222
223
|
throw new Error(d);
|
|
223
224
|
} else if (N) {
|
|
@@ -227,34 +228,34 @@ function fe(e, t) {
|
|
|
227
228
|
throw console.error("Error: ", c.code), console.error("Error: ", c.message), c;
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function me(e, t, n = {}) {
|
|
231
232
|
const o = !!(n && n.debug), s = !!(n && n.override);
|
|
232
233
|
if (typeof t != "object")
|
|
233
234
|
throw new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
234
235
|
for (const r of Object.keys(t))
|
|
235
|
-
Object.prototype.hasOwnProperty.call(e, r) ? (s === !0 && (e[r] = t[r]), o &&
|
|
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];
|
|
236
237
|
}
|
|
237
238
|
const i = {
|
|
238
|
-
configDotenv:
|
|
239
|
-
_configVault:
|
|
240
|
-
_parseVault:
|
|
241
|
-
config:
|
|
242
|
-
decrypt:
|
|
243
|
-
parse:
|
|
244
|
-
populate:
|
|
239
|
+
configDotenv: fe,
|
|
240
|
+
_configVault: pe,
|
|
241
|
+
_parseVault: ie,
|
|
242
|
+
config: ve,
|
|
243
|
+
decrypt: ge,
|
|
244
|
+
parse: ce,
|
|
245
|
+
populate: me
|
|
245
246
|
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
function
|
|
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) {
|
|
255
256
|
if (!(e != null && e.bundler)) {
|
|
256
257
|
console.log(
|
|
257
|
-
|
|
258
|
+
C.red(
|
|
258
259
|
"Please specify the bundler in the options of code-inspector-plugin."
|
|
259
260
|
)
|
|
260
261
|
);
|
|
@@ -265,16 +266,22 @@ function ge(e) {
|
|
|
265
266
|
if (t = !0, process.env.CODE_INSPECTOR === "true")
|
|
266
267
|
t = !1;
|
|
267
268
|
else {
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
(
|
|
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);
|
|
272
273
|
}
|
|
273
274
|
}
|
|
274
|
-
|
|
275
|
+
let n = "";
|
|
276
|
+
typeof __dirname != "undefined" ? n = __dirname : n = R(x(import.meta.url));
|
|
277
|
+
const o = _(E({}, e), {
|
|
278
|
+
close: t,
|
|
279
|
+
output: f.resolve(n, "./")
|
|
280
|
+
});
|
|
281
|
+
return e.bundler === "webpack" || e.bundler === "rspack" ? new P(o) : T(o);
|
|
275
282
|
}
|
|
276
|
-
const
|
|
283
|
+
const Ne = he;
|
|
277
284
|
export {
|
|
278
|
-
|
|
279
|
-
|
|
285
|
+
he as CodeInspectorPlugin,
|
|
286
|
+
Ne as codeInspectorPlugin
|
|
280
287
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-inspector-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./types/index.d.ts",
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
"types": "./types/index.d.ts",
|
|
22
22
|
"default": "./dist/index.js"
|
|
23
23
|
}
|
|
24
|
+
},
|
|
25
|
+
"./dist/*": {
|
|
26
|
+
"import": {
|
|
27
|
+
"default": "./dist/*"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"default": "./dist/*"
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
},
|
|
26
34
|
"homepage": "https://inspector.fe-dev.cn/en",
|
|
@@ -39,9 +47,9 @@
|
|
|
39
47
|
},
|
|
40
48
|
"dependencies": {
|
|
41
49
|
"chalk": "4.1.1",
|
|
42
|
-
"code-inspector-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
50
|
+
"vite-code-inspector-plugin": "0.14.0-beta.1",
|
|
51
|
+
"webpack-code-inspector-plugin": "0.14.0-beta.1",
|
|
52
|
+
"code-inspector-core": "0.14.0-beta.1"
|
|
45
53
|
},
|
|
46
54
|
"devDependencies": {
|
|
47
55
|
"@types/node": "^16.0.1",
|
|
@@ -50,7 +58,8 @@
|
|
|
50
58
|
"vite": "^4.1.0"
|
|
51
59
|
},
|
|
52
60
|
"scripts": {
|
|
53
|
-
"
|
|
61
|
+
"clear": "rimraf ./dist && rimraf ./types",
|
|
62
|
+
"build": "pnpm clear && tsc && vite build",
|
|
54
63
|
"pub": "pnpm publish",
|
|
55
64
|
"pub:beta": "pnpm publish --tag beta"
|
|
56
65
|
}
|