npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@i18n-bakery/baker

v1.0.9

Published

The Pastry Chef. Precision-obsessed expert dealing with delicate file structures, compiling assets, and optimizing ingredients for the final bake.

Downloads

173

Readme

🥯 @i18n-bakery/baker

"The Pastry Chef" - Precision-obsessed expert dealing with delicate file structures, compiling assets, and optimizing ingredients for the final bake.

This package is the heavy machinery of the operation. It keeps the Core lightweight by taking on all the complex build-time tasks: parsing ASTs, handling file systems, compiling artifacts, and encrypting confidential recipes.

npm version License: MIT


🎯 Purpose

  • Build-Time Logic: Keeps the @i18n-bakery/core package lightweight (0 dependencies).
  • File System Operations: Handles reading, writing, and managing translation files.
  • Extraction: Parses source code to find translation keys (t() calls).
  • Compilation ("Baking"): Optimizes translation files for production (minification, hashing, splitting).
  • Encryption: Secures translation files using AES-256-GCM.

📦 Features

1. Key Extraction (KeyExtractor)

Uses Babel to parse TypeScript/JavaScript files and extract translation keys, default values, and namespaces.

import { BabelKeyExtractor } from "@i18n-bakery/baker";

const extractor = new BabelKeyExtractor();
const keys = await extractor.extractFromFile("src/components/Button.tsx");

2. Baking & Compilation (BakingManager)

Compiles translation files into production-ready assets.

  • Minification: Reduces file size.
  • Hashing: Adds content hashes for cache busting (common.a1b2c3.json).
  • Splitting: Splits bundles by namespace for lazy loading.
  • Encryption: Encrypts content with a secret key.
import { BakingManager } from "@i18n-bakery/baker";

const baker = new BakingManager();
await baker.bake("src/locales", {
  out: "dist/locales",
  minify: true,
  hash: true,
  split: true,
  encrypt: true,
  key: process.env.I18N_SECRET,
});

3. File Management (TranslationFileManager)

Manages the creation and updating of translation files, preserving existing values and structure.

  • Auto-creation: Automatically creates missing files and keys.
  • Merging: Smart merging of new keys without overwriting existing translations.
  • Variable Detection: Detects variables in translation strings.
  • Multiple Formats: Support for JSON and TOML file formats.

4. TOML Format Support

Full support for TOML (Tom's Obvious, Minimal Language) format with zero external dependencies.

  • Zero Dependencies: Pure TypeScript TOML parser and serializer.
  • TOML v1.0.0 Compliant: Follows the official specification.
  • Security First: Built-in prototype pollution prevention.
  • Nested & Flat Structures: Support for both file organization styles.

See TOML_SUPPORT.md for detailed documentation.

import { TOMLFileWriter, TOMLFileSaver } from "@i18n-bakery/baker";

// Use TOML writer
const writer = new TOMLFileWriter(fsManager);
await writer.write("./locales/en/common.toml", content);

// Or use simple saver
const saver = new TOMLFileSaver("./locales", "nested");
await saver.save("en", "common", "title", "Welcome");

🛠️ Architecture

This package follows Clean Architecture principles:

  • Domain: Core interfaces and business logic rules.
  • Use Cases: Application-specific business rules (BakingManager, TranslationFileManager).
  • Adapters: Concrete implementations (BabelKeyExtractor, JSONFileSaver, TOMLFileSaver, TOMLFileWriter, NodeFileSystemManager).

📦 Installation

npm install @i18n-bakery/baker
# or
pnpm add @i18n-bakery/baker

🤝 Dependencies

  • @i18n-bakery/core: Shared types and logic.
  • fs-extra: Enhanced file system operations.
  • glob: File pattern matching.
  • @babel/parser, @babel/traverse: AST parsing for extraction.

📜 License

MIT © Arturo Sáenz


🙏 Support


🥐 Heavy-lifting tools for your i18n build pipeline

Made with 🍩 and File System Magic