@finggujadhav/compiler 0.9.0 → 0.9.2
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/package.json +2 -3
- package/docs/policy.md +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finggujadhav/compiler",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "The FingguFlux static analysis and selector hardening engine.",
|
|
5
5
|
"main": "engine.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"engine.js",
|
|
11
11
|
"scanner.js",
|
|
12
|
-
"cli.js"
|
|
13
|
-
"docs/policy.md"
|
|
12
|
+
"cli.js"
|
|
14
13
|
],
|
|
15
14
|
"type": "module",
|
|
16
15
|
"engines": {
|
package/docs/policy.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# FingguFlux Compiler: Explicit Class Policy
|
|
2
|
-
|
|
3
|
-
To ensure 100% reliable tree-shaking and deterministic hashing, developers must adhere to the following class usage policy.
|
|
4
|
-
|
|
5
|
-
## 1. Explicit Class Strings
|
|
6
|
-
The compiler uses static analysis (regex) to identify used classes. It does **not** execute JavaScript. Therefore, class names must appear as full literal strings in your code.
|
|
7
|
-
|
|
8
|
-
### ❌ Prohibited: Concatenation
|
|
9
|
-
```javascript
|
|
10
|
-
// This will NOT be detected
|
|
11
|
-
const type = 'primary';
|
|
12
|
-
const className = 'ff-btn-' + type;
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### ✅ Recommended: Explicit Literals
|
|
16
|
-
```javascript
|
|
17
|
-
// This will be detected correctly
|
|
18
|
-
const className = isPrimary ? 'ff-btn-primary' : 'ff-btn-secondary';
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 2. Template Literals
|
|
22
|
-
Standard template literals are supported as long as the FingguFlux class is a discrete word.
|
|
23
|
-
|
|
24
|
-
### ✅ Supported
|
|
25
|
-
```html
|
|
26
|
-
<div class="ff-card ${isActive ? 'ff-shadow-lg' : ''}">
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## 3. Escape Hatch: Safelist
|
|
30
|
-
If you must use dynamic classes (e.g., from a CMS or database), add them to the `safelist` in your build configuration (to be implemented in Phase 7).
|
|
31
|
-
|
|
32
|
-
Currently, you can force inclusion by adding invisible comments in your template:
|
|
33
|
-
```html
|
|
34
|
-
<!-- ff-safelist: ff-btn ff-shadow-xl -->
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## 4. Determinism
|
|
38
|
-
Hashes are derived from class names.
|
|
39
|
-
- `ff-btn` will **always** hash to the same value across any project or build.
|
|
40
|
-
- Adding new classes does **not** affect existing hashes.
|