@fluffylabs/anan-as 1.2.0-55b7cb4 → 1.2.0-68ec59a
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/dist/bin/index.js
CHANGED
|
@@ -91,7 +91,7 @@ function handleDisassemble(args) {
|
|
|
91
91
|
console.error("Supported extensions: .jam, .pvm, .spi, .bin");
|
|
92
92
|
process.exit(1);
|
|
93
93
|
}
|
|
94
|
-
const ext = file.
|
|
94
|
+
const ext = file.slice(dotIndex);
|
|
95
95
|
if (!validExtensions.includes(ext)) {
|
|
96
96
|
console.error(`Error: Invalid file extension '${ext}' for disassemble command.`);
|
|
97
97
|
console.error("Supported extensions: .jam, .pvm, .spi, .bin");
|
|
@@ -380,25 +380,26 @@ function parseMem(memStr) {
|
|
|
380
380
|
if (colonIdx === -1) {
|
|
381
381
|
throw new Error(`--mem entry ${i} ("${spec}") must be "addr:hexbytes".`);
|
|
382
382
|
}
|
|
383
|
-
const addrStr = spec.
|
|
384
|
-
let hexStr = spec.
|
|
383
|
+
const addrStr = spec.slice(0, colonIdx).trim();
|
|
384
|
+
let hexStr = spec.slice(colonIdx + 1).trim();
|
|
385
385
|
const address = parseNum(addrStr);
|
|
386
386
|
if (Number.isNaN(address)) {
|
|
387
387
|
throw new Error(`--mem entry ${i} has invalid address "${addrStr}".`);
|
|
388
388
|
}
|
|
389
389
|
// Strip 0x prefix from hex data
|
|
390
390
|
if (hexStr.startsWith("0x") || hexStr.startsWith("0X")) {
|
|
391
|
-
hexStr = hexStr.
|
|
391
|
+
hexStr = hexStr.slice(2);
|
|
392
392
|
}
|
|
393
393
|
if (hexStr.length % 2 !== 0) {
|
|
394
394
|
throw new Error(`--mem entry ${i} hex data has odd length.`);
|
|
395
395
|
}
|
|
396
396
|
const data = [];
|
|
397
397
|
for (let j = 0; j < hexStr.length; j += 2) {
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
throw new Error(`--mem entry ${i} has invalid hex byte at position ${j}: "${
|
|
398
|
+
const pair = hexStr.slice(j, j + 2);
|
|
399
|
+
if (!/^[0-9a-fA-F]{2}$/.test(pair)) {
|
|
400
|
+
throw new Error(`--mem entry ${i} has invalid hex byte at position ${j}: "${pair}".`);
|
|
401
401
|
}
|
|
402
|
+
const byte = parseInt(pair, 16);
|
|
402
403
|
data.push(byte);
|
|
403
404
|
}
|
|
404
405
|
return { address, data };
|
package/dist/bin/src/utils.js
CHANGED
|
@@ -6,14 +6,14 @@ export function hexDecode(data) {
|
|
|
6
6
|
if (!data.startsWith("0x")) {
|
|
7
7
|
throw new Error("hex input must start with 0x");
|
|
8
8
|
}
|
|
9
|
-
const hex = data.
|
|
9
|
+
const hex = data.slice(2);
|
|
10
10
|
const len = hex.length;
|
|
11
11
|
if (len % 2 === 1) {
|
|
12
12
|
throw new Error("Odd number of nibbles");
|
|
13
13
|
}
|
|
14
14
|
const bytes = new Uint8Array(len / 2);
|
|
15
15
|
for (let i = 0; i < len; i += 2) {
|
|
16
|
-
const c = hex.
|
|
16
|
+
const c = hex.slice(i, i + 2);
|
|
17
17
|
const byteIndex = i / 2;
|
|
18
18
|
if (!/^[0-9a-fA-F]{2}$/.test(c)) {
|
|
19
19
|
throw new Error(`hexDecode: invalid hex pair "${c}" in data "${data}" for bytes[${byteIndex}]`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluffylabs/anan-as",
|
|
3
3
|
"description": "AssemblyScript PVM interpreter.",
|
|
4
|
-
"version": "1.2.0-
|
|
4
|
+
"version": "1.2.0-68ec59a",
|
|
5
5
|
"main": "./dist/bin/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"anan-as": "./dist/bin/index.js"
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"node": ">=18.3.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@biomejs/biome": "^2.4.
|
|
56
|
+
"@biomejs/biome": "^2.4.10",
|
|
57
57
|
"@typeberry/lib": "^0.5.8",
|
|
58
58
|
"@types/node": "^25.3.3",
|
|
59
59
|
"assemblyscript": "^0.28.9",
|
|
60
60
|
"esbuild": "^0.28.0",
|
|
61
61
|
"json-bigint-patch": "^0.0.8",
|
|
62
62
|
"tsx": "^4.21.0",
|
|
63
|
-
"typescript": "^
|
|
63
|
+
"typescript": "^6.0.2"
|
|
64
64
|
},
|
|
65
65
|
"files": [
|
|
66
66
|
"dist/**/*.wasm",
|