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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011-2019 by Yehuda Katz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,169 @@
1
+ [![CI Build Status](https://github.com/handlebars-lang/handlebars.js/actions/workflows/ci.yml/badge.svg)](https://github.com/handlebars-lang/handlebars.js/actions/workflows/ci.yml)
2
+ [![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/handlebars/badge?style=rounded)](https://www.jsdelivr.com/package/npm/handlebars)
3
+ [![npm downloads](https://badgen.net/npm/dm/handlebars)](https://www.npmjs.com/package/handlebars)
4
+ [![npm version](https://badgen.net/npm/v/handlebars)](https://www.npmjs.com/package/handlebars)
5
+ [![Bundle size](https://badgen.net/bundlephobia/minzip/handlebars?label=minified%20%2B%20gzipped)](https://bundlephobia.com/package/handlebars)
6
+ [![Install size](https://packagephobia.com/badge?p=handlebars)](https://packagephobia.com/result?p=handlebars)
7
+
8
+ Handlebars.js
9
+ =============
10
+
11
+ Handlebars.js is an extension to the [Mustache templating
12
+ language](https://mustache.github.io/) created by Chris Wanstrath.
13
+ Handlebars.js and Mustache are both logicless templating languages that
14
+ keep the view and the code separated like we all know they should be.
15
+
16
+ Checkout the official Handlebars docs site at
17
+ [https://handlebarsjs.com/](https://handlebarsjs.com) and the live demo at [http://tryhandlebarsjs.com/](http://tryhandlebarsjs.com/).
18
+
19
+ Installing
20
+ ----------
21
+
22
+ See our [installation documentation](https://handlebarsjs.com/installation/).
23
+
24
+ Usage
25
+ -----
26
+ In general, the syntax of Handlebars.js templates is a superset
27
+ of Mustache templates. For basic syntax, check out the [Mustache
28
+ manpage](https://mustache.github.io/mustache.5.html).
29
+
30
+ Once you have a template, use the `Handlebars.compile` method to compile
31
+ the template into a function. The generated function takes a context
32
+ argument, which will be used to render the template.
33
+
34
+ ```js
35
+ var source = "<p>Hello, my name is {{name}}. I am from {{hometown}}. I have " +
36
+ "{{kids.length}} kids:</p>" +
37
+ "<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>";
38
+ var template = Handlebars.compile(source);
39
+
40
+ var data = { "name": "Alan", "hometown": "Somewhere, TX",
41
+ "kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
42
+ var result = template(data);
43
+
44
+ // Would render:
45
+ // <p>Hello, my name is Alan. I am from Somewhere, TX. I have 2 kids:</p>
46
+ // <ul>
47
+ // <li>Jimmy is 12</li>
48
+ // <li>Sally is 4</li>
49
+ // </ul>
50
+ ```
51
+
52
+ Full documentation and more examples are at [handlebarsjs.com](https://handlebarsjs.com/).
53
+
54
+ Precompiling Templates
55
+ ----------------------
56
+
57
+ Handlebars allows templates to be precompiled and included as javascript code rather than the handlebars template allowing for faster startup time. Full details are located [here](https://handlebarsjs.com/installation/precompilation.html).
58
+
59
+ Differences Between Handlebars.js and Mustache
60
+ ----------------------------------------------
61
+ Handlebars.js adds a couple of additional features to make writing
62
+ templates easier and also changes a tiny detail of how partials work.
63
+
64
+ - [Nested Paths](https://handlebarsjs.com/guide/expressions.html#path-expressions)
65
+ - [Helpers](https://handlebarsjs.com/guide/expressions.html#helpers)
66
+ - [Block Expressions](https://handlebarsjs.com/guide/block-helpers.html#basic-blocks)
67
+ - [Literal Values](https://handlebarsjs.com/guide/expressions.html#literal-segments)
68
+ - [Delimited Comments](https://handlebarsjs.com/guide/#template-comments)
69
+
70
+ Block expressions have the same syntax as mustache sections but should not be confused with one another. Sections are akin to an implicit `each` or `with` statement depending on the input data and helpers are explicit pieces of code that are free to implement whatever behavior they like. The [mustache spec](https://mustache.github.io/mustache.5.html) defines the exact behavior of sections. In the case of name conflicts, helpers are given priority.
71
+
72
+ ### Compatibility
73
+
74
+ There are a few Mustache behaviors that Handlebars does not implement.
75
+ - Handlebars deviates from Mustache slightly in that it does not perform recursive lookup by default. The compile time `compat` flag must be set to enable this functionality. Users should note that there is a performance cost for enabling this flag. The exact cost varies by template, but it's recommended that performance sensitive operations should avoid this mode and instead opt for explicit path references.
76
+ - The optional Mustache-style lambdas are not supported. Instead Handlebars provides its own lambda resolution that follows the behaviors of helpers.
77
+ - Alternative delimiters are not supported.
78
+
79
+
80
+ Supported Environments
81
+ ----------------------
82
+
83
+ Handlebars has been designed to work in any ECMAScript 3 environment. This includes
84
+
85
+ - Node.js
86
+ - Chrome
87
+ - Firefox
88
+ - Safari 5+
89
+ - Opera 11+
90
+ - IE 6+
91
+
92
+ Older versions and other runtimes are likely to work but have not been formally
93
+ tested. The compiler requires `JSON.stringify` to be implemented natively or via a polyfill. If using the precompiler this is not necessary.
94
+
95
+ Performance
96
+ -----------
97
+
98
+ In a rough performance test, precompiled Handlebars.js templates (in
99
+ the original version of Handlebars.js) rendered in about half the
100
+ time of Mustache templates. It would be a shame if it were any other
101
+ way, since they were precompiled, but the difference in architecture
102
+ does have some big performance advantages. Justin Marney, a.k.a.
103
+ [gotascii](http://github.com/gotascii), confirmed that with an
104
+ [independent test](http://sorescode.com/2010/09/12/benchmarks.html). The
105
+ rewritten Handlebars (current version) is faster than the old version,
106
+ with many performance tests being 5 to 7 times faster than the Mustache equivalent.
107
+
108
+
109
+ Upgrading
110
+ ---------
111
+
112
+ See [release-notes.md](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md) for upgrade notes.
113
+
114
+ Known Issues
115
+ ------------
116
+
117
+ See [FAQ.md](https://github.com/handlebars-lang/handlebars.js/blob/master/FAQ.md) for known issues and common pitfalls.
118
+
119
+
120
+ Handlebars in the Wild
121
+ ----------------------
122
+
123
+ * [Assemble](http://assemble.io), by [@jonschlinkert](https://github.com/jonschlinkert)
124
+ and [@doowb](https://github.com/doowb), is a static site generator that uses Handlebars.js
125
+ as its template engine.
126
+ * [Cory](https://github.com/leo/cory), by [@leo](https://github.com/leo), is another tiny static site generator
127
+ * [CoSchedule](http://coschedule.com) An editorial calendar for WordPress that uses Handlebars.js
128
+ * [dashbars](https://github.com/pismute/dashbars) A modern helper library for Handlebars.js.
129
+ * [Ember.js](http://www.emberjs.com) makes Handlebars.js the primary way to
130
+ structure your views, also with automatic data binding support.
131
+ * [Ghost](https://ghost.org/) Just a blogging platform.
132
+ * [handlebars_assets](http://github.com/leshill/handlebars_assets): A Rails Asset Pipeline gem
133
+ from Les Hill (@leshill).
134
+ * [handlebars-helpers](https://github.com/assemble/handlebars-helpers) is an extensive library
135
+ with 100+ handlebars helpers.
136
+ * [handlebars-layouts](https://github.com/shannonmoeller/handlebars-layouts) is a set of helpers which implement extendible and embeddable layout blocks as seen in other popular templating languages.
137
+ * [hbs](http://github.com/donpark/hbs): An Express.js view engine adapter for Handlebars.js,
138
+ from Don Park.
139
+ * [koa-hbs](https://github.com/jwilm/koa-hbs): [koa](https://github.com/koajs/koa) generator based
140
+ renderer for Handlebars.js.
141
+ * [jblotus](http://github.com/jblotus) created [http://tryhandlebarsjs.com](http://tryhandlebarsjs.com)
142
+ for anyone who would like to try out Handlebars.js in their browser.
143
+ * [jQuery plugin](http://71104.github.io/jquery-handlebars/): allows you to use
144
+ Handlebars.js with [jQuery](http://jquery.com/).
145
+ * [Lumbar](http://walmartlabs.github.io/lumbar) provides easy module-based template management for
146
+ handlebars projects.
147
+ * [Marionette.Handlebars](https://github.com/hashchange/marionette.handlebars) adds support for Handlebars and Mustache templates to Marionette.
148
+ * [sammy.js](http://github.com/quirkey/sammy) by Aaron Quint, a.k.a. quirkey,
149
+ supports Handlebars.js as one of its template plugins.
150
+ * [SproutCore](http://www.sproutcore.com) uses Handlebars.js as its main
151
+ templating engine, extending it with automatic data binding support.
152
+ * [YUI](http://yuilibrary.com/yui/docs/handlebars/) implements a port of handlebars
153
+ * [Swag](https://github.com/elving/swag) by [@elving](https://github.com/elving) is a growing collection of helpers for handlebars.js. Give your handlebars.js templates some swag son!
154
+ * [DOMBars](https://github.com/blakeembrey/dombars) is a DOM-based templating engine built on the Handlebars parser and runtime **DEPRECATED**
155
+ * [promised-handlebars](https://github.com/nknapp/promised-handlebars) is a wrapper for Handlebars that allows helpers to return Promises.
156
+ * [just-handlebars-helpers](https://github.com/leapfrogtechnology/just-handlebars-helpers) A fully tested lightweight package with common Handlebars helpers.
157
+
158
+ External Resources
159
+ ------------------
160
+
161
+ * [Gist about Synchronous and asynchronous loading of external handlebars templates](https://gist.github.com/2287070)
162
+
163
+ Have a project using Handlebars? Send us a [pull request][pull-request]!
164
+
165
+ License
166
+ -------
167
+ Handlebars.js is released under the MIT license.
168
+
169
+ [pull-request]: https://github.com/handlebars-lang/handlebars.js/pull/new/master
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ rules: {
3
+ 'no-console': 0,
4
+ 'no-var': 0
5
+ }
6
+ };
package/bin/handlebars ADDED
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+
3
+ var argv = parseArgs({
4
+ 'f': {
5
+ 'type': 'string',
6
+ 'description': 'Output File',
7
+ 'alias': 'output'
8
+ },
9
+ 'map': {
10
+ 'type': 'string',
11
+ 'description': 'Source Map File'
12
+ },
13
+ 'a': {
14
+ 'type': 'boolean',
15
+ 'description': 'Exports amd style (require.js)',
16
+ 'alias': 'amd'
17
+ },
18
+ 'c': {
19
+ 'type': 'string',
20
+ 'description': 'Exports CommonJS style, path to Handlebars module',
21
+ 'alias': 'commonjs',
22
+ 'default': null
23
+ },
24
+ 'h': {
25
+ 'type': 'string',
26
+ 'description': 'Path to handlebar.js (only valid for amd-style)',
27
+ 'alias': 'handlebarPath',
28
+ 'default': ''
29
+ },
30
+ 'k': {
31
+ 'type': 'string',
32
+ 'description': 'Known helpers',
33
+ 'alias': 'known'
34
+ },
35
+ 'o': {
36
+ 'type': 'boolean',
37
+ 'description': 'Known helpers only',
38
+ 'alias': 'knownOnly'
39
+ },
40
+ 'm': {
41
+ 'type': 'boolean',
42
+ 'description': 'Minimize output',
43
+ 'alias': 'min'
44
+ },
45
+ 'n': {
46
+ 'type': 'string',
47
+ 'description': 'Template namespace',
48
+ 'alias': 'namespace',
49
+ 'default': 'Handlebars.templates'
50
+ },
51
+ 's': {
52
+ 'type': 'boolean',
53
+ 'description': 'Output template function only.',
54
+ 'alias': 'simple'
55
+ },
56
+ 'N': {
57
+ 'type': 'string',
58
+ 'description': 'Name of passed string templates. Optional if running in a simple mode. Required when operating on multiple templates.',
59
+ 'alias': 'name'
60
+ },
61
+ 'i': {
62
+ 'type': 'string',
63
+ 'description': 'Generates a template from the passed CLI argument.\n"-" is treated as a special value and causes stdin to be read for the template value.',
64
+ 'alias': 'string'
65
+ },
66
+ 'r': {
67
+ 'type': 'string',
68
+ 'description': 'Template root. Base value that will be stripped from template names.',
69
+ 'alias': 'root'
70
+ },
71
+ 'p': {
72
+ 'type': 'boolean',
73
+ 'description': 'Compiling a partial template',
74
+ 'alias': 'partial'
75
+ },
76
+ 'd': {
77
+ 'type': 'boolean',
78
+ 'description': 'Include data when compiling',
79
+ 'alias': 'data'
80
+ },
81
+ 'e': {
82
+ 'type': 'string',
83
+ 'description': 'Template extension.',
84
+ 'alias': 'extension',
85
+ 'default': 'handlebars'
86
+ },
87
+ 'b': {
88
+ 'type': 'boolean',
89
+ 'description': 'Removes the BOM (Byte Order Mark) from the beginning of the templates.',
90
+ 'alias': 'bom'
91
+ },
92
+ 'v': {
93
+ 'type': 'boolean',
94
+ 'description': 'Prints the current compiler version',
95
+ 'alias': 'version'
96
+ },
97
+ 'help': {
98
+ 'type': 'boolean',
99
+ 'description': 'Outputs this message'
100
+ }
101
+ });
102
+
103
+ argv.files = argv._;
104
+ delete argv._;
105
+
106
+ var Precompiler = require('../dist/cjs/precompiler');
107
+ Precompiler.loadTemplates(argv, function(err, opts) {
108
+
109
+ if (err) {
110
+ throw err;
111
+ }
112
+
113
+ if (opts.help || (!opts.templates.length && !opts.version)) {
114
+ printUsage(argv._spec, 120);
115
+ } else {
116
+ Precompiler.cli(opts);
117
+ }
118
+ });
119
+
120
+ function pad(n) {
121
+ var str = '';
122
+ while (str.length < n) {
123
+ str += ' ';
124
+ }
125
+ return str;
126
+ }
127
+
128
+ function parseArgs(spec) {
129
+ var opts = { alias: {}, boolean: [], default: {}, string: [] };
130
+
131
+ Object.keys(spec).forEach(function (arg) {
132
+ var opt = spec[arg];
133
+ opts[opt.type].push(arg);
134
+ if ('alias' in opt) opts.alias[arg] = opt.alias;
135
+ if ('default' in opt) opts.default[arg] = opt.default;
136
+ });
137
+
138
+ var argv = require('minimist')(process.argv.slice(2), opts);
139
+ argv._spec = spec;
140
+ return argv;
141
+ }
142
+
143
+ function printUsage(spec, wrap) {
144
+ var wordwrap = require('wordwrap');
145
+
146
+ console.log('Precompile handlebar templates.');
147
+ console.log('Usage: handlebars [template|directory]...');
148
+
149
+ var opts = [];
150
+ var width = 0;
151
+ Object.keys(spec).forEach(function (arg) {
152
+ var opt = spec[arg];
153
+
154
+ var name = (arg.length === 1 ? '-' : '--') + arg;
155
+ if ('alias' in opt) name += ', --' + opt.alias;
156
+
157
+ var meta = '[' + opt.type + ']';
158
+ if ('default' in opt) meta += ' [default: ' + JSON.stringify(opt.default) + ']';
159
+
160
+ opts.push({ name: name, desc: opt.description, meta: meta });
161
+ if (name.length > width) width = name.length;
162
+ });
163
+
164
+ console.log('Options:');
165
+ opts.forEach(function (opt) {
166
+ var desc = wordwrap(width + 4, wrap + 1)(opt.desc);
167
+
168
+ console.log(' %s%s%s%s%s',
169
+ opt.name,
170
+ pad(width - opt.name.length + 2),
171
+ desc.slice(width + 4),
172
+ pad(wrap - opt.meta.length - desc.split(/\n/).pop().length),
173
+ opt.meta
174
+ );
175
+ });
176
+ }
@@ -0,0 +1,106 @@
1
+ define(['exports', './utils', './exception', './helpers', './decorators', './logger', './internal/proto-access'], function (exports, _utils, _exception, _helpers, _decorators, _logger, _internalProtoAccess) {
2
+ 'use strict';
3
+
4
+ exports.__esModule = true;
5
+ exports.HandlebarsEnvironment = HandlebarsEnvironment;
6
+ // istanbul ignore next
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
9
+
10
+ var _Exception = _interopRequireDefault(_exception);
11
+
12
+ var _logger2 = _interopRequireDefault(_logger);
13
+
14
+ var VERSION = '4.7.8';
15
+ exports.VERSION = VERSION;
16
+ var COMPILER_REVISION = 8;
17
+ exports.COMPILER_REVISION = COMPILER_REVISION;
18
+ var LAST_COMPATIBLE_COMPILER_REVISION = 7;
19
+
20
+ exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION;
21
+ var REVISION_CHANGES = {
22
+ 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
23
+ 2: '== 1.0.0-rc.3',
24
+ 3: '== 1.0.0-rc.4',
25
+ 4: '== 1.x.x',
26
+ 5: '== 2.0.0-alpha.x',
27
+ 6: '>= 2.0.0-beta.1',
28
+ 7: '>= 4.0.0 <4.3.0',
29
+ 8: '>= 4.3.0'
30
+ };
31
+
32
+ exports.REVISION_CHANGES = REVISION_CHANGES;
33
+ var objectType = '[object Object]';
34
+
35
+ function HandlebarsEnvironment(helpers, partials, decorators) {
36
+ this.helpers = helpers || {};
37
+ this.partials = partials || {};
38
+ this.decorators = decorators || {};
39
+
40
+ _helpers.registerDefaultHelpers(this);
41
+ _decorators.registerDefaultDecorators(this);
42
+ }
43
+
44
+ HandlebarsEnvironment.prototype = {
45
+ constructor: HandlebarsEnvironment,
46
+
47
+ logger: _logger2['default'],
48
+ log: _logger2['default'].log,
49
+
50
+ registerHelper: function registerHelper(name, fn) {
51
+ if (_utils.toString.call(name) === objectType) {
52
+ if (fn) {
53
+ throw new _Exception['default']('Arg not supported with multiple helpers');
54
+ }
55
+ _utils.extend(this.helpers, name);
56
+ } else {
57
+ this.helpers[name] = fn;
58
+ }
59
+ },
60
+ unregisterHelper: function unregisterHelper(name) {
61
+ delete this.helpers[name];
62
+ },
63
+
64
+ registerPartial: function registerPartial(name, partial) {
65
+ if (_utils.toString.call(name) === objectType) {
66
+ _utils.extend(this.partials, name);
67
+ } else {
68
+ if (typeof partial === 'undefined') {
69
+ throw new _Exception['default']('Attempting to register a partial called "' + name + '" as undefined');
70
+ }
71
+ this.partials[name] = partial;
72
+ }
73
+ },
74
+ unregisterPartial: function unregisterPartial(name) {
75
+ delete this.partials[name];
76
+ },
77
+
78
+ registerDecorator: function registerDecorator(name, fn) {
79
+ if (_utils.toString.call(name) === objectType) {
80
+ if (fn) {
81
+ throw new _Exception['default']('Arg not supported with multiple decorators');
82
+ }
83
+ _utils.extend(this.decorators, name);
84
+ } else {
85
+ this.decorators[name] = fn;
86
+ }
87
+ },
88
+ unregisterDecorator: function unregisterDecorator(name) {
89
+ delete this.decorators[name];
90
+ },
91
+ /**
92
+ * Reset the memory of illegal property accesses that have already been logged.
93
+ * @deprecated should only be used in handlebars test-cases
94
+ */
95
+ resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() {
96
+ _internalProtoAccess.resetLoggedProperties();
97
+ }
98
+ };
99
+
100
+ var log = _logger2['default'].log;
101
+
102
+ exports.log = log;
103
+ exports.createFrame = _utils.createFrame;
104
+ exports.logger = _logger2['default'];
105
+ });
106
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQU9PLE1BQU0sT0FBTyxHQUFHLE9BQU8sQ0FBQzs7QUFDeEIsTUFBTSxpQkFBaUIsR0FBRyxDQUFDLENBQUM7O0FBQzVCLE1BQU0saUNBQWlDLEdBQUcsQ0FBQyxDQUFDOzs7QUFFNUMsTUFBTSxnQkFBZ0IsR0FBRztBQUM5QixLQUFDLEVBQUUsYUFBYTtBQUNoQixLQUFDLEVBQUUsZUFBZTtBQUNsQixLQUFDLEVBQUUsZUFBZTtBQUNsQixLQUFDLEVBQUUsVUFBVTtBQUNiLEtBQUMsRUFBRSxrQkFBa0I7QUFDckIsS0FBQyxFQUFFLGlCQUFpQjtBQUNwQixLQUFDLEVBQUUsaUJBQWlCO0FBQ3BCLEtBQUMsRUFBRSxVQUFVO0dBQ2QsQ0FBQzs7O0FBRUYsTUFBTSxVQUFVLEdBQUcsaUJBQWlCLENBQUM7O0FBRTlCLFdBQVMscUJBQXFCLENBQUMsT0FBTyxFQUFFLFFBQVEsRUFBRSxVQUFVLEVBQUU7QUFDbkUsUUFBSSxDQUFDLE9BQU8sR0FBRyxPQUFPLElBQUksRUF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hhdCBoYXZlIGFscmVhZHkgYmVlbiBsb2dnZWQuXG4gICAqIEBkZXByZWNhdGVkIHNob3VsZCBvbmx5IGJlIHVzZWQgaW4gaGFuZGxlYmFycyB0ZXN0LWNhc2VzXG4gICAqL1xuICByZXNldExvZ2dlZFByb3BlcnR5QWNjZXNzZXMoKSB7XG4gICAgcmVzZXRMb2dnZWRQcm9wZXJ0aWVzKCk7XG4gIH1cbn07XG5cbmV4cG9ydCBsZXQgbG9nID0gbG9nZ2VyLmxvZztcblxuZXhwb3J0IHsgY3JlYXRlRnJhbWUsIGxvZ2dlciB9O1xuIl19
@@ -0,0 +1,31 @@
1
+ define(['exports', 'module'], function (exports, module) {
2
+ 'use strict';
3
+
4
+ var AST = {
5
+ // Public API used to evaluate derived attributes regarding AST nodes
6
+ helpers: {
7
+ // a mustache is definitely a helper if:
8
+ // * it is an eligible helper, and
9
+ // * it has at least one parameter or hash segment
10
+ helperExpression: function helperExpression(node) {
11
+ return node.type === 'SubExpression' || (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && !!(node.params && node.params.length || node.hash);
12
+ },
13
+
14
+ scopedId: function scopedId(path) {
15
+ return (/^\.|this\b/.test(path.original)
16
+ );
17
+ },
18
+
19
+ // an ID is simple if it only has one part, and that part is not
20
+ // `..` or `this`.
21
+ simpleId: function simpleId(path) {
22
+ return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
23
+ }
24
+ }
25
+ };
26
+
27
+ // Must be exported as an object rather than the root of the module as the jison lexer
28
+ // must modify the object to operate properly.
29
+ module.exports = AST;
30
+ });
31
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2NvbXBpbGVyL2FzdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxNQUFJLEdBQUcsR0FBRzs7QUFFUixXQUFPLEVBQUU7Ozs7Q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+1,45 @@
1
+ define(['exports', './parser', './whitespace-control', './helpers', '../utils'], function (exports, _parser, _whitespaceControl, _helpers, _utils) {
2
+ 'use strict';
3
+
4
+ exports.__esModule = true;
5
+ exports.parseWithoutProcessing = parseWithoutProcessing;
6
+ exports.parse = parse;
7
+ // istanbul ignore next
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
10
+
11
+ var _parser2 = _interopRequireDefault(_parser);
12
+
13
+ var _WhitespaceControl = _interopRequireDefault(_whitespaceControl);
14
+
15
+ exports.parser = _parser2['default'];
16
+
17
+ var yy = {};
18
+ _utils.extend(yy, _helpers);
19
+
20
+ function parseWithoutProcessing(input, options) {
21
+ // Just return if an already-compiled AST was passed in.
22
+ if (input.type === 'Program') {
23
+ return input;
24
+ }
25
+
26
+ _parser2['default'].yy = yy;
27
+
28
+ // Altering the shared object here, but this is ok as parser is a sync operation
29
+ yy.locInfo = function (locInfo) {
30
+ return new yy.SourceLocation(options && options.srcName, locInfo);
31
+ };
32
+
33
+ var ast = _parser2['default'].parse(input);
34
+
35
+ return ast;
36
+ }
37
+
38
+ function parse(input, options) {
39
+ var ast = parseWithoutProcessing(input, options);
40
+ var strip = new _WhitespaceControl['default'](options);
41
+
42
+ return strip.accept(ast);
43
+ }
44
+ });
45
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYi9oYW5kbGViYXJzL2NvbXBpbGVyL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7VUFLUyxNQUFNOztBQUVmLE1BQUksRUFBRSxHQUFHLEVBQUUsQ0FBQztBQUNaLFNBTFMsTUFBTSxDQUtSLEVBQUUsV0FBVSxDQUFDOztBQUViLFdBQVMsc0JBQXNCLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRTs7QUFFckQsUUFBSSxLQUFL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