Skip to content

Commit 8885adb

Browse files
committed
CONVERSION STEP - stripNamespaces
1 parent 420bf65 commit 8885adb

File tree

555 files changed

+4206
-1153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

555 files changed

+4206
-1153
lines changed

Diff for: src/compiler/binder.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import * as ts from "./ts";
12

23
/* @internal */
3-
namespace ts {
44
export const enum ModuleInstanceState {
55
NonInstantiated = 0,
66
Instantiated = 1,
@@ -15,6 +15,7 @@ interface ActiveLabel {
1515
referenced: boolean;
1616
}
1717

18+
/* @internal */
1819
export function getModuleInstanceState(node: ts.ModuleDeclaration, visited?: ts.ESMap<number, ModuleInstanceState | undefined>): ModuleInstanceState {
1920
if (node.body && !node.body.parent) {
2021
// getModuleInstanceStateForAliasTarget needs to walk up the parent chain, so parent pointers must be set on this tree already
@@ -173,6 +174,7 @@ function initFlowNode<T extends ts.FlowNode>(node: T) {
173174

174175
const binder = createBinder();
175176

177+
/* @internal */
176178
export function bindSourceFile(file: ts.SourceFile, options: ts.CompilerOptions) {
177179
ts.performance.mark("beforeBind");
178180
ts.perfLogger.logStartBindFile("" + file.fileName);
@@ -3502,6 +3504,7 @@ function isPurelyTypeDeclaration(s: ts.Statement): boolean {
35023504
}
35033505
}
35043506

3507+
/* @internal */
35053508
export function isExportsOrModuleExportsOrAlias(sourceFile: ts.SourceFile, node: ts.Expression): boolean {
35063509
let i = 0;
35073510
const q = [node];
@@ -3536,4 +3539,3 @@ function lookupSymbolForName(container: ts.Node, name: ts.__String): ts.Symbol |
35363539
}
35373540
return container.symbol && container.symbol.exports && container.symbol.exports.get(name);
35383541
}
3539-
}

Diff for: src/compiler/builder.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/*@internal*/
2-
namespace ts {
1+
import * as ts from "./ts";
2+
3+
/* @internal */
34
export interface ReusableDiagnostic extends ReusableDiagnosticRelatedInformation {
45
/** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
56
reportsUnnecessary?: {};
@@ -9,6 +10,7 @@ export interface ReusableDiagnostic extends ReusableDiagnosticRelatedInformation
910
skippedOn?: keyof ts.CompilerOptions;
1011
}
1112

13+
/* @internal */
1214
export interface ReusableDiagnosticRelatedInformation {
1315
category: ts.DiagnosticCategory;
1416
code: number;
@@ -18,8 +20,10 @@ export interface ReusableDiagnosticRelatedInformation {
1820
messageText: string | ReusableDiagnosticMessageChain;
1921
}
2022

23+
/* @internal */
2124
export type ReusableDiagnosticMessageChain = ts.DiagnosticMessageChain;
2225

26+
/* @internal */
2327
export interface ReusableBuilderProgramState extends ts.ReusableBuilderState {
2428
/**
2529
* Cache of bind and check diagnostics for files with their Path being the key
@@ -76,11 +80,13 @@ export interface ReusableBuilderProgramState extends ts.ReusableBuilderState {
7680
hasReusableDiagnostic?: true;
7781
}
7882

83+
/* @internal */
7984
export const enum BuilderFileEmit {
8085
DtsOnly,
8186
Full
8287
}
8388

89+
/* @internal */
8490
/**
8591
* State to store the changed files, affected files and cache semantic diagnostics
8692
*/
@@ -773,11 +779,17 @@ function getBinderAndCheckerDiagnosticsOfFile(state: BuilderProgramState, source
773779
return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
774780
}
775781

782+
/* @internal */
776783
export type ProgramBuildInfoFileId = number & { __programBuildInfoFileIdBrand: any };
784+
/* @internal */
777785
export type ProgramBuildInfoFileIdListId = number & { __programBuildInfoFileIdListIdBrand: any };
786+
/* @internal */
778787
export type ProgramBuildInfoDiagnostic = ProgramBuildInfoFileId | [fileId: ProgramBuildInfoFileId, diagnostics: readonly ReusableDiagnostic[]];
788+
/* @internal */
779789
export type ProgramBuilderInfoFilePendingEmit = [fileId: ProgramBuildInfoFileId, emitKind: BuilderFileEmit];
790+
/* @internal */
780791
export type ProgramBuildInfoReferencedMap = [fileId: ProgramBuildInfoFileId, fileIdListId: ProgramBuildInfoFileIdListId][];
792+
/* @internal */
781793
export type ProgramBuildInfoBuilderStateFileInfo = Omit<ts.BuilderState.FileInfo, "signature"> & {
782794
/**
783795
* Signature is
@@ -787,10 +799,12 @@ export type ProgramBuildInfoBuilderStateFileInfo = Omit<ts.BuilderState.FileInfo
787799
*/
788800
signature: string | false | undefined;
789801
};
802+
/* @internal */
790803
/**
791804
* ProgramBuildInfoFileInfo is string if FileInfo.version === FileInfo.signature && !FileInfo.affectsGlobalScope otherwise encoded FileInfo
792805
*/
793806
export type ProgramBuildInfoFileInfo = string | ProgramBuildInfoBuilderStateFileInfo;
807+
/* @internal */
794808
export interface ProgramBuildInfo {
795809
fileNames: readonly string[];
796810
fileInfos: readonly ProgramBuildInfoFileInfo[];
@@ -993,18 +1007,21 @@ function convertToReusableDiagnosticRelatedInformation(diagnostic: ts.Diagnostic
9931007
};
9941008
}
9951009

1010+
/* @internal */
9961011
export enum BuilderProgramKind {
9971012
SemanticDiagnosticsBuilderProgram,
9981013
EmitAndSemanticDiagnosticsBuilderProgram
9991014
}
10001015

1016+
/* @internal */
10011017
export interface BuilderCreationParameters {
10021018
newProgram: ts.Program;
10031019
host: ts.BuilderProgramHost;
10041020
oldProgram: ts.BuilderProgram | undefined;
10051021
configFileParsingDiagnostics: readonly ts.Diagnostic[];
10061022
}
10071023

1024+
/* @internal */
10081025
export function getBuilderCreationParameters(newProgramOrRootNames: ts.Program | readonly string[] | undefined, hostOrOptions: ts.BuilderProgramHost | ts.CompilerOptions | undefined, oldProgramOrHost?: ts.BuilderProgram | ts.CompilerHost, configFileParsingDiagnosticsOrOldProgram?: readonly ts.Diagnostic[] | ts.BuilderProgram, configFileParsingDiagnostics?: readonly ts.Diagnostic[], projectReferences?: readonly ts.ProjectReference[]): BuilderCreationParameters {
10091026
let host: ts.BuilderProgramHost;
10101027
let newProgram: ts.Program;
@@ -1037,8 +1054,11 @@ export function getBuilderCreationParameters(newProgramOrRootNames: ts.Program |
10371054
return { host, newProgram, oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
10381055
}
10391056

1057+
/* @internal */
10401058
export function createBuilderProgram(kind: BuilderProgramKind.SemanticDiagnosticsBuilderProgram, builderCreationParameters: BuilderCreationParameters): ts.SemanticDiagnosticsBuilderProgram;
1059+
/* @internal */
10411060
export function createBuilderProgram(kind: BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram, builderCreationParameters: BuilderCreationParameters): ts.EmitAndSemanticDiagnosticsBuilderProgram;
1061+
/* @internal */
10421062
export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, host, oldProgram, configFileParsingDiagnostics }: BuilderCreationParameters) {
10431063
// Return same program if underlying program doesnt change
10441064
let oldState = oldProgram && oldProgram.getState();
@@ -1351,6 +1371,7 @@ function addToAffectedFilesPendingEmit(state: BuilderProgramState, affectedFileP
13511371
}
13521372
}
13531373

1374+
/* @internal */
13541375
export function toBuilderStateFileInfo(fileInfo: ProgramBuildInfoFileInfo): ts.BuilderState.FileInfo {
13551376
return ts.isString(fileInfo) ?
13561377
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined, impliedFormat: undefined } :
@@ -1359,6 +1380,7 @@ export function toBuilderStateFileInfo(fileInfo: ProgramBuildInfoFileInfo): ts.B
13591380
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
13601381
}
13611382

1383+
/* @internal */
13621384
export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInfo, buildInfoPath: string, host: ts.ReadBuildProgramHost): ts.EmitAndSemanticDiagnosticsBuilderProgram {
13631385
const buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
13641386
const getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
@@ -1432,6 +1454,7 @@ export function createBuildProgramUsingProgramBuildInfo(program: ProgramBuildInf
14321454
}
14331455
}
14341456

1457+
/* @internal */
14351458
export function createRedirectedBuilderProgram(getState: () => { program: ts.Program | undefined; compilerOptions: ts.CompilerOptions; }, configFileParsingDiagnostics: readonly ts.Diagnostic[]): ts.BuilderProgram {
14361459
return {
14371460
getState: ts.notImplemented,
@@ -1460,4 +1483,3 @@ export function createRedirectedBuilderProgram(getState: () => { program: ts.Pro
14601483
return ts.Debug.checkDefined(getState().program);
14611484
}
14621485
}
1463-
}

Diff for: src/compiler/builderPublic.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace ts {
1+
import * as ts from "./ts";
2+
23
export type AffectedFileResult<T> = { result: T; affected: ts.SourceFile | ts.Program; } | undefined;
34

45
export interface BuilderProgramHost {
@@ -171,4 +172,3 @@ export function createAbstractBuilder(newProgramOrRootNames: ts.Program | readon
171172
const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = ts.getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences);
172173
return ts.createRedirectedBuilderProgram(() => ({ program: newProgram, compilerOptions: newProgram.getCompilerOptions() }), newConfigFileParsingDiagnostics);
173174
}
174-
}

Diff for: src/compiler/builderState.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/*@internal*/
2-
namespace ts {
1+
import * as ts from "./ts";
2+
3+
/* @internal */
34
export function getFileEmitOutput(program: ts.Program, sourceFile: ts.SourceFile, emitOnlyDtsFiles: boolean,
45
cancellationToken?: ts.CancellationToken, customTransformers?: ts.CustomTransformers, forceDtsEmit?: boolean): ts.EmitOutput {
56
const outputFiles: ts.OutputFile[] = [];
@@ -11,6 +12,7 @@ export function getFileEmitOutput(program: ts.Program, sourceFile: ts.SourceFile
1112
}
1213
}
1314

15+
/* @internal */
1416
export interface ReusableBuilderState {
1517
/**
1618
* Information of the file eg. its version, signature etc
@@ -29,6 +31,7 @@ export interface ReusableBuilderState {
2931
readonly exportedModulesMap?: BuilderState.ReadonlyManyToManyPathMap | undefined;
3032
}
3133

34+
/* @internal */
3235
export interface BuilderState {
3336
/**
3437
* Information of the file eg. its version, signature etc
@@ -69,6 +72,7 @@ export interface BuilderState {
6972
allFileNames?: readonly string[];
7073
}
7174

75+
/* @internal */
7276
export namespace BuilderState {
7377
/**
7478
* Information about the source file: Its version and optional signature from last emit
@@ -647,4 +651,3 @@ export namespace BuilderState {
647651
return ts.arrayFrom(ts.mapDefinedIterator(seenFileNamesMap.values(), value => value));
648652
}
649653
}
650-
}

Diff for: src/compiler/builderStatePublic.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace ts {
1+
import * as ts from "./ts";
2+
23
export interface EmitOutput {
34
outputFiles: OutputFile[];
45
emitSkipped: boolean;
@@ -11,4 +12,3 @@ export interface OutputFile {
1112
writeByteOrderMark: boolean;
1213
text: string;
1314
}
14-
}

Diff for: src/compiler/checker.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* @internal */
2-
namespace ts {
1+
import * as ts from "./ts";
2+
33
const ambientModuleSymbolRegex = /^".+"$/;
44
const anon = "(anonymous)" as ts.__String & string;
55

@@ -284,6 +284,7 @@ function NodeLinks(this: ts.NodeLinks) {
284284
this.flags = 0;
285285
}
286286

287+
/* @internal */
287288
export function getNodeId(node: ts.Node): number {
288289
if (!node.id) {
289290
node.id = nextNodeId;
@@ -292,6 +293,7 @@ export function getNodeId(node: ts.Node): number {
292293
return node.id;
293294
}
294295

296+
/* @internal */
295297
export function getSymbolId(symbol: ts.Symbol): ts.SymbolId {
296298
if (!symbol.id) {
297299
symbol.id = nextSymbolId;
@@ -301,12 +303,14 @@ export function getSymbolId(symbol: ts.Symbol): ts.SymbolId {
301303
return symbol.id;
302304
}
303305

306+
/* @internal */
304307
export function isInstantiatedModule(node: ts.ModuleDeclaration, preserveConstEnums: boolean) {
305308
const moduleState = ts.getModuleInstanceState(node);
306309
return moduleState === ts.ModuleInstanceState.Instantiated ||
307310
(preserveConstEnums && moduleState === ts.ModuleInstanceState.ConstEnumOnly);
308311
}
309312

313+
/* @internal */
310314
export function createTypeChecker(host: ts.TypeCheckerHost): ts.TypeChecker {
311315
const getPackagesMap = ts.memoize(() => {
312316
// A package name maps to true when we detect it has .d.ts files.
@@ -45226,11 +45230,12 @@ function getIterationTypesKeyFromIterationTypeKind(typeKind: IterationTypeKind)
4522645230
}
4522745231
}
4522845232

45233+
/* @internal */
4522945234
export function signatureHasRestParameter(s: ts.Signature) {
4523045235
return !!(s.flags & ts.SignatureFlags.HasRestParameter);
4523145236
}
4523245237

45238+
/* @internal */
4523345239
export function signatureHasLiteralTypes(s: ts.Signature) {
4523445240
return !!(s.flags & ts.SignatureFlags.HasLiteralTypes);
4523545241
}
45236-
}

Diff for: src/compiler/commandLineParser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace ts {
1+
import * as ts from "./ts";
2+
23
/* @internal */
34
export const compileOnSaveCommandLineOption: ts.CommandLineOption = {
45
name: "compileOnSave",
@@ -3666,4 +3667,3 @@ function getDefaultValueForOption(option: ts.CommandLineOption) {
36663667
return ts.Debug.fail("Expected 'option.type' to have entries.");
36673668
}
36683669
}
3669-
}

0 commit comments

Comments
 (0)