1- import { createHash } from "node:crypto" ;
21import fsp from "node:fs/promises" ;
32import { defu } from "defu" ;
43import { glob } from "tinyglobby" ;
@@ -24,7 +23,8 @@ const IMMUTABLE_MANIFEST = "immutable.json";
2423
2524// Reserved Vercel namespace under which immutable static files are served.
2625// Used as the client `assetsDir` so content-addressed assets are emitted and
27- // referenced here, and served without the deployment-scoped `?dpl` query.
26+ // referenced here.
27+ // TODO: use process.env.VERCEL_HASH_SALT when exists
2828export const IMMUTABLE_DIR = "_vercel/immutable" ;
2929
3030interface ImmutableManifest {
@@ -38,9 +38,6 @@ export async function generateImmutableManifest(nitro: Nitro) {
3838 return ;
3939 }
4040
41- // The salt is factored into the hashes to provide a way to rotate file names.
42- const salt = process . env . VERCEL_HASH_SALT || "" ;
43-
4441 const isImmutable = createImmutableMatcher ( nitro ) ;
4542
4643 // Walk every emitted static file and hash the immutable (content-addressed)
@@ -57,7 +54,7 @@ export async function generateImmutableManifest(nitro: Nitro) {
5754 }
5855 const contents = await fsp . readFile ( join ( publicDir , file ) ) ;
5956 const url = joinURL ( nitro . options . baseURL , pathname ) ;
60- hashes [ url ] = hashContent ( contents , salt ) ;
57+ hashes [ url ] = ""
6158 }
6259
6360 const manifest : ImmutableManifest = { version : 1 , hashes } ;
@@ -93,8 +90,3 @@ function createImmutableMatcher(nitro: Nitro): (pathname: string) => boolean {
9390 return ! ! cacheControl && cacheControl . includes ( "immutable" ) ;
9491 } ;
9592}
96-
97- // Full content hash, salted so file names can be rotated via `VERCEL_HASH_SALT`.
98- function hashContent ( contents : Buffer , salt : string ) : string {
99- return createHash ( "sha256" ) . update ( salt ) . update ( contents ) . digest ( "base64url" ) ;
100- }
0 commit comments