Commit graph

15 commits

Author SHA1 Message Date
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