Socket
Socket
Sign inDemoInstall

assets-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assets-webpack-plugin - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

20

index.js
var fs = require('fs');
var path = require('path');
var assets = {};
function extend(target, source) {
for(var k in source){
target[k] = source[k];
}
return target;
}
function Plugin(options) {

@@ -25,3 +34,3 @@ this.options = options || {};

var outputFull = path.join(outputDir, outputFilename);
self.writeOutput(compiler, hashes, outputFull);
self.writeOutput(compiler, self.options.multiCompiler ? extend(assets,hashes) : hashes, outputFull);
callback();

@@ -85,6 +94,10 @@ });

.replace('[query]', '')
.replace('[hash]', '')
.replace('.', '');
.replace('[hash]', '');
// mapSegment e.g. ".map"
var mapRegex = new RegExp(mapSegment);
// value e.g.
// desktop.js.map
// desktop.js.map?9b913c8594ce98e06b21
function isSourceMap(value) {

@@ -107,3 +120,2 @@ return mapRegex.test(value);

// e.g. [ 'styles-bundle.js', 'styles-bundle.css' ]
return stringOrArray

@@ -110,0 +122,0 @@ .filter(isAsset)

2

package.json
{
"name": "assets-webpack-plugin",
"version": "0.3.0",
"version": "0.3.1",
"description": "Emits a json file with assets paths",

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

@@ -29,3 +29,5 @@ var path = require('path');

} else {
expect(content).toContain(expectedResult);
var json = JSON.parse(content);
var expectedJson = JSON.parse(expectedResult);
expect(json).toEqual(expectedJson);
}

@@ -106,2 +108,37 @@ }

it('generates a default file with multiple compilers', function(done) {
var webpackConfig = [
{
entry: {
one: path.join(__dirname, 'fixtures/one.js')
},
output: {
path: OUTPUT_DIR,
filename: 'one-bundle.js'
},
plugins: [new Plugin({
multiCompiler: true,
path: 'dist'
})]
},
{
entry: {
two: path.join(__dirname, 'fixtures/two.js')
},
output: {
path: OUTPUT_DIR,
filename: 'two-bundle.js'
},
plugins: [new Plugin({
multiCompiler: true,
path: 'dist'
})]
}
];
var expected = ['{"one":"one-bundle.js","two":"two-bundle.js"}'];
testPlugin(webpackConfig, expected, null, done);
});
it('allows you to specify your own filename', function(done) {

@@ -108,0 +145,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