in src/React.Core/JavaScriptEnginePrecompilationUtils.cs [36:60]
public static bool TryExecuteFileWithPrecompilation(this IJsEngine engine, ICache cache,
IFileSystem fileSystem, string path, Func<string, string> scriptLoader = null)
{
EnsurePrecompilationAvailability(engine, cache);
var cacheKey = string.Format(PRECOMPILED_JS_FILE_CACHE_KEY, path);
var precompiledScript = cache.Get<IPrecompiledScript>(cacheKey);
if (precompiledScript == null)
{
var contents = scriptLoader != null ? scriptLoader(path) : fileSystem.ReadAsString(path);
precompiledScript = engine.Precompile(contents, path);
var fullPath = fileSystem.MapPath(path);
cache.Set(
cacheKey,
precompiledScript,
slidingExpiration: PRECOMPILED_JS_CACHE_ENTRY_SLIDING_EXPIRATION,
cacheDependencyFiles: new[] { fullPath }
);
}
engine.Execute(precompiledScript);
return true;
}