Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-electron-renderer

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-electron-renderer - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

index.d.ts

37

index.js

@@ -5,3 +5,3 @@ const fs = require('fs');

/** @type {import('./types').VitePluginElectronRenderer} */
/** @type {import('.').VitePluginElectronRenderer} */
module.exports = function (options = {}) {

@@ -39,3 +39,6 @@ const { resolve } = options;

generateESModule(cacheDir, resolve);
modifyAlias(config, Object.keys(resolve).map(moduleId => ({ [moduleId]: path.join(cacheDir, moduleId) })));
modifyAlias(
config,
Object.keys(resolve).map(moduleId => ({ [moduleId]: path.join(cacheDir, moduleId) })),
);
}

@@ -72,13 +75,10 @@ },

/** @type {import('./types').GenerateESModule} */
function generateESModule(
cacheDir,
resolveDict,
) {
/** @type {import('.').GenerateESModule} */
function generateESModule(cacheDir, resolve) {
// generate custom-resolve module file
for (const [module, strOrFn] of Object.entries(resolveDict)) {
for (const [module, strOrFn] of Object.entries(resolve)) {
const moduleId = path.join(cacheDir, module + '.js');
const moduleContent = typeof strOrFn === 'function' ? strOrFn() : strOrFn;
// for '@scope/name' module
// supported nest module ('@scope/name')
ensureDir(path.parse(moduleId).dir);

@@ -90,10 +90,7 @@ // write custom-resolve

/** @type {import('./types').ModifyAlias} */
function modifyAlias(
config,
aliaList,
) {
/** @type {import('.').ModifyAlias} */
function modifyAlias(config, aliaList) {
if (!config.resolve) config.resolve = {};
let alias = config.resolve.alias || {};
let alias = config.resolve.alias || [];
if (!Array.isArray(alias)) {

@@ -111,3 +108,3 @@ // keep the the original alias

/** @type {import('./types').ModifyOptimizeDepsExclude} */
/** @type {import('.').ModifyOptimizeDepsExclude} */
function modifyOptimizeDepsExclude(config, exclude) {

@@ -120,3 +117,3 @@ if (!config.optimizeDeps) config.optimizeDeps = {};

/** @type {import('./types').ModifyRollupExternal} */
/** @type {import('.').ModifyRollupExternal} */
function modifyRollupExternal(config) {

@@ -147,3 +144,3 @@ if (!config.build) config.build = {};

/** @type {import('./types').ModifyOptionsForElectron} */
/** @type {import('.').ModifyOptionsForElectron} */
function modifyOptionsForElectron(config) {

@@ -177,6 +174,2 @@ // electron use `loadFile` load Renderer-process file

function cleanUrl(url) {
return url.replace(/\?.*$/s, '').replace(/#.*$/s, '');
}
function ensureDir(dir) {

@@ -183,0 +176,0 @@ if (!(fs.existsSync(dir) && fs.statSync(dir).isDirectory())) {

{
"name": "vite-plugin-electron-renderer",
"version": "0.1.0",
"version": "0.1.1",
"description": "Use Electron and NodeJs API in Renderer-process",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc