feature: client: modules: terminal: migrate to ESM

This commit is contained in:
coderiaser 2026-02-03 00:36:00 +02:00
parent bf50550911
commit dfcbfd632e
7 changed files with 26 additions and 28 deletions

View file

@ -133,7 +133,7 @@ export default {
[`${modules}/upload`]: `${dirModules}/upload.mjs`,
[`${modules}/operation`]: `${dirModules}/operation/index.mjs`,
[`${modules}/konsole`]: `${dirModules}/konsole.mjs`,
[`${modules}/terminal`]: `${dirModules}/terminal.js`,
[`${modules}/terminal`]: `${dirModules}/terminal.mjs`,
[`${modules}/terminal-run`]: `${dirModules}/terminal-run.js`,
[`${modules}/cloud`]: `${dirModules}/cloud.mjs`,
[`${modules}/user-menu`]: `${dirModules}/user-menu/index.mjs`,

View file

@ -6,7 +6,7 @@ import * as Util from '#common/util';
import * as CloudFunc from '#common/cloudfunc';
import {registerSW, listenSW} from './sw/register.mjs';
import {initSortPanel, sortPanel} from './sort.mjs';
import DOM from './dom/index.mjs';
import DOM from '#dom';
import {createCloudCmd} from './client.mjs';
import * as Listeners from './listeners/index.mjs';

View file

@ -1,5 +1,5 @@
import {test, stub} from 'supertape';
import {getCSSVar, goToDirectory} from './index.mjs';
import {getCSSVar, goToDirectory} from '#dom';
globalThis.CloudCmd = {};

View file

@ -9,7 +9,7 @@ require('../../css/terminal.css');
const exec = require('execon');
const load = require('load.js');
const DOM = require('../dom/index.mjs');
const DOM = require('#dom');
const Images = require('#dom/images');
const {Dialog} = DOM;

View file

@ -1,22 +1,22 @@
'use strict';
/* global CloudCmd */
/* global gritty */
const {tryToCatch} = require('try-to-catch');
require('../../css/terminal.css');
const exec = require('execon');
const load = require('load.js');
const DOM = require('../dom/index.mjs');
const Images = require('#dom/images');
import '#css/terminal.css';
import {tryToCatch} from 'try-to-catch';
import exec from 'execon';
import load from 'load.js';
import * as Images from '#dom/images';
import DOM from '#dom';
const loadParallel = load.parallel;
const {Dialog} = DOM;
const {Key, config} = CloudCmd;
const {CloudCmd} = globalThis;
CloudCmd.Terminal = exports;
const {Dialog} = DOM;
const {Key, config} = globalThis.CloudCmd;
CloudCmd.Terminal = {
init,
show,
hide,
};
let Loaded;
let Terminal;
@ -39,7 +39,7 @@ const loadAll = async () => {
Loaded = true;
};
module.exports.init = async () => {
export async function init() {
if (!config('terminal'))
return;
@ -48,12 +48,9 @@ module.exports.init = async () => {
await CloudCmd.View();
await loadAll();
create();
};
}
module.exports.show = show;
module.exports.hide = hide;
function hide() {
export function hide() {
CloudCmd.View.hide();
}
@ -78,7 +75,7 @@ function create() {
fontFamily: 'Droid Sans Mono',
};
const {socket, terminal} = gritty(document.body, options);
const {socket, terminal} = globalThis.gritty(document.body, options);
Socket = socket;
Terminal = terminal;
@ -101,7 +98,7 @@ function authCheck(spawn) {
});
}
function show() {
export function show() {
if (!Loaded)
return;

View file

@ -1,6 +1,6 @@
/* global CloudCmd */
import {fullstore} from 'fullstore';
import DOM from './dom/index.mjs';
import DOM from '#dom';
const sortPrevious = fullstore();

View file

@ -221,6 +221,7 @@
},
"imports": {
"#css/": "./css/",
"#dom": "./client/dom/index.mjs",
"#dom/events": "./client/dom/events/index.mjs",
"#dom/load": "./client/dom/load.mjs",
"#dom/dialog": "./client/dom/dialog.mjs",