in src/main/java/org/apache/sling/scripting/sightly/js/impl/jsapi/SlyBindingsValuesProvider.java [252:273]
private Script loadQScript(ResourceResolver resolver) {
Context context = Context.enter();
context.initStandardObjects();
context.setOptimizationLevel(9);
Resource resource = resolver.getResource(Q_PATH);
if (resource == null) {
LOGGER.warn("Could not load Q library at path: " + Q_PATH);
return null;
}
try (InputStream reader = resource.adaptTo(InputStream.class)) {
if (reader == null) {
LOGGER.warn("Could not read content of Q library");
return null;
}
return context.compileReader(new InputStreamReader(reader, StandardCharsets.UTF_8), Q_PATH, 0, null);
} catch (IOException e) {
LOGGER.error("Unable to compile the Q library at path " + Q_PATH + ".", e);
} finally {
Context.exit();
}
return null;
}