Skip to content

Feat: Composable cache #820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

conico974
Copy link
Contributor

@conico974 conico974 commented Apr 9, 2025

Add basic support for Composable cache.
This PR wil introduce breaking change to the incremental cache and tag cache typings.

Depends on #833

Copy link

changeset-bot bot commented Apr 9, 2025

⚠️ No Changeset found

Latest commit: ae2d5d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

pkg-pr-new bot commented Apr 9, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@820

commit: b355d74

@conico974 conico974 force-pushed the feat/composable-cache branch from 00f043d to b355d74 Compare April 16, 2025 12:57
@conico974 conico974 changed the base branch from main to feat/compute-revalidate-cache April 16, 2025 12:58
@conico974 conico974 force-pushed the feat/compute-revalidate-cache branch from d453e0c to 48c5da6 Compare April 18, 2025 11:43
@conico974 conico974 force-pushed the feat/composable-cache branch from b355d74 to beac4cf Compare April 18, 2025 13:09
@conico974 conico974 marked this pull request as ready for review April 23, 2025 08:27
@conico974 conico974 requested a review from vicb April 28, 2025 14:25
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Could you please add a changeset mentioning the breaking changes

cacheKey,
"composable",
);
if (!result || !result.value?.value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!result || !result.value?.value) {
if (!result?.value?.value) {

@@ -15,19 +15,49 @@ export function compileCache(
) {
const { config } = options;
const ext = format === "cjs" ? "cjs" : "mjs";
const outFile = path.join(options.buildDir, `cache.${ext}`);
const compiledCacheFile = path.join(options.buildDir, `cache.${ext}`);
const compiledComposableCacheFile = path.join(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits:

  • update the function comments line 6
  • move const compiledComposableCacheFile to l 52

versions: ">=15.3.0",
field: {
pathFilter: getCrossPlatformPathRegex(
String.raw`(server/chunks/.*\.js|.*\.runtime\..*\.js|use-cache/use-cache-wrapper\.js)$`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: leading .* should not be needed

Suggested change
String.raw`(server/chunks/.*\.js|.*\.runtime\..*\.js|use-cache/use-cache-wrapper\.js)$`,
String.raw`(server/chunks/.*\.js|\.runtime\..*\.js|use-cache/use-cache-wrapper\.js)$`,

@conico974 conico974 force-pushed the feat/compute-revalidate-cache branch from 48c5da6 to ade16e1 Compare April 29, 2025 08:30
@conico974 conico974 deleted the branch opennextjs:feat/compute-revalidate-cache April 29, 2025 08:38
@conico974 conico974 closed this Apr 29, 2025
@conico974
Copy link
Contributor Author

Oops i created this branch on my fork, i'll need to recreate a new PR.
I'll include all requested changes and merge

@conico974 conico974 mentioned this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants