@menapo/vi18n 0.1.1 → 0.2.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 (121) hide show
  1. package/README.md +19 -0
  2. package/dist/{apply-Bre-lY9J.js → apply-Bg-3rB2m.js} +69 -89
  3. package/dist/{captured-Bj8bO6vd.js → captured-DfLk50Ji.js} +196 -217
  4. package/dist/{check-BIKEuu6B.js → check-CunekuYs.js} +76 -85
  5. package/dist/cli.js +2 -3
  6. package/dist/{collect-Cx4_SKOe.js → collect-CYATDjdo.js} +1 -2
  7. package/dist/collisions-CDSdtLQm.js +215 -0
  8. package/dist/{compile-Cc97JaW2.js → compile-DqkofbiO.js} +376 -331
  9. package/dist/compile-hva0qjhZ.js +240 -0
  10. package/dist/concurrency-BCY_4zcr.js +1 -0
  11. package/dist/concurrency-Dy2ny50V.js +107 -0
  12. package/dist/config.d.ts +1 -5
  13. package/dist/config.js +4 -5
  14. package/dist/{types-D3QGM8XO.js → diagnostics-LgIWyeSp.js} +28 -27
  15. package/dist/{dir-zw6bGMKQ.js → dir-TGLYuOZb.js} +34 -37
  16. package/dist/{duplicates-yuRljQ6h.js → duplicates-8cudcHNj.js} +10 -27
  17. package/dist/engine-ecRD8-IE.js +556 -0
  18. package/dist/engine.d.ts +1 -5
  19. package/dist/engine.js +297 -168
  20. package/dist/exchange-DjwlrTQ9.js +41 -0
  21. package/dist/{exclude-Du-Zd_qI.js → exclude-BFETmvde.js} +2 -3
  22. package/dist/{export-C9Sy6UWv.js → export-D2tsqWIr.js} +17 -38
  23. package/dist/{extract-C3S8btx0.js → extract-BxYchVmY.js} +114 -82
  24. package/dist/{formats-9unqj_fZ.js → formats-BaryZ2N7.js} +352 -276
  25. package/dist/fs-ezCMZeDV.js +52 -0
  26. package/dist/i18next-COO6o0tX.js +1907 -0
  27. package/dist/i18next-Dr7DCQlQ.js +1 -0
  28. package/dist/{import-nANvQutw.js → import-vSC29Cn4.js} +81 -75
  29. package/dist/index.d.ts +1 -13
  30. package/dist/index.js +14 -16
  31. package/dist/{init-C2ScuW6a.js → init-Cc7A-8VX.js} +466 -501
  32. package/dist/{library-D5CWvTQs.js → library-tp_xqzSY.js} +975 -451
  33. package/dist/lingui-BnnlqGXT.js +902 -0
  34. package/dist/lint.d.ts +0 -4
  35. package/dist/lint.js +70 -82
  36. package/dist/{load-gW-oJt1Q.js → load-BSIeGJ5v.js} +275 -148
  37. package/dist/{load-CQRz4PpM.js → load-SSrAeJVB.js} +1214 -1116
  38. package/dist/{locales-DX4MOBFE.js → locales-D0U-yVRm.js} +271 -237
  39. package/dist/{lsp-RMMMc88P.js → lsp-DvC11pBZ.js} +4 -5
  40. package/dist/{match-BGr8EXB3.js → match-BLDcj610.js} +11 -4
  41. package/dist/{mcp-CHVwBoRP.js → mcp-D2zzOTBy.js} +4 -5
  42. package/dist/{merge-driver-BTX87aVm.js → merge-driver-BLI8OtAc.js} +138 -122
  43. package/dist/migrate-1r43OBfe.js +1 -0
  44. package/dist/migrate-ChDGhlC-.js +2169 -0
  45. package/dist/{openai-CTaMDcl-.js → openai-CLn4puY8.js} +128 -87
  46. package/dist/{output-DWE3SIUA.js → output-D5tAt8q4.js} +15 -9
  47. package/dist/parse.d.ts +1 -3
  48. package/dist/parse.js +7 -8
  49. package/dist/{pipeline-C9Dbotkh.js → pipeline-BJSkkRYC.js} +387 -359
  50. package/dist/{pipeline-DbX6rlo5.js → pipeline-BeCc441z.js} +1 -1
  51. package/dist/project-B5KIO0q-.js +544 -0
  52. package/dist/{pseudo-DRv30iN5.js → pseudo-B2DUpoLu.js} +126 -3
  53. package/dist/{raw-C4Y6vyGY.js → raw-YsYZMS9n.js} +52 -29
  54. package/dist/react-intl-C8JehBBL.js +634 -0
  55. package/dist/rename-ZVGq9ZG1.js +577 -0
  56. package/dist/repeated-uuI1tUGg.js +85 -0
  57. package/dist/restore-xlBIrtRt.js +199 -0
  58. package/dist/rewrite-BwzXoBiA.js +415 -0
  59. package/dist/{rich-DCUKl5HM.js → rich-ApY1Dm4S.js} +35 -28
  60. package/dist/rolldown-runtime-C1I3wEg2.js +43 -0
  61. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
  62. package/dist/run-CQ9pDLSa.js +674 -0
  63. package/dist/scan-worker.d.ts +2 -4
  64. package/dist/scan-worker.js +1 -1
  65. package/dist/{scoped-BMYpSthj.js → scoped-h3KE8XWW.js} +3 -4
  66. package/dist/{server-Da1Ot9IN.js → server-Br8tAuG2.js} +312 -386
  67. package/dist/{server-deBOq2vq.js → server-DJRpUQVZ.js} +1059 -333
  68. package/dist/server.d.ts +1 -17
  69. package/dist/server.js +419 -379
  70. package/dist/{sitemap-DJXzKoza.js → sitemap-CSAkm6oi.js} +21 -33
  71. package/dist/{sources-D19czDSA.js → sources-DNVbYsgs.js} +713 -373
  72. package/dist/{status-zr4jY59Y.js → status-q6M3rBrh.js} +30 -30
  73. package/dist/{stdio-FPOKQAgu.js → stdio-D9kTzyqB.js} +2 -4
  74. package/dist/{stdio-CVaJfxA7.js → stdio-FWIVU3P4.js} +1 -2
  75. package/dist/sync-BNIAwMhR.js +1352 -0
  76. package/dist/{t-DC-c9zE5.js → t-gvEXx25s.js} +76 -53
  77. package/dist/test.d.ts +5 -16
  78. package/dist/test.js +126 -56
  79. package/dist/translate-BP4iVhOR.js +336 -0
  80. package/dist/{ts-BaU5yOf0.js → ts-BX6kwig5.js} +25 -14
  81. package/dist/{types-DtvQ7UdD.js → types-3kwyaCAm.js} +1 -2
  82. package/dist/{types-DsdWBG0b.d.ts → types-B4wNX6PA.d.ts} +6 -8
  83. package/dist/{types-CgUCkFU1.d.ts → types-_4UdFhR9.d.ts} +24 -21
  84. package/dist/types-xR2exI3L.js +42 -0
  85. package/dist/{units-CQ5Q99RC.js → units-DPPfCN7j.js} +7 -16
  86. package/dist/{url-CRfCOhUI.js → url-Bpc6wLea.js} +24 -11
  87. package/dist/{url-CsBkRaJy.js → url-D2_VlEeH.js} +25 -12
  88. package/dist/{validate-BxpupdAf.js → validate-CgzaDdOY.js} +690 -377
  89. package/dist/{validate-D6DJepZv.js → validate-PGgMsasz.js} +3 -5
  90. package/dist/{version-Byqi2guX.js → version-DC-J5WvV.js} +3 -5
  91. package/dist/{vite-scan-CT_vsp4g.js → vite-scan-kM8Ta3rO.js} +87 -92
  92. package/dist/vite.d.ts +2 -6
  93. package/dist/vite.js +6500 -6032
  94. package/dist/vue-i18n-_uIXlFVh.js +806 -0
  95. package/dist/{which-BOemZ5Q8.js → which-DFWk_KwN.js} +44 -37
  96. package/dist/{worker-84U6uYB3.js → worker-zlhNj4y3.js} +454 -608
  97. package/package.json +5 -5
  98. package/dist/check-HsmmpJZg.js +0 -1
  99. package/dist/codec-DuvU2VQy.js +0 -207
  100. package/dist/collisions-CfpZU8e4.js +0 -217
  101. package/dist/compile-BaDh0cHG.js +0 -245
  102. package/dist/concurrency-C9UUWuDC.js +0 -96
  103. package/dist/concurrency-DONL7t4V.js +0 -1
  104. package/dist/engine-C2ENBRJe.js +0 -531
  105. package/dist/i18next-9HAoxwUI.js +0 -1
  106. package/dist/i18next-BEJgv_S8.js +0 -1596
  107. package/dist/lingui-zUiCl9Um.js +0 -833
  108. package/dist/messages-BfjIExyB.js +0 -166
  109. package/dist/migrate-IpLDMXmq.js +0 -1484
  110. package/dist/migrate-rCQuOGsf.js +0 -1
  111. package/dist/project-Bw9UPIdx.js +0 -1046
  112. package/dist/project-C4GpaN-n.js +0 -381
  113. package/dist/react-intl-BP0u-D5m.js +0 -519
  114. package/dist/restore-CiYv-jxS.js +0 -175
  115. package/dist/rewrite-EsIw_lsq.js +0 -803
  116. package/dist/run-BEcnBbu-.js +0 -694
  117. package/dist/runtime-DTMmliT1.js +0 -64
  118. package/dist/sync-B9V2KFwb.js +0 -658
  119. package/dist/translate-CQnJfLjO.js +0 -299
  120. package/dist/types-wSh9fCBY.js +0 -11
  121. package/dist/vue-i18n-g0iGy6CZ.js +0 -651
package/dist/lint.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/lint/types.d.ts
2
1
  /**
3
2
  * The slice of ESLint's rule API the `/lint` rules use, declared here: the
4
3
  * entry ships no `eslint` dependency, and oxlint's JS plugins implement the
@@ -98,8 +97,5 @@ interface Plugin {
98
97
  recommended: FlatConfig;
99
98
  };
100
99
  }
101
- //#endregion
102
- //#region src/lint/plugin.d.ts
103
100
  declare const plugin: Plugin;
104
- //#endregion
105
101
  export { plugin as default };
package/dist/lint.js CHANGED
@@ -1,11 +1,10 @@
1
- import { r as DEFAULT_IMPORT_SOURCES } from "./types-D3QGM8XO.js";
2
- import { f as parseICU, p as quoteStarts, u as normalizeSource } from "./validate-BxpupdAf.js";
3
- import { t as createCodec } from "./codec-DuvU2VQy.js";
4
- import { t as VERSION } from "./version-Byqi2guX.js";
5
- import { a as isIgnored, i as findMarkers, n as sourceSpecifiers, r as scanModule } from "./sources-D19czDSA.js";
6
- import { t as findCapturedValues } from "./captured-Bj8bO6vd.js";
1
+ import { t as VERSION } from "./version-DC-J5WvV.js";
2
+ import { a as DEFAULT_IMPORT_SOURCES } from "./diagnostics-LgIWyeSp.js";
3
+ import { S as quoteStarts, p as createCodec, x as parseICU, y as normalizeSource } from "./validate-CgzaDdOY.js";
4
+ import { C as langFromId, E as lineStartsOf, a as scanModule, l as findMarkers, r as sourceSpecifiers, u as isIgnored } from "./sources-DNVbYsgs.js";
5
+ import { t as findCapturedValues } from "./captured-DfLk50Ji.js";
7
6
  import { extname } from "node:path";
8
- //#region src/lint/analysis.ts
7
+ // src/lint/analysis.ts
9
8
  /**
10
9
  * What every `/lint` rule reads of a file, computed once per file: the
11
10
  * settings, the marker comments, and the extraction scan itself, run on the
@@ -84,7 +83,8 @@ function sourceConfig(settings) {
84
83
  aliases: settings.aliases,
85
84
  globals: settings.globals,
86
85
  keep: [],
87
- dependencies: []
86
+ dependencies: [],
87
+ repeatedText: false
88
88
  }
89
89
  };
90
90
  sourceConfigs.set(settings, config);
@@ -139,16 +139,6 @@ function scanTree(root, literals) {
139
139
  function isNode(value) {
140
140
  return value !== null && typeof value === "object" && typeof value.type === "string" && Array.isArray(value.range);
141
141
  }
142
- function langOf(filename) {
143
- switch (extname(filename).toLowerCase()) {
144
- case ".ts":
145
- case ".mts":
146
- case ".cts": return "ts";
147
- case ".tsx": return "tsx";
148
- case ".jsx": return "jsx";
149
- default: return "js";
150
- }
151
- }
152
142
  function commentsOf(context) {
153
143
  return context.sourceCode.getAllComments().map((comment) => {
154
144
  const range = comment.range ?? [comment.start ?? 0, comment.end ?? 0];
@@ -160,11 +150,6 @@ function commentsOf(context) {
160
150
  };
161
151
  });
162
152
  }
163
- function lineStartsOf(code) {
164
- const starts = [0];
165
- for (let i = code.indexOf("\n"); i !== -1; i = code.indexOf("\n", i + 1)) starts.push(i + 1);
166
- return starts;
167
- }
168
153
  /** Whether a module's top level is module code: an export in an SFC script means `<script>` or `<script module>`. */
169
154
  function exports(ast) {
170
155
  return ast.body.some((statement) => statement.type === "ExportDefaultDeclaration" || statement.type === "ExportNamedDeclaration" || statement.type === "ExportAllDeclaration");
@@ -210,7 +195,7 @@ function analyse(context) {
210
195
  const program = scanTree(sourceCode.ast, literals);
211
196
  parsed = {
212
197
  code,
213
- lang: langOf(context.filename),
198
+ lang: langFromId(context.filename),
214
199
  program,
215
200
  comments
216
201
  };
@@ -239,7 +224,7 @@ function analyse(context) {
239
224
  translating,
240
225
  component: extension === ".astro" || sfc && !exports(sourceCode.ast),
241
226
  framework: frameworkOf(settings, extension, imports.map((record) => record.specifier)),
242
- lineStarts: lineStartsOf(code)
227
+ lineStarts: null
243
228
  };
244
229
  cache.set(sourceCode.ast, analysis);
245
230
  return analysis;
@@ -255,10 +240,14 @@ const WRAPPERS = /* @__PURE__ */ new Set([
255
240
  "TSTypeAssertion",
256
241
  "ChainExpression"
257
242
  ]);
243
+ /** Whether the node only wraps its `expression`: a TypeScript-only wrapper or a `?.` chain. */
244
+ function isWrapper(node) {
245
+ return WRAPPERS.has(node.type);
246
+ }
258
247
  /** The expression under TypeScript-only wrappers and `?.` chains. */
259
248
  function unwrap(node) {
260
249
  let current = node;
261
- while (WRAPPERS.has(current.type)) current = current.expression;
250
+ while (isWrapper(current)) current = current.expression;
262
251
  return current;
263
252
  }
264
253
  /** Whether the node is a call that renders a message (`t`, `rich*`, a translator's or an alias). */
@@ -268,6 +257,7 @@ function isTranslating(analysis, node) {
268
257
  }
269
258
  /** The offset of a 1-based line and column of `analysis.code`. */
270
259
  function offsetOf(analysis, line, column) {
260
+ analysis.lineStarts ??= lineStartsOf(analysis.code);
271
261
  return (analysis.lineStarts[line - 1] ?? 0) + column - 1;
272
262
  }
273
263
  /** Reports at an offset range of the file. */
@@ -285,15 +275,14 @@ function reportRange(context, range, messageId, data, fix) {
285
275
  }
286
276
  const DOCS = "https://github.com/menapo/kit/blob/main/packages/vi18n/docs/guide/lint.md";
287
277
  /** Rule docs link: the guide's section of that rule. */
288
- function docs(rule, description, recommended = true) {
278
+ function docs(rule, description) {
289
279
  return {
290
280
  description,
291
- recommended,
281
+ recommended: true,
292
282
  url: `${DOCS}#${rule}`
293
283
  };
294
284
  }
295
- //#endregion
296
- //#region src/lint/rules/no-concatenation.ts
285
+ // src/lint/rules/no-concatenation.ts
297
286
  /**
298
287
  * `no-concatenation`: translated text joined with other text in code, which
299
288
  * fixes the word order for every language and splits one sentence into
@@ -343,7 +332,7 @@ const noConcatenation = {
343
332
  BinaryExpression(node) {
344
333
  if (node.operator !== "+") return;
345
334
  let parent = node.parent;
346
- while (parent && parent.type.startsWith("TS") && parent.type.endsWith("Expression")) parent = parent.parent;
335
+ while (parent && isWrapper(parent)) parent = parent.parent;
347
336
  if (isPlus(parent)) return;
348
337
  const parts = [];
349
338
  operands(node, parts);
@@ -391,8 +380,7 @@ const noConcatenation = {
391
380
  };
392
381
  }
393
382
  };
394
- //#endregion
395
- //#region src/lint/rules/no-dynamic-message.ts
383
+ // src/lint/rules/no-dynamic-message.ts
396
384
  const CODES = /* @__PURE__ */ new Set([
397
385
  "extract-dynamic-message",
398
386
  "extract-non-literal-option",
@@ -414,8 +402,11 @@ const noDynamicMessage = {
414
402
  } };
415
403
  }
416
404
  };
417
- //#endregion
418
- //#region src/lint/jsx.ts
405
+ // src/lint/jsx.ts
406
+ /**
407
+ * JSX helpers of the literal-text rules (`no-literal-string`,
408
+ * `translate-a11y-attrs`, PLAN §4.13, §4.16).
409
+ */
419
410
  /** Attributes assistive technology reads or browsers show as text (`translate-a11y-attrs`). */
420
411
  const A11Y_ATTRIBUTES = [
421
412
  "alt",
@@ -508,12 +499,28 @@ function renderedStrings(expression) {
508
499
  stack.push(next.right);
509
500
  if (next.operator !== "&&") stack.push(next.left);
510
501
  break;
511
- case "TSAsExpression":
512
- case "TSSatisfiesExpression":
513
- case "TSNonNullExpression": stack.push(next.expression);
502
+ default: if (isWrapper(next)) stack.push(next.expression);
514
503
  }
515
504
  return out;
516
505
  }
506
+ /**
507
+ * Reports, as `attribute`, each literal the attribute's value can render
508
+ * that `skip` does not excuse.
509
+ */
510
+ function reportAttributeLiterals(context, attribute, name, skip) {
511
+ for (const literal of renderedStrings(attribute.value)) {
512
+ const text = literalText(literal);
513
+ if (skip(literal, text)) continue;
514
+ context.report({
515
+ node: literal,
516
+ messageId: "attribute",
517
+ data: {
518
+ name,
519
+ text: quote(text)
520
+ }
521
+ });
522
+ }
523
+ }
517
524
  /** The text of a literal `renderedStrings` returned. */
518
525
  function literalText(node) {
519
526
  if (node.type === "Literal") return node.value;
@@ -533,8 +540,7 @@ function quote(text) {
533
540
  const flat = text.trim().replace(/\s+/g, " ");
534
541
  return flat.length > 40 ? `${flat.slice(0, 39)}…` : flat;
535
542
  }
536
- //#endregion
537
- //#region src/lint/rules/no-literal-string.ts
543
+ // src/lint/rules/no-literal-string.ts
538
544
  /**
539
545
  * `no-literal-string` (PLAN §4.13): text a JSX component renders without a
540
546
  * translation call: JSX text, string children (`{"…"}`, either branch of a
@@ -550,6 +556,14 @@ const strings = {
550
556
  items: { type: "string" },
551
557
  uniqueItems: true
552
558
  };
559
+ /** A user's `ignore` pattern; a bad one names the rule and the option instead of failing every file. */
560
+ function ignorePattern(source) {
561
+ try {
562
+ return new RegExp(source, "u");
563
+ } catch (error) {
564
+ throw new Error(`vi18n/no-literal-string: ignore pattern ${JSON.stringify(source)} is not a valid regular expression: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
565
+ }
566
+ }
553
567
  const noLiteralString = {
554
568
  meta: {
555
569
  type: "suggestion",
@@ -572,7 +586,7 @@ const noLiteralString = {
572
586
  const options = context.options[0] ?? {};
573
587
  const attributes = new Set(options.attributes ?? ["label"]);
574
588
  const elements = new Set(options.ignoreElements ?? IGNORED_ELEMENTS);
575
- const patterns = (options.ignore ?? []).map((source) => new RegExp(source, "u"));
589
+ const patterns = (options.ignore ?? []).map(ignorePattern);
576
590
  const analysis = analyse(context);
577
591
  const skip = (node, text) => !hasLetters(text) || patterns.some((pattern) => pattern.test(text.trim())) || ignored(analysis, node) || untranslatable(node, elements);
578
592
  return {
@@ -598,23 +612,12 @@ const noLiteralString = {
598
612
  const name = jsxName(node.name);
599
613
  if (name === null || node.value === null) return;
600
614
  if (!attributes.has(name) && !isButtonValue(node)) return;
601
- for (const literal of renderedStrings(node.value)) {
602
- const text = literalText(literal);
603
- if (!skip(literal, text)) context.report({
604
- node: literal,
605
- messageId: "attribute",
606
- data: {
607
- name,
608
- text: quote(text)
609
- }
610
- });
611
- }
615
+ reportAttributeLiterals(context, node, name, skip);
612
616
  }
613
617
  };
614
618
  }
615
619
  };
616
- //#endregion
617
- //#region src/lint/rules/no-module-scope-t.ts
620
+ // src/lint/rules/no-module-scope-t.ts
618
621
  /**
619
622
  * `no-module-scope-t`: `extract-module-scope`, a `t()` call that runs when
620
623
  * the module is imported (PLAN §5.3). The top level of a Vue or Svelte
@@ -639,8 +642,7 @@ const noModuleScopeT = {
639
642
  } };
640
643
  }
641
644
  };
642
- //#endregion
643
- //#region src/lint/rules/prefer-full-sentence.ts
645
+ // src/lint/rules/prefer-full-sentence.ts
644
646
  /**
645
647
  * `prefer-full-sentence`: a message that reads as part of a sentence, which
646
648
  * code then completes with other text or another message. Translators need
@@ -728,8 +730,7 @@ const preferFullSentence = {
728
730
  } };
729
731
  }
730
732
  };
731
- //#endregion
732
- //#region src/lint/rules/t-result-captured.ts
733
+ // src/lint/rules/t-result-captured.ts
733
734
  /**
734
735
  * `t-result-captured`: a translation computed once and kept, which an
735
736
  * in-place locale switch leaves in the old locale (PLAN §5.15). The same
@@ -759,8 +760,7 @@ const tResultCaptured = {
759
760
  } };
760
761
  }
761
762
  };
762
- //#endregion
763
- //#region src/lint/rules/translate-a11y-attrs.ts
763
+ // src/lint/rules/translate-a11y-attrs.ts
764
764
  /**
765
765
  * `translate-a11y-attrs` (PLAN §4.16): literal text in the attributes
766
766
  * screen readers announce and browsers show (`alt`, `aria-label`,
@@ -793,23 +793,11 @@ const translateA11yAttrs = {
793
793
  return { JSXAttribute(node) {
794
794
  const name = jsxName(node.name);
795
795
  if (name === null || node.value === null || !attributes.has(name)) return;
796
- for (const literal of renderedStrings(node.value)) {
797
- const text = literalText(literal);
798
- if (!hasLetters(text) || ignored(analysis, literal) || untranslatable(literal, NO_ELEMENTS)) continue;
799
- context.report({
800
- node: literal,
801
- messageId: "attribute",
802
- data: {
803
- name,
804
- text: quote(text)
805
- }
806
- });
807
- }
796
+ reportAttributeLiterals(context, node, name, (literal, text) => !hasLetters(text) || ignored(analysis, literal) || untranslatable(literal, NO_ELEMENTS));
808
797
  } };
809
798
  }
810
799
  };
811
- //#endregion
812
- //#region src/lint/rules/valid-icu.ts
800
+ // src/lint/rules/valid-icu.ts
813
801
  /**
814
802
  * `valid-icu`: the ICU checks `vite build` and `vi18n extract` run on every
815
803
  * extracted message (INTERNALS §2.1.3): syntax, argument styles and
@@ -893,8 +881,7 @@ function apostropheFix(node, code) {
893
881
  }
894
882
  return `${quote}${body}${quote}`;
895
883
  }
896
- //#endregion
897
- //#region src/lint/plugin.ts
884
+ // src/lint/plugin.ts
898
885
  /**
899
886
  * The `@menapo/vi18n/lint` plugin (PLAN §4.13, §5.21; INTERNALS §3.7): ESLint
900
887
  * v9 rules that oxlint loads through `jsPlugins`, so they run inside `vp
@@ -925,12 +912,15 @@ const rules = {
925
912
  const { range } = diagnostic;
926
913
  if (!diagnostic.code.startsWith("icu-") || range === void 0) continue;
927
914
  if (diagnostic.code !== "icu-apostrophe") reportRange(context, range, "icu", { message: diagnostic.message });
928
- else if (!apostrophes.has(range[0])) apostrophes.set(range[0], diagnostic);
915
+ else if (!apostrophes.has(range[0])) apostrophes.set(range[0], {
916
+ diagnostic,
917
+ range
918
+ });
929
919
  }
930
- for (const [start, diagnostic] of apostrophes) {
920
+ for (const [start, { diagnostic, range }] of apostrophes) {
931
921
  const literal = analysis.literals.get(start);
932
922
  const fixed = literal === void 0 ? null : apostropheFix(literal, analysis.code);
933
- reportRange(context, diagnostic.range, "icu", { message: diagnostic.message }, fixed === null || literal === void 0 ? void 0 : (fixer) => fixer.replaceTextRange(literal.range, fixed));
923
+ reportRange(context, range, "icu", { message: diagnostic.message }, fixed === null || literal === void 0 ? void 0 : (fixer) => fixer.replaceTextRange(literal.range, fixed));
934
924
  }
935
925
  } };
936
926
  }
@@ -959,13 +949,11 @@ const plugin = {
959
949
  configs: { recommended }
960
950
  };
961
951
  recommended.plugins.vi18n = plugin;
962
- //#endregion
963
- //#region src/lint.ts
952
+ // src/lint.ts
964
953
  /**
965
954
  * `@menapo/vi18n/lint` (INTERNALS §3.7): the lint plugin, as the module's
966
955
  * default export because ESLint flat configs and oxlint's `jsPlugins` both
967
956
  * load a plugin that way.
968
957
  */
969
958
  var lint_default = plugin;
970
- //#endregion
971
959
  export { lint_default as default };