Skip to content

Commit 849459e

Browse files
committed
Add Source Map support.
- Add sourcemaps license. Manually removed a few deletions - Use Emit typeclass, move JS sourcespans into each ctor - Remove sourcemaps from stackage build plans for travis, version is too old - Keep source positions for literals
1 parent 47d547d commit 849459e

31 files changed

+830
-538
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ install:
5151
- mkdir -p .cabal-sandbox
5252
- cabal sandbox init --sandbox .cabal-sandbox
5353
# Download stackage cabal.config, not sure whether filtering is necessary
54-
- if [ -n "$STACKAGE" ]; then curl https://www.stackage.org/$STACKAGE/cabal.config | grep -v purescript > cabal.config; fi
54+
- if [ -n "$STACKAGE" ]; then curl https://www.stackage.org/$STACKAGE/cabal.config | egrep -v 'purescript|sourcemap' > cabal.config; fi
5555
- cabal install --only-dependencies --enable-tests
5656
- cabal install hpc-coveralls
5757
# Snapshot state of the sandbox now, so we don't need to make new one for test install

LICENSE

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ PureScript uses the following Haskell library packages. Their license files foll
6363
safe
6464
scientific
6565
semigroups
66+
sourcemap
6667
split
6768
stm
6869
syb
@@ -1589,6 +1590,39 @@ semigroups LICENSE file:
15891590
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
15901591
POSSIBILITY OF SUCH DAMAGE.
15911592

1593+
sourcemap LICENSE file:
1594+
1595+
Copyright (c) 2012, Chris Done
1596+
1597+
All rights reserved.
1598+
1599+
Redistribution and use in source and binary forms, with or without
1600+
modification, are permitted provided that the following conditions are met:
1601+
1602+
* Redistributions of source code must retain the above copyright
1603+
notice, this list of conditions and the following disclaimer.
1604+
1605+
* Redistributions in binary form must reproduce the above
1606+
copyright notice, this list of conditions and the following
1607+
disclaimer in the documentation and/or other materials provided
1608+
with the distribution.
1609+
1610+
* Neither the name of Chris Done nor the names of other
1611+
contributors may be used to endorse or promote products derived
1612+
from this software without specific prior written permission.
1613+
1614+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1615+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1616+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1617+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1618+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1619+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1620+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1621+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1622+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1623+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1624+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1625+
15921626
split LICENSE file:
15931627

15941628
Copyright (c) 2008 Brent Yorgey, Louis Wasserman

psc/Main.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ jsonErrors :: Parser Bool
177177
jsonErrors = switch $
178178
long "json-errors"
179179
<> help "Print errors to stderr as JSON"
180+
sourceMaps :: Parser Bool
181+
sourceMaps = switch $
182+
long "source-maps"
183+
<> help "Generate source maps"
184+
180185

181186
options :: Parser P.Options
182187
options = P.Options <$> noTco
@@ -186,6 +191,7 @@ options = P.Options <$> noTco
186191
<*> verboseErrors
187192
<*> (not <$> comments)
188193
<*> requirePath
194+
<*> sourceMaps
189195

190196
pscMakeOptions :: Parser PSCMakeOptions
191197
pscMakeOptions = PSCMakeOptions <$> many inputFile

purescript.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ library
7979
process >= 1.2.0 && < 1.5,
8080
safe >= 0.3.9 && < 0.4,
8181
semigroups >= 0.16.2 && < 0.19,
82-
parallel >= 3.2 && < 3.3
82+
parallel >= 3.2 && < 3.3,
83+
sourcemap >= 0.1.6
8384

8485
exposed-modules: Language.PureScript
8586
Language.PureScript.AST

src/Language/PureScript/CodeGen/JS.hs

Lines changed: 140 additions & 123 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)