Skip to content

Commit

Permalink
fix(build): build typescript as js module
Browse files Browse the repository at this point in the history
  • Loading branch information
breakingrobot committed Apr 12, 2018
1 parent 0a3621f commit a45ab44
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 4 deletions.
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import typescript from 'rollup-plugin-typescript2';

export default {
entry: 'lib/nuxt-property-decorator.js',
entry: './src/nuxt-property-decorator.ts',
plugins: [
typescript({
tsconfig: './tsconfig.json'
})
],
format: 'umd',
moduleName: 'NuxtPropertyDecorator',
dest: 'lib/nuxt-property-decorator.umd.js',
Expand Down
68 changes: 68 additions & 0 deletions src/nuxt-property-decorator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import Vue, { PropOptions, WatchOptions } from 'vue';
import Component from 'vue-class-component';
import 'reflect-metadata';
export declare type Constructor = {
new (...args: any[]): any;
};
/**
* decorator of an inject
* @param key key
* @return PropertyDecorator
*/
export declare function Inject(key?: string | symbol): PropertyDecorator;
/**
* decorator of a provide
* @param key key
* @return PropertyDecorator | void
*/
export declare function Provide(key?: string | symbol): PropertyDecorator;
/**
* decorator of model
* @param event event name
* @return PropertyDecorator
*/
export declare function Model(event?: string, options?: (PropOptions | Constructor[] | Constructor)): PropertyDecorator;
/**
* decorator of a prop
* @param options the options for the prop
* @return PropertyDecorator | void
*/
export declare function Prop(options?: (PropOptions | Constructor[] | Constructor)): PropertyDecorator;
/**
* decorator of a watch function
* @param path the path or the expression to observe
* @param WatchOption
* @return MethodDecorator
*/
export declare function Watch(path: string, options?: WatchOptions): MethodDecorator;
/**
* decorator of an event-emitter function
* @param event The name of the event
* @return MethodDecorator
*/
export declare function Emit(event?: string): MethodDecorator;
/**
* decorator of $off
* @param event The name of the event
* @param method The name of the method
*/
export declare function Off(event?: string, method?: string): MethodDecorator;
/**
* decorator of $on
* @param event The name of the event
*/
export declare function On(event?: string): MethodDecorator;
/**
* decorator of $once
* @param event The name of the event
*/
export declare function Once(event?: string): MethodDecorator;
/**
* decorator of $nextTick
*
* @export
* @param {string} method
* @returns {MethodDecorator}
*/
export declare function NextTick(method: string): MethodDecorator;
export { Component, Vue };
6 changes: 3 additions & 3 deletions src/tsconfig.json → tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"outDir": "../lib",
"outDir": "./lib",
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
Expand All @@ -12,7 +12,7 @@
"removeComments": false,
"strictNullChecks": true,
"typeRoots": [
"../node_modules/@types/"
"./node_modules/@types/"
],
"allowSyntheticDefaultImports": true,
"lib": [
Expand All @@ -23,7 +23,7 @@
]
},
"include": [
"./*.ts"
"src/**/*.ts"
],
"exclude": [
"node_modules",
Expand Down

0 comments on commit a45ab44

Please sign in to comment.