Skip to content

Commit

Permalink
Merge eaddf6c into 80c26ef
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Nov 10, 2023
2 parents 80c26ef + eaddf6c commit 9a51c4e
Show file tree
Hide file tree
Showing 107 changed files with 749 additions and 1,041 deletions.
455 changes: 156 additions & 299 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 16 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,29 @@ lto = "off"
[workspace.dependencies]
async-recursion = "1.0.2"
# Keep consistent with preset_env_base through swc_core
browserslist-rs = { version = "0.12.2" }
browserslist-rs = { version = "0.13.0" }

mdxjs = "0.1.19"
modularize_imports = { version = "0.55.0" }
styled_components = { version = "0.82.0" }
styled_jsx = { version = "0.59.0" }
swc_core = { version = "0.86.40", features = [
"ecma_loader_lru",
"ecma_loader_parking_lot",
] }
swc_core = { version = "0.86.50" }
swc_ecma_preset_env = { version = "0.203.36" }
swc_emotion = { version = "0.58.0" }
swc_relay = { version = "0.30.0" }
testing = { version = "0.35.7" }
testing = { version = "0.35.10" }
swc = "0.269.44"
swc_common = "0.33.8"
swc_ecma_ast = "0.110.9"
swc_ecma_parser = "0.141.18"
swc_ecma_transforms_proposal = "0.168.36"
swc_ecma_visit = "0.96.9"
swc_atoms = "0.6.4"
swc_ecma_transforms_base = "0.134.27"
swc_ecma_transforms_module = "0.177.35"
swc_ecma_codegen = "0.146.21"
swc_ecma_transforms_react = "0.180.36"
swc_ecma_transforms_typescript = "0.185.34"

auto-hash-map = { path = "crates/turbo-tasks-auto-hash-map" }
node-file-trace = { path = "crates/node-file-trace", default-features = false }
Expand Down
4 changes: 3 additions & 1 deletion crates/turbo-tasks/src/completion.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::{self as turbo_tasks, RawVc, Vc};
use crate::{
RawVc, Vc, {self as turbo_tasks},
};
/// Just an empty type, but it's never equal to itself.
/// [Vc<Completion>] can be used as return value instead of `()`
/// to have a concrete reference that can be awaited.
Expand Down
3 changes: 1 addition & 2 deletions crates/turbo-tasks/src/generics/index_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use indexmap::IndexMap;
use turbo_tasks_macros::generic_type as __turbo_tasks_internal_generic_type;

use crate::{
self as turbo_tasks,
debug::{ValueDebug, ValueDebugFormat, ValueDebugString},
ValueDefault, Vc,
ValueDefault, Vc, {self as turbo_tasks},
};

__turbo_tasks_internal_generic_type!(<K, V>, IndexMap<Vc<K>, Vc<V>>);
Expand Down
3 changes: 1 addition & 2 deletions crates/turbo-tasks/src/generics/index_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use indexmap::IndexSet;
use turbo_tasks_macros::generic_type as __turbo_tasks_internal_generic_type;

use crate::{
self as turbo_tasks,
debug::{ValueDebug, ValueDebugFormat, ValueDebugString},
ValueDefault, Vc,
ValueDefault, Vc, {self as turbo_tasks},
};

__turbo_tasks_internal_generic_type!(<T>, IndexSet<Vc<T>>);
Expand Down
3 changes: 1 addition & 2 deletions crates/turbo-tasks/src/generics/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use anyhow::Result;
use turbo_tasks_macros::generic_type as __turbo_tasks_internal_generic_type;

use crate::{
self as turbo_tasks,
debug::{ValueDebug, ValueDebugFormat, ValueDebugString},
ValueDefault, Vc,
ValueDefault, Vc, {self as turbo_tasks},
};

__turbo_tasks_internal_generic_type!(<T>, Option<Vc<T>>);
Expand Down
3 changes: 1 addition & 2 deletions crates/turbo-tasks/src/generics/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use anyhow::Result;
use turbo_tasks_macros::generic_type as __turbo_tasks_internal_generic_type;

use crate::{
self as turbo_tasks,
debug::{ValueDebug, ValueDebugFormat, ValueDebugString},
ValueDefault, Vc,
ValueDefault, Vc, {self as turbo_tasks},
};

__turbo_tasks_internal_generic_type!(<T>, Vec<Vc<T>>);
Expand Down
4 changes: 3 additions & 1 deletion crates/turbo-tasks/src/keyed_cell.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use anyhow::Result;

use crate::{
self as turbo_tasks, macro_helpers::find_cell_by_type, manager::current_task,
macro_helpers::find_cell_by_type,
manager::current_task,
ConcreteTaskInput, CurrentCellRef, RawVc, TaskId, TaskInput, ValueTypeId, Vc, VcValueType,
{self as turbo_tasks},
};

#[turbo_tasks::value]
Expand Down
59 changes: 4 additions & 55 deletions crates/turbopack-binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,9 @@ bench = false
[features]
__swc = []
__swc_core = ["__swc"]
__swc_core_next_core = [
"__swc_core",
"swc_core/common_concurrent",
"swc_core/ecma_ast",
"swc_core/ecma_visit",
"swc_core/ecma_loader_node",
"swc_core/ecma_loader_lru",
"swc_core/ecma_utils",
"swc_core/ecma_minifier",
"swc_core/ecma_transforms",
"swc_core/ecma_transforms_react",
"swc_core/ecma_transforms_typescript",
"swc_core/ecma_transforms_optimization",
"swc_core/ecma_parser",
"swc_core/ecma_parser_typescript",
"swc_core/cached",
"swc_core/base",
]
__swc_core_next_core = ["__swc_core"]

__swc_core_binding_napi = [
"__swc_core",
"swc_core/base_concurrent",
"swc_core/base_node",
"swc_core/common_concurrent",
"swc_core/ecma_ast",
"swc_core/ecma_loader_node",
"swc_core/ecma_loader_lru",
"swc_core/bundler",
"swc_core/bundler_concurrent",
"swc_core/ecma_codegen",
"swc_core/ecma_minifier",
"swc_core/ecma_parser",
"swc_core/ecma_parser_typescript",
"swc_core/ecma_transforms",
"swc_core/ecma_transforms_optimization",
"swc_core/ecma_transforms_react",
"swc_core/ecma_transforms_typescript",
"swc_core/ecma_utils",
"swc_core/ecma_visit",
]
__swc_core_binding_napi = ["__swc_core"]
__swc_core_binding_napi_plugin = [
"swc_core/plugin_transform_host_native",
"turbopack-ecmascript-plugins/swc_ecma_transform_plugin",
Expand All @@ -63,24 +26,10 @@ __swc_core_binding_napi_plugin_shared_runtime = [
]
__swc_core_binding_napi_allocator = ["swc_core/allocator_node"]

__swc_core_binding_wasm = [
"__swc_core",
"swc_core/common_concurrent",
"swc_core/binding_macro_wasm",
"swc_core/ecma_codegen",
"swc_core/ecma_minifier",
"swc_core/ecma_transforms",
"swc_core/ecma_transforms_typescript",
"swc_core/ecma_transforms_optimization",
"swc_core/ecma_transforms_react",
"swc_core/ecma_parser",
"swc_core/ecma_parser_typescript",
"swc_core/ecma_utils",
"swc_core/ecma_visit",
]
__swc_core_binding_wasm = ["__swc_core"]
__swc_core_binding_wasm_plugin = ["swc_core/plugin_transform_host_js"]

__swc_core_testing_transform = ["swc_core/testing_transform"]
__swc_core_testing_transform = []

__turbo = []
__turbo_tasks_malloc = ["__turbo", "turbo-tasks-malloc"]
Expand Down
13 changes: 9 additions & 4 deletions crates/turbopack-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ serde = { workspace = true }
serde_json = { workspace = true }
serde_qs = { workspace = true }
sourcemap = { workspace = true }
swc_core = { workspace = true, features = [
"__parser",
"ecma_minifier",
"ecma_minifier_concurrent",
swc.workspace = true
swc_common.workspace = true
swc_ecma_ast.workspace = true
swc_ecma_codegen.workspace = true
swc_ecma_minifier = { version = "0.189.39", features = ["concurrent"] }
swc_ecma_parser.workspace = true
swc_ecma_transforms_base = { workspace = true, features = [
"concurrent-renamer",
] }
swc_ecma_visit.workspace = true

turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
Expand Down
46 changes: 21 additions & 25 deletions crates/turbopack-build/src/ecmascript/minify.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
use std::{io::Write, sync::Arc};

use anyhow::{bail, Context, Result};
use swc_core::{
base::{try_with_handler, Compiler},
common::{
comments::{Comments, SingleThreadedComments},
BytePos, FileName, FilePathMapping, LineCol, Mark, SourceMap as SwcSourceMap, GLOBALS,
},
ecma::{
self,
ast::{EsVersion, Program},
codegen::{
text_writer::{self, JsWriter, WriteJs},
Emitter, Node,
},
minifier::option::{ExtraOptions, MinifyOptions},
parser::{lexer::Lexer, Parser, StringInput, Syntax},
visit::FoldWith,
use swc::{try_with_handler, Compiler};
use swc_common::{
comments::{Comments, SingleThreadedComments},
BytePos, FileName, FilePathMapping, LineCol, Mark, SourceMap as SwcSourceMap, GLOBALS,
};
use swc_ecma_ast::{EsVersion, Program};
use swc_ecma_codegen::{
text_writer::{
JsWriter, WriteJs, {self},
},
Emitter, Node,
};
use swc_ecma_minifier::option::{ExtraOptions, MinifyOptions};
use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax};
use swc_ecma_visit::FoldWith;
use turbo_tasks::Vc;
use turbo_tasks_fs::FileSystemPath;
use turbopack_core::{
Expand Down Expand Up @@ -77,14 +74,13 @@ async fn perform_minify(path: Vc<FileSystemPath>, code_vc: Vc<Code>) -> Result<V
let top_level_mark = Mark::new();

Ok(compiler.run_transform(handler, false, || {
let mut program =
program.fold_with(&mut swc_core::ecma::transforms::base::resolver(
unresolved_mark,
top_level_mark,
false,
));
let mut program = program.fold_with(&mut swc_ecma_transforms_base::resolver(
unresolved_mark,
top_level_mark,
false,
));

program = swc_core::ecma::minifier::optimize(
program = swc_ecma_minifier::optimize(
program,
cm.clone(),
Some(&comments),
Expand All @@ -100,7 +96,7 @@ async fn perform_minify(path: Vc<FileSystemPath>, code_vc: Vc<Code>) -> Result<V
},
);

program.fold_with(&mut ecma::transforms::base::fixer::fixer(Some(
program.fold_with(&mut swc_ecma_transforms_base::fixer::fixer(Some(
&comments as &dyn Comments,
)))
}))
Expand Down Expand Up @@ -138,7 +134,7 @@ fn print_program(
)))) as Box<dyn WriteJs>;

let mut emitter = Emitter {
cfg: swc_core::ecma::codegen::Config::default().with_minify(true),
cfg: swc_ecma_codegen::Config::default().with_minify(true),
comments: None,
cm: cm.clone(),
wr,
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ serde = { workspace = true, features = ["rc"] }
serde_json = { workspace = true, features = ["preserve_order"] }
serde_qs = { workspace = true }
sourcemap = { workspace = true }
swc_core = { workspace = true, features = ["ecma_preset_env", "common"] }
swc_ecma_preset_env = { workspace = true }
tracing = { workspace = true }
turbo-tasks = { workspace = true }
turbo-tasks-env = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-core/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

use anyhow::{anyhow, bail, Context, Result};
use serde::{Deserialize, Serialize};
use swc_core::ecma::preset_env::{Version, Versions};
use swc_ecma_preset_env::{Version, Versions};
use turbo_tasks::{Value, Vc};
use turbo_tasks_env::ProcessEnv;

Expand Down
24 changes: 9 additions & 15 deletions crates/turbopack-css/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,21 @@ indoc = { workspace = true }
once_cell = { workspace = true }
regex = { workspace = true }
serde = { workspace = true }
swc_atoms.workspace = true
swc_common.workspace = true
swc_css_ast = { version = "0.140.9", features = ["serde-impl"] }
swc_css_codegen = "0.151.14"
swc_css_compat = "0.27.14"
swc_css_modules = "0.29.15"
swc_css_parser = "0.150.14"
swc_css_prefixer = "0.153.16"
swc_css_visit = { version = "0.139.9", features = ["path"] }
turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-hash = { workspace = true }
turbopack-core = { workspace = true }
turbopack-ecmascript = { workspace = true }
turbopack-swc-utils = { workspace = true }

swc_core = { workspace = true, features = [
"ecma_ast",
"css_ast",
"css_ast_serde",
"css_codegen",
"css_parser",
"css_utils",
"css_visit",
"css_visit_path",
"css_compat",
"css_modules",
"common",
"common_concurrent",
] }

[build-dependencies]
turbo-tasks-build = { workspace = true }
12 changes: 4 additions & 8 deletions crates/turbopack-css/src/asset.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use anyhow::Result;
use swc_core::{
common::{Globals, GLOBALS},
css::{
ast::{AtRule, AtRulePrelude, Rule},
codegen::{writer::basic::BasicCssWriter, CodeGenerator, Emit},
visit::{VisitMutWith, VisitMutWithPath},
},
};
use swc_common::{Globals, GLOBALS};
use swc_css_ast::{AtRule, AtRulePrelude, Rule};
use swc_css_codegen::{writer::basic::BasicCssWriter, CodeGenerator, Emit};
use swc_css_visit::{VisitMutWith, VisitMutWithPath};
use turbo_tasks::{TryJoinIterExt, ValueToString, Vc};
use turbo_tasks_fs::FileSystemPath;
use turbopack_core::{
Expand Down
Loading

0 comments on commit 9a51c4e

Please sign in to comment.