Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-img

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-img - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

9

dist/index.cjs.js

@@ -16,3 +16,4 @@ 'use strict';

function img(opt) {
!opt && (opt = {});
if ( opt === void 0 ) opt = {};
var extensions = opt.extensions || /\.(png|jpg|jpeg|gif|svg)$/;

@@ -32,3 +33,3 @@ var filter = rollupPluginutils.createFilter(opt.include, opt.exclude);

} else { //copy file to distPath
var output = opt.output || '';
var output = path.relative('./', opt.output) || '';
if (!fs.existsSync(output)) {

@@ -43,4 +44,6 @@ var dirs = output.split('/');

var outputFile = output + "/" + (path.basename(id));
var baseIndex = outputFile.indexOf('/');
baseIndex = baseIndex !== -1 ? baseIndex + 1 : 0;
fs.createReadStream(id).pipe(fs.createWriteStream(outputFile));
return ("export default \"" + outputFile + "\"");
return ("export default \"" + (outputFile.slice(baseIndex)) + "\"");
}

@@ -47,0 +50,0 @@ }

import { createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, statSync } from 'fs';
import { basename, extname } from 'path';
import { basename, extname, relative } from 'path';
import { createFilter } from 'rollup-pluginutils';

@@ -14,3 +14,4 @@

function img(opt) {
!opt && (opt = {});
if ( opt === void 0 ) opt = {};
var extensions = opt.extensions || /\.(png|jpg|jpeg|gif|svg)$/;

@@ -30,3 +31,3 @@ var filter = createFilter(opt.include, opt.exclude);

} else { //copy file to distPath
var output = opt.output || '';
var output = relative('./', opt.output) || '';
if (!existsSync(output)) {

@@ -41,4 +42,6 @@ var dirs = output.split('/');

var outputFile = output + "/" + (basename(id));
var baseIndex = outputFile.indexOf('/');
baseIndex = baseIndex !== -1 ? baseIndex + 1 : 0;
createReadStream(id).pipe(createWriteStream(outputFile));
return ("export default \"" + outputFile + "\"");
return ("export default \"" + (outputFile.slice(baseIndex)) + "\"");
}

@@ -45,0 +48,0 @@ }

{
"name": "rollup-plugin-img",
"version": "1.0.4",
"version": "1.0.5",
"description": "import image files with rollup",

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

import { statSync, readFileSync, createReadStream, createWriteStream, existsSync, mkdirSync } from 'fs';
import { extname, basename } from 'path';
import { extname, basename, relative } from 'path';
import { createFilter } from 'rollup-pluginutils';

@@ -13,4 +13,3 @@

function img(opt) {
!opt && (opt = {});
function img(opt = {}) {
const extensions = opt.extensions || /\.(png|jpg|jpeg|gif|svg)$/;

@@ -30,3 +29,3 @@ const filter = createFilter(opt.include, opt.exclude);

} else { //copy file to distPath
const output = opt.output || '';
const output = relative('./', opt.output) || '';
if (!existsSync(output)) {

@@ -40,5 +39,7 @@ const dirs = output.split('/');

}
var outputFile = `${output}/${basename(id)}`;
const outputFile = `${output}/${basename(id)}`;
let baseIndex = outputFile.indexOf('/');
baseIndex = baseIndex !== -1 ? baseIndex + 1 : 0;
createReadStream(id).pipe(createWriteStream(outputFile));
return `export default "${outputFile}"`;
return `export default "${outputFile.slice(baseIndex)}"`;
}

@@ -45,0 +46,0 @@ }

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