Socket
Socket
Sign inDemoInstall

assets-webpack-plugin

Package Overview
Dependencies
Maintainers
2
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 3.9.4 to 3.9.5

4

changelog.md

@@ -11,2 +11,6 @@ # Change Log

## 3.9.5 - 2018-08-09
-- Adds the `keepInMemory` option to toggle whether you want the assets file generated when running in `webpack-dev-server`.
## 3.9.4 - 2018-08-08

@@ -13,0 +17,0 @@

3

dist/index.js

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

fileTypes: ['js', 'css'],
includeAllFileTypes: true
includeAllFileTypes: true,
keepInMemory: false
}, options);

@@ -28,0 +29,0 @@ this.writer = createQueuedWriter(createOutputWriter(this.options));

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

var mkdirp = require('mkdirp');
var path = require('path');
var fs = require('fs');
var merge = require('lodash.merge');

@@ -36,7 +39,8 @@

return function writeOutput(fs, newAssets, next) {
return function writeOutput(fileStream, newAssets, next) {
// if options.update is false and we're on the first pass of a (possibly) multicompiler
var overwrite = !update && firstRun;
var localFs = options.keepInMemory ? fileStream : fs;
fs.mkdirp(options.path, function (err) {
function mkdirpCallback(err) {
if (err) {

@@ -46,5 +50,5 @@ return next(error('Could not create output folder ' + options.path, err));

var outputPath = fs.join(options.path, options.filename);
var outputPath = options.keepInMemory ? localFs.join(options.path, options.filename) : path.join(options.path, options.filename);
fs.readFile(outputPath, 'utf8', function (err, data) {
localFs.readFile(outputPath, 'utf8', function (err, data) {
// if file does not exist, just write data to it

@@ -68,3 +72,3 @@ if (err && err.code !== 'ENOENT') {

if (output !== data) {
fs.writeFile(outputPath, output, function (err) {
localFs.writeFile(outputPath, output, function (err) {
if (err) {

@@ -80,4 +84,6 @@ return next(error('Unable to write to ' + outputPath, err));

});
});
}
options.keepInMemory ? localFs.mkdirp(options.path, mkdirpCallback) : mkdirp(options.path, mkdirpCallback);
};
};

@@ -21,3 +21,4 @@ var fs = require('fs')

fileTypes: ['js', 'css'],
includeAllFileTypes: true
includeAllFileTypes: true,
keepInMemory: false
}, options)

@@ -24,0 +25,0 @@ this.writer = createQueuedWriter(createOutputWriter(this.options))

{
"name": "assets-webpack-plugin",
"version": "3.9.4",
"version": "3.9.5",
"description": "Emits a json file with assets paths",

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

@@ -249,5 +249,15 @@ # assets-webpack-plugin

```js
new AssetsPlugin({fileTypes: ['js', 'jpg']]})
new AssetsPlugin({fileTypes: ['js', 'jpg']})
```
#### `keepInMemory`
Optional. `false` by default.
When set the assets file will only be generated in memory while running `webpack-dev-server` and not written to disk.
```js
new AssetsPlugin({keepInMemory: true})
```
### Using in multi-compiler mode

@@ -254,0 +264,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