react-loadable-ssr-addon
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -121,2 +121,4 @@ "use strict"; | ||
_proto.getMinimalStatsChunks = function getMinimalStatsChunks(compilationChunks) { | ||
var _this = this; | ||
var compareId = function compareId(a, b) { | ||
@@ -132,3 +134,3 @@ if (typeof a !== typeof b) { | ||
return compilationChunks.reduce(function (chunks, chunk) { | ||
return this.ensureArray(compilationChunks).reduce(function (chunks, chunk) { | ||
var siblings = new Set(); | ||
@@ -153,3 +155,3 @@ | ||
names: chunk.name ? [chunk.name] : [], | ||
files: chunk.files.slice(), | ||
files: _this.ensureArray(chunk.files).slice(), | ||
hash: chunk.renderedHash, | ||
@@ -178,3 +180,3 @@ siblings: Array.from(siblings).sort(compareId), | ||
_proto.processAssets = function processAssets(originAssets) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -218,6 +220,6 @@ var assets = {}; | ||
if (!(0, _utils.hasEntry)(assets[id][ext], 'file', file)) { | ||
var shouldComputeIntegrity = Object.keys(currentAsset) && _this.options.integrity && !currentAsset[_this.options.integrityPropertyName]; | ||
var shouldComputeIntegrity = Object.keys(currentAsset) && _this2.options.integrity && !currentAsset[_this2.options.integrityPropertyName]; | ||
if (shouldComputeIntegrity) { | ||
currentAsset[_this.options.integrityPropertyName] = (0, _utils.computeIntegrity)(_this.options.integrityAlgorithms, currentAsset.source()); | ||
currentAsset[_this2.options.integrityPropertyName] = (0, _utils.computeIntegrity)(_this2.options.integrityAlgorithms, currentAsset.source()); | ||
} | ||
@@ -228,4 +230,4 @@ | ||
hash: hash, | ||
publicPath: _url["default"].resolve(_this.options.publicPath || '', file), | ||
integrity: currentAsset[_this.options.integrityPropertyName] | ||
publicPath: _url["default"].resolve(_this2.options.publicPath || '', file), | ||
integrity: currentAsset[_this2.options.integrityPropertyName] | ||
}); | ||
@@ -262,2 +264,10 @@ } | ||
_proto.ensureArray = function ensureArray(source) { | ||
if (WEBPACK_5) { | ||
return Array.from(source); | ||
} | ||
return source; | ||
}; | ||
(0, _createClass2["default"])(ReactLoadableSSRAddon, [{ | ||
@@ -264,0 +274,0 @@ key: "isRequestFromDevServer", |
{ | ||
"name": "react-loadable-ssr-addon", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Server Side Render add-on for React Loadable. Load splitted chunks was never that easy.", | ||
@@ -47,3 +47,3 @@ "main": "lib/index.js", | ||
"react-loadable": "*", | ||
"webpack": ">=4.41.1" | ||
"webpack": ">=4.41.1 || 5.x" | ||
}, | ||
@@ -50,0 +50,0 @@ "devDependencies": { |
@@ -340,5 +340,9 @@ # React Loadable SSR Add-on | ||
## Release History | ||
* 1.0.1 | ||
* FIX: [Webpack v5 deprecation warning](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/27) | ||
* 1.0.0 | ||
* BREAKING CHANGE: drop support for Webpack v3. | ||
* NEW: add [support for Webpack v5](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/260) | ||
* NEW: add [support for Webpack v5](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/26) | ||
<details> | ||
<summary>See older release note</summary> | ||
* 0.3.0 | ||
@@ -355,6 +359,2 @@ * NEW: [`@babel/runtime` become an explicit dependency](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/22) by [@RDIL](https://github.com/RDIL) | ||
* Improvement: Reduce memory consumption ([Issue #17](https://github.com/themgoncalves/react-loadable-ssr-addon/issues/17)) reported by [@endiliey](https://github.com/endiliey) | ||
<details> | ||
<summary>See older release note</summary> | ||
* 0.1.9 | ||
@@ -410,14 +410,14 @@ * FIX: [Missing entry in origins](https://github.com/themgoncalves/react-loadable-ssr-addon/pull/13) reported by [@p-j](https://github.com/p-j); | ||
⚡️ New feature (`:zap:`) | ||
🐛 Bug fix (`:bug:`) | ||
🔥 P0 fix (`:fire:`) | ||
✅ Tests (`:white_check_mark:`) | ||
🚀 Performance improvements (`:rocket:`) | ||
🖍 CSS / Styling (`:crayon:`) | ||
♿ Accessibility (`:wheelchair:`) | ||
🌐 Internationalization (`:globe_with_meridians:`) | ||
📖 Documentation (`:book:`) | ||
🏗 Infrastructure / Tooling / Builds / CI (`:building_construction:`) | ||
⏪ Reverting a previous change (`:rewind:`) | ||
♻️ Refactoring (like moving around code w/o any changes) (`:recycle:`) | ||
⚡️ New feature (`:zap:`) | ||
🐛 Bug fix (`:bug:`) | ||
🔥 P0 fix (`:fire:`) | ||
✅ Tests (`:white_check_mark:`) | ||
🚀 Performance improvements (`:rocket:`) | ||
🖍 CSS / Styling (`:crayon:`) | ||
♿ Accessibility (`:wheelchair:`) | ||
🌐 Internationalization (`:globe_with_meridians:`) | ||
📖 Documentation (`:book:`) | ||
🏗 Infrastructure / Tooling / Builds / CI (`:building_construction:`) | ||
⏪ Reverting a previous change (`:rewind:`) | ||
♻️ Refactoring (like moving around code w/o any changes) (`:recycle:`) | ||
🚮 Deleting code (`:put_litter_in_its_place:`) | ||
@@ -424,0 +424,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -172,3 +172,3 @@ | ||
* It represents the fully configured Webpack environment. | ||
* @See {@link https://github.com/webpack/docs/wiki/how-to-write-a-plugin#compiler-and-compilation} | ||
* @See {@link https://webpack.js.org/concepts/plugins/#anatomy} | ||
*/ | ||
@@ -184,3 +184,3 @@ apply(compiler) { | ||
* @description equivalent of getting stats.chunks but much less in size & memory usage | ||
* It tries to mimic https://github.com/webpack/webpack/blob/master/lib/Stats.js#L632 | ||
* It tries to mimic https://github.com/webpack/webpack/blob/webpack-4/lib/Stats.js#L632 | ||
* implementation without expensive operations | ||
@@ -200,3 +200,3 @@ * @param {array} compilationChunks | ||
return compilationChunks.reduce((chunks, chunk) => { | ||
return this.ensureArray(compilationChunks).reduce((chunks, chunk) => { | ||
const siblings = new Set(); | ||
@@ -221,5 +221,6 @@ | ||
names: chunk.name ? [chunk.name] : [], | ||
files: chunk.files.slice(), | ||
files: this.ensureArray(chunk.files).slice(), | ||
hash: chunk.renderedHash, | ||
siblings: Array.from(siblings).sort(compareId), | ||
// TODO: This is the final deprecation warning needing to be solved. | ||
modules: chunk.getModules(), | ||
@@ -343,2 +344,16 @@ }); | ||
} | ||
/** | ||
* Ensure that given source is an array (webpack 5 switches a lot of Arrays to Sets) | ||
* @method ensureArray | ||
* @function | ||
* @param {*[]|Set<any>} source | ||
* @returns {*[]} | ||
*/ | ||
ensureArray(source) { | ||
if (WEBPACK_5) { | ||
return Array.from(source); | ||
} | ||
return source; | ||
} | ||
} | ||
@@ -345,0 +360,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -12,3 +12,3 @@ | ||
* @func computeIntegrity | ||
* See {@link https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity|Subresource Integrity} at MDN | ||
* See {@link https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity Subresource Integrity} at MDN | ||
* @param {array} algorithms - The algorithms you want to use when hashing `content` | ||
@@ -15,0 +15,0 @@ * @param {string} source - File contents you want to hash |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
/** | ||
* react-loadable-ssr-addon | ||
* @author Marcos Gonçalves <contact@themgoncalves.com> | ||
* @version 1.0.0 | ||
* @version 1.0.1 | ||
*/ | ||
@@ -6,0 +6,0 @@ |
@@ -9,2 +9,3 @@ const webpack = require('webpack'); | ||
module.exports = { | ||
mode: 'production', | ||
target: 'web', | ||
@@ -14,3 +15,3 @@ entry: { | ||
}, | ||
devtool: 'cheap-module-eval-source-map', | ||
devtool: 'eval-cheap-module-source-map', | ||
output: { | ||
@@ -57,2 +58,3 @@ publicPath: '/dist/', | ||
], | ||
performance: false, | ||
}; |
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
399878
1382