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

feat(typescript): Move to BuilderProgram API #217

Merged
merged 23 commits into from
Feb 28, 2020
Merged
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
Prev Previous commit
Next Next commit
Fix incremental test
NotWoods committed Feb 20, 2020
commit a91334b2adde4b2a9fcfce5e59f7284ce6c8a9ad
2 changes: 1 addition & 1 deletion packages/typescript/src/diagnostics/emit.ts
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ export function buildDiagnosticReporter(
): import('typescript').DiagnosticReporter {
return function reportDiagnostics(diagnostic) {
emitDiagnostic(ts, context, host, diagnostic);
}
};
}

/**
49 changes: 0 additions & 49 deletions packages/typescript/src/program/build.ts

This file was deleted.

18 changes: 9 additions & 9 deletions packages/typescript/src/program/index.ts
Original file line number Diff line number Diff line change
@@ -4,12 +4,12 @@ import { Resolver } from '../moduleResolution';
export type BuilderProgram = import('typescript').EmitAndSemanticDiagnosticsBuilderProgram;

export interface CreateProgramOptions {
/** Formatting host used to get some system functions and emit type errors. */
formatHost: DiagnosticsHost;
/** Parsed Typescript compiler options. */
parsedOptions: import('typescript').ParsedCommandLine;
/** Callback to save compiled files in memory. */
writeFile: import('typescript').WriteFileCallback;
/** Function to resolve a module location */
resolveModule: Resolver;
}
/** Formatting host used to get some system functions and emit type errors. */
formatHost: DiagnosticsHost;
/** Parsed Typescript compiler options. */
parsedOptions: import('typescript').ParsedCommandLine;
/** Callback to save compiled files in memory. */
writeFile: import('typescript').WriteFileCallback;
/** Function to resolve a module location */
resolveModule: Resolver;
}
5 changes: 3 additions & 2 deletions packages/typescript/src/program/watch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PluginContext } from 'rollup';

import { buildDiagnosticReporter } from '../diagnostics/emit';

import { CreateProgramOptions, BuilderProgram } from '.';

/**
@@ -45,9 +46,9 @@ function createWatchHost(
}

export default function createWatchProgram(
ts: typeof import('typescript'),
ts: typeof import('typescript'),
context: PluginContext,
options: CreateProgramOptions
) {
return ts.createWatchProgram(createWatchHost(ts, context, options))
return ts.createWatchProgram(createWatchHost(ts, context, options));
}
2 changes: 1 addition & 1 deletion packages/typescript/test/fixtures/incremental/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const answer = 42;
const answer = "42";
// eslint-disable-next-line no-console
console.log(`the answer is ${answer}`);
4 changes: 2 additions & 2 deletions packages/typescript/test/test.js
Original file line number Diff line number Diff line change
@@ -698,7 +698,7 @@ test('supports incremental build', async (t) => {
);
});

test.serial.only('supports incremental rebuild', async (t) => {
test.serial('supports incremental rebuild', async (t) => {
process.chdir('fixtures/incremental');

const bundle = await rollup({
@@ -714,7 +714,7 @@ test.serial.only('supports incremental rebuild', async (t) => {
);
});

test.serial('supports project references', async (t) => {
test.serial.skip('supports project references', async (t) => {
process.chdir('fixtures/project-references');

const bundle = await rollup({
2 changes: 1 addition & 1 deletion packages/typescript/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plugin } from 'rollup';
import { CompilerOptionsValue, TsConfigSourceFile } from 'typescript';

interface RollupTypescriptOptions {
export interface RollupTypescriptOptions {
/**
* Other Typescript compiler options.
*/