marko 5.37.27 → 5.37.29

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.
@@ -233,18 +233,26 @@ var proto = AsyncStream.prototype = {
233
233
  },
234
234
 
235
235
  toReadable() {
236
+ let cancelled = false;
236
237
  return new ReadableStream({
237
238
  start: async (ctrl) => {
238
239
  const encoder = new TextEncoder();
239
240
  try {
240
241
  for await (const chunk of this) {
242
+ if (cancelled) {
243
+ return;
244
+ }
241
245
  ctrl.enqueue(encoder.encode(chunk));
242
246
  }
243
-
244
247
  ctrl.close();
245
248
  } catch (err) {
246
- ctrl.error(err);
249
+ if (!cancelled) {
250
+ ctrl.error(err);
251
+ }
247
252
  }
253
+ },
254
+ cancel() {
255
+ cancelled = true;
248
256
  }
249
257
  });
250
258
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.37.27",
3
+ "version": "5.37.29",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@babel/runtime": "^7.27.0",
73
- "@marko/compiler": "^5.39.14",
73
+ "@marko/compiler": "^5.39.19",
74
74
  "app-module-path": "^2.2.0",
75
75
  "argly": "^1.2.0",
76
76
  "browser-refresh-client": "1.1.4",
@@ -233,19 +233,27 @@ var proto = (AsyncStream.prototype = {
233
233
  },
234
234
 
235
235
  toReadable() {
236
+ let cancelled = false;
236
237
  return new ReadableStream({
237
238
  start: async (ctrl) => {
238
239
  const encoder = new TextEncoder();
239
240
  try {
240
241
  for await (const chunk of this) {
242
+ if (cancelled) {
243
+ return;
244
+ }
241
245
  ctrl.enqueue(encoder.encode(chunk));
242
246
  }
243
-
244
247
  ctrl.close();
245
248
  } catch (err) {
246
- ctrl.error(err);
249
+ if (!cancelled) {
250
+ ctrl.error(err);
251
+ }
247
252
  }
248
253
  },
254
+ cancel() {
255
+ cancelled = true;
256
+ },
249
257
  });
250
258
  },
251
259