From f62f89e1a95f91859c99fbc6c3658d6dfe9b0a1d Mon Sep 17 00:00:00 2001 From: Artem Pitikin Date: Sat, 29 Jun 2024 21:23:17 +0300 Subject: [PATCH] fix(export-map): fix hashing for parser --- src/utils/export-map.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/utils/export-map.ts b/src/utils/export-map.ts index 73470e15e..df348ebd8 100644 --- a/src/utils/export-map.ts +++ b/src/utils/export-map.ts @@ -1134,20 +1134,23 @@ function makeContextCacheKey(context: RuleContext | ChildContext) { let hash = getOptionsHash('settings', settings) - const usedParserOptions = languageOptions - ? languageOptions.parserOptions - : parserOptions + const usedParserOptions = languageOptions?.parserOptions ?? parserOptions hash += getOptionsHash('parserOptions', usedParserOptions) if (languageOptions) { - const { parser: { meta } = {}, ecmaVersion, sourceType } = languageOptions - hash += - getOptionsHash('parserMeta', meta) + - String(ecmaVersion) + - String(sourceType) + const { ecmaVersion, sourceType } = languageOptions + hash += String(ecmaVersion) + String(sourceType) + } + + if (parserPath) { + hash += parserPath } else { - hash += String(parserPath) + const { meta } = languageOptions?.parser ?? {} + + if (meta) { + hash += getOptionsHash('parserMeta', meta) + } } return hash