UNPKG

1.86 kBSource Map (JSON)View Raw
1{"version":3,"file":"akteWelcome.js","sources":["../../src/akteWelcome.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\nimport { defineAkteFiles } from \"./defineAkteFiles\";\nimport { NotFoundError } from \"./errors\";\n\n/**\n * Akte welcome page shown in development when the Akte app does not have any\n * othe Akte files registered.\n *\n * @remarks\n * The HTML code below is highlighted and uglified manually to prevent the\n * introduction of extra dependencies just for the sake of having a welcome\n * page.\n */\nexport const akteWelcome = __PRODUCTION__\n\t? null\n\t: defineAkteFiles().from({\n\t\t\tpath: \"/\",\n\t\t\tasync data() {\n\t\t\t\ttry {\n\t\t\t\t\tconst require = createRequire(path.resolve(\"index.js\"));\n\t\t\t\t\tconst aktePath = require.resolve(\"akte/package.json\");\n\t\t\t\t\tconst htmlPath = path.resolve(aktePath, \"../dist/akteWelcome.html\");\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\thtml: await fs.readFile(htmlPath, \"utf-8\"),\n\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NotFoundError(\"/\");\n\t\t\t\t}\n\t\t\t},\n\t\t\tbulkData() {\n\t\t\t\t// Never build the file\n\t\t\t\treturn {};\n\t\t\t},\n\t\t\trender(context) {\n\t\t\t\treturn context.data.html;\n\t\t\t},\n\t });\n"],"names":["require"],"mappings":";;;;;;AAiBO,MAAM,cAAc,iBACxB,OACA,gBAAA,EAAkB,KAAK;AAAA,EACvB,MAAM;AAAA,EACN,MAAM,OAAI;AACL,QAAA;AACH,YAAMA,WAAU,cAAc,KAAK,QAAQ,UAAU,CAAC;AAChD,YAAA,WAAWA,SAAQ,QAAQ,mBAAmB;AACpD,YAAM,WAAW,KAAK,QAAQ,UAAU,0BAA0B;AAE3D,aAAA;AAAA,QACN,MAAM,MAAM,GAAG,SAAS,UAAU,OAAO;AAAA,MAAA;AAAA,aAElC;AACF,YAAA,IAAI,cAAc,GAAG;AAAA,IAC3B;AAAA,EACF;AAAA,EACA,WAAQ;AAEP,WAAO;EACR;AAAA,EACA,OAAO,SAAO;AACb,WAAO,QAAQ,KAAK;AAAA,EACrB;AACC,CAAA;"}
\No newline at end of file