@theia/plugin-metrics 1.77.0-next.4 → 1.77.0-next.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ import { PluginMetrics } from '../common/metrics-protocol';
2
+ /**
3
+ * Browser-only apps have no backend to expose metrics, so they are dropped. The `frontend` module
4
+ * isn't loaded there, so this binding is what keeps `PluginMetrics` injectable.
5
+ */
6
+ export declare class BrowserOnlyPluginMetrics implements PluginMetrics {
7
+ setMetrics(_metrics: string): void;
8
+ getMetrics(): string;
9
+ }
10
+ //# sourceMappingURL=browser-only-plugin-metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-only-plugin-metrics.d.ts","sourceRoot":"","sources":["../../src/browser-only/browser-only-plugin-metrics.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;GAGG;AACH,qBACa,wBAAyB,YAAW,aAAa;IAE1D,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAElC,UAAU,IAAI,MAAM;CAGvB"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 Robert Jandow
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.BrowserOnlyPluginMetrics = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ /**
22
+ * Browser-only apps have no backend to expose metrics, so they are dropped. The `frontend` module
23
+ * isn't loaded there, so this binding is what keeps `PluginMetrics` injectable.
24
+ */
25
+ let BrowserOnlyPluginMetrics = class BrowserOnlyPluginMetrics {
26
+ setMetrics(_metrics) { }
27
+ getMetrics() {
28
+ return '';
29
+ }
30
+ };
31
+ exports.BrowserOnlyPluginMetrics = BrowserOnlyPluginMetrics;
32
+ exports.BrowserOnlyPluginMetrics = BrowserOnlyPluginMetrics = tslib_1.__decorate([
33
+ (0, inversify_1.injectable)()
34
+ ], BrowserOnlyPluginMetrics);
35
+ //# sourceMappingURL=browser-only-plugin-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-only-plugin-metrics.js","sourceRoot":"","sources":["../../src/browser-only/browser-only-plugin-metrics.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,mCAAmC;AACnC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAG1D;;;GAGG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEjC,UAAU,CAAC,QAAgB,IAAU,CAAC;IAEtC,UAAU;QACN,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AAPY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAOpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=browser-only-plugin-metrics.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-only-plugin-metrics.spec.d.ts","sourceRoot":"","sources":["../../src/browser-only/browser-only-plugin-metrics.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 Robert Jandow
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const inversify_1 = require("@theia/core/shared/inversify");
19
+ const chai_1 = require("chai");
20
+ const metrics_protocol_1 = require("../common/metrics-protocol");
21
+ const browser_only_plugin_metrics_1 = require("./browser-only-plugin-metrics");
22
+ const plugin_metrics_frontend_only_module_1 = require("./plugin-metrics-frontend-only-module");
23
+ describe('browser-only plugin metrics', () => {
24
+ it('binds the no-op metrics', () => {
25
+ const container = new inversify_1.Container();
26
+ container.load(plugin_metrics_frontend_only_module_1.default);
27
+ const metrics = container.get(metrics_protocol_1.PluginMetrics);
28
+ (0, chai_1.expect)(metrics).to.be.instanceOf(browser_only_plugin_metrics_1.BrowserOnlyPluginMetrics);
29
+ (0, chai_1.expect)(() => metrics.setMetrics('metric 1')).not.to.throw();
30
+ (0, chai_1.expect)(metrics.getMetrics()).to.equal('');
31
+ });
32
+ it('replaces an existing metrics binding', () => {
33
+ const container = new inversify_1.Container();
34
+ container.bind(metrics_protocol_1.PluginMetrics).toConstantValue({
35
+ setMetrics: () => { },
36
+ getMetrics: () => 'existing'
37
+ });
38
+ container.load(plugin_metrics_frontend_only_module_1.default);
39
+ (0, chai_1.expect)(container.get(metrics_protocol_1.PluginMetrics)).to.be.instanceOf(browser_only_plugin_metrics_1.BrowserOnlyPluginMetrics);
40
+ });
41
+ });
42
+ //# sourceMappingURL=browser-only-plugin-metrics.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-only-plugin-metrics.spec.js","sourceRoot":"","sources":["../../src/browser-only/browser-only-plugin-metrics.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,mCAAmC;AACnC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,4DAAyD;AACzD,+BAA8B;AAC9B,iEAA2D;AAC3D,+EAAyE;AACzE,+FAAoF;AAEpF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAC/B,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;QAClC,SAAS,CAAC,IAAI,CAAC,6CAA+B,CAAC,CAAC;QAEhD,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAgB,gCAAa,CAAC,CAAC;QAC5D,IAAA,aAAM,EAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,sDAAwB,CAAC,CAAC;QAC3D,IAAA,aAAM,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAC5D,IAAA,aAAM,EAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC5C,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;QAClC,SAAS,CAAC,IAAI,CAAC,gCAAa,CAAC,CAAC,eAAe,CAAC;YAC1C,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC;YACrB,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU;SAC/B,CAAC,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,6CAA+B,CAAC,CAAC;QAEhD,IAAA,aAAM,EAAC,SAAS,CAAC,GAAG,CAAC,gCAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,sDAAwB,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ContainerModule } from '@theia/core/shared/inversify';
2
+ declare const _default: ContainerModule;
3
+ export default _default;
4
+ //# sourceMappingURL=plugin-metrics-frontend-only-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics-frontend-only-module.d.ts","sourceRoot":"","sources":["../../src/browser-only/plugin-metrics-frontend-only-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAK/D,wBAOG"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 Robert Jandow
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const inversify_1 = require("@theia/core/shared/inversify");
19
+ const metrics_protocol_1 = require("../common/metrics-protocol");
20
+ const browser_only_plugin_metrics_1 = require("./browser-only-plugin-metrics");
21
+ // Loaded instead of the `frontend` module, so plugin API calls aren't wrapped to collect metrics.
22
+ exports.default = new inversify_1.ContainerModule((bind, _unbind, isBound, rebind) => {
23
+ bind(browser_only_plugin_metrics_1.BrowserOnlyPluginMetrics).toSelf().inSingletonScope();
24
+ if (isBound(metrics_protocol_1.PluginMetrics)) {
25
+ rebind(metrics_protocol_1.PluginMetrics).toService(browser_only_plugin_metrics_1.BrowserOnlyPluginMetrics);
26
+ }
27
+ else {
28
+ bind(metrics_protocol_1.PluginMetrics).toService(browser_only_plugin_metrics_1.BrowserOnlyPluginMetrics);
29
+ }
30
+ });
31
+ //# sourceMappingURL=plugin-metrics-frontend-only-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-metrics-frontend-only-module.js","sourceRoot":"","sources":["../../src/browser-only/plugin-metrics-frontend-only-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,mCAAmC;AACnC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,4DAA+D;AAC/D,iEAA2D;AAC3D,+EAAyE;AAEzE,kGAAkG;AAClG,kBAAe,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAClE,IAAI,CAAC,sDAAwB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC3D,IAAI,OAAO,CAAC,gCAAa,CAAC,EAAE,CAAC;QACzB,MAAM,CAAC,gCAAa,CAAC,CAAC,SAAS,CAAC,sDAAwB,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,gCAAa,CAAC,CAAC,SAAS,CAAC,sDAAwB,CAAC,CAAC;IAC5D,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@theia/plugin-metrics",
3
- "version": "1.77.0-next.4+4f24ee401",
3
+ "version": "1.77.0-next.43+5dbb84a9f",
4
4
  "description": "Theia - Plugin Metrics",
5
5
  "dependencies": {
6
- "@theia/core": "1.77.0-next.4+4f24ee401",
7
- "@theia/metrics": "1.77.0-next.4+4f24ee401",
6
+ "@theia/core": "1.77.0-next.43+5dbb84a9f",
7
+ "@theia/metrics": "1.77.0-next.43+5dbb84a9f",
8
8
  "@theia/monaco-editor-core": "1.108.201",
9
- "@theia/plugin": "1.77.0-next.4+4f24ee401",
10
- "@theia/plugin-ext": "1.77.0-next.4+4f24ee401",
9
+ "@theia/plugin": "1.77.0-next.43+5dbb84a9f",
10
+ "@theia/plugin-ext": "1.77.0-next.43+5dbb84a9f",
11
11
  "tslib": "^2.8.1"
12
12
  },
13
13
  "publishConfig": {
@@ -16,6 +16,7 @@
16
16
  "theiaExtensions": [
17
17
  {
18
18
  "frontend": "lib/browser/plugin-metrics-frontend-module",
19
+ "frontendOnly": "lib/browser-only/plugin-metrics-frontend-only-module",
19
20
  "backend": "lib/node/plugin-metrics-backend-module"
20
21
  }
21
22
  ],
@@ -49,5 +50,5 @@
49
50
  "nyc": {
50
51
  "extends": "../../configs/nyc.json"
51
52
  },
52
- "gitHead": "4f24ee40105b8c53808c8293c41387304d15960c"
53
+ "gitHead": "5dbb84a9f43e9287fe3d6f0f52ee1dd2c3c4a20f"
53
54
  }
@@ -0,0 +1,44 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 Robert Jandow
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Container } from '@theia/core/shared/inversify';
18
+ import { expect } from 'chai';
19
+ import { PluginMetrics } from '../common/metrics-protocol';
20
+ import { BrowserOnlyPluginMetrics } from './browser-only-plugin-metrics';
21
+ import pluginMetricsFrontendOnlyModule from './plugin-metrics-frontend-only-module';
22
+
23
+ describe('browser-only plugin metrics', () => {
24
+ it('binds the no-op metrics', () => {
25
+ const container = new Container();
26
+ container.load(pluginMetricsFrontendOnlyModule);
27
+
28
+ const metrics = container.get<PluginMetrics>(PluginMetrics);
29
+ expect(metrics).to.be.instanceOf(BrowserOnlyPluginMetrics);
30
+ expect(() => metrics.setMetrics('metric 1')).not.to.throw();
31
+ expect(metrics.getMetrics()).to.equal('');
32
+ });
33
+
34
+ it('replaces an existing metrics binding', () => {
35
+ const container = new Container();
36
+ container.bind(PluginMetrics).toConstantValue({
37
+ setMetrics: () => { },
38
+ getMetrics: () => 'existing'
39
+ });
40
+ container.load(pluginMetricsFrontendOnlyModule);
41
+
42
+ expect(container.get(PluginMetrics)).to.be.instanceOf(BrowserOnlyPluginMetrics);
43
+ });
44
+ });
@@ -0,0 +1,32 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 Robert Jandow
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable } from '@theia/core/shared/inversify';
18
+ import { PluginMetrics } from '../common/metrics-protocol';
19
+
20
+ /**
21
+ * Browser-only apps have no backend to expose metrics, so they are dropped. The `frontend` module
22
+ * isn't loaded there, so this binding is what keeps `PluginMetrics` injectable.
23
+ */
24
+ @injectable()
25
+ export class BrowserOnlyPluginMetrics implements PluginMetrics {
26
+
27
+ setMetrics(_metrics: string): void { }
28
+
29
+ getMetrics(): string {
30
+ return '';
31
+ }
32
+ }
@@ -0,0 +1,29 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 Robert Jandow
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ContainerModule } from '@theia/core/shared/inversify';
18
+ import { PluginMetrics } from '../common/metrics-protocol';
19
+ import { BrowserOnlyPluginMetrics } from './browser-only-plugin-metrics';
20
+
21
+ // Loaded instead of the `frontend` module, so plugin API calls aren't wrapped to collect metrics.
22
+ export default new ContainerModule((bind, _unbind, isBound, rebind) => {
23
+ bind(BrowserOnlyPluginMetrics).toSelf().inSingletonScope();
24
+ if (isBound(PluginMetrics)) {
25
+ rebind(PluginMetrics).toService(BrowserOnlyPluginMetrics);
26
+ } else {
27
+ bind(PluginMetrics).toService(BrowserOnlyPluginMetrics);
28
+ }
29
+ });