From 2267757c41f33fa7fcdf0ac66f82c52c107d450f Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Wed, 26 Mar 2025 19:53:02 -0700 Subject: [PATCH] apply some patches --- build/gulpfile.vscode.js | 2 +- build/lib/builtInExtensions.ts | 4 +- extensions/mangle-loader.js | 2 +- package-lock.json | 2 +- package.json | 4 +- src/main.ts | 14 ++++++ .../node/extensionManagementService.ts | 5 +-- .../electron-main/nativeHostMainService.ts | 4 +- .../browser/editSessionsStorageService.ts | 45 +------------------ 9 files changed, 25 insertions(+), 57 deletions(-) diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 99db93aced3..fbb520baedf 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -372,7 +372,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op } else if (platform === 'darwin') { const shortcut = gulp.src('resources/darwin/bin/code.sh') .pipe(replace('@@APPNAME@@', product.applicationName)) - .pipe(rename('bin/code')); + .pipe(rename('bin/' + product.applicationName)); all = es.merge(all, shortcut); } diff --git a/build/lib/builtInExtensions.ts b/build/lib/builtInExtensions.ts index e9a1180ce35..6d210d0f6a8 100644 --- a/build/lib/builtInExtensions.ts +++ b/build/lib/builtInExtensions.ts @@ -73,9 +73,7 @@ function getExtensionDownloadStream(extension: IExtensionDefinition) { if (extension.vsix) { input = ext.fromVsix(path.join(root, extension.vsix), extension); - } else if (productjson.extensionsGallery?.serviceUrl) { - input = ext.fromMarketplace(productjson.extensionsGallery.serviceUrl, extension); - } else { + } else { // Void - ext-from-gh.patch input = ext.fromGithub(extension); } diff --git a/extensions/mangle-loader.js b/extensions/mangle-loader.js index 016d0f69033..73d62576287 100644 --- a/extensions/mangle-loader.js +++ b/extensions/mangle-loader.js @@ -37,7 +37,7 @@ function getMangledFileContents(projectPath) { * @type {webpack.LoaderDefinitionFunction} */ module.exports = async function (source, sourceMap, meta) { - if (this.mode !== 'production') { + if (true) { // Void - extensions-disable-mangler // Only enable mangling in production builds return source; } diff --git a/package-lock.json b/package-lock.json index 4a4039174b9..44446c589ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -179,7 +179,7 @@ "ts-loader": "^9.5.1", "ts-node": "^10.9.2", "tsec": "0.2.7", - "tslib": "^2.6.3", + "tslib": "^2.8.1", "tsup": "^8.4.0", "typescript": "^5.8.2", "typescript-eslint": "^8.8.0", diff --git a/package.json b/package.json index d786053c542..1fb97820854 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "extensions-ci-pr": "node ./node_modules/gulp/bin/gulp.js extensions-ci-pr", "perf": "node scripts/code-perf.js", "update-build-ts-version": "npm install typescript@next && tsc -p ./build/tsconfig.build.json" - }, + }, "dependencies": { "@anthropic-ai/sdk": "^0.39.0", "@floating-ui/react": "^0.27.5", @@ -240,7 +240,7 @@ "ts-loader": "^9.5.1", "ts-node": "^10.9.2", "tsec": "0.2.7", - "tslib": "^2.6.3", + "tslib": "^2.8.1", "tsup": "^8.4.0", "typescript": "^5.8.2", "typescript-eslint": "^8.8.0", diff --git a/src/main.ts b/src/main.ts index c132c9b8b9b..64ce156d2ec 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,6 +6,7 @@ import * as path from 'path'; import * as fs from 'original-fs'; import * as os from 'os'; +import { createRequire } from 'node:module'; import { performance } from 'perf_hooks'; import { configurePortable } from './bootstrap-node.js'; import { bootstrapESM } from './bootstrap-esm.js'; @@ -22,6 +23,7 @@ import { INLSConfiguration } from './vs/nls.js'; import { NativeParsedArgs } from './vs/platform/environment/common/argv.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); perf.mark('code/didStartMain'); @@ -110,6 +112,17 @@ protocol.registerSchemesAsPrivileged([ // Global app listeners registerListeners(); +function resolveUserProduct() { + const userProductPath = path.join(userDataPath, 'product.json'); + try { + // Assign the product configuration to the global scope + const productJson = require(userProductPath); + // @ts-expect-error + globalThis._VSCODE_USER_PRODUCT_JSON = productJson; + } catch (ex) { + } +} + /** * We can resolve the NLS configuration early if it is defined * in argv.json before `app.ready` event. Otherwise we can only @@ -206,6 +219,7 @@ async function onReady() { async function startup(codeCachePath: string | undefined, nlsConfig: INLSConfiguration): Promise { process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig); process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || ''; + resolveUserProduct(); // Bootstrap ESM await bootstrapESM(); diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts index 04ed1826609..3436ea863e8 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -52,7 +52,6 @@ import { IProductService } from '../../product/common/productService.js'; import { ITelemetryService } from '../../telemetry/common/telemetry.js'; import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js'; import { IUserDataProfilesService } from '../../userDataProfile/common/userDataProfile.js'; -import { IConfigurationService } from '../../configuration/common/configuration.js'; import { isLinux } from '../../../base/common/platform.js'; export const INativeServerExtensionManagementService = refineServiceDecorator(IExtensionManagementService); @@ -85,7 +84,6 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi @IDownloadService private downloadService: IDownloadService, @IInstantiationService private readonly instantiationService: IInstantiationService, @IFileService private readonly fileService: IFileService, - @IConfigurationService private readonly configurationService: IConfigurationService, @IProductService productService: IProductService, @IAllowedExtensionsService allowedExtensionsService: IAllowedExtensionsService, @IUriIdentityService uriIdentityService: IUriIdentityService, @@ -324,8 +322,7 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi private async downloadExtension(extension: IGalleryExtension, operation: InstallOperation, verifySignature: boolean, clientTargetPlatform?: TargetPlatform): Promise<{ readonly location: URI; readonly verificationStatus: ExtensionSignatureVerificationCode | undefined }> { if (verifySignature) { - const value = this.configurationService.getValue('extensions.verifySignature'); - verifySignature = isBoolean(value) ? value : true; + verifySignature = false; // Void disable-signature-verification-patch } const { location, verificationStatus } = await this.extensionsDownloader.download(extension, operation, verifySignature, clientTargetPlatform); diff --git a/src/vs/platform/native/electron-main/nativeHostMainService.ts b/src/vs/platform/native/electron-main/nativeHostMainService.ts index c2241a9a452..f7ee99770be 100644 --- a/src/vs/platform/native/electron-main/nativeHostMainService.ts +++ b/src/vs/platform/native/electron-main/nativeHostMainService.ts @@ -404,7 +404,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain } private async getShellCommandLink(): Promise<{ readonly source: string; readonly target: string }> { - const target = resolve(this.environmentMainService.appRoot, 'bin', 'code'); + const target = resolve(this.environmentMainService.appRoot, 'bin', this.productService.applicationName); const source = `/usr/local/bin/${this.productService.applicationName}`; // Ensure source exists @@ -639,7 +639,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain // macOS if (this.environmentMainService.isBuilt) { - return join(this.environmentMainService.appRoot, 'bin', 'code'); + return join(this.environmentMainService.appRoot, 'bin', `${this.productService.applicationName}`); } return join(this.environmentMainService.appRoot, 'scripts', 'code-cli.sh'); diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.ts b/src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.ts index 1bb5eb33737..70f1b37ed53 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.ts @@ -5,7 +5,7 @@ import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js'; import { localize } from '../../../../nls.js'; -import { Action2, MenuId, MenuRegistry, registerAction2 } from '../../../../platform/actions/common/actions.js'; +import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js'; import { ContextKeyExpr, IContextKey, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js'; import { IEnvironmentService } from '../../../../platform/environment/common/environment.js'; import { IFileService } from '../../../../platform/files/common/files.js'; @@ -15,7 +15,7 @@ import { IStorageService, StorageScope, StorageTarget } from '../../../../platfo import { createSyncHeaders, IAuthenticationProvider, IResourceRefHandle } from '../../../../platform/userDataSync/common/userDataSync.js'; import { AuthenticationSession, AuthenticationSessionsChangeEvent, IAuthenticationService } from '../../../services/authentication/common/authentication.js'; import { IExtensionService } from '../../../services/extensions/common/extensions.js'; -import { EDIT_SESSIONS_SIGNED_IN, EditSession, EDIT_SESSION_SYNC_CATEGORY, IEditSessionsStorageService, EDIT_SESSIONS_SIGNED_IN_KEY, IEditSessionsLogService, SyncResource, EDIT_SESSIONS_PENDING_KEY } from '../common/editSessions.js'; +import { EDIT_SESSIONS_SIGNED_IN, EditSession, EDIT_SESSION_SYNC_CATEGORY, IEditSessionsStorageService, EDIT_SESSIONS_SIGNED_IN_KEY, IEditSessionsLogService, SyncResource } from '../common/editSessions.js'; import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js'; import { generateUuid } from '../../../../base/common/uuid.js'; import { getCurrentAuthenticationSessionInfo } from '../../../services/authentication/browser/authenticationService.js'; @@ -91,7 +91,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes // If another window changes the preferred session storage, reset our cached auth state in memory this._register(this.storageService.onDidChangeValue(StorageScope.APPLICATION, EditSessionsWorkbenchService.CACHED_SESSION_STORAGE_KEY, this._store)(() => this.onDidChangeStorage())); - this.registerSignInAction(); this.registerResetAuthenticationAction(); this.signedInContext = EDIT_SESSIONS_SIGNED_IN.bindTo(this.contextKeyService); @@ -454,46 +453,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes } } - private registerSignInAction() { - if (!this.serverConfiguration?.url) { - return; - } - const that = this; - const id = 'workbench.editSessions.actions.signIn'; - const when = ContextKeyExpr.and(ContextKeyExpr.equals(EDIT_SESSIONS_PENDING_KEY, false), ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false)); - this._register(registerAction2(class ResetEditSessionAuthenticationAction extends Action2 { - constructor() { - super({ - id, - title: localize('sign in', 'Turn on Cloud Changes...'), - category: EDIT_SESSION_SYNC_CATEGORY, - precondition: when, - menu: [{ - id: MenuId.CommandPalette, - }, - { - id: MenuId.AccountsContext, - group: '2_editSessions', - when, - }] - }); - } - - async run() { - return await that.initialize('write', false); - } - })); - - this._register(MenuRegistry.appendMenuItem(MenuId.AccountsContext, { - group: '2_editSessions', - command: { - id, - title: localize('sign in badge', 'Turn on Cloud Changes... (1)'), - }, - when: ContextKeyExpr.and(ContextKeyExpr.equals(EDIT_SESSIONS_PENDING_KEY, true), ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false)) - })); - } - private registerResetAuthenticationAction() { const that = this; this._register(registerAction2(class ResetEditSessionAuthenticationAction extends Action2 {