cloudcmd 19.1.21 → 19.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/ChangeLog +22 -0
  2. package/HELP.md +3 -1
  3. package/README.md +1 -1
  4. package/bin/{cloudcmd.mjs → cloudcmd.js} +5 -5
  5. package/common/callbackify.js +1 -3
  6. package/common/datetime.js +2 -4
  7. package/common/try-to-promise-all.js +2 -3
  8. package/dist/cloudcmd.common.js +2 -2
  9. package/dist/cloudcmd.common.js.map +1 -1
  10. package/dist/cloudcmd.js +1 -1
  11. package/dist/cloudcmd.js.map +1 -1
  12. package/dist/modules/cloud.js +1 -1
  13. package/dist/modules/cloud.js.map +1 -1
  14. package/dist/modules/command-line.js +1 -1
  15. package/dist/modules/command-line.js.map +1 -1
  16. package/dist/modules/config.js +1 -1
  17. package/dist/modules/config.js.map +1 -1
  18. package/dist/modules/contact.js +1 -1
  19. package/dist/modules/contact.js.map +1 -1
  20. package/dist/modules/edit-file-vim.js +1 -1
  21. package/dist/modules/edit-file-vim.js.map +1 -1
  22. package/dist/modules/edit-file.js +1 -1
  23. package/dist/modules/edit-file.js.map +1 -1
  24. package/dist/modules/edit-names-vim.js +1 -1
  25. package/dist/modules/edit-names-vim.js.map +1 -1
  26. package/dist/modules/edit-names.js +1 -1
  27. package/dist/modules/edit-names.js.map +1 -1
  28. package/dist/modules/edit.js +1 -1
  29. package/dist/modules/edit.js.map +1 -1
  30. package/dist/modules/help.js +1 -1
  31. package/dist/modules/help.js.map +1 -1
  32. package/dist/modules/konsole.js +1 -1
  33. package/dist/modules/konsole.js.map +1 -1
  34. package/dist/modules/markdown.js +1 -1
  35. package/dist/modules/markdown.js.map +1 -1
  36. package/dist/modules/menu.js +1 -1
  37. package/dist/modules/menu.js.map +1 -1
  38. package/dist/modules/operation.js +1 -1
  39. package/dist/modules/operation.js.map +1 -1
  40. package/dist/modules/polyfill.js +1 -1
  41. package/dist/modules/polyfill.js.map +1 -1
  42. package/dist/modules/terminal-run.js +1 -1
  43. package/dist/modules/terminal-run.js.map +1 -1
  44. package/dist/modules/terminal.js +1 -1
  45. package/dist/modules/terminal.js.map +1 -1
  46. package/dist/modules/upload.js +1 -1
  47. package/dist/modules/upload.js.map +1 -1
  48. package/dist/modules/user-menu.js +1 -1
  49. package/dist/modules/user-menu.js.map +1 -1
  50. package/dist/modules/view.js +1 -1
  51. package/dist/modules/view.js.map +1 -1
  52. package/dist/sw.js +1 -1
  53. package/dist/sw.js.map +1 -1
  54. package/dist-dev/cloudcmd.common.js +335 -366
  55. package/dist-dev/cloudcmd.js +1 -1
  56. package/dist-dev/modules/cloud.js +1 -1
  57. package/dist-dev/modules/command-line.js +1 -1
  58. package/dist-dev/modules/config.js +1 -1
  59. package/dist-dev/modules/edit.js +1 -1
  60. package/dist-dev/modules/konsole.js +1 -1
  61. package/dist-dev/modules/menu.js +1 -1
  62. package/dist-dev/modules/operation.js +1 -1
  63. package/dist-dev/modules/upload.js +1 -1
  64. package/dist-dev/modules/user-menu.js +1 -1
  65. package/dist-dev/modules/view.js +1 -1
  66. package/dist-dev/sw.js +6 -6
  67. package/package.json +17 -16
  68. package/server/auth.js +4 -5
  69. package/server/{cloudcmd.mjs → cloudcmd.js} +7 -7
  70. package/server/{config.mjs → config.js} +16 -24
  71. package/server/depstore.js +1 -3
  72. package/server/distribute/{export.mjs → export.js} +1 -1
  73. package/server/distribute/{import.mjs → import.js} +2 -2
  74. package/server/exit.js +2 -3
  75. package/server/markdown/index.js +12 -12
  76. package/server/markdown/worker.js +3 -3
  77. package/server/prefixer.js +1 -3
  78. package/server/repl.js +4 -6
  79. package/server/rest/info.js +7 -6
  80. package/server/root.js +2 -4
  81. package/server/{route.mjs → route.js} +2 -2
  82. package/server/{server.mjs → server.js} +1 -1
  83. package/server/show-config.js +3 -5
  84. package/server/template.js +6 -4
  85. package/server/terminal.js +4 -3
  86. package/server/{user-menu.mjs → user-menu.js} +19 -8
  87. package/server/{validate.mjs → validate.js} +2 -2
  88. package/static/user-menu.js +5 -5
  89. /package/common/{cloudfunc.mjs → cloudfunc.js} +0 -0
  90. /package/common/{entity.mjs → entity.js} +0 -0
  91. /package/common/{util.mjs → util.js} +0 -0
  92. /package/rules/{split-autoglobals-with-tape.mjs → split-autoglobals-with-tape.js} +0 -0
  93. /package/server/{columns.mjs → columns.js} +0 -0
  94. /package/server/distribute/{log.mjs → log.js} +0 -0
  95. /package/server/{env.mjs → env.js} +0 -0
  96. /package/server/{modulas.mjs → modulas.js} +0 -0
  97. /package/server/rest/{index.mjs → index.js} +0 -0
  98. /package/server/{theme.mjs → theme.js} +0 -0
@@ -192,7 +192,7 @@ module.exports = import("https://esm.sh/@putout/processor-html");;
192
192
  /******/ // startup
193
193
  /******/ // Load entry module and return exports
194
194
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
195
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/cloudcmd.mjs")))
195
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/cloudcmd.js")))
196
196
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
197
197
  /******/
198
198
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/cloud.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/cloud.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/command-line.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/command-line.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/config/index.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/config/index.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/edit.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/edit.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/konsole.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/konsole.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/menu/index.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/menu/index.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/operation/index.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/operation/index.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/upload.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/upload.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/user-menu/index.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/user-menu/index.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
@@ -170,7 +170,7 @@
170
170
  /******/ // startup
171
171
  /******/ // Load entry module and return exports
172
172
  /******/ // This entry module depends on other loaded chunks and execution need to be delayed
173
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/view/index.mjs")))
173
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["cloudcmd.common"], () => (__webpack_require__("./client/modules/view/index.js")))
174
174
  /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
175
175
  /******/
176
176
  /******/ })()
package/dist-dev/sw.js CHANGED
@@ -9,14 +9,14 @@
9
9
  /******/ (() => { // webpackBootstrap
10
10
  /******/ var __webpack_modules__ = ({
11
11
 
12
- /***/ "./client/sw/sw.mjs"
13
- /*!**************************!*\
14
- !*** ./client/sw/sw.mjs ***!
15
- \**************************/
12
+ /***/ "./client/sw/sw.js"
13
+ /*!*************************!*\
14
+ !*** ./client/sw/sw.js ***!
15
+ \*************************/
16
16
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
17
17
 
18
18
  "use strict";
19
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\n\nconst isDev = \"development\" === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => e.waitUntil(f()));\nconst respondWith = currify__WEBPACK_IMPORTED_MODULE_2__((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 = \"Mon Feb 02 2026 22:39:14 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};\nglobalThis.addEventListener('install', wait(onInstall));\nglobalThis.addEventListener('fetch', respondWith(onFetch));\nglobalThis.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await globalThis.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 globalThis.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 (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.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//Users/coderaiser/cloudcmd/client/sw/sw.mjs\n}");
19
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\n\nconst isDev = \"development\" === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => e.waitUntil(f()));\nconst respondWith = currify__WEBPACK_IMPORTED_MODULE_2__((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 Feb 03 2026 15:53:49 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};\nglobalThis.addEventListener('install', wait(onInstall));\nglobalThis.addEventListener('fetch', respondWith(onFetch));\nglobalThis.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await globalThis.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 globalThis.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 (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.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//Users/coderaiser/cloudcmd/client/sw/sw.js\n}");
20
20
 
21
21
  /***/ },
22
22
 
@@ -118,7 +118,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
118
118
  /******/ // startup
119
119
  /******/ // Load entry module and return exports
120
120
  /******/ // This entry module can't be inlined because the eval devtool is used.
121
- /******/ var __webpack_exports__ = __webpack_require__("./client/sw/sw.mjs");
121
+ /******/ var __webpack_exports__ = __webpack_require__("./client/sw/sw.js");
122
122
  /******/
123
123
  /******/ })()
124
124
  ;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcmd",
3
- "version": "19.1.21",
4
- "type": "commonjs",
3
+ "version": "19.3.0",
4
+ "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "File manager for the web with console and editor",
7
7
  "homepage": "http://cloudcmd.io",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/coderaiser/cloudcmd.git"
12
12
  },
13
- "main": "server/cloudcmd.mjs",
13
+ "main": "server/cloudcmd.js",
14
14
  "keywords": [
15
15
  "console",
16
16
  "terminal",
@@ -39,7 +39,7 @@
39
39
  "server"
40
40
  ],
41
41
  "bin": {
42
- "cloudcmd": "bin/cloudcmd.mjs"
42
+ "cloudcmd": "bin/cloudcmd.js"
43
43
  },
44
44
  "scripts": {
45
45
  "start": "madrun start",
@@ -160,7 +160,7 @@
160
160
  "@cloudcmd/stub": "^5.0.0",
161
161
  "@iocmd/wait": "^2.1.0",
162
162
  "@putout/eslint-flat": "^4.0.0",
163
- "@putout/plugin-cloudcmd": "^4.0.0",
163
+ "@putout/plugin-cloudcmd": "^5.2.0",
164
164
  "@types/node-fetch": "^2.6.11",
165
165
  "auto-globals": "^4.0.0",
166
166
  "babel-loader": "^10.0.0",
@@ -221,17 +221,18 @@
221
221
  },
222
222
  "imports": {
223
223
  "#css/": "./css/",
224
- "#dom/events": "./client/dom/events/index.mjs",
225
- "#dom/load": "./client/dom/load.mjs",
226
- "#dom/dialog": "./client/dom/dialog.mjs",
227
- "#dom/images": "./client/dom/images.mjs",
228
- "#dom/files": "./client/dom/files.mjs",
229
- "#dom/upload-files": "./client/dom/upload-files.mjs",
230
- "#dom/storage": "./client/dom/storage.mjs",
231
- "#dom/rest": "./client/dom/rest.mjs",
232
- "#common/util": "./common/util.mjs",
233
- "#common/cloudfunc": "./common/cloudfunc.mjs",
234
- "#common/entity": "./common/entity.mjs"
224
+ "#dom": "./client/dom/index.js",
225
+ "#dom/events": "./client/dom/events/index.js",
226
+ "#dom/load": "./client/dom/load.js",
227
+ "#dom/dialog": "./client/dom/dialog.js",
228
+ "#dom/images": "./client/dom/images.js",
229
+ "#dom/files": "./client/dom/files.js",
230
+ "#dom/upload-files": "./client/dom/upload-files.js",
231
+ "#dom/storage": "./client/dom/storage.js",
232
+ "#dom/rest": "./client/dom/rest.js",
233
+ "#common/util": "./common/util.js",
234
+ "#common/cloudfunc": "./common/cloudfunc.js",
235
+ "#common/entity": "./common/entity.js"
235
236
  },
236
237
  "engines": {
237
238
  "node": ">=22"
package/server/auth.js CHANGED
@@ -1,12 +1,11 @@
1
- 'use strict';
1
+ import httpAuth from 'http-auth';
2
+ import criton from 'criton';
3
+ import currify from 'currify';
2
4
 
3
- const httpAuth = require('http-auth');
4
- const criton = require('criton');
5
- const currify = require('currify');
6
5
  const middle = currify(_middle);
7
6
  const check = currify(_check);
8
7
 
9
- module.exports = (config) => {
8
+ export default (config) => {
10
9
  const auth = httpAuth.basic({
11
10
  realm: 'Cloud Commander',
12
11
  }, check(config));
@@ -16,15 +16,15 @@ import nomine from 'nomine';
16
16
  import fileop from '@cloudcmd/fileop';
17
17
  import * as cloudfunc from '#common/cloudfunc';
18
18
  import authentication from './auth.js';
19
- import {createConfig, configPath} from './config.mjs';
20
- import modulas from './modulas.mjs';
21
- import userMenu from './user-menu.mjs';
22
- import rest from './rest/index.mjs';
23
- import route from './route.mjs';
24
- import * as validate from './validate.mjs';
19
+ import {createConfig, configPath} from './config.js';
20
+ import modulas from './modulas.js';
21
+ import {userMenu} from './user-menu.js';
22
+ import rest from './rest/index.js';
23
+ import route from './route.js';
24
+ import * as validate from './validate.js';
25
25
  import prefixer from './prefixer.js';
26
26
  import terminal from './terminal.js';
27
- import {distributeExport} from './distribute/export.mjs';
27
+ import {distributeExport} from './distribute/export.js';
28
28
  import {createDepStore} from './depstore.js';
29
29
 
30
30
  const __filename = fileURLToPath(import.meta.url);
@@ -1,32 +1,24 @@
1
+ import path, {dirname} from 'node:path';
2
+ import fs from 'node:fs';
3
+ import Emitter from 'node:events';
4
+ import {homedir} from 'node:os';
1
5
  import {fileURLToPath} from 'node:url';
2
- import {dirname} from 'node:path';
3
- import {createRequire} from 'node:module';
6
+ import currify from 'currify';
7
+ import wraptile from 'wraptile';
8
+ import {tryToCatch} from 'try-to-catch';
9
+ import pullout from 'pullout';
10
+ import ponse from 'ponse';
11
+ import jonny from 'jonny';
12
+ import jju from 'jju';
13
+ import writejson from 'writejson';
14
+ import {tryCatch} from 'try-catch';
15
+ import criton from 'criton';
16
+ import * as CloudFunc from '#common/cloudfunc';
17
+ import exit from './exit.js';
4
18
 
5
19
  const __filename = fileURLToPath(import.meta.url);
6
20
  const __dirname = dirname(__filename);
7
- const require = createRequire(import.meta.url);
8
21
  const DIR_SERVER = `${__dirname}/`;
9
-
10
- const path = require('node:path');
11
-
12
- const fs = require('node:fs');
13
- const Emitter = require('node:events');
14
- const {homedir} = require('node:os');
15
-
16
- const currify = require('currify');
17
-
18
- const wraptile = require('wraptile');
19
- const {tryToCatch} = require('try-to-catch');
20
- const pullout = require('pullout');
21
- const ponse = require('ponse');
22
- const jonny = require('jonny');
23
- const jju = require('jju');
24
- const writejson = require('writejson');
25
- const {tryCatch} = require('try-catch');
26
- const criton = require('criton');
27
- const exit = require(`${DIR_SERVER}exit`);
28
-
29
- const CloudFunc = require('../common/cloudfunc.mjs');
30
22
  const isUndefined = (a) => typeof a === 'undefined';
31
23
  const DIR = `${DIR_SERVER}../`;
32
24
  const HOME = homedir();
@@ -1,6 +1,4 @@
1
- 'use strict';
2
-
3
- module.exports.createDepStore = () => {
1
+ export const createDepStore = () => {
4
2
  const deps = {};
5
3
 
6
4
  return (name, value) => {
@@ -11,7 +11,7 @@ import log, {
11
11
  getMessage,
12
12
  getDescription,
13
13
  logWrapped,
14
- } from './log.mjs';
14
+ } from './log.js';
15
15
 
16
16
  const omitList = [
17
17
  'auth',
@@ -4,8 +4,8 @@ import squad from 'squad';
4
4
  import {fullstore} from 'fullstore';
5
5
  import io from 'socket.io-client';
6
6
  import _forEachKey from 'for-each-key';
7
- import log from './log.mjs';
8
- import * as env from '../env.mjs';
7
+ import log from './log.js';
8
+ import * as env from '../env.js';
9
9
 
10
10
  const noop = () => {};
11
11
  const forEachKey = currify(_forEachKey);
package/server/exit.js CHANGED
@@ -1,9 +1,8 @@
1
- 'use strict';
1
+ import process from 'node:process';
2
2
 
3
- const process = require('node:process');
4
3
  const getMessage = (a) => a?.message || a;
5
4
 
6
- module.exports = (...args) => {
5
+ export default (...args) => {
7
6
  const messages = args.map(getMessage);
8
7
 
9
8
  console.error(...messages);
@@ -1,14 +1,14 @@
1
- 'use strict';
2
-
3
- const {callbackify} = require('node:util');
4
-
5
- const pullout = require('pullout');
6
- const ponse = require('ponse');
7
- const {read} = require('redzip');
8
-
9
- const root = require('../root');
10
-
11
- const parse = require('./worker');
1
+ import {callbackify} from 'node:util';
2
+ import {fileURLToPath} from 'node:url';
3
+ import {dirname} from 'node:path';
4
+ import pullout from 'pullout';
5
+ import ponse from 'ponse';
6
+ import {read} from 'redzip';
7
+ import root from '../root.js';
8
+ import parse from './worker.js';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
12
  const isString = (a) => typeof a === 'string';
13
13
 
14
14
  // warm up
@@ -16,7 +16,7 @@ parse('');
16
16
 
17
17
  const DIR_ROOT = `${__dirname}/../../`;
18
18
 
19
- module.exports = callbackify(async (name, rootDir, request) => {
19
+ export default callbackify(async (name, rootDir, request) => {
20
20
  check(name, request);
21
21
 
22
22
  const {method} = request;
@@ -1,5 +1,5 @@
1
- 'use strict';
1
+ import createMarkdownIt from 'markdown-it';
2
2
 
3
- const markdownIt = require('markdown-it')();
3
+ const markdownIt = createMarkdownIt();
4
4
 
5
- module.exports = (a) => markdownIt.render(a);
5
+ export default (a) => markdownIt.render(a);
@@ -1,8 +1,6 @@
1
- 'use strict';
2
-
3
1
  const isString = (a) => typeof a === 'string';
4
2
 
5
- module.exports = (value) => {
3
+ export default (value) => {
6
4
  if (!isString(value))
7
5
  return '';
8
6
 
package/server/repl.js CHANGED
@@ -1,10 +1,8 @@
1
- 'use strict';
1
+ import process from 'node:process';
2
+ import net from 'node:net';
3
+ import repl from 'node:repl';
2
4
 
3
- const process = require('node:process');
4
- const net = require('node:net');
5
- const repl = require('node:repl');
6
-
7
- module.exports = net
5
+ export default net
8
6
  .createServer((socket) => {
9
7
  const {pid} = process;
10
8
  const addr = socket.remoteAddress;
@@ -1,16 +1,17 @@
1
- 'use strict';
2
-
3
- const process = require('node:process');
4
- const format = require('format-io');
1
+ import process from 'node:process';
2
+ import format from 'format-io';
3
+ import info from '../../package.json' with {
4
+ type: 'json',
5
+ };
5
6
 
6
- const {version} = require('../../package');
7
+ const {version} = info;
7
8
 
8
9
  const getMemory = () => {
9
10
  const {rss} = process.memoryUsage();
10
11
  return format.size(rss);
11
12
  };
12
13
 
13
- module.exports = (prefix) => ({
14
+ export default (prefix) => ({
14
15
  version,
15
16
  prefix,
16
17
  memory: getMemory(),
package/server/root.js CHANGED
@@ -1,7 +1,5 @@
1
- 'use strict';
1
+ import mellow from 'mellow';
2
2
 
3
- const mellow = require('mellow');
4
-
5
- module.exports = (dir, root, {webToWin = mellow.webToWin} = {}) => {
3
+ export default (dir, root, {webToWin = mellow.webToWin} = {}) => {
6
4
  return webToWin(dir, root || '/');
7
5
  };
@@ -14,8 +14,8 @@ import * as CloudFunc from '#common/cloudfunc';
14
14
  import root from './root.js';
15
15
  import prefixer from './prefixer.js';
16
16
  import Template from './template.js';
17
- import {getColumns} from './columns.mjs';
18
- import {getThemes} from './theme.mjs';
17
+ import {getColumns} from './columns.js';
18
+ import {getThemes} from './theme.js';
19
19
 
20
20
  const require = createRequire(import.meta.url);
21
21
  const {stringify} = JSON;
@@ -11,7 +11,7 @@ import tryRequire from 'tryrequire';
11
11
  import wraptile from 'wraptile';
12
12
  import compression from 'compression';
13
13
  import exit from './exit.js';
14
- import cloudcmd from './cloudcmd.mjs';
14
+ import cloudcmd from './cloudcmd.js';
15
15
 
16
16
  const bind = (f, self) => f.bind(self);
17
17
 
@@ -1,11 +1,9 @@
1
- 'use strict';
2
-
3
- const {
1
+ import {
4
2
  table,
5
3
  getBorderCharacters,
6
- } = require('table');
4
+ } from 'table';
7
5
 
8
- module.exports = (config) => {
6
+ export const showConfig = (config) => {
9
7
  check(config);
10
8
 
11
9
  const data = Object
@@ -1,7 +1,9 @@
1
- 'use strict';
1
+ import path, {dirname} from 'node:path';
2
+ import {fileURLToPath} from 'node:url';
3
+ import readFilesSync from '@cloudcmd/read-files-sync';
2
4
 
3
- const path = require('node:path');
4
- const readFilesSync = require('@cloudcmd/read-files-sync');
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = dirname(__filename);
5
7
  const templatePath = path.join(__dirname, '..', 'tmpl/fs');
6
8
 
7
- module.exports = readFilesSync(templatePath, 'utf8');
9
+ export default readFilesSync(templatePath, 'utf8');
@@ -1,6 +1,7 @@
1
- 'use strict';
1
+ import {createRequire} from 'node:module';
2
+ import {tryCatch} from 'try-catch';
2
3
 
3
- const {tryCatch} = require('try-catch');
4
+ const require = createRequire(import.meta.url);
4
5
 
5
6
  const noop = (req, res, next) => {
6
7
  next && next();
@@ -10,7 +11,7 @@ noop.listen = noop;
10
11
 
11
12
  const _getModule = (a) => require(a);
12
13
 
13
- module.exports = (config, arg, overrides = {}) => {
14
+ export default (config, arg, overrides = {}) => {
14
15
  const {
15
16
  getModule = _getModule,
16
17
  } = overrides;
@@ -1,6 +1,8 @@
1
1
  import {homedir} from 'node:os';
2
2
  import {readFile as _readFile} from 'node:fs/promises';
3
3
  import {join} from 'node:path';
4
+ import {readFileSync} from 'node:fs';
5
+ // warm up worker cache
4
6
  import montag from 'montag';
5
7
  import {tryToCatch} from 'try-to-catch';
6
8
  import currify from 'currify';
@@ -10,9 +12,8 @@ import {putout, codeframe} from 'putout';
10
12
  transpile('');
11
13
 
12
14
  const PREFIX = '/api/v1/user-menu';
13
- const DEFAULT_MENU_PATH = new URL('../static/user-menu.js', import.meta.url).pathname;
14
15
 
15
- export default currify(async ({menuName, readFile = _readFile}, req, res, next) => {
16
+ export const userMenu = currify(async ({menuName, readFile = _readFile}, req, res, next) => {
16
17
  if (!req.url.startsWith(PREFIX))
17
18
  return next();
18
19
 
@@ -34,7 +35,7 @@ async function onGET({req, res, menuName, readFile}) {
34
35
  const url = req.url.replace(PREFIX, '');
35
36
 
36
37
  if (url === '/default')
37
- return sendDefaultMenu(res);
38
+ return await sendDefaultMenu(res);
38
39
 
39
40
  const {findUp} = await import('find-up');
40
41
 
@@ -57,7 +58,7 @@ async function onGET({req, res, menuName, readFile}) {
57
58
  .send(e.message);
58
59
 
59
60
  if (e)
60
- return sendDefaultMenu(res);
61
+ return await sendDefaultMenu(res);
61
62
 
62
63
  const [parseError, result] = await transpile(source);
63
64
 
@@ -85,10 +86,12 @@ function getError(error, source) {
85
86
  `;
86
87
  }
87
88
 
88
- function sendDefaultMenu(res) {
89
- res.sendFile(DEFAULT_MENU_PATH, {
90
- cacheControl: false,
91
- });
89
+ async function sendDefaultMenu(res) {
90
+ const menu = await getDefaultMenu();
91
+
92
+ res
93
+ .type('js')
94
+ .send(menu);
92
95
  }
93
96
 
94
97
  async function transpile(source) {
@@ -102,3 +105,11 @@ async function transpile(source) {
102
105
  ],
103
106
  });
104
107
  }
108
+
109
+ async function getDefaultMenu() {
110
+ const DEFAULT_MENU_PATH = new URL('../static/user-menu.js', import.meta.url).pathname;
111
+ const menu = readFileSync(DEFAULT_MENU_PATH, 'utf8');
112
+ const [, result] = await transpile(menu);
113
+
114
+ return result.code;
115
+ }
@@ -1,8 +1,8 @@
1
1
  import {statSync as _statSync} from 'node:fs';
2
2
  import {tryCatch} from 'try-catch';
3
3
  import _exit from './exit.js';
4
- import {getColumns as _getColumns} from './columns.mjs';
5
- import {getThemes as _getThemes} from './theme.mjs';
4
+ import {getColumns as _getColumns} from './columns.js';
5
+ import {getThemes as _getThemes} from './theme.js';
6
6
 
7
7
  const isString = (a) => typeof a === 'string';
8
8