poe-code 12.0.1 → 12.0.3

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 (57) hide show
  1. package/README.md +24 -0
  2. package/dist/index.js +46 -2
  3. package/dist/index.js.map +2 -2
  4. package/dist/metafile.json +1 -1
  5. package/package.json +8 -2
  6. package/packages/package-lint/dist/bundle-policy.d.ts +45 -0
  7. package/packages/package-lint/dist/bundle-policy.js +169 -0
  8. package/packages/package-lint/dist/model.d.ts +4 -10
  9. package/packages/package-lint/dist/model.js +4 -2
  10. package/packages/package-lint/dist/packlist.js +5 -1
  11. package/packages/package-lint/dist/rules/bundle-self-contained.js +11 -25
  12. package/packages/safe-fs/dist/contracts/abort.d.ts +5 -0
  13. package/packages/safe-fs/dist/contracts/cleanup.d.ts +1 -0
  14. package/packages/safe-fs/dist/contracts/errors.d.ts +49 -0
  15. package/packages/safe-fs/dist/contracts/filesystem.d.ts +96 -0
  16. package/packages/safe-fs/dist/contracts/index.d.ts +4 -0
  17. package/packages/safe-fs/dist/contracts/io.d.ts +8 -0
  18. package/packages/safe-fs/dist/contracts/path.d.ts +13 -0
  19. package/packages/safe-fs/dist/fs/memory/index.d.ts +58 -0
  20. package/packages/safe-fs/dist/fs/mount/comparison.d.ts +18 -0
  21. package/packages/safe-fs/dist/fs/mount/identity.d.ts +2 -0
  22. package/packages/safe-fs/dist/fs/mount/index.d.ts +44 -0
  23. package/packages/safe-fs/dist/fs/overlay/index.d.ts +72 -0
  24. package/packages/safe-fs/dist/fs/readonly/index.d.ts +30 -0
  25. package/packages/safe-fs/dist/fs/real/allocation.d.ts +1 -0
  26. package/packages/safe-fs/dist/fs/real/index.d.ts +76 -0
  27. package/packages/safe-fs/dist/fs/s3/authority.d.ts +13 -0
  28. package/packages/safe-fs/dist/fs/s3/filesystem.d.ts +93 -0
  29. package/packages/safe-fs/dist/fs/s3/http/index.d.ts +2 -0
  30. package/packages/safe-fs/dist/fs/s3/http/request.d.ts +16 -0
  31. package/packages/safe-fs/dist/fs/s3/http/signature.d.ts +20 -0
  32. package/packages/safe-fs/dist/fs/s3/http/transport.d.ts +3 -0
  33. package/packages/safe-fs/dist/fs/s3/http/types.d.ts +30 -0
  34. package/packages/safe-fs/dist/fs/s3/http/xml.d.ts +11 -0
  35. package/packages/safe-fs/dist/fs/s3/index.d.ts +6 -0
  36. package/packages/safe-fs/dist/fs/s3/mock.d.ts +48 -0
  37. package/packages/safe-fs/dist/fs/s3/transport.d.ts +103 -0
  38. package/packages/safe-fs/dist/fs/webdav/index.d.ts +2 -0
  39. package/packages/safe-fs/dist/fs/webdav/resource-id.d.ts +18 -0
  40. package/packages/safe-fs/dist/fs/webdav/webdav.d.ts +98 -0
  41. package/packages/safe-fs/dist/fs/webdav/xml.d.ts +15 -0
  42. package/packages/safe-fs/dist/index.d.ts +11 -0
  43. package/packages/safe-fs/dist/node/filesystem.d.ts +11 -0
  44. package/packages/safe-fs/dist/node/index.d.ts +2 -0
  45. package/packages/safe-fs/dist/node/stats.d.ts +4 -0
  46. package/packages/safe-fs/dist/node/values.d.ts +6 -0
  47. package/packages/safejs/dist/chunks/{chunk-73RTIWRH.js → chunk-T55OILHA.js} +2 -2
  48. package/packages/safejs/dist/chunks/{chunk-HD7TQKZ7.js → chunk-Z3ZMLYCK.js} +39 -1
  49. package/packages/safejs/dist/chunks/{chunk-HD7TQKZ7.js.map → chunk-Z3ZMLYCK.js.map} +2 -2
  50. package/packages/safejs/dist/cli.js +2 -2
  51. package/packages/safejs/dist/core.js +1 -1
  52. package/packages/safejs/dist/index.js +2 -2
  53. package/packages/safejs/dist/interp/methods/string.d.ts +1 -1
  54. package/packages/safejs/dist/interp/methods/string.js +43 -1
  55. package/packages/safejs/dist/safe-fs.js +6476 -0
  56. package/packages/safejs/dist/safe-fs.js.map +7 -0
  57. /package/packages/safejs/dist/chunks/{chunk-73RTIWRH.js.map → chunk-T55OILHA.js.map} +0 -0
@@ -0,0 +1,98 @@
1
+ import type { ByteSource } from "../../contracts/io.js";
2
+ import type { AppendFileOptions, CopyFileOptions, DirectoryEntry, EntryComparison, FileStat, FileSystem, FsOptions, MkdirOptions, ReadFileOptions, ReadStreamOptions, RemoveOptions, WriteFileOptions } from "../../contracts/filesystem.js";
3
+ export type WebDavFetch = (url: string, init: RequestInit) => Promise<Response>;
4
+ export interface WebDavAtomicEmptyDirectoryRequest {
5
+ readonly operation: "atomic-empty-rmdir/v1";
6
+ readonly namespaceUrl: string;
7
+ readonly path: string;
8
+ readonly signal?: AbortSignal;
9
+ }
10
+ export interface WebDavAtomicEmptyDirectoryResult {
11
+ readonly operation: "atomic-empty-rmdir/v1";
12
+ readonly namespaceUrl: string;
13
+ readonly path: string;
14
+ readonly outcome: "removed";
15
+ }
16
+ export interface WebDavAtomicEmptyDirectoryBinding {
17
+ readonly namespaceUrl: string;
18
+ readonly removeEmptyDirectory: (request: WebDavAtomicEmptyDirectoryRequest) => Promise<WebDavAtomicEmptyDirectoryResult>;
19
+ }
20
+ export interface WebDavFileSystemOptions {
21
+ readonly baseUrl: string;
22
+ readonly fetch: WebDavFetch;
23
+ readonly headers?: Readonly<Record<string, string>>;
24
+ readonly maxResponseBytes?: number;
25
+ readonly maxXmlBytes?: number;
26
+ readonly maxEntries?: number;
27
+ readonly timeoutMs?: number;
28
+ readonly overwritePolicy?: "lock" | "etag";
29
+ readonly atomicEmptyDirectory?: WebDavAtomicEmptyDirectoryBinding;
30
+ readonly compareEntry?: (this: FileSystem, ...args: Parameters<NonNullable<FileSystem["compareEntry"]>>) => ReturnType<NonNullable<FileSystem["compareEntry"]>>;
31
+ }
32
+ export declare class WebDavFileSystem implements FileSystem {
33
+ readonly capabilities: Readonly<{
34
+ symlinks: false;
35
+ hardlinks: false;
36
+ permissions: false;
37
+ timestamps: true;
38
+ atomicRename: false;
39
+ streamingRead: true;
40
+ streamingWrite: true;
41
+ }>;
42
+ private readonly base;
43
+ private readonly baseSegments;
44
+ private readonly transport;
45
+ private readonly headers;
46
+ private readonly maxResponseBytes;
47
+ private readonly maxXmlBytes;
48
+ private readonly maxEntries;
49
+ private readonly timeoutMs;
50
+ private readonly overwritePolicy;
51
+ private readonly configuredComparison;
52
+ private readonly atomicEmptyDirectory;
53
+ private readonly etags;
54
+ constructor(options: WebDavFileSystemOptions);
55
+ compareEntry(path: string, peer: FileSystem, peerPath: string, options?: FsOptions): Promise<EntryComparison>;
56
+ private resourceId;
57
+ private url;
58
+ private hrefPath;
59
+ private httpError;
60
+ private request;
61
+ private requestStream;
62
+ private bytes;
63
+ private bodyChunks;
64
+ private xml;
65
+ private multistatus;
66
+ private lockFailure;
67
+ private entryStat;
68
+ private entries;
69
+ private mutation;
70
+ private unsupported;
71
+ private maybeStat;
72
+ stat(path: string, options?: FsOptions): Promise<FileStat>;
73
+ lstat(path: string, options?: FsOptions): Promise<FileStat>;
74
+ readdir(path: string, options?: FsOptions): Promise<DirectoryEntry[]>;
75
+ readFile(path: string, options?: ReadFileOptions): Promise<Uint8Array>;
76
+ readStream(path: string, options?: ReadStreamOptions): AsyncGenerator<Uint8Array>;
77
+ private prepareWrite;
78
+ writeFile(path: string, data: Uint8Array, options?: WriteFileOptions): Promise<void>;
79
+ writeStream(path: string, source: ByteSource, options?: WriteFileOptions): Promise<void>;
80
+ appendFile(path: string, data: Uint8Array, options?: AppendFileOptions): Promise<void>;
81
+ mkdir(path: string, options?: MkdirOptions): Promise<void>;
82
+ rmdir(path: string, options?: FsOptions): Promise<void>;
83
+ private atomicRmdir;
84
+ rm(path: string, options?: RemoveOptions): Promise<void>;
85
+ private guardTransferIdentity;
86
+ private transfer;
87
+ private withDestinationLock;
88
+ rename(source: string, destination: string, options?: FsOptions): Promise<void>;
89
+ copyFile(source: string, destination: string, options?: CopyFileOptions): Promise<void>;
90
+ realpath(path: string, options?: FsOptions): Promise<string>;
91
+ access(path: string, mode?: number, options?: FsOptions): Promise<void>;
92
+ readlink(path: string, _options?: FsOptions): Promise<string>;
93
+ symlink(_target: string, path: string, _options?: FsOptions): Promise<void>;
94
+ link(_source: string, path: string, _options?: FsOptions): Promise<void>;
95
+ chmod(path: string, _mode: number, _options?: FsOptions): Promise<void>;
96
+ utimes(path: string, atimeMs: number, mtimeMs: number, options?: FsOptions): Promise<void>;
97
+ truncate(path: string, _length?: number, _options?: FsOptions): Promise<void>;
98
+ }
@@ -0,0 +1,15 @@
1
+ export interface XmlElement {
2
+ readonly namespace: string;
3
+ readonly localName: string;
4
+ readonly children: XmlElement[];
5
+ text: string;
6
+ }
7
+ export interface XmlLimits {
8
+ readonly maxDepth?: number;
9
+ readonly maxNodes?: number;
10
+ readonly maxAttributes?: number;
11
+ }
12
+ export declare function parseXml(input: string, limits?: XmlLimits): XmlElement;
13
+ export declare function davChildren(element: XmlElement, localName: string): XmlElement[];
14
+ export declare function davChild(element: XmlElement, localName: string): XmlElement | undefined;
15
+ export declare function scalar(element: XmlElement): string;
@@ -0,0 +1,11 @@
1
+ export * from "./contracts/index.js";
2
+ export * from "./fs/memory/index.js";
3
+ export * from "./fs/real/index.js";
4
+ export * from "./fs/s3/index.js";
5
+ export type { S3StreamGetInput, S3StreamGetOutput, S3StreamPutInput } from "./fs/s3/transport.js";
6
+ export * from "./fs/s3/http/index.js";
7
+ export * from "./fs/webdav/index.js";
8
+ export * from "./fs/readonly/index.js";
9
+ export * from "./fs/mount/index.js";
10
+ export * from "./fs/overlay/index.js";
11
+ export * from "./node/index.js";
@@ -0,0 +1,11 @@
1
+ import type * as FsPromises from "node:fs/promises";
2
+ import type { FileSystem, FsOptions } from "../contracts/filesystem.js";
3
+ export type NodeFsImplementation = Pick<typeof FsPromises, "access" | "appendFile" | "chmod" | "copyFile" | "cp" | "link" | "lstat" | "mkdir" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "rename" | "rm" | "rmdir" | "stat" | "symlink" | "truncate" | "utimes" | "writeFile">;
4
+ export interface NodeFsBridgeOptions {
5
+ readonly cwd?: string;
6
+ readonly signal?: AbortSignal;
7
+ }
8
+ export interface NodeFsBridgeFileSystem extends FileSystem {
9
+ rmdir?(path: string, options?: FsOptions): Promise<void>;
10
+ }
11
+ export declare function createNodeFsBridge(fs: FileSystem, options?: NodeFsBridgeOptions): NodeFsImplementation;
@@ -0,0 +1,2 @@
1
+ export { createNodeFsBridge } from "./filesystem.js";
2
+ export type { NodeFsBridgeOptions, NodeFsBridgeFileSystem, NodeFsImplementation } from "./filesystem.js";
@@ -0,0 +1,4 @@
1
+ import type { Dirent, Stats } from "node:fs";
2
+ import type { FileStat, FileType } from "../contracts/filesystem.js";
3
+ export declare function nodeStats(stat: FileStat): Stats;
4
+ export declare function nodeDirent<Name extends string | Buffer>(name: Name, parentPath: string, type: FileType): Dirent<Name>;
@@ -0,0 +1,6 @@
1
+ export declare function record(value: unknown, name: string): Record<string, unknown>;
2
+ export declare function onlyKeys(value: Record<string, unknown>, allowed: readonly string[]): void;
3
+ export declare function booleanValue(value: unknown, fallback?: boolean): boolean;
4
+ export declare function abortError(): Error;
5
+ export declare function checkSignal(signal: AbortSignal | undefined): void;
6
+ export declare function withSignal<Value>(signal: AbortSignal | undefined, operation: () => Promise<Value>): Promise<Value>;
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-HD7TQKZ7.js";
30
+ } from "./chunk-Z3ZMLYCK.js";
31
31
 
32
32
  // packages/safejs/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8055,4 +8055,4 @@ export {
8055
8055
  parseMcpConfig,
8056
8056
  makeMcpModule
8057
8057
  };
8058
- //# sourceMappingURL=chunk-73RTIWRH.js.map
8058
+ //# sourceMappingURL=chunk-T55OILHA.js.map
@@ -25224,6 +25224,7 @@ var stringMethodNames = /* @__PURE__ */ new Set([
25224
25224
  "includes",
25225
25225
  "indexOf",
25226
25226
  "lastIndexOf",
25227
+ "localeCompare",
25227
25228
  "match",
25228
25229
  "matchAll",
25229
25230
  "normalize",
@@ -25258,6 +25259,7 @@ function getStringMember(value, property, budget) {
25258
25259
  return createSandboxClosure({
25259
25260
  sandbox: true,
25260
25261
  name: `String#${property}`,
25262
+ ...property === "localeCompare" ? { length: 1 } : {},
25261
25263
  call: (args) => callStringMethod(value, property, args, budget)
25262
25264
  });
25263
25265
  }
@@ -25283,6 +25285,42 @@ function callStringMethod(value, methodName, args, budget, callClosure = async (
25283
25285
  if (methodName === "match" || methodName === "matchAll" || methodName === "search") {
25284
25286
  return callMatchLikeMethod(value, methodName, args);
25285
25287
  }
25288
+ if (methodName === "localeCompare") {
25289
+ if (isSandboxClosure(args[0])) {
25290
+ throw new TypeError("String#localeCompare does not support function comparison values.");
25291
+ }
25292
+ const comparison = budget.allocateString(String(deepCopyFromSandbox(args[0])));
25293
+ const locales = Reflect.apply(Intl.getCanonicalLocales, Intl, [
25294
+ deepCopyFromSandbox(args[1])
25295
+ ]);
25296
+ const options = args[2];
25297
+ const nativeOptions = options === void 0 || options === null ? options : Object.fromEntries(
25298
+ [
25299
+ "usage",
25300
+ "localeMatcher",
25301
+ "collation",
25302
+ "numeric",
25303
+ "caseFirst",
25304
+ "sensitivity",
25305
+ "ignorePunctuation"
25306
+ ].map((property) => {
25307
+ const descriptor = Object.getOwnPropertyDescriptor(options, property);
25308
+ if (descriptor !== void 0 && !("value" in descriptor)) {
25309
+ throw new TypeError("String#localeCompare only supports data option properties.");
25310
+ }
25311
+ const option = descriptor?.value;
25312
+ return [
25313
+ property,
25314
+ option === void 0 ? void 0 : property === "numeric" || property === "ignorePunctuation" ? Boolean(option) : deepCopyFromSandbox(option)
25315
+ ];
25316
+ })
25317
+ );
25318
+ return Reflect.apply(String.prototype.localeCompare, value, [
25319
+ comparison,
25320
+ locales,
25321
+ nativeOptions
25322
+ ]);
25323
+ }
25286
25324
  if (args.some(isSandboxClosure)) {
25287
25325
  throw new TypeError(`String#${methodName} does not support function arguments.`);
25288
25326
  }
@@ -29256,4 +29294,4 @@ export {
29256
29294
  FileSnapshotBackend,
29257
29295
  run
29258
29296
  };
29259
- //# sourceMappingURL=chunk-HD7TQKZ7.js.map
29297
+ //# sourceMappingURL=chunk-Z3ZMLYCK.js.map