Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
30b04a27
Commit
30b04a27
authored
Feb 26, 2026
by
Niklas Mischkulnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hash(&self, algorithm: HashAlgorithm)
parent
1de67d8b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
35 deletions
+21
-35
paths.rs
crates/next-api/src/paths.rs
+6
-2
routes_hashes_manifest.rs
crates/next-api/src/routes_hashes_manifest.rs
+5
-21
lib.rs
turbopack/crates/turbo-tasks-fs/src/lib.rs
+3
-2
asset.rs
turbopack/crates/turbopack-core/src/asset.rs
+7
-10
No files found.
crates/next-api/src/paths.rs
View file @
30b04a27
...
@@ -4,7 +4,7 @@ use tracing::Instrument;
...
@@ -4,7 +4,7 @@ use tracing::Instrument;
use
turbo_rcstr
::
RcStr
;
use
turbo_rcstr
::
RcStr
;
use
turbo_tasks
::{
ResolvedVc
,
TryFlatJoinIterExt
,
TryJoinIterExt
,
Vc
};
use
turbo_tasks
::{
ResolvedVc
,
TryFlatJoinIterExt
,
TryJoinIterExt
,
Vc
};
use
turbo_tasks_fs
::
FileSystemPath
;
use
turbo_tasks_fs
::
FileSystemPath
;
use
turbo_tasks_hash
::
{
HashAlgorithm
,
encode_hex
}
;
use
turbo_tasks_hash
::
HashAlgorithm
;
use
turbopack_core
::{
use
turbopack_core
::{
asset
::{
Asset
,
no_hash_salt
},
asset
::{
Asset
,
no_hash_salt
},
output
::{
OutputAsset
,
OutputAssets
},
output
::{
OutputAsset
,
OutputAssets
},
...
@@ -44,7 +44,11 @@ async fn asset_path(
...
@@ -44,7 +44,11 @@ async fn asset_path(
.await
?
.await
?
.context
(
"asset content not found"
)
?
.context
(
"asset content not found"
)
?
}
else
{
}
else
{
encode_hex
(
*
asset
.content
()
.hash
()
.await
?
)
.into
()
asset
.content
()
.hash
(
HashAlgorithm
::
Xxh3Hash128Hex
)
.owned
()
.await
?
};
};
Some
(
AssetPath
{
Some
(
AssetPath
{
path
:
RcStr
::
from
(
path
),
path
:
RcStr
::
from
(
path
),
...
...
crates/next-api/src/routes_hashes_manifest.rs
View file @
30b04a27
...
@@ -3,7 +3,7 @@ use serde::Serialize;
...
@@ -3,7 +3,7 @@ use serde::Serialize;
use
turbo_rcstr
::
RcStr
;
use
turbo_rcstr
::
RcStr
;
use
turbo_tasks
::{
FxIndexMap
,
FxIndexSet
,
ResolvedVc
,
TryFlatJoinIterExt
,
TryJoinIterExt
,
Vc
};
use
turbo_tasks
::{
FxIndexMap
,
FxIndexSet
,
ResolvedVc
,
TryFlatJoinIterExt
,
TryJoinIterExt
,
Vc
};
use
turbo_tasks_fs
::{
FileContent
,
FileSystemPath
};
use
turbo_tasks_fs
::{
FileContent
,
FileSystemPath
};
use
turbo_tasks_hash
::{
DeterministicHash
,
Xxh3Hash64Hasher
};
use
turbo_tasks_hash
::{
DeterministicHash
,
HashAlgorithm
,
Xxh3Hash64Hasher
,
hash_xxh3_hash64
};
use
turbopack_core
::{
use
turbopack_core
::{
asset
::{
Asset
,
AssetContent
},
asset
::{
Asset
,
AssetContent
},
module
::{
Module
,
Modules
},
module
::{
Module
,
Modules
},
...
@@ -77,19 +77,11 @@ pub async fn outputs_hash(outputs: Vc<OutputAssets>) -> Result<Vc<u64>> {
...
@@ -77,19 +77,11 @@ pub async fn outputs_hash(outputs: Vc<OutputAssets>) -> Result<Vc<u64>> {
.await
?
;
.await
?
;
let
outputs_hashes
=
output_assets
let
outputs_hashes
=
output_assets
.iter
()
.iter
()
.map
(|
asset
|
asset
.content
()
.hash
())
.map
(|
asset
|
asset
.content
()
.hash
(
HashAlgorithm
::
Xxh3Hash128Hex
))
.try_join
()
.try_join
()
.await
?
;
.await
?
;
let
outputs_hash
=
{
Ok
(
Vc
::
cell
(
hash_xxh3_hash64
(
outputs_hashes
)))
let
mut
hasher
=
Xxh3Hash64Hasher
::
new
();
for
hash
in
outputs_hashes
.iter
()
{
hash
.deterministic_hash
(
&
mut
hasher
);
}
hasher
.finish
()
};
Ok
(
Vc
::
cell
(
outputs_hash
))
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
@@ -159,19 +151,11 @@ pub async fn sources_hash(module_graph: Vc<ModuleGraph>, modules: Vc<Modules>) -
...
@@ -159,19 +151,11 @@ pub async fn sources_hash(module_graph: Vc<ModuleGraph>, modules: Vc<Modules>) -
.try_flat_join
()
.try_flat_join
()
.await
?
.await
?
.into_iter
()
.into_iter
()
.map
(|
source
|
source
.content
()
.hash
())
.map
(|
source
|
source
.content
()
.hash
(
HashAlgorithm
::
Xxh3Hash128Hex
))
.try_join
()
.try_join
()
.await
?
;
.await
?
;
let
sources_hash
=
{
Ok
(
Vc
::
cell
(
hash_xxh3_hash64
(
sources
)))
let
mut
hasher
=
Xxh3Hash64Hasher
::
new
();
for
source
in
sources
.iter
()
{
source
.deterministic_hash
(
&
mut
hasher
);
}
hasher
.finish
()
};
Ok
(
Vc
::
cell
(
sources_hash
))
}
}
#[derive(Serialize)]
#[derive(Serialize)]
...
...
turbopack/crates/turbo-tasks-fs/src/lib.rs
View file @
30b04a27
...
@@ -2441,8 +2441,9 @@ impl FileContent {
...
@@ -2441,8 +2441,9 @@ impl FileContent {
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
async
fn
hash
(
&
self
)
->
Result
<
Vc
<
u64
>>
{
pub
fn
hash
(
&
self
,
algorithm
:
HashAlgorithm
)
->
Vc
<
RcStr
>
{
Ok
(
Vc
::
cell
(
hash_xxh3_hash64
(
self
)))
// no_hash_salt
Vc
::
cell
(
RcStr
::
from
(
deterministic_hash
(
""
,
self
,
algorithm
)))
}
}
/// Converts this [`FileContent`] into a [`PersistedFileContent`] by cloning.
/// Converts this [`FileContent`] into a [`PersistedFileContent`] by cloning.
...
...
turbopack/crates/turbopack-core/src/asset.rs
View file @
30b04a27
...
@@ -4,7 +4,7 @@ use turbo_tasks::{ResolvedVc, Vc};
...
@@ -4,7 +4,7 @@ use turbo_tasks::{ResolvedVc, Vc};
use
turbo_tasks_fs
::{
use
turbo_tasks_fs
::{
FileContent
,
FileJsonContent
,
FileLinesContent
,
FileSystemPath
,
LinkContent
,
LinkType
,
FileContent
,
FileJsonContent
,
FileLinesContent
,
FileSystemPath
,
LinkContent
,
LinkType
,
};
};
use
turbo_tasks_hash
::{
HashAlgorithm
,
Xxh3Hash64Hasher
};
use
turbo_tasks_hash
::{
HashAlgorithm
,
deterministic_hash
};
use
crate
::
version
::{
VersionedAssetContent
,
VersionedContent
};
use
crate
::
version
::{
VersionedAssetContent
,
VersionedContent
};
...
@@ -131,16 +131,13 @@ impl AssetContent {
...
@@ -131,16 +131,13 @@ impl AssetContent {
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
async
fn
hash
(
&
self
)
->
Result
<
Vc
<
u64
>
>
{
pub
fn
hash
(
&
self
,
algorithm
:
HashAlgorithm
)
->
Vc
<
RcStr
>
{
match
self
{
match
self
{
AssetContent
::
File
(
content
)
=>
Ok
(
content
.hash
()),
AssetContent
::
File
(
content
)
=>
content
.hash
(
algorithm
),
AssetContent
::
Redirect
{
target
,
link_type
}
=>
{
AssetContent
::
Redirect
{
target
,
link_type
}
=>
Vc
::
cell
(
RcStr
::
from
(
use
turbo_tasks_hash
::
DeterministicHash
;
// no_hash_salt
let
mut
hasher
=
Xxh3Hash64Hasher
::
new
();
deterministic_hash
(
""
,
(
target
,
link_type
),
algorithm
),
target
.deterministic_hash
(
&
mut
hasher
);
)),
link_type
.deterministic_hash
(
&
mut
hasher
);
Ok
(
Vc
::
cell
(
hasher
.finish
()))
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment