@colyseus/schema 4.0.0 → 4.0.2
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/build/cjs/{index.js → index.cjs} +1 -1
- package/build/cjs/index.cjs.map +1 -0
- package/build/esm/index.mjs.map +1 -1
- package/lib/Metadata.js +54 -58
- package/lib/Metadata.js.map +1 -1
- package/lib/Reflection.js +29 -32
- package/lib/Reflection.js.map +1 -1
- package/lib/Schema.js +41 -45
- package/lib/Schema.js.map +1 -1
- package/lib/annotations.d.ts +1 -1
- package/lib/annotations.js +58 -69
- package/lib/annotations.js.map +1 -1
- package/lib/bench_encode.js +24 -59
- package/lib/bench_encode.js.map +1 -1
- package/lib/benchmark.d.ts +1 -0
- package/lib/benchmark.js +218 -0
- package/lib/benchmark.js.map +1 -0
- package/lib/codegen/api.js +10 -41
- package/lib/codegen/api.js.map +1 -1
- package/lib/codegen/argv.js +1 -3
- package/lib/codegen/argv.js.map +1 -1
- package/lib/codegen/cli.js +4 -9
- package/lib/codegen/cli.js.map +1 -1
- package/lib/codegen/languages/cpp.js +5 -8
- package/lib/codegen/languages/cpp.js.map +1 -1
- package/lib/codegen/languages/csharp.js +5 -8
- package/lib/codegen/languages/csharp.js.map +1 -1
- package/lib/codegen/languages/haxe.js +3 -6
- package/lib/codegen/languages/haxe.js.map +1 -1
- package/lib/codegen/languages/java.js +3 -6
- package/lib/codegen/languages/java.js.map +1 -1
- package/lib/codegen/languages/js.js +4 -7
- package/lib/codegen/languages/js.js.map +1 -1
- package/lib/codegen/languages/lua.js +4 -7
- package/lib/codegen/languages/lua.js.map +1 -1
- package/lib/codegen/languages/ts.js +5 -8
- package/lib/codegen/languages/ts.js.map +1 -1
- package/lib/codegen/parser.js +22 -59
- package/lib/codegen/parser.js.map +1 -1
- package/lib/codegen/types.js +12 -51
- package/lib/codegen/types.js.map +1 -1
- package/lib/decoder/DecodeOperation.js +44 -51
- package/lib/decoder/DecodeOperation.js.map +1 -1
- package/lib/decoder/Decoder.js +24 -28
- package/lib/decoder/Decoder.js.map +1 -1
- package/lib/decoder/ReferenceTracker.js +10 -14
- package/lib/decoder/ReferenceTracker.js.map +1 -1
- package/lib/decoder/strategy/Callbacks.js +39 -43
- package/lib/decoder/strategy/Callbacks.js.map +1 -1
- package/lib/decoder/strategy/RawChanges.js +1 -4
- package/lib/decoder/strategy/RawChanges.js.map +1 -1
- package/lib/decoder/strategy/getDecoderStateCallbacks.js +24 -27
- package/lib/decoder/strategy/getDecoderStateCallbacks.js.map +1 -1
- package/lib/encoder/ChangeTree.js +36 -44
- package/lib/encoder/ChangeTree.js.map +1 -1
- package/lib/encoder/EncodeOperation.js +25 -32
- package/lib/encoder/EncodeOperation.js.map +1 -1
- package/lib/encoder/Encoder.d.ts +5 -5
- package/lib/encoder/Encoder.js +25 -29
- package/lib/encoder/Encoder.js.map +1 -1
- package/lib/encoder/Root.js +17 -21
- package/lib/encoder/Root.js.map +1 -1
- package/lib/encoder/StateView.js +40 -45
- package/lib/encoder/StateView.js.map +1 -1
- package/lib/encoding/assert.js +3 -9
- package/lib/encoding/assert.js.map +1 -1
- package/lib/encoding/decode.js +2 -6
- package/lib/encoding/decode.js.map +1 -1
- package/lib/encoding/encode.js +1 -4
- package/lib/encoding/encode.js.map +1 -1
- package/lib/encoding/spec.js +4 -7
- package/lib/encoding/spec.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +33 -75
- package/lib/index.js.map +1 -1
- package/lib/src/Metadata.d.ts +49 -0
- package/lib/src/Metadata.js +256 -0
- package/lib/src/Metadata.js.map +1 -0
- package/lib/src/Reflection.d.ts +71 -0
- package/lib/src/Reflection.js +179 -0
- package/lib/src/Reflection.js.map +1 -0
- package/lib/src/Schema.d.ts +86 -0
- package/lib/src/Schema.js +352 -0
- package/lib/src/Schema.js.map +1 -0
- package/lib/src/annotations.d.ts +109 -0
- package/lib/src/annotations.js +473 -0
- package/lib/src/annotations.js.map +1 -0
- package/lib/src/bench_encode.d.ts +1 -0
- package/lib/src/bench_encode.js +91 -0
- package/lib/src/bench_encode.js.map +1 -0
- package/lib/src/codegen/api.d.ts +7 -0
- package/lib/src/codegen/api.js +56 -0
- package/lib/src/codegen/api.js.map +1 -0
- package/lib/src/codegen/argv.d.ts +6 -0
- package/lib/src/codegen/argv.js +39 -0
- package/lib/src/codegen/argv.js.map +1 -0
- package/lib/src/codegen/cli.d.ts +1 -0
- package/lib/src/codegen/cli.js +58 -0
- package/lib/src/codegen/cli.js.map +1 -0
- package/lib/src/codegen/languages/cpp.d.ts +3 -0
- package/lib/src/codegen/languages/cpp.js +258 -0
- package/lib/src/codegen/languages/cpp.js.map +1 -0
- package/lib/src/codegen/languages/csharp.d.ts +4 -0
- package/lib/src/codegen/languages/csharp.js +154 -0
- package/lib/src/codegen/languages/csharp.js.map +1 -0
- package/lib/src/codegen/languages/haxe.d.ts +3 -0
- package/lib/src/codegen/languages/haxe.js +100 -0
- package/lib/src/codegen/languages/haxe.js.map +1 -0
- package/lib/src/codegen/languages/java.d.ts +6 -0
- package/lib/src/codegen/languages/java.js +100 -0
- package/lib/src/codegen/languages/java.js.map +1 -0
- package/lib/src/codegen/languages/js.d.ts +3 -0
- package/lib/src/codegen/languages/js.js +101 -0
- package/lib/src/codegen/languages/js.js.map +1 -0
- package/lib/src/codegen/languages/lua.d.ts +3 -0
- package/lib/src/codegen/languages/lua.js +103 -0
- package/lib/src/codegen/languages/lua.js.map +1 -0
- package/lib/src/codegen/languages/ts.d.ts +3 -0
- package/lib/src/codegen/languages/ts.js +116 -0
- package/lib/src/codegen/languages/ts.js.map +1 -0
- package/lib/src/codegen/parser.d.ts +13 -0
- package/lib/src/codegen/parser.js +327 -0
- package/lib/src/codegen/parser.js.map +1 -0
- package/lib/src/codegen/types.d.ts +52 -0
- package/lib/src/codegen/types.js +142 -0
- package/lib/src/codegen/types.js.map +1 -0
- package/lib/src/decoder/DecodeOperation.d.ts +23 -0
- package/lib/src/decoder/DecodeOperation.js +248 -0
- package/lib/src/decoder/DecodeOperation.js.map +1 -0
- package/lib/src/decoder/Decoder.d.ts +21 -0
- package/lib/src/decoder/Decoder.js +114 -0
- package/lib/src/decoder/Decoder.js.map +1 -0
- package/lib/src/decoder/ReferenceTracker.d.ts +25 -0
- package/lib/src/decoder/ReferenceTracker.js +135 -0
- package/lib/src/decoder/ReferenceTracker.js.map +1 -0
- package/lib/src/decoder/strategy/Callbacks.d.ts +154 -0
- package/lib/src/decoder/strategy/Callbacks.js +336 -0
- package/lib/src/decoder/strategy/Callbacks.js.map +1 -0
- package/lib/src/decoder/strategy/RawChanges.d.ts +3 -0
- package/lib/src/decoder/strategy/RawChanges.js +4 -0
- package/lib/src/decoder/strategy/RawChanges.js.map +1 -0
- package/lib/src/decoder/strategy/getDecoderStateCallbacks.d.ts +76 -0
- package/lib/src/decoder/strategy/getDecoderStateCallbacks.js +274 -0
- package/lib/src/decoder/strategy/getDecoderStateCallbacks.js.map +1 -0
- package/lib/src/encoder/ChangeTree.d.ts +135 -0
- package/lib/src/encoder/ChangeTree.js +534 -0
- package/lib/src/encoder/ChangeTree.js.map +1 -0
- package/lib/src/encoder/EncodeOperation.d.ts +22 -0
- package/lib/src/encoder/EncodeOperation.js +132 -0
- package/lib/src/encoder/EncodeOperation.js.map +1 -0
- package/lib/src/encoder/Encoder.d.ts +22 -0
- package/lib/src/encoder/Encoder.js +204 -0
- package/lib/src/encoder/Encoder.js.map +1 -0
- package/lib/src/encoder/Root.d.ts +28 -0
- package/lib/src/encoder/Root.js +229 -0
- package/lib/src/encoder/Root.js.map +1 -0
- package/lib/src/encoder/StateView.d.ts +34 -0
- package/lib/src/encoder/StateView.js +279 -0
- package/lib/src/encoder/StateView.js.map +1 -0
- package/lib/src/encoding/assert.d.ts +10 -0
- package/lib/src/encoding/assert.js +49 -0
- package/lib/src/encoding/assert.js.map +1 -0
- package/lib/src/encoding/decode.d.ts +67 -0
- package/lib/src/encoding/decode.js +217 -0
- package/lib/src/encoding/decode.js.map +1 -0
- package/lib/src/encoding/encode.d.ts +40 -0
- package/lib/src/encoding/encode.js +279 -0
- package/lib/src/encoding/encode.js.map +1 -0
- package/lib/src/encoding/spec.d.ts +24 -0
- package/lib/src/encoding/spec.js +26 -0
- package/lib/src/encoding/spec.js.map +1 -0
- package/lib/src/index.d.ts +32 -0
- package/lib/src/index.js +39 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/symbol.shim.d.ts +6 -0
- package/lib/src/symbol.shim.js +3 -0
- package/lib/src/symbol.shim.js.map +1 -0
- package/lib/src/types/HelperTypes.d.ts +77 -0
- package/lib/src/types/HelperTypes.js +2 -0
- package/lib/src/types/HelperTypes.js.map +1 -0
- package/lib/src/types/TypeContext.d.ts +31 -0
- package/lib/src/types/TypeContext.js +143 -0
- package/lib/src/types/TypeContext.js.map +1 -0
- package/lib/src/types/custom/ArraySchema.d.ts +270 -0
- package/lib/src/types/custom/ArraySchema.js +733 -0
- package/lib/src/types/custom/ArraySchema.js.map +1 -0
- package/lib/src/types/custom/CollectionSchema.d.ts +51 -0
- package/lib/src/types/custom/CollectionSchema.js +170 -0
- package/lib/src/types/custom/CollectionSchema.js.map +1 -0
- package/lib/src/types/custom/MapSchema.d.ts +51 -0
- package/lib/src/types/custom/MapSchema.js +222 -0
- package/lib/src/types/custom/MapSchema.js.map +1 -0
- package/lib/src/types/custom/SetSchema.d.ts +48 -0
- package/lib/src/types/custom/SetSchema.js +178 -0
- package/lib/src/types/custom/SetSchema.js.map +1 -0
- package/lib/src/types/registry.d.ts +16 -0
- package/lib/src/types/registry.js +30 -0
- package/lib/src/types/registry.js.map +1 -0
- package/lib/src/types/symbols.d.ts +33 -0
- package/lib/src/types/symbols.js +34 -0
- package/lib/src/types/symbols.js.map +1 -0
- package/lib/src/types/utils.d.ts +1 -0
- package/lib/src/types/utils.js +13 -0
- package/lib/src/types/utils.js.map +1 -0
- package/lib/src/utils.d.ts +13 -0
- package/lib/src/utils.js +49 -0
- package/lib/src/utils.js.map +1 -0
- package/lib/src/v3_bench.d.ts +1 -0
- package/lib/src/v3_bench.js +128 -0
- package/lib/src/v3_bench.js.map +1 -0
- package/lib/symbol.shim.js +1 -2
- package/lib/symbol.shim.js.map +1 -1
- package/lib/types/HelperTypes.js +1 -2
- package/lib/types/TypeContext.js +8 -12
- package/lib/types/TypeContext.js.map +1 -1
- package/lib/types/custom/ArraySchema.js +63 -67
- package/lib/types/custom/ArraySchema.js.map +1 -1
- package/lib/types/custom/CollectionSchema.js +27 -31
- package/lib/types/custom/CollectionSchema.js.map +1 -1
- package/lib/types/custom/MapSchema.js +37 -41
- package/lib/types/custom/MapSchema.js.map +1 -1
- package/lib/types/custom/SetSchema.js +28 -32
- package/lib/types/custom/SetSchema.js.map +1 -1
- package/lib/types/registry.js +13 -20
- package/lib/types/registry.js.map +1 -1
- package/lib/types/symbols.js +16 -19
- package/lib/types/symbols.js.map +1 -1
- package/lib/types/utils.js +1 -4
- package/lib/types/utils.js.map +1 -1
- package/lib/utils.js +9 -14
- package/lib/utils.js.map +1 -1
- package/lib/v3_bench.js +17 -19
- package/lib/v3_bench.js.map +1 -1
- package/package.json +9 -7
- package/src/codegen/api.ts +7 -0
- package/src/codegen/parser.ts +2 -2
- package/src/codegen/types.ts +5 -0
- package/src/encoder/Encoder.ts +24 -7
- package/src/index.ts +2 -2
- package/build/cjs/index.js.map +0 -1
- package/src/bench_encode.ts +0 -64
package/lib/utils.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.dumpChanges = dumpChanges;
|
|
5
|
-
exports.getNextPowerOf2 = getNextPowerOf2;
|
|
6
|
-
const spec_1 = require("./encoding/spec");
|
|
7
|
-
const symbols_1 = require("./types/symbols");
|
|
8
|
-
function getIndent(level) {
|
|
1
|
+
import { OPERATION } from "./encoding/spec";
|
|
2
|
+
import { $changes, $refId } from "./types/symbols";
|
|
3
|
+
export function getIndent(level) {
|
|
9
4
|
return (new Array(level).fill(0)).map((_, i) => (i === level - 1) ? `└─ ` : ` `).join("");
|
|
10
5
|
}
|
|
11
|
-
function dumpChanges(schema) {
|
|
12
|
-
const $root = schema[
|
|
6
|
+
export function dumpChanges(schema) {
|
|
7
|
+
const $root = schema[$changes].root;
|
|
13
8
|
const dump = {
|
|
14
9
|
ops: {},
|
|
15
10
|
refs: []
|
|
@@ -24,20 +19,20 @@ function dumpChanges(schema) {
|
|
|
24
19
|
continue;
|
|
25
20
|
}
|
|
26
21
|
const changes = changeTree.indexedOperations;
|
|
27
|
-
dump.refs.push(`refId#${changeTree.ref[
|
|
22
|
+
dump.refs.push(`refId#${changeTree.ref[$refId]}`);
|
|
28
23
|
for (const index in changes) {
|
|
29
24
|
const op = changes[index];
|
|
30
|
-
const opName =
|
|
25
|
+
const opName = OPERATION[op];
|
|
31
26
|
if (!dump.ops[opName]) {
|
|
32
27
|
dump.ops[opName] = 0;
|
|
33
28
|
}
|
|
34
|
-
dump.ops[
|
|
29
|
+
dump.ops[OPERATION[op]]++;
|
|
35
30
|
}
|
|
36
31
|
current = current.next;
|
|
37
32
|
}
|
|
38
33
|
return dump;
|
|
39
34
|
}
|
|
40
|
-
function getNextPowerOf2(number) {
|
|
35
|
+
export function getNextPowerOf2(number) {
|
|
41
36
|
// If number is already a power of 2, return it
|
|
42
37
|
if ((number & (number - 1)) === 0) {
|
|
43
38
|
return number;
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAWnD,MAAM,UAAU,SAAS,CAAC,KAAa;IACnC,OAAO,CAAC,IAAI,KAAK,CAAC,KAAK,C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;QACzD,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAc;IAC1C,+CAA+C;IAC/C,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,gDAAgD;IAChD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,OAAO,MAAM,GAAG,CAAC,EAAE,CAAC;QAChB,MAAM,KAAK,CAAC,CAAC;QACb,WAAW,EAAE,CAAC;IAClB,CAAC;IAED,6BAA6B;IAC7B,OAAO,CAAC,IAAI,WAAW,CAAC;AAC5B,CAAC","sourcesContent":["import type { Schema } from \"./Schema\";\nimport { OPERATION } from \"./encoding/spec\";\nimport { $changes, $refId } from \"./types/symbols\";\n\ninterface ChangeDump {\n ops: {\n ADD?: number;\n REMOVE?: number;\n REPLACE?: number;\n },\n refs: string[],\n}\n\nexport function getIndent(level: number) {\n return (new Array(level).fill(0)).map((_, i) =>\n (i === level - 1) ? `└─ ` : ` `\n ).join(\"\");\n}\n\nexport function dumpChanges(schema: Schema) {\n const $root = schema[$changes].root;\n\n const dump: ChangeDump = {\n ops: {},\n refs: []\n };\n\n // for (const refId in $root.changes) {\n let current = $root.changes.next;\n while (current) {\n const changeTree = current.changeTree;\n // skip if ChangeTree is undefined\n if (changeTree === undefined) {\n current = current.next;\n continue;\n }\n\n const changes = changeTree.indexedOperations;\n\n dump.refs.push(`refId#${changeTree.ref[$refId]}`);\n for (const index in changes) {\n const op = changes[index];\n const opName = OPERATION[op];\n if (!dump.ops[opName as keyof ChangeDump['ops']]) { dump.ops[opName as keyof ChangeDump['ops']] = 0; }\n dump.ops[OPERATION[op] as keyof ChangeDump['ops']]++;\n }\n current = current.next;\n }\n\n return dump;\n}\n\nexport function getNextPowerOf2(number: number) {\n // If number is already a power of 2, return it\n if ((number & (number - 1)) === 0) {\n return number;\n }\n\n // Find the position of the most significant bit\n let msbPosition = 0;\n while (number > 0) {\n number >>= 1;\n msbPosition++;\n }\n\n // Return the next power of 2\n return 1 << msbPosition;\n}"]}
|
package/lib/v3_bench.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
const index_1 = require("./index");
|
|
7
|
+
import { Schema, type, MapSchema, Encoder, Decoder } from "./index";
|
|
10
8
|
// globalThis.interval = setInterval(() => {}, 1000);
|
|
11
9
|
// class Item extends Schema {
|
|
12
10
|
// @type("string") name: string;
|
|
@@ -17,27 +15,27 @@ const index_1 = require("./index");
|
|
|
17
15
|
// const state = new RootState();
|
|
18
16
|
// state.items.push(new Item().assign({ name: "hello" }));
|
|
19
17
|
// console.log("Encoded:", state.encode());
|
|
20
|
-
class Vec3 extends
|
|
18
|
+
class Vec3 extends Schema {
|
|
21
19
|
}
|
|
22
20
|
__decorate([
|
|
23
|
-
|
|
21
|
+
type("number")
|
|
24
22
|
], Vec3.prototype, "x", void 0);
|
|
25
23
|
__decorate([
|
|
26
|
-
|
|
24
|
+
type("number")
|
|
27
25
|
], Vec3.prototype, "y", void 0);
|
|
28
26
|
__decorate([
|
|
29
|
-
|
|
27
|
+
type("number")
|
|
30
28
|
], Vec3.prototype, "z", void 0);
|
|
31
|
-
class Base extends
|
|
29
|
+
class Base extends Schema {
|
|
32
30
|
}
|
|
33
|
-
class Entity extends
|
|
31
|
+
class Entity extends Schema {
|
|
34
32
|
constructor() {
|
|
35
33
|
super(...arguments);
|
|
36
34
|
this.position = new Vec3().assign({ x: 0, y: 0, z: 0 });
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
__decorate([
|
|
40
|
-
|
|
38
|
+
type(Vec3)
|
|
41
39
|
], Entity.prototype, "position", void 0);
|
|
42
40
|
class Player extends Entity {
|
|
43
41
|
constructor() {
|
|
@@ -47,12 +45,12 @@ class Player extends Entity {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
__decorate([
|
|
50
|
-
|
|
48
|
+
type(Vec3)
|
|
51
49
|
], Player.prototype, "rotation", void 0);
|
|
52
50
|
__decorate([
|
|
53
|
-
|
|
51
|
+
type("string")
|
|
54
52
|
], Player.prototype, "secret", void 0);
|
|
55
|
-
class State extends
|
|
53
|
+
class State extends Schema {
|
|
56
54
|
constructor() {
|
|
57
55
|
super(...arguments);
|
|
58
56
|
// @type({ map: Base }) players = new MapSchema<Entity>();
|
|
@@ -62,17 +60,17 @@ class State extends index_1.Schema {
|
|
|
62
60
|
// position: new Vec3().assign({ x: 1, y: 2, z: 3 }),
|
|
63
61
|
// rotation: new Vec3().assign({ x: 4, y: 5, z: 6 }),
|
|
64
62
|
// });
|
|
65
|
-
this.entities = new
|
|
63
|
+
this.entities = new MapSchema();
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
__decorate([
|
|
69
|
-
|
|
67
|
+
type("number")
|
|
70
68
|
], State.prototype, "num", void 0);
|
|
71
69
|
__decorate([
|
|
72
|
-
|
|
70
|
+
type("string")
|
|
73
71
|
], State.prototype, "str", void 0);
|
|
74
72
|
__decorate([
|
|
75
|
-
|
|
73
|
+
type({ map: Entity })
|
|
76
74
|
], State.prototype, "entities", void 0);
|
|
77
75
|
const state = new State();
|
|
78
76
|
state.entities.set("one", new Player().assign({
|
|
@@ -83,7 +81,7 @@ state.entities.set("two", new Player().assign({
|
|
|
83
81
|
position: new Vec3().assign({ x: 4, y: 5, z: 6 }),
|
|
84
82
|
rotation: new Vec3().assign({ x: 7, y: 8, z: 9 }),
|
|
85
83
|
}));
|
|
86
|
-
const encoder = new
|
|
84
|
+
const encoder = new Encoder(state);
|
|
87
85
|
let encoded = encoder.encode();
|
|
88
86
|
console.log(`(${encoded.length})`, [...encoded]);
|
|
89
87
|
globalThis.perform = function () {
|
|
@@ -99,7 +97,7 @@ function logTime(label, callback) {
|
|
|
99
97
|
console.log(`${label}:`, Date.now() - time);
|
|
100
98
|
}
|
|
101
99
|
logTime("encode time", () => encoder.encodeAll());
|
|
102
|
-
const decoder = new
|
|
100
|
+
const decoder = new Decoder(new State());
|
|
103
101
|
logTime("decode time", () => decoder.decode(encoded));
|
|
104
102
|
// const time = Date.now();
|
|
105
103
|
// console.profile();
|
package/lib/v3_bench.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3_bench.js","sourceRoot":"","sources":["../src/v3_bench.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v3_bench.js","sourceRoot":"","sources":["../src/v3_bench.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAA2B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE7F,qDAAqD;AAErD,8BAA8B;AAC9B,oCAAoC;AACpC,IAAI;AAEJ,mCAAmC;AACnC,qDAAqD;AACrD,IAAI;AACJ,iCAAiC;AACjC,0DAA0D;AAE1D,2CAA2C;AAE3C,MAAM,IAAK,SAAQ,MAAM;CAIxB;AAHmB;IAAf,IAAI,CAAC,QAAQ,CAAC;+BAAW;AACV;IAAf,IAAI,CAAC,QAAQ,CAAC;+BAAW;AACV;IAAf,IAAI,CAAC,QAAQ,CAAC;+BAAW;AAG9B,MAAM,IAAK,SAAQ,MAAM;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AO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AAChD,CAAC;AACD,OAAO,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;AAElD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;AACzC,OAAO,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtD,2BAA2B;AAC3B,qBAAqB;AACrB,qCAAqC;AACrC,uBAAuB;AACvB,IAAI;AACJ,wBAAwB;AACxB,kDAAkD;AAElD,+DAA+D;AAC/D,2BAA2B;AAC3B,EAAE;AACF,iCAAiC;AACjC,EAAE;AACF,0CAA0C;AAC1C,oBAAoB;AACpB,EAAE;AACF,4BAA4B;AAC5B,0BAA0B;AAC1B,EAAE;AACF,2BAA2B;AAC3B,iCAAiC;AAEjC,2BAA2B;AAC3B,qCAAqC;AACrC,+BAA+B;AAC/B,oBAAoB;AACpB,IAAI;AACJ,kDAAkD","sourcesContent":["import { Schema, type, MapSchema, ArraySchema, Reflection, Encoder, Decoder } from \"./index\";\n\n// globalThis.interval = setInterval(() => {}, 1000);\n\n// class Item extends Schema {\n// @type(\"string\") name: string;\n// }\n\n// class RootState extends Schema {\n// @type([Item]) items = new ArraySchema<Item>();\n// }\n// const state = new RootState();\n// state.items.push(new Item().assign({ name: \"hello\" }));\n\n// console.log(\"Encoded:\", state.encode());\n\nclass Vec3 extends Schema {\n @type(\"number\") x: number;\n @type(\"number\") y: number;\n @type(\"number\") z: number;\n}\n\nclass Base extends Schema {}\n\nclass Entity extends Schema {\n @type(Vec3) position = new Vec3().assign({ x: 0, y: 0, z: 0 });\n}\n\nclass Player extends Entity {\n @type(Vec3) rotation = new Vec3().assign({ x: 0, y: 0, z: 0 });\n @type(\"string\") secret: string = \"private info only for this player\";\n}\n\nclass State extends Schema {\n // @type({ map: Base }) players = new MapSchema<Entity>();\n @type(\"number\") num: number = 0;\n @type(\"string\") str = \"Hello world!\";\n // @type(Entity) entity = new Player().assign({\n // position: new Vec3().assign({ x: 1, y: 2, z: 3 }),\n // rotation: new Vec3().assign({ x: 4, y: 5, z: 6 }),\n // });\n @type({ map: Entity }) entities = new MapSchema();\n}\n\nconst state = new State();\n\nstate.entities.set(\"one\", new Player().assign({\n position: new Vec3().assign({ x: 1, y: 2, z: 3 }),\n rotation: new Vec3().assign({ x: 1, y: 2, z: 3 }),\n}));\n\nstate.entities.set(\"two\", new Player().assign({\n position: new Vec3().assign({ x: 4, y: 5, z: 6 }),\n rotation: new Vec3().assign({ x: 7, y: 8, z: 9 }),\n}));\n\nconst encoder = new Encoder(state);\nlet encoded = encoder.encode();\nconsole.log(`(${encoded.length})`, [...encoded]);\n\n(globalThis as any).perform = function(): void {\n for (let i = 0; i < 500000; i++) {\n encoder.encodeAll();\n }\n}\n\nfunction logTime(label: string, callback: Function) {\n const time = Date.now();\n for (let i = 0; i < 500000; i++) {\n callback();\n }\n console.log(`${label}:`, Date.now() - time);\n}\nlogTime(\"encode time\", () => encoder.encodeAll());\n\nconst decoder = new Decoder(new State());\nlogTime(\"decode time\", () => decoder.decode(encoded));\n\n// const time = Date.now();\n// console.profile();\n// for (let i = 0; i < 300000; i++) {\n// state.encodeAll();\n// }\n// console.profileEnd();\n// console.log(\"encode time:\", Date.now() - time);\n\n// const decoded = Reflection.decode(Reflection.encode(state));\n// decoded.decode(encoded);\n//\n// console.log(decoded.toJSON());\n//\n// const rotation = state.entity.rotation;\n// rotation.x = 100;\n//\n// encoded = state.encode();\n// console.log({encoded});\n//\n// decoded.decode(encoded);\n// console.log(decoded.toJSON());\n\n// const time = Date.now();\n// for (let i = 0; i < 300000; i++) {\n// const state = new State();\n// state.encode();\n// }\n// console.log(\"encode time:\", Date.now() - time);\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/schema",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Binary state serializer with delta encoding for games",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"bin": {
|
|
6
7
|
"schema-codegen": "bin/schema-codegen",
|
|
7
8
|
"schema-debug": "bin/schema-debug"
|
|
@@ -32,14 +33,14 @@
|
|
|
32
33
|
"bin"
|
|
33
34
|
],
|
|
34
35
|
"types": "lib/index.d.ts",
|
|
35
|
-
"main": "build/cjs/index.
|
|
36
|
+
"main": "build/cjs/index.cjs",
|
|
36
37
|
"module": "build/esm/index.mjs",
|
|
37
38
|
"browser": "./build/umd/index.js",
|
|
38
39
|
"exports": {
|
|
39
40
|
".": {
|
|
40
41
|
"browser": "./build/umd/index.js",
|
|
41
42
|
"import": "./build/esm/index.mjs",
|
|
42
|
-
"require": "./build/cjs/index.
|
|
43
|
+
"require": "./build/cjs/index.cjs",
|
|
43
44
|
"types": "./lib/index.d.ts"
|
|
44
45
|
}
|
|
45
46
|
},
|
|
@@ -60,21 +61,19 @@
|
|
|
60
61
|
"@msgpack/msgpack": "^1.9.1",
|
|
61
62
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
62
63
|
"@types/benchmark": "^2.1.0",
|
|
63
|
-
"@types/glob": "^7.1.1",
|
|
64
64
|
"@types/mocha": "^5.2.5",
|
|
65
65
|
"@types/node": "^14.0.13",
|
|
66
|
-
"@types/rimraf": "^2.0.3",
|
|
67
66
|
"@types/sinon": "^7.0.3",
|
|
68
67
|
"benchmark": "^2.1.4",
|
|
69
68
|
"c8": "^10.1.2",
|
|
70
69
|
"core-js": "^3.44.0",
|
|
71
70
|
"flatbuffers": "^1.10.2",
|
|
72
71
|
"fossil-delta": "^1.0.2",
|
|
73
|
-
"glob": "^
|
|
72
|
+
"glob": "^13.0.0",
|
|
74
73
|
"mocha": "^10.2.0",
|
|
75
74
|
"msgpackr": "^1.6.1",
|
|
76
75
|
"nanoid": "^5.1.6",
|
|
77
|
-
"rimraf": "^
|
|
76
|
+
"rimraf": "^6.1.2",
|
|
78
77
|
"rollup": "^4.18.0",
|
|
79
78
|
"sinon": "^7.2.2",
|
|
80
79
|
"source-map-support": "^0.5.13",
|
|
@@ -82,6 +81,9 @@
|
|
|
82
81
|
"tsx": "^4.21.0",
|
|
83
82
|
"typescript": "^5.9.3"
|
|
84
83
|
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"typescript": "^5.9.3"
|
|
86
|
+
},
|
|
85
87
|
"c8": {
|
|
86
88
|
"include": [
|
|
87
89
|
"src/**/*.ts"
|
package/src/codegen/api.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
// import { fileURLToPath } from "url";
|
|
3
5
|
|
|
4
6
|
import { File } from "./types";
|
|
5
7
|
import { parseFiles } from "./parser";
|
|
6
8
|
|
|
9
|
+
// Create require relative to this file's location (for ESM compatibility)
|
|
10
|
+
// const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
// const __dirname = path.dirname(__filename);
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
|
|
7
14
|
export interface GenerateOptions {
|
|
8
15
|
files: string[],
|
|
9
16
|
output: string;
|
package/src/codegen/parser.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import {readFileSync} from "fs";
|
|
4
|
-
import {IStructure, Class, Interface, Property, Context, Enum} from "./types";
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { IStructure, Class, Interface, Property, Context, Enum } from "./types";
|
|
5
5
|
|
|
6
6
|
let currentStructure: IStructure;
|
|
7
7
|
let currentProperty: Property;
|
package/src/codegen/types.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
|
|
4
|
+
if (typeof(__dirname) === "undefined") {
|
|
5
|
+
global.__dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
6
|
+
}
|
|
2
7
|
|
|
3
8
|
const VERSION = JSON.parse(fs.readFileSync(__dirname + "/../../package.json").toString()).version;
|
|
4
9
|
const COMMENT_HEADER = `
|
package/src/encoder/Encoder.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { OPERATION, SWITCH_TO_STRUCTURE, TYPE_ID } from '../encoding/spec';
|
|
|
9
9
|
import { Root } from "./Root";
|
|
10
10
|
|
|
11
11
|
import type { StateView } from "./StateView";
|
|
12
|
-
import type { Metadata } from "../Metadata";
|
|
13
12
|
import type { ChangeSetName, ChangeTree, ChangeTreeList, ChangeTreeNode } from "./ChangeTree";
|
|
14
13
|
import { createChangeTreeList } from "./ChangeTree";
|
|
15
14
|
|
|
@@ -22,7 +21,7 @@ function concatBytes(a: Uint8Array, b: Uint8Array): Uint8Array {
|
|
|
22
21
|
|
|
23
22
|
export class Encoder<T extends Schema = any> {
|
|
24
23
|
static BUFFER_SIZE = 8 * 1024; // 8KB
|
|
25
|
-
sharedBuffer = new Uint8Array(Encoder.BUFFER_SIZE);
|
|
24
|
+
sharedBuffer: Uint8Array = new Uint8Array(Encoder.BUFFER_SIZE);
|
|
26
25
|
|
|
27
26
|
context: TypeContext;
|
|
28
27
|
state: T;
|
|
@@ -55,7 +54,7 @@ export class Encoder<T extends Schema = any> {
|
|
|
55
54
|
encode(
|
|
56
55
|
it: Iterator = { offset: 0 },
|
|
57
56
|
view?: StateView,
|
|
58
|
-
buffer = this.sharedBuffer,
|
|
57
|
+
buffer: Uint8Array = this.sharedBuffer,
|
|
59
58
|
changeSetName: ChangeSetName = "changes",
|
|
60
59
|
isEncodeAll = changeSetName === "allChanges",
|
|
61
60
|
initialOffset = it.offset // cache current offset in case we need to resize the buffer
|
|
@@ -159,11 +158,19 @@ export class Encoder<T extends Schema = any> {
|
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
encodeAll(
|
|
161
|
+
encodeAll(
|
|
162
|
+
it: Iterator = { offset: 0 },
|
|
163
|
+
buffer: Uint8Array = this.sharedBuffer
|
|
164
|
+
) {
|
|
163
165
|
return this.encode(it, undefined, buffer, "allChanges", true);
|
|
164
166
|
}
|
|
165
167
|
|
|
166
|
-
encodeAllView(
|
|
168
|
+
encodeAllView(
|
|
169
|
+
view: StateView,
|
|
170
|
+
sharedOffset: number,
|
|
171
|
+
it: Iterator,
|
|
172
|
+
bytes: Uint8Array = this.sharedBuffer
|
|
173
|
+
) {
|
|
167
174
|
const viewOffset = it.offset;
|
|
168
175
|
|
|
169
176
|
// try to encode "filtered" changes
|
|
@@ -175,7 +182,12 @@ export class Encoder<T extends Schema = any> {
|
|
|
175
182
|
);
|
|
176
183
|
}
|
|
177
184
|
|
|
178
|
-
encodeView(
|
|
185
|
+
encodeView(
|
|
186
|
+
view: StateView,
|
|
187
|
+
sharedOffset: number,
|
|
188
|
+
it: Iterator,
|
|
189
|
+
bytes: Uint8Array = this.sharedBuffer
|
|
190
|
+
) {
|
|
179
191
|
const viewOffset = it.offset;
|
|
180
192
|
|
|
181
193
|
// encode visibility changes (add/remove for this view)
|
|
@@ -251,7 +263,12 @@ export class Encoder<T extends Schema = any> {
|
|
|
251
263
|
this.root.filteredChanges = createChangeTreeList();
|
|
252
264
|
}
|
|
253
265
|
|
|
254
|
-
tryEncodeTypeId
|
|
266
|
+
tryEncodeTypeId(
|
|
267
|
+
bytes: Uint8Array,
|
|
268
|
+
baseType: typeof Schema,
|
|
269
|
+
targetType: typeof Schema,
|
|
270
|
+
it: Iterator
|
|
271
|
+
) {
|
|
255
272
|
const baseTypeId = this.context.getTypeId(baseType);
|
|
256
273
|
const targetTypeId = this.context.getTypeId(targetType);
|
|
257
274
|
|
package/src/index.ts
CHANGED
|
@@ -62,13 +62,13 @@ export { TypeContext } from "./types/TypeContext";
|
|
|
62
62
|
// Helper types for type inference
|
|
63
63
|
export type { InferValueType, InferSchemaInstanceType, AssignableProps } from "./types/HelperTypes";
|
|
64
64
|
|
|
65
|
-
export { getDecoderStateCallbacks, CallbackProxy, SchemaCallback, CollectionCallback, SchemaCallbackProxy } from "./decoder/strategy/getDecoderStateCallbacks";
|
|
65
|
+
export { getDecoderStateCallbacks, type CallbackProxy, type SchemaCallback, type CollectionCallback, type SchemaCallbackProxy } from "./decoder/strategy/getDecoderStateCallbacks";
|
|
66
66
|
export { Callbacks, StateCallbackStrategy } from "./decoder/strategy/Callbacks";
|
|
67
67
|
export { getRawChangesCallback } from "./decoder/strategy/RawChanges";
|
|
68
68
|
|
|
69
69
|
export { Encoder } from "./encoder/Encoder";
|
|
70
70
|
export { encodeSchemaOperation, encodeArray, encodeKeyValueOperation } from "./encoder/EncodeOperation";
|
|
71
|
-
export { ChangeTree, Ref, IRef, type ChangeSetName, type ChangeSet} from "./encoder/ChangeTree";
|
|
71
|
+
export { ChangeTree, type Ref, type IRef, type ChangeSetName, type ChangeSet} from "./encoder/ChangeTree";
|
|
72
72
|
export { StateView } from "./encoder/StateView";
|
|
73
73
|
|
|
74
74
|
export { Decoder } from "./decoder/Decoder";
|