1 |
|
2 | var Qe=Object.create;var L=Object.defineProperty,Xe=Object.defineProperties,Ye=Object.getOwnPropertyDescriptor,Ze=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertyNames,pe=Object.getOwnPropertySymbols,tt=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var de=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,d=(e,t)=>{for(var r in t||(t={}))me.call(t,r)&&de(e,r,t[r]);if(pe)for(var r of pe(t))rt.call(t,r)&&de(e,r,t[r]);return e},P=(e,t)=>Xe(e,Ze(t)),ot=e=>L(e,"__esModule",{value:!0});var st=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of et(t))!me.call(e,o)&&o!=="default"&&L(e,o,{get:()=>t[o],enumerable:!(r=Ye(t,o))||r.enumerable});return e},u=e=>st(ot(L(e!=null?Qe(tt(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Je=u(require("fs-extra")),Ke=u(require("sade"));var it="presta",nt="0.40.7",at="Hyper minimal framework for the modern web.",lt="index.js",ct="index.d.ts",ut={presta:"cli.js"},pt={build:"node scripts/build",cloc:"pnpx cloc lib/*.ts",typecheck:"pnpx tsc --noEmit"},mt={type:"git",url:"git+ssh://git@github.com/sure-thing/presta.git"},dt="estrattonbailey",gt="MIT",ft={url:"https://github.com/sure-thing/presta/issues"},ht="https://github.com/sure-thing/presta#readme",bt={"@netlify/functions":"^0.7.2","@types/mime-types":"^2.1.0",chokidar:"^3.4.3",deepmerge:"^4.2.2",esbuild:"^0.12.28","esbuild-register":"^2.6.0",filewatcher:"^3.0.1","fs-extra":"^9.0.1","get-port":"^5.1.1",kleur:"^4.1.4","mime-types":"^2.1.31","module-alias":"^2.2.2",ms:"^2.1.2",picomatch:"^2.3.0","pocket.io":"^0.1.4","query-string":"^6.14.1","raw-body":"^2.4.1",regexparam:"^1.3.0","route-sort":"^1.0.0",sade:"^1.7.3",sirv:"^1.0.7","tiny-glob":"^0.2.9","watch-dependency-graph":"^2.6.1"},yt={"@types/fs-extra":"^9.0.12","@types/picomatch":"^2.2.4","@types/sade":"^1.7.3",proxyquire:"^2.1.3","supertest-fetch":"^1.4.3"},ge={name:it,version:nt,description:at,main:lt,types:ct,bin:ut,scripts:pt,repository:mt,author:dt,license:gt,bugs:ft,homepage:ht,dependencies:bt,devDependencies:yt};var k=u(require("kleur"));var y={PRODUCTION:"production",DEVELOPMENT:"development"};var vt={pid:process.pid,cwd:process.cwd(),env:y.PRODUCTION,debug:!1};function U(e){return global.__presta__=e,e}function F(){return global.__presta__||U(vt),global.__presta__}var w;(function(i){i.Debug="debug",i.Info="info",i.Warn="warn",i.Err="error"})(w||(w={}));var fe=[],xt={[w.Debug]:"magenta",[w.Info]:"blue",[w.Warn]:"yellow",[w.Err]:"red"};function V(e){if(process.env.TESTING)fe.push(e);else{let t=F().debug,r=F().env===y.PRODUCTION?"prod":"dev";if(!t&&e.level===w.Debug)return;console.log([k.default.gray(r),k.default[xt[e.level||"info"]](e.label),e.message,e.duration?k.default.gray("+"+e.duration):"",e.error?`
|
3 |
|
4 | ${e.error.stack||e.error}
|
5 |
|
6 | `:""].filter(Boolean).join(" "))}}function p(e){V(d({level:w.Debug},e))}function v(e){V(d({level:w.Info},e))}function C(e){V(d({level:w.Warn},e))}function g(e){V(d({level:w.Err},e))}function G(...e){process.env.TESTING?fe.push(e):console.log(...e)}function R(){process.env.TESTING||console.log("")}var be=u(require("fs")),S=u(require("path"));function he(){let e={};function t(n,...a){e[n]&&e[n].map(s=>s(...a))}function r(n,a){return e[n]=e[n]?e[n].concat(a):[a],()=>e[n].splice(e[n].indexOf(a),1)}function o(){e={}}function i(n){return e[n]||[]}return{emit:t,on:r,clear:o,listeners:i}}var ye="presta.config.js";function ve(e,{cwd:t}){return e.files&&(e.files=[].concat(e.files).map(r=>S.default.resolve(t,r))),e.output&&(e.output=S.default.resolve(t,e.output)),e.assets&&(e.assets=S.default.resolve(t,e.assets)),e}function $(e,t=!1){let r=S.default.resolve(e||ye);try{return require(r)}catch(o){return be.default.existsSync(r)&&(g({label:"error",error:o}),t&&process.exit(1)),{}}}async function xe(){return p({label:"debug",message:"config file values cleared"}),U(await O(P(d({},F()),{config:{}})))}async function O({cwd:e=process.cwd(),env:t=F().env,config:r={},cli:o={}}){r=ve(d({},r),{cwd:e}),o=ve(d({},o),{cwd:e});let i={output:S.default.resolve(e,o.output||r.output||"build"),assets:S.default.resolve(o.assets||r.assets||"public"),files:o.files&&o.files.length?o.files:r.files?[].concat(r.files):[]},n=o.port?parseInt(o.port):r.port||4e3,a=F(),s=a.events||he();s.clear();let l=U(P(d(d({},a),i),{env:t,cwd:e,port:n,debug:o.debug||F().debug,configFilepath:S.default.resolve(o.config||ye),staticOutputDir:S.default.join(i.output,"static"),functionsOutputDir:S.default.join(i.output,"functions"),functionsManifest:S.default.join(i.output,"routes.json"),events:s,hooks:{emitPostBuild(c){s.emit("postBuild",c)},onPostBuild(c){return s.on("postBuild",c)},emitBuildFile(c){s.emit("buildFile",c)},onBuildFile(c){return s.on("buildFile",c)},emitBrowserRefresh(){s.emit("browserRefresh")},onBrowserRefresh(c){return s.on("browserRefresh",c)}}}));return r.plugins&&await Promise.all(r.plugins.map(c=>{try{return c(F)}catch(m){g({label:"error",error:m})}})),p({label:"debug",message:`config created ${JSON.stringify(l)}`}),l}var Q=u(require("fs-extra")),$e=u(require("watch-dependency-graph")),Ie=u(require("chokidar")),De=u(require("picomatch"));var q=u(require("fs-extra")),oe=u(require("path")),Se=u(require("route-sort"));function we(e){for(var t=5381,r=e.length;r;)t=t*33^e.charCodeAt(--r);return(t>>>0).toString(36)}function wt(e,t){let{route:r}=require(e),o=oe.default.basename(e).split(".").reverse().slice(1).reverse().join("."),i=oe.default.join(t.functionsOutputDir,t.env===y.PRODUCTION?o+"-"+we(q.default.readFileSync(e,"utf8"))+".js":o+".js");return p({label:"debug",message:`generating ${o} lambda`}),delete require.cache[e],delete require.cache[i],q.default.outputFileSync(i,`import { wrapHandler } from 'presta';
|
7 | import * as file from '${e}';
|
8 | export const route = file.route
|
9 | export const handler = wrapHandler(file)`),[r,i]}function z(e,t){let r=e.map(n=>{try{return wt(n,t)}catch(a){return g({label:"error",error:a}),null}}).filter(Boolean),o=(0,Se.default)(r.map(n=>n[0])),i={};for(let n of o){let a=r.find(s=>s[0]===n);a&&(i[n]=a[1])}return q.default.outputFileSync(t.functionsManifest,JSON.stringify(i)),r}var se=u(require("fs-extra")),Ee=u(require("path")),Pe=u(require("tiny-glob/sync"));function T(e){return/export\s.+\sroute\s+\=/.test(se.default.readFileSync(e,"utf-8"))}function _(e){return/export\s.+\sgetStaticPaths/.test(se.default.readFileSync(e,"utf-8"))}function M(e){try{return[].concat(e.files).map(t=>(0,Pe.default)(t,{cwd:e.cwd})).flat().map(t=>Ee.default.resolve(e.cwd,t))}catch(t){return g({label:"paths",message:"no files found",error:t}),[]}}var Oe=u(require("fs-extra")),ie=u(require("path")),Te=u(require("mime-types"));function E(){let e=process.hrtime();return()=>{let[t,r]=process.hrtime(e),o=r/1e6;return t<1?(o>=1?o.toFixed(0):o.toFixed(2))+"ms":t+"."+o.toFixed(0)+"s"}}var Fe=u(require("regexparam"));function Ce(e,t){let[r]=e.split("?"),o=(0,Fe.default)(t),i=0,n={},a=o.pattern.exec(r)||[];for(;i<o.keys.length;)n[o.keys[i]]=a[++i];return n}function St(e){return typeof e=="object"?JSON.stringify(e):e}function J(e){let{isBase64Encoded:t=!1,statusCode:r=200,headers:o={},multiValueHeaders:i={},body:n="",html:a=void 0,json:s=void 0,xml:l=void 0}=typeof e=="string"?{body:e}:e,c="text/html; charset=utf-8";return s?c="application/json; charset=utf-8":l&&(c="application/xml; charset=utf-8"),{isBase64Encoded:t,statusCode:r,headers:d({"Content-Type":c},o),multiValueHeaders:i,body:St(n||a||s||l||"")}}var j={};var Re=u(require("fs-extra")),ke=u(require("path"));function H(e,t){p({label:"debug",message:`removing old static file ${e}`}),Re.default.remove(ke.default.join(t.staticOutputDir,e))}function K({port:e}){return`
|
10 | <script>
|
11 | (function (global) {
|
12 | try {
|
13 | const socketio = document.createElement('script')
|
14 | socketio.src = 'https://unpkg.com/pocket.io@0.1.4/min.js'
|
15 | socketio.onload = function init () {
|
16 | var disconnected = false
|
17 | var socket = io('http://localhost:${e}', {
|
18 | reconnectionAttempts: 3
|
19 | })
|
20 | socket.on('connect', function() { console.log('presta connected on port ${e}') })
|
21 | socket.on('refresh', function() {
|
22 | global.location.reload()
|
23 | })
|
24 | socket.on('disconnect', function() {
|
25 | disconnected = true
|
26 | })
|
27 | socket.on('reconnect_failed', function(e) {
|
28 | if (disconnected) return
|
29 | console.error("presta - connection to server on :${e} failed")
|
30 | })
|
31 | }
|
32 | document.head.appendChild(socketio)
|
33 | } catch (e) {}
|
34 | })(this);
|
35 | <\/script>
|
36 | `}function Et(e,t="html"){return ie.default.extname(e)?e:t==="html"?`${e}/index.html`:`${e}.${t}`}function N(e,t){return new Promise(async(r,o)=>{p({label:"debug",message:`rendering ${JSON.stringify(e)}`});let i=[],n=K({port:t.port});for(let a of e){let s=a.replace(t.cwd,"");try{delete require.cache[a];let l=require(a),c=await l.getStaticPaths(),m=j[a]=j[a]||[],I=[];if(!c||!c.length){C({label:"paths",message:`${s} - no paths to render`}),m.forEach(x=>H(x,t));continue}for(let x of c){let f=E(),ee={path:x,routeParameters:l.route?Ce(x,l.route):{}},b=J(await l.handler(ee,{})),B=b.headers?b.headers["Content-Type"]:"",te=B&&Te.default.extension(B)||"html",D=Et(x,te),re=b.body+(t.env===y.PRODUCTION?"":n);Oe.default.outputFileSync(ie.default.join(t.staticOutputDir,D),re,"utf-8"),i.push(D),I.push(D),v({label:"built",message:x,duration:f()})}for(let x of m)I.includes(x)||H(x,t);j[a]=I}catch(l){t.env==="development"?(g({label:"error",message:"errors detected, pausing...",error:l}),r({allGeneratedFiles:i})):(g({label:"error",error:l}),o(l));break}}r({allGeneratedFiles:i})})}function X(e,t){let r=E();z(e,t),e.length&&v({label:"built",message:"lambdas",duration:r()})}async function je(e){let t=M(e),r=Q.default.existsSync(e.configFilepath);t.length||C({label:"paths",message:"no files configured"}),X(t.filter(T),e);let o=(0,$e.default)({alias:{"@":e.cwd}}),i=Ie.default.watch(e.cwd,{ignoreInitial:!0,ignored:[e.output,e.assets]});async function n(){t=M(e),await N(t.filter(_),e),X(t.filter(T),e)}async function a(s){_(s)&&await N([s],e),T(s)&&X(t.filter(T),e),e.hooks.emitBrowserRefresh()}e.hooks.onBuildFile(({file:s})=>{a(s)}),o.on("remove",async([s])=>{p({label:"watch",message:`fileWatcher - removed ${s}`}),t.splice(t.indexOf(s),1),X(t.filter(T),e),s===e.configFilepath&&(e=await xe(),r=!1,n()),(j[s]||[]).forEach(l=>H(l,e))}),o.on("change",async([s])=>{if(p({label:"watch",message:`fileWatcher - changed ${s}`}),s===e.configFilepath){delete require.cache[e.configFilepath];try{e=await O({config:$(e.configFilepath)}),n()}catch(l){g({label:"error",error:l})}}else a(s)}),o.on("error",s=>{g({label:"error",error:s})}),i.on("all",async(s,l)=>{if(!(!/add|change/.test(s)||!Q.default.existsSync(l)||Q.default.lstatSync(l).isDirectory())&&((0,De.default)(e.files)(l)&&!t.includes(l)&&(p({label:"watch",message:`globalWatcher - add ${l}`}),t.push(l),o.add(l),a(l)),l===e.configFilepath&&!r)){p({label:"watch",message:`globalWatcher - add config file ${l}`}),o.add(e.configFilepath);try{e=await O({config:$(e.configFilepath)}),r=!0,n()}catch(c){g({label:"error",error:c})}}}),o.add(t),r&&o.add(e.configFilepath);try{t.map(require)}catch(s){g({label:"error",error:s})}}var ne=u(require("fs-extra")),Be=u(require("esbuild"));function Pt(e){try{return require(e)}catch(t){return{}}}async function _e(e){let t=E(),r=M(e),o=r.filter(_),i=r.filter(T);if(p({label:"build",message:"starting build"}),!o.length&&!i.length)C({label:"files",message:"no files were found, nothing to build"});else{let n="",a=0,s="",l="",c=await Promise.allSettled([(async()=>{if(o.length){let m=E(),{allGeneratedFiles:I}=await N(o,e);n=m(),a=I.length}})(),(async()=>{if(i.length){let m=E();z(i,e),await(0,Be.build)({entryPoints:Object.values(require(e.functionsManifest)),outdir:e.functionsOutputDir,bundle:!0,platform:"node",target:["node12"],minify:!0,allowOverwrite:!0,define:{"process.env.PRESTA_SERVERLESS_RUNTIME":"true"}}),s=m()}})(),(async()=>{if(ne.default.existsSync(e.assets)){let m=E();ne.default.copySync(e.assets,e.staticOutputDir),l=m()}})()]);if(c.find(m=>m.status==="rejected")){p({label:"build",message:"build partially failed"}),c.forEach(m=>{m.status==="rejected"&&g({label:"error",error:m.reason})}),process.exit(1);return}(n||s)&&R(),n&&v({label:"static",message:`rendered ${a} file(s)`,duration:n}),s&&v({label:"lambda",message:`compiled ${i.length} function(s)`,duration:s}),l&&v({label:"assets",message:`copied in ${l}`}),e.hooks.emitPostBuild({output:e.output,staticOutput:e.staticOutputDir,functionsOutput:e.functionsOutputDir,functionsManifest:Pt(e.functionsManifest)}),(n||s)&&(R(),v({label:"complete",message:`in ${t()}`}),R())}}var ae=u(require("fs")),Y=u(require("path")),Ue=u(require("http")),Ve=u(require("get-port")),le=u(require("sirv")),Ge=u(require("chokidar")),qe=u(require("mime-types")),ze=u(require("regexparam"));var Me=`<!-- built with presta https://npm.im/presta -->
|
37 | <!DOCTYPE html>
|
38 | <html>
|
39 | <head>
|
40 | <meta charset="UTF-8" />
|
41 | <meta name="viewport" content="width=device-width,initial-scale=1" />
|
42 | <title>404</title>
|
43 | <link
|
44 | rel="stylesheet"
|
45 | type="text/css"
|
46 | href="https://unpkg.com/svbstrate@4.1.1/dist/svbstrate.css"
|
47 | />
|
48 | </head>
|
49 | <body>
|
50 | <div class="f aic jcc" style="height: 100vh">
|
51 | <h2 class="p1" style="color: blue">404 Not Found</h2>
|
52 | </div>
|
53 | </body>
|
54 | </html>`;var He=u(require("url")),Ne=u(require("query-string")),Ae=u(require("raw-body")),We=u(require("mime-types")),Ft=/image|audio|video|application\/pdf|application\/zip|applicaton\/octet-stream/i;function Ct(e){return Boolean(e)&&Ft.test(e)}async function Le(e){var n;let t=String(e.headers["x-forwarded-for"])||e.connection.remoteAddress||"",r=(n=t.split(t.includes(".")?":":",").pop())==null?void 0:n.trim(),o=Ct(e.headers["content-type"]||""),i=e.headers["content-length"]?await(0,Ae.default)(e,{limit:"1mb",encoding:We.default.charset(e.headers["content-type"]||"")||void 0}):void 0;return{path:e.url,httpMethod:e.method,headers:P(d({},e.headers),{"client-ip":r}),multiValueHeaders:Object.keys(e.headers).reduce((a,s)=>e.headers[s]&&!e.headers[s].includes(",")?a:P(d({},a),{[s]:e.headers[s].split(",")}),{}),queryStringParameters:(0,Ne.parse)((0,He.parse)(e.url).query),body:i?new Buffer(i).toString(o?"base64":"utf8"):null,isBase64Encoded:o}}function A(e,t){let r=J(t);for(let o in t.multiValueHeaders)e.setHeader(o,String(t.multiValueHeaders[o]));for(let o in t.headers)e.setHeader(o,String(t.headers[o]));e.statusCode=r.statusCode,e.write(r.body),e.end()}function Rt(e,t){let r=Y.default.join(e,t);if(!Y.default.extname(t))try{return ae.default.readFileSync(Y.default.join(e,t,"index.html"),"utf8")}catch(o){}return ae.default.readFileSync(r,"utf8")}function kt({port:e,config:t}){let r=K({port:e}),o=t.staticOutputDir,i=t.assets;return async function(a,s){let l=E(),c=a.url;p({label:"debug",message:`attempting to serve user static asset ${c}`}),(0,le.default)(i,{dev:!0})(a,s,()=>{p({label:"debug",message:`attempting to serve generated static asset ${c}`}),(0,le.default)(o,{dev:!0})(a,s,async()=>{try{delete require.cache[t.functionsManifest];let m=require(t.functionsManifest),x=Object.keys(m).map(f=>({matcher:(0,ze.default)(f),route:f})).filter(({matcher:f})=>f.pattern.test(c.split("?")[0])).map(({route:f})=>m[f])[0];if(x){p({label:"debug",message:`attempting to render lambda for ${c}`});let{handler:f}=require(x),ee=await Le(a),b=await f(ee,{}),B=b.headers||{},te=b.statusCode>299&&b.statusCode<399,D=B["Content-Type"],re=D?qe.default.extension(D):"html";v({label:"serve",message:`${b.statusCode} ${te?B.Location:c}`,duration:l()}),A(s,{statusCode:b.statusCode,headers:b.headers,multiValueHeaders:b.multiValueHeaders,body:re==="html"?(b.body||"").split("</body>")[0]+r:b.body})}else{p({label:"debug",message:`attempting to render static 404.html page for ${c}`});try{let f=Rt(o,"404")+r;C({label:"serve",message:`404 ${c}`,duration:l()}),A(s,{statusCode:404,body:f})}catch(f){f.message.includes("ENOENT")||console.error(f),p({label:"debug",message:`rendering default 404 HTML page for ${c}`}),C({label:"serve",message:`404 ${c}`,duration:l()}),A(s,{statusCode:404,body:Me+r})}}}catch(m){p({label:"debug",message:`rendering default 500 HTML page for ${c}`}),g({label:"serve",message:`500 ${c}`,error:m,duration:l()}),A(s,{statusCode:500,body:""+r})}})})}}async function ce(e){let t=await(0,Ve.default)({port:e.port}),r=Ue.default.createServer(kt({port:t,config:e})).listen(t),o=require("pocket.io")(r,{serveClient:!1});return e.hooks.onBrowserRefresh(()=>{p({label:"debug",message:"refresh event received"}),o.emit("refresh")}),Ge.default.watch(e.assets,{ignoreInitial:!0}).on("all",()=>{e.hooks.emitBrowserRefresh()}),{port:t}}var W=(0,Ke.default)("presta"),Z="presta.config.js";function ue(e={}){require("module-alias").addAliases({"@":process.cwd(),"presta:internal":__dirname}),require("esbuild-register/dist/node").register(e)}W.version(ge.version).option("--config, -c",`Path to a config file. (default ${Z})`).option("--output, -o","Specify output directory for built files. (default ./build)").option("--assets, -a","Specify static asset directory. (default ./public)").option("--debug, -d","Enable debug mode (prints more logs)").example("dev index.jsx -o dist").example("dev 'pages/*.tsx' -o static").example("'pages/*.tsx'").example("-c site.json").example("serve -p 8080");W.command("build","Build project to output directory.",{default:!0}).example("").example("files/**/*.js").example(`-c ${Z}`).action(async e=>{ue(),console.clear();let t=await O({env:y.PRODUCTION,config:$(e.config,!0),cli:P(d({},e),{files:e._})});Je.default.emptyDirSync(t.output),G(`${k.default.blue("presta build")}`),R(),await _e(t)});W.command("dev","Start Presta dev server and watch files",{alias:"watch"}).option("--port, -p","Port to run the local server. (default 4000)").option("--no-serve, -n","Do not run local dev server. (default false)").describe("Watch project and build to output directory.").example("dev").example("dev ./files/**/*.js").example("dev ./files/**/*.js -o ./out").example(`dev -c ${Z}`).action(async e=>{ue(),console.clear();let t=await O({env:y.DEVELOPMENT,config:$(e.config),cli:P(d({},e),{files:e._})});if(e.n)v({label:"dev"}),R();else{let r=await ce(t);G(`${k.default.blue("presta dev")} - http://localhost:${r.port}`),R()}je(t)});W.command("serve").option("--port, -p","Port to run the local server. (default 4000)").describe("Serve built files, lambdas, and static assets.").example("serve").example("serve -o ./out -p 8080").example(`serve -c ${Z}`).action(async e=>{ue(),console.clear();let t=await O({env:y.PRODUCTION,config:$(e.config),cli:e}),r=await ce(t);G(`${k.default.blue("presta serve")} - http://localhost:${r.port}`),R()});W.parse(process.argv);
|
55 | //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsibGliL2NsaS50cyIsICJsaWIvbG9nLnRzIiwgImxpYi9jb25zdGFudHMudHMiLCAibGliL2N1cnJlbnRQcmVzdGFJbnN0YW5jZS50cyIsICJsaWIvY29uZmlnLnRzIiwgImxpYi9jcmVhdGVFbWl0dGVyLnRzIiwgImxpYi93YXRjaC50cyIsICJsaWIvb3V0cHV0TGFtYmRhcy50cyIsICJsaWIvaGFzaENvbnRlbnQudHMiLCAibGliL2dldEZpbGVzLnRzIiwgImxpYi9yZW5kZXJTdGF0aWNFbnRyaWVzLnRzIiwgImxpYi90aW1lci50cyIsICJsaWIvZ2V0Um91dGVQYXJhbXMudHMiLCAibGliL25vcm1hbGl6ZVJlc3BvbnNlLnRzIiwgImxpYi9idWlsdFN0YXRpY0ZpbGVzLnRzIiwgImxpYi9yZW1vdmVCdWlsdFN0YXRpY0ZpbGUudHMiLCAibGliL2xpdmVSZWxvYWRTY3JpcHQudHMiLCAibGliL2J1aWxkLnR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nQoJ3NjcmlwdCcpXG4gICAgICAgICAgc29ja2V0aW8uc3JjID0gJ2h0dHBzOi8vdW5wa2cuY29tL3BvY2tldC5pb0AwLjEuNC9taW4uanMnXG4gICAgICAgICAgc29ja2V0aW8ub25sb2FkID0gZnVuY3Rpb24gaW5pdCAoKSB7XG4gICAgICAgICAgICB2YXIgZGlzY29ubmVjdGVkID0gZmFsc2VcbiAgICAgICAgICAgIHZhciBzb2NrZXQgPSBpbygnaHR0cDovL2xvY2FsaG9zdDoke3BvcnR9Jywge1xuICAgICAgICAgICAgICByZWNvbm5lY3Rpb25BdHRlbXB0czogM1xuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIHNvY2tldC5vbignY29ubmVjdCcsIGZ1bmN0aW9uKCkgeyBjb25zb2xlLmxvZygncHJlc3RhIGNvbm5lY3RlZCBvbiBwb3J0ICR7cG9ydH0nKSB9KVxuICAgICAgICAgICAgc29ja2V0Lm9uKCdyZWZyZXNoJywgZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgIGdsb2JhbC5sb2NhdGlvbi5yZWxvYWQoKVxuICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIHNvY2tldC5vbignZGlzY29ubmVjdCcsIGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICBkaXNjb25uZWN0ZWQgPSB0cnVlXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgc29ja2V0Lm9uKCdyZWNvbm5lY3RfZmFpbGVkJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICBpZiAoZGlzY29ubmVjdGVkKSByZXR1cm5cbiAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihcInByZXN0YSAtIGNvbm5lY3Rpb24gdG8gc2VydmVyIG9uIDoke3BvcnR9IGZhaWxlZFwiKVxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9XG4gICAgICAgICAgZG9jdW1lbnQuaGVhZC5hcHBlbmRDaGlsZChzb2NrZXRpbylcbiAgICAgICAgfSBjYXRj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plY3QudmFsdWVzKHJlcXVpcmUoY29uZmlnLmZ1bmN0aW9uc01hbmlmZXN0KSksXG4gICAgICAgICAgICBvdXRkaXI6IGNvbmZpZy5mdW5jdGlvbnNPdXRwdXREaXIsXG4gICAgICAgICAgICBidW5kbGU6IHRydWUsXG4gICAgICAgICAgICBwbGF0Zm9ybTogJ25vZGUnLFxuICAgICAgICAgICAgdGFyZ2V0OiBbJ25vZGUxMiddLFxuICAgICAgICAgICAgbWluaWZ5OiB0cnVlLFxuICAgICAgICAgICAgYWxsb3dPdmVyd3JpdGU6IHRydWUsXG4gICAgICAgICAgICBkZWZpbmU6IHtcbiAgICAgICAgICAgICAgJ3Byb2Nlc3MuZW52LlBSRVNUQV9TRVJWRVJMRVNTX1JVTlRJTUUnOiAndHJ1ZScsXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0pXG5cbiAgICAgICAgICBkeW5hbWljVGltZSA9IHRpbWUoKVxuICAgICAgICB9XG4gICAgICB9KSgpLFxuICAgICAgKGFzeW5jICgpID0+IHtcbiAgICAgICAgaWYgKGZzLmV4aXN0c1N5bmMoY29uZmlnLmFzc2V0cykpIHtcbiAgICAgICAgICBjb25zdCB0aW1lID0gdGltZXIoKVxuXG4gICAgICAgICAgZnMuY29weVN5bmMoY29uZmlnLmFzc2V0cywgY29uZmlnLnN0YXRpY091dHB1dERpcilcblxuICAgICAgICAgIGNvcHlUaW1lID0gdGltZSgpXG4gICAgICAgIH1cbiAgICAgIH0pKCksXG4gICAgXSlcblxuICAgIC8vIHNpbmNlIHdlJ3JlIGJ1aWxkaW5nIChub3Qgd2F0Y2gpIGlmIGFueSB0YXNrIGZhaWxzLCBleGl0IHdpdGggZXJyb3JcbiAgICBpZiAodGFza3MuZmluZCgodGFzaykgPT4gdGFzay5zdGF0dXMgPT09ICdyZWplY3RlZCcpKSB7XG4gICAgICBsb2dnZXIuZGVidWcoe1xuICAgICAgICBsYWJlbDogJ2J1aWxkJyxcbiAgICAgICAgbWVzc2FnZTog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OiByZXNwb25zZS5tdWx0aVZhbHVlSGVhZGVycyxcbiAgICAgICAgICAgICAgLy8gb25seSBodG1sIGNhbiBiZSBsaXZlLXJlbG9hZGVkLCBkdWhcbiAgICAgICAgICAgICAgYm9keTogZXh0ID09PSAnaHRtbCcgPyAocmVzcG9uc2UuYm9keSB8fCAnJykuc3BsaXQoJzwvYm9keT4nKVswXSArIGRldkNsaWVudCA6IHJlc3BvbnNlLmJvZHksXG4gICAgICAgICAgICB9KVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBsb2dnZXIuZGVidWcoe1xuICAgICAgICAgICAgICBsYWJlbDogJ2RlYnVnJyxcbiAgICAgICAgICAgICAgbWVzc2FnZTogYGF0dGVtcHRpbmcgdG8gcmVuZGVyIHN0YXRpYyA0MDQuaHRtbCBwYWdlIGZvciAke3VybH1gLFxuICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgLypcbiAgICAgICAgICAgICAqIFRyeSB0byBmYWxsIGJhY2sgdG8gYSBzdGF0aWMgNDA0IHBhZ2VcbiAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgY29uc3QgZmlsZSA9IHJlc29sdmVIVE1MKHN0YXRpY0RpciwgJzQwNCcpICsgZGV2Q2xpZW50XG5cbiAgICAgICAgICAgICAgbG9nZ2VyLndhcm4oe1xuICAgICAgICAgICAgICAgIGxhYmVsOiAnc2VydmUnLFxuICAgICAgICAgICAgICAgIG1lc3NhZ2U6IGA0MDQgJHt1cmx9YCxcbiAgICAgICAgICAgICAgICBkdXJhdGlvbjogdGltZSgpLFxuICAgICAgICAgICAgICB9KVxuXG4gICAgICAgICAgICAgIHNlbmRTZXJ2ZXJsZXNzUmVzcG9uc2UocmVzLCB7XG4gICAgICAgICAgICAgICAgc3RhdHVzQ29kZTogNDA0LFxuICAgICAgICAgICAgICAgIGJvZHk6IGZpbGUsXG4gICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgIGlmICghKGUgYXMgRXJyb3IpLm1lc3NhZ2UuaW5jbHVkZXMoJ0VOT0VOVCcpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5lcnJvcihlKVxuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgbG9nZ2VyLmRlYnVnKHtcbiAgICAgICAgICAgICAgICBsYWJlbDogJ2RlYnVnJyxcbiAgICAgICAgICAgICAgICBtZXNzYWdlOiBgcmVuZGVyaW5nIGRlZmF1bHQgNDA0IEhUTUwgcGFnZSBmb3IgJHt1cmx9YCxcbiAgICAgICAgICAgICAgfSlcblxuICAgICAgICAgICAgICBsb2dnZXIud2Fybih7XG4gICAgICAgICAgICAgICAgbGFiZWw6ICdzZXJ2ZScsXG4gICAgICAgICAgICAgICAgbWVzc2FnZTogYDQwNCAke3VybH1gLFxuICAgICAgICAgICAgICAgIGR1cmF0aW9uOiB0aW1lKCksXG4gICAgICAgICAgICAgIH0pXG5cbiAgICAgICAgICAgICAgc2VuZFNlcnZlcmxlc3NSZXNwb25zZShyZXMsIHtcbiAgICAgICAgICAgICAgICBzdGF0dXNDb2RlOiA0MDQsXG4gICAgICAgICAgICAgICAgYm9keTogZGVmYXVsdDQwNCArIGRldkNsaWVudCxcbiAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICBsb2dnZXIuZGVidWcoe1xuICAgICAgICAgICAgbGFiZWw6ICdkZWJ1ZycsXG4gICAgICAgICAgICBtZXNzYWdlOiBgcmVuZGVyaW5nIGRlZmF1bHQgNTAwIEhUTUwgcGFnZSBmb3IgJHt1cmx9YCxcbiAgICAgICAgICB9KVxuXG4gICAgICAgICAgbG9nZ2VyLmVycm9yKHtcbiAgICAgICAgICAgIGxhYmVsOiAnc2VydmUnLFxuICAgICAgICAgICAgbWVzc2FnZTogYDUwMCAke3VybH1gL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