Commit graph

72 commits

Author SHA1 Message Date
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
Nate Moore
191186af43 TEMP: skip create-astro tests 2021-05-26 18:52:53 -05: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
Drew Powers
f5ecbee192
Add test for npm init astro (#238)
* Add test for npm init astro

* Use Lerna to run test
2021-05-24 16:18:56 -06:00
木杉
cce8ac72e0
Make Astro compatible with Windows (#215) 2021-05-17 17:52:11 -05:00
Nate Moore
b3886c206f
Fix markdown issues (#208)
* Init fix/markdown

* Astro Markdown (#207)

* Add Astro Markdown to VSCode Extension

* Add Astro Markdown to Astro

* refactor: update astro-markdown example

* feat: remove embedded components from `.md` files

* fix: resolve `.md.astro` files at runtime

* chore: update markdown tests

* feat: add <Markdown> component

* chore: bump examples

* chore: update example

* fix: improve Markdown child handling

* feat: harden markdown support, add code fence support, add automatic dedenting

* chore: add weird markdown edge cases

* chore: update remote-markdown examples

* chore: add comment to Markdown.astro

* feat: improve markdown support (codefences, nested inside HTML)

* refactor: extract import specifier types to set

* refactor: conditionally import markdown renderer

* refactor: revert special-cased "astro/components"

* refactor: revert special-cased "astro/components"

* refactor: use astro/components/Markdown.astro

* refactor: remove `.md.astro` support in favor of Markdown component

* refactor: use regular .astro files

* refactor: remove unused code

* refactor: move Markdown inside Layout

* wip: markdown scoped styles

* feat: improve scoped styles in Markdown

* feat: micromark => remark ecosystem

* fix: markdown build

* fix: markdown build

* chore: add todo

* fix: collect headers text

* docs: add Markdown doc

* chore: add changeset

* docs: improve Markdown highlighting

* refactor: prefer Set

* refactor: exclude large unified deps

* docs: update markdown docs

Co-authored-by: Jonathan Neal <jonathantneal@hotmail.com>

* chore: remove extra markdown deps

* perf: optimize markdown

* fix: unified/rehype deps

* temp: fix markdown test

* test: add TODO comment

* fix: do not namespace frontmatter, just astro metadata

* test: fix astro-markdown test

* test: add realworld markdown example

* fix: prism language bug

* docs: update markdown docs

* chore: bump dependencies

* fix: escape codespan

* fix: unterminated string literal

* fix(vscode): inline dependencies

* fix(vscode): dependencies

* feat(vscode): embedded markdown

* feat: add Markdown syntax highlighting

* chore: improve markdown example

* fix: markdown example

* feat: highlighting improvements

* chore: add changeset

* fix: CodeBlock => CodeSpan

* chore: get astro-markdown example running

Co-authored-by: Jonathan Neal <jonathantneal@hotmail.com>
2021-05-17 09:29:16 -05:00
Nate Moore
06edbd1aad fix: format 2021-05-13 14:28:38 -05:00
Nate Moore
087fe6276f
chore: format workflow, format .astro files (#211) 2021-05-13 14:20:01 -05:00
Drew Powers
3ef1b01e14
[wip] Fix CI (#202)
* Yarn format

* Fix changeset --since

* Fix Windows tests
2021-05-12 12:06:16 -06:00
Drew Powers
b81abd5b2c
Add CSS bundling (#172)
* Add CSS bundling

* Add Changeset

* Update build script

* Count better

* Fix stats

* Cleanup

* Add test

* Show profile ms under 750ms
2021-05-06 10:38:53 -06:00
Nate Moore
64f4f74fb6
Split out astro-languageserver and astro-vscode (#173) 2021-05-05 12:44:31 -05:00
Drew Powers
94038d3297
Format (#167) 2021-05-03 12:26:10 -06:00
Nate Moore
c93201a909
Refactor astro export map, add source-map-support (#161)
* fix: add svelte plugin for esbuild, remove precompiled svelte components

* refactor: public export map, public types

* feat: add source-map-support to common code paths

* chore: move new "exports" to "imports" map, add internal types

* Include outPath in error logging for bad load status, and drop error stack (#163)

* Include outPath in the error logging for bad load status

* Discard error stack since it seems not useful

* feat: improve build error logging

* refactor: use object param for writeResult

Co-authored-by: Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>
2021-05-03 13:18:08 -05:00
Drew Powers
4ff3add50f
Clean dependencies (#166)
* Clean dependencies

This moves some dependencies around where they should be

* Formatting
2021-05-03 11:47:51 -06:00
Nate Moore
c74f3e70f1
Adds .editorconfig file (#162)
* chore: adds .editorconfig file

* chore: move devDeps to root
2021-05-03 12:41:39 -05:00
Nate Moore
4df1347156
Migrate to yarn monorepo (#157)
* chore: use monorepo

* chore: scaffold astro-scripts

* chore: move tests inside packages/astro

* chore: refactor tests, add scripts

* chore: move parser to own module

* chore: move runtime to packages/astro

* fix: move parser to own package

* test: fix prettier-plugin-astro tests

* fix: tests

* chore: update package-lock

* chore: add changesets

* fix: cleanup examples

* fix: starter example

* chore: update changeset config

* chore: update changeset config

* chore: setup changeset release workflow

* chore: bump lockfiles

* chore: prism => astro-prism

* fix: tsc --emitDeclarationOnly

* chore: final cleanup, switch to yarn

* chore: add lerna

* chore: update workflows to yarn

* chore: update workflows

* chore: remove lint workflow

* chore: add astro-dev script

* chore: add symlinked README
2021-04-30 16:33:35 -05:00
Nate Moore
a79c63750f chore: release 0.0.9 2021-04-30 09:36:19 -05:00
Nate Moore
509fad6b9a
Fix Svelte bundled behavior (#151)
* build: add svelte to dynamic component imports

* fix: svelte bundling

* fix: ensure svelte runtime is bundled with build

* fix: svelte runtime in dev mode

* fix: include svelte runtime in imports

Co-authored-by: Duncan Healy <duncan.healy@gmail.com>
2021-04-30 09:35:18 -05:00
Nate Moore
1e849689e4
chore: update to snowpack@3.3.7 (#150) 2021-04-29 20:32:53 -05:00
Matthew Phillips
0ea4a986e2
Support 500 pages in the dev server (#131)
* Support 500 pages

* Document custom 400/500 pages

* Remove search from any pages not the 500 page

* fix(kitchen-sink): add snowpack.config.js

* fix(examples): add snowpack.config.js

* style: redesign built-in 500 page

Co-authored-by: Nate Moore <nate@skypack.dev>
2021-04-26 16:42:11 -04:00
Nate Moore
87af0aead8
First Pass at LSP (#129)
* feat(lsp): add HTML features to LSP

* chore: add language server license

* feat(lsp): add folding ranges, scaffold TS features

* feat(lsp): TypeScript Language Service setup

* refactor(lsp): cleanup typescript completion providr

* chore: format

* chore: cleanup eslint

* fix: license

* chore: remove comment

* chore: add marketplace info

* chore: publish
2021-04-23 17:53:01 -05:00
Matthew Phillips
3ffeb0f7b7
Restore parse errors (#130) 2021-04-23 15:20:05 -04:00
Drew Powers
510e7920d2
Add RSS generation (#123) 2021-04-23 10:44:41 -06:00
Matthew Phillips
da033e27ea
CLI docs (#121)
* Start of cli docs

* Document the CLI

Also adds support for the `--config` option and `--port` option for the dev server.

* Add tests for --config and --port flags

* Add port to validateConfig
2021-04-22 08:25:57 -04:00
Nate Moore
54409a0702
Prettier support for .astro files (#106)
* docs: fix readme

* chore: scaffold prettier plugin

* chore(prettier): switch to cjs

* test(prettier): scaffold prettier tests

* test(prettier): add simple prettier tests

* feat(prettier): first pass

* refactor: expose parser as CJS export

* test(prettier): add long expression

* refactor(prettier): use Astro parser + built-in prettier doc for prettier plugin

* chore: remove parser from git

* chore: add prettier-plugin-astro `build` to workflow

* chore: update package-lock

* chore: do not build prettier-plugin-astro

* fix: update engines

* chore: remove NPM restriction

* chore: fix workflow paths

* chore: update build script

* test: fix prettier expr test

* chore: fix parser build on windows

* refactor: add parser tsconfig, extending base config

* chore: relax ban-ts-comment

* chore: fix lint issue

Co-authored-by: Nate Moore <nate@skypack.dev>
2021-04-21 11:14:44 -05:00
Drew Powers
3263c02d77
Update Snowpack, Add CSS Modules SSR (#116)
* Add CSS Modules SSR

* Update docs
2021-04-20 15:06:33 -06:00
Matthew Phillips
b25d2cc93e 0.0.6 2021-04-19 15:38:20 -04:00
Matthew Phillips
58c499dc85
Pass mode into snowpack runtime (#99)
* Pass the `mode` through to snowpack

This allows the production packages to be prepared.

* Use snowpack 3.3.1

* Update path to prism loadComponents external ref

* Upgrade to snowpack 3.3.2
2021-04-16 13:15:27 -04:00
Nate Moore
22ca9e0aac
Support children inside of components (#72)
* chore(examples): add kitchen-sink

* feat: support children in rendered components

* feat: add support for rendering children in Svelte

* fix: cleanup p/react fragment children

* chore: add @ts-nocheck to svelte files

* chore: update lockfiles

* fix: types

* feat: memoize frontend/renderer/utils

* fix: disable eslint for compiled SvelteWrapper

* fix: add missing dep

Co-authored-by: Nate Moore <nate@skypack.dev>
2021-04-15 10:55:50 -05:00
Drew Powers
3d0d53486c
Add Astro.fetchContent API (#91) 2021-04-13 18:08:32 -06: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
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
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
24f50220e1 update package.json 2021-04-10 13:17:31 -07: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
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
008ffc2951
Fix scoping issues (#58) 2021-04-02 20:44:23 -06: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
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
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
Matthew Phillips
3e82a0052d
Add minification (#42) 2021-03-30 16:07:12 -04: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
Matthew Phillips
a79f7d4077
Bundling! 🤘 (#36)
* Bundling! 🤘

* Finalize build changes
2021-03-30 09:24:26 -04:00