Skip to content

Commit

Permalink
fix(export-map): fix hashing for parser
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmotema committed Jun 29, 2024
1 parent 96bf9ba commit f62f89e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/utils/export-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f62f89e

Please sign in to comment.