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

filemanager-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filemanager-webpack-plugin - npm Package Compare versions

Comparing version 1.0.19 to 1.0.20

29

lib/index.js

@@ -295,2 +295,7 @@ 'use strict';

}, {
key: "replaceHash",
value: function replaceHash(filename) {
return filename.replace("[hash]", this.fileHash);
}
}, {
key: "parseFileOptions",

@@ -311,3 +316,6 @@ value: function parseFileOptions(options) {

var _loop = function _loop(key) {
var command = fileOptions[key];
var command = {
source: _this3.replaceHash(fileOptions[key].source),
destination: _this3.replaceHash(fileOptions[key].destination)
};

@@ -341,5 +349,5 @@ if (!command.source || !command.destination) {

/*
* If the supplied destination is a directory copy inside.
* If the supplied destination is a directory that does not exist yet create it & copy inside
*/
* If the supplied destination is a directory copy inside.
* If the supplied destination is a directory that does not exist yet create it & copy inside
*/

@@ -385,3 +393,6 @@ var pathInfo = path.parse(destination);

var _loop2 = function _loop2(key) {
var command = fileOptions[key];
var command = {
source: _this3.replaceHash(fileOptions[key].source),
destination: _this3.replaceHash(fileOptions[key].destination)
};

@@ -431,3 +442,3 @@ if (!command.source || !command.destination) {

var _loop3 = function _loop3(key) {
var path = fileOptions[key];
var path = _this3.replaceHash(fileOptions[key]);

@@ -465,3 +476,3 @@ commandOrder.push(function () {

var _loop4 = function _loop4(key) {
var path = fileOptions[key];
var path = _this3.replaceHash(fileOptions[key]);

@@ -506,3 +517,3 @@ if (_this3.options.verbose) {

compiler.plugin("compilation", function (comp) {
compiler.plugin("compilation", function (compliation) {
_this4.checkOptions("onStart");

@@ -512,4 +523,4 @@ });

compiler.plugin("after-emit", function (compliation, callback) {
_this4.fileHash = compliation.hash;
_this4.checkOptions("onEnd");
callback();

@@ -516,0 +527,0 @@ });

{
"name": "filemanager-webpack-plugin",
"version": "1.0.19",
"version": "1.0.20",
"description": "This Webpack plugin allows you to copy, move, delete files and directories before and after builds",

@@ -21,3 +21,3 @@ "main": "lib/index.js",

"author": "gregnb",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -24,0 +24,0 @@ "url": "https://github.com/gregnb/filemanager-webpack-plugin/issues"

@@ -37,3 +37,4 @@

{ source: '/path/**/*.{html,js}', destination: '/path/to' },
{ source: '/path/{file1,file2}.js', destination: '/path/to' }
{ source: '/path/{file1,file2}.js', destination: '/path/to' },
{ source: '/path/file-[hash].js', destination: '/path/to' }
],

@@ -105,5 +106,5 @@ move: [

|:--:|:----------|:-----|
|**`copy`**|Copy individual files or entire directories from a source folder to a destination folder. Also supports glob pattern |copy: [<br /> { source: 'dist/bundle.js', destination: '/home/web/js/'<br /> }
|**`copy`**|Copy individual files or entire directories from a source folder to a destination folder. Also supports glob pattern |copy: [<br /> { source: 'dist/bundle.js', destination: '/home/web/js/'<br /> }<br />]
|**`delete`**|Delete individual files or entire directories. |delete: [<br />'file.txt', '/path/to'<br />]
|**`move`**|Move individual files or entire directories. |move: <br /> { source: 'dist/bundle.js', destination: '/home/web/js/'<br /> }
|**`move`**|Move individual files or entire directories. |move: [<br /> { source: 'dist/bundle.js', destination: '/home/web/js/'<br /> }<br />]
|**`mkdir`**|Create a directory path. Think mkdir -p |mkdir: [ <br />'/path/to/directory/', '/another/path/' <br/> ]

@@ -78,2 +78,6 @@ const cpx = require("cpx");

replaceHash(filename) {
return filename.replace("[hash]", this.fileHash);
}
parseFileOptions(options, preserveOrder = false) {

@@ -91,3 +95,6 @@ const optKeys = Object.keys(options);

for (let key in fileOptions) {
const command = fileOptions[key];
const command = {
source: this.replaceHash(fileOptions[key].source),
destination: this.replaceHash(fileOptions[key].destination),
};

@@ -166,3 +173,6 @@ if (!command.source || !command.destination) {

for (let key in fileOptions) {
const command = fileOptions[key];
const command = {
source: this.replaceHash(fileOptions[key].source),
destination: this.replaceHash(fileOptions[key].destination),
};

@@ -215,3 +225,3 @@ if (!command.source || !command.destination) {

for (let key in fileOptions) {
const path = fileOptions[key];
const path = this.replaceHash(fileOptions[key]);

@@ -248,3 +258,3 @@ commandOrder.push(

for (let key in fileOptions) {
const path = fileOptions[key];
const path = this.replaceHash(fileOptions[key]);

@@ -278,3 +288,3 @@ if (this.options.verbose) {

apply(compiler) {
compiler.plugin("compilation", comp => {
compiler.plugin("compilation", compliation => {
this.checkOptions("onStart");

@@ -284,4 +294,4 @@ });

compiler.plugin("after-emit", (compliation, callback) => {
this.fileHash = compliation.hash;
this.checkOptions("onEnd");
callback();

@@ -288,0 +298,0 @@ });

@@ -74,2 +74,8 @@ import fs from 'fs';

test.serial('should successfully copy a [hash] file name to destination when { source: "/sourceFile-[hash].js", destination: "/destFolder" } provided', t => {
const result = fs.existsSync("./testing/hashed-bundle.js");
t.true(result);
t.pass();
});

@@ -6,3 +6,3 @@ const path = require('path');

module.exports = {
const plainConfig = {
entry: path.resolve(__dirname, 'example/index.js'),

@@ -51,1 +51,30 @@ stats: "verbose",

};
const hashConfig = {
entry: path.resolve(__dirname, 'example/index.js'),
stats: "verbose",
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle-[hash].js'
},
module: {
loaders: [
{ test: /\.css$/, loader: 'style!css' }
]
},
plugins: [
new FileManagerPlugin({
onEnd: {
copy: [
{ source: "./dist/bundle-[hash].js", destination: "./testing/hashed-bundle.js" }
],
}
})
]
};
module.exports = [
plainConfig,
hashConfig
];

Sorry, the diff of this file is not supported yet

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