-
Notifications
You must be signed in to change notification settings - Fork 436
Add "inline" option for inline source maps. #1445
Add "inline" option for inline source maps. #1445
Conversation
@@ -188,6 +188,11 @@ const optimize = (data, map, path, optimizers, sourceFiles) => { | |||
return promiseReduce(optimizers, runOptimizer, initial); | |||
}; | |||
|
|||
const getInlineSourceMapUrl = map => { | |||
const base64String = new Buffer(JSON.stringify(map)).toString('base64'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Buffer
is deprecated in Node 6, use Buffer.from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure Buffer.from
is not available (yet) in Node 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brunch claims to support Node >= 4
, and Buffer.from
was only added in 5.10
. So, for backwards compatibility, should I do this?
const base64String = (Buffer.from ? Buffer.from(JSON.stringify(map)) : new Buffer(JSON.stringify(map))).toString('base64');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buffer.from
for strings was added in 5.10
: this code will cause TypeError
in Node 4, because Buffer.from
will expect TypedArray
.
Lets leave new Buffer
, I will containbase64
encoding complexity in helper later.
I removed the |
OK, lets keep it. |
This reverts commit 2b74535.
Fixes #1424.