Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
31 lines
1.7 KiB
JavaScript
31 lines
1.7 KiB
JavaScript
/**
|
|
* This file provides some helpers that should be used in conjunction with
|
|
* explicit environment checks. When combined with the environment checks, it
|
|
* will ensure that the correct typings are used as well as enable code
|
|
* elimination.
|
|
*/ /**
|
|
* Type guard to determine if a request is a WebNextRequest. This does not
|
|
* actually check the type of the request, but rather the runtime environment.
|
|
* It's expected that when the runtime environment is the edge runtime, that any
|
|
* base request is a WebNextRequest.
|
|
*/ export const isWebNextRequest = (req)=>process.env.NEXT_RUNTIME === 'edge';
|
|
/**
|
|
* Type guard to determine if a response is a WebNextResponse. This does not
|
|
* actually check the type of the response, but rather the runtime environment.
|
|
* It's expected that when the runtime environment is the edge runtime, that any
|
|
* base response is a WebNextResponse.
|
|
*/ export const isWebNextResponse = (res)=>process.env.NEXT_RUNTIME === 'edge';
|
|
/**
|
|
* Type guard to determine if a request is a NodeNextRequest. This does not
|
|
* actually check the type of the request, but rather the runtime environment.
|
|
* It's expected that when the runtime environment is the node runtime, that any
|
|
* base request is a NodeNextRequest.
|
|
*/ export const isNodeNextRequest = (req)=>process.env.NEXT_RUNTIME !== 'edge';
|
|
/**
|
|
* Type guard to determine if a response is a NodeNextResponse. This does not
|
|
* actually check the type of the response, but rather the runtime environment.
|
|
* It's expected that when the runtime environment is the node runtime, that any
|
|
* base response is a NodeNextResponse.
|
|
*/ export const isNodeNextResponse = (res)=>process.env.NEXT_RUNTIME !== 'edge';
|
|
|
|
//# sourceMappingURL=helpers.js.map
|