@theia/mini-browser 1.77.0-next.0 → 1.77.0-next.101

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.
Files changed (72) hide show
  1. package/lib/browser/environment/mini-browser-environment-module.js +6 -8
  2. package/lib/browser/environment/mini-browser-environment-module.js.map +1 -1
  3. package/lib/browser/environment/mini-browser-environment.js +21 -28
  4. package/lib/browser/environment/mini-browser-environment.js.map +1 -1
  5. package/lib/browser/location-mapper-service.d.ts +1 -1
  6. package/lib/browser/location-mapper-service.d.ts.map +1 -1
  7. package/lib/browser/location-mapper-service.js +32 -37
  8. package/lib/browser/location-mapper-service.js.map +1 -1
  9. package/lib/browser/mini-browser-content-style.js +2 -5
  10. package/lib/browser/mini-browser-content-style.js.map +1 -1
  11. package/lib/browser/mini-browser-content.d.ts +1 -1
  12. package/lib/browser/mini-browser-content.d.ts.map +1 -1
  13. package/lib/browser/mini-browser-content.js +79 -91
  14. package/lib/browser/mini-browser-content.js.map +1 -1
  15. package/lib/browser/mini-browser-frontend-module.js +44 -46
  16. package/lib/browser/mini-browser-frontend-module.js.map +1 -1
  17. package/lib/browser/mini-browser-frontend-security-warnings.d.ts +1 -1
  18. package/lib/browser/mini-browser-frontend-security-warnings.d.ts.map +1 -1
  19. package/lib/browser/mini-browser-frontend-security-warnings.js +23 -29
  20. package/lib/browser/mini-browser-frontend-security-warnings.js.map +1 -1
  21. package/lib/browser/mini-browser-open-handler.d.ts +3 -3
  22. package/lib/browser/mini-browser-open-handler.d.ts.map +1 -1
  23. package/lib/browser/mini-browser-open-handler.js +48 -56
  24. package/lib/browser/mini-browser-open-handler.js.map +1 -1
  25. package/lib/browser/mini-browser.d.ts +1 -1
  26. package/lib/browser/mini-browser.d.ts.map +1 -1
  27. package/lib/browser/mini-browser.js +22 -30
  28. package/lib/browser/mini-browser.js.map +1 -1
  29. package/lib/common/mini-browser-endpoint.js +2 -5
  30. package/lib/common/mini-browser-endpoint.js.map +1 -1
  31. package/lib/common/mini-browser-service.js +2 -5
  32. package/lib/common/mini-browser-service.js.map +1 -1
  33. package/lib/electron-browser/environment/electron-mini-browser-environment-module.js +7 -9
  34. package/lib/electron-browser/environment/electron-mini-browser-environment-module.js.map +1 -1
  35. package/lib/electron-browser/environment/electron-mini-browser-environment.d.ts +1 -1
  36. package/lib/electron-browser/environment/electron-mini-browser-environment.d.ts.map +1 -1
  37. package/lib/electron-browser/environment/electron-mini-browser-environment.js +11 -15
  38. package/lib/electron-browser/environment/electron-mini-browser-environment.js.map +1 -1
  39. package/lib/electron-main/mini-browser-electron-main-contribution.js +10 -14
  40. package/lib/electron-main/mini-browser-electron-main-contribution.js.map +1 -1
  41. package/lib/node/mini-browser-backend-module.js +23 -25
  42. package/lib/node/mini-browser-backend-module.js.map +1 -1
  43. package/lib/node/mini-browser-backend-security-warnings.js +14 -18
  44. package/lib/node/mini-browser-backend-security-warnings.js.map +1 -1
  45. package/lib/node/mini-browser-endpoint.d.ts +4 -4
  46. package/lib/node/mini-browser-endpoint.d.ts.map +1 -1
  47. package/lib/node/mini-browser-endpoint.js +54 -68
  48. package/lib/node/mini-browser-endpoint.js.map +1 -1
  49. package/lib/node/mini-browser-ws-validator.js +9 -15
  50. package/lib/node/mini-browser-ws-validator.js.map +1 -1
  51. package/lib/node/mini-browser-ws-validator.spec.js +7 -9
  52. package/lib/node/mini-browser-ws-validator.spec.js.map +1 -1
  53. package/lib/package.spec.d.ts +1 -0
  54. package/lib/package.spec.js +1 -0
  55. package/package.json +12 -4
  56. package/src/browser/environment/mini-browser-environment-module.ts +1 -1
  57. package/src/browser/environment/mini-browser-environment.ts +1 -1
  58. package/src/browser/location-mapper-service.ts +1 -1
  59. package/src/browser/mini-browser-content.ts +6 -5
  60. package/src/browser/mini-browser-frontend-module.ts +6 -6
  61. package/src/browser/mini-browser-frontend-security-warnings.ts +2 -2
  62. package/src/browser/mini-browser-open-handler.ts +3 -3
  63. package/src/browser/mini-browser.ts +1 -1
  64. package/src/electron-browser/environment/electron-mini-browser-environment-module.ts +2 -2
  65. package/src/electron-browser/environment/electron-mini-browser-environment.ts +1 -1
  66. package/src/electron-main/mini-browser-electron-main-contribution.ts +1 -1
  67. package/src/node/mini-browser-backend-module.ts +4 -4
  68. package/src/node/mini-browser-backend-security-warnings.ts +1 -1
  69. package/src/node/mini-browser-endpoint.ts +20 -29
  70. package/src/node/mini-browser-ws-validator.spec.ts +1 -1
  71. package/src/node/mini-browser-ws-validator.ts +1 -1
  72. package/src/typings/vhost.d.ts +21 -0
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2020 Ericsson and others.
4
3
  //
@@ -14,11 +13,9 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.MiniBrowserWsRequestValidator = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const mini_browser_endpoint_1 = require("../common/mini-browser-endpoint");
16
+ import { __decorate } from "tslib";
17
+ import { injectable, postConstruct } from '@theia/core/shared/inversify';
18
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint.js';
22
19
  /**
23
20
  * Prevents explicit WebSocket connections from the mini-browser virtual host.
24
21
  */
@@ -27,7 +24,7 @@ let MiniBrowserWsRequestValidator = class MiniBrowserWsRequestValidator {
27
24
  this.serveSameOrigin = false;
28
25
  }
29
26
  init() {
30
- const pattern = process.env[mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_ENV] || mini_browser_endpoint_1.MiniBrowserEndpoint.HOST_PATTERN_DEFAULT;
27
+ const pattern = process.env[MiniBrowserEndpoint.HOST_PATTERN_ENV] || MiniBrowserEndpoint.HOST_PATTERN_DEFAULT;
31
28
  if (pattern === '{{hostname}}') {
32
29
  this.serveSameOrigin = true;
33
30
  }
@@ -54,14 +51,11 @@ let MiniBrowserWsRequestValidator = class MiniBrowserWsRequestValidator {
54
51
  return true;
55
52
  }
56
53
  };
57
- exports.MiniBrowserWsRequestValidator = MiniBrowserWsRequestValidator;
58
- tslib_1.__decorate([
59
- (0, inversify_1.postConstruct)(),
60
- tslib_1.__metadata("design:type", Function),
61
- tslib_1.__metadata("design:paramtypes", []),
62
- tslib_1.__metadata("design:returntype", void 0)
54
+ __decorate([
55
+ postConstruct()
63
56
  ], MiniBrowserWsRequestValidator.prototype, "init", null);
64
- exports.MiniBrowserWsRequestValidator = MiniBrowserWsRequestValidator = tslib_1.__decorate([
65
- (0, inversify_1.injectable)()
57
+ MiniBrowserWsRequestValidator = __decorate([
58
+ injectable()
66
59
  ], MiniBrowserWsRequestValidator);
60
+ export { MiniBrowserWsRequestValidator };
67
61
  //# sourceMappingURL=mini-browser-ws-validator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mini-browser-ws-validator.js","sourceRoot":"","sources":["../../src/node/mini-browser-ws-validator.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,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;;;;AAIhF,4DAAyE;AACzE,2EAAsE;AAEtE;;GAEG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAAnC;QAIO,oBAAe,GAAY,KAAK,CAAC;IA8B/C,CAAC;IA3Ba,IAAI;QACV,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,2CAAmB,CAAC,gBAAgB,CAAC,IAAI,2CAAmB,CAAC,oBAAoB,CAAC;QAC9G,IAAI,OAAO,KAAK,cAAc,EAAE,CAAC;YAC7B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;QACD,MAAM,OAAO,GAAG,OAAO;aAClB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;aACrB,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC;aACzB,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,iBAAiB,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA6B;QAC9C,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAClD,IAAI,IAAwB,CAAC;YAC7B,IAAI,CAAC;gBACD,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAChD,CAAC;YAAC,MAAM,CAAC;gBACL,IAAI,GAAG,SAAS,CAAC;YACrB,CAAC;YACD,IAAI,IAAI,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,iDAAiD;gBACjD,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAlCY,sEAA6B;AAO5B;IADT,IAAA,yBAAa,GAAE;;;;yDAWf;wCAjBQ,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAkCzC"}
1
+ {"version":3,"file":"mini-browser-ws-validator.js","sourceRoot":"","sources":["../../src/node/mini-browser-ws-validator.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,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;;AAIhF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,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6B;IADzC,UAAU,EAAE;GACA,6BAA6B,CAkCzC"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2026 EclipseSource and others.
4
3
  //
@@ -14,12 +13,11 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const chai_1 = require("chai");
19
- const mini_browser_ws_validator_1 = require("./mini-browser-ws-validator");
16
+ import { expect } from 'chai';
17
+ import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator.js';
20
18
  describe('MiniBrowserWsRequestValidator', () => {
21
19
  function createValidator() {
22
- const validator = new mini_browser_ws_validator_1.MiniBrowserWsRequestValidator();
20
+ const validator = new MiniBrowserWsRequestValidator();
23
21
  // Uses the default host pattern '{{uuid}}.mini-browser.{{hostname}}'.
24
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
23
  validator['init']();
@@ -36,19 +34,19 @@ describe('MiniBrowserWsRequestValidator', () => {
36
34
  }
37
35
  it('should refuse WebSocket upgrades from the mini-browser virtual host', async () => {
38
36
  const validator = createValidator();
39
- (0, chai_1.expect)(await validator.allowWsUpgrade(createRequest('http://abc.mini-browser.localhost:3000'))).to.be.false;
37
+ expect(await validator.allowWsUpgrade(createRequest('http://abc.mini-browser.localhost:3000'))).to.be.false;
40
38
  });
41
39
  it('should allow WebSocket upgrades from other origins', async () => {
42
40
  const validator = createValidator();
43
- (0, chai_1.expect)(await validator.allowWsUpgrade(createRequest('http://localhost:3000'))).to.be.true;
41
+ expect(await validator.allowWsUpgrade(createRequest('http://localhost:3000'))).to.be.true;
44
42
  });
45
43
  it('should allow requests with no Origin header', async () => {
46
44
  const validator = createValidator();
47
- (0, chai_1.expect)(await validator.allowWsUpgrade(createRequest())).to.be.true;
45
+ expect(await validator.allowWsUpgrade(createRequest())).to.be.true;
48
46
  });
49
47
  it('should not throw and should allow when the Origin header is malformed', async () => {
50
48
  const validator = createValidator();
51
- (0, chai_1.expect)(await validator.allowWsUpgrade(createRequest('not-a-valid-url'))).to.be.true;
49
+ expect(await validator.allowWsUpgrade(createRequest('not-a-valid-url'))).to.be.true;
52
50
  });
53
51
  });
54
52
  //# sourceMappingURL=mini-browser-ws-validator.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mini-browser-ws-validator.spec.js","sourceRoot":"","sources":["../../src/node/mini-browser-ws-validator.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,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,+BAA8B;AAE9B,2EAA4E;AAE5E,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAE3C,SAAS,eAAe;QACpB,MAAM,SAAS,GAAG,IAAI,yDAA6B,EAAE,CAAC;QACtD,sEAAsE;QACtE,8DAA8D;QAC7D,SAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,SAAS,aAAa,CAAC,MAAe;QAClC,MAAM,OAAO,GAAG;YACZ,OAAO,EAAE,EAA8B;SAClB,CAAC;QAC1B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QACpC,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,EAAE,CAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;QACpC,IAAA,aAAM,EAAC,MAAM,SAAS,CAAC,cAAc,CACjC,aAAa,CAAC,wCAAwC,CAAC,CAC1D,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;QAChE,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;QACpC,IAAA,aAAM,EAAC,MAAM,SAAS,CAAC,cAAc,CACjC,aAAa,CAAC,uBAAuB,CAAC,CACzC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;QACpC,IAAA,aAAM,EAAC,MAAM,SAAS,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;QACnF,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;QACpC,IAAA,aAAM,EAAC,MAAM,SAAS,CAAC,cAAc,CACjC,aAAa,CAAC,iBAAiB,CAAC,CACnC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"mini-browser-ws-validator.spec.js","sourceRoot":"","sources":["../../src/node/mini-browser-ws-validator.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,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,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AA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QACnF,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;QACpC,MAAM,CAAC,MAAM,SAAS,CAAC,cAAc,CACjC,aAAa,CAAC,iBAAiB,CAAC,CACnC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1 +1,2 @@
1
+ export {};
1
2
  //# sourceMappingURL=package.spec.d.ts.map
@@ -16,4 +16,5 @@
16
16
  describe('mini-browser package', () => {
17
17
  it('support code coverage statistics', () => true);
18
18
  });
19
+ export {};
19
20
  //# sourceMappingURL=package.spec.js.map
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@theia/mini-browser",
3
- "version": "1.77.0-next.0+d8106d7ff",
3
+ "version": "1.77.0-next.101+8308c936b",
4
4
  "description": "Theia - Mini-Browser Extension",
5
+ "type": "module",
5
6
  "dependencies": {
6
- "@theia/core": "1.77.0-next.0+d8106d7ff",
7
- "@theia/filesystem": "1.77.0-next.0+d8106d7ff",
7
+ "@theia/core": "1.77.0-next.101+8308c936b",
8
+ "@theia/filesystem": "1.77.0-next.101+8308c936b",
8
9
  "@types/mime-types": "^2.1.4",
9
10
  "mime-types": "^2.1.35",
10
11
  "pdfobject": "^2.3.1",
@@ -54,5 +55,12 @@
54
55
  "nyc": {
55
56
  "extends": "../../configs/nyc.json"
56
57
  },
57
- "gitHead": "d8106d7ffa62b3413ff1ca5b63a0e6c2fe0b0649"
58
+ "gitHead": "8308c936be596c357a51fc815ef30022aa62b3d5",
59
+ "exports": {
60
+ "./package.json": "./package.json",
61
+ "./lib/*.json": "./lib/*.json",
62
+ "./lib/*.js": "./lib/*.js",
63
+ "./lib/*": "./lib/*.js",
64
+ "./*": "./*"
65
+ }
58
66
  }
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { FrontendApplicationContribution } from '@theia/core/lib/browser';
18
18
  import { ContainerModule } from '@theia/core/shared/inversify';
19
- import { MiniBrowserEnvironment } from './mini-browser-environment';
19
+ import { MiniBrowserEnvironment } from './mini-browser-environment.js';
20
20
 
21
21
  export default new ContainerModule(bind => {
22
22
  bind(MiniBrowserEnvironment).toSelf().inSingletonScope();
@@ -19,7 +19,7 @@ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
19
19
  import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
20
20
  import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
21
21
  import { generateUuid } from '@theia/core/lib/common/uuid';
22
- import { MiniBrowserEndpoint } from '../../common/mini-browser-endpoint';
22
+ import { MiniBrowserEndpoint } from '../../common/mini-browser-endpoint.js';
23
23
 
24
24
  /**
25
25
  * Fetch values from the backend's environment and caches them locally.
@@ -19,7 +19,7 @@ import URI from '@theia/core/lib/common/uri';
19
19
  import { Endpoint } from '@theia/core/lib/browser';
20
20
  import { MaybePromise, Prioritizeable } from '@theia/core/lib/common/types';
21
21
  import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
22
- import { MiniBrowserEnvironment } from './environment/mini-browser-environment';
22
+ import { MiniBrowserEnvironment } from './environment/mini-browser-environment.js';
23
23
 
24
24
  /**
25
25
  * Contribution for the `LocationMapperService`.
@@ -14,7 +14,8 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import * as PDFObject from 'pdfobject';
17
+ // A CommonJS module whose exports cannot be detected statically, so it is imported as a whole.
18
+ import PDFObject from 'pdfobject';
18
19
  import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
19
20
  import { Message } from '@theia/core/shared/@lumino/messaging';
20
21
  import URI from '@theia/core/lib/common/uri';
@@ -25,11 +26,11 @@ import { WindowService } from '@theia/core/lib/browser/window/window-service';
25
26
  import { parseCssTime, Key, KeyCode } from '@theia/core/lib/browser';
26
27
  import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposable';
27
28
  import { BaseWidget, addEventListener, codiconArray } from '@theia/core/lib/browser/widgets/widget';
28
- import { LocationMapperService } from './location-mapper-service';
29
+ import { LocationMapperService } from './location-mapper-service.js';
29
30
  import { ApplicationShellMouseTracker } from '@theia/core/lib/browser/shell/application-shell-mouse-tracker';
30
31
 
31
- import debounce = require('@theia/core/shared/lodash.debounce');
32
- import { MiniBrowserContentStyle } from './mini-browser-content-style';
32
+ import debounce from '@theia/core/shared/lodash.debounce';
33
+ import { MiniBrowserContentStyle } from './mini-browser-content-style.js';
33
34
  import { FileService } from '@theia/filesystem/lib/browser/file-service';
34
35
  import { FileChangesEvent, FileChangeType } from '@theia/filesystem/lib/common/files';
35
36
 
@@ -583,7 +584,7 @@ export class MiniBrowserContent extends BaseWidget {
583
584
  this.pdfContainer.style.display = 'block';
584
585
  this.frame.style.display = 'none';
585
586
  PDFObject.embed(url, this.pdfContainer, {
586
- // eslint-disable-next-line max-len, @typescript-eslint/quotes
587
+ // eslint-disable-next-line max-len, @stylistic/quotes
587
588
  fallbackLink: `<p style="padding: 0px 15px 0px 15px">Your browser does not support inline PDFs. Click on this <a href='[url]' target="_blank">link</a> to open the PDF in a new tab.</p>`
588
589
  });
589
590
  clearTimeout(this.frameLoadTimeout);
@@ -27,10 +27,10 @@ import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar
27
27
  import { CommandContribution } from '@theia/core/lib/common/command';
28
28
  import { MenuContribution } from '@theia/core/lib/common/menu';
29
29
  import { NavigatableWidgetOptions } from '@theia/core/lib/browser/navigatable';
30
- import { MiniBrowserOpenHandler } from './mini-browser-open-handler';
31
- import { MiniBrowserService, MiniBrowserServicePath } from '../common/mini-browser-service';
32
- import { MiniBrowser, MiniBrowserOptions } from './mini-browser';
33
- import { MiniBrowserProps, MiniBrowserContentFactory, MiniBrowserContent } from './mini-browser-content';
30
+ import { MiniBrowserOpenHandler } from './mini-browser-open-handler.js';
31
+ import { MiniBrowserService, MiniBrowserServicePath } from '../common/mini-browser-service.js';
32
+ import { MiniBrowser, MiniBrowserOptions } from './mini-browser.js';
33
+ import { MiniBrowserProps, MiniBrowserContentFactory, MiniBrowserContent } from './mini-browser-content.js';
34
34
  import {
35
35
  LocationMapperService,
36
36
  FileLocationMapper,
@@ -38,8 +38,8 @@ import {
38
38
  HttpsLocationMapper,
39
39
  LocationMapper,
40
40
  LocationWithoutSchemeMapper,
41
- } from './location-mapper-service';
42
- import { MiniBrowserFrontendSecurityWarnings } from './mini-browser-frontend-security-warnings';
41
+ } from './location-mapper-service.js';
42
+ import { MiniBrowserFrontendSecurityWarnings } from './mini-browser-frontend-security-warnings.js';
43
43
 
44
44
  export default new ContainerModule(bind => {
45
45
  bind(MiniBrowserContent).toSelf();
@@ -20,8 +20,8 @@ import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/front
20
20
  import { nls } from '@theia/core/lib/common/nls';
21
21
  import { WindowService } from '@theia/core/lib/browser/window/window-service';
22
22
  import { inject, injectable } from '@theia/core/shared/inversify';
23
- import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
24
- import { MiniBrowserEnvironment } from './environment/mini-browser-environment';
23
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint.js';
24
+ import { MiniBrowserEnvironment } from './environment/mini-browser-environment.js';
25
25
 
26
26
  @injectable()
27
27
  export class MiniBrowserFrontendSecurityWarnings implements FrontendApplicationContribution {
@@ -28,9 +28,9 @@ import { open, OpenerService } from '@theia/core/lib/browser/opener-service';
28
28
  import { LabelProvider } from '@theia/core/lib/browser/label-provider';
29
29
  import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application-contribution';
30
30
  import { WidgetOpenerOptions } from '@theia/core/lib/browser/widget-open-handler';
31
- import { MiniBrowserService } from '../common/mini-browser-service';
32
- import { MiniBrowser, MiniBrowserProps } from './mini-browser';
33
- import { LocationMapperService } from './location-mapper-service';
31
+ import { MiniBrowserService } from '../common/mini-browser-service.js';
32
+ import { MiniBrowser, MiniBrowserProps } from './mini-browser.js';
33
+ import { LocationMapperService } from './location-mapper-service.js';
34
34
  import { nls } from '@theia/core/lib/common/nls';
35
35
 
36
36
  export namespace MiniBrowserCommands {
@@ -20,7 +20,7 @@ import URI from '@theia/core/lib/common/uri';
20
20
  import { NavigatableWidget, StatefulWidget } from '@theia/core/lib/browser';
21
21
  import { DisposableCollection } from '@theia/core/lib/common/disposable';
22
22
  import { BaseWidget, codicon, PanelLayout } from '@theia/core/lib/browser/widgets/widget';
23
- import { MiniBrowserProps, MiniBrowserContentFactory } from './mini-browser-content';
23
+ import { MiniBrowserProps, MiniBrowserContentFactory } from './mini-browser-content.js';
24
24
 
25
25
  export { MiniBrowserProps };
26
26
 
@@ -16,8 +16,8 @@
16
16
 
17
17
  import { FrontendApplicationContribution } from '@theia/core/lib/browser';
18
18
  import { ContainerModule } from '@theia/core/shared/inversify';
19
- import { MiniBrowserEnvironment } from '../../browser/environment/mini-browser-environment';
20
- import { ElectronMiniBrowserEnvironment } from './electron-mini-browser-environment';
19
+ import { MiniBrowserEnvironment } from '../../browser/environment/mini-browser-environment.js';
20
+ import { ElectronMiniBrowserEnvironment } from './electron-mini-browser-environment.js';
21
21
 
22
22
  export default new ContainerModule(bind => {
23
23
  bind(MiniBrowserEnvironment).to(ElectronMiniBrowserEnvironment).inSingletonScope();
@@ -18,7 +18,7 @@ import { Endpoint } from '@theia/core/lib/browser';
18
18
 
19
19
  import { ElectronSecurityToken } from '@theia/core/lib/electron-common/electron-token';
20
20
  import { inject, injectable } from '@theia/core/shared/inversify';
21
- import { MiniBrowserEnvironment } from '../../browser/environment/mini-browser-environment';
21
+ import { MiniBrowserEnvironment } from '../../browser/environment/mini-browser-environment.js';
22
22
 
23
23
  import '@theia/core/lib/electron-common/electron-api';
24
24
 
@@ -17,7 +17,7 @@
17
17
  import { ElectronMainApplication, ElectronMainApplicationContribution } from '@theia/core/lib/electron-main/electron-main-application';
18
18
  import { ElectronSecurityTokenService } from '@theia/core/lib/electron-main/electron-security-token-service';
19
19
  import { inject, injectable } from '@theia/core/shared/inversify';
20
- import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
20
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint.js';
21
21
 
22
22
  /**
23
23
  * Since the mini-browser might serve content from a new origin,
@@ -18,11 +18,11 @@ import { ContainerModule } from '@theia/core/shared/inversify';
18
18
  import { bindRootContributionProvider } from '@theia/core/lib/common/contribution-provider';
19
19
  import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
20
20
  import { ConnectionHandler, RpcConnectionHandler } from '@theia/core/lib/common';
21
- import { MiniBrowserService, MiniBrowserServicePath } from '../common/mini-browser-service';
22
- import { MiniBrowserEndpoint, MiniBrowserEndpointHandler, HtmlHandler, ImageHandler, PdfHandler, SvgHandler } from './mini-browser-endpoint';
21
+ import { MiniBrowserService, MiniBrowserServicePath } from '../common/mini-browser-service.js';
22
+ import { MiniBrowserEndpoint, MiniBrowserEndpointHandler, HtmlHandler, ImageHandler, PdfHandler, SvgHandler } from './mini-browser-endpoint.js';
23
23
  import { WsRequestValidatorContribution } from '@theia/core/lib/node/ws-request-validators';
24
- import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator';
25
- import { MiniBrowserBackendSecurityWarnings } from './mini-browser-backend-security-warnings';
24
+ import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator.js';
25
+ import { MiniBrowserBackendSecurityWarnings } from './mini-browser-backend-security-warnings.js';
26
26
 
27
27
  export default new ContainerModule(bind => {
28
28
  bind(MiniBrowserEndpoint).toSelf().inSingletonScope();
@@ -17,7 +17,7 @@
17
17
  import { BackendApplicationContribution } from '@theia/core/lib/node';
18
18
  import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
19
19
  import { injectable, inject, named } from '@theia/core/shared/inversify';
20
- import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
20
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint.js';
21
21
  import { ILogger } from '@theia/core';
22
22
 
23
23
  @injectable()
@@ -14,19 +14,18 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- const vhost = require('vhost');
18
- import express = require('@theia/core/shared/express');
17
+ import express, { Application, Request, Response } from '@theia/core/shared/express';
19
18
  import * as fs from '@theia/core/shared/fs-extra';
20
19
  import { lookup } from 'mime-types';
21
20
  import { injectable, inject, named } from '@theia/core/shared/inversify';
22
- import { Application, Request, Response } from '@theia/core/shared/express';
23
21
  import { FileUri } from '@theia/core/lib/common/file-uri';
24
22
  import { ILogger } from '@theia/core/lib/common/logger';
25
23
  import { MaybePromise } from '@theia/core/lib/common/types';
26
24
  import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
27
25
  import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
28
- import { MiniBrowserService } from '../common/mini-browser-service';
29
- import { MiniBrowserEndpoint as MiniBrowserEndpointNS } from '../common/mini-browser-endpoint';
26
+ import { MiniBrowserService } from '../common/mini-browser-service.js';
27
+ import { MiniBrowserEndpoint as MiniBrowserEndpointNS } from '../common/mini-browser-endpoint.js';
28
+ import vhost from 'vhost';
30
29
 
31
30
  /**
32
31
  * The return type of the `FileSystem#resolveContent` method.
@@ -93,7 +92,7 @@ export class MiniBrowserEndpoint implements BackendApplicationContribution, Mini
93
92
  const extensions = await handler.supportedExtensions();
94
93
  for (const extension of (Array.isArray(extensions) ? extensions : [extensions]).map(e => e.toLocaleLowerCase())) {
95
94
  const existingHandler = this.handlers.get(extension);
96
- if (!existingHandler || handler.priority > existingHandler.priority) {
95
+ if (!existingHandler || handler.priority() > existingHandler.priority()) {
97
96
  this.handlers.set(extension, handler);
98
97
  }
99
98
  }
@@ -116,8 +115,8 @@ export class MiniBrowserEndpoint implements BackendApplicationContribution, Mini
116
115
  if (!exists) {
117
116
  return this.missingResourceHandler()(uri, response);
118
117
  }
119
- const statWithContent = await this.readContent(uri);
120
118
  try {
119
+ const statWithContent = await this.readContent(uri);
121
120
  if (!statWithContent.stat.isDirectory()) {
122
121
  const extension = uri.split('.').pop();
123
122
  if (!extension) {
@@ -127,12 +126,12 @@ export class MiniBrowserEndpoint implements BackendApplicationContribution, Mini
127
126
  if (!handler) {
128
127
  return this.defaultHandler()(statWithContent, response);
129
128
  }
130
- return handler.respond(statWithContent, response);
129
+ return await handler.respond(statWithContent, response);
131
130
  }
131
+ return this.defaultHandler()(statWithContent, response);
132
132
  } catch (e) {
133
133
  return this.errorHandler()(e, uri, response);
134
134
  }
135
- return this.defaultHandler()(statWithContent, response);
136
135
  }
137
136
 
138
137
  protected getContributions(): MiniBrowserEndpointHandler[] {
@@ -241,15 +240,11 @@ export class ImageHandler implements MiniBrowserEndpointHandler {
241
240
  return CODE_EDITOR_PRIORITY + 1;
242
241
  }
243
242
 
244
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response> {
245
- fs.readFile(FileUri.fsPath(statWithContent.stat.uri), (error, data) => {
246
- if (error) {
247
- throw error;
248
- }
249
- response.contentType('image/jpeg');
250
- response.send(data);
251
- });
252
- return response;
243
+ async respond(statWithContent: FileStatWithContent, response: Response): Promise<Response> {
244
+ const fsPath = FileUri.fsPath(statWithContent.stat.uri);
245
+ const data = await fs.readFile(fsPath);
246
+ response.contentType(lookup(fsPath) || 'application/octet-stream');
247
+ return response.send(data);
253
248
  }
254
249
 
255
250
  }
@@ -268,7 +263,7 @@ export class PdfHandler implements MiniBrowserEndpointHandler {
268
263
  return CODE_EDITOR_PRIORITY + 1;
269
264
  }
270
265
 
271
- respond(statWithContent: FileStatWithContent, response: Response): MaybePromise<Response> {
266
+ async respond(statWithContent: FileStatWithContent, response: Response): Promise<Response> {
272
267
  // https://stackoverflow.com/questions/11598274/display-pdf-in-browser-using-express-js
273
268
  const encodeRFC5987ValueChars = (input: string) =>
274
269
  encodeURIComponent(input).
@@ -279,16 +274,12 @@ export class PdfHandler implements MiniBrowserEndpointHandler {
279
274
  replace(/%(?:7C|60|5E)/g, unescape);
280
275
 
281
276
  const fileName = FileUri.create(statWithContent.stat.uri).path.base;
282
- fs.readFile(FileUri.fsPath(statWithContent.stat.uri), (error, data) => {
283
- if (error) {
284
- throw error;
285
- }
286
- // Change `inline` to `attachment` if you would like to force downloading the PDF instead of previewing in the browser.
287
- response.setHeader('Content-disposition', `inline; filename*=UTF-8''${encodeRFC5987ValueChars(fileName)}`);
288
- response.contentType('application/pdf');
289
- response.send(data);
290
- });
291
- return response;
277
+ const data = await fs.readFile(FileUri.fsPath(statWithContent.stat.uri));
278
+
279
+ // Change `inline` to `attachment` if you would like to force downloading the PDF instead of previewing in the browser.
280
+ response.setHeader('Content-disposition', `inline; filename*=UTF-8''${encodeRFC5987ValueChars(fileName)}`);
281
+ response.contentType('application/pdf');
282
+ return response.send(data);
292
283
  }
293
284
 
294
285
  }
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { expect } from 'chai';
18
18
  import * as http from 'http';
19
- import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator';
19
+ import { MiniBrowserWsRequestValidator } from './mini-browser-ws-validator.js';
20
20
 
21
21
  describe('MiniBrowserWsRequestValidator', () => {
22
22
 
@@ -17,7 +17,7 @@
17
17
  import { WsRequestValidatorContribution } from '@theia/core/lib/node/ws-request-validators';
18
18
  import * as http from 'http';
19
19
  import { injectable, postConstruct } from '@theia/core/shared/inversify';
20
- import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint';
20
+ import { MiniBrowserEndpoint } from '../common/mini-browser-endpoint.js';
21
21
 
22
22
  /**
23
23
  * Prevents explicit WebSocket connections from the mini-browser virtual host.
@@ -0,0 +1,21 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 EclipseSource and others.
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
+ declare module 'vhost' {
18
+ type RequestHandler = (request: unknown, response: unknown, next: () => void) => void;
19
+ function vhost(hostname: string | RegExp, handler: RequestHandler): RequestHandler;
20
+ export = vhost;
21
+ }