Skip to content

Latest commit

 

History

History
1051 lines (610 loc) · 75.1 KB

CHANGELOG.md

File metadata and controls

1051 lines (610 loc) · 75.1 KB

astro

1.6.14

Patch Changes

1.6.13

Patch Changes

1.6.12

Patch Changes

1.6.11

Patch Changes

1.6.10

Patch Changes

1.6.9

Patch Changes

1.6.8

Patch Changes

1.6.7

Patch Changes

1.6.6

Patch Changes

1.6.5

Patch Changes

1.6.4

Patch Changes

  • #5290 b2b291d29 Thanks @matthewp! - Handle base configuration in adapters

    This allows adapters to correctly handle base configuration. Internally Astro now matches routes when the URL includes the base.

    Adapters now also have access to the removeBase method which will remove the base from a pathname. This is useful to look up files for static assets.

  • #5292 97e2b6ad7 Thanks @MontelAle! - Changes slow astro cli imports to dynamic

  • #5293 4af4d8fa0 Thanks @matthewp! - Prevent overcaching .astro HMR changes

  • #5314 f6add3924 Thanks @matthewp! - Fixes regression with config file restarts

  • #5298 247eb7411 Thanks @wulinsheng123! - have not founded style when srcDir was root

1.6.3

Patch Changes

  • #5273 c7b9b14a1 Thanks @matthewp! - Surface astro.config errors to the user

  • #5264 0d27c4a2b Thanks @VladCuciureanu! - Fixed memleak caused by project dir names containing '.md' or '.mdx'

  • #5258 74759cf78 Thanks @bluwy! - Allow 200 response for endpoints in build

  • #5284 126cd8e83 Thanks @herteleo! - Include missing class:list within HTMLAttributes type

  • #5236 1cc067052 Thanks @bluwy! - Refactor CSS preprocessing handling

  • #5198 c77a6cbe3 Thanks @matthewp! - HMR - Improved error recovery

    This improves error recovery for HMR. Now when the dev server finds itself in an error state (because a route contained an error), it will recover from that state and refresh the page when the user has corrected the mistake.

1.6.2

Patch Changes

1.6.1

Patch Changes

1.6.0

Minor Changes

  • #5147 0bf0758fb Thanks @natemoo-re! - Add astro/types entrypoint. These utilities can be used for common prop type patterns.

    HTMLAttributes

    If you would like to extend valid HTML attributes for a given HTML element, you may use the provided HTMLAttributes type—it accepts an element name and returns the valid HTML attributes for that element name.

    import { HTMLAttributes } from 'astro/types';
    interface Props extends HTMLAttributes<'a'> {
      myProp?: string;
    }
  • #5164 4a8a346ca Thanks @MoustaphaDev! - Add support for markdown files with the following extensions:

    • .markdown
    • .mdown
    • .mkdn
    • .mkd
    • .mdwn
  • #4917 ddf2f8390 Thanks @natemoo-re! - Add support for --base CLI argument, which will override the base set in your astro.config.mjs file.

    astro --site https://astro.build --base /docs
    

Patch Changes

1.5.3

Patch Changes

  • #5133 1c477dd8d Thanks @bluwy! - Fix .css?raw usage

  • #5133 1c477dd8d Thanks @bluwy! - Update @astrojs/compiler and use the new resolvePath option. This allows removing much of the runtime code, which should improve rendering performance for Astro and MDX pages.

  • #5192 8728ee0b9 Thanks @tony-sull! - astro add no longer automatically installs optional peer dependencies

1.5.2

Patch Changes

1.5.1

Patch Changes

1.5.0

Minor Changes

  • #5056 e55af8a23 Thanks @matthewp! - # Adapter support for astro preview

    Adapters are now about to support the astro preview command via a new integration option. The Node.js adapter @astrojs/node is the first of the built-in adapters to gain support for this. What this means is that if you are using @astrojs/node you can new preview your SSR app by running:

    npm run preview

    Adapter API

    We will be updating the other first party Astro adapters to support preview over time. Adapters can opt-in to this feature by providing the previewEntrypoint via the setAdapter function in astro:config:done hook. The Node.js adapter's code looks like this:

    export default function() {
      return {
    		name: '@astrojs/node',
    		hooks: {
    			'astro:config:done': ({ setAdapter, config }) => {
            setAdapter({
              name: '@astrojs/node',
              serverEntrypoint: '@astrojs/node/server.js',
    +          previewEntrypoint: '@astrojs/node/preview.js',
              exports: ['handler'],
            });
    
            // more here
          }
        }
      };
    }

    The previewEntrypoint is a module in the adapter's package that is a Node.js script. This script is run when astro preview is run and is charged with starting up the built server. See the Node.js implementation in @astrojs/node to see how that is implemented.

  • #4986 ebd364e39 Thanks @bluwy! - ## New properties for API routes

    In API routes, you can now get the site, generator, url, clientAddress, props, and redirect fields on the APIContext, which is the first parameter passed to an API route. This was done to make the APIContext more closely align with the Astro global in .astro pages.

    For example, here's how you might use the clientAddress, which is the user's IP address, to selectively allow users.

    export function post({ clientAddress, request, redirect }) {
      if (!allowList.has(clientAddress)) {
        return redirect('/not-allowed');
      }
    }

    Check out the docs for more information on the newly available fields: https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes

  • #4959 0ea6187f9 Thanks @Princesseuh! - Added support for updating TypeScript settings automatically when using astro add

    The astro add command will now automatically update your tsconfig.json with the proper TypeScript settings needed for the chosen frameworks.

    For instance, typing astro add solid will update your tsconfig.json with the following settings, per Solid's TypeScript guide:

    {
      "compilerOptions": {
        "jsx": "preserve",
        "jsxImportSource": "solid-js"
      }
    }
  • #4947 a5e3ecc80 Thanks @JuanM04! - - Added isRestart and addWatchFile to integration step isRestart.

    • Restart dev server automatically when tsconfig changes.
  • #4986 ebd364e39 Thanks @bluwy! - ## Support passing a custom status code for Astro.redirect

    New in this minor is the ability to pass a status code to Astro.redirect. By default it uses 302 but now you can pass another code as the second argument:

    ---
    // This page was moved
    return Astro.redirect('/posts/new-post-name', 301);
    ---
  • #5056 e55af8a23 Thanks @matthewp! - # New build configuration

    The ability to customize SSR build configuration more granularly is now available in Astro. You can now customize the output folder for server (the server code for SSR), client (your client-side JavaScript and assets), and serverEntry (the name of the entrypoint server module). Here are the defaults:

    import { defineConfig } from 'astro/config';
    
    export default defineConfig({
      output: 'server',
      build: {
        server: './dist/server/',
        client: './dist/client/',
        serverEntry: 'entry.mjs',
      },
    });

    These new configuration options are only supported in SSR mode and are ignored when building to SSG (a static site).

    Integration hook change

    The integration hook astro:build:start includes a param buildConfig which includes all of these same options. You can continue to use this param in Astro 1.x, but it is deprecated in favor of the new build.config options. All of the built-in adapters have been updated to the new format. If you have an integration that depends on this param we suggest upgrading to do this instead:

    export default function myIntegration() {
      return {
        name: 'my-integration',
        hooks: {
          'astro:config:setup': ({ updateConfig }) => {
            updateConfig({
              build: {
                server: '...',
              },
            });
          },
        },
      };
    }

Patch Changes

  • #5057 baf88ee9e Thanks @bluwy! - Skip JSX tagging for export statements with source

  • #5044 44ea0c6d9 Thanks @JuanM04! - Upgrade Astro compiler to 0.27.1

  • #5059 f7fcdfe62 Thanks @bluwy! - Support strict dependency install for libraries with JSX

  • #5047 1e2799243 Thanks @matthewp! - Update Astro.cookies.set types to allow booleans and numbers

    Note that booleans and numbers were already allowed, they just were not allowed by the type definitions.

1.4.7

Patch Changes

  • #5035 d7bfb144b Thanks @AirBorne04! - preventing multiple doctype injection into html documents

  • #5015 b1964e9e1 Thanks @matthewp! - Shared state in Preact components with signals

    This makes it possible to share client state between Preact islands via signals.

    For example, you can create a signals in an Astro component and then pass it to multiple islands:

    ---
    // Component Imports
    import Counter from '../components/Counter';
    import { signal } from '@preact/signals';
    const count = signal(0);
    ---
    
    <Count count={count} />
    <Count count={count} />
  • #5036 38fdb4ca6 Thanks @matthewp! - New algorithm for shorter CSS bundle names

1.4.6

Patch Changes

1.4.5

Patch Changes

1.4.4

Patch Changes

  • #4967 e6a881081 Thanks @matthewp! - Final perf fix from 1.3.0 regression

    A regression in rendering perf happened in 1.3.0. This is the final fix for the underlying issue.

1.4.3

Patch Changes

1.4.2

Patch Changes

1.4.1

Patch Changes

1.4.0

Minor Changes

  • #4907 01c1aaa00 Thanks @matthewp! - Order Astro styles last, to override imported styles

    This fixes CSS ordering so that imported styles are placed higher than page/component level styles. This means that if you do:

    ---
    import '../styles/global.css';
    ---
    
    <style>
      body {
        background: limegreen;
      }
    </style>

    The <style> defined in this component will be placed below the imported CSS. When compiled for production this will result in something like this:

    /* /src/styles/global.css */
    body {
      background: blue;
    }
    
    /* /src/pages/index.astro */
    body:where(.astro-12345) {
      background: limegreen;
    }

    Given Astro's 0-specificity hashing, this change effectively makes it so that Astro styles "win" when they have the same specificity as global styles.

  • #4876 d3091f89e Thanks @matthewp! - Adds the Astro.cookies API

    Astro.cookies is a new API for manipulating cookies in Astro components and API routes.

    In Astro components, the new Astro.cookies object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (has):

    ---
    type Prefs = {
      darkMode: boolean;
    };
    
    Astro.cookies.set<Prefs>(
      'prefs',
      { darkMode: true },
      {
        expires: '1 month',
      }
    );
    
    const prefs = Astro.cookies.get<Prefs>('prefs').json();
    ---
    
    <body data-theme={prefs.darkMode ? 'dark' : 'light'}></body>

    Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response.

    This API is also available with the same functionality in API routes:

    export function post({ cookies }) {
      cookies.set('loggedIn', false);
    
      return new Response(null, {
        status: 302,
        headers: {
          Location: '/login',
        },
      });
    }

    See the RFC to learn more.

Patch Changes

1.3.1

Patch Changes

1.3.0

Minor Changes

  • #4775 b0cc93996 Thanks @tony-sull! - Adds a new "astro:build:generated" hook that runs after SSG builds finish but before build artifacts are cleaned up. This is a very specific use case, "astro:build:done" is probably what you're looking for.

  • #4669 a961aa3c2 Thanks @aggre! - astro-island now correctly passes Uint8Array/Uint16Array/Uint32Array

  • #4832 73f215df7 Thanks @matthewp! - Allows Responses to be passed to set:html

    This expands the abilities of set:html to ultimate service this use-case:

    <div set:html={fetch('/legacy-post.html')} />

    This means you can take a legacy app that has been statically generated to HTML and directly consume that HTML within your templates. As is always the case with set:html, this should only be used on trusted content.

    To make this possible, you can also pass several other types into set:html now:

    • Response objects, since that is what fetch() returns:
      <div
        set:html={new Response('<span>Hello world</span>', {
          headers: { 'content-type': 'text/html' },
        })}
      />
    • ReadableStreams:
      <div
        set:html={new ReadableStream({
          start(controller) {
            controller.enqueue(`<span>read me</span>`);
            controller.close();
          },
        })}
      />
    • AsyncIterables:
      <div
        set:html={(async function* () {
          for await (const num of [1, 2, 3, 4, 5]) {
            yield `<li>${num}</li>`;
          }
        })()}
      />
    • Iterables (non-async):
      <div
        set:html={(function* () {
          for (const num of [1, 2, 3, 4, 5]) {
            yield `<li>${num}</li>`;
          }
        })()}
      />

Patch Changes

1.2.8

Patch Changes

1.2.7

Patch Changes

1.2.6

Patch Changes

1.2.5

Patch Changes

1.2.4

Patch Changes

1.2.3

Patch Changes

1.2.2

Patch Changes

1.2.1

Patch Changes

1.2.0

Minor Changes

  • #4682 d1e695914 Thanks @bholmesdev! - astro add - move configuration updates to final step

  • #4549 255636cc7 Thanks @altano! - Allow specifying custom encoding when using a non-html route. Only option before was 'utf-8' and now that is just the default.

  • #4578 c706d845e Thanks @bholmesdev! - Restart dev server when config file is added, updated, or removed

Patch Changes

1.1.8

Patch Changes

1.1.7

Patch Changes

1.1.6

Patch Changes

1.1.5

Patch Changes

1.1.4

Patch Changes

1.1.3

Patch Changes

  • #4574 b92c24f40 Thanks @delucis! - Update astro add to list official integrations & adapters with same organisation we use in docs

1.1.2

Patch Changes

1.1.1

Patch Changes

1.1.0

Minor Changes

  • #4423 d4cd7a59f Thanks @bholmesdev! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment

Patch Changes

  • #4497 78e06c8ec Thanks @bholmesdev! - Production build logging - Only log [code].html instead of [code]/index.html for 404 and 500 routes

  • Updated dependencies [ac0321824, 839097c84]:

    • @astrojs/markdown-remark@1.1.0

1.1.0-next.0

Minor Changes

  • #4423 d4cd7a59f Thanks @bholmesdev! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment

Patch Changes

1.0.9

Patch Changes

1.0.8

Patch Changes

  • #4385 8164fa6f1 Thanks @krolebord! - Fix warning when using hooks inside the react components not exported as a function declaration
  • #4446 27ac6a03a Thanks @matthewp! - Deterministic CSS ordering

    This makes our CSS link order deterministic. It uses CSS depth; that is how deeply a module import the CSS comes from, in order to determine which CSS is page-level vs. component-level CSS.

    This is intended to match dev ordering where, because we do not bundle, the page-level CSS always comes after component-level.

1.0.7

Patch Changes

1.0.6

Patch Changes

1.0.5

Patch Changes

  • #4302 1d3a0a16f Thanks @FredKSchott! - Revert "Ensure hydration scripts inside of slots render ASAP (#4288)" to fix Svelte integration bug

1.0.4

Patch Changes

  • #4268 f7afdb889 Thanks @bholmesdev! - Align MD with MDX on layout props and "glob" import results:
    • Add Content to MDX
    • Add file and url to MDX frontmatter (layout import only)
    • Update glob types to reflect differences (lack of rawContent and compiledContent)

1.0.3

Patch Changes

1.0.2

Patch Changes

1.0.1

Patch Changes

1.0.0

Astro v1.0 is out! Read the official announcement post.

Note If you need help migrating an existing Astro project to the new Astro v1.0, check out our updated Migration Guide and full documentation website.

0.X

For older changelog entries -- including all v0.X, v1.0 Beta, and v1.0 Release Candidate versions -- check out the v0.X changelog.