Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
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)
The npm package babel-plugin-bem receives a total of 16 weekly downloads. As such, babel-plugin-bem popularity was classified as not popular.
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.