@threenative/terrain 0.1.2 → 0.1.4

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.
@@ -1,5 +1,5 @@
1
1
  import { randomUUID, createHash } from 'crypto';
2
- import { lstatSync, readFileSync, writeFileSync, renameSync, unlinkSync, openSync, fstatSync, readSync, closeSync, mkdirSync } from 'fs';
2
+ import { lstatSync, readFileSync, writeFileSync, renameSync, unlinkSync, watchFile, unwatchFile, openSync, fstatSync, readSync, closeSync, mkdirSync } from 'fs';
3
3
  import { isAbsolute, resolve, dirname, basename, join } from 'path';
4
4
  import { Vector3, Matrix4, Quaternion } from 'three';
5
5
 
@@ -3439,6 +3439,8 @@ function terrainEditor(options) {
3439
3439
  if (isAbsolute(path) && resolve(path) === document.path || typeof watchedPath === "string" && (resolve(watchedPath) === document.path || resolve(watchedPath, path) === document.path))
3440
3440
  refresh(document.path);
3441
3441
  };
3442
+ const refreshFile = () => document.refresh();
3443
+ watchFile(document.path, { interval: 100, persistent: false }, refreshFile);
3442
3444
  vite.watcher.on("add", refresh).on("change", refresh).on("unlink", refresh).on("raw", refreshRaw);
3443
3445
  const heartbeat = setInterval(() => {
3444
3446
  for (const response of clients) if (!response.write(": keepalive\n\n")) response.end();
@@ -3447,6 +3449,7 @@ function terrainEditor(options) {
3447
3449
  http.once("close", () => {
3448
3450
  clearInterval(heartbeat);
3449
3451
  unsubscribe();
3452
+ unwatchFile(document.path, refreshFile);
3450
3453
  for (const response of clients) response.end();
3451
3454
  vite.watcher.off("add", refresh).off("change", refresh).off("unlink", refresh).off("raw", refreshRaw);
3452
3455
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threenative/terrain",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "description": "Headless terrain authoring — noise, erosion, sculpting, roads, rivers, material splats and scatter — evaluated into ordinary typed arrays and indexed Three.js geometry.",
6
6
  "keywords": [
@@ -69,8 +69,8 @@
69
69
  "typescript": "npm:@typescript/typescript6@6.0.2",
70
70
  "@typescript/native": "npm:typescript@7.0.2",
71
71
  "vite": "8.2.0",
72
- "@threenative/core": "0.3.6",
73
- "@threenative/physics": "0.3.6"
72
+ "@threenative/physics": "0.3.8",
73
+ "@threenative/core": "0.3.8"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "three": ">=0.185.0 <0.186.0",