Commit graph

78 commits

Author SHA1 Message Date
Matthew Phillips
44a69f7dcb
Protect again no metadata being passed (#644)
If using Astro <= 0.17.0 there is no `metadata` being passed. Even though no one should be using that version with this, adding some extra protection just in case.
2021-07-09 09:40:42 -04:00
github-actions[bot]
e70d9508d9
Version Packages (#639)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-07-09 09:32:15 -04:00
matthewp
00cdbc4a46 [ci] yarn format 2021-07-09 13:01:57 +00:00
Matthew Phillips
1e01251454
Use correct React rendering API or hydration (#636)
* Use correct React rendering API or hydration

* Add changeset
2021-07-09 09:00:32 -04:00
Matthew Phillips
4b89f4ed08
Allow Preact components to return an empty Fragment (#599) 2021-07-01 14:30:48 -05:00
github-actions[bot]
91e11aee2a
Version Packages (#543)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-25 09:51:28 -04:00
Matthew Phillips
028d4e0114
Fix code from bad merge (#540)
* Fix code from bad merge

* Dont wrap the raw

* Wrap the expression in quotes

* remove react-dom just to test

* Add back react-dom as a known entrypoint

* Make startup time even longer
2021-06-25 09:29:57 -04:00
github-actions[bot]
8b69c2d406
Version Packages (#484)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-21 15:38:41 -04:00
matthewp
32fdb383c7 [ci] yarn format 2021-06-21 19:35:26 +00:00
Matthew Phillips
0abd251cda
Removes snowpack warning suppression (#504)
* Start of warnings

* Provide knownEntrypoints by renderers

This allows renderers to provide knownEntrypoints that will be forwarded to snowpack. This gets rid of renderer-specific warnings and allows us to remove the snowpack logging hacks we were doing.

* Adds a changeset
2021-06-21 15:34:22 -04:00
github-actions[bot]
28c2d74dc3
Version Packages (#446)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-15 08:25:29 -04:00
Matthew Phillips
af03c90c2b
Fix usage of arrow functions as components (#426)
* Fix usage of arrow functions as components

This fixes the React and Preact component as arrow function use-case by checking for the prototype property (arrow functions don't)

* Check the prototype
2021-06-14 13:24:37 -04:00
github-actions[bot]
0ef0c99b10
Version Packages (#418)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-14 08:43:03 -04:00
matthewp
a5d6e434ab [ci] yarn format 2021-06-14 12:36:32 +00:00
Matthew Phillips
271cfe6ce3
Improved JSX framework detection (#382)
* Improved JSX framework detection

This improves the JSX detection and adds a bunch of test. The following is improved:

* If an error throws because of a coding mistake, those errors will be reported.
* We properly detect class components for both Preact and React. We don't have to "try to render" these.

It's still possible that error messages might be obscured in this scenario:

A Preact function component that uses hooks (or another preact specific feature) that has a coding mistake. The React renderer might throw when it uses the Preact hook. That error will be reported rather than the real coding mistake.

This is because we can't distinguish between errors that are due to the wrong framework and errors that the user caused.

I might reach out to the Preact community and see if they can think of a better solution to this problem. This will come up when other JSX based frameworks have renderers. I still think that having multiple frameworks in the same project is a feature worth trying to preserve.

* Move try/catch into the __astro_component
2021-06-14 08:35:25 -04:00
Fred K. Schott
ab2972be83
add engines for esm support (#415) 2021-06-14 08:20:14 -04:00
github-actions[bot]
d90f3fc540
Version Packages (#318)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-07 16:52:22 -04:00
Matthew Phillips
b1364afbae
Prevent duplicate snowpack logs (#316)
* Prevent duplicate snowpack logs

* Fix test to wait on expected messages

* Update the snowpack/plugin-vue

* Add changeset

* Debugging

* Skip the logging test on windows :(

* arg
2021-06-07 14:24:55 -04:00
github-actions[bot]
436a016408
Version Packages (#285)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-02 12:49:05 -04:00
natemoo-re
00c6dec8eb [ci] yarn format 2021-06-01 23:42:10 +00:00
Nate Moore
c9d833ee0b
Fix prerelease bugs, reenable @astrojs/renderer-vue (#286)
* fix: add packages to external

* fix: improve renderer error message

* fix: reenable vue renderer

* chore: remove `extensions` from templates

* fix: reenable @astrojs/renderer-vue

* refactor: add types to snowpack plugin

* fix: update snowpack

* fix: use manual SSR wrapper for Svelte

* chore: add changesets

* chore: bump snowpack

* test: fix failing test

* chore: remove redundant entries
2021-06-01 18:41:08 -05:00
natemoo-re
45c508fa46 [ci] yarn format 2021-05-28 23:26:50 +00:00
github-actions[bot]
092d201aee
Version Packages (next) (#227)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-05-28 18:25:36 -05:00
natemoo-re
94a053c99c [ci] yarn format 2021-05-28 22:20:42 +00:00
Nate Moore
3df41d2308
Bugbash! (#263)
* fix(vscode): Markdown frontmatter should use TSX, not YAML

* test: add test for #153

* chore: bump deps

* chore: update to use @astrojs scope

* fix: Markdown parse error when only child is `{expression}`

* fix: update renderer edge cases

* fix: failing test

* fix: update renderer
2021-05-28 17:19:40 -05:00
Drew Powers
a0055bd985
Create astro fixes (#267)
* Remove create-astro from workspace

* Improve contrast ratio

* Swap blank template for blog template

* Remove counter components from blog template

* Use `latest` astro version
2021-05-28 10:06:22 -06:00
natemoo-re
5fa7e354b3 [ci] yarn format 2021-05-26 18:31:27 +00:00
Nate Moore
643c880f28
Renderer plugins (#231)
* refactor: pluggable renderers

* refactor: cache renderer per component

* docs: update comments on snowpack plugin `transform` method

* docs: add comments to renderer plugins

* refactor: convert components to Map

* fix: pass children through to astro __render

* refactor: move Components/ComponentInfo to shared types

* refactor: remove `gatherRuntimes` step, just scan output for imports

* refactor: update isComponentTag logic

* chore: move dependencies to renderers

* fix: cross-platform transform injection

* feat: defer renderer to react, fallback to preact

* fix: use double quotes in generated script

* test: fix failing children tests

* test: add workspaceRoot to all tests

* fix: pass props to renderer check

* chore: add test:core script back for convenience

* chore: remove unused external

* chore: rename renderers

* chore: add astring, estree-util-value-to-estree

* chore: render-component => __astro_component

* refactor: split hydrate logic to own file

* refactor: use `astro-fragment` rather than `div`

* chore: remove unused hooks

* chore: delete unused file

* chore: add changesets

* fix: Astro renderer should be async

* fix: remove <astro-fragment> for static content

* test: fix failing test

* chore: normalize config interface

* feat: allow renderers to inject a snowpackPlugin

* fix: resolve import URL before using dynamic import

* refactor: update renderers to use separate /server entrypoint

* refactor: update server renderer interface

* fix: get renderers working again

* test: debug failing test

* test: better debug

* test: better debug

* test: remove debug

* fix: support esm and cjs packages via "resolve"

* refactor: split hydrate functions into individual files

* fix: dependency resolution relative to projectRoot

* fix: @snowpack/plugin-postcss needs to be hoisted

* fix: do not test prettier-plugin-astro as it's not ready for primetime
2021-05-26 13:30:22 -05:00