esa-pcg-cli 0.1.23-beta.4 → 0.1.23-beta.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.
@@ -60,9 +60,11 @@ function normalizeIsr(rules) {
60
60
  function replaceIpxHandler(options) {
61
61
  const ipx = options.runtimeConfig?.ipx;
62
62
  if (!ipx || options.dev || options.static || options.preset === 'nitro-prerender') return;
63
- const route = `${(ipx.baseURL || '/_ipx').replace(/\/+$/, '')}/**`;
63
+ const prefix = `${(ipx.baseURL || '/_ipx').replace(/\/+$/, '')}/`;
64
+ const route = `${prefix}**`;
65
+ // Nuxt Image can register its handler before Nitro resolves the file extension.
64
66
  const handler = options.handlers?.find(item => item.route === route &&
65
- /[/\\]@nuxt[/\\]image[/\\].*[/\\](?:ipx|_ipx(?:\.legacy)?)\.(?:[cm]?[jt]s)$/.test(item.handler));
67
+ /[/\\]@nuxt[/\\]image[/\\].*[/\\](?:ipx|_ipx(?:\.legacy)?)(?:\.[cm]?[jt]s)?$/.test(item.handler));
66
68
  if (!handler) return;
67
69
  // Replace only the runtime list entry. Nuxt Image also gives a copy of the
68
70
  // original handler to the build-time prerenderer.
@@ -70,7 +72,11 @@ function replaceIpxHandler(options) {
70
72
  item === handler ? { ...item, handler: IMAGE_HANDLER } : item
71
73
  );
72
74
  options.routeRules ||= {};
73
- options.routeRules[route] = { ...options.routeRules[route], cache: false };
75
+ options.routeRules[route] ||= {};
76
+ // More specific cache rules override the wildcard and cannot persist image streams.
77
+ for (const [pathname, rule] of Object.entries(options.routeRules)) {
78
+ if (pathname.startsWith(prefix)) rule.cache = false;
79
+ }
74
80
  }
75
81
 
76
82
  const esaPreset = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esa-pcg-cli",
3
- "version": "0.1.23-beta.4",
3
+ "version": "0.1.23-beta.5",
4
4
  "description": "CLI for building and deploying Next.js, Astro and Nuxt apps onto pages-cache-gateway (PCG)",
5
5
  "keywords": [
6
6
  "next",