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

Add new helpers sub-module with getRequestExecutionContext #450

Closed
wants to merge 1 commit into from
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
14 changes: 14 additions & 0 deletions .changeset/happy-beds-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@cloudflare/next-on-pages': minor
---

Add new `helpers` sub-module with `getRequestExecutionContext`.

Add a new `helpers` module that will provide utilities that will allow developer to utilize better next-on-pages and the cloudflare platform.

The `getRequestExecutionContext` function has been introduced with helpers.
This function provides an execution context object (`ctx`) to the developer.

This function throws an error when executed on the client.
This function also returns a mocked context when executed in a non pages environment.
This is useful when executing unit tests, for example, as it prevents errors from occurring.
253 changes: 247 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/next-on-pages/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ declare global {
NODE_ENV?: string;
npm_config_user_agent?: string;
CF_PAGES?: string;
CF_NEXT_ON_PAGES_EXECUTION_CONTEXT?: ExecutionContext;
SHELL?: string;
[key: string]: string | Fetcher;
}
Expand Down
Loading
Loading