@sola-air-ui/compiler 1.0.7 → 1.1.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.
- package/README.md +57 -0
- package/package.json +5 -4
- package/src/cli.js +0 -0
- package/src/index.js +1360 -716
- package/types/index.d.ts +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @sola-air-ui/compiler
|
|
2
|
+
|
|
3
|
+
Compiler for [Sola AIR](https://sola-air.dev) single-file `.sola` components — transforms `<script>` + template + `<style>` into a dependency-free ES module (or IIFE) that mounts real DOM nodes with fine-grained reactivity. No virtual DOM, no diffing.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sola-air-ui/compiler
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Programmatic use
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { compile } from '@sola-air-ui/compiler';
|
|
15
|
+
import { readFileSync } from 'node:fs';
|
|
16
|
+
|
|
17
|
+
const source = readFileSync('App.sola', 'utf-8');
|
|
18
|
+
const result = compile(source, {
|
|
19
|
+
target: 'esm', // or 'iife'
|
|
20
|
+
exportName: 'App', // used for iife builds
|
|
21
|
+
filename: 'App.sola', // improves error messages
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
console.log(result.code); // compiled JS
|
|
25
|
+
console.log(result.css); // scoped CSS
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## CLI
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx sola build App.sola
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## What a `.sola` file looks like
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<script>
|
|
38
|
+
let count = $state(0);
|
|
39
|
+
let doubled = $derived(() => count() * 2);
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<div>
|
|
43
|
+
<h1>Count: {count()}</h1>
|
|
44
|
+
<p>Doubled: {doubled()}</p>
|
|
45
|
+
<button onclick={() => count(count() + 1)}>+1</button>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<style>
|
|
49
|
+
h1 { color: #0ea5e9; font-weight: 800; }
|
|
50
|
+
</style>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Most projects won't call this package directly — use `@sola-air-ui/vite-plugin-sola` for a normal Vite dev/build setup, or the `sola-air` meta-package to install everything at once.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT — see the [repo root](https://github.com/rbm3267/sola-air) for the full license and [changelog](https://github.com/rbm3267/sola-air/blob/main/CHANGELOG.md).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sola-air-ui/compiler",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Compiler for Sola single-file components (.sola)
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Compiler for Sola single-file components (.sola) \u2014 transforms template + script + style to ES modules",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"homepage": "https://sola-air.dev",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/
|
|
28
|
+
"url": "git+https://github.com/Rbm3267/sola-air.git"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"acorn": "^8.10.0",
|
|
@@ -34,5 +34,6 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public",
|
|
36
36
|
"registry": "https://registry.npmjs.org/"
|
|
37
|
-
}
|
|
37
|
+
},
|
|
38
|
+
"types": "./types/index.d.ts"
|
|
38
39
|
}
|
package/src/cli.js
CHANGED
|
File without changes
|