Add dts bundling

This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
This commit is contained in:
Jake Bailey
2022-09-02 16:39:54 -07:00
parent 4139807e75
commit c65142244c
57 changed files with 7850 additions and 7646 deletions

View File

@@ -28,7 +28,7 @@ import {
parseJsonSourceFileConfigFileContent, parseJsonText, parsePackageName, Path, PerformanceEvent, PluginImport,
PollingInterval, ProjectPackageJsonInfo, ProjectReference, ReadMapFile, ReadonlyCollection, removeFileExtension,
removeIgnoredPath, removeMinAndVersionNumbers, ResolvedProjectReference, resolveProjectReferencePath,
returnNoopFileWatcher, returnTrue, ScriptKind, Set, SharedExtendedConfigFileWatcher, some, SourceFile, startsWith,
returnNoopFileWatcher, returnTrue, ScriptKind, Set, SharedExtendedConfigFileWatcher, some, SourceFile, SourceFileLike, startsWith,
Ternary, TextChange, toFileNameLowerCase, toPath, tracing, tryAddToSet, tryReadFile, TsConfigSourceFile,
TypeAcquisition, typeAcquisitionDeclarations, unorderedRemoveItem, updateSharedExtendedConfigFileWatcher,
updateWatchingWildcardDirectories, UserPreferences, version, WatchDirectoryFlags, WatchFactory, WatchLogLevel,
@@ -397,7 +397,7 @@ function findProjectByName<T extends Project>(projectName: string, projects: T[]
const noopConfigFileWatcher: FileWatcher = { close: noop };
/** @internal */
interface ConfigFileExistenceInfo {
export interface ConfigFileExistenceInfo {
/**
* Cached value of existence of config file
* It is true if there is configured project open for this file.
@@ -2984,7 +2984,7 @@ export class ProjectService {
}
/** @internal */
getSourceFileLike(fileName: string, projectNameOrProject: string | Project, declarationInfo?: ScriptInfo) {
getSourceFileLike(fileName: string, projectNameOrProject: string | Project, declarationInfo?: ScriptInfo): SourceFileLike | undefined {
const project = (projectNameOrProject as Project).projectName ? projectNameOrProject as Project : this.findProject(projectNameOrProject as string);
if (project) {
const path = project.toPath(fileName);

View File

@@ -6,7 +6,8 @@ import { emptyArray, protocol } from "./_namespaces/ts.server";
const lineCollectionCapacity = 4;
interface LineCollection {
/** @internal */
export interface LineCollection {
charCount(): number;
lineCount(): number;
isLeaf(): this is LineLeaf;
@@ -19,7 +20,8 @@ export interface AbsolutePositionAndLineText {
lineText: string | undefined;
}
const enum CharRangeSection {
/** @internal */
export const enum CharRangeSection {
PreStart,
Start,
Entire,
@@ -28,7 +30,8 @@ const enum CharRangeSection {
PostEnd
}
interface LineIndexWalker {
/** @internal */
export interface LineIndexWalker {
goSubtree: boolean;
done: boolean;
leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void;
@@ -568,7 +571,8 @@ export class LineIndex {
}
}
class LineNode implements LineCollection {
/** @internal */
export class LineNode implements LineCollection {
totalChars = 0;
totalLines = 0;
@@ -819,7 +823,8 @@ class LineNode implements LineCollection {
}
}
class LineLeaf implements LineCollection {
/** @internal */
export class LineLeaf implements LineCollection {
constructor(public text: string) {
}