hytopia 0.10.0-prerelease-15 → 0.10.0
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 +28 -19
- package/package.json +1 -1
- package/server.mjs +1 -1
package/bin/scripts.js
CHANGED
@@ -13,23 +13,6 @@ const flags = {};
|
|
13
13
|
|
14
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
15
15
|
|
16
|
-
// Esbuild options
|
17
|
-
const esbuildOptions = {
|
18
|
-
entryPoints: ['index.ts'],
|
19
|
-
outfile: './index.mjs',
|
20
|
-
bundle: true,
|
21
|
-
format: 'esm',
|
22
|
-
platform: 'node',
|
23
|
-
target: 'node24',
|
24
|
-
sourcemap: 'inline',
|
25
|
-
packages: 'external',
|
26
|
-
mainFields: ['module', 'main'],
|
27
|
-
conditions: ['import', 'node'],
|
28
|
-
banner: {
|
29
|
-
js: 'import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);'
|
30
|
-
},
|
31
|
-
}
|
32
|
-
|
33
16
|
// Main function to handle command execution
|
34
17
|
(async () => {
|
35
18
|
const command = process.argv[2];
|
@@ -88,7 +71,21 @@ const esbuildOptions = {
|
|
88
71
|
async function build() {
|
89
72
|
console.log('🔧 Building project...');
|
90
73
|
|
91
|
-
await esbuild.build(
|
74
|
+
await esbuild.build({
|
75
|
+
entryPoints: ['index.ts'],
|
76
|
+
outfile: './index.mjs',
|
77
|
+
bundle: true,
|
78
|
+
format: 'esm',
|
79
|
+
platform: 'node',
|
80
|
+
target: 'node24',
|
81
|
+
sourcemap: 'inline',
|
82
|
+
packages: 'external',
|
83
|
+
mainFields: ['module', 'main'],
|
84
|
+
conditions: ['import', 'node'],
|
85
|
+
banner: {
|
86
|
+
js: 'import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);'
|
87
|
+
}
|
88
|
+
});
|
92
89
|
}
|
93
90
|
|
94
91
|
/**
|
@@ -112,7 +109,19 @@ function start() {
|
|
112
109
|
};
|
113
110
|
|
114
111
|
const ctx = await esbuild.context({
|
115
|
-
|
112
|
+
entryPoints: ['index.ts'],
|
113
|
+
outfile: './index.mjs',
|
114
|
+
bundle: true,
|
115
|
+
format: 'esm',
|
116
|
+
platform: 'node',
|
117
|
+
target: 'node24',
|
118
|
+
sourcemap: 'inline',
|
119
|
+
packages: 'external',
|
120
|
+
mainFields: ['module', 'main'],
|
121
|
+
conditions: ['import', 'node'],
|
122
|
+
banner: {
|
123
|
+
js: 'import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);'
|
124
|
+
},
|
116
125
|
plugins: [{
|
117
126
|
name: 'restart-after-build',
|
118
127
|
setup(build) {
|
package/package.json
CHANGED
package/server.mjs
CHANGED
@@ -442,7 +442,7 @@ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
|
|
442
442
|
xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
|
443
443
|
6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
|
444
444
|
0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
|
445
|
-
-----END RSA PRIVATE KEY-----`;var IE=process.env.PORT??8080,fE="0.10.0
|
445
|
+
-----END RSA PRIVATE KEY-----`;var IE=process.env.PORT??8080,fE="0.10.0",_E;((Y)=>{Y.READY="WEBSERVER.READY";Y.STOPPED="WEBSERVER.STOPPED";Y.ERROR="WEBSERVER.ERROR";Y.UPGRADE="WEBSERVER.UPGRADE"})(_E||={});class D3 extends L0{static instance=new D3;_webserver=k2.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:fE,runtime:"node"})}),this._webserver.use(k2.default.static("assets"));try{this._webserver.use(k2.default.static(tn1.dirname(p.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"))))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?on1.createServer(this._webserver):rn1.createServer({key:T2.existsSync("assets/certs/localhost.key")?T2.readFileSync("assets/certs/localhost.key"):cQ0,cert:T2.existsSync("assets/certs/localhost.crt")?T2.readFileSync("assets/certs/localhost.crt"):jQ0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else y.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(IE,this._onStarted),console.info(`WebServer.start(): Server running on port ${IE}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return y.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let $=en1.parse(Z.url??"",!0).query,Y=$.connectionId?.toString(),Q=$.sessionToken?.toString()??"";if(Y&&C7.instance.isValidConnectionId(Y))Z.connectionId=Y;else{let K=await x7.instance.getPlayerSession(Q);if(K?.error){let W=`${K.error.code}: ${K.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
|
446
446
|
Content-Type: text/plain\r
|
447
447
|
Content-Length: ${W.length}\r
|
448
448
|
Connection: close\r
|