Compare commits
3 commits
main
...
chore/mirr
Author | SHA1 | Date | |
---|---|---|---|
|
4138d5eec5 | ||
|
2d4c0c8c69 | ||
|
6d5d944125 |
129 changed files with 545 additions and 986 deletions
8
.Dockerfile
Normal file
8
.Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
FROM gitpod/workspace-node
|
||||||
|
|
||||||
|
# Install latest pnpm
|
||||||
|
RUN curl -fsSL https://get.pnpm.io/install.sh | SHELL=`which bash` bash -
|
||||||
|
|
||||||
|
# Install deno in gitpod
|
||||||
|
RUN curl -fsSL https://deno.land/x/install/install.sh | sh
|
||||||
|
RUN /home/gitpod/.deno/bin/deno completions bash > /home/gitpod/.bashrc.d/90-deno && echo 'export DENO_INSTALL="/home/gitpod/.deno"' >> /home/gitpod/.bashrc.d/90-deno && echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> /home/gitpod/.bashrc.d/90-deno
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
'astro': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fixed an issue where the transitions router did not work within framework components.
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
'@astrojs/cloudflare': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fixes `AdvancedRuntime` & `DirectoryRuntime` types to work woth Cloudflare caches
|
|
|
@ -6,6 +6,10 @@ RUN npm install -g @playwright/test
|
||||||
# Install latest pnpm
|
# Install latest pnpm
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
|
# Install deno
|
||||||
|
ENV DENO_INSTALL=/usr/local
|
||||||
|
RUN curl -fsSL https://deno.land/x/install/install.sh | sh
|
||||||
|
|
||||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
&& curl -sSL https://dl.google.com/linux/direct/google-chrome-stable_current_$(dpkg --print-architecture).deb -o /tmp/chrome.deb \
|
&& curl -sSL https://dl.google.com/linux/direct/google-chrome-stable_current_$(dpkg --print-architecture).deb -o /tmp/chrome.deb \
|
||||||
&& apt-get -y install /tmp/chrome.deb
|
&& apt-get -y install /tmp/chrome.deb
|
||||||
|
|
34
.devcontainer/deno/devcontainer.json
Normal file
34
.devcontainer/deno/devcontainer.json
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"name": "Deno",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "../examples.deno.Dockerfile"
|
||||||
|
},
|
||||||
|
|
||||||
|
"workspaceFolder": "/workspaces/astro/examples/deno",
|
||||||
|
|
||||||
|
"portsAttributes": {
|
||||||
|
"4321": {
|
||||||
|
"label": "Application",
|
||||||
|
"onAutoForward": "openPreview"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"forwardPorts": [4321],
|
||||||
|
|
||||||
|
"postCreateCommand": "pnpm install && cd /workspaces/astro && pnpm run build",
|
||||||
|
|
||||||
|
"waitFor": "postCreateCommand",
|
||||||
|
|
||||||
|
"postAttachCommand": {
|
||||||
|
"Server": "pnpm start --host"
|
||||||
|
},
|
||||||
|
|
||||||
|
"customizations": {
|
||||||
|
"codespaces": {
|
||||||
|
"openFiles": ["src/pages/index.astro"]
|
||||||
|
},
|
||||||
|
"vscode": {
|
||||||
|
"extensions": ["astro-build.astro-vscode", "esbenp.prettier-vscode"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
.devcontainer/examples.deno.Dockerfile
Normal file
10
.devcontainer/examples.deno.Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
FROM mcr.microsoft.com/devcontainers/javascript-node:0-18
|
||||||
|
|
||||||
|
# Install latest pnpm
|
||||||
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
|
# Install deno
|
||||||
|
ENV DENO_INSTALL=/usr/local
|
||||||
|
RUN curl -fsSL https://deno.land/x/install/install.sh | sh
|
||||||
|
|
||||||
|
COPY example-welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
|
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
@ -133,6 +133,11 @@ jobs:
|
||||||
node-version: ${{ matrix.NODE_VERSION }}
|
node-version: ${{ matrix.NODE_VERSION }}
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
|
|
||||||
|
- name: Use Deno
|
||||||
|
uses: denoland/setup-deno@v1
|
||||||
|
with:
|
||||||
|
deno-version: v1.35.0
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
|
|
31
.github/workflows/mirror.yml
vendored
Normal file
31
.github/workflows/mirror.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
name: Mirror
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "examples/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mirror:
|
||||||
|
if: github.repository_owner == 'natemoo-re'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
name:
|
||||||
|
- basics
|
||||||
|
- blog
|
||||||
|
- minimal
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Mirror (${{ matrix.name }})
|
||||||
|
run: |
|
||||||
|
git filter-repo --path examples/${{matrix.name}}
|
||||||
|
git remote set-url origin https://github.com/natemoo-re/astro-template-${{matrix.name}}.git
|
||||||
|
git add .
|
||||||
|
git commit -m "[ci]: mirror from `withastro/astro`"
|
||||||
|
git push --force
|
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
|
@ -22,9 +22,6 @@ jobs:
|
||||||
name: Changelog PR or Release
|
name: Changelog PR or Release
|
||||||
if: ${{ github.repository_owner == 'withastro' }}
|
if: ${{ github.repository_owner == 'withastro' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
id-token: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
|
7
.github/workflows/snapshot-release.yml
vendored
7
.github/workflows/snapshot-release.yml
vendored
|
@ -19,11 +19,6 @@ jobs:
|
||||||
name: Create a snapshot release of a pull request
|
name: Create a snapshot release of a pull request
|
||||||
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!preview') }}
|
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!preview') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
id-token: write
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Check if user has admin access (only admins can publish snapshot releases)."
|
- name: "Check if user has admin access (only admins can publish snapshot releases)."
|
||||||
uses: "lannonbr/repo-permission-check-action@2.0.0"
|
uses: "lannonbr/repo-permission-check-action@2.0.0"
|
||||||
|
@ -86,8 +81,6 @@ jobs:
|
||||||
id: publish
|
id: publish
|
||||||
run: |
|
run: |
|
||||||
pnpm run release --tag next--${{ steps.getSnapshotName.outputs.result }} > publish.output.txt 2>&1
|
pnpm run release --tag next--${{ steps.getSnapshotName.outputs.result }} > publish.output.txt 2>&1
|
||||||
echo "Release complete"
|
|
||||||
cat publish.output.txt
|
|
||||||
echo ::set-output name=result::`cat publish.output.txt`
|
echo ::set-output name=result::`cat publish.output.txt`
|
||||||
env:
|
env:
|
||||||
# Needs access to publish to npm
|
# Needs access to publish to npm
|
||||||
|
|
18
.github/workflows/test-hosts.yml
vendored
18
.github/workflows/test-hosts.yml
vendored
|
@ -11,6 +11,8 @@ env:
|
||||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_TEST_ORG_ID }}
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_TEST_ORG_ID }}
|
||||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_TEST_PROJECT_ID }}
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_TEST_PROJECT_ID }}
|
||||||
VERCEL_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
|
||||||
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_TEST_SITE_ID }}
|
||||||
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TEST_AUTH_TOKEN }}
|
||||||
FORCE_COLOR: true
|
FORCE_COLOR: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -33,19 +35,21 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Build Astro
|
- name: Install Hosts CLIs
|
||||||
run: pnpm turbo build --filter astro --filter @astrojs/vercel
|
run: pnpm install --global netlify-cli vercel
|
||||||
|
|
||||||
- name: Build test project
|
- name: Deploy Vercel
|
||||||
working-directory: ./packages/integrations/vercel/test/hosted/hosted-astro-project
|
working-directory: ./packages/integrations/vercel/test/hosted/hosted-astro-project
|
||||||
run:
|
run:
|
||||||
pnpm run build
|
pnpm run build
|
||||||
|
vercel --prod --prebuilt
|
||||||
|
|
||||||
- name: Deploy to Vercel
|
- name: Deploy Netlify
|
||||||
working-directory: ./packages/integrations/vercel/test/hosted/hosted-astro-project
|
working-directory: ./packages/integrations/netlify/test/hosted/hosted-astro-project
|
||||||
run:
|
run:
|
||||||
pnpm dlx vercel --prod --prebuilt
|
pnpm run build
|
||||||
|
netlify deploy --prod
|
||||||
|
|
||||||
- name: Test
|
- name: Test both hosts
|
||||||
run:
|
run:
|
||||||
pnpm run test:e2e:hosts
|
pnpm run test:e2e:hosts
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
---
|
---
|
||||||
|
image:
|
||||||
|
file: .Dockerfile
|
||||||
# Commands to start on workspace startup
|
# Commands to start on workspace startup
|
||||||
tasks:
|
tasks:
|
||||||
- before: |
|
- before: |
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
# Convert context URL to an array
|
# Convert context URL to an array
|
||||||
mapfile -t CONTEXT_URL_ITEMS < <(echo "$GITPOD_WORKSPACE_CONTEXT_URL" | tr '/' '\n')
|
mapfile -t CONTEXT_URL_ITEMS < <(echo "$GITPOD_WORKSPACE_CONTEXT_URL" | tr '/' '\n')
|
||||||
|
|
||||||
# Install latest pnpm
|
|
||||||
curl -fsSL https://get.pnpm.io/install.sh | SHELL=`which bash` bash -
|
|
||||||
|
|
||||||
# Check if Gitpod started from a specific example directory in the repository
|
# Check if Gitpod started from a specific example directory in the repository
|
||||||
if [ "${CONTEXT_URL_ITEMS[7]}" = "examples" ]; then
|
if [ "${CONTEXT_URL_ITEMS[7]}" = "examples" ]; then
|
||||||
EXAMPLE_PROJECT=${CONTEXT_URL_ITEMS[8]}
|
EXAMPLE_PROJECT=${CONTEXT_URL_ITEMS[8]}
|
||||||
|
|
|
@ -52,6 +52,8 @@ Join us on [Discord](https://astro.build/chat) to meet other maintainers. We'll
|
||||||
| [@astrojs/svelte](packages/integrations/svelte) | [![astro version](https://img.shields.io/npm/v/@astrojs/svelte.svg?label=%20)](packages/integrations/svelte/CHANGELOG.md) |
|
| [@astrojs/svelte](packages/integrations/svelte) | [![astro version](https://img.shields.io/npm/v/@astrojs/svelte.svg?label=%20)](packages/integrations/svelte/CHANGELOG.md) |
|
||||||
| [@astrojs/vue](packages/integrations/vue) | [![astro version](https://img.shields.io/npm/v/@astrojs/vue.svg?label=%20)](packages/integrations/vue/CHANGELOG.md) |
|
| [@astrojs/vue](packages/integrations/vue) | [![astro version](https://img.shields.io/npm/v/@astrojs/vue.svg?label=%20)](packages/integrations/vue/CHANGELOG.md) |
|
||||||
| [@astrojs/lit](packages/integrations/lit) | [![astro version](https://img.shields.io/npm/v/@astrojs/lit.svg?label=%20)](packages/integrations/lit/CHANGELOG.md) |
|
| [@astrojs/lit](packages/integrations/lit) | [![astro version](https://img.shields.io/npm/v/@astrojs/lit.svg?label=%20)](packages/integrations/lit/CHANGELOG.md) |
|
||||||
|
| [@astrojs/deno](packages/integrations/deno) | [![astro version](https://img.shields.io/npm/v/@astrojs/deno.svg?label=%20)](packages/integrations/deno/CHANGELOG.md) |
|
||||||
|
| [@astrojs/netlify](packages/integrations/netlify) | [![astro version](https://img.shields.io/npm/v/@astrojs/netlify.svg?label=%20)](packages/integrations/netlify/CHANGELOG.md) |
|
||||||
| [@astrojs/node](packages/integrations/node) | [![astro version](https://img.shields.io/npm/v/@astrojs/node.svg?label=%20)](packages/integrations/node/CHANGELOG.md) |
|
| [@astrojs/node](packages/integrations/node) | [![astro version](https://img.shields.io/npm/v/@astrojs/node.svg?label=%20)](packages/integrations/node/CHANGELOG.md) |
|
||||||
| [@astrojs/vercel](packages/integrations/vercel) | [![astro version](https://img.shields.io/npm/v/@astrojs/vercel.svg?label=%20)](packages/integrations/vercel/CHANGELOG.md) |
|
| [@astrojs/vercel](packages/integrations/vercel) | [![astro version](https://img.shields.io/npm/v/@astrojs/vercel.svg?label=%20)](packages/integrations/vercel/CHANGELOG.md) |
|
||||||
| [@astrojs/cloudflare](packages/integrations/cloudflare) | [![astro version](https://img.shields.io/npm/v/@astrojs/cloudflare.svg?label=%20)](packages/integrations/cloudflare/CHANGELOG.md) |
|
| [@astrojs/cloudflare](packages/integrations/cloudflare) | [![astro version](https://img.shields.io/npm/v/@astrojs/cloudflare.svg?label=%20)](packages/integrations/cloudflare/CHANGELOG.md) |
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^1.1.1",
|
"@astrojs/mdx": "^1.1.0",
|
||||||
"@astrojs/rss": "^3.0.0",
|
"@astrojs/rss": "^3.0.0",
|
||||||
"@astrojs/sitemap": "^3.0.1",
|
"@astrojs/sitemap": "^3.0.0",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^2.0.0-beta.0"
|
"astro": "^2.0.0-beta.0"
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/alpinejs": "^0.3.1",
|
"@astrojs/alpinejs": "^0.3.0",
|
||||||
"@types/alpinejs": "^3.7.2",
|
"@types/alpinejs": "^3.7.2",
|
||||||
"alpinejs": "^3.12.3",
|
"alpinejs": "^3.12.3",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/lit": "^3.0.1",
|
"@astrojs/lit": "^3.0.0",
|
||||||
"@webcomponents/template-shadowroot": "^0.2.1",
|
"@webcomponents/template-shadowroot": "^0.2.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"lit": "^2.8.0"
|
"lit": "^2.8.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.0",
|
||||||
"@astrojs/react": "^3.0.3",
|
"@astrojs/react": "^3.0.2",
|
||||||
"@astrojs/solid-js": "^3.0.2",
|
"@astrojs/solid-js": "^3.0.1",
|
||||||
"@astrojs/svelte": "^4.0.3",
|
"@astrojs/svelte": "^4.0.2",
|
||||||
"@astrojs/vue": "^3.0.1",
|
"@astrojs/vue": "^3.0.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"preact": "^10.17.1",
|
"preact": "^10.17.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.0",
|
||||||
"@preact/signals": "^1.2.1",
|
"@preact/signals": "^1.2.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"preact": "^10.17.1"
|
"preact": "^10.17.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/react": "^3.0.3",
|
"@astrojs/react": "^3.0.2",
|
||||||
"@types/react": "^18.2.21",
|
"@types/react": "^18.2.21",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^18.2.7",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/solid-js": "^3.0.2",
|
"@astrojs/solid-js": "^3.0.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"solid-js": "^1.7.11"
|
"solid-js": "^1.7.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/svelte": "^4.0.3",
|
"@astrojs/svelte": "^4.0.2",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"svelte": "^4.2.0"
|
"svelte": "^4.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/vue": "^3.0.1",
|
"@astrojs/vue": "^3.0.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"vue": "^3.3.4"
|
"vue": "^3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.2",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ export default function createIntegration(): AstroIntegration {
|
||||||
// See the @astrojs/react integration for an example
|
// See the @astrojs/react integration for an example
|
||||||
// https://github.com/withastro/astro/blob/main/packages/integrations/react/src/index.ts
|
// https://github.com/withastro/astro/blob/main/packages/integrations/react/src/index.ts
|
||||||
},
|
},
|
||||||
'astro:build:setup': ({ pages, updateConfig }) => {
|
'astro:build:setup': ({ config, updateConfig }) => {
|
||||||
// See the @astrojs/lit integration for an example
|
// See the @astrojs/netlify integration for an example
|
||||||
// https://github.com/withastro/astro/blob/main/packages/integrations/lit/src/index.ts
|
// https://github.com/withastro/astro/blob/main/packages/integrations/netlify/src/integration-functions.ts
|
||||||
},
|
},
|
||||||
'astro:build:done': ({ dir, routes }) => {
|
'astro:build:done': ({ dir, routes }) => {
|
||||||
// See the @astrojs/partytown integration for an example
|
// See the @astrojs/partytown integration for an example
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^2.0.0-beta.0"
|
"astro": "^2.0.0-beta.0"
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
"server": "node dist/server/entry.mjs"
|
"server": "node dist/server/entry.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.2",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"html-minifier": "^4.0.0"
|
"html-minifier": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
"server": "node dist/server/entry.mjs"
|
"server": "node dist/server/entry.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.2",
|
||||||
"@astrojs/svelte": "^4.0.3",
|
"@astrojs/svelte": "^4.0.2",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"svelte": "^4.2.0"
|
"svelte": "^4.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/tailwind": "^5.0.2",
|
"@astrojs/tailwind": "^5.0.0",
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.2",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdoc": "^0.5.2",
|
"@astrojs/markdoc": "^0.5.1",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdown-remark": "^3.2.1",
|
"@astrojs/markdown-remark": "^3.2.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"hast-util-select": "^5.0.5",
|
"hast-util-select": "^5.0.5",
|
||||||
"rehype-autolink-headings": "^6.1.1",
|
"rehype-autolink-headings": "^6.1.1",
|
||||||
"rehype-slug": "^5.1.0",
|
"rehype-slug": "^5.1.0",
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^1.1.1",
|
"@astrojs/mdx": "^1.1.0",
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"preact": "^10.17.1"
|
"preact": "^10.17.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.0",
|
||||||
"@nanostores/preact": "^0.5.0",
|
"@nanostores/preact": "^0.5.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"nanostores": "^0.9.3",
|
"nanostores": "^0.9.3",
|
||||||
"preact": "^10.17.1"
|
"preact": "^10.17.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^1.1.1",
|
"@astrojs/mdx": "^1.1.0",
|
||||||
"@astrojs/tailwind": "^5.0.2",
|
"@astrojs/tailwind": "^5.0.0",
|
||||||
"@types/canvas-confetti": "^1.6.0",
|
"@types/canvas-confetti": "^1.6.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"autoprefixer": "^10.4.15",
|
"autoprefixer": "^10.4.15",
|
||||||
"canvas-confetti": "^1.6.0",
|
"canvas-confetti": "^1.6.0",
|
||||||
"postcss": "^8.4.28",
|
"postcss": "^8.4.28",
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"vite-plugin-pwa": "0.16.4",
|
"vite-plugin-pwa": "0.16.4",
|
||||||
"workbox-window": "^7.0.0"
|
"workbox-window": "^7.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.2",
|
||||||
"vitest": "^0.34.2"
|
"vitest": "^0.34.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,5 @@
|
||||||
# astro
|
# astro
|
||||||
|
|
||||||
## 3.2.4
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8638](https://github.com/withastro/astro/pull/8638) [`160d1cd75`](https://github.com/withastro/astro/commit/160d1cd755e70af1d8ec294d01dd2cb32d60db50) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - The `@astrojs/tailwind` integration now creates a `tailwind.config.mjs` file by default
|
|
||||||
|
|
||||||
- [#8767](https://github.com/withastro/astro/pull/8767) [`30de32436`](https://github.com/withastro/astro/commit/30de324361bc261956eb9fc08fe60a82ff602a9b) Thanks [@martrapp](https://github.com/martrapp)! - Revert fix #8472
|
|
||||||
|
|
||||||
[#8472](https://github.com/withastro/astro/pull/8472) caused some style files from previous pages to not be cleanly deleted on view transitions. For a discussion of a future fix for the original issue [#8144](https://github.com/withastro/astro/issues/8114) see [#8745](https://github.com/withastro/astro/pull/8745).
|
|
||||||
|
|
||||||
- [#8741](https://github.com/withastro/astro/pull/8741) [`c4a7ec425`](https://github.com/withastro/astro/commit/c4a7ec4255e7acb9555cb8bb74ea13c5fbb2ac17) Thanks [@lilnasy](https://github.com/lilnasy)! - Fixed an issue on Windows where lowercase drive letters in current working directory led to missing scripts and styles.
|
|
||||||
|
|
||||||
- [#8772](https://github.com/withastro/astro/pull/8772) [`c24f70d91`](https://github.com/withastro/astro/commit/c24f70d91601dd3a6b5a84f04d61824e775e9b44) Thanks [@martrapp](https://github.com/martrapp)! - Fix flickering during view transitions
|
|
||||||
|
|
||||||
- [#8754](https://github.com/withastro/astro/pull/8754) [`93b092266`](https://github.com/withastro/astro/commit/93b092266febfad16a48575f8eee12d5910bf071) Thanks [@bluwy](https://github.com/bluwy)! - Make CSS chunk names less confusing
|
|
||||||
|
|
||||||
- [#8776](https://github.com/withastro/astro/pull/8776) [`29cdfa024`](https://github.com/withastro/astro/commit/29cdfa024886dd581cb207586f7dfec6966bdd4e) Thanks [@martrapp](https://github.com/martrapp)! - Fix transition attributes on islands
|
|
||||||
|
|
||||||
- [#8773](https://github.com/withastro/astro/pull/8773) [`eaed844ea`](https://github.com/withastro/astro/commit/eaed844ea8f2f52e0c9caa40bb3ec7377e10595f) Thanks [@sumimakito](https://github.com/sumimakito)! - Fix an issue where HTML attributes do not render if getHTMLAttributes in an image service returns a Promise
|
|
||||||
|
|
||||||
## 3.2.3
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
- [#8747](https://github.com/withastro/astro/pull/8747) [`d78806dfe`](https://github.com/withastro/astro/commit/d78806dfe0301ea7ffe6c7c1f783bd415ac7cda9) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Improve error message when user attempts to render a dynamic component reference
|
|
||||||
|
|
||||||
- [#8736](https://github.com/withastro/astro/pull/8736) [`d1c75fe15`](https://github.com/withastro/astro/commit/d1c75fe158839699c59728cf3a83888e8c72a459) Thanks [@bluwy](https://github.com/bluwy)! - Fix `tsconfig.json` update causing the server to crash
|
|
||||||
|
|
||||||
- [#8743](https://github.com/withastro/astro/pull/8743) [`aa265d730`](https://github.com/withastro/astro/commit/aa265d73024422967c1b1c68ad268c419c6c798f) Thanks [@bluwy](https://github.com/bluwy)! - Remove unused CSS output files when inlined
|
|
||||||
|
|
||||||
- [#8700](https://github.com/withastro/astro/pull/8700) [`78adbc443`](https://github.com/withastro/astro/commit/78adbc4433208458291e36713909762e148e1e5d) Thanks [@jacobthesheep](https://github.com/jacobthesheep)! - Update link for Netlify SSR
|
|
||||||
|
|
||||||
- [#8729](https://github.com/withastro/astro/pull/8729) [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436) Thanks [@lilnasy](https://github.com/lilnasy)! - Node-based adapters now create less server-side javascript
|
|
||||||
|
|
||||||
- [#8730](https://github.com/withastro/astro/pull/8730) [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Improve `astro info` copy to clipboard compatability
|
|
||||||
|
|
||||||
- Updated dependencies [[`21f482657`](https://github.com/withastro/astro/commit/21f4826576c2c812a1604e18717799da3470decd), [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436)]:
|
|
||||||
- @astrojs/markdown-remark@3.2.1
|
|
||||||
- @astrojs/internal-helpers@0.2.1
|
|
||||||
- @astrojs/telemetry@3.0.3
|
|
||||||
|
|
||||||
## 3.2.2
|
## 3.2.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
// ISOMORPHIC FILE: NO TOP-LEVEL IMPORT/REQUIRE() ALLOWED
|
// ISOMORPHIC FILE: NO TOP-LEVEL IMPORT/REQUIRE() ALLOWED
|
||||||
// This file has to run as both ESM and CJS on older Node.js versions
|
// This file has to run as both ESM and CJS on older Node.js versions
|
||||||
|
// Needed for Stackblitz: https://github.com/stackblitz/webcontainer-core/issues/281
|
||||||
|
|
||||||
const CI_INSTRUCTIONS = {
|
const CI_INSTRUCTIONS = {
|
||||||
NETLIFY: 'https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript',
|
NETLIFY: 'https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript',
|
||||||
|
@ -15,11 +16,15 @@ const CI_INSTRUCTIONS = {
|
||||||
const engines = '>=18.14.1';
|
const engines = '>=18.14.1';
|
||||||
const skipSemverCheckIfAbove = 19;
|
const skipSemverCheckIfAbove = 19;
|
||||||
|
|
||||||
|
// HACK (2023-08-18) Stackblitz does not support Node 18 yet, so we'll fake Node 16 support for some time until it's supported
|
||||||
|
// TODO: Remove when Node 18 is supported on Stackblitz
|
||||||
|
const isStackblitz = process.env.SHELL === '/bin/jsh' && process.versions.webcontainer != null;
|
||||||
|
|
||||||
/** `astro *` */
|
/** `astro *` */
|
||||||
async function main() {
|
async function main() {
|
||||||
const version = process.versions.node;
|
const version = process.versions.node;
|
||||||
// Fast-path for higher Node.js versions
|
// Fast-path for higher Node.js versions
|
||||||
if ((parseInt(version) || 0) <= skipSemverCheckIfAbove) {
|
if (!isStackblitz && (parseInt(version) || 0) <= skipSemverCheckIfAbove) {
|
||||||
try {
|
try {
|
||||||
const semver = await import('semver');
|
const semver = await import('semver');
|
||||||
if (!semver.satisfies(version, engines)) {
|
if (!semver.satisfies(version, engines)) {
|
||||||
|
@ -32,13 +37,6 @@ async function main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// windows drive letters can sometimes be lowercase, which vite cannot process
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
const cwd = process.cwd();
|
|
||||||
const correctedCwd = cwd.slice(0, 1).toUpperCase() + cwd.slice(1);
|
|
||||||
if (correctedCwd !== cwd) process.chdir(correctedCwd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return import('./dist/cli/index.js')
|
return import('./dist/cli/index.js')
|
||||||
.then(({ cli }) => cli(process.argv))
|
.then(({ cli }) => cli(process.argv))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import { navigate } from "astro:transitions/client";
|
|
||||||
export default function ClickToNavigate({ to, id }) {
|
|
||||||
return <button id={id} onClick={() => navigate(to)}>Navigate to `{to}`</button>;
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
---
|
|
||||||
import { ViewTransitions } from 'astro:transitions';
|
|
||||||
---
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<ViewTransitions/>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>Local transitions</p>
|
|
||||||
<slot/>
|
|
||||||
<script>
|
|
||||||
document.addEventListener("astro:after-swap", () => {
|
|
||||||
document.querySelector("p").addEventListener("transitionstart", () => {
|
|
||||||
console.info("transitionstart");
|
|
||||||
});
|
|
||||||
document.documentElement.setAttribute("class", "blue");
|
|
||||||
});
|
|
||||||
document.dispatchEvent(new Event("astro:after-swap"));
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
<style>
|
|
||||||
p {
|
|
||||||
transition: background-color 1s;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
background-color: #0ee;
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
.blue p {
|
|
||||||
background-color: #ee0;
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</html>
|
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
import ClickToNavigate from "../components/ClickToNavigate.jsx"
|
|
||||||
import { ViewTransitions } from "astro:transitions";
|
|
||||||
---
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<ViewTransitions />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<ClickToNavigate id="react-client-load-navigate-button" to="/two" client:load/>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
import ListenerLayout from '../components/listener-layout.astro';
|
|
||||||
---
|
|
||||||
<ListenerLayout>
|
|
||||||
<a id="totwo" href="/listener-two">Go to listener two</a>
|
|
||||||
</ListenerLayout>
|
|
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
import ListenerLayout from '../components/listener-layout.astro';
|
|
||||||
---
|
|
||||||
<ListenerLayout>
|
|
||||||
<a id="toone" href="/listener-one">Go to listener one</a>
|
|
||||||
</ListenerLayout>
|
|
|
@ -230,28 +230,6 @@ test.describe('View Transitions', () => {
|
||||||
await expect(h, 'imported CSS updated').toHaveCSS('background-color', 'rgba(0, 0, 0, 0)');
|
await expect(h, 'imported CSS updated').toHaveCSS('background-color', 'rgba(0, 0, 0, 0)');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('No page rendering during swap()', async ({ page, astro }) => {
|
|
||||||
let transitions = 0;
|
|
||||||
page.on('console', (msg) => {
|
|
||||||
if (msg.type() === 'info' && msg.text() === 'transitionstart') ++transitions;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Go to page 1
|
|
||||||
await page.goto(astro.resolveUrl('/listener-one'));
|
|
||||||
let p = page.locator('#totwo');
|
|
||||||
await expect(p, 'should have content').toHaveText('Go to listener two');
|
|
||||||
// on load a CSS transition is started triggered by a class on the html element
|
|
||||||
expect(transitions).toEqual(1);
|
|
||||||
|
|
||||||
// go to page 2
|
|
||||||
await page.click('#totwo');
|
|
||||||
p = page.locator('#toone');
|
|
||||||
await expect(p, 'should have content').toHaveText('Go to listener one');
|
|
||||||
// swap() resets that class, the after-swap listener sets it again.
|
|
||||||
// the temporarily missing class must not trigger page rendering
|
|
||||||
expect(transitions).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('click hash links does not do navigation', async ({ page, astro }) => {
|
test('click hash links does not do navigation', async ({ page, astro }) => {
|
||||||
// Go to page 1
|
// Go to page 1
|
||||||
await page.goto(astro.resolveUrl('/one'));
|
await page.goto(astro.resolveUrl('/one'));
|
||||||
|
@ -670,7 +648,7 @@ test.describe('View Transitions', () => {
|
||||||
expect(loads.length, 'There should be 2 page loads').toEqual(2);
|
expect(loads.length, 'There should be 2 page loads').toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('client:only styles are retained on transition', async ({ page, astro }) => {
|
test('client:only styles are retained on transition', async ({ page, astro }) => {
|
||||||
const totalExpectedStyles = 7;
|
const totalExpectedStyles = 7;
|
||||||
|
|
||||||
// Go to page 1
|
// Go to page 1
|
||||||
|
@ -753,21 +731,6 @@ test.describe('View Transitions', () => {
|
||||||
await expect(p, 'should have content').toHaveText('Page 1');
|
await expect(p, 'should have content').toHaveText('Page 1');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Use the client side router in framework components', async ({ page, astro }) => {
|
|
||||||
await page.goto(astro.resolveUrl('/client-load'));
|
|
||||||
|
|
||||||
// the button is set to naviagte() to /two
|
|
||||||
const button = page.locator('#react-client-load-navigate-button');
|
|
||||||
|
|
||||||
await expect(button, 'should have content').toHaveText('Navigate to `/two`');
|
|
||||||
|
|
||||||
await button.click();
|
|
||||||
|
|
||||||
const p = page.locator('#two');
|
|
||||||
|
|
||||||
await expect(p, 'should have content').toHaveText('Page 2');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('body inline scripts do not re-execute on navigation', async ({ page, astro }) => {
|
test('body inline scripts do not re-execute on navigation', async ({ page, astro }) => {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
page.addListener('pageerror', (err) => {
|
page.addListener('pageerror', (err) => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "astro",
|
"name": "astro",
|
||||||
"version": "3.2.4",
|
"version": "3.2.2",
|
||||||
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -168,6 +168,7 @@
|
||||||
"string-width": "^6.1.0",
|
"string-width": "^6.1.0",
|
||||||
"strip-ansi": "^7.1.0",
|
"strip-ansi": "^7.1.0",
|
||||||
"tsconfig-resolver": "^3.0.1",
|
"tsconfig-resolver": "^3.0.1",
|
||||||
|
"undici": "^5.23.0",
|
||||||
"unist-util-visit": "^4.1.2",
|
"unist-util-visit": "^4.1.2",
|
||||||
"vfile": "^5.3.7",
|
"vfile": "^5.3.7",
|
||||||
"vite": "^4.4.9",
|
"vite": "^4.4.9",
|
||||||
|
@ -225,8 +226,5 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1",
|
"node": ">=18.14.1",
|
||||||
"npm": ">=6.14.0"
|
"npm": ">=6.14.0"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,7 +636,7 @@ export interface AstroUserConfig {
|
||||||
* @see output
|
* @see output
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
* Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters for [Netlify](https://docs.astro.build/en/guides/deploy/netlify/#adapter-for-ssr), [Vercel](https://docs.astro.build/en/guides/deploy/vercel/#adapter-for-ssr), and more to engage Astro SSR.
|
* Deploy to your favorite server, serverless, or edge host with build adapters. Import one of our first-party adapters for [Netlify](https://docs.astro.build/en/guides/deploy/netlify/#adapter-for-ssredge), [Vercel](https://docs.astro.build/en/guides/deploy/vercel/#adapter-for-ssr), and more to engage Astro SSR.
|
||||||
*
|
*
|
||||||
* [See our Server-side Rendering guide](https://docs.astro.build/en/guides/server-side-rendering/) for more on SSR, and [our deployment guides](https://docs.astro.build/en/guides/deploy/) for a complete list of hosts.
|
* [See our Server-side Rendering guide](https://docs.astro.build/en/guides/server-side-rendering/) for more on SSR, and [our deployment guides](https://docs.astro.build/en/guides/deploy/) for a complete list of hosts.
|
||||||
*
|
*
|
||||||
|
@ -1168,10 +1168,10 @@ export interface AstroUserConfig {
|
||||||
* Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
|
* Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string.
|
||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';
|
* import rehypeMinifyHtml from 'rehype-minify';
|
||||||
* {
|
* {
|
||||||
* markdown: {
|
* markdown: {
|
||||||
* rehypePlugins: [rehypeAccessibleEmojis]
|
* rehypePlugins: [rehypeMinifyHtml]
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
|
|
|
@ -111,7 +111,7 @@ export async function getImage(
|
||||||
src: imageURL,
|
src: imageURL,
|
||||||
attributes:
|
attributes:
|
||||||
service.getHTMLAttributes !== undefined
|
service.getHTMLAttributes !== undefined
|
||||||
? await service.getHTMLAttributes(validatedOptions, imageConfig)
|
? service.getHTMLAttributes(validatedOptions, imageConfig)
|
||||||
: {},
|
: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ const ALIASES = new Map([
|
||||||
]);
|
]);
|
||||||
const ASTRO_CONFIG_STUB = `import { defineConfig } from 'astro/config';\n\nexport default defineConfig({});`;
|
const ASTRO_CONFIG_STUB = `import { defineConfig } from 'astro/config';\n\nexport default defineConfig({});`;
|
||||||
const TAILWIND_CONFIG_STUB = `/** @type {import('tailwindcss').Config} */
|
const TAILWIND_CONFIG_STUB = `/** @type {import('tailwindcss').Config} */
|
||||||
export default {
|
module.exports = {
|
||||||
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
|
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {},
|
extend: {},
|
||||||
|
@ -74,6 +74,7 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record<string, string> = {
|
||||||
vercel: '@astrojs/vercel/serverless',
|
vercel: '@astrojs/vercel/serverless',
|
||||||
cloudflare: '@astrojs/cloudflare',
|
cloudflare: '@astrojs/cloudflare',
|
||||||
node: '@astrojs/node',
|
node: '@astrojs/node',
|
||||||
|
deno: '@astrojs/deno',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Users might lack access to the global npm registry, this function
|
// Users might lack access to the global npm registry, this function
|
||||||
|
@ -159,7 +160,7 @@ export async function add(names: string[], { flags }: AddOptions) {
|
||||||
'./tailwind.config.mjs',
|
'./tailwind.config.mjs',
|
||||||
'./tailwind.config.js',
|
'./tailwind.config.js',
|
||||||
],
|
],
|
||||||
defaultConfigFile: './tailwind.config.mjs',
|
defaultConfigFile: './tailwind.config.cjs',
|
||||||
defaultConfigContent: TAILWIND_CONFIG_STUB,
|
defaultConfigContent: TAILWIND_CONFIG_STUB,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,22 +41,10 @@ export async function printInfo({ flags }: InfoOptions) {
|
||||||
await copyToClipboard(output.trim());
|
await copyToClipboard(output.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SUPPORTED_SYSTEM = new Set(['darwin', 'win32']);
|
||||||
async function copyToClipboard(text: string) {
|
async function copyToClipboard(text: string) {
|
||||||
const system = platform();
|
const system = platform();
|
||||||
let command = '';
|
if (!SUPPORTED_SYSTEM.has(system)) return;
|
||||||
if (system === 'darwin') {
|
|
||||||
command = 'pbcopy';
|
|
||||||
} else if (system === 'win32') {
|
|
||||||
command = 'clip';
|
|
||||||
} else {
|
|
||||||
// Unix: check if `xclip` is installed
|
|
||||||
const output = execSync('which xclip', { encoding: 'utf8' });
|
|
||||||
if (output[0] !== '/') {
|
|
||||||
// Did not find a path for xclip, bail out!
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
command = 'xclip -sel clipboard -l 1';
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
const { shouldCopy } = await prompts({
|
const { shouldCopy } = await prompts({
|
||||||
|
@ -66,11 +54,11 @@ async function copyToClipboard(text: string) {
|
||||||
initial: true,
|
initial: true,
|
||||||
});
|
});
|
||||||
if (!shouldCopy) return;
|
if (!shouldCopy) return;
|
||||||
|
const command = system === 'darwin' ? 'pbcopy' : 'clip';
|
||||||
try {
|
try {
|
||||||
execSync(command, {
|
execSync(`echo ${JSON.stringify(text.trim())} | ${command}`, {
|
||||||
input: text.trim(),
|
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
|
stdio: 'ignore',
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
console.error(
|
||||||
|
|
|
@ -30,7 +30,7 @@ type RawContentEvent = { name: ChokidarEvent; entry: string };
|
||||||
type ContentEvent = { name: ChokidarEvent; entry: URL };
|
type ContentEvent = { name: ChokidarEvent; entry: URL };
|
||||||
|
|
||||||
type DataEntryMetadata = Record<string, never>;
|
type DataEntryMetadata = Record<string, never>;
|
||||||
type ContentEntryMetadata = { slug: string, path: string };
|
type ContentEntryMetadata = { slug: string };
|
||||||
type CollectionEntryMap = {
|
type CollectionEntryMap = {
|
||||||
[collection: string]:
|
[collection: string]:
|
||||||
| {
|
| {
|
||||||
|
@ -276,7 +276,7 @@ export async function createContentTypesGenerator({
|
||||||
if (!(entryKey in collectionEntryMap[collectionKey].entries)) {
|
if (!(entryKey in collectionEntryMap[collectionKey].entries)) {
|
||||||
collectionEntryMap[collectionKey] = {
|
collectionEntryMap[collectionKey] = {
|
||||||
type: 'content',
|
type: 'content',
|
||||||
entries: { ...collectionInfo.entries, [entryKey]: { slug: addedSlug, path: event.entry.toString() } },
|
entries: { ...collectionInfo.entries, [entryKey]: { slug: addedSlug } },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { shouldGenerateTypes: true };
|
return { shouldGenerateTypes: true };
|
||||||
|
@ -453,15 +453,7 @@ async function writeContentFiles({
|
||||||
)}] }`;
|
)}] }`;
|
||||||
|
|
||||||
const slugType = JSON.stringify(entryMetadata.slug);
|
const slugType = JSON.stringify(entryMetadata.slug);
|
||||||
contentTypesStr += [
|
contentTypesStr += `${entryKey}: {\n id: ${entryKey};\n slug: ${slugType};\n body: string;\n collection: ${collectionKey};\n data: ${dataType}\n} & ${renderType};\n`;
|
||||||
`${entryKey}: {`,
|
|
||||||
` id: ${entryKey};`,
|
|
||||||
` slug: ${slugType};`,
|
|
||||||
` path: ${JSON.stringify(entryMetadata.path)};`,
|
|
||||||
` body: string;`,
|
|
||||||
` collection: ${collectionKey};`,
|
|
||||||
` data: ${dataType}`,
|
|
||||||
`} & ${renderType};`].join("\n");
|
|
||||||
}
|
}
|
||||||
contentTypesStr += `};\n`;
|
contentTypesStr += `};\n`;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -148,16 +148,10 @@ export const _internal = {
|
||||||
hasContentFlag(modUrl, DATA_FLAG) ||
|
hasContentFlag(modUrl, DATA_FLAG) ||
|
||||||
Boolean(getContentRendererByViteId(modUrl, settings))
|
Boolean(getContentRendererByViteId(modUrl, settings))
|
||||||
) {
|
) {
|
||||||
try {
|
|
||||||
const mod = await viteServer.moduleGraph.getModuleByUrl(modUrl);
|
const mod = await viteServer.moduleGraph.getModuleByUrl(modUrl);
|
||||||
if (mod) {
|
if (mod) {
|
||||||
viteServer.moduleGraph.invalidateModule(mod);
|
viteServer.moduleGraph.invalidateModule(mod);
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
|
||||||
// The server may be closed due to a restart caused by this file change
|
|
||||||
if (e.code === 'ERR_CLOSED_SERVER') break;
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { GetModuleInfo, ModuleInfo } from 'rollup';
|
import type { GetModuleInfo } from 'rollup';
|
||||||
|
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import npath from 'node:path';
|
import npath from 'node:path';
|
||||||
|
@ -6,29 +6,20 @@ import type { AstroSettings } from '../../@types/astro.js';
|
||||||
import { viteID } from '../util.js';
|
import { viteID } from '../util.js';
|
||||||
import { getTopLevelPages } from './graph.js';
|
import { getTopLevelPages } from './graph.js';
|
||||||
|
|
||||||
// These pages could be used as base names for the chunk hashed name, but they are confusing
|
|
||||||
// and should be avoided it possible
|
|
||||||
const confusingBaseNames = ['404', '500'];
|
|
||||||
|
|
||||||
// The short name for when the hash can be included
|
// The short name for when the hash can be included
|
||||||
// We could get rid of this and only use the createSlugger implementation, but this creates
|
// We could get rid of this and only use the createSlugger implementation, but this creates
|
||||||
// slightly prettier names.
|
// slightly prettier names.
|
||||||
export function shortHashedName(id: string, ctx: { getModuleInfo: GetModuleInfo }): string {
|
export function shortHashedName(id: string, ctx: { getModuleInfo: GetModuleInfo }): string {
|
||||||
const parents = Array.from(getTopLevelPages(id, ctx));
|
const parents = Array.from(getTopLevelPages(id, ctx));
|
||||||
return createNameHash(
|
const firstParentId = parents[0]?.[0].id;
|
||||||
getFirstParentId(parents),
|
const firstParentName = firstParentId ? npath.parse(firstParentId).name : 'index';
|
||||||
parents.map(([page]) => page.id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createNameHash(baseId: string | undefined, hashIds: string[]): string {
|
|
||||||
const baseName = baseId ? prettifyBaseName(npath.parse(baseId).name) : 'index';
|
|
||||||
const hash = crypto.createHash('sha256');
|
const hash = crypto.createHash('sha256');
|
||||||
for (const id of hashIds) {
|
for (const [page] of parents) {
|
||||||
hash.update(id, 'utf-8');
|
hash.update(page.id, 'utf-8');
|
||||||
}
|
}
|
||||||
const h = hash.digest('hex').slice(0, 8);
|
const h = hash.digest('hex').slice(0, 8);
|
||||||
const proposedName = baseName + '.' + h;
|
const proposedName = firstParentName + '.' + h;
|
||||||
return proposedName;
|
return proposedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +34,7 @@ export function createSlugger(settings: AstroSettings) {
|
||||||
.map(([page]) => page.id)
|
.map(([page]) => page.id)
|
||||||
.sort()
|
.sort()
|
||||||
.join('-');
|
.join('-');
|
||||||
const firstParentId = getFirstParentId(parents) || indexPage;
|
const firstParentId = parents[0]?.[0].id || indexPage;
|
||||||
|
|
||||||
// Use the last two segments, for ex /docs/index
|
// Use the last two segments, for ex /docs/index
|
||||||
let dir = firstParentId;
|
let dir = firstParentId;
|
||||||
|
@ -54,7 +45,7 @@ export function createSlugger(settings: AstroSettings) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = prettifyBaseName(npath.parse(npath.basename(dir)).name);
|
const name = npath.parse(npath.basename(dir)).name;
|
||||||
key = key.length ? name + sep + key : name;
|
key = key.length ? name + sep + key : name;
|
||||||
dir = npath.dirname(dir);
|
dir = npath.dirname(dir);
|
||||||
i++;
|
i++;
|
||||||
|
@ -85,32 +76,3 @@ export function createSlugger(settings: AstroSettings) {
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the first parent id from `parents` where its name is not confusing.
|
|
||||||
* Returns undefined if there's no parents.
|
|
||||||
*/
|
|
||||||
function getFirstParentId(parents: [ModuleInfo, number, number][]) {
|
|
||||||
for (const parent of parents) {
|
|
||||||
const id = parent[0].id;
|
|
||||||
const baseName = npath.parse(id).name;
|
|
||||||
if (!confusingBaseNames.includes(baseName)) {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If all parents are confusing, just use the first one. Or if there's no
|
|
||||||
// parents, this will return undefined.
|
|
||||||
return parents[0]?.[0].id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const charsToReplaceRe = /[.\[\]]/g;
|
|
||||||
const underscoresRe = /_+/g;
|
|
||||||
/**
|
|
||||||
* Prettify base names so they're easier to read:
|
|
||||||
* - index -> index
|
|
||||||
* - [slug] -> _slug_
|
|
||||||
* - [...spread] -> _spread_
|
|
||||||
*/
|
|
||||||
function prettifyBaseName(str: string) {
|
|
||||||
return str.replace(charsToReplaceRe, '_').replace(underscoresRe, '_');
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import * as crypto from 'node:crypto';
|
||||||
|
import * as npath from 'node:path';
|
||||||
import type { GetModuleInfo } from 'rollup';
|
import type { GetModuleInfo } from 'rollup';
|
||||||
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
|
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
|
||||||
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
|
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
|
||||||
|
@ -91,7 +93,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
|
||||||
if (new URL(pageInfo.id, 'file://').searchParams.has(PROPAGATED_ASSET_FLAG)) {
|
if (new URL(pageInfo.id, 'file://').searchParams.has(PROPAGATED_ASSET_FLAG)) {
|
||||||
// Split delayed assets to separate modules
|
// Split delayed assets to separate modules
|
||||||
// so they can be injected where needed
|
// so they can be injected where needed
|
||||||
const chunkId = assetName.createNameHash(id, [id]);
|
const chunkId = createNameHash(id, [id]);
|
||||||
internals.cssModuleToChunkIdMap.set(id, chunkId);
|
internals.cssModuleToChunkIdMap.set(id, chunkId);
|
||||||
return chunkId;
|
return chunkId;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +200,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
|
||||||
const inlineConfig = settings.config.build.inlineStylesheets;
|
const inlineConfig = settings.config.build.inlineStylesheets;
|
||||||
const { assetsInlineLimit = 4096 } = settings.config.vite?.build ?? {};
|
const { assetsInlineLimit = 4096 } = settings.config.vite?.build ?? {};
|
||||||
|
|
||||||
Object.entries(bundle).forEach(([id, stylesheet]) => {
|
Object.entries(bundle).forEach(([_, stylesheet]) => {
|
||||||
if (
|
if (
|
||||||
stylesheet.type !== 'asset' ||
|
stylesheet.type !== 'asset' ||
|
||||||
stylesheet.name?.endsWith('.css') !== true ||
|
stylesheet.name?.endsWith('.css') !== true ||
|
||||||
|
@ -222,15 +224,10 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
|
||||||
: { type: 'external', src: stylesheet.fileName };
|
: { type: 'external', src: stylesheet.fileName };
|
||||||
|
|
||||||
const pages = Array.from(eachPageData(internals));
|
const pages = Array.from(eachPageData(internals));
|
||||||
let sheetAddedToPage = false;
|
|
||||||
|
|
||||||
pages.forEach((pageData) => {
|
pages.forEach((pageData) => {
|
||||||
const orderingInfo = pagesToCss[pageData.moduleSpecifier]?.[stylesheet.fileName];
|
const orderingInfo = pagesToCss[pageData.moduleSpecifier]?.[stylesheet.fileName];
|
||||||
if (orderingInfo !== undefined) {
|
if (orderingInfo !== undefined) return pageData.styles.push({ ...orderingInfo, sheet });
|
||||||
pageData.styles.push({ ...orderingInfo, sheet });
|
|
||||||
sheetAddedToPage = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const propagatedPaths = pagesToPropagatedCss[pageData.moduleSpecifier];
|
const propagatedPaths = pagesToPropagatedCss[pageData.moduleSpecifier];
|
||||||
if (propagatedPaths === undefined) return;
|
if (propagatedPaths === undefined) return;
|
||||||
|
@ -246,21 +243,8 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
|
||||||
pageData.propagatedStyles.set(pageInfoId, new Set()).get(pageInfoId)!;
|
pageData.propagatedStyles.set(pageInfoId, new Set()).get(pageInfoId)!;
|
||||||
|
|
||||||
propagatedStyles.add(sheet);
|
propagatedStyles.add(sheet);
|
||||||
sheetAddedToPage = true;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (toBeInlined && sheetAddedToPage) {
|
|
||||||
// CSS is already added to all used pages, we can delete it from the bundle
|
|
||||||
// and make sure no chunks reference it via `importedCss` (for Vite preloading)
|
|
||||||
// to avoid duplicate CSS.
|
|
||||||
delete bundle[id];
|
|
||||||
for (const chunk of Object.values(bundle)) {
|
|
||||||
if (chunk.type === 'chunk') {
|
|
||||||
chunk.viteMetadata?.importedCss?.delete(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -270,6 +254,17 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
|
||||||
|
|
||||||
/***** UTILITY FUNCTIONS *****/
|
/***** UTILITY FUNCTIONS *****/
|
||||||
|
|
||||||
|
function createNameHash(baseId: string, hashIds: string[]): string {
|
||||||
|
const baseName = baseId ? npath.parse(baseId).name : 'index';
|
||||||
|
const hash = crypto.createHash('sha256');
|
||||||
|
for (const id of hashIds) {
|
||||||
|
hash.update(id, 'utf-8');
|
||||||
|
}
|
||||||
|
const h = hash.digest('hex').slice(0, 8);
|
||||||
|
const proposedName = baseName + '.' + h;
|
||||||
|
return proposedName;
|
||||||
|
}
|
||||||
|
|
||||||
function* getParentClientOnlys(
|
function* getParentClientOnlys(
|
||||||
id: string,
|
id: string,
|
||||||
ctx: { getModuleInfo: GetModuleInfo },
|
ctx: { getModuleInfo: GetModuleInfo },
|
||||||
|
|
|
@ -39,6 +39,7 @@ export function createAPIContext({
|
||||||
props,
|
props,
|
||||||
adapterName,
|
adapterName,
|
||||||
}: CreateAPIContext): APIContext {
|
}: CreateAPIContext): APIContext {
|
||||||
|
initResponseWithEncoding();
|
||||||
const context = {
|
const context = {
|
||||||
cookies: new AstroCookies(request),
|
cookies: new AstroCookies(request),
|
||||||
request,
|
request,
|
||||||
|
@ -91,8 +92,15 @@ export function createAPIContext({
|
||||||
|
|
||||||
type ResponseParameters = ConstructorParameters<typeof Response>;
|
type ResponseParameters = ConstructorParameters<typeof Response>;
|
||||||
|
|
||||||
export class ResponseWithEncoding extends Response {
|
export let ResponseWithEncoding: ReturnType<typeof initResponseWithEncoding>;
|
||||||
constructor(body: ResponseParameters[0], init: ResponseParameters[1], encoding?: BufferEncoding) {
|
// TODO Remove this after StackBlitz supports Node 18.
|
||||||
|
let initResponseWithEncoding = () => {
|
||||||
|
class LocalResponseWithEncoding extends Response {
|
||||||
|
constructor(
|
||||||
|
body: ResponseParameters[0],
|
||||||
|
init: ResponseParameters[1],
|
||||||
|
encoding?: BufferEncoding
|
||||||
|
) {
|
||||||
// If a body string is given, try to encode it to preserve the behaviour as simple objects.
|
// If a body string is given, try to encode it to preserve the behaviour as simple objects.
|
||||||
// We don't do the full handling as simple objects so users can control how headers are set instead.
|
// We don't do the full handling as simple objects so users can control how headers are set instead.
|
||||||
if (typeof body === 'string') {
|
if (typeof body === 'string') {
|
||||||
|
@ -112,7 +120,16 @@ export class ResponseWithEncoding extends Response {
|
||||||
this.headers.set('X-Astro-Encoding', encoding);
|
this.headers.set('X-Astro-Encoding', encoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the module scoped variable.
|
||||||
|
ResponseWithEncoding = LocalResponseWithEncoding;
|
||||||
|
|
||||||
|
// Turn this into a noop.
|
||||||
|
initResponseWithEncoding = (() => {}) as any;
|
||||||
|
|
||||||
|
return LocalResponseWithEncoding;
|
||||||
|
};
|
||||||
|
|
||||||
export async function callEndpoint<MiddlewareResult = Response | EndpointOutput>(
|
export async function callEndpoint<MiddlewareResult = Response | EndpointOutput>(
|
||||||
mod: EndpointHandler,
|
mod: EndpointHandler,
|
||||||
|
|
|
@ -1,52 +1,19 @@
|
||||||
import { EventEmitter } from 'node:events';
|
import { EventEmitter } from 'node:events';
|
||||||
import path from 'node:path';
|
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader.js';
|
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader.js';
|
||||||
|
|
||||||
export function createViteLoader(viteServer: vite.ViteDevServer): ModuleLoader {
|
export function createViteLoader(viteServer: vite.ViteDevServer): ModuleLoader {
|
||||||
const events = new EventEmitter() as ModuleLoaderEventEmitter;
|
const events = new EventEmitter() as ModuleLoaderEventEmitter;
|
||||||
|
|
||||||
let isTsconfigUpdated = false;
|
viteServer.watcher.on('add', (...args) => events.emit('file-add', args));
|
||||||
function isTsconfigUpdate(filePath: string) {
|
viteServer.watcher.on('unlink', (...args) => events.emit('file-unlink', args));
|
||||||
const result = path.basename(filePath) === 'tsconfig.json';
|
viteServer.watcher.on('change', (...args) => events.emit('file-change', args));
|
||||||
if (result) isTsconfigUpdated = true;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip event emit on tsconfig change as Vite restarts the server, and we don't
|
wrapMethod(viteServer.ws, 'send', (msg) => {
|
||||||
// want to trigger unnecessary work that will be invalidated shortly.
|
|
||||||
viteServer.watcher.on('add', (...args) => {
|
|
||||||
if (!isTsconfigUpdate(args[0])) {
|
|
||||||
events.emit('file-add', args);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
viteServer.watcher.on('unlink', (...args) => {
|
|
||||||
if (!isTsconfigUpdate(args[0])) {
|
|
||||||
events.emit('file-unlink', args);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
viteServer.watcher.on('change', (...args) => {
|
|
||||||
if (!isTsconfigUpdate(args[0])) {
|
|
||||||
events.emit('file-change', args);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const _wsSend = viteServer.ws.send;
|
|
||||||
viteServer.ws.send = function (...args: any) {
|
|
||||||
// If the tsconfig changed, Vite will trigger a reload as it invalidates the module.
|
|
||||||
// However in Astro, the whole server is restarted when the tsconfig changes. If we
|
|
||||||
// do a restart and reload at the same time, the browser will refetch and the server
|
|
||||||
// is not ready yet, causing a blank page. Here we block that reload from happening.
|
|
||||||
if (isTsconfigUpdated) {
|
|
||||||
isTsconfigUpdated = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const msg = args[0] as vite.HMRPayload;
|
|
||||||
if (msg?.type === 'error') {
|
if (msg?.type === 'error') {
|
||||||
events.emit('hmr-error', msg);
|
events.emit('hmr-error', msg);
|
||||||
}
|
}
|
||||||
_wsSend.apply(this, args);
|
});
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
import(src) {
|
import(src) {
|
||||||
|
@ -89,3 +56,11 @@ export function createViteLoader(viteServer: vite.ViteDevServer): ModuleLoader {
|
||||||
events,
|
events,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wrapMethod(object: any, method: string, newFn: (...args: any[]) => void) {
|
||||||
|
const orig = object[method];
|
||||||
|
object[method] = function (...args: any[]) {
|
||||||
|
newFn.apply(this, args);
|
||||||
|
return orig.apply(this, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,63 @@
|
||||||
import buffer from 'node:buffer';
|
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
import {
|
||||||
|
ByteLengthQueuingStrategy,
|
||||||
|
CountQueuingStrategy,
|
||||||
|
ReadableByteStreamController,
|
||||||
|
ReadableStream,
|
||||||
|
ReadableStreamBYOBReader,
|
||||||
|
ReadableStreamBYOBRequest,
|
||||||
|
ReadableStreamDefaultController,
|
||||||
|
ReadableStreamDefaultReader,
|
||||||
|
TransformStream,
|
||||||
|
WritableStream,
|
||||||
|
WritableStreamDefaultController,
|
||||||
|
WritableStreamDefaultWriter,
|
||||||
|
} from 'node:stream/web';
|
||||||
|
import { File, FormData, Headers, Request, Response, fetch } from 'undici';
|
||||||
|
|
||||||
|
// NOTE: This file does not intend to polyfill everything that exists, its main goal is to make life easier
|
||||||
|
// for users deploying to runtime that do support these features. In the future, we hope for this file to disappear.
|
||||||
|
|
||||||
|
// HACK (2023-08-18) Stackblitz does not support Node 18 yet, so we'll fake Node 16 support for some time until it's supported
|
||||||
|
// TODO: Remove when Node 18 is supported on Stackblitz. File should get imported from `node:buffer` instead of `undici` once this is removed
|
||||||
|
const isStackblitz = process.env.SHELL === '/bin/jsh' && process.versions.webcontainer != null;
|
||||||
|
|
||||||
export function apply() {
|
export function apply() {
|
||||||
|
if (isStackblitz) {
|
||||||
|
const neededPolyfills = {
|
||||||
|
ByteLengthQueuingStrategy,
|
||||||
|
CountQueuingStrategy,
|
||||||
|
ReadableByteStreamController,
|
||||||
|
ReadableStream,
|
||||||
|
ReadableStreamBYOBReader,
|
||||||
|
ReadableStreamBYOBRequest,
|
||||||
|
ReadableStreamDefaultController,
|
||||||
|
ReadableStreamDefaultReader,
|
||||||
|
TransformStream,
|
||||||
|
WritableStream,
|
||||||
|
WritableStreamDefaultController,
|
||||||
|
WritableStreamDefaultWriter,
|
||||||
|
File,
|
||||||
|
FormData,
|
||||||
|
Headers,
|
||||||
|
Request,
|
||||||
|
Response,
|
||||||
|
fetch,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let polyfillName of Object.keys(neededPolyfills)) {
|
||||||
|
if (Object.hasOwnProperty.call(globalThis, polyfillName)) continue;
|
||||||
|
|
||||||
|
// Add polyfill to globalThis
|
||||||
|
Object.defineProperty(globalThis, polyfillName, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
writable: true,
|
||||||
|
value: neededPolyfills[polyfillName as keyof typeof neededPolyfills],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove when Node 18 is dropped for Node 20
|
// Remove when Node 18 is dropped for Node 20
|
||||||
if (!globalThis.crypto) {
|
if (!globalThis.crypto) {
|
||||||
Object.defineProperty(globalThis, 'crypto', {
|
Object.defineProperty(globalThis, 'crypto', {
|
||||||
|
@ -12,7 +68,7 @@ export function apply() {
|
||||||
// Remove when Node 18 is dropped for Node 20
|
// Remove when Node 18 is dropped for Node 20
|
||||||
if (!globalThis.File) {
|
if (!globalThis.File) {
|
||||||
Object.defineProperty(globalThis, 'File', {
|
Object.defineProperty(globalThis, 'File', {
|
||||||
value: buffer.File,
|
value: File,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,10 @@ export interface HydrationMetadata {
|
||||||
componentExport: { value: string };
|
componentExport: { value: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = Record<string | number | symbol, any>;
|
|
||||||
|
|
||||||
interface ExtractedProps {
|
interface ExtractedProps {
|
||||||
isPage: boolean;
|
isPage: boolean;
|
||||||
hydration: HydrationMetadata | null;
|
hydration: HydrationMetadata | null;
|
||||||
props: Props;
|
props: Record<string | number | symbol, any>;
|
||||||
propsWithoutTransitionAttributes: Props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const transitionDirectivesToCopyOnIsland = Object.freeze([
|
const transitionDirectivesToCopyOnIsland = Object.freeze([
|
||||||
|
@ -32,14 +29,13 @@ const transitionDirectivesToCopyOnIsland = Object.freeze([
|
||||||
// Used to extract the directives, aka `client:load` information about a component.
|
// Used to extract the directives, aka `client:load` information about a component.
|
||||||
// Finds these special props and removes them from what gets passed into the component.
|
// Finds these special props and removes them from what gets passed into the component.
|
||||||
export function extractDirectives(
|
export function extractDirectives(
|
||||||
inputProps: Props,
|
inputProps: Record<string | number | symbol, any>,
|
||||||
clientDirectives: SSRResult['clientDirectives']
|
clientDirectives: SSRResult['clientDirectives']
|
||||||
): ExtractedProps {
|
): ExtractedProps {
|
||||||
let extracted: ExtractedProps = {
|
let extracted: ExtractedProps = {
|
||||||
isPage: false,
|
isPage: false,
|
||||||
hydration: null,
|
hydration: null,
|
||||||
props: {},
|
props: {},
|
||||||
propsWithoutTransitionAttributes: {},
|
|
||||||
};
|
};
|
||||||
for (const [key, value] of Object.entries(inputProps)) {
|
for (const [key, value] of Object.entries(inputProps)) {
|
||||||
if (key.startsWith('server:')) {
|
if (key.startsWith('server:')) {
|
||||||
|
@ -100,14 +96,10 @@ export function extractDirectives(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
extracted.props[key] = value;
|
extracted.props[key] = value;
|
||||||
if (!transitionDirectivesToCopyOnIsland.includes(key)) {
|
|
||||||
extracted.propsWithoutTransitionAttributes[key] = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const sym of Object.getOwnPropertySymbols(inputProps)) {
|
for (const sym of Object.getOwnPropertySymbols(inputProps)) {
|
||||||
extracted.props[sym] = inputProps[sym];
|
extracted.props[sym] = inputProps[sym];
|
||||||
extracted.propsWithoutTransitionAttributes[sym] = inputProps[sym];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return extracted;
|
return extracted;
|
||||||
|
@ -130,10 +122,9 @@ export async function generateHydrateScript(
|
||||||
const { hydrate, componentUrl, componentExport } = metadata;
|
const { hydrate, componentUrl, componentExport } = metadata;
|
||||||
|
|
||||||
if (!componentExport.value) {
|
if (!componentExport.value) {
|
||||||
throw new AstroError({
|
throw new Error(
|
||||||
...AstroErrorData.NoMatchingImport,
|
`Unable to resolve a valid export for "${metadata.displayName}"! Please open an issue at https://astro.build/issues!`
|
||||||
message: AstroErrorData.NoMatchingImport.message(metadata.displayName),
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const island: SSRElement = {
|
const island: SSRElement = {
|
||||||
|
|
|
@ -92,10 +92,7 @@ async function renderFrameworkComponent(
|
||||||
displayName,
|
displayName,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { hydration, isPage, props, propsWithoutTransitionAttributes } = extractDirectives(
|
const { hydration, isPage, props } = extractDirectives(_props, clientDirectives);
|
||||||
_props,
|
|
||||||
clientDirectives
|
|
||||||
);
|
|
||||||
let html = '';
|
let html = '';
|
||||||
let attrs: Record<string, string> | undefined = undefined;
|
let attrs: Record<string, string> | undefined = undefined;
|
||||||
|
|
||||||
|
@ -220,7 +217,7 @@ async function renderFrameworkComponent(
|
||||||
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
||||||
{ result },
|
{ result },
|
||||||
Component,
|
Component,
|
||||||
propsWithoutTransitionAttributes,
|
props,
|
||||||
children,
|
children,
|
||||||
metadata
|
metadata
|
||||||
));
|
));
|
||||||
|
@ -245,7 +242,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
|
||||||
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
({ html, attrs } = await renderer.ssr.renderToStaticMarkup.call(
|
||||||
{ result },
|
{ result },
|
||||||
Component,
|
Component,
|
||||||
propsWithoutTransitionAttributes,
|
props,
|
||||||
children,
|
children,
|
||||||
metadata
|
metadata
|
||||||
));
|
));
|
||||||
|
|
|
@ -13,14 +13,9 @@ type Events = 'astro:page-load' | 'astro:after-swap';
|
||||||
// only update history entries that are managed by us
|
// only update history entries that are managed by us
|
||||||
// leave other entries alone and do not accidently add state.
|
// leave other entries alone and do not accidently add state.
|
||||||
const persistState = (state: State) => history.state && history.replaceState(state, '');
|
const persistState = (state: State) => history.state && history.replaceState(state, '');
|
||||||
|
export const supportsViewTransitions = !!document.startViewTransition;
|
||||||
const inBrowser = import.meta.env.SSR === false;
|
|
||||||
|
|
||||||
export const supportsViewTransitions = inBrowser && !!document.startViewTransition;
|
|
||||||
|
|
||||||
export const transitionEnabledOnThisPage = () =>
|
export const transitionEnabledOnThisPage = () =>
|
||||||
inBrowser && !!document.querySelector('[name="astro-view-transitions-enabled"]');
|
!!document.querySelector('[name="astro-view-transitions-enabled"]');
|
||||||
|
|
||||||
const samePage = (otherLocation: URL) =>
|
const samePage = (otherLocation: URL) =>
|
||||||
location.pathname === otherLocation.pathname && location.search === otherLocation.search;
|
location.pathname === otherLocation.pathname && location.search === otherLocation.search;
|
||||||
const triggerEvent = (name: Events) => document.dispatchEvent(new Event(name));
|
const triggerEvent = (name: Events) => document.dispatchEvent(new Event(name));
|
||||||
|
@ -45,27 +40,26 @@ const announce = () => {
|
||||||
60
|
60
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const PERSIST_ATTR = 'data-astro-transition-persist';
|
const PERSIST_ATTR = 'data-astro-transition-persist';
|
||||||
|
const parser = new DOMParser();
|
||||||
let parser: DOMParser;
|
// explained at its usage
|
||||||
|
let noopEl: HTMLDivElement;
|
||||||
|
if (import.meta.env.DEV) {
|
||||||
|
noopEl = document.createElement('div');
|
||||||
|
}
|
||||||
|
|
||||||
// The History API does not tell you if navigation is forward or back, so
|
// The History API does not tell you if navigation is forward or back, so
|
||||||
// you can figure it using an index. On pushState the index is incremented so you
|
// you can figure it using an index. On pushState the index is incremented so you
|
||||||
// can use that to determine popstate if going forward or back.
|
// can use that to determine popstate if going forward or back.
|
||||||
let currentHistoryIndex = 0;
|
let currentHistoryIndex = 0;
|
||||||
|
if (history.state) {
|
||||||
if (inBrowser) {
|
|
||||||
if (history.state) {
|
|
||||||
// we reloaded a page with history state
|
// we reloaded a page with history state
|
||||||
// (e.g. history navigation from non-transition page or browser reload)
|
// (e.g. history navigation from non-transition page or browser reload)
|
||||||
currentHistoryIndex = history.state.index;
|
currentHistoryIndex = history.state.index;
|
||||||
scrollTo({ left: history.state.scrollX, top: history.state.scrollY });
|
scrollTo({ left: history.state.scrollX, top: history.state.scrollY });
|
||||||
} else if (transitionEnabledOnThisPage()) {
|
} else if (transitionEnabledOnThisPage()) {
|
||||||
history.replaceState({ index: currentHistoryIndex, scrollX, scrollY, intraPage: false }, '');
|
history.replaceState({ index: currentHistoryIndex, scrollX, scrollY, intraPage: false }, '');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const throttle = (cb: (...args: any[]) => any, delay: number) => {
|
const throttle = (cb: (...args: any[]) => any, delay: number) => {
|
||||||
let wait = false;
|
let wait = false;
|
||||||
// During the waiting time additional events are lost.
|
// During the waiting time additional events are lost.
|
||||||
|
@ -157,24 +151,18 @@ function isInfinite(animation: Animation) {
|
||||||
|
|
||||||
const updateHistoryAndScrollPosition = (toLocation: URL, replace: boolean, intraPage: boolean) => {
|
const updateHistoryAndScrollPosition = (toLocation: URL, replace: boolean, intraPage: boolean) => {
|
||||||
const fresh = !samePage(toLocation);
|
const fresh = !samePage(toLocation);
|
||||||
let scrolledToTop = false;
|
|
||||||
if (toLocation.href !== location.href) {
|
if (toLocation.href !== location.href) {
|
||||||
if (replace) {
|
if (replace) {
|
||||||
history.replaceState({ ...history.state }, '', toLocation.href);
|
history.replaceState({ ...history.state }, '', toLocation.href);
|
||||||
} else {
|
} else {
|
||||||
history.replaceState({ ...history.state, intraPage }, '');
|
history.replaceState({ ...history.state, intraPage }, '');
|
||||||
history.pushState(
|
history.pushState({ index: ++currentHistoryIndex, scrollX, scrollY }, '', toLocation.href);
|
||||||
{ index: ++currentHistoryIndex, scrollX: 0, scrollY: 0 },
|
|
||||||
'',
|
|
||||||
toLocation.href
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// now we are on the new page for non-history navigations!
|
// now we are on the new page for non-history navigations!
|
||||||
// (with history navigation page change happens before popstate is fired)
|
// (with history navigation page change happens before popstate is fired)
|
||||||
// freshly loaded pages start from the top
|
// freshly loaded pages start from the top
|
||||||
if (fresh) {
|
if (fresh) {
|
||||||
scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
||||||
scrolledToTop = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toLocation.hash) {
|
if (toLocation.hash) {
|
||||||
|
@ -183,10 +171,8 @@ const updateHistoryAndScrollPosition = (toLocation: URL, replace: boolean, intra
|
||||||
// that won't reload the page but instead scroll to the fragment
|
// that won't reload the page but instead scroll to the fragment
|
||||||
location.href = toLocation.href;
|
location.href = toLocation.href;
|
||||||
} else {
|
} else {
|
||||||
if (!scrolledToTop) {
|
|
||||||
scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// replace head and body of the windows document with contents from newDocument
|
// replace head and body of the windows document with contents from newDocument
|
||||||
|
@ -212,6 +198,22 @@ async function updateDOM(
|
||||||
const href = el.getAttribute('href');
|
const href = el.getAttribute('href');
|
||||||
return newDocument.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
|
return newDocument.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
|
||||||
}
|
}
|
||||||
|
// What follows is a fix for an issue (#8472) with missing client:only styles after transition.
|
||||||
|
// That problem exists only in dev mode where styles are injected into the page by Vite.
|
||||||
|
// Returning a noop element ensures that the styles are not removed from the old document.
|
||||||
|
// Guarding the code below with the dev mode check
|
||||||
|
// allows tree shaking to remove this code in production.
|
||||||
|
if (import.meta.env.DEV) {
|
||||||
|
if (el.tagName === 'STYLE' && el.dataset.viteDevId) {
|
||||||
|
const devId = el.dataset.viteDevId;
|
||||||
|
// If this same style tag exists, remove it from the new page
|
||||||
|
return (
|
||||||
|
newDocument.querySelector(`style[data-vite-dev-id="${devId}"]`) ||
|
||||||
|
// Otherwise, keep it anyways. This is client:only styles.
|
||||||
|
noopEl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -347,8 +349,6 @@ async function transition(
|
||||||
toLocation = new URL(response.redirected);
|
toLocation = new URL(response.redirected);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser ??= new DOMParser();
|
|
||||||
|
|
||||||
const newDocument = parser.parseFromString(response.html, response.mediaType);
|
const newDocument = parser.parseFromString(response.html, response.mediaType);
|
||||||
// The next line might look like a hack,
|
// The next line might look like a hack,
|
||||||
// but it is actually necessary as noscript elements
|
// but it is actually necessary as noscript elements
|
||||||
|
@ -385,22 +385,7 @@ async function transition(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let navigateOnServerWarned = false;
|
|
||||||
|
|
||||||
export function navigate(href: string, options?: Options) {
|
export function navigate(href: string, options?: Options) {
|
||||||
if (inBrowser === false) {
|
|
||||||
if (!navigateOnServerWarned) {
|
|
||||||
// instantiate an error for the stacktrace to show to user.
|
|
||||||
const warning = new Error(
|
|
||||||
'The view transtions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct.'
|
|
||||||
);
|
|
||||||
warning.name = 'Warning';
|
|
||||||
console.warn(warning);
|
|
||||||
navigateOnServerWarned = true;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// not ours
|
// not ours
|
||||||
if (!transitionEnabledOnThisPage()) {
|
if (!transitionEnabledOnThisPage()) {
|
||||||
location.href = href;
|
location.href = href;
|
||||||
|
@ -418,7 +403,8 @@ export function navigate(href: string, options?: Options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPopState(ev: PopStateEvent) {
|
if (supportsViewTransitions || getFallback() !== 'none') {
|
||||||
|
addEventListener('popstate', (ev) => {
|
||||||
if (!transitionEnabledOnThisPage() && ev.state) {
|
if (!transitionEnabledOnThisPage() && ev.state) {
|
||||||
// The current page doesn't have View Transitions enabled
|
// The current page doesn't have View Transitions enabled
|
||||||
// but the page we navigate to does (because it set the state).
|
// but the page we navigate to does (because it set the state).
|
||||||
|
@ -458,11 +444,8 @@ function onPopState(ev: PopStateEvent) {
|
||||||
currentHistoryIndex = nextIndex;
|
currentHistoryIndex = nextIndex;
|
||||||
transition(direction, new URL(location.href), {}, state);
|
transition(direction, new URL(location.href), {}, state);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
if (inBrowser) {
|
|
||||||
if (supportsViewTransitions || getFallback() !== 'none') {
|
|
||||||
addEventListener('popstate', onPopState);
|
|
||||||
addEventListener('load', onPageLoad);
|
addEventListener('load', onPageLoad);
|
||||||
// There's not a good way to record scroll position before a back button.
|
// There's not a good way to record scroll position before a back button.
|
||||||
// So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position.
|
// So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position.
|
||||||
|
@ -474,5 +457,4 @@ if (inBrowser) {
|
||||||
else addEventListener('scroll', throttle(updateState, 300));
|
else addEventListener('scroll', throttle(updateState, 300));
|
||||||
|
|
||||||
markScriptsExec();
|
markScriptsExec();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
import { defineConfig } from 'astro/config';
|
|
||||||
import react from '@astrojs/react';
|
|
||||||
|
|
||||||
// https://astro.build/config
|
|
||||||
export default defineConfig({
|
|
||||||
integrations: [react()],
|
|
||||||
});
|
|
|
@ -3,9 +3,6 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "workspace:*",
|
"astro": "workspace:*"
|
||||||
"@astrojs/react": "workspace:*",
|
|
||||||
"react": "^18.1.0",
|
|
||||||
"react-dom": "^18.1.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
.counter {
|
|
||||||
display: grid;
|
|
||||||
font-size: 2em;
|
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
||||||
margin-top: 2em;
|
|
||||||
place-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.counter-message {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
import React, { useState } from 'react';
|
|
||||||
import './Island.css';
|
|
||||||
|
|
||||||
export default function Counter({ children, count: initialCount, id }) {
|
|
||||||
const [count, setCount] = useState(initialCount);
|
|
||||||
const add = () => setCount((i) => i + 1);
|
|
||||||
const subtract = () => setCount((i) => i - 1);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div id={id} className="counter">
|
|
||||||
<button className="decrement" onClick={subtract}>-</button>
|
|
||||||
<pre>{count}</pre>
|
|
||||||
<button className="increment" onClick={add}>+</button>
|
|
||||||
</div>
|
|
||||||
<div className="counter-message">{children}</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
import Island from '../components/Island.jsx';
|
|
||||||
---
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<Island id="1" count="{1}" children="Greetings!" transition:persist="here" client:load/>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -170,7 +170,7 @@ export async function loadFixture(inlineConfig) {
|
||||||
try {
|
try {
|
||||||
return await fetch(resolvedUrl, init);
|
return await fetch(resolvedUrl, init);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// node fetch throws a vague error when it fails, so we log the url here to easily debug it
|
// undici throws a vague error when it fails, so we log the url here to easily debug it
|
||||||
if (err.message?.includes('fetch failed')) {
|
if (err.message?.includes('fetch failed')) {
|
||||||
console.error(`[astro test] failed to fetch ${resolvedUrl}`);
|
console.error(`[astro test] failed to fetch ${resolvedUrl}`);
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
@ -22,14 +22,4 @@ describe('View Transitions styles', () => {
|
||||||
|
|
||||||
expect($('head style')).to.have.a.lengthOf(3);
|
expect($('head style')).to.have.a.lengthOf(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not duplicate transition attributes on island contents', async () => {
|
|
||||||
let res = await fixture.fetch('/hasIsland');
|
|
||||||
let html = await res.text();
|
|
||||||
let $ = cheerio.load(html);
|
|
||||||
expect($('astro-island[data-astro-transition-persist]')).to.have.a.lengthOf(1);
|
|
||||||
expect(
|
|
||||||
$('astro-island[data-astro-transition-persist] > [data-astro-transition-persist]')
|
|
||||||
).to.have.a.lengthOf(0);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,8 +44,5 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1"
|
"node": ">=18.14.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# @astrojs/alpinejs
|
# @astrojs/alpinejs
|
||||||
|
|
||||||
## 0.3.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
## 0.3.0
|
## 0.3.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/alpinejs",
|
"name": "@astrojs/alpinejs",
|
||||||
"description": "Use Alpine within Astro",
|
"description": "Use Alpine within Astro",
|
||||||
"version": "0.3.1",
|
"version": "0.3.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -39,8 +39,5 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "workspace:*",
|
"astro": "workspace:*",
|
||||||
"astro-scripts": "workspace:*"
|
"astro-scripts": "workspace:*"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,5 @@
|
||||||
# @astrojs/cloudflare
|
# @astrojs/cloudflare
|
||||||
|
|
||||||
## 7.5.2
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8766](https://github.com/withastro/astro/pull/8766) [`054c5c644`](https://github.com/withastro/astro/commit/054c5c6447d79dd4ea7ab6ce0f9ec836abebd211) Thanks [@jadbox](https://github.com/jadbox)! - Adds `cloudflare:sockets` compile support
|
|
||||||
|
|
||||||
- [#8788](https://github.com/withastro/astro/pull/8788) [`0ab6bad7d`](https://github.com/withastro/astro/commit/0ab6bad7dffd413c975ab00e545f8bc150f6a92f) Thanks [@alexanderniebuhr](https://github.com/alexanderniebuhr)! - Adds support for `node:crypto`
|
|
||||||
|
|
||||||
- Updated dependencies [[`160d1cd75`](https://github.com/withastro/astro/commit/160d1cd755e70af1d8ec294d01dd2cb32d60db50), [`30de32436`](https://github.com/withastro/astro/commit/30de324361bc261956eb9fc08fe60a82ff602a9b), [`c4a7ec425`](https://github.com/withastro/astro/commit/c4a7ec4255e7acb9555cb8bb74ea13c5fbb2ac17), [`c24f70d91`](https://github.com/withastro/astro/commit/c24f70d91601dd3a6b5a84f04d61824e775e9b44), [`93b092266`](https://github.com/withastro/astro/commit/93b092266febfad16a48575f8eee12d5910bf071), [`29cdfa024`](https://github.com/withastro/astro/commit/29cdfa024886dd581cb207586f7dfec6966bdd4e), [`eaed844ea`](https://github.com/withastro/astro/commit/eaed844ea8f2f52e0c9caa40bb3ec7377e10595f)]:
|
|
||||||
- astro@3.2.4
|
|
||||||
- @astrojs/underscore-redirects@0.3.1
|
|
||||||
|
|
||||||
## 7.5.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
- Updated dependencies [[`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`d78806dfe`](https://github.com/withastro/astro/commit/d78806dfe0301ea7ffe6c7c1f783bd415ac7cda9), [`d1c75fe15`](https://github.com/withastro/astro/commit/d1c75fe158839699c59728cf3a83888e8c72a459), [`aa265d730`](https://github.com/withastro/astro/commit/aa265d73024422967c1b1c68ad268c419c6c798f), [`78adbc443`](https://github.com/withastro/astro/commit/78adbc4433208458291e36713909762e148e1e5d), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436), [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7)]:
|
|
||||||
- @astrojs/underscore-redirects@0.3.1
|
|
||||||
- astro@3.2.3
|
|
||||||
|
|
||||||
## 7.5.0
|
## 7.5.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
|
@ -169,7 +169,7 @@ default: `false`
|
||||||
|
|
||||||
Whether or not to import `.wasm` files [directly as ES modules](https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration) using the `.wasm?module` import syntax.
|
Whether or not to import `.wasm` files [directly as ES modules](https://github.com/WebAssembly/esm-integration/tree/main/proposals/esm-integration) using the `.wasm?module` import syntax.
|
||||||
|
|
||||||
Add `wasmModuleImports: true` to `astro.config.mjs` to enable this functionality in both the Cloudflare build and the Astro dev server. Read more about [using Wasm modules](#use-wasm-modules).
|
Add `wasmModuleImports: true` to `astro.config.mjs` to enable this functionality in both the Cloudflare build and the Astro dev server. Read more about [using Wasm modules](#use-wasm-modules)
|
||||||
|
|
||||||
```diff lang="js"
|
```diff lang="js"
|
||||||
// astro.config.mjs
|
// astro.config.mjs
|
||||||
|
@ -221,7 +221,7 @@ Currently supported bindings:
|
||||||
- [Cloudflare Workers KV](https://developers.cloudflare.com/kv/)
|
- [Cloudflare Workers KV](https://developers.cloudflare.com/kv/)
|
||||||
- [Cloudflare Durable Objects](https://developers.cloudflare.com/durable-objects/)
|
- [Cloudflare Durable Objects](https://developers.cloudflare.com/durable-objects/)
|
||||||
|
|
||||||
You can access the runtime from Astro components through `Astro.locals` inside any `.astro` file.
|
You can access the runtime from Astro components through `Astro.locals` inside any .astro` file.
|
||||||
|
|
||||||
```astro
|
```astro
|
||||||
---
|
---
|
||||||
|
@ -339,7 +339,6 @@ Astro's Cloudflare adapter allows you to use any Node.js runtime API supported b
|
||||||
- assert
|
- assert
|
||||||
- AsyncLocalStorage
|
- AsyncLocalStorage
|
||||||
- Buffer
|
- Buffer
|
||||||
- Crypto
|
|
||||||
- Diagnostics Channel
|
- Diagnostics Channel
|
||||||
- EventEmitter
|
- EventEmitter
|
||||||
- path
|
- path
|
||||||
|
@ -358,10 +357,6 @@ import { Buffer } from 'node:buffer';
|
||||||
|
|
||||||
Additionally, you'll need to enable the Compatibility Flag in Cloudflare. The configuration for this flag may vary based on where you deploy your Astro site. For detailed guidance, please refer to the [Cloudflare documentation on enabling Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs).
|
Additionally, you'll need to enable the Compatibility Flag in Cloudflare. The configuration for this flag may vary based on where you deploy your Astro site. For detailed guidance, please refer to the [Cloudflare documentation on enabling Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs).
|
||||||
|
|
||||||
## Cloudflare module support
|
|
||||||
|
|
||||||
All Cloudflare namespaced packages (e.g. `cloudflare:sockets`) are allowlisted for use. Note that the package `cloudflare:sockets` does not work locally without using Wrangler dev mode.
|
|
||||||
|
|
||||||
## Preview with Wrangler
|
## Preview with Wrangler
|
||||||
|
|
||||||
To use [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) to run your application locally, update the preview script:
|
To use [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) to run your application locally, update the preview script:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/cloudflare",
|
"name": "@astrojs/cloudflare",
|
||||||
"description": "Deploy your site to Cloudflare Workers/Pages",
|
"description": "Deploy your site to Cloudflare Workers/Pages",
|
||||||
"version": "7.5.2",
|
"version": "7.5.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
"vite": "^4.4.9"
|
"vite": "^4.4.9"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^3.2.4"
|
"astro": "workspace:^3.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/iarna__toml": "^2.0.2",
|
"@types/iarna__toml": "^2.0.2",
|
||||||
|
@ -58,8 +58,5 @@
|
||||||
"cheerio": "1.0.0-rc.12",
|
"cheerio": "1.0.0-rc.12",
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.2.0",
|
||||||
"wrangler": "^3.5.1"
|
"wrangler": "^3.5.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
import type {
|
import type { Request as CFRequest, ExecutionContext } from '@cloudflare/workers-types';
|
||||||
Request as CFRequest,
|
|
||||||
CacheStorage,
|
|
||||||
ExecutionContext,
|
|
||||||
} from '@cloudflare/workers-types';
|
|
||||||
import type { SSRManifest } from 'astro';
|
import type { SSRManifest } from 'astro';
|
||||||
import { App } from 'astro/app';
|
import { App } from 'astro/app';
|
||||||
import { getProcessEnvProxy, isNode } from '../util.js';
|
import { getProcessEnvProxy, isNode } from '../util.js';
|
||||||
|
@ -20,7 +16,7 @@ export interface AdvancedRuntime<T extends object = object> {
|
||||||
waitUntil: (promise: Promise<any>) => void;
|
waitUntil: (promise: Promise<any>) => void;
|
||||||
env: Env & T;
|
env: Env & T;
|
||||||
cf: CFRequest['cf'];
|
cf: CFRequest['cf'];
|
||||||
caches: CacheStorage;
|
caches: typeof caches;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +50,7 @@ export function createExports(manifest: SSRManifest) {
|
||||||
},
|
},
|
||||||
env: env,
|
env: env,
|
||||||
cf: request.cf,
|
cf: request.cf,
|
||||||
caches: caches as unknown as CacheStorage,
|
caches: caches,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Request as CFRequest, CacheStorage, EventContext } from '@cloudflare/workers-types';
|
import type { Request as CFRequest, EventContext } from '@cloudflare/workers-types';
|
||||||
import type { SSRManifest } from 'astro';
|
import type { SSRManifest } from 'astro';
|
||||||
import { App } from 'astro/app';
|
import { App } from 'astro/app';
|
||||||
import { getProcessEnvProxy, isNode } from '../util.js';
|
import { getProcessEnvProxy, isNode } from '../util.js';
|
||||||
|
@ -6,12 +6,13 @@ import { getProcessEnvProxy, isNode } from '../util.js';
|
||||||
if (!isNode) {
|
if (!isNode) {
|
||||||
process.env = getProcessEnvProxy();
|
process.env = getProcessEnvProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DirectoryRuntime<T extends object = object> {
|
export interface DirectoryRuntime<T extends object = object> {
|
||||||
runtime: {
|
runtime: {
|
||||||
waitUntil: (promise: Promise<any>) => void;
|
waitUntil: (promise: Promise<any>) => void;
|
||||||
env: EventContext<unknown, string, unknown>['env'] & T;
|
env: EventContext<unknown, string, unknown>['env'] & T;
|
||||||
cf: CFRequest['cf'];
|
cf: CFRequest['cf'];
|
||||||
caches: CacheStorage;
|
caches: typeof caches;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ export function createExports(manifest: SSRManifest) {
|
||||||
},
|
},
|
||||||
env: context.env,
|
env: context.env,
|
||||||
cf: request.cf,
|
cf: request.cf,
|
||||||
caches: caches as unknown as CacheStorage,
|
caches: caches,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'node:assert',
|
'node:assert',
|
||||||
'node:async_hooks',
|
'node:async_hooks',
|
||||||
'node:buffer',
|
'node:buffer',
|
||||||
'node:crypto',
|
|
||||||
'node:diagnostics_channel',
|
'node:diagnostics_channel',
|
||||||
'node:events',
|
'node:events',
|
||||||
'node:path',
|
'node:path',
|
||||||
|
@ -291,7 +290,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'node:stream',
|
'node:stream',
|
||||||
'node:string_decoder',
|
'node:string_decoder',
|
||||||
'node:util',
|
'node:util',
|
||||||
'cloudflare:*',
|
|
||||||
],
|
],
|
||||||
entryPoints: pathsGroup,
|
entryPoints: pathsGroup,
|
||||||
outbase: absolutePagesDirname,
|
outbase: absolutePagesDirname,
|
||||||
|
@ -366,7 +364,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'node:assert',
|
'node:assert',
|
||||||
'node:async_hooks',
|
'node:async_hooks',
|
||||||
'node:buffer',
|
'node:buffer',
|
||||||
'node:crypto',
|
|
||||||
'node:diagnostics_channel',
|
'node:diagnostics_channel',
|
||||||
'node:events',
|
'node:events',
|
||||||
'node:path',
|
'node:path',
|
||||||
|
@ -374,7 +371,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'node:stream',
|
'node:stream',
|
||||||
'node:string_decoder',
|
'node:string_decoder',
|
||||||
'node:util',
|
'node:util',
|
||||||
'cloudflare:*',
|
|
||||||
],
|
],
|
||||||
entryPoints: [entryPath],
|
entryPoints: [entryPath],
|
||||||
outfile: buildPath,
|
outfile: buildPath,
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# @astrojs/lit
|
# @astrojs/lit
|
||||||
|
|
||||||
## 3.0.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
## 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/lit",
|
"name": "@astrojs/lit",
|
||||||
"version": "3.0.1",
|
"version": "3.0.0",
|
||||||
"description": "Use Lit components within Astro",
|
"description": "Use Lit components within Astro",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
|
@ -59,8 +59,5 @@
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@webcomponents/template-shadowroot": "^0.2.1",
|
"@webcomponents/template-shadowroot": "^0.2.1",
|
||||||
"lit": "^2.7.0"
|
"lit": "^2.7.0"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
# @astrojs/markdoc
|
# @astrojs/markdoc
|
||||||
|
|
||||||
## 0.5.2
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
- Updated dependencies [[`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`d78806dfe`](https://github.com/withastro/astro/commit/d78806dfe0301ea7ffe6c7c1f783bd415ac7cda9), [`d1c75fe15`](https://github.com/withastro/astro/commit/d1c75fe158839699c59728cf3a83888e8c72a459), [`aa265d730`](https://github.com/withastro/astro/commit/aa265d73024422967c1b1c68ad268c419c6c798f), [`78adbc443`](https://github.com/withastro/astro/commit/78adbc4433208458291e36713909762e148e1e5d), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436), [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7)]:
|
|
||||||
- @astrojs/internal-helpers@0.2.1
|
|
||||||
- astro@3.2.3
|
|
||||||
|
|
||||||
## 0.5.1
|
## 0.5.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/markdoc",
|
"name": "@astrojs/markdoc",
|
||||||
"description": "Add support for Markdoc in your Astro site",
|
"description": "Add support for Markdoc in your Astro site",
|
||||||
"version": "0.5.2",
|
"version": "0.5.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
"zod": "3.21.1"
|
"zod": "3.21.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^3.2.4"
|
"astro": "workspace:^3.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/markdown-remark": "workspace:*",
|
"@astrojs/markdown-remark": "workspace:*",
|
||||||
|
@ -94,8 +94,5 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1"
|
"node": ">=18.14.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
# @astrojs/mdx
|
# @astrojs/mdx
|
||||||
|
|
||||||
## 1.1.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
- Updated dependencies [[`21f482657`](https://github.com/withastro/astro/commit/21f4826576c2c812a1604e18717799da3470decd), [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`d78806dfe`](https://github.com/withastro/astro/commit/d78806dfe0301ea7ffe6c7c1f783bd415ac7cda9), [`d1c75fe15`](https://github.com/withastro/astro/commit/d1c75fe158839699c59728cf3a83888e8c72a459), [`aa265d730`](https://github.com/withastro/astro/commit/aa265d73024422967c1b1c68ad268c419c6c798f), [`78adbc443`](https://github.com/withastro/astro/commit/78adbc4433208458291e36713909762e148e1e5d), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436), [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7)]:
|
|
||||||
- @astrojs/markdown-remark@3.2.1
|
|
||||||
- astro@3.2.3
|
|
||||||
|
|
||||||
## 1.1.0
|
## 1.1.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/mdx",
|
"name": "@astrojs/mdx",
|
||||||
"description": "Add support for MDX pages in your Astro site",
|
"description": "Add support for MDX pages in your Astro site",
|
||||||
"version": "1.1.1",
|
"version": "1.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
"vfile": "^5.3.7"
|
"vfile": "^5.3.7"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^3.2.4"
|
"astro": "workspace:^3.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.3.5",
|
"@types/chai": "^4.3.5",
|
||||||
|
@ -79,8 +79,5 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1"
|
"node": ">=18.14.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,14 +116,14 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
|
||||||
if (!id.endsWith('.mdx')) return;
|
if (!id.endsWith('.mdx')) return;
|
||||||
|
|
||||||
// Read code from file manually to prevent Vite from parsing `import.meta.env` expressions
|
// Read code from file manually to prevent Vite from parsing `import.meta.env` expressions
|
||||||
const { fileId, fileUrl } = getFileInfo(id, config);
|
const { fileId } = getFileInfo(id, config);
|
||||||
const code = await fs.readFile(fileId, 'utf-8');
|
const code = await fs.readFile(fileId, 'utf-8');
|
||||||
|
|
||||||
const { data: frontmatter, content: pageContent } = parseFrontmatter(code, id);
|
const { data: frontmatter, content: pageContent } = parseFrontmatter(code, id);
|
||||||
|
|
||||||
const vfile = new VFile({ value: pageContent, path: id });
|
const vfile = new VFile({ value: pageContent, path: id });
|
||||||
// Ensure `data.astro` is available to all remark plugins
|
// Ensure `data.astro` is available to all remark plugins
|
||||||
setVfileFrontmatter(vfile, frontmatter, { fileURL: new URL(fileUrl) });
|
setVfileFrontmatter(vfile, frontmatter);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const compiled = await processor.process(vfile);
|
const compiled = await processor.process(vfile);
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
# @astrojs/node
|
# @astrojs/node
|
||||||
|
|
||||||
## 6.0.3
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
- Updated dependencies [[`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c), [`d78806dfe`](https://github.com/withastro/astro/commit/d78806dfe0301ea7ffe6c7c1f783bd415ac7cda9), [`d1c75fe15`](https://github.com/withastro/astro/commit/d1c75fe158839699c59728cf3a83888e8c72a459), [`aa265d730`](https://github.com/withastro/astro/commit/aa265d73024422967c1b1c68ad268c419c6c798f), [`78adbc443`](https://github.com/withastro/astro/commit/78adbc4433208458291e36713909762e148e1e5d), [`21e0757ea`](https://github.com/withastro/astro/commit/21e0757ea22a57d344c934045ca19db93b684436), [`357270f2a`](https://github.com/withastro/astro/commit/357270f2a3d0bf2aa634ba7e52e9d17618eff4a7)]:
|
|
||||||
- astro@3.2.3
|
|
||||||
|
|
||||||
## 6.0.2
|
## 6.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/node",
|
"name": "@astrojs/node",
|
||||||
"description": "Deploy your site to a Node.js server",
|
"description": "Deploy your site to a Node.js server",
|
||||||
"version": "6.0.3",
|
"version": "6.0.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
"server-destroy": "^1.0.1"
|
"server-destroy": "^1.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "workspace:^3.2.4"
|
"astro": "workspace:^3.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.17.8",
|
"@types/node": "^18.17.8",
|
||||||
|
@ -49,9 +49,7 @@
|
||||||
"cheerio": "1.0.0-rc.12",
|
"cheerio": "1.0.0-rc.12",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.2.0",
|
||||||
"node-mocks-http": "^1.13.0"
|
"node-mocks-http": "^1.13.0",
|
||||||
},
|
"undici": "^5.23.0"
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,15 @@ import type { OutgoingHttpHeaders } from 'node:http';
|
||||||
* @returns NodeJS OutgoingHttpHeaders object with multiple set-cookie handled as an array of values
|
* @returns NodeJS OutgoingHttpHeaders object with multiple set-cookie handled as an array of values
|
||||||
*/
|
*/
|
||||||
export const createOutgoingHttpHeaders = (
|
export const createOutgoingHttpHeaders = (
|
||||||
headers: Headers | undefined | null
|
webHeaders: Headers | undefined | null
|
||||||
): OutgoingHttpHeaders | undefined => {
|
): OutgoingHttpHeaders | undefined => {
|
||||||
if (!headers) {
|
if (!webHeaders) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// re-type to access Header.getSetCookie()
|
||||||
|
const headers = webHeaders as HeadersWithGetSetCookie;
|
||||||
|
|
||||||
// at this point, a multi-value'd set-cookie header is invalid (it was concatenated as a single CSV, which is not valid for set-cookie)
|
// at this point, a multi-value'd set-cookie header is invalid (it was concatenated as a single CSV, which is not valid for set-cookie)
|
||||||
const nodeHeaders: OutgoingHttpHeaders = Object.fromEntries(headers.entries());
|
const nodeHeaders: OutgoingHttpHeaders = Object.fromEntries(headers.entries());
|
||||||
|
|
||||||
|
@ -23,8 +26,7 @@ export const createOutgoingHttpHeaders = (
|
||||||
|
|
||||||
// if there is > 1 set-cookie header, we have to fix it to be an array of values
|
// if there is > 1 set-cookie header, we have to fix it to be an array of values
|
||||||
if (headers.has('set-cookie')) {
|
if (headers.has('set-cookie')) {
|
||||||
// @ts-expect-error
|
const cookieHeaders = headers.getSetCookie();
|
||||||
const cookieHeaders = headers.getSetCookie() as string[];
|
|
||||||
if (cookieHeaders.length > 1) {
|
if (cookieHeaders.length > 1) {
|
||||||
// the Headers.entries() API already normalized all header names to lower case so we can safely index this as 'set-cookie'
|
// the Headers.entries() API already normalized all header names to lower case so we can safely index this as 'set-cookie'
|
||||||
nodeHeaders['set-cookie'] = cookieHeaders;
|
nodeHeaders['set-cookie'] = cookieHeaders;
|
||||||
|
@ -33,3 +35,8 @@ export const createOutgoingHttpHeaders = (
|
||||||
|
|
||||||
return nodeHeaders;
|
return nodeHeaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface HeadersWithGetSetCookie extends Headers {
|
||||||
|
// the @astrojs/webapi polyfill makes this available (as of undici@5.19.0), but tsc doesn't pick it up on the built-in Headers type from DOM lib
|
||||||
|
getSetCookie(): string[];
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
# @astrojs/partytown
|
# @astrojs/partytown
|
||||||
|
|
||||||
## 2.0.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
- [#8740](https://github.com/withastro/astro/pull/8740) [`f277ba8b7`](https://github.com/withastro/astro/commit/f277ba8b703037635bc7adee84d51eaf7dafd388) Thanks [@florian-lefebvre](https://github.com/florian-lefebvre)! - Expose types for TypeScript users
|
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/partytown",
|
"name": "@astrojs/partytown",
|
||||||
"description": "Use Partytown to move scripts into a web worker in your Astro project",
|
"description": "Use Partytown to move scripts into a web worker in your Astro project",
|
||||||
"version": "2.0.1",
|
"version": "2.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -38,8 +38,5 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "workspace:*",
|
"astro": "workspace:*",
|
||||||
"astro-scripts": "workspace:*"
|
"astro-scripts": "workspace:*"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
|
||||||
import sirv from './sirv.js';
|
import sirv from './sirv.js';
|
||||||
const resolve = createRequire(import.meta.url).resolve;
|
const resolve = createRequire(import.meta.url).resolve;
|
||||||
|
|
||||||
export type PartytownOptions = {
|
type PartytownOptions = {
|
||||||
config?: PartytownConfig;
|
config?: PartytownConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# @astrojs/preact
|
# @astrojs/preact
|
||||||
|
|
||||||
## 3.0.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
## 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/preact",
|
"name": "@astrojs/preact",
|
||||||
"description": "Use Preact components within Astro",
|
"description": "Use Preact components within Astro",
|
||||||
"version": "3.0.1",
|
"version": "3.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -52,8 +52,5 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1"
|
"node": ">=18.14.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# @astrojs/prefetch
|
# @astrojs/prefetch
|
||||||
|
|
||||||
## 0.4.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/prefetch",
|
"name": "@astrojs/prefetch",
|
||||||
"description": "Prefetch page navigations in your Astro site",
|
"description": "Prefetch page navigations in your Astro site",
|
||||||
"version": "0.4.1",
|
"version": "0.4.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -40,8 +40,5 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"throttles": "^1.0.1"
|
"throttles": "^1.0.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# @astrojs/react
|
# @astrojs/react
|
||||||
|
|
||||||
## 3.0.3
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#8737](https://github.com/withastro/astro/pull/8737) [`6f60da805`](https://github.com/withastro/astro/commit/6f60da805e0014bc50dd07bef972e91c73560c3c) Thanks [@ematipico](https://github.com/ematipico)! - Add provenance statement when publishing the library from CI
|
|
||||||
|
|
||||||
## 3.0.2
|
## 3.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@astrojs/react",
|
"name": "@astrojs/react",
|
||||||
"description": "Use React components within Astro",
|
"description": "Use React components within Astro",
|
||||||
"version": "3.0.3",
|
"version": "3.0.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"author": "withastro",
|
"author": "withastro",
|
||||||
|
@ -67,8 +67,5 @@
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.1"
|
"node": ">=18.14.1"
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"provenance": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue