@threenative/runtime-native 0.3.18 → 0.3.20
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.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "ThreeNative-owned native host for desktop and Android",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"threenative",
|
|
@@ -80,15 +80,15 @@
|
|
|
80
80
|
"publint": "0.3.22",
|
|
81
81
|
"three": "0.187.0",
|
|
82
82
|
"vitest": "4.1.10",
|
|
83
|
-
"@threenative/playtest": "0.3.
|
|
83
|
+
"@threenative/playtest": "0.3.20"
|
|
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/
|
|
90
|
-
"@threenative/
|
|
91
|
-
"@threenative/
|
|
89
|
+
"@threenative/core": "0.3.20",
|
|
90
|
+
"@threenative/assets": "0.3.21",
|
|
91
|
+
"@threenative/three-native": "0.3.20"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"deps:download": "node scripts/download-deps.mjs",
|
|
@@ -5,7 +5,7 @@ import { execFileSync } from "node:child_process";
|
|
|
5
5
|
import { existsSync, realpathSync, readFileSync } from "node:fs";
|
|
6
6
|
import { readFile, mkdir, rm, writeFile, rename, unlink } from "node:fs/promises";
|
|
7
7
|
import { createRequire } from "node:module";
|
|
8
|
-
import { dirname, resolve
|
|
8
|
+
import nodePath, { dirname, resolve } from "node:path";
|
|
9
9
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
10
10
|
|
|
11
11
|
const native = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
@@ -26,13 +26,21 @@ export function coreSubpathSource(coreDir, specifier) {
|
|
|
26
26
|
throw new Error(`TN_NATIVE_ENGINE_UNBOUND: ${specifier} [${reason}]`);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether `file` sits under `directory`, joined by the platform separator. A hard-coded `/` never
|
|
31
|
+
* matched a Windows importer (`D:\a\core\src\x.ts`), so the native compressed-texture facade was
|
|
32
|
+
* skipped and the browser one refused 36 `three` names on the Windows desktop build (PRD-783 AC-7).
|
|
33
|
+
*/
|
|
34
|
+
export function insideDirectory(file, directory, path = nodePath) {
|
|
35
|
+
return file.startsWith(`${directory}${path.sep}`);
|
|
36
|
+
}
|
|
29
37
|
const threeNative = dirname(require.resolve("@threenative/three-native/package.json"));
|
|
30
38
|
const assetsEntry = resolve(dirname(require.resolve("@threenative/assets/package.json")), "dist/index.js");
|
|
31
39
|
|
|
32
40
|
// Player facades share source with sibling packages; installed packages need their resolved roots.
|
|
33
41
|
const packageImports = { name: "native-player-packages", setup(builder) {
|
|
34
42
|
builder.onResolve({ filter: /^\.\.\/\.\.\/\.\.\/\.\.\/(?:three-native|core)\/src\// }, (args) => {
|
|
35
|
-
if (!args.importer
|
|
43
|
+
if (!insideDirectory(args.importer, player)) return;
|
|
36
44
|
const [, name, source] = /^\.\.\/\.\.\/\.\.\/\.\.\/(three-native|core)\/(.+)$/.exec(args.path);
|
|
37
45
|
return { path: resolve(name === "core" ? core : threeNative, source) };
|
|
38
46
|
});
|
|
@@ -246,12 +254,12 @@ export async function bundleNativeEngine({ entry, outfile, boot = true, define =
|
|
|
246
254
|
loader: { ".css": "empty" },
|
|
247
255
|
plugins: [packageImports, { name: "native-engine", setup(builder) {
|
|
248
256
|
builder.onResolve({ filter: /(?:^|\/)assets\.js$/ }, (args) => {
|
|
249
|
-
if (args.importer
|
|
257
|
+
if (insideDirectory(args.importer, resolve(core, "src")))
|
|
250
258
|
return { path: resolve(player, "core-assets.mjs") };
|
|
251
259
|
});
|
|
252
260
|
// The browser WebGPU upload lane; the engine uploads compressed textures itself.
|
|
253
261
|
builder.onResolve({ filter: /(?:^|\/)compressed-texture-preparation\.js$/ }, (args) => {
|
|
254
|
-
if (args.importer
|
|
262
|
+
if (insideDirectory(args.importer, resolve(core, "src")))
|
|
255
263
|
return { path: resolve(player, "core-compressed-texture-preparation.mjs") };
|
|
256
264
|
});
|
|
257
265
|
builder.onResolve({ filter: /^tn:game$/ }, () => ({ path: "game", namespace: "native-game" }));
|