assets-webpack-plugin
Advanced tools
Comparing version 3.8.4 to 3.9.0
@@ -11,4 +11,14 @@ # Change Log | ||
## Unreleased | ||
## 3.9.0 - 2018-08-06 | ||
- Now supports webpack 4 entries with multiple chunks. See [#109](https://github.com/ztoben/assets-webpack-plugin/pull/109) for details. | ||
- Use compiler.outputFileSystem for output. | ||
- Fixes [#108](https://github.com/ztoben/assets-webpack-plugin/issues/108), [#111](https://github.com/ztoben/assets-webpack-plugin/issues/111), and [#92](https://github.com/ztoben/assets-webpack-plugin/issues/92). | ||
## 3.8.4 - 2018-06-20 | ||
### Changed | ||
- No code changed. Purely for testing tagged releases on git. | ||
## 3.8.3 - 2018-06-18 | ||
@@ -30,3 +40,3 @@ | ||
- Support for listing the manifest entry first when `manifestFirst` option is set. See [#66](https://github.com/kossnocorp/assets-webpack-plugin/issues/66) for details. | ||
- Support for listing the manifest entry first when `manifestFirst` option is set. See [#66](https://github.com/ztoben/assets-webpack-plugin/issues/66) for details. | ||
@@ -37,3 +47,3 @@ ## 3.8.0 - 2018-06-15 | ||
- Reverts [#90](https://github.com/kossnocorp/assets-webpack-plugin/pull/90), fixes [93](https://github.com/kossnocorp/assets-webpack-plugin/issues/93) and [92](https://github.com/kossnocorp/assets-webpack-plugin/issues/92) | ||
- Reverts [#90](https://github.com/ztoben/assets-webpack-plugin/pull/90), fixes [#93](https://github.com/ztoben/assets-webpack-plugin/issues/93) and [#92](https://github.com/ztoben/assets-webpack-plugin/issues/92) | ||
@@ -44,3 +54,3 @@ ## 3.7.2 - 2018-06-14 | ||
- Reduces npm package size [#67](https://github.com/kossnocorp/assets-webpack-plugin/issues/67) | ||
- Reduces npm package size [#67](https://github.com/ztoben/assets-webpack-plugin/issues/67) | ||
@@ -51,3 +61,3 @@ ## 3.7.1 - 2018-06-13 | ||
- Fixes a parsing error with the asset path introduced by the fix for [#88](https://github.com/kossnocorp/assets-webpack-plugin/issues/88) | ||
- Fixes a parsing error with the asset path introduced by the fix for [#88](https://github.com/ztoben/assets-webpack-plugin/issues/88) | ||
@@ -58,3 +68,3 @@ ## 3.7.0 - 2018-06-13 | ||
- Adds all assets to the manifest that aren't in a chunk (kudos to [@Kronuz](https://github.com/Kronuz) see [#65](https://github.com/kossnocorp/assets-webpack-plugin/pull/65)) | ||
- Adds all assets to the manifest that aren't in a chunk (kudos to [@Kronuz](https://github.com/Kronuz) see [#65](https://github.com/ztoben/assets-webpack-plugin/pull/65)) | ||
@@ -65,3 +75,3 @@ ## 3.6.3 - 2018-06-13 | ||
- Add support for multiple files of the same extension (kudos to [@aaronatmycujoo](https://github.com/aaronatmycujoo) see [#79](https://github.com/kossnocorp/assets-webpack-plugin/pull/79) and [@Kronuz](https://github.com/Kronuz) see [#64](https://github.com/kossnocorp/assets-webpack-plugin/pull/64)) | ||
- Add support for multiple files of the same extension (kudos to [@aaronatmycujoo](https://github.com/aaronatmycujoo) see [#79](https://github.com/ztoben/assets-webpack-plugin/pull/79) and [@Kronuz](https://github.com/Kronuz) see [#64](https://github.com/ztoben/assets-webpack-plugin/pull/64)) | ||
@@ -72,3 +82,3 @@ ## 3.6.2 - 2018-06-13 | ||
- Fixed incorrect concatination of asset file names and directory path see [#88](https://github.com/kossnocorp/assets-webpack-plugin/issues/88) | ||
- Fixed incorrect concatination of asset file names and directory path see [#88](https://github.com/ztoben/assets-webpack-plugin/issues/88) | ||
@@ -79,3 +89,3 @@ ## 3.6.1 - 2018-06-13 | ||
- webpack-dev-server (which uses memory-fs) correctly generates the manifest inside the memory file system (kudos to [@Kronuz](https://github.com/Kronuz) see [#90](https://github.com/kossnocorp/assets-webpack-plugin/pull/90)) | ||
- webpack-dev-server (which uses memory-fs) correctly generates the manifest inside the memory file system (kudos to [@Kronuz](https://github.com/Kronuz) see [#90](https://github.com/ztoben/assets-webpack-plugin/pull/90)) | ||
@@ -86,3 +96,3 @@ ## 3.6.0 - 2018-05-29 | ||
- webpack 4 support (kudos to [@ztoben](https://github.com/ztoben) and [@saveman71](https://github.com/saveman71) see [#89](https://github.com/kossnocorp/assets-webpack-plugin/pull/89)) | ||
- webpack 4 support (kudos to [@ztoben](https://github.com/ztoben) and [@saveman71](https://github.com/saveman71) see [#89](https://github.com/ztoben/assets-webpack-plugin/pull/89)) | ||
@@ -89,0 +99,0 @@ ## 3.5.1 - 2017-01-20 |
@@ -5,2 +5,4 @@ 'use strict'; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var merge = require('lodash.merge'); | ||
@@ -17,3 +19,2 @@ | ||
this.options = merge({}, { | ||
path: '.', | ||
filename: 'webpack-assets.json', | ||
@@ -34,2 +35,4 @@ prettyPrint: false, | ||
self.options.path = path.resolve(self.options.path || compiler.options.output.path || '.'); | ||
var afterEmit = function afterEmit(compilation, callback) { | ||
@@ -50,17 +53,9 @@ var options = compiler.options; | ||
var assetPath = stats.publicPath && self.options.fullPath ? stats.publicPath : ''; | ||
// assetsByChunkName contains a hash with the bundle names and the produced files | ||
// e.g. { one: 'one-bundle.js', two: 'two-bundle.js' } | ||
// in some cases (when using a plugin or source maps) it might contain an array of produced files | ||
// e.g. { | ||
// main: | ||
// [ 'index-bundle-42b6e1ec4fa8c5f0303e.js', | ||
// 'index-bundle-42b6e1ec4fa8c5f0303e.js.map' ] | ||
// } | ||
var assetsByChunkName = stats.assetsByChunkName; | ||
var entries = stats.entrypoints || stats.assetsByChunkName; | ||
var seenAssets = {}; | ||
var chunks = Object.keys(assetsByChunkName); | ||
var chunks = Object.keys(entries); | ||
chunks.push(''); // push "unamed" chunk | ||
var output = chunks.reduce(function (chunkMap, chunkName) { | ||
var assets = chunkName ? assetsByChunkName[chunkName] : stats.assets; | ||
var assets = chunkName ? entries[chunkName].assets || entries[chunkName] : stats.assets; | ||
if (!Array.isArray(assets)) { | ||
@@ -122,3 +117,8 @@ assets = [assets]; | ||
self.writer(output, function (err) { | ||
if (!compiler.outputFileSystem.readFile) { | ||
compiler.outputFileSystem.readFile = fs.readFile.bind(fs); | ||
compiler.outputFileSystem.join = path.join.bind(path); | ||
} | ||
self.writer(compiler.outputFileSystem, output, function (err) { | ||
if (err) { | ||
@@ -125,0 +125,0 @@ compilation.errors.push(err); |
@@ -7,5 +7,2 @@ 'use strict'; | ||
var mkdirp = require('mkdirp'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var merge = require('lodash.merge'); | ||
@@ -32,3 +29,2 @@ | ||
module.exports = function (options) { | ||
var outputPath = path.join(options.path, options.filename); | ||
var update = options.update; | ||
@@ -41,10 +37,13 @@ var firstRun = true; | ||
return function writeOutput(newAssets, next) { | ||
// if potions.update is false and we're on the first pass of a (possibly) multicompiler | ||
return function writeOutput(fs, newAssets, next) { | ||
// if options.update is false and we're on the first pass of a (possibly) multicompiler | ||
var overwrite = !update && firstRun; | ||
mkdirp(options.path, function (err) { | ||
fs.mkdirp(options.path, function (err) { | ||
if (err) { | ||
return next(error('Could not create output folder ' + options.path, err)); | ||
} | ||
var outputPath = fs.join(options.path, options.filename); | ||
fs.readFile(outputPath, 'utf8', function (err, data) { | ||
@@ -51,0 +50,0 @@ // if file does not exist, just write data to it |
@@ -20,3 +20,3 @@ "use strict"; | ||
if (next) { | ||
processor(next.data, iterator(next.callback)); | ||
processor(next.fs, next.data, iterator(next.callback)); | ||
} | ||
@@ -26,11 +26,11 @@ }; | ||
return function queuedWriter(data, callback) { | ||
return function queuedWriter(fs, data, callback) { | ||
var empty = !queue.length; | ||
queue.push({ data: data, callback: callback }); | ||
queue.push({ fs: fs, data: data, callback: callback }); | ||
if (empty) { | ||
// start processing | ||
processor(data, iterator(callback)); | ||
processor(fs, data, iterator(callback)); | ||
} | ||
}; | ||
}; |
@@ -0,0 +0,0 @@ 'use strict'; |
33
index.js
@@ -0,1 +1,3 @@ | ||
var fs = require('fs') | ||
var path = require('path') | ||
var merge = require('lodash.merge') | ||
@@ -12,3 +14,2 @@ | ||
this.options = merge({}, { | ||
path: '.', | ||
filename: 'webpack-assets.json', | ||
@@ -29,2 +30,4 @@ prettyPrint: false, | ||
self.options.path = path.resolve(self.options.path || compiler.options.output.path || '.') | ||
var afterEmit = (compilation, callback) => { | ||
@@ -44,18 +47,13 @@ var options = compiler.options | ||
var assetPath = (stats.publicPath && self.options.fullPath) ? stats.publicPath : '' | ||
// assetsByChunkName contains a hash with the bundle names and the produced files | ||
// e.g. { one: 'one-bundle.js', two: 'two-bundle.js' } | ||
// in some cases (when using a plugin or source maps) it might contain an array of produced files | ||
// e.g. { | ||
// main: | ||
// [ 'index-bundle-42b6e1ec4fa8c5f0303e.js', | ||
// 'index-bundle-42b6e1ec4fa8c5f0303e.js.map' ] | ||
// } | ||
var assetsByChunkName = stats.assetsByChunkName | ||
var assetPath = | ||
stats.publicPath && self.options.fullPath ? stats.publicPath : '' | ||
var entries = stats.entrypoints || stats.assetsByChunkName | ||
var seenAssets = {} | ||
var chunks = Object.keys(assetsByChunkName) | ||
chunks.push('')// push "unamed" chunk | ||
var chunks = Object.keys(entries) | ||
chunks.push('') // push "unamed" chunk | ||
var output = chunks.reduce(function (chunkMap, chunkName) { | ||
var assets = chunkName ? assetsByChunkName[chunkName] : stats.assets | ||
var assets = chunkName | ||
? entries[chunkName].assets || entries[chunkName] | ||
: stats.assets | ||
if (!Array.isArray(assets)) { | ||
@@ -117,3 +115,8 @@ assets = [assets] | ||
self.writer(output, function (err) { | ||
if (!compiler.outputFileSystem.readFile) { | ||
compiler.outputFileSystem.readFile = fs.readFile.bind(fs) | ||
compiler.outputFileSystem.join = path.join.bind(path) | ||
} | ||
self.writer(compiler.outputFileSystem, output, function (err) { | ||
if (err) { | ||
@@ -120,0 +123,0 @@ compilation.errors.push(err) |
227
package.json
{ | ||
"name": "assets-webpack-plugin", | ||
"version": "3.8.4", | ||
"version": "3.9.0", | ||
"description": "Emits a json file with assets paths", | ||
@@ -38,3 +38,3 @@ "main": "dist/index.js", | ||
"chai": "^4.1.2", | ||
"css-loader": "^0.28.11", | ||
"css-loader": "^1.0.0", | ||
"lodash": "^4.17.10", | ||
@@ -47,3 +47,3 @@ "mini-css-extract-plugin": "^0.4.0", | ||
"style-loader": "^0.21.0", | ||
"webpack": "^4.10.2" | ||
"webpack": "4.16.3" | ||
}, | ||
@@ -59,11 +59,49 @@ "dependencies": { | ||
{ | ||
"name": "Danny Guo", | ||
"url": "https://github.com/dguo", | ||
"name": "Zach Toben", | ||
"email": null, | ||
"url": "https://github.com/ztoben", | ||
"contributions": 40, | ||
"additions": 1070, | ||
"deletions": 739, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Jonny Gerig Meyer", | ||
"email": null, | ||
"url": "https://github.com/jgerigmeyer", | ||
"contributions": 1, | ||
"additions": 1, | ||
"deletions": 1, | ||
"additions": 32, | ||
"deletions": 6, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Joe Lencioni", | ||
"email": null, | ||
"url": "https://github.com/lencioni", | ||
"contributions": 1, | ||
"additions": 6, | ||
"deletions": 7, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "airwin", | ||
"email": null, | ||
"url": "https://github.com/airwin", | ||
"contributions": 1, | ||
"additions": 3, | ||
"deletions": 2, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Yuriy Grunin", | ||
"email": null, | ||
"url": "https://github.com/th0r", | ||
"contributions": 1, | ||
"additions": 41, | ||
"deletions": 1, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Kane", | ||
"email": null, | ||
"url": "https://github.com/kane-c", | ||
@@ -76,7 +114,8 @@ "contributions": 1, | ||
{ | ||
"name": "Dmitriy Kubyshkin", | ||
"url": "https://github.com/grassator", | ||
"contributions": 1, | ||
"additions": 10, | ||
"deletions": 24, | ||
"name": "Sebastian Porto", | ||
"email": null, | ||
"url": "https://github.com/sporto", | ||
"contributions": 40, | ||
"additions": 2822, | ||
"deletions": 2025, | ||
"hireable": true | ||
@@ -86,22 +125,52 @@ }, | ||
"name": null, | ||
"url": "https://github.com/ju1ius", | ||
"contributions": 15, | ||
"additions": 1488, | ||
"deletions": 992, | ||
"email": null, | ||
"url": "https://github.com/apps/greenkeeper", | ||
"contributions": 12, | ||
"additions": 12, | ||
"deletions": 12, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "airwin", | ||
"url": "https://github.com/airwin", | ||
"name": "Rostislav", | ||
"email": null, | ||
"url": "https://github.com/galkinrost", | ||
"contributions": 3, | ||
"additions": 47, | ||
"deletions": 3, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Danny Guo", | ||
"email": null, | ||
"url": "https://github.com/dguo", | ||
"contributions": 1, | ||
"additions": 3, | ||
"deletions": 2, | ||
"additions": 1, | ||
"deletions": 1, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Joe Lencioni", | ||
"url": "https://github.com/lencioni", | ||
"name": "Matt Krick", | ||
"email": null, | ||
"url": "https://github.com/mattkrick", | ||
"contributions": 1, | ||
"additions": 6, | ||
"deletions": 7, | ||
"additions": 107, | ||
"deletions": 0, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Dmitriy Kubyshkin", | ||
"email": null, | ||
"url": "https://github.com/grassator", | ||
"contributions": 1, | ||
"additions": 10, | ||
"deletions": 24, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Túlio Ornelas", | ||
"email": null, | ||
"url": "https://github.com/tulios", | ||
"contributions": 1, | ||
"additions": 50, | ||
"deletions": 5, | ||
"hireable": null | ||
@@ -111,2 +180,3 @@ }, | ||
"name": "Dido Arellano", | ||
"email": null, | ||
"url": "https://github.com/didoarellano", | ||
@@ -119,11 +189,4 @@ "contributions": 1, | ||
{ | ||
"name": "Germán Méndez Bravo", | ||
"url": "https://github.com/Kronuz", | ||
"contributions": 3, | ||
"additions": 33, | ||
"deletions": 17, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": null, | ||
"email": null, | ||
"url": "https://github.com/dimchez", | ||
@@ -136,23 +199,8 @@ "contributions": 6, | ||
{ | ||
"name": "Matt Krick", | ||
"url": "https://github.com/mattkrick", | ||
"contributions": 1, | ||
"additions": 107, | ||
"deletions": 0, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Zach Toben", | ||
"url": "https://github.com/ztoben", | ||
"contributions": 17, | ||
"additions": 618, | ||
"deletions": 396, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Ernesto Rocha", | ||
"url": "https://github.com/ernestorocha", | ||
"name": "Islam Sharabash", | ||
"email": null, | ||
"url": "https://github.com/ibash", | ||
"contributions": 2, | ||
"additions": 755, | ||
"deletions": 722, | ||
"additions": 63, | ||
"deletions": 12, | ||
"hireable": true | ||
@@ -162,2 +210,3 @@ }, | ||
"name": "Alex Afonin", | ||
"email": null, | ||
"url": "https://github.com/Tuch", | ||
@@ -170,47 +219,44 @@ "contributions": 2, | ||
{ | ||
"name": "Islam Sharabash", | ||
"url": "https://github.com/ibash", | ||
"name": "Hugo Monteiro", | ||
"email": null, | ||
"url": "https://github.com/monteiro", | ||
"contributions": 2, | ||
"additions": 63, | ||
"deletions": 12, | ||
"additions": 19, | ||
"deletions": 15, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Jonny Gerig Meyer", | ||
"url": "https://github.com/jgerigmeyer", | ||
"contributions": 1, | ||
"additions": 32, | ||
"deletions": 6, | ||
"hireable": null | ||
"name": "Ernesto Rocha", | ||
"email": null, | ||
"url": "https://github.com/ernestorocha", | ||
"contributions": 2, | ||
"additions": 755, | ||
"deletions": 722, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Túlio Ornelas", | ||
"url": "https://github.com/tulios", | ||
"contributions": 1, | ||
"additions": 50, | ||
"deletions": 5, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Sebastian Porto", | ||
"url": "https://github.com/sporto", | ||
"contributions": 40, | ||
"additions": 2822, | ||
"deletions": 2025, | ||
"name": "Germán Méndez Bravo", | ||
"email": null, | ||
"url": "https://github.com/Kronuz", | ||
"contributions": 4, | ||
"additions": 36, | ||
"deletions": 21, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Rostislav", | ||
"url": "https://github.com/galkinrost", | ||
"contributions": 3, | ||
"additions": 47, | ||
"deletions": 3, | ||
"name": "Wout Mertens", | ||
"email": null, | ||
"url": "https://github.com/wmertens", | ||
"contributions": 2, | ||
"additions": 12, | ||
"deletions": 17, | ||
"hireable": null | ||
}, | ||
{ | ||
"name": "Hugo Monteiro", | ||
"url": "https://github.com/monteiro", | ||
"contributions": 2, | ||
"additions": 19, | ||
"deletions": 15, | ||
"name": null, | ||
"email": null, | ||
"url": "https://github.com/ju1ius", | ||
"contributions": 15, | ||
"additions": 1488, | ||
"deletions": 992, | ||
"hireable": null | ||
@@ -220,2 +266,3 @@ }, | ||
"name": "Sasha Koss", | ||
"email": null, | ||
"url": "https://github.com/kossnocorp", | ||
@@ -226,12 +273,4 @@ "contributions": 11, | ||
"hireable": true | ||
}, | ||
{ | ||
"name": "Yuriy Grunin", | ||
"url": "https://github.com/th0r", | ||
"contributions": 1, | ||
"additions": 41, | ||
"deletions": 1, | ||
"hireable": true | ||
} | ||
] | ||
} | ||
} |
@@ -0,0 +0,0 @@ # assets-webpack-plugin |
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
34377
496
2