Socket
Socket
Sign inDemoInstall

vite-plugin-fast-external

Package Overview
Dependencies
0
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 1.4.1

index.d.ts

32

index.js
const fs = require('fs')
const path = require('path')
/**
* @typedef {Record<string, string | (() => string)>} Externals
* @typedef {{format: 'esm' | 'cjs'}} Options
*/
/**
*
* @param {Externals} externals
* @param {Options} options
* @returns {import('vite').Plugin}
*/
module.exports = function external(
/**
* @example
* export default defineConfig({
* plugins: [
* fastExternal({
* // use string
* vue: 'Vue',
* // custom external code by function
* '@scope/name': () => `const Lib = window.LibraryName; export default Lib;`,
* })
* ]
* })
*/
externals,
/**
* @example
* esm will generate code -> const vue = window['Vue']; export { vue as default };
* cjs will generate code -> const vue = window['Vue']; module.exports = vue;
* @default 'esm'
*/
options = {},

@@ -80,3 +50,3 @@ ) {

) {
// ensure {viteExternal} directory existed
// ensure .vite-plugin-fast-external directory existed
const externalDir = path.join(node_modules(root), directory)

@@ -83,0 +53,0 @@ fs.existsSync(externalDir) || fs.mkdirSync(externalDir)

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

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

@@ -24,3 +24,2 @@ # vite-plugin-fast-external

fastExternal({
// use string
// will generate code `const vue = window['Vue']; export { vue as default }`

@@ -43,7 +42,7 @@ vue: 'Vue',

* @default 'esm'
* esm will generate code - const vue = window['Vue']; export { vue as default }
* cjs will generate code - const vue = window['Vue']; module.exports = vue;
* esm will generate code -> const vue = window['Vue']; export { vue as default }
* cjs will generate code -> const vue = window['Vue']; module.exports = vue;
*/
format: 'esm' | 'cjs'
},
}
) => VitePlugin

@@ -54,3 +53,3 @@ ```

1. External-module will be generated code into `node_modules/.vite-plugin-fast-external/xxxx.js`
1. External-module will be generated code into `node_modules/.vite-plugin-fast-external/vue.js`
2. Append an external-module alias

@@ -57,0 +56,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc