You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

electron-extension-installer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

33

dist/index.js

@@ -86,3 +86,3 @@ "use strict";

if (process.type !== "browser") {
return Promise.reject(new Error("electron-devtools-assembler can only be used from the main process"));
throw new Error("electron-devtools-assembler can only be used from the main process");
}

@@ -98,3 +98,3 @@ if (Array.isArray(extensionReference)) {

if (!semver.satisfies(electronVersion, extensionReference.electron)) {
return Promise.reject(new Error(`Version of Electron: ${electronVersion} does not match required range ${extensionReference.electron} for extension ${chromeStoreID}`));
throw new Error(`Version of Electron: ${electronVersion} does not match required range ${extensionReference.electron} for extension ${chromeStoreID}`);
}

@@ -106,23 +106,18 @@ }

else {
return Promise.reject(new Error(`Invalid extensionReference passed in: "${extensionReference}"`));
throw new Error(`Invalid extensionReference passed in: "${extensionReference}"`);
}
const IDMap = (0, utils_1.getIdMap)();
const extensionName = IDMap[chromeStoreID];
const extensionInstalled = !!extensionName &&
electron_1.session.defaultSession.getAllExtensions().some((e) => e.name === extensionName);
if (!forceDownload && extensionInstalled) {
return Promise.resolve(IDMap[chromeStoreID]);
// todo - should we check id here?
const installedExtension = electron_1.session.defaultSession.getAllExtensions().find((e) => e.name === extensionName);
if (!forceDownload && installedExtension) {
return IDMap[chromeStoreID];
}
return downloadChromeExtension(chromeStoreID, Boolean(forceDownload)).then((extensionFolder) => {
// Use forceDownload, but already installed
if (extensionInstalled) {
const extensionId = electron_1.session.defaultSession.getAllExtensions().find((e) => e.name)?.id;
if (extensionId) {
electron_1.session.defaultSession.removeExtension(extensionId);
}
}
return electron_1.session.defaultSession.loadExtension(extensionFolder, loadExtensionOptions).then((ext) => {
return Promise.resolve(ext.name);
});
});
const extensionFolder = await downloadChromeExtension(chromeStoreID, Boolean(forceDownload));
// Use forceDownload, but already installed
if (installedExtension) {
electron_1.session.defaultSession.removeExtension(installedExtension.id);
}
const ext = await electron_1.session.defaultSession.loadExtension(extensionFolder, loadExtensionOptions);
return ext.name;
};

@@ -129,0 +124,0 @@ exports.installExtension = installExtension;

{
"name": "electron-extension-installer",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": "Jonluca DeCaro <electronextension@jonlu.ca>",

@@ -86,3 +86,3 @@ import type { LoadExtensionOptions } from "electron";

if (process.type !== "browser") {
return Promise.reject(new Error("electron-devtools-assembler can only be used from the main process"));
throw new Error("electron-devtools-assembler can only be used from the main process");
}

@@ -99,6 +99,4 @@

if (!semver.satisfies(electronVersion, extensionReference.electron)) {
return Promise.reject(
new Error(
`Version of Electron: ${electronVersion} does not match required range ${extensionReference.electron} for extension ${chromeStoreID}`,
), // eslint-disable-line
throw new Error(
`Version of Electron: ${electronVersion} does not match required range ${extensionReference.electron} for extension ${chromeStoreID}`,
);

@@ -109,3 +107,3 @@ }

} else {
return Promise.reject(new Error(`Invalid extensionReference passed in: "${extensionReference}"`));
throw new Error(`Invalid extensionReference passed in: "${extensionReference}"`);
}

@@ -115,24 +113,19 @@

const extensionName = IDMap[chromeStoreID];
const extensionInstalled: boolean =
!!extensionName &&
session.defaultSession.getAllExtensions().some((e: { name: string }) => e.name === extensionName);
// todo - should we check id here?
const installedExtension = session.defaultSession.getAllExtensions().find((e) => e.name === extensionName);
if (!forceDownload && extensionInstalled) {
return Promise.resolve(IDMap[chromeStoreID]);
if (!forceDownload && installedExtension) {
return IDMap[chromeStoreID];
}
return downloadChromeExtension(chromeStoreID, Boolean(forceDownload)).then((extensionFolder) => {
// Use forceDownload, but already installed
if (extensionInstalled) {
const extensionId = session.defaultSession.getAllExtensions().find((e: { name: string }) => e.name)?.id;
if (extensionId) {
session.defaultSession.removeExtension(extensionId);
}
}
return session.defaultSession.loadExtension(extensionFolder, loadExtensionOptions).then((ext: { name: string }) => {
return Promise.resolve(ext.name);
});
});
const extensionFolder = await downloadChromeExtension(chromeStoreID, Boolean(forceDownload));
// Use forceDownload, but already installed
if (installedExtension) {
session.defaultSession.removeExtension(installedExtension.id);
}
const ext = await session.defaultSession.loadExtension(extensionFolder, loadExtensionOptions);
return ext.name;
};
export default installExtension;
export * from "./extensions";
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc