Compare commits
2 commits
main
...
feat/no-ba
Author | SHA1 | Date | |
---|---|---|---|
|
797b121465 | ||
|
27875ae0e9 |
163 changed files with 391 additions and 654 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.
|
|
9
.changeset/great-bears-watch.md
Normal file
9
.changeset/great-bears-watch.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
|
5
.changeset/sharp-insects-yawn.md
Normal file
5
.changeset/sharp-insects-yawn.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Make CSS chunk names less confusing
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
'@astrojs/cloudflare': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fixes `AdvancedRuntime` & `DirectoryRuntime` types to work woth Cloudflare caches
|
|
5
.changeset/young-taxis-battle.md
Normal file
5
.changeset/young-taxis-battle.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix an issue where HTML attributes do not render if getHTMLAttributes in an image service returns a Promise
|
|
@ -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
|
||||||
|
|
||||||
|
|
24
.github/workflows/test-hosts.yml
vendored
24
.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:
|
||||||
|
@ -32,20 +34,22 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Build Astro
|
|
||||||
run: pnpm turbo build --filter astro --filter @astrojs/vercel
|
|
||||||
|
|
||||||
- name: Build test project
|
- name: Install Hosts CLIs
|
||||||
|
run: pnpm install --global netlify-cli vercel
|
||||||
|
|
||||||
|
- 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
|
|
||||||
working-directory: ./packages/integrations/vercel/test/hosted/hosted-astro-project
|
|
||||||
run:
|
|
||||||
pnpm dlx vercel --prod --prebuilt
|
|
||||||
|
|
||||||
- name: Test
|
- name: Deploy Netlify
|
||||||
|
working-directory: ./packages/integrations/netlify/test/hosted/hosted-astro-project
|
||||||
|
run:
|
||||||
|
pnpm run build
|
||||||
|
netlify deploy --prod
|
||||||
|
|
||||||
|
- 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) | [](packages/integrations/svelte/CHANGELOG.md) |
|
| [@astrojs/svelte](packages/integrations/svelte) | [](packages/integrations/svelte/CHANGELOG.md) |
|
||||||
| [@astrojs/vue](packages/integrations/vue) | [](packages/integrations/vue/CHANGELOG.md) |
|
| [@astrojs/vue](packages/integrations/vue) | [](packages/integrations/vue/CHANGELOG.md) |
|
||||||
| [@astrojs/lit](packages/integrations/lit) | [](packages/integrations/lit/CHANGELOG.md) |
|
| [@astrojs/lit](packages/integrations/lit) | [](packages/integrations/lit/CHANGELOG.md) |
|
||||||
|
| [@astrojs/deno](packages/integrations/deno) | [](packages/integrations/deno/CHANGELOG.md) |
|
||||||
|
| [@astrojs/netlify](packages/integrations/netlify) | [](packages/integrations/netlify/CHANGELOG.md) |
|
||||||
| [@astrojs/node](packages/integrations/node) | [](packages/integrations/node/CHANGELOG.md) |
|
| [@astrojs/node](packages/integrations/node) | [](packages/integrations/node/CHANGELOG.md) |
|
||||||
| [@astrojs/vercel](packages/integrations/vercel) | [](packages/integrations/vercel/CHANGELOG.md) |
|
| [@astrojs/vercel](packages/integrations/vercel) | [](packages/integrations/vercel/CHANGELOG.md) |
|
||||||
| [@astrojs/cloudflare](packages/integrations/cloudflare) | [](packages/integrations/cloudflare/CHANGELOG.md) |
|
| [@astrojs/cloudflare](packages/integrations/cloudflare) | [](packages/integrations/cloudflare/CHANGELOG.md) |
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
"@astrojs/mdx": "^1.1.1",
|
"@astrojs/mdx": "^1.1.1",
|
||||||
"@astrojs/rss": "^3.0.0",
|
"@astrojs/rss": "^3.0.0",
|
||||||
"@astrojs/sitemap": "^3.0.1",
|
"@astrojs/sitemap": "^3.0.1",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^2.0.0-beta.0"
|
"astro": "^2.0.0-beta.0"
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
"@astrojs/alpinejs": "^0.3.1",
|
"@astrojs/alpinejs": "^0.3.1",
|
||||||
"@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.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/lit": "^3.0.1",
|
"@astrojs/lit": "^3.0.1",
|
||||||
"@webcomponents/template-shadowroot": "^0.2.1",
|
"@webcomponents/template-shadowroot": "^0.2.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"lit": "^2.8.0"
|
"lit": "^2.8.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"@astrojs/solid-js": "^3.0.2",
|
"@astrojs/solid-js": "^3.0.2",
|
||||||
"@astrojs/svelte": "^4.0.3",
|
"@astrojs/svelte": "^4.0.3",
|
||||||
"@astrojs/vue": "^3.0.1",
|
"@astrojs/vue": "^3.0.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"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",
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.1",
|
||||||
"@preact/signals": "^1.2.1",
|
"@preact/signals": "^1.2.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"preact": "^10.17.1"
|
"preact": "^10.17.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"@astrojs/react": "^3.0.3",
|
"@astrojs/react": "^3.0.3",
|
||||||
"@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.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/solid-js": "^3.0.2",
|
"@astrojs/solid-js": "^3.0.2",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"solid-js": "^1.7.11"
|
"solid-js": "^1.7.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/svelte": "^4.0.3",
|
"@astrojs/svelte": "^4.0.3",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"svelte": "^4.2.0"
|
"svelte": "^4.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/vue": "^3.0.1",
|
"@astrojs/vue": "^3.0.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"vue": "^3.3.4"
|
"vue": "^3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.3",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^2.0.0-beta.0"
|
"astro": "^2.0.0-beta.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.3",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"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.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.3",
|
||||||
"@astrojs/svelte": "^4.0.3",
|
"@astrojs/svelte": "^4.0.3",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"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.1",
|
||||||
"@astrojs/node": "^6.0.3",
|
"@astrojs/node": "^6.0.3",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdoc": "^0.5.2",
|
"@astrojs/markdoc": "^0.5.2",
|
||||||
"astro": "^3.2.4"
|
"astro": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdown-remark": "^3.2.1",
|
"@astrojs/markdown-remark": "^3.2.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"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.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^1.1.1",
|
"@astrojs/mdx": "^1.1.1",
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.1",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"preact": "^10.17.1"
|
"preact": "^10.17.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/preact": "^3.0.1",
|
"@astrojs/preact": "^3.0.1",
|
||||||
"@nanostores/preact": "^0.5.0",
|
"@nanostores/preact": "^0.5.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"nanostores": "^0.9.3",
|
"nanostores": "^0.9.3",
|
||||||
"preact": "^10.17.1"
|
"preact": "^10.17.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^1.1.1",
|
"@astrojs/mdx": "^1.1.1",
|
||||||
"@astrojs/tailwind": "^5.0.2",
|
"@astrojs/tailwind": "^5.0.1",
|
||||||
"@types/canvas-confetti": "^1.6.0",
|
"@types/canvas-confetti": "^1.6.0",
|
||||||
"astro": "^3.2.4",
|
"astro": "^3.2.3",
|
||||||
"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.3",
|
||||||
"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.3",
|
||||||
"vitest": "^0.34.2"
|
"vitest": "^0.34.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +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
|
## 3.2.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -32,13 +32,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'));
|
||||||
|
@ -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.3",
|
||||||
"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",
|
||||||
|
|
|
@ -16,9 +16,9 @@ import type * as vite from 'vite';
|
||||||
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||||
import type { SerializedSSRManifest } from '../core/app/types.js';
|
import type { SerializedSSRManifest } from '../core/app/types.js';
|
||||||
import type { PageBuildData } from '../core/build/types.js';
|
import type { PageBuildData } from '../core/build/types.js';
|
||||||
import type { AstroConfigType } from '../core/config/index.js';
|
import type { AstroConfigType } from '../core/config/schema.js';
|
||||||
import type { AstroTimer } from '../core/config/timer.js';
|
import type { AstroTimer } from '../core/config/timer.js';
|
||||||
import type { AstroCookies } from '../core/cookies/index.js';
|
import type { AstroCookies } from '../core/cookies/cookies.js';
|
||||||
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
||||||
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
||||||
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
|
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
|
||||||
|
@ -52,7 +52,7 @@ export type {
|
||||||
} from '../assets/types.js';
|
} from '../assets/types.js';
|
||||||
export type { RemotePattern } from '../assets/utils/remotePattern.js';
|
export type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||||
export type { SSRManifest } from '../core/app/types.js';
|
export type { SSRManifest } from '../core/app/types.js';
|
||||||
export type { AstroCookies } from '../core/cookies/index.js';
|
export type { AstroCookies };
|
||||||
|
|
||||||
export interface AstroBuiltinProps {
|
export interface AstroBuiltinProps {
|
||||||
'client:load'?: boolean;
|
'client:load'?: boolean;
|
||||||
|
|
|
@ -9,14 +9,10 @@ import ora from 'ora';
|
||||||
import preferredPM from 'preferred-pm';
|
import preferredPM from 'preferred-pm';
|
||||||
import prompts from 'prompts';
|
import prompts from 'prompts';
|
||||||
import type yargs from 'yargs-parser';
|
import type yargs from 'yargs-parser';
|
||||||
import {
|
import { resolveConfig, resolveConfigPath, resolveRoot } from '../../core/config/config.js';
|
||||||
loadTSConfig,
|
|
||||||
resolveConfig,
|
|
||||||
resolveConfigPath,
|
|
||||||
resolveRoot,
|
|
||||||
} from '../../core/config/index.js';
|
|
||||||
import {
|
import {
|
||||||
defaultTSConfig,
|
defaultTSConfig,
|
||||||
|
loadTSConfig,
|
||||||
presets,
|
presets,
|
||||||
updateTSConfigForFramework,
|
updateTSConfigForFramework,
|
||||||
type frameworkWithTSSettings,
|
type frameworkWithTSSettings,
|
||||||
|
@ -50,7 +46,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 +70,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 +156,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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { cyan } from 'kleur/colors';
|
import { cyan } from 'kleur/colors';
|
||||||
import type yargs from 'yargs-parser';
|
import type yargs from 'yargs-parser';
|
||||||
import devServer from '../../core/dev/index.js';
|
import devServer from '../../core/dev/dev.js';
|
||||||
import { printHelp } from '../../core/messages.js';
|
import { printHelp } from '../../core/messages.js';
|
||||||
import { flagsToAstroInlineConfig } from '../flags.js';
|
import { flagsToAstroInlineConfig } from '../flags.js';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { execSync } from 'node:child_process';
|
||||||
import { arch, platform } from 'node:os';
|
import { arch, platform } from 'node:os';
|
||||||
import prompts from 'prompts';
|
import prompts from 'prompts';
|
||||||
import type yargs from 'yargs-parser';
|
import type yargs from 'yargs-parser';
|
||||||
import { resolveConfig } from '../../core/config/index.js';
|
import { resolveConfig } from '../../core/config/config.js';
|
||||||
import { ASTRO_VERSION } from '../../core/constants.js';
|
import { ASTRO_VERSION } from '../../core/constants.js';
|
||||||
import { flagsToAstroInlineConfig } from '../flags.js';
|
import { flagsToAstroInlineConfig } from '../flags.js';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ export function getViteConfig(inlineConfig: UserConfig) {
|
||||||
fs,
|
fs,
|
||||||
{ mergeConfig },
|
{ mergeConfig },
|
||||||
{ nodeLogDestination },
|
{ nodeLogDestination },
|
||||||
{ resolveConfig, createSettings },
|
{ resolveConfig },
|
||||||
|
{ createSettings },
|
||||||
{ createVite },
|
{ createVite },
|
||||||
{ runHookConfigSetup, runHookConfigDone },
|
{ runHookConfigSetup, runHookConfigDone },
|
||||||
{ astroContentListenPlugin },
|
{ astroContentListenPlugin },
|
||||||
|
@ -25,7 +26,8 @@ export function getViteConfig(inlineConfig: UserConfig) {
|
||||||
import('node:fs'),
|
import('node:fs'),
|
||||||
import('vite'),
|
import('vite'),
|
||||||
import('../core/logger/node.js'),
|
import('../core/logger/node.js'),
|
||||||
import('../core/config/index.js'),
|
import('../core/config/config.js'),
|
||||||
|
import('../core/config/settings.js'),
|
||||||
import('../core/create-vite.js'),
|
import('../core/create-vite.js'),
|
||||||
import('../integrations/index.js'),
|
import('../integrations/index.js'),
|
||||||
import('./vite-plugin-content-listen.js'),
|
import('./vite-plugin-content-listen.js'),
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
export { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from './consts.js';
|
|
||||||
export { errorMap } from './error-map.js';
|
|
||||||
export { attachContentServerListeners } from './server-listeners.js';
|
|
||||||
export { createContentTypesGenerator } from './types-generator.js';
|
|
||||||
export { contentObservable, getContentPaths, getDotAstroTypeReference } from './utils.js';
|
|
||||||
export { astroContentAssetPropagationPlugin } from './vite-plugin-content-assets.js';
|
|
||||||
export { astroContentImportPlugin } from './vite-plugin-content-imports.js';
|
|
||||||
export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
|
|
|
@ -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;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type {
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
import { getSetCookiesFromResponse } from '../cookies/response.js';
|
||||||
import { consoleLogDestination } from '../logger/console.js';
|
import { consoleLogDestination } from '../logger/console.js';
|
||||||
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
||||||
import {
|
import {
|
||||||
|
@ -15,8 +15,9 @@ import {
|
||||||
prependForwardSlash,
|
prependForwardSlash,
|
||||||
removeTrailingForwardSlash,
|
removeTrailingForwardSlash,
|
||||||
} from '../path.js';
|
} from '../path.js';
|
||||||
import { RedirectSinglePageBuiltModule } from '../redirects/index.js';
|
import { RedirectSinglePageBuiltModule } from '../redirects/component.js';
|
||||||
import { createEnvironment, createRenderContext, type RenderContext } from '../render/index.js';
|
import { createRenderContext, type RenderContext } from '../render/context.js';
|
||||||
|
import { createEnvironment } from '../render/environment.js';
|
||||||
import { RouteCache } from '../render/route-cache.js';
|
import { RouteCache } from '../render/route-cache.js';
|
||||||
import {
|
import {
|
||||||
createAssetLink,
|
createAssetLink,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Pipeline } from '../pipeline.js';
|
import { Pipeline } from '../pipeline.js';
|
||||||
import type { Environment } from '../render/index.js';
|
import type { Environment } from '../render/environment.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when an endpoint contains a response with the header "X-Astro-Response" === 'Not-Found'
|
* Thrown when an endpoint contains a response with the header "X-Astro-Response" === 'Not-Found'
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import type { SSRManifest } from '../app/types.js';
|
import type { SSRManifest } from '../app/types.js';
|
||||||
import { Logger } from '../logger/core.js';
|
import { Logger } from '../logger/core.js';
|
||||||
import { Pipeline } from '../pipeline.js';
|
import { Pipeline } from '../pipeline.js';
|
||||||
import { createEnvironment } from '../render/index.js';
|
import { createEnvironment } from '../render/environment.js';
|
||||||
import { createAssetLink } from '../render/ssr-element.js';
|
import { createAssetLink } from '../render/ssr-element.js';
|
||||||
import type { BuildInternals } from './internal.js';
|
import type { BuildInternals } from './internal.js';
|
||||||
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
|
|
|
@ -33,8 +33,9 @@ import { runHookBuildGenerated } from '../../integrations/index.js';
|
||||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { RedirectSinglePageBuiltModule, getRedirectLocationOrThrow } from '../redirects/index.js';
|
import { RedirectSinglePageBuiltModule } from '../redirects/component.js';
|
||||||
import { createRenderContext } from '../render/index.js';
|
import { getRedirectLocationOrThrow } from '../redirects/validate.js';
|
||||||
|
import { createRenderContext } from '../render/context.js';
|
||||||
import { callGetStaticPaths } from '../render/route-cache.js';
|
import { callGetStaticPaths } from '../render/route-cache.js';
|
||||||
import {
|
import {
|
||||||
createAssetLink,
|
createAssetLink,
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { createVite } from '../create-vite.js';
|
||||||
import { Logger, levels, timerMessage } from '../logger/core.js';
|
import { Logger, levels, timerMessage } from '../logger/core.js';
|
||||||
import { apply as applyPolyfill } from '../polyfill.js';
|
import { apply as applyPolyfill } from '../polyfill.js';
|
||||||
import { RouteCache } from '../render/route-cache.js';
|
import { RouteCache } from '../render/route-cache.js';
|
||||||
import { createRouteManifest } from '../routing/index.js';
|
import { createRouteManifest } from '../routing/manifest/create.js';
|
||||||
import { collectPagesData } from './page-data.js';
|
import { collectPagesData } from './page-data.js';
|
||||||
import { staticBuild, viteBuild } from './static-build.js';
|
import { staticBuild, viteBuild } from './static-build.js';
|
||||||
import type { StaticBuildOptions } from './types.js';
|
import type { StaticBuildOptions } from './types.js';
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { runHookBuildSsr } from '../../../integrations/index.js';
|
||||||
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
||||||
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.js';
|
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.js';
|
||||||
import { joinPaths, prependForwardSlash } from '../../path.js';
|
import { joinPaths, prependForwardSlash } from '../../path.js';
|
||||||
import { serializeRouteData } from '../../routing/index.js';
|
import { serializeRouteData } from '../../routing/manifest/serialization.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import { getOutFile, getOutFolder } from '../common.js';
|
import { getOutFile, getOutFolder } from '../common.js';
|
||||||
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { extname } from 'node:path';
|
import { extname } from 'node:path';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroSettings } from '../../../@types/astro.js';
|
import type { AstroSettings } from '../../../@types/astro.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/helpers.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import { type BuildInternals } from '../internal.js';
|
import { type BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin.js';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js';
|
import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js';
|
||||||
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
||||||
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/helpers.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin.js';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { runHookBuildSetup } from '../../integrations/index.js';
|
||||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { routeIsRedirect } from '../redirects/index.js';
|
import { routeIsRedirect } from '../redirects/helpers.js';
|
||||||
import { getOutDirWithinCwd } from './common.js';
|
import { getOutDirWithinCwd } from './common.js';
|
||||||
import { generatePages } from './generate.js';
|
import { generatePages } from './generate.js';
|
||||||
import { trackPageData } from './internal.js';
|
import { trackPageData } from './internal.js';
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export { buildClientDirectiveEntrypoint } from './build.js';
|
|
||||||
export { getDefaultClientDirectives } from './default.js';
|
|
|
@ -1,8 +0,0 @@
|
||||||
export {
|
|
||||||
cachedCompilation,
|
|
||||||
getCachedCompileResult,
|
|
||||||
invalidateCompilation,
|
|
||||||
isCached,
|
|
||||||
} from './cache.js';
|
|
||||||
export type { CompileProps, CompileResult } from './compile.js';
|
|
||||||
export type { TransformStyle } from './types.js';
|
|
|
@ -1,6 +0,0 @@
|
||||||
export { resolveConfig, resolveConfigPath, resolveFlags, resolveRoot } from './config.js';
|
|
||||||
export { createNodeLogger } from './logging.js';
|
|
||||||
export { mergeConfig } from './merge.js';
|
|
||||||
export type { AstroConfigType } from './schema.js';
|
|
||||||
export { createSettings } from './settings.js';
|
|
||||||
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
|
|
@ -2,9 +2,9 @@ import yaml from 'js-yaml';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { getContentPaths } from '../../content/index.js';
|
import { getContentPaths } from '../../content/utils.js';
|
||||||
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
|
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
|
||||||
import { getDefaultClientDirectives } from '../client-directive/index.js';
|
import { getDefaultClientDirectives } from '../client-directive/default.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { formatYAMLException, isYAMLException } from '../errors/utils.js';
|
import { formatYAMLException, isYAMLException } from '../errors/utils.js';
|
||||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js';
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js';
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
export { AstroCookies } from './cookies.js';
|
|
||||||
export {
|
|
||||||
attachCookiesToResponse,
|
|
||||||
getSetCookiesFromResponse,
|
|
||||||
responseHasCookies,
|
|
||||||
} from './response.js';
|
|
|
@ -6,11 +6,9 @@ import { fileURLToPath } from 'node:url';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import { crawlFrameworkPkgs } from 'vitefu';
|
import { crawlFrameworkPkgs } from 'vitefu';
|
||||||
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
||||||
import {
|
import { astroContentAssetPropagationPlugin } from '../content/vite-plugin-content-assets.js';
|
||||||
astroContentAssetPropagationPlugin,
|
import { astroContentImportPlugin } from '../content/vite-plugin-content-imports.js';
|
||||||
astroContentImportPlugin,
|
import { astroContentVirtualModPlugin } from '../content/vite-plugin-content-virtual-mod.js';
|
||||||
astroContentVirtualModPlugin,
|
|
||||||
} from '../content/index.js';
|
|
||||||
import astroTransitions from '../transitions/vite-plugin-transitions.js';
|
import astroTransitions from '../transitions/vite-plugin-transitions.js';
|
||||||
import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js';
|
import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js';
|
||||||
import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js';
|
import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { AddressInfo } from 'node:net';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { AstroInlineConfig } from '../../@types/astro.js';
|
import type { AstroInlineConfig } from '../../@types/astro.js';
|
||||||
import { attachContentServerListeners } from '../../content/index.js';
|
import { attachContentServerListeners } from '../../content/server-listeners.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import * as msg from '../messages.js';
|
import * as msg from '../messages.js';
|
||||||
import { startContainer } from './container.js';
|
import { startContainer } from './container.js';
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { createContainer, startContainer } from './container.js';
|
|
||||||
export { default } from './dev.js';
|
|
||||||
export { createContainerWithAutomaticRestart } from './restart.js';
|
|
|
@ -3,7 +3,9 @@ import { fileURLToPath } from 'node:url';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { eventCliSession, telemetry } from '../../events/index.js';
|
import { eventCliSession, telemetry } from '../../events/index.js';
|
||||||
import { createNodeLogger, createSettings, resolveConfig } from '../config/index.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
|
import { createNodeLogger } from '../config/logging.js';
|
||||||
|
import { createSettings } from '../config/settings.js';
|
||||||
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
||||||
import { isAstroConfigZodError } from '../errors/errors.js';
|
import { isAstroConfigZodError } from '../errors/errors.js';
|
||||||
import { createSafeError } from '../errors/index.js';
|
import { createSafeError } from '../errors/index.js';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { EndpointHandler } from '../../../@types/astro.js';
|
import type { EndpointHandler } from '../../../@types/astro.js';
|
||||||
import { createRenderContext, type SSROptions } from '../../render/index.js';
|
import { createRenderContext } from '../../render/context.js';
|
||||||
|
import type { SSROptions } from '../../render/index.js';
|
||||||
import { callEndpoint } from '../index.js';
|
import { callEndpoint } from '../index.js';
|
||||||
|
|
||||||
export async function call(options: SSROptions) {
|
export async function call(options: SSROptions) {
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
import mime from 'mime';
|
import mime from 'mime';
|
||||||
import type {
|
import {
|
||||||
APIContext,
|
type APIContext,
|
||||||
EndpointHandler,
|
type EndpointHandler,
|
||||||
EndpointOutput,
|
type EndpointOutput,
|
||||||
MiddlewareEndpointHandler,
|
type MiddlewareEndpointHandler,
|
||||||
MiddlewareHandler,
|
type MiddlewareHandler,
|
||||||
Params,
|
type Params,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import { renderEndpoint } from '../../runtime/server/index.js';
|
import { renderEndpoint } from '../../runtime/server/index.js';
|
||||||
import { ASTRO_VERSION } from '../constants.js';
|
import { ASTRO_VERSION } from '../constants.js';
|
||||||
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
|
import { AstroCookies } from '../cookies/cookies.js';
|
||||||
|
import { attachCookiesToResponse } from '../cookies/response.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { callMiddleware } from '../middleware/callMiddleware.js';
|
import { callMiddleware } from '../middleware/callMiddleware.js';
|
||||||
import type { Environment, RenderContext } from '../render/index.js';
|
import type { RenderContext } from '../render/context.js';
|
||||||
|
import type { Environment } from '../render/environment.js';
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as fs from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { getHighlighter } from 'shiki';
|
import { getHighlighter } from 'shiki';
|
||||||
import type { ErrorPayload } from 'vite';
|
import type { ErrorPayload } from 'vite';
|
||||||
import type { ModuleLoader } from '../../module-loader/index.js';
|
import type { ModuleLoader } from '../../module-loader/loader.js';
|
||||||
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from '../errors-data.js';
|
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from '../errors-data.js';
|
||||||
import { AstroError, type ErrorWithMetadata } from '../errors.js';
|
import { AstroError, type ErrorWithMetadata } from '../errors.js';
|
||||||
import { createSafeError } from '../utils.js';
|
import { createSafeError } from '../utils.js';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { AstroInlineConfig } from '../@types/astro.js';
|
||||||
import { default as _build } from './build/index.js';
|
import { default as _build } from './build/index.js';
|
||||||
import { default as _sync } from './sync/index.js';
|
import { default as _sync } from './sync/index.js';
|
||||||
|
|
||||||
export { default as dev } from './dev/index.js';
|
export { default as dev } from './dev/dev.js';
|
||||||
export { default as preview } from './preview/index.js';
|
export { default as preview } from './preview/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,9 +5,9 @@ import type {
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareNext,
|
MiddlewareNext,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import { attachCookiesToResponse, responseHasCookies } from '../cookies/index.js';
|
import { attachCookiesToResponse, responseHasCookies } from '../cookies/response.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Environment } from '../render/index.js';
|
import type { Environment } from '../render/environment.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function that is in charge of calling the middleware.
|
* Utility function that is in charge of calling the middleware.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../@types/astro.js';
|
||||||
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
|
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
|
||||||
import type { ModuleLoader } from '../module-loader/index.js';
|
import type { ModuleLoader } from '../module-loader/loader.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { createLoader } from './loader.js';
|
|
||||||
export type { LoaderEvents, ModuleInfo, ModuleLoader, ModuleNode } from './loader.js';
|
|
||||||
export { createViteLoader } from './vite.js';
|
|
|
@ -7,8 +7,9 @@ import type {
|
||||||
} from '../@types/astro.js';
|
} from '../@types/astro.js';
|
||||||
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
||||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||||
|
import type { RenderContext } from './render/context.js';
|
||||||
import { renderPage } from './render/core.js';
|
import { renderPage } from './render/core.js';
|
||||||
import { type Environment, type RenderContext } from './render/index.js';
|
import type { Environment } from './render/environment.js';
|
||||||
|
|
||||||
type EndpointResultHandler = (
|
type EndpointResultHandler = (
|
||||||
originalRequest: Request,
|
originalRequest: Request,
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { RedirectComponentInstance, RedirectSinglePageBuiltModule } from './component.js';
|
|
||||||
export { redirectRouteGenerate, redirectRouteStatus, routeIsRedirect } from './helpers.js';
|
|
||||||
export { getRedirectLocationOrThrow } from './validate.js';
|
|
|
@ -6,10 +6,14 @@ import type {
|
||||||
MiddlewareResponseHandler,
|
MiddlewareResponseHandler,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
||||||
import { attachCookiesToResponse } from '../cookies/index.js';
|
import { attachCookiesToResponse } from '../cookies/response.js';
|
||||||
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
|
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
|
||||||
import { callMiddleware } from '../middleware/callMiddleware.js';
|
import { callMiddleware } from '../middleware/callMiddleware.js';
|
||||||
import { redirectRouteGenerate, redirectRouteStatus, routeIsRedirect } from '../redirects/index.js';
|
import {
|
||||||
|
redirectRouteGenerate,
|
||||||
|
redirectRouteStatus,
|
||||||
|
routeIsRedirect,
|
||||||
|
} from '../redirects/helpers.js';
|
||||||
import type { RenderContext } from './context.js';
|
import type { RenderContext } from './context.js';
|
||||||
import type { Environment } from './environment.js';
|
import type { Environment } from './environment.js';
|
||||||
import { createResult } from './result.js';
|
import { createResult } from './result.js';
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
|
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
|
||||||
import type { Environment } from './environment.js';
|
import type { Environment } from './environment.js';
|
||||||
export { createRenderContext } from './context.js';
|
|
||||||
export type { RenderContext } from './context.js';
|
|
||||||
export { tryRenderRoute } from './core.js';
|
|
||||||
export { createEnvironment } from './environment.js';
|
|
||||||
export { getParamsAndProps } from './params-and-props.js';
|
|
||||||
export { loadRenderer } from './renderer.js';
|
|
||||||
|
|
||||||
export type { Environment };
|
|
||||||
|
|
||||||
export interface SSROptions {
|
export interface SSROptions {
|
||||||
/** The environment instance */
|
/** The environment instance */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
|
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import { routeIsRedirect } from '../redirects/index.js';
|
import { routeIsRedirect } from '../redirects/helpers.js';
|
||||||
import { getParams } from '../routing/params.js';
|
import { getParams } from '../routing/params.js';
|
||||||
import { RouteCache, callGetStaticPaths, findPathItemByKey } from './route-cache.js';
|
import { RouteCache, callGetStaticPaths, findPathItemByKey } from './route-cache.js';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro.js';
|
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro.js';
|
||||||
import type { ModuleLoader } from '../module-loader/index.js';
|
import type { ModuleLoader } from '../module-loader/loader.js';
|
||||||
|
|
||||||
export async function loadRenderer(
|
export async function loadRenderer(
|
||||||
renderer: AstroRenderer,
|
renderer: AstroRenderer,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
||||||
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
||||||
import { renderJSX } from '../../runtime/server/jsx.js';
|
import { renderJSX } from '../../runtime/server/jsx.js';
|
||||||
import { chunkToString } from '../../runtime/server/render/index.js';
|
import { chunkToString } from '../../runtime/server/render/index.js';
|
||||||
import { AstroCookies } from '../cookies/index.js';
|
import { AstroCookies } from '../cookies/cookies.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
export { createRouteManifest } from './manifest/create.js';
|
|
||||||
export { deserializeRouteData, serializeRouteData } from './manifest/serialization.js';
|
|
||||||
export { matchAllRoutes, matchRoute } from './match.js';
|
|
||||||
export { getParams } from './params.js';
|
|
||||||
export { validateDynamicRouteModule, validateGetStaticPathsResult } from './validation.js';
|
|
|
@ -4,7 +4,7 @@ import { performance } from 'node:perf_hooks';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { createServer, type HMRPayload } from 'vite';
|
import { createServer, type HMRPayload } from 'vite';
|
||||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { createContentTypesGenerator } from '../../content/index.js';
|
import { createContentTypesGenerator } from '../../content/types-generator.js';
|
||||||
import { globalContentConfigObserver } from '../../content/utils.js';
|
import { globalContentConfigObserver } from '../../content/utils.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import { eventCliSession } from '../../events/session.js';
|
import { eventCliSession } from '../../events/session.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { normalizePath } from 'vite';
|
||||||
import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro.js';
|
import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './constants.js';
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './constants.js';
|
||||||
import type { ModuleLoader } from './module-loader/index.js';
|
import type { ModuleLoader } from './module-loader/loader.js';
|
||||||
import { prependForwardSlash, removeTrailingForwardSlash, slash } from './path.js';
|
import { prependForwardSlash, removeTrailingForwardSlash, slash } from './path.js';
|
||||||
|
|
||||||
/** Returns true if argument is an object of any prototype/class (but not null). */
|
/** Returns true if argument is an object of any prototype/class (but not null). */
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { bold } from 'kleur/colors';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import type { AddressInfo } from 'node:net';
|
import type { AddressInfo } from 'node:net';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { InlineConfig, ViteDevServer } from 'vite';
|
import { mergeConfig, type InlineConfig, type ViteDevServer } from 'vite';
|
||||||
import type {
|
import type {
|
||||||
AstroAdapter,
|
AstroAdapter,
|
||||||
AstroConfig,
|
AstroConfig,
|
||||||
|
@ -16,8 +16,7 @@ import type {
|
||||||
} from '../@types/astro.js';
|
} from '../@types/astro.js';
|
||||||
import type { SerializedSSRManifest } from '../core/app/types.js';
|
import type { SerializedSSRManifest } from '../core/app/types.js';
|
||||||
import type { PageBuildData } from '../core/build/types.js';
|
import type { PageBuildData } from '../core/build/types.js';
|
||||||
import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.js';
|
import { buildClientDirectiveEntrypoint } from '../core/client-directive/build.js';
|
||||||
import { mergeConfig } from '../core/config/index.js';
|
|
||||||
import { AstroIntegrationLogger, type Logger } from '../core/logger/core.js';
|
import { AstroIntegrationLogger, type Logger } from '../core/logger/core.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { validateSupportedFeatures } from './astroFeaturesValidation.js';
|
import { validateSupportedFeatures } from './astroFeaturesValidation.js';
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export { createAstroJSXComponent } from './component.js';
|
|
||||||
export { default as renderer } from './renderer.js';
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { viteID } from '../core/util.js';
|
import { viteID } from '../core/util.js';
|
||||||
|
|
||||||
type GetPrerenderStatusParams = {
|
type GetPrerenderStatusParams = {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro.js';
|
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro.js';
|
||||||
import { RedirectComponentInstance, routeIsRedirect } from '../core/redirects/index.js';
|
import { RedirectComponentInstance } from '../core/redirects/component.js';
|
||||||
|
import { routeIsRedirect } from '../core/redirects/helpers.js';
|
||||||
import type DevPipeline from '../vite-plugin-astro-server/devPipeline.js';
|
import type DevPipeline from '../vite-plugin-astro-server/devPipeline.js';
|
||||||
import { preload } from '../vite-plugin-astro-server/index.js';
|
import { preload } from '../vite-plugin-astro-server/index.js';
|
||||||
import { getPrerenderStatus } from './metadata.js';
|
import { getPrerenderStatus } from './metadata.js';
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,21 @@ 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;
|
|
||||||
|
|
||||||
// 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) {
|
// we reloaded a page with history state
|
||||||
if (history.state) {
|
// (e.g. history navigation from non-transition page or browser reload)
|
||||||
// we reloaded a page with history state
|
currentHistoryIndex = history.state.index;
|
||||||
// (e.g. history navigation from non-transition page or browser reload)
|
scrollTo({ left: history.state.scrollX, top: history.state.scrollY });
|
||||||
currentHistoryIndex = history.state.index;
|
} else if (transitionEnabledOnThisPage()) {
|
||||||
scrollTo({ left: history.state.scrollX, top: history.state.scrollY });
|
history.replaceState({ index: currentHistoryIndex, scrollX, scrollY, intraPage: false }, '');
|
||||||
} else if (transitionEnabledOnThisPage()) {
|
|
||||||
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 +146,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,9 +166,7 @@ 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' });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -347,8 +328,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 +364,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,61 +382,58 @@ export function navigate(href: string, options?: Options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPopState(ev: PopStateEvent) {
|
if (supportsViewTransitions || getFallback() !== 'none') {
|
||||||
if (!transitionEnabledOnThisPage() && ev.state) {
|
addEventListener('popstate', (ev) => {
|
||||||
// The current page doesn't have View Transitions enabled
|
if (!transitionEnabledOnThisPage() && ev.state) {
|
||||||
// but the page we navigate to does (because it set the state).
|
// The current page doesn't have View Transitions enabled
|
||||||
// Do a full page refresh to reload the client-side router from the new page.
|
// but the page we navigate to does (because it set the state).
|
||||||
// Scroll restauration will then happen during the reload when the router's code is re-executed
|
// Do a full page refresh to reload the client-side router from the new page.
|
||||||
|
// Scroll restauration will then happen during the reload when the router's code is re-executed
|
||||||
|
if (history.scrollRestoration) {
|
||||||
|
history.scrollRestoration = 'manual';
|
||||||
|
}
|
||||||
|
location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// History entries without state are created by the browser (e.g. for hash links)
|
||||||
|
// Our view transition entries always have state.
|
||||||
|
// Just ignore stateless entries.
|
||||||
|
// The browser will handle navigation fine without our help
|
||||||
|
if (ev.state === null) {
|
||||||
|
if (history.scrollRestoration) {
|
||||||
|
history.scrollRestoration = 'auto';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// With the default "auto", the browser will jump to the old scroll position
|
||||||
|
// before the ViewTransition is complete.
|
||||||
if (history.scrollRestoration) {
|
if (history.scrollRestoration) {
|
||||||
history.scrollRestoration = 'manual';
|
history.scrollRestoration = 'manual';
|
||||||
}
|
}
|
||||||
location.reload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// History entries without state are created by the browser (e.g. for hash links)
|
const state: State = history.state;
|
||||||
// Our view transition entries always have state.
|
if (state.intraPage) {
|
||||||
// Just ignore stateless entries.
|
// this is non transition intra-page scrolling
|
||||||
// The browser will handle navigation fine without our help
|
scrollTo(state.scrollX, state.scrollY);
|
||||||
if (ev.state === null) {
|
} else {
|
||||||
if (history.scrollRestoration) {
|
const nextIndex = state.index;
|
||||||
history.scrollRestoration = 'auto';
|
const direction: Direction = nextIndex > currentHistoryIndex ? 'forward' : 'back';
|
||||||
|
currentHistoryIndex = nextIndex;
|
||||||
|
transition(direction, new URL(location.href), {}, state);
|
||||||
}
|
}
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// With the default "auto", the browser will jump to the old scroll position
|
addEventListener('load', onPageLoad);
|
||||||
// before the ViewTransition is complete.
|
// There's not a good way to record scroll position before a back button.
|
||||||
if (history.scrollRestoration) {
|
// So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position.
|
||||||
history.scrollRestoration = 'manual';
|
const updateState = () => {
|
||||||
}
|
persistState({ ...history.state, scrollX, scrollY });
|
||||||
|
};
|
||||||
|
|
||||||
const state: State = history.state;
|
if ('onscrollend' in window) addEventListener('scrollend', updateState);
|
||||||
if (state.intraPage) {
|
else addEventListener('scroll', throttle(updateState, 300));
|
||||||
// this is non transition intra-page scrolling
|
|
||||||
scrollTo(state.scrollX, state.scrollY);
|
markScriptsExec();
|
||||||
} else {
|
|
||||||
const nextIndex = state.index;
|
|
||||||
const direction: Direction = nextIndex > currentHistoryIndex ? 'forward' : 'back';
|
|
||||||
currentHistoryIndex = nextIndex;
|
|
||||||
transition(direction, new URL(location.href), {}, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inBrowser) {
|
|
||||||
if (supportsViewTransitions || getFallback() !== 'none') {
|
|
||||||
addEventListener('popstate', onPopState);
|
|
||||||
addEventListener('load', onPageLoad);
|
|
||||||
// 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.
|
|
||||||
const updateState = () => {
|
|
||||||
persistState({ ...history.state, scrollX, scrollY });
|
|
||||||
};
|
|
||||||
|
|
||||||
if ('onscrollend' in window) addEventListener('scrollend', updateState);
|
|
||||||
else addEventListener('scroll', throttle(updateState, 300));
|
|
||||||
|
|
||||||
markScriptsExec();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue