{"size": 482, "ext": "js", "max_stars_repo_path": "src/lib/precompile/precompile-to-local-var.js", "max_stars_repo_name": "BonnierNews/nunjucks-loader", "max_stars_repo_stars_event_min_datetime": "2019-12-20T14:43:25.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-08T05:48:00.000Z", "max_issues_repo_path": "src/lib/precompile/precompile-to-local-var.js", "max_issues_repo_name": "ogonkov/nunjucks-loader", "max_issues_repo_issues_event_min_datetime": "2019-07-20T23:17:44.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-11T04:56:19.000Z", "max_forks_repo_path": "src/lib/precompile/precompile-to-local-var.js", "max_forks_repo_name": "BonnierNews/nunjucks-loader", "max_forks_repo_forks_event_min_datetime": "2019-12-10T11:50:09.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-28T13:03:17.000Z"}
{"max_stars_count": 22, "max_issues_count": 47, "max_forks_count": 8, "avg_line_length": 25.3684210526, "max_line_length": 73, "alphanum_fraction": 0.6825726141}
import nunjucks from 'nunjucks';

import {localVarWrapper as precompileWrapper} from './local-var-wrapper';


/**
 * @param {string}      source
 * @param {string}      fileName
 * @param {nunjucks.Environment} env
 * @returns {string} Precompiled template, assigned to given `fileName`
 */
export function precompileToLocalVar(source, fileName, env) {
    return nunjucks.precompileString(source, {
        env,
        name: fileName,
        wrapper: precompileWrapper
    });
}
