Skip to content

Commit

Permalink
- build
Browse files Browse the repository at this point in the history
  • Loading branch information
ezolenko committed Dec 3, 2019
1 parent 4217346 commit 23f63b4
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dist/get-options-overrides.d.ts
@@ -1,6 +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 getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot, cwd }: 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/host.d.ts
Expand Up @@ -8,7 +8,7 @@ export declare class LanguageServiceHost implements tsTypes.LanguageServiceHost
private versions;
private service?;
private fileNames;
constructor(parsedConfig: tsTypes.ParsedCommandLine, transformers: TransformerFactoryCreator[]);
constructor(parsedConfig: tsTypes.ParsedCommandLine, transformers: TransformerFactoryCreator[], cwd: string);
reset(): void;
setLanguageService(service: tsTypes.LanguageService): void;
setSnapshot(fileName: string, data: string): tsTypes.IScriptSnapshot;
Expand Down
2 changes: 1 addition & 1 deletion dist/host.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.

1 change: 1 addition & 0 deletions dist/ioptions.d.ts
Expand Up @@ -7,6 +7,7 @@ export interface ICustomTransformer {
}
export declare type TransformerFactoryCreator = (ls: tsTypes.LanguageService) => tsTypes.CustomTransformers | ICustomTransformer;
export interface IOptions {
cwd: string;
include: string | string[];
exclude: string | string[];
check: boolean;
Expand Down
2 changes: 1 addition & 1 deletion dist/ioptions.d.ts.map

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

17 changes: 9 additions & 8 deletions dist/rollup-plugin-typescript2.cjs.js
Expand Up @@ -17222,13 +17222,13 @@ function normalize(fileName) {
}

class LanguageServiceHost {
constructor(parsedConfig, transformers) {
constructor(parsedConfig, transformers, cwd) {
this.parsedConfig = parsedConfig;
this.transformers = transformers;
this.cwd = process.cwd();
this.snapshots = {};
this.versions = {};
this.fileNames = new Set(parsedConfig.fileNames);
this.cwd = cwd;
}
reset() {
this.snapshots = {};
Expand Down Expand Up @@ -24964,7 +24964,7 @@ function printDiagnostics(context, diagnostics, pretty) {

// tslint:disable-next-line:no-var-requires
const createRollupFilter = require("rollup-pluginutils").createFilter;
function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsedTsconfig) {
function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot, cwd }, preParsedTsconfig) {
const overrides = {
noEmitHelpers: false,
importHelpers: true,
Expand All @@ -24982,7 +24982,7 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
if (!declaration)
overrides.declarationDir = undefined;
if (declaration && !useTsconfigDeclarationDir)
overrides.declarationDir = process.cwd();
overrides.declarationDir = 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)
Expand Down Expand Up @@ -25024,12 +25024,12 @@ function checkTsConfig(parsedConfig) {
}

function parseTsConfig(context, pluginOptions) {
const fileName = tsModule.findConfigFile(process.cwd(), tsModule.sys.fileExists, pluginOptions.tsconfig);
const fileName = tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`failed to open '${fileName}'`);
let loadedConfig = {};
let baseDir = process.cwd();
let baseDir = pluginOptions.cwd;
let configFileName;
let pretty = false;
if (fileName) {
Expand Down Expand Up @@ -27263,6 +27263,7 @@ const typescript = (options) => {
transformers: [],
tsconfigDefaults: {},
objectHashIgnoreUnknownHack: false,
cwd: process.cwd(),
});
if (!pluginOptions.typescript) {
pluginOptions.typescript = require("typescript");
Expand Down Expand Up @@ -27291,7 +27292,7 @@ const typescript = (options) => {
context.info(`running in watch mode`);
}
filter = createFilter(context, pluginOptions, parsedConfig);
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers);
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers, pluginOptions.cwd);
service = tsModule.createLanguageService(servicesHost, tsModule.createDocumentRegistry());
servicesHost.setLanguageService(service);
// printing compiler option errors
Expand Down Expand Up @@ -27455,7 +27456,7 @@ const typescript = (options) => {
tsModule.sys.writeFile(fileName, entry.text, entry.writeByteOrderMark);
}
else {
const relativePath = path.relative(process.cwd(), fileName);
const relativePath = path.relative(pluginOptions.cwd, fileName);
context.debug(() => `${safe_5("emitting declarations")} for '${key}' to '${relativePath}'`);
this.emitFile({
type: "asset",
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.cjs.js.map

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions dist/rollup-plugin-typescript2.es.js
Expand Up @@ -17216,13 +17216,13 @@ function normalize(fileName) {
}

class LanguageServiceHost {
constructor(parsedConfig, transformers) {
constructor(parsedConfig, transformers, cwd) {
this.parsedConfig = parsedConfig;
this.transformers = transformers;
this.cwd = process.cwd();
this.snapshots = {};
this.versions = {};
this.fileNames = new Set(parsedConfig.fileNames);
this.cwd = cwd;
}
reset() {
this.snapshots = {};
Expand Down Expand Up @@ -24958,7 +24958,7 @@ function printDiagnostics(context, diagnostics, pretty) {

// tslint:disable-next-line:no-var-requires
const createRollupFilter = require("rollup-pluginutils").createFilter;
function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsedTsconfig) {
function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot, cwd }, preParsedTsconfig) {
const overrides = {
noEmitHelpers: false,
importHelpers: true,
Expand All @@ -24976,7 +24976,7 @@ function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }, preParsed
if (!declaration)
overrides.declarationDir = undefined;
if (declaration && !useTsconfigDeclarationDir)
overrides.declarationDir = process.cwd();
overrides.declarationDir = 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)
Expand Down Expand Up @@ -25018,12 +25018,12 @@ function checkTsConfig(parsedConfig) {
}

function parseTsConfig(context, pluginOptions) {
const fileName = tsModule.findConfigFile(process.cwd(), tsModule.sys.fileExists, pluginOptions.tsconfig);
const fileName = tsModule.findConfigFile(pluginOptions.cwd, tsModule.sys.fileExists, pluginOptions.tsconfig);
// if the value was provided, but no file, fail hard
if (pluginOptions.tsconfig !== undefined && !fileName)
throw new Error(`failed to open '${fileName}'`);
let loadedConfig = {};
let baseDir = process.cwd();
let baseDir = pluginOptions.cwd;
let configFileName;
let pretty = false;
if (fileName) {
Expand Down Expand Up @@ -27257,6 +27257,7 @@ const typescript = (options) => {
transformers: [],
tsconfigDefaults: {},
objectHashIgnoreUnknownHack: false,
cwd: process.cwd(),
});
if (!pluginOptions.typescript) {
pluginOptions.typescript = require("typescript");
Expand Down Expand Up @@ -27285,7 +27286,7 @@ const typescript = (options) => {
context.info(`running in watch mode`);
}
filter = createFilter(context, pluginOptions, parsedConfig);
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers);
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers, pluginOptions.cwd);
service = tsModule.createLanguageService(servicesHost, tsModule.createDocumentRegistry());
servicesHost.setLanguageService(service);
// printing compiler option errors
Expand Down Expand Up @@ -27449,7 +27450,7 @@ const typescript = (options) => {
tsModule.sys.writeFile(fileName, entry.text, entry.writeByteOrderMark);
}
else {
const relativePath = relative(process.cwd(), fileName);
const relativePath = relative(pluginOptions.cwd, fileName);
context.debug(() => `${safe_5("emitting declarations")} for '${key}' to '${relativePath}'`);
this.emitFile({
type: "asset",
Expand Down
2 changes: 1 addition & 1 deletion dist/rollup-plugin-typescript2.es.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/index.ts
Expand Up @@ -359,7 +359,6 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
else
{
const relativePath = relative(pluginOptions.cwd, fileName);
console.log('>>> DEBUG2', pluginOptions.cwd, relativePath, fileName);
context.debug(() => `${blue("emitting declarations")} for '${key}' to '${relativePath}'`);
this.emitFile({
type: "asset",
Expand All @@ -369,7 +368,6 @@ const typescript: PluginImpl<Partial<IOptions>> = (options) =>
}
};

console.log('>>> DEBUG', 'declarations', declarations);
_.each(declarations, ({ type, map }, key) =>
{
emitDeclaration(key, ".d.ts", type);
Expand Down

0 comments on commit 23f63b4

Please sign in to comment.