Skip to content

Commit 91c1f35

Browse files
committed
fix(node): rollback changes of Buffer.from to new Buffer() and bump down travis to 4.3 min node v
1 parent 0b47602 commit 91c1f35

File tree

8 files changed

+25
-10
lines changed

8 files changed

+25
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ matrix:
2222
node_js: "6"
2323
env: NO_WATCH_TESTS=1 JOB_PART=test
2424
- os: linux
25-
node_js: "4"
25+
node_js: "4.3"
2626
env: NO_WATCH_TESTS=1 JOB_PART=test
2727
- os: osx
2828
node_js: "7"

bin/webpack.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Author Tobias Koppers @sokra
66
*/
77
var path = require("path");
8+
89
// Local version replace global one
910
try {
1011
var localWebpack = require.resolve(path.join(process.cwd(), "node_modules", "webpack", "bin", "webpack.js"));

lib/Compiler.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,11 @@ Compiler.prototype.emitAssets = function(compilation, callback) {
320320
return callback();
321321
}
322322
var content = source.source();
323-
if(!Buffer.isBuffer(content))
324-
content = Buffer.from(content, "utf8");
323+
324+
if(!Buffer.isBuffer(content)) {
325+
content = new Buffer(content, "utf8"); //eslint-disable-line
326+
}
327+
325328
source.existsAt = targetPath;
326329
source.emitted = true;
327330
this.outputFileSystem.writeFile(targetPath, content, callback);

lib/EvalSourceMapDevToolModuleTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ EvalSourceMapDevToolModuleTemplatePlugin.prototype.apply = function(moduleTempla
5858
}
5959
sourceMap.sourceRoot = options.sourceRoot || "";
6060
sourceMap.file = module.id + ".js";
61-
var footer = self.sourceMapComment.replace(/\[url\]/g, "data:application/json;charset=utf-8;base64," + Buffer.from(JSON.stringify(sourceMap)).toString("base64"));
61+
var footer = self.sourceMapComment.replace(/\[url\]/g, "data:application/json;charset=utf-8;base64," + new Buffer(JSON.stringify(sourceMap), "utf8").toString("base64")); //eslint-disable-line
6262
source.__EvalSourceMapDevToolData = new RawSource("eval(" + JSON.stringify(content + footer) + ");");
6363
return source.__EvalSourceMapDevToolData;
6464
});

lib/LibManifestPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ LibManifestPlugin.prototype.apply = function(compiler) {
4343
return obj;
4444
}.bind(this), {})
4545
};
46-
var content = Buffer.from(JSON.stringify(manifest, null, 2), "utf8");
46+
var content = new Buffer(JSON.stringify(manifest, null, 2), "utf8"); //eslint-disable-line
4747
compiler.outputFileSystem.mkdirp(path.dirname(targetPath), function(err) {
4848
if(err) return callback(err);
4949
compiler.outputFileSystem.writeFile(targetPath, content, callback);

lib/SourceMapDevToolPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ SourceMapDevToolPlugin.prototype.apply = function(compiler) {
155155
})
156156
.replace(/\[url\]/g, function() {
157157
return "data:application/json;charset=utf-8;base64," +
158-
Buffer.from(JSON.stringify(sourceMap)).toString("base64");
158+
new Buffer(JSON.stringify(sourceMap), "utf8").toString("base64");
159159
})
160160
);
161161
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"worker-loader": "~0.7.0"
6666
},
6767
"engines": {
68-
"node": ">=4.7.0 <5.0.0 || >=5.10"
68+
"node": ">=4.3.0 <5.0.0 || >=5.10"
6969
},
7070
"repository": {
7171
"type": "git",

yarn.lock

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ acorn@^3.0.4:
4343
version "3.3.0"
4444
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
4545

46-
acorn@^4.0.1, acorn@^4.0.3:
46+
acorn@^4.0.1, acorn@^4.0.3, acorn@^4.0.4:
4747
version "4.0.4"
4848
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a"
4949

@@ -408,6 +408,10 @@ buffer-shims@^1.0.0:
408408
version "1.0.0"
409409
resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51"
410410

411+
buffer-v6-polyfill@^1.0.3:
412+
version "1.0.3"
413+
resolved "https://registry.yarnpkg.com/buffer-v6-polyfill/-/buffer-v6-polyfill-1.0.3.tgz#bc695c6f19d00a63e83338c36cd68f3f5dcba3e8"
414+
411415
buffer-xor@^1.0.2:
412416
version "1.0.3"
413417
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
@@ -3555,7 +3559,7 @@ sort-keys@^1.0.0:
35553559
dependencies:
35563560
is-plain-obj "^1.0.0"
35573561

3558-
source-list-map@^0.1.4, source-list-map@~0.1.0:
3562+
source-list-map@^0.1.4, source-list-map@~0.1.0, source-list-map@~0.1.7:
35593563
version "0.1.7"
35603564
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.7.tgz#d4b5ce2a46535c72c7e8527c71a77d250618172e"
35613565

@@ -3990,7 +3994,7 @@ watchpack@^1.2.0:
39903994
chokidar "^1.4.3"
39913995
graceful-fs "^4.1.2"
39923996

3993-
webpack-dev-middleware@^1.0.0:
3997+
webpack-dev-middleware@^1.9.0:
39943998
version "1.9.0"
39953999
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-1.9.0.tgz#a1c67a3dfd8a5c5d62740aa0babe61758b4c84aa"
39964000
dependencies:
@@ -4006,6 +4010,13 @@ webpack-sources@^0.1.0:
40064010
source-list-map "~0.1.0"
40074011
source-map "~0.5.3"
40084012

4013+
webpack-sources@^0.1.4:
4014+
version "0.1.4"
4015+
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.4.tgz#ccc2c817e08e5fa393239412690bb481821393cd"
4016+
dependencies:
4017+
source-list-map "~0.1.7"
4018+
source-map "~0.5.3"
4019+
40094020
whatwg-fetch@>=0.10.0:
40104021
version "2.0.1"
40114022
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.1.tgz#078b9461bbe91cea73cbce8bb122a05f9e92b772"

0 commit comments

Comments
 (0)