@bananacool467/authtics-host 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Authtics Host
2
2
 
3
- Version 0.1.6
3
+ Version 0.1.7
4
4
  License: MIT
5
5
 
6
6
  Authtics Host is a framework inspired by Next.js. Authtics Host supports SSR (Server-Side Rendering) and uses esbuild.
@@ -181,6 +181,21 @@ and then create a file like `paused.tsx` and then inside `App.tsx`, import `Paus
181
181
  ```
182
182
  and if your using `autoPaging` then you just create a file named `_paused.tsx`.
183
183
 
184
+ ## App APIs
185
+
186
+ You can add APIs like `get`, `post`, `del` and `put`.
187
+
188
+ You can use the get API, for example:
189
+ ```typescript
190
+ app.get('/hi', (req, res) => {
191
+ res.text("Hello!");
192
+ })
193
+ ```
194
+ Then when you go to `/hi` you see:
195
+ ```
196
+ Hello!
197
+ ```
198
+
184
199
  ## Developer Panel Notes And DAT (Developer Access Token)
185
200
 
186
201
  A DAT (Developer Access Token) is your token that is used to access the Developer Panel.
package/dist/cli.d.ts CHANGED
@@ -8,4 +8,5 @@ export default class App {
8
8
  post(routePath: string, handler: (req: IncomingMessage, res: ServerResponse) => void): void;
9
9
  put(routePath: string, handler: (req: IncomingMessage, res: ServerResponse) => void): void;
10
10
  delete(routePath: string, handler: (req: IncomingMessage, res: ServerResponse) => void): void;
11
+ remove(method: string, routePath: string): void;
11
12
  }
package/dist/cli.js CHANGED
@@ -343,6 +343,10 @@ export default class App {
343
343
  delete(routePath, handler) {
344
344
  routes.set(`DELETE:${routePath}`, handler);
345
345
  }
346
+ remove(method, routePath) {
347
+ if (routes.has(`${method}:${routePath}`))
348
+ routes.delete(`${method}:${routePath}`);
349
+ }
346
350
  }
347
351
  async function start() {
348
352
  let config = {};
@@ -483,7 +487,7 @@ async function start() {
483
487
  pathname = safePath;
484
488
  if (pathname !== "/" && pathname.endsWith("/"))
485
489
  pathname = pathname.slice(0, -1);
486
- if (!pathname.includes('/__authtics')) {
490
+ if (!pathname.includes('/__authtics') && !pathname.includes('/hmr')) {
487
491
  totalRequests++;
488
492
  }
489
493
  const routeKey = `${method}:${pathname}`;
@@ -498,7 +502,7 @@ async function start() {
498
502
  res.setHeader("Content-Type", "application/javascript");
499
503
  res.end(f);
500
504
  });
501
- }, req.cookies.dat, config_.dat);
505
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
502
506
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
503
507
  res.setHeader("Content-Type", "text/html");
504
508
  return res.end(html);
@@ -521,7 +525,7 @@ async function start() {
521
525
  res.setHeader("Content-Type", "application/javascript");
522
526
  res.end(f);
523
527
  });
524
- }, req.cookies.dat, config_.dat);
528
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
525
529
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
526
530
  res.setHeader("Content-Type", "text/html");
527
531
  return res.end(html);
@@ -551,7 +555,7 @@ async function start() {
551
555
  res.setHeader("Content-Type", "application/javascript");
552
556
  res.end(f);
553
557
  });
554
- }, req.cookies.dat, config_.dat);
558
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
555
559
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
556
560
  res.setHeader("Content-Type", "text/html");
557
561
  return res.end(html);
@@ -574,7 +578,7 @@ async function start() {
574
578
  res.setHeader("Content-Type", "application/javascript");
575
579
  res.end(f);
576
580
  });
577
- }, req.cookies.dat, config_.dat);
581
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
578
582
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
579
583
  res.setHeader("Content-Type", "text/html");
580
584
  return res.end(html);
@@ -602,7 +606,7 @@ async function start() {
602
606
  return handler(req, res);
603
607
  }
604
608
  }
605
- if (pathname === '/__authtics_hmr__') {
609
+ if (pathname === '/hmr') {
606
610
  res.writeHead(200, {
607
611
  'Content-Type': 'text/event-stream',
608
612
  'Cache-Control': 'no-cache',
@@ -625,7 +629,7 @@ async function start() {
625
629
  res.setHeader("Content-Type", "application/javascript");
626
630
  res.end(f);
627
631
  });
628
- }, req.cookies.dat, config_.dat);
632
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
629
633
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
630
634
  res.setHeader("Content-Type", "text/html");
631
635
  return res.end(html);
@@ -648,7 +652,7 @@ async function start() {
648
652
  res.setHeader("Content-Type", "application/javascript");
649
653
  res.end(f);
650
654
  });
651
- }, req.cookies.dat, config_.dat);
655
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
652
656
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
653
657
  res.setHeader("Content-Type", "text/html");
654
658
  return res.end(html);
@@ -678,7 +682,7 @@ async function start() {
678
682
  res.setHeader("Content-Type", "application/javascript");
679
683
  res.end(f);
680
684
  });
681
- }, req.cookies.dat, config_.dat);
685
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
682
686
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
683
687
  res.setHeader("Content-Type", "text/html");
684
688
  return res.end(html);
@@ -701,7 +705,7 @@ async function start() {
701
705
  res.setHeader("Content-Type", "application/javascript");
702
706
  res.end(f);
703
707
  });
704
- }, req.cookies.dat, config_.dat);
708
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
705
709
  html = html.replace("<script>", "<script>\nwindow.__paused__ = true;");
706
710
  res.setHeader("Content-Type", "text/html");
707
711
  return res.end(html);
@@ -759,7 +763,7 @@ async function start() {
759
763
  res.setHeader("Content-Type", "application/javascript");
760
764
  res.end(f);
761
765
  });
762
- }, req.cookies.dat, config_.dat);
766
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
763
767
  res.setHeader("Content-Type", "text/html");
764
768
  res.writeHead(404);
765
769
  html = html.replace("<script>", "<script>\nwindow.__status_code__ = 404;");
@@ -785,7 +789,7 @@ async function start() {
785
789
  res.setHeader("Content-Type", "application/javascript");
786
790
  res.end(f);
787
791
  });
788
- }, req.cookies.dat, config_.dat);
792
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
789
793
  res.setHeader("Content-Type", "text/html");
790
794
  return res.end(html);
791
795
  }
@@ -809,7 +813,7 @@ async function start() {
809
813
  res.setHeader("Content-Type", "application/javascript");
810
814
  res.end(f);
811
815
  });
812
- }, req.cookies.dat, config_.dat);
816
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
813
817
  res.setHeader("Content-Type", "text/html");
814
818
  return res.end(html);
815
819
  }
@@ -828,7 +832,7 @@ async function start() {
828
832
  res.setHeader("Content-Type", "application/javascript");
829
833
  res.end(f);
830
834
  });
831
- }, req.cookies.dat, config_.dat);
835
+ }, (p) => { routes.delete(`GET:${p}`); }, req.cookies.dat, config_.dat);
832
836
  res.setHeader("Content-Type", "text/html");
833
837
  res.writeHead(404);
834
838
  html = html.replace("<script>", "<script>\nwindow.__status_code__ = 404;");
@@ -850,7 +854,7 @@ async function start() {
850
854
  }, 1000);
851
855
  });
852
856
  if (config.hotReload === true) {
853
- const watchDirs = [pagesDir];
857
+ const watchDirs = [pagesDir || path.join(routes.get("APP_TSX"), "../")];
854
858
  const devPanelDir = path.join(__dirname, 'devPanel.js');
855
859
  const _404Dir = path.join(__dirname, '404.js');
856
860
  if (fs.existsSync(devPanelDir))
@@ -1,2 +1 @@
1
- import 'prismjs/components/prism-javascript';
2
1
  export default function DevPanel(): import("react/jsx-runtime").JSX.Element;
package/dist/devPanel.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useRef } from 'react';
3
3
  import { ShieldCheck, CircleX, ChevronDown, ChevronUp, Bug, AlertTriangle, Info, ArrowLeft, Wifi, Terminal, Route, Globe, ChevronRight, ChevronLeft, Server, TriangleAlert, Eye, Zap } from 'lucide-react';
4
- import Prism from 'prismjs';
5
- import 'prismjs/components/prism-javascript';
6
- Prism.languages.javascript['builtin'] = /\b(window|document|console|navigator|localStorage|sessionStorage|fetch|Promise|setTimeout|setInterval|clearTimeout|clearInterval|requestAnimationFrame|Math|JSON|Object|Array|String|Number|Boolean|Date|RegExp|Error|Map|Set|Symbol|Proxy|Reflect|performance|history|location|screen|crypto|indexedDB|alert|confirm|prompt)\b/;
7
4
  function getCallerSource() {
8
5
  try {
9
6
  const stack = new Error().stack ?? '';
@@ -63,7 +60,7 @@ function Sparkline({ data, color, label, unit }) {
63
60
  return _jsx("circle", { cx: last[0], cy: last[1], r: "2.5", fill: color });
64
61
  })()] }))] })] }));
65
62
  }
66
- function installNetworkInterceptor(onFetch, setFetch, onEventSource, setEventSource, onWebSocket, setWebSocket, onResource, setResource, onBytesClient, onBytesServer) {
63
+ function installNetworkInterceptor(onFetch, setFetch, onEventSource, setEventSource, onWebSocket, setWebSocket, onResource, setResource, rmvResource, onBytesClient, onBytesServer) {
67
64
  if (window.__authtics_network_intercepted__)
68
65
  return;
69
66
  window.__authtics_network_intercepted__ = true;
@@ -221,23 +218,60 @@ function installNetworkInterceptor(onFetch, setFetch, onEventSource, setEventSou
221
218
  };
222
219
  window.EventSource.prototype = OriginalEventSource.prototype;
223
220
  Object.assign(window.EventSource, OriginalEventSource);
224
- setTimeout(() => {
221
+ let usedResourcesSlots = [];
222
+ let beforeResources = [];
223
+ let currentResources = [];
224
+ setInterval(() => {
225
+ beforeResources = currentResources;
226
+ currentResources = [];
225
227
  const queryImg = document.querySelectorAll('img');
226
228
  const queryScript = document.querySelectorAll('script');
227
229
  const queryLink = document.querySelectorAll('link');
228
230
  queryImg.forEach((img) => {
229
- if (img.src)
230
- onResource({ url: img.src, type: 'img', id: fetchId++ });
231
+ if (img.src) {
232
+ fetchId++;
233
+ let savedFetchId = fetchId;
234
+ if (!usedResourcesSlots.includes({ url: img.src, type: 'img', id: savedFetchId }))
235
+ onResource({ url: img.src, type: 'img', id: savedFetchId });
236
+ currentResources.push({ url: img.src, type: 'img', id: savedFetchId });
237
+ if (usedResourcesSlots.includes({ url: img.src, type: 'img', id: savedFetchId }))
238
+ setResource({ url: img.src, type: 'img', id: savedFetchId });
239
+ if (!usedResourcesSlots.includes({ url: img.src, type: 'img', id: savedFetchId }))
240
+ usedResourcesSlots.push({ url: img.src, type: 'img', id: savedFetchId });
241
+ }
231
242
  });
232
243
  queryScript.forEach((script) => {
233
- if (script.src)
234
- onResource({ url: script.src, type: 'script', id: fetchId++ });
244
+ if (script.src) {
245
+ fetchId++;
246
+ let savedFetchId = fetchId;
247
+ if (!usedResourcesSlots.includes({ url: script.src, type: 'script', id: savedFetchId }))
248
+ onResource({ url: script.src, type: 'script', id: savedFetchId });
249
+ currentResources.push({ url: script.src, type: 'script', id: savedFetchId });
250
+ if (usedResourcesSlots.includes({ url: script.src, type: 'script', id: savedFetchId }))
251
+ setResource({ url: script.src, type: 'script', id: savedFetchId });
252
+ if (!usedResourcesSlots.includes({ url: script.src, type: 'script', id: savedFetchId }))
253
+ usedResourcesSlots.push({ url: script.src, type: 'script', id: savedFetchId });
254
+ }
235
255
  });
236
256
  queryLink.forEach((link) => {
237
- if (link.href)
238
- onResource({ url: link.href, type: 'link', id: fetchId++ });
257
+ if (link.href) {
258
+ fetchId++;
259
+ let savedFetchId = fetchId;
260
+ if (!usedResourcesSlots.includes({ url: link.href, type: 'link', id: savedFetchId }))
261
+ onResource({ url: link.href, type: 'link', id: savedFetchId });
262
+ currentResources.push({ url: link.href, type: 'link', id: savedFetchId });
263
+ if (usedResourcesSlots.includes({ url: link.href, type: 'link', id: savedFetchId }))
264
+ setResource({ url: link.href, type: 'link', id: savedFetchId });
265
+ if (!usedResourcesSlots.includes({ url: link.href, type: 'link', id: savedFetchId }))
266
+ usedResourcesSlots.push({ url: link.href, type: 'link', id: savedFetchId });
267
+ }
268
+ });
269
+ beforeResources.forEach((resource) => {
270
+ if (!currentResources.includes(resource)) {
271
+ rmvResource(resource);
272
+ }
239
273
  });
240
- }, 5000);
274
+ }, 250);
241
275
  }
242
276
  function installConsoleInterceptor() {
243
277
  if (window.__authtics_intercepted__)
@@ -309,7 +343,6 @@ export default function DevPanel() {
309
343
  const [ping__, setPing__] = useState(0);
310
344
  const [networkFetches, setNetworkFetches] = useState([]);
311
345
  const [eventSources, setEventSources] = useState([]);
312
- const [usersPaused, setUsersPaused] = useState(false);
313
346
  const [usersPausedRealInfo, setUsersPausedRealInfo] = useState(false);
314
347
  const [webSockets, setWebSockets] = useState([]);
315
348
  const [resourcesFound, setResourcesFound] = useState([]);
@@ -324,7 +357,6 @@ export default function DevPanel() {
324
357
  const heapUsage = useRef(0);
325
358
  const [datMatch, setDatMatch] = useState(false);
326
359
  const [compilerType, setCompilerType] = useState("?");
327
- const [errorDetail, setErrorDetail] = useState(undefined);
328
360
  const [httpVersion, setHttpVersion] = useState("v?.?");
329
361
  const [errorBoxOpenable, setErrorBoxOpenable] = useState(false);
330
362
  const [uptime, setUptime] = useState("00:00:00:00");
@@ -400,7 +432,6 @@ export default function DevPanel() {
400
432
  if (resp3.status === 200) {
401
433
  const data = await resp3.json();
402
434
  paused = data.paused;
403
- setUsersPaused(paused);
404
435
  setUsersPausedRealInfo(data.realInfo);
405
436
  }
406
437
  if (!data.isMatching && !paused) {
@@ -603,7 +634,7 @@ export default function DevPanel() {
603
634
  }, []);
604
635
  useEffect(() => {
605
636
  installConsoleInterceptor();
606
- installNetworkInterceptor((f) => setNetworkFetches(prev => [...prev.slice(-49), f]), (f) => setNetworkFetches(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setEventSources(prev => [...prev.slice(-49), f]), (f) => setEventSources(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setWebSockets(prev => [...prev.slice(-49), f]), (f) => setWebSockets(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => [...prev.slice(-49), f]), (f) => setResourcesFound(prev => prev.map(p => p.id === f.id ? f : p)), (sent) => {
637
+ installNetworkInterceptor((f) => setNetworkFetches(prev => [...prev.slice(-49), f]), (f) => setNetworkFetches(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setEventSources(prev => [...prev.slice(-49), f]), (f) => setEventSources(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setWebSockets(prev => [...prev.slice(-49), f]), (f) => setWebSockets(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => [...prev.slice(-49), f]), (f) => setResourcesFound(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => prev.filter(p => p.id !== f.id)), (sent) => {
607
638
  pendingSent.current += sent;
608
639
  }, (received) => {
609
640
  pendingReceived.current += received;
@@ -615,7 +646,6 @@ export default function DevPanel() {
615
646
  setHasIssue(true);
616
647
  setErrorMsgs(prev => [...prev, detail.message]);
617
648
  setErrorBoxOpen(true);
618
- setErrorDetail(detail.source);
619
649
  }
620
650
  ;
621
651
  };
@@ -1,3 +1,3 @@
1
1
  export type CompilerType = 'esbuild' | 'babel';
2
2
  export declare function findFileUpwards(startDir: string, relativePath: string): string | null;
3
- export declare function renderPage(tsxPath: string, reqUrl?: string, showPanel?: boolean, compiler?: CompilerType, hotReload?: boolean, autoPaging?: boolean, autoPageDir?: string, appDir?: string, fileHandler?: (f: string, p: string) => void, reqDAT?: string | undefined, configDAT?: string | string[] | undefined): Promise<string>;
3
+ export declare function renderPage(tsxPath: string, reqUrl?: string, showPanel?: boolean, compiler?: CompilerType, hotReload?: boolean, autoPaging?: boolean, autoPageDir?: string, appDir?: string, fileHandler?: (f: string, p: string) => void, rmvFileHandler?: (p: string) => void, reqDAT?: string | undefined, configDAT?: string | string[] | undefined): Promise<string>;
@@ -38,9 +38,9 @@ async function buildWithEsbuild(virtualContent, resolveDir, platform) {
38
38
  format: isNode ? 'cjs' : 'iife',
39
39
  platform,
40
40
  jsx: 'automatic',
41
- sourcemap: isNode ? false : 'inline',
41
+ sourcemap: isNode ? false : false,
42
42
  target: isNode ? ['node18'] : ['es2020'],
43
- minify: false,
43
+ minify: true,
44
44
  treeShaking: true,
45
45
  external: isNode
46
46
  ? ['react', 'react-dom', 'react-dom/server', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'node:http',
@@ -48,9 +48,16 @@ async function buildWithEsbuild(virtualContent, resolveDir, platform) {
48
48
  'node:fs',
49
49
  'node:url',
50
50
  'tls',
51
- path.join(__dirname, 'cli.js')]
51
+ path.join(__dirname, 'cli.js'),
52
+ path.join(__dirname, 'config.js'),
53
+ path.join(__dirname, 'renderEngine.js'),
54
+ path.join(__dirname, 'rendererTempFiles.js')]
52
55
  : [
53
- path.join(__dirname, 'cli.js')
56
+ path.join(__dirname, 'cli.js'),
57
+ path.join(__dirname, 'cli.js'),
58
+ path.join(__dirname, 'config.js'),
59
+ path.join(__dirname, 'renderEngine.js'),
60
+ path.join(__dirname, 'rendererTempFiles.js')
54
61
  ],
55
62
  });
56
63
  return result.outputFiles[0].text;
@@ -95,7 +102,7 @@ function buildHtml(opts) {
95
102
  template = template.replace(contentTag, `<div id="root">${pageHtml}</div>\n ${devPanelContainer}`);
96
103
  template = template.includes("</body>")
97
104
  ? template.replace("</body>", ` ${fileName ? `<script src="${fileName}"></script>` : `<script>${clientCode}</script>`}\n${hmrScript}</body>`)
98
- : template + `\n${fileName ? `<script src="${fileName}"></script>` : `<script>${clientCode}</script>`}${hmrScript}`;
105
+ : template + `\n${fileName ? `<script src="${fileName}"></script>` : `<script>${clientCode}</script>`}\n${hmrScript}`;
99
106
  return template;
100
107
  }
101
108
  console.warn('[authtics] _template.html has no <authtics_host_content /> — using default layout.');
@@ -131,34 +138,13 @@ function isCacheValid(tsxPath, tempPath, serverCjsPath, templatePath, devPanelPa
131
138
  return false;
132
139
  }
133
140
  }
134
- const HMR_SCRIPT = `
135
- <script>
136
- (function() {
137
- const es = new EventSource('/__authtics_hmr__');
138
- es.onmessage = function(e) { if (e.data === 'reload') window.location.reload(); };
139
- es.onerror = function() { setTimeout(function() { window.location.reload(); }, 1000); };
140
- window.onbeforeunload = function() {
141
- es.close();
142
- es = null;
143
- };
144
- })();
145
- </script>
146
- `;
147
- export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = 'esbuild', hotReload = false, autoPaging = true, autoPageDir, appDir, fileHandler, reqDAT, configDAT) {
141
+ const HMR_SCRIPT = `<script>(function(){const es=new EventSource('/hmr');es.onmessage=function(e){if (e.data === 'reload') window.location.reload()};es.onerror=function(){setTimeout(function(){window.location.reload()},1000)};})();</script>`;
142
+ export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = 'esbuild', hotReload = false, autoPaging = true, autoPageDir, appDir, fileHandler, rmvFileHandler, reqDAT, configDAT) {
148
143
  ensureTempDirs();
149
144
  if (!fs.existsSync(tsxPath)) {
150
145
  throw new Error(`renderPage: source file not found: ${tsxPath}`);
151
146
  }
152
147
  let usesDevPanel = showPanel && devPanelPath !== null;
153
- let datMatched = false;
154
- if (configDAT && configDAT == reqDAT)
155
- datMatched = true;
156
- if (configDAT && Array.isArray(configDAT) && configDAT.includes(reqDAT || ""))
157
- datMatched = true;
158
- if (configDAT == undefined)
159
- datMatched = true;
160
- if (!datMatched && usesDevPanel)
161
- usesDevPanel = false;
162
148
  const templatePath = resolveTemplate(appDir, autoPageDir, autoPaging);
163
149
  const tempPath = tempFileForTsx(tsxPath);
164
150
  const serverCjsPath = tempPath.replace(/\.json$/, ".server.cjs");
@@ -204,6 +190,7 @@ export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = '
204
190
  fs.writeFileSync(serverCjsPath, serverCode, "utf-8");
205
191
  writeTempFile(tempPath, JSON.stringify({ clientCode }));
206
192
  }
193
+ fileHandler ? fileHandler(clientCode, `/${tempPath.substring(tempPath.lastIndexOf('/') + 1).replace(".json", ".js").replace(".tsx_", ".").toLowerCase()}`) : null;
207
194
  const serverModule = await import(`${serverCjsPath}?t=${Date.now()}`);
208
195
  const exports = serverModule.default ?? serverModule;
209
196
  const PageComponent = exports.default ?? exports.Page ?? exports.page ?? null;
@@ -218,6 +205,5 @@ export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = '
218
205
  const devPanelContainer = usesDevPanel
219
206
  ? `<div id="authtics-dev-panel-root">${devPanelHtml}</div>`
220
207
  : "";
221
- fileHandler ? fileHandler(clientCode.replace('\n', ''), `/${tsxPath.substring(tsxPath.lastIndexOf('/') + 1).replace(".tsx", ".js").toLowerCase()}`) : null;
222
- return buildHtml({ pageHtml, clientCode, devPanelContainer, templatePath, hotReload, fileName: `/${tsxPath.substring(tsxPath.lastIndexOf('/') + 1).replace(".tsx", ".js").toLowerCase()}` });
208
+ return buildHtml({ pageHtml, clientCode, devPanelContainer, templatePath, hotReload, fileName: `/${tempPath.substring(tempPath.lastIndexOf('/') + 1).replace(".json", ".js").replace(".tsx_", ".").toLowerCase()}` });
223
209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananacool467/authtics-host",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Authtics Host, A Next.js-inspired SSR framework for Node.js with TypeScript and JSX support.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",