[babel 8] Output minimal strings by default (#12675)

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Justin Ridgewell <jridgewell@google.com>
This commit is contained in:
Huáng Jùnliàng
2021-01-23 16:50:07 -05:00
committed by GitHub
parent 464a02ffe1
commit cd090e9842
37 changed files with 231 additions and 12 deletions

View File

@@ -42,6 +42,15 @@ export default declare(api => {
return {
name: "transform-unicode-escapes",
manipulateOptions({ generatorOpts }) {
// Babel 8 will enable jsesc minimal mode by default, which outputs
// unescaped unicode string
if (!generatorOpts.jsescOption) {
generatorOpts.jsescOption = {};
}
// $FlowIgnore: Flow does not support logical assignment
generatorOpts.jsescOption.minimal ??= false;
},
visitor: {
Identifier(path) {
const { node, key } = path;