From 7715cd1bd903ea2e648b0b3bce5dfc8928659d72 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 13 Nov 2023 22:04:22 +0700 Subject: [PATCH] chore: esm import --- electron/handlers/plugin.ts | 7 +++---- electron/handlers/update.ts | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/electron/handlers/plugin.ts b/electron/handlers/plugin.ts index 4446a667dd..26eb3c5836 100644 --- a/electron/handlers/plugin.ts +++ b/electron/handlers/plugin.ts @@ -4,7 +4,7 @@ import { ModuleManager } from "../managers/module"; import { join, extname } from "path"; import { PluginManager } from "../managers/plugin"; import { WindowManager } from "../managers/window"; -const pacote = require("pacote"); +import { manifest, tarball } from "pacote"; export function handlePluginIPCs() { /** @@ -107,10 +107,9 @@ export function handlePluginIPCs() { app.getPath("userData"), pluginName.replace(/^@.*\//, "") + ".tgz" ); - return pacote - .manifest(pluginName) + return manifest(pluginName) .then(async (manifest: any) => { - await pacote.tarball(manifest._resolved).then((data: Buffer) => { + await tarball(manifest._resolved).then((data: Buffer) => { writeFileSync(destination, data); }); }) diff --git a/electron/handlers/update.ts b/electron/handlers/update.ts index ae582e88f1..096d09bac6 100644 --- a/electron/handlers/update.ts +++ b/electron/handlers/update.ts @@ -1,7 +1,6 @@ import { app, dialog } from "electron"; import { WindowManager } from "../managers/window"; - -const { autoUpdater } = require("electron-updater"); +import { autoUpdater } from "electron-updater"; export function handleAppUpdates() { /* Should not check for update during development */