mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Add SourceMapUrl to section
This commit is contained in:
1 parent
b15cb6b097
commit
38e0d4df0f
18 files changed
+2405
-1843
No files matched your search
@@ -314,7 +314,9 @@ namespace ts {
|
||||
|
||||
if (sourceMappingURL) {
|
||||
if (!writer.isAtStartOfLine()) writer.rawWrite(newLine);
|
||||
const pos = writer.getTextPos();
|
||||
writer.writeComment(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Tools can sometimes see this line as a source mapping url comment
|
||||
if (bundleFileInfo) bundleFileInfo.push({ pos, end: writer.getTextPos(), kind: BundleFileSectionKind.SourceMapUrl });
|
||||
}
|
||||
|
||||
// Write the source map
|
||||
@@ -734,6 +736,7 @@ namespace ts {
|
||||
case SyntaxKind.UnparsedPrologue:
|
||||
case SyntaxKind.UnparsedPrependText:
|
||||
case SyntaxKind.UnparsedText:
|
||||
case SyntaxKind.UnparsedSourceMapUrl:
|
||||
return emitUnparsedNode(<UnparsedNode>node);
|
||||
|
||||
// Identifiers
|
||||
|
||||
@@ -2705,6 +2705,9 @@ namespace ts {
|
||||
case BundleFileSectionKind.Text:
|
||||
(texts || (texts = [])).push(<UnparsedText>createUnparsedNode(SyntaxKind.UnparsedText, section.pos, section.end, node));
|
||||
break;
|
||||
case BundleFileSectionKind.SourceMapUrl:
|
||||
(texts || (texts = [])).push(<UnparsedSourceMapUrl>createUnparsedNode(SyntaxKind.UnparsedSourceMapUrl, section.pos, section.end, node));
|
||||
break;
|
||||
default:
|
||||
Debug.assertNever(section);
|
||||
}
|
||||
@@ -2728,7 +2731,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function createUnparsedNode(kind: UnparsedNode["kind"], pos: number, end: number, parent: UnparsedSource) {
|
||||
const node = <UnparsedNode>createNode(kind, pos, end);
|
||||
const node = createNode(kind, pos, end) as UnparsedNode;
|
||||
node.parent = parent;
|
||||
return node;
|
||||
}
|
||||
|
||||
+15
-2
@@ -432,6 +432,7 @@ namespace ts {
|
||||
UnparsedPrologue,
|
||||
UnparsedPrependText,
|
||||
UnparsedText,
|
||||
UnparsedSourceMapUrl,
|
||||
|
||||
// Top-level nodes
|
||||
SourceFile,
|
||||
@@ -2797,7 +2798,7 @@ namespace ts {
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
}
|
||||
|
||||
export type UnparsedSourceText = UnparsedPrependText | UnparsedText;
|
||||
export type UnparsedSourceText = UnparsedPrependText | UnparsedText | UnparsedSourceMapUrl;
|
||||
export type UnparsedNode = UnparsedPrologue | UnparsedSourceText;
|
||||
|
||||
export interface UnparsedPrologue extends Node {
|
||||
@@ -2817,6 +2818,11 @@ namespace ts {
|
||||
parent: UnparsedSource;
|
||||
}
|
||||
|
||||
export interface UnparsedSourceMapUrl extends Node {
|
||||
kind: SyntaxKind.UnparsedSourceMapUrl;
|
||||
parent: UnparsedSource;
|
||||
}
|
||||
|
||||
export interface JsonSourceFile extends SourceFile {
|
||||
statements: NodeArray<JsonObjectExpressionStatement>;
|
||||
}
|
||||
@@ -5461,6 +5467,7 @@ namespace ts {
|
||||
Lib = "lib",
|
||||
Prepend = "prepend",
|
||||
Text = "text",
|
||||
SourceMapUrl = "sourceMapUrl",
|
||||
// internal comments?
|
||||
}
|
||||
|
||||
@@ -5503,9 +5510,15 @@ namespace ts {
|
||||
kind: BundleFileSectionKind.Text;
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
export interface BundleFileSourceMapUrl extends BundleFileSectionBase {
|
||||
kind: BundleFileSectionKind.SourceMapUrl;
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
export type BundleFileSection = BundleFilePrologue | BundleFileEmitHelpers |
|
||||
BundleFileHasNoDefaultLib | BundleFileReference | BundleFilePrepend | BundleFileText;
|
||||
BundleFileHasNoDefaultLib | BundleFileReference | BundleFilePrepend |
|
||||
BundleFileText | BundleFileSourceMapUrl;
|
||||
|
||||
/*@internal*/
|
||||
export type BundleFileInfo = BundleFileSection[];
|
||||
|
||||
@@ -5988,7 +5988,8 @@ namespace ts {
|
||||
export function isUnparsedNode(node: Node): node is UnparsedNode {
|
||||
return node.kind === SyntaxKind.UnparsedPrologue ||
|
||||
node.kind === SyntaxKind.UnparsedPrependText ||
|
||||
node.kind === SyntaxKind.UnparsedText;
|
||||
node.kind === SyntaxKind.UnparsedText ||
|
||||
node.kind === SyntaxKind.UnparsedSourceMapUrl;
|
||||
}
|
||||
|
||||
// JSDoc
|
||||
|
||||
Reference in new issue
Block a user