return function (data) {
if (context.options.sourceMap) {
- context.inputSourceMapTracker = new InputSourceMapTracker(context.options, context);
+ context.inputSourceMapTracker = new InputSourceMapTracker(context);
return context.inputSourceMapTracker.track(data, function () { return whenSourceMapReady(data); });
} else {
return whenSourceMapReady(data);
var https = require('https');
var url = require('url');
-var MAP_MARKER = /\/\*# sourceMappingURL=(\S+) \*\//;
-
-var DEFAULT_TIMEOUT = 5000;
+var override = require('../utils/object.js').override;
+var MAP_MARKER = /\/\*# sourceMappingURL=(\S+) \*\//;
-function InputSourceMapStore(options, outerContext) {
- this.options = options;
+function InputSourceMapStore(outerContext) {
+ this.options = outerContext.options;
this.errors = outerContext.errors;
this.sourceTracker = outerContext.sourceTracker;
- this.timeout = (options.inliner && options.inliner.timeout) || DEFAULT_TIMEOUT;
- this.requestOptions = (options.inliner && options.inliner.request) || {};
+ this.timeout = this.options.inliner.timeout;
+ this.requestOptions = this.options.inliner.request;
this.maps = {};
}
-function merge(source1, source2) {
- var target = {};
- for (var key1 in source1)
- target[key1] = source1[key1];
- for (var key2 in source2)
- target[key2] = source2[key2];
-
- return target;
-}
-
function fromString(self, data, whenDone) {
self.maps[undefined] = new SourceMapConsumer(self.options.sourceMap);
return whenDone();
}
var method = mapSource.indexOf('https') === 0 ? https : http;
- var requestOptions = merge(url.parse(mapSource), self.requestOptions);
+ var requestOptions = override(url.parse(mapSource), self.requestOptions);
method
.get(requestOptions, function (res) {