@quillmark/quiver 0.1.1 → 0.3.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.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Convenience test harness for Quiver authors using `node:test`.
3
+ *
4
+ * Built into Node 18+; no extra test-runner dependency required. If you
5
+ * prefer vitest, jest, or another runner, write a 12-line loop against
6
+ * the main API instead — every primitive used here is public.
7
+ *
8
+ * Usage (place this file next to your Quiver.yaml):
9
+ *
10
+ * import { Quillmark } from "@quillmark/wasm";
11
+ * import { runQuiverTests } from "@quillmark/quiver/testing";
12
+ * const engine = await Quillmark.load();
13
+ * runQuiverTests(import.meta.url, engine);
14
+ *
15
+ * Run with `node --test`.
16
+ */
17
+ import { describe, it, before } from "node:test";
18
+ import { Quiver } from "./quiver.js";
19
+ import { QuiverRegistry } from "./registry.js";
20
+ /**
21
+ * Registers a `node:test` describe block that validates every quill
22
+ * version in the quiver at `metaUrlOrDir` against the provided engine.
23
+ *
24
+ * Pass `import.meta.url` when this file lives at the quiver root (next
25
+ * to Quiver.yaml). Pass an absolute directory path for any other layout.
26
+ *
27
+ * Validation covers the full loading pipeline: Quiver.yaml, Quill.yaml,
28
+ * all template files, and engine compilation via engine.quill(tree).
29
+ */
30
+ export function runQuiverTests(metaUrlOrDir, engine) {
31
+ describe("Quiver", () => {
32
+ let registry;
33
+ let quiver;
34
+ before(async () => {
35
+ quiver = await Quiver.fromDir(metaUrlOrDir);
36
+ registry = new QuiverRegistry({ engine, quivers: [quiver] });
37
+ });
38
+ it("has at least one quill", () => {
39
+ if (quiver.quillNames().length === 0) {
40
+ throw new Error("Quiver has no quills");
41
+ }
42
+ });
43
+ it("compiles every quill version without error", async () => {
44
+ for (const name of quiver.quillNames()) {
45
+ for (const version of quiver.versionsOf(name)) {
46
+ const quill = await registry.getQuill(`${name}@${version}`);
47
+ if (typeof quill.render !== "function") {
48
+ throw new Error(`${name}@${version}: engine returned non-conforming Quill`);
49
+ }
50
+ }
51
+ }
52
+ });
53
+ });
54
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * HttpTransport — browser-safe built-quiver transport that fetches via HTTP.
3
+ * Internal; not exported from index.ts.
4
+ *
5
+ * Uses globalThis.fetch — no node: imports at any level.
6
+ */
7
+ import type { BuiltTransport } from "../built-loader.js";
8
+ export declare class HttpTransport implements BuiltTransport {
9
+ private readonly baseUrl;
10
+ constructor(baseUrl: string);
11
+ fetchBytes(relativePath: string): Promise<Uint8Array>;
12
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * HttpTransport — browser-safe built-quiver transport that fetches via HTTP.
3
+ * Internal; not exported from index.ts.
4
+ *
5
+ * Uses globalThis.fetch — no node: imports at any level.
6
+ */
7
+ import { QuiverError } from "../errors.js";
8
+ export class HttpTransport {
9
+ baseUrl;
10
+ constructor(baseUrl) {
11
+ // Normalize: ensure exactly one trailing slash.
12
+ this.baseUrl = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
13
+ }
14
+ async fetchBytes(relativePath) {
15
+ // Strip any leading slash from relativePath to avoid double slashes.
16
+ const cleanPath = relativePath.startsWith("/")
17
+ ? relativePath.slice(1)
18
+ : relativePath;
19
+ const url = `${this.baseUrl}${cleanPath}`;
20
+ let response;
21
+ try {
22
+ response = await globalThis.fetch(url);
23
+ }
24
+ catch (err) {
25
+ throw new QuiverError("transport_error", `Network error fetching "${url}": ${err.message}`, { cause: err });
26
+ }
27
+ if (!response.ok) {
28
+ throw new QuiverError("transport_error", `HTTP ${response.status} fetching "${url}"`);
29
+ }
30
+ const buffer = await response.arrayBuffer();
31
+ return new Uint8Array(buffer);
32
+ }
33
+ }
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@quillmark/quiver",
3
- "version": "0.1.1",
4
- "description": "Quiver registry and packaging for Quillmark",
3
+ "version": "0.3.0",
4
+ "description": "Quiver registry and build tooling for Quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/quillmark/quiver"
9
+ "url": "git+https://github.com/nibsbin/quillmark-quiver.git"
10
10
  },
11
+ "bugs": {
12
+ "url": "https://github.com/nibsbin/quillmark-quiver/issues"
13
+ },
14
+ "homepage": "https://github.com/nibsbin/quillmark-quiver#readme",
11
15
  "keywords": [
12
16
  "quillmark",
13
17
  "quiver",
@@ -38,20 +42,14 @@
38
42
  "README.md"
39
43
  ],
40
44
  "peerDependencies": {
41
- "@quillmark/wasm": ">=0.59.0-rc.2",
42
- "vitest": ">=4.0.0"
43
- },
44
- "peerDependenciesMeta": {
45
- "vitest": {
46
- "optional": true
47
- }
45
+ "@quillmark/wasm": ">=0.59.0"
48
46
  },
49
47
  "dependencies": {
50
48
  "fflate": "^0.8.2",
51
49
  "yaml": "^2.8.3"
52
50
  },
53
51
  "devDependencies": {
54
- "@quillmark/wasm": "0.59.0-rc.2",
52
+ "@quillmark/wasm": "0.59.0",
55
53
  "@types/node": "^25.3.3",
56
54
  "typescript": "^5.9.3",
57
55
  "vitest": "^4.0.18"