Skip to content

Commit 28e29a9

Browse files
committed
feat: init
0 parents  commit 28e29a9

24 files changed

+5203
-0
lines changed

.eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@antfu"
3+
}

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [antfu]

.github/workflows/ci.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v2
20+
21+
- name: Set node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 16.x
25+
cache: pnpm
26+
27+
- name: Setup
28+
run: npm i -g @antfu/ni
29+
30+
- name: Install
31+
run: nci
32+
33+
- name: Lint
34+
run: nr lint
35+
36+
typecheck:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v3
40+
41+
- name: Install pnpm
42+
uses: pnpm/action-setup@v2
43+
44+
- name: Set node
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: 16.x
48+
cache: pnpm
49+
50+
- name: Setup
51+
run: npm i -g @antfu/ni
52+
53+
- name: Install
54+
run: nci
55+
56+
- name: Typecheck
57+
run: nr typecheck
58+
59+
test:
60+
runs-on: ${{ matrix.os }}
61+
62+
strategy:
63+
matrix:
64+
node: [14.x, 16.x]
65+
os: [ubuntu-latest, windows-latest, macos-latest]
66+
fail-fast: false
67+
68+
steps:
69+
- uses: actions/checkout@v3
70+
71+
- name: Install pnpm
72+
uses: pnpm/action-setup@v2
73+
74+
- name: Set node ${{ matrix.node }}
75+
uses: actions/setup-node@v3
76+
with:
77+
node-version: ${{ matrix.node }}
78+
cache: pnpm
79+
80+
- name: Setup
81+
run: npm i -g @antfu/ni
82+
83+
- name: Install
84+
run: nci
85+
86+
- name: Build
87+
run: nr build
88+
89+
- name: Test
90+
run: nr test

.github/workflows/release.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
22+
- name: Set node
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: 16.x
26+
cache: pnpm
27+
28+
- run: npx changelogithub
29+
env:
30+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.cache
2+
.DS_Store
3+
.idea
4+
*.log
5+
*.tgz
6+
coverage
7+
dist
8+
lib-cov
9+
logs
10+
node_modules
11+
temp

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore-workspace-root-check=true

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please refer to https://github.com/antfu/contribute

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Anthony Fu <https://github.com/antfu>
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.

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# v-lazy-show
2+
3+
[![NPM version](https://img.shields.io/npm/v/v-lazy-show?color=a1b858&label=)](https://www.npmjs.com/package/v-lazy-show)
4+
5+
## Sponsors
6+
7+
<p align="center">
8+
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
9+
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
10+
</a>
11+
</p>
12+
13+
## License
14+
15+
[MIT](./LICENSE) License © 2022 [Anthony Fu](https://github.com/antfu)

build.config.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
3+
export default defineBuildConfig({
4+
entries: [
5+
'src/index',
6+
],
7+
declaration: true,
8+
clean: true,
9+
rollup: {
10+
emitCJS: true,
11+
},
12+
})

package.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"name": "v-lazy-show",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"packageManager": "[email protected]",
6+
"description": "",
7+
"author": "Anthony Fu <[email protected]>",
8+
"license": "MIT",
9+
"funding": "https://github.com/sponsors/antfu",
10+
"homepage": "https://github.com/antfu/v-lazy-show#readme",
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/antfu/v-lazy-show.git"
14+
},
15+
"bugs": "https://github.com/antfu/v-lazy-show/issues",
16+
"keywords": [],
17+
"sideEffects": false,
18+
"exports": {
19+
".": {
20+
"types": "./dist/index.d.ts",
21+
"require": "./dist/index.cjs",
22+
"import": "./dist/index.mjs"
23+
},
24+
"./runtime": {
25+
"types": "./dist/runtime.d.ts",
26+
"require": "./dist/runtime.cjs",
27+
"import": "./dist/runtime.mjs"
28+
}
29+
},
30+
"main": "./dist/index.mjs",
31+
"module": "./dist/index.mjs",
32+
"types": "./dist/index.d.ts",
33+
"typesVersions": {
34+
"*": {
35+
"*": [
36+
"./dist/*",
37+
"./dist/index.d.ts"
38+
]
39+
}
40+
},
41+
"files": [
42+
"dist"
43+
],
44+
"scripts": {
45+
"build": "unbuild",
46+
"stub": "unbuild --stub",
47+
"dev": "nr -C playground dev",
48+
"lint": "eslint .",
49+
"prepublishOnly": "nr build",
50+
"release": "bumpp && npm publish",
51+
"start": "esno src/index.ts",
52+
"test": "vitest",
53+
"typecheck": "tsc --noEmit"
54+
},
55+
"devDependencies": {
56+
"@antfu/eslint-config": "^0.38.2",
57+
"@antfu/ni": "^0.21.2",
58+
"@antfu/utils": "^0.7.2",
59+
"@types/node": "^18.15.11",
60+
"@vue/compiler-core": "^3.2.47",
61+
"bumpp": "^9.1.0",
62+
"eslint": "^8.37.0",
63+
"esno": "^0.16.3",
64+
"lint-staged": "^13.2.0",
65+
"pnpm": "^8.1.0",
66+
"rimraf": "^4.4.1",
67+
"simple-git-hooks": "^2.8.1",
68+
"typescript": "^5.0.2",
69+
"unbuild": "^1.1.2",
70+
"vite": "^4.2.1",
71+
"vite-plugin-inspect": "^0.7.18",
72+
"vitest": "^0.29.8",
73+
"vue": "^3.2.47"
74+
},
75+
"simple-git-hooks": {
76+
"pre-commit": "pnpm lint-staged"
77+
},
78+
"lint-staged": {
79+
"*": "eslint --fix"
80+
}
81+
}

playground/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + Vue + TS</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

playground/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "playground",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vue-tsc && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"vue": "^3.2.47"
13+
},
14+
"devDependencies": {
15+
"@vitejs/plugin-vue": "^4.1.0",
16+
"typescript": "^4.9.3",
17+
"vite": "^4.2.0",
18+
"vue-tsc": "^1.2.0"
19+
}
20+
}

playground/src/App.vue

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
4+
const enabled = ref(false)
5+
</script>
6+
7+
<template>
8+
<button @click="enabled = !enabled">
9+
Toggle
10+
</button>
11+
<div v-lazy-show="enabled">
12+
<div>v-lazy-show</div>
13+
</div>
14+
<div v-show="enabled">
15+
<div>v-show</div>
16+
</div>
17+
<div v-if="enabled">
18+
<div>v-if</div>
19+
</div>
20+
</template>

playground/src/HelloWorld.vue

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script setup lang="ts">
2+
defineProps({
3+
msg: {
4+
type: String,
5+
required: true,
6+
},
7+
})
8+
9+
console.log('HI')
10+
</script>
11+
12+
<template>
13+
<div>
14+
{{ msg }}
15+
</div>
16+
</template>

playground/src/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
createApp(App).mount('#app')

playground/tsconfig.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"moduleResolution": "Node",
7+
"strict": true,
8+
"jsx": "preserve",
9+
"resolveJsonModule": true,
10+
"isolatedModules": true,
11+
"esModuleInterop": true,
12+
"lib": ["ESNext", "DOM"],
13+
"skipLibCheck": true,
14+
"noEmit": true
15+
}
16+
}

playground/vite.config.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from 'vite'
2+
import Vue from '@vitejs/plugin-vue'
3+
import Inspect from 'vite-plugin-inspect'
4+
import { transformLazyShow } from '../src/index'
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig({
8+
plugins: [
9+
Vue({
10+
template: {
11+
compilerOptions: {
12+
nodeTransforms: [
13+
transformLazyShow,
14+
],
15+
},
16+
},
17+
}),
18+
Inspect(),
19+
],
20+
})

0 commit comments

Comments
 (0)