Commit graph

2326 commits

Author SHA1 Message Date
Drew Powers
3d0d53486c
Add Astro.fetchContent API (#91) 2021-04-13 18:08:32 -06:00
Drew Powers
4a71de9e3d
Add CODEOWNERS (#88) 2021-04-13 12:02:46 -06:00
Matt Mulder
ac22d94e11
fix: bundle client-side code for components used in .md pages (#78) 2021-04-13 13:04:01 -04:00
duncanhealy
b588581396
set node version in nvmrc & engines to lts (#87)
* node lts version for nvmrc v14.16.1

* node lts version for nvmrc v14.16.1

* engine version set to to 14.x.x and npm >=6 < 7
2021-04-13 13:03:26 -04:00
Jonathan Neal
740a6b73e0
add content-type to astro html (#85) 2021-04-13 13:01:42 -04:00
Drew Powers
3639190b4e
Renaming to import.meta.fetchContent (#70)
* Change to import.meta.glob()

Change of plans—maintain parity with Snowpack and Vite because our Collections API will use a different interface

* Get basic pagination working

* Get params working

* Rename to import.meta.fetchContent

* Upgrade to fdir
2021-04-12 17:21:29 -06:00
duncanhealy
687ff5bacd
chore fix lint reduce errors generated (#83)
* add dep domhandler imported in in src/build/static

* lint and jsDoc error

* move domhandler to devDep

* chore: add package lock

* escape string jsDoc

* chore: add astro dep in until prism import is refactored

* chore: add snowpack example package lock
2021-04-12 16:20:58 +01:00
Matthew Phillips
cffde0192b
Add back in astro as a dependency of the snowpack example (#81)
Removing the dependency breaks the site as using Markdown creates an import to a builtin Astro component. So we need astro as a dep. Not sure why it was changed anyways.
2021-04-12 08:26:59 -04:00
Fred K. Schott
8e4b201c1b
Update README.md 2021-04-11 22:31:50 -07:00
Fred K. Schott
4107a53757
Update README.md 2021-04-11 08:45:57 -07:00
Fred K. Schott
faae08712e 0.0.5 2021-04-10 22:02:34 -07:00
Fred K. Schott
a17bafbb5a update snowpack plugin 2021-04-10 22:02:19 -07:00
Fred K. Schott
1355d570f5 add astro bin to files array 2021-04-10 21:59:59 -07:00
Fred K. Schott
c923f1793d 0.0.4 2021-04-10 21:58:59 -07:00
Fred K. Schott
a66fd3272b add publish script 2021-04-10 21:58:57 -07:00
Fred K. Schott
887ee982d8 fix plugins relative issue 2021-04-10 21:57:40 -07:00
Fred K. Schott
24f50220e1 update package.json 2021-04-10 13:17:31 -07:00
Fred K. Schott
4e7ae2075d small size change 2021-04-10 13:02:07 -07:00
Fred K. Schott
d3f8efbf6e cleanup landing page, and small fix 2021-04-10 13:00:50 -07:00
Fred K. Schott
1712f9edb6 add counter component 2021-04-10 12:35:25 -07:00
Drew Powers
e3ca67d6dc
Use import specifier rather than filename (#71) 2021-04-09 14:23:25 -06:00
matthewp
62924b3162 [ci] npm run format 2021-04-09 18:09:44 +00:00
Matthew Phillips
ad9c3b1d8d
Parse inner JSX as Astro (#67)
* Parse inner JSX as Astro

This completes the compiler changes, updating the parser so that it parses inner "JSX" as Astro. It does this by finding the start and end of HTML tags and feeds that back into the parser.

The result is a structure like this:

```
{
  type: 'MustacheTag',
  expression: [
    {
      type: 'Expression',
      codeStart: 'colors.map(color => (',
      codeEnd: '}}'
      children: [ {
        type: 'Fragment',
        children: [ {
          type: 'Element',
          name: 'div'
        } ]
      } ]
    }
  ]
}
```

There is a new Node type, `Expression`.  Note that `MustacheTag` remains in the tree, all it contains is an Expression though. I could spend some time trying to remove it, there's just a few places that expect it to exist.

* Update import to the transform

* Transform prism components into expressions
2021-04-09 14:09:13 -04:00
matthewp
084845f79d [ci] npm run format 2021-04-09 17:04:00 +00:00
Matthew Phillips
185a267133
Improve renderer types (#69)
* Improve renderer types

Looking at the render code I noticed that the Component rendering is not typed. This adds that, might help prevent a bug in the future.

* Create the supported renderer type
2021-04-09 13:03:27 -04:00
matthewp
4ccf4196e3 [ci] npm run format 2021-04-08 19:17:34 +00:00
Matthew Phillips
72ae661e9e
Add support for syntax highlighting of code blocks (#65)
* Add support for syntax highlighting of code blocks

* Escape usage of backtick strings

* Add workspace root for snowpack

* Use prismjs/components as an external module
2021-04-08 15:17:00 -04:00
Drew Powers
2b346d7a4c
Blog Support 1/3: Data fetching (#62)
* Add example blog

* Add author data

* Improve navigation

* Style nav

* Add friendly error message

* Throw error if import glob used for non-Markdown files

* Use import.meta.collection() API instead

* README fixes
2021-04-06 15:54:55 -06:00
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