Skip to content

Commit

Permalink
Merge branch 'main' into dev-444
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Dec 16, 2024
2 parents d07632b + 9ff2d78 commit 5f6b6fb
Show file tree
Hide file tree
Showing 8 changed files with 2,149 additions and 621 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# Changelog


## v0.8.8

[compare changes](https://github.com/nuxt-hub/core/compare/v0.8.7...v0.8.8)

### 📖 Documentation

- Various improvements ([77c4de4](https://github.com/nuxt-hub/core/commit/77c4de4))
- Free plan is now 3MB ([f03e6ec](https://github.com/nuxt-hub/core/commit/f03e6ec))
- 7k ([21aa978](https://github.com/nuxt-hub/core/commit/21aa978))

### 🏡 Chore

- **playground:** Update compatibility date ([baf7b3b](https://github.com/nuxt-hub/core/commit/baf7b3b))
- **playground:** Add password for invoice ([f45a682](https://github.com/nuxt-hub/core/commit/f45a682))
- Add support for other cf presets ([d589d57](https://github.com/nuxt-hub/core/commit/d589d57))
- Update deps ([84bc2ff](https://github.com/nuxt-hub/core/commit/84bc2ff))

### ❤️ Contributors

- Sébastien Chopin ([@atinux](http://github.com/atinux))

## v0.8.7

[compare changes](https://github.com/nuxt-hub/core/compare/v0.8.6...v0.8.7)
Expand Down
4 changes: 2 additions & 2 deletions docs/content/1.docs/2.features/blob.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ async function onFileSelect(event: Event) {
</script>
<template>
<input type="file" name="file" @change="onFileSelect" multiple accept="jpeg, png" />
<input type="file" name="file" @change="onFileSelect" multiple accept="image/jpeg, image/png" />
</template>
```
::
Expand Down Expand Up @@ -691,7 +691,7 @@ async function onFileSelect({ target }: Event) {
<template>
<input
accept="jpeg, png"
accept="image/jpeg, image/png"
type="file"
name="file"
multiple
Expand Down
3 changes: 2 additions & 1 deletion docs/content/1.docs/3.recipes/5.postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ import type { Hyperdrive } from '@cloudflare/workers-types'
import postgres from 'postgres'

export function usePostgres() {
const hyperdrive = process.env.POSTGRES as Hyperdrive | undefined
// @ts-expect-error globalThis.__env__ is not defined
const hyperdrive = process.env.POSTGRES || globalThis.__env__?.POSTGRES || globalThis.POSTGRES as Hyperdrive | undefined
const dbUrl = hyperdrive?.connectionString || process.env.NUXT_POSTGRES_URL
if (!dbUrl) {
throw createError('Missing `POSTGRES` hyperdrive binding or `NUXT_POSTGRES_URL` env variable')
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nuxthub/core",
"private": false,
"version": "0.8.7",
"version": "0.8.8",
"description": "Build full-stack Nuxt applications on Cloudflare, with zero configuration.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -38,9 +38,9 @@
"test:watch": "vitest watch"
},
"dependencies": {
"@cloudflare/workers-types": "^4.20241112.0",
"@nuxt/devtools-kit": "^1.6.0",
"@nuxt/kit": "^3.14.159",
"@cloudflare/workers-types": "^4.20241205.0",
"@nuxt/devtools-kit": "^1.6.3",
"@nuxt/kit": "^3.14.1592",
"@uploadthing/mime-types": "^0.3.2",
"citty": "^0.1.6",
"confbox": "^0.1.8",
Expand All @@ -56,22 +56,22 @@
"ufo": "^1.5.4",
"uncrypto": "^0.1.3",
"unstorage": "^1.13.1",
"zod": "^3.23.8"
"zod": "^3.24.1"
},
"devDependencies": {
"@nuxt/devtools": "^1.6.0",
"@nuxt/eslint-config": "^0.6.1",
"@nuxt/devtools": "^1.6.3",
"@nuxt/eslint-config": "^0.7.2",
"@nuxt/module-builder": "^0.8.4",
"@nuxt/schema": "^3.14.159",
"@nuxt/test-utils": "^3.14.4",
"@nuxt/schema": "^3.14.1592",
"@nuxt/test-utils": "^3.15.1",
"@nuxthub/core": "link:",
"@types/node": "^22.9.0",
"@types/node": "^22.10.2",
"changelogen": "^0.5.7",
"eslint": "^9.14.0",
"nuxt": "^3.14.159",
"typescript": "^5.6.3",
"vitest": "^2.1.4",
"wrangler": "^3.86.1"
"eslint": "^9.16.0",
"nuxt": "^3.14.1592",
"typescript": "5.6.3",
"vitest": "^2.1.8",
"wrangler": "^3.95.0"
},
"packageManager": "pnpm@9.12.3"
"packageManager": "pnpm@9.15.0"
}
1 change: 0 additions & 1 deletion playground/app/pages/blob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ async function deleteFile(pathname: string) {
<input
ref="uploadRef"
tabindex="-1"
accept="jpeg, png"
type="file"
name="files"
multiple
Expand Down
2,688 changes: 2,090 additions & 598 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,22 @@ export default defineNuxtModule<ModuleOptions>({
// Support also cloudflare_module
preset = String(preset).replace('_', '-')

if (preset !== 'cloudflare-pages' && preset !== 'cloudflare-module') {
log.error('NuxtHub is only compatible with the `cloudflare-pages` and `cloudflare-module` presets.')
if (!['cloudflare-pages', 'cloudflare-module', 'cloudflare-durable'].includes(preset)) {
log.error('NuxtHub is only compatible with the `cloudflare-pages`, `cloudflare-module` or `cloudflare-durable` presets.')
process.exit(1)
}

// @ts-expect-error compatibilityDate is not properly typed
if (preset !== 'cloudflare-pages' && nuxt.options.compatibilityDate?.default && nuxt.options.compatibilityDate.default < '2024-11-20') {
log.warn('Found a compatibility date in `nuxt.config.ts` earlier than `2024-09-19`, forcing it to `2024-09-19`. Please update your `nuxt.config.ts` file.')
// @ts-expect-error compatibilityDate is not properly typed
nuxt.options.compatibilityDate.default = '2024-09-19'
}

// Make sure to always set the output to dist/
nuxt.options.nitro.output ||= {}
nuxt.options.nitro.output.dir = 'dist'

// Update the deploy command displayed in the console
nuxt.options.nitro.commands = nuxt.options.nitro.commands || {}
nuxt.options.nitro.commands.preview = 'npx nuxthub preview'
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/blob/server/utils/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,11 @@ export function ensureBlob(blob: Blob, options: BlobEnsureOptions = {}) {
}
}
const blobShortType = blob.type.split('/')[0]
if (options.types?.length && !options.types.includes(blob.type as BlobType) && !options.types.includes(blobShortType as BlobType)) {
if (options.types?.length
&& !options.types.includes(blob.type as BlobType)
&& !options.types.includes(blobShortType as BlobType)
&& !(options.types.includes('pdf' as BlobType) && blob.type === 'application/pdf')
) {
throw createError({
statusCode: 400,
message: `File type is invalid, must be: ${options.types.join(', ')}`
Expand Down

0 comments on commit 5f6b6fb

Please sign in to comment.