* feat(integrations): support optional integrations
By making integration optional, Astro can now ignore null or undefined Integrations instead of giving an internal error most devs can't read/won't understand.
This also enables optional integrations,
e.g.
```ts
integration: [
// Only run `compress` integration in production environments, etc...
import.meta.env.production ? compress() : null
]
```
* ci: add tests for optional integration
* docs: add changelog
* Astro.site should be defaulted to localhost
* test: verify Astro.site default value
* chore: add changeset
* test: matching a URL regex to ignore specific port numbers
* vite-astro-plugin should ignore unresolved relative imports
* test: add error test for unresolved imports
* chore: add changeset
* moving the test to it's own describe
* chore: cleaning up the test's dev server
* TEMP: skipping the old test again to see if that's breaking CI
* test: verifying the dev server recovers
* TEMP: is it the new test breaking ubuntu CI?
* testing whether the errors suite only handles one test case in ubuntu
* disabling the Errors suite on linux for now to avoid reliability issues
* Fix importing CSS packages in frontmatter
* Formatting
* Only update if the source code contains the import
* Consolidate the two plugins
* we do need a pre and a post
* Adds a changeset
* feat: improve HMR handling for styles, persisted islands
* Also using data-persist to keep injected <style>'s during HMR
* Updating E2E tests to validate that .astro HMR doesn't blow away component styles
* chore: add changeset
* copy/paste error when cleaning up tests
* big change - using inline <style> blocks instead of <link>s in dev
* Updating tests that were expecting <link> stylesheets in dev
* updating all E2E tests to use workspace versions for astro deps
* TEMP: adding debug logging to see why the Ubuntu test only fails in CI
* fix: Svelte styles are automatically handled by Vite, we can skip them in dev
* fix: svelte is more interesting, we need Astro to inject styles only until hydration
* avoiding extra HMTL noise by only including the data-astro-injected URL for svelte components
* TEMP: ubuntu CI doesn't like the svelte HMR test...
* disabling the svelte component test on ubuntu for now
Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com>
* chore: fix typo in remark tests
* test: add test cases for markdown expressions in header
* fix: avoid evaluating JSX-like expressions inside inline code in heading
* fix: generate slug for id including values in backtick blocks
* fix: remove source map consumption from babel transform
* refactor: move inputSourceMap to integration option
* tests: add newline ex to test build and dev
* chore: change back to babel.transformAsync
* chore: changeset
* WIP: the leading /@fs broke script HMR
* Revert "WIP: the leading /@fs broke script HMR"
This reverts commit 84fce366268033261369aed48f909e59e78bf3e4.
* Metadata needs to strip off /@fs from hoisted script URLs
* adding a test for hoisted script HMR support
* removing 2 second timeout on navigation, allow default 30 seconds
* simplifying the hoisted script test sync
* TEMP: bubbling up console logs to track down windows failure
* removing temp logging
* disabling the test on windows for now
* chore: adding changeset
* feat: add rawContent obj with html helper
* refactor: change toString to function call
* test: rawContent helpers
* chore: update MarkdownInstance type
* refactor: parseHtml -> html
* chore: changeset
* fix: remove needless async heading on content version
* fix: fixLineEndings helper on unit tests
* refactor: change api to raw and compiled
* chore: add new type to env.d.ts
* docs: JSdocs for raw and compiled
* refactor: change API AGAIN to rawContent, compiledContent
* chore: update changeset
* Fix VITE_ASSET bug
* Updated test that depended on esbuild output
* Fix some more tests
* Fix css config and postcss tests
* Git client only working
* Fix static build test
* Update tailwind tests
* Fix build
* Fix css bundling tests
* Updated some more tests for windows
* Remove tests that are no longer relevant
* Cause it to break
* Fix bug and add explanation
* Adds a changeset
* Inline comments about what the hashing is doing
* Update packages/astro/src/vite-plugin-build-css/index.ts
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
* Update to the lockfile
* Minify css
* Update tailwind tests
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
* feat: use internal MDX tooling for markdown + components
* fix: improve MD + component tests
* chore: add changeset
* fix: make tsc happy
* fix(#3319): add regression test for component children
* fix(markdown): support HTML comments in markdown
* fix(#2474): ensure namespaced components are properly handled in markdown pages
* fix(#3220): ensure html in markdown pages does not have extra surrounding space
* fix(#3264): ensure that remark files pass in file information
* fix(#3254): enable experimentalStaticExtraction for `.md` pages
* fix: revert parsing change
* fix: remove `markdown.mode` option
* WIP: proof of concept fix to use absolute paths
* correct fix to handle absolute paths and config.base
* adding tests for hydration scripts with config.base
* chore: add changeset
* fix: ensure posix paths are used for Windows compat
* adding Tailwind E2E tests with Playwright
* package.json updates
* adding e2e tests to CI workflow
* using e2e for dev tests, mocha for build tests
* refactor: sharing test-utils helpers
* chore: update lockfile
* Adding contributing docs
* Revert "refactor: sharing test-utils helpers"
This reverts commit 48496f43bc99eab30747baf6e83041ba4932e786.
* refactor: simpler solution to resolving e2e test fixtures
* chore: updating lockfile
* refactor: cleaning up how URLs are resolved in e2e tests
* install playwright deps in CI
* ensure playwright deps are installed during CI
* adding a basic HMR test for tailwind styles
* using @e2e for playwright test packages
* adding react hydration and HMR tests
* adding hydration and HMR tests for preact
* adding svelte hydration and HMR tests
* adding solid-js hydration and HMR tests
* adding solid hydration and HMR tests
* adding vue hydration and HMR tests
* adding client:media tests
* fixing Lit hydration and HMR tests
* fixing up the Vue e2e tests
* fixing up svelte tests
* chore: test cleanup
* chore: cleaning up test element IDs
* chore: updating lock file
* chore: update lockfile after merge
* TEMP: disabling React e2e tests
* Revert "TEMP: disabling React e2e tests"
This reverts commit ed1bad9cbc.
* updating to use the new editFiles helper
* chore: updating lock file
* updating lock file
* updating lockfile
* TEMP: watching for console logs
* TEMP: testing typescript tests
* updating test:e2e scripts for config file
* seems like it didn't find the config file?
* use a fresh dev server for each test
* removing Lit tests for now
* Revert "removing Lit tests for now"
This reverts commit 4970a8093e.
* updating test config for CI
* WIP: disabling HMR tests to track down why they're unreliable
* TEMP: logging to debug HMR test
* afterEach isn't a global in Playwright
* fix: the test's file reset helper was using a URL not filepath
* one last try, why is the HMR test hanging at cleanup?
* resetting files after tailwind HMR test
* create the onNextChange watcher before editFile is called
* moving the file changed sync into editFile()
* code refactor + Astro Component HMR test
* chore: lint fixes
* adding a test suite for the framework-multiple example app
* refactor: make node-fetch external in rollup build
* deps: make node-fetch standard dep
* refactor: switch to node-fetch pkg ref in fetch.ts
* chore: changeset
* chore: bump webapi to minor change
* only trim /1 from canonical URLs for paginate() routes
* chore: fixing eslint warning
* chore: add changeset
* typo: copy paste error
* adding a test validation error message
* verifying canonical for all three test routes
* TEMP: extra test logging to track down the failure
* TEMP: additional test logging to see what the failing CLI messages are
* TEMP: digging deeper, it's getting stuck on port 3000 is taken
* TEMP: why is it breaking when LOCAL isn't logged?
* TEMP: still digging, strange how consistent this failure is
* finally found it - the new test wasn't closing the dev server...
* WIP: have a few test failures to track down
* WIP: still a few failures to fix
* WIP: fixes the issue of dynamic routes stepping on static routes
* Resolve route priority before building routes for `getStaticPaths()`
* chore: adding comments explaining why this filter is needed
* chore: adding changeset
* got too fancy with the test suite, these routes weren't valid
* simplifying the test cases
* TEMP: is this test breaking my CI run?
* Revert "TEMP: is this test breaking my CI run?"
This reverts commit 291af2a1b6f075ebfc74002886e43110731b3e1b.
* slots-preact didn't list @astrojs/preact as a dep
* reverting copy/paste error
* test: add with-components to astro-markdown fixture
* fix: markdown pathname with /@fs prefix
* feat: add loadMetadata helper for md
* feat: fix components in Astro.glob results!
* fix: md import path
* Revert "feat: add loadMetadata helper for md"
This reverts commit 76cf96f4be3d0e19589f84025c0131352d0b6cc8.
* fix: add back $$loadMetadata helper
* feat: add second comp framework to md test
* chore: core/render/dev lint
* chore: changeset
* fix: short circuit if mod doesn't have metadata
* fix: skip mod graph preloading in dev
* refactor: make md metadata check recursive
* refactor: extract metadata helper to util
* fix: remove unecessary mod graph query
* fix: move md import flag to util for deno bundling issue
* fix: remove 'dev' mode from test utils build
* feat: add global hashset for seen metadata
* refactor: flip Promise.all to for await for perf!
* Revert bc I was wrong! "refactor: flip Promise.all to for await for perf!"
This reverts commit da8a6873f5.
* WIP: this regex should handle .html as well
* much simpler! Just fix the req.url, don't touch the manifest
* only handle .html requests when config.build.format === 'file'
* chore: add changeset
* Allow overriding build vite config options
* Adds a changeset
* Test svelte
* Move plugins down
* Assign after for the client too
* Spread output options on manually
* Remove .only
* fix(#3309): use system default locale
* fix(#3309): use system default locale in create-astro
* test: add locale regression tests
* test: add i18n regression test
* WIP: adding test coverage
* test fixes
* moving the shared lib up a directory to reproduce the bug
* fix: transform with the module ID instead of parsing the filepath
* adding the shared lib to the workspaces list
* fix: client-only assets now get the full URL from vite
* why is this needed for windows?
* WIP: using /@fs to handle windows filepaths
* fix: remove /@fs from hoisted script imports
* nit: removing unused imports
* fix: strip off the path root when mapping client:only styles
* had to reverse the `/@fs` handling to work on windows and unix
* chore: adding comments to explain the fix
* chore: adding changeset
* Add new configKeys prop for telemetry
This property lets us known which AstroConfig keys are being used, for anonymous telemetry.
* Adds a changeset
* Restructure how the telemetry event is shaped
* Revert "Improvements to build and dev when building for subpaths (#3156)"
This reverts commit 637919c8b6.
* letting Vite handle base paths
* test updates to expect Astro.request.url to no longer include subpaths
* bringing back the fix for including subpaths in injects scripts and styles
* fixing the static-build test to handle subpaths for injected CSS
* fixing asset import URLs when using base subpaths
* chore: fixing typo in the comments
* Astro needs to manage base in dev to maintain Astro.request.url
* fix: reverting dev routing tests to expect existing behavior
* reverting Astro global test to verify existing behavior
* chore: adding changeset
* test: update static-build tests to verify the subpath is used in asset imports
* Conform to API route signature
* Rename to API route
* Update ssr test
* Update packages/astro/test/fixtures/ssr-dynamic/src/pages/api/products/[id].js
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* Adds a changeset
* Make PR review changes
Co-authored-by: Ben Holmes <hey@bholmes.dev>
* feat: add @astrojs/telemetry
* feat: add telemetry events, add queueing system
* feat(telemetry): record CLI events
* chore: add note
* feat: support generic TELEMETRY_DISABLED env var
* Fix test script
* shim telemetry in tests
* Shim telemetry in other commands
* Stub telemetry in the memory leak test
* Disable telemetry in smoke tests
* Adds a changeset
* Run the formatter
* few updates
* Include config keys
* Add shallow viteKeys array:
:
* Add vite keys and tests
Co-authored-by: Nate Moore <nate@skypack.dev>
* Consolidate inline hydration scripts into one
* Adds changeset
* Update custom element test
* Provide a better name for tracking if we have added a hydration script
* Moved types arround
* Removed `rehype-slug` in favor of our own implementation
* Changeset
* Removed rehype-slug from examples
* Remove rehype-slug from tests
* Updated reference
* rehypeCollectHeaders is a function again
* Reverted rehype-slug removes
* Re-added rehype-slug to reference
* feat: add git init step
* fix: update unit tests
* feat: simplify next steps for copy pasteability
* docs: add clarifying comment on test stdin spoofing
* docs: remove "empty" from git repo message
* fix: update git step text for test
* fix: remove redundant --dryrun flag
* refactor: simplify next steps with &&
* chore: changeset
* refactor: simplify dir error log to avoid wrapped text
* refactor: remove redundant "issue" callout
* chore: changeset
* chore: update tests for new dir log
* fix(markdown): file.url fixes
* Added tests
* Changed the default of `base` from `./` to `/`
* Make the url work with subpath
* Changeset
* Forgot to change this comparison
* updating svelte integration to allow custom user config
* test: adding a test to verify that svelte options are piped through the integration
* updating the README with docs on overridding svelte options
* chore: adding changeset
* fix: copy/paste bug in test validation
* removing temporary debug scripts
* wip: add prompt for directory with validation
* feat: wire up dir response to cwd
* feat: improve error handling on non-empty dirs
* fix: update test helpers to execaSync
* chore: add .skipped to old tests for clarity
* deps: add mocha and chai to create-astro
* feat: add directory step test with fixture
* feat: update turbo to run create-astro tests again 🥳
* chore: changeset
* `astro build` should include the `base` provided in astro config
* test: updating build test to expect the base path in links/scripts
* ignore the default "base" value when building links/scripts
* fix: handling config that provides a base but no site
* fix: config.site was being ignored since it's a URL not a string
* hack: handle base path in dev for /public assets
* fix: dev redirect needs to ignore base default of ./
* fix: extra safety checks for the base path redirect
* refactor: simplifying it to remove the regex
* one last safety check - only redirect GET and use a 302 status
* fix: lost the leading slash when redirecting
* nit: adding comments to the test explaining how base is verified
* Remove extra console.log
* Adds a changeset
Co-authored-by: unknown <matthew@skypack.dev>
* adds support for passing options to @vitejs/plugin-vue
* updating vue integration README with options details
* adding a tests for custom vue compiler options
* chore: adding changeset
* fix: replace markdown path prefix with suffix flag
* fix: avoid non-encoded colons for flag
* fix: remove needless ?
* fix: dev server load order
* fix: production build crawl dynamic imports
* fix: remove unused virtual_module_id const
* fix: remove unsafe "!" on getmodbyid
* fix: remove needless @id path check
* fix: add list of SSR-able file extensions
* docs: virtual_mod_id change
* fix: support id prefix on resolved ids
* fix: switch to ?mdImport flag to resolve glob imports
* tests: imported md styles for dev and build
* chore: changeset
* Added schemas to markdown plugin
* Added new schemas to main package
* Changesets
* typeraw
* Explaination about the weird type hack
* Added markdown.mode to config
* Added comment
* Formatted
* Moved validation to `astro` and added RemarkPlugin ad RehypePlugin
* Removed the ability to have a custom markdown renderer internally
* Fixed plugin type
* Removed unused renderMarkdownWithFrontmatter
* Added missing dependency
* Dynamically import astro markdown
* Cache import
* Fix SSR static build public file copying
* chore: update lockfile
* remove dirname and use URL constructor
* Cleanup test and actually test what it says it tests
Co-authored-by: Nate Moore <nate@skypack.dev>
* fix(#2987): relative config handling with `--config` flag
* test: fix tests
* fix: improve config test for failure case
* fix: test on windows?
* fix: test on windows?
* So This works 😎
* need to add to the cli next
* Renamed Files and Export
Applied creditation to where I found the
'inspiration' for this application.
* applied `astro docs` to cli
* Trying to add to CLI,
Not working 🤷♂️
* Converted into async method,
* 🎆🎆 It works!!! 🥳🎉🥳
Embarrasing as it is I totally missed the part where logic was to be in.
* Moved `docs` cmd to `supportedCommands`
* refactor: cleanup docs command
* chore: add changeset
* chore: rename browser to open
Co-authored-by: Nate Moore <nate@skypack.dev>
* feat: human-readable error on bad site or base
* fix: human-readable error should have 1 config option
* docs: update README
* chore: changeset
* docs: mention localhost for testing via netlify CLI