Ver Fonte

Use default import instead of star import

Refs:
https://stackoverflow.com/questions/31386631/difference-between-import-x-and-import-as-x-in-node-js-es6-babel
Manav Rathi há 1 ano atrás
pai
commit
140b65b69d

+ 3 - 3
desktop/src/main.ts

@@ -8,12 +8,12 @@
  *
  * https://www.electronjs.org/docs/latest/tutorial/process-model#the-main-process
  */
-import * as log from "electron-log";
+import log from "electron-log";
 import { app, BrowserWindow } from "electron/main";
 import serveNextAt from "next-electron-server";
 import { existsSync } from "node:fs";
-import * as fs from "node:fs/promises";
-import * as path from "node:path";
+import fs from "node:fs/promises";
+import path from "node:path";
 import { isDev } from "./main/general";
 import { attachFSWatchIPCHandlers, attachIPCHandlers } from "./main/ipc";
 import { logErrorSentry, setupLogging } from "./main/log";

+ 1 - 1
desktop/src/main/dialogs.ts

@@ -1,5 +1,5 @@
 import { dialog } from "electron/main";
-import * as path from "node:path";
+import path from "node:path";
 import { getDirFilePaths, getElectronFile } from "../services/fs";
 import { getElectronFilesFromGoogleZip } from "../services/upload";
 import type { ElectronFile } from "../types";

+ 2 - 2
desktop/src/main/fs.ts

@@ -2,8 +2,8 @@
  * @file file system related functions exposed over the context bridge.
  */
 import { createWriteStream, existsSync } from "node:fs";
-import * as fs from "node:fs/promises";
-import * as path from "node:path";
+import fs from "node:fs/promises";
+import path from "node:path";
 import { Readable } from "node:stream";
 import { logError } from "./log";
 

+ 1 - 1
desktop/src/main/general.ts

@@ -1,6 +1,6 @@
 import { shell } from "electron"; /* TODO(MR): Why is this not in /main? */
 import { app } from "electron/main";
-import * as path from "node:path";
+import path from "node:path";
 
 /** `true` if the app is running in development mode. */
 export const isDev = !app.isPackaged;

+ 1 - 1
desktop/src/services/chokidar.ts

@@ -1,6 +1,6 @@
 import chokidar from "chokidar";
 import { BrowserWindow } from "electron";
-import * as path from "path";
+import path from "path";
 import { logError } from "../main/log";
 import { getWatchMappings } from "../services/watch";
 import { getElectronFile } from "./fs";

+ 3 - 3
desktop/src/services/clipService.ts

@@ -1,8 +1,8 @@
-import * as log from "electron-log";
+import log from "electron-log";
 import { app, net } from "electron/main";
 import { existsSync } from "fs";
-import * as fs from "node:fs/promises";
-import * as path from "node:path";
+import fs from "node:fs/promises";
+import path from "node:path";
 import util from "util";
 import { CustomErrors } from "../constants/errors";
 import { writeStream } from "../main/fs";

+ 1 - 1
desktop/src/services/ffmpeg.ts

@@ -1,7 +1,7 @@
 import log from "electron-log";
 import pathToFfmpeg from "ffmpeg-static";
 import { existsSync } from "node:fs";
-import * as fs from "node:fs/promises";
+import fs from "node:fs/promises";
 import util from "util";
 import { CustomErrors } from "../constants/errors";
 import { writeStream } from "../main/fs";

+ 2 - 2
desktop/src/services/fs.ts

@@ -1,7 +1,7 @@
 import StreamZip from "node-stream-zip";
 import { existsSync } from "node:fs";
-import * as fs from "node:fs/promises";
-import * as path from "node:path";
+import fs from "node:fs/promises";
+import path from "node:path";
 import { logError } from "../main/log";
 import { ElectronFile } from "../types";
 

+ 1 - 1
desktop/src/services/imageProcessor.ts

@@ -1,7 +1,7 @@
 import { exec } from "child_process";
 import log from "electron-log";
 import { existsSync } from "fs";
-import * as fs from "node:fs/promises";
+import fs from "node:fs/promises";
 import path from "path";
 import util from "util";
 import { CustomErrors } from "../constants/errors";

+ 3 - 3
desktop/src/utils/createWindow.ts

@@ -1,11 +1,11 @@
 import { app, BrowserWindow, nativeImage } from "electron";
 import ElectronLog from "electron-log";
-import * as path from "path";
+import path from "path";
 import { isAppQuitting, rendererURL } from "../main";
-import autoLauncher from "../services/autoLauncher";
+import { isDev } from "../main/general";
 import { logErrorSentry } from "../main/log";
+import autoLauncher from "../services/autoLauncher";
 import { getHideDockIconPreference } from "../services/userPreference";
-import { isDev } from "../main/general";
 import { isPlatform } from "./common/platform";
 
 /**

+ 1 - 1
desktop/src/utils/temp.ts

@@ -1,6 +1,6 @@
 import { app } from "electron/main";
 import { existsSync } from "node:fs";
-import * as fs from "node:fs/promises";
+import fs from "node:fs/promises";
 import path from "path";
 
 const CHARACTERS =