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

Export executeCommandLine from public API (internal for now) #58057

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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