Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(turbopack): ignore underscore_started path #48792

Merged
merged 4 commits into from Apr 28, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/next-swc/crates/next-core/src/app_structure.rs
Expand Up @@ -378,8 +378,12 @@ async fn get_directory_tree(
}
}
DirectoryEntry::Directory(dir) => {
let result = get_directory_tree(dir, page_extensions);
subdirectories.insert(basename.to_string(), result);
// appDir ignores paths starting with an underscore
if !basename.starts_with('_') {
let result = get_directory_tree(dir, page_extensions);
subdirectories
.insert(get_underscore_normalized_path(basename), result);
}
}
// TODO(WEB-952) handle symlinks in app dir
_ => {}
Expand Down Expand Up @@ -694,6 +698,12 @@ async fn directory_tree_to_entrypoints_internal(
Ok(EntrypointsVc::cell(result))
}

/// ref: https://github.com/vercel/next.js/blob/c390c1662bc79e12cf7c037dcb382ef5ead6e492/packages/next/src/build/entries.ts#L119
/// if path contains %5F, replace it with _.
fn get_underscore_normalized_path(path: &str) -> String {
path.replace("%5F", "_")
}

/// Returns the global metadata for an app directory.
#[turbo_tasks::function]
pub async fn get_global_metadata(
Expand Down