From 4c05c65a3df5bae935afebc8a15ff52d5b912d8b Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Thu, 8 Sep 2022 18:41:17 +0000 Subject: [PATCH 01/30] [@astrojs/image] Build all optimized images to dist/assets (#4678) * fix: build all optimized images to dist/assets * chore: add changeset --- .changeset/proud-gifts-explain.md | 5 ++++ packages/integrations/image/src/build/ssg.ts | 4 +-- packages/integrations/image/src/index.ts | 2 +- .../integrations/image/src/loaders/sharp.ts | 2 +- .../integrations/image/test/image-ssg.test.js | 28 +++++++++---------- .../image/test/picture-ssg.test.js | 20 ++++++------- .../integrations/image/test/rotation.test.js | 4 +-- .../integrations/image/test/with-mdx.test.js | 10 +++---- 8 files changed, 40 insertions(+), 35 deletions(-) create mode 100644 .changeset/proud-gifts-explain.md diff --git a/.changeset/proud-gifts-explain.md b/.changeset/proud-gifts-explain.md new file mode 100644 index 0000000000000..0c75aab9a5f42 --- /dev/null +++ b/.changeset/proud-gifts-explain.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': patch +--- + +Updates the integration to build all optimized images to `dist/assets` during SSG builds diff --git a/packages/integrations/image/src/build/ssg.ts b/packages/integrations/image/src/build/ssg.ts index 4cf418ad0805f..9219b9afd30c9 100644 --- a/packages/integrations/image/src/build/ssg.ts +++ b/packages/integrations/image/src/build/ssg.ts @@ -83,10 +83,10 @@ export async function ssgBuild({ loader, staticImages, config, outDir, logLevel let outputFile: string; if (isRemoteImage(src)) { - const outputFileURL = new URL(path.join('./', path.basename(filename)), outDir); + const outputFileURL = new URL(path.join('./assets', path.basename(filename)), outDir); outputFile = fileURLToPath(outputFileURL); } else { - const outputFileURL = new URL(path.join('./', filename), outDir); + const outputFileURL = new URL(path.join('./assets', filename), outDir); outputFile = fileURLToPath(outputFileURL); } diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index 01948c0256778..38c6543541cd4 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -85,7 +85,7 @@ export default function integration(options: IntegrationOptions = {}): AstroInte // Doing this here makes sure that base is ignored when building // staticImages to /dist, but the rendered HTML will include the // base prefix for `src`. - return prependForwardSlash(joinPaths(_config.base, filename)); + return prependForwardSlash(joinPaths(_config.base, 'assets', filename)); } // Helpers for building static images should only be available for SSG diff --git a/packages/integrations/image/src/loaders/sharp.ts b/packages/integrations/image/src/loaders/sharp.ts index dbb082dba1479..09a653375d6a7 100644 --- a/packages/integrations/image/src/loaders/sharp.ts +++ b/packages/integrations/image/src/loaders/sharp.ts @@ -116,6 +116,6 @@ class SharpService implements SSRImageService { } } -const service = new SharpService(); +const service: SSRImageService = new SharpService(); export default service; diff --git a/packages/integrations/image/test/image-ssg.test.js b/packages/integrations/image/test/image-ssg.test.js index 0daf066d37073..aa6cf586f8c9f 100644 --- a/packages/integrations/image/test/image-ssg.test.js +++ b/packages/integrations/image/test/image-ssg.test.js @@ -213,43 +213,43 @@ describe('SSG images - build', function () { { title: 'Local images', id: '#social-jpg', - regex: /^\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, }, { title: 'Filename with spaces', id: '#spaces', - regex: /^\/introducing astro.\w{8}_\w{4,10}.webp/, + regex: /^\/assets\/introducing astro.\w{8}_\w{4,10}.webp/, size: { width: 768, height: 414, type: 'webp' }, }, { title: 'Inline imports', id: '#inline', - regex: /^\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, }, { title: 'Remote images', id: '#google', - regex: /^\/googlelogo_color_272x92dp_\w{4,10}.webp/, + regex: /^\/assets\/googlelogo_color_272x92dp_\w{4,10}.webp/, size: { width: 544, height: 184, type: 'webp' }, }, { title: 'Remote without file extension', id: '#ipsum', - regex: /^\/300_\w{4,10}/, + regex: /^\/assets\/300_\w{4,10}/, size: { width: 200, height: 300, type: 'jpg' }, }, { title: 'Public images', id: '#hero', - regex: /^\/hero_\w{4,10}.webp/, + regex: /^\/assets\/hero_\w{4,10}.webp/, size: { width: 768, height: 414, type: 'webp' }, }, { title: 'Remote images', id: '#bg-color', - regex: /^\/googlelogo_color_272x92dp_\w{4,10}.jpeg/, + regex: /^\/assets\/googlelogo_color_272x92dp_\w{4,10}.jpeg/, size: { width: 544, height: 184, type: 'jpg' }, }, ].forEach(({ title, id, regex, size }) => { @@ -289,43 +289,43 @@ describe('SSG images with subpath - build', function () { { title: 'Local images', id: '#social-jpg', - regex: /^\/docs\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/docs\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, }, { title: 'Filename with spaces', id: '#spaces', - regex: /^\/docs\/introducing astro.\w{8}_\w{4,10}.webp/, + regex: /^\/docs\/assets\/introducing astro.\w{8}_\w{4,10}.webp/, size: { width: 768, height: 414, type: 'webp' }, }, { title: 'Inline imports', id: '#inline', - regex: /^\/docs\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/docs\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, }, { title: 'Remote images', id: '#google', - regex: /^\/docs\/googlelogo_color_272x92dp_\w{4,10}.webp/, + regex: /^\/docs\/assets\/googlelogo_color_272x92dp_\w{4,10}.webp/, size: { width: 544, height: 184, type: 'webp' }, }, { title: 'Remote without file extension', id: '#ipsum', - regex: /^\/docs\/300_\w{4,10}/, + regex: /^\/docs\/assets\/300_\w{4,10}/, size: { width: 200, height: 300, type: 'jpg' }, }, { title: 'Public images', id: '#hero', - regex: /^\/docs\/hero_\w{4,10}.webp/, + regex: /^\/docs\/assets\/hero_\w{4,10}.webp/, size: { width: 768, height: 414, type: 'webp' }, }, { title: 'Remote images', id: '#bg-color', - regex: /^\/docs\/googlelogo_color_272x92dp_\w{4,10}.jpeg/, + regex: /^\/docs\/assets\/googlelogo_color_272x92dp_\w{4,10}.jpeg/, size: { width: 544, height: 184, type: 'jpg' }, }, ].forEach(({ title, id, regex, size }) => { diff --git a/packages/integrations/image/test/picture-ssg.test.js b/packages/integrations/image/test/picture-ssg.test.js index 96876b57ab525..6345f8deed7d8 100644 --- a/packages/integrations/image/test/picture-ssg.test.js +++ b/packages/integrations/image/test/picture-ssg.test.js @@ -195,35 +195,35 @@ describe('SSG pictures - build', function () { { title: 'Local images', id: '#social-jpg', - regex: /^\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, alt: 'Social image', }, { title: 'Inline images', id: '#inline', - regex: /^\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, alt: 'Inline social image', }, { title: 'Remote images', id: '#google', - regex: /^\/googlelogo_color_272x92dp_\w{4,10}.png/, + regex: /^\/assets\/googlelogo_color_272x92dp_\w{4,10}.png/, size: { width: 544, height: 184, type: 'png' }, alt: 'Google logo', }, { title: 'Remote without file extension', id: '#ipsum', - regex: /^\/300_\w{4,10}/, + regex: /^\/assets\/300_\w{4,10}/, size: { width: 200, height: 300, type: 'jpg' }, alt: 'ipsum', }, { title: 'Public images', id: '#hero', - regex: /^\/hero_\w{4,10}.jpg/, + regex: /^\/assets\/hero_\w{4,10}.jpg/, size: { width: 768, height: 414, type: 'jpg' }, alt: 'Hero image', }, @@ -290,35 +290,35 @@ describe('SSG pictures with subpath - build', function () { { title: 'Local images', id: '#social-jpg', - regex: /^\/docs\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/docs\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, alt: 'Social image', }, { title: 'Inline images', id: '#inline', - regex: /^\/docs\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/docs\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, alt: 'Inline social image', }, { title: 'Remote images', id: '#google', - regex: /^\/docs\/googlelogo_color_272x92dp_\w{4,10}.png/, + regex: /^\/docs\/assets\/googlelogo_color_272x92dp_\w{4,10}.png/, size: { width: 544, height: 184, type: 'png' }, alt: 'Google logo', }, { title: 'Remote without file extension', id: '#ipsum', - regex: /^\/docs\/300_\w{4,10}/, + regex: /^\/docs\/assets\/300_\w{4,10}/, size: { width: 200, height: 300, type: 'jpg' }, alt: 'ipsum', }, { title: 'Public images', id: '#hero', - regex: /^\/docs\/hero_\w{4,10}.jpg/, + regex: /^\/docs\/assets\/hero_\w{4,10}.jpg/, size: { width: 768, height: 414, type: 'jpg' }, alt: 'Hero image', }, diff --git a/packages/integrations/image/test/rotation.test.js b/packages/integrations/image/test/rotation.test.js index 06f74d1c2ab09..49fe198b1f56e 100644 --- a/packages/integrations/image/test/rotation.test.js +++ b/packages/integrations/image/test/rotation.test.js @@ -32,7 +32,7 @@ describe('Image rotation', function () { it('Landscape images', () => { for (let i = 0; i < 9; i++) { const image = $(`#landscape-${i}`); - const regex = new RegExp(`\^/Landscape_${i}.\\w{8}_\\w{4,10}.jpg`); + const regex = new RegExp(`\^/assets\/Landscape_${i}.\\w{8}_\\w{4,10}.jpg`); expect(image.attr('src')).to.match(regex); expect(image.attr('width')).to.equal('1800'); @@ -49,7 +49,7 @@ describe('Image rotation', function () { it('Portait images', () => { for (let i = 0; i < 9; i++) { const image = $(`#portrait-${i}`); - const regex = new RegExp(`\^/Portrait_${i}.\\w{8}_\\w{4,10}.jpg`); + const regex = new RegExp(`\^/assets\/Portrait_${i}.\\w{8}_\\w{4,10}.jpg`); expect(image.attr('src')).to.match(regex); expect(image.attr('width')).to.equal('1200'); diff --git a/packages/integrations/image/test/with-mdx.test.js b/packages/integrations/image/test/with-mdx.test.js index eb1a572029d2f..963cd9b970bb4 100644 --- a/packages/integrations/image/test/with-mdx.test.js +++ b/packages/integrations/image/test/with-mdx.test.js @@ -28,31 +28,31 @@ describe('Images in MDX - build', function () { { title: 'Local images', id: '#social-jpg', - regex: /^\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, }, { title: 'Inline imports', id: '#inline', - regex: /^\/social.\w{8}_\w{4,10}.jpg/, + regex: /^\/assets\/social.\w{8}_\w{4,10}.jpg/, size: { width: 506, height: 253, type: 'jpg' }, }, { title: 'Remote images', id: '#google', - regex: /^\/googlelogo_color_272x92dp_\w{4,10}.webp/, + regex: /^\/assets\/googlelogo_color_272x92dp_\w{4,10}.webp/, size: { width: 544, height: 184, type: 'webp' }, }, { title: 'Public images', id: '#hero', - regex: /^\/hero_\w{4,10}.webp/, + regex: /^\/assets\/hero_\w{4,10}.webp/, size: { width: 768, height: 414, type: 'webp' }, }, { title: 'Background color', id: '#bg-color', - regex: /^\/googlelogo_color_272x92dp_\w{4,10}.jpeg/, + regex: /^\/assets\/googlelogo_color_272x92dp_\w{4,10}.jpeg/, size: { width: 544, height: 184, type: 'jpg' }, }, ].forEach(({ title, id, regex, size }) => { From cc242d3af2cc39731cc40b07ac0aa1db687b2920 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Thu, 8 Sep 2022 16:31:54 -0300 Subject: [PATCH 02/30] Fix TypeScript compilation errors (#4683) * Fix TypeScript compilation errors * Update lockfile * Add changeset --- .changeset/ninety-donuts-hunt.md | 5 +++++ packages/astro/package.json | 6 +++--- packages/astro/src/@types/astro.ts | 7 +++++-- pnpm-lock.yaml | 15 ++++++--------- 4 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 .changeset/ninety-donuts-hunt.md diff --git a/.changeset/ninety-donuts-hunt.md b/.changeset/ninety-donuts-hunt.md new file mode 100644 index 0000000000000..74255f63f1b41 --- /dev/null +++ b/.changeset/ninety-donuts-hunt.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix `tsc` compilation errors when `skipLibCheck` wasn't enabled diff --git a/packages/astro/package.json b/packages/astro/package.json index 82c848ad37bbe..5428882c488de 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -107,6 +107,9 @@ "@babel/types": "^7.18.4", "@proload/core": "^0.3.2", "@proload/plugin-tsm": "^0.2.1", + "@types/babel__core": "^7.1.19", + "@types/html-escaper": "^3.0.0", + "@types/yargs-parser": "^21.0.0", "boxen": "^6.2.1", "ci-info": "^3.3.1", "common-ancestor-path": "^1.0.1", @@ -151,7 +154,6 @@ }, "devDependencies": { "@playwright/test": "^1.22.2", - "@types/babel__core": "^7.1.19", "@types/babel__generator": "^7.6.4", "@types/babel__traverse": "^7.17.1", "@types/chai": "^4.3.1", @@ -160,7 +162,6 @@ "@types/debug": "^4.1.7", "@types/diff": "^5.0.2", "@types/estree": "^0.0.51", - "@types/html-escaper": "^3.0.0", "@types/mime": "^2.0.3", "@types/mocha": "^9.1.1", "@types/parse5": "^6.0.3", @@ -170,7 +171,6 @@ "@types/rimraf": "^3.0.2", "@types/send": "^0.17.1", "@types/unist": "^2.0.6", - "@types/yargs-parser": "^21.0.0", "ast-types": "^0.14.2", "astro-scripts": "workspace:*", "chai": "^4.3.6", diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 5cd7abe241e67..b2347c4106267 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -924,7 +924,7 @@ export interface MarkdownInstance> { default: AstroComponentFactory; } -export interface MDXInstance +export interface MDXInstance> extends Omit, 'rawContent' | 'compiledContent'> { /** MDX does not support rawContent! If you need to read the Markdown contents to calculate values (ex. reading time), we suggest injecting frontmatter via remark plugins. Learn more on our docs: https://docs.astro.build/en/guides/integrations-guide/mdx/#inject-frontmatter-via-remark-or-rehype-plugins */ rawContent: never; @@ -944,7 +944,10 @@ export interface MarkdownLayoutProps> { compiledContent: MarkdownInstance['compiledContent']; } -export type MDXLayoutProps = Omit, 'rawContent' | 'compiledContent'>; +export type MDXLayoutProps> = Omit< + MarkdownLayoutProps, + 'rawContent' | 'compiledContent' +>; export type GetHydrateCallback = () => Promise<() => void | Promise>; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 145e451c993c4..e67cd1546b9ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -434,6 +434,9 @@ importers: '@babel/types': 7.19.0 '@proload/core': 0.3.3 '@proload/plugin-tsm': 0.2.1_@proload+core@0.3.3 + '@types/babel__core': 7.1.19 + '@types/html-escaper': 3.0.0 + '@types/yargs-parser': 21.0.0 boxen: 6.2.1 ci-info: 3.3.2 common-ancestor-path: 1.0.1 @@ -477,7 +480,6 @@ importers: zod: 3.19.0 devDependencies: '@playwright/test': 1.25.2 - '@types/babel__core': 7.1.19 '@types/babel__generator': 7.6.4 '@types/babel__traverse': 7.18.1 '@types/chai': 4.3.3 @@ -486,7 +488,6 @@ importers: '@types/debug': 4.1.7 '@types/diff': 5.0.2 '@types/estree': 0.0.51 - '@types/html-escaper': 3.0.0 '@types/mime': 2.0.3 '@types/mocha': 9.1.1 '@types/parse5': 6.0.3 @@ -496,7 +497,6 @@ importers: '@types/rimraf': 3.0.2 '@types/send': 0.17.1 '@types/unist': 2.0.6 - '@types/yargs-parser': 21.0.0 ast-types: 0.14.2 astro-scripts: link:../../scripts chai: 4.3.6 @@ -8818,26 +8818,24 @@ packages: '@types/babel__generator': 7.6.4 '@types/babel__template': 7.4.1 '@types/babel__traverse': 7.18.1 - dev: true + dev: false /@types/babel__generator/7.6.4: resolution: {integrity: sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==} dependencies: '@babel/types': 7.19.0 - dev: true /@types/babel__template/7.4.1: resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} dependencies: '@babel/parser': 7.19.0 '@babel/types': 7.19.0 - dev: true + dev: false /@types/babel__traverse/7.18.1: resolution: {integrity: sha512-FSdLaZh2UxaMuLp9lixWaHq/golWTRWOnRsAXzDTDSDOQLuZb1nsdCt6pJSPWSEQt2eFZ2YVk3oYhn+1kLMeMA==} dependencies: '@babel/types': 7.19.0 - dev: true /@types/chai-as-promised/7.1.5: resolution: {integrity: sha512-jStwss93SITGBwt/niYrkf2C+/1KTeZCZl1LaeezTlqppAKeoQC7jxyqYuP72sxBGKCIbw7oHgbYssIRzT5FCQ==} @@ -8926,7 +8924,7 @@ packages: /@types/html-escaper/3.0.0: resolution: {integrity: sha512-OcJcvP3Yk8mjYwf/IdXZtTE1tb/u0WF0qa29ER07ZHCYUBZXSN29Z1mBS+/96+kNMGTFUAbSz9X+pHmHpZrTCw==} - dev: true + dev: false /@types/is-ci/3.0.0: resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} @@ -9137,7 +9135,6 @@ packages: /@types/yargs-parser/21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} - dev: true /@typescript-eslint/eslint-plugin/5.36.2_kou65mzxaniwtkb2mhvaghdcyi: resolution: {integrity: sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==} From 919df13b91eb561ae939e9be51e5a76ca97d8512 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 8 Sep 2022 17:02:29 -0500 Subject: [PATCH 03/30] Improve cyclic reference detection, now ignores non-cyclic shared references (#4684) * fix: improve cyclic reference detection, now ignores references that are not parent/child * fix: only track cyclic parents Co-authored-by: Nate Moore --- .changeset/lovely-clocks-tease.md | 5 ++ .../astro/src/runtime/server/serialize.ts | 40 +++++++---- packages/astro/test/serialize.test.js | 67 +++++++++++++++++++ 3 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 .changeset/lovely-clocks-tease.md create mode 100644 packages/astro/test/serialize.test.js diff --git a/.changeset/lovely-clocks-tease.md b/.changeset/lovely-clocks-tease.md new file mode 100644 index 0000000000000..d6000cf177d5c --- /dev/null +++ b/.changeset/lovely-clocks-tease.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes regression introduced in [#4646](https://github.com/withastro/astro/pull/4646) with better cyclic reference detection diff --git a/packages/astro/src/runtime/server/serialize.ts b/packages/astro/src/runtime/server/serialize.ts index 10812ab7545b1..024a689b01d32 100644 --- a/packages/astro/src/runtime/server/serialize.ts +++ b/packages/astro/src/runtime/server/serialize.ts @@ -13,30 +13,44 @@ const PROP_TYPE = { URL: 7, }; -function serializeArray(value: any[], metadata: AstroComponentMetadata): any[] { - return value.map((v) => convertToSerializedForm(v, metadata)); +function serializeArray(value: any[], metadata: AstroComponentMetadata | Record = {}, parents = new WeakSet()): any[] { + if (parents.has(value)) { + throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>! + +Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`); + } + parents.add(value); + const serialized = value.map((v) => { + return convertToSerializedForm(v, metadata, parents) + }); + parents.delete(value); + return serialized; } function serializeObject( value: Record, - metadata: AstroComponentMetadata + metadata: AstroComponentMetadata | Record = {}, + parents = new WeakSet() ): Record { - if (cyclicRefs.has(value)) { + if (parents.has(value)) { throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>! Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`); } - cyclicRefs.add(value); - return Object.fromEntries( + parents.add(value); + const serialized = Object.fromEntries( Object.entries(value).map(([k, v]) => { - return [k, convertToSerializedForm(v, metadata)]; + return [k, convertToSerializedForm(v, metadata, parents)]; }) ); + parents.delete(value); + return serialized; } function convertToSerializedForm( value: any, - metadata: AstroComponentMetadata + metadata: AstroComponentMetadata | Record = {}, + parents = new WeakSet() ): [ValueOf, any] { const tag = Object.prototype.toString.call(value); switch (tag) { @@ -49,13 +63,13 @@ function convertToSerializedForm( case '[object Map]': { return [ PROP_TYPE.Map, - JSON.stringify(serializeArray(Array.from(value as Map), metadata)), + JSON.stringify(serializeArray(Array.from(value as Map), metadata, parents)), ]; } case '[object Set]': { return [ PROP_TYPE.Set, - JSON.stringify(serializeArray(Array.from(value as Set), metadata)), + JSON.stringify(serializeArray(Array.from(value as Set), metadata, parents)), ]; } case '[object BigInt]': { @@ -65,11 +79,11 @@ function convertToSerializedForm( return [PROP_TYPE.URL, (value as URL).toString()]; } case '[object Array]': { - return [PROP_TYPE.JSON, JSON.stringify(serializeArray(value, metadata))]; + return [PROP_TYPE.JSON, JSON.stringify(serializeArray(value, metadata, parents))]; } default: { if (value !== null && typeof value === 'object') { - return [PROP_TYPE.Value, serializeObject(value, metadata)]; + return [PROP_TYPE.Value, serializeObject(value, metadata, parents)]; } else { return [PROP_TYPE.Value, value]; } @@ -77,9 +91,7 @@ function convertToSerializedForm( } } -let cyclicRefs = new WeakSet(); export function serializeProps(props: any, metadata: AstroComponentMetadata) { const serialized = JSON.stringify(serializeObject(props, metadata)); - cyclicRefs = new WeakSet(); return serialized; } diff --git a/packages/astro/test/serialize.test.js b/packages/astro/test/serialize.test.js new file mode 100644 index 0000000000000..ad28638b206f5 --- /dev/null +++ b/packages/astro/test/serialize.test.js @@ -0,0 +1,67 @@ +import { expect } from 'chai'; +import { serializeProps } from '../dist/runtime/server/serialize.js'; + +describe('serialize', () => { + it('serializes a plain value', () => { + const input = { a: 1 }; + const output = `{"a":[0,1]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes an array', () => { + const input = { a: [0] }; + const output = `{"a":[1,"[[0,0]]"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes a regular expression', () => { + const input = { a: /b/ }; + const output = `{"a":[2,"b"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes a Date', () => { + const input = { a: new Date(0) }; + const output = `{"a":[3,"1970-01-01T00:00:00.000Z"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes a Map', () => { + const input = { a: new Map([[0, 1]]) }; + const output = `{"a":[4,"[[1,\\"[[0,0],[0,1]]\\"]]"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes a Set', () => { + const input = { a: new Set([0, 1, 2, 3]) }; + const output = `{"a":[5,"[[0,0],[0,1],[0,2],[0,3]]"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes a BigInt', () => { + const input = { a: BigInt('1') }; + const output = `{"a":[6,"1"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('serializes a URL', () => { + const input = { a: new URL('https://example.com/') }; + const output = `{"a":[7,"https://example.com/"]}`; + expect(serializeProps(input)).to.equal(output); + }) + it('cannot serialize a cyclic reference', () => { + const a = {} + a.b = a; + const input = { a }; + expect(() => serializeProps(input)).to.throw(/cyclic/); + }) + it('cannot serialize a cyclic array', () => { + const input = { foo: ['bar'] } + input.foo.push(input) + expect(() => serializeProps(input)).to.throw(/cyclic/); + }) + it('cannot serialize a deep cyclic reference', () => { + const a = { b: {}}; + a.b.c = a; + const input = { a }; + expect(() => serializeProps(input)).to.throw(/cyclic/); + }) + it('can serialize shared references that are not cyclic', () => { + const b = {} + const input = { a: { b, b }, b }; + expect(() => serializeProps(input)).not.to.throw(); + }) +}) From fcb9a05c315e38838b1c1a84b959fd0810335d6e Mon Sep 17 00:00:00 2001 From: Dan Jutan Date: Thu, 8 Sep 2022 18:03:09 -0400 Subject: [PATCH 04/30] Remove devDependency flag from `astro add` (#4666) * remove dev dependency flag * remove redundant space if no flags --- packages/astro/src/core/add/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index fa56fa1d261f8..5262386910d96 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -551,11 +551,11 @@ async function getInstallIntegrationsCommand({ switch (pm.name) { case 'npm': - return { pm: 'npm', command: 'install', flags: ['--save-dev'], dependencies }; + return { pm: 'npm', command: 'install', flags: [], dependencies }; case 'yarn': - return { pm: 'yarn', command: 'add', flags: ['--dev'], dependencies }; + return { pm: 'yarn', command: 'add', flags: [], dependencies }; case 'pnpm': - return { pm: 'pnpm', command: 'install', flags: ['--save-dev'], dependencies }; + return { pm: 'pnpm', command: 'install', flags: [], dependencies }; default: return null; } @@ -579,7 +579,7 @@ async function tryToInstallIntegrations({ } else { const coloredOutput = `${bold(installCommand.pm)} ${ installCommand.command - } ${installCommand.flags.join(' ')} ${cyan(installCommand.dependencies.join(' '))}`; + }${['', ...installCommand.flags].join(' ')} ${cyan(installCommand.dependencies.join(' '))}`; const message = `\n${boxen(coloredOutput, { margin: 0.5, padding: 0.5, From 65d753488e9a8b3dca6247fe00dfb8c89f28998f Mon Sep 17 00:00:00 2001 From: natemoo-re Date: Thu, 8 Sep 2022 22:05:06 +0000 Subject: [PATCH 05/30] [ci] format --- packages/astro/src/core/add/index.ts | 7 ++-- .../astro/src/runtime/server/serialize.ts | 8 +++-- packages/astro/test/serialize.test.js | 36 +++++++++---------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 5262386910d96..779349999f914 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -577,9 +577,10 @@ async function tryToInstallIntegrations({ if (installCommand === null) { return UpdateResult.none; } else { - const coloredOutput = `${bold(installCommand.pm)} ${ - installCommand.command - }${['', ...installCommand.flags].join(' ')} ${cyan(installCommand.dependencies.join(' '))}`; + const coloredOutput = `${bold(installCommand.pm)} ${installCommand.command}${[ + '', + ...installCommand.flags, + ].join(' ')} ${cyan(installCommand.dependencies.join(' '))}`; const message = `\n${boxen(coloredOutput, { margin: 0.5, padding: 0.5, diff --git a/packages/astro/src/runtime/server/serialize.ts b/packages/astro/src/runtime/server/serialize.ts index 024a689b01d32..021c050dac4f0 100644 --- a/packages/astro/src/runtime/server/serialize.ts +++ b/packages/astro/src/runtime/server/serialize.ts @@ -13,7 +13,11 @@ const PROP_TYPE = { URL: 7, }; -function serializeArray(value: any[], metadata: AstroComponentMetadata | Record = {}, parents = new WeakSet()): any[] { +function serializeArray( + value: any[], + metadata: AstroComponentMetadata | Record = {}, + parents = new WeakSet() +): any[] { if (parents.has(value)) { throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>! @@ -21,7 +25,7 @@ Cyclic references cannot be safely serialized for client-side usage. Please remo } parents.add(value); const serialized = value.map((v) => { - return convertToSerializedForm(v, metadata, parents) + return convertToSerializedForm(v, metadata, parents); }); parents.delete(value); return serialized; diff --git a/packages/astro/test/serialize.test.js b/packages/astro/test/serialize.test.js index ad28638b206f5..0646edfd7afe4 100644 --- a/packages/astro/test/serialize.test.js +++ b/packages/astro/test/serialize.test.js @@ -6,62 +6,62 @@ describe('serialize', () => { const input = { a: 1 }; const output = `{"a":[0,1]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes an array', () => { const input = { a: [0] }; const output = `{"a":[1,"[[0,0]]"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes a regular expression', () => { const input = { a: /b/ }; const output = `{"a":[2,"b"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes a Date', () => { const input = { a: new Date(0) }; const output = `{"a":[3,"1970-01-01T00:00:00.000Z"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes a Map', () => { const input = { a: new Map([[0, 1]]) }; const output = `{"a":[4,"[[1,\\"[[0,0],[0,1]]\\"]]"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes a Set', () => { const input = { a: new Set([0, 1, 2, 3]) }; const output = `{"a":[5,"[[0,0],[0,1],[0,2],[0,3]]"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes a BigInt', () => { const input = { a: BigInt('1') }; const output = `{"a":[6,"1"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('serializes a URL', () => { const input = { a: new URL('https://example.com/') }; const output = `{"a":[7,"https://example.com/"]}`; expect(serializeProps(input)).to.equal(output); - }) + }); it('cannot serialize a cyclic reference', () => { - const a = {} + const a = {}; a.b = a; const input = { a }; expect(() => serializeProps(input)).to.throw(/cyclic/); - }) + }); it('cannot serialize a cyclic array', () => { - const input = { foo: ['bar'] } - input.foo.push(input) + const input = { foo: ['bar'] }; + input.foo.push(input); expect(() => serializeProps(input)).to.throw(/cyclic/); - }) + }); it('cannot serialize a deep cyclic reference', () => { - const a = { b: {}}; + const a = { b: {} }; a.b.c = a; const input = { a }; expect(() => serializeProps(input)).to.throw(/cyclic/); - }) + }); it('can serialize shared references that are not cyclic', () => { - const b = {} + const b = {}; const input = { a: { b, b }, b }; expect(() => serializeProps(input)).not.to.throw(); - }) -}) + }); +}); From 4753d219490c9b07e7b7d5bb448dcbbcf8e72398 Mon Sep 17 00:00:00 2001 From: Happydev <81974850+MoustaphaDev@users.noreply.github.com> Date: Fri, 9 Sep 2022 03:01:27 +0000 Subject: [PATCH 06/30] docs: correct typo in `@astrojs/node` integration (#4688) --- packages/integrations/node/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/node/README.md b/packages/integrations/node/README.md index cb2297081b36c..3ab5f0b174640 100644 --- a/packages/integrations/node/README.md +++ b/packages/integrations/node/README.md @@ -39,7 +39,7 @@ If you prefer to install the adapter manually instead, complete the following tw ```js title="astro.config.mjs" ins={2, 5-6} import { defineConfig } from 'astro/config'; - import netlify from '@astrojs/node'; + import node from '@astrojs/node'; export default defineConfig({ output: 'server', From b5c436cfd859655a0dbdc3292f56a72203bf36a7 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Fri, 9 Sep 2022 12:02:23 +0100 Subject: [PATCH 07/30] Fix typo in node integration README (#4690) From 63e49c3b642274835cf99e2c0816a5bb655971c9 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 9 Sep 2022 09:02:06 -0400 Subject: [PATCH 08/30] Prevent locking up when encountering invalid CSS (#4675) * Prevent locking up when encountering invalid CSS * Add a changeset * Move the unit test to the test folder * ponyfill aggregateerror * Use the exported type * keep original errors * fix --- .changeset/eleven-goats-confess.md | 5 + packages/astro/package.json | 5 +- .../compile}/compile.ts | 99 +++++-------------- packages/astro/src/core/compile/index.ts | 13 +++ packages/astro/src/core/compile/style.ts | 39 ++++++++ packages/astro/src/core/compile/types.ts | 9 ++ packages/astro/src/core/util.ts | 8 ++ packages/astro/src/vite-plugin-astro/hmr.ts | 2 +- packages/astro/src/vite-plugin-astro/index.ts | 29 +++--- .../src/vite-plugin-markdown-legacy/index.ts | 19 ++-- .../astro/src/vite-style-transform/index.ts | 7 ++ .../vite-style-transform/style-transform.ts | 49 +++++++++ .../transform-with-vite.ts} | 0 .../test/units/compile/invalid-css.test.js | 43 ++++++++ pnpm-lock.yaml | 8 +- 15 files changed, 229 insertions(+), 106 deletions(-) create mode 100644 .changeset/eleven-goats-confess.md rename packages/astro/src/{vite-plugin-astro => core/compile}/compile.ts (53%) create mode 100644 packages/astro/src/core/compile/index.ts create mode 100644 packages/astro/src/core/compile/style.ts create mode 100644 packages/astro/src/core/compile/types.ts create mode 100644 packages/astro/src/vite-style-transform/index.ts create mode 100644 packages/astro/src/vite-style-transform/style-transform.ts rename packages/astro/src/{vite-plugin-astro/styles.ts => vite-style-transform/transform-with-vite.ts} (100%) create mode 100644 packages/astro/test/units/compile/invalid-css.test.js diff --git a/.changeset/eleven-goats-confess.md b/.changeset/eleven-goats-confess.md new file mode 100644 index 0000000000000..a65c2c78340ae --- /dev/null +++ b/.changeset/eleven-goats-confess.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Prevent locking up when encountering invalid CSS diff --git a/packages/astro/package.json b/packages/astro/package.json index 5428882c488de..56349a1ad3218 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -88,13 +88,14 @@ "dev": "astro-scripts dev --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.ts\"", "postbuild": "astro-scripts copy \"src/**/*.astro\"", "benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js", - "test": "mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js", + "test:unit": "mocha --exit --timeout 2000 ./test/units/**/*.test.js", + "test": "pnpm run test:unit && mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js", "test:match": "mocha --timeout 20000 -g", "test:e2e": "playwright test", "test:e2e:match": "playwright test -g" }, "dependencies": { - "@astrojs/compiler": "^0.23.5", + "@astrojs/compiler": "^0.24.0", "@astrojs/language-server": "^0.23.0", "@astrojs/markdown-remark": "^1.1.1", "@astrojs/telemetry": "^1.0.0", diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/core/compile/compile.ts similarity index 53% rename from packages/astro/src/vite-plugin-astro/compile.ts rename to packages/astro/src/core/compile/compile.ts index 368e310fc3c14..d1c5c2f4b2d8d 100644 --- a/packages/astro/src/vite-plugin-astro/compile.ts +++ b/packages/astro/src/core/compile/compile.ts @@ -1,14 +1,12 @@ import type { TransformResult } from '@astrojs/compiler'; -import type { PluginContext, SourceMapInput } from 'rollup'; -import type { ViteDevServer } from 'vite'; -import type { AstroConfig } from '../@types/astro'; -import type { TransformStyleWithVite } from './styles'; +import type { AstroConfig } from '../../@types/astro'; +import type { TransformStyle } from './types'; import { transform } from '@astrojs/compiler'; -import { fileURLToPath } from 'url'; -import { AstroErrorCodes } from '../core/errors.js'; -import { prependForwardSlash } from '../core/path.js'; -import { viteID } from '../core/util.js'; +import { AstroErrorCodes } from '../errors.js'; +import { prependForwardSlash } from '../path.js'; +import { viteID, AggregateError } from '../util.js'; +import { createStylePreprocessor } from './style.js'; type CompilationCache = Map; type CompileResult = TransformResult & { @@ -23,20 +21,7 @@ export interface CompileProps { filename: string; moduleId: string; source: string; - ssr: boolean; - transformStyleWithVite: TransformStyleWithVite; - viteDevServer?: ViteDevServer; - pluginContext: PluginContext; -} - -function getNormalizedID(filename: string): string { - try { - const filenameURL = new URL(`file://${filename}`); - return fileURLToPath(filenameURL); - } catch (err) { - // Not a real file, so just use the provided filename as the normalized id - return filename; - } + transformStyle: TransformStyle; } async function compile({ @@ -44,19 +29,10 @@ async function compile({ filename, moduleId, source, - ssr, - transformStyleWithVite, - viteDevServer, - pluginContext, + transformStyle, }: CompileProps): Promise { - const normalizedID = getNormalizedID(filename); let cssDeps = new Set(); - let cssTransformError: Error | undefined; - - // handleHotUpdate doesn't have `addWatchFile` used by transformStyleWithVite. - if (!pluginContext.addWatchFile) { - pluginContext.addWatchFile = () => {}; - } + let cssTransformErrors: Error[] = []; // Transform from `.astro` to valid `.ts` // use `sourcemap: "both"` so that sourcemap is included in the code @@ -69,44 +45,11 @@ async function compile({ sourcefile: filename, sourcemap: 'both', internalURL: `/@fs${prependForwardSlash( - viteID(new URL('../runtime/server/index.js', import.meta.url)) + viteID(new URL('../../runtime/server/index.js', import.meta.url)) )}`, // TODO: baseline flag experimentalStaticExtraction: true, - preprocessStyle: async (value: string, attrs: Record) => { - const lang = `.${attrs?.lang || 'css'}`.toLowerCase(); - - try { - const result = await transformStyleWithVite.call(pluginContext, { - id: normalizedID, - source: value, - lang, - ssr, - viteDevServer, - }); - - if (!result) return null as any; // TODO: add type in compiler to fix "any" - - for (const dep of result.deps) { - cssDeps.add(dep); - } - - let map: SourceMapInput | undefined; - if (result.map) { - if (typeof result.map === 'string') { - map = result.map; - } else if (result.map.mappings) { - map = result.map.toString(); - } - } - - return { code: result.code, map }; - } catch (err) { - // save error to throw in plugin context - cssTransformError = err as any; - return null; - } - }, + preprocessStyle: createStylePreprocessor(transformStyle, cssDeps, cssTransformErrors), }) .catch((err) => { // throw compiler errors here if encountered @@ -114,13 +57,21 @@ async function compile({ throw err; }) .then((result) => { - // throw CSS transform errors here if encountered - if (cssTransformError) { - (cssTransformError as any).code = - (cssTransformError as any).code || AstroErrorCodes.UnknownCompilerCSSError; - throw cssTransformError; + switch(cssTransformErrors.length) { + case 0: return result; + case 1: { + let error = cssTransformErrors[0]; + if(!(error as any).code) { + (error as any).code = AstroErrorCodes.UnknownCompilerCSSError; + } + throw cssTransformErrors[0]; + } + default: { + const aggregateError = new AggregateError(cssTransformErrors); + (aggregateError as any).code = AstroErrorCodes.UnknownCompilerCSSError; + throw aggregateError; + } } - return result; }); const compileResult: CompileResult = Object.create(transformResult, { diff --git a/packages/astro/src/core/compile/index.ts b/packages/astro/src/core/compile/index.ts new file mode 100644 index 0000000000000..7d3539c2ebec6 --- /dev/null +++ b/packages/astro/src/core/compile/index.ts @@ -0,0 +1,13 @@ +export type { + CompileProps +} from './compile'; +export type { + TransformStyle +} from './types'; + +export { + cachedCompilation, + invalidateCompilation, + isCached, + getCachedSource +} from './compile.js'; diff --git a/packages/astro/src/core/compile/style.ts b/packages/astro/src/core/compile/style.ts new file mode 100644 index 0000000000000..fde1e60bd9db1 --- /dev/null +++ b/packages/astro/src/core/compile/style.ts @@ -0,0 +1,39 @@ +import type { TransformOptions } from '@astrojs/compiler'; +import type { TransformStyle } from './types'; +import type { SourceMapInput } from 'rollup'; + +type PreprocessStyle = TransformOptions['preprocessStyle']; + +export function createStylePreprocessor(transformStyle: TransformStyle, cssDeps: Set, errors: Error[]): PreprocessStyle { + const preprocessStyle: PreprocessStyle = async (value: string, attrs: Record) => { + const lang = `.${attrs?.lang || 'css'}`.toLowerCase(); + + try { + const result = await transformStyle(value, lang); + + if (!result) return null as any; // TODO: add type in compiler to fix "any" + + for (const dep of result.deps) { + cssDeps.add(dep); + } + + let map: SourceMapInput | undefined; + if (result.map) { + if (typeof result.map === 'string') { + map = result.map; + } else if (result.map.mappings) { + map = result.map.toString(); + } + } + + return { code: result.code, map }; + } catch (err) { + errors.push(err as unknown as Error); + return { + error: err + '' + }; + } + }; + + return preprocessStyle; +}; diff --git a/packages/astro/src/core/compile/types.ts b/packages/astro/src/core/compile/types.ts new file mode 100644 index 0000000000000..0e7f79fb2c98e --- /dev/null +++ b/packages/astro/src/core/compile/types.ts @@ -0,0 +1,9 @@ +import type { SourceMap } from 'rollup'; + +export type TransformStyleResult = null | { + code: string; + map: SourceMap | null; + deps: Set; +} + +export type TransformStyle = (source: string, lang: string) => TransformStyleResult | Promise; diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 3c74b5580b31d..3dc5a698e3506 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -226,3 +226,11 @@ export async function resolveIdToUrl(viteServer: ViteDevServer, id: string) { } return VALID_ID_PREFIX + result.id; } + +export const AggregateError = typeof globalThis.AggregateError !== 'undefined' ? globalThis.AggregateError : class extends Error { + errors: Array = []; + constructor( errors: Iterable, message?: string | undefined) { + super(message); + this.errors = Array.from(errors); + } +} diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts index 6ee123e077633..9c729715dd7ac 100644 --- a/packages/astro/src/vite-plugin-astro/hmr.ts +++ b/packages/astro/src/vite-plugin-astro/hmr.ts @@ -4,7 +4,7 @@ import type { AstroConfig } from '../@types/astro'; import type { LogOptions } from '../core/logger/core.js'; import { info } from '../core/logger/core.js'; import * as msg from '../core/messages.js'; -import { cachedCompilation, invalidateCompilation, isCached } from './compile.js'; +import { cachedCompilation, invalidateCompilation, isCached } from '../core/compile/index.js'; import { isAstroScript } from './query.js'; const PKG_PREFIX = new URL('../../', import.meta.url); diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index ccfba7af70362..f8b98a6a4d124 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -3,6 +3,7 @@ import type * as vite from 'vite'; import type { AstroConfig } from '../@types/astro'; import type { LogOptions } from '../core/logger/core.js'; import type { PluginMetadata as AstroPluginMetadata } from './types'; +import type { ViteStyleTransformer } from '../vite-style-transform'; import ancestor from 'common-ancestor-path'; import esbuild from 'esbuild'; @@ -10,10 +11,14 @@ import slash from 'slash'; import { fileURLToPath } from 'url'; import { isRelativePath, startsWithForwardSlash } from '../core/path.js'; import { getFileInfo } from '../vite-plugin-utils/index.js'; -import { cachedCompilation, CompileProps, getCachedSource } from './compile.js'; +import { + cachedCompilation, + CompileProps, + getCachedSource +} from '../core/compile/index.js'; import { handleHotUpdate } from './hmr.js'; import { parseAstroRequest, ParsedRequestResult } from './query.js'; -import { createTransformStyleWithViteFn, TransformStyleWithVite } from './styles.js'; +import { createViteStyleTransformer, createTransformStyles } from '../vite-style-transform/index.js'; const FRONTMATTER_PARSE_REGEXP = /^\-\-\-(.*)^\-\-\-/ms; interface AstroPluginOptions { @@ -38,7 +43,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu } let resolvedConfig: vite.ResolvedConfig; - let transformStyleWithVite: TransformStyleWithVite; + let styleTransformer: ViteStyleTransformer; let viteDevServer: vite.ViteDevServer | undefined; // Variables for determining if an id starts with /src... @@ -60,10 +65,11 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu enforce: 'pre', // run transforms before other plugins can configResolved(_resolvedConfig) { resolvedConfig = _resolvedConfig; - transformStyleWithVite = createTransformStyleWithViteFn(_resolvedConfig); + styleTransformer = createViteStyleTransformer(_resolvedConfig); }, configureServer(server) { viteDevServer = server; + styleTransformer.viteDevServer = server; }, // note: don’t claim .astro files with resolveId() — it prevents Vite from transpiling the final JS (import.meta.glob, etc.) async resolveId(id, from, opts) { @@ -117,10 +123,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu filename, moduleId: id, source, - ssr: Boolean(opts?.ssr), - transformStyleWithVite, - viteDevServer, - pluginContext: this, + transformStyle: createTransformStyles(styleTransformer, filename, Boolean(opts?.ssr), this), }; switch (query.type) { @@ -216,10 +219,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu filename, moduleId: id, source, - ssr: Boolean(opts?.ssr), - transformStyleWithVite, - viteDevServer, - pluginContext: this, + transformStyle: createTransformStyles(styleTransformer, filename, Boolean(opts?.ssr), this), }; try { @@ -352,10 +352,7 @@ ${source} filename: context.file, moduleId: context.file, source: await context.read(), - ssr: true, - transformStyleWithVite, - viteDevServer, - pluginContext: this, + transformStyle: createTransformStyles(styleTransformer, context.file, true, this), }; const compile = () => cachedCompilation(compileProps); return handleHotUpdate.call(this, context, { diff --git a/packages/astro/src/vite-plugin-markdown-legacy/index.ts b/packages/astro/src/vite-plugin-markdown-legacy/index.ts index 1bfb8546b02d9..cd26a7ba613ec 100644 --- a/packages/astro/src/vite-plugin-markdown-legacy/index.ts +++ b/packages/astro/src/vite-plugin-markdown-legacy/index.ts @@ -9,11 +9,8 @@ import type { AstroConfig } from '../@types/astro'; import { pagesVirtualModuleId } from '../core/app/index.js'; import { collectErrorMetadata } from '../core/errors.js'; import type { LogOptions } from '../core/logger/core.js'; -import { cachedCompilation, CompileProps } from '../vite-plugin-astro/compile.js'; -import { - createTransformStyleWithViteFn, - TransformStyleWithVite, -} from '../vite-plugin-astro/styles.js'; +import { cachedCompilation, CompileProps } from '../core/compile/index.js'; +import { ViteStyleTransformer, createViteStyleTransformer, createTransformStyles } from '../vite-style-transform/index.js'; import type { PluginMetadata as AstroPluginMetadata } from '../vite-plugin-astro/types'; import { getFileInfo } from '../vite-plugin-utils/index.js'; @@ -64,14 +61,17 @@ export default function markdown({ config, logging }: AstroPluginOptions): Plugi return false; } - let transformStyleWithVite: TransformStyleWithVite; + let styleTransformer: ViteStyleTransformer; let viteDevServer: ViteDevServer | undefined; return { name: 'astro:markdown', enforce: 'pre', configResolved(_resolvedConfig) { - transformStyleWithVite = createTransformStyleWithViteFn(_resolvedConfig); + styleTransformer = createViteStyleTransformer(_resolvedConfig); + }, + configureServer(server) { + styleTransformer.viteDevServer = server; }, async resolveId(id, importer, options) { // Resolve any .md files with the `?content` cache buster. This should only come from @@ -208,10 +208,7 @@ ${setup}`.trim(); filename, moduleId: id, source: astroResult, - ssr: Boolean(opts?.ssr), - transformStyleWithVite, - viteDevServer, - pluginContext: this, + transformStyle: createTransformStyles(styleTransformer, filename, Boolean(opts?.ssr), this), }; let transformResult = await cachedCompilation(compileProps); diff --git a/packages/astro/src/vite-style-transform/index.ts b/packages/astro/src/vite-style-transform/index.ts new file mode 100644 index 0000000000000..f3635cba7184d --- /dev/null +++ b/packages/astro/src/vite-style-transform/index.ts @@ -0,0 +1,7 @@ +export type { + ViteStyleTransformer +} from './style-transform'; +export { + createViteStyleTransformer, + createTransformStyles +} from './style-transform.js'; diff --git a/packages/astro/src/vite-style-transform/style-transform.ts b/packages/astro/src/vite-style-transform/style-transform.ts new file mode 100644 index 0000000000000..aebec24408d33 --- /dev/null +++ b/packages/astro/src/vite-style-transform/style-transform.ts @@ -0,0 +1,49 @@ +import type { PluginContext } from 'rollup'; +import type { TransformStyle } from '../core/compile/index'; +import { TransformStyleWithVite, createTransformStyleWithViteFn } from './transform-with-vite.js'; +import { fileURLToPath } from 'url'; + +import type * as vite from 'vite'; + +export type ViteStyleTransformer = { + viteDevServer?: vite.ViteDevServer; + transformStyleWithVite: TransformStyleWithVite; +} + +export function createViteStyleTransformer(viteConfig: vite.ResolvedConfig): ViteStyleTransformer { + return { + transformStyleWithVite: createTransformStyleWithViteFn(viteConfig), + }; +} + +function getNormalizedIDForPostCSS(filename: string): string { + try { + const filenameURL = new URL(`file://${filename}`); + return fileURLToPath(filenameURL); + } catch (err) { + // Not a real file, so just use the provided filename as the normalized id + return filename; + } +} + +export function createTransformStyles(viteStyleTransformer: ViteStyleTransformer, filename: string, ssr: boolean, pluginContext: PluginContext): TransformStyle { + // handleHotUpdate doesn't have `addWatchFile` used by transformStyleWithVite. + // TODO, refactor, why is this happening *here* ? + if (!pluginContext.addWatchFile) { + pluginContext.addWatchFile = () => {}; + } + + const normalizedID = getNormalizedIDForPostCSS(filename); + + return async function(styleSource, lang) { + const result = await viteStyleTransformer.transformStyleWithVite.call(pluginContext, { + id: normalizedID, + source: styleSource, + lang, + ssr, + viteDevServer: viteStyleTransformer.viteDevServer, + }); + + return result; + }; +} diff --git a/packages/astro/src/vite-plugin-astro/styles.ts b/packages/astro/src/vite-style-transform/transform-with-vite.ts similarity index 100% rename from packages/astro/src/vite-plugin-astro/styles.ts rename to packages/astro/src/vite-style-transform/transform-with-vite.ts diff --git a/packages/astro/test/units/compile/invalid-css.test.js b/packages/astro/test/units/compile/invalid-css.test.js new file mode 100644 index 0000000000000..72309c445c908 --- /dev/null +++ b/packages/astro/test/units/compile/invalid-css.test.js @@ -0,0 +1,43 @@ + +import { expect } from 'chai'; +import { cachedCompilation } from '../../../dist/core/compile/index.js'; +import { AggregateError } from '../../../dist/core/util.js'; + +describe('astro/src/core/compile', () => { + describe('Invalid CSS', () => { + it('throws an aggregate error with the errors', async () => { + let error; + try { + let r = await cachedCompilation({ + config: /** @type {any} */({ + root: '/' + }), + filename: '/src/pages/index.astro', + moduleId: '/src/pages/index.astro', + source: ` + --- + --- + + + `, + transformStyle(source, lang) { + throw new Error('Invalid css'); + } + }); + } catch(err) { + error = err; + } + + expect(error).to.be.an.instanceOf(AggregateError); + expect(error.errors[0].message).to.contain('Invalid css'); + }); + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e67cd1546b9ea..c3cca8ddd05c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -338,7 +338,7 @@ importers: packages/astro: specifiers: - '@astrojs/compiler': ^0.23.5 + '@astrojs/compiler': ^0.24.0 '@astrojs/language-server': ^0.23.0 '@astrojs/markdown-remark': ^1.1.1 '@astrojs/telemetry': ^1.0.0 @@ -421,7 +421,7 @@ importers: yargs-parser: ^21.0.1 zod: ^3.17.3 dependencies: - '@astrojs/compiler': 0.23.5 + '@astrojs/compiler': 0.24.0 '@astrojs/language-server': 0.23.3 '@astrojs/markdown-remark': link:../markdown/remark '@astrojs/telemetry': link:../telemetry @@ -3232,6 +3232,10 @@ packages: resolution: {integrity: sha512-vBMPy9ok4iLapSyCCT1qsZ9dK7LkVFl9mObtLEmWiec9myGHS9h2kQY2xzPeFNJiWXUf9O6tSyQpQTy5As/p3g==} dev: false + /@astrojs/compiler/0.24.0: + resolution: {integrity: sha512-xZ81C/oMfExdF18I1Tyd2BKKzBqO+qYYctSy4iCwH4UWSo/4Y8A8MAzV1hG67uuE7hFRourSl6H5KUbhyChv/A==} + dev: false + /@astrojs/language-server/0.23.3: resolution: {integrity: sha512-ROoMKo37NZ76pE/A2xHfjDlgfsNnFmkhL4+Wifs0L855n73SUCbnXz7ZaQktIGAq2Te2TpSjAawiOx0q9L5qeg==} hasBin: true From e81292c4ab29bcd3a33bebd4505cede7a27a26b5 Mon Sep 17 00:00:00 2001 From: matthewp Date: Fri, 9 Sep 2022 13:04:29 +0000 Subject: [PATCH 09/30] [ci] format --- packages/astro/src/core/compile/compile.ts | 9 +++++---- packages/astro/src/core/compile/index.ts | 16 +++------------- packages/astro/src/core/compile/style.ts | 12 ++++++++---- packages/astro/src/core/compile/types.ts | 9 ++++++--- packages/astro/src/core/util.ts | 17 ++++++++++------- packages/astro/src/vite-plugin-astro/hmr.ts | 2 +- packages/astro/src/vite-plugin-astro/index.ts | 11 +++++------ .../src/vite-plugin-markdown-legacy/index.ts | 15 ++++++++++++--- .../astro/src/vite-style-transform/index.ts | 9 ++------- .../src/vite-style-transform/style-transform.ts | 15 ++++++++++----- .../test/units/compile/invalid-css.test.js | 9 ++++----- 11 files changed, 66 insertions(+), 58 deletions(-) diff --git a/packages/astro/src/core/compile/compile.ts b/packages/astro/src/core/compile/compile.ts index d1c5c2f4b2d8d..10411860e691f 100644 --- a/packages/astro/src/core/compile/compile.ts +++ b/packages/astro/src/core/compile/compile.ts @@ -5,7 +5,7 @@ import type { TransformStyle } from './types'; import { transform } from '@astrojs/compiler'; import { AstroErrorCodes } from '../errors.js'; import { prependForwardSlash } from '../path.js'; -import { viteID, AggregateError } from '../util.js'; +import { AggregateError, viteID } from '../util.js'; import { createStylePreprocessor } from './style.js'; type CompilationCache = Map; @@ -57,11 +57,12 @@ async function compile({ throw err; }) .then((result) => { - switch(cssTransformErrors.length) { - case 0: return result; + switch (cssTransformErrors.length) { + case 0: + return result; case 1: { let error = cssTransformErrors[0]; - if(!(error as any).code) { + if (!(error as any).code) { (error as any).code = AstroErrorCodes.UnknownCompilerCSSError; } throw cssTransformErrors[0]; diff --git a/packages/astro/src/core/compile/index.ts b/packages/astro/src/core/compile/index.ts index 7d3539c2ebec6..1ee6af06a0696 100644 --- a/packages/astro/src/core/compile/index.ts +++ b/packages/astro/src/core/compile/index.ts @@ -1,13 +1,3 @@ -export type { - CompileProps -} from './compile'; -export type { - TransformStyle -} from './types'; - -export { - cachedCompilation, - invalidateCompilation, - isCached, - getCachedSource -} from './compile.js'; +export type { CompileProps } from './compile'; +export { cachedCompilation, getCachedSource, invalidateCompilation, isCached } from './compile.js'; +export type { TransformStyle } from './types'; diff --git a/packages/astro/src/core/compile/style.ts b/packages/astro/src/core/compile/style.ts index fde1e60bd9db1..20079cede0775 100644 --- a/packages/astro/src/core/compile/style.ts +++ b/packages/astro/src/core/compile/style.ts @@ -1,10 +1,14 @@ import type { TransformOptions } from '@astrojs/compiler'; -import type { TransformStyle } from './types'; import type { SourceMapInput } from 'rollup'; +import type { TransformStyle } from './types'; type PreprocessStyle = TransformOptions['preprocessStyle']; -export function createStylePreprocessor(transformStyle: TransformStyle, cssDeps: Set, errors: Error[]): PreprocessStyle { +export function createStylePreprocessor( + transformStyle: TransformStyle, + cssDeps: Set, + errors: Error[] +): PreprocessStyle { const preprocessStyle: PreprocessStyle = async (value: string, attrs: Record) => { const lang = `.${attrs?.lang || 'css'}`.toLowerCase(); @@ -30,10 +34,10 @@ export function createStylePreprocessor(transformStyle: TransformStyle, cssDeps: } catch (err) { errors.push(err as unknown as Error); return { - error: err + '' + error: err + '', }; } }; return preprocessStyle; -}; +} diff --git a/packages/astro/src/core/compile/types.ts b/packages/astro/src/core/compile/types.ts index 0e7f79fb2c98e..1ef4bdfdcd521 100644 --- a/packages/astro/src/core/compile/types.ts +++ b/packages/astro/src/core/compile/types.ts @@ -1,9 +1,12 @@ import type { SourceMap } from 'rollup'; -export type TransformStyleResult = null | { +export type TransformStyleResult = null | { code: string; map: SourceMap | null; deps: Set; -} +}; -export type TransformStyle = (source: string, lang: string) => TransformStyleResult | Promise; +export type TransformStyle = ( + source: string, + lang: string +) => TransformStyleResult | Promise; diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 3dc5a698e3506..7fb5a4f5b3c45 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -227,10 +227,13 @@ export async function resolveIdToUrl(viteServer: ViteDevServer, id: string) { return VALID_ID_PREFIX + result.id; } -export const AggregateError = typeof globalThis.AggregateError !== 'undefined' ? globalThis.AggregateError : class extends Error { - errors: Array = []; - constructor( errors: Iterable, message?: string | undefined) { - super(message); - this.errors = Array.from(errors); - } -} +export const AggregateError = + typeof globalThis.AggregateError !== 'undefined' + ? globalThis.AggregateError + : class extends Error { + errors: Array = []; + constructor(errors: Iterable, message?: string | undefined) { + super(message); + this.errors = Array.from(errors); + } + }; diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts index 9c729715dd7ac..330ae2e1a3175 100644 --- a/packages/astro/src/vite-plugin-astro/hmr.ts +++ b/packages/astro/src/vite-plugin-astro/hmr.ts @@ -1,10 +1,10 @@ import { fileURLToPath } from 'node:url'; import type { HmrContext, ModuleNode } from 'vite'; import type { AstroConfig } from '../@types/astro'; +import { cachedCompilation, invalidateCompilation, isCached } from '../core/compile/index.js'; import type { LogOptions } from '../core/logger/core.js'; import { info } from '../core/logger/core.js'; import * as msg from '../core/messages.js'; -import { cachedCompilation, invalidateCompilation, isCached } from '../core/compile/index.js'; import { isAstroScript } from './query.js'; const PKG_PREFIX = new URL('../../', import.meta.url); diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index f8b98a6a4d124..3b98b6beedc94 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -2,23 +2,22 @@ import type { PluginContext, SourceDescription } from 'rollup'; import type * as vite from 'vite'; import type { AstroConfig } from '../@types/astro'; import type { LogOptions } from '../core/logger/core.js'; -import type { PluginMetadata as AstroPluginMetadata } from './types'; import type { ViteStyleTransformer } from '../vite-style-transform'; +import type { PluginMetadata as AstroPluginMetadata } from './types'; import ancestor from 'common-ancestor-path'; import esbuild from 'esbuild'; import slash from 'slash'; import { fileURLToPath } from 'url'; +import { cachedCompilation, CompileProps, getCachedSource } from '../core/compile/index.js'; import { isRelativePath, startsWithForwardSlash } from '../core/path.js'; import { getFileInfo } from '../vite-plugin-utils/index.js'; import { - cachedCompilation, - CompileProps, - getCachedSource -} from '../core/compile/index.js'; + createTransformStyles, + createViteStyleTransformer, +} from '../vite-style-transform/index.js'; import { handleHotUpdate } from './hmr.js'; import { parseAstroRequest, ParsedRequestResult } from './query.js'; -import { createViteStyleTransformer, createTransformStyles } from '../vite-style-transform/index.js'; const FRONTMATTER_PARSE_REGEXP = /^\-\-\-(.*)^\-\-\-/ms; interface AstroPluginOptions { diff --git a/packages/astro/src/vite-plugin-markdown-legacy/index.ts b/packages/astro/src/vite-plugin-markdown-legacy/index.ts index cd26a7ba613ec..dd7259e2caa04 100644 --- a/packages/astro/src/vite-plugin-markdown-legacy/index.ts +++ b/packages/astro/src/vite-plugin-markdown-legacy/index.ts @@ -7,12 +7,16 @@ import { fileURLToPath } from 'url'; import type { Plugin, ViteDevServer } from 'vite'; import type { AstroConfig } from '../@types/astro'; import { pagesVirtualModuleId } from '../core/app/index.js'; +import { cachedCompilation, CompileProps } from '../core/compile/index.js'; import { collectErrorMetadata } from '../core/errors.js'; import type { LogOptions } from '../core/logger/core.js'; -import { cachedCompilation, CompileProps } from '../core/compile/index.js'; -import { ViteStyleTransformer, createViteStyleTransformer, createTransformStyles } from '../vite-style-transform/index.js'; import type { PluginMetadata as AstroPluginMetadata } from '../vite-plugin-astro/types'; import { getFileInfo } from '../vite-plugin-utils/index.js'; +import { + createTransformStyles, + createViteStyleTransformer, + ViteStyleTransformer, +} from '../vite-style-transform/index.js'; interface AstroPluginOptions { config: AstroConfig; @@ -208,7 +212,12 @@ ${setup}`.trim(); filename, moduleId: id, source: astroResult, - transformStyle: createTransformStyles(styleTransformer, filename, Boolean(opts?.ssr), this), + transformStyle: createTransformStyles( + styleTransformer, + filename, + Boolean(opts?.ssr), + this + ), }; let transformResult = await cachedCompilation(compileProps); diff --git a/packages/astro/src/vite-style-transform/index.ts b/packages/astro/src/vite-style-transform/index.ts index f3635cba7184d..8e03caca6f790 100644 --- a/packages/astro/src/vite-style-transform/index.ts +++ b/packages/astro/src/vite-style-transform/index.ts @@ -1,7 +1,2 @@ -export type { - ViteStyleTransformer -} from './style-transform'; -export { - createViteStyleTransformer, - createTransformStyles -} from './style-transform.js'; +export type { ViteStyleTransformer } from './style-transform'; +export { createTransformStyles, createViteStyleTransformer } from './style-transform.js'; diff --git a/packages/astro/src/vite-style-transform/style-transform.ts b/packages/astro/src/vite-style-transform/style-transform.ts index aebec24408d33..276a52246fcd1 100644 --- a/packages/astro/src/vite-style-transform/style-transform.ts +++ b/packages/astro/src/vite-style-transform/style-transform.ts @@ -1,14 +1,14 @@ import type { PluginContext } from 'rollup'; -import type { TransformStyle } from '../core/compile/index'; -import { TransformStyleWithVite, createTransformStyleWithViteFn } from './transform-with-vite.js'; import { fileURLToPath } from 'url'; +import type { TransformStyle } from '../core/compile/index'; +import { createTransformStyleWithViteFn, TransformStyleWithVite } from './transform-with-vite.js'; import type * as vite from 'vite'; export type ViteStyleTransformer = { viteDevServer?: vite.ViteDevServer; transformStyleWithVite: TransformStyleWithVite; -} +}; export function createViteStyleTransformer(viteConfig: vite.ResolvedConfig): ViteStyleTransformer { return { @@ -26,7 +26,12 @@ function getNormalizedIDForPostCSS(filename: string): string { } } -export function createTransformStyles(viteStyleTransformer: ViteStyleTransformer, filename: string, ssr: boolean, pluginContext: PluginContext): TransformStyle { +export function createTransformStyles( + viteStyleTransformer: ViteStyleTransformer, + filename: string, + ssr: boolean, + pluginContext: PluginContext +): TransformStyle { // handleHotUpdate doesn't have `addWatchFile` used by transformStyleWithVite. // TODO, refactor, why is this happening *here* ? if (!pluginContext.addWatchFile) { @@ -35,7 +40,7 @@ export function createTransformStyles(viteStyleTransformer: ViteStyleTransformer const normalizedID = getNormalizedIDForPostCSS(filename); - return async function(styleSource, lang) { + return async function (styleSource, lang) { const result = await viteStyleTransformer.transformStyleWithVite.call(pluginContext, { id: normalizedID, source: styleSource, diff --git a/packages/astro/test/units/compile/invalid-css.test.js b/packages/astro/test/units/compile/invalid-css.test.js index 72309c445c908..00d4fb7f6d042 100644 --- a/packages/astro/test/units/compile/invalid-css.test.js +++ b/packages/astro/test/units/compile/invalid-css.test.js @@ -1,4 +1,3 @@ - import { expect } from 'chai'; import { cachedCompilation } from '../../../dist/core/compile/index.js'; import { AggregateError } from '../../../dist/core/util.js'; @@ -9,8 +8,8 @@ describe('astro/src/core/compile', () => { let error; try { let r = await cachedCompilation({ - config: /** @type {any} */({ - root: '/' + config: /** @type {any} */ ({ + root: '/', }), filename: '/src/pages/index.astro', moduleId: '/src/pages/index.astro', @@ -30,9 +29,9 @@ describe('astro/src/core/compile', () => { `, transformStyle(source, lang) { throw new Error('Invalid css'); - } + }, }); - } catch(err) { + } catch (err) { error = err; } From d136864bff1409031d68677564312eac78073e80 Mon Sep 17 00:00:00 2001 From: "Fred K. Bot" <108291165+fredkbot@users.noreply.github.com> Date: Fri, 9 Sep 2022 06:41:07 -0700 Subject: [PATCH 10/30] [ci] update lockfile (#4693) Co-authored-by: FredKSchott --- pnpm-lock.yaml | 112 ++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c3cca8ddd05c5..feaff3ea7a91d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -155,7 +155,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 examples/framework-preact: @@ -202,7 +202,7 @@ importers: dependencies: '@astrojs/svelte': link:../../packages/integrations/svelte astro: link:../../packages/astro - svelte: 3.50.0 + svelte: 3.50.1 examples/framework-vue: specifiers: @@ -248,7 +248,7 @@ importers: astro: link:../../packages/astro concurrently: 7.4.0 lightcookie: 1.0.25 - svelte: 3.50.0 + svelte: 3.50.1 unocss: 0.15.6 vite-imagetools: 4.0.9 @@ -446,7 +446,7 @@ importers: es-module-lexer: 0.10.5 esbuild: 0.14.54 execa: 6.1.0 - fast-glob: 3.2.11 + fast-glob: 3.2.12 github-slugger: 1.4.0 gray-matter: 4.0.3 html-entities: 2.3.3 @@ -474,7 +474,7 @@ importers: supports-esm: 1.0.0 tsconfig-resolver: 3.0.1 unist-util-visit: 4.1.1 - vfile: 5.3.4 + vfile: 5.3.5 vite: 3.0.9_sass@1.54.9 yargs-parser: 21.1.1 zod: 3.19.0 @@ -564,7 +564,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -674,7 +674,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/lit': link:../../../../integrations/lit @@ -717,7 +717,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -746,7 +746,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -775,7 +775,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -804,7 +804,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -833,7 +833,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -862,7 +862,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -961,7 +961,7 @@ importers: '@astrojs/mdx': link:../../../../integrations/mdx '@astrojs/svelte': link:../../../../integrations/svelte astro: link:../../.. - svelte: 3.50.0 + svelte: 3.50.1 packages/astro/e2e/fixtures/tailwindcss: specifiers: @@ -1596,7 +1596,7 @@ importers: react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 - svelte: 3.50.0 + svelte: 3.50.1 vue: 3.2.39 devDependencies: '@astrojs/preact': link:../../../../integrations/preact @@ -2349,7 +2349,7 @@ importers: remark-smartypants: 2.0.0 shiki: 0.11.1 unist-util-visit: 4.1.1 - vfile: 5.3.4 + vfile: 5.3.5 devDependencies: '@types/chai': 4.3.3 '@types/mocha': 9.1.1 @@ -2603,15 +2603,15 @@ importers: svelte2tsx: ^0.5.11 vite: ^3.0.0 dependencies: - '@sveltejs/vite-plugin-svelte': 1.0.5_svelte@3.50.0+vite@3.1.0 + '@sveltejs/vite-plugin-svelte': 1.0.5_svelte@3.50.1+vite@3.1.0 postcss-load-config: 3.1.4 - svelte-preprocess: 4.10.7_5llrep7g7lww57fglza6pzz77u - svelte2tsx: 0.5.16_svelte@3.50.0 + svelte-preprocess: 4.10.7_dnlyed3grtnuceggogyodrmgvm + svelte2tsx: 0.5.16_svelte@3.50.1 vite: 3.1.0 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts - svelte: 3.50.0 + svelte: 3.50.1 packages/integrations/tailwind: specifiers: @@ -2835,7 +2835,7 @@ importers: unified: 10.1.2 unist-util-map: 3.1.1 unist-util-visit: 4.1.1 - vfile: 5.3.4 + vfile: 5.3.5 devDependencies: '@types/chai': 4.3.3 '@types/github-slugger': 1.3.0 @@ -2943,7 +2943,7 @@ importers: esbuild: 0.14.54 globby: 12.2.0 kleur: 4.1.5 - svelte: 3.50.0 + svelte: 3.50.1 tar: 6.1.11 packages: @@ -5373,7 +5373,7 @@ packages: unist-util-position-from-estree: 1.1.1 unist-util-stringify-position: 3.0.2 unist-util-visit: 4.1.1 - vfile: 5.3.4 + vfile: 5.3.5 transitivePeerDependencies: - supports-color dev: false @@ -5389,7 +5389,7 @@ packages: '@mdx-js/mdx': 2.1.3 '@rollup/pluginutils': 4.2.1 source-map: 0.7.4 - vfile: 5.3.4 + vfile: 5.3.5 transitivePeerDependencies: - supports-color dev: false @@ -8763,7 +8763,7 @@ packages: string.prototype.matchall: 4.0.7 dev: false - /@sveltejs/vite-plugin-svelte/1.0.5_svelte@3.50.0+vite@3.1.0: + /@sveltejs/vite-plugin-svelte/1.0.5_svelte@3.50.1+vite@3.1.0: resolution: {integrity: sha512-CmSdSow0Dr5ua1A11BQMtreWnE0JZmkVIcRU/yG3PKbycKUpXjNdgYTWFSbStLB0vdlGnBbm2+Y4sBVj+C+TIw==} engines: {node: ^14.18.0 || >= 16} peerDependencies: @@ -8781,8 +8781,8 @@ packages: deepmerge: 4.2.2 kleur: 4.1.5 magic-string: 0.26.3 - svelte: 3.50.0 - svelte-hmr: 0.14.12_svelte@3.50.0 + svelte: 3.50.1 + svelte-hmr: 0.14.12_svelte@3.50.1 vite: 3.1.0 transitivePeerDependencies: - supports-color @@ -8796,7 +8796,7 @@ packages: /@ts-morph/common/0.16.0: resolution: {integrity: sha512-SgJpzkTgZKLKqQniCjLaE3c2L2sdL7UShvmTmPBejAKd2OKV/yfMpQ2IWpAuA+VY5wy7PkSUaEObIqEK6afFuw==} dependencies: - fast-glob: 3.2.11 + fast-glob: 3.2.12 minimatch: 5.1.0 mkdirp: 1.0.4 path-browserify: 1.0.1 @@ -9313,7 +9313,7 @@ packages: chokidar: 3.5.3 colorette: 2.0.19 consola: 2.15.3 - fast-glob: 3.2.11 + fast-glob: 3.2.12 pathe: 0.2.0 dev: false @@ -10013,7 +10013,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001393 - electron-to-chromium: 1.4.244 + electron-to-chromium: 1.4.246 node-releases: 2.0.6 update-browserslist-db: 1.0.7_browserslist@4.21.3 @@ -10830,8 +10830,8 @@ packages: jake: 10.8.5 dev: false - /electron-to-chromium/1.4.244: - resolution: {integrity: sha512-E21saXLt2eTDaTxgUtiJtBUqanF9A32wZasAwDZ8gvrqXoxrBrbwtDCx7c/PQTLp81wj4X0OLDeoGQg7eMo3+w==} + /electron-to-chromium/1.4.246: + resolution: {integrity: sha512-/wFCHUE+Hocqr/LlVGsuKLIw4P2lBWwFIDcNMDpJGzyIysQV4aycpoOitAs32FT94EHKnNqDR/CVZJFbXEufJA==} /emmet/2.3.6: resolution: {integrity: sha512-pLS4PBPDdxuUAmw7Me7+TcHbykTsBKN/S9XJbUOMFQrNv9MoshzyMFK/R57JBm94/6HSL4vHnDeEmxlC82NQ4A==} @@ -11838,8 +11838,8 @@ packages: resolution: {integrity: sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==} dev: true - /fast-glob/3.2.11: - resolution: {integrity: sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==} + /fast-glob/3.2.12: + resolution: {integrity: sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==} engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 @@ -12203,7 +12203,7 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.2.11 + fast-glob: 3.2.12 ignore: 5.2.0 merge2: 1.4.1 slash: 3.0.0 @@ -12215,7 +12215,7 @@ packages: dependencies: array-union: 3.0.1 dir-glob: 3.0.1 - fast-glob: 3.2.11 + fast-glob: 3.2.12 ignore: 5.2.0 merge2: 1.4.1 slash: 4.0.0 @@ -12325,7 +12325,7 @@ packages: '@types/unist': 2.0.6 hastscript: 7.0.2 property-information: 6.1.1 - vfile: 5.3.4 + vfile: 5.3.5 vfile-location: 4.0.1 web-namespaces: 2.0.1 dev: false @@ -12364,7 +12364,7 @@ packages: parse5: 6.0.1 unist-util-position: 4.0.3 unist-util-visit: 4.1.1 - vfile: 5.3.4 + vfile: 5.3.5 web-namespaces: 2.0.1 zwitch: 2.0.2 dev: false @@ -15631,7 +15631,7 @@ packages: shiki: 0.10.1 shiki-twoslash: 3.1.0 tslib: 2.1.0 - typescript: 4.8.2 + typescript: 4.8.3 unist-util-visit: 2.0.3 transitivePeerDependencies: - supports-color @@ -15991,7 +15991,7 @@ packages: '@typescript/twoslash': 3.1.0 '@typescript/vfs': 1.3.4 shiki: 0.10.1 - typescript: 4.8.2 + typescript: 4.8.3 transitivePeerDependencies: - supports-color dev: true @@ -16422,16 +16422,16 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - /svelte-hmr/0.14.12_svelte@3.50.0: + /svelte-hmr/0.14.12_svelte@3.50.1: resolution: {integrity: sha512-4QSW/VvXuqVcFZ+RhxiR8/newmwOCTlbYIezvkeN6302YFRE8cXy0naamHcjz8Y9Ce3ITTZtrHrIL0AGfyo61w==} engines: {node: ^12.20 || ^14.13.1 || >= 16} peerDependencies: svelte: '>=3.19.0' dependencies: - svelte: 3.50.0 + svelte: 3.50.1 dev: false - /svelte-preprocess/4.10.7_5llrep7g7lww57fglza6pzz77u: + /svelte-preprocess/4.10.7_dnlyed3grtnuceggogyodrmgvm: resolution: {integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==} engines: {node: '>= 9.11.2'} requiresBuild: true @@ -16479,14 +16479,14 @@ packages: postcss-load-config: 3.1.4 sorcery: 0.10.0 strip-indent: 3.0.0 - svelte: 3.50.0 + svelte: 3.50.1 dev: false - /svelte/3.50.0: - resolution: {integrity: sha512-zXeOUDS7+85i+RxLN+0iB6PMbGH7OhEgjETcD1fD8ZrhuhNFxYxYEHU41xuhkHIulJavcu3PKbPyuCrBxdxskQ==} + /svelte/3.50.1: + resolution: {integrity: sha512-bS4odcsdj5D5jEg6riZuMg5NKelzPtmsCbD9RG+8umU03TeNkdWnP6pqbCm0s8UQNBkqk29w/Bdubn3C+HWSwA==} engines: {node: '>= 8'} - /svelte2tsx/0.5.16_svelte@3.50.0: + /svelte2tsx/0.5.16_svelte@3.50.1: resolution: {integrity: sha512-MwgpeRHfzP8T7NkFNT1JPhe9pCF4Dml2oSdjL2zNqvSprjA2BFgQuCNUg4R5qSz7AxVDJsiL/2hciCtVbXAT3A==} peerDependencies: svelte: ^3.24 @@ -16497,7 +16497,7 @@ packages: dependencies: dedent-js: 1.0.1 pascal-case: 3.1.2 - svelte: 3.50.0 + svelte: 3.50.1 dev: false /synckit/0.7.3: @@ -16520,7 +16520,7 @@ packages: detective: 5.2.1 didyoumean: 1.2.2 dlv: 1.1.3 - fast-glob: 3.2.11 + fast-glob: 3.2.12 glob-parent: 6.0.2 is-glob: 4.0.3 lilconfig: 2.0.6 @@ -16960,8 +16960,8 @@ packages: hasBin: true dev: true - /typescript/4.8.2: - resolution: {integrity: sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==} + /typescript/4.8.3: + resolution: {integrity: sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -17027,7 +17027,7 @@ packages: is-buffer: 2.0.5 is-plain-obj: 4.1.0 trough: 2.1.0 - vfile: 5.3.4 + vfile: 5.3.5 /unique-string/2.0.0: resolution: {integrity: sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==} @@ -17250,7 +17250,7 @@ packages: resolution: {integrity: sha512-JDxPlTbZrZCQXogGheBHjbRWjESSPEak770XwWPfw5mTc1v1nWGLB/apzZxsx8a0SJVfF8HK8ql8RD308vXRUw==} dependencies: '@types/unist': 2.0.6 - vfile: 5.3.4 + vfile: 5.3.5 dev: false /vfile-message/3.1.2: @@ -17259,8 +17259,8 @@ packages: '@types/unist': 2.0.6 unist-util-stringify-position: 3.0.2 - /vfile/5.3.4: - resolution: {integrity: sha512-KI+7cnst03KbEyN1+JE504zF5bJBZa+J+CrevLeyIMq0aPU681I2rQ5p4PlnQ6exFtWiUrg26QUdFMnAKR6PIw==} + /vfile/5.3.5: + resolution: {integrity: sha512-U1ho2ga33eZ8y8pkbQLH54uKqGhFJ6GYIHnnG5AhRpAh3OWjkrRHKa/KogbmQn8We+c0KVV3rTOgR9V/WowbXQ==} dependencies: '@types/unist': 2.0.6 is-buffer: 2.0.5 @@ -17286,7 +17286,7 @@ packages: optional: true dependencies: debug: 4.3.4 - fast-glob: 3.2.11 + fast-glob: 3.2.12 pretty-bytes: 5.6.0 rollup: 2.79.0 workbox-build: 6.5.4 From f27ca6ab3edbf0ef55e213ffd09aac454ce07995 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 9 Sep 2022 10:53:34 -0400 Subject: [PATCH 11/30] Fix: Windows client-side script reloads on dev server (#4645) * fix: append forward slash to script paths for "C:/" prob * chore: remove dead regex * chore: changeset * test: add client script test back to windows! * test: add inline script test for sanity * The actual fix Co-authored-by: Matthew Phillips --- .changeset/two-cherries-drop.md | 5 ++++ packages/astro/e2e/astro-component.test.js | 27 ++++++++++++++++--- .../astro-component/src/pages/index.astro | 4 +++ packages/astro/src/core/util.ts | 2 +- packages/astro/src/vite-plugin-astro/index.ts | 19 +++++-------- 5 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 .changeset/two-cherries-drop.md diff --git a/.changeset/two-cherries-drop.md b/.changeset/two-cherries-drop.md new file mode 100644 index 0000000000000..c1f7fc6b61c89 --- /dev/null +++ b/.changeset/two-cherries-drop.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix client-side scripts reloads on dev server in windows diff --git a/packages/astro/e2e/astro-component.test.js b/packages/astro/e2e/astro-component.test.js index 8d6151f0737be..8ebbcd3a62f5f 100644 --- a/packages/astro/e2e/astro-component.test.js +++ b/packages/astro/e2e/astro-component.test.js @@ -36,10 +36,7 @@ test.describe('Astro component HMR', () => { ); }); - // TODO: Re-enable this test on windows when #3424 is fixed - // https://github.com/withastro/astro/issues/3424 - const it = os.platform() === 'win32' ? test.skip : test; - it('hoisted scripts', async ({ page, astro }) => { + test('hoisted scripts', async ({ page, astro }) => { const initialLog = page.waitForEvent( 'console', (message) => message.text() === 'Hello, Astro!' @@ -60,4 +57,26 @@ test.describe('Astro component HMR', () => { await updatedLog; }); + + test('inline scripts', async ({ page, astro }) => { + const initialLog = page.waitForEvent( + 'console', + (message) => message.text() === 'Hello, inline Astro!' + ); + + await page.goto(astro.resolveUrl('/')); + await initialLog; + + const updatedLog = page.waitForEvent( + 'console', + (message) => message.text() === 'Hello, updated inline Astro!' + ); + + // Edit the inline script on the page + await astro.editFile('./src/pages/index.astro', (content) => + content.replace('Hello, inline Astro!', 'Hello, updated inline Astro!') + ); + + await updatedLog; + }); }); diff --git a/packages/astro/e2e/fixtures/astro-component/src/pages/index.astro b/packages/astro/e2e/fixtures/astro-component/src/pages/index.astro index 76221b04084e1..c7522dc545849 100644 --- a/packages/astro/e2e/fixtures/astro-component/src/pages/index.astro +++ b/packages/astro/e2e/fixtures/astro-component/src/pages/index.astro @@ -18,3 +18,7 @@ import Hero from '../components/Hero.astro'; + + diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 7fb5a4f5b3c45..0abc9b40b61ae 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -126,7 +126,7 @@ export function resolveDependency(dep: string, projectRoot: URL) { * Windows: C:/Users/astro/code/my-project/src/pages/index.astro */ export function viteID(filePath: URL): string { - return slash(fileURLToPath(filePath)); + return slash(fileURLToPath(filePath) + filePath.search); } export const VALID_ID_PREFIX = `/@id/`; diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 3b98b6beedc94..b132afe1b5433 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -9,8 +9,9 @@ import ancestor from 'common-ancestor-path'; import esbuild from 'esbuild'; import slash from 'slash'; import { fileURLToPath } from 'url'; +import { isRelativePath, prependForwardSlash, startsWithForwardSlash } from '../core/path.js'; +import { viteID } from '../core/util.js'; import { cachedCompilation, CompileProps, getCachedSource } from '../core/compile/index.js'; -import { isRelativePath, startsWithForwardSlash } from '../core/path.js'; import { getFileInfo } from '../vite-plugin-utils/index.js'; import { createTransformStyles, @@ -48,6 +49,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu // Variables for determining if an id starts with /src... const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1); const isBrowserPath = (path: string) => path.startsWith(srcRootWeb); + const isFullFilePath = (path: string) => path.startsWith(prependForwardSlash(slash(fileURLToPath(config.root)))); function resolveRelativeFromAstroParent(id: string, parsedFrom: ParsedRequestResult): string { const filename = normalizeFilename(parsedFrom.filename); @@ -94,7 +96,10 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu if (query.type === 'style' && isBrowserPath(id)) { return relativeToRoot(id); } - + // Convert file paths to ViteID, meaning on Windows it omits the leading slash + if(isFullFilePath(id)) { + return viteID(new URL('file://' + id)); + } return id; } }, @@ -245,18 +250,8 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu )};export { $$file as file, $$url as url };\n`; // Add HMR handling in dev mode. if (!resolvedConfig.isProduction) { - // HACK: extract dependencies from metadata until compiler static extraction handles them - const metadata = transformResult.code.split('$$createMetadata(')[1].split('});\n')[0]; - const pattern = /specifier:\s*'([^']*)'/g; - const deps = new Set(); - let match; - while ((match = pattern.exec(metadata)?.[1])) { - deps.add(match); - } - let i = 0; while (i < transformResult.scripts.length) { - deps.add(`${id}?astro&type=script&index=${i}&lang.ts`); SUFFIX += `import "${id}?astro&type=script&index=${i}&lang.ts";`; i++; } From e5fd0a49469cee406d68be65bc97b8a7f2bb3b88 Mon Sep 17 00:00:00 2001 From: matthewp Date: Fri, 9 Sep 2022 14:56:07 +0000 Subject: [PATCH 12/30] [ci] format --- packages/astro/src/vite-plugin-astro/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index b132afe1b5433..d946dd2566aa7 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -9,9 +9,9 @@ import ancestor from 'common-ancestor-path'; import esbuild from 'esbuild'; import slash from 'slash'; import { fileURLToPath } from 'url'; +import { cachedCompilation, CompileProps, getCachedSource } from '../core/compile/index.js'; import { isRelativePath, prependForwardSlash, startsWithForwardSlash } from '../core/path.js'; import { viteID } from '../core/util.js'; -import { cachedCompilation, CompileProps, getCachedSource } from '../core/compile/index.js'; import { getFileInfo } from '../vite-plugin-utils/index.js'; import { createTransformStyles, @@ -49,7 +49,8 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu // Variables for determining if an id starts with /src... const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1); const isBrowserPath = (path: string) => path.startsWith(srcRootWeb); - const isFullFilePath = (path: string) => path.startsWith(prependForwardSlash(slash(fileURLToPath(config.root)))); + const isFullFilePath = (path: string) => + path.startsWith(prependForwardSlash(slash(fileURLToPath(config.root)))); function resolveRelativeFromAstroParent(id: string, parsedFrom: ParsedRequestResult): string { const filename = normalizeFilename(parsedFrom.filename); @@ -97,7 +98,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu return relativeToRoot(id); } // Convert file paths to ViteID, meaning on Windows it omits the leading slash - if(isFullFilePath(id)) { + if (isFullFilePath(id)) { return viteID(new URL('file://' + id)); } return id; From b6dd8b595ccbcc3e9984bdd5b685c210867aaaab Mon Sep 17 00:00:00 2001 From: "Fred K. Bot" <108291165+fredkbot@users.noreply.github.com> Date: Fri, 9 Sep 2022 07:56:48 -0700 Subject: [PATCH 13/30] [ci] release (#4680) Co-authored-by: github-actions[bot] --- .changeset/eleven-goats-confess.md | 5 -- .changeset/lovely-clocks-tease.md | 5 -- .changeset/ninety-donuts-hunt.md | 5 -- .changeset/orange-llamas-play.md | 5 -- .changeset/proud-gifts-explain.md | 5 -- .changeset/tasty-owls-watch.md | 6 --- .changeset/two-cherries-drop.md | 5 -- examples/basics/package.json | 2 +- examples/blog/package.json | 2 +- examples/component/package.json | 4 +- examples/docs/package.json | 4 +- examples/framework-alpine/package.json | 2 +- examples/framework-lit/package.json | 2 +- examples/framework-multiple/package.json | 4 +- examples/framework-preact/package.json | 2 +- examples/framework-react/package.json | 4 +- examples/framework-solid/package.json | 2 +- examples/framework-svelte/package.json | 2 +- examples/framework-vue/package.json | 2 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/ssr/package.json | 2 +- examples/with-markdown-plugins/package.json | 2 +- examples/with-markdown-shiki/package.json | 2 +- examples/with-mdx/package.json | 2 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vite-plugin-pwa/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 14 ++++++ packages/astro/package.json | 2 +- packages/integrations/image/CHANGELOG.md | 6 +++ packages/integrations/image/package.json | 2 +- packages/integrations/react/CHANGELOG.md | 8 ++++ packages/integrations/react/package.json | 2 +- pnpm-lock.yaml | 52 ++++++++++----------- 37 files changed, 84 insertions(+), 92 deletions(-) delete mode 100644 .changeset/eleven-goats-confess.md delete mode 100644 .changeset/lovely-clocks-tease.md delete mode 100644 .changeset/ninety-donuts-hunt.md delete mode 100644 .changeset/orange-llamas-play.md delete mode 100644 .changeset/proud-gifts-explain.md delete mode 100644 .changeset/tasty-owls-watch.md delete mode 100644 .changeset/two-cherries-drop.md diff --git a/.changeset/eleven-goats-confess.md b/.changeset/eleven-goats-confess.md deleted file mode 100644 index a65c2c78340ae..0000000000000 --- a/.changeset/eleven-goats-confess.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Prevent locking up when encountering invalid CSS diff --git a/.changeset/lovely-clocks-tease.md b/.changeset/lovely-clocks-tease.md deleted file mode 100644 index d6000cf177d5c..0000000000000 --- a/.changeset/lovely-clocks-tease.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fixes regression introduced in [#4646](https://github.com/withastro/astro/pull/4646) with better cyclic reference detection diff --git a/.changeset/ninety-donuts-hunt.md b/.changeset/ninety-donuts-hunt.md deleted file mode 100644 index 74255f63f1b41..0000000000000 --- a/.changeset/ninety-donuts-hunt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix `tsc` compilation errors when `skipLibCheck` wasn't enabled diff --git a/.changeset/orange-llamas-play.md b/.changeset/orange-llamas-play.md deleted file mode 100644 index 04c0e5ae403b1..0000000000000 --- a/.changeset/orange-llamas-play.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/react': patch ---- - -Prevent decoder from leaking diff --git a/.changeset/proud-gifts-explain.md b/.changeset/proud-gifts-explain.md deleted file mode 100644 index 0c75aab9a5f42..0000000000000 --- a/.changeset/proud-gifts-explain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/image': patch ---- - -Updates the integration to build all optimized images to `dist/assets` during SSG builds diff --git a/.changeset/tasty-owls-watch.md b/.changeset/tasty-owls-watch.md deleted file mode 100644 index 8d0eb53f449ed..0000000000000 --- a/.changeset/tasty-owls-watch.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'astro': patch -'@astrojs/react': patch ---- - -Fix framework components on Vercel Edge diff --git a/.changeset/two-cherries-drop.md b/.changeset/two-cherries-drop.md deleted file mode 100644 index c1f7fc6b61c89..0000000000000 --- a/.changeset/two-cherries-drop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix client-side scripts reloads on dev server in windows diff --git a/examples/basics/package.json b/examples/basics/package.json index 36b26f9348c99..c15309561d642 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 920624ff8c109..24a85f6db2c45 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "@astrojs/mdx": "^0.11.1", "@astrojs/rss": "^1.0.0", "@astrojs/sitemap": "^1.0.0" diff --git a/examples/component/package.json b/examples/component/package.json index 80f78ef8d7123..1c245c8cc847b 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,9 +15,9 @@ ], "scripts": {}, "devDependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" }, "peerDependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/docs/package.json b/examples/docs/package.json index 96a7aa29cbbb4..87aabd18d153c 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -11,11 +11,11 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", - "@astrojs/react": "^1.1.0", + "@astrojs/react": "^1.1.2", "@astrojs/preact": "^1.1.0", "@algolia/client-search": "^4.13.1", "@docsearch/css": "^3.1.0", diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index ecead315700f9..d65020bf5024d 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "alpinejs": "^3.10.2", "@astrojs/alpinejs": "^0.1.2", "@types/alpinejs": "^3.7.0" diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index d9ea200a7e5de..48f1b6bebc7fd 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "lit": "^2.2.5", "@astrojs/lit": "^1.0.0", "@webcomponents/template-shadowroot": "^0.1.0" diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 63bff53426880..6c936eae11965 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", @@ -18,7 +18,7 @@ "svelte": "^3.48.0", "vue": "^3.2.37", "@astrojs/preact": "^1.1.0", - "@astrojs/react": "^1.1.0", + "@astrojs/react": "^1.1.2", "@astrojs/solid-js": "^1.1.0", "@astrojs/svelte": "^1.0.0", "@astrojs/vue": "^1.0.1" diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 86fa870bdbd90..2edb6d1bd4e5d 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "preact": "^10.7.3", "@astrojs/preact": "^1.1.0" } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index a68fbd845a965..abe2a2522048c 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -10,10 +10,10 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "react": "^18.1.0", "react-dom": "^18.1.0", - "@astrojs/react": "^1.1.0", + "@astrojs/react": "^1.1.2", "@types/react": "^18.0.10", "@types/react-dom": "^18.0.5" } diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 55392d4dfa55a..5e90482992206 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "solid-js": "^1.4.3", "@astrojs/solid-js": "^1.1.0" } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index 25c5252d73c78..e8c9df5d34582 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,6 +12,6 @@ "dependencies": { "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.0", - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index b14317693b6a9..8b162bf92e65f 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "vue": "^3.2.37", "@astrojs/vue": "^1.0.1" } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 05284048d8c6c..62ba1f8b5d024 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 83d238c44372a..ac0d6ce3d3d85 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 69f7a343ecf32..406dd862409ce 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index ef957afc8cd95..8def058846bf2 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,7 +12,7 @@ }, "devDependencies": {}, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.0", "@astrojs/node": "^1.0.1", diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 7262a8b2ea0bb..3f04c357cf9ab 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "@astrojs/markdown-remark": "^1.1.0", "hast-util-select": "5.0.1", "rehype-autolink-headings": "^6.1.1", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 1a7936dc7d2e4..82fde255c449c 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7" + "astro": "^1.1.8" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 22446d4d40562..77c6700a6d073 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "preact": "^10.6.5", "@astrojs/preact": "^1.1.0", "@astrojs/mdx": "^0.11.1" diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 81f93325a2e16..4fb3b62acb431 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "preact": "^10.7.3", "@astrojs/preact": "^1.1.0", "nanostores": "^0.5.12", diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 7688bf6eb4e40..af7da3516f78b 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "@astrojs/tailwind": "^1.0.0", "autoprefixer": "^10.4.7", "canvas-confetti": "^1.5.1", diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json index 8c72a34e806ba..3a15d26c8f120 100644 --- a/examples/with-vite-plugin-pwa/package.json +++ b/examples/with-vite-plugin-pwa/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "vite-plugin-pwa": "0.11.11", "workbox-window": "^6.5.3" } diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index c7edbeac69d04..a43c906ab7455 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^1.1.7", + "astro": "^1.1.8", "vitest": "^0.20.3" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 27b36d8d330d6..dd0fa1ce88d28 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,19 @@ # astro +## 1.1.8 + +### Patch Changes + +- [#4675](https://github.com/withastro/astro/pull/4675) [`63e49c3b6`](https://github.com/withastro/astro/commit/63e49c3b642274835cf99e2c0816a5bb655971c9) Thanks [@matthewp](https://github.com/matthewp)! - Prevent locking up when encountering invalid CSS + +- [#4684](https://github.com/withastro/astro/pull/4684) [`919df13b9`](https://github.com/withastro/astro/commit/919df13b91eb561ae939e9be51e5a76ca97d8512) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Fixes regression introduced in [#4646](https://github.com/withastro/astro/pull/4646) with better cyclic reference detection + +- [#4683](https://github.com/withastro/astro/pull/4683) [`cc242d3af`](https://github.com/withastro/astro/commit/cc242d3af2cc39731cc40b07ac0aa1db687b2920) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Fix `tsc` compilation errors when `skipLibCheck` wasn't enabled + +- [#4667](https://github.com/withastro/astro/pull/4667) [`9290b2414`](https://github.com/withastro/astro/commit/9290b24143d753edd3daf25945990c25a58e5bde) Thanks [@Holben888](https://github.com/Holben888)! - Fix framework components on Vercel Edge + +- [#4645](https://github.com/withastro/astro/pull/4645) [`f27ca6ab3`](https://github.com/withastro/astro/commit/f27ca6ab3edbf0ef55e213ffd09aac454ce07995) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix client-side scripts reloads on dev server in windows + ## 1.1.7 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 56349a1ad3218..24a455c26a9de 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "1.1.7", + "version": "1.1.8", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/integrations/image/CHANGELOG.md b/packages/integrations/image/CHANGELOG.md index 8e79766bc580e..41ce91ed0efbc 100644 --- a/packages/integrations/image/CHANGELOG.md +++ b/packages/integrations/image/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/image +## 0.6.1 + +### Patch Changes + +- [#4678](https://github.com/withastro/astro/pull/4678) [`4c05c65a3`](https://github.com/withastro/astro/commit/4c05c65a3df5bae935afebc8a15ff52d5b912d8b) Thanks [@tony-sull](https://github.com/tony-sull)! - Updates the integration to build all optimized images to `dist/assets` during SSG builds + ## 0.6.0 ### Minor Changes diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index a72bf0ecd9fa8..bb6f552081fa9 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/image", "description": "Load and transform images in your Astro site.", - "version": "0.6.0", + "version": "0.6.1", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/packages/integrations/react/CHANGELOG.md b/packages/integrations/react/CHANGELOG.md index 0971832ec7f4a..d029111a58dba 100644 --- a/packages/integrations/react/CHANGELOG.md +++ b/packages/integrations/react/CHANGELOG.md @@ -1,5 +1,13 @@ # @astrojs/react +## 1.1.2 + +### Patch Changes + +- [#4679](https://github.com/withastro/astro/pull/4679) [`5986517b4`](https://github.com/withastro/astro/commit/5986517b4f29af90fcfe333d4bb69ac09d4f8778) Thanks [@matthewp](https://github.com/matthewp)! - Prevent decoder from leaking + +- [#4667](https://github.com/withastro/astro/pull/4667) [`9290b2414`](https://github.com/withastro/astro/commit/9290b24143d753edd3daf25945990c25a58e5bde) Thanks [@Holben888](https://github.com/Holben888)! - Fix framework components on Vercel Edge + ## 1.1.1 ### Patch Changes diff --git a/packages/integrations/react/package.json b/packages/integrations/react/package.json index 042c015671c3f..46a907c303105 100644 --- a/packages/integrations/react/package.json +++ b/packages/integrations/react/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/react", "description": "Use React components within Astro", - "version": "1.1.1", + "version": "1.1.2", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index feaff3ea7a91d..9b49c81aedd7b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,7 +56,7 @@ importers: examples/basics: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 dependencies: astro: link:../../packages/astro @@ -65,7 +65,7 @@ importers: '@astrojs/mdx': ^0.11.1 '@astrojs/rss': ^1.0.0 '@astrojs/sitemap': ^1.0.0 - astro: ^1.1.7 + astro: ^1.1.8 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx '@astrojs/rss': link:../../packages/astro-rss @@ -74,7 +74,7 @@ importers: examples/component: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 devDependencies: astro: link:../../packages/astro @@ -82,13 +82,13 @@ importers: specifiers: '@algolia/client-search': ^4.13.1 '@astrojs/preact': ^1.1.0 - '@astrojs/react': ^1.1.0 + '@astrojs/react': ^1.1.2 '@docsearch/css': ^3.1.0 '@docsearch/react': ^3.1.0 '@types/node': ^18.0.0 '@types/react': ^17.0.45 '@types/react-dom': ^18.0.0 - astro: ^1.1.7 + astro: ^1.1.8 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -111,7 +111,7 @@ importers: '@astrojs/alpinejs': ^0.1.2 '@types/alpinejs': ^3.7.0 alpinejs: ^3.10.2 - astro: ^1.1.7 + astro: ^1.1.8 dependencies: '@astrojs/alpinejs': link:../../packages/integrations/alpinejs '@types/alpinejs': 3.7.0 @@ -122,7 +122,7 @@ importers: specifiers: '@astrojs/lit': ^1.0.0 '@webcomponents/template-shadowroot': ^0.1.0 - astro: ^1.1.7 + astro: ^1.1.8 lit: ^2.2.5 dependencies: '@astrojs/lit': link:../../packages/integrations/lit @@ -133,11 +133,11 @@ importers: examples/framework-multiple: specifiers: '@astrojs/preact': ^1.1.0 - '@astrojs/react': ^1.1.0 + '@astrojs/react': ^1.1.2 '@astrojs/solid-js': ^1.1.0 '@astrojs/svelte': ^1.0.0 '@astrojs/vue': ^1.0.1 - astro: ^1.1.7 + astro: ^1.1.8 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -161,7 +161,7 @@ importers: examples/framework-preact: specifiers: '@astrojs/preact': ^1.1.0 - astro: ^1.1.7 + astro: ^1.1.8 preact: ^10.7.3 dependencies: '@astrojs/preact': link:../../packages/integrations/preact @@ -170,10 +170,10 @@ importers: examples/framework-react: specifiers: - '@astrojs/react': ^1.1.0 + '@astrojs/react': ^1.1.2 '@types/react': ^18.0.10 '@types/react-dom': ^18.0.5 - astro: ^1.1.7 + astro: ^1.1.8 react: ^18.1.0 react-dom: ^18.1.0 dependencies: @@ -187,7 +187,7 @@ importers: examples/framework-solid: specifiers: '@astrojs/solid-js': ^1.1.0 - astro: ^1.1.7 + astro: ^1.1.8 solid-js: ^1.4.3 dependencies: '@astrojs/solid-js': link:../../packages/integrations/solid @@ -197,7 +197,7 @@ importers: examples/framework-svelte: specifiers: '@astrojs/svelte': ^1.0.0 - astro: ^1.1.7 + astro: ^1.1.8 svelte: ^3.48.0 dependencies: '@astrojs/svelte': link:../../packages/integrations/svelte @@ -207,7 +207,7 @@ importers: examples/framework-vue: specifiers: '@astrojs/vue': ^1.0.1 - astro: ^1.1.7 + astro: ^1.1.8 vue: ^3.2.37 dependencies: '@astrojs/vue': link:../../packages/integrations/vue @@ -216,19 +216,19 @@ importers: examples/minimal: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 dependencies: astro: link:../../packages/astro examples/non-html-pages: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 dependencies: astro: link:../../packages/astro examples/portfolio: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 dependencies: astro: link:../../packages/astro @@ -236,7 +236,7 @@ importers: specifiers: '@astrojs/node': ^1.0.1 '@astrojs/svelte': ^1.0.0 - astro: ^1.1.7 + astro: ^1.1.8 concurrently: ^7.2.1 lightcookie: ^1.0.25 svelte: ^3.48.0 @@ -255,7 +255,7 @@ importers: examples/with-markdown-plugins: specifiers: '@astrojs/markdown-remark': ^1.1.0 - astro: ^1.1.7 + astro: ^1.1.8 hast-util-select: 5.0.1 rehype-autolink-headings: ^6.1.1 rehype-slug: ^5.0.1 @@ -272,7 +272,7 @@ importers: examples/with-markdown-shiki: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 dependencies: astro: link:../../packages/astro @@ -280,7 +280,7 @@ importers: specifiers: '@astrojs/mdx': ^0.11.1 '@astrojs/preact': ^1.1.0 - astro: ^1.1.7 + astro: ^1.1.8 preact: ^10.6.5 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx @@ -292,7 +292,7 @@ importers: specifiers: '@astrojs/preact': ^1.1.0 '@nanostores/preact': ^0.1.3 - astro: ^1.1.7 + astro: ^1.1.8 nanostores: ^0.5.12 preact: ^10.7.3 dependencies: @@ -305,7 +305,7 @@ importers: examples/with-tailwindcss: specifiers: '@astrojs/tailwind': ^1.0.0 - astro: ^1.1.7 + astro: ^1.1.8 autoprefixer: ^10.4.7 canvas-confetti: ^1.5.1 postcss: ^8.4.14 @@ -320,7 +320,7 @@ importers: examples/with-vite-plugin-pwa: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 vite-plugin-pwa: 0.11.11 workbox-window: ^6.5.3 dependencies: @@ -330,7 +330,7 @@ importers: examples/with-vitest: specifiers: - astro: ^1.1.7 + astro: ^1.1.8 vitest: ^0.20.3 dependencies: astro: link:../../packages/astro From c706d845ebf4786c33d2295954a98df8c5a7f183 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 9 Sep 2022 11:58:16 -0400 Subject: [PATCH 14/30] =?UTF-8?q?No=20=F0=9F=91=8F=20more=20=F0=9F=91=8F?= =?UTF-8?q?=20server=20=F0=9F=91=8F=20restarts=20=F0=9F=91=8F=20on=20?= =?UTF-8?q?=F0=9F=91=8F=20config=20=F0=9F=91=8F=20changes=20(#4578)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: restart config on add, remove, update * fix: reload for root project configs only * fix: throw when userConfigPath can't resolve * chore: changeset * wip: remove normalizePath before writeFile * refactor: invalidateWithCache -> isConfigReload * wip: mustExist? * debug: config loaded successfully * debug: more logs * debug: MORE logging * fix: normalize resolved config path * debug: yet MORE logging * chore: bump proload * fix: use file path, not URL.pathname * Revert "wip: mustExist?" This reverts commit 8ca8662132532dcdc9fd120868e615ddc60f498e. * chore: remove console log * feat: cleanup restart message, better invalid config handling * chore: update lockfile * chore: fix types * fix: throw helpful error when config does not exist * docs: remove "restart dev server" from integrations * docs: make sure to restart -> try restarting Co-authored-by: Nate Moore --- .changeset/tricky-cows-travel.md | 5 + packages/astro/package.json | 2 +- packages/astro/src/cli/index.ts | 108 ++++++++++++++------ packages/astro/src/core/add/index.ts | 5 +- packages/astro/src/core/config.ts | 104 +++++++++++-------- packages/astro/src/core/dev/index.ts | 3 + packages/astro/src/core/messages.ts | 4 +- packages/astro/src/vite-plugin-astro/hmr.ts | 1 + packages/integrations/alpinejs/README.md | 4 - packages/integrations/image/README.md | 5 +- packages/integrations/lit/README.md | 2 - packages/integrations/mdx/README.md | 4 - packages/integrations/partytown/README.md | 3 - packages/integrations/preact/README.md | 4 - packages/integrations/prefetch/README.md | 5 +- packages/integrations/react/README.md | 2 - packages/integrations/sitemap/README.md | 3 - packages/integrations/solid/README.md | 2 - packages/integrations/svelte/README.md | 2 - packages/integrations/tailwind/README.md | 5 +- packages/integrations/turbolinks/README.md | 2 - packages/integrations/vue/README.md | 2 - pnpm-lock.yaml | 2 +- 23 files changed, 155 insertions(+), 124 deletions(-) create mode 100644 .changeset/tricky-cows-travel.md diff --git a/.changeset/tricky-cows-travel.md b/.changeset/tricky-cows-travel.md new file mode 100644 index 0000000000000..0381d614c9af4 --- /dev/null +++ b/.changeset/tricky-cows-travel.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +Restart dev server when config file is added, updated, or removed diff --git a/packages/astro/package.json b/packages/astro/package.json index 24a455c26a9de..2fde818f8ccbf 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -106,7 +106,7 @@ "@babel/plugin-transform-react-jsx": "^7.17.12", "@babel/traverse": "^7.18.2", "@babel/types": "^7.18.4", - "@proload/core": "^0.3.2", + "@proload/core": "^0.3.3", "@proload/plugin-tsm": "^0.2.1", "@types/babel__core": "^7.1.19", "@types/html-escaper": "^3.0.0", diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts index 2511ada869f4d..4d60ffc5fab8d 100644 --- a/packages/astro/src/cli/index.ts +++ b/packages/astro/src/cli/index.ts @@ -1,14 +1,15 @@ /* eslint-disable no-console */ - +import type { Arguments as Flags } from 'yargs-parser' import * as colors from 'kleur/colors'; import yargs from 'yargs-parser'; import { z } from 'zod'; +import { normalizePath } from 'vite'; import add from '../core/add/index.js'; import build from '../core/build/index.js'; -import { openConfig } from '../core/config.js'; +import { openConfig, resolveConfigPath, resolveFlags, resolveRoot } from '../core/config.js'; import devServer from '../core/dev/index.js'; import { collectErrorMetadata } from '../core/errors.js'; -import { debug, info, LogOptions, warn } from '../core/logger/core.js'; +import { debug, error, info, LogOptions, warn } from '../core/logger/core.js'; import { enableVerboseLogging, nodeLogDestination } from '../core/logger/node.js'; import { formatConfigErrorMessage, formatErrorMessage, printHelp } from '../core/messages.js'; import preview from '../core/preview/index.js'; @@ -18,6 +19,8 @@ import { eventConfigError, eventError, telemetry } from '../events/index.js'; import { check } from './check/index.js'; import { openInBrowser } from './open.js'; import * as telemetryHandler from './telemetry.js'; +import { appendForwardSlash } from '../core/path.js'; +import { pathToFileURL } from 'url' type Arguments = yargs.Arguments; type CLICommand = @@ -81,6 +84,16 @@ function resolveCommand(flags: Arguments): CLICommand { return 'help'; } +async function handleConfigError(e: any, { cwd, flags, logging }: { cwd?: string; flags?: Flags, logging: LogOptions }) { + const path = await resolveConfigPath({ cwd, flags }); + if (e instanceof Error) { + if (path) { + error(logging, 'astro', `Unable to load ${colors.bold(path)}\n`); + } + console.error(formatErrorMessage(collectErrorMetadata(e, path ? pathToFileURL(path) : undefined)) + '\n') + } +} + /** * Run the given command with the given flags. * NOTE: This function provides no error handling, so be sure @@ -132,12 +145,16 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { } } - let { astroConfig, userConfig, userConfigPath } = await openConfig({ - cwd: root, - flags, - cmd, - logging, - }); + let { astroConfig, userConfig } = await openConfig({ + cwd: root, + flags, + cmd, + logging, + }).catch(async (e) => { + await handleConfigError(e, { cwd: root, flags, logging }) + return {} as any; + }); + if (!astroConfig) return; telemetry.record(event.eventCliSession(cmd, userConfig, flags)); // Common CLI Commands: @@ -145,33 +162,56 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { // by the end of this switch statement. switch (cmd) { case 'dev': { - async function startDevServer() { - const { watcher, stop } = await devServer(astroConfig, { logging, telemetry }); - - watcher.on('change', logRestartServerOnConfigChange); - watcher.on('unlink', logRestartServerOnConfigChange); - function logRestartServerOnConfigChange(changedFile: string) { - if (userConfigPath === changedFile) { - warn(logging, 'astro', 'Astro config updated. Restart server to see changes!'); - } - } - - watcher.on('add', async function restartServerOnNewConfigFile(addedFile: string) { - // if there was not a config before, attempt to resolve - if (!userConfigPath && addedFile.includes('astro.config')) { - const addedConfig = await openConfig({ cwd: root, flags, cmd, logging }); - if (addedConfig.userConfigPath) { - info(logging, 'astro', 'Astro config detected. Restarting server...'); - astroConfig = addedConfig.astroConfig; - userConfig = addedConfig.userConfig; - userConfigPath = addedConfig.userConfigPath; - await stop(); - await startDevServer(); + async function startDevServer({ isRestart = false }: { isRestart?: boolean } = {}) { + const { watcher, stop } = await devServer(astroConfig, { logging, telemetry, isRestart }); + let restartInFlight = false; + const configFlag = resolveFlags(flags).config; + const configFlagPath = configFlag + ? await resolveConfigPath({ cwd: root, flags }) + : undefined; + const resolvedRoot = appendForwardSlash(resolveRoot(root)); + + const handleServerRestart = (logMsg: string) => + async function (changedFile: string) { + if ( + !restartInFlight && + (configFlag + ? // If --config is specified, only watch changes for this file + configFlagPath && normalizePath(configFlagPath) === normalizePath(changedFile) + : // Otherwise, watch for any astro.config.* file changes in project root + new RegExp( + `${normalizePath(resolvedRoot)}.*astro\.config\.((mjs)|(cjs)|(js)|(ts))$` + ).test(normalizePath(changedFile))) + ) { + restartInFlight = true; + console.clear() + try { + const newConfig = await openConfig({ + cwd: root, + flags, + cmd, + logging, + isConfigReload: true, + }); + info(logging, 'astro', logMsg + '\n'); + astroConfig = newConfig.astroConfig; + await stop(); + await startDevServer({ isRestart: true }); + } catch (e) { + await handleConfigError(e, { cwd: root, flags, logging }) + await stop(); + info(logging, 'astro', 'Continuing with previous valid configuration\n'); + await startDevServer({ isRestart: true }); + + } } - } - }); + }; + + watcher.on('change', handleServerRestart('Configuration updated. Restarting...')); + watcher.on('unlink', handleServerRestart('Configuration removed. Restarting...')); + watcher.on('add', handleServerRestart('Configuration added. Restarting...')); } - await startDevServer(); + await startDevServer({ isRestart: false }); return await new Promise(() => {}); // lives forever } diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 779349999f914..678004b081b4e 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -10,7 +10,7 @@ import preferredPM from 'preferred-pm'; import prompts from 'prompts'; import { fileURLToPath, pathToFileURL } from 'url'; import type yargs from 'yargs-parser'; -import { resolveConfigURL } from '../config.js'; +import { resolveConfigPath } from '../config.js'; import { debug, info, LogOptions } from '../logger/core.js'; import * as msg from '../messages.js'; import { printHelp } from '../messages.js'; @@ -97,7 +97,8 @@ export default async function add(names: string[], { cwd, flags, logging, teleme } let configURL: URL | undefined; const root = pathToFileURL(cwd ? path.resolve(cwd) : process.cwd()); - configURL = await resolveConfigURL({ cwd, flags }); + const rawConfigPath = await resolveConfigPath({ cwd, flags }); + configURL = rawConfigPath ? pathToFileURL(rawConfigPath) : undefined; applyPolyfill(); if (configURL) { diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index aa8d701e78fee..d56f99958f99f 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -3,6 +3,7 @@ import type * as Postcss from 'postcss'; import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki'; import type { Arguments as Flags } from 'yargs-parser'; import type { AstroConfig, AstroUserConfig, CLIFlags, ViteUserConfig } from '../@types/astro'; +import fs from 'fs'; import load, { ProloadError, resolve } from '@proload/core'; import loadTypeScript from '@proload/plugin-tsm'; @@ -361,7 +362,7 @@ export async function validateConfig( } /** Convert the generic "yargs" flag object into our own, custom TypeScript object. */ -function resolveFlags(flags: Partial): CLIFlags { +export function resolveFlags(flags: Partial): CLIFlags { return { root: typeof flags.root === 'string' ? flags.root : undefined, site: typeof flags.site === 'string' ? flags.site : undefined, @@ -373,6 +374,10 @@ function resolveFlags(flags: Partial): CLIFlags { }; } +export function resolveRoot(cwd?: string): string { + return cwd ? path.resolve(cwd) : process.cwd(); +} + /** Merge CLI flags & user config object (CLI flags take priority) */ function mergeCLIFlags(astroConfig: AstroUserConfig, flags: CLIFlags, cmd: string) { astroConfig.server = astroConfig.server || {}; @@ -398,6 +403,8 @@ interface LoadConfigOptions { cmd: string; validate?: boolean; logging: LogOptions; + /** Invalidate when reloading a previously loaded config */ + isConfigReload?: boolean; } /** @@ -405,10 +412,10 @@ interface LoadConfigOptions { * Note: currently the same as loadConfig but only returns the `filePath` * instead of the resolved config */ -export async function resolveConfigURL( +export async function resolveConfigPath( configOptions: Pick -): Promise { - const root = configOptions.cwd ? path.resolve(configOptions.cwd) : process.cwd(); +): Promise { + const root = resolveRoot(configOptions.cwd); const flags = resolveFlags(configOptions.flags || {}); let userConfigPath: string | undefined; @@ -419,19 +426,23 @@ export async function resolveConfigURL( // Resolve config file path using Proload // If `userConfigPath` is `undefined`, Proload will search for `astro.config.[cm]?[jt]s` - const configPath = await resolve('astro', { - mustExist: false, - cwd: root, - filePath: userConfigPath, - }); - if (configPath) { - return pathToFileURL(configPath); + try { + const configPath = await resolve('astro', { + mustExist: !!userConfigPath, + cwd: root, + filePath: userConfigPath, + }); + return configPath; + } catch (e) { + if (e instanceof ProloadError && flags.config) { + throw new Error(`Unable to resolve --config "${flags.config}"! Does the file exist?`); + } + throw e } } interface OpenConfigResult { userConfig: AstroUserConfig; - userConfigPath: string | undefined; astroConfig: AstroConfig; flags: CLIFlags; root: string; @@ -439,22 +450,13 @@ interface OpenConfigResult { /** Load a configuration file, returning both the userConfig and astroConfig */ export async function openConfig(configOptions: LoadConfigOptions): Promise { - const root = configOptions.cwd ? path.resolve(configOptions.cwd) : process.cwd(); + const root = resolveRoot(configOptions.cwd); const flags = resolveFlags(configOptions.flags || {}); let userConfig: AstroUserConfig = {}; - let userConfigPath: string | undefined; - - if (flags?.config) { - userConfigPath = /^\.*\//.test(flags.config) ? flags.config : `./${flags.config}`; - userConfigPath = fileURLToPath( - new URL(userConfigPath, appendForwardSlash(pathToFileURL(root).toString())) - ); - } - const config = await tryLoadConfig(configOptions, flags, userConfigPath, root); + const config = await tryLoadConfig(configOptions, flags, root); if (config) { userConfig = config.value; - userConfigPath = config.filePath; } const astroConfig = await resolveConfig( userConfig, @@ -467,7 +469,6 @@ export async function openConfig(configOptions: LoadConfigOptions): Promise { + let finallyCleanup = async () => {}; try { - // Automatically load config file using Proload - // If `userConfigPath` is `undefined`, Proload will search for `astro.config.[cm]?[jt]s` + let configPath = await resolveConfigPath({ + cwd: configOptions.cwd, + flags: configOptions.flags, + }); + if (!configPath) return undefined; + if (configOptions.isConfigReload) { + // Hack: Write config to temporary file at project root + // This invalidates and reloads file contents when using ESM imports or "resolve" + const tempConfigPath = path.join( + root, + `.temp.${Date.now()}.config${path.extname(configPath)}` + ); + await fs.promises.writeFile(tempConfigPath, await fs.promises.readFile(configPath)); + finallyCleanup = async () => { + try { + await fs.promises.unlink(tempConfigPath); + } catch { + /** file already removed */ + } + }; + configPath = tempConfigPath; + } + const config = await load('astro', { - mustExist: !!userConfigPath, + mustExist: !!configPath, cwd: root, - filePath: userConfigPath, + filePath: configPath, }); return config as TryLoadConfigResult; @@ -499,28 +521,32 @@ async function tryLoadConfig( throw new Error(`Unable to resolve --config "${flags.config}"! Does the file exist?`); } - const configURL = await resolveConfigURL(configOptions); - if (!configURL) { + const configPath = await resolveConfigPath(configOptions); + if (!configPath) { throw e; } // Fallback to use Vite DevServer const viteServer = await vite.createServer({ server: { middlewareMode: true, hmr: false }, + optimizeDeps: { entries: [] }, + clearScreen: false, appType: 'custom', }); try { - const mod = await viteServer.ssrLoadModule(fileURLToPath(configURL)); + const mod = await viteServer.ssrLoadModule(configPath); if (mod?.default) { return { value: mod.default, - filePath: fileURLToPath(configURL), + filePath: configPath, }; } } finally { await viteServer.close(); } + } finally { + await finallyCleanup(); } } @@ -529,19 +555,11 @@ async function tryLoadConfig( * @deprecated */ export async function loadConfig(configOptions: LoadConfigOptions): Promise { - const root = configOptions.cwd ? path.resolve(configOptions.cwd) : process.cwd(); + const root = resolveRoot(configOptions.cwd); const flags = resolveFlags(configOptions.flags || {}); let userConfig: AstroUserConfig = {}; - let userConfigPath: string | undefined; - - if (flags?.config) { - userConfigPath = /^\.*\//.test(flags.config) ? flags.config : `./${flags.config}`; - userConfigPath = fileURLToPath( - new URL(userConfigPath, appendForwardSlash(pathToFileURL(root).toString())) - ); - } - const config = await tryLoadConfig(configOptions, flags, userConfigPath, root); + const config = await tryLoadConfig(configOptions, flags, root); if (config) { userConfig = config.value; } diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index b768093ed7ecd..d7b0780acc399 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -18,6 +18,7 @@ import { apply as applyPolyfill } from '../polyfill.js'; export interface DevOptions { logging: LogOptions; telemetry: AstroTelemetry; + isRestart?: boolean; } export interface DevServer { @@ -33,6 +34,7 @@ export default async function dev(config: AstroConfig, options: DevOptions): Pro await options.telemetry.record([]); config = await runHookConfigSetup({ config, command: 'dev', logging: options.logging }); const { host, port } = config.server; + const { isRestart = false } = options; // The client entrypoint for renderers. Since these are imported dynamically // we need to tell Vite to preoptimize them. @@ -66,6 +68,7 @@ export default async function dev(config: AstroConfig, options: DevOptions): Pro devServerAddressInfo, site, https: !!viteConfig.server?.https, + isRestart }) ); diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index 0c74f8cbed0af..a2ce5c2042beb 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -58,12 +58,14 @@ export function devStart({ config, https, site, + isRestart = false }: { startupTime: number; devServerAddressInfo: AddressInfo; config: AstroConfig; https: boolean; site: URL | undefined; + isRestart?: boolean }): string { // PACKAGE_VERSION is injected at build-time const version = process.env.PACKAGE_VERSION ?? '0.0.0'; @@ -106,7 +108,7 @@ export function devStart({ const messages = [ `${emoji('🚀 ', '')}${bgGreen(black(` astro `))} ${green(`v${version}`)} ${dim( - `started in ${Math.round(startupTime)}ms` + `${isRestart ? 're' : ''}started in ${Math.round(startupTime)}ms` )}`, '', local, diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts index 330ae2e1a3175..a91874240d475 100644 --- a/packages/astro/src/vite-plugin-astro/hmr.ts +++ b/packages/astro/src/vite-plugin-astro/hmr.ts @@ -125,6 +125,7 @@ export async function handleHotUpdate( // TODO: Svelte files should be marked as `isSelfAccepting` but they don't appear to be const isSelfAccepting = mods.every((m) => m.isSelfAccepting || m.url.endsWith('.svelte')); if (isSelfAccepting) { + if (/astro\.config\.[cm][jt]s$/.test(file)) return mods; info(logging, 'astro', msg.hmr({ file })); } else { info(logging, 'astro', msg.reload({ file })); diff --git a/packages/integrations/alpinejs/README.md b/packages/integrations/alpinejs/README.md index 9eaf4538244fd..7e7484767304d 100644 --- a/packages/integrations/alpinejs/README.md +++ b/packages/integrations/alpinejs/README.md @@ -25,8 +25,6 @@ yarn astro add alpinejs pnpm astro add alpinejs ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -56,8 +54,6 @@ export default defineConfig({ }); ``` -Finally, restart the dev server. - ## Usage Once the integration is installed, you can use [Alpine.js](https://alpinejs.dev/) directives and syntax inside any Astro component. The Alpine.js script is automatically added and enabled on every page of your website. diff --git a/packages/integrations/image/README.md b/packages/integrations/image/README.md index fda9727e6b31a..d1eb00ab3797d 100644 --- a/packages/integrations/image/README.md +++ b/packages/integrations/image/README.md @@ -36,8 +36,6 @@ yarn astro add image pnpm astro add image ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -58,7 +56,6 @@ export default { integrations: [image()], } ``` -Then, restart the dev server. ### Update `env.d.ts` @@ -469,7 +466,7 @@ const imageUrl = 'https://www.google.com/images/branding/googlelogo/2x/googlelog ``` ## Troubleshooting -- If your installation doesn't seem to be working, make sure to restart the dev server. +- If your installation doesn't seem to be working, try restarting the dev server. - If you edit and save a file and don't see your site update accordingly, try refreshing the page. - If refreshing the page doesn't update your preview, or if a new installation doesn't seem to be working, then restart the dev server. diff --git a/packages/integrations/lit/README.md b/packages/integrations/lit/README.md index 97b836bc0d927..af3f78238e9f8 100644 --- a/packages/integrations/lit/README.md +++ b/packages/integrations/lit/README.md @@ -23,8 +23,6 @@ yarn astro add lit pnpm astro add lit ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Install dependencies manually diff --git a/packages/integrations/mdx/README.md b/packages/integrations/mdx/README.md index 2ce12d9cda4ce..52568ea044a4a 100644 --- a/packages/integrations/mdx/README.md +++ b/packages/integrations/mdx/README.md @@ -33,8 +33,6 @@ yarn astro add mdx pnpm astro add mdx ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -59,8 +57,6 @@ export default defineConfig({ }); ``` -Finally, restart the dev server. - ## Usage You can [add MDX pages to your project](https://docs.astro.build/en/guides/markdown-content/#markdown-and-mdx-pages) by adding `.mdx` files within your `src/pages/` directory. diff --git a/packages/integrations/partytown/README.md b/packages/integrations/partytown/README.md index 6ff8dd200bf21..ab1f15eb06f82 100644 --- a/packages/integrations/partytown/README.md +++ b/packages/integrations/partytown/README.md @@ -35,8 +35,6 @@ yarn astro add partytown pnpm astro add partytown ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -59,7 +57,6 @@ export default defineConfig({ }) ``` -Then, restart the dev server. ## Usage diff --git a/packages/integrations/preact/README.md b/packages/integrations/preact/README.md index 2a8779737b248..742d3654b5bb1 100644 --- a/packages/integrations/preact/README.md +++ b/packages/integrations/preact/README.md @@ -35,8 +35,6 @@ yarn astro add preact pnpm astro add preact ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -67,8 +65,6 @@ export default defineConfig({ }); ``` -Finally, restart the dev server. - ## Usage To use your first Preact component in Astro, head to our [UI framework documentation][astro-ui-frameworks]. You'll explore: diff --git a/packages/integrations/prefetch/README.md b/packages/integrations/prefetch/README.md index e3ae6e72af0a6..009cd5fdae836 100644 --- a/packages/integrations/prefetch/README.md +++ b/packages/integrations/prefetch/README.md @@ -29,8 +29,6 @@ yarn astro add prefetch pnpm astro add prefetch ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -52,7 +50,6 @@ export default { } ``` -Then, restart the dev server. ## Usage @@ -94,7 +91,7 @@ export default { ``` ## Troubleshooting -- If your installation doesn't seem to be working, make sure to restart the dev server. +- If your installation doesn't seem to be working, try restarting the dev server. - If a link doesn't seem to be prefetching, make sure that the link is pointing to a page on the same domain and matches the integration's `selector` option. For help, check out the `#support-threads` channel on [Discord](https://astro.build/chat). Our friendly Support Squad members are here to help! diff --git a/packages/integrations/react/README.md b/packages/integrations/react/README.md index 1e502b6c01bd9..e254ee90104c8 100644 --- a/packages/integrations/react/README.md +++ b/packages/integrations/react/README.md @@ -23,8 +23,6 @@ yarn astro add react pnpm astro add react ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Install dependencies manually diff --git a/packages/integrations/sitemap/README.md b/packages/integrations/sitemap/README.md index 58a3cc1d681bd..b05c5aac2774c 100644 --- a/packages/integrations/sitemap/README.md +++ b/packages/integrations/sitemap/README.md @@ -35,8 +35,6 @@ yarn astro add sitemap pnpm astro add sitemap ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -59,7 +57,6 @@ export default defineConfig({ }) ``` -Then, restart the dev server. ## Usage diff --git a/packages/integrations/solid/README.md b/packages/integrations/solid/README.md index 5afe62c116faa..63daaefdf1ecb 100644 --- a/packages/integrations/solid/README.md +++ b/packages/integrations/solid/README.md @@ -23,8 +23,6 @@ yarn astro add solid pnpm astro add solid ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Install dependencies manually diff --git a/packages/integrations/svelte/README.md b/packages/integrations/svelte/README.md index 8acd41a6f9535..9c48177e87886 100644 --- a/packages/integrations/svelte/README.md +++ b/packages/integrations/svelte/README.md @@ -23,8 +23,6 @@ yarn astro add svelte pnpm astro add svelte ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Install dependencies manually diff --git a/packages/integrations/tailwind/README.md b/packages/integrations/tailwind/README.md index df10020384455..9eaf95452741f 100644 --- a/packages/integrations/tailwind/README.md +++ b/packages/integrations/tailwind/README.md @@ -38,8 +38,6 @@ yarn astro add tailwind pnpm astro add tailwind ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Manual Install @@ -61,7 +59,6 @@ export default { } ``` -Then, restart the dev server. ## Usage @@ -154,7 +151,7 @@ module.exports = { - [Browse Astro Tailwind projects on GitHub](https://github.com/search?q=%22%40astrojs%2Ftailwind%22+filename%3Apackage.json&type=Code) for more examples! ## Troubleshooting -- If your installation doesn't seem to be working, make sure to restart the dev server. +- If your installation doesn't seem to be working, try restarting the dev server. - If you edit and save a file and don't see your site update accordingly, try refreshing the page. - If refreshing the page doesn't update your preview, or if a new installation doesn't seem to be working, then restart the dev server. diff --git a/packages/integrations/turbolinks/README.md b/packages/integrations/turbolinks/README.md index 15ece47211d47..569015d85affd 100644 --- a/packages/integrations/turbolinks/README.md +++ b/packages/integrations/turbolinks/README.md @@ -33,8 +33,6 @@ yarn astro add turbolinks pnpm astro add turbolinks ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Install dependencies manually diff --git a/packages/integrations/vue/README.md b/packages/integrations/vue/README.md index 66b320629ade8..9666bf394baaa 100644 --- a/packages/integrations/vue/README.md +++ b/packages/integrations/vue/README.md @@ -23,8 +23,6 @@ yarn astro add vue pnpm astro add vue ``` -Finally, in the terminal window running Astro, press `CTRL+C` and then restart the dev server. - If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. ### Install dependencies manually diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9b49c81aedd7b..5e7d1dce1abad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -350,7 +350,7 @@ importers: '@babel/traverse': ^7.18.2 '@babel/types': ^7.18.4 '@playwright/test': ^1.22.2 - '@proload/core': ^0.3.2 + '@proload/core': ^0.3.3 '@proload/plugin-tsm': ^0.2.1 '@types/babel__core': ^7.1.19 '@types/babel__generator': ^7.6.4 From 255636cc7b4ed5f72045f75a2411ebd84a2bdb0d Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 9 Sep 2022 08:58:24 -0700 Subject: [PATCH 15/30] Add support for custom non-html route encoding (#4549) * Add custom encoding support for non-html routes * Add changeset * Add tests for png and json routes --- .changeset/stale-camels-invent.md | 5 +++ packages/astro/src/@types/astro.ts | 1 + packages/astro/src/core/build/generate.ts | 4 +- packages/astro/src/core/endpoint/index.ts | 2 + .../test/fixtures/non-html-pages/package.json | 8 ++++ .../non-html-pages/src/images/placeholder.png | Bin 0 -> 1040 bytes .../non-html-pages/src/pages/about.json.ts | 11 +++++ .../src/pages/placeholder.png.ts | 17 ++++++++ packages/astro/test/non-html-pages.test.js | 38 ++++++++++++++++++ packages/astro/test/test-utils.js | 4 +- pnpm-lock.yaml | 6 +++ 11 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 .changeset/stale-camels-invent.md create mode 100644 packages/astro/test/fixtures/non-html-pages/package.json create mode 100644 packages/astro/test/fixtures/non-html-pages/src/images/placeholder.png create mode 100644 packages/astro/test/fixtures/non-html-pages/src/pages/about.json.ts create mode 100644 packages/astro/test/fixtures/non-html-pages/src/pages/placeholder.png.ts create mode 100644 packages/astro/test/non-html-pages.test.js diff --git a/.changeset/stale-camels-invent.md b/.changeset/stale-camels-invent.md new file mode 100644 index 0000000000000..e3d88bc33a381 --- /dev/null +++ b/.changeset/stale-camels-invent.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +Allow specifying custom encoding when using a non-html route. Only option before was 'utf-8' and now that is just the default. diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index b2347c4106267..c358d63e7901f 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1085,6 +1085,7 @@ export interface APIContext { export interface EndpointOutput { body: Body; + encoding?: BufferEncoding; } export type APIRoute = ( diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 406186a21d8ee..b6ebf469718b5 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -391,6 +391,7 @@ async function generatePath( }; let body: string; + let encoding: BufferEncoding | undefined; if (pageData.route.type === 'endpoint') { const result = await callEndpoint(mod as unknown as EndpointHandler, options); @@ -398,6 +399,7 @@ async function generatePath( throw new Error(`Returning a Response from an endpoint is not supported in SSG mode.`); } body = result.body; + encoding = result.encoding; } else { const response = await render(options); @@ -413,5 +415,5 @@ async function generatePath( const outFile = getOutFile(astroConfig, outFolder, pathname, pageData.route.type); pageData.route.distURL = outFile; await fs.promises.mkdir(outFolder, { recursive: true }); - await fs.promises.writeFile(outFile, body, 'utf-8'); + await fs.promises.writeFile(outFile, body, encoding ?? 'utf-8'); } diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index 9e974ee366afc..73c96ae6447f6 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -21,6 +21,7 @@ type EndpointCallResult = | { type: 'simple'; body: string; + encoding?: BufferEncoding; } | { type: 'response'; @@ -52,5 +53,6 @@ export async function call( return { type: 'simple', body: response.body, + encoding: response.encoding, }; } diff --git a/packages/astro/test/fixtures/non-html-pages/package.json b/packages/astro/test/fixtures/non-html-pages/package.json new file mode 100644 index 0000000000000..c3a215d98d569 --- /dev/null +++ b/packages/astro/test/fixtures/non-html-pages/package.json @@ -0,0 +1,8 @@ +{ + "name": "@test/non-html-pages", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*" + } +} diff --git a/packages/astro/test/fixtures/non-html-pages/src/images/placeholder.png b/packages/astro/test/fixtures/non-html-pages/src/images/placeholder.png new file mode 100644 index 0000000000000000000000000000000000000000..62841efdbff9f711167ef42e9a6f984137800c72 GIT binary patch literal 1040 zcmeAS@N?(olHy`uVBq!ia0vp^DL_1pgAGV(?9g>%U|_!P>Eakt5%>0HZl02%K+D6k zfjj=s6mY*OI`IS(<1zWGZ#VsY_PuB0tA)3WAHJ@!`~Uawd|#&ch8qzz`78qZ{0?Vq z7#NS}GH(7`(8iE7t>I=_28Ti#=ZxHT>T%O|waxKczKTPCy7$$ui}mL*EfISdyTbTE zMDq%Td5v=tbsQHdq%~}0K6z-z!yQ|XvZ+WP+Nvw2u-I_UEhCvDtcO`sH9Dl*m`@o9 zg!f$3aCW$3=(cD{^O+_?F4hT6^>L~DRxfEfbFHs>wayfi2{R3ij*Ba>DrZ|x5WO|A zbu%o^JzA8)=;ZuM zSYWM#vy0=ZX^bvYmn6uF9xK(BdDXxnWDwod#t=09K;C<$YrHq##=3M07Oh|oGWVUg zewuyiUAu(o8%>KF9Wm{`Wb4FB z6GYv`6+XSM_}w&7B9k|ArRwR1H4Q?&6K_qpIe(Xt0mDiQuW76^3rkWHc`{GrEY=oI z);PiAd-9kB-=iKQro&7}1XD%YcsqnodGI*QldE=5zR|Gb?>{>swJ+j_Cw@zu&T%s>Iq_v)K^JI)B#6( zuwsAIBGIMXEoFPI`>-=U-Vvp%ah8|yiNupCS6we*4vAC=-TuQ@6%wu_UfISn;aAP< zcN(&>p$c0TpM3OunUILXFQaw4qPd)`S8b}V{wU~G=*(cq#OT}{_(>w>ihx6p!+{G) zGFzW)P;8KBY!Gbz`10-FWM_s>=E`;^kDO=n;q_nrK8dxIJ@K$z%rI$k^~c%P3dRiv z>x!nnJAUnS8v~O^9#h) { + let fixture; + + before(async () => { + fixture = await loadFixture({ root: './fixtures/non-html-pages/' }); + await fixture.build(); + }); + + describe('json', () => { + it('should match contents', async () => { + const json = JSON.parse(await fixture.readFile('/about.json')); + expect(json).to.have.property('name', 'Astro'); + expect(json).to.have.property('url', 'https://astro.build/'); + }); + }); + + describe('png', () => { + it('should not have had its encoding mangled', async () => { + const buffer = await fixture.readFile('/placeholder.png', 'base64'); + + // Sanity check the first byte + const hex = Buffer.from(buffer, 'base64').toString('hex'); + const firstHexByte = hex.slice(0, 2); + // If we accidentally utf8 encode the png, the first byte (in hex) will be 'c2' + expect(firstHexByte).to.not.equal('c2'); + // and if correctly encoded in binary, it should be '89' + expect(firstHexByte).to.equal('89'); + + // Make sure the whole buffer (in base64) matches this snapshot + expect(buffer).to.equal( + 'iVBORw0KGgoAAAANSUhEUgAAAGQAAACWCAYAAAAouC1GAAAD10lEQVR4Xu3ZbW4iMRCE4c1RuP+ZEEfZFZHIAgHGH9Xtsv3m94yx6qHaM+HrfD7//cOfTQJfgNhYfG8EEC8PQMw8AAHELQGz/XCGAGKWgNl2aAggZgmYbYeGAGKWgNl2aAggZgmYbYeGAGKWgNl2aAggZgmYbYeGAGKWgNl2aAggZgmYbYeGAGKWgNl2aAggZgmYbYeGAGKWgNl2aAggZgmYbWe6hpxOp6oIL5dL1fWjL54CpBbhXagz4FiDqCCegZxhLEGiIGaAsQPJwrjhuLXFBiQbwrUtFiCjMZzaMhzEBcMFZSiIG4YDyjAQV4zRKENA3DFGoqSDzIIxCgWQgn9eZb6rpILM1o57qyyUNJCZMTLHFyAFI2s5kBXakYWS0hBAymsYDrISRkZLACn/8j5cGfXUFQqyYjuiWwJIY0Out0W0JAxk5XZEtgQQGtKRgOGt6rEV0pAdxlXU2AKks3U0pDPAiNuVKDREIGQNstP5EXGOyBsCSF/lAOnL7/tuRpYgRPUSKhQaIpIBRBSkahlAVEmK1gFEFKRqGUuQHR951e8i0kMdkP6+SUGu29kVxXJkAUJD+hMQrUBDREGqlgFElaRgHRXGdSsc6oAIEjBbgoYAUpfAbu8i1g3Z7V1EiRFyqANSN02er5Y/Zd0+YJexNUVDdmmJGiNsZAHSPrbCRtYOKFM1ZHWQCIzQkbX64Q5I+1iW3xmFkdKQFUcXIPLvePuCkRhpDVmpJcuArIASjZHakNmfujIwAKk4SpYFmXF0ZWEMachsoysTYyjIDE3JxhgO4owyAsMCxBFlFIYNiBPKSAxAnh57R2PYgLj9/j4SJvQXw5L3LjeM+z2PgBkG4gzx/EXKhEkHmQliRFvSQGaFyEZJAVkB4wYTPb7CQVbCyEAJA1kRImN8hYCsjhHZFDnILhhRKICUvL0eXKM86KUgu7Uj4kyRgeyMoRxfEhAw/neld3x1g4Dx+4DpQQFEcKi/WqIVpQuEdrzXTAcB47haLSjNDQHkGOR6RS1KEwgYZRgtj8PVIGDUYdS2BJD6fJvuKB1dVSC0o8ni56YSFED6Mq66WwpCO6qyf3vxEUpxQwAxAgFDg1HyGFzUEECMQMDQYhy15LAhgBiBgBGD8ent/WNDAIkDeYcCSGzmH1d/9U7yFoR25Eg9owCSk3vxmzsgM4AwrnKV7sfWy4YAAkhuAmaf9rEhtCNfC5D8zA8/8Yby6wyhIYfZhVwASEis7Yu+BKEd7YH23glIb4IB919RHs4QGhKQcsWSgFSElXEpIBkpV3zGAwjjqiK5oEsBCQq2Z9l/4WuAC09sfQEAAAAASUVORK5CYII=' + ); + }); + }); +}); diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js index c6150b26bb2b4..59a9253140c20 100644 --- a/packages/astro/test/test-utils.js +++ b/packages/astro/test/test-utils.js @@ -146,8 +146,8 @@ export async function loadFixture(inlineConfig) { const previewServer = await preview(config, { logging, telemetry, ...opts }); return previewServer; }, - readFile: (filePath) => - fs.promises.readFile(new URL(filePath.replace(/^\//, ''), config.outDir), 'utf8'), + readFile: (filePath, encoding) => + fs.promises.readFile(new URL(filePath.replace(/^\//, ''), config.outDir), encoding ?? 'utf8'), readdir: (fp) => fs.promises.readdir(new URL(fp.replace(/^\//, ''), config.outDir)), glob: (p) => fastGlob(p, { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5e7d1dce1abad..e5c2a6f1efed5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1666,6 +1666,12 @@ importers: packages/astro/test/fixtures/multiple-renderers/renderers/two: specifiers: {} + packages/astro/test/fixtures/non-html-pages: + specifiers: + astro: workspace:* + dependencies: + astro: link:../../.. + packages/astro/test/fixtures/page-format: specifiers: astro: workspace:* From 64f11c4ceee3eb38add28a1973886356ff6c8e0b Mon Sep 17 00:00:00 2001 From: matthewp Date: Fri, 9 Sep 2022 16:00:38 +0000 Subject: [PATCH 16/30] [ci] format --- packages/astro/src/cli/index.ts | 44 +++++++++++++++------------- packages/astro/src/core/config.ts | 4 +-- packages/astro/src/core/dev/index.ts | 2 +- packages/astro/src/core/messages.ts | 4 +-- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts index 4d60ffc5fab8d..622505700adb5 100644 --- a/packages/astro/src/cli/index.ts +++ b/packages/astro/src/cli/index.ts @@ -1,17 +1,19 @@ /* eslint-disable no-console */ -import type { Arguments as Flags } from 'yargs-parser' import * as colors from 'kleur/colors'; +import { pathToFileURL } from 'url'; +import { normalizePath } from 'vite'; +import type { Arguments as Flags } from 'yargs-parser'; import yargs from 'yargs-parser'; import { z } from 'zod'; -import { normalizePath } from 'vite'; import add from '../core/add/index.js'; import build from '../core/build/index.js'; import { openConfig, resolveConfigPath, resolveFlags, resolveRoot } from '../core/config.js'; import devServer from '../core/dev/index.js'; import { collectErrorMetadata } from '../core/errors.js'; -import { debug, error, info, LogOptions, warn } from '../core/logger/core.js'; +import { debug, error, info, LogOptions } from '../core/logger/core.js'; import { enableVerboseLogging, nodeLogDestination } from '../core/logger/node.js'; import { formatConfigErrorMessage, formatErrorMessage, printHelp } from '../core/messages.js'; +import { appendForwardSlash } from '../core/path.js'; import preview from '../core/preview/index.js'; import { ASTRO_VERSION, createSafeError } from '../core/util.js'; import * as event from '../events/index.js'; @@ -19,8 +21,6 @@ import { eventConfigError, eventError, telemetry } from '../events/index.js'; import { check } from './check/index.js'; import { openInBrowser } from './open.js'; import * as telemetryHandler from './telemetry.js'; -import { appendForwardSlash } from '../core/path.js'; -import { pathToFileURL } from 'url' type Arguments = yargs.Arguments; type CLICommand = @@ -84,13 +84,18 @@ function resolveCommand(flags: Arguments): CLICommand { return 'help'; } -async function handleConfigError(e: any, { cwd, flags, logging }: { cwd?: string; flags?: Flags, logging: LogOptions }) { +async function handleConfigError( + e: any, + { cwd, flags, logging }: { cwd?: string; flags?: Flags; logging: LogOptions } +) { const path = await resolveConfigPath({ cwd, flags }); if (e instanceof Error) { if (path) { error(logging, 'astro', `Unable to load ${colors.bold(path)}\n`); } - console.error(formatErrorMessage(collectErrorMetadata(e, path ? pathToFileURL(path) : undefined)) + '\n') + console.error( + formatErrorMessage(collectErrorMetadata(e, path ? pathToFileURL(path) : undefined)) + '\n' + ); } } @@ -145,16 +150,16 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { } } - let { astroConfig, userConfig } = await openConfig({ - cwd: root, - flags, - cmd, - logging, - }).catch(async (e) => { - await handleConfigError(e, { cwd: root, flags, logging }) - return {} as any; - }); - if (!astroConfig) return; + let { astroConfig, userConfig } = await openConfig({ + cwd: root, + flags, + cmd, + logging, + }).catch(async (e) => { + await handleConfigError(e, { cwd: root, flags, logging }); + return {} as any; + }); + if (!astroConfig) return; telemetry.record(event.eventCliSession(cmd, userConfig, flags)); // Common CLI Commands: @@ -184,7 +189,7 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { ).test(normalizePath(changedFile))) ) { restartInFlight = true; - console.clear() + console.clear(); try { const newConfig = await openConfig({ cwd: root, @@ -198,11 +203,10 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { await stop(); await startDevServer({ isRestart: true }); } catch (e) { - await handleConfigError(e, { cwd: root, flags, logging }) + await handleConfigError(e, { cwd: root, flags, logging }); await stop(); info(logging, 'astro', 'Continuing with previous valid configuration\n'); await startDevServer({ isRestart: true }); - } } }; diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index d56f99958f99f..611584b76291f 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -1,9 +1,9 @@ import type { RehypePlugin, RemarkPlugin, RemarkRehype } from '@astrojs/markdown-remark'; +import fs from 'fs'; import type * as Postcss from 'postcss'; import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki'; import type { Arguments as Flags } from 'yargs-parser'; import type { AstroConfig, AstroUserConfig, CLIFlags, ViteUserConfig } from '../@types/astro'; -import fs from 'fs'; import load, { ProloadError, resolve } from '@proload/core'; import loadTypeScript from '@proload/plugin-tsm'; @@ -437,7 +437,7 @@ export async function resolveConfigPath( if (e instanceof ProloadError && flags.config) { throw new Error(`Unable to resolve --config "${flags.config}"! Does the file exist?`); } - throw e + throw e; } } diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts index d7b0780acc399..e8069db909471 100644 --- a/packages/astro/src/core/dev/index.ts +++ b/packages/astro/src/core/dev/index.ts @@ -68,7 +68,7 @@ export default async function dev(config: AstroConfig, options: DevOptions): Pro devServerAddressInfo, site, https: !!viteConfig.server?.https, - isRestart + isRestart, }) ); diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index a2ce5c2042beb..f140e052fb121 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -58,14 +58,14 @@ export function devStart({ config, https, site, - isRestart = false + isRestart = false, }: { startupTime: number; devServerAddressInfo: AddressInfo; config: AstroConfig; https: boolean; site: URL | undefined; - isRestart?: boolean + isRestart?: boolean; }): string { // PACKAGE_VERSION is injected at build-time const version = process.env.PACKAGE_VERSION ?? '0.0.0'; From eb4f6faee6d432f06aca86b4e54fd4a7379004bf Mon Sep 17 00:00:00 2001 From: Lloyd Atkinson Date: Fri, 9 Sep 2022 18:13:09 +0100 Subject: [PATCH 17/30] docs: add section on .mdx file support in VS Code (#4694) * docs: add section on .mdx file support in VS Code * Update packages/integrations/mdx/README.md Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: Matthew Phillips Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: Matthew Phillips --- packages/integrations/mdx/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/integrations/mdx/README.md b/packages/integrations/mdx/README.md index 52568ea044a4a..181e55faad366 100644 --- a/packages/integrations/mdx/README.md +++ b/packages/integrations/mdx/README.md @@ -57,6 +57,18 @@ export default defineConfig({ }); ``` +Finally, restart the dev server. + +### Editor Integration + +[VS Code](https://code.visualstudio.com/) supports Markdown by default. However, for MDX editor support, you may wish to add the following setting in your VSCode config. This ensures authoring MDX files provides a Markdown-like editor experience. + +```json title=".vscode/settings.json" +"files.associations": { + "*.mdx": "markdown" +} +``` + ## Usage You can [add MDX pages to your project](https://docs.astro.build/en/guides/markdown-content/#markdown-and-mdx-pages) by adding `.mdx` files within your `src/pages/` directory. From 80ae62ad99d5f300f05d837e5e45e47ba4bc0602 Mon Sep 17 00:00:00 2001 From: Brendan O'Leary Date: Fri, 9 Sep 2022 13:19:45 -0400 Subject: [PATCH 18/30] Fix theme.css location in docs starter project (#4697) * Fix theme.css location in docs starter project * Also fix in diff display Co-authored-by: Brendan O'Leary --- examples/docs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/docs/README.md b/examples/docs/README.md index 8bf8e6ca5d41c..b88fb0808d5f4 100644 --- a/examples/docs/README.md +++ b/examples/docs/README.md @@ -47,14 +47,14 @@ Welcome! Check out [our documentation](https://docs.astro.build) or jump into ou ### CSS styling -The theme's look and feel is controlled by a few key variables that you can customize yourself. You'll find them in the `public/theme.css` CSS file. +The theme's look and feel is controlled by a few key variables that you can customize yourself. You'll find them in the `src/styles/theme.css` CSS file. If you've never worked with CSS variables before, give [MDN's guide on CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) a quick read. This theme uses a "cool blue" accent color by default. To customize this for your project, change the `--theme-accent` variable to whatever color you'd like: ```diff -/* public/theme.css */ +/* src/styles/theme.css */ :root { color-scheme: light; - --theme-accent: hsla(var(--color-blue), 1); From d1e69591479741022eecc122c43afb05985a94fd Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 9 Sep 2022 14:06:39 -0400 Subject: [PATCH 19/30] [astro add] Move config update to final step (#4682) * feat: move astro.config update to end * chore: changeset --- .changeset/clever-taxis-smell.md | 5 + packages/astro/src/core/add/index.ts | 134 ++++++++++++++------------- 2 files changed, 73 insertions(+), 66 deletions(-) create mode 100644 .changeset/clever-taxis-smell.md diff --git a/.changeset/clever-taxis-smell.md b/.changeset/clever-taxis-smell.md new file mode 100644 index 0000000000000..09752ee3c06b8 --- /dev/null +++ b/.changeset/clever-taxis-smell.md @@ -0,0 +1,5 @@ +--- +'astro': minor +--- + +astro add - move configuration updates to final step diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 678004b081b4e..efcf75789f67d 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -95,17 +95,77 @@ export default async function add(names: string[], { cwd, flags, logging, teleme }); return; } - let configURL: URL | undefined; + + // Some packages might have a common alias! We normalize those here. + const integrationNames = names.map((name) => (ALIASES.has(name) ? ALIASES.get(name)! : name)); + const integrations = await validateIntegrations(integrationNames); + let installResult = await tryToInstallIntegrations({ integrations, cwd, flags, logging }); const root = pathToFileURL(cwd ? path.resolve(cwd) : process.cwd()); + // Append forward slash to compute relative paths + root.href = appendForwardSlash(root.href); + + switch (installResult) { + case UpdateResult.updated: { + if (integrations.find((integration) => integration.id === 'tailwind')) { + const possibleConfigFiles = [ + './tailwind.config.cjs', + './tailwind.config.mjs', + './tailwind.config.js', + ].map((p) => fileURLToPath(new URL(p, root))); + let alreadyConfigured = false; + for (const possibleConfigPath of possibleConfigFiles) { + if (existsSync(possibleConfigPath)) { + alreadyConfigured = true; + break; + } + } + if (!alreadyConfigured) { + info( + logging, + null, + `\n ${magenta( + `Astro will generate a minimal ${bold('./tailwind.config.cjs')} file.` + )}\n` + ); + if (await askToContinue({ flags })) { + await fs.writeFile( + fileURLToPath(new URL('./tailwind.config.cjs', root)), + TAILWIND_CONFIG_STUB, + { encoding: 'utf-8' } + ); + debug('add', `Generated default ./tailwind.config.cjs file`); + } + } else { + debug('add', `Using existing Tailwind configuration`); + } + } + break; + } + case UpdateResult.cancelled: { + info( + logging, + null, + msg.cancelled( + `Dependencies ${bold('NOT')} installed.`, + `Be sure to install them manually before continuing!` + ) + ); + break; + } + case UpdateResult.failure: { + throw createPrettyError(new Error(`Unable to install dependencies`)); + } + } + const rawConfigPath = await resolveConfigPath({ cwd, flags }); - configURL = rawConfigPath ? pathToFileURL(rawConfigPath) : undefined; + let configURL = rawConfigPath ? pathToFileURL(rawConfigPath) : undefined; applyPolyfill(); if (configURL) { debug('add', `Found config at ${configURL}`); } else { info(logging, 'add', `Unable to locate a config file, generating one for you.`); - configURL = new URL('./astro.config.mjs', appendForwardSlash(root.href)); + configURL = new URL('./astro.config.mjs', root); await fs.writeFile(fileURLToPath(configURL), ASTRO_CONFIG_STUB, { encoding: 'utf-8' }); } @@ -115,11 +175,6 @@ export default async function add(names: string[], { cwd, flags, logging, teleme `Unable to use "astro add" with package.json configuration. Try migrating to \`astro.config.mjs\` and try again.` ); } - - // Some packages might have a common alias! We normalize those here. - const integrationNames = names.map((name) => (ALIASES.has(name) ? ALIASES.get(name)! : name)); - const integrations = await validateIntegrations(integrationNames); - let ast: t.File | null = null; try { ast = await parseAstroConfig(configURL); @@ -165,7 +220,6 @@ export default async function add(names: string[], { cwd, flags, logging, teleme } let configResult: UpdateResult | undefined; - let installResult: UpdateResult | undefined; if (ast) { try { @@ -204,71 +258,19 @@ export default async function add(names: string[], { cwd, flags, logging, teleme } info(logging, null, msg.success(`Configuration up-to-date.`)); - break; + return; } - } - - installResult = await tryToInstallIntegrations({ integrations, cwd, flags, logging }); - - switch (installResult) { - case UpdateResult.updated: { - const len = integrations.length; - if (integrations.find((integration) => integration.id === 'tailwind')) { - const possibleConfigFiles = [ - './tailwind.config.cjs', - './tailwind.config.mjs', - './tailwind.config.js', - ].map((p) => fileURLToPath(new URL(p, configURL))); - let alreadyConfigured = false; - for (const possibleConfigPath of possibleConfigFiles) { - if (existsSync(possibleConfigPath)) { - alreadyConfigured = true; - break; - } - } - if (!alreadyConfigured) { - info( - logging, - null, - `\n ${magenta( - `Astro will generate a minimal ${bold('./tailwind.config.cjs')} file.` - )}\n` - ); - if (await askToContinue({ flags })) { - await fs.writeFile( - fileURLToPath(new URL('./tailwind.config.cjs', configURL)), - TAILWIND_CONFIG_STUB, - { encoding: 'utf-8' } - ); - debug('add', `Generated default ./tailwind.config.cjs file`); - } - } else { - debug('add', `Using existing Tailwind configuration`); - } - } + default: { const list = integrations.map((integration) => ` - ${integration.packageName}`).join('\n'); info( logging, null, msg.success( - `Added the following integration${len === 1 ? '' : 's'} to your project:\n${list}` - ) - ); - return; - } - case UpdateResult.cancelled: { - info( - logging, - null, - msg.cancelled( - `Dependencies ${bold('NOT')} installed.`, - `Be sure to install them manually before continuing!` + `Added the following integration${ + integrations.length === 1 ? '' : 's' + } to your project:\n${list}` ) ); - return; - } - case UpdateResult.failure: { - throw createPrettyError(new Error(`Unable to install dependencies`)); } } } From b85d05a841538b6a995808b6422b234f3e746804 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 9 Sep 2022 14:51:58 -0400 Subject: [PATCH 20/30] Fix client:only CSS missing from child packages (#4699) --- .changeset/orange-clocks-exist.md | 5 +++++ .../astro/src/core/build/vite-plugin-analyzer.ts | 11 ++++++++++- packages/astro/test/astro-client-only.test.js | 7 +++++++ .../test/fixtures/astro-client-only/package.json | 3 ++- .../test/fixtures/astro-client-only/pkg/index.svelte | 6 ++++++ .../test/fixtures/astro-client-only/pkg/package.json | 4 ++++ .../fixtures/astro-client-only/src/pages/pkg.astro | 12 ++++++++++++ pnpm-lock.yaml | 10 ++++++++++ 8 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .changeset/orange-clocks-exist.md create mode 100644 packages/astro/test/fixtures/astro-client-only/pkg/index.svelte create mode 100644 packages/astro/test/fixtures/astro-client-only/pkg/package.json create mode 100644 packages/astro/test/fixtures/astro-client-only/src/pages/pkg.astro diff --git a/.changeset/orange-clocks-exist.md b/.changeset/orange-clocks-exist.md new file mode 100644 index 0000000000000..65b428643085f --- /dev/null +++ b/.changeset/orange-clocks-exist.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix missing CSS in client:only in child packages diff --git a/packages/astro/src/core/build/vite-plugin-analyzer.ts b/packages/astro/src/core/build/vite-plugin-analyzer.ts index e25ee42aa90d3..faa252befac7c 100644 --- a/packages/astro/src/core/build/vite-plugin-analyzer.ts +++ b/packages/astro/src/core/build/vite-plugin-analyzer.ts @@ -70,7 +70,7 @@ export function vitePluginAnalyzer(internals: BuildInternals): VitePlugin { return { name: '@astro/rollup-plugin-astro-analyzer', - generateBundle() { + async generateBundle() { const hoistScanner = hoistedScriptScanner(); const ids = this.getModuleIds(); @@ -95,6 +95,15 @@ export function vitePluginAnalyzer(internals: BuildInternals): VitePlugin { const cid = c.resolvedPath ? decodeURI(c.resolvedPath) : c.specifier; internals.discoveredClientOnlyComponents.add(cid); clientOnlys.push(cid); + // Bare module specifiers need to be resolved so that the CSS + // plugin can walk up the graph to find which page they belong to. + if(c.resolvedPath === c.specifier) { + const resolvedId = await this.resolve(c.specifier, id); + if(resolvedId) { + clientOnlys.push(resolvedId.id); + } + } + } for (const [pageInfo] of getTopLevelPages(id, this)) { diff --git a/packages/astro/test/astro-client-only.test.js b/packages/astro/test/astro-client-only.test.js index 90e4b083ddcf9..0600b4950fdbe 100644 --- a/packages/astro/test/astro-client-only.test.js +++ b/packages/astro/test/astro-client-only.test.js @@ -3,6 +3,7 @@ import { load as cheerioLoad } from 'cheerio'; import { loadFixture } from './test-utils.js'; describe('Client only components', () => { + /** @type {import('./test-utils').Fixture} */ let fixture; before(async () => { @@ -39,6 +40,12 @@ describe('Client only components', () => { const $ = cheerioLoad(html); expect($('link[rel=stylesheet]')).to.have.a.lengthOf(1); }); + + it('Includes CSS from package components', async () => { + const html = await fixture.readFile('/pkg/index.html'); + const $ = cheerioLoad(html); + expect($('link[rel=stylesheet]')).to.have.a.lengthOf(1); + }); }); describe('Client only components subpath', () => { diff --git a/packages/astro/test/fixtures/astro-client-only/package.json b/packages/astro/test/fixtures/astro-client-only/package.json index dd987f6c252ed..69bef83c6430e 100644 --- a/packages/astro/test/fixtures/astro-client-only/package.json +++ b/packages/astro/test/fixtures/astro-client-only/package.json @@ -7,6 +7,7 @@ "@astrojs/react": "workspace:*", "astro": "workspace:*", "react": "^18.1.0", - "react-dom": "^18.1.0" + "react-dom": "^18.1.0", + "@test/astro-client-only-pkg": "file:./pkg" } } diff --git a/packages/astro/test/fixtures/astro-client-only/pkg/index.svelte b/packages/astro/test/fixtures/astro-client-only/pkg/index.svelte new file mode 100644 index 0000000000000..3e81de564724d --- /dev/null +++ b/packages/astro/test/fixtures/astro-client-only/pkg/index.svelte @@ -0,0 +1,6 @@ +

Testing

+ diff --git a/packages/astro/test/fixtures/astro-client-only/pkg/package.json b/packages/astro/test/fixtures/astro-client-only/pkg/package.json new file mode 100644 index 0000000000000..03e6121e6549b --- /dev/null +++ b/packages/astro/test/fixtures/astro-client-only/pkg/package.json @@ -0,0 +1,4 @@ +{ + "name": "@test/astro-client-only-pkg", + "main": "index.svelte" +} diff --git a/packages/astro/test/fixtures/astro-client-only/src/pages/pkg.astro b/packages/astro/test/fixtures/astro-client-only/src/pages/pkg.astro new file mode 100644 index 0000000000000..dbf693ef8c140 --- /dev/null +++ b/packages/astro/test/fixtures/astro-client-only/src/pages/pkg.astro @@ -0,0 +1,12 @@ +--- +import IndexSvelte from '@test/astro-client-only-pkg'; +--- + + + Testing + + +

Testing

+ + + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e5c2a6f1efed5..1be33908413a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1097,16 +1097,21 @@ importers: specifiers: '@astrojs/react': workspace:* '@astrojs/svelte': workspace:* + '@test/astro-client-only-pkg': file:./pkg astro: workspace:* react: ^18.1.0 react-dom: ^18.1.0 dependencies: '@astrojs/react': link:../../../../integrations/react '@astrojs/svelte': link:../../../../integrations/svelte + '@test/astro-client-only-pkg': file:packages/astro/test/fixtures/astro-client-only/pkg astro: link:../../.. react: 18.2.0 react-dom: 18.2.0_react@18.2.0 + packages/astro/test/fixtures/astro-client-only/pkg: + specifiers: {} + packages/astro/test/fixtures/astro-component-code: specifiers: astro: workspace:* @@ -17934,6 +17939,11 @@ packages: resolution: {integrity: sha512-JZxotl7SxAJH0j7dN4pxsTV6ZLXoLdGME+PsjkL/DaBrVryK9kTGq06GfKrwcSOqypP+fdXGoCHE36b99fWVoA==} dev: false + file:packages/astro/test/fixtures/astro-client-only/pkg: + resolution: {directory: packages/astro/test/fixtures/astro-client-only/pkg, type: directory} + name: '@test/astro-client-only-pkg' + dev: false + file:packages/astro/test/fixtures/css-assets/packages/font-awesome: resolution: {directory: packages/astro/test/fixtures/css-assets/packages/font-awesome, type: directory} name: '@astrojs/test-font-awesome-package' From 07736f74c0ca0f8eee522271f163297676190d56 Mon Sep 17 00:00:00 2001 From: matthewp Date: Fri, 9 Sep 2022 18:54:10 +0000 Subject: [PATCH 21/30] [ci] format --- packages/astro/src/core/build/vite-plugin-analyzer.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/astro/src/core/build/vite-plugin-analyzer.ts b/packages/astro/src/core/build/vite-plugin-analyzer.ts index faa252befac7c..65da4fd0f80e0 100644 --- a/packages/astro/src/core/build/vite-plugin-analyzer.ts +++ b/packages/astro/src/core/build/vite-plugin-analyzer.ts @@ -97,13 +97,12 @@ export function vitePluginAnalyzer(internals: BuildInternals): VitePlugin { clientOnlys.push(cid); // Bare module specifiers need to be resolved so that the CSS // plugin can walk up the graph to find which page they belong to. - if(c.resolvedPath === c.specifier) { + if (c.resolvedPath === c.specifier) { const resolvedId = await this.resolve(c.specifier, id); - if(resolvedId) { + if (resolvedId) { clientOnlys.push(resolvedId.id); } } - } for (const [pageInfo] of getTopLevelPages(id, this)) { From 2737cabd10bb7859e45f653a3106a624b128e075 Mon Sep 17 00:00:00 2001 From: "Fred K. Bot" <108291165+fredkbot@users.noreply.github.com> Date: Fri, 9 Sep 2022 11:58:03 -0700 Subject: [PATCH 22/30] [ci] release (#4698) Co-authored-by: github-actions[bot] --- .changeset/clever-taxis-smell.md | 5 --- .changeset/orange-clocks-exist.md | 5 --- .changeset/stale-camels-invent.md | 5 --- .changeset/tricky-cows-travel.md | 5 --- examples/basics/package.json | 2 +- examples/blog/package.json | 2 +- examples/component/package.json | 4 +- examples/docs/package.json | 2 +- examples/framework-alpine/package.json | 2 +- examples/framework-lit/package.json | 2 +- examples/framework-multiple/package.json | 2 +- examples/framework-preact/package.json | 2 +- examples/framework-react/package.json | 2 +- examples/framework-solid/package.json | 2 +- examples/framework-svelte/package.json | 2 +- examples/framework-vue/package.json | 2 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/ssr/package.json | 2 +- examples/with-markdown-plugins/package.json | 2 +- examples/with-markdown-shiki/package.json | 2 +- examples/with-mdx/package.json | 2 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vite-plugin-pwa/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 14 +++++++ packages/astro/package.json | 2 +- pnpm-lock.yaml | 46 ++++++++++----------- 30 files changed, 62 insertions(+), 68 deletions(-) delete mode 100644 .changeset/clever-taxis-smell.md delete mode 100644 .changeset/orange-clocks-exist.md delete mode 100644 .changeset/stale-camels-invent.md delete mode 100644 .changeset/tricky-cows-travel.md diff --git a/.changeset/clever-taxis-smell.md b/.changeset/clever-taxis-smell.md deleted file mode 100644 index 09752ee3c06b8..0000000000000 --- a/.changeset/clever-taxis-smell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': minor ---- - -astro add - move configuration updates to final step diff --git a/.changeset/orange-clocks-exist.md b/.changeset/orange-clocks-exist.md deleted file mode 100644 index 65b428643085f..0000000000000 --- a/.changeset/orange-clocks-exist.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix missing CSS in client:only in child packages diff --git a/.changeset/stale-camels-invent.md b/.changeset/stale-camels-invent.md deleted file mode 100644 index e3d88bc33a381..0000000000000 --- a/.changeset/stale-camels-invent.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': minor ---- - -Allow specifying custom encoding when using a non-html route. Only option before was 'utf-8' and now that is just the default. diff --git a/.changeset/tricky-cows-travel.md b/.changeset/tricky-cows-travel.md deleted file mode 100644 index 0381d614c9af4..0000000000000 --- a/.changeset/tricky-cows-travel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': minor ---- - -Restart dev server when config file is added, updated, or removed diff --git a/examples/basics/package.json b/examples/basics/package.json index c15309561d642..5efb134d101e9 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index 24a85f6db2c45..e03f98439a9a2 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "@astrojs/mdx": "^0.11.1", "@astrojs/rss": "^1.0.0", "@astrojs/sitemap": "^1.0.0" diff --git a/examples/component/package.json b/examples/component/package.json index 1c245c8cc847b..de72597e8ecde 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,9 +15,9 @@ ], "scripts": {}, "devDependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" }, "peerDependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/docs/package.json b/examples/docs/package.json index 87aabd18d153c..cb2fbba1614ec 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index d65020bf5024d..3a600b303bf72 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "alpinejs": "^3.10.2", "@astrojs/alpinejs": "^0.1.2", "@types/alpinejs": "^3.7.0" diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 48f1b6bebc7fd..9641080bfef7b 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "lit": "^2.2.5", "@astrojs/lit": "^1.0.0", "@webcomponents/template-shadowroot": "^0.1.0" diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index 6c936eae11965..e6b0f66236be5 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index 2edb6d1bd4e5d..ed6d79d131a87 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "preact": "^10.7.3", "@astrojs/preact": "^1.1.0" } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index abe2a2522048c..a63a2cf5a1622 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "react": "^18.1.0", "react-dom": "^18.1.0", "@astrojs/react": "^1.1.2", diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index 5e90482992206..dea068f50c311 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "solid-js": "^1.4.3", "@astrojs/solid-js": "^1.1.0" } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index e8c9df5d34582..dbacbcb83b9de 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,6 +12,6 @@ "dependencies": { "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.0", - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 8b162bf92e65f..898e600d06cad 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "vue": "^3.2.37", "@astrojs/vue": "^1.0.1" } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index 62ba1f8b5d024..dc880f49352da 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index ac0d6ce3d3d85..5eaf85b1f3da8 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 406dd862409ce..7ed9d68514f02 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 8def058846bf2..8885ab397a8f4 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,7 +12,7 @@ }, "devDependencies": {}, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.0", "@astrojs/node": "^1.0.1", diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 3f04c357cf9ab..136871e267026 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "@astrojs/markdown-remark": "^1.1.0", "hast-util-select": "5.0.1", "rehype-autolink-headings": "^6.1.1", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 82fde255c449c..187d0019b4db1 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8" + "astro": "^1.2.0" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 77c6700a6d073..2a85f5797b713 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "preact": "^10.6.5", "@astrojs/preact": "^1.1.0", "@astrojs/mdx": "^0.11.1" diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 4fb3b62acb431..45a4eb5e80419 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "preact": "^10.7.3", "@astrojs/preact": "^1.1.0", "nanostores": "^0.5.12", diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index af7da3516f78b..6d9b6360ce345 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "@astrojs/tailwind": "^1.0.0", "autoprefixer": "^10.4.7", "canvas-confetti": "^1.5.1", diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json index 3a15d26c8f120..224ccf99a0de2 100644 --- a/examples/with-vite-plugin-pwa/package.json +++ b/examples/with-vite-plugin-pwa/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "vite-plugin-pwa": "0.11.11", "workbox-window": "^6.5.3" } diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index a43c906ab7455..7d2a88b483e1d 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^1.1.8", + "astro": "^1.2.0", "vitest": "^0.20.3" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index dd0fa1ce88d28..0c3d98679cdf6 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,19 @@ # astro +## 1.2.0 + +### Minor Changes + +- [#4682](https://github.com/withastro/astro/pull/4682) [`d1e695914`](https://github.com/withastro/astro/commit/d1e69591479741022eecc122c43afb05985a94fd) Thanks [@bholmesdev](https://github.com/bholmesdev)! - astro add - move configuration updates to final step + +- [#4549](https://github.com/withastro/astro/pull/4549) [`255636cc7`](https://github.com/withastro/astro/commit/255636cc7b4ed5f72045f75a2411ebd84a2bdb0d) Thanks [@altano](https://github.com/altano)! - Allow specifying custom encoding when using a non-html route. Only option before was 'utf-8' and now that is just the default. + +- [#4578](https://github.com/withastro/astro/pull/4578) [`c706d845e`](https://github.com/withastro/astro/commit/c706d845ebf4786c33d2295954a98df8c5a7f183) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Restart dev server when config file is added, updated, or removed + +### Patch Changes + +- [#4699](https://github.com/withastro/astro/pull/4699) [`b85d05a84`](https://github.com/withastro/astro/commit/b85d05a841538b6a995808b6422b234f3e746804) Thanks [@matthewp](https://github.com/matthewp)! - Fix missing CSS in client:only in child packages + ## 1.1.8 ### Patch Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index 2fde818f8ccbf..bbef9c7138531 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "1.1.8", + "version": "1.2.0", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1be33908413a8..3c91c08c652e4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,7 +56,7 @@ importers: examples/basics: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 dependencies: astro: link:../../packages/astro @@ -65,7 +65,7 @@ importers: '@astrojs/mdx': ^0.11.1 '@astrojs/rss': ^1.0.0 '@astrojs/sitemap': ^1.0.0 - astro: ^1.1.8 + astro: ^1.2.0 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx '@astrojs/rss': link:../../packages/astro-rss @@ -74,7 +74,7 @@ importers: examples/component: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 devDependencies: astro: link:../../packages/astro @@ -88,7 +88,7 @@ importers: '@types/node': ^18.0.0 '@types/react': ^17.0.45 '@types/react-dom': ^18.0.0 - astro: ^1.1.8 + astro: ^1.2.0 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -111,7 +111,7 @@ importers: '@astrojs/alpinejs': ^0.1.2 '@types/alpinejs': ^3.7.0 alpinejs: ^3.10.2 - astro: ^1.1.8 + astro: ^1.2.0 dependencies: '@astrojs/alpinejs': link:../../packages/integrations/alpinejs '@types/alpinejs': 3.7.0 @@ -122,7 +122,7 @@ importers: specifiers: '@astrojs/lit': ^1.0.0 '@webcomponents/template-shadowroot': ^0.1.0 - astro: ^1.1.8 + astro: ^1.2.0 lit: ^2.2.5 dependencies: '@astrojs/lit': link:../../packages/integrations/lit @@ -137,7 +137,7 @@ importers: '@astrojs/solid-js': ^1.1.0 '@astrojs/svelte': ^1.0.0 '@astrojs/vue': ^1.0.1 - astro: ^1.1.8 + astro: ^1.2.0 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -161,7 +161,7 @@ importers: examples/framework-preact: specifiers: '@astrojs/preact': ^1.1.0 - astro: ^1.1.8 + astro: ^1.2.0 preact: ^10.7.3 dependencies: '@astrojs/preact': link:../../packages/integrations/preact @@ -173,7 +173,7 @@ importers: '@astrojs/react': ^1.1.2 '@types/react': ^18.0.10 '@types/react-dom': ^18.0.5 - astro: ^1.1.8 + astro: ^1.2.0 react: ^18.1.0 react-dom: ^18.1.0 dependencies: @@ -187,7 +187,7 @@ importers: examples/framework-solid: specifiers: '@astrojs/solid-js': ^1.1.0 - astro: ^1.1.8 + astro: ^1.2.0 solid-js: ^1.4.3 dependencies: '@astrojs/solid-js': link:../../packages/integrations/solid @@ -197,7 +197,7 @@ importers: examples/framework-svelte: specifiers: '@astrojs/svelte': ^1.0.0 - astro: ^1.1.8 + astro: ^1.2.0 svelte: ^3.48.0 dependencies: '@astrojs/svelte': link:../../packages/integrations/svelte @@ -207,7 +207,7 @@ importers: examples/framework-vue: specifiers: '@astrojs/vue': ^1.0.1 - astro: ^1.1.8 + astro: ^1.2.0 vue: ^3.2.37 dependencies: '@astrojs/vue': link:../../packages/integrations/vue @@ -216,19 +216,19 @@ importers: examples/minimal: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 dependencies: astro: link:../../packages/astro examples/non-html-pages: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 dependencies: astro: link:../../packages/astro examples/portfolio: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 dependencies: astro: link:../../packages/astro @@ -236,7 +236,7 @@ importers: specifiers: '@astrojs/node': ^1.0.1 '@astrojs/svelte': ^1.0.0 - astro: ^1.1.8 + astro: ^1.2.0 concurrently: ^7.2.1 lightcookie: ^1.0.25 svelte: ^3.48.0 @@ -255,7 +255,7 @@ importers: examples/with-markdown-plugins: specifiers: '@astrojs/markdown-remark': ^1.1.0 - astro: ^1.1.8 + astro: ^1.2.0 hast-util-select: 5.0.1 rehype-autolink-headings: ^6.1.1 rehype-slug: ^5.0.1 @@ -272,7 +272,7 @@ importers: examples/with-markdown-shiki: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 dependencies: astro: link:../../packages/astro @@ -280,7 +280,7 @@ importers: specifiers: '@astrojs/mdx': ^0.11.1 '@astrojs/preact': ^1.1.0 - astro: ^1.1.8 + astro: ^1.2.0 preact: ^10.6.5 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx @@ -292,7 +292,7 @@ importers: specifiers: '@astrojs/preact': ^1.1.0 '@nanostores/preact': ^0.1.3 - astro: ^1.1.8 + astro: ^1.2.0 nanostores: ^0.5.12 preact: ^10.7.3 dependencies: @@ -305,7 +305,7 @@ importers: examples/with-tailwindcss: specifiers: '@astrojs/tailwind': ^1.0.0 - astro: ^1.1.8 + astro: ^1.2.0 autoprefixer: ^10.4.7 canvas-confetti: ^1.5.1 postcss: ^8.4.14 @@ -320,7 +320,7 @@ importers: examples/with-vite-plugin-pwa: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 vite-plugin-pwa: 0.11.11 workbox-window: ^6.5.3 dependencies: @@ -330,7 +330,7 @@ importers: examples/with-vitest: specifiers: - astro: ^1.1.8 + astro: ^1.2.0 vitest: ^0.20.3 dependencies: astro: link:../../packages/astro From 1e5d8ba9af4eb017382263653216e5247d96ab79 Mon Sep 17 00:00:00 2001 From: Oussama Bennaci <9404365+obennaci@users.noreply.github.com> Date: Fri, 9 Sep 2022 21:13:59 +0100 Subject: [PATCH 23/30] [@astrojs/image] support additional resize options (#4438) * working draft * more sharp params * add changeset * fix typing * wip * add missing docblocks * update lock file * remove enlargement and reduction resize options * add tests * Add docs * support crop options in pictures * cleanup * define crop types in docs * cleanup * remove kernel option Co-authored-by: Tony Sullivan --- .changeset/breezy-flowers-pay.md | 5 +++ packages/integrations/image/README.md | 44 ++++++++++++++++++- .../image/components/Picture.astro | 12 ++++- .../integrations/image/src/lib/get-picture.ts | 12 +++-- .../integrations/image/src/loaders/index.ts | 37 ++++++++++++++++ .../integrations/image/src/loaders/sharp.ts | 35 ++++++++++++--- .../integrations/image/test/sharp.test.js | 6 +++ 7 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 .changeset/breezy-flowers-pay.md diff --git a/.changeset/breezy-flowers-pay.md b/.changeset/breezy-flowers-pay.md new file mode 100644 index 0000000000000..04c16a239ec05 --- /dev/null +++ b/.changeset/breezy-flowers-pay.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': minor +--- + +Support additional Sharp resize options diff --git a/packages/integrations/image/README.md b/packages/integrations/image/README.md index d1eb00ab3797d..fe3a699011cea 100644 --- a/packages/integrations/image/README.md +++ b/packages/integrations/image/README.md @@ -205,7 +205,27 @@ The parameter can be a [named HTML color](https://www.w3schools.com/tags/ref_col color representation with 3 or 6 hexadecimal characters in the form `#123[abc]`, or an RGB definition in the form `rgb(100,100,100)`. -### ` +#### fit + +

+ +**Type:** `'cover' | 'contain' | 'fill' | 'inside' | 'outside'`
+**Default:** `'cover'` +

+ +How the image should be resized to fit both `height` and `width`. + +#### position + +

+ +**Type:** `'top' | 'right top' | 'right' | 'right bottom' | 'bottom' | 'left bottom' | 'left' | 'left top' | 'north' | 'northeast' | 'east' | 'southeast' | 'south' | 'southwest' | 'west' | 'northwest' | 'center' | 'centre' | 'cover' | 'entropy' | 'attention'`
+**Default:** `'centre'` +

+ +Position of the crop when fit is `cover` or `contain`. + +### `` #### src @@ -304,6 +324,28 @@ The parameter can be a [named HTML color](https://www.w3schools.com/tags/ref_col color representation with 3 or 6 hexadecimal characters in the form `#123[abc]`, or an RGB definition in the form `rgb(100,100,100)`. +#### fit + +

+ +**Type:** `'cover' | 'contain' | 'fill' | 'inside' | 'outside'`
+**Default:** `'cover'` +

+ +How the image should be resized to fit both `height` and `width`. + +#### position + +

+ +**Type:** `'top' | 'right top' | 'right' | 'right bottom' | 'bottom' | 'left bottom' | 'left' | 'left top' | + 'north' | 'northeast' | 'east' | 'southeast' | 'south' | 'southwest' | 'west' | 'northwest' | + 'center' | 'centre' | 'cover' | 'entropy' | 'attention'`
+**Default:** `'centre'` +

+ +Position of the crop when fit is `cover` or `contain`. + ### `getImage` This is the helper function used by the `` component to build `` attributes for the transformed image. This helper can be used directly for more complex use cases that aren't currently supported by the `` component. diff --git a/packages/integrations/image/components/Picture.astro b/packages/integrations/image/components/Picture.astro index e28f5bf409f7b..a2d80354a346b 100644 --- a/packages/integrations/image/components/Picture.astro +++ b/packages/integrations/image/components/Picture.astro @@ -38,7 +38,9 @@ const { sizes, widths, aspectRatio, + fit, background, + position, formats = ['avif', 'webp'], loading = 'lazy', decoding = 'async', @@ -49,7 +51,15 @@ if (alt === undefined || alt === null) { warnForMissingAlt(); } -const { image, sources } = await getPicture({ src, widths, formats, aspectRatio, background }); +const { image, sources } = await getPicture({ + src, + widths, + formats, + aspectRatio, + fit, + background, + position, +}); --- diff --git a/packages/integrations/image/src/lib/get-picture.ts b/packages/integrations/image/src/lib/get-picture.ts index 2476686b73e28..132d93ee1bfe8 100644 --- a/packages/integrations/image/src/lib/get-picture.ts +++ b/packages/integrations/image/src/lib/get-picture.ts @@ -10,7 +10,9 @@ export interface GetPictureParams { widths: number[]; formats: OutputFormat[]; aspectRatio?: TransformOptions['aspectRatio']; + fit?: TransformOptions['fit']; background?: TransformOptions['background']; + position?: TransformOptions['position']; } export interface GetPictureResult { @@ -41,7 +43,7 @@ async function resolveFormats({ src, formats }: GetPictureParams) { } export async function getPicture(params: GetPictureParams): Promise { - const { src, widths } = params; + const { src, widths, fit, position, background } = params; if (!src) { throw new Error('[@astrojs/image] `src` is required'); @@ -64,8 +66,10 @@ export async function getPicture(params: GetPictureParams): Promise getSource(format))); diff --git a/packages/integrations/image/src/loaders/index.ts b/packages/integrations/image/src/loaders/index.ts index 5001a17a99376..801a19300bfab 100644 --- a/packages/integrations/image/src/loaders/index.ts +++ b/packages/integrations/image/src/loaders/index.ts @@ -21,6 +21,31 @@ export type ColorDefinition = | `rgb(${number}, ${number}, ${number})` | `rgb(${number},${number},${number})`; +export type CropFit = 'cover' | 'contain' | 'fill' | 'inside' | 'outside'; + +export type CropPosition = + | 'top' + | 'right top' + | 'right' + | 'right bottom' + | 'bottom' + | 'left bottom' + | 'left' + | 'left top' + | 'north' + | 'northeast' + | 'east' + | 'southeast' + | 'south' + | 'southwest' + | 'west' + | 'northwest' + | 'center' + | 'centre' + | 'cover' + | 'entropy' + | 'attention'; + export function isOutputFormat(value: string): value is OutputFormat { return ['avif', 'jpeg', 'png', 'webp'].includes(value); } @@ -105,6 +130,18 @@ export interface TransformOptions { * @example "rgb(255, 255, 255)" - an rgb color */ background?: ColorDefinition; + /** + * How the image should be resized to fit both `height` and `width`. + * + * @default 'cover' + */ + fit?: CropFit; + /** + * Position of the crop when fit is `cover` or `contain`. + * + * @default 'centre' + */ + position?: CropPosition; } export interface HostedImageService { diff --git a/packages/integrations/image/src/loaders/sharp.ts b/packages/integrations/image/src/loaders/sharp.ts index 09a653375d6a7..ac1f10c8ac98f 100644 --- a/packages/integrations/image/src/loaders/sharp.ts +++ b/packages/integrations/image/src/loaders/sharp.ts @@ -1,11 +1,12 @@ import sharp from 'sharp'; -import { isAspectRatioString, isColor, isOutputFormat } from '../loaders/index.js'; +import { ColorDefinition, isAspectRatioString, isColor, isOutputFormat } from '../loaders/index.js'; import type { OutputFormat, SSRImageService, TransformOptions } from './index.js'; class SharpService implements SSRImageService { async getImageAttributes(transform: TransformOptions) { // strip off the known attributes - const { width, height, src, format, quality, aspectRatio, background, ...rest } = transform; + const { width, height, src, format, quality, aspectRatio, fit, position, background, ...rest } = + transform; return { ...rest, @@ -37,10 +38,18 @@ class SharpService implements SSRImageService { searchParams.append('ar', transform.aspectRatio.toString()); } + if (transform.fit) { + searchParams.append('fit', transform.fit); + } + if (transform.background) { searchParams.append('bg', transform.background); } + if (transform.position) { + searchParams.append('p', encodeURI(transform.position)); + } + return { searchParams }; } @@ -76,11 +85,16 @@ class SharpService implements SSRImageService { } } + if (searchParams.has('fit')) { + transform.fit = searchParams.get('fit') as typeof transform.fit; + } + + if (searchParams.has('p')) { + transform.position = decodeURI(searchParams.get('p')!) as typeof transform.position; + } + if (searchParams.has('bg')) { - const background = searchParams.get('bg')!; - if (isColor(background)) { - transform.background = background; - } + transform.background = searchParams.get('bg') as ColorDefinition | undefined; } return transform; @@ -95,7 +109,14 @@ class SharpService implements SSRImageService { if (transform.width || transform.height) { const width = transform.width && Math.round(transform.width); const height = transform.height && Math.round(transform.height); - sharpImage.resize(width, height); + + sharpImage.resize({ + width, + height, + fit: transform.fit, + position: transform.position, + background: transform.background, + }); } // remove alpha channel and replace with background color if requested diff --git a/packages/integrations/image/test/sharp.test.js b/packages/integrations/image/test/sharp.test.js index 81172504bb5c1..8e2d1d3afd3d7 100644 --- a/packages/integrations/image/test/sharp.test.js +++ b/packages/integrations/image/test/sharp.test.js @@ -15,6 +15,8 @@ describe('Sharp service', () => { ['aspect ratio string', { src, aspectRatio: '16:9' }], ['aspect ratio float', { src, aspectRatio: 1.7 }], ['background color', { src, format: 'jpeg', background: '#333333' }], + ['crop fit', { src, fit: 'cover' }], + ['crop position', { src, position: 'center' }], ].forEach(([description, props]) => { it(description, async () => { const { searchParams } = await sharp.serializeTransform(props); @@ -32,6 +34,8 @@ describe('Sharp service', () => { verifyProp(props.width, 'w'); verifyProp(props.height, 'h'); verifyProp(props.aspectRatio, 'ar'); + verifyProp(props.fit, 'fit'); + verifyProp(props.position, 'p'); verifyProp(props.background, 'bg'); }); }); @@ -55,6 +59,8 @@ describe('Sharp service', () => { `f=jpeg&bg=%23333333&href=${href}`, { src, format: 'jpeg', background: '#333333' }, ], + ['crop fit', `fit=contain&href=${href}`, { src, fit: 'contain' }], + ['crop position', `p=right%20top&href=${href}`, { src, position: 'right top' }], ].forEach(([description, params, expected]) => { it(description, async () => { const searchParams = new URLSearchParams(params); From f226b677b821c3257cedc3c94921dc8d397c5ed0 Mon Sep 17 00:00:00 2001 From: tony-sull Date: Fri, 9 Sep 2022 20:16:27 +0000 Subject: [PATCH 24/30] [ci] format --- packages/integrations/image/src/loaders/sharp.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/image/src/loaders/sharp.ts b/packages/integrations/image/src/loaders/sharp.ts index ac1f10c8ac98f..fe11295a575b3 100644 --- a/packages/integrations/image/src/loaders/sharp.ts +++ b/packages/integrations/image/src/loaders/sharp.ts @@ -1,5 +1,5 @@ import sharp from 'sharp'; -import { ColorDefinition, isAspectRatioString, isColor, isOutputFormat } from '../loaders/index.js'; +import { ColorDefinition, isAspectRatioString, isOutputFormat } from '../loaders/index.js'; import type { OutputFormat, SSRImageService, TransformOptions } from './index.js'; class SharpService implements SSRImageService { From d28f7013c2b415cbf6b640f17c9678ef0ac53253 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 9 Sep 2022 16:56:07 -0400 Subject: [PATCH 25/30] Fix `[astro add]` fetch failure (#4703) * fix: apply fetch polyfill earlier * chore: changeset --- .changeset/mean-dingos-juggle.md | 5 +++++ packages/astro/src/core/add/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/mean-dingos-juggle.md diff --git a/.changeset/mean-dingos-juggle.md b/.changeset/mean-dingos-juggle.md new file mode 100644 index 0000000000000..8dfdfeeed8a49 --- /dev/null +++ b/.changeset/mean-dingos-juggle.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix: [astro add] Apply fetch polyfill before running diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index efcf75789f67d..c655dab5d7da8 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -57,6 +57,7 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record = { }; export default async function add(names: string[], { cwd, flags, logging, telemetry }: AddOptions) { + applyPolyfill(); if (flags.help || names.length === 0) { printHelp({ commandName: 'astro add', @@ -159,7 +160,6 @@ export default async function add(names: string[], { cwd, flags, logging, teleme const rawConfigPath = await resolveConfigPath({ cwd, flags }); let configURL = rawConfigPath ? pathToFileURL(rawConfigPath) : undefined; - applyPolyfill(); if (configURL) { debug('add', `Found config at ${configURL}`); From 100b8d0583bf5043144cf2b0de7886ff26d88e27 Mon Sep 17 00:00:00 2001 From: "Fred K. Bot" <108291165+fredkbot@users.noreply.github.com> Date: Fri, 9 Sep 2022 14:18:03 -0700 Subject: [PATCH 26/30] [ci] release (#4702) Co-authored-by: github-actions[bot] --- .changeset/breezy-flowers-pay.md | 5 --- .changeset/mean-dingos-juggle.md | 5 --- examples/basics/package.json | 2 +- examples/blog/package.json | 2 +- examples/component/package.json | 4 +- examples/docs/package.json | 2 +- examples/framework-alpine/package.json | 2 +- examples/framework-lit/package.json | 2 +- examples/framework-multiple/package.json | 2 +- examples/framework-preact/package.json | 2 +- examples/framework-react/package.json | 2 +- examples/framework-solid/package.json | 2 +- examples/framework-svelte/package.json | 2 +- examples/framework-vue/package.json | 2 +- examples/minimal/package.json | 2 +- examples/non-html-pages/package.json | 2 +- examples/portfolio/package.json | 2 +- examples/ssr/package.json | 2 +- examples/with-markdown-plugins/package.json | 2 +- examples/with-markdown-shiki/package.json | 2 +- examples/with-mdx/package.json | 2 +- examples/with-nanostores/package.json | 2 +- examples/with-tailwindcss/package.json | 2 +- examples/with-vite-plugin-pwa/package.json | 2 +- examples/with-vitest/package.json | 2 +- packages/astro/CHANGELOG.md | 6 +++ packages/astro/package.json | 2 +- packages/integrations/image/CHANGELOG.md | 6 +++ packages/integrations/image/package.json | 2 +- pnpm-lock.yaml | 46 ++++++++++----------- 30 files changed, 61 insertions(+), 59 deletions(-) delete mode 100644 .changeset/breezy-flowers-pay.md delete mode 100644 .changeset/mean-dingos-juggle.md diff --git a/.changeset/breezy-flowers-pay.md b/.changeset/breezy-flowers-pay.md deleted file mode 100644 index 04c16a239ec05..0000000000000 --- a/.changeset/breezy-flowers-pay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@astrojs/image': minor ---- - -Support additional Sharp resize options diff --git a/.changeset/mean-dingos-juggle.md b/.changeset/mean-dingos-juggle.md deleted file mode 100644 index 8dfdfeeed8a49..0000000000000 --- a/.changeset/mean-dingos-juggle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'astro': patch ---- - -Fix: [astro add] Apply fetch polyfill before running diff --git a/examples/basics/package.json b/examples/basics/package.json index 5efb134d101e9..d1ea84594345e 100644 --- a/examples/basics/package.json +++ b/examples/basics/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/blog/package.json b/examples/blog/package.json index e03f98439a9a2..aed49334df10d 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "@astrojs/mdx": "^0.11.1", "@astrojs/rss": "^1.0.0", "@astrojs/sitemap": "^1.0.0" diff --git a/examples/component/package.json b/examples/component/package.json index de72597e8ecde..fd70c4293aa66 100644 --- a/examples/component/package.json +++ b/examples/component/package.json @@ -15,9 +15,9 @@ ], "scripts": {}, "devDependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" }, "peerDependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/docs/package.json b/examples/docs/package.json index cb2fbba1614ec..1632052d3e046 100644 --- a/examples/docs/package.json +++ b/examples/docs/package.json @@ -11,7 +11,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/framework-alpine/package.json b/examples/framework-alpine/package.json index 3a600b303bf72..15d4931eb9bc7 100644 --- a/examples/framework-alpine/package.json +++ b/examples/framework-alpine/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "alpinejs": "^3.10.2", "@astrojs/alpinejs": "^0.1.2", "@types/alpinejs": "^3.7.0" diff --git a/examples/framework-lit/package.json b/examples/framework-lit/package.json index 9641080bfef7b..d46f1d96a6c85 100644 --- a/examples/framework-lit/package.json +++ b/examples/framework-lit/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "lit": "^2.2.5", "@astrojs/lit": "^1.0.0", "@webcomponents/template-shadowroot": "^0.1.0" diff --git a/examples/framework-multiple/package.json b/examples/framework-multiple/package.json index e6b0f66236be5..8b23093b27d32 100644 --- a/examples/framework-multiple/package.json +++ b/examples/framework-multiple/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "preact": "^10.7.3", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/examples/framework-preact/package.json b/examples/framework-preact/package.json index ed6d79d131a87..5f3f9338b61d8 100644 --- a/examples/framework-preact/package.json +++ b/examples/framework-preact/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "preact": "^10.7.3", "@astrojs/preact": "^1.1.0" } diff --git a/examples/framework-react/package.json b/examples/framework-react/package.json index a63a2cf5a1622..18805c079e5c9 100644 --- a/examples/framework-react/package.json +++ b/examples/framework-react/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "react": "^18.1.0", "react-dom": "^18.1.0", "@astrojs/react": "^1.1.2", diff --git a/examples/framework-solid/package.json b/examples/framework-solid/package.json index dea068f50c311..a7cbdad9b9f22 100644 --- a/examples/framework-solid/package.json +++ b/examples/framework-solid/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "solid-js": "^1.4.3", "@astrojs/solid-js": "^1.1.0" } diff --git a/examples/framework-svelte/package.json b/examples/framework-svelte/package.json index dbacbcb83b9de..86422d9a12623 100644 --- a/examples/framework-svelte/package.json +++ b/examples/framework-svelte/package.json @@ -12,6 +12,6 @@ "dependencies": { "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.0", - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/framework-vue/package.json b/examples/framework-vue/package.json index 898e600d06cad..d0eceaf0ed87e 100644 --- a/examples/framework-vue/package.json +++ b/examples/framework-vue/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "vue": "^3.2.37", "@astrojs/vue": "^1.0.1" } diff --git a/examples/minimal/package.json b/examples/minimal/package.json index dc880f49352da..904f4f60b2040 100644 --- a/examples/minimal/package.json +++ b/examples/minimal/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/non-html-pages/package.json b/examples/non-html-pages/package.json index 5eaf85b1f3da8..9d4a244f78af8 100644 --- a/examples/non-html-pages/package.json +++ b/examples/non-html-pages/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/portfolio/package.json b/examples/portfolio/package.json index 7ed9d68514f02..12f47762c4992 100644 --- a/examples/portfolio/package.json +++ b/examples/portfolio/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/ssr/package.json b/examples/ssr/package.json index 8885ab397a8f4..74087dcfcece8 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -12,7 +12,7 @@ }, "devDependencies": {}, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "svelte": "^3.48.0", "@astrojs/svelte": "^1.0.0", "@astrojs/node": "^1.0.1", diff --git a/examples/with-markdown-plugins/package.json b/examples/with-markdown-plugins/package.json index 136871e267026..0039219ae93ed 100644 --- a/examples/with-markdown-plugins/package.json +++ b/examples/with-markdown-plugins/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "@astrojs/markdown-remark": "^1.1.0", "hast-util-select": "5.0.1", "rehype-autolink-headings": "^6.1.1", diff --git a/examples/with-markdown-shiki/package.json b/examples/with-markdown-shiki/package.json index 187d0019b4db1..c4ae2e551babc 100644 --- a/examples/with-markdown-shiki/package.json +++ b/examples/with-markdown-shiki/package.json @@ -10,6 +10,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0" + "astro": "^1.2.1" } } diff --git a/examples/with-mdx/package.json b/examples/with-mdx/package.json index 2a85f5797b713..b507f7dcd3417 100644 --- a/examples/with-mdx/package.json +++ b/examples/with-mdx/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "preact": "^10.6.5", "@astrojs/preact": "^1.1.0", "@astrojs/mdx": "^0.11.1" diff --git a/examples/with-nanostores/package.json b/examples/with-nanostores/package.json index 45a4eb5e80419..d99d027ad37e0 100644 --- a/examples/with-nanostores/package.json +++ b/examples/with-nanostores/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "preact": "^10.7.3", "@astrojs/preact": "^1.1.0", "nanostores": "^0.5.12", diff --git a/examples/with-tailwindcss/package.json b/examples/with-tailwindcss/package.json index 6d9b6360ce345..13738f0906a88 100644 --- a/examples/with-tailwindcss/package.json +++ b/examples/with-tailwindcss/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "@astrojs/tailwind": "^1.0.0", "autoprefixer": "^10.4.7", "canvas-confetti": "^1.5.1", diff --git a/examples/with-vite-plugin-pwa/package.json b/examples/with-vite-plugin-pwa/package.json index 224ccf99a0de2..0014742b8f73b 100644 --- a/examples/with-vite-plugin-pwa/package.json +++ b/examples/with-vite-plugin-pwa/package.json @@ -10,7 +10,7 @@ "astro": "astro" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "vite-plugin-pwa": "0.11.11", "workbox-window": "^6.5.3" } diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 7d2a88b483e1d..494abf392ce16 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -12,7 +12,7 @@ "test": "vitest" }, "dependencies": { - "astro": "^1.2.0", + "astro": "^1.2.1", "vitest": "^0.20.3" } } diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 0c3d98679cdf6..0d8781cabecee 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,5 +1,11 @@ # astro +## 1.2.1 + +### Patch Changes + +- [#4703](https://github.com/withastro/astro/pull/4703) [`d28f7013c`](https://github.com/withastro/astro/commit/d28f7013c2b415cbf6b640f17c9678ef0ac53253) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix: [astro add] Apply fetch polyfill before running + ## 1.2.0 ### Minor Changes diff --git a/packages/astro/package.json b/packages/astro/package.json index bbef9c7138531..8d31587888ead 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -1,6 +1,6 @@ { "name": "astro", - "version": "1.2.0", + "version": "1.2.1", "description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.", "type": "module", "author": "withastro", diff --git a/packages/integrations/image/CHANGELOG.md b/packages/integrations/image/CHANGELOG.md index 41ce91ed0efbc..8bdb6ee6ee74a 100644 --- a/packages/integrations/image/CHANGELOG.md +++ b/packages/integrations/image/CHANGELOG.md @@ -1,5 +1,11 @@ # @astrojs/image +## 0.7.0 + +### Minor Changes + +- [#4438](https://github.com/withastro/astro/pull/4438) [`1e5d8ba9a`](https://github.com/withastro/astro/commit/1e5d8ba9af4eb017382263653216e5247d96ab79) Thanks [@obennaci](https://github.com/obennaci)! - Support additional Sharp resize options + ## 0.6.1 ### Patch Changes diff --git a/packages/integrations/image/package.json b/packages/integrations/image/package.json index bb6f552081fa9..e21927a45055c 100644 --- a/packages/integrations/image/package.json +++ b/packages/integrations/image/package.json @@ -1,7 +1,7 @@ { "name": "@astrojs/image", "description": "Load and transform images in your Astro site.", - "version": "0.6.1", + "version": "0.7.0", "type": "module", "types": "./dist/index.d.ts", "author": "withastro", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3c91c08c652e4..8f041c15e1b48 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,7 +56,7 @@ importers: examples/basics: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 dependencies: astro: link:../../packages/astro @@ -65,7 +65,7 @@ importers: '@astrojs/mdx': ^0.11.1 '@astrojs/rss': ^1.0.0 '@astrojs/sitemap': ^1.0.0 - astro: ^1.2.0 + astro: ^1.2.1 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx '@astrojs/rss': link:../../packages/astro-rss @@ -74,7 +74,7 @@ importers: examples/component: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 devDependencies: astro: link:../../packages/astro @@ -88,7 +88,7 @@ importers: '@types/node': ^18.0.0 '@types/react': ^17.0.45 '@types/react-dom': ^18.0.0 - astro: ^1.2.0 + astro: ^1.2.1 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -111,7 +111,7 @@ importers: '@astrojs/alpinejs': ^0.1.2 '@types/alpinejs': ^3.7.0 alpinejs: ^3.10.2 - astro: ^1.2.0 + astro: ^1.2.1 dependencies: '@astrojs/alpinejs': link:../../packages/integrations/alpinejs '@types/alpinejs': 3.7.0 @@ -122,7 +122,7 @@ importers: specifiers: '@astrojs/lit': ^1.0.0 '@webcomponents/template-shadowroot': ^0.1.0 - astro: ^1.2.0 + astro: ^1.2.1 lit: ^2.2.5 dependencies: '@astrojs/lit': link:../../packages/integrations/lit @@ -137,7 +137,7 @@ importers: '@astrojs/solid-js': ^1.1.0 '@astrojs/svelte': ^1.0.0 '@astrojs/vue': ^1.0.1 - astro: ^1.2.0 + astro: ^1.2.1 preact: ^10.7.3 react: ^18.1.0 react-dom: ^18.1.0 @@ -161,7 +161,7 @@ importers: examples/framework-preact: specifiers: '@astrojs/preact': ^1.1.0 - astro: ^1.2.0 + astro: ^1.2.1 preact: ^10.7.3 dependencies: '@astrojs/preact': link:../../packages/integrations/preact @@ -173,7 +173,7 @@ importers: '@astrojs/react': ^1.1.2 '@types/react': ^18.0.10 '@types/react-dom': ^18.0.5 - astro: ^1.2.0 + astro: ^1.2.1 react: ^18.1.0 react-dom: ^18.1.0 dependencies: @@ -187,7 +187,7 @@ importers: examples/framework-solid: specifiers: '@astrojs/solid-js': ^1.1.0 - astro: ^1.2.0 + astro: ^1.2.1 solid-js: ^1.4.3 dependencies: '@astrojs/solid-js': link:../../packages/integrations/solid @@ -197,7 +197,7 @@ importers: examples/framework-svelte: specifiers: '@astrojs/svelte': ^1.0.0 - astro: ^1.2.0 + astro: ^1.2.1 svelte: ^3.48.0 dependencies: '@astrojs/svelte': link:../../packages/integrations/svelte @@ -207,7 +207,7 @@ importers: examples/framework-vue: specifiers: '@astrojs/vue': ^1.0.1 - astro: ^1.2.0 + astro: ^1.2.1 vue: ^3.2.37 dependencies: '@astrojs/vue': link:../../packages/integrations/vue @@ -216,19 +216,19 @@ importers: examples/minimal: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 dependencies: astro: link:../../packages/astro examples/non-html-pages: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 dependencies: astro: link:../../packages/astro examples/portfolio: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 dependencies: astro: link:../../packages/astro @@ -236,7 +236,7 @@ importers: specifiers: '@astrojs/node': ^1.0.1 '@astrojs/svelte': ^1.0.0 - astro: ^1.2.0 + astro: ^1.2.1 concurrently: ^7.2.1 lightcookie: ^1.0.25 svelte: ^3.48.0 @@ -255,7 +255,7 @@ importers: examples/with-markdown-plugins: specifiers: '@astrojs/markdown-remark': ^1.1.0 - astro: ^1.2.0 + astro: ^1.2.1 hast-util-select: 5.0.1 rehype-autolink-headings: ^6.1.1 rehype-slug: ^5.0.1 @@ -272,7 +272,7 @@ importers: examples/with-markdown-shiki: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 dependencies: astro: link:../../packages/astro @@ -280,7 +280,7 @@ importers: specifiers: '@astrojs/mdx': ^0.11.1 '@astrojs/preact': ^1.1.0 - astro: ^1.2.0 + astro: ^1.2.1 preact: ^10.6.5 dependencies: '@astrojs/mdx': link:../../packages/integrations/mdx @@ -292,7 +292,7 @@ importers: specifiers: '@astrojs/preact': ^1.1.0 '@nanostores/preact': ^0.1.3 - astro: ^1.2.0 + astro: ^1.2.1 nanostores: ^0.5.12 preact: ^10.7.3 dependencies: @@ -305,7 +305,7 @@ importers: examples/with-tailwindcss: specifiers: '@astrojs/tailwind': ^1.0.0 - astro: ^1.2.0 + astro: ^1.2.1 autoprefixer: ^10.4.7 canvas-confetti: ^1.5.1 postcss: ^8.4.14 @@ -320,7 +320,7 @@ importers: examples/with-vite-plugin-pwa: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 vite-plugin-pwa: 0.11.11 workbox-window: ^6.5.3 dependencies: @@ -330,7 +330,7 @@ importers: examples/with-vitest: specifiers: - astro: ^1.2.0 + astro: ^1.2.1 vitest: ^0.20.3 dependencies: astro: link:../../packages/astro From b0ee81d0a70d8301530c321b670ab784c9bc00a2 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 9 Sep 2022 19:09:59 -0400 Subject: [PATCH 27/30] Fix: Vue `script setup` with other renderers applied (#4706) * fix: add __ssrInlineRender to Vue check * chore: remove console log * test: vue builds with other renderer present * chore: changeset --- .changeset/green-pillows-hammer.md | 5 ++ .../vue-with-multi-renderer/astro.config.mjs | 8 +++ .../vue-with-multi-renderer/package.json | 10 ++++ .../src/components/Counter.vue | 54 ++++++++++++++++++ .../src/components/CounterWithScriptSetup.vue | 15 +++++ .../src/pages/index.astro | 55 +++++++++++++++++++ .../test/vue-with-multi-renderer.test.js | 21 +++++++ packages/integrations/vue/server.js | 2 +- pnpm-lock.yaml | 10 ++++ 9 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 .changeset/green-pillows-hammer.md create mode 100644 packages/astro/test/fixtures/vue-with-multi-renderer/astro.config.mjs create mode 100644 packages/astro/test/fixtures/vue-with-multi-renderer/package.json create mode 100644 packages/astro/test/fixtures/vue-with-multi-renderer/src/components/Counter.vue create mode 100644 packages/astro/test/fixtures/vue-with-multi-renderer/src/components/CounterWithScriptSetup.vue create mode 100644 packages/astro/test/fixtures/vue-with-multi-renderer/src/pages/index.astro create mode 100644 packages/astro/test/vue-with-multi-renderer.test.js diff --git a/.changeset/green-pillows-hammer.md b/.changeset/green-pillows-hammer.md new file mode 100644 index 0000000000000..ca3bef981bf41 --- /dev/null +++ b/.changeset/green-pillows-hammer.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vue': patch +--- + +Fix Vue `script setup` with other renderers applied diff --git a/packages/astro/test/fixtures/vue-with-multi-renderer/astro.config.mjs b/packages/astro/test/fixtures/vue-with-multi-renderer/astro.config.mjs new file mode 100644 index 0000000000000..3c67ad96522a8 --- /dev/null +++ b/packages/astro/test/fixtures/vue-with-multi-renderer/astro.config.mjs @@ -0,0 +1,8 @@ +import { defineConfig } from 'astro/config'; +import svelte from '@astrojs/svelte'; +import vue from '@astrojs/vue'; + +// https://astro.build/config +export default defineConfig({ + integrations: [vue(), svelte()], +}); diff --git a/packages/astro/test/fixtures/vue-with-multi-renderer/package.json b/packages/astro/test/fixtures/vue-with-multi-renderer/package.json new file mode 100644 index 0000000000000..e36b012a6ac85 --- /dev/null +++ b/packages/astro/test/fixtures/vue-with-multi-renderer/package.json @@ -0,0 +1,10 @@ +{ + "name": "@test/vue-with-multi-renderer", + "version": "0.0.0", + "private": true, + "dependencies": { + "@astrojs/vue": "workspace:*", + "@astrojs/svelte": "workspace:*", + "astro": "workspace:*" + } +} diff --git a/packages/astro/test/fixtures/vue-with-multi-renderer/src/components/Counter.vue b/packages/astro/test/fixtures/vue-with-multi-renderer/src/components/Counter.vue new file mode 100644 index 0000000000000..ed6fb5fb43709 --- /dev/null +++ b/packages/astro/test/fixtures/vue-with-multi-renderer/src/components/Counter.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/packages/astro/test/fixtures/vue-with-multi-renderer/src/components/CounterWithScriptSetup.vue b/packages/astro/test/fixtures/vue-with-multi-renderer/src/components/CounterWithScriptSetup.vue new file mode 100644 index 0000000000000..1b63df0d6687a --- /dev/null +++ b/packages/astro/test/fixtures/vue-with-multi-renderer/src/components/CounterWithScriptSetup.vue @@ -0,0 +1,15 @@ + + + diff --git a/packages/astro/test/fixtures/vue-with-multi-renderer/src/pages/index.astro b/packages/astro/test/fixtures/vue-with-multi-renderer/src/pages/index.astro new file mode 100644 index 0000000000000..12cd7bb54eb2c --- /dev/null +++ b/packages/astro/test/fixtures/vue-with-multi-renderer/src/pages/index.astro @@ -0,0 +1,55 @@ +--- +import Counter from '../components/Counter.vue'; +import CounterWithScriptSetup from '../components/CounterWithScriptSetup.vue'; + +const someProps = { + count: 0, +}; +--- + + + + + + + +

Hello, server!

+
+ + +

Hello, client:idle!

+
+ + +

Hello, client:load!

+
+ + +

Hello, client:visible!

+
+ + +

Hello, client:media!

+
+ + +

Hello, server!

+
+ + +

Hello, client:idle!

+
+ + +

Hello, client:load!

+
+ + +

Hello, client:visible!

+
+ + +

Hello, client:media!

+
+ + diff --git a/packages/astro/test/vue-with-multi-renderer.test.js b/packages/astro/test/vue-with-multi-renderer.test.js new file mode 100644 index 0000000000000..62ad964918844 --- /dev/null +++ b/packages/astro/test/vue-with-multi-renderer.test.js @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import * as cheerio from 'cheerio'; +import { loadFixture } from './test-utils.js'; + +describe('Vue with multi-renderer', () => { + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: './fixtures/vue-with-multi-renderer/', + }); + }); + + it('builds with another renderer present', async () => { + try { + await fixture.build(); + } catch (e) { + expect(e).to.equal(undefined, `Should not throw`); + } + }); +}); diff --git a/packages/integrations/vue/server.js b/packages/integrations/vue/server.js index 883aa4de0054a..8d4c6df9e0e26 100644 --- a/packages/integrations/vue/server.js +++ b/packages/integrations/vue/server.js @@ -3,7 +3,7 @@ import { renderToString } from 'vue/server-renderer'; import StaticHtml from './static-html.js'; function check(Component) { - return !!Component['ssrRender']; + return !!Component['ssrRender'] || !!Component['__ssrInlineRender']; } async function renderToStaticMarkup(Component, props, slotted) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f041c15e1b48..836f848b8f1c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2073,6 +2073,16 @@ importers: '@astrojs/vue': link:../../../../integrations/vue astro: link:../../.. + packages/astro/test/fixtures/vue-with-multi-renderer: + specifiers: + '@astrojs/svelte': workspace:* + '@astrojs/vue': workspace:* + astro: workspace:* + dependencies: + '@astrojs/svelte': link:../../../../integrations/svelte + '@astrojs/vue': link:../../../../integrations/vue + astro: link:../../.. + packages/astro/test/fixtures/with-endpoint-routes: specifiers: astro: workspace:* From ee03967f9249dc91d2b02bf4c731bfe069d1fb67 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Mon, 12 Sep 2022 17:29:13 +0900 Subject: [PATCH 28/30] Fix typo in render/head.ts (#4720) --- packages/astro/src/runtime/server/render/head.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/astro/src/runtime/server/render/head.ts b/packages/astro/src/runtime/server/render/head.ts index bb0fffc2ecfd5..ed4b73f3ebaea 100644 --- a/packages/astro/src/runtime/server/render/head.ts +++ b/packages/astro/src/runtime/server/render/head.ts @@ -32,7 +32,7 @@ export function renderHead(result: SSRResult): Promise { } // This function is called by Astro components that do not contain a component -// This accomodates the fact that using a is optional in Astro, so this +// This accommodates the fact that using a is optional in Astro, so this // is called before a component's first non-head HTML element. If the head was // already injected it is a noop. export async function* maybeRenderHead(result: SSRResult): AsyncIterable { From 5b6173fd031b7e85974cbadd39de7fa199075e44 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:55:06 -0300 Subject: [PATCH 29/30] Add an error message for improperly configured renderers (#4705) * Add error messages for wrongly configured renderers * Add changeset --- .changeset/fuzzy-rats-remain.md | 5 +++++ packages/astro/src/integrations/index.ts | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 .changeset/fuzzy-rats-remain.md diff --git a/.changeset/fuzzy-rats-remain.md b/.changeset/fuzzy-rats-remain.md new file mode 100644 index 0000000000000..601d2483b8574 --- /dev/null +++ b/.changeset/fuzzy-rats-remain.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Properly show an error message when a renderer is not properly configured diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index ba9cac2c8b562..68d2a23aeff13 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -66,6 +66,14 @@ export async function runHookConfigSetup({ config: updatedConfig, command, addRenderer(renderer: AstroRenderer) { + if (!renderer.name) { + throw new Error(`Integration ${bold(integration.name)} has an unnamed renderer.`); + } + + if (!renderer.serverEntrypoint) { + throw new Error(`Renderer ${bold(renderer.name)} does not provide a serverEntrypoint.`); + } + updatedConfig._ctx.renderers.push(renderer); }, injectScript: (stage, content) => { From 562147a5b4a4d7e9bcf50191e386bcca25112f0a Mon Sep 17 00:00:00 2001 From: "Fred K. Bot" <108291165+fredkbot@users.noreply.github.com> Date: Mon, 12 Sep 2022 08:31:58 -0700 Subject: [PATCH 30/30] [ci] update lockfile (#4711) Co-authored-by: FredKSchott --- pnpm-lock.yaml | 402 +++++++++++++++++++++++++------------------------ 1 file changed, 203 insertions(+), 199 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 836f848b8f1c5..fcb3c2d200c42 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,14 +37,14 @@ importers: '@changesets/changelog-github': 0.4.4 '@changesets/cli': 2.23.0_kcozqtpxuwjzskw6zg5royevn4 '@octokit/action': 3.18.1 - '@typescript-eslint/eslint-plugin': 5.36.2_kou65mzxaniwtkb2mhvaghdcyi - '@typescript-eslint/parser': 5.36.2_sorwav4hsh5vncerguqybud76i + '@typescript-eslint/eslint-plugin': 5.36.2_ymvve5pmriizw6sqldrdyt3llu + '@typescript-eslint/parser': 5.36.2_4brgkhw6cq4me3drk3kxrpb2mm del: 6.1.1 esbuild: 0.14.54 - eslint: 8.23.0 - eslint-config-prettier: 8.5.0_eslint@8.23.0 + eslint: 8.23.1 + eslint-config-prettier: 8.5.0_eslint@8.23.1 eslint-plugin-no-only-tests: 2.6.0 - eslint-plugin-prettier: 4.2.1_tgumt6uwl2md3n6uqnggd6wvce + eslint-plugin-prettier: 4.2.1_cabrci5exjdaojcvd6xoxgeowu execa: 6.1.0 organize-imports-cli: 0.10.0 prettier: 2.7.1 @@ -102,7 +102,7 @@ importers: '@types/react': 17.0.49 '@types/react-dom': 18.0.6 astro: link:../../packages/astro - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -151,7 +151,7 @@ importers: '@astrojs/svelte': link:../../packages/integrations/svelte '@astrojs/vue': link:../../packages/integrations/vue astro: link:../../packages/astro - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -166,7 +166,7 @@ importers: dependencies: '@astrojs/preact': link:../../packages/integrations/preact astro: link:../../packages/astro - preact: 10.10.6 + preact: 10.11.0 examples/framework-react: specifiers: @@ -178,7 +178,7 @@ importers: react-dom: ^18.1.0 dependencies: '@astrojs/react': link:../../packages/integrations/react - '@types/react': 18.0.18 + '@types/react': 18.0.19 '@types/react-dom': 18.0.6 astro: link:../../packages/astro react: 18.2.0 @@ -286,7 +286,7 @@ importers: '@astrojs/mdx': link:../../packages/integrations/mdx '@astrojs/preact': link:../../packages/integrations/preact astro: link:../../packages/astro - preact: 10.10.6 + preact: 10.11.0 examples/with-nanostores: specifiers: @@ -297,10 +297,10 @@ importers: preact: ^10.7.3 dependencies: '@astrojs/preact': link:../../packages/integrations/preact - '@nanostores/preact': 0.1.3_sjll44dhi63q3s6wepldehyzyi + '@nanostores/preact': 0.1.3_wyz6kgcab5rxpkhqcycsg2kmqm astro: link:../../packages/astro nanostores: 0.5.13 - preact: 10.10.6 + preact: 10.11.0 examples/with-tailwindcss: specifiers: @@ -313,7 +313,7 @@ importers: dependencies: '@astrojs/tailwind': link:../../packages/integrations/tailwind astro: link:../../packages/astro - autoprefixer: 10.4.8_postcss@8.4.16 + autoprefixer: 10.4.9_postcss@8.4.16 canvas-confetti: 1.5.1 postcss: 8.4.16 tailwindcss: 3.1.8_postcss@8.4.16 @@ -438,7 +438,7 @@ importers: '@types/html-escaper': 3.0.0 '@types/yargs-parser': 21.0.0 boxen: 6.2.1 - ci-info: 3.3.2 + ci-info: 3.4.0 common-ancestor-path: 1.0.1 debug: 4.3.4 diff: 5.1.0 @@ -477,7 +477,7 @@ importers: vfile: 5.3.5 vite: 3.0.9_sass@1.54.9 yargs-parser: 21.1.1 - zod: 3.19.0 + zod: 3.19.1 devDependencies: '@playwright/test': 1.25.2 '@types/babel__generator': 7.6.4 @@ -560,7 +560,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.37 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -590,7 +590,7 @@ importers: react: ^18.1.0 react-dom: ^18.1.0 dependencies: - '@adobe/react-spectrum': 3.21.1_biqbaboplfbrettd7655fr4n2y + '@adobe/react-spectrum': 3.21.2_biqbaboplfbrettd7655fr4n2y '@astrojs/react': link:../../../../integrations/react astro: link:../../.. react: 18.2.0 @@ -670,7 +670,7 @@ importers: dependencies: '@webcomponents/template-shadowroot': 0.1.0 lit: 2.3.1 - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -692,7 +692,7 @@ importers: astro: workspace:* preact: ^10.7.3 dependencies: - preact: 10.10.6 + preact: 10.11.0 devDependencies: '@astrojs/mdx': link:../../../../integrations/mdx '@astrojs/preact': link:../../../../integrations/preact @@ -713,7 +713,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.37 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -742,7 +742,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.37 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -771,7 +771,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.37 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -800,7 +800,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.37 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -829,7 +829,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.37 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -858,7 +858,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.36 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -899,7 +899,7 @@ importers: dependencies: '@astrojs/preact': link:../../../../integrations/preact astro: link:../../.. - preact: 10.10.6 + preact: 10.11.0 packages/astro/e2e/fixtures/preact-component: specifiers: @@ -911,7 +911,7 @@ importers: '@astrojs/mdx': link:../../../../integrations/mdx '@astrojs/preact': link:../../../../integrations/preact astro: link:../../.. - preact: 10.10.6 + preact: 10.11.0 packages/astro/e2e/fixtures/react-component: specifiers: @@ -1597,7 +1597,7 @@ importers: svelte: ^3.48.0 vue: ^3.2.36 dependencies: - preact: 10.10.6 + preact: 10.11.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 solid-js: 1.5.4 @@ -1703,7 +1703,7 @@ importers: '@astrojs/svelte': link:../../../../integrations/svelte '@astrojs/vue': link:../../../../integrations/vue astro: link:../../.. - autoprefixer: 10.4.8_postcss@8.4.16 + autoprefixer: 10.4.9_postcss@8.4.16 postcss: 8.4.16 devDependencies: postcss-preset-env: 7.8.1_postcss@8.4.16 @@ -1718,7 +1718,7 @@ importers: '@astrojs/preact': link:../../../../integrations/preact '@test/react-lib': link:packages/react-lib astro: link:../../.. - preact: 10.10.6 + preact: 10.11.0 packages/astro/test/fixtures/preact-compat-component/packages/react-lib: specifiers: @@ -2035,7 +2035,7 @@ importers: '@astrojs/mdx': link:../../../../integrations/mdx '@astrojs/tailwind': link:../../../../integrations/tailwind astro: link:../../.. - autoprefixer: 10.4.8_postcss@8.4.16 + autoprefixer: 10.4.9_postcss@8.4.16 postcss: 8.4.16 tailwindcss: 3.1.8_postcss@8.4.16 @@ -2523,11 +2523,11 @@ importers: '@babel/core': 7.19.0 '@babel/plugin-transform-react-jsx': 7.19.0_@babel+core@7.19.0 babel-plugin-module-resolver: 4.1.0 - preact-render-to-string: 5.2.3_preact@10.10.6 + preact-render-to-string: 5.2.4_preact@10.11.0 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts - preact: 10.10.6 + preact: 10.11.0 packages/integrations/prefetch: specifiers: @@ -2586,7 +2586,7 @@ importers: zod: ^3.17.3 dependencies: sitemap: 7.1.1 - zod: 3.19.0 + zod: 3.19.1 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts @@ -2644,7 +2644,7 @@ importers: tailwindcss: ^3.0.24 dependencies: '@proload/core': 0.3.3 - autoprefixer: 10.4.8_postcss@8.4.16 + autoprefixer: 10.4.9_postcss@8.4.16 postcss: 8.4.16 tailwindcss: 3.1.8_postcss@8.4.16 devDependencies: @@ -2884,7 +2884,7 @@ importers: node-fetch: ^3.2.5 which-pm-runs: ^1.1.0 dependencies: - ci-info: 3.3.2 + ci-info: 3.4.0 debug: 4.3.4 dlv: 1.1.3 dset: 3.1.2 @@ -2999,8 +2999,8 @@ packages: react-dom: 18.2.0_react@18.2.0 dev: false - /@adobe/react-spectrum/3.21.1_biqbaboplfbrettd7655fr4n2y: - resolution: {integrity: sha512-qPWAcq1pXfyXJY+wy7UE4XbtGjSgsDcvv373mC3zo/dbEIZLhZy0+fT5H7J+03ucupREXSMBfQrrW6vvbNc0dw==} + /@adobe/react-spectrum/3.21.2_biqbaboplfbrettd7655fr4n2y: + resolution: {integrity: sha512-jY9yXqWSgciBx4vy+rRugje/baZLG9u8oDMmcnzICGIDUs1V6LJCmKRxymcN7jcNH3+XpGaH95AtIKwfzistEw==} peerDependencies: react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 @@ -3044,7 +3044,7 @@ packages: '@react-spectrum/slider': 3.2.1_d3gwqomfnldt4r5nc27dmvnsce '@react-spectrum/statuslight': 3.4.1_d3gwqomfnldt4r5nc27dmvnsce '@react-spectrum/switch': 3.3.1_vq3pvykbfgerr5rtx4n53bcbxy - '@react-spectrum/table': 3.3.1_vq3pvykbfgerr5rtx4n53bcbxy + '@react-spectrum/table': 3.3.2_vq3pvykbfgerr5rtx4n53bcbxy '@react-spectrum/tabs': 3.3.1_vq3pvykbfgerr5rtx4n53bcbxy '@react-spectrum/text': 3.3.1_d3gwqomfnldt4r5nc27dmvnsce '@react-spectrum/textfield': 3.7.0_vq3pvykbfgerr5rtx4n53bcbxy @@ -5133,8 +5133,8 @@ packages: dev: false optional: true - /@eslint/eslintrc/1.3.1: - resolution: {integrity: sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==} + /@eslint/eslintrc/1.3.2: + resolution: {integrity: sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -5231,7 +5231,7 @@ packages: '@antfu/utils': 0.5.2 '@iconify/types': 1.1.0 debug: 4.3.4 - kolorist: 1.5.1 + kolorist: 1.6.0 local-pkg: 0.4.2 transitivePeerDependencies: - supports-color @@ -5415,32 +5415,32 @@ packages: - supports-color dev: false - /@miniflare/cache/2.8.1: - resolution: {integrity: sha512-7b+x6TB2Jee+G0wdlW/w0GW5UpNM7e1PxDkrn2Xw1wnTLgGNTUXqPPcVNgughrszlMfvXez+PQpm3yAQ32HPmg==} + /@miniflare/cache/2.8.2: + resolution: {integrity: sha512-YaFOsXKmlNLk5xDJfyDCMsRaoZLFLPqHAiEsZBZTcCl3FlZbG2GUIvcMlfkO4OKb1nCjtr9OxFgtIdW6DEuboA==} engines: {node: '>=16.13'} dependencies: - '@miniflare/core': 2.8.1 - '@miniflare/shared': 2.8.1 + '@miniflare/core': 2.8.2 + '@miniflare/shared': 2.8.2 http-cache-semantics: 4.1.0 undici: 5.9.1 dev: true - /@miniflare/cli-parser/2.8.1: - resolution: {integrity: sha512-3pt3DlsV3BsA8/JcbZpN1vLq1CMrbpV5NBBpopzY0zlhjbjhjD0cbeVkXB7iODQmdSyIskotiie7OJtvQUPmDw==} + /@miniflare/cli-parser/2.8.2: + resolution: {integrity: sha512-qa//FhLiJpQpTngq6tCJMZqc1CjhJQV4AwKWaIp85XiVbpbN/cTzZ6PUyoYLTZ6g6dL4j+136o2bb+2XSMxVHw==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 kleur: 4.1.5 dev: true - /@miniflare/core/2.8.1: - resolution: {integrity: sha512-7x32lo4p3dtPAMAYvt+yiUPdtUt2hbYP2JvE7d1pasNWl4mFtgbfEQxRp1jcSFlFcatJszTsR4CAtlDP6n0Esg==} + /@miniflare/core/2.8.2: + resolution: {integrity: sha512-a9Ecyf4xALcvphQhK3qA+mtUApUrUbwcxCexXvvgVsPrQtMCOIjJ2qs7+RKrC+krCy2O8Eq/8eq2hYh4y/HOKQ==} engines: {node: '>=16.13'} dependencies: '@iarna/toml': 2.2.5 - '@miniflare/queues': 2.8.1 - '@miniflare/shared': 2.8.1 - '@miniflare/watcher': 2.8.1 + '@miniflare/queues': 2.8.2 + '@miniflare/shared': 2.8.2 + '@miniflare/watcher': 2.8.2 busboy: 1.6.0 dotenv: 10.0.0 kleur: 4.1.5 @@ -5449,33 +5449,33 @@ packages: urlpattern-polyfill: 4.0.3 dev: true - /@miniflare/durable-objects/2.8.1: - resolution: {integrity: sha512-qdBKjQssugMMtS+5g2qMvkJ37rnK37Vhlp6+I5w6g5CLEkA6hxpgWX7T7p/c5i0aBr/oT/RPsiumkXWkwzBceA==} + /@miniflare/durable-objects/2.8.2: + resolution: {integrity: sha512-jKcnb6lfgVZKfTPom2d0yPiaVAuDJLyr4itzb3nqJNH5Ld2iKJv77iSGOEOv8Wb78YEEFU8PQZvvrAC/TmN6tQ==} engines: {node: '>=16.13'} dependencies: - '@miniflare/core': 2.8.1 - '@miniflare/shared': 2.8.1 - '@miniflare/storage-memory': 2.8.1 + '@miniflare/core': 2.8.2 + '@miniflare/shared': 2.8.2 + '@miniflare/storage-memory': 2.8.2 undici: 5.9.1 dev: true - /@miniflare/html-rewriter/2.8.1: - resolution: {integrity: sha512-TkoK8jB06uwXyYTSEarmXG/FnnD90Q4FCwN9dtixlQVyGUBiVI3/KRxsXDApCJhinQRthdh4tQOMb3K2KsVd1Q==} + /@miniflare/html-rewriter/2.8.2: + resolution: {integrity: sha512-xxrLO7XMpiaWi6HSIqvAxmD5z6RRHWENkWuWjQqaqC6E6qheN+d0ZeZshyP2SRbJUw9wfFUj5zkKTva5sovzbw==} engines: {node: '>=16.13'} dependencies: - '@miniflare/core': 2.8.1 - '@miniflare/shared': 2.8.1 + '@miniflare/core': 2.8.2 + '@miniflare/shared': 2.8.2 html-rewriter-wasm: 0.4.1 undici: 5.9.1 dev: true - /@miniflare/http-server/2.8.1: - resolution: {integrity: sha512-Xp5h37G10zVDN13Nqv3RsfCI89UqGLf5YTlQ7Wj2JZi9Oz4+fWShzZCzKjtpefrPAyV0w9hPnI3088rjypUKXQ==} + /@miniflare/http-server/2.8.2: + resolution: {integrity: sha512-hrTRHHz+LWe7cLkP8Xg4hM3YRH7kI4ngOYozkEz1OC69SLBnxfT8xLkUkvz+fdJ3vquF+dpHyVQAa0dpvJShGA==} engines: {node: '>=16.13'} dependencies: - '@miniflare/core': 2.8.1 - '@miniflare/shared': 2.8.1 - '@miniflare/web-sockets': 2.8.1 + '@miniflare/core': 2.8.2 + '@miniflare/shared': 2.8.2 + '@miniflare/web-sockets': 2.8.2 kleur: 4.1.5 selfsigned: 2.1.1 undici: 5.9.1 @@ -5486,89 +5486,89 @@ packages: - utf-8-validate dev: true - /@miniflare/kv/2.8.1: - resolution: {integrity: sha512-UQkWNqNkCohMceqHwismvxUDk99+e8YAxhWBQBuHm8L1L236aID5rGVaAodlzwWFXiEwlDsqEYWXyX0x8NYGlw==} + /@miniflare/kv/2.8.2: + resolution: {integrity: sha512-radkyE6FtLGAoumf8S1VnPHAbgiP1DOzGnBnBVferMDkd86/3P8hre1a+C9PUTgt6e6KgLq4AKEFDwRJHc1MFw==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 dev: true - /@miniflare/queues/2.8.1: - resolution: {integrity: sha512-+VPogDWD9CnauNw5C1z8lwxBH0FX/qlPI6BGLQGXS4czPqio1py4AwZXZ4wymh7jMIn853+nExKeeZDmyl2J6Q==} + /@miniflare/queues/2.8.2: + resolution: {integrity: sha512-WYlK5L7ukdcL86DdB/BsJhnX7jcLNzyYdcn5vPQbCnDyaK1Lz9lm1RCrtCz7qwJjTrq5z453pczm0ELTxa5n9g==} engines: {node: '>=16.7'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 dev: true - /@miniflare/r2/2.8.1: - resolution: {integrity: sha512-5MMciySrss1Beh2IKNRGLmbg7do0fjvItWJcShYuyFLUXbu6WONWkhLcMP0VOAJCKs8QoPpk+ghBHODT0dybAQ==} + /@miniflare/r2/2.8.2: + resolution: {integrity: sha512-cdqq1dcgfiTlCf3wjQjrhZuRb0vJImLwYSALVEAA/4leVhwNY9ABHIn71y29Nf4bUdv2YKVSfTuV0m0CRGmOqA==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 undici: 5.9.1 dev: true - /@miniflare/runner-vm/2.8.1: - resolution: {integrity: sha512-oQjJdT/3k1Lq8TymAcPaWor7ik+qSjznNb8G+1GwNz5F3qT5fH8ccdmNgtqTwHTq12+U3VrmXD5c5HR7UcWaCg==} + /@miniflare/runner-vm/2.8.2: + resolution: {integrity: sha512-l9V/MedhH1Dc/xIEPEpXW57Y649lcTCYorwqnHPca3didiw75O8jI2g6MvuVlodmbimpg2WtwI7/2ac0WFZfWQ==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 dev: true - /@miniflare/scheduler/2.8.1: - resolution: {integrity: sha512-evhZtZMJJHalKDaqzlAaHTgLSDyj3A1mbJB3oHZQ3XLG9ufNSEPveDorLTppi0yYjGz9ju+duX/GPXlky35InQ==} + /@miniflare/scheduler/2.8.2: + resolution: {integrity: sha512-vhtyPky+1Phq4Arul3mpzRWJuqJex2YgkPnf9MLA977dcxptRBOzGIxwVPzaUTtko4mHwwzEyl15diT/BXkPJA==} engines: {node: '>=16.13'} dependencies: - '@miniflare/core': 2.8.1 - '@miniflare/shared': 2.8.1 + '@miniflare/core': 2.8.2 + '@miniflare/shared': 2.8.2 cron-schedule: 3.0.6 dev: true - /@miniflare/shared/2.8.1: - resolution: {integrity: sha512-FzTMDdE1CBdfd0gJeRlT0qZHTHjul2tzPyzohRLZqy+FEeCp5ONtvjFfFUQdu8MUJTdEumaU28Dyov3vMTLT/Q==} + /@miniflare/shared/2.8.2: + resolution: {integrity: sha512-cjuLIeTAlqcb1POrK4nLa8Bt79SfzbglUr/w78xRAUUoOdB0Lsm3HnEERzD1o0lO2G/Q9F+VDAp2QyglPFV61A==} engines: {node: '>=16.13'} dependencies: kleur: 4.1.5 picomatch: 2.3.1 dev: true - /@miniflare/sites/2.8.1: - resolution: {integrity: sha512-28OivP5IawW5IeDAGiKpmWx9HjLzEfsU7GItnlPGLz74Lx9K99dYYU7Z2PqGjV9QhXiz5qWSD7sGKc4EdvCcrw==} + /@miniflare/sites/2.8.2: + resolution: {integrity: sha512-zdzg8gm/I4bcUIQ4Yo9WqvTQJN+yOnpPqbQ/nKKd6tebrX4k+sw9wTTGl42MjQ4NN5XfNy3xFERo21i1jLgziA==} engines: {node: '>=16.13'} dependencies: - '@miniflare/kv': 2.8.1 - '@miniflare/shared': 2.8.1 - '@miniflare/storage-file': 2.8.1 + '@miniflare/kv': 2.8.2 + '@miniflare/shared': 2.8.2 + '@miniflare/storage-file': 2.8.2 dev: true - /@miniflare/storage-file/2.8.1: - resolution: {integrity: sha512-39xNWssHvQQKtuAq/gc4aXBQ1koyy2peoYHN5iFIhuOFmnzQpBKJFlEjRIGNBq6yEefqTYzZa4NKwil4Qt3fZw==} + /@miniflare/storage-file/2.8.2: + resolution: {integrity: sha512-M5f+vDVjkghix1sCGQy+apiokTBoOU/V7pBaIsHZTnD/58S6/T2s7glD12Dwfr+u1cCjWxEJx+jaXYIBAKbmQQ==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 - '@miniflare/storage-memory': 2.8.1 + '@miniflare/shared': 2.8.2 + '@miniflare/storage-memory': 2.8.2 dev: true - /@miniflare/storage-memory/2.8.1: - resolution: {integrity: sha512-JHqaLN5B0BAo9KrZd4J+Jsk7gKijN8UZk8QOnlWCE8MHBOnjQKHcKFAU2oR3FZmUsMXj6BTkG4ZbfmWT9WFLWg==} + /@miniflare/storage-memory/2.8.2: + resolution: {integrity: sha512-9OclkkWBbJwo6WJEz2QCbHsvMt+qraq/xIbuFOByytAcyjomp1gm1ZUaKZ5VkkqMXMgdQ1E+6wTq2iA1p+YRcg==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 dev: true - /@miniflare/watcher/2.8.1: - resolution: {integrity: sha512-tQNwNiSqKGtuJXLFiz50cqBbfuF6sro9WhNlphDn48lXM13s/HKJ8thJSL/i0rwpv5zyyJENm4teDe+4dddrfA==} + /@miniflare/watcher/2.8.2: + resolution: {integrity: sha512-2+awQITWkUGb9GlpzVmYwoe+qiSibni7C6gVDnkxorBRoecwUAzjFRF09QjdEn40+q7peNdE0ui1oWjZMgOaHg==} engines: {node: '>=16.13'} dependencies: - '@miniflare/shared': 2.8.1 + '@miniflare/shared': 2.8.2 dev: true - /@miniflare/web-sockets/2.8.1: - resolution: {integrity: sha512-Tdzr1OPjzod+JCCnCgNoyGCc3rFIVgoMF6gVBvv/9Aqdi1+ZXxb7tBf4W8rr85IJtVdTpS6mpBwS07P5vDttxA==} + /@miniflare/web-sockets/2.8.2: + resolution: {integrity: sha512-oW9vG7zImwZZ/OKuAI4CEMtVqYVQqWe9MoO47VoxmB/WMMdaXJArx+k8xcJJJL7tcHVtbwBHsypJf69DOtrCmg==} engines: {node: '>=16.13'} dependencies: - '@miniflare/core': 2.8.1 - '@miniflare/shared': 2.8.1 + '@miniflare/core': 2.8.2 + '@miniflare/shared': 2.8.2 undici: 5.9.1 ws: 8.8.1 transitivePeerDependencies: @@ -5576,7 +5576,7 @@ packages: - utf-8-validate dev: true - /@nanostores/preact/0.1.3_sjll44dhi63q3s6wepldehyzyi: + /@nanostores/preact/0.1.3_wyz6kgcab5rxpkhqcycsg2kmqm: resolution: {integrity: sha512-uiX1ned0LrzASot+sPUjyJzr8Js3pX075omazgsSdLf0zPp4ss8xwTiuNh5FSKigTSQEVqZFiS+W8CnHIrX62A==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} peerDependencies: @@ -5584,7 +5584,7 @@ packages: preact: '>=10.0.0' dependencies: nanostores: 0.5.13 - preact: 10.10.6 + preact: 10.11.0 dev: false /@netlify/edge-handler-types/0.34.1: @@ -5649,7 +5649,7 @@ packages: resolution: {integrity: sha512-/USkK4cioY209wXRpund6HZzHo9GmjakpV9ycOkpMcMxMk7QVcVFVyCMtzvXYiHsB2crgDgrtNYSELYFBXhhaA==} engines: {node: '>= 14'} dependencies: - '@octokit/types': 7.3.0 + '@octokit/types': 7.3.1 dev: true /@octokit/core/3.6.0: @@ -5688,8 +5688,8 @@ packages: resolution: {integrity: sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==} dev: true - /@octokit/openapi-types/13.9.0: - resolution: {integrity: sha512-MOYjRyLIM0zzNb9RfEwVK6HLIc2nIF2OMVtMqiNOGbX0SHrQvQbI6X1K16ktmaHr8WUBv+eeul8cD9mz4rNiWQ==} + /@octokit/openapi-types/13.9.1: + resolution: {integrity: sha512-98zOxAAR8MDHjXI2xGKgn/qkZLwfcNjHka0baniuEpN1fCv3kDJeh5qc0mBwim5y31eaPaYer9QikzwOkQq3wQ==} dev: true /@octokit/plugin-paginate-rest/2.21.3_@octokit+core@3.6.0: @@ -5738,10 +5738,10 @@ packages: '@octokit/openapi-types': 12.11.0 dev: true - /@octokit/types/7.3.0: - resolution: {integrity: sha512-7Ar22AVxsJBYZuPkGQwFQybGt2YjuP6j6Z36bPntIYy3R9qSowB55mXOsb16hc0UqtJkYBrRMVXKlaX1OHsh1g==} + /@octokit/types/7.3.1: + resolution: {integrity: sha512-Vefohn8pHGFYWbSc6du0wXMK/Pmy6h0H4lttBw5WqquEuxjdXwyYX07CeZpJDkzSzpdKxBoWRNuDJGTE+FvtqA==} dependencies: - '@octokit/openapi-types': 13.9.0 + '@octokit/openapi-types': 13.9.1 dev: true /@pkgr/utils/2.3.1: @@ -5908,7 +5908,7 @@ packages: '@react-aria/utils': 3.13.3_react@18.2.0 '@react-stately/collections': 3.4.3_react@18.2.0 '@react-stately/combobox': 3.2.1_react@18.2.0 - '@react-stately/layout': 3.7.0_react@18.2.0 + '@react-stately/layout': 3.7.1_react@18.2.0 '@react-types/button': 3.6.1_react@18.2.0 '@react-types/combobox': 3.5.3_react@18.2.0 '@react-types/shared': 3.14.1_react@18.2.0 @@ -7108,7 +7108,7 @@ packages: '@react-spectrum/text': 3.3.1_d3gwqomfnldt4r5nc27dmvnsce '@react-spectrum/utils': 3.7.3_react@18.2.0 '@react-stately/collections': 3.4.3_react@18.2.0 - '@react-stately/layout': 3.7.0_react@18.2.0 + '@react-stately/layout': 3.7.1_react@18.2.0 '@react-stately/list': 3.5.3_react@18.2.0 '@react-stately/virtualizer': 3.3.0_react@18.2.0 '@react-types/grid': 3.1.3_react@18.2.0 @@ -7146,7 +7146,7 @@ packages: '@react-spectrum/text': 3.3.1_d3gwqomfnldt4r5nc27dmvnsce '@react-spectrum/utils': 3.7.3_react@18.2.0 '@react-stately/collections': 3.4.3_react@18.2.0 - '@react-stately/layout': 3.7.0_react@18.2.0 + '@react-stately/layout': 3.7.1_react@18.2.0 '@react-stately/list': 3.5.3_react@18.2.0 '@react-stately/virtualizer': 3.3.0_react@18.2.0 '@react-types/listbox': 3.3.3_react@18.2.0 @@ -7472,8 +7472,8 @@ packages: - react-dom dev: false - /@react-spectrum/table/3.3.1_vq3pvykbfgerr5rtx4n53bcbxy: - resolution: {integrity: sha512-iJaUIh0iPViqRdVd70e8PkMr7XA2HF8kSqTAlkJeNyvO5h3XtXTLXJhkhKM5mCSeHGENxxScAik/JJkHsjyWug==} + /@react-spectrum/table/3.3.2_vq3pvykbfgerr5rtx4n53bcbxy: + resolution: {integrity: sha512-41vbtsx4Ah/aiHXVa4gDGAOToyjAXgXCG7FPjormaf1J6DVrsK7sZaGdNG4ziNwjgfQUc6nXMmnDpAqgn9NhYg==} peerDependencies: '@react-spectrum/provider': ^3.0.0 react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 @@ -7503,7 +7503,7 @@ packages: '@react-spectrum/utils': 3.7.3_react@18.2.0 '@react-stately/collections': 3.4.3_react@18.2.0 '@react-stately/grid': 3.3.1_react@18.2.0 - '@react-stately/layout': 3.7.0_react@18.2.0 + '@react-stately/layout': 3.7.1_react@18.2.0 '@react-stately/table': 3.4.0_react@18.2.0 '@react-stately/virtualizer': 3.3.0_react@18.2.0 '@react-types/grid': 3.1.3_react@18.2.0 @@ -7840,8 +7840,8 @@ packages: react: 18.2.0 dev: false - /@react-stately/layout/3.7.0_react@18.2.0: - resolution: {integrity: sha512-8jUIpsgcKmpvSTUxpXTi7pvkPg6IR4hNQb5VQaOAuzuQRPAfafl7OmIKFggUeeiUgBie/6O7CWXgy/jcORnq8A==} + /@react-stately/layout/3.7.1_react@18.2.0: + resolution: {integrity: sha512-lJpvRryEwatfKaI3ZoUtWMhEIBFAR/w8v0GeD68+LOixSgr/ROB7nCrsbHt8IYzB/olmPa/PwAolf+Yhiu5UxQ==} peerDependencies: react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 peerDependenciesMeta: @@ -8954,7 +8954,7 @@ packages: /@types/is-ci/3.0.0: resolution: {integrity: sha512-Q0Op0hdWbYd1iahB+IFNQcWXFq4O0Q5MwQP7uN0souuQ4rPg1vEYcnIOfr1gY+M+6rc8FGoRaBO1mOOvL29sEQ==} dependencies: - ci-info: 3.3.2 + ci-info: 3.4.0 dev: true /@types/json-schema/7.0.11: @@ -9076,8 +9076,8 @@ packages: '@types/scheduler': 0.16.2 csstype: 3.1.0 - /@types/react/18.0.18: - resolution: {integrity: sha512-6hI08umYs6NaiHFEEGioXnxJ+oEhY3eRz8VCUaudZmGdtvPviCJB8mgaMxaDWAdPSYd4eFavrPk2QIolwbLYrg==} + /@types/react/18.0.19: + resolution: {integrity: sha512-BDc3Q+4Q3zsn7k9xZrKfjWyJsSlEDMs38gD1qp2eDazLCdcPqAT+vq1ND+Z8AGel/UiwzNUk8ptpywgNQcJ1MQ==} dependencies: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.2 @@ -9161,7 +9161,7 @@ packages: /@types/yargs-parser/21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} - /@typescript-eslint/eslint-plugin/5.36.2_kou65mzxaniwtkb2mhvaghdcyi: + /@typescript-eslint/eslint-plugin/5.36.2_ymvve5pmriizw6sqldrdyt3llu: resolution: {integrity: sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -9172,12 +9172,12 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.36.2_sorwav4hsh5vncerguqybud76i + '@typescript-eslint/parser': 5.36.2_4brgkhw6cq4me3drk3kxrpb2mm '@typescript-eslint/scope-manager': 5.36.2 - '@typescript-eslint/type-utils': 5.36.2_sorwav4hsh5vncerguqybud76i - '@typescript-eslint/utils': 5.36.2_sorwav4hsh5vncerguqybud76i + '@typescript-eslint/type-utils': 5.36.2_4brgkhw6cq4me3drk3kxrpb2mm + '@typescript-eslint/utils': 5.36.2_4brgkhw6cq4me3drk3kxrpb2mm debug: 4.3.4 - eslint: 8.23.0 + eslint: 8.23.1 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 @@ -9188,7 +9188,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.36.2_sorwav4hsh5vncerguqybud76i: + /@typescript-eslint/parser/5.36.2_4brgkhw6cq4me3drk3kxrpb2mm: resolution: {integrity: sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -9202,7 +9202,7 @@ packages: '@typescript-eslint/types': 5.36.2 '@typescript-eslint/typescript-estree': 5.36.2_typescript@4.7.4 debug: 4.3.4 - eslint: 8.23.0 + eslint: 8.23.1 typescript: 4.7.4 transitivePeerDependencies: - supports-color @@ -9216,7 +9216,7 @@ packages: '@typescript-eslint/visitor-keys': 5.36.2 dev: true - /@typescript-eslint/type-utils/5.36.2_sorwav4hsh5vncerguqybud76i: + /@typescript-eslint/type-utils/5.36.2_4brgkhw6cq4me3drk3kxrpb2mm: resolution: {integrity: sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -9227,9 +9227,9 @@ packages: optional: true dependencies: '@typescript-eslint/typescript-estree': 5.36.2_typescript@4.7.4 - '@typescript-eslint/utils': 5.36.2_sorwav4hsh5vncerguqybud76i + '@typescript-eslint/utils': 5.36.2_4brgkhw6cq4me3drk3kxrpb2mm debug: 4.3.4 - eslint: 8.23.0 + eslint: 8.23.1 tsutils: 3.21.0_typescript@4.7.4 typescript: 4.7.4 transitivePeerDependencies: @@ -9262,7 +9262,7 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.36.2_sorwav4hsh5vncerguqybud76i: + /@typescript-eslint/utils/5.36.2_4brgkhw6cq4me3drk3kxrpb2mm: resolution: {integrity: sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -9272,9 +9272,9 @@ packages: '@typescript-eslint/scope-manager': 5.36.2 '@typescript-eslint/types': 5.36.2 '@typescript-eslint/typescript-estree': 5.36.2_typescript@4.7.4 - eslint: 8.23.0 + eslint: 8.23.1 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.23.0 + eslint-utils: 3.0.0_eslint@8.23.1 transitivePeerDependencies: - supports-color - typescript @@ -9705,8 +9705,8 @@ packages: dependencies: color-convert: 2.0.1 - /ansi-styles/6.1.0: - resolution: {integrity: sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==} + /ansi-styles/6.1.1: + resolution: {integrity: sha512-qDOv24WjnYuL+wbwHdlsYZFy+cgPtrYw0Tn7GLORicQp9BkQLzrgI3Pm4VyR9ERZ41YTn7KlMPuL1n05WdZvmg==} engines: {node: '>=12'} dev: false @@ -9827,15 +9827,15 @@ packages: engines: {node: '>= 4.0.0'} dev: false - /autoprefixer/10.4.8_postcss@8.4.16: - resolution: {integrity: sha512-75Jr6Q/XpTqEf6D2ltS5uMewJIx5irCU1oBYJrWjFenq/m12WRRrz6g15L1EIoYvPLXTbEry7rDOwrcYNj77xw==} + /autoprefixer/10.4.9_postcss@8.4.16: + resolution: {integrity: sha512-Uu67eduPEmOeA0vyJby5ghu1AAELCCNSsLAjK+lz6kYzNM5sqnBO36MqfsjhPjQF/BaJM5U/UuFYyl7PavY/wQ==} engines: {node: ^10 || ^12 || >=14} hasBin: true peerDependencies: postcss: ^8.1.0 dependencies: browserslist: 4.21.3 - caniuse-lite: 1.0.30001393 + caniuse-lite: 1.0.30001397 fraction.js: 4.2.0 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -10033,8 +10033,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001393 - electron-to-chromium: 1.4.246 + caniuse-lite: 1.0.30001397 + electron-to-chromium: 1.4.247 node-releases: 2.0.6 update-browserslist-db: 1.0.7_browserslist@4.21.3 @@ -10114,8 +10114,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - /caniuse-lite/1.0.30001393: - resolution: {integrity: sha512-N/od11RX+Gsk+1qY/jbPa0R6zJupEa0lxeBG598EbrtblxVCTJsQwbRBm6+V+rxpc5lHKdsXb9RY83cZIPLseA==} + /caniuse-lite/1.0.30001397: + resolution: {integrity: sha512-SW9N2TbCdLf0eiNDRrrQXx2sOkaakNZbCjgNpPyMJJbiOrU5QzMIrXOVMRM1myBXTD5iTkdrtU/EguCrBocHlA==} /canvas-confetti/1.5.1: resolution: {integrity: sha512-Ncz+oZJP6OvY7ti4E1slxVlyAV/3g7H7oQtcCDXgwGgARxPnwYY9PW5Oe+I8uvspYNtuHviAdgA0LfcKFWJfpg==} @@ -10236,8 +10236,8 @@ packages: engines: {node: '>=10'} dev: false - /ci-info/3.3.2: - resolution: {integrity: sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg==} + /ci-info/3.4.0: + resolution: {integrity: sha512-t5QdPT5jq3o262DOQ8zA6E1tlH2upmUc4Hlvrbx1pGYJuiiHl7O7rvVNI+l8HTVhd/q3Qc9vqimkNk5yiXsAug==} /clean-stack/2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} @@ -10851,8 +10851,8 @@ packages: jake: 10.8.5 dev: false - /electron-to-chromium/1.4.246: - resolution: {integrity: sha512-/wFCHUE+Hocqr/LlVGsuKLIw4P2lBWwFIDcNMDpJGzyIysQV4aycpoOitAs32FT94EHKnNqDR/CVZJFbXEufJA==} + /electron-to-chromium/1.4.247: + resolution: {integrity: sha512-FLs6R4FQE+1JHM0hh3sfdxnYjKvJpHZyhQDjc2qFq/xFvmmRt/TATNToZhrcGUFzpF2XjeiuozrA8lI0PZmYYw==} /emmet/2.3.6: resolution: {integrity: sha512-pLS4PBPDdxuUAmw7Me7+TcHbykTsBKN/S9XJbUOMFQrNv9MoshzyMFK/R57JBm94/6HSL4vHnDeEmxlC82NQ4A==} @@ -10910,7 +10910,7 @@ packages: has-property-descriptors: 1.0.0 has-symbols: 1.0.3 internal-slot: 1.0.3 - is-callable: 1.2.4 + is-callable: 1.2.5 is-negative-zero: 2.0.2 is-regex: 1.1.4 is-shared-array-buffer: 1.0.2 @@ -10938,7 +10938,7 @@ packages: resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} engines: {node: '>= 0.4'} dependencies: - is-callable: 1.2.4 + is-callable: 1.2.5 is-date-object: 1.0.5 is-symbol: 1.0.4 @@ -11582,13 +11582,13 @@ packages: source-map: 0.6.1 dev: true - /eslint-config-prettier/8.5.0_eslint@8.23.0: + /eslint-config-prettier/8.5.0_eslint@8.23.1: resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.23.0 + eslint: 8.23.1 dev: true /eslint-plugin-no-only-tests/2.6.0: @@ -11596,7 +11596,7 @@ packages: engines: {node: '>=4.0.0'} dev: true - /eslint-plugin-prettier/4.2.1_tgumt6uwl2md3n6uqnggd6wvce: + /eslint-plugin-prettier/4.2.1_cabrci5exjdaojcvd6xoxgeowu: resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -11607,8 +11607,8 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.23.0 - eslint-config-prettier: 8.5.0_eslint@8.23.0 + eslint: 8.23.1 + eslint-config-prettier: 8.5.0_eslint@8.23.1 prettier: 2.7.1 prettier-linter-helpers: 1.0.0 dev: true @@ -11629,13 +11629,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.23.0: + /eslint-utils/3.0.0_eslint@8.23.1: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.23.0 + eslint: 8.23.1 eslint-visitor-keys: 2.1.0 dev: true @@ -11649,12 +11649,12 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.23.0: - resolution: {integrity: sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==} + /eslint/8.23.1: + resolution: {integrity: sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.3.1 + '@eslint/eslintrc': 1.3.2 '@humanwhocodes/config-array': 0.10.4 '@humanwhocodes/gitignore-to-minimatch': 1.0.2 '@humanwhocodes/module-importer': 1.0.1 @@ -11665,7 +11665,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.23.0 + eslint-utils: 3.0.0_eslint@8.23.1 eslint-visitor-keys: 3.3.0 espree: 9.4.0 esquery: 1.4.0 @@ -11673,7 +11673,6 @@ packages: fast-deep-equal: 3.1.3 file-entry-cache: 6.0.1 find-up: 5.0.0 - functional-red-black-tree: 1.0.1 glob-parent: 6.0.2 globals: 13.17.0 globby: 11.1.0 @@ -11682,6 +11681,7 @@ packages: import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 + js-sdsl: 4.1.4 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -12735,15 +12735,15 @@ packages: builtin-modules: 3.3.0 dev: true - /is-callable/1.2.4: - resolution: {integrity: sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==} + /is-callable/1.2.5: + resolution: {integrity: sha512-ZIWRujF6MvYGkEuHMYtFRkL2wAtFw89EHfKlXrkPkjQZZRWeh9L1q3SV13NIfHnqxugjLvAOkEHx9mb1zcMnEw==} engines: {node: '>= 0.4'} /is-ci/3.0.1: resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} hasBin: true dependencies: - ci-info: 3.3.2 + ci-info: 3.4.0 dev: true /is-core-module/2.10.0: @@ -12974,6 +12974,10 @@ packages: hasBin: true dev: false + /js-sdsl/4.1.4: + resolution: {integrity: sha512-Y2/yD55y5jteOAmY50JbUZYwk3CP3wnLPEZnlR1w9oKhITrBEtAxwuWKebFf8hMrPMgbYwFoWK/lH2sBkErELw==} + dev: true + /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -13072,8 +13076,8 @@ packages: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} - /kolorist/1.5.1: - resolution: {integrity: sha512-lxpCM3HTvquGxKGzHeknB/sUjuVoUElLlfYnXZT73K8geR9jQbroGlSCFBax9/0mpGoD3kzcMLnOlGQPJJNyqQ==} + /kolorist/1.6.0: + resolution: {integrity: sha512-dLkz37Ab97HWMx9KTes3Tbi3D1ln9fCAy2zr2YVExJasDRPGRaKcoE4fycWNtnCAJfjFqe0cnY+f8KT2JePEXQ==} dev: false /leven/3.1.0: @@ -13929,12 +13933,12 @@ packages: resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} engines: {node: '>=4'} - /miniflare/2.8.1: - resolution: {integrity: sha512-Icp9SMl/GwrdcQYSVU0HZ8insZeEG0K3QUXP+a1FKQ6UvoRcP5gw3c0OTcZaoZErOnE6YFh7xO7cuE1KSOWRFA==} + /miniflare/2.8.2: + resolution: {integrity: sha512-t9/QeSSsUFuqafLVAPlmWmoG+egfJ99xtoOWw1C9Wt6nlXz9ox3y1TfAw06YUPp4xVHcQnHQcir7aL4QvRPgfw==} engines: {node: '>=16.13'} hasBin: true peerDependencies: - '@miniflare/storage-redis': 2.8.1 + '@miniflare/storage-redis': 2.8.2 cron-schedule: ^3.0.4 ioredis: ^4.27.9 peerDependenciesMeta: @@ -13945,22 +13949,22 @@ packages: ioredis: optional: true dependencies: - '@miniflare/cache': 2.8.1 - '@miniflare/cli-parser': 2.8.1 - '@miniflare/core': 2.8.1 - '@miniflare/durable-objects': 2.8.1 - '@miniflare/html-rewriter': 2.8.1 - '@miniflare/http-server': 2.8.1 - '@miniflare/kv': 2.8.1 - '@miniflare/queues': 2.8.1 - '@miniflare/r2': 2.8.1 - '@miniflare/runner-vm': 2.8.1 - '@miniflare/scheduler': 2.8.1 - '@miniflare/shared': 2.8.1 - '@miniflare/sites': 2.8.1 - '@miniflare/storage-file': 2.8.1 - '@miniflare/storage-memory': 2.8.1 - '@miniflare/web-sockets': 2.8.1 + '@miniflare/cache': 2.8.2 + '@miniflare/cli-parser': 2.8.2 + '@miniflare/core': 2.8.2 + '@miniflare/durable-objects': 2.8.2 + '@miniflare/html-rewriter': 2.8.2 + '@miniflare/http-server': 2.8.2 + '@miniflare/kv': 2.8.2 + '@miniflare/queues': 2.8.2 + '@miniflare/r2': 2.8.2 + '@miniflare/runner-vm': 2.8.2 + '@miniflare/scheduler': 2.8.2 + '@miniflare/shared': 2.8.2 + '@miniflare/sites': 2.8.2 + '@miniflare/storage-file': 2.8.2 + '@miniflare/storage-memory': 2.8.2 + '@miniflare/web-sockets': 2.8.2 kleur: 4.1.5 semiver: 1.1.0 source-map-support: 0.5.21 @@ -15027,7 +15031,7 @@ packages: '@csstools/postcss-text-decoration-shorthand': 1.0.0_postcss@8.4.16 '@csstools/postcss-trigonometric-functions': 1.0.2_postcss@8.4.16 '@csstools/postcss-unset-value': 1.0.2_postcss@8.4.16 - autoprefixer: 10.4.8_postcss@8.4.16 + autoprefixer: 10.4.9_postcss@8.4.16 browserslist: 4.21.3 css-blank-pseudo: 3.0.3_postcss@8.4.16 css-has-pseudo: 3.0.4_postcss@8.4.16 @@ -15111,17 +15115,17 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 - /preact-render-to-string/5.2.3_preact@10.10.6: - resolution: {integrity: sha512-aPDxUn5o3GhWdtJtW0svRC2SS/l8D9MAgo2+AWml+BhDImb27ALf04Q2d+AHqUUOc6RdSXFIBVa2gxzgMKgtZA==} + /preact-render-to-string/5.2.4_preact@10.11.0: + resolution: {integrity: sha512-iIPHb3BXUQ3Za6KNhkjN/waq11Oh+QWWtAgN3id3LrL+cszH3DYh8TxJPNQ6Aogsbu4JsqdJLBZltwPFpG6N6w==} peerDependencies: preact: '>=10' dependencies: - preact: 10.10.6 + preact: 10.11.0 pretty-format: 3.8.0 dev: false - /preact/10.10.6: - resolution: {integrity: sha512-w0mCL5vICUAZrh1DuHEdOWBjxdO62lvcO++jbzr8UhhYcTbFkpegLH9XX+7MadjTl/y0feoqwQ/zAnzkc/EGog==} + /preact/10.11.0: + resolution: {integrity: sha512-Fk6+vB2kb6mSJfDgODq0YDhMfl0HNtK5+Uc9QqECO4nlyPAQwCI+BKyWO//idA7ikV7o+0Fm6LQmNuQi1wXI1w==} /preact/10.6.6: resolution: {integrity: sha512-dgxpTFV2vs4vizwKohYKkk7g7rmp1wOOcfd4Tz3IB3Wi+ivZzsn/SpeKJhRENSE+n8sUfsAl4S3HiCVT923ABw==} @@ -17576,7 +17580,7 @@ packages: /wide-align/1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} dependencies: - string-width: 4.2.3 + string-width: 1.0.2 dev: false /widest-line/4.0.1: @@ -17752,7 +17756,7 @@ packages: blake3-wasm: 2.1.5 chokidar: 3.5.3 esbuild: 0.14.51 - miniflare: 2.8.1 + miniflare: 2.8.2 nanoid: 3.3.4 path-to-regexp: 6.2.1 selfsigned: 2.1.1 @@ -17789,7 +17793,7 @@ packages: resolution: {integrity: sha512-QFF+ufAqhoYHvoHdajT/Po7KoXVBPXS2bgjIam5isfWJPfIOnQZ50JtUiVvCv/sjgacf3yRrt2ZKUZ/V4itN4g==} engines: {node: '>=12'} dependencies: - ansi-styles: 6.1.0 + ansi-styles: 6.1.1 string-width: 5.1.2 strip-ansi: 7.0.1 dev: false @@ -17941,8 +17945,8 @@ packages: stack-trace: 0.0.10 dev: true - /zod/3.19.0: - resolution: {integrity: sha512-Yw0qvUsCNGBe5YacikdMt5gVYeUuaEFVDIHKMfElrGSaBhwR3CQK6vOzgfAJOjTdGIhEeoaj8GtT+NDZrepZbw==} + /zod/3.19.1: + resolution: {integrity: sha512-LYjZsEDhCdYET9ikFu6dVPGp2YH9DegXjdJToSzD9rO6fy4qiRYFoyEYwps88OseJlPyl2NOe2iJuhEhL7IpEA==} dev: false /zwitch/2.0.2: