Commit graph

48 commits

Author SHA1 Message Date
tony-sull
88dad63322 [ci] format 2022-07-01 20:06:01 +00:00
Tony Sullivan
e8593e7ead
Adds an @astrojs/image integration for optimizing images (#3694)
* initial commit

* WIP: starting to define interfaces for images and transformers

* WIP: basic sharp service to test out the API setup

* adding a few tests for sharp.toImageSrc

* Adding tests for sharp.parseImageSrc

* hooking up basic SSR support

* updating image services to return width/height

* simplifying config setup for v1

* hooking up basic SSR + SSG support (dev & build)

* refactor: a bit of code cleanup and commenting

* WIP: migrating local files to ESM + vite plugin

* WIP: starting to hook up user-provided loaderEntryPoints

* chore: update lock file

* chore: update merged lockfile

* refactor: code cleanup and type docs

* pulling over the README template for first-party integrations

* moving metadata out to the loader

* updating the test for the refactored import

* revert: remove unrelated webapi formatting

* revert: remove unrelated change

* fixing up the existing sharp tests

* fix: vite plugin wasn't dynamically loading the image service properly

* refactor: minor API renaming, removing last hard-coded use of sharp loader

* don't manipulate src for hosted image services

* Adding support for automatically calculating dimensions by aspect ratio, if needed

* a few bug fixes + renaming the aspect ratio search param to "ar"

* Adding ETag support, removing need for loaders to parse file metadata

* using the battle tested `etag` package

* Adding support for dynamically calculating partial sizes

* refactor: moving to the packages/integrations dir, Astro Labs TBD later

* refactor: renaming parse/serialize functions

* Adding tests for SSG image optimizations

* refactor: clean up outdated names related to ImageProps

* nit: reusing cached SSG filename

* chore: update pnpm lock file

* handling file URLs when resolving local image imports

* updating image file resolution to use file URLs

* increasing test timeout for image build tests

* fixing eslint error in sharp test

* adding slash for windows compat in src URLs

* chore: update lockfile after merge

* Adding README content

* adding a readme call to action for configuration options

* review: A few of the quick updates from the PR review

* hack: adds a one-off check to allow query params for the _image route

* Adds support for src={import("...")}, and named component exports

* adding SSR tests

* nit: adding a bit more comments

* limiting the query params in SSG dev to the images integration
2022-07-01 15:47:48 +00:00
Nate Moore
032ad1c047
MDX support (#3706)
* feat: first pass at MDX support

* fix: move built-in JSX renderer to come first

* chore: remove jsx example

* chore: update lockfile

* chore: cleanup example

* fix: missing deps

* refactor: move component render logic to `renderPage`

* chore: update HMR script

* chore: update MDX example

* refactor: prefer unshit

* refactor: remove TODO comment

* fix: remove duplicate identifier

* refactor: cleanup mdx entrypoint

* fix: better html handling

* fix: add tsconfig to mdx package

* chore: update lockfile

* fix: do not sort plugins unless mdx is enabled

* chore: update compiler

* fix(hmr): maybe render head for non-Astro pages

* fix: set initial pageExtensions

* refactor: cleanup addPageExtension

* refactor: remove addPageExtensions from types

* refactor: expose HookParameters type

* fix: only default to astro for MDX

* test: pick up jsx support in test fixtures

* refactor: simplify mdx entrypoint

* test: add basic MDX tests

* test(e2e): add mdx + framework tests

* chore: update lockfile

* test(e2e): fix preact mdx e2e test

* fix(mdx): disable .md support

* test(e2e): fix vue-component test missing mdx

* test(e2e): fix solid component needing import

* fix: allow `client:only="solid"` as an alias to `solid-js`

* chore: move to with-mdx example

* chore: update MDX readme

* chore: update example readme

* chore: bump astro version

* chore: update lockfile

* Update mod.d.ts

* feat: support `export const components` in MDX pages

* chore: update mdx example

* fix: update jsx-runtime with better slot support

* refactor: remove object style support

* chore: cleanup package exports

* chore: add todo comment

* refactor: improve isPage function, move to utils

* refactor: dry up manual HMR updates

* chore: add dev tests for MDX

* chore: prefer set to array

* chore: add changesets

* fix(hmr): flip public/private route

Co-authored-by: Nate Moore <nate@astro.build>
2022-06-30 13:09:09 -05:00
FredKSchott
a99a54d344 [ci] format 2022-06-29 21:56:28 +00:00
Fred K. Schott
dd176ca58d
add error event to telemetry (#3750) 2022-06-29 14:54:33 -07:00
Fred K. Bot
768c8ed21d
[ci] update lockfile (#3740)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-06-28 08:33:13 -05:00
FredKSchott
701799c6d6 [ci] format 2022-06-27 21:17:40 +00:00
Fred K. Schott
4d6d8644e6
SImplify "astro add" by removing confusing multi-select (#3715)
* wip

* update create-astro for new astro add

* update copy

* update git prompt

* Update packages/astro/src/core/logger/node.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/create-astro/test/install-step.test.js

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* update git prompt

* update test

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2022-06-27 14:15:51 -07:00
matthewp
3dc22a2443 [ci] format 2022-06-23 19:39:58 +00:00
Matthew Phillips
fa7ed3f3a9
Remove post-rendering head injection (#3679)
* Remove post-rendering head injection

* Adds a changeset

* Use a layout component for vue
2022-06-23 15:37:55 -04:00
natemoo-re
059d00bd5d [ci] format 2022-06-23 15:12:46 +00:00
Nate Moore
7373d61cdc
Enable named slots in renderers (#3652)
* feat: pass all slots to renderers

* refactor: pass `slots` as top-level props

* test: add named slot test for frameworks

* fix: nested hydration, slots that are not initially rendered

* test: add nested-recursive e2e test

* fix: render unmatched custom element children

* chore: update lockfile

* fix: unrendered slots for client:only

* fix(lit): ensure lit integration uses new slots API

* chore: add changeset

* chore: add changesets

* fix: lit slots

* feat: convert dash-case or snake_case slots to camelCase for JSX

* feat: remove tmpl special logic

* test: add slot components-in-markdown test

* refactor: prefer Object.entries.map() to for/of loop

Co-authored-by: Nate Moore <nate@astro.build>
2022-06-23 10:10:54 -05:00
matthewp
60653c7340 [ci] format 2022-06-14 18:10:04 +00:00
Okiki Ojo
d46f8fb14d
feat: support optional and conditional integrations (#3590)
* feat(integrations): support optional integrations

By making integration optional, Astro can now ignore null or undefined Integrations instead of giving an internal error most devs can't read/won't understand.

This also enables optional integrations,
e.g.
```ts
integration: [
  // Only run `compress` integration in production environments, etc...
  import.meta.env.production ? compress() : null
]
```

* ci: add tests for optional integration

* docs: add changelog
2022-06-14 14:08:14 -04:00
natemoo-re
4eb39d57b9 [ci] format 2022-06-10 03:33:13 +00:00
Nate Moore
7f5e71982d
chore: update types (#3558) 2022-06-09 22:31:48 -05:00
FredKSchott
f0f6a3332f [ci] format 2022-06-06 16:49:53 +00:00
Fred K. Schott
88cd7525be
[ci] update lockfile (#3501)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-06-02 15:30:46 -04:00
Fred K. Schott
cfb85ee10e
[ci] update lockfile (#3495)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-06-01 10:39:32 -05:00
Fred K. Schott
c9d8b10a85
[ci] update lockfile (#3448)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-05-31 11:46:13 -05:00
Fred K. Schott
ffe5cf0312
update typescript (#3456) 2022-05-27 14:53:04 -05:00
github-actions[bot]
8eec97fdd1
[ci] release (#3409)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-05-23 13:26:07 -04:00
bholmesdev
62e0efa043 [ci] format 2022-05-20 21:27:42 +00:00
Ben Holmes
4de53eccef
Fix: support FormData object on fetch body (#3417)
* refactor: make node-fetch external in rollup build

* deps: make node-fetch standard dep

* refactor: switch to node-fetch pkg ref in fetch.ts

* chore: changeset

* chore: bump webapi to minor change
2022-05-20 17:26:41 -04:00
Fred K. Schott
195f3f7eb7
[ci] update lockfile (#3414)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-05-20 12:02:10 -05:00
Fred K. Schott
a7480452b1
[ci] update lockfile (#3404)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-05-19 10:22:27 -05:00
Fred K. Schott
9dd16bace5
[ci] update lockfile (#3363)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-05-16 13:33:16 -05:00
Fred K. Schott
7cd4b1bc12
[ci] update lockfile (#3287)
* [ci] update lockfile

* chore: fix lockfile

* fix: pin turbo

Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
Co-authored-by: Nate Moore <nate@skypack.dev>
2022-05-12 11:42:34 -05:00
Matthew Phillips
3854acdb7d Add typescript to match peerDep 2022-05-03 15:42:19 -04:00
Fred K. Schott
bd76716c88
[ci] update lockfile (#3162)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-04-22 10:04:01 -04:00
Nate Moore
f73d33cb18
chore(webapi): fix types (#3167) 2022-04-21 14:54:26 -04:00
Fred K. Schott
00b8343844
[ci] update lockfile (#3153)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-04-20 09:42:31 -04:00
github-actions[bot]
b23f6b1596
[ci] release (#3101)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-04-13 08:55:32 -04:00
matthewp
16e0ada70f [ci] format 2022-04-13 12:45:17 +00:00
Matthew Phillips
5acf77dd22
Re-enable custom element test and fix "undefined" child (#3095)
* Re-enable custom element test and fix "undefined" child

* Remove outdated comment

* Adds a changeset
2022-04-13 08:44:22 -04:00
Fred K. Schott
77c0be5b26
update lockfile (#3059) 2022-04-10 19:12:30 -07:00
Juan Martín Seery
1907255ca2
chore: webapi test now use chai (#3048) 2022-04-10 18:29:46 -07:00
Nate Moore
5c96145527
add build:ci command which skips tsc (#2869) 2022-03-23 19:46:16 -05:00
Nate Moore
910cae3b95
fix(windows): fix build script on windows (#2830) 2022-03-18 17:44:59 -05:00
Fred K. Schott
498ef59b0e
[ci] update lockfile (#2810)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-03-16 09:53:46 -05:00
Fred K. Schott
2314eba9a4
[ci] update lockfile (#2773)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2022-03-14 10:23:35 -07:00
Fred K. Schott
1634172ff9
[ci] update lockfile (#2763)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-03-11 16:38:28 -06:00
Fred K. Schott
79fc320480
update deps: esbuild, typescript (#2750)
* update dep: typescript

* update dep: esbuild

* update types

* update types

* update dep: es-module-lexer

* update tests
2022-03-10 09:55:40 -06:00
Nate Moore
72c2c86e9d
merge next into main (#2705)
* Unflag the static build (#2652)

* Unflag the static build

* Only set legacyBuild to false if experimentalSSR is true

* Use legacy build when we have to

* Put a few more tests into legacy mode

* Last two

* Make astro-basic use the legacy build

* Adds a changeset

* Mark the lit test as legacy

* Update yarn lock

* Update based on feedback

* Add --legacy-build flag

* Move astro-basic test to use static build (#2682)

* Move some tests over to the static build (#2677)

* Move some tests over to the static build

* Fix assets tests

* Fix the assets tests

* Fix for the client:only components

* Moves asset tests to the static build

* Move postcss test over to static build

* Bring back legacy build for astro-basic test

* Move astro-basic test to use static build

* Migrate more tests to the static build (#2693)

* fix: disable HMR during build (#2684)

* Migrate more tests to the static build

* Only prepend links in non-legacy mode

* Add the 0-css tests

* Convert all CSS tests to the static build

* Migrate Astro global tests

* Remove .only

* Fix static build tests

* Migrate a few more

* More tests

* Move the lit test back to legacy

* Increase the test timeout

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* Improve `head` injection behavior (#2436)

* feat: add renderHead util to server

* feat: remove `layouts` from config, Vite plugin

* fix: improve head injection during rendering

* chore: update compiler

* fix: do not escape links

* chore: enter `pre` mode

* Replace `send` with `sirv` (#2713)

* remove send

* Create thick-ravens-chew.md

* I feel like I'm going to screw something up

* working finally!

* rewrite req.url

* Add tiny bit of doc

* Update .gitignore

Co-authored-by: Evan Boehs <evan@boehs.org>

* Move remaining tests to the static build (#2712)

* Move lit test to the static build

* Migrate astro-env plugin to work in the static build

* Do not remove vite:define

* Adds a changeset

* Add a warning when passing the --experimental-static-build flag (#2718)

* Add a warning when passing the --experimental-static-build flag

* Disable the lint warning

* [ci] release (next) (#2721)

* [ci] release (next)

* chore: update changeset

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nate Moore <nate@skypack.dev>

* 404 page (#2719)

* Fix: build to 404.html in the static build

* Adds a changeset

* fix pnpm install missing peer deps

* fix svelte version in workspace

* fix lockfile

* fix(webapi): add dev script

* improve preview reliability (#2739)

* improve preview reliability - fix broken tests

* shamefully hoist to unblock

* remove lit from test running

* chore: update lockfile

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Evan Boehs <evan@boehs.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Fred K. Schott <fkschott@gmail.com>
2022-03-09 15:44:26 -06:00
Fred K. Schott
240d88aefe
fix format (#2736) 2022-03-08 15:20:04 -08:00
Nate Moore
d08ddaf5b9
Move from yarn to pnpm (#2455)
* chore: `yarn` => `pnpm`

* docs: `yarn` => `pnpm`

* chore(ci): yarn => pnpm

* chore(ci): update pnpm cache path

* fix: add missing deps

* fix: add missing deps

* test: add package.json to all test fixtures

* chore: improve hoisting behavior

* chore: move turbo into package.json

* chore: update npmrc

* fix: add missing `debug` dependency

* chore: remove prepare script

* test: fix new tests

* fix: fully resolve renderer paths and `astro/internal` path

* chore: update lockfile

* chore: remove log

* fix: resolve renderers in vite-plugin-jsx

* fix: prefer public-hoist-pattern to shamefully-hoist

* chore: ignore @babel/core peer warning

* chore: update dependencies

* test: add autoprefixer as explicit dep

* chore: update `.npmrc` file in examples

* chore: update dependencies

* fix: resolve renderer dependencies in static build

* fix: static build renderer resolution

* chore: fix smoke tests

* chore: hoist autoprefixer

* chore: update lockfile

* attempt: use full file:// path on Windows

* attempt: use astro/internal

* attempt: optimize astro/internal

* attempt: expose ./internal.js

* chore: add missing package.json files

* attempt: resolve astro/internal path

* chore: tidy package.json

* chore: update lockfile

* chore: update deps

* chore: update deps

* chore: yarn -> pnpm

* attempt: explicit /@fs urls

* attempt: explicit /@fs urls

* chore: update all examples for pnpm

* chore: fix hoisting for with-vite-plugin-pwa

* chore(ci): fix sharp install

* chore: update with-vite-plugin-pwa example

* fix: pin vite-plugin-pwa to 0.11.11

* fix: add workbox-window to vite-plugin-pwa deps

* refactor: use pnpm update --recursive

Co-authored-by: JuanM04 <me@juanm04.com>

* chore: yarn => pnpm

* chore: yarn => pnpm

* fix: update smoke test to skip examples which don't work in static build

* update lockfile

* chore: update .npmrc files

* chore: update lockfile

* fix: smoke script

* chore: update .npmrc file

* fix: return to shamefully-hoist (shamefully)

* chore: update lockfile

* fix(smoke): ignore scripts for smoke tests

* fix: update example to disable renderers

* chore: bump version

* chore(ci): fix smoke tests

* attempt: disable --frozen-lockfile for smoke tests

* chore: update smoke test

* chore: fix rebase issue

* chore: update lockfile

* fix: smoke tests

* fix(ci): run external smoke tests first

* fix(ci): run syntax

* chore: update lockfile

* fix(ci): ensure submodules are up-to-date

* fix(ci): ensure submodules are up-to-date

* chore: update lockfile

* chore: update for webapi

* chore: silence node:* warnings

* chore: update deps

* fix(ci): persist generated webapi assets

* fix(ci): webapi build script

* chore(ci): remove custom node caching

* chore: keep turbo.json

* chore: update turbo, ignore create-astro

* chore: update deps

* fix(ci): test command

* chore(ci): update test script

Co-authored-by: JuanM04 <me@juanm04.com>
2022-03-08 15:46:11 -06:00
natemoo-re
63adaeec34 [ci] yarn format 2022-03-07 21:37:50 +00:00
Nate Moore
f18ee36dc0
Add @astrojs/webapi package (#2729)
* chore: add @astrojs/webapi

* chore: update package.json

* fix: update file case

* fix: remove lowercase file

* chore: update tests to use mocha

* chore: update LICENSE
2022-03-07 15:36:22 -06:00