mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 10:29:01 -06:00
Stop generating sectional sourcemaps (#24917)
* Generate normal 1-part sourcemaps (at increased processing cost), since tools dislike sectional ones * Add semicolon * Accept sad baselines] * Forward along sourcesContent if available * Supress lint since the API actually calls for null here * Fix concatenated sourcemap paths * Accept bad baselines :( * Add overloads * Accept api update * Fix lint
This commit is contained in:
parent
bb9e0594e4
commit
2a1503610b
@ -2587,18 +2587,41 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createUnparsedSourceFile(text: string, map?: string): UnparsedSource {
|
||||
export function createUnparsedSourceFile(text: string): UnparsedSource;
|
||||
export function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
|
||||
export function createUnparsedSourceFile(text: string, mapPath?: string, map?: string): UnparsedSource {
|
||||
const node = <UnparsedSource>createNode(SyntaxKind.UnparsedSource);
|
||||
node.text = text;
|
||||
node.sourceMapPath = mapPath;
|
||||
node.sourceMapText = map;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createInputFiles(javascript: string, declaration: string, javascriptMapText?: string, declarationMapText?: string): InputFiles {
|
||||
export function createInputFiles(
|
||||
javascript: string,
|
||||
declaration: string
|
||||
): InputFiles;
|
||||
export function createInputFiles(
|
||||
javascript: string,
|
||||
declaration: string,
|
||||
javascriptMapPath: string | undefined,
|
||||
javascriptMapText: string | undefined,
|
||||
declarationMapPath: string | undefined,
|
||||
declarationMapText: string | undefined
|
||||
): InputFiles;
|
||||
export function createInputFiles(
|
||||
javascript: string,
|
||||
declaration: string,
|
||||
javascriptMapPath?: string,
|
||||
javascriptMapText?: string,
|
||||
declarationMapPath?: string,
|
||||
declarationMapText?: string
|
||||
): InputFiles {
|
||||
const node = <InputFiles>createNode(SyntaxKind.InputFiles);
|
||||
node.javascriptText = javascript;
|
||||
node.javascriptMapPath = javascriptMapPath;
|
||||
node.javascriptMapText = javascriptMapText;
|
||||
node.declarationText = declaration;
|
||||
node.declarationMapPath = declarationMapPath;
|
||||
node.declarationMapText = declarationMapText;
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -1240,10 +1240,12 @@ namespace ts {
|
||||
|
||||
const dtsFilename = changeExtension(resolvedRefOpts.options.outFile, ".d.ts");
|
||||
const js = host.readFile(resolvedRefOpts.options.outFile) || `/* Input file ${resolvedRefOpts.options.outFile} was missing */\r\n`;
|
||||
const jsMap = host.readFile(resolvedRefOpts.options.outFile + ".map"); // TODO: try to read sourceMappingUrl comment from the js file
|
||||
const jsMapPath = resolvedRefOpts.options.outFile + ".map"; // TODO: try to read sourceMappingUrl comment from the file
|
||||
const jsMap = host.readFile(jsMapPath);
|
||||
const dts = host.readFile(dtsFilename) || `/* Input file ${dtsFilename} was missing */\r\n`;
|
||||
const dtsMap = host.readFile(dtsFilename + ".map");
|
||||
const node = createInputFiles(js, dts, jsMap, dtsMap);
|
||||
const dtsMapPath = dtsFilename + ".map";
|
||||
const dtsMap = host.readFile(dtsMapPath);
|
||||
const node = createInputFiles(js, dts, jsMap && jsMapPath, jsMap, dtsMap && dtsMapPath, dtsMap);
|
||||
nodes.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,10 +99,6 @@ namespace ts {
|
||||
let sourceMapDataList: SourceMapData[] | undefined;
|
||||
let disabled: boolean = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap);
|
||||
|
||||
let completedSections: SourceMapSectionDefinition[];
|
||||
let sectionStartLine: number;
|
||||
let sectionStartColumn: number;
|
||||
|
||||
return {
|
||||
initialize,
|
||||
reset,
|
||||
@ -150,9 +146,6 @@ namespace ts {
|
||||
lastEncodedNameIndex = 0;
|
||||
|
||||
// Initialize source map data
|
||||
completedSections = [];
|
||||
sectionStartLine = 1;
|
||||
sectionStartColumn = 1;
|
||||
sourceMapData = {
|
||||
sourceMapFilePath,
|
||||
jsSourceMappingURL: !compilerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined!, // TODO: GH#18217
|
||||
@ -221,9 +214,6 @@ namespace ts {
|
||||
lastEncodedNameIndex = undefined;
|
||||
sourceMapData = undefined!;
|
||||
sourceMapDataList = undefined!;
|
||||
completedSections = undefined!;
|
||||
sectionStartLine = undefined!;
|
||||
sectionStartColumn = undefined!;
|
||||
}
|
||||
|
||||
interface SourceMapSection {
|
||||
@ -233,7 +223,7 @@ namespace ts {
|
||||
sources: string[];
|
||||
names?: string[];
|
||||
mappings: string;
|
||||
sourcesContent?: string[];
|
||||
sourcesContent?: (string | null)[];
|
||||
sections?: undefined;
|
||||
}
|
||||
|
||||
@ -261,26 +251,6 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
function resetSectionalData(): void {
|
||||
sourceMapData.sourceMapSources = [];
|
||||
sourceMapData.sourceMapNames = [];
|
||||
sourceMapData.sourceMapMappings = "";
|
||||
sourceMapData.sourceMapSourcesContent = compilerOptions.inlineSources ? [] : undefined;
|
||||
}
|
||||
|
||||
function generateMap(): SourceMap {
|
||||
if (completedSections.length) {
|
||||
captureSectionalSpanIfNeeded(/*reset*/ false);
|
||||
return {
|
||||
version: 3,
|
||||
file: sourceMapData.sourceMapFile,
|
||||
sections: completedSections
|
||||
};
|
||||
}
|
||||
else {
|
||||
return captureSection();
|
||||
}
|
||||
}
|
||||
|
||||
// Encoding for sourcemap span
|
||||
function encodeLastRecordedSourceMapSpan() {
|
||||
@ -350,8 +320,8 @@ namespace ts {
|
||||
sourceLinePos.line++;
|
||||
sourceLinePos.character++;
|
||||
|
||||
const emittedLine = writer.getLine() - sectionStartLine + 1;
|
||||
const emittedColumn = emittedLine === 0 ? (writer.getColumn() - sectionStartColumn + 1) : writer.getColumn();
|
||||
const emittedLine = writer.getLine();
|
||||
const emittedColumn = writer.getColumn();
|
||||
|
||||
// If this location wasn't recorded or the location in source is going backwards, record the span
|
||||
if (!lastRecordedSourceMapSpan ||
|
||||
@ -386,13 +356,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function captureSectionalSpanIfNeeded(reset: boolean) {
|
||||
if (lastRecordedSourceMapSpan && lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { // If we've recorded some spans, save them
|
||||
completedSections.push({ offset: { line: sectionStartLine - 1, column: sectionStartColumn - 1 }, map: captureSection() });
|
||||
if (reset) {
|
||||
resetSectionalData();
|
||||
}
|
||||
}
|
||||
function isPossiblySourceMap(x: {}): x is SourceMapSection {
|
||||
return typeof x === "object" && !!(x as any).mappings && typeof (x as any).mappings === "string" && !!(x as any).sources;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,7 +374,6 @@ namespace ts {
|
||||
|
||||
if (node) {
|
||||
if (isUnparsedSource(node) && node.sourceMapText !== undefined) {
|
||||
captureSectionalSpanIfNeeded(/*reset*/ true);
|
||||
const text = node.sourceMapText;
|
||||
let parsed: {} | undefined;
|
||||
try {
|
||||
@ -418,24 +382,41 @@ namespace ts {
|
||||
catch {
|
||||
// empty
|
||||
}
|
||||
const offset = { line: writer.getLine() - 1, column: writer.getColumn() - 1 };
|
||||
completedSections.push(parsed
|
||||
? {
|
||||
offset,
|
||||
map: parsed as SourceMap
|
||||
}
|
||||
: {
|
||||
offset,
|
||||
// This is just passes the buck on sourcemaps we don't really understand, instead of issuing an error (which would be difficult this late)
|
||||
url: `data:application/json;charset=utf-8;base64,${base64encode(sys, text)}`
|
||||
}
|
||||
);
|
||||
const emitResult = emitCallback(hint, node);
|
||||
sectionStartLine = writer.getLine();
|
||||
sectionStartColumn = writer.getColumn();
|
||||
lastRecordedSourceMapSpan = undefined!;
|
||||
lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan;
|
||||
return emitResult;
|
||||
if (!parsed || !isPossiblySourceMap(parsed)) {
|
||||
return emitCallback(hint, node);
|
||||
}
|
||||
const offsetLine = writer.getLine();
|
||||
const firstLineColumnOffset = writer.getColumn();
|
||||
// First, decode the old component sourcemap
|
||||
const originalMap = parsed;
|
||||
sourcemaps.calculateDecodedMappings(originalMap, (raw): void => {
|
||||
// Apply offsets to each position and fixup source entries
|
||||
const rawPath = originalMap.sources[raw.sourceIndex];
|
||||
const relativePath = originalMap.sourceRoot ? combinePaths(originalMap.sourceRoot, rawPath) : rawPath;
|
||||
const combinedPath = combinePaths(getDirectoryPath(node.sourceMapPath!), relativePath);
|
||||
const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
|
||||
const resolvedPath = getRelativePathToDirectoryOrUrl(
|
||||
sourcesDirectoryPath,
|
||||
combinedPath,
|
||||
host.getCurrentDirectory(),
|
||||
host.getCanonicalFileName,
|
||||
/*isAbsolutePathAnUrl*/ true
|
||||
);
|
||||
const absolutePath = toPath(resolvedPath, sourcesDirectoryPath, host.getCanonicalFileName);
|
||||
// tslint:disable-next-line:no-null-keyword
|
||||
setupSourceEntry(absolutePath, originalMap.sourcesContent ? originalMap.sourcesContent[raw.sourceIndex] : null); // TODO: Lookup content for inlining?
|
||||
const newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath);
|
||||
// Then reencode all the updated spans into the overall map
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
lastRecordedSourceMapSpan = {
|
||||
...raw,
|
||||
emittedLine: raw.emittedLine + offsetLine - 1,
|
||||
emittedColumn: raw.emittedLine === 0 ? (raw.emittedColumn + firstLineColumnOffset - 1) : raw.emittedColumn,
|
||||
sourceIndex: newIndex,
|
||||
};
|
||||
});
|
||||
// And actually emit the text these sourcemaps are for
|
||||
return emitCallback(hint, node);
|
||||
}
|
||||
const emitNode = node.emitNode;
|
||||
const emitFlags = emitNode && emitNode.flags || EmitFlags.None;
|
||||
@ -529,13 +510,17 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
setupSourceEntry(sourceFile.fileName, sourceFile.text);
|
||||
}
|
||||
|
||||
function setupSourceEntry(fileName: string, content: string | null) {
|
||||
// Add the file to tsFilePaths
|
||||
// If sourceroot option: Use the relative path corresponding to the common directory path
|
||||
// otherwise source locations relative to map file location
|
||||
const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
|
||||
|
||||
const source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath,
|
||||
currentSource.fileName,
|
||||
fileName,
|
||||
host.getCurrentDirectory(),
|
||||
host.getCanonicalFileName,
|
||||
/*isAbsolutePathAnUrl*/ true);
|
||||
@ -546,10 +531,10 @@ namespace ts {
|
||||
sourceMapData.sourceMapSources.push(source);
|
||||
|
||||
// The one that can be used from program to get the actual source file
|
||||
sourceMapData.inputSourceFileNames.push(currentSource.fileName);
|
||||
sourceMapData.inputSourceFileNames.push(fileName);
|
||||
|
||||
if (compilerOptions.inlineSources) {
|
||||
sourceMapData.sourceMapSourcesContent!.push(currentSource.text);
|
||||
sourceMapData.sourceMapSourcesContent!.push(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -564,7 +549,7 @@ namespace ts {
|
||||
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
return JSON.stringify(generateMap());
|
||||
return JSON.stringify(captureSection());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
export interface SourceFileLikeCache {
|
||||
get(path: Path): SourceFileLike | undefined;
|
||||
}
|
||||
|
||||
export function createSourceFileLikeCache(host: { readFile?: (path: string) => string | undefined, fileExists?: (path: string) => boolean }): SourceFileLikeCache {
|
||||
const cached = createMap<SourceFileLike>();
|
||||
return {
|
||||
get(path: Path) {
|
||||
if (cached.has(path)) {
|
||||
return cached.get(path);
|
||||
}
|
||||
if (!host.fileExists || !host.readFile || !host.fileExists(path)) return;
|
||||
// And failing that, check the disk
|
||||
const text = host.readFile(path)!; // TODO: GH#18217
|
||||
const file = {
|
||||
text,
|
||||
lineMap: undefined,
|
||||
getLineAndCharacterOfPosition(pos: number) {
|
||||
return computeLineAndCharacterOfPosition(getLineStarts(this), pos);
|
||||
}
|
||||
} as SourceFileLike;
|
||||
cached.set(path, file);
|
||||
return file;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
namespace ts.sourcemaps {
|
||||
export interface SourceMapData {
|
||||
@ -5,7 +35,7 @@ namespace ts.sourcemaps {
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
sources: string[];
|
||||
sourcesContent?: string[];
|
||||
sourcesContent?: (string | null)[];
|
||||
names?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
@ -86,7 +116,7 @@ namespace ts.sourcemaps {
|
||||
}
|
||||
|
||||
function getDecodedMappings() {
|
||||
return decodedMappings || (decodedMappings = calculateDecodedMappings());
|
||||
return decodedMappings || (decodedMappings = calculateDecodedMappings(map, processPosition, host));
|
||||
}
|
||||
|
||||
function getSourceOrderedMappings() {
|
||||
@ -97,30 +127,6 @@ namespace ts.sourcemaps {
|
||||
return generatedOrderedMappings || (generatedOrderedMappings = getDecodedMappings().slice().sort(compareProcessedPositionEmittedPositions));
|
||||
}
|
||||
|
||||
function calculateDecodedMappings(): ProcessedSourceMapPosition[] {
|
||||
const state: DecoderState<ProcessedSourceMapPosition> = {
|
||||
encodedText: map.mappings,
|
||||
currentNameIndex: undefined,
|
||||
sourceMapNamesLength: map.names ? map.names.length : undefined,
|
||||
currentEmittedColumn: 0,
|
||||
currentEmittedLine: 0,
|
||||
currentSourceColumn: 0,
|
||||
currentSourceLine: 0,
|
||||
currentSourceIndex: 0,
|
||||
positions: [],
|
||||
decodingIndex: 0,
|
||||
processPosition,
|
||||
};
|
||||
while (!hasCompletedDecoding(state)) {
|
||||
decodeSinglePosition(state);
|
||||
if (state.error) {
|
||||
host.log(`Encountered error while decoding sourcemap found at ${mapPath}: ${state.error}`);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return state.positions;
|
||||
}
|
||||
|
||||
function compareProcessedPositionSourcePositions(a: ProcessedSourceMapPosition, b: ProcessedSourceMapPosition) {
|
||||
return comparePaths(a.sourcePath, b.sourcePath, sourceRoot) ||
|
||||
compareValues(a.sourcePosition, b.sourcePosition);
|
||||
@ -142,6 +148,32 @@ namespace ts.sourcemaps {
|
||||
}
|
||||
}
|
||||
|
||||
export function calculateDecodedMappings<T>(map: SourceMapData, processPosition: (position: RawSourceMapPosition) => T, host?: { log?(s: string): void }): T[] {
|
||||
const state: DecoderState<T> = {
|
||||
encodedText: map.mappings,
|
||||
currentNameIndex: undefined,
|
||||
sourceMapNamesLength: map.names ? map.names.length : undefined,
|
||||
currentEmittedColumn: 0,
|
||||
currentEmittedLine: 0,
|
||||
currentSourceColumn: 0,
|
||||
currentSourceLine: 0,
|
||||
currentSourceIndex: 0,
|
||||
positions: [],
|
||||
decodingIndex: 0,
|
||||
processPosition,
|
||||
};
|
||||
while (!hasCompletedDecoding(state)) {
|
||||
decodeSinglePosition(state);
|
||||
if (state.error) {
|
||||
if (host && host.log) {
|
||||
host.log(`Encountered error while decoding sourcemap: ${state.error}`);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return state.positions;
|
||||
}
|
||||
|
||||
interface ProcessedSourceMapPosition {
|
||||
emittedPosition: number;
|
||||
sourcePosition: number;
|
||||
@ -180,7 +180,7 @@ namespace ts {
|
||||
}
|
||||
), mapDefined(node.prepends, prepend => {
|
||||
if (prepend.kind === SyntaxKind.InputFiles) {
|
||||
return createUnparsedSourceFile(prepend.declarationText, prepend.declarationMapText);
|
||||
return createUnparsedSourceFile(prepend.declarationText, prepend.declarationMapPath, prepend.declarationMapText);
|
||||
}
|
||||
}));
|
||||
bundle.syntheticFileReferences = [];
|
||||
|
||||
@ -100,7 +100,7 @@ namespace ts {
|
||||
function transformBundle(node: Bundle) {
|
||||
return createBundle(node.sourceFiles.map(transformSourceFile), mapDefined(node.prepends, prepend => {
|
||||
if (prepend.kind === SyntaxKind.InputFiles) {
|
||||
return createUnparsedSourceFile(prepend.javascriptText, prepend.javascriptMapText);
|
||||
return createUnparsedSourceFile(prepend.javascriptText, prepend.javascriptMapPath, prepend.javascriptMapText);
|
||||
}
|
||||
return prepend;
|
||||
}));
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
"checker.ts",
|
||||
"factory.ts",
|
||||
"visitor.ts",
|
||||
"sourcemapDecoder.ts",
|
||||
"transformers/utilities.ts",
|
||||
"transformers/destructuring.ts",
|
||||
"transformers/ts.ts",
|
||||
|
||||
@ -2615,14 +2615,17 @@ namespace ts {
|
||||
export interface InputFiles extends Node {
|
||||
kind: SyntaxKind.InputFiles;
|
||||
javascriptText: string;
|
||||
javascriptMapPath?: string;
|
||||
javascriptMapText?: string;
|
||||
declarationText: string;
|
||||
declarationMapPath?: string;
|
||||
declarationMapText?: string;
|
||||
}
|
||||
|
||||
export interface UnparsedSource extends Node {
|
||||
kind: SyntaxKind.UnparsedSource;
|
||||
text: string;
|
||||
sourceMapPath?: string;
|
||||
sourceMapText?: string;
|
||||
}
|
||||
|
||||
@ -2807,7 +2810,7 @@ namespace ts {
|
||||
sourceMapFile: string; // Source map's file field - .js file name
|
||||
sourceMapSourceRoot: string; // Source map's sourceRoot field - location where the sources will be present if not ""
|
||||
sourceMapSources: string[]; // Source map's sources field - list of sources that can be indexed in this source map
|
||||
sourceMapSourcesContent?: string[]; // Source map's sourcesContent field - list of the sources' text to be embedded in the source map
|
||||
sourceMapSourcesContent?: (string | null)[]; // Source map's sourcesContent field - list of the sources' text to be embedded in the source map
|
||||
inputSourceFileNames: string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMapSources list
|
||||
sourceMapNames?: string[]; // Source map's names field - list of names that can be indexed in this source map
|
||||
sourceMapMappings: string; // Source map's mapping field - encoded source map spans
|
||||
|
||||
@ -1111,35 +1111,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface SourceFileLikeCache {
|
||||
get(path: Path): SourceFileLike | undefined;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function createSourceFileLikeCache(host: { readFile?: (path: string) => string | undefined, fileExists?: (path: string) => boolean }): SourceFileLikeCache {
|
||||
const cached = createMap<SourceFileLike>();
|
||||
return {
|
||||
get(path: Path) {
|
||||
if (cached.has(path)) {
|
||||
return cached.get(path);
|
||||
}
|
||||
if (!host.fileExists || !host.readFile || !host.fileExists(path)) return;
|
||||
// And failing that, check the disk
|
||||
const text = host.readFile(path)!; // TODO: GH#18217
|
||||
const file: SourceFileLike = {
|
||||
text,
|
||||
lineMap: undefined,
|
||||
getLineAndCharacterOfPosition(pos) {
|
||||
return computeLineAndCharacterOfPosition(getLineStarts(this), pos);
|
||||
}
|
||||
};
|
||||
cached.set(path, file);
|
||||
return file;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function createLanguageService(
|
||||
host: LanguageServiceHost,
|
||||
documentRegistry: DocumentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()),
|
||||
|
||||
@ -78,7 +78,6 @@
|
||||
"refactors/generateGetAccessorAndSetAccessor.ts",
|
||||
"refactors/moveToNewFile.ts",
|
||||
"refactors/addOrRemoveBracesToArrowFunction.ts",
|
||||
"sourcemaps.ts",
|
||||
"services.ts",
|
||||
"breakpoints.ts",
|
||||
"transform.ts",
|
||||
|
||||
@ -2380,13 +2380,16 @@ declare namespace ts {
|
||||
interface InputFiles extends Node {
|
||||
kind: SyntaxKind.InputFiles;
|
||||
javascriptText: string;
|
||||
javascriptMapPath?: string;
|
||||
javascriptMapText?: string;
|
||||
declarationText: string;
|
||||
declarationMapPath?: string;
|
||||
declarationMapText?: string;
|
||||
}
|
||||
interface UnparsedSource extends Node {
|
||||
kind: SyntaxKind.UnparsedSource;
|
||||
text: string;
|
||||
sourceMapPath?: string;
|
||||
sourceMapText?: string;
|
||||
}
|
||||
interface JsonSourceFile extends SourceFile {
|
||||
@ -2525,7 +2528,7 @@ declare namespace ts {
|
||||
sourceMapFile: string;
|
||||
sourceMapSourceRoot: string;
|
||||
sourceMapSources: string[];
|
||||
sourceMapSourcesContent?: string[];
|
||||
sourceMapSourcesContent?: (string | null)[];
|
||||
inputSourceFileNames: string[];
|
||||
sourceMapNames?: string[];
|
||||
sourceMapMappings: string;
|
||||
@ -8013,8 +8016,10 @@ declare namespace ts {
|
||||
function createCommaList(elements: ReadonlyArray<Expression>): CommaListExpression;
|
||||
function updateCommaList(node: CommaListExpression, elements: ReadonlyArray<Expression>): CommaListExpression;
|
||||
function createBundle(sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
|
||||
function createUnparsedSourceFile(text: string, map?: string): UnparsedSource;
|
||||
function createInputFiles(javascript: string, declaration: string, javascriptMapText?: string, declarationMapText?: string): InputFiles;
|
||||
function createUnparsedSourceFile(text: string): UnparsedSource;
|
||||
function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
|
||||
function createInputFiles(javascript: string, declaration: string): InputFiles;
|
||||
function createInputFiles(javascript: string, declaration: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
|
||||
function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource>): Bundle;
|
||||
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
|
||||
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
|
||||
@ -8503,6 +8508,56 @@ declare namespace ts {
|
||||
function enableDebugInfo(): void;
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
interface SourceFileLikeCache {
|
||||
get(path: Path): SourceFileLike | undefined;
|
||||
}
|
||||
function createSourceFileLikeCache(host: {
|
||||
readFile?: (path: string) => string | undefined;
|
||||
fileExists?: (path: string) => boolean;
|
||||
}): SourceFileLikeCache;
|
||||
}
|
||||
declare namespace ts.sourcemaps {
|
||||
interface SourceMapData {
|
||||
version?: number;
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
sources: string[];
|
||||
sourcesContent?: (string | null)[];
|
||||
names?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
interface SourceMappableLocation {
|
||||
fileName: string;
|
||||
position: number;
|
||||
}
|
||||
interface SourceMapper {
|
||||
getOriginalPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
getGeneratedPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
}
|
||||
const identitySourceMapper: {
|
||||
getOriginalPosition: typeof identity;
|
||||
getGeneratedPosition: typeof identity;
|
||||
};
|
||||
interface SourceMapDecodeHost {
|
||||
readFile(path: string): string | undefined;
|
||||
fileExists(path: string): boolean;
|
||||
getCanonicalFileName(path: string): string;
|
||||
log(text: string): void;
|
||||
}
|
||||
function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache?: SourceFileLikeCache): SourceMapper;
|
||||
function calculateDecodedMappings<T>(map: SourceMapData, processPosition: (position: RawSourceMapPosition) => T, host?: {
|
||||
log?(s: string): void;
|
||||
}): T[];
|
||||
interface RawSourceMapPosition {
|
||||
emittedLine: number;
|
||||
emittedColumn: number;
|
||||
sourceLine: number;
|
||||
sourceColumn: number;
|
||||
sourceIndex: number;
|
||||
nameIndex?: number;
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
function getOriginalNodeId(node: Node): number;
|
||||
interface ExternalModuleInfo {
|
||||
@ -11487,36 +11542,6 @@ declare namespace ts.refactor {
|
||||
}
|
||||
declare namespace ts.refactor.addOrRemoveBracesToArrowFunction {
|
||||
}
|
||||
declare namespace ts.sourcemaps {
|
||||
interface SourceMapData {
|
||||
version?: number;
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
sources: string[];
|
||||
sourcesContent?: string[];
|
||||
names?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
interface SourceMappableLocation {
|
||||
fileName: string;
|
||||
position: number;
|
||||
}
|
||||
interface SourceMapper {
|
||||
getOriginalPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
getGeneratedPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
}
|
||||
const identitySourceMapper: {
|
||||
getOriginalPosition: typeof identity;
|
||||
getGeneratedPosition: typeof identity;
|
||||
};
|
||||
interface SourceMapDecodeHost {
|
||||
readFile(path: string): string | undefined;
|
||||
fileExists(path: string): boolean;
|
||||
getCanonicalFileName(path: string): string;
|
||||
log(text: string): void;
|
||||
}
|
||||
function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache?: SourceFileLikeCache): SourceMapper;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the language service API */
|
||||
const servicesVersion = "0.8";
|
||||
@ -11540,13 +11565,6 @@ declare namespace ts {
|
||||
isCancellationRequested(): boolean;
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
interface SourceFileLikeCache {
|
||||
get(path: Path): SourceFileLike | undefined;
|
||||
}
|
||||
function createSourceFileLikeCache(host: {
|
||||
readFile?: (path: string) => string | undefined;
|
||||
fileExists?: (path: string) => boolean;
|
||||
}): SourceFileLikeCache;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService;
|
||||
/** Names in the name table are escaped, so an identifier `__foo` will have a name table entry `___foo`. */
|
||||
function getNameTable(sourceFile: SourceFile): UnderscoreEscapedMap<number>;
|
||||
|
||||
98
tests/baselines/reference/api/typescript.d.ts
vendored
98
tests/baselines/reference/api/typescript.d.ts
vendored
@ -2380,13 +2380,16 @@ declare namespace ts {
|
||||
interface InputFiles extends Node {
|
||||
kind: SyntaxKind.InputFiles;
|
||||
javascriptText: string;
|
||||
javascriptMapPath?: string;
|
||||
javascriptMapText?: string;
|
||||
declarationText: string;
|
||||
declarationMapPath?: string;
|
||||
declarationMapText?: string;
|
||||
}
|
||||
interface UnparsedSource extends Node {
|
||||
kind: SyntaxKind.UnparsedSource;
|
||||
text: string;
|
||||
sourceMapPath?: string;
|
||||
sourceMapText?: string;
|
||||
}
|
||||
interface JsonSourceFile extends SourceFile {
|
||||
@ -2525,7 +2528,7 @@ declare namespace ts {
|
||||
sourceMapFile: string;
|
||||
sourceMapSourceRoot: string;
|
||||
sourceMapSources: string[];
|
||||
sourceMapSourcesContent?: string[];
|
||||
sourceMapSourcesContent?: (string | null)[];
|
||||
inputSourceFileNames: string[];
|
||||
sourceMapNames?: string[];
|
||||
sourceMapMappings: string;
|
||||
@ -8013,8 +8016,10 @@ declare namespace ts {
|
||||
function createCommaList(elements: ReadonlyArray<Expression>): CommaListExpression;
|
||||
function updateCommaList(node: CommaListExpression, elements: ReadonlyArray<Expression>): CommaListExpression;
|
||||
function createBundle(sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
|
||||
function createUnparsedSourceFile(text: string, map?: string): UnparsedSource;
|
||||
function createInputFiles(javascript: string, declaration: string, javascriptMapText?: string, declarationMapText?: string): InputFiles;
|
||||
function createUnparsedSourceFile(text: string): UnparsedSource;
|
||||
function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource;
|
||||
function createInputFiles(javascript: string, declaration: string): InputFiles;
|
||||
function createInputFiles(javascript: string, declaration: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
|
||||
function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource>): Bundle;
|
||||
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
|
||||
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
|
||||
@ -8503,6 +8508,56 @@ declare namespace ts {
|
||||
function enableDebugInfo(): void;
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
interface SourceFileLikeCache {
|
||||
get(path: Path): SourceFileLike | undefined;
|
||||
}
|
||||
function createSourceFileLikeCache(host: {
|
||||
readFile?: (path: string) => string | undefined;
|
||||
fileExists?: (path: string) => boolean;
|
||||
}): SourceFileLikeCache;
|
||||
}
|
||||
declare namespace ts.sourcemaps {
|
||||
interface SourceMapData {
|
||||
version?: number;
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
sources: string[];
|
||||
sourcesContent?: (string | null)[];
|
||||
names?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
interface SourceMappableLocation {
|
||||
fileName: string;
|
||||
position: number;
|
||||
}
|
||||
interface SourceMapper {
|
||||
getOriginalPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
getGeneratedPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
}
|
||||
const identitySourceMapper: {
|
||||
getOriginalPosition: typeof identity;
|
||||
getGeneratedPosition: typeof identity;
|
||||
};
|
||||
interface SourceMapDecodeHost {
|
||||
readFile(path: string): string | undefined;
|
||||
fileExists(path: string): boolean;
|
||||
getCanonicalFileName(path: string): string;
|
||||
log(text: string): void;
|
||||
}
|
||||
function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache?: SourceFileLikeCache): SourceMapper;
|
||||
function calculateDecodedMappings<T>(map: SourceMapData, processPosition: (position: RawSourceMapPosition) => T, host?: {
|
||||
log?(s: string): void;
|
||||
}): T[];
|
||||
interface RawSourceMapPosition {
|
||||
emittedLine: number;
|
||||
emittedColumn: number;
|
||||
sourceLine: number;
|
||||
sourceColumn: number;
|
||||
sourceIndex: number;
|
||||
nameIndex?: number;
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
function getOriginalNodeId(node: Node): number;
|
||||
interface ExternalModuleInfo {
|
||||
@ -11667,36 +11722,6 @@ declare namespace ts.refactor {
|
||||
}
|
||||
declare namespace ts.refactor.addOrRemoveBracesToArrowFunction {
|
||||
}
|
||||
declare namespace ts.sourcemaps {
|
||||
interface SourceMapData {
|
||||
version?: number;
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
sources: string[];
|
||||
sourcesContent?: string[];
|
||||
names?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
interface SourceMappableLocation {
|
||||
fileName: string;
|
||||
position: number;
|
||||
}
|
||||
interface SourceMapper {
|
||||
getOriginalPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
getGeneratedPosition(input: SourceMappableLocation): SourceMappableLocation;
|
||||
}
|
||||
const identitySourceMapper: {
|
||||
getOriginalPosition: typeof identity;
|
||||
getGeneratedPosition: typeof identity;
|
||||
};
|
||||
interface SourceMapDecodeHost {
|
||||
readFile(path: string): string | undefined;
|
||||
fileExists(path: string): boolean;
|
||||
getCanonicalFileName(path: string): string;
|
||||
log(text: string): void;
|
||||
}
|
||||
function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache?: SourceFileLikeCache): SourceMapper;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the language service API */
|
||||
const servicesVersion = "0.8";
|
||||
@ -11720,13 +11745,6 @@ declare namespace ts {
|
||||
isCancellationRequested(): boolean;
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
interface SourceFileLikeCache {
|
||||
get(path: Path): SourceFileLike | undefined;
|
||||
}
|
||||
function createSourceFileLikeCache(host: {
|
||||
readFile?: (path: string) => string | undefined;
|
||||
fileExists?: (path: string) => boolean;
|
||||
}): SourceFileLikeCache;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnly?: boolean): LanguageService;
|
||||
/** Names in the name table are escaped, so an identifier `__foo` will have a name table entry `___foo`. */
|
||||
function getNameTable(sourceFile: SourceFile): UnderscoreEscapedMap<number>;
|
||||
|
||||
@ -80,7 +80,7 @@ declare var c: C;
|
||||
//# sourceMappingURL=third-output.d.ts.map
|
||||
|
||||
//// [/src/third/thirdjs/output/third-output.d.ts.map]
|
||||
{"version":3,"file":"third-output.d.ts","sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"file":"first-output.d.ts","sourceRoot":"","sources":["../first_part1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAAA,UAAU,QAAQ;IACd,IAAI,EAAE,GAAG,CAAC;CACb;AAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;AAEzB,UAAU,iBAAiB;IACvB,IAAI,EAAE,GAAG,CAAC;CACb;AERD,6BAEC"}},{"offset":{"line":9,"column":0},"map":{"version":3,"file":"second-output.d.ts","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAAA,kBAAU,CAAC,CAAC;CAEX;AAED,kBAAU,CAAC,CAAC;CAMX;ACVD;IACI,WAAW;CAGd"}},{"offset":{"line":16,"column":43},"map":{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../third_part1.ts"],"names":[],"mappings":";AAAA,QAAA,IAAI,CAAC,GAAU,CAAC"}}]}
|
||||
{"version":3,"file":"third-output.d.ts","sourceRoot":"","sources":["../../third_part1.ts","../../../first/first_part1.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts"],"names":[],"mappings":"DCDD,UAAU,QAAQ;GACd,IAAI,EAAE,GAAG,CAAC;AACb;DAED,QAAA,MAAM,CAAC,iBAAiB,CAAC;DAEzB,UAAU,iBAAiB;GACvB,IAAI,EAAE,GAAG,CAAC;AACb;DCRD,6BAEC;;DCFD,kBAAU,CAAC,CAAC;AAEX;DAED,kBAAU,CAAC,CAAC;AAMX;DCVD;GACI,WAAW;AAGd;;;AJHA,QAAA,IAAI,CAAC,GAAU,CAAC"}
|
||||
|
||||
//// [/src/third/thirdjs/output/third-output.js]
|
||||
var s = "Hello, world";
|
||||
@ -111,5 +111,5 @@ c.doSomething();
|
||||
//# sourceMappingURL=third-output.js.map
|
||||
|
||||
//// [/src/third/thirdjs/output/third-output.js.map]
|
||||
{"version":3,"file":"third-output.js","sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"file":"first-output.js","sourceRoot":"","sources":["../first_part1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB;IACI,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}},{"offset":{"line":7,"column":0},"map":{"version":3,"file":"second-output.js","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAIA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP;QACI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"}},{"offset":{"line":22,"column":41},"map":{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../third_part1.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"}}]}
|
||||
{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../third_part1.ts","../../../first/first_part1.ts","../../../first/first_part2.ts","../../../first/first_part3.ts","../../../second/second_part1.ts","../../../second/second_part2.ts"],"names":[],"mappings":"DCGD,IAAM,CAAC,GAAG,cAAc,CAAC;DAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;DCVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;DCAjB;GACI,OAAO,gBAAgB,CAAC;DAC5B,CAAC;;DCED,IAAU,CAAC,CAMV;DAND,WAAU,CAAC;GACP;OACI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;GAC3B,CAAC;GAED,CAAC,EAAE,CAAC;DACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;DCVD;GAAA;GAIA,CAAC;GAHG,uBAAW,GAAX;OACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;GACtC,CAAC;GACL,QAAC;DAAD,CAAC,AAJD,IAIC;;;ALHA,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"}
|
||||
|
||||
|
||||
1
tests/baselines/reference/third-output.js.map
Normal file
1
tests/baselines/reference/third-output.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../third_part1.ts","../../../../first_part1.ts","../../../../first_part2.ts","../../../../first_part3.ts","../../../../second/second_part1.ts","../../../../second/second_part2.ts"],"names":[],"mappings":"DCGD,IAAM,CAAC,GAAG,cAAc,CAAC;DAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;DCVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;DCAjB;GACI,OAAO,gBAAgB,CAAC;DAC5B,CAAC;;DCED,IAAU,CAAC,CAMV;DAND,WAAU,CAAC;GACP;OACI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;GAC3B,CAAC;GAED,CAAC,EAAE,CAAC;DACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;DCVD;GAAA;GAIA,CAAC;GAHG,uBAAW,GAAX;OACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;GACtC,CAAC;GACL,QAAC;DAAD,CAAC,AAJD,IAIC;;;ALHA,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"}
|
||||
Loading…
x
Reference in New Issue
Block a user