diff --git a/package.json b/package.json index be35df296c3..50ccdc8eac7 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,6 @@ "native-watchdog": "^1.4.1", "node-pty": "1.1.0-beta5", "tas-client-umd": "0.1.8", - "util": "^0.12.4", "v8-inspect-profiler": "^0.1.0", "vscode-oniguruma": "1.7.0", "vscode-regexpp": "^3.1.0", @@ -211,6 +210,7 @@ "tsec": "0.2.7", "typescript": "^5.4.0-dev.20231116", "typescript-formatter": "7.1.0", + "util": "^0.12.4", "vscode-nls-dev": "^3.3.1", "webpack": "^5.77.0", "webpack-cli": "^5.0.1", @@ -228,4 +228,4 @@ "optionalDependencies": { "windows-foreground-love": "0.5.0" } -} \ No newline at end of file +} diff --git a/src/vs/base/node/zip.ts b/src/vs/base/node/zip.ts index cc4c65a625f..3cb7bc9795b 100644 --- a/src/vs/base/node/zip.ts +++ b/src/vs/base/node/zip.ts @@ -11,8 +11,7 @@ import * as path from 'vs/base/common/path'; import { assertIsDefined } from 'vs/base/common/types'; import { Promises } from 'vs/base/node/pfs'; import * as nls from 'vs/nls'; -import { Entry, open as _openZip, ZipFile } from 'yauzl'; -import * as yazl from 'yazl'; +import type { Entry, ZipFile } from 'yauzl'; export const CorruptZipMessage: string = 'end of central directory record signature not found'; const CORRUPT_ZIP_PATTERN = new RegExp(CorruptZipMessage); @@ -161,9 +160,11 @@ function extractZip(zipfile: ZipFile, targetPath: string, options: IOptions, tok }).finally(() => listener.dispose()); } -function openZip(zipFile: string, lazy: boolean = false): Promise { +async function openZip(zipFile: string, lazy: boolean = false): Promise { + const { open } = await import('yauzl'); + return new Promise((resolve, reject) => { - _openZip(zipFile, lazy ? { lazyEntries: true } : undefined!, (error?: Error, zipfile?: ZipFile) => { + open(zipFile, lazy ? { lazyEntries: true } : undefined!, (error?: Error, zipfile?: ZipFile) => { if (error) { reject(toExtractError(error)); } else { @@ -191,9 +192,11 @@ export interface IFile { localPath?: string; } -export function zip(zipPath: string, files: IFile[]): Promise { +export async function zip(zipPath: string, files: IFile[]): Promise { + const { ZipFile } = await import('yazl'); + return new Promise((c, e) => { - const zip = new yazl.ZipFile(); + const zip = new ZipFile(); files.forEach(f => { if (f.contents) { zip.addBuffer(typeof f.contents === 'string' ? Buffer.from(f.contents, 'utf8') : f.contents, f.path); diff --git a/src/vs/platform/keyboardLayout/electron-main/keyboardLayoutMainService.ts b/src/vs/platform/keyboardLayout/electron-main/keyboardLayoutMainService.ts index 1acbb89651c..1d17e4c709e 100644 --- a/src/vs/platform/keyboardLayout/electron-main/keyboardLayoutMainService.ts +++ b/src/vs/platform/keyboardLayout/electron-main/keyboardLayoutMainService.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as nativeKeymap from 'native-keymap'; +import type * as nativeKeymap from 'native-keymap'; import * as platform from 'vs/base/common/platform'; import { Emitter } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; diff --git a/src/vs/platform/log/node/spdlogLog.ts b/src/vs/platform/log/node/spdlogLog.ts index 4f5f1bf8a8c..11f078f941e 100644 --- a/src/vs/platform/log/node/spdlogLog.ts +++ b/src/vs/platform/log/node/spdlogLog.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as spdlog from '@vscode/spdlog'; +import type * as spdlog from '@vscode/spdlog'; import { ByteSize } from 'vs/platform/files/common/files'; import { AbstractMessageLogger, ILogger, LogLevel } from 'vs/platform/log/common/log'; diff --git a/src/vs/platform/policy/node/nativePolicyService.ts b/src/vs/platform/policy/node/nativePolicyService.ts index eae3bf8dfac..d6e3f60cdd1 100644 --- a/src/vs/platform/policy/node/nativePolicyService.ts +++ b/src/vs/platform/policy/node/nativePolicyService.ts @@ -6,7 +6,7 @@ import { AbstractPolicyService, IPolicyService, PolicyDefinition } from 'vs/platform/policy/common/policy'; import { IStringDictionary } from 'vs/base/common/collections'; import { Throttler } from 'vs/base/common/async'; -import { createWatcher, PolicyUpdate, Watcher } from '@vscode/policy-watcher'; +import type { PolicyUpdate, Watcher } from '@vscode/policy-watcher'; import { MutableDisposable } from 'vs/base/common/lifecycle'; import { ILogService } from 'vs/platform/log/common/log'; @@ -25,6 +25,8 @@ export class NativePolicyService extends AbstractPolicyService implements IPolic protected async _updatePolicyDefinitions(policyDefinitions: IStringDictionary): Promise { this.logService.trace(`NativePolicyService#_updatePolicyDefinitions - Found ${Object.keys(policyDefinitions).length} policy definitions`); + const { createWatcher } = await import('@vscode/policy-watcher'); + await this.throttler.queue(() => new Promise((c, e) => { try { this.watcher.value = createWatcher(this.productName, policyDefinitions, update => {