Socket
Socket
Sign inDemoInstall

vite-plugin-utils

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-utils - npm Package Compare versions

Comparing version 0.3.7 to 0.4.0

test/function.js

21

function/index.js

@@ -119,11 +119,16 @@ import fs from 'node:fs';

};
export function node_modules(root, count = 0) {
const p = path.join(root, 'node_modules');
if (fs.existsSync(p)) {
return p;
const VOLUME_RE = /^[A-Z]:/i;
export function node_modules(root, paths = []) {
if (!root)
return paths;
if (!(root.startsWith('/') || VOLUME_RE.test(root)))
return paths;
const p = path.posix.join(normalizePath(root), 'node_modules');
if (fs.existsSync(p) && fs.statSync(p).isDirectory()) {
paths = paths.concat(p);
}
if (count >= 19) {
throw new Error(`Can not found node_modules directory.\n with: ${root}`);
}
return node_modules(path.join(root, '..'), count + 1);
root = path.posix.join(root, '..');
return (root === '/' || /^[A-Z]:$/i.test(root))
? paths
: node_modules(root, paths);
}

@@ -142,11 +142,16 @@ import fs from 'node:fs'

export function node_modules(root: string, count = 0): string {
const p = path.join(root, 'node_modules')
if (fs.existsSync(p)) {
return p
const VOLUME_RE = /^[A-Z]:/i
export function node_modules(root: string, paths: string[] = []): string[] {
if (!root) return paths
if (!(root.startsWith('/') || VOLUME_RE.test(root))) return paths
const p = path.posix.join(normalizePath(root), 'node_modules')
if (fs.existsSync(p) && fs.statSync(p).isDirectory()) {
paths = paths.concat(p)
}
if (count >= 19) {
throw new Error(`Can not found node_modules directory.\n with: ${root}`)
}
return node_modules(path.join(root, '..'), count + 1)
root = path.posix.join(root, '..')
return (root === '/' || /^[A-Z]:$/i.test(root))
? paths
: node_modules(root, paths)
}
{
"name": "vite-plugin-utils",
"description": "A collection of opinionated Vite plugin utils",
"version": "0.3.7",
"version": "0.4.0",
"type": "module",

@@ -6,0 +6,0 @@ "main": "",

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