traceur-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/js/compile.js +7 -15
- data/lib/traceur.rb +2 -1
- data/lib/traceur/compilation_error.rb +27 -0
- data/lib/traceur/compiler.rb +4 -1
- data/lib/traceur/configuration.rb +1 -1
- data/lib/traceur/node/runner.rb +1 -1
- data/lib/traceur/version.rb +1 -1
- data/spec/examples/syntax_error.js +3 -0
- data/spec/integration/examples_spec.rb +6 -0
- data/vendor/node_modules/traceur/LICENSE +202 -0
- data/vendor/node_modules/traceur/README.md +5 -5
- data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
- data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
- data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
- data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
- data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
- data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
- data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
- data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
- data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
- data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
- data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
- data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
- data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
- data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
- data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
- data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
- data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
- data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
- data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
- data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
- data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
- data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
- data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
- data/vendor/node_modules/traceur/package.json +234 -20
- data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
- data/vendor/node_modules/traceur/src/node/System.js +32 -5
- data/vendor/node_modules/traceur/src/node/api.js +28 -93
- data/vendor/node_modules/traceur/src/node/command.js +84 -19
- data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
- data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
- data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
- data/vendor/node_modules/traceur/src/node/require.js +7 -21
- data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
- data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
- data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
- data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
- metadata +196 -190
- data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
- data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
- data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
- data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
- data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
- data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
- data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
- data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
- data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
- data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
- data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
- data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
- data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
- data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
- data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
- data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
- data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
- data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
- data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
- data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -0,0 +1,417 @@
|
|
1
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
4
|
+
* Licensed under the New BSD license. See LICENSE or:
|
5
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
6
|
+
*/
|
7
|
+
if (typeof define !== 'function') {
|
8
|
+
var define = require('amdefine')(module, require);
|
9
|
+
}
|
10
|
+
define(function (require, exports, module) {
|
11
|
+
|
12
|
+
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
|
13
|
+
var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
|
14
|
+
var SourceNode = require('../../lib/source-map/source-node').SourceNode;
|
15
|
+
var util = require('./util');
|
16
|
+
|
17
|
+
exports['test some simple stuff'] = function (assert, util) {
|
18
|
+
var map = new SourceMapGenerator({
|
19
|
+
file: 'foo.js',
|
20
|
+
sourceRoot: '.'
|
21
|
+
});
|
22
|
+
assert.ok(true);
|
23
|
+
};
|
24
|
+
|
25
|
+
exports['test JSON serialization'] = function (assert, util) {
|
26
|
+
var map = new SourceMapGenerator({
|
27
|
+
file: 'foo.js',
|
28
|
+
sourceRoot: '.'
|
29
|
+
});
|
30
|
+
assert.equal(map.toString(), JSON.stringify(map));
|
31
|
+
};
|
32
|
+
|
33
|
+
exports['test adding mappings (case 1)'] = function (assert, util) {
|
34
|
+
var map = new SourceMapGenerator({
|
35
|
+
file: 'generated-foo.js',
|
36
|
+
sourceRoot: '.'
|
37
|
+
});
|
38
|
+
|
39
|
+
assert.doesNotThrow(function () {
|
40
|
+
map.addMapping({
|
41
|
+
generated: { line: 1, column: 1 }
|
42
|
+
});
|
43
|
+
});
|
44
|
+
};
|
45
|
+
|
46
|
+
exports['test adding mappings (case 2)'] = function (assert, util) {
|
47
|
+
var map = new SourceMapGenerator({
|
48
|
+
file: 'generated-foo.js',
|
49
|
+
sourceRoot: '.'
|
50
|
+
});
|
51
|
+
|
52
|
+
assert.doesNotThrow(function () {
|
53
|
+
map.addMapping({
|
54
|
+
generated: { line: 1, column: 1 },
|
55
|
+
source: 'bar.js',
|
56
|
+
original: { line: 1, column: 1 }
|
57
|
+
});
|
58
|
+
});
|
59
|
+
};
|
60
|
+
|
61
|
+
exports['test adding mappings (case 3)'] = function (assert, util) {
|
62
|
+
var map = new SourceMapGenerator({
|
63
|
+
file: 'generated-foo.js',
|
64
|
+
sourceRoot: '.'
|
65
|
+
});
|
66
|
+
|
67
|
+
assert.doesNotThrow(function () {
|
68
|
+
map.addMapping({
|
69
|
+
generated: { line: 1, column: 1 },
|
70
|
+
source: 'bar.js',
|
71
|
+
original: { line: 1, column: 1 },
|
72
|
+
name: 'someToken'
|
73
|
+
});
|
74
|
+
});
|
75
|
+
};
|
76
|
+
|
77
|
+
exports['test adding mappings (invalid)'] = function (assert, util) {
|
78
|
+
var map = new SourceMapGenerator({
|
79
|
+
file: 'generated-foo.js',
|
80
|
+
sourceRoot: '.'
|
81
|
+
});
|
82
|
+
|
83
|
+
// Not enough info.
|
84
|
+
assert.throws(function () {
|
85
|
+
map.addMapping({});
|
86
|
+
});
|
87
|
+
|
88
|
+
// Original file position, but no source.
|
89
|
+
assert.throws(function () {
|
90
|
+
map.addMapping({
|
91
|
+
generated: { line: 1, column: 1 },
|
92
|
+
original: { line: 1, column: 1 }
|
93
|
+
});
|
94
|
+
});
|
95
|
+
};
|
96
|
+
|
97
|
+
exports['test that the correct mappings are being generated'] = function (assert, util) {
|
98
|
+
var map = new SourceMapGenerator({
|
99
|
+
file: 'min.js',
|
100
|
+
sourceRoot: '/the/root'
|
101
|
+
});
|
102
|
+
|
103
|
+
map.addMapping({
|
104
|
+
generated: { line: 1, column: 1 },
|
105
|
+
original: { line: 1, column: 1 },
|
106
|
+
source: 'one.js'
|
107
|
+
});
|
108
|
+
map.addMapping({
|
109
|
+
generated: { line: 1, column: 5 },
|
110
|
+
original: { line: 1, column: 5 },
|
111
|
+
source: 'one.js'
|
112
|
+
});
|
113
|
+
map.addMapping({
|
114
|
+
generated: { line: 1, column: 9 },
|
115
|
+
original: { line: 1, column: 11 },
|
116
|
+
source: 'one.js'
|
117
|
+
});
|
118
|
+
map.addMapping({
|
119
|
+
generated: { line: 1, column: 18 },
|
120
|
+
original: { line: 1, column: 21 },
|
121
|
+
source: 'one.js',
|
122
|
+
name: 'bar'
|
123
|
+
});
|
124
|
+
map.addMapping({
|
125
|
+
generated: { line: 1, column: 21 },
|
126
|
+
original: { line: 2, column: 3 },
|
127
|
+
source: 'one.js'
|
128
|
+
});
|
129
|
+
map.addMapping({
|
130
|
+
generated: { line: 1, column: 28 },
|
131
|
+
original: { line: 2, column: 10 },
|
132
|
+
source: 'one.js',
|
133
|
+
name: 'baz'
|
134
|
+
});
|
135
|
+
map.addMapping({
|
136
|
+
generated: { line: 1, column: 32 },
|
137
|
+
original: { line: 2, column: 14 },
|
138
|
+
source: 'one.js',
|
139
|
+
name: 'bar'
|
140
|
+
});
|
141
|
+
|
142
|
+
map.addMapping({
|
143
|
+
generated: { line: 2, column: 1 },
|
144
|
+
original: { line: 1, column: 1 },
|
145
|
+
source: 'two.js'
|
146
|
+
});
|
147
|
+
map.addMapping({
|
148
|
+
generated: { line: 2, column: 5 },
|
149
|
+
original: { line: 1, column: 5 },
|
150
|
+
source: 'two.js'
|
151
|
+
});
|
152
|
+
map.addMapping({
|
153
|
+
generated: { line: 2, column: 9 },
|
154
|
+
original: { line: 1, column: 11 },
|
155
|
+
source: 'two.js'
|
156
|
+
});
|
157
|
+
map.addMapping({
|
158
|
+
generated: { line: 2, column: 18 },
|
159
|
+
original: { line: 1, column: 21 },
|
160
|
+
source: 'two.js',
|
161
|
+
name: 'n'
|
162
|
+
});
|
163
|
+
map.addMapping({
|
164
|
+
generated: { line: 2, column: 21 },
|
165
|
+
original: { line: 2, column: 3 },
|
166
|
+
source: 'two.js'
|
167
|
+
});
|
168
|
+
map.addMapping({
|
169
|
+
generated: { line: 2, column: 28 },
|
170
|
+
original: { line: 2, column: 10 },
|
171
|
+
source: 'two.js',
|
172
|
+
name: 'n'
|
173
|
+
});
|
174
|
+
|
175
|
+
map = JSON.parse(map.toString());
|
176
|
+
|
177
|
+
util.assertEqualMaps(assert, map, util.testMap);
|
178
|
+
};
|
179
|
+
|
180
|
+
exports['test that source content can be set'] = function (assert, util) {
|
181
|
+
var map = new SourceMapGenerator({
|
182
|
+
file: 'min.js',
|
183
|
+
sourceRoot: '/the/root'
|
184
|
+
});
|
185
|
+
map.addMapping({
|
186
|
+
generated: { line: 1, column: 1 },
|
187
|
+
original: { line: 1, column: 1 },
|
188
|
+
source: 'one.js'
|
189
|
+
});
|
190
|
+
map.addMapping({
|
191
|
+
generated: { line: 2, column: 1 },
|
192
|
+
original: { line: 1, column: 1 },
|
193
|
+
source: 'two.js'
|
194
|
+
});
|
195
|
+
map.setSourceContent('one.js', 'one file content');
|
196
|
+
|
197
|
+
map = JSON.parse(map.toString());
|
198
|
+
assert.equal(map.sources[0], 'one.js');
|
199
|
+
assert.equal(map.sources[1], 'two.js');
|
200
|
+
assert.equal(map.sourcesContent[0], 'one file content');
|
201
|
+
assert.equal(map.sourcesContent[1], null);
|
202
|
+
};
|
203
|
+
|
204
|
+
exports['test .fromSourceMap'] = function (assert, util) {
|
205
|
+
var map = SourceMapGenerator.fromSourceMap(new SourceMapConsumer(util.testMap));
|
206
|
+
util.assertEqualMaps(assert, map.toJSON(), util.testMap);
|
207
|
+
};
|
208
|
+
|
209
|
+
exports['test .fromSourceMap with sourcesContent'] = function (assert, util) {
|
210
|
+
var map = SourceMapGenerator.fromSourceMap(
|
211
|
+
new SourceMapConsumer(util.testMapWithSourcesContent));
|
212
|
+
util.assertEqualMaps(assert, map.toJSON(), util.testMapWithSourcesContent);
|
213
|
+
};
|
214
|
+
|
215
|
+
exports['test applySourceMap'] = function (assert, util) {
|
216
|
+
var node = new SourceNode(null, null, null, [
|
217
|
+
new SourceNode(2, 0, 'fileX', 'lineX2\n'),
|
218
|
+
'genA1\n',
|
219
|
+
new SourceNode(2, 0, 'fileY', 'lineY2\n'),
|
220
|
+
'genA2\n',
|
221
|
+
new SourceNode(1, 0, 'fileX', 'lineX1\n'),
|
222
|
+
'genA3\n',
|
223
|
+
new SourceNode(1, 0, 'fileY', 'lineY1\n')
|
224
|
+
]);
|
225
|
+
var mapStep1 = node.toStringWithSourceMap({
|
226
|
+
file: 'fileA'
|
227
|
+
}).map;
|
228
|
+
mapStep1.setSourceContent('fileX', 'lineX1\nlineX2\n');
|
229
|
+
mapStep1 = mapStep1.toJSON();
|
230
|
+
|
231
|
+
node = new SourceNode(null, null, null, [
|
232
|
+
'gen1\n',
|
233
|
+
new SourceNode(1, 0, 'fileA', 'lineA1\n'),
|
234
|
+
new SourceNode(2, 0, 'fileA', 'lineA2\n'),
|
235
|
+
new SourceNode(3, 0, 'fileA', 'lineA3\n'),
|
236
|
+
new SourceNode(4, 0, 'fileA', 'lineA4\n'),
|
237
|
+
new SourceNode(1, 0, 'fileB', 'lineB1\n'),
|
238
|
+
new SourceNode(2, 0, 'fileB', 'lineB2\n'),
|
239
|
+
'gen2\n'
|
240
|
+
]);
|
241
|
+
var mapStep2 = node.toStringWithSourceMap({
|
242
|
+
file: 'fileGen'
|
243
|
+
}).map;
|
244
|
+
mapStep2.setSourceContent('fileB', 'lineB1\nlineB2\n');
|
245
|
+
mapStep2 = mapStep2.toJSON();
|
246
|
+
|
247
|
+
node = new SourceNode(null, null, null, [
|
248
|
+
'gen1\n',
|
249
|
+
new SourceNode(2, 0, 'fileX', 'lineA1\n'),
|
250
|
+
new SourceNode(2, 0, 'fileA', 'lineA2\n'),
|
251
|
+
new SourceNode(2, 0, 'fileY', 'lineA3\n'),
|
252
|
+
new SourceNode(4, 0, 'fileA', 'lineA4\n'),
|
253
|
+
new SourceNode(1, 0, 'fileB', 'lineB1\n'),
|
254
|
+
new SourceNode(2, 0, 'fileB', 'lineB2\n'),
|
255
|
+
'gen2\n'
|
256
|
+
]);
|
257
|
+
var expectedMap = node.toStringWithSourceMap({
|
258
|
+
file: 'fileGen'
|
259
|
+
}).map;
|
260
|
+
expectedMap.setSourceContent('fileX', 'lineX1\nlineX2\n');
|
261
|
+
expectedMap.setSourceContent('fileB', 'lineB1\nlineB2\n');
|
262
|
+
expectedMap = expectedMap.toJSON();
|
263
|
+
|
264
|
+
// apply source map "mapStep1" to "mapStep2"
|
265
|
+
var generator = SourceMapGenerator.fromSourceMap(new SourceMapConsumer(mapStep2));
|
266
|
+
generator.applySourceMap(new SourceMapConsumer(mapStep1));
|
267
|
+
var actualMap = generator.toJSON();
|
268
|
+
|
269
|
+
util.assertEqualMaps(assert, actualMap, expectedMap);
|
270
|
+
};
|
271
|
+
|
272
|
+
exports['test sorting with duplicate generated mappings'] = function (assert, util) {
|
273
|
+
var map = new SourceMapGenerator({
|
274
|
+
file: 'test.js'
|
275
|
+
});
|
276
|
+
map.addMapping({
|
277
|
+
generated: { line: 3, column: 0 },
|
278
|
+
original: { line: 2, column: 0 },
|
279
|
+
source: 'a.js'
|
280
|
+
});
|
281
|
+
map.addMapping({
|
282
|
+
generated: { line: 2, column: 0 }
|
283
|
+
});
|
284
|
+
map.addMapping({
|
285
|
+
generated: { line: 2, column: 0 }
|
286
|
+
});
|
287
|
+
map.addMapping({
|
288
|
+
generated: { line: 1, column: 0 },
|
289
|
+
original: { line: 1, column: 0 },
|
290
|
+
source: 'a.js'
|
291
|
+
});
|
292
|
+
|
293
|
+
util.assertEqualMaps(assert, map.toJSON(), {
|
294
|
+
version: 3,
|
295
|
+
file: 'test.js',
|
296
|
+
sources: ['a.js'],
|
297
|
+
names: [],
|
298
|
+
mappings: 'AAAA;A;AACA'
|
299
|
+
});
|
300
|
+
};
|
301
|
+
|
302
|
+
exports['test ignore duplicate mappings.'] = function (assert, util) {
|
303
|
+
var init = { file: 'min.js', sourceRoot: '/the/root' };
|
304
|
+
var map1, map2;
|
305
|
+
|
306
|
+
// null original source location
|
307
|
+
var nullMapping1 = {
|
308
|
+
generated: { line: 1, column: 0 }
|
309
|
+
};
|
310
|
+
var nullMapping2 = {
|
311
|
+
generated: { line: 2, column: 2 }
|
312
|
+
};
|
313
|
+
|
314
|
+
map1 = new SourceMapGenerator(init);
|
315
|
+
map2 = new SourceMapGenerator(init);
|
316
|
+
|
317
|
+
map1.addMapping(nullMapping1);
|
318
|
+
map1.addMapping(nullMapping1);
|
319
|
+
|
320
|
+
map2.addMapping(nullMapping1);
|
321
|
+
|
322
|
+
util.assertEqualMaps(assert, map1.toJSON(), map2.toJSON());
|
323
|
+
|
324
|
+
map1.addMapping(nullMapping2);
|
325
|
+
map1.addMapping(nullMapping1);
|
326
|
+
|
327
|
+
map2.addMapping(nullMapping2);
|
328
|
+
|
329
|
+
util.assertEqualMaps(assert, map1.toJSON(), map2.toJSON());
|
330
|
+
|
331
|
+
// original source location
|
332
|
+
var srcMapping1 = {
|
333
|
+
generated: { line: 1, column: 0 },
|
334
|
+
original: { line: 11, column: 0 },
|
335
|
+
source: 'srcMapping1.js'
|
336
|
+
};
|
337
|
+
var srcMapping2 = {
|
338
|
+
generated: { line: 2, column: 2 },
|
339
|
+
original: { line: 11, column: 0 },
|
340
|
+
source: 'srcMapping2.js'
|
341
|
+
};
|
342
|
+
|
343
|
+
map1 = new SourceMapGenerator(init);
|
344
|
+
map2 = new SourceMapGenerator(init);
|
345
|
+
|
346
|
+
map1.addMapping(srcMapping1);
|
347
|
+
map1.addMapping(srcMapping1);
|
348
|
+
|
349
|
+
map2.addMapping(srcMapping1);
|
350
|
+
|
351
|
+
util.assertEqualMaps(assert, map1.toJSON(), map2.toJSON());
|
352
|
+
|
353
|
+
map1.addMapping(srcMapping2);
|
354
|
+
map1.addMapping(srcMapping1);
|
355
|
+
|
356
|
+
map2.addMapping(srcMapping2);
|
357
|
+
|
358
|
+
util.assertEqualMaps(assert, map1.toJSON(), map2.toJSON());
|
359
|
+
|
360
|
+
// full original source and name information
|
361
|
+
var fullMapping1 = {
|
362
|
+
generated: { line: 1, column: 0 },
|
363
|
+
original: { line: 11, column: 0 },
|
364
|
+
source: 'fullMapping1.js',
|
365
|
+
name: 'fullMapping1'
|
366
|
+
};
|
367
|
+
var fullMapping2 = {
|
368
|
+
generated: { line: 2, column: 2 },
|
369
|
+
original: { line: 11, column: 0 },
|
370
|
+
source: 'fullMapping2.js',
|
371
|
+
name: 'fullMapping2'
|
372
|
+
};
|
373
|
+
|
374
|
+
map1 = new SourceMapGenerator(init);
|
375
|
+
map2 = new SourceMapGenerator(init);
|
376
|
+
|
377
|
+
map1.addMapping(fullMapping1);
|
378
|
+
map1.addMapping(fullMapping1);
|
379
|
+
|
380
|
+
map2.addMapping(fullMapping1);
|
381
|
+
|
382
|
+
util.assertEqualMaps(assert, map1.toJSON(), map2.toJSON());
|
383
|
+
|
384
|
+
map1.addMapping(fullMapping2);
|
385
|
+
map1.addMapping(fullMapping1);
|
386
|
+
|
387
|
+
map2.addMapping(fullMapping2);
|
388
|
+
|
389
|
+
util.assertEqualMaps(assert, map1.toJSON(), map2.toJSON());
|
390
|
+
};
|
391
|
+
|
392
|
+
exports['test github issue #72, check for duplicate names or sources'] = function (assert, util) {
|
393
|
+
var map = new SourceMapGenerator({
|
394
|
+
file: 'test.js'
|
395
|
+
});
|
396
|
+
map.addMapping({
|
397
|
+
generated: { line: 1, column: 1 },
|
398
|
+
original: { line: 2, column: 2 },
|
399
|
+
source: 'a.js',
|
400
|
+
name: 'foo'
|
401
|
+
});
|
402
|
+
map.addMapping({
|
403
|
+
generated: { line: 3, column: 3 },
|
404
|
+
original: { line: 4, column: 4 },
|
405
|
+
source: 'a.js',
|
406
|
+
name: 'foo'
|
407
|
+
});
|
408
|
+
util.assertEqualMaps(assert, map.toJSON(), {
|
409
|
+
version: 3,
|
410
|
+
file: 'test.js',
|
411
|
+
sources: ['a.js'],
|
412
|
+
names: ['foo'],
|
413
|
+
mappings: 'CACEA;;GAEEA'
|
414
|
+
});
|
415
|
+
};
|
416
|
+
|
417
|
+
});
|
@@ -0,0 +1,365 @@
|
|
1
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
2
|
+
/*
|
3
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
4
|
+
* Licensed under the New BSD license. See LICENSE or:
|
5
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
6
|
+
*/
|
7
|
+
if (typeof define !== 'function') {
|
8
|
+
var define = require('amdefine')(module, require);
|
9
|
+
}
|
10
|
+
define(function (require, exports, module) {
|
11
|
+
|
12
|
+
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
|
13
|
+
var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
|
14
|
+
var SourceNode = require('../../lib/source-map/source-node').SourceNode;
|
15
|
+
|
16
|
+
exports['test .add()'] = function (assert, util) {
|
17
|
+
var node = new SourceNode(null, null, null);
|
18
|
+
|
19
|
+
// Adding a string works.
|
20
|
+
node.add('function noop() {}');
|
21
|
+
|
22
|
+
// Adding another source node works.
|
23
|
+
node.add(new SourceNode(null, null, null));
|
24
|
+
|
25
|
+
// Adding an array works.
|
26
|
+
node.add(['function foo() {',
|
27
|
+
new SourceNode(null, null, null,
|
28
|
+
'return 10;'),
|
29
|
+
'}']);
|
30
|
+
|
31
|
+
// Adding other stuff doesn't.
|
32
|
+
assert.throws(function () {
|
33
|
+
node.add({});
|
34
|
+
});
|
35
|
+
assert.throws(function () {
|
36
|
+
node.add(function () {});
|
37
|
+
});
|
38
|
+
};
|
39
|
+
|
40
|
+
exports['test .prepend()'] = function (assert, util) {
|
41
|
+
var node = new SourceNode(null, null, null);
|
42
|
+
|
43
|
+
// Prepending a string works.
|
44
|
+
node.prepend('function noop() {}');
|
45
|
+
assert.equal(node.children[0], 'function noop() {}');
|
46
|
+
assert.equal(node.children.length, 1);
|
47
|
+
|
48
|
+
// Prepending another source node works.
|
49
|
+
node.prepend(new SourceNode(null, null, null));
|
50
|
+
assert.equal(node.children[0], '');
|
51
|
+
assert.equal(node.children[1], 'function noop() {}');
|
52
|
+
assert.equal(node.children.length, 2);
|
53
|
+
|
54
|
+
// Prepending an array works.
|
55
|
+
node.prepend(['function foo() {',
|
56
|
+
new SourceNode(null, null, null,
|
57
|
+
'return 10;'),
|
58
|
+
'}']);
|
59
|
+
assert.equal(node.children[0], 'function foo() {');
|
60
|
+
assert.equal(node.children[1], 'return 10;');
|
61
|
+
assert.equal(node.children[2], '}');
|
62
|
+
assert.equal(node.children[3], '');
|
63
|
+
assert.equal(node.children[4], 'function noop() {}');
|
64
|
+
assert.equal(node.children.length, 5);
|
65
|
+
|
66
|
+
// Prepending other stuff doesn't.
|
67
|
+
assert.throws(function () {
|
68
|
+
node.prepend({});
|
69
|
+
});
|
70
|
+
assert.throws(function () {
|
71
|
+
node.prepend(function () {});
|
72
|
+
});
|
73
|
+
};
|
74
|
+
|
75
|
+
exports['test .toString()'] = function (assert, util) {
|
76
|
+
assert.equal((new SourceNode(null, null, null,
|
77
|
+
['function foo() {',
|
78
|
+
new SourceNode(null, null, null, 'return 10;'),
|
79
|
+
'}'])).toString(),
|
80
|
+
'function foo() {return 10;}');
|
81
|
+
};
|
82
|
+
|
83
|
+
exports['test .join()'] = function (assert, util) {
|
84
|
+
assert.equal((new SourceNode(null, null, null,
|
85
|
+
['a', 'b', 'c', 'd'])).join(', ').toString(),
|
86
|
+
'a, b, c, d');
|
87
|
+
};
|
88
|
+
|
89
|
+
exports['test .walk()'] = function (assert, util) {
|
90
|
+
var node = new SourceNode(null, null, null,
|
91
|
+
['(function () {\n',
|
92
|
+
' ', new SourceNode(1, 0, 'a.js', ['someCall()']), ';\n',
|
93
|
+
' ', new SourceNode(2, 0, 'b.js', ['if (foo) bar()']), ';\n',
|
94
|
+
'}());']);
|
95
|
+
var expected = [
|
96
|
+
{ str: '(function () {\n', source: null, line: null, column: null },
|
97
|
+
{ str: ' ', source: null, line: null, column: null },
|
98
|
+
{ str: 'someCall()', source: 'a.js', line: 1, column: 0 },
|
99
|
+
{ str: ';\n', source: null, line: null, column: null },
|
100
|
+
{ str: ' ', source: null, line: null, column: null },
|
101
|
+
{ str: 'if (foo) bar()', source: 'b.js', line: 2, column: 0 },
|
102
|
+
{ str: ';\n', source: null, line: null, column: null },
|
103
|
+
{ str: '}());', source: null, line: null, column: null },
|
104
|
+
];
|
105
|
+
var i = 0;
|
106
|
+
node.walk(function (chunk, loc) {
|
107
|
+
assert.equal(expected[i].str, chunk);
|
108
|
+
assert.equal(expected[i].source, loc.source);
|
109
|
+
assert.equal(expected[i].line, loc.line);
|
110
|
+
assert.equal(expected[i].column, loc.column);
|
111
|
+
i++;
|
112
|
+
});
|
113
|
+
};
|
114
|
+
|
115
|
+
exports['test .replaceRight'] = function (assert, util) {
|
116
|
+
var node;
|
117
|
+
|
118
|
+
// Not nested
|
119
|
+
node = new SourceNode(null, null, null, 'hello world');
|
120
|
+
node.replaceRight(/world/, 'universe');
|
121
|
+
assert.equal(node.toString(), 'hello universe');
|
122
|
+
|
123
|
+
// Nested
|
124
|
+
node = new SourceNode(null, null, null,
|
125
|
+
[new SourceNode(null, null, null, 'hey sexy mama, '),
|
126
|
+
new SourceNode(null, null, null, 'want to kill all humans?')]);
|
127
|
+
node.replaceRight(/kill all humans/, 'watch Futurama');
|
128
|
+
assert.equal(node.toString(), 'hey sexy mama, want to watch Futurama?');
|
129
|
+
};
|
130
|
+
|
131
|
+
exports['test .toStringWithSourceMap()'] = function (assert, util) {
|
132
|
+
var node = new SourceNode(null, null, null,
|
133
|
+
['(function () {\n',
|
134
|
+
' ',
|
135
|
+
new SourceNode(1, 0, 'a.js', 'someCall', 'originalCall'),
|
136
|
+
new SourceNode(1, 8, 'a.js', '()'),
|
137
|
+
';\n',
|
138
|
+
' ', new SourceNode(2, 0, 'b.js', ['if (foo) bar()']), ';\n',
|
139
|
+
'}());']);
|
140
|
+
var map = node.toStringWithSourceMap({
|
141
|
+
file: 'foo.js'
|
142
|
+
}).map;
|
143
|
+
|
144
|
+
assert.ok(map instanceof SourceMapGenerator, 'map instanceof SourceMapGenerator');
|
145
|
+
map = new SourceMapConsumer(map.toString());
|
146
|
+
|
147
|
+
var actual;
|
148
|
+
|
149
|
+
actual = map.originalPositionFor({
|
150
|
+
line: 1,
|
151
|
+
column: 4
|
152
|
+
});
|
153
|
+
assert.equal(actual.source, null);
|
154
|
+
assert.equal(actual.line, null);
|
155
|
+
assert.equal(actual.column, null);
|
156
|
+
|
157
|
+
actual = map.originalPositionFor({
|
158
|
+
line: 2,
|
159
|
+
column: 2
|
160
|
+
});
|
161
|
+
assert.equal(actual.source, 'a.js');
|
162
|
+
assert.equal(actual.line, 1);
|
163
|
+
assert.equal(actual.column, 0);
|
164
|
+
assert.equal(actual.name, 'originalCall');
|
165
|
+
|
166
|
+
actual = map.originalPositionFor({
|
167
|
+
line: 3,
|
168
|
+
column: 2
|
169
|
+
});
|
170
|
+
assert.equal(actual.source, 'b.js');
|
171
|
+
assert.equal(actual.line, 2);
|
172
|
+
assert.equal(actual.column, 0);
|
173
|
+
|
174
|
+
actual = map.originalPositionFor({
|
175
|
+
line: 3,
|
176
|
+
column: 16
|
177
|
+
});
|
178
|
+
assert.equal(actual.source, null);
|
179
|
+
assert.equal(actual.line, null);
|
180
|
+
assert.equal(actual.column, null);
|
181
|
+
|
182
|
+
actual = map.originalPositionFor({
|
183
|
+
line: 4,
|
184
|
+
column: 2
|
185
|
+
});
|
186
|
+
assert.equal(actual.source, null);
|
187
|
+
assert.equal(actual.line, null);
|
188
|
+
assert.equal(actual.column, null);
|
189
|
+
};
|
190
|
+
|
191
|
+
exports['test .fromStringWithSourceMap()'] = function (assert, util) {
|
192
|
+
var node = SourceNode.fromStringWithSourceMap(
|
193
|
+
util.testGeneratedCode,
|
194
|
+
new SourceMapConsumer(util.testMap));
|
195
|
+
|
196
|
+
var result = node.toStringWithSourceMap({
|
197
|
+
file: 'min.js'
|
198
|
+
});
|
199
|
+
var map = result.map;
|
200
|
+
var code = result.code;
|
201
|
+
|
202
|
+
assert.equal(code, util.testGeneratedCode);
|
203
|
+
assert.ok(map instanceof SourceMapGenerator, 'map instanceof SourceMapGenerator');
|
204
|
+
map = map.toJSON();
|
205
|
+
assert.equal(map.version, util.testMap.version);
|
206
|
+
assert.equal(map.file, util.testMap.file);
|
207
|
+
assert.equal(map.mappings, util.testMap.mappings);
|
208
|
+
};
|
209
|
+
|
210
|
+
exports['test .fromStringWithSourceMap() empty map'] = function (assert, util) {
|
211
|
+
var node = SourceNode.fromStringWithSourceMap(
|
212
|
+
util.testGeneratedCode,
|
213
|
+
new SourceMapConsumer(util.emptyMap));
|
214
|
+
var result = node.toStringWithSourceMap({
|
215
|
+
file: 'min.js'
|
216
|
+
});
|
217
|
+
var map = result.map;
|
218
|
+
var code = result.code;
|
219
|
+
|
220
|
+
assert.equal(code, util.testGeneratedCode);
|
221
|
+
assert.ok(map instanceof SourceMapGenerator, 'map instanceof SourceMapGenerator');
|
222
|
+
map = map.toJSON();
|
223
|
+
assert.equal(map.version, util.emptyMap.version);
|
224
|
+
assert.equal(map.file, util.emptyMap.file);
|
225
|
+
assert.equal(map.mappings.length, util.emptyMap.mappings.length);
|
226
|
+
assert.equal(map.mappings, util.emptyMap.mappings);
|
227
|
+
};
|
228
|
+
|
229
|
+
exports['test .fromStringWithSourceMap() complex version'] = function (assert, util) {
|
230
|
+
var input = new SourceNode(null, null, null, [
|
231
|
+
"(function() {\n",
|
232
|
+
" var Test = {};\n",
|
233
|
+
" ", new SourceNode(1, 0, "a.js", "Test.A = { value: 1234 };\n"),
|
234
|
+
" ", new SourceNode(2, 0, "a.js", "Test.A.x = 'xyz';"), "\n",
|
235
|
+
"}());\n",
|
236
|
+
"/* Generated Source */"]);
|
237
|
+
input = input.toStringWithSourceMap({
|
238
|
+
file: 'foo.js'
|
239
|
+
});
|
240
|
+
|
241
|
+
var node = SourceNode.fromStringWithSourceMap(
|
242
|
+
input.code,
|
243
|
+
new SourceMapConsumer(input.map.toString()));
|
244
|
+
|
245
|
+
var result = node.toStringWithSourceMap({
|
246
|
+
file: 'foo.js'
|
247
|
+
});
|
248
|
+
var map = result.map;
|
249
|
+
var code = result.code;
|
250
|
+
|
251
|
+
assert.equal(code, input.code);
|
252
|
+
assert.ok(map instanceof SourceMapGenerator, 'map instanceof SourceMapGenerator');
|
253
|
+
map = map.toJSON();
|
254
|
+
var inputMap = input.map.toJSON();
|
255
|
+
util.assertEqualMaps(assert, map, inputMap);
|
256
|
+
};
|
257
|
+
|
258
|
+
exports['test .fromStringWithSourceMap() merging duplicate mappings'] = function (assert, util) {
|
259
|
+
var input = new SourceNode(null, null, null, [
|
260
|
+
new SourceNode(1, 0, "a.js", "(function"),
|
261
|
+
new SourceNode(1, 0, "a.js", "() {\n"),
|
262
|
+
" ",
|
263
|
+
new SourceNode(1, 0, "a.js", "var Test = "),
|
264
|
+
new SourceNode(1, 0, "b.js", "{};\n"),
|
265
|
+
new SourceNode(2, 0, "b.js", "Test"),
|
266
|
+
new SourceNode(2, 0, "b.js", ".A", "A"),
|
267
|
+
new SourceNode(2, 20, "b.js", " = { value: 1234 };\n", "A"),
|
268
|
+
"}());\n",
|
269
|
+
"/* Generated Source */"
|
270
|
+
]);
|
271
|
+
input = input.toStringWithSourceMap({
|
272
|
+
file: 'foo.js'
|
273
|
+
});
|
274
|
+
|
275
|
+
var correctMap = new SourceMapGenerator({
|
276
|
+
file: 'foo.js'
|
277
|
+
});
|
278
|
+
correctMap.addMapping({
|
279
|
+
generated: { line: 1, column: 0 },
|
280
|
+
source: 'a.js',
|
281
|
+
original: { line: 1, column: 0 }
|
282
|
+
});
|
283
|
+
correctMap.addMapping({
|
284
|
+
generated: { line: 2, column: 0 }
|
285
|
+
});
|
286
|
+
correctMap.addMapping({
|
287
|
+
generated: { line: 2, column: 2 },
|
288
|
+
source: 'a.js',
|
289
|
+
original: { line: 1, column: 0 }
|
290
|
+
});
|
291
|
+
correctMap.addMapping({
|
292
|
+
generated: { line: 2, column: 13 },
|
293
|
+
source: 'b.js',
|
294
|
+
original: { line: 1, column: 0 }
|
295
|
+
});
|
296
|
+
correctMap.addMapping({
|
297
|
+
generated: { line: 3, column: 0 },
|
298
|
+
source: 'b.js',
|
299
|
+
original: { line: 2, column: 0 }
|
300
|
+
});
|
301
|
+
correctMap.addMapping({
|
302
|
+
generated: { line: 3, column: 4 },
|
303
|
+
source: 'b.js',
|
304
|
+
name: 'A',
|
305
|
+
original: { line: 2, column: 0 }
|
306
|
+
});
|
307
|
+
correctMap.addMapping({
|
308
|
+
generated: { line: 3, column: 6 },
|
309
|
+
source: 'b.js',
|
310
|
+
name: 'A',
|
311
|
+
original: { line: 2, column: 20 }
|
312
|
+
});
|
313
|
+
correctMap.addMapping({
|
314
|
+
generated: { line: 4, column: 0 }
|
315
|
+
});
|
316
|
+
|
317
|
+
var inputMap = input.map.toJSON();
|
318
|
+
correctMap = correctMap.toJSON();
|
319
|
+
util.assertEqualMaps(assert, correctMap, inputMap);
|
320
|
+
};
|
321
|
+
|
322
|
+
exports['test setSourceContent with toStringWithSourceMap'] = function (assert, util) {
|
323
|
+
var aNode = new SourceNode(1, 1, 'a.js', 'a');
|
324
|
+
aNode.setSourceContent('a.js', 'someContent');
|
325
|
+
var node = new SourceNode(null, null, null,
|
326
|
+
['(function () {\n',
|
327
|
+
' ', aNode,
|
328
|
+
' ', new SourceNode(1, 1, 'b.js', 'b'),
|
329
|
+
'}());']);
|
330
|
+
node.setSourceContent('b.js', 'otherContent');
|
331
|
+
var map = node.toStringWithSourceMap({
|
332
|
+
file: 'foo.js'
|
333
|
+
}).map;
|
334
|
+
|
335
|
+
assert.ok(map instanceof SourceMapGenerator, 'map instanceof SourceMapGenerator');
|
336
|
+
map = new SourceMapConsumer(map.toString());
|
337
|
+
|
338
|
+
assert.equal(map.sources.length, 2);
|
339
|
+
assert.equal(map.sources[0], 'a.js');
|
340
|
+
assert.equal(map.sources[1], 'b.js');
|
341
|
+
assert.equal(map.sourcesContent.length, 2);
|
342
|
+
assert.equal(map.sourcesContent[0], 'someContent');
|
343
|
+
assert.equal(map.sourcesContent[1], 'otherContent');
|
344
|
+
};
|
345
|
+
|
346
|
+
exports['test walkSourceContents'] = function (assert, util) {
|
347
|
+
var aNode = new SourceNode(1, 1, 'a.js', 'a');
|
348
|
+
aNode.setSourceContent('a.js', 'someContent');
|
349
|
+
var node = new SourceNode(null, null, null,
|
350
|
+
['(function () {\n',
|
351
|
+
' ', aNode,
|
352
|
+
' ', new SourceNode(1, 1, 'b.js', 'b'),
|
353
|
+
'}());']);
|
354
|
+
node.setSourceContent('b.js', 'otherContent');
|
355
|
+
var results = [];
|
356
|
+
node.walkSourceContents(function (sourceFile, sourceContent) {
|
357
|
+
results.push([sourceFile, sourceContent]);
|
358
|
+
});
|
359
|
+
assert.equal(results.length, 2);
|
360
|
+
assert.equal(results[0][0], 'a.js');
|
361
|
+
assert.equal(results[0][1], 'someContent');
|
362
|
+
assert.equal(results[1][0], 'b.js');
|
363
|
+
assert.equal(results[1][1], 'otherContent');
|
364
|
+
};
|
365
|
+
});
|