- relaxing module overrides to allow for ESNext #54

This commit is contained in:
ezolenko 2018-03-06 18:34:12 -07:00
parent e583deee0f
commit 7332077918
16 changed files with 280 additions and 187 deletions

View File

@ -29,9 +29,8 @@ export default {
The plugin inherits all compiler options and file lists from your `tsconfig.json` file. If your tsconfig has another name or another relative path from the root directory, see `tsconfigDefaults`, `tsconfig` and `tsconfigOverride` options below. This also allows for passing in different tsconfig files depending on your build target.
The following compiler options are forced though:
#### Some compiler options are forced
* `module`: `es2015`
* `noEmitHelpers`: false
* `importHelpers`: true
* `noResolve`: false
@ -40,6 +39,10 @@ The following compiler options are forced though:
* `declarationDir`: `process.cwd()` (*only if `useTsconfigDeclarationDir` is false in the plugin options*)
* `moduleResolution`: `node` (*`classic` is [depreciated](https://www.typescriptlang.org/docs/handbook/module-resolution.html). It also breaks this plugin, see [#12](https://github.com/ezolenko/rollup-plugin-typescript2/issues/12) and [#14](https://github.com/ezolenko/rollup-plugin-typescript2/issues/14)*)
#### Some compiler options have more than one compatible value.
* `module`: defaults to `ES2015`, other valid value is `ESNext` (required for dynamic imports, see [#54](https://github.com/ezolenko/rollup-plugin-typescript2/issues/54)).
### Plugin options
* `tsconfigDefaults`: `{}`

2
dist/check-tsconfig.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import * as tsTypes from "typescript";
export declare function checkTsConfig(parsedConfig: tsTypes.ParsedCommandLine): void;

5
dist/get-option-defaults.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare function getOptionsDefaults(): {
compilerOptions: {
module: string;
};
};

View File

@ -1,4 +1,4 @@
import * as tsTypes from "typescript";
import { IContext } from "./context";
import { IOptions } from "./ioptions";
export declare function parseTsConfig(context: IContext, pluginOptions: IOptions): tsTypes.ParsedCommandLine;
import * as tsTypes from "typescript";
import { IContext } from "./context";
import { IOptions } from "./ioptions";
export declare function parseTsConfig(context: IContext, pluginOptions: IOptions): tsTypes.ParsedCommandLine;

View File

@ -23,9 +23,6 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
@ -41,21 +38,11 @@ function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lodash = createCommonjsModule(function (module, exports) {
/**
* @license
* Lodash <https://lodash.com/>
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function() {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
@ -17133,7 +17120,6 @@ var lodash = createCommonjsModule(function (module, exports) {
}
}.call(commonjsGlobal));
});
var lodash_1 = lodash.get;
var lodash_2 = lodash.each;
var lodash_3 = lodash.isEqual;
@ -17314,25 +17300,25 @@ var LanguageServiceHost = /** @class */ (function () {
/* global window */
var lodash$2;
var lodash$1;
if (typeof commonjsRequire === "function") {
try {
lodash$2 = lodash;
lodash$1 = lodash;
} catch (e) {}
}
if (!lodash$2) {
lodash$2 = window._;
if (!lodash$1) {
lodash$1 = window._;
}
var lodash_1$1 = lodash$2;
var lodash_1$1 = lodash$1;
var graph = Graph;
var DEFAULT_EDGE_NAME = "\x00";
var GRAPH_NODE = "\x00";
var EDGE_KEY_DELIM = "\x01";
var DEFAULT_EDGE_NAME = "\x00",
GRAPH_NODE = "\x00",
EDGE_KEY_DELIM = "\x01";
// Implementation notes:
//
@ -18470,11 +18456,36 @@ var graphlib = {
alg: alg,
version: lib.version
};
var graphlib_1 = graphlib.Graph;
var graphlib_3 = graphlib.alg;
var objectHash_1 = createCommonjsModule(function (module, exports) {
/**
* Exported function
*
* Options:
*
* - `algorithm` hash algo to be used by this instance: *'sha1', 'md5'
* - `excludeValues` {true|*false} hash object keys, values ignored
* - `encoding` hash encoding, supports 'buffer', '*hex', 'binary', 'base64'
* - `ignoreUnknown` {true|*false} ignore unknown object types
* - `replacer` optional function that replaces values before hashing
* - `respectFunctionProperties` {*true|false} consider function properties when hashing
* - `respectFunctionNames` {*true|false} consider 'name' property of functions for hashing
* - `respectType` {*true|false} Respect special properties (prototype, constructor)
* when hashing to distinguish between types
* - `unorderedArrays` {true|*false} Sort all arrays before hashing
* - `unorderedSets` {*true|false} Sort `Set` and `Map` instances before hashing
* * = default
*
* @param {object} object value to hash
* @param {object} options hashing options
* @return {string} hash value
* @api public
*/
exports = module.exports = objectHash;
function objectHash(object, options){
@ -18886,7 +18897,6 @@ function PassThrough() {
};
}
});
var objectHash_2 = objectHash_1.sha1;
var objectHash_3 = objectHash_1.keys;
var objectHash_4 = objectHash_1.MD5;
@ -19504,7 +19514,6 @@ var safe = createCommonjsModule(function (module) {
module['exports'] = colors_1;
});
var safe_1 = safe.green;
var safe_2 = safe.white;
var safe_3 = safe.red;
@ -19731,7 +19740,6 @@ function printDiagnostics(context, diagnostics, pretty) {
function getOptionsOverrides(_a, tsConfigJson) {
var useTsconfigDeclarationDir = _a.useTsconfigDeclarationDir;
var overrides = {
module: tsModule.ModuleKind.ES2015,
noEmitHelpers: false,
importHelpers: true,
noResolve: false,
@ -19747,6 +19755,27 @@ function getOptionsOverrides(_a, tsConfigJson) {
return overrides;
}
function checkTsConfig(parsedConfig) {
var module = parsedConfig.options.module;
switch (module) {
case tsModule.ModuleKind.ES2015:
case tsModule.ModuleKind.ESNext:
break;
case undefined:
throw new Error("Incompatible tsconfig option. Missing module option. This is incompatible with rollup, please use 'module: \"ES2015\"' or 'module: \"ESNext\"'.");
default:
throw new Error("Incompatible tsconfig option. Module resolves to '" + tsModule.ModuleKind[module] + "'. This is incompatible with rollup, please use 'module: \"ES2015\"' or 'module: \"ESNext\"'.");
}
}
function getOptionsDefaults() {
return {
compilerOptions: {
module: "ES2015",
},
};
}
function parseTsConfig(context, pluginOptions) {
var fileName = tsModule.findConfigFile(process.cwd(), tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
@ -19769,9 +19798,10 @@ function parseTsConfig(context, pluginOptions) {
configFileName = fileName;
}
var mergedConfig = {};
lodash_14(mergedConfig, pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
lodash_14(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
var compilerOptionsOverride = getOptionsOverrides(pluginOptions, mergedConfig);
var parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
checkTsConfig(parsedTsConfig);
context.debug("built-in options overrides: " + JSON.stringify(compilerOptionsOverride, undefined, 4));
context.debug("parsed tsconfig: " + JSON.stringify(parsedTsConfig, undefined, 4));
return parsedTsConfig;
@ -19833,7 +19863,7 @@ function typescript(options) {
rollupOptions = __assign({}, config);
context = new ConsoleContext(pluginOptions.verbosity, "rpt2: ");
context.info("typescript version: " + tsModule.version);
context.info("rollup-plugin-typescript2 version: 0.11.1");
context.info("rollup-plugin-typescript2 version: 0.12.0");
context.debug(function () { return "plugin options:\n" + JSON.stringify(pluginOptions, function (key, value) { return key === "typescript" ? "version " + value.version : value; }, 4); });
context.debug(function () { return "rollup config:\n" + JSON.stringify(rollupOptions, undefined, 4); });
watchMode = process.env.ROLLUP_WATCH === "true";

File diff suppressed because one or more lines are too long

View File

@ -19,9 +19,6 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
@ -37,21 +34,11 @@ function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lodash = createCommonjsModule(function (module, exports) {
/**
* @license
* Lodash <https://lodash.com/>
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function() {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
@ -3082,14 +3069,14 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path$$1) {
path$$1 = castPath(path$$1, object);
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path$$1.length;
length = path.length;
while (object != null && index < length) {
object = object[toKey(path$$1[index++])];
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
@ -3267,10 +3254,10 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Array} args The arguments to invoke the method with.
* @returns {*} Returns the result of the invoked method.
*/
function baseInvoke(object, path$$1, args) {
path$$1 = castPath(path$$1, object);
object = parent(object, path$$1);
var func = object == null ? object : object[toKey(last(path$$1))];
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined : apply(func, object, args);
}
@ -3627,14 +3614,14 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path$$1, srcValue) {
if (isKey(path$$1) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path$$1), srcValue);
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path$$1);
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn(object, path$$1)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
@ -3801,8 +3788,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* @returns {Object} Returns the new object.
*/
function basePick(object, paths) {
return basePickBy(object, paths, function(value, path$$1) {
return hasIn(object, path$$1);
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}
@ -3821,11 +3808,11 @@ var lodash = createCommonjsModule(function (module, exports) {
result = {};
while (++index < length) {
var path$$1 = paths[index],
value = baseGet(object, path$$1);
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, path$$1)) {
baseSet(result, castPath(path$$1, object), value);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}
}
return result;
@ -3838,9 +3825,9 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path$$1) {
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path$$1);
return baseGet(object, path);
};
}
@ -4019,19 +4006,19 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseSet(object, path$$1, value, customizer) {
function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path$$1 = castPath(path$$1, object);
path = castPath(path, object);
var index = -1,
length = path$$1.length,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = toKey(path$$1[index]),
var key = toKey(path[index]),
newValue = value;
if (index != lastIndex) {
@ -4040,7 +4027,7 @@ var lodash = createCommonjsModule(function (module, exports) {
if (newValue === undefined) {
newValue = isObject(objValue)
? objValue
: (isIndex(path$$1[index + 1]) ? [] : {});
: (isIndex(path[index + 1]) ? [] : {});
}
}
assignValue(nested, key, newValue);
@ -4363,10 +4350,10 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path$$1) {
path$$1 = castPath(path$$1, object);
object = parent(object, path$$1);
return object == null || delete object[toKey(last(path$$1))];
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/**
@ -4379,8 +4366,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Function} [customizer] The function to customize path creation.
* @returns {Object} Returns `object`.
*/
function baseUpdate(object, path$$1, updater, customizer) {
return baseSet(object, path$$1, updater(baseGet(object, path$$1)), customizer);
function baseUpdate(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
}
/**
@ -6201,15 +6188,15 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Function} hasFunc The function to check properties.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path$$1, hasFunc) {
path$$1 = castPath(path$$1, object);
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1,
length = path$$1.length,
length = path.length,
result = false;
while (++index < length) {
var key = toKey(path$$1[index]);
var key = toKey(path[index]);
if (!(result = object != null && hasFunc(object, key))) {
break;
}
@ -6655,8 +6642,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* @param {Array} path The path to get the parent value of.
* @returns {*} Returns the parent value.
*/
function parent(object, path$$1) {
return path$$1.length < 2 ? object : baseGet(object, baseSlice(path$$1, 0, -1));
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
/**
@ -9527,13 +9514,13 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.invokeMap([123, 456], String.prototype.split, '');
* // => [['1', '2', '3'], ['4', '5', '6']]
*/
var invokeMap = baseRest(function(collection, path$$1, args) {
var invokeMap = baseRest(function(collection, path, args) {
var index = -1,
isFunc = typeof path$$1 == 'function',
isFunc = typeof path == 'function',
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value) {
result[++index] = isFunc ? apply(path$$1, value, args) : baseInvoke(value, path$$1, args);
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
});
return result;
});
@ -13157,8 +13144,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path$$1, defaultValue) {
var result = object == null ? undefined : baseGet(object, path$$1);
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
@ -13189,8 +13176,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.has(other, 'a');
* // => false
*/
function has(object, path$$1) {
return object != null && hasPath(object, path$$1, baseHas);
function has(object, path) {
return object != null && hasPath(object, path, baseHas);
}
/**
@ -13219,8 +13206,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path$$1) {
return object != null && hasPath(object, path$$1, baseHasIn);
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
/**
@ -13523,10 +13510,10 @@ var lodash = createCommonjsModule(function (module, exports) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path$$1) {
path$$1 = castPath(path$$1, object);
isDeep || (isDeep = path$$1.length > 1);
return path$$1;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
@ -13610,8 +13597,8 @@ var lodash = createCommonjsModule(function (module, exports) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value, path$$1) {
return predicate(value, path$$1[0]);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
@ -13644,11 +13631,11 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.result(object, 'a[0].b.c3', _.constant('default'));
* // => 'default'
*/
function result(object, path$$1, defaultValue) {
path$$1 = castPath(path$$1, object);
function result(object, path, defaultValue) {
path = castPath(path, object);
var index = -1,
length = path$$1.length;
length = path.length;
// Ensure the loop is entered when path is empty.
if (!length) {
@ -13656,7 +13643,7 @@ var lodash = createCommonjsModule(function (module, exports) {
object = undefined;
}
while (++index < length) {
var value = object == null ? undefined : object[toKey(path$$1[index])];
var value = object == null ? undefined : object[toKey(path[index])];
if (value === undefined) {
index = length;
value = defaultValue;
@ -13694,8 +13681,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* console.log(object.x[0].y.z);
* // => 5
*/
function set(object, path$$1, value) {
return object == null ? object : baseSet(object, path$$1, value);
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}
/**
@ -13722,9 +13709,9 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.setWith(object, '[0][1]', 'a', Object);
* // => { '0': { '1': 'a' } }
*/
function setWith(object, path$$1, value, customizer) {
function setWith(object, path, value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return object == null ? object : baseSet(object, path$$1, value, customizer);
return object == null ? object : baseSet(object, path, value, customizer);
}
/**
@ -13859,8 +13846,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* console.log(object);
* // => { 'a': [{ 'b': {} }] };
*/
function unset(object, path$$1) {
return object == null ? true : baseUnset(object, path$$1);
function unset(object, path) {
return object == null ? true : baseUnset(object, path);
}
/**
@ -13890,8 +13877,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* console.log(object.x[0].y.z);
* // => 0
*/
function update(object, path$$1, updater) {
return object == null ? object : baseUpdate(object, path$$1, castFunction(updater));
function update(object, path, updater) {
return object == null ? object : baseUpdate(object, path, castFunction(updater));
}
/**
@ -13918,9 +13905,9 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.updateWith(object, '[0][1]', _.constant('a'), Object);
* // => { '0': { '1': 'a' } }
*/
function updateWith(object, path$$1, updater, customizer) {
function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return object == null ? object : baseUpdate(object, path$$1, castFunction(updater), customizer);
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
}
/**
@ -15609,8 +15596,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.find(objects, _.matchesProperty('a', 4));
* // => { 'a': 4, 'b': 5, 'c': 6 }
*/
function matchesProperty(path$$1, srcValue) {
return baseMatchesProperty(path$$1, baseClone(srcValue, CLONE_DEEP_FLAG));
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
}
/**
@ -15637,9 +15624,9 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.map(objects, _.method(['a', 'b']));
* // => [2, 1]
*/
var method = baseRest(function(path$$1, args) {
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path$$1, args);
return baseInvoke(object, path, args);
};
});
@ -15667,8 +15654,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* // => [2, 0]
*/
var methodOf = baseRest(function(object, args) {
return function(path$$1) {
return baseInvoke(object, path$$1, args);
return function(path) {
return baseInvoke(object, path, args);
};
});
@ -15901,8 +15888,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2]
*/
function property(path$$1) {
return isKey(path$$1) ? baseProperty(toKey(path$$1)) : basePropertyDeep(path$$1);
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
/**
@ -15927,8 +15914,8 @@ var lodash = createCommonjsModule(function (module, exports) {
* // => [2, 0]
*/
function propertyOf(object) {
return function(path$$1) {
return object == null ? undefined : baseGet(object, path$$1);
return function(path) {
return object == null ? undefined : baseGet(object, path);
};
}
@ -16955,12 +16942,12 @@ var lodash = createCommonjsModule(function (module, exports) {
return this.reverse().find(predicate);
};
LazyWrapper.prototype.invokeMap = baseRest(function(path$$1, args) {
if (typeof path$$1 == 'function') {
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == 'function') {
return new LazyWrapper(this);
}
return this.map(function(value) {
return baseInvoke(value, path$$1, args);
return baseInvoke(value, path, args);
});
});
@ -17129,7 +17116,6 @@ var lodash = createCommonjsModule(function (module, exports) {
}
}.call(commonjsGlobal));
});
var lodash_1 = lodash.get;
var lodash_2 = lodash.each;
var lodash_3 = lodash.isEqual;
@ -17287,14 +17273,14 @@ var LanguageServiceHost = /** @class */ (function () {
LanguageServiceHost.prototype.useCaseSensitiveFileNames = function () {
return tsModule.sys.useCaseSensitiveFileNames;
};
LanguageServiceHost.prototype.readDirectory = function (path$$1, extensions, exclude, include) {
return tsModule.sys.readDirectory(path$$1, extensions, exclude, include);
LanguageServiceHost.prototype.readDirectory = function (path, extensions, exclude, include) {
return tsModule.sys.readDirectory(path, extensions, exclude, include);
};
LanguageServiceHost.prototype.readFile = function (path$$1, encoding) {
return tsModule.sys.readFile(path$$1, encoding);
LanguageServiceHost.prototype.readFile = function (path, encoding) {
return tsModule.sys.readFile(path, encoding);
};
LanguageServiceHost.prototype.fileExists = function (path$$1) {
return tsModule.sys.fileExists(path$$1);
LanguageServiceHost.prototype.fileExists = function (path) {
return tsModule.sys.fileExists(path);
};
LanguageServiceHost.prototype.getTypeRootsVersion = function () {
return 0;
@ -17310,25 +17296,25 @@ var LanguageServiceHost = /** @class */ (function () {
/* global window */
var lodash$2;
var lodash$1;
if (typeof commonjsRequire === "function") {
try {
lodash$2 = lodash;
lodash$1 = lodash;
} catch (e) {}
}
if (!lodash$2) {
lodash$2 = window._;
if (!lodash$1) {
lodash$1 = window._;
}
var lodash_1$1 = lodash$2;
var lodash_1$1 = lodash$1;
var graph = Graph;
var DEFAULT_EDGE_NAME = "\x00";
var GRAPH_NODE = "\x00";
var EDGE_KEY_DELIM = "\x01";
var DEFAULT_EDGE_NAME = "\x00",
GRAPH_NODE = "\x00",
EDGE_KEY_DELIM = "\x01";
// Implementation notes:
//
@ -18466,11 +18452,36 @@ var graphlib = {
alg: alg,
version: lib.version
};
var graphlib_1 = graphlib.Graph;
var graphlib_3 = graphlib.alg;
var objectHash_1 = createCommonjsModule(function (module, exports) {
/**
* Exported function
*
* Options:
*
* - `algorithm` hash algo to be used by this instance: *'sha1', 'md5'
* - `excludeValues` {true|*false} hash object keys, values ignored
* - `encoding` hash encoding, supports 'buffer', '*hex', 'binary', 'base64'
* - `ignoreUnknown` {true|*false} ignore unknown object types
* - `replacer` optional function that replaces values before hashing
* - `respectFunctionProperties` {*true|false} consider function properties when hashing
* - `respectFunctionNames` {*true|false} consider 'name' property of functions for hashing
* - `respectType` {*true|false} Respect special properties (prototype, constructor)
* when hashing to distinguish between types
* - `unorderedArrays` {true|*false} Sort all arrays before hashing
* - `unorderedSets` {*true|false} Sort `Set` and `Map` instances before hashing
* * = default
*
* @param {object} object value to hash
* @param {object} options hashing options
* @return {string} hash value
* @api public
*/
exports = module.exports = objectHash;
function objectHash(object, options){
@ -18882,7 +18893,6 @@ function PassThrough() {
};
}
});
var objectHash_2 = objectHash_1.sha1;
var objectHash_3 = objectHash_1.keys;
var objectHash_4 = objectHash_1.MD5;
@ -19500,7 +19510,6 @@ var safe = createCommonjsModule(function (module) {
module['exports'] = colors_1;
});
var safe_1 = safe.green;
var safe_2 = safe.white;
var safe_3 = safe.red;
@ -19727,7 +19736,6 @@ function printDiagnostics(context, diagnostics, pretty) {
function getOptionsOverrides(_a, tsConfigJson) {
var useTsconfigDeclarationDir = _a.useTsconfigDeclarationDir;
var overrides = {
module: tsModule.ModuleKind.ES2015,
noEmitHelpers: false,
importHelpers: true,
noResolve: false,
@ -19743,6 +19751,27 @@ function getOptionsOverrides(_a, tsConfigJson) {
return overrides;
}
function checkTsConfig(parsedConfig) {
var module = parsedConfig.options.module;
switch (module) {
case tsModule.ModuleKind.ES2015:
case tsModule.ModuleKind.ESNext:
break;
case undefined:
throw new Error("Incompatible tsconfig option. Missing module option. This is incompatible with rollup, please use 'module: \"ES2015\"' or 'module: \"ESNext\"'.");
default:
throw new Error("Incompatible tsconfig option. Module resolves to '" + tsModule.ModuleKind[module] + "'. This is incompatible with rollup, please use 'module: \"ES2015\"' or 'module: \"ESNext\"'.");
}
}
function getOptionsDefaults() {
return {
compilerOptions: {
module: "ES2015",
},
};
}
function parseTsConfig(context, pluginOptions) {
var fileName = tsModule.findConfigFile(process.cwd(), tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
@ -19765,9 +19794,10 @@ function parseTsConfig(context, pluginOptions) {
configFileName = fileName;
}
var mergedConfig = {};
lodash_14(mergedConfig, pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
lodash_14(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
var compilerOptionsOverride = getOptionsOverrides(pluginOptions, mergedConfig);
var parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
checkTsConfig(parsedTsConfig);
context.debug("built-in options overrides: " + JSON.stringify(compilerOptionsOverride, undefined, 4));
context.debug("parsed tsconfig: " + JSON.stringify(parsedTsConfig, undefined, 4));
return parsedTsConfig;
@ -19829,7 +19859,7 @@ function typescript(options) {
rollupOptions = __assign({}, config);
context = new ConsoleContext(pluginOptions.verbosity, "rpt2: ");
context.info("typescript version: " + tsModule.version);
context.info("rollup-plugin-typescript2 version: 0.11.1");
context.info("rollup-plugin-typescript2 version: 0.12.0");
context.debug(function () { return "plugin options:\n" + JSON.stringify(pluginOptions, function (key, value) { return key === "typescript" ? "version " + value.version : value; }, 4); });
context.debug(function () { return "rollup config:\n" + JSON.stringify(rollupOptions, undefined, 4); });
watchMode = process.env.ROLLUP_WATCH === "true";

File diff suppressed because one or more lines are too long

46
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "rollup-plugin-typescript2",
"version": "0.11.1",
"version": "0.11.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -24,9 +24,9 @@
"dev": true
},
"@types/lodash": {
"version": "4.14.100",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.100.tgz",
"integrity": "sha512-RdmitCjynsHc+U09x9LEmMrxNz2lgmeK3jMrfZFO38WZ/wTqojrpe4nRCLzLMLnL+s+8apNofGmQ9KdMxPcfCA==",
"version": "4.14.104",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.104.tgz",
"integrity": "sha512-ufQcVg4daO8xQ5kopxRHanqFdL4AI7ondQkV+2f+7mz3gvp0LkBx2zBRC6hfs3T87mzQFmf5Fck7Fi145Ul6NQ==",
"dev": true
},
"@types/node": {
@ -41,19 +41,14 @@
"dev": true
},
"@types/resolve": {
"version": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.4.tgz",
"integrity": "sha1-m1htZalH3qiMS8JNoLkF/pUgoNU=",
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.7.tgz",
"integrity": "sha512-GPewdjkb0Q76o459qgp6pBLzJj/bD3oveS2kfLhIkZ9U3t3AFKtl5DlFB6lGTw0iZmcmxoGC8lpLW3NNJKrN9A==",
"dev": true,
"requires": {
"@types/node": "8.0.47"
}
},
"acorn": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.0.tgz",
"integrity": "sha512-bkLTrtPfRASTxDXFaih7SbeYSsQ8MjrqCQKMrgZ4Hc7kYI//WVU6rDTAIqVrAudjgMFQEGthYfodtaw8dTRJrg==",
"dev": true
},
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
@ -515,7 +510,7 @@
"magic-string": {
"version": "0.22.4",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.4.tgz",
"integrity": "sha1-MQObTkA2Y5VhjB1s+Bk8U5F0df8=",
"integrity": "sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw==",
"dev": true,
"requires": {
"vlq": "0.2.3"
@ -712,18 +707,17 @@
}
},
"rollup": {
"version": "0.55.3",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-0.55.3.tgz",
"integrity": "sha512-2TgimJ7pk+XfPT0DmAcOqq9qdXlJ04qKyzyLm1WvPS/E6XdXEXyG5u6L8AsjxOaKoEBlYGliPzo99jxwhn2NYQ==",
"version": "0.56.4",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-0.56.4.tgz",
"integrity": "sha512-Ja1ph+tZSE9sY5/WURJCuhaU2+2LTKKmhvxG7Smunn37s7aESLDFUj5XMnSYMypytwxeTvpy8ZzFfEeFiYMyug==",
"dev": true
},
"rollup-plugin-commonjs": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.3.0.tgz",
"integrity": "sha512-PYs3OiYgENFYEmI3vOEm5nrp3eY90YZqd5vGmQqeXmhJsAWFIrFdROCvOasqJ1HgeTvqyYo9IGXnFDyoboNcgQ==",
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.0.0.tgz",
"integrity": "sha512-4wYwVu3wm39bGrOturXtUDfASt/OVh1UTxAukDMLbJnjCMM0i2nMRhLiutU2ZRXkYySq1Vn01Tw+l/AcJtZpkQ==",
"dev": true,
"requires": {
"acorn": "5.4.0",
"estree-walker": "0.5.1",
"magic-string": "0.22.4",
"resolve": "1.5.0",
@ -739,9 +733,9 @@
}
},
"rollup-plugin-node-resolve": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.2.tgz",
"integrity": "sha512-ZwmMip/yqw6cmDQJuCQJ1G7gw2z11iGUtQNFYrFZHmqadRHU+OZGC3nOXwXu+UTvcm5lzDspB1EYWrkTgPWybw==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.3.tgz",
"integrity": "sha512-qJLXJ1aASV6p8SrEfRdQdHmb5OQmqXyIWIdVGcju8QFzftSsHcuL554Vy+n8mr0fZCC+ksO6aWJ7TAVl2F+Qwg==",
"dev": true,
"requires": {
"builtin-modules": "1.1.1",
@ -884,9 +878,9 @@
}
},
"typescript": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.1.tgz",
"integrity": "sha512-bqB1yS6o9TNA9ZC/MJxM0FZzPnZdtHj0xWK/IZ5khzVqdpGul/R/EIiHRgFXlwTD7PSIaYVnGKq1QgMCu2mnqw==",
"version": "2.7.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz",
"integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==",
"dev": true
},
"universalify": {

View File

@ -1,6 +1,6 @@
{
"name": "rollup-plugin-typescript2",
"version": "0.11.2",
"version": "0.12.0",
"description": "Seamless integration between Rollup and TypeScript. Now with errors.",
"main": "dist/rollup-plugin-typescript2.cjs.js",
"module": "dist/rollup-plugin-typescript2.es.js",
@ -40,7 +40,7 @@
"typescript": ">=2.4.0"
},
"devDependencies": {
"typescript": "2.7.1",
"typescript": "2.7.2",
"object-hash": "^1.2.0",
"colors": "^1.1.2",
"graphlib": "^2.1.5",
@ -48,15 +48,15 @@
"@types/colors": "^1.1.3",
"@types/fs-extra": "^5.0.0",
"@types/graphlib": "^2.1.4",
"@types/lodash": "^4.14.100",
"@types/lodash": "^4.14.104",
"@types/node": "^8.0.47",
"@types/object-hash": "^1.1.0",
"@types/resolve": "^0.0.4",
"@types/resolve": "^0.0.7",
"rimraf": "^2.6.2",
"rollup": "^0.55.3",
"rollup": "^0.56.4",
"rollup-plugin-typescript2": "github:ezolenko/rollup-plugin-typescript2#master",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-commonjs": "^8.3.0",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup-plugin-commonjs": "^9.0.0",
"rollup-plugin-re": "^1.0.6",
"rollup-watch": "^4.3.1",
"tslint": "^5.9.1"

18
src/check-tsconfig.ts Normal file
View File

@ -0,0 +1,18 @@
import { tsModule } from "./tsproxy";
import * as tsTypes from "typescript";
export function checkTsConfig(parsedConfig: tsTypes.ParsedCommandLine): void
{
const module = parsedConfig.options.module;
switch (module)
{
case tsModule.ModuleKind.ES2015:
case tsModule.ModuleKind.ESNext:
break;
case undefined:
throw new Error(`Incompatible tsconfig option. Missing module option. This is incompatible with rollup, please use 'module: "ES2015"' or 'module: "ESNext"'.`);
default:
throw new Error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with rollup, please use 'module: "ES2015"' or 'module: "ESNext"'.`);
}
}

View File

@ -0,0 +1,9 @@
export function getOptionsDefaults()
{
return {
compilerOptions:
{
module: "ES2015",
},
};
}

View File

@ -6,7 +6,6 @@ import * as _ from "lodash";
export function getOptionsOverrides({ useTsconfigDeclarationDir }: IOptions, tsConfigJson?: any): tsTypes.CompilerOptions
{
const overrides = {
module: tsModule.ModuleKind.ES2015,
noEmitHelpers: false,
importHelpers: true,
noResolve: false,

View File

@ -9,7 +9,7 @@ import * as _ from "lodash";
import { IRollupOptions } from "./irollup-options";
import { IOptions } from "./ioptions";
import { Partial } from "./partial";
import { parseTsConfig } from "./parse-ts-config";
import { parseTsConfig } from "./parse-tsconfig";
import { printDiagnostics } from "./print-diagnostics";
import { TSLIB, tslibSource } from "./tslib";
import { blue, red, yellow } from "colors/safe";

View File

@ -7,6 +7,8 @@ import { convertDiagnostic } from "./tscache";
import { getOptionsOverrides } from "./get-options-overrides";
import { IOptions } from "./ioptions";
import * as _ from "lodash";
import { checkTsConfig } from "./check-tsconfig";
import { getOptionsDefaults } from "./get-option-defaults";
export function parseTsConfig(context: IContext, pluginOptions: IOptions): tsTypes.ParsedCommandLine
{
@ -39,11 +41,13 @@ export function parseTsConfig(context: IContext, pluginOptions: IOptions): tsTyp
}
const mergedConfig = {};
_.merge(mergedConfig, pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
_.merge(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, mergedConfig);
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
checkTsConfig(parsedTsConfig);
context.debug(`built-in options overrides: ${JSON.stringify(compilerOptionsOverride, undefined, 4)}`);
context.debug(`parsed tsconfig: ${JSON.stringify(parsedTsConfig, undefined, 4)}`);

View File

@ -1,6 +1,5 @@
{
"compilerOptions": {
"module": "es6",
"target": "es5",
"noImplicitAny": true,
"sourceMap": true,