Exemplo n.º 1
0
 public void setSourceMapperNewSourceFile(Document document) 
 {
    this.sourceMapper.setNewSourceFile(document, this.emitOptions);
 }
Exemplo n.º 2
0
 public void createSourceMapper(Document document, string jsFileName, TextWriter jsFile, TextWriter sourceMapOut, Func<string,string> resolvePath) 
 {
    this.sourceMapper = new SourceMapper(jsFile, sourceMapOut, document, jsFileName, this.emitOptions, resolvePath);
 }
Exemplo n.º 3
0
        public SourceMapper
        (
            TextWriter jsFile,
            TextWriter sourceMapOut,
            Document document,
            string jsFilePath,
            EmitOptions emitOptions,
            Func<string,string> resolvePath // (path: string) => string
        ) 
        {
            this.jsFile = jsFile;
            this.sourceMapOut = sourceMapOut;

            this.setSourceMapOptions(document, jsFilePath, emitOptions, resolvePath);
            this.setNewSourceFile(document, emitOptions);
        }
Exemplo n.º 4
0
 private void setNewSourceFilePath(Document document, EmitOptions emitOptions) 
 {
     throw new NotImplementedException();
     /*
     var tsFilePath = switchToForwardSlashes(document.fileName);
     if (emitOptions.sourceRootDirectory()) {
         // Use the relative path corresponding to the common directory path
         tsFilePath = getRelativePathToFixedPath(emitOptions.commonDirectoryPath(), tsFilePath);
     }
     else {
         // Source locations relative to map file location
         tsFilePath = getRelativePathToFixedPath(this.sourceMapDirectory, tsFilePath);
     }
     this.tsFilePaths.Add(tsFilePath);
     */
 }
Exemplo n.º 5
0
        private void setSourceMapOptions(Document document, string jsFilePath, EmitOptions emitOptions, Func<string,string> resolvePath) 
        {
            throw new NotImplementedException();

            /*
            // Decode mapRoot and sourceRoot

            // Js File Name = pretty name of js file
            var prettyJsFileName = TypeScript.getPrettyName(jsFilePath, false, true);
            var prettyMapFileName = prettyJsFileName + SourceMapper.MapFileExtension;
            this.jsFileName = prettyJsFileName;

            // Figure out sourceMapPath and sourceMapDirectory
            if (emitOptions.sourceMapRootDirectory()) {
                // Get the sourceMap Directory
                this.sourceMapDirectory = emitOptions.sourceMapRootDirectory();
                if (document.emitToOwnOutputFile()) {
                    // For modules or multiple emit files the mapRoot will have directory structure like the sources
                    // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map
                    this.sourceMapDirectory = this.sourceMapDirectory + switchToForwardSlashes(getRootFilePath((document.fileName)).replace(emitOptions.commonDirectoryPath(), ""));
                }

                if (isRelative(this.sourceMapDirectory)) {
                    // The relative paths are relative to the common directory
                    this.sourceMapDirectory = emitOptions.commonDirectoryPath() + this.sourceMapDirectory;
                    this.sourceMapDirectory = convertToDirectoryPath(switchToForwardSlashes(resolvePath(this.sourceMapDirectory)));
                    this.sourceMapPath = getRelativePathToFixedPath(getRootFilePath(jsFilePath), this.sourceMapDirectory + prettyMapFileName);
                }
                else {
                    this.sourceMapPath = this.sourceMapDirectory + prettyMapFileName;
                }
            }
            else {
                this.sourceMapPath = prettyMapFileName;
                this.sourceMapDirectory = getRootFilePath(jsFilePath);
            }
            this.sourceRoot = emitOptions.sourceRootDirectory();
            */
        }
Exemplo n.º 6
0
        public void setNewSourceFile(Document document, EmitOptions emitOptions) {
            // Set new mappings
            List<SourceMapping> sourceMappings = new List<SourceMapping>();
            this.allSourceMappings.Add(sourceMappings);
            this.currentMappings = new List<List<SourceMapping>>();  
            this.currentMappings.Add(sourceMappings);
            this.currentNameIndex = new List<int>();

            // Set new source file path
            this.setNewSourceFilePath(document, emitOptions);
        }