cloudcmd 19.2.0 → 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 (106) hide show
  1. package/ChangeLog +7 -0
  2. package/HELP.md +2 -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 +353 -374
  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-file-vim.js +1 -1
  60. package/dist-dev/modules/edit-file.js +1 -1
  61. package/dist-dev/modules/edit-names-vim.js +1 -1
  62. package/dist-dev/modules/edit-names.js +1 -1
  63. package/dist-dev/modules/edit.js +1 -1
  64. package/dist-dev/modules/help.js +1 -1
  65. package/dist-dev/modules/konsole.js +1 -1
  66. package/dist-dev/modules/markdown.js +1 -1
  67. package/dist-dev/modules/menu.js +1 -1
  68. package/dist-dev/modules/operation.js +1 -1
  69. package/dist-dev/modules/polyfill.js +1 -1
  70. package/dist-dev/modules/terminal.js +1 -1
  71. package/dist-dev/modules/upload.js +1 -1
  72. package/dist-dev/modules/user-menu.js +1 -1
  73. package/dist-dev/modules/view.js +1 -1
  74. package/dist-dev/sw.js +6 -6
  75. package/package.json +16 -16
  76. package/server/auth.js +4 -5
  77. package/server/{cloudcmd.mjs → cloudcmd.js} +7 -7
  78. package/server/{config.mjs → config.js} +16 -24
  79. package/server/depstore.js +1 -3
  80. package/server/distribute/{export.mjs → export.js} +1 -1
  81. package/server/distribute/{import.mjs → import.js} +2 -2
  82. package/server/exit.js +2 -3
  83. package/server/markdown/index.js +12 -12
  84. package/server/markdown/worker.js +3 -3
  85. package/server/prefixer.js +1 -3
  86. package/server/repl.js +4 -6
  87. package/server/rest/info.js +7 -6
  88. package/server/root.js +2 -4
  89. package/server/{route.mjs → route.js} +2 -2
  90. package/server/{server.mjs → server.js} +1 -1
  91. package/server/show-config.js +3 -5
  92. package/server/template.js +6 -4
  93. package/server/terminal.js +4 -3
  94. package/server/{user-menu.mjs → user-menu.js} +19 -8
  95. package/server/{validate.mjs → validate.js} +2 -2
  96. package/static/user-menu.js +5 -5
  97. /package/common/{cloudfunc.mjs → cloudfunc.js} +0 -0
  98. /package/common/{entity.mjs → entity.js} +0 -0
  99. /package/common/{util.mjs → util.js} +0 -0
  100. /package/rules/{split-autoglobals-with-tape.mjs → split-autoglobals-with-tape.js} +0 -0
  101. /package/server/{columns.mjs → columns.js} +0 -0
  102. /package/server/distribute/{log.mjs → log.js} +0 -0
  103. /package/server/{env.mjs → env.js} +0 -0
  104. /package/server/{modulas.mjs → modulas.js} +0 -0
  105. /package/server/rest/{index.mjs → index.js} +0 -0
  106. /package/server/{theme.mjs → theme.js} +0 -0
@@ -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
 
@@ -1,9 +1,7 @@
1
- 'use strict';
2
-
3
1
  const RENAME_FILE = 'Rename file';
4
2
  const CDN = 'https://cdn.jsdelivr.net/gh/cloudcmd/user-menu@1.2.4';
5
3
 
6
- module.exports = {
4
+ export default {
7
5
  '__settings': {
8
6
  select: [RENAME_FILE],
9
7
  run: false,
@@ -135,7 +133,8 @@ async function readDefaultMenu({prefix}) {
135
133
  return await res.text();
136
134
  }
137
135
 
138
- module.exports._selectNames = selectNames;
136
+ export const _selectNames = selectNames;
137
+
139
138
  function selectNames(names, panel, {selectFile, getCurrentByName}) {
140
139
  for (const name of names) {
141
140
  const file = getCurrentByName(name, panel);
@@ -143,7 +142,8 @@ function selectNames(names, panel, {selectFile, getCurrentByName}) {
143
142
  }
144
143
  }
145
144
 
146
- module.exports._compare = compare;
145
+ export const _compare = compare;
146
+
147
147
  function compare(a, b) {
148
148
  const result = [];
149
149
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes