fazer-lang 0.1.0 β 2.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 +137 -0
- package/apply_icon.js +28 -0
- package/apply_icon_robust.js +51 -0
- package/bin/fazer.exe +0 -0
- package/fazer.js +1192 -139
- package/package.json +38 -44
- package/package.json.bak +44 -0
- package/standalone.bundled.js +12910 -0
- package/standalone.js +186 -0
- package/test.fz +92 -0
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Fazer Language (fz)
|
|
2
|
+
|
|
3
|
+
> **The Unique, High-Performance Scripting Language for the Modern Era.**
|
|
4
|
+
> "Batteries included" logic, powerful pipes, and unbreakable security.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/fazer-lang)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
Fazer is a new interpreted language designed for **speed**, **readability**, and **power**. It combines the best of functional programming (pipes) with imperative simplicity.
|
|
10
|
+
|
|
11
|
+
## π Features
|
|
12
|
+
|
|
13
|
+
* **Unique Syntax**: Use the Arrow Pipe `β>` to chain operations like a pro.
|
|
14
|
+
* **Batteries Included**:
|
|
15
|
+
* π **Crypto**: AES-256-GCM, SHA256 built-in.
|
|
16
|
+
* π **HTTP Server**: Create web servers in 3 lines of code.
|
|
17
|
+
* π **Filesystem**: Read, write, check existence, manipulate paths.
|
|
18
|
+
* π» **System**: Execute shell commands, handle JSON natively.
|
|
19
|
+
* **Visuals**: Built-in support for colored output (`style`) and UI boxes (`box`).
|
|
20
|
+
* **Portable**: Runs anywhere Node.js runs (or compiles to a standalone EXE).
|
|
21
|
+
|
|
22
|
+
## π¦ Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g fazer-lang
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## β‘ Quick Start
|
|
29
|
+
|
|
30
|
+
Create a file `hello.fz`:
|
|
31
|
+
|
|
32
|
+
```fazer
|
|
33
|
+
fn main() β
|
|
34
|
+
box("WELCOME", "Hello from Fazer!", style("Power is yours.", "cyan"))
|
|
35
|
+
|
|
36
|
+
# Pipe magic
|
|
37
|
+
"secret message" β> sha256() β> println()
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
main()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Run it:
|
|
44
|
+
```bash
|
|
45
|
+
fazer run hello.fz
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## π Ultra-Precise Documentation
|
|
49
|
+
|
|
50
|
+
### 1. The Pipe Operator (`β>`)
|
|
51
|
+
The heart of Fazer. It passes the result of the left expression as the *first argument* to the function on the right.
|
|
52
|
+
|
|
53
|
+
```fazer
|
|
54
|
+
# Standard
|
|
55
|
+
println(sha256("text"))
|
|
56
|
+
|
|
57
|
+
# Fazer Style
|
|
58
|
+
"text" β> sha256() β> println()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2. Control Flow
|
|
62
|
+
|
|
63
|
+
**Functions (`fn`)**
|
|
64
|
+
```fazer
|
|
65
|
+
fn add(a, b) β
|
|
66
|
+
return(a + b)
|
|
67
|
+
end
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Pattern Matching (`case`)**
|
|
71
|
+
Instead of boring `if/else`, use `case`:
|
|
72
|
+
|
|
73
|
+
```fazer
|
|
74
|
+
case x
|
|
75
|
+
10 β println("It is ten") end
|
|
76
|
+
> 10 β println("Greater than ten") end
|
|
77
|
+
else β println("Something else") end
|
|
78
|
+
end
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Built-in Modules (Standard Library)
|
|
82
|
+
|
|
83
|
+
#### π₯οΈ I/O & UI
|
|
84
|
+
* `println(x)`: Print to stdout with newline.
|
|
85
|
+
* `print(x)`: Print without newline.
|
|
86
|
+
* `ask(prompt)`: Read user input.
|
|
87
|
+
* `style(text, color)`: Colorize text (red, green, blue, cyan, yellow, etc.).
|
|
88
|
+
* `box(title, lines...)`: Draw a beautiful ASCII box (handles ANSI colors correctly!).
|
|
89
|
+
|
|
90
|
+
#### π File System
|
|
91
|
+
* `readText(path)` / `saveText(content, path)`
|
|
92
|
+
* `readB64(path)` / `saveB64(content, path)`
|
|
93
|
+
* `exists(path)`: Returns true/false.
|
|
94
|
+
* `ls(dir)`: List files.
|
|
95
|
+
* `rm(path)`: Delete file/dir (recursive).
|
|
96
|
+
* `mkdir(path)`: Create directory.
|
|
97
|
+
|
|
98
|
+
#### π Cryptography (AES-256-GCM)
|
|
99
|
+
* `encText(text, pass)`: Encrypt text.
|
|
100
|
+
* `decText(b64, pass)`: Decrypt text.
|
|
101
|
+
* `sha256(data)`: Hash data.
|
|
102
|
+
|
|
103
|
+
#### π Network & System (NEW!)
|
|
104
|
+
* `server(port, handlerFn)`: Start an HTTP server.
|
|
105
|
+
* `exec(cmd)`: Run a shell command (e.g., `exec("dir")`).
|
|
106
|
+
* `json(obj)`: Convert object to JSON string.
|
|
107
|
+
* `parseJson(str)`: Parse JSON string to object.
|
|
108
|
+
|
|
109
|
+
### 4. Example: Web Server
|
|
110
|
+
|
|
111
|
+
```fazer
|
|
112
|
+
fn handleRequest(req) β
|
|
113
|
+
println("Request received: " + req.url)
|
|
114
|
+
return({
|
|
115
|
+
"status": 200,
|
|
116
|
+
"headers": { "Content-Type": "text/plain" },
|
|
117
|
+
"body": "Hello from Fazer Server!"
|
|
118
|
+
})
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
println("Starting server...")
|
|
122
|
+
server(8080, "handleRequest")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## π οΈ Distribution
|
|
128
|
+
|
|
129
|
+
To compile your script into a standalone executable:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pkg fazer.js --targets node18-win-x64 --output myapp.exe
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## π License
|
|
136
|
+
|
|
137
|
+
MIT Β© Fazer Corp (2026)
|
package/apply_icon.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { rcedit } = require('rcedit');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
const exePath = path.resolve(__dirname, '../FzEncrypt.exe');
|
|
6
|
+
const iconPath = path.resolve(__dirname, '../fazer.ico');
|
|
7
|
+
|
|
8
|
+
console.log(`Applying icon to: ${exePath}`);
|
|
9
|
+
console.log(`Using icon: ${iconPath}`);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
await rcedit(exePath, {
|
|
13
|
+
icon: iconPath,
|
|
14
|
+
'version-string': {
|
|
15
|
+
'CompanyName': 'Fazer Corp',
|
|
16
|
+
'FileDescription': 'Fz Encrypt',
|
|
17
|
+
'ProductName': 'Fz Encrypt',
|
|
18
|
+
'LegalCopyright': 'Copyright (c) 2026'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
console.log('Icon applied successfully!');
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Error applying icon:', error);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
main();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const { rcedit } = require('rcedit');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
const exePath = path.resolve(__dirname, '../FzEncrypt.exe');
|
|
7
|
+
const tempExePath = path.resolve(__dirname, '../FzEncrypt-temp.exe');
|
|
8
|
+
const iconPath = path.resolve(__dirname, '../fazer.ico');
|
|
9
|
+
|
|
10
|
+
console.log(`Applying icon...`);
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
// 1. Copy to temp to avoid lock issues
|
|
14
|
+
fs.copyFileSync(exePath, tempExePath);
|
|
15
|
+
|
|
16
|
+
// 2. Apply icon to temp
|
|
17
|
+
await rcedit(tempExePath, {
|
|
18
|
+
icon: iconPath,
|
|
19
|
+
'version-string': {
|
|
20
|
+
'CompanyName': 'Fazer Corp',
|
|
21
|
+
'FileDescription': 'Fz Encrypt',
|
|
22
|
+
'ProductName': 'Fz Encrypt',
|
|
23
|
+
'LegalCopyright': 'Copyright (c) 2026'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// 3. Replace original
|
|
28
|
+
// Retry a few times if locked
|
|
29
|
+
let retries = 5;
|
|
30
|
+
while (retries > 0) {
|
|
31
|
+
try {
|
|
32
|
+
fs.renameSync(tempExePath, exePath);
|
|
33
|
+
break;
|
|
34
|
+
} catch (e) {
|
|
35
|
+
retries--;
|
|
36
|
+
if (retries === 0) throw e;
|
|
37
|
+
console.log("Fichier verrouillΓ©, nouvelle tentative dans 1s...");
|
|
38
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log('Icon applied successfully!');
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Error applying icon:', error);
|
|
45
|
+
// If temp exists, try to clean up
|
|
46
|
+
try { if (fs.existsSync(tempExePath)) fs.unlinkSync(tempExePath); } catch(e) {}
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
main();
|
package/bin/fazer.exe
CHANGED
|
Binary file
|