@pwfabric/pack 0.0.0-stage → 1.0.0-rc.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tar.js","sourceRoot":"","sources":["../src/tar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEzC,MAAM,KAAK,GAAG,GAAG,CAAA;AACjB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AACjC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAA;AAC9B,8CAA8C;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAA;AAC7B,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAE5B,+DAA+D;AAC/D,QAAQ;AACR,+DAA+D;AAE/D,SAAS,SAAS,CAAC,GAAe,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc;IAC/E,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;AAC5D,CAAC;AAED,gDAAgD;AAChD,SAAS,QAAQ,CAAC,GAAe,EAAE,KAAa,EAAE,MAAc,EAAE,KAAa;IAC7E,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAClF,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,OAAO,CAAC,MAAM,CAA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ACpB,IAAI,IAAI,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;gBAChC,MAAM,IAAI,SAAS,CAAC,iBAAiB,EAAE,GAAG,IAAI,OAAO,IAAI,iBAAiB,MAAM,CAAC,aAAa,GAAG,EAAE,IAAI,CAAC,CAAA;YAC1G,CAAC;YACD,KAAK,IAAI,IAAI,CAAA;YACb,IAAI,KAAK,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;gBACjC,MAAM,IAAI,SAAS,CAAC,gBAAgB,EAAE,wBAAwB,MAAM,CAAC,aAAa,iBAAiB,CAAC,CAAA;YACtG,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IAClF,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["/**\n * A minimal, deterministic ustar writer and a defensive tar reader.\n *\n * Only what a pwpack needs: regular files and directories on the way out;\n * regular files, directories, PAX `path` records and GNU long names on the\n * way in, with links, devices and FIFOs surfaced so the caller can refuse\n * them. Not a general-purpose tar implementation.\n *\n * @module @pwfabric/pack/tar\n */\nimport { PackError } from './types.js'\nimport { compareBytes } from './paths.js'\n\nconst BLOCK = 512\nconst encoder = new TextEncoder()\nconst decoder = new TextDecoder()\n\n/** Mode written for every regular file. Executable bits are not carried. */\nexport const FILE_MODE = 0o644\n/** Mode written for every directory entry. */\nexport const DIR_MODE = 0o755\n/** mtime written into every header (seconds since the epoch). */\nexport const FIXED_MTIME = 0\n\n// ============================================================\n// WRITE\n// ============================================================\n\nfunction putString(buf: Uint8Array, value: string, offset: number, length: number): void {\n buf.set(encoder.encode(value).subarray(0, length), offset)\n}\n\n/** `width - 1` octal digits followed by NUL. */\nfunction putOctal(buf: Uint8Array, value: number, offset: number, width: number): void {\n putString(buf, value.toString(8).padStart(width - 1, '0') + '\\0', offset, width)\n}\n\nfunction byteLength(s: string): number {\n return encoder.encode(s).length\n}\n\n/**\n * Split a path into ustar `prefix` (≤155 bytes) and `name` (≤100 bytes) at a\n * `/`. The longest prefix that fits is chosen. `null` when no split fits.\n */\nexport function splitUstarPath(path: string): { prefix: string; name: string } | null {\n if (byteLength(path) <= 100) return { prefix: '', name: path }\n for (let i = path.length - 1; i > 0; i--) {\n if (path[i] !== '/') continue\n const prefix = path.slice(0, i)\n const name = path.slice(i + 1)\n if (name.length > 0 && byteLength(prefix) <= 155 && byteLength(name) <= 100) return { prefix, name }\n }\n return null\n}\n\n/** The first `max` bytes of `s`, cut at a character boundary. */\nfunction truncateUtf8(s: string, max: number): string {\n let out = ''\n let used = 0\n for (const ch of s) {\n const n = byteLength(ch)\n if (used + n > max) break\n out += ch\n used += n\n }\n return out\n}\n\nfunction header(name: string, prefix: string, size: number, mode: number, typeflag: string): Uint8Array {\n const h = new Uint8Array(BLOCK)\n putString(h, name, 0, 100)\n putOctal(h, mode, 100, 8)\n putOctal(h, 0, 108, 8) // uid\n putOctal(h, 0, 116, 8) // gid\n putOctal(h, size, 124, 12)\n putOctal(h, FIXED_MTIME, 136, 12)\n putString(h, ' ', 148, 8) // checksum placeholder\n putString(h, typeflag, 156, 1)\n // linkname (157..256) stays zero.\n putString(h, 'ustar\\0', 257, 6)\n putString(h, '00', 263, 2)\n // uname (265..296) and gname (297..328) stay empty.\n putOctal(h, 0, 329, 8) // devmajor\n putOctal(h, 0, 337, 8) // devminor\n if (prefix) putString(h, prefix, 345, 155)\n let sum = 0\n for (const b of h) sum += b\n putString(h, sum.toString(8).padStart(6, '0') + '\\0 ', 148, 8)\n return h\n}\n\nfunction padding(size: number): Uint8Array {\n const rem = size % BLOCK\n return new Uint8Array(rem === 0 ? 0 : BLOCK - rem)\n}\n\n/** A PAX `x` header + data blocks carrying `path=<path>` for the entry that follows. */\nfunction paxPathBlocks(path: string): Uint8Array[] {\n const record = ` path=${path}\\n`\n // The length prefix counts itself; iterate until it is stable.\n let len = byteLength(record) + 1\n while (byteLength(`${len}${record}`) !== len) len = byteLength(`${len}${record}`)\n const data = encoder.encode(`${len}${record}`)\n return [header('PaxHeader', '', data.length, FILE_MODE, 'x'), data, padding(data.length)]\n}\n\nfunction entryBlocks(path: string, data: Uint8Array | null): Uint8Array[] {\n const size = data?.length ?? 0\n const mode = data ? FILE_MODE : DIR_MODE\n const typeflag = data ? '0' : '5'\n const split = splitUstarPath(path)\n const out: Uint8Array[] = []\n if (split) {\n out.push(header(split.name, split.prefix, size, mode, typeflag))\n } else {\n out.push(...paxPathBlocks(path))\n out.push(header(truncateUtf8(path, 100), '', size, mode, typeflag))\n }\n if (data) out.push(data, padding(size))\n return out\n}\n\n/**\n * The tar of a file map. Every directory implied by a file path gets its own\n * entry (`<dir>/`); all names are emitted in byte order, so a parent always\n * precedes its children. Callers pass already-validated paths.\n */\nexport function writeTar(files: ReadonlyMap<string, Uint8Array>): Uint8Array {\n const names = new Map<string, Uint8Array | null>()\n for (const [path, data] of files) {\n const parts = path.split('/')\n for (let i = 1; i < parts.length; i++) names.set(`${parts.slice(0, i).join('/')}/`, null)\n names.set(path, data)\n }\n const chunks: Uint8Array[] = []\n for (const name of [...names.keys()].sort(compareBytes)) chunks.push(...entryBlocks(name, names.get(name) ?? null))\n chunks.push(new Uint8Array(BLOCK * 2))\n let total = 0\n for (const c of chunks) total += c.length\n const out = new Uint8Array(total)\n let at = 0\n for (const c of chunks) {\n out.set(c, at)\n at += c.length\n }\n return out\n}\n\n// ============================================================\n// READ\n// ============================================================\n\n/** What a tar member is. */\nexport type TarEntryType = 'file' | 'dir' | 'symlink' | 'hardlink' | 'other'\n\nexport interface TarEntry {\n readonly name: string\n readonly type: TarEntryType\n readonly data: Uint8Array\n}\n\nexport interface TarReadLimits {\n readonly maxEntries: number\n readonly maxEntryBytes: number\n readonly maxTotalBytes: number\n}\n\nfunction cString(bytes: Uint8Array): string {\n const end = bytes.indexOf(0)\n return decoder.decode(end === -1 ? bytes : bytes.subarray(0, end))\n}\n\nfunction readOctal(h: Uint8Array, offset: number, width: number, what: string): number {\n const field = h.subarray(offset, offset + width)\n // Base-256 (high bit set) is how tar spells numbers past the octal range — far past any limit here.\n if (((field[0] as number) & 0x80) !== 0) {\n throw new PackError('ENTRY_TOO_LARGE', `tar ${what} uses base-256 encoding (a value beyond the octal range)`)\n }\n const text = cString(field).trim()\n if (text === '') return 0\n if (!/^[0-7]+$/.test(text)) throw new PackError('TAR_INVALID', `tar ${what} is not an octal number: \"${text}\"`)\n return parseInt(text, 8)\n}\n\nfunction verifyChecksum(h: Uint8Array): void {\n const stored = readOctal(h, 148, 8, 'checksum')\n let unsigned = 0\n let signed = 0\n for (let i = 0; i < BLOCK; i++) {\n const b = i >= 148 && i < 156 ? 0x20 : (h[i] as number)\n unsigned += b\n signed += b > 127 ? b - 256 : b\n }\n if (stored !== unsigned && stored !== signed) {\n throw new PackError('TAR_INVALID', 'tar header checksum does not match')\n }\n}\n\n/** The `path` record of a PAX extended header, if it has one. Lengths count bytes. */\nfunction paxPath(data: Uint8Array): string | null {\n let at = 0\n let path: string | null = null\n while (at < data.length) {\n const space = data.indexOf(0x20, at)\n if (space === -1) break\n const len = Number(decoder.decode(data.subarray(at, space)))\n if (!Number.isInteger(len) || len <= space - at + 1 || at + len > data.length) {\n throw new PackError('TAR_INVALID', 'malformed PAX record')\n }\n const body = decoder.decode(data.subarray(space + 1, at + len)).replace(/\\n$/, '')\n const eq = body.indexOf('=')\n if (eq > 0 && body.slice(0, eq) === 'path') path = body.slice(eq + 1)\n at += len\n }\n return path\n}\n\ntype HeaderKind = TarEntryType | 'pax' | 'pax-global' | 'gnu-longname' | 'gnu-longlink'\n\nfunction typeOf(flag: number): HeaderKind {\n switch (String.fromCharCode(flag)) {\n case '\\0':\n case '0':\n case '7':\n return 'file'\n case '5':\n return 'dir'\n case '1':\n return 'hardlink'\n case '2':\n return 'symlink'\n case 'x':\n return 'pax'\n case 'g':\n return 'pax-global'\n case 'L':\n return 'gnu-longname'\n case 'K':\n return 'gnu-longlink'\n default:\n return 'other'\n }\n}\n\n/**\n * Every member of an uncompressed tar, in archive order. Names are returned\n * as stored (ustar prefix joined, PAX `path` and GNU long names applied);\n * normalisation and safety are the caller's job. Throws {@link PackError}\n * for a malformed stream or a crossed limit.\n */\nexport function readTar(tar: Uint8Array, limits: TarReadLimits): TarEntry[] {\n const out: TarEntry[] = []\n let at = 0\n let total = 0\n let nextName: string | null = null\n while (at + BLOCK <= tar.length) {\n const h = tar.subarray(at, at + BLOCK)\n if (h.every((b) => b === 0)) break\n verifyChecksum(h)\n const size = readOctal(h, 124, 12, 'size')\n const kind = typeOf(h[156] as number)\n at += BLOCK\n if (at + size > tar.length) throw new PackError('TAR_INVALID', 'tar entry is truncated')\n const data = tar.subarray(at, at + size)\n at += Math.ceil(size / BLOCK) * BLOCK\n\n if (kind === 'pax') {\n nextName = paxPath(data) ?? nextName\n continue\n }\n if (kind === 'gnu-longname') {\n nextName = cString(data)\n continue\n }\n if (kind === 'pax-global' || kind === 'gnu-longlink') continue\n\n // POSIX ustar (\"ustar\\0\") carries a prefix field; the old GNU magic (\"ustar \") uses those bytes for other things.\n const posix = decoder.decode(h.subarray(257, 263)) === 'ustar\\0'\n const prefix = posix ? cString(h.subarray(345, 500)) : ''\n const short = cString(h.subarray(0, 100))\n const name = nextName ?? (prefix ? `${prefix}/${short}` : short)\n nextName = null\n\n if (out.length >= limits.maxEntries) {\n throw new PackError('TOO_MANY_ENTRIES', `archive has more than ${limits.maxEntries} entries`)\n }\n if (kind === 'file') {\n if (size > limits.maxEntryBytes) {\n throw new PackError('ENTRY_TOO_LARGE', `${name} is ${size} bytes (limit ${limits.maxEntryBytes})`, name)\n }\n total += size\n if (total > limits.maxTotalBytes) {\n throw new PackError('PACK_TOO_LARGE', `archive files exceed ${limits.maxTotalBytes} bytes in total`)\n }\n }\n out.push({ name, type: kind, data: kind === 'file' ? data : new Uint8Array(0) })\n }\n return out\n}\n"]}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shared types: the in-memory pack folder, the structured error thrown for
3
+ * I/O and archive problems, and the issue shape validation reports.
4
+ *
5
+ * @module @pwfabric/pack/types
6
+ */
7
+ /**
8
+ * A pwpack folder held in memory.
9
+ *
10
+ * Keys are normalised POSIX paths relative to the folder root (no leading
11
+ * `/` or `./`, no `.`/`..` segments, `/` separators). Values are the file's
12
+ * bytes exactly as they were read — never re-encoded, never line-ending
13
+ * converted. Directories are implied by the paths and never stored.
14
+ */
15
+ export interface PackFolder {
16
+ readonly files: ReadonlyMap<string, Uint8Array>;
17
+ }
18
+ /** Codes {@link PackError} carries. */
19
+ export type PackErrorCode =
20
+ /** A path is empty, absolute, drive-qualified, has a `.`/`..`/empty segment, a backslash or a NUL. */
21
+ 'UNSAFE_PATH'
22
+ /** A folder walk met a symbolic link, or an archive carries a link entry. */
23
+ | 'LINK_ENTRY'
24
+ /** An archive carries a device, FIFO or other non-file, non-directory entry. */
25
+ | 'UNSUPPORTED_ENTRY'
26
+ /** The same path appears twice (in an archive, or after `package/` unwrapping). */
27
+ | 'DUPLICATE_ENTRY'
28
+ /** A path is a file and also the directory of another path (`atoms/x` and `atoms/x/y`). */
29
+ | 'PATH_CONFLICT'
30
+ /** One entry is larger than `maxEntryBytes`. */
31
+ | 'ENTRY_TOO_LARGE'
32
+ /** More entries than `maxEntries`. */
33
+ | 'TOO_MANY_ENTRIES'
34
+ /** The compressed input, the decompressed tar or the sum of file sizes exceeds its limit. */
35
+ | 'PACK_TOO_LARGE'
36
+ /** The bytes are not gzip (nor a bare tar), or the gzip stream is corrupt. */
37
+ | 'GZIP_INVALID'
38
+ /** The tar stream is malformed: bad checksum, truncated entry, unreadable number. */
39
+ | 'TAR_INVALID'
40
+ /** The folder to read does not exist or is not a directory. */
41
+ | 'NOT_A_DIRECTORY'
42
+ /** A required identity field is absent where a function needs it. */
43
+ | 'IDENTITY_REQUIRED';
44
+ /** Thrown for I/O and archive problems. Content problems are reported by `validatePack` instead. */
45
+ export declare class PackError extends Error {
46
+ readonly code: PackErrorCode;
47
+ readonly path?: string | undefined;
48
+ constructor(code: PackErrorCode, message: string, path?: string | undefined);
49
+ }
50
+ /** How serious a validation finding is. Only `error` makes a pack invalid. */
51
+ export type PackIssueSeverity = 'error' | 'warning' | 'info';
52
+ /** One validation finding. */
53
+ export interface PackIssue {
54
+ readonly code: string;
55
+ readonly severity: PackIssueSeverity;
56
+ /** The pack path the issue is about, when it is about one. */
57
+ readonly path?: string;
58
+ readonly message: string;
59
+ }
package/dist/types.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared types: the in-memory pack folder, the structured error thrown for
3
+ * I/O and archive problems, and the issue shape validation reports.
4
+ *
5
+ * @module @pwfabric/pack/types
6
+ */
7
+ /** Thrown for I/O and archive problems. Content problems are reported by `validatePack` instead. */
8
+ export class PackError extends Error {
9
+ code;
10
+ path;
11
+ constructor(code, message, path) {
12
+ super(message);
13
+ this.code = code;
14
+ this.path = path;
15
+ this.name = 'PackError';
16
+ }
17
+ }
18
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyCH,oGAAoG;AACpG,MAAM,OAAO,SAAU,SAAQ,KAAK;IAEvB;IAEA;IAHX,YACW,IAAmB,EAC5B,OAAe,EACN,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAA;QAJL,SAAI,GAAJ,IAAI,CAAe;QAEnB,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;IACzB,CAAC;CACF","sourcesContent":["/**\n * Shared types: the in-memory pack folder, the structured error thrown for\n * I/O and archive problems, and the issue shape validation reports.\n *\n * @module @pwfabric/pack/types\n */\n\n/**\n * A pwpack folder held in memory.\n *\n * Keys are normalised POSIX paths relative to the folder root (no leading\n * `/` or `./`, no `.`/`..` segments, `/` separators). Values are the file's\n * bytes exactly as they were read — never re-encoded, never line-ending\n * converted. Directories are implied by the paths and never stored.\n */\nexport interface PackFolder {\n readonly files: ReadonlyMap<string, Uint8Array>\n}\n\n/** Codes {@link PackError} carries. */\nexport type PackErrorCode =\n /** A path is empty, absolute, drive-qualified, has a `.`/`..`/empty segment, a backslash or a NUL. */\n | 'UNSAFE_PATH'\n /** A folder walk met a symbolic link, or an archive carries a link entry. */\n | 'LINK_ENTRY'\n /** An archive carries a device, FIFO or other non-file, non-directory entry. */\n | 'UNSUPPORTED_ENTRY'\n /** The same path appears twice (in an archive, or after `package/` unwrapping). */\n | 'DUPLICATE_ENTRY'\n /** A path is a file and also the directory of another path (`atoms/x` and `atoms/x/y`). */\n | 'PATH_CONFLICT'\n /** One entry is larger than `maxEntryBytes`. */\n | 'ENTRY_TOO_LARGE'\n /** More entries than `maxEntries`. */\n | 'TOO_MANY_ENTRIES'\n /** The compressed input, the decompressed tar or the sum of file sizes exceeds its limit. */\n | 'PACK_TOO_LARGE'\n /** The bytes are not gzip (nor a bare tar), or the gzip stream is corrupt. */\n | 'GZIP_INVALID'\n /** The tar stream is malformed: bad checksum, truncated entry, unreadable number. */\n | 'TAR_INVALID'\n /** The folder to read does not exist or is not a directory. */\n | 'NOT_A_DIRECTORY'\n /** A required identity field is absent where a function needs it. */\n | 'IDENTITY_REQUIRED'\n\n/** Thrown for I/O and archive problems. Content problems are reported by `validatePack` instead. */\nexport class PackError extends Error {\n constructor(\n readonly code: PackErrorCode,\n message: string,\n readonly path?: string\n ) {\n super(message)\n this.name = 'PackError'\n }\n}\n\n/** How serious a validation finding is. Only `error` makes a pack invalid. */\nexport type PackIssueSeverity = 'error' | 'warning' | 'info'\n\n/** One validation finding. */\nexport interface PackIssue {\n readonly code: string\n readonly severity: PackIssueSeverity\n /** The pack path the issue is about, when it is about one. */\n readonly path?: string\n readonly message: string\n}\n"]}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Validation of a pack folder held in memory. Reports, never throws, for
3
+ * content problems.
4
+ *
5
+ * @module @pwfabric/pack/validate
6
+ */
7
+ import { type AtomRef, type PwpackIdentity } from '@pwfabric/contracts';
8
+ import type { PackFolder, PackIssue } from './types.js';
9
+ /** The `formatVersion` major this reader understands. A newer one gets a warning. */
10
+ export declare const SUPPORTED_FORMAT_MAJOR = 1;
11
+ /**
12
+ * Atom families as directory names: under `atoms/` in the canonical folder,
13
+ * at the root in the legacy rootless layout. `lib` holds shared code and
14
+ * `test` the pack's own tests; neither is an atom, both are expected.
15
+ */
16
+ export declare const ATOM_FAMILIES: ReadonlySet<string>;
17
+ /** Which layout the folder's paths use. */
18
+ export type PackLayout =
19
+ /** `atoms/`, `app/` (and `pwpack.json`, `media/`) only. */
20
+ 'canonical'
21
+ /** Atom families at the root, the pre-`atoms/` layout. */
22
+ | 'rootless'
23
+ /** Both at once. */
24
+ | 'mixed'
25
+ /** Neither: no atom or app path at all. */
26
+ | 'empty';
27
+ export interface PackValidation {
28
+ /** No issue has severity `error`. */
29
+ readonly ok: boolean;
30
+ readonly issues: readonly PackIssue[];
31
+ /** The parsed `pwpack.json`, when it is present and valid. */
32
+ readonly identity: PwpackIdentity | null;
33
+ readonly layout: PackLayout;
34
+ /** The derived atoms (see `deriveAtoms`). */
35
+ readonly atoms: readonly AtomRef[];
36
+ }
37
+ /**
38
+ * Validate a pack folder.
39
+ *
40
+ * Errors (the pack is not valid): an unsafe path; a path that is a file and
41
+ * also another path's directory; `pwpack.json` missing,
42
+ * not JSON, or not matching the contract schema; `app.entry` or an
43
+ * `app.surfaceOrder` key without its `app/surfaces/<key>.receipt.json`; two
44
+ * different atom directories yielding the same `kind:id`; a JSON file under
45
+ * `app/` or `media/provenance.json` that does not parse; an invalid
46
+ * `media/provenance.json` or one naming a file the pack does not carry;
47
+ * a file under `app/assets/` (`LEGACY_ASSETS_FOLDER`); a media declaration
48
+ * that breaks its schema, names a `file` missing from `media/`, or whose file
49
+ * has no provenance entry (see `mediaDeclarations`).
50
+ *
51
+ * Warnings: two paths that collide on a case-insensitive file system;
52
+ * unknown top-level entries; unknown families under `atoms/`; the
53
+ * rootless or mixed layout; `pwpack.json` declaring a newer format; an app
54
+ * entry not in its surface order or a key listed twice; files under
55
+ * `app/surfaces/` that are not receipts; media files without provenance, or
56
+ * whose hash disagrees with it (not reported when the provenance record is
57
+ * itself invalid); other JSON files that do not parse; a file under
58
+ * `app/media/` that is not a `<key>.json` declaration.
59
+ *
60
+ * Info: a legacy `package.json` at the root; a Markdown file directly in
61
+ * `atoms/` or in an atom-family directory (documentation, not an atom).
62
+ */
63
+ export declare function validatePack(pack: PackFolder): PackValidation;
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Validation of a pack folder held in memory. Reports, never throws, for
3
+ * content problems.
4
+ *
5
+ * @module @pwfabric/pack/validate
6
+ */
7
+ import { classifyPackPath, safeParsePwpackIdentity, } from '@pwfabric/contracts';
8
+ import { findCaseConflicts, findPathConflict, sortedPaths, unsafePathReason } from './paths.js';
9
+ import { PACK_DOC_FILES } from './content.js';
10
+ import { atomOccurrences, deriveAtoms, IDENTITY_FILE, stripBom } from './manifest.js';
11
+ import { sha256Hex } from './hash.js';
12
+ import { MEDIA_PROVENANCE_FILE as MEDIA_PROVENANCE, mediaDeclarations, readMediaProvenance } from './media.js';
13
+ /** The `formatVersion` major this reader understands. A newer one gets a warning. */
14
+ export const SUPPORTED_FORMAT_MAJOR = 1;
15
+ /**
16
+ * Atom families as directory names: under `atoms/` in the canonical folder,
17
+ * at the root in the legacy rootless layout. `lib` holds shared code and
18
+ * `test` the pack's own tests; neither is an atom, both are expected.
19
+ */
20
+ export const ATOM_FAMILIES = new Set([
21
+ 'blocks',
22
+ 'capabilities',
23
+ 'connectors',
24
+ 'providers',
25
+ 'appearance',
26
+ 'patterns',
27
+ 'icons',
28
+ 'surfaces',
29
+ 'auth',
30
+ 'lib',
31
+ 'test',
32
+ ]);
33
+ /** Family directories that may sit at the root of either layout. */
34
+ const NEUTRAL_ROOT_DIRS = new Set(['lib', 'test']);
35
+ const APP_SURFACES = 'app/surfaces/';
36
+ const RECEIPT_SUFFIX = '.receipt.json';
37
+ /** A Markdown file at depth `depth` (segments), e.g. `atoms/README.md` at 2. */
38
+ function isDocFile(parts, depth) {
39
+ return parts.length === depth && parts[depth - 1].toLowerCase().endsWith('.md');
40
+ }
41
+ function parseJson(bytes) {
42
+ try {
43
+ return { ok: true, value: JSON.parse(stripBom(new TextDecoder().decode(bytes))) };
44
+ }
45
+ catch (e) {
46
+ return { ok: false, error: e.message };
47
+ }
48
+ }
49
+ /**
50
+ * Validate a pack folder.
51
+ *
52
+ * Errors (the pack is not valid): an unsafe path; a path that is a file and
53
+ * also another path's directory; `pwpack.json` missing,
54
+ * not JSON, or not matching the contract schema; `app.entry` or an
55
+ * `app.surfaceOrder` key without its `app/surfaces/<key>.receipt.json`; two
56
+ * different atom directories yielding the same `kind:id`; a JSON file under
57
+ * `app/` or `media/provenance.json` that does not parse; an invalid
58
+ * `media/provenance.json` or one naming a file the pack does not carry;
59
+ * a file under `app/assets/` (`LEGACY_ASSETS_FOLDER`); a media declaration
60
+ * that breaks its schema, names a `file` missing from `media/`, or whose file
61
+ * has no provenance entry (see `mediaDeclarations`).
62
+ *
63
+ * Warnings: two paths that collide on a case-insensitive file system;
64
+ * unknown top-level entries; unknown families under `atoms/`; the
65
+ * rootless or mixed layout; `pwpack.json` declaring a newer format; an app
66
+ * entry not in its surface order or a key listed twice; files under
67
+ * `app/surfaces/` that are not receipts; media files without provenance, or
68
+ * whose hash disagrees with it (not reported when the provenance record is
69
+ * itself invalid); other JSON files that do not parse; a file under
70
+ * `app/media/` that is not a `<key>.json` declaration.
71
+ *
72
+ * Info: a legacy `package.json` at the root; a Markdown file directly in
73
+ * `atoms/` or in an atom-family directory (documentation, not an atom).
74
+ */
75
+ export function validatePack(pack) {
76
+ const issues = [];
77
+ const add = (severity, code, message, path) => {
78
+ issues.push(path === undefined ? { severity, code, message } : { severity, code, message, path });
79
+ };
80
+ const paths = sortedPaths(pack.files.keys());
81
+ // ---- collisions ----
82
+ const conflict = findPathConflict(paths);
83
+ if (conflict) {
84
+ add('error', 'PATH_CONFLICT', `${conflict.file} is a file and also the directory of ${conflict.inside}`, conflict.file);
85
+ }
86
+ for (const group of findCaseConflicts(paths)) {
87
+ add('warning', 'CASE_CONFLICT', `${group.join(', ')} differ only in case or Unicode normalisation; extracting them on a case-insensitive file system keeps one`, group[0]);
88
+ }
89
+ // ---- paths, top level and layout ----
90
+ const unknownTop = new Set();
91
+ const unknownFamily = new Set();
92
+ let canonical = false;
93
+ let rootless = false;
94
+ for (const path of paths) {
95
+ const reason = unsafePathReason(path);
96
+ if (reason) {
97
+ add('error', 'UNSAFE_PATH', `${path}: ${reason}`, path);
98
+ continue;
99
+ }
100
+ const parts = path.split('/');
101
+ const top = parts[0];
102
+ const cls = classifyPackPath(path);
103
+ if (cls?.kind === 'identity')
104
+ continue;
105
+ if (cls?.kind === 'app') {
106
+ canonical = true;
107
+ continue;
108
+ }
109
+ if (path === 'package.json') {
110
+ add('info', 'LEGACY_PACKAGE_JSON', 'package.json at the root is legacy identity; pwpack.json is read instead', path);
111
+ continue;
112
+ }
113
+ if (PACK_DOC_FILES.has(path))
114
+ continue;
115
+ if (top === 'media' && parts.length > 1)
116
+ continue;
117
+ if (top === 'atoms' && parts.length > 1) {
118
+ canonical = true;
119
+ const family = parts[1];
120
+ if (isDocFile(parts, 2) || (parts.length === 3 && ATOM_FAMILIES.has(family) && isDocFile(parts, 3))) {
121
+ add('info', 'DOC_FILE', `${path} is documentation, not an atom`, path);
122
+ continue;
123
+ }
124
+ if (parts.length === 2 || !ATOM_FAMILIES.has(family))
125
+ unknownFamily.add(family);
126
+ continue;
127
+ }
128
+ if (parts.length > 1 && ATOM_FAMILIES.has(top)) {
129
+ if (isDocFile(parts, 2))
130
+ add('info', 'DOC_FILE', `${path} is documentation, not an atom`, path);
131
+ // Atom families at the root are the rootless layout. Root `lib/` and
132
+ // `test/` are expected in both layouts (shared code on the legacy wire,
133
+ // a source folder's own tests), so they do not decide the layout.
134
+ if (!NEUTRAL_ROOT_DIRS.has(top))
135
+ rootless = true;
136
+ continue;
137
+ }
138
+ unknownTop.add(parts.length > 1 ? `${top}/` : top);
139
+ }
140
+ for (const name of unknownTop) {
141
+ add('warning', 'UNKNOWN_TOP_LEVEL', `${name} is not part of the pwpack folder (pwpack.json, app/, atoms/, media/)`, name);
142
+ }
143
+ for (const family of unknownFamily) {
144
+ add('warning', 'UNKNOWN_ATOM_FAMILY', `atoms/${family} is not a known atom family`, `atoms/${family}`);
145
+ }
146
+ const layout = canonical && rootless ? 'mixed' : canonical ? 'canonical' : rootless ? 'rootless' : 'empty';
147
+ if (layout === 'mixed') {
148
+ add('warning', 'LAYOUT_MIXED', 'the folder mixes atoms/ with atom families at the root');
149
+ }
150
+ else if (layout === 'rootless') {
151
+ add('warning', 'LAYOUT_ROOTLESS', 'atom families sit at the root; the canonical folder keeps them under atoms/');
152
+ }
153
+ // ---- identity ----
154
+ let identity = null;
155
+ const identityBytes = pack.files.get(IDENTITY_FILE);
156
+ if (!identityBytes) {
157
+ add('error', 'IDENTITY_MISSING', 'the folder has no pwpack.json', IDENTITY_FILE);
158
+ }
159
+ else {
160
+ const parsed = parseJson(identityBytes);
161
+ if (!parsed.ok) {
162
+ add('error', 'IDENTITY_INVALID', `pwpack.json is not JSON: ${parsed.error}`, IDENTITY_FILE);
163
+ }
164
+ else {
165
+ const result = safeParsePwpackIdentity(parsed.value);
166
+ if (result.ok) {
167
+ identity = result.value;
168
+ }
169
+ else {
170
+ for (const issue of result.issues)
171
+ add('error', 'IDENTITY_INVALID', `pwpack.json ${issue}`, IDENTITY_FILE);
172
+ }
173
+ }
174
+ }
175
+ if (identity?.formatVersion !== undefined) {
176
+ const major = Number(identity.formatVersion.split('.')[0]);
177
+ if (major > SUPPORTED_FORMAT_MAJOR) {
178
+ add('warning', 'FORMAT_VERSION_NEWER', `pwpack.json formatVersion ${identity.formatVersion} is newer than this reader (${SUPPORTED_FORMAT_MAJOR}.x); parts of it may be ignored`, IDENTITY_FILE);
179
+ }
180
+ }
181
+ // ---- app ----
182
+ if (identity?.app) {
183
+ const { entry, surfaceOrder } = identity.app;
184
+ const receipt = (key) => `${APP_SURFACES}${key}${RECEIPT_SUFFIX}`;
185
+ const missing = new Set();
186
+ for (const key of [entry, ...surfaceOrder]) {
187
+ if (!pack.files.has(receipt(key)) && !missing.has(key)) {
188
+ missing.add(key);
189
+ add('error', 'APP_SURFACE_MISSING', `pwpack.json app names surface "${key}" but ${receipt(key)} is absent`, receipt(key));
190
+ }
191
+ }
192
+ if (!surfaceOrder.includes(entry)) {
193
+ add('warning', 'APP_ENTRY_NOT_IN_ORDER', `app.entry "${entry}" is not listed in app.surfaceOrder`, IDENTITY_FILE);
194
+ }
195
+ const seen = new Set();
196
+ for (const key of surfaceOrder) {
197
+ if (seen.has(key))
198
+ add('warning', 'APP_SURFACE_DUPLICATE', `app.surfaceOrder lists "${key}" more than once`, IDENTITY_FILE);
199
+ seen.add(key);
200
+ }
201
+ }
202
+ for (const path of paths) {
203
+ if (!path.startsWith(APP_SURFACES))
204
+ continue;
205
+ const rest = path.slice(APP_SURFACES.length);
206
+ if (rest.includes('/') || !rest.endsWith(RECEIPT_SUFFIX)) {
207
+ add('warning', 'APP_UNEXPECTED_FILE', `${path} is not an app/surfaces/<key>.receipt.json`, path);
208
+ }
209
+ }
210
+ // ---- JSON well-formedness ----
211
+ for (const path of paths) {
212
+ if (!path.endsWith('.json') || path === IDENTITY_FILE || path === MEDIA_PROVENANCE)
213
+ continue;
214
+ const parsed = parseJson(pack.files.get(path));
215
+ if (parsed.ok)
216
+ continue;
217
+ const severity = path.startsWith('app/') ? 'error' : 'warning';
218
+ add(severity, 'JSON_INVALID', `${path} is not JSON: ${parsed.error}`, path);
219
+ }
220
+ // ---- atoms ----
221
+ const firstDir = new Map();
222
+ for (const { ref, dir } of atomOccurrences(pack)) {
223
+ const key = `${ref.kind}:${ref.id}`;
224
+ const seenDir = firstDir.get(key);
225
+ if (seenDir === undefined)
226
+ firstDir.set(key, dir);
227
+ else if (seenDir !== dir) {
228
+ add('error', 'DUPLICATE_ATOM', `${key} comes from both ${seenDir} and ${dir}`, ref.relPath);
229
+ }
230
+ }
231
+ // ---- media ----
232
+ const mediaFiles = paths.filter((p) => p.startsWith('media/') && p !== MEDIA_PROVENANCE);
233
+ const declared = new Set();
234
+ // Undeclared media is only computed against a provenance record that is
235
+ // valid; an invalid one is reported once, not once per media file.
236
+ const provenance = readMediaProvenance(pack);
237
+ if (provenance.state === 'invalid') {
238
+ for (const issue of provenance.issues)
239
+ add('error', 'MEDIA_PROVENANCE_INVALID', `media/provenance.json ${issue}`, MEDIA_PROVENANCE);
240
+ }
241
+ else if (provenance.state === 'valid') {
242
+ for (const item of provenance.value.items) {
243
+ declared.add(item.path);
244
+ const bytes = pack.files.get(item.path);
245
+ if (!bytes) {
246
+ add('error', 'MEDIA_PROVENANCE_PATH_MISSING', `media/provenance.json lists ${item.path}, which the pack does not carry`, item.path);
247
+ }
248
+ else if (item.hash.startsWith('sha256:') && item.hash !== `sha256:${sha256Hex(bytes)}`) {
249
+ add('warning', 'MEDIA_HASH_MISMATCH', `${item.path} does not match the hash media/provenance.json records`, item.path);
250
+ }
251
+ }
252
+ }
253
+ for (const path of provenance.state === 'invalid' ? [] : mediaFiles) {
254
+ if (!declared.has(path))
255
+ add('warning', 'MEDIA_UNDECLARED', `${path} has no entry in media/provenance.json`, path);
256
+ }
257
+ // Declarations: which layout, and whether the bytes they name are there.
258
+ issues.push(...mediaDeclarations(pack).issues);
259
+ return {
260
+ ok: !issues.some((i) => i.severity === 'error'),
261
+ issues,
262
+ identity,
263
+ layout,
264
+ atoms: deriveAtoms(pack),
265
+ };
266
+ }
267
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"m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AC,CAAC,QAAQ,KAAK,OAAO,CAAC;QAC/C,MAAM;QACN,QAAQ;QACR,MAAM;QACN,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC;KACzB,CAAA;AACH,CAAC","sourcesContent":["/**\n * Validation of a pack folder held in memory. Reports, never throws, for\n * content problems.\n *\n * @module @pwfabric/pack/validate\n */\nimport {\n classifyPackPath,\n safeParsePwpackIdentity,\n type AtomRef,\n type PwpackIdentity,\n} from '@pwfabric/contracts'\nimport type { PackFolder, PackIssue } from './types.js'\nimport { findCaseConflicts, findPathConflict, sortedPaths, unsafePathReason } from './paths.js'\nimport { PACK_DOC_FILES } from './content.js'\nimport { atomOccurrences, deriveAtoms, IDENTITY_FILE, stripBom } from './manifest.js'\nimport { sha256Hex } from './hash.js'\nimport { MEDIA_PROVENANCE_FILE as MEDIA_PROVENANCE, mediaDeclarations, readMediaProvenance } from './media.js'\n\n/** The `formatVersion` major this reader understands. A newer one gets a warning. */\nexport const SUPPORTED_FORMAT_MAJOR = 1\n\n/**\n * Atom families as directory names: under `atoms/` in the canonical folder,\n * at the root in the legacy rootless layout. `lib` holds shared code and\n * `test` the pack's own tests; neither is an atom, both are expected.\n */\nexport const ATOM_FAMILIES: ReadonlySet<string> = new Set([\n 'blocks',\n 'capabilities',\n 'connectors',\n 'providers',\n 'appearance',\n 'patterns',\n 'icons',\n 'surfaces',\n 'auth',\n 'lib',\n 'test',\n])\n\n/** Family directories that may sit at the root of either layout. */\nconst NEUTRAL_ROOT_DIRS: ReadonlySet<string> = new Set(['lib', 'test'])\n\n/** Which layout the folder's paths use. */\nexport type PackLayout =\n /** `atoms/`, `app/` (and `pwpack.json`, `media/`) only. */\n | 'canonical'\n /** Atom families at the root, the pre-`atoms/` layout. */\n | 'rootless'\n /** Both at once. */\n | 'mixed'\n /** Neither: no atom or app path at all. */\n | 'empty'\n\nexport interface PackValidation {\n /** No issue has severity `error`. */\n readonly ok: boolean\n readonly issues: readonly PackIssue[]\n /** The parsed `pwpack.json`, when it is present and valid. */\n readonly identity: PwpackIdentity | null\n readonly layout: PackLayout\n /** The derived atoms (see `deriveAtoms`). */\n readonly atoms: readonly AtomRef[]\n}\n\nconst APP_SURFACES = 'app/surfaces/'\nconst RECEIPT_SUFFIX = '.receipt.json'\n\n/** A Markdown file at depth `depth` (segments), e.g. `atoms/README.md` at 2. */\nfunction isDocFile(parts: readonly string[], depth: number): boolean {\n return parts.length === depth && (parts[depth - 1] as string).toLowerCase().endsWith('.md')\n}\n\nfunction parseJson(bytes: Uint8Array): { ok: true; value: unknown } | { ok: false; error: string } {\n try {\n return { ok: true, value: JSON.parse(stripBom(new TextDecoder().decode(bytes))) }\n } catch (e) {\n return { ok: false, error: (e as Error).message }\n }\n}\n\n/**\n * Validate a pack folder.\n *\n * Errors (the pack is not valid): an unsafe path; a path that is a file and\n * also another path's directory; `pwpack.json` missing,\n * not JSON, or not matching the contract schema; `app.entry` or an\n * `app.surfaceOrder` key without its `app/surfaces/<key>.receipt.json`; two\n * different atom directories yielding the same `kind:id`; a JSON file under\n * `app/` or `media/provenance.json` that does not parse; an invalid\n * `media/provenance.json` or one naming a file the pack does not carry;\n * a file under `app/assets/` (`LEGACY_ASSETS_FOLDER`); a media declaration\n * that breaks its schema, names a `file` missing from `media/`, or whose file\n * has no provenance entry (see `mediaDeclarations`).\n *\n * Warnings: two paths that collide on a case-insensitive file system;\n * unknown top-level entries; unknown families under `atoms/`; the\n * rootless or mixed layout; `pwpack.json` declaring a newer format; an app\n * entry not in its surface order or a key listed twice; files under\n * `app/surfaces/` that are not receipts; media files without provenance, or\n * whose hash disagrees with it (not reported when the provenance record is\n * itself invalid); other JSON files that do not parse; a file under\n * `app/media/` that is not a `<key>.json` declaration.\n *\n * Info: a legacy `package.json` at the root; a Markdown file directly in\n * `atoms/` or in an atom-family directory (documentation, not an atom).\n */\nexport function validatePack(pack: PackFolder): PackValidation {\n const issues: PackIssue[] = []\n const add = (severity: PackIssue['severity'], code: string, message: string, path?: string): void => {\n issues.push(path === undefined ? { severity, code, message } : { severity, code, message, path })\n }\n const paths = sortedPaths(pack.files.keys())\n\n // ---- collisions ----\n const conflict = findPathConflict(paths)\n if (conflict) {\n add('error', 'PATH_CONFLICT', `${conflict.file} is a file and also the directory of ${conflict.inside}`, conflict.file)\n }\n for (const group of findCaseConflicts(paths)) {\n add(\n 'warning',\n 'CASE_CONFLICT',\n `${group.join(', ')} differ only in case or Unicode normalisation; extracting them on a case-insensitive file system keeps one`,\n group[0]\n )\n }\n\n // ---- paths, top level and layout ----\n const unknownTop = new Set<string>()\n const unknownFamily = new Set<string>()\n let canonical = false\n let rootless = false\n for (const path of paths) {\n const reason = unsafePathReason(path)\n if (reason) {\n add('error', 'UNSAFE_PATH', `${path}: ${reason}`, path)\n continue\n }\n const parts = path.split('/')\n const top = parts[0] as string\n const cls = classifyPackPath(path)\n if (cls?.kind === 'identity') continue\n if (cls?.kind === 'app') {\n canonical = true\n continue\n }\n if (path === 'package.json') {\n add('info', 'LEGACY_PACKAGE_JSON', 'package.json at the root is legacy identity; pwpack.json is read instead', path)\n continue\n }\n if (PACK_DOC_FILES.has(path)) continue\n if (top === 'media' && parts.length > 1) continue\n if (top === 'atoms' && parts.length > 1) {\n canonical = true\n const family = parts[1] as string\n if (isDocFile(parts, 2) || (parts.length === 3 && ATOM_FAMILIES.has(family) && isDocFile(parts, 3))) {\n add('info', 'DOC_FILE', `${path} is documentation, not an atom`, path)\n continue\n }\n if (parts.length === 2 || !ATOM_FAMILIES.has(family)) unknownFamily.add(family)\n continue\n }\n if (parts.length > 1 && ATOM_FAMILIES.has(top)) {\n if (isDocFile(parts, 2)) add('info', 'DOC_FILE', `${path} is documentation, not an atom`, path)\n // Atom families at the root are the rootless layout. Root `lib/` and\n // `test/` are expected in both layouts (shared code on the legacy wire,\n // a source folder's own tests), so they do not decide the layout.\n if (!NEUTRAL_ROOT_DIRS.has(top)) rootless = true\n continue\n }\n unknownTop.add(parts.length > 1 ? `${top}/` : top)\n }\n for (const name of unknownTop) {\n add('warning', 'UNKNOWN_TOP_LEVEL', `${name} is not part of the pwpack folder (pwpack.json, app/, atoms/, media/)`, name)\n }\n for (const family of unknownFamily) {\n add('warning', 'UNKNOWN_ATOM_FAMILY', `atoms/${family} is not a known atom family`, `atoms/${family}`)\n }\n const layout: PackLayout = canonical && rootless ? 'mixed' : canonical ? 'canonical' : rootless ? 'rootless' : 'empty'\n if (layout === 'mixed') {\n add('warning', 'LAYOUT_MIXED', 'the folder mixes atoms/ with atom families at the root')\n } else if (layout === 'rootless') {\n add('warning', 'LAYOUT_ROOTLESS', 'atom families sit at the root; the canonical folder keeps them under atoms/')\n }\n\n // ---- identity ----\n let identity: PwpackIdentity | null = null\n const identityBytes = pack.files.get(IDENTITY_FILE)\n if (!identityBytes) {\n add('error', 'IDENTITY_MISSING', 'the folder has no pwpack.json', IDENTITY_FILE)\n } else {\n const parsed = parseJson(identityBytes)\n if (!parsed.ok) {\n add('error', 'IDENTITY_INVALID', `pwpack.json is not JSON: ${parsed.error}`, IDENTITY_FILE)\n } else {\n const result = safeParsePwpackIdentity(parsed.value)\n if (result.ok) {\n identity = result.value\n } else {\n for (const issue of result.issues) add('error', 'IDENTITY_INVALID', `pwpack.json ${issue}`, IDENTITY_FILE)\n }\n }\n }\n if (identity?.formatVersion !== undefined) {\n const major = Number(identity.formatVersion.split('.')[0])\n if (major > SUPPORTED_FORMAT_MAJOR) {\n add(\n 'warning',\n 'FORMAT_VERSION_NEWER',\n `pwpack.json formatVersion ${identity.formatVersion} is newer than this reader (${SUPPORTED_FORMAT_MAJOR}.x); parts of it may be ignored`,\n IDENTITY_FILE\n )\n }\n }\n\n // ---- app ----\n if (identity?.app) {\n const { entry, surfaceOrder } = identity.app\n const receipt = (key: string): string => `${APP_SURFACES}${key}${RECEIPT_SUFFIX}`\n const missing = new Set<string>()\n for (const key of [entry, ...surfaceOrder]) {\n if (!pack.files.has(receipt(key)) && !missing.has(key)) {\n missing.add(key)\n add('error', 'APP_SURFACE_MISSING', `pwpack.json app names surface \"${key}\" but ${receipt(key)} is absent`, receipt(key))\n }\n }\n if (!surfaceOrder.includes(entry)) {\n add('warning', 'APP_ENTRY_NOT_IN_ORDER', `app.entry \"${entry}\" is not listed in app.surfaceOrder`, IDENTITY_FILE)\n }\n const seen = new Set<string>()\n for (const key of surfaceOrder) {\n if (seen.has(key)) add('warning', 'APP_SURFACE_DUPLICATE', `app.surfaceOrder lists \"${key}\" more than once`, IDENTITY_FILE)\n seen.add(key)\n }\n }\n for (const path of paths) {\n if (!path.startsWith(APP_SURFACES)) continue\n const rest = path.slice(APP_SURFACES.length)\n if (rest.includes('/') || !rest.endsWith(RECEIPT_SUFFIX)) {\n add('warning', 'APP_UNEXPECTED_FILE', `${path} is not an app/surfaces/<key>.receipt.json`, path)\n }\n }\n\n // ---- JSON well-formedness ----\n for (const path of paths) {\n if (!path.endsWith('.json') || path === IDENTITY_FILE || path === MEDIA_PROVENANCE) continue\n const parsed = parseJson(pack.files.get(path) as Uint8Array)\n if (parsed.ok) continue\n const severity = path.startsWith('app/') ? 'error' : 'warning'\n add(severity, 'JSON_INVALID', `${path} is not JSON: ${parsed.error}`, path)\n }\n\n // ---- atoms ----\n const firstDir = new Map<string, string>()\n for (const { ref, dir } of atomOccurrences(pack)) {\n const key = `${ref.kind}:${ref.id}`\n const seenDir = firstDir.get(key)\n if (seenDir === undefined) firstDir.set(key, dir)\n else if (seenDir !== dir) {\n add('error', 'DUPLICATE_ATOM', `${key} comes from both ${seenDir} and ${dir}`, ref.relPath)\n }\n }\n\n // ---- media ----\n const mediaFiles = paths.filter((p) => p.startsWith('media/') && p !== MEDIA_PROVENANCE)\n const declared = new Set<string>()\n // Undeclared media is only computed against a provenance record that is\n // valid; an invalid one is reported once, not once per media file.\n const provenance = readMediaProvenance(pack)\n if (provenance.state === 'invalid') {\n for (const issue of provenance.issues) add('error', 'MEDIA_PROVENANCE_INVALID', `media/provenance.json ${issue}`, MEDIA_PROVENANCE)\n } else if (provenance.state === 'valid') {\n for (const item of provenance.value.items) {\n declared.add(item.path)\n const bytes = pack.files.get(item.path)\n if (!bytes) {\n add('error', 'MEDIA_PROVENANCE_PATH_MISSING', `media/provenance.json lists ${item.path}, which the pack does not carry`, item.path)\n } else if (item.hash.startsWith('sha256:') && item.hash !== `sha256:${sha256Hex(bytes)}`) {\n add('warning', 'MEDIA_HASH_MISMATCH', `${item.path} does not match the hash media/provenance.json records`, item.path)\n }\n }\n }\n for (const path of provenance.state === 'invalid' ? [] : mediaFiles) {\n if (!declared.has(path)) add('warning', 'MEDIA_UNDECLARED', `${path} has no entry in media/provenance.json`, path)\n }\n // Declarations: which layout, and whether the bytes they name are there.\n issues.push(...mediaDeclarations(pack).issues)\n\n return {\n ok: !issues.some((i) => i.severity === 'error'),\n issues,\n identity,\n layout,\n atoms: deriveAtoms(pack),\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@pwfabric/pack",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Read, validate, hash and write the pwpack folder and its deterministic .pwpack archive",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "author": "PhiMajor Solutions",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/pwfabric/pwfabric.git",
11
+ "directory": "packages/pack"
12
+ },
13
+ "homepage": "https://github.com/pwfabric/pwfabric#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/pwfabric/pwfabric/issues"
16
+ },
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "LICENSE",
29
+ "README.md",
30
+ "COMPAT.md"
31
+ ],
32
+ "engines": {
33
+ "node": ">=22"
34
+ },
35
+ "dependencies": {
36
+ "@pwfabric/contracts": "1.0.0-rc.1"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.0.0",
40
+ "@vitest/coverage-v8": "^2.1.9",
41
+ "typescript": "^5.4.0",
42
+ "vitest": "^2.0.0"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "scripts": {
48
+ "build": "rm -rf dist tsconfig.tsbuildinfo && tsc",
49
+ "dev": "tsc --watch",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:coverage": "vitest run --coverage",
53
+ "lint": "eslint src",
54
+ "lint:fix": "eslint src --fix",
55
+ "typecheck": "tsc --noEmit",
56
+ "clean": "rm -rf dist"
57
+ }
6
58
  }