(host, watchLogLevel, log, getDetailWatchInfo)
| 115610 | WatchLogLevel[WatchLogLevel["Verbose"] = 2] = "Verbose"; |
| 115611 | })(WatchLogLevel = ts.WatchLogLevel || (ts.WatchLogLevel = {})); |
| 115612 | function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo) { |
| 115613 | ts.setSysLog(watchLogLevel === WatchLogLevel.Verbose ? log : ts.noop); |
| 115614 | var plainInvokeFactory = { |
| 115615 | watchFile: function (file, callback, pollingInterval, options) { return host.watchFile(file, callback, pollingInterval, options); }, |
| 115616 | watchDirectory: function (directory, callback, flags, options) { return host.watchDirectory(directory, callback, (flags & 1 /* WatchDirectoryFlags.Recursive */) !== 0, options); }, |
| 115617 | }; |
| 115618 | var triggerInvokingFactory = watchLogLevel !== WatchLogLevel.None ? |
| 115619 | { |
| 115620 | watchFile: createTriggerLoggingAddWatch("watchFile"), |
| 115621 | watchDirectory: createTriggerLoggingAddWatch("watchDirectory") |
| 115622 | } : |
| 115623 | undefined; |
| 115624 | var factory = watchLogLevel === WatchLogLevel.Verbose ? |
| 115625 | { |
| 115626 | watchFile: createFileWatcherWithLogging, |
| 115627 | watchDirectory: createDirectoryWatcherWithLogging |
| 115628 | } : |
| 115629 | triggerInvokingFactory || plainInvokeFactory; |
| 115630 | var excludeWatcherFactory = watchLogLevel === WatchLogLevel.Verbose ? |
| 115631 | createExcludeWatcherWithLogging : |
| 115632 | ts.returnNoopFileWatcher; |
| 115633 | return { |
| 115634 | watchFile: createExcludeHandlingAddWatch("watchFile"), |
| 115635 | watchDirectory: createExcludeHandlingAddWatch("watchDirectory") |
| 115636 | }; |
| 115637 | function createExcludeHandlingAddWatch(key) { |
| 115638 | return function (file, cb, flags, options, detailInfo1, detailInfo2) { |
| 115639 | var _a; |
| 115640 | return !ts.matchesExclude(file, key === "watchFile" ? options === null || options === void 0 ? void 0 : options.excludeFiles : options === null || options === void 0 ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) === null || _a === void 0 ? void 0 : _a.call(host)) || "") ? |
| 115641 | factory[key].call(/*thisArgs*/ undefined, file, cb, flags, options, detailInfo1, detailInfo2) : |
| 115642 | excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2); |
| 115643 | }; |
| 115644 | } |
| 115645 | function useCaseSensitiveFileNames() { |
| 115646 | return typeof host.useCaseSensitiveFileNames === "boolean" ? |
| 115647 | host.useCaseSensitiveFileNames : |
| 115648 | host.useCaseSensitiveFileNames(); |
| 115649 | } |
| 115650 | function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) { |
| 115651 | log("ExcludeWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); |
| 115652 | return { |
| 115653 | close: function () { return log("ExcludeWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); } |
| 115654 | }; |
| 115655 | } |
| 115656 | function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) { |
| 115657 | log("FileWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); |
| 115658 | var watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2); |
| 115659 | return { |
| 115660 | close: function () { |
| 115661 | log("FileWatcher:: Close:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo))); |
| 115662 | watcher.close(); |
| 115663 | } |
| 115664 | }; |
| 115665 | } |
| 115666 | function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) { |
| 115667 | var watchInfo = "DirectoryWatcher:: Added:: ".concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); |
| 115668 | log(watchInfo); |
| 115669 | var start = ts.timestamp(); |
nothing calls this directly
no test coverage detected