From a4a94159725f4479f7f0e1feab789a0b4a838e06 Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Mon, 11 Nov 2024 17:33:17 +0100 Subject: [PATCH 1/4] Prepare Theia for Inversify 6.1.0 --- .../src/common/vsx/sample-ovsx-client-factory.ts | 4 ++-- packages/ai-chat/src/common/chat-agents.ts | 16 ++++++++-------- .../src/browser/bulk-edit-contribution.ts | 13 ++++++++++--- .../core/src/browser/shell/view-contribution.ts | 4 ++-- .../core/src/common/performance/stopwatch.ts | 4 ++-- .../browser/memory-inspector-frontend-module.ts | 2 +- .../src/browser/memory-widget/memory-widget.ts | 2 +- .../src/hosted/node/scanners/scanner-theia.ts | 7 +++++-- .../src/common/vsx-registry-common-module.ts | 4 ++-- 9 files changed, 33 insertions(+), 23 deletions(-) diff --git a/examples/api-samples/src/common/vsx/sample-ovsx-client-factory.ts b/examples/api-samples/src/common/vsx/sample-ovsx-client-factory.ts index 257cd1e46e939..d5241bef6c98d 100644 --- a/examples/api-samples/src/common/vsx/sample-ovsx-client-factory.ts +++ b/examples/api-samples/src/common/vsx/sample-ovsx-client-factory.ts @@ -22,9 +22,9 @@ export function rebindOVSXClientFactory(rebind: interfaces.Rebind): void { // rebind the OVSX client factory so that we can replace patterns like "${self}" in the configs: rebind(OVSXUrlResolver) .toDynamicValue(ctx => { - const appInfo = ctx.container.get(SampleAppInfo); + const appInfo = ctx.container.get(SampleAppInfo); const selfOrigin = appInfo.getSelfOrigin(); - return async url => url.replace('${self}', await selfOrigin); + return async (url: string) => url.replace('${self}', await selfOrigin); }) .inSingletonScope(); } diff --git a/packages/ai-chat/src/common/chat-agents.ts b/packages/ai-chat/src/common/chat-agents.ts index 0af01f90a8e6b..f5b9f1e735e99 100644 --- a/packages/ai-chat/src/common/chat-agents.ts +++ b/packages/ai-chat/src/common/chat-agents.ts @@ -39,7 +39,7 @@ import { MessageActor, } from '@theia/ai-core/lib/common'; import { CancellationToken, CancellationTokenSource, ContributionProvider, ILogger, isArray } from '@theia/core'; -import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify'; +import { inject, injectable, named, postConstruct, unmanaged } from '@theia/core/shared/inversify'; import { ChatAgentService } from './chat-agent-service'; import { ChatModel, @@ -133,13 +133,13 @@ export abstract class AbstractChatAgent { protected defaultContentFactory: DefaultResponseContentFactory; constructor( - public id: string, - public languageModelRequirements: LanguageModelRequirement[], - protected defaultLanguageModelPurpose: string, - public iconClass: string = 'codicon codicon-copilot', - public locations: ChatAgentLocation[] = ChatAgentLocation.ALL, - public tags: string[] = ['Chat'], - public defaultLogging: boolean = true) { + @unmanaged() public id: string, + @unmanaged() public languageModelRequirements: LanguageModelRequirement[], + @unmanaged() protected defaultLanguageModelPurpose: string, + @unmanaged() public iconClass: string = 'codicon codicon-copilot', + @unmanaged() public locations: ChatAgentLocation[] = ChatAgentLocation.ALL, + @unmanaged() public tags: string[] = ['Chat'], + @unmanaged() public defaultLogging: boolean = true) { } @postConstruct() diff --git a/packages/bulk-edit/src/browser/bulk-edit-contribution.ts b/packages/bulk-edit/src/browser/bulk-edit-contribution.ts index dbe3acc339e18..b25190a63ea15 100644 --- a/packages/bulk-edit/src/browser/bulk-edit-contribution.ts +++ b/packages/bulk-edit/src/browser/bulk-edit-contribution.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { injectable, inject, optional } from '@theia/core/shared/inversify'; +import { injectable, inject, optional, postConstruct } from '@theia/core/shared/inversify'; import { Widget } from '@theia/core/lib/browser/widgets/widget'; import { CommandRegistry } from '@theia/core/lib/common'; import { AbstractViewContribution } from '@theia/core/lib/browser/shell/view-contribution'; @@ -28,12 +28,15 @@ import { ResourceEdit } from '@theia/monaco-editor-core/esm/vs/editor/browser/se @injectable() export class BulkEditContribution extends AbstractViewContribution implements TabBarToolbarContribution { - private edits: ResourceEdit[]; + protected edits: ResourceEdit[]; @inject(QuickViewService) @optional() protected override readonly quickView: QuickViewService; - constructor(private readonly bulkEditService: MonacoBulkEditService) { + @inject(MonacoBulkEditService) + protected readonly bulkEditService: MonacoBulkEditService; + + constructor() { super({ widgetId: BULK_EDIT_TREE_WIDGET_ID, widgetName: BULK_EDIT_WIDGET_NAME, @@ -41,6 +44,10 @@ export class BulkEditContribution extends AbstractViewContribution this.previewEdit(edits)); } diff --git a/packages/core/src/browser/shell/view-contribution.ts b/packages/core/src/browser/shell/view-contribution.ts index bad02117f733d..e2bcb17a41a2b 100644 --- a/packages/core/src/browser/shell/view-contribution.ts +++ b/packages/core/src/browser/shell/view-contribution.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { injectable, inject, interfaces, optional } from 'inversify'; +import { injectable, inject, interfaces, optional, unmanaged } from 'inversify'; import { Widget } from '@phosphor/widgets'; import { MenuModelRegistry, Command, CommandContribution, @@ -64,7 +64,7 @@ export abstract class AbstractViewContribution implements Comm readonly toggleCommand?: Command; constructor( - protected readonly options: ViewContributionOptions + @unmanaged() protected readonly options: ViewContributionOptions ) { if (options.toggleCommandId) { this.toggleCommand = { diff --git a/packages/core/src/common/performance/stopwatch.ts b/packages/core/src/common/performance/stopwatch.ts index a86e0d6cd6742..af97c35fd19d3 100644 --- a/packages/core/src/common/performance/stopwatch.ts +++ b/packages/core/src/common/performance/stopwatch.ts @@ -16,7 +16,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { inject, injectable } from 'inversify'; +import { inject, injectable, unmanaged } from 'inversify'; import { ILogger, LogLevel } from '../logger'; import { MaybePromise } from '../types'; import { Measurement, MeasurementOptions, MeasurementResult } from './measurement'; @@ -58,7 +58,7 @@ export abstract class Stopwatch { return this.onDidAddMeasurementResultEmitter.event; } - constructor(protected readonly defaultLogOptions: LogOptions) { + constructor(@unmanaged() protected readonly defaultLogOptions: LogOptions) { if (!defaultLogOptions.defaultLogLevel) { defaultLogOptions.defaultLogLevel = DEFAULT_LOG_LEVEL; } diff --git a/packages/memory-inspector/src/browser/memory-inspector-frontend-module.ts b/packages/memory-inspector/src/browser/memory-inspector-frontend-module.ts index 612a849e906c4..66e5c2dd34f8b 100644 --- a/packages/memory-inspector/src/browser/memory-inspector-frontend-module.ts +++ b/packages/memory-inspector/src/browser/memory-inspector-frontend-module.ts @@ -113,6 +113,6 @@ export default new ContainerModule(bind => { RegisterTableWidget, RegisterWidgetOptions, options, - ).get(MemoryWidget), + ).get(MemoryWidget), })); }); diff --git a/packages/memory-inspector/src/browser/memory-widget/memory-widget.ts b/packages/memory-inspector/src/browser/memory-widget/memory-widget.ts index 41e4ef0aa50a5..b2924a755f8d6 100644 --- a/packages/memory-inspector/src/browser/memory-widget/memory-widget.ts +++ b/packages/memory-inspector/src/browser/memory-widget/memory-widget.ts @@ -45,7 +45,7 @@ export class MemoryWidget< options?: MemoryWidgetOptions, ): MemoryWidget { const child = MemoryWidget.createContainer(parent, optionsWidget, tableWidget, optionSymbol, options); - return child.get(MemoryWidget); + return child.get>(MemoryWidget); } static createContainer( diff --git a/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts b/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts index cabc07ee9c05d..0569ad46423f2 100644 --- a/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts +++ b/packages/plugin-ext/src/hosted/node/scanners/scanner-theia.ts @@ -16,7 +16,7 @@ /* eslint-disable @theia/localization-check */ -import { inject, injectable } from '@theia/core/shared/inversify'; +import { inject, injectable, unmanaged } from '@theia/core/shared/inversify'; import { AutoClosingPair, AutoClosingPairConditional, @@ -100,7 +100,10 @@ export abstract class AbstractPluginScanner implements PluginScanner { @inject(PluginUriFactory) protected readonly pluginUriFactory: PluginUriFactory; - constructor(private readonly _apiType: PluginEngine, private readonly _backendInitPath?: string) { } + constructor( + @unmanaged() private readonly _apiType: PluginEngine, + @unmanaged() private readonly _backendInitPath?: string) { + } get apiType(): PluginEngine { return this._apiType; diff --git a/packages/vsx-registry/src/common/vsx-registry-common-module.ts b/packages/vsx-registry/src/common/vsx-registry-common-module.ts index 5a0940c903d9e..70630e53b7478 100644 --- a/packages/vsx-registry/src/common/vsx-registry-common-module.ts +++ b/packages/vsx-registry/src/common/vsx-registry-common-module.ts @@ -25,12 +25,12 @@ import { RateLimiter } from 'limiter'; export default new ContainerModule(bind => { bind(OVSXUrlResolver) - .toFunction(url => url); + .toFunction((url: string) => url); bind(OVSXClientProvider) .toDynamicValue(ctx => { const vsxEnvironment = ctx.container.get(VSXEnvironment); const requestService = ctx.container.get(RequestService); - const urlResolver = ctx.container.get(OVSXUrlResolver); + const urlResolver = ctx.container.get(OVSXUrlResolver); const clientPromise = Promise .all([ vsxEnvironment.getRegistryApiUri(), From 61d56a85c834744c75f21985a473efccecfacb8c Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Tue, 12 Nov 2024 11:22:26 +0100 Subject: [PATCH 2/4] Update Inversify to latest --- .../collaboration-file-system-provider.ts | 2 - packages/core/README.md | 2 +- packages/core/package.json | 2 +- yarn.lock | 60 +++++++++---------- 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/packages/collaboration/src/browser/collaboration-file-system-provider.ts b/packages/collaboration/src/browser/collaboration-file-system-provider.ts index 87c9f556b0d57..834715a8d48c5 100644 --- a/packages/collaboration/src/browser/collaboration-file-system-provider.ts +++ b/packages/collaboration/src/browser/collaboration-file-system-provider.ts @@ -16,7 +16,6 @@ import * as Y from 'yjs'; import { Disposable, Emitter, Event, URI } from '@theia/core'; -import { injectable } from '@theia/core/shared/inversify'; import { FileChange, FileDeleteOptions, FileOverwriteOptions, FileSystemProviderCapabilities, FileType, Stat, WatchOptions, FileSystemProviderWithFileReadWriteCapability, FileWriteOptions @@ -32,7 +31,6 @@ export namespace CollaborationURI { } } -@injectable() export class CollaborationFileSystemProvider implements FileSystemProviderWithFileReadWriteCapability { capabilities = FileSystemProviderCapabilities.FileReadWrite; diff --git a/packages/core/README.md b/packages/core/README.md index b4ed6ca9c8fc9..1bda346a92a57 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -92,7 +92,7 @@ export class SomeClass { - `@theia/request/lib/node-request-service` (from [`@theia/request@1.55.0`](https://www.npmjs.com/package/@theia/request/v/1.55.0)) - `fs-extra` (from [`fs-extra@^4.0.2`](https://www.npmjs.com/package/fs-extra)) - `fuzzy` (from [`fuzzy@^0.1.3`](https://www.npmjs.com/package/fuzzy)) - - `inversify` (from [`inversify@^6.0.1`](https://www.npmjs.com/package/inversify)) + - `inversify` (from [`inversify@^6.1.3`](https://www.npmjs.com/package/inversify)) - `react-dom` (from [`react-dom@^18.2.0`](https://www.npmjs.com/package/react-dom)) - `react-dom/client` (from [`react-dom@^18.2.0`](https://www.npmjs.com/package/react-dom)) - `react-virtuoso` (from [`react-virtuoso@^2.17.0`](https://www.npmjs.com/package/react-virtuoso)) diff --git a/packages/core/package.json b/packages/core/package.json index 8e0f3e2af8e75..4f59aa602c1b3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -51,7 +51,7 @@ "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", "iconv-lite": "^0.6.0", - "inversify": "^6.0.1", + "inversify": "^6.1.3", "jschardet": "^2.1.1", "keytar": "7.2.0", "lodash.debounce": "^4.0.8", diff --git a/yarn.lock b/yarn.lock index f153a205443bf..394fdd7c2930d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1054,6 +1054,24 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== +"@inversifyjs/common@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@inversifyjs/common/-/common-1.3.2.tgz#883e5972b00e0065e21d300d6e959b188c42fc93" + integrity sha512-jIn8Kq8ZfQ/e6FrrKABS3Yju09PQ2L8tLSv+uoJPnBHhj2VHQYOB9qyvJvtCGIrvWC+mAvZ/5RmczXWyEioBjA== + +"@inversifyjs/core@1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@inversifyjs/core/-/core-1.3.3.tgz#e2da8192a9de39e4c6b3cea80b540e702b99cc55" + integrity sha512-kDj+ehYA8Q437eZO3gDVDfA/ZhEjRbgORH7kB/7G8JJ0Ij2As2Z3iwLLA9Px1AAOrfocK8JxvH6XAmKE0rALTA== + dependencies: + "@inversifyjs/common" "1.3.2" + "@inversifyjs/reflect-metadata-utils" "0.2.2" + +"@inversifyjs/reflect-metadata-utils@0.2.2": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@inversifyjs/reflect-metadata-utils/-/reflect-metadata-utils-0.2.2.tgz#18eedd4f3a4083928772779668308c95a554cc12" + integrity sha512-LaiMbwe4XBzn3GJdYditg0TTSiDMDTY0WuwdQP2BmoGd1e2XSTCIpcjVNqbNLd2dhBLgAEcr7Ep17QLV+DVBAA== + "@isaacs/cliui@^8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" @@ -7060,10 +7078,13 @@ interpret@^2.2.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== -inversify@^6.0.1: - version "6.0.2" - resolved "https://registry.yarnpkg.com/inversify/-/inversify-6.0.2.tgz#dc7fa0348213d789d35ffb719dea9685570989c7" - integrity sha512-i9m8j/7YIv4mDuYXUAcrpKPSaju/CIly9AHK5jvCBeoiM/2KEsuCQTTP+rzSWWpLYWRukdXFSl6ZTk2/uumbiA== +inversify@^6.1.3: + version "6.1.3" + resolved "https://registry.yarnpkg.com/inversify/-/inversify-6.1.3.tgz#de94dd6979fb2cdc8c794481635bd82171a03610" + integrity sha512-B+rsxKIEh4wCj8gf3IjHSF/7lR02SepVa7b21AlYYp0JzRNzPIOC2V+1EWWzbRNj6WCbrF00XX9STDJdcCKjvg== + dependencies: + "@inversifyjs/common" "1.3.2" + "@inversifyjs/core" "1.3.3" ip-address@^9.0.5: version "9.0.5" @@ -11489,7 +11510,7 @@ string-argv@^0.1.1: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.1.2.tgz#c5b7bc03fb2b11983ba3a72333dd0559e77e4738" integrity sha512-mBqPGEOMNJKXRo7z0keX0wlAhbBAjilUdPW13nN0PecVryZxdHIeM7TqbsSUA7VYuS00HGC6mojP7DlQzfa9ZA== -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -11507,15 +11528,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -11581,7 +11593,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -11602,13 +11614,6 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -12861,7 +12866,7 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -12879,15 +12884,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From f7a0208578d298c3627d4e4f00690891e2110c44 Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Tue, 12 Nov 2024 16:27:03 +0100 Subject: [PATCH 3/4] Add more decorations --- packages/core/src/browser/dialogs.ts | 6 +++--- packages/core/src/browser/tree/tree-decorator.ts | 4 ++-- packages/core/src/browser/widgets/widget.ts | 2 +- packages/git/src/browser/blame/blame-decorator.ts | 4 ++-- packages/markers/src/browser/marker-tree.ts | 6 +++--- packages/plugin-ext/src/hosted/common/hosted-plugin.ts | 4 ++-- .../src/main/node/plugin-deployer-proxy-entry-impl.ts | 7 +++++-- packages/process/src/node/process.ts | 6 +++--- packages/task/src/node/task.ts | 8 ++++---- packages/terminal/src/browser/terminal-profile-service.ts | 4 ++-- 10 files changed, 27 insertions(+), 24 deletions(-) diff --git a/packages/core/src/browser/dialogs.ts b/packages/core/src/browser/dialogs.ts index 73f0338a86919..9076dc49c118f 100644 --- a/packages/core/src/browser/dialogs.ts +++ b/packages/core/src/browser/dialogs.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { injectable, inject } from 'inversify'; +import { injectable, inject, unmanaged } from 'inversify'; import { Disposable, MaybePromise, CancellationTokenSource, nls } from '../common'; import { Key } from './keyboard/keys'; import { Widget, BaseWidget, Message, addKeyListener, codiconArray } from './widgets/widget'; @@ -151,8 +151,8 @@ export abstract class AbstractDialog extends BaseWidget { protected activeElement: HTMLElement | undefined; constructor( - protected readonly props: DialogProps, - options?: Widget.IOptions + @unmanaged() protected readonly props: DialogProps, + @unmanaged() options?: Widget.IOptions ) { super(options); this.id = 'theia-dialog-shell'; diff --git a/packages/core/src/browser/tree/tree-decorator.ts b/packages/core/src/browser/tree/tree-decorator.ts index a3260ad3b9b71..6b2c05b02d21d 100644 --- a/packages/core/src/browser/tree/tree-decorator.ts +++ b/packages/core/src/browser/tree/tree-decorator.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { injectable } from 'inversify'; +import { injectable, unmanaged } from 'inversify'; import { Tree, TreeNode } from './tree'; import { Event, Emitter, Disposable, DisposableCollection, MaybePromise } from '../../common'; import { WidgetDecoration } from '../widget-decoration'; @@ -170,7 +170,7 @@ export abstract class AbstractTreeDecoratorService implements TreeDecoratorServi protected readonly toDispose = new DisposableCollection(); - constructor(protected readonly decorators: ReadonlyArray) { + constructor(@unmanaged() protected readonly decorators: ReadonlyArray) { this.toDispose.push(this.onDidChangeDecorationsEmitter); this.toDispose.pushAll(this.decorators.map(decorator => decorator.onDidChangeDecorations(data => diff --git a/packages/core/src/browser/widgets/widget.ts b/packages/core/src/browser/widgets/widget.ts index db2b6f053b26d..74223001670bd 100644 --- a/packages/core/src/browser/widgets/widget.ts +++ b/packages/core/src/browser/widgets/widget.ts @@ -117,7 +117,7 @@ export class BaseWidget extends Widget implements PreviewableWidget { protected scrollBar?: PerfectScrollbar; protected scrollOptions?: PerfectScrollbar.Options; - constructor(options?: Widget.IOptions) { + constructor(@unmanaged() options?: Widget.IOptions) { super(options); } diff --git a/packages/git/src/browser/blame/blame-decorator.ts b/packages/git/src/browser/blame/blame-decorator.ts index 9416e7448166f..021a4daac0951 100644 --- a/packages/git/src/browser/blame/blame-decorator.ts +++ b/packages/git/src/browser/blame/blame-decorator.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { inject, injectable } from '@theia/core/shared/inversify'; +import { inject, injectable, unmanaged } from '@theia/core/shared/inversify'; import { EditorManager, TextEditor, EditorDecoration, EditorDecorationOptions, Range, Position, EditorDecorationStyle } from '@theia/editor/lib/browser'; import { GitFileBlame } from '../../common'; import { Disposable, DisposableCollection, nls } from '@theia/core'; @@ -28,7 +28,7 @@ import { LanguageSelector } from '@theia/monaco-editor-core/esm/vs/editor/common export class BlameDecorator implements monaco.languages.HoverProvider { constructor( - protected blameDecorationsStyleSheet: CSSStyleSheet = DecorationStyle.createStyleSheet('gitBlameDecorationsStyle') + @unmanaged() protected blameDecorationsStyleSheet: CSSStyleSheet = DecorationStyle.createStyleSheet('gitBlameDecorationsStyle') ) { DecorationStyle.getOrCreateStyleRule(`.${BlameDecorator.GIT_BLAME_HIGHLIGHT}`, this.blameDecorationsStyleSheet).style.backgroundColor = 'var(--theia-gitlens-lineHighlightBackgroundColor)'; diff --git a/packages/markers/src/browser/marker-tree.ts b/packages/markers/src/browser/marker-tree.ts index 1ba5d89556c19..b68cacc80708a 100644 --- a/packages/markers/src/browser/marker-tree.ts +++ b/packages/markers/src/browser/marker-tree.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { injectable } from '@theia/core/shared/inversify'; +import { injectable, unmanaged } from '@theia/core/shared/inversify'; import { TreeImpl, CompositeTreeNode, TreeNode, SelectableTreeNode, ExpandableTreeNode } from '@theia/core/lib/browser'; import { MarkerManager } from './marker-manager'; import { Marker } from '../common/marker'; @@ -32,8 +32,8 @@ export interface MarkerOptions { export abstract class MarkerTree extends TreeImpl { constructor( - protected readonly markerManager: MarkerManager, - protected readonly markerOptions: MarkerOptions + @unmanaged() protected readonly markerManager: MarkerManager, + @unmanaged() protected readonly markerOptions: MarkerOptions ) { super(); diff --git a/packages/plugin-ext/src/hosted/common/hosted-plugin.ts b/packages/plugin-ext/src/hosted/common/hosted-plugin.ts index 422bd76a4fe1a..ba9690bef5648 100644 --- a/packages/plugin-ext/src/hosted/common/hosted-plugin.ts +++ b/packages/plugin-ext/src/hosted/common/hosted-plugin.ts @@ -22,7 +22,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import debounce = require('@theia/core/shared/lodash.debounce'); -import { injectable, inject, interfaces, named, postConstruct } from '@theia/core/shared/inversify'; +import { injectable, inject, interfaces, named, postConstruct, unmanaged } from '@theia/core/shared/inversify'; import { PluginMetadata, HostedPluginServer, DeployedPlugin, PluginServer, PluginIdentifiers } from '../../common/plugin-protocol'; import { AbstractPluginManagerExt, ConfigStorage } from '../../common/plugin-api-rpc'; import { @@ -103,7 +103,7 @@ export abstract class AbstractHostedPluginSupport implements PluginDeployerEntry { private readonly deployerName: string; - constructor(readonly deployer: T, readonly delegate: PluginDeployerEntryImpl) { + constructor( + @unmanaged() readonly deployer: T, + @unmanaged() readonly delegate: PluginDeployerEntryImpl + ) { this.deployerName = (this.deployer as {}).constructor.name; } diff --git a/packages/process/src/node/process.ts b/packages/process/src/node/process.ts index 490ee09015563..31dc54523495c 100644 --- a/packages/process/src/node/process.ts +++ b/packages/process/src/node/process.ts @@ -86,10 +86,10 @@ export abstract class Process implements ManagedProcess { abstract readonly inputStream: Writable; constructor( - protected readonly processManager: ManagedProcessManager, - protected readonly logger: ILogger, + @unmanaged() protected readonly processManager: ManagedProcessManager, + @unmanaged() protected readonly logger: ILogger, @unmanaged() protected readonly type: ProcessType, - protected readonly options: ProcessOptions | ForkOptions + @unmanaged() protected readonly options: ProcessOptions | ForkOptions ) { this.id = this.processManager.register(this); this.initialCwd = options && options.options && 'cwd' in options.options && options.options['cwd'].toString() || __dirname; diff --git a/packages/task/src/node/task.ts b/packages/task/src/node/task.ts index dc1bcaca938ba..520d06e9fe57c 100644 --- a/packages/task/src/node/task.ts +++ b/packages/task/src/node/task.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 // ***************************************************************************** -import { injectable } from '@theia/core/shared/inversify'; +import { injectable, unmanaged } from '@theia/core/shared/inversify'; import { ILogger, Disposable, DisposableCollection, Emitter, Event, MaybePromise } from '@theia/core/lib/common/'; import { TaskInfo, TaskExitedEvent, TaskConfiguration, TaskOutputEvent, ManagedTask, ManagedTaskManager } from '../common/task-protocol'; /** @@ -43,9 +43,9 @@ export abstract class Task implements Disposable, ManagedTask { readonly outputEmitter: Emitter; constructor( - protected readonly taskManager: ManagedTaskManager, - protected readonly logger: ILogger, - protected readonly options: TaskOptions + @unmanaged() protected readonly taskManager: ManagedTaskManager, + @unmanaged() protected readonly logger: ILogger, + @unmanaged() protected readonly options: TaskOptions ) { this.taskId = this.taskManager.register(this, this.options.context); this.exitEmitter = new Emitter(); diff --git a/packages/terminal/src/browser/terminal-profile-service.ts b/packages/terminal/src/browser/terminal-profile-service.ts index 2a3f9b4570835..ba01d35c605dc 100644 --- a/packages/terminal/src/browser/terminal-profile-service.ts +++ b/packages/terminal/src/browser/terminal-profile-service.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { Emitter, Event } from '@theia/core'; -import { injectable } from '@theia/core/shared/inversify'; +import { injectable, unmanaged } from '@theia/core/shared/inversify'; import { TerminalWidget } from './base/terminal-widget'; import { ShellTerminalProfile } from './shell-terminal-profile'; @@ -95,7 +95,7 @@ export class DefaultTerminalProfileService implements TerminalProfileService { onRemoved: Event = this.onRemovedEmitter.event; onDidChangeDefaultShell: Event = this.onDidChangeDefaultShellEmitter.event; - constructor(...stores: TerminalProfileStore[]) { + constructor(@unmanaged() ...stores: TerminalProfileStore[]) { this.stores = stores; for (const store of this.stores) { store.onAdded(e => { From f21e842a0607ba0e775547d45ed187500dcd1c26 Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Wed, 13 Nov 2024 11:43:08 +0100 Subject: [PATCH 4/4] Manually approve the inversify libraries --- dependency-check-baseline.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dependency-check-baseline.json b/dependency-check-baseline.json index b4146da9836f4..0c43f6ea2bf58 100644 --- a/dependency-check-baseline.json +++ b/dependency-check-baseline.json @@ -1,3 +1,7 @@ { - "npm/npmjs/-/advanced-mark.js/2.6.0": "Manually approved" + "npm/npmjs/-/advanced-mark.js/2.6.0": "Manually approved", + "npm/npmjs/-/inversify/6.1.3": "Manually approved", + "npm/npmjs/@inversifyjs/common/1.3.2": "Manually approved", + "npm/npmjs/@inversifyjs/core/1.3.3": "Manually approved", + "npm/npmjs/@inversifyjs/reflect-metadata-utils/0.2.2": "Manually approved" }