UNPKG

@builder.io/mitosis

Version:

Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io

52 lines (51 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runPostCodePlugins = exports.runPreCodePlugins = exports.runPostJsonPlugins = exports.runPreJsonPlugins = void 0; const runPreJsonPlugins = ({ json, plugins, options, }) => { var _a; let useJson = json; for (const plugin of plugins) { const preFunction = (_a = plugin(options).json) === null || _a === void 0 ? void 0 : _a.pre; if (preFunction) { useJson = preFunction(json) || json; } } return useJson; }; exports.runPreJsonPlugins = runPreJsonPlugins; const runPostJsonPlugins = ({ json, plugins, options, }) => { var _a; let useJson = json; for (const plugin of plugins) { const postFunction = (_a = plugin(options).json) === null || _a === void 0 ? void 0 : _a.post; if (postFunction) { useJson = postFunction(json) || json; } } return useJson; }; exports.runPostJsonPlugins = runPostJsonPlugins; const runPreCodePlugins = ({ code, plugins, options, json, }) => { var _a; let string = code; for (const plugin of plugins) { const preFunction = (_a = plugin(options).code) === null || _a === void 0 ? void 0 : _a.pre; if (preFunction) { string = preFunction(string, json); } } return string; }; exports.runPreCodePlugins = runPreCodePlugins; const runPostCodePlugins = ({ code, plugins, options, json, }) => { var _a; let string = code; for (const plugin of plugins) { const postFunction = (_a = plugin(options).code) === null || _a === void 0 ? void 0 : _a.post; if (postFunction) { string = postFunction(string, json); } } return string; }; exports.runPostCodePlugins = runPostCodePlugins;