Commit graph

669 commits

Author SHA1 Message Date
Bjorn Lu
ae8a012a7b
Handle compiler breaking change (#5803) 2023-01-12 22:46:56 +08:00
Fred K. Bot
982e21c164
[ci] update lockfile (#5815)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-11 10:40:11 -06:00
HiDeoo
2303f95142
Add support for serving well-known URIs with the @astrojs/node SSR adapter (#5832) 2023-01-11 17:52:51 +08:00
Dovlat Yakshibayev
813073addd
Bumps partytown version to fix deprecation warning (#5820)
* bumps partytown version, adds changeset

* changes changeset from minor to patch

* changes changeset from minor to patch
2023-01-10 16:05:28 -06:00
wulinsheng123
9869f2f6d8
can jump 404 when that page does not exist (#5701) 2023-01-11 00:59:20 +08:00
Erika
c55fbcb8ed
Remove more unnecessary polyfills from webapi for Node 16 (#5814)
* feat(webapi): Remove unnecessary polyfills now that we dropped support for Node 14

* feat(webapi): Removed more unnecessary polyfills for Node 16

* chore: changeset
2023-01-10 15:29:06 +01:00
Bjorn Lu
4a1cabfe6b
Cleanup dependencies (#5773) 2023-01-10 15:58:55 +08:00
Erika
1f92d64ea3
Drop Node 14 support (#5782)
* chore: Update engines field

* fix(deps): Remove node-fetch

* feat(polyfills): Remove node-fetch for undici

* feat(webapi): Remove node-fetch from the webapis polyfills for undici

* feat(core): Remove node-fetch for undici in Astro core

* feat(telemetry): Remove node-fetch for undici

* feat(node): Remove node-fetch for undici in node integration

* feat(vercel): Remove node-fetch for undici in Vercel integration

* chore: update lockfile

* chore: update lockfile

* chore: changeset

* fix(set): Fix set directives not streaming correctly on Node 16

* Try another approach

* Debugging

* Debug fetch

* Use global fetch if there is one

* changeset for lit

* Remove web-streams-polyfill

* Remove web-streams-polyfill license note

* Update .changeset/stupid-wolves-explain.md

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-01-09 16:59:20 -05:00
Bjorn Lu
302e0ef8f5
Default preview host to localhost (#5753)
* Initial refactor

* Extract as vite plugin

* Cleanup vite plugin

* Reduce option passing

* Use localhost as preview default host

* Simplify base handling

* Fix host handling

* Add changeset

* Remove unused imports

* Remove unused sirv dep

* Try pin playwright to 1.28.1

* Update playwright

* Try this

* Speed up CI

* Try fix page off

* Refactor networkidle

* Ensure open connections are destroyed when the preview server is closed

* Revert debug code

Co-authored-by: Matthew Phillips <matthew@matthewphillips.info>
2023-01-09 12:14:07 -05:00
Chris Swithinbank
f35411487b
[markdown-remark] Remove unused dependencies (#5804)
* [markdown-remark] Remove unused dependency

Follow up to #5785. Missed one dependency that is no longer used and can be removed.

* [markdown-remark] Remove unused dependency

* Lockfile fix

* Update lockfile [again]
2023-01-09 17:06:29 +01:00
Nate Moore
f8f4d49aba
Output assets to _astro directory (#5772)
* WIP: emit assets to _astro

* chore: better _astro handling

* refactor: emit server assets to `chunks/`

* chore: update /asset tests

* test: add explicit build output tests

* fix: update image to emit to configured asset path

* chore: update changeset

* chore: update image tests

* chore: update image tests

* test: update css test

* test: update bundling test

* test: update tests

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* chore: add clarifying comment

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2023-01-09 10:01:33 -06:00
Fred K. Bot
32b0795bc0
[ci] update lockfile (#5805)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-09 09:28:53 -05:00
Chris Swithinbank
16107b6a10
Remove Astro-flavored Markdown from @astrojs/markdown-remark (#5785) 2023-01-09 10:23:21 +01:00
Fred K. Bot
0be2d0dbc2
[ci] update lockfile (#5790)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-09 15:25:01 +08:00
Sebastiaan
f7aa1ec25d
[@astrojs/lit] Fix slotted content into main (#5791)
* Fix  add the missing slot attribute to child nodes

* Add lit slot tests

* Add changeset
2023-01-07 08:29:16 -05:00
Fred K. Bot
ec5a39c299
[ci] release (beta) (#5742)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-01-06 13:00:12 -05:00
Bjorn Lu
49ab4f231c
Remove proload for config loading (#5778)
* Refactor resolve and load config

* Add changeset

* Update name

* Remove unnecessary node_env handling

* Fix test

* Update comment
2023-01-06 12:49:18 -05:00
Fred K. Bot
23937fbbc9
[ci] update lockfile (#5775)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-06 10:29:58 -05:00
Ben Holmes
93e633922c
Add SmartyPants flag (#5769)
* feat: add smartypants flag

* test: smartypants in markdown and mdx

* docs: Smartypants -> SmartyPants

* chore: changeset

* chore: update changeset with 1.0 -> 2.0 in mind

* chore: bump to minor change
2023-01-06 09:26:02 -05:00
Nate Moore
9ef0c50427
Update compiler (#5656)
* chore: update compiler

* chore: pin compiler

* update compiler

* update changeset

* chore: test prerelease

* chore: update compiler

* chore: update lockfile

* chore: do not pin compiler

* Delete fresh-kids-serve.md

Co-authored-by: Nate Moore <nate@astro.build>
2023-01-05 10:43:57 -06:00
Fred K. Bot
17608762e1
[ci] update lockfile (#5764)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-05 09:22:54 -06:00
Matthew Phillips
116d8835ca
Fix for hoisted scripts in project with spaces in the file path (#5756)
* Fix for hoisted scripts in project with spaces in the file path

* Adding a changeset

* Use viteID instead
2023-01-04 15:36:44 -05:00
Nate Moore
55cea0a9d8
Handle getStaticPaths with prerendered pages (#5734)
* fix(#5661): ensure getStaticPaths is correctly handled for prerendered pages

* test: add prerender getStaticPaths cases

* chore: add changeset

* test: add props to test suite

* chore: update lockfile

Co-authored-by: Nate Moore <nate@astro.build>
2023-01-04 13:20:13 -06:00
Fred K. Bot
cc4606d65e
[ci] update lockfile (#5744)
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-04 10:45:33 -06:00
Erika
2a57864195
Add file location to errors in build (#5743)
* feat(errors): Add file location where error happened during build for user-generated errors

* chore: changeset

* fix(errors): Only add information if the error is in a compatible shape

* feat(errors): Add hint to throw Error objects instead of other types for better information

* test(errors): Add test to make sure errors in build have the error location

* chore(lockfile): Update lockfile

* chore: misc text fixes
2023-01-04 13:31:28 +01:00
Fred K. Bot
2ba3bd9c16
[ci] release (beta) (#5732)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-01-03 17:23:30 -05:00
Ben Holmes
a9c2920264
Markdown and MDX configuration rework (#5684)
* feat: change extendDefaults -> gfm

* deps: remove smartypants from md/remark

* tests: update markdown plugin tests

* fix: borked lockfile

* feat: allow all Markdown options in MDX config, with extend

* deps: remove smartypants from MDX

* chore: remove unused `mode` property

* chore: remark rehype types

* chore: dead code

* fix: order of default config properties

* refactor: move md defaults to remark

* fix: RemarkRehype type

* fix: apply defaults based on MD defaults

* chore: update plugin tests

* chore: add syntaxHighlight test

* refactor: remove drafts from config defaults

* docs: new MDX config options

* chore: add changeset

* edit: test both extends for syntax highlight

* refactor: remove MDX config deep merge

* docs: update README and changeset

* edit: avoid -> disable

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* edit: `drafts` clarification

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* edit: remove "scare quotes"

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* docs: MDX config options redraft

* docs: add migration

* chore: changeset heading levels

* refactor: githubFlavoredMarkdown -> gfm

* chore: remove unused imports

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-01-03 17:12:47 -05:00
Matthew Phillips
4cc8c84caf
Fix astro-embed peerDep issue (#5731)
* Fix astro-embed peerDep issue

* Update lockfile
2023-01-03 15:32:43 -05:00
Bjorn Lu
f6cf92b483
Upgrade to Vite 4 (#5685)
* Upgrade Vite 4

* Simplify Svelte preprocess setup

* Upgrade rollup

* Fix tests

* Fix wrong changeset target

* Fix error tests

* Set NODE_ENV default
2023-01-03 13:24:49 -05:00
Fred K. Bot
5007bc7881
[ci] update lockfile (#5686)
* [ci] update lockfile

* Fix build errors from new TypeScript version

* Updated lockfile

Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-01-03 12:18:32 -05:00
Fred K. Bot
3a0f7c4855
[ci] release (#5718)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-01-03 10:44:51 -05:00
Ben Holmes
bf210f7841
[content collections] Handle file name spaces and capitalization (#5666)
* feat: slugify slug to handle capitals and spaces

* docs: add not on Slugger issues

* deps: bump to github-slugger 2.0

* refactor: new Slugger() -> slug util

* fix: stop using URL.pathname

* fix: `file://` prefix on isContentFlagImport

* test: spaces in fixture file name

* chore: add `test:unit:match`

* refactor: handle collection errors from getEntryInfo

* test: unit getEntryInfo

* chore: changeset

* chore: markdown-remark out of date

* fix: correctly strip index on windows

* fix: move to utils, fix slug regex

* refactor: intermediate var

* lint: `path` variable shadowing

* chore: add not on allowFilesOutsideCollection
2023-01-03 09:45:16 -05:00
Fred K. Bot
640de3c26f
[ci] release (#5645)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-27 11:52:24 -05:00
Ben Holmes
853081d1c8
[Content] Throw on relative image usage (#5648)
* chore: add rel image error plugin

* deps: mdast, mdast types

* chore: add rel image throw to mdx

* refactor: doc rel image path plugin

* fix: respect experimental flag in md remark

* chore: changeset

* deps: remove mdast package

* fix: resolve contentDir from config

* fix: apply MDX plugin after user plugins

* fix: stub out contentDir
2022-12-22 10:38:03 -05:00
Bjorn Lu
0b50987584
Use acorn to postprocess Astro globs (#5652) 2022-12-21 11:05:18 +08:00
Chris Swithinbank
2c65b433bf
MD/MDX collect headings refactor (#5654) 2022-12-20 23:08:15 +01:00
Fred K. Bot
783a2a8e1b
[ci] release (#5642)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-19 09:26:29 -06:00
Fred K. Bot
2552816d5f
[ci] release (#5618)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-16 20:12:04 -05:00
Fred K. Bot
fc46ca53d1
[ci] release (#5607)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-16 15:54:19 -05:00
Nate Moore
61302ab7a0
fix(create-astro): skip Houston on windows until prompts are fixed (#5616)
Co-authored-by: Nate Moore <nate@astro.build>
2022-12-16 15:48:03 -05:00
Ben Holmes
5ec0f6ed55
Content Collections (#5291)
* feat: port content plugin as-is

* feat: add `fetchContent` to `.astro`

* refactor: move more logic to content-internals

* refactor: move internals -> content dir

* feat: nested dir support

* feat: add with-content playground

* edit: update README

* fix: serialize route pattern for Netlify edge

Co-authored-by: Jackie Macharia <jackiewmacharia>

* wip: add ?astro-asset-ssr flag

* wip: exclude astro-ssr-asset styles from build

* revert: SSR asset flag babel changes

* feat: only load CSS when mdx is rendered!

* fix(vercel): Include all files inside `dist/` instead of only `entry.mjs` (#5175)

* chore: only-allow pnpm (#5131)

* [MDX] Support `recmaPlugins` config (#5146)

* feat: support recma plugins

* chore: add `test:match` to MDX

* chore: changeset

* docs: add recmaPlugins to README

* removes default content-visibility styles from image components (#5180)

* wip: check renderContent works

* nit: injectDelayedAssetPlugin doesn't need enforce

* feat: render content with generated entries

* feat: renderContent style injection POC

* wip: scrappy renderContent binding

* deps: parse-imports

* feat: only bind renderContent when imported

* feat: new-and-improved render-content

* fix: update example to use render-content

* refactor: extract normalizeFilename helper

* feat: move renderContent to `.astro`

* feat: add `getStaticPaths` demo 👀

* chore: remove console log

* refactor: internals -> internal

* fix: style bleed on dynamic routes

* chore: remove console log

* refactor: move rendercontentmap inside same file

* fix: style bleed in dev!

* feat: clean up example

* refactor: curry generateContent

* nit: add datetime demo

* refactor: rename and move content plugins

* feat: granular content updates in development

* chore: console.log

* refactor: move write logic, fix edge cases

* fix: use z.any() when ~schema is missing

* refactor: clean up logging

* fix: add delayed asset flag to render map

* fix: use new server loader

* chore: import type

* fix: split delayed assets to separate chunks

* chore: bad merge changesets

* feat: rework content map to Vite globs

* fix: formatted errors

* fix: get `renderContent` working with new APIs

* refactor: rename to getCollection, getEntry, renderEntry

* feat: streamline type alias!

* fix: check schema import is an import

* refactor: change ~schema -> index with defineCollection

* feat: auto apply env.d.ts reference

* feat: expose `headings` on `renderEntry`

* refactor: expose zod from astro/zod

* feat: add Collection util type

* refactor: generated types in src/content/

* edit: remove env.d.ts change from with-content

* feat: collectionToPaths utility

* refactor: migrate `examples/blog`

* refactor: simplify [...slug]

* fix: invalid date

* fix: renderEntry

* feat: migrate examples/docs to content!

* refactor: union -> enum

* fix: remove duplicate header

* chore: changeset

* Revert "fix: serialize route pattern for Netlify edge"

This reverts commit ac46a0d323.

* fix: lint

* fix: include zod in package files

* chore: push type gen for astro check

* feat: move to single defineCollections file

* feat: move examples to new collections model

* chore: type check valid collection names

* fix: ignore collections path in err logs

* refactor: content/index -> content/config

* refactor: defineCollections -> defineCollection

* fix: update docs to defineCollection

* chore: update with-content to new `astro:content` setup

* fix: renderEntry styles

* fix: bad Collection type

* fix: blog types generated

* feat: expose injectedFrontmatter on renderEntry

* chore: `import type`

* chore: add MDX to changeset

* fix: template package file

* fix: unneeded log on content config change

* chore: add `injectedFrontmatter` to generated types

* fix: escape import.meta.env in `body`

* fix: escape import.meta.env in frontmatter

* chore: unused import

* fix: use URL for config pathname

* feat: allow zod async transforms

* deps: devalue

* feat: custom slugs + better type checking

* fix: update types on config added or removed

* chore: add error msg for MDX preview release

* refactor: restore old normalizeFilename

* fix: add loadContentConfig error classes back

* Add initial tests for renderEntry

* add fixture tests

* Use head propagation APIs in renderEntry

* chore: new type gen

* fix: sort content keys before writing

* fix: avoid writing '.' collection with warning

* chore: docs types generated

* fix: generated types only once in build

* fix: use relative path to config for git

* chore: update generated types

* fix: glob pattern on valid exts

* feat: warn on possible collection typos

* chore: better error on bad lazy import

* fix: clear gray-matter cache for rawData

* fix: wait for config file while generating

* test: get collection and get entry basic

* test: multiple collections and entries

* test: add publishedDate test on entry

* tests: getStaticPaths integration

* test: ssr endpoint integration

* chore: consistent test names

* refactor: simplify generates... test

* chore: tests lockfile

* feat: add `experimental` flag

* chore: revert blog and docs examples

* chore: add experimental flag to with-content

* refactor: reuse contentFileExts

* refactor: make contentCollectionCss required

* chore: remove parse-imports dependency

* chore: remove unresolved idea redundancy

* chore: update changeset to minor v

* chore: clean up with-content pass 1

* refactor: de-monolith vite-plugin-content

* chore: remove maximum jank warning (it's acceptable jank)

* refactor: extract types-generator to separate file

* refactor: onEvent -> handleEvent

* edit: change content log to "types generated"

* fix: more experimental checks in prod build

* refactor: 2 jsToTreeNode calls -> 1

* feat: change with-content example to blog example

* fix: Content component type

* Fix use of renderEntry within a slot

* fix: warn for non-underscore _ files, refine logs

* chore: Content type in tests

* fix: types no updating with config changes

* fix: remove `result: SSRResult` type

* chore: entry var shadowing

* fix: bad experimental flag call

* wip: skip render entry tests

* fix: path resolution for .relative on windows

* chore: remove dead code

* wip: log entryPath into

* fix: use URL for entry

* refactor: getEntryInfo normalization

* refactor: move debounce to queueEvent only

* fix: resolve loader on config error

* fix: pathToFileURL -> new URL

* fix: dangerous pathname comparison

* refactor: move rawEvent -> event mapping to queueEvent

* fix: bad type

* wip: remove mkdir call

* wip: log content paths

* fix: more bad paths

* wip: more logs

* fix: correct glob path

* fix: normalize virtual mod path

* fix: content server file paths

* chore: remove render entry test skip

* wip: skip renderEntry tests (windows issues?)

* chore: remove console log

* feat: renderEntry -> render

* chore: add `--experimental-content-collections`

* refactor: only skip renderEntry tests on windows

* refactor: index.ts barrel export

* fix: cli type error

* fix: proper test skip on windows

* refactor: remove collectionToPaths :(

* refactor: use AstroError for frontmatter error

* nit: its schema, .*

* fix: bad isWindows import

* fix: await mod -> mod = await

Co-authored-by: Juan Martín Seery <me@juanm04.com>
Co-authored-by: 花果山大圣 <316783812@qq.com>
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: bholmesdev <bholmesdev@gmail.com>
2022-12-16 14:19:53 -05:00
Nate Moore
d2960984c5
Experimental Prerender API (#5297)
* wip: hybrid output

* wip: hybrid output mvp

* refactor: move hybrid => server

* wip: hybrid support for `output: 'server'`

* feat(hybrid): overwrite static files

* fix: update static build

* feat(hybrid): skip page generation if no static entrypoints

* feat: migrate from hybrid output => prerender flag

* fix: appease typescript

* fix: appease typescript

* fix: appease typescript

* fix: appease typescript

* fix: improve static cleanup

* attempt: avoid preprocess scanning

* hack: force generated .js files to be treated as ESM

* better handling for astro metadata

* fix: update scanner plugin

* fix: page name bug

* fix: keep ssr false when generating pages

* fix: force output to be treated as ESM

* fix: client output should respect buildConfig

* fix: ensure outDir is always created

* fix: do not replace files with noop

* fix(netlify): add support for `experimental_prerender` pages

* feat: switch to `experimental_prerender`

* chore: update es-module-lexer code in test

* feat: improved code-splitting, cleanup

* feat: move prerender behind flag

* test: prerender

* test: update prerender test

* chore: update lockfile

* fix: only match `.html` files when resolving assets

* chore: update changeset

* chore: remove ESM hack

* chore: allow `--experimental-prerender` flag, move `--experimental-error-overlay` into subobject

* chore: update changeset

* test(vite-plugin-scanner): add proper unit tests for vite-plugin-scanner

* chore: remove leftover code

* chore: add comment on cleanup task

* refactor: move manual chunks logic to vite-plugin-prerender

* fix: do not support let declarations

* test: add var test

* refactor: prefer existing util

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/core/errors/errors-data.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2022-12-16 10:38:37 -06:00
董雨航
2c2c65297a
upgrade giget for support proxy config (#5579) 2022-12-14 13:08:44 -06:00
Ryosuke Iwanaga
dced4a8a26
Add server.headers option (#5564)
With this new `server.headers` option, the users can specify
custom headers for `astro dev` and `astro preview` servers.

This is useful when they want to build a website requiring
specific response headers such as `Cross-Origin-Opener-Policy`.
2022-12-14 10:26:42 -05:00
Fred K. Bot
8913c51e1a
[ci] release (#5605)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-14 10:23:50 -05:00
Fred K. Bot
d7da0996b6
[ci] release (#5597)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-13 10:29:40 -05:00
Fred K. Bot
a219c41319
[ci] release (#5561)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-12 10:22:39 -05:00
Martin J
2bd23e454f
Updated magic-string to 0.27.0 (#5577) 2022-12-10 23:10:52 +08:00
Nate Moore
02bb0a1ccd
Update compiler (#5554)
* chore: update compiler

* chore: add changeset

Co-authored-by: Nate Moore <nate@astro.build>
2022-12-08 14:08:13 -06:00
Fred K. Bot
50cb99003a
[ci] release (#5544)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-12-08 09:12:10 -05:00