@types/ejs
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -142,33 +142,33 @@ // Type definitions for ejs 3.0 | ||
export class Template { | ||
/** | ||
* The EJS template source text. | ||
*/ | ||
readonly templateText: string; | ||
/** | ||
* The EJS template source text. | ||
*/ | ||
readonly templateText: string; | ||
/** | ||
* The compiled JavaScript function source, or the empty string | ||
* if the template hasn't been compiled yet. | ||
*/ | ||
readonly source: string; | ||
/** | ||
* The compiled JavaScript function source, or the empty string | ||
* if the template hasn't been compiled yet. | ||
*/ | ||
readonly source: string; | ||
constructor(text: string, opts?: Options); | ||
constructor(text: string, opts?: Options); | ||
/** | ||
* Compiles the EJS template. | ||
*/ | ||
compile(): TemplateFunction | AsyncTemplateFunction | ClientFunction | AsyncClientFunction; | ||
/** | ||
* Compiles the EJS template. | ||
*/ | ||
compile(): TemplateFunction | AsyncTemplateFunction | ClientFunction | AsyncClientFunction; | ||
} | ||
export namespace Template { | ||
enum modes { | ||
EVAL = 'eval', | ||
ESCAPED = 'escaped', | ||
RAW = 'raw', | ||
COMMENT = 'comment', | ||
LITERAL = 'literal' | ||
} | ||
enum modes { | ||
EVAL = 'eval', | ||
ESCAPED = 'escaped', | ||
RAW = 'raw', | ||
COMMENT = 'comment', | ||
LITERAL = 'literal' | ||
} | ||
} | ||
export interface Data { | ||
[name: string]: any; | ||
[name: string]: any; | ||
} | ||
@@ -211,6 +211,6 @@ | ||
export type ClientFunction = ( | ||
locals?: Data, | ||
escape?: EscapeCallback, | ||
include?: IncludeCallback, | ||
rethrow?: RethrowCallback, | ||
locals?: Data, | ||
escape?: EscapeCallback, | ||
include?: IncludeCallback, | ||
rethrow?: RethrowCallback, | ||
) => string; | ||
@@ -235,6 +235,6 @@ | ||
export type AsyncClientFunction = ( | ||
locals?: Data, | ||
escape?: EscapeCallback, | ||
include?: IncludeCallback, | ||
rethrow?: RethrowCallback, | ||
locals?: Data, | ||
escape?: EscapeCallback, | ||
include?: IncludeCallback, | ||
rethrow?: RethrowCallback, | ||
) => Promise<string>; | ||
@@ -264,7 +264,7 @@ | ||
export type RethrowCallback = ( | ||
err: Error, | ||
str: string, | ||
filename: string | null | undefined, | ||
lineno: number, | ||
esc: EscapeCallback, | ||
err: Error, | ||
str: string, | ||
filename: string | null | undefined, | ||
lineno: number, | ||
esc: EscapeCallback, | ||
) => never; | ||
@@ -282,174 +282,174 @@ | ||
export interface Options { | ||
/** | ||
* Log the generated JavaScript source for the EJS template to the console. | ||
* | ||
* @default false | ||
*/ | ||
debug?: boolean; | ||
/** | ||
* Log the generated JavaScript source for the EJS template to the console. | ||
* | ||
* @default false | ||
*/ | ||
debug?: boolean; | ||
/** | ||
* Include additional runtime debugging information in generated template | ||
* functions. | ||
* | ||
* @default true | ||
*/ | ||
compileDebug?: boolean; | ||
/** | ||
* Include additional runtime debugging information in generated template | ||
* functions. | ||
* | ||
* @default true | ||
*/ | ||
compileDebug?: boolean; | ||
/** | ||
* Whether or not to use `with () {}` construct in the generated template | ||
* functions. If set to `false`, data is still accessible through the object | ||
* whose name is specified by `ejs.localsName` (defaults to `locals`). | ||
* | ||
* @default true | ||
*/ | ||
_with?: boolean; | ||
/** | ||
* Whether or not to use `with () {}` construct in the generated template | ||
* functions. If set to `false`, data is still accessible through the object | ||
* whose name is specified by `ejs.localsName` (defaults to `locals`). | ||
* | ||
* @default true | ||
*/ | ||
_with?: boolean; | ||
/** | ||
* Whether to run in strict mode or not. | ||
* Enforces `_with=false`. | ||
* | ||
* @default false | ||
*/ | ||
strict?: boolean; | ||
/** | ||
* Whether to run in strict mode or not. | ||
* Enforces `_with=false`. | ||
* | ||
* @default false | ||
*/ | ||
strict?: boolean; | ||
/** | ||
* An array of local variables that are always destructured from `localsName`, | ||
* available even in strict mode. | ||
* | ||
* @default [] | ||
*/ | ||
destructuredLocals?: string[]; | ||
/** | ||
* An array of local variables that are always destructured from `localsName`, | ||
* available even in strict mode. | ||
* | ||
* @default [] | ||
*/ | ||
destructuredLocals?: string[]; | ||
/** | ||
* Remove all safe-to-remove whitespace, including leading and trailing | ||
* whitespace. It also enables a safer version of `-%>` line slurping for all | ||
* scriptlet tags (it does not strip new lines of tags in the middle of a | ||
* line). | ||
* | ||
* @default false | ||
*/ | ||
rmWhitespace?: boolean; | ||
/** | ||
* Remove all safe-to-remove whitespace, including leading and trailing | ||
* whitespace. It also enables a safer version of `-%>` line slurping for all | ||
* scriptlet tags (it does not strip new lines of tags in the middle of a | ||
* line). | ||
* | ||
* @default false | ||
*/ | ||
rmWhitespace?: boolean; | ||
/** | ||
* Whether or not to compile a `ClientFunction` that can be rendered | ||
* in the browser without depending on ejs.js. Otherwise, a `TemplateFunction` | ||
* will be compiled. | ||
* | ||
* @default false | ||
*/ | ||
client?: boolean; | ||
/** | ||
* Whether or not to compile a `ClientFunction` that can be rendered | ||
* in the browser without depending on ejs.js. Otherwise, a `TemplateFunction` | ||
* will be compiled. | ||
* | ||
* @default false | ||
*/ | ||
client?: boolean; | ||
/** | ||
* The escaping function used with `<%=` construct. It is used in rendering | ||
* and is `.toString()`ed in the generation of client functions. | ||
* | ||
* @default ejs.escapeXML | ||
*/ | ||
escape?: EscapeCallback; | ||
/** | ||
* The escaping function used with `<%=` construct. It is used in rendering | ||
* and is `.toString()`ed in the generation of client functions. | ||
* | ||
* @default ejs.escapeXML | ||
*/ | ||
escape?: EscapeCallback; | ||
/** | ||
* The filename of the template. Required for inclusion and caching unless | ||
* you are using `renderFile`. Also used for error reporting. | ||
* | ||
* @default undefined | ||
*/ | ||
filename?: string; | ||
/** | ||
* The filename of the template. Required for inclusion and caching unless | ||
* you are using `renderFile`. Also used for error reporting. | ||
* | ||
* @default undefined | ||
*/ | ||
filename?: string; | ||
/** | ||
* The path to the project root. When this is set, absolute paths for includes | ||
* (/filename.ejs) will be relative to the project root. | ||
* | ||
* @default undefined | ||
*/ | ||
root?: string; | ||
/** | ||
* The path to the project root. When this is set, absolute paths for includes | ||
* (/filename.ejs) will be relative to the project root. | ||
* | ||
* @default undefined | ||
*/ | ||
root?: string; | ||
/** | ||
* The opening delimiter for all statements. This allows you to clearly delinate | ||
* the difference between template code and existing delimiters. (It is recommended | ||
* to synchronize this with the closeDelimiter property.) | ||
* | ||
* @default ejs.openDelimiter | ||
*/ | ||
openDelimiter?: string; | ||
/** | ||
* The opening delimiter for all statements. This allows you to clearly delinate | ||
* the difference between template code and existing delimiters. (It is recommended | ||
* to synchronize this with the closeDelimiter property.) | ||
* | ||
* @default ejs.openDelimiter | ||
*/ | ||
openDelimiter?: string; | ||
/** | ||
* The closing delimiter for all statements. This allows to to clearly delinate | ||
* the difference between template code and existing delimiters. (It is recommended | ||
* to synchronize this with the openDelimiter property.) | ||
* | ||
* @default ejs.closeDelimiter | ||
*/ | ||
closeDelimiter?: string; | ||
/** | ||
* The closing delimiter for all statements. This allows to to clearly delinate | ||
* the difference between template code and existing delimiters. (It is recommended | ||
* to synchronize this with the openDelimiter property.) | ||
* | ||
* @default ejs.closeDelimiter | ||
*/ | ||
closeDelimiter?: string; | ||
/** | ||
* Character to use with angle brackets for open/close | ||
* @default '%' | ||
*/ | ||
delimiter?: string; | ||
/** | ||
* Character to use with angle brackets for open/close | ||
* @default '%' | ||
*/ | ||
delimiter?: string; | ||
/** | ||
* Whether or not to enable caching of template functions. Beware that | ||
* the options of compilation are not checked as being the same, so | ||
* special handling is required if, for example, you want to cache client | ||
* and regular functions of the same file. | ||
* | ||
* Requires `filename` to be set. Only works with rendering function. | ||
* | ||
* @default false | ||
*/ | ||
cache?: boolean; | ||
/** | ||
* Whether or not to enable caching of template functions. Beware that | ||
* the options of compilation are not checked as being the same, so | ||
* special handling is required if, for example, you want to cache client | ||
* and regular functions of the same file. | ||
* | ||
* Requires `filename` to be set. Only works with rendering function. | ||
* | ||
* @default false | ||
*/ | ||
cache?: boolean; | ||
/** | ||
* The Object to which `this` is set during rendering. | ||
* | ||
* @default this | ||
*/ | ||
context?: any; | ||
/** | ||
* The Object to which `this` is set during rendering. | ||
* | ||
* @default this | ||
*/ | ||
context?: any; | ||
/** | ||
* Whether or not to create an async function instead of a regular function. | ||
* This requires language support. | ||
* | ||
* @default false | ||
*/ | ||
async?: boolean; | ||
/** | ||
* Whether or not to create an async function instead of a regular function. | ||
* This requires language support. | ||
* | ||
* @default false | ||
*/ | ||
async?: boolean; | ||
/** | ||
* Make sure to set this to 'false' in order to skip UglifyJS parsing, | ||
* when using ES6 features (`const`, etc) as UglifyJS doesn't understand them. | ||
* @default true | ||
*/ | ||
beautify?: boolean; | ||
/** | ||
* Make sure to set this to 'false' in order to skip UglifyJS parsing, | ||
* when using ES6 features (`const`, etc) as UglifyJS doesn't understand them. | ||
* @default true | ||
*/ | ||
beautify?: boolean; | ||
/** | ||
* Name to use for the object storing local variables when not using `with` or destructuring. | ||
* | ||
* @default ejs.localsName | ||
*/ | ||
localsName?: string; | ||
/** | ||
* Name to use for the object storing local variables when not using `with` or destructuring. | ||
* | ||
* @default ejs.localsName | ||
*/ | ||
localsName?: string; | ||
/** Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags. */ | ||
outputFunctionName?: string; | ||
/** Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags. */ | ||
outputFunctionName?: string; | ||
} | ||
export interface Cache { | ||
/** | ||
* Cache the intermediate JavaScript function for a template. | ||
* | ||
* @param key key for caching | ||
* @param val cached function | ||
*/ | ||
set(key: string, val: TemplateFunction): void; | ||
/** | ||
* Cache the intermediate JavaScript function for a template. | ||
* | ||
* @param key key for caching | ||
* @param val cached function | ||
*/ | ||
set(key: string, val: TemplateFunction): void; | ||
/** | ||
* Get the cached intermediate JavaScript function for a template. | ||
* | ||
* @param key key for caching | ||
*/ | ||
get(key: string): TemplateFunction | undefined; | ||
/** | ||
* Get the cached intermediate JavaScript function for a template. | ||
* | ||
* @param key key for caching | ||
*/ | ||
get(key: string): TemplateFunction | undefined; | ||
/** | ||
* Clear the entire cache. | ||
*/ | ||
reset(): void; | ||
/** | ||
* Clear the entire cache. | ||
*/ | ||
reset(): void; | ||
} |
{ | ||
"name": "@types/ejs", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "TypeScript definitions for ejs", | ||
@@ -32,4 +32,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "ef2751b7823838da6ad76241e2139cca54f4c55ecc34ab577eb767db63fad61d", | ||
"typeScriptVersion": "2.8" | ||
"typesPublisherContentHash": "94966743a8ad702ed4f6aeadedbbbe6dbad7fd2ba1130705ddc325e08d857b9b", | ||
"typeScriptVersion": "3.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 27 Apr 2020 09:16:56 GMT | ||
* Last updated: Fri, 15 May 2020 04:09:15 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: `ejs` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16098