Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit ee4c356

Browse files
committed
Merge branch 'main' of github.com:nuxt/learn.nuxt.com
2 parents b8fc224 + 7c7a68f commit ee4c356

File tree

15 files changed

+604
-1235
lines changed

15 files changed

+604
-1235
lines changed

components/ContentNavItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import type { NavItem } from '@nuxt/content/dist/runtime/types'
2+
import type { NavItem } from '@nuxt/content'
33
44
const props = withDefaults(
55
defineProps<{

components/MainPlayground.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ const panelInitTerminal = computed(() => isMounted.value || {
9595
</Pane>
9696
<PaneSplitter />
9797
<Pane
98-
v-bind="terminalPaneProps" :style="panelInitTerminal"
98+
v-bind="terminalPaneProps"
99+
:style="panelInitTerminal"
99100
:class="ui.showTerminal ? '' : 'pane-hidden'"
100101
>
101102
<PanelTerminal />

components/PanelDocs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import type { NavItem, ParsedContent } from '@nuxt/content/dist/runtime/types'
2+
import type { NavItem, ParsedContent } from '@nuxt/content'
33
44
const {
55
navigation,

content/2.concepts/8.rendering-modes/index.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
ogImage: true
33
---
44

5-
# レンダリングモード
65

7-
<!-- TODO:
8-
- Universal Rendering (as default)
9-
- Client-side Rendering
10-
- Hybrid Rendering
11-
- Edge-Side Rendering?
12-
-->
6+
# レンダリングモード
137

148
Nuxt は様々なレンダリングモードをサポートしています。\
159
具体的には、ユニバーサルレンダリング、クライアントサイドレンダリング、ハイブリッドレンダリングがあります。

modules/template-loader.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,15 @@ export default defineNuxtModule({
8181
getFileMap(resolve(id, '../solutions')),
8282
])
8383

84-
return [
85-
code,
86-
`meta.files = ${JSON.stringify(files)}`,
87-
`meta.solutions = ${JSON.stringify(solutions)}`,
88-
'',
89-
].join('\n')
84+
return {
85+
code: [
86+
code,
87+
`meta.files = ${JSON.stringify(files)}`,
88+
`meta.solutions = ${JSON.stringify(solutions)}`,
89+
'',
90+
].join('\n'),
91+
map: null,
92+
}
9093
},
9194
})
9295
},

monaco/env.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,24 @@ export async function reloadLanguageTools(ctx: PlaygroundMonacoContext) {
131131
.map(file => Uri.parse(`file:///${file.filepath}`)),
132132
...extraFiles,
133133
]
134-
const { dispose: disposeMarkers } = volar.editor.activateMarkers(
134+
const { dispose: disposeMarkers } = volar.activateMarkers(
135135
worker,
136136
languageId,
137137
'vue',
138138
getSyncUris,
139-
editor,
139+
editor as typeof import('monaco-editor').editor,
140140
)
141-
const { dispose: disposeAutoInsertion } = volar.editor.activateAutoInsertion(
141+
const { dispose: disposeAutoInsertion } = volar.activateAutoInsertion(
142142
worker,
143143
languageId,
144144
getSyncUris,
145-
editor,
145+
editor as typeof import('monaco-editor').editor,
146146
)
147-
const { dispose: disposeProvides } = await volar.languages.registerProvides(
147+
const { dispose: disposeProvides } = await volar.registerProviders(
148148
worker,
149149
languageId,
150150
getSyncUris,
151-
languages,
151+
languages as unknown as typeof import('monaco-editor').languages,
152152
)
153153

154154
disposeVue = () => {

monaco/setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import vueWorker from './vue.worker?worker'
1010
import { reloadLanguageTools } from './env'
1111

1212
export function initMonaco(ctx: PlaygroundStore) {
13-
// @ts-expect-error MonacoEnvironment is a global variable injected for monaco
1413
self.MonacoEnvironment = {
1514
async getWorker(_: any, label: string) {
1615
switch (label) {

monaco/vue.worker.ts

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
import * as worker from 'monaco-editor-core/esm/vs/editor/editor.worker'
33
import type * as monaco from 'monaco-editor-core'
44
import * as ts from 'typescript/lib/tsserverlibrary'
5-
import type { VueCompilerOptions } from '@vue/language-service'
6-
import { resolveConfig } from '@vue/language-service'
7-
import {
8-
createLanguageHost,
9-
createLanguageService,
10-
createServiceEnvironment,
11-
} from '@volar/monaco/worker'
5+
import type { LanguageServiceEnvironment, VueCompilerOptions } from '@vue/language-service'
6+
import { createVueLanguagePlugin, getFullLanguageServicePlugins, resolveVueCompilerOptions } from '@vue/language-service'
7+
import { createTypeScriptWorkerService } from '@volar/monaco/worker'
8+
import { URI } from 'vscode-uri'
129
import type { WorkerHost } from './env'
1310

1411
export interface CreateData {
@@ -36,51 +33,70 @@ self.onmessage = () => {
3633
ctx: monaco.worker.IWorkerContext<WorkerHost>,
3734
{ tsconfig }: CreateData,
3835
) => {
36+
const asFileName = (uri: URI) => uri.path
37+
const asUri = (fileName: string): URI => URI.file(fileName)
38+
const env: LanguageServiceEnvironment = {
39+
workspaceFolders: [URI.file('/')],
40+
}
3941
const { options: compilerOptions } = ts.convertCompilerOptionsFromJson(
4042
tsconfig.compilerOptions || {},
4143
'',
4244
)
45+
const vueCompilerOptions = resolveVueCompilerOptions(
46+
tsconfig.vueCompilerOptions || {},
47+
)
4348

4449
// eslint-disable-next-line no-console
4550
console.log('Vue Language Services: compilerOptions', compilerOptions)
4651

47-
const env = createServiceEnvironment()
48-
const host = createLanguageHost(
49-
ctx.getMirrorModels,
50-
env,
51-
'/',
52-
compilerOptions,
53-
)
54-
5552
env.fs = {
5653
async readFile(uri) {
57-
if (isInvalidPath(uri))
54+
if (isInvalidPath(uri.path))
5855
return undefined
59-
const file = await ctx.host.fsReadFile(uri)
56+
const file = await ctx.host.fsReadFile(uri.toString())
6057
return file
6158
},
6259
async stat(uri) {
63-
if (isInvalidPath(uri))
60+
if (isInvalidPath(uri.path))
6461
return undefined
65-
const result = await ctx.host.fsStat(uri)
62+
const result = await ctx.host.fsStat(uri.toString())
6663
return result
6764
},
6865
async readDirectory(uri) {
69-
const dirs = await ctx.host.fsReadDirectory(uri)
66+
const dirs = await ctx.host.fsReadDirectory(uri.toString())
7067
return dirs
7168
},
7269
}
7370

74-
return createLanguageService(
75-
{ typescript: ts },
71+
return createTypeScriptWorkerService({
72+
typescript: ts,
7673
env,
77-
resolveConfig(
74+
compilerOptions,
75+
uriConverter: {
76+
asFileName,
77+
asUri,
78+
},
79+
workerContext: ctx,
80+
languagePlugins: [createVueLanguagePlugin(
7881
ts,
79-
{},
82+
asFileName,
83+
() => '', // TODO getProjectVersion
84+
(fileName) => {
85+
const uri = asUri(fileName)
86+
for (const model of ctx.getMirrorModels()) {
87+
if (model.uri.toString() === uri.toString()) {
88+
return true
89+
}
90+
}
91+
return false
92+
},
8093
compilerOptions,
81-
tsconfig?.vueCompilerOptions || {},
82-
),
83-
host,
84-
)
94+
vueCompilerOptions,
95+
)],
96+
languageServicePlugins: getFullLanguageServicePlugins(ts),
97+
setup({ project }) {
98+
project.vue = { compilerOptions: vueCompilerOptions }
99+
},
100+
})
85101
})
86102
}

nuxt.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ export default defineNuxtConfig({
66
'@vueuse/nuxt',
77
'@unocss/nuxt',
88
'@nuxt/content',
9+
'@nuxt/image',
910
'@nuxtjs/color-mode',
1011
'@pinia/nuxt',
1112
'floating-vue/nuxt',
1213
'@nuxtjs/seo',
13-
'nuxt-icon',
14+
'@nuxt/icon',
1415
'@nuxt/eslint',
1516
// local
1617
'~/modules/template-loader',
@@ -108,6 +109,7 @@ export default defineNuxtConfig({
108109
'@vue/language-service',
109110
'@volar/monaco/worker',
110111
'typescript',
112+
'vscode-uri',
111113
],
112114
},
113115
},

package.json

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "learn.nuxt.com",
33
"type": "module",
44
"private": true,
5-
"packageManager": "pnpm@9.1.4",
5+
"packageManager": "pnpm@9.4.0",
66
"scripts": {
77
"build": "nuxt build",
88
"dev": "nuxt dev",
@@ -15,58 +15,56 @@
1515
"textlint": "textlint --format pretty-error content/**"
1616
},
1717
"dependencies": {
18-
"@shikijs/core": "^1.5.2",
19-
"@shikijs/monaco": "^1.5.2",
20-
"@volar/monaco": "^1.11.1",
21-
"@vue/language-service": "^1.8.27",
22-
"@webcontainer/api": "^1.1.9",
18+
"@shikijs/core": "^1.10.0",
19+
"@shikijs/monaco": "^1.10.0",
20+
"@volar/monaco": "~2.4.0-alpha.12",
21+
"@vue/language-service": "^2.0.26-alpha.2",
22+
"@webcontainer/api": "^1.2.0",
2323
"@xterm/addon-fit": "^0.10.0",
2424
"@xterm/xterm": "^5.5.0",
2525
"birpc": "^0.2.17",
2626
"floating-vue": "^5.2.2",
2727
"jszip": "^3.10.1",
2828
"monaco-editor": "^0.50.0",
29-
"monaco-editor-textmate": "^4.0.0",
30-
"monaco-textmate": "^3.0.1",
31-
"onigasm": "^2.2.5",
32-
"shiki": "^1.5.2",
29+
"shiki": "^1.10.0",
3330
"splitpanes": "^3.1.5",
3431
"strip-json-comments": "^5.0.1",
3532
"textlint": "^14.0.4",
3633
"textlint-rule-preset-vuejs-jp": "github:vuejs-jp/textlint-rule-preset-vuejs-jp",
3734
"theme-vitesse": "^0.8.0",
38-
"unified": "^11.0.4",
39-
"vue": "^3.4.27",
40-
"vue-router": "^4.3.2"
35+
"unified": "^11.0.5",
36+
"vscode-uri": "^3.0.8",
37+
"vue": "^3.4.31",
38+
"vue-router": "^4.4.0"
4139
},
4240
"devDependencies": {
43-
"@antfu/eslint-config": "^2.18.1",
44-
"@iconify-json/logos": "^1.1.42",
45-
"@iconify/json": "^2.2.211",
46-
"@nuxt/content": "2.12.1",
47-
"@nuxt/devtools": "^1.3.1",
41+
"@antfu/eslint-config": "^2.21.2",
42+
"@iconify-json/logos": "^1.1.43",
43+
"@iconify/json": "^2.2.224",
44+
"@nuxt/content": "^2.13.0",
45+
"@nuxt/devtools": "^1.3.8",
4846
"@nuxt/eslint": "^0.3.13",
47+
"@nuxt/icon": "^1.0.0",
4948
"@nuxt/image": "^1.7.0",
50-
"@nuxt/kit": "^3.11.2",
51-
"@nuxtjs/color-mode": "^3.4.1",
49+
"@nuxt/kit": "^3.12.2",
50+
"@nuxtjs/color-mode": "^3.4.2",
5251
"@nuxtjs/seo": "2.0.0-rc.10",
5352
"@pinia/nuxt": "^0.5.1",
54-
"@unocss/eslint-plugin": "^0.60.2",
55-
"@unocss/extractor-mdc": "^0.60.2",
56-
"@unocss/nuxt": "^0.60.2",
57-
"@vueuse/nuxt": "^10.9.0",
58-
"eslint": "^9.3.0",
59-
"eslint-plugin-format": "^0.1.1",
60-
"execa": "^9.1.0",
53+
"@unocss/eslint-plugin": "^0.61.0",
54+
"@unocss/extractor-mdc": "^0.61.0",
55+
"@unocss/nuxt": "^0.61.0",
56+
"@vueuse/nuxt": "^10.11.0",
57+
"eslint": "^9.6.0",
58+
"eslint-plugin-format": "^0.1.2",
59+
"execa": "^9.3.0",
6160
"fast-glob": "^3.3.2",
6261
"fuse.js": "^7.0.0",
63-
"monaco-editor-core": "^0.48.0",
64-
"nuxt": "^3.11.2",
65-
"nuxt-icon": "^0.6.10",
62+
"monaco-editor-core": "^0.50.0",
63+
"nuxt": "^3.12.2",
6664
"pathe": "^1.1.2",
6765
"remark-external-links": "^9.0.1",
68-
"typescript": "^5.4.5",
69-
"vue-tsc": "^2.0.19"
66+
"typescript": "^5.5.3",
67+
"vue-tsc": "^2.0.26-alpha.2"
7068
},
7169
"pnpm": {
7270
"patchedDependencies": {

0 commit comments

Comments
 (0)