Provides a simple CLI that takes a bare-bundle generated by bare-pack and transforms each file in the bundle. You can use this to alter code that's incompatible with bare while bundling, like regex patterns using the /u flag.
npm i [-g] bare-bundle-transformPlugins must export a single default function with the following signature (for a specific example, see the local babel plugin used in the tests):
/**
* @param {Bundle} bare - bare bundle being transformed
* @param {Object} file - file being transformed
* @param {string} file.name - file path
* @param {Buffer} file.data - file contents
* @param {number} file.mode - unix file mode (octal)
*/
function plugin(bundle, { name, data, mode }) {
// see https://github.com/holepunchto/bare-bundle/ for bundle API
}
module.exports = pluginA local plugin like ./babel.js can then be applied to a bundle generated by bare-pack like so:
bare-pack ./app.js | bare-bundle-transform --plugin ./babel.js -o ./app.bundleYou can also turn plugins into node modules (EX: bare-bundle-transform-plugin-babel) and then run them like so:
bare-pack ./app.js | bare-bundle-transform --plugin bare-bundle-transform-plugin-babel -o ./app.bundleTransform the bundle located at [bundle]. If no bundle is supplied, will read whatever is passed into stdin. If --out is provided, the transformed bundle will be written to the specified file. Otherwise, the bundle will be written to stdout.
Flags include:
--version|-v
--out|-o <path>
--plugin <path>