@hyperspan/framework
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,1 @@ | ||
// @bun | ||
var __create = Object.create; | ||
@@ -415,4 +414,4 @@ var __defProp = Object.defineProperty; | ||
// src/server.ts | ||
import {readdir} from "fs/promises"; | ||
import {basename, extname, join} from "path"; | ||
import {readdir} from "node:fs/promises"; | ||
import {basename, extname, join, resolve} from "node:path"; | ||
@@ -1827,2 +1826,3 @@ // src/html.ts | ||
const fileRoutes = await buildRoutes(config); | ||
const routeMap = []; | ||
for (let i = 0;i < fileRoutes.length; i++) { | ||
@@ -1832,3 +1832,3 @@ let route = fileRoutes[i]; | ||
const routePattern = normalizePath(route.route); | ||
console.log("[Hyperspan] Added route: ", routePattern); | ||
routeMap.push({ route: routePattern, file: config.appDir + "/routes/" + route.file }); | ||
app2.all(routePattern, async (context) => { | ||
@@ -1842,2 +1842,6 @@ const matchedRoute = await runFileRoute(fullRouteFile, context); | ||
} | ||
if (!IS_PROD) { | ||
console.log("[Hyperspan] File system routes (in app/routes):"); | ||
console.table(routeMap); | ||
} | ||
config.afterRoutesAdded && config.afterRoutesAdded(app2); | ||
@@ -1862,4 +1866,5 @@ app2.all("*", (context) => { | ||
async function buildClientJS() { | ||
const sourceFile = resolve(CWD, "../", "./src/clientjs/hyperspan-client.ts"); | ||
const output = await Bun.build({ | ||
entrypoints: ["./src/hyperspan/clientjs/hyperspan-client.ts"], | ||
entrypoints: [sourceFile], | ||
outdir: `./public/_hs/js`, | ||
@@ -1908,2 +1913,3 @@ naming: IS_PROD ? "[dir]/[name]-[hash].[ext]" : undefined, | ||
var IS_PROD = false; | ||
var CWD = import.meta.dir; | ||
var STATIC_FILE_MATCHER = /[^/\\&\?]+\.([a-zA-Z]+)$/; | ||
@@ -1910,0 +1916,0 @@ var _routeCache = {}; |
{ | ||
"name": "@hyperspan/framework", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Hyperspan Web Framework", | ||
@@ -12,5 +12,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "bun run clean && bun run build:client && bun run build:server", | ||
"build:client": "bun build ./src/index.ts --outdir ./dist --target browser", | ||
"build:server": "bun build ./src/server.ts --outdir ./dist --target bun", | ||
"build": "bun ./build.ts", | ||
"clean": "rm -rf dist", | ||
@@ -24,3 +22,11 @@ "test": "bun test", | ||
}, | ||
"keywords": ["framework", "node", "bun", "web", "framework", "javascript", "typescript"], | ||
"keywords": [ | ||
"framework", | ||
"node", | ||
"bun", | ||
"web", | ||
"framework", | ||
"javascript", | ||
"typescript" | ||
], | ||
"author": "Vance Lucas <vance@vancelucas.com>", | ||
@@ -39,3 +45,10 @@ "license": "BSD-3-Clause", | ||
"trek-router": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "^1.1.9", | ||
"@types/escape-html": "^1.0.4", | ||
"@types/node": "^22.5.5", | ||
"bun-plugin-dts": "^0.2.3", | ||
"typescript": "^5.6.2" | ||
} | ||
} |
import { readdir } from 'node:fs/promises'; | ||
import { basename, extname, join } from 'node:path'; | ||
import { basename, extname, join, resolve } from 'node:path'; | ||
import { html, renderToStream, renderToString } from './html'; | ||
@@ -9,2 +9,3 @@ import { isbot } from 'isbot'; | ||
export const IS_PROD = process.env.NODE_ENV === 'production'; | ||
const CWD = import.meta.dir; | ||
const STATIC_FILE_MATCHER = /[^/\\&\?]+\.([a-zA-Z]+)$/; | ||
@@ -219,2 +220,3 @@ | ||
const fileRoutes = await buildRoutes(config); | ||
const routeMap = []; | ||
@@ -226,4 +228,3 @@ for (let i = 0; i < fileRoutes.length; i++) { | ||
// @ts-ignore | ||
console.log('[Hyperspan] Added route: ', routePattern); | ||
routeMap.push({ route: routePattern, file: config.appDir + '/routes/' + route.file }); | ||
@@ -240,2 +241,8 @@ app.all(routePattern, async (context) => { | ||
// Display routing table for dev env | ||
if (!IS_PROD) { | ||
console.log('[Hyperspan] File system routes (in app/routes):'); | ||
console.table(routeMap); | ||
} | ||
// [Customization] After routes added... | ||
@@ -274,4 +281,5 @@ config.afterRoutesAdded && config.afterRoutesAdded(app); | ||
export async function buildClientJS() { | ||
const sourceFile = resolve(CWD, '../', './src/clientjs/hyperspan-client.ts'); | ||
const output = await Bun.build({ | ||
entrypoints: ['./src/hyperspan/clientjs/hyperspan-client.ts'], | ||
entrypoints: [sourceFile], | ||
outdir: `./public/_hs/js`, | ||
@@ -278,0 +286,0 @@ naming: IS_PROD ? '[dir]/[name]-[hash].[ext]' : undefined, |
@@ -22,6 +22,5 @@ { | ||
"forceConsistentCasingInFileNames": true, | ||
"allowJs": true, | ||
"types": ["bun-types"] | ||
"allowJs": true | ||
}, | ||
"exclude": ["node_modules", "__tests__", "*.test.ts"] | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
169862
20
4642
1
0
5