Make getScriptSnapshot match/call setSnapshot. Previously, a this.fileNames.add call was added to setSnapshot but not getScriptSnapshot, causing a Could not find source file error.
Fixes #271
Details
the fileNames Set that was previously introduced in the fix for #95 (this line in the commit) caused a regression during watch mode
this is because setSnapshot was updated to call this.fileNames.add, but getScriptSnapshot was not
instead of updating both to be the same, we can just call setSnapshot from getScriptSnapshot as this code is supposed to be identical
also rename data -> source for consistency and clarity (source is a more specific name)
Summary
Make
getScriptSnapshot
match/callsetSnapshot
. Previously, athis.fileNames.add
call was added tosetSnapshot
but notgetScriptSnapshot
, causing aCould not find source file
error.Details
fileNames
Set that was previously introduced in the fix for #95 (this line in the commit) caused a regression during watch modesetSnapshot
was updated to callthis.fileNames.add
, butgetScriptSnapshot
was notsetSnapshot
fromgetScriptSnapshot
as this code is supposed to be identicaldata
->source
for consistency and clarity (source
is a more specific name)See https://github.com/ezolenko/rollup-plugin-typescript2/issues/271#issuecomment-1163625864 and my other comment above it for a root cause analysis.