@threenative/runtime-native 0.3.9 → 0.3.10

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threenative/runtime-native",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "ThreeNative-owned native host for desktop and Android",
5
5
  "keywords": [
6
6
  "threenative",
@@ -76,19 +76,19 @@
76
76
  ],
77
77
  "devDependencies": {
78
78
  "@dimforge/rapier3d-compat": "0.19.3",
79
- "@types/three": "0.185.3",
79
+ "@types/three": "0.187.0",
80
80
  "publint": "0.3.22",
81
- "three": "0.185.1",
81
+ "three": "0.187.0",
82
82
  "vitest": "4.1.10",
83
- "@threenative/playtest": "0.3.9"
83
+ "@threenative/playtest": "0.3.10"
84
84
  },
85
85
  "dependencies": {
86
86
  "pngjs": "7.0.0",
87
87
  "esbuild": "0.27.0",
88
88
  "typescript": "npm:@typescript/typescript6@6.0.2",
89
- "@threenative/core": "0.3.9",
90
- "@threenative/assets": "0.3.10",
91
- "@threenative/three-native": "0.3.9"
89
+ "@threenative/core": "0.3.10",
90
+ "@threenative/assets": "0.3.11",
91
+ "@threenative/three-native": "0.3.10"
92
92
  },
93
93
  "scripts": {
94
94
  "deps:download": "node scripts/download-deps.mjs",
@@ -151,9 +151,18 @@ export async function bundleNativeEngine({ entry, outfile, boot = true, define =
151
151
  const declaration = coreIndex.statements.find((node) => ts.isExportDeclaration(node) &&
152
152
  !node.isTypeOnly && node.exportClause && ts.isNamedExports(node.exportClause) &&
153
153
  node.exportClause.elements.some((item) => !item.isTypeOnly && item.name.text === name));
154
- if (!declaration?.moduleSpecifier)
154
+ // A value core declares in the barrel itself (`export const version`) re-exports from no
155
+ // module, so reading it as unbound refused every game that names the engine version it runs.
156
+ const local = declaration === undefined && coreIndex.statements.some((node) => {
157
+ const exported = node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) === true;
158
+ if (!exported) return false;
159
+ if (ts.isVariableStatement(node))
160
+ return node.declarationList.declarations.some((item) => ts.isIdentifier(item.name) && item.name.text === name);
161
+ return (ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) && node.name?.text === name;
162
+ });
163
+ if (!local && !declaration?.moduleSpecifier)
155
164
  throw new Error(`TN_NATIVE_ENGINE_UNBOUND: @threenative/core:${name}`);
156
- const source = JSON.stringify(resolve(core, "src", declaration.moduleSpecifier.text));
165
+ const source = JSON.stringify(resolve(core, "src", local ? "index.ts" : declaration.moduleSpecifier.text));
157
166
  if (name === "defineGame") return `import { defineGame as coreDefineGame } from ${source};
158
167
  import { platform } from ${JSON.stringify(resolve(player, "core-host.mjs"))};
159
168
  export function defineGame(options) { return coreDefineGame({ ...options, platform: options.platform ?? platform }); }`;
@@ -224,13 +224,14 @@ defineRenderTargets(WebGPURenderer.prototype, (renderer) => ({
224
224
  // three's QuadMesh over the engine Mesh (shared with the Wasm back end).
225
225
  export const QuadMesh = defineQuadMesh(globalThis);
226
226
 
227
- // three's TempNode (shared with the Wasm back end): the V8 TSL adapter reads a game node's engine node
227
+ // three's node base (shared with the Wasm back end): the V8 TSL adapter reads a game node's engine node
228
228
  // under `threenative.tslNode`, and each top-level render runs the FRAME nodes' updateBefore first. An
229
- // engine node carries its methods itself; the adapter calls them on the receiver's engine node.
229
+ // engine node carries its methods itself; the adapter calls them on the receiver's engine node. `Node` is
230
+ // r187's name for it and `TempNode` the deprecated alias (r187 src/nodes/core/TempNode.js:39).
230
231
  const tslNode = Symbol.for("threenative.tslNode");
231
232
  const nodeMethods = Object.defineProperties({}, Object.getOwnPropertyDescriptors(globalThis.tsl.float(0)));
232
233
  const tempNodes = defineTempNode(nodeMethods, tslNode, (output) => (tslNode in output ? output[tslNode] : output));
233
- export const { TempNode } = tempNodes;
234
+ export const { Node, TempNode } = tempNodes;
234
235
  // The game's startup render() runs before the player opens its renderer and draws no frame, so its nodes
235
236
  // update on the first render() of a drawn frame.
236
237
  let tempFrame = 0;