Skip to content
Permalink
Browse files
Merge branch '4.x' into merge-4.x
  • Loading branch information
jaylinski committed Dec 29, 2021
2 parents 4da5882 + e2f63da commit 82c613244a668d3983fc9204fbacb5cdc0916bde
Showing with 425 additions and 280 deletions.
  1. +4 −0 .editorconfig
  2. +1 −2 .eslintignore
  3. +9 −0 .github/dependabot.yml
  4. +89 −0 .github/workflows/ci.yml
  5. +1 −2 .gitignore
  6. +1 −1 .prettierignore
  7. +0 −39 .travis.yml
  8. +12 −16 CONTRIBUTING.md
  9. +5 −3 FAQ.md
  10. +15 −70 Gruntfile.js
  11. +6 −8 README.markdown
  12. +0 −36 appveyor.yml
  13. +0 −15 bench/.eslintrc
  14. +1 −1 components/handlebars-source.gemspec
  15. +2 −2 components/handlebars.js.nuspec
  16. +1 −1 docs/decorators-api.md
  17. +6 −0 lib/.eslintrc.js
  18. +1 −1 lib/handlebars/compiler/code-gen.js
  19. +2 −2 lib/handlebars/helpers/each.js
  20. +1 −1 lib/handlebars/internal/proto-access.js
  21. +1 −1 lib/handlebars/no-conflict.js
  22. +1 −0 lib/index.js
  23. +1 −0 lib/precompiler.js
  24. +18 −14 package.json
  25. +1 −1 spec/index.php
  26. +1 −1 spec/umd-runtime.html
  27. +1 −1 spec/umd.html
  28. +1 −1 tasks/metrics.js
  29. +0 −1 tasks/task-tests/README.md
  30. 0 tasks/{task-tests → tests}/.eslintrc.js
  31. +1 −0 tasks/tests/README.md
  32. 0 tasks/{task-tests → tests}/git.test.js
  33. 0 tasks/{task-tests → tests}/mocha.opts
  34. +10 −0 tests/.eslintrc.js
  35. 0 { → tests}/bench/dist-size.js
  36. 0 { → tests}/bench/index.js
  37. +1 −1 { → tests}/bench/precompile-size.js
  38. 0 { → tests}/bench/templates/arguments.js
  39. 0 { → tests}/bench/templates/array-each.js
  40. 0 { → tests}/bench/templates/array-mustache.js
  41. 0 { → tests}/bench/templates/complex.dust
  42. 0 { → tests}/bench/templates/complex.eco
  43. 0 { → tests}/bench/templates/complex.handlebars
  44. 0 { → tests}/bench/templates/complex.js
  45. 0 { → tests}/bench/templates/complex.mustache
  46. 0 { → tests}/bench/templates/data.js
  47. 0 { → tests}/bench/templates/depth-1.js
  48. 0 { → tests}/bench/templates/depth-2.js
  49. 0 { → tests}/bench/templates/index.js
  50. 0 { → tests}/bench/templates/object-mustache.js
  51. 0 { → tests}/bench/templates/object.js
  52. 0 { → tests}/bench/templates/partial-recursion.js
  53. 0 { → tests}/bench/templates/partial.js
  54. 0 { → tests}/bench/templates/paths.js
  55. 0 { → tests}/bench/templates/string.js
  56. 0 { → tests}/bench/templates/subexpression.js
  57. 0 { → tests}/bench/templates/variables.js
  58. +1 −1 { → tests}/bench/throughput.js
  59. +13 −15 { → tests}/bench/util/benchwarmer.js
  60. 0 { → tests}/bench/util/template-runner.js
  61. +5 −0 tests/browser/.eslintrc.js
  62. +14 −0 tests/browser/README.md
  63. +27 −0 tests/browser/playwright.config.js
  64. +33 −0 tests/browser/spec.js
  65. +5 −7 {integration-testing → tests/integration}/README.md
  66. 0 {integration-testing → tests/integration}/multi-nodejs-test/.eslintrc.js
  67. 0 {integration-testing → tests/integration}/multi-nodejs-test/.gitignore
  68. +1 −1 {integration-testing → tests/integration}/multi-nodejs-test/package.json
  69. 0 {integration-testing → tests/integration}/multi-nodejs-test/precompile-test-template.txt.hbs
  70. 0 {integration-testing → tests/integration}/multi-nodejs-test/run-handlebars.js
  71. +1 −4 {integration-testing → tests/integration}/multi-nodejs-test/test.sh
  72. +11 −0 tests/integration/rollup-test/.eslintrc.js
  73. 0 {integration-testing/webpack-babel-test → tests/integration/rollup-test}/.gitignore
  74. +14 −0 tests/integration/rollup-test/package.json
  75. +10 −0 tests/integration/rollup-test/rollup.config.js
  76. +8 −0 tests/integration/rollup-test/src/index.js
  77. +11 −0 tests/integration/rollup-test/test.sh
  78. 0 {integration-testing → tests/integration}/run-integration-tests.sh
  79. 0 {integration-testing → tests/integration}/webpack-babel-test/.babelrc
  80. 0 {integration-testing/webpack-test → tests/integration/webpack-babel-test}/.gitignore
  81. +1 −1 {integration-testing → tests/integration}/webpack-babel-test/package.json
  82. +11 −0 tests/integration/webpack-babel-test/src/.eslintrc.js
  83. 0 ...egration-testing → tests/integration}/webpack-babel-test/src/handlebars-inline-precompile-test.js
  84. 0 {integration-testing → tests/integration}/webpack-babel-test/src/lib/assert.js
  85. 0 {integration-testing → tests/integration}/webpack-babel-test/test.sh
  86. 0 {integration-testing → tests/integration}/webpack-babel-test/webpack.config.js
  87. +3 −0 tests/integration/webpack-test/.gitignore
  88. +1 −1 {integration-testing → tests/integration}/webpack-test/package.json
  89. +12 −0 tests/integration/webpack-test/src/.eslintrc.js
  90. 0 {integration-testing → tests/integration}/webpack-test/src/handlebars-default-import-pre-4.2-test.js
  91. 0 {integration-testing → tests/integration}/webpack-test/src/handlebars-default-import-test.js
  92. 0 {integration-testing → tests/integration}/webpack-test/src/handlebars-loader-test.js
  93. 0 {integration-testing → tests/integration}/webpack-test/src/handlebars-require-vs-import-test.js
  94. 0 ...egration-testing → tests/integration}/webpack-test/src/handlebars-wildcard-import-pre-4.2-test.js
  95. 0 {integration-testing → tests/integration}/webpack-test/src/handlebars-wildcard-import-test.js
  96. 0 {integration-testing → tests/integration}/webpack-test/src/lib/assert.js
  97. 0 {integration-testing → tests/integration}/webpack-test/src/test-template.handlebars
  98. 0 {integration-testing → tests/integration}/webpack-test/test.sh
  99. 0 {integration-testing → tests/integration}/webpack-test/webpack.config.js
  100. +49 −29 print-script → tests/print-script.js
@@ -5,3 +5,7 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
@@ -4,7 +4,6 @@
*.sublime-project
*.sublime-workspace
npm-debug.log
sauce_connect.log*
.idea
yarn-error.log
node_modules
@@ -14,7 +13,7 @@ node_modules
# Generated files
/coverage/
/dist/
/integration-testing/*/dist/
/tests/integration/*/dist/

# Third-party or files that must remain unchanged
/spec/expected/
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
open-pull-requests-limit: 0
schedule:
interval: weekly
allow:
- dependency-type: production
@@ -0,0 +1,89 @@
name: CI

on:
push:
branches:
- master
pull_request: {}

jobs:
lint:
name: Lint
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

test:
name: Test (Node)
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest', 'windows-latest']
# https://nodejs.org/en/about/releases/
node-version: ['10', '12', '14', '16', '17']

steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Test
run: npm run test

- name: Test (Integration)
# https://github.com/webpack/webpack/issues/14532
if: ${{ matrix.node-version != '17' }}
run: |
cd ./tests/integration/rollup-test && ./test.sh && cd -
cd ./tests/integration/webpack-babel-test && ./test.sh && cd -
cd ./tests/integration/webpack-test && ./test.sh && cd -
browser:
name: Test (Browser)
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Install dependencies
run: npm ci

- name: Install Playwright
run: |
npx playwright install-deps
npx playwright install
- name: Build
run: npx grunt prepare

- name: Test
run: npm run test:browser
@@ -4,7 +4,6 @@
*.sublime-project
*.sublime-workspace
npm-debug.log
sauce_connect.log*
.idea
/yarn-error.log
/yarn.lock
@@ -15,5 +14,5 @@ node_modules
# Generated files
/coverage/
/dist/
/integration-testing/*/dist/
/tests/integration/*/dist/
/spec/tmp/*
@@ -14,7 +14,7 @@ node_modules
# Generated files
/coverage/
/dist/
/integration-testing/*/dist/
/tests/integration/*/dist/

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

This file was deleted.

@@ -6,23 +6,22 @@ Please don't open issues for security issues. Instead, file a report at https://

## Reporting Issues

Please see our [FAQ](https://github.com/wycats/handlebars.js/blob/master/FAQ.md) for common issues that people run into.
Please see our [FAQ](https://github.com/handlebars-lang/handlebars.js/blob/master/FAQ.md) for common issues that people run into.

Should you run into other issues with the project, please don't hesitate to let us know by filing an [issue][issue]!

In general we are going to ask for an **example** of the problem failing, which can be as simple as a jsfiddle/jsbin/etc. We've put together a jsfiddle **[template][jsfiddle]** to ease this. (We will keep this link up to date as new releases occur, so feel free to check back here).

Pull requests containing only failing tests demonstrating the issue are welcomed and this also helps ensure that your issue won't regress in the future once it's fixed.

Documentation issues on the handlebarsjs.com site should be reported on [handlebars-site](https://github.com/wycats/handlebars-site).
Documentation issues on the [handlebarsjs.com](https://handlebarsjs.com) site should be reported on [handlebars-lang/docs](https://github.com/handlebars-lang/docs).

## Branches

- The branch `4.x` contains the currently released version. Bugfixes should be made in this branch.
- The branch `master` contains the next version. A release date is not yet specified. Maintainers
should merge the branch `4.x` into the master branch regularly.

* The branch `3.x` comtains the legacy version `3.x`. Bugfixes are applied seperately (if needed). The branch will not
- The branch `3.x` contains the legacy version `3.x`. Bugfixes are applied separately (if needed). The branch will not
be merged with any of the other branches.

## Pull Requests
@@ -56,7 +55,7 @@ You can also run our set of benchmarks with `grunt bench`.
The `grunt dev` implements watching for tests and allows for in browser testing at `http://localhost:9999/spec/`.

If you notice any problems, please report them to the GitHub issue tracker at
[http://github.com/wycats/handlebars.js/issues](http://github.com/wycats/handlebars.js/issues).
[http://github.com/handlebars-lang/handlebars.js/issues](http://github.com/handlebars-lang/handlebars.js/issues).

## Running Tests

@@ -87,38 +86,35 @@ We do linting and formatting in two phases:

- Committed files are linted and formatted in a pre-commit hook. In this stage eslint-errors are forbidden,
while warnings are allowed.
- The travis-ci job also lints all files and checks if they are formatted correctly. In this stage, warnings
- The GitHub CI job also lints all files and checks if they are formatted correctly. In this stage, warnings
are forbidden.

You can use the following scripts to make sure that the travis-job does not fail:
You can use the following scripts to make sure that the CI job does not fail:

- **npm run lint** will run `eslint` and fail on warnings
- **npm run format** will run `prettier` on all files
- **npm run check-before-pull-request** will perform all most checks that travis does in its build-job, excluding the "integration-test".
- **npm run check-before-pull-request** will perform all most checks that our CI job does in its build-job, excluding the "integration-test".
- **npm run integration-test** will run integration tests (using old NodeJS versions and integrations with webpack, babel and so on)
These tests only work on a Linux-machine with `nvm` installed (for running tests in multiple versions of NodeJS).

## Releasing the latest version

Before attempting the release Handlebars, please make sure that you have the following authorizations:

- Push-access to `wycats/handlebars.js`
- Push-access to `handlebars-lang/handlebars.js`
- Publishing rights on npmjs.com for the `handlebars` package
- Publishing rights on gemfury for the `handlebars-source` package
- Push-access to the repo for legacy package managers: `components/handlebars`
- Push-access to the production-repo of the handlebars site: `handlebars-lang/handlebarsjs.com-github-pages`

_When releasing a previous version of Handlebars, please look into the CONTRIBUNG.md in the corresponding branch._

Handlebars utilizes the [release yeoman generator][generator-release] to perform most release tasks.

A full release may be completed with the following:

```
npm ci
yo release
npx grunt
npm publish
yo release:publish components handlebars.js dist/components/
cd dist/components/
gem build handlebars-source.gemspec
@@ -135,13 +131,13 @@ in those places still point to the latest version

When everything is OK, the **handlebars site** needs to be updated.

Go to the master branch of the repo [handlebars-lang/handlebarsjs.com-github-pages](https://github.com/handlebars-lang/handlebarsjs.com-github-pages/tree/master)
Go to the master branch of the repo [handlebars-lang/docs](https://github.com/handlebars-lang/docs/tree/master)
and make a minimal change to the README. This will invoke a github-action that redeploys
the site, fetching the latest version-number from the npm-registry.
(note that the default-branch of this repo is not the master and regular changes are done
in the `handlebars-lang/docs`-repo).

[generator-release]: https://github.com/walmartlabs/generator-release
[pull-request]: https://github.com/wycats/handlebars.js/pull/new/master
[issue]: https://github.com/wycats/handlebars.js/issues/new
[pull-request]: https://github.com/handlebars-lang/handlebars.js/pull/new/master
[issue]: https://github.com/handlebars-lang/handlebars.js/issues/new
[jsfiddle]: https://jsfiddle.net/4nbwjaqz/4/
8 FAQ.md
@@ -2,11 +2,11 @@

## How can I file a bug report:

See our guidelines on [reporting issues](https://github.com/wycats/handlebars.js/blob/master/CONTRIBUTING.md#reporting-issues).
See our guidelines on [reporting issues](https://github.com/handlebars-lang/handlebars.js/blob/master/CONTRIBUTING.md#reporting-issues).

## Why isn't my Mustache template working?

Handlebars deviates from Mustache slightly on a few behaviors. These variations are documented in our [readme](https://github.com/wycats/handlebars.js#differences-between-handlebarsjs-and-mustache).
Handlebars deviates from Mustache slightly on a few behaviors. These variations are documented in our [readme](https://github.com/handlebars-lang/handlebars.js#differences-between-handlebarsjs-and-mustache).

## Why is it slower when compiling?

@@ -36,16 +36,18 @@
```sh
handlebars --version
```

If using the integrated precompiler and

```javascript
console.log(Handlebars.VERSION);
```

On the client side.

We include the built client libraries in the npm package for those who want to be certain that they are using the same client libraries as the compiler.

Should these match, please file an issue with us, per our [issue filing guidelines](https://github.com/wycats/handlebars.js/blob/master/CONTRIBUTING.md#reporting-issues).
Should these match, please file an issue with us, per our [issue filing guidelines](https://github.com/handlebars-lang/handlebars.js/blob/master/CONTRIBUTING.md#reporting-issues).

## How do I load the runtime library when using AMD?

0 comments on commit 82c6132

Please sign in to comment.