aboutsummaryrefslogtreecommitdiff
path: root/test/sourcemaps.js
blob: 7db4672e09ae9467405bafc30662032786af025b (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var UglifyJS = require("..");
var ok = require("assert");

module.exports = function () {
    console.log("--- Sourcemaps tests");

    var basic = source_map([
        'var x = 1 + 1;'
    ].join('\n'));

    ok.equal(basic.version, 3);
    ok.deepEqual(basic.names, ['x']);

    var issue836 = source_map([
        "({",
        "    get enabled() {",
        "        return 3;",
        "    },",
        "    set enabled(x) {",
        "        ;",
        "    }",
        "});",
    ].join("\n"));

    ok.deepEqual(issue836.names, ['enabled', 'x']);
}

function source_map(js) {
    var source_map = UglifyJS.SourceMap();
    var stream = UglifyJS.OutputStream({ source_map: source_map });
    var parsed = UglifyJS.parse(js);
    parsed.print(stream);
    return JSON.parse(source_map.toString());
}

// Run standalone
if (module.parent === null) {
    module.exports();
}

d colspan='3' class='logmsg'> fixes #3598 2019-11-19fix corner case in `collapse_vars` (#3597)Alex Lam S.L fixes #3596 2019-11-18fix corner case in `inline` (#3595)Alex Lam S.L 2019-11-18fix corner case in `unsafe_math` (#3594)Alex Lam S.L fixes #3593 2019-11-17fix corner case in `reduce_funcs` (#3592)Alex Lam S.L 2019-11-17fix corner case in `collapse_vars` (#3591)Alex Lam S.L 2019-11-17compress empty for-in loops (#3590)Alex Lam S.L 2019-11-17refine precision limits on `unsafe_math` (#3589)Alex Lam S.L 2019-11-16introduce eager evaluation (#3587)Alex Lam S.L 2019-11-14migrate to GitHub Actions (#3586)Alex Lam S.L 2019-11-14fix corner case in `switches` (#3585)Alex Lam S.L 2019-11-13enhance `unused` (#3584)Alex Lam S.L 2019-11-13enhance `switches` (#3583)Alex Lam S.L 2019-11-13fix corner case in `collapse_vars` (#3582)Alex Lam S.L fixes #3581 2019-11-13enhance `evaluate` & `inline` (#3580)Alex Lam S.L 2019-11-12fix corner case in `dead_code` (#3579)Alex Lam S.L fixes #3578 2019-11-09fix corner case in `conditionals` (#3577)Alex Lam S.L fixes #3576 2019-11-08enhance `dead_code` (#3575)Alex Lam S.L 2019-11-07fix corner case in `collapse_vars` (#3574)Alex Lam S.L fixes #3573 2019-11-05enhance `collapse_vars` (#3572)Alex Lam S.L 2019-11-04fix corner case in `evaluate` (#3569)Alex Lam S.L 2019-11-02enhance `unsafe` `evaluate` (#3564)Alex Lam S.L 2019-11-02more tests for #3562 (#3565)Alex Lam S.L 2019-11-01fix corner case in `collapse_vars` (#3563)Alex Lam S.L fixes #3562 2019-11-01enhance `if_return` (#3560)Alex Lam S.L 2019-11-01fix corner case in `evaluate` (#3559)Alex Lam S.L fixes #3558 2019-10-31enhance `conditionals` (#3557)Alex Lam S.L 2019-10-31enhance `typeofs` (#3556)Alex Lam S.L 2019-10-30fix corner case in `dead_code` (#3553)Alex Lam S.L fixes #3552 2019-10-30enhance `dead_code` (#3551)Alex Lam S.L 2019-10-30fix corner case in `comments` (#3550)Alex Lam S.L 2019-10-29enhance `evaluate` (#3549)Alex Lam S.L 2019-10-29fix corner case in `unsafe_math` (#3548)Alex Lam S.L fixes #3547 2019-10-29compress object literals (#3546)Alex Lam S.L 2019-10-28fix corner case in `ie8` (#3543)Alex Lam S.L fixes #3542 2019-10-28fix corner case in `evaluate` (#3540)Alex Lam S.L fixes #3539 2019-10-28improve ufuzz resilience (#3541)Alex Lam S.L 2019-10-28fix corner case in ufuzz (#3538)Alex Lam S.L 2019-10-28fix & enhance `unsafe_math` (#3537)Alex Lam S.L closes #3535 fixes #3536 2019-10-27migrate CI workaround (#3534)Alex Lam S.L 2019-10-27improve ufuzz resilience (#3533)Alex Lam S.L 2019-10-27fix corner cases in `unsafe_math` (#3532)Alex Lam S.L fixes #3531 2019-10-27prevent tty truncation in `test/compress` (#3530)Alex Lam S.L