@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 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.4", H_ = V_, ct = {
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
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/astro-cms"
15
15
  },
16
16
  "license": "Apache-2.0",
17
- "version": "0.20.4",
17
+ "version": "0.20.5",
18
18
  "module": "src/index.ts",
19
19
  "types": "src/index.ts",
20
20
  "type": "module",
@@ -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)