rsnext/packages/next
Terence Bezman b20eb99a4d
Relay Support in Rust Compiler (#33240)
## Feature

Implements feature requested in https://github.com/vercel/next.js/issues/30805. 

A few people including myself have been looking to use Relay with Next.JS and want to use the new Rust Compiler. This is my stab at an implementation. 

### How it works?
Finds all  `graphql` tagged template experssions and replaces them with `require`s to the file generated by Relay.

### Where I need help
- I've only worked with Rust a handful of times so I would appreciate any feedback on my use of language features.
- Is there any performance overhead to many duplicate usages of `require`? I imagine there's a cache in place but I want to be sure.
- I've added some unit tests & integration tests but I might be missing some use cases. Feel free to comment some use cases I'm not thinking about.

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
  - I haven't added any docs since this is an experimental API.

## Documentation / Examples

You're expected to be running the Relay Compiler along side Next.JS when you're developing. This is pretty standard. I wouldn't expect people to have any problem with this.

### Usage
In your `next.config.js`
```js
module.exports = {
  experimental: {
    relay: {
      language: 'typescript', // or 'javascript`
      artifactDirectory: 'path/to/you/artifact/directory' // you can leave this undefined if you did not specify one in the `relay.json`
    }
  }
}
```


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-01-26 08:23:57 +00:00
..
bin feat(cli): introduce next info CLI command (#32972) 2022-01-04 15:35:32 +00:00
build Relay Support in Rust Compiler (#33240) 2022-01-26 08:23:57 +00:00
bundles fixes to allow lazy compilation for import() (#32441) 2021-12-14 11:33:04 +01:00
cli feat(cli): introduce next info CLI command (#32972) 2022-01-04 15:35:32 +00:00
client Add lazyRoot optional property to next/image component (#33290) 2022-01-25 14:54:15 +01:00
compiled Update other instances of node-fetch (#33617) 2022-01-24 16:18:39 -06:00
export Refactor base server to remove native dependencies (#33499) 2022-01-20 21:25:44 +00:00
image-types Add support for AVIF to next/image (#29683) 2021-10-11 23:17:47 +00:00
lib Implement web server as the request handler for edge SSR (#33635) 2022-01-26 06:22:11 +00:00
pages Fixes issue with makeStylesheetInert (#32027) 2022-01-03 20:35:57 +00:00
server Relay Support in Rust Compiler (#33240) 2022-01-26 08:23:57 +00:00
shared/lib Move middleware handling to node server (#33448) 2022-01-19 12:36:06 +00:00
telemetry Pre-compile more dependencies (#32742) 2022-01-17 15:17:22 +00:00
trace Simplify trace span id generation (#32946) 2022-01-02 21:22:01 +00:00
types Pre-compile more dependencies (#32742) 2022-01-17 15:17:22 +00:00
amp.d.ts Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
amp.js Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
app.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
app.js
babel.d.ts
babel.js
client.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
client.js
config.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
config.js Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
constants.d.ts Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
constants.js Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
data.d.ts
data.js
data.sqlite Fix export worker threads options (#25063) 2021-05-14 12:50:29 +02:00
document.d.ts Fix document type import path (#32117) 2021-12-04 10:23:15 +00:00
document.js
dynamic.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
dynamic.js Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
error.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
error.js
head.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
head.js Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
image.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
image.js Image component foundation (#17343) 2020-10-14 11:57:10 +02:00
index.d.ts Include submodules in exported type definition (#28316) 2021-11-26 14:46:56 +01:00
jest.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
jest.js Ensure next/jest is published (#31296) 2021-11-11 11:48:12 +01:00
license.md Update license year 2022-01-13 16:02:34 +01:00
link.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
link.js
package.json v12.0.9-canary.9 2022-01-25 10:53:28 -06:00
README.md docs(readme.md): add good first issue section to readme (#25085) 2021-05-18 16:10:01 -05:00
router.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
router.js
rsc.d.ts Escape from next head in rsc _error page (#32624) 2021-12-21 19:24:57 +00:00
rsc.js Escape from next head in rsc _error page (#32624) 2021-12-21 19:24:57 +00:00
script.d.ts Improve exported root definitions (#32077) 2021-12-03 07:16:29 +00:00
script.js Remove experimental tag from Script component (#25435) 2021-06-03 13:56:50 +02:00
server.d.ts Add TS types for NextMiddleware (#30578) 2021-11-30 20:43:40 +00:00
server.js Implement Middleware RFC (#30081) 2021-10-20 17:52:11 +00:00
taskfile-ncc.js Update to latest ncc and ensure caniuse-lite data is external (#32064) 2021-12-08 10:41:35 -06:00
taskfile-swc.js Remove noop import (#31722) 2021-11-24 15:40:58 +01:00
taskfile.js Update main field for nccd jest-worker (#33465) 2022-01-19 10:11:14 -06:00
tsconfig.json Revert incremental config to fix missing types (#30644) 2021-10-29 23:16:11 -05:00
vitals.d.ts Rename experimental vital hook (#32343) 2021-12-12 21:14:12 +01:00
vitals.js Rename experimental vital hook (#32343) 2021-12-12 21:14:12 +01:00

Next.js

Getting Started

Visit https://nextjs.org/learn to get started with Next.js.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Who is using Next.js?

Next.js is used by the world's leading companies. Check out the Next.js Showcase to learn more.

Community

The Next.js community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects.

To chat with other community members you can join the Next.js Discord.

Our Code of Conduct applies to all Next.js community channels.

Contributing

Please see our contributing.md.

Good First Issues

We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Authors