Skip to content

Commit

Permalink
Use buffer-from module for compatibility (fixes TypeStrong#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
burnnat committed Jun 20, 2018
1 parent e034830 commit 60305e6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"homepage": "https://github.com/TypeStrong/ts-node",
"devDependencies": {
"@types/arrify": "^1.0.1",
"@types/buffer-from": "^1.1.0",
"@types/chai": "^4.0.4",
"@types/diff": "^3.2.1",
"@types/minimist": "^1.2.0",
Expand All @@ -74,6 +75,7 @@
},
"dependencies": {
"arrify": "^1.0.0",
"buffer-from": "^1.1.0",
"diff": "^3.1.0",
"make-error": "^1.1.1",
"minimist": "^1.2.0",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import mkdirp = require('mkdirp')
import crypto = require('crypto')
import yn = require('yn')
import arrify = require('arrify')
import bufferFrom = require('buffer-from')
import { BaseError } from 'make-error'
import * as util from 'util'
import * as _ts from 'typescript'
Expand Down Expand Up @@ -557,7 +558,7 @@ function readThrough (
* Update the output remapping the source map.
*/
function updateOutput (outputText: string, fileName: string, sourceMap: string, getExtension: (fileName: string) => string) {
const base64Map = Buffer.from(updateSourceMap(sourceMap, fileName), 'utf8').toString('base64')
const base64Map = bufferFrom(updateSourceMap(sourceMap, fileName), 'utf8').toString('base64')
const sourceMapContent = `data:application/json;charset=utf-8;base64,${base64Map}`
const sourceMapLength = `${basename(fileName)}.map`.length + (getExtension(fileName).length - extname(fileName).length)

Expand Down

0 comments on commit 60305e6

Please sign in to comment.