@inlang/sdk 0.29.0 → 0.30.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.
@@ -1 +1 @@
1
- {"version":3,"file":"loadProject.d.ts","sourceRoot":"","sources":["../src/loadProject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,aAAa,EAGb,YAAY,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,4BAA4B,CAAA;AAyBhF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAgChD;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,cAAc,CAAA;CACxB,GAAG,OAAO,CAAC,aAAa,CAAC,CAuYzB;AAsHD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAQtE"}
1
+ {"version":3,"file":"loadProject.d.ts","sourceRoot":"","sources":["../src/loadProject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,aAAa,EAGb,YAAY,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,4BAA4B,CAAA;AAyBhF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAgChD;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,cAAc,CAAA;CACxB,GAAG,OAAO,CAAC,aAAa,CAAC,CAqYzB;AAsHD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAQtE"}
@@ -49,20 +49,19 @@ export async function loadProject(args) {
49
49
  else if (/[^\\/]+\.inlang$/.test(projectPath) === false) {
50
50
  throw new LoadProjectInvalidArgument(`Expected a path ending in "{name}.inlang" but received "${projectPath}".\n\nValid examples: \n- "/path/to/micky-mouse.inlang"\n- "/path/to/green-elephant.inlang\n`, { argument: "projectPath" });
51
51
  }
52
- const fs = args.repo.nodeishFs;
53
52
  const nodeishFs = createNodeishFsWithAbsolutePaths({
54
53
  projectPath,
55
- nodeishFs: fs,
54
+ nodeishFs: args.repo.nodeishFs,
56
55
  });
57
56
  // -- migratations ------------------------------------------------
58
- await maybeMigrateToDirectory({ nodeishFs: fs, projectPath });
57
+ await maybeMigrateToDirectory({ nodeishFs, projectPath });
59
58
  await maybeCreateFirstProjectId({ projectPath, repo: args.repo });
60
59
  // -- load project ------------------------------------------------------
61
60
  return await createRoot(async () => {
62
61
  // TODO remove tryCatch after https://github.com/opral/monorepo/issues/2013
63
62
  // - a repo will always be present
64
63
  // - if a repo is present, the project id will always be present
65
- const { data: projectId } = await tryCatch(() => fs.readFile(args.projectPath + "/project_id", { encoding: "utf-8" }));
64
+ const { data: projectId } = await tryCatch(() => nodeishFs.readFile(args.projectPath + "/project_id", { encoding: "utf-8" }));
66
65
  const [initialized, markInitAsComplete, markInitAsFailed] = createAwaitable();
67
66
  // -- settings ------------------------------------------------------------
68
67
  const [settings, _setSettings] = createSignal();
@@ -219,7 +218,7 @@ export async function loadProject(args) {
219
218
  // don't trigger saves or set dirty flags during initial setup
220
219
  if (!initialSetup) {
221
220
  messageStates.messageDirtyFlags[message.id] = true;
222
- saveMessagesViaPlugin(fs, messageLockDirPath, messageStates, messagesQuery, settings(), saveMessagesPlugin, loadMessagesPlugin)
221
+ saveMessagesViaPlugin(nodeishFs, messageLockDirPath, messageStates, messagesQuery, settings(), saveMessagesPlugin, loadMessagesPlugin)
223
222
  .catch((e) => setSaveMessagesViaPluginError(new PluginSaveMessagesError({ cause: e })))
224
223
  .then(() => {
225
224
  if (saveMessagesViaPluginError() !== undefined) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inlang/sdk",
3
3
  "type": "module",
4
- "version": "0.29.0",
4
+ "version": "0.30.0",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -39,10 +39,10 @@
39
39
  "@inlang/module": "1.2.9",
40
40
  "@inlang/project-settings": "2.4.0",
41
41
  "@inlang/plugin": "2.4.9",
42
+ "@inlang/translatable": "1.3.1",
42
43
  "@inlang/result": "1.1.0",
43
- "@lix-js/fs": "1.0.0",
44
44
  "@lix-js/client": "1.2.0",
45
- "@inlang/translatable": "1.3.1"
45
+ "@lix-js/fs": "1.0.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/debug": "^4.1.12",
@@ -105,16 +105,14 @@ export async function loadProject(args: {
105
105
  )
106
106
  }
107
107
 
108
- const fs = args.repo.nodeishFs
109
-
110
108
  const nodeishFs = createNodeishFsWithAbsolutePaths({
111
109
  projectPath,
112
- nodeishFs: fs,
110
+ nodeishFs: args.repo.nodeishFs,
113
111
  })
114
112
 
115
113
  // -- migratations ------------------------------------------------
116
114
 
117
- await maybeMigrateToDirectory({ nodeishFs: fs, projectPath })
115
+ await maybeMigrateToDirectory({ nodeishFs, projectPath })
118
116
  await maybeCreateFirstProjectId({ projectPath, repo: args.repo })
119
117
 
120
118
  // -- load project ------------------------------------------------------
@@ -124,7 +122,7 @@ export async function loadProject(args: {
124
122
  // - a repo will always be present
125
123
  // - if a repo is present, the project id will always be present
126
124
  const { data: projectId } = await tryCatch(() =>
127
- fs.readFile(args.projectPath + "/project_id", { encoding: "utf-8" })
125
+ nodeishFs.readFile(args.projectPath + "/project_id", { encoding: "utf-8" })
128
126
  )
129
127
 
130
128
  const [initialized, markInitAsComplete, markInitAsFailed] = createAwaitable()
@@ -348,7 +346,7 @@ export async function loadProject(args: {
348
346
  if (!initialSetup) {
349
347
  messageStates.messageDirtyFlags[message.id] = true
350
348
  saveMessagesViaPlugin(
351
- fs,
349
+ nodeishFs,
352
350
  messageLockDirPath,
353
351
  messageStates,
354
352
  messagesQuery,