The web framework that scales with you — Build fast content sites, powerful web applications, dynamic server APIs, and everything in-between ️ Star to support our work!
Find a file
Ben Holmes c6d7ebefdd
Data collections and references (#6850)
* feat: add generated lookup-map

* feat: wire up fast getEntryBySlug() lookup

* fix: consider frontmatter slugs

* chore: changeset

* chore: lint no-shadow

* fix: revert bad rootRelativePath change

* chore: better var name

* refactor: generated `.json` to in-memory map

* chore: removed unneeded await

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* chore: removed unneeded await

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* Revert "chore: removed unneeded await"

This reverts commit 1b0a8b00c2.

* fix: bad `GetEntryImport` type

* chore: remove unused variable

* refactor: for -> Promise.all

* refactor: replace duplicate parseSlug

* refactor: add cache layer

* Revert "refactor: add cache layer"

This reverts commit 1c3bfdc6b3.

* feat: json collection POC

* wip: add test json file

* wip: playing with api ideas

* refactor: extract getCollectionName

* feat: add defineDataCollection

* refactor: variable destructure

* wip: basic data entry pipeline

* chore: revert fixture playing

* wip: basic entry array parser

* feat: basic data type gen

* chore: add with-data playground

* feat: add error when `defineDataCollection()` isn't used

* fix: missing error message

* feat: data collections are here!

* wip: play with data query APIs

* feat: reference() util!

* fix: Markdoc `$entry` variable

* play: add reference util with markdoc

* chore: delete console logs

* feat: `src/data/`!

* feat: reference() errors

* fix: handle hoisted schema parse errors

* fix: reload config and invalid on collection changes

* feat: separate maps for content and data entries

* feat: new `reference()` API that fixes type inference

* feat: support `defineCollection()` for data config

* fix: defineCollection `type` inferenenceπinference

* chore: lock

* feat: getCollection() for everything!

* feat: get full entry access from reference()

* chore: changeset

* wip: type error on acorn?

* chore: lint

* chore: add slugger to data ID processing

* chore: astro/zod -> zod

* chore: example version

* chore: remove slugifier from data id

* chore: remove dead getDataCollection

* chore: remove dead defineDataCollection

* fix: bad collection import

* chore: lock

* feat: add data collections to lookup map

* refactor: stop resolving data from reference

* feat: introduce getEntry and new reference()

* fix: update config loader

* fix: reference() type

* feat: test self references (they work 🎉)

* fix: use `slug` for content references

* fix: bad getEntry content type

* chroe: remove console logs

* fix: strict null checks on with-data

* feat: add getEntries for ref arrays

* chore: fix type hints for reference strings

* chore: change to type never for clarity

* play: try getEntries

* Return to "everything goes in `src/content/`

This reverts commit cc637ec6db4fc23afab585df5f240b7f7c0abc8a.

* fix: remove old function

* chore: update to AstroErrors

* chore: remove unused fixture files

* play: names

* deps: js-yaml

* feat: data collection YAML with error handling

* refactor: remove console log

* refactor: code cleanup

* fix: allow mixed content to pass through glob imports

* chore: move lookupMap util to virtual-mod

* refactor: new lookupMap logic, better errors

* chore: change MixedContent title

* refactor: remove unneeded try / catch

* fix: use `ws.send` for type gen errors

* fix: bubble `ws.send` errors from astro sync

* refactor: revert verbose astroContentCollectionEntry

* fix: bad with-data package name

* fix: bad virtual mod flag

* chore: remove with-data playground

* test: data collection authors

* test: translations data collection

* fix: add `.yml` support

* refactor: mix in `.yaml` just for fun

* refactor: i18n -> translations

* chore: content-collection-references fixture

* chore: bad lockfile

* fix: bad ContentLookupMap import

* chore: revert back to astroContentCollectionEntry

* test: collection references

* fix: bad error code override

* chore: remove unused asset

* test: sync errors

* chore: remove stray console log

* chore: lock

* chore: revert with-markdoc changes

* chore: doc error states, remove bad merge code

* chore: remove bad `as any`

* chore: lint

* chore: inline ContentLookupMap comments

* chore: settings -> config

* fix: put back `defineCollection()`

* fix: entry.slug for get content collection

* chore: update get-entry-type tests

* docs: totally shorten "missing a `type`"

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* docs: truncate share a `schema`

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* chore: add `test:unit` and `test:unit:match`to base

* chore:  update changeset

* refactor: cleanup runtime types and inline comments

* nit: [0] instead of shift()

* refactor: `getRelativeEntryPath()` util

* chore: capitalized Collections for test:match

* nit: ?? viteId on split

* nit: separate Params obj

* chore: add try / catch on readFile

* nit: `const data`

* chore: clean up data collection exceptions

* nit: `?? ''` for search params

* chore: remove TODO on hoisted error

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-05-17 11:36:27 -04:00
.changeset Data collections and references (#6850) 2023-05-17 11:36:27 -04:00
.devcontainer Fix marketing typo by just removing extra info (#6410) 2023-03-02 15:47:13 -06:00
.github Update lockfile CI (#7105) 2023-05-16 09:35:06 -04:00
.gitpod Gitpod - fix pnpm version error (#4120) 2022-08-02 11:09:16 -05:00
.vscode update prettier width (#2968) 2022-04-02 14:15:41 -06:00
benchmark [ci] release (#6914) 2023-04-27 22:12:14 +08:00
examples adding meta description tag to basics example (#6854) 2023-05-17 15:17:35 +02:00
packages Data collections and references (#6850) 2023-05-17 11:36:27 -04:00
patches chore: update dependencies related to changesets (#6868) 2023-04-28 15:04:03 +08:00
scripts Implement custom client directives (#7074) 2023-05-17 20:51:27 +08:00
.Dockerfile Add a Github Codespace Config based on gitpod dockerfile (#4185) 2022-08-08 12:22:32 -05:00
.editorconfig Use accessible indentation (#2253) 2021-12-22 16:11:05 -05:00
.eslintignore Enables eslint on the full repo and adds a rule for no only() tests (#3659) 2022-06-22 15:59:49 +00:00
.eslintrc.cjs Refactor benchmark script (#6376) 2023-03-01 08:46:06 +00:00
.git-blame-ignore-revs Ignore big formatting commit (#3870) 2022-07-08 15:31:10 -05:00
.gitignore Upgrade turbo (#6911) 2023-04-27 11:39:15 +08:00
.gitpod.yml fix: always get latest pnpm (#4571) 2022-08-31 11:13:06 -05:00
.npmrc Handle compiler breaking change (#5803) 2023-01-12 22:46:56 +08:00
.nvmrc Update .nvmrc to match new CI baseline (#5784) 2023-01-06 12:49:08 -05:00
.prettierignore .prettierignore: update comment; (#5177) 2022-10-24 10:32:31 -03:00
.prettierrc.cjs chore: update dependencies related to changesets (#6868) 2023-04-28 15:04:03 +08:00
CONTRIBUTING.md docs: improve CONTRIBUTING.md (#6867) 2023-04-18 16:44:38 +02:00
LICENSE add vite to license 2022-04-24 16:42:39 -07:00
package.json Data collections and references (#6850) 2023-05-17 11:36:27 -04:00
pnpm-lock.yaml Data collections and references (#6850) 2023-05-17 11:36:27 -04:00
pnpm-workspace.yaml Upgrade turbo (#6911) 2023-04-27 11:39:15 +08:00
README.md Update README.md 2023-03-21 10:09:12 -05:00
SECURITY.md [ci] format 2022-08-08 17:12:48 +00:00
SECURITY_CONTACTS Changes required for a Passing grade from OpenSSF Best Practices (#3718) 2022-08-08 12:11:00 -05:00
STYLE_GUIDE.md Move from yarn to pnpm (#2455) 2022-03-08 15:46:11 -06:00
tsconfig.base.json feat(all): Migrate to TypeScript 5.0 (#6579) 2023-03-20 17:02:07 +01:00
tsconfig.json chore: add empty tsconfig to prevent TypeScript from crawling (#4937) 2022-09-30 16:02:39 -05:00
turbo.json Upgrade turbo (#6911) 2023-04-27 11:39:15 +08:00

Build the web you want


Astro is a website build tool for the modern web —
powerful developer experience meets lightweight output.

Install

The recommended way to install the latest version of Astro is by running the command below:

npm create astro@latest

You can also install Astro manually by running this command instead:

npm install --save-dev astro

Looking for help? Start with our Getting Started guide.

Looking for quick examples? Open a starter project right in your browser.

Documentation

Visit our official documentation.

Support

Having trouble? Get help in the official Astro Discord.

Contributing

New contributors welcome! Check out our Contributors Guide for help getting started.

Join us on Discord to meet other maintainers. We'll help you get your first contribution in no time!

Directory

Package Release Notes
astro astro version
create-astro create-astro version
@astrojs/react astro version
@astrojs/preact astro version
@astrojs/solid-js astro version
@astrojs/svelte astro version
@astrojs/vue astro version
@astrojs/lit astro version
@astrojs/deno astro version
@astrojs/netlify astro version
@astrojs/node astro version
@astrojs/vercel astro version
@astrojs/cloudflare astro version
@astrojs/partytown astro version
@astrojs/sitemap astro version
@astrojs/tailwind astro version
@astrojs/turbolinks astro version
@astrojs/alpinejs astro version
@astrojs/image astro version
@astrojs/mdx astro version
@astrojs/prefetch astro version

CII Best Practices

Several official projects are maintained outside of this repo:

Project Repository
@astrojs/compiler withastro/compiler
Astro Language Tools withastro/language-tools

Sponsors

Astro is generously supported by Netlify, Storyblok, and several other amazing organizations.

❤️ Sponsor Astro! ❤️

Astro's sponsors.