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.
- package/ChangeLog +7 -0
- package/HELP.md +2 -1
- package/README.md +1 -1
- package/bin/{cloudcmd.mjs → cloudcmd.js} +5 -5
- package/common/callbackify.js +1 -3
- package/common/datetime.js +2 -4
- package/common/try-to-promise-all.js +2 -3
- package/dist/cloudcmd.common.js +2 -2
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/cloudcmd.js +1 -1
- package/dist/cloudcmd.js.map +1 -1
- package/dist/modules/cloud.js +1 -1
- package/dist/modules/cloud.js.map +1 -1
- package/dist/modules/command-line.js +1 -1
- package/dist/modules/command-line.js.map +1 -1
- package/dist/modules/config.js +1 -1
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/contact.js +1 -1
- package/dist/modules/contact.js.map +1 -1
- package/dist/modules/edit-file-vim.js +1 -1
- package/dist/modules/edit-file-vim.js.map +1 -1
- package/dist/modules/edit-file.js +1 -1
- package/dist/modules/edit-file.js.map +1 -1
- package/dist/modules/edit-names-vim.js +1 -1
- package/dist/modules/edit-names-vim.js.map +1 -1
- package/dist/modules/edit-names.js +1 -1
- package/dist/modules/edit-names.js.map +1 -1
- package/dist/modules/edit.js +1 -1
- package/dist/modules/edit.js.map +1 -1
- package/dist/modules/help.js +1 -1
- package/dist/modules/help.js.map +1 -1
- package/dist/modules/konsole.js +1 -1
- package/dist/modules/konsole.js.map +1 -1
- package/dist/modules/markdown.js +1 -1
- package/dist/modules/markdown.js.map +1 -1
- package/dist/modules/menu.js +1 -1
- package/dist/modules/menu.js.map +1 -1
- package/dist/modules/operation.js +1 -1
- package/dist/modules/operation.js.map +1 -1
- package/dist/modules/polyfill.js +1 -1
- package/dist/modules/polyfill.js.map +1 -1
- package/dist/modules/terminal-run.js +1 -1
- package/dist/modules/terminal-run.js.map +1 -1
- package/dist/modules/terminal.js +1 -1
- package/dist/modules/terminal.js.map +1 -1
- package/dist/modules/upload.js +1 -1
- package/dist/modules/upload.js.map +1 -1
- package/dist/modules/user-menu.js +1 -1
- package/dist/modules/user-menu.js.map +1 -1
- package/dist/modules/view.js +1 -1
- package/dist/modules/view.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist-dev/cloudcmd.common.js +353 -374
- package/dist-dev/cloudcmd.js +1 -1
- package/dist-dev/modules/cloud.js +1 -1
- package/dist-dev/modules/command-line.js +1 -1
- package/dist-dev/modules/config.js +1 -1
- package/dist-dev/modules/edit-file-vim.js +1 -1
- package/dist-dev/modules/edit-file.js +1 -1
- package/dist-dev/modules/edit-names-vim.js +1 -1
- package/dist-dev/modules/edit-names.js +1 -1
- package/dist-dev/modules/edit.js +1 -1
- package/dist-dev/modules/help.js +1 -1
- package/dist-dev/modules/konsole.js +1 -1
- package/dist-dev/modules/markdown.js +1 -1
- package/dist-dev/modules/menu.js +1 -1
- package/dist-dev/modules/operation.js +1 -1
- package/dist-dev/modules/polyfill.js +1 -1
- package/dist-dev/modules/terminal.js +1 -1
- package/dist-dev/modules/upload.js +1 -1
- package/dist-dev/modules/user-menu.js +1 -1
- package/dist-dev/modules/view.js +1 -1
- package/dist-dev/sw.js +6 -6
- package/package.json +16 -16
- package/server/auth.js +4 -5
- package/server/{cloudcmd.mjs → cloudcmd.js} +7 -7
- package/server/{config.mjs → config.js} +16 -24
- package/server/depstore.js +1 -3
- package/server/distribute/{export.mjs → export.js} +1 -1
- package/server/distribute/{import.mjs → import.js} +2 -2
- package/server/exit.js +2 -3
- package/server/markdown/index.js +12 -12
- package/server/markdown/worker.js +3 -3
- package/server/prefixer.js +1 -3
- package/server/repl.js +4 -6
- package/server/rest/info.js +7 -6
- package/server/root.js +2 -4
- package/server/{route.mjs → route.js} +2 -2
- package/server/{server.mjs → server.js} +1 -1
- package/server/show-config.js +3 -5
- package/server/template.js +6 -4
- package/server/terminal.js +4 -3
- package/server/{user-menu.mjs → user-menu.js} +19 -8
- package/server/{validate.mjs → validate.js} +2 -2
- package/static/user-menu.js +5 -5
- /package/common/{cloudfunc.mjs → cloudfunc.js} +0 -0
- /package/common/{entity.mjs → entity.js} +0 -0
- /package/common/{util.mjs → util.js} +0 -0
- /package/rules/{split-autoglobals-with-tape.mjs → split-autoglobals-with-tape.js} +0 -0
- /package/server/{columns.mjs → columns.js} +0 -0
- /package/server/distribute/{log.mjs → log.js} +0 -0
- /package/server/{env.mjs → env.js} +0 -0
- /package/server/{modulas.mjs → modulas.js} +0 -0
- /package/server/rest/{index.mjs → index.js} +0 -0
- /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
|
|
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
|
-
|
|
90
|
-
|
|
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.
|
|
5
|
-
import {getThemes as _getThemes} from './theme.
|
|
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
|
|
package/static/user-menu.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
File without changes
|