Skip to content

Commit b630283

Browse files
committed
Release 0.0.1-next.11
1 parent 1ca0c5c commit b630283

File tree

5 files changed

+151
-100
lines changed

5 files changed

+151
-100
lines changed

dist/index.d.ts

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
import { PipelineStage } from '@typematter/pipeline';
2+
3+
declare module '@typematter/pipeline' {
4+
interface PipelineContext {
5+
content?: string;
6+
name?: string;
7+
}
8+
}
9+
declare const createLocalLoader: (path: string) => PipelineStage;
10+
11+
declare module '@typematter/pipeline' {
12+
interface PipelineContext {
13+
content?: string;
14+
name?: string;
15+
}
16+
}
17+
declare const createRemoteLoader: (baseUrl: string | URL) => PipelineStage;
18+
119
interface UnknownField {
220
type: string;
321
description?: string;
@@ -92,35 +110,14 @@ interface ArchetypeStore {
92110
load(name: string): Promise<Archetype>;
93111
}
94112

95-
/**
96-
* Error thrown when a local archetype fails to load.
97-
*/
98-
declare class LocalArchetypeLoadError extends ArchetypeLoadError {
99-
constructor(name: string, originalError: Error);
113+
interface StoreOptions {
114+
/**
115+
* Cache loaded archetypes
116+
*/
117+
cache?: boolean;
100118
}
101-
/**
102-
* Creates a store that loads archetype schemas from local markdown files.
103-
*
104-
* @param root - The root directory containing the archetype schemas.
105-
* @returns A store that loads archetype schemas from local markdown files.
106-
* @throws {LocalArchetypeLoadError} If the archetype schema could not be loaded
107-
*/
108-
declare const createLocalStore: (root: string) => ArchetypeStore;
109119

110-
/**
111-
* Error thrown when a remote archetype fails to load.
112-
*/
113-
declare class RemoteArchetypeLoadError extends ArchetypeLoadError {
114-
constructor(name: string, statusText: string);
115-
}
116-
/**
117-
* Creates a store that loads archetype schemas from remote markdown files.
118-
*
119-
* @param baseUrl - The base URL to load the archetype from.
120-
* @returns A store that loads archetype schemas from remote markdown files.
121-
* @throws {RemoteArchetypeLoadError} If the archetype schema could not be loaded
122-
*/
123-
declare const createRemoteStore: (baseUrl: string | URL) => ArchetypeStore;
120+
declare const createStore: (loadContent: PipelineStage, options?: StoreOptions) => ArchetypeStore;
124121

125122
interface ValidationError {
126123
path: string[];
@@ -163,10 +160,6 @@ interface ValidatorOptions {
163160
* Where to load archetypes from
164161
*/
165162
store: ArchetypeStore;
166-
/**
167-
* Cache loaded archetypes
168-
*/
169-
cache?: boolean;
170163
/**
171164
* Validation options
172165
*/
@@ -194,4 +187,4 @@ interface ValidatorOptions {
194187
*/
195188
declare const createValidator: (options: ValidatorOptions) => Promise<ArchetypeValidator>;
196189

197-
export { type Archetype, ArchetypeLoadError, type ArchetypeStore, type ArchetypeValidator, LocalArchetypeLoadError, RemoteArchetypeLoadError, type SchemaField, type ValidationError, type ValidationResult, type ValidatorOptions, createLocalStore, createRemoteStore, createValidator };
190+
export { type Archetype, ArchetypeLoadError, type ArchetypeStore, type ArchetypeValidator, type SchemaField, type ValidationError, type ValidationResult, type ValidatorOptions, createLocalLoader, createRemoteLoader, createStore, createValidator };

dist/index.js

Lines changed: 121 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typematter/archetype",
3-
"version": "0.0.1-next.10",
3+
"version": "0.0.1-next.11",
44
"description": "Archetype system for validating frontmatter.",
55
"private": false,
66
"type": "module",

src/index.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
export {
2-
LocalArchetypeLoadError,
3-
default as createLocalStore
4-
} from './lib/store/create-local-store.js';
5-
export {
6-
RemoteArchetypeLoadError,
7-
default as createRemoteStore
8-
} from './lib/store/create-remote-store.js';
1+
export { default as createLocalLoader } from './lib/store/create-local-loader.js';
2+
export { default as createRemoteLoader } from './lib/store/create-remote-loader.js';
3+
export { default as createStore } from './lib/store/create-store.js';
94
export { default as createValidator } from './lib/validator/create-validator.js';
105
export { ArchetypeLoadError, type ArchetypeStore } from './types/archetype-store.js';
116
export type { ArchetypeValidator } from './types/archetype-validator.js';

0 commit comments

Comments
 (0)