Socket
Socket
Sign inDemoInstall

vite-plugin-externals

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-externals - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/es/index.d.ts
import type { Plugin } from 'vite';
import { Externals, Options } from './types';
export declare function viteExternalsPlugin(external?: Externals, userOptions?: Options): Plugin;
export declare function viteExternalsPlugin(externals?: Externals, userOptions?: Options): Plugin;

@@ -6,7 +6,7 @@ import MagicString from 'magic-string';

const NODE_MODULES_FLAG = 'node_modules';
export function viteExternalsPlugin(external = {}, userOptions = {}) {
export function viteExternalsPlugin(externals = {}, userOptions = {}) {
const { useWindow = true } = userOptions;
const windowContext = useWindow ? 'window.' : '';
return {
name: 'vite-plugin-external',
name: 'vite-plugin-externals',
async transform(code, id, ssr) {

@@ -20,2 +20,3 @@ if (!isNeedExternal.call(this, userOptions, code, id, ssr)) {

imports.forEach(({ d: dynamic, n: dependence, ss: statementStart, se: statementEnd, }) => {
var _a;
if (dynamic !== -1) {

@@ -27,3 +28,3 @@ return;

}
const externalValue = external[dependence];
const externalValue = externals[dependence];
if (!externalValue) {

@@ -38,3 +39,3 @@ return;

});
const specifiers = ast.body[0]?.specifiers;
const specifiers = (_a = ast.body[0]) === null || _a === void 0 ? void 0 : _a.specifiers;
if (!specifiers) {

@@ -41,0 +42,0 @@ return;

import type { Plugin } from 'vite';
import { Externals, Options } from './types';
export declare function viteExternalsPlugin(external?: Externals, userOptions?: Options): Plugin;
export declare function viteExternalsPlugin(externals?: Externals, userOptions?: Options): Plugin;

@@ -9,7 +9,7 @@ "use strict";

const NODE_MODULES_FLAG = 'node_modules';
function viteExternalsPlugin(external = {}, userOptions = {}) {
function viteExternalsPlugin(externals = {}, userOptions = {}) {
const { useWindow = true } = userOptions;
const windowContext = useWindow ? 'window.' : '';
return {
name: 'vite-plugin-external',
name: 'vite-plugin-externals',
async transform(code, id, ssr) {

@@ -23,2 +23,3 @@ if (!isNeedExternal.call(this, userOptions, code, id, ssr)) {

imports.forEach(({ d: dynamic, n: dependence, ss: statementStart, se: statementEnd, }) => {
var _a;
if (dynamic !== -1) {

@@ -30,3 +31,3 @@ return;

}
const externalValue = external[dependence];
const externalValue = externals[dependence];
if (!externalValue) {

@@ -41,3 +42,3 @@ return;

});
const specifiers = ast.body[0]?.specifiers;
const specifiers = (_a = ast.body[0]) === null || _a === void 0 ? void 0 : _a.specifiers;
if (!specifiers) {

@@ -44,0 +45,0 @@ return;

{
"name": "vite-plugin-externals",
"version": "0.1.0",
"version": "0.1.1",
"description": "externals plugin for vite",

@@ -5,0 +5,0 @@ "author": "crcong",

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