@inlang/sdk 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +2 -2
  2. package/dist/adapter/solidAdapter.test.js +13 -6
  3. package/dist/createNodeishFsWithWatcher.js +1 -1
  4. package/dist/env-variables/index.d.ts +4 -0
  5. package/dist/env-variables/index.d.ts.map +1 -0
  6. package/dist/env-variables/index.js +3 -0
  7. package/dist/listProjects.d.ts.map +1 -1
  8. package/dist/listProjects.js +15 -9
  9. package/dist/listProjects.test.js +14 -1
  10. package/dist/loadProject.d.ts +28 -9
  11. package/dist/loadProject.d.ts.map +1 -1
  12. package/dist/loadProject.js +49 -50
  13. package/dist/loadProject.test.js +70 -33
  14. package/dist/migrations/maybeCreateFirstProjectId.d.ts +16 -0
  15. package/dist/migrations/maybeCreateFirstProjectId.d.ts.map +1 -0
  16. package/dist/migrations/maybeCreateFirstProjectId.js +37 -0
  17. package/dist/migrations/maybeCreateFirstProjectId.test.d.ts +2 -0
  18. package/dist/migrations/maybeCreateFirstProjectId.test.d.ts.map +1 -0
  19. package/dist/migrations/maybeCreateFirstProjectId.test.js +27 -0
  20. package/dist/migrations/migrateToDirectory.d.ts +1 -1
  21. package/dist/migrations/migrateToDirectory.js +3 -3
  22. package/dist/telemetry/capture.d.ts +21 -0
  23. package/dist/telemetry/capture.d.ts.map +1 -0
  24. package/dist/telemetry/capture.js +39 -0
  25. package/package.json +13 -12
  26. package/src/adapter/solidAdapter.test.ts +13 -6
  27. package/src/createNodeishFsWithWatcher.ts +1 -1
  28. package/src/env-variables/.prettierignore +1 -0
  29. package/src/env-variables/createIndexFile.js +28 -0
  30. package/src/env-variables/index.d.ts +13 -0
  31. package/src/listProjects.test.ts +21 -2
  32. package/src/listProjects.ts +14 -7
  33. package/src/loadProject.test.ts +73 -33
  34. package/src/loadProject.ts +91 -48
  35. package/src/migrations/maybeCreateFirstProjectId.test.ts +34 -0
  36. package/src/migrations/maybeCreateFirstProjectId.ts +43 -0
  37. package/src/migrations/migrateToDirectory.ts +3 -3
  38. package/src/telemetry/capture.ts +49 -0
  39. package/dist/generateProjectId.d.ts +0 -3
  40. package/dist/generateProjectId.d.ts.map +0 -1
  41. package/dist/generateProjectId.js +0 -11
  42. package/dist/generateProjectId.test.d.ts +0 -2
  43. package/dist/generateProjectId.test.d.ts.map +0 -1
  44. package/dist/generateProjectId.test.js +0 -18
  45. package/src/generateProjectId.test.ts +0 -22
  46. package/src/generateProjectId.ts +0 -14
@@ -5,6 +5,7 @@ import { createEffect, from, createRoot } from "../reactivity/solid.js"
5
5
  import { solidAdapter } from "./solidAdapter.js"
6
6
  import { loadProject } from "../loadProject.js"
7
7
  import { createNodeishMemoryFs } from "@lix-js/fs"
8
+ import { openRepository } from "@lix-js/client"
8
9
  import type {
9
10
  Message,
10
11
  ProjectSettings,
@@ -92,10 +93,11 @@ describe("config", () => {
92
93
  const fs = createNodeishMemoryFs()
93
94
  await fs.mkdir("/user/project.inlang", { recursive: true })
94
95
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(config))
96
+ const repo = await openRepository("file://", { nodeishFs: fs })
95
97
  const project = solidAdapter(
96
98
  await loadProject({
97
99
  projectPath: "/user/project.inlang",
98
- nodeishFs: fs,
100
+ repo,
99
101
  _import: $import,
100
102
  }),
101
103
  { from }
@@ -125,10 +127,11 @@ describe("installed", () => {
125
127
  const fs = createNodeishMemoryFs()
126
128
  await fs.mkdir("/user/project.inlang", { recursive: true })
127
129
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(config))
130
+ const repo = await openRepository("file://", { nodeishFs: fs })
128
131
  const project = solidAdapter(
129
132
  await loadProject({
130
133
  projectPath: "/user/project.inlang",
131
- nodeishFs: fs,
134
+ repo,
132
135
  _import: $import,
133
136
  }),
134
137
  { from }
@@ -190,10 +193,11 @@ describe("messages", () => {
190
193
 
191
194
  await fs.mkdir("/user/project.inlang.inlang", { recursive: true })
192
195
  await fs.writeFile("/user/project.inlang.inlang/settings.json", JSON.stringify(mockConfig))
196
+ const repo = await openRepository("file://", { nodeishFs: fs })
193
197
  const project = solidAdapter(
194
198
  await loadProject({
195
199
  projectPath: "/user/project.inlang.inlang",
196
- nodeishFs: fs,
200
+ repo,
197
201
  _import: mockImport,
198
202
  }),
199
203
  { from }
@@ -220,10 +224,11 @@ describe("messages", () => {
220
224
  const fs = createNodeishMemoryFs()
221
225
  await fs.mkdir("/user/project.inlang.inlang", { recursive: true })
222
226
  await fs.writeFile("/user/project.inlang.inlang/settings.json", JSON.stringify(config))
227
+ const repo = await openRepository("file://", { nodeishFs: fs })
223
228
  const project = solidAdapter(
224
229
  await loadProject({
225
230
  projectPath: "/user/project.inlang.inlang",
226
- nodeishFs: fs,
231
+ repo,
227
232
  _import: $import,
228
233
  }),
229
234
  { from }
@@ -282,10 +287,11 @@ describe("lint", () => {
282
287
  const fs = createNodeishMemoryFs()
283
288
  await fs.mkdir("./project.inlang", { recursive: true })
284
289
  await fs.writeFile("./project.inlang/settings.json", JSON.stringify(config))
290
+ const repo = await openRepository("file://", { nodeishFs: fs })
285
291
  const project = solidAdapter(
286
292
  await loadProject({
287
293
  projectPath: "./project.inlang",
288
- nodeishFs: fs,
294
+ repo,
289
295
  _import: $import,
290
296
  }),
291
297
  { from }
@@ -320,10 +326,11 @@ describe("lint", () => {
320
326
  await createRoot(async () => {
321
327
  const fs = createNodeishMemoryFs()
322
328
  await fs.writeFile("./project.config.json", JSON.stringify(config))
329
+ const repo = await openRepository("file://", { nodeishFs: fs })
323
330
  const project = solidAdapter(
324
331
  await loadProject({
325
332
  projectPath: "./project.config.json",
326
- nodeishFs: fs,
333
+ repo,
327
334
  _import: $import,
328
335
  }),
329
336
  { from }
@@ -28,7 +28,7 @@ export const createNodeishFsWithWatcher = (args: {
28
28
  }
29
29
  } catch (err: any) {
30
30
  if (err.name === "AbortError") return
31
- // https://github.com/inlang/monorepo/issues/1647
31
+ // https://github.com/opral/monorepo/issues/1647
32
32
  // the file does not exist (yet)
33
33
  // this is not testable beacause the fs.watch api differs
34
34
  // from node and lix. lenghty
@@ -0,0 +1 @@
1
+ index.js
@@ -0,0 +1,28 @@
1
+ /* eslint-disable no-restricted-imports */
2
+ /* eslint-disable no-undef */
3
+ /**
4
+ * This script writes public environment variables
5
+ * to an importable env file.
6
+ *
7
+ * - The SDK must bundle this file with the rest of the SDK
8
+ * - This scripts avoids the need for a bundler
9
+ * - Must be ran before building the SDK
10
+ */
11
+
12
+ import fs from "node:fs/promises"
13
+ import url from "node:url"
14
+ import path from "node:path"
15
+
16
+ const dirname = path.dirname(url.fileURLToPath(import.meta.url))
17
+
18
+ await fs.writeFile(
19
+ dirname + "/index.ts",
20
+ `
21
+ export const ENV_VARIABLES = {
22
+ PUBLIC_POSTHOG_TOKEN: "${process.env.PUBLIC_POSTHOG_TOKEN}",
23
+ }
24
+ `
25
+ )
26
+
27
+ // eslint-disable-next-line no-console
28
+ console.log("✅ Created env variable index file.")
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Avoiding TypeScript errors before the `createIndexFile` script
3
+ * is invoked by defining the type ahead of time.
4
+ */
5
+
6
+ /**
7
+ * Env variables that are available at runtime.
8
+ *
9
+ * - assume that each env variable might be undefined (to ease development/contributions)
10
+ */
11
+ export declare const ENV_VARIABLES: Partial<{
12
+ PUBLIC_POSTHOG_TOKEN: string
13
+ }>
@@ -1,7 +1,10 @@
1
- import { assert, describe, it } from "vitest"
1
+ import { assert, describe, it, expect } from "vitest"
2
2
  import { listProjects } from "./listProjects.js"
3
- import { createNodeishMemoryFs } from "@lix-js/fs"
3
+ import { createNodeishMemoryFs, type Snapshot } from "@lix-js/fs"
4
4
  import type { ProjectSettings } from "@inlang/project-settings"
5
+ import { mockRepo } from "@lix-js/client"
6
+ // eslint-disable-next-line no-restricted-imports -- test
7
+ import { readFileSync } from "node:fs"
5
8
 
6
9
  const settings: ProjectSettings = {
7
10
  sourceLanguageTag: "en",
@@ -55,6 +58,22 @@ describe("listProjects", () => {
55
58
  })
56
59
  })
57
60
 
61
+ it("should not crash on broken symlinks as cal.com has", async () => {
62
+ const ciTestRepo: Snapshot = JSON.parse(
63
+ readFileSync("./mocks/ci-test-repo-no-shallow.json", { encoding: "utf-8" })
64
+ )
65
+ const repo = await mockRepo({ fromSnapshot: ciTestRepo })
66
+ repo.checkout({ branch: "test-symlink" })
67
+
68
+ const link = await repo.nodeishFs.readlink("test-symlink-not-existing-target")
69
+
70
+ expect(link).toBe("/test-symlink-not-existing-target//.././no-exist")
71
+
72
+ await listProjects(repo.nodeishFs, "/").then((projects) => {
73
+ assert(projects.length === 1)
74
+ })
75
+ })
76
+
58
77
  it("should also find files inside of a dir that ends with *.inlang", async () => {
59
78
  const fs = createNodeishMemoryFs()
60
79
  await fs.mkdir("/user/dir1/go.inlang", { recursive: true })
@@ -17,14 +17,21 @@ export const listProjects = async (
17
17
  const files = await nodeishFs.readdir(path)
18
18
  for (const file of files) {
19
19
  const filePath = `${path}/${file}`
20
- const stats = await nodeishFs.stat(filePath)
21
- if (stats.isDirectory()) {
22
- if (file === "node_modules") continue
23
- if (file.endsWith(".inlang")) {
24
- projects.push({ projectPath: filePath })
25
- } else {
26
- await searchDir(filePath, depth + 1)
20
+ try {
21
+ const stats = await nodeishFs.stat(filePath)
22
+ if (stats.isDirectory()) {
23
+ if (file === "node_modules") {
24
+ continue
25
+ }
26
+
27
+ if (file.endsWith(".inlang")) {
28
+ projects.push({ projectPath: filePath })
29
+ } else {
30
+ await searchDir(filePath, depth + 1)
31
+ }
27
32
  }
33
+ } catch {
34
+ continue
28
35
  }
29
36
  }
30
37
  }
@@ -19,7 +19,12 @@ import {
19
19
  import { createNodeishMemoryFs, normalizePath } from "@lix-js/fs"
20
20
  import { createMessage } from "./test-utilities/createMessage.js"
21
21
  import { tryCatch } from "@inlang/result"
22
- import { mockRepo } from "@lix-js/client"
22
+ import { mockRepo, openRepository } from "@lix-js/client"
23
+ import { type Snapshot } from "@lix-js/fs"
24
+ // eslint-disable-next-line no-restricted-imports -- test
25
+ import { readFileSync } from "node:fs"
26
+ // eslint-disable-next-line no-restricted-imports -- test
27
+ import { resolve } from "node:path"
23
28
 
24
29
  // ------------------------------------------------------------------------------------------------
25
30
 
@@ -104,6 +109,16 @@ const _import: ImportFunction = async (name) =>
104
109
  default: name === "plugin.js" ? mockPlugin : mockMessageLintRule,
105
110
  } satisfies InlangModule)
106
111
 
112
+ async function openCiTestRepo() {
113
+ return await mockRepo({
114
+ fromSnapshot: JSON.parse(
115
+ readFileSync(resolve(__dirname, "../mocks/ci-test-repo-no-shallow.json"), {
116
+ encoding: "utf-8",
117
+ })
118
+ ) as Snapshot,
119
+ })
120
+ }
121
+
107
122
  // ------------------------------------------------------------------------------------------------
108
123
 
109
124
  /**
@@ -114,10 +129,11 @@ const _import: ImportFunction = async (name) =>
114
129
  */
115
130
  it("should throw if a project (path) does not have a name", async () => {
116
131
  const fs = createNodeishMemoryFs()
132
+ const repo = await openRepository("file://", { nodeishFs: fs })
117
133
  const project = await tryCatch(() =>
118
134
  loadProject({
119
135
  projectPath: "/source-code/.inlang",
120
- nodeishFs: fs,
136
+ repo,
121
137
  _import,
122
138
  })
123
139
  )
@@ -126,6 +142,7 @@ it("should throw if a project (path) does not have a name", async () => {
126
142
 
127
143
  it("should throw if a project path does not end with .inlang", async () => {
128
144
  const fs = createNodeishMemoryFs()
145
+ const repo = await openRepository("file://", { nodeishFs: fs })
129
146
 
130
147
  const invalidPaths = [
131
148
  "/source-code/frontend.inlang/settings",
@@ -137,7 +154,7 @@ it("should throw if a project path does not end with .inlang", async () => {
137
154
  const project = await tryCatch(() =>
138
155
  loadProject({
139
156
  projectPath: invalidPath,
140
- nodeishFs: fs,
157
+ repo,
141
158
  _import,
142
159
  })
143
160
  )
@@ -148,11 +165,12 @@ it("should throw if a project path does not end with .inlang", async () => {
148
165
  describe("initialization", () => {
149
166
  it("should throw if projectPath is not an absolute path", async () => {
150
167
  const fs = createNodeishMemoryFs()
168
+ const repo = await openRepository("file://", { nodeishFs: fs })
151
169
 
152
170
  const result = await tryCatch(() =>
153
171
  loadProject({
154
172
  projectPath: "relative/path",
155
- nodeishFs: fs,
173
+ repo,
156
174
  _import,
157
175
  })
158
176
  )
@@ -161,7 +179,7 @@ describe("initialization", () => {
161
179
  })
162
180
 
163
181
  it("should generate projectId on missing projectid", async () => {
164
- const repo = await mockRepo()
182
+ const repo = await openCiTestRepo()
165
183
 
166
184
  const existing = await repo.nodeishFs
167
185
  .readFile("/project.inlang/project_id", {
@@ -177,7 +195,6 @@ describe("initialization", () => {
177
195
  const result = await tryCatch(() =>
178
196
  loadProject({
179
197
  projectPath: "/project.inlang",
180
- nodeishFs: repo.nodeishFs,
181
198
  repo,
182
199
  _import,
183
200
  })
@@ -191,21 +208,20 @@ describe("initialization", () => {
191
208
  return { error }
192
209
  })
193
210
 
194
- expect(newId).toBe("7cd6c2b7cf12febf99496408917123fdfe158b6bc442914f5fb42aa74346bd50")
211
+ expect(newId).toBe("aef225403be8b526dfb492a4617fd59d8181e8fef2c7f4aff56ab299046e36ed")
195
212
 
196
213
  expect(result.error).toBeUndefined()
197
214
  expect(result.data).toBeDefined()
198
215
  })
199
216
 
200
217
  it("should reuse projectId on existing projectid", async () => {
201
- const repo = await mockRepo()
218
+ const repo = await openCiTestRepo()
202
219
 
203
220
  repo.nodeishFs.writeFile("/project.inlang/project_id", "testId")
204
221
 
205
222
  const result = await tryCatch(() =>
206
223
  loadProject({
207
224
  projectPath: "/project.inlang",
208
- nodeishFs: repo.nodeishFs,
209
225
  repo,
210
226
  _import,
211
227
  })
@@ -229,11 +245,12 @@ describe("initialization", () => {
229
245
  const fs = createNodeishMemoryFs()
230
246
  fs.mkdir("C:\\Users\\user\\project.inlang", { recursive: true })
231
247
  fs.writeFile("C:\\Users\\user\\project.inlang\\settings.json", JSON.stringify(settings))
248
+ const repo = await openRepository("file://", { nodeishFs: fs })
232
249
 
233
250
  const result = await tryCatch(() =>
234
251
  loadProject({
235
252
  projectPath: "C:\\Users\\user\\project.inlang",
236
- nodeishFs: fs,
253
+ repo,
237
254
  _import,
238
255
  })
239
256
  )
@@ -246,10 +263,11 @@ describe("initialization", () => {
246
263
  it("should return an error if settings file is not found", async () => {
247
264
  const fs = createNodeishMemoryFs()
248
265
  fs.mkdir("/user/project", { recursive: true })
266
+ const repo = await openRepository("file://", { nodeishFs: fs })
249
267
 
250
268
  const project = await loadProject({
251
269
  projectPath: "/user/non-existend-project.inlang",
252
- nodeishFs: fs,
270
+ repo,
253
271
  _import,
254
272
  })
255
273
 
@@ -260,10 +278,11 @@ describe("initialization", () => {
260
278
  const fs = await createNodeishMemoryFs()
261
279
  await fs.mkdir("/user/project.inlang", { recursive: true })
262
280
  await fs.writeFile("/user/project.inlang/settings.json", "invalid json")
281
+ const repo = await openRepository("file://", { nodeishFs: fs })
263
282
 
264
283
  const project = await loadProject({
265
284
  projectPath: "/user/project.inlang",
266
- nodeishFs: fs,
285
+ repo,
267
286
  _import,
268
287
  })
269
288
 
@@ -274,10 +293,11 @@ describe("initialization", () => {
274
293
  const fs = await createNodeishMemoryFs()
275
294
  await fs.mkdir("/user/project.inlang", { recursive: true })
276
295
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify({}))
296
+ const repo = await openRepository("file://", { nodeishFs: fs })
277
297
 
278
298
  const project = await loadProject({
279
299
  projectPath: "/user/project.inlang",
280
- nodeishFs: fs,
300
+ repo,
281
301
  _import,
282
302
  })
283
303
 
@@ -288,9 +308,10 @@ describe("initialization", () => {
288
308
  const fs = await createNodeishMemoryFs()
289
309
  await fs.mkdir("/user/project.inlang", { recursive: true })
290
310
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
311
+ const repo = await openRepository("file://", { nodeishFs: fs })
291
312
  const project = await loadProject({
292
313
  projectPath: "/user/project.inlang",
293
- nodeishFs: fs,
314
+ repo,
294
315
  _import,
295
316
  })
296
317
 
@@ -302,10 +323,11 @@ describe("initialization", () => {
302
323
  const settingsWithDeifferentFormatting = JSON.stringify(settings, undefined, 4)
303
324
  await fs.mkdir("/user/project.inlang", { recursive: true })
304
325
  await fs.writeFile("/user/project.inlang/settings.json", settingsWithDeifferentFormatting)
326
+ const repo = await openRepository("file://", { nodeishFs: fs })
305
327
 
306
328
  const project = await loadProject({
307
329
  projectPath: "/user/project.inlang",
308
- nodeishFs: fs,
330
+ repo,
309
331
  _import,
310
332
  })
311
333
 
@@ -335,10 +357,11 @@ describe("initialization", () => {
335
357
  const fs = createNodeishMemoryFs()
336
358
  await fs.mkdir("/user/project.inlang", { recursive: true })
337
359
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
360
+ const repo = await openRepository("file://", { nodeishFs: fs })
338
361
 
339
362
  const project = await loadProject({
340
363
  projectPath: "/user/project.inlang",
341
- nodeishFs: fs,
364
+ repo,
342
365
  _import: $badImport,
343
366
  })
344
367
 
@@ -368,9 +391,10 @@ describe("functionality", () => {
368
391
  const fs = await createNodeishMemoryFs()
369
392
  await fs.mkdir("/user/project.inlang", { recursive: true })
370
393
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
394
+ const repo = await openRepository("file://", { nodeishFs: fs })
371
395
  const project = await loadProject({
372
396
  projectPath: "/user/project.inlang",
373
- nodeishFs: fs,
397
+ repo,
374
398
  _import,
375
399
  })
376
400
 
@@ -381,9 +405,10 @@ describe("functionality", () => {
381
405
  const fs = await createNodeishMemoryFs()
382
406
  await fs.mkdir("/user/project.inlang", { recursive: true })
383
407
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
408
+ const repo = await openRepository("file://", { nodeishFs: fs })
384
409
  const project = await loadProject({
385
410
  projectPath: "/user/project.inlang",
386
- nodeishFs: fs,
411
+ repo,
387
412
  _import,
388
413
  })
389
414
 
@@ -407,9 +432,10 @@ describe("functionality", () => {
407
432
  const fs = await createNodeishMemoryFs()
408
433
  await fs.mkdir("/user/project.inlang", { recursive: true })
409
434
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
435
+ const repo = await openRepository("file://", { nodeishFs: fs })
410
436
  const project = await loadProject({
411
437
  projectPath: "/user/project.inlang",
412
- nodeishFs: fs,
438
+ repo,
413
439
  _import,
414
440
  })
415
441
 
@@ -429,10 +455,11 @@ describe("functionality", () => {
429
455
  }
430
456
 
431
457
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
458
+ const repo = await openRepository("file://", { nodeishFs: fs })
432
459
 
433
460
  const project = await loadProject({
434
461
  projectPath: "/user/project.inlang",
435
- nodeishFs: fs,
462
+ repo,
436
463
  _import,
437
464
  })
438
465
 
@@ -444,9 +471,10 @@ describe("functionality", () => {
444
471
  const fs = await createNodeishMemoryFs()
445
472
  await fs.mkdir("/user/project.inlang", { recursive: true })
446
473
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
474
+ const repo = await openRepository("file://", { nodeishFs: fs })
447
475
  const project = await loadProject({
448
476
  projectPath: "/user/project.inlang",
449
- nodeishFs: fs,
477
+ repo,
450
478
  _import,
451
479
  })
452
480
 
@@ -476,9 +504,10 @@ describe("functionality", () => {
476
504
  }
477
505
  await fs.mkdir("/user/project.inlang", { recursive: true })
478
506
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
507
+ const repo = await openRepository("file://", { nodeishFs: fs })
479
508
  const project = await loadProject({
480
509
  projectPath: "/user/project.inlang",
481
- nodeishFs: fs,
510
+ repo,
482
511
  _import,
483
512
  })
484
513
 
@@ -509,10 +538,11 @@ describe("functionality", () => {
509
538
 
510
539
  await fs.mkdir("/user/project.inlang", { recursive: true })
511
540
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
541
+ const repo = await openRepository("file://", { nodeishFs: fs })
512
542
 
513
543
  const project = await loadProject({
514
544
  projectPath: "/user/project.inlang",
515
- nodeishFs: fs,
545
+ repo,
516
546
  _import,
517
547
  })
518
548
 
@@ -551,6 +581,7 @@ describe("functionality", () => {
551
581
  modules: ["plugin.js", "lintRule.js"],
552
582
  } satisfies ProjectSettings)
553
583
  )
584
+ const repo = await openRepository("file://", { nodeishFs: fs })
554
585
 
555
586
  const _import: ImportFunction = async (name) => {
556
587
  return {
@@ -559,7 +590,7 @@ describe("functionality", () => {
559
590
  }
560
591
  const project = await loadProject({
561
592
  projectPath: "/user/project.inlang",
562
- nodeishFs: fs,
593
+ repo,
563
594
  _import,
564
595
  })
565
596
 
@@ -602,6 +633,7 @@ describe("functionality", () => {
602
633
  modules: ["plugin.js", "lintRule.js"],
603
634
  } satisfies ProjectSettings)
604
635
  )
636
+ const repo = await openRepository("file://", { nodeishFs: fs })
605
637
  const _import: ImportFunction = async (name) => {
606
638
  return {
607
639
  default: name === "plugin.js" ? _mockPlugin : _mockLintRule,
@@ -610,7 +642,7 @@ describe("functionality", () => {
610
642
 
611
643
  const project = await loadProject({
612
644
  projectPath: "/user/project.inlang",
613
- nodeishFs: fs,
645
+ repo,
614
646
  _import,
615
647
  })
616
648
 
@@ -627,9 +659,10 @@ describe("functionality", () => {
627
659
  const fs = await createNodeishMemoryFs()
628
660
  await fs.mkdir("/user/project.inlang", { recursive: true })
629
661
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
662
+ const repo = await openRepository("file://", { nodeishFs: fs })
630
663
  const project = await loadProject({
631
664
  projectPath: "/user/project.inlang",
632
- nodeishFs: fs,
665
+ repo,
633
666
  _import,
634
667
  })
635
668
  project.errors.subscribe((errors) => {
@@ -643,9 +676,10 @@ describe("functionality", () => {
643
676
  const fs = await createNodeishMemoryFs()
644
677
  await fs.mkdir("/user/project.inlang", { recursive: true })
645
678
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
679
+ const repo = await openRepository("file://", { nodeishFs: fs })
646
680
  const project = await loadProject({
647
681
  projectPath: "/user/project.inlang",
648
- nodeishFs: fs,
682
+ repo,
649
683
  _import,
650
684
  })
651
685
 
@@ -660,9 +694,10 @@ describe("functionality", () => {
660
694
  const fs = await createNodeishMemoryFs()
661
695
  await fs.mkdir("/user/project.inlang", { recursive: true })
662
696
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
697
+ const repo = await openRepository("file://", { nodeishFs: fs })
663
698
  const project = await loadProject({
664
699
  projectPath: "/user/project.inlang",
665
- nodeishFs: fs,
700
+ repo,
666
701
  _import,
667
702
  })
668
703
 
@@ -687,6 +722,7 @@ describe("functionality", () => {
687
722
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
688
723
 
689
724
  await fs.mkdir("./resources")
725
+ const repo = await openRepository("file://", { nodeishFs: fs })
690
726
 
691
727
  const mockSaveFn = vi.fn()
692
728
 
@@ -707,7 +743,7 @@ describe("functionality", () => {
707
743
 
708
744
  const project = await loadProject({
709
745
  projectPath: "/user/project.inlang",
710
- nodeishFs: fs,
746
+ repo,
711
747
  _import,
712
748
  })
713
749
 
@@ -862,6 +898,7 @@ describe("functionality", () => {
862
898
 
863
899
  await fs.mkdir("./project.inlang", { recursive: true })
864
900
  await fs.writeFile("./project.inlang/settings.json", JSON.stringify(settings))
901
+ const repo = await openRepository("file://", { nodeishFs: fs })
865
902
 
866
903
  const mockSaveFn = vi.fn()
867
904
 
@@ -886,7 +923,7 @@ describe("functionality", () => {
886
923
 
887
924
  const project = await loadProject({
888
925
  projectPath: "/project.inlang",
889
- nodeishFs: fs,
926
+ repo,
890
927
  _import,
891
928
  })
892
929
 
@@ -904,9 +941,10 @@ describe("functionality", () => {
904
941
  const fs = await createNodeishMemoryFs()
905
942
  await fs.mkdir("/user/project", { recursive: true })
906
943
  await fs.writeFile("/user/project/project.inlang.json", JSON.stringify(settings))
944
+ const repo = await openRepository("file://", { nodeishFs: fs })
907
945
  const project = await loadProject({
908
946
  projectPath: "/user/project/project.inlang.json",
909
- nodeishFs: fs,
947
+ repo,
910
948
  _import,
911
949
  })
912
950
  // TODO: test with real lint rules
@@ -926,9 +964,10 @@ describe("functionality", () => {
926
964
  const fs = createNodeishMemoryFs()
927
965
  await fs.mkdir("/user/project.inlang", { recursive: true })
928
966
  await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings))
967
+ const repo = await openRepository("file://", { nodeishFs: fs })
929
968
  const project = await loadProject({
930
969
  projectPath: "/user/project.inlang",
931
- nodeishFs: fs,
970
+ repo,
932
971
  _import: async () => ({
933
972
  default: mockMessageLintRule,
934
973
  }),
@@ -991,11 +1030,12 @@ describe("functionality", () => {
991
1030
 
992
1031
  await fs.mkdir("./project.inlang", { recursive: true })
993
1032
  await fs.writeFile("./project.inlang/settings.json", JSON.stringify(settings))
1033
+ const repo = await openRepository("file://", { nodeishFs: fs })
994
1034
 
995
1035
  // establish watcher
996
1036
  const project = await loadProject({
997
1037
  projectPath: normalizePath("/project.inlang"),
998
- nodeishFs: fs,
1038
+ repo,
999
1039
  _import: async () => ({
1000
1040
  default: mockMessageFormatPlugin,
1001
1041
  }),