We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! Maybe I’m wrong but I believe the output should be the same. Here are the differences (using emscripten v3.1.59):
5366,5429c5366,5369 < isAbs: path => path.charAt(0) === '/', < splitPath: filename => { < var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; < return splitPathRe.exec(filename).slice(1); < }, < normalizeArray: (parts, allowAboveRoot) => { < // if the path tries to go above the root, `up` ends up > 0 < var up = 0; < for (var i = parts.length - 1; i >= 0; i--) { < var last = parts[i]; < if (last === '.') { < parts.splice(i, 1); < } else if (last === '..') { < parts.splice(i, 1); < up++; < } else if (up) { < parts.splice(i, 1); < up--; < } < } < // if the path is allowed to go above the root, restore leading ..s < if (allowAboveRoot) { < for (; up; up--) { < parts.unshift('..'); < } < } < return parts; < }, < normalize: path => { < var isAbsolute = PATH.isAbs(path), < trailingSlash = path.substr(-1) === '/'; < // Normalize the path < path = PATH.normalizeArray(path.split('/').filter(p => !!p), !isAbsolute).join('/'); < if (!path && !isAbsolute) { < path = '.'; < } < if (path && trailingSlash) { < path += '/'; < } < return (isAbsolute ? '/' : '') + path; < }, < dirname: path => { < var result = PATH.splitPath(path), < root = result[0], < dir = result[1]; < if (!root && !dir) { < // No dirname whatsoever < return '.'; < } < if (dir) { < // It has a dirname, strip trailing slash < dir = dir.substr(0, dir.length - 1); < } < return root + dir; < }, < basename: path => { < // EMSCRIPTEN return '/'' for '/', not an empty string < if (path === '/') return '/'; < path = PATH.normalize(path); < path = path.replace(/\/$/, ""); < var lastSlash = path.lastIndexOf('/'); < if (lastSlash === -1) return path; < return path.substr(lastSlash + 1); < }, --- > isAbs: path => nodePath['isAbsolute'](path), > normalize: path => nodePath['normalize'](path), > dirname: path => nodePath['dirname'](path), > basename: path => nodePath['basename'](path), 5431,5434c5371 < for (var _len = arguments.length, paths = new Array(_len), _key2 = 0; _key2 < _len; _key2++) { < paths[_key2] = arguments[_key2]; < } < return PATH.normalize(paths.join('/')); --- > return nodePath['join'](...arguments); 5436c5373 < join2: (l, r) => PATH.normalize(l + '/' + r) --- > join2: (l, r) => nodePath['join'](l, r) 5466a5404,5405 > > /** @type{{resolve: function(...*)}} */ 5469,5514c5408,5409 < var resolvedPath = '', < resolvedAbsolute = false; < for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { < var path = i >= 0 ? i < 0 || arguments.length <= i ? undefined : arguments[i] : FS.cwd(); < // Skip empty and invalid entries < if (typeof path != 'string') { < throw new TypeError('Arguments to path.resolve must be strings'); < } else if (!path) { < return ''; // an invalid portion invalidates the whole thing < } < resolvedPath = path + '/' + resolvedPath; < resolvedAbsolute = PATH.isAbs(path); < } < // At this point the path should be resolved to a full absolute path, but < // handle relative paths to be safe (might happen when process.cwd() fails) < resolvedPath = PATH.normalizeArray(resolvedPath.split('/').filter(p => !!p), !resolvedAbsolute).join('/'); < return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; < }, < relative: (from, to) => { < from = PATH_FS.resolve(from).substr(1); < to = PATH_FS.resolve(to).substr(1); < function trim(arr) { < var start = 0; < for (; start < arr.length; start++) { < if (arr[start] !== '') break; < } < var end = arr.length - 1; < for (; end >= 0; end--) { < if (arr[end] !== '') break; < } < if (start > end) return []; < return arr.slice(start, end - start + 1); < } < var fromParts = trim(from.split('/')); < var toParts = trim(to.split('/')); < var length = Math.min(fromParts.length, toParts.length); < var samePartsLength = length; < for (var i = 0; i < length; i++) { < if (fromParts[i] !== toParts[i]) { < samePartsLength = i; < break; < } < } < var outputParts = []; < for (var i = samePartsLength; i < fromParts.length; i++) { < outputParts.push('..'); --- > for (var _len = arguments.length, paths = new Array(_len), _key2 = 0; _key2 < _len; _key2++) { > paths[_key2] = arguments[_key2]; 5516,5518c5411,5414 < outputParts = outputParts.concat(toParts.slice(samePartsLength)); < return outputParts.join('/'); < } --- > paths.unshift(FS.cwd()); > return nodePath['posix']['resolve'](...paths); > }, > relative: (from, to) => nodePath['posix']['relative'](from || FS.cwd(), to || FS.cwd())
Kind regards, Maurice
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! Maybe I’m wrong but I believe the output should be the same. Here are the differences (using emscripten v3.1.59):
Kind regards,
Maurice
The text was updated successfully, but these errors were encountered: