hytopia 0.10.11-prerelease-3 → 0.10.11-prerelease-5

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
@@ -6,7 +6,6 @@ import fs from 'fs';
6
6
  import path from 'path';
7
7
  import readline from 'readline';
8
8
  import { fileURLToPath } from 'url';
9
- import * as esbuild from 'esbuild';
10
9
 
11
10
  // Store command-line flags
12
11
  const flags = {};
@@ -68,18 +67,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
68
67
  async function build() {
69
68
  console.log('🔧 Building project...');
70
69
 
71
- await esbuild.build({
72
- entryPoints: ['index.ts'],
73
- outfile: './index.mjs',
74
- bundle: true,
75
- format: 'esm',
76
- platform: 'node',
77
- target: 'node24',
78
- sourcemap: 'inline',
79
- inject: [path.join(__dirname, 'buildInject.js')],
80
- mainFields: ['module', 'main'],
81
- conditions: ['import', 'node']
82
- });
70
+ execSync('npx bun build --target=node --format=esm --outfile=index.mjs index.ts', { stdio: 'inherit' });
83
71
  }
84
72
 
85
73
  /**
@@ -87,58 +75,25 @@ async function build() {
87
75
  * and watches for changes.
88
76
  */
89
77
  function start() {
90
- (async () => {
91
- let child = null;
92
- let restartTimer = null;
93
-
94
- const stopNode = () => {
95
- if (child && !child.killed) {
96
- try { child.kill(); } catch {}
97
- }
98
- };
99
-
100
- const restartNode = () => {
101
- stopNode();
102
- child = spawn(process.execPath, ['--enable-source-maps', 'index.mjs'], { stdio: 'inherit', shell: false });
103
- };
104
-
105
- const ctx = await esbuild.context({
106
- entryPoints: ['index.ts'],
107
- outfile: './index.mjs',
108
- bundle: true,
109
- format: 'esm',
110
- platform: 'node',
111
- target: 'node24',
112
- sourcemap: 'inline',
113
- inject: [path.join(__dirname, 'buildInject.js')],
114
- mainFields: ['module', 'main'],
115
- conditions: ['import', 'node'],
116
- plugins: [{
117
- name: 'restart-after-build',
118
- setup(build) {
119
- build.onStart(() => {
120
- if (restartTimer) { clearTimeout(restartTimer); restartTimer = null; }
121
- });
122
- build.onEnd((result) => {
123
- if (result.errors?.length) return;
124
- restartTimer = setTimeout(restartNode, 150);
125
- });
126
- }
127
- }]
128
- });
129
-
130
- await ctx.watch();
131
-
132
- const cleanup = async () => {
133
- if (restartTimer) clearTimeout(restartTimer);
134
- stopNode();
135
- try { await ctx.dispose(); } catch {}
136
- process.exit(0);
137
- };
78
+ console.log('🚀 Starting development server with nodemon...');
79
+
80
+ const nodemon = spawn('npx', [
81
+ 'nodemon',
82
+ '--watch', 'index.ts',
83
+ '--watch', 'src',
84
+ '--ext', 'ts,js',
85
+ '--exec', 'hytopia build && node --enable-source-maps index.mjs'
86
+ ], { stdio: 'inherit' });
87
+
88
+ // Cleanup on exit
89
+ const cleanup = () => {
90
+ nodemon?.kill();
91
+ process.exit(0);
92
+ };
138
93
 
139
- process.on('SIGINT', cleanup);
140
- process.on('SIGTERM', cleanup);
141
- })();
94
+ process.on('SIGINT', cleanup);
95
+ process.on('SIGTERM', cleanup);
96
+ nodemon.on('error', (err) => console.error('❌ Nodemon error:', err));
142
97
  }
143
98
 
144
99
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.11-prerelease-3",
3
+ "version": "0.10.11-prerelease-5",
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",
@@ -58,7 +58,8 @@
58
58
  "dependencies": {
59
59
  "@gltf-transform/cli": "^4.2.1",
60
60
  "archiver": "^7.0.1",
61
- "esbuild": "^0.25.9",
61
+ "bun": "^1.2.20",
62
+ "nodemon": "^3.1.10",
62
63
  "ws": "^8.18.2"
63
64
  },
64
65
  "optionalDependencies": {