@jsii/runtime 1.65.0 → 1.67.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 CHANGED
@@ -6,6 +6,7 @@ export declare class KernelHost {
6
6
  private readonly eventEmitter;
7
7
  constructor(inout: IInputOutput, opts?: {
8
8
  debug?: boolean;
9
+ debugTiming?: boolean;
9
10
  noStack?: boolean;
10
11
  });
11
12
  run(): void;
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 ? true : false;
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;
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.65.0",
3
+ "version": "1.67.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.65.0",
38
- "@jsii/check-node": "1.65.0",
39
- "@jsii/spec": "^1.65.0"
37
+ "@jsii/kernel": "^1.67.0",
38
+ "@jsii/check-node": "1.67.0",
39
+ "@jsii/spec": "^1.67.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@scope/jsii-calc-base": "^1.65.0",
43
- "@scope/jsii-calc-lib": "^1.65.0",
44
- "jsii-build-tools": "^1.65.0",
42
+ "@scope/jsii-calc-base": "^1.67.0",
43
+ "@scope/jsii-calc-lib": "^1.67.0",
44
+ "jsii-build-tools": "^1.67.0",
45
45
  "jsii-calc": "^3.20.120",
46
46
  "source-map-loader": "^4.0.0",
47
47
  "webpack": "^5.74.0",
@@ -1700,6 +1700,160 @@ var __webpack_modules__ = {
1700
1700
  }
1701
1701
  };
1702
1702
  },
1703
+ 2945: (__unused_webpack_module, exports, __webpack_require__) => {
1704
+ var fs = __webpack_require__(7147), wx = "wx";
1705
+ if (process.version.match(/^v0\.[0-6]/)) {
1706
+ var c = __webpack_require__(2057);
1707
+ wx = c.O_TRUNC | c.O_CREAT | c.O_WRONLY | c.O_EXCL;
1708
+ }
1709
+ var debug, os = __webpack_require__(2037);
1710
+ exports.filetime = "ctime", "win32" == os.platform() && (exports.filetime = "mtime");
1711
+ var util = __webpack_require__(3837);
1712
+ debug = util.debuglog ? util.debuglog("LOCKFILE") : /\blockfile\b/i.test(process.env.NODE_DEBUG) ? function() {
1713
+ var msg = util.format.apply(util, arguments);
1714
+ console.error("LOCKFILE %d %s", process.pid, msg);
1715
+ } : function() {};
1716
+ var locks = {};
1717
+ __webpack_require__(156)((function() {
1718
+ debug("exit listener"), Object.keys(locks).forEach(exports.unlockSync);
1719
+ })), /^v0\.[0-8]\./.test(process.version) && (debug("uncaughtException, version = %s", process.version),
1720
+ process.on("uncaughtException", (function H(er) {
1721
+ if (debug("uncaughtException"), !process.listeners("uncaughtException").filter((function(h) {
1722
+ return h !== H;
1723
+ })).length) {
1724
+ try {
1725
+ Object.keys(locks).forEach(exports.unlockSync);
1726
+ } catch (e) {}
1727
+ throw process.removeListener("uncaughtException", H), er;
1728
+ }
1729
+ }))), exports.unlock = function(path, cb) {
1730
+ debug("unlock", path), delete locks[path], fs.unlink(path, (function(unlinkEr) {
1731
+ cb && cb();
1732
+ }));
1733
+ }, exports.unlockSync = function(path) {
1734
+ debug("unlockSync", path);
1735
+ try {
1736
+ fs.unlinkSync(path);
1737
+ } catch (er) {}
1738
+ delete locks[path];
1739
+ }, exports.check = function(path, opts, cb) {
1740
+ "function" == typeof opts && (cb = opts, opts = {}), debug("check", path, opts),
1741
+ fs.open(path, "r", (function(er, fd) {
1742
+ return er ? "ENOENT" !== er.code ? cb(er) : cb(null, !1) : opts.stale ? void fs.fstat(fd, (function(er, st) {
1743
+ if (er) return fs.close(fd, (function(er2) {
1744
+ return cb(er);
1745
+ }));
1746
+ fs.close(fd, (function(er) {
1747
+ var age = Date.now() - st[exports.filetime].getTime();
1748
+ return cb(er, age <= opts.stale);
1749
+ }));
1750
+ })) : fs.close(fd, (function(er) {
1751
+ return cb(er, !0);
1752
+ }));
1753
+ }));
1754
+ }, exports.checkSync = function(path, opts) {
1755
+ if (debug("checkSync", path, opts = opts || {}), opts.wait) throw new Error("opts.wait not supported sync for obvious reasons");
1756
+ try {
1757
+ var fd = fs.openSync(path, "r");
1758
+ } catch (er) {
1759
+ if ("ENOENT" !== er.code) throw er;
1760
+ return !1;
1761
+ }
1762
+ if (!opts.stale) {
1763
+ try {
1764
+ fs.closeSync(fd);
1765
+ } catch (er) {}
1766
+ return !0;
1767
+ }
1768
+ if (opts.stale) {
1769
+ try {
1770
+ var st = fs.fstatSync(fd);
1771
+ } finally {
1772
+ fs.closeSync(fd);
1773
+ }
1774
+ return Date.now() - st[exports.filetime].getTime() <= opts.stale;
1775
+ }
1776
+ };
1777
+ var req = 1;
1778
+ function maybeStale(originalEr, path, opts, hasStaleLock, cb) {
1779
+ fs.stat(path, (function(statEr, st) {
1780
+ return statEr ? "ENOENT" === statEr.code ? (opts.stale = !1, debug("lock stale enoent retry", path, opts),
1781
+ void exports.lock(path, opts, cb)) : cb(statEr) : Date.now() - st[exports.filetime].getTime() <= opts.stale ? notStale(originalEr, path, opts, cb) : (debug("lock stale", path, opts),
1782
+ void (hasStaleLock ? exports.unlock(path, (function(er) {
1783
+ if (er) return cb(er);
1784
+ debug("lock stale retry", path, opts), fs.link(path + ".STALE", path, (function(er) {
1785
+ fs.unlink(path + ".STALE", (function() {
1786
+ cb(er);
1787
+ }));
1788
+ }));
1789
+ })) : (debug("acquire .STALE file lock", opts), exports.lock(path + ".STALE", opts, (function(er) {
1790
+ if (er) return cb(er);
1791
+ maybeStale(originalEr, path, opts, !0, cb);
1792
+ })))));
1793
+ }));
1794
+ }
1795
+ function notStale(er, path, opts, cb) {
1796
+ if (debug("notStale", path, opts), "number" != typeof opts.wait || opts.wait <= 0) return debug("notStale, wait is not a number"),
1797
+ cb(er);
1798
+ var now = Date.now(), start = opts.start || now, end = start + opts.wait;
1799
+ if (end <= now) return cb(er);
1800
+ debug("now=%d, wait until %d (delta=%d)", start, end, end - start);
1801
+ var wait = Math.min(end - start, opts.pollPeriod || 100);
1802
+ setTimeout((function() {
1803
+ debug("notStale, polling", path, opts), exports.lock(path, opts, cb);
1804
+ }), wait);
1805
+ }
1806
+ function retryThrow(path, opts, er) {
1807
+ if ("number" == typeof opts.retries && opts.retries > 0) {
1808
+ var newRT = opts.retries - 1;
1809
+ return debug("retryThrow", path, opts, newRT), opts.retries = newRT, exports.lockSync(path, opts);
1810
+ }
1811
+ throw er;
1812
+ }
1813
+ exports.lock = function(path, opts, cb) {
1814
+ if ("function" == typeof opts && (cb = opts, opts = {}), opts.req = opts.req || req++,
1815
+ debug("lock", path, opts), opts.start = opts.start || Date.now(), "number" == typeof opts.retries && opts.retries > 0) {
1816
+ debug("has retries", opts.retries);
1817
+ var retries = opts.retries;
1818
+ opts.retries = 0, orig = cb, cb = function cb(er, fd) {
1819
+ if (debug("retry-mutated callback"), retries -= 1, !er || retries < 0) return orig(er, fd);
1820
+ function retry() {
1821
+ opts.start = Date.now(), debug("retrying", opts.start), exports.lock(path, opts, cb);
1822
+ }
1823
+ debug("lock retry", path, opts), opts.retryWait ? setTimeout(retry, opts.retryWait) : retry();
1824
+ };
1825
+ }
1826
+ var orig;
1827
+ fs.open(path, wx, (function(er, fd) {
1828
+ return er ? (debug("failed to acquire lock", er), "EEXIST" !== er.code ? (debug("not EEXIST error", er),
1829
+ cb(er)) : opts.stale ? maybeStale(er, path, opts, !1, cb) : notStale(er, path, opts, cb)) : (debug("locked", path, fd),
1830
+ locks[path] = fd, fs.close(fd, (function() {
1831
+ return cb();
1832
+ })));
1833
+ })), debug("lock return");
1834
+ }, exports.lockSync = function(path, opts) {
1835
+ if ((opts = opts || {}).req = opts.req || req++, debug("lockSync", path, opts),
1836
+ opts.wait || opts.retryWait) throw new Error("opts.wait not supported sync for obvious reasons");
1837
+ try {
1838
+ var fd = fs.openSync(path, wx);
1839
+ locks[path] = fd;
1840
+ try {
1841
+ fs.closeSync(fd);
1842
+ } catch (er) {}
1843
+ return void debug("locked sync!", path, fd);
1844
+ } catch (er) {
1845
+ if ("EEXIST" !== er.code) return retryThrow(path, opts, er);
1846
+ if (opts.stale) {
1847
+ var ct = fs.statSync(path)[exports.filetime].getTime();
1848
+ !(ct % 1e3) && opts.stale % 1e3 && (opts.stale = 1e3 * Math.ceil(opts.stale / 1e3));
1849
+ var age = Date.now() - ct;
1850
+ if (age > opts.stale) return debug("lockSync stale", path, opts, age), exports.unlockSync(path),
1851
+ exports.lockSync(path, opts);
1852
+ }
1853
+ return debug("failed to lock", path, opts, er), retryThrow(path, opts, er);
1854
+ }
1855
+ };
1856
+ },
1703
1857
  2253: (module, __unused_webpack_exports, __webpack_require__) => {
1704
1858
  "use strict";
1705
1859
  const proc = "object" == typeof process && process ? process : {
@@ -2382,6 +2536,76 @@ var __webpack_modules__ = {
2382
2536
  useNativeSync
2383
2537
  };
2384
2538
  },
2539
+ 156: (module, __unused_webpack_exports, __webpack_require__) => {
2540
+ var process = global.process;
2541
+ const processOk = function(process) {
2542
+ return process && "object" == typeof process && "function" == typeof process.removeListener && "function" == typeof process.emit && "function" == typeof process.reallyExit && "function" == typeof process.listeners && "function" == typeof process.kill && "number" == typeof process.pid && "function" == typeof process.on;
2543
+ };
2544
+ if (processOk(process)) {
2545
+ var emitter, assert = __webpack_require__(9491), signals = __webpack_require__(6107), isWin = /^win/i.test(process.platform), EE = __webpack_require__(2361);
2546
+ "function" != typeof EE && (EE = EE.EventEmitter), process.__signal_exit_emitter__ ? emitter = process.__signal_exit_emitter__ : ((emitter = process.__signal_exit_emitter__ = new EE).count = 0,
2547
+ emitter.emitted = {}), emitter.infinite || (emitter.setMaxListeners(1 / 0), emitter.infinite = !0),
2548
+ module.exports = function(cb, opts) {
2549
+ if (!processOk(global.process)) return function() {};
2550
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler"),
2551
+ !1 === loaded && load();
2552
+ var ev = "exit";
2553
+ opts && opts.alwaysLast && (ev = "afterexit");
2554
+ return emitter.on(ev, cb), function() {
2555
+ emitter.removeListener(ev, cb), 0 === emitter.listeners("exit").length && 0 === emitter.listeners("afterexit").length && unload();
2556
+ };
2557
+ };
2558
+ var unload = function() {
2559
+ loaded && processOk(global.process) && (loaded = !1, signals.forEach((function(sig) {
2560
+ try {
2561
+ process.removeListener(sig, sigListeners[sig]);
2562
+ } catch (er) {}
2563
+ })), process.emit = originalProcessEmit, process.reallyExit = originalProcessReallyExit,
2564
+ emitter.count -= 1);
2565
+ };
2566
+ module.exports.unload = unload;
2567
+ var emit = function(event, code, signal) {
2568
+ emitter.emitted[event] || (emitter.emitted[event] = !0, emitter.emit(event, code, signal));
2569
+ }, sigListeners = {};
2570
+ signals.forEach((function(sig) {
2571
+ sigListeners[sig] = function() {
2572
+ processOk(global.process) && (process.listeners(sig).length === emitter.count && (unload(),
2573
+ emit("exit", null, sig), emit("afterexit", null, sig), isWin && "SIGHUP" === sig && (sig = "SIGINT"),
2574
+ process.kill(process.pid, sig)));
2575
+ };
2576
+ })), module.exports.signals = function() {
2577
+ return signals;
2578
+ };
2579
+ var loaded = !1, load = function() {
2580
+ !loaded && processOk(global.process) && (loaded = !0, emitter.count += 1, signals = signals.filter((function(sig) {
2581
+ try {
2582
+ return process.on(sig, sigListeners[sig]), !0;
2583
+ } catch (er) {
2584
+ return !1;
2585
+ }
2586
+ })), process.emit = processEmit, process.reallyExit = processReallyExit);
2587
+ };
2588
+ module.exports.load = load;
2589
+ var originalProcessReallyExit = process.reallyExit, processReallyExit = function(code) {
2590
+ processOk(global.process) && (process.exitCode = code || 0, emit("exit", process.exitCode, null),
2591
+ emit("afterexit", process.exitCode, null), originalProcessReallyExit.call(process, process.exitCode));
2592
+ }, originalProcessEmit = process.emit, processEmit = function(ev, arg) {
2593
+ if ("exit" === ev && processOk(global.process)) {
2594
+ void 0 !== arg && (process.exitCode = arg);
2595
+ var ret = originalProcessEmit.apply(this, arguments);
2596
+ return emit("exit", process.exitCode, null), emit("afterexit", process.exitCode, null),
2597
+ ret;
2598
+ }
2599
+ return originalProcessEmit.apply(this, arguments);
2600
+ };
2601
+ } else module.exports = function() {
2602
+ return function() {};
2603
+ };
2604
+ },
2605
+ 6107: module => {
2606
+ module.exports = [ "SIGABRT", "SIGALRM", "SIGHUP", "SIGINT", "SIGTERM" ], "win32" !== process.platform && module.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT"),
2607
+ "linux" === process.platform && module.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
2608
+ },
2385
2609
  1189: (__unused_webpack_module, exports, __webpack_require__) => {
2386
2610
  "use strict";
2387
2611
  exports.c = exports.create = __webpack_require__(9540), exports.r = exports.replace = __webpack_require__(3666),
@@ -4885,6 +5109,188 @@ var __webpack_modules__ = {
4885
5109
  return null != value.property;
4886
5110
  };
4887
5111
  },
5112
+ 3288: (__unused_webpack_module, exports, __webpack_require__) => {
5113
+ "use strict";
5114
+ Object.defineProperty(exports, "__esModule", {
5115
+ value: !0
5116
+ }), exports.digestFile = void 0;
5117
+ const crypto_1 = __webpack_require__(6113), fs_1 = __webpack_require__(7147);
5118
+ exports.digestFile = function(path, ...comments) {
5119
+ const hash = (0, crypto_1.createHash)("sha256"), buffer = Buffer.alloc(16384), fd = (0,
5120
+ fs_1.openSync)(path, "r");
5121
+ try {
5122
+ let bytesRead = 0;
5123
+ for (;(bytesRead = (0, fs_1.readSync)(fd, buffer)) > 0; ) hash.update(buffer.slice(0, bytesRead));
5124
+ for (const comment of comments) hash.update("\0"), hash.update(comment);
5125
+ return hash.digest();
5126
+ } finally {
5127
+ (0, fs_1.closeSync)(fd);
5128
+ }
5129
+ };
5130
+ },
5131
+ 535: function(__unused_webpack_module, exports, __webpack_require__) {
5132
+ "use strict";
5133
+ var _DiskCache_root, __classPrivateFieldSet = this && this.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
5134
+ if ("m" === kind) throw new TypeError("Private method is not writable");
5135
+ if ("a" === kind && !f) throw new TypeError("Private accessor was defined without a setter");
5136
+ if ("function" == typeof state ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5137
+ return "a" === kind ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value),
5138
+ value;
5139
+ }, __classPrivateFieldGet = this && this.__classPrivateFieldGet || function(receiver, state, kind, f) {
5140
+ if ("a" === kind && !f) throw new TypeError("Private accessor was defined without a getter");
5141
+ if ("function" == typeof state ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5142
+ return "m" === kind ? f : "a" === kind ? f.call(receiver) : f ? f.value : state.get(receiver);
5143
+ };
5144
+ Object.defineProperty(exports, "__esModule", {
5145
+ value: !0
5146
+ }), exports.Entry = exports.DiskCache = void 0;
5147
+ const fs_1 = __webpack_require__(7147), lockfile_1 = __webpack_require__(2945), path_1 = __webpack_require__(4822), digest_file_1 = __webpack_require__(3288), PRUNE_AFTER_MILLISECONDS = process.env.JSII_RUNTIME_PACKAGE_CACHE_TTL ? 864e5 * parseInt(process.env.JSII_RUNTIME_PACKAGE_CACHE_TTL, 10) : 2592e6;
5148
+ class DiskCache {
5149
+ constructor(root) {
5150
+ _DiskCache_root.set(this, void 0), __classPrivateFieldSet(this, _DiskCache_root, root, "f"),
5151
+ process.once("beforeExit", (() => this.pruneExpiredEntries()));
5152
+ }
5153
+ static inDirectory(path) {
5154
+ return null != (0, fs_1.mkdirSync)(path, {
5155
+ recursive: !0
5156
+ }) && "darwin" === process.platform && ((0, fs_1.writeFileSync)((0, path_1.join)(path, ".nobackup"), ""),
5157
+ (0, fs_1.writeFileSync)((0, path_1.join)(path, ".noindex"), ""), (0, fs_1.writeFileSync)((0,
5158
+ path_1.join)(path, ".nosync"), "")), path = (0, fs_1.realpathSync)(path), this.CACHE.has(path) || this.CACHE.set(path, new DiskCache(path)),
5159
+ this.CACHE.get(path);
5160
+ }
5161
+ entry(...key) {
5162
+ if (0 === key.length) throw new Error("Cache entry key must contain at least 1 element!");
5163
+ return new Entry((0, path_1.join)(__classPrivateFieldGet(this, _DiskCache_root, "f"), ...key.flatMap((s => s.replace(/[^@a-z0-9_.\\/-]+/g, "_").split(/[\\/]+/).map((ss => {
5164
+ if (".." === ss) throw new Error(`A cache entry key cannot contain a '..' path segment! (${s})`);
5165
+ return ss;
5166
+ }))))));
5167
+ }
5168
+ entryFor(path, ...comments) {
5169
+ const rawDigest = (0, digest_file_1.digestFile)(path, ...comments);
5170
+ return this.entry(...comments, rawDigest.toString("hex"));
5171
+ }
5172
+ pruneExpiredEntries() {
5173
+ const cutOff = new Date(Date.now() - PRUNE_AFTER_MILLISECONDS);
5174
+ for (const entry of this.entries()) entry.atime < cutOff && entry.lock((lockedEntry => {
5175
+ entry.atime > cutOff || lockedEntry.delete();
5176
+ }));
5177
+ for (const dir of directoriesUnder(__classPrivateFieldGet(this, _DiskCache_root, "f"), !0)) {
5178
+ if ("darwin" === process.platform) try {
5179
+ (0, fs_1.rmSync)((0, path_1.join)(dir, ".DS_Store"), {
5180
+ force: !0
5181
+ });
5182
+ } catch {}
5183
+ if (0 === (0, fs_1.readdirSync)(dir).length) try {
5184
+ (0, fs_1.rmdirSync)(dir);
5185
+ } catch {}
5186
+ }
5187
+ }
5188
+ * entries() {
5189
+ yield* function* inDirectory(dir) {
5190
+ if ((0, fs_1.existsSync)((0, path_1.join)(dir, ".jsii-runtime-package-cache"))) return yield new Entry(dir);
5191
+ for (const file of directoriesUnder(dir)) yield* inDirectory(file);
5192
+ }(__classPrivateFieldGet(this, _DiskCache_root, "f"));
5193
+ }
5194
+ }
5195
+ exports.DiskCache = DiskCache, _DiskCache_root = new WeakMap, DiskCache.CACHE = new Map;
5196
+ class Entry {
5197
+ constructor(path) {
5198
+ this.path = path;
5199
+ }
5200
+ get atime() {
5201
+ try {
5202
+ return (0, fs_1.statSync)(this.markerFile).atime;
5203
+ } catch (err) {
5204
+ if ("ENOENT" !== err.code) throw err;
5205
+ return new Date(0);
5206
+ }
5207
+ }
5208
+ get pathExists() {
5209
+ return (0, fs_1.existsSync)(this.path);
5210
+ }
5211
+ get lockFile() {
5212
+ return `${this.path}.lock`;
5213
+ }
5214
+ get markerFile() {
5215
+ return (0, path_1.join)(this.path, ".jsii-runtime-package-cache");
5216
+ }
5217
+ lock(cb) {
5218
+ (0, fs_1.mkdirSync)((0, path_1.dirname)(this.path), {
5219
+ recursive: !0
5220
+ }), (0, lockfile_1.lockSync)(this.lockFile, {
5221
+ retries: 12,
5222
+ stale: 5e3
5223
+ });
5224
+ let disposed = !1;
5225
+ try {
5226
+ return cb({
5227
+ delete: () => {
5228
+ if (disposed) throw new Error(`Cannot delete ${this.path} once the lock block was returned!`);
5229
+ (0, fs_1.rmSync)(this.path, {
5230
+ force: !0,
5231
+ recursive: !0
5232
+ });
5233
+ },
5234
+ write: (name, content) => {
5235
+ if (disposed) throw new Error(`Cannot write ${(0, path_1.join)(this.path, name)} once the lock block was returned!`);
5236
+ (0, fs_1.mkdirSync)((0, path_1.dirname)((0, path_1.join)(this.path, name)), {
5237
+ recursive: !0
5238
+ }), (0, fs_1.writeFileSync)((0, path_1.join)(this.path, name), content);
5239
+ },
5240
+ touch: () => {
5241
+ if (disposed) throw new Error(`Cannot touch ${this.path} once the lock block was returned!`);
5242
+ if (this.pathExists) if ((0, fs_1.existsSync)(this.markerFile)) {
5243
+ const now = new Date;
5244
+ (0, fs_1.utimesSync)(this.markerFile, now, now);
5245
+ } else (0, fs_1.writeFileSync)(this.markerFile, "");
5246
+ }
5247
+ });
5248
+ } finally {
5249
+ disposed = !0, (0, lockfile_1.unlockSync)(this.lockFile);
5250
+ }
5251
+ }
5252
+ read(file) {
5253
+ try {
5254
+ return (0, fs_1.readFileSync)((0, path_1.join)(this.path, file));
5255
+ } catch (error) {
5256
+ if ("ENOENT" === error.code) return;
5257
+ throw error;
5258
+ }
5259
+ }
5260
+ }
5261
+ function* directoriesUnder(root, recursive = !1, ignoreErrors = !0) {
5262
+ for (const file of (0, fs_1.readdirSync)(root)) {
5263
+ const path = (0, path_1.join)(root, file);
5264
+ try {
5265
+ (0, fs_1.statSync)(path).isDirectory() && (recursive && (yield* directoriesUnder(path, recursive, ignoreErrors)),
5266
+ yield path);
5267
+ } catch (error) {
5268
+ if (!ignoreErrors) throw error;
5269
+ }
5270
+ }
5271
+ }
5272
+ exports.Entry = Entry;
5273
+ },
5274
+ 7202: function(__unused_webpack_module, exports, __webpack_require__) {
5275
+ "use strict";
5276
+ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
5277
+ void 0 === k2 && (k2 = k);
5278
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5279
+ desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
5280
+ enumerable: !0,
5281
+ get: function() {
5282
+ return m[k];
5283
+ }
5284
+ }), Object.defineProperty(o, k2, desc);
5285
+ } : function(o, m, k, k2) {
5286
+ void 0 === k2 && (k2 = k), o[k2] = m[k];
5287
+ }), __exportStar = this && this.__exportStar || function(m, exports) {
5288
+ for (var p in m) "default" === p || Object.prototype.hasOwnProperty.call(exports, p) || __createBinding(exports, m, p);
5289
+ };
5290
+ Object.defineProperty(exports, "__esModule", {
5291
+ value: !0
5292
+ }), __exportStar(__webpack_require__(535), exports);
5293
+ },
4888
5294
  8944: function(__unused_webpack_module, exports, __webpack_require__) {
4889
5295
  "use strict";
4890
5296
  var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
@@ -4912,15 +5318,18 @@ var __webpack_modules__ = {
4912
5318
  Object.defineProperty(exports, "__esModule", {
4913
5319
  value: !0
4914
5320
  }), exports.Kernel = void 0;
4915
- const spec = __webpack_require__(1804), spec_1 = __webpack_require__(1804), cp = __webpack_require__(2081), fs = __webpack_require__(9728), module_1 = __webpack_require__(8188), os = __webpack_require__(2037), path = __webpack_require__(4822), tar = __webpack_require__(1189), api = __webpack_require__(2816), api_1 = __webpack_require__(2816), objects_1 = __webpack_require__(2309), onExit = __webpack_require__(6703), wire = __webpack_require__(8614);
5321
+ const spec = __webpack_require__(1804), spec_1 = __webpack_require__(1804), cp = __webpack_require__(2081), fs_1 = __webpack_require__(7147), fs = __webpack_require__(9728), module_1 = __webpack_require__(8188), os = __webpack_require__(2037), path = __webpack_require__(4822), api = __webpack_require__(2816), api_1 = __webpack_require__(2816), link_1 = __webpack_require__(328), objects_1 = __webpack_require__(2309), onExit = __webpack_require__(6703), wire = __webpack_require__(8614), tar = __webpack_require__(4383);
4916
5322
  exports.Kernel = class {
4917
5323
  constructor(callbackHandler) {
4918
- this.callbackHandler = callbackHandler, this.traceEnabled = !1, this.assemblies = new Map,
4919
- this.objects = new objects_1.ObjectTable(this._typeInfoForFqn.bind(this)), this.cbs = new Map,
4920
- this.waiting = new Map, this.promises = new Map, this.nextid = 2e4;
5324
+ this.callbackHandler = callbackHandler, this.traceEnabled = !1, this.debugTimingEnabled = !1,
5325
+ this.assemblies = new Map, this.objects = new objects_1.ObjectTable(this._typeInfoForFqn.bind(this)),
5326
+ this.cbs = new Map, this.waiting = new Map, this.promises = new Map, this.nextid = 2e4;
4921
5327
  }
4922
5328
  load(req) {
4923
- var _a, _b;
5329
+ return this._debugTime((() => this._load(req)), `load(${JSON.stringify(req, null, 2)})`);
5330
+ }
5331
+ _load(req) {
5332
+ var _a, _b, _c;
4924
5333
  if (this._debug("load", req), "assembly" in req) throw new Error('`assembly` field is deprecated for "load", use `name`, `version` and `tarball` instead');
4925
5334
  const pkgname = req.name, pkgver = req.version, packageDir = this._getPackageDir(pkgname);
4926
5335
  if (fs.pathExistsSync(packageDir)) {
@@ -4933,30 +5342,32 @@ var __webpack_modules__ = {
4933
5342
  types: Object.keys(null !== (_a = assm.metadata.types) && void 0 !== _a ? _a : {}).length
4934
5343
  };
4935
5344
  }
4936
- fs.mkdirpSync(packageDir);
4937
5345
  const originalUmask = process.umask(18);
4938
5346
  try {
4939
- tar.extract({
4940
- cwd: packageDir,
4941
- file: req.tarball,
5347
+ const {path: extractedTo, cache} = this._debugTime((() => tar.extract(req.tarball, {
4942
5348
  strict: !0,
4943
5349
  strip: 1,
4944
- sync: !0,
4945
5350
  unlink: !0
4946
- });
5351
+ }, req.name, req.version)), `tar.extract(${req.tarball}) => ${packageDir}`);
5352
+ fs.mkdirSync(path.dirname(packageDir), {
5353
+ recursive: !0
5354
+ }), null != cache ? (this._debug(`Package cache enabled, extraction resulted in a cache ${cache}`),
5355
+ this._debugTime((() => (0, link_1.link)(extractedTo, packageDir)), `link(${extractedTo}, ${packageDir})`)) : (0,
5356
+ fs_1.renameSync)(extractedTo, packageDir);
4947
5357
  } finally {
4948
5358
  process.umask(originalUmask);
4949
5359
  }
4950
5360
  let assmSpec;
4951
5361
  try {
4952
- assmSpec = (0, spec_1.loadAssemblyFromPath)(packageDir);
5362
+ assmSpec = this._debugTime((() => (0, spec_1.loadAssemblyFromPath)(packageDir)), `loadAssemblyFromPath(${packageDir})`);
4953
5363
  } catch (e) {
4954
5364
  throw new Error(`Error for package tarball ${req.tarball}: ${e.message}`);
4955
5365
  }
4956
- const closure = this.require(packageDir), assm = new Assembly(assmSpec, closure);
4957
- return this._addAssembly(assm), {
5366
+ const closure = this._debugTime((() => this.require(packageDir)), `require(${packageDir})`), assm = new Assembly(assmSpec, closure);
5367
+ return this._debugTime((() => this._addAssembly(assm)), `registerAssembly({ name: ${assm.metadata.name}, types: ${Object.keys(null !== (_b = assm.metadata.types) && void 0 !== _b ? _b : {}).length} })`),
5368
+ {
4958
5369
  assembly: assmSpec.name,
4959
- types: Object.keys(null !== (_b = assmSpec.types) && void 0 !== _b ? _b : {}).length
5370
+ types: Object.keys(null !== (_c = assmSpec.types) && void 0 !== _c ? _c : {}).length
4960
5371
  };
4961
5372
  }
4962
5373
  invokeBinScript(req) {
@@ -5145,7 +5556,7 @@ var __webpack_modules__ = {
5145
5556
  case spec.TypeKind.Class:
5146
5557
  case spec.TypeKind.Enum:
5147
5558
  const constructor = this._findSymbol(fqn);
5148
- (0, objects_1.tagJsiiConstructor)(constructor, fqn);
5559
+ (0, objects_1.tagJsiiConstructor)(constructor, fqn, assm.metadata.version);
5149
5560
  }
5150
5561
  }
5151
5562
  }
@@ -5445,6 +5856,15 @@ var __webpack_modules__ = {
5445
5856
  _debug(...args) {
5446
5857
  this.traceEnabled && console.error("[@jsii/kernel]", ...args);
5447
5858
  }
5859
+ _debugTime(cb, label) {
5860
+ const fullLabel = `[@jsii/kernel:timing] ${label}`;
5861
+ this.debugTimingEnabled && console.time(fullLabel);
5862
+ try {
5863
+ return cb();
5864
+ } finally {
5865
+ this.debugTimingEnabled && console.timeEnd(fullLabel);
5866
+ }
5867
+ }
5448
5868
  _ensureSync(desc, fn) {
5449
5869
  this.syncInProgress = desc;
5450
5870
  try {
@@ -5470,12 +5890,32 @@ var __webpack_modules__ = {
5470
5890
  }
5471
5891
  }
5472
5892
  },
5893
+ 328: (__unused_webpack_module, exports, __webpack_require__) => {
5894
+ "use strict";
5895
+ Object.defineProperty(exports, "__esModule", {
5896
+ value: !0
5897
+ }), exports.link = void 0;
5898
+ const fs_1 = __webpack_require__(7147), path_1 = __webpack_require__(4822);
5899
+ exports.link = function link(existing, destination) {
5900
+ if ((0, fs_1.statSync)(existing).isDirectory()) {
5901
+ (0, fs_1.mkdirSync)(destination, {
5902
+ recursive: !0
5903
+ });
5904
+ for (const file of (0, fs_1.readdirSync)(existing)) link((0, path_1.join)(existing, file), (0,
5905
+ path_1.join)(destination, file));
5906
+ } else try {
5907
+ (0, fs_1.linkSync)(existing, destination);
5908
+ } catch {
5909
+ (0, fs_1.copyFileSync)(existing, destination);
5910
+ }
5911
+ };
5912
+ },
5473
5913
  2309: (__unused_webpack_module, exports, __webpack_require__) => {
5474
5914
  "use strict";
5475
5915
  Object.defineProperty(exports, "__esModule", {
5476
5916
  value: !0
5477
5917
  }), exports.ObjectTable = exports.tagJsiiConstructor = exports.objectReference = exports.jsiiTypeFqn = void 0;
5478
- const spec = __webpack_require__(1804), api = __webpack_require__(2816), serialization_1 = __webpack_require__(8614), OBJID_SYMBOL = Symbol.for("$__jsii__objid__$"), IFACES_SYMBOL = Symbol.for("$__jsii__interfaces__$"), JSII_SYMBOL = Symbol.for("__jsii__");
5918
+ const spec = __webpack_require__(1804), api = __webpack_require__(2816), serialization_1 = __webpack_require__(8614), OBJID_SYMBOL = Symbol.for("$__jsii__objid__$"), IFACES_SYMBOL = Symbol.for("$__jsii__interfaces__$"), JSII_RTTI_SYMBOL = Symbol.for("jsii.rtti");
5479
5919
  function objectReference(obj) {
5480
5920
  if (obj[OBJID_SYMBOL]) return {
5481
5921
  [api.TOKEN_REF]: obj[OBJID_SYMBOL],
@@ -5484,14 +5924,15 @@ var __webpack_modules__ = {
5484
5924
  }
5485
5925
  exports.jsiiTypeFqn = function(obj) {
5486
5926
  var _a;
5487
- return null === (_a = obj.constructor[JSII_SYMBOL]) || void 0 === _a ? void 0 : _a.fqn;
5488
- }, exports.objectReference = objectReference, exports.tagJsiiConstructor = function(constructor, fqn) {
5489
- Object.defineProperty(constructor, JSII_SYMBOL, {
5927
+ return null === (_a = obj.constructor[JSII_RTTI_SYMBOL]) || void 0 === _a ? void 0 : _a.fqn;
5928
+ }, exports.objectReference = objectReference, exports.tagJsiiConstructor = function(constructor, fqn, version) {
5929
+ Object.prototype.hasOwnProperty.call(constructor, JSII_RTTI_SYMBOL) || Object.defineProperty(constructor, JSII_RTTI_SYMBOL, {
5490
5930
  configurable: !1,
5491
5931
  enumerable: !1,
5492
5932
  writable: !1,
5493
5933
  value: {
5494
- fqn
5934
+ fqn,
5935
+ version
5495
5936
  }
5496
5937
  });
5497
5938
  };
@@ -6040,6 +6481,98 @@ var __webpack_modules__ = {
6040
6481
  }
6041
6482
  exports.SerializationError = SerializationError;
6042
6483
  },
6484
+ 4964: (__unused_webpack_module, exports, __webpack_require__) => {
6485
+ "use strict";
6486
+ Object.defineProperty(exports, "__esModule", {
6487
+ value: !0
6488
+ }), exports.defaultCacheRoot = void 0;
6489
+ const os_1 = __webpack_require__(2037), path_1 = __webpack_require__(4822);
6490
+ exports.defaultCacheRoot = function() {
6491
+ switch (process.platform) {
6492
+ case "darwin":
6493
+ if (process.env.HOME) return (0, path_1.join)(process.env.HOME, "Library", "Caches", "com.amazonaws.jsii", "package-cache");
6494
+ break;
6495
+
6496
+ case "linux":
6497
+ if (process.env.HOME) return (0, path_1.join)(process.env.HOME, ".cache", "aws", "jsii", "package-cache");
6498
+ break;
6499
+
6500
+ case "win32":
6501
+ if (process.env.LOCALAPPDATA) return (0, path_1.join)(process.env.LOCALAPPDATA, "AWS", "jsii", "package-cache");
6502
+ }
6503
+ return (0, path_1.join)((0, os_1.tmpdir)(), "aws-jsii-package-cache");
6504
+ };
6505
+ },
6506
+ 4383: (__unused_webpack_module, exports, __webpack_require__) => {
6507
+ "use strict";
6508
+ var _a;
6509
+ Object.defineProperty(exports, "__esModule", {
6510
+ value: !0
6511
+ }), exports.setPackageCacheEnabled = exports.getPackageCacheEnabled = exports.extract = void 0;
6512
+ const fs_1 = __webpack_require__(7147), os_1 = __webpack_require__(2037), path_1 = __webpack_require__(4822), tar = __webpack_require__(1189), disk_cache_1 = __webpack_require__(7202), default_cache_root_1 = __webpack_require__(4964);
6513
+ let packageCacheEnabled = "enabled" === (null === (_a = process.env.JSII_RUNTIME_PACKAGE_CACHE) || void 0 === _a ? void 0 : _a.toLocaleUpperCase());
6514
+ function extractToCache(file, options = {}, ...comments) {
6515
+ var _a;
6516
+ const cacheRoot = null !== (_a = process.env.JSII_RUNTIME_PACKAGE_CACHE_ROOT) && void 0 !== _a ? _a : (0,
6517
+ default_cache_root_1.defaultCacheRoot)(), entry = disk_cache_1.DiskCache.inDirectory(cacheRoot).entryFor(file, ...comments);
6518
+ return entry.lock((lock => {
6519
+ let cache = "hit";
6520
+ if (!entry.pathExists) {
6521
+ const tmpPath = `${entry.path}.tmp`;
6522
+ (0, fs_1.mkdirSync)(tmpPath, {
6523
+ recursive: !0
6524
+ });
6525
+ try {
6526
+ untarInto({
6527
+ ...options,
6528
+ cwd: tmpPath,
6529
+ file
6530
+ }), (0, fs_1.renameSync)(tmpPath, entry.path);
6531
+ } catch (error) {
6532
+ throw (0, fs_1.rmSync)(entry.path, {
6533
+ force: !0,
6534
+ recursive: !0
6535
+ }), error;
6536
+ }
6537
+ cache = "miss";
6538
+ }
6539
+ return lock.touch(), {
6540
+ path: entry.path,
6541
+ cache
6542
+ };
6543
+ }));
6544
+ }
6545
+ function extractToTemporary(file, options = {}) {
6546
+ const path = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), "jsii-runtime-untar-"));
6547
+ return untarInto({
6548
+ ...options,
6549
+ cwd: path,
6550
+ file
6551
+ }), {
6552
+ path
6553
+ };
6554
+ }
6555
+ function untarInto(options) {
6556
+ try {
6557
+ tar.extract({
6558
+ ...options,
6559
+ sync: !0
6560
+ });
6561
+ } catch (error) {
6562
+ throw (0, fs_1.rmSync)(options.cwd, {
6563
+ force: !0,
6564
+ recursive: !0
6565
+ }), error;
6566
+ }
6567
+ }
6568
+ exports.extract = function(file, options, ...comments) {
6569
+ return (packageCacheEnabled ? extractToCache : extractToTemporary)(file, options, ...comments);
6570
+ }, exports.getPackageCacheEnabled = function() {
6571
+ return packageCacheEnabled;
6572
+ }, exports.setPackageCacheEnabled = function(value) {
6573
+ packageCacheEnabled = value;
6574
+ };
6575
+ },
6043
6576
  7905: (__unused_webpack_module, exports, __webpack_require__) => {
6044
6577
  "use strict";
6045
6578
  Object.defineProperty(exports, "__esModule", {
@@ -6048,8 +6581,10 @@ var __webpack_modules__ = {
6048
6581
  const kernel_1 = __webpack_require__(8944), events_1 = __webpack_require__(2361);
6049
6582
  exports.KernelHost = class {
6050
6583
  constructor(inout, opts = {}) {
6584
+ var _a, _b;
6051
6585
  this.inout = inout, this.opts = opts, this.kernel = new kernel_1.Kernel(this.callbackHandler.bind(this)),
6052
- this.eventEmitter = new events_1.EventEmitter, this.kernel.traceEnabled = !!opts.debug;
6586
+ this.eventEmitter = new events_1.EventEmitter, this.kernel.traceEnabled = null !== (_a = opts.debug) && void 0 !== _a && _a,
6587
+ this.kernel.debugTimingEnabled = null !== (_b = opts.debugTiming) && void 0 !== _b && _b;
6053
6588
  }
6054
6589
  run() {
6055
6590
  var _a;
@@ -10266,7 +10801,7 @@ var __webpack_modules__ = {
10266
10801
  },
10267
10802
  4147: module => {
10268
10803
  "use strict";
10269
- module.exports = JSON.parse('{"name":"@jsii/runtime","version":"1.65.0","description":"jsii runtime kernel process","license":"Apache-2.0","author":{"name":"Amazon Web Services","url":"https://aws.amazon.com"},"homepage":"https://github.com/aws/jsii","bugs":{"url":"https://github.com/aws/jsii/issues"},"repository":{"type":"git","url":"https://github.com/aws/jsii.git","directory":"packages/@jsii/runtime"},"engines":{"node":">= 14.6.0"},"main":"lib/index.js","types":"lib/index.d.ts","bin":{"jsii-runtime":"bin/jsii-runtime"},"scripts":{"build":"tsc --build && chmod +x bin/jsii-runtime && npx webpack-cli && npm run lint","watch":"tsc --build -w","lint":"eslint . --ext .js,.ts --ignore-path=.gitignore --ignore-pattern=webpack.config.js","lint:fix":"yarn lint --fix","test":"jest","test:update":"jest -u","package":"package-js"},"dependencies":{"@jsii/kernel":"^1.65.0","@jsii/check-node":"1.65.0","@jsii/spec":"^1.65.0"},"devDependencies":{"@scope/jsii-calc-base":"^1.65.0","@scope/jsii-calc-lib":"^1.65.0","jsii-build-tools":"^1.65.0","jsii-calc":"^3.20.120","source-map-loader":"^4.0.0","webpack":"^5.74.0","webpack-cli":"^4.10.0"}}');
10804
+ module.exports = JSON.parse('{"name":"@jsii/runtime","version":"1.67.0","description":"jsii runtime kernel process","license":"Apache-2.0","author":{"name":"Amazon Web Services","url":"https://aws.amazon.com"},"homepage":"https://github.com/aws/jsii","bugs":{"url":"https://github.com/aws/jsii/issues"},"repository":{"type":"git","url":"https://github.com/aws/jsii.git","directory":"packages/@jsii/runtime"},"engines":{"node":">= 14.6.0"},"main":"lib/index.js","types":"lib/index.d.ts","bin":{"jsii-runtime":"bin/jsii-runtime"},"scripts":{"build":"tsc --build && chmod +x bin/jsii-runtime && npx webpack-cli && npm run lint","watch":"tsc --build -w","lint":"eslint . --ext .js,.ts --ignore-path=.gitignore --ignore-pattern=webpack.config.js","lint:fix":"yarn lint --fix","test":"jest","test:update":"jest -u","package":"package-js"},"dependencies":{"@jsii/kernel":"^1.67.0","@jsii/check-node":"1.67.0","@jsii/spec":"^1.67.0"},"devDependencies":{"@scope/jsii-calc-base":"^1.67.0","@scope/jsii-calc-lib":"^1.67.0","jsii-build-tools":"^1.67.0","jsii-calc":"^3.20.120","source-map-loader":"^4.0.0","webpack":"^5.74.0","webpack-cli":"^4.10.0"}}');
10270
10805
  },
10271
10806
  5277: module => {
10272
10807
  "use strict";
@@ -10301,13 +10836,14 @@ var __webpack_exports__ = {};
10301
10836
  (() => {
10302
10837
  "use strict";
10303
10838
  var _a;
10304
- const packageInfo = __webpack_require__(4147), host_1 = __webpack_require__(7905), in_out_1 = __webpack_require__(6156), sync_stdio_1 = __webpack_require__(1416), name = packageInfo.name, version = packageInfo.version, noStack = !!process.env.JSII_NOSTACK, debug = !!process.env.JSII_DEBUG, stdio = new sync_stdio_1.SyncStdio({
10839
+ const packageInfo = __webpack_require__(4147), host_1 = __webpack_require__(7905), in_out_1 = __webpack_require__(6156), sync_stdio_1 = __webpack_require__(1416), name = packageInfo.name, version = packageInfo.version, noStack = !!process.env.JSII_NOSTACK, debug = !!process.env.JSII_DEBUG, debugTiming = !!process.env.JSII_DEBUG_TIMING, stdio = new sync_stdio_1.SyncStdio({
10305
10840
  errorFD: null !== (_a = process.stderr.fd) && void 0 !== _a ? _a : 2,
10306
10841
  readFD: 3,
10307
10842
  writeFD: 3
10308
10843
  }), inout = new in_out_1.InputOutput(stdio), host = new host_1.KernelHost(inout, {
10309
10844
  debug,
10310
- noStack
10845
+ noStack,
10846
+ debugTiming
10311
10847
  });
10312
10848
  host.once("exit", process.exit.bind(process)), inout.write({
10313
10849
  hello: `${name}@${version}`