forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:redwoodjs/redwood into try/apollo-u…
…pload-link * 'main' of github.com:redwoodjs/redwood: (52 commits) linting: enable 'typescript-eslint/await-thenable' rule (redwoodjs#11311) refactor(api): Add conditional exports to package.json (redwoodjs#11307) chore(readme): Add my middle initials (redwoodjs#11310) chore(README): Fix formatting. One row (redwoodjs#11309) chore(README): Move Kris from Maintainer to Alumni (redwoodjs#11308) fix(codemods): Move away from babel for building package (redwoodjs#11306) fix(api): Move away from babel for building package (redwoodjs#11305) fix(internal): Move away from babel for building package (redwoodjs#11304) fix(auth-providers): Move away from babel for building 'api' packages (redwoodjs#11301) fix(auth-providers): Move away from babel for building 'setup' packages (redwoodjs#11303) chore(deps): Remove webpack related dependencies (redwoodjs#11299) chore(build): build core with esbuild (redwoodjs#11298) chore(exec test): Clean up (redwoodjs#11302) Detect/resolve ambiguous script names (redwoodjs#9848) chore(lint): tidy up the prettier ignore (redwoodjs#11297) feat(context): Build and publish package as dual esm/cjs (redwoodjs#11294) chore(lint): fix prettier configs and ignores (redwoodjs#11295) chore(docs): update prettier config and format docs content (redwoodjs#11293) chore(check): Refactor 'yarn check' away from being a standalone node script (redwoodjs#11292) chore: delete crowdin config file (redwoodjs#11291) ...
- Loading branch information
Showing
520 changed files
with
5,475 additions
and
4,556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
- Add Storybook (Vite) framework package (#10064) by @arimendelow | ||
|
||
Adds: | ||
|
||
- Storybook framework package for using Storybook with Vite. | ||
- CLI package (command: `yarn rw sbv`) for running Storybook using Vite. CLI package additionally creates Mock Service Worker, and, on first run, the project-side Storybook config files. | ||
|
||
Current Storybook (Webpack) users will need to manually migrate any additional Storybook config (mocks, etc.). The primary user-facing difference between the old and new Storybook integrations is that the config used by the old one lives in the `@redwoodjs/testing` package, and the config used by this new one lives in the user's `web/.storybook` directory. | ||
Current Storybook (Webpack) users will need to manually migrate any additional Storybook config (mocks, etc.). The primary user-facing difference between the old and new Storybook integrations is that the config used by the old one lives in the `@redwoodjs/testing` package, and the config used by this new one lives in the user's `web/.storybook` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
- chore(linting): Update versions and avoid `{}` (#10266) by @Josh-Walker-GM | ||
|
||
This PR updates the versions of the `eslint` and the `@typescript-eslint` packages from v5 to v7. | ||
This PR updates the versions of the `eslint` and the `@typescript-eslint` packages from v5 to v7. | ||
|
||
This is a major upgrade of the `@typescript-eslint` package and although we think it is unlikely to introduce a breaking change for you we would recommend that you read the associated documentation. The v6 upgrade can be found [here](https://typescript-eslint.io/blog/announcing-typescript-eslint-v6/) and the v7 one [here](https://typescript-eslint.io/blog/announcing-typescript-eslint-v7/). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,38 @@ | ||
- Middleware Routing & `registerMiddleware` (#10395) by @dac09 | ||
|
||
Implements the new syntax of using Middleware after discussion. This sets us up for doing Auth better, but also for implementations like OG Image generation. | ||
Implements the new syntax of using Middleware after discussion. This sets us up for doing Auth better, but also for implementations like OG Image generation. | ||
|
||
```js | ||
export const registerMiddleware = async () => { | ||
return [ | ||
dbAuthMiddleware(), | ||
[new OgMiddleware({ rootFilename: 'index' }), [ '/:route.:extension']] | ||
] | ||
return [ | ||
dbAuthMiddleware(), | ||
[new OgMiddleware({ rootFilename: 'index' }), ['/:route.:extension']], | ||
] | ||
} | ||
``` | ||
|
||
**Features** | ||
|
||
- [x] Registering middleware with above syntax | ||
- [x] Chaining multiple middleware by passing array of middleware, or tuples | ||
- [x] Defining the route patterns to match in the find-my-way syntax | ||
|
||
--- | ||
--- | ||
|
||
**What syntax are you using for the route patterns?** | ||
After discussion that Regexes are slow and unwieldy, I did some research and comparisons here: https://www.notion.so/redwoodjs/Middleware-Route-patterns-0f1c5587b4134073adfae896a782b5ea?pvs= | ||
|
||
This implementation uses https://github.com/delvedor/find-my-way - which is the Fastify version - but still keeps us decoupled from Fastify (see implementation, or document for why). | ||
|
||
**Important for understanding** | ||
Quoting from find-my-way docs: | ||
|
||
> The nodes are matched in the following order: | ||
static | ||
parametric node with static ending | ||
parametric(regex)/multi-parametric | ||
parametric | ||
wildcard | ||
|
||
Which means, if you have a more specific one - example you have `[mw1, `*`]` and `[mw2, '/refresh_auth']` - then a request to /refresh_auth will ONLY trigger mw2. This is sort of counter intuitive, but them are the rules with fmw. | ||
Which means, if you have a more specific one - example you have `[mw1, `\*`]` and `[mw2, '/refresh_auth']` - then a request to /refresh_auth will ONLY trigger mw2. This is sort of counter intuitive, but them are the rules with fmw. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
- feat: [Auth] Common AuthProvider & use* changes for middleware auth #10420 by @dac09 and @dthyresson | ||
- feat: [Auth] Common AuthProvider & use\* changes for middleware auth #10420 by @dac09 and @dthyresson | ||
|
||
* First step of supporting Auth using middleware | ||
* Ensure backwards compatibility with non-SSR auth | ||
|
||
### Breaking Change | ||
|
||
Removes `skipFetchCurrentUser` which was used by the no longer existing nHost auth provider, but could potentially have been used by custom auth. | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
- feat(og-gen): Update implementation of useLocation | Update App template (#10441) by @dac09 | ||
**Updated App.tsx template** | ||
We modified the `App.tsx` template to accept possible children, and render them if present. This lets the og:image handler inject your component into the Document tree, without including the entire Router, but still style your og:image component using whatever you used to style the rest of your app (Tailwind, perhaps?) | ||
**Updated App.tsx template** | ||
We modified the `App.tsx` template to accept possible children, and render them if present. This lets the og:image handler inject your component into the Document tree, without including the entire Router, but still style your og:image component using whatever you used to style the rest of your app (Tailwind, perhaps?) | ||
|
||
**Updated useLocation implementation** | ||
We also modified the `useLocation()` hook to now return everything that the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) returns. Previously it only returned three attributes of the url (pathname, search, hash), now it returns everything available to a call to `new URL()` (origin, href, searchParams, etc.). | ||
|
||
The reason for this is now that we have SSR, we can get access to more details in the hook - in this case we needed origin | ||
|
||
Both changes should be non-breaking! | ||
Both changes should be non-breaking! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
- feat(server-auth): Part 1/3: dbAuth middleware support (web side changes) (#10444) by @dac09 | ||
Adds ability to `createMiddlewareAuth` in dbAuth client which: | ||
Adds ability to `createMiddlewareAuth` in dbAuth client which: | ||
|
||
1. Updates the dbAuth web client to speak to middleware instead of graphql | ||
2. Implements fetching current user from middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
- feat: Remove `--performance` option from `yarn rw build` (#10453) by @Josh-Walker-GM | ||
|
||
This change removes the `--performance` flag from the `yarn rw build` command. It will no longer be available to use and the CLI will no longer accept this flag being passed in. | ||
This change removes the `--performance` flag from the `yarn rw build` command. It will no longer be available to use and the CLI will no longer accept this flag being passed in. | ||
|
||
Additionally, the associated webpack config (`@redwoodjs/core/config/webpack.perf.js`) has been removed so it can no longer be imported if you were doing so. | ||
Additionally, the associated webpack config (`@redwoodjs/core/config/webpack.perf.js`) has been removed so it can no longer be imported if you were doing so. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
- feat(server-auth): dbAuth 3/3 - handle login, logout, signup, etc. requests if forwarded from middleware (#10457) by @dac09 | ||
- feat(server-auth): dbAuth 3/3 - handle login, logout, signup, etc. requests if forwarded from middleware (#10457) by @dac09 | ||
|
||
This PR updates the DbAuthHandler class to handle requests forwarded from middleware, so it can generate responses for login, logout, signup, etc. These are POST requests - it used to be to the `/auth` function, but now they will be captured by dbAuth middleware and forwarded onto DbAuthHandler. | ||
This PR updates the DbAuthHandler class to handle requests forwarded from middleware, so it can generate responses for login, logout, signup, etc. These are POST requests - it used to be to the `/auth` function, but now they will be captured by dbAuth middleware and forwarded onto DbAuthHandler. | ||
|
||
**High level changes:** | ||
|
||
- use the `Headers` class in each of the "method" responses. This allows us to set multi-value headers like Set-Cookie. A simple object would not. See type `AuthMethodOutput` | ||
- extracts `buildResponse` into a testable function and adds test. For `Set-Cookie` headers we return an array of strings. | ||
- extracts `buildResponse` into a testable function and adds test. For `Set-Cookie` headers we return an array of strings. | ||
|
||
In the middleware here's the code I had for the final conversion: | ||
```ts | ||
if (AUTHHANDLER_REQUEST) { | ||
const output = await dbAuthHandler(req) | ||
|
||
const finalHeaders = new Headers() | ||
Object.entries(output.headers).forEach(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
value.forEach((v) => finalHeaders.append(key, v)) | ||
} else { | ||
finalHeaders.append(key, value) | ||
} | ||
}) | ||
```ts | ||
if (AUTHHANDLER_REQUEST) { | ||
const output = await dbAuthHandler(req) | ||
|
||
return new MiddlewareResponse(output.body, { | ||
headers: finalHeaders, | ||
status: output.statusCode, | ||
}) | ||
const finalHeaders = new Headers() | ||
Object.entries(output.headers).forEach(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
value.forEach((v) => finalHeaders.append(key, v)) | ||
} else { | ||
finalHeaders.append(key, value) | ||
} | ||
}) | ||
|
||
return new MiddlewareResponse(output.body, { | ||
headers: finalHeaders, | ||
status: output.statusCode, | ||
}) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,49 @@ | ||
- feat(og-gen): Implement middleware and hooks (#10469) by @dac09 | ||
- feat(og-gen): Implement middleware and hooks (#10469) by @dac09 | ||
|
||
The OG Gen saga continues with @cannikin and @dac09 ⚔️ | ||
The OG Gen saga continues with @cannikin and @dac09 ⚔️ | ||
|
||
This PR: | ||
|
||
- adds OgImageMiddleware and Hooks to `@redwoodjs/og-gen`, complete with tests | ||
|
||
⚠️ Template changes: | ||
|
||
- updates entry.client template to pass in Routes to App | ||
- updates App to take children (i.e. Routes) | ||
|
||
This is so that we can pass the OG component to be rendered _with_ your App's CSS setup. | ||
|
||
|
||
**How to use this?** | ||
|
||
1. **Registering the middleware:** | ||
```ts | ||
import OgImageMiddleware from '@redwoodjs/ogimage-gen/middleware' | ||
|
||
export const registerMiddleware = () => { | ||
const ogMw = new OgImageMiddleware({ | ||
App, | ||
Document, | ||
}) | ||
```ts | ||
import OgImageMiddleware from '@redwoodjs/ogimage-gen/middleware' | ||
|
||
return [ogMw] | ||
} | ||
``` | ||
export const registerMiddleware = () => { | ||
const ogMw = new OgImageMiddleware({ | ||
App, | ||
Document, | ||
}) | ||
|
||
return [ogMw] | ||
} | ||
``` | ||
|
||
2. Configure your `vite.config.ts` | ||
```ts | ||
import vitePluginOgImageGen from '@redwoodjs/ogimage-gen/plugin' | ||
|
||
const viteConfig: UserConfig = { | ||
// 👇 so it builds your OG components | ||
plugins: [redwood(), vitePluginOgImageGen()], | ||
} | ||
```ts | ||
import vitePluginOgImageGen from '@redwoodjs/ogimage-gen/plugin' | ||
|
||
const viteConfig: UserConfig = { | ||
// 👇 so it builds your OG components | ||
plugins: [redwood(), vitePluginOgImageGen()], | ||
} | ||
|
||
export default defineConfig(viteConfig) | ||
``` | ||
|
||
export default defineConfig(viteConfig) | ||
``` | ||
3. Add your OG Image component next to the page it's for | ||
e.g. web/src/pages/AboutPage/AboutPage.png.tsx | ||
e.g. web/src/pages/AboutPage/AboutPage.png.tsx | ||
|
||
4. Use hooks on AboutPage to generate the ogURL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
- fix(dbauth-mw): Unset cookie instead of clearing (#10502) by @dac09 | ||
Updates dbAuth middleware implementation to _unset_ the cookies, instead of clearing them. | ||
Updates dbAuth middleware implementation to _unset_ the cookies, instead of clearing them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
- feat(eslint): Disable restricted $api imports for entryserver (#10520) by @dac09 | ||
|
||
With the introduction of middleware, it's pretty common to import things from the $api side. This is a non-issue as entry.server.{jsx,tsx} is not part of the client bundle we generate. | ||
With the introduction of middleware, it's pretty common to import things from the $api side. This is a non-issue as entry.server.{jsx,tsx} is not part of the client bundle we generate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.