Skip to content
Permalink

Comparing changes

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

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: harttle/liquidjs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.39.0
Choose a base ref
...
head repository: harttle/liquidjs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.39.1
Choose a head ref
  • 2 commits
  • 6 files changed
  • 2 contributors

Commits on Jul 14, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dtolnay David Tolnay
    Copy the full SHA
    c41a5d5 View commit details
  2. chore(release): 9.39.1 [skip ci]

    ## [9.39.1](v9.39.0...v9.39.1) (2022-07-14)
    
    ### Bug Fixes
    
    * throw ParseError instead of RenderError for invalid assign expression, closes [#519](#519) ([c41a5d5](c41a5d5))
    semantic-release-bot committed Jul 14, 2022

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    66eb3b8 View commit details
Showing with 20 additions and 8 deletions.
  1. +7 −0 CHANGELOG.md
  2. +1 −1 package-lock.json
  3. +1 −1 package.json
  4. +3 −3 src/builtin/tags/assign.ts
  5. +4 −0 test/e2e/issues.ts
  6. +4 −3 test/integration/builtin/tags/assign.ts
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [9.39.1](https://github.com/harttle/liquidjs/compare/v9.39.0...v9.39.1) (2022-07-14)


### Bug Fixes

* throw ParseError instead of RenderError for invalid assign expression, closes [#519](https://github.com/harttle/liquidjs/issues/519) ([c41a5d5](https://github.com/harttle/liquidjs/commit/c41a5d5babf85ccedbcb3b6f9a3cf5c326f72ae1))

# [9.39.0](https://github.com/harttle/liquidjs/compare/v9.38.0...v9.39.0) (2022-07-09)


2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liquidjs",
"version": "9.39.0",
"version": "9.39.1",
"description": "A simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript.",
"main": "dist/liquid.node.cjs.js",
"module": "dist/liquid.node.esm.js",
6 changes: 3 additions & 3 deletions src/builtin/tags/assign.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tokenizer, assert, TagImplOptions, TagToken, Context } from '../../types'
import { Value, Tokenizer, assert, TagImplOptions, TagToken, Context } from '../../types'

export default {
parse: function (token: TagToken) {
@@ -7,9 +7,9 @@ export default {
tokenizer.skipBlank()
assert(tokenizer.peek() === '=', () => `illegal token ${token.getText()}`)
tokenizer.advance()
this.value = tokenizer.remaining()
this.value = new Value(tokenizer.remaining(), this.liquid)
},
render: function * (ctx: Context): Generator<unknown, void, unknown> {
ctx.bottom()[this.key] = yield this.liquid._evalValue(this.value, ctx)
ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf)
}
} as TagImplOptions
4 changes: 4 additions & 0 deletions test/e2e/issues.ts
Original file line number Diff line number Diff line change
@@ -256,4 +256,8 @@ describe('Issues', function () {
const html = engine.parseAndRenderSync(`{% for i in (1..10000) %}{{ i }}{% endfor %}`)
expect(html).to.have.lengthOf(38894)
})
it('#519 should throw parse error for invalid assign expression', () => {
const engine = new Liquid()
expect(() => engine.parse('{% assign headshot = https://testurl.com/not_enclosed_in_quotes.jpg %}')).to.throw(/unexpected token at ":/)
})
})
7 changes: 4 additions & 3 deletions test/integration/builtin/tags/assign.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Liquid } from '../../../../src/liquid'
import { ParseError, Liquid } from '../../../../src/liquid'
import { expect, use } from 'chai'
import * as chaiAsPromised from 'chai-as-promised'

@@ -16,9 +16,10 @@ describe('tags/assign', function () {
const html = await liquid.parseAndRender(src)
return expect(html).to.equal('bar')
})
it('should throw when variable value illegal', async function () {
it('should throw when variable value illegal', function () {
const src = '{% assign foo = “bar” %}'
return expect(liquid.parseAndRender(src)).to.be.rejectedWith(/unexpected token at "bar"/)
expect(() => liquid.parse(src)).to.throw(/unexpected token at "bar"/)
expect(() => liquid.parse(src)).to.throw(ParseError)
})
it('should support assign to a number', async function () {
const src = '{% assign foo=10086 %}{{foo}}'