@bananacool467/authtics-host 0.2.0 → 0.2.1

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,13 +1,13 @@
1
1
  # Authtics Host
2
2
 
3
- Version 0.2.0
3
+ Version 0.2.1
4
4
  License: MIT
5
5
 
6
- Authtics Host is a framework inspired by Next.js. Authtics Host supports SSR (Server-Side Rendering) and uses esbuild.
6
+ Authtics Host is a web framework inspired by Next.js. Authtics Host supports SSR (Server-Side Rendering) and uses esbuild. This is not to be confused with auth platforms.
7
7
 
8
8
  **(NOTE: The short name for Authtics Host is HostJS or Host.js)**
9
9
 
10
- **(Fixes we're applied on this version with security fixes too)**
10
+ **(Fixes we're applied on this version, babel support had to be removed)**
11
11
 
12
12
  **(From the Developer: I am having 2 small issues:**
13
13
 
@@ -259,6 +259,10 @@ There isn't any limit of DATs you can add.
259
259
 
260
260
  **(NOTE: Adding your DAT will give you access to Restart and Shutdown and Pause/Resume Users and other features in the Developer Panel)**
261
261
 
262
+ ## Reasons for the name, Authtics Host
263
+
264
+ I named this web framework Authtics Host because it uses DAT (For the **Auth**tics part) for developer authentication for dev panel, and for "Host" is because it let's the developer **Restart**/**Shutdown** the server.
265
+
262
266
  ## Contacting The Developer Of Authtics Host
263
267
 
264
268
  If you have any questions, or encountered a bug while using HostJS, contact: authtics@proton.me
package/dist/cli.js CHANGED
@@ -411,7 +411,7 @@ async function start() {
411
411
  const PORT = config.port ?? 3000;
412
412
  const showPanel = config.devMode !== false;
413
413
  const autoPaging = config.autoPage !== false;
414
- const compiler = config.compilerType === 'babel' ? 'babel' : 'esbuild';
414
+ const compiler = 'esbuild';
415
415
  const hotReload = config.hotReload === true;
416
416
  const pagesDir = config.autoPage === true ? path.join(process.cwd(), config.autoPageDir || "") : undefined;
417
417
  const publicDir = config.autoFile === true ? path.join(process.cwd(), config.autoFileDir || "") : undefined;
@@ -1,3 +1,3 @@
1
- export type CompilerType = 'esbuild' | 'babel';
1
+ export type CompilerType = 'esbuild';
2
2
  export declare function findFileUpwards(startDir: string, relativePath: string): string | null;
3
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>;
@@ -2,8 +2,6 @@ import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import * as esbuild from "esbuild";
5
- import * as babel from "@babel/core";
6
- import * as babelPresetEnv from "@babel/preset-env";
7
5
  import React from "react";
8
6
  import { renderToString } from "react-dom/server";
9
7
  import { tempFileForTsx, writeTempFile, readTempFile, ensureTempDirs, } from "./rendererTempFiles.js";
@@ -42,22 +40,6 @@ const nodeStubPlugin = {
42
40
  }));
43
41
  },
44
42
  };
45
- async function buildWithBabel(entryPath, virtualContent, platform) {
46
- const presets = [
47
- [babelPresetEnv, {
48
- targets: platform === 'node' ? { node: 'current' } : { browsers: '>0.5%, not dead' },
49
- modules: platform === 'node' ? 'commonjs' : false,
50
- }],
51
- ];
52
- const result = await babel.transformAsync(virtualContent, {
53
- filename: entryPath,
54
- presets,
55
- sourceMaps: false,
56
- });
57
- if (!result?.code)
58
- throw new Error('[authtics] Babel produced no output');
59
- return result.code;
60
- }
61
43
  async function buildWithEsbuild(virtualContent, resolveDir, platform) {
62
44
  const toFwdSlash = (p) => p.split(path.sep).join('/');
63
45
  const isNode = platform === 'node';
@@ -241,19 +223,15 @@ export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = '
241
223
  const rootEl = document.getElementById("root");
242
224
  if (rootEl) hydrateRoot(rootEl, React.createElement(Page));
243
225
  `;
244
- if (compiler === 'babel') {
245
- serverCode = await buildWithBabel(tsxPath, virtualServer, 'node');
246
- clientCode = await buildWithBabel(tsxPath, virtualClient, 'browser');
247
- }
248
- else {
226
+ if (compiler === 'esbuild') {
249
227
  serverCode = await buildWithEsbuild(virtualServer, process.cwd(), 'node');
250
228
  clientCode = await buildWithEsbuild(virtualClient, process.cwd(), 'browser');
251
229
  }
252
- fs.writeFileSync(serverCjsPath, serverCode, "utf-8");
230
+ fs.writeFileSync(serverCjsPath, serverCode || "", "utf-8");
253
231
  writeTempFile(tempPath, JSON.stringify({ clientCode }));
254
232
  freshWrite = true;
255
233
  }
256
- fileHandler ? fileHandler(clientCode, `/${path.basename(tempPath).replace(".json", ".js").replace(".tsx_", ".").toLowerCase()}`) : null;
234
+ fileHandler ? fileHandler(clientCode || "", `/${path.basename(tempPath).replace(".json", ".js").replace(".tsx_", ".").toLowerCase()}`) : null;
257
235
  const serverModule = await import(freshWrite ? `${serverCjsPath}?t=${Date.now()}` : serverCjsPath);
258
236
  const exports = serverModule.default ?? serverModule;
259
237
  const PageComponent = exports.default ?? exports.Page ?? exports.page ?? null;
@@ -268,7 +246,7 @@ export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = '
268
246
  const devPanelContainer = usesDevPanel
269
247
  ? `<div id="authtics-dev-panel-root">${devPanelHtml}</div>`
270
248
  : "";
271
- return buildHtml({ pageHtml, clientCode, devPanelContainer, templatePath, hotReload,
249
+ return buildHtml({ pageHtml, clientCode: clientCode || "", devPanelContainer, templatePath, hotReload,
272
250
  fileName: `/${path.basename(tempPath).replace(".json", ".js").replace(".tsx_", ".").toLowerCase()}`,
273
251
  datRestricted: configDAT !== undefined,
274
252
  devMode: showPanel,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@bananacool467/authtics-host",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
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",
7
7
  "type": "module",
8
8
  "sideEffects": false,
9
9
  "bin": {
10
- "authtics": "./dist/cli.js"
10
+ "hostjs": "dist/cli.js"
11
11
  },
12
12
  "exports": {
13
13
  ".": "./dist/index.js"