poe-code 12.0.10 → 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.
Files changed (25) hide show
  1. package/dist/index.js +4 -2
  2. package/dist/index.js.map +2 -2
  3. package/dist/metafile.json +1 -1
  4. package/package.json +1 -1
  5. package/packages/safe-fs/dist/fs/webdav/webdav.d.ts +2 -0
  6. package/packages/safe-js/dist/browser/chunks/{chunk-MUKMA7ZY.js → chunk-GJWMQ42Z.js} +35 -2
  7. package/packages/safe-js/dist/browser/chunks/{chunk-MUKMA7ZY.js.map → chunk-GJWMQ42Z.js.map} +2 -2
  8. package/packages/safe-js/dist/browser/safe-fs-core.js +1 -1
  9. package/packages/safe-js/dist/browser/safe-fs.js +1 -1
  10. package/packages/safe-js/dist/chunks/{chunk-5TMXWUAL.js → chunk-DALBPQDZ.js} +4 -2
  11. package/packages/safe-js/dist/chunks/{chunk-5TMXWUAL.js.map → chunk-DALBPQDZ.js.map} +2 -2
  12. package/packages/safe-js/dist/chunks/{chunk-HEFYUEBF.js → chunk-EL23VF23.js} +4 -4
  13. package/packages/safe-js/dist/chunks/{chunk-YBQUQPZV.js → chunk-WVN5MMDR.js} +35 -2
  14. package/packages/safe-js/dist/chunks/chunk-WVN5MMDR.js.map +7 -0
  15. package/packages/safe-js/dist/chunks/{chunk-F7NY24BF.js → chunk-ZRX5HT5L.js} +2 -2
  16. package/packages/safe-js/dist/cli.js +4 -4
  17. package/packages/safe-js/dist/core.js +1 -1
  18. package/packages/safe-js/dist/index.js +4 -4
  19. package/packages/safe-js/dist/interp/values.js +1 -1
  20. package/packages/safe-js/dist/safe-fs-core.js +1 -1
  21. package/packages/safe-js/dist/safe-fs-node.js +2 -2
  22. package/packages/safe-js/dist/safe-fs.js +2 -2
  23. package/packages/safe-js/dist/chunks/chunk-YBQUQPZV.js.map +0 -7
  24. /package/packages/safe-js/dist/chunks/{chunk-HEFYUEBF.js.map → chunk-EL23VF23.js.map} +0 -0
  25. /package/packages/safe-js/dist/chunks/{chunk-F7NY24BF.js.map → chunk-ZRX5HT5L.js.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "12.0.10",
3
+ "version": "13.0.0",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,7 @@ export interface WebDavAtomicEmptyDirectoryBinding {
21
21
  export interface WebDavFileSystemOptions {
22
22
  readonly baseUrl: string;
23
23
  readonly fetch: WebDavFetch;
24
+ readonly requestStreamSupport?: "native" | boolean;
24
25
  readonly headers?: Readonly<Record<string, string>>;
25
26
  readonly maxResponseBytes?: number;
26
27
  readonly maxXmlBytes?: number;
@@ -43,6 +44,7 @@ export declare class WebDavFileSystem implements FileSystem {
43
44
  private readonly base;
44
45
  private readonly baseSegments;
45
46
  private readonly transport;
47
+ private readonly requestStreamSupport;
46
48
  private readonly headers;
47
49
  private readonly maxResponseBytes;
48
50
  private readonly maxXmlBytes;
@@ -2566,6 +2566,30 @@ function positive(value, name, zero = false) {
2566
2566
  }
2567
2567
  return value;
2568
2568
  }
2569
+ function nativeRequestStreamsSupported(url) {
2570
+ let body;
2571
+ try {
2572
+ body = new ReadableStream({ start(destination) {
2573
+ destination.close();
2574
+ } });
2575
+ let duplexAccessed = false;
2576
+ const init = {
2577
+ method: "PUT",
2578
+ body,
2579
+ get duplex() {
2580
+ duplexAccessed = true;
2581
+ return "half";
2582
+ }
2583
+ };
2584
+ const request = new Request(url, init);
2585
+ return duplexAccessed && !request.headers.has("Content-Type");
2586
+ } catch {
2587
+ return false;
2588
+ } finally {
2589
+ if (body && !body.locked) void body.cancel().catch(() => {
2590
+ });
2591
+ }
2592
+ }
2569
2593
  function strongEtag(value, path) {
2570
2594
  if (!value || !/^"[\x21\x23-\x7e\x80-\xff]*"$/.test(value)) {
2571
2595
  fail3("ENOTSUP", "webdav", path, "operation requires a strong entity tag");
@@ -2648,6 +2672,7 @@ var WebDavFileSystem = class {
2648
2672
  base;
2649
2673
  baseSegments;
2650
2674
  transport;
2675
+ requestStreamSupport;
2651
2676
  headers;
2652
2677
  maxResponseBytes;
2653
2678
  maxXmlBytes;
@@ -2659,6 +2684,9 @@ var WebDavFileSystem = class {
2659
2684
  etags = /* @__PURE__ */ new WeakMap();
2660
2685
  constructor(options) {
2661
2686
  if (typeof options.fetch !== "function") throw new FsError("EINVAL", { message: "an explicit fetch transport is required" });
2687
+ if (options.requestStreamSupport !== void 0 && options.requestStreamSupport !== "native" && typeof options.requestStreamSupport !== "boolean") {
2688
+ throw new FsError("EINVAL", { message: "requestStreamSupport must be native or a boolean" });
2689
+ }
2662
2690
  if (options.compareEntry !== void 0 && typeof options.compareEntry !== "function") {
2663
2691
  throw new FsError("EINVAL", { message: "compareEntry must be a function" });
2664
2692
  }
@@ -2704,7 +2732,8 @@ var WebDavFileSystem = class {
2704
2732
  }
2705
2733
  this.atomicEmptyDirectory = Object.freeze({ namespaceUrl: this.base.href, removeEmptyDirectory: binding.removeEmptyDirectory });
2706
2734
  }
2707
- this.transport = options.fetch;
2735
+ this.transport = options.fetch === globalThis.fetch ? options.fetch.bind(globalThis) : options.fetch;
2736
+ this.requestStreamSupport = options.requestStreamSupport ?? (options.fetch === globalThis.fetch ? "native" : false);
2708
2737
  this.maxResponseBytes = positive(options.maxResponseBytes ?? 64 * 1024 * 1024, "maxResponseBytes");
2709
2738
  this.maxXmlBytes = positive(options.maxXmlBytes ?? 2 * 1024 * 1024, "maxXmlBytes");
2710
2739
  this.maxEntries = positive(options.maxEntries ?? 1e4, "maxEntries");
@@ -3237,6 +3266,10 @@ var WebDavFileSystem = class {
3237
3266
  });
3238
3267
  }
3239
3268
  async writeStream(path, source, options = {}) {
3269
+ if (options.signal?.aborted) fail3("ECANCELED", "writeStream", path);
3270
+ if (this.requestStreamSupport === false || this.requestStreamSupport === "native" && !nativeRequestStreamsSupported(this.base.href)) {
3271
+ fail3("ENOTSUP", "writeStream", path, "transport does not declare supported request streams");
3272
+ }
3240
3273
  const { normalized, headers, prefix } = await this.prepareWrite(path, options);
3241
3274
  const timeout = AbortSignal.timeout(this.timeoutMs);
3242
3275
  const controller = new AbortController();
@@ -4050,4 +4083,4 @@ export {
4050
4083
  WebDavFileSystem,
4051
4084
  createFsBridge
4052
4085
  };
4053
- //# sourceMappingURL=chunk-MUKMA7ZY.js.map
4086
+ //# sourceMappingURL=chunk-GJWMQ42Z.js.map