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,205 @@
|
|
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
|
+
/**
|
13
|
+
* This is a helper function for getting values from parameter/options
|
14
|
+
* objects.
|
15
|
+
*
|
16
|
+
* @param args The object we are extracting values from
|
17
|
+
* @param name The name of the property we are getting.
|
18
|
+
* @param defaultValue An optional value to return if the property is missing
|
19
|
+
* from the object. If this is not specified and the property is missing, an
|
20
|
+
* error will be thrown.
|
21
|
+
*/
|
22
|
+
function getArg(aArgs, aName, aDefaultValue) {
|
23
|
+
if (aName in aArgs) {
|
24
|
+
return aArgs[aName];
|
25
|
+
} else if (arguments.length === 3) {
|
26
|
+
return aDefaultValue;
|
27
|
+
} else {
|
28
|
+
throw new Error('"' + aName + '" is a required argument.');
|
29
|
+
}
|
30
|
+
}
|
31
|
+
exports.getArg = getArg;
|
32
|
+
|
33
|
+
var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/;
|
34
|
+
var dataUrlRegexp = /^data:.+\,.+/;
|
35
|
+
|
36
|
+
function urlParse(aUrl) {
|
37
|
+
var match = aUrl.match(urlRegexp);
|
38
|
+
if (!match) {
|
39
|
+
return null;
|
40
|
+
}
|
41
|
+
return {
|
42
|
+
scheme: match[1],
|
43
|
+
auth: match[3],
|
44
|
+
host: match[4],
|
45
|
+
port: match[6],
|
46
|
+
path: match[7]
|
47
|
+
};
|
48
|
+
}
|
49
|
+
exports.urlParse = urlParse;
|
50
|
+
|
51
|
+
function urlGenerate(aParsedUrl) {
|
52
|
+
var url = aParsedUrl.scheme + "://";
|
53
|
+
if (aParsedUrl.auth) {
|
54
|
+
url += aParsedUrl.auth + "@"
|
55
|
+
}
|
56
|
+
if (aParsedUrl.host) {
|
57
|
+
url += aParsedUrl.host;
|
58
|
+
}
|
59
|
+
if (aParsedUrl.port) {
|
60
|
+
url += ":" + aParsedUrl.port
|
61
|
+
}
|
62
|
+
if (aParsedUrl.path) {
|
63
|
+
url += aParsedUrl.path;
|
64
|
+
}
|
65
|
+
return url;
|
66
|
+
}
|
67
|
+
exports.urlGenerate = urlGenerate;
|
68
|
+
|
69
|
+
function join(aRoot, aPath) {
|
70
|
+
var url;
|
71
|
+
|
72
|
+
if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) {
|
73
|
+
return aPath;
|
74
|
+
}
|
75
|
+
|
76
|
+
if (aPath.charAt(0) === '/' && (url = urlParse(aRoot))) {
|
77
|
+
url.path = aPath;
|
78
|
+
return urlGenerate(url);
|
79
|
+
}
|
80
|
+
|
81
|
+
return aRoot.replace(/\/$/, '') + '/' + aPath;
|
82
|
+
}
|
83
|
+
exports.join = join;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Because behavior goes wacky when you set `__proto__` on objects, we
|
87
|
+
* have to prefix all the strings in our set with an arbitrary character.
|
88
|
+
*
|
89
|
+
* See https://github.com/mozilla/source-map/pull/31 and
|
90
|
+
* https://github.com/mozilla/source-map/issues/30
|
91
|
+
*
|
92
|
+
* @param String aStr
|
93
|
+
*/
|
94
|
+
function toSetString(aStr) {
|
95
|
+
return '$' + aStr;
|
96
|
+
}
|
97
|
+
exports.toSetString = toSetString;
|
98
|
+
|
99
|
+
function fromSetString(aStr) {
|
100
|
+
return aStr.substr(1);
|
101
|
+
}
|
102
|
+
exports.fromSetString = fromSetString;
|
103
|
+
|
104
|
+
function relative(aRoot, aPath) {
|
105
|
+
aRoot = aRoot.replace(/\/$/, '');
|
106
|
+
|
107
|
+
var url = urlParse(aRoot);
|
108
|
+
if (aPath.charAt(0) == "/" && url && url.path == "/") {
|
109
|
+
return aPath.slice(1);
|
110
|
+
}
|
111
|
+
|
112
|
+
return aPath.indexOf(aRoot + '/') === 0
|
113
|
+
? aPath.substr(aRoot.length + 1)
|
114
|
+
: aPath;
|
115
|
+
}
|
116
|
+
exports.relative = relative;
|
117
|
+
|
118
|
+
function strcmp(aStr1, aStr2) {
|
119
|
+
var s1 = aStr1 || "";
|
120
|
+
var s2 = aStr2 || "";
|
121
|
+
return (s1 > s2) - (s1 < s2);
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Comparator between two mappings where the original positions are compared.
|
126
|
+
*
|
127
|
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
128
|
+
* mappings with the same original source/line/column, but different generated
|
129
|
+
* line and column the same. Useful when searching for a mapping with a
|
130
|
+
* stubbed out mapping.
|
131
|
+
*/
|
132
|
+
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
133
|
+
var cmp;
|
134
|
+
|
135
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
136
|
+
if (cmp) {
|
137
|
+
return cmp;
|
138
|
+
}
|
139
|
+
|
140
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
141
|
+
if (cmp) {
|
142
|
+
return cmp;
|
143
|
+
}
|
144
|
+
|
145
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
146
|
+
if (cmp || onlyCompareOriginal) {
|
147
|
+
return cmp;
|
148
|
+
}
|
149
|
+
|
150
|
+
cmp = strcmp(mappingA.name, mappingB.name);
|
151
|
+
if (cmp) {
|
152
|
+
return cmp;
|
153
|
+
}
|
154
|
+
|
155
|
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
156
|
+
if (cmp) {
|
157
|
+
return cmp;
|
158
|
+
}
|
159
|
+
|
160
|
+
return mappingA.generatedColumn - mappingB.generatedColumn;
|
161
|
+
};
|
162
|
+
exports.compareByOriginalPositions = compareByOriginalPositions;
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Comparator between two mappings where the generated positions are
|
166
|
+
* compared.
|
167
|
+
*
|
168
|
+
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
|
169
|
+
* mappings with the same generated line and column, but different
|
170
|
+
* source/name/original line and column the same. Useful when searching for a
|
171
|
+
* mapping with a stubbed out mapping.
|
172
|
+
*/
|
173
|
+
function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) {
|
174
|
+
var cmp;
|
175
|
+
|
176
|
+
cmp = mappingA.generatedLine - mappingB.generatedLine;
|
177
|
+
if (cmp) {
|
178
|
+
return cmp;
|
179
|
+
}
|
180
|
+
|
181
|
+
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
182
|
+
if (cmp || onlyCompareGenerated) {
|
183
|
+
return cmp;
|
184
|
+
}
|
185
|
+
|
186
|
+
cmp = strcmp(mappingA.source, mappingB.source);
|
187
|
+
if (cmp) {
|
188
|
+
return cmp;
|
189
|
+
}
|
190
|
+
|
191
|
+
cmp = mappingA.originalLine - mappingB.originalLine;
|
192
|
+
if (cmp) {
|
193
|
+
return cmp;
|
194
|
+
}
|
195
|
+
|
196
|
+
cmp = mappingA.originalColumn - mappingB.originalColumn;
|
197
|
+
if (cmp) {
|
198
|
+
return cmp;
|
199
|
+
}
|
200
|
+
|
201
|
+
return strcmp(mappingA.name, mappingB.name);
|
202
|
+
};
|
203
|
+
exports.compareByGeneratedPositions = compareByGeneratedPositions;
|
204
|
+
|
205
|
+
});
|
@@ -0,0 +1,58 @@
|
|
1
|
+
amdefine is released under two licenses: new BSD, and MIT. You may pick the
|
2
|
+
license that best suits your development needs. The text of both licenses are
|
3
|
+
provided below.
|
4
|
+
|
5
|
+
|
6
|
+
The "New" BSD License:
|
7
|
+
----------------------
|
8
|
+
|
9
|
+
Copyright (c) 2011, The Dojo Foundation
|
10
|
+
All rights reserved.
|
11
|
+
|
12
|
+
Redistribution and use in source and binary forms, with or without
|
13
|
+
modification, are permitted provided that the following conditions are met:
|
14
|
+
|
15
|
+
* Redistributions of source code must retain the above copyright notice, this
|
16
|
+
list of conditions and the following disclaimer.
|
17
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
18
|
+
this list of conditions and the following disclaimer in the documentation
|
19
|
+
and/or other materials provided with the distribution.
|
20
|
+
* Neither the name of the Dojo Foundation nor the names of its contributors
|
21
|
+
may be used to endorse or promote products derived from this software
|
22
|
+
without specific prior written permission.
|
23
|
+
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
25
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
26
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
27
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
28
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
29
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
30
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
32
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
33
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
MIT License
|
38
|
+
-----------
|
39
|
+
|
40
|
+
Copyright (c) 2011, The Dojo Foundation
|
41
|
+
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
43
|
+
of this software and associated documentation files (the "Software"), to deal
|
44
|
+
in the Software without restriction, including without limitation the rights
|
45
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
46
|
+
copies of the Software, and to permit persons to whom the Software is
|
47
|
+
furnished to do so, subject to the following conditions:
|
48
|
+
|
49
|
+
The above copyright notice and this permission notice shall be included in
|
50
|
+
all copies or substantial portions of the Software.
|
51
|
+
|
52
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
53
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
54
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
55
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
56
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
57
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
58
|
+
THE SOFTWARE.
|
@@ -0,0 +1,171 @@
|
|
1
|
+
# amdefine
|
2
|
+
|
3
|
+
A module that can be used to implement AMD's define() in Node. This allows you
|
4
|
+
to code to the AMD API and have the module work in node programs without
|
5
|
+
requiring those other programs to use AMD.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
**1)** Update your package.json to indicate amdefine as a dependency:
|
10
|
+
|
11
|
+
```javascript
|
12
|
+
"dependencies": {
|
13
|
+
"amdefine": ">=0.1.0"
|
14
|
+
}
|
15
|
+
```
|
16
|
+
|
17
|
+
Then run `npm install` to get amdefine into your project.
|
18
|
+
|
19
|
+
**2)** At the top of each module that uses define(), place this code:
|
20
|
+
|
21
|
+
```javascript
|
22
|
+
if (typeof define !== 'function') { var define = require('amdefine')(module) }
|
23
|
+
```
|
24
|
+
|
25
|
+
**Only use these snippets** when loading amdefine. If you preserve the basic structure,
|
26
|
+
with the braces, it will be stripped out when using the [RequireJS optimizer](#optimizer).
|
27
|
+
|
28
|
+
You can add spaces, line breaks and even require amdefine with a local path, but
|
29
|
+
keep the rest of the structure to get the stripping behavior.
|
30
|
+
|
31
|
+
As you may know, because `if` statements in JavaScript don't have their own scope, the var
|
32
|
+
declaration in the above snippet is made whether the `if` expression is truthy or not. If
|
33
|
+
RequireJS is loaded then the declaration is superfluous because `define` is already already
|
34
|
+
declared in the same scope in RequireJS. Fortunately JavaScript handles multiple `var`
|
35
|
+
declarations of the same variable in the same scope gracefully.
|
36
|
+
|
37
|
+
If you want to deliver amdefine.js with your code rather than specifying it as a dependency
|
38
|
+
with npm, then just download the latest release and refer to it using a relative path:
|
39
|
+
|
40
|
+
[Latest Version](https://github.com/jrburke/amdefine/raw/latest/amdefine.js)
|
41
|
+
|
42
|
+
### amdefine/intercept
|
43
|
+
|
44
|
+
Consider this very experimental.
|
45
|
+
|
46
|
+
Instead of pasting the piece of text for the amdefine setup of a `define`
|
47
|
+
variable in each module you create or consume, you can use `amdefine/intercept`
|
48
|
+
instead. It will automatically insert the above snippet in each .js file loaded
|
49
|
+
by Node.
|
50
|
+
|
51
|
+
**Warning**: you should only use this if you are creating an application that
|
52
|
+
is consuming AMD style defined()'d modules that are distributed via npm and want
|
53
|
+
to run that code in Node.
|
54
|
+
|
55
|
+
For library code where you are not sure if it will be used by others in Node or
|
56
|
+
in the browser, then explicitly depending on amdefine and placing the code
|
57
|
+
snippet above is suggested path, instead of using `amdefine/intercept`. The
|
58
|
+
intercept module affects all .js files loaded in the Node app, and it is
|
59
|
+
inconsiderate to modify global state like that unless you are also controlling
|
60
|
+
the top level app.
|
61
|
+
|
62
|
+
#### Why distribute AMD-style nodes via npm?
|
63
|
+
|
64
|
+
npm has a lot of weaknesses for front-end use (installed layout is not great,
|
65
|
+
should have better support for the `baseUrl + moduleID + '.js' style of loading,
|
66
|
+
single file JS installs), but some people want a JS package manager and are
|
67
|
+
willing to live with those constraints. If that is you, but still want to author
|
68
|
+
in AMD style modules to get dynamic require([]), better direct source usage and
|
69
|
+
powerful loader plugin support in the browser, then this tool can help.
|
70
|
+
|
71
|
+
#### amdefine/intercept usage
|
72
|
+
|
73
|
+
Just require it in your top level app module (for example index.js, server.js):
|
74
|
+
|
75
|
+
```javascript
|
76
|
+
require('amdefine/intercept');
|
77
|
+
```
|
78
|
+
|
79
|
+
The module does not return a value, so no need to assign the result to a local
|
80
|
+
variable.
|
81
|
+
|
82
|
+
Then just require() code as you normally would with Node's require(). Any .js
|
83
|
+
loaded after the intercept require will have the amdefine check injected in
|
84
|
+
the .js source as it is loaded. It does not modify the source on disk, just
|
85
|
+
prepends some content to the text of the module as it is loaded by Node.
|
86
|
+
|
87
|
+
#### How amdefine/intercept works
|
88
|
+
|
89
|
+
It overrides the `Module._extensions['.js']` in Node to automatically prepend
|
90
|
+
the amdefine snippet above. So, it will affect any .js file loaded by your
|
91
|
+
app.
|
92
|
+
|
93
|
+
## define() usage
|
94
|
+
|
95
|
+
It is best if you use the anonymous forms of define() in your module:
|
96
|
+
|
97
|
+
```javascript
|
98
|
+
define(function (require) {
|
99
|
+
var dependency = require('dependency');
|
100
|
+
});
|
101
|
+
```
|
102
|
+
|
103
|
+
or
|
104
|
+
|
105
|
+
```javascript
|
106
|
+
define(['dependency'], function (dependency) {
|
107
|
+
|
108
|
+
});
|
109
|
+
```
|
110
|
+
|
111
|
+
## RequireJS optimizer integration. <a name="optimizer"></name>
|
112
|
+
|
113
|
+
Version 1.0.3 of the [RequireJS optimizer](http://requirejs.org/docs/optimization.html)
|
114
|
+
will have support for stripping the `if (typeof define !== 'function')` check
|
115
|
+
mentioned above, so you can include this snippet for code that runs in the
|
116
|
+
browser, but avoid taking the cost of the if() statement once the code is
|
117
|
+
optimized for deployment.
|
118
|
+
|
119
|
+
## Node 0.4 Support
|
120
|
+
|
121
|
+
If you want to support Node 0.4, then add `require` as the second parameter to amdefine:
|
122
|
+
|
123
|
+
```javascript
|
124
|
+
//Only if you want Node 0.4. If using 0.5 or later, use the above snippet.
|
125
|
+
if (typeof define !== 'function') { var define = require('amdefine')(module, require) }
|
126
|
+
```
|
127
|
+
|
128
|
+
## Limitations
|
129
|
+
|
130
|
+
### Synchronous vs Asynchronous
|
131
|
+
|
132
|
+
amdefine creates a define() function that is callable by your code. It will
|
133
|
+
execute and trace dependencies and call the factory function *synchronously*,
|
134
|
+
to keep the behavior in line with Node's synchronous dependency tracing.
|
135
|
+
|
136
|
+
The exception: calling AMD's callback-style require() from inside a factory
|
137
|
+
function. The require callback is called on process.nextTick():
|
138
|
+
|
139
|
+
```javascript
|
140
|
+
define(function (require) {
|
141
|
+
require(['a'], function(a) {
|
142
|
+
//'a' is loaded synchronously, but
|
143
|
+
//this callback is called on process.nextTick().
|
144
|
+
});
|
145
|
+
});
|
146
|
+
```
|
147
|
+
|
148
|
+
### Loader Plugins
|
149
|
+
|
150
|
+
Loader plugins are supported as long as they call their load() callbacks
|
151
|
+
synchronously. So ones that do network requests will not work. However plugins
|
152
|
+
like [text](http://requirejs.org/docs/api.html#text) can load text files locally.
|
153
|
+
|
154
|
+
The plugin API's `load.fromText()` is **not supported** in amdefine, so this means
|
155
|
+
transpiler plugins like the [CoffeeScript loader plugin](https://github.com/jrburke/require-cs)
|
156
|
+
will not work. This may be fixable, but it is a bit complex, and I do not have
|
157
|
+
enough node-fu to figure it out yet. See the source for amdefine.js if you want
|
158
|
+
to get an idea of the issues involved.
|
159
|
+
|
160
|
+
## Tests
|
161
|
+
|
162
|
+
To run the tests, cd to **tests** and run:
|
163
|
+
|
164
|
+
```
|
165
|
+
node all.js
|
166
|
+
node all-intercept.js
|
167
|
+
```
|
168
|
+
|
169
|
+
## License
|
170
|
+
|
171
|
+
New BSD and MIT. Check the LICENSE file for all the details.
|
@@ -0,0 +1,299 @@
|
|
1
|
+
/** vim: et:ts=4:sw=4:sts=4
|
2
|
+
* @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
|
3
|
+
* Available via the MIT or new BSD license.
|
4
|
+
* see: http://github.com/jrburke/amdefine for details
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*jslint node: true */
|
8
|
+
/*global module, process */
|
9
|
+
'use strict';
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Creates a define for node.
|
13
|
+
* @param {Object} module the "module" object that is defined by Node for the
|
14
|
+
* current module.
|
15
|
+
* @param {Function} [requireFn]. Node's require function for the current module.
|
16
|
+
* It only needs to be passed in Node versions before 0.5, when module.require
|
17
|
+
* did not exist.
|
18
|
+
* @returns {Function} a define function that is usable for the current node
|
19
|
+
* module.
|
20
|
+
*/
|
21
|
+
function amdefine(module, requireFn) {
|
22
|
+
'use strict';
|
23
|
+
var defineCache = {},
|
24
|
+
loaderCache = {},
|
25
|
+
alreadyCalled = false,
|
26
|
+
path = require('path'),
|
27
|
+
makeRequire, stringRequire;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Trims the . and .. from an array of path segments.
|
31
|
+
* It will keep a leading path segment if a .. will become
|
32
|
+
* the first path segment, to help with module name lookups,
|
33
|
+
* which act like paths, but can be remapped. But the end result,
|
34
|
+
* all paths that use this function should look normalized.
|
35
|
+
* NOTE: this method MODIFIES the input array.
|
36
|
+
* @param {Array} ary the array of path segments.
|
37
|
+
*/
|
38
|
+
function trimDots(ary) {
|
39
|
+
var i, part;
|
40
|
+
for (i = 0; ary[i]; i+= 1) {
|
41
|
+
part = ary[i];
|
42
|
+
if (part === '.') {
|
43
|
+
ary.splice(i, 1);
|
44
|
+
i -= 1;
|
45
|
+
} else if (part === '..') {
|
46
|
+
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
|
47
|
+
//End of the line. Keep at least one non-dot
|
48
|
+
//path segment at the front so it can be mapped
|
49
|
+
//correctly to disk. Otherwise, there is likely
|
50
|
+
//no path mapping for a path starting with '..'.
|
51
|
+
//This can still fail, but catches the most reasonable
|
52
|
+
//uses of ..
|
53
|
+
break;
|
54
|
+
} else if (i > 0) {
|
55
|
+
ary.splice(i - 1, 2);
|
56
|
+
i -= 2;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
function normalize(name, baseName) {
|
63
|
+
var baseParts;
|
64
|
+
|
65
|
+
//Adjust any relative paths.
|
66
|
+
if (name && name.charAt(0) === '.') {
|
67
|
+
//If have a base name, try to normalize against it,
|
68
|
+
//otherwise, assume it is a top-level require that will
|
69
|
+
//be relative to baseUrl in the end.
|
70
|
+
if (baseName) {
|
71
|
+
baseParts = baseName.split('/');
|
72
|
+
baseParts = baseParts.slice(0, baseParts.length - 1);
|
73
|
+
baseParts = baseParts.concat(name.split('/'));
|
74
|
+
trimDots(baseParts);
|
75
|
+
name = baseParts.join('/');
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
return name;
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Create the normalize() function passed to a loader plugin's
|
84
|
+
* normalize method.
|
85
|
+
*/
|
86
|
+
function makeNormalize(relName) {
|
87
|
+
return function (name) {
|
88
|
+
return normalize(name, relName);
|
89
|
+
};
|
90
|
+
}
|
91
|
+
|
92
|
+
function makeLoad(id) {
|
93
|
+
function load(value) {
|
94
|
+
loaderCache[id] = value;
|
95
|
+
}
|
96
|
+
|
97
|
+
load.fromText = function (id, text) {
|
98
|
+
//This one is difficult because the text can/probably uses
|
99
|
+
//define, and any relative paths and requires should be relative
|
100
|
+
//to that id was it would be found on disk. But this would require
|
101
|
+
//bootstrapping a module/require fairly deeply from node core.
|
102
|
+
//Not sure how best to go about that yet.
|
103
|
+
throw new Error('amdefine does not implement load.fromText');
|
104
|
+
};
|
105
|
+
|
106
|
+
return load;
|
107
|
+
}
|
108
|
+
|
109
|
+
makeRequire = function (systemRequire, exports, module, relId) {
|
110
|
+
function amdRequire(deps, callback) {
|
111
|
+
if (typeof deps === 'string') {
|
112
|
+
//Synchronous, single module require('')
|
113
|
+
return stringRequire(systemRequire, exports, module, deps, relId);
|
114
|
+
} else {
|
115
|
+
//Array of dependencies with a callback.
|
116
|
+
|
117
|
+
//Convert the dependencies to modules.
|
118
|
+
deps = deps.map(function (depName) {
|
119
|
+
return stringRequire(systemRequire, exports, module, depName, relId);
|
120
|
+
});
|
121
|
+
|
122
|
+
//Wait for next tick to call back the require call.
|
123
|
+
process.nextTick(function () {
|
124
|
+
callback.apply(null, deps);
|
125
|
+
});
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
amdRequire.toUrl = function (filePath) {
|
130
|
+
if (filePath.indexOf('.') === 0) {
|
131
|
+
return normalize(filePath, path.dirname(module.filename));
|
132
|
+
} else {
|
133
|
+
return filePath;
|
134
|
+
}
|
135
|
+
};
|
136
|
+
|
137
|
+
return amdRequire;
|
138
|
+
};
|
139
|
+
|
140
|
+
//Favor explicit value, passed in if the module wants to support Node 0.4.
|
141
|
+
requireFn = requireFn || function req() {
|
142
|
+
return module.require.apply(module, arguments);
|
143
|
+
};
|
144
|
+
|
145
|
+
function runFactory(id, deps, factory) {
|
146
|
+
var r, e, m, result;
|
147
|
+
|
148
|
+
if (id) {
|
149
|
+
e = loaderCache[id] = {};
|
150
|
+
m = {
|
151
|
+
id: id,
|
152
|
+
uri: __filename,
|
153
|
+
exports: e
|
154
|
+
};
|
155
|
+
r = makeRequire(requireFn, e, m, id);
|
156
|
+
} else {
|
157
|
+
//Only support one define call per file
|
158
|
+
if (alreadyCalled) {
|
159
|
+
throw new Error('amdefine with no module ID cannot be called more than once per file.');
|
160
|
+
}
|
161
|
+
alreadyCalled = true;
|
162
|
+
|
163
|
+
//Use the real variables from node
|
164
|
+
//Use module.exports for exports, since
|
165
|
+
//the exports in here is amdefine exports.
|
166
|
+
e = module.exports;
|
167
|
+
m = module;
|
168
|
+
r = makeRequire(requireFn, e, m, module.id);
|
169
|
+
}
|
170
|
+
|
171
|
+
//If there are dependencies, they are strings, so need
|
172
|
+
//to convert them to dependency values.
|
173
|
+
if (deps) {
|
174
|
+
deps = deps.map(function (depName) {
|
175
|
+
return r(depName);
|
176
|
+
});
|
177
|
+
}
|
178
|
+
|
179
|
+
//Call the factory with the right dependencies.
|
180
|
+
if (typeof factory === 'function') {
|
181
|
+
result = factory.apply(m.exports, deps);
|
182
|
+
} else {
|
183
|
+
result = factory;
|
184
|
+
}
|
185
|
+
|
186
|
+
if (result !== undefined) {
|
187
|
+
m.exports = result;
|
188
|
+
if (id) {
|
189
|
+
loaderCache[id] = m.exports;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
stringRequire = function (systemRequire, exports, module, id, relId) {
|
195
|
+
//Split the ID by a ! so that
|
196
|
+
var index = id.indexOf('!'),
|
197
|
+
originalId = id,
|
198
|
+
prefix, plugin;
|
199
|
+
|
200
|
+
if (index === -1) {
|
201
|
+
id = normalize(id, relId);
|
202
|
+
|
203
|
+
//Straight module lookup. If it is one of the special dependencies,
|
204
|
+
//deal with it, otherwise, delegate to node.
|
205
|
+
if (id === 'require') {
|
206
|
+
return makeRequire(systemRequire, exports, module, relId);
|
207
|
+
} else if (id === 'exports') {
|
208
|
+
return exports;
|
209
|
+
} else if (id === 'module') {
|
210
|
+
return module;
|
211
|
+
} else if (loaderCache.hasOwnProperty(id)) {
|
212
|
+
return loaderCache[id];
|
213
|
+
} else if (defineCache[id]) {
|
214
|
+
runFactory.apply(null, defineCache[id]);
|
215
|
+
return loaderCache[id];
|
216
|
+
} else {
|
217
|
+
if(systemRequire) {
|
218
|
+
return systemRequire(originalId);
|
219
|
+
} else {
|
220
|
+
throw new Error('No module with ID: ' + id);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
} else {
|
224
|
+
//There is a plugin in play.
|
225
|
+
prefix = id.substring(0, index);
|
226
|
+
id = id.substring(index + 1, id.length);
|
227
|
+
|
228
|
+
plugin = stringRequire(systemRequire, exports, module, prefix, relId);
|
229
|
+
|
230
|
+
if (plugin.normalize) {
|
231
|
+
id = plugin.normalize(id, makeNormalize(relId));
|
232
|
+
} else {
|
233
|
+
//Normalize the ID normally.
|
234
|
+
id = normalize(id, relId);
|
235
|
+
}
|
236
|
+
|
237
|
+
if (loaderCache[id]) {
|
238
|
+
return loaderCache[id];
|
239
|
+
} else {
|
240
|
+
plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
|
241
|
+
|
242
|
+
return loaderCache[id];
|
243
|
+
}
|
244
|
+
}
|
245
|
+
};
|
246
|
+
|
247
|
+
//Create a define function specific to the module asking for amdefine.
|
248
|
+
function define(id, deps, factory) {
|
249
|
+
if (Array.isArray(id)) {
|
250
|
+
factory = deps;
|
251
|
+
deps = id;
|
252
|
+
id = undefined;
|
253
|
+
} else if (typeof id !== 'string') {
|
254
|
+
factory = id;
|
255
|
+
id = deps = undefined;
|
256
|
+
}
|
257
|
+
|
258
|
+
if (deps && !Array.isArray(deps)) {
|
259
|
+
factory = deps;
|
260
|
+
deps = undefined;
|
261
|
+
}
|
262
|
+
|
263
|
+
if (!deps) {
|
264
|
+
deps = ['require', 'exports', 'module'];
|
265
|
+
}
|
266
|
+
|
267
|
+
//Set up properties for this module. If an ID, then use
|
268
|
+
//internal cache. If no ID, then use the external variables
|
269
|
+
//for this node module.
|
270
|
+
if (id) {
|
271
|
+
//Put the module in deep freeze until there is a
|
272
|
+
//require call for it.
|
273
|
+
defineCache[id] = [id, deps, factory];
|
274
|
+
} else {
|
275
|
+
runFactory(id, deps, factory);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
//define.require, which has access to all the values in the
|
280
|
+
//cache. Useful for AMD modules that all have IDs in the file,
|
281
|
+
//but need to finally export a value to node based on one of those
|
282
|
+
//IDs.
|
283
|
+
define.require = function (id) {
|
284
|
+
if (loaderCache[id]) {
|
285
|
+
return loaderCache[id];
|
286
|
+
}
|
287
|
+
|
288
|
+
if (defineCache[id]) {
|
289
|
+
runFactory.apply(null, defineCache[id]);
|
290
|
+
return loaderCache[id];
|
291
|
+
}
|
292
|
+
};
|
293
|
+
|
294
|
+
define.amd = {};
|
295
|
+
|
296
|
+
return define;
|
297
|
+
}
|
298
|
+
|
299
|
+
module.exports = amdefine;
|