Skip to content

Commit

Permalink
feat: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
poyoho committed Mar 3, 2022
2 parents 9e4df7a + 3c0a609 commit a598ebb
Show file tree
Hide file tree
Showing 225 changed files with 4,906 additions and 2,369 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Expand Up @@ -66,7 +66,7 @@ body:
required: true
- label: Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
required: true
- label: Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- label: Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
required: true
- label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
required: true
Expand Down
1 change: 1 addition & 0 deletions .github/renovate.json5
Expand Up @@ -28,6 +28,7 @@
"react-router", // `react-router:v6.0.0+` has breaking changes
"react-router-dom", // `react-router-dom:v6.0.0+` has breaking changes
"source-map", // `source-map:v0.7.0+` needs more investigation
"dotenv-expand", // `dotenv-expand:6.0.0+` has breaking changes (#6858)

// ESM Only => https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm
"node-fetch",
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -20,6 +20,7 @@ concurrency:

jobs:
build:
timeout-minutes: 20
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -43,7 +44,7 @@ jobs:
version: 6

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: "pnpm"
Expand All @@ -67,6 +68,7 @@ jobs:
run: pnpm run test-build -- --runInBand

lint:
timeout-minutes: 10
runs-on: ubuntu-latest
name: "Lint: node-16, ubuntu-latest"
steps:
Expand All @@ -80,7 +82,7 @@ jobs:
version: 6

- name: Set node version to 16
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-close-require.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: need reproduction
uses: actions-cool/issues-helper@v2
uses: actions-cool/issues-helper@v3
with:
actions: "close-issues"
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/issue-labeled.yml
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- name: contribution welcome
if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v2
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -21,7 +21,7 @@ jobs:

- name: remove pending
if: github.event.label.name == 'enhancement' || github.event.label.name == 'bug' || (contains(github.event.label.name, 'pending triage') == false && startsWith(github.event.label.name, 'bug:') == true)
uses: actions-cool/issues-helper@v2
uses: actions-cool/issues-helper@v3
with:
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -30,7 +30,7 @@ jobs:

- name: need reproduction
if: github.event.label.name == 'need reproduction'
uses: actions-cool/issues-helper@v2
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,46 @@
name: Publish Package

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
- "plugin-*" # Push events to matching plugin-*, i.e. plugin-(vue|vue-jsx|react|legacy)@1.0.0
- "create-vite*" # # Push events to matching create-vite*, i.e. create-vite@1.0.0

jobs:
publish:
# prevents this action from running on forks
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
environment: Release
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 6

- name: Set node version to 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: https://registry.npmjs.org/
cache: "pnpm"

- name: Install deps
run: pnpm install

- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish package
run: pnpm run ci-publish -- ${{ github.ref_name }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release-tag.yml
@@ -1,4 +1,4 @@
name: release
name: Add GitHub Release Tag

on:
push:
Expand Down
7 changes: 7 additions & 0 deletions .npmrc
@@ -0,0 +1,7 @@
hoist-pattern[]=*eslint*
hoist-pattern[]=*babel*
hoist-pattern[]=*jest*
hoist-pattern[]=@emotion/*
hoist-pattern[]=postcss
hoist-pattern[]=pug
hoist-pattern[]=source-map-support
1 change: 1 addition & 0 deletions .prettierignore
Expand Up @@ -10,3 +10,4 @@ pnpm-lock.yaml
pnpm-workspace.yaml
packages/playground/tsconfig-json-load-error/has-error/tsconfig.json
packages/playground/html/invalid.html
packages/playground/worker/classic-worker.js
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -14,6 +14,36 @@ To develop and test the core `vite` package:

You can alternatively use [Vite.js Docker Dev](https://github.com/nystudio107/vitejs-docker-dev) for a containerized Docker setup for Vite.js development.

## Debugging

If you want to use break point and explore code execution you can use the ["Run and debug"](https://code.visualstudio.com/docs/editor/debugging) feature from vscode.

1. Add a `debugger` statement where you want to stop the code execution.

2. Click on the "Run and Debug" icon in the activity bar of the editor.

3. Click on the "Javascript Debug Terminal" button.

4. It will open a terminal, then go to `packages/playground/xxx` and run `pnpm run dev`.

5. The execution will stop and you'll use the [Debug toolbar](https://code.visualstudio.com/docs/editor/debugging#_debug-actions) to continue, step over, restart the process...

### Debugging errors in Jest tests using Playwright (Chromium)

Some errors are masked and hidden away because of the layers of abstraction and sandboxed nature added by Jest, Playwright, and Chromium. In order to see what's actually going wrong and the contents of the devtools console in those instances, follow this setup:

1. Add a `debugger` statement to the `scripts/jestPerTestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits.

1. Run the tests with the `debug-serve` script command which will enable remote debugging: `pnpm run debug-serve -- --runInBand resolve`.

1. Wait for inspector devtools to open in your browser and the debugger to attach.

1. In the sources panel in the right column, click the play button to resume execution and allow the tests to run which will open a Chromium instance.

1. Focusing the Chomium instance, you can open the browser devtools and inspect the console there to find the underlying problems.

1. To close everything, just stop the test process back in your terminal.

## Testing Vite against external packages

You may wish to test your locally-modified copy of Vite against another package that is built with Vite. For pnpm, after building Vite, you can use [`pnpm.overrides`](https://pnpm.io/package_json#pnpmoverrides). Please note that `pnpm.overrides` must be specified in the root `package.json` and you must first list the package as a dependency in the root `package.json`:
Expand Down
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -33,10 +33,6 @@ In addition, Vite is highly extensible via its [Plugin API](https://vitejs.dev/g

[Read the Docs to Learn More](https://vitejs.dev).

## Migrating from 1.x

Check out the [Migration Guide](https://vitejs.dev/guide/migration.html) if you are upgrading from 1.x.

## Packages

| Package | Version (click for changelogs) |
Expand All @@ -55,3 +51,11 @@ See [Contributing Guide](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.m
## License

MIT

## Sponsors

<p align="center">
<a target="_blank" href="https://github.com/sponsors/yyx990803">
<img alt="sponsors" src="https://sponsors.vuejs.org/vite.svg">
</a>
</p>
3 changes: 3 additions & 0 deletions docs/.vitepress/config.js
Expand Up @@ -7,6 +7,9 @@ module.exports = {
title: 'Vite',
description: 'Next Generation Frontend Tooling',
head: [['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }]],
vue: {
reactivityTransform: true
},
themeConfig: {
repo: 'vitejs/vite',
logo: '/logo.svg',
Expand Down
137 changes: 137 additions & 0 deletions docs/.vitepress/theme/SponsorsGroup.vue
@@ -0,0 +1,137 @@
<script lang="ts">
// shared data across instances so we load only once
let data = $ref<SponsorData>()
const base = `https://sponsors.vuejs.org`
const dataUrl = `${base}/vite.json`
</script>

<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue'
interface Sponsor {
url: string
img: string
name: string
}
interface SponsorData {
special: Sponsor[]
platinum: Sponsor[]
platinum_china: Sponsor[]
gold: Sponsor[]
silver: Sponsor[]
bronze: Sponsor[]
}
const { tier, placement = 'aside' } = defineProps<{
tier: keyof SponsorData
placement?: 'aside' | 'page' | 'landing'
}>()
let container = $ref<HTMLElement>()
let visible = $ref(false)
onMounted(async () => {
// only render when entering view
const observer = new IntersectionObserver(
(entries) => {
if (entries[0].isIntersecting) {
visible = true
observer.disconnect()
}
},
{ rootMargin: '0px 0px 300px 0px' }
)
observer.observe(container)
onUnmounted(() => observer.disconnect())
// load data
if (!data) {
data = await (await fetch(dataUrl)).json()
}
})
</script>

<template>
<div
ref="container"
class="sponsor-container"
:class="[tier.startsWith('plat') ? 'platinum' : tier, placement]"
>
<template v-if="data && visible">
<a
v-for="{ url, img, name } of data[tier]"
class="sponsor-item"
:href="url"
target="_blank"
rel="sponsored noopener"
>
<picture v-if="img.endsWith('png')">
<source
type="image/avif"
:srcset="`${base}/images/${img.replace(/\.png$/, '.avif')}`"
/>
<img :src="`${base}/images/${img}`" :alt="name" />
</picture>
<img v-else :src="`${base}/images/${img}`" :alt="name" />
</a>
</template>
</div>
</template>

<style scoped>
.sponsor-container {
--max-width: 100%;
display: flex;
justify-content: space-evenly;
flex-wrap: wrap;
}
.sponsor-container.platinum {
--max-width: 260px;
}
.sponsor-container.gold {
--max-width: 160px;
}
.sponsor-container.silver {
--max-width: 140px;
}
.sponsor-item {
margin: 2px 0;
display: flex;
align-items: center;
border-radius: 2px;
transition: background-color 0.2s ease;
height: calc(var(--max-width) / 2 - 6px);
}
.sponsor-item.action {
font-size: 11px;
color: #999;
}
.sponsor-item img {
width: 100%;
max-width: calc(var(--max-width) - 30px);
max-height: calc(var(--max-width) / 2 - 20px);
margin: 10px 20px;
}
.special .sponsor-item {
height: 160px;
}
.special .sponsor-item img {
max-width: 300px;
max-height: 150px;
}
/* aside mode (on content pages) */
.sponsor-container.platinum.aside {
--max-width: 200px;
}
.sponsor-container.gold.aside {
--max-width: 124px;
}
.aside .sponsor-item {
margin: 0;
}
</style>
31 changes: 31 additions & 0 deletions docs/.vitepress/theme/SponsorsSidebar.vue
@@ -0,0 +1,31 @@
<script setup lang="ts">
import SponsorsGroup from './SponsorsGroup.vue'
import { useData } from 'vitepress'
const { frontmatter } = useData()
</script>

<template>
<div v-if="frontmatter.sponsors !== false">
<a
class="sponsors-aside-text"
href="https://github.com/sponsors/yyx990803"
target="_blank"
>Sponsors</a
>
<SponsorsGroup tier="platinum" />
<SponsorsGroup tier="gold" />
</div>
</template>

<style>
a.sponsors-aside-text {
color: #999;
display: block;
margin: 3em 0 1em;
font-weight: 700;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.4px;
padding-left: 2em;
}
</style>

0 comments on commit a598ebb

Please sign in to comment.