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.
- package/cli/server.cjs +6 -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
|
|
160
|
-
|
|
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
|
|