Socket
Socket
Sign inDemoInstall

copy-webpack-plugin

Package Overview
Dependencies
19
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

48

index.js

@@ -39,8 +39,2 @@ var _ = require('lodash');

// Determine if this is an absolute to
var absDest;
if (path.isAbsolute(relDest)) {
absDest = relDest;
}
var forceWrite = !!pattern.force;

@@ -56,4 +50,5 @@

if (absDest && toLooksLikeDirectory(pattern)) {
return fs.copyAsync(absSrc, absDest);
// Make the relative destination actually relative
if (path.isAbsolute(relDest)) {
relDest = path.relative(baseDir, relDest);
}

@@ -85,11 +80,2 @@

// If it's an absolute destination, write directly
if (absDest) {
var dest = absDest;
if (toLooksLikeDirectory(pattern)) {
dest = path.join(absDest, path.basename(absFileSrc));
}
return fs.copyAsync(absFileSrc, dest);
}
if (!stat && relFileDirname !== baseDir) {

@@ -107,2 +93,7 @@ if (path.isAbsolute(relFileSrc)) {

}
// Make the relative destination actually relative
if (path.isAbsolute(relFileDest)) {
relFileDest = path.relative(baseDir, relFileDest);
}

@@ -208,7 +199,20 @@ return writeFileToAssets({

function shouldIgnore(pathName, ignoreList) {
var matched = _.find(ignoreList, function(glob) {
return minimatch(pathName, glob, {
matchBase: true,
dot: true
});
var matched = _.find(ignoreList, function(g) {
// Default minimatch params
var params = {
matchBase: true
};
var glob;
if (_.isString(g)) {
glob = g;
} else if(_.isObject(g)){
glob = g.glob || '';
// Overwrite minimatch defaults
params = _.assign(params, _.omit(g, ['glob']));
} else {
glob = '';
}
return minimatch(pathName, glob, params);
});

@@ -215,0 +219,0 @@ if (matched) {

{
"name": "copy-webpack-plugin",
"version": "1.0.0",
"version": "1.1.0",
"description": "Copy files and directories in webpack",

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

@@ -90,3 +90,6 @@ ## Copy Webpack Plugin

// Doesn't copy any files with a txt extension
'*.txt'
'*.txt',
// Doesn't copy any file, even if they start with a dot
{ glob: '**/*', dot: true }
]

@@ -93,0 +96,0 @@ })

@@ -31,7 +31,2 @@ /* globals describe, it, afterEach, __dirname */

describe('apply function', function() {
afterEach(function() {
// Make sure the temp directory is removed
fs.removeSync(TEMP_DIR);
});

@@ -85,12 +80,2 @@ // Ideally we pass in patterns and confirm the resulting assets

}
if (opts.expectedFilesWritten) {
_.each(opts.expectedFilesWritten, function(file) {
var stat = fs.statSync(file);
expect(stat).to.exist;
if (stat) {
fs.unlinkSync(file);
}
});
}
});

@@ -245,2 +230,14 @@ }

it('can move a file to the root directory using an absolute to', function(done) {
runEmit({
patterns: [{
from: 'file.txt',
to: HELPER_DIR
}],
expectedAssetKeys: ['file.txt']
})
.then(done)
.catch(done);
});
it('can move a file to a new directory using an absolute to', function(done) {

@@ -252,4 +249,3 @@ runEmit({

}],
expectedAssetKeys: [],
expectedFilesWritten: [path.join(TEMP_DIR, 'file.txt')]
expectedAssetKeys: ['../tempdir/file.txt']
})

@@ -267,4 +263,3 @@ .then(done)

}],
expectedAssetKeys: [],
expectedFilesWritten: [absolutePath]
expectedAssetKeys: ['../tempdir/newfile.txt']
})

@@ -437,6 +432,5 @@ .then(done)

patterns: [{ from: 'directory', to: TEMP_DIR }],
expectedAssetKeys: [],
expectedFilesWritten: [
path.join(TEMP_DIR, 'directoryfile.txt'),
path.join(TEMP_DIR, 'nested/nestedfile.txt')
expectedAssetKeys: [
'../tempdir/directoryfile.txt',
'../tempdir/nested/nestedfile.txt'
]

@@ -588,3 +582,3 @@ })

it('ignores all files', function(done) {
it('ignores all files except those with dots', function(done) {
runEmit({

@@ -597,2 +591,16 @@ patterns: [{ from: '.' }],

},
expectedAssetKeys: ['.dotted_file']
})
.then(done)
.catch(done);
});
it('ignores all files even if they start with a dot', function(done) {
runEmit({
patterns: [{ from: '.' }],
options: {
ignore: [
{ glob: '**/*', dot: true }
]
},
expectedAssetKeys: []

@@ -599,0 +607,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