Change:
We will ship Electron with to stable soon so we should also look into bringing our copy of library to the same version. Checking for the diff, it seems to be a few commits after and up until //cc
Hm, the first change is already pretty bad for us: Because it seems to depend on a new thing which is maybe defined globally and probably optimised / cached / snapshotted. Maybe we should rather look out for actual bug fixes and focus on those... Changes: I think only the 2 fix commits stand out from the others
I assume you skipped over right?
Reopening given unit test failures, I had to revert the change for now.
yes I skipped the primordials. I didn't dig into why they do this, but it seemed easy enough to just call the string functions instead. As for the test failures, new PR
Primordials are only meant for Nodejs internal code usage, external users should just replace them with corresponding JavaScript builtins. You can read more about why Nodejs does it

Discussion:
*--------------------------------------------------------------------------------------------*/ // NOTE: VSCode's copy of nodejs path library to be usable in common (non-node) namespace <del> // Copied from: https://github.com/nodejs/node/blob/v14.16.0/lib/path.js </del> <ins> // Copied from: https://github.com/nodejs/node/blob/v16.14.2/lib/path.js </ins> /** * Copyright Joyent, Inc. and other Node contributors.

} } <ins> function validateObject(pathObject: object, name: string) { if (pathObject === null || typeof pathObject !== 'object') { throw new ErrorInvalidArgType(name, 'Object', pathObject); } } </ins> function validateString(value: string, name: string) { if (typeof value !== 'string') { throw new ErrorInvalidArgType(name, 'string', value); } } <ins> const platformIsWin32 = (process.platform === 'win32'); </ins> function isPathSeparator(code: number | undefined) { return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; }

} function _format(sep: string, pathObject: ParsedPath) { <del> if (pathObject === null || typeof pathObject !== 'object') { throw new ErrorInvalidArgType('pathObject', 'Object', pathObject); } </del> <ins> validateObject(pathObject, 'pathObject'); </ins> const dir = pathObject.dir || pathObject.root; const base = pathObject.base || `${pathObject.name || ''}${pathObject.ext || ''}`;

toNamespacedPath(path: string): string { // Note: this will *probably* throw somewhere. <del> if (typeof path !== 'string') { </del> <ins> if (typeof path !== 'string' || path.length === 0) { </ins> return path; } <del> if (path.length === 0) { return ''; } </del> const resolvedPath = win32.resolve(path); if (resolvedPath.length <= 2) {

posix: null }; <ins> const posixCwd = (() => { if (platformIsWin32) { // Converts Windows' backslash path separators to POSIX forward slashes // and truncates any drive indicator const regexp = //g; return () => { const cwd = process.cwd().replace(regexp, '/'); return cwd.slice(cwd.indexOf('/')); }; } // We're already on POSIX, no need for any transformations return () => process.cwd(); })(); </ins> export const posix: IPath = { // path.resolve([from ...], to) resolve(...pathSegments: string[]): string {

let resolvedAbsolute = false; for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) { <del> const path = i >= 0 ? pathSegments[i] : process.cwd(); </del> <ins> const path = i >= 0 ? pathSegments[i] : posixCwd(); </ins> validateString(path, 'path');

posix.win32 = win32.win32 = win32; posix.posix = win32.posix = posix; <del> export const normalize = (process.platform === 'win32' ? win32.normalize : posix.normalize); export const isAbsolute = (process.platform === 'win32' ? win32.isAbsolute : posix.isAbsolute); export const join = (process.platform === 'win32' ? win32.join : posix.join); export const resolve = (process.platform === 'win32' ? win32.resolve : posix.resolve); export const relative = (process.platform === 'win32' ? win32.relative : posix.relative); export const dirname = (process.platform === 'win32' ? win32.dirname : posix.dirname); export const basename = (process.platform === 'win32' ? win32.basename : posix.basename); export const extname = (process.platform === 'win32' ? win32.extname : posix.extname); export const format = (process.platform === 'win32' ? win32.format : posix.format); export const parse = (process.platform === 'win32' ? win32.parse : posix.parse); export const toNamespacedPath = (process.platform === 'win32' ? win32.toNamespacedPath : posix.toNamespacedPath); export const sep = (process.platform === 'win32' ? win32.sep : posix.sep); export const delimiter = (process.platform === 'win32' ? win32.delimiter : posix.delimiter); </del> <ins> export const normalize = (platformIsWin32 ? win32.normalize : posix.normalize); export const isAbsolute = (platformIsWin32 ? win32.isAbsolute : posix.isAbsolute); export const join = (platformIsWin32 ? win32.join : posix.join); export const resolve = (platformIsWin32 ? win32.resolve : posix.resolve); export const relative = (platformIsWin32 ? win32.relative : posix.relative); export const dirname = (platformIsWin32 ? win32.dirname : posix.dirname); export const basename = (platformIsWin32 ? win32.basename : posix.basename); export const extname = (platformIsWin32 ? win32.extname : posix.extname); export const format = (platformIsWin32 ? win32.format : posix.format); export const parse = (platformIsWin32 ? win32.parse : posix.parse); export const toNamespacedPath = (platformIsWin32 ? win32.toNamespacedPath : posix.toNamespacedPath); export const sep = (platformIsWin32 ? win32.sep : posix.sep); export const delimiter = (platformIsWin32 ? win32.delimiter : posix.delimiter); </ins>

assert.strictEqual(path.extname('far.boo/boo'), ''); }); <del> (isWeb && isWindows ? test.skip : test)('resolve', () => { // TODO@sbatten fails on windows & browser only </del> <ins> test('resolve', () => { </ins> const failures = [] as string[]; const slashRE = ///g; const backslashRE = //g;

[['c:/ignore', 'd:a/bc/d', 'e.exe'], 'd:e.exe'], [['c:/ignore', 'c:/some/file'], 'c:somefile'], [['d:/ignore', 'd:some/dir//'], 'd:ignoresomedir'], <del> [['.'], process.cwd()], </del> [['//server/share', '..', 'relative'], 'serversharerelative'], [['c:/', '//'], 'c:'], [['c:/', '//dir'], 'c:dir'],

// arguments                    result [[['/var/lib', '../', 'file/'], '/var/file'], [['/var/lib', '/../', 'file/'], '/file'], <del> [['a/b/c/', '../../..'], process.cwd()], [['.'], process.cwd()], </del> [['/some/dir', '.', '/absolute/'], '/absolute'], [['/foo/tmp.3/', '../tmp.3/cycles/root.js'], '/foo/tmp.3/cycles/root.js'] ] <ins> ], [(isWeb ? path.posix.resolve : path.resolve), // arguments						result [[['.'], process.cwd()], [['a/b/c', '../../..'], process.cwd()] </ins> ] <ins> ], </ins> ]; resolveTests.forEach((test) => { const resolve = test[0];