Skip to content

Commit

Permalink
Merge branch 'main' into pr/sheremet-va/18637
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jan 10, 2025
2 parents 19c5019 + e690d8b commit e06731d
Show file tree
Hide file tree
Showing 187 changed files with 3,671 additions and 2,230 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
with:
files: |
docs/**
Expand Down
163 changes: 151 additions & 12 deletions .github/workflows/ecosystem-ci-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'vitejs/vite' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/ecosystem-ci run')
steps:
- uses: actions/github-script@v7
- name: Check User Permissions
uses: actions/github-script@v7
id: check-permissions
with:
script: |
const user = context.payload.sender.login
console.log(`Validate user: ${user}`)
const additionalAllowedUsers = ['lukastaegert']
let hasTriagePermission = false
try {
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
Expand All @@ -27,25 +31,27 @@ jobs:
console.warn(e)
}
if (hasTriagePermission) {
console.log('Allowed')
if (hasTriagePermission || additionalAllowedUsers.includes(user)) {
console.log('User is allowed. Adding +1 reaction.')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
})
} else {
console.log('Not allowed')
console.log('User is not allowed. Adding -1 reaction.')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '-1',
})
throw new Error('not allowed')
throw new Error('User does not have the necessary permissions.')
}
- uses: actions/github-script@v7
- name: Get PR Data
uses: actions/github-script@v7
id: get-pr-data
with:
script: |
Expand All @@ -55,25 +61,158 @@ jobs:
repo: context.repo.repo,
pull_number: context.issue.number
})
core.setOutput('head_sha', pr.head.sha)
return {
num: context.issue.number,
branchName: pr.head.ref,
repo: pr.head.repo.full_name,
commit: pr.head.sha
commit: pr.head.sha,
repo: pr.head.repo.full_name
}
- name: Check Package Existence
uses: actions/github-script@v7
id: check-package
with:
script: |
const prData = ${{ steps.get-pr-data.outputs.result }}
const url = `https://pkg.pr.new/vite@${prData.commit}`
const response = await fetch(url)
console.log(`Package check URL: ${url}, Status: ${response.status}`)
// Add 'rocket' reaction to the issue comment
if (response.status === 404) {
const { data: reaction } = await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'rocket',
})
return { exists: false, reaction: reaction.id }
}
- id: generate-token
return { exists: true, reaction: null }
- name: Generate Token
id: generate-token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_ID }}
installation_retrieval_payload: "${{ github.repository_owner }}/vite-ecosystem-ci"
private_key: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_PRIVATE_KEY }}
- uses: actions/github-script@v7

- name: Trigger Preview Release (if Package Not Found)
if: fromJSON(steps.check-package.outputs.result).exists == false
uses: actions/github-script@v7
id: trigger-preview-release
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
const prData = ${{ steps.get-pr-data.outputs.result }}
console.log('Package not found, triggering preview release...')
// Add label "trigger: preview" to the PR
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prData.num,
labels: ['trigger: preview']
})
console.log('Added "trigger: preview" label.')
- name: Wait for Preview Release Completion (if Package Not Found)
if: fromJSON(steps.check-package.outputs.result).exists == false
uses: actions/github-script@v7
id: wait-preview-release
with:
script: |
const prData = ${{ steps.get-pr-data.outputs.result }}
const reaction = ${{ fromJSON(steps.check-package.outputs.result).reaction }}
const workflowFileName = 'preview-release.yml'
const workflow = await github.rest.actions.getWorkflow({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowFileName,
})
const workflowId = workflow.data.id
console.log(`Waiting for workflow ID ${workflowId} to complete...`)
const maxRetries = 60 // Wait up to 10 minutes
const delay = 10000 // 10 seconds
let completed = false
for (let i = 0; i < maxRetries; i++) {
const runsData = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowId,
head_sha: prData.commit,
per_page: 100,
page: 1,
})
const runs = runsData.data.workflow_runs
if (runs.length > 0) {
const latestRun = runs[0]
console.log(`Latest run status: ${latestRun.status}, conclusion: ${latestRun.conclusion}`)
if (latestRun.status === 'completed') {
if (latestRun.conclusion === 'success') {
console.log('Preview release workflow completed successfully.')
completed = true
break
} else if (latestRun.conclusion === 'skipped') {
// noop
} else {
throw new Error('Preview Release workflow failed.')
}
}
}
console.log(`Retrying... (${i + 1}/${maxRetries})`)
await new Promise(resolve => setTimeout(resolve, delay))
}
if (!completed) {
throw new Error('Preview Release workflow did not complete in time.')
}
// Remove the 'rocket' reaction
if (reaction) {
await github.rest.reactions.deleteForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
reaction_id: reaction,
})
console.log('Removed "rocket" reaction.')
}
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ fromJSON(steps.get-pr-data.outputs.result).num }}/head
fetch-depth: 0

# This step can be removed on May 26 2025
- name: Check Commit Hash Ambiguity
id: check_ambiguity
run: |
HEAD_SHA=${{ steps.get-pr-data.outputs.head_sha }}
COMMIT_SHORT=${HEAD_SHA:0:7}
if git show "$COMMIT_SHORT"; then
echo "COLLISION=false" >> $GITHUB_ENV
else
echo "COLLISION=true" >> $GITHUB_ENV
fi
- name: Trigger Downstream Workflow
uses: actions/github-script@v7
id: trigger
env:
COMMENT: ${{ github.event.comment.body }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
result-encoding: string
script: |
const comment = process.env.COMMENT.trim()
const prData = ${{ steps.get-pr-data.outputs.result }}
Expand All @@ -89,7 +228,7 @@ jobs:
prNumber: '' + prData.num,
branchName: prData.branchName,
repo: prData.repo,
commit: prData.commit,
commit: process.env.COLLISION === 'false' ? prData.commit : '',
suite: suite === '' ? '-' : suite
}
})
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ playground/html/valid.html
playground/external/public/[email protected]
playground/ssr-html/public/[email protected]
playground/worker/classic-worker.js
playground/css/weapp.wxss
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ You may wish to test your locally modified copy of Vite against another package
```json
{
"dependencies": {
"vite": "^5.0.0"
"vite": "^6.0.0"
},
"pnpm": {
"overrides": {
Expand Down
4 changes: 2 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export default defineConfig({
link: '/guide/api-environment',
},
{
text: 'Environment instances',
text: 'Environment Instances',
link: '/guide/api-environment-instances',
},
{
Expand Down Expand Up @@ -442,7 +442,7 @@ export default defineConfig({
transformPageData(pageData) {
const canonicalUrl = `${ogUrl}/${pageData.relativePath}`
.replace(/\/index\.md$/, '/')
.replace(/\.md$/, '/')
.replace(/\.md$/, '')
pageData.frontmatter.head ??= []
pageData.frontmatter.head.unshift(
['link', { rel: 'canonical', href: canonicalUrl }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ const isChromiumBrowser = ref(false)
onMounted(() => {
isChromiumBrowser.value = 'chrome' in window
})
// Check for uwu query
const isUwu = ref(false)
onMounted(() => {
isUwu.value = location.search.includes('?uwu')
})
</script>

<template>
Expand All @@ -463,7 +469,12 @@ onMounted(() => {
></div>
</div>
<div class="vite-chip__filter" />
<img src="/logo.svg" alt="Vite Logo" class="vite-chip__logo" />
<img
:src="isUwu ? '/logo-uwu.png' : '/logo.svg'"
:alt="isUwu ? 'Vite Kawaii Logo by @icarusgkx' : 'Vite Logo'"
class="vite-chip__logo"
:class="{ uwu: isUwu }"
/>
</div>
</div>

Expand Down Expand Up @@ -638,6 +649,10 @@ onMounted(() => {
z-index: 3;
}
.uwu.vite-chip__logo {
width: 134px;
}
&.active {
box-shadow: 0 30px 35px -10px rgba(0, 0, 0, 0.6);
transform: translate3d(0, 0, 0) scale(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import logoLaravel from './images/laravel.svg'
import logoAdonis from './images/adonis.svg'
import logoEmber from './images/ember.svg'
import logoPreact from './images/preact.svg'
import logoHono from './images/hono.svg'
/**
* The frameworks and tools to display in this section.
Expand Down Expand Up @@ -164,6 +165,13 @@ const frameworks: Framework[] = [
url: 'https://emberjs.com/',
visible: ref(false),
},
{
name: 'Hono',
logo: logoHono,
color: '#ff5c13',
url: 'https://hono.dev/',
visible: ref(false),
},
]
// Starting parameters
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/_data/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ export const core = [
],
sponsor: 'https://github.com/sponsors/hi-ogawa',
},
{
avatar: 'https://github.com/btea.png',
name: 'btea',
title: 'Web Developer',
links: [{ icon: 'github', link: 'https://github.com/btea' }],
},
]

export const emeriti = [
Expand Down
4 changes: 2 additions & 2 deletions docs/blog/announcing-vite6.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ Vite 6 supports Node.js 18, 20, and 22+, similar to Vite 5. Node.js 21 support h

Vite is getting more flexible with the new Environment API. These new APIs will allow framework authors to offer a dev experience closer to production and for the Ecosystem to share new building blocks. Nothing changes if you're building a SPA; when you use Vite with a single client environment, everything works as before. And even for custom SSR apps, Vite 6 is backward compatible. The primary target audience for Environment API is framework authors.

For end users who are curious, Sapphi wrote a great [Introduction to Environment API](https://green.sapphi.red/blog/increasing-vites-potential-with-the-environment-api) guide. It is a great place to start and understand why we're trying to make Vite even more flexible.
For end users who are curious, [Sapphi](https://github.com/sapphi-red) wrote a great [Introduction to Environment API](https://green.sapphi.red/blog/increasing-vites-potential-with-the-environment-api) guide. It is a great place to start and understand why we're trying to make Vite even more flexible.

If you are a framework author or Vite plugin maintainer and would like to leverage the new APIs, you can learn more at the [Environment API Guides](https://main.vite.dev/guide/api-environment).

We want to thank everyone involved in defining and implementing the new APIs. Anthony Fu and Pooya Parsa made vite-node to improve [Nuxt's Dev SSR story](https://antfu.me/posts/dev-ssr-on-nuxt) with Vite. Then Anthony used vite-node to power Vitest, and Vladimir Sheremet kept improving it. At the beginning of 2023, Vladimir started working to upstream vite-node to Vite Core, and we released it as Runtime API in Vite 5.1 a year later. Feedback from ecosystem partners (special shout-out to the Cloudflare team) pushed us to do a more ambitious rework of Vite's environments. You can learn more about the story at [Patak's ViteConf 24 talk](https://www.youtube.com/watch?v=WImor3HDyqU?si=EZ-rFJn4pDW3tUvp).
We want to thank everyone involved in defining and implementing the new APIs. The story begins with Vite 2 adopting the unbundled SSR dev scheme pioneered by [Rich Harris](https://github.com/Rich-Harris) and the [SvelteKit](https://svelte.dev/docs/kit) team. Vite's SSR transform then unlocked [Anthony Fu](https://github.com/antfu/) and [Pooya Parsa](https://github.com/pi0) to create vite-node and improve [Nuxt's Dev SSR story](https://antfu.me/posts/dev-ssr-on-nuxt). Anthony went to use vite-node to power [Vitest](https://vitest.dev), and [Vladimir Sheremet](https://github.com/sheremet-va) kept improving it as part of his work maintaining Vitest. At the beginning of 2023, Vladimir started working to upstream vite-node to Vite Core, and we released it as Runtime API in Vite 5.1 a year later. Feedback from ecosystem partners (special shout-out to the Cloudflare team) pushed us to do a more ambitious rework of Vite's environments. You can learn more about the story at [Patak's ViteConf 24 talk](https://www.youtube.com/watch?v=WImor3HDyqU?si=EZ-rFJn4pDW3tUvp).

Everyone on the Vite team participated in defining the new API, which was co-designed with feedback from many projects in the Ecosystem. Thanks to everyone involved! We encourage you to get involved if you're building a framework, plugin, or tool on top of Vite. The new APIs are experimental. We will work with the Ecosystem to review how the new APIs will be used and stabilize them for the next major. If you'd like to ask questions or give feedback, there is an [open GitHub discussion here](https://github.com/vitejs/vite/discussions/16358).

Expand Down
3 changes: 1 addition & 2 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ When running `vite` from the command line, Vite will automatically try to resolv

The most basic config file looks like this:

```js
// vite.config.js
```js [vite.config.js]
export default {
// config options
}
Expand Down
Loading

0 comments on commit e06731d

Please sign in to comment.