PackageTrack

npm · #4525 most downloaded on npm

@astrojs/compiler

4.0.0withastro/compiler

Astro’s [Go](https://golang.org/) + WASM compiler.

Release timeline

373 releases since 2021
20222023202420252026

Releases

  1. 4.0.027 Apr 2026
    Release notes

    Major Changes

    • a0a1082: Calling templateEnter / templateExit when emitting <template>

    Minor Changes

    • 51c38ef: Expand compact option to support JSX-style whitespace stripping
    Open source →
  2. 3.0.116 Mar 2026
    Release notes

    Patch Changes

    • 05ef961: Fix scoped CSS nesting so descendant selectors without & inside nested rules are not incorrectly re-scoped.
    Open source →
  3. 3.0.06 Mar 2026
    Release notes

    Major Changes

    • c05e16e: Removes the first argument of $$result.createAstro()

      $$result.createAstro() does not accept an AstroGlobalPartial as the first argument anymore:

      -const Astro = $$result.createAstro($$Astro, $$props, $$slots);
      +const Astro = $$result.createAstro($$props, $$slots);
      
    • c05e16e: Removes renderScript from TransformOptions. It is now the default and only behavior

    • c05e16e: Removes experimentalScriptOrder from TransformOptions. It is now the default and only behavior

    Patch Changes

    • 811e90f: Fixes an issue where server:defer was treated like a transition directive, causing ViewTransitions CSS to be included even when no transition:* directives were used.

    • 755f046: Fixes a CSS scoping regression where selectors using the nesting selector (&) with pseudo-classes or pseudo-elements (e.g. &:last-of-type, &::before) inside :global() contexts would incorrectly receive a duplicate scope attribute.

    • f89451a: Fixed an issue where explicit <html> and <head> tags were removed from output when a JSX comment appeared between DOCTYPE and the <html> tag.

    • 8275bdd: Fixes a bug where trailing whitespaces were preserved before <style> tags after transformation, in certain cases. Now trailing whitespaces are correctly removed.

    • 56ef0ca: Fixes TSX output to transform top-level returns into throws in order to avoid downstream TypeScript parsing issues

    • e329d20: Fix slot attribute stripped inside expression

    • 02de370: fixed a bug where the Astro compiler incorrectly handled the 'as' property name in Props interfaces.

      This allows Astro components to use 'as' as a prop name (common pattern for polymorphic components) without breaking TypeScript type inference. The Props type is now correctly preserved when destructuring objects with an 'as' property.

    • 615eb21: Fix CSS nesting so nested selectors without an ampersand are parsed and scoped correctly.

    Open source →
  4. 3.0.0-beta.117 Feb 2026pre-release
    Release notes

    Patch Changes

    • 755f046: Fixes a CSS scoping regression where selectors using the nesting selector (&) with pseudo-classes or pseudo-elements (e.g. &:last-of-type, &::before) inside :global() contexts would incorrectly receive a duplicate scope attribute.
    • f89451a: Fixed an issue where explicit <html> and <head> tags were removed from output when a JSX comment appeared between DOCTYPE and the <html> tag.
    • 8275bdd: Fixes a bug where trailing whitespaces were preserved before <style> tags after transformation, in certain cases. Now trailing whitespaces are correctly removed.
    • e329d20: Fix slot attribute stripped inside expression
    • 615eb21: Fix CSS nesting so nested selectors without an ampersand are parsed and scoped correctly.
    Open source →
  5. 3.0.0-beta.05 Feb 2026pre-release
    Release notes

    Major Changes

    • c05e16e: Removes the first argument of $$result.createAstro()

      $$result.createAstro() does not accept an AstroGlobalPartial as the first argument anymore:

      -const Astro = $$result.createAstro($$Astro, $$props, $$slots);
      +const Astro = $$result.createAstro($$props, $$slots);
      
    • c05e16e: Removes renderScript from TransformOptions. It is now the default and only behavior

    • c05e16e: Removes experimentalScriptOrder from TransformOptions. It is now the default and only behavior

    Open source →
  6. 2.13.15 Feb 2026
    Release notes

    Patch Changes

    • 357b8fe: Fixes a panic when parsing files with a closing frontmatter fence (---) but no opening fence. The compiler now returns a helpful diagnostic error instead of crashing.
    • cba568f: Fixes the "Unterminated string literal" error when using multiline attribute values on components.
    Open source →
  7. 2.13.015 Sept 2025
    Release notes

    Minor Changes

    • 59f77593: Support HTML <selectedcontent> element

      Based on the recent commit history, this change appears to be related to fixing issue #1093 regarding selectedcontent parsing in customizable selects. The <selectedcontent> element is part of the new Customizable Select Element API in HTML, used within <selectlist> elements to display the currently selected option(s).

    • 89c80fee: Adds a walkAsync utility function that returns a Promise from the tree traversal process.

      Unlike the existing walk function which doesn't provide a way to wait for traversal completion, walkAsync allows consumers to await the full traversal of the AST.

    Patch Changes

    • 2a27aca7: Fixes a potential parsing issue with head content defined in a component where another component is rendered first.
    • 1264286c: Fixes a CSS scoping issue when a selector contains only pseudo selectors.
    Open source →
  8. 2.12.29 Jun 2025
    Release notes

    Patch Changes

    • 950635e: Reverts a change where view transitions were made async to accomodate the CSP requirements.
    Open source →
  9. 2.12.17 Jun 2025
    Release notes

    Patch Changes

    • 138c07f: Improves detection of function body opening curly brace for exported functions.
    • 4a967ab: Fixes a bug where view transition names got lost after update to Astro 5.9
    Open source →
  10. 2.12.01 May 2025
    Release notes

    Minor Changes

    • e428ae0: Add head propagation metadata to server islands
    Open source →
  11. 2.11.012 Mar 2025
    Release notes

    Minor Changes

    • 0399d55: Add an experimental flag experimentalScriptOrder that corrects the order styles & scripts are rendered within a component. When enabled, the order styles & scripts are rendered will be consistent with the order they are defined.

    Patch Changes

    • c758d7e: Add async properly when await used inside fragment
    Open source →
  12. 2.10.48 Feb 2025
    Release notes

    Patch Changes

    • 8cae811: Fixes an issue with the conditional rendering of scripts.

      This change updates a v5.0 breaking change when experimental.directRenderScript became the default script handling behavior. If you have already successfully upgraded to Astro v5, you may need to review your script tags again and make sure they still behave as desired after this release. See the v5 Upgrade Guide for more details.

    • 970f085: Fixes an issue when parsing elements inside foreign content (e.g. SVG), when they were inside an expression

    • 6b6a134: Fixes a bug caused by having an extra space in the fragment tag in the TSX output

    Open source →
  13. 2.10.314 Aug 2024
    Release notes

    Patch Changes

    • 5d0023d: Fixes sourcemapping for CRLF line endings wrongfully including the last character
    • f55a2af: Resolves an issue where the class:list directive was not correctly merging with the class attribute.
    Open source →
  14. 2.10.26 Aug 2024
    Release notes

    Patch Changes

    • f05a7cc: Adjust TSX output to return ranges using UTF-16 code units, as it would in JavaScript
    Open source →
  15. 2.10.131 Jul 2024
    Release notes

    Patch Changes

    • 21b7b95: Revert the transformation of top-level returns into throws in TSX as it was buggy in numerous situations
    • af471f5: Fixes positions for extracted tags being wrong when using IncludeStyles and IncludeScripts set to false
    Open source →
  16. 2.10.030 Jul 2024
    Release notes

    Minor Changes

    • 1d684b1: Adds detected language to extracted style tags in TSX

    Patch Changes

    • 7fa6577: Transform top level returns into throws in the TSX output
    Open source →
  17. 2.9.217 Jul 2024
    Release notes

    Patch Changes

    • a765f47: Escape script tags with unknown types
    Open source →
  18. 2.9.116 Jul 2024
    Release notes

    Patch Changes

    • 9549bb7: Fixes style and script tags sometimes being forcefully put into the body / head tags in the AST
    Open source →
  19. 2.9.016 Jul 2024
    Release notes

    Minor Changes

    • 3e25858: Adds two new options to convertToTSX: includeScripts and includeStyles. These options allow you to optionally remove scripts and styles from the output TSX file.

      Additionally this PR makes it so scripts and styles metadata are now included in the metaRanges property of the result of convertToTSX. This is notably useful in order to extract scripts and styles from the output TSX file into separate files for language servers.

    • 9fb8d5d: Adds serverComponents metadata

      This adds a change necessary to support server islands. During transformation the compiler discovers server:defer directives and appends them to the serverComponents array. This is exported along with the other metadata so that it can be used inside of Astro.

    Open source →
  20. 2.8.29 Jul 2024
    Release notes

    Patch Changes

    • 6b7c12f: Avoids stringifying undefined in scoped class attributes
    • 8803da6: Fixes newlines in opening tag generating buggy code in TSX
    Open source →
  21. 2.8.124 Jun 2024
    Release notes

    Patch Changes

    • 0bb2746: Allow data-astro-reload to take a value
    Open source →
  22. 2.8.02 May 2024
    Release notes

    Minor Changes

    • 17f8932: The WASM binaries for the compiler are now built using Go 1.22.

    Patch Changes

    • e8b6cdf: Skips printing createAstro code if the Astro global is not referenced
    • ecd7e90: Skips printing async for component functions if await is not used
    Open source →
  23. 2.7.11 Apr 2024
    Release notes

    Patch Changes

    • 5467f40: Fix issue with head content being pushed into body
    • d587ca6: Adds warnings indicating that the data-astro-rerun attribute can not be used on an external module <script> and that data-astro-reload is only supported on <a>, <area> and <form> elements.
    Open source →
  24. 2.7.05 Mar 2024
    Release notes

    Minor Changes

    • 50fc0a9: Implement the transition:persist-props transformation

    Patch Changes

    • f45dbfd: Updates deprecated Node.js 16 github actions.
    Open source →
  25. 2.6.021 Feb 2024
    Release notes

    Minor Changes

    • a90d99e: Adds a new renderScript option to render non-inline script tags using a renderScript function from internalURL, instead of stripping the script entirely

    Patch Changes

    • 6ffa54b: Fix TSX output prefixing output with unnecessary jsdoc comment
    • 86221d6: Adds a lint rule to display a message when attributes are added to a script tag, explaining that the script will be treated as is:inline.
    Open source →
  26. 2.5.36 Feb 2024
    Release notes

    Patch Changes

    • c17734d: Rollbacks the dynamic slot generation feature to rework it
    Open source →
  27. 2.5.231 Jan 2024
    Release notes

    Patch Changes

    • 418558c: Fixes an issue where a slotted element in an expression would cause subsequent ones to be incorrectly printed
    • db93975: Fixes an issue where an expression inside a th tag would cause an infinite loop
    Open source →
  28. 2.5.123 Jan 2024
    Release notes

    Patch Changes

    • d071b0b: Fixes an issue which caused the hydration script of default exported components to fail loading in some cases.
    Open source →
  29. 2.5.018 Jan 2024
    Release notes

    Minor Changes

    • db13db9: - Adds support for dynamic slots inside loops
      • Fixes an issue where successive named slotted elements would cause a runtime error
      • Fixes an issue in which if there was an implicit default slotted element next to named one, the former would get swallowed by the later.
    Open source →
  30. 2.4.216 Jan 2024
    Release notes

    Patch Changes

    • 9938bc1: Fixes a sourcemap-related crash when using multibyte characters
    Open source →
  31. 2.4.19 Jan 2024
    Release notes

    Patch Changes

    • 7a07089: Fixes a bug where expressions starting with whitespace, followed by anything else, weren't printed correctly.
    Open source →
  32. 2.4.04 Jan 2024
    Release notes

    Minor Changes

    • 9ff6342: Return generated frontmatter and body ranges in TSX output

    Patch Changes

    • b52f7d1: Fixes an issue where unterminated quoted attributes caused the compiler to crash
    • 24e2886: Fixes a regression that caused whitespace between elements in an expression to result invalid code
    • c5bcbd0: Prefix TSX output with a JSX pragma to ensure proper types are used
    • 4f74c05: Fixes an issue where HTML and JSX comments lead to subsequent content being incorrectly treated as plain text when they have parent expressions.
    • cad2606: Fixes an issue where components with template literal attributes were printed with the name of the attribute as value.
    • 14ccba5: Fixes an issue where a tr element which contained an expression would cause its parent table to swallow any trailing element inside said table
    • f9373f2: Fixes an issue where Astro fragments used inside a table element would cause lots of missing pieces of markup
    • 4de359b: Preserve whitespace in expressions
    • fe2f0c8: Fixes an issue where / or */ would cause prematurely closed comments in the tsx output
    Open source →
  33. 2.3.415 Dec 2023
    Release notes

    Patch Changes

    • 56e1959: Fixes a memory reference error when an expression is the final node in a file
    Open source →
  34. 2.3.315 Dec 2023
    Release notes

    Patch Changes

    • 5b450df: Fixed an index out of range error when multibyte characters were rendered as markup
    • 852fc1b: Fix index out of range [0] error when there is a component before the <html> tag
    • 05ecaff: Fixes an issue where when there are nested expressions, subsequent content was incorrectly treated as plain text in some cases.
    • 8c0cffb: Fixes an issue causing index out of range errors when handling some multibyte characters like \u2028.
    Open source →
  35. 2.3.214 Nov 2023
    Release notes

    Patch Changes

    • 2bdb4bb: Revert table related parsing change as it resulted in a regression
    Open source →
  36. 2.3.114 Nov 2023
    Release notes

    Patch Changes

    • e241f2d: Fix generated code for expressions within td elements
    • 5ce5cc6: Fix compact collapse for empty text nodes between elements
    Open source →
  37. 2.3.08 Nov 2023
    Release notes

    Minor Changes

    • 0c24ea1: Add a new annotateSourceFile option. This option makes it so the compiler will annotate every element with its source file location. This is notably useful for dev tools to be able to provide features like a "Open in editor" button. This option is disabled by default.

      <div>
        <span>hello world</span>
      </div>
      

      Results in:

      <div data-astro-source-file="/Users/erika/Projects/..." data-astro-source-loc="1:1">
        <span data-astro-source-file="/Users/erika/Projects/..." data-astro-source-loc="2:2">hello world</span>
      </div>
      

      In Astro, this option is enabled only in development mode.

    Open source →
  38. 2.2.22 Nov 2023
    Release notes

    Patch Changes

    • bf76663: [TSX] Add ASTRO__MergeUnion util to allow destructuring from automatically inferred union Prop types
    Open source →
  39. 2.2.117 Oct 2023
    Release notes

    Patch Changes

    • a52c181: Fixed an issue where spread attributes could not include double quotation marks.
    Open source →
  40. 2.2.04 Oct 2023
    Release notes

    Minor Changes

    • 7579d7c: Support CSS @starting-style rule (From: https://github.com/evanw/esbuild/pull/3249)
    • 09abfe4: Adds ability for TSX output to automatically infer Astro.props and Astro.params when getStaticPaths is used
    Open source →
  41. 2.1.08 Sept 2023
    Release notes

    Minor Changes

    • 2584348: Add propagation metadata to the TransformResult
    Open source →
  42. 2.0.123 Aug 2023
    Release notes

    Patch Changes

    • 4e1e907: Remove experimental flags from transition: directives. They are now enabled by default.
    Open source →
  43. 2.0.021 Aug 2023
    Release notes

    Major Changes

    • cd93272: The scope hash created by the compiler is now lowercase.

      This aligns with the HTML spec of the attribute names, where they are lowercase by spec.

      This change is needed because the compiler now creates data attributes that contain the hash in their name.

    Open source →
  44. 1.8.218 Aug 2023
    Release notes

    Patch Changes

    • 80b7e42: Pass the type of the current component as a type argument to the AstroGlobal in order to type Astro.self
    Open source →
  45. 1.8.14 Aug 2023
    Release notes

    Patch Changes

    • 52fe144: Change the value of the generated attribute
    Open source →
  46. 1.8.02 Aug 2023
    Release notes

    Minor Changes

    • 365710c: Support the transition:persist directive
    Open source →
  47. 1.7.01 Aug 2023
    Release notes

    Minor Changes

    • 5c19809: Add a scopedStyleStrategy called "attribute". The strategy will print styles using data attributes.
    Open source →
  48. 1.7.0-pre.228 Jul 2023pre-release

    Nothing published for this version

  49. 1.7.0-pre.128 Jul 2023pre-release

    Nothing published for this version

  50. 1.7.0-pre.028 Jul 2023pre-release

    Nothing published for this version

  51. 1.6.327 Jul 2023
    Release notes

    Patch Changes

    • 6b4873d: Pass transition directives onto components
    Open source →
  52. 1.6.224 Jul 2023
    Release notes

    Patch Changes

    • ce5cf31: Pass transition:animate expressions
    Open source →
  53. 1.6.120 Jul 2023
    Release notes

    Patch Changes

    • 486614b: Fixes use of expression in transition:name
    Open source →
  54. 1.6.019 Jul 2023
    Release notes

    Minor Changes

    • 2906df2: Support for view transition directives

      This adds support for transition:animate and transition:name which get passed into the new renderTransition runtime function.

    Open source →
  55. 1.6.0-pre.1319 Jul 2023pre-release

    Nothing published for this version

  56. 1.6.0-pre.1218 Jul 2023pre-release

    Nothing published for this version

  57. 1.6.0-pre.1113 Jul 2023pre-release

    Nothing published for this version

  58. 1.6.0-pre.1030 Jun 2023pre-release

    Nothing published for this version

  59. 1.6.0-pre.930 Jun 2023pre-release

    Nothing published for this version

  60. 1.6.0-pre.830 Jun 2023pre-release

    Nothing published for this version