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

5
node_modules/astro/dist/assets/svg/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import * as z from 'zod/v4';
export declare const SvgOptimizerSchema: z.ZodObject<{
name: z.ZodString;
optimize: z.ZodCustom<(contents: string) => string | Promise<string>, (contents: string) => string | Promise<string>>;
}, z.core.$strip>;

8
node_modules/astro/dist/assets/svg/config.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import * as z from "zod/v4";
const SvgOptimizerSchema = z.object({
name: z.string(),
optimize: z.custom((v) => typeof v === "function")
});
export {
SvgOptimizerSchema
};

4
node_modules/astro/dist/assets/svg/svgo.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { SvgOptimizer } from './types.js';
import { type Config } from 'svgo';
/** SVG optimizer using [SVGO](https://svgo.dev/). */
export declare function svgoOptimizer(config?: Config): SvgOptimizer;

10
node_modules/astro/dist/assets/svg/svgo.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { optimize } from "svgo";
function svgoOptimizer(config) {
return {
name: "svgo",
optimize: (contents) => optimize(contents, config).data
};
}
export {
svgoOptimizer
};

4
node_modules/astro/dist/assets/svg/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export interface SvgOptimizer {
name: string;
optimize: (contents: string) => string | Promise<string>;
}

0
node_modules/astro/dist/assets/svg/types.js generated vendored Normal file
View File

3
node_modules/astro/dist/assets/svg/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { ImageMetadata } from '../types.js';
import type { SvgOptimizer } from './types.js';
export declare function makeSvgComponent(meta: ImageMetadata, contents: Buffer | string, svgOptimizer: SvgOptimizer | undefined): Promise<string>;

79
node_modules/astro/dist/assets/svg/utils.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
import { ELEMENT_NODE, TEXT_NODE, parse, renderSync } from "ultrahtml";
import { AstroError, AstroErrorData } from "../../core/errors/index.js";
import { dropAttributes } from "../runtime.js";
async function parseSvg({
path,
contents,
svgOptimizer
}) {
let processedContents = contents;
if (svgOptimizer) {
try {
processedContents = await svgOptimizer.optimize(contents);
} catch (cause) {
throw new AstroError(
{
...AstroErrorData.CannotOptimizeSvg,
message: AstroErrorData.CannotOptimizeSvg.message(path, svgOptimizer.name)
},
{ cause }
);
}
}
const root = parse(processedContents);
const svgNode = root.children.find(
({ name, type }) => type === ELEMENT_NODE && name === "svg"
);
if (!svgNode) {
throw new Error("SVG file does not contain an <svg> element");
}
const { attributes, children } = svgNode;
const body = renderSync({ ...root, children });
const styles = [];
for (const child of children) {
if (child.type === ELEMENT_NODE && child.name === "style") {
const textContent = child.children?.filter((c) => c.type === TEXT_NODE).map((c) => c.value).join("");
if (textContent) {
styles.push(textContent);
}
}
}
return { attributes, body, styles };
}
async function makeSvgComponent(meta, contents, svgOptimizer) {
const file = typeof contents === "string" ? contents : contents.toString("utf-8");
const {
attributes,
body: children,
styles
} = await parseSvg({
path: meta.fsPath,
contents: file,
svgOptimizer
});
const props = {
meta,
attributes: dropAttributes(attributes),
children,
styles
};
return `import { createSvgComponent } from 'astro/assets/runtime';
export default createSvgComponent(${JSON.stringify(props)})`;
}
async function parseSvgComponentData(meta, contents, svgOptimizer) {
const file = typeof contents === "string" ? contents : contents.toString("utf-8");
const {
attributes,
body: children,
styles
} = await parseSvg({
path: meta.fsPath,
contents: file,
svgOptimizer
});
return { attributes: dropAttributes(attributes), children, styles };
}
export {
makeSvgComponent,
parseSvgComponentData
};