* The compiled markdown by liquidjs following the remix layout system and ssred loader function
(builtLiquid: string, context)
| 72 | * The compiled markdown by liquidjs following the remix layout system and ssred loader function |
| 73 | */ |
| 74 | async transform(builtLiquid: string, context) { |
| 75 | if (!vite) { |
| 76 | vite = useVite(); |
| 77 | } |
| 78 | let [rawHtml, meta] = await compile(builtLiquid); |
| 79 | /** |
| 80 | * Initialize the page globals to make it ready for the new page. |
| 81 | * page.reloads=[] happens in middleware/router. |
| 82 | */ |
| 83 | page.meta = meta; |
| 84 | page.sources = []; |
| 85 | page.global = { |
| 86 | components: {}, |
| 87 | ssrProps: {}, |
| 88 | }; |
| 89 | page.prevHash = hashIt({ |
| 90 | components: meta.components, |
| 91 | head: meta.head, |
| 92 | }); |
| 93 | |
| 94 | const renderedHtml = await utils.render(rawHtml); |
| 95 | |
| 96 | /** |
| 97 | * Initializes the virtual point for hydrating code |
| 98 | */ |
| 99 | |
| 100 | if (Object.keys(page.global.components).length > 0) { |
| 101 | const virtualModuleId = "/" + uuid() + ".js"; |
| 102 | |
| 103 | page.meta.head.script.push({ |
| 104 | type: "module", |
| 105 | src: virtualModuleId, |
| 106 | innerHTML: undefined, |
| 107 | }); |
| 108 | |
| 109 | virtualModuleMap.set( |
| 110 | virtualModuleId, |
| 111 | await generateVirtualEntryPoint( |
| 112 | page.global.components, |
| 113 | config.vite.root, |
| 114 | isBuild, |
| 115 | utils, |
| 116 | virtualModuleId |
| 117 | ) |
| 118 | ); |
| 119 | } else { |
| 120 | page.meta.head.script.push({ |
| 121 | type: "module", |
| 122 | src: "/uno:only.js", |
| 123 | innerHTML: undefined, |
| 124 | }); |
| 125 | } |
| 126 | |
| 127 | const appHtml = appendPrelude(renderedHtml, page); |
| 128 | for (const toAdd of page.reloads.filter((p) => p.endsWith(".md"))) { |
| 129 | if (!seen.includes(toAdd)) { |
| 130 | context.server.moduleGraph.createFileOnlyEntry(toAdd); |
| 131 | seen.push(toAdd); |
nothing calls this directly
no test coverage detected