diff --git a/extensions.toml b/extensions.toml index b77fdf7a63..844cb0ed69 100644 --- a/extensions.toml +++ b/extensions.toml @@ -663,7 +663,7 @@ version = "1.3.3" [corust-agent] submodule = "extensions/corust-agent" -version = "0.3.2" +version = "0.3.3" [cosmos] submodule = "extensions/cosmos" @@ -2192,7 +2192,7 @@ version = "1.0.3" [modest-dark] submodule = "extensions/modest-dark" -version = "0.1.8" +version = "0.1.9" [modus-themes] submodule = "extensions/modus-themes" @@ -3749,6 +3749,7 @@ version = "0.1.4" [usd] submodule = "extensions/usd" +version = "0.1.0" [utl] submodule = "extensions/utl" diff --git a/extensions/corust-agent b/extensions/corust-agent index 6abc293b99..f9ef70e97a 160000 --- a/extensions/corust-agent +++ b/extensions/corust-agent @@ -1 +1 @@ -Subproject commit 6abc293b9921650421ba0819d6ef0c1ebacb0b9c +Subproject commit f9ef70e97a16ca7fb5911f4a96c972ef3f181e47 diff --git a/extensions/modest-dark b/extensions/modest-dark index 7e0febea65..ffc5c22165 160000 --- a/extensions/modest-dark +++ b/extensions/modest-dark @@ -1 +1 @@ -Subproject commit 7e0febea65f7ebbc4b3f0ce45adc340d7e6e8738 +Subproject commit ffc5c221651685b0d9f54c067efea090fe9c5643 diff --git a/src/lib/validation.js b/src/lib/validation.js index 9546795680..56fd7dd981 100644 --- a/src/lib/validation.js +++ b/src/lib/validation.js @@ -33,7 +33,7 @@ const SUBMODULE_LOCATION_EXCEPTIONS = ["extensions/zed"]; * @param {Record} extensionsToml */ export function validateExtensionsToml(extensionsToml) { - for (const [extensionId, _extensionInfo] of Object.entries(extensionsToml)) { + for (const [extensionId, extensionInfo] of Object.entries(extensionsToml)) { if (!EXTENSION_ID_PATTERN.test(extensionId)) { throw new Error( `Extension IDs must only consist of lowercase letters, numbers, and hyphens ('-'): "${extensionId}".`, @@ -57,6 +57,12 @@ export function validateExtensionsToml(extensionsToml) { `Extension IDs should not end with "-zed", as they are all Zed extensions: "${extensionId}".`, ); } + + if (!extensionInfo.submodule || !extensionInfo.version) { + throw new Error( + `Missing required field "submodule" or "version" for extension "${extensionId}"`, + ); + } } } diff --git a/src/lib/validation.test.js b/src/lib/validation.test.js index 94d099bc2b..cdc90ca3e8 100644 --- a/src/lib/validation.test.js +++ b/src/lib/validation.test.js @@ -44,12 +44,15 @@ describe("validateManifest", () => { }); describe("validateExtensionsToml", () => { - describe("when `extensions.toml` only contains extensions with valid IDs", () => { + describe("when `extensions.toml` only contains extensions with valid IDs and entries", () => { it.each(["my-cool-extension", "base16"])( 'does not throw for "%s"', (extensionId) => { const extensionsToml = { - [extensionId]: {}, + [extensionId]: { + submodule: "https://github.com/zed-extensions/my-extension", + version: "0.1.0", + }, }; expect(() => validateExtensionsToml(extensionsToml)).not.toThrow(); @@ -71,6 +74,34 @@ describe("validateExtensionsToml", () => { }, ); }); + + describe("when `extensions.toml` contains an entry with missing submodule", () => { + it.each(["my-cool-extension"])('does not throw for "%s"', (extensionId) => { + const extensionsToml = { + [extensionId]: { + version: "0.1.0", + }, + }; + + expect(() => validateExtensionsToml(extensionsToml)).toThrowError( + `Missing required field "submodule" or "version" for extension "${extensionId}"`, + ); + }); + }); + + describe("when `extensions.toml` contains an entry with missing version", () => { + it.each(["my-cool-extension"])('does not throw for "%s"', (extensionId) => { + const extensionsToml = { + [extensionId]: { + submodule: "https://github.com/zed-extensions/my-extension", + }, + }; + + expect(() => validateExtensionsToml(extensionsToml)).toThrowError( + `Missing required field "submodule" or "version" for extension "${extensionId}"`, + ); + }); + }); }); describe("validateGitmodules", () => {