fazer-lang 1.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 CHANGED
@@ -1,32 +1,137 @@
1
- # [Logo](logo.png)
2
-
3
- Langage de programmation.
4
-
5
- ## Features
6
- - `stash` vars, `broadcast` outputs
7
- - `risk` pour probabilités
8
- - `uhquali event` pour random culture boosts
9
- - `cooldown` et `wait` pour timers
10
- - `save/load` pour persistence
11
- - `broadcast to discord` pour bots
12
- - Et plus : intersects, flows, parallels, territories
13
-
14
- ## Installation
15
- 1. Clone le repo : `git clone https://github.com/tonusername/fazer-lang.git`
16
- 2. `cd fazer-lang`
17
- 3. `npm install`
18
- 4. Build standalone : `npm run build` → get `bin/fazer.exe`
19
- 5. Run : `fazer run monfichier.fz`
20
-
21
- Ou via npm (si publié) : `npm install -g fazer-lang` puis `fazer run ...`
22
-
23
- ## Exemple (heist.fz)
24
- `stash rep as 50
25
- uhquali event "street cred boost"
26
- cooldown heist 30m
27
- risk 70% chance of broadcast "Win!" ; stash cash as 1000
28
- save empire`
29
-
30
-
31
- ## Logo
32
- ![Fazer Logo](logo.png)
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
+ [![npm version](https://img.shields.io/npm/v/fazer-lang.svg)](https://www.npmjs.com/package/fazer-lang)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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