vladx 1.5.1 → 1.6.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.
@@ -0,0 +1,20 @@
1
+ name: VladX CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - name: Use Node.js
16
+ uses: actions/setup-node@v3
17
+ with:
18
+ node-version: '18.x'
19
+ - run: npm install
20
+ - run: npm test
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [1.5.1] - 2026-02-03
8
+ ### Added
9
+ - Phase 0 of the roadmap: Baseline Hygiene.
10
+ - Unified error handling base class `VladXError`.
11
+ - Simple logging utility.
12
+ - Project directory structure (`tests`, `benchmarks`, `docs`).
13
+ - Initial CI workflow for GitHub Actions.
14
+ - `CHANGELOG.md` to track project evolution.
@@ -1,9 +1,8 @@
1
- importa { data, ora, pausa, timestamp } da "@std/Tempo";
1
+ importa { data, ora } da "@std/Tempo";
2
2
 
3
3
  stampa("Oggi è il: " + data());
4
4
  stampa("Ora attuale: " + ora());
5
- stampa("Timestamp: " + timestamp());
6
5
 
7
6
  stampa("\nAttendo 1 secondo...");
8
- attendi pausa(1000);
7
+ attendi aspetta(1000);
9
8
  stampa("Fine attesa.");
package/install.sh CHANGED
@@ -25,11 +25,23 @@ echo "🌐 Installazione dell'ultima versione di Node.js..."
25
25
  nvm install node
26
26
  nvm use node
27
27
 
28
- # 3. Installazione VladX
28
+ # 3. Preparazione directory VladX
29
+ echo "📁 Preparazione directory dati (~/.vladx)..."
30
+ mkdir -p "$HOME/.vladx/vladpm/bin"
31
+
32
+ # 4. Installazione VladX
29
33
  echo "🛠️ Installazione globale di VladX e VladPM dal registry NPM..."
30
34
 
31
35
  npm install -g vladx
32
36
 
37
+ # 5. Configurazione PATH
38
+ echo "🌐 Configurazione PATH..."
39
+ if [[ ":$PATH:" != *":$HOME/.vladx/vladpm/bin:"* ]]; then
40
+ echo 'export PATH="$HOME/.vladx/vladpm/bin:$PATH"' >> "$HOME/.bashrc"
41
+ echo " ✓ Aggiunto ~/.vladx/vladpm/bin a .bashrc"
42
+ export PATH="$HOME/.vladx/vladpm/bin:$PATH"
43
+ fi
44
+
33
45
  echo ""
34
46
  echo "✅ Installazione completata con successo!"
35
47
  echo "Node.js: $(node -v)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vladx",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "VladX - Linguaggio di programmazione con sintassi italiana",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -10,7 +10,8 @@
10
10
  },
11
11
  "scripts": {
12
12
  "start": "node bin/vladx",
13
- "repl": "node bin/vladx repl"
13
+ "repl": "node bin/vladx repl",
14
+ "postinstall": "node scripts/install-setup.js"
14
15
  },
15
16
  "keywords": [
16
17
  "language",
package/plan.md ADDED
@@ -0,0 +1,140 @@
1
+ # VladX Roadmap to Node.js‑Level Capability
2
+
3
+ This plan is an exhaustive, practical checklist to move VladX from a scripting interpreter toward a Node.js‑class runtime, ecosystem, and developer experience. It is intentionally ambitious and staged. “Node.js‑level” means a non‑blocking runtime, stable core APIs, a robust package ecosystem, strong tooling, security hardening, and measurable performance.
4
+
5
+ ## Principles
6
+ - Preserve Italian syntax and identity while matching Node’s technical quality.
7
+ - Prioritize correctness, security, and developer experience before performance optimizations.
8
+ - Avoid breaking changes without clear migrations.
9
+ - Automate quality gates early.
10
+
11
+ ## Phase 0 — Baseline Hygiene (Immediate)
12
+ - Add a formal versioning strategy (SemVer + changelog).
13
+ - Add a consistent error format with file/line/column everywhere.
14
+ - Add a logging strategy for runtime and PM.
15
+ - Create a repo directory standard for tests, benchmarks, and docs.
16
+ - Add CI with linting, tests, and packaging validation.
17
+
18
+ ## Phase 1 — Correctness Fixes (Must‑Fix Bugs)
19
+ - Fix file path resolution in `Archivio.*` to be relative to the executing file’s directory, not `..` from a file path.
20
+ - Fix REPL last expression evaluation environment so it actually uses current scope.
21
+ - Fix `new` parsing to accept `nuovo` on member expressions, not only identifiers.
22
+ - Fix optional chaining support to include `obj?.[expr]` and `obj?.(args)`.
23
+ - Add clear error when calling non‑functions, include actual type.
24
+ - Ensure destructuring errors reference line/column and show expected vs received.
25
+ - Resolve any mismatch between parser tokens and interpreter operators.
26
+ - Clarify `async/await` semantics and ensure awaiting only actual promises.
27
+ - Ensure `break/continue` are only valid inside loops/switch.
28
+ - Ensure `return` is only valid inside functions.
29
+
30
+ ## Phase 2 — Real Async Runtime (Core Gap vs Node.js)
31
+ - Replace all blocking I/O (`fs.readFileSync`, `execSync`, busy‑wait) with async equivalents.
32
+ - Introduce an event loop abstraction with a task queue and microtask queue.
33
+ - Implement timers (`setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`).
34
+ - Implement promises that integrate with the runtime, not only JS promises.
35
+ - Implement async stack traces for awaited frames.
36
+ - Add cancellation support (AbortController‑like).
37
+ - Add async hooks to enable tracing and profiling.
38
+
39
+ ## Phase 3 — Module System Parity
40
+ - Implement module caching with proper circular dependency handling.
41
+ - Add support for package `main` and `exports` in `vladx.json`.
42
+ - Add extension resolution rules that match Node’s behavior (configurable).
43
+ - Add module resolution for relative, absolute, and bare specifiers with clear errors.
44
+ - Add module type support (common vs esm‑like) or a single well‑defined model.
45
+ - Add a standardized module loader for builtin modules and stdlib.
46
+
47
+ ## Phase 4 — Standard Library Modernization
48
+ - Split stdlib into a clean, stable core API with versioning.
49
+ - Replace `execSync` HTTP with a real HTTP client implementation.
50
+ - Provide a `fetch`‑like API and streaming responses.
51
+ - Provide filesystem async APIs with promises.
52
+ - Provide `net`, `tls`, `http`, `https`, `crypto`, `zlib` equivalents.
53
+ - Provide `path`, `os`, `process` equivalents with consistent naming.
54
+ - Provide robust JSON, URL, and Buffer APIs.
55
+ - Provide structured errors for stdlib failures.
56
+
57
+ ## Phase 5 — Security Hardening
58
+ - Add a permission model for filesystem, network, and process execution.
59
+ - Sandbox `Sistema.esegui` or remove by default.
60
+ - Remove string‑built shell calls in stdlib.
61
+ - Add input validation utilities and safe SQL helpers.
62
+ - Add secure defaults for HTTP client and server.
63
+ - Add dependency signature verification in VladPM.
64
+ - Add audit tooling for known vulnerabilities.
65
+
66
+ ## Phase 6 — Performance & Memory
67
+ - Add a bytecode compiler or IR to avoid deep AST walking.
68
+ - Add a proper GC strategy or integrate with a VM that provides one.
69
+ - Add incremental GC hooks for async workloads.
70
+ - Add profiling tools (CPU, memory, async task tracking).
71
+ - Add performance benchmarks for core runtime and stdlib.
72
+ - Add a caching strategy for parsed modules.
73
+ - Add fast path for numeric operations and tight loops.
74
+
75
+ ## Phase 7 — Language Features for Parity
76
+ - Add default parameters, rest/spread, and destructuring improvements.
77
+ - Add `try/catch` with error types and stack traces.
78
+ - Add `finally` reliability guarantees with async.
79
+ - Add `switch` strict matching options.
80
+ - Add generators or iterators if in scope.
81
+ - Add `for..of` and iterable protocol.
82
+ - Add optional chaining and nullish coalescing everywhere.
83
+ - Add proper `this` and `super` behavior in classes.
84
+ - Add class fields and private fields if desired.
85
+
86
+ ## Phase 8 — Tooling (Developer Experience)
87
+ - Add a debugger protocol and CLI debugger.
88
+ - Add source maps for accurate error locations.
89
+ - Add a test runner with snapshot support.
90
+ - Add formatter and linter with Italian syntax rules.
91
+ - Add language server (LSP) with autocomplete, go‑to‑definition, hover.
92
+ - Add REPL improvements: history, auto‑completion, top‑level await.
93
+
94
+ ## Phase 9 — VladPM (Ecosystem)
95
+ - Add semantic version resolution.
96
+ - Add dependency tree lock correctness and integrity checks.
97
+ - Add package cache and offline install.
98
+ - Add `vladpm audit`.
99
+ - Add `vladpm doctor`.
100
+ - Add scoped packages and registry auth improvements.
101
+ - Add registry replication and fallback mirrors.
102
+
103
+ ## Phase 10 — Docs and Community
104
+ - Full reference documentation for language and stdlib.
105
+ - Cookbook of patterns and migration guides.
106
+ - Examples for web servers, CLIs, data processing, and automation.
107
+ - Contribution guidelines, RFC process, and release process.
108
+
109
+ ## Phase 11 — Compatibility Goals
110
+ - Define what “Node.js‑level” means in measurable terms.
111
+ - Publish performance targets vs Node for key workloads.
112
+ - Publish supported core APIs and their compatibility level.
113
+ - Add a compatibility test suite.
114
+
115
+ ## Immediate Technical TODOs (from current codebase)
116
+ - Fix `Archivio.*` path resolution relative to script directory.
117
+ - Replace blocking `aspetta` busy‑wait with async sleep.
118
+ - Replace `Rete.chiama` and `ClientWeb` curl usage with native HTTP.
119
+ - Fix REPL `evaluate` call to pass the correct environment.
120
+ - Improve error messages to include token context in parser errors.
121
+ - Ensure `optional chaining` tokens parse correctly in member access and calls.
122
+ - Add module path normalization and caching for absolute paths.
123
+
124
+ ## Risks to Track
125
+ - Node parity is a multi‑year effort without a VM or JIT.
126
+ - Security and dependency integrity become critical as adoption grows.
127
+ - Backward compatibility can slow progress without clear versioning.
128
+
129
+ ## Suggested Execution Order
130
+ 1. Baseline Hygiene
131
+ 2. Correctness Fixes
132
+ 3. Real Async Runtime
133
+ 4. Module System Parity
134
+ 5. Stdlib Modernization
135
+ 6. Security Hardening
136
+ 7. Performance & Memory
137
+ 8. Tooling
138
+ 9. VladPM Ecosystem
139
+ 10. Docs and Community
140
+ 11. Compatibility Targets
@@ -1,15 +1,27 @@
1
- variabile passport = {}
2
- passport.nome = chiedi("Come ti chiami? ")
3
- se(Archivio.esiste(`passports/${passport.nome}.json`)) {
4
- stampa("GIA ESISTE, VATTENE!!")
1
+ importa {log, errore} da "@std/Console";
2
+ classe Persona {
3
+ funzione costruttore(nome, eta) {
4
+ questo.nome = nome
5
+ questo.eta = eta
6
+ }
7
+ funzione eMaggiorenne() {
8
+ se(questo.eta >= 18) {
9
+ ritorna vero
10
+ } altrimenti {
11
+ ritorna falso
12
+ }
13
+ }
14
+ }
15
+ variabile nome = chiedi("Come ti chiami? ")
16
+ se(Archivio.esiste(`passports/${nome}.json`)) {
17
+ errore("GIA ESISTE, VATTENE!!")
5
18
  } altrimenti {
6
- passport.eta = chiedi("Quanti anni hai? ")
7
-
8
- se(passport.eta >= 18) {
9
- stampa("Sei maggiorenne")
19
+ variabile eta = chiedi("Quanti anni hai? ")
20
+ variabile persona = nuovo Persona(nome, eta)
21
+ se(persona.eMaggiorenne()) {
22
+ log("Sei maggiorenne")
10
23
  } altrimenti {
11
- stampa("Sei minorenne")
24
+ log("Sei minorenne")
12
25
  }
13
-
14
- Archivio.scrivi(`passports/${passport.nome}.json`, JSON.stringify(passport))
26
+ Archivio.scrivi(`passports/${nome}.json`, JSON.stringify(persona))
15
27
  }
@@ -0,0 +1 @@
1
+ {"klass":{"name":"Persona","superclass":null,"constructor":{"type":"FunctionDeclaration","name":"costruttore","params":["nome","eta"],"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"ThisExpression"},"property":{"type":"Identifier","name":"nome"},"computed":false,"optional":false},"right":{"type":"Identifier","name":"nome"}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"ThisExpression"},"property":{"type":"Identifier","name":"eta"},"computed":false,"optional":false},"right":{"type":"Identifier","name":"eta"}}}]},"isAsync":false},"methods":{}},"fields":{}}
@@ -0,0 +1,2 @@
1
+ importa { saluta } da "testG";
2
+ saluta();
@@ -0,0 +1,36 @@
1
+ /**
2
+ * VladX - Install Setup Script
3
+ * Crea le directory ~/.vladx e sottocartelle per vladpm.
4
+ */
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const os = require('os');
9
+
10
+ const VLADX_HOME = path.join(os.homedir(), '.vladx');
11
+ const VLADPM_HOME = path.join(VLADX_HOME, 'vladpm');
12
+ const VLADPM_BIN = path.join(VLADPM_HOME, 'bin');
13
+
14
+ console.log("📁 Preparazione ambiente VladX...");
15
+
16
+ try {
17
+ if (!fs.existsSync(VLADX_HOME)) {
18
+ fs.mkdirSync(VLADX_HOME, { recursive: true });
19
+ console.log(` ✓ Creata directory: ${VLADX_HOME}`);
20
+ }
21
+
22
+ if (!fs.existsSync(VLADPM_HOME)) {
23
+ fs.mkdirSync(VLADPM_HOME, { recursive: true });
24
+ console.log(` ✓ Creata directory: ${VLADPM_HOME}`);
25
+ }
26
+
27
+ if (!fs.existsSync(VLADPM_BIN)) {
28
+ fs.mkdirSync(VLADPM_BIN, { recursive: true });
29
+ console.log(` ✓ Creata directory: ${VLADPM_BIN}`);
30
+ }
31
+
32
+ console.log("✅ Ambiente configurato correttamente.");
33
+ } catch (error) {
34
+ console.error(`✗ Errore durante la creazione delle directory: ${error.message}`);
35
+ process.exit(1);
36
+ }