Skip to content

Fix #4780: Babel should get correct options #4785

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

Merged
merged 1 commit into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/coffeescript/coffeescript.js

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

8 changes: 5 additions & 3 deletions src/coffeescript.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ exports.compile = compile = withPrettyErrors (code, options = {}) ->
transpiler = options.transpile.transpile
delete options.transpile.transpile

transpilerOptions = Object.assign {}, options.transpile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be a good opportunity for some objects spreads 😄

transpilerOptions = { options.transpile... }

Copy link
Collaborator Author

@GeoffreyBooth GeoffreyBooth Nov 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, indeed. 😄 I’m avoiding using them in the codebase, though, because the compiler is supposed to stay compatible with Node 6 and at some point that syntax will reach Stage 4 and we’ll start outputting it as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other notes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, LGTM.


# See https://github.com/babel/babel/issues/827#issuecomment-77573107:
# Babel can take a v3 source map object as input in `inputSourceMap`
# and it will return an *updated* v3 source map object in its output.
if v3SourceMap and not options.transpile.inputSourceMap?
options.transpile.inputSourceMap = v3SourceMap
transpilerOutput = transpiler js, options.transpile
if v3SourceMap and not transpilerOptions.inputSourceMap?
transpilerOptions.inputSourceMap = v3SourceMap
transpilerOutput = transpiler js, transpilerOptions
js = transpilerOutput.code
if v3SourceMap and transpilerOutput.map
v3SourceMap = transpilerOutput.map
Expand Down