Skip to content
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

refactor(cloudflare): rename the "cloudflare" wrapper to "cloudflare-edge" #645

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Nov 25, 2024

The commit message do not mention "cloudflare-streaming" -> "cloudflare-node" as this was never released officially.

Copy link

changeset-bot bot commented Nov 25, 2024

🦋 Changeset detected

Latest commit: da97b15

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

pkg-pr-new bot commented Nov 25, 2024

Open in Stackblitz

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

commit: e7ed235

Copy link
Contributor

github-actions bot commented Nov 25, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 21.98% 1659 / 7545
🔵 Statements 21.98% 1659 / 7545
🔵 Functions 56.25% 99 / 176
🔵 Branches 70.28% 414 / 589
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/open-next/src/build/createMiddleware.ts 0% 0% 0% 0% 1-86
packages/open-next/src/build/helper.ts 0% 0% 0% 0% 1-376
packages/open-next/src/build/validateConfig.ts 0% 0% 0% 0% 1-116
packages/open-next/src/build/edge/createEdgeBundle.ts 0% 0% 0% 0% 1-241
packages/open-next/src/helpers/withCloudflare.ts 0% 100% 100% 0% 79-118
packages/open-next/src/plugins/resolve.ts 0% 0% 0% 0% 1-111
packages/open-next/src/types/open-next.ts 0% 0% 0% 0%
Generated in workflow #781 for commit e7ed235 by the Vitest Coverage Report Action

@vicb vicb requested a review from conico974 November 25, 2024 11:58
Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

I think we should change the Wrapper type so that it is clearer (and would allow for better validation). It could become

export type Wrapper<
  E extends BaseEventOrResult = InternalEvent,
  R extends BaseEventOrResult = InternalResult,
> = BaseOverride & {
  wrapper: WrapperHandler<E, R>;
  supportStreaming: boolean;
  supportExternalMiddleware?: boolean
  edgeLikeRuntime?: boolean;
};

edgeLikeRuntime would be used at build time to apply the necessary fix for cloudflare. It would also help distinguish this from Next edge runtime. This would be set for both cloudflare wrappers.
I don't like this name a lot, maybe you can find something better. Maybe something with Worker or WinterCG

supportExternalMiddleware would only be used for validation because external middleware need to be able to handle both InternalResult and MiddlewareOutputEvent. This one would be set to true for the aws-cloudfront wrapper as well.

All of this could be done in a different PR if you prefer.

packages/open-next/src/build/helper.ts Outdated Show resolved Hide resolved
@vicb
Copy link
Contributor Author

vicb commented Nov 25, 2024

All of this could be done in a different PR if you prefer.

Yes, I would prefer a different PR as I think we probably need to refactor the code.
See #646

@vicb vicb requested a review from conico974 November 25, 2024 13:47
Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

LGTM Thanks

@vicb
Copy link
Contributor Author

vicb commented Nov 25, 2024

Thanks for the review!

@vicb vicb merged commit 2202f36 into main Nov 25, 2024
3 checks passed
@vicb vicb deleted the edge-validation branch November 25, 2024 14:20
@github-actions github-actions bot mentioned this pull request Nov 25, 2024
vicb added a commit to opennextjs/opennextjs-cloudflare that referenced this pull request Nov 25, 2024
vicb added a commit to opennextjs/opennextjs-cloudflare that referenced this pull request Nov 25, 2024
vicb added a commit to opennextjs/opennextjs-cloudflare that referenced this pull request Nov 25, 2024
vicb added a commit to opennextjs/opennextjs-cloudflare that referenced this pull request Dec 20, 2024
vicb added a commit to opennextjs/opennextjs-cloudflare that referenced this pull request Dec 20, 2024
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