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.

index.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = generate;
  6. exports.CodeGenerator = void 0;
  7. var _sourceMap = require("./source-map");
  8. var _printer = require("./printer");
  9. class Generator extends _printer.default {
  10. constructor(ast, opts = {}, code) {
  11. const format = normalizeOptions(code, opts);
  12. const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
  13. super(format, map);
  14. this.ast = void 0;
  15. this.ast = ast;
  16. }
  17. generate() {
  18. return super.generate(this.ast);
  19. }
  20. }
  21. function normalizeOptions(code, opts) {
  22. const format = {
  23. auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
  24. auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
  25. shouldPrintComment: opts.shouldPrintComment,
  26. retainLines: opts.retainLines,
  27. retainFunctionParens: opts.retainFunctionParens,
  28. comments: opts.comments == null || opts.comments,
  29. compact: opts.compact,
  30. minified: opts.minified,
  31. concise: opts.concise,
  32. indent: {
  33. adjustMultilineComment: true,
  34. style: " ",
  35. base: 0
  36. },
  37. decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
  38. jsescOption: Object.assign({
  39. quotes: "double",
  40. wrap: true,
  41. minimal: false
  42. }, opts.jsescOption),
  43. recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType
  44. };
  45. {
  46. format.jsonCompatibleStrings = opts.jsonCompatibleStrings;
  47. }
  48. if (format.minified) {
  49. format.compact = true;
  50. format.shouldPrintComment = format.shouldPrintComment || (() => format.comments);
  51. } else {
  52. format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0);
  53. }
  54. if (format.compact === "auto") {
  55. format.compact = code.length > 500000;
  56. if (format.compact) {
  57. console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`);
  58. }
  59. }
  60. if (format.compact) {
  61. format.indent.adjustMultilineComment = false;
  62. }
  63. return format;
  64. }
  65. class CodeGenerator {
  66. constructor(ast, opts, code) {
  67. this._generator = void 0;
  68. this._generator = new Generator(ast, opts, code);
  69. }
  70. generate() {
  71. return this._generator.generate();
  72. }
  73. }
  74. exports.CodeGenerator = CodeGenerator;
  75. function generate(ast, opts, code) {
  76. const gen = new Generator(ast, opts, code);
  77. return gen.generate();
  78. }