Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuekit

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuekit - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

2

package.json
{
"name": "nuekit",
"version": "0.4.1",
"version": "0.4.2",
"description": "The closer-to-standards web framework. Build sites and apps with less effort.",

@@ -5,0 +5,0 @@ "homepage": "https://nuejs.org",

@@ -87,3 +87,5 @@ #!/usr/bin/env bun

async function printVersion() {
log(`Nue ${await getVersion()} ${colors.green('•')} ${getEngine()}`)
const v = await getVersion()
log(`Nue ${v} ${colors.green('•')} ${getEngine()}`)
return v
}

@@ -93,6 +95,7 @@

const { createKit } = await import('./nuekit.js')
const nue = await createKit(args)
console.info('')
await printVersion()
args.nuekit_version = await printVersion()
const nue = await createKit(args)
// build

@@ -99,0 +102,0 @@ const { cmd='serve' } = args

@@ -5,2 +5,3 @@

import { promises as fs } from 'node:fs'
import { resolve } from 'import-meta-resolve'
import { buildJS } from './builder.js'

@@ -95,3 +96,5 @@ import { colors } from './util.js'

const [ npm_name, ...parts ] = npm_path.split('/')
const main = await import.meta.resolve(npm_name)
let main = await resolve(npm_name, `file://${process.cwd()}/`)
main = main.replace(/^file:\/\//, '')
main = process.platform === 'win32' && main.startsWith('/') ? main.slice(1) : main
return main.replace('index.js', parts.join('/'))

@@ -98,0 +101,0 @@ }

@@ -6,4 +6,4 @@ import { extname } from 'node:path'

const {
generator = `Nue v${data.nuekit_version} (nuejs.org)`,
viewport = 'width=device-width,initial-scale=1',
generator = 'Nue (nuejs.org)',
charset = 'utf-8',

@@ -29,7 +29,4 @@ title_template = '%s',

if (is_prod) {
pushMeta('generator', generator)
pushMeta('date.updated', new Date().toISOString())
}
pushMeta('generator', generator)
pushMeta('date.updated', new Date().toISOString())
pushMeta('viewport', viewport)

@@ -60,3 +57,3 @@ pushMeta('description', data.description)

// misc
if (favicon) head.push(`<link rel="shortcut icon" type="${TYPES[extname(favicon).slice(1)]}" src="${favicon}">`)
if (favicon) head.push(`<link rel="icon" type="${TYPES[extname(favicon).slice(1)]}" href="${favicon}">`)

@@ -63,0 +60,0 @@ // inline style

@@ -70,5 +70,5 @@

const CLOUDFLARE_SERVERSIDE_DIRS = [ `functions` ]
const IGNORE = ['node_modules', 'package.json', 'bun.lockb', 'pnpm-lock.yaml', ... CLOUDFLARE_SERVERSIDE_DIRS]
const IGNORE = ['node_modules', 'package.json', 'bun.lockb', 'pnpm-lock.yaml']
function ignore(name='') {

@@ -75,0 +75,0 @@ return '._'.includes(name[0]) || IGNORE.includes(name)

@@ -18,3 +18,3 @@

const { root, is_prod, env } = args
const { root, is_prod, env, nuekit_version } = args
const { is_bulk = args.cmd == 'build' } = args

@@ -153,3 +153,3 @@ const cache = {}

self.getData = async function (pagedir) {
const data = { ...site_data }
const data = { nuekit_version, ...site_data }
for (const dir of getDirs(pagedir)) {

@@ -185,3 +185,6 @@ Object.assign(data, await readData(`${dir}/app.yaml`))

arr.sort((a, b) => b.pubDate - a.pubDate)
arr.sort((a, b) => {
const [d1, d2] = [a, b].map(v => v.pubDate || Infinity)
return d2 - d1
})
if (is_bulk) cache[key] = arr

@@ -188,0 +191,0 @@ return arr

@@ -17,7 +17,7 @@

// setup and teardown
beforeAll(async () => {
beforeEach(async () => {
await fs.rm(root, { recursive: true, force: true })
await fs.mkdir(root, { recursive: true })
})
afterAll(async () => await fs.rm(root, { recursive: true, force: true }))
afterEach(async () => await fs.rm(root, { recursive: true, force: true }))

@@ -124,17 +124,28 @@ // helper function for creating files to the root directory

test('content collection', async () => {
// Default sorting is on pubDate returning most recent first.
await write('blog/first-a.md', createFront('First'))
// This test proves
// ----------------
// 1. Default sorting is on pubDate returning most recent first.
// 2. Collection returns parent folders, then child folders.
// 3. Posts with null dates, e.g. First, come before posts with dates.
await write('blog/first-a.md', '# First')
await write('blog/first-b.md', createFront('Second', '2020-01-04'))
await write('blog/nested/hey1.md', createFront('Third', '2020-01-02'))
await write('blog/nested/hey2.md', createFront('Fourth', '2020-01-03'))
// 4. Cloudflare `functions` directory is excluded
await write('blog/functions/contact-us.md', "my secret notes")
// 5. System files starting with '_' or '.' are excluded.
await write('blog/.item6.md', createFront('Sixth', '2020-01-03'))
await write('blog/_item7.md', createFront('Seventh', '2020-01-03'))
const site = await getSite()
const coll = await site.getContentCollection('blog')
const actual = coll.map(c => { return { url: c.url, title: c.title, dir: c.dir, slug: c.slug }; });
// expected order is : First, Second, Fourth, Third.
const actual = coll.map(c => {
return { pubDate: c.pubDate, url: c.url, title: c.title, dir: c.dir, slug: c.slug }
})
// expected order is : First, Second, Fourth, Third
expect(actual).toEqual([
{ url: '/blog/first-a.html', title: 'First', dir: 'blog', slug: 'first-a.html' },
{ url: '/blog/first-b.html', title: 'Second', dir: 'blog', slug: 'first-b.html' },
{ url: '/blog/nested/hey2.html', title: 'Fourth', dir: join('blog', 'nested'), slug: 'hey2.html' },
{ url: '/blog/nested/hey1.html', title: 'Third', dir: join('blog', 'nested'), slug: 'hey1.html' },
{ pubDate: undefined, url: '/blog/first-a.html', title: 'First', dir: 'blog', slug: 'first-a.html' },
{ pubDate: new Date('2020-01-04'), url: '/blog/first-b.html', title: 'Second', dir: 'blog', slug: 'first-b.html' },
{ pubDate: new Date('2020-01-03'), url: '/blog/nested/hey2.html', title: 'Fourth', dir: join('blog', 'nested'), slug: 'hey2.html' },
{ pubDate: new Date('2020-01-02'), url: '/blog/nested/hey1.html', title: 'Third', dir: join('blog', 'nested'), slug: 'hey1.html' },
])

@@ -141,0 +152,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc