Commits
Commits on Dec 29, 2021
-
Also upgraded to `@definitelytyped/dtslint`.
Copy the full SHA a98b01cView commit details
Commits on Feb 15, 2021
-
[FEAT] Extract the Handlebars parser (#1713)
Extracts the parser to `@handlebars/parser`, where it can be shared between different implementations. This means that e.g. Glimmer/Ember will be able to iterate on new features without forcing Handlebars to adopt them immediately, and vice versa. All implementors will be able to absorb changes as it makes sense for them.
Chris Garrett committedFeb 15, 2021 Copy the full SHA 19bdaceView commit details
Commits on Mar 31, 2020
-
chore: ignore external @types in tests
- some indirect dependencies install @types packages which are not compatible with the older typescript. - adjusted test's tsconfig to not pick these up automatically, as the actual .d.ts does not depend on these external types.
Copy the full SHA b440c38View commit details
Commits on Jan 10, 2020
-
feat: default options for controlling proto access
This commmit adds the runtime options - `allowProtoPropertiesByDefault` (boolean, default: false) and - `allowProtoMethodsByDefault` (boolean, default: false)` which can be used to allow access to prototype properties and functions in general. Specific properties and methods can still be disabled from access via `allowedProtoProperties` and `allowedProtoMethods` by setting the corresponding values to false. The methods `constructor`, `__defineGetter__`, `__defineSetter__`, `__lookupGetter__` and the property `__proto__` will be disabled, even if the allow...ByDefault-options are set to true. In order to allow access to those properties and methods, they have to be explicitly set to true in the 'allowedProto...'-options. A warning is logged when the a proto-access it attempted and denied by default (i.e. if no option is set by the user to make the access decision explicit)
Copy the full SHA 7af1c12View commit details
Commits on Jan 8, 2020
-
feat: access control to prototype properties via whitelist
Disallow access to prototype properties and methods by default. Access to properties is always checked via `Object.prototype.hasOwnProperty.call(parent, propertyName)`. New runtime options: - **allowedProtoMethods**: a string-to-boolean map of property-names that are allowed if they are methods of the parent object. - **allowedProtoProperties**: a string-to-boolean map of property-names that are allowed if they are properties but not methods of the parent object. ```js const template = handlebars.compile('{{aString.trim}}') const result = template({ aString: ' abc ' }) // result is empty, because trim is defined at String prototype ``` ```js const template = handlebars.compile('{{aString.trim}}') const result = template({ aString: ' abc ' }, { allowedProtoMethods: { trim: true } }) // result = 'abc' ``` Implementation details: The method now "container.lookupProperty" handles the prototype-checks and the white-lists. It is used in - JavaScriptCompiler#nameLookup - The "lookup"-helper (passed to all helpers as "options.lookupProperty") - The "lookup" function at the container, which is used for recursive lookups in "compat" mode Compatibility: - **Old precompiled templates work with new runtimes**: The "options.lookupPropery"-function is passed to the helper by a wrapper, not by the compiled templated. - **New templates work with old runtimes**: The template contains a function that is used as fallback if the "lookupProperty"-function cannot be found at the container. However, the runtime-options "allowedProtoProperties" and "allowedProtoMethods" only work with the newest runtime. BREAKING CHANGE: - access to prototype properties is forbidden completely by default
Copy the full SHA d03b6ecView commit details
Commits on Oct 28, 2019
-
Add missing types for the Exception class properties (#1583)
* Convert Exception to a class * Add node param type declaration * Test the types
Copy the full SHA b8913fcView commit details
Commits on Oct 27, 2019
-
Add Handlebars.parseWithoutProcessing (#1584)
When authoring tooling that parses Handlebars files and emits Handlebars files, you often want to preserve the **exact** formatting of the input. The changes in this commit add a new method to the `Handlebars` namespace: `parseWithoutProcessing`. Unlike, `Handlebars.parse` (which will mutate the parsed AST to apply whitespace control) this method will parse the template and return it directly (**without** processing
😉 ). For example, parsing the following template: ```hbs {{#foo}} {{~bar~}} {{baz~}} {{/foo}} ``` Using `Handlebars.parse`, the AST returned would have truncated the following whitespace: * The whitespace prior to the `{{#foo}}` * The newline following `{{#foo}}` * The leading whitespace before `{{~bar~}}` * The whitespace between `{{~bar~}}` and `{{baz~}}` * The newline after `{{baz~}}` * The whitespace prior to the `{{/foo}}` When `Handlebars.parse` is used from `Handlebars.precompile` or `Handlebars.compile`, this whitespace stripping is **very** important (these behaviors are intentional, and generally lead to better rendered output). When the same template is parsed with `Handlebars.parseWithoutProcessing` none of those modifications to the AST are made. This enables "codemod tooling" (e.g. `prettier` and `ember-template-recast`) to preserve the **exact** initial formatting. Prior to these changes, those tools would have to _manually_ reconstruct the whitespace that is lost prior to emitting source.Copy the full SHA 62ed3c2View commit details
Commits on Oct 8, 2019
-
Copy the full SHA 0440af2View commit details
Commits on Sep 24, 2019
Commits on Sep 3, 2019
-
fix typings of resolvePartial-options
- derived from the object structure seen in the debugger closes #1534
Copy the full SHA 888750eView commit details -
Add "Handlebars.VM.resolvePartial" to type definitions
- Handlebars.VM is actually not part of the API, but Handlebars.VM.resolvePartial is mentioned in the documentation and is thus now treated as part of the API. Closes #1534
Copy the full SHA 133b96aView commit details
Commits on Aug 29, 2019
-
feat: enhance typescript definition for knownHelpers
- Add support for custom helpers while keeping the list of builtin-helpers to maintain for autocompletion support closes #1544
Copy the full SHA 16572cdView commit details
Commits on Mar 19, 2019
-
Port over linting and test for typings
- Move typings from lib/ to types/. - Add dtslint for validating types. - Use grunt-bg-shell to call out to dtslint during build step.
Copy the full SHA 3fb6687View commit details