Skip to content

Commit 3954d20

Browse files
committed
feat: move to TypeScript
closes #13 #11
1 parent 8e844cf commit 3954d20

13 files changed

+91
-21
lines changed

bili.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** @type {import('bili').Config} */
22
module.exports = {
33
externals: ['vue'],
4+
input: 'src/index.ts',
45
output: {
56
format: ['cjs', 'es', 'umd', 'umd-min'],
67
fileName: 'vue-content-loader.[format][min][ext]',

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"files": [
1515
"dist"
1616
],
17+
"types": "dist/index.d.ts",
1718
"sideEffects": false,
1819
"scripts": {
1920
"prepublishOnly": "npm run build",
@@ -39,6 +40,8 @@
3940
"bili": "^5.0.5",
4041
"jest": "^26.6.3",
4142
"poi": "12.10.3",
43+
"rollup-plugin-typescript2": "^0.29.0",
44+
"typescript": "^4.1.3",
4245
"vue": "^3.0.5",
4346
"vue-loader": "^16.1.2",
4447
"vue-router": "^4.0.3"

src/BulletListLoader.js renamed to src/BulletListLoader.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { defineComponent } from 'vue'
12
import ContentLoader from './ContentLoader'
23

3-
const BulletListLoader = (props, { attrs }) => {
4-
return (
4+
const BulletListLoader = defineComponent((props, { attrs }) => {
5+
return () => (
56
<ContentLoader {...attrs}>
67
<circle cx="10" cy="20" r="8" />
78
<rect x="25" y="15" rx="5" ry="5" width="220" height="10" />
@@ -13,6 +14,6 @@ const BulletListLoader = (props, { attrs }) => {
1314
<rect x="25" y="105" rx="5" ry="5" width="220" height="10" />
1415
</ContentLoader>
1516
)
16-
}
17+
})
1718

1819
export default BulletListLoader

src/CodeLoader.js renamed to src/CodeLoader.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { defineComponent } from 'vue'
12
import ContentLoader from './ContentLoader'
23

3-
const CodeLoader = (props, { attrs }) => {
4-
return (
4+
const CodeLoader = defineComponent((props, { attrs }) => {
5+
return () => (
56
<ContentLoader {...attrs}>
67
<rect x="0" y="0" rx="3" ry="3" width="70" height="10" />
78
<rect x="80" y="0" rx="3" ry="3" width="100" height="10" />
@@ -17,6 +18,6 @@ const CodeLoader = (props, { attrs }) => {
1718
<rect x="0" y="60" rx="3" ry="3" width="30" height="10" />
1819
</ContentLoader>
1920
)
20-
}
21+
})
2122

2223
export default CodeLoader
File renamed without changes.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { defineComponent } from 'vue'
12
import ContentLoader from './ContentLoader'
23

3-
const FacebookLoader = (props, { attrs }) => {
4-
return (
4+
const FacebookLoader = defineComponent((props, { attrs }) => {
5+
return () => (
56
<ContentLoader {...attrs}>
67
<rect x="70" y="15" rx="4" ry="4" width="117" height="6.4" />
78
<rect x="70" y="35" rx="3" ry="3" width="85" height="6.4" />
@@ -11,6 +12,6 @@ const FacebookLoader = (props, { attrs }) => {
1112
<circle cx="30" cy="30" r="30" />
1213
</ContentLoader>
1314
)
14-
}
15+
})
1516

1617
export default FacebookLoader
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { defineComponent } from 'vue'
12
import ContentLoader from './ContentLoader'
23

3-
const InstagramLoader = (props, { attrs }) => {
4-
return (
4+
const InstagramLoader = defineComponent((props, { attrs }) => {
5+
return () => (
56
<ContentLoader {...attrs} viewBox="0 0 400 480">
67
<circle cx="30" cy="30" r="30" />
78

@@ -10,6 +11,6 @@ const InstagramLoader = (props, { attrs }) => {
1011
<rect x="0" y="70" rx="5" ry="5" width="400" height="400" />
1112
</ContentLoader>
1213
)
13-
}
14+
})
1415

1516
export default InstagramLoader
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { defineComponent } from 'vue'
12
import ContentLoader from './ContentLoader'
23

3-
const ListLoader = (props, { attrs }) => {
4-
return (
4+
const ListLoader = defineComponent((props, { attrs }) => {
5+
return () => (
56
<ContentLoader {...attrs}>
67
<rect x="0" y="0" rx="3" ry="3" width="250" height="10" />
78
<rect x="20" y="20" rx="3" ry="3" width="220" height="10" />
@@ -11,6 +12,6 @@ const ListLoader = (props, { attrs }) => {
1112
<rect x="20" y="100" rx="3" ry="3" width="80" height="10" />
1213
</ContentLoader>
1314
)
14-
}
15+
})
1516

1617
export default ListLoader
File renamed without changes.

src/uid.js renamed to src/uid.ts

File renamed without changes.

0 commit comments

Comments
 (0)