@nxtedition/yield 1.0.15 → 1.0.17

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 (2) hide show
  1. package/lib/index.js +7 -2
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -116,8 +116,13 @@ function dispatchYield() {
116
116
  try {
117
117
  resolve(opaque)
118
118
  } catch (err) {
119
+ // Isolate the throw: rethrow asynchronously so dispatch continues.
120
+ // Otherwise yieldIndex stays mid-loop and the queue gets stuck.
121
+ // Materialize the stack now — queueMicrotask severs the sync frame.
122
+ if (err instanceof Error) {
123
+ void err.stack
124
+ }
119
125
  queueMicrotask(() => {
120
- // Crash the process on unhandled exceptions to avoid leaving it in an inconsistent state.
121
126
  throw err
122
127
  })
123
128
  }
@@ -132,7 +137,7 @@ function dispatchYield() {
132
137
  yieldQueue.length = 0
133
138
  yieldIndex = 0
134
139
  } else {
135
- if (yieldIndex > 16 * 1024) {
140
+ if (yieldIndex > 4 * 1024) {
136
141
  yieldQueue.splice(0, yieldIndex)
137
142
  yieldIndex = 0
138
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/yield",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -29,5 +29,5 @@
29
29
  "tsd": "^0.33.0",
30
30
  "typescript": "^5.9.3"
31
31
  },
32
- "gitHead": "c9b449408262ca9431467193d624f1a043d669bb"
32
+ "gitHead": "a4a2240c7502c92e407bab917f1bb0b6661cccba"
33
33
  }