Skip to content

CallExpressions to TaggedTemplateLiterals#387

Closed
boopathi wants to merge 1 commit intomasterfrom
template-calls-0
Closed

CallExpressions to TaggedTemplateLiterals#387
boopathi wants to merge 1 commit intomasterfrom
template-calls-0

Conversation

@boopathi
Copy link
Copy Markdown
Member

@boopathi boopathi commented Jan 23, 2017

Should we have this in some other plugin ? It can be present anywhere - nothing related to simplify (considering simplify already has too many transformations)

@kangax
Copy link
Copy Markdown
Member

kangax commented Jan 24, 2017

Maybe we should call an option "es2015=true", consistent with es2015 presets in babel, etc.

Other than that, this addition makes sense. I have a feeling it's not very impactful due to gzip, and possibly even worse, but we'd need to see benchmarks for that.

/cc @hzoo

@hzoo
Copy link
Copy Markdown
Member

hzoo commented Jan 24, 2017

Yeah I'm not sure about ecmaVersion (I don't know a good name for it either) but I guess we just need to signal that it means that is the minimum supported target version.

Future thoughts: would be better to target a specific feature though (not sure how it would work). An integration with babel-preset-env would be pretty great then since we could pass down the data regarding TaggedTemplate support -> this plugin to turn it on or not.

Kind of like how we do https://github.com/babel/babel-preset-env/blob/master/src/index.js#L210

It really feels like it makes more sense to have something that combined babel-preset-env + babili together and probably with a bundler like webpack..

@boopathi
Copy link
Copy Markdown
Member Author

Oh. Yeah. I'll change it to use the preset-env data and implement option as target like in babel-preset-env instead of ecmaVersion. This will be useful for many other transformations as well - like we can convert some es5 to es2015 if it is smaller.

@boopathi boopathi added Tag: New Feature Pull Request adding a new feature and removed enhancement labels Jan 25, 2017
@kzc
Copy link
Copy Markdown

kzc commented Feb 4, 2017

Maybe I'm missing something, but is this proposed transform sound?

$ node -e 'function foo(x){console.log(JSON.stringify(x));} foo("bar"); foo`bar`;'
"bar"
["bar"]
$ node -v
v6.9.0

@boopathi
Copy link
Copy Markdown
Member Author

boopathi commented Feb 5, 2017

@kzc Good catch. I forgot about that. Thanks!

Closing this. Will try other ES2015+ transformations with the options discussed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Tag: New Feature Pull Request adding a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants