Skip to content

Commit 9ca03f6

Browse files
committed
also add test case from #4075
1 parent 2f244c0 commit 9ca03f6

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Unreleased
44

5-
* Fix incorrect paths in inline source maps ([#4070](https://github.com/evanw/esbuild/issues/4070), [#4105](https://github.com/evanw/esbuild/issues/4105))
5+
* Fix incorrect paths in inline source maps ([#4070](https://github.com/evanw/esbuild/issues/4070), [#4075](https://github.com/evanw/esbuild/issues/4075), [#4105](https://github.com/evanw/esbuild/issues/4105))
66

77
This fixes a regression from version 0.25.0 where esbuild didn't correctly resolve relative paths contained within source maps in inline `sourceMappingURL` data URLs. The paths were incorrectly being passed through as-is instead of being resolved relative to the source file containing the `sourceMappingURL` comment, which was due to the data URL not being a file URL. This regression has been fixed, and this case now has test coverage.
88

scripts/verify-source-map.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,43 @@ const toSearchNestedFoldersIssue4070 = {
573573
'bar': 'src/app/app.config.js',
574574
}
575575

576+
const testCaseAbsolutePathIssue4075 = {
577+
'entry.css': `
578+
@import "./styles.css";
579+
@import "./styles2.css";
580+
`,
581+
'styles.css': `/* You can add global styles to this file, and also import other style files */
582+
* {
583+
content: "foo";
584+
}
585+
586+
/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,` +
587+
`%22sourceRoot%22:%22%22,%22sources%22:%5B%22file:///out/src/styles.scss` +
588+
`%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAAA;AACA;EACE,SAAS%22,%22f` +
589+
`ile%22:%22out%22,%22sourcesContent%22:%5B%22/*%20You%20can%20add%20glob` +
590+
`al%20styles%20to%20this%20file,%20and%20also%20import%20other%20style%2` +
591+
`0files%20%2A/%5Cn*%20%7B%5Cn%20%20content:%20%5C%22foo%5C%22%5Cn%7D%5Cn` +
592+
`%22%5D%7D */`,
593+
'styles2.css': `/* You can add global styles to this file, and also import other style files */
594+
* {
595+
content: "bar";
596+
}
597+
598+
/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,` +
599+
`%22sourceRoot%22:%22%22,%22sources%22:%5B%22/out/src/styles2.scss%22%5D` +
600+
`,%22names%22:%5B%5D,%22mappings%22:%22AAAA;AACA;EACE,SAAS%22,%22file%22` +
601+
`:%22out%22,%22sourcesContent%22:%5B%22/*%20You%20can%20add%20global%20s` +
602+
`tyles%20to%20this%20file,%20and%20also%20import%20other%20style%20files` +
603+
`%20%2A/%5Cn*%20%7B%5Cn%20%20content:%20%5C%22bar%5C%22%5Cn%7D%5Cn%22%5D` +
604+
`%7D */
605+
`,
606+
}
607+
608+
const toSearchAbsolutePathIssue4075 = {
609+
foo: path.relative(path.join(testDir, '(this test)'), '/out/src/styles.scss'),
610+
bar: path.relative(path.join(testDir, '(this test)'), '/out/src/styles2.scss'),
611+
}
612+
576613
const testCaseMissingSourcesIssue4104 = {
577614
'entry.js': `import { bootstrapApplication } from '@angular/platform-browser';
578615
import { AppComponent } from './app.js';
@@ -1091,6 +1128,12 @@ async function main() {
10911128
entryPoints: ['src/main.js'],
10921129
crlf,
10931130
}),
1131+
check('issue-4075' + suffix, testCaseAbsolutePathIssue4075, toSearchAbsolutePathIssue4075, {
1132+
outfile: 'out.css',
1133+
flags: flags.concat('--bundle'),
1134+
entryPoints: ['entry.css'],
1135+
crlf,
1136+
}),
10941137
check('issue-4080' + suffix, testCaseNullMappingIssue4080, toSearchNullMappingIssue4080, {
10951138
outfile: 'out.js',
10961139
flags: flags.concat('--bundle', '--format=esm'),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy