Compare commits

...

6 commits

Author SHA1 Message Date
Emanuele Stoppa
a09ee5a95c chore: ignore commit 2023-09-16 10:07:03 +01:00
Emanuele Stoppa
6a3ce6c738 chore: revert JSON changes with new options 2023-09-16 09:21:40 +01:00
Emanuele Stoppa
3fd60556ac chore: fix regressions 2023-09-16 09:12:59 +01:00
Emanuele Stoppa
966bc2ca0e chore: fix build 2023-09-16 09:12:51 +01:00
Emanuele Stoppa
a58cc96091 chore: rebase 2023-09-16 09:12:48 +01:00
Emanuele Stoppa
07613b96bb chore: use biome to format JSON and JavaScript files 2023-09-16 09:12:23 +01:00
320 changed files with 1398 additions and 989 deletions

View file

@ -4,3 +4,5 @@
1335797903a57716e9a02b0ffd8ca636b3883c62 1335797903a57716e9a02b0ffd8ca636b3883c62
# Manually format .astro files in example projects (#3862) # Manually format .astro files in example projects (#3862)
59e8c71786fd1c154904b3fefa7d26d88f4d92d2 59e8c71786fd1c154904b3fefa7d26d88f4d92d2
# New formatting using Biome
07613b96bbe7a74179895c8cbe5f364133edd9ee

View file

@ -1,5 +1,5 @@
import { build } from 'esbuild';
import { existsSync } from 'node:fs'; import { existsSync } from 'node:fs';
import { build } from 'esbuild';
const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/'; const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/';
@ -24,7 +24,7 @@ export default async function checkBundleSize({ github, context }) {
pull_number: PR_NUM, pull_number: PR_NUM,
}); });
const clientRuntimeFiles = files.filter((file) => { const clientRuntimeFiles = files.filter((file) => {
return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed' return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed';
}); });
if (clientRuntimeFiles.length === 0) return; if (clientRuntimeFiles.length === 0) return;
@ -35,17 +35,26 @@ export default async function checkBundleSize({ github, context }) {
const output = await bundle(clientRuntimeFiles); const output = await bundle(clientRuntimeFiles);
for (let [filename, { oldSize, newSize, sourceFile }] of Object.entries(output)) { for (let [filename, { oldSize, newSize, sourceFile }] of Object.entries(output)) {
filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) ? `client:${filename}` : filename; filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename)
const prefix = (newSize - oldSize) === 0 ? '' : (newSize - oldSize) > 0 ? '+ ' : '- '; ? `client:${filename}`
: filename;
const prefix = newSize - oldSize === 0 ? '' : newSize - oldSize > 0 ? '+ ' : '- ';
const change = `${prefix}${formatBytes(newSize - oldSize)}`; const change = `${prefix}${formatBytes(newSize - oldSize)}`;
table.push(`| [\`${filename}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${context.payload.pull_request.head.ref}/${sourceFile}) | ${formatBytes(oldSize)} | ${formatBytes(newSize)} | ${change} |`); table.push(
`| [\`${filename}\`](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${
context.payload.pull_request.head.ref
}/${sourceFile}) | ${formatBytes(oldSize)} | ${formatBytes(newSize)} | ${change} |`
);
} }
const { data: comments } = await github.rest.issues.listComments({ const { data: comments } = await github.rest.issues.listComments({
...context.repo, ...context.repo,
issue_number: PR_NUM issue_number: PR_NUM,
}) });
const comment = comments.find(comment => comment.user.login === 'github-actions[bot]' && comment.body.includes('Bundle Size Check')); const comment = comments.find(
(comment) =>
comment.user.login === 'github-actions[bot]' && comment.body.includes('Bundle Size Check')
);
const method = comment ? 'updateComment' : 'createComment'; const method = comment ? 'updateComment' : 'createComment';
const payload = comment ? { comment_id: comment.id } : { issue_number: PR_NUM }; const payload = comment ? { comment_id: comment.id } : { issue_number: PR_NUM };
await github.rest.issues[method]({ await github.rest.issues[method]({
@ -60,26 +69,35 @@ ${table.join('\n')}`,
} }
async function bundle(files) { async function bundle(files) {
const { metafile } = await build({ const { metafile } = await build({
entryPoints: [...files.map(({ filename }) => filename), ...files.map(({ filename }) => `main/${filename}`).filter(f => existsSync(f))], entryPoints: [
...files.map(({ filename }) => filename),
...files.map(({ filename }) => `main/${filename}`).filter((f) => existsSync(f)),
],
bundle: true, bundle: true,
minify: true, minify: true,
sourcemap: false, sourcemap: false,
target: ['es2018'], target: ['es2018'],
outdir: 'out', outdir: 'out',
metafile: true, metafile: true,
}) });
return Object.entries(metafile.outputs).reduce((acc, [filename, info]) => { return Object.entries(metafile.outputs).reduce((acc, [filename, info]) => {
filename = filename.slice('out/'.length); filename = filename.slice('out/'.length);
if (filename.startsWith('main/')) { if (filename.startsWith('main/')) {
filename = filename.slice('main/'.length).replace(CLIENT_RUNTIME_PATH, '').replace('.js', ''); filename = filename.slice('main/'.length).replace(CLIENT_RUNTIME_PATH, '').replace('.js', '');
const oldSize = info.bytes; const oldSize = info.bytes;
return Object.assign(acc, { [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { oldSize }) }); return Object.assign(acc, {
[filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { oldSize }),
});
} }
filename = filename.replace(CLIENT_RUNTIME_PATH, '').replace('.js', ''); filename = filename.replace(CLIENT_RUNTIME_PATH, '').replace('.js', '');
const newSize = info.bytes; const newSize = info.bytes;
return Object.assign(acc, { [filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, { newSize, sourceFile: Object.keys(info.inputs).find(src => src.endsWith('.ts')) }) }); return Object.assign(acc, {
[filename]: Object.assign(acc[filename] ?? { oldSize: 0, newSize: 0 }, {
newSize,
sourceFile: Object.keys(info.inputs).find((src) => src.endsWith('.ts')),
}),
});
}, {}); }, {});
} }

View file

@ -16,3 +16,9 @@ benchmark/results/
# Files # Files
pnpm-lock.yaml pnpm-lock.yaml
*.js
*.ts
*.mjs
*.cjs
*.json
*.jsonc

View file

@ -1,7 +1,7 @@
import { execaCommand } from 'execa';
import { markdownTable } from 'markdown-table';
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { execaCommand } from 'execa';
import { markdownTable } from 'markdown-table';
import { astroBin } from './_util.js'; import { astroBin } from './_util.js';
/** @typedef {Record<string, import('../../packages/astro/src/core/config/timer').Stat>} AstroTimerStat */ /** @typedef {Record<string, import('../../packages/astro/src/core/config/timer').Stat>} AstroTimerStat */

View file

@ -1,12 +1,12 @@
import { execaCommand } from 'execa';
import { markdownTable } from 'markdown-table';
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import http from 'node:http'; import http from 'node:http';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { execaCommand } from 'execa';
import { markdownTable } from 'markdown-table';
import { waitUntilBusy } from 'port-authority'; import { waitUntilBusy } from 'port-authority';
import { calculateStat, astroBin } from './_util.js';
import { renderFiles } from '../make-project/render-default.js'; import { renderFiles } from '../make-project/render-default.js';
import { astroBin, calculateStat } from './_util.js';
const port = 4322; const port = 4322;

View file

@ -1,8 +1,8 @@
import fs from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import autocannon from 'autocannon'; import autocannon from 'autocannon';
import { execaCommand } from 'execa'; import { execaCommand } from 'execa';
import { markdownTable } from 'markdown-table'; import { markdownTable } from 'markdown-table';
import fs from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { waitUntilBusy } from 'port-authority'; import { waitUntilBusy } from 'port-authority';
import pb from 'pretty-bytes'; import pb from 'pretty-bytes';
import { astroBin } from './_util.js'; import { astroBin } from './_util.js';

View file

@ -1,7 +1,7 @@
import mri from 'mri';
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import path from 'node:path'; import path from 'node:path';
import { pathToFileURL } from 'node:url'; import { pathToFileURL } from 'node:url';
import mri from 'mri';
const args = mri(process.argv.slice(2)); const args = mri(process.argv.slice(2));

View file

@ -1,5 +1,5 @@
import type { CreatePreviewServer } from 'astro';
import { createServer } from 'node:http'; import { createServer } from 'node:http';
import type { CreatePreviewServer } from 'astro';
import enableDestroy from 'server-destroy'; import enableDestroy from 'server-destroy';
const preview: CreatePreviewServer = async function ({ serverEntrypoint, host, port }) { const preview: CreatePreviewServer = async function ({ serverEntrypoint, host, port }) {

View file

@ -1,6 +1,6 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { SSRManifest } from 'astro'; import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node'; import { NodeApp, applyPolyfills } from 'astro/app/node';
import type { IncomingMessage, ServerResponse } from 'node:http';
applyPolyfills(); applyPolyfills();

41
biome.json Normal file
View file

@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/1.2.1/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignoreUnknown": true,
"ignore": [
"examples/basics/src/layouts/**",
"examples/with-nanostores/src/layouts/**",
"benchmark/projects/**",
"benchmark/results/**",
"**/dist",
"**/smoke",
"**/node_modules",
"**/fixtures",
"**/vendor",
"**/.vercel"
]
},
"linter": {
"enabled": false
},
"formatter": {
"lineWidth": 100
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingComma": "es5"
}
},
"json": {
"parser": {
"allowComments": true
},
"formatter": {
"indentStyle": "space"
}
}
}

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx'; import mdx from '@astrojs/mdx';
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap'; import sitemap from '@astrojs/sitemap';

View file

@ -1,6 +1,6 @@
import rss from '@astrojs/rss'; import rss from '@astrojs/rss';
import { SITE_DESCRIPTION, SITE_TITLE } from '../consts';
import { getCollection } from 'astro:content'; import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
export async function GET(context) { export async function GET(context) {
const posts = await getCollection('blog'); const posts = await getCollection('blog');

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import alpine from '@astrojs/alpinejs'; import alpine from '@astrojs/alpinejs';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import lit from '@astrojs/lit'; import lit from '@astrojs/lit';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,9 +1,9 @@
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact'; import preact from '@astrojs/preact';
import react from '@astrojs/react'; import react from '@astrojs/react';
import solid from '@astrojs/solid-js';
import svelte from '@astrojs/svelte'; import svelte from '@astrojs/svelte';
import vue from '@astrojs/vue'; import vue from '@astrojs/vue';
import solid from '@astrojs/solid-js'; import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact'; import preact from '@astrojs/preact';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,4 +1,4 @@
import { h, Fragment } from 'preact'; import { Fragment, h } from 'preact';
import './Counter.css'; import './Counter.css';
export default function Counter({ children, count }) { export default function Counter({ children, count }) {

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import react from '@astrojs/react'; import react from '@astrojs/react';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import solid from '@astrojs/solid-js'; import solid from '@astrojs/solid-js';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import svelte from '@astrojs/svelte'; import svelte from '@astrojs/svelte';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import vue from '@astrojs/vue'; import vue from '@astrojs/vue';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import node from '@astrojs/node'; import node from '@astrojs/node';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import node from '@astrojs/node'; import node from '@astrojs/node';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineMiddleware, sequence } from 'astro:middleware';
import htmlMinifier from 'html-minifier'; import htmlMinifier from 'html-minifier';
import { defineMiddleware, sequence } from 'astro:middleware';
const limit = 50; const limit = 50;

View file

@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import svelte from '@astrojs/svelte';
import node from '@astrojs/node'; import node from '@astrojs/node';
import svelte from '@astrojs/svelte';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { productMap } from '../../../models/db';
import type { APIContext } from 'astro'; import type { APIContext } from 'astro';
import { productMap } from '../../../models/db';
export function GET({ params }: APIContext) { export function GET({ params }: APIContext) {
const id = Number(params.id); const id = Number(params.id);

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import markdoc from '@astrojs/markdoc'; import markdoc from '@astrojs/markdoc';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,4 +1,4 @@
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config'; import { component, defineMarkdocConfig } from '@astrojs/markdoc/config';
export default defineMarkdocConfig({ export default defineMarkdocConfig({
tags: { tags: {

View file

@ -10,9 +10,7 @@ const adder = ([selector, className]) => {
return (node) => selectAll(selector, node).forEach(writer); return (node) => selectAll(selector, node).forEach(writer);
}; };
const write = const write = (className) => ({ properties }) => {
(className) =>
({ properties }) => {
if (!properties.className) properties.className = className; if (!properties.className) properties.className = className;
else properties.className += ` ${className}`; else properties.className += ` ${className}`;
}; };

View file

@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx'; import mdx from '@astrojs/mdx';
import preact from '@astrojs/preact'; import preact from '@astrojs/preact';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact'; import preact from '@astrojs/preact';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -1,6 +1,6 @@
import { isCartOpen, addCartItem } from '../cartStore';
import type { CartItemDisplayInfo } from '../cartStore';
import type { ComponentChildren } from 'preact'; import type { ComponentChildren } from 'preact';
import { addCartItem, isCartOpen } from '../cartStore';
import type { CartItemDisplayInfo } from '../cartStore';
type Props = { type Props = {
item: CartItemDisplayInfo; item: CartItemDisplayInfo;

View file

@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind'; import tailwind from '@astrojs/tailwind';
import { defineConfig } from 'astro/config';
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({

View file

@ -15,8 +15,7 @@
"dev": "turbo run dev --concurrency=40 --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"", "dev": "turbo run dev --concurrency=40 --parallel --filter=astro --filter=create-astro --filter=\"@astrojs/*\" --filter=\"@benchmark/*\"",
"format": "pnpm run format:code", "format": "pnpm run format:code",
"format:ci": "pnpm run format:imports && pnpm run format:code", "format:ci": "pnpm run format:imports && pnpm run format:code",
"format:code": "prettier -w \"**/*\" --ignore-unknown --cache", "format:code": "biome check --apply-unsafe ./ && prettier -w \"**/*\" --ignore-unknown --cache",
"format:imports": "organize-imports-cli ./packages/*/tsconfig.json ./packages/*/*/tsconfig.json",
"test": "turbo run test --concurrency=1 --filter=astro --filter=create-astro --filter=\"@astrojs/*\"", "test": "turbo run test --concurrency=1 --filter=astro --filter=create-astro --filter=\"@astrojs/*\"",
"test:match": "cd packages/astro && pnpm run test:match", "test:match": "cd packages/astro && pnpm run test:match",
"test:unit": "cd packages/astro && pnpm run test:unit", "test:unit": "cd packages/astro && pnpm run test:unit",
@ -78,6 +77,7 @@
}, },
"devDependencies": { "devDependencies": {
"@astrojs/check": "^0.1.0", "@astrojs/check": "^0.1.0",
"@biomejs/biome": "1.2.1",
"@changesets/changelog-github": "^0.4.8", "@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2", "@changesets/cli": "^2.26.2",
"@types/node": "^18.17.8", "@types/node": "^18.17.8",
@ -89,7 +89,6 @@
"eslint-plugin-no-only-tests": "^3.1.0", "eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.0.0",
"only-allow": "^1.1.1", "only-allow": "^1.1.1",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.0", "prettier-plugin-astro": "^0.12.0",
"tiny-glob": "^0.2.9", "tiny-glob": "^0.2.9",

View file

@ -1,7 +1,7 @@
import chai from 'chai'; import chai from 'chai';
import chaiPromises from 'chai-as-promised'; import chaiPromises from 'chai-as-promised';
import { phpFeedItem, web1FeedItem } from './test-utils.js';
import { pagesGlobToRssItems } from '../dist/index.js'; import { pagesGlobToRssItems } from '../dist/index.js';
import { phpFeedItem, web1FeedItem } from './test-utils.js';
chai.use(chaiPromises); chai.use(chaiPromises);

View file

@ -1,18 +1,18 @@
import rss, { getRssString } from '../dist/index.js';
import { rssSchema } from '../dist/schema.js';
import chai from 'chai'; import chai from 'chai';
import chaiPromises from 'chai-as-promised'; import chaiPromises from 'chai-as-promised';
import chaiXml from 'chai-xml'; import chaiXml from 'chai-xml';
import rss, { getRssString } from '../dist/index.js';
import { rssSchema } from '../dist/schema.js';
import { import {
title,
description, description,
site,
phpFeedItem, phpFeedItem,
phpFeedItemWithContent, phpFeedItemWithContent,
phpFeedItemWithCustomData, phpFeedItemWithCustomData,
site,
title,
web1FeedItem, web1FeedItem,
web1FeedItemWithContent,
web1FeedItemWithAllData, web1FeedItemWithAllData,
web1FeedItemWithContent,
} from './test-utils.js'; } from './test-utils.js';
chai.use(chaiPromises); chai.use(chaiPromises);
@ -21,15 +21,93 @@ chai.use(chaiXml);
// note: I spent 30 minutes looking for a nice node-based snapshot tool // note: I spent 30 minutes looking for a nice node-based snapshot tool
// ...and I gave up. Enjoy big strings! // ...and I gave up. Enjoy big strings!
// prettier-ignore // prettier-ignore
const validXmlResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${phpFeedItem.title}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${phpFeedItem.link}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(phpFeedItem.pubDate).toUTCString()}</pubDate></item><item><title><![CDATA[${web1FeedItem.title}]]></title><link>${site}${web1FeedItem.link}/</link><guid isPermaLink="true">${site}${web1FeedItem.link}/</guid><description><![CDATA[${web1FeedItem.description}]]></description><pubDate>${new Date(web1FeedItem.pubDate).toUTCString()}</pubDate></item></channel></rss>`; const validXmlResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${
phpFeedItem.title
}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${
phpFeedItem.link
}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(
phpFeedItem.pubDate
).toUTCString()}</pubDate></item><item><title><![CDATA[${
web1FeedItem.title
}]]></title><link>${site}${web1FeedItem.link}/</link><guid isPermaLink="true">${site}${
web1FeedItem.link
}/</guid><description><![CDATA[${web1FeedItem.description}]]></description><pubDate>${new Date(
web1FeedItem.pubDate
).toUTCString()}</pubDate></item></channel></rss>`;
// prettier-ignore // prettier-ignore
const validXmlWithoutWeb1FeedResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${phpFeedItem.title}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${phpFeedItem.link}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(phpFeedItem.pubDate).toUTCString()}</pubDate></item></channel></rss>`; const validXmlWithoutWeb1FeedResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${
phpFeedItem.title
}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${
phpFeedItem.link
}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(
phpFeedItem.pubDate
).toUTCString()}</pubDate></item></channel></rss>`;
// prettier-ignore // prettier-ignore
const validXmlWithContentResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${phpFeedItemWithContent.title}]]></title><link>${site}${phpFeedItemWithContent.link}/</link><guid isPermaLink="true">${site}${phpFeedItemWithContent.link}/</guid><description><![CDATA[${phpFeedItemWithContent.description}]]></description><pubDate>${new Date(phpFeedItemWithContent.pubDate).toUTCString()}</pubDate><content:encoded><![CDATA[${phpFeedItemWithContent.content}]]></content:encoded></item><item><title><![CDATA[${web1FeedItemWithContent.title}]]></title><link>${site}${web1FeedItemWithContent.link}/</link><guid isPermaLink="true">${site}${web1FeedItemWithContent.link}/</guid><description><![CDATA[${web1FeedItemWithContent.description}]]></description><pubDate>${new Date(web1FeedItemWithContent.pubDate).toUTCString()}</pubDate><content:encoded><![CDATA[${web1FeedItemWithContent.content}]]></content:encoded></item></channel></rss>`; const validXmlWithContentResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${
phpFeedItemWithContent.title
}]]></title><link>${site}${phpFeedItemWithContent.link}/</link><guid isPermaLink="true">${site}${
phpFeedItemWithContent.link
}/</guid><description><![CDATA[${
phpFeedItemWithContent.description
}]]></description><pubDate>${new Date(
phpFeedItemWithContent.pubDate
).toUTCString()}</pubDate><content:encoded><![CDATA[${
phpFeedItemWithContent.content
}]]></content:encoded></item><item><title><![CDATA[${
web1FeedItemWithContent.title
}]]></title><link>${site}${web1FeedItemWithContent.link}/</link><guid isPermaLink="true">${site}${
web1FeedItemWithContent.link
}/</guid><description><![CDATA[${
web1FeedItemWithContent.description
}]]></description><pubDate>${new Date(
web1FeedItemWithContent.pubDate
).toUTCString()}</pubDate><content:encoded><![CDATA[${
web1FeedItemWithContent.content
}]]></content:encoded></item></channel></rss>`;
// prettier-ignore // prettier-ignore
const validXmlResultWithAllData = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${phpFeedItem.title}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${phpFeedItem.link}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(phpFeedItem.pubDate).toUTCString()}</pubDate></item><item><title><![CDATA[${web1FeedItemWithAllData.title}]]></title><link>${site}${web1FeedItemWithAllData.link}/</link><guid isPermaLink="true">${site}${web1FeedItemWithAllData.link}/</guid><description><![CDATA[${web1FeedItemWithAllData.description}]]></description><pubDate>${new Date(web1FeedItemWithAllData.pubDate).toUTCString()}</pubDate><category>${web1FeedItemWithAllData.categories[0]}</category><category>${web1FeedItemWithAllData.categories[1]}</category><author>${web1FeedItemWithAllData.author}</author><comments>${web1FeedItemWithAllData.commentsUrl}</comments><source url="${web1FeedItemWithAllData.source.url}">${web1FeedItemWithAllData.source.title}</source><enclosure url="${site}${web1FeedItemWithAllData.enclosure.url}" length="${web1FeedItemWithAllData.enclosure.length}" type="${web1FeedItemWithAllData.enclosure.type}"/></item></channel></rss>`; const validXmlResultWithAllData = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${
phpFeedItem.title
}]]></title><link>${site}${phpFeedItem.link}/</link><guid isPermaLink="true">${site}${
phpFeedItem.link
}/</guid><description><![CDATA[${phpFeedItem.description}]]></description><pubDate>${new Date(
phpFeedItem.pubDate
).toUTCString()}</pubDate></item><item><title><![CDATA[${
web1FeedItemWithAllData.title
}]]></title><link>${site}${web1FeedItemWithAllData.link}/</link><guid isPermaLink="true">${site}${
web1FeedItemWithAllData.link
}/</guid><description><![CDATA[${
web1FeedItemWithAllData.description
}]]></description><pubDate>${new Date(
web1FeedItemWithAllData.pubDate
).toUTCString()}</pubDate><category>${web1FeedItemWithAllData.categories[0]}</category><category>${
web1FeedItemWithAllData.categories[1]
}</category><author>${web1FeedItemWithAllData.author}</author><comments>${
web1FeedItemWithAllData.commentsUrl
}</comments><source url="${web1FeedItemWithAllData.source.url}">${
web1FeedItemWithAllData.source.title
}</source><enclosure url="${site}${web1FeedItemWithAllData.enclosure.url}" length="${
web1FeedItemWithAllData.enclosure.length
}" type="${web1FeedItemWithAllData.enclosure.type}"/></item></channel></rss>`;
// prettier-ignore // prettier-ignore
const validXmlWithCustomDataResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${phpFeedItemWithCustomData.title}]]></title><link>${site}${phpFeedItemWithCustomData.link}/</link><guid isPermaLink="true">${site}${phpFeedItemWithCustomData.link}/</guid><description><![CDATA[${phpFeedItemWithCustomData.description}]]></description><pubDate>${new Date(phpFeedItemWithCustomData.pubDate).toUTCString()}</pubDate>${phpFeedItemWithCustomData.customData}</item><item><title><![CDATA[${web1FeedItemWithContent.title}]]></title><link>${site}${web1FeedItemWithContent.link}/</link><guid isPermaLink="true">${site}${web1FeedItemWithContent.link}/</guid><description><![CDATA[${web1FeedItemWithContent.description}]]></description><pubDate>${new Date(web1FeedItemWithContent.pubDate).toUTCString()}</pubDate><content:encoded><![CDATA[${web1FeedItemWithContent.content}]]></content:encoded></item></channel></rss>`; const validXmlWithCustomDataResult = `<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link><item><title><![CDATA[${
phpFeedItemWithCustomData.title
}]]></title><link>${site}${phpFeedItemWithCustomData.link}/</link><guid isPermaLink="true">${site}${
phpFeedItemWithCustomData.link
}/</guid><description><![CDATA[${
phpFeedItemWithCustomData.description
}]]></description><pubDate>${new Date(phpFeedItemWithCustomData.pubDate).toUTCString()}</pubDate>${
phpFeedItemWithCustomData.customData
}</item><item><title><![CDATA[${web1FeedItemWithContent.title}]]></title><link>${site}${
web1FeedItemWithContent.link
}/</link><guid isPermaLink="true">${site}${
web1FeedItemWithContent.link
}/</guid><description><![CDATA[${
web1FeedItemWithContent.description
}]]></description><pubDate>${new Date(
web1FeedItemWithContent.pubDate
).toUTCString()}</pubDate><content:encoded><![CDATA[${
web1FeedItemWithContent.content
}]]></content:encoded></item></channel></rss>`;
// prettier-ignore // prettier-ignore
const validXmlWithStylesheet = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/feedstylesheet.css"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link></channel></rss>`; const validXmlWithStylesheet = `<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/feedstylesheet.css"?><rss version="2.0"><channel><title><![CDATA[${title}]]></title><description><![CDATA[${description}]]></description><link>${site}/</link></channel></rss>`;
// prettier-ignore // prettier-ignore

View file

@ -1,6 +1,6 @@
import { getHighlighter as getShikiHighlighter } from 'shiki'; import { getHighlighter as getShikiHighlighter } from 'shiki';
import { themes } from './shiki-themes.js';
import { languages } from './shiki-languages.js'; import { languages } from './shiki-languages.js';
import { themes } from './shiki-themes.js';
// Caches Promise<Highlighter> for reuse when the same theme and langs are provided // Caches Promise<Highlighter> for reuse when the same theme and langs are provided
const _resolvedHighlighters = new Map(); const _resolvedHighlighters = new Map();

View file

@ -19,158 +19,432 @@ function handleLang(grammar, language) {
// prettier-ignore // prettier-ignore
export const languages = { export const languages = {
'abap': () => import('shiki/languages/abap.tmLanguage.json').then((mod) => handleLang(mod.default, 'abap')), abap: () =>
'actionscript-3': () => import('shiki/languages/actionscript-3.tmLanguage.json').then((mod) => handleLang(mod.default, 'actionscript-3')), import('shiki/languages/abap.tmLanguage.json').then((mod) => handleLang(mod.default, 'abap')),
'ada': () => import('shiki/languages/ada.tmLanguage.json').then((mod) => handleLang(mod.default, 'ada')), 'actionscript-3': () =>
'apache': () => import('shiki/languages/apache.tmLanguage.json').then((mod) => handleLang(mod.default, 'apache')), import('shiki/languages/actionscript-3.tmLanguage.json').then((mod) =>
'apex': () => import('shiki/languages/apex.tmLanguage.json').then((mod) => handleLang(mod.default, 'apex')), handleLang(mod.default, 'actionscript-3')
'apl': () => import('shiki/languages/apl.tmLanguage.json').then((mod) => handleLang(mod.default, 'apl')), ),
'applescript': () => import('shiki/languages/applescript.tmLanguage.json').then((mod) => handleLang(mod.default, 'applescript')), ada: () =>
'ara': () => import('shiki/languages/ara.tmLanguage.json').then((mod) => handleLang(mod.default, 'ara')), import('shiki/languages/ada.tmLanguage.json').then((mod) => handleLang(mod.default, 'ada')),
'asm': () => import('shiki/languages/asm.tmLanguage.json').then((mod) => handleLang(mod.default, 'asm')), apache: () =>
'astro': () => import('shiki/languages/astro.tmLanguage.json').then((mod) => handleLang(mod.default, 'astro')), import('shiki/languages/apache.tmLanguage.json').then((mod) =>
'awk': () => import('shiki/languages/awk.tmLanguage.json').then((mod) => handleLang(mod.default, 'awk')), handleLang(mod.default, 'apache')
'ballerina': () => import('shiki/languages/ballerina.tmLanguage.json').then((mod) => handleLang(mod.default, 'ballerina')), ),
'bat': () => import('shiki/languages/bat.tmLanguage.json').then((mod) => handleLang(mod.default, 'bat')), apex: () =>
'berry': () => import('shiki/languages/berry.tmLanguage.json').then((mod) => handleLang(mod.default, 'berry')), import('shiki/languages/apex.tmLanguage.json').then((mod) => handleLang(mod.default, 'apex')),
'bibtex': () => import('shiki/languages/bibtex.tmLanguage.json').then((mod) => handleLang(mod.default, 'bibtex')), apl: () =>
'bicep': () => import('shiki/languages/bicep.tmLanguage.json').then((mod) => handleLang(mod.default, 'bicep')), import('shiki/languages/apl.tmLanguage.json').then((mod) => handleLang(mod.default, 'apl')),
'blade': () => import('shiki/languages/blade.tmLanguage.json').then((mod) => handleLang(mod.default, 'blade')), applescript: () =>
'c': () => import('shiki/languages/c.tmLanguage.json').then((mod) => handleLang(mod.default, 'c')), import('shiki/languages/applescript.tmLanguage.json').then((mod) =>
'cadence': () => import('shiki/languages/cadence.tmLanguage.json').then((mod) => handleLang(mod.default, 'cadence')), handleLang(mod.default, 'applescript')
'clarity': () => import('shiki/languages/clarity.tmLanguage.json').then((mod) => handleLang(mod.default, 'clarity')), ),
'clojure': () => import('shiki/languages/clojure.tmLanguage.json').then((mod) => handleLang(mod.default, 'clojure')), ara: () =>
'cmake': () => import('shiki/languages/cmake.tmLanguage.json').then((mod) => handleLang(mod.default, 'cmake')), import('shiki/languages/ara.tmLanguage.json').then((mod) => handleLang(mod.default, 'ara')),
'cobol': () => import('shiki/languages/cobol.tmLanguage.json').then((mod) => handleLang(mod.default, 'cobol')), asm: () =>
'codeql': () => import('shiki/languages/codeql.tmLanguage.json').then((mod) => handleLang(mod.default, 'codeql')), import('shiki/languages/asm.tmLanguage.json').then((mod) => handleLang(mod.default, 'asm')),
'coffee': () => import('shiki/languages/coffee.tmLanguage.json').then((mod) => handleLang(mod.default, 'coffee')), astro: () =>
'cpp-macro': () => import('shiki/languages/cpp-macro.tmLanguage.json').then((mod) => handleLang(mod.default, 'cpp-macro')), import('shiki/languages/astro.tmLanguage.json').then((mod) => handleLang(mod.default, 'astro')),
'cpp': () => import('shiki/languages/cpp.tmLanguage.json').then((mod) => handleLang(mod.default, 'cpp')), awk: () =>
'crystal': () => import('shiki/languages/crystal.tmLanguage.json').then((mod) => handleLang(mod.default, 'crystal')), import('shiki/languages/awk.tmLanguage.json').then((mod) => handleLang(mod.default, 'awk')),
'csharp': () => import('shiki/languages/csharp.tmLanguage.json').then((mod) => handleLang(mod.default, 'csharp')), ballerina: () =>
'css': () => import('shiki/languages/css.tmLanguage.json').then((mod) => handleLang(mod.default, 'css')), import('shiki/languages/ballerina.tmLanguage.json').then((mod) =>
'cue': () => import('shiki/languages/cue.tmLanguage.json').then((mod) => handleLang(mod.default, 'cue')), handleLang(mod.default, 'ballerina')
'd': () => import('shiki/languages/d.tmLanguage.json').then((mod) => handleLang(mod.default, 'd')), ),
'dart': () => import('shiki/languages/dart.tmLanguage.json').then((mod) => handleLang(mod.default, 'dart')), bat: () =>
'dax': () => import('shiki/languages/dax.tmLanguage.json').then((mod) => handleLang(mod.default, 'dax')), import('shiki/languages/bat.tmLanguage.json').then((mod) => handleLang(mod.default, 'bat')),
'diff': () => import('shiki/languages/diff.tmLanguage.json').then((mod) => handleLang(mod.default, 'diff')), berry: () =>
'docker': () => import('shiki/languages/docker.tmLanguage.json').then((mod) => handleLang(mod.default, 'docker')), import('shiki/languages/berry.tmLanguage.json').then((mod) => handleLang(mod.default, 'berry')),
'dream-maker': () => import('shiki/languages/dream-maker.tmLanguage.json').then((mod) => handleLang(mod.default, 'dream-maker')), bibtex: () =>
'elixir': () => import('shiki/languages/elixir.tmLanguage.json').then((mod) => handleLang(mod.default, 'elixir')), import('shiki/languages/bibtex.tmLanguage.json').then((mod) =>
'elm': () => import('shiki/languages/elm.tmLanguage.json').then((mod) => handleLang(mod.default, 'elm')), handleLang(mod.default, 'bibtex')
'erb': () => import('shiki/languages/erb.tmLanguage.json').then((mod) => handleLang(mod.default, 'erb')), ),
'erlang': () => import('shiki/languages/erlang.tmLanguage.json').then((mod) => handleLang(mod.default, 'erlang')), bicep: () =>
'fish': () => import('shiki/languages/fish.tmLanguage.json').then((mod) => handleLang(mod.default, 'fish')), import('shiki/languages/bicep.tmLanguage.json').then((mod) => handleLang(mod.default, 'bicep')),
'fsharp': () => import('shiki/languages/fsharp.tmLanguage.json').then((mod) => handleLang(mod.default, 'fsharp')), blade: () =>
'gherkin': () => import('shiki/languages/gherkin.tmLanguage.json').then((mod) => handleLang(mod.default, 'gherkin')), import('shiki/languages/blade.tmLanguage.json').then((mod) => handleLang(mod.default, 'blade')),
'git-commit': () => import('shiki/languages/git-commit.tmLanguage.json').then((mod) => handleLang(mod.default, 'git-commit')), c: () => import('shiki/languages/c.tmLanguage.json').then((mod) => handleLang(mod.default, 'c')),
'git-rebase': () => import('shiki/languages/git-rebase.tmLanguage.json').then((mod) => handleLang(mod.default, 'git-rebase')), cadence: () =>
'glsl': () => import('shiki/languages/glsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'glsl')), import('shiki/languages/cadence.tmLanguage.json').then((mod) =>
'gnuplot': () => import('shiki/languages/gnuplot.tmLanguage.json').then((mod) => handleLang(mod.default, 'gnuplot')), handleLang(mod.default, 'cadence')
'go': () => import('shiki/languages/go.tmLanguage.json').then((mod) => handleLang(mod.default, 'go')), ),
'graphql': () => import('shiki/languages/graphql.tmLanguage.json').then((mod) => handleLang(mod.default, 'graphql')), clarity: () =>
'groovy': () => import('shiki/languages/groovy.tmLanguage.json').then((mod) => handleLang(mod.default, 'groovy')), import('shiki/languages/clarity.tmLanguage.json').then((mod) =>
'hack': () => import('shiki/languages/hack.tmLanguage.json').then((mod) => handleLang(mod.default, 'hack')), handleLang(mod.default, 'clarity')
'haml': () => import('shiki/languages/haml.tmLanguage.json').then((mod) => handleLang(mod.default, 'haml')), ),
'handlebars': () => import('shiki/languages/handlebars.tmLanguage.json').then((mod) => handleLang(mod.default, 'handlebars')), clojure: () =>
'haskell': () => import('shiki/languages/haskell.tmLanguage.json').then((mod) => handleLang(mod.default, 'haskell')), import('shiki/languages/clojure.tmLanguage.json').then((mod) =>
'hcl': () => import('shiki/languages/hcl.tmLanguage.json').then((mod) => handleLang(mod.default, 'hcl')), handleLang(mod.default, 'clojure')
'hlsl': () => import('shiki/languages/hlsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'hlsl')), ),
'html': () => import('shiki/languages/html.tmLanguage.json').then((mod) => handleLang(mod.default, 'html')), cmake: () =>
'http': () => import('shiki/languages/http.tmLanguage.json').then((mod) => handleLang(mod.default, 'http')), import('shiki/languages/cmake.tmLanguage.json').then((mod) => handleLang(mod.default, 'cmake')),
'imba': () => import('shiki/languages/imba.tmLanguage.json').then((mod) => handleLang(mod.default, 'imba')), cobol: () =>
'ini': () => import('shiki/languages/ini.tmLanguage.json').then((mod) => handleLang(mod.default, 'ini')), import('shiki/languages/cobol.tmLanguage.json').then((mod) => handleLang(mod.default, 'cobol')),
'java': () => import('shiki/languages/java.tmLanguage.json').then((mod) => handleLang(mod.default, 'java')), codeql: () =>
'javascript': () => import('shiki/languages/javascript.tmLanguage.json').then((mod) => handleLang(mod.default, 'javascript')), import('shiki/languages/codeql.tmLanguage.json').then((mod) =>
'jinja-html': () => import('shiki/languages/jinja-html.tmLanguage.json').then((mod) => handleLang(mod.default, 'jinja-html')), handleLang(mod.default, 'codeql')
'jinja': () => import('shiki/languages/jinja.tmLanguage.json').then((mod) => handleLang(mod.default, 'jinja')), ),
'jison': () => import('shiki/languages/jison.tmLanguage.json').then((mod) => handleLang(mod.default, 'jison')), coffee: () =>
'json': () => import('shiki/languages/json.tmLanguage.json').then((mod) => handleLang(mod.default, 'json')), import('shiki/languages/coffee.tmLanguage.json').then((mod) =>
'json5': () => import('shiki/languages/json5.tmLanguage.json').then((mod) => handleLang(mod.default, 'json5')), handleLang(mod.default, 'coffee')
'jsonc': () => import('shiki/languages/jsonc.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsonc')), ),
'jsonnet': () => import('shiki/languages/jsonnet.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsonnet')), 'cpp-macro': () =>
'jssm': () => import('shiki/languages/jssm.tmLanguage.json').then((mod) => handleLang(mod.default, 'jssm')), import('shiki/languages/cpp-macro.tmLanguage.json').then((mod) =>
'jsx': () => import('shiki/languages/jsx.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsx')), handleLang(mod.default, 'cpp-macro')
'julia': () => import('shiki/languages/julia.tmLanguage.json').then((mod) => handleLang(mod.default, 'julia')), ),
'kotlin': () => import('shiki/languages/kotlin.tmLanguage.json').then((mod) => handleLang(mod.default, 'kotlin')), cpp: () =>
'latex': () => import('shiki/languages/latex.tmLanguage.json').then((mod) => handleLang(mod.default, 'latex')), import('shiki/languages/cpp.tmLanguage.json').then((mod) => handleLang(mod.default, 'cpp')),
'less': () => import('shiki/languages/less.tmLanguage.json').then((mod) => handleLang(mod.default, 'less')), crystal: () =>
'liquid': () => import('shiki/languages/liquid.tmLanguage.json').then((mod) => handleLang(mod.default, 'liquid')), import('shiki/languages/crystal.tmLanguage.json').then((mod) =>
'lisp': () => import('shiki/languages/lisp.tmLanguage.json').then((mod) => handleLang(mod.default, 'lisp')), handleLang(mod.default, 'crystal')
'logo': () => import('shiki/languages/logo.tmLanguage.json').then((mod) => handleLang(mod.default, 'logo')), ),
'lua': () => import('shiki/languages/lua.tmLanguage.json').then((mod) => handleLang(mod.default, 'lua')), csharp: () =>
'make': () => import('shiki/languages/make.tmLanguage.json').then((mod) => handleLang(mod.default, 'make')), import('shiki/languages/csharp.tmLanguage.json').then((mod) =>
'markdown': () => import('shiki/languages/markdown.tmLanguage.json').then((mod) => handleLang(mod.default, 'markdown')), handleLang(mod.default, 'csharp')
'marko': () => import('shiki/languages/marko.tmLanguage.json').then((mod) => handleLang(mod.default, 'marko')), ),
'matlab': () => import('shiki/languages/matlab.tmLanguage.json').then((mod) => handleLang(mod.default, 'matlab')), css: () =>
'mdx': () => import('shiki/languages/mdx.tmLanguage.json').then((mod) => handleLang(mod.default, 'mdx')), import('shiki/languages/css.tmLanguage.json').then((mod) => handleLang(mod.default, 'css')),
'mermaid': () => import('shiki/languages/mermaid.tmLanguage.json').then((mod) => handleLang(mod.default, 'mermaid')), cue: () =>
'nginx': () => import('shiki/languages/nginx.tmLanguage.json').then((mod) => handleLang(mod.default, 'nginx')), import('shiki/languages/cue.tmLanguage.json').then((mod) => handleLang(mod.default, 'cue')),
'nim': () => import('shiki/languages/nim.tmLanguage.json').then((mod) => handleLang(mod.default, 'nim')), d: () => import('shiki/languages/d.tmLanguage.json').then((mod) => handleLang(mod.default, 'd')),
'nix': () => import('shiki/languages/nix.tmLanguage.json').then((mod) => handleLang(mod.default, 'nix')), dart: () =>
'objective-c': () => import('shiki/languages/objective-c.tmLanguage.json').then((mod) => handleLang(mod.default, 'objective-c')), import('shiki/languages/dart.tmLanguage.json').then((mod) => handleLang(mod.default, 'dart')),
'objective-cpp': () => import('shiki/languages/objective-cpp.tmLanguage.json').then((mod) => handleLang(mod.default, 'objective-cpp')), dax: () =>
'ocaml': () => import('shiki/languages/ocaml.tmLanguage.json').then((mod) => handleLang(mod.default, 'ocaml')), import('shiki/languages/dax.tmLanguage.json').then((mod) => handleLang(mod.default, 'dax')),
'pascal': () => import('shiki/languages/pascal.tmLanguage.json').then((mod) => handleLang(mod.default, 'pascal')), diff: () =>
'perl': () => import('shiki/languages/perl.tmLanguage.json').then((mod) => handleLang(mod.default, 'perl')), import('shiki/languages/diff.tmLanguage.json').then((mod) => handleLang(mod.default, 'diff')),
'php-html': () => import('shiki/languages/php-html.tmLanguage.json').then((mod) => handleLang(mod.default, 'php-html')), docker: () =>
'php': () => import('shiki/languages/php.tmLanguage.json').then((mod) => handleLang(mod.default, 'php')), import('shiki/languages/docker.tmLanguage.json').then((mod) =>
'plsql': () => import('shiki/languages/plsql.tmLanguage.json').then((mod) => handleLang(mod.default, 'plsql')), handleLang(mod.default, 'docker')
'postcss': () => import('shiki/languages/postcss.tmLanguage.json').then((mod) => handleLang(mod.default, 'postcss')), ),
'powerquery': () => import('shiki/languages/powerquery.tmLanguage.json').then((mod) => handleLang(mod.default, 'powerquery')), 'dream-maker': () =>
'powershell': () => import('shiki/languages/powershell.tmLanguage.json').then((mod) => handleLang(mod.default, 'powershell')), import('shiki/languages/dream-maker.tmLanguage.json').then((mod) =>
'prisma': () => import('shiki/languages/prisma.tmLanguage.json').then((mod) => handleLang(mod.default, 'prisma')), handleLang(mod.default, 'dream-maker')
'prolog': () => import('shiki/languages/prolog.tmLanguage.json').then((mod) => handleLang(mod.default, 'prolog')), ),
'proto': () => import('shiki/languages/proto.tmLanguage.json').then((mod) => handleLang(mod.default, 'proto')), elixir: () =>
'pug': () => import('shiki/languages/pug.tmLanguage.json').then((mod) => handleLang(mod.default, 'pug')), import('shiki/languages/elixir.tmLanguage.json').then((mod) =>
'puppet': () => import('shiki/languages/puppet.tmLanguage.json').then((mod) => handleLang(mod.default, 'puppet')), handleLang(mod.default, 'elixir')
'purescript': () => import('shiki/languages/purescript.tmLanguage.json').then((mod) => handleLang(mod.default, 'purescript')), ),
'python': () => import('shiki/languages/python.tmLanguage.json').then((mod) => handleLang(mod.default, 'python')), elm: () =>
'r': () => import('shiki/languages/r.tmLanguage.json').then((mod) => handleLang(mod.default, 'r')), import('shiki/languages/elm.tmLanguage.json').then((mod) => handleLang(mod.default, 'elm')),
'raku': () => import('shiki/languages/raku.tmLanguage.json').then((mod) => handleLang(mod.default, 'raku')), erb: () =>
'razor': () => import('shiki/languages/razor.tmLanguage.json').then((mod) => handleLang(mod.default, 'razor')), import('shiki/languages/erb.tmLanguage.json').then((mod) => handleLang(mod.default, 'erb')),
'rel': () => import('shiki/languages/rel.tmLanguage.json').then((mod) => handleLang(mod.default, 'rel')), erlang: () =>
'riscv': () => import('shiki/languages/riscv.tmLanguage.json').then((mod) => handleLang(mod.default, 'riscv')), import('shiki/languages/erlang.tmLanguage.json').then((mod) =>
'rst': () => import('shiki/languages/rst.tmLanguage.json').then((mod) => handleLang(mod.default, 'rst')), handleLang(mod.default, 'erlang')
'ruby': () => import('shiki/languages/ruby.tmLanguage.json').then((mod) => handleLang(mod.default, 'ruby')), ),
'rust': () => import('shiki/languages/rust.tmLanguage.json').then((mod) => handleLang(mod.default, 'rust')), fish: () =>
'sas': () => import('shiki/languages/sas.tmLanguage.json').then((mod) => handleLang(mod.default, 'sas')), import('shiki/languages/fish.tmLanguage.json').then((mod) => handleLang(mod.default, 'fish')),
'sass': () => import('shiki/languages/sass.tmLanguage.json').then((mod) => handleLang(mod.default, 'sass')), fsharp: () =>
'scala': () => import('shiki/languages/scala.tmLanguage.json').then((mod) => handleLang(mod.default, 'scala')), import('shiki/languages/fsharp.tmLanguage.json').then((mod) =>
'scheme': () => import('shiki/languages/scheme.tmLanguage.json').then((mod) => handleLang(mod.default, 'scheme')), handleLang(mod.default, 'fsharp')
'scss': () => import('shiki/languages/scss.tmLanguage.json').then((mod) => handleLang(mod.default, 'scss')), ),
'shaderlab': () => import('shiki/languages/shaderlab.tmLanguage.json').then((mod) => handleLang(mod.default, 'shaderlab')), gherkin: () =>
'shellscript': () => import('shiki/languages/shellscript.tmLanguage.json').then((mod) => handleLang(mod.default, 'shellscript')), import('shiki/languages/gherkin.tmLanguage.json').then((mod) =>
'smalltalk': () => import('shiki/languages/smalltalk.tmLanguage.json').then((mod) => handleLang(mod.default, 'smalltalk')), handleLang(mod.default, 'gherkin')
'solidity': () => import('shiki/languages/solidity.tmLanguage.json').then((mod) => handleLang(mod.default, 'solidity')), ),
'sparql': () => import('shiki/languages/sparql.tmLanguage.json').then((mod) => handleLang(mod.default, 'sparql')), 'git-commit': () =>
'sql': () => import('shiki/languages/sql.tmLanguage.json').then((mod) => handleLang(mod.default, 'sql')), import('shiki/languages/git-commit.tmLanguage.json').then((mod) =>
'ssh-config': () => import('shiki/languages/ssh-config.tmLanguage.json').then((mod) => handleLang(mod.default, 'ssh-config')), handleLang(mod.default, 'git-commit')
'stata': () => import('shiki/languages/stata.tmLanguage.json').then((mod) => handleLang(mod.default, 'stata')), ),
'stylus': () => import('shiki/languages/stylus.tmLanguage.json').then((mod) => handleLang(mod.default, 'stylus')), 'git-rebase': () =>
'svelte': () => import('shiki/languages/svelte.tmLanguage.json').then((mod) => handleLang(mod.default, 'svelte')), import('shiki/languages/git-rebase.tmLanguage.json').then((mod) =>
'swift': () => import('shiki/languages/swift.tmLanguage.json').then((mod) => handleLang(mod.default, 'swift')), handleLang(mod.default, 'git-rebase')
'system-verilog': () => import('shiki/languages/system-verilog.tmLanguage.json').then((mod) => handleLang(mod.default, 'system-verilog')), ),
'tasl': () => import('shiki/languages/tasl.tmLanguage.json').then((mod) => handleLang(mod.default, 'tasl')), glsl: () =>
'tcl': () => import('shiki/languages/tcl.tmLanguage.json').then((mod) => handleLang(mod.default, 'tcl')), import('shiki/languages/glsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'glsl')),
'tex': () => import('shiki/languages/tex.tmLanguage.json').then((mod) => handleLang(mod.default, 'tex')), gnuplot: () =>
'toml': () => import('shiki/languages/toml.tmLanguage.json').then((mod) => handleLang(mod.default, 'toml')), import('shiki/languages/gnuplot.tmLanguage.json').then((mod) =>
'tsx': () => import('shiki/languages/tsx.tmLanguage.json').then((mod) => handleLang(mod.default, 'tsx')), handleLang(mod.default, 'gnuplot')
'turtle': () => import('shiki/languages/turtle.tmLanguage.json').then((mod) => handleLang(mod.default, 'turtle')), ),
'twig': () => import('shiki/languages/twig.tmLanguage.json').then((mod) => handleLang(mod.default, 'twig')), go: () =>
'typescript': () => import('shiki/languages/typescript.tmLanguage.json').then((mod) => handleLang(mod.default, 'typescript')), import('shiki/languages/go.tmLanguage.json').then((mod) => handleLang(mod.default, 'go')),
'v': () => import('shiki/languages/v.tmLanguage.json').then((mod) => handleLang(mod.default, 'v')), graphql: () =>
'vb': () => import('shiki/languages/vb.tmLanguage.json').then((mod) => handleLang(mod.default, 'vb')), import('shiki/languages/graphql.tmLanguage.json').then((mod) =>
'verilog': () => import('shiki/languages/verilog.tmLanguage.json').then((mod) => handleLang(mod.default, 'verilog')), handleLang(mod.default, 'graphql')
'vhdl': () => import('shiki/languages/vhdl.tmLanguage.json').then((mod) => handleLang(mod.default, 'vhdl')), ),
'viml': () => import('shiki/languages/viml.tmLanguage.json').then((mod) => handleLang(mod.default, 'viml')), groovy: () =>
'vue-html': () => import('shiki/languages/vue-html.tmLanguage.json').then((mod) => handleLang(mod.default, 'vue-html')), import('shiki/languages/groovy.tmLanguage.json').then((mod) =>
'vue': () => import('shiki/languages/vue.tmLanguage.json').then((mod) => handleLang(mod.default, 'vue')), handleLang(mod.default, 'groovy')
'wasm': () => import('shiki/languages/wasm.tmLanguage.json').then((mod) => handleLang(mod.default, 'wasm')), ),
'wenyan': () => import('shiki/languages/wenyan.tmLanguage.json').then((mod) => handleLang(mod.default, 'wenyan')), hack: () =>
'wgsl': () => import('shiki/languages/wgsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'wgsl')), import('shiki/languages/hack.tmLanguage.json').then((mod) => handleLang(mod.default, 'hack')),
'xml': () => import('shiki/languages/xml.tmLanguage.json').then((mod) => handleLang(mod.default, 'xml')), haml: () =>
'xsl': () => import('shiki/languages/xsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'xsl')), import('shiki/languages/haml.tmLanguage.json').then((mod) => handleLang(mod.default, 'haml')),
'yaml': () => import('shiki/languages/yaml.tmLanguage.json').then((mod) => handleLang(mod.default, 'yaml')), handlebars: () =>
'zenscript': () => import('shiki/languages/zenscript.tmLanguage.json').then((mod) => handleLang(mod.default, 'zenscript')), import('shiki/languages/handlebars.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'handlebars')
),
haskell: () =>
import('shiki/languages/haskell.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'haskell')
),
hcl: () =>
import('shiki/languages/hcl.tmLanguage.json').then((mod) => handleLang(mod.default, 'hcl')),
hlsl: () =>
import('shiki/languages/hlsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'hlsl')),
html: () =>
import('shiki/languages/html.tmLanguage.json').then((mod) => handleLang(mod.default, 'html')),
http: () =>
import('shiki/languages/http.tmLanguage.json').then((mod) => handleLang(mod.default, 'http')),
imba: () =>
import('shiki/languages/imba.tmLanguage.json').then((mod) => handleLang(mod.default, 'imba')),
ini: () =>
import('shiki/languages/ini.tmLanguage.json').then((mod) => handleLang(mod.default, 'ini')),
java: () =>
import('shiki/languages/java.tmLanguage.json').then((mod) => handleLang(mod.default, 'java')),
javascript: () =>
import('shiki/languages/javascript.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'javascript')
),
'jinja-html': () =>
import('shiki/languages/jinja-html.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'jinja-html')
),
jinja: () =>
import('shiki/languages/jinja.tmLanguage.json').then((mod) => handleLang(mod.default, 'jinja')),
jison: () =>
import('shiki/languages/jison.tmLanguage.json').then((mod) => handleLang(mod.default, 'jison')),
json: () =>
import('shiki/languages/json.tmLanguage.json').then((mod) => handleLang(mod.default, 'json')),
json5: () =>
import('shiki/languages/json5.tmLanguage.json').then((mod) => handleLang(mod.default, 'json5')),
jsonc: () =>
import('shiki/languages/jsonc.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsonc')),
jsonnet: () =>
import('shiki/languages/jsonnet.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'jsonnet')
),
jssm: () =>
import('shiki/languages/jssm.tmLanguage.json').then((mod) => handleLang(mod.default, 'jssm')),
jsx: () =>
import('shiki/languages/jsx.tmLanguage.json').then((mod) => handleLang(mod.default, 'jsx')),
julia: () =>
import('shiki/languages/julia.tmLanguage.json').then((mod) => handleLang(mod.default, 'julia')),
kotlin: () =>
import('shiki/languages/kotlin.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'kotlin')
),
latex: () =>
import('shiki/languages/latex.tmLanguage.json').then((mod) => handleLang(mod.default, 'latex')),
less: () =>
import('shiki/languages/less.tmLanguage.json').then((mod) => handleLang(mod.default, 'less')),
liquid: () =>
import('shiki/languages/liquid.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'liquid')
),
lisp: () =>
import('shiki/languages/lisp.tmLanguage.json').then((mod) => handleLang(mod.default, 'lisp')),
logo: () =>
import('shiki/languages/logo.tmLanguage.json').then((mod) => handleLang(mod.default, 'logo')),
lua: () =>
import('shiki/languages/lua.tmLanguage.json').then((mod) => handleLang(mod.default, 'lua')),
make: () =>
import('shiki/languages/make.tmLanguage.json').then((mod) => handleLang(mod.default, 'make')),
markdown: () =>
import('shiki/languages/markdown.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'markdown')
),
marko: () =>
import('shiki/languages/marko.tmLanguage.json').then((mod) => handleLang(mod.default, 'marko')),
matlab: () =>
import('shiki/languages/matlab.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'matlab')
),
mdx: () =>
import('shiki/languages/mdx.tmLanguage.json').then((mod) => handleLang(mod.default, 'mdx')),
mermaid: () =>
import('shiki/languages/mermaid.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'mermaid')
),
nginx: () =>
import('shiki/languages/nginx.tmLanguage.json').then((mod) => handleLang(mod.default, 'nginx')),
nim: () =>
import('shiki/languages/nim.tmLanguage.json').then((mod) => handleLang(mod.default, 'nim')),
nix: () =>
import('shiki/languages/nix.tmLanguage.json').then((mod) => handleLang(mod.default, 'nix')),
'objective-c': () =>
import('shiki/languages/objective-c.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'objective-c')
),
'objective-cpp': () =>
import('shiki/languages/objective-cpp.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'objective-cpp')
),
ocaml: () =>
import('shiki/languages/ocaml.tmLanguage.json').then((mod) => handleLang(mod.default, 'ocaml')),
pascal: () =>
import('shiki/languages/pascal.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'pascal')
),
perl: () =>
import('shiki/languages/perl.tmLanguage.json').then((mod) => handleLang(mod.default, 'perl')),
'php-html': () =>
import('shiki/languages/php-html.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'php-html')
),
php: () =>
import('shiki/languages/php.tmLanguage.json').then((mod) => handleLang(mod.default, 'php')),
plsql: () =>
import('shiki/languages/plsql.tmLanguage.json').then((mod) => handleLang(mod.default, 'plsql')),
postcss: () =>
import('shiki/languages/postcss.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'postcss')
),
powerquery: () =>
import('shiki/languages/powerquery.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'powerquery')
),
powershell: () =>
import('shiki/languages/powershell.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'powershell')
),
prisma: () =>
import('shiki/languages/prisma.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'prisma')
),
prolog: () =>
import('shiki/languages/prolog.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'prolog')
),
proto: () =>
import('shiki/languages/proto.tmLanguage.json').then((mod) => handleLang(mod.default, 'proto')),
pug: () =>
import('shiki/languages/pug.tmLanguage.json').then((mod) => handleLang(mod.default, 'pug')),
puppet: () =>
import('shiki/languages/puppet.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'puppet')
),
purescript: () =>
import('shiki/languages/purescript.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'purescript')
),
python: () =>
import('shiki/languages/python.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'python')
),
r: () => import('shiki/languages/r.tmLanguage.json').then((mod) => handleLang(mod.default, 'r')),
raku: () =>
import('shiki/languages/raku.tmLanguage.json').then((mod) => handleLang(mod.default, 'raku')),
razor: () =>
import('shiki/languages/razor.tmLanguage.json').then((mod) => handleLang(mod.default, 'razor')),
rel: () =>
import('shiki/languages/rel.tmLanguage.json').then((mod) => handleLang(mod.default, 'rel')),
riscv: () =>
import('shiki/languages/riscv.tmLanguage.json').then((mod) => handleLang(mod.default, 'riscv')),
rst: () =>
import('shiki/languages/rst.tmLanguage.json').then((mod) => handleLang(mod.default, 'rst')),
ruby: () =>
import('shiki/languages/ruby.tmLanguage.json').then((mod) => handleLang(mod.default, 'ruby')),
rust: () =>
import('shiki/languages/rust.tmLanguage.json').then((mod) => handleLang(mod.default, 'rust')),
sas: () =>
import('shiki/languages/sas.tmLanguage.json').then((mod) => handleLang(mod.default, 'sas')),
sass: () =>
import('shiki/languages/sass.tmLanguage.json').then((mod) => handleLang(mod.default, 'sass')),
scala: () =>
import('shiki/languages/scala.tmLanguage.json').then((mod) => handleLang(mod.default, 'scala')),
scheme: () =>
import('shiki/languages/scheme.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'scheme')
),
scss: () =>
import('shiki/languages/scss.tmLanguage.json').then((mod) => handleLang(mod.default, 'scss')),
shaderlab: () =>
import('shiki/languages/shaderlab.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'shaderlab')
),
shellscript: () =>
import('shiki/languages/shellscript.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'shellscript')
),
smalltalk: () =>
import('shiki/languages/smalltalk.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'smalltalk')
),
solidity: () =>
import('shiki/languages/solidity.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'solidity')
),
sparql: () =>
import('shiki/languages/sparql.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'sparql')
),
sql: () =>
import('shiki/languages/sql.tmLanguage.json').then((mod) => handleLang(mod.default, 'sql')),
'ssh-config': () =>
import('shiki/languages/ssh-config.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'ssh-config')
),
stata: () =>
import('shiki/languages/stata.tmLanguage.json').then((mod) => handleLang(mod.default, 'stata')),
stylus: () =>
import('shiki/languages/stylus.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'stylus')
),
svelte: () =>
import('shiki/languages/svelte.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'svelte')
),
swift: () =>
import('shiki/languages/swift.tmLanguage.json').then((mod) => handleLang(mod.default, 'swift')),
'system-verilog': () =>
import('shiki/languages/system-verilog.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'system-verilog')
),
tasl: () =>
import('shiki/languages/tasl.tmLanguage.json').then((mod) => handleLang(mod.default, 'tasl')),
tcl: () =>
import('shiki/languages/tcl.tmLanguage.json').then((mod) => handleLang(mod.default, 'tcl')),
tex: () =>
import('shiki/languages/tex.tmLanguage.json').then((mod) => handleLang(mod.default, 'tex')),
toml: () =>
import('shiki/languages/toml.tmLanguage.json').then((mod) => handleLang(mod.default, 'toml')),
tsx: () =>
import('shiki/languages/tsx.tmLanguage.json').then((mod) => handleLang(mod.default, 'tsx')),
turtle: () =>
import('shiki/languages/turtle.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'turtle')
),
twig: () =>
import('shiki/languages/twig.tmLanguage.json').then((mod) => handleLang(mod.default, 'twig')),
typescript: () =>
import('shiki/languages/typescript.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'typescript')
),
v: () => import('shiki/languages/v.tmLanguage.json').then((mod) => handleLang(mod.default, 'v')),
vb: () =>
import('shiki/languages/vb.tmLanguage.json').then((mod) => handleLang(mod.default, 'vb')),
verilog: () =>
import('shiki/languages/verilog.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'verilog')
),
vhdl: () =>
import('shiki/languages/vhdl.tmLanguage.json').then((mod) => handleLang(mod.default, 'vhdl')),
viml: () =>
import('shiki/languages/viml.tmLanguage.json').then((mod) => handleLang(mod.default, 'viml')),
'vue-html': () =>
import('shiki/languages/vue-html.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'vue-html')
),
vue: () =>
import('shiki/languages/vue.tmLanguage.json').then((mod) => handleLang(mod.default, 'vue')),
wasm: () =>
import('shiki/languages/wasm.tmLanguage.json').then((mod) => handleLang(mod.default, 'wasm')),
wenyan: () =>
import('shiki/languages/wenyan.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'wenyan')
),
wgsl: () =>
import('shiki/languages/wgsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'wgsl')),
xml: () =>
import('shiki/languages/xml.tmLanguage.json').then((mod) => handleLang(mod.default, 'xml')),
xsl: () =>
import('shiki/languages/xsl.tmLanguage.json').then((mod) => handleLang(mod.default, 'xsl')),
yaml: () =>
import('shiki/languages/yaml.tmLanguage.json').then((mod) => handleLang(mod.default, 'yaml')),
zenscript: () =>
import('shiki/languages/zenscript.tmLanguage.json').then((mod) =>
handleLang(mod.default, 'zenscript')
),
}; };

View file

@ -5,33 +5,38 @@
// prettier-ignore // prettier-ignore
export const themes = { export const themes = {
'css-variables': () => import('shiki/themes/css-variables.json').then(mod => mod.default), 'css-variables': () => import('shiki/themes/css-variables.json').then((mod) => mod.default),
'dark-plus': () => import('shiki/themes/dark-plus.json').then(mod => mod.default), 'dark-plus': () => import('shiki/themes/dark-plus.json').then((mod) => mod.default),
'dracula-soft': () => import('shiki/themes/dracula-soft.json').then(mod => mod.default), 'dracula-soft': () => import('shiki/themes/dracula-soft.json').then((mod) => mod.default),
'dracula': () => import('shiki/themes/dracula.json').then(mod => mod.default), dracula: () => import('shiki/themes/dracula.json').then((mod) => mod.default),
'github-dark-dimmed': () => import('shiki/themes/github-dark-dimmed.json').then(mod => mod.default), 'github-dark-dimmed': () =>
'github-dark': () => import('shiki/themes/github-dark.json').then(mod => mod.default), import('shiki/themes/github-dark-dimmed.json').then((mod) => mod.default),
'github-light': () => import('shiki/themes/github-light.json').then(mod => mod.default), 'github-dark': () => import('shiki/themes/github-dark.json').then((mod) => mod.default),
'hc_light': () => import('shiki/themes/hc_light.json').then(mod => mod.default), 'github-light': () => import('shiki/themes/github-light.json').then((mod) => mod.default),
'light-plus': () => import('shiki/themes/light-plus.json').then(mod => mod.default), hc_light: () => import('shiki/themes/hc_light.json').then((mod) => mod.default),
'material-theme-darker': () => import('shiki/themes/material-theme-darker.json').then(mod => mod.default), 'light-plus': () => import('shiki/themes/light-plus.json').then((mod) => mod.default),
'material-theme-lighter': () => import('shiki/themes/material-theme-lighter.json').then(mod => mod.default), 'material-theme-darker': () =>
'material-theme-ocean': () => import('shiki/themes/material-theme-ocean.json').then(mod => mod.default), import('shiki/themes/material-theme-darker.json').then((mod) => mod.default),
'material-theme-palenight': () => import('shiki/themes/material-theme-palenight.json').then(mod => mod.default), 'material-theme-lighter': () =>
'material-theme': () => import('shiki/themes/material-theme.json').then(mod => mod.default), import('shiki/themes/material-theme-lighter.json').then((mod) => mod.default),
'min-dark': () => import('shiki/themes/min-dark.json').then(mod => mod.default), 'material-theme-ocean': () =>
'min-light': () => import('shiki/themes/min-light.json').then(mod => mod.default), import('shiki/themes/material-theme-ocean.json').then((mod) => mod.default),
'monokai': () => import('shiki/themes/monokai.json').then(mod => mod.default), 'material-theme-palenight': () =>
'nord': () => import('shiki/themes/nord.json').then(mod => mod.default), import('shiki/themes/material-theme-palenight.json').then((mod) => mod.default),
'one-dark-pro': () => import('shiki/themes/one-dark-pro.json').then(mod => mod.default), 'material-theme': () => import('shiki/themes/material-theme.json').then((mod) => mod.default),
'poimandres': () => import('shiki/themes/poimandres.json').then(mod => mod.default), 'min-dark': () => import('shiki/themes/min-dark.json').then((mod) => mod.default),
'rose-pine-dawn': () => import('shiki/themes/rose-pine-dawn.json').then(mod => mod.default), 'min-light': () => import('shiki/themes/min-light.json').then((mod) => mod.default),
'rose-pine-moon': () => import('shiki/themes/rose-pine-moon.json').then(mod => mod.default), monokai: () => import('shiki/themes/monokai.json').then((mod) => mod.default),
'rose-pine': () => import('shiki/themes/rose-pine.json').then(mod => mod.default), nord: () => import('shiki/themes/nord.json').then((mod) => mod.default),
'slack-dark': () => import('shiki/themes/slack-dark.json').then(mod => mod.default), 'one-dark-pro': () => import('shiki/themes/one-dark-pro.json').then((mod) => mod.default),
'slack-ochin': () => import('shiki/themes/slack-ochin.json').then(mod => mod.default), poimandres: () => import('shiki/themes/poimandres.json').then((mod) => mod.default),
'solarized-dark': () => import('shiki/themes/solarized-dark.json').then(mod => mod.default), 'rose-pine-dawn': () => import('shiki/themes/rose-pine-dawn.json').then((mod) => mod.default),
'solarized-light': () => import('shiki/themes/solarized-light.json').then(mod => mod.default), 'rose-pine-moon': () => import('shiki/themes/rose-pine-moon.json').then((mod) => mod.default),
'vitesse-dark': () => import('shiki/themes/vitesse-dark.json').then(mod => mod.default), 'rose-pine': () => import('shiki/themes/rose-pine.json').then((mod) => mod.default),
'vitesse-light': () => import('shiki/themes/vitesse-light.json').then(mod => mod.default), 'slack-dark': () => import('shiki/themes/slack-dark.json').then((mod) => mod.default),
'slack-ochin': () => import('shiki/themes/slack-ochin.json').then((mod) => mod.default),
'solarized-dark': () => import('shiki/themes/solarized-dark.json').then((mod) => mod.default),
'solarized-light': () => import('shiki/themes/solarized-light.json').then((mod) => mod.default),
'vitesse-dark': () => import('shiki/themes/vitesse-dark.json').then((mod) => mod.default),
'vitesse-light': () => import('shiki/themes/vitesse-light.json').then((mod) => mod.default),
}; };

View file

@ -32,7 +32,7 @@ declare module 'astro:content' {
import('astro/zod').ZodLiteral<'tiff'>, import('astro/zod').ZodLiteral<'tiff'>,
import('astro/zod').ZodLiteral<'webp'>, import('astro/zod').ZodLiteral<'webp'>,
import('astro/zod').ZodLiteral<'gif'>, import('astro/zod').ZodLiteral<'gif'>,
import('astro/zod').ZodLiteral<'svg'>, import('astro/zod').ZodLiteral<'svg'>
] ]
>; >;
}>; }>;
@ -72,7 +72,7 @@ declare module 'astro:content' {
export function getEntryBySlug< export function getEntryBySlug<
C extends keyof ContentEntryMap, C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}), E extends ValidContentEntrySlug<C> | (string & {})
>( >(
collection: C, collection: C,
// Note that this has to accept a regular string too, for SSR // Note that this has to accept a regular string too, for SSR
@ -97,7 +97,7 @@ declare module 'astro:content' {
export function getEntry< export function getEntry<
C extends keyof ContentEntryMap, C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}), E extends ValidContentEntrySlug<C> | (string & {})
>(entry: { >(entry: {
collection: C; collection: C;
slug: E; slug: E;
@ -106,7 +106,7 @@ declare module 'astro:content' {
: Promise<CollectionEntry<C> | undefined>; : Promise<CollectionEntry<C> | undefined>;
export function getEntry< export function getEntry<
C extends keyof DataEntryMap, C extends keyof DataEntryMap,
E extends keyof DataEntryMap[C] | (string & {}), E extends keyof DataEntryMap[C] | (string & {})
>(entry: { >(entry: {
collection: C; collection: C;
id: E; id: E;
@ -115,7 +115,7 @@ declare module 'astro:content' {
: Promise<CollectionEntry<C> | undefined>; : Promise<CollectionEntry<C> | undefined>;
export function getEntry< export function getEntry<
C extends keyof ContentEntryMap, C extends keyof ContentEntryMap,
E extends ValidContentEntrySlug<C> | (string & {}), E extends ValidContentEntrySlug<C> | (string & {})
>( >(
collection: C, collection: C,
slug: E slug: E
@ -124,7 +124,7 @@ declare module 'astro:content' {
: Promise<CollectionEntry<C> | undefined>; : Promise<CollectionEntry<C> | undefined>;
export function getEntry< export function getEntry<
C extends keyof DataEntryMap, C extends keyof DataEntryMap,
E extends keyof DataEntryMap[C] | (string & {}), E extends keyof DataEntryMap[C] | (string & {})
>( >(
collection: C, collection: C,
id: E id: E

View file

@ -1,6 +1,6 @@
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { testFactory, waitForHydrate } from './test-utils.js';
import testAdapter from '../test/test-adapter.js'; import testAdapter from '../test/test-adapter.js';
import { testFactory, waitForHydrate } from './test-utils.js';
const test = testFactory({ const test = testFactory({
root: './fixtures/custom-client-directives/', root: './fixtures/custom-client-directives/',

View file

@ -1,5 +1,5 @@
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { testFactory, getErrorOverlayContent } from './test-utils.js'; import { getErrorOverlayContent, testFactory } from './test-utils.js';
const test = testFactory({ const test = testFactory({
root: './fixtures/error-cyclic/', root: './fixtures/error-cyclic/',

View file

@ -1,5 +1,5 @@
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { testFactory, getErrorOverlayContent } from './test-utils.js'; import { getErrorOverlayContent, testFactory } from './test-utils.js';
const test = testFactory({ const test = testFactory({
root: './fixtures/error-sass/', root: './fixtures/error-sass/',

View file

@ -1,4 +1,4 @@
import { test as base, expect } from '@playwright/test'; import { expect, test as base } from '@playwright/test';
import { loadFixture, waitForHydrate } from './test-utils.js'; import { loadFixture, waitForHydrate } from './test-utils.js';
const test = base.extend({ const test = base.extend({

View file

@ -1,7 +1,7 @@
import { expect, test as testBase } from '@playwright/test';
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { expect, test as testBase } from '@playwright/test';
import { loadFixture as baseLoadFixture } from '../test/test-utils.js'; import { loadFixture as baseLoadFixture } from '../test/test-utils.js';
export const isWindows = process.platform === 'win32'; export const isWindows = process.platform === 'win32';

View file

@ -1,5 +1,5 @@
import { prepareTestFactory } from './shared-component-tests.js';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { prepareTestFactory } from './shared-component-tests.js';
const { test, createTests } = prepareTestFactory({ root: './fixtures/vue-component/' }); const { test, createTests } = prepareTestFactory({ root: './fixtures/vue-component/' });
const config = { const config = {

View file

@ -1,10 +1,10 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { bold, cyan, dim } from 'kleur/colors';
import yargs from 'yargs-parser';
import { loadFixture } from '../test/test-utils.js'; import { loadFixture } from '../test/test-utils.js';
import { generatePosts } from './scripts/generate-posts.mjs'; import { generatePosts } from './scripts/generate-posts.mjs';
import yargs from 'yargs-parser';
import { cyan, bold, dim } from 'kleur/colors';
// Skip nonessential remark / rehype plugins for a fair comparison. // Skip nonessential remark / rehype plugins for a fair comparison.
// This includes heading ID generation, syntax highlighting, GFM, and Smartypants. // This includes heading ID generation, syntax highlighting, GFM, and Smartypants.

View file

@ -1,3 +1,5 @@
import type { OutgoingHttpHeaders } from 'node:http';
import type { AddressInfo } from 'node:net';
import type { import type {
MarkdownHeading, MarkdownHeading,
MarkdownMetadata, MarkdownMetadata,
@ -8,8 +10,6 @@ import type {
ShikiConfig, ShikiConfig,
} from '@astrojs/markdown-remark'; } from '@astrojs/markdown-remark';
import type * as babel from '@babel/core'; import type * as babel from '@babel/core';
import type { OutgoingHttpHeaders } from 'node:http';
import type { AddressInfo } from 'node:net';
import type * as rollup from 'rollup'; import type * as rollup from 'rollup';
import type { TsConfigJson } from 'tsconfig-resolver'; import type { TsConfigJson } from 'tsconfig-resolver';
import type * as vite from 'vite'; import type * as vite from 'vite';
@ -148,7 +148,7 @@ export interface CLIFlags {
export interface AstroGlobal< export interface AstroGlobal<
Props extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>,
Self = AstroComponentFactory, Self = AstroComponentFactory,
Params extends Record<string, string | undefined> = Record<string, string | undefined>, Params extends Record<string, string | undefined> = Record<string, string | undefined>
> extends AstroGlobalPartial, > extends AstroGlobalPartial,
AstroSharedContext<Props, Params> { AstroSharedContext<Props, Params> {
/** /**
@ -281,7 +281,7 @@ export interface AstroGlobal<
} }
/** Union type of supported markdown file extensions */ /** Union type of supported markdown file extensions */
type MarkdowFileExtension = (typeof SUPPORTED_MARKDOWN_FILE_EXTENSIONS)[number]; type MarkdowFileExtension = typeof SUPPORTED_MARKDOWN_FILE_EXTENSIONS[number];
export interface AstroGlobalPartial { export interface AstroGlobalPartial {
/** /**
@ -1751,7 +1751,7 @@ export interface Page<T = any> {
export type PaginateFunction = < export type PaginateFunction = <
PaginateData, PaginateData,
AdditionalPaginateProps extends Props, AdditionalPaginateProps extends Props,
AdditionalPaginateParams extends Params, AdditionalPaginateParams extends Params
>( >(
data: PaginateData[], data: PaginateData[],
args?: PaginateOptions<AdditionalPaginateProps, AdditionalPaginateParams> args?: PaginateOptions<AdditionalPaginateProps, AdditionalPaginateParams>
@ -1825,7 +1825,7 @@ export type ValidRedirectStatus = 300 | 301 | 302 | 303 | 304 | 307 | 308;
// Shared types between `Astro` global and API context object // Shared types between `Astro` global and API context object
interface AstroSharedContext< interface AstroSharedContext<
Props extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>,
RouteParams extends Record<string, string | undefined> = Record<string, string | undefined>, RouteParams extends Record<string, string | undefined> = Record<string, string | undefined>
> { > {
/** /**
* The address (usually IP address) of the user. Used with SSR only. * The address (usually IP address) of the user. Used with SSR only.
@ -1864,7 +1864,7 @@ interface AstroSharedContext<
export interface APIContext< export interface APIContext<
Props extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>,
APIParams extends Record<string, string | undefined> = Record<string, string | undefined>, APIParams extends Record<string, string | undefined> = Record<string, string | undefined>
> extends AstroSharedContext<Props, Params> { > extends AstroSharedContext<Props, Params> {
site: URL | undefined; site: URL | undefined;
generator: string; generator: string;
@ -2009,7 +2009,7 @@ export interface SSRLoadedRenderer extends AstroRenderer {
export type HookParameters< export type HookParameters<
Hook extends keyof AstroIntegration['hooks'], Hook extends keyof AstroIntegration['hooks'],
Fn = AstroIntegration['hooks'][Hook], Fn = AstroIntegration['hooks'][Hook]
> = Fn extends (...args: any) => any ? Parameters<Fn>[0] : never; > = Fn extends (...args: any) => any ? Parameters<Fn>[0] : never;
export interface AstroIntegration { export interface AstroIntegration {

View file

@ -6,7 +6,7 @@ import { isServerLikeOutput } from '../../prerender/utils.js';
import { getConfiguredImageService, isESMImportedImage } from '../internal.js'; import { getConfiguredImageService, isESMImportedImage } from '../internal.js';
import type { LocalImageService } from '../services/service.js'; import type { LocalImageService } from '../services/service.js';
import type { ImageMetadata, ImageTransform } from '../types.js'; import type { ImageMetadata, ImageTransform } from '../types.js';
import { loadRemoteImage, type RemoteCacheEntry } from './remote.js'; import { type RemoteCacheEntry, loadRemoteImage } from './remote.js';
interface GenerationDataUncached { interface GenerationDataUncached {
cached: false; cached: false;

View file

@ -1,7 +1,7 @@
import { isRemotePath } from '@astrojs/internal-helpers/path'; import { isRemotePath } from '@astrojs/internal-helpers/path';
import type { AstroConfig, AstroSettings } from '../@types/astro.js'; import type { AstroConfig, AstroSettings } from '../@types/astro.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { isLocalService, type ImageService } from './services/service.js'; import { type ImageService, isLocalService } from './services/service.js';
import type { import type {
GetImageResult, GetImageResult,
ImageMetadata, ImageMetadata,

View file

@ -1,4 +1,4 @@
import { baseService, type LocalImageService } from './service.js'; import { type LocalImageService, baseService } from './service.js';
// Empty service used for platforms that neither support Squoosh or Sharp. // Empty service used for platforms that neither support Squoosh or Sharp.
const noopService: LocalImageService = { const noopService: LocalImageService = {

View file

@ -2,10 +2,10 @@ import type { FormatEnum } from 'sharp';
import { AstroError, AstroErrorData } from '../../core/errors/index.js'; import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js'; import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import { import {
baseService,
parseQuality,
type BaseServiceTransform, type BaseServiceTransform,
type LocalImageService, type LocalImageService,
baseService,
parseQuality,
} from './service.js'; } from './service.js';
let sharp: typeof import('sharp'); let sharp: typeof import('sharp');

View file

@ -3,10 +3,10 @@
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js'; import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import { imageMetadata } from '../utils/metadata.js'; import { imageMetadata } from '../utils/metadata.js';
import { import {
baseService,
parseQuality,
type BaseServiceTransform, type BaseServiceTransform,
type LocalImageService, type LocalImageService,
baseService,
parseQuality,
} from './service.js'; } from './service.js';
import { processBuffer } from './vendor/squoosh/image-pool.js'; import { processBuffer } from './vendor/squoosh/image-pool.js';
import type { Operation } from './vendor/squoosh/image.js'; import type { Operation } from './vendor/squoosh/image.js';

View file

@ -5,8 +5,8 @@ import type { ImageService } from './services/service.js';
export type ImageQualityPreset = 'low' | 'mid' | 'high' | 'max' | (string & {}); export type ImageQualityPreset = 'low' | 'mid' | 'high' | 'max' | (string & {});
export type ImageQuality = ImageQualityPreset | number; export type ImageQuality = ImageQualityPreset | number;
export type ImageInputFormat = (typeof VALID_INPUT_FORMATS)[number]; export type ImageInputFormat = typeof VALID_INPUT_FORMATS[number];
export type ImageOutputFormat = (typeof VALID_OUTPUT_FORMATS)[number] | (string & {}); export type ImageOutputFormat = typeof VALID_OUTPUT_FORMATS[number] | (string & {});
declare global { declare global {
// eslint-disable-next-line no-var // eslint-disable-next-line no-var

View file

@ -1,10 +1,10 @@
import fsMod, { existsSync, promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import boxen from 'boxen'; import boxen from 'boxen';
import { diffWords } from 'diff'; import { diffWords } from 'diff';
import { execa } from 'execa'; import { execa } from 'execa';
import { bold, cyan, dim, green, magenta, red, yellow } from 'kleur/colors'; import { bold, cyan, dim, green, magenta, red, yellow } from 'kleur/colors';
import fsMod, { existsSync, promises as fs } from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import ora from 'ora'; import ora from 'ora';
import preferredPM from 'preferred-pm'; import preferredPM from 'preferred-pm';
import prompts from 'prompts'; import prompts from 'prompts';
@ -12,9 +12,9 @@ import type yargs from 'yargs-parser';
import { loadTSConfig, resolveConfigPath, resolveRoot } from '../../core/config/index.js'; import { loadTSConfig, resolveConfigPath, resolveRoot } from '../../core/config/index.js';
import { import {
defaultTSConfig, defaultTSConfig,
type frameworkWithTSSettings,
presets, presets,
updateTSConfigForFramework, updateTSConfigForFramework,
type frameworkWithTSSettings,
} from '../../core/config/tsconfig.js'; } from '../../core/config/tsconfig.js';
import type { Logger } from '../../core/logger/core.js'; import type { Logger } from '../../core/logger/core.js';
import * as msg from '../../core/messages.js'; import * as msg from '../../core/messages.js';

View file

@ -1,6 +1,6 @@
import type { Arguments as Flags } from 'yargs-parser'; import type { Arguments as Flags } from 'yargs-parser';
import type { AstroInlineConfig } from '../@types/astro.js'; import type { AstroInlineConfig } from '../@types/astro.js';
import { Logger, type LogOptions } from '../core/logger/core.js'; import { type LogOptions, Logger } from '../core/logger/core.js';
import { nodeLogDestination } from '../core/logger/node.js'; import { nodeLogDestination } from '../core/logger/node.js';
export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig { export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig {

View file

@ -1,7 +1,7 @@
/* eslint-disable no-console */
import * as colors from 'kleur/colors';
import { execSync } from 'node:child_process'; import { execSync } from 'node:child_process';
import { arch, platform } from 'node:os'; import { arch, platform } from 'node:os';
/* eslint-disable no-console */
import * as colors from 'kleur/colors';
import prompts from 'prompts'; import prompts from 'prompts';
import type yargs from 'yargs-parser'; import type yargs from 'yargs-parser';
import { resolveConfig } from '../../core/config/index.js'; import { resolveConfig } from '../../core/config/index.js';

View file

@ -3,6 +3,7 @@ import { ZodIssueCode, string as zodString } from 'zod';
import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { prependForwardSlash } from '../core/path.js'; import { prependForwardSlash } from '../core/path.js';
import { import {
type AstroComponentFactory,
createComponent, createComponent,
createHeadAndContent, createHeadAndContent,
renderComponent, renderComponent,
@ -10,7 +11,6 @@ import {
renderTemplate, renderTemplate,
renderUniqueStylesheet, renderUniqueStylesheet,
unescapeHTML, unescapeHTML,
type AstroComponentFactory,
} from '../runtime/server/index.js'; } from '../runtime/server/index.js';
import type { ContentLookupMap } from './utils.js'; import type { ContentLookupMap } from './utils.js';

View file

@ -1,14 +1,14 @@
import { bold, cyan } from 'kleur/colors';
import type fsMod from 'node:fs'; import type fsMod from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import { bold, cyan } from 'kleur/colors';
import type { ViteDevServer } from 'vite'; import type { ViteDevServer } from 'vite';
import type { AstroSettings } from '../@types/astro.js'; import type { AstroSettings } from '../@types/astro.js';
import { loadTSConfig } from '../core/config/tsconfig.js'; import { loadTSConfig } from '../core/config/tsconfig.js';
import type { Logger } from '../core/logger/core.js'; import type { Logger } from '../core/logger/core.js';
import { appendForwardSlash } from '../core/path.js'; import { appendForwardSlash } from '../core/path.js';
import { createContentTypesGenerator } from './types-generator.js'; import { createContentTypesGenerator } from './types-generator.js';
import { getContentPaths, globalContentConfigObserver, type ContentPaths } from './utils.js'; import { type ContentPaths, getContentPaths, globalContentConfigObserver } from './utils.js';
interface ContentServerListenerParams { interface ContentServerListenerParams {
fs: typeof fsMod; fs: typeof fsMod;

View file

@ -1,9 +1,9 @@
import glob from 'fast-glob';
import { cyan } from 'kleur/colors';
import type fsMod from 'node:fs'; import type fsMod from 'node:fs';
import * as path from 'node:path'; import * as path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import { normalizePath, type ViteDevServer } from 'vite'; import glob from 'fast-glob';
import { cyan } from 'kleur/colors';
import { type ViteDevServer, normalizePath } from 'vite';
import type { AstroSettings, ContentEntryType } from '../@types/astro.js'; import type { AstroSettings, ContentEntryType } from '../@types/astro.js';
import { AstroError } from '../core/errors/errors.js'; import { AstroError } from '../core/errors/errors.js';
import { AstroErrorData } from '../core/errors/index.js'; import { AstroErrorData } from '../core/errors/index.js';
@ -11,6 +11,9 @@ import type { Logger } from '../core/logger/core.js';
import { isRelativePath } from '../core/path.js'; import { isRelativePath } from '../core/path.js';
import { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js'; import { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
import { import {
type ContentConfig,
type ContentObservable,
type ContentPaths,
getContentEntryIdAndSlug, getContentEntryIdAndSlug,
getContentPaths, getContentPaths,
getDataEntryExts, getDataEntryExts,
@ -20,9 +23,6 @@ import {
getEntrySlug, getEntrySlug,
getEntryType, getEntryType,
reloadContentConfigObserver, reloadContentConfigObserver,
type ContentConfig,
type ContentObservable,
type ContentPaths,
} from './utils.js'; } from './utils.js';
type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'; type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir';

View file

@ -1,10 +1,10 @@
import { slug as githubSlug } from 'github-slugger';
import matter from 'gray-matter';
import fsMod from 'node:fs'; import fsMod from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import { slug as githubSlug } from 'github-slugger';
import matter from 'gray-matter';
import type { PluginContext } from 'rollup'; import type { PluginContext } from 'rollup';
import { normalizePath, type ViteDevServer } from 'vite'; import { type ViteDevServer, normalizePath } from 'vite';
import { z } from 'zod'; import { z } from 'zod';
import type { import type {
AstroConfig, AstroConfig,
@ -326,7 +326,7 @@ export function parseFrontmatter(fileContents: string) {
*/ */
export const globalContentConfigObserver = contentObservable({ status: 'init' }); export const globalContentConfigObserver = contentObservable({ status: 'init' });
export function hasContentFlag(viteId: string, flag: (typeof CONTENT_FLAGS)[number]): boolean { export function hasContentFlag(viteId: string, flag: typeof CONTENT_FLAGS[number]): boolean {
const flags = new URLSearchParams(viteId.split('?')[1] ?? ''); const flags = new URLSearchParams(viteId.split('?')[1] ?? '');
return flags.has(flag); return flags.has(flag);
} }

View file

@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
import type { Plugin } from 'vite'; import type { Plugin } from 'vite';
import type { AstroSettings } from '../@types/astro.js'; import type { AstroSettings } from '../@types/astro.js';
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js'; import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
import { getPageDataByViteID, type BuildInternals } from '../core/build/internal.js'; import { type BuildInternals, getPageDataByViteID } from '../core/build/internal.js';
import type { AstroBuildPlugin } from '../core/build/plugin.js'; import type { AstroBuildPlugin } from '../core/build/plugin.js';
import type { StaticBuildOptions } from '../core/build/types.js'; import type { StaticBuildOptions } from '../core/build/types.js';
import type { ModuleLoader } from '../core/module-loader/loader.js'; import type { ModuleLoader } from '../core/module-loader/loader.js';

View file

@ -1,7 +1,7 @@
import * as devalue from 'devalue';
import type fsMod from 'node:fs'; import type fsMod from 'node:fs';
import { extname } from 'node:path'; import { extname } from 'node:path';
import { pathToFileURL } from 'node:url'; import { pathToFileURL } from 'node:url';
import * as devalue from 'devalue';
import type { PluginContext } from 'rollup'; import type { PluginContext } from 'rollup';
import type { Plugin } from 'vite'; import type { Plugin } from 'vite';
import type { import type {
@ -17,6 +17,7 @@ import { AstroErrorData } from '../core/errors/index.js';
import { escapeViteEnvReferences } from '../vite-plugin-utils/index.js'; import { escapeViteEnvReferences } from '../vite-plugin-utils/index.js';
import { CONTENT_FLAG, DATA_FLAG } from './consts.js'; import { CONTENT_FLAG, DATA_FLAG } from './consts.js';
import { import {
type ContentConfig,
getContentEntryExts, getContentEntryExts,
getContentEntryIdAndSlug, getContentEntryIdAndSlug,
getContentPaths, getContentPaths,
@ -30,7 +31,6 @@ import {
hasContentFlag, hasContentFlag,
parseEntrySlug, parseEntrySlug,
reloadContentConfigObserver, reloadContentConfigObserver,
type ContentConfig,
} from './utils.js'; } from './utils.js';
function getContentRendererByViteId( function getContentRendererByViteId(

View file

@ -1,7 +1,7 @@
import glob from 'fast-glob';
import fsMod from 'node:fs'; import fsMod from 'node:fs';
import { extname } from 'node:path'; import { extname } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import glob from 'fast-glob';
import pLimit from 'p-limit'; import pLimit from 'p-limit';
import type { Plugin } from 'vite'; import type { Plugin } from 'vite';
import type { AstroSettings, ContentEntryType } from '../@types/astro.js'; import type { AstroSettings, ContentEntryType } from '../@types/astro.js';
@ -10,6 +10,8 @@ import { appendForwardSlash } from '../core/path.js';
import { rootRelativePath } from '../core/util.js'; import { rootRelativePath } from '../core/util.js';
import { VIRTUAL_MODULE_ID } from './consts.js'; import { VIRTUAL_MODULE_ID } from './consts.js';
import { import {
type ContentLookupMap,
type ContentPaths,
getContentEntryIdAndSlug, getContentEntryIdAndSlug,
getContentPaths, getContentPaths,
getDataEntryExts, getDataEntryExts,
@ -19,8 +21,6 @@ import {
getEntrySlug, getEntrySlug,
getEntryType, getEntryType,
getExtGlob, getExtGlob,
type ContentLookupMap,
type ContentPaths,
} from './utils.js'; } from './utils.js';
interface AstroContentVirtualModPluginParams { interface AstroContentVirtualModPluginParams {

View file

@ -1,5 +1,5 @@
import { deserializeRouteData } from '../routing/manifest/serialization.js'; import { deserializeRouteData } from '../routing/manifest/serialization.js';
import type { RouteInfo, SerializedSSRManifest, SSRManifest } from './types.js'; import type { RouteInfo, SSRManifest, SerializedSSRManifest } from './types.js';
export function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest { export function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest {
const routes: RouteInfo[] = []; const routes: RouteInfo[] = [];

View file

@ -16,7 +16,7 @@ import {
removeTrailingForwardSlash, removeTrailingForwardSlash,
} from '../path.js'; } from '../path.js';
import { RedirectSinglePageBuiltModule } from '../redirects/index.js'; import { RedirectSinglePageBuiltModule } from '../redirects/index.js';
import { createEnvironment, createRenderContext, type RenderContext } from '../render/index.js'; import { type RenderContext, createEnvironment, createRenderContext } from '../render/index.js';
import { RouteCache } from '../render/route-cache.js'; import { RouteCache } from '../render/route-cache.js';
import { import {
createAssetLink, createAssetLink,

View file

@ -1,5 +1,5 @@
import type { RouteData } from '../../@types/astro.js'; import type { RouteData } from '../../@types/astro.js';
import type { SerializedSSRManifest, SSRManifest } from './types.js'; import type { SSRManifest, SerializedSSRManifest } from './types.js';
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import { IncomingMessage } from 'node:http'; import { IncomingMessage } from 'node:http';

View file

@ -1,9 +1,9 @@
import type { import type {
RouteData, RouteData,
SerializedRouteData,
SSRComponentMetadata, SSRComponentMetadata,
SSRLoadedRenderer, SSRLoadedRenderer,
SSRResult, SSRResult,
SerializedRouteData,
} from '../../@types/astro.js'; } from '../../@types/astro.js';
import type { SinglePageBuiltModule } from '../build/types.js'; import type { SinglePageBuiltModule } from '../build/types.js';

View file

@ -1,7 +1,7 @@
import * as colors from 'kleur/colors';
import { bgGreen, black, cyan, dim, green, magenta } from 'kleur/colors';
import fs from 'node:fs'; import fs from 'node:fs';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import * as colors from 'kleur/colors';
import { bgGreen, black, cyan, dim, green, magenta } from 'kleur/colors';
import type { OutputAsset, OutputChunk } from 'rollup'; import type { OutputAsset, OutputChunk } from 'rollup';
import type { BufferEncoding } from 'vfile'; import type { BufferEncoding } from 'vfile';
import type { import type {
@ -21,7 +21,7 @@ import {
generateImage as generateImageInternal, generateImage as generateImageInternal,
getStaticImageList, getStaticImageList,
} from '../../assets/build/generate.js'; } from '../../assets/build/generate.js';
import { hasPrerenderedPages, type BuildInternals } from '../../core/build/internal.js'; import { type BuildInternals, hasPrerenderedPages } from '../../core/build/internal.js';
import { import {
isRelativePath, isRelativePath,
joinPaths, joinPaths,

View file

@ -1,7 +1,7 @@
import * as colors from 'kleur/colors';
import fs from 'node:fs'; import fs from 'node:fs';
import { performance } from 'node:perf_hooks'; import { performance } from 'node:perf_hooks';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import * as colors from 'kleur/colors';
import type * as vite from 'vite'; import type * as vite from 'vite';
import type { import type {
AstroConfig, AstroConfig,

View file

@ -1,7 +1,7 @@
import * as crypto from 'node:crypto'; import * as crypto from 'node:crypto';
import * as npath from 'node:path'; import * as npath from 'node:path';
import type { GetModuleInfo } from 'rollup'; import type { GetModuleInfo } from 'rollup';
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite'; import { type Plugin as VitePlugin, type ResolvedConfig } from 'vite';
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js'; import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
import type { BuildInternals } from '../internal.js'; import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin.js'; import type { AstroBuildPlugin } from '../plugin.js';

View file

@ -1,5 +1,5 @@
import glob from 'fast-glob';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import glob from 'fast-glob';
import type { OutputChunk } from 'rollup'; import type { OutputChunk } from 'rollup';
import { type Plugin as VitePlugin } from 'vite'; import { type Plugin as VitePlugin } from 'vite';
import { runHookBuildSsr } from '../../../integrations/index.js'; import { runHookBuildSsr } from '../../../integrations/index.js';
@ -9,7 +9,7 @@ import { joinPaths, prependForwardSlash } from '../../path.js';
import { serializeRouteData } from '../../routing/index.js'; import { serializeRouteData } from '../../routing/index.js';
import { addRollupInput } from '../add-rollup-input.js'; import { addRollupInput } from '../add-rollup-input.js';
import { getOutFile, getOutFolder } from '../common.js'; import { getOutFile, getOutFolder } from '../common.js';
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js'; import { type BuildInternals, cssOrder, mergeInlineCss } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin.js'; import type { AstroBuildPlugin } from '../plugin.js';
import type { StaticBuildOptions } from '../types.js'; import type { StaticBuildOptions } from '../types.js';

View file

@ -1,16 +1,16 @@
import fs from 'node:fs';
import path, { extname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { teardown } from '@astrojs/compiler'; import { teardown } from '@astrojs/compiler';
import * as eslexer from 'es-module-lexer'; import * as eslexer from 'es-module-lexer';
import glob from 'fast-glob'; import glob from 'fast-glob';
import { bgGreen, bgMagenta, black, dim } from 'kleur/colors'; import { bgGreen, bgMagenta, black, dim } from 'kleur/colors';
import fs from 'node:fs';
import path, { extname } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as vite from 'vite'; import * as vite from 'vite';
import type { RouteData } from '../../@types/astro.js'; import type { RouteData } from '../../@types/astro.js';
import { import {
type BuildInternals,
createBuildInternals, createBuildInternals,
eachPageData, eachPageData,
type BuildInternals,
} from '../../core/build/internal.js'; } from '../../core/build/internal.js';
import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js'; import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js';
import { appendForwardSlash, prependForwardSlash } from '../../core/path.js'; import { appendForwardSlash, prependForwardSlash } from '../../core/path.js';
@ -23,7 +23,7 @@ import { routeIsRedirect } from '../redirects/index.js';
import { getOutDirWithinCwd } from './common.js'; import { getOutDirWithinCwd } from './common.js';
import { generatePages } from './generate.js'; import { generatePages } from './generate.js';
import { trackPageData } from './internal.js'; import { trackPageData } from './internal.js';
import { createPluginContainer, type AstroBuildPluginContainer } from './plugin.js'; import { type AstroBuildPluginContainer, createPluginContainer } from './plugin.js';
import { registerAllPlugins } from './plugins/index.js'; import { registerAllPlugins } from './plugins/index.js';
import { RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugins/plugin-manifest.js'; import { RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugins/plugin-manifest.js';
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js'; import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';

View file

@ -1,5 +1,5 @@
import type { AstroConfig } from '../../@types/astro.js'; import type { AstroConfig } from '../../@types/astro.js';
import { compile, type CompileProps, type CompileResult } from './compile.js'; import { type CompileProps, type CompileResult, compile } from './compile.js';
type CompilationCache = Map<string, CompileResult>; type CompilationCache = Map<string, CompileResult>;

View file

@ -2,8 +2,8 @@ import type { TransformResult } from '@astrojs/compiler';
import type { ResolvedConfig } from 'vite'; import type { ResolvedConfig } from 'vite';
import type { AstroConfig } from '../../@types/astro.js'; import type { AstroConfig } from '../../@types/astro.js';
import { transform } from '@astrojs/compiler';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { transform } from '@astrojs/compiler';
import { normalizePath } from 'vite'; import { normalizePath } from 'vite';
import { AggregateError, AstroError, CompilerError } from '../errors/errors.js'; import { AggregateError, AstroError, CompilerError } from '../errors/errors.js';
import { AstroErrorData } from '../errors/index.js'; import { AstroErrorData } from '../errors/index.js';

View file

@ -1,6 +1,6 @@
import type { TransformOptions } from '@astrojs/compiler';
import fs from 'node:fs'; import fs from 'node:fs';
import { preprocessCSS, type ResolvedConfig } from 'vite'; import type { TransformOptions } from '@astrojs/compiler';
import { type ResolvedConfig, preprocessCSS } from 'vite';
import { AstroErrorData, CSSError, positionAt } from '../errors/index.js'; import { AstroErrorData, CSSError, positionAt } from '../errors/index.js';
export function createStylePreprocessor({ export function createStylePreprocessor({

View file

@ -7,10 +7,10 @@ import type {
CLIFlags, CLIFlags,
} from '../../@types/astro.js'; } from '../../@types/astro.js';
import * as colors from 'kleur/colors';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import * as colors from 'kleur/colors';
import { ZodError } from 'zod'; import { ZodError } from 'zod';
import { eventConfigError, telemetry } from '../../events/index.js'; import { eventConfigError, telemetry } from '../../events/index.js';
import { trackAstroConfigZodError } from '../errors/errors.js'; import { trackAstroConfigZodError } from '../errors/errors.js';

View file

@ -1,6 +1,6 @@
import yaml from 'js-yaml';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url'; import { fileURLToPath, pathToFileURL } from 'node:url';
import yaml from 'js-yaml';
import type { AstroConfig, AstroSettings } from '../../@types/astro.js'; import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
import { getContentPaths } from '../../content/index.js'; import { getContentPaths } from '../../content/index.js';
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js'; import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';

View file

@ -1,6 +1,6 @@
import type fsType from 'node:fs'; import type fsType from 'node:fs';
import { pathToFileURL } from 'node:url'; import { pathToFileURL } from 'node:url';
import { createServer, type ViteDevServer } from 'vite'; import { type ViteDevServer, createServer } from 'vite';
import loadFallbackPlugin from '../../vite-plugin-load-fallback/index.js'; import loadFallbackPlugin from '../../vite-plugin-load-fallback/index.js';
import { debug } from '../logger/core.js'; import { debug } from '../logger/core.js';

View file

@ -1,5 +1,5 @@
import type { EndpointHandler } from '../../../@types/astro.js'; import type { EndpointHandler } from '../../../@types/astro.js';
import { createRenderContext, type SSROptions } from '../../render/index.js'; import { type SSROptions, createRenderContext } from '../../render/index.js';
import { callEndpoint } from '../index.js'; import { callEndpoint } from '../index.js';
export async function call(options: SSROptions) { export async function call(options: SSROptions) {

View file

@ -204,7 +204,9 @@ export async function callEndpoint<MiddlewareResult = Response | EndpointOutput>
? // Try the static route `pathname` ? // Try the static route `pathname`
ctx.route.pathname ?? ctx.route.pathname ??
// Dynamic routes don't include `pathname`, so synthesize a path for these (e.g. 'src/pages/[slug].svg') // Dynamic routes don't include `pathname`, so synthesize a path for these (e.g. 'src/pages/[slug].svg')
ctx.route.segments.map((s) => s.map((p) => p.content).join('')).join('/') ctx.route.segments
.map((s) => s.map((p) => p.content).join(''))
.join('/')
: // Fallback to pathname of the request : // Fallback to pathname of the request
ctx.pathname; ctx.pathname;
const mimeType = mime.getType(pathname) || 'text/plain'; const mimeType = mime.getType(pathname) || 'text/plain';

View file

@ -1,8 +1,8 @@
import { escape } from 'html-escaper';
import { bold, underline } from 'kleur/colors';
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import { isAbsolute, join } from 'node:path'; import { isAbsolute, join } from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { escape } from 'html-escaper';
import { bold, underline } from 'kleur/colors';
import stripAnsi from 'strip-ansi'; import stripAnsi from 'strip-ansi';
import type { ESBuildTransformResult } from 'vite'; import type { ESBuildTransformResult } from 'vite';
import { normalizePath } from 'vite'; import { normalizePath } from 'vite';
@ -165,7 +165,9 @@ function collectInfoFromStacktrace(error: SSRError & { stack: string }): StackIn
error.pluginCode || error.pluginCode ||
error.id || error.id ||
// TODO: this could be better, `src` might be something else // TODO: this could be better, `src` might be something else
stackText.split('\n').find((ln) => ln.includes('src') || ln.includes('node_modules')); stackText
.split('\n')
.find((ln) => ln.includes('src') || ln.includes('node_modules'));
const source = possibleFilePath?.replace(/^[^(]+\(([^)]+).*$/, '$1').replace(/^\s+at\s+/, ''); const source = possibleFilePath?.replace(/^[^(]+\(([^)]+).*$/, '$1').replace(/^\s+at\s+/, '');
let file = source?.replace(/(:[0-9]+)/g, ''); let file = source?.replace(/(:[0-9]+)/g, '');

View file

@ -167,9 +167,7 @@ export const NoMatchingRenderer = {
${ ${
validRenderersCount > 0 validRenderersCount > 0
? `There ${plural ? 'are' : 'is'} ${validRenderersCount} renderer${ ? `There ${plural ? 'are' : 'is'} ${validRenderersCount} renderer${plural ? 's' : ''} configured in your \`astro.config.mjs\` file,
plural ? 's' : ''
} configured in your \`astro.config.mjs\` file,
but ${plural ? 'none were' : 'it was not'} able to server-side render \`${componentName}\`.` but ${plural ? 'none were' : 'it was not'} able to server-side render \`${componentName}\`.`
: `No valid renderer was found ${ : `No valid renderer was found ${
componentExtension componentExtension

View file

@ -1,7 +1,7 @@
import debugPackage from 'debug';
import { bold, cyan, dim, red, reset, yellow } from 'kleur/colors';
import * as readline from 'node:readline'; import * as readline from 'node:readline';
import { Writable } from 'node:stream'; import { Writable } from 'node:stream';
import debugPackage from 'debug';
import { bold, cyan, dim, red, reset, yellow } from 'kleur/colors';
import stringWidth from 'string-width'; import stringWidth from 'string-width';
import { dateTimeFormat, error, info, warn } from './core.js'; import { dateTimeFormat, error, info, warn } from './core.js';

View file

@ -2,7 +2,7 @@ import type http from 'node:http';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { performance } from 'perf_hooks'; import { performance } from 'perf_hooks';
import enableDestroy from 'server-destroy'; import enableDestroy from 'server-destroy';
import { preview, type PreviewServer as VitePreviewServer } from 'vite'; import { type PreviewServer as VitePreviewServer, preview } from 'vite';
import type { AstroSettings } from '../../@types/astro.js'; import type { AstroSettings } from '../../@types/astro.js';
import type { Logger } from '../logger/core.js'; import type { Logger } from '../logger/core.js';
import * as msg from '../messages.js'; import * as msg from '../messages.js';

View file

@ -6,7 +6,7 @@ import type {
SSRLoadedRenderer, SSRLoadedRenderer,
SSRResult, SSRResult,
} from '../../@types/astro.js'; } from '../../@types/astro.js';
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js'; import { type ComponentSlots, renderSlotToString } from '../../runtime/server/index.js';
import { renderJSX } from '../../runtime/server/jsx.js'; import { renderJSX } from '../../runtime/server/jsx.js';
import { chunkToString } from '../../runtime/server/render/index.js'; import { chunkToString } from '../../runtime/server/render/index.js';
import { AstroCookies } from '../cookies/index.js'; import { AstroCookies } from '../cookies/index.js';

View file

@ -1,8 +1,8 @@
import { dim } from 'kleur/colors';
import fsMod from 'node:fs'; import fsMod from 'node:fs';
import { performance } from 'node:perf_hooks'; import { performance } from 'node:perf_hooks';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { createServer, type HMRPayload } from 'vite'; import { dim } from 'kleur/colors';
import { type HMRPayload, createServer } from 'vite';
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js'; import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
import { createContentTypesGenerator } from '../../content/index.js'; import { createContentTypesGenerator } from '../../content/index.js';
import { globalContentConfigObserver } from '../../content/utils.js'; import { globalContentConfigObserver } from '../../content/utils.js';

View file

@ -101,11 +101,7 @@ function getSafeErrorMessage(message: string | Function): string {
.slice(1, -1) .slice(1, -1)
.replace( .replace(
/\${([^}]+)}/gm, /\${([^}]+)}/gm,
(str, match1) => (str, match1) => `${match1.split(/\.?(?=[A-Z])/).join('_').toUpperCase()}`
`${match1
.split(/\.?(?=[A-Z])/)
.join('_')
.toUpperCase()}`
) )
.replace(/\\`/g, '`'); .replace(/\\`/g, '`');
} }

View file

@ -1,7 +1,7 @@
import { bold } from 'kleur/colors';
import fs from 'node:fs'; import fs from 'node:fs';
import type { AddressInfo } from 'node:net'; import type { AddressInfo } from 'node:net';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { bold } from 'kleur/colors';
import type { InlineConfig, ViteDevServer } from 'vite'; import type { InlineConfig, ViteDevServer } from 'vite';
import type { import type {
AstroAdapter, AstroAdapter,

View file

@ -1,4 +1,4 @@
import { Fragment, markHTMLString, Renderer } from '../runtime/server/index.js'; import { Fragment, Renderer, markHTMLString } from '../runtime/server/index.js';
const AstroJSX = 'astro:jsx'; const AstroJSX = 'astro:jsx';
const Empty = Symbol('empty'); const Empty = Symbol('empty');

View file

@ -41,7 +41,7 @@ export type {
export { createTransitionScope, renderTransition } from './transition.js'; export { createTransitionScope, renderTransition } from './transition.js';
import { markHTMLString } from './escape.js'; import { markHTMLString } from './escape.js';
import { addAttribute, Renderer } from './render/index.js'; import { Renderer, addAttribute } from './render/index.js';
export function mergeSlots(...slotted: unknown[]) { export function mergeSlots(...slotted: unknown[]) {
const slots: Record<string, () => any> = {}; const slots: Record<string, () => any> = {};

View file

@ -1,6 +1,6 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import type { SSRResult } from '../../@types/astro.js'; import type { SSRResult } from '../../@types/astro.js';
import { AstroJSX, isVNode, type AstroVNode } from '../../jsx-runtime/index.js'; import { AstroJSX, type AstroVNode, isVNode } from '../../jsx-runtime/index.js';
import { import {
HTMLString, HTMLString,
escapeHTML, escapeHTML,

View file

@ -1,6 +1,6 @@
import { escapeHTML, isHTMLString, markHTMLString } from '../escape.js'; import { escapeHTML, isHTMLString, markHTMLString } from '../escape.js';
import { isAstroComponentInstance, isRenderTemplateResult } from './astro/index.js'; import { isAstroComponentInstance, isRenderTemplateResult } from './astro/index.js';
import { isRenderInstance, type RenderDestination } from './common.js'; import { type RenderDestination, isRenderInstance } from './common.js';
import { SlotString } from './slot.js'; import { SlotString } from './slot.js';
import { renderToBufferDestination } from './util.js'; import { renderToBufferDestination } from './util.js';

View file

@ -1,6 +1,6 @@
import type { RouteData, SSRResult } from '../../../../@types/astro.js'; import type { RouteData, SSRResult } from '../../../../@types/astro.js';
import { AstroError, AstroErrorData } from '../../../../core/errors/index.js'; import { AstroError, AstroErrorData } from '../../../../core/errors/index.js';
import { chunkToByteArray, chunkToString, encoder, type RenderDestination } from '../common.js'; import { type RenderDestination, chunkToByteArray, chunkToString, encoder } from '../common.js';
import type { AstroComponentFactory } from './factory.js'; import type { AstroComponentFactory } from './factory.js';
import { isHeadAndContent } from './head-and-content.js'; import { isHeadAndContent } from './head-and-content.js';
import { isRenderTemplateResult } from './render-template.js'; import { isRenderTemplateResult } from './render-template.js';

View file

@ -3,14 +3,14 @@ import type { RenderInstruction } from './instruction.js';
import { HTMLBytes, HTMLString, markHTMLString } from '../escape.js'; import { HTMLBytes, HTMLString, markHTMLString } from '../escape.js';
import { import {
type PrescriptType,
determineIfNeedsHydrationScript, determineIfNeedsHydrationScript,
determinesIfNeedsDirectiveScript, determinesIfNeedsDirectiveScript,
getPrescripts, getPrescripts,
type PrescriptType,
} from '../scripts.js'; } from '../scripts.js';
import { renderAllHeadContent } from './head.js'; import { renderAllHeadContent } from './head.js';
import { isRenderInstruction } from './instruction.js'; import { isRenderInstruction } from './instruction.js';
import { isSlotString, type SlotString } from './slot.js'; import { type SlotString, isSlotString } from './slot.js';
/** /**
* Possible chunk types to be written to the destination, and it'll * Possible chunk types to be written to the destination, and it'll

View file

@ -4,7 +4,7 @@ import type {
SSRLoadedRenderer, SSRLoadedRenderer,
SSRResult, SSRResult,
} from '../../../@types/astro.js'; } from '../../../@types/astro.js';
import { createRenderInstruction, type RenderInstruction } from './instruction.js'; import { type RenderInstruction, createRenderInstruction } from './instruction.js';
import { clsx } from 'clsx'; import { clsx } from 'clsx';
import { AstroError, AstroErrorData } from '../../../core/errors/index.js'; import { AstroError, AstroErrorData } from '../../../core/errors/index.js';
@ -14,21 +14,21 @@ import { serializeProps } from '../serialize.js';
import { shorthash } from '../shorthash.js'; import { shorthash } from '../shorthash.js';
import { isPromise } from '../util.js'; import { isPromise } from '../util.js';
import { import {
type AstroComponentFactory,
createAstroComponentInstance, createAstroComponentInstance,
isAstroComponentFactory, isAstroComponentFactory,
renderTemplate, renderTemplate,
type AstroComponentFactory,
} from './astro/index.js'; } from './astro/index.js';
import { import {
Fragment, Fragment,
Renderer,
chunkToString,
type RenderDestination, type RenderDestination,
type RenderInstance, type RenderInstance,
Renderer,
chunkToString,
} from './common.js'; } from './common.js';
import { componentIsHTMLElement, renderHTMLElement } from './dom.js'; import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
import { maybeRenderHead } from './head.js'; import { maybeRenderHead } from './head.js';
import { renderSlotToString, renderSlots, type ComponentSlots } from './slot.js'; import { type ComponentSlots, renderSlotToString, renderSlots } from './slot.js';
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js'; import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';
const needsHeadRenderingSymbol = Symbol.for('astro.needsHeadRendering'); const needsHeadRenderingSymbol = Symbol.for('astro.needsHeadRendering');

View file

@ -1,5 +1,5 @@
import type { RouteData, SSRResult } from '../../../@types/astro.js'; import type { RouteData, SSRResult } from '../../../@types/astro.js';
import { renderComponentToString, type NonAstroPageComponent } from './component.js'; import { type NonAstroPageComponent, renderComponentToString } from './component.js';
import type { AstroComponentFactory } from './index.js'; import type { AstroComponentFactory } from './index.js';
import { isAstroComponentFactory } from './astro/index.js'; import { isAstroComponentFactory } from './astro/index.js';

View file

@ -4,7 +4,7 @@ import type { RenderInstruction } from './instruction.js';
import { HTMLString, markHTMLString } from '../escape.js'; import { HTMLString, markHTMLString } from '../escape.js';
import { renderChild } from './any.js'; import { renderChild } from './any.js';
import { chunkToString, type RenderDestination, type RenderInstance } from './common.js'; import { type RenderDestination, type RenderInstance, chunkToString } from './common.js';
type RenderTemplateResult = ReturnType<typeof renderTemplate>; type RenderTemplateResult = ReturnType<typeof renderTemplate>;
export type ComponentSlots = Record<string, ComponentSlotValue>; export type ComponentSlots = Record<string, ComponentSlotValue>;

View file

@ -50,7 +50,7 @@ export function renderTransition(
if (animations) { if (animations) {
for (const [direction, images] of Object.entries(animations) as Entries<typeof animations>) { for (const [direction, images] of Object.entries(animations) as Entries<typeof animations>) {
for (const [image, rules] of Object.entries(images) as Entries< for (const [image, rules] of Object.entries(images) as Entries<
(typeof animations)[typeof direction] typeof animations[typeof direction]
>) { >) {
sheet.addAnimationPair(direction, image, rules); sheet.addAnimationPair(direction, image, rules);
} }
@ -69,10 +69,7 @@ class ViewTransitionStyleSheet {
private modern: string[] = []; private modern: string[] = [];
private fallback: string[] = []; private fallback: string[] = [];
constructor( constructor(private scope: string, private name: string) {}
private scope: string,
private name: string
) {}
toString() { toString() {
const { scope, name } = this; const { scope, name } = this;

View file

@ -12,9 +12,8 @@ export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
// Name is pretty self descriptive, but it removes the index signature of an object // Name is pretty self descriptive, but it removes the index signature of an object
export type OmitIndexSignature<ObjectType> = { export type OmitIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> [KeyType in
? never keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
: KeyType]: ObjectType[KeyType];
}; };
// Transform a string into its kebab case equivalent (camelCase -> kebab-case). Useful for CSS-in-JS to CSS. // Transform a string into its kebab case equivalent (camelCase -> kebab-case). Useful for CSS-in-JS to CSS.

Some files were not shown because too many files have changed in this diff Show more