hytopia 0.11.8 → 0.11.9

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,7 +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
+ 'upgrade-assets-library': () => upgradeAssetsLibrary(process.argv[3] || 'latest'),
45
45
  'upgrade-cli': () => upgradeCli(process.argv[3] || 'latest'),
46
46
  'upgrade-project': () => upgradeProject(process.argv[3] || 'latest'),
47
47
  'version': displayVersion,
@@ -173,7 +173,8 @@ function installProjectDependencies() {
173
173
  }, null, 2))
174
174
 
175
175
  // install hytopia sdk and hytopia assets
176
- execSync('npm install --force hytopia@latest @hytopia.com/assets@latest', { stdio: 'inherit' });
176
+ execSync('npm install --force hytopia@latest', { stdio: 'inherit' });
177
+ execSync('npm install --save-optional --force @hytopia.com/assets@latest', { stdio: 'inherit' });
177
178
  }
178
179
 
179
180
  /**
@@ -568,7 +569,7 @@ async function fetchLatestVersion(signal) {
568
569
  function upgradeAssetsLibrary(versionArg = 'latest') {
569
570
  const version = versionArg.trim();
570
571
  console.log(`🔄 Upgrading @hytopia.com/assets package to: ${version} ...`);
571
- execSync(`npm install --force @hytopia.com/assets@${version}`, { stdio: 'inherit' });
572
+ execSync(`npm install --save-optional --force @hytopia.com/assets@${version}`, { stdio: 'inherit' });
572
573
  console.log('✅ Upgrade complete.');
573
574
  }
574
575
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
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 Ai=process.env.PORT??8080,ci="0.11.8",Si;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Si||={});class Yz extends $1{static instance=new Yz;_webserver=DC.default();_internalHttpServer;constructor(){super();this._webserver.use(($,X,Y)=>{X.header("Access-Control-Allow-Origin","*"),Y()}),this._webserver.get("/",($,X)=>{X.json({status:"OK",version:ci,runtime:"node"})}),this._webserver.use(DC.default.static("assets",{dotfiles:"allow"}));let J=lK.instance.assetsLibraryPath;if(process.env.NODE_ENV!=="production"&&J)this._webserver.use(($,X,Y)=>{let Q=sP6.join(J,$.path);lK.instance.syncAsset(Q),Y()}),this._webserver.use(DC.default.static(J,{dotfiles:"allow"}))}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?nP6.createServer(this._webserver):aP6.createServer({key:RN1,cert:ON1},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else J0.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Ai,this._onStarted),console.info(`WebServer.start(): Server running on port ${Ai}.`)}stop(){if(this._internalHttpServer)return new Promise((J,$)=>{this._internalHttpServer.close((X)=>{if(X)$(X);else J(!0)})});else return J0.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&&U3.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 Ai=process.env.PORT??8080,ci="0.11.9",Si;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Si||={});class Yz extends $1{static instance=new Yz;_webserver=DC.default();_internalHttpServer;constructor(){super();this._webserver.use(($,X,Y)=>{X.header("Access-Control-Allow-Origin","*"),Y()}),this._webserver.get("/",($,X)=>{X.json({status:"OK",version:ci,runtime:"node"})}),this._webserver.use(DC.default.static("assets",{dotfiles:"allow"}));let J=lK.instance.assetsLibraryPath;if(process.env.NODE_ENV!=="production"&&J)this._webserver.use(($,X,Y)=>{let Q=sP6.join(J,$.path);lK.instance.syncAsset(Q),Y()}),this._webserver.use(DC.default.static(J,{dotfiles:"allow"}))}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?nP6.createServer(this._webserver):aP6.createServer({key:RN1,cert:ON1},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else J0.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Ai,this._onStarted),console.info(`WebServer.start(): Server running on port ${Ai}.`)}stop(){if(this._internalHttpServer)return new Promise((J,$)=>{this._internalHttpServer.close((X)=>{if(X)$(X);else J(!0)})});else return J0.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&&U3.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