-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: debugger failing on Node <=12 (#1627)
* fix: sourcemap lookups on ipv6 localhost addresses TIL that assigning an invalid value to `url.hostname` silently fails if invalid. Fixes microsoft/vscode#167353 * fix: debugger failing on Node <=12 Fixes #1624 Updates @vscode/l10n to allow it to be tree-shaken away. Also moves `checkContentHash` that likewise had a dependency on more modern language features. I think webpack was just extra aggressive about tree shaking before and assumed `new Hasher()` was side effect free. Which is was, it's just a big assumption to have made. And when I had updated versions in our pipelines, I accidentally updated the minspec to no longer target Node 8 🤦♂️. Targeting the latest 10 should be good. Node 8 thankfully <0.25% of users nowadays. * keep broken minspec for the moment
- Loading branch information
1 parent
1c46464
commit 1fd5f82
Showing
5 changed files
with
46 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,36 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
import { Hasher } from '.'; | ||
import { LocalFsUtils } from '../fsUtils'; | ||
import { isWithinAsar } from '../pathUtils'; | ||
import { promises as fsPromises } from 'fs'; | ||
|
||
const hasher = new Hasher(); | ||
|
||
export async function checkContentHash( | ||
absolutePath: string, | ||
contentHash?: string, | ||
contentOverride?: string, | ||
): Promise<string | undefined> { | ||
if (!absolutePath) { | ||
return undefined; | ||
} | ||
|
||
if (isWithinAsar(absolutePath)) { | ||
return undefined; | ||
} | ||
|
||
if (!contentHash) { | ||
const exists = await new LocalFsUtils(fsPromises).exists(absolutePath); | ||
return exists ? absolutePath : undefined; | ||
} | ||
|
||
const result = | ||
typeof contentOverride === 'string' | ||
? await hasher.verifyBytes(contentOverride, contentHash, true) | ||
: await hasher.verifyFile(absolutePath, contentHash, true); | ||
|
||
return result ? absolutePath : undefined; | ||
} |
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