8000 Feat: Composable cache by conico974 · Pull Request #820 · opennextjs/opennextjs-aws · GitHub
[go: up one dir, main page]

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lucky-ghosts-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/aws": patch
---

pass revalidate for ISR/SSG cache
3 changes: 3 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
- name: Install Nextjs in app-pages-router
working-directory: examples/app-pages-router
run: pnpm add next@${{ needs.check_next_version.outputs.previousNextVersion }}
# We do not install the latest canary of Next in the experimental app.

- name: Get Playwright version
id: playwright-version
Expand Down Expand Up @@ -157,6 +158,8 @@ jobs:
echo "PAGES_ROUTER_URL=$PAGES_ROUTER_URL" >> $GITHUB_ENV
APP_PAGES_ROUTER_URL=$(jq -r '.["e2e-example-AppPagesRouter"].url' .sst/outputs.json)
echo "APP_PAGES_ROUTER_URL=$APP_PAGES_ROUTER_URL" >> $GITHUB_ENV
EXPERIMENTAL_APP_URL=$(jq -r '.["e2e-example-Experimental"].url' .sst/outputs.json)
echo "EXPERIMENTAL_APP_URL=$EXPERIMENTAL_APP_URL" >> $GITHUB_ENV

- name: Run e2e Test
run: npm run e2e:test
Expand Down
41 changes: 41 additions & 0 deletions examples/experimental/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
3 changes: 3 additions & 0 deletions examples/experimental/README.md
F438
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Experimental

This project is meant to test experimental features that are only available on canary builds of Next.js.
17 changes: 17 additions & 0 deletions examples/experimental/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
cleanDistDir: true,
output: "standalone",
eslint: {
ignoreDuringBuilds: true,
},
experimental: {
ppr: "incremental",
nodeMiddleware: true,
dynamicIO: true,
},
};

export default nextConfig;
14 changes: 14 additions & 0 deletions examples/experimental/open-next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const config = {
default: {
override: {
wrapper: "aws-lambda-streaming",
queue: "sqs-lite",
incrementalCache: "s3-lite",
tagCache: "dynamodb-lite",
},
},
functions: {},
buildCommand: "npx turbo build",
};

export default config;
24 changes: 24 additions & 0 deletions examples/experimental/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "experimental",
"version": "0.1.0",
"private": true,
"scripts": {
"openbuild": "node ../../packages/open-next/dist/index.js build",
"dev": "next dev --turbopack --port 3004",
"build": "next build",
"start": "next start --port 3004",
"lint": "next lint",
"clean": "rm -rf .turbo node_modules .next .open-next"
},
"dependencies": {
"next": "15.3.1-canary.13",
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"typescript": "catalog:"
}
}
6 changes: 6 additions & 0 deletions examples/experimental/src/app/api/revalidate/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { revalidateTag } from "next/cache";

export function GET() {
revalidateTag("fullyTagged");
return new Response("DONE");
}
Binary file added examples/experimental/src/app/favicon.ico
Binary file not shown.
42 changes: 42 additions & 0 deletions examples/experimental/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
:root {
--background: #ffffff;
--foreground: #171717;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}

html,
body {
max-width: 100vw;
overflow-x: hidden;
}

body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

* {
box-sizing: border-box;
padding: 0;
margin: 0;
}

a {
color: inherit;
text-decoration: none;
}

@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}
32 changes: 32 additions & 0 deletions examples/experimental/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});

const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable}`}>
{children}
</body>
</html>
);
}
165 changes: 165 additions & 0 deletions examples/experimental/src/app/page.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
.page {
--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;

display: grid;
grid-template-rows: 20px 1fr 20px;
align-items: center;
justify-items: center;
min-height: 100svh;
padding: 80px;
gap: 64px;
font-family: var(--font-geist-sans);
}

@media (prefers-color-scheme: dark) {
.page {
--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

.main {
display: flex;
flex-direction: column;
gap: 32px;
grid-row-start: 2;
}

.main ol {
font-family: var(--font-geist-mono);
padding-left: 0;
margin: 0;
font-size: 14px;
line-height: 24px;
letter-spacing: -0.01em;
list-style-position: inside;
}

.main li:not(:last-of-type) {
margin-bottom: 8px;
}

.main code {
font-family: inherit;
background: var(--gray-alpha-100);
padding: 2px 4px;
border-radius: 4px;
font-weight: 600;
}

.ctas {
display: flex;
gap: 16px;
}

.ctas a {
appearance: none;
border-radius: 128px;
height: 48px;
padding: 0 20px;
border: none;
border: 1px solid transparent;
transition: background 0.2s, color 0.2s, border-color 0.2s;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
line-height: 20px;
font-weight: 500;
}

a.primary {
background: var(--foreground);
color: var(--background);
gap: 8px;
}

a.secondary {
border-color: var(--gray-alpha-200);
min-width: 158px;
}

.footer {
grid-row-start: 3;
display: flex;
gap: 24px;
}

.footer a {
display: flex;
align-items: center;
gap: 8px;
}

.footer img {
flex-shrink: 0;
}

/* Enable hover only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
a.primary:hover {
background: var(--button-primary-hover);
border-color: transparent;
}

a.secondary:hover {
background: var(--button-secondary-hover);
border-color: transparent;
}

.footer a:hover {
text-decoration: underline;
text-underline-offset: 4px;
}
}

@media (max-width: 600px) {
.page {
padding: 32px;
padding-bottom: 80px;
}

.main {
align-items: center;
}

.main ol {
text-align: center;
}

.ctas {
flex-direction: column;
}

.ctas a {
font-size: 14px;
height: 40px;
padding: 0 16px;
}

a.secondary {
min-width: auto;
}

.footer {
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
}

@media (prefers-color-scheme: dark) {
.logo {
filter: invert();
}
}
14 changes: 14 additions & 0 deletions examples/experimental/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Link from "next/link";
import styles from "./page.module.css";

export default function Home() {
return (
<div className={styles.page}>
<main className={styles.main}>
<Link href="/ppr">
<h1 className={styles.title}>Incremental PPR</h1>
</Link>
</main>
</div>
);
}
Loading
0