Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/upgrade swc #1444

Merged
merged 96 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
c08e0a9
🚧
stormslowly Jul 23, 2024
c2c086c
🚧 a basic working version
stormslowly Jul 24, 2024
ee880a9
chore: 🚨 lint happy
stormslowly Jul 24, 2024
f462f2d
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Jul 24, 2024
6cd9a0e
refactor: 🎨 adjust to new swc
stormslowly Jul 24, 2024
3ac7a58
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Jul 29, 2024
7234ad3
refactor: 🎨 remove deprecated methods
stormslowly Jul 29, 2024
1138d0d
chore: 🚨 lint happy
stormslowly Jul 29, 2024
3ffa4f7
feat: ✨ update swc emotion
stormslowly Jul 29, 2024
38f29a4
chore: 🔧 remove useless profile in sub crate
stormslowly Jul 29, 2024
7c90a2e
chore: 🔧 add back emotion plugin
stormslowly Jul 29, 2024
b019acc
refactor: 🎨 add back merge source map
stormslowly Jul 30, 2024
f6ad12f
test: ✅ hot update js file served by hyper static, it use text/javasc…
stormslowly Jul 30, 2024
4999c74
chore: 🔧 lock update
stormslowly Jul 30, 2024
e653291
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 1, 2024
7d35042
chore: 🔧 clean up swc core feature
stormslowly Aug 1, 2024
ac36b4f
refactor: 🎨 fix breaking change of ctxt of span
stormslowly Aug 2, 2024
a8b8c0f
fix: 🐛 ctxt apply mark
stormslowly Aug 2, 2024
5890fd1
refactor: 🎨 use DUMMY CTXT instead of SyntaxContext::empty()
stormslowly Aug 2, 2024
d042ab9
chore: ⬆️ temperal use mdxjs from kdy branch
stormslowly Aug 3, 2024
4804b61
feat: ✨ re-enable mdxjs
stormslowly Aug 3, 2024
70a4b27
feat: ✨ swc_core 0.100.1
stormslowly Aug 6, 2024
aa3b063
chore: 🙈 ignore fmt in fixtures
stormslowly Aug 6, 2024
f0a01c1
chore: 🚨 lint happy
stormslowly Aug 6, 2024
d88c5b3
chore: ⬆️ swc_common
stormslowly Aug 6, 2024
83efd80
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 7, 2024
6a1de11
chore: ✏️ typo
stormslowly Aug 7, 2024
6e11a11
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 7, 2024
e097ed7
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 8, 2024
bf8205e
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 9, 2024
040ef88
release: @umijs/[email protected]
stormslowly Aug 12, 2024
81a3b94
chore: [email protected]
stormslowly Aug 12, 2024
e3b5032
chore: ⬆️ swc_core 0.100.6
stormslowly Aug 13, 2024
47d44c5
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 13, 2024
ad4f211
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 14, 2024
9005c84
release: @umijs/[email protected]
stormslowly Aug 14, 2024
bd59d9e
chore: [email protected]
stormslowly Aug 14, 2024
116bebd
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 16, 2024
47d623d
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 19, 2024
1ea6050
chore: 🚨 lint happy
stormslowly Aug 19, 2024
a9b4b79
chore: 🔧 CI build bindings
stormslowly Aug 20, 2024
ec76b7b
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 20, 2024
182ff17
chore: 🔧 fix build docker
stormslowly Aug 20, 2024
08091e9
refactor: 🔥 remove aarch64-unknown-linux-gnu
stormslowly Aug 20, 2024
82f2b66
chore: 🔧 create tar
stormslowly Aug 20, 2024
3cbc14b
chore: 🙈
stormslowly Aug 20, 2024
813fb05
release: @umijs/[email protected]
stormslowly Aug 20, 2024
fa39267
chore: [email protected]
stormslowly Aug 20, 2024
1a92861
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 20, 2024
a0737d8
chore: 🔧 wrong donwload param
stormslowly Aug 20, 2024
8698e6a
chore: 🔧 upload download actions should be same version
stormslowly Aug 20, 2024
90aafa0
chore: 🔧 try codecov in ci
stormslowly Aug 20, 2024
85ac122
refactor: 🔥 remove unnecessary target
stormslowly Aug 21, 2024
5413b2b
refactor: 🎨 use swc comments
stormslowly Aug 22, 2024
2818dcd
fix: 🐛 after upgrade to swc_core it should remove paren before minifiy
stormslowly Aug 22, 2024
0f31d48
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 22, 2024
6997dd6
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 22, 2024
3477f81
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 22, 2024
2dec42a
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 26, 2024
770214a
refactor: 🎨 move dummy ctxt defintion to ast mod
stormslowly Aug 26, 2024
6b4b3c1
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Aug 29, 2024
c041491
chore: 🚨 lint happy
stormslowly Aug 29, 2024
6557211
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 2, 2024
509be77
release: @umijs/[email protected]
stormslowly Sep 2, 2024
0ecd456
chore: [email protected]
stormslowly Sep 2, 2024
cef7aa9
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 3, 2024
10b0ec3
release: @umijs/[email protected]
stormslowly Sep 3, 2024
073b801
chore: [email protected]
stormslowly Sep 3, 2024
4f0429e
refactor: 🎨 use VisitMut + Fold code style
stormslowly Sep 3, 2024
5a7a51d
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 5, 2024
1cc9e22
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 5, 2024
e750180
chore: ⬆️ update pnpm-lock
stormslowly Sep 5, 2024
e428feb
chore: 🙈
stormslowly Sep 5, 2024
8904f1f
revert: ⏪ delete musl bindin
stormslowly Sep 5, 2024
022702b
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 9, 2024
90fab94
release: @umijs/[email protected]
stormslowly Sep 9, 2024
450c3ae
chore: [email protected]
stormslowly Sep 9, 2024
c1497ef
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 10, 2024
1ca67f6
release: @umijs/[email protected]
stormslowly Sep 10, 2024
21ad3ee
chore: [email protected]
stormslowly Sep 10, 2024
a285995
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 10, 2024
ee28ca6
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 12, 2024
166741c
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 14, 2024
5e52a54
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 14, 2024
843c1e6
fix: 🐛 use chars() instead of bytes()
stormslowly Sep 18, 2024
aebe68f
fix: 🐛 unescape html entity by html escape crate
stormslowly Sep 18, 2024
a1bb3f0
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 19, 2024
1d7ac53
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 23, 2024
6445297
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 23, 2024
98ee3c9
release: @umijs/[email protected]
stormslowly Sep 24, 2024
f93d46f
chore: [email protected]
stormslowly Sep 24, 2024
3b76180
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Sep 26, 2024
f2f2cc5
release: @umijs/[email protected]
stormslowly Sep 27, 2024
5da9cda
chore: [email protected]
stormslowly Sep 27, 2024
9d219f5
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Oct 10, 2024
c8153ef
Merge remote-tracking branch 'origin/master' into feat/upgrade_swc
stormslowly Oct 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,172 changes: 1,891 additions & 1,281 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cached = "0.46.1"
mimalloc-rust = { version = "=0.2.1" }
serde = { version = "1.0.171", features = ["derive"] }
serde_json = "1.0.100"
swc_core = { version = "=0.83.22", default-features = false }
swc_core = { version = "0.96.0", default-features = false }
tikv-jemallocator = { version = "=0.5.4", features = ["disable_initial_exec_tls"] }

[profile.release]
Expand Down
3 changes: 0 additions & 3 deletions crates/binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ tikv-jemallocator = { workspace = true }

[build-dependencies]
napi-build = "2.0.1"

[profile.release]
lto = true
stormslowly marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions crates/binding/src/tsfn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub struct JsHooks {
}

pub struct TsFnHooks {
#[allow(dead_code)]
pub name: String,
pub build_start: Option<threadsafe_function::ThreadsafeFunction<ReadMessage<(), ()>>>,
pub generate_end:
Expand Down
10 changes: 5 additions & 5 deletions crates/mako/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ serde_json = { workspace = true }
url = { version = "2.5.0" }

swc_core = { workspace = true, features = [
"__common",
"__ecma",
"__ecma_plugin_transform",
"__ecma_transforms",
Expand Down Expand Up @@ -67,9 +68,9 @@ swc_core = { workspace = true, features = [
"swc_ecma_quote_macros",
] }

swc_emotion = "0.51.0"
swc_error_reporters = "0.16.1"
swc_node_comments = "0.19.1"
swc_emotion = "=0.72.16"
swc_error_reporters = "=0.18.1"
swc_node_comments = "=0.21.0"

anyhow = "1.0.71"
base64 = "0.21.2"
Expand All @@ -87,8 +88,7 @@ hyper-staticfile = "0.9.6"
hyper-tungstenite = "0.10.0"
indexmap = "2.0.0"
md5 = "0.7.0"
mdxjs = "0.1.14"
merge-source-map = "1.2.0"
mdxjs = "=0.2.5"
mime_guess = "2.0.4"
notify = { version = "6.1.1", default-features = false, features = ["macos_kqueue"] }
notify-debouncer-full = { version = "0.3.1", default-features = false }
Expand Down
5 changes: 4 additions & 1 deletion crates/mako/src/ast/css_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ impl CssAst {
legacy_ie: true,
..Default::default()
};
let lexer = parser::lexer::Lexer::new(StringInput::from(&*fm), config);

let comments = context.meta.css.comments.clone();

let lexer = parser::lexer::Lexer::new(StringInput::from(&*fm), Some(&comments), config);
let mut parser = parser::parser::Parser::new(lexer, config);
let parse_result = parser.parse_all();
let mut ast_errors = parser.take_errors();
Expand Down
6 changes: 3 additions & 3 deletions crates/mako/src/ast/js_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use swc_core::ecma::codegen::text_writer::JsWriter;
use swc_core::ecma::codegen::{Config as JsCodegenConfig, Emitter};
use swc_core::ecma::parser::error::SyntaxError;
use swc_core::ecma::parser::lexer::Lexer;
use swc_core::ecma::parser::{EsConfig, Parser, StringInput, Syntax, TsConfig};
use swc_core::ecma::parser::{EsSyntax, Parser, StringInput, Syntax, TsSyntax};
use swc_core::ecma::transforms::base::helpers::{inject_helpers, Helpers, HELPERS};
use swc_core::ecma::utils::contains_top_level_await;
use swc_core::ecma::visit;
Expand Down Expand Up @@ -51,7 +51,7 @@ impl JsAst {
let comments = context.meta.script.origin_comments.read().unwrap();
let extname = &file.extname;
let syntax = if extname == "ts" || extname == "tsx" {
Syntax::Typescript(TsConfig {
Syntax::Typescript(TsSyntax {
tsx: extname == "tsx",
decorators: true,
..Default::default()
Expand All @@ -60,7 +60,7 @@ impl JsAst {
let jsx = file.is_content_jsx()
|| extname == "jsx"
|| (extname == "js" && !file.is_under_node_modules);
Syntax::Es(EsConfig {
Syntax::Es(EsSyntax {
jsx,
decorators: true,
decorators_before_export: true,
Expand Down
72 changes: 40 additions & 32 deletions crates/mako/src/ast/sourcemap.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use std::path::PathBuf;

use merge_source_map::sourcemap::SourceMap as MergeSourceMap;
use merge_source_map::{merge, MergeOptions};
use pathdiff::diff_paths;
// use merge_source_map::sourcemap::SourceMap as MergeSourceMap;
// use merge_source_map::{merge, MergeOptions};
use swc_core::base::sourcemap;
use swc_core::common::source_map::SourceMapGenConfig;
use swc_core::common::sync::Lrc;
Expand Down Expand Up @@ -69,34 +66,45 @@ impl From<sourcemap::SourceMap> for RawSourceMap {
impl From<RawSourceMap> for sourcemap::SourceMap {
fn from(rsm: RawSourceMap) -> Self {
Self::new(
rsm.file,
rsm.file.map(|f| f.into_boxed_str().into()),
rsm.tokens,
rsm.names,
rsm.sources,
Some(rsm.sources_content),
rsm.names
.into_iter()
.map(|n| n.into_boxed_str().into())
.collect(),
rsm.sources
.into_iter()
.map(|n| n.into_boxed_str().into())
.collect(),
Some(
rsm.sources_content
.into_iter()
.map(|op_string| op_string.map(|s| s.into_boxed_str().into()))
.collect(),
),
)
}
}

pub fn merge_source_map(source_map_chain: Vec<Vec<u8>>, root: PathBuf) -> Vec<u8> {
let source_map_chain = source_map_chain
.iter()
.map(|s| MergeSourceMap::from_slice(s).unwrap())
.collect::<Vec<_>>();

let merged = merge(
source_map_chain,
MergeOptions {
source_replacer: Some(Box::new(move |src| {
diff_paths(src, &root)
.unwrap_or(src.into())
.to_string_lossy()
.to_string()
})),
},
);

let mut buf = vec![];
merged.to_writer(&mut buf).unwrap();
buf
}
//
// pub fn merge_source_map(source_map_chain: Vec<Vec<u8>>, root: PathBuf) -> Vec<u8> {
// let source_map_chain = source_map_chain
// .iter()
// .map(|s| MergeSourceMap::from_slice(s).unwrap())
// .collect::<Vec<_>>();
//
// let merged = merge(
// source_map_chain,
// MergeOptions {
// source_replacer: Some(Box::new(move |src| {
// diff_paths(src, &root)
// .unwrap_or(src.into())
// .to_string_lossy()
// .to_string()
// })),
// },
// );
//
// let mut buf = vec![];
// merged.to_writer(&mut buf).unwrap();
// buf
// }
2 changes: 1 addition & 1 deletion crates/mako/src/build/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function moduleToDom(css) {
Err(reason) => {
return Err(anyhow!(LoadError::CompileMdError {
path: file.path.to_string_lossy().to_string(),
reason,
reason: reason.to_string(),
}));
}
};
Expand Down
3 changes: 3 additions & 0 deletions crates/mako/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use regex::Regex;
use swc_core::common::sync::Lrc;
use swc_core::common::{Globals, SourceMap, DUMMY_SP};
use swc_core::ecma::ast::Ident;
use swc_node_comments::SwcComments;
use tracing::debug;

use crate::ast::comments::Comments;
Expand Down Expand Up @@ -183,13 +184,15 @@ fn build_ident(ident: &str) -> Ident {
pub struct CssMeta {
pub cm: Lrc<SourceMap>,
pub globals: Globals,
pub comments: SwcComments,
}

impl CssMeta {
fn new() -> Self {
Self {
cm: Default::default(),
globals: Globals::default(),
comments: Default::default(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/mako/src/features/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ impl VisitMut for MockFilenameAndDirname {
if let Expr::Ident(ident) = expr
&& ident.span.ctxt.outer() == self.unresolved_mark
{
let is_filename = ident.sym.to_string() == "__filename";
let is_dirname = ident.sym.to_string() == "__dirname";
let is_filename = ident.sym == "__filename";
let is_dirname = ident.sym == "__dirname";
if is_filename || is_dirname {
let path = diff_paths(&self.current_path, &self.context.root).unwrap_or("".into());
let value = if is_filename {
Expand Down
6 changes: 4 additions & 2 deletions crates/mako/src/generate/chunk_pot/ast_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use swc_core::ecma::ast::{
use swc_core::ecma::utils::{quote_ident, quote_str, ExprFactory};

use crate::ast::js_ast::JsAst;
use crate::ast::sourcemap::{build_source_map_to_buf, merge_source_map};
use crate::ast::sourcemap::build_source_map_to_buf;
use crate::compiler::Context;
use crate::config::Mode;
use crate::generate::chunk::{Chunk, ChunkType};
Expand Down Expand Up @@ -97,7 +97,9 @@ pub(crate) fn render_css_chunk(

source_map_chain.push(build_source_map_to_buf(&source_map, cm));

Some(merge_source_map(source_map_chain, context.root.clone()))
// TODO
// Some(merge_source_map(source_map_chain, context.root.clone()))
source_map_chain.pop()
}
};

Expand Down
4 changes: 1 addition & 3 deletions crates/mako/src/generate/chunk_pot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use swc_core::css::ast::Stylesheet;

use crate::compiler::Context;
use crate::config::Mode;
use crate::generate::chunk::{Chunk, ChunkType};
use crate::generate::chunk::Chunk;
pub use crate::generate::chunk_pot::util::CHUNK_FILE_NAME_HASH_LENGTH;
use crate::generate::chunk_pot::util::{hash_hashmap, hash_vec};
use crate::generate::generate_chunks::ChunkFile;
Expand All @@ -22,7 +22,6 @@ use crate::ternary;

pub struct ChunkPot<'a> {
pub chunk_id: String,
pub chunk_type: ChunkType,
pub js_name: String,
pub module_map: HashMap<String, (&'a Module, u64)>,
pub js_hash: u64,
Expand All @@ -39,7 +38,6 @@ impl<'cp> ChunkPot<'cp> {

ChunkPot {
js_name: chunk.filename(),
chunk_type: chunk.chunk_type.clone(),
chunk_id: chunk.id.id.clone(),
module_map: js_modules.module_map,
js_hash: js_modules.raw_hash,
Expand Down
6 changes: 1 addition & 5 deletions crates/mako/src/generate/chunk_pot/str_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,7 @@ fn pot_to_chunk_module_object_string(
chunk_prefix_offset: u32,
) -> Result<(String, RawSourceMap)> {
let sorted_kv = {
let mut sorted_kv = pot
.module_map
.iter()
.map(|(k, v)| (k, v))
.collect::<Vec<_>>();
let mut sorted_kv = pot.module_map.iter().collect::<Vec<_>>();

sorted_kv.sort_by_key(|(k, _)| *k);

Expand Down
10 changes: 3 additions & 7 deletions crates/mako/src/generate/chunk_pot/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ where
K: Hash + Eq + Ord,
V: Hash,
{
let mut sorted_kv = map.iter().map(|(k, v)| (k, v)).collect::<Vec<_>>();
let mut sorted_kv = map.iter().collect::<Vec<_>>();
sorted_kv.sort_by_key(|(k, _)| *k);

let mut hasher: XxHash64 = Default::default();
Expand Down Expand Up @@ -156,11 +156,7 @@ pub(super) fn to_array_lit(elems: Vec<ExprOrSpread>) -> ArrayLit {
pub(crate) fn pot_to_module_object(pot: &ChunkPot, context: &Arc<Context>) -> Result<ObjectLit> {
crate::mako_profile_function!();

let mut sorted_kv = pot
.module_map
.iter()
.map(|(k, v)| (k, v))
.collect::<Vec<_>>();
let mut sorted_kv = pot.module_map.iter().collect::<Vec<_>>();
sorted_kv.sort_by_key(|(k, _)| *k);

let mut props = Vec::new();
Expand Down Expand Up @@ -240,7 +236,7 @@ pub(crate) fn pot_to_chunk_module(
}
.into(),
)
.make_assign_to(AssignOp::Assign, chunk_global_expr.clone().as_pat_or_expr())
.make_assign_to(AssignOp::Assign, chunk_global_expr.clone().into())
.wrap_with_paren()
.make_member::<Ident>(quote_ident!("push"));
let chunk_register_stmt = chunk_global_obj
Expand Down
8 changes: 0 additions & 8 deletions crates/mako/src/generate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ use crate::stats::{write_stats, StatsJsonMap};
use crate::utils::base64_encode;
use crate::visitors::async_module::mark_async;

#[derive(Clone)]
pub struct EmitFile {
pub filename: String,
pub content: String,
pub chunk_id: String,
pub hashname: String,
}

#[derive(Serialize)]
struct ChunksUrlMap {
js: HashMap<String, String>,
Expand Down
1 change: 1 addition & 0 deletions crates/mako/src/generate/swc_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use indexmap::IndexSet;

pub struct SwcHelpers {
#[allow(dead_code)]
pub helpers: IndexSet<String>,
}

Expand Down
3 changes: 1 addition & 2 deletions crates/mako/src/generate/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ pub fn transform_js_generate(transform_js_param: TransformJsParam) -> Result<()>
to_replace: dep_map,
context,
unresolved_mark,
top_level_mark,
};
ast.ast.visit_mut_with(&mut dep_replacer);

Expand Down Expand Up @@ -328,7 +327,7 @@ mod tests {
}

fn transform_css_code(content: &str, path: Option<&str>) -> String {
let path = if let Some(p) = path { p } else { "test.css" };
let path = path.unwrap_or("test.css");
let context: Arc<Context> = Arc::new(Default::default());
let mut ast = CssAst::build(path, content, context.clone(), false).unwrap();
transform_css_generate(&mut ast.ast, &context);
Expand Down
1 change: 0 additions & 1 deletion crates/mako/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![feature(box_patterns)]
#![feature(hasher_prefixfree_extras)]
#![feature(let_chains)]
#![feature(result_option_inspect)]

pub mod ast;
mod build;
Expand Down
1 change: 0 additions & 1 deletion crates/mako/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![feature(box_patterns)]
#![feature(let_chains)]
#![feature(result_option_inspect)]

use std::sync::Arc;

Expand Down
1 change: 0 additions & 1 deletion crates/mako/src/plugins/bundless_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ fn transform_js_generate(
to_replace: dep_map,
context,
unresolved_mark: ast.unresolved_mark,
top_level_mark: ast.top_level_mark,
};
ast.ast.visit_mut_with(&mut dep_replacer);

Expand Down
3 changes: 1 addition & 2 deletions crates/mako/src/plugins/context_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ fn try_replace_context_arg(
// handle `(...)`
Expr::Paren(ParenExpr {
expr: paren_expr, ..
}) => try_replace_context_arg(paren_expr, has_visit_top_bin)
.map(|(prefix, suffix)| (prefix, suffix)),
}) => try_replace_context_arg(paren_expr, has_visit_top_bin),

// handle `'./foo/' + bar`
Expr::Bin(BinExpr {
Expand Down
Loading
Loading