Skip to content

Commit

Permalink
Merge branch 'dev' into vite_additional_entries
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-ebey committed Feb 21, 2024
2 parents deac078 + 0eeea21 commit 2208cc7
Show file tree
Hide file tree
Showing 42 changed files with 337 additions and 84 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Expand Up @@ -146,6 +146,23 @@ Date: YYYY-MM-DD
-->

## 2.7.2

Date: 2024-02-21

### Patch Changes

- Vite: Fix error when building projects with `.css?url` imports ([#8829](https://github.com/remix-run/remix/pull/8829))

## 2.7.1

Date: 2024-02-20

### 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.

## v2.7.0

Date: 2024-02-20
Expand Down
1 change: 1 addition & 0 deletions contributors.yml
Expand Up @@ -74,6 +74,7 @@
- bmac
- bmarvinb
- bmontalvo
- bobziroll
- bogas04
- BogdanDevBst
- bolchowka
Expand Down
24 changes: 22 additions & 2 deletions docs/future/server-bundles.md
Expand Up @@ -40,13 +40,33 @@ Each `route` in the `branch` array contains the following properties:
- `file` — The absolute path to the entry point for this route.
- `index` — Whether or not this route is an index route.

## Server bundle manifest
## Build manifest

When the build is complete, Remix will generate a `bundles.json` manifest file in your server build directory containing an object with the following properties:
When the build is complete, Remix will call the Vite plugin's `buildEnd` hook passing a `buildManifest` object. This is useful if you need to inspect the build manifest to determine how to route requests to the correct server bundle.

```ts filename=vite.config.ts lines=[8-10]
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
remix({
// ...
buildEnd: async ({ buildManifest }) => {
// ...
},
}),
],
});
```

When using server bundles, the build manifest contains the following properties:

- `serverBundles` — An object that maps bundle IDs to the bundle's `id` and `file`.
- `routeIdToServerBundleId` — An object that maps route IDs to its server bundle ID.
- `routes` — A route manifest that maps route IDs to route metadata. This can be used to drive a custom routing layer in front of your Remix request handlers.

Alternatively, you can enable the `manifest` option on the Vite plugin to write this build manifest object to disk as `.remix/manifest.json` in your build directory.

[remix-vite]: ./vite
[pathless-layout-route]: ../file-conventions/routes#nested-layouts-without-nested-urls
2 changes: 1 addition & 1 deletion docs/guides/client-data.md
Expand Up @@ -14,7 +14,7 @@ These new exports are a bit of a sharp knife and are not recommended as your _pr
- **Client Cache:** Cache server loader data in the client and avoid some server calls
- **Migration:** Ease your migration from React Router -> Remix SPA -> Remix SSR (once Remix supports [SPA Mode][rfc-spa])

Please use these new exports with caution! If you're not careful - it's easy to get your UI out of sync. Remix out of the box tries _very_ hard to ensure that this doesn't happen - but once you take control over your own client-side cache, and potentially prevent Remix from performing it's normal server `fetch` calls - then Remix can no longer guarantee your UI remains in sync.
Please use these new exports with caution! If you're not careful - it's easy to get your UI out of sync. Remix out of the box tries _very_ hard to ensure that this doesn't happen - but once you take control over your own client-side cache, and potentially prevent Remix from performing its normal server `fetch` calls - then Remix can no longer guarantee your UI remains in sync.

## Skip the Hop

Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/vite-template/package.json
Expand Up @@ -23,7 +23,7 @@
"@types/react-dom": "^18.2.7",
"eslint": "^8.38.0",
"typescript": "^5.1.6",
"vite": "5.1.0",
"vite": "5.1.3",
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
Expand Down
13 changes: 11 additions & 2 deletions integration/helpers/vite.ts
Expand Up @@ -111,12 +111,21 @@ export async function createProject(files: Record<string, string> = {}) {
return projectDir;
}

export const viteBuild = ({ cwd }: { cwd: string }) => {
export const viteBuild = ({
cwd,
env = {},
}: {
cwd: string;
env?: Record<string, string>;
}) => {
let nodeBin = process.argv[0];

return spawnSync(nodeBin, [remixBin, "vite:build"], {
cwd,
env: { ...process.env },
env: {
...process.env,
...env,
},
});
};

Expand Down
10 changes: 9 additions & 1 deletion integration/vite-css-test.ts
Expand Up @@ -241,7 +241,15 @@ test.describe(() => {
contents.replace('"sideEffects": false', '"sideEffects": ["*.css.ts"]')
);

viteBuild({ cwd });
let { stderr, status } = viteBuild({
cwd,
env: {
// Vanilla Extract uses Vite's CJS build which emits a warning to stderr
VITE_CJS_IGNORE_WARNING: "true",
},
});
expect(stderr.toString()).toBeFalsy();
expect(status).toBe(0);
stop = await viteRemixServe({ cwd, port });
});
test.afterAll(() => stop());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -133,7 +133,7 @@
"unified": "^10.1.2",
"unist-util-remove": "^3.1.0",
"unist-util-visit": "^4.1.1",
"vite": "5.1.0",
"vite": "5.1.3",
"wait-on": "^7.0.1"
},
"engines": {
Expand Down
4 changes: 4 additions & 0 deletions packages/create-remix/CHANGELOG.md
@@ -1,5 +1,9 @@
# `create-remix`

## 2.7.2

## 2.7.1

## 2.7.0

## 2.6.0
Expand Down
2 changes: 1 addition & 1 deletion packages/create-remix/package.json
@@ -1,6 +1,6 @@
{
"name": "create-remix",
"version": "2.7.0",
"version": "2.7.2",
"description": "Create a new Remix app",
"homepage": "https://remix.run",
"bugs": {
Expand Down
14 changes: 14 additions & 0 deletions packages/remix-architect/CHANGELOG.md
@@ -1,5 +1,19 @@
# `@remix-run/architect`

## 2.7.2

### Patch Changes

- Updated dependencies:
- `@remix-run/node@2.7.2`

## 2.7.1

### Patch Changes

- Updated dependencies:
- `@remix-run/node@2.7.1`

## 2.7.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-architect/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-run/architect",
"version": "2.7.0",
"version": "2.7.2",
"description": "Architect server request handler for Remix",
"bugs": {
"url": "https://github.com/remix-run/remix/issues"
Expand All @@ -15,7 +15,7 @@
"typings": "dist/index.d.ts",
"dependencies": {
"@architect/functions": "^5.2.0",
"@remix-run/node": "2.7.0",
"@remix-run/node": "2.7.2",
"@types/aws-lambda": "^8.10.82"
},
"devDependencies": {
Expand Down
18 changes: 18 additions & 0 deletions packages/remix-cloudflare-pages/CHANGELOG.md
@@ -1,5 +1,23 @@
# `@remix-run/cloudflare-pages`

## 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
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-cloudflare-pages/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-run/cloudflare-pages",
"version": "2.7.0",
"version": "2.7.2",
"description": "Cloudflare Pages request handler for Remix",
"bugs": {
"url": "https://github.com/remix-run/remix/issues"
Expand All @@ -15,7 +15,7 @@
"typings": "dist/index.d.ts",
"module": "dist/esm/index.js",
"dependencies": {
"@remix-run/cloudflare": "2.7.0"
"@remix-run/cloudflare": "2.7.2"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20230518.0",
Expand Down
20 changes: 20 additions & 0 deletions packages/remix-cloudflare-pages/worker.ts
Expand Up @@ -14,6 +14,25 @@ export type GetLoadContextFunction<
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> & {
Expand Down Expand Up @@ -54,6 +73,7 @@ export function createRequestHandler<Env = any>({

return async (cloudflare) => {
let loadContext = await getLoadContext({
...cloudflare, // Backcompat, remove in v3
request: cloudflare.request,
context: {
cloudflare: {
Expand Down
14 changes: 14 additions & 0 deletions packages/remix-cloudflare-workers/CHANGELOG.md
@@ -1,5 +1,19 @@
# `@remix-run/cloudflare-workers`

## 2.7.2

### Patch Changes

- Updated dependencies:
- `@remix-run/cloudflare@2.7.2`

## 2.7.1

### Patch Changes

- Updated dependencies:
- `@remix-run/cloudflare@2.7.1`

## 2.7.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-cloudflare-workers/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-run/cloudflare-workers",
"version": "2.7.0",
"version": "2.7.2",
"description": "Cloudflare worker request handler for Remix",
"bugs": {
"url": "https://github.com/remix-run/remix/issues"
Expand All @@ -16,7 +16,7 @@
"module": "dist/esm/index.js",
"dependencies": {
"@cloudflare/kv-asset-handler": "^0.1.3",
"@remix-run/cloudflare": "2.7.0"
"@remix-run/cloudflare": "2.7.2"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20230518.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/remix-cloudflare/CHANGELOG.md
@@ -1,5 +1,19 @@
# `@remix-run/cloudflare`

## 2.7.2

### Patch Changes

- Updated dependencies:
- `@remix-run/server-runtime@2.7.2`

## 2.7.1

### Patch Changes

- Updated dependencies:
- `@remix-run/server-runtime@2.7.1`

## 2.7.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-cloudflare/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-run/cloudflare",
"version": "2.7.0",
"version": "2.7.2",
"description": "Cloudflare platform abstractions for Remix",
"bugs": {
"url": "https://github.com/remix-run/remix/issues"
Expand All @@ -15,7 +15,7 @@
"typings": "dist/index.d.ts",
"dependencies": {
"@cloudflare/kv-asset-handler": "^0.1.3",
"@remix-run/server-runtime": "2.7.0"
"@remix-run/server-runtime": "2.7.2"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20230518.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/remix-css-bundle/CHANGELOG.md
@@ -1,5 +1,9 @@
# @remix-run/css-bundle

## 2.7.2

## 2.7.1

## 2.7.0

## 2.6.0
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-css-bundle/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-run/css-bundle",
"version": "2.7.0",
"version": "2.7.2",
"description": "CSS bundle href when using CSS bundling features in Remix",
"homepage": "https://remix.run",
"bugs": {
Expand Down
14 changes: 14 additions & 0 deletions packages/remix-deno/CHANGELOG.md
@@ -1,5 +1,19 @@
# `@remix-run/deno`

## 2.7.2

### Patch Changes

- Updated dependencies:
- `@remix-run/server-runtime@2.7.2`

## 2.7.1

### Patch Changes

- Updated dependencies:
- `@remix-run/server-runtime@2.7.1`

## 2.7.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-deno/package.json
@@ -1,6 +1,6 @@
{
"name": "@remix-run/deno",
"version": "2.7.0",
"version": "2.7.2",
"description": "Deno platform abstractions for Remix",
"homepage": "https://remix.run",
"main": "./index.ts",
Expand All @@ -15,7 +15,7 @@
"license": "MIT",
"sideEffects": false,
"dependencies": {
"@remix-run/server-runtime": "2.7.0",
"@remix-run/server-runtime": "2.7.2",
"mime": "^3.0.0"
},
"peerDependencies": {
Expand Down

0 comments on commit 2208cc7

Please sign in to comment.