# acute

> Modular build management for client side javascript applications.

Latest version **0.0.3** (published 2013-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install acute
pnpm add acute
yarn add acute
bun add acute
```

Provides the command `acute`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2013-12-20 |
| First published | 2013-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ~0.10.21 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mark Schad |
| Maintainers | markschad |
| Keywords | build, module, management, tools |

## Links

- npm: https://www.npmjs.com/package/acute
- Repository: https://github.com/markschad/acute.js
- Issues: https://github.com/markschad/acute.js
- npm.io page: https://npm.io/package/acute

## Dependencies (2)

- [async](https://npm.io/package/async.md) ~0.2.9
- [colors](https://npm.io/package/colors.md) ~0.6.2

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2013-12-20
- 0.0.2 — 2013-12-18
- 0.0.1 — 2013-12-18

## README

acute.js
========
*The no strings attached JavaScript build solution.*
>**Note:** This project is very much in its infancy.  Feel free to contribute to get it moving!

Why?
------------
Because organising your client side application shouldn't be a chore.  *acute.js* let's you do it however you please, and build it with a single command.

How?
----
At its core, *acute.js\* uses the `/// import` and `/// export` directives to describe a modules context in the project.  The triple-slash comments allows *acute.js* modules to be incredibly portable.

The *hello world!* example demonstrates, pretty much, all the components of *acute.js*.

Getting Started
---------------
*acute.js* is best installed globally.
> npm install -g acute

Now let's whip up a quick *hello world!* library to demonstrate *acute.js's* fool proof module system.

**hello.js**
```javascript
/// exports foo.hello from bar;
var bar = 'hello';
```
First we create a namespace `foo.hello` and give it the object `bar`.

**world.js**
```javascript
/// exports foo.world;
var world = 'world';
```
Now we create a namespace `foo.world` and it infers that it should receive the object `world`.

**example.js**
```javascript
/// exports example;
/// imports foo.hello;
/// imports foo.world to bar;
var example = function() {
  console.log(hello + ' ' + bar + '!');
};
```
This will be our entry point.  It creates a namespace `example` which infers the function we've defined and it also imports our namespaces `foo.hello` and `foo.world`.  In this instance we've imported `foo.world` as `bar`.

So how do build this trivial little example?  With an `acute.json` file of course!

**acute.json**
```json
{
  "root": "./",
  "public": {
    "example": "foo"
  },
  "output": "./build.js"
}
```
So what is this telling us?  Well assuming all our files are in the same directory, `acute.json` is going to instruct the compiler that all source files are located in the `./`, this directory; it wants to make the namespace `example` publically accessible as `window.foo`, and finally; it wants to output the result to a file ./build.js.
Now it's simply a matter of executing the *acute.js* compiler on the command line.
```bash
$ acute .
```
And voila!  We now have a portable JavaScript *hello world!* library!

API Reference
-------------

* [Directives](#dirctives)

###Directives
Directives are the meat of *acute.js*.  The following directives are currently defined.

####Built In Directives

**export namespace[ from identifier]**

>`namespace` A dot-delimited address describing where the module sits in the tree.

>`identifier` The name of the identifier in the module to export to the namespace.  This defaults to the most low-level namespace element.

**import namespace[ to identifier]**

>`namespace` A dot-delimited address describing where the module to import is located in the tree.

>`identifier` The name of the identifier to import the module to.  This defaults to the most low-level namespace element.

####Custom Directives
You can define your own directives by creating a `id.js` file in the `parser/directives` directory.  Directives take the following form.
```javascript
module.exports = function(module, args, done) {

  done(null, 'replacement');

};
```
The directive function takes the following arguments and its identifier is the name of the file it is defined in bar the extension.

>`module` An object containing the module currently being processed.  `module` has the following properties.

>* `path` The path to the source file the module is loaded from.
>* `source` The current state of the source code defining the module.
>* `imports` An array of namespace-alias pairs describing which modules to import.
>* `exports` A namespace-alias pair describing what and where to export.

>`args` The arguments passed to the directive.  This is simply the text after the directive identifier and before the newline, delimited by a space.

>`done` A callback to be executed when the directive has finished processing.  The done callback takes two arguments.

>* `err` An error if one was trigger.  May be set to null.

>* `replacement` A string to replace the directive with.  The default is `undefined`, removing the directive from the source.


Programmatic API
----------------
If you decide you would like to use *acute.js* in your Gruntfile, or anything else, you can execute a build by requiring acute in your source code.

```javascript
var $acute = require('acute');
$acute.make('./path/to/acute.json', function(err) {
  if (err) return console.log(err);
  console.log('All good man!');
);
```

Questions, Comments?
--------------------
Feel free to [email](mailto:mark.schad@gmail.com) or submit an issue!

Contributing
------------
To say *acute.js* is in its infancy would be an understatement.  Please feel free to contribute by forkng this repository and issuing a pull request!  Please maintain the coding style if you do!

---
_Source: https://npm.io/package/acute · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
