@scrolled/nav-graph 0.1.0-dev.2dfa085
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/LICENSE +200 -0
- package/README.md +83 -0
- package/dist/compile/compileGraph.d.ts +15 -0
- package/dist/compile/compileGraph.d.ts.map +1 -0
- package/dist/compile/compileGraph.js +92 -0
- package/dist/compile/compileGraph.js.map +1 -0
- package/dist/compile/index.d.ts +3 -0
- package/dist/compile/index.d.ts.map +1 -0
- package/dist/compile/index.js +2 -0
- package/dist/compile/index.js.map +1 -0
- package/dist/dsl/builder.d.ts +45 -0
- package/dist/dsl/builder.d.ts.map +1 -0
- package/dist/dsl/builder.js +177 -0
- package/dist/dsl/builder.js.map +1 -0
- package/dist/dsl/index.d.ts +4 -0
- package/dist/dsl/index.d.ts.map +1 -0
- package/dist/dsl/index.js +3 -0
- package/dist/dsl/index.js.map +1 -0
- package/dist/dsl/requirements.d.ts +9 -0
- package/dist/dsl/requirements.d.ts.map +1 -0
- package/dist/dsl/requirements.js +12 -0
- package/dist/dsl/requirements.js.map +1 -0
- package/dist/graphs/index.d.ts +6 -0
- package/dist/graphs/index.d.ts.map +1 -0
- package/dist/graphs/index.js +15 -0
- package/dist/graphs/index.js.map +1 -0
- package/dist/graphs/starter/index.d.ts +3 -0
- package/dist/graphs/starter/index.d.ts.map +1 -0
- package/dist/graphs/starter/index.js +54 -0
- package/dist/graphs/starter/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/ir/index.d.ts +4 -0
- package/dist/ir/index.d.ts.map +1 -0
- package/dist/ir/index.js +3 -0
- package/dist/ir/index.js.map +1 -0
- package/dist/ir/schema.d.ts +248 -0
- package/dist/ir/schema.d.ts.map +1 -0
- package/dist/ir/schema.js +60 -0
- package/dist/ir/schema.js.map +1 -0
- package/dist/ir/types.d.ts +63 -0
- package/dist/ir/types.d.ts.map +1 -0
- package/dist/ir/types.js +9 -0
- package/dist/ir/types.js.map +1 -0
- package/dist/json/index.d.ts +3 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/index.js +2 -0
- package/dist/json/index.js.map +1 -0
- package/dist/json/toJSON.d.ts +5 -0
- package/dist/json/toJSON.d.ts.map +1 -0
- package/dist/json/toJSON.js +10 -0
- package/dist/json/toJSON.js.map +1 -0
- package/dist/path/eligibility.d.ts +10 -0
- package/dist/path/eligibility.d.ts.map +1 -0
- package/dist/path/eligibility.js +39 -0
- package/dist/path/eligibility.js.map +1 -0
- package/dist/path/findPath.d.ts +16 -0
- package/dist/path/findPath.d.ts.map +1 -0
- package/dist/path/findPath.js +78 -0
- package/dist/path/findPath.js.map +1 -0
- package/dist/path/index.d.ts +5 -0
- package/dist/path/index.d.ts.map +1 -0
- package/dist/path/index.js +3 -0
- package/dist/path/index.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toJSON.d.ts","sourceRoot":"","sources":["../../src/json/toJSON.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC;AAE1C,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,YAAY,CAIpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Portability: serialize a compiled NavGraph back to its plain authored source.
|
|
2
|
+
// The JSON contract IS NavGraphSource — no extra runtime fields leak out, so
|
|
3
|
+
// the artifact can be re-loaded by a non-TS target and round-tripped through
|
|
4
|
+
// `navGraphSourceSchema.parse(...) → compileGraph(...)` without information loss.
|
|
5
|
+
export function toJSON(graph) {
|
|
6
|
+
// `graph.source` was produced by Zod's parser, so it's already a clean object
|
|
7
|
+
// tree. Re-emitting it without mutation keeps the round-trip contract honest.
|
|
8
|
+
return graph.source;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=toJSON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toJSON.js","sourceRoot":"","sources":["../../src/json/toJSON.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,kFAAkF;AAOlF,MAAM,UAAU,MAAM,CAAC,KAAe;IACpC,8EAA8E;IAC9E,8EAA8E;IAC9E,OAAO,KAAK,CAAC,MAAM,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TravelEdge } from '../ir/types';
|
|
2
|
+
export interface UserCapability {
|
|
3
|
+
level?: number;
|
|
4
|
+
mesos?: number;
|
|
5
|
+
questsCompleted?: ReadonlySet<number>;
|
|
6
|
+
/** itemId → quantity held. */
|
|
7
|
+
itemsHeld?: ReadonlyMap<number, number>;
|
|
8
|
+
}
|
|
9
|
+
export declare function eligibilityFilter(state: UserCapability): (edge: TravelEdge) => boolean;
|
|
10
|
+
//# sourceMappingURL=eligibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eligibility.d.ts","sourceRoot":"","sources":["../../src/path/eligibility.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,8BAA8B;IAC9B,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,GACpB,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAK/B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// User-declared state → an eligibility predicate over edges.
|
|
2
|
+
//
|
|
3
|
+
// MVP semantics:
|
|
4
|
+
// - meso: "can you afford a single use" (not cumulative budget across a trip).
|
|
5
|
+
// Cumulative meso cost is a future weighted-cost-model concern.
|
|
6
|
+
// - item(consumed:true): requires `quantity` (or 1) held; not deducted across
|
|
7
|
+
// steps either, for the same reason.
|
|
8
|
+
// - quest: must appear in questsCompleted.
|
|
9
|
+
// - level: user.level must be ≥ min.
|
|
10
|
+
//
|
|
11
|
+
// Any missing field on UserCapability is treated as "not declared" → the
|
|
12
|
+
// corresponding requirement passes by default. With nothing declared, every
|
|
13
|
+
// edge is eligible — this matches FR6 ("no state declared → all edges eligible").
|
|
14
|
+
export function eligibilityFilter(state) {
|
|
15
|
+
return (edge) => {
|
|
16
|
+
if (!edge.requirements || edge.requirements.length === 0)
|
|
17
|
+
return true;
|
|
18
|
+
return edge.requirements.every((req) => satisfies(req, state));
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function satisfies(req, state) {
|
|
22
|
+
switch (req.kind) {
|
|
23
|
+
case 'meso':
|
|
24
|
+
return state.mesos === undefined || state.mesos >= req.amount;
|
|
25
|
+
case 'level':
|
|
26
|
+
return state.level === undefined || state.level >= req.min;
|
|
27
|
+
case 'quest':
|
|
28
|
+
return (state.questsCompleted === undefined ||
|
|
29
|
+
state.questsCompleted.has(req.questId));
|
|
30
|
+
case 'item': {
|
|
31
|
+
if (state.itemsHeld === undefined)
|
|
32
|
+
return true;
|
|
33
|
+
const held = state.itemsHeld.get(req.itemId) ?? 0;
|
|
34
|
+
const needed = req.quantity ?? 1;
|
|
35
|
+
return held >= needed;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=eligibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eligibility.js","sourceRoot":"","sources":["../../src/path/eligibility.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,iBAAiB;AACjB,iFAAiF;AACjF,oEAAoE;AACpE,gFAAgF;AAChF,yCAAyC;AACzC,6CAA6C;AAC7C,uCAAuC;AACvC,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,kFAAkF;AAYlF,MAAM,UAAU,iBAAiB,CAC/B,KAAqB;IAErB,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtE,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,GAAgB,EAAE,KAAqB;IACxD,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC;QAChE,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC;QAC7D,KAAK,OAAO;YACV,OAAO,CACL,KAAK,CAAC,eAAe,KAAK,SAAS;gBACnC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CACvC,CAAC;QACJ,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;YAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAClD,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC;YACjC,OAAO,IAAI,IAAI,MAAM,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NavGraph } from '../compile/compileGraph';
|
|
2
|
+
import type { NodeId, TravelEdge } from '../ir/types';
|
|
3
|
+
export interface PathResult {
|
|
4
|
+
status: 'found' | 'unreachable' | 'unreachable-when-filtered';
|
|
5
|
+
steps: TravelEdge[];
|
|
6
|
+
fallback?: {
|
|
7
|
+
steps: TravelEdge[];
|
|
8
|
+
/** Indices into `fallback.steps` whose eligibility predicate failed. */
|
|
9
|
+
blocked: number[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface FindPathOptions {
|
|
13
|
+
eligible?: (edge: TravelEdge) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function findPath(graph: NavGraph, from: NodeId, to: NodeId, opts?: FindPathOptions): PathResult;
|
|
16
|
+
//# sourceMappingURL=findPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findPath.d.ts","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,2BAA2B,CAAC;IAC9D,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,UAAU,EAAE,CAAC;QACpB,wEAAwE;QACxE,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;CAC1C;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,eAAoB,GACzB,UAAU,CAyBZ"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// MVP pathfinding: fewest-hops BFS over the compiled adjacency.
|
|
2
|
+
//
|
|
3
|
+
// When an eligibility predicate is supplied:
|
|
4
|
+
// 1. Run BFS with the predicate pruning candidate edges.
|
|
5
|
+
// 2. If the destination is reachable that way, return `status: 'found'`.
|
|
6
|
+
// 3. Otherwise run BFS again *without* the filter. If a path exists, return
|
|
7
|
+
// `status: 'unreachable-when-filtered'` with the unfiltered path as
|
|
8
|
+
// `fallback` and the step indices the filter blocked. This is FR7 — the
|
|
9
|
+
// app never has to surface a blank "no path" state when the graph itself
|
|
10
|
+
// is connected.
|
|
11
|
+
// 4. If the unfiltered BFS also fails, return `status: 'unreachable'`.
|
|
12
|
+
export function findPath(graph, from, to, opts = {}) {
|
|
13
|
+
assertNodeKnown(graph, from, 'from');
|
|
14
|
+
assertNodeKnown(graph, to, 'to');
|
|
15
|
+
if (from === to)
|
|
16
|
+
return { status: 'found', steps: [] };
|
|
17
|
+
const filtered = opts.eligible ? bfs(graph, from, to, opts.eligible) : null;
|
|
18
|
+
if (filtered)
|
|
19
|
+
return { status: 'found', steps: filtered };
|
|
20
|
+
const unfiltered = bfs(graph, from, to);
|
|
21
|
+
if (!unfiltered)
|
|
22
|
+
return { status: 'unreachable', steps: [] };
|
|
23
|
+
if (!opts.eligible) {
|
|
24
|
+
return { status: 'found', steps: unfiltered };
|
|
25
|
+
}
|
|
26
|
+
const blocked = [];
|
|
27
|
+
unfiltered.forEach((edge, i) => {
|
|
28
|
+
if (!opts.eligible(edge))
|
|
29
|
+
blocked.push(i);
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
status: 'unreachable-when-filtered',
|
|
33
|
+
steps: [],
|
|
34
|
+
fallback: { steps: unfiltered, blocked },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function assertNodeKnown(graph, id, label) {
|
|
38
|
+
if (!graph.nodes.has(id)) {
|
|
39
|
+
throw new Error(`findPath ${label} references undeclared node "${id}".`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function bfs(graph, from, to, eligible) {
|
|
43
|
+
const cameFrom = new Map();
|
|
44
|
+
const visited = new Set([from]);
|
|
45
|
+
const queue = [from];
|
|
46
|
+
while (queue.length > 0) {
|
|
47
|
+
const node = queue.shift();
|
|
48
|
+
if (node === to)
|
|
49
|
+
return reconstruct(cameFrom, from, to);
|
|
50
|
+
const out = graph.adjacency.get(node) ?? [];
|
|
51
|
+
for (const edge of out) {
|
|
52
|
+
if (eligible && !eligible(edge))
|
|
53
|
+
continue;
|
|
54
|
+
if (visited.has(edge.to))
|
|
55
|
+
continue;
|
|
56
|
+
visited.add(edge.to);
|
|
57
|
+
cameFrom.set(edge.to, edge);
|
|
58
|
+
queue.push(edge.to);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
function reconstruct(cameFrom, from, to) {
|
|
64
|
+
const steps = [];
|
|
65
|
+
let cursor = to;
|
|
66
|
+
while (cursor !== from) {
|
|
67
|
+
const edge = cameFrom.get(cursor);
|
|
68
|
+
if (!edge) {
|
|
69
|
+
// Defensive: BFS only stores cameFrom for reachable nodes, so this
|
|
70
|
+
// branch is unreachable in practice — but typing the lookup demands it.
|
|
71
|
+
throw new Error(`Path reconstruction broke at "${cursor}".`);
|
|
72
|
+
}
|
|
73
|
+
steps.push(edge);
|
|
74
|
+
cursor = edge.from;
|
|
75
|
+
}
|
|
76
|
+
return steps.reverse();
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=findPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findPath.js","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,6CAA6C;AAC7C,2DAA2D;AAC3D,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,6EAA6E;AAC7E,8EAA8E;AAC9E,qBAAqB;AACrB,yEAAyE;AAmBzE,MAAM,UAAU,QAAQ,CACtB,KAAe,EACf,IAAY,EACZ,EAAU,EACV,OAAwB,EAAE;IAE1B,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAEjC,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEvD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,IAAI,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAE1D,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAE7D,IAAI,CAAC,IAAI,CAA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Y,CAAC;AACtC,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/path/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scrolled/nav-graph",
|
|
3
|
+
"version": "0.1.0-dev.2dfa085",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Framework-agnostic graph core: IR types + Zod schema, an authoring DSL, a compiler (IR → runtime adjacency), and pathfinding (BFS + eligibility). The engine behind Scrolled Navigator; usable standalone in Node and the browser.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "Nicholas Thomson (RedbackThomson)",
|
|
8
|
+
"homepage": "https://github.com/RedbackThomson/scrolled/tree/main/packages/nav-graph",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/RedbackThomson/scrolled.git",
|
|
12
|
+
"directory": "packages/nav-graph"
|
|
13
|
+
},
|
|
14
|
+
"bugs": "https://github.com/RedbackThomson/scrolled/issues",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"graph",
|
|
17
|
+
"directed-graph",
|
|
18
|
+
"pathfinding",
|
|
19
|
+
"bfs",
|
|
20
|
+
"navigation",
|
|
21
|
+
"navigator",
|
|
22
|
+
"scrolled"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": "./src/index.ts",
|
|
34
|
+
"./ir": "./src/ir/index.ts",
|
|
35
|
+
"./dsl": "./src/dsl/index.ts"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"main": "./dist/index.js",
|
|
40
|
+
"module": "./dist/index.js",
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"import": "./dist/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./ir": {
|
|
48
|
+
"types": "./dist/ir/index.d.ts",
|
|
49
|
+
"import": "./dist/ir/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./dsl": {
|
|
52
|
+
"types": "./dist/dsl/index.d.ts",
|
|
53
|
+
"import": "./dist/dsl/index.js"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsc -p tsconfig.build.json",
|
|
59
|
+
"clean": "rm -rf dist LICENSE",
|
|
60
|
+
"export": "vite-node src/cli/export.ts",
|
|
61
|
+
"test": "vitest run --passWithNoTests",
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
|
+
"lint": "eslint .",
|
|
64
|
+
"prepublishOnly": "pnpm run typecheck && pnpm run test && pnpm run clean && pnpm run build && cp ../../LICENSE LICENSE"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"zod": "^3.23.8"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@types/node": "^22.7.4",
|
|
71
|
+
"vite": "^5.4.8",
|
|
72
|
+
"vite-node": "^2.1.2",
|
|
73
|
+
"vitest": "^2.1.2"
|
|
74
|
+
}
|
|
75
|
+
}
|