xyontros 1.0.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.
Files changed (3) hide show
  1. package/Readme.md +5 -0
  2. package/compiler.js +58 -0
  3. package/package.json +19 -0
package/Readme.md ADDED
@@ -0,0 +1,5 @@
1
+ # Xyontros
2
+
3
+ **XML & Yield-optimized Native TypeScript Runtime & Optimization System**
4
+
5
+ Xyontros is a next-generation lightweight development engine and compiler designed to streamline web development using custom `.xyon` source files.
package/compiler.js ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ function compileXyonFile(filePath) {
6
+ console.log(`[Xyntros] Compiling ${filePath}...`);
7
+
8
+ const publicDir = path.join(__dirname, 'public');
9
+ if (!fs.existsSync(publicDir)) {
10
+ fs.mkdirSync(publicDir, { recursive: true });
11
+ }
12
+
13
+ const sourceContent = fs.readFileSync(filePath, 'utf8');
14
+ const outputPath = path.join(publicDir, 'index.html');
15
+
16
+ // FIX: If the file already exists, make it writable first so we don't get EPERM
17
+ if (fs.existsSync(outputPath)) {
18
+ try {
19
+ fs.chmodSync(outputPath, 0o666);
20
+ } catch (e) {
21
+ // Ignore if it fails
22
+ }
23
+ }
24
+
25
+ const warningHeader = `<!--
26
+ =================================================================
27
+ ⚠️ WARNING: AUTO-GENERATED FILE BY XYONTROS COMPILER.
28
+ DO NOT EDIT THIS FILE DIRECTLY!
29
+ Make your changes inside 'index.xyon' instead.
30
+ =================================================================
31
+ -->\n`;
32
+
33
+ fs.writeFileSync(outputPath, warningHeader + sourceContent);
34
+
35
+ // Optional: Keep it read-only for safety after writing
36
+ try {
37
+ fs.chmodSync(outputPath, 0o444);
38
+ } catch (e) {
39
+ // Ignore if OS locks it
40
+ }
41
+
42
+ console.log("[Xyntros] Build successful -> /public/index.html");
43
+ }
44
+
45
+ const targetFile = 'index.xyon';
46
+ compileXyonFile(targetFile);
47
+
48
+ fs.watch(targetFile, (eventType) => {
49
+ if (eventType === 'change') {
50
+ try {
51
+ compileXyonFile(targetFile);
52
+ } catch (err) {
53
+ console.error("[Xyntros Build Error]:", err.message);
54
+ }
55
+ }
56
+ });
57
+
58
+ console.log(`[Xyntros] Watching ${targetFile} for changes...`);
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "xyontros",
3
+ "version": "1.0.1",
4
+ "description": "The official Xyontros compiler and live engine",
5
+ "main": "compiler.js",
6
+ "bin": {
7
+ "xyntros": "./compiler.js"
8
+ },
9
+ "keywords": [
10
+ "xyontros",
11
+ "compiler",
12
+ "engine"
13
+ ],
14
+ "author": "Abdul Aziz Memon",
15
+ "license": "SEE LICENSE IN LICENSE",
16
+ "engines": {
17
+ "node": ">=14.0.0"
18
+ }
19
+ }