Comparing version 0.1.7 to 0.1.8
{ | ||
"name": "nuekit", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "The Nue framework for building websites and webapps", | ||
@@ -9,3 +8,2 @@ "homepage": "https://nuejs.org", | ||
"type": "module", | ||
"repository": { | ||
@@ -15,8 +13,6 @@ "url": "https://github.com/nuejs/nue", | ||
"type": "git" | ||
}, | ||
}, | ||
"bin": { | ||
"nue": "./src/cli.js" | ||
}, | ||
}, | ||
"scripts": { | ||
@@ -26,7 +22,10 @@ "test": "cd test && bun test" | ||
"dependencies": { | ||
"nuejs-core": "^0.3.0", | ||
"diff-dom": "^5.0.6", | ||
"js-yaml": "^4.1.0", | ||
"marked": "^9.1.2" | ||
"marked": "^9.1.6", | ||
"nuejs-core": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "^0.19.11" | ||
}, | ||
"engines": { | ||
@@ -33,0 +32,0 @@ "bun": ">= 1", |
@@ -6,3 +6,3 @@ | ||
# Nue | ||
# Nue [![test](https://github.com/nuejs/nue/actions/workflows/test.yaml/badge.svg?branch=master)](https://github.com/nuejs/nue/actions/workflows/test.yaml) | ||
Nue(kit) is a static website generator and web application builder. It's an amazingly simple and powerful alternative to **Next.js** and **Astro**: | ||
@@ -9,0 +9,0 @@ |
@@ -53,6 +53,8 @@ | ||
const path = el?.getAttribute('href') | ||
const target = el?.getAttribute('target') | ||
// event ignore | ||
if (e.defaultPrevented || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || | ||
!path || path[0] == '#' || path.includes('//') || path.startsWith('mailto:')) return | ||
!path || path[0] == '#' || path.includes('//') || path.startsWith('mailto:') || | ||
target == '_blank') return | ||
@@ -73,2 +75,7 @@ // all good | ||
// Fix: window.onpopstate, event.state == null? | ||
// https://stackoverflow.com/questions/11092736/window-onpopstate-event-state-null | ||
is_browser && history.pushState({ path: location.pathname }, 0) | ||
// autoroute / document clicks | ||
@@ -75,0 +82,0 @@ is_browser && onclick(document, (path) => { |
@@ -124,3 +124,3 @@ #!/usr/bin/env bun | ||
} catch (e) { | ||
if (e.errno != -2) console.info(e) | ||
console.info(e) | ||
} | ||
@@ -127,0 +127,0 @@ } |
@@ -0,3 +1,4 @@ | ||
import { extname } from 'node:path' | ||
import { TYPES } from './nueserver.js' | ||
export function renderHead(data, is_prod) { | ||
@@ -8,2 +9,3 @@ const { | ||
charset = 'utf-8', | ||
title_template = '%s', | ||
scripts = [], | ||
@@ -22,3 +24,3 @@ styles = [], | ||
const head = [`<meta charset="${charset}">`] | ||
if (title) head.push(`<title>${title}</title>`) | ||
if (title) head.push(`<title>${title_template.replace(/%s/gi, title)}</title>`) | ||
@@ -58,3 +60,3 @@ // meta | ||
// misc | ||
if (favicon) head.push(`<link rel="shortcut icon" src="${favicon}">`) | ||
if (favicon) head.push(`<link rel="shortcut icon" type="${TYPES[extname(favicon).slice(1)]}" src="${favicon}">`) | ||
@@ -61,0 +63,0 @@ // inline style |
@@ -15,3 +15,3 @@ | ||
const TYPES = { | ||
export const TYPES = { | ||
html: 'text/html; charset=UTF-8', | ||
@@ -44,5 +44,7 @@ js: 'application/javascript', | ||
const [ url, _ ] = req.url.split('?') | ||
let [ url, _ ] = req.url.split('?') | ||
const ext = extname(url).slice(1) | ||
if (!ext) url = join(url, 'index.html') | ||
try { | ||
@@ -49,0 +51,0 @@ const { code, path } = !ext || ext == 'html' ? await callback(url, _) : { path: url } |
@@ -205,3 +205,3 @@ | ||
test('index.html', async() => { | ||
write('index.html', '<test/>') | ||
await write('index.html', '<test/>') | ||
const kit = await getKit() | ||
@@ -216,3 +216,3 @@ await kit.gen('index.html') | ||
test('index.md', async() => { | ||
write('index.md', '# Hey') | ||
await write('index.md', '# Hey') | ||
const kit = await getKit() | ||
@@ -229,4 +229,4 @@ await kit.gen('index.md') | ||
test('bundle', async() => { | ||
write('a.ts', 'export const foo = 30') | ||
write('b.ts', 'import { foo } from "./a.js"; const bar = 10 + foo') | ||
await write('a.ts', 'export const foo = 30') | ||
await write('b.ts', 'import { foo } from "./a.js"; const bar = 10 + foo') | ||
@@ -245,3 +245,3 @@ // bun bundle | ||
const code = 'konst foo = 1' | ||
write('a.js', code) | ||
await write('a.js', code) | ||
const opts = { path: `./${root}/a.js`, outdir: root, silent: true } | ||
@@ -248,0 +248,0 @@ |
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
73502
1717
1
Updatedmarked@^9.1.6