Currently, file watcher asynchronously retrieves documents and schemas on each project file changes, which is slow, and caused unreasonably high resources usage.
Changes made
resolve all configured documents and schemas only once on server startup and simply check file path matching in watcher.
fix cases when schema path defined with dot like ./src/schema.graphql by resolve absolute schema paths.
fix cases when documents defined with glob pattern like ./src/**/*.graphql, and modifying src/path/api.graphql.generated.ts file caused false positive check and trigger watcher for that file.
reduce amount of log records, as currently it contains a lot of records which is not related to plugin: modifying any file in project produces ~5 log entries. Below are screenshots of the same number of interactions with project files demonstrating this.
Currently, file watcher asynchronously retrieves documents and schemas on each project file changes, which is slow, and caused unreasonably high resources usage.
Changes made
./src/schema.graphql
by resolve absolute schema paths../src/**/*.graphql
, and modifyingsrc/path/api.graphql.generated.ts
file caused false positive check and trigger watcher for that file.Also, this PR should resolve OOM issues reported in https://github.com/danielwaltz/vite-plugin-graphql-codegen/issues/27
Side changes
Before
After