Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

source-map.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _sourceMap = require("source-map");
  7. class SourceMap {
  8. constructor(opts, code) {
  9. this._cachedMap = void 0;
  10. this._code = void 0;
  11. this._opts = void 0;
  12. this._rawMappings = void 0;
  13. this._lastGenLine = void 0;
  14. this._lastSourceLine = void 0;
  15. this._lastSourceColumn = void 0;
  16. this._cachedMap = null;
  17. this._code = code;
  18. this._opts = opts;
  19. this._rawMappings = [];
  20. }
  21. get() {
  22. if (!this._cachedMap) {
  23. const map = this._cachedMap = new _sourceMap.SourceMapGenerator({
  24. sourceRoot: this._opts.sourceRoot
  25. });
  26. const code = this._code;
  27. if (typeof code === "string") {
  28. map.setSourceContent(this._opts.sourceFileName.replace(/\\/g, "/"), code);
  29. } else if (typeof code === "object") {
  30. Object.keys(code).forEach(sourceFileName => {
  31. map.setSourceContent(sourceFileName.replace(/\\/g, "/"), code[sourceFileName]);
  32. });
  33. }
  34. this._rawMappings.forEach(mapping => map.addMapping(mapping), map);
  35. }
  36. return this._cachedMap.toJSON();
  37. }
  38. getRawMappings() {
  39. return this._rawMappings.slice();
  40. }
  41. mark(generatedLine, generatedColumn, line, column, identifierName, filename, force) {
  42. if (this._lastGenLine !== generatedLine && line === null) return;
  43. if (!force && this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) {
  44. return;
  45. }
  46. this._cachedMap = null;
  47. this._lastGenLine = generatedLine;
  48. this._lastSourceLine = line;
  49. this._lastSourceColumn = column;
  50. this._rawMappings.push({
  51. name: identifierName || undefined,
  52. generated: {
  53. line: generatedLine,
  54. column: generatedColumn
  55. },
  56. source: line == null ? undefined : (filename || this._opts.sourceFileName).replace(/\\/g, "/"),
  57. original: line == null ? undefined : {
  58. line: line,
  59. column: column
  60. }
  61. });
  62. }
  63. }
  64. exports.default = SourceMap;