diff --git a/Cargo.lock b/Cargo.lock index 18828bebd386d..55d6f19edbe6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -321,7 +321,7 @@ dependencies = [ [[package]] name = "auto-hash-map" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "serde", "smallvec", @@ -3090,7 +3090,7 @@ dependencies = [ [[package]] name = "node-file-trace" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "serde", @@ -6888,12 +6888,12 @@ dependencies = [ [[package]] name = "turbo-prehash" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" [[package]] name = "turbo-tasks" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-trait", @@ -6927,7 +6927,7 @@ dependencies = [ [[package]] name = "turbo-tasks-build" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "cargo-lock", @@ -6940,7 +6940,7 @@ dependencies = [ [[package]] name = "turbo-tasks-bytes" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "bytes", @@ -6954,7 +6954,7 @@ dependencies = [ [[package]] name = "turbo-tasks-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "dotenvs", @@ -6968,7 +6968,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fetch" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "lazy_static", @@ -6984,7 +6984,7 @@ dependencies = [ [[package]] name = "turbo-tasks-fs" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "auto-hash-map", @@ -7015,7 +7015,7 @@ dependencies = [ [[package]] name = "turbo-tasks-hash" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "md4", "turbo-tasks-macros", @@ -7025,7 +7025,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "either", @@ -7040,7 +7040,7 @@ dependencies = [ [[package]] name = "turbo-tasks-macros-shared" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "proc-macro2", "quote", @@ -7050,7 +7050,7 @@ dependencies = [ [[package]] name = "turbo-tasks-malloc" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "mimalloc", ] @@ -7058,7 +7058,7 @@ dependencies = [ [[package]] name = "turbo-tasks-memory" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "auto-hash-map", @@ -7086,7 +7086,7 @@ dependencies = [ [[package]] name = "turbopack" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-recursion", @@ -7116,7 +7116,7 @@ dependencies = [ [[package]] name = "turbopack-binding" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "auto-hash-map", "mdxjs", @@ -7157,7 +7157,7 @@ dependencies = [ [[package]] name = "turbopack-browser" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7180,7 +7180,7 @@ dependencies = [ [[package]] name = "turbopack-cli-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "clap", @@ -7197,7 +7197,7 @@ dependencies = [ [[package]] name = "turbopack-core" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-recursion", @@ -7226,7 +7226,7 @@ dependencies = [ [[package]] name = "turbopack-css" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7253,7 +7253,7 @@ dependencies = [ [[package]] name = "turbopack-dev-server" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-compression", @@ -7289,7 +7289,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-trait", @@ -7324,7 +7324,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript-hmr-protocol" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "serde", "serde_json", @@ -7335,7 +7335,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript-plugins" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-trait", @@ -7360,7 +7360,7 @@ dependencies = [ [[package]] name = "turbopack-ecmascript-runtime" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indoc", @@ -7376,7 +7376,7 @@ dependencies = [ [[package]] name = "turbopack-env" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7392,7 +7392,7 @@ dependencies = [ [[package]] name = "turbopack-image" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "base64 0.21.4", @@ -7411,7 +7411,7 @@ dependencies = [ [[package]] name = "turbopack-json" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "serde", @@ -7426,7 +7426,7 @@ dependencies = [ [[package]] name = "turbopack-mdx" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "mdxjs", @@ -7441,7 +7441,7 @@ dependencies = [ [[package]] name = "turbopack-node" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "async-stream", @@ -7475,7 +7475,7 @@ dependencies = [ [[package]] name = "turbopack-nodejs" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7495,7 +7495,7 @@ dependencies = [ [[package]] name = "turbopack-resolve" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indexmap 1.9.3", @@ -7513,7 +7513,7 @@ dependencies = [ [[package]] name = "turbopack-static" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "serde", @@ -7529,7 +7529,7 @@ dependencies = [ [[package]] name = "turbopack-swc-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "swc_core", "turbo-tasks", @@ -7540,7 +7540,7 @@ dependencies = [ [[package]] name = "turbopack-trace-server" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "either", @@ -7560,7 +7560,7 @@ dependencies = [ [[package]] name = "turbopack-trace-utils" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "crossbeam-channel", @@ -7576,7 +7576,7 @@ dependencies = [ [[package]] name = "turbopack-wasm" version = "0.1.0" -source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240722.3#7677ac8f23775c5ff10bf23fa43b2097975a7f85" +source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240724.2#f32ebe9618ff7f3b45c7d086918185412cb4668b" dependencies = [ "anyhow", "indexmap 1.9.3", diff --git a/Cargo.toml b/Cargo.toml index bed1d551671b1..28b2e5e336a27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,11 +38,11 @@ swc_core = { version = "0.96.9", features = [ testing = { version = "0.36.0" } # Turbo crates -turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240722.3" } +turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240724.2" } # [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-240722.3" } +turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240724.2" } # [TODO]: need to refactor embed_directory! macro usage in next-core -turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240722.3" } +turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240724.2" } # General Deps diff --git a/crates/next-api/src/dynamic_imports.rs b/crates/next-api/src/dynamic_imports.rs index fea92c76dfaa7..ca6e10bf3ed15 100644 --- a/crates/next-api/src/dynamic_imports.rs +++ b/crates/next-api/src/dynamic_imports.rs @@ -272,7 +272,7 @@ async fn build_dynamic_imports_map_for_module( // https://github.com/vercel/next.js/pull/56389#discussion_r1349336374 // don't emit specific error as we expect there's a parse error already reported - let ParseResult::Ok { program, .. } = &*ecmascript_asset.parse().await? else { + let ParseResult::Ok { program, .. } = &*ecmascript_asset.failsafe_parse().await? else { return Ok(Vc::cell(None)); }; diff --git a/crates/next-api/src/server_actions.rs b/crates/next-api/src/server_actions.rs index 172c62fc7e71c..3a16c0f52ff7b 100644 --- a/crates/next-api/src/server_actions.rs +++ b/crates/next-api/src/server_actions.rs @@ -301,7 +301,7 @@ async fn parse_actions(module: Vc>) -> Result>), - /// Only mark modules listed as external. + /// Only mark modules listed as external, whether inside node_modules or + /// not. Only(Vc>), } @@ -76,13 +78,10 @@ impl AfterResolvePlugin for ExternalCjsModulesResolvePlugin { async fn after_resolve( &self, fs_path: Vc, - context: Vc, + lookup_path: Vc, reference_type: Value, request: Vc, ) -> Result> { - if *condition(self.root).matches(context).await? { - return Ok(ResolveResultOption::none()); - } let request_value = &*request.await?; if !matches!(request_value, Request::Module { .. }) { return Ok(ResolveResultOption::none()); @@ -104,6 +103,10 @@ impl AfterResolvePlugin for ExternalCjsModulesResolvePlugin { let predicate = self.predicate.await?; let must_be_external = match &*predicate { ExternalPredicate::AllExcept(exceptions) => { + if *condition(self.root).matches(lookup_path).await? { + return Ok(ResolveResultOption::none()); + } + let exception_glob = packages_glob(*exceptions).await?; if let Some(PackagesGlobs { @@ -205,13 +208,13 @@ impl AfterResolvePlugin for ExternalCjsModulesResolvePlugin { let mut request = request; let node_resolve_options = if is_esm { - node_esm_resolve_options(context.root()) + node_esm_resolve_options(lookup_path.root()) } else { - node_cjs_resolve_options(context.root()) + node_cjs_resolve_options(lookup_path.root()) }; let result_from_original_location = loop { let node_resolved_from_original_location = resolve( - context, + lookup_path, reference_type.clone(), request, node_resolve_options, @@ -367,7 +370,7 @@ impl AfterResolvePlugin for ExternalCjsModulesResolvePlugin { // It would be more efficient to use an CJS external instead of an ESM external, // but we need to verify if that would be correct (as in resolves to the same // file). - let node_resolve_options = node_cjs_resolve_options(context.root()); + let node_resolve_options = node_cjs_resolve_options(lookup_path.root()); let node_resolved = resolve( self.project_path, reference_type.clone(), diff --git a/crates/next-core/src/next_shared/resolve.rs b/crates/next-core/src/next_shared/resolve.rs index 9214f07636fde..26a7956dfd322 100644 --- a/crates/next-core/src/next_shared/resolve.rs +++ b/crates/next-core/src/next_shared/resolve.rs @@ -232,7 +232,7 @@ impl AfterResolvePlugin for NextExternalResolvePlugin { async fn after_resolve( &self, fs_path: Vc, - _context: Vc, + _lookup_path: Vc, _reference_type: Value, _request: Vc, ) -> Result> { @@ -282,7 +282,7 @@ impl AfterResolvePlugin for NextNodeSharedRuntimeResolvePlugin { async fn after_resolve( &self, fs_path: Vc, - _context: Vc, + _lookup_path: Vc, _reference_type: Value, _request: Vc, ) -> Result> { @@ -406,7 +406,7 @@ impl AfterResolvePlugin for NextSharedRuntimeResolvePlugin { async fn after_resolve( &self, fs_path: Vc, - _context: Vc, + _lookup_path: Vc, _reference_type: Value, _request: Vc, ) -> Result> { diff --git a/crates/next-core/src/util.rs b/crates/next-core/src/util.rs index fc3d233c34387..d844394c34977 100644 --- a/crates/next-core/src/util.rs +++ b/crates/next-core/src/util.rs @@ -380,7 +380,7 @@ pub async fn parse_config_from_source(module: Vc>) -> Result{ "Component.useEffect": ()=>{} }["Component.useEffect"]); const onClick = useCallback({ - "Component.useCallback(onClick)": ()=>[] - }["Component.useCallback(onClick)"]); + "Component.useCallback[onClick]": ()=>[] + }["Component.useCallback[onClick]"]); const computed = useMemo({ - "Component.useMemo(computed)": ()=>{} - }["Component.useMemo(computed)"]); + "Component.useMemo[computed]": ()=>{} + }["Component.useMemo[computed]"]); }; diff --git a/crates/next-custom-transforms/tests/fixture/debug-fn-name/composite-hook/output.js b/crates/next-custom-transforms/tests/fixture/debug-fn-name/composite-hook/output.js index dff6ea08cdc61..2c216531c6033 100644 --- a/crates/next-custom-transforms/tests/fixture/debug-fn-name/composite-hook/output.js +++ b/crates/next-custom-transforms/tests/fixture/debug-fn-name/composite-hook/output.js @@ -6,9 +6,9 @@ function useSomething() { "useSomething.useEffect": ()=>{} }["useSomething.useEffect"]); const onClick = useCallback({ - "useSomething.useCallback(onClick)": ()=>[] - }["useSomething.useCallback(onClick)"]); + "useSomething.useCallback[onClick]": ()=>[] + }["useSomething.useCallback[onClick]"]); const computed = useMemo({ - "useSomething.useMemo(computed)": ()=>{} - }["useSomething.useMemo(computed)"]); + "useSomething.useMemo[computed]": ()=>{} + }["useSomething.useMemo[computed]"]); } diff --git a/crates/next-custom-transforms/tests/fixture/debug-fn-name/export-default/output.js b/crates/next-custom-transforms/tests/fixture/debug-fn-name/export-default/output.js index 4323650b80467..638fa086c1163 100644 --- a/crates/next-custom-transforms/tests/fixture/debug-fn-name/export-default/output.js +++ b/crates/next-custom-transforms/tests/fixture/debug-fn-name/export-default/output.js @@ -6,9 +6,9 @@ export default (()=>{ "useEffect": ()=>{} }["useEffect"]); const onClick = useCallback({ - "useCallback(onClick)": ()=>[] - }["useCallback(onClick)"]); + "useCallback[onClick]": ()=>[] + }["useCallback[onClick]"]); const computed = useMemo({ - "useMemo(computed)": ()=>{} - }["useMemo(computed)"]); + "useMemo[computed]": ()=>{} + }["useMemo[computed]"]); }); diff --git a/crates/next-custom-transforms/tests/fixture/debug-fn-name/hoc/output.js b/crates/next-custom-transforms/tests/fixture/debug-fn-name/hoc/output.js index 0a84ae7849d71..d2b20defa00f2 100644 --- a/crates/next-custom-transforms/tests/fixture/debug-fn-name/hoc/output.js +++ b/crates/next-custom-transforms/tests/fixture/debug-fn-name/hoc/output.js @@ -6,9 +6,9 @@ const Component = someHoC(()=>{ "Component.useEffect": ()=>{} }["Component.useEffect"]); const onClick = useCallback({ - "Component.useCallback(onClick)": ()=>[] - }["Component.useCallback(onClick)"]); + "Component.useCallback[onClick]": ()=>[] + }["Component.useCallback[onClick]"]); const computed = useMemo({ - "Component.useMemo(computed)": ()=>{} - }["Component.useMemo(computed)"]); + "Component.useMemo[computed]": ()=>{} + }["Component.useMemo[computed]"]); }); diff --git a/crates/next-custom-transforms/tests/fixture/debug-fn-name/normal/output.js b/crates/next-custom-transforms/tests/fixture/debug-fn-name/normal/output.js index 8a88618f87afc..423b8955560b7 100644 --- a/crates/next-custom-transforms/tests/fixture/debug-fn-name/normal/output.js +++ b/crates/next-custom-transforms/tests/fixture/debug-fn-name/normal/output.js @@ -6,9 +6,9 @@ function MyComponent() { "MyComponent.useEffect": ()=>{} }["MyComponent.useEffect"]); const onClick = useCallback({ - "MyComponent.useCallback(onClick)": ()=>[] - }["MyComponent.useCallback(onClick)"]); + "MyComponent.useCallback[onClick]": ()=>[] + }["MyComponent.useCallback[onClick]"]); const computed = useMemo({ - "MyComponent.useMemo(computed)": ()=>{} - }["MyComponent.useMemo(computed)"]); + "MyComponent.useMemo[computed]": ()=>{} + }["MyComponent.useMemo[computed]"]); } diff --git a/docs/02-app/02-api-reference/05-next-config-js/serverExternalPackages.mdx b/docs/02-app/02-api-reference/05-next-config-js/serverExternalPackages.mdx index 45e2afe74524b..2583ab63d98ce 100644 --- a/docs/02-app/02-api-reference/05-next-config-js/serverExternalPackages.mdx +++ b/docs/02-app/02-api-reference/05-next-config-js/serverExternalPackages.mdx @@ -47,6 +47,7 @@ Next.js includes a [short list of popular packages](https://github.com/vercel/ne - `isolated-vm` - `jest` - `jsdom` +- `keyv` - `libsql` - `mdx-bundler` - `mongodb` diff --git a/docs/03-pages/02-api-reference/03-next-config-js/serverExternalPackages.mdx b/docs/03-pages/02-api-reference/03-next-config-js/serverExternalPackages.mdx index f869796edf7a8..dcb66eb0abdeb 100644 --- a/docs/03-pages/02-api-reference/03-next-config-js/serverExternalPackages.mdx +++ b/docs/03-pages/02-api-reference/03-next-config-js/serverExternalPackages.mdx @@ -47,6 +47,7 @@ Next.js includes a [short list of popular packages](https://github.com/vercel/ne - `isolated-vm` - `jest` - `jsdom` +- `keyv` - `libsql` - `mdx-bundler` - `mongodb` diff --git a/examples/with-slate/app/api/editor-state/route.ts b/examples/with-slate/app/api/editor-state/route.ts new file mode 100644 index 0000000000000..a07ea10895948 --- /dev/null +++ b/examples/with-slate/app/api/editor-state/route.ts @@ -0,0 +1,8 @@ +export async function POST(req: Request) { + const editorState = await req.json(); + console.log("TODO: Save editorState on the server", editorState); + + return Response.json({ + status: "ok", + }); +} diff --git a/examples/with-slate/app/layout.tsx b/examples/with-slate/app/layout.tsx new file mode 100644 index 0000000000000..5ff842ef07b83 --- /dev/null +++ b/examples/with-slate/app/layout.tsx @@ -0,0 +1,16 @@ +export const metadata = { + title: "Next.js", + description: "Generated by Next.js", +}; + +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + + {children} + + ); +} diff --git a/examples/with-slate/pages/index.tsx b/examples/with-slate/app/page.tsx similarity index 56% rename from examples/with-slate/pages/index.tsx rename to examples/with-slate/app/page.tsx index 4471917c2c7d0..b3c3c67c83974 100644 --- a/examples/with-slate/pages/index.tsx +++ b/examples/with-slate/app/page.tsx @@ -1,39 +1,32 @@ +"use client"; + import { useState } from "react"; import { createEditor, Descendant } from "slate"; import { Slate, Editable, withReact } from "slate-react"; -import { withHistory } from "slate-history"; -import { InferGetServerSidePropsType } from "next"; -export async function getServerSideProps() { - return { - props: { - editorState: [ - { - children: [ - { text: "This is editable plain text, just like a