Skip to content

Commit 690e075

Browse files
committed
Published using @Stream44 Studio
Signed-off-by: Christoph <christoph@christoph.diy>
1 parent 8362ed6 commit 690e075

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "t44",
3-
"version": "0.4.0-rc.6",
3+
"version": "0.4.0-rc.7",
44
"license": "Apache-2.0",
55
"repository": {
66
"type": "git",
@@ -85,9 +85,9 @@
8585
"@ucanto/principal": "^9.0.3",
8686
"@ucanto/server": "^11.0.3",
8787
"json-schema-ref-resolver": "^3.0.0",
88-
"@stream44.studio/encapsulate": "^0.4.0-rc.7",
89-
"@stream44.studio/dco": "^0.3.0-rc.6",
90-
"@stream44.studio/t44-blockchaincommons.com": "^0.1.0-rc.6"
88+
"@stream44.studio/encapsulate": "^0.4.0-rc.8",
89+
"@stream44.studio/dco": "^0.3.0-rc.7",
90+
"@stream44.studio/t44-blockchaincommons.com": "^0.1.0-rc.9"
9191
},
9292
"devDependencies": {
9393
"@types/bun": "^1.3.4",

standalone-rt.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@
44

55
const startTime = Date.now()
66

7+
import { resolve, join } from 'path'
8+
import { access } from 'fs/promises'
79
import chalk from 'chalk'
810
import { CapsuleSpineFactory } from "@stream44.studio/encapsulate/spine-factories/CapsuleSpineFactory.v0"
911
import { CapsuleSpineContract } from "@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0/Membrane.v0"
1012
import { TimingObserver } from "@stream44.studio/encapsulate/spine-factories/TimingObserver"
1113

14+
async function findPackageRoot(startDir: string): Promise<string> {
15+
let dir = resolve(startDir)
16+
while (true) {
17+
try {
18+
await access(join(dir, 'package.json'))
19+
return dir
20+
} catch { }
21+
const parent = resolve(dir, '..')
22+
if (parent === dir) return resolve(startDir)
23+
dir = parent
24+
}
25+
}
26+
1227
export async function run(encapsulateHandler: any, runHandler: any, options?: { importMeta?: { dir: string } }) {
1328

1429
const timing = process.argv.includes('--trace') ? TimingObserver({ startTime }) : undefined
@@ -17,8 +32,12 @@ export async function run(encapsulateHandler: any, runHandler: any, options?: {
1732

1833
const eventsByKey = new Map<string, any>()
1934

35+
const spineFilesystemRoot = options?.importMeta?.dir
36+
? await findPackageRoot(options.importMeta.dir)
37+
: process.cwd()
38+
2039
const { encapsulate, freeze, CapsulePropertyTypes, makeImportStack, hoistSnapshot } = await CapsuleSpineFactory({
21-
spineFilesystemRoot: process.cwd(),
40+
spineFilesystemRoot,
2241
capsuleModuleProjectionRoot: (import.meta as any).dir,
2342
enableCallerStackInference: true,
2443
spineContracts: {

0 commit comments

Comments
 (0)