Unverified Commit a1c695a8 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] add an extension to trace files (#94587)

Add `.bin` extension to trace files

This will hint to tools like tailwind that scan for content not to open
these.
parent ea744957
......@@ -465,7 +465,8 @@ pub fn project_new(
PathBuf::from(&options.root_path)
.join(&options.project_path)
.join(DIST_PROFILES_DIR_NAME)
.join("trace-turbopack")
// use a generic binary extension to hint to random tools not to read it.
.join("trace-turbopack.bin")
};
let trace_dir = trace_file
.parent()
......
......@@ -99,7 +99,7 @@ export async function uploadTraceToBlob(
}
const uploadableFiles = entries.filter(
(f) => f.endsWith('.cpuprofile') || f.endsWith('trace-turbopack')
(f) => f.endsWith('.cpuprofile') || f.endsWith('trace-turbopack.bin')
)
if (uploadableFiles.length === 0) {
......@@ -135,7 +135,7 @@ export async function uploadTraceToBlob(
if (file.endsWith('.cpuprofile')) {
validateCpuProfile(headerBuf, file)
} else if (file.endsWith('trace-turbopack')) {
} else if (file.endsWith('trace-turbopack.bin')) {
validateTurbopackTrace(headerBuf, file)
}
......
......@@ -161,7 +161,7 @@ describe('turbopack-trace-server', () => {
const traceFileNewPath = path.join(
next.testDir,
'.next-profiles',
'trace-turbopack'
'trace-turbopack.bin'
)
const traceFileOldPath = path.join(
next.testDir,
......
......@@ -32,11 +32,11 @@ describe('upload-trace', () => {
expect(cpuProfiles.length).toBeGreaterThan(0)
if (isTurbopack) {
expect(allFiles).toContain('trace-turbopack')
expect(allFiles).toContain('trace-turbopack.bin')
}
const uploadableFiles = allFiles.filter(
(f: string) => f.endsWith('.cpuprofile') || f === 'trace-turbopack'
(f: string) => f.endsWith('.cpuprofile') || f === 'trace-turbopack.bin'
)
const expectedUploadCount = uploadableFiles.length
......
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