@collie-lang/compiler 1.0.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/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/index.cjs +2035 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +139 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.js +2003 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Collie Coders
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @collie-lang/compiler
|
|
2
|
+
|
|
3
|
+
Collie compiler core (MVP stub).
|
|
4
|
+
|
|
5
|
+
## Class aliases
|
|
6
|
+
|
|
7
|
+
The compiler understands a top-level `classes` block that acts as a macro table for CSS/Tailwind tokens. Each block must live at indent level 0 and appear before the first real template node (`div`, text, expressions, conditionals). Multiple `classes` blocks are allowed (even when separated by `props`) and all aliases are merged:
|
|
8
|
+
|
|
9
|
+
```collie
|
|
10
|
+
classes
|
|
11
|
+
baseContainer = container.mx-auto.p-6
|
|
12
|
+
|
|
13
|
+
props
|
|
14
|
+
user: User
|
|
15
|
+
|
|
16
|
+
classes
|
|
17
|
+
adminPanel = mt-4.bg-red-100.text-red-700
|
|
18
|
+
|
|
19
|
+
div.$baseContainer.flex
|
|
20
|
+
@if user.role === "admin"
|
|
21
|
+
div.$adminPanel.rounded
|
|
22
|
+
"Admin tools"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Alias names follow JS identifier rules and must be indented exactly one level under the block header. Within selector syntax you can reference them via `$aliasName`; the compiler expands them in place so the resulting JSX only contains literal classes (duplicates are preserved). Declaring the same alias twice or referencing an undefined alias produces diagnostics.
|
|
26
|
+
|
|
27
|
+
Alias handling is a compile-time affordance only. The core compiler does not attempt to synthesize aliases when converting from TSX back to Collie—the VS Code extension (or other tooling) will keep literal classes unless you explicitly opt into aliases.
|