diff --git a/.changeset/small-mayflies-care.md b/.changeset/small-mayflies-care.md deleted file mode 100644 index e43e065988..0000000000 --- a/.changeset/small-mayflies-care.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"vs-code-extension": minor ---- - -add ability to disable inline annotations diff --git a/inlang/source-code/ide-extension/CHANGELOG.md b/inlang/source-code/ide-extension/CHANGELOG.md index e9c3d72cb8..f077ba40fb 100644 --- a/inlang/source-code/ide-extension/CHANGELOG.md +++ b/inlang/source-code/ide-extension/CHANGELOG.md @@ -1,5 +1,11 @@ # inlang-vs-code-extension +## 1.40.0 + +### Minor Changes + +- 1cfdca2: add ability to disable inline annotations + ## 1.39.8 ### Patch Changes diff --git a/inlang/source-code/ide-extension/package.json b/inlang/source-code/ide-extension/package.json index f926d58a32..1188c43c3a 100644 --- a/inlang/source-code/ide-extension/package.json +++ b/inlang/source-code/ide-extension/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/opral/monorepo.git" }, "icon": "assets/sherlock-logo.png", - "version": "1.39.8", + "version": "1.40.0", "engines": { "vscode": "^1.84.2" }, diff --git a/inlang/source-code/plugins/inlang-message-format/CHANGELOG.md b/inlang/source-code/plugins/inlang-message-format/CHANGELOG.md index 75d6a69fad..65fba2e62b 100644 --- a/inlang/source-code/plugins/inlang-message-format/CHANGELOG.md +++ b/inlang/source-code/plugins/inlang-message-format/CHANGELOG.md @@ -1,5 +1,11 @@ # @inlang/plugin-message-format +## 2.2.0 + +### Minor Changes + +- 732430d: Error on messages file json parse failures + ## 2.1.1 ### Patch Changes diff --git a/inlang/source-code/plugins/inlang-message-format/package.json b/inlang/source-code/plugins/inlang-message-format/package.json index 7a8b7729c6..014643fad6 100644 --- a/inlang/source-code/plugins/inlang-message-format/package.json +++ b/inlang/source-code/plugins/inlang-message-format/package.json @@ -1,6 +1,6 @@ { "name": "@inlang/plugin-message-format", - "version": "2.1.1", + "version": "2.2.0", "type": "module", "exports": { "./storage-schema": "./src/storageSchema.ts" diff --git a/inlang/source-code/plugins/inlang-message-format/src/plugin.test.ts b/inlang/source-code/plugins/inlang-message-format/src/plugin.test.ts index 572db74b67..f0720962de 100644 --- a/inlang/source-code/plugins/inlang-message-format/src/plugin.test.ts +++ b/inlang/source-code/plugins/inlang-message-format/src/plugin.test.ts @@ -164,6 +164,46 @@ test("don't throw if the storage path does not exist. instead, create the file a } }) +test("throws if json has a trailing comma", async () => { + const { plugin } = await import("./plugin.js") + const fs = createNodeishMemoryFs() + + const settings = { + sourceLanguageTag: "en", + languageTags: ["en", "de"], + modules: [], + [pluginId]: { pathPattern: "./messages/{languageTag}.json" } satisfies PluginSettings, + } + + const enInitial = JSON.stringify({ + $schema: "https://inlang.com/schema/inlang-message-format", + first_message: "If this works I will be sad", + second_message: "Let's see if this blows up", + } satisfies StorageSchema) + + let deInitial = JSON.stringify({ + $schema: "https://inlang.com/schema/inlang-message-format", + second_message: "Mal sehen ob das knallt", + } satisfies StorageSchema) + + // inject trailing comma + deInitial = deInitial.slice(0, -1) + ",}" + + await fs.mkdir("./messages") + await fs.writeFile("./messages/en.json", enInitial) + await fs.writeFile("./messages/de.json", deInitial) + + try { + await plugin.loadMessages!({ + settings, + nodeishFs: fs, + }) + throw new Error("loadMessages should have thrown") + } catch (e) { + expect((e as Error).message).not.toBe("loadMessages should have thrown") + } +}) + test("recursively creating a directory should not fail if a subpath already exists", async () => { const { plugin } = await import("./plugin.js") const fs = createNodeishMemoryFs() diff --git a/inlang/source-code/plugins/inlang-message-format/src/plugin.ts b/inlang/source-code/plugins/inlang-message-format/src/plugin.ts index e122bbafc8..cc7fb5d080 100644 --- a/inlang/source-code/plugins/inlang-message-format/src/plugin.ts +++ b/inlang/source-code/plugins/inlang-message-format/src/plugin.ts @@ -53,8 +53,11 @@ export const plugin: Plugin<{ result[key] = parseMessage({ key, value: json[key], languageTag: tag }) } } - } catch { - // file does not exist. likely, no translations for the file exist yet. + } catch (error) { + // ignore if file does not exist => no translations exist yet. + if ((error as any)?.code !== "ENOENT") { + throw error + } } } return Object.values(result) diff --git a/inlang/source-code/server/CHANGELOG.md b/inlang/source-code/server/CHANGELOG.md index 6924a54ee7..12f4565304 100644 --- a/inlang/source-code/server/CHANGELOG.md +++ b/inlang/source-code/server/CHANGELOG.md @@ -4,6 +4,13 @@ ### Patch Changes +- Updated dependencies [732430d] + - @inlang/plugin-message-format@2.2.0 + +## null + +### Patch Changes + - @inlang/plugin-message-format@2.1.1 - @inlang/website@null - @inlang/badge@0.7.18