cloudcmd 17.0.0 → 17.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sw.js CHANGED
@@ -5,5 +5,5 @@ var serviceWorkerOption = {
5
5
  ]
6
6
  };
7
7
 
8
- !function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";const r=n(1),o=n(2),i=n(3),u="development"===r.env.NODE_ENV,c=i((t,e)=>e.waitUntil(t())),s=i((t,e)=>{const{request:n}=e,{url:r}=n,o=a(r);r.endsWith("/")||/\^\/fs/.test(o)||"GET"===n.method&&(t=>"basic"===t.type)(n)&&(o.startsWith("/api")||/^socket.io/.test(o)||e.respondWith(t(e)))}),a=t=>new URL(t).pathname,f="cloudcmd: Tue Dec 12 2023 16:11:24 GMT+0200 (Eastern European Standard Time)",l=(t,e)=>"/"!==t?e:(t=>new Request(t,{credentials:"same-origin"}))("/");self.addEventListener("install",c((async function(){console.info("cloudcmd: sw: install: "+f),await self.skipWaiting()}))),self.addEventListener("fetch",s((async function(t){const{request:e}=t,{url:n}=e,r=a(n),i=l(r,t.request),c=await caches.open(f),s=await c.match(e);if(!u&&s)return s;const[d,h]=await o(fetch,i,{credentials:"same-origin"});return d?new Response(d.message):(await async function(t,e){return(await caches.open(f)).put(t,e)}(e,h.clone()),h)}))),self.addEventListener("activate",c((async function(){console.info("cloudcmd: sw: activate: "+f),await self.clients.claim();const t=await caches.keys(),e=caches.delete.bind(caches);await Promise.all(t.map(e))})))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&h())}function h(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new p(t,e)),1!==a.length||f||c(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";t.exports=async(t,...e)=>{!function(t){if("function"!=typeof t)throw Error("fn should be a function!")}(t);try{return[null,await t(...e)]}catch(t){return[t]}}},function(t,e,n){"use strict";const r=(t,...e)=>{if(function(t){if("function"!=typeof t)throw Error("fn should be function!")}(t),e.length>=t.length)return t(...e);const n=(...n)=>r(t,...e,...n),o=t.length-e.length-1;return(t=>[function(e){return t(...arguments)},function(e,n){return t(...arguments)},function(e,n,r){return t(...arguments)},function(e,n,r,o){return t(...arguments)},function(e,n,r,o,i){return t(...arguments)}])(n)[o]||n};t.exports=r}]);
8
+ !function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";const r=n(1),o=n(2),i=n(3),u="development"===r.env.NODE_ENV,c=i((t,e)=>e.waitUntil(t())),s=i((t,e)=>{const{request:n}=e,{url:r}=n,o=a(r);r.endsWith("/")||/\^\/fs/.test(o)||"GET"===n.method&&(t=>"basic"===t.type)(n)&&(o.startsWith("/api")||/^socket.io/.test(o)||e.respondWith(t(e)))}),a=t=>new URL(t).pathname,f="cloudcmd: Thu Feb 01 2024 12:44:10 GMT+0200 (Eastern European Standard Time)",l=(t,e)=>"/"!==t?e:(t=>new Request(t,{credentials:"same-origin"}))("/");self.addEventListener("install",c((async function(){console.info("cloudcmd: sw: install: "+f),await self.skipWaiting()}))),self.addEventListener("fetch",s((async function(t){const{request:e}=t,{url:n}=e,r=a(n),i=l(r,t.request),c=await caches.open(f),s=await c.match(e);if(!u&&s)return s;const[d,h]=await o(fetch,i,{credentials:"same-origin"});return d?new Response(d.message):(await async function(t,e){return(await caches.open(f)).put(t,e)}(e,h.clone()),h)}))),self.addEventListener("activate",c((async function(){console.info("cloudcmd: sw: activate: "+f),await self.clients.claim();const t=await caches.keys(),e=caches.delete.bind(caches);await Promise.all(t.map(e))})))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&h())}function h(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new p(t,e)),1!==a.length||f||c(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";t.exports=async(t,...e)=>{!function(t){if("function"!=typeof t)throw Error("fn should be a function!")}(t);try{return[null,await t(...e)]}catch(t){return[t]}}},function(t,e,n){"use strict";const r=(t,...e)=>{if(function(t){if("function"!=typeof t)throw Error("fn should be function!")}(t),e.length>=t.length)return t(...e);const n=(...n)=>r(t,...e,...n),o=t.length-e.length-1;return(t=>[function(e){return t(...arguments)},function(e,n){return t(...arguments)},function(e,n,r){return t(...arguments)},function(e,n,r,o){return t(...arguments)},function(e,n,r,o,i){return t(...arguments)}])(n)[o]||n};t.exports=r}]);
9
9
  //# sourceMappingURL=sw.js.map
@@ -498,19 +498,19 @@ a:active {
498
498
  .name {
499
499
  width: 40%;
500
500
  }
501
-
501
+
502
502
  .size {
503
503
  width: 10%;
504
504
  }
505
-
505
+
506
506
  .date {
507
507
  width: 15%;
508
508
  }
509
-
509
+
510
510
  .owner {
511
511
  width: 12%;
512
512
  }
513
-
513
+
514
514
  .mode {
515
515
  width: 15%;
516
516
  }
@@ -520,7 +520,7 @@ a:active {
520
520
  .fm {
521
521
  height: 85%;
522
522
  }
523
-
523
+
524
524
  .files {
525
525
  height: 90%;
526
526
  }
@@ -530,7 +530,7 @@ a:active {
530
530
  .fm {
531
531
  height: 80%;
532
532
  }
533
-
533
+
534
534
  .files {
535
535
  height: 90%;
536
536
  }
@@ -576,7 +576,7 @@ a:active {
576
576
  .fm {
577
577
  height: 85%;
578
578
  }
579
-
579
+
580
580
  .files {
581
581
  height: 90%;
582
582
  }
@@ -592,31 +592,29 @@ a:active {
592
592
  .fm {
593
593
  height: 75%;
594
594
  }
595
-
595
+
596
596
  .files {
597
597
  height: 90%;
598
598
  }
599
599
  }
600
600
 
601
- /* stylelint-disable */
602
601
  /* iphone 6 landscape */
603
602
  @media only screen and (device-width >= 375px) and (device-width <= 667px) and (orientation: landscape),
604
- @media only screen and (max-height: 360px) and (max-width: 640px) {
603
+ only screen and (height <= 360px) and (width <= 640px) {
605
604
  .fm {
606
605
  height: 55%;
607
606
  }
608
-
607
+
609
608
  .files {
610
609
  height: 60%;
611
610
  }
612
611
  }
613
- /* stylelint-enable*/
614
612
 
615
613
  @media only screen and (width <= 600px) {
616
614
  .panel {
617
615
  font-size: 26px;
618
616
  }
619
-
617
+
620
618
  /* текущий файл под курсором */
621
619
  .current-file {
622
620
  background-color: var(--color-transparent);
@@ -626,18 +624,18 @@ a:active {
626
624
  .current-file a {
627
625
  color: white;
628
626
  }
629
-
627
+
630
628
  .file::before,
631
629
  .file-link::before {
632
630
  color: rgb(26 224 124 / 56%);
633
631
  content: '\e80d';
634
632
  }
635
-
633
+
636
634
  .current-file .file::before,
637
635
  .file-link::before {
638
636
  color: white;
639
637
  }
640
-
638
+
641
639
  /* меняем иконки на шрифтовые */
642
640
  .mini-icon {
643
641
  color: rgb(246 224 124 / 56%);
@@ -645,45 +643,45 @@ a:active {
645
643
  background-image: none;
646
644
  padding: 1%;
647
645
  }
648
-
646
+
649
647
  .size,
650
648
  .date,
651
649
  .owner,
652
650
  .mode {
653
651
  display: none;
654
652
  }
655
-
653
+
656
654
  .name {
657
655
  width: 90%;
658
656
  display: inline-block;
659
657
  }
660
-
658
+
661
659
  .directory::before,
662
660
  .directory-link::before {
663
661
  content: '\e807';
664
662
  }
665
-
663
+
666
664
  .file,
667
665
  .file-link {
668
666
  background-image: none;
669
667
  }
670
-
668
+
671
669
  .archive,
672
670
  .archive-link {
673
671
  background-image: none;
674
672
  }
675
-
673
+
676
674
  .archive::before,
677
675
  .archive-link {
678
676
  color: rgb(26 224 124 / 56%);
679
677
  content: '\e81d';
680
678
  }
681
-
679
+
682
680
  /* убираем заголовок */
683
681
  .fm-header {
684
682
  display: none;
685
683
  }
686
-
684
+
687
685
  /* выводим заголовки рядом с полями */
688
686
  .cmd-button {
689
687
  width: 20%;
@@ -721,24 +719,24 @@ a:active {
721
719
  padding: 0;
722
720
  border: none;
723
721
  }
724
-
722
+
725
723
  .keyspanel,
726
724
  .panel-right {
727
725
  display: none;
728
726
  }
729
-
727
+
730
728
  .files {
731
729
  overflow-y: visible;
732
730
  }
733
-
731
+
734
732
  .current-file {
735
733
  box-shadow: 0 0;
736
734
  }
737
-
735
+
738
736
  .path-icon {
739
737
  display: none;
740
738
  }
741
-
739
+
742
740
  .mini-icon {
743
741
  display: none;
744
742
  }
@@ -747,7 +745,7 @@ a:active {
747
745
  .files {
748
746
  overflow-y: overlay;
749
747
  }
750
-
748
+
751
749
  .fm-header {
752
750
  overflow-y: hidden;
753
751
  }
package/dist-dev/sw.js CHANGED
@@ -101,7 +101,7 @@ var serviceWorkerOption = {
101
101
  /***/ (function(module, exports, __webpack_require__) {
102
102
 
103
103
  "use strict";
104
- eval("\n\nconst process = __webpack_require__(/*! process */ \"./node_modules/process/browser.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"Tue Dec 12 2023 16:11:30 GMT+0200 (Eastern European Standard Time)\";\nconst NAME = `cloudcmd: ${date}`;\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\n return createRequest('/');\n};\nself.addEventListener('install', wait(onInstall));\nself.addEventListener('fetch', respondWith(onFetch));\nself.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await self.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n await Promise.all(keys.map(deleteCache));\n}\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await self.skipWaiting();\n}\nasync function onFetch(event) {\n const {\n request\n } = event;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n if (!isDev && response) return response;\n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin'\n });\n if (e) return new Response(e.message);\n await addToCache(request, resp.clone());\n return resp;\n}\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n\n//# sourceURL=file://cloudcmd/client/sw/sw.js");
104
+ eval("\n\nconst process = __webpack_require__(/*! process */ \"./node_modules/process/browser.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"Thu Feb 01 2024 12:44:17 GMT+0200 (Eastern European Standard Time)\";\nconst NAME = `cloudcmd: ${date}`;\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\n return createRequest('/');\n};\nself.addEventListener('install', wait(onInstall));\nself.addEventListener('fetch', respondWith(onFetch));\nself.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await self.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n await Promise.all(keys.map(deleteCache));\n}\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await self.skipWaiting();\n}\nasync function onFetch(event) {\n const {\n request\n } = event;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n if (!isDev && response) return response;\n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin'\n });\n if (e) return new Response(e.message);\n await addToCache(request, resp.clone());\n return resp;\n}\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n\n//# sourceURL=file://cloudcmd/client/sw/sw.js");
105
105
 
106
106
  /***/ }),
107
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcmd",
3
- "version": "17.0.0",
3
+ "version": "17.0.2",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "File manager for the web with console and editor",
@@ -88,7 +88,7 @@
88
88
  "@babel/core": "^7.22.9",
89
89
  "@babel/plugin-transform-optional-chaining": "^7.21.0",
90
90
  "@cloudcmd/dropbox": "^4.0.1",
91
- "@cloudcmd/fileop": "^7.0.0",
91
+ "@cloudcmd/fileop": "^8.0.0",
92
92
  "@cloudcmd/move-files": "^7.0.0",
93
93
  "@cloudcmd/read-files-sync": "^2.0.0",
94
94
  "@putout/cli-validate-args": "^1.0.1",
@@ -123,12 +123,12 @@
123
123
  "nomine": "^4.0.0",
124
124
  "object.omit": "^3.0.0",
125
125
  "once": "^1.4.0",
126
- "onezip": "^5.0.0",
127
- "open": "^9.1.0",
128
- "package-json": "^8.1.0",
126
+ "onezip": "^6.0.1",
127
+ "open": "^10.0.3",
128
+ "package-json": "^9.0.0",
129
129
  "ponse": "^7.0.0",
130
130
  "pullout": "^4.0.0",
131
- "putout": "^34.0.7",
131
+ "putout": "^35.0.0",
132
132
  "redzip": "^3.0.0",
133
133
  "rendy": "^4.1.3",
134
134
  "restafary": "^11.0.0",
@@ -160,7 +160,7 @@
160
160
  "auto-globals": "^3.0.0",
161
161
  "babel-loader": "^8.0.0",
162
162
  "babel-plugin-macros": "^3.0.0",
163
- "c8": "^8.0.0",
163
+ "c8": "^9.1.0",
164
164
  "cheerio": "^1.0.0-rc.5",
165
165
  "clean-css-loader": "^2.0.0",
166
166
  "codegen.macro": "^4.0.0",
@@ -200,7 +200,7 @@
200
200
  "smalltalk": "^4.0.0",
201
201
  "style-loader": "^2.0.0",
202
202
  "supermenu": "^4.0.1",
203
- "supertape": "^9.0.0",
203
+ "supertape": "^10.0.0",
204
204
  "tar-stream": "^3.0.0",
205
205
  "unionfs": "^4.0.0",
206
206
  "url-loader": "^4.0.0",
@@ -22,56 +22,56 @@ const DEFAULT_MENU_PATH = join(__dirname, '../static/user-menu.js');
22
22
  module.exports = currify(async ({menuName}, req, res, next) => {
23
23
  if (req.url.indexOf(URL))
24
24
  return next();
25
-
25
+
26
26
  const {method} = req;
27
-
27
+
28
28
  if (method === 'GET')
29
29
  return await onGET({
30
30
  req,
31
31
  res,
32
32
  menuName,
33
33
  });
34
-
34
+
35
35
  next();
36
36
  });
37
37
 
38
38
  async function onGET({req, res, menuName}) {
39
39
  const {dir} = req.query;
40
40
  const url = req.url.replace(URL, '');
41
-
41
+
42
42
  if (url === '/default')
43
43
  return sendDefaultMenu(res);
44
-
44
+
45
45
  const {findUp} = await import('find-up');
46
-
46
+
47
47
  const [errorFind, currentMenuPath] = await tryToCatch(findUp, [menuName], {
48
48
  cwd: dir,
49
49
  });
50
-
50
+
51
51
  if (errorFind && errorFind.code !== 'ENOENT')
52
52
  return res
53
53
  .status(404)
54
54
  .send(errorFind.message);
55
-
55
+
56
56
  const homeMenuPath = join(homedir(), menuName);
57
57
  const menuPath = currentMenuPath || homeMenuPath;
58
58
  const [e, source] = await tryToCatch(readFile, menuPath, 'utf8');
59
-
59
+
60
60
  if (e && e.code !== 'ENOENT')
61
61
  return res
62
62
  .status(404)
63
63
  .send(e.message);
64
-
64
+
65
65
  if (e)
66
66
  return sendDefaultMenu(res);
67
-
67
+
68
68
  const [parseError, result] = await transpile(source);
69
-
69
+
70
70
  if (parseError)
71
71
  return res
72
72
  .type('js')
73
73
  .send(getError(parseError, source));
74
-
74
+
75
75
  res
76
76
  .type('js')
77
77
  .send(result.code);