SHIFT + D

Filter by package

  • Overview
  • Ancestor variants
  • Composition
  • Edge
  • Features
  • Linear numeric
  • Logic
  • Prose
  • Source transform
  • SPA links
  • Utilities

What is Baleada Source Transform?

Updated on August 22, 2024

Baleada Source Transform is an absurdly flexible tool that can transform the contents of any file during your site or app's build step.

It handles the most basic implementation details of Webpack loaders and Rollup plugins, then lets you transform the contents of any source file in any way you see fit, using a consistent, build tool agnostic, simple workflow.

In other words, Baleada Source Transform abstracts build tool boilerplate so you can write more reusable build code.

Baleada Source Transform abstracts build tool boilerplate so you can write more reusable build code.

Workflow

Abstractly, Baleada Source Transform's workflow is:

  1. Configure your build tool to use Baleada Source Transform
  2. Write a transform function that will transform the source
  3. Pass your transform function into Baleada Source Transform

For more guidance on how to configure your build tool to use Baleada Source Transform and how to pass your transform function into Baleada Source Transform, see the dedicated guides for each build tool:

However, the way you write your transform function is always the same. Regardless of the build tool, your transform function will receive one argument—an object with the following properties:

Property
Type
Description
source
String
The contents of the file being transformed.
id
String
The file path of the file being trasnformed.
context
Object

The context object provided by the build tool.

This is different for each build tool—see the dedicated guide for each build tool for more info.

utils
Object

An object whose properties contain utility functions.

This is different for each build tool—see the dedicated guide for each build tool for more info.

Most of the time, your transform function will return the transformed source as a String. However, depending on the build tool you use, you can return other things. The dedicated guides for each build tool have more information:

Language, compilation, browser support, and dependencies

Baleada Source Transform is written in modern JavaScript and compiled using Babel to support Node. It's not designed to be used in the browser, but instead will most often be used in the Node environment along with your build tools.

Baleada Source Transform dependends on:

Semantic versioning conventions

Any changes to the Baleada Source Transform workflow, including changes to the top-level keys of the object passed to your transform function, will trigger a new major release.

If the loader-utils, schema-utils, or @rollup/pluginutils packages change the functions they provide, or change the way those functions work, that would only trigger a new minor release.

TableUsing with Rollup

Edit doc on GitHub

ON THIS PAGE

What is Baleada Source Transform?WorkflowLanguage, compilation, browser support, and dependenciesSemantic versioning conventions