Skip to content

Commit

Permalink
Merge branch 'main' into back-to-shiki
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Feb 28, 2024
2 parents e4f6139 + 9b00de0 commit 62fef91
Show file tree
Hide file tree
Showing 196 changed files with 458 additions and 444 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-shrimps-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes an issue where `transition:animate="none"` still allowed the browser-native morph animation.
5 changes: 5 additions & 0 deletions .changeset/gold-baboons-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/svelte": minor
---

Adds TypeScript as a required peer dependency as it is required for Svelte's editor tooling to work correctly.
5 changes: 5 additions & 0 deletions .changeset/tall-papayas-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Improves the message of `MiddlewareCantBeLoaded` for clarity
5 changes: 5 additions & 0 deletions .changeset/wicked-houses-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes TypeScript type definitions for `Code` component `theme` and `experimentalThemes` props
2 changes: 1 addition & 1 deletion benchmark/packages/timer/src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CreatePreviewServer } from 'astro';
import { createServer } from 'node:http';
import type { CreatePreviewServer } from 'astro';
import enableDestroy from 'server-destroy';

const preview: CreatePreviewServer = async function ({ serverEntrypoint, host, port }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/packages/timer/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import type { IncomingMessage, ServerResponse } from 'node:http';

applyPolyfills();

Expand Down
4 changes: 2 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"files": {
"include": ["test/**", "e2e/**"],
"ignore": ["vendor"]
"include": ["test/**", "e2e/**", "packages/**"],
"ignore": ["vendor", "dist/**"]
},
"organizeImports": {
"enabled": true
Expand Down
7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@
}
}
},
"svelte2tsx": {
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"rehype-pretty-code": {
"peerDependenciesMeta": {
"shiki": {
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/components/Code.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import type { ThemePresets } from '@astrojs/markdown-remark';
import type {
BuiltinLanguage,
BuiltinTheme,
LanguageRegistration,
SpecialLanguage,
ThemeRegistration,
Expand All @@ -28,12 +28,12 @@ interface Props {
*
* @default "github-dark"
*/
theme?: BuiltinTheme | ThemeRegistration | ThemeRegistrationRaw;
theme?: ThemePresets | ThemeRegistration | ThemeRegistrationRaw;
/**
* Multiple themes to style with -- alternative to "theme" option.
* Supports all themes found above; see https://shiki.style/guide/dual-themes for more information.
*/
themes?: Record<string, BuiltinTheme | ThemeRegistration | ThemeRegistrationRaw>;
themes?: Record<string, ThemePresets | ThemeRegistration | ThemeRegistrationRaw>;
/**
* Enable word wrapping.
* - true: enabled.
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/performance/content-benchmark.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-console */

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 { 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.
// This includes heading ID generation, syntax highlighting, GFM, and Smartypants.
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/performance/fixtures/md/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'astro/config';
import react from "@astrojs/react";
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/performance/fixtures/mdoc/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import markdoc from "@astrojs/markdoc";
import react from "@astrojs/react";
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/performance/fixtures/mdx/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'astro/config';
import mdx from "@astrojs/mdx";
import react from "@astrojs/react";
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { OutgoingHttpHeaders } from 'node:http';
import type { AddressInfo } from 'node:net';
import type {
MarkdownHeading,
MarkdownMetadata,
Expand All @@ -8,8 +10,6 @@ import type {
ShikiConfig,
} from '@astrojs/markdown-remark';
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 vite from 'vite';
import type { RemotePattern } from '../assets/utils/remotePattern.js';
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/assets/build/generate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { dim, green } from 'kleur/colors';
import fs, { readFileSync } from 'node:fs';
import { basename, join } from 'node:path/posix';
import { dim, green } from 'kleur/colors';
import type PQueue from 'p-queue';
import type { AstroConfig } from '../../@types/astro.js';
import type { BuildPipeline } from '../../core/build/pipeline.js';
import { getOutDirWithinCwd } from '../../core/build/common.js';
import type { BuildPipeline } from '../../core/build/pipeline.js';
import { getTimeStat } from '../../core/build/util.js';
import { AstroError } from '../../core/errors/errors.js';
import { AstroErrorData } from '../../core/errors/index.js';
Expand All @@ -16,7 +16,7 @@ import { getConfiguredImageService } from '../internal.js';
import type { LocalImageService } from '../services/service.js';
import type { AssetsGlobalStaticImagesList, ImageMetadata, ImageTransform } from '../types.js';
import { isESMImportedImage } from '../utils/imageKind.js';
import { loadRemoteImage, type RemoteCacheEntry } from './remote.js';
import { type RemoteCacheEntry, loadRemoteImage } from './remote.js';

interface GenerationDataUncached {
cached: false;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/endpoint/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import mime from 'mime/lite.js';
import type { APIRoute } from '../../@types/astro.js';
import { getConfiguredImageService } from '../internal.js';
import { etag } from '../utils/etag.js';
import { isRemoteAllowed } from '../utils/remotePattern.js';
// @ts-expect-error
import { imageConfig } from 'astro:assets';
import { isRemoteAllowed } from '../utils/remotePattern.js';

async function loadRemoteImage(src: URL) {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/endpoint/node.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import os from 'os';
import { isRemotePath, removeQueryString } from '@astrojs/internal-helpers/path';
import { readFile } from 'fs/promises';
import mime from 'mime/lite.js';
import os from 'os';
import type { APIRoute } from '../../@types/astro.js';
import { getConfiguredImageService } from '../internal.js';
import { etag } from '../utils/etag.js';
import { isRemoteAllowed } from '../utils/remotePattern.js';
// @ts-expect-error
import { assetsDir, imageConfig } from 'astro:assets';
import { isRemoteAllowed } from '../utils/remotePattern.js';

function replaceFileSystemReferences(src: string) {
return os.platform().includes('win32') ? src.replace(/^\/@fs\//, '') : src.replace(/^\/@fs/, '');
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/internal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AstroConfig } from '../@types/astro.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { DEFAULT_HASH_PROPS } from './consts.js';
import { isLocalService, type ImageService } from './services/service.js';
import { type ImageService, isLocalService } from './services/service.js';
import type {
GetImageResult,
ImageTransform,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/services/noop.ts
Original file line number Diff line number Diff line change
@@ -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.
const noopService: LocalImageService = {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/services/sharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type { FormatEnum, SharpOptions } from 'sharp';
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import {
baseService,
parseQuality,
type BaseServiceTransform,
type LocalImageService,
baseService,
parseQuality,
} from './service.js';

export interface SharpImageServiceConfig {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/services/squoosh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import { imageMetadata } from '../utils/metadata.js';
import {
baseService,
parseQuality,
type BaseServiceTransform,
type LocalImageService,
baseService,
parseQuality,
} from './service.js';
import { processBuffer } from './vendor/squoosh/image-pool.js';
import type { Operation } from './vendor/squoosh/image.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/utils/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type { ImageInputFormat, ImageMetadata } from '../types.js';
import { lookup as probe } from '../utils/vendor/image-size/lookup.js';

export async function imageMetadata(
data: Uint8Array,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/utils/transformToPath.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deterministicString } from 'deterministic-object-hash';
import { basename, extname } from 'node:path';
import { deterministicString } from 'deterministic-object-hash';
import { removeQueryString } from '../../core/path.js';
import { shorthash } from '../../runtime/server/shorthash.js';
import type { ImageTransform } from '../types.js';
Expand Down
10 changes: 5 additions & 5 deletions packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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 { diffWords } from 'diff';
import { execa } from 'execa';
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 maxSatisfying from 'semver/ranges/max-satisfying.js';
import ora from 'ora';
import preferredPM from 'preferred-pm';
import prompts from 'prompts';
import maxSatisfying from 'semver/ranges/max-satisfying.js';
import type yargs from 'yargs-parser';
import {
loadTSConfig,
Expand All @@ -18,9 +18,9 @@ import {
} from '../../core/config/index.js';
import {
defaultTSConfig,
type frameworkWithTSSettings,
presets,
updateTSConfigForFramework,
type frameworkWithTSSettings,
} from '../../core/config/tsconfig.js';
import type { Logger } from '../../core/logger/core.js';
import * as msg from '../../core/messages.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/cli/check/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import type { Arguments } from 'yargs-parser';
import { ensureProcessNodeEnv } from '../../core/util.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';
import { ensureProcessNodeEnv } from '../../core/util.js';

export async function check(flags: Arguments) {
ensureProcessNodeEnv('production');
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Arguments } from 'yargs-parser';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';
import { resolveConfig } from '../../core/config/config.js';
import type { AstroConfig } from '../../@types/astro.js';
import { resolveConfig } from '../../core/config/config.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';

type DBPackage = {
cli: (args: { flags: Arguments; config: AstroConfig }) => unknown;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/cli/flags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Arguments as Flags } from 'yargs-parser';
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';

export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig {
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/info/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-disable no-console */
import * as colors from 'kleur/colors';
import { execSync } from 'node:child_process';
import { arch, platform } from 'node:os';
/* eslint-disable no-console */
import * as colors from 'kleur/colors';
import prompts from 'prompts';
import type yargs from 'yargs-parser';
import type { AstroConfig, AstroUserConfig } from '../../@types/astro.js';
import { resolveConfig } from '../../core/config/index.js';
import { ASTRO_VERSION } from '../../core/constants.js';
import { flagsToAstroInlineConfig } from '../flags.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { flagsToAstroInlineConfig } from '../flags.js';

interface InfoOptions {
flags: yargs.Arguments;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/cli/install-package.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { createRequire } from 'node:module';
import { sep } from 'node:path';
import boxen from 'boxen';
import { execa } from 'execa';
import { bold, cyan, dim, magenta } from 'kleur/colors';
Expand All @@ -6,8 +8,6 @@ import prompts from 'prompts';
import resolvePackage from 'resolve';
import whichPm from 'which-pm';
import { type Logger } from '../core/logger/core.js';
import { createRequire } from 'node:module';
import { sep } from 'node:path';
const require = createRequire(import.meta.url);

type GetPackageOptions = {
Expand Down
14 changes: 7 additions & 7 deletions packages/astro/src/cli/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
import type yargs from 'yargs-parser';
import type { AstroSettings } from '../../@types/astro.js';

import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';
import { fileURLToPath } from 'node:url';
import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';

import { formatWithOptions } from 'node:util';
import dlv from 'dlv';
// @ts-expect-error flattie types are mispackaged
import { flattie } from 'flattie';
import { resolveConfig } from '../../core/config/config.js';
import { createSettings } from '../../core/config/settings.js';
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
import * as msg from '../../core/messages.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';
import { DEFAULT_PREFERENCES } from '../../preferences/defaults.js';
import { coerce, isValidKey, type PreferenceKey } from '../../preferences/index.js';
import { type PreferenceKey, coerce, isValidKey } from '../../preferences/index.js';
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
// @ts-expect-error flattie types are mispackaged
import { flattie } from 'flattie';
import { formatWithOptions } from 'node:util';
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
import { apply as applyPolyfill } from '../../core/polyfill.js';

interface PreferencesOptions {
flags: yargs.Arguments;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { ZodIssueCode, string as zodString } from 'zod';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import { prependForwardSlash } from '../core/path.js';
import {
type AstroComponentFactory,
createComponent,
createHeadAndContent,
renderComponent,
renderScriptElement,
renderTemplate,
renderUniqueStylesheet,
unescapeHTML,
type AstroComponentFactory,
} from '../runtime/server/index.js';
import type { ContentLookupMap } from './utils.js';

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/server-listeners.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { bold, cyan, underline } from 'kleur/colors';
import type fsMod from 'node:fs';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { bold, cyan, underline } from 'kleur/colors';
import type { ViteDevServer } from 'vite';
import type { AstroSettings } from '../@types/astro.js';
import { loadTSConfig } from '../core/config/tsconfig.js';
import type { Logger } from '../core/logger/core.js';
import { appendForwardSlash } from '../core/path.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 {
fs: typeof fsMod;
Expand Down
Loading

0 comments on commit 62fef91

Please sign in to comment.