( folder: string, manifest: Record<string, unknown>, )
| 130 | } |
| 131 | |
| 132 | async function validateInstallPackage( |
| 133 | folder: string, |
| 134 | manifest: Record<string, unknown>, |
| 135 | ): Promise<void> { |
| 136 | const installation = manifest.installation as |
| 137 | | { |
| 138 | downloadUrl?: unknown; |
| 139 | size?: unknown; |
| 140 | checksum?: unknown; |
| 141 | platformArch?: unknown; |
| 142 | } |
| 143 | | undefined; |
| 144 | const requiresPackage = |
| 145 | getContributionArray(manifest, "databases").length > 0 || |
| 146 | getContributionArray(manifest, "themes").length > 0 || |
| 147 | getContributionArray(manifest, "icons").length > 0; |
| 148 | |
| 149 | if (!requiresPackage) return; |
| 150 | |
| 151 | if (!installation) { |
| 152 | error(folder, "Installable extension missing 'installation' metadata"); |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | await validatePackageEntry(folder, "Installation metadata", installation); |
| 157 | |
| 158 | if (installation.platformArch === undefined) return; |
| 159 | |
| 160 | if ( |
| 161 | typeof installation.platformArch !== "object" || |
| 162 | installation.platformArch === null || |
| 163 | Array.isArray(installation.platformArch) |
| 164 | ) { |
| 165 | error(folder, "Installation metadata 'platformArch' must be an object"); |
| 166 | return; |
| 167 | } |
| 168 | |
| 169 | for (const [platformArch, packageEntry] of Object.entries(installation.platformArch)) { |
| 170 | if (typeof packageEntry !== "object" || packageEntry === null || Array.isArray(packageEntry)) { |
| 171 | error(folder, `Installation package for ${platformArch} must be an object`); |
| 172 | continue; |
| 173 | } |
| 174 | |
| 175 | await validatePackageEntry( |
| 176 | folder, |
| 177 | `Installation package for ${platformArch}`, |
| 178 | packageEntry as { |
| 179 | downloadUrl?: unknown; |
| 180 | size?: unknown; |
| 181 | checksum?: unknown; |
| 182 | }, |
| 183 | ); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | function validateLanguageToolConfig(folder: string, label: string, toolConfig: unknown): void { |
| 188 | if (!toolConfig || typeof toolConfig !== "object" || Array.isArray(toolConfig)) { |
no test coverage detected