Commit graph

3684 commits

Author SHA1 Message Date
Matthew Phillips
854d0feb34
Add support for React components. (#18)
* Add support for React components.

This adds support for react components via a new `extensions` config in astro.config.mjs. In the future we can extend this to do things like look at the import statements, as Snowpack does.

* Fix the tests
2021-03-23 13:47:54 -04:00
Fred K. Schott
3f16550765 fix broken test 2021-03-22 23:06:25 -07:00
Fred K. Schott
799db34d55 fix broken tests 2021-03-22 21:34:47 -07:00
Drew Powers
1fdc1c799a
[wip] Add styles to Snowpack app (#13)
* Add styles to Snowpack app

* Bubble up file build errors

* Fix merge error
2021-03-22 18:06:58 -06:00
Fred K. Schott
9de1e8feab cleanup new parser handling 2021-03-22 00:40:29 -07:00
Fred K. Schott
d125d57b3a add typescript support for expressions 2021-03-22 00:26:59 -07:00
Fred K. Schott
f28590e640 add example of props in ts 2021-03-21 22:56:36 -07:00
Fred K. Schott
e1782f9dc9 fix markdown header issue 2021-03-21 22:43:28 -07:00
Fred K. Schott
6e4367fd49 another pass at head/body handling in pages 2021-03-21 20:34:11 -07:00
Fred K. Schott
e03afbd980 add fetch support 2021-03-21 16:16:18 -07:00
Fred K. Schott
558ef18b58 get test runner running 2021-03-21 15:13:38 -07:00
Fred K. Schott
417657f138 lots of improvements 2021-03-21 00:44:42 -07:00
Matthew Phillips
2082001ff8
Add snowpack as an example project. (#11)
* Initial tests set up

This adds tests using uvu (we can switch if people want) and restructures things a bit so that it's easier to test.

Like in snowpack you set up a little project. In our tests you can say:

```js
const result = await runtime.load('/blog/hello-world')
```

And analyze the result. I included a `test-helpers.js` which has a function that will turn HTML into a cheerio instance, for inspecting the result HTML.

* Bring snowpack example in

* Formatting
2021-03-19 17:17:38 -04:00
Matthew Phillips
17c3c98f07
Initial tests set up (#10)
* Begin debugging

* Initial tests set up

This adds tests using uvu (we can switch if people want) and restructures things a bit so that it's easier to test.

Like in snowpack you set up a little project. In our tests you can say:

```js
const result = await runtime.load('/blog/hello-world')
```

And analyze the result. I included a `test-helpers.js` which has a function that will turn HTML into a cheerio instance, for inspecting the result HTML.

* Add CI

* Remove extra console logs

* Formatting
2021-03-19 17:07:45 -04:00
Drew Powers
8ebc077cb0
Inject styling in HTML AST (#9)
* Inject styling in HTML AST

* Restore optimize structure
2021-03-19 14:55:06 -06:00
Drew Powers
d75107a20e Respect comments when scanning imports
Use es-module-lexer for import scanning in HMX scripts
2021-03-18 18:10:08 -06:00
Matthew Phillips
d27bd74b05
Refactor to enable optimizer modules (#8)
* Refactor to enable optimizer modules

This refactors HMX compilation into steps:

1. Parse - Turn HMX string into an AST.
2. Optimize - Walk the AST making modifications.
3. Codegen - Turn the AST into hyperscript function calls.

There's still more logic in (3) than we probably want. The nice there here is it gives a Visitor API that you can implement to do optimizations. See src/optimize/styles.ts for an example.

* Allow multiple visitors per optimizer
2021-03-18 16:39:17 -04:00
Drew Powers
5661b28914
Add style transforms (#7)
* Add style transforms

* Let crawler be sync
2021-03-18 11:25:19 -06:00
Matthew Phillips
48d73e3ab3
Setup error logging and provide our first parse errors (#6)
This adds parse error in a nicely formatted way, and moves the existing console.logs into a fork of the Snowpack logger. The new logger is not a singleton and won't preformat the message.
2021-03-17 15:48:49 -04:00
Drew Powers
458454dae5 Clean up TS types 2021-03-16 14:58:45 -06:00
Matthew Phillips
0932401433
TypeScript support (#5)
This makes it so that setup scripts are treated as TypeScript.
2021-03-16 16:36:43 -04:00
Matthew Phillips
588b086a4d
Bring compiler into Astro (#4)
* include source compiler

* Import from JS

* Conditionally use the instance contents

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
2021-03-16 16:08:11 -04:00
Drew Powers
174fc1d669 Fix a few lint errors 2021-03-16 12:43:23 -06:00
Drew Powers
8c45c4a856
Annoying Lint PR™ (#3)
* Add Prettier + ESLint

* Format files
2021-03-16 12:37:45 -06:00
Matthew Phillips
1f5c7c791f
Upgrade to latest snowpack pre (#2)
This contains a bunch of bug fixes for SSR we need.
2021-03-16 14:08:49 -04:00
Matthew Phillips
d4a02e7f9a
Merge pull request #1 from snowpackjs/watch-mode
Add watch mode
2021-03-16 13:56:38 -04:00
Drew Powers
f7c2a55788 Add watch mode 2021-03-16 11:54:43 -06:00
Matthew Phillips
e5ebebbcd7 Progress on preparsing 2021-03-16 10:23:29 -04:00
Matthew Phillips
01c34ac5d4 Prevent snowpaack from running on a port 2021-03-15 15:51:36 -04:00
Matthew Phillips
aff6390cc7 Make our h handle void tags properly 2021-03-15 15:41:15 -04:00
Matthew Phillips
c14af18bef Fix case 2021-03-15 15:27:08 -04:00
Matthew Phillips
39ce064b5f Add a proper cli 2021-03-15 15:26:23 -04:00
Matthew Phillips
47d1c22449 magicthing -> astro 2021-03-15 14:18:39 -04:00
Matthew Phillips
af6b029e95 initial commit 2021-03-15 13:22:05 -04:00