async-browser-context 0.2.3 → 0.3.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.
Files changed (140) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +45 -30
  3. package/dist/babel/async-generator-helpers.d.ts +6 -6
  4. package/dist/babel/async-generator-helpers.d.ts.map +1 -1
  5. package/dist/babel/async-generator-helpers.js +33 -22
  6. package/dist/babel/async-generator-helpers.js.map +1 -1
  7. package/dist/babel/async-generator-resources.d.ts +14 -0
  8. package/dist/babel/async-generator-resources.d.ts.map +1 -0
  9. package/dist/babel/async-generator-resources.js +38 -0
  10. package/dist/babel/async-generator-resources.js.map +1 -0
  11. package/dist/babel/bind-generators.d.ts +1 -1
  12. package/dist/babel/bind-generators.d.ts.map +1 -1
  13. package/dist/babel/bind-generators.js +88 -44
  14. package/dist/babel/bind-generators.js.map +1 -1
  15. package/dist/babel/name-coroutines.d.ts +14 -8
  16. package/dist/babel/name-coroutines.d.ts.map +1 -1
  17. package/dist/babel/name-coroutines.js +160 -39
  18. package/dist/babel/name-coroutines.js.map +1 -1
  19. package/dist/babel/preset.d.ts +24 -13
  20. package/dist/babel/preset.d.ts.map +1 -1
  21. package/dist/babel/preset.js +37 -9
  22. package/dist/babel/preset.js.map +1 -1
  23. package/dist/babel/runtime-calls.d.ts +22 -0
  24. package/dist/babel/runtime-calls.d.ts.map +1 -0
  25. package/dist/babel/runtime-calls.js +69 -0
  26. package/dist/babel/runtime-calls.js.map +1 -0
  27. package/dist/babel/skip-runtime.d.ts +18 -11
  28. package/dist/babel/skip-runtime.d.ts.map +1 -1
  29. package/dist/babel/skip-runtime.js +52 -16
  30. package/dist/babel/skip-runtime.js.map +1 -1
  31. package/dist/babel/static-members.d.ts +4 -0
  32. package/dist/babel/static-members.d.ts.map +1 -0
  33. package/dist/babel/static-members.js +112 -0
  34. package/dist/babel/static-members.js.map +1 -0
  35. package/dist/core/async-generator.d.ts +51 -13
  36. package/dist/core/async-generator.d.ts.map +1 -1
  37. package/dist/core/async-generator.js +255 -58
  38. package/dist/core/async-generator.js.map +1 -1
  39. package/dist/core/async-local-storage.d.ts +3 -0
  40. package/dist/core/async-local-storage.d.ts.map +1 -1
  41. package/dist/core/async-local-storage.js +3 -0
  42. package/dist/core/async-local-storage.js.map +1 -1
  43. package/dist/core/callback-hook.d.ts +3 -3
  44. package/dist/core/coroutine.d.ts +6 -2
  45. package/dist/core/coroutine.d.ts.map +1 -1
  46. package/dist/core/coroutine.js +106 -44
  47. package/dist/core/coroutine.js.map +1 -1
  48. package/dist/core/function-name.d.ts +9 -0
  49. package/dist/core/function-name.d.ts.map +1 -0
  50. package/dist/core/function-name.js +12 -0
  51. package/dist/core/function-name.js.map +1 -0
  52. package/dist/core/hooks.d.ts +2 -1
  53. package/dist/core/hooks.d.ts.map +1 -1
  54. package/dist/core/hooks.js +21 -6
  55. package/dist/core/hooks.js.map +1 -1
  56. package/dist/core/snapshot.d.ts +2 -1
  57. package/dist/core/snapshot.d.ts.map +1 -1
  58. package/dist/core/snapshot.js +7 -3
  59. package/dist/core/snapshot.js.map +1 -1
  60. package/dist/core/store.d.ts +28 -0
  61. package/dist/core/store.d.ts.map +1 -1
  62. package/dist/core/store.js +90 -20
  63. package/dist/core/store.js.map +1 -1
  64. package/dist/core/variable.d.ts +2 -1
  65. package/dist/core/variable.d.ts.map +1 -1
  66. package/dist/core/variable.js +5 -2
  67. package/dist/core/variable.js.map +1 -1
  68. package/dist/node/index.d.ts +10 -4
  69. package/dist/node/index.d.ts.map +1 -1
  70. package/dist/node/index.js +51 -16
  71. package/dist/node/index.js.map +1 -1
  72. package/dist/node/runtime.d.ts +7 -6
  73. package/dist/node/runtime.d.ts.map +1 -1
  74. package/dist/node/runtime.js +29 -16
  75. package/dist/node/runtime.js.map +1 -1
  76. package/dist/opentelemetry/context-manager.d.ts.map +1 -1
  77. package/dist/opentelemetry/context-manager.js +172 -13
  78. package/dist/opentelemetry/context-manager.js.map +1 -1
  79. package/dist/patches/callbacks.d.ts.map +1 -1
  80. package/dist/patches/callbacks.js +84 -29
  81. package/dist/patches/callbacks.js.map +1 -1
  82. package/dist/patches/events.d.ts.map +1 -1
  83. package/dist/patches/events.js +203 -91
  84. package/dist/patches/events.js.map +1 -1
  85. package/dist/patches/handler-interfaces.d.ts +3 -2
  86. package/dist/patches/handler-interfaces.d.ts.map +1 -1
  87. package/dist/patches/handler-interfaces.js +3 -2
  88. package/dist/patches/handler-interfaces.js.map +1 -1
  89. package/dist/patches/promise.d.ts +3 -0
  90. package/dist/patches/promise.d.ts.map +1 -1
  91. package/dist/patches/promise.js +13 -5
  92. package/dist/patches/promise.js.map +1 -1
  93. package/dist/patches/streams.d.ts.map +1 -1
  94. package/dist/patches/streams.js +36 -16
  95. package/dist/patches/streams.js.map +1 -1
  96. package/dist/patches/timers.d.ts.map +1 -1
  97. package/dist/patches/timers.js +17 -5
  98. package/dist/patches/timers.js.map +1 -1
  99. package/dist/patches/to-string.d.ts +4 -0
  100. package/dist/patches/to-string.d.ts.map +1 -1
  101. package/dist/patches/to-string.js +12 -6
  102. package/dist/patches/to-string.js.map +1 -1
  103. package/dist/runtime.d.ts +3 -3
  104. package/dist/runtime.d.ts.map +1 -1
  105. package/dist/runtime.js +3 -3
  106. package/dist/runtime.js.map +1 -1
  107. package/dist/vite/plugin.d.ts +7 -2
  108. package/dist/vite/plugin.d.ts.map +1 -1
  109. package/dist/vite/plugin.js +30 -6
  110. package/dist/vite/plugin.js.map +1 -1
  111. package/package.json +49 -25
  112. package/src/babel/async-generator-helpers.ts +34 -23
  113. package/src/babel/async-generator-resources.ts +40 -0
  114. package/src/babel/bind-generators.ts +91 -47
  115. package/src/babel/name-coroutines.ts +170 -41
  116. package/src/babel/preset.ts +47 -15
  117. package/src/babel/runtime-calls.ts +73 -0
  118. package/src/babel/skip-runtime.ts +58 -18
  119. package/src/babel/static-members.ts +117 -0
  120. package/src/core/async-generator.ts +273 -62
  121. package/src/core/async-local-storage.ts +3 -0
  122. package/src/core/callback-hook.ts +3 -3
  123. package/src/core/coroutine.ts +104 -43
  124. package/src/core/function-name.ts +11 -0
  125. package/src/core/hooks.ts +23 -6
  126. package/src/core/snapshot.ts +8 -3
  127. package/src/core/store.ts +107 -21
  128. package/src/core/variable.ts +6 -2
  129. package/src/node/index.ts +62 -19
  130. package/src/node/runtime.ts +33 -15
  131. package/src/opentelemetry/context-manager.ts +188 -13
  132. package/src/patches/callbacks.ts +87 -30
  133. package/src/patches/events.ts +249 -103
  134. package/src/patches/handler-interfaces.ts +3 -2
  135. package/src/patches/promise.ts +17 -13
  136. package/src/patches/streams.ts +36 -16
  137. package/src/patches/timers.ts +17 -5
  138. package/src/patches/to-string.ts +12 -6
  139. package/src/runtime.ts +3 -3
  140. package/src/vite/plugin.ts +38 -8
@@ -1,5 +1,6 @@
1
- import { createAsyncGenerator, OverloadYield } from "./async-generator.js";
2
- import { applyWithHooks, store } from "./store.js";
1
+ import { createAsyncGenerator, isObject, PlainValue, unbox } from "./async-generator.js";
2
+ import { copyNameAndLength } from "./function-name.js";
3
+ import { applyQuietly, applyWithHooks, store } from "./store.js";
3
4
  /**
4
5
  * The code from the Babel preset uses these runtime functions. Do not use them
5
6
  * directly.
@@ -12,52 +13,104 @@ import { applyWithHooks, store } from "./store.js";
12
13
  */
13
14
  /**
14
15
  * This function gives the generator function to the callback hooks, with the name of the
15
- * async function. The preset gives the name, because the generator function
16
+ * async function or the async generator. The preset gives the name, because the generator function
16
17
  * of Babel has no name. The function sets the name only when a hook operates.
17
18
  */
18
19
  function namedForHooks(generatorFunction, name) {
19
- if (name !== undefined && generatorFunction.name !== name) {
20
+ if (name === undefined) {
21
+ return generatorFunction;
22
+ }
23
+ // Stryker disable next-line ConditionalExpression: the check only prevents a second change to the same name
24
+ if (generatorFunction.name !== name) {
20
25
  Object.defineProperty(generatorFunction, "name", { value: name, configurable: true });
21
26
  }
22
27
  return generatorFunction;
23
28
  }
29
+ /**
30
+ * This function gives the value that a driver awaits or gives as its result, in place of `value`. It
31
+ * operates in the context of the body, as `await` reads the `then` property there:
32
+ *
33
+ * - A primitive value and a native promise stay the same. `await` does not read a `then`
34
+ * property of them.
35
+ * - For another object, the function reads `then` one time. A `then` method gets the current
36
+ * frame for its later call. Thus the method operates in the context of the body, as with
37
+ * the native `AsyncLocalStorage`. With `box`, an object without a `then` method goes into a
38
+ * box, so that the engine does not read `then` a second time.
39
+ * - When the read throws, the function gives a rejected promise: the error goes into the body.
40
+ */
41
+ function awaitable(value, NativePromise, box) {
42
+ if (!isObject(value)) {
43
+ return value;
44
+ }
45
+ let then;
46
+ try {
47
+ if (value instanceof NativePromise && value.constructor === NativePromise) {
48
+ return value;
49
+ }
50
+ then = value.then;
51
+ }
52
+ catch (error) {
53
+ return new NativePromise((_resolve, reject) => reject(error));
54
+ }
55
+ if (typeof then !== "function") {
56
+ return box ? new PlainValue(value) : value;
57
+ }
58
+ const frame = store.current;
59
+ return {
60
+ then(resolve, reject) {
61
+ const previous = store.current;
62
+ store.current = frame;
63
+ try {
64
+ return Reflect.apply(then, value, [resolve, reject]);
65
+ }
66
+ finally {
67
+ store.current = previous;
68
+ }
69
+ },
70
+ };
71
+ }
24
72
  /**
25
73
  * This function gives an async function that operates `generatorFunction`. The preset gives
26
74
  * this function to `@babel/plugin-transform-async-to-generator` as its
27
75
  * `method` option, and adds `name`, the name of the async function, if it has one.
76
+ *
77
+ * The first step of the body operates in the step of the caller. Thus an `enterWith()` of that
78
+ * step stays for the caller, as on Node.js.
28
79
  */
29
80
  export function coroutine(generatorFunction, name) {
30
- const { promiseResolve } = store.intrinsics;
31
- return function asyncFunction(...args) {
81
+ const NativePromise = store.intrinsics.Promise;
82
+ const asyncFunction = function asyncFunction(...args) {
32
83
  // The context of the call. The body can change it with AsyncLocalStorage.enterWith.
33
84
  let frame = store.current;
85
+ // An async function that a hook starts does not start the hooks (store.ts, applyQuietly)
86
+ const quiet = store.inHook === true;
34
87
  let generator;
35
88
  const next = (value) => generator.next(value);
36
89
  const throwInto = (error) => generator.throw(error);
37
90
  /**
38
- * This function does one step of the body in the context of the async function, and sets
39
- * the previous context again. `resumed` is `true` for a step after an `await`. Only these
40
- * steps start the hook methods. The function gives the value to await.
91
+ * This function does one step of the body in the context of the async function. `resumed`
92
+ * is `true` for a step after an `await`. Only these steps start the hook methods. After a
93
+ * resumed step, the function sets the previous context again. The first step operates in
94
+ * the code of the caller, so an `enterWith` of that step stays for the caller, as on
95
+ * Node.js. The function gives the value to await, or the result of the function.
41
96
  */
42
97
  const step = (resume, argument, resumed) => {
43
98
  const previous = store.current;
44
99
  store.current = frame;
45
100
  try {
46
101
  const hooks = resumed ? store.hooks : undefined;
47
- const result = hooks === undefined
48
- ? resume(argument)
49
- : applyWithHooks(hooks, namedForHooks(generatorFunction, name), "await", resume, undefined, [argument]);
50
- const value = result.value;
51
- if (!result.done && ((typeof value === "object" && value !== null) || typeof value === "function")) {
52
- // Promise.resolve reads the "then" property of an object. Do it in the context of the body, as await does.
53
- // The result object is new for each step, so the change is not visible to other code.
54
- result.value = promiseResolve(value);
55
- }
102
+ const result = quiet
103
+ ? applyQuietly(resume, undefined, [argument])
104
+ : hooks === undefined
105
+ ? resume(argument)
106
+ : applyWithHooks(hooks, namedForHooks(generatorFunction, name), "await", resume, undefined, [argument]);
107
+ // The result object is new for each step, so the change is not visible to other code
108
+ result.value = awaitable(result.value, NativePromise, result.done !== true);
56
109
  return result;
57
110
  }
58
111
  finally {
59
112
  frame = store.current;
60
- store.current = previous;
113
+ store.current = resumed ? previous : frame;
61
114
  }
62
115
  };
63
116
  /**
@@ -67,14 +120,15 @@ export function coroutine(generatorFunction, name) {
67
120
  */
68
121
  const drive = async () => {
69
122
  // The directive tells the Babel preset not to change this function (src/babel/skip-runtime.ts)
123
+ // Stryker disable next-line all: the directive matters only when a bundler applies the preset to the runtime
70
124
  "async-browser-context runtime";
71
125
  // In the driver, an error of the parameters rejects the promise, as with a native async function
72
- generator = generatorFunction.apply(this, args);
126
+ generator = Reflect.apply(generatorFunction, this, args);
73
127
  let result = step(next, undefined, false);
74
128
  while (result.done !== true) {
75
129
  let value;
76
130
  try {
77
- value = await result.value;
131
+ value = unbox(await result.value);
78
132
  }
79
133
  catch (error) {
80
134
  result = step(throwInto, error, true);
@@ -86,56 +140,64 @@ export function coroutine(generatorFunction, name) {
86
140
  };
87
141
  return drive();
88
142
  };
89
- }
90
- /** This function gives `true` for a value that can have a `then` property: an object or a function. */
91
- function isObject(value) {
92
- return (typeof value === "object" && value !== null) || typeof value === "function";
143
+ // Where Babel gives no named wrapper, for example in a class field, the function keeps the name and the length of the source
144
+ copyNameAndLength(asyncFunction, name, generatorFunction.length);
145
+ return asyncFunction;
93
146
  }
94
147
  /**
95
148
  * This function gives a function that makes an async generator object, which operates
96
149
  * `generatorFunction`. The preset gives this function in place of the helper
97
- * `wrapAsyncGenerator` of `@babel/plugin-transform-async-generator-functions`.
150
+ * `wrapAsyncGenerator` of `@babel/plugin-transform-async-generator-functions`. It adds `name`,
151
+ * the name of the async generator, if it has one.
98
152
  *
99
153
  * Each step of the body operates in the context of the call that made the generator
100
154
  * (rule C5). The driver continues each step with a native `await` (`async-generator.ts`).
101
155
  */
102
- export function asyncGenerator(generatorFunction) {
103
- const { Promise: NativePromise, promiseResolve } = store.intrinsics;
104
- return function makeAsyncGenerator(...args) {
156
+ export function asyncGenerator(generatorFunction, name) {
157
+ const NativePromise = store.intrinsics.Promise;
158
+ const makeAsyncGenerator = function makeAsyncGenerator(...args) {
105
159
  let frame = store.current;
106
- const generator = generatorFunction.apply(this, args);
160
+ // An async generator that a hook makes does not start the hooks (store.ts, applyQuietly)
161
+ const quiet = store.inHook === true;
162
+ const generator = Reflect.apply(generatorFunction, this, args);
107
163
  const methods = {
108
164
  next: (argument) => generator.next(argument),
109
165
  throw: (argument) => generator.throw(argument),
110
166
  return: (argument) => generator.return(argument),
111
167
  };
168
+ /** One step of the body in the context of the generator. The result stays the same: `yield*` gives the result of the delegate back. */
112
169
  const step = (key, argument, resumed) => {
113
170
  const previous = store.current;
114
171
  store.current = frame;
115
172
  try {
173
+ if (quiet) {
174
+ return applyQuietly(methods[key], undefined, [argument]);
175
+ }
116
176
  const hooks = resumed ? store.hooks : undefined;
117
- const result = hooks === undefined
177
+ return hooks === undefined
118
178
  ? methods[key](argument)
119
- : applyWithHooks(hooks, generatorFunction, "await", methods[key], undefined, [argument]);
120
- // Read the "then" property of an awaited or yielded object in the context of the body, as await and yield do
121
- const value = result.value;
122
- if (value instanceof OverloadYield) {
123
- if (isObject(value.v)) {
124
- value.v = promiseResolve(value.v);
125
- }
126
- }
127
- else if (isObject(value)) {
128
- result.value = promiseResolve(value);
129
- }
130
- return result;
179
+ : applyWithHooks(hooks, namedForHooks(generatorFunction, name), "await", methods[key], undefined, [argument]);
131
180
  }
132
181
  finally {
133
182
  frame = store.current;
134
183
  store.current = previous;
135
184
  }
136
185
  };
137
- return createAsyncGenerator(step, NativePromise);
186
+ /** The value to await, in the context of the generator: `await` and `yield` read the `then` property of an object there. */
187
+ const prepare = (value) => {
188
+ const previous = store.current;
189
+ store.current = frame;
190
+ try {
191
+ return awaitable(value, NativePromise, true);
192
+ }
193
+ finally {
194
+ store.current = previous;
195
+ }
196
+ };
197
+ return createAsyncGenerator(step, NativePromise, undefined, prepare);
138
198
  };
199
+ copyNameAndLength(makeAsyncGenerator, name, generatorFunction.length);
200
+ return makeAsyncGenerator;
139
201
  }
140
202
  /**
141
203
  * This function binds a generator object to the current context. The body of
@@ -1 +1 @@
1
- {"version":3,"file":"coroutine.js","sourceRoot":"","sources":["../../src/core/coroutine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,KAAK,EAAc,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,SAAS,aAAa,CAAC,iBAA4B,EAAE,IAAyB;IAC1E,IAAI,IAAI,KA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AC;IACH,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This function gives the function of the runtime the `name` and the `length` of the source
3
+ * function, as the native function has them. Without a name, the name is the empty string, as
4
+ * for a native anonymous function. The preset gives the name, if the source has one. Where Babel
5
+ * gives no named wrapper, for example in a class field, the function of the runtime is the
6
+ * function that the program sees. The browser runtime and the Node.js runtime both use it.
7
+ */
8
+ export declare function copyNameAndLength(fn: Function, name: string | undefined, length: number): void;
9
+ //# sourceMappingURL=function-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-name.d.ts","sourceRoot":"","sources":["../../src/core/function-name.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAG,QAAQ,EAAE,IAAI,EAAG,MAAM,GAAG,SAAS,EAAE,MAAM,EAAG,MAAM,GAAI,IAAI,CAGlG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This function gives the function of the runtime the `name` and the `length` of the source
3
+ * function, as the native function has them. Without a name, the name is the empty string, as
4
+ * for a native anonymous function. The preset gives the name, if the source has one. Where Babel
5
+ * gives no named wrapper, for example in a class field, the function of the runtime is the
6
+ * function that the program sees. The browser runtime and the Node.js runtime both use it.
7
+ */
8
+ export function copyNameAndLength(fn, name, length) {
9
+ Object.defineProperty(fn, "name", { value: name ?? "", configurable: true });
10
+ Object.defineProperty(fn, "length", { value: length, configurable: true });
11
+ }
12
+ //# sourceMappingURL=function-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-name.js","sourceRoot":"","sources":["../../src/core/function-name.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAa,EAAE,IAAyB,EAAE,MAAe;IACvF,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAG,IAAI,IAAI,EAAE,EAAE,YAAY,EAAG,IAAI,EAAE,CAAC,CAAC;IAC/E,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAG,MAAM,EAAE,YAAY,EAAG,IAAI,EAAE,CAAC,CAAC;AACjF,CAAC"}
@@ -9,7 +9,8 @@ export type { CallbackHook } from "./callback-hook.js";
9
9
  * A tool can use the hook to measure the time of each callback, with the
10
10
  * name of the callback and the values of its context. An error in a hook goes
11
11
  * to `reportError()`, and the callback operates as usual. A callback that
12
- * starts synchronously in a hook does not start the hook methods.
12
+ * starts synchronously in a hook does not start the hook methods. A callback
13
+ * that a hook schedules does not start them either, also later.
13
14
  */
14
15
  export declare function addCallbackHook(hook: CallbackHook): () => void;
15
16
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/core/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG3E,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAG,YAAY,GAAI,MAAM,IAAI,CAahE"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/core/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAG3E,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAqBvD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAG,YAAY,GAAI,MAAM,IAAI,CAUhE"}
@@ -1,5 +1,22 @@
1
1
  import { assertCallbackHook } from "./callback-hook.js";
2
2
  import { store } from "./store.js";
3
+ let warned = false;
4
+ /**
5
+ * Version 0.1 of the library has no callback hooks. If a copy of version 0.1 installed some
6
+ * patches first, the callbacks of those patches do not start the hooks. The function tells
7
+ * this one time on the console. The patches of version 0.2 start the hooks, and the patch of
8
+ * `Function.prototype.toString` has no callbacks.
9
+ */
10
+ function warnAboutOldPatches() {
11
+ if (warned) {
12
+ return;
13
+ }
14
+ const without = [...(store.oldCopyPatches ?? [])].filter((name) => name !== "Function.prototype.toString");
15
+ if (without.length > 0) {
16
+ warned = true;
17
+ console.warn(`async-browser-context: an older copy of the library installed these patches, and their callbacks do not start the callback hooks: ${without.join(", ")}`);
18
+ }
19
+ }
3
20
  /**
4
21
  * This function adds a hook. The library starts its methods before and after each
5
22
  * callback that it starts. These callbacks are the callbacks of the patched
@@ -9,18 +26,16 @@ import { store } from "./store.js";
9
26
  * A tool can use the hook to measure the time of each callback, with the
10
27
  * name of the callback and the values of its context. An error in a hook goes
11
28
  * to `reportError()`, and the callback operates as usual. A callback that
12
- * starts synchronously in a hook does not start the hook methods.
29
+ * starts synchronously in a hook does not start the hook methods. A callback
30
+ * that a hook schedules does not start them either, also later.
13
31
  */
14
32
  export function addCallbackHook(hook) {
15
33
  assertCallbackHook(hook);
34
+ warnAboutOldPatches();
16
35
  const entry = { hook };
17
36
  store.hooks = [...(store.hooks ?? []), entry];
18
- let removed = false;
37
+ // A second removal finds no entry, and the list stays the same
19
38
  return function removeCallbackHook() {
20
- if (removed) {
21
- return;
22
- }
23
- removed = true;
24
39
  const remaining = (store.hooks ?? []).filter((other) => other !== entry);
25
40
  store.hooks = remaining.length === 0 ? undefined : remaining;
26
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/core/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAkB,MAAM,YAAY,CAAC;AAInD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,IAAmB;IAC/C,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,KAAK,GAAe,EAAE,IAAI,EAAE,CAAC;IACnC,KAAK,CAA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AAe,CAAC,IAAmB;IAC/C,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACzB,mBAAmB,EAAE,CAAC;IACtB,MAAM,KAAK,GAAe,EAAE,IAAI,EAAE,CAAC;IACnC,KAAK,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IAC9C,+DAA+D;IAC/D,OAAO,SAAS,kBAAkB;QAC9B,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QACzE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC,CAAC;AACN,CAAC"}
@@ -16,7 +16,8 @@ export declare class Snapshot {
16
16
  /**
17
17
  * This method records the current context and gives a wrapper of `fn`. The
18
18
  * wrapper starts `fn` in the recorded context, with the `this` value and the arguments of
19
- * each call.
19
+ * each call. The name of the wrapper is "wrapped" and the name of `fn`, and its length is
20
+ * the length of `fn`.
20
21
  */
21
22
  static wrap<T, A extends unknown[], R>(fn: (this: T, ...args: A) => R): (this: T, ...args: A) => R;
22
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/core/snapshot.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,QAAQ;;IAGjB;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAG,CAAC,GAAG,IAAI,EAAG,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,EAAG,CAAC,GAAI,CAAC;IAUrE;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,EAAG,CAAC,IAAI,EAAG,CAAC,EAAE,GAAG,IAAI,EAAG,CAAC,KAAK,CAAC,GAAI,CAAC,IAAI,EAAG,CAAC,EAAE,GAAG,IAAI,EAAG,CAAC,KAAK,CAAC;CAkB3G"}
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/core/snapshot.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,QAAQ;;IAGjB;;;OAGG;IACH,GAAG,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAG,CAAC,GAAG,IAAI,EAAG,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,EAAG,CAAC,GAAI,CAAC;IAUrE;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,EAAG,CAAC,IAAI,EAAG,CAAC,EAAE,GAAG,IAAI,EAAG,CAAC,KAAK,CAAC,GAAI,CAAC,IAAI,EAAG,CAAC,EAAE,GAAG,IAAI,EAAG,CAAC,KAAK,CAAC;CAoB3G"}
@@ -26,7 +26,8 @@ export class Snapshot {
26
26
  /**
27
27
  * This method records the current context and gives a wrapper of `fn`. The
28
28
  * wrapper starts `fn` in the recorded context, with the `this` value and the arguments of
29
- * each call.
29
+ * each call. The name of the wrapper is "wrapped" and the name of `fn`, and its length is
30
+ * the length of `fn`.
30
31
  */
31
32
  static wrap(fn) {
32
33
  if (typeof fn !== "function") {
@@ -37,15 +38,18 @@ export class Snapshot {
37
38
  const previous = store.current;
38
39
  store.current = frame;
39
40
  try {
40
- return fn.apply(this, args);
41
+ return Reflect.apply(fn, this, args);
41
42
  }
42
43
  finally {
43
44
  store.current = previous;
44
45
  }
45
46
  };
46
- Object.defineProperty(wrapped, "name", { value: fn.name, configurable: true });
47
+ // As CopyNameAndLength with the prefix "wrapped" in the TC39 draft
48
+ const name = fn.name;
49
+ Object.defineProperty(wrapped, "name", { value: `wrapped ${typeof name === "string" ? name : ""}`, configurable: true });
47
50
  Object.defineProperty(wrapped, "length", { value: fn.length, configurable: true });
48
51
  return wrapped;
49
52
  }
50
53
  }
54
+ Object.defineProperty(Snapshot.prototype, Symbol.toStringTag, { value: "AsyncContext.Snapshot", configurable: true });
51
55
  //# sourceMappingURL=snapshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/core/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,YAAY,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,OAAO,QAAQ;IACR,MAAM,GAAW,KAAK,CAAC,OAAO,CAAC;IAExC;;;OAGG;IACH,GAAG,CAAyB,EAAuB,EAAE,GAAG,IAAQ;QAC5D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;QAC/B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC;YACD,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACvB,CAAC;gBAAS,CAAC;YACP,KAAK,CAAC,OAAO,GAAG,QAAQ,CAAC;QAC7B,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAA4B,EAAiC;QACpE,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;YAC3B,MAAM,IAAI,SAAS,CAAC,+CAA+C,CAAC,CAAC;QACzE,CAAC;QACD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,MAAM,OAAO,GAAG,UAAoB,GAAG,IAAQ;YAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;YAC/B,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC;gBACD,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChC,CAAC;oBAA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B,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC;gBACD,OAAO,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC;oBAAS,CAAC;gBACP,KAAK,CAAC,OAAO,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACL,CAAC,CAAC;QACF,mEAAmE;QACnE,MAAM,IAAI,GAAa,EAAE,CAAC,IAAI,CAAC;QAC/B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAG,WAAW,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,YAAY,EAAG,IAAI,EAAE,CAAC,CAAC;QAC3H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAG,EAAE,CAAC,MAAM,EAAE,YAAY,EAAG,IAAI,EAAE,CAAC,CAAC;QACrF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,KAAK,EAAG,uBAAuB,EAAE,YAAY,EAAG,IAAI,EAAE,CAAC,CAAC"}
@@ -17,8 +17,10 @@ export interface Frame {
17
17
  /** The native functions that the runtime uses. The store records them before a patch replaces them. */
18
18
  export interface Intrinsics {
19
19
  readonly Promise: PromiseConstructor;
20
+ /** The patch of version 0.3 does not use it. An older copy of the library that shares the store can use it. */
20
21
  readonly promiseThen: typeof Promise.prototype.then;
21
22
  readonly promiseResolve: <T>(value: T) => Promise<Awaited<T>>;
23
+ /** The patch of version 0.3 does not use it. An older copy of the library that shares the store can use it. */
22
24
  readonly functionToString: () => string;
23
25
  }
24
26
  export interface ContextStore {
@@ -39,6 +41,18 @@ export interface ContextStore {
39
41
  hooks?: readonly HookEntry[] | undefined;
40
42
  /** `true` while a hook operates. Callbacks that start in a hook do not start the hook methods. */
41
43
  inHook?: boolean | undefined;
44
+ /**
45
+ * The patches that a copy of version 0.1 installed before a newer copy loaded. Version 0.1
46
+ * has no callback hooks, so the callbacks of these patches do not start the hooks. Only a
47
+ * store that a copy of version 0.1 made has this property.
48
+ */
49
+ oldCopyPatches?: ReadonlySet<string> | undefined;
50
+ /**
51
+ * The frame that stays current between tasks: the root frame, or the frame of a top-level
52
+ * `enterWith()` (a default store). The event patch handles it as the root frame (rule C13).
53
+ * The store of an older copy of the library does not have this property.
54
+ */
55
+ idle?: Frame | undefined;
42
56
  }
43
57
  /** The methods of a callback hook. The public type is `CallbackHook` in `hooks.ts`. */
44
58
  export interface HookMethods {
@@ -51,6 +65,13 @@ export interface HookEntry {
51
65
  }
52
66
  /** The store of this global object. */
53
67
  export declare const store: ContextStore;
68
+ /**
69
+ * This function records `store.idle` in the next microtask. `enterWith()` starts it, because a
70
+ * top-level `enterWith()` changes the frame that stays current between tasks. A microtask
71
+ * operates when the stack is empty, after each wrapper set its previous frame again. The callback
72
+ * goes to the native `then`, so no wrapper sets a frame for it.
73
+ */
74
+ export declare function recordIdleFrame(): void;
54
75
  /** This function makes `frame` the current frame. It gives the frame that was current before. */
55
76
  export declare function enter(frame: Frame): Frame;
56
77
  /** The result of `findValue` when no frame sets the variable. */
@@ -66,6 +87,13 @@ export declare function findValue(frame: Frame, variable: object): unknown;
66
87
  * the hooks again.
67
88
  */
68
89
  export declare function applyWithHooks<T, A extends unknown[], R>(hooks: readonly HookEntry[], callback: Function, source: string, fn: (this: T, ...args: A) => R, thisValue: T, args: A): R;
90
+ /**
91
+ * This function starts `fn` as a callback that a hook registered: the hooks do not operate for
92
+ * it. `store.inHook` stays `true` while it operates. Thus the callbacks and the async functions
93
+ * that it starts or registers do not start the hooks either. A hook cannot start itself without
94
+ * end, also through a chain of callbacks.
95
+ */
96
+ export declare function applyQuietly<T, A extends unknown[], R>(fn: (this: T, ...args: A) => R, thisValue: T, args: A): R;
69
97
  /**
70
98
  * This function wraps `fn`. The wrapper starts `fn` in `frame`, with the `this`
71
99
  * value and the arguments of the call. After `fn` ends, also with an error, the
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sDAAsD;AACtD,MAAM,WAAW,KAAK;IAClB,QAAQ,CAAC,MAAM,EAAG,KAAK,GAAG,IAAI,CAAC;CAClC;AAED,uGAAuG;AACvG,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,OAAO,EAAG,kBAAkB,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAG,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,cAAc,EAAG,CAAC,CAAC,EAAE,KAAK,EAAG,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,QAAQ,CAAC,gBAAgB,EAAG,MAAM,MAAM,CAAC;CAC5C;AAED,MAAM,WAAW,YAAY;IACzB,wDAAwD;IACxD,OAAO,EAAG,KAAK,CAAC;IAChB,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAG,KAAK,CAAC;IACtB,mGAAmG;IACnG,QAAQ,CAAC,OAAO,EAAG,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,wGAAwG;IACxG,QAAQ,CAAC,SAAS,EAAG,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAG,UAAU,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAG,SAAS,SAAS,EAAE,GAAG,SAAS,CAAC;IAC1C,kGAAkG;IAClG,MAAM,CAAC,EAAG,OAAO,GAAG,SAAS,CAAC;CACjC;AAED,uFAAuF;AACvF,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,CAAC,QAAQ,EAAG,QAAQ,EAAE,MAAM,EAAG,MAAM,GAAI,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