diff --git a/.changeset/lazy-doors-watch.md b/.changeset/lazy-doors-watch.md deleted file mode 100644 index ee5d045ab..000000000 --- a/.changeset/lazy-doors-watch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -#528 Removes unused trapWarn function diff --git a/.changeset/little-bees-protect.md b/.changeset/little-bees-protect.md deleted file mode 100644 index c6fc97ebe..000000000 --- a/.changeset/little-bees-protect.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/renderer-react': patch ---- - -Add react-dom as a knownEntrypoint (speeds up astro startup) diff --git a/.changeset/old-buses-tell.md b/.changeset/old-buses-tell.md deleted file mode 100644 index 41473d671..000000000 --- a/.changeset/old-buses-tell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes livereload on static pages diff --git a/.changeset/rich-starfishes-begin.md b/.changeset/rich-starfishes-begin.md deleted file mode 100644 index 92bfd9e7c..000000000 --- a/.changeset/rich-starfishes-begin.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -'astro': minor ---- - -**This is a breaking change!** - -Astro props are now accessed from the `Astro.props` global. This change is meant to make prop definitions more ergonomic, leaning into JavaScript patterns you already know (destructuring and defaults). Astro components previously used a prop syntax borrowed from [Svelte](https://svelte.dev/docs#1_export_creates_a_component_prop), but it became clear that this was pretty confusing for most users. - -```diff - --- -+ const { text = 'Hello world!' } = Astro.props; -- export let text = 'Hello world!'; - --- - -
{text}
-``` - -[Read more about the `.astro` syntax](https://github.com/snowpackjs/astro/blob/main/docs/syntax.md#data-and-props) - ---- - -### How do I define what props my component accepts? - -Astro frontmatter scripts are TypeScript! Because of this, we can leverage TypeScript types to define the shape of your props. - -```ts ---- -export interface Props { - text?: string; -} -const { text = 'Hello world!' } = Astro.props as Props; ---- -``` - -> **Note** Casting `Astro.props as Props` is a temporary workaround. We expect our Language Server to handle this automatically soon! - -### How do I access props I haven't explicitly defined? - -One of the great things about this change is that it's straight-forward to access _any_ props. Just use `...props`! - -```ts ---- -export interface Props { - text?: string; - [attr: string]: unknown; -} -const { text = 'Hello world!', ...props } = Astro.props as Props; ---- -``` - -### What about prop validation? - -We considered building prop validation into Astro, but decided to leave that implementation up to you! This way, you can use any set of tools you like. - -```ts ---- -const { text = 'Hello world!' } = Astro.props; - -if (typeof text !== 'string') throw new Error(`Expected "text" to be of type "string" but recieved "${typeof string}"!`); ---- -``` diff --git a/.changeset/shy-cats-brake.md b/.changeset/shy-cats-brake.md deleted file mode 100644 index abeedd148..000000000 --- a/.changeset/shy-cats-brake.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'astro': patch -'@astrojs/parser': patch ---- - -Fix #521, allowing `{...spread}` props to work again diff --git a/.changeset/tiny-bobcats-warn.md b/.changeset/tiny-bobcats-warn.md deleted file mode 100644 index 5c2551264..000000000 --- a/.changeset/tiny-bobcats-warn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Bugfix: PostCSS errors in internal Snowpack PostCSS plugin diff --git a/docs-www/package.json b/docs-www/package.json index 155be2bc3..624e76e67 100644 --- a/docs-www/package.json +++ b/docs-www/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": ".." diff --git a/examples/astro-markdown/package.json b/examples/astro-markdown/package.json index 9ee9c7c98..5565b0b14 100644 --- a/examples/astro-markdown/package.json +++ b/examples/astro-markdown/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/astro-nanostores/package.json b/examples/astro-nanostores/package.json index d3248403b..51cbc2a68 100644 --- a/examples/astro-nanostores/package.json +++ b/examples/astro-nanostores/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "dependencies": { "nanostores": "^0.3.3" diff --git a/examples/blog/package.json b/examples/blog/package.json index 7e82ad650..00ec77f07 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/docs/package.json b/examples/docs/package.json index e795246d5..34ade97ce 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/kitchen-sink/package.json b/examples/kitchen-sink/package.json index 7605ca8d8..b1254eb7c 100644 --- a/examples/kitchen-sink/package.json +++ b/examples/kitchen-sink/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index f310a5b34..8267c9d20 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/snowpack/package.json b/examples/snowpack/package.json index 51b6be583..15b96b66b 100644 --- a/examples/snowpack/package.json +++ b/examples/snowpack/package.json @@ -11,7 +11,7 @@ "lint": "prettier --check \"src/**/*.js\"" }, "dependencies": { - "astro": "^0.14.1", + "astro": "^0.15.0", "date-fns": "^2.19.0", "deepmerge": "^4.2.2", "docsearch.js": "^2.6.3", @@ -25,7 +25,7 @@ "@11ty/eleventy-plugin-syntaxhighlight": "^3.0.4", "@contentful/rich-text-html-renderer": "^14.1.2", "@contentful/rich-text-types": "^14.1.2", - "astro": "^0.14.1", + "astro": "^0.15.0", "eleventy-plugin-nesting-toc": "^1.2.0", "luxon": "^1.25.0", "markdown-it": "^12.0.2", diff --git a/examples/starter/package.json b/examples/starter/package.json index ede92528d..b096d72b8 100644 --- a/examples/starter/package.json +++ b/examples/starter/package.json @@ -7,7 +7,7 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/examples/tailwindcss/package.json b/examples/tailwindcss/package.json index 710634c98..2efe251e7 100644 --- a/examples/tailwindcss/package.json +++ b/examples/tailwindcss/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "tailwindcss": "^2.1.2", - "astro": "^0.14.0" + "astro": "^0.15.0" }, "snowpack": { "workspaceRoot": "../.." diff --git a/packages/astro-parser/CHANGELOG.md b/packages/astro-parser/CHANGELOG.md index 4bc0244de..ba1d8fc36 100644 --- a/packages/astro-parser/CHANGELOG.md +++ b/packages/astro-parser/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/parser +## 0.15.0 + +### Patch Changes + +- 47ac2cc: Fix #521, allowing `{...spread}` props to work again + ## 0.13.10 ### Patch Changes diff --git a/packages/astro-parser/package.json b/packages/astro-parser/package.json index 815f2c7ad..d5c6b760f 100644 --- a/packages/astro-parser/package.json +++ b/packages/astro-parser/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/parser", - "version": "0.13.10", + "version": "0.15.0", "author": "Skypack", "license": "MIT", "type": "commonjs", diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 5a1bc1a10..87817cc9b 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,78 @@ # astro +## 0.15.0 + +### Minor Changes + +- a136c85: **This is a breaking change!** + + Astro props are now accessed from the `Astro.props` global. This change is meant to make prop definitions more ergonomic, leaning into JavaScript patterns you already know (destructuring and defaults). Astro components previously used a prop syntax borrowed from [Svelte](https://svelte.dev/docs#1_export_creates_a_component_prop), but it became clear that this was pretty confusing for most users. + + ```diff + --- + + const { text = 'Hello world!' } = Astro.props; + - export let text = 'Hello world!'; + --- + +
{text}
+ ``` + + [Read more about the `.astro` syntax](https://github.com/snowpackjs/astro/blob/main/docs/syntax.md#data-and-props) + + *** + + ### How do I define what props my component accepts? + + Astro frontmatter scripts are TypeScript! Because of this, we can leverage TypeScript types to define the shape of your props. + + ```ts + --- + export interface Props { + text?: string; + } + const { text = 'Hello world!' } = Astro.props as Props; + --- + ``` + + > **Note** Casting `Astro.props as Props` is a temporary workaround. We expect our Language Server to handle this automatically soon! + + ### How do I access props I haven't explicitly defined? + + One of the great things about this change is that it's straight-forward to access _any_ props. Just use `...props`! + + ```ts + --- + export interface Props { + text?: string; + [attr: string]: unknown; + } + const { text = 'Hello world!', ...props } = Astro.props as Props; + --- + ``` + + ### What about prop validation? + + We considered building prop validation into Astro, but decided to leave that implementation up to you! This way, you can use any set of tools you like. + + ```ts + --- + const { text = 'Hello world!' } = Astro.props; + + if (typeof text !== 'string') throw new Error(`Expected "text" to be of type "string" but recieved "${typeof string}"!`); + --- + ``` + +### Patch Changes + +- 4cd84c6: #528 Removes unused trapWarn function +- feb9a31: Fixes livereload on static pages +- 47ac2cc: Fix #521, allowing `{...spread}` props to work again +- 5629349: Bugfix: PostCSS errors in internal Snowpack PostCSS plugin +- Updated dependencies [21dc28c] +- Updated dependencies [47ac2cc] + - @astrojs/renderer-react@0.1.4 + - @astrojs/parser@0.15.0 + ## 0.14.1 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 2ba576131..5de6c9a49 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "0.14.1", + "version": "0.15.0", "author": "Skypack", "license": "MIT", "type": "module", @@ -42,10 +42,10 @@ }, "dependencies": { "@astrojs/markdown-support": "0.1.2", - "@astrojs/parser": "0.13.10", + "@astrojs/parser": "0.15.0", "@astrojs/prism": "0.2.2", "@astrojs/renderer-preact": "0.1.3", - "@astrojs/renderer-react": "0.1.3", + "@astrojs/renderer-react": "0.1.4", "@astrojs/renderer-svelte": "0.1.1", "@astrojs/renderer-vue": "0.1.3", "@babel/code-frame": "^7.12.13", diff --git a/packages/renderers/renderer-react/CHANGELOG.md b/packages/renderers/renderer-react/CHANGELOG.md index f6cd3fe4e..14ce9a64f 100644 --- a/packages/renderers/renderer-react/CHANGELOG.md +++ b/packages/renderers/renderer-react/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/renderer-react +## 0.1.4 + +### Patch Changes + +- 21dc28c: Add react-dom as a knownEntrypoint (speeds up astro startup) + ## 0.1.3 ### Patch Changes diff --git a/packages/renderers/renderer-react/package.json b/packages/renderers/renderer-react/package.json index 3e4aa493b..16383d2f2 100644 --- a/packages/renderers/renderer-react/package.json +++ b/packages/renderers/renderer-react/package.json @@ -1,6 +1,6 @@ { "name": "@astrojs/renderer-react", - "version": "0.1.3", + "version": "0.1.4", "type": "module", "exports": { ".": "./index.js", diff --git a/tools/language-server/package.json b/tools/language-server/package.json index bdd5d4baf..6fab066e4 100644 --- a/tools/language-server/package.json +++ b/tools/language-server/package.json @@ -28,7 +28,7 @@ "vscode-languageserver-textdocument": "^1.0.1" }, "devDependencies": { - "astro": "^0.14.0", + "astro": "^0.15.0", "astro-scripts": "0.0.1" } } diff --git a/tools/prettier-plugin-astro/CHANGELOG.md b/tools/prettier-plugin-astro/CHANGELOG.md index 5be144c2a..f87d9a32a 100644 --- a/tools/prettier-plugin-astro/CHANGELOG.md +++ b/tools/prettier-plugin-astro/CHANGELOG.md @@ -1,5 +1,12 @@ # prettier-plugin-astro +## 0.0.6 + +### Patch Changes + +- Updated dependencies [47ac2cc] + - @astrojs/parser@0.15.0 + ## 0.0.5 ### Patch Changes diff --git a/tools/prettier-plugin-astro/package.json b/tools/prettier-plugin-astro/package.json index d40bf92f7..fc2cb5afb 100644 --- a/tools/prettier-plugin-astro/package.json +++ b/tools/prettier-plugin-astro/package.json @@ -1,6 +1,6 @@ { "name": "prettier-plugin-astro", - "version": "0.0.5", + "version": "0.0.6", "main": "index.js", "type": "commonjs", "private": true, @@ -9,7 +9,7 @@ "build": "echo 'build'" }, "dependencies": { - "@astrojs/parser": "^0.13.3", + "@astrojs/parser": "^0.15.0", "prettier": "^2.2.1" }, "devDependencies": { diff --git a/www/package.json b/www/package.json index 1d4e1f749..297eb9c73 100644 --- a/www/package.json +++ b/www/package.json @@ -7,6 +7,6 @@ "build": "astro build" }, "devDependencies": { - "astro": "^0.14.1" + "astro": "^0.15.0" } }