Bincio design system: auth wall, login page, Grand Tours palette, PageEditor, _docs reorg
This commit is contained in:
+48
-1
@@ -4,6 +4,8 @@ import tailwind from '@astrojs/tailwind';
|
||||
import svelte from '@astrojs/svelte';
|
||||
import { remarkWikiRefs } from 'remark-wikirefs';
|
||||
import { remarkCaml } from 'remark-caml';
|
||||
import { unlinkSync } from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import {
|
||||
resolveHtmlHref,
|
||||
resolveHtmlText,
|
||||
@@ -27,8 +29,53 @@ const remarkPlugins = [
|
||||
const resolveEmbedContent = createResolveEmbedContent(remarkPlugins);
|
||||
remarkPlugins[1][1].resolveEmbedContent = resolveEmbedContent;
|
||||
|
||||
// Astro's glob loader doesn't trigger a full re-scan on unlink events, and
|
||||
// its persisted data-store.json survives server.restart() — so deleted entries
|
||||
// linger. Fix: on unlink, clear data-store.json then restart so Astro does a
|
||||
// full re-scan from scratch instead of loading the stale persisted store.
|
||||
// Vite reuses the same FSWatcher instance across restarts, so we keep a
|
||||
// module-level handler reference and remove it before re-adding to avoid
|
||||
// listener accumulation.
|
||||
let _unlinkHandler = null;
|
||||
function contentDeleteWatcher() {
|
||||
return {
|
||||
name: 'content-delete-watcher',
|
||||
hooks: {
|
||||
'astro:server:setup': ({ server }) => {
|
||||
const siteRoot = new URL('.', import.meta.url).pathname;
|
||||
const dataStore = fileURLToPath(new URL('.astro/data-store.json', import.meta.url));
|
||||
const watched = [
|
||||
siteRoot + 'src/content/entries/',
|
||||
siteRoot + 'src/content/blog/',
|
||||
];
|
||||
if (_unlinkHandler) server.watcher.off('unlink', _unlinkHandler);
|
||||
let restarting = false;
|
||||
_unlinkHandler = (filePath) => {
|
||||
if (restarting || !filePath.endsWith('.md')) return;
|
||||
if (watched.some(dir => filePath.startsWith(dir))) {
|
||||
restarting = true;
|
||||
try { unlinkSync(dataStore); } catch {}
|
||||
server.restart();
|
||||
}
|
||||
};
|
||||
server.watcher.on('unlink', _unlinkHandler);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
site: 'https://wiki.bincio.com',
|
||||
integrations: [sitemap(), tailwind(), svelte()],
|
||||
integrations: [sitemap(), tailwind(), svelte(), contentDeleteWatcher()],
|
||||
markdown: { remarkPlugins },
|
||||
vite: {
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': 'http://localhost:8001',
|
||||
'/pages': 'http://localhost:8001',
|
||||
'/stories': 'http://localhost:8001',
|
||||
'/rebuild': 'http://localhost:8001',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user