Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
babel-plugin-bem
Advanced tools
[![NPM version](https://img.shields.io/npm/v/babel-plugin-bem.svg?style=flat)](https://www.npmjs.org/package/babel-plugin-bem)
A Babel plugin for BEM methodology.
The plugin helps tranform JS written in ES2015 (formally ES6) to YModules module system, that is used inside bem-core library.
// dom.js
import $ from 'bem:jquery';
export default { /* ... */ };
will be tranformed to
// dom.js
modules.define('dom', ['jquery'], function(provide, $) {
provide({ /* ... */ });
});
// button.js
import bemDom from 'bem:i-bem-dom';
export default bemDom.declBlock('button', {
onSetMod : {
/* ... */
}
});
tranforms to
// button.js
module.define('button', ['i-bem-dom'], function(provide, bemDom) {
provide(bemDom.declBlock(this.name, {
onSetMod : {
/* ... */
}
}));
});
// button_type_link.js
import Button from 'bem:button';
export default Button.declMod({ modName : 'type', modVal : 'link' }, {
onSetMod : {
/* ... */
}
});
tranforms to
// button_type_link.js
module.define('button', function(provide, Button) {
provide(Button.declMod({ modName : 'type', modVal : 'link' }, {
onSetMod : {
/* ... */
}
}));
});
// jquery.js
import asyncProvide from 'ym:provide';
import loader from 'bem:loader__js';
import cfg from 'bem:jquery__config';
doProvide = preserveGlobal => {
asyncProvide(preserveGlobal? jQuery : jQuery.noConflict(true));
}
typeof jQuery !== 'undefined'?
doProvide(true) :
loader(cfg.url, doProvide);
tranforms to
// jquery.js
modules.define(
'jquery',
['loader__js', 'jquery__config'],
function(provide, loader, cfg) {
function doProvide(preserveGlobal) {
provide(preserveGlobal? jQuery : jQuery.noConflict(true));
}
typeof jQuery !== 'undefined'?
doProvide(true) :
loader(cfg.url, doProvide);
});
Code and documentation copyright 2015 YANDEX LLC. Code released under the Mozilla Public License 2.0.
FAQs
[![NPM version](https://img.shields.io/npm/v/babel-plugin-bem.svg?style=flat)](https://www.npmjs.org/package/babel-plugin-bem)
We found that babel-plugin-bem demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.