@jsii/runtime 1.68.0 → 1.70.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.js CHANGED
@@ -46,7 +46,10 @@ class KernelHost {
46
46
  if ('complete' in completeReq &&
47
47
  completeReq.complete.cbid === callback.cbid) {
48
48
  if (completeReq.complete.err) {
49
- throw new kernel_1.JsiiFault(completeReq.complete.err);
49
+ if (completeReq.complete.name === "@jsii/kernel.Fault" /* JsiiErrorType.JSII_FAULT */) {
50
+ throw new kernel_1.JsiiFault(completeReq.complete.err);
51
+ }
52
+ throw new kernel_1.RuntimeError(completeReq.complete.err);
50
53
  }
51
54
  return completeReq.complete.result;
52
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsii/runtime",
3
- "version": "1.68.0",
3
+ "version": "1.70.0",
4
4
  "description": "jsii runtime kernel process",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -34,16 +34,16 @@
34
34
  "package": "package-js"
35
35
  },
36
36
  "dependencies": {
37
- "@jsii/kernel": "^1.68.0",
38
- "@jsii/check-node": "1.68.0",
39
- "@jsii/spec": "^1.68.0"
37
+ "@jsii/kernel": "^1.70.0",
38
+ "@jsii/check-node": "1.70.0",
39
+ "@jsii/spec": "^1.70.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@scope/jsii-calc-base": "^1.68.0",
43
- "@scope/jsii-calc-lib": "^1.68.0",
44
- "jsii-build-tools": "^1.68.0",
42
+ "@scope/jsii-calc-base": "^1.70.0",
43
+ "@scope/jsii-calc-lib": "^1.70.0",
44
+ "jsii-build-tools": "^1.70.0",
45
45
  "jsii-calc": "^3.20.120",
46
- "source-map-loader": "^4.0.0",
46
+ "source-map-loader": "^4.0.1",
47
47
  "webpack": "^5.74.0",
48
48
  "webpack-cli": "^4.10.0"
49
49
  }
@@ -2624,51 +2624,91 @@ var __webpack_modules__ = {
2624
2624
  },
2625
2625
  6027: (module, __unused_webpack_exports, __webpack_require__) => {
2626
2626
  const internalRe = __webpack_require__(9541);
2627
+ const constants = __webpack_require__(9041);
2628
+ const SemVer = __webpack_require__(3013);
2629
+ const identifiers = __webpack_require__(3650);
2630
+ const parse = __webpack_require__(7507);
2631
+ const valid = __webpack_require__(2555);
2632
+ const clean = __webpack_require__(3470);
2633
+ const inc = __webpack_require__(5210);
2634
+ const diff = __webpack_require__(5209);
2635
+ const major = __webpack_require__(5847);
2636
+ const minor = __webpack_require__(1757);
2637
+ const patch = __webpack_require__(8150);
2638
+ const prerelease = __webpack_require__(8011);
2639
+ const compare = __webpack_require__(2247);
2640
+ const rcompare = __webpack_require__(9201);
2641
+ const compareLoose = __webpack_require__(2310);
2642
+ const compareBuild = __webpack_require__(6845);
2643
+ const sort = __webpack_require__(1934);
2644
+ const rsort = __webpack_require__(7391);
2645
+ const gt = __webpack_require__(6077);
2646
+ const lt = __webpack_require__(866);
2647
+ const eq = __webpack_require__(8443);
2648
+ const neq = __webpack_require__(1017);
2649
+ const gte = __webpack_require__(4578);
2650
+ const lte = __webpack_require__(698);
2651
+ const cmp = __webpack_require__(1918);
2652
+ const coerce = __webpack_require__(4115);
2653
+ const Comparator = __webpack_require__(7706);
2654
+ const Range = __webpack_require__(6833);
2655
+ const satisfies = __webpack_require__(8915);
2656
+ const toComparators = __webpack_require__(8378);
2657
+ const maxSatisfying = __webpack_require__(1678);
2658
+ const minSatisfying = __webpack_require__(1553);
2659
+ const minVersion = __webpack_require__(2262);
2660
+ const validRange = __webpack_require__(7396);
2661
+ const outside = __webpack_require__(939);
2662
+ const gtr = __webpack_require__(4933);
2663
+ const ltr = __webpack_require__(7233);
2664
+ const intersects = __webpack_require__(8842);
2665
+ const simplifyRange = __webpack_require__(3018);
2666
+ const subset = __webpack_require__(8563);
2627
2667
  module.exports = {
2668
+ parse,
2669
+ valid,
2670
+ clean,
2671
+ inc,
2672
+ diff,
2673
+ major,
2674
+ minor,
2675
+ patch,
2676
+ prerelease,
2677
+ compare,
2678
+ rcompare,
2679
+ compareLoose,
2680
+ compareBuild,
2681
+ sort,
2682
+ rsort,
2683
+ gt,
2684
+ lt,
2685
+ eq,
2686
+ neq,
2687
+ gte,
2688
+ lte,
2689
+ cmp,
2690
+ coerce,
2691
+ Comparator,
2692
+ Range,
2693
+ satisfies,
2694
+ toComparators,
2695
+ maxSatisfying,
2696
+ minSatisfying,
2697
+ minVersion,
2698
+ validRange,
2699
+ outside,
2700
+ gtr,
2701
+ ltr,
2702
+ intersects,
2703
+ simplifyRange,
2704
+ subset,
2705
+ SemVer,
2628
2706
  re: internalRe.re,
2629
2707
  src: internalRe.src,
2630
2708
  tokens: internalRe.t,
2631
- SEMVER_SPEC_VERSION: __webpack_require__(9041).SEMVER_SPEC_VERSION,
2632
- SemVer: __webpack_require__(3013),
2633
- compareIdentifiers: __webpack_require__(3650).compareIdentifiers,
2634
- rcompareIdentifiers: __webpack_require__(3650).rcompareIdentifiers,
2635
- parse: __webpack_require__(7507),
2636
- valid: __webpack_require__(2555),
2637
- clean: __webpack_require__(3470),
2638
- inc: __webpack_require__(5210),
2639
- diff: __webpack_require__(5209),
2640
- major: __webpack_require__(5847),
2641
- minor: __webpack_require__(1757),
2642
- patch: __webpack_require__(8150),
2643
- prerelease: __webpack_require__(8011),
2644
- compare: __webpack_require__(2247),
2645
- rcompare: __webpack_require__(9201),
2646
- compareLoose: __webpack_require__(2310),
2647
- compareBuild: __webpack_require__(6845),
2648
- sort: __webpack_require__(1934),
2649
- rsort: __webpack_require__(7391),
2650
- gt: __webpack_require__(6077),
2651
- lt: __webpack_require__(866),
2652
- eq: __webpack_require__(8443),
2653
- neq: __webpack_require__(1017),
2654
- gte: __webpack_require__(4578),
2655
- lte: __webpack_require__(698),
2656
- cmp: __webpack_require__(1918),
2657
- coerce: __webpack_require__(4115),
2658
- Comparator: __webpack_require__(7706),
2659
- Range: __webpack_require__(6833),
2660
- satisfies: __webpack_require__(8915),
2661
- toComparators: __webpack_require__(8378),
2662
- maxSatisfying: __webpack_require__(1678),
2663
- minSatisfying: __webpack_require__(1553),
2664
- minVersion: __webpack_require__(2262),
2665
- validRange: __webpack_require__(7396),
2666
- outside: __webpack_require__(939),
2667
- gtr: __webpack_require__(4933),
2668
- ltr: __webpack_require__(7233),
2669
- intersects: __webpack_require__(8842),
2670
- simplifyRange: __webpack_require__(3018),
2671
- subset: __webpack_require__(8563)
2709
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2710
+ compareIdentifiers: identifiers.compareIdentifiers,
2711
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
2672
2712
  };
2673
2713
  },
2674
2714
  9041: module => {
@@ -7099,14 +7099,12 @@ var __webpack_modules__ = {
7099
7099
  const spec = __webpack_require__(1804);
7100
7100
  const spec_1 = __webpack_require__(1804);
7101
7101
  const cp = __webpack_require__(2081);
7102
- const fs_1 = __webpack_require__(7147);
7103
7102
  const fs = __webpack_require__(9477);
7104
7103
  const module_1 = __webpack_require__(8188);
7105
7104
  const os = __webpack_require__(2037);
7106
7105
  const path = __webpack_require__(4822);
7107
7106
  const api = __webpack_require__(2816);
7108
7107
  const api_1 = __webpack_require__(2816);
7109
- const link_1 = __webpack_require__(8261);
7110
7108
  const objects_1 = __webpack_require__(2309);
7111
7109
  const onExit = __webpack_require__(6703);
7112
7110
  const wire = __webpack_require__(8614);
@@ -7163,19 +7161,13 @@ var __webpack_modules__ = {
7163
7161
  }
7164
7162
  const originalUmask = process.umask(18);
7165
7163
  try {
7166
- const {path: extractedTo, cache} = this._debugTime((() => tar.extract(req.tarball, {
7164
+ const {cache} = this._debugTime((() => tar.extract(req.tarball, packageDir, {
7167
7165
  strict: true,
7168
7166
  strip: 1,
7169
7167
  unlink: true
7170
7168
  }, req.name, req.version)), `tar.extract(${req.tarball}) => ${packageDir}`);
7171
- fs.mkdirSync(path.dirname(packageDir), {
7172
- recursive: true
7173
- });
7174
7169
  if (cache != null) {
7175
7170
  this._debug(`Package cache enabled, extraction resulted in a cache ${cache}`);
7176
- this._debugTime((() => (0, link_1.link)(extractedTo, packageDir)), `link(${extractedTo}, ${packageDir})`);
7177
- } else {
7178
- (0, fs_1.renameSync)(extractedTo, packageDir);
7179
7171
  }
7180
7172
  } finally {
7181
7173
  process.umask(originalUmask);
@@ -7367,7 +7359,10 @@ var __webpack_modules__ = {
7367
7359
  this._debug("promise result:", result);
7368
7360
  } catch (e) {
7369
7361
  this._debug("promise error:", e);
7370
- throw new JsiiFault(e.message);
7362
+ if (e.name === "@jsii/kernel.Fault") {
7363
+ throw new JsiiFault(e.message);
7364
+ }
7365
+ throw new RuntimeError(e);
7371
7366
  }
7372
7367
  return {
7373
7368
  result: this._fromSandbox(result, (_a = method.returns) !== null && _a !== void 0 ? _a : "void", `returned by async method ${method.name}`)
@@ -7395,7 +7390,7 @@ var __webpack_modules__ = {
7395
7390
  }
7396
7391
  complete(req) {
7397
7392
  var _a;
7398
- const {cbid, err, result} = req;
7393
+ const {cbid, err, result, name} = req;
7399
7394
  this._debug("complete", cbid, err, result);
7400
7395
  const cb = this.waiting.get(cbid);
7401
7396
  if (!cb) {
@@ -7403,7 +7398,7 @@ var __webpack_modules__ = {
7403
7398
  }
7404
7399
  if (err) {
7405
7400
  this._debug("completed with error:", err);
7406
- cb.fail(new Error(err));
7401
+ cb.fail(name === "@jsii/kernel.Fault" ? new JsiiFault(err) : new RuntimeError(err));
7407
7402
  } else {
7408
7403
  const sandoxResult = this._toSandbox(result, (_a = cb.expectedReturnType) !== null && _a !== void 0 ? _a : "void", `returned by callback ${cb.toString()}`);
7409
7404
  this._debug("completed with result:", sandoxResult);
@@ -8883,36 +8878,44 @@ var __webpack_modules__ = {
8883
8878
  });
8884
8879
  exports.setPackageCacheEnabled = exports.getPackageCacheEnabled = exports.extract = void 0;
8885
8880
  const fs_1 = __webpack_require__(7147);
8886
- const os_1 = __webpack_require__(2037);
8887
- const path_1 = __webpack_require__(4822);
8888
8881
  const tar = __webpack_require__(1189);
8889
8882
  const disk_cache_1 = __webpack_require__(7202);
8883
+ const link_1 = __webpack_require__(8261);
8890
8884
  const default_cache_root_1 = __webpack_require__(1034);
8891
8885
  let packageCacheEnabled = ((_a = process.env.JSII_RUNTIME_PACKAGE_CACHE) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase()) === "enabled";
8892
- function extract(file, options, ...comments) {
8893
- return (packageCacheEnabled ? extractToCache : extractToTemporary)(file, options, ...comments);
8886
+ function extract(file, outDir, options, ...comments) {
8887
+ (0, fs_1.mkdirSync)(outDir, {
8888
+ recursive: true
8889
+ });
8890
+ try {
8891
+ return (packageCacheEnabled ? extractViaCache : extractToOutDir)(file, outDir, options, ...comments);
8892
+ } catch (err) {
8893
+ (0, fs_1.rmSync)(outDir, {
8894
+ force: true,
8895
+ recursive: true
8896
+ });
8897
+ throw err;
8898
+ }
8894
8899
  }
8895
8900
  exports.extract = extract;
8896
- function extractToCache(file, options = {}, ...comments) {
8901
+ function extractViaCache(file, outDir, options = {}, ...comments) {
8897
8902
  var _a;
8898
8903
  const cacheRoot = (_a = process.env.JSII_RUNTIME_PACKAGE_CACHE_ROOT) !== null && _a !== void 0 ? _a : (0,
8899
8904
  default_cache_root_1.defaultCacheRoot)();
8900
- const cache = disk_cache_1.DiskCache.inDirectory(cacheRoot);
8901
- const entry = cache.entryFor(file, ...comments);
8902
- return entry.lock((lock => {
8905
+ const dirCache = disk_cache_1.DiskCache.inDirectory(cacheRoot);
8906
+ const entry = dirCache.entryFor(file, ...comments);
8907
+ const {path, cache} = entry.lock((lock => {
8903
8908
  let cache = "hit";
8904
8909
  if (!entry.pathExists) {
8905
- const tmpPath = `${entry.path}.tmp`;
8906
- (0, fs_1.mkdirSync)(tmpPath, {
8910
+ (0, fs_1.mkdirSync)(entry.path, {
8907
8911
  recursive: true
8908
8912
  });
8909
8913
  try {
8910
8914
  untarInto({
8911
8915
  ...options,
8912
- cwd: tmpPath,
8916
+ cwd: entry.path,
8913
8917
  file
8914
8918
  });
8915
- (0, fs_1.renameSync)(tmpPath, entry.path);
8916
8919
  } catch (error) {
8917
8920
  (0, fs_1.rmSync)(entry.path, {
8918
8921
  force: true,
@@ -8928,17 +8931,18 @@ var __webpack_modules__ = {
8928
8931
  cache
8929
8932
  };
8930
8933
  }));
8934
+ (0, link_1.link)(path, outDir);
8935
+ return {
8936
+ cache
8937
+ };
8931
8938
  }
8932
- function extractToTemporary(file, options = {}) {
8933
- const path = (0, fs_1.mkdtempSync)((0, path_1.join)((0, os_1.tmpdir)(), "jsii-runtime-untar-"));
8939
+ function extractToOutDir(file, cwd, options = {}) {
8934
8940
  untarInto({
8935
8941
  ...options,
8936
- cwd: path,
8942
+ cwd,
8937
8943
  file
8938
8944
  });
8939
- return {
8940
- path
8941
- };
8945
+ return {};
8942
8946
  }
8943
8947
  function untarInto(options) {
8944
8948
  try {
@@ -10446,7 +10450,10 @@ var __webpack_modules__ = {
10446
10450
  const completeReq = req;
10447
10451
  if ("complete" in completeReq && completeReq.complete.cbid === callback.cbid) {
10448
10452
  if (completeReq.complete.err) {
10449
- throw new kernel_1.JsiiFault(completeReq.complete.err);
10453
+ if (completeReq.complete.name === "@jsii/kernel.Fault") {
10454
+ throw new kernel_1.JsiiFault(completeReq.complete.err);
10455
+ }
10456
+ throw new kernel_1.RuntimeError(completeReq.complete.err);
10450
10457
  }
10451
10458
  return completeReq.complete.result;
10452
10459
  }
@@ -10687,7 +10694,11 @@ var __webpack_modules__ = {
10687
10694
  exports.loadAssemblyFromPath = loadAssemblyFromPath;
10688
10695
  function loadAssemblyFromFile(pathToFile, validate = true) {
10689
10696
  const data = fs.readFileSync(pathToFile);
10690
- return loadAssemblyFromBuffer(data, (filename => fs.readFileSync(path.resolve(pathToFile, "..", filename))), validate);
10697
+ try {
10698
+ return loadAssemblyFromBuffer(data, (filename => fs.readFileSync(path.resolve(pathToFile, "..", filename))), validate);
10699
+ } catch (e) {
10700
+ throw new Error(`Error loading assembly from file ${pathToFile}:\n${e}`);
10701
+ }
10691
10702
  }
10692
10703
  exports.loadAssemblyFromFile = loadAssemblyFromFile;
10693
10704
  function followRedirect(assemblyRedirect, readFile) {
@@ -10903,11 +10914,16 @@ var __webpack_modules__ = {
10903
10914
  }
10904
10915
  exports.isAssemblyRedirect = isAssemblyRedirect;
10905
10916
  function validateAssemblyRedirect(obj) {
10906
- const ajv = new ajv_1.default;
10917
+ const ajv = new ajv_1.default({
10918
+ allErrors: true
10919
+ });
10907
10920
  const validate = ajv.compile(exports.assemblyRedirectSchema);
10908
10921
  validate(obj);
10909
10922
  if (validate.errors) {
10910
- throw new Error(`Invalid assembly redirect:\n${validate.errors.map((e => ` * ${e.message}`)).join("\n").toString()}`);
10923
+ throw new Error(`Invalid assembly redirect:\n * ${ajv.errorsText(validate.errors, {
10924
+ separator: "\n * ",
10925
+ dataVar: "redirect"
10926
+ })}`);
10911
10927
  }
10912
10928
  return obj;
10913
10929
  }
@@ -10922,11 +10938,20 @@ var __webpack_modules__ = {
10922
10938
  const ajv_1 = __webpack_require__(2785);
10923
10939
  exports.schema = __webpack_require__(9402);
10924
10940
  function validateAssembly(obj) {
10925
- const ajv = new ajv_1.default;
10941
+ const ajv = new ajv_1.default({
10942
+ allErrors: true
10943
+ });
10926
10944
  const validate = ajv.compile(exports.schema);
10927
10945
  validate(obj);
10928
10946
  if (validate.errors) {
10929
- throw new Error(`Invalid assembly:\n${validate.errors.map((e => ` * ${e.message}`)).join("\n").toString()}`);
10947
+ let descr = "";
10948
+ if (typeof obj.name === "string" && obj.name !== "") {
10949
+ descr = typeof obj.version === "string" ? ` ${obj.name}@${obj.version}` : ` ${obj.name}`;
10950
+ }
10951
+ throw new Error(`Invalid assembly${descr}:\n * ${ajv.errorsText(validate.errors, {
10952
+ separator: "\n * ",
10953
+ dataVar: "assembly"
10954
+ })}`);
10930
10955
  }
10931
10956
  return obj;
10932
10957
  }
@@ -16195,7 +16220,7 @@ var __webpack_modules__ = {
16195
16220
  },
16196
16221
  4147: module => {
16197
16222
  "use strict";
16198
- module.exports = JSON.parse('{"name":"@jsii/runtime","version":"1.68.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.68.0","@jsii/check-node":"1.68.0","@jsii/spec":"^1.68.0"},"devDependencies":{"@scope/jsii-calc-base":"^1.68.0","@scope/jsii-calc-lib":"^1.68.0","jsii-build-tools":"^1.68.0","jsii-calc":"^3.20.120","source-map-loader":"^4.0.0","webpack":"^5.74.0","webpack-cli":"^4.10.0"}}');
16223
+ module.exports = JSON.parse('{"name":"@jsii/runtime","version":"1.70.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.70.0","@jsii/check-node":"1.70.0","@jsii/spec":"^1.70.0"},"devDependencies":{"@scope/jsii-calc-base":"^1.70.0","@scope/jsii-calc-lib":"^1.70.0","jsii-build-tools":"^1.70.0","jsii-calc":"^3.20.120","source-map-loader":"^4.0.1","webpack":"^5.74.0","webpack-cli":"^4.10.0"}}');
16199
16224
  },
16200
16225
  5277: module => {
16201
16226
  "use strict";