A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Jam3/brfs-babel below:

Experience-Monks/brfs-babel: like brfs, but built on top of babel for es2015

This is like brfs, a browserify transform to inline static files, but built on top of Babel and its AST manipulations. This provides some new features, like ES2015 import support, various additional edge cases, cleaner code output, and source maps.

However, since this is a re-write and work in progress, this has some limitations and currently only supports fs.readFileSync and fs.readdirSync.

npm install brfs-babel --save

Once installed, you can use it as a replacement for brfs transform:

browserify index.js -t brfs-babel

It will handle ES2015 syntax, so it can be ordered before or after babelify. Or, you can choose to avoid babelify altogether, e.g. if you are targeting a new version of Node/Chrome/FF.

import { readFileSync } from 'fs';
import { join } from 'path';
const src = readFileSync(join(__dirname, 'hello.txt'), 'utf8');

And hello.txt is a text file containing the string "Hello, world!".

After transformation:

import { join } from 'path';
const src = 'Hello, World!';

The following fs functions are supported:

The following path functions will be evaluated statically when they are found inside the arguments of the above calls:

Some test cases are failing from brfs. This includes dynamic variables like this:

const path = '/foo.txt';
fs.readFileSync(__dirname + path, 'utf8');

As well as inline CommonJS usage, like this:

require('fs').readFileSync(__dirname + '/foo.txt', 'utf8');

MIT, see LICENSE.md for details.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4