diff --git a/package.json b/package.json index eedb0306c48a5..12417e8061254 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "typedoc": "^0.22.11", "typedoc-plugin-external-module-map": "1.3.2", "typescript": "~4.5.5", - "uuid": "^8.0.0", "yargs": "^15.3.1" }, "scripts": { diff --git a/packages/core/package.json b/packages/core/package.json index 85c21e0f86dce..cb0b07c75e943 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -68,7 +68,6 @@ "safer-buffer": "^2.1.2", "socket.io": "^4.5.3", "socket.io-client": "^4.5.3", - "uuid": "^8.3.2", "vscode-languageserver-protocol": "^3.17.2", "vscode-uri": "^2.1.1", "ws": "^8.14.1", diff --git a/packages/core/src/browser/tooltip-service.tsx b/packages/core/src/browser/tooltip-service.tsx index 67fbc10285b56..0857960a434be 100644 --- a/packages/core/src/browser/tooltip-service.tsx +++ b/packages/core/src/browser/tooltip-service.tsx @@ -19,7 +19,7 @@ import * as React from 'react'; import ReactTooltip from 'react-tooltip'; import { ReactRenderer, RendererHost } from './widgets/react-renderer'; import { CorePreferences } from './core-preferences'; -import { v4 } from 'uuid'; +import { generateUuid } from '../common/uuid'; export const TooltipService = Symbol('TooltipService'); @@ -59,7 +59,7 @@ export class TooltipServiceImpl extends ReactRenderer implements TooltipService @inject(RendererHost) @optional() host?: RendererHost ) { super(host); - this.tooltipId = v4(); + this.tooltipId = generateUuid(); } @postConstruct() diff --git a/packages/core/src/common/index.ts b/packages/core/src/common/index.ts index a3f5aeb125e57..ada952513f326 100644 --- a/packages/core/src/common/index.ts +++ b/packages/core/src/common/index.ts @@ -46,5 +46,6 @@ export * from './strings'; export * from './telemetry'; export * from './types'; export { default as URI } from './uri'; +export * from './uuid'; export * from './view-column'; export * from './version'; diff --git a/packages/core/src/electron-main/electron-main-application-module.ts b/packages/core/src/electron-main/electron-main-application-module.ts index 0148dbc6fd77c..a512efb722012 100644 --- a/packages/core/src/electron-main/electron-main-application-module.ts +++ b/packages/core/src/electron-main/electron-main-application-module.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { ContainerModule } from 'inversify'; -import { v4 } from 'uuid'; +import { generateUuid } from '../common/uuid'; import { bindContributionProvider } from '../common/contribution-provider'; import { RpcConnectionHandler } from '../common/messaging/proxy-factory'; import { ElectronSecurityToken } from '../electron-common/electron-token'; @@ -29,7 +29,7 @@ import { ElectronSecurityTokenService } from './electron-security-token-service' import { ElectronMessagingService } from './messaging/electron-messaging-service'; import { ElectronConnectionHandler } from './messaging/electron-connection-handler'; -const electronSecurityToken: ElectronSecurityToken = { value: v4() }; +const electronSecurityToken: ElectronSecurityToken = { value: generateUuid() }; // eslint-disable-next-line @typescript-eslint/no-explicit-any (global as any)[ElectronSecurityToken] = electronSecurityToken; diff --git a/packages/filesystem/package.json b/packages/filesystem/package.json index a1517d8fe786f..801d55f964411 100644 --- a/packages/filesystem/package.json +++ b/packages/filesystem/package.json @@ -18,7 +18,6 @@ "stat-mode": "^1.0.0", "tar-fs": "^1.16.2", "trash": "^7.2.0", - "uuid": "^8.0.0", "vscode-languageserver-textdocument": "^1.0.1" }, "publishConfig": { diff --git a/packages/filesystem/src/node/disk-file-system-provider.spec.ts b/packages/filesystem/src/node/disk-file-system-provider.spec.ts index ed0011db27e92..3cae7221a59a8 100644 --- a/packages/filesystem/src/node/disk-file-system-provider.spec.ts +++ b/packages/filesystem/src/node/disk-file-system-provider.spec.ts @@ -25,7 +25,7 @@ import { equal, fail } from 'assert'; import { promises as fs } from 'fs'; import { join } from 'path'; import * as temp from 'temp'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { FilePermission, FileSystemProviderError, FileSystemProviderErrorCode } from '../common/files'; import { DiskFileSystemProvider } from './disk-file-system-provider'; import { bindFileSystemWatcherServer } from './filesystem-backend-module'; @@ -53,7 +53,7 @@ describe('disk-file-system-provider', () => { describe('stat', () => { it("should omit the 'permissions' property of the stat if the file can be both read and write", async () => { const tempDirPath = tracked.mkdirSync(); - const tempFilePath = join(tempDirPath, `${v4()}.txt`); + const tempFilePath = join(tempDirPath, `${generateUuid()}.txt`); await fs.writeFile(tempFilePath, 'some content', { encoding: 'utf8' }); let content = await fs.readFile(tempFilePath, { encoding: 'utf8' }); @@ -70,7 +70,7 @@ describe('disk-file-system-provider', () => { it("should set the 'permissions' property to `Readonly` if the file can be read but not write", async () => { const tempDirPath = tracked.mkdirSync(); - const tempFilePath = join(tempDirPath, `${v4()}.txt`); + const tempFilePath = join(tempDirPath, `${generateUuid()}.txt`); await fs.writeFile(tempFilePath, 'readonly content', { encoding: 'utf8', }); diff --git a/packages/filesystem/src/node/disk-file-system-provider.ts b/packages/filesystem/src/node/disk-file-system-provider.ts index b5bdf2234934c..20ad3c09adc0e 100644 --- a/packages/filesystem/src/node/disk-file-system-provider.ts +++ b/packages/filesystem/src/node/disk-file-system-provider.ts @@ -24,7 +24,7 @@ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify'; import { basename, dirname, normalize, join } from 'path'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import * as os from 'os'; import * as fs from 'fs'; import { @@ -525,7 +525,7 @@ export class DiskFileSystemProvider implements Disposable, protected async rimrafMove(path: string): Promise { try { - const pathInTemp = join(os.tmpdir(), v4()); + const pathInTemp = join(os.tmpdir(), generateUuid()); try { await promisify(rename)(path, pathInTemp); } catch (error) { diff --git a/packages/filesystem/src/node/download/file-download-handler.ts b/packages/filesystem/src/node/download/file-download-handler.ts index f1ae5e478c366..d089eb7d0d82f 100644 --- a/packages/filesystem/src/node/download/file-download-handler.ts +++ b/packages/filesystem/src/node/download/file-download-handler.ts @@ -17,7 +17,7 @@ import * as os from 'os'; import * as fs from '@theia/core/shared/fs-extra'; import * as path from 'path'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { Request, Response } from '@theia/core/shared/express'; import { inject, injectable } from '@theia/core/shared/inversify'; import { OK, BAD_REQUEST, METHOD_NOT_ALLOWED, NOT_FOUND, INTERNAL_SERVER_ERROR, REQUESTED_RANGE_NOT_SATISFIABLE, PARTIAL_CONTENT } from 'http-status-codes'; @@ -135,12 +135,12 @@ export abstract class FileDownloadHandler { end: (isNaN(end) || end > statSize - 1) ? (statSize - 1) : end }; } - protected async archive(inputPath: string, outputPath: string = path.join(os.tmpdir(), v4()), entries?: string[]): Promise { + protected async archive(inputPath: string, outputPath: string = path.join(os.tmpdir(), generateUuid()), entries?: string[]): Promise { await this.directoryArchiver.archive(inputPath, outputPath, entries); return outputPath; } - protected async createTempDir(downloadId: string = v4()): Promise { + protected async createTempDir(downloadId: string = generateUuid()): Promise { const outputPath = path.join(os.tmpdir(), downloadId); await fs.mkdir(outputPath); return outputPath; @@ -221,7 +221,7 @@ export class SingleFileDownloadHandler extends FileDownloadHandler { return; } try { - const downloadId = v4(); + const downloadId = generateUuid(); const options: PrepareDownloadOptions = { filePath, downloadId, remove: false }; if (!stat.isDirectory()) { await this.prepareDownload(request, response, options); @@ -271,7 +271,7 @@ export class MultiFileDownloadHandler extends FileDownloadHandler { } } try { - const downloadId = v4(); + const downloadId = generateUuid(); const outputRootPath = await this.createTempDir(downloadId); const distinctUris = Array.from(new Set(body.uris.map(uri => new URI(uri)))); const tarPaths = []; diff --git a/packages/mini-browser/package.json b/packages/mini-browser/package.json index 3dae7d419dca5..b8260edc05cff 100644 --- a/packages/mini-browser/package.json +++ b/packages/mini-browser/package.json @@ -8,7 +8,6 @@ "@types/mime-types": "^2.1.0", "mime-types": "^2.1.18", "pdfobject": "^2.0.201604172", - "uuid": "^8.0.0", "vhost": "^3.0.2" }, "publishConfig": { diff --git a/packages/mini-browser/src/browser/environment/mini-browser-environment.ts b/packages/mini-browser/src/browser/environment/mini-browser-environment.ts index f5253f43708d6..b13b910d5638d 100644 --- a/packages/mini-browser/src/browser/environment/mini-browser-environment.ts +++ b/packages/mini-browser/src/browser/environment/mini-browser-environment.ts @@ -18,7 +18,7 @@ import { Endpoint, FrontendApplicationContribution } from '@theia/core/lib/brows import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; import { environment } from '@theia/core/shared/@theia/application-package/lib/environment'; import { inject, injectable, postConstruct } from '@theia/core/shared/inversify'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { MiniBrowserEndpoint } from '../../common/mini-browser-endpoint'; /** @@ -71,7 +71,7 @@ export class MiniBrowserEnvironment implements FrontendApplicationContribution { * Throws if `hostPatternPromise` is not yet resolved. */ getRandomEndpoint(): Endpoint { - return this.getEndpoint(v4()); + return this.getEndpoint(generateUuid()); } protected async getHostPattern(): Promise { diff --git a/packages/notebook/package.json b/packages/notebook/package.json index 5578169830a78..64616b31d72aa 100644 --- a/packages/notebook/package.json +++ b/packages/notebook/package.json @@ -6,8 +6,7 @@ "@theia/core": "1.45.0", "@theia/editor": "1.45.0", "@theia/filesystem": "1.45.0", - "@theia/monaco": "1.45.0", - "uuid": "^8.3.2" + "@theia/monaco": "1.45.0" }, "publishConfig": { "access": "public" diff --git a/packages/notebook/src/browser/service/notebook-execution-state-service.ts b/packages/notebook/src/browser/service/notebook-execution-state-service.ts index 3512293d78b4b..5ac7645373be9 100644 --- a/packages/notebook/src/browser/service/notebook-execution-state-service.ts +++ b/packages/notebook/src/browser/service/notebook-execution-state-service.ts @@ -18,7 +18,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Disposable, DisposableCollection, Emitter, URI } from '@theia/core'; +import { Disposable, DisposableCollection, Emitter, URI, generateUuid } from '@theia/core'; import { inject, injectable } from '@theia/core/shared/inversify'; import { NotebookService } from './notebook-service'; import { @@ -27,7 +27,6 @@ import { } from '../../common'; import { CellPartialInternalMetadataEditByHandle, CellEditOperation } from '../notebook-types'; import { NotebookModel } from '../view-model/notebook-model'; -import { v4 } from 'uuid'; export type CellExecuteUpdate = CellExecuteOutputEdit | CellExecuteOutputItemEdit | CellExecutionStateUpdate; @@ -178,7 +177,7 @@ export class CellExecution implements Disposable { editType: CellEditType.PartialInternalMetadata, handle: this.cellHandle, internalMetadata: { - executionId: v4(), + executionId: generateUuid(), runStartTime: undefined, runEndTime: undefined, lastRunSuccess: undefined, diff --git a/packages/plugin-ext/package.json b/packages/plugin-ext/package.json index 2a069d8489e48..c3a6b7e152e70 100644 --- a/packages/plugin-ext/package.json +++ b/packages/plugin-ext/package.json @@ -46,7 +46,6 @@ "mime": "^2.4.4", "ps-tree": "^1.2.0", "semver": "^7.5.4", - "uuid": "^8.0.0", "vhost": "^3.0.2", "vscode-textmate": "^9.0.0" }, diff --git a/packages/plugin-ext/src/main/browser/comments/comments-main.ts b/packages/plugin-ext/src/main/browser/comments/comments-main.ts index 4aab5f5d45914..c4e6051be9764 100644 --- a/packages/plugin-ext/src/main/browser/comments/comments-main.ts +++ b/packages/plugin-ext/src/main/browser/comments/comments-main.ts @@ -38,7 +38,7 @@ import { URI } from '@theia/core/shared/vscode-uri'; import { CancellationToken } from '@theia/core/lib/common'; import { RPCProtocol } from '../../../common/rpc-protocol'; import { interfaces } from '@theia/core/shared/inversify'; -import { v4 as uuidv4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { CommentsContribution } from './comments-contribution'; /*--------------------------------------------------------------------------------------------- @@ -392,7 +392,7 @@ export class CommentsMainImp implements CommentsMain { } $registerCommentController(handle: number, id: string, label: string): void { - const providerId = uuidv4(); + const providerId = generateUuid(); this.handlers.set(handle, providerId); const provider = new CommentController(this.proxy, this.commentService, handle, providerId, id, label, {}); diff --git a/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-opener.tsx b/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-opener.tsx index 245ab57cb1e29..838c3ad08b162 100644 --- a/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-opener.tsx +++ b/packages/plugin-ext/src/main/browser/custom-editors/custom-editor-opener.tsx @@ -19,7 +19,7 @@ import URI from '@theia/core/lib/common/uri'; import { ApplicationShell, OpenHandler, Widget, WidgetManager, WidgetOpenerOptions } from '@theia/core/lib/browser'; import { CustomEditor, CustomEditorPriority, CustomEditorSelector } from '../../../common'; import { CustomEditorWidget } from './custom-editor-widget'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { Emitter } from '@theia/core'; import { match } from '@theia/core/lib/common/glob'; @@ -77,7 +77,7 @@ export class CustomEditorOpener implements OpenHandler { const uriString = uri.toString(); let widgetPromise = this.pendingWidgetPromises.get(uriString); if (!widgetPromise) { - const id = v4(); + const id = generateUuid(); widgetPromise = this.widgetManager.getOrCreateWidget(CustomEditorWidget.FACTORY_ID, { id }); this.pendingWidgetPromises.set(uriString, widgetPromise); widget = await widgetPromise; diff --git a/packages/plugin-ext/src/main/browser/notebooks/renderers/cell-output-webview.tsx b/packages/plugin-ext/src/main/browser/notebooks/renderers/cell-output-webview.tsx index fbd832304adcb..1310db10d438c 100644 --- a/packages/plugin-ext/src/main/browser/notebooks/renderers/cell-output-webview.tsx +++ b/packages/plugin-ext/src/main/browser/notebooks/renderers/cell-output-webview.tsx @@ -21,7 +21,7 @@ import * as React from '@theia/core/shared/react'; import { inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify'; import { NotebookRendererMessagingService, CellOutputWebview, NotebookRendererRegistry, NotebookEditorWidgetService, NotebookCellOutputsSplice } from '@theia/notebook/lib/browser'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { NotebookCellModel } from '@theia/notebook/lib/browser/view-model/notebook-cell-model'; import { WebviewWidget } from '../../webview/webview'; import { Message, WidgetManager } from '@theia/core/lib/browser'; @@ -65,7 +65,7 @@ export class CellOutputWebviewImpl implements CellOutputWebview, Disposable { @inject(QuickPickService) protected readonly quickPickService: QuickPickService; - readonly id = v4(); + readonly id = generateUuid(); protected readonly elementRef = React.createRef(); protected outputPresentationListeners: DisposableCollection = new DisposableCollection(); diff --git a/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts b/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts index 03312edd5803f..ece6eb5c70df8 100644 --- a/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts +++ b/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts @@ -44,7 +44,7 @@ import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/platform/theme/commo import { WebviewView, WebviewViewResolver } from '../webview-views/webview-views'; import { WebviewWidget, WebviewWidgetIdentifier } from '../webview/webview'; import { CancellationToken } from '@theia/core/lib/common/cancellation'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { nls } from '@theia/core'; import { TheiaDockPanel } from '@theia/core/lib/browser/shell/theia-dock-panel'; import { Deferred } from '@theia/core/lib/common/promise-util'; @@ -425,7 +425,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution { protected async createNewWebviewView(viewId: string): Promise { const webview = await this.widgetManager.getOrCreateWidget( WebviewWidget.FACTORY_ID, { - id: v4(), + id: generateUuid(), viewId, }); webview.setContentOptions({ allowScripts: true }); diff --git a/packages/plugin-ext/src/main/browser/webview/webview-widget-factory.ts b/packages/plugin-ext/src/main/browser/webview/webview-widget-factory.ts index aec77f37c448e..707034b33d2f9 100644 --- a/packages/plugin-ext/src/main/browser/webview/webview-widget-factory.ts +++ b/packages/plugin-ext/src/main/browser/webview/webview-widget-factory.ts @@ -18,7 +18,7 @@ import { interfaces } from '@theia/core/shared/inversify'; import { WebviewWidget, WebviewWidgetIdentifier, WebviewWidgetExternalEndpoint } from './webview'; import { WebviewEnvironment } from './webview-environment'; import { StorageService } from '@theia/core/lib/browser'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; export class WebviewWidgetFactory { @@ -46,7 +46,7 @@ export class WebviewWidgetFactory { const key = 'plugin-view-registry.origin.' + viewId; const origin = await storageService.getData(key); if (!origin) { - const newOrigin = v4(); + const newOrigin = generateUuid(); storageService.setData(key, newOrigin); return newOrigin; } else { diff --git a/packages/plugin-ext/src/main/node/errors.spec.ts b/packages/plugin-ext/src/main/node/errors.spec.ts index 56a20052ba287..b013492a91296 100644 --- a/packages/plugin-ext/src/main/node/errors.spec.ts +++ b/packages/plugin-ext/src/main/node/errors.spec.ts @@ -17,13 +17,13 @@ import { rejects } from 'assert'; import { strictEqual } from 'assert/strict'; import { promises as fs } from 'fs'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { isENOENT } from '../../common/errors'; describe('errors', () => { describe('errno-exception', () => { it('should be ENOENT error', async () => { - await rejects(fs.readFile(v4()), reason => isENOENT(reason)); + await rejects(fs.readFile(generateUuid()), reason => isENOENT(reason)); }); it('should not be ENOENT error (no code)', () => { diff --git a/packages/plugin-ext/src/plugin/debug/debug-ext.ts b/packages/plugin-ext/src/plugin/debug/debug-ext.ts index bc896a9be928a..0ee13538b8a8f 100644 --- a/packages/plugin-ext/src/plugin/debug/debug-ext.ts +++ b/packages/plugin-ext/src/plugin/debug/debug-ext.ts @@ -27,7 +27,7 @@ import { DEBUG_SCHEME, SCHEME_PATTERN } from '@theia/debug/lib/common/debug-uri- import { Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range, URI as URIImpl } from '../types-impl'; import { PluginDebugAdapterSession } from './plugin-debug-adapter-session'; import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker'; -import uuid = require('uuid'); +import { generateUuid } from '@theia/core/lib/common/uuid'; import { DebugAdapter } from '@theia/debug/lib/common/debug-model'; import { PluginDebugAdapterCreator } from './plugin-debug-adapter-creator'; import { NodeDebugAdapterCreator } from '../node/debug/plugin-node-debug-adapter-creator'; @@ -336,7 +336,7 @@ export class DebugExtImpl implements DebugExt { } async $createDebugSession(debugConfiguration: DebugConfiguration, workspaceFolderUri: string | undefined): Promise { - const sessionId = uuid.v4(); + const sessionId = generateUuid(); const parentSession = debugConfiguration.parentSessionId ? this.sessions.get(debugConfiguration.parentSessionId) : undefined; const theiaSession: theia.DebugSession = { diff --git a/packages/plugin-ext/src/plugin/env.ts b/packages/plugin-ext/src/plugin/env.ts index 8fe8494a49c47..824588fd7f0b4 100644 --- a/packages/plugin-ext/src/plugin/env.ts +++ b/packages/plugin-ext/src/plugin/env.ts @@ -18,7 +18,7 @@ import * as theia from '@theia/plugin'; import { RPCProtocol } from '../common/rpc-protocol'; import { EnvMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc'; import { QueryParameters } from '../common/env'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; export abstract class EnvExtImpl { private proxy: EnvMain; @@ -33,8 +33,8 @@ export abstract class EnvExtImpl { constructor(rpc: RPCProtocol) { this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.ENV_MAIN); - this.envSessionId = v4(); - this.envMachineId = v4(); + this.envSessionId = generateUuid(); + this.envMachineId = generateUuid(); this._remoteName = undefined; } diff --git a/packages/plugin-ext/src/plugin/languages/diagnostics.ts b/packages/plugin-ext/src/plugin/languages/diagnostics.ts index ea74544b09ea2..5710b5bf804e6 100644 --- a/packages/plugin-ext/src/plugin/languages/diagnostics.ts +++ b/packages/plugin-ext/src/plugin/languages/diagnostics.ts @@ -22,7 +22,7 @@ import { MarkerData } from '../../common/plugin-api-rpc-model'; import { RPCProtocol } from '../../common/rpc-protocol'; import { PLUGIN_RPC_CONTEXT, LanguagesMain } from '../../common/plugin-api-rpc'; import { URI } from '@theia/core/shared/vscode-uri'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; export class DiagnosticCollection implements theia.DiagnosticCollection { private static DIAGNOSTICS_PRIORITY = [ @@ -288,7 +288,7 @@ export class Diagnostics { } private getNextId(): string { - return v4(); + return generateUuid(); } private getAllDiagnosticsForResource(uri: URI): theia.Diagnostic[] { diff --git a/packages/plugin-ext/src/plugin/node/env-node-ext.ts b/packages/plugin-ext/src/plugin/node/env-node-ext.ts index 65924f11b95e6..90abaef431d3b 100644 --- a/packages/plugin-ext/src/plugin/node/env-node-ext.ts +++ b/packages/plugin-ext/src/plugin/node/env-node-ext.ts @@ -18,7 +18,7 @@ import * as mac from 'macaddress'; import { EnvExtImpl } from '../env'; import { RPCProtocol } from '../../common/rpc-protocol'; import { createHash } from 'crypto'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import fs = require('fs'); /** @@ -34,7 +34,7 @@ export class EnvNodeExtImpl extends EnvExtImpl { super(rpc); mac.one((err, macAddress) => { if (err) { - this.macMachineId = v4(); + this.macMachineId = generateUuid(); } else { this.macMachineId = createHash('sha256').update(macAddress, 'utf8').digest('hex'); } diff --git a/packages/plugin-ext/src/plugin/preference-registry.ts b/packages/plugin-ext/src/plugin/preference-registry.ts index 465c7122ec4af..04dbdd0a8f381 100644 --- a/packages/plugin-ext/src/plugin/preference-registry.ts +++ b/packages/plugin-ext/src/plugin/preference-registry.ts @@ -24,7 +24,7 @@ import { IConfigurationOverrides } from '@theia/monaco-editor-core/esm/vs/platfo import { Configuration, ConfigurationModel, ConfigurationModelParser } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configurationModels'; import { Workspace, WorkspaceFolder } from '@theia/monaco-editor-core/esm/vs/platform/workspace/common/workspace'; import * as theia from '@theia/plugin'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { PLUGIN_RPC_CONTEXT, PreferenceChangeExt, PreferenceData, PreferenceRegistryExt, PreferenceRegistryMain @@ -74,7 +74,7 @@ function lookUp(tree: any, key: string): any { export class TheiaWorkspace extends Workspace { constructor(ext: WorkspaceExtImpl) { const folders = (ext.workspaceFolders ?? []).map(folder => new WorkspaceFolder(folder)); - super(v4(), folders, false, ext.workspaceFile ?? null, () => isOSX || isWindows); + super(generateUuid(), folders, false, ext.workspaceFile ?? null, () => isOSX || isWindows); } } diff --git a/packages/plugin-ext/src/plugin/tests.ts b/packages/plugin-ext/src/plugin/tests.ts index 9f1083651123b..48106408d3d47 100644 --- a/packages/plugin-ext/src/plugin/tests.ts +++ b/packages/plugin-ext/src/plugin/tests.ts @@ -34,7 +34,7 @@ import { isDefined } from '@theia/core/lib/common/types'; import { TestingExt, PLUGIN_RPC_CONTEXT, TestingMain } from '../common/plugin-api-rpc'; import { CommandRegistryImpl } from './command-registry'; import { RPCProtocol } from '../common/rpc-protocol'; -import { v4 as uuidv4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import * as Convert from './type-converters'; import { TestItemImpl, TestItemCollection } from './test-item'; import { AccumulatingTreeDeltaEmitter, TreeDelta } from '@theia/test/lib/common/tree-delta'; @@ -257,7 +257,7 @@ class TestRun implements theia.TestRun { readonly name: string, readonly isPersisted: boolean, isRunning: boolean) { - this.id = uuidv4(); + this.id = generateUuid(); this.tokenSource = new CancellationTokenSource(); this.token = this.tokenSource.token; diff --git a/packages/plugin-ext/src/plugin/webviews.ts b/packages/plugin-ext/src/plugin/webviews.ts index c107ced1af6be..20a715a7e9ede 100644 --- a/packages/plugin-ext/src/plugin/webviews.ts +++ b/packages/plugin-ext/src/plugin/webviews.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import { Plugin, WebviewsExt, WebviewPanelViewState, WebviewsMain, PLUGIN_RPC_CONTEXT, WebviewInitData, /* WebviewsMain, PLUGIN_RPC_CONTEXT */ } from '../common/plugin-api-rpc'; import * as theia from '@theia/plugin'; import { RPCProtocol } from '../common/rpc-protocol'; @@ -111,7 +111,7 @@ export class WebviewsExtImpl implements WebviewsExt { options: theia.WebviewPanelOptions & theia.WebviewOptions, plugin: Plugin ): theia.WebviewPanel { - const viewId = v4(); + const viewId = generateUuid(); const webviewShowOptions = toWebviewPanelShowOptions(showOptions); const webviewOptions = WebviewImpl.toWebviewOptions(options, this.workspace, plugin); this.proxy.$createWebviewPanel(viewId, viewType, title, webviewShowOptions, webviewOptions); diff --git a/packages/remote/package.json b/packages/remote/package.json index 5262012b76e1d..1d6f70bc41359 100644 --- a/packages/remote/package.json +++ b/packages/remote/package.json @@ -15,8 +15,7 @@ "ssh2": "^1.12.0", "ssh2-sftp-client": "^9.1.0", "socket.io": "^4.5.3", - "socket.io-client": "^4.5.3", - "uuid": "^8.0.0" + "socket.io-client": "^4.5.3" }, "publishConfig": { "access": "public" diff --git a/packages/remote/src/electron-node/ssh/remote-ssh-connection-provider.ts b/packages/remote/src/electron-node/ssh/remote-ssh-connection-provider.ts index 2f942de3c9a0f..a79fb508e1dd7 100644 --- a/packages/remote/src/electron-node/ssh/remote-ssh-connection-provider.ts +++ b/packages/remote/src/electron-node/ssh/remote-ssh-connection-provider.ts @@ -27,7 +27,7 @@ import { RemoteConnection, RemoteExecOptions, RemoteExecResult, RemoteExecTester import { Deferred, timeout } from '@theia/core/lib/common/promise-util'; import { SSHIdentityFileCollector, SSHKey } from './ssh-identity-file-collector'; import { RemoteSetupService } from '../setup/remote-setup-service'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; @injectable() export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvider { @@ -91,7 +91,7 @@ export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvi .on('ready', async () => { const connection = new RemoteSSHConnection({ client: sshClient, - id: v4(), + id: generateUuid(), name: host, type: 'SSH' }); diff --git a/packages/typehierarchy/package.json b/packages/typehierarchy/package.json index 6c3d008f01805..67c9f252087c8 100644 --- a/packages/typehierarchy/package.json +++ b/packages/typehierarchy/package.json @@ -5,8 +5,7 @@ "dependencies": { "@theia/core": "1.45.0", "@theia/editor": "1.45.0", - "@types/uuid": "^7.0.3", - "uuid": "^8.0.0" + "@types/uuid": "^7.0.3" }, "publishConfig": { "access": "public" diff --git a/packages/typehierarchy/src/browser/tree/typehierarchy-tree.ts b/packages/typehierarchy/src/browser/tree/typehierarchy-tree.ts index 517fe17ebc3e4..65aaaa016e965 100644 --- a/packages/typehierarchy/src/browser/tree/typehierarchy-tree.ts +++ b/packages/typehierarchy/src/browser/tree/typehierarchy-tree.ts @@ -17,7 +17,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { injectable } from '@theia/core/shared/inversify'; -import { v4 } from 'uuid'; +import { generateUuid } from '@theia/core/lib/common/uuid'; import URI from '@theia/core/lib/common/uri'; import { Location } from '@theia/editor/lib/browser/editor'; import { TreeDecoration, DecoratedTreeNode } from '@theia/core/lib/browser/tree/tree-decorator'; @@ -134,7 +134,7 @@ export namespace TypeHierarchyTree { resolved = true; } const node = { - id: v4(), + id: generateUuid(), name: item.name, description: item.detail, parent: undefined, diff --git a/packages/vsx-registry/package.json b/packages/vsx-registry/package.json index 056e3447357b4..d3f379c9a83a7 100644 --- a/packages/vsx-registry/package.json +++ b/packages/vsx-registry/package.json @@ -12,8 +12,7 @@ "@theia/workspace": "1.45.0", "luxon": "^2.4.0", "p-debounce": "^2.1.0", - "semver": "^7.5.4", - "uuid": "^8.0.0" + "semver": "^7.5.4" }, "publishConfig": { "access": "public" diff --git a/yarn.lock b/yarn.lock index 4a9da1bdbf274..e26b6e9a9ca10 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11543,7 +11543,7 @@ uuid@^7.0.3: resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== -uuid@^8.0.0, uuid@^8.3.2: +uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==