From e3ad330ebc52c60d1a674280aa9491b3beca54cb Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 22:38:53 +0200 Subject: [PATCH] feature: client: konsole: migrate to ESM --- .webpack/js.mjs | 2 +- client/modules/{konsole.js => konsole.mjs} | 34 ++++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) rename client/modules/{konsole.js => konsole.mjs} (86%) diff --git a/.webpack/js.mjs b/.webpack/js.mjs index 50cf4caa..52352df7 100644 --- a/.webpack/js.mjs +++ b/.webpack/js.mjs @@ -132,7 +132,7 @@ export default { [`${modules}/contact`]: `${dirModules}/contact.js`, [`${modules}/upload`]: `${dirModules}/upload.mjs`, [`${modules}/operation`]: `${dirModules}/operation/index.mjs`, - [`${modules}/konsole`]: `${dirModules}/konsole.js`, + [`${modules}/konsole`]: `${dirModules}/konsole.mjs`, [`${modules}/terminal`]: `${dirModules}/terminal.js`, [`${modules}/terminal-run`]: `${dirModules}/terminal-run.js`, [`${modules}/cloud`]: `${dirModules}/cloud.mjs`, diff --git a/client/modules/konsole.js b/client/modules/konsole.mjs similarity index 86% rename from client/modules/konsole.js rename to client/modules/konsole.mjs index 80b019d2..e9a465af 100644 --- a/client/modules/konsole.js +++ b/client/modules/konsole.mjs @@ -1,18 +1,20 @@ -'use strict'; - /* global CloudCmd */ /* global Util */ /* global DOM */ /* global Console */ -CloudCmd.Konsole = exports; +import exec from 'execon'; +import currify from 'currify'; +import {tryToCatch} from 'try-to-catch'; +import {js as loadJS} from 'load.js'; +import createElement from '@cloudcmd/create-element'; +import * as Images from '#dom/images'; -const exec = require('execon'); -const currify = require('currify'); -const {tryToCatch} = require('try-to-catch'); -const loadJS = require('load.js').js; -const createElement = require('@cloudcmd/create-element'); +CloudCmd.Konsole = { + init, + show, + hide, +}; -const Images = require('#dom/images'); const {Dialog, CurrentInfo: Info} = DOM; const rmLastSlash = (a) => a.replace(/\/$/, '') || '/'; @@ -27,7 +29,7 @@ const Name = 'Konsole'; let Element; let Loaded; -module.exports.init = async () => { +export async function init() { if (!config('console')) return; @@ -36,13 +38,13 @@ module.exports.init = async () => { await CloudCmd.View(); await load(); await create(); -}; +} -module.exports.hide = () => { +export function hide() { CloudCmd.View.hide(); -}; +} -module.exports.clear = () => { +export const clear = () => { konsole.clear(); }; @@ -109,7 +111,7 @@ function authCheck(konsole) { }); } -module.exports.show = (callback) => { +export function show(callback) { if (!Loaded) return; @@ -122,7 +124,7 @@ module.exports.show = (callback) => { exec(callback); }, }); -}; +} const load = async () => { Util.time(`${Name} load`);