Skip to content

docs(en): merge docs-cn/sync-docs into docs-cn/dev @ 2aba939c #1327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 29, 2025
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
6 changes: 0 additions & 6 deletions .vitepress/theme/styles/landing.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@

html:has(.landing) {
--vp-c-bg: #101010;

background-color: #101010;

body {
background-color: #101010;
}
}

.landing {
overflow-x: hidden;
background-color: #101010;

* {
-webkit-font-smoothing: antialiased !important;
Expand Down
14 changes: 12 additions & 2 deletions guide/api-environment-runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,17 @@ export class ModuleRunner {
**使用示例:**

```js
import { ModuleRunner, ESModulesEvaluator } from 'vite/module-runner'
import {
ModuleRunner,
ESModulesEvaluator,
createNodeImportMeta,
} from 'vite/module-runner'
import { transport } from './rpc-implementation.js'

const moduleRunner = new ModuleRunner(
{
transport,
createImportMeta: createNodeImportMeta, // if the module runner runs in Node.js
},
new ESModulesEvaluator(),
)
Expand Down Expand Up @@ -278,7 +283,11 @@ interface ModuleRunnerTransport {
```js [worker.js]
import { parentPort } from 'node:worker_threads'
import { fileURLToPath } from 'node:url'
import { ESModulesEvaluator, ModuleRunner } from 'vite/module-runner'
import {
ESModulesEvaluator,
ModuleRunner,
createNodeImportMeta,
} from 'vite/module-runner'

/** @type {import('vite/module-runner').ModuleRunnerTransport} */
const transport = {
Expand All @@ -294,6 +303,7 @@ const transport = {
const runner = new ModuleRunner(
{
transport,
createImportMeta: createNodeImportMeta,
},
new ESModulesEvaluator(),
)
Expand Down
15 changes: 15 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Vite
titleTemplate: 下一代的前端工具链
# add `dark` here to apply dark mode on initial load,
# since `onMounted` doesn't run during SSR
pageClass: landing dark

layout: home
Expand All @@ -10,6 +12,9 @@ markdownStyles: false
---

<script setup>
import { useData } from 'vitepress'
import { onBeforeUnmount, onMounted, ref } from 'vue'

import Hero from '.vitepress/theme/components/landing/1. hero-section/HeroSection.vue'
import FeatureSection from './.vitepress/theme/components/landing/2. feature-section/FeatureSection.vue'
import FrameworksSection from './.vitepress/theme/components/landing/3. frameworks-section/FrameworksSection.vue'
Expand All @@ -24,6 +29,16 @@ import FeatureFlexiblePlugins from './.vitepress/theme/components/landing/2. fea
import FeatureTypedAPI from './.vitepress/theme/components/landing/2. feature-section/FeatureTypedAPI.vue'
import FeatureSSRSupport from './.vitepress/theme/components/landing/2. feature-section/FeatureSSRSupport.vue'
import FeatureCI from './.vitepress/theme/components/landing/2. feature-section/FeatureCI.vue'

const { isDark } = useData()

onMounted(() => {
document.documentElement.classList.add('dark')
})

onBeforeUnmount(() => {
document.documentElement.classList.toggle('dark', isDark.value)
})
</script>

<div class="VPHome">
Expand Down