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AW,OAAO,KAAK,EAAU,QAEtC,EAAS,KAAM,EACjB,CAAE,MAAO,GAWP,EATc,IAAI,YAAY,YAAa,EAAI,SAAW,yBAA0B,CAClF,SAAU,EAAK,KACf,WAAY,EAAI,KAChB,aAAc,EAAI,OAClB,MAAO,EAAI,MACX,WAAW,EACX,gBAAgB,IAIpB,CAEJ,GAEJ","file":"/npm/gulp-pug-3@2.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/gulp-pug-3@2.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\r\n * gulp-pug-3 - Gulp plugin for Pug 3.x template engine\r\n * Modern, type-safe, and fully compatible with Pug 3.x\r\n */\r\n\r\nconst { Transform } = require('stream');\r\nconst PluginError = require('plugin-error');\r\nconst path = require('path');\r\nconst pug = require('pug');\r\n\r\nconst PLUGIN_NAME = 'gulp-pug-3';\r\n\r\n/**\r\n * Valid Pug 3.x compilation options (whitelist for validation)\r\n * @see https://pugjs.org/api/reference.html\r\n */\r\nconst VALID_PUG_OPTIONS = new Set([\r\n  'filename', // Name of the file being compiled (required for includes/extends)\r\n  'basedir', // Root directory for absolute includes\r\n  'doctype', // Default doctype (e.g., 'html', 'xml')\r\n  'pretty', // Deprecated in Pug 3, but still supported\r\n  'filters', // Hash of custom filters\r\n  'self', // Use 'self' namespace for locals\r\n  'debug', // Output debugging information\r\n  'compileDebug', // Include function source in compiled template for better errors\r\n  'globals', // Array of global variable names\r\n  'cache', // Enable template caching\r\n  'inlineRuntimeFunctions', // Inline runtime functions (reduces size)\r\n  'name', // Template function name (client mode)\r\n  'client', // Compile to JavaScript function string\r\n  'extension', // Output file extension (default: .html for server, .js for client)\r\n  'locals', // Template variables\r\n  'plugins' // Array of Pug plugins\r\n]);\r\n\r\n/**\r\n * Validate Pug options against whitelist\r\n * @param {Object} options - User-provided options\r\n * @throws {PluginError} If invalid option is found\r\n */\r\nfunction validateOptions(options) {\r\n  for (const key of Object.keys(options)) {\r\n    if (!VALID_PUG_OPTIONS.has(key)) {\r\n      throw new PluginError(\r\n        PLUGIN_NAME,\r\n        `Invalid Pug option: '${key}'\\nAllowed options: ${[...VALID_PUG_OPTIONS].sort().join(', ')}`\r\n      );\r\n    }\r\n  }\r\n}\r\n\r\n/**\r\n * Main plugin function\r\n * @param {Object} [options={}] - Pug compilation options\r\n * @param {boolean} [options.client=false] - Compile to client-side JavaScript function\r\n * @param {string} [options.extension] - Output file extension (default: .html or .js)\r\n * @param {Object} [options.locals={}] - Template variables\r\n * @param {string} [options.filename] - Override source filename\r\n * @param {string} [options.basedir] - Base directory for includes\r\n * @param {boolean} [options.compileDebug=false] - Include debug info\r\n * @param {Array} [options.plugins=[]] - Pug plugins\r\n * @returns {Transform} Gulp transform stream\r\n *\r\n * @example\r\n * // Server-side HTML compilation\r\n * gulp.src('src/*.pug')\r\n *   .pipe(pug({ pretty: true, locals: { title: 'My Site' } }))\r\n *   .pipe(gulp.dest('dist'))\r\n *\r\n * @example\r\n * // Client-side JS compilation\r\n * gulp.src('src/templates/*.pug')\r\n *   .pipe(pug({ client: true, name: 'myTemplate' }))\r\n *   .pipe(gulp.dest('dist/js'))\r\n */\r\nmodule.exports = function (options = {}) {\r\n  // Validate options early (fail fast)\r\n  validateOptions(options);\r\n\r\n  return new Transform({\r\n    objectMode: true,\r\n\r\n    transform(file, encoding, callback) {\r\n      // Pass through null files (e.g., empty directories in glob)\r\n      if (file.isNull()) {\r\n        return callback(null, file);\r\n      }\r\n\r\n      // Reject streaming mode (only buffer supported)\r\n      if (file.isStream()) {\r\n        return callback(\r\n          new PluginError(\r\n            PLUGIN_NAME,\r\n            'Streaming not supported. Use vinyl-buffer or gulp.src({ buffer: true }).'\r\n          )\r\n        );\r\n      }\r\n\r\n      // Handle buffer mode\r\n      if (file.isBuffer()) {\r\n        try {\r\n          // Clone options to avoid mutation\r\n          const opts = { ...options };\r\n\r\n          // Set filename (required for includes/extends/line numbers)\r\n          opts.filename = opts.filename || file.path;\r\n\r\n          // Set basedir (defaults to file directory)\r\n          if (!opts.basedir) {\r\n            opts.basedir = path.dirname(file.path);\r\n          }\r\n\r\n          // Merge locals: options.locals + file.data\r\n          // file.data takes precedence (set by gulp-data or similar)\r\n          const fileLocals = file.data && typeof file.data === 'object' ? file.data : {};\r\n          opts.locals = { ...opts.locals, ...fileLocals };\r\n\r\n          // Determine output extension\r\n          const defaultExt = opts.client ? '.js' : '.html';\r\n          const extension = (opts.extension || defaultExt).replace(/^\\.+/, '.');\r\n\r\n          // Get template source\r\n          const source = file.contents.toString('utf8');\r\n\r\n          // Compile based on mode\r\n          let compiled;\r\n          if (opts.client) {\r\n            // Client-side: compile to JavaScript function string\r\n            // Note: locals are NOT used in client mode (they're applied at runtime)\r\n            compiled = pug.compileClient(source, opts);\r\n          } else {\r\n            // Server-side: compile and render immediately\r\n            const templateFn = pug.compile(source, opts);\r\n            compiled = templateFn(opts.locals);\r\n          }\r\n\r\n          // Update file\r\n          file.path = file.path.replace(/\\.[^.]+$/, '') + extension;\r\n          file.contents = Buffer.from(compiled, 'utf8');\r\n\r\n          callback(null, file);\r\n        } catch (err) {\r\n          // Preserve original error details for debugging\r\n          const error = new PluginError(PLUGIN_NAME, err.message || 'Pug compilation failed', {\r\n            fileName: file.path,\r\n            lineNumber: err.line,\r\n            columnNumber: err.column,\r\n            stack: err.stack,\r\n            showStack: true,\r\n            showProperties: true\r\n          });\r\n\r\n          callback(error);\r\n        }\r\n      }\r\n    }\r\n  });\r\n};\r\n"]}