Releases: ascorbic/astro-loaders
@ascorbic/youtube-loader@0.0.2
@ascorbic/feed-loader@2.0.1
@ascorbic/bluesky-loader@0.1.0
Minor Changes
-
#91
feb8d4bThanks @ascorbic! - Adds live Bluesky loaderAdds
liveBlueskyLoaderfor Astro's experimental Live Content Collections feature. This loader fetches Bluesky posts in real-time, complementing the existing build-timeauthorFeedLoader.The key difference is that while
authorFeedLoaderfetches data at build time for static generation,liveBlueskyLoaderretrieves fresh content on-demand during server-side rendering or client-side navigation.Getting Started
Prerequisites
- Astro 5.10.0+ with experimental Live Content Collections enabled
@ascorbic/bluesky-loaderpackage installed
Basic Usage
Create a live collection in your
live.config.ts:import { defineLiveCollection } from "astro:content"; import { liveBlueskyLoader } from "@ascorbic/bluesky-loader"; const liveBluesky = defineLiveCollection({ type: "live", loader: liveBlueskyLoader({ identifier: "your-handle.bsky.social", // Optional: can also be set in filters service: "https://public.api.bsky.app", // Optional: defaults to public API }), }); export const collections = { liveBluesky };
Using in Pages
Fetch posts in your Astro pages:
--- import { getLiveCollection, getLiveEntry } from 'astro:content'; // Get filtered posts const posts = await getLiveCollection('liveBluesky', (post) => post.data.record.text.includes('astro') ); // Get a specific post by AT URI const post = await getLiveEntry('liveBluesky', 'at://did:plc:user/app.bsky.feed.post/id'); ---
Features
- Real-time data fetching using AT Protocol's
getPostsmethod - Flexible configuration - set identifier globally or per-request
- Filtering options: limit, date ranges, post types, and more
- Error handling with specific error codes and helpful messages
- Full TypeScript support with exported interfaces
- Configurable service URLs for custom Bluesky instances
@ascorbic/feed-loader@2.0.0
Major Changes
-
#85
8c0c2a0Thanks @ascorbic! - BREAKING CHANGE: Updated underlying feed parser libraryThis release updates the underlying feed parsing library from the previous parser to
@rowanmanning/feed-parser, which provides more robust and standardized feed parsing. There is a legacy mode for the previous data shape. This change includes several breaking changes to the data structure:Schema Changes
Category Structure
- BREAKING: Category objects now use
label,term, andurlfields instead ofnameanddomain- Old:
{ name: string, domain: string | null } - New:
{ label: string, term: string, url: string | null }
- Old:
Media/Enclosure Structure
- BREAKING: Media objects now include additional fields and renamed properties
- Old:
{ url: string, type: string | null, length: number | null } - New:
{ url: string, image: string | null, title: string | null, length: number | null, type: string | null, mimeType: string | null }
- Old:
Field Name Changes
- BREAKING:
linkfield renamed tourl - BREAKING:
guidfield renamed toid - BREAKING: Atom
summaryfield now maps todescription(consistent with RSS) - BREAKING: RSS/Atom
enclosure/link[@rel=enclosure]elements now map tomediaarray
Error Message Changes
- Updated error messages to match new parser behavior:
- "Item does not have a guid, skipping" → "Item does not have an id or url, skipping"
- "Response body is empty" → "Feed response is empty"
Benefits
- More robust XML/Atom/RSS parsing
- Better handling of malformed feeds
- Standardized data structure across feed types
- Improved character encoding support
- More comprehensive category and media handling
Legacy Mode Support
To ease migration, this release includes a temporary legacy mode that maintains backward compatibility:
// Enable legacy mode for backward compatibility const loader = feedLoader({ url: "https://example.com/feed.xml", legacy: true, // Will show deprecation warning });
⚠️ Legacy mode is deprecated and will be removed in a future major version. Use it only as a temporary migration aid.Migration Guide
Option 1: Use Legacy Mode (Temporary)
Enable legacy mode to maintain the old data structure while you plan your migration:
const loader = feedLoader({ url: "https://example.com/feed.xml", legacy: true, }); // Data will be in the old format with categories[].name, enclosures, link, guid
Option 2: Update to New Format (Recommended)
Update your code to handle the new structured data format:
Field Name Changes
// Item fields item.link → item.url item.guid → item.id item.pubdate/item.date → item.published item.summary → item.description (Atom feeds) item.enclosures → item.media
Author Structure Change
// Old: Single string format item.author = "email (name)"; // New: Array of objects item.authors = [{ email: "email", name: "name" }]; // Access: item.authors[0]?.name, item.authors[0]?.email
Category Structure Change
// Old: Array of strings item.categories = ["category1", "category2"]; // New: Array of objects item.categories = [{ label: "category1", term: "category1", url: null }]; // Access: item.categories[0].label
Media/Enclosure Structure Change
// Old: Basic enclosure format item.enclosures = [ { url: "http://example.com/file.mp3", type: "audio/mpeg", length: "1234", }, ]; // New: Enhanced media format item.media = [ { url: "http://example.com/file.mp3", mimeType: "audio/mpeg", length: 1234, image: null, title: null, }, ];
Image Structure Change
// Old: Simple object with undefined for missing values item.image = { url: "http://example.com/image.jpg", title: undefined }; // New: Full object structure item.image = { url: "http://example.com/image.jpg", title: "Image Title", description: "Image description", };
Meta Structure Changes
// Feed generator changed from string to object meta.generator = "WordPress" → feed.generator = { name: "WordPress" } // Authors follow same pattern as items meta.author = "email (name)" → feed.authors = [{ email: "email", name: "name" }]
Most users who only access
title,description,url, and basic fields will not need changes. - BREAKING: Category objects now use
Minor Changes
-
#88
1049d3eThanks @ascorbic! - Adds experimental live feed loaderAdds a new
liveFeedLoaderfor Astro's experimental live content collections feature. This allows RSS/Atom feeds to be fetched at request time rather than build time, enabling real-time content updates without rebuilds.Features:
- Runtime feed loading with
liveFeedLoader() - Support for RSS, Atom, and RDF feeds
- Collection filtering (limit, category, author, date ranges)
- Individual entry loading by ID or URL
- Structured error handling with
FeedLoadErrorandFeedValidationError - TypeScript support with proper generics
Requirements:
- Astro 5.10.0 or later
- Experimental live content collections enabled in
astro.config.mjs
Usage:
// src/live.config.ts import { defineLiveCollection } from "astro:content"; import { liveFeedLoader } from "@ascorbic/feed-loader"; const news = defineLiveCollection({ type: "live", loader: liveFeedLoader({ url: "https://feeds.example.com/news.xml", }), });
The existing
feedLoaderremains unchanged and fully compatible. - Runtime feed loading with
@ascorbic/bluesky-loader@0.0.3
@ascorbic/airtable-loader@1.0.5
@ascorbic/bluesky-loader@0.0.2
@ascorbic/bluesky-loader@0.0.1
@ascorbic/mock-loader@2.0.2
Patch Changes
- #51
abd94a3Thanks @HiDeoo! - Ensures loader visibility in the Astro integrations library.
@ascorbic/feed-loader@1.0.4
Patch Changes
- #51
abd94a3Thanks @HiDeoo! - Ensures loader visibility in the Astro integrations library.