Skip to content

Commit a47c11b

Browse files
authored
Merge pull request #104 from posthtml/milestone-1.6.0
Milestone 1.6.0
2 parents d9dd85c + 0679470 commit a47c11b

16 files changed

+9935
-2141
lines changed
File renamed without changes.
File renamed without changes.

.github/funding.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: posthtml
5+
open_collective: posthtml
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
File renamed without changes.

.github/workflows/nodejs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Actions Status
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
branches:
6+
- master
7+
env:
8+
CI: true
9+
10+
jobs:
11+
run:
12+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
node: [10, 12, 14]
19+
os: [ubuntu-latest]
20+
21+
steps:
22+
- name: Clone repository
23+
uses: actions/checkout@v2
24+
25+
- name: Set Node.js version
26+
uses: actions/setup-node@v1
27+
with:
28+
node-version: ${{ matrix.node }}
29+
30+
- name: Install npm dependencies
31+
run: npm ci
32+
33+
- name: Run tests
34+
run: npm run test
35+
36+
- name: Run Coveralls
37+
uses: coverallsapp/github-action@master
38+
with:
39+
github-token: "${{ secrets.GITHUB_TOKEN }}"

.nycrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"reporter": ["lcov", "text"],
3+
"extension": [".js"]
4+
}

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

CHANGELOG.md renamed to changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# [1.6.0](https://github.com/posthtml/posthtml-expressions/compare/v1.5.0...v1.6.0) (2020-10-30)
2+
3+
4+
### Features
5+
6+
* strictMode show or not throw an exception, close [#102](https://github.com/posthtml/posthtml-expressions/issues/102) ([dbb32c9](https://github.com/posthtml/posthtml-expressions/commit/dbb32c9a9cd0c3b6468547ecea1d1d492e0ac7ce))
7+
8+
9+
110
# [1.5.0](https://github.com/posthtml/posthtml-expressions/compare/v1.4.7...v1.5.0) (2020-09-21)
211

312

lib/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ module.exports = function postHTMLExpressions (options) {
112112
switchTags: ['switch', 'case', 'default'],
113113
loopTags: ['each'],
114114
scopeTags: ['scope'],
115-
ignoredTag: 'raw'
115+
ignoredTag: 'raw',
116+
strictMode: true
116117
}, options)
117118

118119
// set tags
@@ -155,7 +156,7 @@ module.exports = function postHTMLExpressions (options) {
155156

156157
// kick off the parsing
157158
return function (tree) {
158-
return normalizeTree(clearRawTag(walk({ locals: options.locals }, tree)), tree.options)
159+
return normalizeTree(clearRawTag(walk({ locals: options.locals, strictMode: options.strictMode }, tree)), tree.options)
159160
}
160161
}
161162

@@ -267,7 +268,14 @@ function walk (opts, nodes) {
267268
}
268269

269270
// evaluate the expression, get the winning condition branch
270-
const branch = branches[vm.runInContext(expression, ctx)]
271+
let branch
272+
try {
273+
branch = branches[vm.runInContext(expression, ctx)]
274+
} catch (error) {
275+
if (opts.strictMode) {
276+
throw new SyntaxError(error)
277+
}
278+
}
271279

272280
// remove all of the conditional tags from the tree
273281
// we subtract 1 from i as it's incremented from the initial if statement

LICENSE renamed to license

File renamed without changes.

0 commit comments

Comments
 (0)