aboutsummaryrefslogtreecommitdiff
path: root/tools/node_modules
diff options
context:
space:
mode:
authorJez Ng <me@jezng.com>2013-06-06 17:48:21 -0700
committerJez Ng <me@jezng.com>2013-06-19 01:22:01 -0700
commit86e672a4371e57238fabdde3a35eeee03c8aa77f (patch)
treef4ec03ff2e181e10865b18865e522284d6a29f9f /tools/node_modules
parent6d7fb083a86bd58317ff3ce0ecc2300934bb9076 (diff)
Commit the source-map library.
Diffstat (limited to 'tools/node_modules')
-rw-r--r--tools/node_modules/source-map/.npmignore2
-rw-r--r--tools/node_modules/source-map/.travis.yml4
-rw-r--r--tools/node_modules/source-map/CHANGELOG.md58
-rw-r--r--tools/node_modules/source-map/LICENSE28
-rw-r--r--tools/node_modules/source-map/Makefile.dryice.js166
-rw-r--r--tools/node_modules/source-map/README.md347
-rw-r--r--tools/node_modules/source-map/build/assert-shim.js56
-rw-r--r--tools/node_modules/source-map/build/mini-require.js152
-rw-r--r--tools/node_modules/source-map/build/prefix-source-map.jsm20
-rw-r--r--tools/node_modules/source-map/build/prefix-utils.jsm18
-rw-r--r--tools/node_modules/source-map/build/suffix-browser.js8
-rw-r--r--tools/node_modules/source-map/build/suffix-source-map.jsm6
-rw-r--r--tools/node_modules/source-map/build/suffix-utils.jsm21
-rw-r--r--tools/node_modules/source-map/build/test-prefix.js8
-rw-r--r--tools/node_modules/source-map/build/test-suffix.js3
-rw-r--r--tools/node_modules/source-map/lib/source-map.js8
-rw-r--r--tools/node_modules/source-map/lib/source-map/array-set.js96
-rw-r--r--tools/node_modules/source-map/lib/source-map/base64-vlq.js144
-rw-r--r--tools/node_modules/source-map/lib/source-map/base64.js42
-rw-r--r--tools/node_modules/source-map/lib/source-map/binary-search.js81
-rw-r--r--tools/node_modules/source-map/lib/source-map/source-map-consumer.js426
-rw-r--r--tools/node_modules/source-map/lib/source-map/source-map-generator.js381
-rw-r--r--tools/node_modules/source-map/lib/source-map/source-node.js353
-rw-r--r--tools/node_modules/source-map/lib/source-map/util.js91
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/LICENSE58
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/README.md119
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/amdefine.js299
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/package.json40
-rw-r--r--tools/node_modules/source-map/package.json81
-rwxr-xr-xtools/node_modules/source-map/test/run-tests.js73
-rw-r--r--tools/node_modules/source-map/test/source-map/test-api.js26
-rw-r--r--tools/node_modules/source-map/test/source-map/test-array-set.js71
-rw-r--r--tools/node_modules/source-map/test/source-map/test-base64-vlq.js24
-rw-r--r--tools/node_modules/source-map/test/source-map/test-base64.js35
-rw-r--r--tools/node_modules/source-map/test/source-map/test-binary-search.js54
-rw-r--r--tools/node_modules/source-map/test/source-map/test-dog-fooding.js72
-rw-r--r--tools/node_modules/source-map/test/source-map/test-source-map-consumer.js291
-rw-r--r--tools/node_modules/source-map/test/source-map/test-source-map-generator.js391
-rw-r--r--tools/node_modules/source-map/test/source-map/test-source-node.js282
-rw-r--r--tools/node_modules/source-map/test/source-map/util.js152
40 files changed, 4587 insertions, 0 deletions
diff --git a/tools/node_modules/source-map/.npmignore b/tools/node_modules/source-map/.npmignore
new file mode 100644
index 00000000..3dddf3f6
--- /dev/null
+++ b/tools/node_modules/source-map/.npmignore
@@ -0,0 +1,2 @@
+dist/*
+node_modules/*
diff --git a/tools/node_modules/source-map/.travis.yml b/tools/node_modules/source-map/.travis.yml
new file mode 100644
index 00000000..ddc9c4f9
--- /dev/null
+++ b/tools/node_modules/source-map/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.8
+ - "0.10" \ No newline at end of file
diff --git a/tools/node_modules/source-map/CHANGELOG.md b/tools/node_modules/source-map/CHANGELOG.md
new file mode 100644
index 00000000..140fe0cf
--- /dev/null
+++ b/tools/node_modules/source-map/CHANGELOG.md
@@ -0,0 +1,58 @@
+# Change Log
+
+## 0.1.22
+
+* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21.
+
+## 0.1.21
+
+* Fixed handling of sources that start with a slash so that they are relative to
+ the source root's host.
+
+## 0.1.20
+
+* Fixed github issue #43: absolute URLs aren't joined with the source root
+ anymore.
+
+## 0.1.19
+
+* Using Travis CI to run tests.
+
+## 0.1.18
+
+* Fixed a bug in the handling of sourceRoot.
+
+## 0.1.17
+
+* Added SourceNode.fromStringWithSourceMap.
+
+## 0.1.16
+
+* Added missing documentation.
+
+* Fixed the generating of empty mappings in SourceNode.
+
+## 0.1.15
+
+* Added SourceMapGenerator.applySourceMap.
+
+## 0.1.14
+
+* The sourceRoot is now handled consistently.
+
+## 0.1.13
+
+* Added SourceMapGenerator.fromSourceMap.
+
+## 0.1.12
+
+* SourceNode now generates empty mappings too.
+
+## 0.1.11
+
+* Added name support to SourceNode.
+
+## 0.1.10
+
+* Added sourcesContent support to the customer and generator.
+
diff --git a/tools/node_modules/source-map/LICENSE b/tools/node_modules/source-map/LICENSE
new file mode 100644
index 00000000..ed1b7cf2
--- /dev/null
+++ b/tools/node_modules/source-map/LICENSE
@@ -0,0 +1,28 @@
+
+Copyright (c) 2009-2011, Mozilla Foundation and contributors
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the names of the Mozilla Foundation nor the names of project
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/node_modules/source-map/Makefile.dryice.js b/tools/node_modules/source-map/Makefile.dryice.js
new file mode 100644
index 00000000..8973ac2c
--- /dev/null
+++ b/tools/node_modules/source-map/Makefile.dryice.js
@@ -0,0 +1,166 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+var path = require('path');
+var fs = require('fs');
+var copy = require('dryice').copy;
+
+function removeAmdefine(src) {
+ src = String(src).replace(
+ /if\s*\(typeof\s*define\s*!==\s*'function'\)\s*{\s*var\s*define\s*=\s*require\('amdefine'\)\(module\);\s*}\s*/g,
+ '');
+ src = src.replace(
+ /\b(define\(.*)('amdefine',?)/gm,
+ '$1');
+ return src;
+}
+removeAmdefine.onRead = true;
+
+function makeNonRelative(src) {
+ return src
+ .replace(/require\('.\//g, 'require(\'source-map/')
+ .replace(/\.\.\/\.\.\/lib\//g, '');
+}
+makeNonRelative.onRead = true;
+
+function buildBrowser() {
+ console.log('\nCreating dist/source-map.js');
+
+ var project = copy.createCommonJsProject({
+ roots: [ path.join(__dirname, 'lib') ]
+ });
+
+ copy({
+ source: [
+ 'build/mini-require.js',
+ {
+ project: project,
+ require: [ 'source-map/source-map-generator',
+ 'source-map/source-map-consumer',
+ 'source-map/source-node']
+ },
+ 'build/suffix-browser.js'
+ ],
+ filter: [
+ copy.filter.moduleDefines,
+ removeAmdefine
+ ],
+ dest: 'dist/source-map.js'
+ });
+}
+
+function buildBrowserMin() {
+ console.log('\nCreating dist/source-map.min.js');
+
+ copy({
+ source: 'dist/source-map.js',
+ filter: copy.filter.uglifyjs,
+ dest: 'dist/source-map.min.js'
+ });
+}
+
+function buildFirefox() {
+ console.log('\nCreating dist/SourceMap.jsm');
+
+ var project = copy.createCommonJsProject({
+ roots: [ path.join(__dirname, 'lib') ]
+ });
+
+ copy({
+ source: [
+ 'build/prefix-source-map.jsm',
+ {
+ project: project,
+ require: [ 'source-map/source-map-consumer',
+ 'source-map/source-map-generator',
+ 'source-map/source-node' ]
+ },
+ 'build/suffix-source-map.jsm'
+ ],
+ filter: [
+ copy.filter.moduleDefines,
+ removeAmdefine,
+ makeNonRelative
+ ],
+ dest: 'dist/SourceMap.jsm'
+ });
+
+ // Create dist/test/Utils.jsm
+ console.log('\nCreating dist/test/Utils.jsm');
+
+ project = copy.createCommonJsProject({
+ roots: [ __dirname, path.join(__dirname, 'lib') ]
+ });
+
+ copy({
+ source: [
+ 'build/prefix-utils.jsm',
+ 'build/assert-shim.js',
+ {
+ project: project,
+ require: [ 'test/source-map/util' ]
+ },
+ 'build/suffix-utils.jsm'
+ ],
+ filter: [
+ copy.filter.moduleDefines,
+ removeAmdefine,
+ makeNonRelative
+ ],
+ dest: 'dist/test/Utils.jsm'
+ });
+
+ function isTestFile(f) {
+ return /^test\-.*?\.js/.test(f);
+ }
+
+ var testFiles = fs.readdirSync(path.join(__dirname, 'test', 'source-map')).filter(isTestFile);
+
+ testFiles.forEach(function (testFile) {
+ console.log('\nCreating', path.join('dist', 'test', testFile.replace(/\-/g, '_')));
+
+ copy({
+ source: [
+ 'build/test-prefix.js',
+ path.join('test', 'source-map', testFile),
+ 'build/test-suffix.js'
+ ],
+ filter: [
+ removeAmdefine,
+ makeNonRelative,
+ function (input, source) {
+ return input.replace('define(',
+ 'define("'
+ + path.join('test', 'source-map', testFile.replace(/\.js$/, ''))
+ + '", ["require", "exports", "module"], ');
+ },
+ function (input, source) {
+ return input.replace('{THIS_MODULE}', function () {
+ return "test/source-map/" + testFile.replace(/\.js$/, '');
+ });
+ }
+ ],
+ dest: path.join('dist', 'test', testFile.replace(/\-/g, '_'))
+ });
+ });
+}
+
+function ensureDir(name) {
+ var dirExists = false;
+ try {
+ dirExists = fs.statSync(name).isDirectory();
+ } catch (err) {}
+
+ if (!dirExists) {
+ fs.mkdirSync(name, 0777);
+ }
+}
+
+ensureDir("dist");
+ensureDir("dist/test");
+buildFirefox();
+buildBrowser();
+buildBrowserMin();
diff --git a/tools/node_modules/source-map/README.md b/tools/node_modules/source-map/README.md
new file mode 100644
index 00000000..95e6787a
--- /dev/null
+++ b/tools/node_modules/source-map/README.md
@@ -0,0 +1,347 @@
+# Source Map
+
+This is a library to generate and consume the source map format
+[described here][format].
+
+[Learn more here][feature].
+
+This library was written in the Asynchronous Module Definition
+format. It should work in the following environments:
+
+* Modern Browsers (either after the build, or with an AMD loader such as
+ RequireJS)
+
+* Inside Firefox (as a JSM file, after the build)
+
+* With NodeJS versions 0.8.X and higher
+
+## Installing with NPM (for use with NodeJS)
+
+Simply
+
+ $ npm install source-map
+
+Or, if you'd like to hack on this library and have it installed via npm so you
+can try out your changes:
+
+ $ git clone https://fitzgen@github.com/mozilla/source-map.git
+ $ cd source-map
+ $ npm link .
+
+## Building from Source (for everywhere else)
+
+Install Node and then run
+
+ $ git clone https://fitzgen@github.com/mozilla/source-map.git
+ $ cd source-map
+ $ npm link .
+
+Next, run
+
+ $ node Makefile.dryice.js`
+
+This should create the following files:
+
+* `dist/source-map.js` - The unminified browser version.
+
+* `dist/source-map.min.js` - The minified browser version.
+
+* `dist/SourceMap.jsm` - The JavaScript Module for inclusion in Firefox
+ source.
+
+## API
+
+Get a reference to the module:
+
+ // NodeJS
+ var sourceMap = require('source-map');
+
+ // Browser builds
+ var sourceMap = window.sourceMap;
+
+ // Inside Firefox
+ let sourceMap = {};
+ Components.utils.import('resource:///modules/devtools/SourceMap.jsm', sourceMap);
+
+### SourceMapConsumer
+
+A SourceMapConsumer instance represents a parsed source map which we can query
+for information about the original file positions by giving it a file position
+in the generated source.
+
+#### new SourceMapConsumer(rawSourceMap)
+
+The only parameter is the raw source map (either as a string which can be
+`JSON.parse`'d, or an object). According to the spec, source maps have the
+following attributes:
+
+* `version`: Which version of the source map spec this map is following.
+
+* `sources`: An array of URLs to the original source files.
+
+* `names`: An array of identifiers which can be referrenced by individual
+ mappings.
+
+* `sourceRoot`: Optional. The URL root from which all sources are relative.
+
+* `sourcesContent`: Optional. An array of contents of the original source files.
+
+* `mappings`: A string of base64 VLQs which contain the actual mappings.
+
+* `file`: The generated filename this source map is associated with.
+
+#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
+
+Returns the original source, line, and column information for the generated
+source's line and column positions provided. The only argument is an object with
+the following properties:
+
+* `line`: The line number in the generated source.
+
+* `column`: The column number in the generated source.
+
+and an object is returned with the following properties:
+
+* `source`: The original source file, or null if this information is not
+ available.
+
+* `line`: The line number in the original source, or null if this information is
+ not available.
+
+* `column`: The column number in the original source, or null or null if this
+ information is not available.
+
+* `name`: The original identifier, or null if this information is not available.
+
+#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
+
+Returns the generated line and column information for the original source,
+line, and column positions provided. The only argument is an object with
+the following properties:
+
+* `source`: The filename of the original source.
+
+* `line`: The line number in the original source.
+
+* `column`: The column number in the original source.
+
+and an object is returned with the following properties:
+
+* `line`: The line number in the generated source, or null.
+
+* `column`: The column number in the generated source, or null.
+
+#### SourceMapConsumer.prototype.sourceContentFor(source)
+
+Returns the original source content for the source provided. The only
+argument is the URL of the original source file.
+
+#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
+
+Iterate over each mapping between an original source/line/column and a
+generated line/column in this source map.
+
+* `callback`: The function that is called with each mapping.
+
+* `context`: Optional. If specified, this object will be the value of `this`
+ every time that `callback` is called.
+
+* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
+ `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
+ the mappings sorted by the generated file's line/column order or the
+ original's source/line/column order, respectively. Defaults to
+ `SourceMapConsumer.GENERATED_ORDER`.
+
+### SourceMapGenerator
+
+An instance of the SourceMapGenerator represents a source map which is being
+built incrementally.
+
+#### new SourceMapGenerator(startOfSourceMap)
+
+To create a new one, you must pass an object with the following properties:
+
+* `file`: The filename of the generated source that this source map is
+ associated with.
+
+* `sourceRoot`: An optional root for all relative URLs in this source map.
+
+#### SourceMapGenerator.fromSourceMap(sourceMapConsumer)
+
+Creates a new SourceMapGenerator based on a SourceMapConsumer
+
+* `sourceMapConsumer` The SourceMap.
+
+#### SourceMapGenerator.prototype.addMapping(mapping)
+
+Add a single mapping from original source line and column to the generated
+source's line and column for this source map being created. The mapping object
+should have the following properties:
+
+* `generated`: An object with the generated line and column positions.
+
+* `original`: An object with the original line and column positions.
+
+* `source`: The original source file (relative to the sourceRoot).
+
+* `name`: An optional original token name for this mapping.
+
+#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
+
+Set the source content for an original source file.
+
+* `sourceFile` the URL of the original source file.
+
+* `sourceContent` the content of the source file.
+
+#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile])
+
+Applies a SourceMap for a source file to the SourceMap.
+Each mapping to the supplied source file is rewritten using the
+supplied SourceMap. Note: The resolution for the resulting mappings
+is the minimium of this map and the supplied map.
+
+* `sourceMapConsumer`: The SourceMap to be applied.
+
+* `sourceFile`: Optional. The filename of the source file.
+ If omitted, sourceMapConsumer.file will be used.
+
+#### SourceMapGenerator.prototype.toString()
+
+Renders the source map being generated to a string.
+
+### SourceNode
+
+SourceNodes provide a way to abstract over interpolating and/or concatenating
+snippets of generated JavaScript source code, while maintaining the line and
+column information associated between those snippets and the original source
+code. This is useful as the final intermediate representation a compiler might
+use before outputting the generated JS and source map.
+
+#### new SourceNode(line, column, source[, chunk[, name]])
+
+* `line`: The original line number associated with this source node, or null if
+ it isn't associated with an original line.
+
+* `column`: The original column number associated with this source node, or null
+ if it isn't associated with an original column.
+
+* `source`: The original source's filename.
+
+* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
+ below.
+
+* `name`: Optional. The original identifier.
+
+#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer)
+
+Creates a SourceNode from generated code and a SourceMapConsumer.
+
+* `code`: The generated code
+
+* `sourceMapConsumer` The SourceMap for the generated code
+
+#### SourceNode.prototype.add(chunk)
+
+Add a chunk of generated JS to this source node.
+
+* `chunk`: A string snippet of generated JS code, another instance of
+ `SourceNode`, or an array where each member is one of those things.
+
+#### SourceNode.prototype.prepend(chunk)
+
+Prepend a chunk of generated JS to this source node.
+
+* `chunk`: A string snippet of generated JS code, another instance of
+ `SourceNode`, or an array where each member is one of those things.
+
+#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
+
+Set the source content for a source file. This will be added to the
+`SourceMap` in the `sourcesContent` field.
+
+* `sourceFile`: The filename of the source file
+
+* `sourceContent`: The content of the source file
+
+#### SourceNode.prototype.walk(fn)
+
+Walk over the tree of JS snippets in this node and its children. The walking
+function is called once for each snippet of JS and is passed that snippet and
+the its original associated source's line/column location.
+
+* `fn`: The traversal function.
+
+#### SourceNode.prototype.walkSourceContents(fn)
+
+Walk over the tree of SourceNodes. The walking function is called for each
+source file content and is passed the filename and source content.
+
+* `fn`: The traversal function.
+
+#### SourceNode.prototype.join(sep)
+
+Like `Array.prototype.join` except for SourceNodes. Inserts the separator
+between each of this source node's children.
+
+* `sep`: The separator.
+
+#### SourceNode.prototype.replaceRight(pattern, replacement)
+
+Call `String.prototype.replace` on the very right-most source snippet. Useful
+for trimming whitespace from the end of a source node, etc.
+
+* `pattern`: The pattern to replace.
+
+* `replacement`: The thing to replace the pattern with.
+
+#### SourceNode.prototype.toString()
+
+Return the string representation of this source node. Walks over the tree and
+concatenates all the various snippets together to one string.
+
+### SourceNode.prototype.toStringWithSourceMap(startOfSourceMap)
+
+Returns the string representation of this tree of source nodes, plus a
+SourceMapGenerator which contains all the mappings between the generated and
+original sources.
+
+The arguments are the same as those to `new SourceMapGenerator`.
+
+## Tests
+
+[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map)
+
+Install NodeJS version 0.8.0 or greater, then run `node test/run-tests.js`.
+
+To add new tests, create a new file named `test/test-<your new test name>.js`
+and export your test functions with names that start with "test", for example
+
+ exports["test doing the foo bar"] = function (assert, util) {
+ ...
+ };
+
+The new test will be located automatically when you run the suite.
+
+The `util` argument is the test utility module located at `test/source-map/util`.
+
+The `assert` argument is a cut down version of node's assert module. You have
+access to the following assertion functions:
+
+* `doesNotThrow`
+
+* `equal`
+
+* `ok`
+
+* `strictEqual`
+
+* `throws`
+
+(The reason for the restricted set of test functions is because we need the
+tests to run inside Firefox's test suite as well and so the assert module is
+shimmed in that environment. See `build/assert-shim.js`.)
+
+[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
+[feature]: https://wiki.mozilla.org/DevTools/Features/SourceMap
+[Dryice]: https://github.com/mozilla/dryice
diff --git a/tools/node_modules/source-map/build/assert-shim.js b/tools/node_modules/source-map/build/assert-shim.js
new file mode 100644
index 00000000..daa1a623
--- /dev/null
+++ b/tools/node_modules/source-map/build/assert-shim.js
@@ -0,0 +1,56 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+define('test/source-map/assert', ['exports'], function (exports) {
+
+ let do_throw = function (msg) {
+ throw new Error(msg);
+ };
+
+ exports.init = function (throw_fn) {
+ do_throw = throw_fn;
+ };
+
+ exports.doesNotThrow = function (fn) {
+ try {
+ fn();
+ }
+ catch (e) {
+ do_throw(e.message);
+ }
+ };
+
+ exports.equal = function (actual, expected, msg) {
+ msg = msg || String(actual) + ' != ' + String(expected);
+ if (actual != expected) {
+ do_throw(msg);
+ }
+ };
+
+ exports.ok = function (val, msg) {
+ msg = msg || String(val) + ' is falsey';
+ if (!Boolean(val)) {
+ do_throw(msg);
+ }
+ };
+
+ exports.strictEqual = function (actual, expected, msg) {
+ msg = msg || String(actual) + ' !== ' + String(expected);
+ if (actual !== expected) {
+ do_throw(msg);
+ }
+ };
+
+ exports.throws = function (fn) {
+ try {
+ fn();
+ do_throw('Expected an error to be thrown, but it wasn\'t.');
+ }
+ catch (e) {
+ }
+ };
+
+});
diff --git a/tools/node_modules/source-map/build/mini-require.js b/tools/node_modules/source-map/build/mini-require.js
new file mode 100644
index 00000000..0daf4537
--- /dev/null
+++ b/tools/node_modules/source-map/build/mini-require.js
@@ -0,0 +1,152 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+/**
+ * Define a module along with a payload.
+ * @param {string} moduleName Name for the payload
+ * @param {ignored} deps Ignored. For compatibility with CommonJS AMD Spec
+ * @param {function} payload Function with (require, exports, module) params
+ */
+function define(moduleName, deps, payload) {
+ if (typeof moduleName != "string") {
+ throw new TypeError('Expected string, got: ' + moduleName);
+ }
+
+ if (arguments.length == 2) {
+ payload = deps;
+ }
+
+ if (moduleName in define.modules) {
+ throw new Error("Module already defined: " + moduleName);
+ }
+ define.modules[moduleName] = payload;
+};
+
+/**
+ * The global store of un-instantiated modules
+ */
+define.modules = {};
+
+
+/**
+ * We invoke require() in the context of a Domain so we can have multiple
+ * sets of modules running separate from each other.
+ * This contrasts with JSMs which are singletons, Domains allows us to
+ * optionally load a CommonJS module twice with separate data each time.
+ * Perhaps you want 2 command lines with a different set of commands in each,
+ * for example.
+ */
+function Domain() {
+ this.modules = {};
+ this._currentModule = null;
+}
+