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.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = parser;
  6. function _parser() {
  7. const data = require("@babel/parser");
  8. _parser = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _codeFrame() {
  14. const data = require("@babel/code-frame");
  15. _codeFrame = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. var _missingPluginHelper = require("./util/missing-plugin-helper");
  21. function* parser(pluginPasses, {
  22. parserOpts,
  23. highlightCode = true,
  24. filename = "unknown"
  25. }, code) {
  26. try {
  27. const results = [];
  28. for (const plugins of pluginPasses) {
  29. for (const plugin of plugins) {
  30. const {
  31. parserOverride
  32. } = plugin;
  33. if (parserOverride) {
  34. const ast = parserOverride(code, parserOpts, _parser().parse);
  35. if (ast !== undefined) results.push(ast);
  36. }
  37. }
  38. }
  39. if (results.length === 0) {
  40. return (0, _parser().parse)(code, parserOpts);
  41. } else if (results.length === 1) {
  42. yield* [];
  43. if (typeof results[0].then === "function") {
  44. throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
  45. }
  46. return results[0];
  47. }
  48. throw new Error("More than one plugin attempted to override parsing.");
  49. } catch (err) {
  50. if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") {
  51. err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file.";
  52. }
  53. const {
  54. loc,
  55. missingPlugin
  56. } = err;
  57. if (loc) {
  58. const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
  59. start: {
  60. line: loc.line,
  61. column: loc.column + 1
  62. }
  63. }, {
  64. highlightCode
  65. });
  66. if (missingPlugin) {
  67. err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
  68. } else {
  69. err.message = `${filename}: ${err.message}\n\n` + codeFrame;
  70. }
  71. err.code = "BABEL_PARSE_ERROR";
  72. }
  73. throw err;
  74. }
  75. }