@rushstack/lockfile-explorer 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.f2224556a037be915214.js +1 -0
- package/dist/index.html +1 -1
- package/lib/init.d.ts +2 -2
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +44 -38
- package/lib/init.js.map +1 -1
- package/lib/start.js +65 -39
- package/lib/start.js.map +1 -1
- package/lib/state/index.d.ts +10 -21
- package/lib/state/index.d.ts.map +1 -1
- package/lib/state/index.js +1 -15
- package/lib/state/index.js.map +1 -1
- package/package.json +10 -6
- package/dist/app.a2846bcee1c8ca4b1bd6.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){"use strict";var e,t={924:function(e,t,n){var a,r,c=n(823),s=n(998),l="HK80a6ZVkdxoTKzrP9Eq",i="HqAzbQwu1zc9yH8ZQESI",o=n(201);!function(e){e[e.DEPENDENCY=0]="DEPENDENCY",e[e.DEV_DEPENDENCY=1]="DEV_DEPENDENCY",e[e.PEER_DEPENDENCY=2]="PEER_DEPENDENCY"}(a||(a={}));class d{constructor(e,t,n,r,c){if(this.entryId="",this.name=e,this.version=t,this.dependencyType=n,this.containingEntry=r,this.peerDependencyMeta={},this.version.startsWith("link:")){const t=this.version.substring("link:".length),n=new o.y(".").relative(new o.y(r.packageJsonFolderPath).concat(t));if(!n)return void console.error("No root relative path for dependency!",e);this.entryId="project:"+n.toString()}else this.version.startsWith("/")?this.entryId=this.version:this.dependencyType===a.PEER_DEPENDENCY?(null==c?void 0:c.peerDependencies)?(this.peerDependencyMeta={name:this.name,version:c.peerDependencies[this.name],optional:!(!c.peerDependenciesMeta||!c.peerDependenciesMeta[this.name])&&c.peerDependenciesMeta[this.name].optional},this.entryId="Peer: "+this.name):console.error("Peer dependencies info missing!",c):this.entryId="/"+this.name+"/"+this.version}static parseDependencies(e,t,n){if(n.dependencies)for(const[r,c]of Object.entries(n.dependencies))e.push(new d(r,c,a.DEPENDENCY,t));if(n.devDependencies)for(const[r,c]of Object.entries(n.devDependencies))e.push(new d(r,c,a.DEV_DEPENDENCY,t));if(n.peerDependencies)for(const[r,c]of Object.entries(n.peerDependencies))e.push(new d(r,c,a.PEER_DEPENDENCY,t,n));if(n.transitivePeerDependencies)for(const e of n.transitivePeerDependencies)t.transitivePeerDependencies.add(e)}}!function(e){e[e.Project=0]="Project",e[e.Package=1]="Package",e[e.SideBySide=2]="SideBySide",e[e.Doppelganger=3]="Doppelganger"}(r||(r={}));class p{constructor(e){this.entryId="",this.packageJsonFolderPath="",this.entryPackageName="",this.displayText="",this.dependencies=[],this.transitivePeerDependencies=new Set,this.referrers=[],this.entryPackageVersion="",this.entrySuffix="";const{rawEntryId:t,kind:n,rawYamlData:a}=e;if(this.rawEntryId=t,this.kind=n,"."!==t){if(n===r.Project){const e=new o.y("common/temp/package.json").dirname()||"",n=new o.y(".").relative(new o.y(e).concat(t)),a=new o.y(t).basename();if(!n||!a)return void console.error("Could not construct path for entry: ",t);this.packageJsonFolderPath=n.toString(),this.entryId="project:"+this.packageJsonFolderPath,this.entryPackageName=a.toString(),this.displayText="Project: "+this.entryPackageName}else{this.displayText=t;const e=p._packageEntryIdRegex.exec(t);if(e){const[,t,n]=e;this.entryPackageName=t;const a=n.indexOf("_");if(a>=0){const e=n.substring(0,a),r=n.substring(a+1);this.entryPackageVersion=e,this.entrySuffix=r,this.displayText=t+" "+e+" ("+r+")"}else this.entryPackageVersion=n,this.displayText=t+" "+n}this.packageJsonFolderPath="common/temp/node_modules/.pnpm/"+this.entryPackageName.replace("/","+")+"@"+this.entryPackageVersion+(this.entrySuffix?`_${this.entrySuffix}`:"")+"/node_modules/"+this.entryPackageName}d.parseDependencies(this.dependencies,this,a)}}}p._packageEntryIdRegex=new RegExp("/(.*)/([^/]+)$");const m=window.appContext.serviceUrl;var E="OcndyDBetZor3ptzTnTX",u="Wg5pG3RVf6SQ51i0tVkd",f="NBIr3yosJ9gX6LZcnC7T",y="IWEAxDEzQLw3g5TI_6up";const h=null;var k=n(775);const g=k.I0,v=k.v9;var P=n(628);const N="LOCKFILE_EXPLORER_BOOKMARKS",S="LOCKFILE_EXPLORER_PROJECT_FILTER",w="LOCKFILE_EXPLORER_PACKAGE_FILTER",C=e=>e===r.Project?localStorage.getItem(S)||"":localStorage.getItem(w)||"",D={allEntries:[],filters:{[r.Project]:!1,[r.Package]:!0,[r.SideBySide]:!1,[r.Doppelganger]:!1},selectedEntryStack:[],selectedEntryForwardStack:[],bookmarkedEntries:[]},b=(0,P.oM)({name:"entry",initialState:D,reducers:{loadEntries:(e,t)=>{e.allEntries=t.payload;const n=(()=>{const e=JSON.parse(localStorage.getItem(N)||"{}"),t=new Set;for(const n of Object.keys(e))t.add(n);return t})();for(const a of t.payload)n.has(a.rawEntryId)&&e.bookmarkedEntries.push(a)},setFilter:(e,t)=>{e.filters[t.payload.filter]=t.payload.state},clearStackAndPush:(e,t)=>{e.selectedEntryStack=[t.payload],e.selectedEntryForwardStack=[]},pushToStack:(e,t)=>{e.selectedEntryStack.push(t.payload),e.selectedEntryForwardStack=[],t.payload.kind===r.Package?(e.filters[r.Project]=!1,e.filters[r.Package]=!0):(e.filters[r.Project]=!0,e.filters[r.Package]=!1)},popStack:e=>{if(e.selectedEntryStack.length>1){const t=e.selectedEntryStack.pop();e.selectedEntryForwardStack.push(t),e.selectedEntryStack.length>=1&&(e.selectedEntryStack[e.selectedEntryStack.length-1].kind===r.Package?(e.filters[r.Project]=!1,e.filters[r.Package]=!0):(e.filters[r.Project]=!0,e.filters[r.Package]=!1))}},forwardStack:e=>{if(e.selectedEntryForwardStack.length>0){const t=e.selectedEntryForwardStack.pop();e.selectedEntryStack.push(t),t.kind===r.Package?(e.filters[r.Project]=!1,e.filters[r.Package]=!0):(e.filters[r.Project]=!0,e.filters[r.Package]=!1)}},addBookmark:(e,t)=>{e.bookmarkedEntries.includes(t.payload)||(e.bookmarkedEntries.push(t.payload),(e=>{const t=e.rawEntryId,n=JSON.parse(localStorage.getItem(N)||"{}");n[t]=!0,localStorage.setItem(N,JSON.stringify(n))})(t.payload))},removeBookmark:(e,t)=>{e.bookmarkedEntries=e.bookmarkedEntries.filter((e=>e.rawEntryId!==t.payload.rawEntryId)),(e=>{const t=e.rawEntryId,n=JSON.parse(localStorage.getItem(N)||"{}");delete n[t],localStorage.setItem(N,JSON.stringify(n))})(t.payload)}}}),j=e=>e.entry.selectedEntryStack.length?e.entry.selectedEntryStack[e.entry.selectedEntryStack.length-1]:void 0,O=e=>{const t=[];return e.entry.filters[r.Package]?t.push(...e.entry.allEntries.filter((e=>e.kind===r.Package))):e.entry.filters[r.Project]&&t.push(...e.entry.allEntries.filter((e=>e.kind===r.Project))),t},{loadEntries:I,setFilter:_,clearStackAndPush:x,pushToStack:A,popStack:R,forwardStack:T,addBookmark:F,removeBookmark:J}=b.actions,M=b.reducer;const $=({options:e})=>c.createElement("div",{className:"b1H6mzJXpxsG350hyeU_"},e.map((e=>c.createElement("div",{key:e.text,className:"mWhs4CnCA0TKj6CRR8gk "+(e.active?"Q9WEwAuQb3UsVbcHr0oI":""),onClick:e.onClick},e.text)))),K=({group:e})=>{const t=v(j),n=v((e=>e.entry.filters)),a=g(),s=(0,c.useRef)(),l=(0,c.useCallback)((e=>()=>{a(A(e))}),[]);return(0,c.useEffect)((()=>{t&&t.entryPackageName===e.entryName&&s.current.scrollIntoView({behavior:"smooth"})}),[t,e]),n[r.Project]?c.createElement("div",{className:E,ref:s},e.versions.map((e=>c.createElement("div",{key:e.rawEntryId,onClick:l(e),className:`${u} ${(null==t?void 0:t.rawEntryId)===e.rawEntryId?f:""}`},c.createElement("h5",null,e.entryPackageName))))):c.createElement("div",{className:E,ref:s},c.createElement("h5",null,e.entryName),e.versions.map((e=>c.createElement("div",{key:e.rawEntryId,onClick:l(e),className:`${u} ${(null==t?void 0:t.rawEntryId)===e.rawEntryId?f:""}`},c.createElement("p",null,e.entryPackageVersion," ",e.entrySuffix&&`[${e.entrySuffix}]`)))))},G=()=>{const e=g(),[t,n]=(0,c.useState)(""),[a,s]=(0,c.useState)(""),i=v(O),o=v((e=>e.entry.filters)),d=(0,c.useCallback)((e=>t=>{e===r.Project?n(t.target.value):s(t.target.value),((e,t)=>{t===r.Project?localStorage.setItem(S,e):localStorage.setItem(w,e)})(t.target.value,e)}),[]);if((0,c.useEffect)((()=>{n(C(r.Project)),s(C(r.Package))}),[]),!i)return h;const p=(0,c.useCallback)(((t,n)=>()=>{e(_({filter:t,state:n}))}),[]),m=(0,c.useCallback)((t=>()=>{t===r.Project?(e(_({filter:r.Project,state:!0})),e(_({filter:r.Package,state:!1}))):(e(_({filter:r.Package,state:!0})),e(_({filter:r.Project,state:!1})))}),[o]);return c.createElement("div",{className:"yk7wrFMnnNyYLABMBhz_"},c.createElement($,{options:[{text:"Projects",active:o[r.Project],onClick:m(r.Project)},{text:"Packages",active:o[r.Package],onClick:m(r.Package)}]}),c.createElement("div",{className:`X00sOTmx1ir4Oc41DIvM ${l}`},c.createElement("div",{className:"oq4FJVnF_fONdOKuiK0w"},c.createElement("input",{type:"search",placeholder:"Filter...",value:o[r.Project]?t:a,onChange:d(o[r.Project]?r.Project:r.Package)})),c.createElement("div",{className:"PoJj8_8xv9BXiMVPKFVE"},(()=>{let e=i;t&&o[r.Project]?e=i.filter((e=>-1!==e.entryPackageName.indexOf(t))):a&&o[r.Package]&&(e=i.filter((e=>-1!==e.entryPackageName.indexOf(a))));const n=e.reduce(((e,t)=>{const n=e[t.entryPackageName]||[];return n.push(t),e[t.entryPackageName]=n,e}),{});let c=[];for(const[e,t]of Object.entries(n))c.push({entryName:e,versions:t});return o[r.SideBySide]&&(c=c.filter((e=>e.versions.length>1))),o[r.Doppelganger]&&(c=c.filter((e=>(e=>{const t=new Set;for(const n of e){if(t.has(n.entryPackageVersion))return!0;t.add(n.entryPackageVersion)}return!1})(e.versions)))),c})().map((e=>c.createElement(K,{group:e,key:e.entryName})))),o[r.Package]?c.createElement("div",{className:"K6dDN5KzjLkbPPFWUaly"},c.createElement("h5",null,"Filters"),c.createElement("div",{className:y,onClick:p(r.SideBySide,!o[r.SideBySide])},c.createElement("input",{type:"checkbox",checked:o[r.SideBySide],readOnly:!0}),c.createElement("h5",null,"Must have side-by-side versions")),c.createElement("div",{className:y,onClick:p(r.Doppelganger,!o[r.Doppelganger])},c.createElement("input",{type:"checkbox",checked:o[r.Doppelganger],readOnly:!0}),c.createElement("h5",null,"Must have doppelgangers"))):null))},V=`${window.appContext.serviceUrl}/api`;var Y="rXOH6AJQU2eYrNAXbp4V";const B={specChanges:new Map},L=(0,P.oM)({name:"workspace",initialState:B,reducers:{loadSpecChanges:(e,t)=>{e.specChanges=t.payload}}}),{loadSpecChanges:z}=L.actions,H=L.reducer,X=(e,t)=>{var n;switch(null===(n=e.get(t))||void 0===n?void 0:n.type){case"add":return"[Added by .pnpmfile.cjs]";case"diff":return"[Changed from {specChanges.get(dep)?.from}]";case"remove":return"[Deleted by .pnpmfile.cjs]";default:return"No Change"}},W=(e,t)=>{if(!e)return!1;for(const n of e.dependencies)if(t.has(n.name))return!0;return!1};var Z;!function(e){e[e.PACKAGE_JSON=0]="PACKAGE_JSON",e[e.PACKAGE_SPEC=1]="PACKAGE_SPEC",e[e.PARSED_PACKAGE_JSON=2]="PARSED_PACKAGE_JSON"}(Z||(Z={}));const Q=()=>{const e=g(),[t,n]=(0,c.useState)(void 0),[a,r]=(0,c.useState)(void 0),[s,i]=(0,c.useState)(""),o=v(j),d=v((e=>e.workspace.specChanges)),[p,m]=(0,c.useState)(Z.PARSED_PACKAGE_JSON),E=(0,c.useCallback)((e=>()=>m(e)),[]);(0,c.useEffect)((()=>{(async function(){const e=await async function(){try{const e=await fetch(`${V}/pnpmfile`);return await e.text()}catch(e){return console.error("Could not load cjs file: ",e),"Missing CJS"}}();i(e)})().catch((e=>{console.error(`Failed to load project's pnpm file: ${e}`)}))}),[]),(0,c.useEffect)((()=>{o&&(o.entryPackageName?async function(t){const a=await async function(e){try{const t=await fetch(`${V}/package-json`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e})});return await t.json()}catch(e){return void console.error("Could not load package json file: ",e)}}(t);n(a);const c=await async function(e){try{const t=await fetch(`${V}/package-spec`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e})});return await t.json()}catch(e){return void console.error("Could not load cjs file: ",e)}}(t);if(r(c),a&&c){const t=((e,t)=>{const n=new Map,a=new Map;for(const[t,a]of Object.entries(Object.assign(Object.assign(Object.assign({},e.dependencies),e.devDependencies),e.peerDependencies)))n.set(t,a);for(const[e,n]of Object.entries(Object.assign(Object.assign(Object.assign({},t.dependencies),t.devDependencies),t.peerDependencies)))a.set(e,n);const r=new Map;for(const e of n.keys())a.has(e)?a.get(e)!==n.get(e)&&r.set(e,{type:"diff",packageName:e,from:n.get(e),to:a.get(e)}):r.set(e,{type:"remove",packageName:e});for(const e of a.keys())n.has(e)||r.set(e,{type:"add",packageName:e});return r})(a,c);e(z(t))}}(o.packageJsonFolderPath).catch((e=>{console.error(`Failed to load project information: ${e}`)})):console.log("The selected entry has no entry name: ",o.entryPackageName))}),[o]);const u=e=>t=>{var n;const[a,r]=t;if(!d.has(a))return e?c.createElement("p",{key:a},a,":"):c.createElement("p",{key:a},r);switch(null===(n=d.get(a))||void 0===n?void 0:n.type){case"add":return e?c.createElement("p",{key:a},c.createElement("span",{className:"nTIc62ACgp5xMWIvZ4cn"},a)):c.createElement("p",{key:a},r," ",X(d,a));case"diff":return e?c.createElement("p",{key:a},c.createElement("span",{className:"I4A8ZZlpCL3Op0c53VjN"},a)):c.createElement("p",{key:a},r," ",X(d,a));case"remove":return e?c.createElement("p",{key:a},c.createElement("span",{className:"iavWjvHy9s5MhCZ_ncgb"},a)):c.createElement("p",{key:a},r," ",X(d,a));default:return e?c.createElement("p",{key:a},a,":"):c.createElement("p",{key:a},r)}};return c.createElement("div",{className:"kzgyQkswpx6xUEo4zOa8"},c.createElement($,{options:[{text:"package spec "+(W(o,d)?"*":""),active:p===Z.PARSED_PACKAGE_JSON,onClick:E(Z.PARSED_PACKAGE_JSON)},{text:"package.json",active:p===Z.PACKAGE_JSON,onClick:E(Z.PACKAGE_JSON)},{text:".pnpmfile.cjs",active:p===Z.PACKAGE_SPEC,onClick:E(Z.PACKAGE_SPEC)}]}),c.createElement("div",{className:l},c.createElement("div",{className:"e2KEBfZCHwEMeH4j6wS7"},(()=>{switch(p){case Z.PACKAGE_JSON:return t?c.createElement("pre",null,JSON.stringify(t,null,2)):c.createElement("h5",null,"Please select a Project or Package to view it's package.json");case Z.PACKAGE_SPEC:return s?c.createElement("pre",null,s):c.createElement("h5",null,"Couldn't load the pnpmfile.cjs file - does it exist in the expected location? (/common/config/rush/.pnpmfile.cjs)");case Z.PARSED_PACKAGE_JSON:return a?c.createElement("div",{className:"Ko0YQxSlY0hCIDTfmNlr"},c.createElement("div",{className:Y},c.createElement("h5",null,"Package Name:"),c.createElement("p",null,null==o?void 0:o.displayText)),c.createElement("div",{className:Y},c.createElement("h5",null,"Version:"),c.createElement("p",null,null==o?void 0:o.entryPackageVersion)),c.createElement("div",{className:"hqNteMkwhYXuZqHE_8MJ"},c.createElement("div",null,c.createElement("h5",null,"Dependencies"),a.dependencies&&Object.entries(a.dependencies).map(u(!0)),c.createElement("h5",null,"Dev Dependencies"),a.devDependencies&&Object.entries(a.devDependencies).map(u(!0)),c.createElement("h5",null,"Peer Dependencies"),a.peerDependencies&&Object.entries(a.peerDependencies).map(u(!0))),c.createElement("div",null,c.createElement("h5",null," "),a.dependencies&&Object.entries(a.dependencies).map(u(!1)),c.createElement("h5",null," "),a.devDependencies&&Object.entries(a.devDependencies).map(u(!1)),c.createElement("h5",null," "),a.peerDependencies&&Object.entries(a.peerDependencies).map(u(!1))))):c.createElement("h5",null,"Please select a Project or Package to view the parsed package.json");default:return null}})())))};var U,q="_R50_3JsFs2FC9kVffQL",ee="mRQWdzXzOM1NpFUpYnhP",te="rIv2KvSZ0CKMbctSHL04",ne="wzeVrHi3oyOhEe6qD3PX",ae="lGp34XdOFjHfZNwiilgC";!function(e){e[e.Determinant=0]="Determinant",e[e.TransitiveReferrer=1]="TransitiveReferrer"}(U||(U={}));const re=()=>{var e,t;const n=v(j),r=v((e=>e.workspace.specChanges)),s=g(),[i,o]=(0,c.useState)(null),[d,p]=(0,c.useState)([]);(0,c.useEffect)((()=>{n&&o(null)}),[n]);const m=(0,c.useCallback)((e=>()=>{if(i&&i.entryId===e.entryId)e.resolvedEntry?s(A(e.resolvedEntry)):((...e)=>{window.appContext.debugMode&&console.log("Diagnostic: ",...e)})("No resolved entry for dependency:",e);else if(n){if(console.log("dependency to trace: ",e),o(e),e.dependencyType!==a.PEER_DEPENDENCY)return;const t=[n],r=new Set,c=new Set,s=new Set;for(s.add(n);t.length;){const n=t.pop();if(n)for(const a of n.referrers){let l=!1;for(const t of a.dependencies)if(t.name===e.name){r.add(a),l=!0;break}if(!l){a.transitivePeerDependencies.has(e.name)?c.add(a):console.error('Error analyzing influencers: A referrer appears to be missing its "transitivePeerDependencies" field in the YAML file: ',e,a,n);for(const e of n.referrers)s.has(e)||(t.push(e),s.add(e))}}}const l=[];for(const e of r.values())l.push({entry:e,type:U.Determinant});for(const e of c.values())l.push({entry:e,type:U.TransitiveReferrer});p(l)}}),[n,i]),E=(0,c.useCallback)((e=>()=>{console.log("going to entry: ",e),s(A(e))}),[n]);return n?c.createElement(c.Fragment,null,c.createElement("div",{className:"KWDuEbG1GmwLxFmPPppw"},c.createElement("div",{className:l},c.createElement("h5",null,"Direct Referrers"),c.createElement("div",{className:q},null===(e=n.referrers)||void 0===e?void 0:e.map((e=>c.createElement("div",{className:ee,key:e.rawEntryId,onClick:E(e)},c.createElement("h5",null,"Name: ",e.displayText),c.createElement("div",null,c.createElement("p",null,"Entry ID: ",e.rawEntryId))))))),c.createElement("div",{className:l},c.createElement("h5",null,"Direct Dependencies"),c.createElement("div",{className:q},null===(t=n.dependencies)||void 0===t?void 0:t.map((e=>c.createElement("div",{className:`${ee} ${(null==i?void 0:i.entryId)===e.entryId&&"GbZbP1wHbcReGrxpZ3Ra"}`,key:e.entryId||e.name,onClick:m(e)},c.createElement("h5",null,"Name: ",e.name," ",e.dependencyType===a.PEER_DEPENDENCY?(e.peerDependencyMeta.optional?"(Optional)":"(Non-optional)")+" Peer Dependency":""),c.createElement("div",null,c.createElement("p",null,"Version: ",e.version),c.createElement("p",null,"Entry ID: ",e.entryId)))))))),i?c.createElement("div",{className:`${l} xSxHmjxIXTOSskLhma3A`},c.createElement("div",{className:ae},c.createElement("h5",null,"Selected Dependency: "),c.createElement("span",null,i.name,": ",i.version)),c.createElement("div",{className:ae},c.createElement("h5",null,"package.json spec: "),c.createElement("span",null,i.dependencyType===a.PEER_DEPENDENCY?`"${i.peerDependencyMeta.version}" ${i.peerDependencyMeta.optional?"Optional":"Required"} Peer`:i.version)),c.createElement("div",{className:ae},c.createElement("h5",null,".pnpmfile.cjs: "),c.createElement("span",null,r.has(i.name)?X(r,i.name):"No Effect"))):h,(()=>{if(!n)return h;if(!n.dependencies.filter((e=>e.dependencyType===a.PEER_DEPENDENCY)).length)return c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"No peer dependencies."));if(!i||i.dependencyType!==a.PEER_DEPENDENCY)return c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"Select a peer dependency to view its influencers"));const e=d.filter((e=>e.type===U.Determinant)),t=d.filter((e=>e.type===U.TransitiveReferrer));return c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"Determinants:"),e.length?e.map((({entry:e})=>c.createElement("a",{className:ne,key:e.rawEntryId,onClick:E(e)},e.displayText))):c.createElement("p",null,"(none)"),c.createElement("h5",{className:"aKaZTElUypfUGQWhNJON"},"Transitive Referencers:"),t.length?t.map((({entry:e})=>c.createElement("a",{className:ne,key:e.rawEntryId,onClick:E(e)},e.displayText))):c.createElement("p",null,"(none)"))})()):c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"Select an entry to view its details"))};const ce=()=>{const e=v((e=>e.entry.bookmarkedEntries)),t=g(),n=(0,c.useCallback)((e=>()=>{t(x(e))}),[]),a=(0,c.useCallback)((e=>()=>{t(J(e))}),[]);return c.createElement("div",{className:`${l} aM5oGgiHs9rRHcHdAqFh`},c.createElement("h5",null,"Bookmarks"),c.createElement("hr",null),e.map((e=>c.createElement("div",{key:e.rawEntryId,className:"Ci1rEoM4eR29ZJcnvJJE"},c.createElement("p",{onClick:n(e)},e.displayText),c.createElement("button",{onClick:a(e)},"Remove")))))};var se="dklLbMzvzbuzLd2XJh3W",le="vJvmAdZ2VafvyXjc16Mz";const ie=()=>{const e=v(j),t=v((t=>!!e&&t.entry.bookmarkedEntries.includes(e))),n=v((e=>e.entry.selectedEntryStack)),a=v((e=>e.entry.selectedEntryForwardStack)),r=g(),s=(0,c.useCallback)((()=>{e&&r(F(e))}),[e]),l=(0,c.useCallback)((()=>{e&&r(J(e))}),[e]),i=(0,c.useCallback)((()=>{r(R())}),[]),o=(0,c.useCallback)((()=>{r(T())}),[]),d=()=>c.createElement("div",{className:"LkGUkEuAC1lrNLYWXZAB"},c.createElement("button",{disabled:n.length<=1,onClick:i},"Back"),c.createElement("button",{disabled:0===a.length,onClick:o},"Forward"),t?c.createElement("button",{onClick:l,disabled:!e},"Remove Bookmark"):c.createElement("button",{onClick:s,disabled:!e},"Add Bookmark"));return e?c.createElement("div",{className:se},c.createElement("div",{className:le},c.createElement("div",{className:"Hd2WYHIwrFrldD0I8qDj"},c.createElement("h5",null,"Selected entry:"),c.createElement("span",null,e.displayText)),d()),c.createElement("div",null,c.createElement("p",null,"Package Entry: ",e.rawEntryId),c.createElement("p",null,"Package JSON path: ",e.packageJsonFolderPath))):c.createElement("div",{className:se},c.createElement("div",{className:le},c.createElement("h5",null,"No Entry Selected"),d()))};var oe="wR2C2OTixe7QR738j44h",de="Oo_rkIqOkO0j8slDAm5V";const pe=()=>{const e=window.appContext.appVersion;return c.createElement("div",{className:"mqcpXwTQfD4A2eS4QRMa"},c.createElement("div",{className:"gxAXHLK7j_oYpFDmIJLR"},c.createElement("img",{className:oe,src:n(769)})),c.createElement("div",null,c.createElement("a",{href:"https://lfx.rushstack.io/",target:"_blank",rel:"noreferrer"},c.createElement("div",{className:"rHArsuIMBTbIFs5o2cuw"},c.createElement("img",{className:oe,src:n(500)})),c.createElement("div",{className:"P6XzPBuW8Osze59RSui1"},c.createElement("img",{className:oe,src:n(126)})),c.createElement("div",{className:de},e)),c.createElement("a",{href:"https://rushstack.io/",target:"_blank",rel:"noreferrer"},c.createElement("div",{className:de},"rushstack.io"))))};const me=()=>{const[e,t]=(0,c.useState)(!0),[n,a]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1);async function i(){await async function(){try{return await fetch(`${V}/health`),!0}catch(e){return!1}}()?t(!0):t(!1),a(!1)}(0,c.useEffect)((()=>{window.setInterval(i,2e3)}),[]);const o=(0,c.useCallback)((()=>{a(!0),s(!0),i().catch((e=>{console.error(`Unexpected exception: ${e}`)}))}),[]);return e?null:c.createElement("div",{className:"uVMB4BjTN3pGKpcO9hFB"},c.createElement("div",{className:`gyz87hLRy_DyMUyraMaM ${l}`},c.createElement("h5",null,"The server has disconnected!"),r?c.createElement("p",null,"We were still not able to establish a connection to the server. Are you sure it is running?"):c.createElement("p",null,"Please re-start the local development server to continue using this application."),c.createElement("div",{className:"UkJzWedRWYeVMPCVDmCS"},c.createElement("button",{disabled:n,onClick:o},"Check Again"),n?c.createElement("p",null,"Checking..."):null)))},Ee=(0,P.xC)({reducer:{entry:M,workspace:H},middleware:e=>e({serializableCheck:!1})}),ue=document.getElementById("root");s.render(c.createElement(k.zt,{store:Ee},c.createElement((()=>{const e=g();return(0,c.useEffect)((()=>{(async function(){const t=await async function(){const e=await fetch(`${m}/api/lockfile`);return function(e){const t=[],n={},c=[];if(e.importers)for(const[a,s]of Object.entries(e.importers)){const e=new p({rawEntryId:a,kind:r.Project,rawYamlData:s});c.push(e),t.push(e),n[e.entryId]=e}const s=[];if(e.packages)for(const[a,c]of Object.entries(e.packages)){const e=new p({rawEntryId:a,kind:r.Package,rawYamlData:c});s.push(e),t.push(e),n[a]=e}for(const e of t)for(const t of e.dependencies){if(t.dependencyType===a.PEER_DEPENDENCY)continue;const r=n[t.entryId];r?(t.resolvedEntry=r,r.referrers.push(e)):console.error("Could not resolve dependency entryId: ",t.entryId)}return t}(await e.json())}();e(I(t))})().catch((e=>{console.log(`Failed to read lockfile: ${e}`)}))}),[]),c.createElement(c.Fragment,null,c.createElement(me,null),c.createElement("div",{className:"uXEYthi0e8fjYu_FisVm"},c.createElement("div",{className:"ms-Grid",dir:"ltr"},c.createElement("div",{className:"ms-Grid-row"},c.createElement("div",{className:`ms-Grid-col ms-sm3 ${i}`},c.createElement(G,null)),c.createElement("div",{className:`ms-Grid-col ms-sm7 ${i}`},c.createElement(ie,null),c.createElement(Q,null),c.createElement(re,null)),c.createElement("div",{className:`ms-Grid-col ms-sm2 ${i}`},c.createElement(pe,null),c.createElement(ce,null))))))}),null)),ue)},769:function(e,t,n){e.exports=n.p+"d39919ddc699d58b84ba.svg"},500:function(e,t,n){e.exports=n.p+"d13d30e9b42faf842d2f.svg"},126:function(e,t,n){e.exports=n.p+"510f03f81080fd3cfd63.svg"}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var c=n[e]={exports:{}};return t[e](c,c.exports,a),c.exports}a.m=t,e=[],a.O=function(t,n,r,c){if(!n){var s=1/0;for(d=0;d<e.length;d++){n=e[d][0],r=e[d][1],c=e[d][2];for(var l=!0,i=0;i<n.length;i++)(!1&c||s>=c)&&Object.keys(a.O).every((function(e){return a.O[e](n[i])}))?n.splice(i--,1):(l=!1,c<s&&(s=c));if(l){e.splice(d--,1);var o=r();void 0!==o&&(t=o)}}return t}c=c||0;for(var d=e.length;d>0&&e[d-1][2]>c;d--)e[d]=e[d-1];e[d]=[n,r,c]},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e}(),function(){var e={143:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,c,s=n[0],l=n[1],i=n[2],o=0;if(s.some((function(t){return 0!==e[t]}))){for(r in l)a.o(l,r)&&(a.m[r]=l[r]);if(i)var d=i(a)}for(t&&t(n);o<s.length;o++)c=s[o],a.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return a.O(d)},n=self.webpackChunk_rushstack_lockfile_explorer_web=self.webpackChunk_rushstack_lockfile_explorer_web||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var r=a.O(void 0,[414],(function(){return a(924)}));r=a.O(r)}();
|
package/dist/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Lockfile Explorer</title><link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css"/><script defer="defer" src="initappcontext.js"></script><script defer="defer" src="414.f8e7585f91bc428fbe8e.js"></script><script defer="defer" src="app.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Lockfile Explorer</title><link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css"/><script defer="defer" src="initappcontext.js"></script><script defer="defer" src="414.f8e7585f91bc428fbe8e.js"></script><script defer="defer" src="app.f2224556a037be915214.js"></script><link href="app.1d93099dbf4344c15207.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
package/lib/init.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const init: () =>
|
|
1
|
+
import { type IAppState } from './state';
|
|
2
|
+
export declare const init: () => IAppState;
|
|
3
3
|
//# sourceMappingURL=init.d.ts.map
|
package/lib/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,SAAS,EAAoC,MAAM,SAAS,CAAC;AAE3E,eAAO,MAAM,IAAI,QAAO,SA2DvB,CAAC"}
|
package/lib/init.js
CHANGED
|
@@ -1,59 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
3
|
// See LICENSE in the project root for license information.
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
5
|
exports.init = void 0;
|
|
9
6
|
// This function will read the current directory and try to figure out if it's a rush project or regular pnpm workspace
|
|
10
7
|
// Currently it will throw error if neither can be determined
|
|
11
|
-
const
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
13
9
|
const state_1 = require("./state");
|
|
14
10
|
const init = () => {
|
|
15
11
|
const currDir = process.cwd();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
while (path_1.default.resolve(currExploredDir) !== '/') {
|
|
12
|
+
const lockfileExplorerProjectRoot = node_core_library_1.PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname);
|
|
13
|
+
const appVersion = node_core_library_1.JsonFile.load(`${lockfileExplorerProjectRoot}/package.json`).version;
|
|
14
|
+
let appState;
|
|
15
|
+
let currExploredDir = node_core_library_1.Path.convertToSlashes(currDir);
|
|
16
|
+
while (currExploredDir.includes('/')) {
|
|
22
17
|
// Look for a rush.json [rush project] or pnpm-lock.yaml file [regular pnpm workspace]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
const rushJsonPath = `${currExploredDir}/rush.json`;
|
|
19
|
+
const pnpmLockPath = `${currExploredDir}/pnpm-lock.yaml`;
|
|
20
|
+
if (node_core_library_1.FileSystem.exists(rushJsonPath)) {
|
|
21
|
+
console.log('found rush project: ', rushJsonPath);
|
|
22
|
+
// Load the rush projects
|
|
23
|
+
const rushJson = node_core_library_1.JsonFile.load(rushJsonPath);
|
|
24
|
+
const projectsByProjectFolder = new Map();
|
|
25
|
+
for (const project of rushJson.projects) {
|
|
26
|
+
projectsByProjectFolder.set(project.projectFolder, {
|
|
27
|
+
projectName: project.packageName,
|
|
28
|
+
projectFolder: project.projectFolder
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
appState = {
|
|
32
|
+
currDir,
|
|
33
|
+
appVersion,
|
|
34
|
+
lockfileExplorerProjectRoot,
|
|
35
|
+
projectType: state_1.ProjectType.RUSH_PROJECT,
|
|
36
|
+
pnpmLockfileLocation: `${currExploredDir}/common/config/rush/pnpm-lock.yaml`,
|
|
37
|
+
pnpmfileLocation: `${currExploredDir}/common/config/rush/.pnpmfile.cjs`,
|
|
38
|
+
projectRoot: currExploredDir,
|
|
39
|
+
rush: {
|
|
40
|
+
rushJsonPath,
|
|
41
|
+
projectsByProjectFolder
|
|
42
|
+
}
|
|
43
|
+
};
|
|
29
44
|
break;
|
|
30
45
|
}
|
|
31
|
-
else if (
|
|
32
|
-
appState
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
else if (node_core_library_1.FileSystem.exists(pnpmLockPath)) {
|
|
47
|
+
appState = {
|
|
48
|
+
currDir,
|
|
49
|
+
appVersion,
|
|
50
|
+
lockfileExplorerProjectRoot,
|
|
51
|
+
projectType: state_1.ProjectType.PNPM_WORKSPACE,
|
|
52
|
+
pnpmLockfileLocation: `${currExploredDir}/pnpm-lock.yaml`,
|
|
53
|
+
pnpmfileLocation: `${currExploredDir}/.pnpmfile.cjs`,
|
|
54
|
+
projectRoot: currExploredDir
|
|
55
|
+
};
|
|
36
56
|
break;
|
|
37
57
|
}
|
|
38
|
-
currExploredDir
|
|
58
|
+
currExploredDir = currExploredDir.substring(0, currExploredDir.lastIndexOf('/'));
|
|
39
59
|
}
|
|
40
|
-
if (!appState
|
|
60
|
+
if (!appState) {
|
|
41
61
|
throw new Error('Could not find a rush or pnpm project!');
|
|
42
62
|
}
|
|
43
|
-
if (appState.projectType === state_1.ProjectType.RUSH_PROJECT) {
|
|
44
|
-
// Load the rush projects
|
|
45
|
-
const rushJsonString = fs_1.default.readFileSync(path_1.default.join(appState.projectRoot, 'rush.json')).toString();
|
|
46
|
-
const parsedRushJsonString = rushJsonString.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => (g ? '' : m));
|
|
47
|
-
const rushJson = JSON.parse(parsedRushJsonString);
|
|
48
|
-
const projects = {};
|
|
49
|
-
for (const project of rushJson.projects) {
|
|
50
|
-
projects[project.projectFolder] = {
|
|
51
|
-
projectName: project.packageName,
|
|
52
|
-
projectFolder: project.projectFolder
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
appState.rush.projects = projects;
|
|
56
|
-
}
|
|
57
63
|
return appState;
|
|
58
64
|
};
|
|
59
65
|
exports.init = init;
|
package/lib/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,uHAAuH;AACvH,6DAA6D;AAE7D,oEAA6F;AAG7F,mCAA2E;AAEpE,MAAM,IAAI,GAAG,GAAc,EAAE;IAClC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9B,MAAM,2BAA2B,GAAW,qCAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,SAAS,CAAE,CAAC;IAC1G,MAAM,UAAU,GAAW,4BAAQ,CAAC,IAAI,CAAC,GAAG,2BAA2B,eAAe,CAAC,CAAC,OAAO,CAAC;IAEhG,IAAI,QAA+B,CAAC;IACpC,IAAI,eAAe,GAAG,wBAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrD,OAAO,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACpC,sFAAsF;QACtF,MAAM,YAAY,GAAW,GAAG,eAAe,YAAY,CAAC;QAC5D,MAAM,YAAY,GAAW,GAAG,eAAe,iBAAiB,CAAC;QACjE,IAAI,8BAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YACnC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;YAClD,yBAAyB;YACzB,MAAM,QAAQ,GAA2B,4BAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACrE,MAAM,uBAAuB,GAAqC,IAAI,GAAG,EAAE,CAAC;YAC5E,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE;gBACvC,uBAAuB,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE;oBACjD,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,aAAa,EAAE,OAAO,CAAC,aAAa;iBACrC,CAAC,CAAC;aACJ;YAED,QAAQ,GAAG;gBACT,OAAO;gBACP,UAAU;gBACV,2BAA2B;gBAC3B,WAAW,EAAE,mBAAW,CAAC,YAAY;gBACrC,oBAAoB,EAAE,GAAG,eAAe,oCAAoC;gBAC5E,gBAAgB,EAAE,GAAG,eAAe,mCAAmC;gBACvE,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE;oBACJ,YAAY;oBACZ,uBAAuB;iBACxB;aACF,CAAC;YACF,MAAM;SACP;aAAM,IAAI,8BAAU,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAC1C,QAAQ,GAAG;gBACT,OAAO;gBACP,UAAU;gBACV,2BAA2B;gBAC3B,WAAW,EAAE,mBAAW,CAAC,cAAc;gBACvC,oBAAoB,EAAE,GAAG,eAAe,iBAAiB;gBACzD,gBAAgB,EAAE,GAAG,eAAe,gBAAgB;gBACpD,WAAW,EAAE,eAAe;aAC7B,CAAC;YAEF,MAAM;SACP;QAED,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;KAClF;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA3DW,QAAA,IAAI,QA2Df","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n// This function will read the current directory and try to figure out if it's a rush project or regular pnpm workspace\n// Currently it will throw error if neither can be determined\n\nimport { FileSystem, JsonFile, PackageJsonLookup, Path } from '@rushstack/node-core-library';\nimport type { IRushConfigurationJson } from '@microsoft/rush-lib/lib/api/RushConfiguration';\n\nimport { type IAppState, IRushProjectDetails, ProjectType } from './state';\n\nexport const init = (): IAppState => {\n const currDir = process.cwd();\n const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;\n const appVersion: string = JsonFile.load(`${lockfileExplorerProjectRoot}/package.json`).version;\n\n let appState: IAppState | undefined;\n let currExploredDir = Path.convertToSlashes(currDir);\n while (currExploredDir.includes('/')) {\n // Look for a rush.json [rush project] or pnpm-lock.yaml file [regular pnpm workspace]\n const rushJsonPath: string = `${currExploredDir}/rush.json`;\n const pnpmLockPath: string = `${currExploredDir}/pnpm-lock.yaml`;\n if (FileSystem.exists(rushJsonPath)) {\n console.log('found rush project: ', rushJsonPath);\n // Load the rush projects\n const rushJson: IRushConfigurationJson = JsonFile.load(rushJsonPath);\n const projectsByProjectFolder: Map<string, IRushProjectDetails> = new Map();\n for (const project of rushJson.projects) {\n projectsByProjectFolder.set(project.projectFolder, {\n projectName: project.packageName,\n projectFolder: project.projectFolder\n });\n }\n\n appState = {\n currDir,\n appVersion,\n lockfileExplorerProjectRoot,\n projectType: ProjectType.RUSH_PROJECT,\n pnpmLockfileLocation: `${currExploredDir}/common/config/rush/pnpm-lock.yaml`,\n pnpmfileLocation: `${currExploredDir}/common/config/rush/.pnpmfile.cjs`,\n projectRoot: currExploredDir,\n rush: {\n rushJsonPath,\n projectsByProjectFolder\n }\n };\n break;\n } else if (FileSystem.exists(pnpmLockPath)) {\n appState = {\n currDir,\n appVersion,\n lockfileExplorerProjectRoot,\n projectType: ProjectType.PNPM_WORKSPACE,\n pnpmLockfileLocation: `${currExploredDir}/pnpm-lock.yaml`,\n pnpmfileLocation: `${currExploredDir}/.pnpmfile.cjs`,\n projectRoot: currExploredDir\n };\n\n break;\n }\n\n currExploredDir = currExploredDir.substring(0, currExploredDir.lastIndexOf('/'));\n }\n\n if (!appState) {\n throw new Error('Could not find a rush or pnpm project!');\n }\n\n return appState;\n};\n"]}
|
package/lib/start.js
CHANGED
|
@@ -8,18 +8,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
const express_1 = __importDefault(require("express"));
|
|
9
9
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
10
10
|
const cors_1 = __importDefault(require("cors"));
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
11
|
const process_1 = __importDefault(require("process"));
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
12
|
const safe_1 = __importDefault(require("colors/safe"));
|
|
15
13
|
const open_1 = __importDefault(require("open"));
|
|
14
|
+
const update_notifier_1 = __importDefault(require("update-notifier"));
|
|
15
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
16
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
16
17
|
const init_1 = require("./init");
|
|
17
18
|
const PORT = 8091;
|
|
18
19
|
// Must not have a trailing slash
|
|
19
20
|
const SERVICE_URL = `http://localhost:${PORT}`;
|
|
20
|
-
|
|
21
|
+
(0, update_notifier_1.default)({ pkg: package_json_1.default }).notify();
|
|
21
22
|
const appState = (0, init_1.init)();
|
|
22
|
-
process_1.default.chdir(
|
|
23
|
+
process_1.default.chdir(appState.lockfileExplorerProjectRoot);
|
|
24
|
+
const distFolderPath = `${appState.lockfileExplorerProjectRoot}/dist`;
|
|
23
25
|
const app = (0, express_1.default)();
|
|
24
26
|
app.use(express_1.default.json());
|
|
25
27
|
app.use((0, cors_1.default)());
|
|
@@ -27,7 +29,7 @@ app.use((0, cors_1.default)());
|
|
|
27
29
|
let awaitingFirstConnect = true;
|
|
28
30
|
let isClientConnected = false;
|
|
29
31
|
let disconnected = false;
|
|
30
|
-
setInterval(
|
|
32
|
+
setInterval(() => {
|
|
31
33
|
if (!isClientConnected && !awaitingFirstConnect && !disconnected) {
|
|
32
34
|
console.log(safe_1.default.red('The client has disconnected!'));
|
|
33
35
|
console.log(`Please open a browser window at http://localhost:${PORT}/app`);
|
|
@@ -38,7 +40,7 @@ setInterval(function () {
|
|
|
38
40
|
}
|
|
39
41
|
}, 4000);
|
|
40
42
|
// This takes precedence over the `/app` static route, which also has an `initappcontext.js` file.
|
|
41
|
-
app.get('/
|
|
43
|
+
app.get('/initappcontext.js', (req, res) => {
|
|
42
44
|
const appContext = {
|
|
43
45
|
serviceUrl: SERVICE_URL,
|
|
44
46
|
appVersion: appState.appVersion,
|
|
@@ -50,10 +52,11 @@ app.get('/app/initappcontext.js', (req, res) => {
|
|
|
50
52
|
].join('\n');
|
|
51
53
|
res.type('application/javascript').send(sourceCode);
|
|
52
54
|
});
|
|
53
|
-
app.use('/
|
|
54
|
-
app.use('/favicon.ico', express_1.default.static(
|
|
55
|
-
app.get('/', (req, res) => {
|
|
56
|
-
const
|
|
55
|
+
app.use('/', express_1.default.static(distFolderPath));
|
|
56
|
+
app.use('/favicon.ico', express_1.default.static(distFolderPath, { index: 'favicon.ico' }));
|
|
57
|
+
app.get('/api/lockfile', async (req, res) => {
|
|
58
|
+
const pnpmLockfileText = await node_core_library_1.FileSystem.readFileAsync(appState.pnpmLockfileLocation);
|
|
59
|
+
const doc = js_yaml_1.default.load(pnpmLockfileText);
|
|
57
60
|
res.send(doc);
|
|
58
61
|
});
|
|
59
62
|
app.get('/api/health', (req, res) => {
|
|
@@ -65,48 +68,71 @@ app.get('/api/health', (req, res) => {
|
|
|
65
68
|
}
|
|
66
69
|
res.status(200).send();
|
|
67
70
|
});
|
|
68
|
-
app.post('/api/package-json', (req, res) => {
|
|
71
|
+
app.post('/api/package-json', async (req, res) => {
|
|
69
72
|
const { projectPath } = req.body;
|
|
70
|
-
const fileLocation =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
error: `No package.json in location: ${projectPath}`
|
|
75
|
-
});
|
|
73
|
+
const fileLocation = `${appState.projectRoot}/${projectPath}/package.json`;
|
|
74
|
+
let packageJsonText;
|
|
75
|
+
try {
|
|
76
|
+
packageJsonText = await node_core_library_1.FileSystem.readFileAsync(fileLocation);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
catch (e) {
|
|
79
|
+
if (node_core_library_1.FileSystem.isNotExistError(e)) {
|
|
80
|
+
return res.status(404).send({
|
|
81
|
+
message: `Could not load package.json file for this package. Have you installed all the dependencies for this workspace?`,
|
|
82
|
+
error: `No package.json in location: ${projectPath}`
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
throw e;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
res.send(packageJsonText);
|
|
79
90
|
});
|
|
80
|
-
app.get('/api/pnpmfile', (req, res) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
message: `Could not load pnpmfile file in this repo.`,
|
|
85
|
-
error: `No .pnpmifile.cjs found.`
|
|
86
|
-
});
|
|
91
|
+
app.get('/api/pnpmfile', async (req, res) => {
|
|
92
|
+
let pnpmLockfile;
|
|
93
|
+
try {
|
|
94
|
+
pnpmLockfile = await node_core_library_1.FileSystem.readFileAsync(appState.pnpmLockfileLocation);
|
|
87
95
|
}
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
catch (e) {
|
|
97
|
+
if (node_core_library_1.FileSystem.isNotExistError(e)) {
|
|
98
|
+
return res.status(404).send({
|
|
99
|
+
message: `Could not load pnpmfile file in this repo.`,
|
|
100
|
+
error: `No .pnpmifile.cjs found.`
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
throw e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
res.send(pnpmLockfile);
|
|
90
108
|
});
|
|
91
|
-
app.post('/api/package-spec', (req, res) => {
|
|
109
|
+
app.post('/api/package-spec', async (req, res) => {
|
|
92
110
|
const { projectPath } = req.body;
|
|
93
|
-
const fileLocation =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
const fileLocation = `${appState.projectRoot}/${projectPath}/package.json`;
|
|
112
|
+
let packageJson;
|
|
113
|
+
try {
|
|
114
|
+
packageJson = await node_core_library_1.JsonFile.loadAsync(fileLocation);
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
if (node_core_library_1.FileSystem.isNotExistError(e)) {
|
|
118
|
+
return res.status(404).send({
|
|
119
|
+
message: `Could not load package.json file in location: ${projectPath}`
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
throw e;
|
|
124
|
+
}
|
|
98
125
|
}
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const parsedPackage = readPackage(JSON.parse(packageJson));
|
|
126
|
+
const { hooks: { readPackage } } = require(appState.pnpmfileLocation);
|
|
127
|
+
const parsedPackage = readPackage(packageJson);
|
|
102
128
|
res.send(parsedPackage);
|
|
103
129
|
});
|
|
104
130
|
app.listen(PORT, async () => {
|
|
105
|
-
console.log(`Rush Lockfile Explorer ${appState.appVersion} running at ${
|
|
131
|
+
console.log(`Rush Lockfile Explorer ${appState.appVersion} running at ${SERVICE_URL}`);
|
|
106
132
|
if (!process_1.default.argv.includes('--debug')) {
|
|
107
133
|
try {
|
|
108
134
|
// Launch the web browser
|
|
109
|
-
await (0, open_1.default)(
|
|
135
|
+
await (0, open_1.default)(SERVICE_URL);
|
|
110
136
|
}
|
|
111
137
|
catch (e) {
|
|
112
138
|
console.error('Error launching browser: ' + e.toString());
|
package/lib/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,sDAA8B;AAC9B,sDAA2B;AAC3B,gDAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport express from 'express';\nimport yaml from 'js-yaml';\nimport cors from 'cors';\nimport process from 'process';\nimport colors from 'colors/safe';\nimport open from 'open';\nimport updateNotifier from 'update-notifier';\nimport { FileSystem, type IPackageJson, JsonFile } from '@rushstack/node-core-library';\nimport type { IAppContext } from '@rushstack/lockfile-explorer-web/lib/AppContext';\nimport packageJSON from '../package.json';\nimport { init } from './init';\nimport type { IAppState } from './state';\n\nconst PORT: number = 8091;\n// Must not have a trailing slash\nconst SERVICE_URL: string = `http://localhost:${PORT}`;\n\nupdateNotifier({ pkg: packageJSON }).notify();\n\nconst appState: IAppState = init();\n\nprocess.chdir(appState.lockfileExplorerProjectRoot);\nconst distFolderPath: string = `${appState.lockfileExplorerProjectRoot}/dist`;\nconst app: express.Application = express();\napp.use(express.json());\napp.use(cors());\n\n// Variable used to check if the front-end client is still connected\nlet awaitingFirstConnect: boolean = true;\nlet isClientConnected: boolean = false;\nlet disconnected: boolean = false;\nsetInterval(() => {\n if (!isClientConnected && !awaitingFirstConnect && !disconnected) {\n console.log(colors.red('The client has disconnected!'));\n console.log(`Please open a browser window at http://localhost:${PORT}/app`);\n disconnected = true;\n } else if (!awaitingFirstConnect) {\n isClientConnected = false;\n }\n}, 4000);\n\n// This takes precedence over the `/app` static route, which also has an `initappcontext.js` file.\napp.get('/initappcontext.js', (req: express.Request, res: express.Response) => {\n const appContext: IAppContext = {\n serviceUrl: SERVICE_URL,\n appVersion: appState.appVersion,\n debugMode: process.argv.indexOf('--debug') >= 0\n };\n const sourceCode: string = [\n `console.log('Loaded initappcontext.js');`,\n `appContext = ${JSON.stringify(appContext)}`\n ].join('\\n');\n\n res.type('application/javascript').send(sourceCode);\n});\n\napp.use('/', express.static(distFolderPath));\n\napp.use('/favicon.ico', express.static(distFolderPath, { index: 'favicon.ico' }));\n\napp.get('/api/lockfile', async (req: express.Request, res: express.Response) => {\n const pnpmLockfileText: string = await FileSystem.readFileAsync(appState.pnpmLockfileLocation);\n const doc = yaml.load(pnpmLockfileText);\n res.send(doc);\n});\n\napp.get('/api/health', (req: express.Request, res: express.Response) => {\n awaitingFirstConnect = false;\n isClientConnected = true;\n if (disconnected) {\n disconnected = false;\n console.log(colors.green('The client has reconnected!'));\n }\n res.status(200).send();\n});\n\napp.post(\n '/api/package-json',\n async (req: express.Request<{}, {}, { projectPath: string }, {}>, res: express.Response) => {\n const { projectPath } = req.body;\n const fileLocation = `${appState.projectRoot}/${projectPath}/package.json`;\n let packageJsonText: string;\n try {\n packageJsonText = await FileSystem.readFileAsync(fileLocation);\n } catch (e) {\n if (FileSystem.isNotExistError(e)) {\n return res.status(404).send({\n message: `Could not load package.json file for this package. Have you installed all the dependencies for this workspace?`,\n error: `No package.json in location: ${projectPath}`\n });\n } else {\n throw e;\n }\n }\n\n res.send(packageJsonText);\n }\n);\n\napp.get('/api/pnpmfile', async (req: express.Request, res: express.Response) => {\n let pnpmLockfile: string;\n try {\n pnpmLockfile = await FileSystem.readFileAsync(appState.pnpmLockfileLocation);\n } catch (e) {\n if (FileSystem.isNotExistError(e)) {\n return res.status(404).send({\n message: `Could not load pnpmfile file in this repo.`,\n error: `No .pnpmifile.cjs found.`\n });\n } else {\n throw e;\n }\n }\n\n res.send(pnpmLockfile);\n});\n\napp.post(\n '/api/package-spec',\n async (req: express.Request<{}, {}, { projectPath: string }, {}>, res: express.Response) => {\n const { projectPath } = req.body;\n const fileLocation = `${appState.projectRoot}/${projectPath}/package.json`;\n let packageJson: IPackageJson;\n try {\n packageJson = await JsonFile.loadAsync(fileLocation);\n } catch (e) {\n if (FileSystem.isNotExistError(e)) {\n return res.status(404).send({\n message: `Could not load package.json file in location: ${projectPath}`\n });\n } else {\n throw e;\n }\n }\n\n const {\n hooks: { readPackage }\n } = require(appState.pnpmfileLocation);\n const parsedPackage = readPackage(packageJson);\n res.send(parsedPackage);\n }\n);\n\napp.listen(PORT, async () => {\n console.log(`Rush Lockfile Explorer ${appState.appVersion} running at ${SERVICE_URL}`);\n\n if (!process.argv.includes('--debug')) {\n try {\n // Launch the web browser\n await open(SERVICE_URL);\n } catch (e) {\n console.error('Error launching browser: ' + e.toString());\n }\n }\n});\n"]}
|
package/lib/state/index.d.ts
CHANGED
|
@@ -6,35 +6,24 @@ export interface IRushProjectDetails {
|
|
|
6
6
|
projectName: string;
|
|
7
7
|
projectFolder: string;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface IAppStateBase {
|
|
10
|
+
lockfileExplorerProjectRoot: string;
|
|
10
11
|
currDir: string;
|
|
11
12
|
projectRoot: string;
|
|
12
13
|
projectType: ProjectType;
|
|
13
14
|
pnpmLockfileLocation: string;
|
|
14
15
|
pnpmfileLocation: string;
|
|
15
16
|
appVersion: string;
|
|
16
|
-
rush: {
|
|
17
|
-
projects: {
|
|
18
|
-
[key in string]: IRushProjectDetails;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
interface IProps {
|
|
23
|
-
currDir: string;
|
|
24
17
|
}
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
projectRoot: string;
|
|
28
|
-
projectType: ProjectType;
|
|
29
|
-
pnpmLockfileLocation: string;
|
|
30
|
-
pnpmfileLocation: string;
|
|
31
|
-
appVersion: string;
|
|
18
|
+
export interface IRushAppState extends IAppStateBase {
|
|
19
|
+
projectType: ProjectType.RUSH_PROJECT;
|
|
32
20
|
rush: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
21
|
+
rushJsonPath: string;
|
|
22
|
+
projectsByProjectFolder: Map<string, IRushProjectDetails>;
|
|
36
23
|
};
|
|
37
|
-
constructor(props: IProps);
|
|
38
24
|
}
|
|
39
|
-
export {
|
|
25
|
+
export interface IPnpmWorkspaceAppState extends IAppStateBase {
|
|
26
|
+
projectType: ProjectType.PNPM_WORKSPACE;
|
|
27
|
+
}
|
|
28
|
+
export declare type IAppState = IRushAppState | IPnpmWorkspaceAppState;
|
|
40
29
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/state/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAGA,oBAAY,WAAW;IACrB,YAAY,IAAA;IACZ,cAAc,IAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAGA,oBAAY,WAAW;IACrB,YAAY,IAAA;IACZ,cAAc,IAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,2BAA2B,EAAE,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC;IACtC,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,CAAC;QACrB,uBAAuB,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;KAC3D,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC;CACzC;AAED,oBAAY,SAAS,GAAG,aAAa,GAAG,sBAAsB,CAAC"}
|
package/lib/state/index.js
CHANGED
|
@@ -2,24 +2,10 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
3
|
// See LICENSE in the project root for license information.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.ProjectType = void 0;
|
|
6
6
|
var ProjectType;
|
|
7
7
|
(function (ProjectType) {
|
|
8
8
|
ProjectType[ProjectType["RUSH_PROJECT"] = 0] = "RUSH_PROJECT";
|
|
9
9
|
ProjectType[ProjectType["PNPM_WORKSPACE"] = 1] = "PNPM_WORKSPACE";
|
|
10
10
|
})(ProjectType = exports.ProjectType || (exports.ProjectType = {}));
|
|
11
|
-
class AppState {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
this.projectRoot = '';
|
|
14
|
-
this.projectType = ProjectType.RUSH_PROJECT;
|
|
15
|
-
this.pnpmLockfileLocation = '';
|
|
16
|
-
this.pnpmfileLocation = '';
|
|
17
|
-
this.appVersion = '';
|
|
18
|
-
this.rush = {
|
|
19
|
-
projects: {}
|
|
20
|
-
};
|
|
21
|
-
this.currDir = props.currDir;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.AppState = AppState;
|
|
25
11
|
//# sourceMappingURL=index.js.map
|
package/lib/state/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,6DAAY,CAAA;IACZ,iEAAc,CAAA;AAChB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,6DAAY,CAAA;IACZ,iEAAc,CAAA;AAChB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport enum ProjectType {\n RUSH_PROJECT,\n PNPM_WORKSPACE\n}\n\nexport interface IRushProjectDetails {\n projectName: string;\n projectFolder: string;\n}\n\nexport interface IAppStateBase {\n lockfileExplorerProjectRoot: string;\n currDir: string;\n projectRoot: string;\n projectType: ProjectType;\n pnpmLockfileLocation: string;\n pnpmfileLocation: string;\n appVersion: string;\n}\n\nexport interface IRushAppState extends IAppStateBase {\n projectType: ProjectType.RUSH_PROJECT;\n rush: {\n rushJsonPath: string;\n projectsByProjectFolder: Map<string, IRushProjectDetails>;\n };\n}\n\nexport interface IPnpmWorkspaceAppState extends IAppStateBase {\n projectType: ProjectType.PNPM_WORKSPACE;\n}\n\nexport type IAppState = IRushAppState | IPnpmWorkspaceAppState;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/lockfile-explorer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Rush Lockfile Explorer: The UI for solving version conflicts quickly in a large monorepo",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"conflict",
|
|
@@ -28,23 +28,27 @@
|
|
|
28
28
|
"lockfile-explorer": "./bin/lockfile-explorer"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@microsoft/rush-lib": "5.88.1",
|
|
31
32
|
"@rushstack/eslint-config": "3.1.1",
|
|
32
|
-
"@rushstack/heft-node-rig": "1.11.
|
|
33
|
-
"@rushstack/heft": "0.49.
|
|
33
|
+
"@rushstack/heft-node-rig": "1.11.12",
|
|
34
|
+
"@rushstack/heft": "0.49.1",
|
|
34
35
|
"@rushstack/lockfile-explorer-web": "0.0.0",
|
|
36
|
+
"@types/cors": "~2.8.12",
|
|
35
37
|
"@types/express": "4.17.13",
|
|
36
38
|
"@types/heft-jest": "1.0.1",
|
|
37
39
|
"@types/js-yaml": "3.12.1",
|
|
38
40
|
"@types/node": "12.20.24",
|
|
39
|
-
"@types/
|
|
41
|
+
"@types/update-notifier": "~6.0.1"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|
|
44
|
+
"@rushstack/node-core-library": "3.53.3",
|
|
42
45
|
"@types/express": "4.17.13",
|
|
46
|
+
"colors": "~1.2.1",
|
|
47
|
+
"cors": "~2.8.5",
|
|
43
48
|
"express": "4.18.1",
|
|
44
49
|
"js-yaml": "~3.13.1",
|
|
45
50
|
"open": "~8.4.0",
|
|
46
|
-
"
|
|
47
|
-
"colors": "~1.2.1"
|
|
51
|
+
"update-notifier": "~5.1.0"
|
|
48
52
|
},
|
|
49
53
|
"scripts": {
|
|
50
54
|
"build": "heft build --clean",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(){"use strict";var e,t={924:function(e,t,n){var a,r,c=n(823),s=n(998),l="HK80a6ZVkdxoTKzrP9Eq",i="HqAzbQwu1zc9yH8ZQESI",o=n(201);!function(e){e[e.DEPENDENCY=0]="DEPENDENCY",e[e.DEV_DEPENDENCY=1]="DEV_DEPENDENCY",e[e.PEER_DEPENDENCY=2]="PEER_DEPENDENCY"}(a||(a={}));class d{constructor(e,t,n,r,c){if(this.entryId="",this.name=e,this.version=t,this.dependencyType=n,this.containingEntry=r,this.peerDependencyMeta={},this.version.startsWith("link:")){const t=this.version.substring("link:".length),n=new o.y(".").relative(new o.y(r.packageJsonFolderPath).concat(t));if(!n)return void console.error("No root relative path for dependency!",e);this.entryId="project:"+n.toString()}else this.version.startsWith("/")?this.entryId=this.version:this.dependencyType===a.PEER_DEPENDENCY?(null==c?void 0:c.peerDependencies)?(this.peerDependencyMeta={name:this.name,version:c.peerDependencies[this.name],optional:!(!c.peerDependenciesMeta||!c.peerDependenciesMeta[this.name])&&c.peerDependenciesMeta[this.name].optional},this.entryId="Peer: "+this.name):console.error("Peer dependencies info missing!",c):this.entryId="/"+this.name+"/"+this.version}static parseDependencies(e,t,n){if(n.dependencies)for(const[r,c]of Object.entries(n.dependencies))e.push(new d(r,c,a.DEPENDENCY,t));if(n.devDependencies)for(const[r,c]of Object.entries(n.devDependencies))e.push(new d(r,c,a.DEV_DEPENDENCY,t));if(n.peerDependencies)for(const[r,c]of Object.entries(n.peerDependencies))e.push(new d(r,c,a.PEER_DEPENDENCY,t,n));if(n.transitivePeerDependencies)for(const e of n.transitivePeerDependencies)t.transitivePeerDependencies.add(e)}}!function(e){e[e.Project=0]="Project",e[e.Package=1]="Package",e[e.SideBySide=2]="SideBySide",e[e.Doppelganger=3]="Doppelganger"}(r||(r={}));class p{constructor(e){this.entryId="",this.packageJsonFolderPath="",this.entryPackageName="",this.displayText="",this.dependencies=[],this.transitivePeerDependencies=new Set,this.referrers=[],this.entryPackageVersion="",this.entrySuffix="";const{rawEntryId:t,kind:n,rawYamlData:a}=e;if(this.rawEntryId=t,this.kind=n,"."!==t){if(n===r.Project){const e=new o.y("common/temp/package.json").dirname()||"",n=new o.y(".").relative(new o.y(e).concat(t)),a=new o.y(t).basename();if(!n||!a)return void console.error("Could not construct path for entry: ",t);this.packageJsonFolderPath=n.toString(),this.entryId="project:"+this.packageJsonFolderPath,this.entryPackageName=a.toString(),this.displayText="Project: "+this.entryPackageName}else{this.displayText=t;const e=p._packageEntryIdRegex.exec(t);if(e){const[,t,n]=e;this.entryPackageName=t;const a=n.indexOf("_");if(a>=0){const e=n.substring(0,a),r=n.substring(a+1);this.entryPackageVersion=e,this.entrySuffix=r,this.displayText=t+" "+e+" ("+r+")"}else this.entryPackageVersion=n,this.displayText=t+" "+n}this.packageJsonFolderPath="common/temp/node_modules/.pnpm/"+this.entryPackageName.replace("/","+")+"@"+this.entryPackageVersion+(this.entrySuffix?`_${this.entrySuffix}`:"")+"/node_modules/"+this.entryPackageName}d.parseDependencies(this.dependencies,this,a)}}}p._packageEntryIdRegex=new RegExp("/(.*)/([^/]+)$");const m=window.appContext.serviceUrl;var E="OcndyDBetZor3ptzTnTX",u="Wg5pG3RVf6SQ51i0tVkd",y="NBIr3yosJ9gX6LZcnC7T",f="IWEAxDEzQLw3g5TI_6up";const h=null;var k=n(775);const g=k.I0,v=k.v9;var P=n(628);const N="LOCKFILE_EXPLORER_BOOKMARKS",S="LOCKFILE_EXPLORER_PROJECT_FILTER",w="LOCKFILE_EXPLORER_PACKAGE_FILTER",C=e=>e===r.Project?localStorage.getItem(S)||"":localStorage.getItem(w)||"",D={allEntries:[],filters:{[r.Project]:!1,[r.Package]:!0,[r.SideBySide]:!1,[r.Doppelganger]:!1},selectedEntryStack:[],selectedEntryForwardStack:[],bookmarkedEntries:[]},b=(0,P.oM)({name:"entry",initialState:D,reducers:{loadEntries:(e,t)=>{e.allEntries=t.payload;const n=(()=>{const e=JSON.parse(localStorage.getItem(N)||"{}"),t=new Set;for(const n of Object.keys(e))t.add(n);return t})();for(const a of t.payload)n.has(a.rawEntryId)&&e.bookmarkedEntries.push(a)},setFilter:(e,t)=>{e.filters[t.payload.filter]=t.payload.state},clearStackAndPush:(e,t)=>{e.selectedEntryStack=[t.payload],e.selectedEntryForwardStack=[]},pushToStack:(e,t)=>{e.selectedEntryStack.push(t.payload),e.selectedEntryForwardStack=[],t.payload.kind===r.Package?(e.filters[r.Project]=!1,e.filters[r.Package]=!0):(e.filters[r.Project]=!0,e.filters[r.Package]=!1)},popStack:e=>{if(e.selectedEntryStack.length>1){const t=e.selectedEntryStack.pop();e.selectedEntryForwardStack.push(t),e.selectedEntryStack.length>=1&&(e.selectedEntryStack[e.selectedEntryStack.length-1].kind===r.Package?(e.filters[r.Project]=!1,e.filters[r.Package]=!0):(e.filters[r.Project]=!0,e.filters[r.Package]=!1))}},forwardStack:e=>{if(e.selectedEntryForwardStack.length>0){const t=e.selectedEntryForwardStack.pop();e.selectedEntryStack.push(t),t.kind===r.Package?(e.filters[r.Project]=!1,e.filters[r.Package]=!0):(e.filters[r.Project]=!0,e.filters[r.Package]=!1)}},addBookmark:(e,t)=>{e.bookmarkedEntries.includes(t.payload)||(e.bookmarkedEntries.push(t.payload),(e=>{const t=e.rawEntryId,n=JSON.parse(localStorage.getItem(N)||"{}");n[t]=!0,localStorage.setItem(N,JSON.stringify(n))})(t.payload))},removeBookmark:(e,t)=>{e.bookmarkedEntries=e.bookmarkedEntries.filter((e=>e.rawEntryId!==t.payload.rawEntryId)),(e=>{const t=e.rawEntryId,n=JSON.parse(localStorage.getItem(N)||"{}");delete n[t],localStorage.setItem(N,JSON.stringify(n))})(t.payload)}}}),j=e=>e.entry.selectedEntryStack.length?e.entry.selectedEntryStack[e.entry.selectedEntryStack.length-1]:void 0,O=e=>{const t=[];return e.entry.filters[r.Package]?t.push(...e.entry.allEntries.filter((e=>e.kind===r.Package))):e.entry.filters[r.Project]&&t.push(...e.entry.allEntries.filter((e=>e.kind===r.Project))),t},{loadEntries:I,setFilter:_,clearStackAndPush:x,pushToStack:A,popStack:R,forwardStack:T,addBookmark:F,removeBookmark:J}=b.actions,M=b.reducer;const K=({options:e})=>c.createElement("div",{className:"b1H6mzJXpxsG350hyeU_"},e.map((e=>c.createElement("div",{key:e.text,className:"mWhs4CnCA0TKj6CRR8gk "+(e.active?"Q9WEwAuQb3UsVbcHr0oI":""),onClick:e.onClick},e.text)))),$=({group:e})=>{const t=v(j),n=v((e=>e.entry.filters)),a=g(),s=(0,c.useRef)(),l=(0,c.useCallback)((e=>()=>{a(A(e))}),[]);return(0,c.useEffect)((()=>{t&&t.entryPackageName===e.entryName&&s.current.scrollIntoView({behavior:"smooth"})}),[t,e]),n[r.Project]?c.createElement("div",{className:E,ref:s},e.versions.map((e=>c.createElement("div",{key:e.rawEntryId,onClick:l(e),className:`${u} ${(null==t?void 0:t.rawEntryId)===e.rawEntryId?y:""}`},c.createElement("h5",null,e.entryPackageName))))):c.createElement("div",{className:E,ref:s},c.createElement("h5",null,e.entryName),e.versions.map((e=>c.createElement("div",{key:e.rawEntryId,onClick:l(e),className:`${u} ${(null==t?void 0:t.rawEntryId)===e.rawEntryId?y:""}`},c.createElement("p",null,e.entryPackageVersion," ",e.entrySuffix&&`[${e.entrySuffix}]`)))))},G=()=>{const e=g(),[t,n]=(0,c.useState)(""),[a,s]=(0,c.useState)(""),i=v(O),o=v((e=>e.entry.filters)),d=(0,c.useCallback)((e=>t=>{e===r.Project?n(t.target.value):s(t.target.value),((e,t)=>{t===r.Project?localStorage.setItem(S,e):localStorage.setItem(w,e)})(t.target.value,e)}),[]);if((0,c.useEffect)((()=>{n(C(r.Project)),s(C(r.Package))}),[]),!i)return h;const p=(0,c.useCallback)(((t,n)=>()=>{e(_({filter:t,state:n}))}),[]),m=(0,c.useCallback)((t=>()=>{t===r.Project?(e(_({filter:r.Project,state:!0})),e(_({filter:r.Package,state:!1}))):(e(_({filter:r.Package,state:!0})),e(_({filter:r.Project,state:!1})))}),[o]);return c.createElement("div",{className:"yk7wrFMnnNyYLABMBhz_"},c.createElement(K,{options:[{text:"Projects",active:o[r.Project],onClick:m(r.Project)},{text:"Packages",active:o[r.Package],onClick:m(r.Package)}]}),c.createElement("div",{className:`X00sOTmx1ir4Oc41DIvM ${l}`},c.createElement("div",{className:"oq4FJVnF_fONdOKuiK0w"},c.createElement("input",{type:"search",placeholder:"Filter...",value:o[r.Project]?t:a,onChange:d(o[r.Project]?r.Project:r.Package)})),c.createElement("div",{className:"PoJj8_8xv9BXiMVPKFVE"},(()=>{let e=i;t&&o[r.Project]?e=i.filter((e=>-1!==e.entryPackageName.indexOf(t))):a&&o[r.Package]&&(e=i.filter((e=>-1!==e.entryPackageName.indexOf(a))));const n=e.reduce(((e,t)=>{const n=e[t.entryPackageName]||[];return n.push(t),e[t.entryPackageName]=n,e}),{});let c=[];for(const[e,t]of Object.entries(n))c.push({entryName:e,versions:t});return o[r.SideBySide]&&(c=c.filter((e=>e.versions.length>1))),o[r.Doppelganger]&&(c=c.filter((e=>(e=>{const t=new Set;for(const n of e){if(t.has(n.entryPackageVersion))return!0;t.add(n.entryPackageVersion)}return!1})(e.versions)))),c})().map((e=>c.createElement($,{group:e,key:e.entryName})))),o[r.Package]?c.createElement("div",{className:"K6dDN5KzjLkbPPFWUaly"},c.createElement("h5",null,"Filters"),c.createElement("div",{className:f,onClick:p(r.SideBySide,!o[r.SideBySide])},c.createElement("input",{type:"checkbox",checked:o[r.SideBySide],readOnly:!0}),c.createElement("h5",null,"Must have side-by-side versions")),c.createElement("div",{className:f,onClick:p(r.Doppelganger,!o[r.Doppelganger])},c.createElement("input",{type:"checkbox",checked:o[r.Doppelganger],readOnly:!0}),c.createElement("h5",null,"Must have doppelgangers"))):null))},V=window.appContext.serviceUrl;var Y="rXOH6AJQU2eYrNAXbp4V";const B={specChanges:new Map},L=(0,P.oM)({name:"workspace",initialState:B,reducers:{loadSpecChanges:(e,t)=>{e.specChanges=t.payload}}}),{loadSpecChanges:z}=L.actions,H=L.reducer,X=(e,t)=>{var n;switch(null===(n=e.get(t))||void 0===n?void 0:n.type){case"add":return"[Added by .pnpmfile.cjs]";case"diff":return"[Changed from {specChanges.get(dep)?.from}]";case"remove":return"[Deleted by .pnpmfile.cjs]";default:return"No Change"}},W=(e,t)=>{if(!e)return!1;for(const n of e.dependencies)if(t.has(n.name))return!0;return!1};var Z;!function(e){e[e.PACKAGE_JSON=0]="PACKAGE_JSON",e[e.PACKAGE_SPEC=1]="PACKAGE_SPEC",e[e.PARSED_PACKAGE_JSON=2]="PARSED_PACKAGE_JSON"}(Z||(Z={}));const Q=()=>{const e=g(),[t,n]=(0,c.useState)(void 0),[a,r]=(0,c.useState)(void 0),[s,i]=(0,c.useState)(""),o=v(j),d=v((e=>e.workspace.specChanges)),[p,m]=(0,c.useState)(Z.PARSED_PACKAGE_JSON),E=(0,c.useCallback)((e=>()=>m(e)),[]);(0,c.useEffect)((()=>{(async function(){const e=await(async()=>{try{const e=await fetch(`${V}/api/pnpmfile`);return await e.text()}catch(e){return console.error("Could not load cjs file: ",e),"Missing CJS"}})();i(e)})().catch((e=>{console.error(`Failed to load project's pnpm file: ${e}`)}))}),[]),(0,c.useEffect)((()=>{o&&(o.entryPackageName?async function(t){const a=await(async e=>{try{const t=await fetch(`${V}/api/package-json`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e})});return await t.json()}catch(e){return void console.error("Could not load package json file: ",e)}})(t);n(a);const c=await(async e=>{try{const t=await fetch(`${V}/api/package-spec`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e})});return await t.json()}catch(e){return void console.error("Could not load cjs file: ",e)}})(t);if(r(c),a&&c){const t=((e,t)=>{const n=new Map,a=new Map;for(const[t,a]of Object.entries(Object.assign(Object.assign(Object.assign({},e.dependencies),e.devDependencies),e.peerDependencies)))n.set(t,a);for(const[e,n]of Object.entries(Object.assign(Object.assign(Object.assign({},t.dependencies),t.devDependencies),t.peerDependencies)))a.set(e,n);const r=new Map;for(const e of n.keys())a.has(e)?a.get(e)!==n.get(e)&&r.set(e,{type:"diff",packageName:e,from:n.get(e),to:a.get(e)}):r.set(e,{type:"remove",packageName:e});for(const e of a.keys())n.has(e)||r.set(e,{type:"add",packageName:e});return r})(a,c);e(z(t))}}(o.packageJsonFolderPath).catch((e=>{console.error(`Failed to load project information: ${e}`)})):console.log("The selected entry has no entry name: ",o.entryPackageName))}),[o]);const u=e=>t=>{var n;const[a,r]=t;if(!d.has(a))return e?c.createElement("p",{key:a},a,":"):c.createElement("p",{key:a},r);switch(null===(n=d.get(a))||void 0===n?void 0:n.type){case"add":return e?c.createElement("p",{key:a},c.createElement("span",{className:"nTIc62ACgp5xMWIvZ4cn"},a)):c.createElement("p",{key:a},r," ",X(d,a));case"diff":return e?c.createElement("p",{key:a},c.createElement("span",{className:"I4A8ZZlpCL3Op0c53VjN"},a)):c.createElement("p",{key:a},r," ",X(d,a));case"remove":return e?c.createElement("p",{key:a},c.createElement("span",{className:"iavWjvHy9s5MhCZ_ncgb"},a)):c.createElement("p",{key:a},r," ",X(d,a));default:return e?c.createElement("p",{key:a},a,":"):c.createElement("p",{key:a},r)}};return c.createElement("div",{className:"kzgyQkswpx6xUEo4zOa8"},c.createElement(K,{options:[{text:"package spec "+(W(o,d)?"*":""),active:p===Z.PARSED_PACKAGE_JSON,onClick:E(Z.PARSED_PACKAGE_JSON)},{text:"package.json",active:p===Z.PACKAGE_JSON,onClick:E(Z.PACKAGE_JSON)},{text:".pnpmfile.cjs",active:p===Z.PACKAGE_SPEC,onClick:E(Z.PACKAGE_SPEC)}]}),c.createElement("div",{className:l},c.createElement("div",{className:"e2KEBfZCHwEMeH4j6wS7"},(()=>{switch(p){case Z.PACKAGE_JSON:return t?c.createElement("pre",null,JSON.stringify(t,null,2)):c.createElement("h5",null,"Please select a Project or Package to view it's package.json");case Z.PACKAGE_SPEC:return s?c.createElement("pre",null,s):c.createElement("h5",null,"Couldn't load the pnpmfile.cjs file - does it exist in the expected location? (/common/config/rush/.pnpmfile.cjs)");case Z.PARSED_PACKAGE_JSON:return a?c.createElement("div",{className:"Ko0YQxSlY0hCIDTfmNlr"},c.createElement("div",{className:Y},c.createElement("h5",null,"Package Name:"),c.createElement("p",null,null==o?void 0:o.displayText)),c.createElement("div",{className:Y},c.createElement("h5",null,"Version:"),c.createElement("p",null,null==o?void 0:o.entryPackageVersion)),c.createElement("div",{className:"hqNteMkwhYXuZqHE_8MJ"},c.createElement("div",null,c.createElement("h5",null,"Dependencies"),a.dependencies&&Object.entries(a.dependencies).map(u(!0)),c.createElement("h5",null,"Dev Dependencies"),a.devDependencies&&Object.entries(a.devDependencies).map(u(!0)),c.createElement("h5",null,"Peer Dependencies"),a.peerDependencies&&Object.entries(a.peerDependencies).map(u(!0))),c.createElement("div",null,c.createElement("h5",null," "),a.dependencies&&Object.entries(a.dependencies).map(u(!1)),c.createElement("h5",null," "),a.devDependencies&&Object.entries(a.devDependencies).map(u(!1)),c.createElement("h5",null," "),a.peerDependencies&&Object.entries(a.peerDependencies).map(u(!1))))):c.createElement("h5",null,"Please select a Project or Package to view the parsed package.json");default:return null}})())))};var U,q="_R50_3JsFs2FC9kVffQL",ee="mRQWdzXzOM1NpFUpYnhP",te="rIv2KvSZ0CKMbctSHL04",ne="wzeVrHi3oyOhEe6qD3PX",ae="lGp34XdOFjHfZNwiilgC";!function(e){e[e.Determinant=0]="Determinant",e[e.TransitiveReferrer=1]="TransitiveReferrer"}(U||(U={}));const re=()=>{var e,t;const n=v(j),r=v((e=>e.workspace.specChanges)),s=g(),[i,o]=(0,c.useState)(null),[d,p]=(0,c.useState)([]);(0,c.useEffect)((()=>{n&&o(null)}),[n]);const m=(0,c.useCallback)((e=>()=>{if(i&&i.entryId===e.entryId)e.resolvedEntry?s(A(e.resolvedEntry)):((...e)=>{window.appContext.debugMode&&console.log("Diagnostic: ",...e)})("No resolved entry for dependency:",e);else if(n){if(console.log("dependency to trace: ",e),o(e),e.dependencyType!==a.PEER_DEPENDENCY)return;const t=[n],r=new Set,c=new Set,s=new Set;for(s.add(n);t.length;){const n=t.pop();if(n)for(const a of n.referrers){let l=!1;for(const t of a.dependencies)if(t.name===e.name){r.add(a),l=!0;break}if(!l){a.transitivePeerDependencies.has(e.name)?c.add(a):console.error('Error analyzing influencers: A referrer appears to be missing its "transitivePeerDependencies" field in the YAML file: ',e,a,n);for(const e of n.referrers)s.has(e)||(t.push(e),s.add(e))}}}const l=[];for(const e of r.values())l.push({entry:e,type:U.Determinant});for(const e of c.values())l.push({entry:e,type:U.TransitiveReferrer});p(l)}}),[n,i]),E=(0,c.useCallback)((e=>()=>{console.log("going to entry: ",e),s(A(e))}),[n]);return n?c.createElement(c.Fragment,null,c.createElement("div",{className:"KWDuEbG1GmwLxFmPPppw"},c.createElement("div",{className:l},c.createElement("h5",null,"Direct Referrers"),c.createElement("div",{className:q},null===(e=n.referrers)||void 0===e?void 0:e.map((e=>c.createElement("div",{className:ee,key:e.rawEntryId,onClick:E(e)},c.createElement("h5",null,"Name: ",e.displayText),c.createElement("div",null,c.createElement("p",null,"Entry ID: ",e.rawEntryId))))))),c.createElement("div",{className:l},c.createElement("h5",null,"Direct Dependencies"),c.createElement("div",{className:q},null===(t=n.dependencies)||void 0===t?void 0:t.map((e=>c.createElement("div",{className:`${ee} ${(null==i?void 0:i.entryId)===e.entryId&&"GbZbP1wHbcReGrxpZ3Ra"}`,key:e.entryId||e.name,onClick:m(e)},c.createElement("h5",null,"Name: ",e.name," ",e.dependencyType===a.PEER_DEPENDENCY?(e.peerDependencyMeta.optional?"(Optional)":"(Non-optional)")+" Peer Dependency":""),c.createElement("div",null,c.createElement("p",null,"Version: ",e.version),c.createElement("p",null,"Entry ID: ",e.entryId)))))))),i?c.createElement("div",{className:`${l} xSxHmjxIXTOSskLhma3A`},c.createElement("div",{className:ae},c.createElement("h5",null,"Selected Dependency: "),c.createElement("span",null,i.name,": ",i.version)),c.createElement("div",{className:ae},c.createElement("h5",null,"package.json spec: "),c.createElement("span",null,i.dependencyType===a.PEER_DEPENDENCY?`"${i.peerDependencyMeta.version}" ${i.peerDependencyMeta.optional?"Optional":"Required"} Peer`:i.version)),c.createElement("div",{className:ae},c.createElement("h5",null,".pnpmfile.cjs: "),c.createElement("span",null,r.has(i.name)?X(r,i.name):"No Effect"))):h,(()=>{if(!n)return h;if(!n.dependencies.filter((e=>e.dependencyType===a.PEER_DEPENDENCY)).length)return c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"No peer dependencies."));if(!i||i.dependencyType!==a.PEER_DEPENDENCY)return c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"Select a peer dependency to view its influencers"));const e=d.filter((e=>e.type===U.Determinant)),t=d.filter((e=>e.type===U.TransitiveReferrer));return c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"Determinants:"),e.length?e.map((({entry:e})=>c.createElement("a",{className:ne,key:e.rawEntryId,onClick:E(e)},e.displayText))):c.createElement("p",null,"(none)"),c.createElement("h5",{className:"aKaZTElUypfUGQWhNJON"},"Transitive Referencers:"),t.length?t.map((({entry:e})=>c.createElement("a",{className:ne,key:e.rawEntryId,onClick:E(e)},e.displayText))):c.createElement("p",null,"(none)"))})()):c.createElement("div",{className:`${l} ${te}`},c.createElement("h5",null,"Select an entry to view its details"))};const ce=()=>{const e=v((e=>e.entry.bookmarkedEntries)),t=g(),n=(0,c.useCallback)((e=>()=>{t(x(e))}),[]),a=(0,c.useCallback)((e=>()=>{t(J(e))}),[]);return c.createElement("div",{className:`${l} aM5oGgiHs9rRHcHdAqFh`},c.createElement("h5",null,"Bookmarks"),c.createElement("hr",null),e.map((e=>c.createElement("div",{key:e.rawEntryId,className:"Ci1rEoM4eR29ZJcnvJJE"},c.createElement("p",{onClick:n(e)},e.displayText),c.createElement("button",{onClick:a(e)},"Remove")))))};var se="dklLbMzvzbuzLd2XJh3W",le="vJvmAdZ2VafvyXjc16Mz";const ie=()=>{const e=v(j),t=v((t=>!!e&&t.entry.bookmarkedEntries.includes(e))),n=v((e=>e.entry.selectedEntryStack)),a=v((e=>e.entry.selectedEntryForwardStack)),r=g(),s=(0,c.useCallback)((()=>{e&&r(F(e))}),[e]),l=(0,c.useCallback)((()=>{e&&r(J(e))}),[e]),i=(0,c.useCallback)((()=>{r(R())}),[]),o=(0,c.useCallback)((()=>{r(T())}),[]),d=()=>c.createElement("div",{className:"LkGUkEuAC1lrNLYWXZAB"},c.createElement("button",{disabled:n.length<=1,onClick:i},"Back"),c.createElement("button",{disabled:0===a.length,onClick:o},"Forward"),t?c.createElement("button",{onClick:l,disabled:!e},"Remove Bookmark"):c.createElement("button",{onClick:s,disabled:!e},"Add Bookmark"));return e?c.createElement("div",{className:se},c.createElement("div",{className:le},c.createElement("div",{className:"Hd2WYHIwrFrldD0I8qDj"},c.createElement("h5",null,"Selected entry:"),c.createElement("span",null,e.displayText)),d()),c.createElement("div",null,c.createElement("p",null,"Package Entry: ",e.rawEntryId),c.createElement("p",null,"Package JSON path: ",e.packageJsonFolderPath))):c.createElement("div",{className:se},c.createElement("div",{className:le},c.createElement("h5",null,"No Entry Selected"),d()))};var oe="wR2C2OTixe7QR738j44h",de="Oo_rkIqOkO0j8slDAm5V";const pe=()=>{const e=window.appContext.appVersion;return c.createElement("div",{className:"mqcpXwTQfD4A2eS4QRMa"},c.createElement("div",{className:"gxAXHLK7j_oYpFDmIJLR"},c.createElement("img",{className:oe,src:n(769)})),c.createElement("div",null,c.createElement("a",{href:"https://lfx.rushstack.io/",target:"_blank",rel:"noreferrer"},c.createElement("div",{className:"rHArsuIMBTbIFs5o2cuw"},c.createElement("img",{className:oe,src:n(500)})),c.createElement("div",{className:"P6XzPBuW8Osze59RSui1"},c.createElement("img",{className:oe,src:n(126)})),c.createElement("div",{className:de},e)),c.createElement("a",{href:"https://rushstack.io/",target:"_blank",rel:"noreferrer"},c.createElement("div",{className:de},"rushstack.io"))))};const me=()=>{const[e,t]=(0,c.useState)(!0),[n,a]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1);async function i(){await(async()=>{try{return await fetch(`${V}/api/health`),!0}catch(e){return!1}})()?t(!0):t(!1),a(!1)}(0,c.useEffect)((()=>{window.setInterval(i,2e3)}),[]);const o=(0,c.useCallback)((()=>{a(!0),s(!0),i().catch((e=>{console.error(`Unexpected exception: ${e}`)}))}),[]);return e?null:c.createElement("div",{className:"uVMB4BjTN3pGKpcO9hFB"},c.createElement("div",{className:`gyz87hLRy_DyMUyraMaM ${l}`},c.createElement("h5",null,"The server has disconnected!"),r?c.createElement("p",null,"We were still not able to establish a connection to the server. Are you sure it is running?"):c.createElement("p",null,"Please re-start the local development server to continue using this application."),c.createElement("div",{className:"UkJzWedRWYeVMPCVDmCS"},c.createElement("button",{disabled:n,onClick:o},"Check Again"),n?c.createElement("p",null,"Checking..."):null)))},Ee=(0,P.xC)({reducer:{entry:M,workspace:H},middleware:e=>e({serializableCheck:!1})}),ue=document.getElementById("root");s.render(c.createElement(k.zt,{store:Ee},c.createElement((()=>{const e=g();return(0,c.useEffect)((()=>{(async function(){const t=await(async()=>{const e=await fetch(`${m}/`);return(e=>{const t=[],n={},c=[];if(e.importers)for(const[a,s]of Object.entries(e.importers)){const e=new p({rawEntryId:a,kind:r.Project,rawYamlData:s});c.push(e),t.push(e),n[e.entryId]=e}const s=[];if(e.packages)for(const[a,c]of Object.entries(e.packages)){const e=new p({rawEntryId:a,kind:r.Package,rawYamlData:c});s.push(e),t.push(e),n[a]=e}for(const e of t)for(const t of e.dependencies){if(t.dependencyType===a.PEER_DEPENDENCY)continue;const r=n[t.entryId];r?(t.resolvedEntry=r,r.referrers.push(e)):console.error("Could not resolve dependency entryId: ",t.entryId)}return t})(await e.json())})();e(I(t))})().catch((e=>{console.log(`Failed to read lockfile: ${e}`)}))}),[]),c.createElement(c.Fragment,null,c.createElement(me,null),c.createElement("div",{className:"uXEYthi0e8fjYu_FisVm"},c.createElement("div",{className:"ms-Grid",dir:"ltr"},c.createElement("div",{className:"ms-Grid-row"},c.createElement("div",{className:`ms-Grid-col ms-sm3 ${i}`},c.createElement(G,null)),c.createElement("div",{className:`ms-Grid-col ms-sm7 ${i}`},c.createElement(ie,null),c.createElement(Q,null),c.createElement(re,null)),c.createElement("div",{className:`ms-Grid-col ms-sm2 ${i}`},c.createElement(pe,null),c.createElement(ce,null))))))}),null)),ue)},769:function(e,t,n){e.exports=n.p+"d39919ddc699d58b84ba.svg"},500:function(e,t,n){e.exports=n.p+"d13d30e9b42faf842d2f.svg"},126:function(e,t,n){e.exports=n.p+"510f03f81080fd3cfd63.svg"}},n={};function a(e){var r=n[e];if(void 0!==r)return r.exports;var c=n[e]={exports:{}};return t[e](c,c.exports,a),c.exports}a.m=t,e=[],a.O=function(t,n,r,c){if(!n){var s=1/0;for(d=0;d<e.length;d++){n=e[d][0],r=e[d][1],c=e[d][2];for(var l=!0,i=0;i<n.length;i++)(!1&c||s>=c)&&Object.keys(a.O).every((function(e){return a.O[e](n[i])}))?n.splice(i--,1):(l=!1,c<s&&(s=c));if(l){e.splice(d--,1);var o=r();void 0!==o&&(t=o)}}return t}c=c||0;for(var d=e.length;d>0&&e[d-1][2]>c;d--)e[d]=e[d-1];e[d]=[n,r,c]},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e}(),function(){var e={143:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,c,s=n[0],l=n[1],i=n[2],o=0;if(s.some((function(t){return 0!==e[t]}))){for(r in l)a.o(l,r)&&(a.m[r]=l[r]);if(i)var d=i(a)}for(t&&t(n);o<s.length;o++)c=s[o],a.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return a.O(d)},n=self.webpackChunk_rushstack_lockfile_explorer_web=self.webpackChunk_rushstack_lockfile_explorer_web||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var r=a.O(void 0,[414],(function(){return a(924)}));r=a.O(r)}();
|