Socket
Socket
Sign inDemoInstall

vite-plugin-electron-renderer

Package Overview
Dependencies
Maintainers
2
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.5.4 to 0.5.5

6

CHANGELOG.md
## [2022-07-11] v0.5.5
- 7f5117b chore: types
- 17eab4d fix(🐞): build Electron-Renderer
- f5ea26c remove `plugins/use-node.js/electron-renderer.js`
## [2022-07-10] v0.5.4

@@ -3,0 +9,0 @@

2

package.json
{
"name": "vite-plugin-electron-renderer",
"version": "0.5.4",
"version": "0.5.5",
"description": "Support use Node.js API in Electron-Renderer",

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

@@ -1,2 +0,2 @@

import { Plugin, ResolvedConfig } from 'vite';
import { Plugin, UserConfig } from 'vite';

@@ -23,3 +23,3 @@ declare const useNodeJs: UseNodeJs;

export interface ResolveModules {
(config: ResolvedConfig, options?: Options): {
(config: UserConfig, options?: Options): {
/** Node.js builtin modules */

@@ -26,0 +26,0 @@ builtins: string[];

const fs = require('fs');
const path = require('path');
const { builtinModules } = require('module');
const { normalizePath } = require('vite');

@@ -61,2 +62,8 @@ /**

const resolved = resolveModules(config, options);
builtins.push(...resolved.builtins);
dependencies.push(...resolved.dependencies);
ESM_deps.push(...resolved.ESM_deps);
CJS_modules.push(...builtins.concat(dependencies));
if (env.command === 'serve') {

@@ -116,10 +123,2 @@ if (!config.resolve) config.resolve = {};

},
configResolved(config) {
const resolved = resolveModules(config, options);
builtins.push(...resolved.builtins);
dependencies.push(...resolved.dependencies);
ESM_deps.push(...resolved.ESM_deps);
CJS_modules.push(...builtins.concat(dependencies));
},
resolveId(source) {

@@ -193,4 +192,5 @@ if (env.command === 'serve') {

function resolveModules(config, options = {}) {
const root = config.root;
const cwd = process.cwd();
// https://github.com/vitejs/vite/blob/53799e1cced7957f9877a5b5c9b6351b48e216a7/packages/vite/src/node/config.ts#L439-L442
const root = normalizePath(config.root ? path.resolve(config.root) : cwd)
const builtins = builtinModules.filter(e => !e.startsWith('_')); builtins.push('electron', ...builtins.map(m => `node:${m}`));

@@ -236,2 +236,5 @@ // dependencies of package.json

/**
* @type {(filename: string, paths: string[]) => string | undefined}
*/
function lookupFile(filename, paths) {

@@ -238,0 +241,0 @@ for (const p of paths) {

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