@nuasite/cms 0.20.4 → 0.20.5
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/dist/editor.js +1 -1
- package/package.json +1 -1
- package/src/dev-middleware.ts +14 -0
package/dist/editor.js
CHANGED
|
@@ -381,7 +381,7 @@ function SS(t, e) {
|
|
|
381
381
|
function CS(t, e) {
|
|
382
382
|
return typeof e == "function" ? e(t) : e;
|
|
383
383
|
}
|
|
384
|
-
const V_ = "0.20.
|
|
384
|
+
const V_ = "0.20.5", H_ = V_, ct = {
|
|
385
385
|
/** Highlight overlay for hovered elements */
|
|
386
386
|
HIGHLIGHT: 2147483644,
|
|
387
387
|
/** Hover outline for elements/components */
|
package/package.json
CHANGED
package/src/dev-middleware.ts
CHANGED
|
@@ -44,6 +44,9 @@ interface ViteDevServerLike {
|
|
|
44
44
|
on: (event: string, listener: (...args: any[]) => void) => any
|
|
45
45
|
removeListener: (event: string, listener: (...args: any[]) => void) => any
|
|
46
46
|
}
|
|
47
|
+
environments?: Record<string, {
|
|
48
|
+
moduleGraph: { invalidateAll: () => void }
|
|
49
|
+
}>
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -112,6 +115,17 @@ export function createDevMiddleware(
|
|
|
112
115
|
const route = url.replace('/_nua/cms/', '').split('?')[0]!
|
|
113
116
|
|
|
114
117
|
handleCmsApiRoute(route, req, res, manifestWriter, config.contentDir, options.mediaAdapter)
|
|
118
|
+
.then(() => {
|
|
119
|
+
// Invalidate all Vite environment module caches after content-modifying
|
|
120
|
+
// routes so that a subsequent page reload serves fresh content.
|
|
121
|
+
// In sandboxed environments (e.g. E2B) chokidar doesn't detect file
|
|
122
|
+
// changes, leaving stale modules in Astro's SSR/prerender environments.
|
|
123
|
+
if (req.method === 'POST' && server.environments) {
|
|
124
|
+
for (const env of Object.values(server.environments)) {
|
|
125
|
+
env.moduleGraph.invalidateAll()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
115
129
|
.catch((error) => {
|
|
116
130
|
console.error('[astro-cms] API error:', error)
|
|
117
131
|
sendError(res, 'Internal server error', 500)
|