Skip to content

Commit

Permalink
- refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ezolenko committed Feb 25, 2019
1 parent 36aabef commit 9188132
Show file tree
Hide file tree
Showing 11 changed files with 1,185 additions and 201 deletions.
2 changes: 2 additions & 0 deletions dist/get-options-overrides.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as tsTypes from "typescript";
import { IOptions } from "./ioptions";
import { IContext } from "./context";
export declare function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IOptions, preParsedTsconfig?: tsTypes.ParsedCommandLine): tsTypes.CompilerOptions;
export declare function createFilter(context: IContext, pluginOptions: IOptions, parsedConfig: tsTypes.ParsedCommandLine): any;
//# sourceMappingURL=get-options-overrides.d.ts.map
2 changes: 1 addition & 1 deletion dist/get-options-overrides.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 33 additions & 31 deletions dist/rollup-plugin-typescript2.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24947,6 +24947,8 @@ function printDiagnostics(context, diagnostics, pretty) {
});
}

// tslint:disable-next-line:no-var-requires
const createRollupFilter = require("rollup-pluginutils").createFilter;
function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsedTsconfig) {
const overrides = {
noEmitHelpers: false,
Expand All @@ -24972,6 +24974,36 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
overrides.sourceRoot = undefined;
}
return overrides;
}
function createFilter(context, pluginOptions, parsedConfig) {
if (parsedConfig.options.rootDirs) {
const included = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.include instanceof Array)
return pluginOptions.include.map((include) => path.join(root, include));
else
return path.join(root, pluginOptions.include);
})
.uniq()
.value();
const excluded = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.exclude instanceof Array)
return pluginOptions.exclude.map((exclude) => path.join(root, exclude));
else
return path.join(root, pluginOptions.exclude);
})
.uniq()
.value();
context.debug(() => `included:\n${JSON.stringify(included, undefined, 4)}`);
context.debug(() => `excluded:\n${JSON.stringify(excluded, undefined, 4)}`);
return createRollupFilter(included, excluded);
}
else {
context.debug(() => `included:\n'${JSON.stringify(pluginOptions.include, undefined, 4)}'`);
context.debug(() => `excluded:\n'${JSON.stringify(pluginOptions.exclude, undefined, 4)}'`);
return createRollupFilter(pluginOptions.include, pluginOptions.exclude);
}
}

function checkTsConfig(parsedConfig) {
Expand Down Expand Up @@ -26426,9 +26458,6 @@ var semver_38 = semver.intersects;
var semver_39 = semver.coerce;

const typescript = (options) => {
// tslint:disable-next-line:no-var-requires
const createFilter = require("rollup-pluginutils").createFilter;
// tslint:enable-next-line:no-var-requires
let watchMode = false;
let generateRound = 0;
let rollupOptions;
Expand Down Expand Up @@ -26484,34 +26513,7 @@ const typescript = (options) => {
if (watchMode)
context.info(`running in watch mode`);
parsedConfig = parseTsConfig(context, pluginOptions);
if (parsedConfig.options.rootDirs) {
const included = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.include instanceof Array)
return pluginOptions.include.map((include) => path.join(root, include));
else
return path.join(root, pluginOptions.include);
})
.uniq()
.value();
const excluded = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.exclude instanceof Array)
return pluginOptions.exclude.map((exclude) => path.join(root, exclude));
else
return path.join(root, pluginOptions.exclude);
})
.uniq()
.value();
filter = createFilter(included, excluded);
context.debug(() => `included:\n${JSON.stringify(included, undefined, 4)}`);
context.debug(() => `excluded:\n${JSON.stringify(excluded, undefined, 4)}`);
}
else {
filter = createFilter(pluginOptions.include, pluginOptions.exclude);
context.debug(() => `included:\n'${JSON.stringify(pluginOptions.include, undefined, 4)}'`);
context.debug(() => `excluded:\n'${JSON.stringify(pluginOptions.exclude, undefined, 4)}'`);
}
filter = createFilter(context, pluginOptions, parsedConfig);
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers);
service = tsModule.createLanguageService(servicesHost, tsModule.createDocumentRegistry());
servicesHost.setLanguageService(service);
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

66 changes: 34 additions & 32 deletions dist/rollup-plugin-typescript2.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import crypto from 'crypto';
import { emptyDirSync, readJsonSync, writeJsonSync, ensureFileSync, removeSync, pathExistsSync, readdirSync as readdirSync$1, statSync } from 'fs-extra';
import util from 'util';
import os from 'os';
import { normalize as normalize$1, dirname, join, isAbsolute, relative } from 'path';
import { normalize as normalize$1, join, dirname, isAbsolute, relative } from 'path';
import { sync } from 'resolve';

var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
Expand Down Expand Up @@ -24943,6 +24943,8 @@ function printDiagnostics(context, diagnostics, pretty) {
});
}

// tslint:disable-next-line:no-var-requires
const createRollupFilter = require("rollup-pluginutils").createFilter;
function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsedTsconfig) {
const overrides = {
noEmitHelpers: false,
Expand All @@ -24968,6 +24970,36 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
overrides.sourceRoot = undefined;
}
return overrides;
}
function createFilter(context, pluginOptions, parsedConfig) {
if (parsedConfig.options.rootDirs) {
const included = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.include instanceof Array)
return pluginOptions.include.map((include) => join(root, include));
else
return join(root, pluginOptions.include);
})
.uniq()
.value();
const excluded = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.exclude instanceof Array)
return pluginOptions.exclude.map((exclude) => join(root, exclude));
else
return join(root, pluginOptions.exclude);
})
.uniq()
.value();
context.debug(() => `included:\n${JSON.stringify(included, undefined, 4)}`);
context.debug(() => `excluded:\n${JSON.stringify(excluded, undefined, 4)}`);
return createRollupFilter(included, excluded);
}
else {
context.debug(() => `included:\n'${JSON.stringify(pluginOptions.include, undefined, 4)}'`);
context.debug(() => `excluded:\n'${JSON.stringify(pluginOptions.exclude, undefined, 4)}'`);
return createRollupFilter(pluginOptions.include, pluginOptions.exclude);
}
}

function checkTsConfig(parsedConfig) {
Expand Down Expand Up @@ -26422,9 +26454,6 @@ var semver_38 = semver.intersects;
var semver_39 = semver.coerce;

const typescript = (options) => {
// tslint:disable-next-line:no-var-requires
const createFilter = require("rollup-pluginutils").createFilter;
// tslint:enable-next-line:no-var-requires
let watchMode = false;
let generateRound = 0;
let rollupOptions;
Expand Down Expand Up @@ -26480,34 +26509,7 @@ const typescript = (options) => {
if (watchMode)
context.info(`running in watch mode`);
parsedConfig = parseTsConfig(context, pluginOptions);
if (parsedConfig.options.rootDirs) {
const included = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.include instanceof Array)
return pluginOptions.include.map((include) => join(root, include));
else
return join(root, pluginOptions.include);
})
.uniq()
.value();
const excluded = lodash_16(parsedConfig.options.rootDirs)
.flatMap((root) => {
if (pluginOptions.exclude instanceof Array)
return pluginOptions.exclude.map((exclude) => join(root, exclude));
else
return join(root, pluginOptions.exclude);
})
.uniq()
.value();
filter = createFilter(included, excluded);
context.debug(() => `included:\n${JSON.stringify(included, undefined, 4)}`);
context.debug(() => `excluded:\n${JSON.stringify(excluded, undefined, 4)}`);
}
else {
filter = createFilter(pluginOptions.include, pluginOptions.exclude);
context.debug(() => `included:\n'${JSON.stringify(pluginOptions.include, undefined, 4)}'`);
context.debug(() => `excluded:\n'${JSON.stringify(pluginOptions.exclude, undefined, 4)}'`);
}
filter = createFilter(context, pluginOptions, parsedConfig);
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers);
service = tsModule.createLanguageService(servicesHost, tsModule.createDocumentRegistry());
servicesHost.setLanguageService(service);
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.es.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 9188132

Please sign in to comment.