File tree Expand file tree Collapse file tree 8 files changed +31
-29
lines changed Expand file tree Collapse file tree 8 files changed +31
-29
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,4 @@ node_modules
2
2
example /build.js
3
3
example /build.js.map
4
4
test /test.build.js
5
-
6
- /index.js
7
- /index.d.ts
5
+ lib
Original file line number Diff line number Diff line change 1
1
import * as Vue from 'vue'
2
- import Component from '../index'
2
+ import Component from '../lib/ index'
3
3
4
4
@Component ( {
5
5
props : {
Original file line number Diff line number Diff line change 2
2
"name" : " vue-class-component" ,
3
3
"version" : " 4.2.0" ,
4
4
"description" : " ES201X/TypeScript class decorator for Vue components" ,
5
- "main" : " index.js" ,
6
- "typings" : " index.d.ts" ,
5
+ "main" : " lib/ index.js" ,
6
+ "typings" : " lib/ index.d.ts" ,
7
7
"files" : [
8
- " index.js" ,
9
- " index.d.ts" ,
8
+ " lib" ,
10
9
" tsconfig.json"
11
10
],
12
11
"scripts" : {
13
12
"build" : " tsc -p ." ,
13
+ "clean" : " rm -rf lib" ,
14
14
"example" : " npm run build && webpack --config example/webpack.config.js" ,
15
15
"dev" : " webpack --config example/webpack.config.js --watch" ,
16
16
"test" : " npm run build && webpack --config test/webpack.config.js && mocha test/test.build.js" ,
17
- "prepublish" : " npm run build"
17
+ "prepublish" : " npm run clean && npm run build"
18
18
},
19
19
"repository" : {
20
20
"type" : " git" ,
Original file line number Diff line number Diff line change 1
1
import * as Vue from 'vue'
2
+ import { VueClass } from './declarations'
2
3
3
4
const internalHooks = [
4
5
'data' ,
@@ -15,9 +16,7 @@ const internalHooks = [
15
16
'render'
16
17
]
17
18
18
- export type VueClass = { new ( ) : Vue } & typeof Vue
19
-
20
- function componentFactory (
19
+ export function componentFactory (
21
20
Component : VueClass ,
22
21
options : Vue . ComponentOptions < any > = { }
23
22
) : VueClass {
@@ -52,15 +51,3 @@ function componentFactory (
52
51
: Vue
53
52
return Super . extend ( options )
54
53
}
55
-
56
- export default function decorator < U extends Vue > ( options : Vue . ComponentOptions < U > ) : < V extends VueClass > ( target : V ) => V
57
- export default function decorator < V extends VueClass > ( target : V ) : V
58
- export default function decorator < V extends VueClass > ( options : Vue . ComponentOptions < any > | V ) : any {
59
- if ( typeof options === 'function' ) {
60
- return componentFactory ( options )
61
- }
62
- return function ( Component : any ) {
63
- return componentFactory ( Component , options )
64
- }
65
- }
66
-
Original file line number Diff line number Diff line change
1
+ import * as Vue from 'vue'
2
+
3
+ export type VueClass = { new ( ) : Vue } & typeof Vue
Original file line number Diff line number Diff line change
1
+ import * as Vue from 'vue'
2
+ import { VueClass } from './declarations'
3
+
4
+ import { componentFactory } from './component'
5
+
6
+ export default function Component < U extends Vue > ( options : Vue . ComponentOptions < U > ) : < V extends VueClass > ( target : V ) => V
7
+ export default function Component < V extends VueClass > ( target : V ) : V
8
+ export default function Component < V extends VueClass > ( options : Vue . ComponentOptions < any > | V ) : any {
9
+ if ( typeof options === 'function' ) {
10
+ return componentFactory ( options )
11
+ }
12
+ return function ( Component : V ) {
13
+ return componentFactory ( Component , options )
14
+ }
15
+ }
Original file line number Diff line number Diff line change 1
- import Component from '../index'
1
+ import Component from '../lib/ index'
2
2
import { expect } from 'chai'
3
3
import * as Vue from 'vue'
4
4
Original file line number Diff line number Diff line change 7
7
],
8
8
"module" : " commonjs" ,
9
9
"moduleResolution" : " node" ,
10
+ "outDir" : " lib" ,
10
11
"isolatedModules" : false ,
11
12
"experimentalDecorators" : true ,
12
13
"declaration" : true ,
16
17
"removeComments" : true ,
17
18
"suppressImplicitAnyIndexErrors" : true
18
19
},
19
- "exclude" : [
20
- " node_modules" ,
21
- " test" ,
22
- " example"
20
+ "include" : [
21
+ " src/**/*.ts"
23
22
],
24
23
"compileOnSave" : false
25
24
}
You can’t perform that action at this time.
0 commit comments