Skip to content

Commit

Permalink
refactor: parser
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabh3112 authored Dec 11, 2023
2 parents c508c5f + ef9e306 commit 8df4013
Show file tree
Hide file tree
Showing 18 changed files with 981 additions and 837 deletions.
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use graphql_tag::structs::{GraphQLTagConfig, TransformVisitor};

// libs
use serde::Deserialize;
use swc_core::plugin::{plugin_transform, proxies::TransformPluginProgramMetadata};
use swc_ecma_ast::Program;
use swc_ecma_visit::{as_folder, FoldWith};

use serde::Deserialize;
// structs
use graphql_tag::structs::{GraphQLTagConfig, TransformVisitor};

#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
7 changes: 5 additions & 2 deletions tests/fixtures.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// built-ins
use std::path::PathBuf;

use graphql_tag::structs::{GraphQLTagConfig, TransformVisitor};
// libs
use swc_core::ecma::transforms::testing::{test_fixture, FixtureTestConfig};
use swc_ecma_parser::{EsConfig, Syntax};
use swc_ecma_visit::as_folder;

use testing::fixture;

// structs
use graphql_tag::structs::{GraphQLTagConfig, TransformVisitor};

fn syntax() -> Syntax {
Syntax::Es(EsConfig {
jsx: true,
Expand Down
13 changes: 8 additions & 5 deletions transform/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
mod parser;
pub mod structs;

use structs::{GraphQLTagConfig, TransformVisitor};

// built-ins
use std::collections::HashMap;

// libs
use regex::Regex;
use swc_ecma_ast::*;
use swc_ecma_visit::{VisitMut, VisitMutWith};
// modules
pub mod parser;
pub mod structs;

// structs
use structs::{GraphQLTagConfig, TransformVisitor};

impl TransformVisitor {
pub fn new(config: GraphQLTagConfig) -> Self {
Expand Down
Loading

0 comments on commit 8df4013

Please sign in to comment.