From 0604ca7088bb4f8309fcecd0a596de9e4354f795 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Wed, 22 May 2024 12:39:22 +0530 Subject: [PATCH 1/9] chore: update readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index caf4a2a..02ff613 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # graphql-tag-swc-plugin +[![NPM Downloads](https://img.shields.io/npm/d18m/graphql-tag-swc-plugin?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/graphql-tag-swc-plugin) +![GitHub Repo stars](https://img.shields.io/github/stars/rishabh3112/graphql-tag-swc-plugin?style=for-the-badge&logo=github) + + SWC plugin alternative to `babel-plugin-graphql-tag` ## Installation From e9dcee6f2b411ab5de777855729950199a30cc96 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Mon, 10 Jun 2024 16:56:28 +0530 Subject: [PATCH 2/9] chore: update docs --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 02ff613..6db1e7e 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ [![NPM Downloads](https://img.shields.io/npm/d18m/graphql-tag-swc-plugin?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/graphql-tag-swc-plugin) ![GitHub Repo stars](https://img.shields.io/github/stars/rishabh3112/graphql-tag-swc-plugin?style=for-the-badge&logo=github) +[![](https://img.shields.io/static/v1?label=Sponsor%20Project&message=%E2%9D%A4&color=%23fe8e86&style=for-the-badge)](https://github.com/sponsors/rishabh3112) -SWC plugin alternative to `babel-plugin-graphql-tag` +SWC plugin alternative to `babel-plugin-graphql-tag`. + ## Installation From effac58079d7206c43be52b539bd112d802b0795 Mon Sep 17 00:00:00 2001 From: Andrei Anelkin <35991006+desout@users.noreply.github.com> Date: Thu, 20 Jun 2024 12:55:52 +0300 Subject: [PATCH 3/9] chore: add support for un-named definations * fixed 2 cases with unnamed operation and query * fixed comments * chore: format files and minor updates --------- Co-authored-by: Rishabh Chawla --- .../operation/unnamed_operation/input.js | 3 + .../operation/unnamed_operation/output.js | 33 +++++++++++ .../unnamed_operation/strip-output.js | 33 +++++++++++ .../operation/unnamed_query/input.js | 3 + .../operation/unnamed_query/output.js | 55 +++++++++++++++++++ .../operation/unnamed_query/strip-output.js | 55 +++++++++++++++++++ .../src/parser/nodes/definitions/mod.rs | 13 ++++- .../src/parser/nodes/definitions/operation.rs | 17 ++++-- transforms/graphql_tag/src/parser/utils.rs | 4 ++ 9 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 tests/graphql_tag/definations/operation/unnamed_operation/input.js create mode 100644 tests/graphql_tag/definations/operation/unnamed_operation/output.js create mode 100644 tests/graphql_tag/definations/operation/unnamed_operation/strip-output.js create mode 100644 tests/graphql_tag/definations/operation/unnamed_query/input.js create mode 100644 tests/graphql_tag/definations/operation/unnamed_query/output.js create mode 100644 tests/graphql_tag/definations/operation/unnamed_query/strip-output.js diff --git a/tests/graphql_tag/definations/operation/unnamed_operation/input.js b/tests/graphql_tag/definations/operation/unnamed_operation/input.js new file mode 100644 index 0000000..234de95 --- /dev/null +++ b/tests/graphql_tag/definations/operation/unnamed_operation/input.js @@ -0,0 +1,3 @@ +import gql from 'graphql-tag'; + +const foo = gql`{foo}`; \ No newline at end of file diff --git a/tests/graphql_tag/definations/operation/unnamed_operation/output.js b/tests/graphql_tag/definations/operation/unnamed_operation/output.js new file mode 100644 index 0000000..ab6ae09 --- /dev/null +++ b/tests/graphql_tag/definations/operation/unnamed_operation/output.js @@ -0,0 +1,33 @@ +import gql from 'graphql-tag'; +const foo = { + "kind": "Document", + "definitions": [ + { + "kind": "OperationDefinition", + "directives": [], + "variableDefinitions": [], + "operation": "query", + "selectionSet": { + "kind": "SelectionSet", + "selections": [ + { + "kind": "Field", + "name": { + "kind": "Name", + "value": "foo" + }, + "arguments": [], + "directives": [] + } + ] + } + } + ], + "loc": { + "start": 0, + "end": 5, + "source": { + "body": "{foo}" + } + } +}; diff --git a/tests/graphql_tag/definations/operation/unnamed_operation/strip-output.js b/tests/graphql_tag/definations/operation/unnamed_operation/strip-output.js new file mode 100644 index 0000000..ab6ae09 --- /dev/null +++ b/tests/graphql_tag/definations/operation/unnamed_operation/strip-output.js @@ -0,0 +1,33 @@ +import gql from 'graphql-tag'; +const foo = { + "kind": "Document", + "definitions": [ + { + "kind": "OperationDefinition", + "directives": [], + "variableDefinitions": [], + "operation": "query", + "selectionSet": { + "kind": "SelectionSet", + "selections": [ + { + "kind": "Field", + "name": { + "kind": "Name", + "value": "foo" + }, + "arguments": [], + "directives": [] + } + ] + } + } + ], + "loc": { + "start": 0, + "end": 5, + "source": { + "body": "{foo}" + } + } +}; diff --git a/tests/graphql_tag/definations/operation/unnamed_query/input.js b/tests/graphql_tag/definations/operation/unnamed_query/input.js new file mode 100644 index 0000000..477e8e4 --- /dev/null +++ b/tests/graphql_tag/definations/operation/unnamed_query/input.js @@ -0,0 +1,3 @@ +import gql from 'graphql-tag'; + +const foo = gql`query($foo: String!) {foo1}`; \ No newline at end of file diff --git a/tests/graphql_tag/definations/operation/unnamed_query/output.js b/tests/graphql_tag/definations/operation/unnamed_query/output.js new file mode 100644 index 0000000..f8a56c2 --- /dev/null +++ b/tests/graphql_tag/definations/operation/unnamed_query/output.js @@ -0,0 +1,55 @@ +import gql from 'graphql-tag'; +const foo = { + "kind": "Document", + "definitions": [ + { + "kind": "OperationDefinition", + "directives": [], + "variableDefinitions": [ + { + "kind": "VariableDefinition", + "directives": [], + "variable": { + "kind": "Variable", + "name": { + "kind": "Name", + "value": "foo" + } + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + } + } + ], + "operation": "query", + "selectionSet": { + "kind": "SelectionSet", + "selections": [ + { + "kind": "Field", + "name": { + "kind": "Name", + "value": "foo1" + }, + "arguments": [], + "directives": [] + } + ] + } + } + ], + "loc": { + "start": 0, + "end": 27, + "source": { + "body": "query($foo: String!) {foo1}" + } + } +}; \ No newline at end of file diff --git a/tests/graphql_tag/definations/operation/unnamed_query/strip-output.js b/tests/graphql_tag/definations/operation/unnamed_query/strip-output.js new file mode 100644 index 0000000..65a4ea2 --- /dev/null +++ b/tests/graphql_tag/definations/operation/unnamed_query/strip-output.js @@ -0,0 +1,55 @@ +import gql from 'graphql-tag'; +const foo = { + "kind": "Document", + "definitions": [ + { + "kind": "OperationDefinition", + "directives": [], + "variableDefinitions": [ + { + "kind": "VariableDefinition", + "directives": [], + "variable": { + "kind": "Variable", + "name": { + "kind": "Name", + "value": "foo" + } + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + } + } + ], + "operation": "query", + "selectionSet": { + "kind": "SelectionSet", + "selections": [ + { + "kind": "Field", + "name": { + "kind": "Name", + "value": "foo1" + }, + "arguments": [], + "directives": [] + } + ] + } + } + ], + "loc": { + "start": 0, + "end": 25, + "source": { + "body": "query($foo:String!){foo1}" + } + } +}; \ No newline at end of file diff --git a/transforms/graphql_tag/src/parser/nodes/definitions/mod.rs b/transforms/graphql_tag/src/parser/nodes/definitions/mod.rs index 2f92bc9..2e78bb2 100644 --- a/transforms/graphql_tag/src/parser/nodes/definitions/mod.rs +++ b/transforms/graphql_tag/src/parser/nodes/definitions/mod.rs @@ -11,7 +11,14 @@ mod operation; use fragment::create_fragment_definition; use operation::create_operation_definition; -pub fn create_definition(definition: Definition, span: Span) -> Option { +pub fn create_definition( + definition: Definition, + span: Span, + assert_definition_name: bool, +) -> Option { + if assert_definition_name { + definition.name().expect("GraphQL query must have name."); + } let def_expr = match definition { Definition::FragmentDefinition(frag_def) => create_fragment_definition(frag_def, span), Definition::OperationDefinition(operation_def) => { @@ -42,8 +49,10 @@ pub fn create_definition(definition: Definition, span: Span) -> Option, span: Span) -> Expr { let mut all_definitions = vec![]; + let is_multiple_definitions = definitions.clone().count() > 1; + for def in definitions { - all_definitions.push(create_definition(def, span)); + all_definitions.push(create_definition(def, span, is_multiple_definitions)); } Expr::Array(ArrayLit { diff --git a/transforms/graphql_tag/src/parser/nodes/definitions/operation.rs b/transforms/graphql_tag/src/parser/nodes/definitions/operation.rs index b176bc1..6ee0f6b 100644 --- a/transforms/graphql_tag/src/parser/nodes/definitions/operation.rs +++ b/transforms/graphql_tag/src/parser/nodes/definitions/operation.rs @@ -14,10 +14,7 @@ use crate::parser::{ pub fn create_operation_definition(definition: OperationDefinition, span: Span) -> Box { let kind = get_key_value_node("kind".into(), "OperationDefinition".into()); - let name = get_key_value_node( - "name".into(), - create_name(definition.name().unwrap().text().as_str().into(), span), - ); + let variable_definitions = get_key_value_node( "variableDefinitions".into(), create_variable_definitions(definition.variable_definitions(), span), @@ -34,9 +31,19 @@ pub fn create_operation_definition(definition: OperationDefinition, span: Span) let mut opr_def = ObjectLit { span, - props: vec![kind, name, directives, variable_definitions, operation], + props: vec![kind, directives, variable_definitions, operation], }; + if definition.name().is_some() { + opr_def.props.insert( + 1, + get_key_value_node( + "name".into(), + create_name(definition.name().unwrap().text().as_str().into(), span), + ), + ); + } + if definition.selection_set().is_some() { let selection_set = get_key_value_node( "selectionSet".into(), diff --git a/transforms/graphql_tag/src/parser/utils.rs b/transforms/graphql_tag/src/parser/utils.rs index 3a35d7d..9e4cf71 100644 --- a/transforms/graphql_tag/src/parser/utils.rs +++ b/transforms/graphql_tag/src/parser/utils.rs @@ -10,6 +10,10 @@ pub fn get_key_value_node(key: String, value: Expr) -> PropOrSpread { } pub fn get_operation_token(operation_type: Option) -> String { + if operation_type.is_none() { + return "query".into(); + } + let opr_token = operation_type.unwrap(); if opr_token.query_token().is_some() { From a4f1f2508ed2837cd75d6d44c6b8c6289a301858 Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Thu, 20 Jun 2024 15:31:11 +0530 Subject: [PATCH 4/9] chore: add license file --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..237be1c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Rishabh Chawla + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 661f8341bf3b975a98e9b0fce55d22013d9ddb2b Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Thu, 20 Jun 2024 15:29:26 +0530 Subject: [PATCH 5/9] chore: update package json metadata --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d94dc19..bc5d7d7 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,13 @@ "version": "1.0.0", "description": "SWC plugin to expand gql tags at build time", "author": "rishabh3112 ", - "license": "ISC", + "license": "MIT", "keywords": [ "swc-plugin", "swc", "graphql" ], + "repository": "github:rishabh3112/graphql-tag-swc-plugin", "main": "graphql_tag_swc_plugin.wasm", "scripts": { "build": "cargo build-wasi --release && cp target/wasm32-wasi/release/graphql_tag_swc_plugin.wasm .", From 50bec495b7a67e47d065d0a8daabd5a809cb8dea Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Thu, 20 Jun 2024 15:32:13 +0530 Subject: [PATCH 6/9] 1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc5d7d7..3645620 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphql-tag-swc-plugin", - "version": "1.0.0", + "version": "1.1.0", "description": "SWC plugin to expand gql tags at build time", "author": "rishabh3112 ", "license": "MIT", From 2b36371d44d91fab90ea4efaff7f7c41f00382ca Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Mon, 4 Nov 2024 18:50:23 +0530 Subject: [PATCH 7/9] chore: update swc crates (#22) --- Cargo.lock | 659 ++++++++++++++---- Cargo.toml | 7 +- tests/fixtures.rs | 1 + transforms/graphql_tag/Cargo.toml | 10 +- .../src/parser/nodes/document/mod.rs | 9 +- transforms/graphql_tag/src/utils/mod.rs | 32 +- transforms/unique_identifier/Cargo.toml | 4 +- 7 files changed, 571 insertions(+), 151 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3332d9f..344db02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,15 +38,33 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "ansi_term" version = "0.12.1" @@ -58,9 +76,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" [[package]] name = "apollo-parser" @@ -82,7 +100,19 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.60", + "syn 2.0.87", +] + +[[package]] +name = "ast_node" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4d23a6d1d5f18bdbc06d9aa908880e5f49205156ba804751af731c51f5cf81a" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.87", ] [[package]] @@ -134,9 +164,9 @@ dependencies = [ [[package]] name = "better_scoped_tls" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794edcc9b3fb07bb4aecaa11f093fd45663b4feadb782d68303a2268bc2701de" +checksum = "297b153aa5e573b5863108a6ddc9d5c968bd0b20e75cc614ee9821d2f45679c7" dependencies = [ "scoped-tls", ] @@ -174,6 +204,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +dependencies = [ + "allocator-api2", +] + [[package]] name = "bytecheck" version = "0.6.11" @@ -234,6 +273,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.20", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.73" @@ -271,6 +324,41 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.87", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.87", +] + [[package]] name = "data-encoding" version = "2.5.0" @@ -287,6 +375,37 @@ dependencies = [ "uuid", ] +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn 2.0.87", +] + [[package]] name = "diff" version = "0.1.13" @@ -337,6 +456,12 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -354,7 +479,18 @@ checksum = "fdc9cc75639b041067353b9bce2450d6847e547276c6fbe4487d7407980e07db" dependencies = [ "proc-macro2", "swc_macros_common", - "syn 2.0.60", + "syn 2.0.87", +] + +[[package]] +name = "from_variant" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d8947525c49c73130b5a7187b55b027b6b78fe60268d9f4c283ed690698cb1" +dependencies = [ + "proc-macro2", + "swc_macros_common", + "syn 2.0.87", ] [[package]] @@ -404,10 +540,11 @@ dependencies = [ "serde", "serde_json", "swc_core", - "swc_ecma_ast", - "swc_ecma_parser", + "swc_ecma_ast 0.121.2", + "swc_ecma_parser 0.143.16", + "swc_ecma_parser 0.152.2", "swc_ecma_visit", - "testing", + "testing 0.35.24", "unique_identifier", ] @@ -420,10 +557,10 @@ dependencies = [ "regex", "serde", "serde_json", - "swc_common", + "swc_common 0.40.2", "swc_core", - "swc_ecma_ast", - "swc_ecma_parser", + "swc_ecma_ast 0.121.2", + "swc_ecma_parser 0.152.2", "swc_ecma_visit", "thiserror", ] @@ -434,14 +571,18 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", +] [[package]] name = "hermit-abi" @@ -460,11 +601,11 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hstr" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96274be293b8877e61974a607105d09c84caebe9620b47774aa8a6b942042dd4" +checksum = "dae404c0c5d4e95d4858876ab02eecd6a196bb8caa42050dfa809938833fc412" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", "new_debug_unreachable", "once_cell", "phf", @@ -472,6 +613,12 @@ dependencies = [ "triomphe", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -495,7 +642,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -507,7 +654,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -565,7 +712,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -593,7 +740,7 @@ dependencies = [ "backtrace", "miette-derive 3.3.0", "once_cell", - "owo-colors", + "owo-colors 3.5.0", "supports-color", "supports-hyperlinks", "supports-unicode", @@ -612,7 +759,7 @@ dependencies = [ "backtrace", "miette-derive 4.7.1", "once_cell", - "owo-colors", + "owo-colors 3.5.0", "supports-color", "supports-hyperlinks", "supports-unicode", @@ -622,6 +769,20 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "miette" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" +dependencies = [ + "cfg-if", + "miette-derive 7.2.0", + "owo-colors 4.1.0", + "textwrap 0.16.1", + "thiserror", + "unicode-width", +] + [[package]] name = "miette-derive" version = "3.3.0" @@ -644,6 +805,17 @@ dependencies = [ "syn 1.0.99", ] +[[package]] +name = "miette-derive" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "miniz_oxide" version = "0.5.3" @@ -655,9 +827,9 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nu-ansi-term" @@ -743,6 +915,12 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "owo-colors" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" + [[package]] name = "parking_lot" version = "0.12.1" @@ -802,7 +980,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -832,9 +1010,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -918,13 +1096,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -933,7 +1112,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.27", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", ] [[package]] @@ -942,6 +1132,12 @@ version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + [[package]] name = "relative-path" version = "1.7.2" @@ -959,9 +1155,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -977,9 +1173,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -1035,9 +1231,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -1045,6 +1241,12 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "ryu-js" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad97d4ce1560a5e27cec89519dc8300d1aa6035b099821261c651486a19e44d5" + [[package]] name = "scoped-tls" version = "1.0.1" @@ -1104,7 +1306,7 @@ checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1184,9 +1386,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "sourcemap" -version = "8.0.1" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208d40b9e8cad9f93613778ea295ed8f3c2b1824217c6cfc7219d3f6f45b96d4" +checksum = "dab08a862c70980b8e23698b507e272317ae52a608a164a844111f5372374f1f" dependencies = [ "base64-simd", "bitvec", @@ -1228,16 +1430,22 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_enum" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b650ea2087d32854a0f20b837fc56ec987a1cb4f758c9757e1171ee9812da63" +checksum = "05e383308aebc257e7d7920224fa055c632478d92744eca77f99be8fa1545b90" dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.60", + "syn 2.0.87", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "supports-color" version = "1.3.0" @@ -1266,11 +1474,36 @@ dependencies = [ "atty", ] +[[package]] +name = "swc_allocator" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76aa0eb65c0f39f9b6d82a7e5192c30f7ac9a78f084a21f270de1d8c600ca388" +dependencies = [ + "bumpalo", + "hashbrown 0.14.5", + "ptr_meta", + "rustc-hash", + "triomphe", +] + [[package]] name = "swc_atoms" version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb6567e4e67485b3e7662b486f1565bdae54bd5b9d6b16b2ba1a9babb1e42125" +dependencies = [ + "hstr", + "once_cell", + "rustc-hash", + "serde", +] + +[[package]] +name = "swc_atoms" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b25ff0f3fd48ab1a95d86fd0505fdd1ac904f84d0350dc8222bbc824e9d4fdf6" dependencies = [ "bytecheck", "hstr", @@ -1286,14 +1519,41 @@ version = "0.33.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2f9706038906e66f3919028f9f7a37f3ed552f1b85578e93f4468742e2da438" dependencies = [ - "anyhow", - "ast_node", + "ast_node 0.9.8", "atty", "better_scoped_tls", + "cfg-if", + "either", + "from_variant 0.1.8", + "new_debug_unreachable", + "num-bigint", + "once_cell", + "parking_lot", + "rustc-hash", + "serde", + "siphasher", + "swc_atoms 0.6.7", + "swc_eq_ignore_macros", + "swc_visit 0.5.14", + "termcolor", + "tracing", + "unicode-width", + "url", +] + +[[package]] +name = "swc_common" +version = "0.40.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca32839a37f3b12213b18623b1bd58d37641cab750c50c3c287876cb98b12ab4" +dependencies = [ + "anyhow", + "ast_node 1.0.0", + "better_scoped_tls", "bytecheck", "cfg-if", "either", - "from_variant", + "from_variant 1.0.0", "new_debug_unreachable", "num-bigint", "once_cell", @@ -1303,9 +1563,10 @@ dependencies = [ "serde", "siphasher", "sourcemap", - "swc_atoms", + "swc_allocator", + "swc_atoms 1.0.2", "swc_eq_ignore_macros", - "swc_visit", + "swc_visit 0.6.2", "termcolor", "tracing", "unicode-width", @@ -1314,14 +1575,15 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.90.37" +version = "0.106.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecbbbf25e5d035165bde87f2388f9fbe6d5ce38ddd2c6cb9f24084823a9c0044" +checksum = "0d4d1040f3e4289cdae3e53965b9100b1af09a0422382e8f5161f7a438705c14" dependencies = [ "once_cell", - "swc_atoms", - "swc_common", - "swc_ecma_ast", + "swc_allocator", + "swc_atoms 1.0.2", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", "swc_ecma_transforms_base", "swc_ecma_transforms_testing", "swc_ecma_visit", @@ -1336,6 +1598,23 @@ name = "swc_ecma_ast" version = "0.112.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1d5c33c22ad50e8e34b3080a6fb133316d2eaa7d00400fc5018151f5ca44c5a" +dependencies = [ + "bitflags 2.5.0", + "is-macro", + "num-bigint", + "phf", + "scoped-tls", + "string_enum", + "swc_atoms 0.6.7", + "swc_common 0.33.26", + "unicode-id-start", +] + +[[package]] +name = "swc_ecma_ast" +version = "0.121.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d568834a727fc06c608db119dcea52c2d58e9426e92e72f358e2f7dc847063" dependencies = [ "bitflags 2.5.0", "bytecheck", @@ -1345,40 +1624,41 @@ dependencies = [ "rkyv", "scoped-tls", "string_enum", - "swc_atoms", - "swc_common", + "swc_atoms 1.0.2", + "swc_common 0.40.2", "unicode-id-start", ] [[package]] name = "swc_ecma_codegen" -version = "0.148.13" +version = "0.158.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ae864cb69934f8753b9cbbad803a0ee1b0759f5b87c219db0a12e8d03fa86a" +checksum = "e2549dd7b0f4db0b127fe286958f749b4e2d5467cb6739a78ac887df4f33dcef" dependencies = [ "memchr", "num-bigint", "once_cell", - "rustc-hash", + "regex", "serde", "sourcemap", - "swc_atoms", - "swc_common", - "swc_ecma_ast", + "swc_allocator", + "swc_atoms 1.0.2", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", "swc_ecma_codegen_macros", "tracing", ] [[package]] name = "swc_ecma_codegen_macros" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ab87ba81ae05efd394ab4a8cbdba595ac3554a5e393c76699449d47c43582e" +checksum = "859fabde36db38634f3fad548dd5e3410c1aebba1b67a3c63e67018fa57a0bca" dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1396,31 +1676,53 @@ dependencies = [ "smallvec", "smartstring", "stacker", - "swc_atoms", - "swc_common", - "swc_ecma_ast", + "swc_atoms 0.6.7", + "swc_common 0.33.26", + "swc_ecma_ast 0.112.8", + "tracing", + "typed-arena", +] + +[[package]] +name = "swc_ecma_parser" +version = "0.152.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b888663998ef49da15d1dd3377e6b62bab4f994588e4f405628cb058d11ce8b3" +dependencies = [ + "either", + "new_debug_unreachable", + "num-bigint", + "num-traits", + "phf", + "serde", + "smallvec", + "smartstring", + "stacker", + "swc_atoms 1.0.2", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", "tracing", "typed-arena", ] [[package]] name = "swc_ecma_testing" -version = "0.22.22" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5704ef494b1805bc4566ff566b964bc1e9d3fb0f0e046ad6392b09a54de844" +checksum = "d88a64496b73a0e9c9d8333d14d39904e8d87dbcefe7baaa161803a7f5bae110" dependencies = [ "anyhow", "hex", "sha2", - "testing", + "testing 0.42.1", "tracing", ] [[package]] name = "swc_ecma_transforms_base" -version = "0.137.16" +version = "0.149.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e9a23d6af398b6efd17bbdad2cfa580102f6c560611f85c63b48f76ffe8f0c" +checksum = "f2194d20416a03ae02058934f8387691809f86466a2f2e7a65c56dcb001bd46b" dependencies = [ "better_scoped_tls", "bitflags 2.5.0", @@ -1430,10 +1732,10 @@ dependencies = [ "rustc-hash", "serde", "smallvec", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", + "swc_atoms 1.0.2", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", + "swc_ecma_parser 0.152.2", "swc_ecma_utils", "swc_ecma_visit", "tracing", @@ -1441,9 +1743,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.140.18" +version = "0.152.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c0ea6f85b7bf04391a172d7a369e49865effa77ec3a6cd0e969a274cfcb982d" +checksum = "b0cd337a171f362abb45841429b75c8fa78750fefa4896c8b1900ba16e4a2e71" dependencies = [ "ansi_term", "anyhow", @@ -1453,31 +1755,32 @@ dependencies = [ "serde_json", "sha2", "sourcemap", - "swc_common", - "swc_ecma_ast", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", "swc_ecma_codegen", - "swc_ecma_parser", + "swc_ecma_parser 0.152.2", "swc_ecma_testing", "swc_ecma_transforms_base", "swc_ecma_utils", "swc_ecma_visit", "tempfile", - "testing", + "testing 0.42.1", ] [[package]] name = "swc_ecma_utils" -version = "0.127.20" +version = "0.137.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d40abfc4f3a7bfdf54d11ac705cc9dd0836c48bf085b359143b4d40b50cb31" +checksum = "939f21c75eff61ad3e485fc54d38988f2f9744ceda24a3feb8228dd072171d94" dependencies = [ "indexmap", "num_cpus", "once_cell", "rustc-hash", - "swc_atoms", - "swc_common", - "swc_ecma_ast", + "ryu-js", + "swc_atoms 1.0.2", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", "swc_ecma_visit", "tracing", "unicode-id", @@ -1485,15 +1788,16 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.98.7" +version = "0.107.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93692bdcdbb63db8f5e10fea5d202b5487cb27eb443aec424f4335c88f9864af" +checksum = "b5983d63df36fdefec8b4bdb88d1fdcd06c9acb815d987c871409a5a64d58f63" dependencies = [ + "new_debug_unreachable", "num-bigint", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_visit", + "swc_atoms 1.0.2", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", + "swc_visit 0.6.2", "tracing", ] @@ -1505,7 +1809,7 @@ checksum = "695a1d8b461033d32429b5befbf0ad4d7a2c4d6ba9cd5ba4e0645c615839e8e4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1518,7 +1822,20 @@ dependencies = [ "miette 4.7.1", "once_cell", "parking_lot", - "swc_common", + "swc_common 0.33.26", +] + +[[package]] +name = "swc_error_reporters" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83f9286183c9be40aafcbbe8c397403fb32af812a3dffe93eee9067aee4fbedb" +dependencies = [ + "anyhow", + "miette 7.2.0", + "once_cell", + "parking_lot", + "swc_common 0.40.2", ] [[package]] @@ -1529,7 +1846,7 @@ checksum = "91745f3561057493d2da768437c427c0e979dff7396507ae02f16c981c4a8466" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1549,32 +1866,32 @@ checksum = "3232db481484070637b20a155c064096c0ea1ba04fa2247b89b618661b3574f4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] name = "swc_plugin_proxy" -version = "0.41.7" +version = "0.50.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e09ebf5da9eb13f431ebfb916cd3378a87ffae927ba896261ebc9dc094457ae" +checksum = "62a0c7f6098cb0ea5d0191bc02c5b3705000f2dd94c6da31f3ac47adf77ae419" dependencies = [ "better_scoped_tls", "rkyv", - "swc_common", - "swc_ecma_ast", + "swc_common 0.40.2", + "swc_ecma_ast 0.121.2", "swc_trace_macro", "tracing", ] [[package]] name = "swc_trace_macro" -version = "0.1.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" +checksum = "69aa25f667e4d74ab10a17a266edeb8b354273817b20b91e60471f1c860a221b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1587,6 +1904,16 @@ dependencies = [ "swc_visit_macros", ] +[[package]] +name = "swc_visit" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ceb044142ba2719ef9eb3b6b454fce61ab849eb696c34d190f04651955c613d" +dependencies = [ + "either", + "new_debug_unreachable", +] + [[package]] name = "swc_visit_macros" version = "0.5.12" @@ -1597,7 +1924,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1613,9 +1940,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -1667,15 +1994,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71dd5265f4921fe51b386b1496c63ac058589d8cd38de6b61489a98c6019a16" dependencies = [ "ansi_term", - "cargo_metadata", + "cargo_metadata 0.15.4", + "difference", + "once_cell", + "pretty_assertions", + "regex", + "serde", + "serde_json", + "swc_common 0.33.26", + "swc_error_reporters 0.17.20", + "testing_macros", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "testing" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9217860da21fabe9c65981ba42f6dad2bd8f463b670448afe79aa9d50f0bc137" +dependencies = [ + "ansi_term", + "cargo_metadata 0.18.1", "difference", "once_cell", "pretty_assertions", "regex", "serde", "serde_json", - "swc_common", - "swc_error_reporters", + "swc_common 0.40.2", + "swc_error_reporters 1.0.0", "testing_macros", "tracing", "tracing-subscriber", @@ -1694,7 +2042,7 @@ dependencies = [ "quote", "regex", "relative-path", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1725,24 +2073,35 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "textwrap" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + [[package]] name = "thiserror" -version = "1.0.32" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" +checksum = "3b3c6efbfc763e64eb85c11c25320f0737cb7364c4b6336db90aa9ebe27a0bbd" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.32" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" +checksum = "b607164372e89797d78b8e23a6d67d5d1038c1c65efd52e1389ef8b77caba2a6" dependencies = [ "proc-macro2", "quote", - "syn 1.0.99", + "syn 2.0.87", ] [[package]] @@ -1788,7 +2147,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.87", ] [[package]] @@ -1832,9 +2191,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.11" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" +checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" dependencies = [ "serde", "stable_deref_trait", @@ -1866,9 +2225,9 @@ checksum = "69fe8d9274f490a36442acb4edfd0c4e473fdfc6a8b5cd32f28a0235761aedbe" [[package]] name = "unicode-id-start" -version = "1.1.2" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f73150333cb58412db36f2aca8f2875b013049705cc77b94ded70a1ab1f5da" +checksum = "2f322b60f6b9736017344fa0635d64be2f458fbc04eef65f6be22976dd1ffd5b" [[package]] name = "unicode-ident" @@ -1878,12 +2237,9 @@ checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-linebreak" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f" -dependencies = [ - "regex", -] +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-normalization" @@ -1896,15 +2252,15 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unique_identifier" version = "0.1.0" dependencies = [ - "swc_ecma_ast", + "swc_ecma_ast 0.121.2", "swc_ecma_visit", ] @@ -1933,11 +2289,26 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vergen" -version = "8.2.6" +version = "9.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349ed9e45296a581f455bc18039878f409992999bc1d5da12a6800eb18c8752f" +dependencies = [ + "anyhow", + "cargo_metadata 0.18.1", + "derive_builder", + "regex", + "rustversion", + "vergen-lib", +] + +[[package]] +name = "vergen-lib" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1290fd64cc4e7d3c9b07d7f333ce0ce0007253e32870e632624835cc80b83939" +checksum = "229eaddb0050920816cf051e619affaf18caa3dd512de8de5839ccbc8e53abb0" dependencies = [ "anyhow", + "derive_builder", "rustversion", ] @@ -2173,3 +2544,23 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] diff --git a/Cargo.toml b/Cargo.toml index 8f3b9ee..f01b221 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,10 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -swc_core = { version = "0.90.30", features = ["ecma_plugin_transform"] } -swc_ecma_ast = "^0.112.6" -swc_ecma_visit = "^0.98.7" +swc_core = { version = "0.106.3", features = ["ecma_plugin_transform"] } +swc_ecma_ast = "0.121.1" +swc_ecma_visit = "0.107.0" +swc_ecma_parser = "0.152.1" graphql_tag = { path = "./transforms/graphql_tag" } unique_identifier = { path = "./transforms/unique_identifier" } serde = "1.0.193" diff --git a/tests/fixtures.rs b/tests/fixtures.rs index 2d40a93..5ccbeda 100644 --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -12,6 +12,7 @@ use graphql_tag::structs::{GraphQLTagConfig, TransformVisitor}; use unique_identifier::UniqueIdentifierVisitor; fn get_syntax() -> Syntax { + // TODO: use EsSyntax instead Syntax::Es(EsConfig { jsx: true, ..Default::default() diff --git a/transforms/graphql_tag/Cargo.toml b/transforms/graphql_tag/Cargo.toml index 733cd59..5deb2b3 100644 --- a/transforms/graphql_tag/Cargo.toml +++ b/transforms/graphql_tag/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" [dependencies] apollo-parser = "0.7.5" -swc_common = { version = "*", features = ["concurrent"] } -swc_ecma_ast = "^0.112.6" -swc_ecma_visit = "^0.98.7" -swc_ecma_parser = "^0.143.10" -swc_core = { version = "0.90.30", features = ["ecma_plugin_transform"] } +swc_common = { version = "0.40.1", features = ["concurrent"] } +swc_ecma_ast = "0.121.1" +swc_ecma_visit = "0.107.0" +swc_ecma_parser = "0.152.1" +swc_core = { version = "0.106.3", features = ["ecma_plugin_transform"] } regex = "1" serde = "1.0.193" serde_json = "1.0.108" diff --git a/transforms/graphql_tag/src/parser/nodes/document/mod.rs b/transforms/graphql_tag/src/parser/nodes/document/mod.rs index e6c3a1c..a332887 100644 --- a/transforms/graphql_tag/src/parser/nodes/document/mod.rs +++ b/transforms/graphql_tag/src/parser/nodes/document/mod.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; // libs use apollo_parser::cst::Document; -use swc_common::{comments::Comments, BytePos, Span}; +use swc_common::{comments::Comments, BytePos, Span, SyntaxContext}; use swc_ecma_ast::*; // helpers @@ -44,7 +44,7 @@ pub fn create_document( let member_expr_for_definitions = MemberExpr { span, obj: _expression, - prop: MemberProp::Ident(Ident::new("definitions".into(), span)), + prop: MemberProp::Ident(IdentName::new("definitions".into(), span)), }; all_expressions.push(ExprOrSpread { @@ -58,10 +58,11 @@ pub fn create_document( callee: Callee::Expr(Box::new(Expr::Member(MemberExpr { span, obj: Box::new(definitions_expr.clone()), - prop: MemberProp::Ident(Ident::new("concat".into(), span)), + prop: MemberProp::Ident(IdentName::new("concat".into(), span)), }))), args: all_expressions, type_args: None, + ctxt: SyntaxContext::default(), }); let unique_fn_call_expr = Expr::Call(CallExpr { @@ -69,12 +70,14 @@ pub fn create_document( callee: Callee::Expr(Box::new(Expr::Ident(Ident::new( unique_fn_name.clone().into(), span, + SyntaxContext::default(), )))), args: vec![ExprOrSpread { spread: None, expr: Box::new(concat_definitions_expr.clone()), }], type_args: None, + ctxt: SyntaxContext::default(), }); let definitions = get_key_value_node( diff --git a/transforms/graphql_tag/src/utils/mod.rs b/transforms/graphql_tag/src/utils/mod.rs index 6b07f64..480b353 100644 --- a/transforms/graphql_tag/src/utils/mod.rs +++ b/transforms/graphql_tag/src/utils/mod.rs @@ -1,5 +1,7 @@ +use std::sync::Arc; + // libs -use swc_common::{BytePos, FileName::Anon, SourceFile}; +use swc_common::{BytePos, FileName::Anon, SourceFile, SyntaxContext}; use swc_core::atoms::Atom; use swc_ecma_ast::*; use swc_ecma_parser::parse_file_as_expr; @@ -21,7 +23,13 @@ const SOURCE: &str = "(definitions) => { }"; pub fn add_unique_fn_to_program(program: &mut Program, unique_fn_name: String) { - let source_file = SourceFile::new(Anon, false, Anon, SOURCE.into(), BytePos(1)); + let source_file = SourceFile::new( + Arc::new(Anon), + false, + Arc::new(Anon), + SOURCE.into(), + BytePos(1), + ); let expr_result = parse_file_as_expr( &source_file, @@ -41,10 +49,18 @@ pub fn add_unique_fn_to_program(program: &mut Program, unique_fn_name: String) { declare: false, decls: vec![VarDeclarator { span: program.span, - name: Pat::Ident(Ident::new(Atom::from(unique_fn_name), program.span).into()), + name: Pat::Ident( + Ident::new( + Atom::from(unique_fn_name), + program.span, + SyntaxContext::default(), + ) + .into(), + ), init: Some(expr_result), definite: true, }], + ctxt: SyntaxContext::default(), })))), ), Program::Script(program) => program.body.insert( @@ -55,10 +71,18 @@ pub fn add_unique_fn_to_program(program: &mut Program, unique_fn_name: String) { declare: false, decls: vec![VarDeclarator { span: program.span, - name: Pat::Ident(Ident::new(Atom::from(unique_fn_name), program.span).into()), + name: Pat::Ident( + Ident::new( + Atom::from(unique_fn_name), + program.span, + SyntaxContext::default(), + ) + .into(), + ), init: Some(expr_result), definite: true, }], + ctxt: SyntaxContext::default(), }))), ), } diff --git a/transforms/unique_identifier/Cargo.toml b/transforms/unique_identifier/Cargo.toml index 4e8e882..9b20b14 100644 --- a/transforms/unique_identifier/Cargo.toml +++ b/transforms/unique_identifier/Cargo.toml @@ -5,5 +5,5 @@ version = "0.1.0" edition = "2021" [dependencies] -swc_ecma_ast = "^0.112.6" -swc_ecma_visit = "^0.98.7" +swc_ecma_ast = "0.121.1" +swc_ecma_visit = "0.107.0" From a043be64e47a9d4e0f4847f1c7e030916ce4388f Mon Sep 17 00:00:00 2001 From: Rishabh Chawla Date: Mon, 4 Nov 2024 18:53:15 +0530 Subject: [PATCH 8/9] 1.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3645620..076ceda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graphql-tag-swc-plugin", - "version": "1.1.0", + "version": "1.1.1", "description": "SWC plugin to expand gql tags at build time", "author": "rishabh3112 ", "license": "MIT", From 28e7548ac2824e6c245cc331f1a9c705bdd1ebf3 Mon Sep 17 00:00:00 2001 From: George Muresan Date: Fri, 13 Dec 2024 15:30:22 -0500 Subject: [PATCH 9/9] update readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 2b5e0ea..9256d3f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,18 @@ SWC plugin alternative to `babel-plugin-graphql-tag` npm install -D graphql-tag-swc-plugin ``` +## Building and deploying to Scorebet repository + +1. Build locally +``` +npm run build +``` +2. Create a local file `/.token` containing a personal access token with publish package scope for the scorebet organization +3. Publish the package +``` +npm run publish +``` + ## Usage ### SWC