Skip to content

Commit 02ab463

Browse files
committed
fix recipe-spells with builder/runner
- builder importing runner creates a circular dependency - move doc helper to runner - builder shouldn't use runtime (as it no longer exists)
1 parent 5b4e3eb commit 02ab463

File tree

8 files changed

+14
-17
lines changed

8 files changed

+14
-17
lines changed

typescript/package-lock.json

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

typescript/packages/common-builder/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { opaqueRef as cell, stream } from "./opaque-ref.js";
2-
export { Spell, doc, select, $, event } from "./spell.js";
2+
export { Spell, select, $, event } from "./spell.js";
33
export {
44
createNodeFactory,
55
derive,

typescript/packages/common-builder/src/spell.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
stream,
66
UI,
77
} from "@commontools/common-builder";
8-
import { getDoc } from "@commontools/common-runner";
98

109
// $ is a proxy that just collect paths, so that one can call [getPath] on it
1110
// and get an array. For example for `q = $.foo.bar[0]` `q[getPath]` yields
@@ -237,7 +236,3 @@ export abstract class Spell<T extends Record<string, any>> {
237236
});
238237
}
239238
}
240-
241-
export function doc<T = any>(value: any) {
242-
return getDoc<T>(value).getAsQueryResult();
243-
}

typescript/packages/common-builder/test/module.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import {
77
Frame,
88
JSONSchema,
99
} from "../src/types.js";
10-
import { lift, handler, isolated } from "../src/module.js";
10+
import { lift, handler } from "../src/module.js";
1111
import { opaqueRef } from "../src/opaque-ref.js";
12-
import { JavaScriptModuleDefinition } from "@commontools/common-runtime";
1312
import { pushFrame } from "../src/recipe.js";
1413
import { popFrame } from "../src/recipe.js";
1514
import { z } from "zod";

typescript/packages/common-runner/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@commontools/common-runner",
33
"author": "The Common Authors",
44
"version": "0.0.1",
5-
"description": "Typescript implementation of Common Runtime.",
5+
"description": "Typescript implementation of Common Runner.",
66
"license": "UNLICENSED",
77
"private": true,
88
"type": "module",
@@ -25,7 +25,6 @@
2525
],
2626
"dependencies": {
2727
"@commontools/common-builder": "^0.0.1",
28-
"@commontools/common-runtime": "file:../common-runtime",
2928
"@commontools/llm-client": "^0.0.1",
3029
"merkle-reference": "^0.0.2"
3130
},

typescript/packages/common-runner/src/cell.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,3 +999,10 @@ export function isQueryResultForDereferencing(
999999
): value is QueryResultInternals {
10001000
return isQueryResult(value);
10011001
}
1002+
1003+
/**
1004+
* this is a helper created for the spell-style recipe prototype...
1005+
*/
1006+
export function doc<T = any>(value: any) {
1007+
return getDoc<T>(value).getAsQueryResult();
1008+
}

typescript/packages/common-runner/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type {
1414
ReactivityLog,
1515
} from "./cell.js";
1616
export {
17+
doc,
1718
getDoc,
1819
isDoc,
1920
isCell,

typescript/packages/lookslike-high-level/src/recipes/commentbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import {
55
ifElse,
66
select,
77
Spell,
8-
doc,
98
$
109
} from "@commontools/common-builder";
1110
import { h } from "@commontools/common-html";
11+
import { doc } from "@commontools/common-runner";
1212

1313
type Meta = {
1414
category: string;

0 commit comments

Comments
 (0)