Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2021-07-27 16:54:26 +00:00
parent 6b0d45a5c6
commit cc1adb825a
4247 changed files with 144820 additions and 149530 deletions

View file

@ -1,10 +1,10 @@
'use strict'
'use strict';
const crypto = require('crypto')
, moduleRequire = require('eslint-module-utils/module-require').default
, hashObject = require('eslint-module-utils/hash').hashObject
const crypto = require('crypto');
const moduleRequire = require('eslint-module-utils/module-require').default;
const hashObject = require('eslint-module-utils/hash').hashObject;
const cache = new Map()
const cache = new Map();
// must match ESLint default options or we'll miss the cache every time
const parserOptions = {
@ -14,28 +14,28 @@ const parserOptions = {
tokens: true,
comment: true,
attachComment: true,
}
};
exports.parse = function parse(content, options) {
options = Object.assign({}, options, parserOptions)
options = Object.assign({}, options, parserOptions);
if (!options.filePath) {
throw new Error('no file path provided!')
throw new Error('no file path provided!');
}
const keyHash = crypto.createHash('sha256')
keyHash.update(content)
hashObject(options, keyHash)
const keyHash = crypto.createHash('sha256');
keyHash.update(content);
hashObject(options, keyHash);
const key = keyHash.digest('hex')
const key = keyHash.digest('hex');
let ast = cache.get(key)
if (ast != null) return ast
let ast = cache.get(key);
if (ast != null) return ast;
const realParser = moduleRequire(options.parser)
const realParser = moduleRequire(options.parser);
ast = realParser.parse(content, options)
cache.set(key, ast)
ast = realParser.parse(content, options);
cache.set(key, ast);
return ast
}
return ast;
};