add jsesc options support (#8143)

This commit is contained in:
Vincent Chan
2018-06-12 02:34:41 +08:00
committed by Henry Zhu
parent cc4ee350e4
commit 3432792568
2 changed files with 6 additions and 4 deletions

View File

@@ -132,10 +132,7 @@ export function StringLiteral(node: Object) {
}
// ensure the output is ASCII-safe
const opts = {
quotes: "double",
wrap: true,
};
const opts = this.format.jsescOption;
if (this.format.jsonCompatibleStrings) {
opts.json = true;
}

View File

@@ -53,6 +53,11 @@ function normalizeOptions(code, opts): Format {
base: 0,
},
decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
jsescOption: {
quotes: "double",
wrap: true,
...opts.jsescOption,
},
};
if (format.minified) {