@quillmark/registry 0.1.0 → 0.1.10
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/README.md +133 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +49 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +83 -0
- package/dist/registry.js.map +1 -0
- package/dist/sources/file-system-source.d.ts +24 -0
- package/dist/sources/file-system-source.d.ts.map +1 -0
- package/dist/sources/file-system-source.js +149 -0
- package/dist/sources/file-system-source.js.map +1 -0
- package/dist/sources/http-source.d.ts +27 -0
- package/dist/sources/http-source.d.ts.map +1 -0
- package/dist/sources/http-source.js +113 -0
- package/dist/sources/http-source.js.map +1 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @quillmark/registry
|
|
2
|
+
|
|
3
|
+
Unified API for discovering, loading, and registering Quills with the Quillmark WASM engine. Works in both browser and Node.js environments.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @quillmark/registry
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependency:** Requires `@quillmark/wasm@^0.36.0` — you provide the engine instance.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Browser (HTTP source)
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { Quillmark } from '@quillmark/wasm';
|
|
19
|
+
import { QuillRegistry, HttpSource } from '@quillmark/registry';
|
|
20
|
+
|
|
21
|
+
const engine = new Quillmark();
|
|
22
|
+
const source = new HttpSource({ baseUrl: 'https://cdn.example.com/quills/' });
|
|
23
|
+
const registry = new QuillRegistry({ source, engine });
|
|
24
|
+
|
|
25
|
+
// Resolve a quill — fetches, caches, and registers with the engine
|
|
26
|
+
const bundle = await registry.resolve('usaf_memo');
|
|
27
|
+
|
|
28
|
+
// Engine is now ready to render
|
|
29
|
+
const parsed = Quillmark.parseMarkdown(myMarkdown);
|
|
30
|
+
const result = engine.render(parsed, { quill: 'usaf_memo' });
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Node.js (filesystem source)
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { Quillmark } from '@quillmark/wasm';
|
|
37
|
+
import { QuillRegistry, FileSystemSource } from '@quillmark/registry';
|
|
38
|
+
|
|
39
|
+
const engine = new Quillmark();
|
|
40
|
+
const source = new FileSystemSource('/path/to/quills');
|
|
41
|
+
const registry = new QuillRegistry({ source, engine });
|
|
42
|
+
|
|
43
|
+
const bundle = await registry.resolve('usaf_memo');
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
### `QuillRegistry`
|
|
49
|
+
|
|
50
|
+
Orchestrates sources, resolves versions, caches loaded quills, and registers them with the engine. Loading is lazy — quills are fetched on first `resolve()` call, not at construction time.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const registry = new QuillRegistry({ source, engine });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
| Method | Description |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `resolve(name, version?)` | Resolves a quill by name. Fetches from source, caches, and registers with the engine. Returns a `QuillBundle`. |
|
|
59
|
+
| `preload(names)` | Resolves multiple quills in parallel. Fail-fast — rejects immediately if any quill fails. |
|
|
60
|
+
| `getManifest()` | Returns the full `QuillManifest` from the source. |
|
|
61
|
+
| `getAvailableQuills()` | Returns `QuillMetadata[]` for all quills in the source. |
|
|
62
|
+
| `isLoaded(name)` | Returns `true` if the quill is registered in the engine. |
|
|
63
|
+
|
|
64
|
+
### `HttpSource`
|
|
65
|
+
|
|
66
|
+
Fetches quill zips and manifest from any HTTP endpoint. Works in browser and Node.js.
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const source = new HttpSource({
|
|
70
|
+
baseUrl: 'https://cdn.example.com/quills/',
|
|
71
|
+
manifest: preloadedManifest, // optional — skip initial manifest fetch (useful for SSR)
|
|
72
|
+
fetch: customFetch, // optional — custom fetch function
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Zip URLs use the format `{baseUrl}{name}@{version}.zip?v={version}` for cache-busting.
|
|
77
|
+
|
|
78
|
+
### `FileSystemSource`
|
|
79
|
+
|
|
80
|
+
Node.js-only source that reads quill directories from disk. Each subdirectory must contain a `Quill.yaml` with `name` and `version` fields.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const source = new FileSystemSource('/path/to/quills');
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Packaging for static hosting
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
await source.packageForHttp('/path/to/output');
|
|
90
|
+
// Writes: output/manifest.json, output/usaf_memo@1.0.0.zip, ...
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `QuillSource` interface
|
|
94
|
+
|
|
95
|
+
Implement this to create custom sources:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
interface QuillSource {
|
|
99
|
+
getManifest(): Promise<QuillManifest>;
|
|
100
|
+
loadQuill(name: string, version?: string): Promise<QuillBundle>;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Error Handling
|
|
105
|
+
|
|
106
|
+
All errors are thrown as `RegistryError` with a typed `code`:
|
|
107
|
+
|
|
108
|
+
| Code | Meaning |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `quill_not_found` | No quill with that name exists in the source |
|
|
111
|
+
| `version_not_found` | Quill exists but the requested version doesn't |
|
|
112
|
+
| `load_error` | Source failed to fetch or parse quill data |
|
|
113
|
+
| `source_unavailable` | Network failure, filesystem error, etc. |
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { RegistryError } from '@quillmark/registry';
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
await registry.resolve('nonexistent');
|
|
120
|
+
} catch (err) {
|
|
121
|
+
if (err instanceof RegistryError) {
|
|
122
|
+
console.error(err.code, err.quillName);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Version Resolution
|
|
128
|
+
|
|
129
|
+
When a version is provided, the registry resolves an exact match. When omitted, it resolves to the latest available. The registry checks the engine first (via `resolveQuill()`) to avoid redundant fetches, then checks its in-memory cache, and only hits the source if needed.
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
Apache-2.0
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RegistryErrorCode = 'quill_not_found' | 'version_not_found' | 'load_error' | 'source_unavailable';
|
|
2
|
+
export declare class RegistryError extends Error {
|
|
3
|
+
code: RegistryErrorCode;
|
|
4
|
+
quillName?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
constructor(code: RegistryErrorCode, message: string, options?: {
|
|
7
|
+
quillName?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAC1B,iBAAiB,GACjB,mBAAmB,GACnB,YAAY,GACZ,oBAAoB,CAAC;AAExB,qBAAa,aAAc,SAAQ,KAAK;IACvC,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;gBAGhB,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAQpE"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class RegistryError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
quillName;
|
|
4
|
+
version;
|
|
5
|
+
constructor(code, message, options) {
|
|
6
|
+
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
7
|
+
this.name = 'RegistryError';
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.quillName = options?.quillName;
|
|
10
|
+
this.version = options?.version;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACvC,IAAI,CAAoB;IACxB,SAAS,CAAU;IACnB,OAAO,CAAU;IAEjB,YACC,IAAuB,EACvB,OAAe,EACf,OAAmE;QAEnE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;IACjC,CAAC;CACD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { QuillData, QuillMetadata, QuillManifest, QuillBundle, QuillSource, QuillInfo, QuillmarkEngine, } from './types.js';
|
|
2
|
+
export { RegistryError } from './errors.js';
|
|
3
|
+
export type { RegistryErrorCode } from './errors.js';
|
|
4
|
+
export { FileSystemSource } from './sources/file-system-source.js';
|
|
5
|
+
export { HttpSource } from './sources/http-source.js';
|
|
6
|
+
export type { HttpSourceOptions } from './sources/http-source.js';
|
|
7
|
+
export { QuillRegistry } from './registry.js';
|
|
8
|
+
export type { QuillRegistryOptions } from './registry.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Errors
|
|
2
|
+
export { RegistryError } from './errors.js';
|
|
3
|
+
// Sources
|
|
4
|
+
export { FileSystemSource } from './sources/file-system-source.js';
|
|
5
|
+
export { HttpSource } from './sources/http-source.js';
|
|
6
|
+
// Registry
|
|
7
|
+
export { QuillRegistry } from './registry.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,UAAU;AACV,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,WAAW;AACX,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { QuillBundle, QuillManifest, QuillmarkEngine, QuillMetadata, QuillSource } from './types.js';
|
|
2
|
+
export interface QuillRegistryOptions {
|
|
3
|
+
source: QuillSource;
|
|
4
|
+
engine: QuillmarkEngine;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Orchestrates quill sources, resolves versions, caches loaded quills,
|
|
8
|
+
* and registers them with the engine.
|
|
9
|
+
*
|
|
10
|
+
* The registry is scoped to a specific engine instance. On resolve(), it
|
|
11
|
+
* fetches quill data from the source and registers it with that engine.
|
|
12
|
+
* Loading is lazy — quills are fetched and pushed to the engine on first
|
|
13
|
+
* resolve() call, not at construction time.
|
|
14
|
+
*/
|
|
15
|
+
export declare class QuillRegistry {
|
|
16
|
+
private source;
|
|
17
|
+
private engine;
|
|
18
|
+
/** In-memory cache of resolved QuillBundle objects, keyed by `name@version`. */
|
|
19
|
+
private cache;
|
|
20
|
+
constructor(options: QuillRegistryOptions);
|
|
21
|
+
/** Returns the manifest from the underlying source. */
|
|
22
|
+
getManifest(): Promise<QuillManifest>;
|
|
23
|
+
/** Returns metadata for all available quills from the source manifest. */
|
|
24
|
+
getAvailableQuills(): Promise<QuillMetadata[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolves a quill by name and optional version.
|
|
27
|
+
*
|
|
28
|
+
* Resolution flow:
|
|
29
|
+
* 1. Check engine via resolveQuill() — return immediately if already registered
|
|
30
|
+
* 2. Check registry cache — return if cached
|
|
31
|
+
* 3. Ask source for the bundle (or throw version_not_found / quill_not_found)
|
|
32
|
+
* 4. Register with engine via registerQuill()
|
|
33
|
+
*
|
|
34
|
+
* When no version is specified, resolves to latest available.
|
|
35
|
+
*/
|
|
36
|
+
resolve(name: string, version?: string): Promise<QuillBundle>;
|
|
37
|
+
/**
|
|
38
|
+
* Preloads multiple quills. Fail-fast: if any quill fails to load,
|
|
39
|
+
* rejects immediately. Callers who want best-effort can call resolve()
|
|
40
|
+
* individually and catch per-quill.
|
|
41
|
+
*/
|
|
42
|
+
preload(names: string[]): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether a quill is currently loaded in the engine.
|
|
45
|
+
* Delegates to engine.resolveQuill().
|
|
46
|
+
*/
|
|
47
|
+
isLoaded(name: string): boolean;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EACX,aAAa,EACb,eAAe,EACf,aAAa,EACb,WAAW,EACX,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,MAAM,CAAkB;IAChC,gFAAgF;IAChF,OAAO,CAAC,KAAK,CAAuC;gBAExC,OAAO,EAAE,oBAAoB;IAKzC,uDAAuD;IACjD,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC;IAI3C,0EAA0E;IACpE,kBAAkB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAKpD;;;;;;;;;;OAUG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAkCnE;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG/B"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrates quill sources, resolves versions, caches loaded quills,
|
|
3
|
+
* and registers them with the engine.
|
|
4
|
+
*
|
|
5
|
+
* The registry is scoped to a specific engine instance. On resolve(), it
|
|
6
|
+
* fetches quill data from the source and registers it with that engine.
|
|
7
|
+
* Loading is lazy — quills are fetched and pushed to the engine on first
|
|
8
|
+
* resolve() call, not at construction time.
|
|
9
|
+
*/
|
|
10
|
+
export class QuillRegistry {
|
|
11
|
+
source;
|
|
12
|
+
engine;
|
|
13
|
+
/** In-memory cache of resolved QuillBundle objects, keyed by `name@version`. */
|
|
14
|
+
cache = new Map();
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.source = options.source;
|
|
17
|
+
this.engine = options.engine;
|
|
18
|
+
}
|
|
19
|
+
/** Returns the manifest from the underlying source. */
|
|
20
|
+
async getManifest() {
|
|
21
|
+
return this.source.getManifest();
|
|
22
|
+
}
|
|
23
|
+
/** Returns metadata for all available quills from the source manifest. */
|
|
24
|
+
async getAvailableQuills() {
|
|
25
|
+
const manifest = await this.source.getManifest();
|
|
26
|
+
return manifest.quills;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolves a quill by name and optional version.
|
|
30
|
+
*
|
|
31
|
+
* Resolution flow:
|
|
32
|
+
* 1. Check engine via resolveQuill() — return immediately if already registered
|
|
33
|
+
* 2. Check registry cache — return if cached
|
|
34
|
+
* 3. Ask source for the bundle (or throw version_not_found / quill_not_found)
|
|
35
|
+
* 4. Register with engine via registerQuill()
|
|
36
|
+
*
|
|
37
|
+
* When no version is specified, resolves to latest available.
|
|
38
|
+
*/
|
|
39
|
+
async resolve(name, version) {
|
|
40
|
+
// 1. Check engine — return immediately if already registered
|
|
41
|
+
const quillRef = version ? `${name}@${version}` : name;
|
|
42
|
+
const engineInfo = this.engine.resolveQuill(quillRef);
|
|
43
|
+
if (engineInfo) {
|
|
44
|
+
const cacheKey = `${engineInfo.name}@${engineInfo.version}`;
|
|
45
|
+
const cached = this.cache.get(cacheKey);
|
|
46
|
+
if (cached) {
|
|
47
|
+
return cached;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// 2. Check registry cache
|
|
51
|
+
if (version) {
|
|
52
|
+
const cacheKey = `${name}@${version}`;
|
|
53
|
+
const cached = this.cache.get(cacheKey);
|
|
54
|
+
if (cached) {
|
|
55
|
+
return cached;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// 3. Ask source for the bundle
|
|
59
|
+
const bundle = await this.source.loadQuill(name, version);
|
|
60
|
+
// 4. Register with engine
|
|
61
|
+
this.engine.registerQuill(bundle.data);
|
|
62
|
+
// Cache the resolved bundle
|
|
63
|
+
const cacheKey = `${bundle.name}@${bundle.version}`;
|
|
64
|
+
this.cache.set(cacheKey, bundle);
|
|
65
|
+
return bundle;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Preloads multiple quills. Fail-fast: if any quill fails to load,
|
|
69
|
+
* rejects immediately. Callers who want best-effort can call resolve()
|
|
70
|
+
* individually and catch per-quill.
|
|
71
|
+
*/
|
|
72
|
+
async preload(names) {
|
|
73
|
+
await Promise.all(names.map((name) => this.resolve(name)));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Checks whether a quill is currently loaded in the engine.
|
|
77
|
+
* Delegates to engine.resolveQuill().
|
|
78
|
+
*/
|
|
79
|
+
isLoaded(name) {
|
|
80
|
+
return this.engine.resolveQuill(name) !== null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=registry.js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E,CAAC;YACb,MAAM,QAAQ,GAAG,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxC,IAAI,MAAM,EAAE,CAAC;gBACZ,OAAO,MAAM,CAAC;YACf,CAAC;QACF,CAAC;QAED,+BAA+B;QAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE1D,0BAA0B;QAC1B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvC,4BAA4B;QAC5B,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEjC,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,KAAe;QAC5B,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAChD,CAAC;CACD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { QuillBundle, QuillManifest, QuillSource } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Node.js-only QuillSource that reads Quill directories from the local filesystem.
|
|
4
|
+
*
|
|
5
|
+
* Each subdirectory of the provided `quillsDir` is treated as a quill.
|
|
6
|
+
* Each must contain a `Quill.yaml` with at least `name` and `version` fields.
|
|
7
|
+
*
|
|
8
|
+
* Also exposes `packageForHttp(outputDir)` to zip quills and write a manifest
|
|
9
|
+
* for static hosting.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FileSystemSource implements QuillSource {
|
|
12
|
+
private quillsDir;
|
|
13
|
+
constructor(quillsDir: string);
|
|
14
|
+
getManifest(): Promise<QuillManifest>;
|
|
15
|
+
loadQuill(name: string, version?: string): Promise<QuillBundle>;
|
|
16
|
+
/**
|
|
17
|
+
* Packages all quills for HTTP static hosting.
|
|
18
|
+
* Zips each quill directory and writes the zips plus a `manifest.json` to `outputDir`.
|
|
19
|
+
*/
|
|
20
|
+
packageForHttp(outputDir: string): Promise<void>;
|
|
21
|
+
/** Finds the directory for a quill by scanning subdirectories and matching metadata. */
|
|
22
|
+
private findQuillDir;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=file-system-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-system-source.d.ts","sourceRoot":"","sources":["../../src/sources/file-system-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAiB,WAAW,EAAE,MAAM,aAAa,CAAC;AAuD1F;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IACnD,OAAO,CAAC,SAAS,CAAS;gBAEd,SAAS,EAAE,MAAM;IAIvB,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC;IAuBrC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAwCrE;;;OAGG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtD,wFAAwF;YAC1E,YAAY;CAqB1B"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import JSZip from 'jszip';
|
|
4
|
+
import { parse as parseYaml } from 'yaml';
|
|
5
|
+
import { RegistryError } from '../errors.js';
|
|
6
|
+
/** Reads files from a directory recursively, returning a map of relative paths to contents. */
|
|
7
|
+
async function readDirRecursive(dirPath, basePath = dirPath) {
|
|
8
|
+
const files = {};
|
|
9
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
10
|
+
for (const entry of entries) {
|
|
11
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
12
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
13
|
+
if (entry.isDirectory()) {
|
|
14
|
+
const subFiles = await readDirRecursive(fullPath, basePath);
|
|
15
|
+
Object.assign(files, subFiles);
|
|
16
|
+
}
|
|
17
|
+
else if (entry.isFile()) {
|
|
18
|
+
files[relativePath] = new Uint8Array(await fs.readFile(fullPath));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return files;
|
|
22
|
+
}
|
|
23
|
+
/** Extracts metadata from a Quill.yaml file within a quill directory. */
|
|
24
|
+
async function readQuillMetadata(quillDir) {
|
|
25
|
+
const yamlPath = path.join(quillDir, 'Quill.yaml');
|
|
26
|
+
let content;
|
|
27
|
+
try {
|
|
28
|
+
content = await fs.readFile(yamlPath, 'utf-8');
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
throw new RegistryError('load_error', `Failed to read Quill.yaml in ${quillDir}`, {
|
|
32
|
+
cause: err,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const parsed = parseYaml(content);
|
|
36
|
+
if (!parsed || typeof parsed.name !== 'string' || typeof parsed.version !== 'string') {
|
|
37
|
+
throw new RegistryError('load_error', `Invalid Quill.yaml in ${quillDir}: missing name or version`);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
name: parsed.name,
|
|
41
|
+
version: parsed.version,
|
|
42
|
+
...(typeof parsed.description === 'string' ? { description: parsed.description } : {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Node.js-only QuillSource that reads Quill directories from the local filesystem.
|
|
47
|
+
*
|
|
48
|
+
* Each subdirectory of the provided `quillsDir` is treated as a quill.
|
|
49
|
+
* Each must contain a `Quill.yaml` with at least `name` and `version` fields.
|
|
50
|
+
*
|
|
51
|
+
* Also exposes `packageForHttp(outputDir)` to zip quills and write a manifest
|
|
52
|
+
* for static hosting.
|
|
53
|
+
*/
|
|
54
|
+
export class FileSystemSource {
|
|
55
|
+
quillsDir;
|
|
56
|
+
constructor(quillsDir) {
|
|
57
|
+
this.quillsDir = quillsDir;
|
|
58
|
+
}
|
|
59
|
+
async getManifest() {
|
|
60
|
+
let entries;
|
|
61
|
+
try {
|
|
62
|
+
const dirEntries = await fs.readdir(this.quillsDir, { withFileTypes: true });
|
|
63
|
+
entries = dirEntries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
throw new RegistryError('source_unavailable', `Failed to read quills directory: ${this.quillsDir}`, { cause: err });
|
|
67
|
+
}
|
|
68
|
+
const quills = [];
|
|
69
|
+
for (const dirName of entries) {
|
|
70
|
+
const quillDir = path.join(this.quillsDir, dirName);
|
|
71
|
+
const metadata = await readQuillMetadata(quillDir);
|
|
72
|
+
quills.push(metadata);
|
|
73
|
+
}
|
|
74
|
+
return { quills };
|
|
75
|
+
}
|
|
76
|
+
async loadQuill(name, version) {
|
|
77
|
+
const manifest = await this.getManifest();
|
|
78
|
+
const entry = manifest.quills.find((q) => q.name === name && (version === undefined || q.version === version));
|
|
79
|
+
if (!entry) {
|
|
80
|
+
if (version && manifest.quills.some((q) => q.name === name)) {
|
|
81
|
+
throw new RegistryError('version_not_found', `Quill "${name}" exists but version "${version}" was not found`, { quillName: name, version });
|
|
82
|
+
}
|
|
83
|
+
throw new RegistryError('quill_not_found', `Quill "${name}" not found in source`, {
|
|
84
|
+
quillName: name,
|
|
85
|
+
version,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const quillDir = await this.findQuillDir(entry.name, entry.version);
|
|
89
|
+
let files;
|
|
90
|
+
try {
|
|
91
|
+
files = await readDirRecursive(quillDir);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
throw new RegistryError('load_error', `Failed to read quill directory: ${quillDir}`, {
|
|
95
|
+
quillName: name,
|
|
96
|
+
version: entry.version,
|
|
97
|
+
cause: err,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
name: entry.name,
|
|
102
|
+
version: entry.version,
|
|
103
|
+
data: files,
|
|
104
|
+
metadata: entry,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Packages all quills for HTTP static hosting.
|
|
109
|
+
* Zips each quill directory and writes the zips plus a `manifest.json` to `outputDir`.
|
|
110
|
+
*/
|
|
111
|
+
async packageForHttp(outputDir) {
|
|
112
|
+
await fs.mkdir(outputDir, { recursive: true });
|
|
113
|
+
const manifest = await this.getManifest();
|
|
114
|
+
for (const entry of manifest.quills) {
|
|
115
|
+
const quillDir = await this.findQuillDir(entry.name, entry.version);
|
|
116
|
+
const files = await readDirRecursive(quillDir);
|
|
117
|
+
const zip = new JSZip();
|
|
118
|
+
for (const [relativePath, content] of Object.entries(files)) {
|
|
119
|
+
zip.file(relativePath, content);
|
|
120
|
+
}
|
|
121
|
+
const zipBuffer = await zip.generateAsync({ type: 'uint8array' });
|
|
122
|
+
const zipFileName = `${entry.name}@${entry.version}.zip`;
|
|
123
|
+
await fs.writeFile(path.join(outputDir, zipFileName), zipBuffer);
|
|
124
|
+
}
|
|
125
|
+
await fs.writeFile(path.join(outputDir, 'manifest.json'), JSON.stringify(manifest, null, 2));
|
|
126
|
+
}
|
|
127
|
+
/** Finds the directory for a quill by scanning subdirectories and matching metadata. */
|
|
128
|
+
async findQuillDir(name, version) {
|
|
129
|
+
const dirEntries = await fs.readdir(this.quillsDir, { withFileTypes: true });
|
|
130
|
+
const dirs = dirEntries.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
131
|
+
for (const dirName of dirs) {
|
|
132
|
+
const quillDir = path.join(this.quillsDir, dirName);
|
|
133
|
+
try {
|
|
134
|
+
const metadata = await readQuillMetadata(quillDir);
|
|
135
|
+
if (metadata.name === name && metadata.version === version) {
|
|
136
|
+
return quillDir;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// Skip directories that don't have valid Quill.yaml
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
throw new RegistryError('quill_not_found', `Quill directory for "${name}@${version}" not found`, {
|
|
144
|
+
quillName: name,
|
|
145
|
+
version,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=file-system-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-system-source.js","sourceRoot":"","sources":["../../src/sources/file-system-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,+FAA+F;AAC/F,KAAK,UAAU,gBAAgB,CAC9B,OAAe,EACf,WAAmB,OAAO;IAE1B,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAEnE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,C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AC9F,CAAC;IAED,wFAAwF;IAChF,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAAe;QACvD,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7E,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAE1E,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;YAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC;gBACJ,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;gBACnD,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;oBAC5D,OAAO,QAAQ,CAAC;gBACjB,CAAC;YACF,CAAC;YAAC,MAAM,CAAC;gBACR,oDAAoD;YACrD,CAAC;QACF,CAAC;QAED,MAAM,IAAI,aAAa,CAAC,iBAAiB,EAAE,wBAAwB,IAAI,IAAI,OAAO,aAAa,EAAE;YAChG,SAAS,EAAE,IAAI;YACf,OAAO;SACP,CAAC,CAAC;IACJ,CAAC;CACD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { QuillBundle, QuillManifest, QuillSource } from '../types.js';
|
|
2
|
+
export interface HttpSourceOptions {
|
|
3
|
+
/** Base URL serving zips + manifest (e.g., "https://cdn.example.com/quills/"). */
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
/** Optional pre-loaded manifest to skip the initial fetch (for SSR bootstrap). */
|
|
6
|
+
manifest?: QuillManifest;
|
|
7
|
+
/** Optional custom fetch function (for testing or non-browser environments). */
|
|
8
|
+
fetch?: typeof globalThis.fetch;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* QuillSource that fetches quill zips and manifest from any HTTP endpoint.
|
|
12
|
+
*
|
|
13
|
+
* Supports local static serving, CDN hosting, and remote quill registries
|
|
14
|
+
* with the same interface. Appends `?v={version}` to zip URLs for cache-busting.
|
|
15
|
+
*
|
|
16
|
+
* Works in both browser and Node.js environments.
|
|
17
|
+
*/
|
|
18
|
+
export declare class HttpSource implements QuillSource {
|
|
19
|
+
private baseUrl;
|
|
20
|
+
private preloadedManifest?;
|
|
21
|
+
private cachedManifest?;
|
|
22
|
+
private fetchFn;
|
|
23
|
+
constructor(options: HttpSourceOptions);
|
|
24
|
+
getManifest(): Promise<QuillManifest>;
|
|
25
|
+
loadQuill(name: string, version?: string): Promise<QuillBundle>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=http-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-source.d.ts","sourceRoot":"","sources":["../../src/sources/http-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG3E,MAAM,WAAW,iBAAiB;IACjC,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,qBAAa,UAAW,YAAW,WAAW;IAC7C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,iBAAiB,CAAC,CAAgB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,OAAO,CAAC,OAAO,CAA0B;gBAE7B,OAAO,EAAE,iBAAiB;IAOhC,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC;IAuCrC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CA4ErE"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
import { RegistryError } from '../errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* QuillSource that fetches quill zips and manifest from any HTTP endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Supports local static serving, CDN hosting, and remote quill registries
|
|
7
|
+
* with the same interface. Appends `?v={version}` to zip URLs for cache-busting.
|
|
8
|
+
*
|
|
9
|
+
* Works in both browser and Node.js environments.
|
|
10
|
+
*/
|
|
11
|
+
export class HttpSource {
|
|
12
|
+
baseUrl;
|
|
13
|
+
preloadedManifest;
|
|
14
|
+
cachedManifest;
|
|
15
|
+
fetchFn;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
// Ensure baseUrl ends with a slash for consistent URL construction
|
|
18
|
+
this.baseUrl = options.baseUrl.endsWith('/') ? options.baseUrl : options.baseUrl + '/';
|
|
19
|
+
this.preloadedManifest = options.manifest;
|
|
20
|
+
this.fetchFn = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
21
|
+
}
|
|
22
|
+
async getManifest() {
|
|
23
|
+
if (this.preloadedManifest) {
|
|
24
|
+
return this.preloadedManifest;
|
|
25
|
+
}
|
|
26
|
+
if (this.cachedManifest) {
|
|
27
|
+
return this.cachedManifest;
|
|
28
|
+
}
|
|
29
|
+
const url = `${this.baseUrl}manifest.json`;
|
|
30
|
+
let response;
|
|
31
|
+
try {
|
|
32
|
+
response = await this.fetchFn(url);
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
throw new RegistryError('source_unavailable', `Failed to fetch manifest from ${url}`, {
|
|
36
|
+
cause: err,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new RegistryError('source_unavailable', `Failed to fetch manifest: ${response.status} ${response.statusText}`);
|
|
41
|
+
}
|
|
42
|
+
let manifest;
|
|
43
|
+
try {
|
|
44
|
+
manifest = (await response.json());
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
throw new RegistryError('source_unavailable', 'Failed to parse manifest JSON', {
|
|
48
|
+
cause: err,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
this.cachedManifest = manifest;
|
|
52
|
+
return manifest;
|
|
53
|
+
}
|
|
54
|
+
async loadQuill(name, version) {
|
|
55
|
+
const manifest = await this.getManifest();
|
|
56
|
+
const entry = manifest.quills.find((q) => q.name === name && (version === undefined || q.version === version));
|
|
57
|
+
if (!entry) {
|
|
58
|
+
if (version && manifest.quills.some((q) => q.name === name)) {
|
|
59
|
+
throw new RegistryError('version_not_found', `Quill "${name}" exists but version "${version}" was not found`, { quillName: name, version });
|
|
60
|
+
}
|
|
61
|
+
throw new RegistryError('quill_not_found', `Quill "${name}" not found in source`, {
|
|
62
|
+
quillName: name,
|
|
63
|
+
version,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const resolvedVersion = entry.version;
|
|
67
|
+
const zipFileName = `${name}@${resolvedVersion}.zip`;
|
|
68
|
+
const zipUrl = `${this.baseUrl}${zipFileName}?v=${resolvedVersion}`;
|
|
69
|
+
let response;
|
|
70
|
+
try {
|
|
71
|
+
response = await this.fetchFn(zipUrl);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
throw new RegistryError('load_error', `Failed to fetch quill zip from ${zipUrl}`, {
|
|
75
|
+
quillName: name,
|
|
76
|
+
version: resolvedVersion,
|
|
77
|
+
cause: err,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
throw new RegistryError('load_error', `Failed to fetch quill zip: ${response.status} ${response.statusText}`, { quillName: name, version: resolvedVersion });
|
|
82
|
+
}
|
|
83
|
+
let files;
|
|
84
|
+
try {
|
|
85
|
+
const zipData = await response.arrayBuffer();
|
|
86
|
+
const zip = await JSZip.loadAsync(zipData);
|
|
87
|
+
files = {};
|
|
88
|
+
const zipEntries = [];
|
|
89
|
+
zip.forEach((relativePath, zipEntry) => {
|
|
90
|
+
if (!zipEntry.dir) {
|
|
91
|
+
zipEntries.push(zipEntry.async('uint8array').then((content) => {
|
|
92
|
+
files[relativePath] = content;
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
await Promise.all(zipEntries);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
throw new RegistryError('load_error', `Failed to unzip quill "${name}"`, {
|
|
100
|
+
quillName: name,
|
|
101
|
+
version: resolvedVersion,
|
|
102
|
+
cause: err,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
name: entry.name,
|
|
107
|
+
version: resolvedVersion,
|
|
108
|
+
data: files,
|
|
109
|
+
metadata: entry,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=http-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-source.js","sourceRoot":"","sources":["../../src/sources/http-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAW7C;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IACd,OAAO,CAAS;IAChB,iBAAiB,CAAiB;IAClC,cAAc,CAAiB;IAC/B,OAAO,CAA0B;IAEzC,YAAY,OAA0B;QACrC,mEAAmE;QACnE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC;QACvF,IAAI,CAAC,iBAAiB,GAAG,OAAO,CA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YACX,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC;CACD"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opaque to the registry. Defined and validated by @quillmark/wasm.
|
|
3
|
+
* Currently: the JSON structure returned by loaders.fromZip() or equivalent
|
|
4
|
+
* filesystem read (template files, assets, fonts, Typst packages).
|
|
5
|
+
*/
|
|
6
|
+
export type QuillData = unknown;
|
|
7
|
+
/** Metadata about a quill, extracted from Quill.yaml or manifest. */
|
|
8
|
+
export interface QuillMetadata {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Manifest listing all available quills from a source. */
|
|
14
|
+
export interface QuillManifest {
|
|
15
|
+
quills: QuillMetadata[];
|
|
16
|
+
}
|
|
17
|
+
/** A resolved quill bundle ready for engine registration. */
|
|
18
|
+
export interface QuillBundle {
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
/** Opaque payload passed to engine.registerQuill().
|
|
22
|
+
* Shape is defined by @quillmark/wasm — the registry passes it through untouched.
|
|
23
|
+
* Currently: the JSON structure returned by loaders.fromZip() or equivalent
|
|
24
|
+
* filesystem read (template files, assets, fonts, Typst packages). */
|
|
25
|
+
data: QuillData;
|
|
26
|
+
metadata: QuillMetadata;
|
|
27
|
+
}
|
|
28
|
+
/** Pluggable backend that knows how to list and fetch Quills from a specific location. */
|
|
29
|
+
export interface QuillSource {
|
|
30
|
+
getManifest(): Promise<QuillManifest>;
|
|
31
|
+
loadQuill(name: string, version?: string): Promise<QuillBundle>;
|
|
32
|
+
}
|
|
33
|
+
/** Info returned by the engine after registering or resolving a quill. */
|
|
34
|
+
export interface QuillInfo {
|
|
35
|
+
name: string;
|
|
36
|
+
version: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Minimal interface for the @quillmark/wasm engine instance.
|
|
40
|
+
* The registry only calls these methods — it never imports or instantiates the engine.
|
|
41
|
+
*/
|
|
42
|
+
export interface QuillmarkEngine {
|
|
43
|
+
registerQuill(quill_json: unknown): QuillInfo;
|
|
44
|
+
resolveQuill(quill_ref: string): QuillInfo | null;
|
|
45
|
+
listQuills(): string[];
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC;AAEhC,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;2EAGuE;IACvE,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,aAAa,CAAC;CACxB;AAED,0FAA0F;AAC1F,MAAM,WAAW,WAAW;IAC3B,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IACtC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAChE;AAED,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAClD,UAAU,IAAI,MAAM,EAAE,CAAC;CACvB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillmark/registry",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Unified API for discovering, loading, packaging, and registering Quills with the WASM engine",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
7
|
+
"access": "public",
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
8
9
|
},
|
|
9
10
|
"scripts": {
|
|
10
11
|
"build": "tsc",
|
|
@@ -62,4 +63,4 @@
|
|
|
62
63
|
"optional": false
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
|
+
}
|