@jxsuite/compiler 0.10.2 → 0.11.0

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 (2) hide show
  1. package/README.md +78 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # `@jxsuite/compiler`
2
+
3
+ > Static HTML compiler, custom element emitter, and site builder for Jx.
4
+
5
+ ## Overview
6
+
7
+ The compiler transforms Jx `.json` documents into optimized production artifacts. It erases all Jx abstractions at build time — the output is plain HTML/CSS/JS with no JSON and no Jx-specific code shipped to browsers.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ bun add @jxsuite/compiler
13
+ ```
14
+
15
+ ## CLI
16
+
17
+ ```bash
18
+ # Build a site from project.json
19
+ jx build [project-root] [--verbose] [--no-clean]
20
+ ```
21
+
22
+ ## API
23
+
24
+ ```js
25
+ import { compile } from "@jxsuite/compiler";
26
+
27
+ const { html, files } = await compile("./counter.json", {
28
+ title: "My App",
29
+ projectStyle: null,
30
+ });
31
+ ```
32
+
33
+ ## Compilation routes
34
+
35
+ The compiler auto-detects the appropriate output target:
36
+
37
+ | Route | Condition | Output |
38
+ | ------------------ | -------------------------------- | --------------------------------- |
39
+ | 0 — Class | Input is `.class.json` | ES class module |
40
+ | 1 — Static | No dynamic bindings | Plain HTML/CSS, zero JS |
41
+ | 2 — Custom element | Root `tagName` contains a hyphen | `HTMLElement` subclass + lit-html |
42
+ | 3 — Dynamic page | Dynamic, standard `tagName` | Pre-rendered HTML + reactive JS |
43
+ | 4 — Server | Has `timing: "server"` entries | Hono server handler |
44
+
45
+ ## Site builder
46
+
47
+ ```js
48
+ import { buildSite } from "@jxsuite/compiler/site";
49
+
50
+ const result = await buildSite("./my-site", { verbose: true, clean: true });
51
+ // { routes: 12, files: 36, errors: [] }
52
+ ```
53
+
54
+ `buildSite` reads `project.json`, resolves all pages/layouts/components, runs each through the compiler, and writes the output to `build.outDir` (default `./dist`).
55
+
56
+ ## Exports
57
+
58
+ | Export | Description |
59
+ | ---------------------------- | ------------------------------------ |
60
+ | `compile(src, opts)` | Compile a single Jx document |
61
+ | `compileClient(doc, opts)` | Dynamic page with reactive hydration |
62
+ | `compileElement(doc, opts)` | Custom element module |
63
+ | `compileServer(src, opts)` | Hono server handler |
64
+ | `compileSiteServer(entries)` | Site-wide server bundle |
65
+ | `isDynamic(doc)` | Detect whether a document needs JS |
66
+
67
+ ## Dependencies
68
+
69
+ | Package | Purpose |
70
+ | ---------------------- | ---------------------- |
71
+ | `@jxsuite/parser` | Markdown transpilation |
72
+ | `@jxsuite/runtime` | Shared utilities |
73
+ | `sharp` | Image optimization |
74
+ | `unified` / `remark-*` | Markdown processing |
75
+
76
+ ## License
77
+
78
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/compiler",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "description": "Jx static HTML compiler, island detector, and site builder",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@apidevtools/json-schema-ref-parser": "^15.3.5",
40
- "@jxsuite/parser": "^0.10.1",
41
- "@jxsuite/runtime": "^0.10.1",
40
+ "@jxsuite/parser": "^0.10.2",
41
+ "@jxsuite/runtime": "^0.10.2",
42
42
  "remark-gfm": "^4.0.1",
43
43
  "remark-stringify": "^11.0.0",
44
44
  "sharp": "^0.34.5",