Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions Makefile.dryice.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,27 @@ 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*require\);\s*}\s*/g,
'');
src = src.replace(
/\b(define\(.*)('amdefine',?)/gm,
'$1');
return src;
}
removeAmdefine.onRead = true;

function makeNonRelative(src) {
return src
return String(src)
.replace(/require\('.\//g, 'require(\'source-map/')
.replace(/\.\.\/\.\.\/lib\//g, '');
}
makeNonRelative.onRead = true;

function wrapDefine(src, location) {
src = String(src);
if (/^build\//.test(location.path)) {
return src;
} else {
return (
'\ndefine(function (require, exports, module) {\n' +
src.replace(/^(?=[^\n])/gm, ' ') +
'\n});\n\n'
);
}
}
wrapDefine.onRead = true;

function buildBrowser() {
console.log('\nCreating dist/source-map.js');

Expand All @@ -45,8 +48,8 @@ function buildBrowser() {
'build/suffix-browser.js'
],
filter: [
copy.filter.moduleDefines,
removeAmdefine
wrapDefine,
copy.filter.moduleDefines
],
dest: 'dist/source-map.js'
});
Expand Down Expand Up @@ -81,8 +84,8 @@ function buildFirefox() {
'build/suffix-source-map.jsm'
],
filter: [
wrapDefine,
copy.filter.moduleDefines,
removeAmdefine,
makeNonRelative
],
dest: 'dist/SourceMap.jsm'
Expand All @@ -106,8 +109,8 @@ function buildFirefox() {
'build/suffix-utils.jsm'
],
filter: [
wrapDefine,
copy.filter.moduleDefines,
removeAmdefine,
makeNonRelative
],
dest: 'dist/test/Utils.jsm'
Expand All @@ -129,7 +132,7 @@ function buildFirefox() {
'build/test-suffix.js'
],
filter: [
removeAmdefine,
wrapDefine,
makeNonRelative,
function (input, source) {
return input.replace('define(',
Expand Down
7 changes: 0 additions & 7 deletions lib/source-map/array-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var util = require('./util');

/**
Expand Down Expand Up @@ -105,5 +100,3 @@ define(function (require, exports, module) {
};

exports.ArraySet = ArraySet;

});
7 changes: 0 additions & 7 deletions lib/source-map/base64-vlq.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var base64 = require('./base64');

// A single base 64 digit can contain 6 bits of data. For the base 64 variable
Expand Down Expand Up @@ -142,5 +137,3 @@ define(function (require, exports, module) {
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
};

});
7 changes: 0 additions & 7 deletions lib/source-map/base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');

/**
Expand Down Expand Up @@ -69,5 +64,3 @@ define(function (require, exports, module) {
// Invalid base64 digit.
return -1;
};

});
7 changes: 0 additions & 7 deletions lib/source-map/binary-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

exports.GREATEST_LOWER_BOUND = 1;
exports.LEAST_UPPER_BOUND = 2;

Expand Down Expand Up @@ -113,5 +108,3 @@ define(function (require, exports, module) {

return index;
};

});
7 changes: 0 additions & 7 deletions lib/source-map/mapping-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var util = require('./util');

/**
Expand Down Expand Up @@ -81,5 +76,3 @@ define(function (require, exports, module) {
};

exports.MappingList = MappingList;

});
7 changes: 0 additions & 7 deletions lib/source-map/quick-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

// It turns out that some (most?) JavaScript engines don't self-host
// `Array.prototype.sort`. This makes sense because C++ will likely remain
// faster than JS when doing raw CPU-intensive sorting. However, when using a
Expand Down Expand Up @@ -116,5 +111,3 @@ define(function (require, exports, module) {
exports.quickSort = function (ary, comparator) {
doQuickSort(ary, comparator, 0, ary.length - 1);
};

});
7 changes: 0 additions & 7 deletions lib/source-map/source-map-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var util = require('./util');
var binarySearch = require('./binary-search');
var ArraySet = require('./array-set').ArraySet;
Expand Down Expand Up @@ -1083,5 +1078,3 @@ define(function (require, exports, module) {
};

exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;

});
7 changes: 0 additions & 7 deletions lib/source-map/source-map-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var base64VLQ = require('./base64-vlq');
var util = require('./util');
var ArraySet = require('./array-set').ArraySet;
Expand Down Expand Up @@ -397,5 +392,3 @@ define(function (require, exports, module) {
};

exports.SourceMapGenerator = SourceMapGenerator;

});
7 changes: 0 additions & 7 deletions lib/source-map/source-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
var util = require('./util');

Expand Down Expand Up @@ -410,5 +405,3 @@ define(function (require, exports, module) {
};

exports.SourceNode = SourceNode;

});
7 changes: 0 additions & 7 deletions lib/source-map/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

/**
* This is a helper function for getting values from parameter/options
* objects.
Expand Down Expand Up @@ -370,5 +365,3 @@ define(function (require, exports, module) {
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;

});
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
"node": ">=0.8.0"
},
"license": "BSD-3-Clause",
"dependencies": {
"amdefine": ">=0.0.4"
},
"devDependencies": {
"dryice": ">=0.4.8"
},
Expand Down
7 changes: 0 additions & 7 deletions test/source-map/test-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var sourceMap;
try {
sourceMap = require('../../lib/source-map');
Expand All @@ -22,5 +17,3 @@ define(function (require, exports, module) {
assert.equal(typeof sourceMap.SourceMapConsumer, "function");
assert.equal(typeof sourceMap.SourceNode, "function");
};

});
7 changes: 0 additions & 7 deletions test/source-map/test-array-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var ArraySet = require('../../lib/source-map/array-set').ArraySet;

function makeTestSet() {
Expand Down Expand Up @@ -138,5 +133,3 @@ define(function (require, exports, module) {

assert.strictEqual(set.size(), 3);
};

});
7 changes: 0 additions & 7 deletions test/source-map/test-base64-vlq.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var base64VLQ = require('../../lib/source-map/base64-vlq');

exports['test normal encoding and decoding'] = function (assert, util) {
Expand All @@ -20,5 +15,3 @@ define(function (require, exports, module) {
assert.equal(result.rest, str.length);
}
};

});
7 changes: 0 additions & 7 deletions test/source-map/test-base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var base64 = require('../../lib/source-map/base64');

exports['test out of range encoding'] = function (assert, util) {
Expand All @@ -29,5 +24,3 @@ define(function (require, exports, module) {
assert.equal(base64.decode(base64.encode(i).charCodeAt(0)), i);
}
};

});
7 changes: 0 additions & 7 deletions test/source-map/test-binary-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var binarySearch = require('../../lib/source-map/binary-search');

function numberCompare(a, b) {
Expand Down Expand Up @@ -98,5 +93,3 @@ define(function (require, exports, module) {
assert.equal(binarySearch.search(needle, haystack, numberCompare,
binarySearch.LEAST_UPPER_BOUND), 0);
};

});
7 changes: 0 additions & 7 deletions test/source-map/test-dog-fooding.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;

Expand Down Expand Up @@ -101,5 +96,3 @@ define(function (require, exports, module) {
util.assertMapping(6, 12, '/wu/tang/gza.coffee', 5, 9, null, SourceMapConsumer.LEAST_UPPER_BOUND, smc, assert, null, true);
util.assertMapping(null, null, '/wu/tang/gza.coffee', 6, 19, null, SourceMapConsumer.LEAST_UPPER_BOUND, smc, assert, null, true);
};

});
7 changes: 0 additions & 7 deletions test/source-map/test-quick-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
if (typeof define !== 'function') {
var define = require('amdefine')(module, require);
}
define(function (require, exports, module) {

var quickSort = require('../../lib/source-map/quick-sort').quickSort;

function numberCompare(a, b) {
Expand Down Expand Up @@ -47,5 +42,3 @@ define(function (require, exports, module) {
assert.equal(JSON.stringify(ary.sort(numberCompare)),
JSON.stringify(quickSorted));
};

});
Loading