@mongosh/browser-runtime-electron 1.10.1 → 1.10.2
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.
- package/.depcheckrc +13 -0
- package/.eslintrc.js +10 -1
- package/.prettierignore +6 -0
- package/.prettierrc.json +1 -0
- package/AUTHORS +1 -0
- package/README.md +2 -2
- package/lib/electron-interpreter-environment.d.ts +2 -2
- package/lib/electron-interpreter-environment.js.map +1 -1
- package/lib/electron-runtime.d.ts +2 -2
- package/lib/electron-runtime.js +3 -1
- package/lib/electron-runtime.js.map +1 -1
- package/package.json +21 -11
- package/src/electron-interpreter-environment.spec.ts +5 -5
- package/src/electron-interpreter-environment.ts +4 -3
- package/src/electron-runtime.spec.ts +53 -41
- package/src/electron-runtime.ts +12 -10
- package/tsconfig-lint.json +5 -0
- package/tsconfig.json +3 -7
- package/tsconfig.lint.json +0 -8
package/.depcheckrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ignores:
|
|
2
|
+
- '@mongodb-js/eslint-config-mongosh'
|
|
3
|
+
- '@mongodb-js/tsconfig-mongosh'
|
|
4
|
+
- '@mongodb-js/prettier-config-devtools'
|
|
5
|
+
- '@typescript-eslint/parser'
|
|
6
|
+
- '@typescript-eslint/eslint-plugin'
|
|
7
|
+
- chai
|
|
8
|
+
- sinon-chai
|
|
9
|
+
- sinon
|
|
10
|
+
- eslint-plugin-mocha
|
|
11
|
+
- eslint-config-mongodb-js
|
|
12
|
+
ignore-patterns:
|
|
13
|
+
- .eslintrc.js
|
package/.eslintrc.js
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
root: true,
|
|
5
|
+
extends: ['@mongodb-js/eslint-config-mongosh'],
|
|
6
|
+
parserOptions: {
|
|
7
|
+
tsconfigRootDir: fixCygwinPath(__dirname),
|
|
8
|
+
project: ['./tsconfig-lint.json'],
|
|
9
|
+
},
|
|
10
|
+
};
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"@mongodb-js/prettier-config-devtools"
|
package/AUTHORS
CHANGED
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
`Runtime` implementation that uses Node.js `vm` module as sandbox for
|
|
6
6
|
code execution.
|
|
7
7
|
|
|
8
|
-
```
|
|
8
|
+
```js
|
|
9
9
|
import { ElectronRuntime } from 'mongosh-browser-repl';
|
|
10
10
|
|
|
11
11
|
const runtime = new ElectronRuntime(serviceProvider);
|
|
@@ -13,7 +13,7 @@ const runtime = new ElectronRuntime(serviceProvider);
|
|
|
13
13
|
|
|
14
14
|
##### Example: usage in Compass
|
|
15
15
|
|
|
16
|
-
```
|
|
16
|
+
```js
|
|
17
17
|
import { Shell, ElectronRuntime } from 'mongosh-browser-repl';
|
|
18
18
|
|
|
19
19
|
const runtime = new ElectronRuntime(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Context } from 'vm';
|
|
3
|
-
import { ContextValue, InterpreterEnvironment } from '@mongosh/browser-runtime-core';
|
|
2
|
+
import type { Context } from 'vm';
|
|
3
|
+
import type { ContextValue, InterpreterEnvironment } from '@mongosh/browser-runtime-core';
|
|
4
4
|
export declare class ElectronInterpreterEnvironment implements InterpreterEnvironment {
|
|
5
5
|
private context;
|
|
6
6
|
constructor(context: Context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-interpreter-environment.js","sourceRoot":"","sources":["../src/electron-interpreter-environment.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"electron-interpreter-environment.js","sourceRoot":"","sources":["../src/electron-interpreter-environment.ts"],"names":[],"mappings":";;;;;;AACA,4CAAoB;AAOpB,MAAa,8BAA8B;IAGzC,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,OAAO,YAAE,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAfD,wEAeC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Runtime, Completion, RuntimeEvaluationListener, RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
|
|
2
|
-
import { ServiceProvider } from '@mongosh/service-provider-core';
|
|
1
|
+
import type { Runtime, Completion, RuntimeEvaluationListener, RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
|
|
2
|
+
import type { ServiceProvider } from '@mongosh/service-provider-core';
|
|
3
3
|
import type { MongoshBus } from '@mongosh/types';
|
|
4
4
|
export declare class ElectronRuntime implements Runtime {
|
|
5
5
|
private openContextRuntime;
|
package/lib/electron-runtime.js
CHANGED
|
@@ -5,7 +5,9 @@ const electron_interpreter_environment_1 = require("./electron-interpreter-envir
|
|
|
5
5
|
const browser_runtime_core_1 = require("@mongosh/browser-runtime-core");
|
|
6
6
|
class ElectronRuntime {
|
|
7
7
|
constructor(serviceProvider, messageBus) {
|
|
8
|
-
const requireFunc = typeof __webpack_require__ === 'function'
|
|
8
|
+
const requireFunc = typeof __webpack_require__ === 'function'
|
|
9
|
+
? __non_webpack_require__
|
|
10
|
+
: require;
|
|
9
11
|
this.openContextRuntime = new browser_runtime_core_1.OpenContextRuntime(serviceProvider, new electron_interpreter_environment_1.ElectronInterpreterEnvironment({ require: requireFunc }), messageBus);
|
|
10
12
|
}
|
|
11
13
|
setEvaluationListener(listener) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electron-runtime.js","sourceRoot":"","sources":["../src/electron-runtime.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"electron-runtime.js","sourceRoot":"","sources":["../src/electron-runtime.ts"],"names":[],"mappings":";;;AAAA,yFAAoF;AAQpF,wEAAmE;AAQnE,MAAa,eAAe;IAG1B,YAAY,eAAgC,EAAE,UAAuB;QAcnE,MAAM,WAAW,GACf,OAAO,mBAAmB,KAAK,UAAU;YACvC,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,OAAO,CAAC;QAEd,IAAI,CAAC,kBAAkB,GAAG,IAAI,yCAAkB,CAC9C,eAAe,EACf,IAAI,iEAA8B,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAC5D,UAAU,CACX,CAAC;IACJ,CAAC;IAED,qBAAqB,CACnB,QAAmC;QAEnC,OAAO,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,IAAY;QAC/B,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC;IACxD,CAAC;CACF;AA9CD,0CA8CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/browser-runtime-electron",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Mongosh browser runtime electron",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -17,11 +17,15 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test": "mocha -r \"../../scripts/import-expansions.js\" --timeout 60000 -r ts-node/register \"./{src,lib}/**/*.spec.ts\"",
|
|
19
19
|
"test-ci": "node ../../scripts/run-if-package-requested.js npm test",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"eslint": "eslint",
|
|
21
|
+
"lint": "npm run eslint . && npm run prettier -- --check .",
|
|
22
|
+
"check": "npm run lint && npm run depcheck",
|
|
23
|
+
"depcheck": "depcheck",
|
|
22
24
|
"preprepublish": "rimraf ./lib",
|
|
23
|
-
"prepublish": "npm run compile
|
|
24
|
-
"compile
|
|
25
|
+
"prepublish": "npm run compile",
|
|
26
|
+
"compile": "tsc -p tsconfig.json",
|
|
27
|
+
"prettier": "prettier",
|
|
28
|
+
"reformat": "npm run prettier -- --write . && npm run eslint --fix"
|
|
25
29
|
},
|
|
26
30
|
"author": "",
|
|
27
31
|
"license": "Apache-2.0",
|
|
@@ -32,15 +36,21 @@
|
|
|
32
36
|
"unitTestsOnly": true
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
|
-
"@
|
|
39
|
+
"@mongodb-js/eslint-config-mongosh": "1.10.2",
|
|
40
|
+
"@mongodb-js/prettier-config-devtools": "^1.0.1",
|
|
41
|
+
"@mongodb-js/tsconfig-mongosh": "1.10.2",
|
|
42
|
+
"@mongosh/service-provider-server": "1.10.2",
|
|
36
43
|
"@types/sinon": "^7.5.1",
|
|
37
|
-
"@types/sinon-chai": "^3.2.
|
|
44
|
+
"@types/sinon-chai": "^3.2.4",
|
|
45
|
+
"depcheck": "^1.4.3",
|
|
46
|
+
"eslint": "^7.25.0",
|
|
47
|
+
"prettier": "^2.8.8",
|
|
38
48
|
"rimraf": "^3.0.2"
|
|
39
49
|
},
|
|
40
50
|
"dependencies": {
|
|
41
|
-
"@mongosh/browser-runtime-core": "1.10.
|
|
42
|
-
"@mongosh/service-provider-core": "1.10.
|
|
43
|
-
"@mongosh/types": "1.10.
|
|
51
|
+
"@mongosh/browser-runtime-core": "1.10.2",
|
|
52
|
+
"@mongosh/service-provider-core": "1.10.2",
|
|
53
|
+
"@mongosh/types": "1.10.2"
|
|
44
54
|
},
|
|
45
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "9351a54cc24def10a97fe7f8c7b455c02fdce62e"
|
|
46
56
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ElectronInterpreterEnvironment } from './electron-interpreter-environment';
|
|
2
2
|
import { expect } from 'chai';
|
|
3
3
|
|
|
4
|
-
describe('IframeRuntime', ()
|
|
5
|
-
describe('#sloppyEval', ()
|
|
6
|
-
it('evaluates code in context', ()
|
|
4
|
+
describe('IframeRuntime', function () {
|
|
5
|
+
describe('#sloppyEval', function () {
|
|
6
|
+
it('evaluates code in context', function () {
|
|
7
7
|
const env = new ElectronInterpreterEnvironment({ x: 2 });
|
|
8
8
|
expect(env.sloppyEval('x + 1')).to.equal(3);
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
describe('#getContextObject', ()
|
|
13
|
-
it('returns context', ()
|
|
12
|
+
describe('#getContextObject', function () {
|
|
13
|
+
it('returns context', function () {
|
|
14
14
|
const env = new ElectronInterpreterEnvironment({ x: 2 });
|
|
15
15
|
expect(env.getContextObject().x).to.equal(2);
|
|
16
16
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Context } from 'vm';
|
|
2
|
+
import vm from 'vm';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import type {
|
|
4
5
|
ContextValue,
|
|
5
|
-
InterpreterEnvironment
|
|
6
|
+
InterpreterEnvironment,
|
|
6
7
|
} from '@mongosh/browser-runtime-core';
|
|
7
8
|
|
|
8
9
|
export class ElectronInterpreterEnvironment implements InterpreterEnvironment {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { SinonStubbedInstance } from 'sinon';
|
|
2
|
+
import sinon from 'sinon';
|
|
2
3
|
import chai from 'chai';
|
|
3
4
|
import sinonChai from 'sinon-chai';
|
|
4
5
|
chai.use(sinonChai);
|
|
@@ -8,18 +9,20 @@ import { CliServiceProvider } from '@mongosh/service-provider-server';
|
|
|
8
9
|
import { bson } from '@mongosh/service-provider-core';
|
|
9
10
|
import { ElectronRuntime } from './electron-runtime';
|
|
10
11
|
import { EventEmitter } from 'events';
|
|
11
|
-
import { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
|
|
12
|
+
import type { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
|
|
12
13
|
|
|
13
|
-
describe('Electron runtime', function() {
|
|
14
|
+
describe('Electron runtime', function () {
|
|
14
15
|
let serviceProvider: SinonStubbedInstance<CliServiceProvider>;
|
|
15
16
|
let messageBus: SinonStubbedInstance<EventEmitter>;
|
|
16
17
|
let evaluationListener: SinonStubbedInstance<RuntimeEvaluationListener>;
|
|
17
18
|
let electronRuntime: ElectronRuntime;
|
|
18
19
|
|
|
19
|
-
beforeEach(()
|
|
20
|
+
beforeEach(function () {
|
|
20
21
|
serviceProvider = sinon.createStubInstance(CliServiceProvider);
|
|
21
22
|
serviceProvider.bsonLibrary = bson;
|
|
22
|
-
serviceProvider.getConnectionInfo.resolves({
|
|
23
|
+
serviceProvider.getConnectionInfo.resolves({
|
|
24
|
+
extraInfo: { uri: '' },
|
|
25
|
+
} as any);
|
|
23
26
|
messageBus = sinon.createStubInstance(EventEmitter);
|
|
24
27
|
evaluationListener = sinon.createStubInstance(class FakeListener {});
|
|
25
28
|
evaluationListener.onPrint = sinon.stub();
|
|
@@ -27,16 +30,16 @@ describe('Electron runtime', function() {
|
|
|
27
30
|
electronRuntime.setEvaluationListener(evaluationListener as any);
|
|
28
31
|
});
|
|
29
32
|
|
|
30
|
-
it('can evaluate simple js', async()
|
|
33
|
+
it('can evaluate simple js', async function () {
|
|
31
34
|
const result = await electronRuntime.evaluate('2 + 2');
|
|
32
35
|
expect(result.printable).to.equal(4);
|
|
33
36
|
});
|
|
34
|
-
it('prints BSON help correctly', async()
|
|
37
|
+
it('prints BSON help correctly', async function () {
|
|
35
38
|
const result = await electronRuntime.evaluate('ObjectId().help');
|
|
36
39
|
expect(result.type).to.equal('Help');
|
|
37
40
|
});
|
|
38
41
|
|
|
39
|
-
it('allows do declare variables', async()
|
|
42
|
+
it('allows do declare variables', async function () {
|
|
40
43
|
await electronRuntime.evaluate('var x = 2');
|
|
41
44
|
expect((await electronRuntime.evaluate('x')).printable).to.equal(2);
|
|
42
45
|
await electronRuntime.evaluate('let y = 2');
|
|
@@ -45,82 +48,91 @@ describe('Electron runtime', function() {
|
|
|
45
48
|
expect((await electronRuntime.evaluate('z')).printable).to.equal(2);
|
|
46
49
|
});
|
|
47
50
|
|
|
48
|
-
it('allows do declare functions', async()
|
|
51
|
+
it('allows do declare functions', async function () {
|
|
49
52
|
await electronRuntime.evaluate('function f() { return 2; }');
|
|
50
53
|
expect((await electronRuntime.evaluate('f()')).printable).to.equal(2);
|
|
51
54
|
});
|
|
52
55
|
|
|
53
|
-
it('can run help', async()
|
|
56
|
+
it('can run help', async function () {
|
|
54
57
|
const result = await electronRuntime.evaluate('help');
|
|
55
58
|
expect(result.type).to.equal('Help');
|
|
56
59
|
});
|
|
57
60
|
|
|
58
|
-
it('can run show dbs', async()
|
|
61
|
+
it('can run show dbs', async function () {
|
|
59
62
|
serviceProvider.listDatabases.resolves({
|
|
60
|
-
databases: []
|
|
63
|
+
databases: [],
|
|
61
64
|
});
|
|
62
65
|
|
|
63
66
|
const result = await electronRuntime.evaluate('show dbs');
|
|
64
67
|
expect(result.type).to.equal('ShowDatabasesResult');
|
|
65
68
|
});
|
|
66
69
|
|
|
67
|
-
it('can run show collections', async()
|
|
70
|
+
it('can run show collections', async function () {
|
|
68
71
|
serviceProvider.listCollections.resolves([]);
|
|
69
72
|
|
|
70
73
|
const result = await electronRuntime.evaluate('show collections');
|
|
71
74
|
expect(result.type).to.equal('ShowCollectionsResult');
|
|
72
75
|
});
|
|
73
76
|
|
|
74
|
-
it('allows to use require', async()
|
|
75
|
-
const result = await electronRuntime.evaluate(
|
|
77
|
+
it('allows to use require', async function () {
|
|
78
|
+
const result = await electronRuntime.evaluate(
|
|
79
|
+
'require("util").types.isDate(new Date())'
|
|
80
|
+
);
|
|
76
81
|
expect(result.printable).to.equal(true);
|
|
77
82
|
});
|
|
78
83
|
|
|
79
|
-
it('can switch database', async()
|
|
80
|
-
expect(
|
|
81
|
-
|
|
82
|
-
)
|
|
84
|
+
it('can switch database', async function () {
|
|
85
|
+
expect((await electronRuntime.evaluate('db')).printable).not.to.equal(
|
|
86
|
+
'db1'
|
|
87
|
+
);
|
|
83
88
|
|
|
84
89
|
await electronRuntime.evaluate('use db1');
|
|
85
90
|
|
|
86
|
-
expect(
|
|
87
|
-
(await electronRuntime.evaluate('db')).printable
|
|
88
|
-
).to.equal('db1');
|
|
91
|
+
expect((await electronRuntime.evaluate('db')).printable).to.equal('db1');
|
|
89
92
|
});
|
|
90
93
|
|
|
91
|
-
it('allows to receive telemetry event passing a message bus', async()
|
|
94
|
+
it('allows to receive telemetry event passing a message bus', async function () {
|
|
92
95
|
await electronRuntime.evaluate('use db1');
|
|
93
96
|
expect(messageBus.emit).to.have.been.calledWith('mongosh:use');
|
|
94
97
|
});
|
|
95
98
|
|
|
96
|
-
describe('onPrint', ()
|
|
97
|
-
it('allows getting the output of print() statements', async()
|
|
99
|
+
describe('onPrint', function () {
|
|
100
|
+
it('allows getting the output of print() statements', async function () {
|
|
98
101
|
await electronRuntime.evaluate('print("foo");');
|
|
99
102
|
expect(evaluationListener.onPrint).to.have.been.calledWithMatch(
|
|
100
|
-
sinon.match(
|
|
101
|
-
array
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
sinon.match(
|
|
104
|
+
(array) =>
|
|
105
|
+
array.length === 1 &&
|
|
106
|
+
array[0].type === null &&
|
|
107
|
+
array[0].printable === 'foo'
|
|
108
|
+
)
|
|
109
|
+
);
|
|
104
110
|
});
|
|
105
111
|
|
|
106
|
-
it('allows getting the output of console.log() statements', async()
|
|
112
|
+
it('allows getting the output of console.log() statements', async function () {
|
|
107
113
|
await electronRuntime.evaluate('console.log("foo");');
|
|
108
114
|
expect(evaluationListener.onPrint).to.have.been.calledWithMatch(
|
|
109
|
-
sinon.match(
|
|
110
|
-
array
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
sinon.match(
|
|
116
|
+
(array) =>
|
|
117
|
+
array.length === 1 &&
|
|
118
|
+
array[0].type === null &&
|
|
119
|
+
array[0].printable === 'foo'
|
|
120
|
+
)
|
|
121
|
+
);
|
|
113
122
|
});
|
|
114
123
|
|
|
115
|
-
it('allows getting the output of multi-arg console.log() statements', async()
|
|
124
|
+
it('allows getting the output of multi-arg console.log() statements', async function () {
|
|
116
125
|
await electronRuntime.evaluate('console.log("foo", "bar");');
|
|
117
126
|
expect(evaluationListener.onPrint).to.have.been.calledWithMatch(
|
|
118
|
-
sinon.match(
|
|
119
|
-
array
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
sinon.match(
|
|
128
|
+
(array) =>
|
|
129
|
+
array.length === 2 &&
|
|
130
|
+
array[0].type === null &&
|
|
131
|
+
array[0].printable === 'foo' &&
|
|
132
|
+
array[1].type === null &&
|
|
133
|
+
array[1].printable === 'bar'
|
|
134
|
+
)
|
|
135
|
+
);
|
|
124
136
|
expect(evaluationListener.onPrint).to.have.been.calledOnce;
|
|
125
137
|
});
|
|
126
138
|
});
|
package/src/electron-runtime.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
ElectronInterpreterEnvironment
|
|
4
|
-
} from './electron-interpreter-environment';
|
|
1
|
+
import { ElectronInterpreterEnvironment } from './electron-interpreter-environment';
|
|
5
2
|
|
|
6
|
-
import {
|
|
3
|
+
import type {
|
|
7
4
|
Runtime,
|
|
8
|
-
OpenContextRuntime,
|
|
9
5
|
Completion,
|
|
10
6
|
RuntimeEvaluationListener,
|
|
11
|
-
RuntimeEvaluationResult
|
|
7
|
+
RuntimeEvaluationResult,
|
|
12
8
|
} from '@mongosh/browser-runtime-core';
|
|
9
|
+
import { OpenContextRuntime } from '@mongosh/browser-runtime-core';
|
|
13
10
|
|
|
14
|
-
import { ServiceProvider } from '@mongosh/service-provider-core';
|
|
11
|
+
import type { ServiceProvider } from '@mongosh/service-provider-core';
|
|
15
12
|
import type { MongoshBus } from '@mongosh/types';
|
|
16
13
|
|
|
17
14
|
declare const __webpack_require__: any;
|
|
@@ -34,7 +31,10 @@ export class ElectronRuntime implements Runtime {
|
|
|
34
31
|
// changing this line: https://github.com/webpack/webpack/issues/5939 (it
|
|
35
32
|
// seems that checking for `typeof __non_webpack_require__` does not work).
|
|
36
33
|
//
|
|
37
|
-
const requireFunc =
|
|
34
|
+
const requireFunc =
|
|
35
|
+
typeof __webpack_require__ === 'function'
|
|
36
|
+
? __non_webpack_require__
|
|
37
|
+
: require;
|
|
38
38
|
|
|
39
39
|
this.openContextRuntime = new OpenContextRuntime(
|
|
40
40
|
serviceProvider,
|
|
@@ -43,7 +43,9 @@ export class ElectronRuntime implements Runtime {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
setEvaluationListener(
|
|
46
|
+
setEvaluationListener(
|
|
47
|
+
listener: RuntimeEvaluationListener
|
|
48
|
+
): RuntimeEvaluationListener | null {
|
|
47
49
|
return this.openContextRuntime.setEvaluationListener(listener);
|
|
48
50
|
}
|
|
49
51
|
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "
|
|
2
|
+
"extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "./lib"
|
|
5
5
|
},
|
|
6
|
-
"include": [
|
|
7
|
-
|
|
8
|
-
],
|
|
9
|
-
"exclude": [
|
|
10
|
-
"./src/**/*.spec.*"
|
|
11
|
-
]
|
|
6
|
+
"include": ["src/**/*"],
|
|
7
|
+
"exclude": ["./src/**/*.spec.*"]
|
|
12
8
|
}
|