Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sourceMapCallback option to enable advanced mapping use cases #69

Merged
merged 2 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions dist/ioptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export interface IOptions {
typescript: typeof tsModule;
tsconfigOverride: any;
tsconfigDefaults: any;
sourceMapCallback: (id: string, map: string) => void;
}
176 changes: 96 additions & 80 deletions dist/rollup-plugin-typescript2.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var lodash = createCommonjsModule(function (module, exports) {
var undefined;

/** Used as the semantic version number. */
var VERSION = '4.17.4';
var VERSION = '4.17.5';

/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
Expand Down Expand Up @@ -180,7 +180,6 @@ var lodash = createCommonjsModule(function (module, exports) {
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;

/**
Expand Down Expand Up @@ -280,8 +279,8 @@ var lodash = createCommonjsModule(function (module, exports) {
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
Expand Down Expand Up @@ -488,34 +487,6 @@ var lodash = createCommonjsModule(function (module, exports) {

/*--------------------------------------------------------------------------*/

/**
* Adds the key-value `pair` to `map`.
*
* @private
* @param {Object} map The map to modify.
* @param {Array} pair The key-value pair to add.
* @returns {Object} Returns `map`.
*/
function addMapEntry(map, pair) {
// Don't return `map.set` because it's not chainable in IE 11.
map.set(pair[0], pair[1]);
return map;
}

/**
* Adds `value` to `set`.
*
* @private
* @param {Object} set The set to modify.
* @param {*} value The value to add.
* @returns {Object} Returns `set`.
*/
function addSetEntry(set, value) {
// Don't return `set.add` because it's not chainable in IE 11.
set.add(value);
return set;
}

/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
Expand Down Expand Up @@ -1282,6 +1253,20 @@ var lodash = createCommonjsModule(function (module, exports) {
return result;
}

/**
* Gets the value at `key`, unless `key` is "__proto__".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
return key == '__proto__'
? undefined
: object[key];
}

/**
* Converts `set` to an array of its values.
*
Expand Down Expand Up @@ -2714,7 +2699,7 @@ var lodash = createCommonjsModule(function (module, exports) {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, baseClone, isDeep);
result = initCloneByTag(value, tag, isDeep);
}
}
// Check for circular references and return its corresponding clone.
Expand All @@ -2725,6 +2710,22 @@ var lodash = createCommonjsModule(function (module, exports) {
}
stack.set(value, result);

if (isSet(value)) {
value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});

return result;
}

if (isMap(value)) {
value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});

return result;
}

var keysFunc = isFull
? (isFlat ? getAllKeysIn : getAllKeys)
: (isFlat ? keysIn : keys);
Expand Down Expand Up @@ -3652,7 +3653,7 @@ var lodash = createCommonjsModule(function (module, exports) {
}
else {
var newValue = customizer
? customizer(object[key], srcValue, (key + ''), object, source, stack)
? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;

if (newValue === undefined) {
Expand All @@ -3679,8 +3680,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
srcValue = source[key],
var objValue = safeGet(object, key),
srcValue = safeGet(source, key),
stacked = stack.get(srcValue);

if (stacked) {
Expand Down Expand Up @@ -4588,20 +4589,6 @@ var lodash = createCommonjsModule(function (module, exports) {
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}

/**
* Creates a clone of `map`.
*
* @private
* @param {Object} map The map to clone.
* @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned map.
*/
function cloneMap(map, isDeep, cloneFunc) {
var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
return arrayReduce(array, addMapEntry, new map.constructor);
}

/**
* Creates a clone of `regexp`.
*
Expand All @@ -4615,20 +4602,6 @@ var lodash = createCommonjsModule(function (module, exports) {
return result;
}

/**
* Creates a clone of `set`.
*
* @private
* @param {Object} set The set to clone.
* @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned set.
*/
function cloneSet(set, isDeep, cloneFunc) {
var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
return arrayReduce(array, addSetEntry, new set.constructor);
}

/**
* Creates a clone of the `symbol` object.
*
Expand Down Expand Up @@ -6223,7 +6196,7 @@ var lodash = createCommonjsModule(function (module, exports) {
*/
function initCloneArray(array) {
var length = array.length,
result = array.constructor(length);
result = new array.constructor(length);

// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
Expand All @@ -6250,16 +6223,15 @@ var lodash = createCommonjsModule(function (module, exports) {
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, cloneFunc, isDeep) {
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
Expand All @@ -6278,7 +6250,7 @@ var lodash = createCommonjsModule(function (module, exports) {
return cloneTypedArray(object, isDeep);

case mapTag:
return cloneMap(object, isDeep, cloneFunc);
return new Ctor;

case numberTag:
case stringTag:
Expand All @@ -6288,7 +6260,7 @@ var lodash = createCommonjsModule(function (module, exports) {
return cloneRegExp(object);

case setTag:
return cloneSet(object, isDeep, cloneFunc);
return new Ctor;

case symbolTag:
return cloneSymbol(object);
Expand Down Expand Up @@ -6335,10 +6307,13 @@ var lodash = createCommonjsModule(function (module, exports) {
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;

return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}

/**
Expand Down Expand Up @@ -6788,11 +6763,11 @@ var lodash = createCommonjsModule(function (module, exports) {
*/
var stringToPath = memoizeCapped(function(string) {
var result = [];
if (reLeadingDot.test(string)) {
if (string.charCodeAt(0) === 46 /* . */) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
string.replace(rePropName, function(match, number, quote, subString) {
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
Expand Down Expand Up @@ -10400,9 +10375,11 @@ var lodash = createCommonjsModule(function (module, exports) {
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
timeWaiting = wait - timeSinceLastCall;

return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
return maxing
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
: timeWaiting;
}

function shouldInvoke(time) {
Expand Down Expand Up @@ -12834,9 +12811,35 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = baseRest(function(args) {
args.push(undefined, customDefaultsAssignIn);
return apply(assignInWith, undefined, args);
var defaults = baseRest(function(object, sources) {
object = Object(object);

var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined;

if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}

while (++index < length) {
var source = sources[index];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;

while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];

if (value === undefined ||
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
object[key] = source[key];
}
}
}

return object;
});

/**
Expand Down Expand Up @@ -13233,6 +13236,11 @@ var lodash = createCommonjsModule(function (module, exports) {
* // => { '1': 'c', '2': 'b' }
*/
var invert = createInverter(function(result, value, key) {
if (value != null &&
typeof value.toString != 'function') {
value = nativeObjectToString.call(value);
}

result[value] = key;
}, constant(identity));

Expand Down Expand Up @@ -13263,6 +13271,11 @@ var lodash = createCommonjsModule(function (module, exports) {
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
*/
var invertBy = createInverter(function(result, value, key) {
if (value != null &&
typeof value.toString != 'function') {
value = nativeObjectToString.call(value);
}

if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
Expand Down Expand Up @@ -19960,6 +19973,9 @@ function typescript(options) {
var transpiled = lodash_11(output.outputFiles, function (entry) { return lodash_6(entry.name, ".js") || lodash_6(entry.name, ".jsx"); });
var map = lodash_11(output.outputFiles, function (entry) { return lodash_6(entry.name, ".map"); });
var dts = lodash_11(output.outputFiles, function (entry) { return lodash_6(entry.name, ".d.ts"); });
if (pluginOptions.sourceMapCallback && map) {
pluginOptions.sourceMapCallback(id, map.text);
}
return {
code: transpiled ? transpiled.text : undefined,
map: map ? JSON.parse(map.text) : { mappings: "" },
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

Loading