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qBACR,QAAQ,sBACR,QAAQ,qBACR,QAAQ,sBACR,QAAQ","file":"/npm/server@1.0.42/server.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/server@1.0.42/server.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// server for Node.js (https://serverjs.io/)\n// A simple and powerful server for Node.js.\n\n// Internal modules\nconst config = require('./src/config');\nconst router = require('./router');\nconst reply = require('./reply');\nconst join = require('./src/join/index.js');\nconst modern = require('./src/modern');\n\n// Create a context per-request\nconst context = (self, req, res) => Object.assign(req, self, { req, res });\n\n// Get the functions from the plugins for a special point\nconst hook = (ctx, name) => ctx.plugins.map(p => p[name]).filter(p => p);\n\n\n\n// Main function\nconst Server = async (...middle) => {\n\n  // Initialize the global context\n  const ctx = {};\n\n  // First parameter can be:\n  // - options: Number || Object (cannot be ID'd)\n  // - middleware: undefined || null || Boolean || Function || Array\n  const opts = (\n    typeof middle[0] === 'undefined' ||\n    typeof middle[0] === 'boolean' ||\n    typeof middle[0] === 'string' ||\n    middle[0] === null ||\n    middle[0] instanceof Function ||\n    middle[0] instanceof Array\n  ) ? {} : middle.shift();\n\n  // Set the options for the context of Server.js\n  ctx.options = await config(opts, module.exports.plugins);\n\n  // Only enabled plugins through the config\n  ctx.plugins = module.exports.plugins.filter(p => ctx.options[p.name]);\n\n  ctx.utils = { modern: modern };\n  ctx.modern = modern;\n\n  // All the init beforehand\n  for (let init of hook(ctx, 'init')) {\n    await init(ctx);\n  }\n\n\n\n  // PLUGIN middleware\n  ctx.middle = join(hook(ctx, 'before'), middle, hook(ctx, 'after'));\n\n  // Main thing here\n  ctx.app.use((req, res) => ctx.middle(context(ctx, req, res)));\n\n\n\n  // Different listening methods\n  await Promise.all(hook(ctx, 'listen').map(listen => listen(ctx)));\n\n  // After launching it (already proxified)\n  for (let launch of hook(ctx, 'launch')) {\n    await launch(ctx);\n  }\n\n  return ctx;\n};\n\nmodule.exports = Server;\nmodule.exports.router = router;\nmodule.exports.reply = reply;\nmodule.exports.utils = {\n  modern: modern\n};\nmodule.exports.plugins = [\n  require('./plugins/log'),\n  require('./plugins/express'),\n  require('./plugins/parser'),\n  require('./plugins/static'),\n  require('./plugins/socket'),\n  require('./plugins/session'),\n  require('./plugins/security'),\n  require('./plugins/favicon'),\n  require('./plugins/compress'),\n  require('./plugins/final')\n];\n"]}