fix: source map resolution in parent workspace folder paths not working (#1573)
* fix: source map resolution in parent workspace folder paths not working Fixes https://github.com/microsoft/vscode-js-debug/issues/1554#issuecomment-1420520834 * fix for auto-updated build agents
This commit is contained in:
Родитель
8d34776af0
Коммит
188f552ca9
|
@ -17,6 +17,8 @@ steps:
|
||||||
- task: Npm@1
|
- task: Npm@1
|
||||||
displayName: npm install
|
displayName: npm install
|
||||||
inputs:
|
inputs:
|
||||||
|
command: custom
|
||||||
|
customCommand: install --legacy-peer-deps
|
||||||
verbose: false
|
verbose: false
|
||||||
|
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
|
|
|
@ -23,7 +23,7 @@ extends:
|
||||||
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
|
cgIgnoreDirectories: 'testdata,demos,.vscode-test'
|
||||||
l10nShouldProcess: false
|
l10nShouldProcess: false
|
||||||
buildSteps:
|
buildSteps:
|
||||||
- script: npm install
|
- script: npm install --legacy-peer-deps
|
||||||
displayName: Install dependencies
|
displayName: Install dependencies
|
||||||
|
|
||||||
- script: npm run compile -- package:prepare --nightly
|
- script: npm run compile -- package:prepare --nightly
|
||||||
|
|
|
@ -33,7 +33,7 @@ extends:
|
||||||
ghReleaseAddChangeLog: true
|
ghReleaseAddChangeLog: true
|
||||||
l10nShouldProcess: false
|
l10nShouldProcess: false
|
||||||
buildSteps:
|
buildSteps:
|
||||||
- script: npm install
|
- script: npm install --legacy-peer-deps
|
||||||
displayName: Install dependencies
|
displayName: Install dependencies
|
||||||
|
|
||||||
- script: npm run compile -- package:prepare
|
- script: npm run compile -- package:prepare
|
||||||
|
|
|
@ -8,6 +8,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
|
||||||
- fix: don't fail on dynamic config provisioning if no package.json's exist ([vscode#172522](https://github.com/microsoft/vscode/issues/172522))
|
- fix: don't fail on dynamic config provisioning if no package.json's exist ([vscode#172522](https://github.com/microsoft/vscode/issues/172522))
|
||||||
- fix: expansion of non-primitive getters not working ([#1525](https://github.com/microsoft/vscode-js-debug/issues/1525))
|
- fix: expansion of non-primitive getters not working ([#1525](https://github.com/microsoft/vscode-js-debug/issues/1525))
|
||||||
- fix: support rich ANSI output for complex logs ([vscode#172868](https://github.com/microsoft/vscode/issues/172868))
|
- fix: support rich ANSI output for complex logs ([vscode#172868](https://github.com/microsoft/vscode/issues/172868))
|
||||||
|
- fix: source map resolution in parent workspace folder paths not working ([#1554 comment](https://github.com/microsoft/vscode-js-debug/issues/1554#issuecomment-1420520834))
|
||||||
- fix: revert support for renamed property accessors ([#1561](https://github.com/microsoft/vscode-js-debug/issues/1561))
|
- fix: revert support for renamed property accessors ([#1561](https://github.com/microsoft/vscode-js-debug/issues/1561))
|
||||||
- fix: resolveSourceMapLocations not being auto-filled for ext host debug ([#1554 comment](https://github.com/microsoft/vscode-js-debug/issues/1554#issuecomment-1420520834))
|
- fix: resolveSourceMapLocations not being auto-filled for ext host debug ([#1554 comment](https://github.com/microsoft/vscode-js-debug/issues/1554#issuecomment-1420520834))
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,10 @@ export function properRelative(fromPath: string, toPath: string): string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const splitRe = /\/|\\/;
|
||||||
|
|
||||||
|
export const properSplit = (path: string) => path.split(splitRe);
|
||||||
|
|
||||||
export function fixDriveLetter(aPath: string, uppercaseDriveLetter = false): string {
|
export function fixDriveLetter(aPath: string, uppercaseDriveLetter = false): string {
|
||||||
if (!aPath) return aPath;
|
if (!aPath) return aPath;
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ import {
|
||||||
properJoin,
|
properJoin,
|
||||||
properRelative,
|
properRelative,
|
||||||
properResolve,
|
properResolve,
|
||||||
|
properSplit,
|
||||||
} from '../common/pathUtils';
|
} from '../common/pathUtils';
|
||||||
import { ISourceMapMetadata } from '../common/sourceMaps/sourceMap';
|
import { ISourceMapMetadata } from '../common/sourceMaps/sourceMap';
|
||||||
import { ISourcePathResolver, IUrlResolution } from '../common/sourcePathResolver';
|
import { ISourcePathResolver, IUrlResolution } from '../common/sourcePathResolver';
|
||||||
import {
|
import {
|
||||||
comparePathsWithoutCasing,
|
|
||||||
fileUrlToAbsolutePath,
|
fileUrlToAbsolutePath,
|
||||||
getCaseSensitivePaths,
|
getCaseSensitivePaths,
|
||||||
isAbsolute,
|
isAbsolute,
|
||||||
|
@ -62,14 +62,23 @@ export abstract class SourcePathResolverBase<T extends ISourcePathResolverOption
|
||||||
suffix = forceForwardSlashes(properResolve(suffix));
|
suffix = forceForwardSlashes(properResolve(suffix));
|
||||||
|
|
||||||
// replace special minimatch characters that appear in the local root (vscode#166400)
|
// replace special minimatch characters that appear in the local root (vscode#166400)
|
||||||
// we compare against the original location since forceForwardSlashes will
|
const wfParts = properSplit(this.options.workspaceFolder);
|
||||||
// prevent matching on Windows
|
const suffixParts = properSplit(suffix);
|
||||||
const wf = this.options.workspaceFolder;
|
let sharedPrefixLen = 0;
|
||||||
if (comparePathsWithoutCasing(wf, location.slice(prefix.length, prefix.length + wf.length))) {
|
for (
|
||||||
suffix =
|
let i = 0;
|
||||||
suffix.slice(0, wf.length).replace(/[\[\]\(\)\{\}\!\*]/g, '\\$&') + suffix.slice(wf.length);
|
i < wfParts.length &&
|
||||||
|
i < suffixParts.length &&
|
||||||
|
suffixParts[i].toLowerCase() === wfParts[i].toLowerCase();
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
sharedPrefixLen += wfParts[i].length + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suffix =
|
||||||
|
suffix.slice(0, sharedPrefixLen).replace(/[\[\]\(\)\{\}\!\*]/g, '\\$&') +
|
||||||
|
suffix.slice(sharedPrefixLen);
|
||||||
|
|
||||||
return prefix + suffix;
|
return prefix + suffix;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,60 @@ describe('node source path resolver', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('escapes regex parts segments', async () => {
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
const r = new NodeSourcePathResolver(
|
||||||
|
fsUtils,
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
...defaultOptions,
|
||||||
|
workspaceFolder: 'C:\\some\\workspa*ce\\folder',
|
||||||
|
basePath: 'C:\\some\\workspa*ce\\folder',
|
||||||
|
resolveSourceMapLocations: [
|
||||||
|
'C:\\some\\workspa*ce\\folder/**',
|
||||||
|
'C:\\some\\workspa*ce\\folder/../**',
|
||||||
|
'C:\\some\\workspa*ce\\folder/../foo/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
await Logger.test(),
|
||||||
|
);
|
||||||
|
expect((r as unknown as Record<string, string[]>).resolvePatterns).to.deep.equal([
|
||||||
|
'C:/some/workspa\\*ce/folder/**',
|
||||||
|
'C:/some/workspa\\*ce/**',
|
||||||
|
'C:/some/workspa\\*ce/foo/**',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('fixes regex escape issue #1554', async () => {
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
const r = new NodeSourcePathResolver(
|
||||||
|
fsUtils,
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
...defaultOptions,
|
||||||
|
workspaceFolder: 'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode',
|
||||||
|
basePath: 'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode',
|
||||||
|
resolveSourceMapLocations: [
|
||||||
|
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/**',
|
||||||
|
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../../packages/shared/dist/**',
|
||||||
|
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../../packages/swimmagic/dist/**',
|
||||||
|
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../../packages/editor/dist/**',
|
||||||
|
'C:\\Users\\Segev\\prj\\swimm\\ide\\extensions\\vscode/../../server/dist/**',
|
||||||
|
'!**/node_modules/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
await Logger.test(),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
r.shouldResolveSourceMap({
|
||||||
|
compiledPath: 'c:\\Users\\Segev\\prj\\swimm\\ide\\server\\dist\\app.js',
|
||||||
|
sourceMapUrl: 'file:///c:/Users/Segev/prj/swimm/ide/server/dist/app.js.map',
|
||||||
|
}),
|
||||||
|
).to.be.true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it('resolves unc paths', async () => {
|
it('resolves unc paths', async () => {
|
||||||
if (process.platform !== 'win32') {
|
if (process.platform !== 'win32') {
|
||||||
return;
|
return;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче