Skip to content

Commit e3ad330

Browse files
committed
feature: client: konsole: migrate to ESM
1 parent 983fd9a commit e3ad330

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

.webpack/js.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default {
132132
[`${modules}/contact`]: `${dirModules}/contact.js`,
133133
[`${modules}/upload`]: `${dirModules}/upload.mjs`,
134134
[`${modules}/operation`]: `${dirModules}/operation/index.mjs`,
135-
[`${modules}/konsole`]: `${dirModules}/konsole.js`,
135+
[`${modules}/konsole`]: `${dirModules}/konsole.mjs`,
136136
[`${modules}/terminal`]: `${dirModules}/terminal.js`,
137137
[`${modules}/terminal-run`]: `${dirModules}/terminal-run.js`,
138138
[`${modules}/cloud`]: `${dirModules}/cloud.mjs`,
Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
'use strict';
2-
31
/* global CloudCmd */
42
/* global Util */
53
/* global DOM */
64
/* global Console */
7-
CloudCmd.Konsole = exports;
8-
9-
const exec = require('execon');
10-
const currify = require('currify');
11-
const {tryToCatch} = require('try-to-catch');
12-
const loadJS = require('load.js').js;
13-
const createElement = require('@cloudcmd/create-element');
5+
import exec from 'execon';
6+
import currify from 'currify';
7+
import {tryToCatch} from 'try-to-catch';
8+
import {js as loadJS} from 'load.js';
9+
import createElement from '@cloudcmd/create-element';
10+
import * as Images from '#dom/images';
11+
12+
CloudCmd.Konsole = {
13+
init,
14+
show,
15+
hide,
16+
};
1417

15-
const Images = require('#dom/images');
1618
const {Dialog, CurrentInfo: Info} = DOM;
1719

1820
const rmLastSlash = (a) => a.replace(/\/$/, '') || '/';
@@ -27,7 +29,7 @@ const Name = 'Konsole';
2729
let Element;
2830
let Loaded;
2931

30-
module.exports.init = async () => {
32+
export async function init() {
3133
if (!config('console'))
3234
return;
3335

@@ -36,13 +38,13 @@ module.exports.init = async () => {
3638
await CloudCmd.View();
3739
await load();
3840
await create();
39-
};
41+
}
4042

41-
module.exports.hide = () => {
43+
export function hide() {
4244
CloudCmd.View.hide();
43-
};
45+
}
4446

45-
module.exports.clear = () => {
47+
export const clear = () => {
4648
konsole.clear();
4749
};
4850

@@ -109,7 +111,7 @@ function authCheck(konsole) {
109111
});
110112
}
111113

112-
module.exports.show = (callback) => {
114+
export function show(callback) {
113115
if (!Loaded)
114116
return;
115117

@@ -122,7 +124,7 @@ module.exports.show = (callback) => {
122124
exec(callback);
123125
},
124126
});
125-
};
127+
}
126128

127129
const load = async () => {
128130
Util.time(`${Name} load`);

0 commit comments

Comments
 (0)