summaryrefslogtreecommitdiff
path: root/src/compiler/index.ts
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-31 16:47:03 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-31 16:47:03 -0400
commit7c10d563f2fc921ee66ee4820b85c4b871d218fd (patch)
tree3aa5259f3854f7bddaf8b6856232f1a2c88b6a18 /src/compiler/index.ts
parentd5b15a385153915cad7dbffd0d8893c39059c1ed (diff)
downloadastro-7c10d563f2fc921ee66ee4820b85c4b871d218fd.tar.gz
astro-7c10d563f2fc921ee66ee4820b85c4b871d218fd.tar.zst
astro-7c10d563f2fc921ee66ee4820b85c4b871d218fd.zip
Implements import.meta.request (#46)
This adds `import.meta.request` to pages (not components).
Diffstat (limited to 'src/compiler/index.ts')
-rw-r--r--src/compiler/index.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/index.ts b/src/compiler/index.ts
index 1afa97c87..0ba5657cd 100644
--- a/src/compiler/index.ts
+++ b/src/compiler/index.ts
@@ -1,12 +1,12 @@
import type { LogOptions } from '../logger.js';
-import type { AstroConfig } from '../@types/astro';
+import type { AstroConfig, CompileResult, TransformResult } from '../@types/astro';
import path from 'path';
import micromark from 'micromark';
import gfmSyntax from 'micromark-extension-gfm';
import matter from 'gray-matter';
import gfmHtml from 'micromark-extension-gfm/html.js';
-import { CompileResult, TransformResult } from '../@types/astro';
+
import { parse } from '../parser/index.js';
import { createMarkdownHeadersCollector } from '../micromark-collect-headers.js';
import { encodeMarkdown } from '../micromark-encode.js';
@@ -130,13 +130,12 @@ export default __render;
// triggered by loading a component directly by URL.
export async function __renderPage({request, children, props}) {
const currentChild = {
- setup: typeof setup === 'undefined' ? (passthrough) => passthrough : setup,
layout: typeof __layout === 'undefined' ? undefined : __layout,
content: typeof __content === 'undefined' ? undefined : __content,
__render,
};
- await currentChild.setup({request});
+ import.meta.request = request;
const childBodyResult = await currentChild.__render(props, children);
// find layout, if one was given.