fazer-lang 1.1.0 → 2.1.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/README.md CHANGED
@@ -1,32 +1,200 @@
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 Reference Manual
2
+
3
+ > **The Next-Generation Scripting Language for High-Performance Computing & Security.**
4
+ > *Copyright © 2026 L'EMPRISE. All Rights Reserved.*
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
+ ---
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:
30
+
31
+ ```bash
32
+ npm install -g fazer-lang
33
+ ```
34
+
35
+ ### Verification
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
+ ---
105
+
106
+ ## 5. Standard Library Reference (StdLib)
107
+
108
+ Fazer comes equipped with a professional-grade standard library.
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"))
121
+ ```
122
+
123
+ ### 5.2. Cryptography (`Crypto`)
124
+ **Security Level: Military Grade (AES-256-GCM).**
125
+
126
+ * **`sha256(data)`**: Returns the SHA-256 hash of the data (hex string).
127
+ * **`encText(plainText, password)`**: Encrypts text using AES-256-GCM. Returns a secure JSON string containing IV, AuthTag, and Ciphertext.
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")
133
+ ```
134
+
135
+ ### 5.3. File System (`FS`)
136
+ Robust, synchronous file operations.
137
+
138
+ * **`readText(path)`**: Reads file as UTF-8 string.
139
+ * **`saveText(content, path)`**: Writes string to file (overwrites).
140
+ * **`readB64(path)`**: Reads file as Base64 string (useful for binaries).
141
+ * **`saveB64(content, path)`**: Writes Base64 string to file.
142
+ * **`exists(path)`**: Returns `true` if file/directory exists, `false` otherwise.
143
+ * **`ls(path)`**: Returns an array of file names in the directory.
144
+ * **`rm(path)`**: Recursively deletes a file or directory. **Handle with care.**
145
+ * **`mkdir(path)`**: Creates a directory (recursive).
146
+
147
+ ### 5.4. Networking & Web (`Net`)
148
+ Create high-performance web servers instantly.
149
+
150
+ * **`server(port, handlerFunctionName)`**: Starts a blocking HTTP server.
151
+
152
+ **Example Web Server:**
153
+ ```fazer
154
+ fn handler(req) →
155
+ # req has .method, .url, .headers
156
+ println("Hit: " + req.url)
157
+
158
+ return({
159
+ "status": 200,
160
+ "headers": { "Content-Type": "application/json" },
161
+ "body": json({ "message": "Welcome to Fazer API" })
162
+ })
163
+ end
164
+
165
+ server(3000, "handler")
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
184
+ ```
185
+
186
+ This capability makes Fazer the ideal choice for deploying secure, self-contained tools to client environments.
187
+
188
+ ---
189
+
190
+ ## 7. Copyright & Legal
191
+
192
+ **Fazer Language** is a proprietary technology developed by **L'EMPRISE**.
193
+ Unauthorized reproduction of the core interpreter logic without attribution is prohibited.
194
+
195
+ * **Copyright**: © 2026 L'EMPRISE.
196
+ * **License**: MIT (Open Source for usage).
197
+
198
+ ---
199
+
200
+ > *"Control the code, control the world."* — **L'EMPRISE**
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