ClojureScript

relativize source map urls

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

The user provides :output-dir and :source-map. We should simply combine these to generate the relative paths based on :output-dir. We already copy all JS & CLJS files from jars into :output-dir, we should also copy any of user's CLJS files to :output-dir if :source-map enabled. This should satisfy both the server-less and web server source map use cases.

Activity

Hide
David Nolen added a comment -

Before moving on this I wonder if Chrome's flexibility for resolving source map location sufficiently addresses this?

Show
David Nolen added a comment - Before moving on this I wonder if Chrome's flexibility for resolving source map location sufficiently addresses this?
Hide
Eric Normand added a comment -

Note that I am using ClojureScript in a Chrome extension.

Chrome seems to look in the original location using an absolute path. This is the URL I see in Chrome Dev Tools for one of my source-mapped files:

chrome-extension://eplaphehkbcdfhogfgblgcgggpccmcbl/Users/eric/sec/chrome/src/editor/com/secondchance/chrome/editor.cljs

Each extension gets its own "space" (the noisy host part of the URL). But /Users/eric/sec... is the full, absolute path on the hard drive, not a path relative to that extension directory.

Is this related to the way paths are passed to Google Closure? They should be passed relative to the location of the source map.

Show
Eric Normand added a comment - Note that I am using ClojureScript in a Chrome extension. Chrome seems to look in the original location using an absolute path. This is the URL I see in Chrome Dev Tools for one of my source-mapped files: chrome-extension://eplaphehkbcdfhogfgblgcgggpccmcbl/Users/eric/sec/chrome/src/editor/com/secondchance/chrome/editor.cljs Each extension gets its own "space" (the noisy host part of the URL). But /Users/eric/sec... is the full, absolute path on the hard drive, not a path relative to that extension directory. Is this related to the way paths are passed to Google Closure? They should be passed relative to the location of the source map.
Hide
David Nolen added a comment -

Happy to take a patch if you can confirm that making the paths relatively to the location of the source map will actually work. Such a patch would also need to properly handle files in JARs and those not actually local to the build (since arbitrary URLs are actually supported).

Show
David Nolen added a comment - Happy to take a patch if you can confirm that making the paths relatively to the location of the source map will actually work. Such a patch would also need to properly handle files in JARs and those not actually local to the build (since arbitrary URLs are actually supported).
David Nolen made changes -
Field Original Value New Value
Description If provided all original sources regardless of original location should be copied into the specified location. This way source maps can more easily be integrated into web application workflows. The user provides {{:output-dir}} and {{:source-map}}. We should simply combine these to generate the relative paths based on {{:output-dir}}. We already copy all JS & CLJS files from jars into {{:output-dir}}, we should also copy any of user's CLJS files to out. This should satisfy both the server-less and web server source map use cases.
Summary add :source-map-dir option relativize source map urls
David Nolen made changes -
Description The user provides {{:output-dir}} and {{:source-map}}. We should simply combine these to generate the relative paths based on {{:output-dir}}. We already copy all JS & CLJS files from jars into {{:output-dir}}, we should also copy any of user's CLJS files to out. This should satisfy both the server-less and web server source map use cases. The user provides {{:output-dir}} and {{:source-map}}. We should simply combine these to generate the relative paths based on {{:output-dir}}. We already copy all JS & CLJS files from jars into {{:output-dir}}, we should also copy any of user's CLJS files to out if {{:source-map}} enabled. This should satisfy both the server-less and web server source map use cases.
David Nolen made changes -
Assignee David Nolen [ dnolen ]
David Nolen made changes -
Description The user provides {{:output-dir}} and {{:source-map}}. We should simply combine these to generate the relative paths based on {{:output-dir}}. We already copy all JS & CLJS files from jars into {{:output-dir}}, we should also copy any of user's CLJS files to out if {{:source-map}} enabled. This should satisfy both the server-less and web server source map use cases. The user provides {{:output-dir}} and {{:source-map}}. We should simply combine these to generate the relative paths based on {{:output-dir}}. We already copy all JS & CLJS files from jars into {{:output-dir}}, we should also copy any of user's CLJS files to {{:output-dir}} if {{:source-map}} enabled. This should satisfy both the server-less and web server source map use cases.
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: