cordova/mpdjs/jsbuild/r.js
function appendToFileContents(fileContents, singleContents, path, config, module, sourceMapGenerator) {
        var refPath, sourceMapPath, resourcePath, pluginId, sourceMapLineNumber, lineCount, parts, i;
        if (sourceMapGenerator) {
            if (config.out) {
                refPath = config.baseUrl;
            } else if (module && module._buildPath) {
                refPath = module._buildPath;
            } else {
                refPath = "";
            }
            parts = path.split('!');
            if (parts.length === 1) {
                //Not a plugin resource, fix the path
                sourceMapPath = build.makeRelativeFilePath(refPath, path);
            } else {
                //Plugin resource. If it looks like just a plugin
                //followed by a module ID, pull off the plugin
                //and put it at the end of the name, otherwise
                //just leave it alone.
                pluginId = parts.shift();
                resourcePath = parts.join('!');
                if (resourceIsModuleIdRegExp.test(resourcePath)) {
                    sourceMapPath = build.makeRelativeFilePath(refPath, require.toUrl(resourcePath)) +
                                    '!' + pluginId;
                } else {
                    sourceMapPath = path;
                }
            }

            sourceMapLineNumber = fileContents.split('\n').length - 1;
            lineCount = singleContents.split('\n').length;
            for (i = 1; i <= lineCount; i += 1) {
                sourceMapGenerator.addMapping({
                    generated: {
                        line: sourceMapLineNumber + i,
                        column: 0
                    },
                    original: {
                        line: i,
                        column: 0
                    },
                    source: sourceMapPath
                });
            }

            //Store the content of the original in the source
            //map since other transforms later like minification
            //can mess up translating back to the original
            //source.
            sourceMapGenerator.setSourceContent(sourceMapPath, singleContents);
        }
        fileContents += singleContents;
        return fileContents;
    }
function appendToFileContents(fileContents, singleContents, path, config, module, sourceMapGenerator) {
        var refPath, sourceMapPath, resourcePath, pluginId, sourceMapLineNumber, lineCount, parts, i;
        if (sourceMapGenerator) {
            if (config.out) {
                refPath = config.baseUrl;
            } else if (module && module._buildPath) {
                refPath = module._buildPath;
            } else {
                refPath = "";
            }
            parts = path.split('!');
            if (parts.length === 1) {
                //Not a plugin resource, fix the path
                sourceMapPath = build.makeRelativeFilePath(refPath, path);
            } else {
                //Plugin resource. If it looks like just a plugin
                //followed by a module ID, pull off the plugin
                //and put it at the end of the name, otherwise
                //just leave it alone.
                pluginId = parts.shift();
                resourcePath = parts.join('!');
                if (resourceIsModuleIdRegExp.test(resourcePath)) {
                    sourceMapPath = build.makeRelativeFilePath(refPath, require.toUrl(resourcePath)) +
                                    '!' + pluginId;
                } else {
                    sourceMapPath = path;
                }
            }

            sourceMapLineNumber = fileContents.split('\n').length - 1;
            lineCount = singleContents.split('\n').length;
            for (i = 1; i <= lineCount; i += 1) {
                sourceMapGenerator.addMapping({
                    generated: {
                        line: sourceMapLineNumber + i,
                        column: 0
                    },
                    original: {
                        line: i,
                        column: 0
                    },
                    source: sourceMapPath
                });
            }

            //Store the content of the original in the source
            //map since other transforms later like minification
            //can mess up translating back to the original
            //source.
            sourceMapGenerator.setSourceContent(sourceMapPath, singleContents);
        }
        fileContents += singleContents;
        return fileContents;
    }
function appendToFileContents ( fileContents , singleContents , path , config , module , sourceMapGenerator ) { var refPath , sourceMapPath , resourcePath , pluginId , sourceMapLineNumber , lineCount , parts , i ; if ( sourceMapGenerator ) { if ( config . out ) { refPath = config . baseUrl ; } else if ( module && module . _buildPath ) { refPath = module . _buildPath ; } else { refPath = "" ; } parts = path . split ( '!' ) ; if ( parts . length === 1 ) { //Not a plugin resource, fix the path sourceMapPath = build . makeRelativeFilePath ( refPath , path ) ; } else { //Plugin resource. If it looks like just a plugin //followed by a module ID, pull off the plugin //and put it at the end of the name, otherwise //just leave it alone. pluginId = parts . shift ( ) ; resourcePath = parts . join ( '!' ) ; if ( resourceIsModuleIdRegExp . test ( resourcePath ) ) { sourceMapPath = build . makeRelativeFilePath ( refPath , require . toUrl ( resourcePath ) ) + '!' + pluginId ; } else { sourceMapPath = path ; } } sourceMapLineNumber = fileContents . split ( '\n' ) . length - 1 ; lineCount = singleContents . split ( '\n' ) . length ; for ( i = 1 ; i <= lineCount ; i += 1 ) { sourceMapGenerator . addMapping ( { generated : { line : sourceMapLineNumber + i , column : 0 } , original : { line : i , column : 0 } , source : sourceMapPath } ) ; } //Store the content of the original in the source //map since other transforms later like minification //can mess up translating back to the original //source. sourceMapGenerator . setSourceContent ( sourceMapPath , singleContents ) ; } fileContents += singleContents ; return fileContents ; }
Appends singleContents to fileContents and returns the result.  If a sourceMapGenerator
is provided, adds singleContents to the source map.

@param {string} fileContents - The file contents to which to append singleContents
@param {string} singleContents - The additional contents to append to fileContents
@param {string} path - An absolute path of a file whose name to use in the source map.
The file need not actually exist if the code in singleContents is generated.
@param {{out: ?string, baseUrl: ?string}} config - The build configuration object.
@param {?{_buildPath: ?string}} module - An object with module information.
@param {?SourceMapGenerator} sourceMapGenerator - An instance of Mozilla's SourceMapGenerator,
or null if no source map is being generated.
@returns {string} fileContents with singleContents appended
Appends singleContents to fileContents and returns the result . If a sourceMapGenerator is provided adds singleContents to the source map .