Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
[fixed] regression in v6.0.0, which could cause Compiler to gzip co…
Browse files Browse the repository at this point in the history
…mpress in development mode
  • Loading branch information
thealjey committed Jan 23, 2017
1 parent f594eae commit 282e763
Show file tree
Hide file tree
Showing 25 changed files with 152 additions and 42 deletions.
12 changes: 6 additions & 6 deletions docs/Compiler.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h4 class="name" id="Compiler"><span class="type-signature">(abstract) </span>ne

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line16">line 16</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line17">line 17</a>
</li></ul></dd>


Expand Down Expand Up @@ -236,7 +236,7 @@ <h4 class="name" id=".done"><span class="type-signature">(static) </span>done<sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line41">line 41</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line42">line 42</a>
</li></ul></dd>


Expand Down Expand Up @@ -397,7 +397,7 @@ <h4 class="name" id=".fsWrite"><span class="type-signature">(static) </span>fsWr

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line77">line 77</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line78">line 78</a>
</li></ul></dd>


Expand Down Expand Up @@ -599,7 +599,7 @@ <h4 class="name" id=".gzip"><span class="type-signature">(static) </span>gzip<sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line132">line 132</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line133">line 133</a>
</li></ul></dd>


Expand Down Expand Up @@ -778,7 +778,7 @@ <h4 class="name" id=".mkdir"><span class="type-signature">(static) </span>mkdir<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line112">line 112</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line113">line 113</a>
</li></ul></dd>


Expand Down Expand Up @@ -939,7 +939,7 @@ <h4 class="name" id="save"><span class="type-signature">(protected) </span>save<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line187">line 187</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line188">line 188</a>
</li></ul></dd>


Expand Down
3 changes: 2 additions & 1 deletion docs/Compiler.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ <h1 class="page-title">Compiler.js</h1>
import {writeFile, readFile} from 'fs';
import {gzip, gunzip} from 'zlib';
import {logError, log, consoleStyles} from './logger';
import {isProduction} from './webpack';

/* eslint-disable no-process-env */

Expand Down Expand Up @@ -74,7 +75,7 @@ <h1 class="page-title">Compiler.js</h1>
/* eslint-disable require-jsdoc */
constructor(compress: boolean = true) {
/* eslint-enable require-jsdoc */
this.compress = compress;
this.compress = isProduction &amp;&amp; compress;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion docs/JS.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ <h5>Parameters:</h5>
</td>


<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data</p></td>
<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data in production mode</p></td>
</tr>


Expand Down
2 changes: 1 addition & 1 deletion docs/JS.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h1 class="page-title">JS.js</h1>
* JavaScript compilation tools
*
* @class JS
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production mode
* @param {Object} [lintRules={}] - allows to override the default linting rules
* @example
* import {JS} from 'webcompiler';
Expand Down
4 changes: 2 additions & 2 deletions docs/JSCompiler.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ <h5>Parameters:</h5>
</td>


<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data</p></td>
<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data in production mode</p></td>
</tr>


Expand Down Expand Up @@ -731,7 +731,7 @@ <h4 class="name" id="save"><span class="type-signature">(protected) </span>save<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line187">line 187</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line188">line 188</a>
</li></ul></dd>


Expand Down
2 changes: 1 addition & 1 deletion docs/JSCompiler.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h1 class="page-title">JSCompiler.js</h1>
*
* @class JSCompiler
* @extends Compiler
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production mode
* @example
* import {JSCompiler} from 'webcompiler';
* // or - import {JSCompiler} from 'webcompiler/lib/JSCompiler';
Expand Down
9 changes: 5 additions & 4 deletions docs/SASS.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ <h5>Parameters:</h5>
</td>


<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data</p></td>
<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data in production
mode</p></td>
</tr>


Expand Down Expand Up @@ -367,7 +368,7 @@ <h4 class="name" id="compiler"><span class="type-signature"></span>compiler<span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="SASS.js.html">SASS.js</a>, <a href="SASS.js.html#line37">line 37</a>
<a href="SASS.js.html">SASS.js</a>, <a href="SASS.js.html#line38">line 38</a>
</li></ul></dd>


Expand Down Expand Up @@ -450,7 +451,7 @@ <h4 class="name" id="fe"><span class="type-signature"></span>fe<span class="sign

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="SASS.js.html">SASS.js</a>, <a href="SASS.js.html#line88">line 88</a>
<a href="SASS.js.html">SASS.js</a>, <a href="SASS.js.html#line89">line 89</a>
</li></ul></dd>


Expand Down Expand Up @@ -739,7 +740,7 @@ <h4 class="name" id="lint"><span class="type-signature"></span>lint<span class="

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="SASS.js.html">SASS.js</a>, <a href="SASS.js.html#line64">line 64</a>
<a href="SASS.js.html">SASS.js</a>, <a href="SASS.js.html#line65">line 65</a>
</li></ul></dd>


Expand Down
3 changes: 2 additions & 1 deletion docs/SASS.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ <h1 class="page-title">SASS.js</h1>
* the module in JavaScript).
*
* @class SASS
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production
* mode
* @param {Array&lt;string>} [includePaths=[]] - an array of additional include paths
* @param {Object} [configOverrides={}] - an object that lets you override the default linting configuration
* @param {Object} [importOnceOptions={}] - an object that lets you override default importOnce resolver
Expand Down
9 changes: 5 additions & 4 deletions docs/SASSCompiler.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ <h5>Parameters:</h5>
</td>


<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data</p></td>
<td class="description last"><p>if true <code>Compiler#save</code> will gzip compress the data in production
mode</p></td>
</tr>


Expand Down Expand Up @@ -345,7 +346,7 @@ <h4 class="name" id=".autoprefix"><span class="type-signature">(static) </span>a

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="SASSCompiler.js.html">SASSCompiler.js</a>, <a href="SASSCompiler.js.html#line77">line 77</a>
<a href="SASSCompiler.js.html">SASSCompiler.js</a>, <a href="SASSCompiler.js.html#line78">line 78</a>
</li></ul></dd>


Expand Down Expand Up @@ -531,7 +532,7 @@ <h4 class="name" id="fe"><span class="type-signature"></span>fe<span class="sign

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="SASSCompiler.js.html">SASSCompiler.js</a>, <a href="SASSCompiler.js.html#line106">line 106</a>
<a href="SASSCompiler.js.html">SASSCompiler.js</a>, <a href="SASSCompiler.js.html#line107">line 107</a>
</li></ul></dd>


Expand Down Expand Up @@ -761,7 +762,7 @@ <h4 class="name" id="save"><span class="type-signature">(protected) </span>save<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line187">line 187</a>
<a href="Compiler.js.html">Compiler.js</a>, <a href="Compiler.js.html#line188">line 188</a>
</li></ul></dd>


Expand Down
3 changes: 2 additions & 1 deletion docs/SASSCompiler.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ <h1 class="page-title">SASSCompiler.js</h1>
*
* @class SASSCompiler
* @extends Compiler
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production
* mode
* @param {Array&lt;string>} [includePaths=[]] - an array of additional include paths
* @param {Object} [importOnceOptions={}] - an object that lets you override default importOnce resolver
* configuration
Expand Down
79 changes: 76 additions & 3 deletions docs/module-webpack.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h1 class="page-title">webpack</h1>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line25">line 25</a>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line24">line 24</a>
</li></ul></dd>


Expand Down Expand Up @@ -157,7 +157,7 @@ <h4 class="name" id=".babelBEOptions"><span class="type-signature">(static) </sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line33">line 33</a>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line40">line 40</a>
</li></ul></dd>


Expand Down Expand Up @@ -240,7 +240,7 @@ <h4 class="name" id=".babelFEOptions"><span class="type-signature">(static) </sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line53">line 53</a>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line60">line 60</a>
</li></ul></dd>


Expand Down Expand Up @@ -311,6 +311,79 @@ <h5>Example</h5>




<h4 class="name" id=".isProduction"><span class="type-signature">(static, constant) </span>isProduction<span class="type-signature"> :boolean</span></h4>





<dl class="details">


<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="webpack.js.html">webpack.js</a>, <a href="webpack.js.html#line32">line 32</a>
</li></ul></dd>































</dl>





<div class="description">
<p><code>true</code> if the <code>NODE_ENV</code> environment variable is set to <code>'production'</code></p>
</div>



<h5>Type:</h5>
<ul>
<li>

<span class="param-type">boolean</span>


</li>
</ul>










Expand Down
9 changes: 8 additions & 1 deletion docs/webpack.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ <h1 class="page-title">webpack.js</h1>

const cache = {},
fakeFS = new MemoryFS(),
isProduction = 'production' === process.env.NODE_ENV,
{optimize, DefinePlugin, HotModuleReplacementPlugin} = webpack,
{OccurrenceOrderPlugin, DedupePlugin, UglifyJsPlugin} = optimize,
productionPlugins = [
Expand All @@ -69,6 +68,14 @@ <h1 class="page-title">webpack.js</h1>
* @module webpack
*/

/**
* `true` if the `NODE_ENV` environment variable is set to `'production'`
*
* @memberof module:webpack
* @constant {boolean} isProduction
*/
export const isProduction = 'production' === process.env.NODE_ENV;

/**
* Babel configuration for the Node.js.
*
Expand Down
4 changes: 3 additions & 1 deletion lib/Compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ var _zlib = require('zlib');

var _logger = require('./logger');

var _webpack = require('./webpack');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable no-process-env */
Expand All @@ -35,7 +37,7 @@ class Compiler {
/* eslint-disable require-jsdoc */
constructor(compress = true) {
/* eslint-enable require-jsdoc */
this.compress = compress;
this.compress = _webpack.isProduction && compress;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/JS.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* JavaScript compilation tools
*
* @class JS
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production mode
* @param {Object} [lintRules={}] - allows to override the default linting rules
* @example
* import {JS} from 'webcompiler';
Expand Down
2 changes: 1 addition & 1 deletion lib/JSCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { yellow, red } = _logger.consoleStyles;
*
* @class JSCompiler
* @extends Compiler
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production mode
* @example
* import {JSCompiler} from 'webcompiler';
* // or - import {JSCompiler} from 'webcompiler/lib/JSCompiler';
Expand Down
3 changes: 2 additions & 1 deletion lib/SASS.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* the module in JavaScript).
*
* @class SASS
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production
* mode
* @param {Array<string>} [includePaths=[]] - an array of additional include paths
* @param {Object} [configOverrides={}] - an object that lets you override the default linting configuration
* @param {Object} [importOnceOptions={}] - an object that lets you override default importOnce resolver
Expand Down
3 changes: 2 additions & 1 deletion lib/SASSCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const precision = 8,
*
* @class SASSCompiler
* @extends Compiler
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data
* @param {boolean} [compress=true] - if true `Compiler#save` will gzip compress the data in production
* mode
* @param {Array<string>} [includePaths=[]] - an array of additional include paths
* @param {Object} [importOnceOptions={}] - an object that lets you override default importOnce resolver
* configuration
Expand Down
Loading

0 comments on commit 282e763

Please sign in to comment.