Commit graph

114 commits

Author SHA1 Message Date
tony-sull
849fefd8b0 [ci] format 2022-09-29 21:22:49 +00:00
Tony Sullivan
9892989619
[@astrojs/image] adding caching support for SSG builds (#4909)
* adds a caching feature for SSG builds

* chore: add changeset

* nit: eslint fix

* chore: add readme docs for caching

* adding basic test coverage for cached images
2022-09-29 21:20:48 +00:00
Fred K. Bot
d08093f7d4
[ci] release (#4903)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-29 11:20:00 -04:00
matthewp
55a1b5bb58 [ci] format 2022-09-28 20:57:35 +00:00
Tony Sullivan
ec55745ae5
Fix: let Squoosh default image quality internally (#4906)
* removes our quality defaults, allowing Squoosh format-specific defaults to be used

* chore: add changeset
2022-09-28 20:55:09 +00:00
Bjorn Lu
812658ad2a
Remove shamefully-hoist (#4842) 2022-09-28 23:13:33 +08:00
Fred K. Bot
077134ae2c
[ci] release (#4846)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-27 12:12:44 -04:00
Jake Strawn
b0f6216367
docs: Update references to support channel in Discord. (#4872) 2022-09-26 21:02:05 +08:00
Gerard de Brieder
944d24e9ee
Update Picture.astro so it no longer passes height and width attributes (#4797)
* Update Picture.astro

the image variable of getPicture contains a width and height property, which we usually require. In this case, the image is wrapped in a picture tag and the img tag itself should not have a width and height property as this will break the responsiveness of the image provided by the picture tag.

* added changeset

* fixing SSG picture tests that were expecting img dimensions

Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
2022-09-22 21:01:38 +00:00
tony-sull
426f3bb40f [ci] format 2022-09-22 19:50:47 +00:00
Tony Sullivan
fad3867adb
Adding an optional image service based on Squoosh (#4738)
* WIP: adding a service built on @squoosh/lib

* WIP: investigating memory leaks in Squoosh

* WIP: vendoring Squoosh to work with our build

* chore: a bit of cleanup and a small perf gain

* removing a few unused deps

* fix: removing temp .only() in sharp test

* hooking up the last build steps to copy over .wasm files

* removing the duplicated lib/*.wasm files

* defaulting to Sharp for the initial @next release

* make sure pnpm always runs the postbuild script

* removing a few node dependencies

* refactor: move the copy .wasm build step out of the SSR bundle

* linter fixes

* fixing lock file

* chore: add TEMP changeset

* fix built wasm location for SSG builds

* Revert "defaulting to Sharp for the initial @next release"

This reverts commit 1a8d4f7f60.

* removing sharp dependency

* Revert "fix built wasm location for SSG builds"

This reverts commit 446b80bb53.

* chore: update lockfile

* fixing up image tests for the wasm loader

* updating the README for squoosh

* parallel wasm builds

* refactor: a bit of house keeping

* perf: allow a thread for each output encoding format

* fix: dev broke with the shift to wasm workers

* adds a new `astro:build:generated` hook for SSG builds

* fix: typo + calling cleanup methods in wasm codecs

* adding @astrojs/webapi for the TransformStream polyfill

* Revert "adding @astrojs/webapi for the TransformStream polyfill"

This reverts commit 39e5b845a5.

* perf: using sharp for most of the CI tests

* chore: update lockfile

* removing hard-coded squoosh imports

* fix: adding sharp to rollup externals

* test: using dev for the squoosh tests

* fix: updating the build output dir for wasm filles in SSG builds

* updating the changeset with migration details

* Revert "adds a new `astro:build:generated` hook for SSG builds"

This reverts commit 59b5fec7be.

* nit: adding comments for the wasm file copy

* chore: fix eslint warning
2022-09-22 19:48:14 +00:00
Fred K. Bot
5684a016bb
[ci] release (#4823)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-20 16:55:48 -04:00
tony-sull
b2c9059ed8 [ci] format 2022-09-20 20:28:39 +00:00
Oussama Bennaci
ea37de86e4
[@astrojs/image] flatten background only if alpha channel isn't supported (#4800)
* Use sharp flatten only when format doesnt support alpha

* Allow rgba for background prop

* Add changeset

* Adjust doc

* Fix tests
2022-09-20 20:25:45 +00:00
Fred K. Bot
100b8d0583
[ci] release (#4702)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-09 17:18:03 -04:00
tony-sull
f226b677b8 [ci] format 2022-09-09 20:16:27 +00:00
Oussama Bennaci
1e5d8ba9af
[@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 <tony.f.sullivan@outlook.com>
2022-09-09 20:13:59 +00:00
Ben Holmes
c706d845eb
No 👏 more 👏 server 👏 restarts 👏 on 👏 config 👏 changes (#4578)
* 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 <nate@astro.build>
2022-09-09 11:58:16 -04:00
Fred K. Bot
b6dd8b595c
[ci] release (#4680)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-09 10:56:48 -04:00
Tony Sullivan
4c05c65a3d
[@astrojs/image] Build all optimized images to dist/assets (#4678)
* fix: build all optimized images to dist/assets

* chore: add changeset
2022-09-08 18:41:17 +00:00
Fred K. Bot
f165353e7a
[ci] release (#4657)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-07 21:29:44 +00:00
tony-sull
b5a91d40b7 [ci] format 2022-09-07 17:26:36 +00:00
Valentin Bersier
e4348a4eb4
@astrojs/image: add a background option/prop to replace the alpha layer (#4642)
* Added `background` option and prop.
This optional color specifies which background to use when removing the
alpha channel if the output format doesn't support transparency.

* Modified existing tests

* Fixed wrong dimensions in tests

* Fixing a few instances of jpeg vs jpg

* Added color checking

* working on the tests

* tests are now passing

* Adding tests

* Added tests for background color

* no need to test with subpath

* Added fixture

* Renamed test fixture for background-color

* skipping test until fixed

* Typo

* Working on tests

* tests are passing

* Updated readme and added changeset

* Updated lockfile

* Updated lockfile

* Updated lockfile

Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
2022-09-07 17:22:11 +00:00
tony-sull
c080438b89 [ci] format 2022-09-07 13:57:52 +00:00
Tony Sullivan
db70afdcd5
[@astrojs/image] Fixes a regression in remote image filenames (#4649)
* fixes a bug in filename creation for remote images without a file extension

* chore: add changeset
2022-09-07 13:56:07 +00:00
Tibor Schiemann
d693e365ca
Integrations: Fix NPM instructions to use npx astro add again (#4653)
* Fix install instructions to use `npx astro` again

* Replace joyful hiccups with regular issues :)
2022-09-07 12:08:58 +02:00
Fred K. Bot
481e0d1d8a
[ci] release (#4620)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-06 15:40:15 -04:00
tony-sull
29f044267f [ci] format 2022-09-06 14:32:19 +00:00
Alan
494c2b8353
Parallelize @astrojs/image transforms (#4626) 2022-09-06 14:29:20 +00:00
Fred K. Bot
592de3d703
[ci] release (#4589)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-02 16:13:04 -04:00
Chris Swithinbank
eb4eebde9e
Fix image integration README (#4599)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-09-02 17:05:04 +02:00
tony-sull
c62257f0b0 [ci] format 2022-09-01 21:26:15 +00:00
Jan Müller
72c760e9b8
feat(image): throw if alt text is missing (#4511)
* feat(image): throw if no `alt` is provided

* chore: add changeset

* docs(image): update README

* updated alt text stuff throughout

* fixing with-mdx test suite

* warn for missing alt text, will throw an error in a future release

* final README tweaks

Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-09-01 21:24:07 +00:00
tony-sull
df402ddc93 [ci] format 2022-09-01 20:34:20 +00:00
Tony Sullivan
56f83be92a
Fix: [@astrojs/image] handle filenames with spaces (#4593)
* fix: decode file URLs to handle filenames with spaces

* chore: add changeset
2022-09-01 20:31:53 +00:00
tony-sull
ef0ed38339 [ci] format 2022-09-01 15:01:07 +00:00
Tony Sullivan
aeae89d6ae
refactor: Cleaning up all uses of hard-coded hashes in image tests (#4579) 2022-09-01 14:58:57 +00:00
Fred K. Bot
005d53145f
[ci] release (#4555)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-31 18:03:27 -04:00
tony-sull
6f1fbd8be0 [ci] format 2022-08-30 21:12:45 +00:00
Tony Sullivan
00c605ce35
Image integration refactor and cleanup (#4482)
* WIP: simplifying the use of `fs` vs. the vite plugin

* removing a few node deps (etag and node:path)

* adding ts defs for sharp

* using the same mime package as astro's core App

* fixing file URL support in windows

* using file URLs when loading local image metadata

* fixing a bug in the etag helper

* Windows compat

* splitting out dev & build tests

* why do these suites fail in parallel?

* one last windows compat case

* Adding tests for treating /public images the same as remote URLs

* a couple fixes for Astro's `base` config

* adding base path tests for SSR

* fixing a bad merge, lost the kleur dependency

* adding a test suite for images + MDX

* chore: add changeset

* simplifying the with-mdx tests

* bugfix: don't duplicate the period when using existing file extensions

* let Vite cache the image loader service

* adding some docs for using /public images

* fixing changeset

* Update packages/integrations/image/README.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/integrations/image/README.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* nit: minor README syntax tweaks

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-08-30 21:09:44 +00:00
Fred K. Bot
e905784bf1
[ci] release (#4520)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-30 12:45:04 -04:00
Erika
b8a80bc42d
Fix image integration's types not referring to the base types for Vite client types (#4534) 2022-08-29 12:06:41 -03:00
Tim Rinkel
9389517f63
Update README.md (#4517) 2022-08-29 16:42:27 +08:00
Tc001
ca24a60b13
Earlier import snippet for @astrojs/image (#4484)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-08-25 19:39:22 -03:00
Fred K. Bot
c8d0fa4c4e
[ci] release (#4425)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-22 16:53:44 -04:00
matthewp
a20e811795 [ci] format 2022-08-22 19:49:45 +00:00
Fred K. Bot
457e559cd5
[ci] release (#4363)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-22 15:46:46 -04:00
Tony Sullivan
579e2daf8d
[@astrojs/image] Handle query params in remote image URLs during SSG builds (#4338)
* fix: SSG builds should remove query params when building local image files

* chore: add changeset

* handling an edge case related to stripping extensions from a filename
2022-08-22 19:45:34 +00:00
tony-sull
2c40fba0c8 [ci] format 2022-08-22 19:15:35 +00:00
Tony Sullivan
c4af8723bd
[@astrojs/image] adds a logger to the the image integration (#4342)
* WIP: adding a console logger that respect vite.logLevel

* adds an optional prefix for messages

* remove temporary debug log

* typo fix

* cleaning up log syntax

* fixing logger whitespace

* adding README docs

* test: disable integration logging in tests

* chore: add changeset
2022-08-22 19:13:19 +00:00