Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/{encode,decode}-source-map don't support inline sourcemaps (data URI) #20

Open
hjdivad opened this issue Nov 22, 2016 · 4 comments
Open
Labels

Comments

@hjdivad
Copy link
Contributor

hjdivad commented Nov 22, 2016

but they should

@hjdivad
Copy link
Contributor Author

hjdivad commented Nov 22, 2016

> let s = 'eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJmaXJzdCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZmlyc3QtY29udGVudCIsICJleHRyYS1jb250ZW50Il19'
undefined
> s
'eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJmaXJzdCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZmlyc3QtY29udGVudCIsICJleHRyYS1jb250ZW50Il19'
> Buffer
{ [Function: Buffer]
  poolSize: 8192,
  from: [Function],
  alloc: [Function],
  allocUnsafe: [Function],
  allocUnsafeSlow: [Function],
  isBuffer: [Function: isBuffer],
  compare: [Function: compare],
  isEncoding: [Function],
  concat: [Function],
  byteLength: [Function: byteLength] }
> buf = new Buffer(s, 'base64')
<Buffer 7b 22 76 65 72 73 69 6f 6e 22 3a 33 2c 22 66 69 6c 65 22 3a 22 74 79 70 65 73 2e 6a 73 22 2c 22 73 6f 75 72 63 65 52 6f 6f 74 22 3a 22 22 2c 22 73 6f ... >
> buf+''
'{"version":3,"file":"types.js","sourceRoot":"","sources":["first"],"names":[],"mappings":"","sourcesContent":["first-content", "extra-content"]}'
> console.log(buf+'')
{"version":3,"file":"types.js","sourceRoot":"","sources":["first"],"names":[],"mappings":"","sourcesContent":["first-content", "extra-content"]}

@Turbo87 Turbo87 added the bug label Nov 23, 2016
@hjdivad
Copy link
Contributor Author

hjdivad commented Nov 23, 2016

we should also support easy transformation between inline and external sourcemaps.

@krisselden
Copy link
Owner

@hjdivad is the idea that it would be a command line switch?

@hjdivad
Copy link
Contributor Author

hjdivad commented Nov 29, 2016

@krisselden if necessary, but it would be nice to autodetect. We already read the entire file into memory before processing, so we should be able to just check the last (couple?) lines for a sourceMappingURL=data:application/json;base64, comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants