Skip to content

Commit

Permalink
Merge branch 'withastro:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rdwz authored Jan 25, 2024
2 parents 850f316 + 57ab578 commit 3a09d06
Show file tree
Hide file tree
Showing 150 changed files with 2,468 additions and 1,047 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-dryers-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/rss": patch
---

Restores `rssSchema` to a zod object
5 changes: 5 additions & 0 deletions .changeset/breezy-plants-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes types generation from Content Collections config file
5 changes: 0 additions & 5 deletions .changeset/eight-turtles-itch.md

This file was deleted.

31 changes: 31 additions & 0 deletions .changeset/heavy-beers-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
"@astrojs/alpinejs": minor
---

Allows extending Alpine using the new `entrypoint` configuration

You can extend Alpine by setting the `entrypoint` option to a root-relative import specifier (for example, `entrypoint: "/src/entrypoint"`).

The default export of this file should be a function that accepts an Alpine instance prior to starting, allowing the use of custom directives, plugins and other customizations for advanced use cases.

```js
// astro.config.mjs
import { defineConfig } from 'astro/config';
import alpine from '@astrojs/alpinejs';

export default defineConfig({
// ...
integrations: [alpine({ entrypoint: '/src/entrypoint' })],
});
```

```js
// src/entrypoint.ts
import type { Alpine } from 'alpinejs'

export default (Alpine: Alpine) => {
Alpine.directive('foo', el => {
el.textContent = 'bar';
})
}
```
5 changes: 0 additions & 5 deletions .changeset/lemon-carrots-cheer.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/red-carrots-fail.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/selfish-donuts-approve.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/seven-kiwis-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-astro": patch
---

Fixes `@astrojs/check` and `typescript` addition to `package.json` dependencies when the user has decided not to auto-install dependencies
5 changes: 5 additions & 0 deletions .changeset/spicy-tips-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Adds telemetry for when apps are toggled in the dev toolbar. This data is completely anonymous and only the names of built-in apps are shared with us. This data will help us monitor how much the dev toolbar is used and which apps are used more. For more information on how Astro collects telemetry, visit the following page: https://astro.build/telemetry/
5 changes: 5 additions & 0 deletions .changeset/strange-students-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes environment variables replacement for `export const prerender`
5 changes: 0 additions & 5 deletions .changeset/sweet-owls-trade.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/tame-crabs-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Refactors internals of the `astro:i18n` module to be more maintainable.
5 changes: 0 additions & 5 deletions .changeset/thick-carrots-run.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/two-ducks-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/vercel": patch
---

Fixes an issue where the serverless function ignored cookies added using Astro.cookies.
66 changes: 30 additions & 36 deletions scripts/notify/index.js → .github/scripts/announce.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { globby as glob } from 'globby';
import { fileURLToPath } from 'node:url';
import { readFile } from 'node:fs/promises';
import { setOutput } from './utils.mjs';

const { GITHUB_REF = 'main' } = process.env;
const baseUrl = new URL(`https://github.com/withastro/astro/blob/${GITHUB_REF}/`);
Expand All @@ -17,34 +18,34 @@ const descriptors = [
'updates',
];
const verbs = [
'just went out!',
'just launched!',
'now available!',
'in the wild!',
'now live!',
'hit the registry!',
'to share!',
'for you!',
'for y’all! 🤠',
'comin’ your way!',
'comin’ atcha!',
'comin’ in hot!',
'freshly minted on the blockchain! (jk)',
'[is] out (now with 100% more reticulated splines!)',
'(as seen on TV!)',
'just dropped!',
'– artisanally hand-crafted just for you.',
'– oh happy day!',
'– enjoy!',
'now out. Be the first on your block to download!',
'made with love 💕',
'[is] out! Our best [version] yet!',
'[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!',
'... HUZZAH!',
'[has] landed!',
'landed! The internet just got a little more fun.',
'– from our family to yours.',
'– go forth and build!',
"just went out!",
"just launched!",
"now available!",
"in the wild!",
"now live!",
"hit the registry!",
"to share!",
"for you!",
"for y’all! 🤠",
"comin’ your way!",
"comin’ atcha!",
"comin’ in hot!",
"freshly minted on the blockchain! (jk)",
"[is] out (now with 100% more reticulated splines!)",
"(as seen on TV!)",
"just dropped!",
"– artisanally hand-crafted just for you.",
"– oh happy day!",
"– enjoy!",
"now out. Be the first on your block to download!",
"made with love 💕",
"[is] out! Our best [version] yet!",
"[is] here. DOWNLOAD! DOWNLOAD! DOWNLOAD!",
"... HUZZAH!",
"[has] landed!",
"landed! The internet just got a little more fun.",
"– from our family to yours.",
"– go forth and build!"
];
const extraVerbs = [
'new',
Expand Down Expand Up @@ -162,14 +163,7 @@ async function run() {
process.exit(1);
}
const content = await generateMessage();

await fetch(`${process.env.DISCORD_WEBHOOK}?wait=true`, {
method: 'POST',
body: JSON.stringify({ content }),
headers: {
'content-type': 'application/json',
},
});
setOutput('DISCORD_MESSAGE', content);
}

run();
59 changes: 59 additions & 0 deletions .github/scripts/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import * as fs from 'node:fs'
import * as os from 'node:os'
import * as crypto from 'node:crypto'

/** Based on https://github.com/actions/toolkit/blob/4e3b068ce116d28cb840033c02f912100b4592b0/packages/core/src/file-command.ts */
export function setOutput(key, value) {
const filePath = process.env['GITHUB_OUTPUT'] || ''
if (filePath) {
return issueFileCommand('OUTPUT', prepareKeyValueMessage(key, value))
}
process.stdout.write(os.EOL)
}

function issueFileCommand(command, message) {
const filePath = process.env[`GITHUB_${command}`]
if (!filePath) {
throw new Error(
`Unable to find environment variable for file command ${command}`
)
}
if (!fs.existsSync(filePath)) {
throw new Error(`Missing file at path: ${filePath}`)
}

fs.appendFileSync(filePath, `${toCommandValue(message)}${os.EOL}`, {
encoding: 'utf8'
})
}

function prepareKeyValueMessage(key, value) {
const delimiter = `gh-delimiter-${crypto.randomUUID()}`
const convertedValue = toCommandValue(value)

// These should realistically never happen, but just in case someone finds a
// way to exploit uuid generation let's not allow keys or values that contain
// the delimiter.
if (key.includes(delimiter)) {
throw new Error(
`Unexpected input: name should not contain the delimiter "${delimiter}"`
)
}

if (convertedValue.includes(delimiter)) {
throw new Error(
`Unexpected input: value should not contain the delimiter "${delimiter}"`
)
}

return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`
}

function toCommandValue(input) {
if (input === null || input === undefined) {
return ''
} else if (typeof input === 'string' || input instanceof String) {
return input
}
return JSON.stringify(input)
}
14 changes: 11 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ jobs:
# Needs access to publish to npm
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Generate Notification
id: notification
- name: Generate Announcement
id: message
if: steps.changesets.outputs.published == 'true'
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: node scripts/notify/index.js '${{ steps.changesets.outputs.publishedPackages }}'
run: node .github/scripts/announce.mjs '${{ steps.changesets.outputs.publishedPackages }}'

- name: Send message on Discord
if: steps.changesets.outputs.published == 'true'
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: "${{ steps.message.outputs.DISCORD_MESSAGE }}"
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": "^4.2.1"
"astro": "^4.2.4"
}
}
6 changes: 3 additions & 3 deletions examples/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^2.0.5",
"@astrojs/rss": "^4.0.2",
"@astrojs/mdx": "^2.1.0",
"@astrojs/rss": "^4.0.3",
"@astrojs/sitemap": "^3.0.5",
"astro": "^4.2.1"
"astro": "^4.2.4"
}
}
4 changes: 2 additions & 2 deletions examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"scripts": {},
"devDependencies": {
"astro": "^4.2.1"
"astro": "^4.2.4"
},
"peerDependencies": {
"astro": "^3.0.0"
"astro": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion examples/framework-alpine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"@astrojs/alpinejs": "^0.3.2",
"@types/alpinejs": "^3.13.5",
"alpinejs": "^3.13.3",
"astro": "^4.2.1"
"astro": "^4.2.4"
}
}
2 changes: 1 addition & 1 deletion examples/framework-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/lit": "^4.0.1",
"@webcomponents/template-shadowroot": "^0.2.1",
"astro": "^4.2.1",
"astro": "^4.2.4",
"lit": "^2.8.0"
}
}
2 changes: 1 addition & 1 deletion examples/framework-multiple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@astrojs/solid-js": "^4.0.1",
"@astrojs/svelte": "^5.0.3",
"@astrojs/vue": "^4.0.8",
"astro": "^4.2.1",
"astro": "^4.2.4",
"preact": "^10.19.2",
"react": "^18.2.0",
"react-dom": "^18.2.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 @@ -13,7 +13,7 @@
"dependencies": {
"@astrojs/preact": "^3.1.0",
"@preact/signals": "^1.2.1",
"astro": "^4.2.1",
"astro": "^4.2.4",
"preact": "^10.19.2"
}
}
2 changes: 1 addition & 1 deletion examples/framework-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@astrojs/react": "^3.0.9",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"astro": "^4.2.1",
"astro": "^4.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.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 @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/solid-js": "^4.0.1",
"astro": "^4.2.1",
"astro": "^4.2.4",
"solid-js": "^1.8.5"
}
}
2 changes: 1 addition & 1 deletion examples/framework-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/svelte": "^5.0.3",
"astro": "^4.2.1",
"astro": "^4.2.4",
"svelte": "^4.2.5"
}
}
2 changes: 1 addition & 1 deletion examples/framework-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/vue": "^4.0.8",
"astro": "^4.2.1",
"astro": "^4.2.4",
"vue": "^3.3.8"
}
}
2 changes: 1 addition & 1 deletion examples/hackernews/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"dependencies": {
"@astrojs/node": "^8.0.0",
"astro": "^4.2.1"
"astro": "^4.2.4"
}
}
Loading

0 comments on commit 3a09d06

Please sign in to comment.