Teach the Vite plugin to watch authoritative inputs and avoid self-trigger loops#357
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 <jkomyno@users.noreply.github.com>
…te-plugin-watch-behavior
c5e478d to
e50178e
Compare
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.