This commit is contained in:
2022-07-21 03:28:35 +00:00
parent d7c883d6df
commit 51b34b0e1d
30103 changed files with 4152204 additions and 23 deletions
+54
View File
@@ -0,0 +1,54 @@
## @vue/babel-preset-jsx
Configurable preset for Vue JSX plugins.
### Babel Compatibility Notes
- This repo is only compatible with Babel 7.x, for 6.x please use [vuejs/babel-plugin-transform-vue-jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx)
### Usage
Install the dependencies:
```sh
# for yarn:
yarn add @vue/babel-preset-jsx @vue/babel-helper-vue-jsx-merge-props
# for npm:
npm install @vue/babel-preset-jsx @vue/babel-helper-vue-jsx-merge-props --save
```
In your `babel.config.js`:
```js
module.exports = {
presets: ['@vue/babel-preset-jsx'],
}
```
You can toggle specific features, by default all features (except `compositionAPI`) are enabled, e.g.:
```js
module.exports = {
presets: [
[
'@vue/babel-preset-jsx',
{
vModel: false,
compositionAPI: true,
},
],
],
}
```
Options are:
- `compositionAPI` - Enables [@vue/babel-sugar-composition-api-inject-h](../babel-sugar-composition-api-inject-h) and [@vue/babel-sugar-composition-api-render-instance](../babel-sugar-composition-api-render-instance), support returning render function in `setup`.
- The default value is `false`;
- When set to `'auto'` (or `true`), it will detect the Vue version in the project. If it's >= 2.7, it will import the composition utilities from `vue`, otherwise from `@vue/composition-api`;
- When set to `'native'` (or `'naruto'`), it will always import the composition utilities from `vue`
- When set to `plugin`, it will always import the composition utilities from `@vue/composition-api`
- `functional` [@vue/babel-sugar-functional-vue](../babel-sugar-functional-vue/README.md) - Functional components syntactic sugar
- `injectH` [@vue/babel-sugar-inject-h](../babel-sugar-inject-h/README.md) - Automatic `h` injection syntactic sugar
- `vModel` [@vue/babel-sugar-v-model](../babel-sugar-v-model/README.md) - `vModel` syntactic sugar
- `vOn` [@vue/babel-sugar-v-on](../babel-sugar-v-on/README.md) - `vOn` syntactic sugar
+1
View File
@@ -0,0 +1 @@
"use strict";function _interopDefault(a){return a&&"object"==typeof a&&"default"in a?a["default"]:a}var babelPluginTransformVueJsx=_interopDefault(require("@vue/babel-plugin-transform-vue-jsx")),babelSugarFunctionalVue=_interopDefault(require("@vue/babel-sugar-functional-vue")),babelSugarInjectH=_interopDefault(require("@vue/babel-sugar-inject-h")),babelSugarCompositionApiInjectH=_interopDefault(require("@vue/babel-sugar-composition-api-inject-h")),babelSugarCompositionApiRenderInstance=_interopDefault(require("@vue/babel-sugar-composition-api-render-instance")),babelSugarVModel=_interopDefault(require("@vue/babel-sugar-v-model")),babelSugarVOn=_interopDefault(require("@vue/babel-sugar-v-on")),index=(a,{functional:b=!0,injectH:c=!0,vModel:d=!0,vOn:e=!0,compositionAPI:f=!1}={})=>{let g=babelSugarInjectH,h="@vue/composition-api";if(f){if(("native"===f||"naruto"===f)&&(h="vue"),"auto"===f||!0===f)try{const a=require("vue/package.json").version;a.startsWith("2.7")&&(h="vue")}catch(a){}g=[babelSugarCompositionApiInjectH,{importSource:h}]}return{plugins:[b&&babelSugarFunctionalVue,c&&g,d&&babelSugarVModel,e&&babelSugarVOn,f&&[babelSugarCompositionApiRenderInstance,{importSource:h}],babelPluginTransformVueJsx].filter(Boolean)}};module.exports=index;
+77
View File
@@ -0,0 +1,77 @@
{
"_args": [
[
"@vue/babel-preset-jsx@1.3.0",
"/home/node/nuxt"
]
],
"_from": "@vue/babel-preset-jsx@1.3.0",
"_id": "@vue/babel-preset-jsx@1.3.0",
"_inBundle": false,
"_integrity": "sha512-WFHjZWoUV/W0VAnEM/vi3zhdKsWrYf1TVFuxrpMQXVjhU8w8cxAUzNkmUDvf5iugCNzQssTJp9LjDPHAcmCqUw==",
"_location": "/@vue/babel-preset-jsx",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@vue/babel-preset-jsx@1.3.0",
"name": "@vue/babel-preset-jsx",
"escapedName": "@vue%2fbabel-preset-jsx",
"scope": "@vue",
"rawSpec": "1.3.0",
"saveSpec": null,
"fetchSpec": "1.3.0"
},
"_requiredBy": [
"/@nuxt/babel-preset-app"
],
"_resolved": "https://registry.npmjs.org/@vue/babel-preset-jsx/-/babel-preset-jsx-1.3.0.tgz",
"_spec": "1.3.0",
"_where": "/home/node/nuxt",
"author": {
"name": "Nick Messing",
"email": "dot.nick.dot.messing@gmail.com"
},
"dependencies": {
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
"@vue/babel-plugin-transform-vue-jsx": "^1.2.1",
"@vue/babel-sugar-composition-api-inject-h": "^1.3.0",
"@vue/babel-sugar-composition-api-render-instance": "^1.3.0",
"@vue/babel-sugar-functional-vue": "^1.2.2",
"@vue/babel-sugar-inject-h": "^1.2.2",
"@vue/babel-sugar-v-model": "^1.3.0",
"@vue/babel-sugar-v-on": "^1.3.0"
},
"description": "Babel preset for Vue JSX",
"devDependencies": {
"rollup": "^0.67.4",
"rollup-plugin-babel-minify": "^6.2.0"
},
"files": [],
"gitHead": "f82f6182d294632a2cbddaacdff0a506c09e4ddc",
"license": "MIT",
"main": "dist/plugin.cjs.js",
"name": "@vue/babel-preset-jsx",
"peerDependencies": {
"@babel/core": "^7.0.0-0",
"vue": "2.x"
},
"peerDependenciesMeta": {
"vue": {
"optional": true
}
},
"private": false,
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/vuejs/jsx/tree/master/packages/babel-preset-jsx"
},
"scripts": {
"build": "rollup -c",
"prerelease": "yarn build"
},
"version": "1.3.0"
}