@aethervtt/shard-node 0.0.1 → 0.2.0

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -7
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { readdir, readFile } from "node:fs/promises";
3
3
  import { createRequire } from "node:module";
4
- import { dirname, join, relative, resolve } from "node:path";
5
- import { pathToFileURL } from "node:url";
4
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import { assetServer } from "@aethervtt/shard-assets";
7
7
  import {
8
8
  ChildOf,
@@ -11,7 +11,7 @@ import {
11
11
  } from "@aethervtt/shard-core";
12
12
  import { createNodeGpuContext } from "@aethervtt/shard-gpu/node";
13
13
  import { createMemoryStorage } from "@aethervtt/shard-platform";
14
- import { createNodePlatform } from "@aethervtt/shard-platform-node";
14
+ import { createNodePlatform, loadPerfBudgets } from "@aethervtt/shard-platform-node";
15
15
  import { configureProcgenHost, procgenHost } from "@aethervtt/shard-procgen";
16
16
  import {
17
17
  buildApp,
@@ -24,7 +24,10 @@ import {
24
24
  } from "@aethervtt/shard-project";
25
25
  import { createProtocolServer } from "@aethervtt/shard-protocol";
26
26
  import { OffscreenTarget } from "@aethervtt/shard-render";
27
- import { LogResource } from "@aethervtt/shard-runtime";
27
+ import {
28
+ LogResource,
29
+ PerfBudgets
30
+ } from "@aethervtt/shard-runtime";
28
31
  import { loadScene, whenSceneReady } from "@aethervtt/shard-scene";
29
32
  import { createBundler } from "./bundle.js";
30
33
  import { prepareGenerators } from "./generators.js";
@@ -96,6 +99,8 @@ async function openProject(options) {
96
99
  height: options.height ?? manifest.window.height
97
100
  });
98
101
  const app = buildApp({ manifest, project, gpu, target, platform });
102
+ const budgets = loadPerfBudgets(root);
103
+ if (budgets) app.insertResource(PerfBudgets, budgets);
99
104
  await app.init();
100
105
  await loadProjectNavCache(app, platform);
101
106
  const stopShaders = await loadProjectShaders(app, platform, { watch: options.watch });
@@ -223,11 +228,11 @@ function locateInProject(error, root) {
223
228
  if (typeof stack !== "string") return void 0;
224
229
  const prefix = resolve(root);
225
230
  for (const line of stack.split("\n")) {
226
- const m = /(?:file:\/\/)?(\/[^\s():]+):(\d+):(\d+)/.exec(line);
231
+ const m = /(file:\/\/[^\s()]+|(?:[A-Za-z]:)?[\\/][^\s():]+):(\d+):(\d+)/.exec(line);
227
232
  if (!m) continue;
228
- const file = decodeURIComponent(m[1]);
229
- if (!file.startsWith(`${prefix}/`)) continue;
233
+ const file = m[1].startsWith("file:") ? fileURLToPath(m[1]) : m[1];
230
234
  const rel = relative(prefix, file).split("\\").join("/");
235
+ if (rel.startsWith("../") || isAbsolute(rel)) continue;
231
236
  if (rel.startsWith(".shard/") || rel.includes("node_modules/")) continue;
232
237
  return `${rel}:${m[2]}:${m[3]}`;
233
238
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aethervtt/shard-node",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -16,17 +16,17 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
- "@aethervtt/shard-assets": "0.0.1",
20
- "@aethervtt/shard-core": "0.0.1",
21
- "@aethervtt/shard-gpu": "0.0.1",
22
- "@aethervtt/shard-platform": "0.0.1",
23
- "@aethervtt/shard-platform-node": "0.0.1",
24
- "@aethervtt/shard-procgen": "0.0.1",
25
- "@aethervtt/shard-project": "0.0.1",
26
- "@aethervtt/shard-protocol": "0.0.1",
27
- "@aethervtt/shard-render": "0.0.1",
28
- "@aethervtt/shard-runtime": "0.0.1",
29
- "@aethervtt/shard-scene": "0.0.1",
19
+ "@aethervtt/shard-assets": "0.2.0",
20
+ "@aethervtt/shard-core": "0.2.0",
21
+ "@aethervtt/shard-gpu": "0.2.0",
22
+ "@aethervtt/shard-platform": "0.2.0",
23
+ "@aethervtt/shard-platform-node": "0.2.0",
24
+ "@aethervtt/shard-procgen": "0.2.0",
25
+ "@aethervtt/shard-project": "0.2.0",
26
+ "@aethervtt/shard-protocol": "0.2.0",
27
+ "@aethervtt/shard-render": "0.2.0",
28
+ "@aethervtt/shard-runtime": "0.2.0",
29
+ "@aethervtt/shard-scene": "0.2.0",
30
30
  "esbuild": "^0.28.2",
31
31
  "webgpu": "0.6.1"
32
32
  },
@@ -40,6 +40,6 @@
40
40
  "provenance": true
41
41
  },
42
42
  "shard": {
43
- "buildSha": "d6c5c6aef4675575c878b02cf2c8f738b4190229"
43
+ "buildSha": "32c22a3944ed23f5d1baa90bf7cc9fae724f5fd8"
44
44
  }
45
45
  }