Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/middleware-telemetry
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/emitter
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/runtime-executor
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-pipeline-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
| try { | ||
| // Load the config module and any declared module-graph roots through Vite's SSR loader | ||
| // so they appear in the module graph before we crawl their dependencies. | ||
| for (const root of moduleGraphRoots) { | ||
| try { | ||
| await viteServer.ssrLoadModule(root); | ||
| } catch (error) { | ||
| if (root === absoluteConfigPath) { | ||
| throw error; | ||
| } | ||
| log(`Skipped module-graph root after load failure: ${root}`, 'debug'); | ||
| } | ||
| } |
There was a problem hiding this comment.
This is one of those areas where I would really like to use Effect or better-result to avoid having nested try blocks.
Signed-off-by: Alberto Schiabel <[email protected]>
…te-plugin-watch-behavior
c5e478d to
e50178e
Compare
6b128c6 to
9edc5ed
Compare
## Summary - finalize `contract.output` in the CLI loader for plain-object configs so the Vite plugin always receives resolved absolute paths - make the Vite plugin consume loader-resolved inputs and emitted artifact paths, update watched files as config/module-graph inputs change, and warn once when it must fall back to config-only watching - refresh plugin docs and align integration coverage with the default output behavior ## Testing - pnpm test -- test/plugin.test.ts - pnpm test -- test/config-loader.test.ts - pnpm test -- test/cli.emit-command.test.ts test/vite-plugin.hmr.e2e.test.ts - rg "resolve\(configDir" packages/1-framework/3-tooling/vite-plugin-contract-emit/src/ - rg "slice\(0, -5\)" packages/1-framework/3-tooling/vite-plugin-contract-emit/src/ ## Notes - Stacked on #356 - Replaces the older attempt in #357 - Refs TML-2277 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Contract configs now get a consistent default output path when omitted. * **Bug Fixes** * More precise validation for optional contract fields; clearer errors when modules lack expected exports. * **Improvements** * CLI always finalizes contract output and resolves input paths; Vite plugin watch/emission behavior improved with fallback warnings and fewer redundant emits. * **Tests** * Expanded and reorganized unit and integration tests to cover provider shapes, path resolution, watch fallback, and emit flows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: jkomyno <[email protected]>
Summary
addandunlinkevents, not onlychange.tsfacades withwatchStrategy: "moduleGraph"and cover the new behavior in plugin/facade testsWhy
The watch-input work from PR #356 closed the PSL/config gap, but two dev-loop cases were still stale:
add/unlinkevents on authoritative inputs never scheduled re-emitdefineConfig({ contract: "./contract.ts" })only watched the entry file, so helper imports could change without re-emittingThis PR closes those follow-up gaps so the Vite plugin reacts to authoritative file lifecycle events and follows TS contract module graphs rooted at declared watch inputs.
Verification
pnpm --filter @prisma-next/vite-plugin-contract-emit exec vitest run test/plugin.test.tspnpm --filter @prisma-next/integration-tests exec vitest run test/vite-plugin.hmr.e2e.test.tspnpm --filter @prisma-next/vite-plugin-contract-emit buildpnpm --filter @prisma-next/cli buildpnpm --filter @prisma-next/config buildpnpm --filter @prisma-next/sql-contract-psl buildpnpm --filter @prisma-next/sql-contract-ts buildpnpm --filter @prisma-next/postgres buildpnpm --filter @prisma-next/mongo-contract-psl buildpnpm --filter @prisma-next/mongo-contract-ts buildpnpm exec biome checkon the touched filesNotes
tml-2276-authoritative-watch-inputs).@prisma-next/postgrespackage-local Vitest and@prisma-next/mongopackage-local build/test scripts are still blocked in this checkout by the same pre-existing workspace resolution / missing localnode_modulesissues seen earlier, so I verified the facade change via buildable packages and direct runtime checks instead.