Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ contact_links:
url: https://github.com/remix-run/remix/discussions/new?category=q-a
about: Open a Discussion in GitHub with the `Q&A` label
- name: 💬 Remix Discord Channel
url: https://rmx.as/discord
url: https://remix.run/discord
about: Interact with other people using React Router and Remix 📀
4 changes: 2 additions & 2 deletions .github/workflows/issue-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

Or, if this was closed by mistake and there is a valid reproduction, please ensure that it is linked in the Issue description and tag `@brophdawg11` or `@brookslybrand` in a comment so we can re-open.

If you have any questions, you can always reach out on [Discord](https://rmx.as/discord). Thanks again for providing feedback and helping us make React Router even better!
If you have any questions, you can always reach out on [Discord](https://remix.run/discord). Thanks again for providing feedback and helping us make React Router even better!
run: |
gh issue comment ${{ github.event.issue.number }} --body "$COMMENT_BODY"
gh issue edit ${{ github.event.issue.number }} --remove-label "${{ github.event.label.name }}"
Expand All @@ -48,7 +48,7 @@ jobs:
COMMENT_BODY: |
:wave: @${{ github.event.issue.user.login }}, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request.

For usage questions, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/react-router) or [Discord](https://rmx.as/discord) where there are a lot more people ready to help you out, or [post a new question](https://github.com/remix-run/react-router/discussions/new?category=q-a) in the Discussions tab of this repository.
For usage questions, please use [Stack Overflow](https://stackoverflow.com/questions/tagged/react-router) or [Discord](https://remix.run/discord) where there are a lot more people ready to help you out, or [post a new question](https://github.com/remix-run/react-router/discussions/new?category=q-a) in the Discussions tab of this repository.

Please feel free to clarify your issue if you think it was closed prematurely.
run: |
Expand Down
35 changes: 1 addition & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Specific jobs only run on the proper trigger:
#
# - Change file driven stable releases (push to main/hotfix/v7 branches)
# - v8 prereleases (from a workflow_dispatch trigger on the v8 branch)
# - Experimental releases (from a workflow_dispatch trigger)

name: Release
Expand Down Expand Up @@ -168,41 +167,9 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: pnpm run release-comments

prerelease:
name: Publish prerelease (v8)
if: github.repository == 'remix-run/react-router' && github.event_name == 'workflow_dispatch' && github.event.inputs.branch == 'v8'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # enable generation of an ID token for publishing
steps:
- name: Checkout repo
uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.branch }}
fetch-depth: 0 # needed for tags

- name: Setup pnpm
uses: pnpm/action-setup@v6

- name: Setup node
uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
package-manager-cache: false

- name: Install deps
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Publish prerelease
run: pnpm prerelease:publish

experimental-release:
name: Experimental Release
if: github.repository == 'remix-run/react-router' && github.event_name == 'workflow_dispatch' && github.event.inputs.branch != 'v8'
if: github.repository == 'remix-run/react-router' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write # enable pushing changes to the origin
Expand Down
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
- SailorStat
- samimsu
- sanjai451
- sanjibani
- sanketshah19
- sapphi-red
- saul-atomrigs
Expand Down
2 changes: 1 addition & 1 deletion docs/api/components/Form.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/do

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.Form.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.Form.html)

A progressively enhanced HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)
that submits data to actions via [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch),
Expand Down
2 changes: 1 addition & 1 deletion docs/api/components/Link.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/do

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.Link.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.Link.html)

A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)
wrapper to enable navigation with client-side routing.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/components/NavLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/do

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.NavLink.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.NavLink.html)

Wraps [`<Link>`](../components/Link) with additional props for styling active and
pending states.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/utils/createRoutesFromElements.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/co

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.createRoutesFromElements.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.createRoutesFromElements.html)

Create route objects from JSX elements instead of arrays of objects.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/utils/redirect.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/ro

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.redirect.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.redirect.html)

A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/utils/redirectDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/ro

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.redirectDocument.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.redirectDocument.html)

A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
that will force a document reload to the new location. Sets the status code
Expand Down
2 changes: 1 addition & 1 deletion docs/api/utils/replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/ro

## Summary

[Reference Documentation ↗](https://api.reactrouter.com/v8/functions/react-router.replace.html)
[Reference Documentation ↗](https://api.reactrouter.com/v8/variables/react-router.replace.html)

A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
that will perform a [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState)
Expand Down
2 changes: 1 addition & 1 deletion docs/upgrading/component-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you are using `<RouterProvider>` please see [Framework Adoption from RouterPr

If you are using `<Routes>` this is the right place.

The React Router Vite plugin adds framework features to React Router. This guide will help you adopt the plugin in your app. If you run into any issues, please reach out for help on [Twitter](https://x.com/remix_run) or [Discord](https://rmx.as/discord).
The React Router Vite plugin adds framework features to React Router. This guide will help you adopt the plugin in your app. If you run into any issues, please reach out for help on [Twitter](https://x.com/remix_run) or [Discord](https://remix.run/discord).

## Features

Expand Down
2 changes: 1 addition & 1 deletion docs/upgrading/router-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ order: 5

If you are not using `<RouterProvider>` please see [Framework Adoption from Component Routes][upgrade-component-routes] instead.

The React Router Vite plugin adds framework features to React Router. This guide will help you adopt the plugin in your app. If you run into any issues, please reach out for help on [Twitter](https://x.com/remix_run) or [Discord](https://rmx.as/discord).
The React Router Vite plugin adds framework features to React Router. This guide will help you adopt the plugin in your app. If you run into any issues, please reach out for help on [Twitter](https://x.com/remix_run) or [Discord](https://remix.run/discord).

## Features

Expand Down
45 changes: 45 additions & 0 deletions integration/vite-prerender-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,51 @@ test.describe(`Prerendering`, () => {
expect(html).toMatch('<p data-loader-data="true">About Loader Data</p>');
});

test("Runs buildEnd after prerendering is complete", async () => {
let cwd = await createProject({
...files,
"react-router.config.ts": js`
import fs from "node:fs";
import path from "node:path";

export default {
prerender: ["/about"],
async buildEnd({ reactRouterConfig }) {
let clientBuildDirectory = path.join(
reactRouterConfig.buildDirectory,
"client"
);

fs.writeFileSync(
"BUILD_END_META.json",
JSON.stringify({
htmlExists: fs.existsSync(
path.join(clientBuildDirectory, "about", "index.html")
),
dataExists: fs.existsSync(
path.join(clientBuildDirectory, "about.data")
),
})
);
},
};
`,
});

let result = build({ cwd });
expect(result.stderr.toString()).toBeFalsy();
expect(result.status).toBe(0);

await expect(
fs.promises.readFile(path.join(cwd, "BUILD_END_META.json"), "utf8"),
).resolves.toEqual(
JSON.stringify({
htmlExists: true,
dataExists: true,
}),
);
});

test("Prerenders a static array of routes with server bundles", async () => {
fixture = await createFixture({
prerender: true,
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
"format:check": "prettier --ignore-path .prettierignore --check .",
"lint": "eslint --cache .",
"playground": "node ./scripts/playground.js",
"prerelease:version": "node ./scripts/prerelease.ts version",
"prerelease:publish": "node ./scripts/prerelease.ts publish",
"release-comments": "node scripts/release-comments.ts",
"test": "node --experimental-vm-modules --no-warnings=ExperimentalWarning ./node_modules/jest/bin/jest.js",
"test:inspect": "node --experimental-vm-modules --no-warnings=ExperimentalWarning --inspect-brk ./node_modules/jest/bin/jest.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-react-router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ async function doneStep(ctx: Context) {
);
await sleep(100);
log(
`\n${prefix}Join the community at ${color.cyan(`https://rmx.as/discord`)}\n`,
`\n${prefix}Join the community at ${color.cyan(`https://remix.run/discord`)}\n`,
);
await sleep(200);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a regression with the new prerendering plugin where the `react-router.config.ts` `buildEnd` hook would run before prerendering was completed
61 changes: 38 additions & 23 deletions packages/react-router-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1336,33 +1336,18 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
invariant(viteConfig);
viteConfig.logger.info("Using Vite Environment API");

try {
let { reactRouterConfig } = ctx;

await cleanBuildDirectory(viteConfig, ctx);

await builder.build(builder.environments.client);

let serverEnvironments = getServerEnvironmentValues(
ctx,
builder.environments,
);
await cleanBuildDirectory(viteConfig, ctx);

await Promise.all(serverEnvironments.map(builder.build));
await builder.build(builder.environments.client);

await cleanViteManifests(environments, ctx);
let serverEnvironments = getServerEnvironmentValues(
ctx,
builder.environments,
);

let { buildManifest } = ctx;
invariant(buildManifest, "Expected build manifest");
await Promise.all(serverEnvironments.map(builder.build));

await reactRouterConfig.buildEnd?.({
buildManifest,
reactRouterConfig,
viteConfig,
});
} finally {
await closePluginResources();
}
await cleanViteManifests(environments, ctx);
},
},
};
Expand Down Expand Up @@ -2724,6 +2709,36 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
}
},
}),
{
name: "react-router-build-end",
sharedDuringBuild: true,
config: {
order: "post",
handler({ builder: { buildApp } = {} }) {
return {
builder: {
async buildApp(builder) {
try {
await buildApp?.(builder);

invariant(viteConfig);
let { buildManifest, reactRouterConfig } = ctx;
invariant(buildManifest, "Expected build manifest");

await reactRouterConfig.buildEnd?.({
buildManifest,
reactRouterConfig,
viteConfig,
});
} finally {
await closePluginResources();
}
},
},
};
},
},
},
validatePluginOrder(),
warnOnClientSourceMaps(),
];
Expand Down
12 changes: 0 additions & 12 deletions scripts/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,6 @@ function processTypedocModule(
? "variables"
: undefined;

// Assigning an arrow function to a variable will be a "variable" here but
// typedoc will classify it as a "function". We can identify these if they
// define `@params` or `@returns` tags in their JSDoc.
if (
type === "variables" &&
subChild.comment?.blockTags?.some(
(tag) => tag.tag === "@param" || tag.tag === "@returns",
)
) {
type = "functions";
}

if (!type) {
warn(
`Skipping ${apiName} because it is not a function, class, enum, interface, or type`,
Expand Down
2 changes: 1 addition & 1 deletion scripts/pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ If this feature doesn't have a Proposal, please [open one](https://github.com/re

If this PR already has a Proposal but it has not yet been accepted, let's continue the discussion in the Proposal until it gets accepted and then we can look to open a PR. Feel free to link to this PR or to a branch in a forked repo to show what a potential implementation might look like.

If you have any questions, you can always reach out on [Discord](https://rmx.as/discord). Thanks again for providing feedback and helping us make React Router even better!
If you have any questions, you can always reach out on [Discord](https://remix.run/discord). Thanks again for providing feedback and helping us make React Router even better!
`;

let { positionals } = util.parseArgs({ allowPositionals: true });
Expand Down
Loading
Loading