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

turbo-binding -> turbopack-binding #49816

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ swc_core = { version = "0.75.41" }
testing = { version = "0.33.4" }

# Turbo crates
turbo-binding = { package = "turbopack-binding", git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.3" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.3" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230511.3" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
Expand Down
6 changes: 3 additions & 3 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version = "0.0.0"
publish = false

[features]
plugin = ["turbo-binding/__swc_core_binding_napi_plugin"]
plugin = ["turbopack-binding/__swc_core_binding_napi_plugin"]

[dependencies]
chrono = "0.4"
Expand All @@ -22,7 +22,7 @@ serde_json = "1"
sha1 = "0.10.1"
tracing = { version = "0.1.37" }

turbo-binding = { workspace = true, features = [
turbopack-binding = { workspace = true, features = [
"__swc_core",
"__swc_core_next_core",
"__swc_transform_styled_jsx",
Expand All @@ -33,7 +33,7 @@ turbo-binding = { workspace = true, features = [
] }

[dev-dependencies]
turbo-binding = { workspace = true, features = [
turbopack-binding = { workspace = true, features = [
"__swc_core_testing_transform",
"__swc_testing",
] }
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/amp_attributes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use turbo_binding::swc::core::ecma::{
use turbopack_binding::swc::core::ecma::{
ast::{Ident, JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXElementName, JSXOpeningElement},
atoms::JsWord,
visit::Fold,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/auto_cjs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use turbo_binding::swc::core::ecma::{
use turbopack_binding::swc::core::ecma::{
ast::*,
visit::{Visit, VisitWith},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::errors::HANDLER,
ecma::{
ast::ExportAll,
Expand Down
27 changes: 14 additions & 13 deletions packages/next-swc/crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use either::Either;
use fxhash::FxHashSet;
use next_transform_font::next_font_loaders;
use serde::Deserialize;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{chain, comments::Comments, pass::Optional, FileName, SourceFile, SourceMap},
ecma::{
ast::EsVersion, parser::parse_file_as_module, transforms::base::pass::noop, visit::Fold,
Expand All @@ -61,7 +61,7 @@ mod top_level_binding_collector;
#[serde(rename_all = "camelCase")]
pub struct TransformOptions {
#[serde(flatten)]
pub swc: turbo_binding::swc::core::base::config::Options,
pub swc: turbopack_binding::swc::core::base::config::Options,

#[serde(default)]
pub disable_next_ssg: bool,
Expand Down Expand Up @@ -91,7 +91,8 @@ pub struct TransformOptions {
pub styled_jsx: bool,

#[serde(default)]
pub styled_components: Option<turbo_binding::swc::custom_transform::styled_components::Config>,
pub styled_components:
Option<turbopack_binding::swc::custom_transform::styled_components::Config>,

#[serde(default)]
pub remove_console: Option<remove_console::Config>,
Expand All @@ -101,7 +102,7 @@ pub struct TransformOptions {

#[serde(default)]
#[cfg(not(target_arch = "wasm32"))]
pub relay: Option<turbo_binding::swc::custom_transform::relay::Config>,
pub relay: Option<turbopack_binding::swc::custom_transform::relay::Config>,

#[allow(unused)]
#[serde(default)]
Expand All @@ -113,11 +114,11 @@ pub struct TransformOptions {
pub shake_exports: Option<shake_exports::Config>,

#[serde(default)]
pub emotion: Option<turbo_binding::swc::custom_transform::emotion::EmotionOptions>,
pub emotion: Option<turbopack_binding::swc::custom_transform::emotion::EmotionOptions>,

#[serde(default)]
pub modularize_imports:
Option<turbo_binding::swc::custom_transform::modularize_imports::Config>,
Option<turbopack_binding::swc::custom_transform::modularize_imports::Config>,

#[serde(default)]
pub font_loaders: Option<next_transform_font::Config>,
Expand All @@ -142,7 +143,7 @@ where
#[cfg(not(target_arch = "wasm32"))]
let relay_plugin = {
if let Some(config) = &opts.relay {
Either::Left(turbo_binding::swc::custom_transform::relay::relay(
Either::Left(turbopack_binding::swc::custom_transform::relay::relay(
config,
file.name.clone(),
current_dir().unwrap(),
Expand All @@ -156,13 +157,13 @@ where

let mut modularize_imports_config = match &opts.modularize_imports {
Some(config) => config.clone(),
None => turbo_binding::swc::custom_transform::modularize_imports::Config {
None => turbopack_binding::swc::custom_transform::modularize_imports::Config {
packages: std::collections::HashMap::new(),
},
};
modularize_imports_config.packages.insert(
"next/server".to_string(),
turbo_binding::swc::custom_transform::modularize_imports::PackageConfig {
turbopack_binding::swc::custom_transform::modularize_imports::PackageConfig {
transform: "next/dist/server/web/exports/{{ kebabCase member }}".to_string(),
prevent_full_import: false,
skip_default_conversion: false,
Expand All @@ -183,7 +184,7 @@ where
},
if opts.styled_jsx {
Either::Left(
turbo_binding::swc::custom_transform::styled_jsx::visitor::styled_jsx(
turbopack_binding::swc::custom_transform::styled_jsx::visitor::styled_jsx(
cm.clone(),
file.name.clone(),
),
Expand All @@ -193,7 +194,7 @@ where
},
match &opts.styled_components {
Some(config) => Either::Left(
turbo_binding::swc::custom_transform::styled_components::styled_components(
turbopack_binding::swc::custom_transform::styled_components::styled_components(
file.name.clone(),
file.src_hash,
config.clone(),
Expand Down Expand Up @@ -247,7 +248,7 @@ where
if let FileName::Real(path) = &file.name {
path.to_str().map(|_| {
Either::Left(
turbo_binding::swc::custom_transform::emotion::EmotionTransformer::new(
turbopack_binding::swc::custom_transform::emotion::EmotionTransformer::new(
config.clone(),
path,
file.src_hash as u32,
Expand All @@ -261,7 +262,7 @@ where
}
})
.unwrap_or_else(|| Either::Right(noop())),
turbo_binding::swc::custom_transform::modularize_imports::modularize_imports(
turbopack_binding::swc::custom_transform::modularize_imports::modularize_imports(
modularize_imports_config
),
match &opts.font_loaders {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/next_dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};

use pathdiff::diff_paths;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{errors::HANDLER, FileName, DUMMY_SP},
ecma::{
ast::{
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/next_ssg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{cell::RefCell, mem::take, rc::Rc};

use easy_error::{bail, Error};
use fxhash::FxHashSet;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{
errors::HANDLER,
pass::{Repeat, Repeated},
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/page_config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chrono::Utc;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{errors::HANDLER, Span, DUMMY_SP},
ecma::{
ast::*,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use regex::Regex;
use serde::Deserialize;
use turbo_binding::swc::core::ecma::{
use turbopack_binding::swc::core::ecma::{
ast::*,
visit::{noop_fold_type, Fold, FoldWith},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::HashMap, path::PathBuf};

use regex::Regex;
use serde::Deserialize;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{
comments::{Comment, CommentKind, Comments},
errors::HANDLER,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/remove_console.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::Deserialize;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{collections::AHashSet, DUMMY_SP},
ecma::{
ast::*,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::convert::{TryFrom, TryInto};
use hex::encode as hex_encode;
use serde::Deserialize;
use sha1::{Digest, Sha1};
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{
comments::{Comment, CommentKind, Comments},
errors::HANDLER,
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/shake_exports.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::Deserialize;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::Mark,
ecma::{
ast::*,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::hash::Hash;

use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
common::{collections::AHashSet, SyntaxContext},
ecma::{
ast::{
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/tests/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use next_swc::{
server_actions::{self, server_actions},
};
use next_transform_font::{next_font_loaders, Config as FontLoaderConfig};
use turbo_binding::swc::{
use turbopack_binding::swc::{
core::{
common::{chain, FileName, Mark},
ecma::{
Expand Down
6 changes: 3 additions & 3 deletions packages/next-swc/crates/core/tests/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use next_swc::{
shake_exports::{shake_exports, Config as ShakeExportsConfig},
};
use next_transform_font::{next_font_loaders, Config as FontLoaderConfig};
use turbo_binding::swc::{
use turbopack_binding::swc::{
core::{
common::{chain, comments::SingleThreadedComments, FileName, Mark},
ecma::{
Expand Down Expand Up @@ -110,7 +110,7 @@ fn next_ssg_fixture(input: PathBuf) {
let jsx = jsx::<SingleThreadedComments>(
tr.cm.clone(),
None,
turbo_binding::swc::core::ecma::transforms::react::Options {
turbopack_binding::swc::core::ecma::transforms::react::Options {
next: false.into(),
runtime: None,
import_source: Some("".into()),
Expand Down Expand Up @@ -151,7 +151,7 @@ fn page_config_fixture(input: PathBuf) {
#[fixture("tests/fixture/relay/**/input.ts*")]
fn relay_no_artifact_dir_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
let config = turbo_binding::swc::custom_transform::relay::Config {
let config = turbopack_binding::swc::custom_transform::relay::Config {
language: RelayLanguageConfig::TypeScript,
artifact_directory: Some(PathBuf::from("__generated__")),
..Default::default()
Expand Down
18 changes: 9 additions & 9 deletions packages/next-swc/crates/core/tests/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};

use next_swc::{custom_before_pass, TransformOptions};
use serde::de::DeserializeOwned;
use turbo_binding::swc::{
use turbopack_binding::swc::{
core::{
base::Compiler,
common::comments::SingleThreadedComments,
Expand All @@ -14,12 +14,12 @@ use turbo_binding::swc::{
testing::{NormalizedOutput, Tester},
};

#[turbo_binding::swc::testing::fixture("tests/full/**/input.js")]
#[turbopack_binding::swc::testing::fixture("tests/full/**/input.js")]
fn full(input: PathBuf) {
test(&input, true);
}

#[turbo_binding::swc::testing::fixture("tests/loader/**/input.js")]
#[turbopack_binding::swc::testing::fixture("tests/loader/**/input.js")]
fn loader(input: PathBuf) {
test(&input, false);
}
Expand All @@ -34,16 +34,16 @@ fn test(input: &Path, minify: bool) {
let fm = cm.load_file(input).expect("failed to load file");

let options = TransformOptions {
swc: turbo_binding::swc::core::base::config::Options {
swc: turbopack_binding::swc::core::base::config::Options {
swcrc: true,
output_path: Some(output.clone()),

config: turbo_binding::swc::core::base::config::Config {
is_module: Some(turbo_binding::swc::core::base::config::IsModule::Bool(
true,
)),
config: turbopack_binding::swc::core::base::config::Config {
is_module: Some(
turbopack_binding::swc::core::base::config::IsModule::Bool(true),
),

jsc: turbo_binding::swc::core::base::config::JscConfig {
jsc: turbopack_binding::swc::core::base::config::JscConfig {
minify: if minify {
Some(assert_json("{ \"compress\": true, \"mangle\": true }"))
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/tests/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{cell::RefCell, rc::Rc, sync::Arc};
use fxhash::FxHashSet;
use next_swc::next_ssg::next_ssg;
use once_cell::sync::Lazy;
use turbo_binding::swc::core::{
use turbopack_binding::swc::core::{
base::{try_with_handler, Compiler},
common::{comments::SingleThreadedComments, FileName, FilePathMapping, SourceMap, GLOBALS},
ecma::transforms::base::pass::noop,
Expand Down
10 changes: 5 additions & 5 deletions packages/next-swc/crates/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ default = ["rustls-tls"]
# when build (i.e napi --build --features plugin), same for the wasm as well.
# this is due to some of transitive dependencies have features cannot be enabled at the same time
# (i.e wasmer/default vs wasmer/js-default) while cargo merges all the features at once.
plugin = ["turbo-binding/__swc_core_binding_napi_plugin", "next-swc/plugin"]
plugin = ["turbopack-binding/__swc_core_binding_napi_plugin", "next-swc/plugin"]
sentry_native_tls = ["sentry", "sentry/native-tls", "native-tls"]
sentry_rustls = ["sentry", "sentry/rustls", "rustls-tls"]

Expand Down Expand Up @@ -58,7 +58,7 @@ tracing = { version = "0.1.37" }
tracing-futures = "0.2.5"
tracing-subscriber = "0.3.9"
tracing-chrome = "0.5.0"
turbo-binding = { workspace = true, features = [
turbopack-binding = { workspace = true, features = [
"__swc_core_binding_napi",
"__feature_node_file_trace",
"__feature_mdx_rs",
Expand All @@ -69,7 +69,7 @@ turbo-binding = { workspace = true, features = [
] }

[target.'cfg(not(all(target_os = "linux", target_env = "musl", target_arch = "aarch64")))'.dependencies]
turbo-binding = { workspace = true, features = [
turbopack-binding = { workspace = true, features = [
"__turbo_tasks_malloc"
] }

Expand All @@ -88,6 +88,6 @@ sentry = { version = "0.27.0", default-features = false, features = [
napi-build = "2"
serde = "1"
serde_json = "1"
turbo-binding = { workspace = true, features = [
turbopack-binding = { workspace = true, features = [
"__turbo_tasks_build"
]}
]}
2 changes: 1 addition & 1 deletion packages/next-swc/crates/napi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
path::Path,
};

use turbo_binding::turbo::tasks_build::generate_register;
use turbopack_binding::turbo::tasks_build::generate_register;

extern crate napi_build;

Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/napi/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use next_core::app_structure::{
EntrypointsVc, LoaderTree, LoaderTreeVc, MetadataWithAltItem,
};
use serde::{Deserialize, Serialize};
use turbo_binding::{
use turbopack_binding::{
turbo::{
tasks,
tasks::{
Expand Down
Loading