-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor content collection transforms #6817
Conversation
🦋 Changeset detectedLatest commit: 1d16001 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -104,6 +105,11 @@ interface AstroPluginJSXOptions { | |||
logging: LogOptions; | |||
} | |||
|
|||
// Format inspired by https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts#L54 | |||
const SPECIAL_QUERY_REGEX = new RegExp( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discovered our JSX runtime will try to process files with special flags like ?raw
and ?astroContent
. This regex should prevent that
|
||
function isPropagatedAsset(viteId: string, contentEntryExts: string[]): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contentEntryExts
check removed. Speeds up check and unlocks for future file extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactor!
Changes
load
step for content collection imports and assets to thetransform
step. This reduces complexity and unblocks support for content extensions with existing transforms from Vite core, like.json
(reason for unblock here).vite.build.sourcemap
option to content collections and the MDX plugin. When present, generate source maps. Avoid generating otherwise to prevent perf bottlenecks.Testing
Docs