jam 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +47 -46
  2. package/bin/jam.js +1 -1
  3. package/package.json +6 -5
package/README.md CHANGED
@@ -1,62 +1,63 @@
1
1
  # jam
2
2
 
3
- `jam` is an application server for isolated JavaScript. It runs JavaScript (and TypeScript) per request with isolated execution contexts, inspired by the PHP-FPM model.
3
+ `jam` serves JavaScript and TypeScript files as HTTP routes with isolated per-request execution.
4
4
 
5
5
  ## Usage
6
6
 
7
- ```bash
7
+ ```sh
8
8
  jam [flags] [scripts-dir]
9
9
  ```
10
10
 
11
- Run `jam --help` for all options:
12
-
13
- ```text
14
- Options:
15
- --port <port> TCP port to listen on.
16
- --host <host> Host or IP address to bind the TCP server to.
17
- --unix <path> Unix socket path to listen on instead of TCP.
18
- --php Enable PHP-style globals such as $_GET, $_POST, and $_SERVER.
19
- --public <dir> Directory for static files (checked before script routes).
20
- --access-log Enable per-request access log output.
21
- --config <path> Path to jamconfig.json (default: ./jamconfig.json).
22
- --env <KEY=VALUE> Set an env var for scripts; include multiple times.
23
- --log <path|-> Log destination ('-' for stdout, otherwise a file path).
24
- --log-level <error|warning|info|debug> Minimum log level to emit (default: info).
25
- --tls-cert <path> Path to TLS certificate PEM file.
26
- --tls-key <path> Path to TLS private key PEM file.
27
- --timeout-ms <ms> Maximum script execution time in milliseconds.
28
- --request-max-body-bytes <bytes> Maximum allowed request body size in bytes.
29
- --request-max-header-bytes <bytes> Maximum allowed request header size in bytes.
30
- --workers <count> Worker pool size (0 uses automatic sizing).
31
- --worker-memory-mb <mb> Per-worker memory limit in MB.
32
- --worker-max-requests <count> Recycle a worker after this many requests.
33
- --mode <value> Runtime mode string (commonly production or development).
34
- --error-page-404 <path> Path to a custom 404 error page.
35
- --error-page-500 <path> Path to a custom 500 error page.
36
- --help Print this help message and exit.
37
- --version Print version and exit.
38
-
39
- Examples:
40
- jam
41
- jam --port 3000
42
- jam ./app
43
- jam --php --public ./public ./app
11
+ ## Common Commands
12
+
13
+ ```sh
14
+ # Serve scripts from ./scripts on port 3000
15
+ jam ./scripts
16
+
17
+ # Development mode with detailed error pages
18
+ jam --mode development ./scripts
19
+
20
+ # Use a config file
21
+ jam --config ./jamconfig.json ./scripts
22
+
23
+ # Enable PHP-style globals
24
+ jam --php ./scripts
25
+ ```
26
+
27
+ For the complete CLI surface, run:
28
+
29
+ ```sh
30
+ jam --help
31
+ ```
32
+
33
+ ## Minimal Script
34
+
35
+ ```ts
36
+ export default {
37
+ fetch() {
38
+ return new Response("Hello from Jam");
39
+ }
40
+ };
44
41
  ```
45
42
 
46
- Warning and error messages are written to stderr, while info/debug messages are written to stdout when logging to stdout.
47
- When stderr is an interactive terminal, warning output is yellow and error output is red.
48
- Set `NO_COLOR` in the environment to force no colors.
43
+ Saved as `scripts/app.ts`, this route is available at `/app`.
44
+
45
+ ## Docs
46
+
47
+ - [Introduction](../../docs/001-introduction.md)
48
+ - [Getting Started](../../docs/002-getting-started.md)
49
+ - [Build a Real App](../../docs/003-writing-scripts.md)
50
+ - [Configuration](../../docs/004-configuration.md)
51
+ - [Runtime APIs](../../docs/005-runtime-apis.md)
52
+ - [Templates](../../docs/006-templates.md)
53
+ - [Deployment](../../docs/007-deployment.md)
49
54
 
50
55
  ## Development
51
56
 
52
57
  `jam` has two entry points with different roles:
53
58
 
54
- - `bin/jam.js`: Node-facing dispatch shim for the npm package.
55
- - This is what `npx jam` and `npm/yarn/pnpm` bin resolution executes.
56
- - It picks the correct platform package (`jam-darwin-arm64`, `jam-darwin-x64`, `jam-linux-arm64`, `jam-linux-x64`), installs it if needed, and forwards execution to its binary.
57
- - `src/entry.ts`: Bun runtime CLI entrypoint.
58
- - This is what gets compiled into each platform binary.
59
- - It should remain minimal and primarily call into `main` from `src/main.ts`.
60
- - CI and release scripts build it for each target.
59
+ - `bin/jam.js`: Node-facing dispatch shim for npm usage.
60
+ - `src/entry.ts`: Bun runtime CLI entrypoint compiled into platform binaries.
61
61
 
62
- The fallback path used in `bin/jam.js` (`../src/entry.ts`) is for local development when running from a checked out repo and the platform package binary is unavailable.
62
+ For repeatable runtime engineering workflows, see the repo-local skills index:
63
+ [`../../skills/README.md`](../../skills/README.md).
package/bin/jam.js CHANGED
@@ -11,7 +11,7 @@
11
11
  // If the platform package is not installed yet, this shim tries to install it
12
12
  // on demand via `npm install <platform-package>@<version> --no-save`.
13
13
  // If Bun is available in a local repo checkout and no platform package is
14
- // present, it falls back to running `src/main.ts` directly for development.
14
+ // present, it falls back to running `src/entry.ts` directly for development.
15
15
  //
16
16
  // `src/entry.ts` is the Bun source entrypoint used by platform package builds;
17
17
  // this file (`jam.js`) is the runtime dispatcher that selects and runs them.
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "jam",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "An application server for isolated JavaScript",
5
5
  "license": "MIT",
6
+ "author": "Michael Jackson <mjijackson@gmail.com>",
6
7
  "type": "module",
7
8
  "types": "types/index.d.ts",
8
9
  "repository": {
@@ -28,10 +29,10 @@
28
29
  ]
29
30
  },
30
31
  "optionalDependencies": {
31
- "jam-darwin-arm64": "0.9.2",
32
- "jam-darwin-x64": "0.9.2",
33
- "jam-linux-arm64": "0.9.2",
34
- "jam-linux-x64": "0.9.2"
32
+ "jam-darwin-arm64": "0.9.3",
33
+ "jam-darwin-x64": "0.9.3",
34
+ "jam-linux-arm64": "0.9.3",
35
+ "jam-linux-x64": "0.9.3"
35
36
  },
36
37
  "dependencies": {
37
38
  "@jridgewell/trace-mapping": "^0.3.31",