no-unused-modules.js 106 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. 'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};
  2. var _ExportMap = require('../ExportMap');var _ExportMap2 = _interopRequireDefault(_ExportMap);
  3. var _ignore = require('eslint-module-utils/ignore');
  4. var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve);
  5. var _visit = require('eslint-module-utils/visit');var _visit2 = _interopRequireDefault(_visit);
  6. var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);
  7. var _path = require('path');
  8. var _readPkgUp2 = require('eslint-module-utils/readPkgUp');var _readPkgUp3 = _interopRequireDefault(_readPkgUp2);
  9. var _object = require('object.values');var _object2 = _interopRequireDefault(_object);
  10. var _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _toConsumableArray(arr) {if (Array.isArray(arr)) {for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {arr2[i] = arr[i];}return arr2;} else {return Array.from(arr);}} /**
  11. * @fileOverview Ensures that modules contain exports and/or all
  12. * modules are consumed within other modules.
  13. * @author René Fermann
  14. */var FileEnumerator = void 0;var listFilesToProcess = void 0;
  15. try {var _require =
  16. require('eslint/use-at-your-own-risk');FileEnumerator = _require.FileEnumerator;
  17. } catch (e) {
  18. try {var _require2 =
  19. require('eslint/lib/cli-engine/file-enumerator'); // has been moved to eslint/lib/cli-engine/file-enumerator in version 6
  20. FileEnumerator = _require2.FileEnumerator;} catch (e) {
  21. try {
  22. // eslint/lib/util/glob-util has been moved to eslint/lib/util/glob-utils with version 5.3
  23. var _require3 = require('eslint/lib/util/glob-utils'),originalListFilesToProcess = _require3.listFilesToProcess;
  24. // Prevent passing invalid options (extensions array) to old versions of the function.
  25. // https://github.com/eslint/eslint/blob/v5.16.0/lib/util/glob-utils.js#L178-L280
  26. // https://github.com/eslint/eslint/blob/v5.2.0/lib/util/glob-util.js#L174-L269
  27. listFilesToProcess = function listFilesToProcess(src, extensions) {
  28. return originalListFilesToProcess(src, {
  29. extensions: extensions });
  30. };
  31. } catch (e) {var _require4 =
  32. require('eslint/lib/util/glob-util'),_originalListFilesToProcess = _require4.listFilesToProcess;
  33. listFilesToProcess = function listFilesToProcess(src, extensions) {
  34. var patterns = src.reduce(function (carry, pattern) {
  35. return carry.concat(extensions.map(function (extension) {
  36. return (/\*\*|\*\./.test(pattern) ? pattern : String(pattern) + '/**/*' + String(extension));
  37. }));
  38. }, src.slice());
  39. return _originalListFilesToProcess(patterns);
  40. };
  41. }
  42. }
  43. }
  44. if (FileEnumerator) {
  45. listFilesToProcess = function listFilesToProcess(src, extensions) {
  46. var e = new FileEnumerator({
  47. extensions: extensions });
  48. return Array.from(e.iterateFiles(src), function (_ref) {var filePath = _ref.filePath,ignored = _ref.ignored;return {
  49. ignored: ignored,
  50. filename: filePath };});
  51. };
  52. }
  53. var EXPORT_DEFAULT_DECLARATION = 'ExportDefaultDeclaration';
  54. var EXPORT_NAMED_DECLARATION = 'ExportNamedDeclaration';
  55. var EXPORT_ALL_DECLARATION = 'ExportAllDeclaration';
  56. var IMPORT_DECLARATION = 'ImportDeclaration';
  57. var IMPORT_NAMESPACE_SPECIFIER = 'ImportNamespaceSpecifier';
  58. var IMPORT_DEFAULT_SPECIFIER = 'ImportDefaultSpecifier';
  59. var VARIABLE_DECLARATION = 'VariableDeclaration';
  60. var FUNCTION_DECLARATION = 'FunctionDeclaration';
  61. var CLASS_DECLARATION = 'ClassDeclaration';
  62. var IDENTIFIER = 'Identifier';
  63. var OBJECT_PATTERN = 'ObjectPattern';
  64. var TS_INTERFACE_DECLARATION = 'TSInterfaceDeclaration';
  65. var TS_TYPE_ALIAS_DECLARATION = 'TSTypeAliasDeclaration';
  66. var TS_ENUM_DECLARATION = 'TSEnumDeclaration';
  67. var DEFAULT = 'default';
  68. function forEachDeclarationIdentifier(declaration, cb) {
  69. if (declaration) {
  70. if (
  71. declaration.type === FUNCTION_DECLARATION ||
  72. declaration.type === CLASS_DECLARATION ||
  73. declaration.type === TS_INTERFACE_DECLARATION ||
  74. declaration.type === TS_TYPE_ALIAS_DECLARATION ||
  75. declaration.type === TS_ENUM_DECLARATION)
  76. {
  77. cb(declaration.id.name);
  78. } else if (declaration.type === VARIABLE_DECLARATION) {
  79. declaration.declarations.forEach(function (_ref2) {var id = _ref2.id;
  80. if (id.type === OBJECT_PATTERN) {
  81. (0, _ExportMap.recursivePatternCapture)(id, function (pattern) {
  82. if (pattern.type === IDENTIFIER) {
  83. cb(pattern.name);
  84. }
  85. });
  86. } else {
  87. cb(id.name);
  88. }
  89. });
  90. }
  91. }
  92. }
  93. /**
  94. * List of imports per file.
  95. *
  96. * Represented by a two-level Map to a Set of identifiers. The upper-level Map
  97. * keys are the paths to the modules containing the imports, while the
  98. * lower-level Map keys are the paths to the files which are being imported
  99. * from. Lastly, the Set of identifiers contains either names being imported
  100. * or a special AST node name listed above (e.g ImportDefaultSpecifier).
  101. *
  102. * For example, if we have a file named foo.js containing:
  103. *
  104. * import { o2 } from './bar.js';
  105. *
  106. * Then we will have a structure that looks like:
  107. *
  108. * Map { 'foo.js' => Map { 'bar.js' => Set { 'o2' } } }
  109. *
  110. * @type {Map<string, Map<string, Set<string>>>}
  111. */
  112. var importList = new Map();
  113. /**
  114. * List of exports per file.
  115. *
  116. * Represented by a two-level Map to an object of metadata. The upper-level Map
  117. * keys are the paths to the modules containing the exports, while the
  118. * lower-level Map keys are the specific identifiers or special AST node names
  119. * being exported. The leaf-level metadata object at the moment only contains a
  120. * `whereUsed` property, which contains a Set of paths to modules that import
  121. * the name.
  122. *
  123. * For example, if we have a file named bar.js containing the following exports:
  124. *
  125. * const o2 = 'bar';
  126. * export { o2 };
  127. *
  128. * And a file named foo.js containing the following import:
  129. *
  130. * import { o2 } from './bar.js';
  131. *
  132. * Then we will have a structure that looks like:
  133. *
  134. * Map { 'bar.js' => Map { 'o2' => { whereUsed: Set { 'foo.js' } } } }
  135. *
  136. * @type {Map<string, Map<string, object>>}
  137. */
  138. var exportList = new Map();
  139. var visitorKeyMap = new Map();
  140. var ignoredFiles = new Set();
  141. var filesOutsideSrc = new Set();
  142. var isNodeModule = function isNodeModule(path) {
  143. return (/\/(node_modules)\//.test(path));
  144. };
  145. /**
  146. * read all files matching the patterns in src and ignoreExports
  147. *
  148. * return all files matching src pattern, which are not matching the ignoreExports pattern
  149. */
  150. var resolveFiles = function resolveFiles(src, ignoreExports, context) {
  151. var extensions = Array.from((0, _ignore.getFileExtensions)(context.settings));
  152. var srcFiles = new Set();
  153. var srcFileList = listFilesToProcess(src, extensions);
  154. // prepare list of ignored files
  155. var ignoredFilesList = listFilesToProcess(ignoreExports, extensions);
  156. ignoredFilesList.forEach(function (_ref3) {var filename = _ref3.filename;return ignoredFiles.add(filename);});
  157. // prepare list of source files, don't consider files from node_modules
  158. srcFileList.filter(function (_ref4) {var filename = _ref4.filename;return !isNodeModule(filename);}).forEach(function (_ref5) {var filename = _ref5.filename;
  159. srcFiles.add(filename);
  160. });
  161. return srcFiles;
  162. };
  163. /**
  164. * parse all source files and build up 2 maps containing the existing imports and exports
  165. */
  166. var prepareImportsAndExports = function prepareImportsAndExports(srcFiles, context) {
  167. var exportAll = new Map();
  168. srcFiles.forEach(function (file) {
  169. var exports = new Map();
  170. var imports = new Map();
  171. var currentExports = _ExportMap2['default'].get(file, context);
  172. if (currentExports) {var
  173. dependencies =
  174. currentExports.dependencies,reexports = currentExports.reexports,localImportList = currentExports.imports,namespace = currentExports.namespace,visitorKeys = currentExports.visitorKeys;
  175. visitorKeyMap.set(file, visitorKeys);
  176. // dependencies === export * from
  177. var currentExportAll = new Set();
  178. dependencies.forEach(function (getDependency) {
  179. var dependency = getDependency();
  180. if (dependency === null) {
  181. return;
  182. }
  183. currentExportAll.add(dependency.path);
  184. });
  185. exportAll.set(file, currentExportAll);
  186. reexports.forEach(function (value, key) {
  187. if (key === DEFAULT) {
  188. exports.set(IMPORT_DEFAULT_SPECIFIER, { whereUsed: new Set() });
  189. } else {
  190. exports.set(key, { whereUsed: new Set() });
  191. }
  192. var reexport = value.getImport();
  193. if (!reexport) {
  194. return;
  195. }
  196. var localImport = imports.get(reexport.path);
  197. var currentValue = void 0;
  198. if (value.local === DEFAULT) {
  199. currentValue = IMPORT_DEFAULT_SPECIFIER;
  200. } else {
  201. currentValue = value.local;
  202. }
  203. if (typeof localImport !== 'undefined') {
  204. localImport = new Set([].concat(_toConsumableArray(localImport), [currentValue]));
  205. } else {
  206. localImport = new Set([currentValue]);
  207. }
  208. imports.set(reexport.path, localImport);
  209. });
  210. localImportList.forEach(function (value, key) {
  211. if (isNodeModule(key)) {
  212. return;
  213. }
  214. var localImport = imports.get(key) || new Set();
  215. value.declarations.forEach(function (_ref6) {var importedSpecifiers = _ref6.importedSpecifiers;return (
  216. importedSpecifiers.forEach(function (specifier) {return localImport.add(specifier);}));});
  217. imports.set(key, localImport);
  218. });
  219. importList.set(file, imports);
  220. // build up export list only, if file is not ignored
  221. if (ignoredFiles.has(file)) {
  222. return;
  223. }
  224. namespace.forEach(function (value, key) {
  225. if (key === DEFAULT) {
  226. exports.set(IMPORT_DEFAULT_SPECIFIER, { whereUsed: new Set() });
  227. } else {
  228. exports.set(key, { whereUsed: new Set() });
  229. }
  230. });
  231. }
  232. exports.set(EXPORT_ALL_DECLARATION, { whereUsed: new Set() });
  233. exports.set(IMPORT_NAMESPACE_SPECIFIER, { whereUsed: new Set() });
  234. exportList.set(file, exports);
  235. });
  236. exportAll.forEach(function (value, key) {
  237. value.forEach(function (val) {
  238. var currentExports = exportList.get(val);
  239. if (currentExports) {
  240. var currentExport = currentExports.get(EXPORT_ALL_DECLARATION);
  241. currentExport.whereUsed.add(key);
  242. }
  243. });
  244. });
  245. };
  246. /**
  247. * traverse through all imports and add the respective path to the whereUsed-list
  248. * of the corresponding export
  249. */
  250. var determineUsage = function determineUsage() {
  251. importList.forEach(function (listValue, listKey) {
  252. listValue.forEach(function (value, key) {
  253. var exports = exportList.get(key);
  254. if (typeof exports !== 'undefined') {
  255. value.forEach(function (currentImport) {
  256. var specifier = void 0;
  257. if (currentImport === IMPORT_NAMESPACE_SPECIFIER) {
  258. specifier = IMPORT_NAMESPACE_SPECIFIER;
  259. } else if (currentImport === IMPORT_DEFAULT_SPECIFIER) {
  260. specifier = IMPORT_DEFAULT_SPECIFIER;
  261. } else {
  262. specifier = currentImport;
  263. }
  264. if (typeof specifier !== 'undefined') {
  265. var exportStatement = exports.get(specifier);
  266. if (typeof exportStatement !== 'undefined') {var
  267. whereUsed = exportStatement.whereUsed;
  268. whereUsed.add(listKey);
  269. exports.set(specifier, { whereUsed: whereUsed });
  270. }
  271. }
  272. });
  273. }
  274. });
  275. });
  276. };
  277. var getSrc = function getSrc(src) {
  278. if (src) {
  279. return src;
  280. }
  281. return [process.cwd()];
  282. };
  283. /**
  284. * prepare the lists of existing imports and exports - should only be executed once at
  285. * the start of a new eslint run
  286. */
  287. var srcFiles = void 0;
  288. var lastPrepareKey = void 0;
  289. var doPreparation = function doPreparation(src, ignoreExports, context) {
  290. var prepareKey = JSON.stringify({
  291. src: (src || []).sort(),
  292. ignoreExports: (ignoreExports || []).sort(),
  293. extensions: Array.from((0, _ignore.getFileExtensions)(context.settings)).sort() });
  294. if (prepareKey === lastPrepareKey) {
  295. return;
  296. }
  297. importList.clear();
  298. exportList.clear();
  299. ignoredFiles.clear();
  300. filesOutsideSrc.clear();
  301. srcFiles = resolveFiles(getSrc(src), ignoreExports, context);
  302. prepareImportsAndExports(srcFiles, context);
  303. determineUsage();
  304. lastPrepareKey = prepareKey;
  305. };
  306. var newNamespaceImportExists = function newNamespaceImportExists(specifiers) {return (
  307. specifiers.some(function (_ref7) {var type = _ref7.type;return type === IMPORT_NAMESPACE_SPECIFIER;}));};
  308. var newDefaultImportExists = function newDefaultImportExists(specifiers) {return (
  309. specifiers.some(function (_ref8) {var type = _ref8.type;return type === IMPORT_DEFAULT_SPECIFIER;}));};
  310. var fileIsInPkg = function fileIsInPkg(file) {var _readPkgUp =
  311. (0, _readPkgUp3['default'])({ cwd: file }),path = _readPkgUp.path,pkg = _readPkgUp.pkg;
  312. var basePath = (0, _path.dirname)(path);
  313. var checkPkgFieldString = function checkPkgFieldString(pkgField) {
  314. if ((0, _path.join)(basePath, pkgField) === file) {
  315. return true;
  316. }
  317. };
  318. var checkPkgFieldObject = function checkPkgFieldObject(pkgField) {
  319. var pkgFieldFiles = (0, _object2['default'])(pkgField).map(function (value) {return (0, _path.join)(basePath, value);});
  320. if ((0, _arrayIncludes2['default'])(pkgFieldFiles, file)) {
  321. return true;
  322. }
  323. };
  324. var checkPkgField = function checkPkgField(pkgField) {
  325. if (typeof pkgField === 'string') {
  326. return checkPkgFieldString(pkgField);
  327. }
  328. if ((typeof pkgField === 'undefined' ? 'undefined' : _typeof(pkgField)) === 'object') {
  329. return checkPkgFieldObject(pkgField);
  330. }
  331. };
  332. if (pkg['private'] === true) {
  333. return false;
  334. }
  335. if (pkg.bin) {
  336. if (checkPkgField(pkg.bin)) {
  337. return true;
  338. }
  339. }
  340. if (pkg.browser) {
  341. if (checkPkgField(pkg.browser)) {
  342. return true;
  343. }
  344. }
  345. if (pkg.main) {
  346. if (checkPkgFieldString(pkg.main)) {
  347. return true;
  348. }
  349. }
  350. return false;
  351. };
  352. module.exports = {
  353. meta: {
  354. type: 'suggestion',
  355. docs: { url: (0, _docsUrl2['default'])('no-unused-modules') },
  356. schema: [{
  357. properties: {
  358. src: {
  359. description: 'files/paths to be analyzed (only for unused exports)',
  360. type: 'array',
  361. minItems: 1,
  362. items: {
  363. type: 'string',
  364. minLength: 1 } },
  365. ignoreExports: {
  366. description:
  367. 'files/paths for which unused exports will not be reported (e.g module entry points)',
  368. type: 'array',
  369. minItems: 1,
  370. items: {
  371. type: 'string',
  372. minLength: 1 } },
  373. missingExports: {
  374. description: 'report modules without any exports',
  375. type: 'boolean' },
  376. unusedExports: {
  377. description: 'report exports without any usage',
  378. type: 'boolean' } },
  379. not: {
  380. properties: {
  381. unusedExports: { 'enum': [false] },
  382. missingExports: { 'enum': [false] } } },
  383. anyOf: [{
  384. not: {
  385. properties: {
  386. unusedExports: { 'enum': [true] } } },
  387. required: ['missingExports'] },
  388. {
  389. not: {
  390. properties: {
  391. missingExports: { 'enum': [true] } } },
  392. required: ['unusedExports'] },
  393. {
  394. properties: {
  395. unusedExports: { 'enum': [true] } },
  396. required: ['unusedExports'] },
  397. {
  398. properties: {
  399. missingExports: { 'enum': [true] } },
  400. required: ['missingExports'] }] }] },
  401. create: function () {function create(context) {var _ref9 =
  402. context.options[0] || {},src = _ref9.src,_ref9$ignoreExports = _ref9.ignoreExports,ignoreExports = _ref9$ignoreExports === undefined ? [] : _ref9$ignoreExports,missingExports = _ref9.missingExports,unusedExports = _ref9.unusedExports;
  403. if (unusedExports) {
  404. doPreparation(src, ignoreExports, context);
  405. }
  406. var file = context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename();
  407. var checkExportPresence = function () {function checkExportPresence(node) {
  408. if (!missingExports) {
  409. return;
  410. }
  411. if (ignoredFiles.has(file)) {
  412. return;
  413. }
  414. var exportCount = exportList.get(file);
  415. var exportAll = exportCount.get(EXPORT_ALL_DECLARATION);
  416. var namespaceImports = exportCount.get(IMPORT_NAMESPACE_SPECIFIER);
  417. exportCount['delete'](EXPORT_ALL_DECLARATION);
  418. exportCount['delete'](IMPORT_NAMESPACE_SPECIFIER);
  419. if (exportCount.size < 1) {
  420. // node.body[0] === 'undefined' only happens, if everything is commented out in the file
  421. // being linted
  422. context.report(node.body[0] ? node.body[0] : node, 'No exports found');
  423. }
  424. exportCount.set(EXPORT_ALL_DECLARATION, exportAll);
  425. exportCount.set(IMPORT_NAMESPACE_SPECIFIER, namespaceImports);
  426. }return checkExportPresence;}();
  427. var checkUsage = function () {function checkUsage(node, exportedValue) {
  428. if (!unusedExports) {
  429. return;
  430. }
  431. if (ignoredFiles.has(file)) {
  432. return;
  433. }
  434. if (fileIsInPkg(file)) {
  435. return;
  436. }
  437. if (filesOutsideSrc.has(file)) {
  438. return;
  439. }
  440. // make sure file to be linted is included in source files
  441. if (!srcFiles.has(file)) {
  442. srcFiles = resolveFiles(getSrc(src), ignoreExports, context);
  443. if (!srcFiles.has(file)) {
  444. filesOutsideSrc.add(file);
  445. return;
  446. }
  447. }
  448. exports = exportList.get(file);
  449. // special case: export * from
  450. var exportAll = exports.get(EXPORT_ALL_DECLARATION);
  451. if (typeof exportAll !== 'undefined' && exportedValue !== IMPORT_DEFAULT_SPECIFIER) {
  452. if (exportAll.whereUsed.size > 0) {
  453. return;
  454. }
  455. }
  456. // special case: namespace import
  457. var namespaceImports = exports.get(IMPORT_NAMESPACE_SPECIFIER);
  458. if (typeof namespaceImports !== 'undefined') {
  459. if (namespaceImports.whereUsed.size > 0) {
  460. return;
  461. }
  462. }
  463. // exportsList will always map any imported value of 'default' to 'ImportDefaultSpecifier'
  464. var exportsKey = exportedValue === DEFAULT ? IMPORT_DEFAULT_SPECIFIER : exportedValue;
  465. var exportStatement = exports.get(exportsKey);
  466. var value = exportsKey === IMPORT_DEFAULT_SPECIFIER ? DEFAULT : exportsKey;
  467. if (typeof exportStatement !== 'undefined') {
  468. if (exportStatement.whereUsed.size < 1) {
  469. context.report(
  470. node, 'exported declaration \'' +
  471. value + '\' not used within other modules');
  472. }
  473. } else {
  474. context.report(
  475. node, 'exported declaration \'' +
  476. value + '\' not used within other modules');
  477. }
  478. }return checkUsage;}();
  479. /**
  480. * only useful for tools like vscode-eslint
  481. *
  482. * update lists of existing exports during runtime
  483. */
  484. var updateExportUsage = function () {function updateExportUsage(node) {
  485. if (ignoredFiles.has(file)) {
  486. return;
  487. }
  488. var exports = exportList.get(file);
  489. // new module has been created during runtime
  490. // include it in further processing
  491. if (typeof exports === 'undefined') {
  492. exports = new Map();
  493. }
  494. var newExports = new Map();
  495. var newExportIdentifiers = new Set();
  496. node.body.forEach(function (_ref10) {var type = _ref10.type,declaration = _ref10.declaration,specifiers = _ref10.specifiers;
  497. if (type === EXPORT_DEFAULT_DECLARATION) {
  498. newExportIdentifiers.add(IMPORT_DEFAULT_SPECIFIER);
  499. }
  500. if (type === EXPORT_NAMED_DECLARATION) {
  501. if (specifiers.length > 0) {
  502. specifiers.forEach(function (specifier) {
  503. if (specifier.exported) {
  504. newExportIdentifiers.add(specifier.exported.name || specifier.exported.value);
  505. }
  506. });
  507. }
  508. forEachDeclarationIdentifier(declaration, function (name) {
  509. newExportIdentifiers.add(name);
  510. });
  511. }
  512. });
  513. // old exports exist within list of new exports identifiers: add to map of new exports
  514. exports.forEach(function (value, key) {
  515. if (newExportIdentifiers.has(key)) {
  516. newExports.set(key, value);
  517. }
  518. });
  519. // new export identifiers added: add to map of new exports
  520. newExportIdentifiers.forEach(function (key) {
  521. if (!exports.has(key)) {
  522. newExports.set(key, { whereUsed: new Set() });
  523. }
  524. });
  525. // preserve information about namespace imports
  526. var exportAll = exports.get(EXPORT_ALL_DECLARATION);
  527. var namespaceImports = exports.get(IMPORT_NAMESPACE_SPECIFIER);
  528. if (typeof namespaceImports === 'undefined') {
  529. namespaceImports = { whereUsed: new Set() };
  530. }
  531. newExports.set(EXPORT_ALL_DECLARATION, exportAll);
  532. newExports.set(IMPORT_NAMESPACE_SPECIFIER, namespaceImports);
  533. exportList.set(file, newExports);
  534. }return updateExportUsage;}();
  535. /**
  536. * only useful for tools like vscode-eslint
  537. *
  538. * update lists of existing imports during runtime
  539. */
  540. var updateImportUsage = function () {function updateImportUsage(node) {
  541. if (!unusedExports) {
  542. return;
  543. }
  544. var oldImportPaths = importList.get(file);
  545. if (typeof oldImportPaths === 'undefined') {
  546. oldImportPaths = new Map();
  547. }
  548. var oldNamespaceImports = new Set();
  549. var newNamespaceImports = new Set();
  550. var oldExportAll = new Set();
  551. var newExportAll = new Set();
  552. var oldDefaultImports = new Set();
  553. var newDefaultImports = new Set();
  554. var oldImports = new Map();
  555. var newImports = new Map();
  556. oldImportPaths.forEach(function (value, key) {
  557. if (value.has(EXPORT_ALL_DECLARATION)) {
  558. oldExportAll.add(key);
  559. }
  560. if (value.has(IMPORT_NAMESPACE_SPECIFIER)) {
  561. oldNamespaceImports.add(key);
  562. }
  563. if (value.has(IMPORT_DEFAULT_SPECIFIER)) {
  564. oldDefaultImports.add(key);
  565. }
  566. value.forEach(function (val) {
  567. if (val !== IMPORT_NAMESPACE_SPECIFIER &&
  568. val !== IMPORT_DEFAULT_SPECIFIER) {
  569. oldImports.set(val, key);
  570. }
  571. });
  572. });
  573. function processDynamicImport(source) {
  574. if (source.type !== 'Literal') {
  575. return null;
  576. }
  577. var p = (0, _resolve2['default'])(source.value, context);
  578. if (p == null) {
  579. return null;
  580. }
  581. newNamespaceImports.add(p);
  582. }
  583. (0, _visit2['default'])(node, visitorKeyMap.get(file), {
  584. ImportExpression: function () {function ImportExpression(child) {
  585. processDynamicImport(child.source);
  586. }return ImportExpression;}(),
  587. CallExpression: function () {function CallExpression(child) {
  588. if (child.callee.type === 'Import') {
  589. processDynamicImport(child.arguments[0]);
  590. }
  591. }return CallExpression;}() });
  592. node.body.forEach(function (astNode) {
  593. var resolvedPath = void 0;
  594. // support for export { value } from 'module'
  595. if (astNode.type === EXPORT_NAMED_DECLARATION) {
  596. if (astNode.source) {
  597. resolvedPath = (0, _resolve2['default'])(astNode.source.raw.replace(/('|")/g, ''), context);
  598. astNode.specifiers.forEach(function (specifier) {
  599. var name = specifier.local.name || specifier.local.value;
  600. if (name === DEFAULT) {
  601. newDefaultImports.add(resolvedPath);
  602. } else {
  603. newImports.set(name, resolvedPath);
  604. }
  605. });
  606. }
  607. }
  608. if (astNode.type === EXPORT_ALL_DECLARATION) {
  609. resolvedPath = (0, _resolve2['default'])(astNode.source.raw.replace(/('|")/g, ''), context);
  610. newExportAll.add(resolvedPath);
  611. }
  612. if (astNode.type === IMPORT_DECLARATION) {
  613. resolvedPath = (0, _resolve2['default'])(astNode.source.raw.replace(/('|")/g, ''), context);
  614. if (!resolvedPath) {
  615. return;
  616. }
  617. if (isNodeModule(resolvedPath)) {
  618. return;
  619. }
  620. if (newNamespaceImportExists(astNode.specifiers)) {
  621. newNamespaceImports.add(resolvedPath);
  622. }
  623. if (newDefaultImportExists(astNode.specifiers)) {
  624. newDefaultImports.add(resolvedPath);
  625. }
  626. astNode.specifiers.forEach(function (specifier) {
  627. if (specifier.type === IMPORT_DEFAULT_SPECIFIER ||
  628. specifier.type === IMPORT_NAMESPACE_SPECIFIER) {
  629. return;
  630. }
  631. newImports.set(specifier.imported.name || specifier.imported.value, resolvedPath);
  632. });
  633. }
  634. });
  635. newExportAll.forEach(function (value) {
  636. if (!oldExportAll.has(value)) {
  637. var imports = oldImportPaths.get(value);
  638. if (typeof imports === 'undefined') {
  639. imports = new Set();
  640. }
  641. imports.add(EXPORT_ALL_DECLARATION);
  642. oldImportPaths.set(value, imports);
  643. var _exports = exportList.get(value);
  644. var currentExport = void 0;
  645. if (typeof _exports !== 'undefined') {
  646. currentExport = _exports.get(EXPORT_ALL_DECLARATION);
  647. } else {
  648. _exports = new Map();
  649. exportList.set(value, _exports);
  650. }
  651. if (typeof currentExport !== 'undefined') {
  652. currentExport.whereUsed.add(file);
  653. } else {
  654. var whereUsed = new Set();
  655. whereUsed.add(file);
  656. _exports.set(EXPORT_ALL_DECLARATION, { whereUsed: whereUsed });
  657. }
  658. }
  659. });
  660. oldExportAll.forEach(function (value) {
  661. if (!newExportAll.has(value)) {
  662. var imports = oldImportPaths.get(value);
  663. imports['delete'](EXPORT_ALL_DECLARATION);
  664. var _exports2 = exportList.get(value);
  665. if (typeof _exports2 !== 'undefined') {
  666. var currentExport = _exports2.get(EXPORT_ALL_DECLARATION);
  667. if (typeof currentExport !== 'undefined') {
  668. currentExport.whereUsed['delete'](file);
  669. }
  670. }
  671. }
  672. });
  673. newDefaultImports.forEach(function (value) {
  674. if (!oldDefaultImports.has(value)) {
  675. var imports = oldImportPaths.get(value);
  676. if (typeof imports === 'undefined') {
  677. imports = new Set();
  678. }
  679. imports.add(IMPORT_DEFAULT_SPECIFIER);
  680. oldImportPaths.set(value, imports);
  681. var _exports3 = exportList.get(value);
  682. var currentExport = void 0;
  683. if (typeof _exports3 !== 'undefined') {
  684. currentExport = _exports3.get(IMPORT_DEFAULT_SPECIFIER);
  685. } else {
  686. _exports3 = new Map();
  687. exportList.set(value, _exports3);
  688. }
  689. if (typeof currentExport !== 'undefined') {
  690. currentExport.whereUsed.add(file);
  691. } else {
  692. var whereUsed = new Set();
  693. whereUsed.add(file);
  694. _exports3.set(IMPORT_DEFAULT_SPECIFIER, { whereUsed: whereUsed });
  695. }
  696. }
  697. });
  698. oldDefaultImports.forEach(function (value) {
  699. if (!newDefaultImports.has(value)) {
  700. var imports = oldImportPaths.get(value);
  701. imports['delete'](IMPORT_DEFAULT_SPECIFIER);
  702. var _exports4 = exportList.get(value);
  703. if (typeof _exports4 !== 'undefined') {
  704. var currentExport = _exports4.get(IMPORT_DEFAULT_SPECIFIER);
  705. if (typeof currentExport !== 'undefined') {
  706. currentExport.whereUsed['delete'](file);
  707. }
  708. }
  709. }
  710. });
  711. newNamespaceImports.forEach(function (value) {
  712. if (!oldNamespaceImports.has(value)) {
  713. var imports = oldImportPaths.get(value);
  714. if (typeof imports === 'undefined') {
  715. imports = new Set();
  716. }
  717. imports.add(IMPORT_NAMESPACE_SPECIFIER);
  718. oldImportPaths.set(value, imports);
  719. var _exports5 = exportList.get(value);
  720. var currentExport = void 0;
  721. if (typeof _exports5 !== 'undefined') {
  722. currentExport = _exports5.get(IMPORT_NAMESPACE_SPECIFIER);
  723. } else {
  724. _exports5 = new Map();
  725. exportList.set(value, _exports5);
  726. }
  727. if (typeof currentExport !== 'undefined') {
  728. currentExport.whereUsed.add(file);
  729. } else {
  730. var whereUsed = new Set();
  731. whereUsed.add(file);
  732. _exports5.set(IMPORT_NAMESPACE_SPECIFIER, { whereUsed: whereUsed });
  733. }
  734. }
  735. });
  736. oldNamespaceImports.forEach(function (value) {
  737. if (!newNamespaceImports.has(value)) {
  738. var imports = oldImportPaths.get(value);
  739. imports['delete'](IMPORT_NAMESPACE_SPECIFIER);
  740. var _exports6 = exportList.get(value);
  741. if (typeof _exports6 !== 'undefined') {
  742. var currentExport = _exports6.get(IMPORT_NAMESPACE_SPECIFIER);
  743. if (typeof currentExport !== 'undefined') {
  744. currentExport.whereUsed['delete'](file);
  745. }
  746. }
  747. }
  748. });
  749. newImports.forEach(function (value, key) {
  750. if (!oldImports.has(key)) {
  751. var imports = oldImportPaths.get(value);
  752. if (typeof imports === 'undefined') {
  753. imports = new Set();
  754. }
  755. imports.add(key);
  756. oldImportPaths.set(value, imports);
  757. var _exports7 = exportList.get(value);
  758. var currentExport = void 0;
  759. if (typeof _exports7 !== 'undefined') {
  760. currentExport = _exports7.get(key);
  761. } else {
  762. _exports7 = new Map();
  763. exportList.set(value, _exports7);
  764. }
  765. if (typeof currentExport !== 'undefined') {
  766. currentExport.whereUsed.add(file);
  767. } else {
  768. var whereUsed = new Set();
  769. whereUsed.add(file);
  770. _exports7.set(key, { whereUsed: whereUsed });
  771. }
  772. }
  773. });
  774. oldImports.forEach(function (value, key) {
  775. if (!newImports.has(key)) {
  776. var imports = oldImportPaths.get(value);
  777. imports['delete'](key);
  778. var _exports8 = exportList.get(value);
  779. if (typeof _exports8 !== 'undefined') {
  780. var currentExport = _exports8.get(key);
  781. if (typeof currentExport !== 'undefined') {
  782. currentExport.whereUsed['delete'](file);
  783. }
  784. }
  785. }
  786. });
  787. }return updateImportUsage;}();
  788. return {
  789. 'Program:exit': function () {function ProgramExit(node) {
  790. updateExportUsage(node);
  791. updateImportUsage(node);
  792. checkExportPresence(node);
  793. }return ProgramExit;}(),
  794. 'ExportDefaultDeclaration': function () {function ExportDefaultDeclaration(node) {
  795. checkUsage(node, IMPORT_DEFAULT_SPECIFIER);
  796. }return ExportDefaultDeclaration;}(),
  797. 'ExportNamedDeclaration': function () {function ExportNamedDeclaration(node) {
  798. node.specifiers.forEach(function (specifier) {
  799. checkUsage(node, specifier.exported.name || specifier.exported.value);
  800. });
  801. forEachDeclarationIdentifier(node.declaration, function (name) {
  802. checkUsage(node, name);
  803. });
  804. }return ExportNamedDeclaration;}() };
  805. }return create;}() };
  806. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11bnVzZWQtbW9kdWxlcy5qcyJdLCJuYW1lcyI6WyJGaWxlRW51bWVyYXRvciIsImxpc3RGaWxlc1RvUHJvY2VzcyIsInJlcXVpcmUiLCJlIiwib3JpZ2luYWxMaXN0RmlsZXNUb1Byb2Nlc3MiLCJzcmMiLCJleHRlbnNpb25zIiwicGF0dGVybnMiLCJyZWR1Y2UiLCJjYXJyeSIsInBhdHRlcm4iLCJjb25jYXQiLCJtYXAiLCJleHRlbnNpb24iLCJ0ZXN0Iiwic2xpY2UiLCJBcnJheSIsImZyb20iLCJpdGVyYXRlRmlsZXMiLCJmaWxlUGF0aCIsImlnbm9yZWQiLCJmaWxlbmFtZSIsIkVYUE9SVF9ERUZBVUxUX0RFQ0xBUkFUSU9OIiwiRVhQT1JUX05BTUVEX0RFQ0xBUkFUSU9OIiwiRVhQT1JUX0FMTF9ERUNMQVJBVElPTiIsIklNUE9SVF9ERUNMQVJBVElPTiIsIklNUE9SVF9OQU1FU1BBQ0VfU1BFQ0lGSUVSIiwiSU1QT1JUX0RFRkFVTFRfU1BFQ0lGSUVSIiwiVkFSSUFCTEVfREVDTEFSQVRJT04iLCJGVU5DVElPTl9ERUNMQVJBVElPTiIsIkNMQVNTX0RFQ0xBUkFUSU9OIiwiSURFTlRJRklFUiIsIk9CSkVDVF9QQVRURVJOIiwiVFNfSU5URVJGQUNFX0RFQ0xBUkFUSU9OIiwiVFNfVFlQRV9BTElBU19ERUNMQVJBVElPTiIsIlRTX0VOVU1fREVDTEFSQVRJT04iLCJERUZBVUxUIiwiZm9yRWFjaERlY2xhcmF0aW9uSWRlbnRpZmllciIsImRlY2xhcmF0aW9uIiwiY2IiLCJ0eXBlIiwiaWQiLCJuYW1lI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NzVXJsKCduby11bnVzZWQtbW9kdWxlcycpIH0sXG4gICAgc2NoZW1hOiBbe1xuICAgICAgcHJvcGVydGllczoge1xuICAgICAgICBzcmM6IHtcbiAgICAgICAgICBkZXNjcmlwdGlvbjogJ2ZpbGVzL3BhdGhzIHRvIGJlIGFuYWx5emVkIChvbmx5IGZvciB1bnVzZWQgZXhwb3J0cyknLFxuICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgbWluSXRlbXM6IDEsXG4gICAgICAgICAgaXRlbXM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgbWluTGVuZ3RoOiAxLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIGlnbm9yZUV4cG9ydHM6IHtcbiAgICAgICAgICBkZXNjcmlwdGlvbjpcbiAgICAgICAgICAgICdmaWxlcy9wYXRocyBmb3Igd2hpY2ggdW51c2VkIGV4cG9ydHMgd2lsbCBub3QgYmUgcmVwb3J0ZWQgKGUuZyBtb2R1bGUgZW50cnkgcG9pbnRzKScsXG4gICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICBtaW5JdGVtczogMSxcbiAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsXG4gICAgICAgICAgICBtaW5MZW5ndGg6IDEsXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAgbWlzc2luZ0V4cG9ydHM6IHtcbiAgICAgICAgICBkZXNjcmlwdGlvbjogJ3JlcG9ydCBtb2R1bGVzIHdpdGhvdXQgYW55IGV4cG9ydHMnLFxuICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgfSxcbiAgICAgICAgdW51c2VkRXhwb3J0czoge1xuICAgICAgICAgIGRlc2NyaXB0aW9uOiAncmVwb3J0IGV4cG9ydHMgd2l0aG91dCBhbnkgdXNhZ2UnLFxuICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgICBub3Q6IHtcbiAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgIHVudXNlZEV4cG9ydHM6IHsgZW51bTogW2ZhbHNlXSB9LFxuICAgICAgICAgIG1pc3NpbmdFeHBvcnRzOiB7IGVudW06IFtmYWxzZV0gfSxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgICBhbnlPZjpbe1xuICAgICAgICBub3Q6IHtcbiAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICB1bnVzZWRFeHBvcnRzOiB7IGVudW06IFt0cnVlXSB9LFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIHJlcXVpcmVkOiBbJ21pc3NpbmdFeHBvcnRzJ10sXG4gICAgICB9LCB7XG4gICAgICAgIG5vdDoge1xuICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgIG1pc3NpbmdFeHBvcnRzOiB7IGVudW06IFt0cnVlXSB9LFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIHJlcXVpcmVkOiBbJ3VudXNlZEV4cG9ydHMnXSxcbiAgICAgIH0sIHtcbiAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgIHVudXNlZEV4cG9ydHM6IHsgZW51bTogW3RydWVdIH0sXG4gICAgICAgIH0sXG4gICAgICAgIHJlcXVpcmVkOiBbJ3VudXNlZEV4cG9ydHMnXSxcbiAgICAgIH0sIHtcbiAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgIG1pc3NpbmdFeHBvcnRzOiB7IGVudW06IFt0cnVlXSB9LFxuICAgICAgICB9LFxuICAgICAgICByZXF1aXJlZDogWydtaXNzaW5nRXhwb3J0cyddLFxuICAgICAgfV0sXG4gICAgfV0sXG4gIH0sXG5cbiAgY3JlYXRlOiBjb250ZXh0ID0+IHtcbiAgICBjb25zdCB7XG4gICAgICBzcmMsXG4gICAgIC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Gw7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcCA9IHJlc29sdmUoc291cmNlLnZhbHVlLCBjb250ZXh0KTtcbiAgICAgICAgaWYgKHAgPT0gbnVsbCkge1xuICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICB9XG4gICAgICAgIG5ld05hbWVzcGFjZUltcG9ydHMuYWRkKHApO1xuICAgICAgfVxuXG4gICAgICB2aXNpdChub2RlLCB2aXNpdG9yS2V5TWFwLmdldChmaWxlKSwge1xuICAgICAgICBJbXBvcnRFeHByZXNzaW9uKGNoaWxkKSB7XG4gICAgICAgICAgcHJvY2Vzc0R5bmFtaWNJbXBvcnQoY2hpbGQuc291cmNlKTtcbiAgICAgICAgfSxcbiAgICAgICAgQ2FsbEV4cHJlc3Npb24oY2hpbGQpIHtcbiAgICAgICAgICBpZiAoY2hpbGQuY2FsbGVlLnR5cGUgPT09ICdJbXBvcnQnKSB7XG4gICAgICAgICAgICBwcm9jZXNzRHluYW1pY0ltcG9ydChjaGlsZC5hcmd1bWVudHNbMF0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgIH0pO1xuXG4gICAgICBub2RlLmJvZHkuZm9yRWFjaChhc3ROb2RlID0+IHtcbiAgICAgICAgbGV0IHJlc29sdmVkUGF0aDtcblxuICAgICAgICAvLyBzdXBwb3J0IGZvciBleHBvcnQgeyB2YWx1ZSB9IGZyb20gJ21vZHVsZSdcbiAgICAgICAgaWYgKGFzdE5vZGUudHlwZSA9PT0gRVhQT1JUX05BTUVEX0RFQ0xBUkFUSU9OKSB7XG4gICAgICAgICAgaWYgKGFzdE5vZGUuc291cmNlKSB7XG4gICAgICAgICAgICByZXNvbHZlZFBhdGggPSByZXNvbHZlKGFzdE5vZGUuc291cmNlLnJhdy5yZXBsYWNlKC8oJ3xcIikvZywgJycpLCBjb250ZXh0KTtcbiAgICAgICAgICAgIGFzdE5vZGUuc3BlY2lmaWVycy5mb3JFYWNoKHNwZWNpZmllciA9PiB7XG4gICAgICAgICAgICAgIGNvbnN0IG5hbWUgPSBzcGVjaWZpZXIubG9jYWwubmFtZSB8fCBzcGVjaWZpZXIubG9jYWwudmFsdWU7XG4gICAgICAgICAgICAgIGlmIChuYW1lID09PSBERUZBVUxUKSB7XG4gICAgICAgICAgICAgICAgbmV3RGVmYXVsdEltcG9ydHMuYWRkKHJlc29sdmVkUGF0aCk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgbmV3SW1wb3J0cy5zZXQobmFtZSwgcmVzb2x2ZWRQYXRoKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGFzdE5vZGUudHlwZSA9PT0gRVhQT1JUX0FMTF9ERUNMQVJBVElPTikge1xuICAgICAgICAgIHJlc29sdmVkUGF0aCA9IHJlc29sdmUoYXN0Tm9kZS5zb3VyY2UucmF3LnJlcGxhY2UoLygnfFwiKS9nLCAnJyksIGNvbnRleHQpO1xuICAgICAgICAgIG5ld0V4cG9ydEFsbC5hZGQocmVzb2x2ZWRQYXRoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChhc3ROb2RlLnR5cGUgPT09IElNUE9SVF9ERUNMQVJBVElPTikge1xuICAgICAgICAgIHJlc29sdmVkUGF0aCA9IHJlc29sdmUoYXN0Tm9kZS5zb3VyY2UucmF3LnJlcGxhY2UoLygnfFwiKS9nLCAnJyksIGNvbnRleHQpO1xuICAgICAgICAgIGlmICghcmVzb2x2ZWRQYXRoKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKGlzTm9kZU1vZHVsZShyZXNvbHZlZFBhdGgpKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKG5ld05hbWVzcGFjZUltcG9ydEV4aXN0cyhhc3ROb2RlLnNwZWNpZmllcnMpKSB7XG4gICAgICAgICAgICBuZXdOYW1lc3BhY2VJbXBvcnRzLmFkZChyZXNvbHZlZFBhdGgpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChuZXdEZWZhdWx0SW1wb3J0RXhpc3RzKGFzdE5vZGUuc3BlY2lmaWVycykpIHtcbiAgICAgICAgICAgIG5ld0RlZmF1bHRJbXBvcnRzLmFkZChyZXNvbHZlZFBhdGgpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGFzdE5vZGUuc3BlY2lmaWVycy5mb3JFYWNoKHNwZWNpZmllciA9PiB7XG4gICAgICAgICAgICBpZiAoc3BlY2lmaWVyLnR5cGUgPT09IElNUE9SVF9ERUZBVUxUX1NQRUNJRklFUiB8fFxuICAgICAgICAgICAgICAgIHNwZWNpZmllci50eXBlID09PSBJTVBPUlRfTkFNRVNQQUNFX1NQRUNJRklFUikge1xuICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBuZXdJbXBvcnRzLnNldChzcGVjaWZpZXIuaW1wb3J0ZWQubmFtZSB8fCBzcGVjaWZpZXIuaW1wb3J0ZWQudmFsdWUsIHJlc29sdmVkUGF0aCk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuXG4gICAgICBuZXdFeHBvcnRBbGwuZm9yRWFjaCh2YWx1ZSA9PiB7XG4gICAgICAgIGlmICghb2xkRXhwb3J0QWxsLmhhcyh2YWx1ZSkpIHtcbiAgICAgICAgICBsZXQgaW1wb3J0cyA9IG9sZEltcG9ydFBhdGhzLmdldCh2YWx1ZSk7XG4gICAgICAgICAgaWYgKHR5cGVvZiBpbXBvcnRzID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgaW1wb3J0cyA9IG5ldyBTZXQoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaW1wb3J0cy5hZGQoRVhQT1JUX0FMTF9ERUNMQVJBVElPTik7XG4gICAgICAgICAgb2xkSW1wb3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gICAgICAgIGNvbnN0IGV4cG9ydHMgPSBleHBvcnRMaXN0LmdldCh2YWx1ZSk7XG4gICAgICAgICAgaWYgKHR5cGVvZiBleHBvcnRzICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgY29uc3QgY3VycmVudEV4cG9ydCA9IGV4cG9ydHMuZ2V0KEVYUE9SVF9BTExfREVDTEFSQVRJT04pO1xuICAgICAgICAgICAgaWYgKHR5cGVvZiBjdXJyZW50RXhwb3J0ICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICBjdXJyZW50RXhwb3J0LndoZXJlVXNlZC5kZWxldGUoZmlsZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9KTtcblxuICAgICAgbmV3RGVmYXVsdEltcG9ydHMuZm9yRWFjaCh2YWx1ZSA9PiB7XG4gICAgICAgIGlmICghb2xkRGVmYXVsdEltcG9ydHMuaGFzKHZhbHVlKSkge1xuICAgICAgICAgIGxldCBpbXBvcnRzID0gb2xkSW1wb3J0UGF0aHMuZ2V0KHZhbHVlKTtcbiAgICAgICAgICBpZiAodHlwZW9mIGltcG9ydHMgPT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICBpbXBvcnRzID0gbmV3IFNldCgpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpbXBvcnRzLmFkZChJTVBPUlRfREVGQVVMVF9TUEVDSUZJRVIpO1xuICAgICAgICAgIG9sZEltcG9ydFBhdGhzLnNldCh2YWx1ZSwgaW1wb3J0cyk7XG5cbiAgICAgICAgICBsZXQgZXhwb3J0cyA9IGV4cG9ydExpc3QuZ2V0KHZhbHVlKTtcbiAgICAgICAgICBsZXQgY3VycmVudEV4cG9ydDtcbiAgICAgICAgICBpZiAodHlwZW9mIGV4cG9ydHMgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICBjdXJyZW50RXhwb3J0ID0gZXhwb3J0cy5nZXQoSU1QT1JUX0RFRkFV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rZXkpID0+IHtcbiAgICAgICAgaWYgKCFvbGRJbXBvcnRzLmhhcyhrZXkpKSB7XG4gICAgICAgICAgbGV0IGltcG9ydHMgPSBvbGRJbXBvcnRQYXRocy5nZXQodmFsdWUpO1xuICAgICAgICAgIGlmICh0eXBlb2YgaW1wb3J0cyA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIGltcG9ydHMgPSBuZXcgU2V0KCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGltcG9ydHMuYWRkKGtleSk7XG4gICAgICAgICAgb2xkSW1wb3J0UGF0aHMuc2V0KHZhbHVlLCBpbXBvcnRzKTtcblxuICAgICAgICAgIGxldCBleHBvcnRzID0gZXhwb3J0TGlzdC5nZXQodmFsdWUpO1xuICAgICAgICAgIGxldCBjdXJyZW50RXhwb3J0O1xuICAgICAgICAgIGlmICh0eXBlb2YgZXhwb3J0cyAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIGN1cnJlbnRFeHBvcnQgPSBleHBvcnRzLmdldChrZXkpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBleHBvcnRzID0gbmV3IE1hcCgpO1xuICAgICAgICAgICAgZXhwb3J0TGlzdC5zZXQodmFsdWUsIGV4cG9ydHMpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmICh0eXBlb2YgY3VycmVudEV4cG9ydCAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgIGN1cnJlbnRFeHBvcnQud2hlcmVVc2VkLmFkZChmaWxlKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgY29uc3Qgd2hlcmVVc2VkID0gbmV3IFNldCgpO1xuICAgICAgICAgICAgd2hlcmVVc2VkLmFkZChmaWxlKTtcbiAgICAgICAgICAgIGV4cG9ydHMuc2V0KGtleSwgeyB3aGVyZVVzZWQgfSk7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9KTtcblxuICAg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