MCPcopy Create free account
hub / github.com/reactjs/react-rails / inlineSourceMap

Function inlineSourceMap

lib/assets/javascripts/JSXTransformer.js:15903–15914  ·  view source on GitHub ↗
(sourceMap, sourceCode, sourceFilename)

Source from the content-addressed store, hash-verified

15901var Buffer = _dereq_('buffer').Buffer;
15902
15903function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
15904 // This can be used with a sourcemap that has already has toJSON called on it.
15905 // Check first.
15906 var json = sourceMap;
15907 if (typeof sourceMap.toJSON === 'function') {
15908 json = sourceMap.toJSON();
15909 }
15910 json.sources = [sourceFilename];
15911 json.sourcesContent = [sourceCode];
15912 var base64 = Buffer(JSON.stringify(json)).toString('base64');
15913 return '//# sourceMappingURL=data:application/json;base64,' + base64;
15914}
15915
15916module.exports = inlineSourceMap;
15917

Callers 2

transformCodeFunction · 0.85
JSXTransformer.jsFile · 0.85

Calls 1

BufferFunction · 0.85

Tested by

no test coverage detected