Socket
Socket
Sign inDemoInstall

vite-plugin-fast-external

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-fast-external - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

35

index.js

@@ -34,5 +34,8 @@ const fs = require('fs')

function node_modules(root, count = 0) {
if (node_modules.p) {
return node_modules.p
}
const p = path.join(root, 'node_modules')
if (fs.existsSync(p)) {
return p
return node_modules.p = p
}

@@ -57,20 +60,16 @@ if (count >= 19) {

for (const [module, strOrFn] of Object.entries(externals)) {
const modFilename = path.join(node_modules(root), directory, `${module}.js`)
if (!fs.existsSync(modFilename)) {
// for '@scope/name' package
ensureDir(path.parse(modFilename).dir)
const moduleId = path.join(node_modules(root), directory, `${module}.js`)
let moduleContent
if (typeof strOrFn === 'string') {
const iifeName = strOrFn
moduleContent = format === 'cjs'
? `const ${iifeName} = window['${iifeName}']; module.exports = ${iifeName};`
: `const ${iifeName} = window['${iifeName}']; export { ${iifeName} as default }`
} else {
moduleContent = strOrFn()
}
let moduleContent
if (typeof strOrFn === 'string') {
const iifeName = strOrFn
moduleContent = format === 'cjs'
? `const ${iifeName} = window['${iifeName}']; module.exports = ${iifeName};`
: `const ${iifeName} = window['${iifeName}']; export { ${iifeName} as default }`
} else {
moduleContent = strOrFn()
}
fs.writeFileSync(modFilename, moduleContent)
}
// for '@scope/name' package
ensureDir(path.parse(moduleId).dir)
fs.writeFileSync(moduleId, moduleContent)
}

@@ -77,0 +76,0 @@ }

{
"name": "vite-plugin-fast-external",
"version": "1.4.1",
"version": "1.4.2",
"description": "An tiny and fast external plugin for vite.",

@@ -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