-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: vue and nuxt support + fixed exported files (#17)
- Loading branch information
Showing
39 changed files
with
12,321 additions
and
6,043 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.next/ | ||
dist/ | ||
.github/ | ||
.github/ | ||
.nuxt/ | ||
.svelte-kit/ | ||
.vercel/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export default function Blog() { | ||
return <div>My blog page</div>; | ||
export default function Blog({ | ||
params: { slug }, | ||
}: { | ||
params: { slug: string }; | ||
}) { | ||
return <div>My blog page {slug}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
import Link from 'next/link'; | ||
|
||
export default function Page() { | ||
return <div>Testing speed insights</div>; | ||
return ( | ||
<> | ||
<div>Testing speed insights</div> | ||
<ul> | ||
<li> | ||
<Link href="/blog-pages/page-a">Pages directory A</Link> | ||
</li> | ||
<li> | ||
<Link href="/blog-pages/page-b">Pages directory B</Link> | ||
</li> | ||
<li> | ||
<Link href="/blog">App directory</Link> | ||
</li> | ||
</ul> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Nuxt dev/build outputs | ||
.output | ||
.data | ||
.nuxt | ||
.nitro | ||
.cache | ||
dist | ||
|
||
# Node dependencies | ||
node_modules | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Misc | ||
.DS_Store | ||
.fleet | ||
.idea | ||
|
||
# Local env files | ||
.env | ||
.env.* | ||
!.env.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Nuxt 3 Demo application for Vercel Speed-insights | ||
|
||
## Setup | ||
|
||
This application was created with the following commands: | ||
|
||
- `cd apps` | ||
- `npx nuxi@latest init nuxt` (answers: npm, no git) | ||
- `cd nuxt` | ||
- `rm -rf node_modules .nuxt` | ||
- manually edit package.json to add `"@vercel/speed-insights": "workspace:*"` dependency | ||
- `pnpm i` | ||
|
||
Then we moved some code from vue's official template (styles, HelloWorld SFC) and added a few dynamic route to illustrate the use. | ||
We also imported and used `<SpeedInsights />` component in `layouts/default.vue` file: | ||
|
||
```vue | ||
<script setup> | ||
import { SpeedInsights } from '@vercel/speed-insights/vue'; | ||
</script> | ||
<template> | ||
<SpeedInsights /> | ||
</template> | ||
``` | ||
|
||
## Usage | ||
|
||
Start it with `cd apps/nuxt` + `pnpm dev` and browse to [http://localhost:3000](http://localhost:3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* color palette from <https://github.com/vuejs/theme> */ | ||
:root { | ||
--vt-c-white: #ffffff; | ||
--vt-c-white-soft: #f8f8f8; | ||
--vt-c-white-mute: #f2f2f2; | ||
|
||
--vt-c-black: #181818; | ||
--vt-c-black-soft: #222222; | ||
--vt-c-black-mute: #282828; | ||
|
||
--vt-c-indigo: #2c3e50; | ||
|
||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29); | ||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12); | ||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); | ||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); | ||
|
||
--vt-c-text-light-1: var(--vt-c-indigo); | ||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66); | ||
--vt-c-text-dark-1: var(--vt-c-white); | ||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64); | ||
} | ||
|
||
/* semantic color variables for this project */ | ||
:root { | ||
--color-background: var(--vt-c-white); | ||
--color-background-soft: var(--vt-c-white-soft); | ||
--color-background-mute: var(--vt-c-white-mute); | ||
|
||
--color-border: var(--vt-c-divider-light-2); | ||
--color-border-hover: var(--vt-c-divider-light-1); | ||
|
||
--color-heading: var(--vt-c-text-light-1); | ||
--color-text: var(--vt-c-text-light-1); | ||
|
||
--section-gap: 160px; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--color-background: var(--vt-c-black); | ||
--color-background-soft: var(--vt-c-black-soft); | ||
--color-background-mute: var(--vt-c-black-mute); | ||
|
||
--color-border: var(--vt-c-divider-dark-2); | ||
--color-border-hover: var(--vt-c-divider-dark-1); | ||
|
||
--color-heading: var(--vt-c-text-dark-1); | ||
--color-text: var(--vt-c-text-dark-2); | ||
} | ||
} | ||
|
||
*, | ||
*::before, | ||
*::after { | ||
box-sizing: border-box; | ||
margin: 0; | ||
font-weight: normal; | ||
} | ||
|
||
body { | ||
min-height: 100vh; | ||
color: var(--color-text); | ||
background: var(--color-background); | ||
transition: | ||
color 0.5s, | ||
background-color 0.5s; | ||
line-height: 1.6; | ||
font-family: | ||
Inter, | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
Oxygen, | ||
Ubuntu, | ||
Cantarell, | ||
'Fira Sans', | ||
'Droid Sans', | ||
'Helvetica Neue', | ||
sans-serif; | ||
font-size: 15px; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@import './base.css'; | ||
|
||
#app { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
|
||
font-weight: normal; | ||
} | ||
|
||
a, | ||
.green { | ||
text-decoration: none; | ||
color: hsla(160, 100%, 37%, 1); | ||
transition: 0.4s; | ||
} | ||
|
||
h1 { | ||
font-weight: 500; | ||
font-size: 2.6rem; | ||
position: relative; | ||
top: -10px; | ||
} | ||
|
||
h3 { | ||
font-size: 1.2rem; | ||
} | ||
|
||
.greetings h1, | ||
.greetings h3 { | ||
text-align: center; | ||
} | ||
|
||
@media (hover: hover) { | ||
a:hover { | ||
background-color: hsla(160, 100%, 37%, 0.2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
msg: string; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<div class="greetings"> | ||
<h1 class="green">{{ msg }}</h1> | ||
<h3> | ||
You’ve successfully created a project with | ||
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> + | ||
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>. | ||
What's next? | ||
</h3> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<script setup lang="ts"> | ||
import { SpeedInsights } from '@vercel/speed-insights/nuxt'; | ||
</script> | ||
|
||
<template> | ||
<SpeedInsights /> | ||
<header> | ||
<img | ||
alt="Vue logo" | ||
class="logo" | ||
src="@/assets/logo.svg" | ||
width="125" | ||
height="125" | ||
/> | ||
|
||
<div class="wrapper"> | ||
<nav> | ||
<NuxtLink to="/">Home</NuxtLink> | ||
<NuxtLink to="/blog/various/hi">Hi!</NuxtLink> | ||
<NuxtLink to="/blog/various/hallo">Hallo!</NuxtLink> | ||
</nav> | ||
</div> | ||
</header> | ||
<slot /> | ||
</template> | ||
|
||
<style> | ||
@import url('~/assets/main.css'); | ||
header { | ||
line-height: 1.5; | ||
max-height: 100vh; | ||
} | ||
.logo { | ||
display: block; | ||
margin: 0 auto 2rem; | ||
} | ||
nav { | ||
width: 100%; | ||
font-size: 12px; | ||
text-align: center; | ||
margin: 2rem 0; | ||
} | ||
nav a.router-link-exact-active { | ||
color: var(--color-text); | ||
} | ||
nav a.router-link-exact-active:hover { | ||
background-color: transparent; | ||
} | ||
nav a { | ||
display: inline-block; | ||
padding: 0 1rem; | ||
border-left: 1px solid var(--color-border); | ||
} | ||
nav a:first-of-type { | ||
border: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// https://nuxt.com/docs/api/configuration/nuxt-config | ||
export default defineNuxtConfig({ | ||
devtools: { enabled: true }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "nuxt", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "nuxt build", | ||
"dev": "nuxt dev", | ||
"generate": "nuxt generate", | ||
"postinstall": "nuxt prepare", | ||
"preview": "nuxt preview" | ||
}, | ||
"devDependencies": { | ||
"@nuxt/devtools": "latest", | ||
"@vercel/speed-insights": "workspace:*", | ||
"nuxt": "^3.8.2", | ||
"vue": "^3.3.8", | ||
"vue-router": "^4.2.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script setup lang="ts"> | ||
const route = useRoute(); | ||
</script> | ||
|
||
<template> | ||
<div class="greetings"> | ||
<h1 class="green">{{ route.params.slug }}!</h1> | ||
<h3>Category {{ route.params.category }}</h3> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<HelloWorld msg="You did it!" /> | ||
</div> | ||
</template> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "../.nuxt/tsconfig.server.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
// https://nuxt.com/docs/guide/concepts/typescript | ||
"extends": "./.nuxt/tsconfig.json" | ||
} |
Oops, something went wrong.
0496c9e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
speed-insights-remix – ./apps/remix
speed-insights-remix-git-main-vercel-analytics.vercel.app
speed-insights-remix.vercel.app
speed-insights-remix-vercel-analytics.vercel.app
0496c9e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
speed-insights-sveltekit – ./apps/sveltekit
speed-insights-sveltekit.vercel.app
speed-insights-sveltekit-vercel-analytics.vercel.app
speed-insights-sveltekit-git-main-vercel-analytics.vercel.app