first commit

This commit is contained in:
jefferyzhao
2025-07-31 17:44:12 +08:00
commit b9bdc8598b
42390 changed files with 4467935 additions and 0 deletions

View File

@ -0,0 +1,30 @@
## @vue/babel-helper-vue-jsx-merge-props
A package used internally by vue jsx transformer to merge props spread. It is required to merge some prop trees like this:
```js
import mergeProps from '@vue/babel-helper-vue-jsx-merge-props'
const MyComponent = {
render(h) {
// original: <button onClick={$event => console.log($event)} {...{ on: { click: $event => doSomething($event) } }} />
return h(
'button',
mergeProps([
{
on: {
click: $event => console.log($event),
},
},
{
on: {
click: $event => doSomething($event),
},
},
]),
)
},
}
```
This tool is used internally and there is no reason for you to ever use it.

View File

@ -0,0 +1 @@
"use strict";function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=[].concat(d,e)}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=[].concat(g,h)}else c[b][f]=a[b][f];}else if("hook"===b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments)}};module.exports=mergeJsxProps;

View File

@ -0,0 +1,38 @@
{
"name": "@vue/babel-helper-vue-jsx-merge-props",
"version": "1.4.0",
"description": "Babel helper for Vue JSX spread",
"main": "dist/helper.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-helper-vue-jsx-merge-props",
"author": "Evan You",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"build:testing": "rollup -c rollup.config.testing.js",
"build": "rollup -c",
"pretest": "yarn build:testing",
"test": "nyc --reporter=html --reporter=text-summary ava -v test/test.js",
"prepublish": "yarn build"
},
"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"ava": "^0.25.0",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-babel-minify": "^6.2.0",
"rollup-plugin-istanbul": "^2.0.1"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-present vuejs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,5 @@
# @vue/babel-helper-vue-transform-on
A package used internally by vue jsx transformer to transform events.
on: { click: xx } --> onClick: xx

View File

@ -0,0 +1,4 @@
declare function transformOn(
obj: Record<string, any>
): Record<`on${string}`, any>;
export = transformOn;

View File

@ -0,0 +1,9 @@
const transformOn = (obj) => {
const result = {};
Object.keys(obj).forEach((evt) => {
result[`on${evt[0].toUpperCase()}${evt.slice(1)}`] = obj[evt];
});
return result;
};
module.exports = transformOn;

View File

@ -0,0 +1,13 @@
{
"name": "@vue/babel-helper-vue-transform-on",
"version": "1.2.1",
"description": "to help transform on",
"author": "Amour1688 <lcz_1996@foxmail.com>",
"license": "MIT",
"main": "index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/babel-plugin-jsx"
}
}

21
node_modules/@vue/babel-plugin-jsx/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-present vuejs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

388
node_modules/@vue/babel-plugin-jsx/README.md generated vendored Normal file
View File

@ -0,0 +1,388 @@
# Babel Plugin JSX for Vue 3
[![npm package](https://img.shields.io/npm/v/@vue/babel-plugin-jsx.svg?style=flat-square)](https://www.npmjs.com/package/@vue/babel-plugin-jsx)
[![issues-helper](https://img.shields.io/badge/Issues%20Manage%20By-issues--helper-blueviolet?style=flat-square)](https://github.com/actions-cool/issues-helper)
To add Vue JSX support.
English | [简体中文](/packages/babel-plugin-jsx/README-zh_CN.md)
## Installation
Install the plugin with:
```bash
npm install @vue/babel-plugin-jsx -D
```
Then add the plugin to your babel config:
```json
{
"plugins": ["@vue/babel-plugin-jsx"]
}
```
## Usage
### options
#### transformOn
Type: `boolean`
Default: `false`
transform `on: { click: xx }` to `onClick: xxx`
#### optimize
Type: `boolean`
Default: `false`
enable optimization or not. It's not recommended to enable it If you are not familiar with Vue 3.
#### isCustomElement
Type: `(tag: string) => boolean`
Default: `undefined`
configuring custom elements
#### mergeProps
Type: `boolean`
Default: `true`
merge static and dynamic class / style attributes / onXXX handlers
#### enableObjectSlots
Type: `boolean`
Default: `true`
Whether to enable `object slots` (mentioned below the document) syntax". It might be useful in JSX, but it will add a lot of `_isSlot` condition expressions which increase your bundle size. And `v-slots` is still available even if `enableObjectSlots` is turned off.
#### pragma
Type: `string`
Default: `createVNode`
Replace the function used when compiling JSX expressions.
#### resolveType
Type: `boolean`
Default: `false`
(**Experimental**) Infer component metadata from types (e.g. `props`, `emits`, `name`). This is an experimental feature and may not work in all cases.
## Syntax
### Content
functional component
```jsx
const App = () => <div>Vue 3.0</div>;
```
with render
```jsx
const App = {
render() {
return <div>Vue 3.0</div>;
},
};
```
```jsx
import { withModifiers, defineComponent } from 'vue';
const App = defineComponent({
setup() {
const count = ref(0);
const inc = () => {
count.value++;
};
return () => (
<div onClick={withModifiers(inc, ['self'])}>{count.value}</div>
);
},
});
```
Fragment
```jsx
const App = () => (
<>
<span>I'm</span>
<span>Fragment</span>
</>
);
```
### Attributes / Props
```jsx
const App = () => <input type="email" />;
```
with a dynamic binding:
```jsx
const placeholderText = 'email';
const App = () => <input type="email" placeholder={placeholderText} />;
```
### Directives
#### v-show
```jsx
const App = {
data() {
return { visible: true };
},
render() {
return <input v-show={this.visible} />;
},
};
```
#### v-model
> Note: You should pass the second param as string for using `arg`.
```jsx
<input v-model={val} />
```
```jsx
<input v-model:argument={val} />
```
```jsx
<input v-model={[val, ['modifier']]} />
// Or
<input v-model_modifier={val} />
```
```jsx
<A v-model={[val, 'argument', ['modifier']]} />
// Or
<input v-model:argument_modifier={val} />
```
Will compile to:
```js
h(A, {
argument: val,
argumentModifiers: {
modifier: true,
},
'onUpdate:argument': ($event) => (val = $event),
});
```
#### v-models (Not recommended since v1.1.0)
> Note: You should pass a Two-dimensional Arrays to v-models.
```jsx
<A v-models={[[foo], [bar, 'bar']]} />
```
```jsx
<A
v-models={[
[foo, 'foo'],
[bar, 'bar'],
]}
/>
```
```jsx
<A
v-models={[
[foo, ['modifier']],
[bar, 'bar', ['modifier']],
]}
/>
```
Will compile to:
```js
h(A, {
modelValue: foo,
modelModifiers: {
modifier: true,
},
'onUpdate:modelValue': ($event) => (foo = $event),
bar: bar,
barModifiers: {
modifier: true,
},
'onUpdate:bar': ($event) => (bar = $event),
});
```
#### custom directive
Recommended when using string arguments
```jsx
const App = {
directives: { custom: customDirective },
setup() {
return () => <a v-custom:arg={val} />;
},
};
```
```jsx
const App = {
directives: { custom: customDirective },
setup() {
return () => <a v-custom={[val, 'arg', ['a', 'b']]} />;
},
};
```
### Slot
> Note: In `jsx`, _`v-slot`_ should be replaced with **`v-slots`**
```jsx
const A = (props, { slots }) => (
<>
<h1>{slots.default ? slots.default() : 'foo'}</h1>
<h2>{slots.bar?.()}</h2>
</>
);
const App = {
setup() {
const slots = {
bar: () => <span>B</span>,
};
return () => (
<A v-slots={slots}>
<div>A</div>
</A>
);
},
};
// or
const App = {
setup() {
const slots = {
default: () => <div>A</div>,
bar: () => <span>B</span>,
};
return () => <A v-slots={slots} />;
},
};
// or you can use object slots when `enableObjectSlots` is not false.
const App = {
setup() {
return () => (
<>
<A>
{{
default: () => <div>A</div>,
bar: () => <span>B</span>,
}}
</A>
<B>{() => 'foo'}</B>
</>
);
},
};
```
### In TypeScript
`tsconfig.json`:
```json
{
"compilerOptions": {
"jsx": "preserve"
}
}
```
## Who is using
<table>
<tbody>
<tr>
<td align="center">
<a target="_blank" href="https://www.antdv.com/">
<img
width="32"
src="https://github.com/vuejs/babel-plugin-jsx/assets/6481596/8d604d42-fe5f-4450-af87-97999537cd21"
/>
<br>
<strong>Ant Design Vue</strong>
</a>
</td>
<td align="center">
<a target="_blank" href="https://youzan.github.io/vant/#/zh-CN/">
<img
width="32"
style="vertical-align: -0.32em; margin-right: 8px;"
src="https://img.yzcdn.cn/vant/logo.png"
/>
<br>
<strong>Vant</strong>
</a>
</td>
<td align="center">
<a target="_blank" href="https://github.com/element-plus/element-plus">
<img
height="32"
style="vertical-align: -0.32em; margin-right: 8px;"
src="https://user-images.githubusercontent.com/10731096/91267529-259f3680-e7a6-11ea-9a60-3286f750de01.png"
/>
<br>
<strong>Element Plus</strong>
</a>
</td>
<td align="center">
<a target="_blank" href="https://github.com/leezng/vue-json-pretty">
<img
height="32"
style="vertical-align: -0.32em; margin-right: 8px;"
src="https://raw.githubusercontent.com/leezng/vue-json-pretty/master/static/logo.svg"
/>
<br>
<strong>Vue Json Pretty</strong>
</a>
</td>
</tr>
</tbody>
</table>
## Compatibility
This repo is only compatible with:
- **Babel 7+**
- **Vue 3+**

32
node_modules/@vue/babel-plugin-jsx/dist/index.d.mts generated vendored Normal file
View File

@ -0,0 +1,32 @@
import * as BabelCore from '@babel/core';
import { Options } from '@vue/babel-plugin-resolve-type';
type State = {
get: (name: string) => any;
set: (name: string, value: any) => any;
opts: VueJSXPluginOptions;
file: BabelCore.BabelFile;
};
interface VueJSXPluginOptions {
/** transform `on: { click: xx }` to `onClick: xxx` */
transformOn?: boolean;
/** enable optimization or not. */
optimize?: boolean;
/** merge static and dynamic class / style attributes / onXXX handlers */
mergeProps?: boolean;
/** configuring custom elements */
isCustomElement?: (tag: string) => boolean;
/** enable object slots syntax */
enableObjectSlots?: boolean;
/** Replace the function used when compiling JSX expressions */
pragma?: string;
/**
* (**Experimental**) Infer component metadata from types (e.g. `props`, `emits`, `name`)
* @default false
*/
resolveType?: Options | boolean;
}
declare const _default: (api: object, options: VueJSXPluginOptions | null | undefined, dirname: string) => BabelCore.PluginObj<State>;
export { type VueJSXPluginOptions, _default as default };

32
node_modules/@vue/babel-plugin-jsx/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,32 @@
import * as BabelCore from '@babel/core';
import { Options } from '@vue/babel-plugin-resolve-type';
type State = {
get: (name: string) => any;
set: (name: string, value: any) => any;
opts: VueJSXPluginOptions;
file: BabelCore.BabelFile;
};
interface VueJSXPluginOptions {
/** transform `on: { click: xx }` to `onClick: xxx` */
transformOn?: boolean;
/** enable optimization or not. */
optimize?: boolean;
/** merge static and dynamic class / style attributes / onXXX handlers */
mergeProps?: boolean;
/** configuring custom elements */
isCustomElement?: (tag: string) => boolean;
/** enable object slots syntax */
enableObjectSlots?: boolean;
/** Replace the function used when compiling JSX expressions */
pragma?: string;
/**
* (**Experimental**) Infer component metadata from types (e.g. `props`, `emits`, `name`)
* @default false
*/
resolveType?: Options | boolean;
}
declare const _default: (api: object, options: VueJSXPluginOptions | null | undefined, dirname: string) => BabelCore.PluginObj<State>;
export { type VueJSXPluginOptions, _default as default };

1041
node_modules/@vue/babel-plugin-jsx/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1013
node_modules/@vue/babel-plugin-jsx/dist/index.mjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

57
node_modules/@vue/babel-plugin-jsx/package.json generated vendored Normal file
View File

@ -0,0 +1,57 @@
{
"name": "@vue/babel-plugin-jsx",
"version": "1.2.1",
"description": "Babel plugin for Vue 3 JSX",
"author": "Amour1688 <lcz_1996@foxmail.com>",
"homepage": "https://github.com/vuejs/babel-plugin-jsx/tree/dev/packages/babel-plugin-jsx#readme",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/babel-plugin-jsx"
},
"bugs": {
"url": "https://github.com/vuejs/babel-plugin-jsx/issues"
},
"files": [
"dist"
],
"dependencies": {
"@babel/helper-module-imports": "^7.22.15",
"@babel/helper-plugin-utils": "^7.22.5",
"@babel/plugin-syntax-jsx": "^7.23.3",
"@babel/template": "^7.22.15",
"@babel/traverse": "^7.23.7",
"@babel/types": "^7.23.6",
"camelcase": "^6.3.0",
"html-tags": "^3.3.1",
"svg-tags": "^1.0.0",
"@vue/babel-helper-vue-transform-on": "1.2.1",
"@vue/babel-plugin-resolve-type": "1.2.1"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/preset-env": "^7.23.8",
"@types/babel__template": "^7.4.4",
"@types/babel__traverse": "^7.20.5",
"@types/svg-tags": "^1.0.2",
"@vue/runtime-dom": "^3.4.15",
"@vue/test-utils": "^2.4.3",
"regenerator-runtime": "^0.14.1",
"vue": "^3.4.15"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"peerDependenciesMeta": {
"@babel/core": {
"optional": true
}
},
"scripts": {
"build": "tsup",
"watch": "tsup --watch"
}
}

21
node_modules/@vue/babel-plugin-resolve-type/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-present vuejs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
# babel-plugin-resolve-type

View File

@ -0,0 +1,7 @@
import * as _vue_compiler_sfc from '@vue/compiler-sfc';
export { SimpleTypeResolveOptions as Options } from '@vue/compiler-sfc';
import * as BabelCore from '@babel/core';
declare const _default: (api: object, options: Partial<Pick<_vue_compiler_sfc.SFCScriptCompileOptions, "globalTypeFiles" | "fs" | "babelParserPlugins" | "isProd">> | null | undefined, dirname: string) => BabelCore.PluginObj<BabelCore.PluginPass>;
export { _default as default };

View File

@ -0,0 +1,7 @@
import * as _vue_compiler_sfc from '@vue/compiler-sfc';
export { SimpleTypeResolveOptions as Options } from '@vue/compiler-sfc';
import * as BabelCore from '@babel/core';
declare const _default: (api: object, options: Partial<Pick<_vue_compiler_sfc.SFCScriptCompileOptions, "globalTypeFiles" | "fs" | "babelParserPlugins" | "isProd">> | null | undefined, dirname: string) => BabelCore.PluginObj<BabelCore.PluginPass>;
export { _default as default };

View File

@ -0,0 +1,195 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
default: () => src_default
});
module.exports = __toCommonJS(src_exports);
var import_parser = require("@babel/parser");
var import_compiler_sfc = require("@vue/compiler-sfc");
var import_code_frame = require("@babel/code-frame");
var import_helper_module_imports = require("@babel/helper-module-imports");
var import_helper_plugin_utils = require("@babel/helper-plugin-utils");
var src_default = (0, import_helper_plugin_utils.declare)(({ types: t }, options) => {
let ctx;
let helpers;
return {
name: "babel-plugin-resolve-type",
pre(file) {
const filename = file.opts.filename || "unknown.js";
helpers = /* @__PURE__ */ new Set();
ctx = {
filename,
source: file.code,
options,
ast: file.ast.program.body,
isCE: false,
error(msg, node) {
throw new Error(
`[@vue/babel-plugin-resolve-type] ${msg}
${filename}
${(0, import_code_frame.codeFrameColumns)(
file.code,
{
start: {
line: node.loc.start.line,
column: node.loc.start.column + 1
},
end: {
line: node.loc.end.line,
column: node.loc.end.column + 1
}
}
)}`
);
},
helper(key) {
helpers.add(key);
return `_${key}`;
},
getString(node) {
return file.code.slice(node.start, node.end);
},
propsTypeDecl: void 0,
propsRuntimeDefaults: void 0,
propsDestructuredBindings: {},
emitsTypeDecl: void 0
};
},
visitor: {
CallExpression(path) {
if (!ctx) {
throw new Error(
"[@vue/babel-plugin-resolve-type] context is not loaded."
);
}
const { node } = path;
if (!t.isIdentifier(node.callee, { name: "defineComponent" }))
return;
if (!checkDefineComponent(path))
return;
const comp = node.arguments[0];
if (!comp || !t.isFunction(comp))
return;
let options2 = node.arguments[1];
if (!options2) {
options2 = t.objectExpression([]);
node.arguments.push(options2);
}
node.arguments[1] = processProps(comp, options2) || options2;
node.arguments[1] = processEmits(comp, node.arguments[1]) || options2;
},
VariableDeclarator(path) {
inferComponentName(path);
}
},
post(file) {
for (const helper of helpers) {
(0, import_helper_module_imports.addNamed)(file.path, `_${helper}`, "vue");
}
}
};
function inferComponentName(path) {
var _a;
const id = path.get("id");
const init = path.get("init");
if (!id || !id.isIdentifier() || !init || !init.isCallExpression())
return;
if (!((_a = init.get("callee")) == null ? void 0 : _a.isIdentifier({ name: "defineComponent" })))
return;
if (!checkDefineComponent(init))
return;
const nameProperty = t.objectProperty(
t.identifier("name"),
t.stringLiteral(id.node.name)
);
const { arguments: args } = init.node;
if (args.length === 0)
return;
if (args.length === 1) {
init.node.arguments.push(t.objectExpression([]));
}
args[1] = addProperty(t, args[1], nameProperty);
}
function processProps(comp, options2) {
const props = comp.params[0];
if (!props)
return;
if (props.type === "AssignmentPattern") {
ctx.propsTypeDecl = getTypeAnnotation(props.left);
ctx.propsRuntimeDefaults = props.right;
} else {
ctx.propsTypeDecl = getTypeAnnotation(props);
}
if (!ctx.propsTypeDecl)
return;
const runtimeProps = (0, import_compiler_sfc.extractRuntimeProps)(ctx);
if (!runtimeProps) {
return;
}
const ast = (0, import_parser.parseExpression)(runtimeProps);
return addProperty(
t,
options2,
t.objectProperty(t.identifier("props"), ast)
);
}
function processEmits(comp, options2) {
var _a;
const setupCtx = comp.params[1] && getTypeAnnotation(comp.params[1]);
if (!setupCtx || !t.isTSTypeReference(setupCtx) || !t.isIdentifier(setupCtx.typeName, { name: "SetupContext" }))
return;
const emitType = (_a = setupCtx.typeParameters) == null ? void 0 : _a.params[0];
if (!emitType)
return;
ctx.emitsTypeDecl = emitType;
const runtimeEmits = (0, import_compiler_sfc.extractRuntimeEmits)(ctx);
const ast = t.arrayExpression(
Array.from(runtimeEmits).map((e) => t.stringLiteral(e))
);
return addProperty(
t,
options2,
t.objectProperty(t.identifier("emits"), ast)
);
}
});
function getTypeAnnotation(node) {
if ("typeAnnotation" in node && node.typeAnnotation && node.typeAnnotation.type === "TSTypeAnnotation") {
return node.typeAnnotation.typeAnnotation;
}
}
function checkDefineComponent(path) {
var _a;
const defineCompImport = (_a = path.scope.getBinding("defineComponent")) == null ? void 0 : _a.path.parent;
if (!defineCompImport)
return true;
return defineCompImport.type === "ImportDeclaration" && /^@?vue(\/|$)/.test(defineCompImport.source.value);
}
function addProperty(t, object, property) {
if (t.isObjectExpression(object)) {
object.properties.unshift(property);
} else if (t.isExpression(object)) {
return t.objectExpression([property, t.spreadElement(object)]);
}
return object;
}

View File

@ -0,0 +1,177 @@
// src/index.ts
import { parseExpression } from "@babel/parser";
import {
extractRuntimeEmits,
extractRuntimeProps
} from "@vue/compiler-sfc";
import { codeFrameColumns } from "@babel/code-frame";
import { addNamed } from "@babel/helper-module-imports";
import { declare } from "@babel/helper-plugin-utils";
var src_default = declare(({ types: t }, options) => {
let ctx;
let helpers;
return {
name: "babel-plugin-resolve-type",
pre(file) {
const filename = file.opts.filename || "unknown.js";
helpers = /* @__PURE__ */ new Set();
ctx = {
filename,
source: file.code,
options,
ast: file.ast.program.body,
isCE: false,
error(msg, node) {
throw new Error(
`[@vue/babel-plugin-resolve-type] ${msg}
${filename}
${codeFrameColumns(
file.code,
{
start: {
line: node.loc.start.line,
column: node.loc.start.column + 1
},
end: {
line: node.loc.end.line,
column: node.loc.end.column + 1
}
}
)}`
);
},
helper(key) {
helpers.add(key);
return `_${key}`;
},
getString(node) {
return file.code.slice(node.start, node.end);
},
propsTypeDecl: void 0,
propsRuntimeDefaults: void 0,
propsDestructuredBindings: {},
emitsTypeDecl: void 0
};
},
visitor: {
CallExpression(path) {
if (!ctx) {
throw new Error(
"[@vue/babel-plugin-resolve-type] context is not loaded."
);
}
const { node } = path;
if (!t.isIdentifier(node.callee, { name: "defineComponent" }))
return;
if (!checkDefineComponent(path))
return;
const comp = node.arguments[0];
if (!comp || !t.isFunction(comp))
return;
let options2 = node.arguments[1];
if (!options2) {
options2 = t.objectExpression([]);
node.arguments.push(options2);
}
node.arguments[1] = processProps(comp, options2) || options2;
node.arguments[1] = processEmits(comp, node.arguments[1]) || options2;
},
VariableDeclarator(path) {
inferComponentName(path);
}
},
post(file) {
for (const helper of helpers) {
addNamed(file.path, `_${helper}`, "vue");
}
}
};
function inferComponentName(path) {
var _a;
const id = path.get("id");
const init = path.get("init");
if (!id || !id.isIdentifier() || !init || !init.isCallExpression())
return;
if (!((_a = init.get("callee")) == null ? void 0 : _a.isIdentifier({ name: "defineComponent" })))
return;
if (!checkDefineComponent(init))
return;
const nameProperty = t.objectProperty(
t.identifier("name"),
t.stringLiteral(id.node.name)
);
const { arguments: args } = init.node;
if (args.length === 0)
return;
if (args.length === 1) {
init.node.arguments.push(t.objectExpression([]));
}
args[1] = addProperty(t, args[1], nameProperty);
}
function processProps(comp, options2) {
const props = comp.params[0];
if (!props)
return;
if (props.type === "AssignmentPattern") {
ctx.propsTypeDecl = getTypeAnnotation(props.left);
ctx.propsRuntimeDefaults = props.right;
} else {
ctx.propsTypeDecl = getTypeAnnotation(props);
}
if (!ctx.propsTypeDecl)
return;
const runtimeProps = extractRuntimeProps(ctx);
if (!runtimeProps) {
return;
}
const ast = parseExpression(runtimeProps);
return addProperty(
t,
options2,
t.objectProperty(t.identifier("props"), ast)
);
}
function processEmits(comp, options2) {
var _a;
const setupCtx = comp.params[1] && getTypeAnnotation(comp.params[1]);
if (!setupCtx || !t.isTSTypeReference(setupCtx) || !t.isIdentifier(setupCtx.typeName, { name: "SetupContext" }))
return;
const emitType = (_a = setupCtx.typeParameters) == null ? void 0 : _a.params[0];
if (!emitType)
return;
ctx.emitsTypeDecl = emitType;
const runtimeEmits = extractRuntimeEmits(ctx);
const ast = t.arrayExpression(
Array.from(runtimeEmits).map((e) => t.stringLiteral(e))
);
return addProperty(
t,
options2,
t.objectProperty(t.identifier("emits"), ast)
);
}
});
function getTypeAnnotation(node) {
if ("typeAnnotation" in node && node.typeAnnotation && node.typeAnnotation.type === "TSTypeAnnotation") {
return node.typeAnnotation.typeAnnotation;
}
}
function checkDefineComponent(path) {
var _a;
const defineCompImport = (_a = path.scope.getBinding("defineComponent")) == null ? void 0 : _a.path.parent;
if (!defineCompImport)
return true;
return defineCompImport.type === "ImportDeclaration" && /^@?vue(\/|$)/.test(defineCompImport.source.value);
}
function addProperty(t, object, property) {
if (t.isObjectExpression(object)) {
object.properties.unshift(property);
} else if (t.isExpression(object)) {
return t.objectExpression([property, t.spreadElement(object)]);
}
return object;
}
export {
src_default as default
};

View File

@ -0,0 +1,47 @@
{
"name": "@vue/babel-plugin-resolve-type",
"version": "1.2.1",
"description": "Babel plugin for resolving Vue types.",
"author": "三咲智子 <sxzz@sxzz.moe>",
"homepage": "https://github.com/vuejs/babel-plugin-jsx/tree/dev/packages/babel-plugin-resolve-type#readme",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/babel-plugin-jsx"
},
"bugs": {
"url": "https://github.com/vuejs/babel-plugin-jsx/issues"
},
"files": [
"dist"
],
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"dependencies": {
"@babel/code-frame": "^7.23.5",
"@babel/helper-module-imports": "^7.22.15",
"@babel/helper-plugin-utils": "^7.22.5",
"@babel/parser": "^7.23.6",
"@vue/compiler-sfc": "^3.4.15"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@types/babel__code-frame": "^7.0.6",
"vue": "^3.4.15"
},
"scripts": {
"build": "tsup",
"watch": "tsup --watch"
}
}

View File

@ -0,0 +1,184 @@
## @vue/babel-plugin-transform-vue-jsx
> Babel plugin for Vue 2.0 JSX
### 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)
### Requirements
- Assumes you are using Babel with a module bundler e.g. Webpack, because the spread merge helper is imported as a module to avoid duplication.
- This is mutually exclusive with `babel-plugin-transform-react-jsx`.
### Usage
```bash
npm install @vue/babel-plugin-transform-vue-jsx --save-dev
npm install @vue/babel-helper-vue-jsx-merge-props --save
```
In your `.babelrc`:
```json
{
"plugins": ["transform-vue-jsx"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
The plugin transpiles the following JSX:
```jsx
<div id="foo">{this.text}</div>
```
To the following JavaScript:
```js
h(
'div',
{
attrs: {
id: 'foo',
},
},
[this.text],
)
```
Note the `h` function, which is a shorthand for a Vue instance's `$createElement` method, must be in the scope where the JSX is. Since this method is passed to component render functions as the first argument, in most cases you'd do this:
```js
Vue.component('jsx-example', {
render(h) {
// <-- h must be in scope
return <div id="foo">bar</div>
},
})
```
### Difference from React JSX
First, Vue 2.0's vnode format is different from React's. The second argument to the `createElement` call is a "data object" that accepts nested objects. Each nested object will be then processed by corresponding modules:
```js
render (h) {
return h('div', {
// Component props
props: {
msg: 'hi'
},
// Normal HTML attributes
attrs: {
id: 'foo'
},
// DOM props
domProps: {
innerHTML: 'bar'
},
// Event handlers are nested under "on", though
// modifiers such as in v-on:keyup.enter are not
// supported. You'll have to manually check the
// keyCode in the handler instead.
on: {
click: this.clickHandler
},
// For components only. Allows you to listen to
// native events, rather than events emitted from
// the component using vm.$emit.
nativeOn: {
click: this.nativeClickHandler
},
// Class is a special module, same API as `v-bind:class`
class: {
foo: true,
bar: false
},
// Style is also same as `v-bind:style`
style: {
color: 'red',
fontSize: '14px'
},
// Other special top-level properties
key: 'key',
ref: 'ref',
// Assign the `ref` is used on elements/components with v-for
refInFor: true,
slot: 'slot'
})
}
```
The equivalent of the above in Vue 2.0 JSX is:
```jsx
render (h) {
return (
<div
// Component props
propsMsg="hi"
// Normal attributes or component props.
id="foo"
// DOM properties are prefixed with `domProps`
domPropsInnerHTML="bar"
// event listeners are prefixed with `on` or `nativeOn`
onClick={this.clickHandler}
nativeOnClick={this.nativeClickHandler}
// other special top-level properties
class={{ foo: true, bar: false }}
style={{ color: 'red', fontSize: '14px' }}
key="key"
ref="ref"
// assign the `ref` is used on elements/components with v-for
refInFor
slot="slot">
</div>
)
}
```
### Component Tip
If a custom element starts with lowercase, it will be treated as a string id and used to lookup a registered component. If it starts with uppercase, it will be treated as an identifier, which allows you to do:
```js
import Todo from './Todo.js'
export default {
render(h) {
return <Todo /> // no need to register Todo via components option
},
}
```
### JSX Spread
JSX spread is supported, and this plugin will intelligently merge nested data properties. For example:
```jsx
const data = {
class: ['b', 'c'],
}
const vnode = <div class="a" {...data} />
```
The merged data will be:
```js
{ class: ['a', 'b', 'c'] }
```
### Vue directives
Vue directives are usable the same way as in template with a few key differences:
1. You can use directives camelCased instead of kebab-cased (vMyDirective is treated as `v-my-directive`)
2. You have to use underscore sign instead of dots for modifiers because of JSXIdentifier limitation.
3. Only runtime directives work (only v-show and custom directives), compile-time directives are out of this project's scope.
A full example would be: `<MyComponent vMyDirective:argument_modifier1_modifier2={someExpression} />`

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
[
"area",
"base",
"br",
"col",
"embed",
"hr",
"img",
"input",
"link",
"menuitem",
"meta",
"param",
"source",
"track",
"wbr"
]

View File

@ -0,0 +1,120 @@
[
"a",
"abbr",
"address",
"area",
"article",
"aside",
"audio",
"b",
"base",
"bdi",
"bdo",
"blockquote",
"body",
"br",
"button",
"canvas",
"caption",
"cite",
"code",
"col",
"colgroup",
"data",
"datalist",
"dd",
"del",
"details",
"dfn",
"dialog",
"div",
"dl",
"dt",
"em",
"embed",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hgroup",
"hr",
"html",
"i",
"iframe",
"img",
"input",
"ins",
"kbd",
"keygen",
"label",
"legend",
"li",
"link",
"main",
"map",
"mark",
"math",
"menu",
"menuitem",
"meta",
"meter",
"nav",
"noscript",
"object",
"ol",
"optgroup",
"option",
"output",
"p",
"param",
"picture",
"pre",
"progress",
"q",
"rb",
"rp",
"rt",
"rtc",
"ruby",
"s",
"samp",
"script",
"section",
"select",
"slot",
"small",
"source",
"span",
"strong",
"style",
"sub",
"summary",
"sup",
"svg",
"table",
"tbody",
"td",
"template",
"textarea",
"tfoot",
"th",
"thead",
"time",
"title",
"tr",
"track",
"u",
"ul",
"var",
"video",
"wbr"
]

View File

@ -0,0 +1,2 @@
'use strict';
module.exports = require('./html-tags.json');

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,39 @@
{
"name": "html-tags",
"version": "2.0.0",
"description": "List of standard HTML tags",
"license": "MIT",
"repository": "sindresorhus/html-tags",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"void.js",
"html-tags.json",
"html-tags-void.json"
],
"keywords": [
"html",
"html5",
"tags",
"elements",
"list",
"whatwg",
"w3c",
"void",
"self-closing"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@ -0,0 +1,38 @@
# html-tags [![Build Status](https://travis-ci.org/sindresorhus/html-tags.svg?branch=master)](https://travis-ci.org/sindresorhus/html-tags)
> List of standard HTML tags
It's just a couple of JSON files that can be used in any environment.
It intentionally leaves out obsolete tags.
## Install
```
$ npm install html-tags
```
## Usage
```js
const htmlTags = require('html-tags');
console.log(htmlTags);
//=> ['a', 'abbr', 'acronym', ...]
```
And void (self-closing) tags:
```js
const voidHtmlTags = require('html-tags/void');
console.log(voidHtmlTags);
//=> ['area', 'base', 'br', ...]
```
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -0,0 +1,2 @@
'use strict';
module.exports = require('./html-tags-void.json');

View File

@ -0,0 +1,59 @@
{
"name": "@vue/babel-plugin-transform-vue-jsx",
"version": "1.4.0",
"description": "Babel plugin for Vue 2.0 JSX",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-plugin-transform-vue-jsx",
"author": "Evan You",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"pretest:snapshot": "yarn build:test",
"test:snapshot": "nyc --reporter=html --reporter=text-summary ava -v test/snapshot.js",
"build:dependency": "cd ../babel-helper-vue-jsx-merge-props && yarn build",
"pretest:functional": "yarn build:dependency && yarn build:test && nyc --reporter=html --reporter=text-summary babel test/functional.js --plugins ./dist/plugin.testing.js --out-file test/functional-compiled.js",
"test:functional": "ava -v test/functional-compiled.js",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"test": "rm -rf coverage* && yarn test:snapshot && mv coverage coverage-snapshot && yarn test:functional && mv coverage coverage-functional",
"prepublish": "yarn build"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"@vue/test-utils": "1.0.0-beta.26",
"ava": "^0.25.0",
"jsdom": "^13.0.0",
"jsdom-global": "^3.0.2",
"nyc": "^12.0.2",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-babel-minify": "^6.2.0",
"rollup-plugin-istanbul": "^2.0.1",
"vue": "^2.5.17",
"vue-template-compiler": "^2.5.17"
},
"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"@babel/plugin-syntax-jsx": "^7.2.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"html-tags": "^2.0.0",
"lodash.kebabcase": "^4.1.1",
"svg-tags": "^1.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

21
node_modules/@vue/babel-preset-app/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017-present, Yuxi (Evan) You
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

103
node_modules/@vue/babel-preset-app/README.md generated vendored Normal file
View File

@ -0,0 +1,103 @@
# @vue/babel-preset-app
This is the default Babel preset used in all Vue CLI projects. **Note: this preset is meant to be used exclusively in projects created via Vue CLI and does not consider external use cases.**
## Included Features
### [@babel/preset-env](https://new.babeljs.io/docs/en/next/babel-preset-env.html)
`preset-env` automatically determines the transforms and polyfills to apply based on your browser target. See [Browser Compatibility](https://cli.vuejs.org/guide/browser-compatibility.html) section in docs for more details.
- `modules: false`
- auto set to `'commonjs'` in Jest tests
- [`useBuiltIns: 'usage'`](#usebuiltins)
- `targets`:
- by default `@babel/preset-env` will use [`browserslist config sources`](https://github.com/browserslist/browserslist#queries) (browserslist key in package.json file is recommend) unless either the [`targets`](https://babeljs.io/docs/en/babel-preset-env#targets) or [`ignoreBrowserslistConfig`](https://babeljs.io/docs/en/babel-preset-env#ignorebrowserslistconfig) options are set.
- set to `{ node: 'current' }` when running unit tests in Node.js
- Includes `Promise` polyfill by default so that they are usable even in non-transpiled dependencies (only for environments that need it)
### Stage 3 or Below
Only the following stage 3 or below features are supported (object rest spread is supported as part of `preset-env`):
- [Dynamic Import Syntax](https://github.com/tc39/proposal-dynamic-import)
- [Proposal Class Properties](https://babeljs.io/docs/en/next/babel-plugin-proposal-class-properties.html)
- [Proposal Decorators (legacy)](https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html)
If you need additional stage 3 or below features, you need to install and configure it yourself.
### Vue JSX support
- [@babel/plugin-syntax-jsx](https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx)
- [@vue/babel-preset-jsx](https://github.com/vuejs/jsx)
### [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime)
`transform-runtime` avoids inlining helpers in every file. This is enabled for helpers only, since polyfills are handled by `babel-preset-env`.
## Options
- All options from [@babel/preset-env](https://babeljs.io/docs/en/next/babel-preset-env.html) are supported, with some of them having smarter defaults.
### modules
- Default:
- `false` when building with webpack
- `'commonjs'` when running tests in Jest.
Explicitly set `modules` option for `babel-preset-env`. See [babel-preset-env docs](https://github.com/babel/babel/tree/master/packages/babel-preset-env#modules) for more details.
### targets
- Default:
- `@vue/babel-preset-app` will use [`browserslist config sources`](https://github.com/browserslist/browserslist#queries) (browserslist key in package.json file is recommend) unless either the [`targets`](https://babeljs.io/docs/en/babel-preset-env#targets) or [`ignoreBrowserslistConfig`](https://babeljs.io/docs/en/babel-preset-env#ignorebrowserslistconfig) options are set.
- set to `{ node: 'current' }` when running unit tests in Node.js
Explicitly set `targets` option for `babel-preset-env`. See [babel-preset-env docs](https://github.com/babel/babel/tree/master/packages/babel-preset-env#targets) for more details.
### useBuiltIns
- Default: `'usage'`
- Allowed values: `'usage' | 'entry' | false`
Explicitly set `useBuiltIns` option for `babel-preset-env`.
The default value is `'usage'`, which adds imports to polyfills based on the usage in transpiled code. For example, if you use `Object.assign` in your code, the corresponding polyfill will be auto-imported if your target environment does not supports it.
If you are building a library or web component instead of an app, you probably want to set this to `false` and let the consuming app be responsible for the polyfills.
Note that the usage detection does not apply to your dependencies (which are excluded by `cli-plugin-babel` by default). If one of your dependencies need polyfills, you have a few options:
1. **If the dependency is written in an ES version that your target environments do not support:** Add that dependency to the `transpileDependencies` option in `vue.config.js`. This would enable both syntax transforms and usage-based polyfill detection for that dependency.
2. **If the dependency ships ES5 code and explicitly lists the polyfills needed:** you can pre-include the needed polyfills using the [polyfills](#polyfills) option for this preset.
3. **If the dependency ships ES5 code, but uses ES6+ features without explicitly listing polyfill requirements (e.g. Vuetify):** Use `useBuiltIns: 'entry'` and then add `import '@babel/polyfill'` to your entry file. This will import **ALL** polyfills based on your `browserslist` targets so that you don't need to worry about dependency polyfills anymore, but will likely increase your final bundle size with some unused polyfills.
See [@babel/preset-env docs](https://new.babeljs.io/docs/en/next/babel-preset-env.html#usebuiltins-usage) for more details.
### polyfills
- Default: `['es.array.iterator', 'es.promise', 'es.object.assign', 'es.promise.finally']`
A list of [core-js](https://github.com/zloirock/core-js) polyfills to pre-include when using `useBuiltIns: 'usage'`. **These polyfills are automatically excluded if they are not needed for your target environments**.
Use this option when you have 3rd party dependencies that are not processed by Babel but have specific polyfill requirements (e.g. Axios and Vuex require Promise support).
### jsx
- Default: `true`.
Set to `false` to disable JSX support. Or you can toggle [@vue/babel-preset-jsx](https://github.com/vuejs/jsx/tree/dev/packages/babel-preset-jsx) (or [@vue/babel-plugin-jsx](https://github.com/vuejs/jsx-next) for Vue 3 projects) features here.
### loose
- Default: `false`.
Setting this to `true` will generate code that is more performant but less spec-compliant.
### entryFiles
- Default: `[]`
Multi page repo use `entryFiles` to ensure inject polyfills to all entry file.

297
node_modules/@vue/babel-preset-app/index.js generated vendored Normal file
View File

@ -0,0 +1,297 @@
const path = require('path')
const semver = require('semver')
const defaultPolyfills = [
// promise polyfill alone doesn't work in IE,
// needs this as well. see: #1642
'es.array.iterator',
// this is required for webpack code splitting, vuex etc.
'es.promise',
// this is needed for object rest spread support in templates
// as vue-template-es2015-compiler 1.8+ compiles it to Object.assign() calls.
'es.object.assign',
// #2012 es.promise replaces native Promise in FF and causes missing finally
'es.promise.finally'
]
const {
default: getTargets,
isRequired
} = require('@babel/helper-compilation-targets')
function getIntersectionTargets (targets, constraintTargets) {
const intersection = Object.keys(constraintTargets).reduce(
(results, browser) => {
// exclude the browsers that the user does not need
if (!targets[browser]) {
return results
}
// if the user-specified version is higher the minimum version that supports esmodule, than use it
results[browser] = semver.gt(
semver.coerce(constraintTargets[browser]),
semver.coerce(targets[browser])
)
? constraintTargets[browser]
: targets[browser]
return results
},
{}
)
return intersection
}
function getModernTargets (targets) {
const allModernTargets = getTargets(
{ esmodules: true },
{ ignoreBrowserslistConfig: true }
)
// use the intersection of modern mode browsers and user defined targets config
const result = getIntersectionTargets(targets, allModernTargets)
// webpack 4 uses acorn 6, which does not support newer syntaxes such as optional chaining
// so we have to add samsung 12 as a target to force transpiling these syntaxes
// https://github.com/vuejs/vue-cli/issues/6449#issuecomment-828559068
result.samsung = '12.0.0'
return result
}
function getWCTargets (targets) {
// targeting browsers that at least support ES2015 classes
// https://github.com/babel/babel/blob/v7.9.6/packages/babel-compat-data/data/plugins.json#L194-L204
const allWCTargets = getTargets(
{
browsers: [
'Chrome >= 46',
'Firefox >= 45',
'Safari >= 10',
'Edge >= 13',
'iOS >= 10',
'Electron >= 0.36'
]
},
{ ignoreBrowserslistConfig: true }
)
// use the intersection of browsers supporting Web Components and user defined targets config
return getIntersectionTargets(targets, allWCTargets)
}
function getPolyfills (targets, includes) {
// if no targets specified, include all default polyfills
if (!targets || !Object.keys(targets).length) {
return includes
}
const compatData = require('core-js-compat').data
return includes.filter(item => {
if (!compatData[item]) {
throw new Error(`Cannot find polyfill ${item}, please refer to 'core-js-compat' for a complete list of available modules`)
}
return isRequired(item, targets, { compatData })
})
}
module.exports = (context, options = {}) => {
const presets = []
const plugins = []
const defaultEntryFiles = JSON.parse(process.env.VUE_CLI_ENTRY_FILES || '[]')
// Though in the vue-cli repo, we only use the two environment variables
// for tests, users may have relied on them for some features,
// dropping them may break some projects.
// So in the following blocks we don't directly test the `NODE_ENV`.
// Rather, we turn it into the two commonly used feature flags.
if (!process.env.VUE_CLI_TEST && process.env.NODE_ENV === 'test') {
// Both Jest & Mocha set NODE_ENV to 'test'.
// And both requires the `node` target.
process.env.VUE_CLI_BABEL_TARGET_NODE = 'true'
// Jest runs without bundling so it needs this.
// With the node target, tree shaking is not a necessity,
// so we set it for maximum compatibility.
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = 'true'
}
// JSX
if (options.jsx !== false) {
let jsxOptions = {}
if (typeof options.jsx === 'object') {
jsxOptions = options.jsx
}
let vueVersion = 2
try {
const Vue = require('vue')
vueVersion = semver.major(Vue.version)
} catch (e) {}
if (vueVersion === 2) {
presets.push([require('@vue/babel-preset-jsx'), jsxOptions])
} else if (vueVersion === 3) {
plugins.push([require('@vue/babel-plugin-jsx'), jsxOptions])
}
}
const runtimePath = path.dirname(require.resolve('@babel/runtime/package.json'))
const runtimeVersion = require('@babel/runtime/package.json').version
const {
polyfills: userPolyfills,
loose = false,
debug = false,
useBuiltIns = 'usage',
modules = false,
bugfixes = true,
targets: rawTargets,
spec,
ignoreBrowserslistConfig,
configPath,
include,
exclude,
shippedProposals,
forceAllTransforms,
decoratorsBeforeExport,
decoratorsLegacy,
// entry file list
entryFiles = defaultEntryFiles,
// Undocumented option of @babel/plugin-transform-runtime.
// When enabled, an absolute path is used when importing a runtime helper after transforming.
// This ensures the transpiled file always use the runtime version required in this package.
// However, this may cause hash inconsistency if the project is moved to another directory.
// So here we allow user to explicit disable this option if hash consistency is a requirement
// and the runtime version is sure to be correct.
absoluteRuntime = runtimePath,
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#version
// By default transform-runtime assumes that @babel/runtime@7.0.0-beta.0 is installed, which means helpers introduced later than 7.0.0-beta.0 will be inlined instead of imported.
// See https://github.com/babel/babel/issues/10261
// And https://github.com/facebook/docusaurus/pull/2111
version = runtimeVersion
} = options
// resolve targets for preset-env
let targets = getTargets(rawTargets, { ignoreBrowserslistConfig, configPath })
// Webpack 4 uses acorn 6 underlyingly;
// The highest ESLint version that Vue CLI v4 supports is 6.x;
// Both can only parse ES2019 syntax + BigInt at most.
// Thus, newer syntaxes such as optional chaining and nullish coalescing won't
// be accept by webpack / ESLint, and must be processed by Babel first.
// Chrome 79 is the last Chrome version that doesn't support these syntaxes.
// So the targets set by the user cannot be higher than Chrome 79.
if (!targets.chrome || semver.gt(targets.chrome, '79.0.0')) {
targets.chrome = '79.0.0'
}
if (process.env.VUE_CLI_BABEL_TARGET_NODE) {
// running tests in Node.js
targets = { node: '12' }
} else if (process.env.VUE_CLI_BUILD_TARGET === 'wc' || process.env.VUE_CLI_BUILD_TARGET === 'wc-async') {
// targeting browsers that at least support ES2015 classes
targets = getWCTargets(targets)
} else if (process.env.VUE_CLI_MODERN_BUILD) {
// targeting browsers that at least support <script type="module">
targets = getModernTargets(targets)
}
// included-by-default polyfills. These are common polyfills that 3rd party
// dependencies may rely on (e.g. Vuex relies on Promise), but since with
// useBuiltIns: 'usage' we won't be running Babel on these deps, they need to
// be force-included.
let polyfills
const buildTarget = process.env.VUE_CLI_BUILD_TARGET || 'app'
if (
buildTarget === 'app' &&
useBuiltIns === 'usage' &&
!process.env.VUE_CLI_BABEL_TARGET_NODE
) {
polyfills = getPolyfills(targets, userPolyfills || defaultPolyfills)
plugins.push([
require('./polyfillsPlugin'),
{ polyfills, entryFiles, useAbsolutePath: !!absoluteRuntime }
])
} else {
polyfills = []
}
const envOptions = {
bugfixes,
corejs: useBuiltIns ? require('core-js/package.json').version : false,
spec,
loose,
debug,
modules,
targets,
useBuiltIns,
ignoreBrowserslistConfig,
configPath,
include,
exclude: polyfills.concat(exclude || []),
shippedProposals,
forceAllTransforms
}
// cli-plugin-jest sets this to true because Jest runs without bundling
if (process.env.VUE_CLI_BABEL_TRANSPILE_MODULES) {
envOptions.modules = 'commonjs'
if (process.env.VUE_CLI_BABEL_TARGET_NODE) {
// necessary for dynamic import to work in tests
plugins.push(require('babel-plugin-dynamic-import-node'))
}
}
// pass options along to babel-preset-env
presets.unshift([require('@babel/preset-env'), envOptions])
// additional <= stage-3 plugins
// Babel 7 is removing stage presets altogether because people are using
// too many unstable proposals. Let's be conservative in the defaults here.
plugins.push(
require('@babel/plugin-syntax-dynamic-import'),
[require('@babel/plugin-proposal-decorators'), {
decoratorsBeforeExport,
legacy: decoratorsLegacy !== false
}],
[require('@babel/plugin-proposal-class-properties'), { loose }]
)
// transform runtime, but only for helpers
plugins.push([require('@babel/plugin-transform-runtime'), {
regenerator: useBuiltIns !== 'usage',
// polyfills are injected by preset-env & polyfillsPlugin, so no need to add them again
corejs: false,
helpers: useBuiltIns === 'usage',
useESModules: !process.env.VUE_CLI_BABEL_TRANSPILE_MODULES,
absoluteRuntime,
version
}])
return {
sourceType: 'unambiguous',
overrides: [{
exclude: [/@babel[\/|\\\\]runtime/, /core-js/],
presets,
plugins
}, {
// there are some untranspiled code in @babel/runtime
// https://github.com/babel/babel/issues/9903
include: [/@babel[\/|\\\\]runtime/],
presets: [
[require('@babel/preset-env'), envOptions]
]
}]
}
}
// a special flag to tell @vue/cli-plugin-babel to include @babel/runtime for transpilation
// otherwise the above `include` option won't take effect
process.env.VUE_CLI_TRANSPILE_BABEL_RUNTIME = true

56
node_modules/@vue/babel-preset-app/package.json generated vendored Normal file
View File

@ -0,0 +1,56 @@
{
"name": "@vue/babel-preset-app",
"version": "4.5.19",
"description": "babel-preset-app for vue-cli",
"main": "index.js",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/babel-preset-app"
},
"keywords": [
"vue",
"cli"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue-cli/issues"
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/babel-preset-app#readme",
"dependencies": {
"@babel/core": "^7.11.0",
"@babel/helper-compilation-targets": "^7.9.6",
"@babel/helper-module-imports": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-jsx": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"@babel/runtime": "^7.11.0",
"@vue/babel-plugin-jsx": "^1.0.3",
"@vue/babel-preset-jsx": "^1.2.4",
"babel-plugin-dynamic-import-node": "^2.3.3",
"core-js": "^3.6.5",
"core-js-compat": "^3.6.5",
"semver": "^6.1.0"
},
"peerDependencies": {
"@babel/core": "*",
"core-js": "^3",
"vue": "^2 || ^3.0.0-0"
},
"peerDependenciesMeta": {
"core-js": {
"optional": true
},
"vue": {
"optional": true
}
},
"gitHead": "bef7a67566585876d56fa0e41b364675467bba8f"
}

43
node_modules/@vue/babel-preset-app/polyfillsPlugin.js generated vendored Normal file
View File

@ -0,0 +1,43 @@
const { addSideEffect } = require('@babel/helper-module-imports')
// slightly modifiled from @babel/preset-env/src/utils
// use an absolute path for core-js modules, to fix conflicts of different core-js versions
// TODO: remove the `useAbsolutePath` option in v5,
// because `core-js` is sure to be present in newer projects;
// we only need absolute path for babel runtime helpers, not for polyfills
function getModulePath (mod, useAbsolutePath) {
const modPath =
mod === 'regenerator-runtime'
? 'regenerator-runtime/runtime'
: `core-js/modules/${mod}`
return useAbsolutePath ? require.resolve(modPath) : modPath
}
function createImport (path, mod, useAbsolutePath) {
return addSideEffect(path, getModulePath(mod, useAbsolutePath))
}
// add polyfill imports to the first file encountered.
module.exports = (
{ types },
{ polyfills, entryFiles = [], useAbsolutePath }
) => {
return {
name: 'vue-cli-inject-polyfills',
visitor: {
Program (path, state) {
if (!entryFiles.includes(state.filename)) {
return
}
// imports are injected in reverse order
polyfills
.slice()
.reverse()
.forEach(p => {
createImport(path, p, useAbsolutePath)
})
}
}
}
}

56
node_modules/@vue/babel-preset-jsx/README.md generated vendored Normal file
View File

@ -0,0 +1,56 @@
## @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`, but it will redirect to `'vue'` itself when the vue version is `2.7.x`
- When set to `vue-demi`, it will always import the composition utilities from `vue-demi`
- When set to an object like `{ importSource: string; }`, it will always import the composition utilities from the importSource you set
- `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

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","naruto"].includes(f)&&(h="vue"),"vue-demi"===f&&(h="vue-demi"),["auto",!0].includes(f))try{const a=require("vue/package.json").version;a.startsWith("2.7")&&(h="vue")}catch(a){}"object"==typeof f&&f.importSource&&(h=f.importSource),g=[babelSugarCompositionApiInjectH,{importSource:h}]}return{plugins:[b&&babelSugarFunctionalVue,c&&g,d&&babelSugarVModel,e&&babelSugarVOn,f&&[babelSugarCompositionApiRenderInstance,{importSource:h}],babelPluginTransformVueJsx].filter(Boolean)}};module.exports=index;

42
node_modules/@vue/babel-preset-jsx/package.json generated vendored Normal file
View File

@ -0,0 +1,42 @@
{
"name": "@vue/babel-preset-jsx",
"version": "1.4.0",
"description": "Babel preset for Vue JSX",
"main": "dist/plugin.cjs.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-preset-jsx",
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"build": "rollup -c",
"prerelease": "yarn build"
},
"dependencies": {
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.4.0",
"@vue/babel-sugar-composition-api-inject-h": "^1.4.0",
"@vue/babel-sugar-composition-api-render-instance": "^1.4.0",
"@vue/babel-sugar-functional-vue": "^1.4.0",
"@vue/babel-sugar-inject-h": "^1.4.0",
"@vue/babel-sugar-v-model": "^1.4.0",
"@vue/babel-sugar-v-on": "^1.4.0"
},
"devDependencies": {
"rollup": "^0.67.4",
"rollup-plugin-babel-minify": "^6.2.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0",
"vue": "*"
},
"peerDependenciesMeta": {
"vue": {
"optional": true
}
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

View File

@ -0,0 +1,54 @@
## @vue/babel-sugar-composition-api-inject-h
> Ported from [luwanquan/babel-preset-vca-jsx](https://github.com/luwanquan/babel-preset-vca-jsx) by [@luwanquan](https://github.com/luwanquan)
Syntactic sugar for automatic `h` inject in JSX with @vue/composition-api.
### Babel Compatibility Notes
- This repo is only compatible with Babel 7.x
### Usage
Install the dependencies:
```sh
# for yarn:
yarn add @vue/babel-sugar-composition-api-inject-h
# for npm:
npm install @vue/babel-sugar-composition-api-inject-h --save
```
In your `.babelrc`:
```json
{
"plugins": ["@vue/babel-sugar-composition-api-inject-h"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
This plugin automatically injects `h` in every method that has JSX. By using this plugin you don't have to always import `h` from `@vue/composition-api`.
```js
// Without @vue/babel-sugar-inject-h
import { h } from '@vue/composition-api'
export default {
setup() {
return () => <button />
},
}
```
```js
// With @vue/babel-sugar-inject-h
export default {
setup() {
return () => <button />
},
}
```

View File

@ -0,0 +1 @@
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var syntaxJsx=_interopDefault(require("@babel/plugin-syntax-jsx"));const hasJSX=(e,t)=>{const n={hasJSX:!1};t.traverse({JSXElement(){this.hasJSX=!0}},n);return n.hasJSX},remove$createElement=(e,t)=>{t.traverse({ObjectMethod(t){"setup"===t.node.key.name&&t.traverse({VariableDeclaration(t){t.traverse({MemberExpression(n){e.isThisExpression(n.node.object)&&e.isIdentifier(n.node.property)&&"$createElement"===n.node.property.name&&t.remove()}})}})}})},autoImportH=(e,t,n)=>{if(hasJSX(e,t)){const i=t.get("body").filter(e=>e.isImportDeclaration()).map(e=>e.node),o=i.filter(e=>e.source.value===n),r=o.some(t=>t.specifiers.some(t=>e.isImportSpecifier(t)&&"h"===t.local.name));if(!r){const i=e.importSpecifier(e.identifier("h"),e.identifier("h"));o.length>0?o[0].specifiers.push(i):t.unshiftContainer("body",e.importDeclaration([i],e.stringLiteral(n)))}}};var index=(e,{importSource:importSource="@vue/composition-api"}={})=>{const t=e.types;return{inherits:syntaxJsx,visitor:{Program(e){remove$createElement(t,e),autoImportH(t,e,importSource)}}}};module.exports=index;

View File

@ -0,0 +1,46 @@
{
"name": "@vue/babel-sugar-composition-api-inject-h",
"version": "1.4.0",
"description": "Babel syntactic sugar for h automatic injection for Vue JSX with @vue/composition-api",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-composition-api-inject-h",
"author": "luwanquan <luwanquan@f-road.com.cn>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"prepublish": "yarn build",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"pretest": "yarn build:test",
"test": "nyc --reporter=html --reporter=text-summary ava -v test/test.js"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"ava": "^0.25.0",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-uglify-es": "^0.0.1",
"vue": "^2.5.17"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.2.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

View File

@ -0,0 +1,78 @@
## @vue/babel-sugar-composition-api-render-instance
> Ported from [luwanquan/babel-preset-vca-jsx](https://github.com/luwanquan/babel-preset-vca-jsx) by [@luwanquan](https://github.com/luwanquan)
Babel syntactic sugar for replacing `this` with `getCurrentInstance()` in Vue JSX with @vue/composition-api
### Babel Compatibility Notes
- This repo is only compatible with Babel 7.x
### Usage
Install the dependencies:
```sh
# for yarn:
yarn add @vue/babel-sugar-composition-api-render-instance
# for npm:
npm install @vue/babel-sugar-composition-api-render-instance --save
```
In your `.babelrc`:
```json
{
"plugins": ["@vue/babel-sugar-composition-api-render-instance"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
This plugin automatically replaces `this` in `setup()` with `getCurrentInstance()`. This is required for JSX to work in @vue/composition-api as `this` is not available in `setup()`
Input:
```jsx
defineComponent({
setup() {
return () => <MyComponent vModel={a.b} />
}
})
```
Output (without @vue/babel-sugar-composition-api-render-instance):
```jsx
defineComponent({
setup() {
return () => <MyComponent model={{
value: a.b,
callback: $$v => {
this.$set(a, "b", $$v);
}
}} />
}
})
```
Output (with @vue/babel-sugar-composition-api-render-instance):
```jsx
import { getCurrentInstance } from "@vue/composition-api";
defineComponent({
setup() {
const __currentInstance = getCurrentInstance();
return () => <MyComponent model={{
value: a.b,
callback: $$v => {
__currentInstance.$set(a, "b", $$v);
}
}} />
}
})
```

View File

@ -0,0 +1 @@
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var syntaxJsx=_interopDefault(require("@babel/plugin-syntax-jsx"));const autoImportGetCurrentInstance=(e,t,n)=>{const i=t.get("body").filter(e=>e.isImportDeclaration()).map(e=>e.node);const r=i.filter(e=>e.source.value===n);const o=r.some(t=>t.specifiers.some(t=>e.isImportSpecifier(t)&&"getCurrentInstance"===t.local.name));if(!o){const i=e.importSpecifier(e.identifier("getCurrentInstance"),e.identifier("getCurrentInstance"));r.length>0?r[0].specifiers.push(i):t.unshiftContainer("body",e.importDeclaration([i],e.stringLiteral(n)))}},injectInstanceId="__currentInstance";var index=({types:t},{importSource:importSource="@vue/composition-api"}={})=>({inherits:syntaxJsx,visitor:{Program(e){e.traverse({"ObjectMethod|ObjectProperty"(n){if("setup"===n.node.key.name){let i=!1;n.traverse({JSXAttribute(r){const o=r.get("name");["v-on","on-input","on-change","model"].includes(o.node.name)&&r.traverse({MemberExpression(r){const o=r.get("object"),s=r.get("property");t.isThisExpression(o)&&t.isIdentifier(s)&&["$","_"].includes(s.node.name[0])&&(autoImportGetCurrentInstance(t,e,importSource),i||(n.node.value.body.body.unshift(t.variableDeclaration("const",[t.variableDeclarator(t.identifier(injectInstanceId),t.callExpression(t.identifier("getCurrentInstance"),[]))])),i=!0),o.replaceWith(t.identifier(injectInstanceId)))}})}})}}})}}});module.exports=index;

View File

@ -0,0 +1,46 @@
{
"name": "@vue/babel-sugar-composition-api-render-instance",
"version": "1.4.0",
"description": "Babel syntactic sugar for replaceing `this` with `getCurrentInstance()` in Vue JSX with @vue/composition-api",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-composition-api-render-instance",
"author": "luwanquan <luwanquan@f-road.com.cn>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"prepublish": "yarn build",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"pretest": "yarn build:test && cd ../babel-sugar-v-model && yarn build:test",
"test": "nyc --reporter=html --reporter=text-summary ava -v test/test.js"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"ava": "^0.25.0",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-uglify-es": "^0.0.1",
"vue": "^2.5.17"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.2.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

56
node_modules/@vue/babel-sugar-functional-vue/README.md generated vendored Normal file
View File

@ -0,0 +1,56 @@
## @vue/babel-sugar-functional-vue
Syntactic sugar for functional components.
### 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-sugar-functional-vue
# for npm:
npm install @vue/babel-sugar-functional-vue --save
```
In your `.babelrc`:
```json
{
"plugins": ["@vue/babel-sugar-functional-vue"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
This plugin transpiles arrow functions that return JSX into functional components but only if it's an uppercase variable declaration or default export:
```js
// Original:
export const A = ({ props, listeners }) => <div onClick={listeners.click}>{props.msg}</div>
export const b = ({ props, listeners }) => <div onClick={listeners.click}>{props.msg}</div>
export default ({ props, listeners }) => <div onClick={listeners.click}>{props.msg}</div>
// Result:
export const A = {
functional: true,
render: (h, {
props,
listeners
}) => <div onClick={listeners.click}>{props.msg}</div>
}
export const b = ({ props, listeners }) => <div onClick={listeners.click}>{props.msg}</div>
export default {
functional: true,
render: (h, {
props,
listeners
}) => <div onClick={listeners.click}>{props.msg}</div>
}
```

View File

@ -0,0 +1,12 @@
"use strict";function _interopDefault(a){return a&&"object"==typeof a&&"default"in a?a["default"]:a}var syntaxJsx=_interopDefault(require("@babel/plugin-syntax-jsx"));/**
* Check if expression is in method
* @param t
* @param path
* @param parentLimitPath
* @returns boolean
*/const isInMethod=(a,b,c)=>!!(b&&b!==c)&&(!!a.isObjectMethod(b)||isInMethod(a,b.parentPath,c)),hasJSX=(a,b)=>{let c=!1;return b.traverse({JSXElement(d){isInMethod(a,d,b)||(c=!0)}}),c},isFunctionalComponentDeclarator=(a,b)=>{const c=b.get("id.name").node[0];return!("A">c||"Z"<c)&&hasJSX(a,b)},convertFunctionalComponent=(a,b,c=null)=>{const d=[a.identifier("h"),...b.node.params],e=b.node.body,f=[a.objectProperty(a.identifier("functional"),a.booleanLiteral(!0)),a.objectProperty(a.identifier("render"),a.arrowFunctionExpression(d,e))];"development"===process.env.NODE_ENV&&c&&f.unshift(a.objectProperty(a.identifier("name"),a.stringLiteral(c))),b.replaceWith(a.objectExpression(f))};/**
* Check path has JSX
* @param t
* @param path
* @returns boolean
*/var index=a=>{const b=a.types;return{inherits:syntaxJsx,visitor:{Program(a){a.traverse({ExportDefaultDeclaration:{exit(a){b.isArrowFunctionExpression(a.node.declaration)&&hasJSX(b,a)&&convertFunctionalComponent(b,a.get("declaration"))}},VariableDeclaration:{exit(a){if(1===a.node.declarations.length&&b.isVariableDeclarator(a.node.declarations[0])&&b.isArrowFunctionExpression(a.node.declarations[0].init)){const c=a.get("declarations")[0];if(isFunctionalComponentDeclarator(b,c)){const c=a.node.declarations[0].id.name;convertFunctionalComponent(b,a.get("declarations")[0].get("init"),c)}}}}})}}}};module.exports=index;

View File

@ -0,0 +1,46 @@
{
"name": "@vue/babel-sugar-functional-vue",
"version": "1.4.0",
"description": "Babel syntactic sugar for functional components",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-functional-vue",
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"prepublish": "yarn build",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"pretest": "yarn build:test && cd ../babel-plugin-transform-vue-jsx && yarn build:test",
"test": "nyc --reporter=html --reporter=text-summary ava -v test/test.js"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"ava": "^0.25.0",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-babel-minify": "^6.2.0",
"rollup-plugin-istanbul": "^2.0.1",
"vue": "^2.5.17"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.2.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

48
node_modules/@vue/babel-sugar-inject-h/README.md generated vendored Normal file
View File

@ -0,0 +1,48 @@
## @vue/babel-sugar-inject-h
Syntactic sugar for automatic `h` inject in JSX.
### 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-sugar-inject-h
# for npm:
npm install @vue/babel-sugar-inject-h --save
```
In your `.babelrc`:
```json
{
"plugins": ["@vue/babel-sugar-inject-h"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
This plugin automatically injects `h` in every method that has JSX. By using this plugin you don't have to always specifically declare `h` as first parameter in your `render()` function.
```js
// Without @vue/babel-sugar-inject-h
export default {
render (h) {
return <button />
}
}
// With @vue/babel-sugar-inject-h
export default {
render () {
return <button />
}
}
```

View File

@ -0,0 +1 @@
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var syntaxJsx=_interopDefault(require("@babel/plugin-syntax-jsx"));const firstParamIsH=(e,n)=>{const t=n.get("params");return t.length&&e.isIdentifier(t[0])&&"h"===t[0].node.name},hasJSX=(e,n)=>{const t={hasJSX:!1};n.traverse({JSXElement(){this.hasJSX=!0}},t);return t.hasJSX},isInsideJSXExpression=(e,n)=>{if(!n.parentPath)return!1;if(e.isJSXExpressionContainer(n.parentPath))return!0;return isInsideJSXExpression(e,n.parentPath)};var index=e=>{const n=e.types;return{inherits:syntaxJsx,visitor:{Program(e){e.traverse({"ObjectMethod|ClassMethod"(e){if(!firstParamIsH(n,e)&&hasJSX(n,e)&&!isInsideJSXExpression(n,e)){const t="render"===e.node.key.name;e.get("body").unshiftContainer("body",n.variableDeclaration("const",[n.variableDeclarator(n.identifier("h"),t?n.memberExpression(n.identifier("arguments"),n.numericLiteral(0),!0):n.memberExpression(n.thisExpression(),n.identifier("$createElement")))]))}}})}}}};module.exports=index;

46
node_modules/@vue/babel-sugar-inject-h/package.json generated vendored Normal file
View File

@ -0,0 +1,46 @@
{
"name": "@vue/babel-sugar-inject-h",
"version": "1.4.0",
"description": "Babel syntactic sugar for h automatic injection for Vue JSX",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-inject-h",
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"prepublish": "yarn build",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"pretest": "yarn build:test && cd ../babel-plugin-transform-vue-jsx && yarn build:test",
"test": "nyc --reporter=html --reporter=text-summary ava -v test/test.js"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"ava": "^0.25.0",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-uglify-es": "^0.0.1",
"vue": "^2.5.17"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.2.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

51
node_modules/@vue/babel-sugar-v-model/README.md generated vendored Normal file
View File

@ -0,0 +1,51 @@
## @vue/babel-sugar-v-model
Syntactic sugar for v-model in JSX.
### 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-sugar-v-model
# for npm:
npm install @vue/babel-sugar-v-model --save
```
In your `.babelrc`:
```json
{
"plugins": ["@vue/babel-sugar-v-model"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
This plugin adds v-model to the JSX and tries to mirror the same behaviour as in vue-template-compiler, with a few differences:
1. You should use underscore (`_`) instead of dot (`.`) for modifiers (`vModel_trim={this.test}`)
2. It is recommended to use camelCase version of it (`vModel`) in JSX, but you can use kebab-case too (`v-model`).
```js
export default {
data: () => ({
test: 'Hello World',
}),
render(h) {
return (
<div>
<input type="text" vModel_trim={this.test} />
{this.test}
</div>
)
},
}
```

1
node_modules/@vue/babel-sugar-v-model/dist/plugin.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,63 @@
declare namespace camelcase {
interface Options {
/**
Uppercase the first character: `foo-bar` → `FooBar`.
@default false
*/
readonly pascalCase?: boolean;
}
}
declare const camelcase: {
/**
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
@param input - String to convert to camel case.
@example
```
import camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
*/
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function camelcase(
// input: string | ReadonlyArray<string>,
// options?: camelcase.Options
// ): string;
// export = camelcase;
default: typeof camelcase;
};
export = camelcase;

View File

@ -0,0 +1,76 @@
'use strict';
const preserveCamelCase = string => {
let isLastCharLower = false;
let isLastCharUpper = false;
let isLastLastCharUpper = false;
for (let i = 0; i < string.length; i++) {
const character = string[i];
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
string = string.slice(0, i) + '-' + string.slice(i);
isLastCharLower = false;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = true;
i++;
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = false;
isLastCharLower = true;
} else {
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
}
}
return string;
};
const camelCase = (input, options) => {
if (!(typeof input === 'string' || Array.isArray(input))) {
throw new TypeError('Expected the input to be `string | string[]`');
}
options = Object.assign({
pascalCase: false
}, options);
const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
if (Array.isArray(input)) {
input = input.map(x => x.trim())
.filter(x => x.length)
.join('-');
} else {
input = input.trim();
}
if (input.length === 0) {
return '';
}
if (input.length === 1) {
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
}
const hasUpperCase = input !== input.toLowerCase();
if (hasUpperCase) {
input = preserveCamelCase(input);
}
input = input
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
.replace(/\d+(\w|$)/g, m => m.toUpperCase());
return postProcess(input);
};
module.exports = camelCase;
// TODO: Remove this for the next major release
module.exports.default = camelCase;

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,43 @@
{
"name": "camelcase",
"version": "5.3.1",
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
"license": "MIT",
"repository": "sindresorhus/camelcase",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert",
"pascalcase",
"pascal-case"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
}

View File

@ -0,0 +1,99 @@
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
```
$ npm install camelcase
```
## Usage
```js
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
## API
### camelCase(input, [options])
#### input
Type: `string` `string[]`
String to convert to camel case.
#### options
Type: `Object`
##### pascalCase
Type: `boolean`<br>
Default: `false`
Uppercase the first character: `foo-bar``FooBar`
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Related
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -0,0 +1,17 @@
[
"area",
"base",
"br",
"col",
"embed",
"hr",
"img",
"input",
"link",
"menuitem",
"meta",
"param",
"source",
"track",
"wbr"
]

View File

@ -0,0 +1,120 @@
[
"a",
"abbr",
"address",
"area",
"article",
"aside",
"audio",
"b",
"base",
"bdi",
"bdo",
"blockquote",
"body",
"br",
"button",
"canvas",
"caption",
"cite",
"code",
"col",
"colgroup",
"data",
"datalist",
"dd",
"del",
"details",
"dfn",
"dialog",
"div",
"dl",
"dt",
"em",
"embed",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"header",
"hgroup",
"hr",
"html",
"i",
"iframe",
"img",
"input",
"ins",
"kbd",
"keygen",
"label",
"legend",
"li",
"link",
"main",
"map",
"mark",
"math",
"menu",
"menuitem",
"meta",
"meter",
"nav",
"noscript",
"object",
"ol",
"optgroup",
"option",
"output",
"p",
"param",
"picture",
"pre",
"progress",
"q",
"rb",
"rp",
"rt",
"rtc",
"ruby",
"s",
"samp",
"script",
"section",
"select",
"slot",
"small",
"source",
"span",
"strong",
"style",
"sub",
"summary",
"sup",
"svg",
"table",
"tbody",
"td",
"template",
"textarea",
"tfoot",
"th",
"thead",
"time",
"title",
"tr",
"track",
"u",
"ul",
"var",
"video",
"wbr"
]

View File

@ -0,0 +1,2 @@
'use strict';
module.exports = require('./html-tags.json');

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,39 @@
{
"name": "html-tags",
"version": "2.0.0",
"description": "List of standard HTML tags",
"license": "MIT",
"repository": "sindresorhus/html-tags",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"void.js",
"html-tags.json",
"html-tags-void.json"
],
"keywords": [
"html",
"html5",
"tags",
"elements",
"list",
"whatwg",
"w3c",
"void",
"self-closing"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

View File

@ -0,0 +1,38 @@
# html-tags [![Build Status](https://travis-ci.org/sindresorhus/html-tags.svg?branch=master)](https://travis-ci.org/sindresorhus/html-tags)
> List of standard HTML tags
It's just a couple of JSON files that can be used in any environment.
It intentionally leaves out obsolete tags.
## Install
```
$ npm install html-tags
```
## Usage
```js
const htmlTags = require('html-tags');
console.log(htmlTags);
//=> ['a', 'abbr', 'acronym', ...]
```
And void (self-closing) tags:
```js
const voidHtmlTags = require('html-tags/void');
console.log(voidHtmlTags);
//=> ['area', 'base', 'br', ...]
```
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -0,0 +1,2 @@
'use strict';
module.exports = require('./html-tags-void.json');

60
node_modules/@vue/babel-sugar-v-model/package.json generated vendored Normal file
View File

@ -0,0 +1,60 @@
{
"name": "@vue/babel-sugar-v-model",
"version": "1.4.0",
"description": "Babel syntactic sugar for v-model support in Vue JSX",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-v-model",
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"pretest:snapshot": "yarn build:test",
"test:snapshot": "nyc --reporter=html --reporter=text-summary ava -v test/snapshot.js",
"build:dependency": "cd ../babel-plugin-transform-vue-jsx && yarn build",
"pretest:functional": "yarn build:dependency && yarn build:test && nyc --reporter=html --reporter=text-summary babel test/functional.js --plugins ./dist/plugin.testing.js,../babel-plugin-transform-vue-jsx/dist/plugin.js,@babel/plugin-transform-arrow-functions --out-file test/functional-compiled.js",
"test:functional": "ava -v test/functional-compiled.js",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"test": "rm -rf coverage* && yarn test:snapshot && mv coverage coverage-snapshot && yarn test:functional && mv coverage coverage-functional",
"prepublish": "yarn build"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/plugin-transform-arrow-functions": "^7.12.1",
"@babel/preset-env": "^7.2.0",
"@vue/test-utils": "1.0.0-beta.26",
"ava": "^0.25.0",
"jsdom": "^13.0.0",
"jsdom-global": "^3.0.2",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-uglify-es": "^0.0.1",
"vue": "^2.5.17",
"vue-template-compiler": "^2.5.17"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.2.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.4.0",
"camelcase": "^5.0.0",
"html-tags": "^2.0.0",
"svg-tags": "^1.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

52
node_modules/@vue/babel-sugar-v-on/README.md generated vendored Normal file
View File

@ -0,0 +1,52 @@
## @vue/babel-sugar-v-on
Syntactic sugar for v-on in JSX.
### 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-sugar-v-on
# for npm:
npm install @vue/babel-sugar-v-on --save
```
In your `.babelrc`:
```json
{
"plugins": ["@vue/babel-sugar-v-on"]
}
```
However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.
### Details
This plugin adds v-on to the JSX and tries to mirror the same behaviour as in vue-template-compiler, with a few differences:
1. You should use underscore (`_`) instead of dot (`.`) for modifiers (`vOn:click_prevent={this.test}`)
2. It is recommended to use camelCase version of it (`vOn`) in JSX, but you can use kebab-case too (`v-on`).
```js
export default {
methods: {
test() {
console.log('Hello World')
},
},
render(h) {
return (
<div>
<a href="https://vuejs.org" vOn:click={this.test}>Vue</a>
</div>
)
},
}
```

1
node_modules/@vue/babel-sugar-v-on/dist/plugin.js generated vendored Normal file
View File

@ -0,0 +1 @@
"use strict";function _interopDefault(a){return a&&"object"==typeof a&&"default"in a?a["default"]:a}var camelCase=_interopDefault(require("camelcase")),syntaxJsx=_interopDefault(require("@babel/plugin-syntax-jsx"));const cachedCamelCase=(()=>{const a=Object.create(null);return b=>(a[b]||(a[b]=camelCase(b)),a[b])})(),equalCamel=(a,b)=>a===b||a===cachedCamelCase(b),keyModifiers=["ctrl","shift","alt","meta"],keyCodes={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},keyNames={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:" ",up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete"]};function index(a){function b(a){return p.ifStatement(a,p.returnStatement(p.nullLiteral()))}function c(a,b=[]){return p.callExpression(a,b)}function d(a){return p.memberExpression(p.identifier("$event"),p.identifier(a))}function e(a){return p.unaryExpression("!",a)}function f(a,b){return p.binaryExpression("!==",a,b)}function g(a,b){return p.logicalExpression("&&",a,b)}function h(a,b){return p.logicalExpression("||",a,b)}function i(){return p.binaryExpression("in",p.stringLiteral("button"),p.identifier("$event"))}function j(a){return p.arrowFunctionExpression([p.identifier("$event")],p.blockStatement(a instanceof Array?a:[a]))}function k(a){const b=a.get("name");let c=p.isJSXNamespacedName(b)?`${b.get("namespace.name").node}:${b.get("name.name").node}`:b.get("name").node;camelCase(c);let d,e;if([c,...d]=c.split("_"),[c,e]=c.split(":"),!equalCamel(c,"v-on")||!e)return{isInvalid:!1};if(!p.isJSXExpressionContainer(a.get("value")))throw new Error("Only expression container is allowed on v-on directive.");const f=a.get("value.expression");return{expression:f.node,modifiers:d,event:e}}function l(a){let{modifiers:e,isInvalid:f,expression:g,event:i}=k(a);"click"===i&&e.includes("right")&&(e=e.filter(a=>"right"!==a),i="contextmenu"),"click"===i&&e.includes("middle")&&(i="mouseup");let l=!1;if(f)return;if(!e||0===e.length)return{event:i,expression:g,isNative:l};const n=[],o=[],r=[];for(const c of e)if(q[c]){const a=q[c]();o.push(p.isExpression(a)?p.expressionStatement(a):a),keyCodes[c]&&r.push(c)}else if("exact"===c)o.push(b(keyModifiers.filter(a=>!e.includes(a)).map(a=>d(a+"Key")).reduce((a,b)=>a?h(a,b):b)));else if("capture"===c||"once"===c||"passive"===c)continue;else"native"===c?l=!0:r.push(c);return(-1<e.indexOf("capture")&&(i="!"+i),-1<e.indexOf("once")&&(i="~"+i),-1<e.indexOf("passive")&&(i="&"+i),r.length&&n.push(m(r)),o.length&&n.push(...o),0===n.length)?{event:i,expression:g,isNative:l}:(n.push(p.returnStatement(c(g,[p.identifier("$event")]))),{event:i,expression:j(n),isNative:l})}function m(a){return b(a.map(n).reduce((a,b)=>g(a,b),e(i())))}function n(a){const b=parseInt(a,10);if(b)return f(d("keyCode"),p.numericLiteral(b));const c=keyCodes[a],e=keyNames[a];return p.callExpression(p.memberExpression(p.thisExpression(),p.identifier("_k")),[d("keyCode"),p.stringLiteral(`${a}`),c?Array.isArray(c)?p.arrayExpression(c.map(a=>p.numericLiteral(a))):p.numericLiteral(c):p.identifier("undefined"),d("key"),e?Array.isArray(e)?p.arrayExpression(e.map(a=>p.stringLiteral(a))):p.stringLiteral(`${e}`):p.identifier("undefined")])}function o(a,b,c,d){"~"!==a[0]&&"!"!==a[0]&&"&"!==a[0]?d.push(p.jSXAttribute(p.jSXIdentifier(`${c?"nativeOn":"on"}-${a}`),p.jSXExpressionContainer(b))):d.push(p.jSXSpreadAttribute(p.objectExpression([p.objectProperty(p.identifier("on"),p.objectExpression([p.objectProperty(p.stringLiteral(a),b)]))])))}const p=a.types,q={stop:()=>c(d("stopPropagation")),prevent:()=>c(d("preventDefault")),self:()=>b(f(d("target"),d("currentTarget"))),ctrl:()=>b(e(d("ctrlKey"))),shift:()=>b(e(d("shiftKey"))),alt:()=>b(e(d("altKey"))),meta:()=>b(e(d("metaKey"))),left:()=>b(g(i(),f(d("button"),p.numericLiteral(0)))),middle:()=>b(g(i(),f(d("button"),p.numericLiteral(1)))),right:()=>b(g(i(),f(d("button"),p.numericLiteral(2))))};return{inherits:syntaxJsx,visitor:{Program(a){a.traverse({JSXAttribute(a){const{event:b,expression:c,isNative:d}=l(a);b&&(a.remove(),o(b,c,d,a.parentPath.node.attributes))}})}}}}module.exports=index;

View File

@ -0,0 +1,63 @@
declare namespace camelcase {
interface Options {
/**
Uppercase the first character: `foo-bar` → `FooBar`.
@default false
*/
readonly pascalCase?: boolean;
}
}
declare const camelcase: {
/**
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
@param input - String to convert to camel case.
@example
```
import camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
*/
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function camelcase(
// input: string | ReadonlyArray<string>,
// options?: camelcase.Options
// ): string;
// export = camelcase;
default: typeof camelcase;
};
export = camelcase;

View File

@ -0,0 +1,76 @@
'use strict';
const preserveCamelCase = string => {
let isLastCharLower = false;
let isLastCharUpper = false;
let isLastLastCharUpper = false;
for (let i = 0; i < string.length; i++) {
const character = string[i];
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
string = string.slice(0, i) + '-' + string.slice(i);
isLastCharLower = false;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = true;
i++;
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = false;
isLastCharLower = true;
} else {
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
isLastLastCharUpper = isLastCharUpper;
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
}
}
return string;
};
const camelCase = (input, options) => {
if (!(typeof input === 'string' || Array.isArray(input))) {
throw new TypeError('Expected the input to be `string | string[]`');
}
options = Object.assign({
pascalCase: false
}, options);
const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
if (Array.isArray(input)) {
input = input.map(x => x.trim())
.filter(x => x.length)
.join('-');
} else {
input = input.trim();
}
if (input.length === 0) {
return '';
}
if (input.length === 1) {
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
}
const hasUpperCase = input !== input.toLowerCase();
if (hasUpperCase) {
input = preserveCamelCase(input);
}
input = input
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
.replace(/\d+(\w|$)/g, m => m.toUpperCase());
return postProcess(input);
};
module.exports = camelCase;
// TODO: Remove this for the next major release
module.exports.default = camelCase;

View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,43 @@
{
"name": "camelcase",
"version": "5.3.1",
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
"license": "MIT",
"repository": "sindresorhus/camelcase",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert",
"pascalcase",
"pascal-case"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.1",
"xo": "^0.24.0"
}
}

View File

@ -0,0 +1,99 @@
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
```
$ npm install camelcase
```
## Usage
```js
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('Foo-Bar', {pascalCase: true});
//=> 'FooBar'
camelCase('--foo.bar', {pascalCase: false});
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase(['foo', 'bar']);
//=> 'fooBar'
camelCase(['__foo__', '--bar'], {pascalCase: true});
//=> 'FooBar'
```
## API
### camelCase(input, [options])
#### input
Type: `string` `string[]`
String to convert to camel case.
#### options
Type: `Object`
##### pascalCase
Type: `boolean`<br>
Default: `false`
Uppercase the first character: `foo-bar``FooBar`
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Related
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

58
node_modules/@vue/babel-sugar-v-on/package.json generated vendored Normal file
View File

@ -0,0 +1,58 @@
{
"name": "@vue/babel-sugar-v-on",
"version": "1.4.0",
"description": "Babel syntactic sugar for v-model support in Vue JSX",
"main": "dist/plugin.js",
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-v-on",
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
"license": "MIT",
"private": false,
"publishConfig": {
"access": "public"
},
"files": [],
"scripts": {
"pretest:snapshot": "yarn build:test",
"test:snapshot": "nyc --reporter=html --reporter=text-summary ava -v test/snapshot.js",
"build:dependency": "cd ../babel-plugin-transform-vue-jsx && yarn build",
"pretest:functional": "yarn build:dependency && yarn build:test && nyc --reporter=html --reporter=text-summary babel test/functional.js --plugins ./dist/plugin.testing.js,../babel-plugin-transform-vue-jsx/dist/plugin.js,@babel/plugin-transform-arrow-functions --out-file test/functional-compiled.js",
"test:functional": "ava -v test/functional-compiled.js",
"build": "rollup -c",
"build:test": "rollup -c rollup.config.testing.js",
"test": "rm -rf coverage* && yarn test:snapshot && mv coverage coverage-snapshot && yarn test:functional && mv coverage coverage-functional",
"prepublish": "yarn build"
},
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0",
"@babel/plugin-transform-arrow-functions": "^7.12.1",
"@babel/preset-env": "^7.2.0",
"@vue/test-utils": "1.0.0-beta.26",
"ava": "^0.25.0",
"jsdom": "^13.0.0",
"jsdom-global": "^3.0.2",
"ninos": "^2.0.2",
"nyc": "^13.1.0",
"rollup": "^0.67.4",
"rollup-plugin-babel": "4.0.3",
"rollup-plugin-babel-minify": "^6.2.0",
"rollup-plugin-istanbul": "^2.0.1",
"vue": "^2.5.17",
"vue-template-compiler": "^2.5.17"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.2.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.4.0",
"camelcase": "^5.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"nyc": {
"exclude": [
"dist",
"test"
]
},
"gitHead": "6566e12067f5d6c02d3849b574a1b84de5634008"
}

21
node_modules/@vue/cli-overlay/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017-present, Yuxi (Evan) You
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

3
node_modules/@vue/cli-overlay/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# @vue/cli-overlay
> overlay for vue-cli

29
node_modules/@vue/cli-overlay/package.json generated vendored Normal file
View File

@ -0,0 +1,29 @@
{
"name": "@vue/cli-overlay",
"version": "4.5.19",
"description": "error overlay & dev server middleware for vue-cli",
"main": "dist/client.js",
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-overlay"
},
"keywords": [
"vue",
"cli",
"cli-overlay"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue-cli/issues"
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-overlay#readme",
"publishConfig": {
"access": "public"
},
"gitHead": "bef7a67566585876d56fa0e41b364675467bba8f"
}

21
node_modules/@vue/cli-plugin-babel/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017-present, Yuxi (Evan) You
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

41
node_modules/@vue/cli-plugin-babel/README.md generated vendored Normal file
View File

@ -0,0 +1,41 @@
# @vue/cli-plugin-babel
> babel plugin for vue-cli
## Configuration
Uses Babel 7 + `babel-loader` + [@vue/babel-preset-app](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app) by default, but can be configured via `babel.config.js` to use any other Babel presets or plugins.
By default, `babel-loader` excludes files inside `node_modules` dependencies. If you wish to explicitly transpile a dependency module, you will need to add it to the `transpileDependencies` option in `vue.config.js`:
``` js
module.exports = {
transpileDependencies: [
// can be string or regex
'my-dep',
/other-dep/
]
}
```
## Caching
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/babel-loader`.
## Parallelization
[thread-loader](https://github.com/webpack-contrib/thread-loader) is enabled by default when the machine has more than 1 CPU cores. This can be turned off by setting `parallel: false` in `vue.config.js`.
`parallel` should be set to `false` when using Babel in combination with non-serializable loader options, such as regexes, dates and functions. These options would not be passed correctly to `babel-loader` which may lead to unexpected errors.
## Installing in an Already Created Project
``` sh
vue add babel
```
## Injected webpack-chain Rules
- `config.rule('js')`
- `config.rule('js').use('babel-loader')`
- `config.rule('js').use('cache-loader')`

View File

@ -0,0 +1,41 @@
module.exports = function (fileInfo, api) {
const j = api.jscodeshift
const root = j(fileInfo.source)
const useDoubleQuote = root.find(j.Literal).some(({ node }) => node.raw.startsWith('"'))
root
.find(j.Literal, { value: '@vue/app' })
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
root
.find(j.Literal, { value: '@vue/babel-preset-app' })
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
const templateLiterals = root
.find(j.TemplateLiteral, {
expressions: { length: 0 }
})
templateLiterals
.find(j.TemplateElement, {
value: {
cooked: '@vue/app'
}
})
.closest(j.TemplateLiteral)
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
templateLiterals
.find(j.TemplateElement, {
value: {
cooked: '@vue/babel-preset-app'
}
})
.closest(j.TemplateLiteral)
.replaceWith(j.stringLiteral('@vue/cli-plugin-babel/preset'))
return root.toSource({
lineTerminator: '\n',
quote: useDoubleQuote ? 'double' : 'single'
})
}

16
node_modules/@vue/cli-plugin-babel/generator.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
module.exports = api => {
// Most likely you want to overwrite the whole config to ensure it's working
// without conflicts, e.g. for a project that used Jest without Babel.
// It should be rare for the user to have their own special babel config
// without using the Babel plugin already.
delete api.generator.files['babel.config.js']
api.extendPackage({
babel: {
presets: ['@vue/cli-plugin-babel/preset']
},
dependencies: {
'core-js': '^3.6.5'
}
})
}

92
node_modules/@vue/cli-plugin-babel/index.js generated vendored Normal file
View File

@ -0,0 +1,92 @@
const path = require('path')
const babel = require('@babel/core')
const { isWindows } = require('@vue/cli-shared-utils')
function genTranspileDepRegex (transpileDependencies) {
const deps = transpileDependencies.map(dep => {
if (typeof dep === 'string') {
const depPath = path.join('node_modules', dep, '/')
return isWindows
? depPath.replace(/\\/g, '\\\\') // double escape for windows style path
: depPath
} else if (dep instanceof RegExp) {
return dep.source
}
})
return deps.length ? new RegExp(deps.join('|')) : null
}
module.exports = (api, options) => {
const useThreads = process.env.NODE_ENV === 'production' && !!options.parallel
const cliServicePath = path.dirname(require.resolve('@vue/cli-service'))
const transpileDepRegex = genTranspileDepRegex(options.transpileDependencies)
// try to load the project babel config;
// if the default preset is used,
// there will be a VUE_CLI_TRANSPILE_BABEL_RUNTIME env var set.
// the `filename` field is required
// in case there're filename-related options like `ignore` in the user config
babel.loadPartialConfigSync({ filename: api.resolve('src/main.js') })
api.chainWebpack(webpackConfig => {
webpackConfig.resolveLoader.modules.prepend(path.join(__dirname, 'node_modules'))
const jsRule = webpackConfig.module
.rule('js')
.test(/\.m?jsx?$/)
.exclude
.add(filepath => {
// always transpile js in vue files
if (/\.vue\.jsx?$/.test(filepath)) {
return false
}
// exclude dynamic entries from cli-service
if (filepath.startsWith(cliServicePath)) {
return true
}
// only include @babel/runtime when the @vue/babel-preset-app preset is used
if (
process.env.VUE_CLI_TRANSPILE_BABEL_RUNTIME &&
filepath.includes(path.join('@babel', 'runtime'))
) {
return false
}
// check if this is something the user explicitly wants to transpile
if (transpileDepRegex && transpileDepRegex.test(filepath)) {
return false
}
// Don't transpile node_modules
return /node_modules/.test(filepath)
})
.end()
.use('cache-loader')
.loader(require.resolve('cache-loader'))
.options(api.genCacheConfig('babel-loader', {
'@babel/core': require('@babel/core/package.json').version,
'@vue/babel-preset-app': require('@vue/babel-preset-app/package.json').version,
'babel-loader': require('babel-loader/package.json').version,
modern: !!process.env.VUE_CLI_MODERN_BUILD,
browserslist: api.service.pkg.browserslist
}, [
'babel.config.js',
'.browserslistrc'
]))
.end()
if (useThreads) {
const threadLoaderConfig = jsRule
.use('thread-loader')
.loader(require.resolve('thread-loader'))
if (typeof options.parallel === 'number') {
threadLoaderConfig.options({ workers: options.parallel })
}
}
jsRule
.use('babel-loader')
.loader(require.resolve('babel-loader'))
})
}

BIN
node_modules/@vue/cli-plugin-babel/logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

24
node_modules/@vue/cli-plugin-babel/migrator/index.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
const { chalk } = require('@vue/cli-shared-utils')
module.exports = api => {
api.transformScript(
'babel.config.js',
require('../codemods/usePluginPreset')
)
if (api.fromVersion('^3')) {
api.extendPackage(
{
dependencies: {
'core-js': '^3.6.5'
}
},
{ warnIncompatibleVersions: false }
)
// TODO: implement a codemod to migrate polyfills
api.exitLog(`core-js has been upgraded from v2 to v3.
If you have any custom polyfills defined in ${chalk.yellow('babel.config.js')}, please be aware their names may have been changed.
For more complete changelog, see https://github.com/zloirock/core-js/blob/master/CHANGELOG.md#300---20190319`)
}
}

41
node_modules/@vue/cli-plugin-babel/package.json generated vendored Normal file
View File

@ -0,0 +1,41 @@
{
"name": "@vue/cli-plugin-babel",
"version": "4.5.19",
"description": "babel plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-babel"
},
"keywords": [
"vue",
"cli",
"babel"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue-cli/issues"
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-babel#readme",
"dependencies": {
"@babel/core": "^7.11.0",
"@vue/babel-preset-app": "^4.5.19",
"@vue/cli-shared-utils": "^4.5.19",
"babel-loader": "^8.1.0",
"cache-loader": "^4.1.0",
"thread-loader": "^2.1.3",
"webpack": "^4.0.0"
},
"peerDependencies": {
"@vue/cli-service": "^3.0.0 || ^4.0.0-0"
},
"devDependencies": {
"jscodeshift": "^0.10.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "bef7a67566585876d56fa0e41b364675467bba8f"
}

1
node_modules/@vue/cli-plugin-babel/preset.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('@vue/babel-preset-app')

21
node_modules/@vue/cli-plugin-eslint/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017-present, Yuxi (Evan) You
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

76
node_modules/@vue/cli-plugin-eslint/README.md generated vendored Normal file
View File

@ -0,0 +1,76 @@
# @vue/cli-plugin-eslint
> eslint plugin for vue-cli
## Injected Commands
- **`vue-cli-service lint`**
```
Usage: vue-cli-service lint [options] [...files]
Options:
--format [formatter] specify formatter (default: codeframe)
--no-fix do not fix errors
--max-errors specify number of errors to make build failed (default: 0)
--max-warnings specify number of warnings to make build failed (default: Infinity)
```
Lints and fixes files. If no specific files are given, it lints all files in `src` and `tests`.
Other [ESLint CLI options](https://eslint.org/docs/user-guide/command-line-interface#options) are also supported.
## Configuration
ESLint can be configured via `.eslintrc` or the `eslintConfig` field in `package.json`. See the [ESLint configuration docs](https://eslint.org/docs/user-guide/configuring) for more detail.
::: tip
The following option is under the section of [`vue.config.js`](https://cli.vuejs.org/config/#vue-config-js). It is respected only when `@vue/cli-plugin-eslint` is installed.
:::
Lint-on-save during development with `eslint-loader` is enabled by default. It can be disabled with the `lintOnSave` option in `vue.config.js`:
``` js
module.exports = {
lintOnSave: false
}
```
When set to `true`, `eslint-loader` will emit lint errors as warnings. By default, warnings are only logged to the terminal and does not fail the compilation.
To make lint errors show up in the browser overlay, you can use `lintOnSave: 'error'`. This will force `eslint-loader` to always emit errors. this also means lint errors will now cause the compilation to fail.
Alternatively, you can configure the overlay to display both warnings and errors:
``` js
// vue.config.js
module.exports = {
devServer: {
overlay: {
warnings: true,
errors: true
}
}
}
```
When `lintOnSave` is a truthy value, `eslint-loader` will be applied in both development and production. If you want to disable `eslint-loader` during production build, you can use the following config:
``` js
// vue.config.js
module.exports = {
lintOnSave: process.env.NODE_ENV !== 'production'
}
```
## Installing in an Already Created Project
``` sh
vue add eslint
```
## Injected webpack-chain Rules
- `config.module.rule('eslint')`
- `config.module.rule('eslint').use('eslint-loader')`

49
node_modules/@vue/cli-plugin-eslint/eslintDeps.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
const DEPS_MAP = {
base: {
eslint: '^6.7.2',
'eslint-plugin-vue': '^6.2.2'
},
airbnb: {
'@vue/eslint-config-airbnb': '^5.0.2',
'eslint-plugin-import': '^2.20.2'
},
prettier: {
'@vue/eslint-config-prettier': '^6.0.0',
'eslint-plugin-prettier': '^3.3.1',
prettier: '^2.2.1'
},
standard: {
'@vue/eslint-config-standard': '^5.1.2',
'eslint-plugin-import': '^2.20.2',
'eslint-plugin-node': '^11.1.0',
'eslint-plugin-promise': '^4.2.1',
'eslint-plugin-standard': '^4.0.0'
},
typescript: {
'@vue/eslint-config-typescript': '^7.0.0',
'@typescript-eslint/eslint-plugin': '^4.18.0',
'@typescript-eslint/parser': '^4.18.0'
}
}
exports.DEPS_MAP = DEPS_MAP
exports.getDeps = function (api, preset, rootOptions = {}) {
const deps = Object.assign({}, DEPS_MAP.base, DEPS_MAP[preset])
if (rootOptions.vueVersion === '3') {
Object.assign(deps, { 'eslint-plugin-vue': '^7.0.0' })
}
if (api.hasPlugin('typescript')) {
Object.assign(deps, DEPS_MAP.typescript)
}
if (api.hasPlugin('babel') && !api.hasPlugin('typescript')) {
Object.assign(deps, {
'babel-eslint': '^10.1.0'
})
}
return deps
}

66
node_modules/@vue/cli-plugin-eslint/eslintOptions.js generated vendored Normal file
View File

@ -0,0 +1,66 @@
exports.config = (api, preset, rootOptions = {}) => {
const config = {
root: true,
env: { node: true },
extends: ['plugin:vue/essential'],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': makeJSOnlyValue(`process.env.NODE_ENV === 'production' ? 'warn' : 'off'`),
'no-debugger': makeJSOnlyValue(`process.env.NODE_ENV === 'production' ? 'warn' : 'off'`)
}
}
if (api.hasPlugin('babel') && !api.hasPlugin('typescript')) {
config.parserOptions = {
parser: 'babel-eslint'
}
}
if (preset === 'airbnb') {
config.extends.push('@vue/airbnb')
} else if (preset === 'standard') {
config.extends.push('@vue/standard')
} else if (preset === 'prettier') {
config.extends.push(...['eslint:recommended', '@vue/prettier'])
} else {
// default
config.extends.push('eslint:recommended')
}
if (api.hasPlugin('typescript')) {
// typically, typescript ruleset should be appended to the end of the `extends` array
// but that is not the case for prettier, as there are conflicting rules
if (preset === 'prettier') {
config.extends.pop()
config.extends.push(...['@vue/typescript/recommended', '@vue/prettier', '@vue/prettier/@typescript-eslint'])
} else {
config.extends.push('@vue/typescript/recommended')
}
}
if (rootOptions.vueVersion === '3') {
const updateConfig = cfg =>
cfg.replace(
/plugin:vue\/(essential|recommended|strongly-recommended)/gi,
'plugin:vue/vue3-$1'
)
config.extends = config.extends.map(updateConfig)
}
return config
}
// __expression is a special flag that allows us to customize stringification
// output when extracting configs into standalone files
function makeJSOnlyValue (str) {
const fn = () => {}
fn.__expression = str
return fn
}
const baseExtensions = ['.js', '.jsx', '.vue']
exports.extensions = api => api.hasPlugin('typescript')
? baseExtensions.concat('.ts', '.tsx')
: baseExtensions

105
node_modules/@vue/cli-plugin-eslint/generator/index.js generated vendored Normal file
View File

@ -0,0 +1,105 @@
const fs = require('fs')
const path = require('path')
module.exports = (api, { config, lintOn = [] }, rootOptions, invoking) => {
const eslintConfig = require('../eslintOptions').config(api, config, rootOptions)
const devDependencies = require('../eslintDeps').getDeps(api, config, rootOptions)
const pkg = {
scripts: {
lint: 'vue-cli-service lint'
},
eslintConfig,
devDependencies
}
const editorConfigTemplatePath = path.resolve(__dirname, `./template/${config}/_editorconfig`)
if (fs.existsSync(editorConfigTemplatePath)) {
if (fs.existsSync(api.resolve('.editorconfig'))) {
// Append to existing .editorconfig
api.render(files => {
const editorconfig = fs.readFileSync(editorConfigTemplatePath, 'utf-8')
files['.editorconfig'] += `\n${editorconfig}`
})
} else {
api.render(`./template/${config}`)
}
}
if (typeof lintOn === 'string') {
lintOn = lintOn.split(',')
}
if (!lintOn.includes('save')) {
pkg.vue = {
lintOnSave: false // eslint-loader configured in runtime plugin
}
}
if (lintOn.includes('commit')) {
Object.assign(pkg.devDependencies, {
'lint-staged': '^9.5.0'
})
pkg.gitHooks = {
'pre-commit': 'lint-staged'
}
const extensions = require('../eslintOptions').extensions(api)
.map(ext => ext.replace(/^\./, '')) // remove the leading `.`
pkg['lint-staged'] = {
[`*.{${extensions.join(',')}}`]: ['vue-cli-service lint', 'git add']
}
}
api.extendPackage(pkg)
// invoking only
if (invoking) {
if (api.hasPlugin('unit-mocha')) {
// eslint-disable-next-line node/no-extraneous-require
require('@vue/cli-plugin-unit-mocha/generator').applyESLint(api)
} else if (api.hasPlugin('unit-jest')) {
// eslint-disable-next-line node/no-extraneous-require
require('@vue/cli-plugin-unit-jest/generator').applyESLint(api)
}
}
// lint & fix after create to ensure files adhere to chosen config
// for older versions that do not support the `hooks` feature
try {
api.assertCliVersion('^4.0.0-beta.0')
} catch (e) {
if (config && config !== 'base') {
api.onCreateComplete(() => {
require('../lint')({ silent: true }, api)
})
}
}
}
// In PNPM v4, due to their implementation of the module resolution mechanism,
// put require('../lint') in the callback would raise a "Module not found" error,
// But we cannot cache the file outside the callback,
// because the node_module layout may change after the "intall additional dependencies"
// phase, thus making the cached module fail to execute.
// FIXME: at the moment we have to catch the bug and silently fail. Need to fix later.
module.exports.hooks = (api) => {
// lint & fix after create to ensure files adhere to chosen config
api.afterAnyInvoke(() => {
try {
require('../lint')({ silent: true }, api)
} catch (e) {}
})
}
// exposed for the typescript plugin
module.exports.applyTS = api => {
api.extendPackage({
eslintConfig: {
extends: ['@vue/typescript'],
parserOptions: {
parser: '@typescript-eslint/parser'
}
},
devDependencies: require('../eslintDeps').DEPS_MAP.typescript
})
}

View File

@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

View File

@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

85
node_modules/@vue/cli-plugin-eslint/index.js generated vendored Normal file
View File

@ -0,0 +1,85 @@
const path = require('path')
module.exports = (api, options) => {
if (options.lintOnSave) {
const extensions = require('./eslintOptions').extensions(api)
// Use loadModule to allow users to customize their ESLint dependency version.
const { resolveModule, loadModule } = require('@vue/cli-shared-utils')
const cwd = api.getCwd()
const eslintPkg =
loadModule('eslint/package.json', cwd, true) ||
loadModule('eslint/package.json', __dirname, true)
// eslint-loader doesn't bust cache when eslint config changes
// so we have to manually generate a cache identifier that takes the config
// into account.
const { cacheIdentifier } = api.genCacheConfig(
'eslint-loader',
{
'eslint-loader': require('eslint-loader/package.json').version,
eslint: eslintPkg.version
},
[
'.eslintrc.js',
'.eslintrc.yaml',
'.eslintrc.yml',
'.eslintrc.json',
'.eslintrc',
'.eslintignore',
'package.json'
]
)
api.chainWebpack(webpackConfig => {
const { lintOnSave } = options
const allWarnings = lintOnSave === true || lintOnSave === 'warning'
const allErrors = lintOnSave === 'error'
webpackConfig.module
.rule('eslint')
.pre()
.exclude
.add(/node_modules/)
.add(path.dirname(require.resolve('@vue/cli-service')))
.end()
.test(/\.(vue|(j|t)sx?)$/)
.use('eslint-loader')
.loader(require.resolve('eslint-loader'))
.options({
extensions,
cache: true,
cacheIdentifier,
emitWarning: allWarnings,
// only emit errors in production mode.
emitError: allErrors,
eslintPath: path.dirname(
resolveModule('eslint/package.json', cwd) ||
resolveModule('eslint/package.json', __dirname)
),
formatter: loadModule('eslint/lib/formatters/codeframe', cwd, true)
})
})
}
api.registerCommand(
'lint',
{
description: 'lint and fix source files',
usage: 'vue-cli-service lint [options] [...files]',
options: {
'--format [formatter]': 'specify formatter (default: codeframe)',
'--no-fix': 'do not fix errors or warnings',
'--no-fix-warnings': 'fix errors, but do not fix warnings',
'--max-errors [limit]':
'specify number of errors to make build failed (default: 0)',
'--max-warnings [limit]':
'specify number of warnings to make build failed (default: Infinity)'
},
details:
'For more options, see https://eslint.org/docs/user-guide/command-line-interface#options'
},
args => {
require('./lint')(args, api)
}
)
}

142
node_modules/@vue/cli-plugin-eslint/lint.js generated vendored Normal file
View File

@ -0,0 +1,142 @@
const fs = require('fs')
const globby = require('globby')
const renamedArrayArgs = {
ext: 'extensions',
env: 'envs',
global: 'globals',
rulesdir: 'rulePaths',
plugin: 'plugins',
'ignore-pattern': 'ignorePattern'
}
const renamedArgs = {
'inline-config': 'allowInlineConfig',
rule: 'rules',
eslintrc: 'useEslintrc',
c: 'configFile',
config: 'configFile'
}
module.exports = function lint (args = {}, api) {
const path = require('path')
const cwd = api.resolve('.')
const { log, done, exit, chalk, loadModule } = require('@vue/cli-shared-utils')
const { CLIEngine } = loadModule('eslint', cwd, true) || require('eslint')
const extensions = require('./eslintOptions').extensions(api)
const argsConfig = normalizeConfig(args)
const config = Object.assign({
extensions,
fix: true,
cwd
}, argsConfig)
const noFixWarnings = (argsConfig.fixWarnings === false)
const noFixWarningsPredicate = (lintResult) => lintResult.severity === 2
config.fix = config.fix && (noFixWarnings ? noFixWarningsPredicate : true)
if (!fs.existsSync(api.resolve('.eslintignore')) && !config.ignorePattern) {
// .eslintrc.js files (ignored by default)
// However, we need to lint & fix them so as to make the default generated project's
// code style consistent with user's selected eslint config.
// Though, if users provided their own `.eslintignore` file, we don't want to
// add our own customized ignore pattern here (in eslint, ignorePattern is
// an addition to eslintignore, i.e. it can't be overridden by user),
// following the principle of least astonishment.
config.ignorePattern = [
'!.*.js',
'!{src,tests}/**/.*.js'
]
}
const engine = new CLIEngine(config)
const defaultFilesToLint = [
'src',
'tests',
// root config files
'*.js',
'.*.js'
]
.filter(pattern =>
globby
.sync(pattern, { cwd, absolute: true })
.some(p => !engine.isPathIgnored(p))
)
const files = args._ && args._.length
? args._
: defaultFilesToLint
// mock process.cwd before executing
// See:
// https://github.com/vuejs/vue-cli/issues/2554
// https://github.com/benmosher/eslint-plugin-import/issues/602
// https://github.com/eslint/eslint/issues/11218
const processCwd = process.cwd
if (!api.invoking) {
process.cwd = () => cwd
}
const report = engine.executeOnFiles(files)
process.cwd = processCwd
const formatter = engine.getFormatter(args.format || 'codeframe')
if (config.fix) {
CLIEngine.outputFixes(report)
}
const maxErrors = argsConfig.maxErrors || 0
const maxWarnings = typeof argsConfig.maxWarnings === 'number' ? argsConfig.maxWarnings : Infinity
const isErrorsExceeded = report.errorCount > maxErrors
const isWarningsExceeded = report.warningCount > maxWarnings
if (!isErrorsExceeded && !isWarningsExceeded) {
if (!args.silent) {
const hasFixed = report.results.some(f => f.output)
if (hasFixed) {
log(`The following files have been auto-fixed:`)
log()
report.results.forEach(f => {
if (f.output) {
log(` ${chalk.blue(path.relative(cwd, f.filePath))}`)
}
})
log()
}
if (report.warningCount || report.errorCount) {
console.log(formatter(report.results))
} else {
done(hasFixed ? `All lint errors auto-fixed.` : `No lint errors found!`)
}
}
} else {
console.log(formatter(report.results))
if (isErrorsExceeded && typeof argsConfig.maxErrors === 'number') {
log(`Eslint found too many errors (maximum: ${argsConfig.maxErrors}).`)
}
if (isWarningsExceeded) {
log(`Eslint found too many warnings (maximum: ${argsConfig.maxWarnings}).`)
}
exit(1)
}
}
function normalizeConfig (args) {
const config = {}
for (const key in args) {
if (renamedArrayArgs[key]) {
config[renamedArrayArgs[key]] = args[key].split(',')
} else if (renamedArgs[key]) {
config[renamedArgs[key]] = args[key]
} else if (key !== '_') {
config[camelize(key)] = args[key]
}
}
return config
}
function camelize (str) {
return str.replace(/-(\w)/g, (_, c) => c ? c.toUpperCase() : '')
}

BIN
node_modules/@vue/cli-plugin-eslint/logo.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

75
node_modules/@vue/cli-plugin-eslint/migrator/index.js generated vendored Normal file
View File

@ -0,0 +1,75 @@
const inquirer = require('inquirer')
const { semver } = require('@vue/cli-shared-utils')
module.exports = async (api) => {
const pkg = require(api.resolve('package.json'))
let localESLintRange = pkg.devDependencies.eslint
// if project is scaffolded by Vue CLI 3.0.x or earlier,
// the ESLint dependency (ESLint v4) is inside @vue/cli-plugin-eslint;
// in Vue CLI v4 it should be extracted to the project dependency list.
if (api.fromVersion('^3') && !localESLintRange) {
localESLintRange = '^4.19.1'
api.extendPackage({
devDependencies: {
eslint: localESLintRange,
'babel-eslint': '^8.2.5',
'eslint-plugin-vue': '^4.5.0'
}
})
}
const localESLintMajor = semver.major(
semver.maxSatisfying(['4.99.0', '5.99.0', '6.99.0', '7.99.0'], localESLintRange) ||
// in case the user does not specify a typical caret range;
// it is used as **fallback** because the user may have not previously
// installed eslint yet, such as in the case that they are from v3.0.x
require('eslint/package.json').version
)
if (localESLintMajor >= 6) {
return
}
const { confirmUpgrade } = await inquirer.prompt([{
name: 'confirmUpgrade',
type: 'confirm',
message:
`Your current ESLint version is v${localESLintMajor}.\n` +
`The latest major version which supported by vue-cli is v6.\n` +
`Do you want to upgrade? (May contain breaking changes)\n`
}])
if (confirmUpgrade) {
const { getDeps } = require('../eslintDeps')
const newDeps = getDeps(api)
if (pkg.devDependencies['@vue/eslint-config-airbnb']) {
Object.assign(newDeps, getDeps(api, 'airbnb'))
}
if (pkg.devDependencies['@vue/eslint-config-standard']) {
Object.assign(newDeps, getDeps(api, 'standard'))
}
if (pkg.devDependencies['@vue/eslint-config-prettier']) {
Object.assign(newDeps, getDeps(api, 'prettier'))
}
api.extendPackage({ devDependencies: newDeps }, { warnIncompatibleVersions: false })
// in case anyone's upgrading from the legacy `typescript-eslint-parser`
if (api.hasPlugin('typescript')) {
api.extendPackage({
eslintConfig: {
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
})
}
// TODO:
// transform `@vue/prettier` to `eslint:recommended` + `@vue/prettier`
// transform `@vue/typescript` to `@vue/typescript/recommended` and also fix prettier compatibility for it
}
}

38
node_modules/@vue/cli-plugin-eslint/package.json generated vendored Normal file
View File

@ -0,0 +1,38 @@
{
"name": "@vue/cli-plugin-eslint",
"version": "4.5.19",
"description": "eslint plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-eslint"
},
"keywords": [
"vue",
"cli",
"eslint"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vue-cli/issues"
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-eslint#readme",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^4.5.19",
"eslint-loader": "^2.2.1",
"globby": "^9.2.0",
"inquirer": "^7.1.0",
"webpack": "^4.0.0",
"yorkie": "^2.0.0"
},
"peerDependencies": {
"@vue/cli-service": "^3.0.0 || ^4.0.0-0",
"eslint": ">= 1.6.0 < 7.0.0"
},
"gitHead": "bef7a67566585876d56fa0e41b364675467bba8f"
}

50
node_modules/@vue/cli-plugin-eslint/prompts.js generated vendored Normal file
View File

@ -0,0 +1,50 @@
// these prompts are used if the plugin is late-installed into an existing
// project and invoked by `vue invoke`.
const { chalk, hasGit } = require('@vue/cli-shared-utils')
module.exports = [
{
name: 'config',
type: 'list',
message: `Pick an ESLint config:`,
choices: [
{
name: 'Error prevention only',
value: 'base',
short: 'Basic'
},
{
name: 'Airbnb',
value: 'airbnb',
short: 'Airbnb'
},
{
name: 'Standard',
value: 'standard',
short: 'Standard'
},
{
name: 'Prettier',
value: 'prettier',
short: 'Prettier'
}
]
},
{
name: 'lintOn',
type: 'checkbox',
message: 'Pick additional lint features:',
choices: [
{
name: 'Lint on save',
value: 'save',
checked: true
},
{
name: 'Lint and fix on commit' + (hasGit() ? '' : chalk.red(' (requires Git)')),
value: 'commit'
}
]
}
]

Some files were not shown because too many files have changed in this diff Show More