Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jsx-runtime): fix automatic runtime implementation #7959

Merged
merged 3 commits into from Mar 28, 2023

Commits on Mar 26, 2023

  1. fix(jsx-runtime): fix automatic runtime implementation

    The JSX automatic runtime consists of two modules. These modules require
    different exports.
    
    - `vue/jsx-runtime` is for production. This has the following exports:
      - `jsx`
      - `jsxs`
      - `Fragment`
    - `vue/jsx-dev-runtime` is for development. This has the following exports:
      - `jsxDEV`
      - `Fragment`
    
    Whereas a JSX pragma of the classic runtime accepts children as the 3rd..nth
    arguments, in the automatic runtime this is passed as the `children`
    prop. If the JSX element has one child, the `jsx` function is used and
    `children` is that child. If the JSX element has more, the `jsxs`
    function is called and `children` is an array of all childrne. If no
    children are passed, this prop is omitted.
    
    The third argument is the key. In the classic runtime this was part of
    props.
    
    If the development transform is used, `jsxDEV` from the
    `vue/jsx-dev-runtime` module is used intead. This is similar to `jsx` /
    `jsxs`, but it accepts more arguments.
    
    The 4th argument determines if the production runtime would use `jsxs` or
    `jsx`.
    
    The 5th argument is positional information that you could use to enhance the
    developer experience. Note that different compilers compile the file
    name differently. (relative vs absolute paths)
    
    The 6th argument is the value of `this` in the scopewhere the JSX element was
    created. React uses this to warn about string refs.
    
    This implementation combines the production and development runtime in
    the same file, and uses an package exports to expose both import entry
    points.
    remcohaszing committed Mar 26, 2023
    Copy the full SHA
    c8bdfe6 View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2023

  1. Update index.js

    yyx990803 committed Mar 28, 2023
    Copy the full SHA
    815648b View commit details
    Browse the repository at this point in the history
  2. Update index.mjs

    yyx990803 committed Mar 28, 2023
    Copy the full SHA
    9577f1c View commit details
    Browse the repository at this point in the history