Support runtime platform config in RunFrame#3163
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79b92f2107
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| relativeConfigPath && | ||
| !this.ignoredFiles.includes(relativeConfigPath) | ||
| ) { | ||
| this.ignoredFiles.push(relativeConfigPath) |
There was a problem hiding this comment.
Use a file glob when excluding config module
When tscircuit.config.ts is at the project root, pushing the bare relative filename does not actually ignore the file: shouldIgnorePath/getPackageFilePaths pass config entries through normalizeIgnorePattern, which treats entries without glob characters as directories (**/<name>/**). As a result the config module is still included in the initial file upload and filesystem watcher, so configs containing tokens/imports are still exposed to the browser despite the new server-side runtime-config bridge. Use an explicit file glob or update the ignore normalization for this path.
Useful? React with 👍 / 👎.
Summary
This PR bridges runtime
platformConfiginto the CLI dev server flow sotscircuit.config.tscan be loaded on the server and its resolved platform config can be passed into RunFrame without asking the browser to execute the config module directly.What changed
DevServerbefore startupplatformConfigfromtscircuit.config.ts/jsand pass it into the dev HTTP serverprojectConfigis not provided directlyWhy
The current CLI dev flow can load
tscircuit.config.tslocally, but RunFrame still ends up trying to evaluate config-driven runtime imports in the browser. That breaks setups like@tscircuit/ti-parts-engine, where the desired behavior is:.envWithout this bridge, CLI dev either fails on config-module imports or cannot use function-valued platform config at runtime.
Root cause
tscircuit.config.tswas being treated as part of the synced browser file graph instead of as a server-resolved runtime input. That meant browser-side evaluation paths could try to import packages directly from the config module, which is the wrong execution environment for this feature.Validation
Passed locally:
bun test tests/test4-get-index-token.test.ts tests/lib/project-config.test.ts tests/lib/get-entrypoint-config-module.test.tsManual smoke validation:
tsci devagainst the TI example project locallyTSCIRCUIT_RUNTIME_PLATFORM_CONFIGtscircuit.config.tsScope notes