Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/little-spoons-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@astrojs/compiler": major
---

Removes the first argument of `$$result.createAstro()`

`$$result.createAstro()` does not accept an `AstroGlobalPartial` as the first argument anymore:

```diff
-const Astro = $$result.createAstro($$Astro, $$props, $$slots);
+const Astro = $$result.createAstro($$props, $$slots);
```
8 changes: 0 additions & 8 deletions .changeset/pre.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [{ module
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

// Component Imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

interface MarkdownFrontmatter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$maybeRenderHead($$result)}<div class:list="something"${$$spreadAttributes(Astro.props)}></div>`;
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/class_with_spread.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$maybeRenderHead($$result)}<div class="something"${$$spreadAttributes(Astro.props)}></div>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata("/projects/app/src/components/RenderN
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$RenderNode = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$RenderNode;

return $$render`${($$render`${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render`${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render`${$$unescapeHTML(`<${Node.tag} ${stringifyAttributes(Node.attributes)}>`)}`,})}${Node.children.map((child) => ($$render`${$$renderComponent($$result,'Astro.self',Astro.self,{"node":(child)})}`))}${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render`${$$unescapeHTML(`</${Node.tag}>`)}`,})}`,})}`)}`;
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/complex_table.snap
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`<html lang="en">
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/dynamic_import.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(async ($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

const markdownDocs = await Astro.glob('../markdown/*.md')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$renderComponent($$result,'Layout',Layout,{"title":"Welcome to Astro."},{"default": () => $$render`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$renderComponent($$result,'Layout',Layout,{"title":"Welcome to Astro."},{"default": () => $$render`
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/import.meta.env.snap
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function getStaticPaths() {
});
}
const $$Component = $$createComponent(async ($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

const { product } = Astro.props;
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/nested_expressions.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$maybeRenderHead($$result)}<article>${(previous || next) && $$render`<aside>${previous && $$render`<div>Previous Article: <a rel="prev"${$$addAttribute(new URL(previous.link, Astro.site).pathname, "href")}>${previous.text}</a></div>`}${next && $$render`<div>Next Article: <a rel="next"${$$addAttribute(new URL(next.link, Astro.site).pathname, "href")}>${next.text}</a></div>`}</aside>`}</article>`;
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/nested_expressions_II.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$maybeRenderHead($$result)}<article>${(previous || next) && $$render`<aside>${previous && $$render`<div>Previous Article: <a rel="prev"${$$addAttribute(new URL(previous.link, Astro.site).pathname, "href")}>${previous.text}</a></div>`} ${next && $$render`<div>Next Article: <a rel="next"${$$addAttribute(new URL(next.link, Astro.site).pathname, "href")}>${next.text}</a></div>`}</aside>`}</article>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$maybeRenderHead($$result)}<div${$$spreadAttributes(Astro.props,undefined,{"class":"astro-XXXX"})}></div>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${$$maybeRenderHead($$result)}<div${$$spreadAttributes(Astro.props)}></div>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

const { title, footnotes, tables } = Astro.props;
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/__printer_js__/ternary_layout.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const $$metadata = $$createMetadata(import.meta.url, { modules: [], hydra
const $$Astro = $$createAstro('https://astro.build');
const Astro = $$Astro;
const $$Component = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
const Astro = $$result.createAstro($$props, $$slots);
Astro.self = $$Component;

return $$render`${toggleError ? $$render`${$$renderComponent($$result,'BaseLayout',BaseLayout,{},{"default": () => $$render`${$$maybeRenderHead($$result)}<h1>SITE: ${Astro.site}</h1>`,})}` : $$render`${$$renderComponent($$result,'Fragment',Fragment,{},{"default": () => $$render`<h1>SITE: ${Astro.site}</h1>`,})}`}`;
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (p *printer) printFuncPrelude(opts transform.TransformOptions, printAstroGl
p.println(fmt.Sprintf("const %s = %s(%s(%s, $$props, %s) => {", componentName, CREATE_COMPONENT, p.getAsyncFuncPrefix(), RESULT, SLOTS))
if printAstroGlobal {
p.addNilSourceMapping()
p.println(fmt.Sprintf("const Astro = %s.createAstro($$Astro, $$props, %s);", RESULT, SLOTS))
p.println(fmt.Sprintf("const Astro = %s.createAstro($$props, %s);", RESULT, SLOTS))
p.addNilSourceMapping()
p.println(fmt.Sprintf("Astro.self = %s;", componentName))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/printer/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var INTERNAL_IMPORTS = fmt.Sprintf("import {\n %s\n} from \"%s\";\n", strings.J
}, ",\n "), "http://localhost:3000/")
var PRELUDE = fmt.Sprintf(`const $$Component = %s(($$result, $$props, %s) => {`, CREATE_COMPONENT, SLOTS)
var PRELUDE_WITH_ASYNC = fmt.Sprintf(`const $$Component = %s(async ($$result, $$props, %s) => {`, CREATE_COMPONENT, SLOTS)
var PRELUDE_ASTRO_GLOBAL = fmt.Sprintf(`const Astro = $$result.createAstro($$Astro, $$props, %s);
var PRELUDE_ASTRO_GLOBAL = fmt.Sprintf(`const Astro = $$result.createAstro($$props, %s);
Astro.self = $$Component;`, SLOTS)
var RETURN = fmt.Sprintf("return %s%s", TEMPLATE_TAG, BACKTICK)
var SUFFIX = fmt.Sprintf("%s;", BACKTICK) + `
Expand Down
Loading