@@ -30,13 +30,14 @@ pub fn compute_import_metadata<'a>(
3030
3131 let source = extract_source_path ( source) ;
3232 let is_style_import = is_style ( source) ;
33+ let path_kind = to_path_kind ( source, options) ;
3334
3435 // Create group matcher from import characteristics
3536 let matcher = ImportGroupMatcher {
3637 is_side_effect : * is_side_effect,
3738 is_type_import : * is_type_import,
3839 is_style_import,
39- path_kind : to_path_kind ( source ) ,
40+ path_kind,
4041 is_subpath : is_subpath ( source) ,
4142 has_default_specifier : * has_default_specifier,
4243 has_namespace_specifier : * has_namespace_specifier,
@@ -346,7 +347,7 @@ enum ImportPathKind {
346347}
347348
348349/// Determine the path kind for an import source.
349- fn to_path_kind ( source : & str ) -> ImportPathKind {
350+ fn to_path_kind ( source : & str , options : & options :: SortImports ) -> ImportPathKind {
350351 if is_builtin ( source) {
351352 return ImportPathKind :: Builtin ;
352353 }
@@ -364,8 +365,11 @@ fn to_path_kind(source: &str) -> ImportPathKind {
364365 return ImportPathKind :: Sibling ;
365366 }
366367
367- // TODO: This can be changed via `options.internalPattern`
368- if source. starts_with ( "~/" ) || source. starts_with ( "@/" ) {
368+ // Check if source matches any internal pattern
369+ if match & options. internal_pattern {
370+ Some ( patterns) => patterns. iter ( ) . any ( |p| source. starts_with ( p. as_str ( ) ) ) ,
371+ None => [ "~/" , "@/" ] . iter ( ) . any ( |p| source. starts_with ( * p) ) ,
372+ } {
369373 return ImportPathKind :: Internal ;
370374 }
371375
0 commit comments