mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[idyll] add type declaration for idyll (#25454)
* add type declaration for idyll * incorrect export: expected a function export
This commit is contained in:
parent
9208696d3b
commit
b94b775e93
7
types/idyll/idyll-tests.ts
Normal file
7
types/idyll/idyll-tests.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import idyll = require("idyll");
|
||||
|
||||
// $ExpectType IdyllInstance
|
||||
idyll({
|
||||
watch: true,
|
||||
datasets: "."
|
||||
});
|
||||
130
types/idyll/index.d.ts
vendored
Normal file
130
types/idyll/index.d.ts
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
// Type definitions for idyll 2.10
|
||||
// Project: https://github.com/idyll-lang/idyll/tree/master/packages/idyll-cli
|
||||
// Definitions by: Thanh Ngo <https://github.com/iocat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
import { Options as CompilerOptions } from "idyll-compiler";
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Monitor input files and rebuild on changes
|
||||
*/
|
||||
watch?: boolean;
|
||||
/**
|
||||
* The datasets directory
|
||||
*/
|
||||
datasets?: string;
|
||||
/**
|
||||
* Whether to minify output build
|
||||
*/
|
||||
minify?: boolean;
|
||||
/**
|
||||
*
|
||||
* Pre-render HTML as part of the build
|
||||
*/
|
||||
ssr?: boolean;
|
||||
/**
|
||||
* The components directory
|
||||
*/
|
||||
components?: boolean;
|
||||
/**
|
||||
* The default component directory
|
||||
* This corresponds to where the idyll-components package stays
|
||||
*/
|
||||
defaultComponents?: boolean;
|
||||
/**
|
||||
* The layout defined in idyll-layouts package
|
||||
*/
|
||||
layout?: string;
|
||||
/**
|
||||
* The theme defined in idyll-theme package
|
||||
*/
|
||||
theme?: string;
|
||||
/**
|
||||
* The output directory for compiled documents
|
||||
*/
|
||||
output?: string;
|
||||
/**
|
||||
* Custom port to bind the local server to.
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Temporary directory used by idyll
|
||||
*/
|
||||
temp?: string;
|
||||
/**
|
||||
* path to HTML template
|
||||
*
|
||||
*/
|
||||
template?: string;
|
||||
|
||||
/**
|
||||
* Custom CSS file to include in output
|
||||
*/
|
||||
css?: string;
|
||||
/**
|
||||
* Custom browserify transforms to apply.
|
||||
*/
|
||||
transform?: string[];
|
||||
/**
|
||||
* Compiler options
|
||||
*/
|
||||
compiler?: CompilerOptions;
|
||||
/**
|
||||
* the idyll file to be compiled into
|
||||
*/
|
||||
inputFile?: string;
|
||||
|
||||
/**
|
||||
* used internally by IdyllInstance
|
||||
*/
|
||||
inputConfig?: {
|
||||
components: any;
|
||||
transform: any[];
|
||||
compiler: CompilerOptions;
|
||||
};
|
||||
}
|
||||
|
||||
type PredefinedFile =
|
||||
| "APP_PATH"
|
||||
| "CSS_INPUT_FILE"
|
||||
| "DATA_DIR"
|
||||
| "HTML_TEMPLATE_FILE"
|
||||
| "IDYLL_INPUT_FILE"
|
||||
| "INPUT_DIR"
|
||||
| "PACKAGE_FILE"
|
||||
| "OUTPUT_DIR"
|
||||
| "TMP_DIR"
|
||||
| "CSS_OUTPUT_FILE"
|
||||
| "HTML_OUTPUT_FILE"
|
||||
| "JS_OUTPUT_FILE";
|
||||
|
||||
type ComponentFiles = "COMPONENT_DIRS" | "DEFAULT_COMPONENT_DIRS";
|
||||
|
||||
type Paths = Record<PredefinedFile, string> & Record<ComponentFiles, string[]>;
|
||||
|
||||
declare class IdyllInstance extends EventEmitter {
|
||||
/**
|
||||
* Returns internal paths used by idyll-cli
|
||||
*/
|
||||
getPaths(): Paths;
|
||||
/**
|
||||
* Returns idyll compiling's options
|
||||
*/
|
||||
getOptions(): Options;
|
||||
/**
|
||||
*
|
||||
* if indexIdyllMarkup is provided, compiles it
|
||||
*
|
||||
* Otherwise, compiles and optionally watches
|
||||
* the idyll file at IOptions.inputFile
|
||||
*
|
||||
*/
|
||||
build(indexIdyllMarkup?: string | null): this;
|
||||
}
|
||||
|
||||
declare function idyll(options: Options, callback?: () => void): IdyllInstance;
|
||||
|
||||
export = idyll;
|
||||
16
types/idyll/tsconfig.json
Normal file
16
types/idyll/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": ["index.d.ts", "idyll-tests.ts"]
|
||||
}
|
||||
3
types/idyll/tslint.json
Normal file
3
types/idyll/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user