vovk 2.0.0-beta.13 → 2.0.0-beta.15
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 -3
- package/package.json +1 -1
package/cli/server.cjs
CHANGED
|
@@ -164,17 +164,23 @@ async function startVovkServer({ VOVK_PORT, VOVK_WATCH_DIR }) {
|
|
|
164
164
|
// Old approach: setInterval(() => void ping(), 1000 * 3);
|
|
165
165
|
|
|
166
166
|
// initial ping
|
|
167
|
-
ping
|
|
167
|
+
setTimeout(ping, 3000);
|
|
168
168
|
const srcRoot = path.join(__dirname, '../../..', VOVK_WATCH_DIR ?? './src');
|
|
169
169
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
170
170
|
for await (const info of fs.watch(srcRoot, { recursive: true })) {
|
|
171
|
-
if (
|
|
171
|
+
if (
|
|
172
|
+
info.filename &&
|
|
173
|
+
(info.filename.endsWith('.ts') ||
|
|
174
|
+
info.filename.endsWith('.tsx') ||
|
|
175
|
+
info.filename.endsWith('.js') ||
|
|
176
|
+
info.filename.endsWith('.jsx'))
|
|
177
|
+
) {
|
|
172
178
|
const filename = path.join(srcRoot, info.filename);
|
|
173
179
|
try {
|
|
174
180
|
const stats = await fs.lstat(filename);
|
|
175
181
|
if (stats.isFile()) {
|
|
176
182
|
const fileContent = await fs.readFile(filename, 'utf-8');
|
|
177
|
-
const importRegex = /import\s*{[^}]*\b(get|post|put|del|head|options)\b[^}]*}\s*from\s*['"]vovk['"]/;
|
|
183
|
+
const importRegex = /import\s*{[^}]*\b(initVovk|get|post|put|del|head|options)\b[^}]*}\s*from\s*['"]vovk['"]/;
|
|
178
184
|
if (importRegex.test(fileContent)) ping();
|
|
179
185
|
}
|
|
180
186
|
} catch {
|