This commit is contained in:
2026-08-17 01:21:55 +02:00
parent 5761d6e67a
commit 4bd1e24e75
265 changed files with 20617 additions and 24457 deletions
+9 -32
View File
@@ -62,10 +62,16 @@ def flatc(
# Execute esbuild with the specified parameters
def esbuild(input, output):
cmd = ["../../node_modules/.bin/esbuild", input, "--outfile=" + output]
cmd = ["esbuild", input, "--outfile=" + output]
cmd += ["--format=cjs", "--bundle", "--external:flatbuffers"]
check_call(cmd)
print("Removing node_modules/ directory...")
shutil.rmtree(Path(tests_path, "node_modules"), ignore_errors=True)
check_call(["npm", "install", "--silent"])
flatc(
options=[
"--ts",
@@ -81,20 +87,6 @@ flatc(
)
esbuild("monster_test.ts", "monster_test_generated.cjs")
flatc(
options=[
"--ts",
"--reflect-names",
"--gen-name-strings",
"--gen-mutable",
"--gen-object-api",
"--ts-entry-points",
"--ts-flat-files",
],
schema="../even_more_defaults.fbs",
include="../include_test",
)
flatc(
options=["--gen-object-api", "-b"],
schema="../monster_test.fbs",
@@ -207,27 +199,13 @@ flatc(
flatc(options=["--ts"], schema="../long_namespace.fbs")
flatc(options=["--ts"], schema="../longer_namespace.fbs")
flatc(
options=[
"--ts",
"--reflect-names",
"--gen-name-strings",
"--gen-object-api",
"--ts-entry-points",
"--ts-flat-files",
],
schema="relative_imports/relative_imports.fbs",
prefix="relative_imports",
)
print("Running TypeScript Compiler...")
check_call(["../../node_modules/.bin/tsc"])
check_call(["tsc"])
print(
"Running TypeScript Compiler in old node resolution mode for"
" no_import_ext..."
)
check_call(["../../node_modules/.bin/tsc", "-p", "./tsconfig.node.json"])
check_call(["tsc", "-p", "./tsconfig.node.json"])
NODE_CMD = ["node"]
@@ -237,7 +215,6 @@ check_call(NODE_CMD + ["JavaScriptUnionVectorTest"])
check_call(NODE_CMD + ["JavaScriptFlexBuffersTest"])
check_call(NODE_CMD + ["JavaScriptComplexArraysTest"])
check_call(NODE_CMD + ["JavaScriptUnionUnderlyingTypeTest"])
check_call(NODE_CMD + ["JavaScriptRelativeImportPathTest"])
check_call(NODE_CMD + ["JavaScriptUndefinedForOptionals"])
print("Running old v1 TypeScript Tests...")
@@ -3,6 +3,6 @@
"type": "module",
"private": true,
"devDependencies": {
"lodash": "4.17.23"
"lodash": "4.17.21"
}
}
+4 -8
View File
@@ -1,16 +1,12 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
devDependencies:
lodash:
specifier: 4.17.23
version: 4.17.23
specifier: 4.17.21
version: 4.17.21
packages:
/lodash@4.17.23:
resolution: {integrity: sha512-LgVTMpQtIopCi79SJeDiP0TfWi5CNEc/L/aRdTh3yIvmZXTnheWpKjSZhnvMl8iXbC1tFg9gdHHDMLoV7CnG+w==}
/lodash@4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: true
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
import { Monster, MonsterT } from './monster.js';
import { Monster, MonsterT } from '../../my-game/example/monster.js';
export enum AnyAmbiguousAliases {
@@ -2,9 +2,9 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../example2/monster.js';
import { Monster, MonsterT } from './monster.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './test-simple-table-with-enum.js';
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
import { Monster, MonsterT } from '../../my-game/example/monster.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
export enum AnyUniqueAliases {
+3 -3
View File
@@ -2,9 +2,9 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../example2/monster.js';
import { Monster, MonsterT } from './monster.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './test-simple-table-with-enum.js';
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
import { Monster, MonsterT } from '../../my-game/example/monster.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
export enum Any {
+17 -17
View File
@@ -4,19 +4,19 @@
import * as flatbuffers from 'flatbuffers';
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../example2/monster.js';
import { Ability, AbilityT } from './ability.js';
import { Any, unionToAny, unionListToAny } from './any.js';
import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from './any-ambiguous-aliases.js';
import { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from './any-unique-aliases.js';
import { Color } from './color.js';
import { Race } from './race.js';
import { Referrable, ReferrableT } from './referrable.js';
import { Stat, StatT } from './stat.js';
import { Test, TestT } from './test.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './test-simple-table-with-enum.js';
import { Vec3, Vec3T } from './vec3.js';
import { InParentNamespace, InParentNamespaceT } from '../in-parent-namespace.js';
import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
import { Ability, AbilityT } from '../../my-game/example/ability.js';
import { Any, unionToAny, unionListToAny } from '../../my-game/example/any.js';
import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases.js';
import { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from '../../my-game/example/any-unique-aliases.js';
import { Color } from '../../my-game/example/color.js';
import { Race } from '../../my-game/example/race.js';
import { Referrable, ReferrableT } from '../../my-game/example/referrable.js';
import { Stat, StatT } from '../../my-game/example/stat.js';
import { Test, TestT } from '../../my-game/example/test.js';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
import { Vec3, Vec3T } from '../../my-game/example/vec3.js';
import { InParentNamespace, InParentNamespaceT } from '../../my-game/in-parent-namespace.js';
/**
@@ -81,11 +81,11 @@ mutate_hp(value:number):boolean {
return true;
}
name():string
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
name(optionalEncoding?:any):string|Uint8Array {
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return this.bb!.__string(this.bb_pos + offset, optionalEncoding);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
inventory(index: number):number|null {
@@ -4,7 +4,7 @@
import * as flatbuffers from 'flatbuffers';
import { StructOfStructs, StructOfStructsT } from './struct-of-structs.js';
import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
export class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
@@ -4,8 +4,8 @@
import * as flatbuffers from 'flatbuffers';
import { Ability, AbilityT } from './ability.js';
import { Test, TestT } from './test.js';
import { Ability, AbilityT } from '../../my-game/example/ability.js';
import { Test, TestT } from '../../my-game/example/test.js';
export class StructOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsT> {
@@ -4,7 +4,7 @@
import * as flatbuffers from 'flatbuffers';
import { Color } from './color.js';
import { Color } from '../../my-game/example/color.js';
export class TestSimpleTableWithEnum implements flatbuffers.IUnpackableObject<TestSimpleTableWithEnumT> {
+2 -2
View File
@@ -4,8 +4,8 @@
import * as flatbuffers from 'flatbuffers';
import { Color } from './color.js';
import { Test, TestT } from './test.js';
import { Color } from '../../my-game/example/color.js';
import { Test, TestT } from '../../my-game/example/test.js';
export class Vec3 implements flatbuffers.IUnpackableObject<Vec3T> {
+1 -1
View File
@@ -4,7 +4,7 @@
import * as flatbuffers from 'flatbuffers';
import { OptionalByte } from './optional-byte.js';
import { OptionalByte } from '../optional-scalars/optional-byte.js';
export class ScalarStuff {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"type": "module",
"dependencies": {
"flatbuffers": "workspace:*"
"flatbuffers": "../../"
}
}
+10
View File
@@ -0,0 +1,10 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
flatbuffers:
specifier: ../../
version: link:../..
+3 -7
View File
@@ -1,10 +1,7 @@
{
"compilerOptions": {
"target": "ES2020",
"lib": [
"ES2020",
"DOM"
],
"lib": ["ES2020", "DOM"],
"module": "NodeNext",
"declaration": true,
"strict": true
@@ -20,7 +17,6 @@
"arrays_test_complex/**/*.ts",
"union_underlying_type_test.ts",
"long-namespace/**/*.ts",
"longer-namespace/**/*.ts",
"relative_imports/**/*.ts"
"longer-namespace/**/*.ts"
]
}
}