@intlayer/cli 5.7.7 → 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 (67) hide show
  1. package/dist/cjs/fill.cjs +82 -54
  2. package/dist/cjs/fill.cjs.map +1 -1
  3. package/dist/esm/fill.mjs +86 -56
  4. package/dist/esm/fill.mjs.map +1 -1
  5. package/dist/types/fill.d.ts +1 -0
  6. package/dist/types/fill.d.ts.map +1 -1
  7. package/package.json +13 -13
  8. package/dist/cjs/cli.test.cjs +0 -435
  9. package/dist/cjs/cli.test.cjs.map +0 -1
  10. package/dist/cjs/utils/calculateChunks.test.cjs +0 -104
  11. package/dist/cjs/utils/calculateChunks.test.cjs.map +0 -1
  12. package/dist/cjs/utils/checkFileModifiedRange.test.cjs +0 -175
  13. package/dist/cjs/utils/checkFileModifiedRange.test.cjs.map +0 -1
  14. package/dist/cjs/utils/fixChunkStartEndChars.test.cjs +0 -81
  15. package/dist/cjs/utils/fixChunkStartEndChars.test.cjs.map +0 -1
  16. package/dist/cjs/utils/formatTimeDiff.test.cjs +0 -32
  17. package/dist/cjs/utils/formatTimeDiff.test.cjs.map +0 -1
  18. package/dist/cjs/utils/getChunk.test.cjs +0 -46
  19. package/dist/cjs/utils/getChunk.test.cjs.map +0 -1
  20. package/dist/cjs/utils/getOutputFilePath.test.cjs +0 -73
  21. package/dist/cjs/utils/getOutputFilePath.test.cjs.map +0 -1
  22. package/dist/cjs/utils/listSpecialChars.test.cjs +0 -58
  23. package/dist/cjs/utils/listSpecialChars.test.cjs.map +0 -1
  24. package/dist/cjs/utils/reorderParagraphs.test.cjs +0 -71
  25. package/dist/cjs/utils/reorderParagraphs.test.cjs.map +0 -1
  26. package/dist/cjs/utils/splitTextByLine.test.cjs +0 -14
  27. package/dist/cjs/utils/splitTextByLine.test.cjs.map +0 -1
  28. package/dist/esm/cli.test.mjs +0 -412
  29. package/dist/esm/cli.test.mjs.map +0 -1
  30. package/dist/esm/utils/calculateChunks.test.mjs +0 -103
  31. package/dist/esm/utils/calculateChunks.test.mjs.map +0 -1
  32. package/dist/esm/utils/checkFileModifiedRange.test.mjs +0 -181
  33. package/dist/esm/utils/checkFileModifiedRange.test.mjs.map +0 -1
  34. package/dist/esm/utils/fixChunkStartEndChars.test.mjs +0 -80
  35. package/dist/esm/utils/fixChunkStartEndChars.test.mjs.map +0 -1
  36. package/dist/esm/utils/formatTimeDiff.test.mjs +0 -31
  37. package/dist/esm/utils/formatTimeDiff.test.mjs.map +0 -1
  38. package/dist/esm/utils/getChunk.test.mjs +0 -45
  39. package/dist/esm/utils/getChunk.test.mjs.map +0 -1
  40. package/dist/esm/utils/getOutputFilePath.test.mjs +0 -72
  41. package/dist/esm/utils/getOutputFilePath.test.mjs.map +0 -1
  42. package/dist/esm/utils/listSpecialChars.test.mjs +0 -57
  43. package/dist/esm/utils/listSpecialChars.test.mjs.map +0 -1
  44. package/dist/esm/utils/reorderParagraphs.test.mjs +0 -70
  45. package/dist/esm/utils/reorderParagraphs.test.mjs.map +0 -1
  46. package/dist/esm/utils/splitTextByLine.test.mjs +0 -13
  47. package/dist/esm/utils/splitTextByLine.test.mjs.map +0 -1
  48. package/dist/types/cli.test.d.ts +0 -2
  49. package/dist/types/cli.test.d.ts.map +0 -1
  50. package/dist/types/utils/calculateChunks.test.d.ts +0 -2
  51. package/dist/types/utils/calculateChunks.test.d.ts.map +0 -1
  52. package/dist/types/utils/checkFileModifiedRange.test.d.ts +0 -2
  53. package/dist/types/utils/checkFileModifiedRange.test.d.ts.map +0 -1
  54. package/dist/types/utils/fixChunkStartEndChars.test.d.ts +0 -2
  55. package/dist/types/utils/fixChunkStartEndChars.test.d.ts.map +0 -1
  56. package/dist/types/utils/formatTimeDiff.test.d.ts +0 -2
  57. package/dist/types/utils/formatTimeDiff.test.d.ts.map +0 -1
  58. package/dist/types/utils/getChunk.test.d.ts +0 -2
  59. package/dist/types/utils/getChunk.test.d.ts.map +0 -1
  60. package/dist/types/utils/getOutputFilePath.test.d.ts +0 -2
  61. package/dist/types/utils/getOutputFilePath.test.d.ts.map +0 -1
  62. package/dist/types/utils/listSpecialChars.test.d.ts +0 -2
  63. package/dist/types/utils/listSpecialChars.test.d.ts.map +0 -1
  64. package/dist/types/utils/reorderParagraphs.test.d.ts +0 -2
  65. package/dist/types/utils/reorderParagraphs.test.d.ts.map +0 -1
  66. package/dist/types/utils/splitTextByLine.test.d.ts +0 -2
  67. package/dist/types/utils/splitTextByLine.test.d.ts.map +0 -1
@@ -1,175 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_checkFileModifiedRange = require('./checkFileModifiedRange.cjs');
4
- var import_checkLastUpdateTime = require('./checkLastUpdateTime.cjs');
5
- import_vitest.vi.mock("./checkLastUpdateTime", () => {
6
- return {
7
- checkLastUpdateTime: import_vitest.vi.fn(() => /* @__PURE__ */ new Date())
8
- // pretend the file was just modified
9
- };
10
- });
11
- (0, import_vitest.describe)("checkFileModifiedRange", () => {
12
- (0, import_vitest.beforeEach)(() => {
13
- import_vitest.vi.useFakeTimers();
14
- import_vitest.vi.setSystemTime(/* @__PURE__ */ new Date("2025-01-01"));
15
- });
16
- (0, import_vitest.afterEach)(() => {
17
- import_vitest.vi.useRealTimers();
18
- import_vitest.vi.clearAllMocks();
19
- });
20
- const testList = [
21
- {
22
- // |---a---|
23
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
24
- // a
25
- isSkipped: false
26
- // No constraints
27
- },
28
- {
29
- // |-min-a-max-|
30
- skipIfModifiedBefore: "2024-01-01",
31
- // min
32
- skipIfModifiedAfter: "2026-01-01",
33
- // max
34
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
35
- // a
36
- isSkipped: true
37
- // During the range
38
- },
39
- {
40
- // |-min-max-a-|
41
- skipIfModifiedBefore: "2024-01-01",
42
- // min
43
- skipIfModifiedAfter: "2026-01-01",
44
- // max
45
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
46
- // a
47
- isSkipped: false
48
- // After the range
49
- },
50
- {
51
- // |-a-min-max-|
52
- skipIfModifiedBefore: "2024-01-01",
53
- // min
54
- skipIfModifiedAfter: "2026-01-01",
55
- // max
56
- fileModifiedTime: /* @__PURE__ */ new Date("2023-01-01"),
57
- // a
58
- isSkipped: false
59
- // Before the range
60
- },
61
- {
62
- // |-a-min-|
63
- skipIfModifiedBefore: "2024-01-01",
64
- // min
65
- fileModifiedTime: /* @__PURE__ */ new Date("2023-01-01"),
66
- // a
67
- isSkipped: false
68
- // Before the skipIfModifiedBefore
69
- },
70
- {
71
- // |-min-a-|
72
- skipIfModifiedBefore: "2024-01-01",
73
- // min
74
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
75
- // a
76
- isSkipped: true
77
- // After the skipIfModifiedBefore
78
- },
79
- {
80
- // |-a-max-|
81
- skipIfModifiedAfter: "2026-01-01",
82
- // max
83
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
84
- // a
85
- isSkipped: true
86
- // Before the skipIfModifiedAfter
87
- },
88
- {
89
- // |-max-a-|
90
- skipIfModifiedAfter: "2026-01-01",
91
- // max
92
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
93
- // a
94
- isSkipped: true
95
- // After the skipIfModifiedAfter
96
- },
97
- {
98
- // |-min-max-a-|
99
- skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1e3,
100
- // min // 3 year ago
101
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
102
- // max // 1 year
103
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
104
- // a
105
- isSkipped: false
106
- // Before the range
107
- },
108
- {
109
- // |-a-max-|
110
- skipIfModifiedAfter: 0,
111
- // max // now
112
- fileModifiedTime: /* @__PURE__ */ new Date("2024-01-01"),
113
- // a
114
- isSkipped: false
115
- // Before the skipIfModifiedAfter
116
- },
117
- {
118
- // |-min-a-|
119
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
120
- // max // 1 year
121
- fileModifiedTime: /* @__PURE__ */ new Date("2025-01-01"),
122
- // a
123
- isSkipped: true
124
- // Before the skipIfModifiedAfter
125
- },
126
- {
127
- // |-min-a-max-|
128
- skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1e3,
129
- // min // 3 year ago
130
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
131
- // max // 1 year
132
- fileModifiedTime: /* @__PURE__ */ new Date("2023-01-01"),
133
- // a
134
- isSkipped: true
135
- // After the range
136
- },
137
- {
138
- // |-a-min-max-|
139
- skipIfModifiedBefore: 3 * 365 * 24 * 60 * 60 * 1e3,
140
- // min // 3 year ago
141
- skipIfModifiedAfter: 1 * 365 * 24 * 60 * 60 * 1e3,
142
- // max // 1 year
143
- fileModifiedTime: /* @__PURE__ */ new Date("2020-01-01"),
144
- // a
145
- isSkipped: false
146
- // Before the range
147
- },
148
- {
149
- // |-min-max-a-|
150
- skipIfModifiedBefore: "2024-01-01T00:00:00Z",
151
- // min
152
- skipIfModifiedAfter: "2026-01-01T00:00:00Z",
153
- // max
154
- fileModifiedTime: /* @__PURE__ */ new Date("2027-01-01"),
155
- // a
156
- isSkipped: false
157
- // After the range
158
- }
159
- ];
160
- testList.forEach((test) => {
161
- (0, import_vitest.it)(`should correctly handle string date inputs (absolute time) outside of the range`, () => {
162
- const filePath = "test/file.txt";
163
- import_checkLastUpdateTime.checkLastUpdateTime.mockReturnValue(
164
- // If a specific mocked modification time is provided, use it. Otherwise, fall back to "now".
165
- test.fileModifiedTime ?? /* @__PURE__ */ new Date()
166
- );
167
- const { isSkipped } = (0, import_checkFileModifiedRange.checkFileModifiedRange)(filePath, {
168
- skipIfModifiedBefore: test.skipIfModifiedBefore,
169
- skipIfModifiedAfter: test.skipIfModifiedAfter
170
- });
171
- (0, import_vitest.expect)(isSkipped).toBe(test.isSkipped);
172
- });
173
- });
174
- });
175
- //# sourceMappingURL=checkFileModifiedRange.test.cjs.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,81 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_fixChunkStartEndChars = require('./fixChunkStartEndChars.cjs');
4
- const visible = (str) => str.replace(/\n/g, "\\n");
5
- (0, import_vitest.describe)("fixChunkStartEndChars", () => {
6
- (0, import_vitest.it)("should add the missing starting character when the base chunk starts with it", () => {
7
- const base = "\nHello world";
8
- const reviewed = "Hello world";
9
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
10
- (0, import_vitest.expect)(visible(fixed)).toEqual(visible(base));
11
- });
12
- (0, import_vitest.it)("should add the missing ending character when the base chunk ends with it", () => {
13
- const base = 'console.log("hi")```';
14
- const reviewed = 'console.log("hi")';
15
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
16
- (0, import_vitest.expect)(fixed).toEqual(base);
17
- });
18
- (0, import_vitest.it)("should remove the extra starting character when the base chunk does not start with it", () => {
19
- const base = "Hello world";
20
- const reviewed = "\nHello world";
21
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
22
- (0, import_vitest.expect)(visible(fixed)).toEqual(visible(base));
23
- });
24
- (0, import_vitest.it)("should remove the extra ending character when the base chunk does not end with it", () => {
25
- const base = "Hello world";
26
- const reviewed = "Hello world---";
27
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
28
- (0, import_vitest.expect)(fixed).toEqual(base);
29
- });
30
- (0, import_vitest.it)("should return the reviewed chunk untouched when already matching the base structure", () => {
31
- const base = "Plain text without special markers";
32
- const reviewed = "Plain text without special markers";
33
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
34
- (0, import_vitest.expect)(fixed).toEqual(base);
35
- });
36
- (0, import_vitest.it)("should not remove ```` when the base chunk starts with it", () => {
37
- const base = "```test";
38
- const reviewed = "```test";
39
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
40
- (0, import_vitest.expect)(fixed).toEqual(base);
41
- });
42
- (0, import_vitest.it)("should add ```` when the base chunk ends with it", () => {
43
- const base = "```test";
44
- const reviewed = "test";
45
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
46
- (0, import_vitest.expect)(fixed).toEqual(base);
47
- });
48
- (0, import_vitest.it)("should remove ```` when the base chunk starts with it", () => {
49
- const base = "test";
50
- const reviewed = "```test";
51
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
52
- (0, import_vitest.expect)(fixed).toEqual(base);
53
- });
54
- (0, import_vitest.it)("should not remove ```` when the base chunk finishes with it", () => {
55
- const base = "test```";
56
- const reviewed = "test```";
57
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
58
- (0, import_vitest.expect)(fixed).toEqual(base);
59
- });
60
- (0, import_vitest.it)("should add ```` when the base chunk finishes with it", () => {
61
- const base = "test```";
62
- const reviewed = "test";
63
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
64
- (0, import_vitest.expect)(fixed).toEqual(base);
65
- });
66
- (0, import_vitest.it)("should remove ```` when the base chunk finishes with it", () => {
67
- const base = "test";
68
- const reviewed = "test```";
69
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(reviewed, base);
70
- (0, import_vitest.expect)(fixed).toEqual(base);
71
- });
72
- (0, import_vitest.it)("should add the missing char is a char list that matching char list", () => {
73
- const baseChunk = "```\n\n### 2. **Check if the command is registered**\n";
74
- const aiGeneratedResult = "\n\n### 2. **V\xE9rifiez si la commande est enregistr\xE9e**\n";
75
- const fixedResultError = "```### 2. **V\xE9rifiez si la commande est enregistr\xE9e**\n";
76
- const fixedResultSuccess = "```\n\n### 2. **V\xE9rifiez si la commande est enregistr\xE9e**\n";
77
- const fixed = (0, import_fixChunkStartEndChars.fixChunkStartEndChars)(aiGeneratedResult, baseChunk);
78
- (0, import_vitest.expect)(fixed).toMatch(/^```\n\n### 2\./);
79
- });
80
- });
81
- //# sourceMappingURL=fixChunkStartEndChars.test.cjs.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,oBAAqC;AACrC,mCAAsC;AAGtC,MAAM,UAAU,CAAC,QAAgB,IAAI,QAAQ,OAAO,KAAK;AAAA,IAEzD,wBAAS,yBAAyB,MAAM;AACtC,wBAAG,gFAAgF,MAAM;AACvF,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,QAAQ,KAAK,CAAC,EAAE,QAAQ,QAAQ,IAAI,CAAC;AAAA,EAC9C,CAAC;AAED,wBAAG,4EAA4E,MAAM;AACnF,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,yFAAyF,MAAM;AAChG,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,QAAQ,KAAK,CAAC,EAAE,QAAQ,QAAQ,IAAI,CAAC;AAAA,EAC9C,CAAC;AAED,wBAAG,qFAAqF,MAAM;AAC5F,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,uFAAuF,MAAM;AAC9F,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,6DAA6D,MAAM;AACpE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,oDAAoD,MAAM;AAC3D,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,yDAAyD,MAAM;AAChE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,+DAA+D,MAAM;AACtE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,wDAAwD,MAAM;AAC/D,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,2DAA2D,MAAM;AAClE,UAAM,OAAO;AACb,UAAM,WAAW;AAEjB,UAAM,YAAQ,oDAAsB,UAAU,IAAI;AAClD,8BAAO,KAAK,EAAE,QAAQ,IAAI;AAAA,EAC5B,CAAC;AAED,wBAAG,sEAAsE,MAAM;AAE7E,UAAM,YACJ;AAGF,UAAM,oBACJ;AAGF,UAAM,mBACJ;AAGF,UAAM,qBACJ;AAEF,UAAM,YAAQ,oDAAsB,mBAAmB,SAAS;AAGhE,8BAAO,KAAK,EAAE,QAAQ,iBAAiB;AAAA,EACzC,CAAC;AACH,CAAC;","names":[]}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_formatTimeDiff = require('./formatTimeDiff.cjs');
4
- (0, import_vitest.describe)("formatTimeDiff", () => {
5
- const fixedNow = /* @__PURE__ */ new Date("2025-01-01T00:00:00Z");
6
- (0, import_vitest.beforeEach)(() => {
7
- import_vitest.vi.useFakeTimers();
8
- import_vitest.vi.setSystemTime(fixedNow);
9
- });
10
- (0, import_vitest.afterEach)(() => {
11
- import_vitest.vi.useRealTimers();
12
- });
13
- (0, import_vitest.it)("formats differences containing days", () => {
14
- const past = new Date(
15
- 2 * 24 * 60 * 60 * 1e3 + // 2 days
16
- 3 * 60 * 60 * 1e3 + // 3 hours
17
- 4 * 60 * 1e3 + // 4 minutes
18
- 5 * 1e3
19
- // 5 seconds
20
- );
21
- (0, import_vitest.expect)((0, import_formatTimeDiff.formatTimeDiff)(past)).toBe("2d 3h 4m 5s");
22
- });
23
- (0, import_vitest.it)("formats differences containing hours but no days", () => {
24
- const past = new Date(3 * 60 * 60 * 1e3 + 15 * 60 * 1e3 + 20 * 1e3);
25
- (0, import_vitest.expect)((0, import_formatTimeDiff.formatTimeDiff)(past)).toBe("3h 15m 20s");
26
- });
27
- (0, import_vitest.it)("formats differences containing only minutes and seconds", () => {
28
- const past = new Date(7 * 60 * 1e3 + 45 * 1e3);
29
- (0, import_vitest.expect)((0, import_formatTimeDiff.formatTimeDiff)(past)).toBe("7m 45s");
30
- });
31
- });
32
- //# sourceMappingURL=formatTimeDiff.test.cjs.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,oBAAgE;AAChE,4BAA+B;AAAA,IAE/B,wBAAS,kBAAkB,MAAM;AAC/B,QAAM,WAAW,oBAAI,KAAK,sBAAsB;AAEhD,gCAAW,MAAM;AAEf,qBAAG,cAAc;AACjB,qBAAG,cAAc,QAAQ;AAAA,EAC3B,CAAC;AAED,+BAAU,MAAM;AACd,qBAAG,cAAc;AAAA,EACnB,CAAC;AAED,wBAAG,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,kCAAO,sCAAe,IAAI,CAAC,EAAE,KAAK,aAAa;AAAA,EACjD,CAAC;AAED,wBAAG,oDAAoD,MAAM;AAE3D,UAAM,OAAO,IAAI,KAAK,IAAI,KAAK,KAAK,MAAO,KAAK,KAAK,MAAO,KAAK,GAAI;AAErE,kCAAO,sCAAe,IAAI,CAAC,EAAE,KAAK,YAAY;AAAA,EAChD,CAAC;AAED,wBAAG,2DAA2D,MAAM;AAElE,UAAM,OAAO,IAAI,KAAK,IAAI,KAAK,MAAO,KAAK,GAAI;AAE/C,kCAAO,sCAAe,IAAI,CAAC,EAAE,KAAK,QAAQ;AAAA,EAC5C,CAAC;AACH,CAAC;","names":[]}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_getChunk = require('./getChunk.cjs');
4
- const sampleText = [
5
- "Line 0: The quick brown fox jumps over the lazy dog.",
6
- "Line 1: Pack my box with five dozen liquor jugs.",
7
- "Line 2: How razorback-jumping frogs can level six piqued gymnasts!",
8
- "Line 3: Cozy lummox gives smart squid who asks for job pen.",
9
- "Line 4: A mad boxer shot a quick, gloved jab to the jaw of his dizzy opponent."
10
- ].join("\n");
11
- (0, import_vitest.describe)("getChunk", () => {
12
- (0, import_vitest.it)("returns the whole text when no filters are provided", () => {
13
- const result = (0, import_getChunk.getChunk)(sampleText);
14
- (0, import_vitest.expect)(result).toBe(sampleText);
15
- });
16
- (0, import_vitest.it)("applies lineStart and lineLength filters", () => {
17
- const result = (0, import_getChunk.getChunk)(sampleText, { lineStart: 1, lineLength: 2 });
18
- const expected = [
19
- "Line 1: Pack my box with five dozen liquor jugs.\n",
20
- "Line 2: How razorback-jumping frogs can level six piqued gymnasts!\n"
21
- ].join("");
22
- (0, import_vitest.expect)(result).toBe(expected);
23
- });
24
- (0, import_vitest.it)("applies charStart and charLength filters", () => {
25
- const charStart = sampleText.indexOf("quick");
26
- const charLength = "quick brown fox".length;
27
- const result = (0, import_getChunk.getChunk)(sampleText, { charStart, charLength });
28
- (0, import_vitest.expect)(result).toBe("quick brown fox");
29
- });
30
- (0, import_vitest.it)("combines line and char filters by intersecting their ranges", () => {
31
- const partial = (0, import_getChunk.getChunk)(sampleText, {
32
- lineStart: 0,
33
- lineLength: 3,
34
- // lines 0, 1, 2
35
- // Grab only the first 10 characters of the selected block
36
- charStart: 0,
37
- charLength: 10
38
- });
39
- (0, import_vitest.expect)(partial).toBe("Line 0: Th");
40
- });
41
- (0, import_vitest.it)("returns an empty string when effectiveStart > effectiveEnd", () => {
42
- const result = (0, import_getChunk.getChunk)(sampleText, { charStart: 10, charLength: 0 });
43
- (0, import_vitest.expect)(result).toBe("");
44
- });
45
- });
46
- //# sourceMappingURL=getChunk.test.cjs.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,oBAAqC;AAErC,sBAAyB;AAGzB,MAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAAA,IAEX,wBAAS,YAAY,MAAM;AACzB,wBAAG,uDAAuD,MAAM;AAC9D,UAAM,aAAS,0BAAS,UAAU;AAClC,8BAAO,MAAM,EAAE,KAAK,UAAU;AAAA,EAChC,CAAC;AAED,wBAAG,4CAA4C,MAAM;AACnD,UAAM,aAAS,0BAAS,YAAY,EAAE,WAAW,GAAG,YAAY,EAAE,CAAC;AAGnE,UAAM,WAAW;AAAA,MACf;AAAA,MACA;AAAA,IACF,EAAE,KAAK,EAAE;AAET,8BAAO,MAAM,EAAE,KAAK,QAAQ;AAAA,EAC9B,CAAC;AAED,wBAAG,4CAA4C,MAAM;AAEnD,UAAM,YAAY,WAAW,QAAQ,OAAO;AAC5C,UAAM,aAAa,kBAAkB;AAErC,UAAM,aAAS,0BAAS,YAAY,EAAE,WAAW,WAAW,CAAC;AAE7D,8BAAO,MAAM,EAAE,KAAK,iBAAiB;AAAA,EACvC,CAAC;AAED,wBAAG,+DAA+D,MAAM;AAEtE,UAAM,cAAU,0BAAS,YAAY;AAAA,MACnC,WAAW;AAAA,MACX,YAAY;AAAA;AAAA;AAAA,MAEZ,WAAW;AAAA,MACX,YAAY;AAAA,IACd,CAAC;AAED,8BAAO,OAAO,EAAE,KAAK,YAAY;AAAA,EACnC,CAAC;AAED,wBAAG,8DAA8D,MAAM;AACrE,UAAM,aAAS,0BAAS,YAAY,EAAE,WAAW,IAAI,YAAY,EAAE,CAAC;AACpE,8BAAO,MAAM,EAAE,KAAK,EAAE;AAAA,EACxB,CAAC;AACH,CAAC;","names":[]}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var import_config = require("@intlayer/config");
3
- var import_vitest = require("vitest");
4
- var import_getOutputFilePath = require('./getOutputFilePath.cjs');
5
- const baseLocale = import_config.Locales.ENGLISH;
6
- const targetLocale = import_config.Locales.FRENCH;
7
- (0, import_vitest.describe)("getOutputFilePath", () => {
8
- (0, import_vitest.it)("should replace locale in directory paths", () => {
9
- (0, import_vitest.expect)(
10
- (0, import_getOutputFilePath.getOutputFilePath)("/docs/en/guide.md", targetLocale, baseLocale)
11
- ).toBe("/docs/fr/guide.md");
12
- });
13
- (0, import_vitest.it)("should handle Windows-style paths", () => {
14
- (0, import_vitest.expect)(
15
- (0, import_getOutputFilePath.getOutputFilePath)("\\docs\\en\\guide.md", targetLocale, baseLocale)
16
- ).toBe("\\docs\\fr\\guide.md");
17
- });
18
- (0, import_vitest.it)("should replace locale in file naming patterns", () => {
19
- (0, import_vitest.expect)((0, import_getOutputFilePath.getOutputFilePath)("guide_en.md", targetLocale, baseLocale)).toBe(
20
- "guide_fr.md"
21
- );
22
- (0, import_vitest.expect)((0, import_getOutputFilePath.getOutputFilePath)("en_guide.md", targetLocale, baseLocale)).toBe(
23
- "fr_guide.md"
24
- );
25
- });
26
- (0, import_vitest.it)("should handle template placeholders", () => {
27
- (0, import_vitest.expect)(
28
- (0, import_getOutputFilePath.getOutputFilePath)(
29
- "/docs/{{baseLocale}}/guide.md",
30
- targetLocale,
31
- baseLocale
32
- )
33
- ).toBe("/docs/{{locale}}/guide.md");
34
- (0, import_vitest.expect)(
35
- (0, import_getOutputFilePath.getOutputFilePath)("guide.{{baseLocaleName}}.md", targetLocale, baseLocale)
36
- ).toBe("guide.{{localeName}}.md");
37
- });
38
- (0, import_vitest.it)("should handle locale name patterns", () => {
39
- (0, import_vitest.expect)((0, import_getOutputFilePath.getOutputFilePath)("guide.en.md", targetLocale, baseLocale)).toBe(
40
- "guide.fr.md"
41
- );
42
- });
43
- (0, import_vitest.it)("should append locale when no patterns match", () => {
44
- (0, import_vitest.expect)((0, import_getOutputFilePath.getOutputFilePath)("/docs/guide.md", targetLocale, baseLocale)).toBe(
45
- "/docs/guide.fr.md"
46
- );
47
- });
48
- (0, import_vitest.it)("should handle files without extensions", () => {
49
- (0, import_vitest.expect)((0, import_getOutputFilePath.getOutputFilePath)("/docs/guide", targetLocale, baseLocale)).toBe(
50
- "/docs/guide.fr"
51
- );
52
- });
53
- (0, import_vitest.it)("should handle multiple occurrences", () => {
54
- (0, import_vitest.expect)(
55
- (0, import_getOutputFilePath.getOutputFilePath)("/en/docs/en/guide_en.md", targetLocale, baseLocale)
56
- ).toBe("/fr/docs/fr/guide_fr.md");
57
- });
58
- (0, import_vitest.it)("should not duplicate locale parts for composite target locales", () => {
59
- const compositeTarget = "en-GB";
60
- (0, import_vitest.expect)((0, import_getOutputFilePath.getOutputFilePath)("/en/file.md", compositeTarget, baseLocale)).toBe(
61
- "/en-GB/file.md"
62
- );
63
- });
64
- (0, import_vitest.it)("should throw error for invalid inputs", () => {
65
- (0, import_vitest.expect)(() => (0, import_getOutputFilePath.getOutputFilePath)("", targetLocale, baseLocale)).toThrow(
66
- "filePath, locale, and baseLocale are required"
67
- );
68
- (0, import_vitest.expect)(
69
- () => (0, import_getOutputFilePath.getOutputFilePath)("/docs/guide.md", "", baseLocale)
70
- ).toThrow("filePath, locale, and baseLocale are required");
71
- });
72
- });
73
- //# sourceMappingURL=getOutputFilePath.test.cjs.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,oBAAwB;AACxB,oBAAqC;AACrC,+BAAkC;AAElC,MAAM,aAAa,sBAAQ;AAC3B,MAAM,eAAe,sBAAQ;AAAA,IAE7B,wBAAS,qBAAqB,MAAM;AAClC,wBAAG,4CAA4C,MAAM;AACnD;AAAA,UACE,4CAAkB,qBAAqB,cAAc,UAAU;AAAA,IACjE,EAAE,KAAK,mBAAmB;AAAA,EAC5B,CAAC;AAED,wBAAG,qCAAqC,MAAM;AAC5C;AAAA,UACE,4CAAkB,wBAAwB,cAAc,UAAU;AAAA,IACpE,EAAE,KAAK,sBAAsB;AAAA,EAC/B,CAAC;AAED,wBAAG,iDAAiD,MAAM;AACxD,kCAAO,4CAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAEA,kCAAO,4CAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF,CAAC;AAED,wBAAG,uCAAuC,MAAM;AAC9C;AAAA,UACE;AAAA,QACE;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,EAAE,KAAK,2BAA2B;AAElC;AAAA,UACE,4CAAkB,+BAA+B,cAAc,UAAU;AAAA,IAC3E,EAAE,KAAK,yBAAyB;AAAA,EAClC,CAAC;AAED,wBAAG,sCAAsC,MAAM;AAC7C,kCAAO,4CAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF,CAAC;AAED,wBAAG,+CAA+C,MAAM;AACtD,kCAAO,4CAAkB,kBAAkB,cAAc,UAAU,CAAC,EAAE;AAAA,MACpE;AAAA,IACF;AAAA,EACF,CAAC;AAED,wBAAG,0CAA0C,MAAM;AACjD,kCAAO,4CAAkB,eAAe,cAAc,UAAU,CAAC,EAAE;AAAA,MACjE;AAAA,IACF;AAAA,EACF,CAAC;AAED,wBAAG,sCAAsC,MAAM;AAC7C;AAAA,UACE,4CAAkB,2BAA2B,cAAc,UAAU;AAAA,IACvE,EAAE,KAAK,yBAAyB;AAAA,EAClC,CAAC;AAED,wBAAG,kEAAkE,MAAM;AACzE,UAAM,kBAAkB;AACxB,kCAAO,4CAAkB,eAAe,iBAAiB,UAAU,CAAC,EAAE;AAAA,MACpE;AAAA,IACF;AAAA,EACF,CAAC;AAED,wBAAG,yCAAyC,MAAM;AAChD,8BAAO,UAAM,4CAAkB,IAAI,cAAc,UAAU,CAAC,EAAE;AAAA,MAC5D;AAAA,IACF;AAEA;AAAA,MAAO,UACL,4CAAkB,kBAAkB,IAAe,UAAU;AAAA,IAC/D,EAAE,QAAQ,+CAA+C;AAAA,EAC3D,CAAC;AACH,CAAC;","names":[]}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_listSpecialChars = require('./listSpecialChars.cjs');
4
- const test = [
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
- "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."
10
- ].join("\n");
11
- (0, import_vitest.describe)("listSpecialChars", () => {
12
- (0, import_vitest.it)("should return an empty array if the text is empty", () => {
13
- const text = "";
14
- const result = (0, import_listSpecialChars.listSpecialChars)(text);
15
- (0, import_vitest.expect)(result).toEqual([]);
16
- });
17
- (0, import_vitest.it)("should return an array of special characters", () => {
18
- const result = (0, import_listSpecialChars.listSpecialChars)(test);
19
- (0, import_vitest.expect)(result).toEqual([
20
- {
21
- char: "(",
22
- charStart: 56,
23
- lineStart: 0
24
- },
25
- {
26
- char: ")",
27
- charStart: 115,
28
- lineStart: 0
29
- },
30
- {
31
- char: "\\",
32
- charStart: 439,
33
- lineStart: 0
34
- },
35
- {
36
- char: "!",
37
- charStart: 494,
38
- lineStart: 1
39
- },
40
- {
41
- char: "\\",
42
- charStart: 877,
43
- lineStart: 1
44
- },
45
- {
46
- char: "\\",
47
- charStart: 1315,
48
- lineStart: 2
49
- },
50
- {
51
- char: "\\",
52
- charStart: 1754,
53
- lineStart: 3
54
- }
55
- ]);
56
- });
57
- });
58
- //# sourceMappingURL=listSpecialChars.test.cjs.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,oBAAqC;AACrC,8BAAiC;AAEjC,MAAM,OAAO;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAAA,IAEX,wBAAS,oBAAoB,MAAM;AACjC,wBAAG,qDAAqD,MAAM;AAC5D,UAAM,OAAO;AACb,UAAM,aAAS,0CAAiB,IAAI;AACpC,8BAAO,MAAM,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC3B,CAAC;AAED,wBAAG,gDAAgD,MAAM;AACvD,UAAM,aAAS,0CAAiB,IAAI;AACpC,8BAAO,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,71 +0,0 @@
1
- "use strict";
2
- var import_vitest = require("vitest");
3
- var import_reorderParagraphs = require('./reorderParagraphs.cjs');
4
- const baseText = [
5
- "! Lorem ipsum dolor sit amet consectetur adipiscing elit.",
6
- // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content
7
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
8
- // Similar n1
9
- "- Lorem ipsum dolor sit amet consectetur adipiscing elit.",
10
- "\n\n",
11
- // Empty line
12
- "* Lorem ipsum dolor sit amet consectetur adipiscing elit.",
13
- "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
14
- // No special char
15
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
16
- // Similar n2
17
- "+ Lorem ipsum dolor sit amet consectetur adipiscing elit.",
18
- // Similar n3 but different content
19
- "= Lorem ipsum dolor sit amet consectetur adipiscing elit.",
20
- // Missing content
21
- "& Lorem ipsum dolor sit amet consectetur adipiscing elit."
22
- ].join("\n\n");
23
- const textToReorder = [
24
- "! Lorem ipsum dolor sit amet consectetur adipiscing elit.",
25
- // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content
26
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
27
- // Similar n1
28
- "\n\n",
29
- // Empty line
30
- "* Lorem ipsum dolor sit amet consectetur adipiscing elit.",
31
- "- Lorem ipsum dolor sit amet consectetur adipiscing elit.",
32
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
33
- // Similar n2
34
- "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
35
- // No special char
36
- "+ Lorem ipsum dolor sit amet consectetur adipiscing elit.",
37
- // Similar n3 but different content
38
- "& Lorem ipsum dolor sit amet consectetur adipiscing elit.",
39
- "= Lorem ipsum dolor sit amet consectetur adipiscing elit."
40
- // Missing content
41
- ].join("\n\n");
42
- const texReordered = [
43
- "! Lorem ipsum dolor sit amet consectetur adipiscing elit.",
44
- // '> Lorem ipsum dolor sit amet consectetur adipiscing elit.', // Additional content
45
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
46
- // Similar n1
47
- "- Lorem ipsum dolor sit amet consectetur adipiscing elit.",
48
- "\n\n",
49
- // Empty line
50
- "* Lorem ipsum dolor sit amet consectetur adipiscing elit.",
51
- "Lorem ipsum dolor sit amet consectetur adipiscing elit.",
52
- // No special char
53
- "+ Lorem dolor sit amet consectetur adipiscing elit.",
54
- // Similar n2
55
- "+ Lorem ipsum dolor sit amet consectetur adipiscing elit.",
56
- // Similar n3 but different content
57
- "= Lorem ipsum dolor sit amet consectetur adipiscing elit.",
58
- // Missing content
59
- "& Lorem ipsum dolor sit amet consectetur adipiscing elit."
60
- ].join("\n\n");
61
- (0, import_vitest.describe)("reorderParagraphs", () => {
62
- (0, import_vitest.it)("should keep the same order when input matches base text", () => {
63
- const result = (0, import_reorderParagraphs.reorderParagraphs)(baseText, baseText);
64
- (0, import_vitest.expect)(result).toEqual(baseText);
65
- });
66
- (0, import_vitest.it)("should reorder the paragraphs", () => {
67
- const result = (0, import_reorderParagraphs.reorderParagraphs)(textToReorder, baseText);
68
- (0, import_vitest.expect)(result).toEqual(texReordered);
69
- });
70
- });
71
- //# sourceMappingURL=reorderParagraphs.test.cjs.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,oBAAqC;AACrC,+BAAkC;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;AAAA,IAEb,wBAAS,qBAAqB,MAAM;AAClC,wBAAG,2DAA2D,MAAM;AAClE,UAAM,aAAS,4CAAkB,UAAU,QAAQ;AACnD,8BAAO,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACjC,CAAC;AAED,wBAAG,iCAAiC,MAAM;AACxC,UAAM,aAAS,4CAAkB,eAAe,QAAQ;AACxD,8BAAO,MAAM,EAAE,QAAQ,YAAY;AAAA,EACrC,CAAC;AACH,CAAC;","names":[]}