Merge pull request #26523 from Microsoft/disableBuildAPI
Disable apis for tsc --build till we have the actual API figured out with the tests and usage
This commit is contained in:
commit
56bac29808
4 changed files with 3 additions and 364 deletions
|
@ -1,3 +1,5 @@
|
|||
// Currently we do not want to expose API for build, we should work out the API, and then expose it just like we did for builder/watch
|
||||
/*@internal*/
|
||||
namespace ts {
|
||||
const minimumDate = new Date(-8640000000000000);
|
||||
const maximumDate = new Date(8640000000000000);
|
||||
|
|
|
@ -4714,6 +4714,7 @@ namespace ts {
|
|||
verticalTab = 0x0B, // \v
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
export interface UpToDateHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
getModifiedTime(fileName: string): Date | undefined;
|
||||
|
|
182
tests/baselines/reference/api/tsserverlibrary.d.ts
vendored
182
tests/baselines/reference/api/tsserverlibrary.d.ts
vendored
|
@ -2592,14 +2592,6 @@ declare namespace ts {
|
|||
oldProgram?: Program;
|
||||
configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>;
|
||||
}
|
||||
interface UpToDateHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
getModifiedTime(fileName: string): Date | undefined;
|
||||
getUnchangedTime?(fileName: string): Date | undefined;
|
||||
getLastStatus?(fileName: string): UpToDateStatus | undefined;
|
||||
setLastStatus?(fileName: string, status: UpToDateStatus): void;
|
||||
parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined;
|
||||
}
|
||||
interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string | undefined;
|
||||
|
@ -4423,180 +4415,6 @@ declare namespace ts {
|
|||
*/
|
||||
function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfConfigFile<T>): WatchOfConfigFile<T>;
|
||||
}
|
||||
declare namespace ts {
|
||||
interface BuildHost {
|
||||
verbose(diag: DiagnosticMessage, ...args: string[]): void;
|
||||
error(diag: DiagnosticMessage, ...args: string[]): void;
|
||||
errorDiagnostic(diag: Diagnostic): void;
|
||||
message(diag: DiagnosticMessage, ...args: string[]): void;
|
||||
}
|
||||
/**
|
||||
* A BuildContext tracks what's going on during the course of a build.
|
||||
*
|
||||
* Callers may invoke any number of build requests within the same context;
|
||||
* until the context is reset, each project will only be built at most once.
|
||||
*
|
||||
* Example: In a standard setup where project B depends on project A, and both are out of date,
|
||||
* a failed build of A will result in A remaining out of date. When we try to build
|
||||
* B, we should immediately bail instead of recomputing A's up-to-date status again.
|
||||
*
|
||||
* This also matters for performing fast (i.e. fake) downstream builds of projects
|
||||
* when their upstream .d.ts files haven't changed content (but have newer timestamps)
|
||||
*/
|
||||
interface BuildContext {
|
||||
options: BuildOptions;
|
||||
/**
|
||||
* Map from output file name to its pre-build timestamp
|
||||
*/
|
||||
unchangedOutputs: FileMap<Date>;
|
||||
/**
|
||||
* Map from config file name to up-to-date status
|
||||
*/
|
||||
projectStatus: FileMap<UpToDateStatus>;
|
||||
invalidatedProjects: FileMap<true>;
|
||||
queuedProjects: FileMap<true>;
|
||||
missingRoots: Map<true>;
|
||||
}
|
||||
type Mapper = ReturnType<typeof createDependencyMapper>;
|
||||
interface DependencyGraph {
|
||||
buildQueue: ResolvedConfigFileName[];
|
||||
dependencyMap: Mapper;
|
||||
}
|
||||
interface BuildOptions {
|
||||
dry: boolean;
|
||||
force: boolean;
|
||||
verbose: boolean;
|
||||
}
|
||||
enum UpToDateStatusType {
|
||||
Unbuildable = 0,
|
||||
UpToDate = 1,
|
||||
/**
|
||||
* The project appears out of date because its upstream inputs are newer than its outputs,
|
||||
* but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs.
|
||||
* This means we can Pseudo-build (just touch timestamps), as if we had actually built this project.
|
||||
*/
|
||||
UpToDateWithUpstreamTypes = 2,
|
||||
OutputMissing = 3,
|
||||
OutOfDateWithSelf = 4,
|
||||
OutOfDateWithUpstream = 5,
|
||||
UpstreamOutOfDate = 6,
|
||||
UpstreamBlocked = 7,
|
||||
/**
|
||||
* Projects with no outputs (i.e. "solution" files)
|
||||
*/
|
||||
ContainerOnly = 8
|
||||
}
|
||||
type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly;
|
||||
namespace Status {
|
||||
/**
|
||||
* The project can't be built at all in its current state. For example,
|
||||
* its config file cannot be parsed, or it has a syntax error or missing file
|
||||
*/
|
||||
interface Unbuildable {
|
||||
type: UpToDateStatusType.Unbuildable;
|
||||
reason: string;
|
||||
}
|
||||
/**
|
||||
* This project doesn't have any outputs, so "is it up to date" is a meaningless question.
|
||||
*/
|
||||
interface ContainerOnly {
|
||||
type: UpToDateStatusType.ContainerOnly;
|
||||
}
|
||||
/**
|
||||
* The project is up to date with respect to its inputs.
|
||||
* We track what the newest input file is.
|
||||
*/
|
||||
interface UpToDate {
|
||||
type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes;
|
||||
newestInputFileTime?: Date;
|
||||
newestInputFileName?: string;
|
||||
newestDeclarationFileContentChangedTime?: Date;
|
||||
newestOutputFileTime?: Date;
|
||||
newestOutputFileName?: string;
|
||||
oldestOutputFileName?: string;
|
||||
}
|
||||
/**
|
||||
* One or more of the outputs of the project does not exist.
|
||||
*/
|
||||
interface OutputMissing {
|
||||
type: UpToDateStatusType.OutputMissing;
|
||||
/**
|
||||
* The name of the first output file that didn't exist
|
||||
*/
|
||||
missingOutputFileName: string;
|
||||
}
|
||||
/**
|
||||
* One or more of the project's outputs is older than its newest input.
|
||||
*/
|
||||
interface OutOfDateWithSelf {
|
||||
type: UpToDateStatusType.OutOfDateWithSelf;
|
||||
outOfDateOutputFileName: string;
|
||||
newerInputFileName: string;
|
||||
}
|
||||
/**
|
||||
* This project depends on an out-of-date project, so shouldn't be built yet
|
||||
*/
|
||||
interface UpstreamOutOfDate {
|
||||
type: UpToDateStatusType.UpstreamOutOfDate;
|
||||
upstreamProjectName: string;
|
||||
}
|
||||
/**
|
||||
* This project depends an upstream project with build errors
|
||||
*/
|
||||
interface UpstreamBlocked {
|
||||
type: UpToDateStatusType.UpstreamBlocked;
|
||||
upstreamProjectName: string;
|
||||
}
|
||||
/**
|
||||
* One or more of the project's outputs is older than the newest output of
|
||||
* an upstream project.
|
||||
*/
|
||||
interface OutOfDateWithUpstream {
|
||||
type: UpToDateStatusType.OutOfDateWithUpstream;
|
||||
outOfDateOutputFileName: string;
|
||||
newerProjectName: string;
|
||||
}
|
||||
}
|
||||
interface FileMap<T> {
|
||||
setValue(fileName: string, value: T): void;
|
||||
getValue(fileName: string): T | never;
|
||||
getValueOrUndefined(fileName: string): T | undefined;
|
||||
hasKey(fileName: string): boolean;
|
||||
removeKey(fileName: string): void;
|
||||
getKeys(): string[];
|
||||
}
|
||||
function createDependencyMapper(): {
|
||||
addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void;
|
||||
getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[];
|
||||
getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[];
|
||||
getKeys: () => ReadonlyArray<ResolvedConfigFileName>;
|
||||
};
|
||||
function createBuildContext(options: BuildOptions): BuildContext;
|
||||
function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined;
|
||||
/**
|
||||
* A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but
|
||||
* can dynamically add/remove other projects based on changes on the rootNames' references
|
||||
*/
|
||||
function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray<string>, defaultOptions: BuildOptions, system?: System): {
|
||||
buildAllProjects: () => ExitStatus;
|
||||
getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus;
|
||||
getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus;
|
||||
cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped;
|
||||
resetBuildContext: (opts?: BuildOptions) => void;
|
||||
getBuildGraph: (configFileNames: ReadonlyArray<string>) => DependencyGraph | undefined;
|
||||
invalidateProject: (configFileName: string) => void;
|
||||
buildInvalidatedProjects: () => void;
|
||||
buildDependentInvalidatedProjects: () => void;
|
||||
resolveProjectName: (name: string) => ResolvedConfigFileName | undefined;
|
||||
startWatching: () => void;
|
||||
};
|
||||
/**
|
||||
* Gets the UpToDateStatus for a project
|
||||
*/
|
||||
function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus;
|
||||
function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray<string>;
|
||||
function formatUpToDateStatus<T>(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined;
|
||||
}
|
||||
declare namespace ts.server {
|
||||
type ActionSet = "action::set";
|
||||
type ActionInvalidate = "action::invalidate";
|
||||
|
|
182
tests/baselines/reference/api/typescript.d.ts
vendored
182
tests/baselines/reference/api/typescript.d.ts
vendored
|
@ -2592,14 +2592,6 @@ declare namespace ts {
|
|||
oldProgram?: Program;
|
||||
configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>;
|
||||
}
|
||||
interface UpToDateHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
getModifiedTime(fileName: string): Date | undefined;
|
||||
getUnchangedTime?(fileName: string): Date | undefined;
|
||||
getLastStatus?(fileName: string): UpToDateStatus | undefined;
|
||||
setLastStatus?(fileName: string, status: UpToDateStatus): void;
|
||||
parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined;
|
||||
}
|
||||
interface ModuleResolutionHost {
|
||||
fileExists(fileName: string): boolean;
|
||||
readFile(fileName: string): string | undefined;
|
||||
|
@ -4423,180 +4415,6 @@ declare namespace ts {
|
|||
*/
|
||||
function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfConfigFile<T>): WatchOfConfigFile<T>;
|
||||
}
|
||||
declare namespace ts {
|
||||
interface BuildHost {
|
||||
verbose(diag: DiagnosticMessage, ...args: string[]): void;
|
||||
error(diag: DiagnosticMessage, ...args: string[]): void;
|
||||
errorDiagnostic(diag: Diagnostic): void;
|
||||
message(diag: DiagnosticMessage, ...args: string[]): void;
|
||||
}
|
||||
/**
|
||||
* A BuildContext tracks what's going on during the course of a build.
|
||||
*
|
||||
* Callers may invoke any number of build requests within the same context;
|
||||
* until the context is reset, each project will only be built at most once.
|
||||
*
|
||||
* Example: In a standard setup where project B depends on project A, and both are out of date,
|
||||
* a failed build of A will result in A remaining out of date. When we try to build
|
||||
* B, we should immediately bail instead of recomputing A's up-to-date status again.
|
||||
*
|
||||
* This also matters for performing fast (i.e. fake) downstream builds of projects
|
||||
* when their upstream .d.ts files haven't changed content (but have newer timestamps)
|
||||
*/
|
||||
interface BuildContext {
|
||||
options: BuildOptions;
|
||||
/**
|
||||
* Map from output file name to its pre-build timestamp
|
||||
*/
|
||||
unchangedOutputs: FileMap<Date>;
|
||||
/**
|
||||
* Map from config file name to up-to-date status
|
||||
*/
|
||||
projectStatus: FileMap<UpToDateStatus>;
|
||||
invalidatedProjects: FileMap<true>;
|
||||
queuedProjects: FileMap<true>;
|
||||
missingRoots: Map<true>;
|
||||
}
|
||||
type Mapper = ReturnType<typeof createDependencyMapper>;
|
||||
interface DependencyGraph {
|
||||
buildQueue: ResolvedConfigFileName[];
|
||||
dependencyMap: Mapper;
|
||||
}
|
||||
interface BuildOptions {
|
||||
dry: boolean;
|
||||
force: boolean;
|
||||
verbose: boolean;
|
||||
}
|
||||
enum UpToDateStatusType {
|
||||
Unbuildable = 0,
|
||||
UpToDate = 1,
|
||||
/**
|
||||
* The project appears out of date because its upstream inputs are newer than its outputs,
|
||||
* but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs.
|
||||
* This means we can Pseudo-build (just touch timestamps), as if we had actually built this project.
|
||||
*/
|
||||
UpToDateWithUpstreamTypes = 2,
|
||||
OutputMissing = 3,
|
||||
OutOfDateWithSelf = 4,
|
||||
OutOfDateWithUpstream = 5,
|
||||
UpstreamOutOfDate = 6,
|
||||
UpstreamBlocked = 7,
|
||||
/**
|
||||
* Projects with no outputs (i.e. "solution" files)
|
||||
*/
|
||||
ContainerOnly = 8
|
||||
}
|
||||
type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly;
|
||||
namespace Status {
|
||||
/**
|
||||
* The project can't be built at all in its current state. For example,
|
||||
* its config file cannot be parsed, or it has a syntax error or missing file
|
||||
*/
|
||||
interface Unbuildable {
|
||||
type: UpToDateStatusType.Unbuildable;
|
||||
reason: string;
|
||||
}
|
||||
/**
|
||||
* This project doesn't have any outputs, so "is it up to date" is a meaningless question.
|
||||
*/
|
||||
interface ContainerOnly {
|
||||
type: UpToDateStatusType.ContainerOnly;
|
||||
}
|
||||
/**
|
||||
* The project is up to date with respect to its inputs.
|
||||
* We track what the newest input file is.
|
||||
*/
|
||||
interface UpToDate {
|
||||
type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes;
|
||||
newestInputFileTime?: Date;
|
||||
newestInputFileName?: string;
|
||||
newestDeclarationFileContentChangedTime?: Date;
|
||||
newestOutputFileTime?: Date;
|
||||
newestOutputFileName?: string;
|
||||
oldestOutputFileName?: string;
|
||||
}
|
||||
/**
|
||||
* One or more of the outputs of the project does not exist.
|
||||
*/
|
||||
interface OutputMissing {
|
||||
type: UpToDateStatusType.OutputMissing;
|
||||
/**
|
||||
* The name of the first output file that didn't exist
|
||||
*/
|
||||
missingOutputFileName: string;
|
||||
}
|
||||
/**
|
||||
* One or more of the project's outputs is older than its newest input.
|
||||
*/
|
||||
interface OutOfDateWithSelf {
|
||||
type: UpToDateStatusType.OutOfDateWithSelf;
|
||||
outOfDateOutputFileName: string;
|
||||
newerInputFileName: string;
|
||||
}
|
||||
/**
|
||||
* This project depends on an out-of-date project, so shouldn't be built yet
|
||||
*/
|
||||
interface UpstreamOutOfDate {
|
||||
type: UpToDateStatusType.UpstreamOutOfDate;
|
||||
upstreamProjectName: string;
|
||||
}
|
||||
/**
|
||||
* This project depends an upstream project with build errors
|
||||
*/
|
||||
interface UpstreamBlocked {
|
||||
type: UpToDateStatusType.UpstreamBlocked;
|
||||
upstreamProjectName: string;
|
||||
}
|
||||
/**
|
||||
* One or more of the project's outputs is older than the newest output of
|
||||
* an upstream project.
|
||||
*/
|
||||
interface OutOfDateWithUpstream {
|
||||
type: UpToDateStatusType.OutOfDateWithUpstream;
|
||||
outOfDateOutputFileName: string;
|
||||
newerProjectName: string;
|
||||
}
|
||||
}
|
||||
interface FileMap<T> {
|
||||
setValue(fileName: string, value: T): void;
|
||||
getValue(fileName: string): T | never;
|
||||
getValueOrUndefined(fileName: string): T | undefined;
|
||||
hasKey(fileName: string): boolean;
|
||||
removeKey(fileName: string): void;
|
||||
getKeys(): string[];
|
||||
}
|
||||
function createDependencyMapper(): {
|
||||
addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void;
|
||||
getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[];
|
||||
getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[];
|
||||
getKeys: () => ReadonlyArray<ResolvedConfigFileName>;
|
||||
};
|
||||
function createBuildContext(options: BuildOptions): BuildContext;
|
||||
function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined;
|
||||
/**
|
||||
* A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but
|
||||
* can dynamically add/remove other projects based on changes on the rootNames' references
|
||||
*/
|
||||
function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray<string>, defaultOptions: BuildOptions, system?: System): {
|
||||
buildAllProjects: () => ExitStatus;
|
||||
getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus;
|
||||
getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus;
|
||||
cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped;
|
||||
resetBuildContext: (opts?: BuildOptions) => void;
|
||||
getBuildGraph: (configFileNames: ReadonlyArray<string>) => DependencyGraph | undefined;
|
||||
invalidateProject: (configFileName: string) => void;
|
||||
buildInvalidatedProjects: () => void;
|
||||
buildDependentInvalidatedProjects: () => void;
|
||||
resolveProjectName: (name: string) => ResolvedConfigFileName | undefined;
|
||||
startWatching: () => void;
|
||||
};
|
||||
/**
|
||||
* Gets the UpToDateStatus for a project
|
||||
*/
|
||||
function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus;
|
||||
function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray<string>;
|
||||
function formatUpToDateStatus<T>(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined;
|
||||
}
|
||||
declare namespace ts.server {
|
||||
type ActionSet = "action::set";
|
||||
type ActionInvalidate = "action::invalidate";
|
||||
|
|
Loading…
Reference in a new issue