Skip to content

Commit 2c2ca8e

Browse files
committed
feature: client: edit-file: migrate to ESM
1 parent c9f57c5 commit 2c2ca8e

3 files changed

Lines changed: 19 additions & 20 deletions

File tree

.webpack/js.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default {
120120
'sw': `${dir}/sw/sw.mjs`,
121121
'cloudcmd': `${dir}/cloudcmd.mjs`,
122122
[`${modules}/edit`]: `${dirModules}/edit.mjs`,
123-
[`${modules}/edit-file`]: `${dirModules}/edit-file.js`,
123+
[`${modules}/edit-file`]: `${dirModules}/edit-file.mjs`,
124124
[`${modules}/edit-file-vim`]: `${dirModules}/edit-file-vim.mjs`,
125125
[`${modules}/edit-names`]: `${dirModules}/edit-names.js`,
126126
[`${modules}/edit-names-vim`]: `${dirModules}/edit-names-vim.mjs`,

client/cloudcmd.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import wraptile from 'wraptile';
44
import load from 'load.js';
55
import * as Util from '#common/util';
66
import * as CloudFunc from '#common/cloudfunc';
7+
import DOM from '#dom';
78
import {registerSW, listenSW} from './sw/register.mjs';
89
import {initSortPanel, sortPanel} from './sort.mjs';
9-
import DOM from '#dom';
1010
import {createCloudCmd} from './client.mjs';
1111
import * as Listeners from './listeners/index.mjs';
1212

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
'use strict';
2-
31
/* global CloudCmd, DOM*/
4-
CloudCmd.EditFile = exports;
5-
6-
const Format = require('format-io');
7-
const {fullstore} = require('fullstore');
8-
const exec = require('execon');
9-
const supermenu = require('supermenu');
2+
import Format from 'format-io';
3+
import {fullstore} from 'fullstore';
4+
import exec from 'execon';
5+
import supermenu from 'supermenu';
6+
7+
CloudCmd.EditFile = {
8+
init,
9+
show,
10+
hide,
11+
isChanged,
12+
};
1013

1114
const Info = DOM.CurrentInfo;
1215

@@ -26,7 +29,7 @@ const ConfigView = {
2629
},
2730
};
2831

29-
module.exports.init = async () => {
32+
export async function init() {
3033
isLoading(true);
3134

3235
await CloudCmd.Edit();
@@ -36,7 +39,7 @@ module.exports.init = async () => {
3639
setListeners(editor);
3740

3841
isLoading(false);
39-
};
42+
}
4043

4144
function getName() {
4245
const {name, isDir} = Info;
@@ -47,7 +50,7 @@ function getName() {
4750
return name;
4851
}
4952

50-
module.exports.show = async (options) => {
53+
export async function show(options) {
5154
if (isLoading())
5255
return;
5356

@@ -86,11 +89,9 @@ module.exports.show = async (options) => {
8689
CloudCmd.Edit.show(optionsEdit);
8790

8891
return CloudCmd.Edit;
89-
};
90-
91-
module.exports.hide = hide;
92+
}
9293

93-
function hide() {
94+
export function hide() {
9495
CloudCmd.Edit.hide();
9596
}
9697

@@ -176,9 +177,7 @@ function setMsgChanged(name) {
176177
MSG_CHANGED = `Do you want to save changes to ${name}?`;
177178
}
178179

179-
module.exports.isChanged = isChanged;
180-
181-
async function isChanged() {
180+
export async function isChanged() {
182181
const editor = CloudCmd.Edit.getEditor();
183182
const is = editor.isChanged();
184183

0 commit comments

Comments
 (0)