From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- node_modules/nunjucks/bin/precompile | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 node_modules/nunjucks/bin/precompile (limited to 'node_modules/nunjucks/bin/precompile') diff --git a/node_modules/nunjucks/bin/precompile b/node_modules/nunjucks/bin/precompile new file mode 100755 index 0000000..1708235 --- /dev/null +++ b/node_modules/nunjucks/bin/precompile @@ -0,0 +1,58 @@ +#!/usr/bin/env node +var {program} = require('commander'); +var precompile = require('../src/precompile').precompile; +var Environment = require('../src/environment').Environment; +var lib = require('../src/lib'); + +var cmdpath = null; + +program + .storeOptionsAsProperties(false) + .passCommandToAction(false); + +program + .name('precompile') + .usage('[-f|--force] [-a|--filters ] [-n|--name ] [-i|--include ] [-x|--exclude ] [-w|--wrapper ] ') + .arguments('') + .helpOption('-?, -h, --help', 'Display this help message') + .option('-f, --force', 'Force compilation to continue on error') + .option('-a, --filters ', 'Give the compiler a comma-delimited list of asynchronous filters, required for correctly generating code') + .option('-n, --name ', 'Specify the template name when compiling a single file') + .option('-i, --include ', 'Include a file or folder which match the regex but would otherwise be excluded. You can use this flag multiple times', concat, ['\\.html$', '\\.jinja$']) + .option('-x, --exclude ', 'Exclude a file or folder which match the regex but would otherwise be included. You can use this flag multiple times', concat, []) + .option('-w, --wrapper ', 'Load a external plugin to change the output format of the precompiled templates (for example, "-w custom" will load a module named "nunjucks-custom")') + .action(function (path) { + cmdpath = path; + }) + .parse(process.argv); + +function concat(value, previous) { + return previous.concat(value); +} + +if (cmdpath == null) { + program.outputHelp(); + console.error('\nerror: no path given'); + process.exit(1); +} + +var env = new Environment([]); + +const opts = program.opts(); + +lib.each([].concat(opts.filters).join(',').split(','), function (name) { + env.addFilter(name.trim(), function () {}, true); +}); + +if (opts.wrapper) { + opts.wrapper = require('nunjucks-' + opts.wrapper).wrapper; +} + +console.log(precompile(cmdpath, { + env : env, + force : opts.force, + name : opts.name, + wrapper: opts.wrapper, + include : [].concat(opts.include), + exclude : [].concat(opts.exclude) +})); -- cgit v1.2.3