poe-code 12.0.11 → 13.0.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.
@@ -24,7 +24,7 @@ import {
24
24
  toByteSource,
25
25
  toFsError,
26
26
  validatePath
27
- } from "./chunks/chunk-MUKMA7ZY.js";
27
+ } from "./chunks/chunk-GJWMQ42Z.js";
28
28
  export {
29
29
  ACCESS_MODES,
30
30
  FsError,
@@ -24,7 +24,7 @@ import {
24
24
  toByteSource,
25
25
  toFsError,
26
26
  validatePath
27
- } from "./chunks/chunk-MUKMA7ZY.js";
27
+ } from "./chunks/chunk-GJWMQ42Z.js";
28
28
  export {
29
29
  ACCESS_MODES,
30
30
  FsError,
@@ -34,11 +34,11 @@ import {
34
34
  createNodeFsBridge,
35
35
  readConfigRecord,
36
36
  validateFileSystemConfig
37
- } from "./chunk-F7NY24BF.js";
37
+ } from "./chunk-ZRX5HT5L.js";
38
38
  import {
39
39
  FsError,
40
40
  isPathWithin
41
- } from "./chunk-YBQUQPZV.js";
41
+ } from "./chunk-WVN5MMDR.js";
42
42
 
43
43
  // packages/safe-js/src/migrate.ts
44
44
  import { createHash } from "node:crypto";
@@ -8183,4 +8183,4 @@ export {
8183
8183
  parseMcpConfig,
8184
8184
  makeMcpModule
8185
8185
  };
8186
- //# sourceMappingURL=chunk-HCODJUGF.js.map
8186
+ //# sourceMappingURL=chunk-EL23VF23.js.map
@@ -1218,6 +1218,30 @@ function positive(value, name, zero = false) {
1218
1218
  }
1219
1219
  return value;
1220
1220
  }
1221
+ function nativeRequestStreamsSupported(url) {
1222
+ let body;
1223
+ try {
1224
+ body = new ReadableStream({ start(destination) {
1225
+ destination.close();
1226
+ } });
1227
+ let duplexAccessed = false;
1228
+ const init = {
1229
+ method: "PUT",
1230
+ body,
1231
+ get duplex() {
1232
+ duplexAccessed = true;
1233
+ return "half";
1234
+ }
1235
+ };
1236
+ const request = new Request(url, init);
1237
+ return duplexAccessed && !request.headers.has("Content-Type");
1238
+ } catch {
1239
+ return false;
1240
+ } finally {
1241
+ if (body && !body.locked) void body.cancel().catch(() => {
1242
+ });
1243
+ }
1244
+ }
1221
1245
  function strongEtag(value, path) {
1222
1246
  if (!value || !/^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value)) {
1223
1247
  fail("ENOTSUP", "webdav", path, "operation requires a strong entity tag");
@@ -1300,6 +1324,7 @@ var WebDavFileSystem = class {
1300
1324
  base;
1301
1325
  baseSegments;
1302
1326
  transport;
1327
+ requestStreamSupport;
1303
1328
  headers;
1304
1329
  maxResponseBytes;
1305
1330
  maxXmlBytes;
@@ -1311,6 +1336,9 @@ var WebDavFileSystem = class {
1311
1336
  etags = /* @__PURE__ */ new WeakMap();
1312
1337
  constructor(options) {
1313
1338
  if (typeof options.fetch !== "function") throw new FsError("EINVAL", { message: "an explicit fetch transport is required" });
1339
+ if (options.requestStreamSupport !== void 0 && options.requestStreamSupport !== "native" && typeof options.requestStreamSupport !== "boolean") {
1340
+ throw new FsError("EINVAL", { message: "requestStreamSupport must be native or a boolean" });
1341
+ }
1314
1342
  if (options.compareEntry !== void 0 && typeof options.compareEntry !== "function") {
1315
1343
  throw new FsError("EINVAL", { message: "compareEntry must be a function" });
1316
1344
  }
@@ -1356,7 +1384,8 @@ var WebDavFileSystem = class {
1356
1384
  }
1357
1385
  this.atomicEmptyDirectory = Object.freeze({ namespaceUrl: this.base.href, removeEmptyDirectory: binding.removeEmptyDirectory });
1358
1386
  }
1359
- this.transport = options.fetch;
1387
+ this.transport = options.fetch === globalThis.fetch ? options.fetch.bind(globalThis) : options.fetch;
1388
+ this.requestStreamSupport = options.requestStreamSupport ?? (options.fetch === globalThis.fetch ? "native" : false);
1360
1389
  this.maxResponseBytes = positive(options.maxResponseBytes ?? 64 * 1024 * 1024, "maxResponseBytes");
1361
1390
  this.maxXmlBytes = positive(options.maxXmlBytes ?? 2 * 1024 * 1024, "maxXmlBytes");
1362
1391
  this.maxEntries = positive(options.maxEntries ?? 1e4, "maxEntries");
@@ -1889,6 +1918,10 @@ var WebDavFileSystem = class {
1889
1918
  });
1890
1919
  }
1891
1920
  async writeStream(path, source, options = {}) {
1921
+ if (options.signal?.aborted) fail("ECANCELED", "writeStream", path);
1922
+ if (this.requestStreamSupport === false || this.requestStreamSupport === "native" && !nativeRequestStreamsSupported(this.base.href)) {
1923
+ fail("ENOTSUP", "writeStream", path, "transport does not declare supported request streams");
1924
+ }
1892
1925
  const { normalized, headers, prefix } = await this.prepareWrite(path, options);
1893
1926
  const timeout = AbortSignal.timeout(this.timeoutMs);
1894
1927
  const controller = new AbortController();
@@ -4079,4 +4112,4 @@ export {
4079
4112
  createOverlayFileSystem,
4080
4113
  FileSystemBridge
4081
4114
  };
4082
- //# sourceMappingURL=chunk-YBQUQPZV.js.map
4115
+ //# sourceMappingURL=chunk-WVN5MMDR.js.map