-
-
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
Fix hoisted script propagation in content collection pages #6119
Changes from 8 commits
b68b858
ced486e
3c291a3
8561ecf
a7bd5a9
398b201
4f82f41
b44f4de
9df9d3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix hoisted script propagation in content collection pages |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,9 +40,10 @@ export function moduleIsTopLevelPage(info: ModuleInfo): boolean { | |
// This could be a .astro page, a .markdown or a .md (or really any file extension for markdown files) page. | ||
export function* getTopLevelPages( | ||
id: string, | ||
ctx: { getModuleInfo: GetModuleInfo } | ||
ctx: { getModuleInfo: GetModuleInfo }, | ||
walkUntil?: (importer: string) => boolean | ||
): Generator<[ModuleInfo, number, number], void, unknown> { | ||
for (const res of walkParentInfos(id, ctx)) { | ||
for (const res of walkParentInfos(id, ctx, walkUntil)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This refactor is unused looks like. Good to revert changes to this file! |
||
if (moduleIsTopLevelPage(res[0])) { | ||
yield res; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ export interface PageBuildData { | |
moduleSpecifier: string; | ||
css: Map<string, { depth: number; order: number }>; | ||
contentCollectionCss: Map<string, Set<string>>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Meant to rename |
||
propagatedScripts: Map<string, Set<string>>; | ||
hoistedScript: { type: 'inline' | 'external'; value: string } | undefined; | ||
} | ||
export type AllPagesData = Record<ComponentPath, PageBuildData>; | ||
|
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.
Love that we can look these up now 👏 Way simpler than scary naming conventions!