Unverified Commit aa51bedb authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Revert "Implement Turbopack trace server bindings" (#65419)

This is failing to compile for some of our targets to reverting to
unblock CI

Reverts vercel/next.js#65410

Closes NEXT-3331
parent 89d2abdf
This diff is collapsed.
...@@ -37,11 +37,11 @@ swc_core = { version = "0.90.33", features = [ ...@@ -37,11 +37,11 @@ swc_core = { version = "0.90.33", features = [
testing = { version = "0.35.22" } testing = { version = "0.35.22" }
# Turbo crates # Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240506.2" } turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240503.1" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros.. # [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-240506.2" } turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240503.1" }
# [TODO]: need to refactor embed_directory! macro usage in next-core # [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240506.2" } turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240503.1" }
# General Deps # General Deps
......
...@@ -58,8 +58,6 @@ pub mod next_api; ...@@ -58,8 +58,6 @@ pub mod next_api;
pub mod parse; pub mod parse;
pub mod transform; pub mod transform;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub mod turbo_trace_server;
#[cfg(not(target_arch = "wasm32"))]
pub mod turbopack; pub mod turbopack;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub mod turbotrace; pub mod turbotrace;
......
use std::{path::PathBuf, sync::Arc, thread, time::Duration}; use std::{path::PathBuf, sync::Arc, time::Duration};
use anyhow::{anyhow, bail, Context, Result}; use anyhow::{anyhow, bail, Context, Result};
use napi::{ use napi::{
...@@ -249,22 +249,12 @@ pub async fn project_new( ...@@ -249,22 +249,12 @@ pub async fn project_new(
.context("Unable to create .next directory") .context("Unable to create .next directory")
.unwrap(); .unwrap();
let trace_file = internal_dir.join("trace.log"); let trace_file = internal_dir.join("trace.log");
let trace_writer = std::fs::File::create(trace_file.clone()).unwrap(); let trace_writer = std::fs::File::create(trace_file).unwrap();
let (trace_writer, guard) = TraceWriter::new(trace_writer); let (trace_writer, guard) = TraceWriter::new(trace_writer);
let subscriber = subscriber.with(RawTraceLayer::new(trace_writer)); let subscriber = subscriber.with(RawTraceLayer::new(trace_writer));
let guard = ExitGuard::new(guard).unwrap(); let guard = ExitGuard::new(guard).unwrap();
let trace_server = std::env::var("NEXT_TURBOPACK_TRACE_SERVER").ok();
if trace_server.is_some() {
thread::spawn(move || {
turbopack_binding::turbopack::trace_server::start_turbopack_trace_server(
trace_file,
);
});
println!("Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/");
}
subscriber.init(); subscriber.init();
Some(guard) Some(guard)
......
use std::path::PathBuf;
#[napi]
pub fn start_turbopack_trace_server(path: String) {
let path_buf = PathBuf::from(path);
turbopack_binding::turbopack::trace_server::start_turbopack_trace_server(path_buf);
}
...@@ -55,7 +55,6 @@ turbopack-binding = { workspace = true, features = [ ...@@ -55,7 +55,6 @@ turbopack-binding = { workspace = true, features = [
"__turbopack_image", "__turbopack_image",
"__turbopack_node", "__turbopack_node",
"__turbopack_trace_utils", "__turbopack_trace_utils",
"__turbopack_trace_server",
] } ] }
turbo-tasks = { workspace = true } turbo-tasks = { workspace = true }
......
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
"@types/ws": "8.2.0", "@types/ws": "8.2.0",
"@vercel/ncc": "0.34.0", "@vercel/ncc": "0.34.0",
"@vercel/nft": "0.26.4", "@vercel/nft": "0.26.4",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240506.2", "@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240503.1",
"acorn": "8.5.0", "acorn": "8.5.0",
"amphtml-validator": "1.0.35", "amphtml-validator": "1.0.35",
"anser": "1.4.9", "anser": "1.4.9",
......
...@@ -383,19 +383,4 @@ program ...@@ -383,19 +383,4 @@ program
}) })
.usage('[directory] [options]') .usage('[directory] [options]')
const internal = program
.command('internal')
.description(
'Internal debugging commands. Use with caution. Not covered by semver.'
)
internal
.command('turbo-trace-server')
.argument('[file]', 'Trace file to serve.')
.action((file) => {
return import('../cli/internal/turbo-trace-server.js').then((mod) =>
mod.startTurboTraceServerCli(file)
)
})
program.parse(process.argv) program.parse(process.argv)
...@@ -137,7 +137,7 @@ let lastNativeBindingsLoadErrorCode: ...@@ -137,7 +137,7 @@ let lastNativeBindingsLoadErrorCode:
| 'unsupported_target' | 'unsupported_target'
| string | string
| undefined = undefined | undefined = undefined
let nativeBindings: Binding let nativeBindings: any
let wasmBindings: any let wasmBindings: any
let downloadWasmPromise: any let downloadWasmPromise: any
let pendingBindings: any let pendingBindings: any
...@@ -157,21 +157,21 @@ export interface Binding { ...@@ -157,21 +157,21 @@ export interface Binding {
stream: any stream: any
get: any get: any
} }
mdx: {
compile: any
compileSync: any
}
createProject: ( createProject: (
options: ProjectOptions, options: ProjectOptions,
turboEngineOptions?: TurboEngineOptions turboEngineOptions?: TurboEngineOptions
) => Promise<Project> ) => Promise<Project>
startTurbopackTraceServer: (path: string) => void
}
mdx: {
compile: any
compileSync: any
} }
minify: any minify: any
minifySync: any minifySync: any
transform: any transform: any
transformSync: any transformSync: any
parse: any parse: any
parseSync: any
getTargetTriple(): string | undefined getTargetTriple(): string | undefined
...@@ -752,10 +752,7 @@ function rustifyEnv(env: Record<string, string>): RustifiedEnv { ...@@ -752,10 +752,7 @@ function rustifyEnv(env: Record<string, string>): RustifiedEnv {
} }
// TODO(sokra) Support wasm option. // TODO(sokra) Support wasm option.
function bindingToApi( function bindingToApi(binding: any, _wasm: boolean) {
binding: any,
_wasm: boolean
): Binding['turbo']['createProject'] {
type NativeFunction<T> = ( type NativeFunction<T> = (
callback: (err: Error, value: T) => void callback: (err: Error, value: T) => void
) => Promise<{ __napiType: 'RootTask' }> ) => Promise<{ __napiType: 'RootTask' }>
...@@ -1197,10 +1194,10 @@ function bindingToApi( ...@@ -1197,10 +1194,10 @@ function bindingToApi(
} }
} }
const createProject: Binding['turbo']['createProject'] = async ( async function createProject(
options, options: ProjectOptions,
turboEngineOptions turboEngineOptions: TurboEngineOptions
) => { ) {
return new ProjectImpl( return new ProjectImpl(
await binding.projectNew( await binding.projectNew(
await rustifyProjectOptions(options), await rustifyProjectOptions(options),
...@@ -1258,6 +1255,9 @@ async function loadWasm(importPath = '') { ...@@ -1258,6 +1255,9 @@ async function loadWasm(importPath = '') {
? bindings.parse(src.toString(), options) ? bindings.parse(src.toString(), options)
: Promise.resolve(bindings.parseSync(src.toString(), options)) : Promise.resolve(bindings.parseSync(src.toString(), options))
}, },
parseSync(src: string, options: any) {
return bindings.parseSync(src.toString(), options)
},
getTargetTriple() { getTargetTriple() {
return undefined return undefined
}, },
...@@ -1483,12 +1483,6 @@ function loadNative(importPath?: string) { ...@@ -1483,12 +1483,6 @@ function loadNative(importPath?: string) {
}, },
}, },
createProject: bindingToApi(customBindings ?? bindings, false), createProject: bindingToApi(customBindings ?? bindings, false),
startTurbopackTraceServer: (traceFilePath) => {
Log.warn(
'Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/'
)
;(customBindings ?? bindings).startTurbopackTraceServer(traceFilePath)
},
}, },
mdx: { mdx: {
compile: (src: string, options: any) => compile: (src: string, options: any) =>
......
import { loadBindings } from '../../build/swc'
export async function startTurboTraceServerCli(file: string) {
let bindings = await loadBindings()
bindings.turbo.startTurbopackTraceServer(file)
}
...@@ -1072,8 +1072,8 @@ importers: ...@@ -1072,8 +1072,8 @@ importers:
specifier: 0.26.4 specifier: 0.26.4
version: 0.26.4 version: 0.26.4
'@vercel/turbopack-ecmascript-runtime': '@vercel/turbopack-ecmascript-runtime':
specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240506.2 specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240503.1
version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240506.2' version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240503.1'
acorn: acorn:
specifier: 8.5.0 specifier: 8.5.0
version: 8.5.0 version: 8.5.0
...@@ -25773,8 +25773,8 @@ packages: ...@@ -25773,8 +25773,8 @@ packages:
/zwitch@2.0.4: /zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
'@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240506.2': '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240503.1':
resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240506.2} resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240503.1}
name: '@vercel/turbopack-ecmascript-runtime' name: '@vercel/turbopack-ecmascript-runtime'
version: 0.0.0 version: 0.0.0
dependencies: dependencies:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment