@amxts/core 0.1.0
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 +162 -0
- package/README.ru.md +162 -0
- package/amxmodx/base/include/amxconst.inc +594 -0
- package/amxmodx/base/include/amxmisc.inc +902 -0
- package/amxmodx/base/include/amxmodx.inc +3447 -0
- package/amxmodx/base/include/amxmodx_version.inc +20 -0
- package/amxmodx/base/include/cellarray.inc +525 -0
- package/amxmodx/base/include/cellstack.inc +166 -0
- package/amxmodx/base/include/celltrie.inc +412 -0
- package/amxmodx/base/include/core.inc +202 -0
- package/amxmodx/base/include/csstats.inc +298 -0
- package/amxmodx/base/include/csstats_const.inc +29 -0
- package/amxmodx/base/include/cstrike.inc +1287 -0
- package/amxmodx/base/include/cstrike_const.inc +521 -0
- package/amxmodx/base/include/csx.inc +259 -0
- package/amxmodx/base/include/cvars.inc +547 -0
- package/amxmodx/base/include/datapack.inc +161 -0
- package/amxmodx/base/include/dbi.inc +154 -0
- package/amxmodx/base/include/dodconst.inc +152 -0
- package/amxmodx/base/include/dodfun.inc +152 -0
- package/amxmodx/base/include/dodstats.inc +69 -0
- package/amxmodx/base/include/dodx.inc +161 -0
- package/amxmodx/base/include/engine.inc +1343 -0
- package/amxmodx/base/include/engine_const.inc +310 -0
- package/amxmodx/base/include/engine_stocks.inc +248 -0
- package/amxmodx/base/include/esf.inc +70 -0
- package/amxmodx/base/include/esf_const.inc +74 -0
- package/amxmodx/base/include/fakemeta.inc +1127 -0
- package/amxmodx/base/include/fakemeta_const.inc +793 -0
- package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
- package/amxmodx/base/include/fakemeta_util.inc +882 -0
- package/amxmodx/base/include/file.inc +666 -0
- package/amxmodx/base/include/float.inc +422 -0
- package/amxmodx/base/include/fun.inc +333 -0
- package/amxmodx/base/include/gameconfig.inc +93 -0
- package/amxmodx/base/include/geoip.inc +264 -0
- package/amxmodx/base/include/ham_const.inc +4352 -0
- package/amxmodx/base/include/hamsandwich.inc +439 -0
- package/amxmodx/base/include/hlsdk_const.inc +808 -0
- package/amxmodx/base/include/json.inc +777 -0
- package/amxmodx/base/include/lang.inc +119 -0
- package/amxmodx/base/include/message_const.inc +1130 -0
- package/amxmodx/base/include/message_stocks.inc +161 -0
- package/amxmodx/base/include/messages.inc +604 -0
- package/amxmodx/base/include/newmenus.inc +387 -0
- package/amxmodx/base/include/ns.inc +754 -0
- package/amxmodx/base/include/ns_const.inc +196 -0
- package/amxmodx/base/include/nvault.inc +154 -0
- package/amxmodx/base/include/regex.inc +348 -0
- package/amxmodx/base/include/sockets.inc +183 -0
- package/amxmodx/base/include/sorting.inc +107 -0
- package/amxmodx/base/include/sqlx.inc +582 -0
- package/amxmodx/base/include/string.inc +786 -0
- package/amxmodx/base/include/string_const.inc +156 -0
- package/amxmodx/base/include/string_stocks.inc +325 -0
- package/amxmodx/base/include/textparse_ini.inc +214 -0
- package/amxmodx/base/include/textparse_smc.inc +261 -0
- package/amxmodx/base/include/tfcconst.inc +84 -0
- package/amxmodx/base/include/tfcstats.inc +62 -0
- package/amxmodx/base/include/tfcx.inc +148 -0
- package/amxmodx/base/include/time.inc +118 -0
- package/amxmodx/base/include/tsconst.inc +154 -0
- package/amxmodx/base/include/tsfun.inc +198 -0
- package/amxmodx/base/include/tsstats.inc +65 -0
- package/amxmodx/base/include/tsx.inc +88 -0
- package/amxmodx/base/include/vault.inc +60 -0
- package/amxmodx/base/include/vector.inc +131 -0
- package/amxmodx/base/include/xs.inc +1570 -0
- package/as/amxts.d.ts +153 -0
- package/as/constants.ts +4730 -0
- package/as/effects.ts +1449 -0
- package/as/entities.ts +5482 -0
- package/as/events.ts +3054 -0
- package/as/facade.ts +4639 -0
- package/as/flags.ts +299 -0
- package/as/fs.ts +287 -0
- package/as/hooks.ts +18536 -0
- package/as/kit.ts +25 -0
- package/as/lib/check.ts +86 -0
- package/as/modules/http.ts +184 -0
- package/as/natives.ts +11845 -0
- package/as/os.ts +30 -0
- package/as/promise.ts +1392 -0
- package/as/promise.types.d.ts +82 -0
- package/as/remote.ts +288 -0
- package/as/tsconfig.json +22 -0
- package/as/vector.ts +65 -0
- package/bin/amxts.mjs +10 -0
- package/includes/menu_core.inc +355 -0
- package/includes/order.txt +54 -0
- package/includes/sources.json +27 -0
- package/includes/universal_config.inc +355 -0
- package/lint/oxlint-plugin.mjs +77 -0
- package/node_modules/assemblyscript/LICENSE +201 -0
- package/node_modules/assemblyscript/NOTICE +93 -0
- package/node_modules/assemblyscript/package.json +63 -0
- package/node_modules/assemblyscript/std/README.md +6 -0
- package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
- package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
- package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
- package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
- package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
- package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
- package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
- package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
- package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
- package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
- package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
- package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
- package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
- package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
- package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
- package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
- package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
- package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
- package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
- package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
- package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
- package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
- package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
- package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
- package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
- package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
- package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
- package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
- package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
- package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
- package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
- package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
- package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
- package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
- package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
- package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
- package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
- package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
- package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
- package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
- package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
- package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
- package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
- package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
- package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
- package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
- package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
- package/node_modules/assemblyscript/std/assembly.json +16 -0
- package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
- package/node_modules/assemblyscript/std/portable/index.js +416 -0
- package/node_modules/assemblyscript/std/portable.json +11 -0
- package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
- package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
- package/node_modules/assemblyscript/tsconfig-base.json +13 -0
- package/package.json +112 -0
- package/runtime/deps/assemblyscript/LICENSE +201 -0
- package/runtime/deps/assemblyscript/NOTICE +93 -0
- package/runtime/deps/assemblyscript/bin/asc.js +35 -0
- package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
- package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
- package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
- package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
- package/runtime/deps/assemblyscript/package.json +114 -0
- package/runtime/host/amxts.inc +85 -0
- package/runtime/licenses/AMXX-LICENSE.txt +34 -0
- package/runtime/licenses/AssemblyScript-LICENSE +201 -0
- package/runtime/licenses/AssemblyScript-NOTICE +93 -0
- package/runtime/licenses/Binaryen-LICENSE +201 -0
- package/runtime/licenses/Bun-LICENSE.md +84 -0
- package/runtime/licenses/GPL-3.0.txt +674 -0
- package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
- package/runtime/licenses/README.md +25 -0
- package/runtime/licenses/WAMR-LICENSE +219 -0
- package/runtime/natives.txt +1095 -0
- package/runtime/patches/README.md +59 -0
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
- package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
- package/scripts/apply-docs.ts +508 -0
- package/scripts/asc.ts +27 -0
- package/scripts/auto-imports.ts +258 -0
- package/scripts/build-wasm.ts +595 -0
- package/scripts/check.ts +93 -0
- package/scripts/compile-cache.ts +179 -0
- package/scripts/compile.ts +401 -0
- package/scripts/docker-server.ts +73 -0
- package/scripts/docs/as/amxts.ts +210 -0
- package/scripts/docs/as/effects.ts +1684 -0
- package/scripts/docs/as/facade.ts +3302 -0
- package/scripts/docs/as/fs.ts +173 -0
- package/scripts/docs/as/lib/check.ts +68 -0
- package/scripts/docs/as/modules/http.ts +66 -0
- package/scripts/docs/as/os.ts +16 -0
- package/scripts/docs/as/promise.ts +132 -0
- package/scripts/docs/as/promise.types.ts +63 -0
- package/scripts/docs/as/vector.ts +48 -0
- package/scripts/docs/entities.ts +2338 -0
- package/scripts/docs/events.ts +245 -0
- package/scripts/docs/game.ts +497 -0
- package/scripts/docs/messages.ts +148 -0
- package/scripts/file-contents.ts +74 -0
- package/scripts/includes.ts +134 -0
- package/scripts/player-fields.ts +866 -0
- package/scripts/plugin-cache.ts +92 -0
- package/scripts/plugin-natives.ts +1157 -0
- package/scripts/prebuilt.ts +268 -0
- package/scripts/prepare.ts +134 -0
- package/scripts/project.ts +973 -0
- package/scripts/run.ts +28 -0
- package/scripts/shared-modules.ts +906 -0
- package/scripts/system.ts +33 -0
- package/scripts/tracked-fs.ts +115 -0
- package/scripts/typed-configs.ts +788 -0
- package/scripts/ui.ts +77 -0
- package/src/cli-api.mjs +175 -0
- package/src/parser/include-parser.ts +506 -0
- package/src/system.mjs +155 -0
- package/src/testing/compile-cache.ts +31 -0
- package/src/testing/compile.ts +222 -0
- package/src/testing/coroutines.ts +191 -0
- package/src/testing/index.ts +39 -0
- package/src/testing/kits.ts +55 -0
- package/src/testing/memory.ts +125 -0
- package/src/testing/natives.ts +925 -0
- package/src/testing/server.ts +1874 -0
- package/src/testing/setup.ts +63 -0
- package/src/testing/tables.ts +139 -0
- package/src/types.ts +51 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/** @module std/portable *//***/
|
|
2
|
+
|
|
3
|
+
let globalScope = typeof window !== "undefined" && window || typeof global !== "undefined" && global || self;
|
|
4
|
+
if (typeof globalScope.ASC_TARGET === "undefined") {
|
|
5
|
+
|
|
6
|
+
globalScope.ASC_TARGET = 0; // Target.JS
|
|
7
|
+
globalScope.ASC_RUNTIME = 0; // Runtime.Stub
|
|
8
|
+
globalScope.ASC_NO_ASSERT = false;
|
|
9
|
+
globalScope.ASC_MEMORY_BASE = 0;
|
|
10
|
+
globalScope.ASC_OPTIMIZE_LEVEL = 3;
|
|
11
|
+
globalScope.ASC_SHRINK_LEVEL = 0;
|
|
12
|
+
globalScope.ASC_FEATURE_MUTABLE_GLOBAL = false;
|
|
13
|
+
globalScope.ASC_FEATURE_SIGN_EXTENSION = false;
|
|
14
|
+
globalScope.ASC_FEATURE_BULK_MEMORY = false;
|
|
15
|
+
globalScope.ASC_FEATURE_SIMD = false;
|
|
16
|
+
globalScope.ASC_FEATURE_THREADS = false;
|
|
17
|
+
|
|
18
|
+
let F64 = new Float64Array(1);
|
|
19
|
+
let U64 = new Uint32Array(F64.buffer);
|
|
20
|
+
|
|
21
|
+
Object.defineProperties(
|
|
22
|
+
globalScope["i8"] = function i8(value) { return value << 24 >> 24; },
|
|
23
|
+
{
|
|
24
|
+
"MIN_VALUE": { value: -128 },
|
|
25
|
+
"MAX_VALUE": { value: 127 },
|
|
26
|
+
|
|
27
|
+
parse(str, radix) { return parseInt(str, radix) << 24 >> 24; }
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
Object.defineProperties(
|
|
32
|
+
globalScope["i16"] = function i16(value) { return value << 16 >> 16; },
|
|
33
|
+
{
|
|
34
|
+
"MIN_VALUE": { value: -32768 },
|
|
35
|
+
"MAX_VALUE": { value: 32767 },
|
|
36
|
+
|
|
37
|
+
parse(str, radix) { return parseInt(str, radix) << 16 >> 16; }
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
Object.defineProperties(
|
|
42
|
+
globalScope["i32"] = globalScope["isize"] = function i32(value) { return value | 0; },
|
|
43
|
+
{
|
|
44
|
+
"MIN_VALUE": { value: -2147483648 },
|
|
45
|
+
"MAX_VALUE": { value: 2147483647 },
|
|
46
|
+
|
|
47
|
+
parse(str, radix) { return parseInt(str, radix) | 0; }
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
Object.defineProperties(
|
|
52
|
+
globalScope["u8"] = function u8(value) { return value & 0xff; },
|
|
53
|
+
{
|
|
54
|
+
"MIN_VALUE": { value: 0 },
|
|
55
|
+
"MAX_VALUE": { value: 255 },
|
|
56
|
+
|
|
57
|
+
parse(str, radix) { return parseInt(str, radix) & 0xff; }
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
Object.defineProperties(
|
|
62
|
+
globalScope["u16"] = function u16(value) { return value & 0xffff; },
|
|
63
|
+
{
|
|
64
|
+
"MIN_VALUE": { value: 0 },
|
|
65
|
+
"MAX_VALUE": { value: 65535 },
|
|
66
|
+
|
|
67
|
+
parse(str, radix) { return parseInt(str, radix) & 0xffff; }
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
Object.defineProperties(
|
|
72
|
+
globalScope["u32"] = globalScope["usize"] = function u32(value) { return value >>> 0; },
|
|
73
|
+
{
|
|
74
|
+
"MIN_VALUE": { value: 0 },
|
|
75
|
+
"MAX_VALUE": { value: 4294967295 },
|
|
76
|
+
|
|
77
|
+
parse(str, radix) { return parseInt(str, radix) >>> 0; }
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
Object.defineProperties(
|
|
82
|
+
globalScope["bool"] = function bool(value) { return !!value; },
|
|
83
|
+
{
|
|
84
|
+
"MIN_VALUE": { value: false },
|
|
85
|
+
"MAX_VALUE": { value: true },
|
|
86
|
+
|
|
87
|
+
parse(str) { return str.trim() === "true"; }
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
Object.defineProperties(
|
|
92
|
+
globalScope["f32"] = function f32(value) { return Math.fround(value); },
|
|
93
|
+
{
|
|
94
|
+
"EPSILON": { value: 1.1920928955078125e-07 },
|
|
95
|
+
"MIN_VALUE": { value: 1.401298464324817e-45 },
|
|
96
|
+
"MAX_VALUE": { value: 3.4028234663852886e+38 },
|
|
97
|
+
"MIN_NORMAL_VALUE": { value: 1.1754943508222875e-38 },
|
|
98
|
+
"MIN_SAFE_INTEGER": { value: -16777215 },
|
|
99
|
+
"MAX_SAFE_INTEGER": { value: 16777215 },
|
|
100
|
+
"POSITIVE_INFINITY": { value: Infinity },
|
|
101
|
+
"NEGATIVE_INFINITY": { value: -Infinity },
|
|
102
|
+
"NaN": { value: NaN },
|
|
103
|
+
|
|
104
|
+
parse(str) { return Math.fround(parseFloat(str)); }
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
Object.defineProperties(
|
|
109
|
+
globalScope["f64"] = function f64(value) { return +value; },
|
|
110
|
+
{
|
|
111
|
+
"EPSILON": { value: 2.2204460492503131e-016 },
|
|
112
|
+
"MIN_VALUE": { value: 5e-324 },
|
|
113
|
+
"MAX_VALUE": { value: 1.7976931348623157e+308 },
|
|
114
|
+
"MIN_NORMAL_VALUE": { value: 2.2250738585072014e-308 },
|
|
115
|
+
"MIN_SAFE_INTEGER": { value: -9007199254740991 },
|
|
116
|
+
"MAX_SAFE_INTEGER": { value: 9007199254740991 },
|
|
117
|
+
"POSITIVE_INFINITY": { value: Infinity },
|
|
118
|
+
"NEGATIVE_INFINITY": { value: -Infinity },
|
|
119
|
+
"NaN": { value: NaN },
|
|
120
|
+
|
|
121
|
+
parse(str) { return parseFloat(str); }
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
globalScope["clz"] = Math.clz32;
|
|
126
|
+
|
|
127
|
+
globalScope["ctz"] = function ctz(value) {
|
|
128
|
+
return 32 - Math.clz32(~value & (value - 1));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
globalScope["popcnt"] = function popcnt(value) {
|
|
132
|
+
value -= value >>> 1 & 0x55555555;
|
|
133
|
+
value = (value & 0x33333333) + (value >>> 2 & 0x33333333);
|
|
134
|
+
return (((value + (value >>> 4)) & 0x0F0F0F0F) * 0x01010101) >>> 24;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
globalScope["rotl"] = function rotl(value, shift) {
|
|
138
|
+
shift &= 31;
|
|
139
|
+
return (value << shift) | (value >>> (32 - shift));
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
globalScope["rotr"] = function rotr(value, shift) {
|
|
143
|
+
shift &= 31;
|
|
144
|
+
return (value >>> shift) | (value << (32 - shift));
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
globalScope["abs"] = Math.abs;
|
|
148
|
+
|
|
149
|
+
globalScope["max"] = Math.max;
|
|
150
|
+
|
|
151
|
+
globalScope["min"] = Math.min;
|
|
152
|
+
|
|
153
|
+
globalScope["ceil"] = Math.ceil;
|
|
154
|
+
|
|
155
|
+
globalScope["floor"] = Math.floor;
|
|
156
|
+
|
|
157
|
+
globalScope["nearest"] = function nearest(value) {
|
|
158
|
+
const INV_EPS64 = 4503599627370496.0;
|
|
159
|
+
const y = Math.abs(value);
|
|
160
|
+
return y < INV_EPS64
|
|
161
|
+
? (y + INV_EPS64 - INV_EPS64) * Math.sign(value)
|
|
162
|
+
: value;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
globalScope["select"] = function select(ifTrue, ifFalse, condition) {
|
|
166
|
+
return condition ? ifTrue : ifFalse;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
globalScope["sqrt"] = Math.sqrt;
|
|
170
|
+
|
|
171
|
+
globalScope["trunc"] = Math.trunc;
|
|
172
|
+
|
|
173
|
+
globalScope["copysign"] = function copysign(x, y) {
|
|
174
|
+
return y
|
|
175
|
+
? Math.abs(x) * Math.sign(y)
|
|
176
|
+
: (F64[0] = y, U64[1] >>> 31 ? -1 : 1); // +0, -0, -NaN, +NaN
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
globalScope["bswap"] = function bswap(value) {
|
|
180
|
+
let a = value >> 8 & 0x00FF00FF;
|
|
181
|
+
let b = (value & 0x00FF00FF) << 8;
|
|
182
|
+
value = a | b;
|
|
183
|
+
a = value >> 16 & 0x0000FFFF;
|
|
184
|
+
b = (value & 0x0000FFFF) << 16;
|
|
185
|
+
return a | b;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
function UnreachableError() {
|
|
189
|
+
if (Error.captureStackTrace) {
|
|
190
|
+
Error.captureStackTrace(this, UnreachableError);
|
|
191
|
+
} else {
|
|
192
|
+
this.stack = this.name + ": " + this.message + "\n" + new Error().stack;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
UnreachableError.prototype = Object.create(Error.prototype);
|
|
196
|
+
UnreachableError.prototype.name = "UnreachableError";
|
|
197
|
+
UnreachableError.prototype.message = "unreachable";
|
|
198
|
+
|
|
199
|
+
globalScope["unreachable"] = function unreachable() {
|
|
200
|
+
throw new UnreachableError();
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
function AssertionError(message) {
|
|
204
|
+
this.message = message || "assertion failed";
|
|
205
|
+
if (Error.captureStackTrace) {
|
|
206
|
+
Error.captureStackTrace(this, AssertionError);
|
|
207
|
+
} else {
|
|
208
|
+
this.stack = this.name + ": " + this.message + "\n" + new Error().stack;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
AssertionError.prototype = Object.create(Error.prototype);
|
|
212
|
+
AssertionError.prototype.name = "AssertionError";
|
|
213
|
+
|
|
214
|
+
globalScope["assert"] = function assert(isTrueish, message) {
|
|
215
|
+
if (isTrueish) return isTrueish;
|
|
216
|
+
throw new AssertionError(message);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
globalScope["changetype"] = function changetype(value) {
|
|
220
|
+
return value;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
String["fromCharCodes"] = function fromCharCodes(arr) {
|
|
224
|
+
const CHUNKSIZE = 1 << 13;
|
|
225
|
+
const len = arr.length;
|
|
226
|
+
if (len <= CHUNKSIZE) {
|
|
227
|
+
return String.fromCharCode.apply(String, arr);
|
|
228
|
+
}
|
|
229
|
+
let index = 0;
|
|
230
|
+
let parts = '';
|
|
231
|
+
while (index < len) {
|
|
232
|
+
parts += String.fromCharCode.apply(
|
|
233
|
+
String,
|
|
234
|
+
arr.slice(index, Math.min(index + CHUNKSIZE, len))
|
|
235
|
+
);
|
|
236
|
+
index += CHUNKSIZE;
|
|
237
|
+
}
|
|
238
|
+
return parts;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
String["fromCodePoints"] = function fromCodePoints(arr) {
|
|
242
|
+
const CHUNKSIZE = 1 << 13;
|
|
243
|
+
const len = arr.length;
|
|
244
|
+
if (len <= CHUNKSIZE) {
|
|
245
|
+
return String.fromCodePoint.apply(String, arr);
|
|
246
|
+
}
|
|
247
|
+
let index = 0;
|
|
248
|
+
let parts = '';
|
|
249
|
+
while (index < len) {
|
|
250
|
+
parts += String.fromCodePoint.apply(
|
|
251
|
+
String,
|
|
252
|
+
arr.slice(index, Math.min(index + CHUNKSIZE, len))
|
|
253
|
+
);
|
|
254
|
+
index += CHUNKSIZE;
|
|
255
|
+
}
|
|
256
|
+
return parts;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
if (!String.prototype.at) {
|
|
260
|
+
Object.defineProperty(String.prototype, "at", {
|
|
261
|
+
value: function at(index) {
|
|
262
|
+
return this.charAt(index >= 0 ? index : index + this.length);
|
|
263
|
+
},
|
|
264
|
+
configurable: true
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (!String.prototype.replaceAll) {
|
|
269
|
+
Object.defineProperty(String.prototype, "replaceAll", {
|
|
270
|
+
value: function replaceAll(search, replacement) {
|
|
271
|
+
let res = this.split(search).join(replacement);
|
|
272
|
+
if (!search.length) res = replacement + res + replacement;
|
|
273
|
+
return res;
|
|
274
|
+
},
|
|
275
|
+
configurable: true
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function defaultComparator(a, b) {
|
|
280
|
+
if (a == b) {
|
|
281
|
+
if (a != 0) return 0;
|
|
282
|
+
a = 1 / a;
|
|
283
|
+
b = 1 / b;
|
|
284
|
+
} else {
|
|
285
|
+
let nanA = a != a, nanB = b != b;
|
|
286
|
+
if (nanA | nanB) return nanA - nanB;
|
|
287
|
+
if (a == null) a = String(a);
|
|
288
|
+
if (b == null) b = String(b);
|
|
289
|
+
}
|
|
290
|
+
return a > b ? 1 : -1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const arraySort = Array.prototype.sort;
|
|
294
|
+
Array.prototype.sort = function sort(comparator) {
|
|
295
|
+
return arraySort.call(this, comparator || defaultComparator);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
[ Array,
|
|
299
|
+
Uint8ClampedArray,
|
|
300
|
+
Uint8Array, Int8Array,
|
|
301
|
+
Uint16Array, Int16Array,
|
|
302
|
+
Uint32Array, Int32Array,
|
|
303
|
+
Float32Array, Float64Array
|
|
304
|
+
].forEach(Ctr => {
|
|
305
|
+
if (!Ctr.prototype.at) {
|
|
306
|
+
Object.defineProperty(Ctr.prototype, "at", {
|
|
307
|
+
value: function at(index) {
|
|
308
|
+
return this[index >= 0 ? index : index + this.length];
|
|
309
|
+
},
|
|
310
|
+
configurable: true
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (!Ctr.prototype.findLastIndex) {
|
|
315
|
+
Object.defineProperty(Ctr.prototype, "findLastIndex", {
|
|
316
|
+
value: function findLastIndex(fn) {
|
|
317
|
+
for (let i = this.length - 1; i >= 0; --i) {
|
|
318
|
+
if (fn(this[i], i, this)) return i;
|
|
319
|
+
}
|
|
320
|
+
return -1;
|
|
321
|
+
},
|
|
322
|
+
configurable: true
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (Ctr != Array) {
|
|
327
|
+
Object.defineProperty(Ctr, "wrap", {
|
|
328
|
+
value: function wrap(buffer, byteOffset, length) {
|
|
329
|
+
return new Ctr(buffer, byteOffset, length);
|
|
330
|
+
},
|
|
331
|
+
configurable: true
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
globalScope["isInteger"] = Number.isInteger;
|
|
337
|
+
|
|
338
|
+
globalScope["isFloat"] = function isFloat(arg) {
|
|
339
|
+
return typeof arg === "number";
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
globalScope["isNullable"] = function isNullable(arg) {
|
|
343
|
+
return true;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
globalScope["isReference"] = function isReference(arg) {
|
|
347
|
+
return typeof arg === "object" || typeof arg === "string";
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
globalScope["isFunction"] = function isFunction(arg) {
|
|
351
|
+
return typeof arg === "function";
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
globalScope["isString"] = function isString(arg) {
|
|
355
|
+
return typeof arg === "string" || arg instanceof String;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
globalScope["isArray"] = Array.isArray;
|
|
359
|
+
globalScope["isArrayLike"] = function isArrayLike(expr) {
|
|
360
|
+
return expr
|
|
361
|
+
&& typeof expr === 'object'
|
|
362
|
+
&& typeof expr.length === 'number'
|
|
363
|
+
&& expr.length >= 0
|
|
364
|
+
&& Math.trunc(expr.length) === expr.length;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
globalScope["isDefined"] = function isDefined(expr) {
|
|
368
|
+
return typeof expr !== "undefined";
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
globalScope["isConstant"] = function isConstant(expr) {
|
|
372
|
+
return false;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
globalScope["unchecked"] = function unchecked(expr) {
|
|
376
|
+
return expr;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
globalScope["fmod"] = function fmod(x, y) {
|
|
380
|
+
return x % y;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
globalScope["fmodf"] = function fmodf(x, y) {
|
|
384
|
+
return Math.fround(x % y);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
globalScope["JSMath"] = Math;
|
|
388
|
+
|
|
389
|
+
Object.defineProperties(globalScope["JSMath"], {
|
|
390
|
+
sincos_sin: { value: 0.0, writable: true },
|
|
391
|
+
sincos_cos: { value: 0.0, writable: true },
|
|
392
|
+
signbit: {
|
|
393
|
+
value: function signbit(x) {
|
|
394
|
+
F64[0] = x; return Boolean(U64[1] >>> 31);
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
sincos: {
|
|
398
|
+
value: function sincos(x) {
|
|
399
|
+
this.sincos_sin = Math.sin(x);
|
|
400
|
+
this.sincos_cos = Math.cos(x);
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
exp2: {
|
|
404
|
+
value: function exp2(x) {
|
|
405
|
+
return Math.pow(2, x);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
globalScope["unmanaged"] = function() { /* nop */ };
|
|
411
|
+
|
|
412
|
+
globalScope["trace"] = function(message, n) {
|
|
413
|
+
if (n) message += Array.prototype.slice.call(arguments, 2, 2 + n);
|
|
414
|
+
console.error("trace: " + message);
|
|
415
|
+
};
|
|
416
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../assembly/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../portable/index";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"alwaysStrict": true,
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitReturns": true,
|
|
7
|
+
"noImplicitThis": true,
|
|
8
|
+
"noEmitOnError": true,
|
|
9
|
+
"strictNullChecks": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"preserveConstEnums": false
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amxts/core",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Counter-Strike 1.6 plugins in TypeScript: compiled ahead of time and run inside AMX Mod X, next to Pawn plugins.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "kukson777",
|
|
8
|
+
"url": "https://github.com/kukson777"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"homepage": "https://amxts.github.io",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/amxts/amxts.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": "https://github.com/amxts/amxts/issues",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"amxmodx",
|
|
19
|
+
"counter-strike",
|
|
20
|
+
"cs16",
|
|
21
|
+
"typescript",
|
|
22
|
+
"assemblyscript",
|
|
23
|
+
"webassembly",
|
|
24
|
+
"game-server"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": "./as/facade.ts",
|
|
28
|
+
"./kit": "./as/kit.ts",
|
|
29
|
+
"./test-utils": "./src/testing/index.ts",
|
|
30
|
+
"./cli-api": "./src/cli-api.mjs",
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
"./*": "./*"
|
|
33
|
+
},
|
|
34
|
+
"types": "./as/facade.ts",
|
|
35
|
+
"bin": {
|
|
36
|
+
"amxts": "bin/amxts.mjs"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"README.ru.md",
|
|
40
|
+
"as",
|
|
41
|
+
"bin",
|
|
42
|
+
"lint",
|
|
43
|
+
"src",
|
|
44
|
+
"scripts/apply-docs.ts",
|
|
45
|
+
"scripts/asc.ts",
|
|
46
|
+
"scripts/auto-imports.ts",
|
|
47
|
+
"scripts/build-wasm.ts",
|
|
48
|
+
"scripts/check.ts",
|
|
49
|
+
"scripts/compile-cache.ts",
|
|
50
|
+
"scripts/compile.ts",
|
|
51
|
+
"scripts/docker-server.ts",
|
|
52
|
+
"scripts/docs",
|
|
53
|
+
"scripts/file-contents.ts",
|
|
54
|
+
"scripts/includes.ts",
|
|
55
|
+
"scripts/player-fields.ts",
|
|
56
|
+
"scripts/plugin-cache.ts",
|
|
57
|
+
"scripts/plugin-natives.ts",
|
|
58
|
+
"scripts/prebuilt.ts",
|
|
59
|
+
"scripts/prepare.ts",
|
|
60
|
+
"scripts/project.ts",
|
|
61
|
+
"scripts/run.ts",
|
|
62
|
+
"scripts/shared-modules.ts",
|
|
63
|
+
"scripts/system.ts",
|
|
64
|
+
"scripts/tracked-fs.ts",
|
|
65
|
+
"scripts/typed-configs.ts",
|
|
66
|
+
"scripts/ui.ts",
|
|
67
|
+
"includes/*.inc",
|
|
68
|
+
"includes/order.txt",
|
|
69
|
+
"includes/sources.json",
|
|
70
|
+
"amxmodx/base/include",
|
|
71
|
+
"runtime/host/amxts.inc",
|
|
72
|
+
"runtime/licenses",
|
|
73
|
+
"runtime/natives.txt",
|
|
74
|
+
"runtime/patches",
|
|
75
|
+
"runtime/deps/assemblyscript"
|
|
76
|
+
],
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=20.12"
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"@amxts/cli": "^0.1.0",
|
|
85
|
+
"bun": "^1.4.2",
|
|
86
|
+
"typescript": "^5.6.0",
|
|
87
|
+
"assemblyscript": "0.28.20"
|
|
88
|
+
},
|
|
89
|
+
"optionalDependencies": {
|
|
90
|
+
"@amxts/wamrc-linux-x64": "^0.1.0",
|
|
91
|
+
"@amxts/wamrc-win32-x64": "^0.1.0"
|
|
92
|
+
},
|
|
93
|
+
"devDependencies": {
|
|
94
|
+
"@amxts/config-core": "^0.1.0",
|
|
95
|
+
"@amxts/menu-core": "^0.1.0",
|
|
96
|
+
"@e18e/eslint-plugin": "^0.8.1",
|
|
97
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
98
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
99
|
+
"@types/node": "^22.0.0",
|
|
100
|
+
"binaryen": "131.0.0-nightly.20260721",
|
|
101
|
+
"eslint-plugin-antfu": "^3.2.3",
|
|
102
|
+
"eslint-plugin-command": "^4.0.0",
|
|
103
|
+
"eslint-plugin-n": "^18.4.0",
|
|
104
|
+
"eslint-plugin-perfectionist": "^5.12.1",
|
|
105
|
+
"eslint-plugin-regexp": "^3.3.1",
|
|
106
|
+
"oxfmt": "^0.70.0",
|
|
107
|
+
"oxlint": "^1.85.0"
|
|
108
|
+
},
|
|
109
|
+
"bundleDependencies": [
|
|
110
|
+
"assemblyscript"
|
|
111
|
+
]
|
|
112
|
+
}
|