vovk 2.0.0-beta.5 → 2.0.0-beta.7
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 +9 -2
- package/package.json +1 -1
package/cli/server.cjs
CHANGED
|
@@ -155,9 +155,16 @@ async function startVovkServer(env) {
|
|
|
155
155
|
|
|
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
|
+
|
|
159
|
+
const srcRoot = path.join(__dirname, '../../..', 'src');
|
|
158
160
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
159
|
-
for await (const
|
|
160
|
-
|
|
161
|
+
for await (const info of fs.watch(srcRoot, { recursive: true })) {
|
|
162
|
+
if (info.filename) {
|
|
163
|
+
const filename = path.join(srcRoot, info.filename);
|
|
164
|
+
const importRegex = /import\s*{[^}]*\b(get|post|put|del|head|options)\b[^}]*}\s*from\s*['"]vovk['"]/;
|
|
165
|
+
const fileContent = await fs.readFile(filename, 'utf-8');
|
|
166
|
+
if (importRegex.test(fileContent)) await ping(); // TODO: Debounce this
|
|
167
|
+
}
|
|
161
168
|
}
|
|
162
169
|
}
|
|
163
170
|
|