@intlayer/cli 5.5.10 → 5.6.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.
- package/README.md +1 -1
- package/dist/cjs/cli.cjs +83 -9
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/cli.test.cjs +435 -0
- package/dist/cjs/cli.test.cjs.map +1 -0
- package/dist/cjs/fill.cjs +8 -12
- package/dist/cjs/fill.cjs.map +1 -1
- package/dist/cjs/index.cjs +5 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/prompts/REVIEW_PROMPT.md +37 -0
- package/dist/cjs/prompts/TRANSLATE_PROMPT.md +38 -0
- package/dist/cjs/pull.cjs +10 -2
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +5 -1
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/cjs/reviewDoc.cjs +229 -0
- package/dist/cjs/reviewDoc.cjs.map +1 -0
- package/dist/cjs/translateDoc.cjs +211 -0
- package/dist/cjs/translateDoc.cjs.map +1 -0
- package/dist/cjs/utils/calculateChunks.cjs +120 -0
- package/dist/cjs/utils/calculateChunks.cjs.map +1 -0
- package/dist/cjs/utils/calculateChunks.test.cjs +104 -0
- package/dist/cjs/utils/calculateChunks.test.cjs.map +1 -0
- package/dist/cjs/utils/calculrateChunkTest.md +9 -0
- package/dist/cjs/utils/checkAIAccess.cjs +40 -0
- package/dist/cjs/utils/checkAIAccess.cjs.map +1 -0
- package/dist/cjs/utils/checkFileModifiedRange.cjs +97 -0
- package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -0
- package/dist/cjs/utils/checkFileModifiedRange.test.cjs +175 -0
- package/dist/cjs/utils/checkFileModifiedRange.test.cjs.map +1 -0
- package/dist/cjs/utils/checkLastUpdateTime.cjs +33 -0
- package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -0
- package/dist/cjs/utils/chunkInference.cjs +58 -0
- package/dist/cjs/utils/chunkInference.cjs.map +1 -0
- package/dist/cjs/utils/fixChunkStartEndChars.cjs +47 -0
- package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -0
- package/dist/cjs/utils/fixChunkStartEndChars.test.cjs +81 -0
- package/dist/cjs/utils/fixChunkStartEndChars.test.cjs.map +1 -0
- package/dist/cjs/utils/formatTimeDiff.cjs +46 -0
- package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -0
- package/dist/cjs/utils/formatTimeDiff.test.cjs +32 -0
- package/dist/cjs/utils/formatTimeDiff.test.cjs.map +1 -0
- package/dist/cjs/utils/getChunk.cjs +77 -0
- package/dist/cjs/utils/getChunk.cjs.map +1 -0
- package/dist/cjs/utils/getChunk.test.cjs +46 -0
- package/dist/cjs/utils/getChunk.test.cjs.map +1 -0
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +36 -0
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -0
- package/dist/cjs/utils/getOutputFilePath.cjs +89 -0
- package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -0
- package/dist/cjs/utils/getOutputFilePath.test.cjs +73 -0
- package/dist/cjs/utils/getOutputFilePath.test.cjs.map +1 -0
- package/dist/cjs/utils/getParentPackageJSON.cjs +47 -0
- package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -0
- package/dist/cjs/utils/listSpecialChars.cjs +78 -0
- package/dist/cjs/utils/listSpecialChars.cjs.map +1 -0
- package/dist/cjs/utils/listSpecialChars.test.cjs +58 -0
- package/dist/cjs/utils/listSpecialChars.test.cjs.map +1 -0
- package/dist/cjs/utils/reorderParagraphs.cjs +125 -0
- package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -0
- package/dist/cjs/utils/reorderParagraphs.test.cjs +71 -0
- package/dist/cjs/utils/reorderParagraphs.test.cjs.map +1 -0
- package/dist/cjs/utils/splitTextByLine.cjs +35 -0
- package/dist/cjs/utils/splitTextByLine.cjs.map +1 -0
- package/dist/cjs/utils/splitTextByLine.test.cjs +14 -0
- package/dist/cjs/utils/splitTextByLine.test.cjs.map +1 -0
- package/dist/esm/cli.mjs +84 -10
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/cli.test.mjs +412 -0
- package/dist/esm/cli.test.mjs.map +1 -0
- package/dist/esm/fill.mjs +8 -12
- package/dist/esm/fill.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/prompts/REVIEW_PROMPT.md +37 -0
- package/dist/esm/prompts/TRANSLATE_PROMPT.md +38 -0
- package/dist/esm/pull.mjs +10 -2
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +5 -1
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/esm/reviewDoc.mjs +198 -0
- package/dist/esm/reviewDoc.mjs.map +1 -0
- package/dist/esm/translateDoc.mjs +180 -0
- package/dist/esm/translateDoc.mjs.map +1 -0
- package/dist/esm/utils/calculateChunks.mjs +96 -0
- package/dist/esm/utils/calculateChunks.mjs.map +1 -0
- package/dist/esm/utils/calculateChunks.test.mjs +103 -0
- package/dist/esm/utils/calculateChunks.test.mjs.map +1 -0
- package/dist/esm/utils/calculrateChunkTest.md +9 -0
- package/dist/esm/utils/checkAIAccess.mjs +16 -0
- package/dist/esm/utils/checkAIAccess.mjs.map +1 -0
- package/dist/esm/utils/checkFileModifiedRange.mjs +73 -0
- package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -0
- package/dist/esm/utils/checkFileModifiedRange.test.mjs +181 -0
- package/dist/esm/utils/checkFileModifiedRange.test.mjs.map +1 -0
- package/dist/esm/utils/checkLastUpdateTime.mjs +9 -0
- package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -0
- package/dist/esm/utils/chunkInference.mjs +34 -0
- package/dist/esm/utils/chunkInference.mjs.map +1 -0
- package/dist/esm/utils/fixChunkStartEndChars.mjs +23 -0
- package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -0
- package/dist/esm/utils/fixChunkStartEndChars.test.mjs +80 -0
- package/dist/esm/utils/fixChunkStartEndChars.test.mjs.map +1 -0
- package/dist/esm/utils/formatTimeDiff.mjs +22 -0
- package/dist/esm/utils/formatTimeDiff.mjs.map +1 -0
- package/dist/esm/utils/formatTimeDiff.test.mjs +31 -0
- package/dist/esm/utils/formatTimeDiff.test.mjs.map +1 -0
- package/dist/esm/utils/getChunk.mjs +53 -0
- package/dist/esm/utils/getChunk.mjs.map +1 -0
- package/dist/esm/utils/getChunk.test.mjs +45 -0
- package/dist/esm/utils/getChunk.test.mjs.map +1 -0
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs +12 -0
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -0
- package/dist/esm/utils/getOutputFilePath.mjs +65 -0
- package/dist/esm/utils/getOutputFilePath.mjs.map +1 -0
- package/dist/esm/utils/getOutputFilePath.test.mjs +72 -0
- package/dist/esm/utils/getOutputFilePath.test.mjs.map +1 -0
- package/dist/esm/utils/getParentPackageJSON.mjs +23 -0
- package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -0
- package/dist/esm/utils/listSpecialChars.mjs +54 -0
- package/dist/esm/utils/listSpecialChars.mjs.map +1 -0
- package/dist/esm/utils/listSpecialChars.test.mjs +57 -0
- package/dist/esm/utils/listSpecialChars.test.mjs.map +1 -0
- package/dist/esm/utils/reorderParagraphs.mjs +101 -0
- package/dist/esm/utils/reorderParagraphs.mjs.map +1 -0
- package/dist/esm/utils/reorderParagraphs.test.mjs +70 -0
- package/dist/esm/utils/reorderParagraphs.test.mjs.map +1 -0
- package/dist/esm/utils/splitTextByLine.mjs +11 -0
- package/dist/esm/utils/splitTextByLine.mjs.map +1 -0
- package/dist/esm/utils/splitTextByLine.test.mjs +13 -0
- package/dist/esm/utils/splitTextByLine.test.mjs.map +1 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/cli.test.d.ts +2 -0
- package/dist/types/cli.test.d.ts.map +1 -0
- package/dist/types/fill.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/dist/types/reviewDoc.d.ts +27 -0
- package/dist/types/reviewDoc.d.ts.map +1 -0
- package/dist/types/translateDoc.d.ts +27 -0
- package/dist/types/translateDoc.d.ts.map +1 -0
- package/dist/types/utils/calculateChunks.d.ts +9 -0
- package/dist/types/utils/calculateChunks.d.ts.map +1 -0
- package/dist/types/utils/calculateChunks.test.d.ts +2 -0
- package/dist/types/utils/calculateChunks.test.d.ts.map +1 -0
- package/dist/types/utils/checkAIAccess.d.ts +4 -0
- package/dist/types/utils/checkAIAccess.d.ts.map +1 -0
- package/dist/types/utils/checkFileModifiedRange.d.ts +11 -0
- package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -0
- package/dist/types/utils/checkFileModifiedRange.test.d.ts +2 -0
- package/dist/types/utils/checkFileModifiedRange.test.d.ts.map +1 -0
- package/dist/types/utils/checkLastUpdateTime.d.ts +9 -0
- package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -0
- package/dist/types/utils/chunkInference.d.ts +12 -0
- package/dist/types/utils/chunkInference.d.ts.map +1 -0
- package/dist/types/utils/fixChunkStartEndChars.d.ts +2 -0
- package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -0
- package/dist/types/utils/fixChunkStartEndChars.test.d.ts +2 -0
- package/dist/types/utils/fixChunkStartEndChars.test.d.ts.map +1 -0
- package/dist/types/utils/formatTimeDiff.d.ts +2 -0
- package/dist/types/utils/formatTimeDiff.d.ts.map +1 -0
- package/dist/types/utils/formatTimeDiff.test.d.ts +2 -0
- package/dist/types/utils/formatTimeDiff.test.d.ts.map +1 -0
- package/dist/types/utils/getChunk.d.ts +9 -0
- package/dist/types/utils/getChunk.d.ts.map +1 -0
- package/dist/types/utils/getChunk.test.d.ts +2 -0
- package/dist/types/utils/getChunk.test.d.ts.map +1 -0
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts +5 -0
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -0
- package/dist/types/utils/getOutputFilePath.d.ts +26 -0
- package/dist/types/utils/getOutputFilePath.d.ts.map +1 -0
- package/dist/types/utils/getOutputFilePath.test.d.ts +2 -0
- package/dist/types/utils/getOutputFilePath.test.d.ts.map +1 -0
- package/dist/types/utils/getParentPackageJSON.d.ts +32 -0
- package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -0
- package/dist/types/utils/listSpecialChars.d.ts +10 -0
- package/dist/types/utils/listSpecialChars.d.ts.map +1 -0
- package/dist/types/utils/listSpecialChars.test.d.ts +2 -0
- package/dist/types/utils/listSpecialChars.test.d.ts.map +1 -0
- package/dist/types/utils/reorderParagraphs.d.ts +8 -0
- package/dist/types/utils/reorderParagraphs.d.ts.map +1 -0
- package/dist/types/utils/reorderParagraphs.test.d.ts +2 -0
- package/dist/types/utils/reorderParagraphs.test.d.ts.map +1 -0
- package/dist/types/utils/splitTextByLine.d.ts +2 -0
- package/dist/types/utils/splitTextByLine.d.ts.map +1 -0
- package/dist/types/utils/splitTextByLine.test.d.ts +2 -0
- package/dist/types/utils/splitTextByLine.test.d.ts.map +1 -0
- package/package.json +15 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/fixChunkStartEndChars.ts"],"sourcesContent":["const CHAR_TO_CHECK_FORMATTING = ['```', '\\n\\n', '\\n', '---', '{{', '}}'];\n\n// Escape a string for use in RegExp\nconst escapeForRegExp = (str: string) =>\n str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&').replace(/\\n/g, '\\\\n');\n\n// Build once the regex that matches any combination of the formatting chars appearing\n// sequentially at the beginning or at the end of a string.\nconst FORMATTING_REGEX_SOURCE = `(?:${CHAR_TO_CHECK_FORMATTING.map(escapeForRegExp).join('|')})+`;\nconst LEADING_FORMATTING_REGEX = new RegExp(`^${FORMATTING_REGEX_SOURCE}`);\nconst TRAILING_FORMATTING_REGEX = new RegExp(`${FORMATTING_REGEX_SOURCE}$`);\n\nexport const fixChunkStartEndChars = (\n reviewedChunkResult: string,\n baseChunkContext: string\n) => {\n let result = reviewedChunkResult;\n\n const baseLeading =\n baseChunkContext.match(LEADING_FORMATTING_REGEX)?.[0] ?? '';\n const baseTrailing =\n baseChunkContext.match(TRAILING_FORMATTING_REGEX)?.[0] ?? '';\n\n const resultLeading = result.match(LEADING_FORMATTING_REGEX)?.[0] ?? '';\n const resultTrailing = result.match(TRAILING_FORMATTING_REGEX)?.[0] ?? '';\n\n // Fix leading formatting\n if (baseLeading !== resultLeading) {\n // Remove current leading formatting found in result and prepend the correct one\n result = baseLeading + result.slice(resultLeading.length);\n }\n\n // Fix trailing formatting\n if (baseTrailing !== resultTrailing) {\n // Remove current trailing formatting found in result and append the correct one\n result =\n result.slice(0, result.length - resultTrailing.length) + baseTrailing;\n }\n\n return result;\n};\n"],"mappings":"AAAA,MAAM,2BAA2B,CAAC,OAAO,QAAQ,MAAM,OAAO,MAAM,IAAI;AAGxE,MAAM,kBAAkB,CAAC,QACvB,IAAI,QAAQ,uBAAuB,MAAM,EAAE,QAAQ,OAAO,KAAK;AAIjE,MAAM,0BAA0B,MAAM,yBAAyB,IAAI,eAAe,EAAE,KAAK,GAAG,CAAC;AAC7F,MAAM,2BAA2B,IAAI,OAAO,IAAI,uBAAuB,EAAE;AACzE,MAAM,4BAA4B,IAAI,OAAO,GAAG,uBAAuB,GAAG;AAEnE,MAAM,wBAAwB,CACnC,qBACA,qBACG;AACH,MAAI,SAAS;AAEb,QAAM,cACJ,iBAAiB,MAAM,wBAAwB,IAAI,CAAC,KAAK;AAC3D,QAAM,eACJ,iBAAiB,MAAM,yBAAyB,IAAI,CAAC,KAAK;AAE5D,QAAM,gBAAgB,OAAO,MAAM,wBAAwB,IAAI,CAAC,KAAK;AACrE,QAAM,iBAAiB,OAAO,MAAM,yBAAyB,IAAI,CAAC,KAAK;AAGvE,MAAI,gBAAgB,eAAe;AAEjC,aAAS,cAAc,OAAO,MAAM,cAAc,MAAM;AAAA,EAC1D;AAGA,MAAI,iBAAiB,gBAAgB;AAEnC,aACE,OAAO,MAAM,GAAG,OAAO,SAAS,eAAe,MAAM,IAAI;AAAA,EAC7D;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { fixChunkStartEndChars } from "./fixChunkStartEndChars.mjs";
|
|
3
|
+
const visible = (str) => str.replace(/\n/g, "\\n");
|
|
4
|
+
describe("fixChunkStartEndChars", () => {
|
|
5
|
+
it("should add the missing starting character when the base chunk starts with it", () => {
|
|
6
|
+
const base = "\nHello world";
|
|
7
|
+
const reviewed = "Hello world";
|
|
8
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
9
|
+
expect(visible(fixed)).toEqual(visible(base));
|
|
10
|
+
});
|
|
11
|
+
it("should add the missing ending character when the base chunk ends with it", () => {
|
|
12
|
+
const base = 'console.log("hi")```';
|
|
13
|
+
const reviewed = 'console.log("hi")';
|
|
14
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
15
|
+
expect(fixed).toEqual(base);
|
|
16
|
+
});
|
|
17
|
+
it("should remove the extra starting character when the base chunk does not start with it", () => {
|
|
18
|
+
const base = "Hello world";
|
|
19
|
+
const reviewed = "\nHello world";
|
|
20
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
21
|
+
expect(visible(fixed)).toEqual(visible(base));
|
|
22
|
+
});
|
|
23
|
+
it("should remove the extra ending character when the base chunk does not end with it", () => {
|
|
24
|
+
const base = "Hello world";
|
|
25
|
+
const reviewed = "Hello world---";
|
|
26
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
27
|
+
expect(fixed).toEqual(base);
|
|
28
|
+
});
|
|
29
|
+
it("should return the reviewed chunk untouched when already matching the base structure", () => {
|
|
30
|
+
const base = "Plain text without special markers";
|
|
31
|
+
const reviewed = "Plain text without special markers";
|
|
32
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
33
|
+
expect(fixed).toEqual(base);
|
|
34
|
+
});
|
|
35
|
+
it("should not remove ```` when the base chunk starts with it", () => {
|
|
36
|
+
const base = "```test";
|
|
37
|
+
const reviewed = "```test";
|
|
38
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
39
|
+
expect(fixed).toEqual(base);
|
|
40
|
+
});
|
|
41
|
+
it("should add ```` when the base chunk ends with it", () => {
|
|
42
|
+
const base = "```test";
|
|
43
|
+
const reviewed = "test";
|
|
44
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
45
|
+
expect(fixed).toEqual(base);
|
|
46
|
+
});
|
|
47
|
+
it("should remove ```` when the base chunk starts with it", () => {
|
|
48
|
+
const base = "test";
|
|
49
|
+
const reviewed = "```test";
|
|
50
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
51
|
+
expect(fixed).toEqual(base);
|
|
52
|
+
});
|
|
53
|
+
it("should not remove ```` when the base chunk finishes with it", () => {
|
|
54
|
+
const base = "test```";
|
|
55
|
+
const reviewed = "test```";
|
|
56
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
57
|
+
expect(fixed).toEqual(base);
|
|
58
|
+
});
|
|
59
|
+
it("should add ```` when the base chunk finishes with it", () => {
|
|
60
|
+
const base = "test```";
|
|
61
|
+
const reviewed = "test";
|
|
62
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
63
|
+
expect(fixed).toEqual(base);
|
|
64
|
+
});
|
|
65
|
+
it("should remove ```` when the base chunk finishes with it", () => {
|
|
66
|
+
const base = "test";
|
|
67
|
+
const reviewed = "test```";
|
|
68
|
+
const fixed = fixChunkStartEndChars(reviewed, base);
|
|
69
|
+
expect(fixed).toEqual(base);
|
|
70
|
+
});
|
|
71
|
+
it("should add the missing char is a char list that matching char list", () => {
|
|
72
|
+
const baseChunk = "```\n\n### 2. **Check if the command is registered**\n";
|
|
73
|
+
const aiGeneratedResult = "\n\n### 2. **V\xE9rifiez si la commande est enregistr\xE9e**\n";
|
|
74
|
+
const fixedResultError = "```### 2. **V\xE9rifiez si la commande est enregistr\xE9e**\n";
|
|
75
|
+
const fixedResultSuccess = "```\n\n### 2. **V\xE9rifiez si la commande est enregistr\xE9e**\n";
|
|
76
|
+
const fixed = fixChunkStartEndChars(aiGeneratedResult, baseChunk);
|
|
77
|
+
expect(fixed).toMatch(/^```\n\n### 2\./);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=fixChunkStartEndChars.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/fixChunkStartEndChars.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { fixChunkStartEndChars } from './fixChunkStartEndChars';\n\n// Helper to visualise new line at the beginning/end of a string when debugging\nconst visible = (str: string) => str.replace(/\\n/g, '\\\\n');\n\ndescribe('fixChunkStartEndChars', () => {\n it('should add the missing starting character when the base chunk starts with it', () => {\n const base = '\\nHello world';\n const reviewed = 'Hello world';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(visible(fixed)).toEqual(visible(base));\n });\n\n it('should add the missing ending character when the base chunk ends with it', () => {\n const base = 'console.log(\"hi\")```';\n const reviewed = 'console.log(\"hi\")';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should remove the extra starting character when the base chunk does not start with it', () => {\n const base = 'Hello world';\n const reviewed = '\\nHello world';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(visible(fixed)).toEqual(visible(base));\n });\n\n it('should remove the extra ending character when the base chunk does not end with it', () => {\n const base = 'Hello world';\n const reviewed = 'Hello world---';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should return the reviewed chunk untouched when already matching the base structure', () => {\n const base = 'Plain text without special markers';\n const reviewed = 'Plain text without special markers';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should not remove ```` when the base chunk starts with it', () => {\n const base = '```test';\n const reviewed = '```test';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should add ```` when the base chunk ends with it', () => {\n const base = '```test';\n const reviewed = 'test';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should remove ```` when the base chunk starts with it', () => {\n const base = 'test';\n const reviewed = '```test';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should not remove ```` when the base chunk finishes with it', () => {\n const base = 'test```';\n const reviewed = 'test```';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should add ```` when the base chunk finishes with it', () => {\n const base = 'test```';\n const reviewed = 'test';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should remove ```` when the base chunk finishes with it', () => {\n const base = 'test';\n const reviewed = 'test```';\n\n const fixed = fixChunkStartEndChars(reviewed, base);\n expect(fixed).toEqual(base);\n });\n\n it('should add the missing char is a char list that matching char list', () => {\n // Here the base chunk as entry for the AI\n const baseChunk =\n '```\\n' + '\\n' + '### 2. **Check if the command is registered**\\n';\n\n // But the translation AI returned a content that is wrong, because the firsts chars are missing\n const aiGeneratedResult =\n '\\n' + '\\n' + '### 2. **Vérifiez si la commande est enregistrée**\\n';\n\n // The current result is this one, but it's wrong because the \\n are missing\n const fixedResultError =\n '```### 2. **Vérifiez si la commande est enregistrée**\\n';\n\n // The correct result should be this one, with the \\n at the beginning\n const fixedResultSuccess =\n '```\\n' + '\\n' + '### 2. **Vérifiez si la commande est enregistrée**\\n';\n\n const fixed = fixChunkStartEndChars(aiGeneratedResult, baseChunk);\n\n // Check if it start by '```\\n' + '\\n' + '### 2.'\n expect(fixed).toMatch(/^```\\n\\n### 2\\./);\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,6BAA6B;AAGtC,MAAM,UAAU,CAAC,QAAgB,IAAI,QAAQ,OAAO,KAAK;AAEzD,SAAS,yBAAyB,MAAM;AACtC,KAAG,gFAAgF,MAAM;AACvF,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,QAAQ,KAAK,CAAC,EAAE,QAAQ,QAAQ,IAAI,CAAC;AAAA,EAC9C,CAAC;AAED,KAAG,4EAA4E,MAAM;AACnF,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,yFAAyF,MAAM;AAChG,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,QAAQ,KAAK,CAAC,EAAE,QAAQ,QAAQ,IAAI,CAAC;AAAA,EAC9C,CAAC;AAED,KAAG,qFAAqF,MAAM;AAC5F,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,uFAAuF,MAAM;AAC9F,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,6DAA6D,MAAM;AACpE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,oDAAoD,MAAM;AAC3D,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,yDAAyD,MAAM;AAChE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,+DAA+D,MAAM;AACtE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,wDAAwD,MAAM;AAC/D,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,2DAA2D,MAAM;AAClE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,QAAQ,sBAAsB,UAAU,IAAI;AAClD,WAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,KAAG,sEAAsE,MAAM;AAE7E,UAAM,YACJ;AAGF,UAAM,oBACJ;AAGF,UAAM,mBACJ;AAGF,UAAM,qBACJ;AAEF,UAAM,QAAQ,sBAAsB,mBAAmB,SAAS;AAGhE,WAAO,KAAK,EAAE,QAAQ,iBAAiB;AAAA,EACzC,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const formatTimeDiff = (realtiveTime) => {
|
|
2
|
+
const diff = realtiveTime.getTime();
|
|
3
|
+
const MS_IN_SECOND = 1e3;
|
|
4
|
+
const MS_IN_MINUTE = 60 * MS_IN_SECOND;
|
|
5
|
+
const MS_IN_HOUR = 60 * MS_IN_MINUTE;
|
|
6
|
+
const MS_IN_DAY = 24 * MS_IN_HOUR;
|
|
7
|
+
const days = Math.floor(diff / MS_IN_DAY);
|
|
8
|
+
const hours = Math.floor(diff % MS_IN_DAY / MS_IN_HOUR);
|
|
9
|
+
const minutes = Math.floor(diff % MS_IN_HOUR / MS_IN_MINUTE);
|
|
10
|
+
const seconds = Math.floor(diff % MS_IN_MINUTE / MS_IN_SECOND);
|
|
11
|
+
if (days > 0) {
|
|
12
|
+
return `${days}d ${hours}h ${minutes}m ${seconds}s`;
|
|
13
|
+
}
|
|
14
|
+
if (hours > 0) {
|
|
15
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
16
|
+
}
|
|
17
|
+
return `${minutes}m ${seconds}s`;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
formatTimeDiff
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=formatTimeDiff.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/formatTimeDiff.ts"],"sourcesContent":["export const formatTimeDiff = (realtiveTime: Date): string => {\n const diff = realtiveTime.getTime();\n\n const MS_IN_SECOND = 1000;\n const MS_IN_MINUTE = 60 * MS_IN_SECOND;\n const MS_IN_HOUR = 60 * MS_IN_MINUTE;\n const MS_IN_DAY = 24 * MS_IN_HOUR;\n\n const days = Math.floor(diff / MS_IN_DAY);\n const hours = Math.floor((diff % MS_IN_DAY) / MS_IN_HOUR);\n const minutes = Math.floor((diff % MS_IN_HOUR) / MS_IN_MINUTE);\n const seconds = Math.floor((diff % MS_IN_MINUTE) / MS_IN_SECOND);\n\n if (days > 0) {\n return `${days}d ${hours}h ${minutes}m ${seconds}s`;\n }\n if (hours > 0) {\n return `${hours}h ${minutes}m ${seconds}s`;\n }\n\n return `${minutes}m ${seconds}s`;\n};\n"],"mappings":"AAAO,MAAM,iBAAiB,CAAC,iBAA+B;AAC5D,QAAM,OAAO,aAAa,QAAQ;AAElC,QAAM,eAAe;AACrB,QAAM,eAAe,KAAK;AAC1B,QAAM,aAAa,KAAK;AACxB,QAAM,YAAY,KAAK;AAEvB,QAAM,OAAO,KAAK,MAAM,OAAO,SAAS;AACxC,QAAM,QAAQ,KAAK,MAAO,OAAO,YAAa,UAAU;AACxD,QAAM,UAAU,KAAK,MAAO,OAAO,aAAc,YAAY;AAC7D,QAAM,UAAU,KAAK,MAAO,OAAO,eAAgB,YAAY;AAE/D,MAAI,OAAO,GAAG;AACZ,WAAO,GAAG,IAAI,KAAK,KAAK,KAAK,OAAO,KAAK,OAAO;AAAA,EAClD;AACA,MAAI,QAAQ,GAAG;AACb,WAAO,GAAG,KAAK,KAAK,OAAO,KAAK,OAAO;AAAA,EACzC;AAEA,SAAO,GAAG,OAAO,KAAK,OAAO;AAC/B;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { formatTimeDiff } from "./formatTimeDiff.mjs";
|
|
3
|
+
describe("formatTimeDiff", () => {
|
|
4
|
+
const fixedNow = /* @__PURE__ */ new Date("2025-01-01T00:00:00Z");
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
vi.useFakeTimers();
|
|
7
|
+
vi.setSystemTime(fixedNow);
|
|
8
|
+
});
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
vi.useRealTimers();
|
|
11
|
+
});
|
|
12
|
+
it("formats differences containing days", () => {
|
|
13
|
+
const past = new Date(
|
|
14
|
+
2 * 24 * 60 * 60 * 1e3 + // 2 days
|
|
15
|
+
3 * 60 * 60 * 1e3 + // 3 hours
|
|
16
|
+
4 * 60 * 1e3 + // 4 minutes
|
|
17
|
+
5 * 1e3
|
|
18
|
+
// 5 seconds
|
|
19
|
+
);
|
|
20
|
+
expect(formatTimeDiff(past)).toBe("2d 3h 4m 5s");
|
|
21
|
+
});
|
|
22
|
+
it("formats differences containing hours but no days", () => {
|
|
23
|
+
const past = new Date(3 * 60 * 60 * 1e3 + 15 * 60 * 1e3 + 20 * 1e3);
|
|
24
|
+
expect(formatTimeDiff(past)).toBe("3h 15m 20s");
|
|
25
|
+
});
|
|
26
|
+
it("formats differences containing only minutes and seconds", () => {
|
|
27
|
+
const past = new Date(7 * 60 * 1e3 + 45 * 1e3);
|
|
28
|
+
expect(formatTimeDiff(past)).toBe("7m 45s");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=formatTimeDiff.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/formatTimeDiff.test.ts"],"sourcesContent":["import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\nimport { formatTimeDiff } from './formatTimeDiff';\n\ndescribe('formatTimeDiff', () => {\n const fixedNow = new Date('2025-01-01T00:00:00Z');\n\n beforeEach(() => {\n // Use fake timers so \"now\" is deterministic across tests\n vi.useFakeTimers();\n vi.setSystemTime(fixedNow);\n });\n\n afterEach(() => {\n vi.useRealTimers();\n });\n\n it('formats differences containing days', () => {\n // 2 days, 3 hours, 4 minutes, 5 seconds ago\n const past = new Date(\n 2 * 24 * 60 * 60 * 1000 + // 2 days\n 3 * 60 * 60 * 1000 + // 3 hours\n 4 * 60 * 1000 + // 4 minutes\n 5 * 1000 // 5 seconds\n );\n\n expect(formatTimeDiff(past)).toBe('2d 3h 4m 5s');\n });\n\n it('formats differences containing hours but no days', () => {\n // 3 hours, 15 minutes, 20 seconds ago\n const past = new Date(3 * 60 * 60 * 1000 + 15 * 60 * 1000 + 20 * 1000);\n\n expect(formatTimeDiff(past)).toBe('3h 15m 20s');\n });\n\n it('formats differences containing only minutes and seconds', () => {\n // 7 minutes, 45 seconds ago\n const past = new Date(7 * 60 * 1000 + 45 * 1000);\n\n expect(formatTimeDiff(past)).toBe('7m 45s');\n });\n});\n"],"mappings":"AAAA,SAAS,WAAW,YAAY,UAAU,QAAQ,IAAI,UAAU;AAChE,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB,MAAM;AAC/B,QAAM,WAAW,oBAAI,KAAK,sBAAsB;AAEhD,aAAW,MAAM;AAEf,OAAG,cAAc;AACjB,OAAG,cAAc,QAAQ;AAAA,EAC3B,CAAC;AAED,YAAU,MAAM;AACd,OAAG,cAAc;AAAA,EACnB,CAAC;AAED,KAAG,uCAAuC,MAAM;AAE9C,UAAM,OAAO,IAAI;AAAA,MACf,IAAI,KAAK,KAAK,KAAK;AAAA,MACjB,IAAI,KAAK,KAAK;AAAA,MACd,IAAI,KAAK;AAAA,MACT,IAAI;AAAA;AAAA,IACR;AAEA,WAAO,eAAe,IAAI,CAAC,EAAE,KAAK,aAAa;AAAA,EACjD,CAAC;AAED,KAAG,oDAAoD,MAAM;AAE3D,UAAM,OAAO,IAAI,KAAK,IAAI,KAAK,KAAK,MAAO,KAAK,KAAK,MAAO,KAAK,GAAI;AAErE,WAAO,eAAe,IAAI,CAAC,EAAE,KAAK,YAAY;AAAA,EAChD,CAAC;AAED,KAAG,2DAA2D,MAAM;AAElE,UAAM,OAAO,IAAI,KAAK,IAAI,KAAK,MAAO,KAAK,GAAI;AAE/C,WAAO,eAAe,IAAI,CAAC,EAAE,KAAK,QAAQ;AAAA,EAC5C,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { splitTextByLines } from "./splitTextByLine.mjs";
|
|
2
|
+
const getChunk = (text, options = {}) => {
|
|
3
|
+
const { lineStart, lineLength, charStart, charLength } = options;
|
|
4
|
+
if (lineStart === void 0 && lineLength === void 0 && charStart === void 0 && charLength === void 0) {
|
|
5
|
+
return text;
|
|
6
|
+
}
|
|
7
|
+
const lines = splitTextByLines(text);
|
|
8
|
+
const getCharIndexOfLineStart = (lineNumber) => {
|
|
9
|
+
if (lineNumber <= 0) return 0;
|
|
10
|
+
let idx = 0;
|
|
11
|
+
for (let i = 0; i < Math.min(lineNumber, lines.length); i++) {
|
|
12
|
+
idx += lines[i].length;
|
|
13
|
+
}
|
|
14
|
+
return idx;
|
|
15
|
+
};
|
|
16
|
+
const getCharIndexOfLineEnd = (lineNumber) => {
|
|
17
|
+
if (lineNumber >= lines.length) {
|
|
18
|
+
return text.length;
|
|
19
|
+
}
|
|
20
|
+
const line = lines[lineNumber];
|
|
21
|
+
const lineEnd = getCharIndexOfLineStart(lineNumber) + line.length;
|
|
22
|
+
return lineEnd;
|
|
23
|
+
};
|
|
24
|
+
let effectiveStart = 0;
|
|
25
|
+
let effectiveEnd = text.length;
|
|
26
|
+
if (lineStart !== void 0) {
|
|
27
|
+
effectiveStart = Math.max(
|
|
28
|
+
effectiveStart,
|
|
29
|
+
getCharIndexOfLineStart(lineStart)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (charStart !== void 0) {
|
|
33
|
+
effectiveStart = Math.max(effectiveStart, charStart);
|
|
34
|
+
}
|
|
35
|
+
if (lineLength !== void 0) {
|
|
36
|
+
const endLine = (lineStart ?? 0) + lineLength - 1;
|
|
37
|
+
effectiveEnd = Math.min(effectiveEnd, getCharIndexOfLineEnd(endLine));
|
|
38
|
+
}
|
|
39
|
+
if (charLength !== void 0) {
|
|
40
|
+
effectiveEnd = Math.min(
|
|
41
|
+
effectiveEnd,
|
|
42
|
+
(charStart ?? effectiveStart) + charLength
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
if (effectiveStart >= effectiveEnd) {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
return text.slice(effectiveStart, effectiveEnd);
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
getChunk
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=getChunk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getChunk.ts"],"sourcesContent":["import { splitTextByLines } from './splitTextByLine';\n\ntype TrunkOptions = {\n lineStart?: number;\n lineLength?: number;\n charStart?: number;\n charLength?: number;\n};\n\nexport const getChunk = (text: string, options: TrunkOptions = {}): string => {\n const { lineStart, lineLength, charStart, charLength } = options;\n\n // Fast-path: if no filters were provided, return the whole text\n if (\n lineStart === undefined &&\n lineLength === undefined &&\n charStart === undefined &&\n charLength === undefined\n ) {\n return text;\n }\n\n // ---------------------------------------------------------------------------\n // Utility helpers to convert between line numbers and absolute char indices\n // ---------------------------------------------------------------------------\n const lines = splitTextByLines(text);\n\n const getCharIndexOfLineStart = (lineNumber: number): number => {\n if (lineNumber <= 0) return 0;\n // Sum the length of every previous line\n let idx = 0;\n for (let i = 0; i < Math.min(lineNumber, lines.length); i++) {\n idx += lines[i].length;\n }\n return idx;\n };\n\n const getCharIndexOfLineEnd = (lineNumber: number): number => {\n // If the requested line number exceeds the number of lines, clamp to the last character\n if (lineNumber >= lines.length) {\n return text.length;\n }\n const line = lines[lineNumber];\n const lineEnd = getCharIndexOfLineStart(lineNumber) + line.length;\n\n return lineEnd;\n };\n\n // ---------------------------------------------------------------------------\n // Compute the effective (inclusive) charStart/charEnd for the requested slice\n // ---------------------------------------------------------------------------\n let effectiveStart = 0; // inclusive\n let effectiveEnd = text.length; // exclusive\n\n // Apply line boundaries if provided\n if (lineStart !== undefined) {\n effectiveStart = Math.max(\n effectiveStart,\n getCharIndexOfLineStart(lineStart)\n );\n }\n\n // Apply character boundaries if provided\n if (charStart !== undefined) {\n effectiveStart = Math.max(effectiveStart, charStart);\n }\n\n // Apply line length boundary from lineStart (or 0)\n if (lineLength !== undefined) {\n const endLine = (lineStart ?? 0) + lineLength - 1;\n effectiveEnd = Math.min(effectiveEnd, getCharIndexOfLineEnd(endLine));\n }\n\n // Apply character length boundary from effectiveStart\n if (charLength !== undefined) {\n effectiveEnd = Math.min(\n effectiveEnd,\n (charStart ?? effectiveStart) + charLength\n );\n }\n\n // If bounds do not overlap, return empty string\n if (effectiveStart >= effectiveEnd) {\n return '';\n }\n\n return text.slice(effectiveStart, effectiveEnd);\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AAS1B,MAAM,WAAW,CAAC,MAAc,UAAwB,CAAC,MAAc;AAC5E,QAAM,EAAE,WAAW,YAAY,WAAW,WAAW,IAAI;AAGzD,MACE,cAAc,UACd,eAAe,UACf,cAAc,UACd,eAAe,QACf;AACA,WAAO;AAAA,EACT;AAKA,QAAM,QAAQ,iBAAiB,IAAI;AAEnC,QAAM,0BAA0B,CAAC,eAA+B;AAC9D,QAAI,cAAc,EAAG,QAAO;AAE5B,QAAI,MAAM;AACV,aAAS,IAAI,GAAG,IAAI,KAAK,IAAI,YAAY,MAAM,MAAM,GAAG,KAAK;AAC3D,aAAO,MAAM,CAAC,EAAE;AAAA,IAClB;AACA,WAAO;AAAA,EACT;AAEA,QAAM,wBAAwB,CAAC,eAA+B;AAE5D,QAAI,cAAc,MAAM,QAAQ;AAC9B,aAAO,KAAK;AAAA,IACd;AACA,UAAM,OAAO,MAAM,UAAU;AAC7B,UAAM,UAAU,wBAAwB,UAAU,IAAI,KAAK;AAE3D,WAAO;AAAA,EACT;AAKA,MAAI,iBAAiB;AACrB,MAAI,eAAe,KAAK;AAGxB,MAAI,cAAc,QAAW;AAC3B,qBAAiB,KAAK;AAAA,MACpB;AAAA,MACA,wBAAwB,SAAS;AAAA,IACnC;AAAA,EACF;AAGA,MAAI,cAAc,QAAW;AAC3B,qBAAiB,KAAK,IAAI,gBAAgB,SAAS;AAAA,EACrD;AAGA,MAAI,eAAe,QAAW;AAC5B,UAAM,WAAW,aAAa,KAAK,aAAa;AAChD,mBAAe,KAAK,IAAI,cAAc,sBAAsB,OAAO,CAAC;AAAA,EACtE;AAGA,MAAI,eAAe,QAAW;AAC5B,mBAAe,KAAK;AAAA,MAClB;AAAA,OACC,aAAa,kBAAkB;AAAA,IAClC;AAAA,EACF;AAGA,MAAI,kBAAkB,cAAc;AAClC,WAAO;AAAA,EACT;AAEA,SAAO,KAAK,MAAM,gBAAgB,YAAY;AAChD;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { getChunk } from "./getChunk.mjs";
|
|
3
|
+
const sampleText = [
|
|
4
|
+
"Line 0: The quick brown fox jumps over the lazy dog.",
|
|
5
|
+
"Line 1: Pack my box with five dozen liquor jugs.",
|
|
6
|
+
"Line 2: How razorback-jumping frogs can level six piqued gymnasts!",
|
|
7
|
+
"Line 3: Cozy lummox gives smart squid who asks for job pen.",
|
|
8
|
+
"Line 4: A mad boxer shot a quick, gloved jab to the jaw of his dizzy opponent."
|
|
9
|
+
].join("\n");
|
|
10
|
+
describe("getChunk", () => {
|
|
11
|
+
it("returns the whole text when no filters are provided", () => {
|
|
12
|
+
const result = getChunk(sampleText);
|
|
13
|
+
expect(result).toBe(sampleText);
|
|
14
|
+
});
|
|
15
|
+
it("applies lineStart and lineLength filters", () => {
|
|
16
|
+
const result = getChunk(sampleText, { lineStart: 1, lineLength: 2 });
|
|
17
|
+
const expected = [
|
|
18
|
+
"Line 1: Pack my box with five dozen liquor jugs.\n",
|
|
19
|
+
"Line 2: How razorback-jumping frogs can level six piqued gymnasts!\n"
|
|
20
|
+
].join("");
|
|
21
|
+
expect(result).toBe(expected);
|
|
22
|
+
});
|
|
23
|
+
it("applies charStart and charLength filters", () => {
|
|
24
|
+
const charStart = sampleText.indexOf("quick");
|
|
25
|
+
const charLength = "quick brown fox".length;
|
|
26
|
+
const result = getChunk(sampleText, { charStart, charLength });
|
|
27
|
+
expect(result).toBe("quick brown fox");
|
|
28
|
+
});
|
|
29
|
+
it("combines line and char filters by intersecting their ranges", () => {
|
|
30
|
+
const partial = getChunk(sampleText, {
|
|
31
|
+
lineStart: 0,
|
|
32
|
+
lineLength: 3,
|
|
33
|
+
// lines 0, 1, 2
|
|
34
|
+
// Grab only the first 10 characters of the selected block
|
|
35
|
+
charStart: 0,
|
|
36
|
+
charLength: 10
|
|
37
|
+
});
|
|
38
|
+
expect(partial).toBe("Line 0: Th");
|
|
39
|
+
});
|
|
40
|
+
it("returns an empty string when effectiveStart > effectiveEnd", () => {
|
|
41
|
+
const result = getChunk(sampleText, { charStart: 10, charLength: 0 });
|
|
42
|
+
expect(result).toBe("");
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=getChunk.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getChunk.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\n\nimport { getChunk } from './getChunk';\n\n// Sample multiline string used across test cases\nconst sampleText = [\n 'Line 0: The quick brown fox jumps over the lazy dog.',\n 'Line 1: Pack my box with five dozen liquor jugs.',\n 'Line 2: How razorback-jumping frogs can level six piqued gymnasts!',\n 'Line 3: Cozy lummox gives smart squid who asks for job pen.',\n 'Line 4: A mad boxer shot a quick, gloved jab to the jaw of his dizzy opponent.',\n].join('\\n');\n\ndescribe('getChunk', () => {\n it('returns the whole text when no filters are provided', () => {\n const result = getChunk(sampleText);\n expect(result).toBe(sampleText);\n });\n\n it('applies lineStart and lineLength filters', () => {\n const result = getChunk(sampleText, { lineStart: 1, lineLength: 2 });\n\n // Expected substring is lines 1 and 2 plus the newline in-between\n const expected = [\n 'Line 1: Pack my box with five dozen liquor jugs.\\n',\n 'Line 2: How razorback-jumping frogs can level six piqued gymnasts!\\n',\n ].join('');\n\n expect(result).toBe(expected);\n });\n\n it('applies charStart and charLength filters', () => {\n // Grab substring \"quick brown fox\" from first line\n const charStart = sampleText.indexOf('quick');\n const charLength = 'quick brown fox'.length;\n\n const result = getChunk(sampleText, { charStart, charLength });\n\n expect(result).toBe('quick brown fox');\n });\n\n it('combines line and char filters by intersecting their ranges', () => {\n // Restrict to lines 0-2, then further to characters within those lines\n const partial = getChunk(sampleText, {\n lineStart: 0,\n lineLength: 3, // lines 0, 1, 2\n // Grab only the first 10 characters of the selected block\n charStart: 0,\n charLength: 10,\n });\n\n expect(partial).toBe('Line 0: Th');\n });\n\n it('returns an empty string when effectiveStart > effectiveEnd', () => {\n const result = getChunk(sampleText, { charStart: 10, charLength: 0 });\n expect(result).toBe('');\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,gBAAgB;AAGzB,MAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAEX,SAAS,YAAY,MAAM;AACzB,KAAG,uDAAuD,MAAM;AAC9D,UAAM,SAAS,SAAS,UAAU;AAClC,WAAO,MAAM,EAAE,KAAK,UAAU;AAAA,EAChC,CAAC;AAED,KAAG,4CAA4C,MAAM;AACnD,UAAM,SAAS,SAAS,YAAY,EAAE,WAAW,GAAG,YAAY,EAAE,CAAC;AAGnE,UAAM,WAAW;AAAA,MACf;AAAA,MACA;AAAA,IACF,EAAE,KAAK,EAAE;AAET,WAAO,MAAM,EAAE,KAAK,QAAQ;AAAA,EAC9B,CAAC;AAED,KAAG,4CAA4C,MAAM;AAEnD,UAAM,YAAY,WAAW,QAAQ,OAAO;AAC5C,UAAM,aAAa,kBAAkB;AAErC,UAAM,SAAS,SAAS,YAAY,EAAE,WAAW,WAAW,CAAC;AAE7D,WAAO,MAAM,EAAE,KAAK,iBAAiB;AAAA,EACvC,CAAC;AAED,KAAG,+DAA+D,MAAM;AAEtE,UAAM,UAAU,SAAS,YAAY;AAAA,MACnC,WAAW;AAAA,MACX,YAAY;AAAA;AAAA;AAAA,MAEZ,WAAW;AAAA,MACX,YAAY;AAAA,IACd,CAAC;AAED,WAAO,OAAO,EAAE,KAAK,YAAY;AAAA,EACnC,CAAC;AAED,KAAG,8DAA8D,MAAM;AACrE,UAAM,SAAS,SAAS,YAAY,EAAE,WAAW,IAAI,YAAY,EAAE,CAAC;AACpE,WAAO,MAAM,EAAE,KAAK,EAAE;AAAA,EACxB,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { statSync } from "fs";
|
|
2
|
+
const SKIP_RANGE_OF_LAST_UPDATE_TIME = 0;
|
|
3
|
+
const getIsFileUpdatedRecently = (localeFilePath) => {
|
|
4
|
+
const stats = statSync(localeFilePath);
|
|
5
|
+
const lastModified = new Date(stats.mtime);
|
|
6
|
+
const threshold = new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);
|
|
7
|
+
return lastModified > threshold;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
getIsFileUpdatedRecently
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=getIsFileUpdatedRecently.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getIsFileUpdatedRecently.ts"],"sourcesContent":["import { statSync } from 'fs';\n\nconst SKIP_RANGE_OF_LAST_UPDATE_TIME: number = 0; //2 * 60 * 60 * 1000; // 2 hours\n\n/**\n * Check if file was updated recently, to skip re-translation\n */\nexport const getIsFileUpdatedRecently = (localeFilePath: string): boolean => {\n const stats = statSync(localeFilePath);\n const lastModified = new Date(stats.mtime);\n const threshold = new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);\n\n return lastModified > threshold;\n};\n"],"mappings":"AAAA,SAAS,gBAAgB;AAEzB,MAAM,iCAAyC;AAKxC,MAAM,2BAA2B,CAAC,mBAAoC;AAC3E,QAAM,QAAQ,SAAS,cAAc;AACrC,QAAM,eAAe,IAAI,KAAK,MAAM,KAAK;AACzC,QAAM,YAAY,IAAI,KAAK,KAAK,IAAI,IAAI,8BAA8B;AAEtE,SAAO,eAAe;AACxB;","names":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const getOutputFilePath = (filePath, locale, baseLocale) => {
|
|
2
|
+
if (!filePath || !locale || !baseLocale) {
|
|
3
|
+
throw new Error("filePath, locale, and baseLocale are required");
|
|
4
|
+
}
|
|
5
|
+
let outputFilePath = filePath;
|
|
6
|
+
const replacements = [
|
|
7
|
+
// Template placeholders (processed first)
|
|
8
|
+
{
|
|
9
|
+
pattern: /\{\{baseLocale\}\}/g,
|
|
10
|
+
replacement: "{{locale}}"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
pattern: /\{\{baseLocaleName\}\}/g,
|
|
14
|
+
replacement: "{{localeName}}"
|
|
15
|
+
},
|
|
16
|
+
// Path separators (most specific first)
|
|
17
|
+
{
|
|
18
|
+
// Unix path separators
|
|
19
|
+
pattern: new RegExp(`/${baseLocale}/`, "g"),
|
|
20
|
+
replacement: `/${locale}/`
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
// Windows path separators
|
|
24
|
+
pattern: new RegExp(`\\\\${baseLocale}\\\\`, "g"),
|
|
25
|
+
replacement: `\\${locale}\\`
|
|
26
|
+
},
|
|
27
|
+
// File naming patterns
|
|
28
|
+
{
|
|
29
|
+
// file_en.md → file_fr.md
|
|
30
|
+
pattern: new RegExp(`_${baseLocale}\\.`, "g"),
|
|
31
|
+
replacement: `_${locale}.`
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
// /file_en.md → /file_fr.md
|
|
35
|
+
pattern: new RegExp(`/${baseLocale}_`, "g"),
|
|
36
|
+
replacement: `/${locale}_`
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
// Start of filename pattern en_guide.md → fr_guide.md (or after path separator)
|
|
40
|
+
pattern: new RegExp(`(^|[\\/])${baseLocale}_`, "g"),
|
|
41
|
+
replacement: `$1${locale}_`
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
// Dot delimited pattern guide.en.md → guide.fr.md
|
|
45
|
+
pattern: new RegExp(`\\.${baseLocale}\\.`, "g"),
|
|
46
|
+
replacement: `.${locale}.`
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
for (const { pattern, replacement } of replacements) {
|
|
50
|
+
outputFilePath = outputFilePath.replace(pattern, replacement);
|
|
51
|
+
}
|
|
52
|
+
if (outputFilePath === filePath) {
|
|
53
|
+
const lastDotIndex = filePath.lastIndexOf(".");
|
|
54
|
+
if (lastDotIndex > 0) {
|
|
55
|
+
return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;
|
|
56
|
+
} else {
|
|
57
|
+
return `${filePath}.${locale}`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return outputFilePath;
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
getOutputFilePath
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=getOutputFilePath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getOutputFilePath.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config';\n\n/**\n * Get the output file path by replacing the base locale with the target locale\n *\n * This function handles two types of replacements:\n * 1. Actual locale values (e.g., `/en/` → `/fr/`)\n * 2. Template placeholders (e.g., `{{baseLocale}}` → `{{locale}}`, `{{baseLocaleName}}` → `{{localeName}}`)\n *\n * Replacement patterns:\n * - `/baseLocale/` → `/locale/`\n * - `\\baseLocale\\` → `\\locale\\`\n * - `_baseLocale.` → `_locale.`\n * - `baseLocale_` → `locale_`\n * - `.baseLocaleName.` → `.localeName.`\n * - `{{baseLocale}}` → `{{locale}}`\n * - `{{baseLocaleName}}` → `{{localeName}}`\n *\n * If no patterns match, appends `.locale` to the file extension.\n *\n * @param filePath - The input file path\n * @param locale - The target locale\n * @param baseLocale - The base locale to replace\n * @returns The output file path with locale replacements\n */\nexport const getOutputFilePath = (\n filePath: string,\n locale: LocalesValues,\n baseLocale: LocalesValues\n): string => {\n if (!filePath || !locale || !baseLocale) {\n throw new Error('filePath, locale, and baseLocale are required');\n }\n\n let outputFilePath = filePath;\n\n // Define replacement patterns with global flag to replace all occurrences\n const replacements = [\n // Template placeholders (processed first)\n {\n pattern: /\\{\\{baseLocale\\}\\}/g,\n replacement: '{{locale}}',\n },\n {\n pattern: /\\{\\{baseLocaleName\\}\\}/g,\n replacement: '{{localeName}}',\n },\n\n // Path separators (most specific first)\n {\n // Unix path separators\n pattern: new RegExp(`/${baseLocale}/`, 'g'),\n replacement: `/${locale}/`,\n },\n {\n // Windows path separators\n pattern: new RegExp(`\\\\\\\\${baseLocale}\\\\\\\\`, 'g'),\n replacement: `\\\\${locale}\\\\`,\n },\n\n // File naming patterns\n {\n // file_en.md → file_fr.md\n pattern: new RegExp(`_${baseLocale}\\\\.`, 'g'),\n replacement: `_${locale}.`,\n },\n {\n // /file_en.md → /file_fr.md\n pattern: new RegExp(`/${baseLocale}_`, 'g'),\n replacement: `/${locale}_`,\n },\n {\n // Start of filename pattern en_guide.md → fr_guide.md (or after path separator)\n pattern: new RegExp(`(^|[\\\\/])${baseLocale}_`, 'g'),\n replacement: `$1${locale}_`,\n },\n {\n // Dot delimited pattern guide.en.md → guide.fr.md\n pattern: new RegExp(`\\\\.${baseLocale}\\\\.`, 'g'),\n replacement: `.${locale}.`,\n },\n ];\n\n // Apply all replacements\n for (const { pattern, replacement } of replacements) {\n outputFilePath = outputFilePath.replace(pattern, replacement);\n }\n\n // If no changes were made, append locale as extension\n if (outputFilePath === filePath) {\n const lastDotIndex = filePath.lastIndexOf('.');\n if (lastDotIndex > 0) {\n // Insert locale before the file extension\n return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;\n } else {\n // No extension found, just append\n return `${filePath}.${locale}`;\n }\n }\n\n return outputFilePath;\n};\n"],"mappings":"AAyBO,MAAM,oBAAoB,CAC/B,UACA,QACA,eACW;AACX,MAAI,CAAC,YAAY,CAAC,UAAU,CAAC,YAAY;AACvC,UAAM,IAAI,MAAM,+CAA+C;AAAA,EACjE;AAEA,MAAI,iBAAiB;AAGrB,QAAM,eAAe;AAAA;AAAA,IAEnB;AAAA,MACE,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA;AAAA,IAGA;AAAA;AAAA,MAEE,SAAS,IAAI,OAAO,IAAI,UAAU,KAAK,GAAG;AAAA,MAC1C,aAAa,IAAI,MAAM;AAAA,IACzB;AAAA,IACA;AAAA;AAAA,MAEE,SAAS,IAAI,OAAO,OAAO,UAAU,QAAQ,GAAG;AAAA,MAChD,aAAa,KAAK,MAAM;AAAA,IAC1B;AAAA;AAAA,IAGA;AAAA;AAAA,MAEE,SAAS,IAAI,OAAO,IAAI,UAAU,OAAO,GAAG;AAAA,MAC5C,aAAa,IAAI,MAAM;AAAA,IACzB;AAAA,IACA;AAAA;AAAA,MAEE,SAAS,IAAI,OAAO,IAAI,UAAU,KAAK,GAAG;AAAA,MAC1C,aAAa,IAAI,MAAM;AAAA,IACzB;AAAA,IACA;AAAA;AAAA,MAEE,SAAS,IAAI,OAAO,YAAY,UAAU,KAAK,GAAG;AAAA,MAClD,aAAa,KAAK,MAAM;AAAA,IAC1B;AAAA,IACA;AAAA;AAAA,MAEE,SAAS,IAAI,OAAO,MAAM,UAAU,OAAO,GAAG;AAAA,MAC9C,aAAa,IAAI,MAAM;AAAA,IACzB;AAAA,EACF;AAGA,aAAW,EAAE,SAAS,YAAY,KAAK,cAAc;AACnD,qBAAiB,eAAe,QAAQ,SAAS,WAAW;AAAA,EAC9D;AAGA,MAAI,mBAAmB,UAAU;AAC/B,UAAM,eAAe,SAAS,YAAY,GAAG;AAC7C,QAAI,eAAe,GAAG;AAEpB,aAAO,GAAG,SAAS,MAAM,GAAG,YAAY,CAAC,IAAI,MAAM,GAAG,SAAS,MAAM,YAAY,CAAC;AAAA,IACpF,OAAO;AAEL,aAAO,GAAG,QAAQ,IAAI,MAAM;AAAA,IAC9B;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Locales } from "@intlayer/config";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { getOutputFilePath } from "./getOutputFilePath.mjs";
|
|
4
|
+
const baseLocale = Locales.ENGLISH;
|
|
5
|
+
const targetLocale = Locales.FRENCH;
|
|
6
|
+
describe("getOutputFilePath", () => {
|
|
7
|
+
it("should replace locale in directory paths", () => {
|
|
8
|
+
expect(
|
|
9
|
+
getOutputFilePath("/docs/en/guide.md", targetLocale, baseLocale)
|
|
10
|
+
).toBe("/docs/fr/guide.md");
|
|
11
|
+
});
|
|
12
|
+
it("should handle Windows-style paths", () => {
|
|
13
|
+
expect(
|
|
14
|
+
getOutputFilePath("\\docs\\en\\guide.md", targetLocale, baseLocale)
|
|
15
|
+
).toBe("\\docs\\fr\\guide.md");
|
|
16
|
+
});
|
|
17
|
+
it("should replace locale in file naming patterns", () => {
|
|
18
|
+
expect(getOutputFilePath("guide_en.md", targetLocale, baseLocale)).toBe(
|
|
19
|
+
"guide_fr.md"
|
|
20
|
+
);
|
|
21
|
+
expect(getOutputFilePath("en_guide.md", targetLocale, baseLocale)).toBe(
|
|
22
|
+
"fr_guide.md"
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
it("should handle template placeholders", () => {
|
|
26
|
+
expect(
|
|
27
|
+
getOutputFilePath(
|
|
28
|
+
"/docs/{{baseLocale}}/guide.md",
|
|
29
|
+
targetLocale,
|
|
30
|
+
baseLocale
|
|
31
|
+
)
|
|
32
|
+
).toBe("/docs/{{locale}}/guide.md");
|
|
33
|
+
expect(
|
|
34
|
+
getOutputFilePath("guide.{{baseLocaleName}}.md", targetLocale, baseLocale)
|
|
35
|
+
).toBe("guide.{{localeName}}.md");
|
|
36
|
+
});
|
|
37
|
+
it("should handle locale name patterns", () => {
|
|
38
|
+
expect(getOutputFilePath("guide.en.md", targetLocale, baseLocale)).toBe(
|
|
39
|
+
"guide.fr.md"
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
it("should append locale when no patterns match", () => {
|
|
43
|
+
expect(getOutputFilePath("/docs/guide.md", targetLocale, baseLocale)).toBe(
|
|
44
|
+
"/docs/guide.fr.md"
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
it("should handle files without extensions", () => {
|
|
48
|
+
expect(getOutputFilePath("/docs/guide", targetLocale, baseLocale)).toBe(
|
|
49
|
+
"/docs/guide.fr"
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
it("should handle multiple occurrences", () => {
|
|
53
|
+
expect(
|
|
54
|
+
getOutputFilePath("/en/docs/en/guide_en.md", targetLocale, baseLocale)
|
|
55
|
+
).toBe("/fr/docs/fr/guide_fr.md");
|
|
56
|
+
});
|
|
57
|
+
it("should not duplicate locale parts for composite target locales", () => {
|
|
58
|
+
const compositeTarget = "en-GB";
|
|
59
|
+
expect(getOutputFilePath("/en/file.md", compositeTarget, baseLocale)).toBe(
|
|
60
|
+
"/en-GB/file.md"
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
it("should throw error for invalid inputs", () => {
|
|
64
|
+
expect(() => getOutputFilePath("", targetLocale, baseLocale)).toThrow(
|
|
65
|
+
"filePath, locale, and baseLocale are required"
|
|
66
|
+
);
|
|
67
|
+
expect(
|
|
68
|
+
() => getOutputFilePath("/docs/guide.md", "", baseLocale)
|
|
69
|
+
).toThrow("filePath, locale, and baseLocale are required");
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=getOutputFilePath.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getOutputFilePath.test.ts"],"sourcesContent":["import { Locales } from '@intlayer/config';\nimport { describe, expect, it } from 'vitest';\nimport { getOutputFilePath } from './getOutputFilePath';\n\nconst baseLocale = Locales.ENGLISH;\nconst targetLocale = Locales.FRENCH;\n\ndescribe('getOutputFilePath', () => {\n it('should replace locale in directory paths', () => {\n expect(\n getOutputFilePath('/docs/en/guide.md', targetLocale, baseLocale)\n ).toBe('/docs/fr/guide.md');\n });\n\n it('should handle Windows-style paths', () => {\n expect(\n getOutputFilePath('\\\\docs\\\\en\\\\guide.md', targetLocale, baseLocale)\n ).toBe('\\\\docs\\\\fr\\\\guide.md');\n });\n\n it('should replace locale in file naming patterns', () => {\n expect(getOutputFilePath('guide_en.md', targetLocale, baseLocale)).toBe(\n 'guide_fr.md'\n );\n\n expect(getOutputFilePath('en_guide.md', targetLocale, baseLocale)).toBe(\n 'fr_guide.md'\n );\n });\n\n it('should handle template placeholders', () => {\n expect(\n getOutputFilePath(\n '/docs/{{baseLocale}}/guide.md',\n targetLocale,\n baseLocale\n )\n ).toBe('/docs/{{locale}}/guide.md');\n\n expect(\n getOutputFilePath('guide.{{baseLocaleName}}.md', targetLocale, baseLocale)\n ).toBe('guide.{{localeName}}.md');\n });\n\n it('should handle locale name patterns', () => {\n expect(getOutputFilePath('guide.en.md', targetLocale, baseLocale)).toBe(\n 'guide.fr.md'\n );\n });\n\n it('should append locale when no patterns match', () => {\n expect(getOutputFilePath('/docs/guide.md', targetLocale, baseLocale)).toBe(\n '/docs/guide.fr.md'\n );\n });\n\n it('should handle files without extensions', () => {\n expect(getOutputFilePath('/docs/guide', targetLocale, baseLocale)).toBe(\n '/docs/guide.fr'\n );\n });\n\n it('should handle multiple occurrences', () => {\n expect(\n getOutputFilePath('/en/docs/en/guide_en.md', targetLocale, baseLocale)\n ).toBe('/fr/docs/fr/guide_fr.md');\n });\n\n it('should not duplicate locale parts for composite target locales', () => {\n const compositeTarget = 'en-GB' as unknown as Locales;\n expect(getOutputFilePath('/en/file.md', compositeTarget, baseLocale)).toBe(\n '/en-GB/file.md'\n );\n });\n\n it('should throw error for invalid inputs', () => {\n expect(() => getOutputFilePath('', targetLocale, baseLocale)).toThrow(\n 'filePath, locale, and baseLocale are required'\n );\n\n expect(() =>\n getOutputFilePath('/docs/guide.md', '' as Locales, baseLocale)\n ).toThrow('filePath, locale, and baseLocale are required');\n });\n});\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,yBAAyB;AAElC,MAAM,aAAa,QAAQ;AAC3B,MAAM,eAAe,QAAQ;AAE7B,SAAS,qBAAqB,MAAM;AAClC,KAAG,4CAA4C,MAAM;AACnD;AAAA,MACE,kBAAkB,qBAAqB,cAAc,UAAU;AAAA,IACjE,EAAE,KAAK,mBAAmB;AAAA,EAC5B,CAAC;AAED,KAAG,qCAAqC,MAAM;AAC5C;AAAA,MACE,kBAAkB,wBAAwB,cAAc,UAAU;AAAA,IACpE,EAAE,KAAK,sBAAsB;AAAA,EAC/B,CAAC;AAED,KAAG,iDAAiD,MAAM;AACxD,WAAO,kBAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAEA,WAAO,kBAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF,CAAC;AAED,KAAG,uCAAuC,MAAM;AAC9C;AAAA,MACE;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,EAAE,KAAK,2BAA2B;AAElC;AAAA,MACE,kBAAkB,+BAA+B,cAAc,UAAU;AAAA,IAC3E,EAAE,KAAK,yBAAyB;AAAA,EAClC,CAAC;AAED,KAAG,sCAAsC,MAAM;AAC7C,WAAO,kBAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF,CAAC;AAED,KAAG,+CAA+C,MAAM;AACtD,WAAO,kBAAkB,kBAAkB,cAAc,UAAU,CAAC,EAAE;AAAA,MACpE;AAAA,IACF;AAAA,EACF,CAAC;AAED,KAAG,0CAA0C,MAAM;AACjD,WAAO,kBAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF,CAAC;AAED,KAAG,sCAAsC,MAAM;AAC7C;AAAA,MACE,kBAAkB,2BAA2B,cAAc,UAAU;AAAA,IACvE,EAAE,KAAK,yBAAyB;AAAA,EAClC,CAAC;AAED,KAAG,kEAAkE,MAAM;AACzE,UAAM,kBAAkB;AACxB,WAAO,kBAAkB,eAAe,iBAAiB,UAAU,CAAC,EAAE;AAAA,MACpE;AAAA,IACF;AAAA,EACF,CAAC;AAED,KAAG,yCAAyC,MAAM;AAChD,WAAO,MAAM,kBAAkB,IAAI,cAAc,UAAU,CAAC,EAAE;AAAA,MAC5D;AAAA,IACF;AAEA;AAAA,MAAO,MACL,kBAAkB,kBAAkB,IAAe,UAAU;AAAA,IAC/D,EAAE,QAAQ,+CAA+C;AAAA,EAC3D,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
|
+
import { dirname, resolve } from "path";
|
|
3
|
+
const getParentPackageJSON = (startDir) => {
|
|
4
|
+
let currentDir = startDir;
|
|
5
|
+
while (currentDir !== dirname(currentDir)) {
|
|
6
|
+
const packageJsonPath = resolve(currentDir, "package.json");
|
|
7
|
+
if (existsSync(packageJsonPath)) {
|
|
8
|
+
return JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
9
|
+
}
|
|
10
|
+
currentDir = dirname(currentDir);
|
|
11
|
+
}
|
|
12
|
+
const rootPackageJsonPath = resolve(currentDir, "package.json");
|
|
13
|
+
if (existsSync(rootPackageJsonPath)) {
|
|
14
|
+
return JSON.parse(readFileSync(rootPackageJsonPath, "utf8"));
|
|
15
|
+
}
|
|
16
|
+
throw new Error(
|
|
17
|
+
`No package.json found in any parent directory of ${startDir}`
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
getParentPackageJSON
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=getParentPackageJSON.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/getParentPackageJSON.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { dirname, resolve } from 'path';\n\ntype PackageJSON = {\n name?: string;\n version?: string;\n private: boolean;\n description?: string;\n homepage?: string;\n bugs: {\n url?: string;\n };\n repository: {\n type?: string;\n url?: string;\n };\n license?: string;\n author: {\n name?: string;\n url?: string;\n };\n contributors?: {\n name?: string;\n email?: string;\n url?: string;\n }[];\n type?: string;\n scripts: Record<string, string>;\n devDependencies: Record<string, string>;\n packageManager?: string;\n engines: Record<string, string>;\n};\n\nexport const getParentPackageJSON = (startDir: string): PackageJSON => {\n let currentDir = startDir;\n\n while (currentDir !== dirname(currentDir)) {\n // Stop when we reach the root\n const packageJsonPath = resolve(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n return JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n }\n\n // Move up one directory level\n currentDir = dirname(currentDir);\n }\n\n // Check the root directory as well\n const rootPackageJsonPath = resolve(currentDir, 'package.json');\n if (existsSync(rootPackageJsonPath)) {\n return JSON.parse(readFileSync(rootPackageJsonPath, 'utf8'));\n }\n\n // If no package.json is found in any parent directory\n throw new Error(\n `No package.json found in any parent directory of ${startDir}`\n );\n};\n"],"mappings":"AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,SAAS,eAAe;AAgC1B,MAAM,uBAAuB,CAAC,aAAkC;AACrE,MAAI,aAAa;AAEjB,SAAO,eAAe,QAAQ,UAAU,GAAG;AAEzC,UAAM,kBAAkB,QAAQ,YAAY,cAAc;AAE1D,QAAI,WAAW,eAAe,GAAG;AAC/B,aAAO,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAAC;AAAA,IACzD;AAGA,iBAAa,QAAQ,UAAU;AAAA,EACjC;AAGA,QAAM,sBAAsB,QAAQ,YAAY,cAAc;AAC9D,MAAI,WAAW,mBAAmB,GAAG;AACnC,WAAO,KAAK,MAAM,aAAa,qBAAqB,MAAM,CAAC;AAAA,EAC7D;AAGA,QAAM,IAAI;AAAA,IACR,oDAAoD,QAAQ;AAAA,EAC9D;AACF;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const SPECIAL_CHARS = [
|
|
2
|
+
" ",
|
|
3
|
+
"\\",
|
|
4
|
+
"|",
|
|
5
|
+
"(",
|
|
6
|
+
")",
|
|
7
|
+
"{",
|
|
8
|
+
"}",
|
|
9
|
+
"[",
|
|
10
|
+
"]",
|
|
11
|
+
"<",
|
|
12
|
+
">",
|
|
13
|
+
'"',
|
|
14
|
+
"=",
|
|
15
|
+
"+",
|
|
16
|
+
"*",
|
|
17
|
+
"&",
|
|
18
|
+
"#",
|
|
19
|
+
"%",
|
|
20
|
+
"$",
|
|
21
|
+
"!",
|
|
22
|
+
"?",
|
|
23
|
+
":",
|
|
24
|
+
";",
|
|
25
|
+
"~"
|
|
26
|
+
];
|
|
27
|
+
const listSpecialChars = (text) => {
|
|
28
|
+
const results = [];
|
|
29
|
+
let lineIndex = 0;
|
|
30
|
+
for (let i = 0; i < text.length; i++) {
|
|
31
|
+
const currentChar = text[i];
|
|
32
|
+
if (currentChar === "\n") {
|
|
33
|
+
results.push({
|
|
34
|
+
char: "\\",
|
|
35
|
+
lineStart: lineIndex,
|
|
36
|
+
charStart: i
|
|
37
|
+
});
|
|
38
|
+
lineIndex++;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (SPECIAL_CHARS.includes(currentChar)) {
|
|
42
|
+
results.push({
|
|
43
|
+
char: currentChar,
|
|
44
|
+
lineStart: lineIndex,
|
|
45
|
+
charStart: i
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return results;
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
listSpecialChars
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=listSpecialChars.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/listSpecialChars.ts"],"sourcesContent":["type ListCharResult = {\n char: string;\n /** First line index contained in this chunk (0-based) */\n lineStart: number;\n /** Start character index in the original text (0-based, inclusive)*/\n charStart: number;\n}[];\n\nconst SPECIAL_CHARS = [\n ' ',\n '\\\\',\n '|',\n '(',\n ')',\n '{',\n '}',\n '[',\n ']',\n '<',\n '>',\n '\"',\n '=',\n '+',\n '*',\n '&',\n '#',\n '%',\n '$',\n '!',\n '?',\n ':',\n ';',\n '~',\n];\n\nexport const listSpecialChars = (text: string): ListCharResult => {\n const results: ListCharResult = [];\n\n let lineIndex = 0;\n\n for (let i = 0; i < text.length; i++) {\n const currentChar = text[i];\n\n // Handle newline characters (\"\\n\"): treat them as a \"\\\\\" special char\n if (currentChar === '\\n') {\n results.push({\n char: '\\\\',\n lineStart: lineIndex,\n charStart: i,\n });\n\n // Move to the next line after recording the special char\n lineIndex++;\n continue;\n }\n\n // Check if the current character is one of the special characters\n if (SPECIAL_CHARS.includes(currentChar)) {\n results.push({\n char: currentChar,\n lineStart: lineIndex,\n charStart: i,\n });\n }\n }\n\n return results;\n};\n"],"mappings":"AAQA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,mBAAmB,CAAC,SAAiC;AAChE,QAAM,UAA0B,CAAC;AAEjC,MAAI,YAAY;AAEhB,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,cAAc,KAAK,CAAC;AAG1B,QAAI,gBAAgB,MAAM;AACxB,cAAQ,KAAK;AAAA,QACX,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb,CAAC;AAGD;AACA;AAAA,IACF;AAGA,QAAI,cAAc,SAAS,WAAW,GAAG;AACvC,cAAQ,KAAK;AAAA,QACX,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { listSpecialChars } from "./listSpecialChars.mjs";
|
|
3
|
+
const test = [
|
|
4
|
+
"Lorem ipsum dolor sit amet consectetur adipiscing elit. (Quisque faucibus ex sapien vitae pellentesque sem placerat). In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.",
|
|
5
|
+
"Lorem ipsum dolor sit amet consectetur adipiscing elit! Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.",
|
|
6
|
+
"Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.",
|
|
7
|
+
"Lorem ipsum dolor sit amet consectetur adipiscing elit.. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.",
|
|
8
|
+
"Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos."
|
|
9
|
+
].join("\n");
|
|
10
|
+
describe("listSpecialChars", () => {
|
|
11
|
+
it("should return an empty array if the text is empty", () => {
|
|
12
|
+
const text = "";
|
|
13
|
+
const result = listSpecialChars(text);
|
|
14
|
+
expect(result).toEqual([]);
|
|
15
|
+
});
|
|
16
|
+
it("should return an array of special characters", () => {
|
|
17
|
+
const result = listSpecialChars(test);
|
|
18
|
+
expect(result).toEqual([
|
|
19
|
+
{
|
|
20
|
+
char: "(",
|
|
21
|
+
charStart: 56,
|
|
22
|
+
lineStart: 0
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
char: ")",
|
|
26
|
+
charStart: 115,
|
|
27
|
+
lineStart: 0
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
char: "\\",
|
|
31
|
+
charStart: 439,
|
|
32
|
+
lineStart: 0
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
char: "!",
|
|
36
|
+
charStart: 494,
|
|
37
|
+
lineStart: 1
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
char: "\\",
|
|
41
|
+
charStart: 877,
|
|
42
|
+
lineStart: 1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
char: "\\",
|
|
46
|
+
charStart: 1315,
|
|
47
|
+
lineStart: 2
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
char: "\\",
|
|
51
|
+
charStart: 1754,
|
|
52
|
+
lineStart: 3
|
|
53
|
+
}
|
|
54
|
+
]);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=listSpecialChars.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/listSpecialChars.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { listSpecialChars } from './listSpecialChars';\n\nconst test = [\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit. (Quisque faucibus ex sapien vitae pellentesque sem placerat). In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.',\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit! Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.',\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.',\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit.. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.',\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.',\n].join('\\n');\n\ndescribe('listSpecialChars', () => {\n it('should return an empty array if the text is empty', () => {\n const text = '';\n const result = listSpecialChars(text);\n expect(result).toEqual([]);\n });\n\n it('should return an array of special characters', () => {\n const result = listSpecialChars(test);\n expect(result).toEqual([\n {\n char: '(',\n charStart: 56,\n lineStart: 0,\n },\n {\n char: ')',\n charStart: 115,\n lineStart: 0,\n },\n {\n char: '\\\\',\n charStart: 439,\n lineStart: 0,\n },\n {\n char: '!',\n charStart: 494,\n lineStart: 1,\n },\n {\n char: '\\\\',\n charStart: 877,\n lineStart: 1,\n },\n {\n char: '\\\\',\n charStart: 1315,\n lineStart: 2,\n },\n {\n char: '\\\\',\n charStart: 1754,\n lineStart: 3,\n },\n ]);\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,wBAAwB;AAEjC,MAAM,OAAO;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAEX,SAAS,oBAAoB,MAAM;AACjC,KAAG,qDAAqD,MAAM;AAC5D,UAAM,OAAO;AACb,UAAM,SAAS,iBAAiB,IAAI;AACpC,WAAO,MAAM,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC3B,CAAC;AAED,KAAG,gDAAgD,MAAM;AACvD,UAAM,SAAS,iBAAiB,IAAI;AACpC,WAAO,MAAM,EAAE,QAAQ;AAAA,MACrB;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|