
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@fluent/dom
Advanced tools
@fluent/dom
provides the DOM bindings for Project Fluent.
@fluent/dom
can be used both on the client-side and the server-side. You
can install it from the npm registry or use it as a standalone script (as the
FluentDOM
global).
npm install @fluent/dom
The DOMLocalization
constructor provides the core functionality of
full-fallback ready message formatting. It uses a lazy-resolved
FluentBundle
objects from the @fluent/bundle
package to format messages.
On top of that, DOMLocalization
can localize any DOMFragment by
identifying localizable elements with data-l10n-id
and translating them.
import { DOMLocalization } from "@fluent/dom";
const l10n = new DOMLocalization(
["/browser/main.ftl", "/toolkit/menu.ftl"],
generateBundles
);
l10n.connectRoot(document.documentElement);
l10n.translateRoots();
const h1 = document.querySelector("h1");
// Sets `data-l10n-id` and `data-l10n-args` which triggers
// the `MutationObserver` from `DOMLocalization` and translates the
// element.
l10n.setAttributes(h1, "welcome", { user: "Anna" });
For imperative uses straight from the JS code, there's also a Localization
class that provides just the API needed to format messages in the running code.
import { Localization } from "@fluent/dom";
function* generateBundles() {
// Some lazy logic for yielding FluentBundles.
yield* [bundle1, bundle2];
}
const l10n = new Localization(
document,
["/browser/main.ftl", "/toolkit/menu.ftl"],
generateBundles
);
async function main() {
const msg = await l10n.formatValue("welcome", { name: "Anna" });
// → 'Welcome, Anna!'
}
FAQs
Fluent bindings for DOM
The npm package @fluent/dom receives a total of 4,034 weekly downloads. As such, @fluent/dom popularity was classified as popular.
We found that @fluent/dom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.