next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages

MIT License

Downloads
440.7K
Stars
1.2K
Committers
47

Bot releases are visible (Hide)

next-on-pages - @cloudflare/[email protected] Latest Release

Published by github-actions[bot] 28 days ago

Patch Changes

  • d1dce9e: Fix prerendered dynamic ISR functions with catch-all segments
  • e890632: Provide __NEXT_BUILD_ID env var to functions, making them compatible with Next v14.2.8 and newer.
next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 2 months ago

Patch Changes

  • 968171a: Fix autogenerated content also getting appended to the original public/_headers file

  • 2115b9e: fix: implement route specific global scoping strategy

    currently routes all share the same global scope, this can be problematic and cause
    race conditions and failures

    One example of this is the following code that is present in route function files:

    self.webpackChunk_N_E = ...
    

    and

    self.webpackChunk_N_E.push(...)
    

    this indicates that an in-memory global collection of the webpack chunks is shared by all routes,
    this combined with the fact that chunks can have their own module state this can easily cause routes to conflict with each other at runtime.

    So, in order to solve the above issue, all route functions are wrapped in a function which accepts as parameters, thus overrides, the self, globalThis and global symbols. The symbols
    will be resolved with proxies that redirect setters to route-scoped in-memory maps and
    getters to the above mentioned map's values and fallback to the original symbol values otherwise
    (i.e. globalThis will be overridden by a proxy that, when setting values, sets them in a separate
    location and, when getting values, gets them from said location if present there or from the real
    globalThis otherwise)

next-on-pages - [email protected]

Published by github-actions[bot] 2 months ago

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 3 months ago

Patch Changes

  • 8c04184: fix typescript declaration files not getting properly built
next-on-pages - [email protected]

Published by github-actions[bot] 3 months ago

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 3 months ago

Minor Changes

  • 4bd4c19: Use request.cf.regionCode for x-vercel-ip-country-region for keeping behavior consistent with documentation

  • 78accfd: Add support for custom worker entrypoints.

    Example:

    import nextOnPagesHandler from '@cloudflare/next-on-pages/fetch-handler';
    
    export default {
      async fetch(request, env, ctx) {
        // do something before running the next-on-pages handler
    
        const response = await nextOnPagesHandler.fetch(request, env, ctx);
    
        // do something after running the next-on-pages handler
    
        return response;
      },
    } as ExportedHandler<{ ASSETS: Fetcher }>;
    

Patch Changes

  • 2527917: Account for the Vercel CLI no longer generating prerender configs for dynamic ISR functions.
next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 3 months ago

Patch Changes

  • 9dd9fe4: make sure headers set in middlewares are accessibly by layouts and pages
  • 97d7981: Support for pre-rendered API functions.
next-on-pages - [email protected]

Published by github-actions[bot] 3 months ago

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 4 months ago

Minor Changes

  • c2b173c: Fix: The city name for the location of the requester's public IP address must be encoded according to RFC3986.
  • 2d55e8f: Optimized cache tags manifest loading; cache updates do not block responses
  • fa751e3: add support for the revalidate option in fetch

Patch Changes

  • d3caf91: Middleware move permanently fix
next-on-pages - [email protected]

Published by github-actions[bot] 4 months ago

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 5 months ago

Patch Changes

  • 317e872: Fix hanging promise caused by fetch patch symbol
next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 6 months ago

Patch Changes

  • 31c2627: update package.json to properly export the typescript types

    the current types are declared in the package.json via typesVersions
    such don't seem to get picked up correctly by all package managers, to for
    the types use the package.json exports field instead

  • 31c2627: fix the setupDevPlatform's options parameter not being optional

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 6 months ago

Patch Changes

  • f7bf30b: Ignore the invalid *.action.func folders introduced in next.js 14.2.2
  • 446e9af: exit with exit status 1 on build unexpected errors (when watch mode is disabled)
  • 5170477: Respect next basePath when configuring _next/static headers.
  • ad4ca02: Convert dynamic requires for cloudflare:* built-ins to import statements.
  • ad4ca02: Mark cloudflare:* as external for esbuild.
next-on-pages - [email protected]

Published by github-actions[bot] 6 months ago

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 7 months ago

Patch Changes

  • 555b4a7: fix trailingSlash set to true alongside i18n enabled causing incorrect 404s

  • 8da9da2: Make sure protocol relative URLs are not treated as actual relative URLs

  • 60eb0ae: fix issue in which redirect responses become rewrites when a middleware is involved

  • c3fb67b: make sure that the original request headers are not passed along when fetching external images

  • 9900517: fix process.env not giving access to bindings during local development (in next-dev)

  • 869cee0: Throw a user friendly error message when getRequestContext is called during prerendering

  • 53cb762: fix applications using Next.js v.14.2.0-canary.18 and up

    In v.14.2.0-canary.18 a simple upstream change in Next.js changes the code that
    next-on-pages receives, nullifying a find-and-replace regex that next-on-pages
    is currently relying on, update such regex so that it can handle the new code

next-on-pages - [email protected]

Published by github-actions[bot] 7 months ago

Minor Changes

  • 702f601: add new no-app-nodejs-dynamic-ssg rule

    add the new no-app-nodejs-dynamic-ssg rule that makes sure that
    developers using generateStaticParams also export either the runtime
    variable set to edge or the dynamicParams one set to false

  • 82aa1a4: add new no-pages-nodejs-dynamic-ssg rule

    add the new no-pages-nodejs-dynamic-ssg rule that makes sure that
    developers using getStaticPaths set the fallback property to false
    or opt in into the edge runtime

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 8 months ago

Minor Changes

  • 739e2a7: make (no-op) caches available in dev mode

    update setupDevPlatform to also add a caches object to the global scope
    so that it can be used during development in a production-like manner

    note: the implementation of caches is currently a no-op one

Patch Changes

  • 90e140c: Make the getRequestContext's error message more helpful during local development

    During local development add information in the getRequestContext's error
    message reminding the user to setup the dev platform via setupDevPlatform
    in their config file

  • 5187973: Make getRequestContext and getOptionalRequestContext throw if used inside the Node.js runtime

    Currently if users run getRequestContext or getOptionalRequestContext in the Node.js runtime
    they get a generic error saying that the request context could not be found, improve such behavior
    by having the functions throw instead, clearly informing the user that the problem is the wrong
    runtime being used

  • 9b1d951: Fix bundled wasm imports that are not located inside the function's directory.

  • b46977c: Fix the Next.js originalRequest bug for an unminified edge function generated by Vercel.

next-on-pages - [email protected]

Published by github-actions[bot] 8 months ago

next-on-pages - @cloudflare/[email protected]

Published by github-actions[bot] 8 months ago

Minor Changes

  • 5712c57: Add new getRequestContext utility

    Introduce a new getRequestContext utility that allows developer to get access not only
    to their Cloudflare env but also to their cf and ctx objects

    The utility can only be used in server-only code (meaning that it is incompatible with
    Pages-router components).

    Usage example:

    // app/api/hello/route.js
    
    import { getRequestContext } from '@cloudflare/next-on-pages';
    
    export const runtime = 'edge';
    
    export async function GET(request) {
      const {
        env,
        cf,
        ctx: { waitUntil },
      } = getRequestContext();
      // ...
    }
    
  • 06de52e: add new setupDevPlatform while deprecating setupDevBindings

    Previously developers would provide their bindings as inline options passed to
    the setupDevBindings function (see: https://github.com/cloudflare/next-on-pages/tree/main/internal-packages/next-dev#how-to-use-the-module)

    Such function has been deprecated and the new setupDevPlatform has been added instead as its replacement, the latter does not
    require users to use inline options but it reads and gathers the binding definitions from the user's wrangler.toml file instead,
    this is:

    • consistent with the newly introduced getBindingsProxy utility (which is actually being used here under the hood)
      (https://developers.cloudflare.com/workers/wrangler/api/#getbindingsproxy)
    • more convenient for users, since wrangler pages dev is also going to read the wrangler.toml file, making users
      only need to declare the bindings at most once for local development instead of twice
next-on-pages - [email protected]

Published by github-actions[bot] 8 months ago