Skip to content

Commit

Permalink
Merge branch 'dev' into pedro/tux
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori authored Jun 14, 2023
2 parents 2f7a6d3 + 0ab3e9a commit 43af086
Show file tree
Hide file tree
Showing 22 changed files with 133 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-shoes-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Rename `Architect (AWS Lambda)` -> `Architect` in the `create-remix` CLI to avoid confusion for other methods of deploying to AWS (i.e., SST)
5 changes: 5 additions & 0 deletions .changeset/fix-react-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/server-runtime": patch
---

Fix typing issues when using React 17 stemming from `@remix/server-runtime` including `@types/react` as a `devDependency` when it doesn't actually do anything React-specific and was just re-exporting `ComponentType` in values such as `CatchBoundaryComponent`/`ErrorBoundaryComponent`/`V2_ErrorBoundaryComponent`. These types are more correctly exported from `@remix-run/react` which is React-aware so that is the correct place to be importing those types from. In order to avoid breaking existing builds, the types in `@remix/server-runtime` have been loosened to `any` and `@deprecated` warnings have been added informing users to switch to the corresponding types in `@remix-run/react`.
5 changes: 5 additions & 0 deletions .changeset/types-cookie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/server-runtime": patch
---

Move `@types/cookie` to `dependencies` since we re-export types from there
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
- freeman
- frontsideair
- furkanakkurt1335
- fwang
- fx109138
- gabimor
- garand
Expand Down
7 changes: 7 additions & 0 deletions integration/bug-report-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ let appFixture: AppFixture;
// ```
////////////////////////////////////////////////////////////////////////////////

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
7 changes: 7 additions & 0 deletions integration/catch-boundary-data-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ let HAS_BOUNDARY_NESTED_LOADER = "/yes/loader-self-boundary" as const;
let ROOT_DATA = "root data";
let LAYOUT_DATA = "root data";

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
7 changes: 7 additions & 0 deletions integration/catch-boundary-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ test.describe("CatchBoundary", () => {

let NOT_FOUND_HREF = "/not/found";

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
7 changes: 7 additions & 0 deletions integration/defer-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ declare global {
};
}

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.describe("non-aborted", () => {
let fixture: Fixture;
let appFixture: AppFixture;
Expand Down
7 changes: 7 additions & 0 deletions integration/error-boundary-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ test.describe("ErrorBoundary", () => {
// packages/remix-react/errorBoundaries.tsx
let INTERNAL_ERROR_BOUNDARY_HEADING = "Application Error";

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
_consoleError = console.error;
console.error = () => {};
Expand Down
7 changes: 7 additions & 0 deletions integration/fetcher-state-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ test.describe("fetcher states", () => {
let fixture: Fixture;
let appFixture: AppFixture;

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
7 changes: 7 additions & 0 deletions integration/form-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ test.describe("Forms", () => {
let SPLAT_ROUTE_PARENT_ACTION = "splat-route-parent";
let SPLAT_ROUTE_TOO_MANY_DOTS_ACTION = "splat-route-too-many-dots";

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
10 changes: 5 additions & 5 deletions integration/hmr-log-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ test("HMR", async ({ page, browserName }) => {
if (dev.exitCode) throw Error("Dev server exited early");
return /✅ app ready: /.test(devStdout());
},
{ timeoutMs: 10_000 }
{ timeoutMs: HMR_TIMEOUT_MS }
);

await page.goto(`http://localhost:${appPort}`, {
Expand Down Expand Up @@ -369,7 +369,7 @@ test("HMR", async ({ page, browserName }) => {
}
`;
fs.writeFileSync(indexPath, withLoader1);
await expect.poll(() => dataRequests).toBe(1);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(1);
await page.waitForLoadState("networkidle");

await page.getByText("Hello, world").waitFor({ timeout: HMR_TIMEOUT_MS });
Expand Down Expand Up @@ -399,7 +399,7 @@ test("HMR", async ({ page, browserName }) => {
}
`;
fs.writeFileSync(indexPath, withLoader2);
await expect.poll(() => dataRequests).toBe(2);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(2);
await page.waitForLoadState("networkidle");

await page.getByText("Hello, planet").waitFor({ timeout: HMR_TIMEOUT_MS });
Expand Down Expand Up @@ -465,11 +465,11 @@ whatsup
<Component/>
`;
fs.writeFileSync(mdxPath, mdx);
await expect.poll(() => dataRequests).toBe(4);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(4);
await page.waitForSelector(`#hot`);

fs.writeFileSync(mdxPath, originalMdx);
await expect.poll(() => dataRequests).toBe(5);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(5);
await page.waitForSelector(`#crazy`);

// dev server doesn't crash when rebuild fails
Expand Down
10 changes: 5 additions & 5 deletions integration/hmr-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ test("HMR", async ({ page, browserName }) => {
if (dev.exitCode) throw Error("Dev server exited early");
return /✅ app ready: /.test(devStdout());
},
{ timeoutMs: 10_000 }
{ timeoutMs: HMR_TIMEOUT_MS }
);

await page.goto(`http://localhost:${appPort}`, {
Expand Down Expand Up @@ -403,7 +403,7 @@ test("HMR", async ({ page, browserName }) => {
}
`;
fs.writeFileSync(indexPath, withLoader1);
await expect.poll(() => dataRequests).toBe(1);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(1);
await page.waitForLoadState("networkidle");

await page.getByText("Hello, world").waitFor({ timeout: HMR_TIMEOUT_MS });
Expand Down Expand Up @@ -432,7 +432,7 @@ test("HMR", async ({ page, browserName }) => {
`;
fs.writeFileSync(indexPath, withLoader2);

await expect.poll(() => dataRequests).toBe(2);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(2);

await page.waitForLoadState("networkidle");

Expand Down Expand Up @@ -499,11 +499,11 @@ whatsup
<Component/>
`;
fs.writeFileSync(mdxPath, mdx);
await expect.poll(() => dataRequests).toBe(4);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(4);
await page.waitForSelector(`#hot`);

fs.writeFileSync(mdxPath, originalMdx);
await expect.poll(() => dataRequests).toBe(5);
await expect.poll(() => dataRequests, { timeout: HMR_TIMEOUT_MS }).toBe(5);
await page.waitForSelector(`#crazy`);

// dev server doesn't crash when rebuild fails
Expand Down
7 changes: 7 additions & 0 deletions integration/navigation-state-v2-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ test.describe("navigation states", () => {
let fixture: Fixture;
let appFixture: AppFixture;

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
7 changes: 7 additions & 0 deletions integration/transition-state-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ test.describe("rendering", () => {
let fixture: Fixture;
let appFixture: AppFixture;

test.beforeEach(async ({ context }) => {
await context.route(/_data/, async (route) => {
await new Promise((resolve) => setTimeout(resolve, 50));
route.continue();
});
});

test.beforeAll(async () => {
fixture = await createFixture({
config: {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
const templateChoices = [
{ name: "Remix App Server", value: "remix" },
{ name: "Express Server", value: "express" },
{ name: "Architect (AWS Lambda)", value: "arc" },
{ name: "Architect", value: "arc" },
{ name: "Fly.io", value: "fly" },
{ name: "Netlify", value: "netlify" },
{ name: "Vercel", value: "vercel" },
Expand Down
1 change: 1 addition & 0 deletions packages/remix-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@remix-run/server-runtime": "1.17.0",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^13.3.0",
"@types/react": "^18.0.15",
"abort-controller": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/remix-server-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
"module": "dist/esm/index.js",
"dependencies": {
"@remix-run/router": "1.6.3",
"@types/cookie": "^0.4.1",
"@web3-storage/multipart-parser": "^1.0.0",
"cookie": "^0.4.1",
"set-cookie-parser": "^2.4.8",
"source-map": "^0.7.3"
},
"devDependencies": {
"@remix-run/web-file": "^3.0.2",
"@types/cookie": "^0.4.0",
"@types/react": "^18.0.15",
"@types/set-cookie-parser": "^2.4.1"
},
"engines": {
Expand Down
23 changes: 16 additions & 7 deletions packages/remix-server-runtime/routeModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type {
Params,
RouterState,
} from "@remix-run/router";
import type { ComponentType } from "react";

import type { AppLoadContext, AppData } from "./data";
import type { LinkDescriptor } from "./links";
Expand Down Expand Up @@ -48,23 +47,31 @@ export interface ActionFunction {
/**
* A React component that is rendered when the server throws a Response.
*
* @deprecated Please enable the v2_errorBoundary flag
* @deprecated Please enable the v2_errorBoundary flag to eliminate the need
* for this type. If you are still using this, please use `@remix-run/react`'s
* `CatchBoundaryComponent` type
*/
export type CatchBoundaryComponent = ComponentType;
export type CatchBoundaryComponent = any;

/**
* A React component that is rendered when there is an error on a route.
*
* @deprecated Please enable the v2_errorBoundary flag
* @deprecated Please enable the v2_errorBoundary flag to eliminate the need
* for this type. If you are still using this, please use `@remix-run/react`'s
* `ErrorBoundaryComponent` type
*/
export type ErrorBoundaryComponent = ComponentType<{ error: Error }>;
export type ErrorBoundaryComponent = any;

/**
* V2 version of the ErrorBoundary that eliminates the distinction between
* Error and Catch Boundaries and behaves like RR 6.4 errorElement and captures
* errors with useRouteError()
*
* @deprecated Please enable the v2_errorBoundary flag to eliminate the need
* for this type. If you are still using this, please use `@remix-run/react`'s
* `V2_ErrorBoundaryComponent` type
*/
export type V2_ErrorBoundaryComponent = ComponentType;
export type V2_ErrorBoundaryComponent = any;

export type HeadersArgs = {
loaderHeaders: Headers;
Expand Down Expand Up @@ -262,8 +269,10 @@ type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;

/**
* A React component that is rendered for a route.
*
* @deprecated Please use `@remix-run/react`'s `RouteComponent` type instead
*/
export type RouteComponent = ComponentType<{}>;
export type RouteComponent = any;

/**
* An arbitrary object that is associated with a route.
Expand Down
18 changes: 18 additions & 0 deletions packages/remix-vercel/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
import "./globals";

const alreadyWarned: Record<string, boolean> = {};
const warnOnce = (message: string, key = message) => {
if (!alreadyWarned[key]) {
alreadyWarned[key] = true;
console.warn(message);
}
};

warnOnce(
"⚠️ REMIX FUTURE CHANGE: The `@remix-run/vercel` runtime adapter " +
"has been deprecated in favor of out of the box Vercel functionality and " +
"will be removed in Remix v2. Please update your code by removing " +
"`@remix-run/vercel` & `@vercel/node` from your `package.json`, removing " +
"your `server.js`/`server.ts` file, and removing the `server` & " +
"`serverBuildPath` options from your `remix.config.js`.",
"built-in-vercel-functionality"
);

export type { GetLoadContextFunction, RequestHandler } from "./server";
export { createRequestHandler } from "./server";
6 changes: 6 additions & 0 deletions templates/vercel/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
> **Warning**
> The `@remix-run/vercel` runtime adapter has been deprecated in favor of out of
> the box Vercel functionality and will be removed in Remix v2.
> This means you don't have to use the Vercel template & can just use the Remix
> template instead.
# Welcome to Remix!

- [Remix Docs](https://remix.run/docs)
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2943,7 +2943,7 @@
resolved "https://registry.npmjs.org/@types/cookie-signature/-/cookie-signature-1.0.3.tgz"
integrity sha512-0jpd4oizLaBybWBCew/lx4iAjjNWmCfzbspvnjoppyGEquN51BjShmPCksiH2IXLwtxQ2F/e2PkFy0LL7jpLsw==

"@types/cookie@^0.4.0", "@types/cookie@^0.4.1":
"@types/cookie@^0.4.1":
version "0.4.1"
resolved "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz"
integrity sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==
Expand Down

0 comments on commit 43af086

Please sign in to comment.