Skip to content

Commit

Permalink
Export executeCommandLine from public API (internal for now) (#58057)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey authored Apr 4, 2024
1 parent 84eff8f commit 5144b3e
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/compiler/_namespaces/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export * from "../watch";
export * from "../watchPublic";
export * from "../tsbuild";
export * from "../tsbuildPublic";
export * from "../executeCommandLine";
import * as moduleSpecifiers from "./ts.moduleSpecifiers";
export { moduleSpecifiers };
import * as performance from "./ts.performance";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as performance from "../compiler/performance";
import {
arrayFrom,
BuilderProgram,
Expand Down Expand Up @@ -85,15 +84,18 @@ import {
validateLocaleAndSetLanguage,
version,
WatchCompilerHost,
WatchOfConfigFile,
WatchOptions,
} from "./_namespaces/ts";
import * as performance from "./performance";

interface Statistic {
name: string;
value: number;
type: StatisticType;
}

/** @internal */
export enum StatisticType {
time,
count,
Expand Down Expand Up @@ -730,6 +732,7 @@ function executeCommandLineWorker(
}
}

/** @internal */
export function isBuild(commandLineArgs: readonly string[]) {
if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === CharacterCodes.minus) {
const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === CharacterCodes.minus ? 2 : 1).toLowerCase();
Expand All @@ -738,12 +741,14 @@ export function isBuild(commandLineArgs: readonly string[]) {
return false;
}

/** @internal */
export type ExecuteCommandLineCallbacks = (program: Program | BuilderProgram | ParsedCommandLine) => void;
/** @internal */
export function executeCommandLine(
system: System,
cb: ExecuteCommandLineCallbacks,
commandLineArgs: readonly string[],
) {
): void | SolutionBuilder<EmitAndSemanticDiagnosticsBuilderProgram> | WatchOfConfigFile<EmitAndSemanticDiagnosticsBuilderProgram> {
if (isBuild(commandLineArgs)) {
const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1));
if (buildOptions.generateCpuProfile && system.enableCPUProfiler) {
Expand Down
4 changes: 0 additions & 4 deletions src/executeCommandLine/_namespaces/ts.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/executeCommandLine/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion src/testRunner/_namespaces/ts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Generated file to emulate the ts namespace. */

export * from "../../compiler/_namespaces/ts";
export * from "../../executeCommandLine/_namespaces/ts";
export * from "../../services/_namespaces/ts";
export * from "../../jsTyping/_namespaces/ts";
export * from "../../server/_namespaces/ts";
Expand Down
1 change: 0 additions & 1 deletion src/testRunner/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"references": [
{ "path": "../compiler" },
{ "path": "../executeCommandLine" },
{ "path": "../services" },
{ "path": "../jsTyping" },
{ "path": "../server" },
Expand Down
1 change: 0 additions & 1 deletion src/tsc/_namespaces/ts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* Generated file to emulate the ts namespace. */

export * from "../../compiler/_namespaces/ts";
export * from "../../executeCommandLine/_namespaces/ts";
3 changes: 1 addition & 2 deletions src/tsc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
},
"references": [
{ "path": "../compiler" },
{ "path": "../executeCommandLine" }
{ "path": "../compiler" }
],
"include": ["**/*"]
}
1 change: 0 additions & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{ "path": "./cancellationToken" },
{ "path": "./compiler" },
{ "path": "./deprecatedCompat" },
{ "path": "./executeCommandLine" },
{ "path": "./harness" },
{ "path": "./jsTyping" },
{ "path": "./server" },
Expand Down

0 comments on commit 5144b3e

Please sign in to comment.