hytopia 0.10.0-prerelease-10 → 0.10.0-prerelease-11

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/bin/scripts.js CHANGED
@@ -89,7 +89,6 @@ async function build() {
89
89
  function start() {
90
90
  (async () => {
91
91
  let child = null;
92
- let restartTimer = null;
93
92
 
94
93
  const stopNode = () => {
95
94
  if (child && !child.killed) {
@@ -97,16 +96,9 @@ function start() {
97
96
  }
98
97
  };
99
98
 
100
- const startNode = () => {
99
+ const spawnNode = () => {
101
100
  stopNode();
102
- child = spawn(process.execPath, ['index.mjs'], { stdio: 'inherit', shell: false });
103
- };
104
-
105
- const scheduleRestart = () => {
106
- if (restartTimer) clearTimeout(restartTimer);
107
- logDivider();
108
- console.log('Restarting HYTOPIA server...');
109
- restartTimer = setTimeout(startNode, 100);
101
+ child = spawn(process.execPath, ['--watch', 'index.mjs'], { stdio: 'inherit', shell: false });
110
102
  };
111
103
 
112
104
  const ctx = await esbuild.context({
@@ -117,22 +109,15 @@ function start() {
117
109
  platform: 'node',
118
110
  target: 'node24',
119
111
  sourcemap: 'inline',
120
- plugins: [{
121
- name: 'restart-on-end',
122
- setup(build) {
123
- build.onEnd((result) => {
124
- if (!result.errors?.length) scheduleRestart();
125
- });
126
- }
127
- }]
128
112
  });
129
113
 
130
- await ctx.rebuild();
131
- startNode();
114
+ // Start watching (per esbuild, this performs an initial build before resolving)
132
115
  await ctx.watch();
133
116
 
117
+ // Run node with native --watch to auto-restart on output changes
118
+ spawnNode();
119
+
134
120
  const cleanup = async () => {
135
- if (restartTimer) clearTimeout(restartTimer);
136
121
  stopNode();
137
122
  try { await ctx.dispose(); } catch {}
138
123
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.0-prerelease-10",
3
+ "version": "0.10.0-prerelease-11",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",