Commit graph

1848 commits

Author SHA1 Message Date
matthewp
3adb9ea87c [ci] npm run format 2021-04-06 20:15:14 +00:00
Matthew Phillips
72d9ece6db
Compiler cleanup (#64)
* Compiler cleanup

This is general compiler cleanup, especially around the codegen part. Goals here were too:

1. Make it possible to compile HTML recursively (needed for future astro-in-expressions work) by moving that work into its own function.
1. Get rid of collectionItems and have compiling the HTML return just a source string.

Also not planned, this change gets rid of the different between components and pages. All Astro components compile to the same JavaScript.

* Remove unused node types
2021-04-06 16:14:42 -04:00
Matthew Phillips
7240f0d677
Create a astro/components/ folder (#63)
This adds astro/components/ and moves the Prism.astro component into there. So to use in a project you can do:

```html
---
import Prism from 'astro/components/Prism.astro';
---

<Prism lang="html" code={`<html> ... </html>`}
```
2021-04-06 15:27:42 -04:00
Drew Powers
1acd5ee310
Allow no config (#61)
* Allow no config

* Update README
2021-04-05 15:56:46 -06:00
matthewp
71e5de76f1 [ci] npm run format 2021-04-05 18:18:39 +00:00
Matthew Phillips
c9bc6ffef7
Improve searching for pages (#60)
This improves the algorithm for searching for pages. It now works like:

1. If pathname ends with /
  1. Look for PATHNAME/index.astro
  1. Look for PATHNAME/index.md
1. else
  1. Look for PATHNAME.astro
  1. Look for PATHNAME.md
1. Look for PATHNAME/index.astro
  1. 301
1. Look for PATHNAME/index.md
  1. 301
1. 404
2021-04-05 14:18:09 -04:00
Drew Powers
d9733e8d42
Add type declarations (#59) 2021-04-02 21:01:57 -06:00
Drew Powers
008ffc2951
Fix scoping issues (#58) 2021-04-02 20:44:23 -06:00
Drew Powers
aa333c2f29
Add Tailwind support (#57) 2021-04-02 19:23:30 -06:00
Drew Powers
b58b493948
Fix body from being scoped (#56) 2021-04-02 12:50:30 -06:00
Drew Powers
004b3ea6a0
Fix React import (#55)
* Fix React import

* Change default export

* Fix :visible dynamic component

* Use colon to alias vue createElement

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2021-04-02 14:48:41 -04:00
Drew Powers
5a1f422883
Move devDeps to deps (#54) 2021-04-02 11:04:48 -06:00
Drew Powers
003b3c395f
Get CSS Modules working in Vue (#53) 2021-04-02 10:16:16 -06:00
Matthew Phillips
2646f800af
Remove errant console.log (#51) 2021-04-01 16:57:32 -04:00
matthewp
1d73883469 [ci] npm run format 2021-04-01 20:34:51 +00:00
Matthew Phillips
54ba9f5ee1
Fix complex MDX parsing (#50)
* Fix complex MDX parsing

This allows fully MDX support using the micromark MDX extension. One caveat is that if you do something like use the less than sign, you need to escape it because the parser expects these to be tags otherwise.

* Move micromark definition
2021-04-01 16:34:11 -04:00
Matthew Phillips
397b7145cc
Add prism and skeleton www page (#49)
* Add prism and skeleton www page

This adds a Prism plugin, a Prism component, and the skeleton of our www site (just for testing the Prism component at the moment).

* Remove debugging
2021-04-01 15:16:29 -04:00
Drew Powers
c26c244ca2
Annoying Lint PR #2 (#47) 2021-04-01 10:25:28 -06:00
Drew Powers
f6a7ac67be
Add runtime mode (#48) 2021-04-01 10:20:57 -06:00
Matthew Phillips
7c10d563f2
Implements import.meta.request (#46)
This adds `import.meta.request` to pages (not components).
2021-03-31 16:47:03 -04:00
Matthew Phillips
d5b15a3851
Support for custom elements (#45)
* Support for custom elements

Now you can use custom elements like so in Astro components:

```html
<script type="module" src="./datepicker.js">
<date-picker></date-picker>
```

These will be resolve relative to the current astro component. In the build these modules are run through the same bundle/minify process as components.

* Remove component from public

* Formatting

* Disable empty fn rule
2021-03-31 16:46:09 -04:00
Matthew Phillips
d9084ff4ad
Implement fallback capability (#44)
* Implement fallback capability

This makes it possible for a dynamic component to render fallback content on the server.

The mechanism is a special `static` prop passed to the component. If `static` is true then the component knows it can render static content.

Putting aside the word `static`, is this the right approach? I think giving components the flexibility to make the decision themselves *is* the right approach.

However in this case we have a special property that is passed in non-explicitly. I think we have to do it this way because if the caller passes in a prop it will get serialized and appear on the client. By making this something we *add* during rendering, it only happens on the server (and only when using `:load`).

Assuming this is the right approach, is `static` the right name for this prop? Other candidates:

* `server`

That's all I have!

* Use `import.meta.env.astro` to tell if running in SSR mode.

* Run formatter
2021-03-31 16:10:27 -04:00
Drew Powers
3fa6396a7b
Extract Astro styles to external stylesheets (#43)
* Extract Astro styles to external stylesheets

* Require relative URLs in Markdown layouts
2021-03-31 13:04:18 -06:00
Fred K. Schott
a3b20a9aff remove unused fn 2021-03-30 17:06:13 -07:00
matthewp
da6ad7a5ed [ci] npm run format 2021-03-30 20:07:48 +00:00
Matthew Phillips
3e82a0052d
Add minification (#42) 2021-03-30 16:07:12 -04:00
Fred K. Schott
1c0590aeff simplify svg animation, slow it down 2021-03-30 12:13:56 -07:00
matthewp
f7603e0097 [ci] npm run format 2021-03-30 19:07:17 +00:00
Matthew Phillips
4a732837cd
Resolve component URLs during compilation (#40)
Previously dynamic component URLs were being resolved client-side in a weird way that only worked during dev. This change makes them handle during compilation, so it works in both (and improves readability of the dynamic import output).
2021-03-30 15:06:43 -04:00
Drew Powers
7334a550d8
Fix nested parens bug (#39) 2021-03-30 10:37:04 -06:00
Drew Powers
ee6ef81cf3
Convert CSS Modules to scoped styles (#38)
* Convert CSS Modules to scoped styles

* Update README

* Move class scoping into HTML walker

* Fix SSR styles test

* Fix mustache tags

* Update PostCSS plugin name

* Add JSDoc comment

* Update test
2021-03-30 10:11:21 -06:00
matthewp
d267fa461b [ci] npm run format 2021-03-30 14:52:09 +00:00
Matthew Phillips
3b27eaac43
Add support for doctype (#37)
* Add support for doctype

* Automatically prepend doctype
2021-03-30 10:51:31 -04:00
matthewp
dbd764bdeb [ci] npm run format 2021-03-30 13:24:54 +00:00
Matthew Phillips
a79f7d4077
Bundling! 🤘 (#36)
* Bundling! 🤘

* Finalize build changes
2021-03-30 09:24:26 -04:00
Fred K. Schott
f11fd265f8 revert bad snowpack example changes 2021-03-29 13:48:27 -07:00
Fred K. Schott
d2d0ddad82 update landing page 2021-03-29 11:33:14 -07:00
Fred K. Schott
33c7b953b5 update site title 2021-03-29 10:46:35 -07:00
Fred K. Schott
ae8840bf8f clean up landing page 2021-03-29 10:43:46 -07:00
Fred K. Schott
4ff1822bb9 add example www site 2021-03-29 08:43:38 -07:00
Nate Moore
9ab1f52a1c
New hydration methods (#29)
* WIP: new hydration methods

* refactor: genericize load/idle/visible renderers

* fix: do not pass "data-astro-id" to component

* docs: add hydration section to README

* docs: update README

Co-authored-by: Nate Moore <nate@skypack.dev>
2021-03-26 17:09:28 -05:00
Drew Powers
202973291f
Add PR Template (#34)
* Add Auto-format action

* Add PR template
2021-03-26 14:03:07 -06:00
Drew Powers
88df57e690
Add SSR Styles test (#35) 2021-03-26 13:59:41 -06:00
drwpow
b92b9f66e5 [ci] npm run format 2021-03-26 19:46:26 +00:00
Drew Powers
7def0463b1
Add Auto-format action (#33) 2021-03-26 13:45:53 -06:00
Drew Powers
c7b03776ee
Fix JSX CSS Modules classes (#31) 2021-03-26 13:26:36 -06:00
Drew Powers
3ddd3594f0
Absorb Snowpack config inside Astro (#32)
* Absorb Snowpack config inside Astro

* Add basic README

* Format tests

* Update esbuild

* Format tests
2021-03-26 13:14:32 -06:00
Drew Powers
11637df579
Improve styles (#30) 2021-03-25 18:23:45 -06:00
Drew Powers
04a443a888
Add React component SSR (#28)
* Add React component SSR

* Add React component SSR
2021-03-25 16:59:38 -06:00
Matthew Phillips
3db5959377
First pass at the build (#27)
This updates `astro build` to do a production build. It works! No optimizations yet.
2021-03-25 14:06:08 -04:00