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,380 @@
|
|
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 base64VLQ = require('./base64-vlq');
|
13
|
+
var util = require('./util');
|
14
|
+
var ArraySet = require('./array-set').ArraySet;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* An instance of the SourceMapGenerator represents a source map which is
|
18
|
+
* being built incrementally. To create a new one, you must pass an object
|
19
|
+
* with the following properties:
|
20
|
+
*
|
21
|
+
* - file: The filename of the generated source.
|
22
|
+
* - sourceRoot: An optional root for all URLs in this source map.
|
23
|
+
*/
|
24
|
+
function SourceMapGenerator(aArgs) {
|
25
|
+
this._file = util.getArg(aArgs, 'file');
|
26
|
+
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
|
27
|
+
this._sources = new ArraySet();
|
28
|
+
this._names = new ArraySet();
|
29
|
+
this._mappings = [];
|
30
|
+
this._sourcesContents = null;
|
31
|
+
}
|
32
|
+
|
33
|
+
SourceMapGenerator.prototype._version = 3;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Creates a new SourceMapGenerator based on a SourceMapConsumer
|
37
|
+
*
|
38
|
+
* @param aSourceMapConsumer The SourceMap.
|
39
|
+
*/
|
40
|
+
SourceMapGenerator.fromSourceMap =
|
41
|
+
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
42
|
+
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
43
|
+
var generator = new SourceMapGenerator({
|
44
|
+
file: aSourceMapConsumer.file,
|
45
|
+
sourceRoot: sourceRoot
|
46
|
+
});
|
47
|
+
aSourceMapConsumer.eachMapping(function (mapping) {
|
48
|
+
var newMapping = {
|
49
|
+
generated: {
|
50
|
+
line: mapping.generatedLine,
|
51
|
+
column: mapping.generatedColumn
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
if (mapping.source) {
|
56
|
+
newMapping.source = mapping.source;
|
57
|
+
if (sourceRoot) {
|
58
|
+
newMapping.source = util.relative(sourceRoot, newMapping.source);
|
59
|
+
}
|
60
|
+
|
61
|
+
newMapping.original = {
|
62
|
+
line: mapping.originalLine,
|
63
|
+
column: mapping.originalColumn
|
64
|
+
};
|
65
|
+
|
66
|
+
if (mapping.name) {
|
67
|
+
newMapping.name = mapping.name;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
generator.addMapping(newMapping);
|
72
|
+
});
|
73
|
+
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
74
|
+
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
75
|
+
if (content) {
|
76
|
+
generator.setSourceContent(sourceFile, content);
|
77
|
+
}
|
78
|
+
});
|
79
|
+
return generator;
|
80
|
+
};
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Add a single mapping from original source line and column to the generated
|
84
|
+
* source's line and column for this source map being created. The mapping
|
85
|
+
* object should have the following properties:
|
86
|
+
*
|
87
|
+
* - generated: An object with the generated line and column positions.
|
88
|
+
* - original: An object with the original line and column positions.
|
89
|
+
* - source: The original source file (relative to the sourceRoot).
|
90
|
+
* - name: An optional original token name for this mapping.
|
91
|
+
*/
|
92
|
+
SourceMapGenerator.prototype.addMapping =
|
93
|
+
function SourceMapGenerator_addMapping(aArgs) {
|
94
|
+
var generated = util.getArg(aArgs, 'generated');
|
95
|
+
var original = util.getArg(aArgs, 'original', null);
|
96
|
+
var source = util.getArg(aArgs, 'source', null);
|
97
|
+
var name = util.getArg(aArgs, 'name', null);
|
98
|
+
|
99
|
+
this._validateMapping(generated, original, source, name);
|
100
|
+
|
101
|
+
if (source && !this._sources.has(source)) {
|
102
|
+
this._sources.add(source);
|
103
|
+
}
|
104
|
+
|
105
|
+
if (name && !this._names.has(name)) {
|
106
|
+
this._names.add(name);
|
107
|
+
}
|
108
|
+
|
109
|
+
this._mappings.push({
|
110
|
+
generatedLine: generated.line,
|
111
|
+
generatedColumn: generated.column,
|
112
|
+
originalLine: original != null && original.line,
|
113
|
+
originalColumn: original != null && original.column,
|
114
|
+
source: source,
|
115
|
+
name: name
|
116
|
+
});
|
117
|
+
};
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Set the source content for a source file.
|
121
|
+
*/
|
122
|
+
SourceMapGenerator.prototype.setSourceContent =
|
123
|
+
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
|
124
|
+
var source = aSourceFile;
|
125
|
+
if (this._sourceRoot) {
|
126
|
+
source = util.relative(this._sourceRoot, source);
|
127
|
+
}
|
128
|
+
|
129
|
+
if (aSourceContent !== null) {
|
130
|
+
// Add the source content to the _sourcesContents map.
|
131
|
+
// Create a new _sourcesContents map if the property is null.
|
132
|
+
if (!this._sourcesContents) {
|
133
|
+
this._sourcesContents = {};
|
134
|
+
}
|
135
|
+
this._sourcesContents[util.toSetString(source)] = aSourceContent;
|
136
|
+
} else {
|
137
|
+
// Remove the source file from the _sourcesContents map.
|
138
|
+
// If the _sourcesContents map is empty, set the property to null.
|
139
|
+
delete this._sourcesContents[util.toSetString(source)];
|
140
|
+
if (Object.keys(this._sourcesContents).length === 0) {
|
141
|
+
this._sourcesContents = null;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
};
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Applies the mappings of a sub-source-map for a specific source file to the
|
148
|
+
* source map being generated. Each mapping to the supplied source file is
|
149
|
+
* rewritten using the supplied source map. Note: The resolution for the
|
150
|
+
* resulting mappings is the minimium of this map and the supplied map.
|
151
|
+
*
|
152
|
+
* @param aSourceMapConsumer The source map to be applied.
|
153
|
+
* @param aSourceFile Optional. The filename of the source file.
|
154
|
+
* If omitted, SourceMapConsumer's file property will be used.
|
155
|
+
*/
|
156
|
+
SourceMapGenerator.prototype.applySourceMap =
|
157
|
+
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) {
|
158
|
+
// If aSourceFile is omitted, we will use the file property of the SourceMap
|
159
|
+
if (!aSourceFile) {
|
160
|
+
aSourceFile = aSourceMapConsumer.file;
|
161
|
+
}
|
162
|
+
var sourceRoot = this._sourceRoot;
|
163
|
+
// Make "aSourceFile" relative if an absolute Url is passed.
|
164
|
+
if (sourceRoot) {
|
165
|
+
aSourceFile = util.relative(sourceRoot, aSourceFile);
|
166
|
+
}
|
167
|
+
// Applying the SourceMap can add and remove items from the sources and
|
168
|
+
// the names array.
|
169
|
+
var newSources = new ArraySet();
|
170
|
+
var newNames = new ArraySet();
|
171
|
+
|
172
|
+
// Find mappings for the "aSourceFile"
|
173
|
+
this._mappings.forEach(function (mapping) {
|
174
|
+
if (mapping.source === aSourceFile && mapping.originalLine) {
|
175
|
+
// Check if it can be mapped by the source map, then update the mapping.
|
176
|
+
var original = aSourceMapConsumer.originalPositionFor({
|
177
|
+
line: mapping.originalLine,
|
178
|
+
column: mapping.originalColumn
|
179
|
+
});
|
180
|
+
if (original.source !== null) {
|
181
|
+
// Copy mapping
|
182
|
+
if (sourceRoot) {
|
183
|
+
mapping.source = util.relative(sourceRoot, original.source);
|
184
|
+
} else {
|
185
|
+
mapping.source = original.source;
|
186
|
+
}
|
187
|
+
mapping.originalLine = original.line;
|
188
|
+
mapping.originalColumn = original.column;
|
189
|
+
if (original.name !== null && mapping.name !== null) {
|
190
|
+
// Only use the identifier name if it's an identifier
|
191
|
+
// in both SourceMaps
|
192
|
+
mapping.name = original.name;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
var source = mapping.source;
|
198
|
+
if (source && !newSources.has(source)) {
|
199
|
+
newSources.add(source);
|
200
|
+
}
|
201
|
+
|
202
|
+
var name = mapping.name;
|
203
|
+
if (name && !newNames.has(name)) {
|
204
|
+
newNames.add(name);
|
205
|
+
}
|
206
|
+
|
207
|
+
}, this);
|
208
|
+
this._sources = newSources;
|
209
|
+
this._names = newNames;
|
210
|
+
|
211
|
+
// Copy sourcesContents of applied map.
|
212
|
+
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
213
|
+
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
214
|
+
if (content) {
|
215
|
+
if (sourceRoot) {
|
216
|
+
sourceFile = util.relative(sourceRoot, sourceFile);
|
217
|
+
}
|
218
|
+
this.setSourceContent(sourceFile, content);
|
219
|
+
}
|
220
|
+
}, this);
|
221
|
+
};
|
222
|
+
|
223
|
+
/**
|
224
|
+
* A mapping can have one of the three levels of data:
|
225
|
+
*
|
226
|
+
* 1. Just the generated position.
|
227
|
+
* 2. The Generated position, original position, and original source.
|
228
|
+
* 3. Generated and original position, original source, as well as a name
|
229
|
+
* token.
|
230
|
+
*
|
231
|
+
* To maintain consistency, we validate that any new mapping being added falls
|
232
|
+
* in to one of these categories.
|
233
|
+
*/
|
234
|
+
SourceMapGenerator.prototype._validateMapping =
|
235
|
+
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
|
236
|
+
aName) {
|
237
|
+
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
238
|
+
&& aGenerated.line > 0 && aGenerated.column >= 0
|
239
|
+
&& !aOriginal && !aSource && !aName) {
|
240
|
+
// Case 1.
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
|
244
|
+
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
|
245
|
+
&& aGenerated.line > 0 && aGenerated.column >= 0
|
246
|
+
&& aOriginal.line > 0 && aOriginal.column >= 0
|
247
|
+
&& aSource) {
|
248
|
+
// Cases 2 and 3.
|
249
|
+
return;
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
throw new Error('Invalid mapping: ' + JSON.stringify({
|
253
|
+
generated: aGenerated,
|
254
|
+
source: aSource,
|
255
|
+
original: aOriginal,
|
256
|
+
name: aName
|
257
|
+
}));
|
258
|
+
}
|
259
|
+
};
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Serialize the accumulated mappings in to the stream of base 64 VLQs
|
263
|
+
* specified by the source map format.
|
264
|
+
*/
|
265
|
+
SourceMapGenerator.prototype._serializeMappings =
|
266
|
+
function SourceMapGenerator_serializeMappings() {
|
267
|
+
var previousGeneratedColumn = 0;
|
268
|
+
var previousGeneratedLine = 1;
|
269
|
+
var previousOriginalColumn = 0;
|
270
|
+
var previousOriginalLine = 0;
|
271
|
+
var previousName = 0;
|
272
|
+
var previousSource = 0;
|
273
|
+
var result = '';
|
274
|
+
var mapping;
|
275
|
+
|
276
|
+
// The mappings must be guaranteed to be in sorted order before we start
|
277
|
+
// serializing them or else the generated line numbers (which are defined
|
278
|
+
// via the ';' separators) will be all messed up. Note: it might be more
|
279
|
+
// performant to maintain the sorting as we insert them, rather than as we
|
280
|
+
// serialize them, but the big O is the same either way.
|
281
|
+
this._mappings.sort(util.compareByGeneratedPositions);
|
282
|
+
|
283
|
+
for (var i = 0, len = this._mappings.length; i < len; i++) {
|
284
|
+
mapping = this._mappings[i];
|
285
|
+
|
286
|
+
if (mapping.generatedLine !== previousGeneratedLine) {
|
287
|
+
previousGeneratedColumn = 0;
|
288
|
+
while (mapping.generatedLine !== previousGeneratedLine) {
|
289
|
+
result += ';';
|
290
|
+
previousGeneratedLine++;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
else {
|
294
|
+
if (i > 0) {
|
295
|
+
if (!util.compareByGeneratedPositions(mapping, this._mappings[i - 1])) {
|
296
|
+
continue;
|
297
|
+
}
|
298
|
+
result += ',';
|
299
|
+
}
|
300
|
+
}
|
301
|
+
|
302
|
+
result += base64VLQ.encode(mapping.generatedColumn
|
303
|
+
- previousGeneratedColumn);
|
304
|
+
previousGeneratedColumn = mapping.generatedColumn;
|
305
|
+
|
306
|
+
if (mapping.source) {
|
307
|
+
result += base64VLQ.encode(this._sources.indexOf(mapping.source)
|
308
|
+
- previousSource);
|
309
|
+
previousSource = this._sources.indexOf(mapping.source);
|
310
|
+
|
311
|
+
// lines are stored 0-based in SourceMap spec version 3
|
312
|
+
result += base64VLQ.encode(mapping.originalLine - 1
|
313
|
+
- previousOriginalLine);
|
314
|
+
previousOriginalLine = mapping.originalLine - 1;
|
315
|
+
|
316
|
+
result += base64VLQ.encode(mapping.originalColumn
|
317
|
+
- previousOriginalColumn);
|
318
|
+
previousOriginalColumn = mapping.originalColumn;
|
319
|
+
|
320
|
+
if (mapping.name) {
|
321
|
+
result += base64VLQ.encode(this._names.indexOf(mapping.name)
|
322
|
+
- previousName);
|
323
|
+
previousName = this._names.indexOf(mapping.name);
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
return result;
|
329
|
+
};
|
330
|
+
|
331
|
+
SourceMapGenerator.prototype._generateSourcesContent =
|
332
|
+
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
|
333
|
+
return aSources.map(function (source) {
|
334
|
+
if (!this._sourcesContents) {
|
335
|
+
return null;
|
336
|
+
}
|
337
|
+
if (aSourceRoot) {
|
338
|
+
source = util.relative(aSourceRoot, source);
|
339
|
+
}
|
340
|
+
var key = util.toSetString(source);
|
341
|
+
return Object.prototype.hasOwnProperty.call(this._sourcesContents,
|
342
|
+
key)
|
343
|
+
? this._sourcesContents[key]
|
344
|
+
: null;
|
345
|
+
}, this);
|
346
|
+
};
|
347
|
+
|
348
|
+
/**
|
349
|
+
* Externalize the source map.
|
350
|
+
*/
|
351
|
+
SourceMapGenerator.prototype.toJSON =
|
352
|
+
function SourceMapGenerator_toJSON() {
|
353
|
+
var map = {
|
354
|
+
version: this._version,
|
355
|
+
file: this._file,
|
356
|
+
sources: this._sources.toArray(),
|
357
|
+
names: this._names.toArray(),
|
358
|
+
mappings: this._serializeMappings()
|
359
|
+
};
|
360
|
+
if (this._sourceRoot) {
|
361
|
+
map.sourceRoot = this._sourceRoot;
|
362
|
+
}
|
363
|
+
if (this._sourcesContents) {
|
364
|
+
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
|
365
|
+
}
|
366
|
+
|
367
|
+
return map;
|
368
|
+
};
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Render the source map being generated to a string.
|
372
|
+
*/
|
373
|
+
SourceMapGenerator.prototype.toString =
|
374
|
+
function SourceMapGenerator_toString() {
|
375
|
+
return JSON.stringify(this);
|
376
|
+
};
|
377
|
+
|
378
|
+
exports.SourceMapGenerator = SourceMapGenerator;
|
379
|
+
|
380
|
+
});
|
@@ -0,0 +1,371 @@
|
|
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('./source-map-generator').SourceMapGenerator;
|
13
|
+
var util = require('./util');
|
14
|
+
|
15
|
+
/**
|
16
|
+
* SourceNodes provide a way to abstract over interpolating/concatenating
|
17
|
+
* snippets of generated JavaScript source code while maintaining the line and
|
18
|
+
* column information associated with the original source code.
|
19
|
+
*
|
20
|
+
* @param aLine The original line number.
|
21
|
+
* @param aColumn The original column number.
|
22
|
+
* @param aSource The original source's filename.
|
23
|
+
* @param aChunks Optional. An array of strings which are snippets of
|
24
|
+
* generated JS, or other SourceNodes.
|
25
|
+
* @param aName The original identifier.
|
26
|
+
*/
|
27
|
+
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
|
28
|
+
this.children = [];
|
29
|
+
this.sourceContents = {};
|
30
|
+
this.line = aLine === undefined ? null : aLine;
|
31
|
+
this.column = aColumn === undefined ? null : aColumn;
|
32
|
+
this.source = aSource === undefined ? null : aSource;
|
33
|
+
this.name = aName === undefined ? null : aName;
|
34
|
+
if (aChunks != null) this.add(aChunks);
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Creates a SourceNode from generated code and a SourceMapConsumer.
|
39
|
+
*
|
40
|
+
* @param aGeneratedCode The generated code
|
41
|
+
* @param aSourceMapConsumer The SourceMap for the generated code
|
42
|
+
*/
|
43
|
+
SourceNode.fromStringWithSourceMap =
|
44
|
+
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {
|
45
|
+
// The SourceNode we want to fill with the generated code
|
46
|
+
// and the SourceMap
|
47
|
+
var node = new SourceNode();
|
48
|
+
|
49
|
+
// The generated code
|
50
|
+
// Processed fragments are removed from this array.
|
51
|
+
var remainingLines = aGeneratedCode.split('\n');
|
52
|
+
|
53
|
+
// We need to remember the position of "remainingLines"
|
54
|
+
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
55
|
+
|
56
|
+
// The generate SourceNodes we need a code range.
|
57
|
+
// To extract it current and last mapping is used.
|
58
|
+
// Here we store the last mapping.
|
59
|
+
var lastMapping = null;
|
60
|
+
|
61
|
+
aSourceMapConsumer.eachMapping(function (mapping) {
|
62
|
+
if (lastMapping === null) {
|
63
|
+
// We add the generated code until the first mapping
|
64
|
+
// to the SourceNode without any mapping.
|
65
|
+
// Each line is added as separate string.
|
66
|
+
while (lastGeneratedLine < mapping.generatedLine) {
|
67
|
+
node.add(remainingLines.shift() + "\n");
|
68
|
+
lastGeneratedLine++;
|
69
|
+
}
|
70
|
+
if (lastGeneratedColumn < mapping.generatedColumn) {
|
71
|
+
var nextLine = remainingLines[0];
|
72
|
+
node.add(nextLine.substr(0, mapping.generatedColumn));
|
73
|
+
remainingLines[0] = nextLine.substr(mapping.generatedColumn);
|
74
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
75
|
+
}
|
76
|
+
} else {
|
77
|
+
// We add the code from "lastMapping" to "mapping":
|
78
|
+
// First check if there is a new line in between.
|
79
|
+
if (lastGeneratedLine < mapping.generatedLine) {
|
80
|
+
var code = "";
|
81
|
+
// Associate full lines with "lastMapping"
|
82
|
+
do {
|
83
|
+
code += remainingLines.shift() + "\n";
|
84
|
+
lastGeneratedLine++;
|
85
|
+
lastGeneratedColumn = 0;
|
86
|
+
} while (lastGeneratedLine < mapping.generatedLine);
|
87
|
+
// When we reached the correct line, we add code until we
|
88
|
+
// reach the correct column too.
|
89
|
+
if (lastGeneratedColumn < mapping.generatedColumn) {
|
90
|
+
var nextLine = remainingLines[0];
|
91
|
+
code += nextLine.substr(0, mapping.generatedColumn);
|
92
|
+
remainingLines[0] = nextLine.substr(mapping.generatedColumn);
|
93
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
94
|
+
}
|
95
|
+
// Create the SourceNode.
|
96
|
+
addMappingWithCode(lastMapping, code);
|
97
|
+
} else {
|
98
|
+
// There is no new line in between.
|
99
|
+
// Associate the code between "lastGeneratedColumn" and
|
100
|
+
// "mapping.generatedColumn" with "lastMapping"
|
101
|
+
var nextLine = remainingLines[0];
|
102
|
+
var code = nextLine.substr(0, mapping.generatedColumn -
|
103
|
+
lastGeneratedColumn);
|
104
|
+
remainingLines[0] = nextLine.substr(mapping.generatedColumn -
|
105
|
+
lastGeneratedColumn);
|
106
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
107
|
+
addMappingWithCode(lastMapping, code);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
lastMapping = mapping;
|
111
|
+
}, this);
|
112
|
+
// We have processed all mappings.
|
113
|
+
// Associate the remaining code in the current line with "lastMapping"
|
114
|
+
// and add the remaining lines without any mapping
|
115
|
+
addMappingWithCode(lastMapping, remainingLines.join("\n"));
|
116
|
+
|
117
|
+
// Copy sourcesContent into SourceNode
|
118
|
+
aSourceMapConsumer.sources.forEach(function (sourceFile) {
|
119
|
+
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
120
|
+
if (content) {
|
121
|
+
node.setSourceContent(sourceFile, content);
|
122
|
+
}
|
123
|
+
});
|
124
|
+
|
125
|
+
return node;
|
126
|
+
|
127
|
+
function addMappingWithCode(mapping, code) {
|
128
|
+
if (mapping === null || mapping.source === undefined) {
|
129
|
+
node.add(code);
|
130
|
+
} else {
|
131
|
+
node.add(new SourceNode(mapping.originalLine,
|
132
|
+
mapping.originalColumn,
|
133
|
+
mapping.source,
|
134
|
+
code,
|
135
|
+
mapping.name));
|
136
|
+
}
|
137
|
+
}
|
138
|
+
};
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Add a chunk of generated JS to this source node.
|
142
|
+
*
|
143
|
+
* @param aChunk A string snippet of generated JS code, another instance of
|
144
|
+
* SourceNode, or an array where each member is one of those things.
|
145
|
+
*/
|
146
|
+
SourceNode.prototype.add = function SourceNode_add(aChunk) {
|
147
|
+
if (Array.isArray(aChunk)) {
|
148
|
+
aChunk.forEach(function (chunk) {
|
149
|
+
this.add(chunk);
|
150
|
+
}, this);
|
151
|
+
}
|
152
|
+
else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
|
153
|
+
if (aChunk) {
|
154
|
+
this.children.push(aChunk);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
throw new TypeError(
|
159
|
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
160
|
+
);
|
161
|
+
}
|
162
|
+
return this;
|
163
|
+
};
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Add a chunk of generated JS to the beginning of this source node.
|
167
|
+
*
|
168
|
+
* @param aChunk A string snippet of generated JS code, another instance of
|
169
|
+
* SourceNode, or an array where each member is one of those things.
|
170
|
+
*/
|
171
|
+
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
|
172
|
+
if (Array.isArray(aChunk)) {
|
173
|
+
for (var i = aChunk.length-1; i >= 0; i--) {
|
174
|
+
this.prepend(aChunk[i]);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
|
178
|
+
this.children.unshift(aChunk);
|
179
|
+
}
|
180
|
+
else {
|
181
|
+
throw new TypeError(
|
182
|
+
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
|
183
|
+
);
|
184
|
+
}
|
185
|
+
return this;
|
186
|
+
};
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Walk over the tree of JS snippets in this node and its children. The
|
190
|
+
* walking function is called once for each snippet of JS and is passed that
|
191
|
+
* snippet and the its original associated source's line/column location.
|
192
|
+
*
|
193
|
+
* @param aFn The traversal function.
|
194
|
+
*/
|
195
|
+
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
|
196
|
+
var chunk;
|
197
|
+
for (var i = 0, len = this.children.length; i < len; i++) {
|
198
|
+
chunk = this.children[i];
|
199
|
+
if (chunk instanceof SourceNode) {
|
200
|
+
chunk.walk(aFn);
|
201
|
+
}
|
202
|
+
else {
|
203
|
+
if (chunk !== '') {
|
204
|
+
aFn(chunk, { source: this.source,
|
205
|
+
line: this.line,
|
206
|
+
column: this.column,
|
207
|
+
name: this.name });
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
};
|
212
|
+
|
213
|
+
/**
|
214
|
+
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
|
215
|
+
* each of `this.children`.
|
216
|
+
*
|
217
|
+
* @param aSep The separator.
|
218
|
+
*/
|
219
|
+
SourceNode.prototype.join = function SourceNode_join(aSep) {
|
220
|
+
var newChildren;
|
221
|
+
var i;
|
222
|
+
var len = this.children.length;
|
223
|
+
if (len > 0) {
|
224
|
+
newChildren = [];
|
225
|
+
for (i = 0; i < len-1; i++) {
|
226
|
+
newChildren.push(this.children[i]);
|
227
|
+
newChildren.push(aSep);
|
228
|
+
}
|
229
|
+
newChildren.push(this.children[i]);
|
230
|
+
this.children = newChildren;
|
231
|
+
}
|
232
|
+
return this;
|
233
|
+
};
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Call String.prototype.replace on the very right-most source snippet. Useful
|
237
|
+
* for trimming whitespace from the end of a source node, etc.
|
238
|
+
*
|
239
|
+
* @param aPattern The pattern to replace.
|
240
|
+
* @param aReplacement The thing to replace the pattern with.
|
241
|
+
*/
|
242
|
+
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
|
243
|
+
var lastChild = this.children[this.children.length - 1];
|
244
|
+
if (lastChild instanceof SourceNode) {
|
245
|
+
lastChild.replaceRight(aPattern, aReplacement);
|
246
|
+
}
|
247
|
+
else if (typeof lastChild === 'string') {
|
248
|
+
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
|
249
|
+
}
|
250
|
+
else {
|
251
|
+
this.children.push(''.replace(aPattern, aReplacement));
|
252
|
+
}
|
253
|
+
return this;
|
254
|
+
};
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Set the source content for a source file. This will be added to the SourceMapGenerator
|
258
|
+
* in the sourcesContent field.
|
259
|
+
*
|
260
|
+
* @param aSourceFile The filename of the source file
|
261
|
+
* @param aSourceContent The content of the source file
|
262
|
+
*/
|
263
|
+
SourceNode.prototype.setSourceContent =
|
264
|
+
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
|
265
|
+
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
|
266
|
+
};
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Walk over the tree of SourceNodes. The walking function is called for each
|
270
|
+
* source file content and is passed the filename and source content.
|
271
|
+
*
|
272
|
+
* @param aFn The traversal function.
|
273
|
+
*/
|
274
|
+
SourceNode.prototype.walkSourceContents =
|
275
|
+
function SourceNode_walkSourceContents(aFn) {
|
276
|
+
for (var i = 0, len = this.children.length; i < len; i++) {
|
277
|
+
if (this.children[i] instanceof SourceNode) {
|
278
|
+
this.children[i].walkSourceContents(aFn);
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
var sources = Object.keys(this.sourceContents);
|
283
|
+
for (var i = 0, len = sources.length; i < len; i++) {
|
284
|
+
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
|
285
|
+
}
|
286
|
+
};
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Return the string representation of this source node. Walks over the tree
|
290
|
+
* and concatenates all the various snippets together to one string.
|
291
|
+
*/
|
292
|
+
SourceNode.prototype.toString = function SourceNode_toString() {
|
293
|
+
var str = "";
|
294
|
+
this.walk(function (chunk) {
|
295
|
+
str += chunk;
|
296
|
+
});
|
297
|
+
return str;
|
298
|
+
};
|
299
|
+
|
300
|
+
/**
|
301
|
+
* Returns the string representation of this source node along with a source
|
302
|
+
* map.
|
303
|
+
*/
|
304
|
+
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
|
305
|
+
var generated = {
|
306
|
+
code: "",
|
307
|
+
line: 1,
|
308
|
+
column: 0
|
309
|
+
};
|
310
|
+
var map = new SourceMapGenerator(aArgs);
|
311
|
+
var sourceMappingActive = false;
|
312
|
+
var lastOriginalSource = null;
|
313
|
+
var lastOriginalLine = null;
|
314
|
+
var lastOriginalColumn = null;
|
315
|
+
var lastOriginalName = null;
|
316
|
+
this.walk(function (chunk, original) {
|
317
|
+
generated.code += chunk;
|
318
|
+
if (original.source !== null
|
319
|
+
&& original.line !== null
|
320
|
+
&& original.column !== null) {
|
321
|
+
if(lastOriginalSource !== original.source
|
322
|
+
|| lastOriginalLine !== original.line
|
323
|
+
|| lastOriginalColumn !== original.column
|
324
|
+
|| lastOriginalName !== original.name) {
|
325
|
+
map.addMapping({
|
326
|
+
source: original.source,
|
327
|
+
original: {
|
328
|
+
line: original.line,
|
329
|
+
column: original.column
|
330
|
+
},
|
331
|
+
generated: {
|
332
|
+
line: generated.line,
|
333
|
+
column: generated.column
|
334
|
+
},
|
335
|
+
name: original.name
|
336
|
+
});
|
337
|
+
}
|
338
|
+
lastOriginalSource = original.source;
|
339
|
+
lastOriginalLine = original.line;
|
340
|
+
lastOriginalColumn = original.column;
|
341
|
+
lastOriginalName = original.name;
|
342
|
+
sourceMappingActive = true;
|
343
|
+
} else if (sourceMappingActive) {
|
344
|
+
map.addMapping({
|
345
|
+
generated: {
|
346
|
+
line: generated.line,
|
347
|
+
column: generated.column
|
348
|
+
}
|
349
|
+
});
|
350
|
+
lastOriginalSource = null;
|
351
|
+
sourceMappingActive = false;
|
352
|
+
}
|
353
|
+
chunk.split('').forEach(function (ch) {
|
354
|
+
if (ch === '\n') {
|
355
|
+
generated.line++;
|
356
|
+
generated.column = 0;
|
357
|
+
} else {
|
358
|
+
generated.column++;
|
359
|
+
}
|
360
|
+
});
|
361
|
+
});
|
362
|
+
this.walkSourceContents(function (sourceFile, sourceContent) {
|
363
|
+
map.setSourceContent(sourceFile, sourceContent);
|
364
|
+
});
|
365
|
+
|
366
|
+
return { code: generated.code, map: map };
|
367
|
+
};
|
368
|
+
|
369
|
+
exports.SourceNode = SourceNode;
|
370
|
+
|
371
|
+
});
|