├── .commitlintrc.js ├── .cz-configrc.js ├── .github └── workflows │ ├── greetings.yml │ └── npm-publish.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── examples └── vite-project │ ├── .gitignore │ ├── README.md │ ├── index.html │ ├── package.json │ ├── public │ └── favicon.ico │ ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ └── HelloWorld.vue │ ├── main.ts │ └── shims-vue.d.ts │ ├── tsconfig.json │ └── vite.config.ts ├── package.json ├── src ├── index.ts └── lib │ ├── options.ts │ └── utils.ts └── tsconfig.json /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | extends: ['@commitlint/config-conventional'], 5 | rules: { 6 | 'type-enum': [ 7 | 2, 8 | 'always', 9 | ['WIP', 'feat', 'fix', 'refactor', 'docs', 'test', 'style', 'chore', 'revert'], 10 | ], 11 | 'type-case': [1, 'always', ['lower-case', 'upper-case']], 12 | 'scope-case': [0, 'never'], 13 | 'subject-case': [0, 'never'], 14 | 'scope-empty': [0, 'never'], 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /.cz-configrc.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | types: [ 5 | { 6 | value: 'WIP', 7 | name: '💪 WIP: Work in progress', 8 | }, 9 | { 10 | value: 'feat', 11 | name: '✨ feat: A new feature', 12 | }, 13 | { 14 | value: 'fix', 15 | name: '🐞 fix: A bug fix', 16 | }, 17 | { 18 | value: 'refactor', 19 | name: '🛠 refactor: A code change that neither fixes a bug nor adds a feature', 20 | }, 21 | { 22 | value: 'docs', 23 | name: '📚 docs: Documentation only changes', 24 | }, 25 | { 26 | value: 'test', 27 | name: '🏁 test: Add missing tests or correcting existing tests', 28 | }, 29 | { 30 | value: 'chore', 31 | name: 32 | "🗯 chore: Changes that don't modify src or test files. Such as updating build tasks, package manager", 33 | }, 34 | { 35 | value: 'style', 36 | name: 37 | '💅 style: Code Style, Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)', 38 | }, 39 | { 40 | value: 'revert', 41 | name: '⏪ revert: Revert to a commit', 42 | }, 43 | ], 44 | scopes: [], 45 | allowCustomScopes: true, 46 | allowBreakingChanges: ['feat', 'fix'], 47 | } 48 | -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/first-interaction@v1 10 | with: 11 | repo-token: ${{ secrets.GITHUB_TOKEN }} 12 | issue-message: 'Thanks feedback. We will check it later:-)' 13 | pr-message: 'Thank for your PR. We will check it later:-)' 14 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | name: NPM-Publish 2 | 3 | on: 4 | push: 5 | # Sequence of patterns matched against refs/heads 6 | branches: 7 | # Push events on main branch 8 | - main 9 | 10 | pull_request: 11 | # Sequence of patterns matched against refs/heads 12 | branches: 13 | # Push events on main branch 14 | - main 15 | 16 | jobs: 17 | publish: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v1 21 | - uses: actions/setup-node@v1 22 | with: 23 | node-version: 12 24 | - run: yarn install 25 | - run: yarn test 26 | - uses: JS-DevTools/npm-publish@v1 27 | with: 28 | token: ${{ secrets.NPM_TOKEN }} 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | .npmrc 4 | 5 | # Log files 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | dist 11 | package-lock.json 12 | yarn.lock 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /examples 2 | yarn-error.log 3 | .github 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 PENG Rui 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vite-plugin-sleep 2 | 3 | > vite is too fast, we need to rest. a vite-plugin you never need. 4 | 5 |
16 | 17 | ## Motivation 18 | 19 | - In the old days with webpack, we had many times when we could compile with pay, and with vite it was so fast that we couldn't rest. 20 | - Time to take a nap in the vite. 21 | 22 | ## Usage 23 | 24 | ```sh 25 | yarn add vite-plugin-sleep 26 | ``` 27 | 28 | ```ts 29 | // vite.config.ts 30 | import sleep from 'vite-plugin-sleep' 31 | 32 | /** @see {@link https://vitejs.dev/config/} */ 33 | export default defineConfig({ 34 | plugins: [ 35 | // ...other plugins 36 | sleep(/* options */), 37 | ], 38 | }) 39 | ``` 40 | 41 | ## Options 42 | 43 | ```ts 44 | { 45 | /** 46 | * DevServer start delay(ms) 47 | * @default 20000 48 | */ 49 | devServerStartDelay: number 50 | /** 51 | * HMR delay(ms) 52 | * @default 3000 53 | */ 54 | hmrDelay: number 55 | } 56 | -------------------------------------------------------------------------------- /examples/vite-project/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | dist-ssr 5 | *.local 6 | -------------------------------------------------------------------------------- /examples/vite-project/README.md: -------------------------------------------------------------------------------- 1 | # Vue 3 + Typescript + Vite 2 | 3 | This template should help get you started developing with Vue 3 and Typescript in Vite. 4 | 5 | ## Recommended IDE Setup 6 | 7 | [VSCode](https://code.visualstudio.com/) + [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur). Make sure to enable `vetur.experimental.templateInterpolationService` in settings! 8 | 9 | ### If Using ` 12 |