BVB Source Codes

reactide Show source-map.js Source code

Return Download reactide: download source-map.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4.  
  5. var _keys = require("babel-runtime/core-js/object/keys");
  6.  
  7. var _keys2 = _interopRequireDefault(_keys);
  8.  
  9. var _typeof2 = require("babel-runtime/helpers/typeof");
  10.  
  11. var _typeof3 = _interopRequireDefault(_typeof2);
  12.  
  13. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  14.  
  15. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  16.  
  17. var _sourceMap = require("source-map");
  18.  
  19. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  20.  
  21. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  22.  
  23. var SourceMap = function () {
  24.   function SourceMap(opts, code) {
  25.     (0, _classCallCheck3.default)(this, SourceMap);
  26.  
  27.     this._cachedMap = null;
  28.     this._code = code;
  29.     this._opts = opts;
  30.     this._rawMappings = [];
  31.   }
  32.  
  33.   SourceMap.prototype.get = function get() {
  34.     if (!this._cachedMap) {
  35.       var map = this._cachedMap = new _sourceMap2.default.SourceMapGenerator({
  36.         file: this._opts.sourceMapTarget,
  37.         sourceRoot: this._opts.sourceRoot
  38.       });
  39.  
  40.       var code = this._code;
  41.       if (typeof code === "string") {
  42.         map.setSourceContent(this._opts.sourceFileName, code);
  43.       } else if ((typeof code === "undefined" ? "undefined" : (0, _typeof3.default)(code)) === "object") {
  44.         (0, _keys2.default)(code).forEach(function (sourceFileName) {
  45.           map.setSourceContent(sourceFileName, code[sourceFileName]);
  46.         });
  47.       }
  48.  
  49.       this._rawMappings.forEach(map.addMapping, map);
  50.     }
  51.  
  52.     return this._cachedMap.toJSON();
  53.   };
  54.  
  55.   SourceMap.prototype.getRawMappings = function getRawMappings() {
  56.     return this._rawMappings.slice();
  57.   };
  58.  
  59.   SourceMap.prototype.mark = function mark(generatedLine, generatedColumn, line, column, identifierName, filename) {
  60.     if (this._lastGenLine !== generatedLine && line === null) return;
  61.  
  62.     if (this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) {
  63.       return;
  64.     }
  65.  
  66.     this._cachedMap = null;
  67.     this._lastGenLine = generatedLine;
  68.     this._lastSourceLine = line;
  69.     this._lastSourceColumn = column;
  70.  
  71.     this._rawMappings.push({
  72.       name: identifierName || undefined,
  73.       generated: {
  74.         line: generatedLine,
  75.         column: generatedColumn
  76.       },
  77.       source: line == null ? undefined : filename || this._opts.sourceFileName,
  78.       original: line == null ? undefined : {
  79.         line: line,
  80.         column: column
  81.       }
  82.     });
  83.   };
  84.  
  85.   return SourceMap;
  86. }();
  87.  
  88. exports.default = SourceMap;
  89. module.exports = exports["default"];
downloadsource-map.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top