From 7b337f3b7ed1e1a947d5426d0ce8b2f2669e91ab Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 26 Jan 2022 10:32:06 -0600 Subject: [PATCH 01/15] Revert "Revert "Relay Support in Rust Compiler" (#33699)" This reverts commit b5d4564cca27dac6b588f26fe21a2439ead89a46. --- docs/advanced-features/compiler.md | 13 + package.json | 3 + packages/next-swc/Cargo.lock | 1486 +++++++++++++++-- packages/next-swc/crates/core/Cargo.toml | 7 + packages/next-swc/crates/core/src/lib.rs | 17 + packages/next-swc/crates/core/src/relay.rs | 277 +++ .../next-swc/crates/core/tests/fixture.rs | 19 + .../crates/core/tests/fixture/relay/input.tsx | 42 + .../crates/core/tests/fixture/relay/output.js | 13 + packages/next-swc/crates/core/tests/full.rs | 1 + packages/next-swc/crates/wasm/Cargo.toml | 2 +- packages/next/build/swc/options.js | 1 + packages/next/build/webpack-config.ts | 1 + packages/next/server/config-shared.ts | 1 + .../__generated__/pagesQuery.graphql.ts | 63 + .../project-a/next.config.js | 6 + .../project-a/pages/api/query.ts | 12 + .../project-a/pages/index.tsx | 63 + .../project-a/tsconfig.json | 21 + .../project-b/next.config.js | 6 + .../project-b/pages/api/query.ts | 12 + .../project-b/pages/index.tsx | 63 + .../project-b/tsconfig.json | 21 + .../relay.config.js | 19 + .../schema.graphql | 3 + .../test/index.test.js | 89 + .../__generated__/pagesQuery.graphql.ts | 63 + .../next.config.js | 5 + .../pages/api/query.ts | 12 + .../pages/index.tsx | 63 + .../relay.config.js | 6 + .../schema.graphql | 3 + .../test/index.test.js | 57 + .../tsconfig.json | 21 + yarn.lock | 74 +- 35 files changed, 2424 insertions(+), 141 deletions(-) create mode 100644 packages/next-swc/crates/core/src/relay.rs create mode 100644 packages/next-swc/crates/core/tests/fixture/relay/input.tsx create mode 100644 packages/next-swc/crates/core/tests/fixture/relay/output.js create mode 100644 test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts create mode 100644 test/integration/relay-graphql-swc-multi-project/project-a/next.config.js create mode 100644 test/integration/relay-graphql-swc-multi-project/project-a/pages/api/query.ts create mode 100644 test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx create mode 100644 test/integration/relay-graphql-swc-multi-project/project-a/tsconfig.json create mode 100644 test/integration/relay-graphql-swc-multi-project/project-b/next.config.js create mode 100644 test/integration/relay-graphql-swc-multi-project/project-b/pages/api/query.ts create mode 100644 test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx create mode 100644 test/integration/relay-graphql-swc-multi-project/project-b/tsconfig.json create mode 100644 test/integration/relay-graphql-swc-multi-project/relay.config.js create mode 100644 test/integration/relay-graphql-swc-multi-project/schema.graphql create mode 100644 test/integration/relay-graphql-swc-multi-project/test/index.test.js create mode 100644 test/integration/relay-graphql-swc-single-project/__generated__/pagesQuery.graphql.ts create mode 100644 test/integration/relay-graphql-swc-single-project/next.config.js create mode 100644 test/integration/relay-graphql-swc-single-project/pages/api/query.ts create mode 100644 test/integration/relay-graphql-swc-single-project/pages/index.tsx create mode 100644 test/integration/relay-graphql-swc-single-project/relay.config.js create mode 100644 test/integration/relay-graphql-swc-single-project/schema.graphql create mode 100644 test/integration/relay-graphql-swc-single-project/test/index.test.js create mode 100644 test/integration/relay-graphql-swc-single-project/tsconfig.json diff --git a/docs/advanced-features/compiler.md b/docs/advanced-features/compiler.md index ac07f30fe24c1..0ed7b6b9a532b 100644 --- a/docs/advanced-features/compiler.md +++ b/docs/advanced-features/compiler.md @@ -94,6 +94,19 @@ const customJestConfig = { module.exports = createJestConfig(customJestConfig) ``` +### Relay + +To enable [Relay](https://relay.dev/) support: + +```js +// next.config.js +module.exports = { + experimental: { + relay: true, + }, +} +``` + ### Remove React Properties Allows to remove JSX properties. This is often used for testing. Similar to `babel-plugin-react-remove-properties`. diff --git a/package.json b/package.json index e38083a606fee..17f4d58ac5ec6 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "@types/http-proxy": "1.17.3", "@types/jest": "24.0.13", "@types/node": "13.11.0", + "@types/relay-runtime": "13.0.0", "@types/selenium-webdriver": "4.0.15", "@types/sharp": "0.29.3", "@types/string-hash": "1.1.1", @@ -145,6 +146,8 @@ "react-dom": "17.0.2", "react-dom-18": "npm:react-dom@18.0.0-rc.0", "react-ssr-prepass": "1.0.8", + "relay-compiler": "13.0.1", + "relay-runtime": "13.0.1", "release": "6.3.0", "request-promise-core": "1.1.2", "resolve-from": "5.0.0", diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 71bbaccd17e56..e6fd178ca52eb 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -33,7 +33,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.4", "once_cell", "serde", "version_check", @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" +checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" [[package]] name = "arrayvec" @@ -89,6 +89,17 @@ dependencies = [ "syn", ] +[[package]] +name = "async-trait" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atty" version = "0.2.14" @@ -145,19 +156,55 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "beef" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "474a626a67200bd107d44179bb3d4fc61891172d11696609264589be6a0e6a43" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array", + "generic-array 0.14.5", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", ] [[package]] @@ -192,9 +239,15 @@ checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" [[package]] name = "bumpalo" -version = "3.8.0" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" + +[[package]] +name = "byte-tools" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" @@ -202,11 +255,33 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +dependencies = [ + "serde", +] + [[package]] name = "cc" version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -236,14 +311,52 @@ dependencies = [ ] [[package]] -name = "cloudabi" -version = "0.1.0" +name = "clap" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ + "ansi_term", + "atty", "bitflags", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", ] +[[package]] +name = "colored" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" +dependencies = [ + "atty", + "lazy_static", + "winapi", +] + +[[package]] +name = "common" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "colored", + "indexmap", + "intern", + "log", + "lsp-types", + "md-5", + "rayon", + "serde", +] + +[[package]] +name = "common-path" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -254,6 +367,22 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "core-foundation" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "cpufeatures" version = "0.2.1" @@ -274,9 +403,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -295,9 +424,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -308,9 +437,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" dependencies = [ "cfg-if 1.0.0", "lazy_static", @@ -352,7 +481,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.9.3", "syn", ] @@ -375,6 +504,8 @@ checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" dependencies = [ "cfg-if 1.0.0", "num_cpus", + "rayon", + "serde", ] [[package]] @@ -386,6 +517,19 @@ dependencies = [ "unreachable", ] +[[package]] +name = "dependency-analyzer" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "fnv", + "graphql-ir", + "graphql-syntax", + "intern", + "relay-transforms", + "schema", +] + [[package]] name = "diff" version = "0.1.12" @@ -398,13 +542,22 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.5", ] [[package]] @@ -431,18 +584,88 @@ dependencies = [ "syn", ] +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errors" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", +] + +[[package]] +name = "extract-graphql" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "graphql-syntax", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fastrand" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +dependencies = [ + "instant", +] + [[package]] name = "fixedbitset" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +[[package]] +name = "flatbuffers" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4c5738bcd7fad10315029c50026f83c9da5e4a21f8ed66826f43e0e2bde5f6" +dependencies = [ + "bitflags", + "smallvec", + "thiserror", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -465,6 +688,102 @@ dependencies = [ "syn", ] +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + +[[package]] +name = "futures" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" + +[[package]] +name = "futures-executor" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" + +[[package]] +name = "futures-macro" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" + +[[package]] +name = "futures-task" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" + +[[package]] +name = "futures-util" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" +dependencies = [ + "futures 0.1.31", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -476,9 +795,18 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", "version_check", @@ -497,9 +825,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" dependencies = [ "cfg-if 1.0.0", "libc", @@ -518,6 +846,88 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "graphql-cli" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "colored", + "common", +] + +[[package]] +name = "graphql-ir" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "errors", + "fnv", + "graphql-syntax", + "intern", + "lazy_static", + "once_cell", + "schema", + "strsim 0.10.0", + "thiserror", +] + +[[package]] +name = "graphql-syntax" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "intern", + "logos", + "lsp-types", + "serde", + "thiserror", +] + +[[package]] +name = "graphql-text-printer" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "fnv", + "graphql-ir", + "graphql-syntax", + "intern", + "schema", +] + +[[package]] +name = "graphql-watchman" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "log", + "serde", + "serde_bser", + "watchman_client", +] + +[[package]] +name = "h2" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689" +dependencies = [ + "bytes 1.1.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -525,6 +935,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ "ahash", + "serde", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", ] [[package]] @@ -542,6 +962,86 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "http" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +dependencies = [ + "bytes 1.1.0", + "fnv", + "itoa 1.0.1", +] + +[[package]] +name = "http-body" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +dependencies = [ + "bytes 1.1.0", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + +[[package]] +name = "hyper" +version = "0.14.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" +dependencies = [ + "bytes 1.1.0", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 0.4.8", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes 1.1.0", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -567,23 +1067,48 @@ checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", "hashbrown", - "rayon", + "rayon", + "serde", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "intern" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "fnv", + "hashbrown", + "indexmap", + "once_cell", + "parking_lot", "serde", + "serde_bytes", + "serde_derive", + "smallvec", ] [[package]] -name = "instant" -version = "0.1.12" +name = "iovec" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" dependencies = [ - "cfg-if 1.0.0", + "libc", ] [[package]] @@ -601,9 +1126,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -614,6 +1139,31 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + +[[package]] +name = "js-config-loader" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "js-sys" version = "0.3.49" @@ -654,9 +1204,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.108" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "lock_api" @@ -674,6 +1224,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ "cfg-if 1.0.0", + "value-bag", +] + +[[package]] +name = "logos" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91c49573597a5d6c094f9031617bb1fed15c0db68c81e6546d313414ce107e4" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-derive" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "797b1f8a0571b331c1b47e7db245af3dc634838da7a92b3bef4e30376ae1c347" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax", + "syn", + "utf8-ranges", ] [[package]] @@ -685,6 +1260,25 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "lsp-types" +version = "0.89.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e0dedfd52cc32325598b2631e0eba31b7b708959676a9f837042f276b09a2" +dependencies = [ + "bitflags", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + [[package]] name = "matchers" version = "0.1.0" @@ -700,6 +1294,17 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "md-5" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "opaque-debug 0.2.3", +] + [[package]] name = "memchr" version = "2.4.1" @@ -708,9 +1313,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -751,6 +1356,28 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mio" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + [[package]] name = "napi" version = "1.8.0" @@ -765,9 +1392,9 @@ dependencies = [ [[package]] name = "napi-build" -version = "1.1.2" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d46af3cd13ef452354c8704da88bfc4bfa38724ddb38963a5113099749710788" +checksum = "ebd4419172727423cf30351406c54f6cc1b354a2cfb4f1dba3e6cd07f6d5522b" [[package]] name = "napi-derive" @@ -786,6 +1413,24 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf20e0081fea04e044aa4adf74cfea8ddc0324eec2894b1c700f4cafc72a56" +[[package]] +name = "native-tls" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -797,11 +1442,16 @@ name = "next-swc" version = "0.0.0" dependencies = [ "chrono", + "common", "easy-error", "either", "fxhash", + "intern", + "once_cell", "pathdiff", "regex", + "relay-compiler", + "relay-config", "serde", "serde_json", "styled_components", @@ -862,6 +1512,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi", +] + [[package]] name = "num-bigint" version = "0.2.6" @@ -895,9 +1554,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -914,9 +1573,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" + +[[package]] +name = "opaque-debug" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "opaque-debug" @@ -924,15 +1589,71 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "ordered-float" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97c9d06878b3a851e8026ef94bf7fef9ba93062cd412601da4d9cf369b1cc62d" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" dependencies = [ "num-traits", ] +[[package]] +name = "ouroboros" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d5c203fe8d786d9d7bec8203cbbff3eb2cf8410c0d70cfd05b3d5f5d545da" +dependencies = [ + "ouroboros_macro", + "stable_deref_trait", +] + +[[package]] +name = "ouroboros_macro" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129943a960e6a08c7e70ca5a09f113c273fe7f10ae8420992c78293e3dffdf65" +dependencies = [ + "Inflector", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "output_vt100" version = "0.1.2" @@ -953,9 +1674,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", @@ -964,15 +1685,14 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.0" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", + "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.1.57", + "redox_syscall", "smallvec", "winapi", ] @@ -995,6 +1715,19 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "persist-query" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "hyper", + "hyper-tls", + "serde", + "serde_json", + "thiserror", + "url", +] + [[package]] name = "petgraph" version = "0.5.1" @@ -1023,7 +1756,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ "phf_shared", - "rand 0.7.3", + "rand", ] [[package]] @@ -1051,9 +1784,21 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "pmutil" @@ -1068,9 +1813,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "precomputed-hash" @@ -1122,18 +1867,24 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.32" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" -version = "1.0.10" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" dependencies = [ "proc-macro2", ] @@ -1152,24 +1903,12 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc 0.2.0", + "rand_chacha", + "rand_core", + "rand_hc", "rand_pcg", ] -[[package]] -name = "rand" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.3", - "rand_hc 0.3.1", -] - [[package]] name = "rand_chacha" version = "0.2.2" @@ -1177,17 +1916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.3", + "rand_core", ] [[package]] @@ -1199,31 +1928,13 @@ dependencies = [ "getrandom 0.1.16", ] -[[package]] -name = "rand_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" -dependencies = [ - "getrandom 0.2.3", -] - [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", + "rand_core", ] [[package]] @@ -1232,7 +1943,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core", ] [[package]] @@ -1260,12 +1971,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.10" @@ -1302,10 +2007,146 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] -name = "relative-path" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9629de8974fd69c97684736786b807edd3da456d3e3f95341dd9d4cbd8f5ad6" +name = "relative-path" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73d4caf086b102ab49d0525b721594a555ab55c6556086bbe52a430ad26c3bd7" + +[[package]] +name = "relay-codegen" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "fnv", + "graphql-ir", + "graphql-syntax", + "hex", + "indexmap", + "intern", + "lazy_static", + "md-5", + "relay-config", + "relay-transforms", + "schema", +] + +[[package]] +name = "relay-compiler" +version = "13.0.1" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "async-trait", + "bincode", + "common", + "common-path", + "dashmap", + "dependency-analyzer", + "env_logger", + "errors", + "extract-graphql", + "fnv", + "futures 0.3.19", + "glob", + "graphql-cli", + "graphql-ir", + "graphql-syntax", + "graphql-text-printer", + "graphql-watchman", + "hex", + "indexmap", + "intern", + "js-config-loader", + "lazy_static", + "log", + "md-5", + "persist-query", + "rayon", + "regex", + "relay-codegen", + "relay-config", + "relay-schema", + "relay-transforms", + "relay-typegen", + "schema", + "schema-diff", + "serde", + "serde_bser", + "serde_json", + "sha-1 0.8.2", + "signedsource", + "structopt", + "thiserror", + "tokio", + "walkdir", + "watchman_client", + "zstd", +] + +[[package]] +name = "relay-config" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "fnv", + "indexmap", + "intern", + "regex", + "serde", + "serde_json", +] + +[[package]] +name = "relay-schema" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "intern", + "schema", +] + +[[package]] +name = "relay-transforms" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "dashmap", + "errors", + "fnv", + "graphql-ir", + "graphql-syntax", + "graphql-text-printer", + "indexmap", + "intern", + "itertools", + "lazy_static", + "once_cell", + "parking_lot", + "regex", + "relay-config", + "schema", + "thiserror", +] + +[[package]] +name = "relay-typegen" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "fnv", + "graphql-ir", + "indexmap", + "intern", + "itertools", + "lazy_static", + "relay-config", + "relay-transforms", + "schema", +] [[package]] name = "remove_dir_all" @@ -1318,9 +2159,9 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "448296241d034b96c11173591deaa1302f2c17b56092106c1f92c1bc0183a8c9" +checksum = "11000e6ba5020e53e7cc26f73b91ae7d5496b4977851479edb66b694c0675c21" [[package]] name = "rustc-demangle" @@ -1345,9 +2186,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "same-file" @@ -1358,6 +2199,55 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi", +] + +[[package]] +name = "schema" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "dashmap", + "flatbuffers", + "fnv", + "graphql-syntax", + "intern", + "lazy_static", + "ouroboros", + "schema-flatbuffer", + "thiserror", +] + +[[package]] +name = "schema-diff" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "common", + "fnv", + "graphql-syntax", + "intern", + "lazy_static", + "relay-config", + "schema", +] + +[[package]] +name = "schema-flatbuffer" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "flatbuffers", +] + [[package]] name = "scoped-tls" version = "1.0.0" @@ -1370,6 +2260,29 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d09d3c15d814eda1d6a836f2f2b56a6abc1446c8a34351cb3180d3db92ffe4ce" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e90dd10c41c6bfc633da6e0c659bd25d31e0791e5974ac42970267d59eba87f7" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "0.9.0" @@ -1415,6 +2328,28 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "serde_bser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b929ea725591083cbca8b8ea178ed6efc918eccd40b784e199ce88967104199" +dependencies = [ + "anyhow", + "byteorder", + "bytes 0.4.12", + "serde", + "thiserror", +] + +[[package]] +name = "serde_bytes" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.133" @@ -1428,11 +2363,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.72" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527" +checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" dependencies = [ - "itoa", + "itoa 1.0.1", "ryu", "serde", ] @@ -1447,17 +2382,40 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + [[package]] name = "sha-1" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest", - "opaque-debug", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -1469,17 +2427,56 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "signedsource" +version = "0.0.0" +source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" +dependencies = [ + "hex", + "lazy_static", + "md-5", + "regex", +] + [[package]] name = "siphasher" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" +[[package]] +name = "slab" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" + [[package]] name = "smallvec" -version = "1.7.0" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +dependencies = [ + "libc", + "winapi", +] [[package]] name = "sourcemap" @@ -1570,12 +2567,48 @@ dependencies = [ "syn", ] +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + [[package]] name = "strsim" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "structopt" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" +dependencies = [ + "clap", + "lazy_static", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "styled_components" version = "0.13.0" @@ -1592,6 +2625,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "sval" +version = "1.0.0-alpha.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" + [[package]] name = "swc" version = "0.117.2" @@ -2142,7 +3181,7 @@ dependencies = [ "once_cell", "regex", "serde", - "sha-1", + "sha-1 0.9.8", "string_enum", "swc_atoms", "swc_common", @@ -2165,7 +3204,7 @@ dependencies = [ "hex", "serde", "serde_json", - "sha-1", + "sha-1 0.9.8", "swc_common", "swc_ecma_ast", "swc_ecma_codegen", @@ -2367,14 +3406,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if 1.0.0", + "fastrand", "libc", - "rand 0.8.4", - "redox_syscall 0.2.10", + "redox_syscall", "remove_dir_all", "winapi", ] @@ -2408,9 +3447,9 @@ dependencies = [ [[package]] name = "testing_macros" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6976b6f5ffd18755bef29dce0e9e882382d53bc1ed9d414ccd5c0ee7346bc2" +checksum = "adfb26385ca4db3f8aa680824013819e3b9f8d9a1b64b4f83a411e09a61f11c3" dependencies = [ "anyhow", "glob", @@ -2422,6 +3461,15 @@ dependencies = [ "syn", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.30" @@ -2476,6 +3524,69 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +[[package]] +name = "tokio" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" +dependencies = [ + "bytes 1.1.0", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "tracing", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +dependencies = [ + "bytes 1.1.0", + "futures-core", + "futures-io", + "futures-sink", + "log", + "pin-project-lite", + "slab", + "tokio", +] + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + [[package]] name = "tracing" version = "0.1.29" @@ -2537,6 +3648,12 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typed-arena" version = "2.0.1" @@ -2545,9 +3662,9 @@ checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" @@ -2564,6 +3681,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" + [[package]] name = "unicode-width" version = "0.1.9" @@ -2595,13 +3718,43 @@ dependencies = [ "idna", "matches", "percent-encoding", + "serde", +] + +[[package]] +name = "utf8-ranges" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" + +[[package]] +name = "value-bag" +version = "1.0.0-alpha.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" +dependencies = [ + "ctor", + "sval", + "version_check", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -2620,6 +3773,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -2720,6 +3883,24 @@ version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" +[[package]] +name = "watchman_client" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1afbab1186833c9b34f64132b80ed4b373ed4eab6f9efa1f55430835200f0a28" +dependencies = [ + "anyhow", + "bytes 1.1.0", + "futures 0.3.19", + "maplit", + "serde", + "serde_bser", + "thiserror", + "tokio", + "tokio-util", + "winapi", +] + [[package]] name = "web-sys" version = "0.3.49" @@ -2760,3 +3941,32 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "zstd" +version = "0.8.0+zstd.1.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afab5e288c9e10bcd910b16ad82cb8028b74b09eccaa5ecd90621f99d3380735" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "4.0.0+zstd.1.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f02c0811d5455aa82c6bc400cffd8c882f3a2813f5e2245e2b264443305ab2" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.5.0+zstd.1.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e6c094340240369025fc6b731b054ee2a834328fa584310ac96aa4baebdc465" +dependencies = [ + "cc", + "libc", +] diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 0ccf231f91488..3c80ae0d3661f 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -8,6 +8,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] chrono = "0.4" +once_cell = "1.8.0" easy-error = "1.0.0" either = "1" fxhash = "0.2.1" @@ -26,6 +27,12 @@ swc_stylis = "0.43.0" tracing = {version = "0.1.28", features = ["release_max_level_off"]} regex = "1.5" +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +relay-compiler = { git = "https://github.com/facebook/relay", tag="v13.0.1" } +relay-compiler-intern = { package="intern", git = "https://github.com/facebook/relay", tag="v13.0.1" } +relay-compiler-common = { package = "common", git = "https://github.com/facebook/relay", tag="v13.0.1" } +relay-config = { git = "https://github.com/facebook/relay", tag="v13.0.1" } + [dev-dependencies] swc_ecma_transforms_testing = "0.59.0" testing = "0.18.0" diff --git a/packages/next-swc/crates/core/src/lib.rs b/packages/next-swc/crates/core/src/lib.rs index 1a36b3b2b5693..4d147f5a475b7 100644 --- a/packages/next-swc/crates/core/src/lib.rs +++ b/packages/next-swc/crates/core/src/lib.rs @@ -53,6 +53,8 @@ pub mod next_dynamic; pub mod next_ssg; pub mod page_config; pub mod react_remove_properties; +#[cfg(not(target_arch = "wasm32"))] +pub mod relay; pub mod remove_console; pub mod shake_exports; pub mod styled_jsx; @@ -91,6 +93,9 @@ pub struct TransformOptions { #[serde(default)] pub react_remove_properties: Option, + #[serde(default)] + pub relay: bool, + #[serde(default)] pub shake_exports: Option, } @@ -100,6 +105,17 @@ pub fn custom_before_pass( file: Arc, opts: &TransformOptions, ) -> impl Fold { + #[cfg(target_arch = "wasm32")] + let relay_plugin = noop(); + + #[cfg(not(target_arch = "wasm32"))] + let relay_plugin = { + match &opts.relay { + true => Either::Left(relay::relay(file.name.clone())), + false => Either::Right(noop()), + } + }; + chain!( disallow_re_export_all_in_page::disallow_re_export_all_in_page(opts.is_page_file), styled_jsx::styled_jsx(cm.clone()), @@ -130,6 +146,7 @@ pub fn custom_before_pass( page_config::page_config(opts.is_development, opts.is_page_file), !opts.disable_page_config ), + relay_plugin, match &opts.remove_console { Some(config) if config.truthy() => Either::Left(remove_console::remove_console(config.clone())), diff --git a/packages/next-swc/crates/core/src/relay.rs b/packages/next-swc/crates/core/src/relay.rs new file mode 100644 index 0000000000000..d3b655a0bdd11 --- /dev/null +++ b/packages/next-swc/crates/core/src/relay.rs @@ -0,0 +1,277 @@ +use once_cell::sync::Lazy; +use pathdiff::diff_paths; +use regex::Regex; +use relay_compiler::compiler_state::{SourceSet, SourceSetName}; +use relay_compiler::{create_path_for_artifact, FileCategorizer, FileGroup, ProjectConfig}; +use relay_compiler_common::SourceLocationKey; +use serde::Deserialize; +use std::borrow::Cow; +use std::path::{Path, PathBuf}; +use swc_atoms::JsWord; +use swc_common::errors::HANDLER; +use swc_common::FileName; +use swc_ecmascript::ast::*; +use swc_ecmascript::utils::{quote_ident, ExprFactory}; +use swc_ecmascript::visit::{Fold, FoldWith}; + +#[derive(Copy, Clone, Debug, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum RelayLanguageConfig { + Typescript, + Flow, +} + +struct Relay { + file_name: FileName, + relay_config_for_tests: Option, +} + +fn pull_first_operation_name_from_tpl(tpl: &TaggedTpl) -> Option { + tpl.tpl.quasis.iter().find_map(|quasis| { + static OPERATION_REGEX: Lazy = + Lazy::new(|| Regex::new(r"(fragment|mutation|query|subscription) (\w+)").unwrap()); + + let capture_group = OPERATION_REGEX.captures_iter(&quasis.raw.value).next(); + + match capture_group { + None => None, + Some(capture_group) => Some(capture_group[2].to_string()), + } + }) +} + +fn build_require_expr_from_path(path: &str) -> Expr { + Expr::Call(CallExpr { + span: Default::default(), + callee: quote_ident!("require").as_callee(), + args: vec![Lit::Str(Str { + span: Default::default(), + value: JsWord::from(path), + has_escape: false, + kind: Default::default(), + }) + .as_arg()], + type_args: None, + }) +} + +impl Fold for Relay { + fn fold_expr(&mut self, expr: Expr) -> Expr { + let expr = expr.fold_children_with(self); + + match &expr { + Expr::TaggedTpl(tpl) => { + if let Some(built_expr) = self.build_call_expr_from_tpl(tpl) { + built_expr + } else { + expr + } + } + _ => expr, + } + } +} + +#[derive(Debug)] +enum BuildRequirePathError<'a> { + FileNameNotReal, + MultipleSourceSetsFound { + source_set_names: Vec, + path: &'a PathBuf, + }, + ProjectNotFoundForSourceSet { + source_set_name: SourceSetName, + }, + FileNotASourceFile, + CouldNotCategorize { + err: Cow<'static, str>, + path: String, + }, +} + +// This is copied from https://github.com/facebook/relay/blob/main/compiler/crates/relay-compiler/src/build_project/generate_artifacts.rs#L251 +// until the Relay team exposes it for external use. +fn path_for_artifact( + root_dir: &Path, + source_path: &Path, + project_config: &ProjectConfig, + definition_name: &str, +) -> PathBuf { + let source_file_location_key = SourceLocationKey::Standalone { + path: source_path.to_str().unwrap().parse().unwrap(), + }; + let filename = if let Some(filename_for_artifact) = &project_config.filename_for_artifact { + filename_for_artifact(source_file_location_key, definition_name.parse().unwrap()) + } else { + match &project_config.typegen_config.language { + relay_config::TypegenLanguage::Flow => format!("{}.graphql.js", definition_name), + relay_config::TypegenLanguage::TypeScript => { + format!("{}.graphql.ts", definition_name) + } + } + }; + + let output_path = create_path_for_artifact(project_config, source_file_location_key, filename); + + if project_config.output.is_some() { + let absolute_output_path = root_dir.join(&output_path); + + let diffed_path = + diff_paths(&absolute_output_path, &source_path.parent().unwrap()).unwrap(); + + return diffed_path; + } + + output_path +} +impl Relay { + fn build_require_path( + &mut self, + operation_name: &str, + ) -> Result { + match &self.relay_config_for_tests { + Some(config) => match &self.file_name { + FileName::Real(real_file_path) => Ok(path_for_artifact( + &std::env::current_dir().unwrap(), + &real_file_path, + config, + operation_name, + )), + _ => Err(BuildRequirePathError::FileNameNotReal), + }, + _ => { + let config = + relay_compiler::config::Config::search(&std::env::current_dir().unwrap()) + .unwrap(); + + let categorizer = FileCategorizer::from_config(&config); + + match &self.file_name { + FileName::Real(real_file_name) => { + // Make sure we have a path which is relative to the config. + // Otherwise, categorize won't be able to recognize that + // the absolute source path is a child of a source set. + let diffed_path = diff_paths(real_file_name, &config.root_dir).unwrap(); + + let group = categorizer.categorize(diffed_path.as_path()); + + match group { + Ok(group) => match group { + FileGroup::Source { source_set } => match source_set { + SourceSet::SourceSetName(source_set_name) => { + let project_config: Option<&ProjectConfig> = + config.projects.get(&source_set_name); + + match project_config { + None => Err(BuildRequirePathError::ProjectNotFoundForSourceSet { source_set_name }), + Some(project_config) => { + Ok(path_for_artifact(&config.root_dir,real_file_name, &project_config, operation_name)) + } + } + } + SourceSet::SourceSetNames(source_set_names) => { + Err(BuildRequirePathError::MultipleSourceSetsFound { + source_set_names, + path: real_file_name, + }) + } + }, + _ => Err(BuildRequirePathError::FileNotASourceFile), + }, + Err(err) => Err(BuildRequirePathError::CouldNotCategorize { + err, + path: real_file_name.display().to_string(), + }), + } + } + _ => Err(BuildRequirePathError::FileNameNotReal), + } + } + } + } + + fn build_call_expr_from_tpl(&mut self, tpl: &TaggedTpl) -> Option { + if let Expr::Ident(ident) = &*tpl.tag { + if &*ident.sym != "graphql" { + return None; + } + } + + let operation_name = pull_first_operation_name_from_tpl(tpl); + + match operation_name { + None => None, + Some(operation_name) => match self.build_require_path(operation_name.as_str()) { + Ok(final_path) => Some(build_require_expr_from_path(final_path.to_str().unwrap())), + Err(err) => { + let base_error = "Could not transform GraphQL template to a Relay import."; + let error_message = match err { + BuildRequirePathError::FileNameNotReal => "Source file was not a real \ + file. This is likely a bug and \ + should be reported to Next.js" + .to_string(), + BuildRequirePathError::MultipleSourceSetsFound { + source_set_names, + path, + } => { + format!( + "Multiple source sets were found for file: {}. Found source sets: \ + [{}]. We could not determine the project config to use for the \ + source file. Please consider narrowing down your source sets.", + path.to_str().unwrap(), + source_set_names + .iter() + .map(|name| name.lookup()) + .collect::>() + .join(", ") + ) + } + BuildRequirePathError::ProjectNotFoundForSourceSet { source_set_name } => { + format!( + "Project could not be found for the source set: {}", + source_set_name + ) + } + BuildRequirePathError::FileNotASourceFile => { + "This file was not considered a source file by the Relay Compiler. \ + This is likely a bug and should be reported to Next.js" + .to_string() + } + BuildRequirePathError::CouldNotCategorize { path, err } => { + format!( + "Relay was unable to categorize the file at: {}. Ensure your \ + `src` path includes this file in `relay.config.js` The \ + underlying error is: {}. \n\nThis is likely a bug and should be \ + reported to Next.js", + path, err + ) + } + }; + + HANDLER.with(|handler| { + handler.span_err( + tpl.span, + format!("{} {}", base_error, error_message).as_str(), + ); + }); + + None + } + }, + } + } +} + +pub fn relay(file_name: FileName) -> impl Fold { + Relay { + file_name, + relay_config_for_tests: None, + } +} + +pub fn test_relay(file_name: FileName, relay_config_for_tests: ProjectConfig) -> impl Fold { + Relay { + file_name, + relay_config_for_tests: Some(relay_config_for_tests), + } +} diff --git a/packages/next-swc/crates/core/tests/fixture.rs b/packages/next-swc/crates/core/tests/fixture.rs index f575c26c3d8c4..dfb212f85f36d 100644 --- a/packages/next-swc/crates/core/tests/fixture.rs +++ b/packages/next-swc/crates/core/tests/fixture.rs @@ -1,3 +1,4 @@ +use next_swc::relay::test_relay; use next_swc::{ amp_attributes::amp_attributes, next_dynamic::next_dynamic, @@ -8,6 +9,8 @@ use next_swc::{ shake_exports::{shake_exports, Config as ShakeExportsConfig}, styled_jsx::styled_jsx, }; +use relay_compiler::ProjectConfig; +use relay_config::TypegenLanguage; use std::path::PathBuf; use swc_common::{chain, comments::SingleThreadedComments, FileName, Mark, Span, DUMMY_SP}; use swc_ecma_transforms_testing::{test, test_fixture}; @@ -149,6 +152,22 @@ fn page_config_fixture(input: PathBuf) { test_fixture(syntax(), &|_tr| page_config_test(), &input, &output); } +#[fixture("tests/fixture/relay/**/input.ts*")] +fn relay_no_artifact_dir_fixture(input: PathBuf) { + let output = input.parent().unwrap().join("output.js"); + test_fixture( + syntax(), + &|_tr| { + let mut config = ProjectConfig::default(); + config.typegen_config.language = TypegenLanguage::TypeScript; + + test_relay(FileName::Real(PathBuf::from("input.tsx")), config) + }, + &input, + &output, + ); +} + #[fixture("tests/fixture/remove-console/**/input.js")] fn remove_console_fixture(input: PathBuf) { let output = input.parent().unwrap().join("output.js"); diff --git a/packages/next-swc/crates/core/tests/fixture/relay/input.tsx b/packages/next-swc/crates/core/tests/fixture/relay/input.tsx new file mode 100644 index 0000000000000..8bc789841d4e1 --- /dev/null +++ b/packages/next-swc/crates/core/tests/fixture/relay/input.tsx @@ -0,0 +1,42 @@ +const variableQuery = graphql` + query InputVariableQuery { + hello + } +` + +fetchQuery(graphql` + query InputUsedInFunctionCallQuery { + hello + } +`) + +function SomeQueryComponent() { + useLazyLoadQuery(graphql` + query InputInHookQuery { + hello + } + `) +} + +const variableMutation = graphql` + query InputVariableMutation { + someMutation + } +` + +commitMutation( + environment, + graphql` + query InputUsedInFunctionCallMutation { + someMutation + } + ` +) + +function SomeMutationComponent() { + useMutation(graphql` + query InputInHookMutation { + someMutation + } + `) +} \ No newline at end of file diff --git a/packages/next-swc/crates/core/tests/fixture/relay/output.js b/packages/next-swc/crates/core/tests/fixture/relay/output.js new file mode 100644 index 0000000000000..bf391cc8ff397 --- /dev/null +++ b/packages/next-swc/crates/core/tests/fixture/relay/output.js @@ -0,0 +1,13 @@ +const variableQuery = require('__generated__/InputVariableQuery.graphql.ts') +fetchQuery(require('__generated__/InputUsedInFunctionCallQuery.graphql.ts')) +function SomeQueryComponent() { + useLazyLoadQuery(require('__generated__/InputInHookQuery.graphql.ts')) +} +const variableMutation = require('__generated__/InputVariableMutation.graphql.ts') +commitMutation( + environment, + require('__generated__/InputUsedInFunctionCallMutation.graphql.ts') +) +function SomeMutationComponent() { + useMutation(require('__generated__/InputInHookMutation.graphql.ts')) +} diff --git a/packages/next-swc/crates/core/tests/full.rs b/packages/next-swc/crates/core/tests/full.rs index 834b14748d920..80c5bb0519513 100644 --- a/packages/next-swc/crates/core/tests/full.rs +++ b/packages/next-swc/crates/core/tests/full.rs @@ -59,6 +59,7 @@ fn test(input: &Path, minify: bool) { styled_components: Some(assert_json("{}")), remove_console: None, react_remove_properties: None, + relay: false, shake_exports: None, }; diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index ba836eb72c317..357fd01d81f12 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib"] anyhow = "1.0.42" console_error_panic_hook = "0.1.6" once_cell = "1.3.1" -parking_lot_core = "=0.8.0" +parking_lot_core = "=0.8.5" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" diff --git a/packages/next/build/swc/options.js b/packages/next/build/swc/options.js index 103119885e47b..27bf7878acce6 100644 --- a/packages/next/build/swc/options.js +++ b/packages/next/build/swc/options.js @@ -75,6 +75,7 @@ function getBaseSWCOptions({ : null, removeConsole: nextConfig?.experimental?.removeConsole, reactRemoveProperties: nextConfig?.experimental?.reactRemoveProperties, + relay: nextConfig?.experimental?.relay, } } diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index ddd269cac3b80..d16f10b7631ff 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -1617,6 +1617,7 @@ export default async function getBaseWebpackConfig( removeConsole: config.experimental.removeConsole, reactRemoveProperties: config.experimental.reactRemoveProperties, styledComponents: config.experimental.styledComponents, + relay: config.experimental.relay, }) const cache: any = { diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 7b22fd471a450..3a098d055e520 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -172,6 +172,7 @@ export type NextConfig = { [key: string]: any } & { urlImports?: NonNullable['buildHttp'] outputFileTracingRoot?: string outputStandalone?: boolean + relay?: boolean } } diff --git a/test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts b/test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts new file mode 100644 index 0000000000000..3963e412c6151 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts @@ -0,0 +1,63 @@ +/** + * @generated SignedSource<<187ead9fb6e7b26d71c9161bda6ab902>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest, Query } from 'relay-runtime' +export type pagesQuery$variables = {} +export type pagesQueryVariables = pagesQuery$variables +export type pagesQuery$data = { + readonly greeting: string +} +export type pagesQueryResponse = pagesQuery$data +export type pagesQuery = { + variables: pagesQueryVariables + response: pagesQuery$data +} + +const node: ConcreteRequest = (function () { + var v0 = [ + { + alias: null, + args: null, + kind: 'ScalarField', + name: 'greeting', + storageKey: null, + }, + ] + return { + fragment: { + argumentDefinitions: [], + kind: 'Fragment', + metadata: null, + name: 'pagesQuery', + selections: v0 /*: any*/, + type: 'Query', + abstractKey: null, + }, + kind: 'Request', + operation: { + argumentDefinitions: [], + kind: 'Operation', + name: 'pagesQuery', + selections: v0 /*: any*/, + }, + params: { + cacheID: '167b6de16340efeb876a7787c90e7cec', + id: null, + metadata: {}, + name: 'pagesQuery', + operationKind: 'query', + text: 'query pagesQuery {\n greeting\n}\n', + }, + } +})() + +;(node as any).hash = '4017856344f36f61252354e2eb442d98' + +export default node diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js b/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js new file mode 100644 index 0000000000000..80e35cc588f55 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js @@ -0,0 +1,6 @@ +module.exports = { + experimental: { + relay: true, + externalDir: true, + }, +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/pages/api/query.ts b/test/integration/relay-graphql-swc-multi-project/project-a/pages/api/query.ts new file mode 100644 index 0000000000000..5ad51e06bc09b --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-a/pages/api/query.ts @@ -0,0 +1,12 @@ +import { NextApiRequest, NextApiResponse } from 'next' + +export default function handler( + req: NextApiRequest, + res: NextApiResponse<{ data: { greeting: string } }> +) { + res.status(200).json({ + data: { + greeting: 'Hello, World!', + }, + }) +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx b/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx new file mode 100644 index 0000000000000..c70a9e48aeb6b --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx @@ -0,0 +1,63 @@ +import { + Environment, + FetchFunction, + fetchQuery, + graphql, + Network, + RecordSource, + Store, +} from 'relay-runtime' +import { GetServerSideProps } from 'next' +import { pagesQuery } from '../../__generated__/pagesQuery.graphql' + +type Props = { greeting: string } + +export default function Index({ greeting }: Props) { + return

Project A:{greeting}

+} + +function createGraphQLFetcher(host: string | undefined): FetchFunction { + return async function fetchGraphQL(params, variables) { + const url = host ? `http://${host}/api/query` : `/api/query` + + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + query: params.text, + variables, + }), + }) + + return await response.json() + } +} + +export const getServerSideProps: GetServerSideProps = async ({ req }) => { + const environment = new Environment({ + store: new Store(new RecordSource({}), {}), + network: Network.create(createGraphQLFetcher(req.headers.host)), + }) + + const result = await fetchQuery( + environment, + graphql` + query pagesQuery { + greeting + } + `, + {} + ).toPromise() + + if (!result) { + throw new Error( + 'Mock GraphQL Server network request finished without a response!' + ) + } + + return { + props: { greeting: result.greeting }, + } +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/tsconfig.json b/test/integration/relay-graphql-swc-multi-project/project-a/tsconfig.json new file mode 100644 index 0000000000000..a247e53e341ed --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-a/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "esModuleInterop": true, + "module": "esnext", + "jsx": "preserve", + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "incremental": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true + }, + "exclude": ["node_modules"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js b/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js new file mode 100644 index 0000000000000..80e35cc588f55 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js @@ -0,0 +1,6 @@ +module.exports = { + experimental: { + relay: true, + externalDir: true, + }, +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/pages/api/query.ts b/test/integration/relay-graphql-swc-multi-project/project-b/pages/api/query.ts new file mode 100644 index 0000000000000..5ad51e06bc09b --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-b/pages/api/query.ts @@ -0,0 +1,12 @@ +import { NextApiRequest, NextApiResponse } from 'next' + +export default function handler( + req: NextApiRequest, + res: NextApiResponse<{ data: { greeting: string } }> +) { + res.status(200).json({ + data: { + greeting: 'Hello, World!', + }, + }) +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx b/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx new file mode 100644 index 0000000000000..547d72f775ef7 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx @@ -0,0 +1,63 @@ +import { + Environment, + FetchFunction, + fetchQuery, + graphql, + Network, + RecordSource, + Store, +} from 'relay-runtime' +import { GetServerSideProps } from 'next' +import { pagesQuery } from '../../__generated__/pagesQuery.graphql' + +type Props = { greeting: string } + +export default function Index({ greeting }: Props) { + return

Project B:{greeting}

+} + +function createGraphQLFetcher(host: string | undefined): FetchFunction { + return async function fetchGraphQL(params, variables) { + const url = host ? `http://${host}/api/query` : `/api/query` + + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + query: params.text, + variables, + }), + }) + + return await response.json() + } +} + +export const getServerSideProps: GetServerSideProps = async ({ req }) => { + const environment = new Environment({ + store: new Store(new RecordSource({}), {}), + network: Network.create(createGraphQLFetcher(req.headers.host)), + }) + + const result = await fetchQuery( + environment, + graphql` + query pagesQuery { + greeting + } + `, + {} + ).toPromise() + + if (!result) { + throw new Error( + 'Mock GraphQL Server network request finished without a response!' + ) + } + + return { + props: { greeting: result.greeting }, + } +} diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/tsconfig.json b/test/integration/relay-graphql-swc-multi-project/project-b/tsconfig.json new file mode 100644 index 0000000000000..a247e53e341ed --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "esModuleInterop": true, + "module": "esnext", + "jsx": "preserve", + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "incremental": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true + }, + "exclude": ["node_modules"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] +} diff --git a/test/integration/relay-graphql-swc-multi-project/relay.config.js b/test/integration/relay-graphql-swc-multi-project/relay.config.js new file mode 100644 index 0000000000000..10af186bc62cb --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/relay.config.js @@ -0,0 +1,19 @@ +module.exports = { + root: './', + sources: { + 'project-a/pages': 'project-a', + 'project-b/pages': 'project-b', + }, + projects: { + 'project-a': { + schema: 'schema.graphql', + language: 'typescript', + output: '__generated__', + }, + 'project-b': { + schema: 'schema.graphql', + language: 'typescript', + output: '__generated__', + }, + }, +} diff --git a/test/integration/relay-graphql-swc-multi-project/schema.graphql b/test/integration/relay-graphql-swc-multi-project/schema.graphql new file mode 100644 index 0000000000000..7428cd8c20588 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/schema.graphql @@ -0,0 +1,3 @@ +type Query { + greeting: String! +} diff --git a/test/integration/relay-graphql-swc-multi-project/test/index.test.js b/test/integration/relay-graphql-swc-multi-project/test/index.test.js new file mode 100644 index 0000000000000..605f06c875279 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/test/index.test.js @@ -0,0 +1,89 @@ +/* eslint-env jest */ +import { join } from 'path' +import { execSync } from 'child_process' +import { + findPort, + killApp, + launchApp, + nextBuild, + nextStart, + renderViaHTTP, +} from 'next-test-utils' + +let app +let appPort +const projectAAppDir = join(__dirname, '../project-a') +const projectBAppDir = join(__dirname, '../project-b') + +const runTests = (project) => { + it('should resolve index page correctly', async () => { + const html = await renderViaHTTP(appPort, '/') + expect(html).toContain(project) + expect(html).toContain(`Hello, World!`) + }) +} + +const runRelayCompiler = () => { + // Relay expects the current directory to contain a relay.json + // This ensures the CWD is the one with relay.json since running + // the relay-compiler through yarn would make the root of the repo the CWD. + execSync('../../../node_modules/relay-compiler/cli.js', { + cwd: './test/integration/relay-graphql-swc-multi-project', + }) +} + +describe('Relay Compiler Transform - Multi Project Config', () => { + beforeAll(() => { + runRelayCompiler() + }) + + describe('dev mode', () => { + describe('project-a', () => { + beforeAll(async () => { + appPort = await findPort() + app = await launchApp(projectAAppDir, appPort, { cwd: projectAAppDir }) + }) + + afterAll(() => killApp(app)) + + runTests('Project A') + }) + + describe('project-b', () => { + beforeAll(async () => { + appPort = await findPort() + app = await launchApp(projectBAppDir, appPort, { cwd: projectBAppDir }) + }) + + afterAll(() => killApp(app)) + + runTests('Project B') + }) + }) + + describe('production mode', () => { + describe('project-a', () => { + beforeAll(async () => { + await nextBuild(projectAAppDir, [], { cwd: projectAAppDir }) + appPort = await findPort() + app = await nextStart(projectAAppDir, appPort) + }) + + afterAll(() => killApp(app)) + + runTests('Project A') + }) + + describe('project-b', () => { + beforeAll(async () => { + await nextBuild(projectBAppDir, [], { cwd: projectBAppDir }) + appPort = await findPort() + app = await nextStart(projectBAppDir, appPort) + }) + + afterAll(() => killApp(app)) + + runTests('Project B') + }) + }) +}) diff --git a/test/integration/relay-graphql-swc-single-project/__generated__/pagesQuery.graphql.ts b/test/integration/relay-graphql-swc-single-project/__generated__/pagesQuery.graphql.ts new file mode 100644 index 0000000000000..3963e412c6151 --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/__generated__/pagesQuery.graphql.ts @@ -0,0 +1,63 @@ +/** + * @generated SignedSource<<187ead9fb6e7b26d71c9161bda6ab902>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest, Query } from 'relay-runtime' +export type pagesQuery$variables = {} +export type pagesQueryVariables = pagesQuery$variables +export type pagesQuery$data = { + readonly greeting: string +} +export type pagesQueryResponse = pagesQuery$data +export type pagesQuery = { + variables: pagesQueryVariables + response: pagesQuery$data +} + +const node: ConcreteRequest = (function () { + var v0 = [ + { + alias: null, + args: null, + kind: 'ScalarField', + name: 'greeting', + storageKey: null, + }, + ] + return { + fragment: { + argumentDefinitions: [], + kind: 'Fragment', + metadata: null, + name: 'pagesQuery', + selections: v0 /*: any*/, + type: 'Query', + abstractKey: null, + }, + kind: 'Request', + operation: { + argumentDefinitions: [], + kind: 'Operation', + name: 'pagesQuery', + selections: v0 /*: any*/, + }, + params: { + cacheID: '167b6de16340efeb876a7787c90e7cec', + id: null, + metadata: {}, + name: 'pagesQuery', + operationKind: 'query', + text: 'query pagesQuery {\n greeting\n}\n', + }, + } +})() + +;(node as any).hash = '4017856344f36f61252354e2eb442d98' + +export default node diff --git a/test/integration/relay-graphql-swc-single-project/next.config.js b/test/integration/relay-graphql-swc-single-project/next.config.js new file mode 100644 index 0000000000000..7e32b6ae09cdc --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/next.config.js @@ -0,0 +1,5 @@ +module.exports = { + experimental: { + relay: true, + }, +} diff --git a/test/integration/relay-graphql-swc-single-project/pages/api/query.ts b/test/integration/relay-graphql-swc-single-project/pages/api/query.ts new file mode 100644 index 0000000000000..5ad51e06bc09b --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/pages/api/query.ts @@ -0,0 +1,12 @@ +import { NextApiRequest, NextApiResponse } from 'next' + +export default function handler( + req: NextApiRequest, + res: NextApiResponse<{ data: { greeting: string } }> +) { + res.status(200).json({ + data: { + greeting: 'Hello, World!', + }, + }) +} diff --git a/test/integration/relay-graphql-swc-single-project/pages/index.tsx b/test/integration/relay-graphql-swc-single-project/pages/index.tsx new file mode 100644 index 0000000000000..5b586d43dbd96 --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/pages/index.tsx @@ -0,0 +1,63 @@ +import { + Environment, + FetchFunction, + fetchQuery, + graphql, + Network, + RecordSource, + Store, +} from 'relay-runtime' +import { GetServerSideProps } from 'next' +import { pagesQuery } from '../__generated__/pagesQuery.graphql' + +type Props = { greeting: string } + +export default function Index({ greeting }: Props) { + return

{greeting}

+} + +function createGraphQLFetcher(host: string | undefined): FetchFunction { + return async function fetchGraphQL(params, variables) { + const url = host ? `http://${host}/api/query` : `/api/query` + + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + query: params.text, + variables, + }), + }) + + return await response.json() + } +} + +export const getServerSideProps: GetServerSideProps = async ({ req }) => { + const environment = new Environment({ + store: new Store(new RecordSource({}), {}), + network: Network.create(createGraphQLFetcher(req.headers.host)), + }) + + const result = await fetchQuery( + environment, + graphql` + query pagesQuery { + greeting + } + `, + {} + ).toPromise() + + if (!result) { + throw new Error( + 'Mock GraphQL Server network request finished without a response!' + ) + } + + return { + props: { greeting: result.greeting }, + } +} diff --git a/test/integration/relay-graphql-swc-single-project/relay.config.js b/test/integration/relay-graphql-swc-single-project/relay.config.js new file mode 100644 index 0000000000000..f01ef1932d212 --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/relay.config.js @@ -0,0 +1,6 @@ +module.exports = { + src: 'pages', + schema: './schema.graphql', + artifactDirectory: './__generated__', + language: 'typescript', +} diff --git a/test/integration/relay-graphql-swc-single-project/schema.graphql b/test/integration/relay-graphql-swc-single-project/schema.graphql new file mode 100644 index 0000000000000..7428cd8c20588 --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/schema.graphql @@ -0,0 +1,3 @@ +type Query { + greeting: String! +} diff --git a/test/integration/relay-graphql-swc-single-project/test/index.test.js b/test/integration/relay-graphql-swc-single-project/test/index.test.js new file mode 100644 index 0000000000000..0b19183047878 --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/test/index.test.js @@ -0,0 +1,57 @@ +/* eslint-env jest */ +import { join } from 'path' +import { execSync } from 'child_process' +import { + findPort, + killApp, + launchApp, + nextBuild, + nextStart, + renderViaHTTP, +} from 'next-test-utils' + +let app +let appPort +const appDir = join(__dirname, '../') + +const runTests = () => { + it('should resolve index page correctly', async () => { + const html = await renderViaHTTP(appPort, '/') + expect(html).toContain('Hello, World!') + }) +} + +const runRelayCompiler = () => { + // Relay expects the current directory to contain a relay.json + // This ensures the CWD is the one with relay.json since running + // the relay-compiler through yarn would make the root of the repo the CWD. + execSync('../../../node_modules/relay-compiler/cli.js', { + cwd: './test/integration/relay-graphql-swc-single-project', + }) +} + +describe('Relay Compiler Transform - Single Project Config', () => { + describe('dev mode', () => { + beforeAll(async () => { + runRelayCompiler() + appPort = await findPort() + app = await launchApp(appDir, appPort, { cwd: appDir }) + }) + afterAll(() => killApp(app)) + + runTests() + }) + + describe('production mode', () => { + beforeAll(async () => { + runRelayCompiler() + await nextBuild(appDir, [], { cwd: appDir }) + appPort = await findPort() + app = await nextStart(appDir, appPort) + }) + + afterAll(() => killApp(app)) + + runTests() + }) +}) diff --git a/test/integration/relay-graphql-swc-single-project/tsconfig.json b/test/integration/relay-graphql-swc-single-project/tsconfig.json new file mode 100644 index 0000000000000..a247e53e341ed --- /dev/null +++ b/test/integration/relay-graphql-swc-single-project/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "esModuleInterop": true, + "module": "esnext", + "jsx": "preserve", + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "incremental": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true + }, + "exclude": ["node_modules"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"] +} diff --git a/yarn.lock b/yarn.lock index b376efc5417db..86bef3f03fd49 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2260,6 +2260,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.0.0": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa" + integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/runtime@^7.10.2": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.13.tgz#0a21452352b02542db0ffb928ac2d3ca7cb6d66d" @@ -4794,6 +4801,11 @@ "@types/prop-types" "*" csstype "^2.2.0" +"@types/relay-runtime@13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@types/relay-runtime/-/relay-runtime-13.0.0.tgz#d0009275522ff826f2e4dab40419f2db58417ecf" + integrity sha512-yzv6F8EZPWA2rtfFP2qMluS8tsz1q4lfdYxLegCshdAjX5uqxTR2pAliATj9wrzD6OMZF4fl9aU+Y+zmSfm2EA== + "@types/resolve@1.17.1": version "1.17.1" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" @@ -7850,6 +7862,13 @@ cross-fetch@3.0.6, cross-fetch@^3.0.6: dependencies: node-fetch "2.6.1" +cross-fetch@^3.0.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.4.tgz#9723f3a3a247bf8b89039f3a380a9244e8fa2f39" + integrity sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ== + dependencies: + node-fetch "2.6.1" + cross-spawn-async@^2.1.1: version "2.2.5" resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc" @@ -9720,6 +9739,24 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.2.tgz#dfae08a85c66a58372993ce2caf30863f569ff94" + integrity sha512-qv+boqYndjElAJHNN3NoM8XuwQZ1j2m3kEvTgdle8IDjr6oUbkEpvABWtj/rQl3vq4ew7dnElBxL4YJAwTVqQQ== + dependencies: + cross-fetch "^3.0.4" + fbjs-css-vars "^1.0.0" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.30" + fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -11419,6 +11456,13 @@ interpret@^2.2.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== +invariant@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + ip@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" @@ -13379,7 +13423,7 @@ longest-streak@^2.0.0: resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4" integrity sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg== -loose-envify@^1.1.0, loose-envify@^1.4.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: @@ -16615,6 +16659,13 @@ promise@8.0.1: dependencies: asap "~2.0.3" +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + prompts@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.1.0.tgz#bf90bc71f6065d255ea2bdc0fe6520485c1b45db" @@ -17345,6 +17396,20 @@ rehype-retext@^2.0.1: dependencies: hast-util-to-nlcst "^1.0.0" +relay-compiler@13.0.1: + version "13.0.1" + resolved "https://registry.yarnpkg.com/relay-compiler/-/relay-compiler-13.0.1.tgz#09c713647aa7e1d8cf3de9f7fb4ee6a76b32cf26" + integrity sha512-C/qJ7IdfZ140b9JaNpuAP6WhV/Odt/tIq4sUZoTwsaOlhs+1Zu3fvIOoWKTnZT5PC6krRuw1hD7GSX6/paVpTQ== + +relay-runtime@13.0.1: + version "13.0.1" + resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-13.0.1.tgz#7e59a07c3b4e8c58d04bc94f6f978822d4128ffb" + integrity sha512-n/+J8PFfLFPVUcz9OG/z2i+adnfk0INwlTkVTw0V6KJe9NI9plc5eRCJwzzwspT4pdCkis5Lcjzvzp4H+0zn8g== + dependencies: + "@babel/runtime" "^7.0.0" + fbjs "^3.0.2" + invariant "^2.2.4" + release@6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/release/-/release-6.3.0.tgz#bbd351d7460948f1ed55ea02b4b2393f98a1637a" @@ -18103,7 +18168,7 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@1.0.5, setimmediate@^1.0.4: +setimmediate@1.0.5, setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= @@ -19751,6 +19816,11 @@ ua-parser-js@0.7.28: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g== +ua-parser-js@^0.7.30: + version "0.7.31" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6" + integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ== + uglify-js@^3.1.4: version "3.7.3" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.3.tgz#f918fce9182f466d5140f24bb0ff35c2d32dcc6a" From 6b1beabbfb9e762d2598f8e1742e8a193d6f89ac Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 27 Jan 2022 10:25:17 -0600 Subject: [PATCH 02/15] enable release builds for debugging --- .github/workflows/build_test_deploy.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 7906496c0d9ad..83bdd424c522c 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -748,7 +748,7 @@ jobs: # Build binaries for publishing build-native: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: os: [ubuntu-18.04, macos-latest, windows-latest] @@ -867,7 +867,7 @@ jobs: build-windows-i686: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-i686 - node@14 runs-on: windows-latest env: @@ -926,7 +926,7 @@ jobs: build-windows-aarch64: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-aarch64 - node@14 runs-on: windows-latest steps: @@ -974,7 +974,7 @@ jobs: build-linux-musl: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - linux-musl - node@lts runs-on: ubuntu-latest steps: @@ -1025,7 +1025,7 @@ jobs: build-linux-aarch64-gnu: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1088,7 +1088,7 @@ jobs: build-linux-aarch64-musl: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-musl - node@14 runs-on: ubuntu-18.04 steps: @@ -1147,7 +1147,7 @@ jobs: build-linux-arm7: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - arm7-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1209,7 +1209,7 @@ jobs: build-android-aarch64: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - Android - aarch64 runs-on: macos-latest steps: @@ -1260,7 +1260,7 @@ jobs: build-wasm: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: target: [web, nodejs] From c33529721d4fb83988170092439af03a8aac6080 Mon Sep 17 00:00:00 2001 From: Andrey Lunyov Date: Thu, 27 Jan 2022 11:40:39 -0500 Subject: [PATCH 03/15] Revert 33699 revert 33240 relay plugin (#33704) * add hyper-tls/vendored * test --- .github/workflows/build_test_deploy.yml | 4 ++-- packages/next-swc/crates/core/Cargo.toml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 83bdd424c522c..fdb3d322164a3 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -1015,7 +1015,7 @@ jobs: - name: 'Build' run: | - docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.28 && turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl" + docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.28 && turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl --features vendored" - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1137,7 +1137,7 @@ jobs: turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Cross build aarch64 - run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl + run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl --features vendored - name: Upload artifact uses: actions/upload-artifact@v2 diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 3c80ae0d3661f..d58d3b259e2d2 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -38,4 +38,5 @@ swc_ecma_transforms_testing = "0.59.0" testing = "0.18.0" walkdir = "2.3.2" - +[features] +vendored = ["hyper-tls/vendored"] From fb62da6d15c06b3f3fd0e474dad451f2f86b339e Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 27 Jan 2022 10:44:13 -0600 Subject: [PATCH 04/15] update cargo --- packages/next-swc/Cargo.lock | 11 +++++++++++ packages/next-swc/crates/core/Cargo.toml | 1 + 2 files changed, 12 insertions(+) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index e6fd178ca52eb..7466083ed8b00 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -1446,6 +1446,7 @@ dependencies = [ "easy-error", "either", "fxhash", + "hyper-tls", "intern", "once_cell", "pathdiff", @@ -1609,6 +1610,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "111.17.0+1.1.1m" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d6a336abd10814198f66e2a91ccd7336611f30334119ca8ce300536666fcf4" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.72" @@ -1618,6 +1628,7 @@ dependencies = [ "autocfg", "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index d58d3b259e2d2..2ff9dc58b6bf8 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -13,6 +13,7 @@ easy-error = "1.0.0" either = "1" fxhash = "0.2.1" pathdiff = "0.2.0" +hyper-tls = "0.5.0" serde = "1" serde_json = "1" styled_components = "0.13.0" From e4c58ce657ba030ab3d27ed31f2b7345e2c03baa Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 27 Jan 2022 11:05:45 -0600 Subject: [PATCH 05/15] move dep --- packages/next-swc/crates/core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 2ff9dc58b6bf8..ed0eec932d85a 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -13,7 +13,6 @@ easy-error = "1.0.0" either = "1" fxhash = "0.2.1" pathdiff = "0.2.0" -hyper-tls = "0.5.0" serde = "1" serde_json = "1" styled_components = "0.13.0" @@ -33,6 +32,7 @@ relay-compiler = { git = "https://github.com/facebook/relay", tag="v13.0.1" } relay-compiler-intern = { package="intern", git = "https://github.com/facebook/relay", tag="v13.0.1" } relay-compiler-common = { package = "common", git = "https://github.com/facebook/relay", tag="v13.0.1" } relay-config = { git = "https://github.com/facebook/relay", tag="v13.0.1" } +hyper-tls = "0.5.0" [dev-dependencies] swc_ecma_transforms_testing = "0.59.0" From a61229cfa147ea5de6380b1b68991049917f73bb Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 27 Jan 2022 11:27:47 -0600 Subject: [PATCH 06/15] disable fail-fast --- .github/workflows/build_test_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index fdb3d322164a3..cb89e8ec8e4da 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -753,6 +753,7 @@ jobs: matrix: os: [ubuntu-18.04, macos-latest, windows-latest] description: [default] + fail-fast: false include: - os: ubuntu-18.04 target: x86_64-unknown-linux-gnu From 946228589cef5526169bb8d35cce7158c84daa4d Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 27 Jan 2022 11:56:50 -0600 Subject: [PATCH 07/15] fix config --- .github/workflows/build_test_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index cb89e8ec8e4da..708a51f9b5aa7 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -750,10 +750,10 @@ jobs: needs: build # if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: + fail-fast: false matrix: os: [ubuntu-18.04, macos-latest, windows-latest] description: [default] - fail-fast: false include: - os: ubuntu-18.04 target: x86_64-unknown-linux-gnu From 81a320092a6dcd26ff7b7e1ae52cbc916217b02d Mon Sep 17 00:00:00 2001 From: Andrey Lunyov Date: Thu, 27 Jan 2022 14:51:12 -0500 Subject: [PATCH 08/15] install musl-tools (#33748) --- .github/workflows/build_test_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 708a51f9b5aa7..7ef79b1e7be4f 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -1064,7 +1064,7 @@ jobs: - name: Install cross compile toolchain run: | sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y + sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu musl-tools -y - name: Turbo Cache id: turbo-cache @@ -1124,7 +1124,7 @@ jobs: - name: Install cross compile toolchain run: | sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu -y + sudo apt-get install gcc-aarch64-linux-gnu musl-tools -y - name: Turbo Cache id: turbo-cache From b3b9a6e7e882e1da203722a94d26c508465258eb Mon Sep 17 00:00:00 2001 From: Andrey Lunyov Date: Sat, 29 Jan 2022 12:56:40 -0500 Subject: [PATCH 09/15] Remove relay-compiler as a dependency, to unblock the build. (#33780) * install musl-tools * [relay] Remove rust dependecy on relay-compiler to unblock the build * Add note about artifactsDirectory * revert changes to build_test_deploy * happy build, fix the name of artifact_directory * fix name one more time * remove cfg(wasm32) * remove --features vendored * cargo test * BuildRequirePathError::ArtifactDirectoryExpected --- .github/workflows/build_test_deploy.yml | 4 +- docs/advanced-features/compiler.md | 9 +- package.json | 4 +- packages/next-swc/Cargo.lock | 1331 +---------------- packages/next-swc/crates/core/Cargo.toml | 10 - packages/next-swc/crates/core/src/lib.rs | 16 +- packages/next-swc/crates/core/src/relay.rs | 217 +-- .../next-swc/crates/core/tests/fixture.rs | 16 +- .../crates/core/tests/fixture/relay/input.tsx | 2 +- .../crates/core/tests/fixture/relay/output.js | 15 +- packages/next-swc/crates/core/tests/full.rs | 2 +- .../project-a/next.config.js | 8 +- .../project-b/next.config.js | 8 +- .../next.config.js | 4 +- .../relay.config.js | 2 +- yarn.lock | 18 +- 16 files changed, 147 insertions(+), 1519 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 7ef79b1e7be4f..4a045466e09c4 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -1016,7 +1016,7 @@ jobs: - name: 'Build' run: | - docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.28 && turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl --features vendored" + docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.28 && turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl" - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1138,7 +1138,7 @@ jobs: turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Cross build aarch64 - run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl --features vendored + run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl - name: Upload artifact uses: actions/upload-artifact@v2 diff --git a/docs/advanced-features/compiler.md b/docs/advanced-features/compiler.md index 0ed7b6b9a532b..7e192389688e6 100644 --- a/docs/advanced-features/compiler.md +++ b/docs/advanced-features/compiler.md @@ -102,11 +102,18 @@ To enable [Relay](https://relay.dev/) support: // next.config.js module.exports = { experimental: { - relay: true, + relay: { + // This should match relay.config.js + src: './', + artifactDirectory: './__generated__' + language: 'typescript', + }, }, } ``` +NOTE: In Next.js all JavaScripts files in `pages` directory are considered routes. So, for `relay-compiler` you'll need to specify `artifactDirectory` configuration settings outside of the `pages`, otherwise `relay-compiler` will generate files next to the source file in the `__generated__` directory, and this file will be considered a route, which will break production build. + ### Remove React Properties Allows to remove JSX properties. This is often used for testing. Similar to `babel-plugin-react-remove-properties`. diff --git a/package.json b/package.json index 17f4d58ac5ec6..0a6c7f65e2540 100644 --- a/package.json +++ b/package.json @@ -146,8 +146,8 @@ "react-dom": "17.0.2", "react-dom-18": "npm:react-dom@18.0.0-rc.0", "react-ssr-prepass": "1.0.8", - "relay-compiler": "13.0.1", - "relay-runtime": "13.0.1", + "relay-compiler": "13.0.2", + "relay-runtime": "13.0.2", "release": "6.3.0", "request-promise-core": "1.1.2", "resolve-from": "5.0.0", diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 7466083ed8b00..8185c1d513a19 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -89,17 +89,6 @@ dependencies = [ "syn", ] -[[package]] -name = "async-trait" -version = "0.1.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "atty" version = "0.2.14" @@ -156,55 +145,19 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" -[[package]] -name = "beef" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "474a626a67200bd107d44179bb3d4fc61891172d11696609264589be6a0e6a43" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.5", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -243,45 +196,17 @@ version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "bytes" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" -dependencies = [ - "serde", -] - [[package]] name = "cc" version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" -dependencies = [ - "jobserver", -] [[package]] name = "cfg-if" @@ -310,53 +235,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "clap" -version = "2.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim 0.8.0", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "colored" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - -[[package]] -name = "common" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "colored", - "indexmap", - "intern", - "log", - "lsp-types", - "md-5", - "rayon", - "serde", -] - -[[package]] -name = "common-path" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" - [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -367,22 +245,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "core-foundation" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - [[package]] name = "cpufeatures" version = "0.2.1" @@ -481,7 +343,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.9.3", + "strsim", "syn", ] @@ -504,8 +366,6 @@ checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" dependencies = [ "cfg-if 1.0.0", "num_cpus", - "rayon", - "serde", ] [[package]] @@ -517,19 +377,6 @@ dependencies = [ "unreachable", ] -[[package]] -name = "dependency-analyzer" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "fnv", - "graphql-ir", - "graphql-syntax", - "intern", - "relay-transforms", - "schema", -] - [[package]] name = "diff" version = "0.1.12" @@ -542,22 +389,13 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.5", + "generic-array", ] [[package]] @@ -584,41 +422,6 @@ dependencies = [ "syn", ] -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "errors" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", -] - -[[package]] -name = "extract-graphql" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "graphql-syntax", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fastrand" version = "1.6.0" @@ -634,38 +437,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" -[[package]] -name = "flatbuffers" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4c5738bcd7fad10315029c50026f83c9da5e4a21f8ed66826f43e0e2bde5f6" -dependencies = [ - "bitflags", - "smallvec", - "thiserror", -] - [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.0.1" @@ -688,102 +465,6 @@ dependencies = [ "syn", ] -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - -[[package]] -name = "futures" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" - -[[package]] -name = "futures-executor" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" - -[[package]] -name = "futures-macro" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" - -[[package]] -name = "futures-task" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" - -[[package]] -name = "futures-util" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" -dependencies = [ - "futures 0.1.31", - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "fxhash" version = "0.2.1" @@ -793,15 +474,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.5" @@ -847,200 +519,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] -name = "graphql-cli" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "colored", - "common", -] - -[[package]] -name = "graphql-ir" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "errors", - "fnv", - "graphql-syntax", - "intern", - "lazy_static", - "once_cell", - "schema", - "strsim 0.10.0", - "thiserror", -] - -[[package]] -name = "graphql-syntax" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "intern", - "logos", - "lsp-types", - "serde", - "thiserror", -] - -[[package]] -name = "graphql-text-printer" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "fnv", - "graphql-ir", - "graphql-syntax", - "intern", - "schema", -] - -[[package]] -name = "graphql-watchman" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "log", - "serde", - "serde_bser", - "watchman_client", -] - -[[package]] -name = "h2" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689" -dependencies = [ - "bytes 1.1.0", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", - "serde", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "http" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" -dependencies = [ - "bytes 1.1.0", - "fnv", - "itoa 1.0.1", -] - -[[package]] -name = "http-body" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" -dependencies = [ - "bytes 1.1.0", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "humantime" -version = "1.3.0" +name = "hashbrown" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "quick-error", + "ahash", ] [[package]] -name = "hyper" -version = "0.14.16" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "bytes 1.1.0", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa 0.4.8", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", + "libc", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes 1.1.0", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "ident_case" @@ -1086,31 +586,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "intern" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "fnv", - "hashbrown", - "indexmap", - "once_cell", - "parking_lot", - "serde", - "serde_bytes", - "serde_derive", - "smallvec", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "is-macro" version = "0.2.0" @@ -1133,37 +608,12 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - [[package]] name = "itoa" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" -[[package]] -name = "jobserver" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" -dependencies = [ - "libc", -] - -[[package]] -name = "js-config-loader" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "js-sys" version = "0.3.49" @@ -1224,31 +674,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ "cfg-if 1.0.0", - "value-bag", -] - -[[package]] -name = "logos" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91c49573597a5d6c094f9031617bb1fed15c0db68c81e6546d313414ce107e4" -dependencies = [ - "logos-derive", -] - -[[package]] -name = "logos-derive" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "797b1f8a0571b331c1b47e7db245af3dc634838da7a92b3bef4e30376ae1c347" -dependencies = [ - "beef", - "fnv", - "proc-macro2", - "quote", - "regex-syntax", - "syn", - "utf8-ranges", ] [[package]] @@ -1260,25 +685,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "lsp-types" -version = "0.89.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852e0dedfd52cc32325598b2631e0eba31b7b708959676a9f837042f276b09a2" -dependencies = [ - "bitflags", - "serde", - "serde_json", - "serde_repr", - "url", -] - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - [[package]] name = "matchers" version = "0.1.0" @@ -1294,17 +700,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" -[[package]] -name = "md-5" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "opaque-debug 0.2.3", -] - [[package]] name = "memchr" version = "2.4.1" @@ -1356,28 +751,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - [[package]] name = "napi" version = "1.8.0" @@ -1413,24 +786,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf20e0081fea04e044aa4adf74cfea8ddc0324eec2894b1c700f4cafc72a56" -[[package]] -name = "native-tls" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -1442,17 +797,12 @@ name = "next-swc" version = "0.0.0" dependencies = [ "chrono", - "common", "easy-error", "either", "fxhash", - "hyper-tls", - "intern", "once_cell", "pathdiff", "regex", - "relay-compiler", - "relay-config", "serde", "serde_json", "styled_components", @@ -1513,15 +863,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ntapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" -dependencies = [ - "winapi", -] - [[package]] name = "num-bigint" version = "0.2.6" @@ -1578,61 +919,12 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-src" -version = "111.17.0+1.1.1m" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d6a336abd10814198f66e2a91ccd7336611f30334119ca8ce300536666fcf4" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" -dependencies = [ - "autocfg", - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - [[package]] name = "ordered-float" version = "2.10.0" @@ -1642,29 +934,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "ouroboros" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d5c203fe8d786d9d7bec8203cbbff3eb2cf8410c0d70cfd05b3d5f5d545da" -dependencies = [ - "ouroboros_macro", - "stable_deref_trait", -] - -[[package]] -name = "ouroboros_macro" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129943a960e6a08c7e70ca5a09f113c273fe7f10ae8420992c78293e3dffdf65" -dependencies = [ - "Inflector", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "output_vt100" version = "0.1.2" @@ -1726,19 +995,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "persist-query" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "hyper", - "hyper-tls", - "serde", - "serde_json", - "thiserror", - "url", -] - [[package]] name = "petgraph" version = "0.5.1" @@ -1799,18 +1055,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" - [[package]] name = "pmutil" version = "0.5.3" @@ -1885,12 +1129,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quote" version = "1.0.14" @@ -2007,157 +1245,21 @@ name = "regex-automata" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "relative-path" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d4caf086b102ab49d0525b721594a555ab55c6556086bbe52a430ad26c3bd7" - -[[package]] -name = "relay-codegen" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "fnv", - "graphql-ir", - "graphql-syntax", - "hex", - "indexmap", - "intern", - "lazy_static", - "md-5", - "relay-config", - "relay-transforms", - "schema", -] - -[[package]] -name = "relay-compiler" -version = "13.0.1" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "async-trait", - "bincode", - "common", - "common-path", - "dashmap", - "dependency-analyzer", - "env_logger", - "errors", - "extract-graphql", - "fnv", - "futures 0.3.19", - "glob", - "graphql-cli", - "graphql-ir", - "graphql-syntax", - "graphql-text-printer", - "graphql-watchman", - "hex", - "indexmap", - "intern", - "js-config-loader", - "lazy_static", - "log", - "md-5", - "persist-query", - "rayon", - "regex", - "relay-codegen", - "relay-config", - "relay-schema", - "relay-transforms", - "relay-typegen", - "schema", - "schema-diff", - "serde", - "serde_bser", - "serde_json", - "sha-1 0.8.2", - "signedsource", - "structopt", - "thiserror", - "tokio", - "walkdir", - "watchman_client", - "zstd", -] - -[[package]] -name = "relay-config" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "fnv", - "indexmap", - "intern", - "regex", - "serde", - "serde_json", -] - -[[package]] -name = "relay-schema" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "intern", - "schema", -] - -[[package]] -name = "relay-transforms" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "dashmap", - "errors", - "fnv", - "graphql-ir", - "graphql-syntax", - "graphql-text-printer", - "indexmap", - "intern", - "itertools", - "lazy_static", - "once_cell", - "parking_lot", - "regex", - "relay-config", - "schema", - "thiserror", +dependencies = [ + "regex-syntax", ] [[package]] -name = "relay-typegen" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "fnv", - "graphql-ir", - "indexmap", - "intern", - "itertools", - "lazy_static", - "relay-config", - "relay-transforms", - "schema", -] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "relative-path" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73d4caf086b102ab49d0525b721594a555ab55c6556086bbe52a430ad26c3bd7" [[package]] name = "remove_dir_all" @@ -2210,55 +1312,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi", -] - -[[package]] -name = "schema" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "dashmap", - "flatbuffers", - "fnv", - "graphql-syntax", - "intern", - "lazy_static", - "ouroboros", - "schema-flatbuffer", - "thiserror", -] - -[[package]] -name = "schema-diff" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "common", - "fnv", - "graphql-syntax", - "intern", - "lazy_static", - "relay-config", - "schema", -] - -[[package]] -name = "schema-flatbuffer" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "flatbuffers", -] - [[package]] name = "scoped-tls" version = "1.0.0" @@ -2271,29 +1324,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "security-framework" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09d3c15d814eda1d6a836f2f2b56a6abc1446c8a34351cb3180d3db92ffe4ce" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90dd10c41c6bfc633da6e0c659bd25d31e0791e5974ac42970267d59eba87f7" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "0.9.0" @@ -2339,28 +1369,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "serde_bser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b929ea725591083cbca8b8ea178ed6efc918eccd40b784e199ce88967104199" -dependencies = [ - "anyhow", - "byteorder", - "bytes 0.4.12", - "serde", - "thiserror", -] - -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" version = "1.0.133" @@ -2378,7 +1386,7 @@ version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" dependencies = [ - "itoa 1.0.1", + "itoa", "ryu", "serde", ] @@ -2393,40 +1401,17 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha-1" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.9.0", + "block-buffer", "cfg-if 1.0.0", "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest", + "opaque-debug", ] [[package]] @@ -2438,56 +1423,17 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "signedsource" -version = "0.0.0" -source = "git+https://github.com/facebook/relay?tag=v13.0.1#e10dba54b46fc01bdf3b6b811853c6f2b3e565b6" -dependencies = [ - "hex", - "lazy_static", - "md-5", - "regex", -] - [[package]] name = "siphasher" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" -[[package]] -name = "slab" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" - [[package]] name = "smallvec" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" -dependencies = [ - "libc", - "winapi", -] [[package]] name = "sourcemap" @@ -2578,48 +1524,12 @@ dependencies = [ "syn", ] -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "strsim" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "structopt" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "styled_components" version = "0.13.0" @@ -2636,12 +1546,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "sval" -version = "1.0.0-alpha.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" - [[package]] name = "swc" version = "0.117.2" @@ -3192,7 +2096,7 @@ dependencies = [ "once_cell", "regex", "serde", - "sha-1 0.9.8", + "sha-1", "string_enum", "swc_atoms", "swc_common", @@ -3215,7 +2119,7 @@ dependencies = [ "hex", "serde", "serde_json", - "sha-1 0.9.8", + "sha-1", "swc_common", "swc_ecma_ast", "swc_ecma_codegen", @@ -3472,15 +2376,6 @@ dependencies = [ "syn", ] -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.30" @@ -3535,69 +2430,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "tokio" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" -dependencies = [ - "bytes 1.1.0", - "libc", - "memchr", - "mio", - "num_cpus", - "once_cell", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "tokio-macros", - "tracing", - "winapi", -] - -[[package]] -name = "tokio-macros" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" -dependencies = [ - "bytes 1.1.0", - "futures-core", - "futures-io", - "futures-sink", - "log", - "pin-project-lite", - "slab", - "tokio", -] - -[[package]] -name = "tower-service" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" - [[package]] name = "tracing" version = "0.1.29" @@ -3659,12 +2491,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "try-lock" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" - [[package]] name = "typed-arena" version = "2.0.1" @@ -3692,12 +2518,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - [[package]] name = "unicode-width" version = "0.1.9" @@ -3729,38 +2549,8 @@ dependencies = [ "idna", "matches", "percent-encoding", - "serde", -] - -[[package]] -name = "utf8-ranges" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba" - -[[package]] -name = "value-bag" -version = "1.0.0-alpha.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" -dependencies = [ - "ctor", - "sval", - "version_check", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -3784,16 +2574,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3894,24 +2674,6 @@ version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa" -[[package]] -name = "watchman_client" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1afbab1186833c9b34f64132b80ed4b373ed4eab6f9efa1f55430835200f0a28" -dependencies = [ - "anyhow", - "bytes 1.1.0", - "futures 0.3.19", - "maplit", - "serde", - "serde_bser", - "thiserror", - "tokio", - "tokio-util", - "winapi", -] - [[package]] name = "web-sys" version = "0.3.49" @@ -3952,32 +2714,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "zstd" -version = "0.8.0+zstd.1.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afab5e288c9e10bcd910b16ad82cb8028b74b09eccaa5ecd90621f99d3380735" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "4.0.0+zstd.1.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f02c0811d5455aa82c6bc400cffd8c882f3a2813f5e2245e2b264443305ab2" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "1.5.0+zstd.1.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e6c094340240369025fc6b731b054ee2a834328fa584310ac96aa4baebdc465" -dependencies = [ - "cc", - "libc", -] diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index ed0eec932d85a..6efe5f72b6a69 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -27,17 +27,7 @@ swc_stylis = "0.43.0" tracing = {version = "0.1.28", features = ["release_max_level_off"]} regex = "1.5" -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -relay-compiler = { git = "https://github.com/facebook/relay", tag="v13.0.1" } -relay-compiler-intern = { package="intern", git = "https://github.com/facebook/relay", tag="v13.0.1" } -relay-compiler-common = { package = "common", git = "https://github.com/facebook/relay", tag="v13.0.1" } -relay-config = { git = "https://github.com/facebook/relay", tag="v13.0.1" } -hyper-tls = "0.5.0" - [dev-dependencies] swc_ecma_transforms_testing = "0.59.0" testing = "0.18.0" walkdir = "2.3.2" - -[features] -vendored = ["hyper-tls/vendored"] diff --git a/packages/next-swc/crates/core/src/lib.rs b/packages/next-swc/crates/core/src/lib.rs index 4d147f5a475b7..7b7d05c5218d4 100644 --- a/packages/next-swc/crates/core/src/lib.rs +++ b/packages/next-swc/crates/core/src/lib.rs @@ -53,7 +53,6 @@ pub mod next_dynamic; pub mod next_ssg; pub mod page_config; pub mod react_remove_properties; -#[cfg(not(target_arch = "wasm32"))] pub mod relay; pub mod remove_console; pub mod shake_exports; @@ -94,7 +93,7 @@ pub struct TransformOptions { pub react_remove_properties: Option, #[serde(default)] - pub relay: bool, + pub relay: Option, #[serde(default)] pub shake_exports: Option, @@ -104,15 +103,12 @@ pub fn custom_before_pass( cm: Arc, file: Arc, opts: &TransformOptions, -) -> impl Fold { - #[cfg(target_arch = "wasm32")] - let relay_plugin = noop(); - - #[cfg(not(target_arch = "wasm32"))] +) -> impl Fold + '_ { let relay_plugin = { - match &opts.relay { - true => Either::Left(relay::relay(file.name.clone())), - false => Either::Right(noop()), + if let Some(config) = &opts.relay { + Either::Left(relay::relay(config, file.name.clone())) + } else { + Either::Right(noop()) } }; diff --git a/packages/next-swc/crates/core/src/relay.rs b/packages/next-swc/crates/core/src/relay.rs index d3b655a0bdd11..76c7298eee913 100644 --- a/packages/next-swc/crates/core/src/relay.rs +++ b/packages/next-swc/crates/core/src/relay.rs @@ -1,11 +1,6 @@ use once_cell::sync::Lazy; -use pathdiff::diff_paths; use regex::Regex; -use relay_compiler::compiler_state::{SourceSet, SourceSetName}; -use relay_compiler::{create_path_for_artifact, FileCategorizer, FileGroup, ProjectConfig}; -use relay_compiler_common::SourceLocationKey; use serde::Deserialize; -use std::borrow::Cow; use std::path::{Path, PathBuf}; use swc_atoms::JsWord; use swc_common::errors::HANDLER; @@ -15,15 +10,31 @@ use swc_ecmascript::utils::{quote_ident, ExprFactory}; use swc_ecmascript::visit::{Fold, FoldWith}; #[derive(Copy, Clone, Debug, Deserialize)] -#[serde(rename_all = "snake_case")] +#[serde(rename_all = "lowercase")] pub enum RelayLanguageConfig { - Typescript, + TypeScript, Flow, } -struct Relay { +impl Default for RelayLanguageConfig { + fn default() -> Self { + Self::Flow + } +} + +struct Relay<'a> { + root_dir: PathBuf, file_name: FileName, - relay_config_for_tests: Option, + config: &'a Config, +} + +#[derive(Deserialize, Debug, Default, Clone)] +#[serde(rename_all = "camelCase")] +pub struct Config { + pub src: PathBuf, + pub artifact_directory: Option, + #[serde(default)] + pub language: RelayLanguageConfig, } fn pull_first_operation_name_from_tpl(tpl: &TaggedTpl) -> Option { @@ -33,10 +44,7 @@ fn pull_first_operation_name_from_tpl(tpl: &TaggedTpl) -> Option { let capture_group = OPERATION_REGEX.captures_iter(&quasis.raw.value).next(); - match capture_group { - None => None, - Some(capture_group) => Some(capture_group[2].to_string()), - } + capture_group.map(|capture_group| capture_group[2].to_string()) }) } @@ -44,18 +52,20 @@ fn build_require_expr_from_path(path: &str) -> Expr { Expr::Call(CallExpr { span: Default::default(), callee: quote_ident!("require").as_callee(), - args: vec![Lit::Str(Str { - span: Default::default(), - value: JsWord::from(path), - has_escape: false, - kind: Default::default(), - }) - .as_arg()], + args: vec![ + Lit::Str(Str { + span: Default::default(), + value: JsWord::from(path), + has_escape: false, + kind: Default::default(), + }) + .as_arg(), + ], type_args: None, }) } -impl Fold for Relay { +impl<'a> Fold for Relay<'a> { fn fold_expr(&mut self, expr: Expr) -> Expr { let expr = expr.fold_children_with(self); @@ -73,120 +83,40 @@ impl Fold for Relay { } #[derive(Debug)] -enum BuildRequirePathError<'a> { +enum BuildRequirePathError { FileNameNotReal, - MultipleSourceSetsFound { - source_set_names: Vec, - path: &'a PathBuf, - }, - ProjectNotFoundForSourceSet { - source_set_name: SourceSetName, - }, - FileNotASourceFile, - CouldNotCategorize { - err: Cow<'static, str>, - path: String, - }, + ArtifactDirectoryExpected, } -// This is copied from https://github.com/facebook/relay/blob/main/compiler/crates/relay-compiler/src/build_project/generate_artifacts.rs#L251 -// until the Relay team exposes it for external use. fn path_for_artifact( root_dir: &Path, - source_path: &Path, - project_config: &ProjectConfig, + config: &Config, definition_name: &str, -) -> PathBuf { - let source_file_location_key = SourceLocationKey::Standalone { - path: source_path.to_str().unwrap().parse().unwrap(), - }; - let filename = if let Some(filename_for_artifact) = &project_config.filename_for_artifact { - filename_for_artifact(source_file_location_key, definition_name.parse().unwrap()) - } else { - match &project_config.typegen_config.language { - relay_config::TypegenLanguage::Flow => format!("{}.graphql.js", definition_name), - relay_config::TypegenLanguage::TypeScript => { - format!("{}.graphql.ts", definition_name) - } +) -> Result { + let filename = match &config.language { + RelayLanguageConfig::Flow => format!("{}.graphql.js", definition_name), + RelayLanguageConfig::TypeScript => { + format!("{}.graphql.ts", definition_name) } }; - let output_path = create_path_for_artifact(project_config, source_file_location_key, filename); - - if project_config.output.is_some() { - let absolute_output_path = root_dir.join(&output_path); - - let diffed_path = - diff_paths(&absolute_output_path, &source_path.parent().unwrap()).unwrap(); - - return diffed_path; + if let Some(artifact_directory) = &config.artifact_directory { + Ok(root_dir.join(artifact_directory).join(filename)) + } else { + Err(BuildRequirePathError::ArtifactDirectoryExpected) } - - output_path } -impl Relay { + +impl<'a> Relay<'a> { fn build_require_path( &mut self, operation_name: &str, ) -> Result { - match &self.relay_config_for_tests { - Some(config) => match &self.file_name { - FileName::Real(real_file_path) => Ok(path_for_artifact( - &std::env::current_dir().unwrap(), - &real_file_path, - config, - operation_name, - )), - _ => Err(BuildRequirePathError::FileNameNotReal), - }, - _ => { - let config = - relay_compiler::config::Config::search(&std::env::current_dir().unwrap()) - .unwrap(); - - let categorizer = FileCategorizer::from_config(&config); - - match &self.file_name { - FileName::Real(real_file_name) => { - // Make sure we have a path which is relative to the config. - // Otherwise, categorize won't be able to recognize that - // the absolute source path is a child of a source set. - let diffed_path = diff_paths(real_file_name, &config.root_dir).unwrap(); - - let group = categorizer.categorize(diffed_path.as_path()); - - match group { - Ok(group) => match group { - FileGroup::Source { source_set } => match source_set { - SourceSet::SourceSetName(source_set_name) => { - let project_config: Option<&ProjectConfig> = - config.projects.get(&source_set_name); - - match project_config { - None => Err(BuildRequirePathError::ProjectNotFoundForSourceSet { source_set_name }), - Some(project_config) => { - Ok(path_for_artifact(&config.root_dir,real_file_name, &project_config, operation_name)) - } - } - } - SourceSet::SourceSetNames(source_set_names) => { - Err(BuildRequirePathError::MultipleSourceSetsFound { - source_set_names, - path: real_file_name, - }) - } - }, - _ => Err(BuildRequirePathError::FileNotASourceFile), - }, - Err(err) => Err(BuildRequirePathError::CouldNotCategorize { - err, - path: real_file_name.display().to_string(), - }), - } - } - _ => Err(BuildRequirePathError::FileNameNotReal), - } + match &self.file_name { + FileName::Real(_real_file_name) => { + path_for_artifact(&self.root_dir, self.config, operation_name) } + _ => Err(BuildRequirePathError::FileNameNotReal), } } @@ -210,42 +140,11 @@ impl Relay { file. This is likely a bug and \ should be reported to Next.js" .to_string(), - BuildRequirePathError::MultipleSourceSetsFound { - source_set_names, - path, - } => { - format!( - "Multiple source sets were found for file: {}. Found source sets: \ - [{}]. We could not determine the project config to use for the \ - source file. Please consider narrowing down your source sets.", - path.to_str().unwrap(), - source_set_names - .iter() - .map(|name| name.lookup()) - .collect::>() - .join(", ") - ) - } - BuildRequirePathError::ProjectNotFoundForSourceSet { source_set_name } => { - format!( - "Project could not be found for the source set: {}", - source_set_name - ) - } - BuildRequirePathError::FileNotASourceFile => { - "This file was not considered a source file by the Relay Compiler. \ - This is likely a bug and should be reported to Next.js" + BuildRequirePathError::ArtifactDirectoryExpected => { + "The `artifactDirectory` is expected to be set in the Relay config \ + file to work correctly with Next.js." .to_string() } - BuildRequirePathError::CouldNotCategorize { path, err } => { - format!( - "Relay was unable to categorize the file at: {}. Ensure your \ - `src` path includes this file in `relay.config.js` The \ - underlying error is: {}. \n\nThis is likely a bug and should be \ - reported to Next.js", - path, err - ) - } }; HANDLER.with(|handler| { @@ -262,16 +161,10 @@ impl Relay { } } -pub fn relay(file_name: FileName) -> impl Fold { - Relay { - file_name, - relay_config_for_tests: None, - } -} - -pub fn test_relay(file_name: FileName, relay_config_for_tests: ProjectConfig) -> impl Fold { +pub fn relay<'a>(config: &'a Config, file_name: FileName) -> impl Fold + '_ { Relay { + root_dir: std::env::current_dir().unwrap(), file_name, - relay_config_for_tests: Some(relay_config_for_tests), + config, } } diff --git a/packages/next-swc/crates/core/tests/fixture.rs b/packages/next-swc/crates/core/tests/fixture.rs index dfb212f85f36d..332f35d15fbf8 100644 --- a/packages/next-swc/crates/core/tests/fixture.rs +++ b/packages/next-swc/crates/core/tests/fixture.rs @@ -1,16 +1,14 @@ -use next_swc::relay::test_relay; use next_swc::{ amp_attributes::amp_attributes, next_dynamic::next_dynamic, next_ssg::next_ssg, page_config::page_config_test, react_remove_properties::remove_properties, + relay::{relay, Config as RelayConfig, RelayLanguageConfig}, remove_console::remove_console, shake_exports::{shake_exports, Config as ShakeExportsConfig}, styled_jsx::styled_jsx, }; -use relay_compiler::ProjectConfig; -use relay_config::TypegenLanguage; use std::path::PathBuf; use swc_common::{chain, comments::SingleThreadedComments, FileName, Mark, Span, DUMMY_SP}; use swc_ecma_transforms_testing::{test, test_fixture}; @@ -155,14 +153,14 @@ fn page_config_fixture(input: PathBuf) { #[fixture("tests/fixture/relay/**/input.ts*")] fn relay_no_artifact_dir_fixture(input: PathBuf) { let output = input.parent().unwrap().join("output.js"); + let config = RelayConfig { + language: RelayLanguageConfig::TypeScript, + artifact_directory: Some(PathBuf::from("__generated__")), + ..Default::default() + }; test_fixture( syntax(), - &|_tr| { - let mut config = ProjectConfig::default(); - config.typegen_config.language = TypegenLanguage::TypeScript; - - test_relay(FileName::Real(PathBuf::from("input.tsx")), config) - }, + &|_tr| relay(&config, FileName::Real(PathBuf::from("input.tsx"))), &input, &output, ); diff --git a/packages/next-swc/crates/core/tests/fixture/relay/input.tsx b/packages/next-swc/crates/core/tests/fixture/relay/input.tsx index 8bc789841d4e1..f244f2045cc02 100644 --- a/packages/next-swc/crates/core/tests/fixture/relay/input.tsx +++ b/packages/next-swc/crates/core/tests/fixture/relay/input.tsx @@ -39,4 +39,4 @@ function SomeMutationComponent() { someMutation } `) -} \ No newline at end of file +} diff --git a/packages/next-swc/crates/core/tests/fixture/relay/output.js b/packages/next-swc/crates/core/tests/fixture/relay/output.js index bf391cc8ff397..16a8af74db126 100644 --- a/packages/next-swc/crates/core/tests/fixture/relay/output.js +++ b/packages/next-swc/crates/core/tests/fixture/relay/output.js @@ -1,13 +1,10 @@ -const variableQuery = require('__generated__/InputVariableQuery.graphql.ts') -fetchQuery(require('__generated__/InputUsedInFunctionCallQuery.graphql.ts')) +const variableQuery = require("$DIR/__generated__/InputVariableQuery.graphql.ts"); +fetchQuery(require("$DIR/__generated__/InputUsedInFunctionCallQuery.graphql.ts")); function SomeQueryComponent() { - useLazyLoadQuery(require('__generated__/InputInHookQuery.graphql.ts')) + useLazyLoadQuery(require("$DIR/__generated__/InputInHookQuery.graphql.ts")); } -const variableMutation = require('__generated__/InputVariableMutation.graphql.ts') -commitMutation( - environment, - require('__generated__/InputUsedInFunctionCallMutation.graphql.ts') -) +const variableMutation = require("$DIR/__generated__/InputVariableMutation.graphql.ts"); +commitMutation(environment, require("$DIR/__generated__/InputUsedInFunctionCallMutation.graphql.ts")); function SomeMutationComponent() { - useMutation(require('__generated__/InputInHookMutation.graphql.ts')) + useMutation(require("$DIR/__generated__/InputInHookMutation.graphql.ts")); } diff --git a/packages/next-swc/crates/core/tests/full.rs b/packages/next-swc/crates/core/tests/full.rs index 80c5bb0519513..f915188aace8c 100644 --- a/packages/next-swc/crates/core/tests/full.rs +++ b/packages/next-swc/crates/core/tests/full.rs @@ -59,7 +59,7 @@ fn test(input: &Path, minify: bool) { styled_components: Some(assert_json("{}")), remove_console: None, react_remove_properties: None, - relay: false, + relay: None, shake_exports: None, }; diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js b/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js index 80e35cc588f55..da7f4cc45c093 100644 --- a/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js +++ b/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js @@ -1,6 +1,12 @@ +const relay = require('../relay.config') + module.exports = { experimental: { - relay: true, + relay: { + src: './pages', + artifactDirectory: '../__generated__', + language: relay.projects['project-b'].language, + }, externalDir: true, }, } diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js b/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js index 80e35cc588f55..da7f4cc45c093 100644 --- a/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js +++ b/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js @@ -1,6 +1,12 @@ +const relay = require('../relay.config') + module.exports = { experimental: { - relay: true, + relay: { + src: './pages', + artifactDirectory: '../__generated__', + language: relay.projects['project-b'].language, + }, externalDir: true, }, } diff --git a/test/integration/relay-graphql-swc-single-project/next.config.js b/test/integration/relay-graphql-swc-single-project/next.config.js index 7e32b6ae09cdc..ef214a05ace7a 100644 --- a/test/integration/relay-graphql-swc-single-project/next.config.js +++ b/test/integration/relay-graphql-swc-single-project/next.config.js @@ -1,5 +1,7 @@ +const relay = require('./relay.config') + module.exports = { experimental: { - relay: true, + relay, }, } diff --git a/test/integration/relay-graphql-swc-single-project/relay.config.js b/test/integration/relay-graphql-swc-single-project/relay.config.js index f01ef1932d212..a79dff7760383 100644 --- a/test/integration/relay-graphql-swc-single-project/relay.config.js +++ b/test/integration/relay-graphql-swc-single-project/relay.config.js @@ -1,5 +1,5 @@ module.exports = { - src: 'pages', + src: './pages', schema: './schema.graphql', artifactDirectory: './__generated__', language: 'typescript', diff --git a/yarn.lock b/yarn.lock index 86bef3f03fd49..18f25af5544db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17396,15 +17396,15 @@ rehype-retext@^2.0.1: dependencies: hast-util-to-nlcst "^1.0.0" -relay-compiler@13.0.1: - version "13.0.1" - resolved "https://registry.yarnpkg.com/relay-compiler/-/relay-compiler-13.0.1.tgz#09c713647aa7e1d8cf3de9f7fb4ee6a76b32cf26" - integrity sha512-C/qJ7IdfZ140b9JaNpuAP6WhV/Odt/tIq4sUZoTwsaOlhs+1Zu3fvIOoWKTnZT5PC6krRuw1hD7GSX6/paVpTQ== - -relay-runtime@13.0.1: - version "13.0.1" - resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-13.0.1.tgz#7e59a07c3b4e8c58d04bc94f6f978822d4128ffb" - integrity sha512-n/+J8PFfLFPVUcz9OG/z2i+adnfk0INwlTkVTw0V6KJe9NI9plc5eRCJwzzwspT4pdCkis5Lcjzvzp4H+0zn8g== +relay-compiler@13.0.2: + version "13.0.2" + resolved "https://registry.yarnpkg.com/relay-compiler/-/relay-compiler-13.0.2.tgz#2ec086bcc55ac8cb94cc08a19be129e037ca8044" + integrity sha512-Gg/5FNj8gz03GRkG5KjMNpDB4nOeApDFZq+8CZehu3KkQQ+vNIurX6RiTY3UNUYvg5SX2A9DS5bq5iHJ8iEV3A== + +relay-runtime@13.0.2: + version "13.0.2" + resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-13.0.2.tgz#02adb73ddc159c57b92a23c52984bf73fae0d1fc" + integrity sha512-sP4lNGfFcOm7tQD12qlvwsiOREDgjkw4FQAjtemmtwivKOqI4qHAL22Ar62r5TPVlASn4iVWMk7rIdIJI20KGQ== dependencies: "@babel/runtime" "^7.0.0" fbjs "^3.0.2" From 5da944c6273ec98db5013e623f7f7424bc84ff4b Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sat, 29 Jan 2022 21:12:26 -0600 Subject: [PATCH 10/15] fix wasm build --- packages/next-swc/Cargo.lock | 90 +++++++++++++++++++++--- packages/next-swc/crates/wasm/Cargo.toml | 2 +- 2 files changed, 82 insertions(+), 10 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 8185c1d513a19..11aa92ad36dad 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -235,6 +235,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "cloudabi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +dependencies = [ + "bitflags", +] + [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -954,29 +963,43 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.2" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.0", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", + "cloudabi", "instant", "libc", - "redox_syscall", + "redox_syscall 0.1.57", "smallvec", "winapi", ] +[[package]] +name = "parking_lot_core" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2f4f894f3865f6c0e02810fc597300f34dc2510f66400da262d8ae10e75767d" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.10", + "smallvec", + "windows-sys", +] + [[package]] name = "path-clean" version = "0.1.0" @@ -1220,6 +1243,12 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "redox_syscall" version = "0.2.10" @@ -2328,7 +2357,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall", + "redox_syscall 0.2.10", "remove_dir_all", "winapi", ] @@ -2594,7 +2623,7 @@ dependencies = [ "console_error_panic_hook", "next-swc", "once_cell", - "parking_lot_core", + "parking_lot_core 0.9.0", "path-clean", "serde", "serde_json", @@ -2714,3 +2743,46 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceb069ac8b2117d36924190469735767f0990833935ab430155e71a44bafe148" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" + +[[package]] +name = "windows_i686_gnu" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" + +[[package]] +name = "windows_i686_msvc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index 357fd01d81f12..81f772823a16c 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib"] anyhow = "1.0.42" console_error_panic_hook = "0.1.6" once_cell = "1.3.1" -parking_lot_core = "=0.8.5" +parking_lot_core = "=0.9.0" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" From e6eb7768875c33447f1a7d2cf23647f2ded57ff4 Mon Sep 17 00:00:00 2001 From: Andrey Lunyov Date: Sun, 30 Jan 2022 10:37:06 -0500 Subject: [PATCH 11/15] Few more fixes for Relay Support in Rust Compiler PR (#33795) * revert changes in build_test_deploy * correct relay config * typoscript * Restructure Relay multi-project example --- .github/workflows/build_test_deploy.yml | 23 ++++--- packages/next/server/config-shared.ts | 6 +- .../__generated__/pagesAQuery.graphql.ts} | 28 ++++----- .../project-a/next.config.js | 2 +- .../project-a/pages/index.tsx | 6 +- .../__generated__/pagesBQuery.graphql.ts | 63 +++++++++++++++++++ .../project-b/next.config.js | 2 +- .../project-b/pages/index.tsx | 6 +- .../relay.config.js | 4 +- 9 files changed, 103 insertions(+), 37 deletions(-) rename test/integration/relay-graphql-swc-multi-project/{__generated__/pagesQuery.graphql.ts => project-a/__generated__/pagesAQuery.graphql.ts} (58%) create mode 100644 test/integration/relay-graphql-swc-multi-project/project-b/__generated__/pagesBQuery.graphql.ts diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 4a045466e09c4..7906496c0d9ad 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -748,9 +748,8 @@ jobs: # Build binaries for publishing build-native: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: - fail-fast: false matrix: os: [ubuntu-18.04, macos-latest, windows-latest] description: [default] @@ -868,7 +867,7 @@ jobs: build-windows-i686: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-i686 - node@14 runs-on: windows-latest env: @@ -927,7 +926,7 @@ jobs: build-windows-aarch64: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-aarch64 - node@14 runs-on: windows-latest steps: @@ -975,7 +974,7 @@ jobs: build-linux-musl: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - linux-musl - node@lts runs-on: ubuntu-latest steps: @@ -1026,7 +1025,7 @@ jobs: build-linux-aarch64-gnu: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1064,7 +1063,7 @@ jobs: - name: Install cross compile toolchain run: | sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu musl-tools -y + sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y - name: Turbo Cache id: turbo-cache @@ -1089,7 +1088,7 @@ jobs: build-linux-aarch64-musl: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-musl - node@14 runs-on: ubuntu-18.04 steps: @@ -1124,7 +1123,7 @@ jobs: - name: Install cross compile toolchain run: | sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu musl-tools -y + sudo apt-get install gcc-aarch64-linux-gnu -y - name: Turbo Cache id: turbo-cache @@ -1148,7 +1147,7 @@ jobs: build-linux-arm7: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - arm7-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1210,7 +1209,7 @@ jobs: build-android-aarch64: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - Android - aarch64 runs-on: macos-latest steps: @@ -1261,7 +1260,7 @@ jobs: build-wasm: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: target: [web, nodejs] diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 3a098d055e520..26a1374106d4b 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -172,7 +172,11 @@ export type NextConfig = { [key: string]: any } & { urlImports?: NonNullable['buildHttp'] outputFileTracingRoot?: string outputStandalone?: boolean - relay?: boolean + relay?: { + src: string + artifactDirectory?: string + language?: 'typescript' | 'flow' + } } } diff --git a/test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts b/test/integration/relay-graphql-swc-multi-project/project-a/__generated__/pagesAQuery.graphql.ts similarity index 58% rename from test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts rename to test/integration/relay-graphql-swc-multi-project/project-a/__generated__/pagesAQuery.graphql.ts index 3963e412c6151..b34157d840b20 100644 --- a/test/integration/relay-graphql-swc-multi-project/__generated__/pagesQuery.graphql.ts +++ b/test/integration/relay-graphql-swc-multi-project/project-a/__generated__/pagesAQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<187ead9fb6e7b26d71c9161bda6ab902>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -9,15 +9,15 @@ // @ts-nocheck import { ConcreteRequest, Query } from 'relay-runtime' -export type pagesQuery$variables = {} -export type pagesQueryVariables = pagesQuery$variables -export type pagesQuery$data = { +export type pagesAQuery$variables = {} +export type pagesAQueryVariables = pagesAQuery$variables +export type pagesAQuery$data = { readonly greeting: string } -export type pagesQueryResponse = pagesQuery$data -export type pagesQuery = { - variables: pagesQueryVariables - response: pagesQuery$data +export type pagesAQueryResponse = pagesAQuery$data +export type pagesAQuery = { + variables: pagesAQueryVariables + response: pagesAQuery$data } const node: ConcreteRequest = (function () { @@ -35,7 +35,7 @@ const node: ConcreteRequest = (function () { argumentDefinitions: [], kind: 'Fragment', metadata: null, - name: 'pagesQuery', + name: 'pagesAQuery', selections: v0 /*: any*/, type: 'Query', abstractKey: null, @@ -44,20 +44,20 @@ const node: ConcreteRequest = (function () { operation: { argumentDefinitions: [], kind: 'Operation', - name: 'pagesQuery', + name: 'pagesAQuery', selections: v0 /*: any*/, }, params: { - cacheID: '167b6de16340efeb876a7787c90e7cec', + cacheID: 'bc59dc1b50eecd19488f004d5cd93913', id: null, metadata: {}, - name: 'pagesQuery', + name: 'pagesAQuery', operationKind: 'query', - text: 'query pagesQuery {\n greeting\n}\n', + text: 'query pagesAQuery {\n greeting\n}\n', }, } })() -;(node as any).hash = '4017856344f36f61252354e2eb442d98' +;(node as any).hash = '7f699085b71746bb18cb74e3a0776f46' export default node diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js b/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js index da7f4cc45c093..79ef26c30f3a1 100644 --- a/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js +++ b/test/integration/relay-graphql-swc-multi-project/project-a/next.config.js @@ -4,7 +4,7 @@ module.exports = { experimental: { relay: { src: './pages', - artifactDirectory: '../__generated__', + artifactDirectory: './__generated__', language: relay.projects['project-b'].language, }, externalDir: true, diff --git a/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx b/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx index c70a9e48aeb6b..2f185a1bcfdfd 100644 --- a/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx +++ b/test/integration/relay-graphql-swc-multi-project/project-a/pages/index.tsx @@ -8,7 +8,7 @@ import { Store, } from 'relay-runtime' import { GetServerSideProps } from 'next' -import { pagesQuery } from '../../__generated__/pagesQuery.graphql' +import { pagesAQuery } from '../__generated__/pagesAQuery.graphql' type Props = { greeting: string } @@ -41,10 +41,10 @@ export const getServerSideProps: GetServerSideProps = async ({ req }) => { network: Network.create(createGraphQLFetcher(req.headers.host)), }) - const result = await fetchQuery( + const result = await fetchQuery( environment, graphql` - query pagesQuery { + query pagesAQuery { greeting } `, diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/__generated__/pagesBQuery.graphql.ts b/test/integration/relay-graphql-swc-multi-project/project-b/__generated__/pagesBQuery.graphql.ts new file mode 100644 index 0000000000000..da63ea9678502 --- /dev/null +++ b/test/integration/relay-graphql-swc-multi-project/project-b/__generated__/pagesBQuery.graphql.ts @@ -0,0 +1,63 @@ +/** + * @generated SignedSource<<9f92ea3ccfda1f64fa269e68b912abae>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest, Query } from 'relay-runtime' +export type pagesBQuery$variables = {} +export type pagesBQueryVariables = pagesBQuery$variables +export type pagesBQuery$data = { + readonly greeting: string +} +export type pagesBQueryResponse = pagesBQuery$data +export type pagesBQuery = { + variables: pagesBQueryVariables + response: pagesBQuery$data +} + +const node: ConcreteRequest = (function () { + var v0 = [ + { + alias: null, + args: null, + kind: 'ScalarField', + name: 'greeting', + storageKey: null, + }, + ] + return { + fragment: { + argumentDefinitions: [], + kind: 'Fragment', + metadata: null, + name: 'pagesBQuery', + selections: v0 /*: any*/, + type: 'Query', + abstractKey: null, + }, + kind: 'Request', + operation: { + argumentDefinitions: [], + kind: 'Operation', + name: 'pagesBQuery', + selections: v0 /*: any*/, + }, + params: { + cacheID: 'e7cc6f8c55ef42783faec7a49b72ae71', + id: null, + metadata: {}, + name: 'pagesBQuery', + operationKind: 'query', + text: 'query pagesBQuery {\n greeting\n}\n', + }, + } +})() + +;(node as any).hash = '83bf9452eafa7635d81bdc98603cd75f' + +export default node diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js b/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js index da7f4cc45c093..79ef26c30f3a1 100644 --- a/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js +++ b/test/integration/relay-graphql-swc-multi-project/project-b/next.config.js @@ -4,7 +4,7 @@ module.exports = { experimental: { relay: { src: './pages', - artifactDirectory: '../__generated__', + artifactDirectory: './__generated__', language: relay.projects['project-b'].language, }, externalDir: true, diff --git a/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx b/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx index 547d72f775ef7..e1adebcf42d32 100644 --- a/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx +++ b/test/integration/relay-graphql-swc-multi-project/project-b/pages/index.tsx @@ -8,7 +8,7 @@ import { Store, } from 'relay-runtime' import { GetServerSideProps } from 'next' -import { pagesQuery } from '../../__generated__/pagesQuery.graphql' +import { pagesBQuery } from '../__generated__/pagesBQuery.graphql' type Props = { greeting: string } @@ -41,10 +41,10 @@ export const getServerSideProps: GetServerSideProps = async ({ req }) => { network: Network.create(createGraphQLFetcher(req.headers.host)), }) - const result = await fetchQuery( + const result = await fetchQuery( environment, graphql` - query pagesQuery { + query pagesBQuery { greeting } `, diff --git a/test/integration/relay-graphql-swc-multi-project/relay.config.js b/test/integration/relay-graphql-swc-multi-project/relay.config.js index 10af186bc62cb..1a999e5be80ad 100644 --- a/test/integration/relay-graphql-swc-multi-project/relay.config.js +++ b/test/integration/relay-graphql-swc-multi-project/relay.config.js @@ -8,12 +8,12 @@ module.exports = { 'project-a': { schema: 'schema.graphql', language: 'typescript', - output: '__generated__', + output: 'project-a/__generated__', }, 'project-b': { schema: 'schema.graphql', language: 'typescript', - output: '__generated__', + output: 'project-b/__generated__', }, }, } From 9747ddd21059397020ab32f10027061857caeab6 Mon Sep 17 00:00:00 2001 From: Andrey Lunyov Date: Mon, 31 Jan 2022 17:20:16 -0500 Subject: [PATCH 12/15] #[cfg(target_arch = "wasm32")] (#33839) --- packages/next-swc/crates/core/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/next-swc/crates/core/src/lib.rs b/packages/next-swc/crates/core/src/lib.rs index 7b7d05c5218d4..03b77e8ea85ff 100644 --- a/packages/next-swc/crates/core/src/lib.rs +++ b/packages/next-swc/crates/core/src/lib.rs @@ -53,6 +53,7 @@ pub mod next_dynamic; pub mod next_ssg; pub mod page_config; pub mod react_remove_properties; +#[cfg(not(target_arch = "wasm32"))] pub mod relay; pub mod remove_console; pub mod shake_exports; @@ -93,6 +94,7 @@ pub struct TransformOptions { pub react_remove_properties: Option, #[serde(default)] + #[cfg(not(target_arch = "wasm32"))] pub relay: Option, #[serde(default)] @@ -104,6 +106,10 @@ pub fn custom_before_pass( file: Arc, opts: &TransformOptions, ) -> impl Fold + '_ { + #[cfg(target_arch = "wasm32")] + let relay_plugin = noop(); + + #[cfg(not(target_arch = "wasm32"))] let relay_plugin = { if let Some(config) = &opts.relay { Either::Left(relay::relay(config, file.name.clone())) From acfc3dbccf586de7acbb11284b2562a4ae780af4 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 31 Jan 2022 19:35:23 -0600 Subject: [PATCH 13/15] revert dependency bumps --- packages/next-swc/Cargo.lock | 243 ++++++++++------------- packages/next-swc/crates/wasm/Cargo.toml | 2 +- 2 files changed, 110 insertions(+), 135 deletions(-) diff --git a/packages/next-swc/Cargo.lock b/packages/next-swc/Cargo.lock index 11aa92ad36dad..efc296f06629e 100644 --- a/packages/next-swc/Cargo.lock +++ b/packages/next-swc/Cargo.lock @@ -33,7 +33,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.4", + "getrandom 0.2.3", "once_cell", "serde", "version_check", @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.52" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" +checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" [[package]] name = "arrayvec" @@ -192,9 +192,9 @@ checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" [[package]] name = "byteorder" @@ -274,9 +274,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -295,9 +295,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.6" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.6" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" dependencies = [ "cfg-if 1.0.0", "lazy_static", @@ -431,15 +431,6 @@ dependencies = [ "syn", ] -[[package]] -name = "fastrand" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" -dependencies = [ - "instant", -] - [[package]] name = "fixedbitset" version = "0.2.0" @@ -485,9 +476,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", "version_check", @@ -506,9 +497,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.4" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ "cfg-if 1.0.0", "libc", @@ -576,9 +567,9 @@ checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" [[package]] name = "indexmap" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", @@ -610,18 +601,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.1" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "js-sys" @@ -663,9 +654,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.112" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" [[package]] name = "lock_api" @@ -717,9 +708,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" dependencies = [ "autocfg", ] @@ -774,9 +765,9 @@ dependencies = [ [[package]] name = "napi-build" -version = "1.2.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd4419172727423cf30351406c54f6cc1b354a2cfb4f1dba3e6cd07f6d5522b" +checksum = "d46af3cd13ef452354c8704da88bfc4bfa38724ddb38963a5113099749710788" [[package]] name = "napi-derive" @@ -905,9 +896,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", "libc", @@ -924,9 +915,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.9.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" @@ -936,9 +927,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "ordered-float" -version = "2.10.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +checksum = "97c9d06878b3a851e8026ef94bf7fef9ba93062cd412601da4d9cf369b1cc62d" dependencies = [ "num-traits", ] @@ -969,7 +960,7 @@ checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.0", + "parking_lot_core", ] [[package]] @@ -987,19 +978,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "parking_lot_core" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f4f894f3865f6c0e02810fc597300f34dc2510f66400da262d8ae10e75767d" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.10", - "smallvec", - "windows-sys", -] - [[package]] name = "path-clean" version = "0.1.0" @@ -1046,7 +1024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ "phf_shared", - "rand", + "rand 0.7.3", ] [[package]] @@ -1074,9 +1052,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pmutil" @@ -1091,9 +1069,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" [[package]] name = "precomputed-hash" @@ -1145,18 +1123,18 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ "unicode-xid", ] [[package]] name = "quote" -version = "1.0.14" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ "proc-macro2", ] @@ -1175,12 +1153,24 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", - "rand_chacha", - "rand_core", - "rand_hc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", "rand_pcg", ] +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -1188,7 +1178,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.3", ] [[package]] @@ -1200,13 +1200,31 @@ dependencies = [ "getrandom 0.1.16", ] +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom 0.2.3", +] + [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core 0.6.3", ] [[package]] @@ -1215,7 +1233,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core", + "rand_core 0.5.1", ] [[package]] @@ -1286,9 +1304,9 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "relative-path" -version = "1.6.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d4caf086b102ab49d0525b721594a555ab55c6556086bbe52a430ad26c3bd7" +checksum = "f9629de8974fd69c97684736786b807edd3da456d3e3f95341dd9d4cbd8f5ad6" [[package]] name = "remove_dir_all" @@ -1301,9 +1319,9 @@ dependencies = [ [[package]] name = "retain_mut" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11000e6ba5020e53e7cc26f73b91ae7d5496b4977851479edb66b694c0675c21" +checksum = "448296241d034b96c11173591deaa1302f2c17b56092106c1f92c1bc0183a8c9" [[package]] name = "rustc-demangle" @@ -1328,9 +1346,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568" [[package]] name = "same-file" @@ -1411,9 +1429,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.74" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142" +checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527" dependencies = [ "itoa", "ryu", @@ -1460,9 +1478,9 @@ checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" [[package]] name = "smallvec" -version = "1.8.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "sourcemap" @@ -2350,13 +2368,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", - "fastrand", "libc", + "rand 0.8.4", "redox_syscall 0.2.10", "remove_dir_all", "winapi", @@ -2391,9 +2409,9 @@ dependencies = [ [[package]] name = "testing_macros" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfb26385ca4db3f8aa680824013819e3b9f8d9a1b64b4f83a411e09a61f11c3" +checksum = "dc6976b6f5ffd18755bef29dce0e9e882382d53bc1ed9d414ccd5c0ee7346bc2" dependencies = [ "anyhow", "glob", @@ -2528,9 +2546,9 @@ checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" [[package]] name = "typenum" -version = "1.15.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "unicode-bidi" @@ -2582,9 +2600,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "void" @@ -2623,7 +2641,7 @@ dependencies = [ "console_error_panic_hook", "next-swc", "once_cell", - "parking_lot_core 0.9.0", + "parking_lot_core", "path-clean", "serde", "serde_json", @@ -2743,46 +2761,3 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceb069ac8b2117d36924190469735767f0990833935ab430155e71a44bafe148" -dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" - -[[package]] -name = "windows_i686_gnu" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" - -[[package]] -name = "windows_i686_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index 81f772823a16c..ba836eb72c317 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib"] anyhow = "1.0.42" console_error_panic_hook = "0.1.6" once_cell = "1.3.1" -parking_lot_core = "=0.9.0" +parking_lot_core = "=0.8.0" path-clean = "0.1" serde = {version = "1", features = ["derive"]} serde_json = "1" From 02ce6da675dec19c652e5febe0f02ee066eb6f2f Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 31 Jan 2022 19:38:06 -0600 Subject: [PATCH 14/15] ensure release builds without dep bumps --- .github/workflows/build_test_deploy.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 7906496c0d9ad..83bdd424c522c 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -748,7 +748,7 @@ jobs: # Build binaries for publishing build-native: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: os: [ubuntu-18.04, macos-latest, windows-latest] @@ -867,7 +867,7 @@ jobs: build-windows-i686: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-i686 - node@14 runs-on: windows-latest env: @@ -926,7 +926,7 @@ jobs: build-windows-aarch64: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-aarch64 - node@14 runs-on: windows-latest steps: @@ -974,7 +974,7 @@ jobs: build-linux-musl: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - linux-musl - node@lts runs-on: ubuntu-latest steps: @@ -1025,7 +1025,7 @@ jobs: build-linux-aarch64-gnu: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1088,7 +1088,7 @@ jobs: build-linux-aarch64-musl: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-musl - node@14 runs-on: ubuntu-18.04 steps: @@ -1147,7 +1147,7 @@ jobs: build-linux-arm7: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - arm7-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1209,7 +1209,7 @@ jobs: build-android-aarch64: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - Android - aarch64 runs-on: macos-latest steps: @@ -1260,7 +1260,7 @@ jobs: build-wasm: needs: build - if: ${{ needs.build.outputs.isRelease == 'true' }} + # if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: target: [web, nodejs] From 0fcd22d134b64e7bbe01aff6c27686e5bf0c5161 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 31 Jan 2022 20:15:42 -0600 Subject: [PATCH 15/15] undo release builds change --- .github/workflows/build_test_deploy.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 83bdd424c522c..7906496c0d9ad 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -748,7 +748,7 @@ jobs: # Build binaries for publishing build-native: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: os: [ubuntu-18.04, macos-latest, windows-latest] @@ -867,7 +867,7 @@ jobs: build-windows-i686: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-i686 - node@14 runs-on: windows-latest env: @@ -926,7 +926,7 @@ jobs: build-windows-aarch64: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - windows-aarch64 - node@14 runs-on: windows-latest steps: @@ -974,7 +974,7 @@ jobs: build-linux-musl: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - linux-musl - node@lts runs-on: ubuntu-latest steps: @@ -1025,7 +1025,7 @@ jobs: build-linux-aarch64-gnu: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1088,7 +1088,7 @@ jobs: build-linux-aarch64-musl: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-musl - node@14 runs-on: ubuntu-18.04 steps: @@ -1147,7 +1147,7 @@ jobs: build-linux-arm7: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - arm7-unknown-linux-gnu - node@14 runs-on: ubuntu-18.04 steps: @@ -1209,7 +1209,7 @@ jobs: build-android-aarch64: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - Android - aarch64 runs-on: macos-latest steps: @@ -1260,7 +1260,7 @@ jobs: build-wasm: needs: build - # if: ${{ needs.build.outputs.isRelease == 'true' }} + if: ${{ needs.build.outputs.isRelease == 'true' }} strategy: matrix: target: [web, nodejs]