pindeck 0.0.0-stage → 2.8.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.
package/lib/zip.mjs ADDED
@@ -0,0 +1,46 @@
1
+ /* Minimal zip reader (enough for .pptx): central directory, stored and deflated entries.
2
+ No dependencies: inflation uses Node's zlib. Zip64 archives are not supported. */
3
+
4
+ import zlib from "node:zlib";
5
+
6
+ const MAX_ENTRY = 1024 * 1024 * 1024; // a zip bomb stops here instead of filling the memory
7
+
8
+ export function readZip(buf) {
9
+ // the end-of-central-directory record is in the last 64 kB (+22 bytes)
10
+ let eocd = -1;
11
+ for (let i = buf.length - 22; i >= Math.max(0, buf.length - 65557); i--) {
12
+ if (buf.readUInt32LE(i) === 0x06054b50) { eocd = i; break; }
13
+ }
14
+ if (eocd < 0) throw new Error("Not a zip file (no end of central directory).");
15
+ const count = buf.readUInt16LE(eocd + 10);
16
+ let p = buf.readUInt32LE(eocd + 16);
17
+ if (p === 0xffffffff) throw new Error("Zip64 archives are not supported.");
18
+ const entries = new Map();
19
+ for (let k = 0; k < count; k++) {
20
+ if (buf.readUInt32LE(p) !== 0x02014b50) throw new Error("Corrupt zip central directory.");
21
+ const method = buf.readUInt16LE(p + 10);
22
+ const csize = buf.readUInt32LE(p + 20);
23
+ const nameLen = buf.readUInt16LE(p + 28), extraLen = buf.readUInt16LE(p + 30), commentLen = buf.readUInt16LE(p + 32);
24
+ const local = buf.readUInt32LE(p + 42);
25
+ const name = buf.toString("utf8", p + 46, p + 46 + nameLen);
26
+ entries.set(name, { method, csize, local });
27
+ p += 46 + nameLen + extraLen + commentLen;
28
+ }
29
+ const read = (name) => {
30
+ const e = entries.get(name);
31
+ if (!e) return null;
32
+ const lp = e.local;
33
+ if (buf.readUInt32LE(lp) !== 0x04034b50) throw new Error(`Corrupt zip entry ${name}.`);
34
+ const start = lp + 30 + buf.readUInt16LE(lp + 26) + buf.readUInt16LE(lp + 28);
35
+ const data = buf.subarray(start, start + e.csize);
36
+ if (e.method === 0) return Buffer.from(data);
37
+ if (e.method === 8) return zlib.inflateRawSync(data, { maxOutputLength: MAX_ENTRY });
38
+ throw new Error(`Unsupported zip compression (method ${e.method}) in ${name}.`);
39
+ };
40
+ return {
41
+ names: () => [...entries.keys()],
42
+ has: (name) => entries.has(name),
43
+ read,
44
+ text: (name) => { const b = read(name); return b ? b.toString("utf8") : null; },
45
+ };
46
+ }
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "pindeck",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.8.1",
4
+ "description": "PinDeck: a local editor for HTML slide decks. Pin elements, describe the change, and Claude Code edits the slides.",
5
+ "keywords": [
6
+ "slides",
7
+ "presentation",
8
+ "reveal.js",
9
+ "editor",
10
+ "claude",
11
+ "claude-code",
12
+ "ai"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Emanuël A. P. Habets",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/ehabets/PinDeck.git"
19
+ },
20
+ "homepage": "https://github.com/ehabets/PinDeck#readme",
21
+ "bugs": "https://github.com/ehabets/PinDeck/issues",
22
+ "type": "module",
23
+ "bin": {
24
+ "pindeck": "server.mjs"
25
+ },
26
+ "files": [
27
+ "server.mjs",
28
+ "cli.mjs",
29
+ "lib/",
30
+ "public/",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "start": "node server.mjs",
36
+ "test": "node --test"
37
+ },
38
+ "engines": {
39
+ "node": ">=20"
40
+ }
41
+ }
Binary file