Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions examples/TscircuitWorkspaceWithRunframe.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RunFrame } from "@tscircuit/runframe/runner"
import { useMemo, useState } from "react"
import "../src/styles.css"
import type { EditorFile } from "../src"
import { resolveTscircuitEntrypoint } from "../fixtures-support/resolveTscircuitEntrypoint"
import { SuspenseRunFrame } from "../src/components/SuspenseRunFrame"
import { WorkspaceCodeEditor } from "../src/components/WorkspaceCodeEditor"
import { useWorkspaceFiles } from "../src/hooks/useWorkspaceFiles"

Expand Down Expand Up @@ -135,16 +135,18 @@ export default function TscircuitWorkspaceWithRunframeFixture() {
<WorkspaceCodeEditor {...workspace} />
</div>
<div className="min-h-0 flex flex-1 flex-col">
<SuspenseRunFrame
className="h-full flex-1"
fsMap={fsMap}
mainComponentPath={mainComponentPath}
showFileMenu={false}
showRunButton
forceLatestEvalVersion
onRenderStarted={() => setLastRenderState("running")}
onRenderFinished={() => setLastRenderState("finished")}
/>
<div className="h-full flex-1">
<RunFrame
key={mainComponentPath}
fsMap={fsMap}
mainComponentPath={mainComponentPath}
showFileMenu={false}
showRunButton
forceLatestEvalVersion
onRenderStarted={() => setLastRenderState("running")}
onRenderFinished={() => setLastRenderState("finished")}
/>
</div>
</div>
</div>
</div>
Expand Down
16 changes: 1 addition & 15 deletions fixtures-support/resolveTscircuitEntrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ import type { EditorFile } from "../src"
// Cosmos runframe example runs the selected runnable file instead of always
// falling back to index.tsx. This stays outside src/ because it is not part of
// the public editor/workspace library API.
export const hasDefaultEntrypointExport = (code: string) => {
return (
/export default\s+\w+/.test(code) ||
/export default\s+function\s*(\w*)\s*\(/.test(code) ||
/export default\s*\(\s*\)\s*=>/.test(code) ||
/export default\s*\(.*?\)\s*=>/.test(code) ||
/export\s*\{\s*\w+\s+as\s+default\s*\}/.test(code)
)
}

const findConfiguredEntrypoint = (
files: EditorFile[],
field: "mainEntrypoint" | "previewComponentPath",
Expand Down Expand Up @@ -44,11 +34,7 @@ export const resolveTscircuitEntrypoint = (
? files.find((file) => file.path === currentFile)
: null

if (
currentFileData &&
/\.(ts|tsx)$/.test(currentFileData.path) &&
hasDefaultEntrypointExport(currentFileData.content)
) {
if (currentFileData && /\.(ts|tsx)$/.test(currentFileData.path)) {
return currentFileData.path
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"build": "bun run build:lib",
"build:lib": "tsc --noEmit && tsup src/index.ts --format esm --dts --external react,react-dom,@monaco-editor/react,monaco-editor,@typescript/ata,typescript,@tscircuit/runframe",
"build:lib": "tsc --noEmit && tsup src/index.ts --format esm --dts --external react,react-dom,@monaco-editor/react,monaco-editor,@typescript/ata,typescript",
"dev": "cosmos",
"cosmos": "cosmos",
"cosmos:export": "cosmos-export",
Expand Down
16 changes: 0 additions & 16 deletions src/components/SuspenseRunFrame.tsx

This file was deleted.

Loading