@jsii/runtime 1.66.0 → 1.68.0
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/lib/host.d.ts +1 -0
- package/lib/host.js +13 -10
- package/lib/program.js +2 -1
- package/package.json +7 -7
- package/test/__snapshots__/kernel-host.test.js.snap +19 -19
- package/webpack/bin/jsii-runtime.js +2653 -986
- package/webpack/lib/program.js +11363 -5410
package/lib/host.d.ts
CHANGED
package/lib/host.js
CHANGED
|
@@ -5,11 +5,13 @@ const kernel_1 = require("@jsii/kernel");
|
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
class KernelHost {
|
|
7
7
|
constructor(inout, opts = {}) {
|
|
8
|
+
var _a, _b;
|
|
8
9
|
this.inout = inout;
|
|
9
10
|
this.opts = opts;
|
|
10
11
|
this.kernel = new kernel_1.Kernel(this.callbackHandler.bind(this));
|
|
11
12
|
this.eventEmitter = new events_1.EventEmitter();
|
|
12
|
-
this.kernel.traceEnabled = opts.debug ?
|
|
13
|
+
this.kernel.traceEnabled = (_a = opts.debug) !== null && _a !== void 0 ? _a : false;
|
|
14
|
+
this.kernel.debugTimingEnabled = (_b = opts.debugTiming) !== null && _b !== void 0 ? _b : false;
|
|
13
15
|
}
|
|
14
16
|
run() {
|
|
15
17
|
var _a;
|
|
@@ -36,7 +38,7 @@ class KernelHost {
|
|
|
36
38
|
function completeCallback() {
|
|
37
39
|
const req = this.inout.read();
|
|
38
40
|
if (!req || 'exit' in req) {
|
|
39
|
-
throw new
|
|
41
|
+
throw new kernel_1.JsiiFault('Interrupted before callback returned');
|
|
40
42
|
}
|
|
41
43
|
// if this is a completion for the current callback, then we can
|
|
42
44
|
// finally stop this nonsense and return the result.
|
|
@@ -44,7 +46,7 @@ class KernelHost {
|
|
|
44
46
|
if ('complete' in completeReq &&
|
|
45
47
|
completeReq.complete.cbid === callback.cbid) {
|
|
46
48
|
if (completeReq.complete.err) {
|
|
47
|
-
throw new
|
|
49
|
+
throw new kernel_1.JsiiFault(completeReq.complete.err);
|
|
48
50
|
}
|
|
49
51
|
return completeReq.complete.result;
|
|
50
52
|
}
|
|
@@ -72,10 +74,10 @@ class KernelHost {
|
|
|
72
74
|
*/
|
|
73
75
|
processRequest(req, next, sync = false) {
|
|
74
76
|
if ('callback' in req) {
|
|
75
|
-
throw new
|
|
77
|
+
throw new kernel_1.JsiiFault('Unexpected `callback` result. This request should have been processed by a callback handler');
|
|
76
78
|
}
|
|
77
79
|
if (!('api' in req)) {
|
|
78
|
-
throw new
|
|
80
|
+
throw new kernel_1.JsiiFault('Malformed request, "api" field is required');
|
|
79
81
|
}
|
|
80
82
|
const apiReq = req;
|
|
81
83
|
const fn = this.findApi(apiReq.api);
|
|
@@ -125,7 +127,7 @@ class KernelHost {
|
|
|
125
127
|
return next();
|
|
126
128
|
function checkIfAsyncIsAllowed() {
|
|
127
129
|
if (sync) {
|
|
128
|
-
throw new
|
|
130
|
+
throw new kernel_1.JsiiFault('Cannot handle async operations while waiting for a sync callback to return');
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
}
|
|
@@ -140,10 +142,11 @@ class KernelHost {
|
|
|
140
142
|
* Writes an "error" result to stdout.
|
|
141
143
|
*/
|
|
142
144
|
writeError(error) {
|
|
143
|
-
const res = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
const res = {
|
|
146
|
+
error: error.message,
|
|
147
|
+
name: error.name,
|
|
148
|
+
stack: this.opts.noStack ? undefined : error.stack,
|
|
149
|
+
};
|
|
147
150
|
this.inout.write(res);
|
|
148
151
|
}
|
|
149
152
|
/**
|
package/lib/program.js
CHANGED
|
@@ -9,6 +9,7 @@ const name = packageInfo.name;
|
|
|
9
9
|
const version = packageInfo.version;
|
|
10
10
|
const noStack = !!process.env.JSII_NOSTACK;
|
|
11
11
|
const debug = !!process.env.JSII_DEBUG;
|
|
12
|
+
const debugTiming = !!process.env.JSII_DEBUG_TIMING;
|
|
12
13
|
// This assumes FD#3 is opened for reading and writing. This is normally
|
|
13
14
|
// performed by`bin/jsii-runtime.js`, and we will not be verifying this once
|
|
14
15
|
// again...Meaning that failure to have set this up correctly results in
|
|
@@ -23,7 +24,7 @@ const stdio = new sync_stdio_1.SyncStdio({
|
|
|
23
24
|
writeFD: 3,
|
|
24
25
|
});
|
|
25
26
|
const inout = new in_out_1.InputOutput(stdio);
|
|
26
|
-
const host = new host_1.KernelHost(inout, { debug, noStack });
|
|
27
|
+
const host = new host_1.KernelHost(inout, { debug, noStack, debugTiming });
|
|
27
28
|
host.once('exit', process.exit.bind(process));
|
|
28
29
|
// say hello
|
|
29
30
|
inout.write({ hello: `${name}@${version}` });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsii/runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.68.0",
|
|
4
4
|
"description": "jsii runtime kernel process",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"package": "package-js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@jsii/kernel": "^1.
|
|
38
|
-
"@jsii/check-node": "1.
|
|
39
|
-
"@jsii/spec": "^1.
|
|
37
|
+
"@jsii/kernel": "^1.68.0",
|
|
38
|
+
"@jsii/check-node": "1.68.0",
|
|
39
|
+
"@jsii/spec": "^1.68.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@scope/jsii-calc-base": "^1.
|
|
43
|
-
"@scope/jsii-calc-lib": "^1.
|
|
44
|
-
"jsii-build-tools": "^1.
|
|
42
|
+
"@scope/jsii-calc-base": "^1.68.0",
|
|
43
|
+
"@scope/jsii-calc-lib": "^1.68.0",
|
|
44
|
+
"jsii-build-tools": "^1.68.0",
|
|
45
45
|
"jsii-calc": "^3.20.120",
|
|
46
46
|
"source-map-loader": "^4.0.0",
|
|
47
47
|
"webpack": "^5.74.0",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`can load libraries from within a callback 1`] = `
|
|
4
|
-
|
|
5
|
-
"ok":
|
|
4
|
+
{
|
|
5
|
+
"ok": {
|
|
6
6
|
"assembly": "@scope/jsii-calc-base-of-base",
|
|
7
7
|
"types": "*redacted*",
|
|
8
8
|
},
|
|
@@ -10,8 +10,8 @@ Object {
|
|
|
10
10
|
`;
|
|
11
11
|
|
|
12
12
|
exports[`can load libraries from within a callback 2`] = `
|
|
13
|
-
|
|
14
|
-
"ok":
|
|
13
|
+
{
|
|
14
|
+
"ok": {
|
|
15
15
|
"assembly": "@scope/jsii-calc-base",
|
|
16
16
|
"types": "*redacted*",
|
|
17
17
|
},
|
|
@@ -19,8 +19,8 @@ Object {
|
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`can load libraries from within a callback 3`] = `
|
|
22
|
-
|
|
23
|
-
"ok":
|
|
22
|
+
{
|
|
23
|
+
"ok": {
|
|
24
24
|
"assembly": "@scope/jsii-calc-lib",
|
|
25
25
|
"types": "*redacted*",
|
|
26
26
|
},
|
|
@@ -28,10 +28,10 @@ Object {
|
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
30
|
exports[`can load libraries from within a callback 4`] = `
|
|
31
|
-
|
|
32
|
-
"ok":
|
|
31
|
+
{
|
|
32
|
+
"ok": {
|
|
33
33
|
"$jsii.byref": "Object@10000",
|
|
34
|
-
"$jsii.interfaces":
|
|
34
|
+
"$jsii.interfaces": [
|
|
35
35
|
"@scope/jsii-calc-lib.IFriendly",
|
|
36
36
|
],
|
|
37
37
|
},
|
|
@@ -39,16 +39,16 @@ Object {
|
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
41
|
exports[`can load libraries from within a callback 5`] = `
|
|
42
|
-
|
|
43
|
-
"callback":
|
|
42
|
+
{
|
|
43
|
+
"callback": {
|
|
44
44
|
"cbid": "jsii::callback::20000",
|
|
45
45
|
"cookie": undefined,
|
|
46
|
-
"invoke":
|
|
47
|
-
"args":
|
|
46
|
+
"invoke": {
|
|
47
|
+
"args": [],
|
|
48
48
|
"method": "hello",
|
|
49
|
-
"objref":
|
|
49
|
+
"objref": {
|
|
50
50
|
"$jsii.byref": "Object@10000",
|
|
51
|
-
"$jsii.interfaces":
|
|
51
|
+
"$jsii.interfaces": [
|
|
52
52
|
"@scope/jsii-calc-lib.IFriendly",
|
|
53
53
|
],
|
|
54
54
|
},
|
|
@@ -58,8 +58,8 @@ Object {
|
|
|
58
58
|
`;
|
|
59
59
|
|
|
60
60
|
exports[`can load libraries from within a callback 6`] = `
|
|
61
|
-
|
|
62
|
-
"ok":
|
|
61
|
+
{
|
|
62
|
+
"ok": {
|
|
63
63
|
"assembly": "jsii-calc",
|
|
64
64
|
"types": "*redacted*",
|
|
65
65
|
},
|
|
@@ -67,8 +67,8 @@ Object {
|
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
69
|
exports[`can load libraries from within a callback 7`] = `
|
|
70
|
-
|
|
71
|
-
"ok":
|
|
70
|
+
{
|
|
71
|
+
"ok": {
|
|
72
72
|
"result": "SUCCESS!",
|
|
73
73
|
},
|
|
74
74
|
}
|