Skip to content

Commit e99b149

Browse files
authored
Merge pull request #206 from maxtaco/zapu/source-map-support-iced3
[iced3] Use source-map-support for stack trace formatting
2 parents 26524e9 + 568b80a commit e99b149

27 files changed

+829
-467
lines changed

Cakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ runTests = (CoffeeScript) ->
449449

450450
# End Iced additions
451451
# ----
452-
452+
453453
helpers.extend global, require './test/support/helpers'
454454

455455
# When all the tests have run, collect and print errors.
@@ -519,6 +519,10 @@ task 'test:browser', 'run the test suite against the merged browser script', ->
519519
result = {}
520520
global.testingBrowser = yes
521521
(-> eval source).call result
522+
# When testing browser build, install custom prepareStackTrace handler instead
523+
# of source-map-support. `CoffeeScript.run` is pulled from `browser.coffee` in
524+
# browser build, and it's incompatible with our source-map-support hooks.
525+
result.CoffeeScript.installPrepareStackTrace()
522526
testResults = runTests result.CoffeeScript
523527

524528
task 'check_version', 'Check version between package.json and version compiled in', ->

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,27 @@ For documentation, usage, and examples, see: http://coffeescript.org/
7878
To suggest a feature or report a bug: http://github.com/maxtaco/coffeescript/issues
7979

8080
The source repository: https://github.com/maxtaco/coffeescript.git
81+
82+
## Note about `source-map-support`
83+
84+
Since v112.8.1 (2019-12-20), IcedCoffeeScript v3 uses `source-map-support`
85+
package to handle location mapping for stack traces for errors coming from
86+
IcedCoffeeScript code. It's enabled by default when using `iced3` to run scripts
87+
or when using `register` to enable IcedCoffeeScript in Node's module system.
88+
89+
To enable it manually (e.g. in environments other than Node.js or when not
90+
using `register`), use the following API:
91+
92+
```
93+
require('iced-coffee-script-3').installSourceMapSupport({})
94+
```
95+
96+
This function can also be called with options for `source-map-support` instead
97+
of an empty object. Available options are described in `source-map-support`
98+
README file.
99+
100+
To use the old error handler, use the following API instead:
101+
102+
```
103+
require('iced-coffee-script-3').installPrepareStackTrace()
104+
```

docs/v1/browser-compiler/iced-coffee-script.js

Lines changed: 402 additions & 399 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)