UNPKG

@memberjunction/react-runtime

Version:

Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.

53 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getJSXConfig = exports.JSX_PRAGMAS = exports.validateBabelPresets = exports.getBabelConfig = exports.DEVELOPMENT_CONFIG = exports.PRODUCTION_CONFIG = exports.DEFAULT_PLUGINS = exports.DEFAULT_PRESETS = void 0; exports.DEFAULT_PRESETS = [ 'react', ]; exports.DEFAULT_PLUGINS = []; exports.PRODUCTION_CONFIG = { presets: exports.DEFAULT_PRESETS, plugins: [ ...exports.DEFAULT_PLUGINS, ], minified: true, comments: false }; exports.DEVELOPMENT_CONFIG = { presets: exports.DEFAULT_PRESETS, plugins: [ ...exports.DEFAULT_PLUGINS, ], sourceMaps: 'inline', minified: false, comments: true }; function getBabelConfig(production = false) { return production ? exports.PRODUCTION_CONFIG : exports.DEVELOPMENT_CONFIG; } exports.getBabelConfig = getBabelConfig; function validateBabelPresets(babel) { if (!babel || !babel.availablePresets) { return false; } return 'react' in babel.availablePresets; } exports.validateBabelPresets = validateBabelPresets; exports.JSX_PRAGMAS = { classic: { pragma: 'React.createElement', pragmaFrag: 'React.Fragment' }, automatic: { runtime: 'automatic', importSource: 'react' } }; function getJSXConfig(reactVersion) { if (reactVersion && parseInt(reactVersion.split('.')[0]) >= 17) { return exports.JSX_PRAGMAS.automatic; } return exports.JSX_PRAGMAS.classic; } exports.getJSXConfig = getJSXConfig; //# sourceMappingURL=babel-config.js.map