@inlang/paraglide-js 2.27.0 → 2.28.0

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.
Files changed (171) hide show
  1. package/README.md +9 -0
  2. package/dist/bundler-plugins/per-locale-build/index.js +14 -7
  3. package/dist/bundler-plugins/per-locale-build/index.js.map +1 -1
  4. package/dist/bundler-plugins/per-locale-build/vite-environments.test.js +235 -2
  5. package/dist/bundler-plugins/per-locale-build/vite-environments.test.js.map +1 -1
  6. package/dist/bundler-plugins/unplugin.d.ts +1 -1
  7. package/dist/bundler-plugins/unplugin.js +79 -10
  8. package/dist/bundler-plugins/unplugin.js.map +1 -1
  9. package/dist/bundler-plugins/unplugin.test.js +334 -1
  10. package/dist/bundler-plugins/unplugin.test.js.map +1 -1
  11. package/dist/bundler-plugins/vite.js +2 -1
  12. package/dist/bundler-plugins/vite.js.map +1 -1
  13. package/dist/bundler-plugins/vite.test.js +1 -1
  14. package/dist/bundler-plugins/vite.test.js.map +1 -1
  15. package/dist/cli/commands/compile/command.js +13 -0
  16. package/dist/cli/commands/compile/command.js.map +1 -1
  17. package/dist/cli/commands/compile/command.test.js +87 -3
  18. package/dist/cli/commands/compile/command.test.js.map +1 -1
  19. package/dist/cli/commands/init/command.d.ts +5 -0
  20. package/dist/cli/commands/init/command.js +213 -59
  21. package/dist/cli/commands/init/command.js.map +1 -1
  22. package/dist/cli/commands/init/command.test.d.ts +1 -0
  23. package/dist/cli/commands/init/command.test.js +123 -0
  24. package/dist/cli/commands/init/command.test.js.map +1 -0
  25. package/dist/cli/init-options.d.ts +11 -0
  26. package/dist/cli/init-options.js +2 -0
  27. package/dist/cli/init-options.js.map +1 -0
  28. package/dist/cli/steps/add-inlang-check.js +2 -2
  29. package/dist/cli/steps/add-inlang-check.js.map +1 -1
  30. package/dist/cli/steps/add-message-lint.d.ts +34 -0
  31. package/dist/cli/steps/add-message-lint.js +105 -0
  32. package/dist/cli/steps/add-message-lint.js.map +1 -0
  33. package/dist/cli/steps/add-message-lint.test.d.ts +1 -0
  34. package/dist/cli/steps/add-message-lint.test.js +74 -0
  35. package/dist/cli/steps/add-message-lint.test.js.map +1 -0
  36. package/dist/cli/steps/add-vite-plugin.d.ts +18 -0
  37. package/dist/cli/steps/add-vite-plugin.js +34 -6
  38. package/dist/cli/steps/add-vite-plugin.js.map +1 -1
  39. package/dist/cli/steps/add-vite-plugin.test.js +25 -9
  40. package/dist/cli/steps/add-vite-plugin.test.js.map +1 -1
  41. package/dist/cli/steps/check-for-uncomitted-changes.d.ts +3 -0
  42. package/dist/cli/steps/check-for-uncomitted-changes.js +15 -3
  43. package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -1
  44. package/dist/cli/steps/detect-bundler.d.ts +1 -0
  45. package/dist/cli/steps/detect-bundler.js +7 -1
  46. package/dist/cli/steps/detect-bundler.js.map +1 -1
  47. package/dist/cli/steps/initialize-inlang-project.d.ts +4 -3
  48. package/dist/cli/steps/initialize-inlang-project.js +60 -157
  49. package/dist/cli/steps/initialize-inlang-project.js.map +1 -1
  50. package/dist/cli/steps/maybe-add-machine-translation.d.ts +4 -0
  51. package/dist/cli/steps/maybe-add-machine-translation.js +11 -6
  52. package/dist/cli/steps/maybe-add-machine-translation.js.map +1 -1
  53. package/dist/cli/steps/maybe-add-sherlock.d.ts +2 -0
  54. package/dist/cli/steps/maybe-add-sherlock.js +12 -6
  55. package/dist/cli/steps/maybe-add-sherlock.js.map +1 -1
  56. package/dist/cli/steps/maybe-add-sherlock.test.d.ts +1 -0
  57. package/dist/cli/steps/maybe-add-sherlock.test.js +44 -0
  58. package/dist/cli/steps/maybe-add-sherlock.test.js.map +1 -0
  59. package/dist/cli/steps/prompt-for-outdir.d.ts +2 -0
  60. package/dist/cli/steps/prompt-for-outdir.js +4 -0
  61. package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
  62. package/dist/cli/steps/update-package-json.js +8 -13
  63. package/dist/cli/steps/update-package-json.js.map +1 -1
  64. package/dist/cli/steps/update-ts-config.d.ts +6 -0
  65. package/dist/cli/steps/update-ts-config.js +27 -4
  66. package/dist/cli/steps/update-ts-config.js.map +1 -1
  67. package/dist/cli/utils.d.ts +2 -0
  68. package/dist/cli/utils.js +6 -0
  69. package/dist/cli/utils.js.map +1 -1
  70. package/dist/cli/utils.test.d.ts +1 -0
  71. package/dist/cli/utils.test.js +16 -0
  72. package/dist/cli/utils.test.js.map +1 -0
  73. package/dist/compiler/compile-annotation.js +6 -1
  74. package/dist/compiler/compile-annotation.js.map +1 -1
  75. package/dist/compiler/compile-bundle.d.ts +4 -0
  76. package/dist/compiler/compile-bundle.js +67 -2
  77. package/dist/compiler/compile-bundle.js.map +1 -1
  78. package/dist/compiler/compile-bundle.test.js +214 -1
  79. package/dist/compiler/compile-bundle.test.js.map +1 -1
  80. package/dist/compiler/compile-lifecycle.test.d.ts +1 -0
  81. package/dist/compiler/compile-lifecycle.test.js +69 -0
  82. package/dist/compiler/compile-lifecycle.test.js.map +1 -0
  83. package/dist/compiler/compile-local-variable.test.js +14 -14
  84. package/dist/compiler/compile-local-variable.test.js.map +1 -1
  85. package/dist/compiler/compile-message.exact-number.test.js +1 -1
  86. package/dist/compiler/compile-message.exact-number.test.js.map +1 -1
  87. package/dist/compiler/compile-message.locals.test.js +1 -1
  88. package/dist/compiler/compile-message.locals.test.js.map +1 -1
  89. package/dist/compiler/compile-message.test.js +2 -2
  90. package/dist/compiler/compile-message.test.js.map +1 -1
  91. package/dist/compiler/compile-pattern.test.js +5 -5
  92. package/dist/compiler/compile-pattern.test.js.map +1 -1
  93. package/dist/compiler/compile-project.js +1 -0
  94. package/dist/compiler/compile-project.js.map +1 -1
  95. package/dist/compiler/compile-project.test.js +94 -1
  96. package/dist/compiler/compile-project.test.js.map +1 -1
  97. package/dist/compiler/compile.js +36 -17
  98. package/dist/compiler/compile.js.map +1 -1
  99. package/dist/compiler/compile.test.js +70 -0
  100. package/dist/compiler/compile.test.js.map +1 -1
  101. package/dist/compiler/compiler-options.d.ts +41 -0
  102. package/dist/compiler/compiler-options.js.map +1 -1
  103. package/dist/compiler/output-structure/message-modules.js +1 -1
  104. package/dist/compiler/output-structure/message-modules.js.map +1 -1
  105. package/dist/compiler/registry.js +71 -13
  106. package/dist/compiler/registry.js.map +1 -1
  107. package/dist/compiler/registry.test.d.ts +1 -0
  108. package/dist/compiler/registry.test.js +291 -0
  109. package/dist/compiler/registry.test.js.map +1 -0
  110. package/dist/compiler/runtime/create-runtime.d.ts +2 -0
  111. package/dist/compiler/runtime/create-runtime.js +9 -0
  112. package/dist/compiler/runtime/create-runtime.js.map +1 -1
  113. package/dist/compiler/runtime/extract-locale-from-cookie.js +8 -1
  114. package/dist/compiler/runtime/extract-locale-from-cookie.js.map +1 -1
  115. package/dist/compiler/runtime/extract-locale-from-cookie.test.js +26 -0
  116. package/dist/compiler/runtime/extract-locale-from-cookie.test.js.map +1 -1
  117. package/dist/compiler/runtime/extract-locale-from-header.js +47 -5
  118. package/dist/compiler/runtime/extract-locale-from-header.js.map +1 -1
  119. package/dist/compiler/runtime/extract-locale-from-header.test.js +58 -0
  120. package/dist/compiler/runtime/extract-locale-from-header.test.js.map +1 -1
  121. package/dist/compiler/runtime/get-locale.js +7 -1
  122. package/dist/compiler/runtime/get-locale.js.map +1 -1
  123. package/dist/compiler/runtime/get-locale.test.js +95 -0
  124. package/dist/compiler/runtime/get-locale.test.js.map +1 -1
  125. package/dist/compiler/runtime/localize-href.d.ts +8 -0
  126. package/dist/compiler/runtime/localize-href.js +60 -0
  127. package/dist/compiler/runtime/localize-href.js.map +1 -1
  128. package/dist/compiler/runtime/localize-href.test.js +227 -1
  129. package/dist/compiler/runtime/localize-href.test.js.map +1 -1
  130. package/dist/compiler/runtime/set-locale.js +24 -6
  131. package/dist/compiler/runtime/set-locale.js.map +1 -1
  132. package/dist/compiler/runtime/set-locale.test.js +182 -0
  133. package/dist/compiler/runtime/set-locale.test.js.map +1 -1
  134. package/dist/compiler/runtime/type.d.ts +2 -0
  135. package/dist/compiler/runtime/type.js.map +1 -1
  136. package/dist/compiler/runtime/type.test.js +34 -0
  137. package/dist/compiler/runtime/type.test.js.map +1 -1
  138. package/dist/compiler/runtime/variables.d.ts +2 -0
  139. package/dist/compiler/runtime/variables.js +7 -0
  140. package/dist/compiler/runtime/variables.js.map +1 -1
  141. package/dist/compiler/server/middleware.d.ts +8 -2
  142. package/dist/compiler/server/middleware.js +175 -7
  143. package/dist/compiler/server/middleware.js.map +1 -1
  144. package/dist/compiler/server/middleware.test.js +750 -3
  145. package/dist/compiler/server/middleware.test.js.map +1 -1
  146. package/dist/eslint/index.d.ts +4 -0
  147. package/dist/eslint/index.js +8 -0
  148. package/dist/eslint/index.js.map +1 -0
  149. package/dist/eslint/no-dynamic-message-access.d.ts +3 -0
  150. package/dist/eslint/no-dynamic-message-access.js +150 -0
  151. package/dist/eslint/no-dynamic-message-access.js.map +1 -0
  152. package/dist/eslint/no-dynamic-message-access.test.d.ts +1 -0
  153. package/dist/eslint/no-dynamic-message-access.test.js +126 -0
  154. package/dist/eslint/no-dynamic-message-access.test.js.map +1 -0
  155. package/dist/eslint/oxlint.test.d.ts +1 -0
  156. package/dist/eslint/oxlint.test.js +64 -0
  157. package/dist/eslint/oxlint.test.js.map +1 -0
  158. package/dist/services/config/config-schema.d.ts +2 -0
  159. package/dist/services/config/config-schema.js +2 -0
  160. package/dist/services/config/config-schema.js.map +1 -1
  161. package/dist/services/config/load-paraglide-config.test.js +12 -0
  162. package/dist/services/config/load-paraglide-config.test.js.map +1 -1
  163. package/dist/services/env-variables/index.js +1 -1
  164. package/dist/services/env-variables/index.js.map +1 -1
  165. package/dist/services/file-handling/write-output.bench.js +51 -11
  166. package/dist/services/file-handling/write-output.bench.js.map +1 -1
  167. package/dist/services/file-handling/write-output.js +60 -20
  168. package/dist/services/file-handling/write-output.js.map +1 -1
  169. package/dist/services/file-handling/write-output.test.js +175 -0
  170. package/dist/services/file-handling/write-output.test.js.map +1 -1
  171. package/package.json +14 -4
@@ -1 +1 @@
1
- {"version":3,"file":"compile-message.exact-number.test.js","sourceRoot":"","sources":["../../src/compiler/compile-message.exact-number.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAUhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAAC,IAK/B;IACA,MAAM,OAAO,GAAY;QACxB,EAAE,EAAE,YAAY;QAChB,QAAQ,EAAE,eAAe;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,EAAE,oBAAoB;YAC1B,IAAI;SACJ,CAAC,CAAC;KACH,CAAC;IACF,MAAM,QAAQ,GAAc,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAClE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,GAAG,OAAO;KACV,CAAC,CAAC,CAAC;IACJ,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtE,MAAM,MAAM,GACX,cAAc,EAAE;QAChB,iCAAiC;QACjC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAC1B,8BAA8B,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM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C,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test } from \"vitest\";\nimport type {\n\tBundleNested,\n\tDeclaration,\n\tMatch,\n\tMessage,\n\tPattern,\n\tProjectSettings,\n\tVariant,\n} from \"@inlang/sdk\";\nimport { compileMessage } from \"./compile-message.js\";\nimport { compileBundle } from \"./compile-bundle.js\";\nimport { createRegistry } from \"./registry.js\";\nimport { toSafeModuleId } from \"./safe-module-id.js\";\n\n/**\n * Compiles a message and imports it together with an inlined registry so the\n * generated code can be executed.\n */\nasync function compileAndImport(args: {\n\tdeclarations: Declaration[];\n\tselectors: string[];\n\tlocale: string;\n\tvariants: Array<{ matches: Match[]; pattern: Pattern }>;\n}) {\n\tconst message: Message = {\n\t\tid: \"message-id\",\n\t\tbundleId: \"exact_message\",\n\t\tlocale: args.locale,\n\t\tselectors: args.selectors.map((name) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname,\n\t\t})),\n\t};\n\tconst variants: Variant[] = args.variants.map((variant, index) => ({\n\t\tid: String(index),\n\t\tmessageId: message.id,\n\t\t...variant,\n\t}));\n\tconst compiled = compileMessage(args.declarations, message, variants);\n\tconst source =\n\t\tcreateRegistry() +\n\t\t\"\\nexport const exact_message = \" +\n\t\tcompiled.code.replaceAll(\"registry.\", \"\");\n\tconst module = await import(\n\t\t\"data:text/javascript;base64,\" + Buffer.from(source).toString(\"base64\")\n\t);\n\treturn {\n\t\tcode: compiled.code,\n\t\tmessage: module.exact_message as (\n\t\t\tinputs: Record<string, unknown>\n\t\t) => string,\n\t};\n}\n\nconst literal = (key: string, value: string): Match => ({\n\ttype: \"literal-match\",\n\tkey,\n\tvalue,\n});\nconst catchall = (key: string): Match => ({ type: \"catchall-match\", key });\nconst text = (value: string): Pattern => [{ type: \"text\", value }];\nconst withCount = (before: string, after = \"\"): Pattern => [\n\t{ type: \"text\", value: before },\n\t{ type: \"expression\", arg: { type: \"variable-reference\", name: \"count\" } },\n\t{ type: \"text\", value: after },\n];\n\n/**\n * The shape inlang's ICU MessageFormat 1 plugin imports\n * `{count, plural, =0 {…} one {…} other {…}}` as, and the shape editors create\n * when a user adds an exact number to a plural message.\n */\nconst icuDeclarations = (): Declaration[] => [\n\t{ type: \"input-variable\", name: \"count\" },\n\t{\n\t\ttype: \"local-variable\",\n\t\tname: \"countPluralExact\",\n\t\tvalue: {\n\t\t\ttype: \"expression\",\n\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t},\n\t},\n\t{\n\t\ttype: \"local-variable\",\n\t\tname: \"countPlural\",\n\t\tvalue: {\n\t\t\ttype: \"expression\",\n\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\tannotation: { type: \"function-reference\", name: \"plural\", options: [] },\n\t\t},\n\t},\n];\nconst icuSelectors = [\"countPluralExact\", \"countPlural\"];\n\n/** ICU `=N {…}` */\nconst exact = (value: string, pattern: Pattern) => ({\n\tmatches: [literal(\"countPluralExact\", value), catchall(\"countPlural\")],\n\tpattern,\n});\n/** ICU `one {…}`, `few {…}`, ... */\nconst category = (value: string, pattern: Pattern) => ({\n\tmatches: [catchall(\"countPluralExact\"), literal(\"countPlural\", value)],\n\tpattern,\n});\n/** ICU `other {…}` */\nconst other = (pattern: Pattern) => ({\n\tmatches: [catchall(\"countPluralExact\"), catchall(\"countPlural\")],\n\tpattern,\n});\n\nconst render = (\n\tmessage: (inputs: Record<string, unknown>) => string,\n\tcounts: unknown[]\n) =>\n\tObject.fromEntries(\n\t\tcounts.map((count) => [String(JSON.stringify(count)), message({ count })])\n\t);\n\nconst COUNTS = [0, 1, 2, 5, 21, \"0\"];\n\ndescribe(\"exact number matches on un-annotated local aliases (ICU =N)\", () => {\n\ttest(\"en: =0, one, other\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"No items\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" item\")),\n\t\t\t\tother(withCount(\"\", \" items\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\n\t\t\t'(countPluralExact === 0 || countPluralExact === \"0\")'\n\t\t);\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"No items\",\n\t\t\t\"1\": \"1 item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"5\": \"5 items\",\n\t\t\t\"21\": \"21 items\",\n\t\t\t'\"0\"': \"No items\",\n\t\t});\n\t});\n\n\ttest(\"en: =1 wins over one and matches the string '1'\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"No items\")),\n\t\t\t\texact(\"1\", text(\"Exactly one item\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" item\")),\n\t\t\t\tother(withCount(\"\", \" items\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, [...COUNTS, \"1\"])).toEqual({\n\t\t\t\"0\": \"No items\",\n\t\t\t\"1\": \"Exactly one item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"5\": \"5 items\",\n\t\t\t\"21\": \"21 items\",\n\t\t\t'\"0\"': \"No items\",\n\t\t\t'\"1\"': \"Exactly one item\",\n\t\t});\n\t});\n\n\ttest(\"fr: =0 wins over one, which covers 0 in French\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"Aucun élément\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" élément\")),\n\t\t\t\tother(withCount(\"\", \" éléments\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Aucun élément\",\n\t\t\t\"1\": \"1 élément\",\n\t\t\t\"2\": \"2 éléments\",\n\t\t\t\"5\": \"5 éléments\",\n\t\t\t\"21\": \"21 éléments\",\n\t\t\t'\"0\"': \"Aucun élément\",\n\t\t});\n\t});\n\n\ttest(\"fr: variant preference follows selector order, not storage order\", async () => {\n\t\t// editors append the exact variant after the existing plural variants\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\tother(withCount(\"\", \" éléments\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" élément\")),\n\t\t\t\texact(\"0\", text(\"Aucun élément\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Aucun élément\",\n\t\t\t\"1\": \"1 élément\",\n\t\t\t\"2\": \"2 éléments\",\n\t\t\t\"5\": \"5 éléments\",\n\t\t\t\"21\": \"21 éléments\",\n\t\t\t'\"0\"': \"Aucun élément\",\n\t\t});\n\t});\n\n\ttest(\"ru: =0 and =1 next to one/few/many/other\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"ru\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"Нет файлов\")),\n\t\t\t\texact(\"1\", text(\"Ровно один файл\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" файл\")),\n\t\t\t\tcategory(\"few\", withCount(\"\", \" файла\")),\n\t\t\t\tcategory(\"many\", withCount(\"\", \" файлов\")),\n\t\t\t\tother(withCount(\"\", \" файла (other)\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Нет файлов\",\n\t\t\t\"1\": \"Ровно один файл\",\n\t\t\t\"2\": \"2 файла\",\n\t\t\t\"5\": \"5 файлов\",\n\t\t\t\"21\": \"21 файл\",\n\t\t\t'\"0\"': \"Нет файлов\",\n\t\t});\n\t});\n\n\ttest(\"ja: =0 and =1 in a locale with only the other category\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"ja\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"アイテムなし\")),\n\t\t\t\texact(\"1\", text(\"アイテム1つだけ\")),\n\t\t\t\tother(withCount(\"アイテム\", \"個\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"アイテムなし\",\n\t\t\t\"1\": \"アイテム1つだけ\",\n\t\t\t\"2\": \"アイテム2個\",\n\t\t\t\"5\": \"アイテム5個\",\n\t\t\t\"21\": \"アイテム21個\",\n\t\t\t'\"0\"': \"アイテムなし\",\n\t\t});\n\t});\n\n\ttest(\"exact numbers nested inside a select\", async () => {\n\t\t// {gender, select, female {{count, plural, =0 {…} one {…} other {…}}} other {…}}\n\t\tconst declarations: Declaration[] = [\n\t\t\t{ type: \"input-variable\", name: \"gender\" },\n\t\t\t...icuDeclarations(),\n\t\t];\n\t\tconst nested = (\n\t\t\tgender: Match,\n\t\t\tvariant: { matches: Match[]; pattern: Pattern }\n\t\t) => ({ ...variant, matches: [gender, ...variant.matches] });\n\t\tconst female = literal(\"gender\", \"female\");\n\t\tconst anyGender = catchall(\"gender\");\n\n\t\tfor (const locale of [\"en\", \"fr\"]) {\n\t\t\tconst { message } = await compileAndImport({\n\t\t\t\tlocale,\n\t\t\t\tdeclarations,\n\t\t\t\tselectors: [\"gender\", ...icuSelectors],\n\t\t\t\tvariants: [\n\t\t\t\t\tnested(female, exact(\"0\", text(\"She has none\"))),\n\t\t\t\t\tnested(female, category(\"one\", withCount(\"She has \", \" (one)\"))),\n\t\t\t\t\tnested(female, other(withCount(\"She has \", \" (other)\"))),\n\t\t\t\t\tnested(anyGender, exact(\"0\", text(\"They have none\"))),\n\t\t\t\t\tnested(anyGender, category(\"one\", withCount(\"They have \", \" (one)\"))),\n\t\t\t\t\tnested(anyGender, other(withCount(\"They have \", \" (other)\"))),\n\t\t\t\t],\n\t\t\t});\n\n\t\t\tconst results = (gender: string) =>\n\t\t\t\tCOUNTS.map((count) => message({ gender, count }));\n\t\t\t// =0 wins in both locales, also where French `one` covers 0\n\t\t\texpect(results(\"female\")).toEqual([\n\t\t\t\t\"She has none\",\n\t\t\t\t\"She has 1 (one)\",\n\t\t\t\t\"She has 2 (other)\",\n\t\t\t\t\"She has 5 (other)\",\n\t\t\t\t\"She has 21 (other)\",\n\t\t\t\t\"She has none\",\n\t\t\t]);\n\t\t\texpect(results(\"male\")).toEqual([\n\t\t\t\t\"They have none\",\n\t\t\t\t\"They have 1 (one)\",\n\t\t\t\t\"They have 2 (other)\",\n\t\t\t\t\"They have 5 (other)\",\n\t\t\t\t\"They have 21 (other)\",\n\t\t\t\t\"They have none\",\n\t\t\t]);\n\t\t}\n\t});\n\n\ttest(\"resolves chains of un-annotated aliases\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"countAlias\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"countAliasAlias\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"countAlias\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"countPlural\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\tname: \"plural\",\n\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tselectors: [\"countAliasAlias\", \"countPlural\"],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"countAliasAlias\"), literal(\"countPlural\", \"one\")],\n\t\t\t\t\tpattern: text(\"one\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [literal(\"countAliasAlias\", \"0\"), catchall(\"countPlural\")],\n\t\t\t\t\tpattern: text(\"zero\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"countAliasAlias\"), catchall(\"countPlural\")],\n\t\t\t\t\tpattern: text(\"other\"),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\n\t\t\t'(countAliasAlias === 0 || countAliasAlias === \"0\")'\n\t\t);\n\t\texpect(COUNTS.map((count) => message({ count }))).toEqual([\n\t\t\t\"zero\",\n\t\t\t\"one\",\n\t\t\t\"other\",\n\t\t\t\"other\",\n\t\t\t\"other\",\n\t\t\t\"zero\",\n\t\t]);\n\t});\n\n\ttest(\"annotated locals and literal locals keep string matching\", async () => {\n\t\tconst { code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"formatted\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// aliases the formatted string, not the input\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"formattedAlias\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"formatted\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"constant\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"literal\", value: \"0\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tselectors: [\"formatted\", \"formattedAlias\", \"constant\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [literal(\"formatted\", \"0\")], pattern: text(\"a\") },\n\t\t\t\t{ matches: [literal(\"formattedAlias\", \"0\")], pattern: text(\"b\") },\n\t\t\t\t{ matches: [literal(\"constant\", \"0\")], pattern: text(\"c\") },\n\t\t\t\t{ matches: [], pattern: text(\"d\") },\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain('if (formatted === \"0\")');\n\t\texpect(code).toContain('if (formattedAlias === \"0\")');\n\t\texpect(code).toContain('if (constant === \"0\")');\n\t});\n});\n\ndescribe(\"exact number matches on the input itself (i18next _zero import)\", () => {\n\t// i18next `key_zero`, `key_one`, `key_other` import as selectors\n\t// `count` (exact 0) and `countPlural`. `_zero` also becomes the Intl `zero`\n\t// category variant. Variants are listed in import order.\n\tconst declarations = (): Declaration[] => [\n\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t{\n\t\t\ttype: \"local-variable\",\n\t\t\tname: \"countPlural\",\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\tannotation: { type: \"function-reference\", name: \"plural\", options: [] },\n\t\t\t},\n\t\t},\n\t];\n\tconst variants = (zero: string, one: Pattern, others: Pattern) => [\n\t\t{\n\t\t\tmatches: [catchall(\"count\"), literal(\"countPlural\", \"one\")],\n\t\t\tpattern: one,\n\t\t},\n\t\t{\n\t\t\tmatches: [catchall(\"count\"), literal(\"countPlural\", \"other\")],\n\t\t\tpattern: others,\n\t\t},\n\t\t{\n\t\t\tmatches: [literal(\"count\", \"0\"), catchall(\"countPlural\")],\n\t\t\tpattern: text(zero),\n\t\t},\n\t\t{\n\t\t\tmatches: [catchall(\"count\"), literal(\"countPlural\", \"zero\")],\n\t\t\tpattern: text(zero),\n\t\t},\n\t];\n\n\ttest(\"en\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: declarations(),\n\t\t\tselectors: [\"count\", \"countPlural\"],\n\t\t\tvariants: variants(\n\t\t\t\t\"No items\",\n\t\t\t\twithCount(\"\", \" item\"),\n\t\t\t\twithCount(\"\", \" items\")\n\t\t\t),\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"No items\",\n\t\t\t\"1\": \"1 item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"5\": \"5 items\",\n\t\t\t\"21\": \"21 items\",\n\t\t\t'\"0\"': \"No items\",\n\t\t});\n\t});\n\n\ttest(\"fr: exact 0 wins over one\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: declarations(),\n\t\t\tselectors: [\"count\", \"countPlural\"],\n\t\t\tvariants: variants(\n\t\t\t\t\"Aucun élément\",\n\t\t\t\twithCount(\"\", \" élément\"),\n\t\t\t\twithCount(\"\", \" éléments\")\n\t\t\t),\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Aucun élément\",\n\t\t\t\"1\": \"1 élément\",\n\t\t\t\"2\": \"2 éléments\",\n\t\t\t\"5\": \"5 éléments\",\n\t\t\t\"21\": \"21 éléments\",\n\t\t\t'\"0\"': \"Aucun élément\",\n\t\t});\n\t});\n});\n\ndescribe(\"variant preference follows selector order\", () => {\n\ttest(\"literal keys win over catchalls selector by selector, not by storage order\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"platform\" },\n\t\t\t\t{ type: \"input-variable\", name: \"gender\" },\n\t\t\t],\n\t\t\tselectors: [\"platform\", \"gender\"],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"platform\"), literal(\"gender\", \"male\")],\n\t\t\t\t\tpattern: text(\"*,male\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [literal(\"platform\", \"android\"), catchall(\"gender\")],\n\t\t\t\t\tpattern: text(\"android,*\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"platform\"), catchall(\"gender\")],\n\t\t\t\t\tpattern: text(\"*,*\"),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(message({ platform: \"android\", gender: \"male\" })).toBe(\"android,*\");\n\t\texpect(message({ platform: \"ios\", gender: \"male\" })).toBe(\"*,male\");\n\t\texpect(message({ platform: \"ios\", gender: \"female\" })).toBe(\"*,*\");\n\t});\n\n\ttest(\"an ICU select with `other` stored first still reaches the other cases\", async () => {\n\t\t// {gender, select, other {They} female {She} male {He}}\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: [{ type: \"input-variable\", name: \"gender\" }],\n\t\t\tselectors: [\"gender\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [catchall(\"gender\")], pattern: text(\"They\") },\n\t\t\t\t{ matches: [literal(\"gender\", \"female\")], pattern: text(\"She\") },\n\t\t\t\t{ matches: [literal(\"gender\", \"male\")], pattern: text(\"He\") },\n\t\t\t],\n\t\t});\n\n\t\texpect(message({ gender: \"female\" })).toBe(\"She\");\n\t\texpect(message({ gender: \"male\" })).toBe(\"He\");\n\t\texpect(message({ gender: \"other\" })).toBe(\"They\");\n\t});\n});\n\ndescribe(\"input match types with alias matches\", () => {\n\tconst statusBundle = (fr: Array<{ matches: Match[]; pattern: Pattern }>) => {\n\t\tconst bundle: BundleNested = {\n\t\t\tid: \"status_message\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"status\" },\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"statusExact\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"status\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tmessages: [\n\t\t\t\t{\n\t\t\t\t\tid: \"en-id\",\n\t\t\t\t\tbundle_id: \"status_message\",\n\t\t\t\t\tlocale: \"en\",\n\t\t\t\t\tselectors: [{ type: \"variable-reference\", name: \"status\" }],\n\t\t\t\t\tvariants: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\t\tmessage_id: \"en-id\",\n\t\t\t\t\t\t\tmatches: [literal(\"status\", \"active\")],\n\t\t\t\t\t\t\tpattern: text(\"Active\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"fr-id\",\n\t\t\t\t\tbundle_id: \"status_message\",\n\t\t\t\t\tlocale: \"fr\",\n\t\t\t\t\tselectors: [{ type: \"variable-reference\", name: \"statusExact\" }],\n\t\t\t\t\tvariants: fr.map((variant, index) => ({\n\t\t\t\t\t\tid: `fr-${index}`,\n\t\t\t\t\t\tmessage_id: \"fr-id\",\n\t\t\t\t\t\t...variant,\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn compileBundle({\n\t\t\tfallbackMap: { en: \"en\", fr: \"fr\" },\n\t\t\tbundle,\n\t\t\tmessageReferenceExpression: (locale) =>\n\t\t\t\t`${toSafeModuleId(locale)}.status_message`,\n\t\t\tsettings: { locales: [\"en\", \"fr\"] } as ProjectSettings,\n\t\t}).matchTypes.get(\"status\");\n\t};\n\n\ttest(\"alias literal matches widen an input type narrowed by direct matches\", () => {\n\t\tconst info = statusBundle([\n\t\t\t{ matches: [literal(\"statusExact\", \"0\")], pattern: text(\"Zéro\") },\n\t\t]);\n\n\t\texpect(info?.literals).toEqual(new Set([\"active\", \"0\"]));\n\t\texpect(info?.hasCatchAll).toBe(false);\n\t});\n\n\ttest(\"an alias catchall widens the input type to any value\", () => {\n\t\tconst info = statusBundle([\n\t\t\t{ matches: [literal(\"statusExact\", \"0\")], pattern: text(\"Zéro\") },\n\t\t\t{ matches: [catchall(\"statusExact\")], pattern: text(\"Autre\") },\n\t\t]);\n\n\t\t// status: \"inactive\" must type-check, fr handles any status\n\t\texpect(info?.hasCatchAll).toBe(true);\n\t});\n});\n\ndescribe(\"ICU plural offset (`{count, plural, offset:1 …}`)\", () => {\n\t/**\n\t * The shape inlang's ICU MessageFormat 1 plugin imports\n\t * `{count, plural, offset:1 =0 {…} =1 {…} one {…} other {…}}` as.\n\t */\n\tconst offsetDeclarations = (offset = \"1\"): Declaration[] => [\n\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t{\n\t\t\ttype: \"local-variable\",\n\t\t\tname: \"countPluralOffset1\",\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\tannotation: {\n\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\tname: \"plural\",\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{ name: \"offset\", value: { type: \"literal\", value: offset } },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"local-variable\",\n\t\t\tname: \"countPluralOffset1Exact\",\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t},\n\t\t},\n\t];\n\tconst offsetSelectors = [\"countPluralOffset1Exact\", \"countPluralOffset1\"];\n\tconst exactOffset = (value: string, pattern: Pattern) => ({\n\t\tmatches: [\n\t\t\tliteral(\"countPluralOffset1Exact\", value),\n\t\t\tcatchall(\"countPluralOffset1\"),\n\t\t],\n\t\tpattern,\n\t});\n\tconst categoryOffset = (value: string, pattern: Pattern) => ({\n\t\tmatches: [\n\t\t\tcatchall(\"countPluralOffset1Exact\"),\n\t\t\tliteral(\"countPluralOffset1\", value),\n\t\t],\n\t\tpattern,\n\t});\n\tconst otherOffset = (pattern: Pattern) => ({\n\t\tmatches: [\n\t\t\tcatchall(\"countPluralOffset1Exact\"),\n\t\t\tcatchall(\"countPluralOffset1\"),\n\t\t],\n\t\tpattern,\n\t});\n\n\ttest(\"en: the category is selected on count - offset, exact matches on count\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: offsetDeclarations(),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\texactOffset(\"0\", text(\"Nobody\")),\n\t\t\t\texactOffset(\"1\", text(\"Only you\")),\n\t\t\t\tcategoryOffset(\"one\", text(\"You and one other\")),\n\t\t\t\totherOffset(text(\"You and others\")),\n\t\t\t],\n\t\t});\n\n\t\t// a number, not the string \"1\"\n\t\texpect(code).toContain('registry.plural(\"en\", i?.count, { offset: 1 })');\n\t\texpect(render(message, [0, 1, 2, 3, 22, \"1\", \"2\"])).toEqual({\n\t\t\t\"0\": \"Nobody\",\n\t\t\t\"1\": \"Only you\",\n\t\t\t// 2 - 1 = 1 is \"one\"\n\t\t\t\"2\": \"You and one other\",\n\t\t\t\"3\": \"You and others\",\n\t\t\t\"22\": \"You and others\",\n\t\t\t'\"1\"': \"Only you\",\n\t\t\t'\"2\"': \"You and one other\",\n\t\t});\n\t});\n\n\ttest(\"ru: one/few/many follow count - offset\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"ru\",\n\t\t\tdeclarations: offsetDeclarations(),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\texactOffset(\"1\", text(\"only you\")),\n\t\t\t\tcategoryOffset(\"one\", text(\"one\")),\n\t\t\t\tcategoryOffset(\"few\", text(\"few\")),\n\t\t\t\tcategoryOffset(\"many\", text(\"many\")),\n\t\t\t\totherOffset(text(\"other\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, [1, 2, 3, 6, 22, 23])).toEqual({\n\t\t\t\"1\": \"only you\",\n\t\t\t\"2\": \"one\", // 1\n\t\t\t\"3\": \"few\", // 2\n\t\t\t\"6\": \"many\", // 5\n\t\t\t\"22\": \"one\", // 21\n\t\t\t\"23\": \"few\", // 22\n\t\t});\n\t});\n\n\ttest(\"an offset of 0 and no offset select the same category\", async () => {\n\t\tconst withZero = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: offsetDeclarations(\"0\"),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\tcategoryOffset(\"one\", text(\"one\")),\n\t\t\t\totherOffset(text(\"other\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(withZero.message, [0, 1, 2])).toEqual({\n\t\t\t\"0\": \"other\",\n\t\t\t\"1\": \"one\",\n\t\t\t\"2\": \"other\",\n\t\t});\n\t});\n\n\ttest(\"a non-numeric offset fails compilation\", async () => {\n\t\tawait expect(\n\t\t\tcompileAndImport({\n\t\t\t\tlocale: \"en\",\n\t\t\t\tdeclarations: offsetDeclarations(\"one\"),\n\t\t\t\tselectors: offsetSelectors,\n\t\t\t\tvariants: [\n\t\t\t\t\tcategoryOffset(\"one\", text(\"one\")),\n\t\t\t\t\totherOffset(text(\"other\")),\n\t\t\t\t],\n\t\t\t})\n\t\t).rejects.toThrow('Invalid \"plural\" offset \"one\". Expected a number.');\n\t});\n\n\ttest(\"registry.plural subtracts the offset and ignores it otherwise\", async () => {\n\t\tconst registry = await import(\n\t\t\t\"data:text/javascript;base64,\" +\n\t\t\t\tBuffer.from(createRegistry()).toString(\"base64\")\n\t\t);\n\n\t\texpect(registry.plural(\"en\", 2, { offset: 1 })).toBe(\"one\");\n\t\texpect(registry.plural(\"en\", 1, { offset: 1 })).toBe(\"other\");\n\t\texpect(registry.plural(\"en\", 1, {})).toBe(\"one\");\n\t\texpect(registry.plural(\"en\", 1)).toBe(\"one\");\n\t\texpect(registry.plural(\"en\", 3, { type: \"ordinal\", offset: 1 })).toBe(\n\t\t\t\"two\"\n\t\t);\n\t});\n\n\tconst pound = (offset?: string): Pattern[number] => ({\n\t\ttype: \"expression\",\n\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\tannotation: {\n\t\t\ttype: \"function-reference\",\n\t\t\tname: \"icu:pound\",\n\t\t\toptions:\n\t\t\t\toffset === undefined\n\t\t\t\t\t? []\n\t\t\t\t\t: [{ name: \"offset\", value: { type: \"literal\", value: offset } }],\n\t\t},\n\t});\n\n\ttest(\"# displays count - offset, formatted like number()\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: offsetDeclarations(),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\texactOffset(\"0\", text(\"Nobody\")),\n\t\t\t\texactOffset(\"1\", text(\"You\")),\n\t\t\t\tcategoryOffset(\"one\", [\n\t\t\t\t\t{ type: \"text\", value: \"You and \" },\n\t\t\t\t\tpound(\"1\"),\n\t\t\t\t\t{ type: \"text\", value: \" other\" },\n\t\t\t\t]),\n\t\t\t\totherOffset([\n\t\t\t\t\t{ type: \"text\", value: \"You and \" },\n\t\t\t\t\tpound(\"1\"),\n\t\t\t\t\t{ type: \"text\", value: \" others\" },\n\t\t\t\t]),\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain('registry.icuPound(\"en\", i?.count, { offset: 1 })');\n\t\texpect(render(message, [0, 1, 2, 3, 1234, \"2\"])).toEqual({\n\t\t\t\"0\": \"Nobody\",\n\t\t\t\"1\": \"You\",\n\t\t\t\"2\": \"You and 1 other\",\n\t\t\t\"3\": \"You and 2 others\",\n\t\t\t\"1234\": \"You and 1,233 others\",\n\t\t\t'\"2\"': \"You and 1 other\",\n\t\t});\n\t});\n\n\ttest(\"# without an offset displays count, formatted like number()\", async () => {\n\t\tconst variants = [\n\t\t\tcategory(\"one\", [pound(), { type: \"text\", value: \" item\" }]),\n\t\t\tother([pound(), { type: \"text\", value: \" items\" }]),\n\t\t];\n\t\tconst en = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants,\n\t\t});\n\t\tconst de = await compileAndImport({\n\t\t\tlocale: \"de\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants,\n\t\t});\n\n\t\texpect(en.code).toContain('registry.icuPound(\"en\", i?.count, {})');\n\t\texpect(render(en.message, [1, 2, 1234, 1.5])).toEqual({\n\t\t\t\"1\": \"1 item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"1234\": \"1,234 items\",\n\t\t\t\"1.5\": \"1.5 items\",\n\t\t});\n\t\texpect(de.message({ count: 1234 })).toBe(\"1.234 items\");\n\t});\n\n\ttest(\"a non-numeric # offset fails compilation\", async () => {\n\t\tawait expect(\n\t\t\tcompileAndImport({\n\t\t\t\tlocale: \"en\",\n\t\t\t\tdeclarations: offsetDeclarations(),\n\t\t\t\tselectors: offsetSelectors,\n\t\t\t\tvariants: [otherOffset([pound(\"x\")])],\n\t\t\t})\n\t\t).rejects.toThrow('Invalid \"icu:pound\" offset \"x\". Expected a number.');\n\t});\n\n\ttest(\"registry.icuPound subtracts the offset and formats like number()\", async () => {\n\t\tconst registry = await import(\n\t\t\t\"data:text/javascript;base64,\" +\n\t\t\t\tBuffer.from(createRegistry()).toString(\"base64\")\n\t\t);\n\n\t\texpect(registry.icuPound(\"en\", 1234, { offset: 1 })).toBe(\"1,233\");\n\t\texpect(registry.icuPound(\"en\", 1234, {})).toBe(\n\t\t\tregistry.number(\"en\", 1234, {})\n\t\t);\n\t\texpect(registry.icuPound(\"en\", \"3\")).toBe(\"3\");\n\t});\n\n\ttest(\"# displays an input that is not a number as is, without the offset\", async () => {\n\t\tconst registry = await import(\n\t\t\t\"data:text/javascript;base64,\" +\n\t\t\t\tBuffer.from(createRegistry()).toString(\"base64\")\n\t\t);\n\t\tconst pound = (input: unknown) =>\n\t\t\tregistry.icuPound(\"en\", input, { offset: 1 });\n\n\t\t// numbers and numeric strings are offset and formatted\n\t\texpect(pound(1234)).toBe(\"1,233\");\n\t\texpect(pound(\"1234\")).toBe(\"1,233\");\n\t\texpect(pound(\" 3 \")).toBe(\"2\");\n\t\t// anything else is displayed like a plain {count} placeholder\n\t\texpect(pound(\"abc\")).toBe(\"abc\");\n\t\texpect(pound(\"1,234\")).toBe(\"1,234\");\n\t\texpect(pound(\"\")).toBe(\"\");\n\t\texpect(pound(undefined)).toBe(\"undefined\");\n\t\texpect(pound(null)).toBe(\"null\");\n\t\texpect(pound(true)).toBe(\"true\");\n\t\texpect(pound(Number.NaN)).toBe(\"NaN\");\n\t\texpect(pound(Infinity)).toBe(\"Infinity\");\n\t});\n});\n"]}
1
+ {"version":3,"file":"compile-message.exact-number.test.js","sourceRoot":"","sources":["../../src/compiler/compile-message.exact-number.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAUhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAAC,IAK/B;IACA,MAAM,OAAO,GAAY;QACxB,EAAE,EAAE,YAAY;QAChB,QAAQ,EAAE,eAAe;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,EAAE,oBAAoB;YAC1B,IAAI;SACJ,CAAC,CAAC;KACH,CAAC;IACF,MAAM,QAAQ,GAAc,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAClE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,GAAG,OAAO;KACV,CAAC,CAAC,CAAC;IACJ,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtE,MAAM,MAAM,GACX,cAAc,EAAE;QAChB,iCAAiC;QACjC,QAAQ,CAAC,IAAI,CAAC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C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test } from \"vitest\";\nimport type {\n\tBundleNested,\n\tDeclaration,\n\tMatch,\n\tMessage,\n\tPattern,\n\tProjectSettings,\n\tVariant,\n} from \"@inlang/sdk\";\nimport { compileMessage } from \"./compile-message.js\";\nimport { compileBundle } from \"./compile-bundle.js\";\nimport { createRegistry } from \"./registry.js\";\nimport { toSafeModuleId } from \"./safe-module-id.js\";\n\n/**\n * Compiles a message and imports it together with an inlined registry so the\n * generated code can be executed.\n */\nasync function compileAndImport(args: {\n\tdeclarations: Declaration[];\n\tselectors: string[];\n\tlocale: string;\n\tvariants: Array<{ matches: Match[]; pattern: Pattern }>;\n}) {\n\tconst message: Message = {\n\t\tid: \"message-id\",\n\t\tbundleId: \"exact_message\",\n\t\tlocale: args.locale,\n\t\tselectors: args.selectors.map((name) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname,\n\t\t})),\n\t};\n\tconst variants: Variant[] = args.variants.map((variant, index) => ({\n\t\tid: String(index),\n\t\tmessageId: message.id,\n\t\t...variant,\n\t}));\n\tconst compiled = compileMessage(args.declarations, message, variants);\n\tconst source =\n\t\tcreateRegistry() +\n\t\t\"\\nexport const exact_message = \" +\n\t\tcompiled.code.replaceAll(\"registry.\", \"\");\n\tconst module = await import(\n\t\t\"data:text/javascript;base64,\" + Buffer.from(source).toString(\"base64\")\n\t);\n\treturn {\n\t\tcode: compiled.code,\n\t\tmessage: module.exact_message as (\n\t\t\tinputs: Record<string, unknown>\n\t\t) => string,\n\t};\n}\n\nconst literal = (key: string, value: string): Match => ({\n\ttype: \"literal-match\",\n\tkey,\n\tvalue,\n});\nconst catchall = (key: string): Match => ({ type: \"catchall-match\", key });\nconst text = (value: string): Pattern => [{ type: \"text\", value }];\nconst withCount = (before: string, after = \"\"): Pattern => [\n\t{ type: \"text\", value: before },\n\t{ type: \"expression\", arg: { type: \"variable-reference\", name: \"count\" } },\n\t{ type: \"text\", value: after },\n];\n\n/**\n * The shape inlang's ICU MessageFormat 1 plugin imports\n * `{count, plural, =0 {…} one {…} other {…}}` as, and the shape editors create\n * when a user adds an exact number to a plural message.\n */\nconst icuDeclarations = (): Declaration[] => [\n\t{ type: \"input-variable\", name: \"count\" },\n\t{\n\t\ttype: \"local-variable\",\n\t\tname: \"countPluralExact\",\n\t\tvalue: {\n\t\t\ttype: \"expression\",\n\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t},\n\t},\n\t{\n\t\ttype: \"local-variable\",\n\t\tname: \"countPlural\",\n\t\tvalue: {\n\t\t\ttype: \"expression\",\n\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\tannotation: { type: \"function-reference\", name: \"plural\", options: [] },\n\t\t},\n\t},\n];\nconst icuSelectors = [\"countPluralExact\", \"countPlural\"];\n\n/** ICU `=N {…}` */\nconst exact = (value: string, pattern: Pattern) => ({\n\tmatches: [literal(\"countPluralExact\", value), catchall(\"countPlural\")],\n\tpattern,\n});\n/** ICU `one {…}`, `few {…}`, ... */\nconst category = (value: string, pattern: Pattern) => ({\n\tmatches: [catchall(\"countPluralExact\"), literal(\"countPlural\", value)],\n\tpattern,\n});\n/** ICU `other {…}` */\nconst other = (pattern: Pattern) => ({\n\tmatches: [catchall(\"countPluralExact\"), catchall(\"countPlural\")],\n\tpattern,\n});\n\nconst render = (\n\tmessage: (inputs: Record<string, unknown>) => string,\n\tcounts: unknown[]\n) =>\n\tObject.fromEntries(\n\t\tcounts.map((count) => [String(JSON.stringify(count)), message({ count })])\n\t);\n\nconst COUNTS = [0, 1, 2, 5, 21, \"0\"];\n\ndescribe(\"exact number matches on un-annotated local aliases (ICU =N)\", () => {\n\ttest(\"en: =0, one, other\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"No items\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" item\")),\n\t\t\t\tother(withCount(\"\", \" items\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\n\t\t\t'(countPluralExact === 0 || countPluralExact === \"0\")'\n\t\t);\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"No items\",\n\t\t\t\"1\": \"1 item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"5\": \"5 items\",\n\t\t\t\"21\": \"21 items\",\n\t\t\t'\"0\"': \"No items\",\n\t\t});\n\t});\n\n\ttest(\"en: =1 wins over one and matches the string '1'\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"No items\")),\n\t\t\t\texact(\"1\", text(\"Exactly one item\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" item\")),\n\t\t\t\tother(withCount(\"\", \" items\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, [...COUNTS, \"1\"])).toEqual({\n\t\t\t\"0\": \"No items\",\n\t\t\t\"1\": \"Exactly one item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"5\": \"5 items\",\n\t\t\t\"21\": \"21 items\",\n\t\t\t'\"0\"': \"No items\",\n\t\t\t'\"1\"': \"Exactly one item\",\n\t\t});\n\t});\n\n\ttest(\"fr: =0 wins over one, which covers 0 in French\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"Aucun élément\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" élément\")),\n\t\t\t\tother(withCount(\"\", \" éléments\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Aucun élément\",\n\t\t\t\"1\": \"1 élément\",\n\t\t\t\"2\": \"2 éléments\",\n\t\t\t\"5\": \"5 éléments\",\n\t\t\t\"21\": \"21 éléments\",\n\t\t\t'\"0\"': \"Aucun élément\",\n\t\t});\n\t});\n\n\ttest(\"fr: variant preference follows selector order, not storage order\", async () => {\n\t\t// editors append the exact variant after the existing plural variants\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\tother(withCount(\"\", \" éléments\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" élément\")),\n\t\t\t\texact(\"0\", text(\"Aucun élément\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Aucun élément\",\n\t\t\t\"1\": \"1 élément\",\n\t\t\t\"2\": \"2 éléments\",\n\t\t\t\"5\": \"5 éléments\",\n\t\t\t\"21\": \"21 éléments\",\n\t\t\t'\"0\"': \"Aucun élément\",\n\t\t});\n\t});\n\n\ttest(\"ru: =0 and =1 next to one/few/many/other\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"ru\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"Нет файлов\")),\n\t\t\t\texact(\"1\", text(\"Ровно один файл\")),\n\t\t\t\tcategory(\"one\", withCount(\"\", \" файл\")),\n\t\t\t\tcategory(\"few\", withCount(\"\", \" файла\")),\n\t\t\t\tcategory(\"many\", withCount(\"\", \" файлов\")),\n\t\t\t\tother(withCount(\"\", \" файла (other)\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Нет файлов\",\n\t\t\t\"1\": \"Ровно один файл\",\n\t\t\t\"2\": \"2 файла\",\n\t\t\t\"5\": \"5 файлов\",\n\t\t\t\"21\": \"21 файл\",\n\t\t\t'\"0\"': \"Нет файлов\",\n\t\t});\n\t});\n\n\ttest(\"ja: =0 and =1 in a locale with only the other category\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"ja\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants: [\n\t\t\t\texact(\"0\", text(\"アイテムなし\")),\n\t\t\t\texact(\"1\", text(\"アイテム1つだけ\")),\n\t\t\t\tother(withCount(\"アイテム\", \"個\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"アイテムなし\",\n\t\t\t\"1\": \"アイテム1つだけ\",\n\t\t\t\"2\": \"アイテム2個\",\n\t\t\t\"5\": \"アイテム5個\",\n\t\t\t\"21\": \"アイテム21個\",\n\t\t\t'\"0\"': \"アイテムなし\",\n\t\t});\n\t});\n\n\ttest(\"exact numbers nested inside a select\", async () => {\n\t\t// {gender, select, female {{count, plural, =0 {…} one {…} other {…}}} other {…}}\n\t\tconst declarations: Declaration[] = [\n\t\t\t{ type: \"input-variable\", name: \"gender\" },\n\t\t\t...icuDeclarations(),\n\t\t];\n\t\tconst nested = (\n\t\t\tgender: Match,\n\t\t\tvariant: { matches: Match[]; pattern: Pattern }\n\t\t) => ({ ...variant, matches: [gender, ...variant.matches] });\n\t\tconst female = literal(\"gender\", \"female\");\n\t\tconst anyGender = catchall(\"gender\");\n\n\t\tfor (const locale of [\"en\", \"fr\"]) {\n\t\t\tconst { message } = await compileAndImport({\n\t\t\t\tlocale,\n\t\t\t\tdeclarations,\n\t\t\t\tselectors: [\"gender\", ...icuSelectors],\n\t\t\t\tvariants: [\n\t\t\t\t\tnested(female, exact(\"0\", text(\"She has none\"))),\n\t\t\t\t\tnested(female, category(\"one\", withCount(\"She has \", \" (one)\"))),\n\t\t\t\t\tnested(female, other(withCount(\"She has \", \" (other)\"))),\n\t\t\t\t\tnested(anyGender, exact(\"0\", text(\"They have none\"))),\n\t\t\t\t\tnested(anyGender, category(\"one\", withCount(\"They have \", \" (one)\"))),\n\t\t\t\t\tnested(anyGender, other(withCount(\"They have \", \" (other)\"))),\n\t\t\t\t],\n\t\t\t});\n\n\t\t\tconst results = (gender: string) =>\n\t\t\t\tCOUNTS.map((count) => message({ gender, count }));\n\t\t\t// =0 wins in both locales, also where French `one` covers 0\n\t\t\texpect(results(\"female\")).toEqual([\n\t\t\t\t\"She has none\",\n\t\t\t\t\"She has 1 (one)\",\n\t\t\t\t\"She has 2 (other)\",\n\t\t\t\t\"She has 5 (other)\",\n\t\t\t\t\"She has 21 (other)\",\n\t\t\t\t\"She has none\",\n\t\t\t]);\n\t\t\texpect(results(\"male\")).toEqual([\n\t\t\t\t\"They have none\",\n\t\t\t\t\"They have 1 (one)\",\n\t\t\t\t\"They have 2 (other)\",\n\t\t\t\t\"They have 5 (other)\",\n\t\t\t\t\"They have 21 (other)\",\n\t\t\t\t\"They have none\",\n\t\t\t]);\n\t\t}\n\t});\n\n\ttest(\"resolves chains of un-annotated aliases\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"countAlias\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"countAliasAlias\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"countAlias\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"countPlural\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\tname: \"plural\",\n\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tselectors: [\"countAliasAlias\", \"countPlural\"],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"countAliasAlias\"), literal(\"countPlural\", \"one\")],\n\t\t\t\t\tpattern: text(\"one\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [literal(\"countAliasAlias\", \"0\"), catchall(\"countPlural\")],\n\t\t\t\t\tpattern: text(\"zero\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"countAliasAlias\"), catchall(\"countPlural\")],\n\t\t\t\t\tpattern: text(\"other\"),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\n\t\t\t'(countAliasAlias === 0 || countAliasAlias === \"0\")'\n\t\t);\n\t\texpect(COUNTS.map((count) => message({ count }))).toEqual([\n\t\t\t\"zero\",\n\t\t\t\"one\",\n\t\t\t\"other\",\n\t\t\t\"other\",\n\t\t\t\"other\",\n\t\t\t\"zero\",\n\t\t]);\n\t});\n\n\ttest(\"annotated locals and literal locals keep string matching\", async () => {\n\t\tconst { code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"formatted\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// aliases the formatted string, not the input\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"formattedAlias\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"formatted\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"constant\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"literal\", value: \"0\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tselectors: [\"formatted\", \"formattedAlias\", \"constant\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [literal(\"formatted\", \"0\")], pattern: text(\"a\") },\n\t\t\t\t{ matches: [literal(\"formattedAlias\", \"0\")], pattern: text(\"b\") },\n\t\t\t\t{ matches: [literal(\"constant\", \"0\")], pattern: text(\"c\") },\n\t\t\t\t{ matches: [], pattern: text(\"d\") },\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain('if (formatted === \"0\")');\n\t\texpect(code).toContain('if (formattedAlias === \"0\")');\n\t\texpect(code).toContain('if (constant === \"0\")');\n\t});\n});\n\ndescribe(\"exact number matches on the input itself (i18next _zero import)\", () => {\n\t// i18next `key_zero`, `key_one`, `key_other` import as selectors\n\t// `count` (exact 0) and `countPlural`. `_zero` also becomes the Intl `zero`\n\t// category variant. Variants are listed in import order.\n\tconst declarations = (): Declaration[] => [\n\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t{\n\t\t\ttype: \"local-variable\",\n\t\t\tname: \"countPlural\",\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\tannotation: { type: \"function-reference\", name: \"plural\", options: [] },\n\t\t\t},\n\t\t},\n\t];\n\tconst variants = (zero: string, one: Pattern, others: Pattern) => [\n\t\t{\n\t\t\tmatches: [catchall(\"count\"), literal(\"countPlural\", \"one\")],\n\t\t\tpattern: one,\n\t\t},\n\t\t{\n\t\t\tmatches: [catchall(\"count\"), literal(\"countPlural\", \"other\")],\n\t\t\tpattern: others,\n\t\t},\n\t\t{\n\t\t\tmatches: [literal(\"count\", \"0\"), catchall(\"countPlural\")],\n\t\t\tpattern: text(zero),\n\t\t},\n\t\t{\n\t\t\tmatches: [catchall(\"count\"), literal(\"countPlural\", \"zero\")],\n\t\t\tpattern: text(zero),\n\t\t},\n\t];\n\n\ttest(\"en\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: declarations(),\n\t\t\tselectors: [\"count\", \"countPlural\"],\n\t\t\tvariants: variants(\n\t\t\t\t\"No items\",\n\t\t\t\twithCount(\"\", \" item\"),\n\t\t\t\twithCount(\"\", \" items\")\n\t\t\t),\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"No items\",\n\t\t\t\"1\": \"1 item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"5\": \"5 items\",\n\t\t\t\"21\": \"21 items\",\n\t\t\t'\"0\"': \"No items\",\n\t\t});\n\t});\n\n\ttest(\"fr: exact 0 wins over one\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"fr\",\n\t\t\tdeclarations: declarations(),\n\t\t\tselectors: [\"count\", \"countPlural\"],\n\t\t\tvariants: variants(\n\t\t\t\t\"Aucun élément\",\n\t\t\t\twithCount(\"\", \" élément\"),\n\t\t\t\twithCount(\"\", \" éléments\")\n\t\t\t),\n\t\t});\n\n\t\texpect(render(message, COUNTS)).toEqual({\n\t\t\t\"0\": \"Aucun élément\",\n\t\t\t\"1\": \"1 élément\",\n\t\t\t\"2\": \"2 éléments\",\n\t\t\t\"5\": \"5 éléments\",\n\t\t\t\"21\": \"21 éléments\",\n\t\t\t'\"0\"': \"Aucun élément\",\n\t\t});\n\t});\n});\n\ndescribe(\"variant preference follows selector order\", () => {\n\ttest(\"literal keys win over catchalls selector by selector, not by storage order\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"platform\" },\n\t\t\t\t{ type: \"input-variable\", name: \"gender\" },\n\t\t\t],\n\t\t\tselectors: [\"platform\", \"gender\"],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"platform\"), literal(\"gender\", \"male\")],\n\t\t\t\t\tpattern: text(\"*,male\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [literal(\"platform\", \"android\"), catchall(\"gender\")],\n\t\t\t\t\tpattern: text(\"android,*\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"platform\"), catchall(\"gender\")],\n\t\t\t\t\tpattern: text(\"*,*\"),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(message({ platform: \"android\", gender: \"male\" })).toBe(\"android,*\");\n\t\texpect(message({ platform: \"ios\", gender: \"male\" })).toBe(\"*,male\");\n\t\texpect(message({ platform: \"ios\", gender: \"female\" })).toBe(\"*,*\");\n\t});\n\n\ttest(\"an ICU select with `other` stored first still reaches the other cases\", async () => {\n\t\t// {gender, select, other {They} female {She} male {He}}\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: [{ type: \"input-variable\", name: \"gender\" }],\n\t\t\tselectors: [\"gender\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [catchall(\"gender\")], pattern: text(\"They\") },\n\t\t\t\t{ matches: [literal(\"gender\", \"female\")], pattern: text(\"She\") },\n\t\t\t\t{ matches: [literal(\"gender\", \"male\")], pattern: text(\"He\") },\n\t\t\t],\n\t\t});\n\n\t\texpect(message({ gender: \"female\" })).toBe(\"She\");\n\t\texpect(message({ gender: \"male\" })).toBe(\"He\");\n\t\texpect(message({ gender: \"other\" })).toBe(\"They\");\n\t});\n});\n\ndescribe(\"input match types with alias matches\", () => {\n\tconst statusBundle = (fr: Array<{ matches: Match[]; pattern: Pattern }>) => {\n\t\tconst bundle: BundleNested = {\n\t\t\tid: \"status_message\",\n\t\t\tdeclarations: [\n\t\t\t\t{ type: \"input-variable\", name: \"status\" },\n\t\t\t\t{\n\t\t\t\t\ttype: \"local-variable\",\n\t\t\t\t\tname: \"statusExact\",\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"status\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tmessages: [\n\t\t\t\t{\n\t\t\t\t\tid: \"en-id\",\n\t\t\t\t\tbundle_id: \"status_message\",\n\t\t\t\t\tlocale: \"en\",\n\t\t\t\t\tselectors: [{ type: \"variable-reference\", name: \"status\" }],\n\t\t\t\t\tvariants: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: \"1\",\n\t\t\t\t\t\t\tmessage_id: \"en-id\",\n\t\t\t\t\t\t\tmatches: [literal(\"status\", \"active\")],\n\t\t\t\t\t\t\tpattern: text(\"Active\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"fr-id\",\n\t\t\t\t\tbundle_id: \"status_message\",\n\t\t\t\t\tlocale: \"fr\",\n\t\t\t\t\tselectors: [{ type: \"variable-reference\", name: \"statusExact\" }],\n\t\t\t\t\tvariants: fr.map((variant, index) => ({\n\t\t\t\t\t\tid: `fr-${index}`,\n\t\t\t\t\t\tmessage_id: \"fr-id\",\n\t\t\t\t\t\t...variant,\n\t\t\t\t\t})),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\treturn compileBundle({\n\t\t\tfallbackMap: { en: \"en\", fr: \"fr\" },\n\t\t\tbundle,\n\t\t\tmessageReferenceExpression: (locale) =>\n\t\t\t\t`${toSafeModuleId(locale)}.status_message`,\n\t\t\tsettings: { locales: [\"en\", \"fr\"] } as ProjectSettings,\n\t\t}).matchTypes.get(\"status\");\n\t};\n\n\ttest(\"alias literal matches widen an input type narrowed by direct matches\", () => {\n\t\tconst info = statusBundle([\n\t\t\t{ matches: [literal(\"statusExact\", \"0\")], pattern: text(\"Zéro\") },\n\t\t]);\n\n\t\texpect(info?.literals).toEqual(new Set([\"active\", \"0\"]));\n\t\texpect(info?.hasCatchAll).toBe(false);\n\t});\n\n\ttest(\"an alias catchall widens the input type to any value\", () => {\n\t\tconst info = statusBundle([\n\t\t\t{ matches: [literal(\"statusExact\", \"0\")], pattern: text(\"Zéro\") },\n\t\t\t{ matches: [catchall(\"statusExact\")], pattern: text(\"Autre\") },\n\t\t]);\n\n\t\t// status: \"inactive\" must type-check, fr handles any status\n\t\texpect(info?.hasCatchAll).toBe(true);\n\t});\n});\n\ndescribe(\"ICU plural offset (`{count, plural, offset:1 …}`)\", () => {\n\t/**\n\t * The shape inlang's ICU MessageFormat 1 plugin imports\n\t * `{count, plural, offset:1 =0 {…} =1 {…} one {…} other {…}}` as.\n\t */\n\tconst offsetDeclarations = (offset = \"1\"): Declaration[] => [\n\t\t{ type: \"input-variable\", name: \"count\" },\n\t\t{\n\t\t\ttype: \"local-variable\",\n\t\t\tname: \"countPluralOffset1\",\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\tannotation: {\n\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\tname: \"plural\",\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{ name: \"offset\", value: { type: \"literal\", value: offset } },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"local-variable\",\n\t\t\tname: \"countPluralOffset1Exact\",\n\t\t\tvalue: {\n\t\t\t\ttype: \"expression\",\n\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t},\n\t\t},\n\t];\n\tconst offsetSelectors = [\"countPluralOffset1Exact\", \"countPluralOffset1\"];\n\tconst exactOffset = (value: string, pattern: Pattern) => ({\n\t\tmatches: [\n\t\t\tliteral(\"countPluralOffset1Exact\", value),\n\t\t\tcatchall(\"countPluralOffset1\"),\n\t\t],\n\t\tpattern,\n\t});\n\tconst categoryOffset = (value: string, pattern: Pattern) => ({\n\t\tmatches: [\n\t\t\tcatchall(\"countPluralOffset1Exact\"),\n\t\t\tliteral(\"countPluralOffset1\", value),\n\t\t],\n\t\tpattern,\n\t});\n\tconst otherOffset = (pattern: Pattern) => ({\n\t\tmatches: [\n\t\t\tcatchall(\"countPluralOffset1Exact\"),\n\t\t\tcatchall(\"countPluralOffset1\"),\n\t\t],\n\t\tpattern,\n\t});\n\n\ttest(\"en: the category is selected on count - offset, exact matches on count\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: offsetDeclarations(),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\texactOffset(\"0\", text(\"Nobody\")),\n\t\t\t\texactOffset(\"1\", text(\"Only you\")),\n\t\t\t\tcategoryOffset(\"one\", text(\"You and one other\")),\n\t\t\t\totherOffset(text(\"You and others\")),\n\t\t\t],\n\t\t});\n\n\t\t// a number, not the string \"1\"\n\t\texpect(code).toContain('registry.plural(\"en\", i?.count, { offset: 1 }, true)');\n\t\texpect(render(message, [0, 1, 2, 3, 22, \"1\", \"2\"])).toEqual({\n\t\t\t\"0\": \"Nobody\",\n\t\t\t\"1\": \"Only you\",\n\t\t\t// 2 - 1 = 1 is \"one\"\n\t\t\t\"2\": \"You and one other\",\n\t\t\t\"3\": \"You and others\",\n\t\t\t\"22\": \"You and others\",\n\t\t\t'\"1\"': \"Only you\",\n\t\t\t'\"2\"': \"You and one other\",\n\t\t});\n\t});\n\n\ttest(\"ru: one/few/many follow count - offset\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tlocale: \"ru\",\n\t\t\tdeclarations: offsetDeclarations(),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\texactOffset(\"1\", text(\"only you\")),\n\t\t\t\tcategoryOffset(\"one\", text(\"one\")),\n\t\t\t\tcategoryOffset(\"few\", text(\"few\")),\n\t\t\t\tcategoryOffset(\"many\", text(\"many\")),\n\t\t\t\totherOffset(text(\"other\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(message, [1, 2, 3, 6, 22, 23])).toEqual({\n\t\t\t\"1\": \"only you\",\n\t\t\t\"2\": \"one\", // 1\n\t\t\t\"3\": \"few\", // 2\n\t\t\t\"6\": \"many\", // 5\n\t\t\t\"22\": \"one\", // 21\n\t\t\t\"23\": \"few\", // 22\n\t\t});\n\t});\n\n\ttest(\"an offset of 0 and no offset select the same category\", async () => {\n\t\tconst withZero = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: offsetDeclarations(\"0\"),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\tcategoryOffset(\"one\", text(\"one\")),\n\t\t\t\totherOffset(text(\"other\")),\n\t\t\t],\n\t\t});\n\n\t\texpect(render(withZero.message, [0, 1, 2])).toEqual({\n\t\t\t\"0\": \"other\",\n\t\t\t\"1\": \"one\",\n\t\t\t\"2\": \"other\",\n\t\t});\n\t});\n\n\ttest(\"a non-numeric offset fails compilation\", async () => {\n\t\tawait expect(\n\t\t\tcompileAndImport({\n\t\t\t\tlocale: \"en\",\n\t\t\t\tdeclarations: offsetDeclarations(\"one\"),\n\t\t\t\tselectors: offsetSelectors,\n\t\t\t\tvariants: [\n\t\t\t\t\tcategoryOffset(\"one\", text(\"one\")),\n\t\t\t\t\totherOffset(text(\"other\")),\n\t\t\t\t],\n\t\t\t})\n\t\t).rejects.toThrow('Invalid \"plural\" offset \"one\". Expected a number.');\n\t});\n\n\ttest(\"registry.plural subtracts the offset and ignores it otherwise\", async () => {\n\t\tconst registry = await import(\n\t\t\t\"data:text/javascript;base64,\" +\n\t\t\t\tBuffer.from(createRegistry()).toString(\"base64\")\n\t\t);\n\n\t\texpect(registry.plural(\"en\", 2, { offset: 1 })).toBe(\"one\");\n\t\texpect(registry.plural(\"en\", 1, { offset: 1 })).toBe(\"other\");\n\t\texpect(registry.plural(\"en\", 1, {})).toBe(\"one\");\n\t\texpect(registry.plural(\"en\", 1)).toBe(\"one\");\n\t\texpect(registry.plural(\"en\", 3, { type: \"ordinal\", offset: 1 })).toBe(\n\t\t\t\"two\"\n\t\t);\n\t});\n\n\tconst pound = (offset?: string): Pattern[number] => ({\n\t\ttype: \"expression\",\n\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\tannotation: {\n\t\t\ttype: \"function-reference\",\n\t\t\tname: \"icu:pound\",\n\t\t\toptions:\n\t\t\t\toffset === undefined\n\t\t\t\t\t? []\n\t\t\t\t\t: [{ name: \"offset\", value: { type: \"literal\", value: offset } }],\n\t\t},\n\t});\n\n\ttest(\"# displays count - offset, formatted like number()\", async () => {\n\t\tconst { message, code } = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: offsetDeclarations(),\n\t\t\tselectors: offsetSelectors,\n\t\t\tvariants: [\n\t\t\t\texactOffset(\"0\", text(\"Nobody\")),\n\t\t\t\texactOffset(\"1\", text(\"You\")),\n\t\t\t\tcategoryOffset(\"one\", [\n\t\t\t\t\t{ type: \"text\", value: \"You and \" },\n\t\t\t\t\tpound(\"1\"),\n\t\t\t\t\t{ type: \"text\", value: \" other\" },\n\t\t\t\t]),\n\t\t\t\totherOffset([\n\t\t\t\t\t{ type: \"text\", value: \"You and \" },\n\t\t\t\t\tpound(\"1\"),\n\t\t\t\t\t{ type: \"text\", value: \" others\" },\n\t\t\t\t]),\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain('registry.icuPound(\"en\", i?.count, { offset: 1 })');\n\t\texpect(render(message, [0, 1, 2, 3, 1234, \"2\"])).toEqual({\n\t\t\t\"0\": \"Nobody\",\n\t\t\t\"1\": \"You\",\n\t\t\t\"2\": \"You and 1 other\",\n\t\t\t\"3\": \"You and 2 others\",\n\t\t\t\"1234\": \"You and 1,233 others\",\n\t\t\t'\"2\"': \"You and 1 other\",\n\t\t});\n\t});\n\n\ttest(\"# without an offset displays count, formatted like number()\", async () => {\n\t\tconst variants = [\n\t\t\tcategory(\"one\", [pound(), { type: \"text\", value: \" item\" }]),\n\t\t\tother([pound(), { type: \"text\", value: \" items\" }]),\n\t\t];\n\t\tconst en = await compileAndImport({\n\t\t\tlocale: \"en\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants,\n\t\t});\n\t\tconst de = await compileAndImport({\n\t\t\tlocale: \"de\",\n\t\t\tdeclarations: icuDeclarations(),\n\t\t\tselectors: icuSelectors,\n\t\t\tvariants,\n\t\t});\n\n\t\texpect(en.code).toContain('registry.icuPound(\"en\", i?.count, {})');\n\t\texpect(render(en.message, [1, 2, 1234, 1.5])).toEqual({\n\t\t\t\"1\": \"1 item\",\n\t\t\t\"2\": \"2 items\",\n\t\t\t\"1234\": \"1,234 items\",\n\t\t\t\"1.5\": \"1.5 items\",\n\t\t});\n\t\texpect(de.message({ count: 1234 })).toBe(\"1.234 items\");\n\t});\n\n\ttest(\"a non-numeric # offset fails compilation\", async () => {\n\t\tawait expect(\n\t\t\tcompileAndImport({\n\t\t\t\tlocale: \"en\",\n\t\t\t\tdeclarations: offsetDeclarations(),\n\t\t\t\tselectors: offsetSelectors,\n\t\t\t\tvariants: [otherOffset([pound(\"x\")])],\n\t\t\t})\n\t\t).rejects.toThrow('Invalid \"icu:pound\" offset \"x\". Expected a number.');\n\t});\n\n\ttest(\"registry.icuPound subtracts the offset and formats like number()\", async () => {\n\t\tconst registry = await import(\n\t\t\t\"data:text/javascript;base64,\" +\n\t\t\t\tBuffer.from(createRegistry()).toString(\"base64\")\n\t\t);\n\n\t\texpect(registry.icuPound(\"en\", 1234, { offset: 1 })).toBe(\"1,233\");\n\t\texpect(registry.icuPound(\"en\", 1234, {})).toBe(\n\t\t\tregistry.number(\"en\", 1234, {})\n\t\t);\n\t\texpect(registry.icuPound(\"en\", \"3\")).toBe(\"3\");\n\t});\n\n\ttest(\"# displays an input that is not a number as is, without the offset\", async () => {\n\t\tconst registry = await import(\n\t\t\t\"data:text/javascript;base64,\" +\n\t\t\t\tBuffer.from(createRegistry()).toString(\"base64\")\n\t\t);\n\t\tconst pound = (input: unknown) =>\n\t\t\tregistry.icuPound(\"en\", input, { offset: 1 });\n\n\t\t// numbers and numeric strings are offset and formatted\n\t\texpect(pound(1234)).toBe(\"1,233\");\n\t\texpect(pound(\"1234\")).toBe(\"1,233\");\n\t\texpect(pound(\" 3 \")).toBe(\"2\");\n\t\t// anything else is displayed like a plain {count} placeholder\n\t\texpect(pound(\"abc\")).toBe(\"abc\");\n\t\texpect(pound(\"1,234\")).toBe(\"1,234\");\n\t\texpect(pound(\"\")).toBe(\"\");\n\t\texpect(pound(undefined)).toBe(\"undefined\");\n\t\texpect(pound(null)).toBe(\"null\");\n\t\texpect(pound(true)).toBe(\"true\");\n\t\texpect(pound(Number.NaN)).toBe(\"NaN\");\n\t\texpect(pound(Infinity)).toBe(\"Infinity\");\n\t});\n});\n"]}
@@ -102,7 +102,7 @@ describe("emits only the locals a message reads", () => {
102
102
  ],
103
103
  });
104
104
  expect(code).toContain("const countValue = i?.count;");
105
- expect(code).toContain('const countPlural = registry.plural("en", countValue, {});');
105
+ expect(code).toContain('const countPlural = registry.plural("en", countValue, {}, true);');
106
106
  expect(code).toContain("const nameValue = i?.name;");
107
107
  expect(code).not.toContain("unusedPlural");
108
108
  expect(code).not.toContain("unusedName");
@@ -1 +1 @@
1
- {"version":3,"file":"compile-message.locals.test.js","sourceRoot":"","sources":["../../src/compiler/compile-message.locals.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAUpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAAC,IAK/B;IACA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,MAAM,GACX,cAAc,EAAE;QAChB,kCAAkC;QAClC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,MAAM,MAAM,CAC1B,8BAA8B,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACvE,C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AC,CAAC;oBAClC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,YAAY;4BAClB,GAAG,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE;4BAClD,UAAU,EAAE;gCACX,IAAI,EAAE,oBAAoB;gCAC1B,IAAI,EAAE,WAAW;gCACjB,OAAO,EAAE,EAAE;6BACX;yBACD;qBACD;iBACD;aACD;SACD,CAAC,CAAC,IAAI,EAAE,CACT,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;QAClC,MAAM,CACL,iBAAiB,CAAC;YACjB,YAAY,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/B,QAAQ,EAAE;gBACT;oBACC,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,YAAY;4BAClB,GAAG,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACnD,UAAU,EAAE;gCACX,IAAI,EAAE,oBAAoB;gCAC1B,IAAI,EAAE,QAAQ;gCACd,OAAO,EAAE,EAAE;6BACX;yBACD;qBACD;iBACD;aACD;SACD,CAAC,CACF,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test, vi } from \"vitest\";\nimport type {\n\tDeclaration,\n\tExpression,\n\tLocalVariable,\n\tMatch,\n\tMessage,\n\tPattern,\n\tVariant,\n} from \"@inlang/sdk\";\nimport { compileMessage } from \"./compile-message.js\";\nimport { createRegistry } from \"./registry.js\";\nimport { Logger } from \"../services/logger/index.js\";\n\n/**\n * Compiles a message and imports it together with an inlined registry so the\n * generated code can be executed.\n */\nasync function compileAndImport(args: {\n\tdeclarations: Declaration[];\n\tselectors?: string[];\n\tlocale?: string;\n\tvariants: Array<{ matches?: Match[]; pattern: Pattern }>;\n}) {\n\tconst code = compile(args);\n\tconst source =\n\t\tcreateRegistry() +\n\t\t\"\\nexport const locals_message = \" +\n\t\tcode.replaceAll(\"registry.\", \"\");\n\tconst module = await import(\n\t\t\"data:text/javascript;base64,\" + Buffer.from(source).toString(\"base64\")\n\t);\n\treturn {\n\t\tcode,\n\t\tmessage: module.locals_message as ((\n\t\t\tinputs?: Record<string, unknown>\n\t\t) => string) & {\n\t\t\tparts?: (inputs?: Record<string, unknown>) => unknown[];\n\t\t},\n\t};\n}\n\nfunction compile(args: {\n\tdeclarations: Declaration[];\n\tselectors?: string[];\n\tlocale?: string;\n\tvariants: Array<{ matches?: Match[]; pattern: Pattern }>;\n}): string {\n\tconst message: Message = {\n\t\tid: \"message-id\",\n\t\tbundleId: \"locals_message\",\n\t\tlocale: args.locale ?? \"en\",\n\t\tselectors: (args.selectors ?? []).map((name) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname,\n\t\t})),\n\t};\n\tconst variants: Variant[] = args.variants.map((variant, index) => ({\n\t\tid: String(index),\n\t\tmessageId: message.id,\n\t\tmatches: variant.matches ?? [],\n\t\tpattern: variant.pattern,\n\t}));\n\treturn compileMessage(args.declarations, message, variants).code;\n}\n\nconst input = (name: string): Declaration => ({\n\ttype: \"input-variable\",\n\tname,\n});\nconst local = (\n\tname: string,\n\targ: string,\n\tannotation?: Expression[\"annotation\"]\n): LocalVariable => ({\n\ttype: \"local-variable\",\n\tname,\n\tvalue: {\n\t\ttype: \"expression\",\n\t\targ: { type: \"variable-reference\", name: arg },\n\t\t...(annotation ? { annotation } : {}),\n\t},\n});\nconst plural = (): Expression[\"annotation\"] => ({\n\ttype: \"function-reference\",\n\tname: \"plural\",\n\toptions: [],\n});\nconst ref = (name: string): Pattern[number] => ({\n\ttype: \"expression\",\n\targ: { type: \"variable-reference\", name },\n});\nconst literal = (key: string, value: string): Match => ({\n\ttype: \"literal-match\",\n\tkey,\n\tvalue,\n});\nconst catchall = (key: string): Match => ({ type: \"catchall-match\", key });\nconst text = (value: string): Pattern[number] => ({ type: \"text\", value });\n\ndescribe(\"emits only the locals a message reads\", () => {\n\ttest(\"a locale that does not read a bundle local does not declare it\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"status\"), local(\"statusExact\", \"status\")],\n\t\t\tselectors: [\"status\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [literal(\"status\", \"active\")], pattern: [text(\"Active\")] },\n\t\t\t\t{ matches: [catchall(\"status\")], pattern: [text(\"Other\")] },\n\t\t\t],\n\t\t});\n\n\t\texpect(code).not.toContain(\"statusExact\");\n\t\texpect(message({ status: \"active\" })).toBe(\"Active\");\n\t\texpect(message({ status: \"inactive\" })).toBe(\"Other\");\n\t});\n\n\ttest(\"locals read through selectors, patterns and other locals are declared\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"count\"),\n\t\t\t\tinput(\"name\"),\n\t\t\t\tlocal(\"countValue\", \"count\"),\n\t\t\t\tlocal(\"countPlural\", \"countValue\", plural()),\n\t\t\t\tlocal(\"unusedPlural\", \"count\", plural()),\n\t\t\t\tlocal(\"nameValue\", \"name\"),\n\t\t\t\tlocal(\"unusedName\", \"name\"),\n\t\t\t],\n\t\t\tselectors: [\"countPlural\"],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmatches: [literal(\"countPlural\", \"one\")],\n\t\t\t\t\tpattern: [text(\"One for \"), ref(\"nameValue\")],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"countPlural\")],\n\t\t\t\t\tpattern: [text(\"Many for \"), ref(\"nameValue\")],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\"const countValue = i?.count;\");\n\t\texpect(code).toContain(\n\t\t\t'const countPlural = registry.plural(\"en\", countValue, {});'\n\t\t);\n\t\texpect(code).toContain(\"const nameValue = i?.name;\");\n\t\texpect(code).not.toContain(\"unusedPlural\");\n\t\texpect(code).not.toContain(\"unusedName\");\n\t\texpect(message({ count: 1, name: \"Ada\" })).toBe(\"One for Ada\");\n\t\texpect(message({ count: 2, name: \"Ada\" })).toBe(\"Many for Ada\");\n\t});\n\n\ttest(\"locals read through annotation options are declared\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"amount\"),\n\t\t\t\tinput(\"digits\"),\n\t\t\t\tinput(\"unit\"),\n\t\t\t\tinput(\"value\"),\n\t\t\t\tlocal(\"digitsValue\", \"digits\"),\n\t\t\t\tlocal(\"unitValue\", \"unit\"),\n\t\t\t],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"minimumFractionDigits\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"digitsValue\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttext(\" / \"),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"value\" },\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\tname: \"relativetime\",\n\t\t\t\t\t\t\t\t// `unit=$unitValue` as a literal, as some importers emit it\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"unit\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"literal\", value: \"$unitValue\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\"const digitsValue = i?.digits;\");\n\t\texpect(code).toContain(\"const unitValue = i?.unit;\");\n\t\texpect(message({ amount: 1, digits: 2, unit: \"day\", value: 1 })).toBe(\n\t\t\t\"1.00 / in 1 day\"\n\t\t);\n\t});\n\n\ttest(\"options of unknown annotations are not emitted, so their locals are not declared\", () => {\n\t\tconst code = compile({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"value\"),\n\t\t\t\tinput(\"style\"),\n\t\t\t\tlocal(\"styleValue\", \"style\"),\n\t\t\t],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"value\" },\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\tname: \"customFormatter\",\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"style\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"styleValue\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).not.toContain(\"styleValue\");\n\t});\n\n\ttest(\"a local read only by a markup option is declared in .parts() only\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"url\"), local(\"href\", \"url\")],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"markup-start\",\n\t\t\t\t\t\t\tname: \"link\",\n\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"href\" },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttext(\"Docs\"),\n\t\t\t\t\t\t{ type: \"markup-end\", name: \"link\" },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code.match(/const href = i\\?\\.url;/g)).toHaveLength(1);\n\t\t// the string function reads no input\n\t\texpect(code).toContain(\"LocalizedString} */ (() => {\");\n\t\texpect(message({ url: \"/docs\" })).toBe(\"Docs\");\n\t\texpect(message.parts?.({ url: \"/docs\" })).toEqual([\n\t\t\t{\n\t\t\t\ttype: \"markup-start\",\n\t\t\t\tname: \"link\",\n\t\t\t\toptions: { to: \"/docs\" },\n\t\t\t\tattributes: {},\n\t\t\t},\n\t\t\t{ type: \"text\", value: \"Docs\" },\n\t\t\t{ type: \"markup-end\", name: \"link\", options: {}, attributes: {} },\n\t\t]);\n\t});\n\n\ttest(\"a message that reads no input does not declare the input parameter\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"name\"), local(\"nameValue\", \"name\")],\n\t\t\tvariants: [{ pattern: [text(\"Bonjour\")] }],\n\t\t});\n\n\t\texpect(code).toContain(\"() => {\");\n\t\texpect(code).not.toContain(\"nameValue\");\n\t\texpect(message({ name: \"Ada\" })).toBe(\"Bonjour\");\n\t});\n});\n\ndescribe(\"declaration order\", () => {\n\ttest(\"a local declared before the local it reads is emitted after it\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"count\"),\n\t\t\t\t// reads countValue, which is declared below\n\t\t\t\tlocal(\"countPlural\", \"countValue\", plural()),\n\t\t\t\tlocal(\"countValue\", \"countAlias\"),\n\t\t\t\tlocal(\"countAlias\", \"count\"),\n\t\t\t],\n\t\t\tselectors: [\"countPlural\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [literal(\"countPlural\", \"one\")], pattern: [text(\"one\")] },\n\t\t\t\t{ matches: [catchall(\"countPlural\")], pattern: [text(\"other\")] },\n\t\t\t],\n\t\t});\n\n\t\tconst position = (name: string) => code.indexOf(`const ${name} =`);\n\t\texpect(position(\"countAlias\")).toBeGreaterThan(-1);\n\t\texpect(position(\"countAlias\")).toBeLessThan(position(\"countValue\"));\n\t\texpect(position(\"countValue\")).toBeLessThan(position(\"countPlural\"));\n\t\texpect(message({ count: 1 })).toBe(\"one\");\n\t\texpect(message({ count: 2 })).toBe(\"other\");\n\t});\n\n\ttest(\"locals in a valid order keep their declaration order\", () => {\n\t\tconst code = compile({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"count\"),\n\t\t\t\tlocal(\"b\", \"count\"),\n\t\t\t\tlocal(\"a\", \"count\"),\n\t\t\t\tlocal(\"c\", \"a\"),\n\t\t\t],\n\t\t\tvariants: [{ pattern: [ref(\"a\"), ref(\"b\"), ref(\"c\")] }],\n\t\t});\n\n\t\texpect(code).toContain(\n\t\t\t\"const b = i?.count;\\n\\tconst a = i?.count;\\n\\tconst c = a;\"\n\t\t);\n\t});\n\n\ttest(\"locals that reference each other in a cycle fail compilation\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [input(\"count\"), local(\"a\", \"b\"), local(\"b\", \"a\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"a\")] }],\n\t\t\t})\n\t\t).toThrow(\n\t\t\t'The message \"locals_message\" (locale \"en\") has local variables that reference each other in a cycle: a -> b -> a.'\n\t\t);\n\t});\n\n\ttest(\"a local that references itself fails compilation\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [local(\"a\", \"a\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"a\")] }],\n\t\t\t})\n\t\t).toThrow(\"in a cycle: a -> a.\");\n\t});\n\n\ttest(\"a cycle among locals the message does not read is ignored\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"name\"), local(\"a\", \"b\"), local(\"b\", \"a\")],\n\t\t\tvariants: [{ pattern: [text(\"Hi \"), ref(\"name\")] }],\n\t\t});\n\n\t\texpect(message({ name: \"Ada\" })).toBe(\"Hi Ada\");\n\t});\n});\n\ndescribe(\"undeclared variables\", () => {\n\ttest(\"an alias of an undeclared variable fails compilation\", () => {\n\t\t// previously compiled to `const e = i?.count` without an `i` parameter,\n\t\t// which threw `ReferenceError: i is not defined` when called\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [local(\"e\", \"count\")],\n\t\t\t\tselectors: [\"e\"],\n\t\t\t\tvariants: [\n\t\t\t\t\t{ matches: [literal(\"e\", \"0\")], pattern: [text(\"zero\")] },\n\t\t\t\t\t{ matches: [catchall(\"e\")], pattern: [text(\"other\")] },\n\t\t\t\t],\n\t\t\t})\n\t\t).toThrow(\n\t\t\t'The message \"locals_message\" (locale \"en\") references the variable \"count\" in the local variable \"e\", but \"count\" is not declared. Declare it as an input variable or a local variable.'\n\t\t);\n\t});\n\n\ttest(\"an alias of an undeclared variable fails compilation when other inputs exist\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [input(\"name\"), local(\"e\", \"count\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"name\"), ref(\"e\")] }],\n\t\t\t})\n\t\t).toThrow('references the variable \"count\" in the local variable \"e\"');\n\t});\n\n\ttest(\"an undeclared variable in a pattern fails compilation with the bundle and locale\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tlocale: \"de\",\n\t\t\t\tdeclarations: [input(\"name\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"nmae\")] }],\n\t\t\t})\n\t\t).toThrow(\n\t\t\t'The message \"locals_message\" (locale \"de\") references the variable \"nmae\", but \"nmae\" is not declared.'\n\t\t);\n\t});\n\n\ttest(\"an undeclared variable in an annotation option fails compilation\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [input(\"amount\")],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tname: \"minimumFractionDigits\",\n\t\t\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"digits\" },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t).toThrow('references the variable \"digits\", but \"digits\" is not declared');\n\t});\n\n\ttest(\"a local the message does not read may reference an undeclared variable\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"name\"), local(\"e\", \"count\")],\n\t\t\tvariants: [{ pattern: [text(\"Hi \"), ref(\"name\")] }],\n\t\t});\n\n\t\texpect(code).not.toContain(\"count\");\n\t\texpect(message({ name: \"Ada\" })).toBe(\"Hi Ada\");\n\t});\n});\n\ndescribe(\"unknown annotations on locals\", () => {\n\ttest(\"interpolate the raw value like unknown pattern annotations\", async () => {\n\t\tconst warn = vi\n\t\t\t.spyOn(Logger.prototype, \"warn\")\n\t\t\t.mockImplementation(function (this: Logger) {\n\t\t\t\treturn this;\n\t\t\t});\n\t\ttry {\n\t\t\tconst { code, message } = await compileAndImport({\n\t\t\t\tdeclarations: [\n\t\t\t\t\tinput(\"amount\"),\n\t\t\t\t\tinput(\"style\"),\n\t\t\t\t\tlocal(\"styleValue\", \"style\"),\n\t\t\t\t\tlocal(\"formatted\", \"amount\", {\n\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\tname: \"customLocalFormatter\",\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"style\",\n\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"styleValue\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tvariants: [{ pattern: [text(\"Total: \"), ref(\"formatted\")] }],\n\t\t\t});\n\n\t\t\texpect(code).toContain(\"const formatted = i?.amount;\");\n\t\t\texpect(code).not.toContain(\"registry.\");\n\t\t\t// the option of the ignored annotation is not read\n\t\t\texpect(code).not.toContain(\"styleValue\");\n\t\t\texpect(message({ amount: 1234, style: \"x\" })).toBe(\"Total: 1234\");\n\t\t\texpect(warn).toHaveBeenCalledWith(\n\t\t\t\texpect.stringContaining('\"customLocalFormatter\" is unknown')\n\t\t\t);\n\t\t} finally {\n\t\t\twarn.mockRestore();\n\t\t}\n\t});\n});\n\ndescribe(\"registryFunctions metadata\", () => {\n\tconst registryFunctions = (args: {\n\t\tdeclarations: Declaration[];\n\t\tselectors?: string[];\n\t\tvariants: Array<{ matches?: Match[]; pattern: Pattern }>;\n\t}) => {\n\t\tconst message: Message = {\n\t\t\tid: \"message-id\",\n\t\t\tbundleId: \"locals_message\",\n\t\t\tlocale: \"en\",\n\t\t\tselectors: (args.selectors ?? []).map((name) => ({\n\t\t\t\ttype: \"variable-reference\",\n\t\t\t\tname,\n\t\t\t})),\n\t\t};\n\t\treturn compileMessage(\n\t\t\targs.declarations,\n\t\t\tmessage,\n\t\t\targs.variants.map((variant, index) => ({\n\t\t\t\tid: String(index),\n\t\t\t\tmessageId: message.id,\n\t\t\t\tmatches: variant.matches ?? [],\n\t\t\t\tpattern: variant.pattern,\n\t\t\t}))\n\t\t).registryFunctions;\n\t};\n\n\ttest(\"message text that mentions the registry does not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [],\n\t\t\t\tvariants: [{ pattern: [text(\"Open the registry. Now.\")] }],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"an unread annotated local does not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"count\"), local(\"countPlural\", \"count\", plural())],\n\t\t\t\tvariants: [{ pattern: [ref(\"count\")] }],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"unknown local annotations do not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [\n\t\t\t\t\tinput(\"value\"),\n\t\t\t\t\tlocal(\"custom\", \"value\", {\n\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\tname: \"customFormatter\",\n\t\t\t\t\t\toptions: [],\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tvariants: [{ pattern: [ref(\"custom\")] }],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"unknown pattern annotations do not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"value\")],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"value\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"customFormatter\",\n\t\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"read locals and pattern annotations count, in both variant paths\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"count\"), local(\"countPlural\", \"count\", plural())],\n\t\t\t\tselectors: [\"countPlural\"],\n\t\t\t\tvariants: [\n\t\t\t\t\t{ matches: [literal(\"countPlural\", \"one\")], pattern: [text(\"one\")] },\n\t\t\t\t\t{\n\t\t\t\t\t\tmatches: [catchall(\"countPlural\")],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"icu:pound\",\n\t\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}).sort()\n\t\t).toEqual([\"icuPound\", \"plural\"]);\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"amount\")],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t).toEqual([\"number\"]);\n\t});\n});\n"]}
1
+ {"version":3,"file":"compile-message.locals.test.js","sourceRoot":"","sources":["../../src/compiler/compile-message.locals.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAUpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD;;;GAGG;AACH,KAAK,UAAU,gBAAgB,CAAC,IAK/B;IACA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,MAAM,GACX,cAAc,EAAE;QAChB,kCAAkC;QAClC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,MAAM,MAAM,CAC1B,8BAA8B,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACvE,CAAC;IACF,OAAO;QACN,IAAI;QACJ,OAAO,EAAE,MAAM,CAAC,cAIf;KACD,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,IAKhB;IACA,MAAM,OAAO,GAAY;QACxB,EAAE,EAAE,YAAY;QAChB,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;QAC3B,SAAS,EAAE,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAChD,IAAI,EAAE,oBAAoB;YAC1B,IAAI;SACJ,CAAC,CAAC;KACH,CAAC;IACF,MAAM,QAAQ,GAAc,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAClE,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AE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACnD,UAAU,EAAE;gCACX,IAAI,EAAE,oBAAoB;gCAC1B,IAAI,EAAE,QAAQ;gCACd,OAAO,EAAE,EAAE;6BACX;yBACD;qBACD;iBACD;aACD;SACD,CAAC,CACF,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, test, vi } from \"vitest\";\nimport type {\n\tDeclaration,\n\tExpression,\n\tLocalVariable,\n\tMatch,\n\tMessage,\n\tPattern,\n\tVariant,\n} from \"@inlang/sdk\";\nimport { compileMessage } from \"./compile-message.js\";\nimport { createRegistry } from \"./registry.js\";\nimport { Logger } from \"../services/logger/index.js\";\n\n/**\n * Compiles a message and imports it together with an inlined registry so the\n * generated code can be executed.\n */\nasync function compileAndImport(args: {\n\tdeclarations: Declaration[];\n\tselectors?: string[];\n\tlocale?: string;\n\tvariants: Array<{ matches?: Match[]; pattern: Pattern }>;\n}) {\n\tconst code = compile(args);\n\tconst source =\n\t\tcreateRegistry() +\n\t\t\"\\nexport const locals_message = \" +\n\t\tcode.replaceAll(\"registry.\", \"\");\n\tconst module = await import(\n\t\t\"data:text/javascript;base64,\" + Buffer.from(source).toString(\"base64\")\n\t);\n\treturn {\n\t\tcode,\n\t\tmessage: module.locals_message as ((\n\t\t\tinputs?: Record<string, unknown>\n\t\t) => string) & {\n\t\t\tparts?: (inputs?: Record<string, unknown>) => unknown[];\n\t\t},\n\t};\n}\n\nfunction compile(args: {\n\tdeclarations: Declaration[];\n\tselectors?: string[];\n\tlocale?: string;\n\tvariants: Array<{ matches?: Match[]; pattern: Pattern }>;\n}): string {\n\tconst message: Message = {\n\t\tid: \"message-id\",\n\t\tbundleId: \"locals_message\",\n\t\tlocale: args.locale ?? \"en\",\n\t\tselectors: (args.selectors ?? []).map((name) => ({\n\t\t\ttype: \"variable-reference\",\n\t\t\tname,\n\t\t})),\n\t};\n\tconst variants: Variant[] = args.variants.map((variant, index) => ({\n\t\tid: String(index),\n\t\tmessageId: message.id,\n\t\tmatches: variant.matches ?? [],\n\t\tpattern: variant.pattern,\n\t}));\n\treturn compileMessage(args.declarations, message, variants).code;\n}\n\nconst input = (name: string): Declaration => ({\n\ttype: \"input-variable\",\n\tname,\n});\nconst local = (\n\tname: string,\n\targ: string,\n\tannotation?: Expression[\"annotation\"]\n): LocalVariable => ({\n\ttype: \"local-variable\",\n\tname,\n\tvalue: {\n\t\ttype: \"expression\",\n\t\targ: { type: \"variable-reference\", name: arg },\n\t\t...(annotation ? { annotation } : {}),\n\t},\n});\nconst plural = (): Expression[\"annotation\"] => ({\n\ttype: \"function-reference\",\n\tname: \"plural\",\n\toptions: [],\n});\nconst ref = (name: string): Pattern[number] => ({\n\ttype: \"expression\",\n\targ: { type: \"variable-reference\", name },\n});\nconst literal = (key: string, value: string): Match => ({\n\ttype: \"literal-match\",\n\tkey,\n\tvalue,\n});\nconst catchall = (key: string): Match => ({ type: \"catchall-match\", key });\nconst text = (value: string): Pattern[number] => ({ type: \"text\", value });\n\ndescribe(\"emits only the locals a message reads\", () => {\n\ttest(\"a locale that does not read a bundle local does not declare it\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"status\"), local(\"statusExact\", \"status\")],\n\t\t\tselectors: [\"status\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [literal(\"status\", \"active\")], pattern: [text(\"Active\")] },\n\t\t\t\t{ matches: [catchall(\"status\")], pattern: [text(\"Other\")] },\n\t\t\t],\n\t\t});\n\n\t\texpect(code).not.toContain(\"statusExact\");\n\t\texpect(message({ status: \"active\" })).toBe(\"Active\");\n\t\texpect(message({ status: \"inactive\" })).toBe(\"Other\");\n\t});\n\n\ttest(\"locals read through selectors, patterns and other locals are declared\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"count\"),\n\t\t\t\tinput(\"name\"),\n\t\t\t\tlocal(\"countValue\", \"count\"),\n\t\t\t\tlocal(\"countPlural\", \"countValue\", plural()),\n\t\t\t\tlocal(\"unusedPlural\", \"count\", plural()),\n\t\t\t\tlocal(\"nameValue\", \"name\"),\n\t\t\t\tlocal(\"unusedName\", \"name\"),\n\t\t\t],\n\t\t\tselectors: [\"countPlural\"],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tmatches: [literal(\"countPlural\", \"one\")],\n\t\t\t\t\tpattern: [text(\"One for \"), ref(\"nameValue\")],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmatches: [catchall(\"countPlural\")],\n\t\t\t\t\tpattern: [text(\"Many for \"), ref(\"nameValue\")],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\"const countValue = i?.count;\");\n\t\texpect(code).toContain(\n\t\t\t'const countPlural = registry.plural(\"en\", countValue, {}, true);'\n\t\t);\n\t\texpect(code).toContain(\"const nameValue = i?.name;\");\n\t\texpect(code).not.toContain(\"unusedPlural\");\n\t\texpect(code).not.toContain(\"unusedName\");\n\t\texpect(message({ count: 1, name: \"Ada\" })).toBe(\"One for Ada\");\n\t\texpect(message({ count: 2, name: \"Ada\" })).toBe(\"Many for Ada\");\n\t});\n\n\ttest(\"locals read through annotation options are declared\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"amount\"),\n\t\t\t\tinput(\"digits\"),\n\t\t\t\tinput(\"unit\"),\n\t\t\t\tinput(\"value\"),\n\t\t\t\tlocal(\"digitsValue\", \"digits\"),\n\t\t\t\tlocal(\"unitValue\", \"unit\"),\n\t\t\t],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"minimumFractionDigits\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"digitsValue\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttext(\" / \"),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"value\" },\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\tname: \"relativetime\",\n\t\t\t\t\t\t\t\t// `unit=$unitValue` as a literal, as some importers emit it\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"unit\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"literal\", value: \"$unitValue\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).toContain(\"const digitsValue = i?.digits;\");\n\t\texpect(code).toContain(\"const unitValue = i?.unit;\");\n\t\texpect(message({ amount: 1, digits: 2, unit: \"day\", value: 1 })).toBe(\n\t\t\t\"1.00 / in 1 day\"\n\t\t);\n\t});\n\n\ttest(\"options of unknown annotations are not emitted, so their locals are not declared\", () => {\n\t\tconst code = compile({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"value\"),\n\t\t\t\tinput(\"style\"),\n\t\t\t\tlocal(\"styleValue\", \"style\"),\n\t\t\t],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"value\" },\n\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\tname: \"customFormatter\",\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"style\",\n\t\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"styleValue\" },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code).not.toContain(\"styleValue\");\n\t});\n\n\ttest(\"a local read only by a markup option is declared in .parts() only\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"url\"), local(\"href\", \"url\")],\n\t\t\tvariants: [\n\t\t\t\t{\n\t\t\t\t\tpattern: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"markup-start\",\n\t\t\t\t\t\t\tname: \"link\",\n\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"href\" },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttext(\"Docs\"),\n\t\t\t\t\t\t{ type: \"markup-end\", name: \"link\" },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\n\t\texpect(code.match(/const href = i\\?\\.url;/g)).toHaveLength(1);\n\t\t// the string function reads no input\n\t\texpect(code).toContain(\"LocalizedString} */ (() => {\");\n\t\texpect(message({ url: \"/docs\" })).toBe(\"Docs\");\n\t\texpect(message.parts?.({ url: \"/docs\" })).toEqual([\n\t\t\t{\n\t\t\t\ttype: \"markup-start\",\n\t\t\t\tname: \"link\",\n\t\t\t\toptions: { to: \"/docs\" },\n\t\t\t\tattributes: {},\n\t\t\t},\n\t\t\t{ type: \"text\", value: \"Docs\" },\n\t\t\t{ type: \"markup-end\", name: \"link\", options: {}, attributes: {} },\n\t\t]);\n\t});\n\n\ttest(\"a message that reads no input does not declare the input parameter\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"name\"), local(\"nameValue\", \"name\")],\n\t\t\tvariants: [{ pattern: [text(\"Bonjour\")] }],\n\t\t});\n\n\t\texpect(code).toContain(\"() => {\");\n\t\texpect(code).not.toContain(\"nameValue\");\n\t\texpect(message({ name: \"Ada\" })).toBe(\"Bonjour\");\n\t});\n});\n\ndescribe(\"declaration order\", () => {\n\ttest(\"a local declared before the local it reads is emitted after it\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"count\"),\n\t\t\t\t// reads countValue, which is declared below\n\t\t\t\tlocal(\"countPlural\", \"countValue\", plural()),\n\t\t\t\tlocal(\"countValue\", \"countAlias\"),\n\t\t\t\tlocal(\"countAlias\", \"count\"),\n\t\t\t],\n\t\t\tselectors: [\"countPlural\"],\n\t\t\tvariants: [\n\t\t\t\t{ matches: [literal(\"countPlural\", \"one\")], pattern: [text(\"one\")] },\n\t\t\t\t{ matches: [catchall(\"countPlural\")], pattern: [text(\"other\")] },\n\t\t\t],\n\t\t});\n\n\t\tconst position = (name: string) => code.indexOf(`const ${name} =`);\n\t\texpect(position(\"countAlias\")).toBeGreaterThan(-1);\n\t\texpect(position(\"countAlias\")).toBeLessThan(position(\"countValue\"));\n\t\texpect(position(\"countValue\")).toBeLessThan(position(\"countPlural\"));\n\t\texpect(message({ count: 1 })).toBe(\"one\");\n\t\texpect(message({ count: 2 })).toBe(\"other\");\n\t});\n\n\ttest(\"locals in a valid order keep their declaration order\", () => {\n\t\tconst code = compile({\n\t\t\tdeclarations: [\n\t\t\t\tinput(\"count\"),\n\t\t\t\tlocal(\"b\", \"count\"),\n\t\t\t\tlocal(\"a\", \"count\"),\n\t\t\t\tlocal(\"c\", \"a\"),\n\t\t\t],\n\t\t\tvariants: [{ pattern: [ref(\"a\"), ref(\"b\"), ref(\"c\")] }],\n\t\t});\n\n\t\texpect(code).toContain(\n\t\t\t\"const b = i?.count;\\n\\tconst a = i?.count;\\n\\tconst c = a;\"\n\t\t);\n\t});\n\n\ttest(\"locals that reference each other in a cycle fail compilation\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [input(\"count\"), local(\"a\", \"b\"), local(\"b\", \"a\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"a\")] }],\n\t\t\t})\n\t\t).toThrow(\n\t\t\t'The message \"locals_message\" (locale \"en\") has local variables that reference each other in a cycle: a -> b -> a.'\n\t\t);\n\t});\n\n\ttest(\"a local that references itself fails compilation\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [local(\"a\", \"a\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"a\")] }],\n\t\t\t})\n\t\t).toThrow(\"in a cycle: a -> a.\");\n\t});\n\n\ttest(\"a cycle among locals the message does not read is ignored\", async () => {\n\t\tconst { message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"name\"), local(\"a\", \"b\"), local(\"b\", \"a\")],\n\t\t\tvariants: [{ pattern: [text(\"Hi \"), ref(\"name\")] }],\n\t\t});\n\n\t\texpect(message({ name: \"Ada\" })).toBe(\"Hi Ada\");\n\t});\n});\n\ndescribe(\"undeclared variables\", () => {\n\ttest(\"an alias of an undeclared variable fails compilation\", () => {\n\t\t// previously compiled to `const e = i?.count` without an `i` parameter,\n\t\t// which threw `ReferenceError: i is not defined` when called\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [local(\"e\", \"count\")],\n\t\t\t\tselectors: [\"e\"],\n\t\t\t\tvariants: [\n\t\t\t\t\t{ matches: [literal(\"e\", \"0\")], pattern: [text(\"zero\")] },\n\t\t\t\t\t{ matches: [catchall(\"e\")], pattern: [text(\"other\")] },\n\t\t\t\t],\n\t\t\t})\n\t\t).toThrow(\n\t\t\t'The message \"locals_message\" (locale \"en\") references the variable \"count\" in the local variable \"e\", but \"count\" is not declared. Declare it as an input variable or a local variable.'\n\t\t);\n\t});\n\n\ttest(\"an alias of an undeclared variable fails compilation when other inputs exist\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [input(\"name\"), local(\"e\", \"count\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"name\"), ref(\"e\")] }],\n\t\t\t})\n\t\t).toThrow('references the variable \"count\" in the local variable \"e\"');\n\t});\n\n\ttest(\"an undeclared variable in a pattern fails compilation with the bundle and locale\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tlocale: \"de\",\n\t\t\t\tdeclarations: [input(\"name\")],\n\t\t\t\tvariants: [{ pattern: [ref(\"nmae\")] }],\n\t\t\t})\n\t\t).toThrow(\n\t\t\t'The message \"locals_message\" (locale \"de\") references the variable \"nmae\", but \"nmae\" is not declared.'\n\t\t);\n\t});\n\n\ttest(\"an undeclared variable in an annotation option fails compilation\", () => {\n\t\texpect(() =>\n\t\t\tcompile({\n\t\t\t\tdeclarations: [input(\"amount\")],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tname: \"minimumFractionDigits\",\n\t\t\t\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"digits\" },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t).toThrow('references the variable \"digits\", but \"digits\" is not declared');\n\t});\n\n\ttest(\"a local the message does not read may reference an undeclared variable\", async () => {\n\t\tconst { code, message } = await compileAndImport({\n\t\t\tdeclarations: [input(\"name\"), local(\"e\", \"count\")],\n\t\t\tvariants: [{ pattern: [text(\"Hi \"), ref(\"name\")] }],\n\t\t});\n\n\t\texpect(code).not.toContain(\"count\");\n\t\texpect(message({ name: \"Ada\" })).toBe(\"Hi Ada\");\n\t});\n});\n\ndescribe(\"unknown annotations on locals\", () => {\n\ttest(\"interpolate the raw value like unknown pattern annotations\", async () => {\n\t\tconst warn = vi\n\t\t\t.spyOn(Logger.prototype, \"warn\")\n\t\t\t.mockImplementation(function (this: Logger) {\n\t\t\t\treturn this;\n\t\t\t});\n\t\ttry {\n\t\t\tconst { code, message } = await compileAndImport({\n\t\t\t\tdeclarations: [\n\t\t\t\t\tinput(\"amount\"),\n\t\t\t\t\tinput(\"style\"),\n\t\t\t\t\tlocal(\"styleValue\", \"style\"),\n\t\t\t\t\tlocal(\"formatted\", \"amount\", {\n\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\tname: \"customLocalFormatter\",\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"style\",\n\t\t\t\t\t\t\t\tvalue: { type: \"variable-reference\", name: \"styleValue\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tvariants: [{ pattern: [text(\"Total: \"), ref(\"formatted\")] }],\n\t\t\t});\n\n\t\t\texpect(code).toContain(\"const formatted = i?.amount;\");\n\t\t\texpect(code).not.toContain(\"registry.\");\n\t\t\t// the option of the ignored annotation is not read\n\t\t\texpect(code).not.toContain(\"styleValue\");\n\t\t\texpect(message({ amount: 1234, style: \"x\" })).toBe(\"Total: 1234\");\n\t\t\texpect(warn).toHaveBeenCalledWith(\n\t\t\t\texpect.stringContaining('\"customLocalFormatter\" is unknown')\n\t\t\t);\n\t\t} finally {\n\t\t\twarn.mockRestore();\n\t\t}\n\t});\n});\n\ndescribe(\"registryFunctions metadata\", () => {\n\tconst registryFunctions = (args: {\n\t\tdeclarations: Declaration[];\n\t\tselectors?: string[];\n\t\tvariants: Array<{ matches?: Match[]; pattern: Pattern }>;\n\t}) => {\n\t\tconst message: Message = {\n\t\t\tid: \"message-id\",\n\t\t\tbundleId: \"locals_message\",\n\t\t\tlocale: \"en\",\n\t\t\tselectors: (args.selectors ?? []).map((name) => ({\n\t\t\t\ttype: \"variable-reference\",\n\t\t\t\tname,\n\t\t\t})),\n\t\t};\n\t\treturn compileMessage(\n\t\t\targs.declarations,\n\t\t\tmessage,\n\t\t\targs.variants.map((variant, index) => ({\n\t\t\t\tid: String(index),\n\t\t\t\tmessageId: message.id,\n\t\t\t\tmatches: variant.matches ?? [],\n\t\t\t\tpattern: variant.pattern,\n\t\t\t}))\n\t\t).registryFunctions;\n\t};\n\n\ttest(\"message text that mentions the registry does not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [],\n\t\t\t\tvariants: [{ pattern: [text(\"Open the registry. Now.\")] }],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"an unread annotated local does not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"count\"), local(\"countPlural\", \"count\", plural())],\n\t\t\t\tvariants: [{ pattern: [ref(\"count\")] }],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"unknown local annotations do not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [\n\t\t\t\t\tinput(\"value\"),\n\t\t\t\t\tlocal(\"custom\", \"value\", {\n\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\tname: \"customFormatter\",\n\t\t\t\t\t\toptions: [],\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tvariants: [{ pattern: [ref(\"custom\")] }],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"unknown pattern annotations do not count\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"value\")],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"value\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"customFormatter\",\n\t\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t).toEqual([]);\n\t});\n\n\ttest(\"read locals and pattern annotations count, in both variant paths\", () => {\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"count\"), local(\"countPlural\", \"count\", plural())],\n\t\t\t\tselectors: [\"countPlural\"],\n\t\t\t\tvariants: [\n\t\t\t\t\t{ matches: [literal(\"countPlural\", \"one\")], pattern: [text(\"one\")] },\n\t\t\t\t\t{\n\t\t\t\t\t\tmatches: [catchall(\"countPlural\")],\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"count\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"icu:pound\",\n\t\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}).sort()\n\t\t).toEqual([\"icuPound\", \"plural\"]);\n\t\texpect(\n\t\t\tregistryFunctions({\n\t\t\t\tdeclarations: [input(\"amount\")],\n\t\t\t\tvariants: [\n\t\t\t\t\t{\n\t\t\t\t\t\tpattern: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\targ: { type: \"variable-reference\", name: \"amount\" },\n\t\t\t\t\t\t\t\tannotation: {\n\t\t\t\t\t\t\t\t\ttype: \"function-reference\",\n\t\t\t\t\t\t\t\t\tname: \"number\",\n\t\t\t\t\t\t\t\t\toptions: [],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})\n\t\t).toEqual([\"number\"]);\n\t});\n});\n"]}
@@ -84,7 +84,7 @@ test.each(["single", "multiple"])("compiles chained local variables in %s-varian
84
84
  });
85
85
  }
86
86
  const compiled = compileMessage(declarations, message, variants);
87
- expect(compiled.code).toContain('const alpha = registry.number("en", zebra, {});');
87
+ expect(compiled.code).toContain('const alpha = registry.number("en", zebra, {}, true);');
88
88
  const { chained_locals } = await import("data:text/javascript;base64," +
89
89
  btoa(createRegistry() +
90
90
  "\nexport const chained_locals = " +
@@ -181,7 +181,7 @@ test("compiles pattern-level annotations to registry calls", async () => {
181
181
  },
182
182
  ];
183
183
  const compiled = compileMessage(declarations, message, variants);
184
- expect(compiled.code).toContain('registry.number("en", i?.count, {})');
184
+ expect(compiled.code).toContain('registry.number("en", i?.count, {}, true)');
185
185
  const { views } = await import("data:text/javascript;base64," +
186
186
  // bundling the registry inline to avoid managing module imports here
187
187
  btoa(createRegistry() +