|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | const babel = require("./babel-core.cjs");
|
|---|
| 4 | const maybeParse = require("./maybeParse.cjs");
|
|---|
| 5 | const maybeParseSync = require("./maybeParseSync.cjs");
|
|---|
| 6 | const astInfo = require("./ast-info.cjs");
|
|---|
| 7 | const config = require("./configuration.cjs");
|
|---|
| 8 | const Clients = require("../client.cjs");
|
|---|
| 9 | var ACTIONS = Clients.ACTIONS;
|
|---|
| 10 | module.exports = function handleMessage(action, payload) {
|
|---|
| 11 | switch (action) {
|
|---|
| 12 | case ACTIONS.GET_VERSION:
|
|---|
| 13 | return babel.version;
|
|---|
| 14 | case ACTIONS.GET_TYPES_INFO:
|
|---|
| 15 | return {
|
|---|
| 16 | FLOW_FLIPPED_ALIAS_KEYS: babel.types.FLIPPED_ALIAS_KEYS.Flow,
|
|---|
| 17 | VISITOR_KEYS: babel.types.VISITOR_KEYS
|
|---|
| 18 | };
|
|---|
| 19 | case ACTIONS.GET_TOKEN_LABELS:
|
|---|
| 20 | return astInfo.getTokLabels();
|
|---|
| 21 | case ACTIONS.GET_VISITOR_KEYS:
|
|---|
| 22 | return astInfo.getVisitorKeys();
|
|---|
| 23 | case ACTIONS.MAYBE_PARSE:
|
|---|
| 24 | return config.normalizeBabelParseConfig(payload.options).then(options => maybeParse(payload.code, options));
|
|---|
| 25 | case ACTIONS.MAYBE_PARSE_SYNC:
|
|---|
| 26 | return maybeParseSync(payload.code, config.normalizeBabelParseConfigSync(payload.options));
|
|---|
| 27 | }
|
|---|
| 28 | throw new Error(`Unknown internal parser worker action: ${action}`);
|
|---|
| 29 | };
|
|---|
| 30 |
|
|---|
| 31 | //# sourceMappingURL=handle-message.cjs.map
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.