@mdzip/core-js 1.2.1 → 1.2.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.
- package/AGENTS.md +38 -0
- package/package.json +3 -2
package/AGENTS.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Notes for AI Agents
|
|
2
|
+
|
|
3
|
+
Read `README.md` before looking at source or type files.
|
|
4
|
+
|
|
5
|
+
## Key facts that are easy to miss
|
|
6
|
+
|
|
7
|
+
**Two main classes: `MdzArchiveCore` and `MdzPackagerCore`**
|
|
8
|
+
|
|
9
|
+
- `MdzArchiveCore`: Read and validate existing `.mdz` archives. Operate on archive bytes.
|
|
10
|
+
- `MdzPackagerCore`: Build new archives, manage paths, create manifests, pack directories into `.mdz` format.
|
|
11
|
+
|
|
12
|
+
**Static vs Instance methods**
|
|
13
|
+
|
|
14
|
+
Most operations are static (e.g., `MdzArchiveCore.open()`, `MdzArchiveCore.addFile()`). Instance methods operate on an already-opened `MdzArchiveCore` object. Static methods accept archive bytes; instance methods work with the open archive.
|
|
15
|
+
|
|
16
|
+
**Paths are case-insensitive**
|
|
17
|
+
|
|
18
|
+
Archive paths are normalized and compared case-insensitively. `index.md` and `Index.md` refer to the same entry.
|
|
19
|
+
|
|
20
|
+
**Entry point resolution**
|
|
21
|
+
|
|
22
|
+
Manifest `entryPoint` is optional. If missing, the library infers it: first `.md` file in root, or `index.md` if present. Call `resolveEntryPoint()` to get the inferred path.
|
|
23
|
+
|
|
24
|
+
**Mutation returns new bytes, not mutated archives**
|
|
25
|
+
|
|
26
|
+
`MdzArchiveCore.addFile()`, `removeFile()`, etc. return new archive bytes. They do NOT mutate the input. This is important for immutable workflows.
|
|
27
|
+
|
|
28
|
+
**Workspace shape**
|
|
29
|
+
|
|
30
|
+
`openWorkspace()` returns a flattened `MdzWorkspace` object with `documents` and `assets` arrays, not the nested directory structure of the archive. Assets expose `readBytes` and `readDataUri` for lazy loading.
|
|
31
|
+
|
|
32
|
+
**Validation is lax by default**
|
|
33
|
+
|
|
34
|
+
`validate()` returns warnings but not errors for common issues (missing manifest, missing entry point). Check `getValidationStatus()` to convert to a single status value.
|
|
35
|
+
|
|
36
|
+
**Orphaned asset detection is O(n²)**
|
|
37
|
+
|
|
38
|
+
`findOrphanedAssets()` scans all markdown files against all images. For large archives with many assets, this is slow. Cache the result if needed across multiple calls.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdzip/core-js",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Core TypeScript/JavaScript library for MDZip (.mdz): pack, unpack, validate, and resolve entry points.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"AGENTS.md"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "tsc -p tsconfig.json",
|