@inlang/paraglide-js 2.0.11 → 2.0.12

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.
@@ -3,41 +3,39 @@ import { createParaglide } from "../create-paraglide.js";
3
3
  import { newProject } from "@inlang/sdk";
4
4
  test("pathname based localization", async () => {
5
5
  const runtime = await createParaglide({
6
- project: await newProject({
6
+ blob: await newProject({
7
7
  settings: {
8
8
  baseLocale: "en",
9
9
  locales: ["en", "de"],
10
10
  },
11
11
  }),
12
- compilerOptions: {
13
- strategy: ["url"],
14
- urlPatterns: [
15
- // literal match
16
- {
17
- pattern: "/blog/about",
18
- localized: [
19
- ["en", "/blog/about"],
20
- ["de", "/de/artikel/ueber-uns"],
21
- ],
22
- },
23
- // parameter
24
- {
25
- pattern: "/blog/:id",
26
- localized: [
27
- ["en", "/blog/:id"],
28
- ["de", "/de/artikel/:id"],
29
- ],
30
- },
31
- // wildcard
32
- {
33
- pattern: "/:path(.*)",
34
- localized: [
35
- ["de", "/de/:path(.*)"],
36
- ["en", "/:path(.*)"],
37
- ],
38
- },
39
- ],
40
- },
12
+ strategy: ["url"],
13
+ urlPatterns: [
14
+ // literal match
15
+ {
16
+ pattern: "/blog/about",
17
+ localized: [
18
+ ["en", "/blog/about"],
19
+ ["de", "/de/artikel/ueber-uns"],
20
+ ],
21
+ },
22
+ // parameter
23
+ {
24
+ pattern: "/blog/:id",
25
+ localized: [
26
+ ["en", "/blog/:id"],
27
+ ["de", "/de/artikel/:id"],
28
+ ],
29
+ },
30
+ // wildcard
31
+ {
32
+ pattern: "/:path(.*)",
33
+ localized: [
34
+ ["de", "/de/:path(.*)"],
35
+ ["en", "/:path(.*)"],
36
+ ],
37
+ },
38
+ ],
41
39
  });
42
40
  // wildcard - en to de
43
41
  expect(runtime.localizeUrl("https://example.com/home", { locale: "de" }).href).toBe("https://example.com/de/home");
@@ -56,33 +54,31 @@ test("pathname based localization", async () => {
56
54
  });
57
55
  test("cross domain urls", async () => {
58
56
  const runtime = await createParaglide({
59
- project: await newProject({
57
+ blob: await newProject({
60
58
  settings: {
61
59
  baseLocale: "en",
62
60
  locales: ["en", "de"],
63
61
  },
64
62
  }),
65
- compilerOptions: {
66
- strategy: ["url"],
67
- urlPatterns: [
68
- // Development/deployment mapping
69
- {
70
- pattern: "https://localhost::port/:path*",
71
- localized: [
72
- ["de", "https://localhost::port/de/:path*"],
73
- ["en", "https://localhost::port/:path*"],
74
- ],
75
- },
76
- // Domain based localization
77
- {
78
- pattern: "https://example.com/:path*",
79
- localized: [
80
- ["en", "https://example.com/:path*"],
81
- ["de", "https://de.example.com/:path*"],
82
- ],
83
- },
84
- ],
85
- },
63
+ strategy: ["url"],
64
+ urlPatterns: [
65
+ // Development/deployment mapping
66
+ {
67
+ pattern: "https://localhost::port/:path*",
68
+ localized: [
69
+ ["de", "https://localhost::port/de/:path*"],
70
+ ["en", "https://localhost::port/:path*"],
71
+ ],
72
+ },
73
+ // Domain based localization
74
+ {
75
+ pattern: "https://example.com/:path*",
76
+ localized: [
77
+ ["en", "https://example.com/:path*"],
78
+ ["de", "https://de.example.com/:path*"],
79
+ ],
80
+ },
81
+ ],
86
82
  });
87
83
  // in development use localhost with different mapping
88
84
  expect(runtime.localizeUrl("https://localhost:5173/about", { locale: "de" }).href).toBe("https://localhost:5173/de/about");
@@ -101,41 +97,39 @@ test("cross domain urls", async () => {
101
97
  });
102
98
  test("multi tenancy", async () => {
103
99
  const runtime = await createParaglide({
104
- project: await newProject({
100
+ blob: await newProject({
105
101
  settings: {
106
102
  baseLocale: "en",
107
103
  locales: ["en", "de", "fr"],
108
104
  },
109
105
  }),
110
- compilerOptions: {
111
- strategy: ["url"],
112
- urlPatterns: [
113
- // 1) customer1.fr => root path locale is fr, other locales via sub-path e.g. /en/
114
- {
115
- pattern: "https://customer1.fr/:path*",
116
- localized: [
117
- ["en", "https://customer1.fr/en/:path*"],
118
- ["fr", "https://customer1.fr/:path*"],
119
- ],
120
- },
121
- // 2) customer2.com => root path locale is en, other locales via sub-path e.g. /fr/
122
- {
123
- pattern: "https://customer2.com/:path*",
124
- localized: [
125
- ["fr", "https://customer2.com/fr/:path*"],
126
- ["en", "https://customer2.com/:path*"],
127
- ],
128
- },
129
- // 3) Any other domain => path-based for en/fr
130
- {
131
- pattern: "https://:domain(.*)/:path*",
132
- localized: [
133
- ["en", "https://:domain(.*)/en/:path*"],
134
- ["fr", "https://:domain(.*)/fr/:path*"],
135
- ],
136
- },
137
- ],
138
- },
106
+ strategy: ["url"],
107
+ urlPatterns: [
108
+ // 1) customer1.fr => root path locale is fr, other locales via sub-path e.g. /en/
109
+ {
110
+ pattern: "https://customer1.fr/:path*",
111
+ localized: [
112
+ ["en", "https://customer1.fr/en/:path*"],
113
+ ["fr", "https://customer1.fr/:path*"],
114
+ ],
115
+ },
116
+ // 2) customer2.com => root path locale is en, other locales via sub-path e.g. /fr/
117
+ {
118
+ pattern: "https://customer2.com/:path*",
119
+ localized: [
120
+ ["fr", "https://customer2.com/fr/:path*"],
121
+ ["en", "https://customer2.com/:path*"],
122
+ ],
123
+ },
124
+ // 3) Any other domain => path-based for en/fr
125
+ {
126
+ pattern: "https://:domain(.*)/:path*",
127
+ localized: [
128
+ ["en", "https://:domain(.*)/en/:path*"],
129
+ ["fr", "https://:domain(.*)/fr/:path*"],
130
+ ],
131
+ },
132
+ ],
139
133
  });
140
134
  // customer 1 - localizing french to french
141
135
  expect(runtime.localizeUrl("https://customer1.fr/about", { locale: "fr" }).href).toBe("https://customer1.fr/about");
@@ -152,24 +146,22 @@ test("multi tenancy", async () => {
152
146
  });
153
147
  test("providing a URL object as input", async () => {
154
148
  const runtime = await createParaglide({
155
- project: await newProject({
149
+ blob: await newProject({
156
150
  settings: {
157
151
  baseLocale: "en",
158
152
  locales: ["en", "de"],
159
153
  },
160
154
  }),
161
- compilerOptions: {
162
- strategy: ["url"],
163
- urlPatterns: [
164
- {
165
- pattern: "https://:domain(.*)/:path*",
166
- localized: [
167
- ["en", "https://:domain(.*)/:path*"],
168
- ["de", "https://de.:domain(.*)/:path*"],
169
- ],
170
- },
171
- ],
172
- },
155
+ strategy: ["url"],
156
+ urlPatterns: [
157
+ {
158
+ pattern: "https://:domain(.*)/:path*",
159
+ localized: [
160
+ ["en", "https://:domain(.*)/:path*"],
161
+ ["de", "https://de.:domain(.*)/:path*"],
162
+ ],
163
+ },
164
+ ],
173
165
  });
174
166
  const url = new URL("https://example.com/about");
175
167
  expect(runtime.localizeUrl(url, { locale: "de" }).href).toBe("https://de.example.com/about");
@@ -177,24 +169,22 @@ test("providing a URL object as input", async () => {
177
169
  });
178
170
  test("localhost with portname", async () => {
179
171
  const runtime = await createParaglide({
180
- project: await newProject({
172
+ blob: await newProject({
181
173
  settings: {
182
174
  baseLocale: "en",
183
175
  locales: ["en", "de"],
184
176
  },
185
177
  }),
186
- compilerOptions: {
187
- strategy: ["url"],
188
- urlPatterns: [
189
- {
190
- pattern: ":protocol://:domain(.*)::port?/:path(.*)?",
191
- localized: [
192
- ["de", ":protocol://:domain(.*)::port?/de/:path(.*)?"],
193
- ["en", ":protocol://:domain(.*)::port?/:path(.*)?"],
194
- ],
195
- },
196
- ],
197
- },
178
+ strategy: ["url"],
179
+ urlPatterns: [
180
+ {
181
+ pattern: ":protocol://:domain(.*)::port?/:path(.*)?",
182
+ localized: [
183
+ ["de", ":protocol://:domain(.*)::port?/de/:path(.*)?"],
184
+ ["en", ":protocol://:domain(.*)::port?/:path(.*)?"],
185
+ ],
186
+ },
187
+ ],
198
188
  });
199
189
  // http
200
190
  expect(runtime.deLocalizeUrl(new URL("http://localhost:5173/de/about")).href).toBe("http://localhost:5173/about");
@@ -209,24 +199,22 @@ test("localhost with portname", async () => {
209
199
  });
210
200
  test("it keeps the query parameters", async () => {
211
201
  const runtime = await createParaglide({
212
- project: await newProject({
202
+ blob: await newProject({
213
203
  settings: {
214
204
  baseLocale: "en",
215
205
  locales: ["en", "de"],
216
206
  },
217
207
  }),
218
- compilerOptions: {
219
- strategy: ["url"],
220
- urlPatterns: [
221
- {
222
- pattern: "https://:domain(.*)/:path(.*)?",
223
- localized: [
224
- ["de", "https://:domain(.*)/de/:path(.*)?"],
225
- ["en", "https://:domain(.*)/:path(.*)?"],
226
- ],
227
- },
228
- ],
229
- },
208
+ strategy: ["url"],
209
+ urlPatterns: [
210
+ {
211
+ pattern: "https://:domain(.*)/:path(.*)?",
212
+ localized: [
213
+ ["de", "https://:domain(.*)/de/:path(.*)?"],
214
+ ["en", "https://:domain(.*)/:path(.*)?"],
215
+ ],
216
+ },
217
+ ],
230
218
  });
231
219
  expect(runtime.localizeUrl("https://example.com/about?foo=bar&baz=qux", {
232
220
  locale: "de",
@@ -235,24 +223,22 @@ test("it keeps the query parameters", async () => {
235
223
  });
236
224
  test("it keeps the url hash", async () => {
237
225
  const runtime = await createParaglide({
238
- project: await newProject({
226
+ blob: await newProject({
239
227
  settings: {
240
228
  baseLocale: "en",
241
229
  locales: ["en", "de"],
242
230
  },
243
231
  }),
244
- compilerOptions: {
245
- strategy: ["url"],
246
- urlPatterns: [
247
- {
248
- pattern: "https://:domain(.*)/:path(.*)?",
249
- localized: [
250
- ["de", "https://:domain(.*)/de/:path(.*)?"],
251
- ["en", "https://:domain(.*)/:path(.*)?"],
252
- ],
253
- },
254
- ],
255
- },
232
+ strategy: ["url"],
233
+ urlPatterns: [
234
+ {
235
+ pattern: "https://:domain(.*)/:path(.*)?",
236
+ localized: [
237
+ ["de", "https://:domain(.*)/de/:path(.*)?"],
238
+ ["en", "https://:domain(.*)/:path(.*)?"],
239
+ ],
240
+ },
241
+ ],
256
242
  });
257
243
  expect(runtime.localizeUrl("https://example.com/about#test", { locale: "de" }).href).toBe("https://example.com/de/about#test");
258
244
  expect(runtime.deLocalizeUrl("https://example.com/de/about#test").href).toBe("https://example.com/about#test");
@@ -264,48 +250,44 @@ test("it keeps the url hash", async () => {
264
250
  // This means any request, including https://example.com/about, will match.
265
251
  test("it keeps the url path", async () => {
266
252
  const runtime = await createParaglide({
267
- project: await newProject({
253
+ blob: await newProject({
268
254
  settings: {
269
255
  baseLocale: "en",
270
256
  locales: ["en", "de"],
271
257
  },
272
258
  }),
273
- compilerOptions: {
274
- strategy: ["url"],
275
- urlPatterns: [
276
- {
277
- pattern: "https://example.com",
278
- localized: [
279
- ["de", "https://example.de"],
280
- ["en", "https://example.com"],
281
- ],
282
- },
283
- ],
284
- },
259
+ strategy: ["url"],
260
+ urlPatterns: [
261
+ {
262
+ pattern: "https://example.com",
263
+ localized: [
264
+ ["de", "https://example.de"],
265
+ ["en", "https://example.com"],
266
+ ],
267
+ },
268
+ ],
285
269
  });
286
270
  expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.de/about");
287
271
  expect(runtime.deLocalizeUrl("https://example.de/about").href).toBe("https://example.com/about");
288
272
  });
289
273
  test("uses getLocale when no locale is provided", async () => {
290
274
  const runtime = await createParaglide({
291
- project: await newProject({
275
+ blob: await newProject({
292
276
  settings: {
293
277
  baseLocale: "en",
294
278
  locales: ["en", "de"],
295
279
  },
296
280
  }),
297
- compilerOptions: {
298
- strategy: ["url"],
299
- urlPatterns: [
300
- {
301
- pattern: "https://:domain(.*)/:path(.*)?",
302
- localized: [
303
- ["de", "https://:domain(.*)/de/:path(.*)?"],
304
- ["en", "https://:domain(.*)/en/:path(.*)?"],
305
- ],
306
- },
307
- ],
308
- },
281
+ strategy: ["url"],
282
+ urlPatterns: [
283
+ {
284
+ pattern: "https://:domain(.*)/:path(.*)?",
285
+ localized: [
286
+ ["de", "https://:domain(.*)/de/:path(.*)?"],
287
+ ["en", "https://:domain(.*)/en/:path(.*)?"],
288
+ ],
289
+ },
290
+ ],
309
291
  });
310
292
  // Override getLocale to return German
311
293
  runtime.overwriteGetLocale(() => "de");
@@ -333,13 +315,13 @@ test.each([
333
315
  },
334
316
  ])("default url pattern", async (compilerOptions) => {
335
317
  const runtime = await createParaglide({
336
- project: await newProject({
318
+ blob: await newProject({
337
319
  settings: {
338
320
  baseLocale: "en",
339
321
  locales: ["en", "de"],
340
322
  },
341
323
  }),
342
- compilerOptions,
324
+ ...compilerOptions,
343
325
  });
344
326
  runtime.overwriteGetLocale(() => "en");
345
327
  expect(runtime.localizeUrl("https://example.com/about").href).toBe("https://example.com/about");
@@ -354,24 +336,22 @@ test.each([
354
336
  });
355
337
  test("auto fills the url base path", async () => {
356
338
  const runtime = await createParaglide({
357
- project: await newProject({
339
+ blob: await newProject({
358
340
  settings: {
359
341
  baseLocale: "en",
360
342
  locales: ["en", "de"],
361
343
  },
362
344
  }),
363
- compilerOptions: {
364
- strategy: ["url"],
365
- urlPatterns: [
366
- {
367
- pattern: "/:path(.*)?",
368
- localized: [
369
- ["de", "/de/:path(.*)?"],
370
- ["en", "/:path(.*)?"],
371
- ],
372
- },
373
- ],
374
- },
345
+ strategy: ["url"],
346
+ urlPatterns: [
347
+ {
348
+ pattern: "/:path(.*)?",
349
+ localized: [
350
+ ["de", "/de/:path(.*)?"],
351
+ ["en", "/:path(.*)?"],
352
+ ],
353
+ },
354
+ ],
375
355
  });
376
356
  expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
377
357
  expect(runtime.localizeUrl("https://example.com/about", { locale: "de" }).href).toBe("https://example.com/de/about");
@@ -380,24 +360,22 @@ test("auto fills the url base path", async () => {
380
360
  // https://github.com/opral/inlang-paraglide-js/issues/454
381
361
  test("works with no trailing slash at the end", async () => {
382
362
  const runtime = await createParaglide({
383
- project: await newProject({
363
+ blob: await newProject({
384
364
  settings: {
385
365
  baseLocale: "en",
386
366
  locales: ["en", "de"],
387
367
  },
388
368
  }),
389
- compilerOptions: {
390
- strategy: ["url"],
391
- urlPatterns: [
392
- {
393
- pattern: "/:path(.*)?",
394
- localized: [
395
- ["en", "/en/:path(.*)?"],
396
- ["de", "/de/:path(.*)?"],
397
- ],
398
- },
399
- ],
400
- },
369
+ strategy: ["url"],
370
+ urlPatterns: [
371
+ {
372
+ pattern: "/:path(.*)?",
373
+ localized: [
374
+ ["en", "/en/:path(.*)?"],
375
+ ["de", "/de/:path(.*)?"],
376
+ ],
377
+ },
378
+ ],
401
379
  });
402
380
  expect(runtime.deLocalizeUrl("https://example.com/en/").href).toBe("https://example.com/");
403
381
  expect(runtime.deLocalizeUrl("https://example.com/en").href).toBe("https://example.com/");
@@ -405,45 +383,41 @@ test("works with no trailing slash at the end", async () => {
405
383
  // https://github.com/opral/inlang-paraglide-js/issues/452#issuecomment-2715761308
406
384
  test("falls through if no match is found", async () => {
407
385
  const runtime = await createParaglide({
408
- project: await newProject({
386
+ blob: await newProject({
409
387
  settings: {
410
388
  baseLocale: "en",
411
389
  locales: ["en", "de"],
412
390
  },
413
391
  }),
414
- compilerOptions: {
415
- strategy: ["url"],
416
- urlPatterns: [
417
- {
418
- pattern: "/about",
419
- localized: [
420
- ["de", "/ueber"],
421
- ["en", "/about"],
422
- ],
423
- },
424
- ],
425
- },
392
+ strategy: ["url"],
393
+ urlPatterns: [
394
+ {
395
+ pattern: "/about",
396
+ localized: [
397
+ ["de", "/ueber"],
398
+ ["en", "/about"],
399
+ ],
400
+ },
401
+ ],
426
402
  });
427
403
  expect(runtime.localizeUrl("https://example.com/", { locale: "en" }).href).toBe("https://example.com/");
428
404
  expect(runtime.deLocalizeUrl("https://example.com/").href).toBe("https://example.com/");
429
405
  });
430
406
  test("defining no localized pattern leads to a fallthrough", async () => {
431
407
  const runtime = await createParaglide({
432
- project: await newProject({
408
+ blob: await newProject({
433
409
  settings: {
434
410
  baseLocale: "en",
435
411
  locales: ["en", "de"],
436
412
  },
437
413
  }),
438
- compilerOptions: {
439
- strategy: ["url"],
440
- urlPatterns: [
441
- {
442
- pattern: "/specific-path",
443
- localized: [["en", "/specific-path"]],
444
- },
445
- ],
446
- },
414
+ strategy: ["url"],
415
+ urlPatterns: [
416
+ {
417
+ pattern: "/specific-path",
418
+ localized: [["en", "/specific-path"]],
419
+ },
420
+ ],
447
421
  });
448
422
  // doesn't localize because no localized pattern is defined
449
423
  expect(runtime.localizeUrl("https://example.com/specific-path", { locale: "de" })
@@ -454,38 +428,36 @@ test("defining no localized pattern leads to a fallthrough", async () => {
454
428
  // https://github.com/opral/inlang-paraglide-js/issues/456
455
429
  test("routing to a 404 page", async () => {
456
430
  const runtime = await createParaglide({
457
- project: await newProject({
431
+ blob: await newProject({
458
432
  settings: {
459
433
  baseLocale: "en",
460
434
  locales: ["en", "de"],
461
435
  },
462
436
  }),
463
- compilerOptions: {
464
- strategy: ["url"],
465
- urlPatterns: [
466
- {
467
- pattern: "/404",
468
- localized: [
469
- ["en", "/404"],
470
- ["de", "/de/404"],
471
- ],
472
- },
473
- {
474
- pattern: "specific-path",
475
- localized: [
476
- ["en", "/specific-path"],
477
- ["de", "/de/404"],
478
- ],
479
- },
480
- {
481
- pattern: "/:path(.*)?",
482
- localized: [
483
- ["en", "/:path(.*)?"],
484
- ["de", "/de/:path(.*)?"],
485
- ],
486
- },
487
- ],
488
- },
437
+ strategy: ["url"],
438
+ urlPatterns: [
439
+ {
440
+ pattern: "/404",
441
+ localized: [
442
+ ["en", "/404"],
443
+ ["de", "/de/404"],
444
+ ],
445
+ },
446
+ {
447
+ pattern: "specific-path",
448
+ localized: [
449
+ ["en", "/specific-path"],
450
+ ["de", "/de/404"],
451
+ ],
452
+ },
453
+ {
454
+ pattern: "/:path(.*)?",
455
+ localized: [
456
+ ["en", "/:path(.*)?"],
457
+ ["de", "/de/:path(.*)?"],
458
+ ],
459
+ },
460
+ ],
489
461
  });
490
462
  expect(runtime.localizeUrl("https://example.com/specific-path", { locale: "en" })
491
463
  .href).toBe("https://example.com/specific-path");
@@ -498,25 +470,23 @@ test("routing to a 404 page", async () => {
498
470
  // Test showing the importance of pattern order in the localized array
499
471
  test("pattern order in localized array - correct order (specific first)", async () => {
500
472
  const runtime = await createParaglide({
501
- project: await newProject({
473
+ blob: await newProject({
502
474
  settings: {
503
475
  baseLocale: "en",
504
476
  locales: ["en", "de"],
505
477
  },
506
478
  }),
507
- compilerOptions: {
508
- strategy: ["url"],
509
- urlPatterns: [
510
- {
511
- pattern: "/:path(.*)?",
512
- localized: [
513
- // CORRECT ORDER: more specific pattern first
514
- ["de", "/de/:path(.*)?"], // More specific pattern with prefix
515
- ["en", "/:path(.*)?"], // Less specific pattern without prefix
516
- ],
517
- },
518
- ],
519
- },
479
+ strategy: ["url"],
480
+ urlPatterns: [
481
+ {
482
+ pattern: "/:path(.*)?",
483
+ localized: [
484
+ // CORRECT ORDER: more specific pattern first
485
+ ["de", "/de/:path(.*)?"], // More specific pattern with prefix
486
+ ["en", "/:path(.*)?"], // Less specific pattern without prefix
487
+ ],
488
+ },
489
+ ],
520
490
  });
521
491
  // These should work correctly with the specific (de) pattern first
522
492
  expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
@@ -527,25 +497,23 @@ test("pattern order in localized array - correct order (specific first)", async
527
497
  // Test showing the importance of pattern order in the localized array
528
498
  test("pattern order in localized array - incorrect order (generic first)", async () => {
529
499
  const runtime = await createParaglide({
530
- project: await newProject({
500
+ blob: await newProject({
531
501
  settings: {
532
502
  baseLocale: "en",
533
503
  locales: ["en", "de"],
534
504
  },
535
505
  }),
536
- compilerOptions: {
537
- strategy: ["url"],
538
- urlPatterns: [
539
- {
540
- pattern: "/:path(.*)?",
541
- localized: [
542
- // INCORRECT ORDER: less specific pattern first
543
- ["en", "/:path(.*)?"], // Less specific pattern without prefix
544
- ["de", "/de/:path(.*)?"], // More specific pattern with prefix that may never match
545
- ],
546
- },
547
- ],
548
- },
506
+ strategy: ["url"],
507
+ urlPatterns: [
508
+ {
509
+ pattern: "/:path(.*)?",
510
+ localized: [
511
+ // INCORRECT ORDER: less specific pattern first
512
+ ["en", "/:path(.*)?"], // Less specific pattern without prefix
513
+ ["de", "/de/:path(.*)?"], // More specific pattern with prefix that may never match
514
+ ],
515
+ },
516
+ ],
549
517
  });
550
518
  // English localization works as expected
551
519
  expect(runtime.localizeUrl("https://example.com/about", { locale: "en" }).href).toBe("https://example.com/about");
@@ -559,25 +527,23 @@ test("pattern order in localized array - incorrect order (generic first)", async
559
527
  // Test for port number issue with specific port numbers in the URL pattern
560
528
  test("handles explicit port numbers in URL patterns correctly", async () => {
561
529
  const runtime = await createParaglide({
562
- project: await newProject({
530
+ blob: await newProject({
563
531
  settings: {
564
532
  baseLocale: "en",
565
533
  locales: ["en", "de"],
566
534
  },
567
535
  }),
568
- compilerOptions: {
569
- strategy: ["url"],
570
- urlPatterns: [
571
- {
572
- // Using explicit port number - this causes issues with deLocalizeUrl
573
- pattern: "http://localhost:5173/:path(.*)?",
574
- localized: [
575
- ["de", "http://localhost:5173/de/:path(.*)?"],
576
- ["en", "http://localhost:5173/:path(.*)?"],
577
- ],
578
- },
579
- ],
580
- },
536
+ strategy: ["url"],
537
+ urlPatterns: [
538
+ {
539
+ // Using explicit port number - this causes issues with deLocalizeUrl
540
+ pattern: "http://localhost:5173/:path(.*)?",
541
+ localized: [
542
+ ["de", "http://localhost:5173/de/:path(.*)?"],
543
+ ["en", "http://localhost:5173/:path(.*)?"],
544
+ ],
545
+ },
546
+ ],
581
547
  });
582
548
  // Localization should work correctly
583
549
  expect(runtime.localizeUrl("http://localhost:5173/about", { locale: "de" }).href).toBe("http://localhost:5173/de/about");
@@ -589,25 +555,23 @@ test("handles explicit port numbers in URL patterns correctly", async () => {
589
555
  // Test for the correct approach using port as a pattern parameter
590
556
  test("correctly handles port numbers as pattern parameters", async () => {
591
557
  const runtime = await createParaglide({
592
- project: await newProject({
558
+ blob: await newProject({
593
559
  settings: {
594
560
  baseLocale: "en",
595
561
  locales: ["en", "de"],
596
562
  },
597
563
  }),
598
- compilerOptions: {
599
- strategy: ["url"],
600
- urlPatterns: [
601
- {
602
- // Using port as a proper pattern parameter with :: syntax
603
- pattern: "http://localhost::port/:path(.*)?",
604
- localized: [
605
- ["de", "http://localhost::port/de/:path(.*)?"],
606
- ["en", "http://localhost::port/:path(.*)?"],
607
- ],
608
- },
609
- ],
610
- },
564
+ strategy: ["url"],
565
+ urlPatterns: [
566
+ {
567
+ // Using port as a proper pattern parameter with :: syntax
568
+ pattern: "http://localhost::port/:path(.*)?",
569
+ localized: [
570
+ ["de", "http://localhost::port/de/:path(.*)?"],
571
+ ["en", "http://localhost::port/:path(.*)?"],
572
+ ],
573
+ },
574
+ ],
611
575
  });
612
576
  // Localization should work correctly
613
577
  expect(runtime.localizeUrl("http://localhost:5173/about", { locale: "de" }).href).toBe("http://localhost:5173/de/about");