@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
- const has = new Set(obj.properties.flatMap((p) => (ast_helpers_1.t.isObjectProperty(p) && ast_helpers_1.t.isStringLiteral(p.key) ? [p.key.value] : [])));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babelize/engine",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Babelize translation pipeline (extract, keygen, translate, inject). Infrastructure is injected through provider/store interfaces.",
5
5
  "keywords": [
6
6
  "babelize",