hytopia 0.11.3 → 0.11.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.
package/bin/scripts.js CHANGED
@@ -41,6 +41,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
41
41
  'init-mcp': initMcp,
42
42
  'package': packageProject,
43
43
  'start': start,
44
+ 'upgrade-assets-library': () => upgradeAssets(process.argv[3] || 'latest'),
44
45
  'upgrade-cli': () => upgradeCli(process.argv[3] || 'latest'),
45
46
  'upgrade-project': () => upgradeProject(process.argv[3] || 'latest'),
46
47
  'version': displayVersion,
@@ -142,9 +143,6 @@ function init() {
142
143
  // Update SDK to latest (sets package.json requirement)
143
144
  upgradeProject();
144
145
 
145
- // Copy assets into project, not overwriting existing files
146
- copyAssets(destDir);
147
-
148
146
  // Display success message
149
147
  displayInitSuccessMessage();
150
148
 
@@ -210,18 +208,6 @@ function initFromBoilerplate(destDir) {
210
208
  }
211
209
  }
212
210
 
213
- /**
214
- * Copies assets to the project directory
215
- */
216
- function copyAssets(destDir) {
217
- const assetsSource = path.join(destDir, 'node_modules', '@hytopia.com', 'assets');
218
- const assetsDest = path.join(destDir, 'assets');
219
-
220
- if (!copyDirectoryContents(assetsSource, assetsDest, { recursive: true, force: false })) {
221
- console.error('❌ Error: Could not copy assets from @hytopia.com/assets package');
222
- }
223
- }
224
-
225
211
  /**
226
212
  * Displays success message after project initialization
227
213
  */
@@ -579,6 +565,13 @@ async function fetchLatestVersion(signal) {
579
565
  }
580
566
  }
581
567
 
568
+ function upgradeAssetsLibrary(versionArg = 'latest') {
569
+ const version = versionArg.trim();
570
+ console.log(`🔄 Upgrading @hytopia.com/assets package to: ${version} ...`);
571
+ execSync(`npm install --force @hytopia.com/assets@${version}`, { stdio: 'inherit' });
572
+ console.log('✅ Upgrade complete.');
573
+ }
574
+
582
575
  function upgradeCli(versionArg = 'latest') {
583
576
  const version = versionArg.trim();
584
577
  console.log(`🔄 Upgrading HYTOPIA CLI to: hytopia@${version} ...`);
@@ -613,8 +606,9 @@ function displayHelp() {
613
606
  console.log(' init [--template NAME] Initialize a new project');
614
607
  console.log(' init-mcp Setup MCP integrations');
615
608
  console.log(' package Create a zip of the project for uploading to the HYTOPIA create portal.');
616
- console.log(' upgrade-cli Upgrade the HYTOPIA CLI');
617
- console.log(' upgrade-project [VERSION] Upgrade project SDK dep (default: latest)');
609
+ console.log(' upgrade-assets-library [VERSION] Upgrade the @hytopia.com/assets package (default: latest)');
610
+ console.log(' upgrade-cli [VERSION] Upgrade the HYTOPIA CLI (default: latest)');
611
+ console.log(' upgrade-project [VERSION] Upgrade project SDK dependency (default: latest)');
618
612
  console.log('');
619
613
  console.log('Examples:');
620
614
  console.log(' hytopia init --template zombies-fps');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
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",
package/server.mjs CHANGED
@@ -545,7 +545,7 @@ xkiy5MGE6Xbe6AybpI1Hg+ET8zOyO1c5GroDQ6w9AoGAKC+zMSn3ahj8Cobpt51M
545
545
  997nuSH5YQLe5+Bl5RXkZBSSNUHAczvgRHDgKi2SEHPLI2HoONLp1BvsKLQgXPJh
546
546
  T8Y+oVbsNcG8DraW9kEzVm8esk3IqJEKmH01U2LW4EsWFKyhKSr6Yr7Y97A8oNb5
547
547
  qyLISxkkFOndPeDIzSNnADk=
548
- -----END PRIVATE KEY-----`;var Si=process.env.PORT??8080,Ai="0.11.3",Ii;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Ii||={});class Xz extends $1{static instance=new Xz;_webserver=RC.default();_internalHttpServer;constructor(){super();if(this._webserver.use((J,$,X)=>{$.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(J,$)=>{$.json({status:"OK",version:Ai,runtime:"node"})}),this._webserver.use(RC.default.static("assets",{dotfiles:"allow"})),process.env.NODE_ENV!=="production"){let $=NX.dirname(e.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"));this._webserver.use((X,Y,Q)=>{let W=NX.join($,X.path);this._syncAssetsPackageAsset(W,$),Q()}),this._webserver.use(RC.default.static($,{dotfiles:"allow"}))}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?pP6.createServer(this._webserver):dP6.createServer({key:ON1,cert:NN1},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else $0.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Si,this._onStarted),console.info(`WebServer.start(): Server running on port ${Si}.`)}stop(){if(this._internalHttpServer)return new Promise((J,$)=>{this._internalHttpServer.close((X)=>{if(X)$(X);else J(!0)})});else return $0.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(J,$,X)=>{let Y=J.url??"",Q=Y.includes("?")?Y.slice(Y.indexOf("?")):"",W=new URLSearchParams(Q),K=W.get("connectionId")??void 0,Z=W.get("sessionToken")??"";if(K&&F3.instance.isValidConnectionId(K))J.connectionId=K;else{let G=await k7.instance.getPlayerSession(Z);if(G?.error){let V=`${G.error.code}: ${G.error.message}`;$.write(`HTTP/1.1 401 Unauthorized\r
548
+ -----END PRIVATE KEY-----`;var Si=process.env.PORT??8080,Ai="0.11.4",Ii;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Ii||={});class Xz extends $1{static instance=new Xz;_webserver=RC.default();_internalHttpServer;constructor(){super();if(this._webserver.use((J,$,X)=>{$.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(J,$)=>{$.json({status:"OK",version:Ai,runtime:"node"})}),this._webserver.use(RC.default.static("assets",{dotfiles:"allow"})),process.env.NODE_ENV!=="production"){let $=NX.dirname(e.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"));this._webserver.use((X,Y,Q)=>{let W=NX.join($,X.path);this._syncAssetsPackageAsset(W,$),Q()}),this._webserver.use(RC.default.static($,{dotfiles:"allow"}))}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?pP6.createServer(this._webserver):dP6.createServer({key:ON1,cert:NN1},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else $0.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Si,this._onStarted),console.info(`WebServer.start(): Server running on port ${Si}.`)}stop(){if(this._internalHttpServer)return new Promise((J,$)=>{this._internalHttpServer.close((X)=>{if(X)$(X);else J(!0)})});else return $0.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(J,$,X)=>{let Y=J.url??"",Q=Y.includes("?")?Y.slice(Y.indexOf("?")):"",W=new URLSearchParams(Q),K=W.get("connectionId")??void 0,Z=W.get("sessionToken")??"";if(K&&F3.instance.isValidConnectionId(K))J.connectionId=K;else{let G=await k7.instance.getPlayerSession(Z);if(G?.error){let V=`${G.error.code}: ${G.error.message}`;$.write(`HTTP/1.1 401 Unauthorized\r
549
549
  Content-Type: text/plain\r
550
550
  Content-Length: ${V.length}\r
551
551
  Connection: close\r