@babelize/engine 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -355,7 +355,11 @@ function addLabelMaps(plan, keys, isTypeScript, usedNames) {
|
|
|
355
355
|
const init = scope.getBinding(existing)?.path.node;
|
|
356
356
|
if (ast_helpers_1.t.isVariableDeclarator(init) && ast_helpers_1.t.isObjectExpression(init.init)) {
|
|
357
357
|
const obj = init.init;
|
|
358
|
-
|
|
358
|
+
// Formatters unquote keys that are valid identifiers (`"English": …` → `English: …`).
|
|
359
|
+
const has = new Set(obj.properties.flatMap((p) => !ast_helpers_1.t.isObjectProperty(p) || p.computed ? []
|
|
360
|
+
: ast_helpers_1.t.isStringLiteral(p.key) ? [p.key.value]
|
|
361
|
+
: ast_helpers_1.t.isIdentifier(p.key) ? [p.key.name]
|
|
362
|
+
: []));
|
|
359
363
|
for (const [value, key] of values) {
|
|
360
364
|
if (!has.has(value))
|
|
361
365
|
obj.properties.push(ast_helpers_1.t.objectProperty(ast_helpers_1.t.stringLiteral(value), ast_helpers_1.t.stringLiteral(key)));
|
package/package.json
CHANGED