Small cleanups

This commit is contained in:
Matt Bierner
2025-11-21 22:28:34 -08:00
parent ac71e4f6ad
commit 2352f5be67
5 changed files with 20 additions and 10 deletions

View File

@@ -279,7 +279,12 @@ export const monacoTypecheckWatchTask = task.define('monaco-typecheck-watch', cr
export const monacoTypecheckTask = task.define('monaco-typecheck', createTscCompileTask(false));
//#endregion
/**
* Sets a field on an object only if it's not already set, otherwise throws an error
* @param obj The object to modify
* @param field The field name to set
* @param value The value to set
*/
function setUnsetField(obj: Record<string, unknown>, field: string, value: unknown) {
if (obj[field] !== undefined) {
throw new Error(`Field "${field}" is already set (but was expected to not be).`);

View File

@@ -289,10 +289,11 @@ function packageTask(type: string, platform: string, arch: string, sourceFolderN
return !isUIExtension(manifest);
}).map((extensionPath) => path.basename(path.dirname(extensionPath)))
.filter(name => name !== 'vscode-api-tests' && name !== 'vscode-test-resolver'); // Do not ship the test extensions
const marketplaceExtensions = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'product.json'), 'utf8')).builtInExtensions
.filter((entry: { platforms?: string[]; clientOnly?: boolean }) => !entry.platforms || new Set(entry.platforms).has(platform))
.filter((entry: { clientOnly?: boolean }) => !entry.clientOnly)
.map((entry: { name: string }) => entry.name);
const builtInExtensions: Array<{ name: string; platforms?: string[]; clientOnly?: boolean }> = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, 'product.json'), 'utf8')).builtInExtensions;
const marketplaceExtensions = builtInExtensions
.filter(entry => !entry.platforms || new Set(entry.platforms).has(platform))
.filter(entry => !entry.clientOnly)
.map(entry => entry.name);
const extensionPaths = [...localWorkspaceExtensions, ...marketplaceExtensions]
.map(name => `.build/extensions/${name}/**`);

View File

@@ -1,8 +1,12 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module '@vscode/gulp-electron' {
interface MainFunction {
(options: any): NodeJS.ReadWriteStream;
dest(destination: string, options: any): NodeJS.ReadWriteStream;
}

View File

@@ -6,9 +6,6 @@
declare module 'gulp-untar' {
import type { Transform } from 'stream';
/**
* Extract TAR files
*/
function untar(): Transform;
export = untar;

View File

@@ -1,5 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'rcedit' {
export default function rcedit(exePath, options, cb): Promise<void>;
}