gg-esolang 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/README.md +54 -2
- package/bin/run.js +233 -0
- package/package.json +36 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Azest Kingscrown
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# gg-esolang (줴줴랭)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **줴줴랭 (JjeJje / .gg)** — 100% Rust core & native CLI launcher via npm / npx.
|
|
4
|
+
|
|
5
|
+
Official fast, dependency-free wrapper for the `gg` native CLI executable.
|
|
6
|
+
|
|
7
|
+
## Instant Run (No installation required)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Run a .gg script directly with npx
|
|
11
|
+
npx gg-esolang script.gg
|
|
12
|
+
|
|
13
|
+
# Check version
|
|
14
|
+
npx gg-esolang --version
|
|
15
|
+
|
|
16
|
+
# Interactive REPL
|
|
17
|
+
npx gg-esolang
|
|
18
|
+
|
|
19
|
+
# Explain source execution step-by-step
|
|
20
|
+
npx gg-esolang --explain script.gg
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Global Installation (Optional)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g gg-esolang
|
|
27
|
+
|
|
28
|
+
# Run directly
|
|
29
|
+
gg script.gg
|
|
30
|
+
# or
|
|
31
|
+
gg-esolang script.gg
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Zero npm dependencies**: Fast bootstrap with automatic native binary download and caching.
|
|
37
|
+
- **Strict Integrity Verification**: Releases are verified using SHA-256 before extraction.
|
|
38
|
+
- **Native Performance**: 100% Rust core (AST-walking interpreter, byte-exact Hangul/UTF-8 indexing, deterministic cycle limits).
|
|
39
|
+
- **Supported Platforms**:
|
|
40
|
+
- Linux x86_64 (`linux-x64`)
|
|
41
|
+
- Linux aarch64 (`linux-arm64`)
|
|
42
|
+
- macOS Apple Silicon (`darwin-arm64`)
|
|
43
|
+
- macOS Intel (`darwin-x64`)
|
|
44
|
+
- Windows x86_64 (`win32-x64`)
|
|
45
|
+
- Windows ARM64 (`win32-arm64`)
|
|
46
|
+
|
|
47
|
+
## Documentation & Repository
|
|
48
|
+
|
|
49
|
+
- **GitHub**: [https://github.com/azestkingscrown/gg-lang](https://github.com/azestkingscrown/gg-lang)
|
|
50
|
+
- **Web Playground**: [https://azestkingscrown.github.io/gg-lang/](https://azestkingscrown.github.io/gg-lang/)
|
|
51
|
+
- **Specification**: See [spec/SPEC.md](https://github.com/azestkingscrown/gg-lang/blob/main/spec/SPEC.md)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT © azestkingscrown
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const crypto = require('crypto');
|
|
7
|
+
const { spawnSync, execSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
const VERSION = '1.2.1';
|
|
10
|
+
const TAG = 'v1.2.1';
|
|
11
|
+
const REPO = 'azestkingscrown/gg-lang';
|
|
12
|
+
|
|
13
|
+
const TARGET_MAP = {
|
|
14
|
+
'linux-x64': {
|
|
15
|
+
asset: 'gg-v1.2.1-linux-x86_64.tar.gz',
|
|
16
|
+
binName: 'gg',
|
|
17
|
+
archiveType: 'tar.gz',
|
|
18
|
+
sha256: '1e7c3ae92aca1f3660c0d1a09f74af56a51d4b126b263f067d0570b75bab9fb5',
|
|
19
|
+
},
|
|
20
|
+
'linux-arm64': {
|
|
21
|
+
asset: 'gg-v1.2.1-linux-aarch64.tar.gz',
|
|
22
|
+
binName: 'gg',
|
|
23
|
+
archiveType: 'tar.gz',
|
|
24
|
+
sha256: '75386d70c0e8d1625d74763be6ea2e79fbb6b672a3b523bf31513c0c315c1807',
|
|
25
|
+
},
|
|
26
|
+
'darwin-arm64': {
|
|
27
|
+
asset: 'gg-v1.2.1-macos-aarch64.tar.gz',
|
|
28
|
+
binName: 'gg',
|
|
29
|
+
archiveType: 'tar.gz',
|
|
30
|
+
sha256: 'da8cb67c03d1b0c7ac164d30891147e4be816588ff5986f6a70b26378268ab7e',
|
|
31
|
+
},
|
|
32
|
+
'darwin-x64': {
|
|
33
|
+
asset: 'gg-v1.2.1-macos-x86_64.tar.gz',
|
|
34
|
+
binName: 'gg',
|
|
35
|
+
archiveType: 'tar.gz',
|
|
36
|
+
sha256: '892eed5f6ffe81e5b47de44e6de5da88ae12117454a171c6a525e84a594e2eeb',
|
|
37
|
+
},
|
|
38
|
+
'win32-x64': {
|
|
39
|
+
asset: 'gg-v1.2.1-windows-x86_64.zip',
|
|
40
|
+
binName: 'gg.exe',
|
|
41
|
+
archiveType: 'zip',
|
|
42
|
+
sha256: 'f30612047c6791a0355e555ac51efef8351466d542de5c14f4aa895a8e8d466b',
|
|
43
|
+
},
|
|
44
|
+
'win32-arm64': {
|
|
45
|
+
asset: 'gg-v1.2.1-windows-aarch64.zip',
|
|
46
|
+
binName: 'gg.exe',
|
|
47
|
+
archiveType: 'zip',
|
|
48
|
+
sha256: '9bc23e9d3406f5922446f3c09d0c9a344ff63a89bbafca4d8fde5739feea7bc',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function getPlatformKey() {
|
|
53
|
+
const platform = process.platform;
|
|
54
|
+
let arch = process.arch;
|
|
55
|
+
|
|
56
|
+
// On macOS x64 running under Rosetta 2 on Apple Silicon
|
|
57
|
+
if (platform === 'darwin' && arch === 'x64') {
|
|
58
|
+
try {
|
|
59
|
+
const isTranslated = execSync('sysctl -in sysctl.proc_translated', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
|
60
|
+
if (isTranslated === '1') {
|
|
61
|
+
arch = 'arm64';
|
|
62
|
+
}
|
|
63
|
+
} catch {}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return `${platform}-${arch}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function getCacheDir() {
|
|
70
|
+
if (process.platform === 'win32') {
|
|
71
|
+
return path.join(
|
|
72
|
+
process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local'),
|
|
73
|
+
'gg-lang',
|
|
74
|
+
VERSION
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
const xdgCache = process.env.XDG_CACHE_HOME || path.join(os.homedir(), '.cache');
|
|
78
|
+
return path.join(xdgCache, 'gg-lang', VERSION);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function downloadFile(url, destPath) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
function get(currentUrl, redirectCount = 0) {
|
|
84
|
+
if (redirectCount > 5) {
|
|
85
|
+
return reject(new Error('Too many redirects while downloading release asset.'));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
https.get(currentUrl, (res) => {
|
|
89
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
90
|
+
return get(res.headers.location, redirectCount + 1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (res.statusCode !== 200) {
|
|
94
|
+
return reject(new Error(`Download failed with HTTP ${res.statusCode}: ${currentUrl}`));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const fileStream = fs.createWriteStream(destPath);
|
|
98
|
+
res.pipe(fileStream);
|
|
99
|
+
|
|
100
|
+
fileStream.on('finish', () => {
|
|
101
|
+
fileStream.close(resolve);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
fileStream.on('error', (err) => {
|
|
105
|
+
fs.unlink(destPath, () => {});
|
|
106
|
+
reject(err);
|
|
107
|
+
});
|
|
108
|
+
}).on('error', reject);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get(url);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function verifySha256(filePath, expectedSha256) {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
const hash = crypto.createHash('sha256');
|
|
118
|
+
const stream = fs.createReadStream(filePath);
|
|
119
|
+
|
|
120
|
+
stream.on('data', (chunk) => hash.update(chunk));
|
|
121
|
+
stream.on('end', () => {
|
|
122
|
+
const actual = hash.digest('hex');
|
|
123
|
+
if (actual.toLowerCase() === expectedSha256.toLowerCase()) {
|
|
124
|
+
resolve();
|
|
125
|
+
} else {
|
|
126
|
+
reject(new Error(`Checksum mismatch!\nExpected: ${expectedSha256}\nActual: ${actual}`));
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
stream.on('error', reject);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function extractArchive(archivePath, targetDir, archiveType) {
|
|
134
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
135
|
+
if (archiveType === 'tar.gz') {
|
|
136
|
+
execSync(`tar -xzf "${archivePath}" -C "${targetDir}"`, { stdio: 'inherit' });
|
|
137
|
+
} else if (archiveType === 'zip') {
|
|
138
|
+
if (process.platform === 'win32') {
|
|
139
|
+
try {
|
|
140
|
+
execSync(`tar.exe -xf "${archivePath}" -C "${targetDir}"`, { stdio: 'inherit' });
|
|
141
|
+
} catch {
|
|
142
|
+
execSync(`powershell -NoProfile -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${targetDir}' -Force"`, { stdio: 'inherit' });
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
execSync(`unzip -q -o "${archivePath}" -d "${targetDir}"`, { stdio: 'inherit' });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function ensureBinary() {
|
|
151
|
+
const key = getPlatformKey();
|
|
152
|
+
const config = TARGET_MAP[key];
|
|
153
|
+
|
|
154
|
+
if (!config) {
|
|
155
|
+
console.error(`[gg-esolang] Unsupported platform/architecture: ${key}`);
|
|
156
|
+
console.error(`[gg-esolang] Supported platforms: ${Object.keys(TARGET_MAP).join(', ')}`);
|
|
157
|
+
console.error(`[gg-esolang] You can build from source using 'cargo build --release' or report this issue at:`);
|
|
158
|
+
console.error(` https://github.com/${REPO}/issues`);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const cacheDir = getCacheDir();
|
|
163
|
+
const binaryPath = path.join(cacheDir, config.binName);
|
|
164
|
+
|
|
165
|
+
if (fs.existsSync(binaryPath)) {
|
|
166
|
+
try {
|
|
167
|
+
fs.accessSync(binaryPath, fs.constants.X_OK);
|
|
168
|
+
return binaryPath;
|
|
169
|
+
} catch {
|
|
170
|
+
// If found but not executable, attempt chmod
|
|
171
|
+
try {
|
|
172
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
173
|
+
return binaryPath;
|
|
174
|
+
} catch {}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const downloadUrl = `https://github.com/${REPO}/releases/download/${TAG}/${config.asset}`;
|
|
179
|
+
const tempArchivePath = path.join(cacheDir, config.asset);
|
|
180
|
+
|
|
181
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
182
|
+
|
|
183
|
+
process.stderr.write(`[gg-esolang] Downloading native binary for ${key} (${TAG})...\n`);
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
await downloadFile(downloadUrl, tempArchivePath);
|
|
187
|
+
await verifySha256(tempArchivePath, config.sha256);
|
|
188
|
+
extractArchive(tempArchivePath, cacheDir, config.archiveType);
|
|
189
|
+
|
|
190
|
+
if (process.platform !== 'win32') {
|
|
191
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
fs.unlinkSync(tempArchivePath);
|
|
196
|
+
} catch {}
|
|
197
|
+
|
|
198
|
+
return binaryPath;
|
|
199
|
+
} catch (err) {
|
|
200
|
+
try {
|
|
201
|
+
if (fs.existsSync(tempArchivePath)) fs.unlinkSync(tempArchivePath);
|
|
202
|
+
if (fs.existsSync(binaryPath)) fs.unlinkSync(binaryPath);
|
|
203
|
+
} catch {}
|
|
204
|
+
console.error(`[gg-esolang] Failed to prepare native binary: ${err.message}`);
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function main() {
|
|
210
|
+
const binaryPath = await ensureBinary();
|
|
211
|
+
const args = process.argv.slice(2);
|
|
212
|
+
|
|
213
|
+
const result = spawnSync(binaryPath, args, {
|
|
214
|
+
stdio: 'inherit',
|
|
215
|
+
env: process.env,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
if (result.error) {
|
|
219
|
+
console.error(`[gg-esolang] Execution error: ${result.error.message}`);
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (result.signal) {
|
|
224
|
+
process.kill(process.pid, result.signal);
|
|
225
|
+
} else {
|
|
226
|
+
process.exit(result.status ?? 0);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
main().catch((err) => {
|
|
231
|
+
console.error(`[gg-esolang] Unexpected fatal error: ${err.message}`);
|
|
232
|
+
process.exit(1);
|
|
233
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gg-esolang",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "줴줴랭 (JjeJje / .gg) — 100% Rust core & native CLI launcher",
|
|
5
|
+
"bin": {
|
|
6
|
+
"gg": "bin/run.js",
|
|
7
|
+
"gg-esolang": "bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/azestkingscrown/gg-lang.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"esolang",
|
|
20
|
+
"jjejje",
|
|
21
|
+
"gg-lang",
|
|
22
|
+
"gg-esolang",
|
|
23
|
+
"rust",
|
|
24
|
+
"wasm",
|
|
25
|
+
"cli",
|
|
26
|
+
"compiler",
|
|
27
|
+
"interpreter"
|
|
28
|
+
],
|
|
29
|
+
"author": "azestkingscrown",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/azestkingscrown/gg-lang/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/azestkingscrown/gg-lang#readme",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|