sinwan-compiler 0.2.4 → 0.2.5

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.
package/README.md CHANGED
@@ -1,27 +1,50 @@
1
1
  # sinwan-compiler
2
2
 
3
- Shared compiler core for the SinwanJS framework. Provides the JSX transform, the project-wide reactive-prop analyzer, and the dev/HMR cache used by both the Bun and Vite plugins.
3
+ Shared compiler for [Sinwan](https://sinwanjs.com). App code usually never imports this package: **`bun-plugin-sinwan`** and **`vite-plugin-sinwan`** call it for you.
4
4
 
5
- ## Documentation
5
+ Use this package directly when you write a plugin, run a production analysis pass, or want to understand what the compiler changes in your JSX.
6
6
 
7
- See the [`docs/`](docs/) folder:
7
+ ## What it does
8
8
 
9
- - [Overview](docs/README.md)
10
- - [Analyzer](docs/analyzer.md)
11
- - [Transform](docs/transform.md)
12
- - [CLI](docs/cli.md)
13
- - [Plugins](docs/plugins.md)
14
- - [API reference](docs/api.md)
15
- - [Architecture](docs/architecture.md)
9
+ - **Transforms JSX** so reactive reads become lazy getters the runtime can track.
10
+ - **Hoists static markup** into reusable templates (including `ref` slots).
11
+ - **Wraps exported function components** with `cc()` when they look like components.
12
+ - **Analyzes the project** so static props stay static and only truly reactive props pay for an effect.
16
13
 
17
- ## Quick start
14
+ ## Install
18
15
 
19
16
  ```bash
20
- bunx sinwan-compiler analyze ./src ./.sinwan/reactive-props.json
17
+ bun add -d sinwan-compiler
21
18
  ```
22
19
 
23
- ## Installation
20
+ App templates already depend on the Bun or Vite plugin. You only need this package if you call the compiler yourself.
21
+
22
+ ## Production analysis
24
23
 
25
24
  ```bash
26
- bun add -d sinwan-compiler
25
+ bunx sinwan-compiler analyze ./src ./.sinwan/reactive-props.json
27
26
  ```
27
+
28
+ Then point the plugin at that file:
29
+
30
+ ```ts
31
+ sinwan({ analyze: "./.sinwan/reactive-props.json" });
32
+ ```
33
+
34
+ In development the plugins keep an incremental `AnalyzerCache` instead. You do not need to run the CLI for `bun run dev` / `vite`.
35
+
36
+ ## Documentation
37
+
38
+ | Guide | Topic |
39
+ | ----- | ----- |
40
+ | [Overview](docs/README.md) | How the pieces fit together |
41
+ | [Transform](docs/transform.md) | Wrapping rules, auto-`cc`, template hoisting |
42
+ | [Analyzer](docs/analyzer.md) | Cross-file reactive props, workspaces, cache |
43
+ | [CLI](docs/cli.md) | `analyze` command |
44
+ | [Plugins](docs/plugins.md) | Bun and Vite options |
45
+ | [API](docs/api.md) | Public TypeScript API |
46
+ | [Architecture](docs/architecture.md) | Internals for contributors |
47
+
48
+ ## License
49
+
50
+ MIT
package/dist/analyze.d.ts CHANGED
@@ -97,7 +97,6 @@ export declare class AnalyzerCache {
97
97
  private ensureAnalyzed;
98
98
  private collectAffected;
99
99
  private recomputeFor;
100
- private recompute;
101
100
  }
102
101
  export declare function analyze(options: AnalyzeOptions): void;
103
102
  export declare function loadMetadata(filePath: string): Map<string, Map<string, Set<string>>>;