[PR #592] [MERGED] fix: scope getStaticProps revalidate parsing to the exported function #691

Closed
opened 2026-05-06 13:09:35 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/592
Author: @Boyeep
Created: 3/19/2026
Status: Merged
Merged: 3/20/2026
Merged by: @james-elicx

Base: mainHead: fix/scope-getstaticprops-revalidate


📝 Commits (8)

  • e6b1264 fix: scope getStaticProps revalidate parsing
  • 5a1f4c8 fix: handle early returns in getStaticProps revalidate parsing
  • 8e6136f fix: scope getStaticProps parsing to its declaration
  • 98598e2 fix: handle destructured getStaticProps params
  • 1a86e86 fix: ignore nested helper returns in getStaticProps
  • 8942db5 fix: avoid re-export false positives in getStaticProps parsing
  • 4280a13 fix: harden getStaticProps revalidate parsing
  • f3d2a60 chore: polish getStaticProps parser follow-up

📊 Changes

2 files changed (+636 additions, -7 deletions)

View changed files

📝 packages/vinext/src/build/report.ts (+491 -7)
📝 tests/build-report.test.ts (+145 -0)

📄 Description

  1. Summary

This fixes a false positive in extractGetStaticPropsRevalidate().

Previously, the helper could match revalidate: anywhere in the file, including unrelated config objects outside getStaticProps. That could misclassify Pages Router routes in the build report.

This change scopes the search to the exported getStaticProps return object when that function is present.

  1. Changes
  • scope extractGetStaticPropsRevalidate() to getStaticProps
  • add regression coverage for unrelated revalidate values outside getStaticProps
  • add regression coverage showing the getStaticProps value still wins when both are present
  1. Validation
  • pnpm exec vp test run tests/build-report.test.ts
  • pnpm exec vp fmt packages/vinext/src/build/report.ts tests/build-report.test.ts
  • pnpm exec vp lint packages/vinext/src/build/report.ts tests/build-report.test.ts

#Notes

pnpm exec vp check reports existing repo-wide formatting issues in this checkout, so validation here was kept targeted to the changed files.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/592 **Author:** [@Boyeep](https://github.com/Boyeep) **Created:** 3/19/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/scope-getstaticprops-revalidate` --- ### 📝 Commits (8) - [`e6b1264`](https://github.com/cloudflare/vinext/commit/e6b1264ea2d2df31d006bb7f425b1c69941de36e) fix: scope getStaticProps revalidate parsing - [`5a1f4c8`](https://github.com/cloudflare/vinext/commit/5a1f4c87f09c20869fef746c99dace6e3ca631ac) fix: handle early returns in getStaticProps revalidate parsing - [`8e6136f`](https://github.com/cloudflare/vinext/commit/8e6136fde80b4906ed82cdde158b13fcda278eee) fix: scope getStaticProps parsing to its declaration - [`98598e2`](https://github.com/cloudflare/vinext/commit/98598e2ab9f3039158a0d4d80f98e10a73dc275a) fix: handle destructured getStaticProps params - [`1a86e86`](https://github.com/cloudflare/vinext/commit/1a86e860d36e65e30594c02b482413a2bbc1b80a) fix: ignore nested helper returns in getStaticProps - [`8942db5`](https://github.com/cloudflare/vinext/commit/8942db5cc745229d0fdb5e704db00135a2e1823f) fix: avoid re-export false positives in getStaticProps parsing - [`4280a13`](https://github.com/cloudflare/vinext/commit/4280a136fed97c49378a7c9d80ccdf19b90e8ff3) fix: harden getStaticProps revalidate parsing - [`f3d2a60`](https://github.com/cloudflare/vinext/commit/f3d2a6081882aa97afc711fdbe54ecc7bb718c7d) chore: polish getStaticProps parser follow-up ### 📊 Changes **2 files changed** (+636 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/build/report.ts` (+491 -7) 📝 `tests/build-report.test.ts` (+145 -0) </details> ### 📄 Description 1. Summary This fixes a false positive in `extractGetStaticPropsRevalidate()`. Previously, the helper could match `revalidate:` anywhere in the file, including unrelated config objects outside `getStaticProps`. That could misclassify Pages Router routes in the build report. This change scopes the search to the exported `getStaticProps` return object when that function is present. 2. Changes - scope `extractGetStaticPropsRevalidate()` to `getStaticProps` - add regression coverage for unrelated `revalidate` values outside `getStaticProps` - add regression coverage showing the `getStaticProps` value still wins when both are present 3. Validation - `pnpm exec vp test run tests/build-report.test.ts` - `pnpm exec vp fmt packages/vinext/src/build/report.ts tests/build-report.test.ts` - `pnpm exec vp lint packages/vinext/src/build/report.ts tests/build-report.test.ts` #Notes `pnpm exec vp check` reports existing repo-wide formatting issues in this checkout, so validation here was kept targeted to the changed files. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:35 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#691
No description provided.