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.

README.md 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. # convert-source-map [![build status](https://secure.travis-ci.org/thlorenz/convert-source-map.svg?branch=master)](http://travis-ci.org/thlorenz/convert-source-map)
  2. Converts a source-map from/to different formats and allows adding/changing properties.
  3. ```js
  4. var convert = require('convert-source-map');
  5. var json = convert
  6. .fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
  7. .toJSON();
  8. var modified = convert
  9. .fromComment('//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQvZm9vLm1pbi5qcyIsInNvdXJjZXMiOlsic3JjL2Zvby5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
  10. .setProperty('sources', [ 'SRC/FOO.JS' ])
  11. .toJSON();
  12. console.log(json);
  13. console.log(modified);
  14. ```
  15. ```json
  16. {"version":3,"file":"build/foo.min.js","sources":["src/foo.js"],"names":[],"mappings":"AAAA","sourceRoot":"/"}
  17. {"version":3,"file":"build/foo.min.js","sources":["SRC/FOO.JS"],"names":[],"mappings":"AAAA","sourceRoot":"/"}
  18. ```
  19. ## API
  20. ### fromObject(obj)
  21. Returns source map converter from given object.
  22. ### fromJSON(json)
  23. Returns source map converter from given json string.
  24. ### fromBase64(base64)
  25. Returns source map converter from given base64 encoded json string.
  26. ### fromComment(comment)
  27. Returns source map converter from given base64 encoded json string prefixed with `//# sourceMappingURL=...`.
  28. ### fromMapFileComment(comment, mapFileDir)
  29. Returns source map converter from given `filename` by parsing `//# sourceMappingURL=filename`.
  30. `filename` must point to a file that is found inside the `mapFileDir`. Most tools store this file right next to the
  31. generated file, i.e. the one containing the source map.
  32. ### fromSource(source)
  33. Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was found.
  34. ### fromMapFileSource(source, mapFileDir)
  35. Finds last sourcemap comment in file and returns source map converter or returns null if no source map comment was
  36. found.
  37. The sourcemap will be read from the map file found by parsing `# sourceMappingURL=file` comment. For more info see
  38. fromMapFileComment.
  39. ### toObject()
  40. Returns a copy of the underlying source map.
  41. ### toJSON([space])
  42. Converts source map to json string. If `space` is given (optional), this will be passed to
  43. [JSON.stringify](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify) when the
  44. JSON string is generated.
  45. ### toBase64()
  46. Converts source map to base64 encoded json string.
  47. ### toComment([options])
  48. Converts source map to an inline comment that can be appended to the source-file.
  49. By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would
  50. normally see in a JS source file.
  51. When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file.
  52. ### addProperty(key, value)
  53. Adds given property to the source map. Throws an error if property already exists.
  54. ### setProperty(key, value)
  55. Sets given property to the source map. If property doesn't exist it is added, otherwise its value is updated.
  56. ### getProperty(key)
  57. Gets given property of the source map.
  58. ### removeComments(src)
  59. Returns `src` with all source map comments removed
  60. ### removeMapFileComments(src)
  61. Returns `src` with all source map comments pointing to map files removed.
  62. ### commentRegex
  63. Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments.
  64. ### mapFileCommentRegex
  65. Provides __a fresh__ RegExp each time it is accessed. Can be used to find source map comments pointing to map files.
  66. ### generateMapFileComment(file, [options])
  67. Returns a comment that links to an external source map via `file`.
  68. By default, the comment is formatted like: `//# sourceMappingURL=...`, which you would normally see in a JS source file.
  69. When `options.multiline == true`, the comment is formatted like: `/*# sourceMappingURL=... */`, which you would find in a CSS source file.