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>
This commit is contained in:
7
package-lock.json
generated
7
package-lock.json
generated
@@ -57,7 +57,7 @@
|
|||||||
"javascript-stringify": "^2.1.0",
|
"javascript-stringify": "^2.1.0",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"liquidjs": "^10.7.0",
|
"liquidjs": "^10.13.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"lowdb": "7.0.1",
|
"lowdb": "7.0.1",
|
||||||
@@ -8753,8 +8753,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/liquidjs": {
|
"node_modules/liquidjs": {
|
||||||
"version": "10.7.0",
|
"version": "10.13.1",
|
||||||
"license": "MIT",
|
"resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-10.13.1.tgz",
|
||||||
|
"integrity": "sha512-QCQ69sbyMdA1970NEsG7KdQoKi6N+lGg55izisvKvrrRO1nrpS/YBAnzDndR13exYB4xE9A87qdOMuaXPn9v9A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"commander": "^10.0.0"
|
"commander": "^10.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -272,7 +272,7 @@
|
|||||||
"javascript-stringify": "^2.1.0",
|
"javascript-stringify": "^2.1.0",
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"liquidjs": "^10.7.0",
|
"liquidjs": "^10.13.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"lowdb": "7.0.1",
|
"lowdb": "7.0.1",
|
||||||
|
|||||||
@@ -2,9 +2,14 @@ import { Tokenizer } from 'liquidjs'
|
|||||||
|
|
||||||
const liquidTokenCache = new Map()
|
const liquidTokenCache = new Map()
|
||||||
|
|
||||||
export function getLiquidTokens(content) {
|
export function getLiquidTokens(content, { noCache = false } = {}) {
|
||||||
if (!content) return []
|
if (!content) return []
|
||||||
|
|
||||||
|
if (noCache) {
|
||||||
|
const tokenizer = new Tokenizer(content)
|
||||||
|
return tokenizer.readTopLevelTokens()
|
||||||
|
}
|
||||||
|
|
||||||
if (liquidTokenCache.has(content)) {
|
if (liquidTokenCache.has(content)) {
|
||||||
return liquidTokenCache.get(content)
|
return liquidTokenCache.get(content)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,11 @@ function checkString(
|
|||||||
}: { page?: Page; filePath?: string; languageCode?: string; verbose?: boolean } = {},
|
}: { page?: Page; filePath?: string; languageCode?: string; verbose?: boolean } = {},
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
for (const token of getLiquidTokens(string)) {
|
// The reason for the `noCache: true` is that we're going to be sending
|
||||||
|
// a LOT of different strings in and the cache will fill up rapidly
|
||||||
|
// when testing every possible string in every possible language for
|
||||||
|
// every page.
|
||||||
|
for (const token of getLiquidTokens(string, { noCache: true })) {
|
||||||
if (token.name === 'ifversion' || token.name === 'elsif') {
|
if (token.name === 'ifversion' || token.name === 'elsif') {
|
||||||
for (const arg of token.args.split(/\s+/)) {
|
for (const arg of token.args.split(/\s+/)) {
|
||||||
if (IGNORE_ARGS.has(arg)) continue
|
if (IGNORE_ARGS.has(arg)) continue
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ function run(languageCode: string, site: Site, englishReusables: Reusables) {
|
|||||||
const illegalTags = new Map<string, number>()
|
const illegalTags = new Map<string, number>()
|
||||||
|
|
||||||
function countError(error: TokenizationError, where: string) {
|
function countError(error: TokenizationError, where: string) {
|
||||||
const errorString = (error as any).originalError.message as string
|
const originalError = (error as any).originalError
|
||||||
|
const errorString = originalError ? originalError.message : error.message
|
||||||
if (errorString.includes('illegal tag syntax')) {
|
if (errorString.includes('illegal tag syntax')) {
|
||||||
const illegalTag = (error as any).token.content
|
const illegalTag = (error as any).token.content
|
||||||
illegalTags.set(illegalTag, (illegalTags.get(illegalTag) || 0) + 1)
|
illegalTags.set(illegalTag, (illegalTags.get(illegalTag) || 0) + 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user