Skip to content

Commit

Permalink
Merge branch 'main' into streaming-on-cloudflare-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusMorton committed Jan 26, 2023
2 parents da97431 + 98d35de commit e27a812
Show file tree
Hide file tree
Showing 57 changed files with 149 additions and 87 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-cherries-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a dev server edge case where prerender + getStaticPaths would not 404 on an unmatched route
5 changes: 5 additions & 0 deletions .changeset/fresh-eels-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/react': patch
---

Support passing `children` as props to a React component
5 changes: 5 additions & 0 deletions .changeset/serious-turtles-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

improve error message: change @astrojs/solid to @astrojs/solid-js
5 changes: 0 additions & 5 deletions .changeset/silly-bees-impress.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/strong-hotels-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Add type guard support to filters on `getCollection()`
5 changes: 5 additions & 0 deletions .changeset/ten-icons-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Astro <Code> component is not able to use a custom theme anymore
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"@astrojs/mdx": "^0.15.0",
"@astrojs/rss": "^2.1.0",
"@astrojs/sitemap": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
},
"peerDependencies": {
"astro": "^2.0.0-beta.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
},
"devDependencies": {
"@astrojs/deno": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"preact": "^10.7.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"alpinejs": "^3.10.2",
"@astrojs/alpinejs": "^0.1.2",
"@types/alpinejs": "^3.7.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"lit": "^2.2.5",
"@astrojs/lit": "^1.1.0",
"@webcomponents/template-shadowroot": "^0.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"preact": "^10.7.3",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"preact": "^10.7.3",
"@astrojs/preact": "^2.0.0",
"@preact/signals": "^1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"@astrojs/react": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"solid-js": "^1.4.3",
"@astrojs/solid-js": "^2.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"dependencies": {
"svelte": "^3.48.0",
"@astrojs/svelte": "^2.0.0",
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"vue": "^3.2.37",
"@astrojs/vue": "^2.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
},
"dependencies": {
"@astrojs/node": "^5.0.0",
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {},
"devDependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
},
"peerDependencies": {
"astro": "^2.0.0-beta.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/non-html-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"server": "node dist/server/entry.mjs"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"svelte": "^3.48.0",
"@astrojs/svelte": "^2.0.0",
"@astrojs/node": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"@astrojs/markdown-remark": "^2.0.0",
"hast-util-select": "5.0.1",
"rehype-autolink-headings": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-markdown-shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0"
"astro": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion examples/with-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"preact": "^10.6.5",
"@astrojs/preact": "^2.0.0",
"@astrojs/mdx": "^0.15.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/with-nanostores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"preact": "^10.7.3",
"@astrojs/preact": "^2.0.0",
"nanostores": "^0.5.12",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/mdx": "^0.15.0",
"@astrojs/tailwind": "^3.0.0",
"@types/canvas-confetti": "^1.4.3",
"astro": "^2.0.0",
"astro": "^2.0.1",
"autoprefixer": "^10.4.7",
"canvas-confetti": "^1.5.1",
"postcss": "^8.4.14",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vite-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"vite-plugin-pwa": "0.11.11",
"workbox-window": "^6.5.3"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/with-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "vitest"
},
"dependencies": {
"astro": "^2.0.0",
"astro": "^2.0.1",
"vitest": "^0.20.3"
}
}
12 changes: 12 additions & 0 deletions packages/astro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# astro

## 2.0.1

### Patch Changes

- [#5969](https://github.com/withastro/astro/pull/5969) [`f4c71e5eb`](https://github.com/withastro/astro/commit/f4c71e5eb937ce92cc8803d4a6e19400d22ae611) Thanks [@matthewp](https://github.com/matthewp)! - Fix usage of logger in Vercel Edge

This protects against usage of `process` global in shimmed environments.

- [#5962](https://github.com/withastro/astro/pull/5962) [`46b6e1426`](https://github.com/withastro/astro/commit/46b6e14265f81ffbf1a7511909d5a9954160b504) Thanks [@MoustaphaDev](https://github.com/MoustaphaDev)! - Fix Content Collections not loading config file when there are spaces in the folder tree

- [#5972](https://github.com/withastro/astro/pull/5972) [`02549b8ce`](https://github.com/withastro/astro/commit/02549b8ced18bf193efc407a625d908b65b3979f) Thanks [@bluwy](https://github.com/bluwy)! - Correctly detect Node.js version

## 2.0.0

> **Note**
Expand Down
1 change: 0 additions & 1 deletion packages/astro/components/Code.astro
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const highlighter = await getHighlighter({
});
const _html = highlighter.codeToHtml(code, {
lang: typeof lang === 'string' ? lang : lang.id,
theme,
});
const html = repairShikiTheme(_html);
---
Expand Down
4 changes: 3 additions & 1 deletion packages/astro/components/Shiki.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ function stringify(opts) {
*/
async function resolveHighlighter(opts) {
const resolvedThemes = [];
if (opts.theme && opts.theme in themes) {
if (Object.keys(opts.theme).length) {
resolvedThemes.push(opts.theme);
} else if (opts.theme && opts.theme in themes) {
resolvedThemes.push(await themes[opts.theme]());
}

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "2.0.0",
"version": "2.0.1",
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
"type": "module",
"author": "withastro",
Expand Down Expand Up @@ -136,7 +136,7 @@
"preferred-pm": "^3.0.3",
"prompts": "^2.4.2",
"rehype": "^12.0.1",
"semver": "^7.3.7",
"semver": "^7.3.8",
"server-destroy": "^1.0.1",
"shiki": "^0.11.1",
"slash": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/content/template/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ declare module 'astro:content' {
): E extends ValidEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
export function getCollection<C extends keyof typeof entryMap>(
export function getCollection<C extends keyof typeof entryMap, E extends CollectionEntry<C>>(
collection: C,
filter?: (data: CollectionEntry<C>) => boolean
): Promise<CollectionEntry<C>[]>;
filter?: (entry: CollectionEntry<C>) => entry is E
): Promise<E[]>;

type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
Required<ContentConfig['collections'][C]>['schema']
Expand Down
16 changes: 12 additions & 4 deletions packages/astro/src/core/logger/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,18 @@ function padStr(str: string, len: number) {

export let defaultLogLevel: LoggerLevel;
if (typeof process !== 'undefined') {
if (process.argv.includes('--verbose')) {
defaultLogLevel = 'debug';
} else if (process.argv.includes('--silent')) {
defaultLogLevel = 'silent';
// This could be a shimmed environment so we don't know that `process` is the full
// NodeJS.process. This code treats it as a plain object so TS doesn't let us
// get away with incorrect assumptions.
let proc: object = process;
if ('argv' in proc && Array.isArray(proc.argv)) {
if (proc.argv.includes('--verbose')) {
defaultLogLevel = 'debug';
} else if (proc.argv.includes('--silent')) {
defaultLogLevel = 'silent';
} else {
defaultLogLevel = 'info';
}
} else {
defaultLogLevel = 'info';
}
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function getParamsAndProps(
routeCache.set(route, routeCacheEntry);
}
const matchedStaticPath = findPathItemByKey(routeCacheEntry.staticPaths, params, route);
if (!matchedStaticPath && !ssr) {
if (!matchedStaticPath && (ssr ? mod.prerender : true)) {
return GetParamsAndPropsError.NoMatchingStaticPath;
}
// Note: considered using Object.create(...) for performance
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/runtime/server/render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ function guessRenderers(componentUrl?: string): string[] {
return ['@astrojs/vue'];
case 'jsx':
case 'tsx':
return ['@astrojs/react', '@astrojs/preact', '@astrojs/solid', '@astrojs/vue (jsx)'];
return ['@astrojs/react', '@astrojs/preact', '@astrojs/solid-js', '@astrojs/vue (jsx)'];
default:
return [
'@astrojs/react',
'@astrojs/preact',
'@astrojs/solid',
'@astrojs/solid-js',
'@astrojs/vue',
'@astrojs/svelte',
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

export default function ({ children }) {
return <div className="with-children">{children}</div>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {Research2} from '../components/Research.jsx';
import Pure from '../components/Pure.jsx';
import TypeScriptComponent from '../components/TypeScriptComponent';
import CloneElement from '../components/CloneElement';
import WithChildren from '../components/WithChildren';
const someProps = {
text: 'Hello world!',
Expand All @@ -31,5 +32,7 @@ const someProps = {
<TypeScriptComponent client:load />
<Pure />
<CloneElement />
<WithChildren client:load>test</WithChildren>
<WithChildren client:load children="test" />
</body>
</html>
Loading

0 comments on commit e27a812

Please sign in to comment.