Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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 2 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.