summaryrefslogtreecommitdiff
path: root/packages/integrations
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations')
-rw-r--r--packages/integrations/mdx/test/css-head-mdx.test.js1
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/components/UsingMdx.astro6
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/config.ts18
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/blog/_styles.css (renamed from packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/blog/_styles.css)0
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/blog/using-mdx.mdx (renamed from packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/blog/using-mdx.mdx)0
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/posts/test.mdx (renamed from packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/posts/test.mdx)0
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/posts/using-component.mdx (renamed from packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/posts/using-component.mdx)0
-rw-r--r--packages/integrations/mdx/test/fixtures/css-head-mdx/src/pages/posts/[post].astro8
-rw-r--r--packages/integrations/solid/CHANGELOG.md6
-rw-r--r--packages/integrations/solid/package.json2
-rw-r--r--packages/integrations/solid/src/client.ts67
-rw-r--r--packages/integrations/svelte/CHANGELOG.md6
-rw-r--r--packages/integrations/svelte/client-v5.js22
-rw-r--r--packages/integrations/svelte/client.js29
-rw-r--r--packages/integrations/svelte/package.json2
-rw-r--r--packages/integrations/tailwind/CHANGELOG.md6
-rw-r--r--packages/integrations/tailwind/package.json4
-rw-r--r--packages/integrations/vue/CHANGELOG.md6
-rw-r--r--packages/integrations/vue/client.js46
-rw-r--r--packages/integrations/vue/package.json2
20 files changed, 162 insertions, 69 deletions
diff --git a/packages/integrations/mdx/test/css-head-mdx.test.js b/packages/integrations/mdx/test/css-head-mdx.test.js
index 96ee7c900..5565cde60 100644
--- a/packages/integrations/mdx/test/css-head-mdx.test.js
+++ b/packages/integrations/mdx/test/css-head-mdx.test.js
@@ -15,6 +15,7 @@ describe('Head injection w/ MDX', () => {
integrations: [mdx()],
// test suite was authored when inlineStylesheets defaulted to never
build: { inlineStylesheets: 'never' },
+ experimental: { contentLayer: true },
});
});
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/components/UsingMdx.astro b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/components/UsingMdx.astro
index 1804388b0..3ef9d7639 100644
--- a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/components/UsingMdx.astro
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/components/UsingMdx.astro
@@ -1,8 +1,8 @@
---
-import { getEntryBySlug } from 'astro:content';
+import { getEntry, render } from 'astro:content';
-const launchWeek = await getEntryBySlug('blog', 'using-mdx');
-const { Content } = await launchWeek.render();
+const launchWeek = await getEntry('blog', 'using-mdx');
+const { Content } = await render(launchWeek);
---
<Content />
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/config.ts b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/config.ts
new file mode 100644
index 000000000..2c8944d51
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/config.ts
@@ -0,0 +1,18 @@
+import { defineCollection } from "astro:content";
+import { glob } from "astro/loaders"
+
+const posts = defineCollection({
+ loader: glob({
+ pattern: "*.mdx",
+ base: "src/data/posts",
+ })
+});
+
+const blog = defineCollection({
+ loader: glob({
+ pattern: "*.mdx",
+ base: "src/data/blog",
+ })
+});
+
+export const collections = { posts, blog };
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/blog/_styles.css b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/blog/_styles.css
index 1379b29c0..1379b29c0 100644
--- a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/blog/_styles.css
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/blog/_styles.css
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/blog/using-mdx.mdx b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/blog/using-mdx.mdx
index 917fc3331..917fc3331 100644
--- a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/blog/using-mdx.mdx
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/blog/using-mdx.mdx
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/posts/test.mdx b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/posts/test.mdx
index 0bb1153ca..0bb1153ca 100644
--- a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/posts/test.mdx
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/posts/test.mdx
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/posts/using-component.mdx b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/posts/using-component.mdx
index fa550fb04..fa550fb04 100644
--- a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/content/posts/using-component.mdx
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/data/posts/using-component.mdx
diff --git a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/pages/posts/[post].astro b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/pages/posts/[post].astro
index 5afb5be92..13a9e56db 100644
--- a/packages/integrations/mdx/test/fixtures/css-head-mdx/src/pages/posts/[post].astro
+++ b/packages/integrations/mdx/test/fixtures/css-head-mdx/src/pages/posts/[post].astro
@@ -1,17 +1,17 @@
---
-import { getCollection } from 'astro:content';
+import { getCollection, render } from 'astro:content';
import SmallCaps from '../../components/SmallCaps.astro';
import Layout from '../../layouts/ContentLayout.astro';
export async function getStaticPaths() {
const entries = await getCollection('posts');
return entries.map(entry => {
- return {params: { post: entry.slug }, props: { entry },
- }});
+ return { params: { post: entry.id }, props: { entry }};
+ });
}
const { entry } = Astro.props;
-const { Content } = await entry.render();
+const { Content } = await render(entry);
---
<Layout title="">
<Content components={{ SmallCaps }} />
diff --git a/packages/integrations/solid/CHANGELOG.md b/packages/integrations/solid/CHANGELOG.md
index bc1d135d0..9f69e7e2f 100644
--- a/packages/integrations/solid/CHANGELOG.md
+++ b/packages/integrations/solid/CHANGELOG.md
@@ -1,5 +1,11 @@
# @astrojs/solid-js
+## 4.4.2
+
+### Patch Changes
+
+- [#11998](https://github.com/withastro/astro/pull/11998) [`082f450`](https://github.com/withastro/astro/commit/082f45094471d52e55c55d3291f541306d9388b1) Thanks [@johannesspohr](https://github.com/johannesspohr)! - Fix view transition state persistence
+
## 4.4.1
### Patch Changes
diff --git a/packages/integrations/solid/package.json b/packages/integrations/solid/package.json
index 5320cc57e..7a3cb6e15 100644
--- a/packages/integrations/solid/package.json
+++ b/packages/integrations/solid/package.json
@@ -1,6 +1,6 @@
{
"name": "@astrojs/solid-js",
- "version": "4.4.1",
+ "version": "4.4.2",
"description": "Use Solid components within Astro",
"type": "module",
"types": "./dist/index.d.ts",
diff --git a/packages/integrations/solid/src/client.ts b/packages/integrations/solid/src/client.ts
index a47c5310d..f2020bb56 100644
--- a/packages/integrations/solid/src/client.ts
+++ b/packages/integrations/solid/src/client.ts
@@ -1,10 +1,12 @@
import { Suspense } from 'solid-js';
+import { createStore, reconcile } from 'solid-js/store';
import { createComponent, hydrate, render } from 'solid-js/web';
+const alreadyInitializedElements = new WeakMap<Element, any>();
+
export default (element: HTMLElement) =>
(Component: any, props: any, slotted: any, { client }: { client: string }) => {
if (!element.hasAttribute('ssr')) return;
-
const isHydrate = client !== 'only';
const bootstrap = isHydrate ? hydrate : render;
@@ -32,31 +34,44 @@ export default (element: HTMLElement) =>
const { default: children, ...slots } = _slots;
const renderId = element.dataset.solidRenderId;
+ if (alreadyInitializedElements.has(element)) {
+ // update the mounted component
+ alreadyInitializedElements.get(element)!(
+ // reconcile will make sure to apply as little updates as possible, and also remove missing values w/o breaking reactivity
+ reconcile({
+ ...props,
+ ...slots,
+ children,
+ }),
+ );
+ } else {
+ const [store, setStore] = createStore({
+ ...props,
+ ...slots,
+ children,
+ });
+ // store the function to update the current mounted component
+ alreadyInitializedElements.set(element, setStore);
- const dispose = bootstrap(
- () => {
- const inner = () =>
- createComponent(Component, {
- ...props,
- ...slots,
- children,
- });
+ const dispose = bootstrap(
+ () => {
+ const inner = () => createComponent(Component, store);
- if (isHydrate) {
- return createComponent(Suspense, {
- get children() {
- return inner();
- },
- });
- } else {
- return inner();
- }
- },
- element,
- {
- renderId,
- },
- );
-
- element.addEventListener('astro:unmount', () => dispose(), { once: true });
+ if (isHydrate) {
+ return createComponent(Suspense, {
+ get children() {
+ return inner();
+ },
+ });
+ } else {
+ return inner();
+ }
+ },
+ element,
+ {
+ renderId,
+ },
+ );
+ element.addEventListener('astro:unmount', () => dispose(), { once: true });
+ }
};
diff --git a/packages/integrations/svelte/CHANGELOG.md b/packages/integrations/svelte/CHANGELOG.md
index a498778af..528b7363c 100644
--- a/packages/integrations/svelte/CHANGELOG.md
+++ b/packages/integrations/svelte/CHANGELOG.md
@@ -7,6 +7,12 @@
- Updated dependencies [[`b6fbdaa`](https://github.com/withastro/astro/commit/b6fbdaa94a9ecec706a99e1938fbf5cd028c72e0), [`89bab1e`](https://github.com/withastro/astro/commit/89bab1e70786123fbe933a9d7a1b80c9334dcc5f), [`d74617c`](https://github.com/withastro/astro/commit/d74617cbd3278feba05909ec83db2d73d57a153e), [`e90f559`](https://github.com/withastro/astro/commit/e90f5593d23043579611452a84b9e18ad2407ef9), [`2df49a6`](https://github.com/withastro/astro/commit/2df49a6fb4f6d92fe45f7429430abe63defeacd6), [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6)]:
- astro@5.0.0-alpha.0
+## 5.7.1
+
+### Patch Changes
+
+- [#12006](https://github.com/withastro/astro/pull/12006) [`a582cb6`](https://github.com/withastro/astro/commit/a582cb61241b9c2a6f95900920145c055d5d6c12) Thanks [@johannesspohr](https://github.com/johannesspohr)! - Fix Svelte component view transition state persistence
+
## 5.7.0
### Minor Changes
diff --git a/packages/integrations/svelte/client-v5.js b/packages/integrations/svelte/client-v5.js
index fda68ee54..78bab3ea3 100644
--- a/packages/integrations/svelte/client-v5.js
+++ b/packages/integrations/svelte/client-v5.js
@@ -1,5 +1,7 @@
import { createRawSnippet, hydrate, mount, unmount } from 'svelte';
+const existingApplications = new WeakMap();
+
export default (element) => {
return async (Component, props, slotted, { client }) => {
if (!element.hasAttribute('ssr')) return;
@@ -21,15 +23,23 @@ export default (element) => {
}
const bootstrap = client !== 'only' ? hydrate : mount;
-
- const component = bootstrap(Component, {
- target: element,
- props: {
+ if (existingApplications.has(element)) {
+ existingApplications.get(element).$set({
...props,
children,
$$slots,
- },
- });
+ });
+ } else {
+ const component = bootstrap(Component, {
+ target: element,
+ props: {
+ ...props,
+ children,
+ $$slots,
+ },
+ });
+ existingApplications.set(element, component);
+ }
element.addEventListener('astro:unmount', () => unmount(component), { once: true });
};
diff --git a/packages/integrations/svelte/client.js b/packages/integrations/svelte/client.js
index 005bbe9da..288c7a661 100644
--- a/packages/integrations/svelte/client.js
+++ b/packages/integrations/svelte/client.js
@@ -3,6 +3,8 @@ const noop = () => {};
let originalConsoleWarning;
let consoleFilterRefs = 0;
+const existingApplications = new WeakMap();
+
export default (element) => {
return (Component, props, slotted, { client }) => {
if (!element.hasAttribute('ssr')) return;
@@ -14,18 +16,23 @@ export default (element) => {
try {
if (import.meta.env.DEV) useConsoleFilter();
- const component = new Component({
- target: element,
- props: {
- ...props,
- $$slots: slots,
- $$scope: { ctx: [] },
- },
- hydrate: client !== 'only',
- $$inline: true,
- });
+ if (existingApplications.has(element)) {
+ existingApplications.get(element).$set({ ...props, $$slots: slots, $$scope: { ctx: [] } });
+ } else {
+ const component = new Component({
+ target: element,
+ props: {
+ ...props,
+ $$slots: slots,
+ $$scope: { ctx: [] },
+ },
+ hydrate: client !== 'only',
+ $$inline: true,
+ });
+ existingApplications.set(element, component);
- element.addEventListener('astro:unmount', () => component.$destroy(), { once: true });
+ element.addEventListener('astro:unmount', () => component.$destroy(), { once: true });
+ }
} finally {
if (import.meta.env.DEV) finishUsingConsoleFilter();
}
diff --git a/packages/integrations/svelte/package.json b/packages/integrations/svelte/package.json
index 663309585..7241dbc6a 100644
--- a/packages/integrations/svelte/package.json
+++ b/packages/integrations/svelte/package.json
@@ -1,6 +1,6 @@
{
"name": "@astrojs/svelte",
- "version": "5.7.0",
+ "version": "5.7.1",
"description": "Use Svelte components within Astro",
"type": "module",
"types": "./dist/index.d.ts",
diff --git a/packages/integrations/tailwind/CHANGELOG.md b/packages/integrations/tailwind/CHANGELOG.md
index cc632bfc2..c2985edef 100644
--- a/packages/integrations/tailwind/CHANGELOG.md
+++ b/packages/integrations/tailwind/CHANGELOG.md
@@ -7,6 +7,12 @@
- Updated dependencies [[`b6fbdaa`](https://github.com/withastro/astro/commit/b6fbdaa94a9ecec706a99e1938fbf5cd028c72e0), [`89bab1e`](https://github.com/withastro/astro/commit/89bab1e70786123fbe933a9d7a1b80c9334dcc5f), [`d74617c`](https://github.com/withastro/astro/commit/d74617cbd3278feba05909ec83db2d73d57a153e), [`e90f559`](https://github.com/withastro/astro/commit/e90f5593d23043579611452a84b9e18ad2407ef9), [`2df49a6`](https://github.com/withastro/astro/commit/2df49a6fb4f6d92fe45f7429430abe63defeacd6), [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6)]:
- astro@5.0.0-alpha.0
+## 5.1.1
+
+### Patch Changes
+
+- [#12018](https://github.com/withastro/astro/pull/12018) [`dcd1158`](https://github.com/withastro/astro/commit/dcd115892a23b17309347c13ce4d82af73d204b2) Thanks [@matthewp](https://github.com/matthewp)! - Make @astrojs/tailwind compat with Astro 5
+
## 5.1.0
### Minor Changes
diff --git a/packages/integrations/tailwind/package.json b/packages/integrations/tailwind/package.json
index 65fd41b5b..3e383437c 100644
--- a/packages/integrations/tailwind/package.json
+++ b/packages/integrations/tailwind/package.json
@@ -1,7 +1,7 @@
{
"name": "@astrojs/tailwind",
"description": "Use Tailwind CSS to style your Astro site",
- "version": "5.1.0",
+ "version": "5.1.1",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
@@ -44,7 +44,7 @@
"vite": "^5.4.3"
},
"peerDependencies": {
- "astro": "^5.0.0-alpha.0",
+ "astro": "^3.0.0 || ^4.0.0 || ^5.0.0-beta.0",
"tailwindcss": "^3.0.24"
},
"publishConfig": {
diff --git a/packages/integrations/vue/CHANGELOG.md b/packages/integrations/vue/CHANGELOG.md
index 88ff9204e..a6fbc1ca6 100644
--- a/packages/integrations/vue/CHANGELOG.md
+++ b/packages/integrations/vue/CHANGELOG.md
@@ -7,6 +7,12 @@
- Updated dependencies [[`b6fbdaa`](https://github.com/withastro/astro/commit/b6fbdaa94a9ecec706a99e1938fbf5cd028c72e0), [`89bab1e`](https://github.com/withastro/astro/commit/89bab1e70786123fbe933a9d7a1b80c9334dcc5f), [`d74617c`](https://github.com/withastro/astro/commit/d74617cbd3278feba05909ec83db2d73d57a153e), [`e90f559`](https://github.com/withastro/astro/commit/e90f5593d23043579611452a84b9e18ad2407ef9), [`2df49a6`](https://github.com/withastro/astro/commit/2df49a6fb4f6d92fe45f7429430abe63defeacd6), [`8a53517`](https://github.com/withastro/astro/commit/8a5351737d6a14fc55f1dafad8f3b04079e81af6)]:
- astro@5.0.0-alpha.0
+## 4.5.1
+
+### Patch Changes
+
+- [#11946](https://github.com/withastro/astro/pull/11946) [`b75bfc8`](https://github.com/withastro/astro/commit/b75bfc8cc41f5c631c10055b78670fdc26dff23a) Thanks [@johannesspohr](https://github.com/johannesspohr)! - Fix vue islands keeping their state when using view transition persistence
+
## 4.5.0
### Minor Changes
diff --git a/packages/integrations/vue/client.js b/packages/integrations/vue/client.js
index 807f843fc..58ee11d5c 100644
--- a/packages/integrations/vue/client.js
+++ b/packages/integrations/vue/client.js
@@ -2,6 +2,9 @@ import { setup } from 'virtual:@astrojs/vue/app';
import { Suspense, createApp, createSSRApp, h } from 'vue';
import StaticHtml from './static-html.js';
+// keep track of already initialized apps, so we don't hydrate again for view transitions
+let appMap = new WeakMap();
+
export default (element) =>
async (Component, props, slotted, { client }) => {
if (!element.hasAttribute('ssr')) return;
@@ -15,21 +18,36 @@ export default (element) =>
const isHydrate = client !== 'only';
const bootstrap = isHydrate ? createSSRApp : createApp;
- const app = bootstrap({
- name,
- render() {
- let content = h(Component, props, slots);
- // related to https://github.com/withastro/astro/issues/6549
- // if the component is async, wrap it in a Suspense component
- if (isAsync(Component.setup)) {
- content = h(Suspense, null, content);
- }
- return content;
- },
- });
- await setup(app);
- app.mount(element, isHydrate);
+ // keep a reference to the app, props and slots so we can update a running instance later
+ let appInstance = appMap.get(element);
+
+ if (!appInstance) {
+ appInstance = {
+ props,
+ slots,
+ };
+ const app = bootstrap({
+ name,
+ render() {
+ let content = h(Component, appInstance.props, appInstance.slots);
+ appInstance.component = this;
+ // related to https://github.com/withastro/astro/issues/6549
+ // if the component is async, wrap it in a Suspense component
+ if (isAsync(Component.setup)) {
+ content = h(Suspense, null, content);
+ }
+ return content;
+ },
+ });
+ await setup(app);
+ app.mount(element, isHydrate);
+ appMap.set(element, appInstance);
+ } else {
+ appInstance.props = props;
+ appInstance.slots = slots;
+ appInstance.component.$forceUpdate();
+ }
element.addEventListener('astro:unmount', () => app.unmount(), { once: true });
};
diff --git a/packages/integrations/vue/package.json b/packages/integrations/vue/package.json
index c11771173..eb723f8fb 100644
--- a/packages/integrations/vue/package.json
+++ b/packages/integrations/vue/package.json
@@ -1,6 +1,6 @@
{
"name": "@astrojs/vue",
- "version": "4.5.0",
+ "version": "4.5.1",
"description": "Use Vue components within Astro",
"type": "module",
"types": "./dist/index.d.ts",