@rbarilani/remove-source-map-url-webpack-plugin
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "@rbarilani/remove-source-map-url-webpack-plugin", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Remove source map url comments webpack plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Remove Source Map Url Webpack Plugin | ||
==================================== | ||
![npm](https://img.shields.io/npm/dw/@rbarilani/remove-source-map-url-webpack-plugin) | ||
![npm latest version](https://img.shields.io/npm/v/@rbarilani/remove-source-map-url-webpack-plugin) | ||
![npm downloads](https://img.shields.io/npm/dm/@rbarilani/remove-source-map-url-webpack-plugin?style=plastic) | ||
[![dependencies Status](https://david-dm.org/rbarilani/remove-source-map-url-webpack-plugin/status.svg)](https://david-dm.org/rbarilani/remove-source-map-url-webpack-plugin) | ||
@@ -52,8 +53,8 @@ [![devDependencies Status](https://david-dm.org/rbarilani/remove-source-map-url-webpack-plugin/dev-status.svg)](https://david-dm.org/rbarilani/remove-source-map-url-webpack-plugin?type=dev) | ||
## Configuration | ||
## Options | ||
* `test`: A condition that must be met to include or exclude the assets that should be processed (*default*: `/\.js($|\?)/i`). The allowed types for a condition are: | ||
* `String` - A string for exact matching with the asset key | ||
* `RegExp` - A regular expression which will be tested against the asset key | ||
* `Function(key:string):bool` - A function that will be invoked with the asset key as the argument and must return `true` to include the asset or `false` to exclude it | ||
* `String` - A string for exact matching with the file name of the asset | ||
* `RegExp` - A regular expression which will be tested against the file name of the asset | ||
* `Function(fileName:string):bool` - A function that will be invoked with the file name of the asset as the argument and must return `true` to include the asset or `false` to exclude it | ||
@@ -60,0 +61,0 @@ |
@@ -20,5 +20,5 @@ const { sources, Compilation } = require("webpack"); | ||
const count = this.processAssets(assets).reduce( | ||
(acc, { file, source }) => { | ||
(acc, { filename, source }) => { | ||
// update asset for the current compilation | ||
compilation.updateAsset(file, source); | ||
compilation.updateAsset(filename, source); | ||
return acc + 1; | ||
@@ -42,5 +42,5 @@ }, | ||
return Object.keys(assets) | ||
.filter((file) => this.testFile(file)) | ||
.map((file) => { | ||
const asset = assets[file]; | ||
.filter((filename) => this.testFileName(filename)) | ||
.map((filename) => { | ||
const asset = assets[filename]; | ||
const source = asset | ||
@@ -51,3 +51,3 @@ .source() | ||
return { | ||
file, | ||
filename, | ||
source: new sources.RawSource(source), | ||
@@ -58,13 +58,13 @@ }; | ||
testFile(file) { | ||
testFileName(filename) { | ||
if (this.options.test instanceof RegExp) { | ||
return this.options.test.test(file); | ||
return this.options.test.test(filename); | ||
} | ||
if (typeof this.options.test === "string") { | ||
return this.options.test === file; | ||
return this.options.test === filename; | ||
} | ||
if (typeof this.options.test === "function") { | ||
return this.options.test(file); | ||
return this.options.test(filename); | ||
} | ||
@@ -71,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7922
82