full site update
This commit is contained in:
BIN
node_modules/@astrojs/compiler/dist/astro.wasm
generated
vendored
BIN
node_modules/@astrojs/compiler/dist/astro.wasm
generated
vendored
Binary file not shown.
2
node_modules/@astrojs/compiler/package.json
generated
vendored
2
node_modules/@astrojs/compiler/package.json
generated
vendored
@@ -5,7 +5,7 @@
|
||||
"type": "module",
|
||||
"bugs": "https://github.com/withastro/compiler/issues",
|
||||
"homepage": "https://astro.build",
|
||||
"version": "2.12.0",
|
||||
"version": "2.12.2",
|
||||
"main": "./dist/node/index.js",
|
||||
"types": "./dist/shared/types.d.ts",
|
||||
"repository": {
|
||||
|
4
node_modules/@astrojs/internal-helpers/dist/fs.js
generated
vendored
4
node_modules/@astrojs/internal-helpers/dist/fs.js
generated
vendored
@@ -26,8 +26,8 @@ async function getFilesFromFolder(dir) {
|
||||
return files;
|
||||
}
|
||||
async function copyFilesToFolder(files, outDir, exclude = []) {
|
||||
const excludeList = exclude.map(fileURLToPath);
|
||||
const fileList = files.map(fileURLToPath).filter((f) => !excludeList.includes(f));
|
||||
const excludeList = exclude.map((url) => fileURLToPath(url));
|
||||
const fileList = files.map((url) => fileURLToPath(url)).filter((f) => !excludeList.includes(f));
|
||||
if (files.length === 0) throw new Error("No files found to copy");
|
||||
let commonAncestor = nodePath.dirname(fileList[0]);
|
||||
for (const file of fileList.slice(1)) {
|
||||
|
3
node_modules/@astrojs/internal-helpers/dist/path.d.ts
generated
vendored
3
node_modules/@astrojs/internal-helpers/dist/path.d.ts
generated
vendored
@@ -6,6 +6,8 @@ export declare function appendExtension(path: string, extension: string): string
|
||||
export declare function appendForwardSlash(path: string): string;
|
||||
export declare function prependForwardSlash(path: string): string;
|
||||
export declare function collapseDuplicateSlashes(path: string): string;
|
||||
export declare const MANY_TRAILING_SLASHES: RegExp;
|
||||
export declare function collapseDuplicateTrailingSlashes(path: string, trailingSlash: boolean): string;
|
||||
export declare function removeTrailingForwardSlash(path: string): string;
|
||||
export declare function removeLeadingForwardSlash(path: string): string;
|
||||
export declare function removeLeadingForwardSlashWindows(path: string): string;
|
||||
@@ -21,3 +23,4 @@ export declare function isRemotePath(src: string): boolean;
|
||||
export declare function slash(path: string): string;
|
||||
export declare function fileExtension(path: string): string;
|
||||
export declare function removeBase(path: string, base: string): string;
|
||||
export declare function hasFileExtension(path: string): boolean;
|
||||
|
14
node_modules/@astrojs/internal-helpers/dist/path.js
generated
vendored
14
node_modules/@astrojs/internal-helpers/dist/path.js
generated
vendored
@@ -10,6 +10,13 @@ function prependForwardSlash(path) {
|
||||
function collapseDuplicateSlashes(path) {
|
||||
return path.replace(/(?<!:)\/{2,}/g, "/");
|
||||
}
|
||||
const MANY_TRAILING_SLASHES = /\/{2,}$/g;
|
||||
function collapseDuplicateTrailingSlashes(path, trailingSlash) {
|
||||
if (!path) {
|
||||
return path;
|
||||
}
|
||||
return path.replace(MANY_TRAILING_SLASHES, trailingSlash ? "/" : "") || "/";
|
||||
}
|
||||
function removeTrailingForwardSlash(path) {
|
||||
return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
|
||||
}
|
||||
@@ -77,11 +84,18 @@ function removeBase(path, base) {
|
||||
}
|
||||
return path;
|
||||
}
|
||||
const WITH_FILE_EXT = /\/[^/]+\.\w+$/;
|
||||
function hasFileExtension(path) {
|
||||
return WITH_FILE_EXT.test(path);
|
||||
}
|
||||
export {
|
||||
MANY_TRAILING_SLASHES,
|
||||
appendExtension,
|
||||
appendForwardSlash,
|
||||
collapseDuplicateSlashes,
|
||||
collapseDuplicateTrailingSlashes,
|
||||
fileExtension,
|
||||
hasFileExtension,
|
||||
isRelativePath,
|
||||
isRemotePath,
|
||||
joinPaths,
|
||||
|
62
node_modules/@astrojs/internal-helpers/dist/remote.d.ts
generated
vendored
Normal file
62
node_modules/@astrojs/internal-helpers/dist/remote.d.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
export type RemotePattern = {
|
||||
hostname?: string;
|
||||
pathname?: string;
|
||||
protocol?: string;
|
||||
port?: string;
|
||||
};
|
||||
/**
|
||||
* Evaluates whether a given URL matches the specified remote pattern based on protocol, hostname, port, and pathname.
|
||||
*
|
||||
* @param {URL} url - The URL object to be matched against the remote pattern.
|
||||
* @param {RemotePattern} remotePattern - The remote pattern object containing the protocol, hostname, port, and pathname to match.
|
||||
* @return {boolean} Returns `true` if the URL matches the given remote pattern; otherwise, `false`.
|
||||
*/
|
||||
export declare function matchPattern(url: URL, remotePattern: RemotePattern): boolean;
|
||||
/**
|
||||
* Checks if the given URL's port matches the specified port. If no port is provided, it returns `true`.
|
||||
*
|
||||
* @param {URL} url - The URL object whose port will be checked.
|
||||
* @param {string} [port=] - The port to match against the URL's port. Optional.
|
||||
* @return {boolean} Returns `true` if the URL's port matches the specified port or if no port is provided; otherwise, `false`.
|
||||
*/
|
||||
export declare function matchPort(url: URL, port?: string): boolean;
|
||||
/**
|
||||
* Compares the protocol of the provided URL with a specified protocol.
|
||||
*
|
||||
* @param {URL} url - The URL object whose protocol needs to be checked.
|
||||
* @param {string} [protocol] - The protocol to compare against, without the trailing colon. If not provided, the method will always return `true`.
|
||||
* @return {boolean} Returns `true` if the protocol matches or if no protocol is specified; otherwise, `false`.
|
||||
*/
|
||||
export declare function matchProtocol(url: URL, protocol?: string): boolean;
|
||||
/**
|
||||
* Matches a given URL's hostname against a specified hostname, with optional support for wildcard patterns.
|
||||
*
|
||||
* @param {URL} url - The URL object whose hostname is to be matched.
|
||||
* @param {string} [hostname] - The hostname to match against. Supports wildcard patterns if `allowWildcard` is `true`.
|
||||
* @param {boolean} [allowWildcard=false] - Indicates whether wildcard patterns in the `hostname` parameter are allowed.
|
||||
* @return {boolean} - Returns `true` if the URL's hostname matches the given hostname criteria; otherwise, `false`.
|
||||
*/
|
||||
export declare function matchHostname(url: URL, hostname?: string, allowWildcard?: boolean): boolean;
|
||||
/**
|
||||
* Matches a given URL's pathname against a specified pattern, with optional support for wildcards.
|
||||
*
|
||||
* @param {URL} url - The URL object containing the pathname to be matched.
|
||||
* @param {string} [pathname] - The pathname pattern to match the URL against.
|
||||
* @param {boolean} [allowWildcard=false] - Determines whether wildcard matching is allowed.
|
||||
* @return {boolean} - Returns `true` if the URL's pathname matches the specified pattern; otherwise, `false`.
|
||||
*/
|
||||
export declare function matchPathname(url: URL, pathname?: string, allowWildcard?: boolean): boolean;
|
||||
/**
|
||||
* Determines whether a given remote resource, identified by its source URL,
|
||||
* is allowed based on specified domains and remote patterns.
|
||||
*
|
||||
* @param {string} src - The source URL of the remote resource to be validated.
|
||||
* @param {Object} options - The configuration options for domain and pattern matching.
|
||||
* @param {string[]} options.domains - A list of allowed domain names.
|
||||
* @param {RemotePattern[]} options.remotePatterns - A list of allowed remote patterns for matching.
|
||||
* @return {boolean} Returns `true` if the source URL matches any of the specified domains or remote patterns; otherwise, `false`.
|
||||
*/
|
||||
export declare function isRemoteAllowed(src: string, { domains, remotePatterns, }: {
|
||||
domains: string[];
|
||||
remotePatterns: RemotePattern[];
|
||||
}): boolean;
|
57
node_modules/@astrojs/internal-helpers/dist/remote.js
generated
vendored
Normal file
57
node_modules/@astrojs/internal-helpers/dist/remote.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
function matchPattern(url, remotePattern) {
|
||||
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
||||
}
|
||||
function matchPort(url, port) {
|
||||
return !port || port === url.port;
|
||||
}
|
||||
function matchProtocol(url, protocol) {
|
||||
return !protocol || protocol === url.protocol.slice(0, -1);
|
||||
}
|
||||
function matchHostname(url, hostname, allowWildcard = false) {
|
||||
if (!hostname) {
|
||||
return true;
|
||||
} else if (!allowWildcard || !hostname.startsWith("*")) {
|
||||
return hostname === url.hostname;
|
||||
} else if (hostname.startsWith("**.")) {
|
||||
const slicedHostname = hostname.slice(2);
|
||||
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
||||
} else if (hostname.startsWith("*.")) {
|
||||
const slicedHostname = hostname.slice(1);
|
||||
const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean);
|
||||
return additionalSubdomains.length === 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function matchPathname(url, pathname, allowWildcard = false) {
|
||||
if (!pathname) {
|
||||
return true;
|
||||
} else if (!allowWildcard || !pathname.endsWith("*")) {
|
||||
return pathname === url.pathname;
|
||||
} else if (pathname.endsWith("/**")) {
|
||||
const slicedPathname = pathname.slice(0, -2);
|
||||
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
||||
} else if (pathname.endsWith("/*")) {
|
||||
const slicedPathname = pathname.slice(0, -1);
|
||||
const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
|
||||
return additionalPathChunks.length === 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isRemoteAllowed(src, {
|
||||
domains,
|
||||
remotePatterns
|
||||
}) {
|
||||
if (!URL.canParse(src)) {
|
||||
return false;
|
||||
}
|
||||
const url = new URL(src);
|
||||
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
||||
}
|
||||
export {
|
||||
isRemoteAllowed,
|
||||
matchHostname,
|
||||
matchPathname,
|
||||
matchPattern,
|
||||
matchPort,
|
||||
matchProtocol
|
||||
};
|
9
node_modules/@astrojs/internal-helpers/package.json
generated
vendored
9
node_modules/@astrojs/internal-helpers/package.json
generated
vendored
@@ -1,18 +1,19 @@
|
||||
{
|
||||
"name": "@astrojs/internal-helpers",
|
||||
"description": "Internal helpers used by core Astro packages.",
|
||||
"version": "0.4.1",
|
||||
"version": "0.6.1",
|
||||
"type": "module",
|
||||
"author": "withastro",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/withastro/astro.git",
|
||||
"url": "git+https://github.com/withastro/astro.git",
|
||||
"directory": "packages/internal-helpers"
|
||||
},
|
||||
"bugs": "https://github.com/withastro/astro/issues",
|
||||
"exports": {
|
||||
"./path": "./dist/path.js",
|
||||
"./remote": "./dist/remote.js",
|
||||
"./fs": "./dist/fs.js"
|
||||
},
|
||||
"typesVersions": {
|
||||
@@ -20,6 +21,9 @@
|
||||
"path": [
|
||||
"./dist/path.d.ts"
|
||||
],
|
||||
"remote": [
|
||||
"./dist/remote.d.ts"
|
||||
],
|
||||
"fs": [
|
||||
"./dist/fs.d.ts"
|
||||
]
|
||||
@@ -42,7 +46,6 @@
|
||||
"prepublish": "pnpm build",
|
||||
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
|
||||
"build:ci": "astro-scripts build \"src/**/*.ts\"",
|
||||
"postbuild": "astro-scripts copy \"src/**/*.js\"",
|
||||
"dev": "astro-scripts dev \"src/**/*.ts\""
|
||||
}
|
||||
}
|
6
node_modules/@astrojs/markdown-remark/dist/frontmatter-injection.d.ts
generated
vendored
6
node_modules/@astrojs/markdown-remark/dist/frontmatter-injection.d.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
import type { VFileData as Data, VFile } from 'vfile';
|
||||
import type { MarkdownAstroData } from './types.js';
|
||||
export declare class InvalidAstroDataError extends TypeError {
|
||||
}
|
||||
export declare function safelyGetAstroData(vfileData: Data): MarkdownAstroData | InvalidAstroDataError;
|
||||
export declare function setVfileFrontmatter(vfile: VFile, frontmatter: Record<string, any>): void;
|
31
node_modules/@astrojs/markdown-remark/dist/frontmatter-injection.js
generated
vendored
31
node_modules/@astrojs/markdown-remark/dist/frontmatter-injection.js
generated
vendored
@@ -1,31 +0,0 @@
|
||||
function isValidAstroData(obj) {
|
||||
if (typeof obj === "object" && obj !== null && obj.hasOwnProperty("frontmatter")) {
|
||||
const { frontmatter } = obj;
|
||||
try {
|
||||
JSON.stringify(frontmatter);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return typeof frontmatter === "object" && frontmatter !== null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
class InvalidAstroDataError extends TypeError {
|
||||
}
|
||||
function safelyGetAstroData(vfileData) {
|
||||
const { astro } = vfileData;
|
||||
if (!astro || !isValidAstroData(astro)) {
|
||||
return new InvalidAstroDataError();
|
||||
}
|
||||
return astro;
|
||||
}
|
||||
function setVfileFrontmatter(vfile, frontmatter) {
|
||||
vfile.data ??= {};
|
||||
vfile.data.astro ??= {};
|
||||
vfile.data.astro.frontmatter = frontmatter;
|
||||
}
|
||||
export {
|
||||
InvalidAstroDataError,
|
||||
safelyGetAstroData,
|
||||
setVfileFrontmatter
|
||||
};
|
20
node_modules/@astrojs/markdown-remark/dist/frontmatter.d.ts
generated
vendored
Normal file
20
node_modules/@astrojs/markdown-remark/dist/frontmatter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export declare function isFrontmatterValid(frontmatter: Record<string, any>): boolean;
|
||||
export declare function extractFrontmatter(code: string): string | undefined;
|
||||
export interface ParseFrontmatterOptions {
|
||||
/**
|
||||
* How the frontmatter should be handled in the returned `content` string.
|
||||
* - `preserve`: Keep the frontmatter.
|
||||
* - `remove`: Remove the frontmatter.
|
||||
* - `empty-with-spaces`: Replace the frontmatter with empty spaces. (preserves sourcemap line/col/offset)
|
||||
* - `empty-with-lines`: Replace the frontmatter with empty line breaks. (preserves sourcemap line/col)
|
||||
*
|
||||
* @default 'remove'
|
||||
*/
|
||||
frontmatter: 'preserve' | 'remove' | 'empty-with-spaces' | 'empty-with-lines';
|
||||
}
|
||||
export interface ParseFrontmatterResult {
|
||||
frontmatter: Record<string, any>;
|
||||
rawFrontmatter: string;
|
||||
content: string;
|
||||
}
|
||||
export declare function parseFrontmatter(code: string, options?: ParseFrontmatterOptions): ParseFrontmatterResult;
|
58
node_modules/@astrojs/markdown-remark/dist/frontmatter.js
generated
vendored
Normal file
58
node_modules/@astrojs/markdown-remark/dist/frontmatter.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import yaml from "js-yaml";
|
||||
import * as toml from "smol-toml";
|
||||
function isFrontmatterValid(frontmatter) {
|
||||
try {
|
||||
JSON.stringify(frontmatter);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
return typeof frontmatter === "object" && frontmatter !== null;
|
||||
}
|
||||
const frontmatterRE = /(?:^\uFEFF?|^\s*\n)(?:---|\+\+\+)([\s\S]*?\n)(?:---|\+\+\+)/;
|
||||
const frontmatterTypeRE = /(?:^\uFEFF?|^\s*\n)(---|\+\+\+)/;
|
||||
function extractFrontmatter(code) {
|
||||
return frontmatterRE.exec(code)?.[1];
|
||||
}
|
||||
function getFrontmatterParser(code) {
|
||||
return frontmatterTypeRE.exec(code)?.[1] === "+++" ? ["+++", toml.parse] : ["---", yaml.load];
|
||||
}
|
||||
function parseFrontmatter(code, options) {
|
||||
const rawFrontmatter = extractFrontmatter(code);
|
||||
if (rawFrontmatter == null) {
|
||||
return { frontmatter: {}, rawFrontmatter: "", content: code };
|
||||
}
|
||||
const [delims, parser] = getFrontmatterParser(code);
|
||||
const parsed = parser(rawFrontmatter);
|
||||
const frontmatter = parsed && typeof parsed === "object" ? parsed : {};
|
||||
let content;
|
||||
switch (options?.frontmatter ?? "remove") {
|
||||
case "preserve":
|
||||
content = code;
|
||||
break;
|
||||
case "remove":
|
||||
content = code.replace(`${delims}${rawFrontmatter}${delims}`, "");
|
||||
break;
|
||||
case "empty-with-spaces":
|
||||
content = code.replace(
|
||||
`${delims}${rawFrontmatter}${delims}`,
|
||||
` ${rawFrontmatter.replace(/[^\r\n]/g, " ")} `
|
||||
);
|
||||
break;
|
||||
case "empty-with-lines":
|
||||
content = code.replace(
|
||||
`${delims}${rawFrontmatter}${delims}`,
|
||||
rawFrontmatter.replace(/[^\r\n]/g, "")
|
||||
);
|
||||
break;
|
||||
}
|
||||
return {
|
||||
frontmatter,
|
||||
rawFrontmatter,
|
||||
content
|
||||
};
|
||||
}
|
||||
export {
|
||||
extractFrontmatter,
|
||||
isFrontmatterValid,
|
||||
parseFrontmatter
|
||||
};
|
5
node_modules/@astrojs/markdown-remark/dist/highlight.d.ts
generated
vendored
5
node_modules/@astrojs/markdown-remark/dist/highlight.d.ts
generated
vendored
@@ -1,7 +1,8 @@
|
||||
import type { Root } from 'hast';
|
||||
type Highlighter = (code: string, language: string, options?: {
|
||||
meta?: string;
|
||||
}) => Promise<string>;
|
||||
}) => Promise<Root | string>;
|
||||
export declare const defaultExcludeLanguages: string[];
|
||||
/**
|
||||
* A hast utility to syntax highlight code blocks with a given syntax highlighter.
|
||||
*
|
||||
@@ -11,5 +12,5 @@ type Highlighter = (code: string, language: string, options?: {
|
||||
* A function which receives the code and language, and returns the HTML of a syntax
|
||||
* highlighted `<pre>` element.
|
||||
*/
|
||||
export declare function highlightCodeBlocks(tree: Root, highlighter: Highlighter): Promise<void>;
|
||||
export declare function highlightCodeBlocks(tree: Root, highlighter: Highlighter, excludeLanguages?: string[]): Promise<void>;
|
||||
export {};
|
||||
|
20
node_modules/@astrojs/markdown-remark/dist/highlight.js
generated
vendored
20
node_modules/@astrojs/markdown-remark/dist/highlight.js
generated
vendored
@@ -3,7 +3,8 @@ import { toText } from "hast-util-to-text";
|
||||
import { removePosition } from "unist-util-remove-position";
|
||||
import { visitParents } from "unist-util-visit-parents";
|
||||
const languagePattern = /\blanguage-(\S+)\b/;
|
||||
async function highlightCodeBlocks(tree, highlighter) {
|
||||
const defaultExcludeLanguages = ["math"];
|
||||
async function highlightCodeBlocks(tree, highlighter, excludeLanguages = []) {
|
||||
const nodes = [];
|
||||
visitParents(tree, { type: "element", tagName: "code" }, (node, ancestors) => {
|
||||
const parent = ancestors.at(-1);
|
||||
@@ -28,12 +29,13 @@ async function highlightCodeBlocks(tree, highlighter) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (languageMatch?.[1] === "math") {
|
||||
const language = languageMatch?.[1] || "plaintext";
|
||||
if (excludeLanguages.includes(language) || defaultExcludeLanguages.includes(language)) {
|
||||
return;
|
||||
}
|
||||
nodes.push({
|
||||
node,
|
||||
language: languageMatch?.[1] || "plaintext",
|
||||
language,
|
||||
parent,
|
||||
grandParent: ancestors.at(-2)
|
||||
});
|
||||
@@ -41,13 +43,19 @@ async function highlightCodeBlocks(tree, highlighter) {
|
||||
for (const { node, language, grandParent, parent } of nodes) {
|
||||
const meta = node.data?.meta ?? node.properties.metastring ?? void 0;
|
||||
const code = toText(node, { whitespace: "pre" });
|
||||
const html = await highlighter(code, language, { meta });
|
||||
const replacement = fromHtml(html, { fragment: true }).children[0];
|
||||
removePosition(replacement);
|
||||
const result = await highlighter(code, language, { meta });
|
||||
let replacement;
|
||||
if (typeof result === "string") {
|
||||
replacement = fromHtml(result, { fragment: true }).children[0];
|
||||
removePosition(replacement);
|
||||
} else {
|
||||
replacement = result.children[0];
|
||||
}
|
||||
const index = grandParent.children.indexOf(parent);
|
||||
grandParent.children[index] = replacement;
|
||||
}
|
||||
}
|
||||
export {
|
||||
defaultExcludeLanguages,
|
||||
highlightCodeBlocks
|
||||
};
|
||||
|
10
node_modules/@astrojs/markdown-remark/dist/import-plugin-default.js
generated
vendored
10
node_modules/@astrojs/markdown-remark/dist/import-plugin-default.js
generated
vendored
@@ -4,13 +4,19 @@ import { resolve as importMetaResolve } from "import-meta-resolve";
|
||||
let cwdUrlStr;
|
||||
async function importPlugin(p) {
|
||||
try {
|
||||
const importResult2 = await import(p);
|
||||
const importResult2 = await import(
|
||||
/* @vite-ignore */
|
||||
p
|
||||
);
|
||||
return importResult2.default;
|
||||
} catch {
|
||||
}
|
||||
cwdUrlStr ??= pathToFileURL(path.join(process.cwd(), "package.json")).toString();
|
||||
const resolved = importMetaResolve(p, cwdUrlStr);
|
||||
const importResult = await import(resolved);
|
||||
const importResult = await import(
|
||||
/* @vite-ignore */
|
||||
resolved
|
||||
);
|
||||
return importResult.default;
|
||||
}
|
||||
export {
|
||||
|
11
node_modules/@astrojs/markdown-remark/dist/index.d.ts
generated
vendored
11
node_modules/@astrojs/markdown-remark/dist/index.d.ts
generated
vendored
@@ -1,13 +1,14 @@
|
||||
import type { AstroMarkdownOptions, MarkdownProcessor } from './types.js';
|
||||
export { InvalidAstroDataError, setVfileFrontmatter } from './frontmatter-injection.js';
|
||||
import type { AstroMarkdownOptions, AstroMarkdownProcessorOptions, MarkdownProcessor, SyntaxHighlightConfig } from './types.js';
|
||||
export { extractFrontmatter, isFrontmatterValid, type ParseFrontmatterOptions, type ParseFrontmatterResult, parseFrontmatter, } from './frontmatter.js';
|
||||
export { rehypeHeadingIds } from './rehype-collect-headings.js';
|
||||
export { remarkCollectImages } from './remark-collect-images.js';
|
||||
export { rehypePrism } from './rehype-prism.js';
|
||||
export { rehypeShiki } from './rehype-shiki.js';
|
||||
export { createShikiHighlighter, type ShikiHighlighter } from './shiki.js';
|
||||
export { remarkCollectImages } from './remark-collect-images.js';
|
||||
export { type CreateShikiHighlighterOptions, createShikiHighlighter, type ShikiHighlighter, type ShikiHighlighterHighlightOptions, } from './shiki.js';
|
||||
export * from './types.js';
|
||||
export declare const syntaxHighlightDefaults: Required<SyntaxHighlightConfig>;
|
||||
export declare const markdownConfigDefaults: Required<AstroMarkdownOptions>;
|
||||
/**
|
||||
* Create a markdown preprocessor to render multiple markdown files
|
||||
*/
|
||||
export declare function createMarkdownProcessor(opts?: AstroMarkdownOptions): Promise<MarkdownProcessor>;
|
||||
export declare function createMarkdownProcessor(opts?: AstroMarkdownProcessorOptions): Promise<MarkdownProcessor>;
|
||||
|
83
node_modules/@astrojs/markdown-remark/dist/index.js
generated
vendored
83
node_modules/@astrojs/markdown-remark/dist/index.js
generated
vendored
@@ -1,13 +1,3 @@
|
||||
import {
|
||||
InvalidAstroDataError,
|
||||
safelyGetAstroData,
|
||||
setVfileFrontmatter
|
||||
} from "./frontmatter-injection.js";
|
||||
import { loadPlugins } from "./load-plugins.js";
|
||||
import { rehypeHeadingIds } from "./rehype-collect-headings.js";
|
||||
import { rehypePrism } from "./rehype-prism.js";
|
||||
import { rehypeShiki } from "./rehype-shiki.js";
|
||||
import { remarkCollectImages } from "./remark-collect-images.js";
|
||||
import rehypeRaw from "rehype-raw";
|
||||
import rehypeStringify from "rehype-stringify";
|
||||
import remarkGfm from "remark-gfm";
|
||||
@@ -16,16 +6,32 @@ import remarkRehype from "remark-rehype";
|
||||
import remarkSmartypants from "remark-smartypants";
|
||||
import { unified } from "unified";
|
||||
import { VFile } from "vfile";
|
||||
import { defaultExcludeLanguages } from "./highlight.js";
|
||||
import { loadPlugins } from "./load-plugins.js";
|
||||
import { rehypeHeadingIds } from "./rehype-collect-headings.js";
|
||||
import { rehypeImages } from "./rehype-images.js";
|
||||
import { InvalidAstroDataError as InvalidAstroDataError2, setVfileFrontmatter as setVfileFrontmatter2 } from "./frontmatter-injection.js";
|
||||
import { rehypePrism } from "./rehype-prism.js";
|
||||
import { rehypeShiki } from "./rehype-shiki.js";
|
||||
import { remarkCollectImages } from "./remark-collect-images.js";
|
||||
import {
|
||||
extractFrontmatter,
|
||||
isFrontmatterValid,
|
||||
parseFrontmatter
|
||||
} from "./frontmatter.js";
|
||||
import { rehypeHeadingIds as rehypeHeadingIds2 } from "./rehype-collect-headings.js";
|
||||
import { remarkCollectImages as remarkCollectImages2 } from "./remark-collect-images.js";
|
||||
import { rehypePrism as rehypePrism2 } from "./rehype-prism.js";
|
||||
import { rehypeShiki as rehypeShiki2 } from "./rehype-shiki.js";
|
||||
import { createShikiHighlighter } from "./shiki.js";
|
||||
import { remarkCollectImages as remarkCollectImages2 } from "./remark-collect-images.js";
|
||||
import {
|
||||
createShikiHighlighter
|
||||
} from "./shiki.js";
|
||||
export * from "./types.js";
|
||||
const syntaxHighlightDefaults = {
|
||||
type: "shiki",
|
||||
excludeLangs: defaultExcludeLanguages
|
||||
};
|
||||
const markdownConfigDefaults = {
|
||||
syntaxHighlight: "shiki",
|
||||
syntaxHighlight: syntaxHighlightDefaults,
|
||||
shikiConfig: {
|
||||
langs: [],
|
||||
theme: "github-dark",
|
||||
@@ -49,7 +55,8 @@ async function createMarkdownProcessor(opts) {
|
||||
rehypePlugins = markdownConfigDefaults.rehypePlugins,
|
||||
remarkRehype: remarkRehypeOptions = markdownConfigDefaults.remarkRehype,
|
||||
gfm = markdownConfigDefaults.gfm,
|
||||
smartypants = markdownConfigDefaults.smartypants
|
||||
smartypants = markdownConfigDefaults.smartypants,
|
||||
experimentalHeadingIdCompat = false
|
||||
} = opts ?? {};
|
||||
const loadedRemarkPlugins = await Promise.all(loadPlugins(remarkPlugins));
|
||||
const loadedRehypePlugins = await Promise.all(loadPlugins(rehypePlugins));
|
||||
@@ -66,47 +73,53 @@ async function createMarkdownProcessor(opts) {
|
||||
parser.use(plugin, pluginOpts);
|
||||
}
|
||||
if (!isPerformanceBenchmark) {
|
||||
parser.use(remarkCollectImages);
|
||||
parser.use(remarkCollectImages, opts?.image);
|
||||
}
|
||||
parser.use(remarkRehype, {
|
||||
allowDangerousHtml: true,
|
||||
passThrough: [],
|
||||
...remarkRehypeOptions
|
||||
});
|
||||
if (!isPerformanceBenchmark) {
|
||||
if (syntaxHighlight === "shiki") {
|
||||
parser.use(rehypeShiki, shikiConfig);
|
||||
} else if (syntaxHighlight === "prism") {
|
||||
parser.use(rehypePrism);
|
||||
if (syntaxHighlight && !isPerformanceBenchmark) {
|
||||
const syntaxHighlightType = typeof syntaxHighlight === "string" ? syntaxHighlight : syntaxHighlight?.type;
|
||||
const excludeLangs = typeof syntaxHighlight === "object" ? syntaxHighlight?.excludeLangs : void 0;
|
||||
if (syntaxHighlightType === "shiki") {
|
||||
parser.use(rehypeShiki, shikiConfig, excludeLangs);
|
||||
} else if (syntaxHighlightType === "prism") {
|
||||
parser.use(rehypePrism, excludeLangs);
|
||||
}
|
||||
}
|
||||
for (const [plugin, pluginOpts] of loadedRehypePlugins) {
|
||||
parser.use(plugin, pluginOpts);
|
||||
}
|
||||
parser.use(rehypeImages());
|
||||
parser.use(rehypeImages);
|
||||
if (!isPerformanceBenchmark) {
|
||||
parser.use(rehypeHeadingIds);
|
||||
parser.use(rehypeHeadingIds, { experimentalHeadingIdCompat });
|
||||
}
|
||||
parser.use(rehypeRaw).use(rehypeStringify, { allowDangerousHtml: true });
|
||||
return {
|
||||
async render(content, renderOpts) {
|
||||
const vfile = new VFile({ value: content, path: renderOpts?.fileURL });
|
||||
setVfileFrontmatter(vfile, renderOpts?.frontmatter ?? {});
|
||||
const vfile = new VFile({
|
||||
value: content,
|
||||
path: renderOpts?.fileURL,
|
||||
data: {
|
||||
astro: {
|
||||
frontmatter: renderOpts?.frontmatter ?? {}
|
||||
}
|
||||
}
|
||||
});
|
||||
const result = await parser.process(vfile).catch((err) => {
|
||||
err = prefixError(err, `Failed to parse Markdown file "${vfile.path}"`);
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
const astroData = safelyGetAstroData(result.data);
|
||||
if (astroData instanceof InvalidAstroDataError) {
|
||||
throw astroData;
|
||||
}
|
||||
return {
|
||||
code: String(result.value),
|
||||
metadata: {
|
||||
headings: result.data.__astroHeadings ?? [],
|
||||
imagePaths: result.data.imagePaths ?? /* @__PURE__ */ new Set(),
|
||||
frontmatter: astroData.frontmatter ?? {}
|
||||
headings: result.data.astro?.headings ?? [],
|
||||
localImagePaths: result.data.astro?.localImagePaths ?? [],
|
||||
remoteImagePaths: result.data.astro?.remoteImagePaths ?? [],
|
||||
frontmatter: result.data.astro?.frontmatter ?? {}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -130,13 +143,15 @@ ${err.message}`;
|
||||
return wrappedError;
|
||||
}
|
||||
export {
|
||||
InvalidAstroDataError2 as InvalidAstroDataError,
|
||||
createMarkdownProcessor,
|
||||
createShikiHighlighter,
|
||||
extractFrontmatter,
|
||||
isFrontmatterValid,
|
||||
markdownConfigDefaults,
|
||||
parseFrontmatter,
|
||||
rehypeHeadingIds2 as rehypeHeadingIds,
|
||||
rehypePrism2 as rehypePrism,
|
||||
rehypeShiki2 as rehypeShiki,
|
||||
remarkCollectImages2 as remarkCollectImages,
|
||||
setVfileFrontmatter2 as setVfileFrontmatter
|
||||
syntaxHighlightDefaults
|
||||
};
|
||||
|
1
node_modules/@astrojs/markdown-remark/dist/internal.d.ts
generated
vendored
1
node_modules/@astrojs/markdown-remark/dist/internal.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export { InvalidAstroDataError, safelyGetAstroData } from './frontmatter-injection.js';
|
5
node_modules/@astrojs/markdown-remark/dist/internal.js
generated
vendored
5
node_modules/@astrojs/markdown-remark/dist/internal.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
import { InvalidAstroDataError, safelyGetAstroData } from "./frontmatter-injection.js";
|
||||
export {
|
||||
InvalidAstroDataError,
|
||||
safelyGetAstroData
|
||||
};
|
11
node_modules/@astrojs/markdown-remark/dist/rehype-collect-headings.d.ts
generated
vendored
11
node_modules/@astrojs/markdown-remark/dist/rehype-collect-headings.d.ts
generated
vendored
@@ -1,2 +1,11 @@
|
||||
import type { RehypePlugin } from './types.js';
|
||||
export declare function rehypeHeadingIds(): ReturnType<RehypePlugin>;
|
||||
/**
|
||||
* Rehype plugin that adds `id` attributes to headings based on their text content.
|
||||
*
|
||||
* @param options Optional configuration object for the plugin.
|
||||
*
|
||||
* @see https://docs.astro.build/en/guides/markdown-content/#heading-ids-and-plugins
|
||||
*/
|
||||
export declare function rehypeHeadingIds({ experimentalHeadingIdCompat, }?: {
|
||||
experimentalHeadingIdCompat?: boolean;
|
||||
}): ReturnType<RehypePlugin>;
|
||||
|
25
node_modules/@astrojs/markdown-remark/dist/rehype-collect-headings.js
generated
vendored
25
node_modules/@astrojs/markdown-remark/dist/rehype-collect-headings.js
generated
vendored
@@ -1,14 +1,15 @@
|
||||
import Slugger from "github-slugger";
|
||||
import { visit } from "unist-util-visit";
|
||||
import { InvalidAstroDataError, safelyGetAstroData } from "./frontmatter-injection.js";
|
||||
const rawNodeTypes = /* @__PURE__ */ new Set(["text", "raw", "mdxTextExpression"]);
|
||||
const codeTagNames = /* @__PURE__ */ new Set(["code", "pre"]);
|
||||
function rehypeHeadingIds() {
|
||||
function rehypeHeadingIds({
|
||||
experimentalHeadingIdCompat
|
||||
} = {}) {
|
||||
return function(tree, file) {
|
||||
const headings = [];
|
||||
const frontmatter = file.data.astro?.frontmatter;
|
||||
const slugger = new Slugger();
|
||||
const isMDX = isMDXFile(file);
|
||||
const astroData = safelyGetAstroData(file.data);
|
||||
visit(tree, (node) => {
|
||||
if (node.type !== "element") return;
|
||||
const { tagName } = node;
|
||||
@@ -29,10 +30,13 @@ function rehypeHeadingIds() {
|
||||
if (rawNodeTypes.has(child.type)) {
|
||||
if (isMDX || codeTagNames.has(parent.tagName)) {
|
||||
let value = child.value;
|
||||
if (isMdxTextExpression(child) && !(astroData instanceof InvalidAstroDataError)) {
|
||||
if (isMdxTextExpression(child) && frontmatter) {
|
||||
const frontmatterPath = getMdxFrontmatterVariablePath(child);
|
||||
if (Array.isArray(frontmatterPath) && frontmatterPath.length > 0) {
|
||||
const frontmatterValue = getMdxFrontmatterVariableValue(astroData, frontmatterPath);
|
||||
const frontmatterValue = getMdxFrontmatterVariableValue(
|
||||
frontmatter,
|
||||
frontmatterPath
|
||||
);
|
||||
if (typeof frontmatterValue === "string") {
|
||||
value = frontmatterValue;
|
||||
}
|
||||
@@ -47,12 +51,15 @@ function rehypeHeadingIds() {
|
||||
node.properties = node.properties || {};
|
||||
if (typeof node.properties.id !== "string") {
|
||||
let slug = slugger.slug(text);
|
||||
if (slug.endsWith("-")) slug = slug.slice(0, -1);
|
||||
if (!experimentalHeadingIdCompat) {
|
||||
if (slug.endsWith("-")) slug = slug.slice(0, -1);
|
||||
}
|
||||
node.properties.id = slug;
|
||||
}
|
||||
headings.push({ depth, slug: node.properties.id, text });
|
||||
});
|
||||
file.data.__astroHeadings = headings;
|
||||
file.data.astro ??= {};
|
||||
file.data.astro.headings = headings;
|
||||
};
|
||||
}
|
||||
function isMDXFile(file) {
|
||||
@@ -74,8 +81,8 @@ function getMdxFrontmatterVariablePath(node) {
|
||||
if (expression.type !== "Identifier" || expression.name !== "frontmatter") return new Error();
|
||||
return expressionPath.reverse();
|
||||
}
|
||||
function getMdxFrontmatterVariableValue(astroData, path) {
|
||||
let value = astroData.frontmatter;
|
||||
function getMdxFrontmatterVariableValue(frontmatter, path) {
|
||||
let value = frontmatter;
|
||||
for (const key of path) {
|
||||
if (!value[key]) return void 0;
|
||||
value = value[key];
|
||||
|
5
node_modules/@astrojs/markdown-remark/dist/rehype-images.d.ts
generated
vendored
5
node_modules/@astrojs/markdown-remark/dist/rehype-images.d.ts
generated
vendored
@@ -1,2 +1,3 @@
|
||||
import type { MarkdownVFile } from './types.js';
|
||||
export declare function rehypeImages(): () => (tree: any, file: MarkdownVFile) => void;
|
||||
import type { Root } from 'hast';
|
||||
import type { VFile } from 'vfile';
|
||||
export declare function rehypeImages(): (tree: Root, file: VFile) => void;
|
||||
|
36
node_modules/@astrojs/markdown-remark/dist/rehype-images.js
generated
vendored
36
node_modules/@astrojs/markdown-remark/dist/rehype-images.js
generated
vendored
@@ -1,22 +1,30 @@
|
||||
import { visit } from "unist-util-visit";
|
||||
function rehypeImages() {
|
||||
return () => function(tree, file) {
|
||||
return function(tree, file) {
|
||||
if (!file.data.astro?.localImagePaths?.length && !file.data.astro?.remoteImagePaths?.length) {
|
||||
return;
|
||||
}
|
||||
const imageOccurrenceMap = /* @__PURE__ */ new Map();
|
||||
visit(tree, (node) => {
|
||||
if (node.type !== "element") return;
|
||||
visit(tree, "element", (node) => {
|
||||
if (node.tagName !== "img") return;
|
||||
if (node.properties?.src) {
|
||||
node.properties.src = decodeURI(node.properties.src);
|
||||
if (file.data.imagePaths?.has(node.properties.src)) {
|
||||
const { ...props } = node.properties;
|
||||
const index = imageOccurrenceMap.get(node.properties.src) || 0;
|
||||
imageOccurrenceMap.set(node.properties.src, index + 1);
|
||||
node.properties["__ASTRO_IMAGE_"] = JSON.stringify({ ...props, index });
|
||||
Object.keys(props).forEach((prop) => {
|
||||
delete node.properties[prop];
|
||||
});
|
||||
}
|
||||
if (typeof node.properties?.src !== "string") return;
|
||||
const src = decodeURI(node.properties.src);
|
||||
let newProperties;
|
||||
if (file.data.astro?.localImagePaths?.includes(src)) {
|
||||
newProperties = { ...node.properties, src };
|
||||
} else if (file.data.astro?.remoteImagePaths?.includes(src)) {
|
||||
newProperties = {
|
||||
// By default, markdown images won't have width and height set. However, just in case another user plugin does set these, we should respect them.
|
||||
inferSize: "width" in node.properties && "height" in node.properties ? void 0 : true,
|
||||
...node.properties,
|
||||
src
|
||||
};
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
const index = imageOccurrenceMap.get(node.properties.src) || 0;
|
||||
imageOccurrenceMap.set(node.properties.src, index + 1);
|
||||
node.properties = { __ASTRO_IMAGE_: JSON.stringify({ ...newProperties, index }) };
|
||||
});
|
||||
};
|
||||
}
|
||||
|
2
node_modules/@astrojs/markdown-remark/dist/rehype-prism.d.ts
generated
vendored
2
node_modules/@astrojs/markdown-remark/dist/rehype-prism.d.ts
generated
vendored
@@ -1,3 +1,3 @@
|
||||
import type { Root } from 'hast';
|
||||
import type { Plugin } from 'unified';
|
||||
export declare const rehypePrism: Plugin<[], Root>;
|
||||
export declare const rehypePrism: Plugin<[string[]?], Root>;
|
||||
|
18
node_modules/@astrojs/markdown-remark/dist/rehype-prism.js
generated
vendored
18
node_modules/@astrojs/markdown-remark/dist/rehype-prism.js
generated
vendored
@@ -1,13 +1,17 @@
|
||||
import { runHighlighterWithAstro } from "@astrojs/prism/dist/highlighter";
|
||||
import { highlightCodeBlocks } from "./highlight.js";
|
||||
const rehypePrism = () => {
|
||||
const rehypePrism = (excludeLangs) => {
|
||||
return async (tree) => {
|
||||
await highlightCodeBlocks(tree, (code, language) => {
|
||||
let { html, classLanguage } = runHighlighterWithAstro(language, code);
|
||||
return Promise.resolve(
|
||||
`<pre class="${classLanguage}" data-language="${language}"><code is:raw class="${classLanguage}">${html}</code></pre>`
|
||||
);
|
||||
});
|
||||
await highlightCodeBlocks(
|
||||
tree,
|
||||
(code, language) => {
|
||||
let { html, classLanguage } = runHighlighterWithAstro(language, code);
|
||||
return Promise.resolve(
|
||||
`<pre class="${classLanguage}" data-language="${language}"><code is:raw class="${classLanguage}">${html}</code></pre>`
|
||||
);
|
||||
},
|
||||
excludeLangs
|
||||
);
|
||||
};
|
||||
};
|
||||
export {
|
||||
|
2
node_modules/@astrojs/markdown-remark/dist/rehype-shiki.d.ts
generated
vendored
2
node_modules/@astrojs/markdown-remark/dist/rehype-shiki.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import type { Root } from 'hast';
|
||||
import type { Plugin } from 'unified';
|
||||
import type { ShikiConfig } from './types.js';
|
||||
export declare const rehypeShiki: Plugin<[ShikiConfig?], Root>;
|
||||
export declare const rehypeShiki: Plugin<[ShikiConfig, string[]?], Root>;
|
||||
|
22
node_modules/@astrojs/markdown-remark/dist/rehype-shiki.js
generated
vendored
22
node_modules/@astrojs/markdown-remark/dist/rehype-shiki.js
generated
vendored
@@ -1,11 +1,27 @@
|
||||
import { highlightCodeBlocks } from "./highlight.js";
|
||||
import { createShikiHighlighter } from "./shiki.js";
|
||||
const rehypeShiki = (config) => {
|
||||
const rehypeShiki = (config, excludeLangs) => {
|
||||
let highlighterAsync;
|
||||
return async (tree) => {
|
||||
highlighterAsync ??= createShikiHighlighter(config);
|
||||
highlighterAsync ??= createShikiHighlighter({
|
||||
langs: config?.langs,
|
||||
theme: config?.theme,
|
||||
themes: config?.themes,
|
||||
langAlias: config?.langAlias
|
||||
});
|
||||
const highlighter = await highlighterAsync;
|
||||
await highlightCodeBlocks(tree, highlighter.highlight);
|
||||
await highlightCodeBlocks(
|
||||
tree,
|
||||
(code, language, options) => {
|
||||
return highlighter.codeToHast(code, language, {
|
||||
meta: options?.meta,
|
||||
wrap: config?.wrap,
|
||||
defaultColor: config?.defaultColor,
|
||||
transformers: config?.transformers
|
||||
});
|
||||
},
|
||||
excludeLangs
|
||||
);
|
||||
};
|
||||
};
|
||||
export {
|
||||
|
6
node_modules/@astrojs/markdown-remark/dist/remark-collect-images.d.ts
generated
vendored
6
node_modules/@astrojs/markdown-remark/dist/remark-collect-images.d.ts
generated
vendored
@@ -1,2 +1,4 @@
|
||||
import type { MarkdownVFile } from './types.js';
|
||||
export declare function remarkCollectImages(): (tree: any, vfile: MarkdownVFile) => void;
|
||||
import type { Root } from 'mdast';
|
||||
import type { VFile } from 'vfile';
|
||||
import type { AstroMarkdownProcessorOptions } from './types.js';
|
||||
export declare function remarkCollectImages(opts: AstroMarkdownProcessorOptions['image']): (tree: Root, vfile: VFile) => void;
|
||||
|
42
node_modules/@astrojs/markdown-remark/dist/remark-collect-images.js
generated
vendored
42
node_modules/@astrojs/markdown-remark/dist/remark-collect-images.js
generated
vendored
@@ -1,36 +1,38 @@
|
||||
import { isRemoteAllowed } from "@astrojs/internal-helpers/remote";
|
||||
import { definitions } from "mdast-util-definitions";
|
||||
import { visit } from "unist-util-visit";
|
||||
function remarkCollectImages() {
|
||||
function remarkCollectImages(opts) {
|
||||
const domains = opts?.domains ?? [];
|
||||
const remotePatterns = opts?.remotePatterns ?? [];
|
||||
return function(tree, vfile) {
|
||||
if (typeof vfile?.path !== "string") return;
|
||||
const definition = definitions(tree);
|
||||
const imagePaths = /* @__PURE__ */ new Set();
|
||||
visit(tree, ["image", "imageReference"], (node) => {
|
||||
const localImagePaths = /* @__PURE__ */ new Set();
|
||||
const remoteImagePaths = /* @__PURE__ */ new Set();
|
||||
visit(tree, (node) => {
|
||||
let url;
|
||||
if (node.type === "image") {
|
||||
if (shouldOptimizeImage(node.url)) imagePaths.add(decodeURI(node.url));
|
||||
}
|
||||
if (node.type === "imageReference") {
|
||||
url = decodeURI(node.url);
|
||||
} else if (node.type === "imageReference") {
|
||||
const imageDefinition = definition(node.identifier);
|
||||
if (imageDefinition) {
|
||||
if (shouldOptimizeImage(imageDefinition.url))
|
||||
imagePaths.add(decodeURI(imageDefinition.url));
|
||||
url = decodeURI(imageDefinition.url);
|
||||
}
|
||||
}
|
||||
if (!url) return;
|
||||
if (URL.canParse(url)) {
|
||||
if (isRemoteAllowed(url, { domains, remotePatterns })) {
|
||||
remoteImagePaths.add(url);
|
||||
}
|
||||
} else if (!url.startsWith("/")) {
|
||||
localImagePaths.add(url);
|
||||
}
|
||||
});
|
||||
vfile.data.imagePaths = imagePaths;
|
||||
vfile.data.astro ??= {};
|
||||
vfile.data.astro.localImagePaths = Array.from(localImagePaths);
|
||||
vfile.data.astro.remoteImagePaths = Array.from(remoteImagePaths);
|
||||
};
|
||||
}
|
||||
function shouldOptimizeImage(src) {
|
||||
return !isValidUrl(src) && !src.startsWith("/");
|
||||
}
|
||||
function isValidUrl(str) {
|
||||
try {
|
||||
new URL(str);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export {
|
||||
remarkCollectImages
|
||||
};
|
||||
|
51
node_modules/@astrojs/markdown-remark/dist/shiki.d.ts
generated
vendored
51
node_modules/@astrojs/markdown-remark/dist/shiki.d.ts
generated
vendored
@@ -1,12 +1,43 @@
|
||||
import type { ShikiConfig } from './types.js';
|
||||
import type { Root } from 'hast';
|
||||
import { type HighlighterCoreOptions, type LanguageRegistration, type ShikiTransformer, type ThemeRegistration, type ThemeRegistrationRaw } from 'shiki';
|
||||
import type { ThemePresets } from './types.js';
|
||||
export interface ShikiHighlighter {
|
||||
highlight(code: string, lang?: string, options?: {
|
||||
inline?: boolean;
|
||||
attributes?: Record<string, string>;
|
||||
/**
|
||||
* Raw `meta` information to be used by Shiki transformers
|
||||
*/
|
||||
meta?: string;
|
||||
}): Promise<string>;
|
||||
codeToHast(code: string, lang?: string, options?: ShikiHighlighterHighlightOptions): Promise<Root>;
|
||||
codeToHtml(code: string, lang?: string, options?: ShikiHighlighterHighlightOptions): Promise<string>;
|
||||
}
|
||||
export declare function createShikiHighlighter({ langs, theme, themes, defaultColor, wrap, transformers, langAlias, }?: ShikiConfig): Promise<ShikiHighlighter>;
|
||||
export interface CreateShikiHighlighterOptions {
|
||||
langs?: LanguageRegistration[];
|
||||
theme?: ThemePresets | ThemeRegistration | ThemeRegistrationRaw;
|
||||
themes?: Record<string, ThemePresets | ThemeRegistration | ThemeRegistrationRaw>;
|
||||
langAlias?: HighlighterCoreOptions['langAlias'];
|
||||
}
|
||||
export interface ShikiHighlighterHighlightOptions {
|
||||
/**
|
||||
* Generate inline code element only, without the pre element wrapper.
|
||||
*/
|
||||
inline?: boolean;
|
||||
/**
|
||||
* Enable word wrapping.
|
||||
* - true: enabled.
|
||||
* - false: disabled.
|
||||
* - null: All overflow styling removed. Code will overflow the element by default.
|
||||
*/
|
||||
wrap?: boolean | null;
|
||||
/**
|
||||
* Chooses a theme from the "themes" option that you've defined as the default styling theme.
|
||||
*/
|
||||
defaultColor?: 'light' | 'dark' | string | false;
|
||||
/**
|
||||
* Shiki transformers to customize the generated HTML by manipulating the hast tree.
|
||||
*/
|
||||
transformers?: ShikiTransformer[];
|
||||
/**
|
||||
* Additional attributes to be added to the root code block element.
|
||||
*/
|
||||
attributes?: Record<string, string>;
|
||||
/**
|
||||
* Raw `meta` information to be used by Shiki transformers.
|
||||
*/
|
||||
meta?: string;
|
||||
}
|
||||
export declare function createShikiHighlighter({ langs, theme, themes, langAlias, }?: CreateShikiHighlighterOptions): Promise<ShikiHighlighter>;
|
||||
|
179
node_modules/@astrojs/markdown-remark/dist/shiki.js
generated
vendored
179
node_modules/@astrojs/markdown-remark/dist/shiki.js
generated
vendored
@@ -1,130 +1,109 @@
|
||||
import {
|
||||
createCssVariablesTheme,
|
||||
getHighlighter,
|
||||
createHighlighter,
|
||||
isSpecialLang
|
||||
} from "shiki";
|
||||
import { visit } from "unist-util-visit";
|
||||
const ASTRO_COLOR_REPLACEMENTS = {
|
||||
"--astro-code-foreground": "--astro-code-color-text",
|
||||
"--astro-code-background": "--astro-code-color-background"
|
||||
};
|
||||
const COLOR_REPLACEMENT_REGEX = new RegExp(
|
||||
`${Object.keys(ASTRO_COLOR_REPLACEMENTS).join("|")}`,
|
||||
"g"
|
||||
);
|
||||
let _cssVariablesTheme;
|
||||
const cssVariablesTheme = () => _cssVariablesTheme ?? (_cssVariablesTheme = createCssVariablesTheme({ variablePrefix: "--astro-code-" }));
|
||||
const cssVariablesTheme = () => _cssVariablesTheme ?? (_cssVariablesTheme = createCssVariablesTheme({
|
||||
variablePrefix: "--astro-code-"
|
||||
}));
|
||||
async function createShikiHighlighter({
|
||||
langs = [],
|
||||
theme = "github-dark",
|
||||
themes = {},
|
||||
defaultColor,
|
||||
wrap = false,
|
||||
transformers = [],
|
||||
langAlias = {}
|
||||
} = {}) {
|
||||
theme = theme === "css-variables" ? cssVariablesTheme() : theme;
|
||||
const highlighter = await getHighlighter({
|
||||
const highlighter = await createHighlighter({
|
||||
langs: ["plaintext", ...langs],
|
||||
langAlias,
|
||||
themes: Object.values(themes).length ? Object.values(themes) : [theme]
|
||||
});
|
||||
return {
|
||||
async highlight(code, lang = "plaintext", options) {
|
||||
const resolvedLang = langAlias[lang] ?? lang;
|
||||
const loadedLanguages = highlighter.getLoadedLanguages();
|
||||
if (!isSpecialLang(lang) && !loadedLanguages.includes(resolvedLang)) {
|
||||
try {
|
||||
await highlighter.loadLanguage(resolvedLang);
|
||||
} catch (_err) {
|
||||
const langStr = lang === resolvedLang ? `"${lang}"` : `"${lang}" (aliased to "${resolvedLang}")`;
|
||||
console.warn(
|
||||
`[Shiki] The language ${langStr} doesn't exist, falling back to "plaintext".`
|
||||
);
|
||||
lang = "plaintext";
|
||||
}
|
||||
async function highlight(code, lang = "plaintext", options, to) {
|
||||
const resolvedLang = langAlias[lang] ?? lang;
|
||||
const loadedLanguages = highlighter.getLoadedLanguages();
|
||||
if (!isSpecialLang(lang) && !loadedLanguages.includes(resolvedLang)) {
|
||||
try {
|
||||
await highlighter.loadLanguage(resolvedLang);
|
||||
} catch (_err) {
|
||||
const langStr = lang === resolvedLang ? `"${lang}"` : `"${lang}" (aliased to "${resolvedLang}")`;
|
||||
console.warn(`[Shiki] The language ${langStr} doesn't exist, falling back to "plaintext".`);
|
||||
lang = "plaintext";
|
||||
}
|
||||
const themeOptions = Object.values(themes).length ? { themes } : { theme };
|
||||
const inline = options?.inline ?? false;
|
||||
return highlighter.codeToHtml(code, {
|
||||
...themeOptions,
|
||||
defaultColor,
|
||||
lang,
|
||||
// NOTE: while we can spread `options.attributes` here so that Shiki can auto-serialize this as rendered
|
||||
// attributes on the top-level tag, it's not clear whether it is fine to pass all attributes as meta, as
|
||||
// they're technically not meta, nor parsed from Shiki's `parseMetaString` API.
|
||||
meta: options?.meta ? { __raw: options?.meta } : void 0,
|
||||
transformers: [
|
||||
{
|
||||
pre(node) {
|
||||
if (inline) {
|
||||
node.tagName = "code";
|
||||
}
|
||||
const {
|
||||
class: attributesClass,
|
||||
style: attributesStyle,
|
||||
...rest
|
||||
} = options?.attributes ?? {};
|
||||
Object.assign(node.properties, rest);
|
||||
const classValue = (normalizePropAsString(node.properties.class) ?? "") + (attributesClass ? ` ${attributesClass}` : "");
|
||||
const styleValue = (normalizePropAsString(node.properties.style) ?? "") + (attributesStyle ? `; ${attributesStyle}` : "");
|
||||
node.properties.class = classValue.replace(/shiki/g, "astro-code");
|
||||
node.properties.dataLanguage = lang;
|
||||
if (wrap === false) {
|
||||
node.properties.style = styleValue + "; overflow-x: auto;";
|
||||
} else if (wrap === true) {
|
||||
node.properties.style = styleValue + "; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;";
|
||||
}
|
||||
},
|
||||
line(node) {
|
||||
if (resolvedLang === "diff") {
|
||||
const innerSpanNode = node.children[0];
|
||||
const innerSpanTextNode = innerSpanNode?.type === "element" && innerSpanNode.children?.[0];
|
||||
if (innerSpanTextNode && innerSpanTextNode.type === "text") {
|
||||
const start = innerSpanTextNode.value[0];
|
||||
if (start === "+" || start === "-") {
|
||||
innerSpanTextNode.value = innerSpanTextNode.value.slice(1);
|
||||
innerSpanNode.children.unshift({
|
||||
type: "element",
|
||||
tagName: "span",
|
||||
properties: { style: "user-select: none;" },
|
||||
children: [{ type: "text", value: start }]
|
||||
});
|
||||
}
|
||||
}
|
||||
code = code.replace(/(?:\r\n|\r|\n)$/, "");
|
||||
const themeOptions = Object.values(themes).length ? { themes } : { theme };
|
||||
const inline = options?.inline ?? false;
|
||||
return highlighter[to === "html" ? "codeToHtml" : "codeToHast"](code, {
|
||||
...themeOptions,
|
||||
defaultColor: options.defaultColor,
|
||||
lang,
|
||||
// NOTE: while we can spread `options.attributes` here so that Shiki can auto-serialize this as rendered
|
||||
// attributes on the top-level tag, it's not clear whether it is fine to pass all attributes as meta, as
|
||||
// they're technically not meta, nor parsed from Shiki's `parseMetaString` API.
|
||||
meta: options?.meta ? { __raw: options?.meta } : void 0,
|
||||
transformers: [
|
||||
{
|
||||
pre(node) {
|
||||
if (inline) {
|
||||
node.tagName = "code";
|
||||
}
|
||||
const {
|
||||
class: attributesClass,
|
||||
style: attributesStyle,
|
||||
...rest
|
||||
} = options?.attributes ?? {};
|
||||
Object.assign(node.properties, rest);
|
||||
const classValue = (normalizePropAsString(node.properties.class) ?? "") + (attributesClass ? ` ${attributesClass}` : "");
|
||||
const styleValue = (normalizePropAsString(node.properties.style) ?? "") + (attributesStyle ? `; ${attributesStyle}` : "");
|
||||
node.properties.class = classValue.replace(/shiki/g, "astro-code");
|
||||
node.properties.dataLanguage = lang;
|
||||
if (options.wrap === false || options.wrap === void 0) {
|
||||
node.properties.style = styleValue + "; overflow-x: auto;";
|
||||
} else if (options.wrap === true) {
|
||||
node.properties.style = styleValue + "; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;";
|
||||
}
|
||||
},
|
||||
line(node) {
|
||||
if (resolvedLang === "diff") {
|
||||
const innerSpanNode = node.children[0];
|
||||
const innerSpanTextNode = innerSpanNode?.type === "element" && innerSpanNode.children?.[0];
|
||||
if (innerSpanTextNode && innerSpanTextNode.type === "text") {
|
||||
const start = innerSpanTextNode.value[0];
|
||||
if (start === "+" || start === "-") {
|
||||
innerSpanTextNode.value = innerSpanTextNode.value.slice(1);
|
||||
innerSpanNode.children.unshift({
|
||||
type: "element",
|
||||
tagName: "span",
|
||||
properties: { style: "user-select: none;" },
|
||||
children: [{ type: "text", value: start }]
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
code(node) {
|
||||
if (inline) {
|
||||
return node.children[0];
|
||||
}
|
||||
},
|
||||
root(node) {
|
||||
if (Object.values(themes).length) {
|
||||
return;
|
||||
}
|
||||
const themeName = typeof theme === "string" ? theme : theme.name;
|
||||
if (themeName === "css-variables") {
|
||||
visit(node, "element", (child) => {
|
||||
if (child.properties?.style) {
|
||||
child.properties.style = replaceCssVariables(child.properties.style);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
...transformers
|
||||
]
|
||||
});
|
||||
code(node) {
|
||||
if (inline) {
|
||||
return node.children[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
...options.transformers ?? []
|
||||
]
|
||||
});
|
||||
}
|
||||
return {
|
||||
codeToHast(code, lang, options = {}) {
|
||||
return highlight(code, lang, options, "hast");
|
||||
},
|
||||
codeToHtml(code, lang, options = {}) {
|
||||
return highlight(code, lang, options, "html");
|
||||
}
|
||||
};
|
||||
}
|
||||
function normalizePropAsString(value) {
|
||||
return Array.isArray(value) ? value.join(" ") : value;
|
||||
}
|
||||
function replaceCssVariables(str) {
|
||||
return str.replace(COLOR_REPLACEMENT_REGEX, (match) => ASTRO_COLOR_REPLACEMENTS[match] || match);
|
||||
}
|
||||
export {
|
||||
createShikiHighlighter
|
||||
};
|
||||
|
56
node_modules/@astrojs/markdown-remark/dist/types.d.ts
generated
vendored
56
node_modules/@astrojs/markdown-remark/dist/types.d.ts
generated
vendored
@@ -1,30 +1,39 @@
|
||||
import type { RemotePattern } from '@astrojs/internal-helpers/remote';
|
||||
import type * as hast from 'hast';
|
||||
import type * as mdast from 'mdast';
|
||||
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
|
||||
import type { BuiltinTheme, HighlighterCoreOptions, LanguageRegistration, ShikiTransformer, ThemeRegistration, ThemeRegistrationRaw } from 'shiki';
|
||||
import type { BuiltinTheme } from 'shiki';
|
||||
import type * as unified from 'unified';
|
||||
import type { DataMap, VFile } from 'vfile';
|
||||
import type { CreateShikiHighlighterOptions, ShikiHighlighterHighlightOptions } from './shiki.js';
|
||||
export type { Node } from 'unist';
|
||||
export type MarkdownAstroData = {
|
||||
frontmatter: Record<string, any>;
|
||||
};
|
||||
declare module 'vfile' {
|
||||
interface DataMap {
|
||||
astro: {
|
||||
headings?: MarkdownHeading[];
|
||||
localImagePaths?: string[];
|
||||
remoteImagePaths?: string[];
|
||||
frontmatter?: Record<string, any>;
|
||||
};
|
||||
}
|
||||
}
|
||||
export type RemarkPlugin<PluginParameters extends any[] = any[]> = unified.Plugin<PluginParameters, mdast.Root>;
|
||||
export type RemarkPlugins = (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];
|
||||
export type RehypePlugin<PluginParameters extends any[] = any[]> = unified.Plugin<PluginParameters, hast.Root>;
|
||||
export type RehypePlugins = (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];
|
||||
export type RemarkRehype = RemarkRehypeOptions;
|
||||
export type ThemePresets = BuiltinTheme | 'css-variables';
|
||||
export interface ShikiConfig {
|
||||
langs?: LanguageRegistration[];
|
||||
langAlias?: HighlighterCoreOptions['langAlias'];
|
||||
theme?: ThemePresets | ThemeRegistration | ThemeRegistrationRaw;
|
||||
themes?: Record<string, ThemePresets | ThemeRegistration | ThemeRegistrationRaw>;
|
||||
defaultColor?: 'light' | 'dark' | string | false;
|
||||
wrap?: boolean | null;
|
||||
transformers?: ShikiTransformer[];
|
||||
export type SyntaxHighlightConfigType = 'shiki' | 'prism';
|
||||
export interface SyntaxHighlightConfig {
|
||||
type: SyntaxHighlightConfigType;
|
||||
excludeLangs?: string[];
|
||||
}
|
||||
export interface ShikiConfig extends Pick<CreateShikiHighlighterOptions, 'langs' | 'theme' | 'themes' | 'langAlias'>, Pick<ShikiHighlighterHighlightOptions, 'defaultColor' | 'wrap' | 'transformers'> {
|
||||
}
|
||||
/**
|
||||
* Configuration options that end up in the markdown section of AstroConfig
|
||||
*/
|
||||
export interface AstroMarkdownOptions {
|
||||
syntaxHighlight?: 'shiki' | 'prism' | false;
|
||||
syntaxHighlight?: SyntaxHighlightConfig | SyntaxHighlightConfigType | false;
|
||||
shikiConfig?: ShikiConfig;
|
||||
remarkPlugins?: RemarkPlugins;
|
||||
rehypePlugins?: RehypePlugins;
|
||||
@@ -32,6 +41,16 @@ export interface AstroMarkdownOptions {
|
||||
gfm?: boolean;
|
||||
smartypants?: boolean;
|
||||
}
|
||||
/**
|
||||
* Extra configuration options from other parts of AstroConfig that get injected into this plugin
|
||||
*/
|
||||
export interface AstroMarkdownProcessorOptions extends AstroMarkdownOptions {
|
||||
image?: {
|
||||
domains?: string[];
|
||||
remotePatterns?: RemotePattern[];
|
||||
};
|
||||
experimentalHeadingIdCompat?: boolean;
|
||||
}
|
||||
export interface MarkdownProcessor {
|
||||
render: (content: string, opts?: MarkdownProcessorRenderOptions) => Promise<MarkdownProcessorRenderResult>;
|
||||
}
|
||||
@@ -43,7 +62,8 @@ export interface MarkdownProcessorRenderResult {
|
||||
code: string;
|
||||
metadata: {
|
||||
headings: MarkdownHeading[];
|
||||
imagePaths: Set<string>;
|
||||
localImagePaths: string[];
|
||||
remoteImagePaths: string[];
|
||||
frontmatter: Record<string, any>;
|
||||
};
|
||||
}
|
||||
@@ -52,9 +72,3 @@ export interface MarkdownHeading {
|
||||
slug: string;
|
||||
text: string;
|
||||
}
|
||||
export interface MarkdownVFile extends VFile {
|
||||
data: Record<string, unknown> & Partial<DataMap> & {
|
||||
__astroHeadings?: MarkdownHeading[];
|
||||
imagePaths?: Set<string>;
|
||||
};
|
||||
}
|
||||
|
23
node_modules/@astrojs/markdown-remark/package.json
generated
vendored
23
node_modules/@astrojs/markdown-remark/package.json
generated
vendored
@@ -1,20 +1,19 @@
|
||||
{
|
||||
"name": "@astrojs/markdown-remark",
|
||||
"version": "5.3.0",
|
||||
"version": "6.3.3",
|
||||
"type": "module",
|
||||
"author": "withastro",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/withastro/astro.git",
|
||||
"url": "git+https://github.com/withastro/astro.git",
|
||||
"directory": "packages/markdown/remark"
|
||||
},
|
||||
"bugs": "https://github.com/withastro/astro/issues",
|
||||
"homepage": "https://astro.build",
|
||||
"main": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./dist/internal.js": "./dist/internal.js"
|
||||
".": "./dist/index.js"
|
||||
},
|
||||
"imports": {
|
||||
"#import-plugin": {
|
||||
@@ -30,27 +29,31 @@
|
||||
"hast-util-from-html": "^2.0.3",
|
||||
"hast-util-to-text": "^4.0.2",
|
||||
"import-meta-resolve": "^4.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"mdast-util-definitions": "^6.0.0",
|
||||
"rehype-raw": "^7.0.0",
|
||||
"rehype-stringify": "^10.0.1",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.1.1",
|
||||
"remark-rehype": "^11.1.2",
|
||||
"remark-smartypants": "^3.0.2",
|
||||
"shiki": "^1.22.0",
|
||||
"shiki": "^3.2.1",
|
||||
"smol-toml": "^1.3.4",
|
||||
"unified": "^11.0.5",
|
||||
"unist-util-remove-position": "^5.0.0",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"unist-util-visit-parents": "^6.0.1",
|
||||
"vfile": "^6.0.3",
|
||||
"@astrojs/prism": "3.1.0"
|
||||
"@astrojs/internal-helpers": "0.6.1",
|
||||
"@astrojs/prism": "3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/estree": "^1.0.7",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/mdast": "^4.0.4",
|
||||
"@types/unist": "^3.0.3",
|
||||
"esbuild": "^0.21.5",
|
||||
"esbuild": "^0.24.2",
|
||||
"mdast-util-mdx-expression": "^2.0.1",
|
||||
"astro-scripts": "0.0.14"
|
||||
},
|
||||
|
2
node_modules/@astrojs/prism/README.md
generated
vendored
2
node_modules/@astrojs/prism/README.md
generated
vendored
@@ -29,6 +29,6 @@ runHighlighterWithAstro(
|
||||
|
||||
<div>{helloAstro}</div>
|
||||
`,
|
||||
'astro'
|
||||
'astro',
|
||||
);
|
||||
```
|
||||
|
10
node_modules/@astrojs/prism/package.json
generated
vendored
10
node_modules/@astrojs/prism/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@astrojs/prism",
|
||||
"version": "3.1.0",
|
||||
"version": "3.3.0",
|
||||
"description": "Add Prism syntax highlighting support to your Astro site",
|
||||
"author": "withastro",
|
||||
"type": "module",
|
||||
@@ -8,7 +8,7 @@
|
||||
"bugs": "https://github.com/withastro/astro/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/withastro/astro.git",
|
||||
"url": "git+https://github.com/withastro/astro.git",
|
||||
"directory": "packages/astro-prism"
|
||||
},
|
||||
"homepage": "https://docs.astro.build/en/reference/api-reference/#prism-",
|
||||
@@ -27,14 +27,14 @@
|
||||
"astro-component"
|
||||
],
|
||||
"dependencies": {
|
||||
"prismjs": "^1.29.0"
|
||||
"prismjs": "^1.30.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/prismjs": "1.26.3",
|
||||
"@types/prismjs": "1.26.5",
|
||||
"astro-scripts": "0.0.14"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"
|
||||
"node": "18.20.8 || ^20.3.0 || >=22.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p ./tsconfig.json",
|
||||
|
12
node_modules/@astrojs/tailwind/README.md
generated
vendored
12
node_modules/@astrojs/tailwind/README.md
generated
vendored
@@ -1,10 +1,10 @@
|
||||
# @astrojs/tailwind 💨
|
||||
|
||||
This **[Astro integration][astro-integration]** brings [Tailwind's](https://tailwindcss.com/) utility CSS classes to every `.astro` file and [framework component](https://docs.astro.build/en/core-concepts/framework-components/) in your project, along with support for the Tailwind configuration file.
|
||||
|
||||
## Documentation
|
||||
|
||||
Read the [`@astrojs/tailwind` docs][docs]
|
||||
> ⚠️ **This integration is deprecated**
|
||||
>
|
||||
> [Tailwind CSS now offers a Vite plugin](https://tailwindcss.com/docs/installation/framework-guides/astro) which is the preferred way to use Tailwind 4 in Astro.
|
||||
>
|
||||
> Learn how to use Tailwind in your project in the Astro [“Styles and CSS”][docs] guide.
|
||||
|
||||
## Support
|
||||
|
||||
@@ -29,7 +29,7 @@ MIT
|
||||
Copyright (c) 2023–present [Astro][astro]
|
||||
|
||||
[astro]: https://astro.build/
|
||||
[docs]: https://docs.astro.build/en/guides/integrations-guide/tailwind/
|
||||
[docs]: https://docs.astro.build/en/guides/styling/#tailwind
|
||||
[contributing]: https://github.com/withastro/astro/blob/main/CONTRIBUTING.md
|
||||
[coc]: https://github.com/withastro/.github/blob/main/CODE_OF_CONDUCT.md
|
||||
[community]: https://github.com/withastro/.github/blob/main/COMMUNITY_GUIDE.md
|
||||
|
12
node_modules/@astrojs/tailwind/package.json
generated
vendored
12
node_modules/@astrojs/tailwind/package.json
generated
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@astrojs/tailwind",
|
||||
"description": "Use Tailwind CSS to style your Astro site",
|
||||
"version": "5.1.5",
|
||||
"version": "6.0.2",
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"author": "withastro",
|
||||
@@ -29,15 +29,15 @@
|
||||
"base.css"
|
||||
],
|
||||
"dependencies": {
|
||||
"autoprefixer": "^10.4.20",
|
||||
"postcss": "^8.5.1",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"postcss": "^8.5.3",
|
||||
"postcss-load-config": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tailwindcss": "^3.4.17",
|
||||
"vite": "^6.0.9",
|
||||
"astro": "5.1.8",
|
||||
"astro-scripts": "0.0.14"
|
||||
"vite": "^6.2.3",
|
||||
"astro-scripts": "0.0.14",
|
||||
"astro": "5.5.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"astro": "^3.0.0 || ^4.0.0 || ^5.0.0",
|
||||
|
3
node_modules/@astrojs/telemetry/dist/config.d.ts
generated
vendored
3
node_modules/@astrojs/telemetry/dist/config.d.ts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
export interface ConfigOptions {
|
||||
interface ConfigOptions {
|
||||
name: string;
|
||||
}
|
||||
export declare class GlobalConfig {
|
||||
@@ -17,3 +17,4 @@ export declare class GlobalConfig {
|
||||
has(key: string): boolean;
|
||||
set(key: string, value: any): void;
|
||||
}
|
||||
export {};
|
||||
|
3
node_modules/@astrojs/telemetry/dist/config.js
generated
vendored
3
node_modules/@astrojs/telemetry/dist/config.js
generated
vendored
@@ -34,8 +34,7 @@ class GlobalConfig {
|
||||
file;
|
||||
_store;
|
||||
get store() {
|
||||
if (this._store)
|
||||
return this._store;
|
||||
if (this._store) return this._store;
|
||||
this.ensureDir();
|
||||
if (fs.existsSync(this.file)) {
|
||||
try {
|
||||
|
3
node_modules/@astrojs/telemetry/dist/index.js
generated
vendored
3
node_modules/@astrojs/telemetry/dist/index.js
generated
vendored
@@ -73,8 +73,7 @@ class AstroTelemetry {
|
||||
return this.config.clear();
|
||||
}
|
||||
isValidNotice() {
|
||||
if (!this.notifyDate)
|
||||
return false;
|
||||
if (!this.notifyDate) return false;
|
||||
const current = Number(this.notifyDate);
|
||||
const valid = new Date(VALID_TELEMETRY_NOTICE_DATE).valueOf();
|
||||
return current > valid;
|
||||
|
1
node_modules/@astrojs/telemetry/dist/system-info.d.ts
generated
vendored
1
node_modules/@astrojs/telemetry/dist/system-info.d.ts
generated
vendored
@@ -1,4 +1,3 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/**
|
||||
* Astro Telemetry -- System Info
|
||||
*
|
||||
|
2
node_modules/@astrojs/telemetry/dist/system-info.js
generated
vendored
2
node_modules/@astrojs/telemetry/dist/system-info.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
import os from "node:os";
|
||||
import { isCI, name as ciName } from "ci-info";
|
||||
import { name as ciName, isCI } from "ci-info";
|
||||
import isDocker from "is-docker";
|
||||
import isWSL from "is-wsl";
|
||||
let meta;
|
||||
|
16
node_modules/@astrojs/telemetry/package.json
generated
vendored
16
node_modules/@astrojs/telemetry/package.json
generated
vendored
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@astrojs/telemetry",
|
||||
"version": "3.1.0",
|
||||
"version": "3.3.0",
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"author": "withastro",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/withastro/astro.git",
|
||||
"url": "git+https://github.com/withastro/astro.git",
|
||||
"directory": "packages/telemetry"
|
||||
},
|
||||
"bugs": "https://github.com/withastro/astro/issues",
|
||||
@@ -23,23 +23,23 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"ci-info": "^4.0.0",
|
||||
"debug": "^4.3.4",
|
||||
"ci-info": "^4.2.0",
|
||||
"debug": "^4.4.0",
|
||||
"dlv": "^1.1.3",
|
||||
"dset": "^3.1.3",
|
||||
"dset": "^3.1.4",
|
||||
"is-docker": "^3.0.0",
|
||||
"is-wsl": "^3.0.0",
|
||||
"is-wsl": "^3.1.0",
|
||||
"which-pm-runs": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/debug": "^4.1.12",
|
||||
"@types/dlv": "^1.1.4",
|
||||
"@types/dlv": "^1.1.5",
|
||||
"@types/node": "^18.17.8",
|
||||
"@types/which-pm-runs": "^1.0.2",
|
||||
"astro-scripts": "0.0.14"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"
|
||||
"node": "18.20.8 || ^20.3.0 || >=22.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"provenance": true
|
||||
|
Reference in New Issue
Block a user