bevy-ts 0.1.0-alpha.8 → 0.1.0-alpha.9
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/package.json +6 -6
- package/protocol.d.ts +10 -2
- package/runtime/jsx-runtime.js +15 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bevy-ts",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
4
|
"description": "TypeScript for Bevy: components, systems and hot reload without recompiling Rust",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"examples"
|
|
60
60
|
],
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@bevy-ts/darwin-arm64": "0.1.0-alpha.
|
|
63
|
-
"@bevy-ts/darwin-x64": "0.1.0-alpha.
|
|
64
|
-
"@bevy-ts/linux-arm64": "0.1.0-alpha.
|
|
65
|
-
"@bevy-ts/linux-x64": "0.1.0-alpha.
|
|
66
|
-
"@bevy-ts/win32-x64": "0.1.0-alpha.
|
|
62
|
+
"@bevy-ts/darwin-arm64": "0.1.0-alpha.9",
|
|
63
|
+
"@bevy-ts/darwin-x64": "0.1.0-alpha.9",
|
|
64
|
+
"@bevy-ts/linux-arm64": "0.1.0-alpha.9",
|
|
65
|
+
"@bevy-ts/linux-x64": "0.1.0-alpha.9",
|
|
66
|
+
"@bevy-ts/win32-x64": "0.1.0-alpha.9"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"json-schema-to-typescript": "^15.0.4",
|
package/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @generated by packages/bevy-ts/scripts/gen-protocol.mjs from protocol/bevy-ts.openrpc.json. Do not edit.
|
|
2
2
|
|
|
3
3
|
/** The protocol version these types describe. */
|
|
4
|
-
export const PROTOCOL_VERSION: "1.
|
|
4
|
+
export const PROTOCOL_VERSION: "1.23.0";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* An entity id: Entity::to_bits.
|
|
@@ -858,6 +858,10 @@ export interface TsxTreeNode {
|
|
|
858
858
|
*/
|
|
859
859
|
component: string;
|
|
860
860
|
reason: MissingReason;
|
|
861
|
+
/**
|
|
862
|
+
* (1.23) True when the component is the entity's own scene component, the one its row instances; absent for a patch component.
|
|
863
|
+
*/
|
|
864
|
+
scene?: boolean;
|
|
861
865
|
}[];
|
|
862
866
|
};
|
|
863
867
|
/**
|
|
@@ -2054,7 +2058,7 @@ export interface LevelNodeResult {
|
|
|
2054
2058
|
*/
|
|
2055
2059
|
props?: LevelProp[];
|
|
2056
2060
|
/**
|
|
2057
|
-
* (1.12) Components the file adds that the entity's prefab does not give, named as LevelOverride.component names them.
|
|
2061
|
+
* (1.12) Components the file adds that the entity's prefab does not give, named as LevelOverride.component names them. (1.23) A placeholder patch component the file writes is listed too, by the name the file writes; the entity's own scene component never is.
|
|
2058
2062
|
*/
|
|
2059
2063
|
patches?: string[];
|
|
2060
2064
|
/**
|
|
@@ -2107,6 +2111,10 @@ export interface MissingComponent {
|
|
|
2107
2111
|
*/
|
|
2108
2112
|
component: string;
|
|
2109
2113
|
reason: MissingReason;
|
|
2114
|
+
/**
|
|
2115
|
+
* (1.23) True when the component is the entity's own scene component, the one it instances; absent for a patch component.
|
|
2116
|
+
*/
|
|
2117
|
+
scene?: boolean;
|
|
2110
2118
|
/**
|
|
2111
2119
|
* One line of why.
|
|
2112
2120
|
*/
|
package/runtime/jsx-runtime.js
CHANGED
|
@@ -376,6 +376,11 @@ class Computation extends Owner {
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
/** An error as it crosses to Rust. */
|
|
380
|
+
function errorRecord(e, location) {
|
|
381
|
+
return { message: e && e.message ? `${e.name || "Error"}: ${e.message}` : String(e), location: location || null, stack: e && e.stack ? String(e.stack) : null };
|
|
382
|
+
}
|
|
383
|
+
|
|
379
384
|
function reportError(e) {
|
|
380
385
|
console.error(e && e.stack ? e.stack : String(e));
|
|
381
386
|
}
|
|
@@ -702,19 +707,15 @@ export class TsxContext {
|
|
|
702
707
|
return { $b: id, $s: site.id };
|
|
703
708
|
}
|
|
704
709
|
|
|
705
|
-
/** One scene component instance, by name or `module#export`: its description, or
|
|
710
|
+
/** One scene component instance, by name or `module#export`: its description, or the error it raised. */
|
|
706
711
|
expand(name, props, at) {
|
|
707
712
|
const C = hostSceneComponent ? hostSceneComponent(name) : null;
|
|
708
|
-
if (!C || typeof C.scene !== "function") {
|
|
709
|
-
this.error(new Error(`no scene component named ${name}`), at || null);
|
|
710
|
-
return null;
|
|
711
|
-
}
|
|
713
|
+
if (!C || typeof C.scene !== "function") return { failure: errorRecord(new Error(`no scene component named ${name}`), at) };
|
|
712
714
|
try {
|
|
713
715
|
const nodes = runScene(this, () => describe(create(C, props || {}, undefined, at, false), this));
|
|
714
|
-
return nodes[0] || null;
|
|
716
|
+
return { node: nodes[0] || null };
|
|
715
717
|
} catch (e) {
|
|
716
|
-
|
|
717
|
-
return null;
|
|
718
|
+
return { failure: errorRecord(e, (e && e.bevyTsLocation) || at) };
|
|
718
719
|
}
|
|
719
720
|
}
|
|
720
721
|
|
|
@@ -757,7 +758,7 @@ export class TsxContext {
|
|
|
757
758
|
}
|
|
758
759
|
|
|
759
760
|
error(e, location) {
|
|
760
|
-
this.errors.push(
|
|
761
|
+
this.errors.push(errorRecord(e, location));
|
|
761
762
|
}
|
|
762
763
|
|
|
763
764
|
/**
|
|
@@ -836,9 +837,13 @@ export class TsxContext {
|
|
|
836
837
|
});
|
|
837
838
|
// Scene component instances a Rust plugin (levels) asks for: described after this call's
|
|
838
839
|
// computations started, so their bindings wait until the plugin has mounted them.
|
|
840
|
+
// Each failed item's own error goes beside it, not among the call's.
|
|
839
841
|
const expanded = (payload.expand || []).map(([name, props, at]) => this.expand(name, props, at));
|
|
840
842
|
const out = this.output();
|
|
841
|
-
if (payload.expand)
|
|
843
|
+
if (payload.expand) {
|
|
844
|
+
out.expanded = expanded.map((x) => x.node || null);
|
|
845
|
+
out.failures = expanded.map((x) => x.failure || null);
|
|
846
|
+
}
|
|
842
847
|
return out;
|
|
843
848
|
} finally {
|
|
844
849
|
this.inCall = false;
|