Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
0b653bc
refactor: allow wraping route component into `ClientOnly`
logotip4ik Jan 3, 2024
e3d63de
test: add tests for client only page
logotip4ik Jan 3, 2024
a0e28b9
chore: add `clientOnly` option to `PageMeta` interface
logotip4ik Jan 3, 2024
821a9c8
docs: mention `clientOnly` in definePageMeta
logotip4ik Jan 3, 2024
44e0750
fix ? wrap transition into client only
logotip4ik Jan 3, 2024
2a62ce0
test: type errors array and push only error text
logotip4ik Jan 3, 2024
4a568f8
Update docs/2.guide/2.directory-structure/1.pages.md
logotip4ik Jan 4, 2024
6f69fbc
Update packages/nuxt/src/pages/runtime/composables.ts
logotip4ik Jan 4, 2024
16e2761
Revert "fix ? wrap transition into client only"
logotip4ik Jan 4, 2024
39eb07f
wip rexport page component wrapped in createClientOnly
logotip4ik Jan 4, 2024
7221021
Merge branch 'main' into feat/client-only-page
logotip4ik Jan 14, 2024
d4c58fa
Merge branch 'main' into feat/client-only-page
logotip4ik Jan 18, 2024
b15125a
Reapply "fix ? wrap transition into client only"
logotip4ik Jan 19, 2024
ff16d81
is it really that broken ?
logotip4ik Jan 19, 2024
93bf622
Merge branch 'main' into feat/client-only-page
logotip4ik Jan 19, 2024
eaba14f
chore: invert if check
logotip4ik Jan 19, 2024
51167ff
refactor: reexport page component
logotip4ik Jan 20, 2024
8488b56
fix: export undefined if page source is empty
logotip4ik Jan 20, 2024
ba79c79
fix: only retest for client only page if not seen one yet
logotip4ik Jan 20, 2024
17caed5
fix: check macro page imports for definePageMeta macro
logotip4ik Jan 20, 2024
03703c4
refactor: remove not needed query for page component import
logotip4ik Jan 20, 2024
f8f5d9e
test: add little delay to account for vue transition
logotip4ik Jan 20, 2024
48a37cf
Merge branch 'main' into feat/client-only-page
logotip4ik Jan 20, 2024
0625b61
chore: pretend we are import from a file
logotip4ik Jan 20, 2024
f1598b1
chore: stub page wrapper file
logotip4ik Jan 20, 2024
a2fcafd
test: bump a bit delay
logotip4ik Jan 20, 2024
d462b0c
fix: actually add page wrapper stub file only for webpack
logotip4ik Jan 20, 2024
ef82a21
Merge remote-tracking branch 'origin/main' into feat/client-only-page
danielroe Jan 29, 2024
bcb046f
test: rename index client only page to index.client
logotip4ik Feb 1, 2024
7aff470
test: remove not needed `definePageMeta` call
logotip4ik Feb 1, 2024
994831b
refactor: add mode to page meta type
logotip4ik Feb 1, 2024
a273877
refactor: strip `client` extension from page segment and apply client…
logotip4ik Feb 1, 2024
6ae06e1
refactor: pass nuxt pages to page wrapper plugin to check for client …
logotip4ik Feb 1, 2024
5fc8063
refactor: use route meta to check if client mode is enabled
logotip4ik Feb 1, 2024
dd52fec
refactor: more consistent plugin naming
logotip4ik Feb 1, 2024
b9b648e
Merge branch 'main' of github.com:logotip4ik/nuxt into feat/client-on…
logotip4ik Feb 1, 2024
ad9797e
refactor: try to reexport page wrapped in createClienOnly
logotip4ik Feb 3, 2024
70409eb
chore: Remove not used plugin
logotip4ik Feb 3, 2024
ad55085
chore: less diff
logotip4ik Feb 3, 2024
c610822
chore: even less diff
logotip4ik Feb 3, 2024
4fadacf
chore: allow all page modes beeing the query value
logotip4ik Feb 3, 2024
d1417f5
Merge branch 'main' into feat/client-only-page
logotip4ik Feb 21, 2024
e831dca
Merge branch 'main' of github.com:logotip4ik/nuxt into feat/client-on…
logotip4ik Mar 1, 2024
f778228
fix: finally it works
logotip4ik Mar 1, 2024
087e038
chore: remove not used plugin
logotip4ik Mar 1, 2024
a3e7ef2
chore: cleanup type
logotip4ik Mar 1, 2024
3834257
chore: cleanup imports
logotip4ik Mar 1, 2024
68feb8b
chore: better description wording
logotip4ik Mar 1, 2024
3cefe8f
chore: run lint
logotip4ik Mar 1, 2024
5738bfe
chore: add no side effects to createClientPage
logotip4ik Mar 1, 2024
8e6ecd8
docs: add client only section in pages
logotip4ik Mar 1, 2024
da85070
docs: cleanup meta section
logotip4ik Mar 1, 2024
899ff0f
fix: allow passing down page props
logotip4ik Mar 2, 2024
6d240ce
chore: revert server replacement control flow changes
logotip4ik Mar 2, 2024
6f2620a
chore: use else-if to prevent double check
logotip4ik Mar 2, 2024
1a28d8d
Merge remote-tracking branch 'origin/main' into feat/client-only-page
danielroe Mar 6, 2024
86de839
style: lint
danielroe Mar 6, 2024
66fa33f
docs: add additional line
danielroe Mar 6, 2024
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
Prev Previous commit
Next Next commit
Merge branch 'main' of github.com:logotip4ik/nuxt into feat/client-on…
…ly-page
  • Loading branch information
logotip4ik committed Mar 1, 2024
commit e831dca86fa4652d0ce20911e28a62dbfdf5c32d
16 changes: 13 additions & 3 deletions packages/nuxt/src/pages/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type { NuxtPage } from 'nuxt/schema'
import { uniqueBy } from '../core/utils'
import { toArray } from '../utils'
import { pageWrappersQueryKey } from './plugins/page-wrappers'
import { distDir } from '../dirs'

enum SegmentParserState {
initial,
Expand Down Expand Up @@ -460,9 +461,18 @@ export function normalizeRoutes (routes: NuxtPage[], metaImports: Set<string> =
meta: `${metaImportName} || {}`,
alias: `${metaImportName}?.alias || []`,
redirect: `${metaImportName}?.redirect`,
component: genDynamicImport(
page.mode !== undefined ? withQuery(file, { [pageWrappersQueryKey]: page.mode }) : file
, { interopDefault: true })
component: page.mode === 'server'
? `() => createIslandPage(${route.name})`
: genDynamicImport(file, { interopDefault: true })
}

if (page.mode === 'server') {
metaImports.add(`
let _createIslandPage
async function createIslandPage (name) {
_createIslandPage ||= await import(${JSON.stringify(resolve(distDir, 'components/runtime/server-component'))}).then(r => r.createIslandPage)
return _createIslandPage(name)
};`)
}

if (route.children != null) {
Expand Down
13 changes: 12 additions & 1 deletion packages/schema/src/types/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type TSReference = { types: string } | { path: string }
export type WatchEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'

// If the user does not have `@vue/language-core` installed, VueCompilerOptions will be typed as `any`,
// thus making the whole `VueTSConfig` type `any`. We only augment TSConfig if VueCompilerOptions is available.
// thus making the whole `VueTSConfig` type `any`. We only augment TSConfig if VueCompilerOptions is available.
export type VueTSConfig = 0 extends 1 & VueCompilerOptions ? TSConfig : TSConfig & { vueCompilerOptions?: VueCompilerOptions }

export type NuxtPage = {
Expand All @@ -33,6 +33,17 @@ export type NuxtPage = {
alias?: string[] | string
redirect?: RouteLocationRaw
children?: NuxtPage[]
/**
* Set the render mode.
*
* `all` means the page will be rendered isomorphically - with JavaScript both on client and server.
*
* `server` means pages are automatically rendered with server components, so there will be no JavaScript to render the page in your client bundle.
*
* `client` means that page will render only on the client side.
*
* @default 'all'
*/
mode?: 'client' | 'server' | 'all'
}

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.