Repository navigation
Conversation
The `require` conditions for `./typia` and `./deepkit` pointed at `dist/*.cjs`, but tsup emits `dist/*.js`, so requiring either subpath failed with MODULE_NOT_FOUND. Remove the `superglueTypia` export. It re-exported `@ttsc/unplugin` through a bare `require`, which is undefined in the ESM build, so it was always `null` there. Apps can import `@ttsc/unplugin` directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The typia plugin rewrote `useContent<T>()` to pass
`{ validate: typia.createValidate<T>() }`, but typia never expanded it.
Typia only transforms calls the checker resolves to its own
declarations, and the rewrite rebuilt the call and its ancestors after
type-checking, so the checker could not resolve the injected callee.
The emitted code referenced an undefined `typia` at runtime.
Two changes let typia resolve the injected call:
- Add a `SourcePreamble` that prepends
`import __superglueTypia from "typia"` to every file before parsing,
so the injected callee refers to a real, checked binding. Files
without hooks never reference it, so import elision drops it.
- Mutate each hook call in place instead of rebuilding it through a
visitor, so the injected nodes hang off the original, bound parse
tree. The injected callee borrows the hook identifier's source range
because typia reads the callee's text to label its errors.
The ttsc descriptor now raises a clear error when typia is not
installed, since the preamble would otherwise fail to type-check in
every file.
Add end-to-end specs that run the real ttsc CLI with typia hosting the
build, which the existing specs never exercised. ttsc needs the native
TypeScript 7 compiler, so add `@typescript/native-preview` (it ships
`tsgo`, avoiding a clash with TypeScript 5's `tsc`) and point ttsc at
it through `TTSC_TSGO_BINARY`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`useContent` and `useFragment` logged failed validation with
`console.error` and kept rendering. Under SSR, Humid forwards
`console.error` to the Rails logger but drops every argument after the
first, so the errors never appeared and nothing surfaced the failure.
Throw a `ContentValidationError` instead. It keeps the validator's
errors on `error.errors` and lists each one in the message, for both
the typia (`{ path, expected, value }`) and deepkit
(`{ path, message, value }`) shapes. Under SSR Humid raises it as a
`Humid::RenderError`. It only throws when a validator is present,
which the typia and deepkit plugins inject in builds that run them.
Export `ContentValidationError` so apps can match on it, and pass
deepkit's `value` through so its messages include the offending value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes typia integration which wasn't working because the transformation of
useContenttook place after the typecheck which end up skipped by typia. This uses a different strategy that takes inspiration from thepreambleplugin and thepathplugin to inline the change.