mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
- fix for #131
This commit is contained in:
parent
8dcdfb89be
commit
d1082d830f
2
dist/check-tsconfig.d.ts.map
vendored
2
dist/check-tsconfig.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"check-tsconfig.d.ts","sourceRoot":"","sources":["src/check-tsconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,wBAAgB,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAc3E"}
|
||||
{"version":3,"file":"check-tsconfig.d.ts","sourceRoot":"","sources":["src/check-tsconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,wBAAgB,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAM3E"}
|
||||
6
dist/get-option-defaults.d.ts
vendored
6
dist/get-option-defaults.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export declare function getOptionsDefaults(): {
|
||||
compilerOptions: {
|
||||
module: string;
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=get-option-defaults.d.ts.map
|
||||
1
dist/get-option-defaults.d.ts.map
vendored
1
dist/get-option-defaults.d.ts.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"get-option-defaults.d.ts","sourceRoot":"","sources":["src/get-option-defaults.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB;;;;EAQjC"}
|
||||
2
dist/get-options-overrides.d.ts.map
vendored
2
dist/get-options-overrides.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"get-options-overrides.d.ts","sourceRoot":"","sources":["src/get-options-overrides.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,wBAAgB,mBAAmB,CAAC,EAAE,yBAAyB,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,eAAe,CA4B9J"}
|
||||
{"version":3,"file":"get-options-overrides.d.ts","sourceRoot":"","sources":["src/get-options-overrides.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,wBAAgB,mBAAmB,CAAC,EAAE,yBAAyB,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,eAAe,CA+B9J"}
|
||||
2
dist/parse-tsconfig.d.ts.map
vendored
2
dist/parse-tsconfig.d.ts.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"parse-tsconfig.d.ts","sourceRoot":"","sources":["src/parse-tsconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKtC,wBAAgB,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CA8CnG"}
|
||||
{"version":3,"file":"parse-tsconfig.d.ts","sourceRoot":"","sources":["src/parse-tsconfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,wBAAgB,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CA8CnG"}
|
||||
27
dist/rollup-plugin-typescript2.cjs.js
vendored
27
dist/rollup-plugin-typescript2.cjs.js
vendored
@ -24957,38 +24957,25 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
|
||||
allowNonTsExtensions: true,
|
||||
};
|
||||
if (preParsedTsconfig) {
|
||||
if (preParsedTsconfig.options.module === undefined)
|
||||
overrides.module = tsModule.ModuleKind.ES2015;
|
||||
const declaration = preParsedTsconfig.options.declaration;
|
||||
if (!declaration)
|
||||
overrides.declarationDir = null;
|
||||
overrides.declarationDir = undefined;
|
||||
if (declaration && !useTsconfigDeclarationDir)
|
||||
overrides.declarationDir = process.cwd();
|
||||
// unsetting sourceRoot if sourceMap is not enabled (in case original tsconfig had inlineSourceMap set that is being unset and would cause TS5051)
|
||||
const sourceMap = preParsedTsconfig.options.sourceMap;
|
||||
if (!sourceMap)
|
||||
overrides.sourceRoot = null;
|
||||
overrides.sourceRoot = undefined;
|
||||
}
|
||||
return overrides;
|
||||
}
|
||||
|
||||
function checkTsConfig(parsedConfig) {
|
||||
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"'.`);
|
||||
}
|
||||
}
|
||||
|
||||
function getOptionsDefaults() {
|
||||
return {
|
||||
compilerOptions: {
|
||||
module: "ES2015",
|
||||
},
|
||||
};
|
||||
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ESNext)
|
||||
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 parseTsConfig(context, pluginOptions) {
|
||||
@ -25015,7 +25002,7 @@ function parseTsConfig(context, pluginOptions) {
|
||||
configFileName = fileName;
|
||||
}
|
||||
const mergedConfig = {};
|
||||
lodash_14(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
|
||||
lodash_14(mergedConfig, pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
|
||||
const preParsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, getOptionsOverrides(pluginOptions), configFileName);
|
||||
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, preParsedTsConfig);
|
||||
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
|
||||
|
||||
2
dist/rollup-plugin-typescript2.cjs.js.map
vendored
2
dist/rollup-plugin-typescript2.cjs.js.map
vendored
File diff suppressed because one or more lines are too long
27
dist/rollup-plugin-typescript2.es.js
vendored
27
dist/rollup-plugin-typescript2.es.js
vendored
@ -24953,38 +24953,25 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
|
||||
allowNonTsExtensions: true,
|
||||
};
|
||||
if (preParsedTsconfig) {
|
||||
if (preParsedTsconfig.options.module === undefined)
|
||||
overrides.module = tsModule.ModuleKind.ES2015;
|
||||
const declaration = preParsedTsconfig.options.declaration;
|
||||
if (!declaration)
|
||||
overrides.declarationDir = null;
|
||||
overrides.declarationDir = undefined;
|
||||
if (declaration && !useTsconfigDeclarationDir)
|
||||
overrides.declarationDir = process.cwd();
|
||||
// unsetting sourceRoot if sourceMap is not enabled (in case original tsconfig had inlineSourceMap set that is being unset and would cause TS5051)
|
||||
const sourceMap = preParsedTsconfig.options.sourceMap;
|
||||
if (!sourceMap)
|
||||
overrides.sourceRoot = null;
|
||||
overrides.sourceRoot = undefined;
|
||||
}
|
||||
return overrides;
|
||||
}
|
||||
|
||||
function checkTsConfig(parsedConfig) {
|
||||
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"'.`);
|
||||
}
|
||||
}
|
||||
|
||||
function getOptionsDefaults() {
|
||||
return {
|
||||
compilerOptions: {
|
||||
module: "ES2015",
|
||||
},
|
||||
};
|
||||
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ESNext)
|
||||
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 parseTsConfig(context, pluginOptions) {
|
||||
@ -25011,7 +24998,7 @@ function parseTsConfig(context, pluginOptions) {
|
||||
configFileName = fileName;
|
||||
}
|
||||
const mergedConfig = {};
|
||||
lodash_14(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
|
||||
lodash_14(mergedConfig, pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
|
||||
const preParsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, getOptionsOverrides(pluginOptions), configFileName);
|
||||
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, preParsedTsConfig);
|
||||
const parsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, compilerOptionsOverride, configFileName);
|
||||
|
||||
2
dist/rollup-plugin-typescript2.es.js.map
vendored
2
dist/rollup-plugin-typescript2.es.js.map
vendored
File diff suppressed because one or more lines are too long
@ -3,16 +3,8 @@ import * as tsTypes from "typescript";
|
||||
|
||||
export function checkTsConfig(parsedConfig: tsTypes.ParsedCommandLine): void
|
||||
{
|
||||
const module = parsedConfig.options.module;
|
||||
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"'.`);
|
||||
}
|
||||
if (module !== tsModule.ModuleKind.ES2015 && module !== tsModule.ModuleKind.ESNext)
|
||||
throw new Error(`Incompatible tsconfig option. Module resolves to '${tsModule.ModuleKind[module]}'. This is incompatible with rollup, please use 'module: "ES2015"' or 'module: "ESNext"'.`);
|
||||
}
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
export function getOptionsDefaults()
|
||||
{
|
||||
return {
|
||||
compilerOptions:
|
||||
{
|
||||
module: "ES2015",
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -5,7 +5,7 @@ import * as _ from "lodash";
|
||||
|
||||
export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IOptions, preParsedTsconfig?: tsTypes.ParsedCommandLine): tsTypes.CompilerOptions
|
||||
{
|
||||
const overrides = {
|
||||
const overrides: tsTypes.CompilerOptions = {
|
||||
noEmitHelpers: false,
|
||||
importHelpers: true,
|
||||
noResolve: false,
|
||||
@ -18,16 +18,19 @@ export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IO
|
||||
|
||||
if (preParsedTsconfig)
|
||||
{
|
||||
if (preParsedTsconfig.options.module === undefined)
|
||||
overrides.module = tsModule.ModuleKind.ES2015;
|
||||
|
||||
const declaration = preParsedTsconfig.options.declaration;
|
||||
if (!declaration)
|
||||
(overrides as any).declarationDir = null;
|
||||
overrides.declarationDir = undefined;
|
||||
if (declaration && !useTsconfigDeclarationDir)
|
||||
(overrides as any).declarationDir = process.cwd();
|
||||
overrides.declarationDir = process.cwd();
|
||||
|
||||
// unsetting sourceRoot if sourceMap is not enabled (in case original tsconfig had inlineSourceMap set that is being unset and would cause TS5051)
|
||||
const sourceMap = preParsedTsconfig.options.sourceMap;
|
||||
if (!sourceMap)
|
||||
(overrides as any).sourceRoot = null;
|
||||
overrides.sourceRoot = undefined;
|
||||
}
|
||||
|
||||
return overrides;
|
||||
|
||||
@ -8,7 +8,6 @@ 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
|
||||
{
|
||||
@ -43,7 +42,7 @@ export function parseTsConfig(context: IContext, pluginOptions: IOptions): tsTyp
|
||||
}
|
||||
|
||||
const mergedConfig = {};
|
||||
_.merge(mergedConfig, getOptionsDefaults(), pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
|
||||
_.merge(mergedConfig, pluginOptions.tsconfigDefaults, loadedConfig, pluginOptions.tsconfigOverride);
|
||||
|
||||
const preParsedTsConfig = tsModule.parseJsonConfigFileContent(mergedConfig, tsModule.sys, baseDir, getOptionsOverrides(pluginOptions), configFileName);
|
||||
const compilerOptionsOverride = getOptionsOverrides(pluginOptions, preParsedTsConfig);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.base",
|
||||
"extends": "./tsconfig.base",
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user