@amxts/core 0.2.1 → 0.2.3
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/as/hooks.ts
CHANGED
|
@@ -12194,6 +12194,7 @@ function playerSpawnFireHlds(event: PlayerSpawnEvent, post: bool): void {
|
|
|
12194
12194
|
let playerSpawnHldsHooked = false;
|
|
12195
12195
|
const playerSpawnBackend = new __Switch();
|
|
12196
12196
|
function playerSpawnRun(event: PlayerSpawnEvent, entries: HookEntry<PlayerSpawnEvent, i32>[], post: bool): void {
|
|
12197
|
+
if (event.player.hasDisconnected) return;
|
|
12197
12198
|
const list = entries.slice(0);
|
|
12198
12199
|
for (let i = 0; i < list.length; i++) list[i].silent!(event);
|
|
12199
12200
|
}
|
|
@@ -2796,23 +2796,6 @@ interface Iterator<T, TReturn = any, TNext = any> { next(): IteratorResult<T> }
|
|
|
2796
2796
|
interface Iterable<T, TReturn = any, TNext = any> { [Symbol.iterator](): Iterator<T, TReturn, TNext> }
|
|
2797
2797
|
interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> { [Symbol.iterator](): IterableIterator<T, TReturn, TNext> }
|
|
2798
2798
|
|
|
2799
|
-
/** @hidden amxts: the tuples of the library - a plugin writes `[A, B]`. */
|
|
2800
|
-
declare abstract class __Tuple { __setRaw(index: i32, ref: usize, bits: u64): void }
|
|
2801
|
-
/** @hidden */ declare class __Tuple2<A, B> extends __Tuple { constructor(_0: A, _1: B); _0: A; _1: B; readonly length: i32 }
|
|
2802
|
-
/** @hidden */ declare class __Tuple3<A, B, C> extends __Tuple { constructor(_0: A, _1: B, _2: C); _0: A; _1: B; _2: C; readonly length: i32 }
|
|
2803
|
-
/** @hidden */ declare class __Tuple4<A, B, C, D> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D); _0: A; _1: B; _2: C; _3: D; readonly length: i32 }
|
|
2804
|
-
/** @hidden */ declare class __Tuple5<A, B, C, D, E> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E); _0: A; _1: B; _2: C; _3: D; _4: E; readonly length: i32 }
|
|
2805
|
-
/** @hidden */ declare class __Tuple6<A, B, C, D, E, F> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E, _5: F); _0: A; _1: B; _2: C; _3: D; _4: E; _5: F; readonly length: i32 }
|
|
2806
|
-
/** @hidden */ declare class __Tuple7<A, B, C, D, E, F, G> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E, _5: F, _6: G); _0: A; _1: B; _2: C; _3: D; _4: E; _5: F; _6: G; readonly length: i32 }
|
|
2807
|
-
/** @hidden */ declare class __Tuple8<A, B, C, D, E, F, G, H> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E, _5: F, _6: G, _7: H); _0: A; _1: B; _2: C; _3: D; _4: E; _5: F; _6: G; _7: H; readonly length: i32 }
|
|
2808
|
-
|
|
2809
|
-
/** @hidden amxts: how many `try` blocks the running code is inside. */
|
|
2810
|
-
declare let __tryDepth: i32;
|
|
2811
|
-
/** @hidden amxts: the error on its way to a `catch`. */
|
|
2812
|
-
declare let __thrown: Error | null;
|
|
2813
|
-
/** @hidden amxts: what a `catch` takes. */
|
|
2814
|
-
declare function __catch(): Error;
|
|
2815
|
-
|
|
2816
2799
|
/** JSON text: `JSON.parse<T>(text)` and `JSON.stringify(value)`. */
|
|
2817
2800
|
declare namespace JSON {
|
|
2818
2801
|
/**
|
|
@@ -2825,6 +2808,23 @@ declare namespace JSON {
|
|
|
2825
2808
|
function stringify(value: unknown, replacer?: null, space?: number | string): string;
|
|
2826
2809
|
}
|
|
2827
2810
|
|
|
2811
|
+
/** @hidden amxts: how many `try` blocks the running code is inside. */
|
|
2812
|
+
declare let __tryDepth: i32;
|
|
2813
|
+
/** @hidden amxts: the error on its way to a `catch`. */
|
|
2814
|
+
declare let __thrown: Error | null;
|
|
2815
|
+
/** @hidden amxts: what a `catch` takes. */
|
|
2816
|
+
declare function __catch(): Error;
|
|
2817
|
+
|
|
2818
|
+
/** @hidden amxts: the tuples of the library - a plugin writes `[A, B]`. */
|
|
2819
|
+
declare abstract class __Tuple { __setRaw(index: i32, ref: usize, bits: u64): void }
|
|
2820
|
+
/** @hidden */ declare class __Tuple2<A, B> extends __Tuple { constructor(_0: A, _1: B); _0: A; _1: B; readonly length: i32 }
|
|
2821
|
+
/** @hidden */ declare class __Tuple3<A, B, C> extends __Tuple { constructor(_0: A, _1: B, _2: C); _0: A; _1: B; _2: C; readonly length: i32 }
|
|
2822
|
+
/** @hidden */ declare class __Tuple4<A, B, C, D> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D); _0: A; _1: B; _2: C; _3: D; readonly length: i32 }
|
|
2823
|
+
/** @hidden */ declare class __Tuple5<A, B, C, D, E> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E); _0: A; _1: B; _2: C; _3: D; _4: E; readonly length: i32 }
|
|
2824
|
+
/** @hidden */ declare class __Tuple6<A, B, C, D, E, F> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E, _5: F); _0: A; _1: B; _2: C; _3: D; _4: E; _5: F; readonly length: i32 }
|
|
2825
|
+
/** @hidden */ declare class __Tuple7<A, B, C, D, E, F, G> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E, _5: F, _6: G); _0: A; _1: B; _2: C; _3: D; _4: E; _5: F; _6: G; readonly length: i32 }
|
|
2826
|
+
/** @hidden */ declare class __Tuple8<A, B, C, D, E, F, G, H> extends __Tuple { constructor(_0: A, _1: B, _2: C, _3: D, _4: E, _5: F, _6: G, _7: H); _0: A; _1: B; _2: C; _3: D; _4: E; _5: F; _6: G; _7: H; readonly length: i32 }
|
|
2827
|
+
|
|
2828
2828
|
/** @hidden amxts: what an error's `stack` is made of - the host's frames, then their words. */
|
|
2829
2829
|
declare abstract class ErrorStack { abstract frames(): StaticArray<u32>; abstract text(frames: StaticArray<u32>): string }
|
|
2830
2830
|
/** @hidden amxts: the hood's ErrorStack. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amxts/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "Counter-Strike 1.6 plugins in TypeScript: compiled ahead of time and run inside AMX Mod X, next to Pawn plugins.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "kukson777",
|
|
@@ -98,18 +98,18 @@
|
|
|
98
98
|
"access": "public"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@amxts/cli": "^0.2.
|
|
101
|
+
"@amxts/cli": "^0.2.1",
|
|
102
102
|
"bun": "^1.4.2",
|
|
103
103
|
"typescript": "^5.6.0",
|
|
104
104
|
"assemblyscript": "0.28.20"
|
|
105
105
|
},
|
|
106
106
|
"optionalDependencies": {
|
|
107
|
-
"@amxts/wamrc-linux-x64": "^0.2.
|
|
108
|
-
"@amxts/wamrc-win32-x64": "^0.2.
|
|
107
|
+
"@amxts/wamrc-linux-x64": "^0.2.3",
|
|
108
|
+
"@amxts/wamrc-win32-x64": "^0.2.3"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@amxts/config-core": "^0.1.
|
|
112
|
-
"@amxts/menu-core": "^0.2.
|
|
111
|
+
"@amxts/config-core": "^0.1.2",
|
|
112
|
+
"@amxts/menu-core": "^0.2.1",
|
|
113
113
|
"@e18e/eslint-plugin": "^0.8.1",
|
|
114
114
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
115
115
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
@@ -126,7 +126,8 @@
|
|
|
126
126
|
"oxfmt": "^0.70.0",
|
|
127
127
|
"oxlint": "^1.85.0",
|
|
128
128
|
"ssh2": "^1.17.0",
|
|
129
|
-
"ssh2-sftp-client": "^12.1.1"
|
|
129
|
+
"ssh2-sftp-client": "^12.1.1",
|
|
130
|
+
"vitest": "^5.0.3"
|
|
130
131
|
},
|
|
131
132
|
"bundleDependencies": [
|
|
132
133
|
"assemblyscript"
|
package/scripts/asc.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// asc - the patched AssemblyScript compiler (runtime/patches explains what it
|
|
2
2
|
// carries and why) - as every build here runs it.
|
|
3
|
-
|
|
4
|
-
import { fullGC } from 'bun:jsc';
|
|
3
|
+
import process from 'node:process';
|
|
5
4
|
// @ts-ignore - shipped as JavaScript, with types beside it we do not need here
|
|
6
5
|
import asc from '../runtime/deps/assemblyscript/dist/asc.js';
|
|
7
6
|
|
|
7
|
+
// A full collection: Bun's own; elsewhere the runtime's `gc`, when it exposes one (`node --expose-gc`).
|
|
8
|
+
// @ts-ignore - bun's own module
|
|
9
|
+
const fullGC: () => void = process.versions.bun ? (await import('bun:jsc')).fullGC : () => globalThis.gc?.();
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* asc.main, and nothing of the compile kept alive after it.
|
|
10
13
|
*
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// A compile process of scripts/compile-pool.ts: compiles the plugins it is
|
|
2
|
-
// sent, one at a time, through the build's plugin cache (scripts/plugin-cache.ts),
|
|
3
|
-
// and answers each with what went wrong and the plugin's natives. It ends when
|
|
4
|
-
// the build disconnects.
|
|
5
|
-
import type { WorkerJob, WorkerResult } from './compile-pool';
|
|
6
|
-
import type { PluginNative } from './plugin-natives';
|
|
7
|
-
import { pluginCache } from './plugin-cache';
|
|
8
|
-
import { nativesBeside } from './plugin-natives';
|
|
9
|
-
|
|
10
|
-
const caches = new Map<string, ReturnType<typeof pluginCache>>();
|
|
11
|
-
|
|
12
|
-
process.on('message', async ({ plugin, dir, includes }: WorkerJob) => {
|
|
13
|
-
const key = JSON.stringify([dir, includes]);
|
|
14
|
-
if (!caches.has(key)) caches.set(key, pluginCache(dir, includes));
|
|
15
|
-
const natives: PluginNative[] = [];
|
|
16
|
-
let problem: string | null;
|
|
17
|
-
try {
|
|
18
|
-
problem = await caches.get(key)!.compile(plugin, natives);
|
|
19
|
-
} catch (error) {
|
|
20
|
-
problem = String((error as Error).stack ?? error);
|
|
21
|
-
}
|
|
22
|
-
process.send!({ problem, natives, beside: nativesBeside(natives) } satisfies WorkerResult);
|
|
23
|
-
});
|
|
1
|
+
// A compile process of scripts/compile-pool.ts: compiles the plugins it is
|
|
2
|
+
// sent, one at a time, through the build's plugin cache (scripts/plugin-cache.ts),
|
|
3
|
+
// and answers each with what went wrong and the plugin's natives. It ends when
|
|
4
|
+
// the build disconnects.
|
|
5
|
+
import type { WorkerJob, WorkerResult } from './compile-pool';
|
|
6
|
+
import type { PluginNative } from './plugin-natives';
|
|
7
|
+
import { pluginCache } from './plugin-cache';
|
|
8
|
+
import { nativesBeside } from './plugin-natives';
|
|
9
|
+
|
|
10
|
+
const caches = new Map<string, ReturnType<typeof pluginCache>>();
|
|
11
|
+
|
|
12
|
+
process.on('message', async ({ plugin, dir, includes }: WorkerJob) => {
|
|
13
|
+
const key = JSON.stringify([dir, includes]);
|
|
14
|
+
if (!caches.has(key)) caches.set(key, pluginCache(dir, includes));
|
|
15
|
+
const natives: PluginNative[] = [];
|
|
16
|
+
let problem: string | null;
|
|
17
|
+
try {
|
|
18
|
+
problem = await caches.get(key)!.compile(plugin, natives);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
problem = String((error as Error).stack ?? error);
|
|
21
|
+
}
|
|
22
|
+
process.send!({ problem, natives, beside: nativesBeside(natives) } satisfies WorkerResult);
|
|
23
|
+
});
|