Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: handlebars-lang/handlebars.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.1.2
Choose a base ref
...
head repository: handlebars-lang/handlebars.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.7.7
Choose a head ref
Loading
Showing with 14,464 additions and 6,612 deletions.
  1. +25 −0 .eslintignore
  2. +51 −114 .eslintrc.js
  3. +12 −6 .gitignore
  4. +0 −2 .istanbul.yml
  5. +22 −0 .prettierignore
  6. +33 −21 .travis.yml
  7. +43 −20 CONTRIBUTING.md
  8. +125 −75 Gruntfile.js
  9. +1 −1 LICENSE
  10. +9 −9 README.markdown
  11. +3 −4 appveyor.yml
  12. +2 −1 bench/.eslintrc
  13. +11 −6 bench/dist-size.js
  14. +1 −1 bench/index.js
  15. +9 −4 bench/precompile-size.js
  16. +2 −1 bench/templates/arguments.js
  17. +8 −1 bench/templates/array-each.js
  18. +8 −1 bench/templates/array-mustache.js
  19. +3 −3 bench/templates/complex.js
  20. +8 −1 bench/templates/data.js
  21. +9 −1 bench/templates/depth-1.js
  22. +13 −3 bench/templates/depth-2.js
  23. +1 −1 bench/templates/index.js
  24. +4 −1 bench/templates/partial-recursion.js
  25. +10 −2 bench/templates/partial.js
  26. +5 −3 bench/templates/paths.js
  27. +1 −2 bench/templates/variables.js
  28. +50 −26 bench/throughput.js
  29. +52 −26 bench/util/benchwarmer.js
  30. +3 −3 bench/util/template-runner.js
  31. +6 −0 bin/.eslintrc.js
  32. +160 −112 bin/handlebars
  33. +1 −1 components/bower.json
  34. +1 −1 components/handlebars.js.nuspec
  35. +1 −1 components/package.json
  36. +28 −0 docs/compiler-api.md
  37. +12 −0 integration-testing/README.md
  38. +13 −0 integration-testing/multi-nodejs-test/.eslintrc.js
  39. +2 −0 integration-testing/multi-nodejs-test/.gitignore
  40. +16 −0 integration-testing/multi-nodejs-test/package.json
  41. +1 −0 integration-testing/multi-nodejs-test/precompile-test-template.txt.hbs
  42. +11 −0 integration-testing/multi-nodejs-test/run-handlebars.js
  43. +18 −8 multi-nodejs-test/run-tests.sh → integration-testing/multi-nodejs-test/test.sh
  44. +15 −0 integration-testing/run-integration-tests.sh
  45. +11 −0 integration-testing/webpack-babel-test/.babelrc
  46. +3 −0 integration-testing/webpack-babel-test/.gitignore
  47. +24 −0 integration-testing/webpack-babel-test/package.json
  48. +12 −0 integration-testing/webpack-babel-test/src/handlebars-inline-precompile-test.js
  49. +5 −0 integration-testing/webpack-babel-test/src/lib/assert.js
  50. +16 −0 integration-testing/webpack-babel-test/test.sh
  51. +32 −0 integration-testing/webpack-babel-test/webpack.config.js
  52. +3 −0 integration-testing/webpack-test/.gitignore
  53. +21 −0 integration-testing/webpack-test/package.json
  54. +6 −0 integration-testing/webpack-test/src/handlebars-default-import-pre-4.2-test.js
  55. +5 −0 integration-testing/webpack-test/src/handlebars-default-import-test.js
  56. +10 −0 integration-testing/webpack-test/src/handlebars-loader-test.js
  57. +10 −0 integration-testing/webpack-test/src/handlebars-require-vs-import-test.js
  58. +6 −0 integration-testing/webpack-test/src/handlebars-wildcard-import-pre-4.2-test.js
  59. +5 −0 integration-testing/webpack-test/src/handlebars-wildcard-import-test.js
  60. +5 −0 integration-testing/webpack-test/src/lib/assert.js
  61. +2 −0 integration-testing/webpack-test/src/test-template.handlebars
  62. +16 −0 integration-testing/webpack-test/test.sh
  63. +20 −0 integration-testing/webpack-test/webpack.config.js
  64. +6 −1 lib/handlebars.js
  65. +26 −10 lib/handlebars/base.js
  66. +10 −6 lib/handlebars/compiler/ast.js
  67. +13 −3 lib/handlebars/compiler/base.js
  68. +26 −23 lib/handlebars/compiler/code-gen.js
  69. +97 −62 lib/handlebars/compiler/compiler.js
  70. +29 −20 lib/handlebars/compiler/helpers.js
  71. +252 −100 lib/handlebars/compiler/javascript-compiler.js
  72. +19 −12 lib/handlebars/compiler/printer.js
  73. +8 −1 lib/handlebars/compiler/visitor.js
  74. +48 −30 lib/handlebars/compiler/whitespace-control.js
  75. +0 −1 lib/handlebars/decorators.js
  76. +1 −1 lib/handlebars/decorators/inline.js
  77. +23 −4 lib/handlebars/exception.js
  78. +9 −0 lib/handlebars/helpers.js
  79. +7 −4 lib/handlebars/helpers/block-helper-missing.js
  80. +45 −23 lib/handlebars/helpers/each.js
  81. +3 −1 lib/handlebars/helpers/helper-missing.js
  82. +16 −3 lib/handlebars/helpers/if.js
  83. +2 −2 lib/handlebars/helpers/log.js
  84. +3 −5 lib/handlebars/helpers/lookup.js
  85. +18 −3 lib/handlebars/helpers/with.js
  86. +11 −0 lib/handlebars/internal/create-new-lookup-object.js
  87. +70 −0 lib/handlebars/internal/proto-access.js
  88. +13 −0 lib/handlebars/internal/wrapHelper.js
  89. +7 −3 lib/handlebars/logger.js
  90. +1 −2 lib/handlebars/no-conflict.js
  91. +220 −51 lib/handlebars/runtime.js
  92. +17 −9 lib/handlebars/utils.js
  93. +117 −75 lib/precompiler.js
  94. +0 −114 multi-nodejs-test/.eslintrc.js
  95. +0 −1 multi-nodejs-test/expected.txt
  96. +0 −13 multi-nodejs-test/run-handlebars.js
  97. +0 −1 multi-nodejs-test/template.txt.hbs
  98. +9 −0 nyc.config.js
  99. +4,570 −2,377 package-lock.json
  100. +51 −11 package.json
  101. +5 −0 prettier.config.js
  102. +479 −26 release-notes.md
  103. +17 −6 spec/.eslintrc
  104. +6 −3 spec/amd-runtime.html
  105. +6 −3 spec/amd.html
  106. +6 −0 spec/artifacts/known.helpers.handlebars
  107. +1 −0 spec/artifacts/non.default.extension.hbs
  108. +1 −0 spec/artifacts/partial.template.handlebars
  109. +260 −75 spec/ast.js
  110. +467 −176 spec/basic.js
  111. +304 −195 spec/blocks.js
  112. +521 −206 spec/builtins.js
  113. +112 −35 spec/compiler.js
  114. +179 −172 spec/data.js
  115. +13 −2 spec/env/browser.js
  116. +175 −13 spec/env/common.js
  117. +8 −0 spec/env/node.js
  118. +12 −8 spec/env/runner.js
  119. +18 −3 spec/env/runtime.js
  120. +6 −0 spec/expected/bom.amd.js
  121. +3 −0 spec/expected/compiled.string.txt
  122. +1 −1 spec/expected/empty.amd.js
  123. +1 −0 spec/expected/empty.amd.min.js
  124. +6 −0 spec/expected/empty.amd.namespace.js
  125. +3 −0 spec/expected/empty.amd.simple.js
  126. +6 −0 spec/expected/empty.common.js
  127. +10 −0 spec/expected/empty.name.amd.js
  128. +6 −0 spec/expected/empty.root.amd.js
  129. +6 −0 spec/expected/handlebar.path.amd.js
  130. +25 −0 spec/expected/help.menu.txt
  131. +10 −0 spec/expected/namespace.amd.js
  132. +6 −0 spec/expected/non.default.extension.amd.js
  133. +24 −0 spec/expected/non.empty.amd.known.helper.js
  134. +6 −0 spec/expected/partial.template.js
  135. +2 −0 spec/expected/source.map.amd.js
  136. +749 −442 spec/helpers.js
  137. +5 −2 spec/index.html
  138. +50 −9 spec/javascript-compiler.js
  139. +260 −98 spec/parser.js
  140. +483 −305 spec/partials.js
  141. +186 −92 spec/precompiler.js
  142. +393 −184 spec/regressions.js
  143. +2 −2 spec/require.js
  144. +75 −43 spec/runtime.js
  145. +419 −22 spec/security.js
  146. +15 −9 spec/source-map.js
  147. +19 −17 spec/spec.js
  148. +112 −88 spec/strict.js
  149. +162 −131 spec/string-params.js
  150. +215 −175 spec/subexpressions.js
  151. +1 −0 spec/tmp/.gitkeep
  152. +398 −46 spec/tokenizer.js
  153. +269 −145 spec/track-ids.js
  154. +6 −3 spec/umd-runtime.html
  155. +7 −3 spec/umd.html
  156. +14 −5 spec/utils.js
  157. 0 spec/{env → vendor}/json2.js
  158. 0 spec/{env → vendor}/require.js
  159. +50 −28 spec/visitor.js
  160. +123 −43 spec/whitespace-control.js
  161. +1 −1 src/handlebars.l
  162. +1 −1 src/handlebars.yy
  163. +0 −16 tasks/.eslintrc
  164. +14 −0 tasks/.eslintrc.js
  165. +20 −14 tasks/metrics.js
  166. +26 −22 tasks/parser.js
  167. +102 −0 tasks/publish-to-aws.js
  168. +0 −91 tasks/publish.js
  169. +9 −0 tasks/task-tests/.eslintrc.js
  170. +1 −0 tasks/task-tests/README.md
  171. +121 −0 tasks/task-tests/git.test.js
  172. 0 tasks/task-tests/mocha.opts
  173. +232 −0 tasks/test-bin.js
  174. +22 −0 tasks/test-mocha.js
  175. +0 −77 tasks/test.js
  176. +13 −0 tasks/util/async-grunt-task.js
  177. +51 −0 tasks/util/exec-file.js
  178. +61 −95 tasks/util/git.js
  179. +47 −27 tasks/version.js
  180. +80 −15 types/index.d.ts
  181. +169 −2 types/test.ts
  182. +2 −1 types/tsconfig.json
25 changes: 25 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.rvmrc
.DS_Store
/tmp/
*.sublime-project
*.sublime-workspace
npm-debug.log
sauce_connect.log*
.idea
yarn-error.log
node_modules
/handlebars-release.tgz
.nyc_output

# Generated files
lib/handlebars/compiler/parser.js
/coverage/
/dist/
/integration-testing/*/dist/

# Third-party or files that must remain unchanged
/spec/expected/
/spec/vendor

# JS-Snippets
src/*.js
165 changes: 51 additions & 114 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,129 +1,66 @@
module.exports = {
"extends": "eslint:recommended",
"globals": {
"self": false
extends: ['eslint:recommended', 'plugin:compat/recommended', 'prettier'],
globals: {
self: false
},
"env": {
"node": true
env: {
node: true,
es6: true
},
"ecmaFeatures": {
// Enabling features that can be implemented without polyfills. Want to avoid polyfills at this time.
"arrowFunctions": true,
"blockBindings": true,
"defaultParams": true,
"destructuring": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"restParams": true,
"spread": true,
"templateStrings": true
},
"rules": {
// overrides eslint:recommended defaults
"no-sparse-arrays": "off",
"no-func-assign": "off",
"no-console": "warn",
"no-debugger": "warn",
"no-unreachable": "warn",

// Possible Errors //
//-----------------//
"no-unsafe-negation": "error",
rules: {
'no-console': 'warn',

// temporarily disabled until the violating places are fixed.
'no-func-assign': 'off',
'no-sparse-arrays': 'off',

// Best Practices //
//----------------//
"curly": "error",
"default-case": "warn",
"dot-notation": ["error", { "allowKeywords": false }],
"guard-for-in": "warn",
"no-alert": "error",
"no-caller": "error",
"no-div-regex": "warn",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-floating-decimal": "error",
"no-implied-eval": "error",
"no-iterator": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-multi-str": "warn",
"no-global-assign": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-process-env": "error",
"no-proto": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unused-expressions": "error",
"no-warning-comments": "warn",
"no-with": "error",
"radix": "error",
"wrap-iife": "error",

'default-case': 'warn',
'guard-for-in': 'warn',
'no-alert': 'error',
'no-caller': 'error',
'no-div-regex': 'warn',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-floating-decimal': 'error',
'no-implied-eval': 'error',
'no-iterator': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-loop-func': 'error',
'no-multi-str': 'warn',
'no-global-assign': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-process-env': 'error',
'no-proto': 'error',
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-throw-literal': 'error',
'no-unused-expressions': 'error',
'no-warning-comments': 'warn',
'no-with': 'error',
radix: 'error',

// Variables //
//-----------//
"no-catch-shadow": "error",
"no-label-var": "error",
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
"no-use-before-define": ["error", "nofunc"],


// Stylistic Issues //
//------------------//
"comma-dangle": ["error", "never"],
"quote-props": ["error", "as-needed", { "keywords": true, "unnecessary": false }],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"camelcase": "error",
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-style": ["error", "last"],
"consistent-this": ["warn", "self"],
"eol-last": "error",
"func-style": ["error", "declaration"],
"key-spacing": ["error", {
"beforeColon": false,
"afterColon": true
}],
"new-cap": "error",
"new-parens": "error",
"no-array-constructor": "error",
"no-lonely-if": "error",
"no-mixed-spaces-and-tabs": "error",
"no-nested-ternary": "warn",
"no-new-object": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"no-extra-parens": ["error", "functions"],
"quotes": ["error", "single", "avoid-escape"],
"semi": "error",
"semi-spacing": ["error", { "before": false, "after": true }],
"keyword-spacing": "error",
"space-before-blocks": ["error", "always"],
"space-before-function-paren": ["error", { "anonymous": "never", "named": "never" }],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": ["error", "always", { "markers": [","] }],
"wrap-regex": "warn",
'no-label-var': 'error',
'no-undef-init': 'error',
'no-use-before-define': ['error', 'nofunc'],

// ECMAScript 6 //
//--------------//
"no-var": "warn"
'no-var': 'error'
},
"parserOptions": {
"sourceType": "module"
parserOptions: {
sourceType: 'module',
ecmaVersion: 6,
ecmaFeatures: {}
}
}
};
18 changes: 12 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
vendor
.rvmrc
.DS_Store
lib/handlebars/compiler/parser.js
/dist/
/tmp/
/coverage/
node_modules
*.sublime-project
*.sublime-workspace
npm-debug.log
sauce_connect.log*
.idea
yarn-error.log
/yarn-error.log
/yarn.lock
node_modules
/handlebars-release.tgz
.nyc_output

# Generated files
lib/handlebars/compiler/parser.js
/coverage/
/dist/
/integration-testing/*/dist/
/spec/tmp/*
2 changes: 0 additions & 2 deletions .istanbul.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.rvmrc
.DS_Store
/tmp/
*.sublime-project
*.sublime-workspace
npm-debug.log
sauce_connect.log*
.idea
yarn-error.log
node_modules
/handlebars-release.tgz
.nyc_output

# Generated files
lib/handlebars/compiler/parser.js
/coverage/
/dist/
/integration-testing/*/dist/

# Third-party or files that must remain unchanged
/spec/expected/
/spec/vendor
54 changes: 33 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
language: node_js
before_install:
- npm install -g grunt-cli
script:
- grunt --stack travis
- multi-nodejs-test/run-tests.sh 0.10 0.12 4 5 6 7 8 9 10 11
jobs:
include:
- stage: test
name: check javascript (eslint)
node_js: lts/*
script: npm run lint
- stage: test
name: check formatting (prettier)
node_js: lts/*
script: npm run check-format
- stage: test
name: check typescript definitions (dtslint)
node_js: lts/*
script: npm run dtslint
- stage: test
name: extensive tests and publish to aws
script: npm run extensive-tests-and-publish-to-aws
env:
- S3_BUCKET_NAME=builds.handlebarsjs.com
- secure: ckyEe5dzjdFDjmZ6wIrhGm0CFBEnKq8c1dYptfgVV/Q5/nJFGzu8T0yTjouS/ERxzdT2H327/63VCxhFnLCRHrsh4rlW/rCy4XI3O/0TeMLgFPa4TXkO8359qZ4CB44TBb3NsJyQXNMYdJpPLTCVTMpuiqqkFFOr+6OeggR7ufA=
- secure: Nm4AgSfsgNB21kgKrF9Tl7qVZU8YYREhouQunFracTcZZh2NZ2XH5aHuSiXCj88B13Cr/jGbJKsZ4T3QS3wWYtz6lkyVOx3H3iI+TMtqhD9RM3a7A4O+4vVN8IioB2YjhEu0OKjwgX5gp+0uF+pLEi7Hpj6fupD3AbbL5uYcKg8=
- SAUCE_USERNAME=handlebars
- secure: 1VkLQhbsEug4ZMQ52tTOus/WLvW3Etqe7GbCzZfzsI8d2ygJPjFfzU8fNm4pVVwoTI21MaM5AQq7SVPu8DWN1YbDjJycMdY1zO3DsB9aZBxTal98fIB7ZIUce9r5z2EP6mETrsbYjZkeckzIBI0A4UVa+F2BO4KbRDXP1Db3u3I=
node_js: '10'
- stage: test
name: test with latest nodejs-lts
node_js: lts/*
script: npm run test
- stage: test
name: test with active nodejs
node_js: node
script: npm run test
cache: npm
email:
on_failure: change
on_success: never
env:
global:
- S3_BUCKET_NAME=builds.handlebarsjs.com
- secure: ckyEe5dzjdFDjmZ6wIrhGm0CFBEnKq8c1dYptfgVV/Q5/nJFGzu8T0yTjouS/ERxzdT2H327/63VCxhFnLCRHrsh4rlW/rCy4XI3O/0TeMLgFPa4TXkO8359qZ4CB44TBb3NsJyQXNMYdJpPLTCVTMpuiqqkFFOr+6OeggR7ufA=
- secure: Nm4AgSfsgNB21kgKrF9Tl7qVZU8YYREhouQunFracTcZZh2NZ2XH5aHuSiXCj88B13Cr/jGbJKsZ4T3QS3wWYtz6lkyVOx3H3iI+TMtqhD9RM3a7A4O+4vVN8IioB2YjhEu0OKjwgX5gp+0uF+pLEi7Hpj6fupD3AbbL5uYcKg8=
matrix:
include:
- node_js: '10'
env:
- PUBLISH=true
- secure: pLTzghtVll9yGKJI0AaB0uI8GypfWxLTaIB0ZL8//yN3nAEIKMhf/RRilYTsn/rKj2NUa7vt2edYILi3lttOUlCBOwTc9amiRms1W8Lwr/3IdWPeBLvLuH1zNJRm2lBAwU4LBSqaOwhGaxOQr6KHTnWudhNhgOucxpZfvfI/dFw=
- secure: yERYCf7AwL11D9uMtacly/THGV8BlzsMmrt+iQVvGA3GaY6QMmfYqf6P6cCH98sH5etd1Y+1e6YrPeMjqI6lyRllT7FptoyOdHulazQe86VQN4sc0EpqMlH088kB7gGjTut9Z+X9ViooT5XEh9WA5jXEI9pXhQJNoIHkWPuwGuY=
cache:
directories:
- node_modules

git:
depth: 100
Loading