Skip to content

Commit c251f6d

Browse files
Peter Bengtssondependabot[bot]gracepark
authored
Upgradeliquidjs 10.13 (#50845)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Grace Park <gracepark@github.com>
1 parent b58e73c commit c251f6d

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

package-lock.json

Lines changed: 4 additions & 3 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
@@ -272,7 +272,7 @@
272272
"javascript-stringify": "^2.1.0",
273273
"js-cookie": "^3.0.1",
274274
"js-yaml": "^4.1.0",
275-
"liquidjs": "^10.7.0",
275+
"liquidjs": "^10.13.1",
276276
"lodash": "^4.17.21",
277277
"lodash-es": "^4.17.21",
278278
"lowdb": "7.0.1",

src/content-linter/lib/helpers/liquid-utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ import { Tokenizer } from 'liquidjs'
22

33
const liquidTokenCache = new Map()
44

5-
export function getLiquidTokens(content) {
5+
export function getLiquidTokens(content, { noCache = false } = {}) {
66
if (!content) return []
77

8+
if (noCache) {
9+
const tokenizer = new Tokenizer(content)
10+
return tokenizer.readTopLevelTokens()
11+
}
12+
813
if (liquidTokenCache.has(content)) {
914
return liquidTokenCache.get(content)
1015
}

src/data-directory/scripts/find-orphaned-features/find.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ function checkString(
223223
}: { page?: Page; filePath?: string; languageCode?: string; verbose?: boolean } = {},
224224
) {
225225
try {
226-
for (const token of getLiquidTokens(string)) {
226+
// The reason for the `noCache: true` is that we're going to be sending
227+
// a LOT of different strings in and the cache will fill up rapidly
228+
// when testing every possible string in every possible language for
229+
// every page.
230+
for (const token of getLiquidTokens(string, { noCache: true })) {
227231
if (token.name === 'ifversion' || token.name === 'elsif') {
228232
for (const arg of token.args.split(/\s+/)) {
229233
if (IGNORE_ARGS.has(arg)) continue

src/languages/scripts/count-translation-corruptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ function run(languageCode: string, site: Site, englishReusables: Reusables) {
7777
const illegalTags = new Map<string, number>()
7878

7979
function countError(error: TokenizationError, where: string) {
80-
const errorString = (error as any).originalError.message as string
80+
const originalError = (error as any).originalError
81+
const errorString = originalError ? originalError.message : error.message
8182
if (errorString.includes('illegal tag syntax')) {
8283
const illegalTag = (error as any).token.content
8384
illegalTags.set(illegalTag, (illegalTags.get(illegalTag) || 0) + 1)

0 commit comments

Comments
 (0)