
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
babel-plugin-esx-browser
Advanced tools
Babel plugin to prepare ESX for production-ready browser code.
Babel plugin to prepare ESX for production-ready browser code.
Stable.
In
const esx = require('esx')()
const data = { value: 'hi' }
const Component = ({ value, prop, title }) => esx`
<div>
<p> some content: ${title} </p>
<p> some ${value} </p>
<p> some ${prop} prop </p>
</div>
`
esx.register({ Component })
const App = ({ title }) => {
return esx`<Component prop="static" ...${data} title=${title}/>`
}
export default App
Out
import React from 'react';
const data = {
value: 'hi'
};
const Component = ({
value,
prop,
title
}) => React.createElement('div', null, [React.createElement('p', null, [" some content: ", title]), React.createElement('p', null, [" some ", value]), React.createElement('p', null, [" some ", prop, " prop "])]);
const App = ({
title
}) => {
return React.createElement(Component, {
prop: "static",
...data,
title: title
});
};
export default App;
Out when configured with @babel/preset-env
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var data = {
value: 'hi'
};
var Component = function Component(_ref) {
var value = _ref.value,
prop = _ref.prop,
title = _ref.title;
return _react["default"].createElement('div', null, [_react["default"].createElement('p', null, [" some content: ", title]), _react["default"].createElement('p', null, [" some ", value]), _react["default"].createElement('p', null, [" some ", prop, " prop "])]);
};
var App = function App(_ref2) {
var title = _ref2.title;
return _react["default"].createElement(Component, _objectSpread({
prop: "static"
}, data, {
title: title
}));
};
var _default = App;
exports["default"] = _default;
$ npm install babel-plugin-esx-ssr
.babelrc
{
"plugins": ["esx-ssr", {
"framework": "React",
"include": "import"
}]
}
framework
(default: React
)Currently the only available option is React
.
When set to React
all elements are created
with React.createElement
and if React has not
been included into a script, it will be added
with either import
or require
as per the include
option.
include
(default: import
)May be either import
or require
. If the framework
hasn't been added to a script, it will included
with the module syntax specified.
This plugin is for esx
v2.x.x.
esx
is an OPEN Open Source Project. This means that:
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the CONTRIBUTING.md file for more details.
MIT
FAQs
Babel plugin to prepare ESX for production-ready browser code.
We found that babel-plugin-esx-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.