Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow applying input source maps to the generated source map.
This allows users to easily map from generated source that's an input to the compiler back into their original source files. E.g. when compiling TypeScript, users would have: input.ts -(a)-> input.js -(b)-> compiled.js Where (a) is the TypeScript compilation operation, and (b) is Closure Compiler. With this option set, the source map generated in (a) is applied to the operation (b), with the final source map mapping back into `input.ts` from locations in `compiled.js`. This also introduces an interface `SourceFileMapping` to avoid increasing the coupling and responsibility of the Compiler object. Merge pull request #1971 from mprobst/closure-compiler Closes #1971 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=131651810
- Loading branch information
Showing
8 changed files
with
174 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2016 The Closure Compiler Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.javascript.jscomp; | ||
|
||
import com.google.debugging.sourcemap.proto.Mapping.OriginalMapping; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* A SourceFileMapping maps a source file, line, and column into an {@link OriginalMapping}. | ||
* | ||
* @see com.google.debugging.sourcemap.SourceMapping | ||
*/ | ||
public interface SourceFileMapping { | ||
/** | ||
* Returns the original mapping for the file name, line number and column position found | ||
* in the source map. Returns {@code null} if none is found. | ||
* | ||
* @param lineNo The line number, 1-based. | ||
* @param columnNo The column index, 1-based. | ||
*/ | ||
@Nullable | ||
OriginalMapping getSourceMapping(String fileName, int lineNo, int columnNo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I really think this should default to
true
for the open source command line runner. Did it get changed to false in the internal CL on purpose?