feat: scaffold Astro + Tailwind project

This commit is contained in:
TerryM
2026-05-12 16:16:03 +08:00
parent 906eb5c763
commit 03d3800c6c
12097 changed files with 1266600 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { type HeadInstructionRenderState } from '../../../../core/head-propagation/policy.js';
import type { SSRResult } from '../../../../types/public/internal.js';
import type { AstroComponentFactory } from '../astro/factory.js';
/** Facade helper used by runtime adapters to read effective hint resolution. */
export declare function getPropagationHint(result: SSRResult, factory: AstroComponentFactory): import("../../../../types/public/internal.js").PropagationHint;
/**
* Registers an instance in the propagation set when its hint requires buffering.
*
* @example
* A runtime-created component with `propagation: 'self'` is registered so its
* styles can be collected before head flush.
*/
export declare function registerIfPropagating(result: SSRResult, factory: AstroComponentFactory, instance: {
init(result: SSRResult): unknown | Promise<unknown>;
}): void;
export declare function bufferPropagatedHead(result: SSRResult): Promise<void>;
/** Facade helper for render instruction gating (`head` vs `maybe-head`). */
export declare function shouldRenderInstruction(type: 'head' | 'maybe-head', state: HeadInstructionRenderState): boolean;
/** Projects `SSRResult` into the minimal state needed by instruction policy. */
export declare function getInstructionRenderState(result: SSRResult): HeadInstructionRenderState;

View File

@@ -0,0 +1,53 @@
import { collectPropagatedHeadParts } from "../../../../core/head-propagation/buffer.js";
import {
getPropagationHint as getHint,
isPropagatingHint
} from "../../../../core/head-propagation/resolver.js";
import {
shouldRenderInstruction as shouldRenderInstructionByPolicy
} from "../../../../core/head-propagation/policy.js";
import { isHeadAndContent } from "../astro/head-and-content.js";
function getPropagationHint(result, factory) {
return getHint(result, factory);
}
function registerIfPropagating(result, factory, instance) {
if (factory.propagation === "self" || factory.propagation === "in-tree") {
result._metadata.propagators.add(
instance
);
return;
}
if (factory.moduleId) {
const hint = result.componentMetadata.get(factory.moduleId)?.propagation;
if (isPropagatingHint(hint ?? "none")) {
result._metadata.propagators.add(
instance
);
}
}
}
async function bufferPropagatedHead(result) {
const collected = await collectPropagatedHeadParts({
propagators: result._metadata.propagators,
result,
isHeadAndContent
});
result._metadata.extraHead.push(...collected);
}
function shouldRenderInstruction(type, state) {
return shouldRenderInstructionByPolicy(type, state);
}
function getInstructionRenderState(result) {
return {
hasRenderedHead: result._metadata.hasRenderedHead,
headInTree: result._metadata.headInTree,
partial: result.partial
};
}
export {
bufferPropagatedHead,
getInstructionRenderState,
getPropagationHint,
registerIfPropagating,
shouldRenderInstruction
};