Skip to content

Commit 4aebac6

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/breakpoint-tool-paths
2 parents a992483 + 528ca82 commit 4aebac6

File tree

6 files changed

+51
-27
lines changed

6 files changed

+51
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
66

77
- feat: make Deno easier to configure
88
- fix: path display issues in breakpoint diagnostic tool ([#1343](https://github.com/microsoft/vscode-js-debug/issues/1343))
9+
- fix: improve breakpoint resolution in webpack HMR ([vscode#155331](https://github.com/microsoft/vscode/issues/155331))
910
- fix: allow overriding resolution of workspaceFolder in pathMapping ([#1308](https://github.com/microsoft/vscode-js-debug/issues/1308))
1011
- fix: extraneous warnings when restarting debugging ([vscode#156432](https://github.com/microsoft/vscode/issues/156432))
1112
- fix: webview debugging ([#1344](https://github.com/microsoft/vscode-js-debug/issues/1344))

src/adapter/sources.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ export type SourceMapTimeouts = {
102102
output: number;
103103
};
104104

105+
/** Gets whether the URL is a compiled source containing a webpack HMR */
106+
const isWebpackHMR = (url: string) => url.endsWith('.hot-update.js');
107+
105108
const defaultTimeouts: SourceMapTimeouts = {
106109
load: 0,
107110
resolveLocation: 2000,
@@ -1033,6 +1036,9 @@ export class SourceContainer {
10331036
this._sourceByReference.delete(source.sourceReference);
10341037
if (source instanceof SourceFromMap) {
10351038
this._sourceMapSourcesByUrl.delete(source.url);
1039+
for (const [compiled, key] of source.compiledToSourceUrl) {
1040+
compiled.sourceMap.sourceByUrl.delete(key);
1041+
}
10361042
}
10371043

10381044
this._sourceByAbsolutePath.delete(source.absolutePath);
@@ -1082,9 +1088,15 @@ export class SourceContainer {
10821088

10831089
const existing = this._sourceMapSourcesByUrl.get(resolvedUrl);
10841090
if (existing) {
1085-
existing.compiledToSourceUrl.set(compiled, url);
1086-
compiled.sourceMap.sourceByUrl.set(url, existing);
1087-
continue;
1091+
// In the case of a Webpack HMR, remove the old source entirely and
1092+
// replace it with the new one.
1093+
if (isWebpackHMR(compiled.url)) {
1094+
this.removeSource(existing);
1095+
} else {
1096+
existing.compiledToSourceUrl.set(compiled, url);
1097+
compiled.sourceMap.sourceByUrl.set(url, existing);
1098+
continue;
1099+
}
10881100
}
10891101

10901102
this.logger.verbose(LogTag.RuntimeSourceCreate, 'Creating source from source map', {
@@ -1126,7 +1138,10 @@ export class SourceContainer {
11261138
private _removeSourceMapSources(compiled: ISourceWithMap, map: SourceMap, silent: boolean) {
11271139
for (const url of map.sources) {
11281140
const source = compiled.sourceMap.sourceByUrl.get(url);
1129-
if (!this.logger.assert(source, `Unknown source ${url} in removeSourceMapSources`)) {
1141+
if (!source) {
1142+
// Previously, we would have always expected the source to exist here.
1143+
// However, with webpack HMR, we can unload sources that get replaced,
1144+
// so replaced sources will no longer exist in the map.
11301145
continue;
11311146
}
11321147

src/common/urlUtils.test.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,35 +64,41 @@ describe('urlUtils', () => {
6464
after(() => resetCaseSensitivePaths());
6565

6666
it('works for a simple posix path', () => {
67-
testUrlToRegex('file:///a/b.js', 'file:\\/\\/\\/a\\/b\\.js|\\/a\\/b\\.js');
67+
testUrlToRegex('file:///a/b.js', 'file:\\/\\/\\/a\\/b\\.js($|\\?)|\\/a\\/b\\.js($|\\?)');
6868
});
6969

7070
it('works for a simple windows path', () => {
71-
testUrlToRegex('file:///c:/a/b.js', 'file:\\/\\/\\/[Cc]:\\/a\\/b\\.js|[Cc]:\\\\a\\\\b\\.js');
71+
testUrlToRegex(
72+
'file:///c:/a/b.js',
73+
'file:\\/\\/\\/[Cc]:\\/a\\/b\\.js($|\\?)|[Cc]:\\\\a\\\\b\\.js($|\\?)',
74+
);
7275
});
7376

7477
it('works for a url', () => {
75-
testUrlToRegex('http://localhost:8080/a/b.js', 'http:\\/\\/localhost:8080\\/a\\/b\\.js');
78+
testUrlToRegex(
79+
'http://localhost:8080/a/b.js',
80+
'http:\\/\\/localhost:8080\\/a\\/b\\.js($|\\?)',
81+
);
7682
});
7783

7884
it('space in path', () => {
7985
testUrlToRegex(
8086
'file:///a/space%20path.js',
81-
'file:\\/\\/\\/a\\/space(?: |%20)path\\.js|\\/a\\/space(?: |%20)path\\.js',
87+
'file:\\/\\/\\/a\\/space(?: |%20)path\\.js($|\\?)|\\/a\\/space(?: |%20)path\\.js($|\\?)',
8288
);
8389
});
8490
it('preserves high unicode (#496)', () => {
8591
testUrlToRegex(
8692
'file:///c:/foo/%E2%91%A0%E2%85%AB%E3%84%A8%E3%84%A9%20%E5%95%8A%E9%98%BF%E9%BC%BE%E9%BD%84%E4%B8%82%E4%B8%84%E7%8B%9A%E7%8B%9B%E7%8B%9C%E7%8B%9D%EF%A8%A8%EF%A8%A9%CB%8A%CB%8B%CB%99%E2%80%93%E2%BF%BB%E3%80%87%E3%90%80%E3%90%81%E4%B6%B4%E4%B6%B5U1[%EE%80%A5%EE%80%A6%EE%80%A7%EE%80%B8%EE%80%B9]U2[%EE%89%9A%EE%89%9B%EE%89%AC%EE%89%AD]U3[%EE%93%BE%EE%93%BF%EE%94%80%EE%94%8B%EE%94%8C].js',
87-
'file:\\/\\/\\/[Cc]:\\/foo\\/(?:①|%E2%91%A0)(?:Ⅻ|%E2%85%AB)(?:ㄨ|%E3%84%A8)(?:ㄩ|%E3%84%A9)(?: |%20)(?:啊|%E5%95%8A)(?:阿|%E9%98%BF)(?:鼾|%E9%BC%BE)(?:齄|%E9%BD%84)(?:丂|%E4%B8%82)(?:丄|%E4%B8%84)(?:狚|%E7%8B%9A)(?:狛|%E7%8B%9B)(?:狜|%E7%8B%9C)(?:狝|%E7%8B%9D)(?:﨨|%EF%A8%A8)(?:﨩|%EF%A8%A9)(?:ˊ|%CB%8A)(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EF%A8%A8)(?:﨩|%EF%A8%A9)(?:ˊ|%CB%8A)(?:ˋ|%CB%8B)(?:˙|%CB%99)(?:–|%E2%80%93)(?:⿻|%E2%BF%BB)(?:〇|%E3%80%87)(?:㐀|%E3%90%80)(?:㐁|%E3%90%81)(?:䶴|%E4%B6%B4)(?:䶵|%E4%B6%B5)U1(?:\\[|%5B)(?:|%EE%80%A5)(?:|%EE%80%A6)(?:|%EE%80%A7)(?:|%EE%80%B8)(?:|%EE%80%B9)(?:\\]|%5D)U2(?:\\[|%5B)(?:|%EE%89%9A)(?:|%EE%89%9B)(?:|%EE%89%AC)(?:|%EE%89%AD)(?:\\]|%5D)U3(?:\\[|%5B)(?:|%EE%93%BE)(?:|%EE%93%BF)(?:|%EE%94%80)(?:|%EE%94%8B)(?:|%EE%94%8C)(?:\\]|%5D)\\.js($|\\?)',
8894
);
8995
});
9096

9197
it('works with a pre-escaped suffix', () => {
9298
const url = 'file:///foo';
9399
const escapedRe = '\\/?($|index(\\.html)?)';
94100
expect(urlToRegex(`${url}${escapedRe}`, [0, url.length])).to.equal(
95-
'file:\\/\\/\\/foo\\/?($|index(\\.html)?)|\\/foo\\/?($|index(\\.html)?)',
101+
'file:\\/\\/\\/foo\\/?($|index(\\.html)?)($|\\?)|\\/foo\\/?($|index(\\.html)?)($|\\?)',
96102
);
97103
});
98104

@@ -101,7 +107,7 @@ describe('urlUtils', () => {
101107
const wildcardHostname = 'https?:\\/\\/[^\\/]+\\/';
102108
const url = `${wildcardHostname}${path}`;
103109
expect(urlToRegex(url, [wildcardHostname.length, url.length])).to.equal(
104-
'https?:\\/\\/[^\\/]+\\/foo',
110+
'https?:\\/\\/[^\\/]+\\/foo($|\\?)',
105111
);
106112
});
107113
});
@@ -113,42 +119,42 @@ describe('urlUtils', () => {
113119
it('works for a simple posix path', () => {
114120
testUrlToRegex(
115121
'file:///a/b.js',
116-
'[fF][iI][lL][eE]:\\/\\/\\/[aA]\\/[bB]\\.[jJ][sS]|\\/[aA]\\/[bB]\\.[jJ][sS]',
122+
'[fF][iI][lL][eE]:\\/\\/\\/[aA]\\/[bB]\\.[jJ][sS]($|\\?)|\\/[aA]\\/[bB]\\.[jJ][sS]($|\\?)',
117123
);
118124
});
119125

120126
it('works for a simple windows path', () => {
121127
testUrlToRegex(
122128
'file:///c:/a/b.js',
123-
'[fF][iI][lL][eE]:\\/\\/\\/[cC]:\\/[aA]\\/[bB]\\.[jJ][sS]|[cC]:\\\\[aA]\\\\[bB]\\.[jJ][sS]',
129+
'[fF][iI][lL][eE]:\\/\\/\\/[cC]:\\/[aA]\\/[bB]\\.[jJ][sS]($|\\?)|[cC]:\\\\[aA]\\\\[bB]\\.[jJ][sS]($|\\?)',
124130
);
125131
});
126132

127133
it('works for a url', () => {
128134
testUrlToRegex(
129135
'http://localhost:8080/a/b.js',
130-
'[hH][tT][tT][pP]:\\/\\/[lL][oO][cC][aA][lL][hH][oO][sS][tT]:8080\\/[aA]\\/[bB]\\.[jJ][sS]',
136+
'[hH][tT][tT][pP]:\\/\\/[lL][oO][cC][aA][lL][hH][oO][sS][tT]:8080\\/[aA]\\/[bB]\\.[jJ][sS]($|\\?)',
131137
);
132138
});
133139

134140
it('escapes component entities (#1174)', () => {
135141
testUrlToRegex(
136142
'file:///%23a/b.js',
137-
'[fF][iI][lL][eE]:\\/\\/\\/(?:#|%23)[aA]\\/[bB]\\.[jJ][sS]|\\/(?:#|%23)[aA]\\/[bB]\\.[jJ][sS]',
143+
'[fF][iI][lL][eE]:\\/\\/\\/(?:#|%23)[aA]\\/[bB]\\.[jJ][sS]($|\\?)|\\/(?:#|%23)[aA]\\/[bB]\\.[jJ][sS]($|\\?)',
138144
);
139145
});
140146

141147
it('space in path', () => {
142148
testUrlToRegex(
143149
'file:///a/space%20path.js',
144-
'[fF][iI][lL][eE]:\\/\\/\\/[aA]\\/[sS][pP][aA][cC][eE](?: |%20)[pP][aA][tT][hH]\\.[jJ][sS]|\\/[aA]\\/[sS][pP][aA][cC][eE](?: |%20)[pP][aA][tT][hH]\\.[jJ][sS]',
150+
'[fF][iI][lL][eE]:\\/\\/\\/[aA]\\/[sS][pP][aA][cC][eE](?: |%20)[pP][aA][tT][hH]\\.[jJ][sS]($|\\?)|\\/[aA]\\/[sS][pP][aA][cC][eE](?: |%20)[pP][aA][tT][hH]\\.[jJ][sS]($|\\?)',
145151
);
146152
});
147153

148154
it('preserves high unicode (#496)', () => {
149155
testUrlToRegex(
150156
'file:///c:/foo/%E2%91%A0%E2%85%AB%E3%84%A8%E3%84%A9%20%E5%95%8A%E9%98%BF%E9%BC%BE%E9%BD%84%E4%B8%82%E4%B8%84%E7%8B%9A%E7%8B%9B%E7%8B%9C%E7%8B%9D%EF%A8%A8%EF%A8%A9%CB%8A%CB%8B%CB%99%E2%80%93%E2%BF%BB%E3%80%87%E3%90%80%E3%90%81%E4%B6%B4%E4%B6%B5U1[%EE%80%A5%EE%80%A6%EE%80%A7%EE%80%B8%EE%80%B9]U2[%EE%89%9A%EE%89%9B%EE%89%AC%EE%89%AD]U3[%EE%93%BE%EE%93%BF%EE%94%80%EE%94%8B%EE%94%8C].js',
151-
'[fF][iI][lL][eE]:\\/\\/\\/[cC]:\\/[fF][oO][oO]\\/(?:①|%E2%91%A0)(?:ⅻ|%E2%85%BB|Ⅻ|%E2%85%AB)(?:ㄨ|%E3%84%A8)(?:ㄩ|%E3%84%A9)(?: |%20)(?:啊|%E5%95%8A)(?:阿|%E9%98%BF)(?:鼾|%E9%BC%BE)(?:齄|%E9%BD%84)(?:丂|%E4%B8%82)(?:丄|%E4%B8%84)(?:狚|%E7%8B%9A)(?:狛|%E7%8B%9B)(?:狜|%E7%8B%9C)(?:狝|%E7%8B%9D)(?:﨨|%EF%A8%A8)(?:﨩|%EF%A8%A9)(?:ˊ|%CB%8A)(?:ˋ|%CB%8B)(?:˙|%CB%99)(?:–|%E2%80%93)(?:⿻|%E2%BF%BB)(?:〇|%E3%80%87)(?:㐀|%E3%90%80)(?:㐁|%E3%90%81)(?:䶴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|%E7%8B%9D)(?:﨨|%EF%A8%A8)(?:﨩|%EF%A8%A9)(?:ˊ|%CB%8A)(?:ˋ|%CB%8B)(?:˙|%CB%99)(?:–|%E2%80%93)(?:⿻|%E2%BF%BB)(?:〇|%E3%80%87)(?:㐀|%E3%90%80)(?:㐁|%E3%90%81)(?:䶴|%E4%B6%B4)(?:䶵|%E4%B6%B5)[uU]1(?:\\[|%5B)(?:|%EE%80%A5)(?:|%EE%80%A6)(?:|%EE%80%A7)(?:|%EE%80%B8)(?:|%EE%80%B9)(?:\\]|%5D)[uU]2(?:\\[|%5B)(?:|%EE%89%9A)(?:|%EE%89%9B)(?:|%EE%89%AC)(?:|%EE%89%AD)(?:\\]|%5D)[uU]3(?:\\[|%5B)(?:|%EE%93%BE)(?:|%EE%93%BF)(?:|%EE%94%80)(?:|%EE%94%8B)(?:|%EE%94%8C)(?:\\]|%5D)\\.[jJ][sS]($|\\?)',
152158
);
153159
});
154160
});

src/common/urlUtils.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,12 @@ export function urlToRegex(
407407
// fancy regex above), replace `file:///c:/` or simple `c:/` patterns with
408408
// an insensitive drive letter.
409409
patterns.push(
410-
`${rePrefix}${re}${reSuffix}`.replace(
411-
/^(file:\\\/\\\/\\\/)?([a-z]):/i,
412-
(_, file = '', letter) => `${file}[${letter.toUpperCase()}${letter.toLowerCase()}]:`,
413-
),
410+
`${rePrefix}${re}${reSuffix}`
411+
.replace(
412+
/^(file:\\\/\\\/\\\/)?([a-z]):/i,
413+
(_, file = '', letter) => `${file}[${letter.toUpperCase()}${letter.toLowerCase()}]:`,
414+
)
415+
.concat('($|\\?)'),
414416
);
415417
}
416418

src/targets/browser/browserPathResolver.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ describe('BrowserPathResolver', () => {
204204
const filePath = path.join(testFixturesDir, 'web', 'foo.js');
205205
expect(resolver({ baseUrl: undefined }).absolutePathToUrlRegexp(filePath)).to.equal(
206206
urlToRegex(absolutePathToFileUrl(filePath)) +
207-
'|[hH][tT][tT][pP][sS]?:\\/\\/[^\\/]+\\/[fF][oO][oO]\\.[jJ][sS]',
207+
'|[hH][tT][tT][pP][sS]?:\\/\\/[^\\/]+\\/[fF][oO][oO]\\.[jJ][sS]($|\\?)',
208208
);
209209
});
210210

src/test/browser/blazorSourcePathResolverTest.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ describe('BlazorSourcePathResolver.absolutePathToUrlRegexp', () => {
5555

5656
if (getCaseSensitivePaths()) {
5757
expect(regexp).to.equal(
58-
'file:\\/\\/\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor' +
59-
'|\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor',
58+
'file:\\/\\/\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor($|\\?)' +
59+
'|\\/c\\/Users\\/digeff\\/source\\/repos\\/MyBlazorApp\\/MyBlazorApp\\/Pages\\/Counter\\.razor($|\\?)',
6060
);
6161
} else {
6262
// This regexp was generated from running the real scenario, verifying that the breakpoint with this regexp works, and then copying it here
6363
expect(regexp).to.equal(
6464
'[fF][iI][lL][eE]:\\/\\/\\/[cC]:\\/[uU][sS][eE][rR][sS]\\/[dD][iI][gG][eE][fF][fF]\\/[sS][oO][uU][rR][cC][eE]\\/' +
6565
'[rR][eE][pP][oO][sS]\\/[mM][yY][bB][lL][aA][zZ][oO][rR][aA][pP][pP]\\/[mM][yY][bB][lL][aA][zZ][oO][rR][aA][pP][pP]\\/' +
66-
'[pP][aA][gG][eE][sS]\\/[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]|[cC]:\\\\[uU][sS][eE][rR][sS]\\\\[dD][iI][gG][eE][fF][fF]\\\\' +
66+
'[pP][aA][gG][eE][sS]\\/[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]($|\\?)|[cC]:\\\\[uU][sS][eE][rR][sS]\\\\[dD][iI][gG][eE][fF][fF]\\\\' +
6767
'[sS][oO][uU][rR][cC][eE]\\\\[rR][eE][pP][oO][sS]\\\\[mM][yY][bB][lL][aA][zZ][oO][rR][aA][pP][pP]\\\\[mM][yY][bB][lL][aA][zZ][oO][rR][aA][pP][pP]\\\\' +
68-
'[pP][aA][gG][eE][sS]\\\\[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]',
68+
'[pP][aA][gG][eE][sS]\\\\[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]($|\\?)',
6969
);
7070
}
7171
});
@@ -92,7 +92,7 @@ describe('BlazorSourcePathResolver.absolutePathToUrlRegexp', () => {
9292
// This regexp was generated from running the real scenario, verifying that the breakpoint with this regexp works, and then copying it here
9393
expect(regexp).to.equal(
9494
'dotnet://.*\\.dll/[cC]\\/[wW][oO][rR][kK][sS][pP][aA][cC][eE]\\/[nN][eE][wW][bB][lL][aA][zZ][oO][rR][wW][aA][sS][mM]\\/' +
95-
'[nN][eE][wW][bB][lL][aA][zZ][oO][rR][wW][aA][sS][mM]\\/[pP][aA][gG][eE][sS]\\/[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]',
95+
'[nN][eE][wW][bB][lL][aA][zZ][oO][rR][wW][aA][sS][mM]\\/[pP][aA][gG][eE][sS]\\/[cC][oO][uU][nN][tT][eE][rR]\\.[rR][aA][zZ][oO][rR]($|\\?)',
9696
);
9797
});
9898
}

0 commit comments

Comments
 (0)