diff --git a/packages/oc-generic-template-compiler/index.d.ts b/packages/oc-generic-template-compiler/index.d.ts index 8d96fbb9..eff3774e 100644 --- a/packages/oc-generic-template-compiler/index.d.ts +++ b/packages/oc-generic-template-compiler/index.d.ts @@ -1,21 +1,20 @@ type Callback = (err: Error | null, data: T) => void; - interface PackageJson { name: string; version: string; dependencies?: Record; devDependencies?: Record; } - interface CompiledViewInfo { template: { type: string; hashKey: string; src: string; }; - bundle: { hashKey: string }; + bundle: { + hashKey: string; + }; } - type OcOptions = { files: { data: string; @@ -26,8 +25,7 @@ type OcOptions = { static: string[]; }; }; - -interface CompilerOptions { +export interface CompilerOptions { componentPackage: PackageJson & { oc: OcOptions; }; @@ -39,17 +37,21 @@ interface CompilerOptions { verbose: boolean; watch: boolean; } - -type CompileView = ( +export type CompileView = ( options: CompilerOptions, cb: Callback ) => void; -type CompileServer = ( - options: CompilerOptions & { compiledViewInfo: CompiledViewInfo }, +export type CompileServer = ( + options: CompilerOptions & { + compiledViewInfo: CompiledViewInfo; + }, cb: Callback ) => void; -type CompileStatics = (options: CompilerOptions, cb: Callback<'ok'>) => void; -type GetInfo = () => { +export type CompileStatics = ( + options: CompilerOptions, + cb: Callback<'ok'> +) => void; +export type GetInfo = () => { type: string; version: string; externals: Array<{ @@ -58,14 +60,16 @@ type GetInfo = () => { url: string; }>; }; - -declare const compiler: { - createCompile: (compilers: { - compileView: CompileView; - compileServer: CompileServer; - compileStatics: CompileStatics; - getInfo: GetInfo; - }) => (options: CompilerOptions, cb: Callback) => void; +export type Compilers = { + compileView: CompileView; + compileServer: CompileServer; + compileStatics: CompileStatics; + getInfo: GetInfo; }; - -export = compiler; +export declare const createCompile: ({ + compileServer, + compileView, + compileStatics, + getInfo +}: Compilers) => (options: CompilerOptions, callback: Callback) => void; +export {}; diff --git a/packages/oc-generic-template-compiler/package.json b/packages/oc-generic-template-compiler/package.json index 3208164a..698b052d 100644 --- a/packages/oc-generic-template-compiler/package.json +++ b/packages/oc-generic-template-compiler/package.json @@ -1,6 +1,6 @@ { "name": "oc-generic-template-compiler", - "version": "2.1.1", + "version": "2.1.2", "description": "OC-Generic-Template-Compiler", "main": "index.js", "types": "index.d.ts", @@ -34,4 +34,4 @@ "lodash": "^4.17.4", "oc-get-unix-utc-timestamp": "1.0.3" } -} +} \ No newline at end of file