1.0.1 • Published 5 years ago

mason-preprocessor v1.0.1

Weekly downloads
4
License
MIT
Repository
-
Last release
5 years ago

Mason

A preprocessor for both TypeScript and JavaScript.

Usage

let foo:string = '';
/*&<mason>
	mason.insert(fs.readFileSync('foo.txt', 'utf8'));
</mason>*/

console.log(foo); // After running the program through mason, this will print out the contents of foo.txt.

Configuration

Usage is similar to a tsconfig.json file, but with the following feilds:

{
	"outDir": "./foo/bar/baz/", // Specifies where to output files.
	"dependencies": [ // A list containing any of the built in modules, like fs or path.
		"fs"
	],
	"include": [ // Files to include while processing.
		"foo/bar.ts"
	],
	"exclude": [ // Files to exclude while processing.
		"foo/baz.ts"
	]
}

Node API

const fs = require('fs');
const mason = require('mason-preprocessor');
myCode = fs.readFileSync('foo.js', 'utf8');

const myCodeProcessed = mason.process(myCode, {
	dependencies: [
		"fs"
	]
});

CLI

mason [options] 

Options:
	-p, --project : Specify a specific masonconf.json file to use.
	-s, --silent : No messages during processing.

Why "mason"?

ma·son

/ˈmās(ə)n/ noun 1. a builder and worker in stone.

A "mason" is someone who builds things, and in this case Mason helps in the build process.

1.0.1

5 years ago

1.0.0

5 years ago