@decocms/blocks-cli 7.71.0 → 7.71.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/blocks-cli",
3
- "version": "7.71.0",
3
+ "version": "7.71.2",
4
4
  "type": "module",
5
5
  "description": "Deco codegen (generate-blocks, generate-schema, generate-invoke) and Fresh-to-TanStack migration tooling",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "lint:unused": "knip"
34
34
  },
35
35
  "dependencies": {
36
- "@decocms/blocks": "7.71.0",
36
+ "@decocms/blocks": "7.71.2",
37
37
  "ts-morph": "^27.0.0",
38
38
  "tsx": "^4.22.5"
39
39
  },
@@ -98,14 +98,10 @@ const decoWorker = createDecoWorkerEntry(serverEntry, {
98
98
  handleRender,
99
99
  corsHeaders,
100
100
  },
101
- // Region splits the cache so a RJ-cached response isn't served to SP visitors
102
- // when pages use the website/matchers/location.ts matcher. Without this, the
103
- // first geo-resolved response leaks across regions.
104
- buildSegment: (request) => {
105
- const cf = (request as unknown as { cf?: { regionCode?: string } }).cf;
106
- const regionCode = request.headers.get("cf-region-code") ?? cf?.regionCode ?? "";
107
- return regionCode ? { regionId: regionCode } : {};
108
- },
101
+ // No geo in buildSegment: createDecoWorkerEntry's geoCacheKey: "auto" already
102
+ // backfills the region into the segment — but only when the decofile has a
103
+ // website/matchers/location.ts block. Setting it here unconditionally split
104
+ // every page's cache per state (~27 copies per URL in Brazil) for nothing.
109
105
  });
110
106
 
111
107
  export default instrumentWorker(decoWorker, {
@@ -174,16 +170,15 @@ const decoWorker = createDecoWorkerEntry(serverEntry, {
174
170
  csp: CSP_DIRECTIVES,
175
171
  buildSegment: (request) => {
176
172
  const vtx = extractVtexContext(request);
177
- const cf = (request as unknown as { cf?: { regionCode?: string } }).cf;
178
- const geoRegion = request.headers.get("cf-region-code") ?? cf?.regionCode ?? "";
179
173
  return {
180
174
  device: MOBILE_RE.test(request.headers.get("user-agent") ?? "") ? "mobile" : "desktop",
181
175
  loggedIn: vtx.isLoggedIn,
182
176
  salesChannel: vtx.salesChannel,
183
- // Prefer VTEX regionalization regionId when present; otherwise fall back
184
- // to Cloudflare geo so the website/matchers/location.ts matcher gets a
185
- // properly segmented cache.
186
- regionId: (vtx as any).regionId ?? (geoRegion || undefined),
177
+ // VTEX regionalization only. Don't fall back to Cloudflare geo here:
178
+ // geoCacheKey: "auto" adds the region only when a
179
+ // website/matchers/location.ts block exists; doing it unconditionally
180
+ // splits every page's cache per state.
181
+ regionId: (vtx as any).regionId,
187
182
  };
188
183
  },
189
184
  admin: {
@@ -298,4 +298,6 @@ function main() {
298
298
  );
299
299
  }
300
300
 
301
- if (process.argv[1] && /reconcile\.ts$/.test(process.argv[1])) main();
301
+ // realpath: under npx/bunx argv[1] is the `.bin/deco-reconcile` symlink, which
302
+ // the regex alone never matched — the CLI exited 0 without running (#515).
303
+ if (process.argv[1] && /reconcile\.ts$/.test(fs.realpathSync(process.argv[1]))) main();