fazer-lang 2.1.2 → 2.2.1
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 +37 -216
- package/fazer.js +312 -85
- package/package.json +11 -9
- package/apply_icon.js +0 -28
- package/apply_icon_robust.js +0 -51
- package/bin/fazer.exe +0 -0
- package/package.json.bak +0 -44
- package/standalone.bundled.js +0 -12910
- package/standalone.js +0 -186
- package/test.fz +0 -92
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fazer Corp
|
|
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
CHANGED
|
@@ -1,241 +1,62 @@
|
|
|
1
|
-
# Fazer
|
|
1
|
+
# Fazer
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> *Copyright © 2026 L'EMPRISE. All Rights Reserved.*
|
|
3
|
+
**Fazer** is a powerful, concise scripting language designed for automation, security, and data processing. It features a unique syntax with pipe operators (`→>`), pattern matching (`case`), and a batteries-included standard library.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## 1. Introduction
|
|
12
|
-
|
|
13
|
-
**Fazer (fz)** is not just another scripting language. It is a precision tool engineered by **L'EMPRISE** for developers who demand **clarity**, **security**, and **efficiency**.
|
|
14
|
-
|
|
15
|
-
Unlike traditional languages that bury logic in verbose syntax, Fazer prioritizes the **Data Flow**. By utilizing the revolutionary Arrow Pipe Operator (`→>`), Fazer allows data to flow naturally from one operation to the next, mirroring the human thought process.
|
|
16
|
-
|
|
17
|
-
### Why Fazer?
|
|
18
|
-
|
|
19
|
-
* **Superior Readability**: Logic flows left-to-right. No more nesting hell `func(func(func(x)))`.
|
|
20
|
-
* **Security First**: AES-256-GCM encryption is a first-class citizen, not an afterthought.
|
|
21
|
-
* **Batteries Included**: HTTP Server, FileSystem, System Execution, and JSON parsing are built-in. No external dependencies required for standard tasks.
|
|
22
|
-
* **Universal Compatibility**: Runs on any Node.js environment or compiles to a standalone, dependency-free Binary (EXE/Linux).
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## 2. Installation
|
|
27
|
-
|
|
28
|
-
### Global Installation (Recommended)
|
|
29
|
-
To access the `fazer` command globally on your system:
|
|
7
|
+
Install Fazer globally using npm:
|
|
30
8
|
|
|
31
9
|
```bash
|
|
32
10
|
npm install -g fazer-lang
|
|
33
11
|
```
|
|
34
12
|
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
fazer --version
|
|
38
|
-
# Output: 2.1.0
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## 3. The Core Philosophy: The Pipe (`→>`)
|
|
44
|
-
|
|
45
|
-
In most languages, you write:
|
|
46
|
-
```javascript
|
|
47
|
-
// JavaScript / Python style
|
|
48
|
-
print(sha256(readFile("data.txt")));
|
|
49
|
-
```
|
|
50
|
-
This requires reading "inside-out".
|
|
51
|
-
|
|
52
|
-
**In Fazer, you write:**
|
|
53
|
-
```fazer
|
|
54
|
-
"data.txt" →> readText() →> sha256() →> print()
|
|
55
|
-
```
|
|
56
|
-
This is the **Pipeline Architecture**. The result of the left side is automatically injected as the *first argument* of the function on the right.
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## 4. Language Guide
|
|
61
|
-
|
|
62
|
-
### Variables & Constants
|
|
63
|
-
Fazer uses dynamic typing. Variables are declared implicitly.
|
|
64
|
-
|
|
65
|
-
```fazer
|
|
66
|
-
x = 10
|
|
67
|
-
name = "L'EMPRISE"
|
|
68
|
-
isActive = true
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Data Types
|
|
72
|
-
* **String**: `"Hello World"` (supports concatenation with `+`)
|
|
73
|
-
* **Number**: `42`, `3.14`
|
|
74
|
-
* **Boolean**: `true`, `false`
|
|
75
|
-
* **Object/Map**: `{"key": "value"}`
|
|
76
|
-
* **Null**: `null`
|
|
77
|
-
|
|
78
|
-
### Control Flow: The Power of `case`
|
|
79
|
-
Fazer replaces the archaic `if/else/switch` with a unified, powerful `case` structure.
|
|
80
|
-
|
|
81
|
-
```fazer
|
|
82
|
-
fn analyze(val) →
|
|
83
|
-
case val
|
|
84
|
-
0 → println("Zero detected") end
|
|
85
|
-
> 100 → println("High value detected") end
|
|
86
|
-
"admin" → println("Access Granted") end
|
|
87
|
-
else → println("Unknown value") end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Functions (`fn`)
|
|
93
|
-
Functions are first-class citizens.
|
|
94
|
-
|
|
95
|
-
```fazer
|
|
96
|
-
fn multiply(a, b) →
|
|
97
|
-
return(a * b)
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
# Using with pipe
|
|
101
|
-
5 →> multiply(10) →> println() # Output: 50
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
---
|
|
13
|
+
## Usage
|
|
105
14
|
|
|
106
|
-
|
|
15
|
+
Run the REPL (interactive mode):
|
|
107
16
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
### 5.1. Input / Output & UI (`IO`)
|
|
111
|
-
|
|
112
|
-
* **`print(val)`**: Prints value to stdout (no newline).
|
|
113
|
-
* **`println(val)`**: Prints value with newline.
|
|
114
|
-
* **`ask(prompt)`**: Pauses execution and waits for user input. Returns the string entered.
|
|
115
|
-
* **`style(text, color)`**: Applies ANSI colors to text.
|
|
116
|
-
* *Colors*: `"red"`, `"green"`, `"yellow"`, `"blue"`, `"magenta"`, `"cyan"`, `"white"`, `"gray"`.
|
|
117
|
-
* **`box(title, lines...)`**: Renders a professional ASCII interface box. Automatically handles alignment and ANSI codes.
|
|
118
|
-
|
|
119
|
-
```fazer
|
|
120
|
-
box("SYSTEM ALERT", "Access Restricted", style("L'EMPRISE Protocol", "red"))
|
|
17
|
+
```bash
|
|
18
|
+
fazer
|
|
121
19
|
```
|
|
122
20
|
|
|
123
|
-
|
|
124
|
-
**Security Level: Military Grade (AES-256-GCM).**
|
|
21
|
+
Run a script:
|
|
125
22
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
* **`decText(encryptedJson, password)`**: Decrypts the JSON string. Throws error if password is wrong or integrity is compromised.
|
|
129
|
-
|
|
130
|
-
```fazer
|
|
131
|
-
pass = "super_secret"
|
|
132
|
-
"My Secret Data" →> encText(pass) →> saveText("secret.enc")
|
|
23
|
+
```bash
|
|
24
|
+
fazer my_script.fz
|
|
133
25
|
```
|
|
134
26
|
|
|
135
|
-
|
|
136
|
-
Robust, synchronous file operations.
|
|
27
|
+
## Features
|
|
137
28
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
29
|
+
- **Pipe Operator**: Chain functions easily: `readText("in.txt") →> encText(pass) →> writeText("out.enc")`
|
|
30
|
+
- **Pattern Matching**: Expressive control flow with `case`
|
|
31
|
+
- **Batteries Included**: Built-in modules for:
|
|
32
|
+
- File System (`readText`, `writeText`, `ls`, `exists`)
|
|
33
|
+
- Cryptography (`aes-256-gcm`, `sha256`)
|
|
34
|
+
- Networking (`fetch`, `server`, `discord`)
|
|
35
|
+
- JSON (`json`, `parseJson`)
|
|
36
|
+
- System (`exec`, `env`, `argv`)
|
|
37
|
+
- **Single File**: The runtime is compact and efficient.
|
|
146
38
|
|
|
147
|
-
|
|
148
|
-
Create high-performance web servers instantly.
|
|
39
|
+
## Example
|
|
149
40
|
|
|
150
|
-
* **`server(port, handlerFunctionName)`**: Starts a blocking HTTP server.
|
|
151
|
-
|
|
152
|
-
**Example Web Server:**
|
|
153
41
|
```fazer
|
|
154
|
-
fn
|
|
155
|
-
|
|
156
|
-
|
|
42
|
+
fn main() →
|
|
43
|
+
println(style("Welcome to Fazer", "cyan"))
|
|
44
|
+
|
|
45
|
+
files := ls(".")
|
|
46
|
+
println("Found " + len(files) + " files.")
|
|
157
47
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
48
|
+
case exists("secret.txt")
|
|
49
|
+
true →
|
|
50
|
+
content := readText("secret.txt")
|
|
51
|
+
println("Secret content: " + content)
|
|
52
|
+
end
|
|
53
|
+
else → end
|
|
54
|
+
end
|
|
163
55
|
end
|
|
164
56
|
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 5.5. System & Utilities (`Sys`)
|
|
169
|
-
|
|
170
|
-
* **`exec(command)`**: Executes a shell command and returns the output (stdout).
|
|
171
|
-
* **`json(obj)`**: Serializes an object/array to a JSON string.
|
|
172
|
-
* **`parseJson(jsonString)`**: Parses a JSON string into an object.
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
## 6. Advanced Usage: Building Standalone Executables
|
|
177
|
-
|
|
178
|
-
You can compile your Fazer scripts into standalone executables (`.exe` for Windows, binary for Linux) that do not require Node.js or Fazer to be installed on the target machine.
|
|
179
|
-
|
|
180
|
-
**Command:**
|
|
181
|
-
```bash
|
|
182
|
-
# Requires 'pkg' installed via npm
|
|
183
|
-
pkg fazer.js --targets node18-win-x64,node18-linux-x64 --output my_app
|
|
57
|
+
main()
|
|
184
58
|
```
|
|
185
59
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## 8. Fazer vs The World: A Technical Comparison
|
|
191
|
-
|
|
192
|
-
Why choose Fazer when you have JavaScript, Python, or Go? Because Fazer is designed for a specific purpose: **High-level Orchestration with Low-level Power**.
|
|
193
|
-
|
|
194
|
-
### 8.1. Fazer vs JavaScript / Node.js
|
|
195
|
-
|
|
196
|
-
* **The Problem with JS**: "Callback Hell" and "Promise Chaining". JavaScript forces you to write code "inside-out" or manage endless `.then()` chains.
|
|
197
|
-
* *JS*: `process(parse(read(file)))`
|
|
198
|
-
* **The Fazer Solution**: Linear data flow. The pipe operator (`→>`) is not just sugar; it's the core of the language.
|
|
199
|
-
* *Fazer*: `file →> read() →> parse() →> process()`
|
|
200
|
-
* **Ecosystem**: To get encryption, HTTP server, and file system operations in Node.js, you often need to install external packages or write boilerplate code using `fs`, `http`, and `crypto` modules. Fazer includes these batteries **natively**. `encText` and `server` are there from line 1.
|
|
201
|
-
|
|
202
|
-
### 8.2. Fazer vs Python
|
|
203
|
-
|
|
204
|
-
* **Distribution**: Sharing a Python script is painful. The user needs Python installed, then `pip install -r requirements.txt`, and version conflicts are common.
|
|
205
|
-
* **Fazer's Edge**: Fazer compiles to a **single, standalone binary** (EXE for Windows, Bin for Linux). You give the file to the user, they double-click, and it runs. No installation, no dependencies, no friction.
|
|
206
|
-
* **Performance**: While Python interprets line-by-line, Fazer's lightweight runtime is optimized for rapid I/O and cryptographic operations, making it feel snappier for CLI tools.
|
|
207
|
-
|
|
208
|
-
### 8.3. Fazer vs Bash / Shell
|
|
209
|
-
|
|
210
|
-
* **Cross-Platform Nightmare**: A Bash script written for Linux often fails on Windows (PowerShell/CMD) or macOS due to syntax differences (`ls` vs `dir`, `/` vs `\`).
|
|
211
|
-
* **Fazer's Universality**: Fazer abstracts the operating system. `ls()`, `rm()`, and `exec()` work identically on Windows, Linux, and macOS. Write once, control any system.
|
|
212
|
-
* **Safety**: Bash has no real error handling or types. A wrong variable expansion can delete your hard drive (`rm -rf /$VAR`). Fazer provides a structured, safe environment with scoped variables and error handling.
|
|
213
|
-
|
|
214
|
-
### 8.4. Fazer vs C/C++
|
|
215
|
-
|
|
216
|
-
* **Development Speed**: Writing a secure HTTP server with AES encryption in C++ takes days and hundreds of lines of code. In Fazer, it takes **5 lines**.
|
|
217
|
-
* **Memory Safety**: No manual memory management, no buffer overflows, no segmentation faults. Fazer handles the dirty work so you can focus on the logic.
|
|
218
|
-
|
|
219
|
-
### Summary Table
|
|
220
|
-
|
|
221
|
-
| Feature | Fazer | JavaScript | Python | Bash |
|
|
222
|
-
| :--- | :---: | :---: | :---: | :---: |
|
|
223
|
-
| **Pipeline Logic** | ✅ Native (`→>`) | ❌ (Plugins needed) | ❌ | ✅ (Pipes `|`) |
|
|
224
|
-
| **Distribution** | ✅ Single Binary | ❌ (Requires Runtime) | ❌ (Complex) | ✅ (Source only) |
|
|
225
|
-
| **Cryptography** | ✅ Built-in AES-256 | ⚠️ Module required | ⚠️ Module required | ❌ External tools |
|
|
226
|
-
| **Cross-Platform** | ✅ 100% | ✅ | ✅ | ❌ |
|
|
227
|
-
| **Setup Time** | ⚡ Instant | 🐢 Slow (npm install) | 🐢 Slow (pip install) | ⚡ Instant |
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## 9. Copyright & Legal
|
|
232
|
-
|
|
233
|
-
**Fazer Language** is a proprietary technology developed by **L'EMPRISE**.
|
|
234
|
-
Unauthorized reproduction of the core interpreter logic without attribution is prohibited.
|
|
235
|
-
|
|
236
|
-
* **Copyright**: © 2026 L'EMPRISE.
|
|
237
|
-
* **License**: MIT (Open Source for usage).
|
|
238
|
-
|
|
239
|
-
---
|
|
60
|
+
## License
|
|
240
61
|
|
|
241
|
-
|
|
62
|
+
MIT
|