-
Notifications
You must be signed in to change notification settings - Fork 9
chore(api): Move runtime constant definitions from @commontools/api to @commontools/runner #2004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…o @commontools/runner Changed ID, ID_FIELD, TYPE, NAME, and UI from concrete exports to ambient declarations in @commontools/api, getting it closer to being a pure TypeScript interface package. The actual runtime values are now defined in @commontools/runner/src/builder/types.ts, where the runtime environment is created. Type compatibility is maintained by having the runner reference the API's declared types using typeof, ensuring both locations share the same TypeScript symbol types. Non-pattern code like tests or Lit components should import the types from @commontools/runner instead of @commontools/api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 4 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/api/index.ts">
<violation number="1" location="packages/api/index.ts:17">
Turning `UI` into an ambient declaration removes the runtime export. Callers such as packages/html/test/jsx.test.tsx still import `UI` as a value and will now throw at module load because `@commontools/api` no longer provides that export. Please keep exporting the concrete value (or ensure all runtime imports move to the new location first).</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed changes from recent commits (found 1 issue).
1 issue found across 4 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/api/index.ts">
<violation number="1" location="packages/api/index.ts:976">
`toSchema` is still imported as a runtime helper elsewhere, but this change makes @commontools/api stop exporting any concrete value. That import will now fail at module load time because the symbol no longer exists.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 11 files
Changed ID, ID_FIELD, TYPE, NAME, and UI from concrete exports to ambient declarations in @commontools/api, getting it closer to being a pure TypeScript interface package. The actual runtime values are now defined in @commontools/runner/src/builder/types.ts, where the runtime environment is created. Type compatibility is maintained by having the runner reference the API's declared types using typeof, ensuring both locations share the same TypeScript symbol types.
Non-pattern code like tests or Lit components should import the types from @commontools/runner instead of @commontools/api
Summary by cubic
Moved runtime constants and helpers from @commontools/api to runtime packages: constants and schema/toSchema now live in @commontools/runner, and the JSX h function moved to @commontools/html. @commontools/api is now type-only with ambient declarations.
Refactors
Migration
Written for commit 10e9c1e. Summary will update automatically on new commits.