Fix JSON escaping (#2461)

pull/2473/head^2
YISH 2024-05-24 09:26:34 +08:00 committed by GitHub
parent 50c53de296
commit 82899d9d5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -780,7 +780,7 @@ export const getVariableValue = (
const variableValue = variableDict[path]
// Replace all occurrence
if (typeof variableValue === 'object') {
returnVal = returnVal.split(path).join(JSON.stringify(variableValue).replace(/"/g, '\\"'))
returnVal = returnVal.split(path).join(JSON.stringify(variableValue).replaceAll('"', '\\"').replaceAll('\\n', '\\\\n'))
} else {
returnVal = returnVal.split(path).join(variableValue)
}

View File

@ -1,7 +1,7 @@
{
"compilerOptions": {
"lib": ["es2017"],
"target": "es2017" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": ["es2021"],
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"experimentalDecorators": true /* Enable experimental support for TC39 stage 2 draft decorators. */,
"emitDecoratorMetadata": true /* Emit design-type metadata for decorated declarations in source files. */,
"module": "commonjs" /* Specify what module code is generated. */,