Skip to content

Commit 69c7e2b

Browse files
heiskrhectorsector
andauthored
Update Liquid to 10 (github#35835)
Co-authored-by: Hector Alfaro <[email protected]>
1 parent 2ee59d7 commit 69c7e2b

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ You can configure {% data variables.product.prodname_code_scanning %} to use the
5757

5858
You can run third-party analysis tools within {% data variables.product.product_name %} using actions or within an external CI system. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository)" or "[AUTOTITLE](/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github)."
5959

60-
{% ifversion code-scanning-tool-status }
60+
{% ifversion code-scanning-tool-status-page %}
6161

6262
## About the {% data variables.code-scanning.tool_status_page %}
6363

6464
The {% data variables.code-scanning.tool_status_page %} shows useful information about all of your code scanning tools. If code scanning is not working as you'd expect, the {% data variables.code-scanning.tool_status_page %} is a good starting point for debugging problems. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-the-tool-status-page)".
6565

66-
{% endif %}
66+
{% endif %}

content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ You decide how to generate {% data variables.product.prodname_code_scanning %} a
4242

4343
{% data reusables.code-scanning.codeql-action-version-ghes %}
4444

45-
{% ifversion code-scanning-tool-status }
45+
{% ifversion code-scanning-tool-status-page %}
4646

4747
The {% data variables.code-scanning.tool_status_page %} shows useful information about all of your code scanning tools. If code scanning is not working as you'd expect, the {% data variables.code-scanning.tool_status_page %} is a good starting point for debugging problems. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-the-tool-status-page)".
4848

lib/liquid-tags/ifversion.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isTruthy, Expression, TokenizationError } from 'liquidjs'
1+
import { Tag, isTruthy, Value, TokenizationError } from 'liquidjs'
22
import versionSatisfiesRange from '../version-satisfies-range.js'
33
import supportedOperators from './ifversion-supported-operators.js'
44

@@ -13,9 +13,11 @@ const notRegex = /(?:^|\s)not\s/
1313
// native Liquid `if` block tag. It has special handling for statements like {% ifversion ghes < 3.0 %},
1414
// using semver to evaluate release numbers instead of doing standard number comparisons, which
1515
// don't work the way we want because they evaluate 3.2 > 3.10 = true.
16-
export default {
16+
export default class extends Tag {
1717
// The following is verbatim from https://github.com/harttle/liquidjs/blob/v9.22.1/src/builtin/tags/if.ts
18-
parse(tagToken, remainTokens) {
18+
constructor(tagToken, remainTokens, liquid) {
19+
super(tagToken, remainTokens, liquid)
20+
1921
this.tagToken = tagToken
2022
this.branches = []
2123
this.elseTemplates = []
@@ -43,13 +45,12 @@ export default {
4345
})
4446

4547
stream.start()
46-
},
48+
}
4749

4850
// The following is _mostly_ verbatim from https://github.com/harttle/liquidjs/blob/v9.22.1/src/builtin/tags/if.ts
4951
// The additions here are the handleNots() and handleOperators() calls.
50-
render: function* (ctx, emitter) {
52+
*render(ctx, emitter) {
5153
const r = this.liquid.renderer
52-
const { operators, operatorsTrie } = this.liquid.options
5354

5455
this.currentVersionObj = ctx.environments.currentVersionObj
5556

@@ -64,20 +65,15 @@ export default {
6465
resolvedBranchCond = this.handleOperators(resolvedBranchCond)
6566

6667
// Use Liquid's native function for the final evaluation.
67-
const cond = yield new Expression(
68-
resolvedBranchCond,
69-
operators,
70-
operatorsTrie,
71-
ctx.opts.lenientIf
72-
).value(ctx)
68+
const cond = yield new Value(resolvedBranchCond, this.liquid).value(ctx, ctx.opts.lenientIf)
7369

7470
if (isTruthy(cond, ctx)) {
7571
yield r.renderTemplates(branch.templates, ctx, emitter)
7672
return
7773
}
7874
}
7975
yield r.renderTemplates(this.elseTemplates, ctx, emitter)
80-
},
76+
}
8177

8278
handleNots(resolvedBranchCond) {
8379
if (!notRegex.test(resolvedBranchCond)) return resolvedBranchCond
@@ -107,7 +103,7 @@ export default {
107103
}
108104

109105
return resolvedBranchCond
110-
},
106+
}
111107

112108
handleOperators(resolvedBranchCond) {
113109
if (!supportedOperatorsRegex.test(resolvedBranchCond)) return resolvedBranchCond
@@ -162,5 +158,5 @@ export default {
162158
}
163159

164160
return resolvedBranchCond
165-
},
161+
}
166162
}

package-lock.json

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"javascript-stringify": "^2.1.0",
5656
"js-cookie": "^3.0.1",
5757
"js-yaml": "^4.1.0",
58-
"liquidjs": "9.22.1",
58+
"liquidjs": "^10.7.0",
5959
"lodash": "^4.17.21",
6060
"lodash-es": "^4.17.21",
6161
"lowdb": "5.0.5",

0 commit comments

Comments
 (0)