Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/nunjucks

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/nunjucks - npm Package Compare versions

Comparing version 0.0.33 to 3.0.0

227

nunjucks/index.d.ts

@@ -1,148 +0,139 @@

// Type definitions for nunjucks
// Type definitions for nunjucks 3.0
// Project: http://mozilla.github.io/nunjucks/
// Definitions by: Ruben Slabbert <https://github.com/RubenSlabbert>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export function render(name: string, context?: object): string;
export function render(name: string, context?: object, callback?: (err: any, res: string) => any): void;
declare namespace Nunjucks {
function render(name: string, context?: Object): string;
function render(name: string, context?: Object, callback?: (err: any, res: string) => any): void;
export function renderString(src: string, context: object): string;
export function renderString(src: string, context: object, callback?: (err: any, res: string) => any): void;
function renderString(src: string, context: Object): string;
function renderString(src: string, context: Object, callback?: (err: any, res: string) => any): void;
export function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template;
function compile(src: string, env?: Environment): Template;
function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template;
export function precompile(path: string, opts?: PrecompileOptions): string;
export function precompileString(src: string, opts?: PrecompileOptions): string;
function precompile(path: string, opts?: PrecompileOptions): string;
function precompileString(src: string, opts?: PrecompileOptions): string;
export interface PrecompileOptions {
name?: string;
asFunction?: boolean;
force?: boolean;
env?: Environment;
include?: string[];
exclude?: string[];
wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string;
}
interface PrecompileOptions {
name?: string;
asFunction?: boolean;
force?: boolean;
env?: Environment;
include?: string[];
exclude?: string[];
wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string;
}
export class Template {
constructor(src: string, env?: Environment, eagerCompile?: boolean);
render(context?: object): string;
render(context?: object, callback?: (err: any, res: string) => any): void;
}
class Template {
constructor(src: string, env?: Environment, eagerCompile?: boolean);
render(context?: Object): string;
render(context?: Object, callback?: (err: any, res: string) => any): void;
}
export function configure(options: ConfigureOptions): Environment;
export function configure(path: string | string[], options?: ConfigureOptions): Environment;
function configure(options: ConfigureOptions): Environment;
function configure(path: string, options?: ConfigureOptions): Environment;
function configure(path: string[], options?: ConfigureOptions): Environment;
export interface ConfigureOptions {
autoescape?: boolean;
throwOnUndefined?: boolean;
trimBlocks?: boolean;
lstripBlocks?: boolean;
watch?: boolean;
noCache?: boolean;
web?: {
useCache?: boolean,
async?: boolean
};
express?: object;
tags?: {
blockStart?: string,
blockEnd?: string,
variableStart?: string,
variableEnd?: string,
commentStart?: string,
commentEnd?: string
};
}
interface ConfigureOptions {
autoescape?: boolean;
throwOnUndefined?: boolean;
trimBlocks?: boolean;
lstripBlocks?: boolean;
watch?: boolean;
noCache?: boolean;
web?: {
useCache?: boolean,
async?: boolean
};
express?: Object;
tags?: {
blockStart?: string,
blockEnd?: string,
variableStart?: string,
variableEnd?: string,
commentStart?: string,
commentEnd?: string
};
}
export class Environment {
options: {
autoescape: boolean;
};
class Environment {
options: {
autoescape: boolean;
};
constructor(loader?: ILoader | ILoader[] | null, opts?: ConfigureOptions);
render(name: string, context?: object): string;
render(name: string, context?: object, callback?: (err: any, res: string) => any): void;
constructor();
constructor(loader: ILoader, opts?: ConfigureOptions);
constructor(loaders: ILoader[], opts?: ConfigureOptions);
renderString(name: string, context: object): string;
renderString(name: string, context: object, callback?: (err: any, res: string) => any): void;
render(name: string, context?: Object): string;
render(name: string, context?: Object, callback?: (err: any, res: string) => any): void;
addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void;
getFilter(name: string): void;
renderString(name: string, context: Object): string;
renderString(name: string, context: Object, callback?: (err: any, res: string) => any): void;
addExtension(name: string, ext: Extension): void;
removeExtension(name: string): void;
getExtension(name: string): Extension;
hasExtension(name: string): void;
addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void;
getFilter(name: string): void;
addGlobal(name: string, value: any): void;
addExtension(name: string, ext: Extension): void;
removeExtension(name: string): void;
getExtension(name: string): Extension;
hasExtension(name: string): void;
getTemplate(name: string, eagerCompile?: boolean): Template;
getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void;
addGlobal(name: string, value: any): void;
express(app: object): void;
}
getTemplate(name: string, eagerCompile?: boolean): Template;
getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void;
export interface Extension {
tags: string[];
// Parser API is undocumented it is suggested to check the source: https://github.com/mozilla/nunjucks/blob/master/src/parser.js
parse(parser: any, nodes: any, lexer: any): any;
}
express(app: Object): void;
}
export function installJinjaCompat(): void;
interface Extension {
tags: string[];
// Parser API is undocumented it is suggested to check the source: https://github.com/mozilla/nunjucks/blob/master/src/parser.js
parse(parser: any, nodes: any, lexer: any): any;
}
export interface ILoader {
async?: boolean;
getSource(name: string): LoaderSource;
extend?(extender: ILoader): ILoader;
}
function installJinjaCompat(): void;
// Needs both Loader and ILoader since nunjucks uses a custom object system
// Object system is also responsible for the extend methods
export class Loader {
on(name: string, func: (...args: any[]) => any): void;
emit(name: string, ...args: any[]): void;
resolve(from: string, to: string): string;
isRelative(filename: string): boolean;
extend(toExtend: ILoader): ILoader;
}
interface ILoader {
async?: boolean;
getSource(name: string): LoaderSource;
extend?(extender: ILoader): ILoader;
}
export interface LoaderSource {
src: string;
path: string;
noCache: boolean;
}
// Needs both Loader and ILoader since nunjucks uses a custom object system
// Object system is also responsible for the extend methods
class Loader {
on(name: string, func: (...args: any[]) => any): void;
emit(name: string, ...args: any[]): void;
resolve(from: string, to: string): string;
isRelative(filename: string): boolean;
extend(toExtend: ILoader): ILoader;
}
export interface FileSystemLoaderOptions {
/** if true, the system will automatically update templates when they are changed on the filesystem */
watch?: boolean;
interface LoaderSource {
src: string;
path: string;
noCache: boolean;
}
/** if true, the system will avoid using a cache and templates will be recompiled every single time */
noCache?: boolean;
}
interface FileSystemLoaderOptions {
/** if true, the system will automatically update templates when they are changed on the filesystem */
watch?: boolean;
export class FileSystemLoader extends Loader implements ILoader {
init(searchPaths: string[], opts: any): void;
getSource(name: string): LoaderSource;
constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions);
}
/** if true, the system will avoid using a cache and templates will be recompiled every single time */
noCache?: boolean;
}
export class WebLoader implements ILoader {
constructor(baseUrl: string, opts?: any);
getSource(name: string): LoaderSource;
}
class FileSystemLoader extends Loader implements ILoader {
init(searchPaths: string[], opts: any): void;
getSource(name: string): LoaderSource;
constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions);
}
export class WebLoader implements ILoader {
constructor(baseUrl: string, opts?: any);
getSource(name: string): LoaderSource;
}
class PrecompiledLoader extends Loader implements ILoader {
init(searchPaths: string[], opts: any): void;
getSource(name: string): LoaderSource;
}
export class PrecompiledLoader extends Loader implements ILoader {
init(searchPaths: string[], opts: any): void;
getSource(name: string): LoaderSource;
}
export = Nunjucks;
{
"name": "@types/nunjucks",
"version": "0.0.33",
"version": "3.0.0",
"description": "TypeScript definitions for nunjucks",

@@ -9,3 +9,4 @@ "license": "MIT",

"name": "Ruben Slabbert",
"url": "https://github.com/RubenSlabbert"
"url": "https://github.com/RubenSlabbert",
"githubUsername": "RubenSlabbert"
}

@@ -20,4 +21,4 @@ ],

"dependencies": {},
"typesPublisherContentHash": "1e90380e3fce6d869fdcc50d3547855a223e23bf031b649ee6502c1f133a951e",
"typeScriptVersion": "2.0"
"typesPublisherContentHash": "0ccc7ee5e02090044d73de410cd7f64e401e318b6244ccccf97b822fb2833205",
"typeScriptVersion": "2.2"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Mon, 21 Aug 2017 21:59:27 GMT
* Last updated: Tue, 07 Nov 2017 08:18:22 GMT
* Dependencies: none

@@ -14,0 +14,0 @@ * Global values: none

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc