Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ca0d385a6c | |||
| 520e1d5f08 | |||
| 02423780a9 | |||
| be92d2f254 | |||
| 443a613b3a | |||
| 83ee5908f2 | |||
| 8dc3d2517b | |||
| 668c4fb878 | |||
| c65c6cce3f | |||
| 3d3796c1e9 | |||
| 075b354a3b | |||
| 30dbf04781 | |||
| e3a54485db | |||
| 8e23642ea2 | |||
| 88ac06875f | |||
| c68bc08a0d | |||
| 6cfbc2653a | |||
| b65135acef | |||
| e2f63da5c0 | |||
| 78e7e28ff9 | |||
| 03d387bf8e | |||
| e0f50b4eec | |||
| 9ed9418488 | |||
| ef0fc290b9 | |||
| edc65b5c19 | |||
| 715f4af179 | |||
| 3bd0fa8b32 | |||
| c295ef085f | |||
| c1ad3c8057 | |||
| af92e32822 | |||
| 2954e7ea66 | |||
| 8eefee56ff | |||
| fd93073146 | |||
| a9a8e40321 | |||
| e66aed5b99 | |||
| 7d4d170ce4 | |||
| eb860c0899 | |||
| b6d3de7123 | |||
| f058970169 |
@@ -0,0 +1,14 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*.js]
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[spec/expected/*.js]
|
||||||
|
insert_final_newline = false
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
+1
-2
@@ -4,7 +4,6 @@
|
|||||||
*.sublime-project
|
*.sublime-project
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
sauce_connect.log*
|
|
||||||
.idea
|
.idea
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
node_modules
|
node_modules
|
||||||
@@ -15,7 +14,7 @@ node_modules
|
|||||||
lib/handlebars/compiler/parser.js
|
lib/handlebars/compiler/parser.js
|
||||||
/coverage/
|
/coverage/
|
||||||
/dist/
|
/dist/
|
||||||
/integration-testing/*/dist/
|
/tests/integration/*/dist/
|
||||||
|
|
||||||
# Third-party or files that must remain unchanged
|
# Third-party or files that must remain unchanged
|
||||||
/spec/expected/
|
/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', '18', '20']
|
||||||
|
|
||||||
|
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 != '18' && matrix.node-version != '20' }}
|
||||||
|
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-20.04'
|
||||||
|
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
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-aws-s3:
|
||||||
|
name: Publish to AWS S3
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
environment: 'builds.handlebarsjs.com.s3.amazonaws.com'
|
||||||
|
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: Publish
|
||||||
|
run: |
|
||||||
|
git config --global user.email "release@handlebarsjs.com"
|
||||||
|
git config --global user.name "handlebars-lang"
|
||||||
|
npm run publish:aws
|
||||||
|
env:
|
||||||
|
S3_BUCKET_NAME: "builds.handlebarsjs.com"
|
||||||
|
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
|
||||||
|
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
|
||||||
+2
-3
@@ -4,7 +4,6 @@
|
|||||||
*.sublime-project
|
*.sublime-project
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
sauce_connect.log*
|
|
||||||
.idea
|
.idea
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
@@ -16,5 +15,5 @@ node_modules
|
|||||||
lib/handlebars/compiler/parser.js
|
lib/handlebars/compiler/parser.js
|
||||||
/coverage/
|
/coverage/
|
||||||
/dist/
|
/dist/
|
||||||
/integration-testing/*/dist/
|
/tests/integration/*/dist/
|
||||||
/spec/tmp/*
|
/spec/tmp/*
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
[submodule "spec/mustache"]
|
[submodule "spec/mustache"]
|
||||||
path = spec/mustache
|
path = spec/mustache
|
||||||
url = git://github.com/mustache/spec.git
|
url = https://github.com/mustache/spec.git
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ node_modules
|
|||||||
lib/handlebars/compiler/parser.js
|
lib/handlebars/compiler/parser.js
|
||||||
/coverage/
|
/coverage/
|
||||||
/dist/
|
/dist/
|
||||||
/integration-testing/*/dist/
|
/tests/integration/*/dist/
|
||||||
|
|
||||||
# Third-party or files that must remain unchanged
|
# Third-party or files that must remain unchanged
|
||||||
/spec/expected/
|
/spec/expected/
|
||||||
|
|||||||
-39
@@ -1,39 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
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
|
|
||||||
git:
|
|
||||||
depth: 100
|
|
||||||
+92
-28
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
## Reporting Issues
|
## 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)
|
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.
|
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
|
## Branches
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ 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/`.
|
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
|
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
|
## Running Tests
|
||||||
|
|
||||||
To run tests locally, first install all dependencies.
|
To run tests locally, first install all dependencies.
|
||||||
|
|
||||||
@@ -78,43 +78,107 @@ 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,
|
- Committed files are linted and formatted in a pre-commit hook. In this stage eslint-errors are forbidden,
|
||||||
while warnings are allowed.
|
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.
|
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 lint** will run `eslint` and fail on warnings
|
||||||
- **npm run format** will run `prettier` on all files
|
- **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)
|
- **npm run test:integration** 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).
|
These tests only work on a Linux-machine with `nvm` installed (for running tests in multiple versions of NodeJS).
|
||||||
|
|
||||||
## Releasing the latest version
|
## Releasing the latest version
|
||||||
|
|
||||||
Before attempting the release Handlebars, please make sure that you have the following authorizations:
|
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](https://github.com/handlebars-lang/handlebars.js/)
|
||||||
- Publishing rights on npmjs.com for the `handlebars` package
|
- Publishing rights on npmjs.com for the [handlebars](https://www.npmjs.com/package/handlebars) package
|
||||||
- Publishing rights on gemfury for the `handlebars-source` package
|
- Publishing rights on rubygems for the [handlebars-source](https://rubygems.org/gems/handlebars-source) package
|
||||||
- Push-access to the repo for legacy package managers: `components/handlebars`
|
- Push-access to the repo for legacy package managers: [components/handlebars.js](https://github.com/components/handlebars.js)
|
||||||
- Push-access to the production-repo of the handlebars site: `handlebars-lang/handlebarsjs.com-github-pages`
|
- Push-access to the production-repo of the handlebars site: [handlebars-lang/docs](https://github.com/handlebars-lang/docs)
|
||||||
|
|
||||||
_When releasing a previous version of Handlebars, please look into the CONTRIBUNG.md in the corresponding branch._
|
_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 via Docker may be completed with the following:
|
||||||
|
|
||||||
A full release may be completed with the following:
|
1. Create a `Dockerfile` in this folder for releasing
|
||||||
|
```Dockerfile
|
||||||
|
FROM node:10-slim
|
||||||
|
|
||||||
|
ENV EDITOR=vim
|
||||||
|
|
||||||
|
# Update stretch repositories
|
||||||
|
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
|
||||||
|
-e 's|security.debian.org|archive.debian.org/|g' \
|
||||||
|
-e '/stretch-updates/d' /etc/apt/sources.list
|
||||||
|
|
||||||
|
# Install release dependencies
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y git vim
|
||||||
|
|
||||||
|
# Work around deprecated npm dependency install via unauthenticated git-protocol:
|
||||||
|
# https://github.com/kpdecker/generator-release/blob/87aab9b84c9f083635c3fcc822f18acce1f48736/package.json#L31
|
||||||
|
RUN git config --system url."https://github.com/".insteadOf git://github.com/
|
||||||
|
|
||||||
|
# Configure git
|
||||||
|
RUN git config --system user.email "release@handlebarsjs.com"
|
||||||
|
RUN git config --system user.name "handlebars-lang"
|
||||||
|
|
||||||
|
RUN mkdir /home/node/.config
|
||||||
|
RUN mkdir /home/node/.ssh
|
||||||
|
RUN mkdir /home/node/tmp
|
||||||
|
|
||||||
|
# Generate config for yo generator-release:
|
||||||
|
# https://github.com/kpdecker/generator-release#example
|
||||||
|
# You have to add a valid GitHub OAuth token!
|
||||||
|
RUN echo "module.exports = {\n auth: 'oauth',\n token: 'GitHub OAuth token'\n};" > /home/node/.config/generator-release
|
||||||
|
RUN chown -R node:node /home/node/.config
|
||||||
|
|
||||||
|
# Add the generated key to GitHub: https://github.com/settings/keys
|
||||||
|
RUN ssh-keygen -q -t ed25519 -N '' -f /home/node/.ssh/id_ed25519 -C "release@handlebarsjs.com"
|
||||||
|
RUN chmod 0600 /home/node/.ssh/id_ed25519*
|
||||||
|
RUN chown node:node /home/node/.ssh/id_ed25519*
|
||||||
|
```
|
||||||
|
2. Build and run the Docker image
|
||||||
|
```bash
|
||||||
|
docker build --tag handlebars:release .
|
||||||
|
docker run --rm --interactive --tty \
|
||||||
|
--volume $PWD:/app \
|
||||||
|
--workdir /app \
|
||||||
|
--user $(id -u):$(id -g) \
|
||||||
|
--env NPM_CONFIG_PREFIX=/home/node/.npm-global \
|
||||||
|
handlebars:release bash -c 'export PATH=$PATH:/home/node/.npm-global/bin; bash'
|
||||||
|
```
|
||||||
|
* Add SSH key to GitHub: `cat /home/node/.ssh/id_ed25519.pub` (https://github.com/settings/keys)
|
||||||
|
* Add GitHub API token: `vi /home/node/.config/generator-release`
|
||||||
|
* Execute the following steps:
|
||||||
|
```bash
|
||||||
|
npm ci
|
||||||
|
npm install -g yo@1 grunt@1 generator-release
|
||||||
|
npm run release
|
||||||
|
yo release
|
||||||
|
npm login
|
||||||
|
npm publish
|
||||||
|
yo release:publish components handlebars.js dist/components/
|
||||||
|
```
|
||||||
|
6. Publish Ruby `handlebars-source` gem:
|
||||||
|
```bash
|
||||||
|
docker run --rm --interactive --tty \
|
||||||
|
--volume $PWD:/app \
|
||||||
|
--workdir /app \
|
||||||
|
--user $(id -u):$(id -g) \
|
||||||
|
ruby:3.2-slim bash
|
||||||
|
```
|
||||||
|
* Execute the following steps:
|
||||||
|
```bash
|
||||||
|
cd dist/components/
|
||||||
|
gem build handlebars-source.gemspec
|
||||||
|
gem push handlebars-source-*.gem
|
||||||
|
```
|
||||||
|
|
||||||
```
|
### After the release
|
||||||
npm ci
|
|
||||||
yo release
|
|
||||||
npm publish
|
|
||||||
yo release:publish components handlebars.js dist/components/
|
|
||||||
|
|
||||||
cd dist/components/
|
|
||||||
gem build handlebars-source.gemspec
|
|
||||||
gem push handlebars-source-*.gem
|
|
||||||
```
|
|
||||||
|
|
||||||
After the release, you should check that all places have really been updated. Especially verify that the `latest`-tags
|
After the release, you should check that all places have really been updated. Especially verify that the `latest`-tags
|
||||||
in those places still point to the latest version
|
in those places still point to the latest version
|
||||||
@@ -126,13 +190,13 @@ in those places still point to the latest version
|
|||||||
|
|
||||||
When everything is OK, the **handlebars site** needs to be updated.
|
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
|
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.
|
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
|
(note that the default-branch of this repo is not the master and regular changes are done
|
||||||
in the `handlebars-lang/docs`-repo).
|
in the `handlebars-lang/docs`-repo).
|
||||||
|
|
||||||
[generator-release]: https://github.com/walmartlabs/generator-release
|
[generator-release]: https://github.com/walmartlabs/generator-release
|
||||||
[pull-request]: https://github.com/wycats/handlebars.js/pull/new/master
|
[pull-request]: https://github.com/handlebars-lang/handlebars.js/pull/new/master
|
||||||
[issue]: https://github.com/wycats/handlebars.js/issues/new
|
[issue]: https://github.com/handlebars-lang/handlebars.js/issues/new
|
||||||
[jsfiddle]: https://jsfiddle.net/9D88g/180/
|
[jsfiddle]: https://jsfiddle.net/9D88g/180/
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
1. How can I file a bug report:
|
1. 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).
|
||||||
|
|
||||||
1. Why isn't my Mustache template working?
|
1. 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).
|
||||||
|
|
||||||
1. Why is it slower when compiling?
|
1. Why is it slower when compiling?
|
||||||
|
|
||||||
@@ -36,16 +36,18 @@
|
|||||||
```sh
|
```sh
|
||||||
handlebars --version
|
handlebars --version
|
||||||
```
|
```
|
||||||
|
|
||||||
If using the integrated precompiler and
|
If using the integrated precompiler and
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
console.log(Handlebars.VERSION);
|
console.log(Handlebars.VERSION);
|
||||||
```
|
```
|
||||||
|
|
||||||
On the client side.
|
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.
|
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).
|
||||||
|
|
||||||
1. Why doesn't IE like the `default` name in the AMD module?
|
1. Why doesn't IE like the `default` name in the AMD module?
|
||||||
|
|
||||||
@@ -53,8 +55,8 @@
|
|||||||
|
|
||||||
1. How do I load the runtime library when using AMD?
|
1. How do I load the runtime library when using AMD?
|
||||||
|
|
||||||
There are two options for loading under AMD environments. The first is to use the `handlebars.runtime.amd.js` file. This may require a [path mapping](https://github.com/wycats/handlebars.js/blob/master/spec/amd-runtime.html#L31) as well as access via the `default` field.
|
There are two options for loading under AMD environments. The first is to use the `handlebars.runtime.amd.js` file. This may require a [path mapping](https://github.com/handlebars-lang/handlebars.js/blob/master/spec/amd-runtime.html#L31) as well as access via the `default` field.
|
||||||
|
|
||||||
The other option is to load the `handlebars.runtime.js` UMD build, which might not require path configuration and exposes the library as both the module root and the `default` field for compatibility.
|
The other option is to load the `handlebars.runtime.js` UMD build, which might not require path configuration and exposes the library as both the module root and the `default` field for compatibility.
|
||||||
|
|
||||||
If not using ES6 transpilers or accessing submodules in the build the former option should be sufficient for most use cases.
|
If not using ES6 transpilers or accessing submodules in the build the former option should be sufficient for most use cases.
|
||||||
|
|||||||
+21
-82
@@ -7,7 +7,7 @@ module.exports = function(grunt) {
|
|||||||
'tmp',
|
'tmp',
|
||||||
'dist',
|
'dist',
|
||||||
'lib/handlebars/compiler/parser.js',
|
'lib/handlebars/compiler/parser.js',
|
||||||
'integration-testing/**/node_modules'
|
'/tests/integration/**/node_modules'
|
||||||
],
|
],
|
||||||
|
|
||||||
copy: {
|
copy: {
|
||||||
@@ -165,54 +165,10 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'saucelabs-mocha': {
|
|
||||||
all: {
|
|
||||||
options: {
|
|
||||||
build: process.env.TRAVIS_JOB_ID,
|
|
||||||
urls: [
|
|
||||||
'http://localhost:9999/spec/?headless=true',
|
|
||||||
'http://localhost:9999/spec/amd.html?headless=true'
|
|
||||||
],
|
|
||||||
detailedError: true,
|
|
||||||
concurrency: 4,
|
|
||||||
browsers: [
|
|
||||||
{ browserName: 'chrome' },
|
|
||||||
{ browserName: 'firefox', platform: 'Linux' },
|
|
||||||
// {browserName: 'safari', version: 9, platform: 'OS X 10.11'},
|
|
||||||
// {browserName: 'safari', version: 8, platform: 'OS X 10.10'},
|
|
||||||
{
|
|
||||||
browserName: 'internet explorer',
|
|
||||||
version: 11,
|
|
||||||
platform: 'Windows 8.1'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
browserName: 'internet explorer',
|
|
||||||
version: 10,
|
|
||||||
platform: 'Windows 8'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sanity: {
|
|
||||||
options: {
|
|
||||||
build: process.env.TRAVIS_JOB_ID,
|
|
||||||
urls: [
|
|
||||||
'http://localhost:9999/spec/umd.html?headless=true',
|
|
||||||
'http://localhost:9999/spec/amd-runtime.html?headless=true',
|
|
||||||
'http://localhost:9999/spec/umd-runtime.html?headless=true'
|
|
||||||
],
|
|
||||||
detailedError: true,
|
|
||||||
concurrency: 2,
|
|
||||||
browsers: [{ browserName: 'chrome' }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
bgShell: {
|
shell: {
|
||||||
integrationTests: {
|
integrationTests: {
|
||||||
cmd: './integration-testing/run-integration-tests.sh',
|
command: './tests/integration/run-integration-tests.sh'
|
||||||
bg: false,
|
|
||||||
fail: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -237,23 +193,15 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
grunt.loadNpmTasks('grunt-babel');
|
grunt.loadNpmTasks('grunt-babel');
|
||||||
grunt.loadNpmTasks('grunt-bg-shell');
|
grunt.loadNpmTasks('grunt-shell');
|
||||||
grunt.loadNpmTasks('@knappi/grunt-saucelabs');
|
|
||||||
grunt.loadNpmTasks('grunt-webpack');
|
grunt.loadNpmTasks('grunt-webpack');
|
||||||
|
|
||||||
grunt.task.loadTasks('tasks');
|
grunt.task.loadTasks('tasks');
|
||||||
|
|
||||||
this.registerTask(
|
grunt.registerTask('node', ['babel:cjs']);
|
||||||
'build',
|
grunt.registerTask('amd', ['babel:amd', 'requirejs']);
|
||||||
'Builds a distributable version of the current project',
|
grunt.registerTask('globals', ['webpack']);
|
||||||
['parser', 'node', 'globals']
|
grunt.registerTask('release', 'Build final packages', [
|
||||||
);
|
|
||||||
|
|
||||||
this.registerTask('node', ['babel:cjs']);
|
|
||||||
this.registerTask('globals', ['webpack']);
|
|
||||||
|
|
||||||
this.registerTask('release', 'Build final packages', [
|
|
||||||
'amd',
|
|
||||||
'uglify',
|
'uglify',
|
||||||
'test:min',
|
'test:min',
|
||||||
'copy:dist',
|
'copy:dist',
|
||||||
@@ -261,38 +209,29 @@ module.exports = function(grunt) {
|
|||||||
'copy:cdnjs'
|
'copy:cdnjs'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.registerTask('amd', ['babel:amd', 'requirejs']);
|
// Requires secret properties from .travis.yaml
|
||||||
|
|
||||||
this.registerTask('test', ['test:bin', 'test:cov']);
|
|
||||||
|
|
||||||
grunt.registerTask('bench', ['metrics']);
|
|
||||||
|
|
||||||
if (process.env.SAUCE_ACCESS_KEY) {
|
|
||||||
grunt.registerTask('sauce', ['concat:tests', 'connect', 'saucelabs-mocha']);
|
|
||||||
} else {
|
|
||||||
grunt.registerTask('sauce', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Requires secret properties (saucelabs-credentials etc.) from .travis.yaml
|
|
||||||
grunt.registerTask('extensive-tests-and-publish-to-aws', [
|
grunt.registerTask('extensive-tests-and-publish-to-aws', [
|
||||||
'default',
|
'default',
|
||||||
'bgShell:integrationTests',
|
'shell:integrationTests',
|
||||||
'sauce',
|
|
||||||
'metrics',
|
'metrics',
|
||||||
'publish-to-aws'
|
'publish-to-aws'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('on-file-change', [
|
|
||||||
'build',
|
grunt.registerTask('on-file-change', ['build', 'concat:tests', 'test']);
|
||||||
'amd',
|
|
||||||
'concat:tests',
|
|
||||||
'test'
|
|
||||||
]);
|
|
||||||
|
|
||||||
// === Primary tasks ===
|
// === Primary tasks ===
|
||||||
grunt.registerTask('dev', ['clean', 'connect', 'watch']);
|
grunt.registerTask('dev', ['clean', 'connect', 'watch']);
|
||||||
grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
|
grunt.registerTask('default', ['clean', 'build', 'test', 'release']);
|
||||||
|
grunt.registerTask('test', ['test:bin', 'test:cov']);
|
||||||
|
grunt.registerTask('bench', ['metrics']);
|
||||||
|
grunt.registerTask('prepare', ['build', 'concat:tests']);
|
||||||
|
grunt.registerTask(
|
||||||
|
'build',
|
||||||
|
'Builds a distributable version of the current project',
|
||||||
|
['parser', 'node', 'amd', 'globals']
|
||||||
|
);
|
||||||
grunt.registerTask('integration-tests', [
|
grunt.registerTask('integration-tests', [
|
||||||
'default',
|
'default',
|
||||||
'bgShell:integrationTests'
|
'shell:integrationTests'
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|||||||
+15
-16
@@ -1,17 +1,18 @@
|
|||||||
[](https://travis-ci.org/wycats/handlebars.js)
|
[](https://github.com/handlebars-lang/handlebars.js/actions/workflows/ci.yml)
|
||||||
[](https://ci.appveyor.com/project/wycats/handlebars-js)
|
[](https://www.jsdelivr.com/package/npm/handlebars)
|
||||||
[](https://saucelabs.com/u/handlebars)
|
[](https://www.npmjs.com/package/handlebars)
|
||||||
|
[](https://www.npmjs.com/package/handlebars)
|
||||||
|
[](https://bundlephobia.com/package/handlebars)
|
||||||
|
[](https://packagephobia.com/result?p=handlebars)
|
||||||
|
|
||||||
Handlebars.js
|
Handlebars.js
|
||||||
=============
|
=============
|
||||||
|
|
||||||
Handlebars.js is an extension to the [Mustache templating
|
Handlebars provides the power necessary to let you build **semantic templates** effectively with no frustration.
|
||||||
language](http://mustache.github.com/) created by Chris Wanstrath.
|
Handlebars is largely compatible with Mustache templates. In most cases it is possible to swap out Mustache with Handlebars and continue using your current templates.
|
||||||
Handlebars.js and Mustache are both logicless templating languages that
|
|
||||||
keep the view and the code separated like we all know they should be.
|
|
||||||
|
|
||||||
Checkout the official Handlebars docs site at
|
Checkout the official Handlebars docs site at
|
||||||
[https://handlebarsjs.com/](https://handlebarsjs.com) and the live demo at [http://tryhandlebarsjs.com/](http://tryhandlebarsjs.com/).
|
[handlebarsjs.com](https://handlebarsjs.com) and try our [live demo](https://handlebarsjs.com/playground.html).
|
||||||
|
|
||||||
Installing
|
Installing
|
||||||
----------
|
----------
|
||||||
@@ -22,7 +23,7 @@ Usage
|
|||||||
-----
|
-----
|
||||||
In general, the syntax of Handlebars.js templates is a superset
|
In general, the syntax of Handlebars.js templates is a superset
|
||||||
of Mustache templates. For basic syntax, check out the [Mustache
|
of Mustache templates. For basic syntax, check out the [Mustache
|
||||||
manpage](http://mustache.github.com/mustache.5.html).
|
manpage](https://mustache.github.io/mustache.5.html).
|
||||||
|
|
||||||
Once you have a template, use the `Handlebars.compile` method to compile
|
Once you have a template, use the `Handlebars.compile` method to compile
|
||||||
the template into a function. The generated function takes a context
|
the template into a function. The generated function takes a context
|
||||||
@@ -64,7 +65,7 @@ templates easier and also changes a tiny detail of how partials work.
|
|||||||
- [Literal Values](https://handlebarsjs.com/guide/expressions.html#literal-segments)
|
- [Literal Values](https://handlebarsjs.com/guide/expressions.html#literal-segments)
|
||||||
- [Delimited Comments](https://handlebarsjs.com/guide/#template-comments)
|
- [Delimited Comments](https://handlebarsjs.com/guide/#template-comments)
|
||||||
|
|
||||||
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](http://mustache.github.io/mustache.5.html) defines the exact behavior of sections. In the case of name conflicts, helpers are given priority.
|
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.
|
||||||
|
|
||||||
### Compatibility
|
### Compatibility
|
||||||
|
|
||||||
@@ -89,8 +90,6 @@ Handlebars has been designed to work in any ECMAScript 3 environment. This inclu
|
|||||||
Older versions and other runtimes are likely to work but have not been formally
|
Older versions and other runtimes are likely to work but have not been formally
|
||||||
tested. The compiler requires `JSON.stringify` to be implemented natively or via a polyfill. If using the precompiler this is not necessary.
|
tested. The compiler requires `JSON.stringify` to be implemented natively or via a polyfill. If using the precompiler this is not necessary.
|
||||||
|
|
||||||
[](https://saucelabs.com/u/handlebars)
|
|
||||||
|
|
||||||
Performance
|
Performance
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
@@ -102,18 +101,18 @@ does have some big performance advantages. Justin Marney, a.k.a.
|
|||||||
[gotascii](http://github.com/gotascii), confirmed that with an
|
[gotascii](http://github.com/gotascii), confirmed that with an
|
||||||
[independent test](http://sorescode.com/2010/09/12/benchmarks.html). The
|
[independent test](http://sorescode.com/2010/09/12/benchmarks.html). The
|
||||||
rewritten Handlebars (current version) is faster than the old version,
|
rewritten Handlebars (current version) is faster than the old version,
|
||||||
with many [performance tests](https://travis-ci.org/wycats/handlebars.js/builds/33392182#L538) being 5 to 7 times faster than the Mustache equivalent.
|
with many performance tests being 5 to 7 times faster than the Mustache equivalent.
|
||||||
|
|
||||||
|
|
||||||
Upgrading
|
Upgrading
|
||||||
---------
|
---------
|
||||||
|
|
||||||
See [release-notes.md](https://github.com/wycats/handlebars.js/blob/master/release-notes.md) for upgrade notes.
|
See [release-notes.md](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md) for upgrade notes.
|
||||||
|
|
||||||
Known Issues
|
Known Issues
|
||||||
------------
|
------------
|
||||||
|
|
||||||
See [FAQ.md](https://github.com/wycats/handlebars.js/blob/master/FAQ.md) for known issues and common pitfalls.
|
See [FAQ.md](https://github.com/handlebars-lang/handlebars.js/blob/master/FAQ.md) for known issues and common pitfalls.
|
||||||
|
|
||||||
|
|
||||||
Handlebars in the Wild
|
Handlebars in the Wild
|
||||||
@@ -165,4 +164,4 @@ License
|
|||||||
-------
|
-------
|
||||||
Handlebars.js is released under the MIT license.
|
Handlebars.js is released under the MIT license.
|
||||||
|
|
||||||
[pull-request]: https://github.com/wycats/handlebars.js/pull/new/master
|
[pull-request]: https://github.com/handlebars-lang/handlebars.js/pull/new/master
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
# Test against these versions of Node.js
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- nodejs_version: "10"
|
|
||||||
|
|
||||||
platform:
|
|
||||||
- x64
|
|
||||||
|
|
||||||
# Install scripts (runs after repo cloning)
|
|
||||||
install:
|
|
||||||
# Get the latest stable version of Node.js
|
|
||||||
- ps: Install-Product node $env:nodejs_version $env:platform
|
|
||||||
# Clone submodules (mustache spec)
|
|
||||||
- cmd: git submodule update --init --recursive
|
|
||||||
# Install modules
|
|
||||||
- cmd: npm ci
|
|
||||||
|
|
||||||
|
|
||||||
# Post-install test scripts
|
|
||||||
test_script:
|
|
||||||
# Output useful info for debugging
|
|
||||||
- cmd: node --version
|
|
||||||
- cmd: npm --version
|
|
||||||
# Run tests
|
|
||||||
- cmd: npm run test
|
|
||||||
|
|
||||||
# Don't actually build
|
|
||||||
build: off
|
|
||||||
|
|
||||||
on_failure:
|
|
||||||
- cmd: 7z a coverage.zip coverage
|
|
||||||
- cmd: appveyor PushArtifact coverage.zip
|
|
||||||
|
|
||||||
|
|
||||||
# Set build version format here instead of in the admin panel
|
|
||||||
version: "{build}"
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "prettier",
|
|
||||||
"globals": {
|
|
||||||
"require": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
// Disabling for tests, for now.
|
|
||||||
"no-path-concat": 0,
|
|
||||||
|
|
||||||
"no-var": 0,
|
|
||||||
"no-shadow": 0,
|
|
||||||
"handle-callback-err": 0,
|
|
||||||
"no-console": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "handlebars",
|
"name": "handlebars",
|
||||||
"version": "4.7.6",
|
"version": "4.7.8",
|
||||||
"main": "handlebars.js",
|
"main": "handlebars.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|||||||
gem.date = Time.now.strftime("%Y-%m-%d")
|
gem.date = Time.now.strftime("%Y-%m-%d")
|
||||||
gem.description = %q{Handlebars.js source code wrapper for (pre)compilation gems.}
|
gem.description = %q{Handlebars.js source code wrapper for (pre)compilation gems.}
|
||||||
gem.summary = %q{Handlebars.js source code wrapper}
|
gem.summary = %q{Handlebars.js source code wrapper}
|
||||||
gem.homepage = "https://github.com/wycats/handlebars.js/"
|
gem.homepage = "https://github.com/handlebars-lang/handlebars.js/"
|
||||||
gem.version = package["version"].sub "-", "."
|
gem.version = package["version"].sub "-", "."
|
||||||
gem.license = "MIT"
|
gem.license = "MIT"
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
<package>
|
<package>
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>handlebars.js</id>
|
<id>handlebars.js</id>
|
||||||
<version>4.7.6</version>
|
<version>4.7.8</version>
|
||||||
<authors>handlebars.js Authors</authors>
|
<authors>handlebars.js Authors</authors>
|
||||||
<licenseUrl>https://github.com/wycats/handlebars.js/blob/master/LICENSE</licenseUrl>
|
<licenseUrl>https://github.com/handlebars-lang/handlebars.js/blob/master/LICENSE</licenseUrl>
|
||||||
<projectUrl>https://github.com/wycats/handlebars.js/</projectUrl>
|
<projectUrl>https://github.com/handlebars-lang/handlebars.js/</projectUrl>
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<description>Extension of the Mustache logicless template language</description>
|
<description>Extension of the Mustache logicless template language</description>
|
||||||
<releaseNotes></releaseNotes>
|
<releaseNotes></releaseNotes>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "handlebars",
|
"name": "handlebars",
|
||||||
"version": "4.7.6",
|
"version": "4.7.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"jspm": {
|
"jspm": {
|
||||||
"main": "handlebars",
|
"main": "handlebars",
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ Decorators are executed when the block program is instantiated and are passed `(
|
|||||||
|
|
||||||
Decorators may set values on `props` or return a modified function that wraps `program` in particular behaviors. If the decorator returns nothing, then `program` is left unaltered.
|
Decorators may set values on `props` or return a modified function that wraps `program` in particular behaviors. If the decorator returns nothing, then `program` is left unaltered.
|
||||||
|
|
||||||
The [inline partial](https://github.com/wycats/handlebars.js/blob/master/lib/handlebars/decorators/inline.js) implementation provides an example of decorators being used for both metadata and wrapping behaviors.
|
The [inline partial](https://github.com/handlebars-lang/handlebars.js/blob/master/lib/handlebars/decorators/inline.js) implementation provides an example of decorators being used for both metadata and wrapping behaviors.
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "webpack-test",
|
|
||||||
"description": "Various tests with Handlebars and Webpack",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "webpack --config webpack.config.js",
|
|
||||||
"test": "node dist/main.js"
|
|
||||||
},
|
|
||||||
"private": true,
|
|
||||||
"keywords": [],
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
|
||||||
"handlebars": "file:../..",
|
|
||||||
"handlebars-loader": "^1.7.1",
|
|
||||||
"webpack": "^4.39.3",
|
|
||||||
"webpack-cli": "^3.3.7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
// Handlebars should not use node or browser-specific APIs
|
||||||
|
'shared-node-browser': true,
|
||||||
|
node: false,
|
||||||
|
browser: false
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -5,7 +5,7 @@ import { registerDefaultDecorators } from './decorators';
|
|||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
import { resetLoggedProperties } from './internal/proto-access';
|
import { resetLoggedProperties } from './internal/proto-access';
|
||||||
|
|
||||||
export const VERSION = '4.7.6';
|
export const VERSION = '4.7.8';
|
||||||
export const COMPILER_REVISION = 8;
|
export const COMPILER_REVISION = 8;
|
||||||
export const LAST_COMPATIBLE_COMPILER_REVISION = 7;
|
export const LAST_COMPATIBLE_COMPILER_REVISION = 7;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global define */
|
/* global define, require */
|
||||||
import { isArray } from '../utils';
|
import { isArray } from '../utils';
|
||||||
|
|
||||||
let SourceNode;
|
let SourceNode;
|
||||||
@@ -6,7 +6,7 @@ let SourceNode;
|
|||||||
try {
|
try {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
if (typeof define !== 'function' || !define.amd) {
|
if (typeof define !== 'function' || !define.amd) {
|
||||||
// We don't support this in AMD environments. For these environments, we asusme that
|
// We don't support this in AMD environments. For these environments, we assume that
|
||||||
// they are running on the browser and thus have no need for the source-map library.
|
// they are running on the browser and thus have no need for the source-map library.
|
||||||
let SourceMap = require('source-map');
|
let SourceMap = require('source-map');
|
||||||
SourceNode = SourceMap.SourceNode;
|
SourceNode = SourceMap.SourceNode;
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ JavaScriptCompiler.prototype = {
|
|||||||
return this.internalNameLookup(parent, name);
|
return this.internalNameLookup(parent, name);
|
||||||
},
|
},
|
||||||
depthedLookup: function(name) {
|
depthedLookup: function(name) {
|
||||||
return [this.aliasable('container.lookup'), '(depths, "', name, '")'];
|
return [
|
||||||
|
this.aliasable('container.lookup'),
|
||||||
|
'(depths, ',
|
||||||
|
JSON.stringify(name),
|
||||||
|
')'
|
||||||
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
compilerInfo: function() {
|
compilerInfo: function() {
|
||||||
@@ -303,7 +308,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
|
|
||||||
if (appendOnly) {
|
if (appendOnly) {
|
||||||
if (bufferStart) {
|
if (bufferStart) {
|
||||||
bufferStart.prepend('return ');
|
bufferStart.prepend('return ""+');
|
||||||
bufferEnd.add(';');
|
bufferEnd.add(';');
|
||||||
} else if (!sourceSeen) {
|
} else if (!sourceSeen) {
|
||||||
this.source.push('return "";');
|
this.source.push('return "";');
|
||||||
@@ -532,7 +537,9 @@ JavaScriptCompiler.prototype = {
|
|||||||
|
|
||||||
resolvePath: function(type, parts, i, falsy, strict) {
|
resolvePath: function(type, parts, i, falsy, strict) {
|
||||||
if (this.options.strict || this.options.assumeObjects) {
|
if (this.options.strict || this.options.assumeObjects) {
|
||||||
this.push(strictLookup(this.options.strict && strict, this, parts, type));
|
this.push(
|
||||||
|
strictLookup(this.options.strict && strict, this, parts, i, type)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1256,9 +1263,8 @@ JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function strictLookup(requireTerminal, compiler, parts, type) {
|
function strictLookup(requireTerminal, compiler, parts, i, type) {
|
||||||
let stack = compiler.popStack(),
|
let stack = compiler.popStack(),
|
||||||
i = 0,
|
|
||||||
len = parts.length;
|
len = parts.length;
|
||||||
if (requireTerminal) {
|
if (requireTerminal) {
|
||||||
len--;
|
len--;
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ export default function(instance) {
|
|||||||
execIteration(i, i, i === context.length - 1);
|
execIteration(i, i, i === context.length - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (global.Symbol && context[global.Symbol.iterator]) {
|
} else if (typeof Symbol === 'function' && context[Symbol.iterator]) {
|
||||||
const newContext = [];
|
const newContext = [];
|
||||||
const iterator = context[global.Symbol.iterator]();
|
const iterator = context[Symbol.iterator]();
|
||||||
for (let it = iterator.next(); !it.done; it = iterator.next()) {
|
for (let it = iterator.next(); !it.done; it = iterator.next()) {
|
||||||
newContext.push(it.value);
|
newContext.push(it.value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createNewLookupObject } from './create-new-lookup-object';
|
import { createNewLookupObject } from './create-new-lookup-object';
|
||||||
import * as logger from '../logger';
|
import logger from '../logger';
|
||||||
|
|
||||||
const loggedProperties = Object.create(null);
|
const loggedProperties = Object.create(null);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
|
/* global globalThis */
|
||||||
export default function(Handlebars) {
|
export default function(Handlebars) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
let root = typeof global !== 'undefined' ? global : window,
|
// https://mathiasbynens.be/notes/globalthis
|
||||||
$Handlebars = root.Handlebars;
|
(function() {
|
||||||
|
if (typeof globalThis === 'object') return;
|
||||||
|
Object.prototype.__defineGetter__('__magic__', function() {
|
||||||
|
return this;
|
||||||
|
});
|
||||||
|
__magic__.globalThis = __magic__; // eslint-disable-line no-undef
|
||||||
|
delete Object.prototype.__magic__;
|
||||||
|
})();
|
||||||
|
|
||||||
|
const $Handlebars = globalThis.Handlebars;
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
Handlebars.noConflict = function() {
|
Handlebars.noConflict = function() {
|
||||||
if (root.Handlebars === Handlebars) {
|
if (globalThis.Handlebars === Handlebars) {
|
||||||
root.Handlebars = $Handlebars;
|
globalThis.Handlebars = $Handlebars;
|
||||||
}
|
}
|
||||||
return Handlebars;
|
return Handlebars;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export function template(templateSpec, env) {
|
|||||||
loc: loc
|
loc: loc
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return obj[name];
|
return container.lookupProperty(obj, name);
|
||||||
},
|
},
|
||||||
lookupProperty: function(parent, propertyName) {
|
lookupProperty: function(parent, propertyName) {
|
||||||
let result = parent[propertyName];
|
let result = parent[propertyName];
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// USAGE:
|
// USAGE:
|
||||||
// var handlebars = require('handlebars');
|
// var handlebars = require('handlebars');
|
||||||
|
/* eslint-env node */
|
||||||
/* eslint-disable no-var */
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
// var local = handlebars.create();
|
// var local = handlebars.create();
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-env node */
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import Async from 'neo-async';
|
import Async from 'neo-async';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|||||||
Generated
+16914
-921
File diff suppressed because it is too large
Load Diff
+22
-21
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "handlebars",
|
"name": "handlebars",
|
||||||
"barename": "handlebars",
|
"barename": "handlebars",
|
||||||
"version": "4.7.6",
|
"version": "4.7.8",
|
||||||
"description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration",
|
"description": "Handlebars provides the power necessary to let you build semantic templates effectively with no frustration",
|
||||||
"homepage": "http://www.handlebarsjs.com/",
|
"homepage": "https://handlebarsjs.com/",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"handlebars",
|
"handlebars",
|
||||||
"mustache",
|
"mustache",
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/wycats/handlebars.js.git"
|
"url": "https://github.com/handlebars-lang/handlebars.js.git"
|
||||||
},
|
},
|
||||||
"author": "Yehuda Katz",
|
"author": "Yehuda Katz",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"neo-async": "^2.6.0",
|
"neo-async": "^2.6.2",
|
||||||
"source-map": "^0.6.1",
|
"source-map": "^0.6.1",
|
||||||
"wordwrap": "^1.0.0"
|
"wordwrap": "^1.0.0"
|
||||||
},
|
},
|
||||||
@@ -30,13 +30,12 @@
|
|||||||
"uglify-js": "^3.1.4"
|
"uglify-js": "^3.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@knappi/grunt-saucelabs": "^9.0.2",
|
"@playwright/test": "^1.17.1",
|
||||||
"aws-sdk": "^2.1.49",
|
"aws-sdk": "^2.1.49",
|
||||||
"babel-loader": "^5.0.0",
|
"babel-loader": "^5.0.0",
|
||||||
"babel-runtime": "^5.1.10",
|
"babel-runtime": "^5.1.10",
|
||||||
"benchmark": "~1.0",
|
"benchmark": "~1.0",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"chai-diff": "^1.0.1",
|
|
||||||
"concurrently": "^5.0.0",
|
"concurrently": "^5.0.0",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"dtslint": "^0.5.5",
|
"dtslint": "^0.5.5",
|
||||||
@@ -44,12 +43,11 @@
|
|||||||
"eco": "~1.1.0-rc-3",
|
"eco": "~1.1.0-rc-3",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-config-prettier": "^6.7.0",
|
"eslint-config-prettier": "^6.7.0",
|
||||||
"eslint-plugin-compat": "^3.3.0",
|
"eslint-plugin-compat": "^3.13.0",
|
||||||
"eslint-plugin-es5": "^1.4.1",
|
"eslint-plugin-es5": "^1.4.1",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"grunt": "^1.0.4",
|
"grunt": "^1.0.4",
|
||||||
"grunt-babel": "^5.0.0",
|
"grunt-babel": "^5.0.0",
|
||||||
"grunt-bg-shell": "^2.3.3",
|
|
||||||
"grunt-cli": "^1",
|
"grunt-cli": "^1",
|
||||||
"grunt-contrib-clean": "^1",
|
"grunt-contrib-clean": "^1",
|
||||||
"grunt-contrib-concat": "^1",
|
"grunt-contrib-concat": "^1",
|
||||||
@@ -58,6 +56,7 @@
|
|||||||
"grunt-contrib-requirejs": "^1",
|
"grunt-contrib-requirejs": "^1",
|
||||||
"grunt-contrib-uglify": "^1",
|
"grunt-contrib-uglify": "^1",
|
||||||
"grunt-contrib-watch": "^1.1.0",
|
"grunt-contrib-watch": "^1.1.0",
|
||||||
|
"grunt-shell": "^4.0.0",
|
||||||
"grunt-webpack": "^1.0.8",
|
"grunt-webpack": "^1.0.8",
|
||||||
"husky": "^3.1.0",
|
"husky": "^3.1.0",
|
||||||
"jison": "~0.3.0",
|
"jison": "~0.3.0",
|
||||||
@@ -76,23 +75,26 @@
|
|||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "types/index.d.ts",
|
"types": "types/index.d.ts",
|
||||||
"browser": {
|
"browser": "./dist/cjs/handlebars.js",
|
||||||
".": "./dist/cjs/handlebars.js",
|
|
||||||
"./runtime": "./dist/cjs/handlebars.runtime.js"
|
|
||||||
},
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"handlebars": "bin/handlebars"
|
"handlebars": "bin/handlebars"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "grunt build",
|
||||||
|
"release": "npm run build && grunt release",
|
||||||
"format": "prettier --write '**/*.js' && eslint --fix .",
|
"format": "prettier --write '**/*.js' && eslint --fix .",
|
||||||
"check-format": "prettier --check '**/*.js'",
|
"lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:types",
|
||||||
"lint": "eslint --max-warnings 0 .",
|
"lint:eslint": "eslint --max-warnings 0 .",
|
||||||
"dtslint": "dtslint types",
|
"lint:prettier": "prettier --check '**/*.js'",
|
||||||
"test": "grunt",
|
"lint:types": "dtslint types",
|
||||||
"extensive-tests-and-publish-to-aws": "npx mocha tasks/task-tests/ && grunt --stack extensive-tests-and-publish-to-aws",
|
"test": "npm run test:mocha",
|
||||||
"integration-test": "grunt integration-tests",
|
"test:mocha": "grunt build && grunt test",
|
||||||
|
"test:browser": "playwright test --config tests/browser/playwright.config.js tests/browser/spec.js",
|
||||||
|
"test:integration": "grunt integration-tests",
|
||||||
|
"test:serve": "grunt connect:server:keepalive",
|
||||||
|
"extensive-tests-and-publish-to-aws": "npx mocha tasks/tests/ && grunt --stack extensive-tests-and-publish-to-aws",
|
||||||
"--- combined tasks ---": "",
|
"--- combined tasks ---": "",
|
||||||
"check-before-pull-request": "concurrently --kill-others-on-fail npm:lint npm:dtslint npm:check-format npm:test"
|
"check-before-pull-request": "concurrently --kill-others-on-fail npm:lint npm:test"
|
||||||
},
|
},
|
||||||
"jspm": {
|
"jspm": {
|
||||||
"main": "handlebars",
|
"main": "handlebars",
|
||||||
@@ -109,7 +111,6 @@
|
|||||||
"dist/amd/**/*.js",
|
"dist/amd/**/*.js",
|
||||||
"dist/cjs/**/*.js",
|
"dist/cjs/**/*.js",
|
||||||
"lib",
|
"lib",
|
||||||
"print-script",
|
|
||||||
"release-notes.md",
|
"release-notes.md",
|
||||||
"runtime.js",
|
"runtime.js",
|
||||||
"types/*.d.ts",
|
"types/*.d.ts",
|
||||||
@@ -121,7 +122,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,css,json,md}": [
|
"*.{js,css,json}": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
"git add"
|
"git add"
|
||||||
],
|
],
|
||||||
|
|||||||
+31
-1
@@ -2,7 +2,37 @@
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...master)
|
[Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.8...master)
|
||||||
|
|
||||||
|
## v4.7.8 - July 27th, 2023
|
||||||
|
|
||||||
|
- Make library compatible with workers (#1894) - 3d3796c
|
||||||
|
- Don't rely on Node.js global object (#1776) - 2954e7e
|
||||||
|
- Fix compiling of each block params in strict mode (#1855) - 30dbf04
|
||||||
|
- Fix rollup warning when importing Handlebars as ESM - 03d387b
|
||||||
|
- Fix bundler issue with webpack 5 (#1862) - c6c6bbb
|
||||||
|
- Use https instead of git for mustache submodule - 88ac068
|
||||||
|
|
||||||
|
[Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.7...v4.7.8)
|
||||||
|
|
||||||
|
## v4.7.7 - February 15th, 2021
|
||||||
|
|
||||||
|
- fix weird error in integration tests - eb860c0
|
||||||
|
- fix: check prototype property access in strict-mode (#1736) - b6d3de7
|
||||||
|
- fix: escape property names in compat mode (#1736) - f058970
|
||||||
|
- refactor: In spec tests, use expectTemplate over equals and shouldThrow (#1683) - 77825f8
|
||||||
|
- chore: start testing on Node.js 12 and 13 - 3789a30
|
||||||
|
|
||||||
|
(POSSIBLY) BREAKING CHANGES:
|
||||||
|
|
||||||
|
- the changes from version [4.6.0](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md#v460---january-8th-2020) now also apply
|
||||||
|
in when using the compile-option "strict: true". Access to prototype properties is forbidden completely by default, specific properties or methods
|
||||||
|
can be allowed via runtime-options. See #1633 for details. If you are using Handlebars as documented, you should not be accessing prototype properties
|
||||||
|
from your template anyway, so the changes should not be a problem for you. Only the use of undocumented features can break your build.
|
||||||
|
|
||||||
|
That is why we only bump the patch version despite mentioning breaking changes.
|
||||||
|
|
||||||
|
[Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)
|
||||||
|
|
||||||
## v4.7.6 - April 3rd, 2020
|
## v4.7.6 - April 3rd, 2020
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
}
|
}
|
||||||
var runner = mocha.run();
|
var runner = mocha.run();
|
||||||
|
|
||||||
//Reporting for saucelabs
|
// Reporting to test-runner
|
||||||
var failedTests = [];
|
var failedTests = [];
|
||||||
runner.on('end', function(){
|
runner.on('end', function(){
|
||||||
window.mochaResults = runner.stats;
|
window.mochaResults = runner.stats;
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@
|
|||||||
}
|
}
|
||||||
var runner = mocha.run();
|
var runner = mocha.run();
|
||||||
|
|
||||||
//Reporting for saucelabs
|
// Reporting to test-runner
|
||||||
var failedTests = [];
|
var failedTests = [];
|
||||||
runner.on('end', function(){
|
runner.on('end', function(){
|
||||||
window.mochaResults = runner.stats;
|
window.mochaResults = runner.stats;
|
||||||
|
|||||||
@@ -324,6 +324,15 @@ describe('builtin helpers', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('each with block params and strict compilation', function() {
|
||||||
|
expectTemplate(
|
||||||
|
'{{#each goodbyes as |value index|}}{{index}}. {{value.text}}!{{/each}}'
|
||||||
|
)
|
||||||
|
.withCompileOptions({ strict: true })
|
||||||
|
.withInput({ goodbyes: [{ text: 'goodbye' }, { text: 'Goodbye' }] })
|
||||||
|
.toCompileTo('0. goodbye!1. Goodbye!');
|
||||||
|
});
|
||||||
|
|
||||||
it('each object with @index', function() {
|
it('each object with @index', function() {
|
||||||
expectTemplate(
|
expectTemplate(
|
||||||
'{{#each goodbyes}}{{@index}}. {{text}}! {{/each}}cruel {{world}}!'
|
'{{#each goodbyes}}{{@index}}. {{text}}! {{/each}}cruel {{world}}!'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
define(['handlebars.runtime'], function(Handlebars) {
|
define(['handlebars.runtime'], function(Handlebars) {
|
||||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||||
return templates['bom'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
return templates['bom'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "a";
|
return "a";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
});
|
});
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
{"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
{"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "";
|
return "";
|
||||||
},"useData":true}
|
},"useData":true}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
define(['some-path/handlebars.runtime'], function(Handlebars) {
|
define(['some-path/handlebars.runtime'], function(Handlebars) {
|
||||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||||
return templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
return templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "";
|
return "";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
});
|
});
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
Precompile handlebar templates.
|
Precompile handlebar templates.
|
||||||
Usage: handlebars [template|directory]...
|
Usage: handlebars [template|directory]...
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-f, --output Output File [string]
|
-f, --output Output File [string]
|
||||||
--map Source Map File [string]
|
--map Source Map File [string]
|
||||||
@@ -22,4 +21,4 @@ Options:
|
|||||||
-e, --extension Template extension. [string] [default: "handlebars"]
|
-e, --extension Template extension. [string] [default: "handlebars"]
|
||||||
-b, --bom Removes the BOM (Byte Order Mark) from the beginning of the templates. [boolean]
|
-b, --bom Removes the BOM (Byte Order Mark) from the beginning of the templates. [boolean]
|
||||||
-v, --version Prints the current compiler version [boolean]
|
-v, --version Prints the current compiler version [boolean]
|
||||||
--help Outputs this message [boolean]
|
--help Outputs this message [boolean]
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
define(['handlebars.runtime'], function(Handlebars) {
|
define(['handlebars.runtime'], function(Handlebars) {
|
||||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = someNameSpace = someNameSpace || {};
|
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = someNameSpace = someNameSpace || {};
|
||||||
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "";
|
return "";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
templates['empty'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "";
|
return "";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
return templates;
|
return templates;
|
||||||
});
|
});
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
define(['handlebars.runtime'], function(Handlebars) {
|
define(['handlebars.runtime'], function(Handlebars) {
|
||||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||||
return templates['non.default.extension'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
return templates['non.default.extension'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "<div>This is a test</div>";
|
return "<div>This is a test</div>";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
});
|
});
|
||||||
@@ -1,24 +1,25 @@
|
|||||||
define(['handlebars.runtime'], function(Handlebars) {
|
define(['handlebars.runtime'], function(Handlebars) {
|
||||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||||
return templates['known.helpers'] = template({"1":function(container,depth0,helpers,partials,data) {
|
return templates['known.helpers'] = template({"1":function(container,depth0,helpers,partials,data) {
|
||||||
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||||
return parent[propertyName];
|
return parent[propertyName];
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
};
|
};
|
||||||
return " <div>Some known helper</div>\n"
|
|
||||||
+ ((stack1 = lookupProperty(helpers,"anotherHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"anotherHelper","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":22}}})) != null ? stack1 : "");
|
return ""+" <div>Some known helper</div>\n"
|
||||||
|
+ ((stack1 = lookupProperty(helpers,"anotherHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"anotherHelper","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":4},"end":{"line":5,"column":22}}})) != null ? stack1 : "");
|
||||||
},"2":function(container,depth0,helpers,partials,data) {
|
},"2":function(container,depth0,helpers,partials,data) {
|
||||||
return " <div>Another known helper</div>\n";
|
return " <div>Another known helper</div>\n";
|
||||||
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
||||||
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
||||||
return parent[propertyName];
|
return parent[propertyName];
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
};
|
};
|
||||||
return ((stack1 = lookupProperty(helpers,"someHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"someHelper","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":15}}})) != null ? stack1 : "");
|
|
||||||
|
return ""+((stack1 = lookupProperty(helpers,"someHelper").call(depth0 != null ? depth0 : (container.nullContext || {}),true,{"name":"someHelper","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":15}}})) != null ? stack1 : "");
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
define(['handlebars.runtime'], function(Handlebars) {
|
define(['handlebars.runtime'], function(Handlebars) {
|
||||||
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
Handlebars = Handlebars["default"]; var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||||
return Handlebars.partials['partial.template'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
return Handlebars.partials['partial.template'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
return "<div>Test Partial</div>";
|
return "<div>Test Partial</div>";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
});
|
});
|
||||||
+1
-1
@@ -62,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
var runner = mocha.run();
|
var runner = mocha.run();
|
||||||
|
|
||||||
//Reporting for saucelabs
|
// Reporting to test-runner
|
||||||
var failedTests = [];
|
var failedTests = [];
|
||||||
runner.on('end', function(){
|
runner.on('end', function(){
|
||||||
window.mochaResults = runner.stats;
|
window.mochaResults = runner.stats;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ describe('javascript-compiler api', function() {
|
|||||||
.toCompileTo('food');
|
.toCompileTo('food');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#compilerInfo', function() {
|
describe('#compilerInfo', function() {
|
||||||
var $superCheck, $superInfo;
|
var $superCheck, $superInfo;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@@ -58,6 +59,7 @@ describe('javascript-compiler api', function() {
|
|||||||
.toCompileTo('food ');
|
.toCompileTo('food ');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('buffer', function() {
|
describe('buffer', function() {
|
||||||
var $superAppend, $superCreate;
|
var $superAppend, $superCreate;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@@ -116,4 +118,13 @@ describe('javascript-compiler api', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('options', function() {
|
||||||
|
it('should append `noEscape` statements as string', function() {
|
||||||
|
expectTemplate('{{a}}{{b}}')
|
||||||
|
.withCompileOptions({ noEscape: true })
|
||||||
|
.withInput({ a: 1, b: 1 })
|
||||||
|
.toCompileTo('11');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -298,6 +298,10 @@ describe('security issues', function() {
|
|||||||
checkProtoPropertyAccess({ compat: true });
|
checkProtoPropertyAccess({ compat: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('in strict-mode', function() {
|
||||||
|
checkProtoPropertyAccess({ strict: true });
|
||||||
|
});
|
||||||
|
|
||||||
function checkProtoPropertyAccess(compileOptions) {
|
function checkProtoPropertyAccess(compileOptions) {
|
||||||
it('should be prohibited by default and log a warning', function() {
|
it('should be prohibited by default and log a warning', function() {
|
||||||
var spy = sinon.spy(console, 'error');
|
var spy = sinon.spy(console, 'error');
|
||||||
@@ -396,6 +400,28 @@ describe('security issues', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('escapes template variables', function() {
|
||||||
|
it('in compat mode', function() {
|
||||||
|
expectTemplate("{{'a\\b'}}")
|
||||||
|
.withCompileOptions({ compat: true })
|
||||||
|
.withInput({ 'a\\b': 'c' })
|
||||||
|
.toCompileTo('c');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('in default mode', function() {
|
||||||
|
expectTemplate("{{'a\\b'}}")
|
||||||
|
.withCompileOptions()
|
||||||
|
.withInput({ 'a\\b': 'c' })
|
||||||
|
.toCompileTo('c');
|
||||||
|
});
|
||||||
|
it('in default mode', function() {
|
||||||
|
expectTemplate("{{'a\\b'}}")
|
||||||
|
.withCompileOptions({ strict: true })
|
||||||
|
.withInput({ 'a\\b': 'c' })
|
||||||
|
.toCompileTo('c');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function wrapToAdjustContainer(precompiledTemplateFunction) {
|
function wrapToAdjustContainer(precompiledTemplateFunction) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
}
|
}
|
||||||
var runner = mocha.run();
|
var runner = mocha.run();
|
||||||
|
|
||||||
//Reporting for saucelabs
|
// Reporting to test-runner
|
||||||
var failedTests = [];
|
var failedTests = [];
|
||||||
runner.on('end', function(){
|
runner.on('end', function(){
|
||||||
window.mochaResults = runner.stats;
|
window.mochaResults = runner.stats;
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
var runner = mocha.run();
|
var runner = mocha.run();
|
||||||
|
|
||||||
//Reporting for saucelabs
|
// Reporting to test-runner
|
||||||
var failedTests = [];
|
var failedTests = [];
|
||||||
runner.on('end', function(){
|
runner.on('end', function(){
|
||||||
window.mochaResults = runner.stats;
|
window.mochaResults = runner.stats;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const metrics = require('../bench');
|
const metrics = require('../tests/bench');
|
||||||
const { createRegisterAsyncTaskFn } = require('./util/async-grunt-task');
|
const { createRegisterAsyncTaskFn } = require('./util/async-grunt-task');
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
Use `mocha tasks/task-tests` to run these tests
|
|
||||||
+3
-6
@@ -4,7 +4,6 @@ const os = require('os');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
chai.use(require('chai-diff'));
|
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
const testCases = [
|
const testCases = [
|
||||||
@@ -192,11 +191,9 @@ module.exports = function(grunt) {
|
|||||||
fs.unlinkSync(outputLocation);
|
fs.unlinkSync(outputLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(normalizedOutput).not.to.be.differentFrom(
|
expect(normalizedOutput).to.be.equal(
|
||||||
normalizedExpectedOutput,
|
normalizedExpectedOutput,
|
||||||
{
|
`Failed on ${expectedOutputSpec}`
|
||||||
relaxedSpace: true
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -226,7 +223,7 @@ function addPathToNodeJs(pathEnvironment) {
|
|||||||
|
|
||||||
function normalizeCrlf(string) {
|
function normalizeCrlf(string) {
|
||||||
if (typeof string === 'string') {
|
if (typeof string === 'string') {
|
||||||
return string.replace(/\r\n/g, '\n');
|
return string.replace(/\r\n/g, '\n').trim();
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Use `mocha tasks/tests` to run these tests
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: ['eslint:recommended', 'prettier'],
|
||||||
|
env: {
|
||||||
|
node: true
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 6
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@ var _ = require('underscore'),
|
|||||||
|
|
||||||
module.exports = function(grunt, callback) {
|
module.exports = function(grunt, callback) {
|
||||||
// Deferring to here in case we have a build for parser, etc as part of this grunt exec
|
// Deferring to here in case we have a build for parser, etc as part of this grunt exec
|
||||||
var Handlebars = require('../lib');
|
var Handlebars = require('../../lib');
|
||||||
|
|
||||||
var templateSizes = {};
|
var templateSizes = {};
|
||||||
_.each(templates, function(info, template) {
|
_.each(templates, function(info, template) {
|
||||||
@@ -145,7 +145,7 @@ function makeSuite(bench, name, template, handlebarsOnly) {
|
|||||||
|
|
||||||
module.exports = function(grunt, callback) {
|
module.exports = function(grunt, callback) {
|
||||||
// Deferring load incase we are being run inline with the grunt build
|
// Deferring load incase we are being run inline with the grunt build
|
||||||
Handlebars = require('../lib');
|
Handlebars = require('../../lib');
|
||||||
|
|
||||||
console.log('Execution Throughput');
|
console.log('Execution Throughput');
|
||||||
runner(grunt, makeSuite, function(times, scaled) {
|
runner(grunt, makeSuite, function(times, scaled) {
|
||||||
@@ -11,8 +11,6 @@ function BenchWarmer() {
|
|||||||
this.errors = {};
|
this.errors = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
var print = require('util').print;
|
|
||||||
|
|
||||||
BenchWarmer.prototype = {
|
BenchWarmer.prototype = {
|
||||||
winners: function(benches) {
|
winners: function(benches) {
|
||||||
return Benchmark.filter(benches, 'fastest');
|
return Benchmark.filter(benches, 'fastest');
|
||||||
@@ -69,7 +67,7 @@ BenchWarmer.prototype = {
|
|||||||
|
|
||||||
self.startLine('');
|
self.startLine('');
|
||||||
|
|
||||||
print('\n');
|
console.log('\n');
|
||||||
self.printHeader('scaled');
|
self.printHeader('scaled');
|
||||||
_.each(self.scaled, function(value, name) {
|
_.each(self.scaled, function(value, name) {
|
||||||
self.startLine(name);
|
self.startLine(name);
|
||||||
@@ -78,7 +76,7 @@ BenchWarmer.prototype = {
|
|||||||
self.writeValue(value[lang] || '');
|
self.writeValue(value[lang] || '');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
print('\n');
|
console.log('\n');
|
||||||
|
|
||||||
var errors = false,
|
var errors = false,
|
||||||
prop,
|
prop,
|
||||||
@@ -94,16 +92,16 @@ BenchWarmer.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
print('\n\nErrors:\n');
|
console.log('\n\nErrors:\n');
|
||||||
Object.keys(self.errors).forEach(function(prop) {
|
Object.keys(self.errors).forEach(function(prop) {
|
||||||
if (self.errors[prop].error.message !== 'EWOT') {
|
if (self.errors[prop].error.message !== 'EWOT') {
|
||||||
bench = self.errors[prop];
|
bench = self.errors[prop];
|
||||||
print('\n' + bench.name + ':\n');
|
console.log('\n' + bench.name + ':\n');
|
||||||
print(bench.error.message);
|
console.log(bench.error.message);
|
||||||
if (bench.error.stack) {
|
if (bench.error.stack) {
|
||||||
print(bench.error.stack.join('\n'));
|
console.log(bench.error.stack.join('\n'));
|
||||||
}
|
}
|
||||||
print('\n');
|
console.log('\n');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -112,7 +110,7 @@ BenchWarmer.prototype = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
print('\n');
|
console.log('\n');
|
||||||
},
|
},
|
||||||
|
|
||||||
scaleTimes: function() {
|
scaleTimes: function() {
|
||||||
@@ -163,11 +161,11 @@ BenchWarmer.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (winners) {
|
if (winners) {
|
||||||
print('WINNER(S)');
|
console.log('WINNER(S)');
|
||||||
horSize = horSize + 'WINNER(S)'.length;
|
horSize = horSize + 'WINNER(S)'.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
print('\n' + new Array(horSize + 1).join('-'));
|
console.log('\n' + new Array(horSize + 1).join('-'));
|
||||||
},
|
},
|
||||||
|
|
||||||
startLine: function(name) {
|
startLine: function(name) {
|
||||||
@@ -179,8 +177,8 @@ BenchWarmer.prototype = {
|
|||||||
|
|
||||||
this.currentBenches = [];
|
this.currentBenches = [];
|
||||||
|
|
||||||
print(winners.join(', '));
|
console.log(winners.join(', '));
|
||||||
print('\n');
|
console.log('\n');
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
this.writeValue(name);
|
this.writeValue(name);
|
||||||
@@ -216,7 +214,7 @@ BenchWarmer.prototype = {
|
|||||||
writeValue: function(out) {
|
writeValue: function(out) {
|
||||||
var padding = this.benchSize - out.length + 1;
|
var padding = this.benchSize - out.length + 1;
|
||||||
out = out + new Array(padding).join(' ');
|
out = out + new Array(padding).join(' ');
|
||||||
print(out);
|
console.log(out);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2020
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Browser Tests with Playwright
|
||||||
|
|
||||||
|
These tests execute Mocha tests from the `spec`-folder in multiple browsers.
|
||||||
|
|
||||||
|
## Using Docker
|
||||||
|
|
||||||
|
Execute the following commands in the project root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npx grunt prepare
|
||||||
|
docker pull mcr.microsoft.com/playwright:focal
|
||||||
|
docker run -it --rm --volume $(pwd):/srv/app --workdir /srv/app --ipc=host mcr.microsoft.com/playwright:focal npm run test:browser
|
||||||
|
```
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
const { devices } = require('@playwright/test');
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chromium',
|
||||||
|
use: { ...devices['Desktop Chrome'] }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
use: { ...devices['Desktop Firefox'] }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'webkit',
|
||||||
|
use: { ...devices['Desktop Safari'] }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: 'list',
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run test:serve',
|
||||||
|
port: 9999,
|
||||||
|
reuseExistingServer: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
const { test, expect } = require('@playwright/test');
|
||||||
|
|
||||||
|
async function waitForMochaAndAssertResult(page) {
|
||||||
|
await page.waitForFunction(() => window.mochaResults); // eslint-disable-line no-undef
|
||||||
|
const mochaResults = await page.evaluate('window.mochaResults');
|
||||||
|
|
||||||
|
expect(mochaResults.failures).toBe(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
test('Spec handlebars.js', async ({ page, baseURL }) => {
|
||||||
|
await page.goto(`${baseURL}/spec/?headless=true`);
|
||||||
|
await waitForMochaAndAssertResult(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Spec handlebars.amd.js (AMD)', async ({ page, baseURL }) => {
|
||||||
|
await page.goto(`${baseURL}/spec/amd.html?headless=true`);
|
||||||
|
await waitForMochaAndAssertResult(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Spec handlebars.runtime.amd.js (AMD)', async ({ page, baseURL }) => {
|
||||||
|
await page.goto(`${baseURL}/spec/amd-runtime.html?headless=true`);
|
||||||
|
await waitForMochaAndAssertResult(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Spec handlebars.js (UMD)', async ({ page, baseURL }) => {
|
||||||
|
await page.goto(`${baseURL}/spec/umd.html?headless=true`);
|
||||||
|
await waitForMochaAndAssertResult(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Spec handlebars.runtime.js (UMD)', async ({ page, baseURL }) => {
|
||||||
|
await page.goto(`${baseURL}/spec/umd-runtime.html?headless=true`);
|
||||||
|
await waitForMochaAndAssertResult(page);
|
||||||
|
});
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
Add a new integration test by creating a new subfolder
|
Add a new integration test by creating a new subfolder
|
||||||
|
|
||||||
Add a file "test.sh" to that runs the test. "test.sh" should exit with a non-zero exit code
|
Add a file "test.sh" to that runs the test. "test.sh" should exit with a non-zero exit code
|
||||||
and display an error message, if something goes wrong.
|
and display an error message, if something goes wrong.
|
||||||
|
|
||||||
* An integration test should reflect real-world setups that use handlebars.
|
- An integration test should reflect real-world setups that use handlebars.
|
||||||
* It should compile a minimal template and compare the output to an expected output.
|
- It should compile a minimal template and compare the output to an expected output.
|
||||||
* It should use "../.." as dependency for Handlebars so that the currently built library is used.
|
- It should use "../.." as dependency for Handlebars so that the currently built library is used.
|
||||||
|
|
||||||
Currently, integration tests are only running on Linux, especially in travis-ci.
|
Currently, integration tests are only running on Linux, especially in our CI GitHub action.
|
||||||
|
|
||||||
|
|
||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"handlebars": "file:../.."
|
"handlebars": "file:../../.."
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node run-handlebars.js",
|
"test": "node run-handlebars.js",
|
||||||
+8
-9
@@ -7,23 +7,22 @@ cd "$( dirname "$( readlink -f "$0" )" )" || exit 1
|
|||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
|
||||||
# This script tests with precompiler and the built distribution with multiple NodeJS version.
|
# This script tests with precompiler and the built distribution with multiple NodeJS version.
|
||||||
# The rest of the travis-build will only work with newer NodeJS versions, because the build
|
|
||||||
# tools don't support older versions.
|
|
||||||
# However, the built distribution should work with older NodeJS versions as well.
|
|
||||||
# This test is simple by design. It merely ensures, that calling Handlebars does not fail with old versions.
|
# This test is simple by design. It merely ensures, that calling Handlebars does not fail with old versions.
|
||||||
# It does (almost) not test for correctness, because that is already done in the mocha-tests.
|
# It does (almost) not test for correctness, because that is already done in the mocha-tests.
|
||||||
# And it does not use any NodeJS based testing framwork to make this part independent of the Node version.
|
# And it does not use any NodeJS based testing framework to make this part independent of the Node version.
|
||||||
|
|
||||||
unset npm_config_prefix
|
unset npm_config_prefix
|
||||||
|
|
||||||
echo "Handlebars should be able to run in various versions of NodeJS"
|
echo "Handlebars should be able to run in various versions of NodeJS"
|
||||||
for i in 0.10 0.12 4 5 6 7 8 9 10 11 12 13 ; do
|
for node_version_to_test in 0.10 0.12 4 5 6 7 8 9 10 11 12 13 14 15 16 18; do
|
||||||
|
|
||||||
rm target node_modules package-lock.json -rf
|
rm target node_modules package-lock.json -rf
|
||||||
mkdir target
|
mkdir target
|
||||||
nvm install "$i"
|
|
||||||
nvm exec "$i" npm install
|
nvm install "$node_version_to_test"
|
||||||
nvm exec "$i" npm run test
|
nvm exec "$node_version_to_test" npm install
|
||||||
nvm exec "$i" npm run test-precompile
|
nvm exec "$node_version_to_test" npm run test
|
||||||
|
nvm exec "$node_version_to_test" npm run test-precompile
|
||||||
|
|
||||||
echo Success
|
echo Success
|
||||||
done
|
done
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: ['eslint:recommended', 'prettier'],
|
||||||
|
env: {
|
||||||
|
browser: true
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaVersion: 6
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "rollup-test",
|
||||||
|
"description": "Various tests with Handlebars and rollup",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"build": "rollup --config rollup.config.js --failAfterWarnings"
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-node-resolve": "^13.1.1",
|
||||||
|
"handlebars": "file:../../..",
|
||||||
|
"rollup": "^2.61.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'src/index.js',
|
||||||
|
output: {
|
||||||
|
file: 'dist/bundle.js',
|
||||||
|
format: 'es'
|
||||||
|
},
|
||||||
|
plugins: [nodeResolve()]
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import Handlebars from 'handlebars/lib/handlebars';
|
||||||
|
|
||||||
|
const template = Handlebars.compile('Author: {{author}}');
|
||||||
|
const result = template({ author: 'Yehuda' });
|
||||||
|
|
||||||
|
if (result !== 'Author: Yehuda') {
|
||||||
|
throw Error('Assertion failed');
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user