opal 1.2.0 → 1.3.0.alpha1
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.
- checksums.yaml +4 -4
- data/.eslintrc.await.js +6 -0
- data/.eslintrc.js +34 -0
- data/.github/workflows/build.yml +8 -0
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/UNRELEASED.md +64 -38
- data/docs/async.md +109 -0
- data/docs/roda-sprockets.md +0 -2
- data/exe/opal +2 -0
- data/exe/opal-repl +2 -2
- data/lib/opal/builder.rb +5 -1
- data/lib/opal/builder_processors.rb +7 -2
- data/lib/opal/cache/file_cache.rb +119 -0
- data/lib/opal/cache.rb +71 -0
- data/lib/opal/cli.rb +35 -1
- data/lib/opal/cli_options.rb +21 -0
- data/lib/opal/cli_runners/chrome.rb +21 -14
- data/lib/opal/cli_runners/chrome_cdp_interface.js +30285 -0
- data/lib/opal/cli_runners/{chrome.js → chrome_cdp_interface.rb} +27 -6
- data/lib/opal/cli_runners/compiler.rb +2 -1
- data/lib/opal/cli_runners/gjs.rb +27 -0
- data/lib/opal/cli_runners/mini_racer.rb +36 -0
- data/lib/opal/cli_runners/source-map-support-browser.js +276 -91
- data/lib/opal/cli_runners/source-map-support-node.js +276 -91
- data/lib/opal/cli_runners/source-map-support.js +60 -18
- data/lib/opal/cli_runners.rb +2 -0
- data/lib/opal/compiler.rb +99 -10
- data/lib/opal/fragment.rb +77 -14
- data/lib/opal/nodes/args/extract_kwrestarg.rb +6 -4
- data/lib/opal/nodes/args/extract_restarg.rb +10 -12
- data/lib/opal/nodes/args.rb +28 -0
- data/lib/opal/nodes/base.rb +29 -5
- data/lib/opal/nodes/call.rb +123 -2
- data/lib/opal/nodes/case.rb +7 -1
- data/lib/opal/nodes/class.rb +12 -2
- data/lib/opal/nodes/def.rb +3 -23
- data/lib/opal/nodes/definitions.rb +21 -4
- data/lib/opal/nodes/helpers.rb +2 -2
- data/lib/opal/nodes/if.rb +39 -9
- data/lib/opal/nodes/iter.rb +15 -3
- data/lib/opal/nodes/lambda.rb +3 -1
- data/lib/opal/nodes/literal.rb +13 -7
- data/lib/opal/nodes/logic.rb +2 -2
- data/lib/opal/nodes/module.rb +12 -2
- data/lib/opal/nodes/rescue.rb +59 -34
- data/lib/opal/nodes/scope.rb +88 -6
- data/lib/opal/nodes/super.rb +52 -25
- data/lib/opal/nodes/top.rb +13 -7
- data/lib/opal/nodes/while.rb +7 -1
- data/lib/opal/parser/patch.rb +2 -1
- data/lib/opal/repl.rb +137 -49
- data/lib/opal/rewriters/binary_operator_assignment.rb +10 -10
- data/lib/opal/rewriters/block_to_iter.rb +3 -3
- data/lib/opal/rewriters/for_rewriter.rb +7 -7
- data/lib/opal/rewriters/js_reserved_words.rb +5 -3
- data/lib/opal/source_map/file.rb +7 -4
- data/lib/opal/source_map/map.rb +17 -3
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array.rb +2 -2
- data/opal/corelib/binding.rb +46 -0
- data/opal/corelib/boolean.rb +54 -4
- data/opal/corelib/class.rb +2 -0
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/error.rb +98 -12
- data/opal/corelib/io.rb +250 -38
- data/opal/corelib/kernel/format.rb +5 -2
- data/opal/corelib/kernel.rb +44 -23
- data/opal/corelib/main.rb +5 -0
- data/opal/corelib/method.rb +1 -0
- data/opal/corelib/module.rb +28 -0
- data/opal/corelib/number.rb +12 -1
- data/opal/corelib/random/seedrandom.js.rb +2 -2
- data/opal/corelib/regexp.rb +47 -3
- data/opal/corelib/runtime.js +152 -12
- data/opal/corelib/string/encoding.rb +17 -17
- data/opal/corelib/string.rb +2 -0
- data/opal/corelib/struct.rb +10 -3
- data/opal/corelib/trace_point.rb +57 -0
- data/opal/opal/full.rb +2 -0
- data/package.json +3 -2
- data/spec/filters/bugs/array.rb +0 -1
- data/spec/filters/bugs/basicobject.rb +0 -1
- data/spec/filters/bugs/binding.rb +27 -0
- data/spec/filters/bugs/enumerator.rb +132 -0
- data/spec/filters/bugs/exception.rb +70 -93
- data/spec/filters/bugs/float.rb +0 -1
- data/spec/filters/bugs/kernel.rb +3 -9
- data/spec/filters/bugs/language.rb +15 -58
- data/spec/filters/bugs/main.rb +16 -0
- data/spec/filters/bugs/matrix.rb +39 -0
- data/spec/filters/bugs/method.rb +0 -2
- data/spec/filters/bugs/module.rb +36 -79
- data/spec/filters/bugs/proc.rb +0 -1
- data/spec/filters/bugs/regexp.rb +0 -16
- data/spec/filters/bugs/trace_point.rb +12 -0
- data/spec/filters/bugs/warnings.rb +0 -4
- data/spec/filters/unsupported/freeze.rb +2 -0
- data/spec/filters/unsupported/privacy.rb +4 -0
- data/spec/lib/compiler_spec.rb +7 -1
- data/spec/lib/repl_spec.rb +4 -2
- data/spec/lib/source_map/file_spec.rb +1 -1
- data/spec/mspec-opal/formatters.rb +18 -4
- data/spec/mspec-opal/runner.rb +2 -2
- data/spec/opal/core/boolean_spec.rb +44 -0
- data/spec/opal/core/hash_spec.rb +8 -0
- data/spec/opal/core/number/to_s_spec.rb +11 -0
- data/spec/opal/stdlib/json/ext_spec.rb +3 -3
- data/spec/opal/stdlib/logger/logger_spec.rb +10 -1
- data/spec/ruby_specs +18 -0
- data/stdlib/await.rb +83 -0
- data/stdlib/base64.rb +4 -4
- data/stdlib/bigdecimal/bignumber.js.rb +4 -2
- data/stdlib/bigdecimal.rb +1 -0
- data/stdlib/gjs/io.rb +33 -0
- data/stdlib/gjs/kernel.rb +5 -0
- data/stdlib/gjs.rb +2 -0
- data/stdlib/js.rb +4 -0
- data/stdlib/json.rb +3 -3
- data/stdlib/logger.rb +1 -1
- data/stdlib/nashorn/file.rb +2 -0
- data/stdlib/nodejs/env.rb +7 -0
- data/stdlib/nodejs/file.rb +6 -41
- data/stdlib/nodejs/io.rb +21 -5
- data/stdlib/nodejs/js-yaml-3-6-1.js +2 -2
- data/stdlib/opal/miniracer.rb +6 -0
- data/stdlib/opal/platform.rb +4 -0
- data/stdlib/opal/repl_js.rb +5 -0
- data/stdlib/opal/replutils.rb +271 -0
- data/stdlib/opal-parser.rb +24 -11
- data/stdlib/opal-platform.rb +8 -0
- data/stdlib/promise/v2.rb +16 -4
- data/stdlib/promise.rb +14 -0
- data/stdlib/stringio.rb +13 -110
- data/stdlib/thread.rb +29 -0
- data/tasks/building.rake +10 -4
- data/tasks/linting-parse-eslint-results.js +39 -0
- data/tasks/linting.rake +38 -28
- data/tasks/performance/asciidoctor_test.rb.erb +6 -0
- data/tasks/performance/optimization_status.rb +77 -0
- data/tasks/performance.rake +149 -0
- data/tasks/testing.rake +9 -1
- data/test/nodejs/test_await.rb +169 -0
- data/test/opal/promisev2/test_error.rb +9 -3
- data/test/opal/unsupported_and_bugs.rb +5 -0
- data/vendored-minitest/minitest/benchmark.rb +9 -7
- data/vendored-minitest/minitest/test.rb +14 -12
- data/vendored-minitest/minitest.rb +19 -16
- data/yarn.lock +686 -117
- metadata +60 -23
- data/.jshintrc +0 -41
- data/spec/filters/unsupported/refinements.rb +0 -8
- data/vendored-minitest/minitest/hell.rb +0 -11
- data/vendored-minitest/minitest/parallel.rb +0 -65
- data/vendored-minitest/minitest/pride.rb +0 -4
- data/vendored-minitest/minitest/pride_plugin.rb +0 -142
- data/vendored-minitest/minitest/unit.rb +0 -45
|
@@ -3470,19 +3470,19 @@ var ArraySet = require('./array-set').ArraySet;
|
|
|
3470
3470
|
var base64VLQ = require('./base64-vlq');
|
|
3471
3471
|
var quickSort = require('./quick-sort').quickSort;
|
|
3472
3472
|
|
|
3473
|
-
function SourceMapConsumer(aSourceMap) {
|
|
3473
|
+
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
3474
3474
|
var sourceMap = aSourceMap;
|
|
3475
3475
|
if (typeof aSourceMap === 'string') {
|
|
3476
|
-
sourceMap =
|
|
3476
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
3477
3477
|
}
|
|
3478
3478
|
|
|
3479
3479
|
return sourceMap.sections != null
|
|
3480
|
-
? new IndexedSourceMapConsumer(sourceMap)
|
|
3481
|
-
: new BasicSourceMapConsumer(sourceMap);
|
|
3480
|
+
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
|
|
3481
|
+
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
|
|
3482
3482
|
}
|
|
3483
3483
|
|
|
3484
|
-
SourceMapConsumer.fromSourceMap = function(aSourceMap) {
|
|
3485
|
-
return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
|
|
3484
|
+
SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
|
|
3485
|
+
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
|
|
3486
3486
|
}
|
|
3487
3487
|
|
|
3488
3488
|
/**
|
|
@@ -3522,6 +3522,8 @@ SourceMapConsumer.prototype._version = 3;
|
|
|
3522
3522
|
|
|
3523
3523
|
SourceMapConsumer.prototype.__generatedMappings = null;
|
|
3524
3524
|
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
|
|
3525
|
+
configurable: true,
|
|
3526
|
+
enumerable: true,
|
|
3525
3527
|
get: function () {
|
|
3526
3528
|
if (!this.__generatedMappings) {
|
|
3527
3529
|
this._parseMappings(this._mappings, this.sourceRoot);
|
|
@@ -3533,6 +3535,8 @@ Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
|
|
|
3533
3535
|
|
|
3534
3536
|
SourceMapConsumer.prototype.__originalMappings = null;
|
|
3535
3537
|
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
|
|
3538
|
+
configurable: true,
|
|
3539
|
+
enumerable: true,
|
|
3536
3540
|
get: function () {
|
|
3537
3541
|
if (!this.__originalMappings) {
|
|
3538
3542
|
this._parseMappings(this._mappings, this.sourceRoot);
|
|
@@ -3600,9 +3604,7 @@ SourceMapConsumer.prototype.eachMapping =
|
|
|
3600
3604
|
var sourceRoot = this.sourceRoot;
|
|
3601
3605
|
mappings.map(function (mapping) {
|
|
3602
3606
|
var source = mapping.source === null ? null : this._sources.at(mapping.source);
|
|
3603
|
-
|
|
3604
|
-
source = util.join(sourceRoot, source);
|
|
3605
|
-
}
|
|
3607
|
+
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
|
|
3606
3608
|
return {
|
|
3607
3609
|
source: source,
|
|
3608
3610
|
generatedLine: mapping.generatedLine,
|
|
@@ -3625,13 +3627,16 @@ SourceMapConsumer.prototype.eachMapping =
|
|
|
3625
3627
|
* The only argument is an object with the following properties:
|
|
3626
3628
|
*
|
|
3627
3629
|
* - source: The filename of the original source.
|
|
3628
|
-
* - line: The line number in the original source.
|
|
3630
|
+
* - line: The line number in the original source. The line number is 1-based.
|
|
3629
3631
|
* - column: Optional. the column number in the original source.
|
|
3632
|
+
* The column number is 0-based.
|
|
3630
3633
|
*
|
|
3631
3634
|
* and an array of objects is returned, each with the following properties:
|
|
3632
3635
|
*
|
|
3633
|
-
* - line: The line number in the generated source, or null.
|
|
3636
|
+
* - line: The line number in the generated source, or null. The
|
|
3637
|
+
* line number is 1-based.
|
|
3634
3638
|
* - column: The column number in the generated source, or null.
|
|
3639
|
+
* The column number is 0-based.
|
|
3635
3640
|
*/
|
|
3636
3641
|
SourceMapConsumer.prototype.allGeneratedPositionsFor =
|
|
3637
3642
|
function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
|
|
@@ -3647,13 +3652,10 @@ SourceMapConsumer.prototype.allGeneratedPositionsFor =
|
|
|
3647
3652
|
originalColumn: util.getArg(aArgs, 'column', 0)
|
|
3648
3653
|
};
|
|
3649
3654
|
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
}
|
|
3653
|
-
if (!this._sources.has(needle.source)) {
|
|
3655
|
+
needle.source = this._findSourceIndex(needle.source);
|
|
3656
|
+
if (needle.source < 0) {
|
|
3654
3657
|
return [];
|
|
3655
3658
|
}
|
|
3656
|
-
needle.source = this._sources.indexOf(needle.source);
|
|
3657
3659
|
|
|
3658
3660
|
var mappings = [];
|
|
3659
3661
|
|
|
@@ -3713,7 +3715,7 @@ exports.SourceMapConsumer = SourceMapConsumer;
|
|
|
3713
3715
|
* query for information about the original file positions by giving it a file
|
|
3714
3716
|
* position in the generated source.
|
|
3715
3717
|
*
|
|
3716
|
-
* The
|
|
3718
|
+
* The first parameter is the raw source map (either as a JSON string, or
|
|
3717
3719
|
* already parsed to an object). According to the spec, source maps have the
|
|
3718
3720
|
* following attributes:
|
|
3719
3721
|
*
|
|
@@ -3736,12 +3738,16 @@ exports.SourceMapConsumer = SourceMapConsumer;
|
|
|
3736
3738
|
* mappings: "AA,AB;;ABCDE;"
|
|
3737
3739
|
* }
|
|
3738
3740
|
*
|
|
3741
|
+
* The second parameter, if given, is a string whose value is the URL
|
|
3742
|
+
* at which the source map was found. This URL is used to compute the
|
|
3743
|
+
* sources array.
|
|
3744
|
+
*
|
|
3739
3745
|
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
|
|
3740
3746
|
*/
|
|
3741
|
-
function BasicSourceMapConsumer(aSourceMap) {
|
|
3747
|
+
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
3742
3748
|
var sourceMap = aSourceMap;
|
|
3743
3749
|
if (typeof aSourceMap === 'string') {
|
|
3744
|
-
sourceMap =
|
|
3750
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
3745
3751
|
}
|
|
3746
3752
|
|
|
3747
3753
|
var version = util.getArg(sourceMap, 'version');
|
|
@@ -3760,6 +3766,10 @@ function BasicSourceMapConsumer(aSourceMap) {
|
|
|
3760
3766
|
throw new Error('Unsupported version: ' + version);
|
|
3761
3767
|
}
|
|
3762
3768
|
|
|
3769
|
+
if (sourceRoot) {
|
|
3770
|
+
sourceRoot = util.normalize(sourceRoot);
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3763
3773
|
sources = sources
|
|
3764
3774
|
.map(String)
|
|
3765
3775
|
// Some source maps produce relative source paths like "./foo.js" instead of
|
|
@@ -3783,24 +3793,57 @@ function BasicSourceMapConsumer(aSourceMap) {
|
|
|
3783
3793
|
this._names = ArraySet.fromArray(names.map(String), true);
|
|
3784
3794
|
this._sources = ArraySet.fromArray(sources, true);
|
|
3785
3795
|
|
|
3796
|
+
this._absoluteSources = this._sources.toArray().map(function (s) {
|
|
3797
|
+
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
|
|
3798
|
+
});
|
|
3799
|
+
|
|
3786
3800
|
this.sourceRoot = sourceRoot;
|
|
3787
3801
|
this.sourcesContent = sourcesContent;
|
|
3788
3802
|
this._mappings = mappings;
|
|
3803
|
+
this._sourceMapURL = aSourceMapURL;
|
|
3789
3804
|
this.file = file;
|
|
3790
3805
|
}
|
|
3791
3806
|
|
|
3792
3807
|
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
|
|
3793
3808
|
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
|
|
3794
3809
|
|
|
3810
|
+
/**
|
|
3811
|
+
* Utility function to find the index of a source. Returns -1 if not
|
|
3812
|
+
* found.
|
|
3813
|
+
*/
|
|
3814
|
+
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
|
|
3815
|
+
var relativeSource = aSource;
|
|
3816
|
+
if (this.sourceRoot != null) {
|
|
3817
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
if (this._sources.has(relativeSource)) {
|
|
3821
|
+
return this._sources.indexOf(relativeSource);
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
// Maybe aSource is an absolute URL as returned by |sources|. In
|
|
3825
|
+
// this case we can't simply undo the transform.
|
|
3826
|
+
var i;
|
|
3827
|
+
for (i = 0; i < this._absoluteSources.length; ++i) {
|
|
3828
|
+
if (this._absoluteSources[i] == aSource) {
|
|
3829
|
+
return i;
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
return -1;
|
|
3834
|
+
};
|
|
3835
|
+
|
|
3795
3836
|
/**
|
|
3796
3837
|
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
|
|
3797
3838
|
*
|
|
3798
3839
|
* @param SourceMapGenerator aSourceMap
|
|
3799
3840
|
* The source map that will be consumed.
|
|
3841
|
+
* @param String aSourceMapURL
|
|
3842
|
+
* The URL at which the source map can be found (optional)
|
|
3800
3843
|
* @returns BasicSourceMapConsumer
|
|
3801
3844
|
*/
|
|
3802
3845
|
BasicSourceMapConsumer.fromSourceMap =
|
|
3803
|
-
function SourceMapConsumer_fromSourceMap(aSourceMap) {
|
|
3846
|
+
function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
|
|
3804
3847
|
var smc = Object.create(BasicSourceMapConsumer.prototype);
|
|
3805
3848
|
|
|
3806
3849
|
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
|
|
@@ -3809,6 +3852,10 @@ BasicSourceMapConsumer.fromSourceMap =
|
|
|
3809
3852
|
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
|
|
3810
3853
|
smc.sourceRoot);
|
|
3811
3854
|
smc.file = aSourceMap._file;
|
|
3855
|
+
smc._sourceMapURL = aSourceMapURL;
|
|
3856
|
+
smc._absoluteSources = smc._sources.toArray().map(function (s) {
|
|
3857
|
+
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
|
|
3858
|
+
});
|
|
3812
3859
|
|
|
3813
3860
|
// Because we are modifying the entries (by converting string sources and
|
|
3814
3861
|
// names to indices into the sources and names ArraySets), we have to make
|
|
@@ -3855,9 +3902,7 @@ BasicSourceMapConsumer.prototype._version = 3;
|
|
|
3855
3902
|
*/
|
|
3856
3903
|
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
|
|
3857
3904
|
get: function () {
|
|
3858
|
-
return this.
|
|
3859
|
-
return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
|
|
3860
|
-
}, this);
|
|
3905
|
+
return this._absoluteSources.slice();
|
|
3861
3906
|
}
|
|
3862
3907
|
});
|
|
3863
3908
|
|
|
@@ -4038,8 +4083,10 @@ BasicSourceMapConsumer.prototype.computeColumnSpans =
|
|
|
4038
4083
|
* source's line and column positions provided. The only argument is an object
|
|
4039
4084
|
* with the following properties:
|
|
4040
4085
|
*
|
|
4041
|
-
* - line: The line number in the generated source.
|
|
4042
|
-
*
|
|
4086
|
+
* - line: The line number in the generated source. The line number
|
|
4087
|
+
* is 1-based.
|
|
4088
|
+
* - column: The column number in the generated source. The column
|
|
4089
|
+
* number is 0-based.
|
|
4043
4090
|
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
4044
4091
|
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
4045
4092
|
* closest element that is smaller than or greater than the one we are
|
|
@@ -4049,8 +4096,10 @@ BasicSourceMapConsumer.prototype.computeColumnSpans =
|
|
|
4049
4096
|
* and an object is returned with the following properties:
|
|
4050
4097
|
*
|
|
4051
4098
|
* - source: The original source file, or null.
|
|
4052
|
-
* - line: The line number in the original source, or null.
|
|
4053
|
-
*
|
|
4099
|
+
* - line: The line number in the original source, or null. The
|
|
4100
|
+
* line number is 1-based.
|
|
4101
|
+
* - column: The column number in the original source, or null. The
|
|
4102
|
+
* column number is 0-based.
|
|
4054
4103
|
* - name: The original identifier, or null.
|
|
4055
4104
|
*/
|
|
4056
4105
|
BasicSourceMapConsumer.prototype.originalPositionFor =
|
|
@@ -4076,9 +4125,7 @@ BasicSourceMapConsumer.prototype.originalPositionFor =
|
|
|
4076
4125
|
var source = util.getArg(mapping, 'source', null);
|
|
4077
4126
|
if (source !== null) {
|
|
4078
4127
|
source = this._sources.at(source);
|
|
4079
|
-
|
|
4080
|
-
source = util.join(this.sourceRoot, source);
|
|
4081
|
-
}
|
|
4128
|
+
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
|
|
4082
4129
|
}
|
|
4083
4130
|
var name = util.getArg(mapping, 'name', null);
|
|
4084
4131
|
if (name !== null) {
|
|
@@ -4125,12 +4172,14 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
|
4125
4172
|
return null;
|
|
4126
4173
|
}
|
|
4127
4174
|
|
|
4128
|
-
|
|
4129
|
-
|
|
4175
|
+
var index = this._findSourceIndex(aSource);
|
|
4176
|
+
if (index >= 0) {
|
|
4177
|
+
return this.sourcesContent[index];
|
|
4130
4178
|
}
|
|
4131
4179
|
|
|
4132
|
-
|
|
4133
|
-
|
|
4180
|
+
var relativeSource = aSource;
|
|
4181
|
+
if (this.sourceRoot != null) {
|
|
4182
|
+
relativeSource = util.relative(this.sourceRoot, relativeSource);
|
|
4134
4183
|
}
|
|
4135
4184
|
|
|
4136
4185
|
var url;
|
|
@@ -4140,15 +4189,15 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
|
4140
4189
|
// many users. We can help them out when they expect file:// URIs to
|
|
4141
4190
|
// behave like it would if they were running a local HTTP server. See
|
|
4142
4191
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
|
|
4143
|
-
var fileUriAbsPath =
|
|
4192
|
+
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
4144
4193
|
if (url.scheme == "file"
|
|
4145
4194
|
&& this._sources.has(fileUriAbsPath)) {
|
|
4146
4195
|
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
|
|
4147
4196
|
}
|
|
4148
4197
|
|
|
4149
4198
|
if ((!url.path || url.path == "/")
|
|
4150
|
-
&& this._sources.has("/" +
|
|
4151
|
-
return this.sourcesContent[this._sources.indexOf("/" +
|
|
4199
|
+
&& this._sources.has("/" + relativeSource)) {
|
|
4200
|
+
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
4152
4201
|
}
|
|
4153
4202
|
}
|
|
4154
4203
|
|
|
@@ -4160,7 +4209,7 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
|
4160
4209
|
return null;
|
|
4161
4210
|
}
|
|
4162
4211
|
else {
|
|
4163
|
-
throw new Error('"' +
|
|
4212
|
+
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
|
|
4164
4213
|
}
|
|
4165
4214
|
};
|
|
4166
4215
|
|
|
@@ -4170,8 +4219,10 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
|
4170
4219
|
* the following properties:
|
|
4171
4220
|
*
|
|
4172
4221
|
* - source: The filename of the original source.
|
|
4173
|
-
* - line: The line number in the original source.
|
|
4174
|
-
*
|
|
4222
|
+
* - line: The line number in the original source. The line number
|
|
4223
|
+
* is 1-based.
|
|
4224
|
+
* - column: The column number in the original source. The column
|
|
4225
|
+
* number is 0-based.
|
|
4175
4226
|
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
|
|
4176
4227
|
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
|
|
4177
4228
|
* closest element that is smaller than or greater than the one we are
|
|
@@ -4180,23 +4231,22 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
|
|
|
4180
4231
|
*
|
|
4181
4232
|
* and an object is returned with the following properties:
|
|
4182
4233
|
*
|
|
4183
|
-
* - line: The line number in the generated source, or null.
|
|
4234
|
+
* - line: The line number in the generated source, or null. The
|
|
4235
|
+
* line number is 1-based.
|
|
4184
4236
|
* - column: The column number in the generated source, or null.
|
|
4237
|
+
* The column number is 0-based.
|
|
4185
4238
|
*/
|
|
4186
4239
|
BasicSourceMapConsumer.prototype.generatedPositionFor =
|
|
4187
4240
|
function SourceMapConsumer_generatedPositionFor(aArgs) {
|
|
4188
4241
|
var source = util.getArg(aArgs, 'source');
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
}
|
|
4192
|
-
if (!this._sources.has(source)) {
|
|
4242
|
+
source = this._findSourceIndex(source);
|
|
4243
|
+
if (source < 0) {
|
|
4193
4244
|
return {
|
|
4194
4245
|
line: null,
|
|
4195
4246
|
column: null,
|
|
4196
4247
|
lastColumn: null
|
|
4197
4248
|
};
|
|
4198
4249
|
}
|
|
4199
|
-
source = this._sources.indexOf(source);
|
|
4200
4250
|
|
|
4201
4251
|
var needle = {
|
|
4202
4252
|
source: source,
|
|
@@ -4240,7 +4290,7 @@ exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
|
|
|
4240
4290
|
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
|
|
4241
4291
|
* input.
|
|
4242
4292
|
*
|
|
4243
|
-
* The
|
|
4293
|
+
* The first parameter is a raw source map (either as a JSON string, or already
|
|
4244
4294
|
* parsed to an object). According to the spec for indexed source maps, they
|
|
4245
4295
|
* have the following attributes:
|
|
4246
4296
|
*
|
|
@@ -4277,12 +4327,16 @@ exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
|
|
|
4277
4327
|
* }],
|
|
4278
4328
|
* }
|
|
4279
4329
|
*
|
|
4330
|
+
* The second parameter, if given, is a string whose value is the URL
|
|
4331
|
+
* at which the source map was found. This URL is used to compute the
|
|
4332
|
+
* sources array.
|
|
4333
|
+
*
|
|
4280
4334
|
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
|
|
4281
4335
|
*/
|
|
4282
|
-
function IndexedSourceMapConsumer(aSourceMap) {
|
|
4336
|
+
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
|
|
4283
4337
|
var sourceMap = aSourceMap;
|
|
4284
4338
|
if (typeof aSourceMap === 'string') {
|
|
4285
|
-
sourceMap =
|
|
4339
|
+
sourceMap = util.parseSourceMapInput(aSourceMap);
|
|
4286
4340
|
}
|
|
4287
4341
|
|
|
4288
4342
|
var version = util.getArg(sourceMap, 'version');
|
|
@@ -4322,7 +4376,7 @@ function IndexedSourceMapConsumer(aSourceMap) {
|
|
|
4322
4376
|
generatedLine: offsetLine + 1,
|
|
4323
4377
|
generatedColumn: offsetColumn + 1
|
|
4324
4378
|
},
|
|
4325
|
-
consumer: new SourceMapConsumer(util.getArg(s, 'map'))
|
|
4379
|
+
consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
|
|
4326
4380
|
}
|
|
4327
4381
|
});
|
|
4328
4382
|
}
|
|
@@ -4355,14 +4409,18 @@ Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
|
|
|
4355
4409
|
* source's line and column positions provided. The only argument is an object
|
|
4356
4410
|
* with the following properties:
|
|
4357
4411
|
*
|
|
4358
|
-
* - line: The line number in the generated source.
|
|
4359
|
-
*
|
|
4412
|
+
* - line: The line number in the generated source. The line number
|
|
4413
|
+
* is 1-based.
|
|
4414
|
+
* - column: The column number in the generated source. The column
|
|
4415
|
+
* number is 0-based.
|
|
4360
4416
|
*
|
|
4361
4417
|
* and an object is returned with the following properties:
|
|
4362
4418
|
*
|
|
4363
4419
|
* - source: The original source file, or null.
|
|
4364
|
-
* - line: The line number in the original source, or null.
|
|
4365
|
-
*
|
|
4420
|
+
* - line: The line number in the original source, or null. The
|
|
4421
|
+
* line number is 1-based.
|
|
4422
|
+
* - column: The column number in the original source, or null. The
|
|
4423
|
+
* column number is 0-based.
|
|
4366
4424
|
* - name: The original identifier, or null.
|
|
4367
4425
|
*/
|
|
4368
4426
|
IndexedSourceMapConsumer.prototype.originalPositionFor =
|
|
@@ -4446,13 +4504,17 @@ IndexedSourceMapConsumer.prototype.sourceContentFor =
|
|
|
4446
4504
|
* the following properties:
|
|
4447
4505
|
*
|
|
4448
4506
|
* - source: The filename of the original source.
|
|
4449
|
-
* - line: The line number in the original source.
|
|
4450
|
-
*
|
|
4507
|
+
* - line: The line number in the original source. The line number
|
|
4508
|
+
* is 1-based.
|
|
4509
|
+
* - column: The column number in the original source. The column
|
|
4510
|
+
* number is 0-based.
|
|
4451
4511
|
*
|
|
4452
4512
|
* and an object is returned with the following properties:
|
|
4453
4513
|
*
|
|
4454
|
-
* - line: The line number in the generated source, or null.
|
|
4514
|
+
* - line: The line number in the generated source, or null. The
|
|
4515
|
+
* line number is 1-based.
|
|
4455
4516
|
* - column: The column number in the generated source, or null.
|
|
4517
|
+
* The column number is 0-based.
|
|
4456
4518
|
*/
|
|
4457
4519
|
IndexedSourceMapConsumer.prototype.generatedPositionFor =
|
|
4458
4520
|
function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
|
|
@@ -4461,7 +4523,7 @@ IndexedSourceMapConsumer.prototype.generatedPositionFor =
|
|
|
4461
4523
|
|
|
4462
4524
|
// Only consider this section if the requested source is in the list of
|
|
4463
4525
|
// sources of the consumer.
|
|
4464
|
-
if (section.consumer.
|
|
4526
|
+
if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
|
|
4465
4527
|
continue;
|
|
4466
4528
|
}
|
|
4467
4529
|
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
|
|
@@ -4500,15 +4562,16 @@ IndexedSourceMapConsumer.prototype._parseMappings =
|
|
|
4500
4562
|
var mapping = sectionMappings[j];
|
|
4501
4563
|
|
|
4502
4564
|
var source = section.consumer._sources.at(mapping.source);
|
|
4503
|
-
|
|
4504
|
-
source = util.join(section.consumer.sourceRoot, source);
|
|
4505
|
-
}
|
|
4565
|
+
source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
|
|
4506
4566
|
this._sources.add(source);
|
|
4507
4567
|
source = this._sources.indexOf(source);
|
|
4508
4568
|
|
|
4509
|
-
var name =
|
|
4510
|
-
|
|
4511
|
-
|
|
4569
|
+
var name = null;
|
|
4570
|
+
if (mapping.name) {
|
|
4571
|
+
name = section.consumer._names.at(mapping.name);
|
|
4572
|
+
this._names.add(name);
|
|
4573
|
+
name = this._names.indexOf(name);
|
|
4574
|
+
}
|
|
4512
4575
|
|
|
4513
4576
|
// The mappings coming from the consumer for the section have
|
|
4514
4577
|
// generated positions relative to the start of the section, so we
|
|
@@ -4615,6 +4678,15 @@ SourceMapGenerator.fromSourceMap =
|
|
|
4615
4678
|
generator.addMapping(newMapping);
|
|
4616
4679
|
});
|
|
4617
4680
|
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
|
4681
|
+
var sourceRelative = sourceFile;
|
|
4682
|
+
if (sourceRoot !== null) {
|
|
4683
|
+
sourceRelative = util.relative(sourceRoot, sourceFile);
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
if (!generator._sources.has(sourceRelative)) {
|
|
4687
|
+
generator._sources.add(sourceRelative);
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4618
4690
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
4619
4691
|
if (content != null) {
|
|
4620
4692
|
generator.setSourceContent(sourceFile, content);
|
|
@@ -5058,7 +5130,7 @@ SourceNode.fromStringWithSourceMap =
|
|
|
5058
5130
|
// There is no new line in between.
|
|
5059
5131
|
// Associate the code between "lastGeneratedColumn" and
|
|
5060
5132
|
// "mapping.generatedColumn" with "lastMapping"
|
|
5061
|
-
var nextLine = remainingLines[remainingLinesIndex];
|
|
5133
|
+
var nextLine = remainingLines[remainingLinesIndex] || '';
|
|
5062
5134
|
var code = nextLine.substr(0, mapping.generatedColumn -
|
|
5063
5135
|
lastGeneratedColumn);
|
|
5064
5136
|
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
|
|
@@ -5078,7 +5150,7 @@ SourceNode.fromStringWithSourceMap =
|
|
|
5078
5150
|
lastGeneratedLine++;
|
|
5079
5151
|
}
|
|
5080
5152
|
if (lastGeneratedColumn < mapping.generatedColumn) {
|
|
5081
|
-
var nextLine = remainingLines[remainingLinesIndex];
|
|
5153
|
+
var nextLine = remainingLines[remainingLinesIndex] || '';
|
|
5082
5154
|
node.add(nextLine.substr(0, mapping.generatedColumn));
|
|
5083
5155
|
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
|
|
5084
5156
|
lastGeneratedColumn = mapping.generatedColumn;
|
|
@@ -5402,7 +5474,7 @@ function getArg(aArgs, aName, aDefaultValue) {
|
|
|
5402
5474
|
}
|
|
5403
5475
|
exports.getArg = getArg;
|
|
5404
5476
|
|
|
5405
|
-
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w
|
|
5477
|
+
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
|
5406
5478
|
var dataUrlRegexp = /^data:.+\,.+$/;
|
|
5407
5479
|
|
|
5408
5480
|
function urlParse(aUrl) {
|
|
@@ -5558,7 +5630,7 @@ function join(aRoot, aPath) {
|
|
|
5558
5630
|
exports.join = join;
|
|
5559
5631
|
|
|
5560
5632
|
exports.isAbsolute = function (aPath) {
|
|
5561
|
-
return aPath.charAt(0) === '/' ||
|
|
5633
|
+
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
|
|
5562
5634
|
};
|
|
5563
5635
|
|
|
5564
5636
|
/**
|
|
@@ -5678,7 +5750,7 @@ function isProtoString(s) {
|
|
|
5678
5750
|
* stubbed out mapping.
|
|
5679
5751
|
*/
|
|
5680
5752
|
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
|
5681
|
-
var cmp = mappingA.source
|
|
5753
|
+
var cmp = strcmp(mappingA.source, mappingB.source);
|
|
5682
5754
|
if (cmp !== 0) {
|
|
5683
5755
|
return cmp;
|
|
5684
5756
|
}
|
|
@@ -5703,7 +5775,7 @@ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
|
|
5703
5775
|
return cmp;
|
|
5704
5776
|
}
|
|
5705
5777
|
|
|
5706
|
-
return mappingA.name
|
|
5778
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
5707
5779
|
}
|
|
5708
5780
|
exports.compareByOriginalPositions = compareByOriginalPositions;
|
|
5709
5781
|
|
|
@@ -5727,7 +5799,7 @@ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGene
|
|
|
5727
5799
|
return cmp;
|
|
5728
5800
|
}
|
|
5729
5801
|
|
|
5730
|
-
cmp = mappingA.source
|
|
5802
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
|
5731
5803
|
if (cmp !== 0) {
|
|
5732
5804
|
return cmp;
|
|
5733
5805
|
}
|
|
@@ -5742,7 +5814,7 @@ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGene
|
|
|
5742
5814
|
return cmp;
|
|
5743
5815
|
}
|
|
5744
5816
|
|
|
5745
|
-
return mappingA.name
|
|
5817
|
+
return strcmp(mappingA.name, mappingB.name);
|
|
5746
5818
|
}
|
|
5747
5819
|
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
|
5748
5820
|
|
|
@@ -5751,6 +5823,14 @@ function strcmp(aStr1, aStr2) {
|
|
|
5751
5823
|
return 0;
|
|
5752
5824
|
}
|
|
5753
5825
|
|
|
5826
|
+
if (aStr1 === null) {
|
|
5827
|
+
return 1; // aStr2 !== null
|
|
5828
|
+
}
|
|
5829
|
+
|
|
5830
|
+
if (aStr2 === null) {
|
|
5831
|
+
return -1; // aStr1 !== null
|
|
5832
|
+
}
|
|
5833
|
+
|
|
5754
5834
|
if (aStr1 > aStr2) {
|
|
5755
5835
|
return 1;
|
|
5756
5836
|
}
|
|
@@ -5792,6 +5872,69 @@ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
|
|
5792
5872
|
}
|
|
5793
5873
|
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
|
5794
5874
|
|
|
5875
|
+
/**
|
|
5876
|
+
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
|
5877
|
+
* in the source maps specification), and then parse the string as
|
|
5878
|
+
* JSON.
|
|
5879
|
+
*/
|
|
5880
|
+
function parseSourceMapInput(str) {
|
|
5881
|
+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
|
|
5882
|
+
}
|
|
5883
|
+
exports.parseSourceMapInput = parseSourceMapInput;
|
|
5884
|
+
|
|
5885
|
+
/**
|
|
5886
|
+
* Compute the URL of a source given the the source root, the source's
|
|
5887
|
+
* URL, and the source map's URL.
|
|
5888
|
+
*/
|
|
5889
|
+
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
|
5890
|
+
sourceURL = sourceURL || '';
|
|
5891
|
+
|
|
5892
|
+
if (sourceRoot) {
|
|
5893
|
+
// This follows what Chrome does.
|
|
5894
|
+
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
|
|
5895
|
+
sourceRoot += '/';
|
|
5896
|
+
}
|
|
5897
|
+
// The spec says:
|
|
5898
|
+
// Line 4: An optional source root, useful for relocating source
|
|
5899
|
+
// files on a server or removing repeated values in the
|
|
5900
|
+
// “sources” entry. This value is prepended to the individual
|
|
5901
|
+
// entries in the “source” field.
|
|
5902
|
+
sourceURL = sourceRoot + sourceURL;
|
|
5903
|
+
}
|
|
5904
|
+
|
|
5905
|
+
// Historically, SourceMapConsumer did not take the sourceMapURL as
|
|
5906
|
+
// a parameter. This mode is still somewhat supported, which is why
|
|
5907
|
+
// this code block is conditional. However, it's preferable to pass
|
|
5908
|
+
// the source map URL to SourceMapConsumer, so that this function
|
|
5909
|
+
// can implement the source URL resolution algorithm as outlined in
|
|
5910
|
+
// the spec. This block is basically the equivalent of:
|
|
5911
|
+
// new URL(sourceURL, sourceMapURL).toString()
|
|
5912
|
+
// ... except it avoids using URL, which wasn't available in the
|
|
5913
|
+
// older releases of node still supported by this library.
|
|
5914
|
+
//
|
|
5915
|
+
// The spec says:
|
|
5916
|
+
// If the sources are not absolute URLs after prepending of the
|
|
5917
|
+
// “sourceRoot”, the sources are resolved relative to the
|
|
5918
|
+
// SourceMap (like resolving script src in a html document).
|
|
5919
|
+
if (sourceMapURL) {
|
|
5920
|
+
var parsed = urlParse(sourceMapURL);
|
|
5921
|
+
if (!parsed) {
|
|
5922
|
+
throw new Error("sourceMapURL could not be parsed");
|
|
5923
|
+
}
|
|
5924
|
+
if (parsed.path) {
|
|
5925
|
+
// Strip the last path component, but keep the "/".
|
|
5926
|
+
var index = parsed.path.lastIndexOf('/');
|
|
5927
|
+
if (index >= 0) {
|
|
5928
|
+
parsed.path = parsed.path.substring(0, index + 1);
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
sourceURL = join(urlGenerate(parsed), sourceURL);
|
|
5932
|
+
}
|
|
5933
|
+
|
|
5934
|
+
return normalize(sourceURL);
|
|
5935
|
+
}
|
|
5936
|
+
exports.computeSourceURL = computeSourceURL;
|
|
5937
|
+
|
|
5795
5938
|
},{}],18:[function(require,module,exports){
|
|
5796
5939
|
/*
|
|
5797
5940
|
* Copyright 2009-2011 Mozilla Foundation and contributors
|
|
@@ -5809,7 +5952,7 @@ exports.SourceNode = require('./lib/source-node').SourceNode;
|
|
|
5809
5952
|
// to do so, `run bin/build-browser-source-map-support`
|
|
5810
5953
|
|
|
5811
5954
|
// The following is taken and adapted from the work of Evan Wallace
|
|
5812
|
-
// https://github.com/evanw/node-source-map-support v0.5.
|
|
5955
|
+
// https://github.com/evanw/node-source-map-support v0.5.19
|
|
5813
5956
|
|
|
5814
5957
|
// The MIT License (MIT)
|
|
5815
5958
|
//
|
|
@@ -5849,6 +5992,16 @@ try {
|
|
|
5849
5992
|
|
|
5850
5993
|
var bufferFrom = require('buffer-from');
|
|
5851
5994
|
|
|
5995
|
+
/**
|
|
5996
|
+
* Requires a module which is protected against bundler minification.
|
|
5997
|
+
*
|
|
5998
|
+
* @param {NodeModule} mod
|
|
5999
|
+
* @param {string} request
|
|
6000
|
+
*/
|
|
6001
|
+
function dynamicRequire(mod, request) {
|
|
6002
|
+
return mod.require(request);
|
|
6003
|
+
}
|
|
6004
|
+
|
|
5852
6005
|
// Only install once if called multiple times
|
|
5853
6006
|
var errorFormatterInstalled = false;
|
|
5854
6007
|
var uncaughtShimInstalled = false;
|
|
@@ -5975,7 +6128,7 @@ function retrieveSourceMapURL(source) {
|
|
|
5975
6128
|
|
|
5976
6129
|
// Get the URL of the source map
|
|
5977
6130
|
fileData = retrieveFile(source);
|
|
5978
|
-
var re = /(?:\/\/[@#][
|
|
6131
|
+
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
|
|
5979
6132
|
// Keep executing the search to find the *last* sourceMappingURL to avoid
|
|
5980
6133
|
// picking up sourceMappingURLs from comments, strings, etc.
|
|
5981
6134
|
var lastMatch, match;
|
|
@@ -6186,8 +6339,13 @@ function cloneCallSite(frame) {
|
|
|
6186
6339
|
return object;
|
|
6187
6340
|
}
|
|
6188
6341
|
|
|
6189
|
-
function wrapCallSite(frame) {
|
|
6342
|
+
function wrapCallSite(frame, state) {
|
|
6343
|
+
// provides interface backward compatibility
|
|
6344
|
+
if (state === undefined) {
|
|
6345
|
+
state = { nextPosition: null, curPosition: null }
|
|
6346
|
+
}
|
|
6190
6347
|
if(frame.isNative()) {
|
|
6348
|
+
state.curPosition = null;
|
|
6191
6349
|
return frame;
|
|
6192
6350
|
}
|
|
6193
6351
|
|
|
@@ -6201,7 +6359,11 @@ function wrapCallSite(frame) {
|
|
|
6201
6359
|
|
|
6202
6360
|
// Fix position in Node where some (internal) code is prepended.
|
|
6203
6361
|
// See https://github.com/evanw/node-source-map-support/issues/36
|
|
6204
|
-
|
|
6362
|
+
// Header removed in node at ^10.16 || >=11.11.0
|
|
6363
|
+
// v11 is not an LTS candidate, we can just test the one version with it.
|
|
6364
|
+
// Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
|
|
6365
|
+
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
|
|
6366
|
+
var headerLength = noHeader.test(process.version) ? 0 : 62;
|
|
6205
6367
|
if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
|
|
6206
6368
|
column -= headerLength;
|
|
6207
6369
|
}
|
|
@@ -6211,9 +6373,15 @@ function wrapCallSite(frame) {
|
|
|
6211
6373
|
line: line,
|
|
6212
6374
|
column: column
|
|
6213
6375
|
});
|
|
6376
|
+
state.curPosition = position;
|
|
6214
6377
|
frame = cloneCallSite(frame);
|
|
6215
6378
|
var originalFunctionName = frame.getFunctionName;
|
|
6216
|
-
frame.getFunctionName = function() {
|
|
6379
|
+
frame.getFunctionName = function() {
|
|
6380
|
+
if (state.nextPosition == null) {
|
|
6381
|
+
return originalFunctionName();
|
|
6382
|
+
}
|
|
6383
|
+
return state.nextPosition.name || originalFunctionName();
|
|
6384
|
+
};
|
|
6217
6385
|
frame.getFileName = function() { return position.source; };
|
|
6218
6386
|
frame.getLineNumber = function() { return position.line; };
|
|
6219
6387
|
frame.getColumnNumber = function() { return position.column + 1; };
|
|
@@ -6246,9 +6414,14 @@ function prepareStackTrace(error, stack) {
|
|
|
6246
6414
|
var message = error.message || '';
|
|
6247
6415
|
var errorString = name + ": " + message;
|
|
6248
6416
|
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6417
|
+
var state = { nextPosition: null, curPosition: null };
|
|
6418
|
+
var processedStack = [];
|
|
6419
|
+
for (var i = stack.length - 1; i >= 0; i--) {
|
|
6420
|
+
processedStack.push('\n from ' + wrapCallSite(stack[i], state));
|
|
6421
|
+
state.nextPosition = state.curPosition;
|
|
6422
|
+
}
|
|
6423
|
+
state.curPosition = state.nextPosition = null;
|
|
6424
|
+
return errorString + processedStack.reverse().join('');
|
|
6252
6425
|
}
|
|
6253
6426
|
|
|
6254
6427
|
// Generate position and snippet of original source with pointer
|
|
@@ -6291,12 +6464,17 @@ function printErrorAndExit (error) {
|
|
|
6291
6464
|
process.stderr._handle.setBlocking(true);
|
|
6292
6465
|
}
|
|
6293
6466
|
|
|
6294
|
-
if (
|
|
6295
|
-
console.error();
|
|
6296
|
-
console.error(source);
|
|
6467
|
+
if (typeof error.$full_message === 'function') {
|
|
6468
|
+
console.error(error.$full_message().$chomp());
|
|
6297
6469
|
}
|
|
6470
|
+
else {
|
|
6471
|
+
if (source) {
|
|
6472
|
+
console.error();
|
|
6473
|
+
console.error(source);
|
|
6474
|
+
}
|
|
6298
6475
|
|
|
6299
|
-
|
|
6476
|
+
console.error(error.stack);
|
|
6477
|
+
}
|
|
6300
6478
|
process.exit(1);
|
|
6301
6479
|
}
|
|
6302
6480
|
|
|
@@ -6357,12 +6535,8 @@ exports.install = function(options) {
|
|
|
6357
6535
|
|
|
6358
6536
|
// Support runtime transpilers that include inline source maps
|
|
6359
6537
|
if (options.hookRequire && !isInBrowser()) {
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
Module = require('module');
|
|
6363
|
-
} catch (err) {
|
|
6364
|
-
// NOP: Loading in catch block to convert webpack error to warning.
|
|
6365
|
-
}
|
|
6538
|
+
// Use dynamicRequire to avoid including in browser bundles
|
|
6539
|
+
var Module = dynamicRequire(module, 'module');
|
|
6366
6540
|
var $compile = Module.prototype._compile;
|
|
6367
6541
|
|
|
6368
6542
|
if (!$compile.__sourceMapSupport) {
|
|
@@ -6392,6 +6566,17 @@ exports.install = function(options) {
|
|
|
6392
6566
|
var installHandler = 'handleUncaughtExceptions' in options ?
|
|
6393
6567
|
options.handleUncaughtExceptions : true;
|
|
6394
6568
|
|
|
6569
|
+
// Do not override 'uncaughtException' with our own handler in Node.js
|
|
6570
|
+
// Worker threads. Workers pass the error to the main thread as an event,
|
|
6571
|
+
// rather than printing something to stderr and exiting.
|
|
6572
|
+
try {
|
|
6573
|
+
// We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify.
|
|
6574
|
+
var worker_threads = dynamicRequire(module, 'worker_threads');
|
|
6575
|
+
if (worker_threads.isMainThread === false) {
|
|
6576
|
+
installHandler = false;
|
|
6577
|
+
}
|
|
6578
|
+
} catch(e) {}
|
|
6579
|
+
|
|
6395
6580
|
// Provide the option to not install the uncaught exception handler. This is
|
|
6396
6581
|
// to support other uncaught exception handlers (in test frameworks, for
|
|
6397
6582
|
// example). If this handler is not installed and there are no other uncaught
|
|
@@ -6447,5 +6632,5 @@ exports.install();
|
|
|
6447
6632
|
// /Users/elia/Code/opal/lib/opal/cli_runners/system_runner.rb:43:in `call': unhandled exception
|
|
6448
6633
|
|
|
6449
6634
|
}).call(this)}).call(this,require('_process'))
|
|
6450
|
-
},{"_process":7,"buffer-from":3,"fs":2,"
|
|
6635
|
+
},{"_process":7,"buffer-from":3,"fs":2,"path":6,"source-map":18}]},{},[])("/lib/opal/cli_runners/source-map-support.js")
|
|
6451
6636
|
});
|