vovk 2.0.0-beta.8 → 2.0.0-beta.9
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 +10 -3
- package/package.json +1 -1
package/cli/server.cjs
CHANGED
|
@@ -169,9 +169,16 @@ async function startVovkServer(env) {
|
|
|
169
169
|
for await (const info of fs.watch(srcRoot, { recursive: true })) {
|
|
170
170
|
if (info.filename) {
|
|
171
171
|
const filename = path.join(srcRoot, info.filename);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
try {
|
|
173
|
+
const stats = await fs.lstat(filename);
|
|
174
|
+
if (stats.isFile()) {
|
|
175
|
+
const fileContent = await fs.readFile(filename, 'utf-8');
|
|
176
|
+
const importRegex = /import\s*{[^}]*\b(get|post|put|del|head|options)\b[^}]*}\s*from\s*['"]vovk['"]/;
|
|
177
|
+
if (importRegex.test(fileContent)) void ping();
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.error(' 🐺 Error reading file:', error);
|
|
181
|
+
}
|
|
175
182
|
}
|
|
176
183
|
}
|
|
177
184
|
}
|