astexplorer.app
Version:
https://astexplorer.net with ES Modules support and Hot Reloading
17 lines (16 loc) • 2.43 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
exports.__esModule = true;
exports.DEFAULT_TRANSFORM = exports.DEFAULT_SOURCE = exports.WEBSITE_PATH = exports.ICON_PATH = exports.DEFAULT_TRANSFORM_PARSER = exports.DEFAULT_SOURCE_PARSER = exports.CSS_PATH = exports.CLIENT_SCRIPT_PATH = exports.ROOT = void 0;
var path_1 = __importDefault(require("path"));
exports.ROOT = path_1["default"].resolve(__dirname, '..');
exports.CLIENT_SCRIPT_PATH = path_1["default"].resolve(__dirname, './browser/index.js');
exports.CSS_PATH = path_1["default"].resolve(exports.ROOT, './assets/overrides.css');
exports.DEFAULT_SOURCE_PARSER = 'babylon7';
exports.DEFAULT_TRANSFORM_PARSER = 'babelv7';
exports.ICON_PATH = path_1["default"].resolve(exports.ROOT, './assets/icons/png/64x64.png');
exports.WEBSITE_PATH = path_1["default"].resolve(exports.ROOT, './vendor/astexplorer/out/index.html');
exports.DEFAULT_SOURCE = "\n// This is the \"Source\" Panel.\n//\n// Code which you want to explore the AST of and/or run through a \"Transform\"\n// (Babel Plugin, ESLint Rule, Codemod etc) goes here.\n//\n// The AST of this code is displayed in the panel on the top-right and your\n// Transform goes in the panel below in the bottom-left.\n//\n// Paste some source code here to view its AST.\n\nconst reverseMe = 'Hello World';\n".trimLeft();
exports.DEFAULT_TRANSFORM = "\n// This is the \"Transform\" Panel.\n//\n// The result of running this transform over the Source Panel is shown in the\n// panel on the bottom-right.\n//\n// 1. Using the \"Transform\" Menu above, choose your Transform type, such as\n// Babel Plugin, ESLint Rule, Codemod etc.\n// 2. Use the Open File Dialog to locate your Transform Script.\n// 3. Edit your Transform Script in your IDE.\n// 4. Changes will be reloaded here automatically.\n//\n// Feel free to organise your transform using ES modules and they will be\n// bundled together automatically.\n\nexport default (babel) => {\n const { types: t } = babel;\n\n return {\n visitor: {\n Identifier(path) {\n path.node.name = path.node.name\n .split('')\n .reverse()\n .join('');\n },\n Program(path) {\n path.traverse({\n enter(path) {\n t.removeComments(path.node);\n }\n });\n }\n }\n };\n};\n".trimLeft();