Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remix-run/cloudflare-pages

Package Overview
Dependencies
Maintainers
2
Versions
1020
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/cloudflare-pages - npm Package Compare versions

Comparing version 0.0.0-nightly-d1c93a1-20231102 to 0.0.0-nightly-d216bca0c-20241212

265

CHANGELOG.md
# `@remix-run/cloudflare-pages`
## 2.15.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.15.1`
## 2.15.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.15.0`
## 2.14.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.14.0`
## 2.13.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.13.1`
## 2.13.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.13.0`
## 2.12.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.12.1`
## 2.12.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.12.0`
## 2.11.2
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.11.2`
## 2.11.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.11.1`
## 2.11.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.11.0`
## 2.10.3
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.10.3`
## 2.10.2
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.10.2`
## 2.10.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.10.1`
## 2.10.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.10.0`
## 2.9.2
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.9.2`
## 2.9.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.9.1`
## 2.9.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.9.0`
## 2.8.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.8.1`
## 2.8.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.8.0`
## 2.7.2
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.7.2`
## 2.7.1
### Patch Changes
- Fix breaking change for `@remix-run/cloudflare-pages` ([#8819](https://github.com/remix-run/remix/pull/8819))
Restore Cloudflare event context fields in `getLoadContext` argument for backwards compatibility.
- Updated dependencies:
- `@remix-run/cloudflare@2.7.1`
## 2.7.0
### Minor Changes
- Make `getLoadContext` optional for Cloudflare Pages ([#8701](https://github.com/remix-run/remix/pull/8701))
Defaults to `(context) => ({ env: context })`, which is what we used to have in all the templates.
This gives parity with the Cloudflare preset for the Remix Vite plugin and keeps our templates leaner.
- Vite: Cloudflare Proxy as a Vite plugin ([#8749](https://github.com/remix-run/remix/pull/8749))
**This is a breaking change for projects relying on Cloudflare support from the unstable Vite plugin**
The Cloudflare preset (`unstable_cloudflarePreset`) as been removed and replaced with a new Vite plugin:
```diff
import {
unstable_vitePlugin as remix,
- unstable_cloudflarePreset as cloudflare,
+ cloudflareDevProxyVitePlugin as remixCloudflareDevProxy,
} from "@remix-run/dev";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
+ remixCloudflareDevProxy(),
+ remix(),
- remix({
- presets: [cloudflare()],
- }),
],
- ssr: {
- resolve: {
- externalConditions: ["workerd", "worker"],
- },
- },
});
```
`remixCloudflareDevProxy` must come _before_ the `remix` plugin so that it can override Vite's dev server middleware to be compatible with Cloudflare's proxied environment.
Because it is a Vite plugin, `remixCloudflareDevProxy` can set `ssr.resolve.externalConditions` to be `workerd`-compatible for you.
`remixCloudflareDevProxy` accepts a `getLoadContext` function that replaces the old `getRemixDevLoadContext`.
If you were using a `nightly` version that required `getBindingsProxy` or `getPlatformProxy`, that is no longer required.
Any options you were passing to `getBindingsProxy` or `getPlatformProxy` should now be passed to `remixCloudflareDevProxy` instead.
This API also better aligns with future plans to support Cloudflare with a framework-agnostic Vite plugin that makes use of Vite's (experimental) Runtime API.
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.7.0`
## 2.6.0
### Patch Changes
- Vite: Cloudflare Pages support ([#8531](https://github.com/remix-run/remix/pull/8531))
To get started with Cloudflare, you can use the \[`unstable-vite-cloudflare`]\[template-vite-cloudflare] template:
```shellscript nonumber
npx create-remix@latest --template remix-run/remix/templates/unstable-vite-cloudflare
```
Or read the new docs at [Future > Vite > Cloudflare](https://remix.run/docs/en/main/future/vite#cloudflare) and
[Future > Vite > Migrating > Migrating Cloudflare Functions](https://remix.run/docs/en/main/future/vite#migrating-cloudflare-functions).
- Updated dependencies:
- `@remix-run/cloudflare@2.6.0`
## 2.5.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.5.1`
## 2.5.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.5.0`
## 2.4.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.4.1`
## 2.4.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.4.0`
## 2.3.1
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.3.1`
## 2.3.0
### Patch Changes
- Updated dependencies:
- `@remix-run/cloudflare@2.3.0`
## 2.2.0

@@ -4,0 +269,0 @@

2

dist/esm/index.js
/**
* @remix-run/cloudflare-pages v0.0.0-nightly-d1c93a1-20231102
* @remix-run/cloudflare-pages v0.0.0-nightly-d216bca0c-20241212
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* @remix-run/cloudflare-pages v0.0.0-nightly-d1c93a1-20231102
* @remix-run/cloudflare-pages v0.0.0-nightly-d216bca0c-20241212
*

@@ -23,9 +23,32 @@ * Copyright (c) Remix Software Inc.

build,
getLoadContext,
mode
mode,
getLoadContext = ({
context
}) => ({
...context,
cloudflare: {
...context.cloudflare,
cf: context.cloudflare.request.cf
}
})
}) {
let handleRequest = createRequestHandler$1(build, mode);
return async context => {
let loadContext = await (getLoadContext === null || getLoadContext === void 0 ? void 0 : getLoadContext(context));
return handleRequest(context.request, loadContext);
return async cloudflare => {
let loadContext = await getLoadContext({
...cloudflare,
// Backcompat, remove in v3
request: cloudflare.request,
context: {
cloudflare: {
...cloudflare,
cf: cloudflare.request.cf,
ctx: {
waitUntil: cloudflare.waitUntil,
passThroughOnException: cloudflare.passThroughOnException
},
caches
}
}
});
return handleRequest(cloudflare.request, loadContext);
};

@@ -32,0 +55,0 @@ }

/**
* @remix-run/cloudflare-pages v0.0.0-nightly-d1c93a1-20231102
* @remix-run/cloudflare-pages v0.0.0-nightly-d216bca0c-20241212
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

@@ -1,3 +0,3 @@

/// <reference types="@cloudflare/workers-types" />
import type { AppLoadContext, ServerBuild } from "@remix-run/cloudflare";
import { type CacheStorage } from "@cloudflare/workers-types";
/**

@@ -10,10 +10,36 @@ * A function that returns the value to use as `context` in route `loader` and

*/
export type GetLoadContextFunction<Env = unknown> = (context: Parameters<PagesFunction<Env>>[0]) => Promise<AppLoadContext> | AppLoadContext;
export type GetLoadContextFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (args: {
/** @deprecated use `context.cloudflare.env` instead */
env: EventContext<Env, Params, Data>["env"];
/** @deprecated use `context.cloudflare.functionPath` instead */
functionPath: EventContext<Env, Params, Data>["functionPath"];
/** @deprecated use `context.cloudflare.waitUntil` instead */
waitUntil: EventContext<Env, Params, Data>["waitUntil"];
/** @deprecated use `context.cloudflare.passThroughOnException` instead */
passThroughOnException: EventContext<Env, Params, Data>["passThroughOnException"];
/** @deprecated use `context.cloudflare.next` instead */
next: EventContext<Env, Params, Data>["next"];
/** @deprecated use `context.cloudflare.params` instead */
params: EventContext<Env, Params, Data>["params"];
/** @deprecated use `context.cloudflare.data` instead */
data: EventContext<Env, Params, Data>["data"];
request: Request;
context: {
cloudflare: EventContext<Env, Params, Data> & {
cf: EventContext<Env, Params, Data>["request"]["cf"];
ctx: {
waitUntil: EventContext<Env, Params, Data>["waitUntil"];
passThroughOnException: EventContext<Env, Params, Data>["passThroughOnException"];
};
caches: CacheStorage;
};
};
}) => AppLoadContext | Promise<AppLoadContext>;
export type RequestHandler<Env = any> = PagesFunction<Env>;
export interface createPagesFunctionHandlerParams<Env = any> {
build: ServerBuild;
build: ServerBuild | (() => ServerBuild | Promise<ServerBuild>);
getLoadContext?: GetLoadContextFunction<Env>;
mode?: string;
}
export declare function createRequestHandler<Env = any>({ build, getLoadContext, mode, }: createPagesFunctionHandlerParams<Env>): RequestHandler<Env>;
export declare function createRequestHandler<Env = any>({ build, mode, getLoadContext, }: createPagesFunctionHandlerParams<Env>): RequestHandler<Env>;
export declare function createPagesFunctionHandler<Env = any>({ build, getLoadContext, mode, }: createPagesFunctionHandlerParams<Env>): (context: EventContext<Env, any, any>) => Promise<Response>;
/**
* @remix-run/cloudflare-pages v0.0.0-nightly-d1c93a1-20231102
* @remix-run/cloudflare-pages v0.0.0-nightly-d216bca0c-20241212
*

@@ -27,9 +27,32 @@ * Copyright (c) Remix Software Inc.

build,
getLoadContext,
mode
mode,
getLoadContext = ({
context
}) => ({
...context,
cloudflare: {
...context.cloudflare,
cf: context.cloudflare.request.cf
}
})
}) {
let handleRequest = cloudflare.createRequestHandler(build, mode);
return async context => {
let loadContext = await (getLoadContext === null || getLoadContext === void 0 ? void 0 : getLoadContext(context));
return handleRequest(context.request, loadContext);
return async cloudflare => {
let loadContext = await getLoadContext({
...cloudflare,
// Backcompat, remove in v3
request: cloudflare.request,
context: {
cloudflare: {
...cloudflare,
cf: cloudflare.request.cf,
ctx: {
waitUntil: cloudflare.waitUntil,
passThroughOnException: cloudflare.passThroughOnException
},
caches
}
}
});
return handleRequest(cloudflare.request, loadContext);
};

@@ -36,0 +59,0 @@ }

MIT License
Copyright (c) Remix Software Inc. 2020-2021
Copyright (c) Shopify Inc. 2022-2023
Copyright (c) Shopify Inc. 2022-2024

@@ -6,0 +6,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "@remix-run/cloudflare-pages",
"version": "0.0.0-nightly-d1c93a1-20231102",
"version": "0.0.0-nightly-d216bca0c-20241212",
"description": "Cloudflare Pages request handler for Remix",

@@ -18,3 +18,3 @@ "bugs": {

"dependencies": {
"@remix-run/cloudflare": "0.0.0-nightly-d1c93a1-20231102"
"@remix-run/cloudflare": "0.0.0-nightly-d216bca0c-20241212"
},

@@ -24,2 +24,3 @@ "devDependencies": {

"@types/mime": "^2.0.3",
"@types/node": "^18.17.1",
"typescript": "^5.1.0"

@@ -44,3 +45,6 @@ },

"README.md"
]
}
],
"scripts": {
"tsc": "tsc"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc