# jspackage

> build tool which adds client-side import syntax

Latest version **0.5.0** (published 2013-03-10) · MIT license · 0 weekly downloads

## Install

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

Provides the command `jspackage`.

## 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.5.0 |
| Published | 2013-03-10 |
| First published | 2012-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Andrew Kelley |
| Maintainers | superjoe |

## Links

- npm: https://www.npmjs.com/package/jspackage
- Repository: https://github.com/superjoe30/jspackage
- Issues: http://github.com/superjoe30/jspackage/issues
- npm.io page: https://npm.io/package/jspackage

## Dependencies (3)

- [async](https://npm.io/package/async.md) ~0.1.22
- [chokidar](https://npm.io/package/chokidar.md) ~0.5.3
- [optparse](https://npm.io/package/optparse.md) ~1.0.3

## Recent versions

- 0.5.0 (latest) — 2013-03-10
- 0.4.9 — 2012-09-05
- 0.4.8 — 2012-09-05
- 0.4.7 — 2012-07-25
- 0.4.6 — 2012-07-25
- 0.4.5 — 2012-07-14
- 0.4.4 — 2012-07-13
- 0.4.3 — 2012-07-12
- 0.4.2 — 2012-07-10
- 0.4.1 — 2012-07-10
- 0.4.0 — 2012-07-10
- 0.3.1 — 2012-07-09
- 0.3.0 — 2012-07-09
- 0.2.1 — 2012-07-08
- 0.2.0 — 2012-07-08
- … 3 more at https://npm.io/package/jspackage/versions

## README

# Bundle client side code with inline dependency declaration syntax

## Synopsis

    # in your source code, declare the files you depend on:
    
    #depend "some_js_file"
    #depend "or_some_coffee_file"
    #depend "even_coco_is_supported"
    #depend "some/path/and_livescript"

    # leave off the top-level function wrapper
    #depend "vendor/Audiolet" bare
    
    # some code using the files here.

In JavaScript, the `//depend` directive is used instead of `#depend`.

Be sure to install the languages you wish to use with `npm install -g`.

## Command line usage

When installed with `npm install jspackage -g`, a command line tool called
`jspackage` will be made available.

```
Usage: jspackage input_file output_file [options]

Available options:
  -h, --help       shows this help section
  -w, --watch      watch source files and recompile when any change
  -l, --lib PATH   add an additional search directory for source files
```

## Features

* File extensions are automatically resolved, and in fact are not allowed in
  depend statements. This goes for the input_file too.
* Files will only be included once in the resulting code, regardless of how
  many times a file is depended upon.
* Compiling CoffeeScript, JavaScript, Coco, LiveScript, and Iced CoffeeScript
  source files are included out of the box.  You can add more to the 
  `compile.extensions` object.
  - Or add support to the bottom of `lib/jspackage.js` and submit a pull
    request.
* Includes a `--watch` mode which automatically recompiles source files when
  they change.
* Ability to supply more source code search paths with `--lib`.
  
## Server example

```coffee
http = require 'http'
{compile} = require 'jspackage'

server = http.createServer (req, res) ->
  res.writeHead(200)
 
  compile {mainfile}, (err, compiled_code) ->
    if err
      res.end 'throw unescape("' + escape(err.toString()) + '");'
    else
      res.end compiled_code
 
server.listen(8080)
```

## Out-of-the-box supported languages

 * JavaScript
 * Coffee-Script
 * LiveScript
 * Coco
 * Iced-Coffee-Script

To add out-of-the-box support for another language, add it to the bottom of
`lib/jspackage.js` and submit a pull request.

To add support by wrapping the code, add an entry to the `extensions`
object:

```coffee
{extensions} = require 'jspackage'
extensions['.lua'] =
  require: 'npm-lua-package'
  compile: (code, options) ->
    require('npm-lua-package').compile(code, bare: options.bare)
  depend_re: /^--depend "(.+)"( bare)?$/gm
```

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