Skip to content

Commit

Permalink
fix(turbopack): ignore underscore_started path
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Apr 25, 2023
1 parent 2f6ff0d commit 8c1a8f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/next-swc/crates/next-core/src/app_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,15 @@ async fn create_app_page_source_for_route(
fallback_page: DevHtmlAssetVc,
intermediate_output_path_root: FileSystemPathVc,
) -> Result<ContentSourceVc> {
let pathname_vc = StringVc::cell(pathname.to_string());
let pathname = pathname.to_string().replace("%5F", "_");
let pathname_vc = StringVc::cell(pathname.clone());

let params_matcher = NextParamsMatcherVc::new(pathname_vc);

let source = create_node_rendered_source(
project_path,
env,
pathname_to_specificity(pathname),
pathname_to_specificity(pathname.as_str()),
server_root,
params_matcher.into(),
pathname_vc,
Expand Down Expand Up @@ -506,14 +507,15 @@ async fn create_app_route_source_for_route(
runtime_entries: AssetsVc,
intermediate_output_path_root: FileSystemPathVc,
) -> Result<ContentSourceVc> {
let pathname_vc = StringVc::cell(pathname.to_string());
let pathname = pathname.to_string().replace("%5F", "_");
let pathname_vc = StringVc::cell(pathname.clone());

let params_matcher = NextParamsMatcherVc::new(pathname_vc);

let source = create_node_api_source(
project_path,
env,
pathname_to_specificity(pathname),
pathname_to_specificity(pathname.as_str()),
server_root,
params_matcher.into(),
pathname_vc,
Expand Down
6 changes: 6 additions & 0 deletions packages/next-swc/crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ async fn directory_tree_to_entrypoints_internal(
) -> Result<EntrypointsVc> {
let mut result = IndexMap::new();

// appDir ignores path starts with underscore
if directory_name.starts_with('_') {
return Ok(Entrypoints(result).cell());
}

let directory_tree = &*directory_tree.await?;

let subdirectories = &directory_tree.subdirectories;
Expand Down Expand Up @@ -534,6 +539,7 @@ async fn directory_tree_to_entrypoints_internal(
for (subdir_name, &subdirectory) in subdirectories.iter() {
let parallel_route_key = match_parallel_route(subdir_name);
let optional_segment = is_optional_segment(subdir_name);

let map = directory_tree_to_entrypoints_internal(
app_dir,
subdir_name,
Expand Down

0 comments on commit 8c1a8f6

Please sign in to comment.