diff --git a/examples/programmatic-typescript/package.json b/examples/programmatic-typescript/package.json index bc3c27842197..866b18b43bd5 100644 --- a/examples/programmatic-typescript/package.json +++ b/examples/programmatic-typescript/package.json @@ -24,7 +24,7 @@ "prettier": "2.8.4" }, "devDependencies": { - "@types/node": "18.14.6", + "@types/node": "18.15.0", "tsup": "6.6.3" } } diff --git a/package.json b/package.json index fd7f793167bc..3aeb080a1e5d 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "jest": "28.1.3", "jest-docblock": "28.1.1", "jest-junit": "15.0.0", - "lint-staged": "13.1.2", + "lint-staged": "13.2.0", "patch-package": "6.5.1", "prettier": "2.8.4", "prettier-plugin-svelte": "2.9.0", diff --git a/packages/presets/swc-plugin/Cargo.lock b/packages/presets/swc-plugin/Cargo.lock index 9cd216ae5ecb..81cf6d7a9af4 100644 --- a/packages/presets/swc-plugin/Cargo.lock +++ b/packages/presets/swc-plugin/Cargo.lock @@ -1323,7 +1323,7 @@ dependencies = [ [[package]] name = "swc-plugin" -version = "0.1.1" +version = "0.1.2" dependencies = [ "graphql-parser", "pathdiff", @@ -1382,9 +1382,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.64.0" +version = "0.59.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1dac464a65631860012b7389d682b9f9cc70826673f21ec6f281078f62ccefb" +checksum = "68f5e05fb254be0384197b7d5ba19ad5f73764c754f96d49683ca8c86f9c1283" dependencies = [ "once_cell", "swc_atoms", @@ -1404,9 +1404,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.98.0" +version = "0.96.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1f6bc913d0f1daf0fa713a64660aed27848e0047ee671ab2206ad602730d1f" +checksum = "621c66e27fbb6cbb6434a4e2b25e439e9a2583cc3419a4a83eba51d16ac0cd7b" dependencies = [ "bitflags", "is-macro", @@ -1422,9 +1422,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.133.0" +version = "0.129.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7463347994c0faca879c0b77ee016584794d4e58510587c7b08c5c12a437de2" +checksum = "ed38caed505e7e00c58e15c5dd36a1ece62c5e6b19b4efe18833747895a7a052" dependencies = [ "memchr", "num-bigint", @@ -1454,9 +1454,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.128.0" +version = "0.124.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea3a955c65427fc94c2819ab00b3f4b635da882f7ce58d81d527755f439348c" +checksum = "89b3f472b3dfbfd279de364d2b014459a281824b938e243a8739037c445d6b6c" dependencies = [ "either", "enum_kind", @@ -1486,9 +1486,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.120.0" +version = "0.116.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54cd246fc8b639402d6bfa0e9cd79bb93efbcb0628bdf98bc4b247677b2d360" +checksum = "1607f54ac0a3e677f5a61aa71d47f067630af66ddf8a0f66092139520c4ca53c" dependencies = [ "better_scoped_tls", "bitflags", @@ -1508,9 +1508,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.123.0" +version = "0.119.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68963deb64cd43d3ca5f41f4abc4b136843f13505e35d2d1c5a0f9bed15ab92e" +checksum = "05a1509a523804cf0467b84d5b801939d6305ee2a3506619d235556c3504b1de" dependencies = [ "ansi_term", "anyhow", @@ -1534,9 +1534,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.111.0" +version = "0.107.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bc6fea9fcd2fbf5b380366d8827d37447affbb153bf0caaed0e59f09e9ea5b" +checksum = "0e4473b78bb2d4ef4f12f9c09dd3756fc108df1a9b64375b585ff3fff80c0832" dependencies = [ "indexmap", "num_cpus", @@ -1552,9 +1552,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.84.0" +version = "0.82.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa285890870239831b1f77987be6760cef3fde84a21b90df64fd159bbe5647d7" +checksum = "f7d44d0d7c3cf08d4553d1e37e34cd2cd56efc28ee90e49fbfa7073a9c5bbfba" dependencies = [ "num-bigint", "swc_atoms", @@ -1623,9 +1623,9 @@ dependencies = [ [[package]] name = "swc_plugin_proxy" -version = "0.27.0" +version = "0.25.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e2496a242d3e76f51ccdfa9a4fcbef29e452e8a6c0b51eb208f00925405abb" +checksum = "cd6df98daa1e20bdfbd2f9d4c2978daa606e53d676f1b2f72d3534cb9ce880ba" dependencies = [ "better_scoped_tls", "rkyv", diff --git a/packages/presets/swc-plugin/Cargo.toml b/packages/presets/swc-plugin/Cargo.toml index 643c9c842628..e601dc3f6cd3 100644 --- a/packages/presets/swc-plugin/Cargo.toml +++ b/packages/presets/swc-plugin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "swc-plugin" -version = "0.1.2" +version = "0.1.3" edition = "2021" description = "SWC plugin for https://the-guild.dev/graphql/codegen/plugins/presets/preset-client" license = "MIT" @@ -27,7 +27,7 @@ graphql-parser = "0.4.0" pathdiff = "0.2.1" serde = "1" serde_json = "1.0.94" -swc_core = { version = "0.64.*", features = ["ecma_plugin_transform", "ecma_visit", "ecma_utils", "ecma_parser", "common", "testing" ] } +swc_core = { version = "0.59.*", features = ["ecma_plugin_transform", "ecma_visit", "ecma_utils", "ecma_parser", "common", "testing" ] } # .cargo/config defines few alias to build plugin. # cargo build-wasi generates wasm-wasi32 binary diff --git a/packages/presets/swc-plugin/package.json b/packages/presets/swc-plugin/package.json index bf200bedb8ce..197ff19088d5 100644 --- a/packages/presets/swc-plugin/package.json +++ b/packages/presets/swc-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/client-preset-swc-plugin", - "version": "0.1.2", + "version": "0.1.3", "description": "A SWC plugin for https://the-guild.dev/graphql/codegen/plugins/presets/preset-client", "license": "MIT", "bob": false, diff --git a/website/package.json b/website/package.json index 51806b3d4780..e2b2cc93edc1 100644 --- a/website/package.json +++ b/website/package.json @@ -14,7 +14,7 @@ "@theguild/tailwind-config": "0.2.1", "@types/dedent": "0.7.0", "@types/jsonpath": "0.2.0", - "@types/node": "18.14.6", + "@types/node": "18.15.0", "@types/react": "18.0.28", "fast-xml-parser": "4.1.3", "jsonpath": "1.1.1", diff --git a/website/src/pages/plugins/presets/preset-client.mdx b/website/src/pages/plugins/presets/preset-client.mdx index debc73505699..f9766abbd6d8 100644 --- a/website/src/pages/plugins/presets/preset-client.mdx +++ b/website/src/pages/plugins/presets/preset-client.mdx @@ -450,6 +450,22 @@ module.exports = { ### SWC plugin + + As of 2023/03/11, SWC's custom plugins is still an experimental feature, that means unexpected breaking changes that + makes specific nextjs versions or our plugin incompatible are possible, so please file an issue + [here](https://github.com/dotansimha/graphql-code-generator/issues/new?assignees=&labels=&template=bug_report.yml&title=@graphql-codegen/client-preset-swc-plugin%20...) + if you faced any unexpected behavior/errors while using the plugin. + +Pro tip: if you faced the following obscure error, or the nextjs `dev` script just instantly terminates the process without any errors, +it most likely means that SWC is not happy with your nextjs version, so try upgrading it to `latest` if possible, +then let us know of your current broken version to try fixing it or documenting its no longer supported. + +```sh +thread '' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("/app/node_modules/next/dist/client/router.js")' +``` + + + The SWC plugin is not bundled in the `client-preset` package, so you will need to install it separately: diff --git a/yarn.lock b/yarn.lock index 204a1f797ace..076b200682c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4076,10 +4076,10 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node@*", "@types/node@18.14.6", "@types/node@^18.11.18": - version "18.14.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.14.6.tgz#ae1973dd2b1eeb1825695bb11ebfb746d27e3e93" - integrity sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA== +"@types/node@*", "@types/node@18.15.0", "@types/node@^18.11.18": + version "18.15.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.0.tgz#286a65e3fdffd691e170541e6ecb0410b16a38be" + integrity sha512-z6nr0TTEOBGkzLGmbypWOGnpSpSIBorEhC4L+4HeQ2iezKCi4f77kyslRwvHeNitymGQ+oFyIWGP96l/DPSV9w== "@types/node@^12.7.1": version "12.20.55" @@ -5422,11 +5422,16 @@ chalk@2.3.0, chalk@^2.0.0, chalk@^2.1.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" -chalk@5.0.1, chalk@^5.0.1: +chalk@5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.0.1.tgz#ca57d71e82bb534a296df63bbacc4a1c22b2a4b6" integrity sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w== +chalk@5.2.0, chalk@^5.0.1: + version "5.2.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" + integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== + chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -5760,11 +5765,6 @@ commander@^8.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== -commander@^9.4.1: - version "9.5.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" - integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== - common-tags@1.8.2, common-tags@^1.8.0: version "1.8.2" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" @@ -7433,14 +7433,14 @@ execa@^0.8.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-6.1.0.tgz#cea16dee211ff011246556388effa0818394fb20" - integrity sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA== +execa@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.0.0.tgz#2a44e20e73797f6c2df23889927972386157d7e4" + integrity sha512-tQbH0pH/8LHTnwTrsKWideqi6rFB/QNUawEwrn+WHyz7PX1Tuz2u7wfTvbaNBdP5JD5LVWxNo8/A8CHNZ3bV6g== dependencies: cross-spawn "^7.0.3" get-stream "^6.0.1" - human-signals "^3.0.1" + human-signals "^4.3.0" is-stream "^3.0.0" merge-stream "^2.0.0" npm-run-path "^5.1.0" @@ -8425,10 +8425,10 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -human-signals@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-3.0.1.tgz#c740920859dafa50e5a3222da9d3bf4bb0e5eef5" - integrity sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ== +human-signals@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.0.tgz#2095c3cd5afae40049403d4b811235b03879db50" + integrity sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ== husky@8.0.3: version "8.0.3" @@ -9762,34 +9762,34 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lilconfig@2.0.6, lilconfig@^2.0.3, lilconfig@^2.0.5, lilconfig@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.6.tgz#32a384558bd58af3d4c6e077dd1ad1d397bc69d4" - integrity sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg== +lilconfig@2.1.0, lilconfig@^2.0.3, lilconfig@^2.0.5, lilconfig@^2.0.6: + version "2.1.0" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" + integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== lines-and-columns@^1.1.6: version "1.2.4" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== -lint-staged@13.1.2: - version "13.1.2" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.1.2.tgz#443636a0cfd834d5518d57d228130dc04c83d6fb" - integrity sha512-K9b4FPbWkpnupvK3WXZLbgu9pchUJ6N7TtVZjbaPsoizkqFUDkUReUL25xdrCljJs7uLUF3tZ7nVPeo/6lp+6w== +lint-staged@13.2.0: + version "13.2.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.2.0.tgz#b7abaf79c91cd36d824f17b23a4ce5209206126a" + integrity sha512-GbyK5iWinax5Dfw5obm2g2ccUiZXNGtAS4mCbJ0Lv4rq6iEtfBSjOYdcbOtAIFtM114t0vdpViDDetjVTSd8Vw== dependencies: + chalk "5.2.0" cli-truncate "^3.1.0" - colorette "^2.0.19" - commander "^9.4.1" + commander "^10.0.0" debug "^4.3.4" - execa "^6.1.0" - lilconfig "2.0.6" - listr2 "^5.0.5" + execa "^7.0.0" + lilconfig "2.1.0" + listr2 "^5.0.7" micromatch "^4.0.5" normalize-path "^3.0.0" - object-inspect "^1.12.2" + object-inspect "^1.12.3" pidtree "^0.6.0" string-argv "^0.3.1" - yaml "^2.1.3" + yaml "^2.2.1" listr2@^3.8.3: version "3.14.0" @@ -9819,7 +9819,7 @@ listr2@^4.0.5: through "^2.3.8" wrap-ansi "^7.0.0" -listr2@^5.0.5: +listr2@^5.0.7: version "5.0.7" resolved "https://registry.yarnpkg.com/listr2/-/listr2-5.0.7.tgz#de69ccc4caf6bea7da03c74f7a2ffecf3904bd53" integrity sha512-MD+qXHPmtivrHIDRwPYdfNkrzqDiuaKU/rfBcec3WMyMF3xylQj3jMq344OtvQxz7zaCFViRAeqlr2AFhPvXHw== @@ -11186,7 +11186,7 @@ object-hash@^3.0.0: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== -object-inspect@^1.12.2, object-inspect@^1.9.0: +object-inspect@^1.12.2, object-inspect@^1.12.3, object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== @@ -14658,7 +14658,7 @@ yaml@^1.10.0, yaml@^1.10.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.0.0, yaml@^2.1.3: +yaml@^2.0.0, yaml@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.1.tgz#3014bf0482dcd15147aa8e56109ce8632cd60ce4" integrity sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==