-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 windows next tests in ci #11050
Closed
Closed
fix windows next tests in ci #11050
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4046760
progress
dylan-conway 52127b1
Merge branch 'main' into dylan/maybe-fix-next-tests
dylan-conway 763b4b5
test
dylan-conway b430254
Merge branch 'main' into dylan/maybe-fix-next-tests
Jarred-Sumner 44fd560
Apply formatting changes
Jarred-Sumner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1160,16 +1160,19 @@ pub const Resolver = struct { | |
// Treating these paths as absolute paths on all platforms means Windows | ||
// users will not be able to accidentally make use of these paths. | ||
if (std.fs.path.isAbsolute(import_path)) { | ||
var normalizer = ResolvePath.PosixToWinNormalizer{}; | ||
const abs_import_path = normalizer.resolve(source_dir, import_path); | ||
|
||
if (r.debug_logs) |*debug| { | ||
debug.addNoteFmt("The import \"{s}\" is being treated as an absolute path", .{import_path}); | ||
debug.addNoteFmt("The import \"{s}\" is being treated as an absolute path", .{abs_import_path}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should print the user-provided path. though, we dont really show this anywhere. (i could never get the debug messages to work) |
||
} | ||
|
||
// First, check path overrides from the nearest enclosing TypeScript "tsconfig.json" file | ||
if ((r.dirInfoCached(source_dir) catch null)) |_dir_info| { | ||
const dir_info: *DirInfo = _dir_info; | ||
if (dir_info.enclosing_tsconfig_json) |tsconfig| { | ||
if (tsconfig.paths.count() > 0) { | ||
if (r.matchTSConfigPaths(tsconfig, import_path, kind)) |res| { | ||
if (r.matchTSConfigPaths(tsconfig, abs_import_path, kind)) |res| { | ||
|
||
// We don't set the directory fd here because it might remap an entirely different directory | ||
return .{ | ||
|
@@ -1187,26 +1190,25 @@ pub const Resolver = struct { | |
} | ||
} | ||
|
||
if (r.opts.external.abs_paths.count() > 0 and r.opts.external.abs_paths.contains(import_path)) { | ||
if (r.opts.external.abs_paths.count() > 0 and r.opts.external.abs_paths.contains(abs_import_path)) { | ||
// If the string literal in the source text is an absolute path and has | ||
// been marked as an external module, mark it as *not* an absolute path. | ||
// That way we preserve the literal text in the output and don't generate | ||
// a relative path from the output directory to that path. | ||
if (r.debug_logs) |*debug| { | ||
debug.addNoteFmt("The path \"{s}\" is marked as external by the user", .{import_path}); | ||
debug.addNoteFmt("The path \"{s}\" is marked as external by the user", .{abs_import_path}); | ||
} | ||
|
||
return .{ | ||
.success = Result{ | ||
.path_pair = .{ .primary = Path.init(import_path) }, | ||
.path_pair = .{ .primary = Path.init(abs_import_path) }, | ||
.is_external = true, | ||
}, | ||
}; | ||
} | ||
|
||
// Run node's resolution rules (e.g. adding ".js") | ||
var normalizer = ResolvePath.PosixToWinNormalizer{}; | ||
if (r.loadAsFileOrDirectory(normalizer.resolve(source_dir, import_path), kind)) |entry| { | ||
if (r.loadAsFileOrDirectory(abs_import_path, kind)) |entry| { | ||
return .{ | ||
.success = Result{ | ||
.dirname_fd = entry.dirname_fd, | ||
|
@@ -1230,7 +1232,10 @@ pub const Resolver = struct { | |
|
||
if (check_relative) { | ||
const parts = [_]string{ source_dir, import_path }; | ||
const abs_path = r.fs.absBuf(&parts, bufs(.relative_abs_path)); | ||
const joined = r.fs.absBufZ(&parts, bufs(.relative_abs_path)); | ||
const abs_path: []u8 = ResolvePath.PosixToWinNormalizer.ensureLongPath(bufs(.relative_abs_path), joined); | ||
// var normalizer = ResolvePath.PosixToWinNormalizer{}; | ||
// const abs_path = normalizer.resolve(source_dir, joined); | ||
|
||
if (r.opts.external.abs_paths.count() > 0 and r.opts.external.abs_paths.contains(abs_path)) { | ||
// If the string literal in the source text is an absolute path and has | ||
|
@@ -2437,7 +2442,9 @@ pub const Resolver = struct { | |
return r.loadNodeModules(import_path, kind, source_dir_info, global_cache, false); | ||
} else { | ||
const paths = [_]string{ source_dir_info.abs_path, import_path }; | ||
const resolved = r.fs.absBuf(&paths, bufs(.resolve_without_remapping)); | ||
const joined = r.fs.absBuf(&paths, bufs(.resolve_without_remapping)); | ||
var normalizer = ResolvePath.PosixToWinNormalizer{}; | ||
const resolved = normalizer.resolve(source_dir_info.abs_path, joined); | ||
if (r.loadAsFileOrDirectory(resolved, kind)) |result| { | ||
return .{ .success = result }; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports.foo = "bar"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's only do this if the file path contains
~{0-9}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we should never use the
A
version of functions