handlebars-jaylinski 4.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/LICENSE +19 -0
  2. package/README.markdown +169 -0
  3. package/bin/.eslintrc.js +6 -0
  4. package/bin/handlebars +176 -0
  5. package/dist/amd/handlebars/base.js +106 -0
  6. package/dist/amd/handlebars/compiler/ast.js +31 -0
  7. package/dist/amd/handlebars/compiler/base.js +45 -0
  8. package/dist/amd/handlebars/compiler/code-gen.js +165 -0
  9. package/dist/amd/handlebars/compiler/compiler.js +562 -0
  10. package/dist/amd/handlebars/compiler/helpers.js +228 -0
  11. package/dist/amd/handlebars/compiler/javascript-compiler.js +1150 -0
  12. package/dist/amd/handlebars/compiler/parser.js +737 -0
  13. package/dist/amd/handlebars/compiler/printer.js +186 -0
  14. package/dist/amd/handlebars/compiler/visitor.js +138 -0
  15. package/dist/amd/handlebars/compiler/whitespace-control.js +219 -0
  16. package/dist/amd/handlebars/decorators/inline.js +25 -0
  17. package/dist/amd/handlebars/decorators.js +16 -0
  18. package/dist/amd/handlebars/exception.js +64 -0
  19. package/dist/amd/handlebars/helpers/block-helper-missing.js +35 -0
  20. package/dist/amd/handlebars/helpers/each.js +99 -0
  21. package/dist/amd/handlebars/helpers/helper-missing.js +22 -0
  22. package/dist/amd/handlebars/helpers/if.js +41 -0
  23. package/dist/amd/handlebars/helpers/log.js +24 -0
  24. package/dist/amd/handlebars/helpers/lookup.js +14 -0
  25. package/dist/amd/handlebars/helpers/with.js +38 -0
  26. package/dist/amd/handlebars/helpers.js +44 -0
  27. package/dist/amd/handlebars/internal/create-new-lookup-object.js +22 -0
  28. package/dist/amd/handlebars/internal/proto-access.js +71 -0
  29. package/dist/amd/handlebars/internal/wrapHelper.js +21 -0
  30. package/dist/amd/handlebars/logger.js +44 -0
  31. package/dist/amd/handlebars/no-conflict.js +28 -0
  32. package/dist/amd/handlebars/runtime.js +356 -0
  33. package/dist/amd/handlebars/safe-string.js +15 -0
  34. package/dist/amd/handlebars/utils.js +126 -0
  35. package/dist/amd/handlebars.js +52 -0
  36. package/dist/amd/handlebars.runtime.js +44 -0
  37. package/dist/amd/precompiler.js +314 -0
  38. package/dist/cjs/handlebars/base.js +116 -0
  39. package/dist/cjs/handlebars/compiler/ast.js +31 -0
  40. package/dist/cjs/handlebars/compiler/base.js +57 -0
  41. package/dist/cjs/handlebars/compiler/code-gen.js +168 -0
  42. package/dist/cjs/handlebars/compiler/compiler.js +566 -0
  43. package/dist/cjs/handlebars/compiler/helpers.js +228 -0
  44. package/dist/cjs/handlebars/compiler/javascript-compiler.js +1158 -0
  45. package/dist/cjs/handlebars/compiler/parser.js +737 -0
  46. package/dist/cjs/handlebars/compiler/printer.js +186 -0
  47. package/dist/cjs/handlebars/compiler/visitor.js +140 -0
  48. package/dist/cjs/handlebars/compiler/whitespace-control.js +221 -0
  49. package/dist/cjs/handlebars/decorators/inline.js +29 -0
  50. package/dist/cjs/handlebars/decorators.js +16 -0
  51. package/dist/cjs/handlebars/exception.js +64 -0
  52. package/dist/cjs/handlebars/helpers/block-helper-missing.js +39 -0
  53. package/dist/cjs/handlebars/helpers/each.js +104 -0
  54. package/dist/cjs/handlebars/helpers/helper-missing.js +25 -0
  55. package/dist/cjs/handlebars/helpers/if.js +46 -0
  56. package/dist/cjs/handlebars/helpers/log.js +26 -0
  57. package/dist/cjs/handlebars/helpers/lookup.js +16 -0
  58. package/dist/cjs/handlebars/helpers/with.js +43 -0
  59. package/dist/cjs/handlebars/helpers.js +56 -0
  60. package/dist/cjs/handlebars/internal/create-new-lookup-object.js +22 -0
  61. package/dist/cjs/handlebars/internal/proto-access.js +73 -0
  62. package/dist/cjs/handlebars/internal/wrapHelper.js +19 -0
  63. package/dist/cjs/handlebars/logger.js +47 -0
  64. package/dist/cjs/handlebars/no-conflict.js +30 -0
  65. package/dist/cjs/handlebars/runtime.js +372 -0
  66. package/dist/cjs/handlebars/safe-string.js +15 -0
  67. package/dist/cjs/handlebars/utils.js +124 -0
  68. package/dist/cjs/handlebars.js +66 -0
  69. package/dist/cjs/handlebars.runtime.js +66 -0
  70. package/dist/cjs/precompiler.js +328 -0
  71. package/dist/handlebars.amd.js +4639 -0
  72. package/dist/handlebars.amd.min.js +29 -0
  73. package/dist/handlebars.js +5972 -0
  74. package/dist/handlebars.min.js +29 -0
  75. package/dist/handlebars.runtime.amd.js +1302 -0
  76. package/dist/handlebars.runtime.amd.min.js +27 -0
  77. package/dist/handlebars.runtime.js +2563 -0
  78. package/dist/handlebars.runtime.min.js +27 -0
  79. package/lib/.eslintrc.js +8 -0
  80. package/lib/handlebars/base.js +94 -0
  81. package/lib/handlebars/compiler/ast.js +32 -0
  82. package/lib/handlebars/compiler/base.js +34 -0
  83. package/lib/handlebars/compiler/code-gen.js +171 -0
  84. package/lib/handlebars/compiler/compiler.js +594 -0
  85. package/lib/handlebars/compiler/helpers.js +219 -0
  86. package/lib/handlebars/compiler/javascript-compiler.js +1293 -0
  87. package/lib/handlebars/compiler/parser.js +622 -0
  88. package/lib/handlebars/compiler/printer.js +178 -0
  89. package/lib/handlebars/compiler/visitor.js +136 -0
  90. package/lib/handlebars/compiler/whitespace-control.js +234 -0
  91. package/lib/handlebars/decorators/inline.js +22 -0
  92. package/lib/handlebars/decorators.js +5 -0
  93. package/lib/handlebars/exception.js +68 -0
  94. package/lib/handlebars/helpers/block-helper-missing.js +35 -0
  95. package/lib/handlebars/helpers/each.js +101 -0
  96. package/lib/handlebars/helpers/helper-missing.js +15 -0
  97. package/lib/handlebars/helpers/if.js +33 -0
  98. package/lib/handlebars/helpers/log.js +19 -0
  99. package/lib/handlebars/helpers/lookup.js +9 -0
  100. package/lib/handlebars/helpers/with.js +39 -0
  101. package/lib/handlebars/helpers.js +26 -0
  102. package/lib/handlebars/internal/create-new-lookup-object.js +11 -0
  103. package/lib/handlebars/internal/proto-access.js +70 -0
  104. package/lib/handlebars/internal/wrapHelper.js +13 -0
  105. package/lib/handlebars/logger.js +39 -0
  106. package/lib/handlebars/no-conflict.js +23 -0
  107. package/lib/handlebars/runtime.js +450 -0
  108. package/lib/handlebars/safe-string.js +10 -0
  109. package/lib/handlebars/utils.js +116 -0
  110. package/lib/handlebars.js +46 -0
  111. package/lib/handlebars.runtime.js +37 -0
  112. package/lib/index.js +26 -0
  113. package/lib/precompiler.js +341 -0
  114. package/package.json +135 -0
  115. package/release-notes.md +1101 -0
  116. package/runtime.d.ts +5 -0
  117. package/runtime.js +3 -0
  118. package/types/index.d.ts +422 -0
package/runtime.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import Handlebars = require('handlebars')
2
+
3
+ declare module "handlebars/runtime" {
4
+
5
+ }
package/runtime.js ADDED
@@ -0,0 +1,3 @@
1
+ // Create a simple path alias to allow browserify to resolve
2
+ // the runtime on a supported path.
3
+ module.exports = require('./dist/cjs/handlebars.runtime')['default'];
@@ -0,0 +1,422 @@
1
+ /* These definitions were imported from https://github.com/DefinitelyTyped/DefinitelyTyped
2
+ * and includes previous contributions from the DefinitelyTyped community by:
3
+ * - Albert Willemsen <https://github.com/AlbertWillemsen-Centric>
4
+ * - Boris Yankov <https://github.com/borisyankov>
5
+ * - Jessica Franco <https://github.com/Kovensky>
6
+ * - Masahiro Wakame <https://github.com/vvakame>
7
+ * - Raanan Weber <https://github.com/RaananW>
8
+ * - Sergei Dorogin <https://github.com/evil-shrike>
9
+ * - webbiesdk <https://github.com/webbiesdk>
10
+ * - Andrew Leedham <https://github.com/AndrewLeedham>
11
+ * - Nils Knappmeier <https://github.com/nknapp>
12
+ * For full history prior to their migration to handlebars.js, please see:
13
+ * https://github.com/DefinitelyTyped/DefinitelyTyped/commits/1ce60bdc07f10e0b076778c6c953271c072bc894/types/handlebars/index.d.ts
14
+ */
15
+ // TypeScript Version: 2.3
16
+
17
+ declare namespace Handlebars {
18
+ export interface TemplateDelegate<T = any> {
19
+ (context: T, options?: RuntimeOptions): string;
20
+ }
21
+
22
+ export type Template<T = any> = TemplateDelegate<T>|string;
23
+
24
+ export interface RuntimeOptions {
25
+ partial?: boolean;
26
+ depths?: any[];
27
+ helpers?: { [name: string]: Function };
28
+ partials?: { [name: string]: HandlebarsTemplateDelegate };
29
+ decorators?: { [name: string]: Function };
30
+ data?: any;
31
+ blockParams?: any[];
32
+ allowCallsToHelperMissing?: boolean;
33
+ allowedProtoProperties?: { [name: string]: boolean };
34
+ allowedProtoMethods?: { [name: string]: boolean };
35
+ allowProtoPropertiesByDefault?: boolean;
36
+ allowProtoMethodsByDefault?: boolean;
37
+ }
38
+
39
+ export interface HelperOptions {
40
+ fn: TemplateDelegate;
41
+ inverse: TemplateDelegate;
42
+ hash: any;
43
+ data?: any;
44
+ }
45
+
46
+ export interface HelperDelegate {
47
+ (context?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, options?: HelperOptions): any;
48
+ }
49
+ export interface HelperDeclareSpec {
50
+ [key: string]: HelperDelegate;
51
+ }
52
+
53
+ export interface ParseOptions {
54
+ srcName?: string;
55
+ ignoreStandalone?: boolean;
56
+ }
57
+
58
+ export function registerHelper(name: string, fn: HelperDelegate): void;
59
+ export function registerHelper(name: HelperDeclareSpec): void;
60
+ export function unregisterHelper(name: string): void;
61
+
62
+ export function registerPartial(name: string, fn: Template): void;
63
+ export function registerPartial(spec: { [name: string]: HandlebarsTemplateDelegate }): void;
64
+ export function unregisterPartial(name: string): void;
65
+
66
+ // TODO: replace Function with actual signature
67
+ export function registerDecorator(name: string, fn: Function): void;
68
+ export function unregisterDecorator(name: string): void;
69
+
70
+ export function K(): void;
71
+ export function createFrame(object: any): any;
72
+ export function blockParams(obj: any[], ids: any[]): any[];
73
+ export function log(level: number, obj: any): void;
74
+ export function parse(input: string, options?: ParseOptions): hbs.AST.Program;
75
+ export function parseWithoutProcessing(input: string, options?: ParseOptions): hbs.AST.Program;
76
+ export function compile<T = any>(input: any, options?: CompileOptions): HandlebarsTemplateDelegate<T>;
77
+ export function precompile(input: any, options?: PrecompileOptions): TemplateSpecification;
78
+ export function template<T = any>(precompilation: TemplateSpecification): HandlebarsTemplateDelegate<T>;
79
+
80
+ export function create(): typeof Handlebars;
81
+
82
+ export const escapeExpression: typeof Utils.escapeExpression;
83
+ //export const Utils: typeof hbs.Utils;
84
+ export const logger: Logger;
85
+ export const templates: HandlebarsTemplates;
86
+ export const helpers: { [name: string]: HelperDelegate };
87
+ export const partials: { [name: string]: any };
88
+ // TODO: replace Function with actual signature
89
+ export const decorators: { [name: string]: Function };
90
+
91
+ export const VERSION: string;
92
+
93
+ export function noConflict(): typeof Handlebars;
94
+
95
+ export class Exception {
96
+ constructor(message: string, node?: hbs.AST.Node);
97
+ description: string;
98
+ fileName: string;
99
+ lineNumber?: any;
100
+ endLineNumber?: any;
101
+ message: string;
102
+ name: string;
103
+ number: number;
104
+ stack?: string;
105
+ column?: any;
106
+ endColumn?: any;
107
+ }
108
+
109
+ export class SafeString {
110
+ constructor(str: string);
111
+ toString(): string;
112
+ toHTML(): string;
113
+ }
114
+
115
+ export namespace Utils {
116
+ export function escapeExpression(str: string): string;
117
+ export function createFrame(object: any): any;
118
+ export function blockParams(obj: any[], ids: any[]): any[];
119
+ export function isEmpty(obj: any) : boolean;
120
+ export function extend(obj: any, ...source: any[]): any;
121
+ export function toString(obj: any): string;
122
+ export function isArray(obj: any): boolean;
123
+ export function isFunction(obj: any): boolean;
124
+ }
125
+
126
+ export namespace AST {
127
+ export const helpers: hbs.AST.helpers;
128
+ }
129
+
130
+ interface ICompiler {
131
+ accept(node: hbs.AST.Node): void;
132
+ Program(program: hbs.AST.Program): void;
133
+ BlockStatement(block: hbs.AST.BlockStatement): void;
134
+ PartialStatement(partial: hbs.AST.PartialStatement): void;
135
+ PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void;
136
+ DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void;
137
+ Decorator(decorator: hbs.AST.Decorator): void;
138
+ MustacheStatement(mustache: hbs.AST.MustacheStatement): void;
139
+ ContentStatement(content: hbs.AST.ContentStatement): void;
140
+ CommentStatement(comment?: hbs.AST.CommentStatement): void;
141
+ SubExpression(sexpr: hbs.AST.SubExpression): void;
142
+ PathExpression(path: hbs.AST.PathExpression): void;
143
+ StringLiteral(str: hbs.AST.StringLiteral): void;
144
+ NumberLiteral(num: hbs.AST.NumberLiteral): void;
145
+ BooleanLiteral(bool: hbs.AST.BooleanLiteral): void;
146
+ UndefinedLiteral(): void;
147
+ NullLiteral(): void;
148
+ Hash(hash: hbs.AST.Hash): void;
149
+ }
150
+
151
+ export class Visitor implements ICompiler {
152
+ accept(node: hbs.AST.Node): void;
153
+ acceptKey(node: hbs.AST.Node, name: string): void;
154
+ acceptArray(arr: hbs.AST.Expression[]): void;
155
+ Program(program: hbs.AST.Program): void;
156
+ BlockStatement(block: hbs.AST.BlockStatement): void;
157
+ PartialStatement(partial: hbs.AST.PartialStatement): void;
158
+ PartialBlockStatement(partial: hbs.AST.PartialBlockStatement): void;
159
+ DecoratorBlock(decorator: hbs.AST.DecoratorBlock): void;
160
+ Decorator(decorator: hbs.AST.Decorator): void;
161
+ MustacheStatement(mustache: hbs.AST.MustacheStatement): void;
162
+ ContentStatement(content: hbs.AST.ContentStatement): void;
163
+ CommentStatement(comment?: hbs.AST.CommentStatement): void;
164
+ SubExpression(sexpr: hbs.AST.SubExpression): void;
165
+ PathExpression(path: hbs.AST.PathExpression): void;
166
+ StringLiteral(str: hbs.AST.StringLiteral): void;
167
+ NumberLiteral(num: hbs.AST.NumberLiteral): void;
168
+ BooleanLiteral(bool: hbs.AST.BooleanLiteral): void;
169
+ UndefinedLiteral(): void;
170
+ NullLiteral(): void;
171
+ Hash(hash: hbs.AST.Hash): void;
172
+ }
173
+
174
+
175
+ export interface ResolvePartialOptions {
176
+ name: string;
177
+ helpers?: { [name: string]: Function };
178
+ partials?: { [name: string]: HandlebarsTemplateDelegate };
179
+ decorators?: { [name: string]: Function };
180
+ data?: any;
181
+ }
182
+
183
+ export namespace VM {
184
+ /**
185
+ * @deprecated
186
+ */
187
+ export function resolvePartial<T = any>(partial: HandlebarsTemplateDelegate<T> | undefined, context: any, options: ResolvePartialOptions): HandlebarsTemplateDelegate<T>;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Implement this interface on your MVW/MVVM/MVC views such as Backbone.View
193
+ **/
194
+ interface HandlebarsTemplatable {
195
+ template: HandlebarsTemplateDelegate;
196
+ }
197
+
198
+ // NOTE: for backward compatibility of this typing
199
+ type HandlebarsTemplateDelegate<T = any> = Handlebars.TemplateDelegate<T>;
200
+
201
+ interface HandlebarsTemplates {
202
+ [index: string]: HandlebarsTemplateDelegate;
203
+ }
204
+
205
+ interface TemplateSpecification {
206
+
207
+ }
208
+
209
+ // for backward compatibility of this typing
210
+ type RuntimeOptions = Handlebars.RuntimeOptions;
211
+
212
+ interface CompileOptions {
213
+ data?: boolean;
214
+ compat?: boolean;
215
+ knownHelpers?: KnownHelpers;
216
+ knownHelpersOnly?: boolean;
217
+ noEscape?: boolean;
218
+ strict?: boolean;
219
+ assumeObjects?: boolean;
220
+ preventIndent?: boolean;
221
+ ignoreStandalone?: boolean;
222
+ explicitPartialContext?: boolean;
223
+ }
224
+
225
+ type KnownHelpers = {
226
+ [name in BuiltinHelperName | CustomHelperName]: boolean;
227
+ };
228
+
229
+ type BuiltinHelperName =
230
+ "helperMissing"|
231
+ "blockHelperMissing"|
232
+ "each"|
233
+ "if"|
234
+ "unless"|
235
+ "with"|
236
+ "log"|
237
+ "lookup";
238
+
239
+ type CustomHelperName = string;
240
+
241
+ interface PrecompileOptions extends CompileOptions {
242
+ srcName?: string;
243
+ destName?: string;
244
+ }
245
+
246
+ declare namespace hbs {
247
+ // for backward compatibility of this typing
248
+ type SafeString = Handlebars.SafeString;
249
+
250
+ type Utils = typeof Handlebars.Utils;
251
+ }
252
+
253
+ interface Logger {
254
+ DEBUG: number;
255
+ INFO: number;
256
+ WARN: number;
257
+ ERROR: number;
258
+ level: number;
259
+
260
+ methodMap: { [level: number]: string };
261
+
262
+ log(level: number, obj: string): void;
263
+ }
264
+
265
+ type CompilerInfo = [number/* revision */, string /* versions */];
266
+
267
+ declare namespace hbs {
268
+ namespace AST {
269
+ interface Node {
270
+ type: string;
271
+ loc: SourceLocation;
272
+ }
273
+
274
+ interface SourceLocation {
275
+ source: string;
276
+ start: Position;
277
+ end: Position;
278
+ }
279
+
280
+ interface Position {
281
+ line: number;
282
+ column: number;
283
+ }
284
+
285
+ interface Program extends Node {
286
+ body: Statement[];
287
+ blockParams: string[];
288
+ }
289
+
290
+ interface Statement extends Node {}
291
+
292
+ interface MustacheStatement extends Statement {
293
+ type: 'MustacheStatement';
294
+ path: PathExpression | Literal;
295
+ params: Expression[];
296
+ hash: Hash;
297
+ escaped: boolean;
298
+ strip: StripFlags;
299
+ }
300
+
301
+ interface Decorator extends MustacheStatement { }
302
+
303
+ interface BlockStatement extends Statement {
304
+ type: 'BlockStatement';
305
+ path: PathExpression;
306
+ params: Expression[];
307
+ hash: Hash;
308
+ program: Program;
309
+ inverse: Program;
310
+ openStrip: StripFlags;
311
+ inverseStrip: StripFlags;
312
+ closeStrip: StripFlags;
313
+ }
314
+
315
+ interface DecoratorBlock extends BlockStatement { }
316
+
317
+ interface PartialStatement extends Statement {
318
+ type: 'PartialStatement';
319
+ name: PathExpression | SubExpression;
320
+ params: Expression[];
321
+ hash: Hash;
322
+ indent: string;
323
+ strip: StripFlags;
324
+ }
325
+
326
+ interface PartialBlockStatement extends Statement {
327
+ type: 'PartialBlockStatement';
328
+ name: PathExpression | SubExpression;
329
+ params: Expression[];
330
+ hash: Hash;
331
+ program: Program;
332
+ openStrip: StripFlags;
333
+ closeStrip: StripFlags;
334
+ }
335
+
336
+ interface ContentStatement extends Statement {
337
+ type: 'ContentStatement';
338
+ value: string;
339
+ original: StripFlags;
340
+ }
341
+
342
+ interface CommentStatement extends Statement {
343
+ type: 'CommentStatement';
344
+ value: string;
345
+ strip: StripFlags;
346
+ }
347
+
348
+ interface Expression extends Node {}
349
+
350
+ interface SubExpression extends Expression {
351
+ type: 'SubExpression';
352
+ path: PathExpression;
353
+ params: Expression[];
354
+ hash: Hash;
355
+ }
356
+
357
+ interface PathExpression extends Expression {
358
+ type: 'PathExpression';
359
+ data: boolean;
360
+ depth: number;
361
+ parts: string[];
362
+ original: string;
363
+ }
364
+
365
+ interface Literal extends Expression {}
366
+ interface StringLiteral extends Literal {
367
+ type: 'StringLiteral';
368
+ value: string;
369
+ original: string;
370
+ }
371
+
372
+ interface BooleanLiteral extends Literal {
373
+ type: 'BooleanLiteral';
374
+ value: boolean;
375
+ original: boolean;
376
+ }
377
+
378
+ interface NumberLiteral extends Literal {
379
+ type: 'NumberLiteral';
380
+ value: number;
381
+ original: number;
382
+ }
383
+
384
+ interface UndefinedLiteral extends Literal {
385
+ type: 'UndefinedLiteral';
386
+ }
387
+
388
+ interface NullLiteral extends Literal {
389
+ type: 'NullLiteral';
390
+ }
391
+
392
+ interface Hash extends Node {
393
+ type: 'Hash';
394
+ pairs: HashPair[];
395
+ }
396
+
397
+ interface HashPair extends Node {
398
+ type: 'HashPair';
399
+ key: string;
400
+ value: Expression;
401
+ }
402
+
403
+ interface StripFlags {
404
+ open: boolean;
405
+ close: boolean;
406
+ }
407
+
408
+ interface helpers {
409
+ helperExpression(node: Node): boolean;
410
+ scopeId(path: PathExpression): boolean;
411
+ simpleId(path: PathExpression): boolean;
412
+ }
413
+ }
414
+ }
415
+
416
+ declare module "handlebars" {
417
+ export = Handlebars;
418
+ }
419
+
420
+ declare module "handlebars/runtime" {
421
+ export = Handlebars;
422
+ }