>;
+/**
+ * All the CSS properties available, as defined by the CSS specification
+ */
+export type CSSProperty = keyof astroHTML.JSX.KebabCSSDOMProperties;
+
type PolymorphicAttributes = Omit
, 'as'> & {
as?: P['as'];
};
diff --git a/packages/create-astro/README.md b/packages/create-astro/README.md
index 5341d60f02e5..ba406d942698 100644
--- a/packages/create-astro/README.md
+++ b/packages/create-astro/README.md
@@ -14,17 +14,23 @@ npm create astro@latest
yarn create astro
```
-`create-astro` automatically runs in _interactive_ mode, but you can also specify your project name and template with command line arguments.
+**With PNPM:**
```bash
-# npm 6.x
-npm create astro@latest my-astro-project --template minimal
+pnpm create astro
+```
+
+`create-astro` automatically runs in _interactive_ mode, but you can also specify your project name and template with command line arguments.
-# npm 7+, extra double-dash is needed:
+```bash
+# npm
npm create astro@latest my-astro-project -- --template minimal
# yarn
yarn create astro my-astro-project --template minimal
+
+# pnpm
+pnpm create astro my-astro-project --template minimal
```
[Check out the full list][examples] of example templates, available on GitHub.
diff --git a/packages/create-astro/create-astro.mjs b/packages/create-astro/create-astro.mjs
index b7489a6b173d..f9df779d871c 100755
--- a/packages/create-astro/create-astro.mjs
+++ b/packages/create-astro/create-astro.mjs
@@ -4,7 +4,7 @@
const currentVersion = process.versions.node;
const requiredMajorVersion = parseInt(currentVersion.split('.')[0], 10);
-const minimumMajorVersion = 14;
+const minimumMajorVersion = 18;
if (requiredMajorVersion < minimumMajorVersion) {
console.error(`Node.js v${currentVersion} is out of date and unsupported!`);
diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json
index 0eb08cdc755c..7a341d125f4e 100644
--- a/packages/create-astro/package.json
+++ b/packages/create-astro/package.json
@@ -31,14 +31,10 @@
"//a": "MOST PACKAGES SHOULD GO IN DEV_DEPENDENCIES! THEY WILL BE BUNDLED.",
"//b": "DEPENDENCIES IS FOR UNBUNDLED PACKAGES",
"dependencies": {
- "@astrojs/cli-kit": "^0.2.3",
- "execa": "^8.0.1",
- "giget": "1.1.2",
- "node-fetch-native": "^1.4.0",
- "which-pm-runs": "^1.1.0"
+ "@astrojs/cli-kit": "^0.3.0",
+ "giget": "1.1.2"
},
"devDependencies": {
- "@types/which-pm-runs": "^1.0.0",
"arg": "^5.0.2",
"astro-scripts": "workspace:*",
"chai": "^4.3.7",
diff --git a/packages/create-astro/src/actions/context.ts b/packages/create-astro/src/actions/context.ts
index c91a0caae48c..ae720a1b3cd6 100644
--- a/packages/create-astro/src/actions/context.ts
+++ b/packages/create-astro/src/actions/context.ts
@@ -1,7 +1,7 @@
import { prompt } from '@astrojs/cli-kit';
+import { random } from '@astrojs/cli-kit/utils';
import arg from 'arg';
import os from 'node:os';
-import detectPackageManager from 'which-pm-runs';
import { getName, getVersion } from '../messages.js';
@@ -10,8 +10,8 @@ export interface Context {
prompt: typeof prompt;
cwd: string;
packageManager: string;
- username: string;
- version: string;
+ username: Promise;
+ version: Promise;
skipHouston: boolean;
fancy?: boolean;
dryRun?: boolean;
@@ -25,6 +25,7 @@ export interface Context {
stdin?: typeof process.stdin;
stdout?: typeof process.stdout;
exit(code: number): never;
+ hat?: string;
}
export async function getContext(argv: string[]): Promise {
@@ -51,8 +52,7 @@ export async function getContext(argv: string[]): Promise {
{ argv, permissive: true }
);
- const packageManager = detectPackageManager()?.name ?? 'npm';
- const [username, version] = await Promise.all([getName(), getVersion()]);
+ const packageManager = detectPackageManager() ?? 'npm';
let cwd = flags['_'][0];
let {
'--help': help = false,
@@ -86,14 +86,15 @@ export async function getContext(argv: string[]): Promise {
help,
prompt,
packageManager,
- username,
- version,
+ username: getName(),
+ version: getVersion(packageManager),
skipHouston,
fancy,
dryRun,
projectName,
template,
ref: ref ?? 'latest',
+ hat: fancy ? random(['🎩', '🎩', '🎩', '🎩', '🎓', '👑', '🧢', '🍦']) : undefined,
yes,
install: install ?? (noInstall ? false : undefined),
git: git ?? (noGit ? false : undefined),
@@ -105,3 +106,10 @@ export async function getContext(argv: string[]): Promise {
};
return context;
}
+
+function detectPackageManager() {
+ if (!process.env.npm_config_user_agent) return;
+ const specifier = process.env.npm_config_user_agent.split(' ')[0];
+ const name = specifier.substring(0, specifier.lastIndexOf('/'));
+ return name === 'npminstall' ? 'cnpm' : name;
+}
diff --git a/packages/create-astro/src/actions/dependencies.ts b/packages/create-astro/src/actions/dependencies.ts
index f05e9e93ae02..1e731099c010 100644
--- a/packages/create-astro/src/actions/dependencies.ts
+++ b/packages/create-astro/src/actions/dependencies.ts
@@ -3,7 +3,7 @@ import fs from 'node:fs';
import path from 'node:path';
import { error, info, spinner, title } from '../messages.js';
import { shell } from '../shell.js';
-import type { Context } from './context';
+import type { Context } from './context.js';
export async function dependencies(
ctx: Pick
diff --git a/packages/create-astro/src/actions/git.ts b/packages/create-astro/src/actions/git.ts
index c2a59b0b32f1..dd703b1f559c 100644
--- a/packages/create-astro/src/actions/git.ts
+++ b/packages/create-astro/src/actions/git.ts
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
-import type { Context } from './context';
+import type { Context } from './context.js';
import { color } from '@astrojs/cli-kit';
import { error, info, spinner, title } from '../messages.js';
diff --git a/packages/create-astro/src/actions/intro.ts b/packages/create-astro/src/actions/intro.ts
index a96c8e4346e6..1781fb260109 100644
--- a/packages/create-astro/src/actions/intro.ts
+++ b/packages/create-astro/src/actions/intro.ts
@@ -1,27 +1,29 @@
-import type { Context } from './context';
+import type { Context } from './context.js';
import { color, label } from '@astrojs/cli-kit';
import { random } from '@astrojs/cli-kit/utils';
import { banner, say, welcome } from '../messages.js';
-export async function intro(ctx: Pick) {
+export async function intro(
+ ctx: Pick
+) {
+ banner();
+
if (!ctx.skipHouston) {
- const hat = ctx.fancy ? random(['🎩', '🎩', '👑', '🧢', '🍦']) : undefined;
await say(
[
[
'Welcome',
'to',
label('astro', color.bgGreen, color.black),
- (ctx.version ? color.green(`v${ctx.version}`) : '') + ',',
- `${ctx.username}!`,
+ Promise.resolve(ctx.version).then(
+ (version) => (version ? color.green(`v${version}`) : '') + ','
+ ),
+ Promise.resolve(ctx.username).then((username) => `${username}!`),
],
random(welcome),
],
- { hat }
+ { clear: true, hat: ctx.hat }
);
- await banner(ctx.version);
- } else {
- await banner(ctx.version);
}
}
diff --git a/packages/create-astro/src/actions/next-steps.ts b/packages/create-astro/src/actions/next-steps.ts
index c79a80525428..86907abf54bc 100644
--- a/packages/create-astro/src/actions/next-steps.ts
+++ b/packages/create-astro/src/actions/next-steps.ts
@@ -1,9 +1,9 @@
import path from 'node:path';
-import type { Context } from './context';
+import type { Context } from './context.js';
import { nextSteps, say } from '../messages.js';
-export async function next(ctx: Pick) {
+export async function next(ctx: Pick) {
let projectDir = path.relative(process.cwd(), ctx.cwd);
const commandMap: { [key: string]: string } = {
@@ -17,7 +17,7 @@ export async function next(ctx: Pick {
- const packageManager = detectPackageManager()?.name || 'npm';
+async function getRegistry(packageManager: string): Promise {
try {
const { stdout } = await shell(packageManager, ['config', 'get', 'registry']);
return stdout?.trim()?.replace(/\/$/, '') || 'https://registry.npmjs.org';
@@ -78,10 +75,10 @@ export const getName = () =>
});
let v: string;
-export const getVersion = () =>
+export const getVersion = (packageManager: string) =>
new Promise(async (resolve) => {
if (v) return resolve(v);
- let registry = await getRegistry();
+ let registry = await getRegistry(packageManager);
const { version } = await fetch(`${registry}/astro/latest`, { redirect: 'follow' }).then(
(res) => res.json(),
() => ({ version: '' })
@@ -91,12 +88,11 @@ export const getVersion = () =>
});
export const log = (message: string) => stdout.write(message + '\n');
-export const banner = async (version: string) =>
- log(
- `\n${label('astro', color.bgGreen, color.black)}${
- version ? ' ' + color.green(color.bold(`v${version}`)) : ''
- } ${color.bold('Launch sequence initiated.')}`
- );
+export const banner = () => {
+ const prefix = `astro`;
+ const suffix = `Launch sequence initiated.`;
+ log(`${label(prefix, color.bgGreen, color.black)} ${suffix}`);
+};
export const bannerAbort = () =>
log(`\n${label('astro', color.bgRed)} ${color.bold('Launch sequence aborted.')}`);
diff --git a/packages/create-astro/tsconfig.json b/packages/create-astro/tsconfig.json
index 1ab34c5a2010..18443cddf207 100644
--- a/packages/create-astro/tsconfig.json
+++ b/packages/create-astro/tsconfig.json
@@ -1,13 +1,7 @@
{
"extends": "../../tsconfig.base.json",
- "include": ["src", "index.d.ts"],
+ "include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "emitDeclarationOnly": false,
- "noEmit": true,
- "target": "ES2022",
- "module": "ES2022",
- "outDir": "./dist",
- "declarationDir": "./dist/types"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/alpinejs/tsconfig.json b/packages/integrations/alpinejs/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/alpinejs/tsconfig.json
+++ b/packages/integrations/alpinejs/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/cloudflare/package.json b/packages/integrations/cloudflare/package.json
index 1fc188e0202b..ef17b0ec74ea 100644
--- a/packages/integrations/cloudflare/package.json
+++ b/packages/integrations/cloudflare/package.json
@@ -41,19 +41,20 @@
"dependencies": {
"@astrojs/underscore-redirects": "workspace:*",
"@cloudflare/workers-types": "^4.20230821.0",
- "esbuild": "^0.19.2",
- "tiny-glob": "^0.2.9",
- "find-up": "^6.3.0",
"@iarna/toml": "^2.2.5",
- "dotenv": "^16.3.1",
"@miniflare/cache": "^2.14.1",
"@miniflare/shared": "^2.14.1",
- "@miniflare/storage-memory": "^2.14.1"
+ "@miniflare/storage-memory": "^2.14.1",
+ "dotenv": "^16.3.1",
+ "esbuild": "^0.19.2",
+ "find-up": "^6.3.0",
+ "tiny-glob": "^0.2.9"
},
"peerDependencies": {
"astro": "workspace:^3.0.13"
},
"devDependencies": {
+ "@types/iarna__toml": "^2.0.2",
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"chai": "^4.3.7",
diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts
index c70c9c5aab1f..b64d986affa2 100644
--- a/packages/integrations/cloudflare/src/index.ts
+++ b/packages/integrations/cloudflare/src/index.ts
@@ -14,8 +14,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
import glob from 'tiny-glob';
import { getEnvVars } from './parser.js';
-export type { AdvancedRuntime } from './server.advanced';
-export type { DirectoryRuntime } from './server.directory';
+export type { AdvancedRuntime } from './server.advanced.js';
+export type { DirectoryRuntime } from './server.directory.js';
type Options = {
mode?: 'directory' | 'advanced';
diff --git a/packages/integrations/cloudflare/tsconfig.json b/packages/integrations/cloudflare/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/cloudflare/tsconfig.json
+++ b/packages/integrations/cloudflare/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/deno/tsconfig.json b/packages/integrations/deno/tsconfig.json
index f3c96447a6a1..d999917aafdd 100644
--- a/packages/integrations/deno/tsconfig.json
+++ b/packages/integrations/deno/tsconfig.json
@@ -2,11 +2,9 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
"module": "ES2022",
"outDir": "./dist",
- "target": "ES2022",
- // TODO: Due to the shim for Deno imports in `server.ts`, we can't use moduleResolution: 'bundler' or the types get very weird.
+ // TODO: Due to the shim for Deno imports in `server.ts`, we can't use moduleResolution: 'node16' or the types get very weird.
"moduleResolution": "Node"
}
}
diff --git a/packages/integrations/lit/tsconfig.json b/packages/integrations/lit/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/lit/tsconfig.json
+++ b/packages/integrations/lit/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/markdoc/src/html/index.ts b/packages/integrations/markdoc/src/html/index.ts
index 8798d3c9a224..3f947736cdf6 100644
--- a/packages/integrations/markdoc/src/html/index.ts
+++ b/packages/integrations/markdoc/src/html/index.ts
@@ -1,2 +1,2 @@
-export { htmlTag } from './tagdefs/html.tag';
-export { htmlTokenTransform } from './transform/html-token-transform';
+export { htmlTag } from './tagdefs/html.tag.js';
+export { htmlTokenTransform } from './transform/html-token-transform.js';
diff --git a/packages/integrations/markdoc/src/html/transform/html-token-transform.ts b/packages/integrations/markdoc/src/html/transform/html-token-transform.ts
index cfa511a9f90f..10796cdc0c85 100644
--- a/packages/integrations/markdoc/src/html/transform/html-token-transform.ts
+++ b/packages/integrations/markdoc/src/html/transform/html-token-transform.ts
@@ -1,5 +1,6 @@
import type { Tokenizer } from '@markdoc/markdoc';
import { Parser } from 'htmlparser2';
+// @ts-expect-error This type isn't exported
import type * as Token from 'markdown-it/lib/token';
export function htmlTokenTransform(tokenizer: Tokenizer, tokens: Token[]): Token[] {
diff --git a/packages/integrations/markdoc/tsconfig.json b/packages/integrations/markdoc/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/markdoc/tsconfig.json
+++ b/packages/integrations/markdoc/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index c27abb4d1137..438372e87767 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -13,6 +13,11 @@ import { VFile } from 'vfile';
import type { Plugin as VitePlugin } from 'vite';
import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js';
import type { OptimizeOptions } from './rehype-optimize-static.js';
+import {
+ ASTRO_IMAGE_ELEMENT,
+ ASTRO_IMAGE_IMPORT,
+ USES_ASTRO_IMAGE_FLAG,
+} from './remark-images-to-component.js';
import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js';
export type MdxOptions = Omit & {
@@ -194,12 +199,25 @@ export default function mdx(partialMdxOptions: Partial = {}): AstroI
if (!moduleExports.find(({ n }) => n === 'Content')) {
// If have `export const components`, pass that as props to `Content` as fallback
const hasComponents = moduleExports.find(({ n }) => n === 'components');
+ const usesAstroImage = moduleExports.find(
+ ({ n }) => n === USES_ASTRO_IMAGE_FLAG
+ );
+
+ let componentsCode = `{ Fragment${
+ hasComponents ? ', ...components' : ''
+ }, ...props.components,`;
+ if (usesAstroImage) {
+ componentsCode += ` ${JSON.stringify(ASTRO_IMAGE_ELEMENT)}: ${
+ hasComponents ? 'components.img ?? ' : ''
+ } props.components?.img ?? ${ASTRO_IMAGE_IMPORT}`;
+ }
+ componentsCode += ' }';
// Make `Content` the default export so we can wrap `MDXContent` and pass in `Fragment`
code = code.replace('export default MDXContent;', '');
code += `\nexport const Content = (props = {}) => MDXContent({
...props,
- components: { Fragment${hasComponents ? ', ...components' : ''}, ...props.components },
+ components: ${componentsCode},
});
export default Content;`;
}
diff --git a/packages/integrations/mdx/src/remark-images-to-component.ts b/packages/integrations/mdx/src/remark-images-to-component.ts
index bb9657f42624..f83f5d76abf9 100644
--- a/packages/integrations/mdx/src/remark-images-to-component.ts
+++ b/packages/integrations/mdx/src/remark-images-to-component.ts
@@ -4,6 +4,10 @@ import type { MdxJsxFlowElement, MdxjsEsm } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
import { jsToTreeNode } from './utils.js';
+export const ASTRO_IMAGE_ELEMENT = 'astro-image';
+export const ASTRO_IMAGE_IMPORT = '__AstroImage__';
+export const USES_ASTRO_IMAGE_FLAG = '__usesAstroImage';
+
export function remarkImageToComponent() {
return function (tree: any, file: MarkdownVFile) {
if (!file.data.imagePaths) return;
@@ -48,7 +52,7 @@ export function remarkImageToComponent() {
// Build a component that's equivalent to
const componentElement: MdxJsxFlowElement = {
- name: '__AstroImage__',
+ name: ASTRO_IMAGE_ELEMENT,
type: 'mdxJsxFlowElement',
attributes: [
{
@@ -92,7 +96,11 @@ export function remarkImageToComponent() {
// Add all the import statements to the top of the file for the images
tree.children.unshift(...importsStatements);
- // Add an import statement for the Astro Image component, we rename it to avoid conflicts
- tree.children.unshift(jsToTreeNode(`import { Image as __AstroImage__ } from "astro:assets";`));
+ tree.children.unshift(
+ jsToTreeNode(`import { Image as ${ASTRO_IMAGE_IMPORT} } from "astro:assets";`)
+ );
+ // Export `__usesAstroImage` to pick up `astro:assets` usage in the module graph.
+ // @see the '@astrojs/mdx-postprocess' plugin
+ tree.children.push(jsToTreeNode(`export const ${USES_ASTRO_IMAGE_FLAG} = true`));
};
}
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/public/favicon.svg b/packages/integrations/mdx/test/fixtures/mdx-images/public/favicon.svg
new file mode 100644
index 000000000000..f157bd1c5e28
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/public/favicon.svg
@@ -0,0 +1,9 @@
+
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/src/components/Component.mdx b/packages/integrations/mdx/test/fixtures/mdx-images/src/components/Component.mdx
new file mode 100644
index 000000000000..7463939ba1f1
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/src/components/Component.mdx
@@ -0,0 +1,5 @@
+Optimized image:
+![Houston](../assets/houston.webp)
+
+Public image:
+![Astro logo](/favicon.svg)
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/src/components/MyImage.astro b/packages/integrations/mdx/test/fixtures/mdx-images/src/components/MyImage.astro
new file mode 100644
index 000000000000..e3541867c7fc
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/src/components/MyImage.astro
@@ -0,0 +1,25 @@
+---
+import type { ImageMetadata } from 'astro';
+import { Image } from 'astro:assets';
+
+type Props = {
+ src: string | ImageMetadata;
+ alt: string;
+};
+
+const { src, alt } = Astro.props;
+---
+
+{
+ typeof src === 'string' ? (
+
+ ) : (
+
+ )
+}
+
+
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/src/content/blog/entry.mdx b/packages/integrations/mdx/test/fixtures/mdx-images/src/content/blog/entry.mdx
new file mode 100644
index 000000000000..58aebcf54f89
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/src/content/blog/entry.mdx
@@ -0,0 +1,5 @@
+Optimized image:
+![Houston](../../assets/houston.webp)
+
+Public image:
+![Astro logo](/favicon.svg)
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/content-collection.astro b/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/content-collection.astro
new file mode 100644
index 000000000000..63d068b5c2b9
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/content-collection.astro
@@ -0,0 +1,19 @@
+---
+import { getEntry } from 'astro:content';
+import MyImage from 'src/components/MyImage.astro';
+
+const entry = await getEntry('blog', 'entry');
+const { Content } = await entry.render();
+---
+
+
+
+
+
+
+ Renderer
+
+
+
+
+
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/esm-import.astro b/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/esm-import.astro
new file mode 100644
index 000000000000..e5f7a61d971d
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/esm-import.astro
@@ -0,0 +1,16 @@
+---
+import MDX from '../components/Component.mdx';
+import MyImage from 'src/components/MyImage.astro';
+---
+
+
+
+
+
+
+ Renderer
+
+
+
+
+
diff --git a/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/with-components.mdx b/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/with-components.mdx
new file mode 100644
index 000000000000..763256b1c8d3
--- /dev/null
+++ b/packages/integrations/mdx/test/fixtures/mdx-images/src/pages/with-components.mdx
@@ -0,0 +1,9 @@
+import MyImage from '../components/MyImage.astro';
+
+export const components = { img: MyImage };
+
+Optimized image:
+![Houston](../assets/houston.webp)
+
+Public image:
+![Astro logo](/favicon.svg)
diff --git a/packages/integrations/mdx/test/mdx-images.test.js b/packages/integrations/mdx/test/mdx-images.test.js
index c9c8e1f7c79e..950b54581d2c 100644
--- a/packages/integrations/mdx/test/mdx-images.test.js
+++ b/packages/integrations/mdx/test/mdx-images.test.js
@@ -2,6 +2,8 @@ import { expect } from 'chai';
import { parseHTML } from 'linkedom';
import { loadFixture } from '../../../astro/test/test-utils.js';
+const imageTestRoutes = ['with-components', 'esm-import', 'content-collection'];
+
describe('MDX Page', () => {
let devServer;
let fixture;
@@ -36,5 +38,26 @@ describe('MDX Page', () => {
// Image with spaces in the path
expect(imgs.item(3).src.startsWith('/_image')).to.be.true;
});
+
+ for (const route of imageTestRoutes) {
+ it(`supports img component - ${route}`, async () => {
+ const res = await fixture.fetch(`/${route}`);
+ expect(res.status).to.equal(200);
+
+ const html = await res.text();
+ const { document } = parseHTML(html);
+
+ const imgs = document.getElementsByTagName('img');
+ expect(imgs.length).to.equal(2);
+
+ const assetsImg = imgs.item(0);
+ expect(assetsImg.src.startsWith('/_image')).to.be.true;
+ expect(assetsImg.hasAttribute('data-my-image')).to.be.true;
+
+ const publicImg = imgs.item(1);
+ expect(publicImg.src).to.equal('/favicon.svg');
+ expect(publicImg.hasAttribute('data-my-image')).to.be.true;
+ });
+ }
});
});
diff --git a/packages/integrations/mdx/tsconfig.json b/packages/integrations/mdx/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/mdx/tsconfig.json
+++ b/packages/integrations/mdx/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro
new file mode 100644
index 000000000000..873b5c720032
--- /dev/null
+++ b/packages/integrations/netlify/test/hosted/hosted-astro-project/src/pages/time.astro
@@ -0,0 +1,5 @@
+---
+const currentTime = new Date().getTime();
+---
+
+{currentTime}
diff --git a/packages/integrations/netlify/test/hosted/hosted.test.js b/packages/integrations/netlify/test/hosted/hosted.test.js
index 0ce531e4dced..2dc8c67cec5c 100644
--- a/packages/integrations/netlify/test/hosted/hosted.test.js
+++ b/packages/integrations/netlify/test/hosted/hosted.test.js
@@ -10,4 +10,12 @@ describe('Hosted Netlify Tests', () => {
expect(image.status).to.equal(200);
});
+
+ it('Server returns fresh content', async () => {
+ const responseOne = await fetch(NETLIFY_TEST_URL + '/time');
+
+ const responseTwo = await fetch(NETLIFY_TEST_URL + '/time');
+
+ expect(responseOne.body).to.not.equal(responseTwo.body);
+ });
});
diff --git a/packages/integrations/netlify/tsconfig.json b/packages/integrations/netlify/tsconfig.json
index 66b0102c718d..4095e9b83248 100644
--- a/packages/integrations/netlify/tsconfig.json
+++ b/packages/integrations/netlify/tsconfig.json
@@ -2,11 +2,7 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
"outDir": "./dist",
- "target": "ES2022",
- "typeRoots": ["node_modules/@types", "node_modules/@netlify"],
- "allowImportingTsExtensions": true
+ "typeRoots": ["node_modules/@types", "node_modules/@netlify"]
}
}
diff --git a/packages/integrations/node/src/index.ts b/packages/integrations/node/src/index.ts
index 5afc49f6a679..5978371e466d 100644
--- a/packages/integrations/node/src/index.ts
+++ b/packages/integrations/node/src/index.ts
@@ -1,6 +1,6 @@
import type { AstroAdapter, AstroIntegration } from 'astro';
import { AstroError } from 'astro/errors';
-import type { Options, UserOptions } from './types';
+import type { Options, UserOptions } from './types.js';
export function getAdapter(options: Options): AstroAdapter {
return {
name: '@astrojs/node',
diff --git a/packages/integrations/node/src/nodeMiddleware.ts b/packages/integrations/node/src/nodeMiddleware.ts
index 1e0aaea0fc8a..32b8020dc199 100644
--- a/packages/integrations/node/src/nodeMiddleware.ts
+++ b/packages/integrations/node/src/nodeMiddleware.ts
@@ -1,9 +1,9 @@
import type { NodeApp } from 'astro/app/node';
import type { ServerResponse } from 'node:http';
import type { Readable } from 'stream';
-import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders';
-import { responseIterator } from './response-iterator';
-import type { ErrorHandlerParams, Options, RequestHandlerParams } from './types';
+import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders.js';
+import { responseIterator } from './response-iterator.js';
+import type { ErrorHandlerParams, Options, RequestHandlerParams } from './types.js';
// Disable no-unused-vars to avoid breaking signature change
export default function (app: NodeApp, mode: Options['mode']) {
diff --git a/packages/integrations/node/src/preview.ts b/packages/integrations/node/src/preview.ts
index 77560d734687..70ed5469875b 100644
--- a/packages/integrations/node/src/preview.ts
+++ b/packages/integrations/node/src/preview.ts
@@ -4,7 +4,7 @@ import type http from 'node:http';
import { fileURLToPath } from 'node:url';
import { getNetworkAddress } from './get-network-address.js';
import { createServer } from './http-server.js';
-import type { createExports } from './server';
+import type { createExports } from './server.js';
const preview: CreatePreviewServer = async function ({
client,
diff --git a/packages/integrations/node/src/server.ts b/packages/integrations/node/src/server.ts
index 04c81c2d1f85..90bf8c44c46f 100644
--- a/packages/integrations/node/src/server.ts
+++ b/packages/integrations/node/src/server.ts
@@ -2,7 +2,7 @@ import type { SSRManifest } from 'astro';
import { NodeApp, applyPolyfills } from 'astro/app/node';
import middleware from './nodeMiddleware.js';
import startServer from './standalone.js';
-import type { Options } from './types';
+import type { Options } from './types.js';
applyPolyfills();
export function createExports(manifest: SSRManifest, options: Options) {
diff --git a/packages/integrations/node/src/standalone.ts b/packages/integrations/node/src/standalone.ts
index 66d1b9c6a244..abe40ff5cced 100644
--- a/packages/integrations/node/src/standalone.ts
+++ b/packages/integrations/node/src/standalone.ts
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url';
import { getNetworkAddress } from './get-network-address.js';
import { createServer } from './http-server.js';
import middleware from './nodeMiddleware.js';
-import type { Options } from './types';
+import type { Options } from './types.js';
function resolvePaths(options: Options) {
const clientURLRaw = new URL(options.client);
diff --git a/packages/integrations/node/tsconfig.json b/packages/integrations/node/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/node/tsconfig.json
+++ b/packages/integrations/node/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/partytown/tsconfig.json b/packages/integrations/partytown/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/partytown/tsconfig.json
+++ b/packages/integrations/partytown/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/preact/src/client.ts b/packages/integrations/preact/src/client.ts
index b64431130b91..050a86f8a2f7 100644
--- a/packages/integrations/preact/src/client.ts
+++ b/packages/integrations/preact/src/client.ts
@@ -1,6 +1,6 @@
import { h, hydrate, render } from 'preact';
import StaticHtml from './static-html.js';
-import type { SignalLike } from './types';
+import type { SignalLike } from './types.js';
const sharedSignalMap = new Map();
diff --git a/packages/integrations/preact/src/context.ts b/packages/integrations/preact/src/context.ts
index c711017c4d28..4d2398d288af 100644
--- a/packages/integrations/preact/src/context.ts
+++ b/packages/integrations/preact/src/context.ts
@@ -1,4 +1,4 @@
-import type { PropNameToSignalMap, RendererContext, SignalLike } from './types';
+import type { PropNameToSignalMap, RendererContext, SignalLike } from './types.js';
export type Context = {
id: string;
diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts
index 85c3c66ec659..85f9bed0f593 100644
--- a/packages/integrations/preact/src/index.ts
+++ b/packages/integrations/preact/src/index.ts
@@ -1,4 +1,4 @@
-import preact, { type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
+import { preact, type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
import { fileURLToPath } from 'node:url';
diff --git a/packages/integrations/preact/src/server.ts b/packages/integrations/preact/src/server.ts
index e55d29d1c956..a395433c9bad 100644
--- a/packages/integrations/preact/src/server.ts
+++ b/packages/integrations/preact/src/server.ts
@@ -1,10 +1,10 @@
import type { AstroComponentMetadata } from 'astro';
import { Component as BaseComponent, h, type VNode } from 'preact';
-import render from 'preact-render-to-string';
+import { render } from 'preact-render-to-string';
import { getContext } from './context.js';
import { restoreSignalsOnProps, serializeSignals } from './signals.js';
import StaticHtml from './static-html.js';
-import type { AstroPreactAttrs, RendererContext } from './types';
+import type { AstroPreactAttrs, RendererContext } from './types.js';
const slotName = (str: string) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
diff --git a/packages/integrations/preact/src/signals.ts b/packages/integrations/preact/src/signals.ts
index 3fa1529f4004..ef3a4b70a4ee 100644
--- a/packages/integrations/preact/src/signals.ts
+++ b/packages/integrations/preact/src/signals.ts
@@ -1,6 +1,6 @@
-import type { Context } from './context';
+import type { Context } from './context.js';
import { incrementId } from './context.js';
-import type { AstroPreactAttrs, PropNameToSignalMap, SignalLike } from './types';
+import type { AstroPreactAttrs, PropNameToSignalMap, SignalLike } from './types.js';
function isSignal(x: any): x is SignalLike {
return x != null && typeof x === 'object' && typeof x.peek === 'function' && 'value' in x;
diff --git a/packages/integrations/preact/tsconfig.json b/packages/integrations/preact/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/preact/tsconfig.json
+++ b/packages/integrations/preact/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/prefetch/tsconfig.json b/packages/integrations/prefetch/tsconfig.json
index 6457dfe8c831..dadc37a826de 100644
--- a/packages/integrations/prefetch/tsconfig.json
+++ b/packages/integrations/prefetch/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src", "@types"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts
index d5f6965224e4..e4b9778808cf 100644
--- a/packages/integrations/react/src/index.ts
+++ b/packages/integrations/react/src/index.ts
@@ -7,6 +7,7 @@ export type ReactIntegrationOptions = Pick str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
diff --git a/packages/integrations/solid/tsconfig.json b/packages/integrations/solid/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/solid/tsconfig.json
+++ b/packages/integrations/solid/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/svelte/tsconfig.json b/packages/integrations/svelte/tsconfig.json
index af1b43564edc..5742d1f6efd2 100644
--- a/packages/integrations/svelte/tsconfig.json
+++ b/packages/integrations/svelte/tsconfig.json
@@ -2,9 +2,7 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
"outDir": "./dist",
- "target": "ES2022"
+ "verbatimModuleSyntax": false
}
}
diff --git a/packages/integrations/tailwind/src/index.ts b/packages/integrations/tailwind/src/index.ts
index df0f01723abe..700f16937d2c 100644
--- a/packages/integrations/tailwind/src/index.ts
+++ b/packages/integrations/tailwind/src/index.ts
@@ -33,6 +33,7 @@ async function getViteConfiguration(
const postcssOptions = postcssConfigResult?.options ?? {};
const postcssPlugins = postcssConfigResult?.plugins?.slice() ?? [];
+ // @ts-expect-error Tailwind plugin types are wrong
postcssPlugins.push(tailwindPlugin(tailwindConfigPath) as ResultPlugin);
postcssPlugins.push(autoprefixerPlugin());
diff --git a/packages/integrations/tailwind/tsconfig.json b/packages/integrations/tailwind/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/tailwind/tsconfig.json
+++ b/packages/integrations/tailwind/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md
index f2be2cd48f89..7776c2b3033f 100644
--- a/packages/integrations/vercel/README.md
+++ b/packages/integrations/vercel/README.md
@@ -162,7 +162,7 @@ export default defineConfig({
**Available for:** Serverless, Static
**Added in:** `@astrojs/vercel@3.3.0`
-When enabled, an [Image Service](https://docs.astro.build/en/reference/image-service-reference/) powered by the Vercel Image Optimization API will be automatically configured and used in production. In development, a built-in Squoosh-based service will be used instead.
+When enabled, an [Image Service](https://docs.astro.build/en/reference/image-service-reference/) powered by the Vercel Image Optimization API will be automatically configured and used in production. In development, the image service specified by [`devImageService`](#devimageservice) will be used instead.
```js
// astro.config.mjs
@@ -197,6 +197,30 @@ import astroLogo from '../assets/logo.png';
/>
```
+### devImageService
+
+**Type:** `'sharp' | 'squoosh' | string`
+**Available for:** Serverless, Static
+**Added in:** `@astrojs/vercel@3.3.0`
+**Default**: 'sharp'
+
+Allows you to configure which image service to use in development when [imageService](#imageservice) is enabled. This can be useful if you cannot install Sharp's dependencies on your development machine, but using another image service like Squoosh would allow you to preview images in your dev environment. Build is unaffected and will always use Vercel's Image Optimization.
+
+It can also be set to any arbitrary value in order to use a custom image service instead of Astro's built-in ones.
+
+```js
+import { defineConfig } from 'astro/config';
+import vercel from '@astrojs/vercel/serverless';
+
+export default defineConfig({
+ output: 'server',
+ adapter: vercel({
+ imageService: true,
+ devImageService: 'squoosh',
+ }),
+});
+```
+
### includeFiles
**Type:** `string[]`
diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json
index 1634afec8a12..60c0878f12af 100644
--- a/packages/integrations/vercel/package.json
+++ b/packages/integrations/vercel/package.json
@@ -25,6 +25,7 @@
"./speed-insights": "./dist/speed-insights.js",
"./build-image-service": "./dist/image/build-service.js",
"./dev-image-service": "./dist/image/dev-service.js",
+ "./squoosh-dev-service": "./dist/image/squoosh-dev-service.js",
"./package.json": "./package.json"
},
"typesVersions": {
diff --git a/packages/integrations/vercel/src/image/build-service.ts b/packages/integrations/vercel/src/image/build-service.ts
index 63a37a5fee89..bd58d3af61ce 100644
--- a/packages/integrations/vercel/src/image/build-service.ts
+++ b/packages/integrations/vercel/src/image/build-service.ts
@@ -1,5 +1,5 @@
import type { ExternalImageService } from 'astro';
-import { isESMImportedImage, sharedValidateOptions } from './shared';
+import { isESMImportedImage, sharedValidateOptions } from './shared.js';
const service: ExternalImageService = {
validateOptions: (options, serviceOptions) =>
@@ -40,8 +40,9 @@ const service: ExternalImageService = {
};
},
getURL(options) {
- const fileSrc =
- typeof options.src === 'string' ? options.src : removeLeadingForwardSlash(options.src.src);
+ const fileSrc = isESMImportedImage(options.src)
+ ? removeLeadingForwardSlash(options.src.src)
+ : options.src;
const searchParams = new URLSearchParams();
searchParams.append('url', fileSrc);
diff --git a/packages/integrations/vercel/src/image/dev-service.ts b/packages/integrations/vercel/src/image/dev-service.ts
index 72eb7ca0bfad..c9702cff9754 100644
--- a/packages/integrations/vercel/src/image/dev-service.ts
+++ b/packages/integrations/vercel/src/image/dev-service.ts
@@ -1,10 +1,9 @@
import type { LocalImageService } from 'astro';
-import squooshService from 'astro/assets/services/squoosh';
-import { sharedValidateOptions } from './shared';
+import sharpService from 'astro/assets/services/sharp';
+import { baseDevService } from './shared-dev-service.js';
const service: LocalImageService = {
- validateOptions: (options, serviceOptions) =>
- sharedValidateOptions(options, serviceOptions.service.config, 'development'),
+ ...baseDevService,
getHTMLAttributes(options, serviceOptions) {
const { inputtedWidth, ...props } = options;
@@ -13,45 +12,19 @@ const service: LocalImageService = {
props.width = inputtedWidth;
}
- return squooshService.getHTMLAttributes
- ? squooshService.getHTMLAttributes(props, serviceOptions)
+ return sharpService.getHTMLAttributes
+ ? sharpService.getHTMLAttributes(props, serviceOptions)
: {};
},
- getURL(options) {
- const fileSrc = typeof options.src === 'string' ? options.src : options.src.src;
-
- const searchParams = new URLSearchParams();
- searchParams.append('href', fileSrc);
-
- options.width && searchParams.append('w', options.width.toString());
- options.quality && searchParams.append('q', options.quality.toString());
-
- return '/_image?' + searchParams;
- },
- parseURL(url) {
- const params = url.searchParams;
-
- if (!params.has('href')) {
- return undefined;
- }
-
- const transform = {
- src: params.get('href')!,
- width: params.has('w') ? parseInt(params.get('w')!) : undefined,
- quality: params.get('q'),
- };
-
- return transform;
- },
transform(inputBuffer, transform, serviceOptions) {
// NOTE: Hardcoding webp here isn't accurate to how the Vercel Image Optimization API works, normally what we should
// do is setup a custom endpoint that sniff the user's accept-content header and serve the proper format based on the
// user's Vercel config. However, that's: a lot of work for: not much. The dev service is inaccurate to the prod service
// in many more ways, this is one of the less offending cases and is, imo, okay, erika - 2023-04-27
- transform.format = 'webp';
+ transform.format = transform.src.endsWith('svg') ? 'svg' : 'webp';
- // The base Squoosh service works the same way as the Vercel Image Optimization API, so it's a safe fallback in local
- return squooshService.transform(inputBuffer, transform, serviceOptions);
+ // The base sharp service works the same way as the Vercel Image Optimization API, so it's a safe fallback in local
+ return sharpService.transform(inputBuffer, transform, serviceOptions);
},
};
diff --git a/packages/integrations/vercel/src/image/shared-dev-service.ts b/packages/integrations/vercel/src/image/shared-dev-service.ts
new file mode 100644
index 000000000000..4251603a704c
--- /dev/null
+++ b/packages/integrations/vercel/src/image/shared-dev-service.ts
@@ -0,0 +1,33 @@
+import type { LocalImageService } from 'astro';
+import { sharedValidateOptions } from './shared.js';
+
+export const baseDevService: Omit = {
+ validateOptions: (options, serviceOptions) =>
+ sharedValidateOptions(options, serviceOptions.service.config, 'development'),
+ getURL(options) {
+ const fileSrc = typeof options.src === 'string' ? options.src : options.src.src;
+
+ const searchParams = new URLSearchParams();
+ searchParams.append('href', fileSrc);
+
+ options.width && searchParams.append('w', options.width.toString());
+ options.quality && searchParams.append('q', options.quality.toString());
+
+ return '/_image?' + searchParams;
+ },
+ parseURL(url) {
+ const params = url.searchParams;
+
+ if (!params.has('href')) {
+ return undefined;
+ }
+
+ const transform = {
+ src: params.get('href')!,
+ width: params.has('w') ? parseInt(params.get('w')!) : undefined,
+ quality: params.get('q'),
+ };
+
+ return transform;
+ },
+};
diff --git a/packages/integrations/vercel/src/image/shared.ts b/packages/integrations/vercel/src/image/shared.ts
index f6cace2a24ee..079186e187c2 100644
--- a/packages/integrations/vercel/src/image/shared.ts
+++ b/packages/integrations/vercel/src/image/shared.ts
@@ -12,6 +12,10 @@ export function getDefaultImageConfig(astroImageConfig: AstroConfig['image']): V
export function isESMImportedImage(src: ImageMetadata | string): src is ImageMetadata {
return typeof src === 'object';
}
+
+// eslint-disable-next-line @typescript-eslint/ban-types
+export type DevImageService = 'sharp' | 'squoosh' | (string & {});
+
// https://vercel.com/docs/build-output-api/v3/configuration#images
type ImageFormat = 'image/avif' | 'image/webp';
@@ -64,16 +68,32 @@ export function getAstroImageConfig(
images: boolean | undefined,
imagesConfig: VercelImageConfig | undefined,
command: string,
+ devImageService: DevImageService,
astroImageConfig: AstroConfig['image']
) {
+ let devService = '@astrojs/vercel/dev-image-service';
+
+ switch (devImageService) {
+ case 'sharp':
+ devService = '@astrojs/vercel/dev-image-service';
+ break;
+ case 'squoosh':
+ devService = '@astrojs/vercel/squoosh-dev-image-service';
+ break;
+ default:
+ if (typeof devImageService === 'string') {
+ devService = devImageService;
+ } else {
+ devService = '@astrojs/vercel/dev-image-service';
+ }
+ break;
+ }
+
if (images) {
return {
image: {
service: {
- entrypoint:
- command === 'dev'
- ? '@astrojs/vercel/dev-image-service'
- : '@astrojs/vercel/build-image-service',
+ entrypoint: command === 'dev' ? devService : '@astrojs/vercel/build-image-service',
config: imagesConfig ? imagesConfig : getDefaultImageConfig(astroImageConfig),
},
},
diff --git a/packages/integrations/vercel/src/image/squoosh-dev-service.ts b/packages/integrations/vercel/src/image/squoosh-dev-service.ts
new file mode 100644
index 000000000000..d3b05bb115f2
--- /dev/null
+++ b/packages/integrations/vercel/src/image/squoosh-dev-service.ts
@@ -0,0 +1,31 @@
+import type { LocalImageService } from 'astro';
+import squooshService from 'astro/assets/services/squoosh';
+import { baseDevService } from './shared-dev-service.js';
+
+const service: LocalImageService = {
+ ...baseDevService,
+ getHTMLAttributes(options, serviceOptions) {
+ const { inputtedWidth, ...props } = options;
+
+ // If `validateOptions` returned a different width than the one of the image, use it for attributes
+ if (inputtedWidth) {
+ props.width = inputtedWidth;
+ }
+
+ return squooshService.getHTMLAttributes
+ ? squooshService.getHTMLAttributes(props, serviceOptions)
+ : {};
+ },
+ transform(inputBuffer, transform, serviceOptions) {
+ // NOTE: Hardcoding webp here isn't accurate to how the Vercel Image Optimization API works, normally what we should
+ // do is setup a custom endpoint that sniff the user's accept-content header and serve the proper format based on the
+ // user's Vercel config. However, that's: a lot of work for: not much. The dev service is inaccurate to the prod service
+ // in many more ways, this is one of the less offending cases and is, imo, okay, erika - 2023-04-27
+ transform.format = transform.src.endsWith('svg') ? 'svg' : 'webp';
+
+ // The base squoosh service works the same way as the Vercel Image Optimization API, so it's a safe fallback in local
+ return squooshService.transform(inputBuffer, transform, serviceOptions);
+ },
+};
+
+export default service;
diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts
index 6f9021c69e7d..12fb2caa76b1 100644
--- a/packages/integrations/vercel/src/serverless/adapter.ts
+++ b/packages/integrations/vercel/src/serverless/adapter.ts
@@ -12,6 +12,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
import {
getAstroImageConfig,
getDefaultImageConfig,
+ type DevImageService,
type VercelImageConfig,
} from '../image/shared.js';
import { getVercelOutput, removeDir, writeJson } from '../lib/fs.js';
@@ -80,6 +81,7 @@ export interface VercelServerlessConfig {
excludeFiles?: string[];
imageService?: boolean;
imagesConfig?: VercelImageConfig;
+ devImageService?: DevImageService;
edgeMiddleware?: boolean;
functionPerRoute?: boolean;
}
@@ -92,6 +94,7 @@ export default function vercelServerless({
excludeFiles,
imageService,
imagesConfig,
+ devImageService = 'sharp',
functionPerRoute = true,
edgeMiddleware = false,
}: VercelServerlessConfig = {}): AstroIntegration {
@@ -174,7 +177,13 @@ export default function vercelServerless({
external: ['@vercel/nft'],
},
},
- ...getAstroImageConfig(imageService, imagesConfig, command, config.image),
+ ...getAstroImageConfig(
+ imageService,
+ imagesConfig,
+ command,
+ devImageService,
+ config.image
+ ),
});
},
'astro:config:done': ({ setAdapter, config, logger }) => {
diff --git a/packages/integrations/vercel/src/serverless/entrypoint.ts b/packages/integrations/vercel/src/serverless/entrypoint.ts
index f132d71f346c..7b548dc37bfa 100644
--- a/packages/integrations/vercel/src/serverless/entrypoint.ts
+++ b/packages/integrations/vercel/src/serverless/entrypoint.ts
@@ -3,8 +3,8 @@ import { App } from 'astro/app';
import { applyPolyfills } from 'astro/app/node';
import type { IncomingMessage, ServerResponse } from 'node:http';
-import { ASTRO_LOCALS_HEADER } from './adapter';
-import { getRequest, setResponse } from './request-transform';
+import { ASTRO_LOCALS_HEADER } from './adapter.js';
+import { getRequest, setResponse } from './request-transform.js';
applyPolyfills();
diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts
index 43beba86f845..df2995c372ad 100644
--- a/packages/integrations/vercel/src/static/adapter.ts
+++ b/packages/integrations/vercel/src/static/adapter.ts
@@ -3,6 +3,7 @@ import type { AstroAdapter, AstroConfig, AstroIntegration } from 'astro';
import {
getAstroImageConfig,
getDefaultImageConfig,
+ type DevImageService,
type VercelImageConfig,
} from '../image/shared.js';
import { emptyDir, getVercelOutput, writeJson } from '../lib/fs.js';
@@ -48,6 +49,7 @@ export interface VercelStaticConfig {
speedInsights?: VercelSpeedInsightsConfig;
imageService?: boolean;
imagesConfig?: VercelImageConfig;
+ devImageService?: DevImageService;
}
export default function vercelStatic({
@@ -56,6 +58,7 @@ export default function vercelStatic({
speedInsights,
imageService,
imagesConfig,
+ devImageService = 'sharp',
}: VercelStaticConfig = {}): AstroIntegration {
let _config: AstroConfig;
@@ -90,7 +93,13 @@ export default function vercelStatic({
vite: {
...getSpeedInsightsViteConfig(speedInsights?.enabled || analytics),
},
- ...getAstroImageConfig(imageService, imagesConfig, command, config.image),
+ ...getAstroImageConfig(
+ imageService,
+ imagesConfig,
+ command,
+ devImageService,
+ config.image
+ ),
});
},
'astro:config:done': ({ setAdapter, config }) => {
diff --git a/packages/integrations/vercel/test/fixtures/image/package.json b/packages/integrations/vercel/test/fixtures/image/package.json
index ea9d554f5d9c..87fefe2e019e 100644
--- a/packages/integrations/vercel/test/fixtures/image/package.json
+++ b/packages/integrations/vercel/test/fixtures/image/package.json
@@ -2,6 +2,9 @@
"name": "@test/astro-vercel-image",
"version": "0.0.0",
"private": true,
+ "scripts": {
+ "dev": "astro dev"
+ },
"dependencies": {
"@astrojs/vercel": "workspace:*",
"astro": "workspace:*"
diff --git a/packages/integrations/vercel/test/fixtures/image/src/assets/penguin.svg b/packages/integrations/vercel/test/fixtures/image/src/assets/penguin.svg
new file mode 100644
index 000000000000..341a0522f2bc
--- /dev/null
+++ b/packages/integrations/vercel/test/fixtures/image/src/assets/penguin.svg
@@ -0,0 +1,183 @@
+
+
+
+
diff --git a/packages/integrations/vercel/test/fixtures/image/src/pages/index.astro b/packages/integrations/vercel/test/fixtures/image/src/pages/index.astro
index 0a154874fa07..db7c22eebc64 100644
--- a/packages/integrations/vercel/test/fixtures/image/src/pages/index.astro
+++ b/packages/integrations/vercel/test/fixtures/image/src/pages/index.astro
@@ -1,6 +1,13 @@
---
import { Image } from "astro:assets";
import astro from "../assets/astro.jpeg";
+import penguin from "../assets/penguin.svg";
---
-
+
+
+
+
+
+
+
diff --git a/packages/integrations/vercel/test/image.test.js b/packages/integrations/vercel/test/image.test.js
index c5153cc6e622..b8bc3af95bd8 100644
--- a/packages/integrations/vercel/test/image.test.js
+++ b/packages/integrations/vercel/test/image.test.js
@@ -20,7 +20,7 @@ describe('Image', () => {
it('has link to vercel in build with proper attributes', async () => {
const html = await fixture.readFile('../.vercel/output/static/index.html');
const $ = cheerio.load(html);
- const img = $('img');
+ const img = $('#basic-image img');
expect(img.attr('src').startsWith('/_vercel/image?url=_astr')).to.be.true;
expect(img.attr('loading')).to.equal('lazy');
@@ -56,11 +56,22 @@ describe('Image', () => {
it('has link to local image in dev with proper attributes', async () => {
const html = await fixture.fetch('/').then((res) => res.text());
const $ = cheerio.load(html);
- const img = $('img');
+ const img = $('#basic-image img');
expect(img.attr('src').startsWith('/_image?href=')).to.be.true;
expect(img.attr('loading')).to.equal('lazy');
expect(img.attr('width')).to.equal('225');
});
+
+ it('supports SVGs', async () => {
+ const html = await fixture.fetch('/').then((res) => res.text());
+ const $ = cheerio.load(html);
+ const img = $('#svg img');
+ const src = img.attr('src');
+
+ const res = await fixture.fetch(src);
+ expect(res.status).to.equal(200);
+ expect(res.headers.get('content-type')).to.equal('image/svg+xml');
+ });
});
});
diff --git a/packages/integrations/vercel/tsconfig.json b/packages/integrations/vercel/tsconfig.json
index af1b43564edc..1504b4b6dfa4 100644
--- a/packages/integrations/vercel/tsconfig.json
+++ b/packages/integrations/vercel/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
- "outDir": "./dist",
- "target": "ES2022"
+ "outDir": "./dist"
}
}
diff --git a/packages/integrations/vue/tsconfig.json b/packages/integrations/vue/tsconfig.json
index af1b43564edc..5742d1f6efd2 100644
--- a/packages/integrations/vue/tsconfig.json
+++ b/packages/integrations/vue/tsconfig.json
@@ -2,9 +2,7 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "module": "ES2022",
"outDir": "./dist",
- "target": "ES2022"
+ "verbatimModuleSyntax": false
}
}
diff --git a/packages/internal-helpers/tsconfig.json b/packages/internal-helpers/tsconfig.json
index fd652e629fc1..18443cddf207 100644
--- a/packages/internal-helpers/tsconfig.json
+++ b/packages/internal-helpers/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "target": "ES2022",
- "module": "ES2022",
"outDir": "./dist"
}
}
diff --git a/packages/markdown/remark/package.json b/packages/markdown/remark/package.json
index 8710cce0854f..b25950c00f2f 100644
--- a/packages/markdown/remark/package.json
+++ b/packages/markdown/remark/package.json
@@ -34,6 +34,7 @@
"@astrojs/prism": "^3.0.0",
"github-slugger": "^2.0.0",
"import-meta-resolve": "^3.0.0",
+ "mdast-util-definitions": "^6.0.0",
"rehype-raw": "^6.1.1",
"rehype-stringify": "^9.0.4",
"remark-gfm": "^3.0.1",
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index c54826bdc656..d81d1702ec00 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -3,7 +3,7 @@ import type {
MarkdownRenderingOptions,
MarkdownRenderingResult,
MarkdownVFile,
-} from './types';
+} from './types.js';
import { toRemarkInitializeAstroData } from './frontmatter-injection.js';
import { loadPlugins } from './load-plugins.js';
diff --git a/packages/markdown/remark/src/remark-collect-images.ts b/packages/markdown/remark/src/remark-collect-images.ts
index a9f524f7ac69..cfce51376592 100644
--- a/packages/markdown/remark/src/remark-collect-images.ts
+++ b/packages/markdown/remark/src/remark-collect-images.ts
@@ -1,14 +1,24 @@
-import type { Image } from 'mdast';
+import type { Image, ImageReference } from 'mdast';
+import { definitions } from 'mdast-util-definitions';
import { visit } from 'unist-util-visit';
-import type { MarkdownVFile } from './types';
+import type { MarkdownVFile } from './types.js';
export function remarkCollectImages() {
return function (tree: any, vfile: MarkdownVFile) {
if (typeof vfile?.path !== 'string') return;
+ const definition = definitions(tree);
const imagePaths = new Set();
- visit(tree, 'image', (node: Image) => {
- if (shouldOptimizeImage(node.url)) imagePaths.add(node.url);
+ visit(tree, ['image', 'imageReference'], (node: Image | ImageReference) => {
+ if (node.type === 'image') {
+ if (shouldOptimizeImage(node.url)) imagePaths.add(node.url);
+ }
+ if (node.type === 'imageReference') {
+ const imageDefinition = definition(node.identifier);
+ if (imageDefinition) {
+ if (shouldOptimizeImage(imageDefinition.url)) imagePaths.add(imageDefinition.url);
+ }
+ }
});
vfile.data.imagePaths = imagePaths;
diff --git a/packages/markdown/remark/test/remark-collect-images.test.js b/packages/markdown/remark/test/remark-collect-images.test.js
new file mode 100644
index 000000000000..d5c743e20d6b
--- /dev/null
+++ b/packages/markdown/remark/test/remark-collect-images.test.js
@@ -0,0 +1,28 @@
+import { renderMarkdown } from '../dist/index.js';
+import { mockRenderMarkdownParams } from './test-utils.js';
+import chai from 'chai';
+
+describe('collect images', () => {
+ it('should collect inline image paths', async () => {
+ const { code, vfile } = await renderMarkdown(
+ `Hello ![inline image url](./img.png)`,
+ mockRenderMarkdownParams
+ );
+
+ chai
+ .expect(code)
+ .to.equal('Hello
');
+
+ chai.expect(Array.from(vfile.data.imagePaths)).to.deep.equal(['./img.png']);
+ });
+
+ it('should add image paths from definition', async () => {
+ const { code, vfile } = await renderMarkdown(
+ `Hello ![image ref][img-ref]\n\n[img-ref]: ./img.webp`,
+ mockRenderMarkdownParams
+ );
+
+ chai.expect(code).to.equal('Hello
');
+ chai.expect(Array.from(vfile.data.imagePaths)).to.deep.equal(['./img.webp']);
+ });
+});
diff --git a/packages/markdown/remark/test/test-utils.js b/packages/markdown/remark/test/test-utils.js
index 10b779a7de79..76b593deb71c 100644
--- a/packages/markdown/remark/test/test-utils.js
+++ b/packages/markdown/remark/test/test-utils.js
@@ -1,3 +1,4 @@
export const mockRenderMarkdownParams = {
+ fileURL: 'file.md',
contentDir: new URL('file:///src/content/'),
};
diff --git a/packages/markdown/remark/tsconfig.json b/packages/markdown/remark/tsconfig.json
index 9a8c6d8cb545..1504b4b6dfa4 100644
--- a/packages/markdown/remark/tsconfig.json
+++ b/packages/markdown/remark/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "target": "ES2022",
- "module": "ES2022",
"outDir": "./dist"
}
}
diff --git a/packages/telemetry/package.json b/packages/telemetry/package.json
index 8f8a634bf3b4..d4082091d171 100644
--- a/packages/telemetry/package.json
+++ b/packages/telemetry/package.json
@@ -2,7 +2,7 @@
"name": "@astrojs/telemetry",
"version": "3.0.1",
"type": "module",
- "types": "./dist/types/index.d.ts",
+ "types": "./dist/index.d.ts",
"author": "withastro",
"license": "MIT",
"repository": {
@@ -14,7 +14,7 @@
"homepage": "https://astro.build",
"exports": {
".": {
- "types": "./dist/types/index.d.ts",
+ "types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
diff --git a/packages/telemetry/tsconfig.json b/packages/telemetry/tsconfig.json
index 451badc02b5d..18443cddf207 100644
--- a/packages/telemetry/tsconfig.json
+++ b/packages/telemetry/tsconfig.json
@@ -2,10 +2,6 @@
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "target": "ES2022",
- "module": "ES2022",
- "outDir": "./dist",
- "declarationDir": "./dist/types"
+ "outDir": "./dist"
}
}
diff --git a/packages/underscore-redirects/src/print.ts b/packages/underscore-redirects/src/print.ts
index 5d7bd238785a..2a9bec257829 100644
--- a/packages/underscore-redirects/src/print.ts
+++ b/packages/underscore-redirects/src/print.ts
@@ -1,4 +1,4 @@
-import type { RedirectDefinition } from './redirects';
+import type { RedirectDefinition } from './redirects.js';
/**
* Pretty print a list of definitions into the output format. Keeps
diff --git a/packages/underscore-redirects/tsconfig.json b/packages/underscore-redirects/tsconfig.json
index fd652e629fc1..18443cddf207 100644
--- a/packages/underscore-redirects/tsconfig.json
+++ b/packages/underscore-redirects/tsconfig.json
@@ -2,9 +2,6 @@
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
- "allowJs": true,
- "target": "ES2022",
- "module": "ES2022",
"outDir": "./dist"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f789d9ea671d..66287ebc73f5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -596,6 +596,9 @@ importers:
preferred-pm:
specifier: ^3.1.2
version: 3.1.2
+ probe-image-size:
+ specifier: ^7.2.3
+ version: 7.2.3
prompts:
specifier: ^2.4.2
version: 2.4.2
@@ -706,6 +709,9 @@ importers:
'@types/mocha':
specifier: ^10.0.1
version: 10.0.1
+ '@types/probe-image-size':
+ specifier: ^7.2.0
+ version: 7.2.0
'@types/prompts':
specifier: ^2.4.4
version: 2.4.4
@@ -3566,24 +3572,12 @@ importers:
packages/create-astro:
dependencies:
'@astrojs/cli-kit':
- specifier: ^0.2.3
- version: 0.2.3
- execa:
- specifier: ^8.0.1
- version: 8.0.1
+ specifier: ^0.3.0
+ version: 0.3.0
giget:
specifier: 1.1.2
version: 1.1.2
- node-fetch-native:
- specifier: ^1.4.0
- version: 1.4.0
- which-pm-runs:
- specifier: ^1.1.0
- version: 1.1.0
devDependencies:
- '@types/which-pm-runs':
- specifier: ^1.0.0
- version: 1.0.0
arg:
specifier: ^5.0.2
version: 5.0.2
@@ -3647,6 +3641,9 @@ importers:
specifier: ^0.2.9
version: 0.2.9
devDependencies:
+ '@types/iarna__toml':
+ specifier: ^2.0.2
+ version: 2.0.2
astro:
specifier: workspace:*
version: link:../../astro
@@ -4957,6 +4954,9 @@ importers:
import-meta-resolve:
specifier: ^3.0.0
version: 3.0.0
+ mdast-util-definitions:
+ specifier: ^6.0.0
+ version: 6.0.0
rehype-raw:
specifier: ^6.1.1
version: 6.1.1
@@ -5224,10 +5224,11 @@ packages:
- prettier-plugin-astro
dev: true
- /@astrojs/cli-kit@0.2.3:
- resolution: {integrity: sha512-MjB42mpIG/F2rFtdp4f3NylFCILuFSib2yITSq65fRaDFn8+UC8EMh6T7Jr3YqHAbUY5r8V8QWNgH4keOEO2BA==}
+ /@astrojs/cli-kit@0.3.0:
+ resolution: {integrity: sha512-nil0Kz2xuzR3xQX+FVHg2W8g+FvbeUeoCeU53duQjAFuHRJrbqWRmgfjYeM6f2780dsSuGiYMXmY+IaJqaqiaw==}
+ engines: {node: '>=18.14.1'}
dependencies:
- chalk: 5.2.0
+ chalk: 5.3.0
log-update: 5.0.1
sisteransi: 1.0.5
dev: false
@@ -8845,6 +8846,12 @@ packages:
resolution: {integrity: sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==}
dev: true
+ /@types/iarna__toml@2.0.2:
+ resolution: {integrity: sha512-Q3obxKhBLVVbEQ8zsAmsQVobAAZhi8dFFFjF0q5xKXiaHvH8IkSxcbM27e46M9feUMieR03SPpmp5CtaNzpdBg==}
+ dependencies:
+ '@types/node': 18.17.8
+ dev: true
+
/@types/is-ci@3.0.0:
resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==}
dependencies:
@@ -8926,6 +8933,12 @@ packages:
/@types/ms@0.7.31:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
+ /@types/needle@3.2.0:
+ resolution: {integrity: sha512-6XzvzEyJ2ozFNfPajFmqH9JOt0Hp+9TawaYpJT59iIP/zR0U37cfWCRwosyIeEBBZBi021Osq4jGAD3AOju5fg==}
+ dependencies:
+ '@types/node': 18.17.8
+ dev: true
+
/@types/nlcst@1.0.0:
resolution: {integrity: sha512-3TGCfOcy8R8mMQ4CNSNOe3PG66HttvjcLzCoOpvXvDtfWOTi+uT/rxeOKm/qEwbM4SNe1O/PjdiBK2YcTjU4OQ==}
dependencies:
@@ -8967,6 +8980,13 @@ packages:
resolution: {integrity: sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==}
dev: true
+ /@types/probe-image-size@7.2.0:
+ resolution: {integrity: sha512-R5H3vw62gHNHrn+JGZbKejb+Z2D/6E5UNVlhCzIaBBLroMQMOFqy5Pap2gM+ZZHdqBtVU0/cx/M6to+mOJcoew==}
+ dependencies:
+ '@types/needle': 3.2.0
+ '@types/node': 18.17.8
+ dev: true
+
/@types/prompts@2.4.4:
resolution: {integrity: sha512-p5N9uoTH76lLvSAaYSZtBCdEXzpOOufsRjnhjVSrZGXikVGHX9+cc9ERtHRV4hvBKHyZb1bg4K+56Bd2TqUn4A==}
dependencies:
@@ -10292,11 +10312,6 @@ packages:
ansi-styles: 4.3.0
supports-color: 7.2.0
- /chalk@5.2.0:
- resolution: {integrity: sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==}
- engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
- dev: false
-
/chalk@5.3.0:
resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==}
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
@@ -10791,6 +10806,17 @@ packages:
dependencies:
ms: 2.0.0
+ /debug@3.2.7:
+ resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
+ peerDependencies:
+ supports-color: '*'
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+ dependencies:
+ ms: 2.1.3
+ dev: false
+
/debug@4.3.4(supports-color@8.1.1):
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
engines: {node: '>=6.0'}
@@ -12553,7 +12579,6 @@ packages:
engines: {node: '>=0.10.0'}
dependencies:
safer-buffer: 2.1.2
- dev: true
/iconv-lite@0.6.3:
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
@@ -13284,7 +13309,6 @@ packages:
/lodash.merge@4.6.2:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
- dev: true
/lodash.sortby@4.7.0:
resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==}
@@ -13440,6 +13464,14 @@ packages:
'@types/unist': 2.0.7
unist-util-visit: 4.1.2
+ /mdast-util-definitions@6.0.0:
+ resolution: {integrity: sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==}
+ dependencies:
+ '@types/mdast': 4.0.0
+ '@types/unist': 3.0.0
+ unist-util-visit: 5.0.0
+ dev: false
+
/mdast-util-find-and-replace@2.2.2:
resolution: {integrity: sha512-MTtdFRz/eMDHXzeK6W3dO7mXUlF82Gom4y0oOgvHhh/HXZAGvIQDUvQ0SuUx+j2tv44b8xTHOm8K/9OoRFnXKw==}
dependencies:
@@ -14370,6 +14402,18 @@ packages:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
dev: true
+ /needle@2.9.1:
+ resolution: {integrity: sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==}
+ engines: {node: '>= 4.4.x'}
+ hasBin: true
+ dependencies:
+ debug: 3.2.7
+ iconv-lite: 0.4.24
+ sax: 1.2.4
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
/negotiator@0.6.3:
resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==}
engines: {node: '>= 0.6'}
@@ -15467,6 +15511,16 @@ packages:
engines: {node: '>=6'}
dev: false
+ /probe-image-size@7.2.3:
+ resolution: {integrity: sha512-HubhG4Rb2UH8YtV4ba0Vp5bQ7L78RTONYu/ujmCu5nBI8wGv24s4E9xSKBi0N1MowRpxk76pFCpJtW0KPzOK0w==}
+ dependencies:
+ lodash.merge: 4.6.2
+ needle: 2.9.1
+ stream-parser: 0.3.1
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
/progress@2.0.3:
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
engines: {node: '>=0.4.0'}
@@ -16101,7 +16155,6 @@ packages:
/safer-buffer@2.1.2:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
- dev: true
/sass-formatter@0.7.7:
resolution: {integrity: sha512-axtQ7c7Cf4UgHsD8e4okhIkkc90+tdgBIfUMx69+qJuMNq9EOo2k+RH/mDKj0XeA5z3nC1Ca5TCntuxRhI+1MA==}
@@ -16521,6 +16574,14 @@ packages:
engines: {node: '>=4', npm: '>=6'}
dev: true
+ /stream-parser@0.3.1:
+ resolution: {integrity: sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==}
+ dependencies:
+ debug: 2.6.9
+ transitivePeerDependencies:
+ - supports-color
+ dev: false
+
/stream-transform@2.1.3:
resolution: {integrity: sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==}
dependencies:
diff --git a/tsconfig.base.json b/tsconfig.base.json
index 337005ad49fa..0349af8a150b 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -1,10 +1,12 @@
{
+ "$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"strict": true,
- // All packages are built with ESBuild, so we can use `moduleResolution: 'bundler'`
- "moduleResolution": "Bundler",
+ "moduleResolution": "Node16",
+ "target": "ES2022",
+ "module": "Node16",
"esModuleInterop": true,
"skipLibCheck": true,
"verbatimModuleSyntax": true