Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,30 @@ jobs:
- name: Lint
run: yarn lint

typecheck:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [16]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install dependencies
run: yarn --immutable

- name: Stub
run: yarn stub

- name: Typecheck
run: yarn typecheck

test-fixtures:
runs-on: ${{ matrix.os }}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"lint": "eslint --ext .vue,.ts,.js,.mjs .",
"lint:docs": "markdownlint ./docs/content && case-police 'docs/content**/*.md'",
"lint:docs:fix": "markdownlint ./docs/content --fix && case-police 'docs/content**/*.md' --fix",
"typecheck": "tsc --noEmit",
"nuxi": "NUXT_TELEMETRY_DISABLED=1 node ./packages/nuxi/bin/nuxi.mjs",
"nuxt": "NUXT_TELEMETRY_DISABLED=1 node ./packages/nuxi/bin/nuxi.mjs",
"play": "echo use yarn dev && exit 1",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxi/src/commands/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ export default defineNuxtCommand({

await listen(app)

return 'wait'
return 'wait' as const
}
})
2 changes: 1 addition & 1 deletion packages/nuxi/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ export default defineNuxtCommand({

await load(false)

return 'wait'
return 'wait' as const
}
})
2 changes: 1 addition & 1 deletion packages/nuxi/src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineNuxtCommand({
})

if (args.watch) {
return 'wait'
return 'wait' as const
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/src/app/composables/asyncData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch } from 'vue'
import { onBeforeMount, onServerPrefetch, onUnmounted, ref, getCurrentInstance, watch, unref } from 'vue'
import type { Ref, WatchSource } from 'vue'
import { wrapInRef } from './utils'
import { NuxtApp, useNuxtApp } from '#app'
Expand Down Expand Up @@ -116,7 +116,7 @@ export function useAsyncData<
})
.catch((error: any) => {
asyncData.error.value = error
asyncData.data.value = options.default()
asyncData.data.value = unref(options.default())
})
.finally(() => {
asyncData.pending.value = false
Expand Down
2 changes: 2 additions & 0 deletions packages/nuxt/src/app/entry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// We set __webpack_public_path via this import with webpack builder
import { createSSRApp, createApp, nextTick } from 'vue'
import { $fetch } from 'ohmyfetch'
// @ts-ignore
import { baseURL } from '#build/paths.mjs'
import { createNuxtApp, applyPlugins, normalizePlugins, CreateOptions } from '#app'
import '#build/css'
Expand All @@ -12,6 +13,7 @@ import RootComponent from '#build/root-component.mjs'
import AppComponent from '#build/app-component.mjs'

if (!globalThis.$fetch) {
// @ts-ignore
globalThis.$fetch = $fetch.create({
baseURL: baseURL()
})
Expand Down
1 change: 1 addition & 0 deletions packages/nuxt/src/core/runtime/nitro/paths.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { joinURL } from 'ufo'
// @ts-ignore
import { useRuntimeConfig } from '#internal/nitro'

export function baseURL (): string {
Expand Down
5 changes: 5 additions & 0 deletions packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createRenderer } from 'vue-bundle-renderer'
import { eventHandler, useQuery } from 'h3'
import devalue from '@nuxt/devalue'
// @ts-ignore
import { useRuntimeConfig } from '#internal/nitro'
// @ts-ignore
import { buildAssetsURL } from '#paths'
// @ts-ignore
import htmlTemplate from '#build/views/document.template.mjs'
Expand All @@ -10,7 +12,9 @@ const STATIC_ASSETS_BASE = process.env.NUXT_STATIC_BASE + '/' + process.env.NUXT
const NUXT_NO_SSR = process.env.NUXT_NO_SSR
const PAYLOAD_JS = '/payload.js'

// @ts-ignore
const getClientManifest = cachedImport(() => import('#build/dist/server/client.manifest.mjs'))
// @ts-ignore
const getSSRApp = !process.env.NUXT_NO_SSR && cachedImport(() => import('#build/dist/server/server.mjs'))

const getSSRRenderer = cachedResult(async () => {
Expand All @@ -21,6 +25,7 @@ const getSSRRenderer = cachedResult(async () => {
const createSSRApp = await getSSRApp()
if (!createSSRApp) { throw new Error('Server bundle is not available') }
// Create renderer
// @ts-ignore
const { renderToString } = await import('#vue-renderer') // Alias to vue2.ts or vue3.ts
return createRenderer((createSSRApp), { clientManifest, renderToString, publicPath: buildAssetsURL() }).renderToString
})
Expand Down
2 changes: 2 additions & 0 deletions packages/nuxt/src/head/runtime/lib/vue-meta.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { MetaObject } from '..'
import { defineNuxtPlugin } from '#app'

export default defineNuxtPlugin((nuxtApp) => {
// @ts-expect-error missing resolver
const manager = createMetaManager(process.server)

nuxtApp.vueApp.use(manager)
Expand All @@ -20,6 +21,7 @@ export default defineNuxtPlugin((nuxtApp) => {

if (process.server) {
nuxtApp.ssrContext.renderMeta = async () => {
// @ts-ignore
const { renderMetaToString } = await import('vue-meta/ssr')
nuxtApp.ssrContext.teleports = nuxtApp.ssrContext.teleports || {}

Expand Down
1 change: 0 additions & 1 deletion packages/webpack/src/utils/index.ts

This file was deleted.

11 changes: 9 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@
],
"#app/*": [
"./packages/nuxt/src/app/*"
]
],
"#head": [
"./packages/nuxt/src/head/runtime/index"
],
}
},
"exclude": [
"**/*/dist/*",
"**/.nuxt/**",
"**/nuxt.d.ts"
"**/nuxt.d.ts",
"**/examples/**",
"**/docs/**",
"**/playground/**",
"**/test/fixtures/**"
]
}
31 changes: 1 addition & 30 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13913,36 +13913,7 @@ __metadata:
languageName: node
linkType: hard

"vite@npm:^2.9.5":
version: 2.9.5
resolution: "vite@npm:2.9.5"
dependencies:
esbuild: ^0.14.27
fsevents: ~2.3.2
postcss: ^8.4.12
resolve: ^1.22.0
rollup: ^2.59.0
peerDependencies:
less: "*"
sass: "*"
stylus: "*"
dependenciesMeta:
fsevents:
optional: true
peerDependenciesMeta:
less:
optional: true
sass:
optional: true
stylus:
optional: true
bin:
vite: bin/vite.js
checksum: 354189cbce6904a3b58ca70b7ad9e1bb751ded9c13e483165562e634804cfb29bbf1507a4e6334cb9987e3f1f41e9f50764878a3c837523762e9da65229c9543
languageName: node
linkType: hard

"vite@npm:^2.9.6":
"vite@npm:^2.9.5, vite@npm:^2.9.6":
version: 2.9.6
resolution: "vite@npm:2.9.6"
dependencies:
Expand Down