vovk 2.0.0-beta.5 → 2.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli/server.cjs +6 -2
  2. package/package.json +1 -1
package/cli/server.cjs CHANGED
@@ -156,8 +156,12 @@ async function startVovkServer(env) {
156
156
  // due to changes at Next.js 14.2.0 we get too many logs, therefore the interval should be changed to fs.watch
157
157
  // Old approach: setInterval(() => void ping(), 1000 * 3);
158
158
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
159
- for await (const _info of fs.watch(path.join(__dirname, '../../..', 'src'), { recursive: true })) {
160
- void ping();
159
+ for await (const info of fs.watch(path.join(__dirname, '../../..', 'src'), { recursive: true })) {
160
+ if (info.filename) {
161
+ const importRegex = /import\s*{[^}]*\b(get|post|put|del|head|options)\b[^}]*}\s*from\s*['"]vovk['"]/;
162
+ const fileContent = await fs.readFile(info.filename, 'utf-8');
163
+ if (importRegex.test(fileContent)) await ping(); // TODO: Debounce this
164
+ }
161
165
  }
162
166
  }
163
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "REST for Next - Transforms Next.js into a powerful and extensible REST API platform",
5
5
  "bin": "./cli/index.cjs",
6
6
  "scripts": {