vxrn 0.1.63 → 0.1.64

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.
@@ -1,8 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
7
  __defProp(target, name, { get: all[name], enumerable: !0 });
@@ -12,44 +11,20 @@ var __export = (target, all) => {
12
11
  !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
12
  return to;
14
13
  };
15
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
15
  var createServer_exports = {};
24
16
  __export(createServer_exports, {
25
17
  createProdServer: () => createProdServer
26
18
  });
27
19
  module.exports = __toCommonJS(createServer_exports);
28
- var import_h3 = require("h3"), import_sirv = __toESM(require("sirv"), 1);
20
+ var import_hono = require("hono"), import_compress = require("hono/compress"), import_serve_static = require("@hono/node-server/serve-static");
29
21
  const createProdServer = async (options) => {
30
- const app = (0, import_h3.createApp)(), sirvStaticMiddleware = (0, import_sirv.default)("dist/static", {
31
- gzip: !0
32
- });
33
- options.serve && options.serve(options, app), app.use(
34
- (0, import_h3.defineEventHandler)(async ({ node: { req, res } }) => {
35
- await new Promise((response) => {
36
- sirvStaticMiddleware(req, res, () => {
37
- response();
38
- });
39
- });
22
+ const app = new import_hono.Hono();
23
+ return app.use((0, import_compress.compress)()), app.use(
24
+ "*",
25
+ (0, import_serve_static.serveStatic)({
26
+ root: "./dist/client"
40
27
  })
41
- );
42
- const sirvMiddleware = (0, import_sirv.default)("dist/client", {
43
- gzip: !0
44
- });
45
- return app.use(
46
- (0, import_h3.defineEventHandler)(async ({ node: { req, res } }) => {
47
- await new Promise((response) => {
48
- sirvMiddleware(req, res, () => {
49
- response();
50
- });
51
- });
52
- })
53
- ), app;
28
+ ), options.serve && options.serve(options, app), app;
54
29
  };
55
30
  //# sourceMappingURL=createServer.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/createServer.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA8C,eAC9C,cAAiB;AAGV,MAAM,mBAAmB,OAAO,YAAwB;AAC7D,QAAM,UAAM,qBAAU,GAEhB,2BAAuB,YAAAA,SAAK,eAAe;AAAA,IAC/C,MAAM;AAAA,EACR,CAAC;AAED,EAAI,QAAQ,SACV,QAAQ,MAAM,SAAS,GAAG,GAG5B,IAAI;AAAA,QACF,8BAAmB,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM;AACnD,YAAM,IAAI,QAAc,CAAC,aAAa;AACpC,6BAAqB,KAAK,KAAK,MAAM;AACnC,mBAAS;AAAA,QACX,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,qBAAiB,YAAAA,SAAK,eAAe;AAAA,IACzC,MAAM;AAAA,EACR,CAAC;AAED,aAAI;AAAA,QACF,8BAAmB,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM;AACnD,YAAM,IAAI,QAAc,CAAC,aAAa;AACpC,uBAAe,KAAK,KAAK,MAAM;AAC7B,mBAAS;AAAA,QACX,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH,GAEO;AACT;",
5
- "names": ["sirv"]
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB,iBACrB,kBAAyB,0BAEzB,sBAA4B;AAIrB,MAAM,mBAAmB,OAAO,YAAwB;AAC7D,QAAM,MAAM,IAAI,iBAAK;AAErB,aAAI,QAAI,0BAAS,CAAC,GAElB,IAAI;AAAA,IACF;AAAA,QACA,iCAAY;AAAA,MACV,MAAM;AAAA,IACR,CAAC;AAAA,EACH,GAUI,QAAQ,SACV,QAAQ,MAAM,SAAS,GAAG,GAGrB;AACT;",
5
+ "names": []
6
6
  }
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
6
  var __export = (target, all) => {
8
7
  for (var name in all)
9
8
  __defProp(target, name, { get: all[name], enumerable: !0 });
@@ -13,20 +12,13 @@ var __export = (target, all) => {
13
12
  !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
13
  return to;
15
14
  };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
16
  var createServer_exports = {};
25
17
  __export(createServer_exports, {
26
18
  createProdServer: () => createProdServer
27
19
  });
28
20
  module.exports = __toCommonJS(createServer_exports);
29
- var import_h3 = require("h3"), import_sirv = __toESM(require("sirv"), 1);
21
+ var import_hono = require("hono"), import_compress = require("hono/compress"), import_serve_static = require("@hono/node-server/serve-static");
30
22
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
31
23
  try {
32
24
  var info = gen[key](arg), value = info.value;
@@ -143,67 +135,45 @@ function _ts_generator(thisArg, body) {
143
135
  }
144
136
  }
145
137
  var createProdServer = function() {
146
- var _ref = _async_to_generator(function(options) {
147
- var app, sirvStaticMiddleware, sirvMiddleware;
148
- return _ts_generator(this, function(_state) {
149
- return app = (0, import_h3.createApp)(), sirvStaticMiddleware = (0, import_sirv.default)("dist/static", {
150
- gzip: !0
151
- }), options.serve && options.serve(options, app), app.use((0, import_h3.defineEventHandler)(function() {
152
- var _ref2 = _async_to_generator(function(param) {
153
- var _param_node, req, res;
154
- return _ts_generator(this, function(_state2) {
155
- switch (_state2.label) {
156
- case 0:
157
- return _param_node = param.node, req = _param_node.req, res = _param_node.res, [
158
- 4,
159
- new Promise(function(response) {
160
- sirvStaticMiddleware(req, res, function() {
161
- response();
162
- });
163
- })
164
- ];
165
- case 1:
166
- return _state2.sent(), [
167
- 2
168
- ];
169
- }
170
- });
171
- });
172
- return function(_) {
173
- return _ref2.apply(this, arguments);
174
- };
175
- }())), sirvMiddleware = (0, import_sirv.default)("dist/client", {
176
- gzip: !0
177
- }), app.use((0, import_h3.defineEventHandler)(function() {
178
- var _ref2 = _async_to_generator(function(param) {
179
- var _param_node, req, res;
180
- return _ts_generator(this, function(_state2) {
181
- switch (_state2.label) {
182
- case 0:
183
- return _param_node = param.node, req = _param_node.req, res = _param_node.res, [
184
- 4,
185
- new Promise(function(response) {
186
- sirvMiddleware(req, res, function() {
187
- response();
188
- });
189
- })
190
- ];
191
- case 1:
192
- return _state2.sent(), [
193
- 2
194
- ];
195
- }
196
- });
197
- });
198
- return function(_) {
199
- return _ref2.apply(this, arguments);
200
- };
201
- }())), [
202
- 2,
203
- app
204
- ];
205
- });
206
- });
138
+ var _ref = _async_to_generator(
139
+ function(options) {
140
+ var app;
141
+ return _ts_generator(this, function(_state) {
142
+ return app = new import_hono.Hono(), app.use((0, import_compress.compress)()), app.use("*", (0, import_serve_static.serveStatic)({
143
+ root: "./dist/client"
144
+ })), options.serve && options.serve(options, app), [
145
+ 2,
146
+ app
147
+ ];
148
+ });
149
+ }
150
+ // // testing cache
151
+ // const caches = {}
152
+ // function createCache(name: string) {
153
+ // if (caches[name]) return caches[name] as any
154
+ // const store = {}
155
+ // const cache = {
156
+ // async match(key: string) {
157
+ // console.log('matching', key)
158
+ // return store[key]
159
+ // },
160
+ // async put(key: string, val) {
161
+ // store[key] = val
162
+ // },
163
+ // async delete(key: string) {
164
+ // delete store[key]
165
+ // },
166
+ // }
167
+ // caches[name] = cache
168
+ // return cache
169
+ // }
170
+ // globalThis.caches = {
171
+ // ...createCache(''),
172
+ // async open(name: string) {
173
+ // return createCache(name)
174
+ // },
175
+ // }
176
+ );
207
177
  return function(options) {
208
178
  return _ref.apply(this, arguments);
209
179
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/Users/n8/vxrn/packages/vxrn/src/exports/createServer.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gBAA8C,eAC9C,cAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGV,IAAMA,mBAAAA,WAAAA;aAAmB,oBAAA,SAAOC,SAAAA;QAC/BC,KAEAC,sBAkBAC;;AApBAF,uBAAMG,qBAAAA,GAENF,2BAAuBG,YAAAA,SAAK,eAAe;QAC/CC,MAAM;MACR,CAAA,GAEIN,QAAQO,SACVP,QAAQO,MAAMP,SAASC,GAAAA,GAGzBA,IAAIO,QACFC,8BAAAA,WAAAA;oBAAmB,oBAAA,SAAA,OAAA;2BAAiBC,KAAKC;;;;2CAAbC,MAAQF,MAAAA,YAAAA,KAAKC,MAAAA,YAAAA,KACvC;;kBAAM,IAAIE,QAAc,SAACC,UAAAA;AACvBZ,yCAAqBQ,KAAKC,KAAK,WAAA;AAC7BG,+BAAAA;oBACF,CAAA;kBACF,CAAA;;;AAJA,uBAAAC,QAAA,KAAA;;;;;QAKF,CAAA;;;;aAGIZ,qBAAiBE,YAAAA,SAAK,eAAe;QACzCC,MAAM;MACR,CAAA,GAEAL,IAAIO,QACFC,8BAAAA,WAAAA;oBAAmB,oBAAA,SAAA,OAAA;2BAAiBC,KAAKC;;;;2CAAbC,MAAQF,MAAAA,YAAAA,KAAKC,MAAAA,YAAAA,KACvC;;kBAAM,IAAIE,QAAc,SAACC,UAAAA;AACvBX,mCAAeO,KAAKC,KAAK,WAAA;AACvBG,+BAAAA;oBACF,CAAA;kBACF,CAAA;;;AAJA,uBAAAC,QAAA,KAAA;;;;;QAKF,CAAA;;;;aAGF;;QAAOd;;;EACT,CAAA;kBApCuCD,SAAAA;;;;",
5
- "names": ["createProdServer", "options", "app", "sirvStaticMiddleware", "sirvMiddleware", "createApp", "sirv", "gzip", "serve", "use", "defineEventHandler", "req", "res", "node", "Promise", "response", "_state"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,kBAAqB,iBACrB,kBAAyB,0BAEzB,sBAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIrB,IAAMA,mBAAAA,WAAAA;aAAmB;IAAA,SAAOC,SAAAA;UAC/BC;;AAAAA,qBAAM,IAAIC,iBAAAA,GAEhBD,IAAIE,QAAIC,0BAAAA,CAAAA,GAERH,IAAIE,IACF,SACAE,iCAAY;UACVC,MAAM;QACR,CAAA,CAAA,GAWEN,QAAQO,SACVP,QAAQO,MAAMP,SAASC,GAAAA,GAGzB;;UAAOA;;;IACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAzBuCD,SAAAA;;;;",
5
+ "names": ["createProdServer", "options", "app", "Hono", "use", "compress", "serveStatic", "root", "serve"]
6
6
  }
@@ -17,10 +17,16 @@ __export(serve_exports, {
17
17
  serve: () => serve
18
18
  });
19
19
  module.exports = __toCommonJS(serve_exports);
20
- var import_h3 = require("h3"), import_node_http = require("node:http"), import_createServer = require("./createServer"), import_getOptionsFilled = require("../utils/getOptionsFilled");
20
+ var import_node_server = require("@hono/node-server"), import_createServer = require("./createServer"), import_getOptionsFilled = require("../utils/getOptionsFilled");
21
21
  const serve = async (optionsIn) => {
22
- const options = await (0, import_getOptionsFilled.getOptionsFilled)(optionsIn, { mode: "prod" }), app = await (0, import_createServer.createProdServer)(options), server = (0, import_node_http.createServer)((0, import_h3.toNodeListener)(app));
23
- await new Promise((res) => setTimeout(res, 1)), server.listen(options.port, options.host), console.info(`Listening on http://${options.host}:${options.port}`), await new Promise((res) => {
22
+ const options = await (0, import_getOptionsFilled.getOptionsFilled)(optionsIn, { mode: "prod" }), app = await (0, import_createServer.createProdServer)(options);
23
+ await new Promise((res) => setTimeout(res, 1));
24
+ const server = (0, import_node_server.serve)({
25
+ fetch: app.fetch,
26
+ port: options.port,
27
+ hostname: options.host
28
+ });
29
+ console.info(`Listening on http://${options.host}:${options.port}`), await new Promise((res) => {
24
30
  server.on("close", () => {
25
31
  res();
26
32
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/serve.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA+B,eAC/B,mBAA6B,sBAE7B,sBAAiC,2BACjC,0BAAiC;AAE1B,MAAM,QAAQ,OAAO,cAA0B;AACpD,QAAM,UAAU,UAAM,0CAAiB,WAAW,EAAE,MAAM,OAAO,CAAC,GAC5D,MAAM,UAAM,sCAAiB,OAAO,GACpC,aAAS,mCAAa,0BAAe,GAAG,CAAC;AAE/C,QAAM,IAAI,QAAQ,CAAC,QAAQ,WAAW,KAAK,CAAC,CAAC,GAC7C,OAAO,OAAO,QAAQ,MAAM,QAAQ,IAAI,GACxC,QAAQ,KAAK,uBAAuB,QAAQ,IAAI,IAAI,QAAQ,IAAI,EAAE,GAClE,MAAM,IAAI,QAAc,CAAC,QAAQ;AAC/B,WAAO,GAAG,SAAS,MAAM;AACvB,UAAI;AAAA,IACN,CAAC;AAAA,EACH,CAAC;AACH;",
5
- "names": []
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAmC,8BAGnC,sBAAiC,2BACjC,0BAAiC;AAE1B,MAAM,QAAQ,OAAO,cAA0B;AACpD,QAAM,UAAU,UAAM,0CAAiB,WAAW,EAAE,MAAM,OAAO,CAAC,GAC5D,MAAM,UAAM,sCAAiB,OAAO;AAE1C,QAAM,IAAI,QAAQ,CAAC,QAAQ,WAAW,KAAK,CAAC,CAAC;AAC7C,QAAM,aAAS,mBAAAA,OAAU;AAAA,IACvB,OAAO,IAAI;AAAA,IACX,MAAM,QAAQ;AAAA,IACd,UAAU,QAAQ;AAAA,EACpB,CAAC;AAED,UAAQ,KAAK,uBAAuB,QAAQ,IAAI,IAAI,QAAQ,IAAI,EAAE,GAClE,MAAM,IAAI,QAAc,CAAC,QAAQ;AAC/B,WAAO,GAAG,SAAS,MAAM;AACvB,UAAI;AAAA,IACN,CAAC;AAAA,EACH,CAAC;AACH;",
5
+ "names": ["honoServe"]
6
6
  }
@@ -18,7 +18,7 @@ __export(serve_exports, {
18
18
  serve: () => serve
19
19
  });
20
20
  module.exports = __toCommonJS(serve_exports);
21
- var import_h3 = require("h3"), import_node_http = require("node:http"), import_createServer = require("./createServer"), import_getOptionsFilled = require("../utils/getOptionsFilled");
21
+ var import_node_server = require("@hono/node-server"), import_createServer = require("./createServer"), import_getOptionsFilled = require("../utils/getOptionsFilled");
22
22
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
23
23
  try {
24
24
  var info = gen[key](arg), value = info.value;
@@ -152,14 +152,18 @@ var serve = function() {
152
152
  (0, import_createServer.createProdServer)(options)
153
153
  ];
154
154
  case 2:
155
- return app = _state.sent(), server = (0, import_node_http.createServer)((0, import_h3.toNodeListener)(app)), [
155
+ return app = _state.sent(), [
156
156
  4,
157
157
  new Promise(function(res) {
158
158
  return setTimeout(res, 1);
159
159
  })
160
160
  ];
161
161
  case 3:
162
- return _state.sent(), server.listen(options.port, options.host), console.info("Listening on http://".concat(options.host, ":").concat(options.port)), [
162
+ return _state.sent(), server = (0, import_node_server.serve)({
163
+ fetch: app.fetch,
164
+ port: options.port,
165
+ hostname: options.host
166
+ }), console.info("Listening on http://".concat(options.host, ":").concat(options.port)), [
163
167
  4,
164
168
  new Promise(function(res) {
165
169
  server.on("close", function() {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/Users/n8/vxrn/packages/vxrn/src/exports/serve.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,gBAA+B,eAC/B,mBAA6B,sBAE7B,sBAAiC,2BACjC,0BAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,IAAMA,QAAAA,WAAAA;aAAQ,oBAAA,SAAOC,WAAAA;QACpBC,SACAC,KACAC;;;;AAFU,iBAAA;;gBAAMC,0CAAiBJ,WAAW;cAAEK,MAAM;YAAO,CAAA;;;AAA3DJ,2BAAU,OAAA,KAAA,GACJ;;gBAAMK,sCAAiBL,OAAAA;;;AAA7BC,uBAAM,OAAA,KAAA,GACNC,aAASI,mCAAaC,0BAAeN,GAAAA,CAAAA,GAE3C;;YAAM,IAAIO,QAAQ,SAACC,KAAAA;qBAAQC,WAAWD,KAAK,CAAA;;;;AAA3C,wBAAA,KAAA,GACAP,OAAOS,OAAOX,QAAQY,MAAMZ,QAAQa,IAAI,GACxCC,QAAQC,KAAM,uBAAsCf,OAAhBA,QAAQa,MAAK,GAAA,EAAgB,OAAbb,QAAQY,IAAI,CAAA,GAChE;;YAAM,IAAIJ,QAAc,SAACC,KAAAA;AACvBP,qBAAOc,GAAG,SAAS,WAAA;AACjBP,oBAAAA;cACF,CAAA;YACF,CAAA;;;AAJA,wBAAA,KAAA;;;;;EAKF,CAAA;kBAb4BV,WAAAA;;;;",
5
- "names": ["serve", "optionsIn", "options", "app", "server", "getOptionsFilled", "mode", "createProdServer", "createServer", "toNodeListener", "Promise", "res", "setTimeout", "listen", "port", "host", "console", "info", "on"]
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,yBAAmC,8BAGnC,sBAAiC,2BACjC,0BAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,IAAMA,QAAAA,WAAAA;aAAQ,oBAAA,SAAOC,WAAAA;QACpBC,SACAC,KAGAC;;;;AAJU,iBAAA;;gBAAMC,0CAAiBJ,WAAW;cAAEK,MAAM;YAAO,CAAA;;;AAA3DJ,2BAAU,OAAA,KAAA,GACJ;;gBAAMK,sCAAiBL,OAAAA;;;AAA7BC,uBAAM,OAAA,KAAA,GAEZ;;YAAM,IAAIK,QAAQ,SAACC,KAAAA;qBAAQC,WAAWD,KAAK,CAAA;;;;AAA3C,wBAAA,KAAA,GACML,aAASO,mBAAAA,OAAU;YACvBC,OAAOT,IAAIS;YACXC,MAAMX,QAAQW;YACdC,UAAUZ,QAAQa;UACpB,CAAA,GAEAC,QAAQC,KAAM,uBAAsCf,OAAhBA,QAAQa,MAAK,GAAA,EAAgB,OAAbb,QAAQW,IAAI,CAAA,GAChE;;YAAM,IAAIL,QAAc,SAACC,KAAAA;AACvBL,qBAAOc,GAAG,SAAS,WAAA;AACjBT,oBAAAA;cACF,CAAA;YACF,CAAA;;;AAJA,wBAAA,KAAA;;;;;EAKF,CAAA;kBAjB4BR,WAAAA;;;;",
5
+ "names": ["serve", "optionsIn", "options", "app", "server", "getOptionsFilled", "mode", "createProdServer", "Promise", "res", "setTimeout", "honoServe", "fetch", "port", "hostname", "host", "console", "info", "on"]
6
6
  }
@@ -1,30 +1,14 @@
1
- import { createApp, defineEventHandler } from "h3";
2
- import sirv from "sirv";
1
+ import { Hono } from "hono";
2
+ import { compress } from "hono/compress";
3
+ import { serveStatic } from "@hono/node-server/serve-static";
3
4
  const createProdServer = async (options) => {
4
- const app = createApp(), sirvStaticMiddleware = sirv("dist/static", {
5
- gzip: !0
6
- });
7
- options.serve && options.serve(options, app), app.use(
8
- defineEventHandler(async ({ node: { req, res } }) => {
9
- await new Promise((response) => {
10
- sirvStaticMiddleware(req, res, () => {
11
- response();
12
- });
13
- });
5
+ const app = new Hono();
6
+ return app.use(compress()), app.use(
7
+ "*",
8
+ serveStatic({
9
+ root: "./dist/client"
14
10
  })
15
- );
16
- const sirvMiddleware = sirv("dist/client", {
17
- gzip: !0
18
- });
19
- return app.use(
20
- defineEventHandler(async ({ node: { req, res } }) => {
21
- await new Promise((response) => {
22
- sirvMiddleware(req, res, () => {
23
- response();
24
- });
25
- });
26
- })
27
- ), app;
11
+ ), options.serve && options.serve(options, app), app;
28
12
  };
29
13
  export {
30
14
  createProdServer
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/createServer.ts"],
4
- "mappings": "AAAA,SAAS,WAAW,0BAA0B;AAC9C,OAAO,UAAU;AAGV,MAAM,mBAAmB,OAAO,YAAwB;AAC7D,QAAM,MAAM,UAAU,GAEhB,uBAAuB,KAAK,eAAe;AAAA,IAC/C,MAAM;AAAA,EACR,CAAC;AAED,EAAI,QAAQ,SACV,QAAQ,MAAM,SAAS,GAAG,GAG5B,IAAI;AAAA,IACF,mBAAmB,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM;AACnD,YAAM,IAAI,QAAc,CAAC,aAAa;AACpC,6BAAqB,KAAK,KAAK,MAAM;AACnC,mBAAS;AAAA,QACX,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,iBAAiB,KAAK,eAAe;AAAA,IACzC,MAAM;AAAA,EACR,CAAC;AAED,aAAI;AAAA,IACF,mBAAmB,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM;AACnD,YAAM,IAAI,QAAc,CAAC,aAAa;AACpC,uBAAe,KAAK,KAAK,MAAM;AAC7B,mBAAS;AAAA,QACX,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH,GAEO;AACT;",
4
+ "mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB;AAIrB,MAAM,mBAAmB,OAAO,YAAwB;AAC7D,QAAM,MAAM,IAAI,KAAK;AAErB,aAAI,IAAI,SAAS,CAAC,GAElB,IAAI;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,MAAM;AAAA,IACR,CAAC;AAAA,EACH,GAUI,QAAQ,SACV,QAAQ,MAAM,SAAS,GAAG,GAGrB;AACT;",
5
5
  "names": []
6
6
  }
@@ -1,36 +1,10 @@
1
- import { createApp, defineEventHandler } from "h3";
2
- import sirv from "sirv";
1
+ import { Hono } from "hono";
2
+ import { compress } from "hono/compress";
3
+ import { serveStatic } from "@hono/node-server/serve-static";
3
4
  const createProdServer = async options => {
4
- const app = createApp(),
5
- sirvStaticMiddleware = sirv("dist/static", {
6
- gzip: !0
7
- });
8
- options.serve && options.serve(options, app), app.use(defineEventHandler(async ({
9
- node: {
10
- req,
11
- res
12
- }
13
- }) => {
14
- await new Promise(response => {
15
- sirvStaticMiddleware(req, res, () => {
16
- response();
17
- });
18
- });
19
- }));
20
- const sirvMiddleware = sirv("dist/client", {
21
- gzip: !0
22
- });
23
- return app.use(defineEventHandler(async ({
24
- node: {
25
- req,
26
- res
27
- }
28
- }) => {
29
- await new Promise(response => {
30
- sirvMiddleware(req, res, () => {
31
- response();
32
- });
33
- });
34
- })), app;
5
+ const app = new Hono();
6
+ return app.use(compress()), app.use("*", serveStatic({
7
+ root: "./dist/client"
8
+ })), options.serve && options.serve(options, app), app;
35
9
  };
36
10
  export { createProdServer };
@@ -1,5 +1,6 @@
1
- import { createApp, defineEventHandler } from "h3";
2
- import sirv from "sirv";
1
+ import { Hono } from "hono";
2
+ import { compress } from "hono/compress";
3
+ import { serveStatic } from "@hono/node-server/serve-static";
3
4
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4
5
  try {
5
6
  var info = gen[key](arg), value = info.value;
@@ -116,67 +117,45 @@ function _ts_generator(thisArg, body) {
116
117
  }
117
118
  }
118
119
  var createProdServer = function() {
119
- var _ref = _async_to_generator(function(options) {
120
- var app, sirvStaticMiddleware, sirvMiddleware;
121
- return _ts_generator(this, function(_state) {
122
- return app = createApp(), sirvStaticMiddleware = sirv("dist/static", {
123
- gzip: !0
124
- }), options.serve && options.serve(options, app), app.use(defineEventHandler(function() {
125
- var _ref2 = _async_to_generator(function(param) {
126
- var _param_node, req, res;
127
- return _ts_generator(this, function(_state2) {
128
- switch (_state2.label) {
129
- case 0:
130
- return _param_node = param.node, req = _param_node.req, res = _param_node.res, [
131
- 4,
132
- new Promise(function(response) {
133
- sirvStaticMiddleware(req, res, function() {
134
- response();
135
- });
136
- })
137
- ];
138
- case 1:
139
- return _state2.sent(), [
140
- 2
141
- ];
142
- }
143
- });
144
- });
145
- return function(_) {
146
- return _ref2.apply(this, arguments);
147
- };
148
- }())), sirvMiddleware = sirv("dist/client", {
149
- gzip: !0
150
- }), app.use(defineEventHandler(function() {
151
- var _ref2 = _async_to_generator(function(param) {
152
- var _param_node, req, res;
153
- return _ts_generator(this, function(_state2) {
154
- switch (_state2.label) {
155
- case 0:
156
- return _param_node = param.node, req = _param_node.req, res = _param_node.res, [
157
- 4,
158
- new Promise(function(response) {
159
- sirvMiddleware(req, res, function() {
160
- response();
161
- });
162
- })
163
- ];
164
- case 1:
165
- return _state2.sent(), [
166
- 2
167
- ];
168
- }
169
- });
170
- });
171
- return function(_) {
172
- return _ref2.apply(this, arguments);
173
- };
174
- }())), [
175
- 2,
176
- app
177
- ];
178
- });
179
- });
120
+ var _ref = _async_to_generator(
121
+ function(options) {
122
+ var app;
123
+ return _ts_generator(this, function(_state) {
124
+ return app = new Hono(), app.use(compress()), app.use("*", serveStatic({
125
+ root: "./dist/client"
126
+ })), options.serve && options.serve(options, app), [
127
+ 2,
128
+ app
129
+ ];
130
+ });
131
+ }
132
+ // // testing cache
133
+ // const caches = {}
134
+ // function createCache(name: string) {
135
+ // if (caches[name]) return caches[name] as any
136
+ // const store = {}
137
+ // const cache = {
138
+ // async match(key: string) {
139
+ // console.log('matching', key)
140
+ // return store[key]
141
+ // },
142
+ // async put(key: string, val) {
143
+ // store[key] = val
144
+ // },
145
+ // async delete(key: string) {
146
+ // delete store[key]
147
+ // },
148
+ // }
149
+ // caches[name] = cache
150
+ // return cache
151
+ // }
152
+ // globalThis.caches = {
153
+ // ...createCache(''),
154
+ // async open(name: string) {
155
+ // return createCache(name)
156
+ // },
157
+ // }
158
+ );
180
159
  return function(options) {
181
160
  return _ref.apply(this, arguments);
182
161
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/Users/n8/vxrn/packages/vxrn/src/exports/createServer.ts"],
4
- "mappings": "AAAA,SAASA,WAAWC,0BAA0B;AAC9C,OAAOC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGV,IAAMC,mBAAAA,WAAAA;aAAmB,oBAAA,SAAOC,SAAAA;QAC/BC,KAEAC,sBAkBAC;;AApBAF,mBAAML,UAAAA,GAENM,uBAAuBJ,KAAK,eAAe;QAC/CM,MAAM;MACR,CAAA,GAEIJ,QAAQK,SACVL,QAAQK,MAAML,SAASC,GAAAA,GAGzBA,IAAIK,IACFT,mBAAAA,WAAAA;oBAAmB,oBAAA,SAAA,OAAA;2BAAiBU,KAAKC;;;;2CAAbC,MAAQF,MAAAA,YAAAA,KAAKC,MAAAA,YAAAA,KACvC;;kBAAM,IAAIE,QAAc,SAACC,UAAAA;AACvBT,yCAAqBK,KAAKC,KAAK,WAAA;AAC7BG,+BAAAA;oBACF,CAAA;kBACF,CAAA;;;AAJA,uBAAAC,QAAA,KAAA;;;;;QAKF,CAAA;;;;aAGIT,iBAAiBL,KAAK,eAAe;QACzCM,MAAM;MACR,CAAA,GAEAH,IAAIK,IACFT,mBAAAA,WAAAA;oBAAmB,oBAAA,SAAA,OAAA;2BAAiBU,KAAKC;;;;2CAAbC,MAAQF,MAAAA,YAAAA,KAAKC,MAAAA,YAAAA,KACvC;;kBAAM,IAAIE,QAAc,SAACC,UAAAA;AACvBR,mCAAeI,KAAKC,KAAK,WAAA;AACvBG,+BAAAA;oBACF,CAAA;kBACF,CAAA;;;AAJA,uBAAAC,QAAA,KAAA;;;;;QAKF,CAAA;;;;aAGF;;QAAOX;;;EACT,CAAA;kBApCuCD,SAAAA;;;;",
5
- "names": ["createApp", "defineEventHandler", "sirv", "createProdServer", "options", "app", "sirvStaticMiddleware", "sirvMiddleware", "gzip", "serve", "use", "req", "res", "node", "Promise", "response", "_state"]
4
+ "mappings": "AAAA,SAASA,YAAY;AACrB,SAASC,gBAAgB;AAEzB,SAASC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIrB,IAAMC,mBAAAA,WAAAA;aAAmB;IAAA,SAAOC,SAAAA;UAC/BC;;AAAAA,qBAAM,IAAIL,KAAAA,GAEhBK,IAAIC,IAAIL,SAAAA,CAAAA,GAERI,IAAIC,IACF,KACAJ,YAAY;UACVK,MAAM;QACR,CAAA,CAAA,GAWEH,QAAQI,SACVJ,QAAQI,MAAMJ,SAASC,GAAAA,GAGzB;;UAAOA;;;IACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAzBuCD,SAAAA;;;;",
5
+ "names": ["Hono", "compress", "serveStatic", "createProdServer", "options", "app", "use", "root", "serve"]
6
6
  }
@@ -1,10 +1,15 @@
1
- import { toNodeListener } from "h3";
2
- import { createServer } from "node:http";
1
+ import { serve as honoServe } from "@hono/node-server";
3
2
  import { createProdServer } from "./createServer";
4
3
  import { getOptionsFilled } from "../utils/getOptionsFilled";
5
4
  const serve = async (optionsIn) => {
6
- const options = await getOptionsFilled(optionsIn, { mode: "prod" }), app = await createProdServer(options), server = createServer(toNodeListener(app));
7
- await new Promise((res) => setTimeout(res, 1)), server.listen(options.port, options.host), console.info(`Listening on http://${options.host}:${options.port}`), await new Promise((res) => {
5
+ const options = await getOptionsFilled(optionsIn, { mode: "prod" }), app = await createProdServer(options);
6
+ await new Promise((res) => setTimeout(res, 1));
7
+ const server = honoServe({
8
+ fetch: app.fetch,
9
+ port: options.port,
10
+ hostname: options.host
11
+ });
12
+ console.info(`Listening on http://${options.host}:${options.port}`), await new Promise((res) => {
8
13
  server.on("close", () => {
9
14
  res();
10
15
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/serve.ts"],
4
- "mappings": "AAAA,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAE7B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAE1B,MAAM,QAAQ,OAAO,cAA0B;AACpD,QAAM,UAAU,MAAM,iBAAiB,WAAW,EAAE,MAAM,OAAO,CAAC,GAC5D,MAAM,MAAM,iBAAiB,OAAO,GACpC,SAAS,aAAa,eAAe,GAAG,CAAC;AAE/C,QAAM,IAAI,QAAQ,CAAC,QAAQ,WAAW,KAAK,CAAC,CAAC,GAC7C,OAAO,OAAO,QAAQ,MAAM,QAAQ,IAAI,GACxC,QAAQ,KAAK,uBAAuB,QAAQ,IAAI,IAAI,QAAQ,IAAI,EAAE,GAClE,MAAM,IAAI,QAAc,CAAC,QAAQ;AAC/B,WAAO,GAAG,SAAS,MAAM;AACvB,UAAI;AAAA,IACN,CAAC;AAAA,EACH,CAAC;AACH;",
4
+ "mappings": "AAAA,SAAS,SAAS,iBAAiB;AAGnC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AAE1B,MAAM,QAAQ,OAAO,cAA0B;AACpD,QAAM,UAAU,MAAM,iBAAiB,WAAW,EAAE,MAAM,OAAO,CAAC,GAC5D,MAAM,MAAM,iBAAiB,OAAO;AAE1C,QAAM,IAAI,QAAQ,CAAC,QAAQ,WAAW,KAAK,CAAC,CAAC;AAC7C,QAAM,SAAS,UAAU;AAAA,IACvB,OAAO,IAAI;AAAA,IACX,MAAM,QAAQ;AAAA,IACd,UAAU,QAAQ;AAAA,EACpB,CAAC;AAED,UAAQ,KAAK,uBAAuB,QAAQ,IAAI,IAAI,QAAQ,IAAI,EAAE,GAClE,MAAM,IAAI,QAAc,CAAC,QAAQ;AAC/B,WAAO,GAAG,SAAS,MAAM;AACvB,UAAI;AAAA,IACN,CAAC;AAAA,EACH,CAAC;AACH;",
5
5
  "names": []
6
6
  }
@@ -1,14 +1,18 @@
1
- import { toNodeListener } from "h3";
2
- import { createServer } from "node:http";
1
+ import { serve as honoServe } from "@hono/node-server";
3
2
  import { createProdServer } from "./createServer.mjs";
4
3
  import { getOptionsFilled } from "../utils/getOptionsFilled.mjs";
5
4
  const serve = async optionsIn => {
6
5
  const options = await getOptionsFilled(optionsIn, {
7
6
  mode: "prod"
8
7
  }),
9
- app = await createProdServer(options),
10
- server = createServer(toNodeListener(app));
11
- await new Promise(res => setTimeout(res, 1)), server.listen(options.port, options.host), console.info(`Listening on http://${options.host}:${options.port}`), await new Promise(res => {
8
+ app = await createProdServer(options);
9
+ await new Promise(res => setTimeout(res, 1));
10
+ const server = honoServe({
11
+ fetch: app.fetch,
12
+ port: options.port,
13
+ hostname: options.host
14
+ });
15
+ console.info(`Listening on http://${options.host}:${options.port}`), await new Promise(res => {
12
16
  server.on("close", () => {
13
17
  res();
14
18
  });
@@ -1,5 +1,4 @@
1
- import { toNodeListener } from "h3";
2
- import { createServer } from "node:http";
1
+ import { serve as honoServe } from "@hono/node-server";
3
2
  import { createProdServer } from "./createServer";
4
3
  import { getOptionsFilled } from "../utils/getOptionsFilled";
5
4
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -135,14 +134,18 @@ var serve = function() {
135
134
  createProdServer(options)
136
135
  ];
137
136
  case 2:
138
- return app = _state.sent(), server = createServer(toNodeListener(app)), [
137
+ return app = _state.sent(), [
139
138
  4,
140
139
  new Promise(function(res) {
141
140
  return setTimeout(res, 1);
142
141
  })
143
142
  ];
144
143
  case 3:
145
- return _state.sent(), server.listen(options.port, options.host), console.info("Listening on http://".concat(options.host, ":").concat(options.port)), [
144
+ return _state.sent(), server = honoServe({
145
+ fetch: app.fetch,
146
+ port: options.port,
147
+ hostname: options.host
148
+ }), console.info("Listening on http://".concat(options.host, ":").concat(options.port)), [
146
149
  4,
147
150
  new Promise(function(res) {
148
151
  server.on("close", function() {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/exports/Users/n8/vxrn/packages/vxrn/src/exports/serve.ts"],
4
- "mappings": "AAAA,SAASA,sBAAsB;AAC/B,SAASC,oBAAoB;AAE7B,SAASC,wBAAwB;AACjC,SAASC,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,IAAMC,QAAAA,WAAAA;aAAQ,oBAAA,SAAOC,WAAAA;QACpBC,SACAC,KACAC;;;;AAFU,iBAAA;;YAAML,iBAAiBE,WAAW;cAAEI,MAAM;YAAO,CAAA;;;AAA3DH,2BAAU,OAAA,KAAA,GACJ;;YAAMJ,iBAAiBI,OAAAA;;;AAA7BC,uBAAM,OAAA,KAAA,GACNC,SAASP,aAAaD,eAAeO,GAAAA,CAAAA,GAE3C;;YAAM,IAAIG,QAAQ,SAACC,KAAAA;qBAAQC,WAAWD,KAAK,CAAA;;;;AAA3C,wBAAA,KAAA,GACAH,OAAOK,OAAOP,QAAQQ,MAAMR,QAAQS,IAAI,GACxCC,QAAQC,KAAM,uBAAsCX,OAAhBA,QAAQS,MAAK,GAAA,EAAgB,OAAbT,QAAQQ,IAAI,CAAA,GAChE;;YAAM,IAAIJ,QAAc,SAACC,KAAAA;AACvBH,qBAAOU,GAAG,SAAS,WAAA;AACjBP,oBAAAA;cACF,CAAA;YACF,CAAA;;;AAJA,wBAAA,KAAA;;;;;EAKF,CAAA;kBAb4BN,WAAAA;;;;",
5
- "names": ["toNodeListener", "createServer", "createProdServer", "getOptionsFilled", "serve", "optionsIn", "options", "app", "server", "mode", "Promise", "res", "setTimeout", "listen", "port", "host", "console", "info", "on"]
4
+ "mappings": "AAAA,SAASA,SAASC,iBAAiB;AAGnC,SAASC,wBAAwB;AACjC,SAASC,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,IAAMH,QAAAA,WAAAA;aAAQ,oBAAA,SAAOI,WAAAA;QACpBC,SACAC,KAGAC;;;;AAJU,iBAAA;;YAAMJ,iBAAiBC,WAAW;cAAEI,MAAM;YAAO,CAAA;;;AAA3DH,2BAAU,OAAA,KAAA,GACJ;;YAAMH,iBAAiBG,OAAAA;;;AAA7BC,uBAAM,OAAA,KAAA,GAEZ;;YAAM,IAAIG,QAAQ,SAACC,KAAAA;qBAAQC,WAAWD,KAAK,CAAA;;;;AAA3C,wBAAA,KAAA,GACMH,SAASN,UAAU;YACvBW,OAAON,IAAIM;YACXC,MAAMR,QAAQQ;YACdC,UAAUT,QAAQU;UACpB,CAAA,GAEAC,QAAQC,KAAM,uBAAsCZ,OAAhBA,QAAQU,MAAK,GAAA,EAAgB,OAAbV,QAAQQ,IAAI,CAAA,GAChE;;YAAM,IAAIJ,QAAc,SAACC,KAAAA;AACvBH,qBAAOW,GAAG,SAAS,WAAA;AACjBR,oBAAAA;cACF,CAAA;YACF,CAAA;;;AAJA,wBAAA,KAAA;;;;;EAKF,CAAA;kBAjB4BN,WAAAA;;;;",
5
+ "names": ["serve", "honoServe", "createProdServer", "getOptionsFilled", "optionsIn", "options", "app", "server", "mode", "Promise", "res", "setTimeout", "fetch", "port", "hostname", "host", "console", "info", "on"]
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxrn",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "type": "module",
@@ -32,14 +32,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/code-frame": "^7.21.4",
35
+ "@hono/node-server": "^1.11.1",
35
36
  "@vitejs/plugin-react": "^4.2.1",
36
37
  "@vitejs/plugin-react-swc": "^3.6.0",
37
- "@vxrn/react-native-prebuilt": "0.1.63",
38
- "@vxrn/safe-area": "0.1.63",
39
- "@vxrn/vite-flow": "0.1.63",
40
- "@vxrn/vite-native-client": "0.1.63",
41
- "@vxrn/vite-native-hmr": "0.1.63",
42
- "@vxrn/vite-native-swc": "0.1.63",
38
+ "@vxrn/react-native-prebuilt": "0.1.64",
39
+ "@vxrn/safe-area": "0.1.64",
40
+ "@vxrn/vite-flow": "0.1.64",
41
+ "@vxrn/vite-native-client": "0.1.64",
42
+ "@vxrn/vite-native-hmr": "0.1.64",
43
+ "@vxrn/vite-native-swc": "0.1.64",
43
44
  "citty": "^0.1.6",
44
45
  "crossws": "^0.2.4",
45
46
  "es-module-lexer": "^1.3.0",
@@ -51,7 +52,9 @@
51
52
  "get-port-please": "^3.1.2",
52
53
  "glob": "^10.3.12",
53
54
  "h3": "^1.11.1",
55
+ "h3-compression": "^0.3.2",
54
56
  "h3-proxy": "^1.13.0",
57
+ "hono": "^4.3.10",
55
58
  "import-meta-resolve": "^4.0.0",
56
59
  "jiti": "^1.21.0",
57
60
  "metro-inspector-proxy": "^0.71.0",
@@ -66,7 +69,7 @@
66
69
  "source-map": "^0.7.3",
67
70
  "url": "^0.11.0",
68
71
  "vite": "6.0.0-alpha.11",
69
- "vxs": "0.1.63",
72
+ "vxs": "0.1.64",
70
73
  "ws": "^8.7.0"
71
74
  },
72
75
  "devDependencies": {
@@ -1,41 +1,60 @@
1
- import { createApp, defineEventHandler } from 'h3'
2
- import sirv from 'sirv'
1
+ import { Hono } from 'hono'
2
+ import { compress } from 'hono/compress'
3
+ // import { cache } from 'hono/cache'
4
+ import { serveStatic } from '@hono/node-server/serve-static'
5
+
3
6
  import type { VXRNConfig } from '../types'
4
7
 
5
8
  export const createProdServer = async (options: VXRNConfig) => {
6
- const app = createApp()
7
-
8
- const sirvStaticMiddleware = sirv('dist/static', {
9
- gzip: true,
10
- })
9
+ const app = new Hono()
11
10
 
12
- if (options.serve) {
13
- options.serve(options, app)
14
- }
11
+ app.use(compress())
15
12
 
16
13
  app.use(
17
- defineEventHandler(async ({ node: { req, res } }) => {
18
- await new Promise<void>((response) => {
19
- sirvStaticMiddleware(req, res, () => {
20
- response()
21
- })
22
- })
14
+ '*',
15
+ serveStatic({
16
+ root: './dist/client',
23
17
  })
24
18
  )
25
19
 
26
- const sirvMiddleware = sirv('dist/client', {
27
- gzip: true,
28
- })
20
+ // app.get(
21
+ // '*',
22
+ // cache({
23
+ // cacheName: 'my-app',
24
+ // cacheControl: 'max-age=3600',
25
+ // })
26
+ // )
29
27
 
30
- app.use(
31
- defineEventHandler(async ({ node: { req, res } }) => {
32
- await new Promise<void>((response) => {
33
- sirvMiddleware(req, res, () => {
34
- response()
35
- })
36
- })
37
- })
38
- )
28
+ if (options.serve) {
29
+ options.serve(options, app)
30
+ }
39
31
 
40
32
  return app
41
33
  }
34
+
35
+ // // testing cache
36
+ // const caches = {}
37
+ // function createCache(name: string) {
38
+ // if (caches[name]) return caches[name] as any
39
+ // const store = {}
40
+ // const cache = {
41
+ // async match(key: string) {
42
+ // console.log('matching', key)
43
+ // return store[key]
44
+ // },
45
+ // async put(key: string, val) {
46
+ // store[key] = val
47
+ // },
48
+ // async delete(key: string) {
49
+ // delete store[key]
50
+ // },
51
+ // }
52
+ // caches[name] = cache
53
+ // return cache
54
+ // }
55
+ // globalThis.caches = {
56
+ // ...createCache(''),
57
+ // async open(name: string) {
58
+ // return createCache(name)
59
+ // },
60
+ // }
@@ -1,5 +1,5 @@
1
- import { toNodeListener } from 'h3'
2
- import { createServer } from 'node:http'
1
+ import { serve as honoServe } from '@hono/node-server'
2
+
3
3
  import type { VXRNConfig } from '../types'
4
4
  import { createProdServer } from './createServer'
5
5
  import { getOptionsFilled } from '../utils/getOptionsFilled'
@@ -7,10 +7,14 @@ import { getOptionsFilled } from '../utils/getOptionsFilled'
7
7
  export const serve = async (optionsIn: VXRNConfig) => {
8
8
  const options = await getOptionsFilled(optionsIn, { mode: 'prod' })
9
9
  const app = await createProdServer(options)
10
- const server = createServer(toNodeListener(app))
11
10
  // strange prevents a cant listen on port issue
12
11
  await new Promise((res) => setTimeout(res, 1))
13
- server.listen(options.port, options.host)
12
+ const server = honoServe({
13
+ fetch: app.fetch,
14
+ port: options.port,
15
+ hostname: options.host,
16
+ })
17
+ // server.listen(options.port, options.host)
14
18
  console.info(`Listening on http://${options.host}:${options.port}`)
15
19
  await new Promise<void>((res) => {
16
20
  server.on('close', () => {
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Options as FlowOptions } from '@vxrn/vite-flow'
2
- import type { App } from 'h3'
2
+ import type { Hono } from 'hono'
3
3
  import type { OutputAsset, OutputChunk } from 'rollup'
4
4
  import type { InlineConfig, UserConfig } from 'vite'
5
5
 
@@ -41,7 +41,7 @@ export type VXRNConfig = {
41
41
 
42
42
  afterBuild?: (props: AfterBuildProps) => void | Promise<void>
43
43
 
44
- serve?: (options: VXRNConfig, app: App) => void
44
+ serve?: (options: VXRNConfig, app: Hono) => void
45
45
  }
46
46
 
47
47
  export type HMRListener = (update: { file: string; contents: string }) => void
@@ -1,3 +1,4 @@
1
+ import { Hono } from 'hono';
1
2
  import type { VXRNConfig } from '../types';
2
- export declare const createProdServer: (options: VXRNConfig) => Promise<import("h3").App>;
3
+ export declare const createProdServer: (options: VXRNConfig) => Promise<Hono<import("hono").Env, import("hono/types").BlankSchema, "/">>;
3
4
  //# sourceMappingURL=createServer.d.ts.map
package/types/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Options as FlowOptions } from '@vxrn/vite-flow';
2
- import type { App } from 'h3';
2
+ import type { Hono } from 'hono';
3
3
  import type { OutputAsset, OutputChunk } from 'rollup';
4
4
  import type { InlineConfig, UserConfig } from 'vite';
5
5
  export type AfterBuildProps = {
@@ -36,7 +36,7 @@ export type VXRNConfig = {
36
36
  nativeConfig?: InlineConfig;
37
37
  flow?: FlowOptions;
38
38
  afterBuild?: (props: AfterBuildProps) => void | Promise<void>;
39
- serve?: (options: VXRNConfig, app: App) => void;
39
+ serve?: (options: VXRNConfig, app: Hono) => void;
40
40
  };
41
41
  export type HMRListener = (update: {
42
42
  file: string;
@@ -20,7 +20,7 @@ export declare function getOptionsFilled(options: VXRNConfig, internal?: {
20
20
  nativeConfig?: import("vite").InlineConfig | undefined;
21
21
  flow?: import("@vxrn/vite-flow").Options | undefined;
22
22
  afterBuild?: ((props: import("..").AfterBuildProps) => void | Promise<void>) | undefined;
23
- serve?: ((options: VXRNConfig, app: import("h3").App) => void) | undefined;
23
+ serve?: ((options: VXRNConfig, app: import("hono").Hono<import("hono").Env, import("hono/types").BlankSchema, "/">) => void) | undefined;
24
24
  }>;
25
25
  type State = {
26
26
  applyPatches?: boolean;