@endo/eventual-send 0.17.0 → 0.17.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endo/eventual-send",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "description": "Extend a Promise class to implement the eventual-send API",
5
5
  "type": "module",
6
6
  "main": "src/no-shim.js",
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "homepage": "https://github.com/endojs/endo#readme",
32
32
  "devDependencies": {
33
- "@endo/lockdown": "^0.1.26",
34
- "@endo/ses-ava": "^0.2.38",
33
+ "@endo/lockdown": "^0.1.28",
34
+ "@endo/ses-ava": "^0.2.40",
35
35
  "ava": "^5.2.0",
36
36
  "c8": "^7.7.3",
37
37
  "tsd": "^0.24.1"
@@ -49,14 +49,9 @@
49
49
  ],
50
50
  "eslintConfig": {
51
51
  "extends": [
52
- "@endo"
52
+ "plugin:@endo/internal"
53
53
  ]
54
54
  },
55
- "prettier": {
56
- "arrowParens": "avoid",
57
- "trailingComma": "all",
58
- "singleQuote": true
59
- },
60
55
  "publishConfig": {
61
56
  "access": "public"
62
57
  },
@@ -66,5 +61,5 @@
66
61
  ],
67
62
  "timeout": "2m"
68
63
  },
69
- "gitHead": "0053227a37ee76ee8a3dce6059dd55140ed0ce6d"
64
+ "gitHead": "38c2c59d6ae8c53f84cd333e6c7828e2d37604e2"
70
65
  }
@@ -508,7 +508,7 @@ export const makeHandledPromise = () => {
508
508
  return;
509
509
  }
510
510
  try {
511
- resolve(trackedDoDispatch(handlerName, handler, o));
511
+ resolve(harden(trackedDoDispatch(handlerName, handler, o)));
512
512
  } catch (reason) {
513
513
  reject(harden(reason));
514
514
  }
@@ -1,11 +1,11 @@
1
- /* eslint-disable @endo/no-polymorphic-call, import/no-extraneous-dependencies, no-restricted-globals, prettier/prettier */
1
+ /* eslint-disable @endo/no-polymorphic-call, import/no-extraneous-dependencies, no-restricted-globals */
2
2
  import { expectType } from 'tsd';
3
3
  import { E } from '../test/get-hp.js';
4
4
  import { DataOnly, ERef } from './index.js';
5
5
 
6
6
  type FarRef<
7
7
  Primary,
8
- Local = DataOnly<Primary>
8
+ Local = DataOnly<Primary>,
9
9
  > = import('@endo/eventual-send').FarRef<Primary, Local>;
10
10
 
11
11
  // Check the legacy ERef type
@@ -1 +1 @@
1
- {"version":3,"file":"track-turns.d.ts","sourceRoot":"","sources":["track-turns.js"],"names":[],"mappings":"AA+FO,mEAeN;;;;;uCAnCuB,GAAG,EAAE,KAAK,GAAG"}
1
+ {"version":3,"file":"track-turns.d.ts","sourceRoot":"","sources":["track-turns.js"],"names":[],"mappings":"AAwGO,mEAeN;;;;;uCAnCuB,GAAG,EAAE,KAAK,GAAG"}
@@ -1,6 +1,8 @@
1
1
  /* global globalThis */
2
2
  // @ts-nocheck
3
3
 
4
+ const { freeze } = Object;
5
+
4
6
  // NOTE: We can't import these because they're not in scope before lockdown.
5
7
  // import { assert, details as X, Fail } from '@agoric/assert';
6
8
 
@@ -22,12 +24,19 @@ const env = (globalThis.process || {}).env || {};
22
24
  // Turn on if you seem to be losing error logging at the top of the event loop
23
25
  const VERBOSE = (env.DEBUG || '').split(':').includes('track-turns');
24
26
 
25
- // Track-turns is disabled by default and can be enabled by an environment
26
- // option. We intend to change the default after verifying that having
27
- // the feature enabled in production does not cause memory to leak.
28
- const ENABLED = env.TRACK_TURNS === 'enabled';
27
+ const validOptionValues = freeze([undefined, 'enabled', 'disabled']);
28
+
29
+ // Track-turns is enabled by default and can be disabled by an environment
30
+ // option.
31
+ const envOptionValue = env.TRACK_TURNS;
32
+ if (!validOptionValues.includes(envOptionValue)) {
33
+ throw new TypeError(
34
+ `unrecognized TRACK_TURNS ${JSON.stringify(envOptionValue)}`,
35
+ );
36
+ }
37
+ const ENABLED = (envOptionValue || 'disabled') === 'enabled';
29
38
 
30
- // We hoist these functions out of trackTurns() to discourage the
39
+ // We hoist the following functions out of trackTurns() to discourage the
31
40
  // closures from holding onto 'args' or 'func' longer than necessary,
32
41
  // which we've seen cause HandledPromise arguments to be retained for
33
42
  // a surprisingly long time.
@@ -66,7 +75,7 @@ const wrapFunction =
66
75
  // Must capture this now, not when the catch triggers.
67
76
  const detailsNote = X`Rejection from: ${hiddenPriorError}:${hiddenCurrentTurn}.${hiddenCurrentEvent}`;
68
77
  Promise.resolve(result).catch(addRejectionNote(detailsNote));
69
- return harden(result);
78
+ return result;
70
79
  } finally {
71
80
  hiddenPriorError = undefined;
72
81
  }