Unverified Commit c1967707 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

Turbopack: Use more robust logic for absolute and percent-encoded URLs in source…

Turbopack: Use more robust logic for absolute and percent-encoded URLs in source maps received from loaders (#84255)
Co-authored-by: 's avatarSebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
parent c35549a5
......@@ -9564,6 +9564,7 @@ dependencies = [
"turbo-tasks-hash",
"turbo-tasks-testing",
"turbo-unix-path",
"url",
"urlencoding",
]
......
......@@ -406,9 +406,22 @@ describe('ReactRefreshLogBox app', () => {
)
if (isTurbopack) {
// TODO(veil): Turbopack is flaky. Possibly related to https://linear.app/vercel/issue/NDX-920/turbopack-errors-after-hmr-have-no-stacktraces-in-affected-chunks
// Should use `await expect(browser).toDisplayRedbox()`
await session.assertHasRedbox()
// TODO(veil): Possibly https://linear.app/vercel/issue/NEXT-4411
await expect(browser).toDisplayRedbox(`
{
"description": "",
"environmentLabel": null,
"label": "Runtime Error",
"source": "Child.js (4:11) @ ClickCount.render
> 4 | throw new Error()
| ^",
"stack": [
"ClickCount.render Child.js (4:11)",
"Home index.js (6:7)",
"<FIXME-file-protocol>",
],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
......@@ -1032,7 +1045,6 @@ describe('ReactRefreshLogBox app', () => {
)
if (isTurbopack) {
// <FIXME-file-protocol>: https://linear.app/vercel/issue/NDX-920/
await expect(browser).toDisplayRedbox(`
{
"description": "test",
......@@ -1043,8 +1055,6 @@ describe('ReactRefreshLogBox app', () => {
| ^",
"stack": [
"{default export} index.js (3:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"Page app/page.js (2:1)",
],
}
......@@ -1135,7 +1145,6 @@ describe('ReactRefreshLogBox app', () => {
// Render error should "win" and show up in fullscreen
// TODO(veil): Why Owner Stack location different?
if (isTurbopack) {
// <FIXME-file-protocol>: https://linear.app/vercel/issue/NDX-920/
await expect(browser).toDisplayRedbox(`
{
"description": "Component error",
......@@ -1146,8 +1155,6 @@ describe('ReactRefreshLogBox app', () => {
| ^",
"stack": [
"Index index.js (2:44)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"Page index.js (16:8)",
],
}
......@@ -1540,8 +1547,6 @@ describe('ReactRefreshLogBox app', () => {
await session.assertHasRedbox()
})
// TODO(veil): Turbopack is flaky. Possibly related to https://linear.app/vercel/issue/NDX-920/turbopack-errors-after-hmr-have-no-stacktraces-in-affected-chunks
if (isRspack) {
await expect({ browser, next }).toDisplayRedbox(`
{
......
......@@ -520,7 +520,7 @@ describe('Error recovery app', () => {
)
if (isTurbopack) {
// <FIXME-file-protocol>: https://linear.app/vercel/issue/NDX-920/
// TODO(veil): Possibly https://linear.app/vercel/issue/NDX-920/
await expect(browser).toDisplayRedbox(`
{
"description": "oops",
......@@ -531,8 +531,6 @@ describe('Error recovery app', () => {
| ^",
"stack": [
"Child child.js (3:9)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"Index index.js (6:7)",
"<FIXME-file-protocol>",
],
......@@ -824,7 +822,7 @@ describe('Error recovery app', () => {
// We get an error because Foo didn't import React. Fair.
if (isTurbopack) {
// <FIXME-file-protocol>: https://linear.app/vercel/issue/NDX-920/
// TODO(veil): Possibly https://linear.app/vercel/issue/NDX-920/
await expect(browser).toDisplayRedbox(`
{
"description": "React is not defined",
......@@ -835,8 +833,6 @@ describe('Error recovery app', () => {
| ^",
"stack": [
"Foo Foo.js (3:3)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"FunctionDefault index.js (4:10)",
"<FIXME-file-protocol>",
],
......@@ -1086,7 +1082,6 @@ describe('Error recovery app', () => {
)
if (isTurbopack) {
// TODO(veil): Location of Page should be app/page.js
// <FIXME-file-protocol>: https://linear.app/vercel/issue/NDX-920/
await expect(browser).toDisplayRedbox(`
{
"description": "nooo",
......@@ -1097,8 +1092,6 @@ describe('Error recovery app', () => {
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"Page index.js (10:16)",
],
}
......
......@@ -294,8 +294,6 @@ describe('ReactRefreshLogBox', () => {
| ^",
"stack": [
"FunctionDefault FunctionDefault.js (1:51)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
{
......@@ -307,8 +305,6 @@ describe('ReactRefreshLogBox', () => {
| ^",
"stack": [
"FunctionDefault FunctionDefault.js (1:51)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
]
......@@ -352,8 +348,6 @@ describe('ReactRefreshLogBox', () => {
| ^",
"stack": [
"FunctionDefault FunctionDefault.js (1:51)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
}
`)
......@@ -570,7 +564,6 @@ describe('ReactRefreshLogBox', () => {
`
)
// TODO(veil): Don't bail in Turbopack for sources outside of the project (https://linear.app/vercel/issue/NDX-944)
if (isReact18 && isTurbopack) {
await expect(browser).toDisplayRedbox(`
[
......@@ -583,8 +576,6 @@ describe('ReactRefreshLogBox', () => {
| ^",
"stack": [
"ClickCount.render Child.js (4:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
{
......@@ -596,8 +587,6 @@ describe('ReactRefreshLogBox', () => {
| ^",
"stack": [
"ClickCount.render Child.js (4:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
]
......@@ -630,23 +619,7 @@ describe('ReactRefreshLogBox', () => {
]
`)
} else {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "",
"environmentLabel": null,
"label": "Runtime Error",
"source": "Child.js (4:11) @ ClickCount.render
> 4 | throw new Error()
| ^",
"stack": [
"ClickCount.render Child.js (4:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
}
`)
} else if (isRspack) {
if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "",
......
......@@ -244,8 +244,6 @@ describe('pages/ error recovery', () => {
`
)
// TODO(veil): Don't bail in Turbopack for sources outside of the project (https://linear.app/vercel/issue/NDX-944)
// Somehow we end up with two in React 18 + Turbopack/Rspack due to React's attempt to recover from this error.
if (isReact18 && isTurbopack) {
await expect(browser).toDisplayRedbox(`
[
......@@ -258,8 +256,6 @@ describe('pages/ error recovery', () => {
| ^",
"stack": [
"Child child.js (3:9)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
{
......@@ -271,8 +267,6 @@ describe('pages/ error recovery', () => {
| ^",
"stack": [
"Child child.js (3:9)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
]
......@@ -305,23 +299,7 @@ describe('pages/ error recovery', () => {
]
`)
} else {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "oops",
"environmentLabel": null,
"label": "Runtime Error",
"source": "child.js (3:9) @ Child
> 3 | throw new Error('oops')
| ^",
"stack": [
"Child child.js (3:9)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
}
`)
} else if (isRspack) {
if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "oops",
......@@ -587,8 +565,6 @@ describe('pages/ error recovery', () => {
await expect(session.getRedboxSource()).resolves.toInclude('render() {')
})
// TODO(veil): Don't bail in Turbopack for sources outside of the project (https://linear.app/vercel/issue/NDX-944)
// Somehow we end up with two in React 18 due to React's attempt to recover from this error.
if (isReact18 && isTurbopack) {
await expect(browser).toDisplayRedbox(`
[
......@@ -601,8 +577,6 @@ describe('pages/ error recovery', () => {
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
{
......@@ -614,60 +588,24 @@ describe('pages/ error recovery', () => {
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
]
`)
} else {
if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "nooo",
"environmentLabel": null,
"label": "Runtime Error",
"source": "index.js (5:11) @ ClassDefault.render
> 5 | throw new Error('nooo');
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
],
}
`)
} else {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "nooo",
"environmentLabel": null,
"label": "Runtime Error",
"source": "index.js (5:11) @ ClassDefault.render
> 5 | throw new Error('nooo');
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
}
`)
} else {
await expect(browser).toDisplayRedbox(`
{
"description": "nooo",
"environmentLabel": null,
"label": "Runtime Error",
"source": "index.js (5:11) @ ClassDefault.render
> 5 | throw new Error('nooo');
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
],
}
`)
await expect(browser).toDisplayRedbox(`
{
"description": "nooo",
"environmentLabel": null,
"label": "Runtime Error",
"source": "index.js (5:11) @ ClassDefault.render
> 5 | throw new Error('nooo');
| ^",
"stack": [
"ClassDefault.render index.js (5:11)",
],
}
}
`)
}
})
......@@ -714,41 +652,7 @@ describe('pages/ error recovery', () => {
`
)
// TODO(veil): Don't bail in Turbopack for sources outside of the project (https://linear.app/vercel/issue/NDX-944)
// We get an error because Foo didn't import React. Fair.
// Somehow we end up with two in React 18 + Turbopack/Rspack due to React's attempt to recover from this error.
if (isReact18 && isTurbopack) {
await expect(browser).toDisplayRedbox(`
[
{
"description": "React is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "Foo.js (3:3) @ Foo
> 3 | return React.createElement('h1', null, 'Foo');
| ^",
"stack": [
"Foo Foo.js (3:3)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
{
"description": "React is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "Foo.js (3:3) @ Foo
> 3 | return React.createElement('h1', null, 'Foo');
| ^",
"stack": [
"Foo Foo.js (3:3)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
},
]
`)
} else if (isReact18 && isRspack) {
if (isReact18 && (isRspack || isTurbopack)) {
await expect(browser).toDisplayRedbox(`
[
{
......@@ -776,23 +680,7 @@ describe('pages/ error recovery', () => {
]
`)
} else {
if (isTurbopack) {
await expect(browser).toDisplayRedbox(`
{
"description": "React is not defined",
"environmentLabel": null,
"label": "Runtime ReferenceError",
"source": "Foo.js (3:3) @ Foo
> 3 | return React.createElement('h1', null, 'Foo');
| ^",
"stack": [
"Foo Foo.js (3:3)",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
],
}
`)
} else if (isRspack) {
if (isRspack) {
await expect(browser).toDisplayRedbox(`
{
"description": "React is not defined",
......
......@@ -148,8 +148,7 @@ describe('app-dir - server source maps', () => {
'\n at runWithExternal (app/ssr-error-log-ignore-listed/page.js:17:32)' +
'\n at runWithInternalSourceMapped (app/ssr-error-log-ignore-listed/page.js:16:18)' +
// Realpath does not point into node_modules so we don't ignore it.
// TODO(veil): Should be internal-pkg/sourcemapped.ts
'\n at runInternalSourceMapped (sourcemapped.ts:5:10)' +
'\n at runInternalSourceMapped (internal-pkg/sourcemapped.ts:5:10)' +
'\n at runWithInternal (app/ssr-error-log-ignore-listed/page.js:15:28)' +
// Realpath does not point into node_modules so we don't ignore it.
'\n at runInternal (internal-pkg/index.js:2:10)' +
......@@ -191,12 +190,11 @@ describe('app-dir - server source maps', () => {
"stack": [
"logError app/ssr-error-log-ignore-listed/page.js (9:17)",
"runWithInternalIgnored app/ssr-error-log-ignore-listed/page.js (19:13)",
"<FIXME-file-protocol>",
"runInternalIgnored internal-pkg/ignored.ts (6:10)",
"runWithExternalSourceMapped app/ssr-error-log-ignore-listed/page.js (18:29)",
"<FIXME-file-protocol>",
"runWithExternal app/ssr-error-log-ignore-listed/page.js (17:32)",
"runWithInternalSourceMapped app/ssr-error-log-ignore-listed/page.js (16:18)",
"<FIXME-file-protocol>",
"runInternalSourceMapped internal-pkg/sourcemapped.ts (5:10)",
"runWithInternal app/ssr-error-log-ignore-listed/page.js (15:28)",
"runInternal internal-pkg/index.js (2:10)",
"Page app/ssr-error-log-ignore-listed/page.js (14:14)",
......@@ -266,8 +264,7 @@ describe('app-dir - server source maps', () => {
'\n at runWithExternal (app/rsc-error-log-ignore-listed/page.js:16:32)' +
'\n at runWithInternalSourceMapped (app/rsc-error-log-ignore-listed/page.js:15:18)' +
// Realpath does not point into node_modules so we don't ignore it.
// TODO(veil): Should be internal-pkg/sourcemapped.ts
'\n at runInternalSourceMapped (sourcemapped.ts:5:10)' +
'\n at runInternalSourceMapped (internal-pkg/sourcemapped.ts:5:10)' +
'\n at runWithInternal (app/rsc-error-log-ignore-listed/page.js:14:28)' +
// Realpath does not point into node_modules so we don't ignore it.
'\n at runInternal (internal-pkg/index.js:2:10)' +
......@@ -398,9 +395,8 @@ describe('app-dir - server source maps', () => {
// Node.js is fine with invalid URLs in index maps apparently.
'' +
'\nError: bad-sourcemap' +
'\n at logError (custom://[badhost]/app/bad-sourcemap/page.js:6:17)' +
'\n at Page (custom://[badhost]/app/bad-sourcemap/page.js:10:3)' +
// TODO: Remove blank line
'\n at logError (app/bad-sourcemap/custom:/[badhost]/app/bad-sourcemap/page.js:6:17)' +
'\n at Page (app/bad-sourcemap/custom:/[badhost]/app/bad-sourcemap/page.js:10:3)' +
'\n'
)
} else {
......@@ -704,7 +700,6 @@ describe('app-dir - server source maps', () => {
const browser = await next.browser('/ssr-anonymous-stack-frame-sandwich')
if (isTurbopack) {
// TODO(veil): https://linear.app/vercel/issue/NEXT-4410/
await expect(browser).toDisplayCollapsedRedbox(`
[
{
......@@ -715,13 +710,6 @@ describe('app-dir - server source maps', () => {
> 6 | runHiddenSetOfSetsExternal('ssr-anonymous-stack-frame-sandwich: external')
| ^",
"stack": [
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"Set.forEach <anonymous>",
"<FIXME-file-protocol>",
"Set.forEach <anonymous>",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"Page app/ssr-anonymous-stack-frame-sandwich/page.js (6:29)",
],
},
......@@ -729,17 +717,15 @@ describe('app-dir - server source maps', () => {
"description": "ignore-listed frames",
"environmentLabel": null,
"label": "Console Error",
"source": "app/ssr-anonymous-stack-frame-sandwich/page.js (7:29) @ Page
> 7 | runHiddenSetOfSetsInternal('ssr-anonymous-stack-frame-sandwich: internal')
| ^",
"source": "internal-pkg/sourcemapped.ts (9:13) @ runSetOfSets",
"stack": [
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"<unknown> internal-pkg/sourcemapped.ts (18:43)",
"<unknown> internal-pkg/sourcemapped.ts (11:7)",
"Set.forEach <anonymous>",
"<FIXME-file-protocol>",
"<unknown> internal-pkg/sourcemapped.ts (10:9)",
"Set.forEach <anonymous>",
"<FIXME-file-protocol>",
"<FIXME-file-protocol>",
"runSetOfSets internal-pkg/sourcemapped.ts (9:13)",
"runHiddenSetOfSets internal-pkg/sourcemapped.ts (17:3)",
"Page app/ssr-anonymous-stack-frame-sandwich/page.js (7:29)",
],
},
......
......@@ -106,21 +106,7 @@ describe.each(['default', 'babelrc'] as const)(
// Just make sure this is the heuristic from the React Compiler not something else.
'Page[useEffect()]'
if (isNextDev) {
if (isTurbopack) {
// FIXME: https://linear.app/vercel/issue/NAR-351
await expect(browser).toDisplayCollapsedRedbox(`
{
"description": "test-top-frame",
"environmentLabel": null,
"label": "Console Error",
"source": null,
"stack": [
"<FIXME-file-protocol>",
],
}
`)
} else {
await expect(browser).toDisplayCollapsedRedbox(`
await expect(browser).toDisplayCollapsedRedbox(`
{
"description": "test-top-frame",
"environmentLabel": null,
......@@ -133,7 +119,6 @@ describe.each(['default', 'babelrc'] as const)(
],
}
`)
}
// We care more about the sourcemapped frame in the Redbox.
// This assertion is only here to show that the negative assertion below is valid.
expect(normalizeCodeLocInfo(callFrame)).toEqual(
......
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
#![feature(btree_cursors)] // needed for the `InvalidatorMap` and watcher, reduces time complexity
#![feature(trivial_bounds)]
#![feature(min_specialization)]
#![feature(iter_advance_by)]
#![feature(io_error_more)]
#![feature(arbitrary_self_types)]
#![feature(arbitrary_self_types_pointers)]
#![feature(btree_cursors)] // needed for the `InvalidatorMap` and watcher, reduces time complexity
#![feature(io_error_more)]
#![feature(iter_advance_by)]
#![feature(min_specialization)]
// if `normalize_lexically` isn't eventually stabilized, we can copy the implementation from the
// stdlib into our source tree
#![feature(normalize_lexically)]
#![feature(trivial_bounds)]
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
#![allow(clippy::mutable_key_type)]
pub mod attach;
......@@ -250,6 +253,7 @@ struct DiskFileSystemInner {
impl DiskFileSystemInner {
/// Returns the root as Path
fn root_path(&self) -> &Path {
// just in case there's a windows unc path prefix we remove it with `dunce`
simplified(Path::new(&*self.root))
}
......@@ -460,8 +464,54 @@ impl DiskFileSystem {
self.inner.watcher.stop_watching();
}
/// Try to convert [`Path`] to [`FileSystemPath`]. Return `None` if the file path leaves the
/// filesystem root. If no `relative_to` argument is given, it is assumed that the `sys_path` is
/// relative to the [`DiskFileSystem`] root.
///
/// Attempts to convert absolute paths to paths relative to the filesystem root, though we only
/// attempt to do so lexically.
///
/// Assumes `self` is the `DiskFileSystem` contained in `vc_self`. This API is a bit awkward
/// because:
/// - [`Path`]/[`PathBuf`] should not be stored in the persistent cache, so the function cannot
/// be a [`turbo_tasks::function`].
/// - It's a little convenient for this function to be sync.
pub fn try_from_sys_path(
&self,
vc_self: ResolvedVc<DiskFileSystem>,
sys_path: &Path,
relative_to: Option<&FileSystemPath>,
) -> Option<FileSystemPath> {
let vc_self = ResolvedVc::upcast(vc_self);
let sys_path = simplified(sys_path);
let relative_sys_path = if sys_path.is_absolute() {
// `normalize_lexically` will return an error if the relative `sys_path` leaves the
// DiskFileSystem root
let normalized_sys_path = sys_path.normalize_lexically().ok()?;
normalized_sys_path
.strip_prefix(self.inner.root_path())
.ok()?
.to_owned()
} else if let Some(relative_to) = relative_to {
debug_assert_eq!(
relative_to.fs, vc_self,
"`relative_to.fs` must match the current `ResolvedVc<DiskFileSystem>`"
);
let mut joined_sys_path = PathBuf::from(unix_to_sys(&relative_to.path).into_owned());
joined_sys_path.push(sys_path);
joined_sys_path.normalize_lexically().ok()?
} else {
sys_path.normalize_lexically().ok()?
};
Some(FileSystemPath {
fs: vc_self,
path: RcStr::from(sys_to_unix(relative_sys_path.to_str()?)),
})
}
pub fn to_sys_path(&self, fs_path: FileSystemPath) -> Result<PathBuf> {
// just in case there's a windows unc path prefix we remove it with `dunce`
let path = self.inner.root_path();
Ok(if fs_path.path.is_empty() {
path.to_path_buf()
......@@ -2465,6 +2515,7 @@ async fn realpath_with_links(path: FileSystemPath) -> Result<Vc<RealPathResult>>
#[cfg(test)]
mod tests {
use turbo_rcstr::rcstr;
use turbo_tasks_backend::{BackendOptions, TurboTasksBackend, noop_backing_storage};
use super::*;
......@@ -2546,4 +2597,103 @@ mod tests {
.await
.unwrap()
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_try_from_sys_path() {
let sys_root = if cfg!(windows) {
Path::new(r"C:\fake\root")
} else {
Path::new(r"/fake/root")
};
let tt = turbo_tasks::TurboTasks::new(TurboTasksBackend::new(
BackendOptions::default(),
noop_backing_storage(),
));
tt.run_once(async {
let fs_vc =
DiskFileSystem::new(rcstr!("temp"), RcStr::from(sys_root.to_str().unwrap()))
.to_resolved()
.await?;
let fs = fs_vc.await?;
let fs_root_path = fs_vc.root().await?;
assert_eq!(
fs.try_from_sys_path(
fs_vc,
&Path::new("relative").join("directory"),
/* relative_to */ None,
)
.unwrap()
.path,
"relative/directory"
);
assert_eq!(
fs.try_from_sys_path(
fs_vc,
&sys_root
.join("absolute")
.join("directory")
.join("..")
.join("normalized_path"),
/* relative_to */ Some(&fs_root_path.join("ignored").unwrap()),
)
.unwrap()
.path,
"absolute/normalized_path"
);
assert_eq!(
fs.try_from_sys_path(
fs_vc,
Path::new("child"),
/* relative_to */ Some(&fs_root_path.join("parent").unwrap()),
)
.unwrap()
.path,
"parent/child"
);
assert_eq!(
fs.try_from_sys_path(
fs_vc,
&Path::new("..").join("parallel_dir"),
/* relative_to */ Some(&fs_root_path.join("parent").unwrap()),
)
.unwrap()
.path,
"parallel_dir"
);
assert_eq!(
fs.try_from_sys_path(
fs_vc,
&Path::new("relative")
.join("..")
.join("..")
.join("leaves_root"),
/* relative_to */ None,
),
None
);
assert_eq!(
fs.try_from_sys_path(
fs_vc,
&sys_root
.join("absolute")
.join("..")
.join("..")
.join("leaves_root"),
/* relative_to */ None,
),
None
);
anyhow::Ok(())
})
.await
.unwrap();
}
}
......@@ -234,7 +234,6 @@ pub mod tests {
collections::HashMap,
fs::{File, create_dir},
io::prelude::*,
os::unix::fs::symlink,
};
use turbo_rcstr::{RcStr, rcstr};
......@@ -317,6 +316,8 @@ pub mod tests {
#[cfg(unix)]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn read_glob_symlinks() {
use std::os::unix::fs::symlink;
let scratch = tempfile::tempdir().unwrap();
{
// root.js
......
......@@ -17,6 +17,7 @@ anyhow = { workspace = true }
async-trait = { workspace = true }
auto-hash-map = { workspace = true }
browserslist-rs = { workspace = true }
bytes-str = { workspace = true }
const_format = { workspace = true }
data-encoding = { workspace = true }
either = { workspace = true }
......@@ -42,8 +43,8 @@ turbo-tasks-env = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-hash = { workspace = true }
turbo-unix-path = { workspace = true }
url = { workspace = true }
urlencoding = { workspace = true }
bytes-str = { workspace = true }
[dev-dependencies]
......
......@@ -2,6 +2,6 @@
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"file":"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.js","sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.ts"],"sourceRoot":"","sourcesContent":["// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext\n// tsc compile errors can be ignored\ntype Fn<T> = () => T\nexport function runExternalSourceMapped<T>(fn: Fn<T>): T {\n return fn()\n}\n"],"names":[],"mappings":";;;;AAGM,SAAU,uBAAuB,CAAI,EAAS;IAClD,OAAO,EAAE,EAAE,CAAA;AACb,CAAC"}},
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"file":"turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.js","sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/sourcemapped.ts"],"sourcesContent":["// Compile with pnpm tsc turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map-merged/input/sourcemapped.ts --sourceMap --inlineSources --target esnext\n// tsc compile errors can be ignored\ntype Fn<T> = () => T\nexport function runExternalSourceMapped<T>(fn: Fn<T>): T {\n return fn()\n}\n"],"names":[],"mappings":";;;;AAGM,SAAU,uBAAuB,CAAI,EAAS;IAClD,OAAO,EAAE,EAAE,CAAA;AACb,CAAC"}},
{"offset": {"line": 15, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/source_maps/input-source-map/input/index.js"],"sourcesContent":["import { runExternalSourceMapped } from './sourcemapped.js'\n\nrunExternalSourceMapped()\n"],"names":[],"mappings":";AAAA;;AAEA,IAAA,qPAAuB"}}]
}
\ No newline at end of file
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