Compare commits

..

9 Commits

Author SHA1 Message Date
Chris Wanstrath
4f092fca3f prelude tests 2025-10-28 12:51:46 -07:00
b50dafe79d need you 2025-10-28 12:51:46 -07:00
af7f389a04 use module 2025-10-28 12:51:46 -07:00
67a98837ed native -> global 2025-10-28 12:51:46 -07:00
b42675e1d9 narrow type 2025-10-28 12:51:46 -07:00
354df33894 no valueFunctions 2025-10-28 12:51:46 -07:00
66d21ce72b update-reef command 2025-10-28 12:51:46 -07:00
d7bcc590fe better echo 2025-10-28 12:51:46 -07:00
787d2f2611 start on a prelude of builtin functions 2025-10-28 12:51:46 -07:00
3 changed files with 6 additions and 6 deletions

View File

@ -62,7 +62,7 @@
"hono": ["hono@4.9.8", "", {}, "sha512-JW8Bb4RFWD9iOKxg5PbUarBYGM99IcxFl2FPBo2gSJO11jjUDqlP1Bmfyqt8Z/dGhIQ63PMA9LdcLefXyIasyg=="],
"reefvm": ["reefvm@git+https://git.nose.space/defunkt/reefvm#e54207067734d2186cd788c3654b675b493c2585", { "peerDependencies": { "typescript": "^5" } }, "e54207067734d2186cd788c3654b675b493c2585"],
"reefvm": ["reefvm@git+https://git.nose.space/defunkt/reefvm#97b6722a113417398a1c47d583bfe07a906f87a0", { "peerDependencies": { "typescript": "^5" } }, "97b6722a113417398a1c47d583bfe07a906f87a0"],
"style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="],

View File

@ -13,12 +13,12 @@
"update-reef": "cd packages/ReefVM && git pull origin main"
},
"dependencies": {
"reefvm": "git+https://git.nose.space/defunkt/reefvm",
"@codemirror/view": "^6.38.3",
"@lezer/generator": "^1.8.0",
"bun-plugin-tailwind": "^0.0.15",
"codemirror": "^6.0.2",
"hono": "^4.9.8",
"reefvm": "git+https://git.nose.space/defunkt/reefvm",
"tailwindcss": "^4.1.11"
},
"devDependencies": {

View File

@ -3,7 +3,7 @@ import { parser } from '#parser/shrimp'
import { $ } from 'bun'
import { assert, errorMessage } from '#utils/utils'
import { Compiler } from '#compiler/compiler'
import { run, VM } from 'reefvm'
import { run, VM, type TypeScriptFunction } from 'reefvm'
import { treeToString, VMResultToValue } from '#utils/tree'
const regenerateParser = async () => {
@ -33,7 +33,7 @@ declare module 'bun:test' {
toMatchTree(expected: string): T
toMatchExpression(expected: string): T
toFailParse(): T
toEvaluateTo(expected: unknown, globals?: Record<string, any>): Promise<T>
toEvaluateTo(expected: unknown, globalFunctions?: Record<string, TypeScriptFunction>): Promise<T>
toFailEvaluation(): Promise<T>
}
}
@ -96,13 +96,13 @@ expect.extend({
async toEvaluateTo(
received: unknown,
expected: unknown,
globals: Record<string, any> = {}
globalFunctions: Record<string, TypeScriptFunction> = {}
) {
assert(typeof received === 'string', 'toEvaluateTo can only be used with string values')
try {
const compiler = new Compiler(received)
const result = await run(compiler.bytecode, globals)
const result = await run(compiler.bytecode, globalFunctions)
let value = VMResultToValue(result)
// Just treat regex as strings for comparison purposes