@intlayer/cli 5.7.6 → 5.7.8

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 (68) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/fill.cjs +82 -54
  3. package/dist/cjs/fill.cjs.map +1 -1
  4. package/dist/esm/fill.mjs +86 -56
  5. package/dist/esm/fill.mjs.map +1 -1
  6. package/dist/types/fill.d.ts +1 -0
  7. package/dist/types/fill.d.ts.map +1 -1
  8. package/package.json +13 -13
  9. package/dist/cjs/cli.test.cjs +0 -435
  10. package/dist/cjs/cli.test.cjs.map +0 -1
  11. package/dist/cjs/utils/calculateChunks.test.cjs +0 -104
  12. package/dist/cjs/utils/calculateChunks.test.cjs.map +0 -1
  13. package/dist/cjs/utils/checkFileModifiedRange.test.cjs +0 -175
  14. package/dist/cjs/utils/checkFileModifiedRange.test.cjs.map +0 -1
  15. package/dist/cjs/utils/fixChunkStartEndChars.test.cjs +0 -81
  16. package/dist/cjs/utils/fixChunkStartEndChars.test.cjs.map +0 -1
  17. package/dist/cjs/utils/formatTimeDiff.test.cjs +0 -32
  18. package/dist/cjs/utils/formatTimeDiff.test.cjs.map +0 -1
  19. package/dist/cjs/utils/getChunk.test.cjs +0 -46
  20. package/dist/cjs/utils/getChunk.test.cjs.map +0 -1
  21. package/dist/cjs/utils/getOutputFilePath.test.cjs +0 -73
  22. package/dist/cjs/utils/getOutputFilePath.test.cjs.map +0 -1
  23. package/dist/cjs/utils/listSpecialChars.test.cjs +0 -58
  24. package/dist/cjs/utils/listSpecialChars.test.cjs.map +0 -1
  25. package/dist/cjs/utils/reorderParagraphs.test.cjs +0 -71
  26. package/dist/cjs/utils/reorderParagraphs.test.cjs.map +0 -1
  27. package/dist/cjs/utils/splitTextByLine.test.cjs +0 -14
  28. package/dist/cjs/utils/splitTextByLine.test.cjs.map +0 -1
  29. package/dist/esm/cli.test.mjs +0 -412
  30. package/dist/esm/cli.test.mjs.map +0 -1
  31. package/dist/esm/utils/calculateChunks.test.mjs +0 -103
  32. package/dist/esm/utils/calculateChunks.test.mjs.map +0 -1
  33. package/dist/esm/utils/checkFileModifiedRange.test.mjs +0 -181
  34. package/dist/esm/utils/checkFileModifiedRange.test.mjs.map +0 -1
  35. package/dist/esm/utils/fixChunkStartEndChars.test.mjs +0 -80
  36. package/dist/esm/utils/fixChunkStartEndChars.test.mjs.map +0 -1
  37. package/dist/esm/utils/formatTimeDiff.test.mjs +0 -31
  38. package/dist/esm/utils/formatTimeDiff.test.mjs.map +0 -1
  39. package/dist/esm/utils/getChunk.test.mjs +0 -45
  40. package/dist/esm/utils/getChunk.test.mjs.map +0 -1
  41. package/dist/esm/utils/getOutputFilePath.test.mjs +0 -72
  42. package/dist/esm/utils/getOutputFilePath.test.mjs.map +0 -1
  43. package/dist/esm/utils/listSpecialChars.test.mjs +0 -57
  44. package/dist/esm/utils/listSpecialChars.test.mjs.map +0 -1
  45. package/dist/esm/utils/reorderParagraphs.test.mjs +0 -70
  46. package/dist/esm/utils/reorderParagraphs.test.mjs.map +0 -1
  47. package/dist/esm/utils/splitTextByLine.test.mjs +0 -13
  48. package/dist/esm/utils/splitTextByLine.test.mjs.map +0 -1
  49. package/dist/types/cli.test.d.ts +0 -2
  50. package/dist/types/cli.test.d.ts.map +0 -1
  51. package/dist/types/utils/calculateChunks.test.d.ts +0 -2
  52. package/dist/types/utils/calculateChunks.test.d.ts.map +0 -1
  53. package/dist/types/utils/checkFileModifiedRange.test.d.ts +0 -2
  54. package/dist/types/utils/checkFileModifiedRange.test.d.ts.map +0 -1
  55. package/dist/types/utils/fixChunkStartEndChars.test.d.ts +0 -2
  56. package/dist/types/utils/fixChunkStartEndChars.test.d.ts.map +0 -1
  57. package/dist/types/utils/formatTimeDiff.test.d.ts +0 -2
  58. package/dist/types/utils/formatTimeDiff.test.d.ts.map +0 -1
  59. package/dist/types/utils/getChunk.test.d.ts +0 -2
  60. package/dist/types/utils/getChunk.test.d.ts.map +0 -1
  61. package/dist/types/utils/getOutputFilePath.test.d.ts +0 -2
  62. package/dist/types/utils/getOutputFilePath.test.d.ts.map +0 -1
  63. package/dist/types/utils/listSpecialChars.test.d.ts +0 -2
  64. package/dist/types/utils/listSpecialChars.test.d.ts.map +0 -1
  65. package/dist/types/utils/reorderParagraphs.test.d.ts +0 -2
  66. package/dist/types/utils/reorderParagraphs.test.d.ts.map +0 -1
  67. package/dist/types/utils/splitTextByLine.test.d.ts +0 -2
  68. package/dist/types/utils/splitTextByLine.test.d.ts.map +0 -1
@@ -1,181 +0,0 @@
1
- import {
2
- afterEach,
3
- beforeEach,
4
- describe,
5
- expect,
6
- it,
7
- vi
8
- } from "vitest";
9
- vi.mock("./checkLastUpdateTime", () => {
10
- return {
11
- checkLastUpdateTime: vi.fn(() => /* @__PURE__ */ new Date())
12
- // pretend the file was just modified
13
- };
14
- });
15
- import { checkFileModifiedRange } from "./checkFileModifiedRange.mjs";
16
- import { checkLastUpdateTime } from "./checkLastUpdateTime.mjs";
17
- describe("checkFileModifiedRange", () => {
18
- beforeEach(() => {
19
- vi.useFakeTimers();
20
- vi.setSystemTime(/* @__PURE__ */ new Date("2025-01-01"));
21
- });
22
- afterEach(() => {
23
- vi.useRealTimers();
24
- vi.clearAllMocks();
25
- });
26
- const testList = [
27
- {
28
- // |---a---|
29
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
30
- // a
31
- isSkipped: false
32
- // No constraints
33
- },
34
- {
35
- // |-min-a-max-|
36
- skipIfModifiedBefore: "2024-01-01",
37
- // min
38
- skipIfModifiedAfter: "2026-01-01",
39
- // max
40
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
41
- // a
42
- isSkipped: true
43
- // During the range
44
- },
45
- {
46
- // |-min-max-a-|
47
- skipIfModifiedBefore: "2024-01-01",
48
- // min
49
- skipIfModifiedAfter: "2026-01-01",
50
- // max
51
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
52
- // a
53
- isSkipped: false
54
- // After the range
55
- },
56
- {
57
- // |-a-min-max-|
58
- skipIfModifiedBefore: "2024-01-01",
59
- // min
60
- skipIfModifiedAfter: "2026-01-01",
61
- // max
62
- fileModifiedTime: /* @__PURE__ */ new Date("2023-01-01"),
63
- // a
64
- isSkipped: false
65
- // Before the range
66
- },
67
- {
68
- // |-a-min-|
69
- skipIfModifiedBefore: "2024-01-01",
70
- // min
71
- fileModifiedTime: /* @__PURE__ */ new Date("2023-01-01"),
72
- // a
73
- isSkipped: false
74
- // Before the skipIfModifiedBefore
75
- },
76
- {
77
- // |-min-a-|
78
- skipIfModifiedBefore: "2024-01-01",
79
- // min
80
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
81
- // a
82
- isSkipped: true
83
- // After the skipIfModifiedBefore
84
- },
85
- {
86
- // |-a-max-|
87
- skipIfModifiedAfter: "2026-01-01",
88
- // max
89
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
90
- // a
91
- isSkipped: true
92
- // Before the skipIfModifiedAfter
93
- },
94
- {
95
- // |-max-a-|
96
- skipIfModifiedAfter: "2026-01-01",
97
- // max
98
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
99
- // a
100
- isSkipped: true
101
- // After the skipIfModifiedAfter
102
- },
103
- {
104
- // |-min-max-a-|
105
- skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1e3,
106
- // min // 3 year ago
107
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
108
- // max // 1 year
109
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
110
- // a
111
- isSkipped: false
112
- // Before the range
113
- },
114
- {
115
- // |-a-max-|
116
- skipIfModifiedAfter: 0,
117
- // max // now
118
- fileModifiedTime: /* @__PURE__ */ new Date("2024-01-01"),
119
- // a
120
- isSkipped: false
121
- // Before the skipIfModifiedAfter
122
- },
123
- {
124
- // |-min-a-|
125
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
126
- // max // 1 year
127
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
128
- // a
129
- isSkipped: true
130
- // Before the skipIfModifiedAfter
131
- },
132
- {
133
- // |-min-a-max-|
134
- skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1e3,
135
- // min // 3 year ago
136
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
137
- // max // 1 year
138
- fileModifiedTime: /* @__PURE__ */ new Date("2023-01-01"),
139
- // a
140
- isSkipped: true
141
- // After the range
142
- },
143
- {
144
- // |-a-min-max-|
145
- skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1e3,
146
- // min // 3 year ago
147
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
148
- // max // 1 year
149
- fileModifiedTime: /* @__PURE__ */ new Date("2020-01-01"),
150
- // a
151
- isSkipped: false
152
- // Before the range
153
- },
154
- {
155
- // |-min-max-a-|
156
- skipIfModifiedBefore: "2024-01-01T00:00:00Z",
157
- // min
158
- skipIfModifiedAfter: "2026-01-01T00:00:00Z",
159
- // max
160
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
161
- // a
162
- isSkipped: false
163
- // After the range
164
- }
165
- ];
166
- testList.forEach((test) => {
167
- it(`should correctly handle string date inputs (absolute time) outside of the range`, () => {
168
- const filePath = "test/file.txt";
169
- checkLastUpdateTime.mockReturnValue(
170
- // If a specific mocked modification time is provided, use it. Otherwise, fall back to "now".
171
- test.fileModifiedTime ?? /* @__PURE__ */ new Date()
172
- );
173
- const { isSkipped } = checkFileModifiedRange(filePath, {
174
- skipIfModifiedBefore: test.skipIfModifiedBefore,
175
- skipIfModifiedAfter: test.skipIfModifiedAfter
176
- });
177
- expect(isSkipped).toBe(test.isSkipped);
178
- });
179
- });
180
- });
181
- //# sourceMappingURL=checkFileModifiedRange.test.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/checkFileModifiedRange.test.ts"],"sourcesContent":["import {\n afterEach,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n type Mock,\n} from 'vitest';\n\n// We are testing the public helper. The helper itself internally relies on\n// `checkLastUpdateTime`, which hits the file-system. To keep the test\n// deterministic (and independent from the real FS) we mock this dependency so\n// that we can control the last modification date that the helper receives.\n\n// NOTE: `vi.mock` must be called *before* the module under test is imported.\nvi.mock('./checkLastUpdateTime', () => {\n return {\n checkLastUpdateTime: vi.fn(() => new Date()), // pretend the file was just modified\n };\n});\n\nimport { checkFileModifiedRange } from './checkFileModifiedRange';\nimport { checkLastUpdateTime } from './checkLastUpdateTime';\n\ndescribe('checkFileModifiedRange', () => {\n beforeEach(() => {\n // Use fake timers so Date.now() is deterministic.\n vi.useFakeTimers();\n // Pin the system time to an arbitrary date for reproducibility\n vi.setSystemTime(new Date('2025-01-01'));\n });\n\n afterEach(() => {\n vi.useRealTimers();\n vi.clearAllMocks();\n });\n\n const testList = [\n {\n // |---a---|\n fileModifiedTime: new Date('2025-01-01'), // a\n isSkipped: false, // No constraints\n },\n {\n // |-min-a-max-|\n skipIfModifiedBefore: '2024-01-01', // min\n skipIfModifiedAfter: '2026-01-01', // max\n fileModifiedTime: new Date('2025-01-01'), // a\n isSkipped: true, // During the range\n },\n {\n // |-min-max-a-|\n skipIfModifiedBefore: '2024-01-01', // min\n skipIfModifiedAfter: '2026-01-01', // max\n fileModifiedTime: new Date('2027-01-01'), // a\n isSkipped: false, // After the range\n },\n {\n // |-a-min-max-|\n skipIfModifiedBefore: '2024-01-01', // min\n skipIfModifiedAfter: '2026-01-01', // max\n fileModifiedTime: new Date('2023-01-01'), // a\n isSkipped: false, // Before the range\n },\n {\n // |-a-min-|\n skipIfModifiedBefore: '2024-01-01', // min\n fileModifiedTime: new Date('2023-01-01'), // a\n isSkipped: false, // Before the skipIfModifiedBefore\n },\n {\n // |-min-a-|\n skipIfModifiedBefore: '2024-01-01', // min\n fileModifiedTime: new Date('2025-01-01'), // a\n isSkipped: true, // After the skipIfModifiedBefore\n },\n {\n // |-a-max-|\n skipIfModifiedAfter: '2026-01-01', // max\n fileModifiedTime: new Date('2027-01-01'), // a\n isSkipped: true, // Before the skipIfModifiedAfter\n },\n {\n // |-max-a-|\n skipIfModifiedAfter: '2026-01-01', // max\n fileModifiedTime: new Date('2027-01-01'), // a\n isSkipped: true, // After the skipIfModifiedAfter\n },\n {\n // |-min-max-a-|\n skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1000, // min // 3 year ago\n skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1000, // max // 1 year\n fileModifiedTime: new Date('2025-01-01'), // a\n isSkipped: false, // Before the range\n },\n {\n // |-a-max-|\n skipIfModifiedAfter: 0, // max // now\n fileModifiedTime: new Date('2024-01-01'), // a\n isSkipped: false, // Before the skipIfModifiedAfter\n },\n {\n // |-min-a-|\n skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1000, // max // 1 year\n fileModifiedTime: new Date('2025-01-01'), // a\n isSkipped: true, // Before the skipIfModifiedAfter\n },\n {\n // |-min-a-max-|\n skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1000, // min // 3 year ago\n skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1000, // max // 1 year\n fileModifiedTime: new Date('2023-01-01'), // a\n isSkipped: true, // After the range\n },\n {\n // |-a-min-max-|\n skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1000, // min // 3 year ago\n skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1000, // max // 1 year\n fileModifiedTime: new Date('2020-01-01'), // a\n isSkipped: false, // Before the range\n },\n {\n // |-min-max-a-|\n skipIfModifiedBefore: '2024-01-01T00:00:00Z', // min\n skipIfModifiedAfter: '2026-01-01T00:00:00Z', // max\n fileModifiedTime: new Date('2027-01-01'), // a\n isSkipped: false, // After the range\n },\n ];\n\n testList.forEach((test) => {\n it(`should correctly handle string date inputs (absolute time) outside of the range`, () => {\n const filePath = 'test/file.txt';\n\n // Simulate the file's last modification time for this test case\n (checkLastUpdateTime as unknown as Mock).mockReturnValue(\n // If a specific mocked modification time is provided, use it. Otherwise, fall back to \"now\".\n test.fileModifiedTime ?? new Date()\n );\n\n const { isSkipped } = checkFileModifiedRange(filePath, {\n skipIfModifiedBefore: test.skipIfModifiedBefore,\n skipIfModifiedAfter: test.skipIfModifiedAfter,\n });\n\n expect(isSkipped).toBe(test.isSkipped);\n });\n });\n});\n"],"mappings":"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","names":[]}
@@ -1,80 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,31 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,45 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,72 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,57 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,70 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { reorderParagraphs } from "./reorderParagraphs.mjs";
3
- const baseText = [
4
- "! Lorem ipsum dolor sit amet consectetur adipiscing elit.",
5
- // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content
6
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
7
- // Similar n1
8
- "- Lorem ipsum dolor sit amet consectetur adipiscing elit.",
9
- "\n\n",
10
- // Empty line
11
- "* Lorem ipsum dolor sit amet consectetur adipiscing elit.",
12
- "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
13
- // No special char
14
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
15
- // Similar n2
16
- "+ Lorem ipsum dolor sit amet consectetur adipiscing elit.",
17
- // Similar n3 but different content
18
- "= Lorem ipsum dolor sit amet consectetur adipiscing elit.",
19
- // Missing content
20
- "& Lorem ipsum dolor sit amet consectetur adipiscing elit."
21
- ].join("\n\n");
22
- const textToReorder = [
23
- "! Lorem ipsum dolor sit amet consectetur adipiscing elit.",
24
- // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content
25
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
26
- // Similar n1
27
- "\n\n",
28
- // Empty line
29
- "* Lorem ipsum dolor sit amet consectetur adipiscing elit.",
30
- "- Lorem ipsum dolor sit amet consectetur adipiscing elit.",
31
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
32
- // Similar n2
33
- "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
34
- // No special char
35
- "+ Lorem ipsum dolor sit amet consectetur adipiscing elit.",
36
- // Similar n3 but different content
37
- "& Lorem ipsum dolor sit amet consectetur adipiscing elit.",
38
- "= Lorem ipsum dolor sit amet consectetur adipiscing elit."
39
- // Missing content
40
- ].join("\n\n");
41
- const texReordered = [
42
- "! Lorem ipsum dolor sit amet consectetur adipiscing elit.",
43
- // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content
44
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
45
- // Similar n1
46
- "- Lorem ipsum dolor sit amet consectetur adipiscing elit.",
47
- "\n\n",
48
- // Empty line
49
- "* Lorem ipsum dolor sit amet consectetur adipiscing elit.",
50
- "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
51
- // No special char
52
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
53
- // Similar n2
54
- "+ Lorem ipsum dolor sit amet consectetur adipiscing elit.",
55
- // Similar n3 but different content
56
- "= Lorem ipsum dolor sit amet consectetur adipiscing elit.",
57
- // Missing content
58
- "& Lorem ipsum dolor sit amet consectetur adipiscing elit."
59
- ].join("\n\n");
60
- describe("reorderParagraphs", () => {
61
- it("should keep the same order when input matches base text", () => {
62
- const result = reorderParagraphs(baseText, baseText);
63
- expect(result).toEqual(baseText);
64
- });
65
- it("should reorder the paragraphs", () => {
66
- const result = reorderParagraphs(textToReorder, baseText);
67
- expect(result).toEqual(texReordered);
68
- });
69
- });
70
- //# sourceMappingURL=reorderParagraphs.test.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/reorderParagraphs.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { reorderParagraphs } from './reorderParagraphs';\n\nconst baseText = [\n '! Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content\n '+ Lorem dolor sit amet consectetur adipiscing elit.', // Similar n1\n '- Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n '\\n\\n', // Empty line\n '* Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit.', // No special char\n '+ Lorem dolor sit amet consectetur adipiscing elit.', // Similar n2\n '+ Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Similar n3 but different content\n '= Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Missing content\n '& Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n].join('\\n\\n');\n\nconst textToReorder = [\n '! Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content\n '+ Lorem dolor sit amet consectetur adipiscing elit.', // Similar n1\n '\\n\\n', // Empty line\n '* Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n '- Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n '+ Lorem dolor sit amet consectetur adipiscing elit.', // Similar n2\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit.', // No special char\n '+ Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Similar n3 but different content\n '& Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n '= Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Missing content\n].join('\\n\\n');\n\nconst texReordered = [\n '! Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content\n '+ Lorem dolor sit amet consectetur adipiscing elit.', // Similar n1\n '- Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n '\\n\\n', // Empty line\n '* Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n 'Lorem ipsum dolor sit amet consectetur adipiscing elit.', // No special char\n '+ Lorem dolor sit amet consectetur adipiscing elit.', // Similar n2\n '+ Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Similar n3 but different content\n '= Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Missing content\n '& Lorem ipsum dolor sit amet consectetur adipiscing elit.',\n].join('\\n\\n');\n\ndescribe('reorderParagraphs', () => {\n it('should keep the same order when input matches base text', () => {\n const result = reorderParagraphs(baseText, baseText);\n expect(result).toEqual(baseText);\n });\n\n it('should reorder the paragraphs', () => {\n const result = reorderParagraphs(textToReorder, baseText);\n expect(result).toEqual(texReordered);\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,yBAAyB;AAElC,MAAM,WAAW;AAAA,EACf;AAAA;AAAA,EAEA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AACF,EAAE,KAAK,MAAM;AAEb,MAAM,gBAAgB;AAAA,EACpB;AAAA;AAAA,EAEA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AACF,EAAE,KAAK,MAAM;AAEb,MAAM,eAAe;AAAA,EACnB;AAAA;AAAA,EAEA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AACF,EAAE,KAAK,MAAM;AAEb,SAAS,qBAAqB,MAAM;AAClC,KAAG,2DAA2D,MAAM;AAClE,UAAM,SAAS,kBAAkB,UAAU,QAAQ;AACnD,WAAO,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACjC,CAAC;AAED,KAAG,iCAAiC,MAAM;AACxC,UAAM,SAAS,kBAAkB,eAAe,QAAQ;AACxD,WAAO,MAAM,EAAE,QAAQ,YAAY;AAAA,EACrC,CAAC;AACH,CAAC;","names":[]}
@@ -1,13 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { splitTextByLines } from "./splitTextByLine.mjs";
3
- describe("splitTextByLines", () => {
4
- it("splits text by lines", () => {
5
- const lines = splitTextByLines("Here a test. \nAnd another one.");
6
- expect(lines).toStrictEqual(["Here a test. \n", "And another one."]);
7
- });
8
- it("splits text by lines with no trailing newline", () => {
9
- const lines = splitTextByLines("Here a test. \n");
10
- expect(lines).toStrictEqual(["Here a test. \n"]);
11
- });
12
- });
13
- //# sourceMappingURL=splitTextByLine.test.mjs.map