fix(invariants): join package checks at startup

This commit is contained in:
Tianyi Cui
2026-07-20 01:53:09 +08:00
parent 684fcf3357
commit e80fc3e61b
31 changed files with 596 additions and 314 deletions

View File

@@ -12,13 +12,10 @@ export const name = 'brand-invariant'
export const inject = ['invariants']
/** Assert that the nominal-type primitive remains erased at runtime. */
const install: InvariantInstaller = (ctx, fail) => {
ctx.effect(async () => {
const brandRuntime = await import('./index.ts')
assertInvariant(fail, Object.keys(brandRuntime).length === 0,
'the branded-id primitive must remain type-only with no runtime exports')
return () => {}
}, 'brand: validate type-only runtime erasure')
const install: InvariantInstaller = async (_ctx, fail) => {
const brandRuntime = await import('./index.ts')
assertInvariant(fail, Object.keys(brandRuntime).length === 0,
'the branded-id primitive must remain type-only with no runtime exports')
}
/**