Skip to content

Commit 9260776

Browse files
committed
feat: add plugin-api module for external plugin authors
Exports OstToolsPlugin, PluginContext, ParseResult and related types via ost-tools/plugin-api so external plugins can import the contract without depending on internal paths. Also enables declaration emit so .d.ts files are generated on build.
1 parent 43d8768 commit 9260776

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
"dist/",
1313
"schemas/"
1414
],
15+
"exports": {
16+
".": "./dist/index.js",
17+
"./plugin-api": {
18+
"types": "./dist/plugin-api.d.ts",
19+
"default": "./dist/plugin-api.js"
20+
}
21+
},
1522
"scripts": {
1623
"clean": "rm -rf dist",
1724
"generate:schema-meta": "bun run scripts/generate-schema-meta.ts",

src/plugin-api.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Public API for external ost-tools plugins.
3+
*
4+
* Import from this module to get the types needed to implement an OstToolsPlugin:
5+
*
6+
* import type { OstToolsPlugin, PluginContext, ParseResult } from 'ost-tools/plugin-api';
7+
*/
8+
9+
export type {
10+
OstToolsPlugin,
11+
ParseHook,
12+
ParseResult,
13+
PluginContext,
14+
TemplateSyncHook,
15+
TemplateSyncOptions,
16+
} from './plugins/util';
17+
export { resolveNodeType } from './schema/schema';
18+
export type {
19+
EdgeDefinition,
20+
HierarchyLevel,
21+
Relationship,
22+
SchemaMetadata,
23+
SpaceContext,
24+
SpaceNode,
25+
UnresolvedRef,
26+
} from './types';

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"moduleResolution": "bundler",
1414
"verbatimModuleSyntax": true,
1515
"noEmit": false,
16+
"declaration": true,
1617
"outDir": "dist",
1718
"rootDir": "src",
1819
"paths": { "@/*": ["./src/*"], "*": ["./*"] },

0 commit comments

Comments
 (0)