A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/withastro/compiler below:

withastro/compiler: The Astro compiler. Written in Go. Distributed as WASM.

Astro’s Go + WASM compiler.

npm install @astrojs/compiler
Transform .astro to valid TypeScript

The Astro compiler can convert .astro syntax to a TypeScript Module whose default export generates HTML.

Some notes...

import { transform, type TransformResult } from "@astrojs/compiler";

const result = await transform(source, {
  filename: "/Users/astro/Code/project/src/pages/index.astro",
  sourcemap: "both",
  internalURL: "astro/runtime/server/index.js",
});
Parse .astro and return an AST

The Astro compiler can emit an AST using the parse method.

Some notes...

import { parse } from "@astrojs/compiler";
import { walk, is } from "@astrojs/compiler/utils";

const result = await parse(source, {
  position: false, // defaults to `true`
});

walk(result.ast, (node) => {
  // `tag` nodes are `element` | `custom-element` | `component`
  if (is.tag(node)) {
    console.log(node.name);
  }
});

A devcontainer configuration is available for use with VSCode's Remote Development extension pack and GitHub CodeSpaces.

CONTRIBUTING.md


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3