@emeryld/rrroutes-contract 2.7.10 → 2.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -734,8 +734,19 @@ var DEFAULT_VIEWER_TEMPLATE = `<!doctype html>
734
734
  const toHref = (source) => {
735
735
  if (!source || !source.file) return null
736
736
  const normalizedPath = String(source.file).replace(/\\\\/g, '/')
737
- const prefix = normalizedPath.startsWith('/') ? 'file://' : 'file:///'
738
- return prefix + encodeURI(normalizedPath)
737
+ const platform =
738
+ (navigator.userAgentData && navigator.userAgentData.platform) ||
739
+ navigator.platform ||
740
+ ''
741
+ const isWindows = /win/i.test(platform)
742
+ const vscodePath = isWindows
743
+ ? normalizedPath.replace(/^\\/+/, '')
744
+ : normalizedPath.startsWith('/')
745
+ ? normalizedPath
746
+ : '/' + normalizedPath
747
+ const line = Number.isFinite(source.line) ? source.line : 1
748
+ const column = Number.isFinite(source.column) ? source.column : 1
749
+ return 'vscode://file/' + encodeURI(vscodePath) + ':' + line + ':' + column
739
750
  }
740
751
 
741
752
  const sourceDisplay = (source) => {