Skip to content

Commit 56bac29

Browse files
authored
Merge pull request microsoft#26523 from Microsoft/disableBuildAPI
Disable apis for tsc --build till we have the actual API figured out with the tests and usage
2 parents 60b8f8c + 8e2c422 commit 56bac29

File tree

4 files changed

+3
-364
lines changed

4 files changed

+3
-364
lines changed

src/compiler/tsbuild.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// 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
2+
/*@internal*/
13
namespace ts {
24
const minimumDate = new Date(-8640000000000000);
35
const maximumDate = new Date(8640000000000000);

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4714,6 +4714,7 @@ namespace ts {
47144714
verticalTab = 0x0B, // \v
47154715
}
47164716

4717+
/*@internal*/
47174718
export interface UpToDateHost {
47184719
fileExists(fileName: string): boolean;
47194720
getModifiedTime(fileName: string): Date | undefined;

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 0 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,14 +2592,6 @@ declare namespace ts {
25922592
oldProgram?: Program;
25932593
configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>;
25942594
}
2595-
interface UpToDateHost {
2596-
fileExists(fileName: string): boolean;
2597-
getModifiedTime(fileName: string): Date | undefined;
2598-
getUnchangedTime?(fileName: string): Date | undefined;
2599-
getLastStatus?(fileName: string): UpToDateStatus | undefined;
2600-
setLastStatus?(fileName: string, status: UpToDateStatus): void;
2601-
parseConfigFile?(configFilePath: ResolvedConfigFileName): ParsedCommandLine | undefined;
2602-
}
26032595
interface ModuleResolutionHost {
26042596
fileExists(fileName: string): boolean;
26052597
readFile(fileName: string): string | undefined;
@@ -4423,180 +4415,6 @@ declare namespace ts {
44234415
*/
44244416
function createWatchProgram<T extends BuilderProgram>(host: WatchCompilerHostOfConfigFile<T>): WatchOfConfigFile<T>;
44254417
}
4426-
declare namespace ts {
4427-
interface BuildHost {
4428-
verbose(diag: DiagnosticMessage, ...args: string[]): void;
4429-
error(diag: DiagnosticMessage, ...args: string[]): void;
4430-
errorDiagnostic(diag: Diagnostic): void;
4431-
message(diag: DiagnosticMessage, ...args: string[]): void;
4432-
}
4433-
/**
4434-
* A BuildContext tracks what's going on during the course of a build.
4435-
*
4436-
* Callers may invoke any number of build requests within the same context;
4437-
* until the context is reset, each project will only be built at most once.
4438-
*
4439-
* Example: In a standard setup where project B depends on project A, and both are out of date,
4440-
* a failed build of A will result in A remaining out of date. When we try to build
4441-
* B, we should immediately bail instead of recomputing A's up-to-date status again.
4442-
*
4443-
* This also matters for performing fast (i.e. fake) downstream builds of projects
4444-
* when their upstream .d.ts files haven't changed content (but have newer timestamps)
4445-
*/
4446-
interface BuildContext {
4447-
options: BuildOptions;
4448-
/**
4449-
* Map from output file name to its pre-build timestamp
4450-
*/
4451-
unchangedOutputs: FileMap<Date>;
4452-
/**
4453-
* Map from config file name to up-to-date status
4454-
*/
4455-
projectStatus: FileMap<UpToDateStatus>;
4456-
invalidatedProjects: FileMap<true>;
4457-
queuedProjects: FileMap<true>;
4458-
missingRoots: Map<true>;
4459-
}
4460-
type Mapper = ReturnType<typeof createDependencyMapper>;
4461-
interface DependencyGraph {
4462-
buildQueue: ResolvedConfigFileName[];
4463-
dependencyMap: Mapper;
4464-
}
4465-
interface BuildOptions {
4466-
dry: boolean;
4467-
force: boolean;
4468-
verbose: boolean;
4469-
}
4470-
enum UpToDateStatusType {
4471-
Unbuildable = 0,
4472-
UpToDate = 1,
4473-
/**
4474-
* The project appears out of date because its upstream inputs are newer than its outputs,
4475-
* but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs.
4476-
* This means we can Pseudo-build (just touch timestamps), as if we had actually built this project.
4477-
*/
4478-
UpToDateWithUpstreamTypes = 2,
4479-
OutputMissing = 3,
4480-
OutOfDateWithSelf = 4,
4481-
OutOfDateWithUpstream = 5,
4482-
UpstreamOutOfDate = 6,
4483-
UpstreamBlocked = 7,
4484-
/**
4485-
* Projects with no outputs (i.e. "solution" files)
4486-
*/
4487-
ContainerOnly = 8
4488-
}
4489-
type UpToDateStatus = Status.Unbuildable | Status.UpToDate | Status.OutputMissing | Status.OutOfDateWithSelf | Status.OutOfDateWithUpstream | Status.UpstreamOutOfDate | Status.UpstreamBlocked | Status.ContainerOnly;
4490-
namespace Status {
4491-
/**
4492-
* The project can't be built at all in its current state. For example,
4493-
* its config file cannot be parsed, or it has a syntax error or missing file
4494-
*/
4495-
interface Unbuildable {
4496-
type: UpToDateStatusType.Unbuildable;
4497-
reason: string;
4498-
}
4499-
/**
4500-
* This project doesn't have any outputs, so "is it up to date" is a meaningless question.
4501-
*/
4502-
interface ContainerOnly {
4503-
type: UpToDateStatusType.ContainerOnly;
4504-
}
4505-
/**
4506-
* The project is up to date with respect to its inputs.
4507-
* We track what the newest input file is.
4508-
*/
4509-
interface UpToDate {
4510-
type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes;
4511-
newestInputFileTime?: Date;
4512-
newestInputFileName?: string;
4513-
newestDeclarationFileContentChangedTime?: Date;
4514-
newestOutputFileTime?: Date;
4515-
newestOutputFileName?: string;
4516-
oldestOutputFileName?: string;
4517-
}
4518-
/**
4519-
* One or more of the outputs of the project does not exist.
4520-
*/
4521-
interface OutputMissing {
4522-
type: UpToDateStatusType.OutputMissing;
4523-
/**
4524-
* The name of the first output file that didn't exist
4525-
*/
4526-
missingOutputFileName: string;
4527-
}
4528-
/**
4529-
* One or more of the project's outputs is older than its newest input.
4530-
*/
4531-
interface OutOfDateWithSelf {
4532-
type: UpToDateStatusType.OutOfDateWithSelf;
4533-
outOfDateOutputFileName: string;
4534-
newerInputFileName: string;
4535-
}
4536-
/**
4537-
* This project depends on an out-of-date project, so shouldn't be built yet
4538-
*/
4539-
interface UpstreamOutOfDate {
4540-
type: UpToDateStatusType.UpstreamOutOfDate;
4541-
upstreamProjectName: string;
4542-
}
4543-
/**
4544-
* This project depends an upstream project with build errors
4545-
*/
4546-
interface UpstreamBlocked {
4547-
type: UpToDateStatusType.UpstreamBlocked;
4548-
upstreamProjectName: string;
4549-
}
4550-
/**
4551-
* One or more of the project's outputs is older than the newest output of
4552-
* an upstream project.
4553-
*/
4554-
interface OutOfDateWithUpstream {
4555-
type: UpToDateStatusType.OutOfDateWithUpstream;
4556-
outOfDateOutputFileName: string;
4557-
newerProjectName: string;
4558-
}
4559-
}
4560-
interface FileMap<T> {
4561-
setValue(fileName: string, value: T): void;
4562-
getValue(fileName: string): T | never;
4563-
getValueOrUndefined(fileName: string): T | undefined;
4564-
hasKey(fileName: string): boolean;
4565-
removeKey(fileName: string): void;
4566-
getKeys(): string[];
4567-
}
4568-
function createDependencyMapper(): {
4569-
addReference: (childConfigFileName: ResolvedConfigFileName, parentConfigFileName: ResolvedConfigFileName) => void;
4570-
getReferencesTo: (parentConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[];
4571-
getReferencesOf: (childConfigFileName: ResolvedConfigFileName) => ResolvedConfigFileName[];
4572-
getKeys: () => ReadonlyArray<ResolvedConfigFileName>;
4573-
};
4574-
function createBuildContext(options: BuildOptions): BuildContext;
4575-
function performBuild(args: string[], compilerHost: CompilerHost, buildHost: BuildHost, system?: System): number | undefined;
4576-
/**
4577-
* A SolutionBuilder has an immutable set of rootNames that are the "entry point" projects, but
4578-
* can dynamically add/remove other projects based on changes on the rootNames' references
4579-
*/
4580-
function createSolutionBuilder(compilerHost: CompilerHost, buildHost: BuildHost, rootNames: ReadonlyArray<string>, defaultOptions: BuildOptions, system?: System): {
4581-
buildAllProjects: () => ExitStatus;
4582-
getUpToDateStatus: (project: ParsedCommandLine | undefined) => UpToDateStatus;
4583-
getUpToDateStatusOfFile: (configFileName: ResolvedConfigFileName) => UpToDateStatus;
4584-
cleanAllProjects: () => ExitStatus.Success | ExitStatus.DiagnosticsPresent_OutputsSkipped;
4585-
resetBuildContext: (opts?: BuildOptions) => void;
4586-
getBuildGraph: (configFileNames: ReadonlyArray<string>) => DependencyGraph | undefined;
4587-
invalidateProject: (configFileName: string) => void;
4588-
buildInvalidatedProjects: () => void;
4589-
buildDependentInvalidatedProjects: () => void;
4590-
resolveProjectName: (name: string) => ResolvedConfigFileName | undefined;
4591-
startWatching: () => void;
4592-
};
4593-
/**
4594-
* Gets the UpToDateStatus for a project
4595-
*/
4596-
function getUpToDateStatus(host: UpToDateHost, project: ParsedCommandLine | undefined): UpToDateStatus;
4597-
function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray<string>;
4598-
function formatUpToDateStatus<T>(configFileName: string, status: UpToDateStatus, relName: (fileName: string) => string, formatMessage: (message: DiagnosticMessage, ...args: string[]) => T): T | undefined;
4599-
}
46004418
declare namespace ts.server {
46014419
type ActionSet = "action::set";
46024420
type ActionInvalidate = "action::invalidate";

0 commit comments

Comments
 (0)