@rushstack/lockfile-explorer 1.7.42 → 1.8.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.
Files changed (62) hide show
  1. package/CHANGELOG.json +64 -0
  2. package/CHANGELOG.md +21 -1
  3. package/build/lfx-shared/IAppContext.d.ts +32 -0
  4. package/build/lfx-shared/IAppContext.js +5 -0
  5. package/build/lfx-shared/IAppContext.js.map +1 -0
  6. package/build/lfx-shared/IJsonLfxGraph.d.ts +51 -0
  7. package/build/lfx-shared/IJsonLfxGraph.js +19 -0
  8. package/build/lfx-shared/IJsonLfxGraph.js.map +1 -0
  9. package/build/lfx-shared/IJsonLfxWorkspace.d.ts +59 -0
  10. package/build/lfx-shared/IJsonLfxWorkspace.js +5 -0
  11. package/build/lfx-shared/IJsonLfxWorkspace.js.map +1 -0
  12. package/build/lfx-shared/LfxGraph.d.ts +96 -0
  13. package/build/lfx-shared/LfxGraph.js +67 -0
  14. package/build/lfx-shared/LfxGraph.js.map +1 -0
  15. package/build/lfx-shared/index.d.ts +6 -0
  16. package/build/lfx-shared/index.js +12 -0
  17. package/build/lfx-shared/index.js.map +1 -0
  18. package/build/lfx-shared/lfxGraphSerializer.d.ts +5 -0
  19. package/build/lfx-shared/lfxGraphSerializer.js +121 -0
  20. package/build/lfx-shared/lfxGraphSerializer.js.map +1 -0
  21. package/dist/531.0e5a24ca1399529aa975.js +2 -0
  22. package/dist/{964.4bbaf68a6f1467df6770.js.LICENSE.txt → 531.0e5a24ca1399529aa975.js.LICENSE.txt} +13 -0
  23. package/dist/app.22259b754540a899e03d.js +1 -0
  24. package/dist/index.html +1 -1
  25. package/lib/cli/explorer/ExplorerCommandLineParser.d.ts.map +1 -1
  26. package/lib/cli/explorer/ExplorerCommandLineParser.js +61 -22
  27. package/lib/cli/explorer/ExplorerCommandLineParser.js.map +1 -1
  28. package/lib/cli/lint/actions/CheckAction.d.ts.map +1 -1
  29. package/lib/cli/lint/actions/CheckAction.js.map +1 -1
  30. package/lib/graph/IPnpmfileModule.d.ts +15 -0
  31. package/lib/graph/IPnpmfileModule.d.ts.map +1 -0
  32. package/lib/graph/IPnpmfileModule.js +5 -0
  33. package/lib/graph/IPnpmfileModule.js.map +1 -0
  34. package/lib/graph/PnpmfileRunner.d.ts +19 -0
  35. package/lib/graph/PnpmfileRunner.d.ts.map +1 -0
  36. package/lib/graph/PnpmfileRunner.js +123 -0
  37. package/lib/graph/PnpmfileRunner.js.map +1 -0
  38. package/lib/graph/lfxGraphLoader.d.ts +9 -0
  39. package/lib/graph/lfxGraphLoader.d.ts.map +1 -0
  40. package/lib/graph/lfxGraphLoader.js +408 -0
  41. package/lib/graph/lfxGraphLoader.js.map +1 -0
  42. package/lib/graph/lockfilePath.d.ts +37 -0
  43. package/lib/graph/lockfilePath.d.ts.map +1 -0
  44. package/lib/graph/lockfilePath.js +123 -0
  45. package/lib/graph/lockfilePath.js.map +1 -0
  46. package/lib/graph/pnpmfileRunnerWorkerThread.d.ts +23 -0
  47. package/lib/graph/pnpmfileRunnerWorkerThread.d.ts.map +1 -0
  48. package/lib/graph/pnpmfileRunnerWorkerThread.js +94 -0
  49. package/lib/graph/pnpmfileRunnerWorkerThread.js.map +1 -0
  50. package/lib/state/index.d.ts +4 -22
  51. package/lib/state/index.d.ts.map +1 -1
  52. package/lib/state/index.js +0 -6
  53. package/lib/state/index.js.map +1 -1
  54. package/lib/utils/init.d.ts +2 -2
  55. package/lib/utils/init.d.ts.map +1 -1
  56. package/lib/utils/init.js +73 -29
  57. package/lib/utils/init.js.map +1 -1
  58. package/lib/utils/shrinkwrap.d.ts.map +1 -1
  59. package/lib/utils/shrinkwrap.js.map +1 -1
  60. package/package.json +17 -15
  61. package/dist/964.4bbaf68a6f1467df6770.js +0 -2
  62. package/dist/app.acf2b912c3f02793012c.js +0 -1
@@ -4,6 +4,19 @@ object-assign
4
4
  @license MIT
5
5
  */
6
6
 
7
+ /*! Bundled license information:
8
+
9
+ prismjs/prism.js:
10
+ (**
11
+ * Prism: Lightweight, robust, elegant syntax highlighting
12
+ *
13
+ * @license MIT <https://opensource.org/licenses/MIT>
14
+ * @author Lea Verou <https://lea.verou.me>
15
+ * @namespace
16
+ * @public
17
+ *)
18
+ */
19
+
7
20
  /**
8
21
  * @license React
9
22
  * react-is.production.min.js
@@ -0,0 +1 @@
1
+ !function(){var e,t={158:function(e,t,n){"use strict";e.exports=n.p+"d13d30e9b42faf842d2f.svg"},201:function(e,t,n){"use strict";e.exports=n.p+"d39919ddc699d58b84ba.svg"},405:function(e,t,n){"use strict";e.exports=n.p+"510f03f81080fd3cfd63.svg"},509:function(e,t,n){var r,o;e.exports=(r=n(943),o=n(935),function(){"use strict";var e,t,n={66:function(e){e.exports=function(e){return e[1]}},125:function(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},155:function(e){e.exports=r},177:function(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},310:function(e,t,n){var r=n(66),o=n.n(r),a=n(771),l=n.n(a)()(o());l.push([e.id,'.gQUln75LgrNAv33iEQhx{border-radius:4px;overflow:hidden;--scrollbar-size: 6px;height:100%}.YABN5ZbWRfbX8Bbj41KF{width:100%;height:100%;border-radius:inherit}.YABN5ZbWRfbX8Bbj41KF>*{padding-right:8px}.ICjBreoW5ZAqZ9txdiH9{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;padding:2px;background:#f3f2f1;transition:background 160ms ease-out}.ICjBreoW5ZAqZ9txdiH9:hover{background:#f3f2f1}.ICjBreoW5ZAqZ9txdiH9[data-orientation=vertical]{width:var(--scrollbar-size)}.ICjBreoW5ZAqZ9txdiH9[data-orientation=horizontal]{flex-direction:column;height:var(--scrollbar-size)}.SNDfMaHFMf5swwou75WQ{flex:1;background:#107c10;border-radius:var(--scrollbar-size);position:relative}.SNDfMaHFMf5swwou75WQ::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:100%;height:100%;min-width:44px;min-height:44px}.KxOpf0j2WwULFJnM_2Up{background:#f3f2f1}',""]),l.locals={ScrollAreaRoot:"gQUln75LgrNAv33iEQhx",ScrollAreaViewport:"YABN5ZbWRfbX8Bbj41KF",ScrollAreaScrollbar:"ICjBreoW5ZAqZ9txdiH9",ScrollAreaThumb:"SNDfMaHFMf5swwou75WQ",ScrollAreaCorner:"KxOpf0j2WwULFJnM_2Up"},t.A=l},362:function(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},394:function(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},454:function(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},514:function(e){e.exports=o},574:function(e,t,n){var r=n(66),o=n.n(r),a=n(771),l=n.n(a)()(o());l.push([e.id,"button,fieldset,input{all:unset}.YhXMGBOKBRuKAvsx8mwk{display:flex;flex-direction:column;width:100%}.t08yVQir831gIp_A2xsP{flex-shrink:0;display:flex;border-bottom:1px solid #107c10}.L7_6rMInDO6tBxFRFiuO{font-family:inherit;padding:0 20px;height:45px;flex:1;display:flex;align-items:center;justify-content:center;font-size:15px;line-height:1;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.L7_6rMInDO6tBxFRFiuO:hover{color:#107c10;cursor:pointer}.L7_6rMInDO6tBxFRFiuO[data-state=active]{color:#107c10;box-shadow:inset 0 -1px 0 0 currentColor,0 1px 0 0 currentColor}.L7_6rMInDO6tBxFRFiuO:focus{position:relative;box-shadow:0 0 0 2px #107c10}.kLJtm9LC8LxOdvGhZdw_{flex-grow:1;padding:12px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;outline:none}.kLJtm9LC8LxOdvGhZdw_:focus{box-shadow:0 0 0 2px #000}",""]),l.locals={TabsRoot:"YhXMGBOKBRuKAvsx8mwk",TabsList:"t08yVQir831gIp_A2xsP",TabsTrigger:"L7_6rMInDO6tBxFRFiuO",TabsContent:"kLJtm9LC8LxOdvGhZdw_"},t.A=l},761:function(e,t,n){var r=n(66),o=n.n(r),a=n(771),l=n.n(a)()(o());l.push([e.id,"button{all:unset}.i8BZVdjUfbst7_tarHzS{background-color:#fff;width:25px;min-width:25px;height:25px;border-radius:4px;display:flex;align-items:center;justify-content:center;border:1px solid #000;cursor:pointer}.i8BZVdjUfbst7_tarHzS:hover{background-color:#dff6dd}.l0YazbYK7P8YQSDvX2o0{color:#107c10}.w9I3BjE7cnjsfBLB3UyI{padding-left:15px;font-size:15px;line-height:1;-webkit-user-select:none;-moz-user-select:none;user-select:none}",""]),l.locals={CheckboxRoot:"i8BZVdjUfbst7_tarHzS",CheckboxIndicator:"l0YazbYK7P8YQSDvX2o0",Label:"w9I3BjE7cnjsfBLB3UyI"},t.A=l},771:function(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var l={};if(r)for(var c=0;c<this.length;c++){var s=this[c][0];null!=s&&(l[s]=!0)}for(var i=0;i<e.length;i++){var d=[].concat(e[i]);r&&l[d[0]]||(void 0!==a&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),t.push(d))}},t}},779:function(e,t,n){var r=n(66),o=n.n(r),a=n(771),l=n.n(a)()(o());l.push([e.id,'.EEW4moi09VKPLYf_QQjc{font-weight:bold;line-height:1.2;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:24px}.J7ir6XIWo7jdiI2ntfcg{font-weight:bold;line-height:1.2;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:21px}.SWvmPuRvIE0SV9q04VZG{font-weight:bold;line-height:1.2;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:19px}.QHCu9OO40pSJaXahbkYF{font-weight:bold;line-height:1.2;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:16px}.oK4n_cRPbdF5MN5Ed_h2{font-weight:bold;line-height:1.2;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:14px}.odUGt__AQTdr_z7W6Fk7{font-weight:bold;line-height:1.2;margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:12px}.f_gEnP5sMtd6eYNOiYQQ{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;margin:0;font-weight:normal;line-height:1.5;font-size:14px}.aLGFzKvQOPA_BfQw5vqO{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:12px}',""]),l.locals={H1:"EEW4moi09VKPLYf_QQjc",H2:"J7ir6XIWo7jdiI2ntfcg",H3:"SWvmPuRvIE0SV9q04VZG",H4:"QHCu9OO40pSJaXahbkYF",H5:"oK4n_cRPbdF5MN5Ed_h2",H6:"odUGt__AQTdr_z7W6Fk7",ParagraphStyles:"f_gEnP5sMtd6eYNOiYQQ",SpanStyles:"aLGFzKvQOPA_BfQw5vqO"},t.A=l},794:function(e,t,n){var r=n(66),o=n.n(r),a=n(771),l=n.n(a)()(o());l.push([e.id,".dVadg6u2kwiGWhobva5n{padding:4px 8px;border:1px solid #107c10;border-radius:2px}.dVadg6u2kwiGWhobva5n:hover{cursor:pointer;background-color:#dff6dd}.dVadg6u2kwiGWhobva5n:disabled{cursor:default;background-color:#fff;color:#666;border-color:#ab9e8e}",""]),l.locals={ButtonWrapper:"dVadg6u2kwiGWhobva5n"},t.A=l},821:function(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},l=[],c=0;c<e.length;c++){var s=e[c],i=r.base?s[0]+r.base:s[0],d=a[i]||0,u="".concat(i," ").concat(d);a[i]=d+1;var p=n(u),f={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==p)t[p].references++,t[p].updater(f);else{var m=o(f,r);r.byIndex=c,t.splice(c,0,{identifier:u,updater:m,references:1})}l.push(u)}return l}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var l=0;l<a.length;l++){var c=n(a[l]);t[c].references--}for(var s=r(e,o),i=0;i<a.length;i++){var d=n(a[i]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}a=s}}},936:function(e,t,n){var r=n(66),o=n.n(r),a=n(771),l=n.n(a)()(o());l.push([e.id,".FYuNNcaXqlTXB7M6DHBZ{border:solid 1px #666;border-radius:4px;padding:.4em}",""]),l.locals={InputWrapper:"FYuNNcaXqlTXB7M6DHBZ"},t.A=l}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={id:e,exports:{}};return n[e](r,r.exports,l),r.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},l.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);l.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var c=2&r&&n;"object"==typeof c&&!~e.indexOf(c);c=t(c))Object.getOwnPropertyNames(c).forEach((function(e){a[e]=function(){return n[e]}}));return a.default=function(){return n},l.d(o,a),o},l.d=function(e,t){for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.nc=void 0;var c={};l.r(c),l.d(c,{Button:function(){return I},Checkbox:function(){return Lt},Input:function(){return Ht},ScrollArea:function(){return Le},Tabs:function(){return bt},Text:function(){return T}});var s=l(155),i=l.t(s,2),d=l.n(s),u=l(821),p=l.n(u),f=l(394),m=l.n(f),h=l(362),v=l.n(h),y=l(125),g=l.n(y),E=l(177),b=l.n(E),w=l(454),k=l.n(w),S=l(779),x={};x.styleTagTransform=k(),x.setAttributes=g(),x.insert=v().bind(null,"head"),x.domAPI=m(),x.insertStyleElement=b(),p()(S.A,x);var C=S.A&&S.A.locals?S.A.locals:void 0;const T=({type:e,bold:t=!1,children:n,className:r,size:o})=>{const a=Object.assign({fontWeight:t?"bold":"normal"},o?{fontSize:o}:{});switch(e){case"h1":return d().createElement("h1",{className:`${C.H1} ${r||""}`,style:a},n);case"h2":return d().createElement("h2",{className:`${C.H2} ${r||""}`,style:a},n);case"h3":return d().createElement("h3",{className:`${C.H3} ${r||""}`,style:a},n);case"h4":return d().createElement("h4",{className:`${C.H4} ${r||""}`,style:a},n);case"h5":return d().createElement("h5",{className:`${C.H5} ${r||""}`,style:a},n);case"h6":return d().createElement("h6",{className:`${C.H6} ${r||""}`,style:a},n);case"p":default:return d().createElement("p",{className:`${C.ParagraphStyles} ${r||""}`,style:a},n);case"span":return d().createElement("span",{className:`${C.SpanStyles} ${r||""}`,style:a},n)}};var P=l(794),N={};N.styleTagTransform=k(),N.setAttributes=g(),N.insert=v().bind(null,"head"),N.domAPI=m(),N.insertStyleElement=b(),p()(P.A,N);var A=P.A&&P.A.locals?P.A.locals:void 0;const I=({children:e,disabled:t=!1,onClick:n})=>d().createElement("button",{disabled:t,className:A.ButtonWrapper,onClick:n},d().createElement(T,{type:"span",size:14},e));function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O.apply(this,arguments)}var R=l(514);function _(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function j(...e){return(0,s.useCallback)(_(...e),e)}const D=(0,s.forwardRef)(((e,t)=>{const{children:n,...r}=e,o=s.Children.toArray(n),a=o.find(F);if(a){const e=a.props.children,n=o.map((t=>t===a?s.Children.count(e)>1?s.Children.only(null):(0,s.isValidElement)(e)?e.props.children:null:t));return(0,s.createElement)(M,O({},r,{ref:t}),(0,s.isValidElement)(e)?(0,s.cloneElement)(e,void 0,n):null)}return(0,s.createElement)(M,O({},r,{ref:t}),n)}));D.displayName="Slot";const M=(0,s.forwardRef)(((e,t)=>{const{children:n,...r}=e;return(0,s.isValidElement)(n)?(0,s.cloneElement)(n,{...B(r,n.props),ref:t?_(t,n.ref):n.ref}):s.Children.count(n)>1?s.Children.only(null):null}));M.displayName="SlotClone";const L=({children:e})=>(0,s.createElement)(s.Fragment,null,e);function F(e){return(0,s.isValidElement)(e)&&e.type===L}function B(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{a(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}const z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=(0,s.forwardRef)(((e,n)=>{const{asChild:r,...o}=e,a=r?D:t;return(0,s.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,s.createElement)(a,O({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{}),H=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?s.useLayoutEffect:()=>{},U=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=(0,s.useState)(),r=(0,s.useRef)({}),o=(0,s.useRef)(e),a=(0,s.useRef)("none"),l=e?"mounted":"unmounted",[c,i]=function(e,t){return(0,s.useReducer)(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,s.useEffect)((()=>{const e=$(r.current);a.current="mounted"===c?e:"none"}),[c]),H((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,l=$(t);e?i("MOUNT"):"none"===l||"none"===(null==t?void 0:t.display)?i("UNMOUNT"):i(n&&r!==l?"ANIMATION_OUT":"UNMOUNT"),o.current=e}}),[e,i]),H((()=>{if(t){const e=e=>{const n=$(r.current).includes(e.animationName);e.target===t&&n&&(0,R.flushSync)((()=>i("ANIMATION_END")))},n=e=>{e.target===t&&(a.current=$(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}i("ANIMATION_END")}),[t,i]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:(0,s.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):s.Children.only(n),a=j(r.ref,o.ref);return"function"==typeof n||r.isPresent?(0,s.cloneElement)(o,{ref:a}):null};function $(e){return(null==e?void 0:e.animationName)||"none"}function W(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>(0,s.createContext)(e)));return function(n){const r=(null==n?void 0:n[e])||t;return(0,s.useMemo)((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=(0,s.createContext)(r),a=n.length;function l(t){const{scope:n,children:r,...l}=t,c=(null==n?void 0:n[e][a])||o,i=(0,s.useMemo)((()=>l),Object.values(l));return(0,s.createElement)(c.Provider,{value:i},r)}return n=[...n,r],l.displayName=t+"Provider",[l,function(n,l){const c=(null==l?void 0:l[e][a])||o,i=(0,s.useContext)(c);if(i)return i;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},V(r,...t)]}function V(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return(0,s.useMemo)((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function X(e){const t=(0,s.useRef)(e);return(0,s.useEffect)((()=>{t.current=e})),(0,s.useMemo)((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}U.displayName="Presence";const K=(0,s.createContext)(void 0);function Y(e){const t=(0,s.useContext)(K);return e||t||"ltr"}function Z(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}const J="ScrollArea",[G,Q]=W(J),[q,ee]=G(J),te=(0,s.forwardRef)(((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:a=600,...l}=e,[c,i]=(0,s.useState)(null),[d,u]=(0,s.useState)(null),[p,f]=(0,s.useState)(null),[m,h]=(0,s.useState)(null),[v,y]=(0,s.useState)(null),[g,E]=(0,s.useState)(0),[b,w]=(0,s.useState)(0),[k,S]=(0,s.useState)(!1),[x,C]=(0,s.useState)(!1),T=j(t,(e=>i(e))),P=Y(o);return(0,s.createElement)(q,{scope:n,type:r,dir:P,scrollHideDelay:a,scrollArea:c,viewport:d,onViewportChange:u,content:p,onContentChange:f,scrollbarX:m,onScrollbarXChange:h,scrollbarXEnabled:k,onScrollbarXEnabledChange:S,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:x,onScrollbarYEnabledChange:C,onCornerWidthChange:E,onCornerHeightChange:w},(0,s.createElement)(z.div,O({dir:P},l,{ref:T,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})))})),ne=(0,s.forwardRef)(((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,a=ee("ScrollAreaViewport",n),l=j(t,(0,s.useRef)(null),a.onViewportChange);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),(0,s.createElement)(z.div,O({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style}}),(0,s.createElement)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"}},r)))})),re="ScrollAreaScrollbar",oe=(0,s.forwardRef)(((e,t)=>{const{forceMount:n,...r}=e,o=ee(re,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:l}=o,c="horizontal"===e.orientation;return(0,s.useEffect)((()=>(c?a(!0):l(!0),()=>{c?a(!1):l(!1)})),[c,a,l]),"hover"===o.type?(0,s.createElement)(ae,O({},r,{ref:t,forceMount:n})):"scroll"===o.type?(0,s.createElement)(le,O({},r,{ref:t,forceMount:n})):"auto"===o.type?(0,s.createElement)(ce,O({},r,{ref:t,forceMount:n})):"always"===o.type?(0,s.createElement)(se,O({},r,{ref:t})):null})),ae=(0,s.forwardRef)(((e,t)=>{const{forceMount:n,...r}=e,o=ee(re,e.__scopeScrollArea),[a,l]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{const e=o.scrollArea;let t=0;if(e){const n=()=>{window.clearTimeout(t),l(!0)},r=()=>{t=window.setTimeout((()=>l(!1)),o.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",r)}}}),[o.scrollArea,o.scrollHideDelay]),(0,s.createElement)(U,{present:n||a},(0,s.createElement)(ce,O({"data-state":a?"visible":"hidden"},r,{ref:t})))})),le=(0,s.forwardRef)(((e,t)=>{const{forceMount:n,...r}=e,o=ee(re,e.__scopeScrollArea),a="horizontal"===e.orientation,l=Pe((()=>i("SCROLL_END")),100),[c,i]=(d={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},(0,s.useReducer)(((e,t)=>{const n=d[e][t];return null!=n?n:e}),"hidden"));var d;return(0,s.useEffect)((()=>{if("idle"===c){const e=window.setTimeout((()=>i("HIDE")),o.scrollHideDelay);return()=>window.clearTimeout(e)}}),[c,o.scrollHideDelay,i]),(0,s.useEffect)((()=>{const e=o.viewport,t=a?"scrollLeft":"scrollTop";if(e){let n=e[t];const r=()=>{const r=e[t];n!==r&&(i("SCROLL"),l()),n=r};return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}}),[o.viewport,a,i,l]),(0,s.createElement)(U,{present:n||"hidden"!==c},(0,s.createElement)(se,O({"data-state":"hidden"===c?"hidden":"visible"},r,{ref:t,onPointerEnter:Z(e.onPointerEnter,(()=>i("POINTER_ENTER"))),onPointerLeave:Z(e.onPointerLeave,(()=>i("POINTER_LEAVE")))})))})),ce=(0,s.forwardRef)(((e,t)=>{const n=ee(re,e.__scopeScrollArea),{forceMount:r,...o}=e,[a,l]=(0,s.useState)(!1),c="horizontal"===e.orientation,i=Pe((()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;l(c?e:t)}}),10);return Ne(n.viewport,i),Ne(n.content,i),(0,s.createElement)(U,{present:r||a},(0,s.createElement)(se,O({"data-state":a?"visible":"hidden"},o,{ref:t})))})),se=(0,s.forwardRef)(((e,t)=>{const{orientation:n="vertical",...r}=e,o=ee(re,e.__scopeScrollArea),a=(0,s.useRef)(null),l=(0,s.useRef)(0),[c,i]=(0,s.useState)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=we(c.viewport,c.content),u={...r,sizes:c,onSizesChange:i,hasThumb:Boolean(d>0&&d<1),onThumbChange:e=>a.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function p(e,t){return function(e,t,n,r="ltr"){const o=ke(n),a=t||o/2,l=o-a,c=n.scrollbar.paddingStart+a,s=n.scrollbar.size-n.scrollbar.paddingEnd-l,i=n.content-n.viewport;return xe([c,s],"ltr"===r?[0,i]:[-1*i,0])(e)}(e,l.current,c,t)}return"horizontal"===n?(0,s.createElement)(ie,O({},u,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&a.current){const e=Se(o.viewport.scrollLeft,c,o.dir);a.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=p(e,o.dir))}})):"vertical"===n?(0,s.createElement)(de,O({},u,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&a.current){const e=Se(o.viewport.scrollTop,c);a.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=p(e))}})):null})),ie=(0,s.forwardRef)(((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,a=ee(re,e.__scopeScrollArea),[l,c]=(0,s.useState)(),i=(0,s.useRef)(null),d=j(t,i,a.onScrollbarXChange);return(0,s.useEffect)((()=>{i.current&&c(getComputedStyle(i.current))}),[i]),(0,s.createElement)(fe,O({"data-orientation":"horizontal"},o,{ref:d,sizes:n,style:{bottom:0,left:"rtl"===a.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===a.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ke(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){const r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Ce(r,n)&&t.preventDefault()}},onResize:()=>{i.current&&a.viewport&&l&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:be(l.paddingLeft),paddingEnd:be(l.paddingRight)}})}}))})),de=(0,s.forwardRef)(((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,a=ee(re,e.__scopeScrollArea),[l,c]=(0,s.useState)(),i=(0,s.useRef)(null),d=j(t,i,a.onScrollbarYChange);return(0,s.useEffect)((()=>{i.current&&c(getComputedStyle(i.current))}),[i]),(0,s.createElement)(fe,O({"data-orientation":"vertical"},o,{ref:d,sizes:n,style:{top:0,right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ke(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){const r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Ce(r,n)&&t.preventDefault()}},onResize:()=>{i.current&&a.viewport&&l&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:be(l.paddingTop),paddingEnd:be(l.paddingBottom)}})}}))})),[ue,pe]=G(re),fe=(0,s.forwardRef)(((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:a,onThumbPointerUp:l,onThumbPointerDown:c,onThumbPositionChange:i,onDragScroll:d,onWheelScroll:u,onResize:p,...f}=e,m=ee(re,n),[h,v]=(0,s.useState)(null),y=j(t,(e=>v(e))),g=(0,s.useRef)(null),E=(0,s.useRef)(""),b=m.viewport,w=r.content-r.viewport,k=X(u),S=X(i),x=Pe(p,10);function C(e){if(g.current){const t=e.clientX-g.current.left,n=e.clientY-g.current.top;d({x:t,y:n})}}return(0,s.useEffect)((()=>{const e=e=>{const t=e.target;(null==h?void 0:h.contains(t))&&k(e,w)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})}),[b,h,w,k]),(0,s.useEffect)(S,[r,S]),Ne(h,x),Ne(m.content,x),(0,s.createElement)(ue,{scope:n,scrollbar:h,hasThumb:o,onThumbChange:X(a),onThumbPointerUp:X(l),onThumbPositionChange:S,onThumbPointerDown:X(c)},(0,s.createElement)(z.div,O({},f,{ref:y,style:{position:"absolute",...f.style},onPointerDown:Z(e.onPointerDown,(e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),g.current=h.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),C(e))})),onPointerMove:Z(e.onPointerMove,C),onPointerUp:Z(e.onPointerUp,(e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=E.current,m.viewport&&(m.viewport.style.scrollBehavior=""),g.current=null}))})))})),me="ScrollAreaThumb",he=(0,s.forwardRef)(((e,t)=>{const{forceMount:n,...r}=e,o=pe(me,e.__scopeScrollArea);return(0,s.createElement)(U,{present:n||o.hasThumb},(0,s.createElement)(ve,O({ref:t},r)))})),ve=(0,s.forwardRef)(((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,a=ee(me,n),l=pe(me,n),{onThumbPositionChange:c}=l,i=j(t,(e=>l.onThumbChange(e))),d=(0,s.useRef)(),u=Pe((()=>{d.current&&(d.current(),d.current=void 0)}),100);return(0,s.useEffect)((()=>{const e=a.viewport;if(e){const t=()=>{if(u(),!d.current){const t=Te(e,c);d.current=t,c()}};return c(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}}),[a.viewport,u,c]),(0,s.createElement)(z.div,O({"data-state":l.hasThumb?"visible":"hidden"},o,{ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Z(e.onPointerDownCapture,(e=>{const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;l.onThumbPointerDown({x:n,y:r})})),onPointerUp:Z(e.onPointerUp,l.onThumbPointerUp)}))})),ye="ScrollAreaCorner",ge=(0,s.forwardRef)(((e,t)=>{const n=ee(ye,e.__scopeScrollArea),r=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&r?(0,s.createElement)(Ee,O({},e,{ref:t})):null})),Ee=(0,s.forwardRef)(((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=ee(ye,n),[a,l]=(0,s.useState)(0),[c,i]=(0,s.useState)(0),d=Boolean(a&&c);return Ne(o.scrollbarX,(()=>{var e;const t=(null===(e=o.scrollbarX)||void 0===e?void 0:e.offsetHeight)||0;o.onCornerHeightChange(t),i(t)})),Ne(o.scrollbarY,(()=>{var e;const t=(null===(e=o.scrollbarY)||void 0===e?void 0:e.offsetWidth)||0;o.onCornerWidthChange(t),l(t)})),d?(0,s.createElement)(z.div,O({},r,{ref:t,style:{width:a,height:c,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...e.style}})):null}));function be(e){return e?parseInt(e,10):0}function we(e,t){const n=e/t;return isNaN(n)?0:n}function ke(e){const t=we(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function Se(e,t,n="ltr"){const r=ke(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-o,l=t.content-t.viewport,c=a-r,s=function(e,[t,n]){return Math.min(n,Math.max(t,e))}(e,"ltr"===n?[0,l]:[-1*l,0]);return xe([0,l],[0,c])(s)}function xe(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Ce(e,t){return e>0&&e<t}const Te=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const a={left:e.scrollLeft,top:e.scrollTop},l=n.left!==a.left,c=n.top!==a.top;(l||c)&&t(),n=a,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Pe(e,t){const n=X(e),r=(0,s.useRef)(0);return(0,s.useEffect)((()=>()=>window.clearTimeout(r.current)),[]),(0,s.useCallback)((()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)}),[n,t])}function Ne(e,t){const n=X(t);H((()=>{let t=0;if(e){const r=new ResizeObserver((()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)}));return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}}),[e,n])}const Ae=te,Ie=ne,Oe=oe,Re=he,_e=ge;var je=l(310),De={};De.styleTagTransform=k(),De.setAttributes=g(),De.insert=v().bind(null,"head"),De.domAPI=m(),De.insertStyleElement=b(),p()(je.A,De);var Me=je.A&&je.A.locals?je.A.locals:void 0;const Le=({children:e})=>d().createElement(Ae,{className:Me.ScrollAreaRoot},d().createElement(Ie,{className:Me.ScrollAreaViewport},e),d().createElement(Oe,{className:Me.ScrollAreaScrollbar,orientation:"vertical"},d().createElement(Re,{className:Me.ScrollAreaThumb})),d().createElement(Oe,{className:Me.ScrollAreaScrollbar,orientation:"horizontal"},d().createElement(Re,{className:Me.ScrollAreaThumb})),d().createElement(_e,{className:Me.ScrollAreaCorner})),Fe=i["useId".toString()]||(()=>{});let Be=0;function ze(e){const[t,n]=s.useState(Fe());return H((()=>{e||n((e=>null!=e?e:String(Be++)))}),[e]),e||(t?`radix-${t}`:"")}function He({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=function({defaultProp:e,onChange:t}){const n=(0,s.useState)(e),[r]=n,o=(0,s.useRef)(r),a=X(t);return(0,s.useEffect)((()=>{o.current!==r&&(a(r),o.current=r)}),[r,o,a]),n}({defaultProp:t,onChange:n}),a=void 0!==e,l=a?e:r,c=X(n);return[l,(0,s.useCallback)((t=>{if(a){const n="function"==typeof t?t(e):t;n!==e&&c(n)}else o(t)}),[a,e,o,c])]}const Ue="rovingFocusGroup.onEntryFocus",$e={bubbles:!1,cancelable:!0},We="RovingFocusGroup",[Ve,Xe,Ke]=function(e){const t=e+"CollectionProvider",[n,r]=W(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=e+"CollectionSlot",c=e+"CollectionItemSlot",i="data-radix-collection-item";return[{Provider:e=>{const{scope:t,children:n}=e,r=s.useRef(null),a=s.useRef(new Map).current;return s.createElement(o,{scope:t,itemMap:a,collectionRef:r},n)},Slot:s.forwardRef(((e,t)=>{const{scope:n,children:r}=e,o=j(t,a(l,n).collectionRef);return s.createElement(D,{ref:o},r)})),ItemSlot:s.forwardRef(((e,t)=>{const{scope:n,children:r,...o}=e,l=s.useRef(null),d=j(t,l),u=a(c,n);return s.useEffect((()=>(u.itemMap.set(l,{ref:l,...o}),()=>{u.itemMap.delete(l)}))),s.createElement(D,{[i]:"",ref:d},r)}))},function(t){const n=a(e+"CollectionConsumer",t);return s.useCallback((()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${i}]`));return Array.from(n.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[n.collectionRef,n.itemMap])},r]}(We),[Ye,Ze]=W(We,[Ke]),[Je,Ge]=Ye(We),Qe=(0,s.forwardRef)(((e,t)=>(0,s.createElement)(Ve.Provider,{scope:e.__scopeRovingFocusGroup},(0,s.createElement)(Ve.Slot,{scope:e.__scopeRovingFocusGroup},(0,s.createElement)(qe,O({},e,{ref:t})))))),qe=(0,s.forwardRef)(((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:i,onEntryFocus:d,...u}=e,p=(0,s.useRef)(null),f=j(t,p),m=Y(a),[h=null,v]=He({prop:l,defaultProp:c,onChange:i}),[y,g]=(0,s.useState)(!1),E=X(d),b=Xe(n),w=(0,s.useRef)(!1),[k,S]=(0,s.useState)(0);return(0,s.useEffect)((()=>{const e=p.current;if(e)return e.addEventListener(Ue,E),()=>e.removeEventListener(Ue,E)}),[E]),(0,s.createElement)(Je,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:h,onItemFocus:(0,s.useCallback)((e=>v(e)),[v]),onItemShiftTab:(0,s.useCallback)((()=>g(!0)),[]),onFocusableItemAdd:(0,s.useCallback)((()=>S((e=>e+1))),[]),onFocusableItemRemove:(0,s.useCallback)((()=>S((e=>e-1))),[])},(0,s.createElement)(z.div,O({tabIndex:y||0===k?-1:0,"data-orientation":r},u,{ref:f,style:{outline:"none",...e.style},onMouseDown:Z(e.onMouseDown,(()=>{w.current=!0})),onFocus:Z(e.onFocus,(e=>{const t=!w.current;if(e.target===e.currentTarget&&t&&!y){const t=new CustomEvent(Ue,$e);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=b().filter((e=>e.focusable));nt([e.find((e=>e.active)),e.find((e=>e.id===h)),...e].filter(Boolean).map((e=>e.ref.current)))}}w.current=!1})),onBlur:Z(e.onBlur,(()=>g(!1)))})))})),et=(0,s.forwardRef)(((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,...l}=e,c=ze(),i=a||c,d=Ge("RovingFocusGroupItem",n),u=d.currentTabStopId===i,p=Xe(n),{onFocusableItemAdd:f,onFocusableItemRemove:m}=d;return(0,s.useEffect)((()=>{if(r)return f(),()=>m()}),[r,f,m]),(0,s.createElement)(Ve.ItemSlot,{scope:n,id:i,focusable:r,active:o},(0,s.createElement)(z.span,O({tabIndex:u?0:-1,"data-orientation":d.orientation},l,{ref:t,onMouseDown:Z(e.onMouseDown,(e=>{r?d.onItemFocus(i):e.preventDefault()})),onFocus:Z(e.onFocus,(()=>d.onItemFocus(i))),onKeyDown:Z(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:tt[r]}(e,d.orientation,d.dir);if(void 0!==t){e.preventDefault();let o=p().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const a=o.indexOf(e.currentTarget);o=d.loop?(r=a+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(a+1)}setTimeout((()=>nt(o)))}var n,r}))})))})),tt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nt(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}const rt=Qe,ot=et,at="Tabs",[lt,ct]=W(at,[Ze]),st=Ze(),[it,dt]=lt(at);function ut(e,t){return`${e}-trigger-${t}`}function pt(e,t){return`${e}-content-${t}`}const ft=(0,s.forwardRef)(((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:l="horizontal",dir:c,activationMode:i="automatic",...d}=e,u=Y(c),[p,f]=He({prop:r,onChange:o,defaultProp:a});return(0,s.createElement)(it,{scope:n,baseId:ze(),value:p,onValueChange:f,orientation:l,dir:u,activationMode:i},(0,s.createElement)(z.div,O({dir:u,"data-orientation":l},d,{ref:t})))})),mt=(0,s.forwardRef)(((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,a=dt("TabsList",n),l=st(n);return(0,s.createElement)(rt,O({asChild:!0},l,{orientation:a.orientation,dir:a.dir,loop:r}),(0,s.createElement)(z.div,O({role:"tablist","aria-orientation":a.orientation},o,{ref:t})))})),ht=(0,s.forwardRef)(((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=e,l=dt("TabsTrigger",n),c=st(n),i=ut(l.baseId,r),d=pt(l.baseId,r),u=r===l.value;return(0,s.createElement)(ot,O({asChild:!0},c,{focusable:!o,active:u}),(0,s.createElement)(z.button,O({type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:i},a,{ref:t,onMouseDown:Z(e.onMouseDown,(e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():l.onValueChange(r)})),onKeyDown:Z(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&l.onValueChange(r)})),onFocus:Z(e.onFocus,(()=>{const e="manual"!==l.activationMode;u||o||!e||l.onValueChange(r)}))})))})),vt=(0,s.forwardRef)(((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...l}=e,c=dt("TabsContent",n),i=ut(c.baseId,r),d=pt(c.baseId,r),u=r===c.value,p=(0,s.useRef)(u);return(0,s.useEffect)((()=>{const e=requestAnimationFrame((()=>p.current=!1));return()=>cancelAnimationFrame(e)}),[]),(0,s.createElement)(U,{present:o||u},(({present:n})=>(0,s.createElement)(z.div,O({"data-state":u?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":i,hidden:!n,id:d,tabIndex:0},l,{ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0}}),n&&a)))}));var yt=l(574),gt={};gt.styleTagTransform=k(),gt.setAttributes=g(),gt.insert=v().bind(null,"head"),gt.domAPI=m(),gt.insertStyleElement=b(),p()(yt.A,gt);var Et=yt.A&&yt.A.locals?yt.A.locals:void 0;const bt=({items:e,def:t,value:n,onChange:r,renderChildren:o})=>{const a=e=>void 0===e.value?e.header:e.value;return d().createElement(ft,{className:Et.TabsRoot,defaultValue:t||e[0].header,value:n,onValueChange:r},d().createElement(mt,{className:Et.TabsList,"aria-label":"Manage your account"},e.map((e=>d().createElement(ht,{key:e.header,className:Et.TabsTrigger,value:a(e)},e.header)))),o?o():e.map(((e,t)=>e.body?d().createElement(vt,{key:`${t}`,className:Et.TabsContent,value:a(e)},e.body):null)))},wt="Checkbox",[kt,St]=W(wt),[xt,Ct]=kt(wt),Tt=(0,s.forwardRef)(((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:l,disabled:c,value:i="on",onCheckedChange:d,...u}=e,[p,f]=(0,s.useState)(null),m=j(t,(e=>f(e))),h=(0,s.useRef)(!1),v=!p||Boolean(p.closest("form")),[y=!1,g]=He({prop:o,defaultProp:a,onChange:d}),E=(0,s.useRef)(y);return(0,s.useEffect)((()=>{const e=null==p?void 0:p.form;if(e){const t=()=>g(E.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[p,g]),(0,s.createElement)(xt,{scope:n,state:y,disabled:c},(0,s.createElement)(z.button,O({type:"button",role:"checkbox","aria-checked":Nt(y)?"mixed":y,"aria-required":l,"data-state":At(y),"data-disabled":c?"":void 0,disabled:c,value:i},u,{ref:m,onKeyDown:Z(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:Z(e.onClick,(e=>{g((e=>!!Nt(e)||!e)),v&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())}))})),v&&(0,s.createElement)(Pt,{control:p,bubbles:!h.current,name:r,value:i,checked:y,required:l,disabled:c,style:{transform:"translateX(-100%)"}}))})),Pt=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,a=(0,s.useRef)(null),l=function(e){const t=(0,s.useRef)({value:e,previous:e});return(0,s.useMemo)((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(n),c=function(e){const[t,n]=(0,s.useState)(void 0);return H((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(t);return(0,s.useEffect)((()=>{const e=a.current,t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==n&&o){const t=new Event("click",{bubbles:r});e.indeterminate=Nt(n),o.call(e,!Nt(n)&&n),e.dispatchEvent(t)}}),[l,n,r]),(0,s.createElement)("input",O({type:"checkbox","aria-hidden":!0,defaultChecked:!Nt(n)&&n},o,{tabIndex:-1,ref:a,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function Nt(e){return"indeterminate"===e}function At(e){return Nt(e)?"indeterminate":e?"checked":"unchecked"}const It=Tt,Ot=(0,s.forwardRef)(((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=Ct("CheckboxIndicator",n);return(0,s.createElement)(U,{present:r||Nt(a.state)||!0===a.state},(0,s.createElement)(z.span,O({"data-state":At(a.state),"data-disabled":a.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}));var Rt=["color"],_t=(0,s.forwardRef)((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,Rt);return(0,s.createElement)("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),(0,s.createElement)("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),jt=l(761),Dt={};Dt.styleTagTransform=k(),Dt.setAttributes=g(),Dt.insert=v().bind(null,"head"),Dt.domAPI=m(),Dt.insertStyleElement=b(),p()(jt.A,Dt);var Mt=jt.A&&jt.A.locals?jt.A.locals:void 0;const Lt=({label:e,isChecked:t,onChecked:n})=>d().createElement("form",null,d().createElement("div",{style:{display:"flex",alignItems:"center"}},d().createElement(It,{className:Mt.CheckboxRoot,defaultChecked:!0,checked:t,onCheckedChange:n,id:e},d().createElement(Ot,{className:Mt.CheckboxIndicator},d().createElement(_t,null))),d().createElement("label",{className:Mt.Label,htmlFor:e},e)));var Ft=l(936),Bt={};Bt.styleTagTransform=k(),Bt.setAttributes=g(),Bt.insert=v().bind(null,"head"),Bt.domAPI=m(),Bt.insertStyleElement=b(),p()(Ft.A,Bt);var zt=Ft.A&&Ft.A.locals?Ft.A.locals:void 0;const Ht=({value:e,placeholder:t,onChange:n,type:r="text"})=>d().createElement("input",{type:r,value:e,placeholder:t,onChange:n,className:zt.InputWrapper});return c}())},758:function(e,t,n){"use strict";var r,o,a=n(943),l=n(935),c="HK80a6ZVkdxoTKzrP9Eq",s="HqAzbQwu1zc9yH8ZQESI";!function(e){e[e.Project=1]="Project",e[e.Package=2]="Package",e[e.SideBySide=3]="SideBySide",e[e.Doppelganger=4]="Doppelganger"}(r||(r={})),function(e){e.Regular="regular",e.Dev="dev",e.Peer="peer"}(o||(o={}));class i{constructor(e){this.resolvedEntry=void 0,this.name=e.name,this.version=e.version,this.dependencyType=e.dependencyType,this.containingEntry=e.containingEntry,this.entryId=e.entryId,this.peerDependencyMeta=e.peerDependencyMeta}}class d{constructor(e){this.dependencies=[],this.transitivePeerDependencies=new Set,this.referrers=[],this.kind=e.kind,this.entryId=e.entryId,this.rawEntryId=e.rawEntryId,this.packageJsonFolderPath=e.packageJsonFolderPath,this.entryPackageName=e.entryPackageName,this.displayText=e.displayText,this.entryPackageVersion=e.entryPackageVersion,this.entrySuffix=e.entrySuffix}}class u{constructor(e){this.entries=[],this.workspace=Object.assign({},e)}}const p=window.appContext.serviceUrl;var f="OcndyDBetZor3ptzTnTX",m="Wg5pG3RVf6SQ51i0tVkd",h="NBIr3yosJ9gX6LZcnC7T";const v=null;var y=n(299);const g=y.wA,E=y.d4;var b=n(300);const w="LOCKFILE_EXPLORER_BOOKMARKS",k="LOCKFILE_EXPLORER_PROJECT_FILTER",S="LOCKFILE_EXPLORER_PACKAGE_FILTER",x=e=>e===r.Project?localStorage.getItem(k)||"":localStorage.getItem(S)||"",C={allEntries:[],filters:{[r.Project]:!1,[r.Package]:!0,[r.SideBySide]:!1,[r.Doppelganger]:!1},selectedEntryStack:[],selectedEntryForwardStack:[],bookmarkedEntries:[]},T=(0,b.Z0)({name:"entry",initialState:C,reducers:{loadEntries:(e,t)=>{e.allEntries=t.payload;const n=(()=>{const e=JSON.parse(localStorage.getItem(w)||"{}"),t=new Set;for(const n of Object.keys(e))t.add(n);return t})();for(const r of t.payload)n.has(r.rawEntryId)&&e.bookmarkedEntries.push(r)},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(w)||"{}");n[t]=!0,localStorage.setItem(w,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(w)||"{}");delete n[t],localStorage.setItem(w,JSON.stringify(n))})(t.payload)}}}),P=e=>e.entry.selectedEntryStack.length?e.entry.selectedEntryStack[e.entry.selectedEntryStack.length-1]:void 0,N=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:A,setFilter:I,clearStackAndPush:O,pushToStack:R,popStack:_,forwardStack:j,addBookmark:D,removeBookmark:M}=T.actions,L=T.reducer;var F=n(509);const B=({group:e})=>{const t=E(P),n=E((e=>e.entry.filters)),o=g(),l=(0,a.useRef)(),c=(0,a.useCallback)((e=>()=>{o(R(e))}),[o]);return(0,a.useEffect)((()=>{t&&t.entryPackageName===e.entryName&&l.current.scrollIntoView({behavior:"smooth"})}),[t,e]),n[r.Project]?a.createElement("div",{className:f,ref:l},e.versions.map((e=>a.createElement("div",{key:e.rawEntryId,onClick:c(e),className:`${m} ${(null==t?void 0:t.rawEntryId)===e.rawEntryId?h:""}`},a.createElement(F.Text,{type:"h5"},e.entryPackageName))))):a.createElement("div",{className:f,ref:l},a.createElement(F.Text,{type:"h5",bold:!0},e.entryName),e.versions.map((e=>a.createElement("div",{key:e.rawEntryId,onClick:c(e),className:`${m} ${(null==t?void 0:t.rawEntryId)===e.rawEntryId?h:""}`},a.createElement(F.Text,{type:"p"},e.entryPackageVersion," ",e.entrySuffix&&`[${e.entrySuffix}]`)))))},z=()=>{const e=g(),[t,n]=(0,a.useState)(""),[o,l]=(0,a.useState)(""),c=E(N),s=E((e=>e.entry.filters)),i=(0,a.useCallback)((e=>t=>{e===r.Project?n(t.target.value):l(t.target.value),((e,t)=>{t===r.Project?localStorage.setItem(k,e):localStorage.setItem(S,e)})(t.target.value,e)}),[]);(0,a.useEffect)((()=>{n(x(r.Project)),l(x(r.Package))}),[]);const d=(0,a.useCallback)(((t,n)=>()=>{e(I({filter:t,state:n}))}),[e]),u=(0,a.useCallback)((t=>{"Projects"===t?(e(I({filter:r.Project,state:!0})),e(I({filter:r.Package,state:!1}))):(e(I({filter:r.Package,state:!0})),e(I({filter:r.Project,state:!1})))}),[e,s]);return c?a.createElement("div",{className:"yk7wrFMnnNyYLABMBhz_"},a.createElement("div",{className:"X00sOTmx1ir4Oc41DIvM"},a.createElement(F.Tabs,{items:[{header:"Projects"},{header:"Packages"}],value:s[r.Project]?"Projects":"Packages",onChange:u}),a.createElement(F.Input,{type:"search",placeholder:"Filter...",value:s[r.Project]?t:o,onChange:i(s[r.Project]?r.Project:r.Package)}),a.createElement(F.ScrollArea,null,(()=>{let e=c;t&&s[r.Project]?e=c.filter((e=>-1!==e.entryPackageName.indexOf(t))):o&&s[r.Package]&&(e=c.filter((e=>-1!==e.entryPackageName.indexOf(o))));const n=e.reduce(((e,t)=>{const n=e[t.entryPackageName]||[];return n.push(t),e[t.entryPackageName]=n,e}),{});let a=[];for(const[e,t]of Object.entries(n))a.push({entryName:e,versions:t});return s[r.SideBySide]&&(a=a.filter((e=>e.versions.length>1))),s[r.Doppelganger]&&(a=a.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)))),s[r.Project]&&(a=a.sort(((e,t)=>e.entryName>t.entryName?1:t.entryName>e.entryName?-1:0))),a})().map((e=>a.createElement(B,{group:e,key:e.entryName})))),s[r.Package]?a.createElement("div",{className:"K6dDN5KzjLkbPPFWUaly"},a.createElement(F.Text,{type:"h5",bold:!0},"Filters"),a.createElement(F.Checkbox,{label:"Must have side-by-side versions",isChecked:s[r.SideBySide],onChecked:d(r.SideBySide,!s[r.SideBySide])}),a.createElement(F.Checkbox,{label:"Must have doppelgangers",isChecked:s[r.Doppelganger],onChecked:d(r.Doppelganger,!s[r.Doppelganger])})):null)):v},H=window.appContext.serviceUrl;async function U(e){try{const t=await fetch(`${H}/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)}}const $={specChanges:new Map},W=(0,b.Z0)({name:"workspace",initialState:$,reducers:{loadSpecChanges:(e,t)=>{e.specChanges=t.payload}}}),{loadSpecChanges:V}=W.actions,X=W.reducer,K=(e,t)=>{var n,r;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 ${null===(r=e.get(t))||void 0===r?void 0:r.from}]`;case"remove":return"[Deleted by .pnpmfile.cjs]";default:return"No Change"}},Y=(e,t)=>{if(!e)return!1;for(const n of e.dependencies)if(t.has(n.name))return!0;return!1};var Z=n(560);const J=e=>a.createElement(Z.f4,{theme:Z.Zj.vsLight,code:e.code,language:e.language},(({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:o})=>a.createElement("pre",{style:t},n.map(((e,t)=>a.createElement("div",Object.assign({key:t},r({line:e})),e.map(((e,t)=>a.createElement("span",Object.assign({key:t},o({token:e})))))))))));var G="rXOH6AJQU2eYrNAXbp4V";const Q="PACKAGE_JSON",q="PACKAGE_SPEC",ee="PARSED_PACKAGE_JSON",te=()=>{const e=g(),[t,n]=(0,a.useState)(void 0),[o,l]=(0,a.useState)(void 0),[c,s]=(0,a.useState)(""),i=E(P),d=E((e=>e.workspace.specChanges)),[u,p]=(0,a.useState)(ee),f=(0,a.useCallback)((e=>{p(e)}),[]);(0,a.useEffect)((()=>{(async function(){const e=await async function(){try{const e=await fetch(`${H}/api/pnpmfile`);return await e.text()}catch(e){return console.error("Could not load cjs file: ",e),"Missing CJS"}}();s(e)})().catch((e=>{console.error(`Failed to load project's pnpm file: ${e}`)}))}),[]),(0,a.useEffect)((()=>{i&&(i.entryPackageName?async function(t){const r=await U(t);n(r);const o=await async function(e){try{const t=await fetch(`${H}/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(l(o),r&&o){const t=((e,t)=>{const n=new Map,r=new Map;for(const[t,r]of Object.entries(Object.assign(Object.assign(Object.assign({},e.dependencies),e.devDependencies),e.peerDependencies)))n.set(t,r);for(const[e,n]of Object.entries(Object.assign(Object.assign(Object.assign({},t.dependencies),t.devDependencies),t.peerDependencies)))r.set(e,n);const o=new Map;for(const e of n.keys())r.has(e)?r.get(e)!==n.get(e)&&o.set(e,{type:"diff",packageName:e,from:n.get(e),to:r.get(e)}):o.set(e,{type:"remove",packageName:e});for(const e of r.keys())n.has(e)||o.set(e,{type:"add",packageName:e});return o})(r,o);e(V(t))}}(i.packageJsonFolderPath).catch((e=>{console.error(`Failed to load project information: ${e}`)})):console.log("The selected entry has no entry name: ",i.entryPackageName))}),[e,i]);const m=e=>t=>{var n;const[r,o]=t;if(!d.has(r))return e?a.createElement(F.Text,{type:"p",key:r},r,":"):a.createElement(F.Text,{type:"p",key:r},o);switch(null===(n=d.get(r))||void 0===n?void 0:n.type){case"add":return e?a.createElement(F.Text,{type:"p",key:r},a.createElement("span",{className:"nTIc62ACgp5xMWIvZ4cn"},r)):a.createElement(F.Text,{type:"p",key:r},o," ",K(d,r));case"diff":return e?a.createElement(F.Text,{type:"p",key:r},a.createElement("span",{className:"I4A8ZZlpCL3Op0c53VjN"},r)):a.createElement(F.Text,{type:"p",key:r},o," ",K(d,r));case"remove":return e?a.createElement(F.Text,{type:"p",key:r},a.createElement("span",{className:"iavWjvHy9s5MhCZ_ncgb"},r)):a.createElement(F.Text,{type:"p",key:r},o," ",K(d,r));default:return e?a.createElement(F.Text,{type:"p",key:r},r,":"):a.createElement(F.Text,{type:"p",key:r},o)}};return a.createElement("div",{className:"kzgyQkswpx6xUEo4zOa8"},a.createElement(F.Tabs,{items:[{header:"package spec "+(Y(i,d)?"*":""),value:ee},{header:"package.json",value:Q},{header:".pnpmfile.cjs",value:q}],value:u,onChange:f}),a.createElement("div",{className:"e2KEBfZCHwEMeH4j6wS7"},a.createElement(F.ScrollArea,null,a.createElement("div",{className:"zjGuydlDBdLj1kQnKe4V"},(()=>{switch(u){case Q:return t?a.createElement(J,{code:JSON.stringify(t,null,2),language:"json"}):a.createElement(F.Text,{type:"h5",bold:!0},"Please select a Project or Package to view it's package.json");case q:return c?a.createElement(J,{code:c,language:"js"}):a.createElement(F.Text,{type:"h5",bold:!0},"Couldn't load the pnpmfile.cjs file - does it exist in the expected location? (/common/config/rush/.pnpmfile.cjs)");case ee:return o?a.createElement("div",{className:"Ko0YQxSlY0hCIDTfmNlr"},a.createElement("div",{className:G},a.createElement(F.Text,{type:"h5",bold:!0},"Package Name:"),a.createElement(F.Text,{type:"p"},(null==i?void 0:i.kind)===r.Project?o.name:null==i?void 0:i.displayText)),a.createElement("div",{className:G},a.createElement(F.Text,{type:"h5",bold:!0},"Version:"),a.createElement(F.Text,{type:"p"},(null==i?void 0:i.entryPackageVersion)||o.version)),a.createElement("div",{className:"hqNteMkwhYXuZqHE_8MJ"},a.createElement("div",null,a.createElement(F.Text,{type:"h5",bold:!0},"Dependencies"),o.dependencies&&Object.entries(o.dependencies).map(m(!0)),a.createElement(F.Text,{type:"h5",bold:!0},"Dev Dependencies"),o.devDependencies&&Object.entries(o.devDependencies).map(m(!0)),a.createElement(F.Text,{type:"h5",bold:!0},"Peer Dependencies"),o.peerDependencies&&Object.entries(o.peerDependencies).map(m(!0))),a.createElement("div",null,a.createElement(F.Text,{type:"h5",bold:!0}," "),o.dependencies&&Object.entries(o.dependencies).map(m(!1)),a.createElement(F.Text,{type:"h5",bold:!0}," "),o.devDependencies&&Object.entries(o.devDependencies).map(m(!1)),a.createElement(F.Text,{type:"h5",bold:!0}," "),o.peerDependencies&&Object.entries(o.peerDependencies).map(m(!1))))):a.createElement(F.Text,{type:"h5",bold:!0},"Please select a Project or Package to view the parsed package.json");default:return null}})()))))};var ne,re,oe="_R50_3JsFs2FC9kVffQL",ae="mRQWdzXzOM1NpFUpYnhP",le="rIv2KvSZ0CKMbctSHL04",ce="wzeVrHi3oyOhEe6qD3PX",se="lGp34XdOFjHfZNwiilgC";!function(e){e[e.Determinant=0]="Determinant",e[e.TransitiveReferrer=1]="TransitiveReferrer"}(ne||(ne={})),function(e){e.Regular="dependencies",e.Dev="devDependencies",e.Peer="peerDependencies"}(re||(re={}));const ie=()=>{var e,t;const n=E(P),r=E((e=>e.workspace.specChanges)),l=g(),[s,i]=(0,a.useState)(null),[d,u]=(0,a.useState)([]),[p,f]=(0,a.useState)(new Map);(0,a.useEffect)((()=>{(async function(e){const t=new Map;await Promise.all(e.map((async e=>{const n=await U(e.packageJsonFolderPath);return t.set(e.rawEntryId,n),n}))),f(t)})((null==n?void 0:n.referrers)||[]).catch((e=>{console.error(`Failed to load referrers package.json: ${e}`)})),n&&i(null)}),[n]);const m=(0,a.useCallback)((e=>()=>{if(s&&s.entryId===e.entryId)e.resolvedEntry?l(R(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),i(e),e.dependencyType!==o.Peer)return;const t=[n],r=new Set,a=new Set,l=new Set;for(l.add(n);t.length;){const n=t.pop();if(n)for(const o of n.referrers){let c=!1;for(const t of o.dependencies)if(t.name===e.name){r.add(o),c=!0;break}if(!c){o.transitivePeerDependencies.has(e.name)?a.add(o):console.error('Error analyzing influencers: A referrer appears to be missing its "transitivePeerDependencies" field in the YAML file: ',e,o,n);for(const e of n.referrers)l.has(e)||(t.push(e),l.add(e))}}}const c=[];for(const e of r.values())c.push({entry:e,type:ne.Determinant});for(const e of a.values())c.push({entry:e,type:ne.TransitiveReferrer});u(c)}}),[n,s]),h=(0,a.useCallback)((e=>()=>{l(R(e))}),[n]);return n?a.createElement(a.Fragment,null,a.createElement("div",{className:"KWDuEbG1GmwLxFmPPppw"},a.createElement("div",{className:c},a.createElement(F.Text,{type:"h4",bold:!0},"Direct Referrers"),a.createElement("div",{className:oe},a.createElement(F.ScrollArea,null,null===(e=n.referrers)||void 0===e?void 0:e.map((e=>{var t;return a.createElement("div",{className:ae,key:e.rawEntryId,onClick:h(e)},a.createElement(F.Text,{type:"h5",bold:!0},"Name: ",e.displayText),a.createElement("div",null,a.createElement(F.Text,{type:"p"},"Entry ID: ",e.rawEntryId),a.createElement(F.Text,{type:"p"},"Dependency version: ",null===(t=((e,t)=>{var n;const r=p.get(e);if(!r)return;const o=[re.Regular,re.Dev,re.Peer];for(const e of o){const o=null===(n=r[e])||void 0===n?void 0:n[t];if(o)return{type:e,version:o}}})(e.rawEntryId,n.entryPackageName))||void 0===t?void 0:t.version)))}))))),a.createElement("div",{className:c},a.createElement(F.Text,{type:"h4",bold:!0},"Direct Dependencies"),a.createElement("div",{className:oe},a.createElement(F.ScrollArea,null,null===(t=n.dependencies)||void 0===t?void 0:t.map((e=>a.createElement("div",{className:`${ae} ${(null==s?void 0:s.entryId)===e.entryId&&"GbZbP1wHbcReGrxpZ3Ra"}`,key:e.entryId||e.name,onClick:m(e)},a.createElement(F.Text,{type:"h5",bold:!0},"Name: ",e.name," ",e.dependencyType===o.Peer?(e.peerDependencyMeta.optional?"(Optional)":"(Non-optional)")+" Peer Dependency":""),a.createElement("div",null,a.createElement(F.Text,{type:"p"},"Version: ",e.version),a.createElement(F.Text,{type:"p"},"Entry ID: ",e.entryId))))))))),s?a.createElement("div",{className:"xSxHmjxIXTOSskLhma3A"},a.createElement(F.ScrollArea,null,a.createElement("div",{className:se},a.createElement(F.Text,{type:"h5",bold:!0},"Selected Dependency:"," "),a.createElement(F.Text,{type:"span"},s.name,": ",s.version)),a.createElement("div",{className:se},a.createElement(F.Text,{type:"h5",bold:!0},"package.json spec:"," "),a.createElement(F.Text,{type:"span"},s.dependencyType===o.Peer?`"${s.peerDependencyMeta.version}" ${s.peerDependencyMeta.optional?"Optional":"Required"} Peer`:s.version)),a.createElement("div",{className:se},a.createElement(F.Text,{type:"h5",bold:!0},".pnpmfile.cjs:"," "),a.createElement(F.Text,{type:"span"},r.has(s.name)?K(r,s.name):"No Effect")))):v,(()=>{if(!n)return v;if(!n.dependencies.filter((e=>e.dependencyType===o.Peer)).length)return a.createElement("div",{className:`${c} ${le}`},a.createElement(F.Text,{type:"h5"},"No peer dependencies."));if(!s||s.dependencyType!==o.Peer)return a.createElement("div",{className:`${c} ${le}`},a.createElement(F.Text,{type:"h5"},"Select a peer dependency to view its influencers"));const e=d.filter((e=>e.type===ne.Determinant)),t=d.filter((e=>e.type===ne.TransitiveReferrer));return a.createElement("div",{className:`${c} ${le}`},a.createElement(F.ScrollArea,null,a.createElement(F.Text,{type:"h5",bold:!0},"Determinants:"),e.length?e.map((({entry:e})=>a.createElement("a",{className:ce,key:e.rawEntryId,onClick:h(e)},e.displayText))):a.createElement(F.Text,{type:"p"},"(none)"),a.createElement(F.Text,{type:"h5",bold:!0,className:"aKaZTElUypfUGQWhNJON"},"Transitive Referencers:"),t.length?t.map((({entry:e})=>a.createElement("a",{className:ce,key:e.rawEntryId,onClick:h(e)},e.displayText))):a.createElement(F.Text,{type:"p"},"(none)")))})()):a.createElement("div",{className:`${c} ${le}`},a.createElement(F.Text,{type:"h5",bold:!0},"Select an entry to view its details"))};const de=()=>{const e=E((e=>e.entry.bookmarkedEntries)),t=g(),n=(0,a.useCallback)((e=>()=>{t(O(e))}),[t]),r=(0,a.useCallback)((e=>()=>{t(M(e))}),[t]);return a.createElement("div",{className:`${c} aM5oGgiHs9rRHcHdAqFh`},a.createElement(F.ScrollArea,null,a.createElement(F.Text,{type:"h5"},"Bookmarks"),a.createElement("hr",null),e.map((e=>a.createElement("div",{key:e.rawEntryId,className:"Ci1rEoM4eR29ZJcnvJJE"},a.createElement("div",{onClick:n(e),className:"RNRBHB_iXGOnzVd_Ry9b"},a.createElement(F.Text,{type:"p"},e.displayText)),a.createElement(F.Button,{onClick:r(e)},"Remove"))))))};var ue="dklLbMzvzbuzLd2XJh3W",pe="vJvmAdZ2VafvyXjc16Mz";const fe=()=>{const e=E(P),t=E((t=>!!e&&t.entry.bookmarkedEntries.includes(e))),n=E((e=>e.entry.selectedEntryStack)),r=E((e=>e.entry.selectedEntryForwardStack)),o=g(),l=(0,a.useCallback)((()=>{e&&o(D(e))}),[o,e]),c=(0,a.useCallback)((()=>{e&&o(M(e))}),[o,e]),s=(0,a.useCallback)((()=>{o(_())}),[o]),i=(0,a.useCallback)((()=>{o(j())}),[o]),d=()=>a.createElement("div",{className:"LkGUkEuAC1lrNLYWXZAB"},a.createElement(F.Button,{disabled:n.length<=1,onClick:s},"Back"),a.createElement(F.Button,{disabled:0===r.length,onClick:i},"Forward"),t?a.createElement(F.Button,{onClick:c,disabled:!e},"Remove Bookmark"):a.createElement(F.Button,{onClick:l,disabled:!e},"Add Bookmark"));return e?a.createElement("div",{className:ue},a.createElement(F.ScrollArea,null,a.createElement("div",{className:pe},a.createElement("div",{className:"Hd2WYHIwrFrldD0I8qDj"},a.createElement(F.Text,{type:"h5",bold:!0},"Selected entry:"),a.createElement("span",null,e.displayText)),d()),a.createElement("div",null,a.createElement(F.Text,{type:"p"},"Package Entry: ",e.rawEntryId),a.createElement(F.Text,{type:"p"},"Package JSON path: ",e.packageJsonFolderPath)))):a.createElement("div",{className:ue},a.createElement("div",{className:pe},a.createElement(F.Text,{type:"h5",bold:!0},"No Entry Selected"),d()))};var me="wR2C2OTixe7QR738j44h",he="Oo_rkIqOkO0j8slDAm5V";const ve=()=>{const e=window.appContext.appVersion;return a.createElement("div",{className:"mqcpXwTQfD4A2eS4QRMa"},a.createElement("div",{className:"gxAXHLK7j_oYpFDmIJLR"},a.createElement("a",{href:"https://lfx.rushstack.io/",target:"_blank",rel:"noreferrer"},a.createElement("img",{className:me,src:n(201)}))),a.createElement("div",null,a.createElement("a",{href:"https://lfx.rushstack.io/",target:"_blank",rel:"noreferrer"},a.createElement("div",{className:"rHArsuIMBTbIFs5o2cuw"},a.createElement("img",{className:me,src:n(158)})),a.createElement("div",{className:"P6XzPBuW8Osze59RSui1"},a.createElement("img",{className:me,src:n(405)})),a.createElement("div",{className:he},e)),a.createElement("a",{href:"https://lfx.rushstack.io/",target:"_blank",rel:"noreferrer"},a.createElement("div",{className:he},"lfx.rushstack.io"))))};const ye=()=>{const[e,t]=(0,a.useState)(!0),[n,r]=(0,a.useState)(!1),[o,l]=(0,a.useState)(!1);async function s(){await async function(){try{return await fetch(`${H}/api/health`),!0}catch(e){return!1}}()?t(!0):t(!1),r(!1)}(0,a.useEffect)((()=>{window.setInterval(s,2e3)}),[]);const i=(0,a.useCallback)((()=>{r(!0),l(!0),s().catch((e=>{console.error(`Unexpected exception: ${e}`)}))}),[]);return e?null:a.createElement("div",{className:"uVMB4BjTN3pGKpcO9hFB"},a.createElement("div",{className:`gyz87hLRy_DyMUyraMaM ${c}`},a.createElement(F.Text,{type:"h5",bold:!0},"The Lockfile Explorer server has disconnected!"),o?a.createElement(F.Text,{type:"p"},'We were still not able to connect to the server. Are you sure the "lockfile-explorer" shell command is running?'):a.createElement(F.Text,{type:"p"},'Please restart the "lockfile-explorer" shell command to continue using this application.'),a.createElement("div",{className:"UkJzWedRWYeVMPCVDmCS"},a.createElement(F.Button,{disabled:n,onClick:i},"Check Again"),n?a.createElement(F.Text,{type:"p"},"Checking..."):null)))},ge=(0,b.U1)({reducer:{entry:L,workspace:X},middleware:e=>e({serializableCheck:!1})}),Ee=document.getElementById("root");l.render(a.createElement(y.Kq,{store:ge},a.createElement((()=>{const e=g();return(0,a.useEffect)((()=>{(async function(){const t=await async function(){console.log("Loading graph");const e=await fetch(`${p}/api/graph`);return function(e){const t=new u(e.workspace),n=t.entries;function r(e){const t=n[e];if(void 0===t)throw new Error("Invalid jsonId");return t}const o=e.entries;for(const e of o){const t={kind:e.kind,entryId:e.entryId,rawEntryId:e.rawEntryId,packageJsonFolderPath:e.packageJsonFolderPath,entryPackageName:e.entryPackageName,displayText:e.displayText,entryPackageVersion:e.entryPackageVersion,entrySuffix:e.entrySuffix};n.push(new d(t))}for(let e=0;e<o.length;++e){const n=o[e],a=t.entries[e];for(const e of n.dependencies){const t=new i({name:e.name,version:e.version,dependencyType:e.dependencyType,containingEntry:a,entryId:e.entryId,peerDependencyMeta:{name:e.peerDependencyMeta.name,version:e.peerDependencyMeta.version,optional:e.peerDependencyMeta.optional}});e.resolvedEntryJsonId&&(t.resolvedEntry=r(e.resolvedEntryJsonId)),a.dependencies.push(t)}for(const e of n.transitivePeerDependencies)a.transitivePeerDependencies.add(e);for(const e of n.referrerJsonIds)a.referrers.push(r(e))}return t}(await e.json()).entries}();e(A(t))})().catch((e=>{console.log(`Failed to read lockfile: ${e}`)}))}),[e]),a.createElement(a.Fragment,null,a.createElement(ye,null),a.createElement("div",{className:"uXEYthi0e8fjYu_FisVm"},a.createElement("div",{className:"ms-Grid",dir:"ltr"},a.createElement("div",{className:"ms-Grid-row"},a.createElement("div",{className:`ms-Grid-col ms-sm3 ${s}`},a.createElement(z,null)),a.createElement("div",{className:`ms-Grid-col ms-sm7 ${s}`},a.createElement(fe,null),a.createElement(te,null),a.createElement(ie,null)),a.createElement("div",{className:`ms-Grid-col ms-sm2 ${s}`},a.createElement(ve,null),a.createElement(de,null))))))}),null)),Ee)}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e].call(a.exports,a,a.exports,r),a.exports}r.m=t,e=[],r.O=function(t,n,o,a){if(!n){var l=1/0;for(d=0;d<e.length;d++){n=e[d][0],o=e[d][1],a=e[d][2];for(var c=!0,s=0;s<n.length;s++)(!1&a||l>=a)&&Object.keys(r.O).every((function(e){return r.O[e](n[s])}))?n.splice(s--,1):(c=!1,a<l&&(l=a));if(c){e.splice(d--,1);var i=o();void 0!==i&&(t=i)}}return t}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[n,o,a]},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e}(),function(){var e={524:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var o,a,l=n[0],c=n[1],s=n[2],i=0;if(l.some((function(t){return 0!==e[t]}))){for(o in c)r.o(c,o)&&(r.m[o]=c[o]);if(s)var d=s(r)}for(t&&t(n);i<l.length;i++)a=l[i],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.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 o=r.O(void 0,[531],(function(){return r(758)}));o=r.O(o)}();
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="964.4bbaf68a6f1467df6770.js"></script><script defer="defer" src="app.acf2b912c3f02793012c.js"></script><link href="app.e74e7004c99e392a3c70.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
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="531.0e5a24ca1399529aa975.js"></script><script defer="defer" src="app.22259b754540a899e03d.js"></script><link href="app.e74e7004c99e392a3c70.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerCommandLineParser.d.ts","sourceRoot":"","sources":["../../../src/cli/explorer/ExplorerCommandLineParser.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2B,KAAK,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAEL,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAUpC,qBAAa,yBAA0B,SAAQ,iBAAiB;IAC9D,SAAgB,cAAc,EAAE,SAAS,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA0B;IAC5D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2B;IAE3D,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsC;;IA0BzE,IAAW,OAAO,IAAI,OAAO,CAE5B;cAEwB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CA2LzD"}
1
+ {"version":3,"file":"ExplorerCommandLineParser.d.ts","sourceRoot":"","sources":["../../../src/cli/explorer/ExplorerCommandLineParser.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2B,KAAK,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAEL,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAkBpC,qBAAa,yBAA0B,SAAQ,iBAAiB;IAC9D,SAAgB,cAAc,EAAE,SAAS,CAAC;IAC1C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA0B;IAC5D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2B;IAE3D,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAsC;;IA0BzE,IAAW,OAAO,IAAI,OAAO,CAE5B;cAEwB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CA+LzD"}
@@ -1,6 +1,39 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
4
37
  var __importDefault = (this && this.__importDefault) || function (mod) {
5
38
  return (mod && mod.__esModule) ? mod : { "default": mod };
6
39
  };
@@ -12,11 +45,15 @@ const cors_1 = __importDefault(require("cors"));
12
45
  const process_1 = __importDefault(require("process"));
13
46
  const open_1 = __importDefault(require("open"));
14
47
  const update_notifier_1 = __importDefault(require("update-notifier"));
48
+ const path = __importStar(require("node:path"));
15
49
  const node_core_library_1 = require("@rushstack/node-core-library");
16
50
  const terminal_1 = require("@rushstack/terminal");
17
51
  const ts_command_line_1 = require("@rushstack/ts-command-line");
52
+ const lfx_shared_1 = require("../../../build/lfx-shared");
53
+ const lockfilePath = __importStar(require("../../graph/lockfilePath"));
18
54
  const init_1 = require("../../utils/init");
19
- const shrinkwrap_1 = require("../../utils/shrinkwrap");
55
+ const PnpmfileRunner_1 = require("../../graph/PnpmfileRunner");
56
+ const lfxGraphLoader = __importStar(require("../../graph/lfxGraphLoader"));
20
57
  const EXPLORER_TOOL_FILENAME = 'lockfile-explorer';
21
58
  class ExplorerCommandLineParser extends ts_command_line_1.CommandLineParser {
22
59
  constructor() {
@@ -67,6 +104,7 @@ class ExplorerCommandLineParser extends ts_command_line_1.CommandLineParser {
67
104
  debugMode: this.isDebug,
68
105
  subspaceName: this._subspaceParameter.value
69
106
  });
107
+ const lfxWorkspace = appState.lfxWorkspace;
70
108
  // Important: This must happen after init() reads the current working directory
71
109
  process_1.default.chdir(appState.lockfileExplorerProjectRoot);
72
110
  const distFolderPath = `${appState.lockfileExplorerProjectRoot}/dist`;
@@ -102,23 +140,6 @@ class ExplorerCommandLineParser extends ts_command_line_1.CommandLineParser {
102
140
  });
103
141
  app.use('/', express_1.default.static(distFolderPath));
104
142
  app.use('/favicon.ico', express_1.default.static(distFolderPath, { index: 'favicon.ico' }));
105
- app.get('/api/lockfile', async (req, res) => {
106
- const pnpmLockfileText = await node_core_library_1.FileSystem.readFileAsync(appState.pnpmLockfileLocation);
107
- const doc = js_yaml_1.default.load(pnpmLockfileText);
108
- const { packages, lockfileVersion } = doc;
109
- const shrinkwrapFileMajorVersion = (0, shrinkwrap_1.getShrinkwrapFileMajorVersion)(lockfileVersion);
110
- if (packages && shrinkwrapFileMajorVersion === 6) {
111
- const updatedPackages = {};
112
- for (const [dependencyPath, dependency] of Object.entries(packages)) {
113
- updatedPackages[(0, shrinkwrap_1.convertLockfileV6DepPathToV5DepPath)(dependencyPath)] = dependency;
114
- }
115
- doc.packages = updatedPackages;
116
- }
117
- res.send({
118
- doc,
119
- subspaceName: this._subspaceParameter.value
120
- });
121
- });
122
143
  app.get('/api/health', (req, res) => {
123
144
  awaitingFirstConnect = false;
124
145
  isClientConnected = true;
@@ -128,6 +149,13 @@ class ExplorerCommandLineParser extends ts_command_line_1.CommandLineParser {
128
149
  }
129
150
  res.status(200).send();
130
151
  });
152
+ app.get('/api/graph', async (req, res) => {
153
+ const pnpmLockfileText = await node_core_library_1.FileSystem.readFileAsync(appState.pnpmLockfileLocation);
154
+ const lockfile = js_yaml_1.default.load(pnpmLockfileText);
155
+ const graph = lfxGraphLoader.generateLockfileGraph(lockfile, lfxWorkspace);
156
+ const jsonGraph = lfx_shared_1.lfxGraphSerializer.serializeToJson(graph);
157
+ res.type('application/json').send(jsonGraph);
158
+ });
131
159
  app.post('/api/package-json', async (req, res) => {
132
160
  const { projectPath } = req.body;
133
161
  const fileLocation = `${appState.projectRoot}/${projectPath}/package.json`;
@@ -149,14 +177,16 @@ class ExplorerCommandLineParser extends ts_command_line_1.CommandLineParser {
149
177
  res.send(packageJsonText);
150
178
  });
151
179
  app.get('/api/pnpmfile', async (req, res) => {
180
+ var _a, _b;
181
+ const pnpmfilePath = lockfilePath.join(lfxWorkspace.workspaceRootFullPath, (_b = (_a = lfxWorkspace.rushConfig) === null || _a === void 0 ? void 0 : _a.rushPnpmfilePath) !== null && _b !== void 0 ? _b : lfxWorkspace.pnpmfilePath);
152
182
  let pnpmfile;
153
183
  try {
154
- pnpmfile = await node_core_library_1.FileSystem.readFileAsync(appState.pnpmfileLocation);
184
+ pnpmfile = await node_core_library_1.FileSystem.readFileAsync(pnpmfilePath);
155
185
  }
156
186
  catch (e) {
157
187
  if (node_core_library_1.FileSystem.isNotExistError(e)) {
158
188
  return res.status(404).send({
159
- message: `Could not load pnpmfile file in this repo.`,
189
+ message: `Could not load .pnpmfile.cjs file in this repo: "${pnpmfilePath}"`,
160
190
  error: `No .pnpmifile.cjs found.`
161
191
  });
162
192
  }
@@ -183,8 +213,17 @@ class ExplorerCommandLineParser extends ts_command_line_1.CommandLineParser {
183
213
  throw e;
184
214
  }
185
215
  }
186
- const { hooks: { readPackage } } = require(appState.pnpmfileLocation);
187
- const parsedPackage = readPackage(packageJson, {});
216
+ let parsedPackage = packageJson;
217
+ const pnpmfilePath = path.join(lfxWorkspace.workspaceRootFullPath, lfxWorkspace.pnpmfilePath);
218
+ if (await node_core_library_1.FileSystem.existsAsync(pnpmfilePath)) {
219
+ const pnpmFileRunner = new PnpmfileRunner_1.PnpmfileRunner(pnpmfilePath);
220
+ try {
221
+ parsedPackage = await pnpmFileRunner.transformPackageAsync(packageJson, fileLocation);
222
+ }
223
+ finally {
224
+ await pnpmFileRunner.disposeAsync();
225
+ }
226
+ }
188
227
  res.send(parsedPackage);
189
228
  });
190
229
  app.listen(PORT, async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"ExplorerCommandLineParser.js","sourceRoot":"","sources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G,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC7E,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA9ND,8DA8NC","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 open from 'open';\nimport updateNotifier from 'update-notifier';\n\nimport { FileSystem, type IPackageJson, JsonFile, PackageJsonLookup } from '@rushstack/node-core-library';\nimport { ConsoleTerminalProvider, type ITerminal, Terminal, Colorize } from '@rushstack/terminal';\nimport {\n type CommandLineFlagParameter,\n CommandLineParser,\n type IRequiredCommandLineStringParameter\n} from '@rushstack/ts-command-line';\nimport type { IAppContext } from '@rushstack/lockfile-explorer-web/lib/AppContext';\nimport type { Lockfile } from '@pnpm/lockfile-types';\n\nimport type { IAppState } from '../../state';\nimport { init } from '../../utils/init';\nimport { convertLockfileV6DepPathToV5DepPath, getShrinkwrapFileMajorVersion } from '../../utils/shrinkwrap';\n\nconst EXPLORER_TOOL_FILENAME: 'lockfile-explorer' = 'lockfile-explorer';\n\nexport class ExplorerCommandLineParser extends CommandLineParser {\n public readonly globalTerminal: ITerminal;\n private readonly _terminalProvider: ConsoleTerminalProvider;\n private readonly _debugParameter: CommandLineFlagParameter;\n\n private readonly _subspaceParameter: IRequiredCommandLineStringParameter;\n\n public constructor() {\n super({\n toolFilename: EXPLORER_TOOL_FILENAME,\n toolDescription:\n 'Lockfile Explorer is a desktop app for investigating and solving version conflicts in a PNPM workspace.'\n });\n\n this._debugParameter = this.defineFlagParameter({\n parameterLongName: '--debug',\n parameterShortName: '-d',\n description: 'Show the full call stack if an error occurs while executing the tool'\n });\n\n this._subspaceParameter = this.defineStringParameter({\n parameterLongName: '--subspace',\n argumentName: 'SUBSPACE_NAME',\n description: 'Specifies an individual Rush subspace to check.',\n defaultValue: 'default'\n });\n\n this._terminalProvider = new ConsoleTerminalProvider();\n this.globalTerminal = new Terminal(this._terminalProvider);\n }\n\n public get isDebug(): boolean {\n return this._debugParameter.value;\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;\n const lockfileExplorerPackageJson: IPackageJson = JsonFile.load(\n `${lockfileExplorerProjectRoot}/package.json`\n );\n const appVersion: string = lockfileExplorerPackageJson.version;\n\n this.globalTerminal.writeLine(\n Colorize.bold(`\\nRush Lockfile Explorer ${appVersion}`) +\n Colorize.cyan(' - https://lfx.rushstack.io/\\n')\n );\n\n updateNotifier({\n pkg: lockfileExplorerPackageJson,\n // Normally update-notifier waits a day or so before it starts displaying upgrade notices.\n // In debug mode, show the notice right away.\n updateCheckInterval: this.isDebug ? 0 : undefined\n }).notify({\n // Make sure it says \"-g\" in the \"npm install\" example command line\n isGlobal: true,\n // Show the notice immediately, rather than waiting for process.onExit()\n defer: false\n });\n\n const PORT: number = 8091;\n // Must not have a trailing slash\n const SERVICE_URL: string = `http://localhost:${PORT}`;\n\n const appState: IAppState = init({\n lockfileExplorerProjectRoot,\n appVersion,\n debugMode: this.isDebug,\n subspaceName: this._subspaceParameter.value\n });\n\n // Important: This must happen after init() reads the current working directory\n process.chdir(appState.lockfileExplorerProjectRoot);\n\n const distFolderPath: string = `${appState.lockfileExplorerProjectRoot}/dist`;\n const app: express.Application = express();\n app.use(express.json());\n app.use(cors());\n\n // Variable used to check if the front-end client is still connected\n let awaitingFirstConnect: boolean = true;\n let isClientConnected: boolean = false;\n let disconnected: boolean = false;\n setInterval(() => {\n if (!isClientConnected && !awaitingFirstConnect && !disconnected) {\n console.log(Colorize.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.\n app.get('/initappcontext.js', (req: express.Request, res: express.Response) => {\n const appContext: IAppContext = {\n serviceUrl: SERVICE_URL,\n appVersion: appState.appVersion,\n debugMode: this.isDebug\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\n app.use('/', express.static(distFolderPath));\n\n app.use('/favicon.ico', express.static(distFolderPath, { index: 'favicon.ico' }));\n\n app.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) as Lockfile;\n const { packages, lockfileVersion } = doc;\n\n const shrinkwrapFileMajorVersion: number = getShrinkwrapFileMajorVersion(lockfileVersion);\n\n if (packages && shrinkwrapFileMajorVersion === 6) {\n const updatedPackages: Lockfile['packages'] = {};\n for (const [dependencyPath, dependency] of Object.entries(packages)) {\n updatedPackages[convertLockfileV6DepPathToV5DepPath(dependencyPath)] = dependency;\n }\n doc.packages = updatedPackages;\n }\n\n res.send({\n doc,\n subspaceName: this._subspaceParameter.value\n });\n });\n\n app.get('/api/health', (req: express.Request, res: express.Response) => {\n awaitingFirstConnect = false;\n isClientConnected = true;\n if (disconnected) {\n disconnected = false;\n console.log(Colorize.green('The client has reconnected!'));\n }\n res.status(200).send();\n });\n\n app.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\n app.get('/api/pnpmfile', async (req: express.Request, res: express.Response) => {\n let pnpmfile: string;\n try {\n pnpmfile = await FileSystem.readFileAsync(appState.pnpmfileLocation);\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(pnpmfile);\n });\n\n app.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\n app.listen(PORT, async () => {\n console.log(`App launched on ${SERVICE_URL}`);\n\n if (!appState.debugMode) {\n try {\n // Launch the web browser\n await open(SERVICE_URL);\n } catch (e) {\n this.globalTerminal.writeError('Error launching browser: ' + e.toString());\n }\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ExplorerCommandLineParser.js","sourceRoot":"","sources":["../../../src/cli/explorer/ExplorerCommandLineParser.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,sDAA8B;AAC9B,sDAA2B;AAC3B,gDAAwB;AACxB,sDAA8B;AAC9B,gDAAwB;AACxB,sEAA6C;AAC7C,gDAAkC;AAClC,oEAA0G;AAC1G,kDAAkG;AAClG,gEAIoC;AAEpC,0DAMmC;AACnC,uEAAyD;AAGzD,2CAAwC;AACxC,+DAA4D;AAC5D,2EAA6D;AAE7D,MAAM,sBAAsB,GAAwB,mBAAmB,CAAC;AAExE,MAAa,yBAA0B,SAAQ,m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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 open from 'open';\nimport updateNotifier from 'update-notifier';\nimport * as path from 'node:path';\nimport { FileSystem, type IPackageJson, JsonFile, PackageJsonLookup } from '@rushstack/node-core-library';\nimport { ConsoleTerminalProvider, type ITerminal, Terminal, Colorize } from '@rushstack/terminal';\nimport {\n type CommandLineFlagParameter,\n CommandLineParser,\n type IRequiredCommandLineStringParameter\n} from '@rushstack/ts-command-line';\n\nimport {\n type LfxGraph,\n lfxGraphSerializer,\n type IAppContext,\n type IJsonLfxGraph,\n type IJsonLfxWorkspace\n} from '../../../build/lfx-shared';\nimport * as lockfilePath from '../../graph/lockfilePath';\n\nimport type { IAppState } from '../../state';\nimport { init } from '../../utils/init';\nimport { PnpmfileRunner } from '../../graph/PnpmfileRunner';\nimport * as lfxGraphLoader from '../../graph/lfxGraphLoader';\n\nconst EXPLORER_TOOL_FILENAME: 'lockfile-explorer' = 'lockfile-explorer';\n\nexport class ExplorerCommandLineParser extends CommandLineParser {\n public readonly globalTerminal: ITerminal;\n private readonly _terminalProvider: ConsoleTerminalProvider;\n private readonly _debugParameter: CommandLineFlagParameter;\n\n private readonly _subspaceParameter: IRequiredCommandLineStringParameter;\n\n public constructor() {\n super({\n toolFilename: EXPLORER_TOOL_FILENAME,\n toolDescription:\n 'Lockfile Explorer is a desktop app for investigating and solving version conflicts in a PNPM workspace.'\n });\n\n this._debugParameter = this.defineFlagParameter({\n parameterLongName: '--debug',\n parameterShortName: '-d',\n description: 'Show the full call stack if an error occurs while executing the tool'\n });\n\n this._subspaceParameter = this.defineStringParameter({\n parameterLongName: '--subspace',\n argumentName: 'SUBSPACE_NAME',\n description: 'Specifies an individual Rush subspace to check.',\n defaultValue: 'default'\n });\n\n this._terminalProvider = new ConsoleTerminalProvider();\n this.globalTerminal = new Terminal(this._terminalProvider);\n }\n\n public get isDebug(): boolean {\n return this._debugParameter.value;\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;\n const lockfileExplorerPackageJson: IPackageJson = JsonFile.load(\n `${lockfileExplorerProjectRoot}/package.json`\n );\n const appVersion: string = lockfileExplorerPackageJson.version;\n\n this.globalTerminal.writeLine(\n Colorize.bold(`\\nRush Lockfile Explorer ${appVersion}`) +\n Colorize.cyan(' - https://lfx.rushstack.io/\\n')\n );\n\n updateNotifier({\n pkg: lockfileExplorerPackageJson,\n // Normally update-notifier waits a day or so before it starts displaying upgrade notices.\n // In debug mode, show the notice right away.\n updateCheckInterval: this.isDebug ? 0 : undefined\n }).notify({\n // Make sure it says \"-g\" in the \"npm install\" example command line\n isGlobal: true,\n // Show the notice immediately, rather than waiting for process.onExit()\n defer: false\n });\n\n const PORT: number = 8091;\n // Must not have a trailing slash\n const SERVICE_URL: string = `http://localhost:${PORT}`;\n\n const appState: IAppState = init({\n lockfileExplorerProjectRoot,\n appVersion,\n debugMode: this.isDebug,\n subspaceName: this._subspaceParameter.value\n });\n\n const lfxWorkspace: IJsonLfxWorkspace = appState.lfxWorkspace;\n\n // Important: This must happen after init() reads the current working directory\n process.chdir(appState.lockfileExplorerProjectRoot);\n\n const distFolderPath: string = `${appState.lockfileExplorerProjectRoot}/dist`;\n const app: express.Application = express();\n app.use(express.json());\n app.use(cors());\n\n // Variable used to check if the front-end client is still connected\n let awaitingFirstConnect: boolean = true;\n let isClientConnected: boolean = false;\n let disconnected: boolean = false;\n setInterval(() => {\n if (!isClientConnected && !awaitingFirstConnect && !disconnected) {\n console.log(Colorize.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.\n app.get('/initappcontext.js', (req: express.Request, res: express.Response) => {\n const appContext: IAppContext = {\n serviceUrl: SERVICE_URL,\n appVersion: appState.appVersion,\n debugMode: this.isDebug\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\n app.use('/', express.static(distFolderPath));\n\n app.use('/favicon.ico', express.static(distFolderPath, { index: 'favicon.ico' }));\n\n app.get('/api/health', (req: express.Request, res: express.Response) => {\n awaitingFirstConnect = false;\n isClientConnected = true;\n if (disconnected) {\n disconnected = false;\n console.log(Colorize.green('The client has reconnected!'));\n }\n res.status(200).send();\n });\n\n app.get('/api/graph', async (req: express.Request, res: express.Response) => {\n const pnpmLockfileText: string = await FileSystem.readFileAsync(appState.pnpmLockfileLocation);\n const lockfile: unknown = yaml.load(pnpmLockfileText) as unknown;\n\n const graph: LfxGraph = lfxGraphLoader.generateLockfileGraph(lockfile, lfxWorkspace);\n\n const jsonGraph: IJsonLfxGraph = lfxGraphSerializer.serializeToJson(graph);\n res.type('application/json').send(jsonGraph);\n });\n\n app.post(\n '/api/package-json',\n async (req: express.Request<{}, {}, { projectPath: string }, {}>, res: express.Response) => {\n const { projectPath } = req.body;\n const fileLocation: string = `${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\n app.get('/api/pnpmfile', async (req: express.Request, res: express.Response) => {\n const pnpmfilePath: string = lockfilePath.join(\n lfxWorkspace.workspaceRootFullPath,\n lfxWorkspace.rushConfig?.rushPnpmfilePath ?? lfxWorkspace.pnpmfilePath\n );\n\n let pnpmfile: string;\n try {\n pnpmfile = await FileSystem.readFileAsync(pnpmfilePath);\n } catch (e) {\n if (FileSystem.isNotExistError(e)) {\n return res.status(404).send({\n message: `Could not load .pnpmfile.cjs file in this repo: \"${pnpmfilePath}\"`,\n error: `No .pnpmifile.cjs found.`\n });\n } else {\n throw e;\n }\n }\n\n res.send(pnpmfile);\n });\n\n app.post(\n '/api/package-spec',\n async (req: express.Request<{}, {}, { projectPath: string }, {}>, res: express.Response) => {\n const { projectPath } = req.body;\n const fileLocation: string = `${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 let parsedPackage: IPackageJson = packageJson;\n\n const pnpmfilePath: string = path.join(lfxWorkspace.workspaceRootFullPath, lfxWorkspace.pnpmfilePath);\n if (await FileSystem.existsAsync(pnpmfilePath)) {\n const pnpmFileRunner: PnpmfileRunner = new PnpmfileRunner(pnpmfilePath);\n try {\n parsedPackage = await pnpmFileRunner.transformPackageAsync(packageJson, fileLocation);\n } finally {\n await pnpmFileRunner.disposeAsync();\n }\n }\n\n res.send(parsedPackage);\n }\n );\n\n app.listen(PORT, async () => {\n console.log(`App launched on ${SERVICE_URL}`);\n\n if (!appState.debugMode) {\n try {\n // Launch the web browser\n await open(SERVICE_URL);\n } catch (e) {\n this.globalTerminal.writeError('Error launching browser: ' + e.toString());\n }\n }\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckAction.d.ts","sourceRoot":"","sources":["../../../../src/cli/lint/actions/CheckAction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAS/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAQtE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,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AAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC5C,CAAC,CAAC,EAAE,CAAC;gBACH,IAAI,CAAC,SAAS,CAAC,SAAS,CACtB,mBAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CACrF,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,wCAAoB,EAAE,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,oBAAoB,CAAC,CAAC;IAC/E,CAAC;CACF;AA7MD,kCA6MC","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 { Colorize, type ITerminal } from '@rushstack/terminal';\nimport { CommandLineAction } from '@rushstack/ts-command-line';\nimport { RushConfiguration, type RushConfigurationProject, type Subspace } from '@rushstack/rush-sdk';\nimport path from 'path';\nimport yaml from 'js-yaml';\nimport semver from 'semver';\nimport { AlreadyReportedError, Async, FileSystem, JsonFile, JsonSchema } from '@rushstack/node-core-library';\n\nimport lockfileLintSchema from '../../../schemas/lockfile-lint.schema.json';\nimport { LOCKFILE_EXPLORER_FOLDERNAME, LOCKFILE_LINT_JSON_FILENAME } from '../../../constants/common';\nimport type { LintCommandLineParser } from '../LintCommandLineParser';\nimport {\n getShrinkwrapFileMajorVersion,\n parseDependencyPath,\n splicePackageWithVersion\n} from '../../../utils/shrinkwrap';\nimport type { Lockfile, LockfileV6 } from '@pnpm/lockfile-types';\n\nexport interface ILintRule {\n rule: 'restrict-versions';\n project: string;\n requiredVersions: Record<string, string>;\n}\n\nexport interface ILockfileLint {\n rules: ILintRule[];\n}\n\nexport interface ILintIssue {\n project: string;\n rule: string;\n message: string;\n}\n\nexport class CheckAction extends CommandLineAction {\n private readonly _terminal: ITerminal;\n\n private _rushConfiguration!: RushConfiguration;\n private _checkedProjects: Set<RushConfigurationProject>;\n private _docMap: Map<string, Lockfile | LockfileV6>;\n\n public constructor(parser: LintCommandLineParser) {\n super({\n actionName: 'check',\n summary: 'Check and report dependency issues in your workspace',\n documentation:\n 'This command applies the policies that are configured in ' +\n LOCKFILE_LINT_JSON_FILENAME +\n ', reporting any problems found in your PNPM workspace.'\n });\n\n this._terminal = parser.globalTerminal;\n this._checkedProjects = new Set();\n this._docMap = new Map();\n }\n\n private async _checkVersionCompatibilityAsync(\n shrinkwrapFileMajorVersion: number,\n packages: Lockfile['packages'],\n dependencyPath: string,\n requiredVersions: Record<string, string>,\n checkedDependencyPaths: Set<string>\n ): Promise<void> {\n if (packages && packages[dependencyPath] && !checkedDependencyPaths.has(dependencyPath)) {\n checkedDependencyPaths.add(dependencyPath);\n const { name, version } = parseDependencyPath(shrinkwrapFileMajorVersion, dependencyPath);\n if (name in requiredVersions && !semver.satisfies(version, requiredVersions[name])) {\n throw new Error(\n `The version of \"${name}\" should match \"${requiredVersions[name]}\";` +\n ` actual version is \"${version}\"`\n );\n }\n\n await Promise.all(\n Object.entries(packages[dependencyPath].dependencies ?? {}).map(\n async ([dependencyPackageName, dependencyPackageVersion]) => {\n await this._checkVersionCompatibilityAsync(\n shrinkwrapFileMajorVersion,\n packages,\n splicePackageWithVersion(\n shrinkwrapFileMajorVersion,\n dependencyPackageName,\n dependencyPackageVersion\n ),\n requiredVersions,\n checkedDependencyPaths\n );\n }\n )\n );\n }\n }\n\n private async _searchAndValidateDependenciesAsync(\n project: RushConfigurationProject,\n requiredVersions: Record<string, string>\n ): Promise<void> {\n this._terminal.writeLine(`Checking project \"${project.packageName}\"`);\n\n const projectFolder: string = project.projectFolder;\n const subspace: Subspace = project.subspace;\n const shrinkwrapFilename: string = subspace.getCommittedShrinkwrapFilePath();\n let doc: Lockfile | LockfileV6;\n if (this._docMap.has(shrinkwrapFilename)) {\n doc = this._docMap.get(shrinkwrapFilename)!;\n } else {\n const pnpmLockfileText: string = await FileSystem.readFileAsync(shrinkwrapFilename);\n doc = yaml.load(pnpmLockfileText) as Lockfile | LockfileV6;\n this._docMap.set(shrinkwrapFilename, doc);\n }\n const { importers, lockfileVersion, packages } = doc;\n const shrinkwrapFileMajorVersion: number = getShrinkwrapFileMajorVersion(lockfileVersion);\n const checkedDependencyPaths: Set<string> = new Set<string>();\n\n await Promise.all(\n Object.entries(importers).map(async ([relativePath, { dependencies }]) => {\n if (path.resolve(projectFolder, relativePath) === projectFolder) {\n const dependenciesEntries = Object.entries(dependencies ?? {});\n for (const [dependencyName, dependencyValue] of dependenciesEntries) {\n const fullDependencyPath = splicePackageWithVersion(\n shrinkwrapFileMajorVersion,\n dependencyName,\n typeof dependencyValue === 'string'\n ? dependencyValue\n : (\n dependencyValue as {\n version: string;\n specifier: string;\n }\n ).version\n );\n if (fullDependencyPath.includes('link:')) {\n const dependencyProject: RushConfigurationProject | undefined =\n this._rushConfiguration.getProjectByName(dependencyName);\n if (dependencyProject && !this._checkedProjects?.has(dependencyProject)) {\n this._checkedProjects!.add(project);\n await this._searchAndValidateDependenciesAsync(dependencyProject, requiredVersions);\n }\n } else {\n await this._checkVersionCompatibilityAsync(\n shrinkwrapFileMajorVersion,\n packages,\n fullDependencyPath,\n requiredVersions,\n checkedDependencyPaths\n );\n }\n }\n }\n })\n );\n }\n\n private async _performVersionRestrictionCheckAsync(\n requiredVersions: Record<string, string>,\n projectName: string\n ): Promise<string | undefined> {\n try {\n const project: RushConfigurationProject | undefined =\n this._rushConfiguration?.getProjectByName(projectName);\n if (!project) {\n throw new Error(\n `Specified project \"${projectName}\" does not exist in ${LOCKFILE_LINT_JSON_FILENAME}`\n );\n }\n this._checkedProjects.add(project);\n await this._searchAndValidateDependenciesAsync(project, requiredVersions);\n return undefined;\n } catch (e) {\n return e.message;\n }\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const rushConfiguration: RushConfiguration | undefined = RushConfiguration.tryLoadFromDefaultLocation();\n if (!rushConfiguration) {\n throw new Error(\n 'The \"lockfile-explorer check\" must be executed in a folder that is under a Rush workspace folder'\n );\n }\n this._rushConfiguration = rushConfiguration!;\n\n const lintingFile: string = path.resolve(\n this._rushConfiguration.commonFolder,\n 'config',\n LOCKFILE_EXPLORER_FOLDERNAME,\n LOCKFILE_LINT_JSON_FILENAME\n );\n const { rules }: ILockfileLint = await JsonFile.loadAndValidateAsync(\n lintingFile,\n JsonSchema.fromLoadedObject(lockfileLintSchema)\n );\n const issues: ILintIssue[] = [];\n await Async.forEachAsync(\n rules,\n async ({ requiredVersions, project, rule }) => {\n switch (rule) {\n case 'restrict-versions': {\n const message: string | undefined = await this._performVersionRestrictionCheckAsync(\n requiredVersions,\n project\n );\n if (message) {\n issues.push({ project, rule, message });\n }\n break;\n }\n\n default: {\n throw new Error('Unsupported rule name: ' + rule);\n }\n }\n },\n { concurrency: 50 }\n );\n if (issues.length > 0) {\n this._terminal.writeLine();\n\n // Deterministic order\n for (const issue of issues.sort((a, b): number => {\n let diff: number = a.project.localeCompare(b.project);\n if (diff !== 0) {\n return diff;\n }\n diff = a.rule.localeCompare(b.rule);\n if (diff !== 0) {\n return diff;\n }\n return a.message.localeCompare(b.message);\n })) {\n this._terminal.writeLine(\n Colorize.red('PROBLEM: ') + Colorize.cyan(`[${issue.rule}] `) + issue.message + '\\n'\n );\n }\n\n throw new AlreadyReportedError();\n }\n this._terminal.writeLine(Colorize.green('SUCCESS: ') + 'All checks passed.');\n }\n}\n"]}
1
+ {"version":3,"file":"CheckAction.js","sourceRoot":"","sources":["../../../../src/cli/lint/actions/CheckAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,k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,WAAW,CAAC,GAAG,mBAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CACrF,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,wCAAoB,EAAE,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,mBAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,oBAAoB,CAAC,CAAC;IAC/E,CAAC;CACF;AA7MD,kCA6MC","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 { Colorize, type ITerminal } from '@rushstack/terminal';\nimport { CommandLineAction } from '@rushstack/ts-command-line';\nimport { RushConfiguration, type RushConfigurationProject, type Subspace } from '@rushstack/rush-sdk';\nimport path from 'path';\nimport yaml from 'js-yaml';\nimport semver from 'semver';\nimport type * as lockfileTypes from '@pnpm/lockfile.types';\nimport type * as pnpmTypes from '@pnpm/types';\nimport { AlreadyReportedError, Async, FileSystem, JsonFile, JsonSchema } from '@rushstack/node-core-library';\n\nimport lockfileLintSchema from '../../../schemas/lockfile-lint.schema.json';\nimport { LOCKFILE_EXPLORER_FOLDERNAME, LOCKFILE_LINT_JSON_FILENAME } from '../../../constants/common';\nimport type { LintCommandLineParser } from '../LintCommandLineParser';\nimport {\n getShrinkwrapFileMajorVersion,\n parseDependencyPath,\n splicePackageWithVersion\n} from '../../../utils/shrinkwrap';\n\nexport interface ILintRule {\n rule: 'restrict-versions';\n project: string;\n requiredVersions: Record<string, string>;\n}\n\nexport interface ILockfileLint {\n rules: ILintRule[];\n}\n\nexport interface ILintIssue {\n project: string;\n rule: string;\n message: string;\n}\n\nexport class CheckAction extends CommandLineAction {\n private readonly _terminal: ITerminal;\n\n private _rushConfiguration!: RushConfiguration;\n private _checkedProjects: Set<RushConfigurationProject>;\n private _docMap: Map<string, lockfileTypes.LockfileObject>;\n\n public constructor(parser: LintCommandLineParser) {\n super({\n actionName: 'check',\n summary: 'Check and report dependency issues in your workspace',\n documentation:\n 'This command applies the policies that are configured in ' +\n LOCKFILE_LINT_JSON_FILENAME +\n ', reporting any problems found in your PNPM workspace.'\n });\n\n this._terminal = parser.globalTerminal;\n this._checkedProjects = new Set();\n this._docMap = new Map();\n }\n\n private async _checkVersionCompatibilityAsync(\n shrinkwrapFileMajorVersion: number,\n packages: lockfileTypes.PackageSnapshots | undefined,\n dependencyPath: pnpmTypes.DepPath,\n requiredVersions: Record<string, string>,\n checkedDependencyPaths: Set<string>\n ): Promise<void> {\n if (packages && packages[dependencyPath] && !checkedDependencyPaths.has(dependencyPath)) {\n checkedDependencyPaths.add(dependencyPath);\n const { name, version } = parseDependencyPath(shrinkwrapFileMajorVersion, dependencyPath);\n if (name in requiredVersions && !semver.satisfies(version, requiredVersions[name])) {\n throw new Error(\n `The version of \"${name}\" should match \"${requiredVersions[name]}\";` +\n ` actual version is \"${version}\"`\n );\n }\n\n await Promise.all(\n Object.entries(packages[dependencyPath].dependencies ?? {}).map(\n async ([dependencyPackageName, dependencyPackageVersion]) => {\n await this._checkVersionCompatibilityAsync(\n shrinkwrapFileMajorVersion,\n packages,\n splicePackageWithVersion(\n shrinkwrapFileMajorVersion,\n dependencyPackageName,\n dependencyPackageVersion\n ) as pnpmTypes.DepPath,\n requiredVersions,\n checkedDependencyPaths\n );\n }\n )\n );\n }\n }\n\n private async _searchAndValidateDependenciesAsync(\n project: RushConfigurationProject,\n requiredVersions: Record<string, string>\n ): Promise<void> {\n this._terminal.writeLine(`Checking project \"${project.packageName}\"`);\n\n const projectFolder: string = project.projectFolder;\n const subspace: Subspace = project.subspace;\n const shrinkwrapFilename: string = subspace.getCommittedShrinkwrapFilePath();\n let doc: lockfileTypes.LockfileObject;\n if (this._docMap.has(shrinkwrapFilename)) {\n doc = this._docMap.get(shrinkwrapFilename)!;\n } else {\n const pnpmLockfileText: string = await FileSystem.readFileAsync(shrinkwrapFilename);\n doc = yaml.load(pnpmLockfileText) as lockfileTypes.LockfileObject;\n this._docMap.set(shrinkwrapFilename, doc);\n }\n const { importers, lockfileVersion, packages } = doc;\n const shrinkwrapFileMajorVersion: number = getShrinkwrapFileMajorVersion(lockfileVersion);\n const checkedDependencyPaths: Set<string> = new Set<string>();\n\n await Promise.all(\n Object.entries(importers).map(async ([relativePath, { dependencies }]) => {\n if (path.resolve(projectFolder, relativePath) === projectFolder) {\n const dependenciesEntries: [string, unknown][] = Object.entries(dependencies ?? {});\n for (const [dependencyName, dependencyValue] of dependenciesEntries) {\n const fullDependencyPath: pnpmTypes.DepPath = splicePackageWithVersion(\n shrinkwrapFileMajorVersion,\n dependencyName,\n typeof dependencyValue === 'string'\n ? dependencyValue\n : (\n dependencyValue as {\n version: string;\n specifier: string;\n }\n ).version\n ) as pnpmTypes.DepPath;\n if (fullDependencyPath.includes('link:')) {\n const dependencyProject: RushConfigurationProject | undefined =\n this._rushConfiguration.getProjectByName(dependencyName);\n if (dependencyProject && !this._checkedProjects?.has(dependencyProject)) {\n this._checkedProjects!.add(project);\n await this._searchAndValidateDependenciesAsync(dependencyProject, requiredVersions);\n }\n } else {\n await this._checkVersionCompatibilityAsync(\n shrinkwrapFileMajorVersion,\n packages,\n fullDependencyPath,\n requiredVersions,\n checkedDependencyPaths\n );\n }\n }\n }\n })\n );\n }\n\n private async _performVersionRestrictionCheckAsync(\n requiredVersions: Record<string, string>,\n projectName: string\n ): Promise<string | undefined> {\n try {\n const project: RushConfigurationProject | undefined =\n this._rushConfiguration?.getProjectByName(projectName);\n if (!project) {\n throw new Error(\n `Specified project \"${projectName}\" does not exist in ${LOCKFILE_LINT_JSON_FILENAME}`\n );\n }\n this._checkedProjects.add(project);\n await this._searchAndValidateDependenciesAsync(project, requiredVersions);\n return undefined;\n } catch (e) {\n return e.message;\n }\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const rushConfiguration: RushConfiguration | undefined = RushConfiguration.tryLoadFromDefaultLocation();\n if (!rushConfiguration) {\n throw new Error(\n 'The \"lockfile-explorer check\" must be executed in a folder that is under a Rush workspace folder'\n );\n }\n this._rushConfiguration = rushConfiguration!;\n\n const lintingFile: string = path.resolve(\n this._rushConfiguration.commonFolder,\n 'config',\n LOCKFILE_EXPLORER_FOLDERNAME,\n LOCKFILE_LINT_JSON_FILENAME\n );\n const { rules }: ILockfileLint = await JsonFile.loadAndValidateAsync(\n lintingFile,\n JsonSchema.fromLoadedObject(lockfileLintSchema)\n );\n const issues: ILintIssue[] = [];\n await Async.forEachAsync(\n rules,\n async ({ requiredVersions, project, rule }) => {\n switch (rule) {\n case 'restrict-versions': {\n const message: string | undefined = await this._performVersionRestrictionCheckAsync(\n requiredVersions,\n project\n );\n if (message) {\n issues.push({ project, rule, message });\n }\n break;\n }\n\n default: {\n throw new Error('Unsupported rule name: ' + rule);\n }\n }\n },\n { concurrency: 50 }\n );\n if (issues.length > 0) {\n this._terminal.writeLine();\n\n // Deterministic order\n for (const issue of issues.sort((a, b): number => {\n let diff: number = a.project.localeCompare(b.project);\n if (diff !== 0) {\n return diff;\n }\n diff = a.rule.localeCompare(b.rule);\n if (diff !== 0) {\n return diff;\n }\n return a.message.localeCompare(b.message);\n })) {\n this._terminal.writeLine(\n Colorize.red('PROBLEM: ') + Colorize.cyan(`[${issue.rule}] `) + issue.message + '\\n'\n );\n }\n\n throw new AlreadyReportedError();\n }\n this._terminal.writeLine(Colorize.green('SUCCESS: ') + 'All checks passed.');\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { IPackageJson } from '@rushstack/node-core-library';
2
+ export interface IReadPackageContext {
3
+ log: (message: string) => void;
4
+ }
5
+ export type IReadPackageHook = (packageJson: IPackageJson, context: IReadPackageContext) => IPackageJson | Promise<IPackageJson>;
6
+ export interface IPnpmHooks {
7
+ readPackage?: IReadPackageHook;
8
+ }
9
+ /**
10
+ * Type of the `.pnpmfile.cjs` module.
11
+ */
12
+ export interface IPnpmfileModule {
13
+ hooks?: IPnpmHooks;
14
+ }
15
+ //# sourceMappingURL=IPnpmfileModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPnpmfileModule.d.ts","sourceRoot":"","sources":["../../src/graph/IPnpmfileModule.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG,CAC7B,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,mBAAmB,KACzB,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1C,MAAM,WAAW,UAAU;IACzB,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IPnpmfileModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPnpmfileModule.js","sourceRoot":"","sources":["../../src/graph/IPnpmfileModule.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","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 type { IPackageJson } from '@rushstack/node-core-library';\n\nexport interface IReadPackageContext {\n log: (message: string) => void;\n}\n\nexport type IReadPackageHook = (\n packageJson: IPackageJson,\n context: IReadPackageContext\n) => IPackageJson | Promise<IPackageJson>;\n\nexport interface IPnpmHooks {\n readPackage?: IReadPackageHook;\n}\n\n/**\n * Type of the `.pnpmfile.cjs` module.\n */\nexport interface IPnpmfileModule {\n hooks?: IPnpmHooks;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import type { IPackageJson } from '@rushstack/node-core-library';
2
+ /**
3
+ * Evals `.pnpmfile.cjs` in an isolated thread, so `transformPackageAsync()` can be used to rewrite
4
+ * package.json files. Calling `disposeAsync()` will free the loaded modules.
5
+ */
6
+ export declare class PnpmfileRunner {
7
+ private _worker;
8
+ private _nextId;
9
+ private _promisesById;
10
+ private _disposed;
11
+ logger: ((message: string) => void) | undefined;
12
+ constructor(pnpmfilePath: string);
13
+ /**
14
+ * Invokes the readPackage() hook from .pnpmfile.cjs
15
+ */
16
+ transformPackageAsync(packageJson: IPackageJson, packageJsonFullPath: string): Promise<IPackageJson>;
17
+ disposeAsync(): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=PnpmfileRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PnpmfileRunner.d.ts","sourceRoot":"","sources":["../../src/graph/PnpmfileRunner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASjE;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,SAAS,CAAkB;IAE5B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAa;gBAEhD,YAAY,EAAE,MAAM;IAmDvC;;OAEG;IACI,qBAAqB,CAC1B,WAAW,EAAE,YAAY,EACzB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,YAAY,CAAC;IAYX,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAW3C"}